Core/Spells: Cleanup in Spell.h:
- Codestyle (fix function naming) and cleanup changes in SpellCastTargets class, also access variables of this class by getters/setters - Move IsQuestTameSpell function to SpellMgr.h - Move UnitList typedef to Unit.h Additionally - add missing copyright notice to SpellAuraEffects.h
This commit is contained in:
@@ -332,7 +332,7 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid
|
||||
if (unit_target->GetTypeId() == TYPEID_PLAYER)
|
||||
pet->SendUpdateToPlayer((Player*)unit_target);
|
||||
}
|
||||
else if (Unit *unit_target2 = spell->m_targets.getUnitTarget())
|
||||
else if (Unit *unit_target2 = spell->m_targets.GetUnitTarget())
|
||||
{
|
||||
pet->SetInFront(unit_target2);
|
||||
if (unit_target2->GetTypeId() == TYPEID_PLAYER)
|
||||
@@ -348,7 +348,7 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid
|
||||
{
|
||||
pet->ToCreature()->AddCreatureSpellCooldown(spellid);
|
||||
|
||||
unit_target = spell->m_targets.getUnitTarget();
|
||||
unit_target = spell->m_targets.GetUnitTarget();
|
||||
|
||||
//10% chance to play special pet attack talk, else growl
|
||||
//actually this only seems to happen on special spells, fire shield for imp, torment for voidwalker, but it's stupid to check every spell
|
||||
@@ -769,7 +769,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
|
||||
return;
|
||||
|
||||
SpellCastTargets targets;
|
||||
targets.read(recvPacket, caster);
|
||||
targets.Read(recvPacket, caster);
|
||||
HandleClientCastFlags(recvPacket, castFlags, targets);
|
||||
|
||||
caster->ClearUnitState(UNIT_STAT_FOLLOW);
|
||||
|
||||
@@ -32,14 +32,19 @@
|
||||
#include "ScriptMgr.h"
|
||||
#include "GameObjectAI.h"
|
||||
|
||||
void WorldSession::HandleClientCastFlags(WorldPacket& recvPacket, uint8 castFlags, SpellCastTargets & targets)
|
||||
void WorldSession::HandleClientCastFlags(WorldPacket& recvPacket, uint8 castFlags, SpellCastTargets& targets)
|
||||
{
|
||||
// some spell cast packet including more data (for projectiles?)
|
||||
if (castFlags & 0x02)
|
||||
{
|
||||
// not sure about these two
|
||||
recvPacket >> targets.m_elevation;
|
||||
recvPacket >> targets.m_speed;
|
||||
float elevation, speed;
|
||||
recvPacket >> elevation;
|
||||
recvPacket >> speed;
|
||||
|
||||
targets.SetElevation(elevation);
|
||||
targets.SetSpeed(speed);
|
||||
|
||||
uint8 hasMovementData;
|
||||
recvPacket >> hasMovementData;
|
||||
if (hasMovementData)
|
||||
@@ -156,10 +161,10 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
|
||||
}
|
||||
|
||||
SpellCastTargets targets;
|
||||
targets.read(recvPacket, pUser);
|
||||
targets.Read(recvPacket, pUser);
|
||||
HandleClientCastFlags(recvPacket, castFlags, targets);
|
||||
|
||||
if (!pItem->IsTargetValidForItemUse(targets.getUnitTarget()))
|
||||
if (!pItem->IsTargetValidForItemUse(targets.GetUnitTarget()))
|
||||
{
|
||||
// free gray item after use fail
|
||||
pUser->SendEquipError(EQUIP_ERR_NONE, pItem, NULL);
|
||||
@@ -168,7 +173,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
|
||||
if (SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId))
|
||||
{
|
||||
// for implicit area/coord target spells
|
||||
if (!targets.getUnitTarget())
|
||||
if (!targets.GetUnitTarget())
|
||||
Spell::SendCastResult(_player, spellInfo, castCount, SPELL_FAILED_NO_VALID_TARGETS);
|
||||
// for explicit target spells
|
||||
else
|
||||
@@ -384,13 +389,13 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
|
||||
|
||||
// client provided targets
|
||||
SpellCastTargets targets;
|
||||
targets.read(recvPacket, mover);
|
||||
targets.Read(recvPacket, mover);
|
||||
HandleClientCastFlags(recvPacket, castFlags, targets);
|
||||
|
||||
// auto-selection buff level base at target level (in spellInfo)
|
||||
if (targets.getUnitTarget())
|
||||
if (targets.GetUnitTarget())
|
||||
{
|
||||
SpellEntry const *actualSpellInfo = sSpellMgr->SelectAuraRankForPlayerLevel(spellInfo, targets.getUnitTarget()->getLevel());
|
||||
SpellEntry const *actualSpellInfo = sSpellMgr->SelectAuraRankForPlayerLevel(spellInfo, targets.GetUnitTarget()->getLevel());
|
||||
|
||||
// if rank not found then function return NULL but in explicit cast case original spell can be casted and later failed with appropriate error message
|
||||
if (actualSpellInfo)
|
||||
|
||||
@@ -353,7 +353,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
|
||||
|
||||
my_spell = new Spell(_player, spellEntry, true);
|
||||
my_spell->m_CastItem = castItem;
|
||||
my_targets.setTradeItemTarget(_player);
|
||||
my_targets.SetTradeItemTarget(_player);
|
||||
my_spell->m_targets = my_targets;
|
||||
|
||||
SpellCastResult res = my_spell->CheckCast(true);
|
||||
@@ -388,7 +388,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
|
||||
|
||||
his_spell = new Spell(trader, spellEntry, true);
|
||||
his_spell->m_CastItem = castItem;
|
||||
his_targets.setTradeItemTarget(trader);
|
||||
his_targets.SetTradeItemTarget(trader);
|
||||
his_spell->m_targets = his_targets;
|
||||
|
||||
SpellCastResult res = his_spell->CheckCast(true);
|
||||
|
||||
Reference in New Issue
Block a user