Core/Spells: ported CastSpell unclusterfucking from 3.3.5 branch

This commit is contained in:
Ovahlord committed 2020-11-04 22:37:11 +01:00
1 parent 7e637971ee
commit 754c138f89
157 files changed
+1195 -1223

No files matched your search

+28 -17
View File
@@ -1692,7 +1692,11 @@ void Player::ProcessDelayedOperations()
SetPower(POWER_ECLIPSE, 0);
if (uint32 aura = _resurrectionData->Aura)
CastSpell(this, aura, true, nullptr, nullptr, _resurrectionData->GUID);
{
CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SetOriginalCaster(_resurrectionData->GUID);
CastSpell(this, aura, args);
}
SpawnCorpseBones();
}
@@ -7676,7 +7680,7 @@ void Player::ApplyItemObtainSpells(Item* item, bool apply)
if (apply)
{
if (!HasAura(spellId))
CastSpell(this, spellId, true, item);
CastSpell(this, spellId, item);
}
else
RemoveAurasDueToSpell(spellId);
@@ -7752,7 +7756,7 @@ void Player::ApplyEquipSpell(SpellInfo const* spellInfo, Item* item, bool apply,
TC_LOG_DEBUG("entities.player", "Player::ApplyEquipSpell: Player '%s' (%s) cast %s equip spell (ID: %i)",
GetName().c_str(), GetGUID().ToString().c_str(), (item ? "item" : "itemset"), spellInfo->Id);
CastSpell(this, spellInfo, true, item);
CastSpell(this, spellInfo->Id, item);
}
else
{
@@ -7890,7 +7894,7 @@ void Player::CastItemCombatSpell(DamageInfo const& damageInfo, Item* item, ItemT
chance = GetWeaponProcChance();
if (roll_chance_f(chance))
CastSpell(damageInfo.GetVictim(), spellInfo->Id, true, item);
CastSpell(damageInfo.GetVictim(), spellInfo->Id, item);
}
}
@@ -7952,9 +7956,9 @@ void Player::CastItemCombatSpell(DamageInfo const& damageInfo, Item* item, ItemT
if (roll_chance_f(chance))
{
if (spellInfo->IsPositive())
CastSpell(this, spellInfo, true, item);
CastSpell(this, spellInfo->Id, item);
else
CastSpell(damageInfo.GetVictim(), spellInfo, true, item);
CastSpell(damageInfo.GetVictim(), spellInfo->Id, item);
}
}
}
@@ -7981,7 +7985,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8
spell->m_CastItem = item;
spell->m_cast_count = cast_count; //set count of casts
spell->SetSpellValue(SPELLVALUE_BASE_POINT0, learning_spell_id);
spell->prepare(&targets);
spell->prepare(targets);
return;
}
@@ -8006,7 +8010,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8
spell->m_CastItem = item;
spell->m_cast_count = cast_count; // set count of casts
spell->m_glyphIndex = glyphIndex; // glyph index
spell->prepare(&targets);
spell->prepare(targets);
return;
}
@@ -8036,7 +8040,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8
spell->m_CastItem = item;
spell->m_cast_count = cast_count; // set count of casts
spell->m_glyphIndex = glyphIndex; // glyph index
spell->prepare(&targets);
spell->prepare(targets);
return;
}
}
@@ -13429,11 +13433,14 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool
}
}
}
CastSpellExtraArgs args(item);
// Cast custom spell vs all equal basepoints got from enchant_amount
if (basepoints)
CastCustomSpell(this, enchant_spell_id, &basepoints, &basepoints, &basepoints, true, item);
else
CastSpell(this, enchant_spell_id, true, item);
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
args.SpellValueOverrides.AddMod(SpellValueMod(SPELLVALUE_BASE_POINT0 + i), basepoints);
CastSpell(this, enchant_spell_id, args);
}
else
RemoveAurasDueToItemSpell(enchant_spell_id, item->GetGUID());
@@ -14057,7 +14064,7 @@ void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 men
break;
case GOSSIP_OPTION_SPIRITHEALER:
if (isDead())
source->ToCreature()->CastSpell(source->ToCreature(), 17251, true, nullptr, nullptr, GetGUID());
source->ToCreature()->CastSpell(source->ToCreature(), 17251, GetGUID());
break;
case GOSSIP_OPTION_QUESTGIVER:
PrepareQuestMenu(guid);
@@ -14078,8 +14085,8 @@ void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 men
{
// Cast spells that teach dual spec
// Both are also ImplicitTarget self and must be cast by player
CastSpell(this, 63680, true, nullptr, nullptr, GetGUID());
CastSpell(this, 63624, true, nullptr, nullptr, GetGUID());
CastSpell(this, 63680, GetGUID());
CastSpell(this, 63624, GetGUID());
PrepareGossipMenu(source, menuItemData->GossipActionMenuId);
SendPreparedGossip(source);
@@ -24716,7 +24723,7 @@ bool Player::IsAtRecruitAFriendDistance(WorldObject const* pOther) const
void Player::ResurrectUsingRequestData()
{
/// Teleport before resurrecting by player, otherwise the player might get attacked from creatures near his corpse
// Teleport before resurrecting by player, otherwise the player might get attacked from creatures near his corpse
float x, y, z, o;
_resurrectionData->Location.GetPosition(x, y, z, o);
TeleportTo(_resurrectionData->Location.GetMapId(), x, y, z, o);
@@ -24741,7 +24748,11 @@ void Player::ResurrectUsingRequestData()
SetPower(POWER_ECLIPSE, 0);
if (uint32 aura = _resurrectionData->Aura)
CastSpell(this, aura, true, nullptr, nullptr, _resurrectionData->GUID);
{
CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SetOriginalCaster(_resurrectionData->GUID);
CastSpell(this, aura, args);
}
SpawnCorpseBones();
}