From c955941b55d13d99456b015c8486db7810412a76 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Wed, 20 Oct 2010 08:15:30 +0400 Subject: [PATCH] [10627] Use ObjectGuid for player's selection and unit's target --- sql/mangos.sql | 2 +- src/game/Chat.cpp | 12 ++++++------ src/game/Creature.cpp | 2 +- src/game/FleeingMovementGenerator.cpp | 2 +- src/game/GameObject.cpp | 2 +- src/game/Level1.cpp | 4 ++-- src/game/Level2.cpp | 6 +++--- src/game/Level3.cpp | 10 +++++----- src/game/MiscHandler.cpp | 22 +++++++++++----------- src/game/Player.cpp | 7 ++----- src/game/Player.h | 6 +++--- src/game/QueryHandler.cpp | 7 ++++--- src/game/Spell.cpp | 21 +++++++++------------ src/game/SpellAuras.cpp | 14 ++++++-------- src/game/SpellAuras.h | 3 ++- src/game/SpellEffects.cpp | 4 ++-- src/game/Unit.cpp | 4 ++-- src/game/Unit.h | 4 ++-- src/game/UnitAuraProcHandler.cpp | 3 +-- src/game/debugcmds.cpp | 2 +- src/shared/revision_nr.h | 2 +- 21 files changed, 66 insertions(+), 73 deletions(-) diff --git a/sql/mangos.sql b/sql/mangos.sql index 01abee3f5..00aa4a16c 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -3156,7 +3156,7 @@ INSERT INTO `mangos_string` VALUES (174,'%s changed your runic power to %i/%i.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (175,'Liquid level: %f, ground: %f, type: %d, status: %d',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (200,'No selection.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), -(201,'Object GUID is: lowpart %u highpart %X',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(201,'Object GUID is: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (202,'The name was too long by %i characters.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (203,'Error, name can only contain characters A-Z and a-z.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (204,'The subname was too long by %i characters.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 1357c6142..ab91c6e76 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -1156,7 +1156,7 @@ void ChatHandler::ExecuteCommand(const char* text) if (m_session) { Player* p = m_session->GetPlayer(); - ObjectGuid sel_guid = p->GetSelection(); + ObjectGuid sel_guid = p->GetSelectionGuid(); sLog.outCommand(GetAccountId(),"Command: %s [Player: %s (Account: %u) X: %f Y: %f Z: %f Map: %u Selected: %s]", fullcmd.c_str(),p->GetName(),GetAccountId(),p->GetPositionX(),p->GetPositionY(),p->GetPositionZ(),p->GetMapId(), sel_guid.GetString().c_str()); @@ -2012,9 +2012,9 @@ Player * ChatHandler::getSelectedPlayer() if(!m_session) return NULL; - uint64 guid = m_session->GetPlayer()->GetSelection(); + ObjectGuid guid = m_session->GetPlayer()->GetSelectionGuid(); - if (guid == 0) + if (guid.IsEmpty()) return m_session->GetPlayer(); return sObjectMgr.GetPlayer(guid); @@ -2025,9 +2025,9 @@ Unit* ChatHandler::getSelectedUnit() if(!m_session) return NULL; - uint64 guid = m_session->GetPlayer()->GetSelection(); + ObjectGuid guid = m_session->GetPlayer()->GetSelectionGuid(); - if (guid == 0) + if (guid.IsEmpty()) return m_session->GetPlayer(); // can be selected player at another map @@ -2039,7 +2039,7 @@ Creature* ChatHandler::getSelectedCreature() if(!m_session) return NULL; - return m_session->GetPlayer()->GetMap()->GetAnyTypeCreature(m_session->GetPlayer()->GetSelection()); + return m_session->GetPlayer()->GetMap()->GetAnyTypeCreature(m_session->GetPlayer()->GetSelectionGuid()); } /** diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index ac1cb9af1..ecdd7d09f 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -1385,7 +1385,7 @@ void Creature::SetDeathState(DeathState s) if (s == JUST_DIED) { - SetTargetGUID(0); // remove target selection in any cases (can be set at aura remove in Unit::SetDeathState) + SetTargetGuid(ObjectGuid()); // remove target selection in any cases (can be set at aura remove in Unit::SetDeathState) SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); if (HasSearchedAssistance()) diff --git a/src/game/FleeingMovementGenerator.cpp b/src/game/FleeingMovementGenerator.cpp index 7670f29c6..ba8bb2861 100644 --- a/src/game/FleeingMovementGenerator.cpp +++ b/src/game/FleeingMovementGenerator.cpp @@ -311,7 +311,7 @@ void FleeingMovementGenerator::_Init(Creature &owner) { owner.RemoveSplineFlag(SPLINEFLAG_WALKMODE); - owner.SetTargetGUID(0); + owner.SetTargetGuid(ObjectGuid()); is_water_ok = owner.CanSwim(); is_land_ok = owner.CanWalk(); } diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index 29bf77260..32bedb366 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -1338,7 +1338,7 @@ void GameObject::Use(Unit* user) Player* player = (Player*)user; - Player* targetPlayer = ObjectAccessor::FindPlayer(player->GetSelection()); + Player* targetPlayer = ObjectAccessor::FindPlayer(player->GetSelectionGuid()); // accept only use by player from same group for caster except caster itself if (!targetPlayer || targetPlayer == player || !targetPlayer->IsInSameGroupWith(player)) diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index 11957054f..11868180c 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -101,8 +101,8 @@ bool ChatHandler::HandleNpcWhisperCommand(char* args) if (!ExtractPlayerTarget(&args, &target)) return false; - uint64 guid = m_session->GetPlayer()->GetSelection(); - if (!guid) + ObjectGuid guid = m_session->GetPlayer()->GetSelectionGuid(); + if (guid.IsEmpty()) return false; Creature* pCreature = m_session->GetPlayer()->GetMap()->GetCreature(guid); diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index e6790611e..0a8c229c2 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -1201,16 +1201,16 @@ bool ChatHandler::HandleGameObjectNearCommand(char* args) bool ChatHandler::HandleGUIDCommand(char* /*args*/) { - uint64 guid = m_session->GetPlayer()->GetSelection(); + ObjectGuid guid = m_session->GetPlayer()->GetSelectionGuid(); - if (guid == 0) + if (guid.IsEmpty()) { SendSysMessage(LANG_NO_SELECTION); SetSentErrorMessage(true); return false; } - PSendSysMessage(LANG_OBJECT_GUID, GUID_LOPART(guid), GUID_HIPART(guid)); + PSendSysMessage(LANG_OBJECT_GUID, guid.GetString().c_str()); return true; } diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 27d32394f..a7748120a 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -3659,7 +3659,7 @@ bool ChatHandler::HandleDieCommand(char* /*args*/) { Unit* target = getSelectedUnit(); - if(!target || !m_session->GetPlayer()->GetSelection()) + if(!target || m_session->GetPlayer()->GetSelectionGuid().IsEmpty()) { SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); SetSentErrorMessage(true); @@ -3687,7 +3687,7 @@ bool ChatHandler::HandleDamageCommand(char* args) Unit* target = getSelectedUnit(); - if (!target || !m_session->GetPlayer()->GetSelection()) + if (!target || m_session->GetPlayer()->GetSelectionGuid().IsEmpty()) { SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); SetSentErrorMessage(true); @@ -5649,16 +5649,16 @@ bool ChatHandler::HandleRespawnCommand(char* /*args*/) // accept only explicitly selected target (not implicitly self targeting case) Unit* target = getSelectedUnit(); - if(pl->GetSelection() && target) + if (!pl->GetSelectionGuid().IsEmpty() && target) { - if(target->GetTypeId()!=TYPEID_UNIT) + if (target->GetTypeId() != TYPEID_UNIT) { SendSysMessage(LANG_SELECT_CREATURE); SetSentErrorMessage(true); return false; } - if(target->isDead()) + if (target->isDead()) ((Creature*)target)->Respawn(); return true; } diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index b4658035d..b414d01ca 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -382,14 +382,14 @@ void WorldSession::HandleZoneUpdateOpcode( WorldPacket & recv_data ) void WorldSession::HandleSetTargetOpcode( WorldPacket & recv_data ) { // When this packet send? - uint64 guid ; + ObjectGuid guid ; recv_data >> guid; - _player->SetTargetGUID(guid); + _player->SetTargetGuid(guid); // update reputation list if need - Unit* unit = ObjectAccessor::GetUnit(*_player, guid ); - if(!unit) + Unit* unit = ObjectAccessor::GetUnit(*_player, guid ); // can select group members at diff maps + if (!unit) return; if(FactionTemplateEntry const* factionTemplateEntry = sFactionTemplateStore.LookupEntry(unit->getFaction())) @@ -398,14 +398,14 @@ void WorldSession::HandleSetTargetOpcode( WorldPacket & recv_data ) void WorldSession::HandleSetSelectionOpcode( WorldPacket & recv_data ) { - uint64 guid; + ObjectGuid guid; recv_data >> guid; - _player->SetSelection(guid); + _player->SetSelectionGuid(guid); // update reputation list if need - Unit* unit = ObjectAccessor::GetUnit(*_player, guid ); - if(!unit) + Unit* unit = ObjectAccessor::GetUnit(*_player, guid ); // can select group members at diff maps + if (!unit) return; if(FactionTemplateEntry const* factionTemplateEntry = sFactionTemplateStore.LookupEntry(unit->getFaction())) @@ -1075,11 +1075,11 @@ void WorldSession::HandlePlayedTime(WorldPacket& recv_data) void WorldSession::HandleInspectOpcode(WorldPacket& recv_data) { - uint64 guid; + ObjectGuid guid; recv_data >> guid; - DEBUG_LOG("Inspected guid is (GUID: %u TypeId: %u)", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid))); + DEBUG_LOG("Inspected guid is %s", guid.GetString().c_str()); - _player->SetSelection(guid); + _player->SetSelectionGuid(guid); Player *plr = sObjectMgr.GetPlayer(guid); if(!plr) // wrong player diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 497d0593d..27f848caa 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -430,9 +430,6 @@ Player::Player (WorldSession *session): Unit(), m_mover(this), m_camera(this), m if(GetSession()->GetSecurity() == SEC_PLAYER) SetAcceptWhispers(true); - m_curSelection = 0; - m_lootGuid = 0; - m_comboTarget = 0; m_comboPoints = 0; @@ -1840,7 +1837,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati return true; } - SetSelection(0); + SetSelectionGuid(ObjectGuid()); CombatStop(); @@ -15365,7 +15362,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) // clear charm/summon related fields SetCharm(NULL); SetPet(NULL); - SetTargetGUID(0); + SetTargetGuid(ObjectGuid()); SetChannelObjectGUID(0); SetCharmerGUID(0); SetOwnerGUID(0); diff --git a/src/game/Player.h b/src/game/Player.h index 3347ea0a9..6159885e1 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1579,8 +1579,8 @@ class MANGOS_DLL_SPEC Player : public Unit QuestStatusMap& getQuestStatusMap() { return mQuestStatus; }; - const uint64& GetSelection( ) const { return m_curSelection; } - void SetSelection(const uint64 &guid) { m_curSelection = guid; SetTargetGUID(guid); } + ObjectGuid const& GetSelectionGuid( ) const { return m_curSelectionGuid; } + void SetSelectionGuid(ObjectGuid guid) { m_curSelectionGuid = guid; SetTargetGuid(guid); } uint8 GetComboPoints() { return m_comboPoints; } const uint64& GetComboTarget() const { return m_comboTarget; } @@ -2510,7 +2510,7 @@ class MANGOS_DLL_SPEC Player : public Unit bool m_itemUpdateQueueBlocked; uint32 m_ExtraFlags; - uint64 m_curSelection; + ObjectGuid m_curSelectionGuid; uint64 m_comboTarget; int8 m_comboPoints; diff --git a/src/game/QueryHandler.cpp b/src/game/QueryHandler.cpp index 46d2b8088..d55b3926a 100644 --- a/src/game/QueryHandler.cpp +++ b/src/game/QueryHandler.cpp @@ -321,13 +321,14 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recv_data*/) void WorldSession::HandleNpcTextQueryOpcode( WorldPacket & recv_data ) { uint32 textID; - uint64 guid; + ObjectGuid guid; recv_data >> textID; + recv_data >> guid; + DETAIL_LOG("WORLD: CMSG_NPC_TEXT_QUERY ID '%u'", textID); - recv_data >> guid; - _player->SetTargetGUID(guid); + _player->SetTargetGuid(guid); GossipText const* pGossip = sObjectMgr.GetGossipText(textID); diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 926fdec00..90476d505 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1955,7 +1955,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& { // checked in Spell::CheckCast if (m_caster->GetTypeId()==TYPEID_PLAYER) - if (Unit* target = m_caster->GetMap()->GetPet(((Player*)m_caster)->GetSelection())) + if (Unit* target = m_caster->GetMap()->GetPet(((Player*)m_caster)->GetSelectionGuid())) targetUnitMap.push_back(target); } // Circle of Healing @@ -2314,7 +2314,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& else if(m_caster->getVictim()) pTarget = m_caster->getVictim(); else if(m_caster->GetTypeId() == TYPEID_PLAYER) - pTarget = ObjectAccessor::GetUnit(*m_caster, ((Player*)m_caster)->GetSelection()); + pTarget = ObjectAccessor::GetUnit(*m_caster, ((Player*)m_caster)->GetSelectionGuid()); if(pTarget) { @@ -2486,12 +2486,9 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& targetUnitMap.push_back(m_caster); break; case SPELL_EFFECT_SUMMON_PLAYER: - if (m_caster->GetTypeId()==TYPEID_PLAYER && ((Player*)m_caster)->GetSelection()) - { - Player* target = sObjectMgr.GetPlayer(((Player*)m_caster)->GetSelection()); - if(target) + if (m_caster->GetTypeId()==TYPEID_PLAYER && !((Player*)m_caster)->GetSelectionGuid().IsEmpty()) + if (Player* target = sObjectMgr.GetPlayer(((Player*)m_caster)->GetSelectionGuid())) targetUnitMap.push_back(target); - } break; case SPELL_EFFECT_RESURRECT_NEW: if (m_targets.getUnitTarget()) @@ -4370,7 +4367,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_targets.m_targetMask == TARGET_FLAG_SELF && m_spellInfo->EffectImplicitTargetA[EFFECT_INDEX_1] == TARGET_CHAIN_DAMAGE) { - if (target = m_caster->GetMap()->GetUnit(((Player *)m_caster)->GetSelection())) + if (target = m_caster->GetMap()->GetUnit(((Player *)m_caster)->GetSelectionGuid())) m_targets.setUnitTarget(target); else return SPELL_FAILED_BAD_TARGETS; @@ -4752,9 +4749,9 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_caster->GetTypeId() != TYPEID_PLAYER) return SPELL_FAILED_ERROR; - if (!((Player*)m_caster)->GetSelection()) + if (((Player*)m_caster)->GetSelectionGuid().IsEmpty()) return SPELL_FAILED_BAD_IMPLICIT_TARGETS; - Pet* target = m_caster->GetMap()->GetPet(((Player*)m_caster)->GetSelection()); + Pet* target = m_caster->GetMap()->GetPet(((Player*)m_caster)->GetSelectionGuid()); // alive if (!target || target->isDead()) @@ -5086,10 +5083,10 @@ SpellCastResult Spell::CheckCast(bool strict) { if(m_caster->GetTypeId() != TYPEID_PLAYER) return SPELL_FAILED_BAD_TARGETS; - if(!((Player*)m_caster)->GetSelection()) + if(((Player*)m_caster)->GetSelectionGuid().IsEmpty()) return SPELL_FAILED_BAD_TARGETS; - Player* target = sObjectMgr.GetPlayer(((Player*)m_caster)->GetSelection()); + Player* target = sObjectMgr.GetPlayer(((Player*)m_caster)->GetSelectionGuid()); if( !target || ((Player*)m_caster) == target || !target->IsInSameRaidWith((Player*)m_caster) ) return SPELL_FAILED_BAD_TARGETS; diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index c62fea919..58ef2ba1d 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -525,9 +525,7 @@ SingleEnemyTargetAura::SingleEnemyTargetAura(SpellEntry const* spellproto, Spell Unit *caster, Item* castItem) : Aura(spellproto, eff, currentBasePoints, holder, target, caster, castItem) { if (caster) - m_casters_target_guid = caster->GetTypeId()==TYPEID_PLAYER ? ((Player*)caster)->GetSelection() : caster->GetTargetGUID(); - else - m_casters_target_guid = 0; + m_castersTargetGuid = caster->GetTypeId()==TYPEID_PLAYER ? ((Player*)caster)->GetSelectionGuid() : caster->GetTargetGuid(); } SingleEnemyTargetAura::~SingleEnemyTargetAura() @@ -536,7 +534,7 @@ SingleEnemyTargetAura::~SingleEnemyTargetAura() Unit* SingleEnemyTargetAura::GetTriggerTarget() const { - return ObjectAccessor::GetUnit(*(m_spellAuraHolder->GetTarget()), m_casters_target_guid); + return ObjectAccessor::GetUnit(*(m_spellAuraHolder->GetTarget()), m_castersTargetGuid); } Aura* CreateAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder *holder, Unit *target, Unit *caster, Item* castItem) @@ -3776,7 +3774,7 @@ void Aura::HandleAuraModStun(bool apply, bool Real) target->ModifyAuraState(AURA_STATE_FROZEN, apply); target->addUnitState(UNIT_STAT_STUNNED); - target->SetTargetGUID(0); + target->SetTargetGuid(ObjectGuid()); target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); target->CastStop(target->GetGUID() == GetCasterGUID() ? GetId() : 0); @@ -3846,7 +3844,7 @@ void Aura::HandleAuraModStun(bool apply, bool Real) if(!target->hasUnitState(UNIT_STAT_ROOT)) // prevent allow move if have also root effect { if(target->getVictim() && target->isAlive()) - target->SetTargetGUID(target->getVictim()->GetGUID()); + target->SetTargetGuid(target->getVictim()->GetObjectGuid()); WorldPacket data(SMSG_FORCE_MOVE_UNROOT, 8+4); data << target->GetPackGUID(); @@ -4063,7 +4061,7 @@ void Aura::HandleAuraModRoot(bool apply, bool Real) target->ModifyAuraState(AURA_STATE_FROZEN, apply); target->addUnitState(UNIT_STAT_ROOT); - target->SetTargetGUID(0); + target->SetTargetGuid(ObjectGuid()); //Save last orientation if( target->getVictim() ) @@ -4116,7 +4114,7 @@ void Aura::HandleAuraModRoot(bool apply, bool Real) if(!target->hasUnitState(UNIT_STAT_STUNNED)) // prevent allow move if have also stun effect { if(target->getVictim() && target->isAlive()) - target->SetTargetGUID(target->getVictim()->GetGUID()); + target->SetTargetGuid(target->getVictim()->GetObjectGuid()); if(target->GetTypeId() == TYPEID_PLAYER) { diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index eea9f7213..b08bcc47b 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -20,6 +20,7 @@ #include "SpellAuraDefines.h" #include "DBCEnums.h" +#include "ObjectGuid.h" struct Modifier { @@ -510,7 +511,7 @@ class MANGOS_DLL_SPEC SingleEnemyTargetAura : public Aura protected: SingleEnemyTargetAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder *holder, Unit *target, Unit *caster = NULL, Item* castItem = NULL); - uint64 m_casters_target_guid; + ObjectGuid m_castersTargetGuid; }; Aura* CreateAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder *holder, Unit *target, Unit *caster = NULL, Item* castItem = NULL); diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index efdbcff83..345aabfd5 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -2886,7 +2886,7 @@ void Spell::EffectJump(SpellEffectIndex eff_idx) else if(unitTarget->getVictim()) pTarget = m_caster->getVictim(); else if(m_caster->GetTypeId() == TYPEID_PLAYER) - pTarget = m_caster->GetMap()->GetUnit(((Player*)m_caster)->GetSelection()); + pTarget = m_caster->GetMap()->GetUnit(((Player*)m_caster)->GetSelectionGuid()); o = pTarget ? pTarget->GetOrientation() : m_caster->GetOrientation(); } @@ -2955,7 +2955,7 @@ void Spell::EffectTeleportUnits(SpellEffectIndex eff_idx) else if(unitTarget->getVictim()) pTarget = unitTarget->getVictim(); else if(unitTarget->GetTypeId() == TYPEID_PLAYER) - pTarget = unitTarget->GetMap()->GetUnit(((Player*)unitTarget)->GetSelection()); + pTarget = unitTarget->GetMap()->GetUnit(((Player*)unitTarget)->GetSelectionGuid()); // Init dest coordinates float x = m_targets.m_destX; diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 7c1379e6b..aa5ddd613 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -5602,7 +5602,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack) } // Set our target - SetTargetGUID(victim->GetGUID()); + SetTargetGuid(victim->GetObjectGuid()); if(meleeAttack) addUnitState(UNIT_STAT_MELEE_ATTACKING); @@ -5637,7 +5637,7 @@ bool Unit::AttackStop(bool targetSwitch /*=false*/) m_attacking = NULL; // Clear our target - SetTargetGUID(0); + SetTargetGuid(ObjectGuid()); clearUnitState(UNIT_STAT_MELEE_ATTACKING); diff --git a/src/game/Unit.h b/src/game/Unit.h index a79654458..8669b7104 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1483,8 +1483,8 @@ class MANGOS_DLL_SPEC Unit : public WorldObject void SetCharmerGUID(uint64 owner) { SetUInt64Value(UNIT_FIELD_CHARMEDBY, owner); } uint64 GetCharmGUID() const { return GetUInt64Value(UNIT_FIELD_CHARM); } void SetCharmGUID(uint64 charm) { SetUInt64Value(UNIT_FIELD_CHARM, charm); } - uint64 GetTargetGUID() const { return GetUInt64Value(UNIT_FIELD_TARGET); } - void SetTargetGUID(uint64 targetGuid) { SetUInt64Value(UNIT_FIELD_TARGET, targetGuid); } + ObjectGuid const& GetTargetGuid() const { return GetGuidValue(UNIT_FIELD_TARGET); } + void SetTargetGuid(ObjectGuid targetGuid) { SetGuidValue(UNIT_FIELD_TARGET, targetGuid); } uint64 GetChannelObjectGUID() const { return GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT); } void SetChannelObjectGUID(uint64 targetGuid) { SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, targetGuid); } diff --git a/src/game/UnitAuraProcHandler.cpp b/src/game/UnitAuraProcHandler.cpp index 965d2647c..8f488ed45 100644 --- a/src/game/UnitAuraProcHandler.cpp +++ b/src/game/UnitAuraProcHandler.cpp @@ -831,8 +831,7 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura target = getVictim(); if(!target) { - uint64 selected_guid = ((Player *)this)->GetSelection(); - target = ObjectAccessor::GetUnit(*this,selected_guid); + target = ObjectAccessor::GetUnit(*this,((Player *)this)->GetSelectionGuid()); if(!target) return SPELL_AURA_PROC_FAILED; } diff --git a/src/game/debugcmds.cpp b/src/game/debugcmds.cpp index a613b4b51..6d80714f1 100644 --- a/src/game/debugcmds.cpp +++ b/src/game/debugcmds.cpp @@ -270,7 +270,7 @@ bool ChatHandler::HandleDebugPlaySoundCommand(char* args) return false; } - if (m_session->GetPlayer()->GetSelection()) + if (!m_session->GetPlayer()->GetSelectionGuid().IsEmpty()) unit->PlayDistanceSound(dwSoundId,m_session->GetPlayer()); else unit->PlayDirectSound(dwSoundId,m_session->GetPlayer()); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 6fb5a5d09..48ed48052 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10626" + #define REVISION_NR "10627" #endif // __REVISION_NR_H__