diff options
Diffstat (limited to 'src')
543 files changed, 6732 insertions, 7494 deletions
diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index 603c34e2403..327ad6ba8fa 100644 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -164,7 +164,7 @@ void PetAI::UpdateAI(uint32 diff) continue; } - Spell* spell = new Spell(me, spellInfo, TRIGGERED_NONE, 0); + Spell* spell = new Spell(me, spellInfo, TRIGGERED_NONE); bool spellUsed = false; // Some spells can target enemy or friendly (DK Ghoul's Leap) @@ -192,7 +192,7 @@ void PetAI::UpdateAI(uint32 diff) // No enemy, check friendly if (!spellUsed) { - for (std::set<uint64>::const_iterator tar = m_AllySet.begin(); tar != m_AllySet.end(); ++tar) + for (GuidSet::const_iterator tar = m_AllySet.begin(); tar != m_AllySet.end(); ++tar) { Unit* ally = ObjectAccessor::GetUnit(*me, *tar); @@ -215,7 +215,7 @@ void PetAI::UpdateAI(uint32 diff) } else if (me->GetVictim() && CanAttack(me->GetVictim()) && spellInfo->CanBeUsedInCombat()) { - Spell* spell = new Spell(me, spellInfo, TRIGGERED_NONE, 0); + Spell* spell = new Spell(me, spellInfo, TRIGGERED_NONE); if (spell->CanAutoCast(me->GetVictim())) targetSpellStore.push_back(std::make_pair(me->GetVictim(), spell)); else diff --git a/src/server/game/AI/CoreAI/PetAI.h b/src/server/game/AI/CoreAI/PetAI.h index c24bf3a0c1b..9517efd8927 100644 --- a/src/server/game/AI/CoreAI/PetAI.h +++ b/src/server/game/AI/CoreAI/PetAI.h @@ -57,7 +57,7 @@ class PetAI : public CreatureAI void UpdateAllies(); TimeTracker i_tracker; - std::set<uint64> m_AllySet; + GuidSet m_AllySet; uint32 m_updateAlliesTimer; Unit* SelectNextTarget(bool allowAutoSelect) const; diff --git a/src/server/game/AI/CoreAI/TotemAI.cpp b/src/server/game/AI/CoreAI/TotemAI.cpp index 245a47dbe64..7cce969f2a4 100644 --- a/src/server/game/AI/CoreAI/TotemAI.cpp +++ b/src/server/game/AI/CoreAI/TotemAI.cpp @@ -35,7 +35,7 @@ int TotemAI::Permissible(Creature const* creature) return PERMIT_BASE_NO; } -TotemAI::TotemAI(Creature* c) : CreatureAI(c), i_victimGuid(0) +TotemAI::TotemAI(Creature* c) : CreatureAI(c), i_victimGuid() { ASSERT(c->IsTotem()); } @@ -90,7 +90,7 @@ void TotemAI::UpdateAI(uint32 /*diff*/) me->CastSpell(victim, me->ToTotem()->GetSpell(), false); } else - i_victimGuid = 0; + i_victimGuid.Clear(); } void TotemAI::AttackStart(Unit* /*victim*/) diff --git a/src/server/game/AI/CoreAI/TotemAI.h b/src/server/game/AI/CoreAI/TotemAI.h index 93106b91492..c63da0af31c 100644 --- a/src/server/game/AI/CoreAI/TotemAI.h +++ b/src/server/game/AI/CoreAI/TotemAI.h @@ -39,7 +39,7 @@ class TotemAI : public CreatureAI static int Permissible(Creature const* creature); private: - uint64 i_victimGuid; + ObjectGuid i_victimGuid; }; #endif diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h index 979fe4fe558..5d67c9546aa 100644 --- a/src/server/game/AI/CoreAI/UnitAI.h +++ b/src/server/game/AI/CoreAI/UnitAI.h @@ -137,8 +137,8 @@ class UnitAI virtual void DoAction(int32 /*param*/) { } virtual uint32 GetData(uint32 /*id = 0*/) const { return 0; } virtual void SetData(uint32 /*id*/, uint32 /*value*/) { } - virtual void SetGUID(uint64 /*guid*/, int32 /*id*/ = 0) { } - virtual uint64 GetGUID(int32 /*id*/ = 0) const { return 0; } + virtual void SetGUID(ObjectGuid /*guid*/, int32 /*id*/ = 0) { } + virtual ObjectGuid GetGUID(int32 /*id*/ = 0) const { return ObjectGuid::Empty; } Unit* SelectTarget(SelectAggroTarget targetType, uint32 position = 0, float dist = 0.0f, bool playerOnly = false, int32 aura = 0); // Select the targets satisfying the predicate. diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index 06820b03218..cb3e480e01a 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -311,8 +311,8 @@ void ScriptedAI::DoTeleportPlayer(Unit* unit, float x, float y, float z, float o if (Player* player = unit->ToPlayer()) player->TeleportTo(unit->GetMapId(), x, y, z, o, TELE_TO_NOT_LEAVE_COMBAT); else - TC_LOG_ERROR("scripts", "Creature " UI64FMTD " (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: " UI64FMTD ") to x: %f y:%f z: %f o: %f. Aborted.", - me->GetGUID(), me->GetEntry(), unit->GetTypeId(), unit->GetGUID(), x, y, z, o); + TC_LOG_ERROR("scripts", "Creature %s Tried to teleport non-player unit (%s) to x: %f y:%f z: %f o: %f. Aborted.", + me->GetGUID().ToString().c_str(), unit->GetGUID().ToString().c_str(), x, y, z, o); } void ScriptedAI::DoTeleportAll(float x, float y, float z, float o) diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h index f11769f1d1d..2c13db1b14f 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h @@ -40,7 +40,7 @@ class InstanceScript; class SummonList { public: - typedef std::list<uint64> StorageType; + typedef GuidList StorageType; typedef StorageType::iterator iterator; typedef StorageType::const_iterator const_iterator; typedef StorageType::size_type size_type; @@ -104,7 +104,7 @@ public: { // We need to use a copy of SummonList here, otherwise original SummonList would be modified StorageType listCopy = storage_; - Trinity::Containers::RandomResizeList<uint64, Predicate>(listCopy, predicate, max); + Trinity::Containers::RandomResizeList<ObjectGuid, Predicate>(listCopy, predicate, max); for (StorageType::iterator i = listCopy.begin(); i != listCopy.end(); ) { Creature* summon = ObjectAccessor::GetCreature(*me, *i++); @@ -126,7 +126,7 @@ class EntryCheckPredicate { public: EntryCheckPredicate(uint32 entry) : _entry(entry) { } - bool operator()(uint64 guid) { return GUID_ENPART(guid) == _entry; } + bool operator()(ObjectGuid guid) { return guid.GetEntry() == _entry; } private: uint32 _entry; @@ -135,7 +135,7 @@ class EntryCheckPredicate class DummyEntryCheckPredicate { public: - bool operator()(uint64) { return true; } + bool operator()(ObjectGuid) { return true; } }; struct ScriptedAI : public CreatureAI diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp index d06f90c1aeb..38b3d2d882d 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -35,7 +35,6 @@ enum Points }; npc_escortAI::npc_escortAI(Creature* creature) : ScriptedAI(creature), - m_uiPlayerGUID(0), m_uiWPWaitTimer(2500), m_uiPlayerCheckTimer(1000), m_uiEscortState(STATE_ESCORT_NONE), @@ -430,7 +429,7 @@ void npc_escortAI::SetRun(bool on) } /// @todo get rid of this many variables passed in function. -void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false */, uint64 playerGUID /* = 0 */, Quest const* quest /* = NULL */, bool instantRespawn /* = false */, bool canLoopPath /* = false */, bool resetWaypoints /* = true */) +void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false */, ObjectGuid playerGUID /* = 0 */, Quest const* quest /* = NULL */, bool instantRespawn /* = false */, bool canLoopPath /* = false */, bool resetWaypoints /* = true */) { if (me->GetVictim()) { @@ -486,7 +485,7 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); } - TC_LOG_DEBUG("scripts", "EscortAI started with " UI64FMTD " waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = " UI64FMTD "", uint64(WaypointList.size()), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID); + TC_LOG_DEBUG("scripts", "EscortAI started with " UI64FMTD " waypoints. ActiveAttacker = %d, Run = %d, %s", uint64(WaypointList.size()), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID.ToString().c_str()); CurrentWP = WaypointList.begin(); diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h index b8c9ee57aeb..22280ee3575 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h @@ -88,7 +88,7 @@ struct npc_escortAI : public ScriptedAI virtual void WaypointReached(uint32 pointId) = 0; virtual void WaypointStart(uint32 /*pointId*/) { } - void Start(bool isActiveAttacker = true, bool run = false, uint64 playerGUID = 0, Quest const* quest = NULL, bool instantRespawn = false, bool canLoopPath = false, bool resetWaypoints = true); + void Start(bool isActiveAttacker = true, bool run = false, ObjectGuid playerGUID = ObjectGuid::Empty, Quest const* quest = NULL, bool instantRespawn = false, bool canLoopPath = false, bool resetWaypoints = true); void SetRun(bool on = true); void SetEscortPaused(bool on); @@ -103,7 +103,7 @@ struct npc_escortAI : public ScriptedAI void SetDespawnAtFar(bool despawn) { DespawnAtFar = despawn; } bool GetAttack() { return m_bIsActiveAttacker; }//used in EnterEvadeMode override void SetCanAttack(bool attack) { m_bIsActiveAttacker = attack; } - uint64 GetEventStarterGUID() { return m_uiPlayerGUID; } + ObjectGuid GetEventStarterGUID() { return m_uiPlayerGUID; } protected: Player* GetPlayerForEscort() { return ObjectAccessor::GetPlayer(*me, m_uiPlayerGUID); } @@ -116,7 +116,7 @@ struct npc_escortAI : public ScriptedAI void AddEscortState(uint32 escortState) { m_uiEscortState |= escortState; } void RemoveEscortState(uint32 escortState) { m_uiEscortState &= ~escortState; } - uint64 m_uiPlayerGUID; + ObjectGuid m_uiPlayerGUID; uint32 m_uiWPWaitTimer; uint32 m_uiPlayerCheckTimer; uint32 m_uiEscortState; diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp index a106c98c786..6640341e589 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp @@ -36,7 +36,6 @@ enum Points }; FollowerAI::FollowerAI(Creature* creature) : ScriptedAI(creature), - m_uiLeaderGUID(0), m_uiUpdateFollowTimer(2500), m_uiFollowState(STATE_FOLLOW_NONE), m_pQuestForFollow(NULL) @@ -320,7 +319,7 @@ void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, const Qu me->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); - TC_LOG_DEBUG("scripts", "FollowerAI start follow %s (GUID " UI64FMTD ")", player->GetName().c_str(), m_uiLeaderGUID); + TC_LOG_DEBUG("scripts", "FollowerAI start follow %s (%s)", player->GetName().c_str(), m_uiLeaderGUID.ToString().c_str()); } Player* FollowerAI::GetLeaderForFollower() diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h index adb17ef76b1..88b3ccd6a64 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h @@ -71,7 +71,7 @@ class FollowerAI : public ScriptedAI bool AssistPlayerInCombat(Unit* who); - uint64 m_uiLeaderGUID; + ObjectGuid m_uiLeaderGUID; uint32 m_uiUpdateFollowTimer; uint32 m_uiFollowState; diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index 41f783f4289..bdad018c622 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -61,7 +61,7 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c) mDespawnState = 0; mEscortInvokerCheckTimer = 1000; - mFollowGuid = 0; + mFollowGuid.Clear(); mFollowDist = 0; mFollowAngle = 0; mFollowCredit = 0; @@ -540,7 +540,7 @@ void SmartAI::JustRespawned() mJustReset = true; JustReachedHome(); GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN); - mFollowGuid = 0;//do not reset follower on Reset(), we need it after combat evade + mFollowGuid.Clear();//do not reset follower on Reset(), we need it after combat evade mFollowDist = 0; mFollowAngle = 0; mFollowCredit = 0; @@ -674,8 +674,8 @@ void SmartAI::OnCharmed(bool apply) { GetScript()->ProcessEventsFor(SMART_EVENT_CHARMED, NULL, 0, 0, apply); - if (!apply && !me->IsInEvadeMode() && me->GetUInt64Value(UNIT_FIELD_CHARMEDBY)) - if (Unit* charmer = ObjectAccessor::GetUnit(*me, me->GetUInt64Value(UNIT_FIELD_CHARMEDBY))) + if (!apply && !me->IsInEvadeMode() && me->GetCharmerGUID()) + if (Unit* charmer = ObjectAccessor::GetUnit(*me, me->GetCharmerGUID())) AttackStart(charmer); } @@ -694,11 +694,11 @@ void SmartAI::SetData(uint32 id, uint32 value) GetScript()->ProcessEventsFor(SMART_EVENT_DATA_SET, NULL, id, value); } -void SmartAI::SetGUID(uint64 /*guid*/, int32 /*id*/) { } +void SmartAI::SetGUID(ObjectGuid /*guid*/, int32 /*id*/) { } -uint64 SmartAI::GetGUID(int32 /*id*/) const +ObjectGuid SmartAI::GetGUID(int32 /*id*/) const { - return 0; + return ObjectGuid::Empty; } void SmartAI::SetRun(bool run) @@ -800,7 +800,7 @@ void SmartAI::StopFollow() player->GroupEventHappens(mFollowCredit, me); } - mFollowGuid = 0; + mFollowGuid.Clear(); mFollowDist = 0; mFollowAngle = 0; mFollowCredit = 0; diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h index b0d5d4f8343..a5abf2a33e3 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.h +++ b/src/server/game/AI/SmartScripts/SmartAI.h @@ -154,10 +154,10 @@ class SmartAI : public CreatureAI void SetData(uint32 id, uint32 value) override; // Used in scripts to share variables - void SetGUID(uint64 guid, int32 id = 0) override; + void SetGUID(ObjectGuid guid, int32 id = 0) override; // Used in scripts to share variables - uint64 GetGUID(int32 id = 0) const override; + ObjectGuid GetGUID(int32 id = 0) const override; //core related static int Permissible(const Creature*); @@ -199,7 +199,7 @@ class SmartAI : public CreatureAI uint32 mFollowArrivedTimer; uint32 mFollowCredit; uint32 mFollowArrivedEntry; - uint64 mFollowGuid; + ObjectGuid mFollowGuid; float mFollowDist; float mFollowAngle; diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 1ec20830140..75fedb5bb57 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -51,9 +51,6 @@ SmartScript::SmartScript() mUseTextTimer = false; mTalkerEntry = 0; mTemplate = SMARTAI_TEMPLATE_BASIC; - meOrigGUID = 0; - goOrigGUID = 0; - mLastInvoker = 0; mScriptType = SMART_SCRIPT_TYPE_CREATURE; isProcessingTimedActionList = false; } @@ -79,7 +76,7 @@ void SmartScript::OnReset() } } ProcessEventsFor(SMART_EVENT_RESET); - mLastInvoker = 0; + mLastInvoker.Clear(); } void SmartScript::ProcessEventsFor(SMART_EVENT e, Unit* unit, uint32 var0, uint32 var1, bool bvar, const SpellInfo* spell, GameObject* gob) @@ -509,10 +506,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u go->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) != 0); TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_CAST:: %s: %u casts spell %u on target %u with castflags %u", - GetLogNameForGuid(me ? me->GetGUID() : go->GetGUID()), me ? me->GetGUIDLow() : go->GetGUIDLow(), e.action.cast.spell, (*itr)->GetGUIDLow(), e.action.cast.flags); + (me ? me->GetGUID() : go->GetGUID()).GetTypeName(), me ? me->GetGUIDLow() : go->GetGUIDLow(), e.action.cast.spell, (*itr)->GetGUIDLow(), e.action.cast.flags); } else - TC_LOG_DEBUG("scripts.ai", "Spell %u not cast because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*itr)->GetGUID(), (*itr)->GetEntry(), uint32((*itr)->GetTypeId())); + TC_LOG_DEBUG("scripts.ai", "Spell %u not cast because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (%s) already has the aura", e.action.cast.spell, (*itr)->GetGUID().ToString().c_str()); } delete targets; @@ -543,7 +540,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u tempLastInvoker->GetGUIDLow(), e.action.cast.spell, (*itr)->GetGUIDLow(), e.action.cast.flags); } else - TC_LOG_DEBUG("scripts.ai", "Spell %u not cast because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*itr)->GetGUID(), (*itr)->GetEntry(), uint32((*itr)->GetTypeId())); + TC_LOG_DEBUG("scripts.ai", "Spell %u not cast because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (%s) already has the aura", e.action.cast.spell, (*itr)->GetGUID().ToString().c_str()); } delete targets; @@ -939,9 +936,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!targets) break; - instance->SetData64(e.action.setInstanceData64.field, targets->front()->GetGUID()); - TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_SET_INST_DATA64: Field: %u, data: " UI64FMTD, - e.action.setInstanceData64.field, targets->front()->GetGUID()); + instance->SetGuidData(e.action.setInstanceData64.field, targets->front()->GetGUID()); + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_SET_INST_DATA64: Field: %u, data: %s", + e.action.setInstanceData64.field, targets->front()->GetGUID().ToString().c_str()); delete targets; break; @@ -1558,20 +1555,20 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { if (IsCreature(*itr)) { - if (!meOrigGUID) - meOrigGUID = me ? me->GetGUID() : 0; - if (!goOrigGUID) - goOrigGUID = go ? go->GetGUID() : 0; + if (!meOrigGUID && me) + meOrigGUID = me->GetGUID(); + if (!goOrigGUID && go) + goOrigGUID = go->GetGUID(); go = NULL; me = (*itr)->ToCreature(); break; } else if (IsGameObject(*itr)) { - if (!meOrigGUID) - meOrigGUID = me ? me->GetGUID() : 0; - if (!goOrigGUID) - goOrigGUID = go ? go->GetGUID() : 0; + if (!meOrigGUID && me) + meOrigGUID = me->GetGUID(); + if (!goOrigGUID && go) + goOrigGUID = go->GetGUID(); go = (*itr)->ToGameObject(); me = NULL; break; @@ -1713,7 +1710,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u unit->CastSpell((*it)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) != 0); } else - TC_LOG_DEBUG("scripts.ai", "Spell %u not cast because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*it)->GetGUID(), (*it)->GetEntry(), uint32((*it)->GetTypeId())); + TC_LOG_DEBUG("scripts.ai", "Spell %u not cast because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (%s) already has the aura", e.action.cast.spell, (*it)->GetGUID().ToString().c_str()); } } @@ -2627,7 +2624,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /* { if (me) { - uint64 charmerOrOwnerGuid = me->GetCharmerOrOwnerGUID(); + ObjectGuid charmerOrOwnerGuid = me->GetCharmerOrOwnerGUID(); if (!charmerOrOwnerGuid) charmerOrOwnerGuid = me->GetCreatorGUID(); diff --git a/src/server/game/AI/SmartScripts/SmartScript.h b/src/server/game/AI/SmartScripts/SmartScript.h index 0931756a026..9ff9e870eec 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.h +++ b/src/server/game/AI/SmartScripts/SmartScript.h @@ -197,14 +197,14 @@ class SmartScript go = o; } } - goOrigGUID = 0; - meOrigGUID = 0; + goOrigGUID.Clear(); + meOrigGUID.Clear(); } //TIMED_ACTIONLIST (script type 9 aka script9) void SetScript9(SmartScriptHolder& e, uint32 entry); Unit* GetLastInvoker(); - uint64 mLastInvoker; + ObjectGuid mLastInvoker; private: void IncPhase(int32 p = 1) @@ -224,9 +224,9 @@ class SmartScript SmartAIEventList mTimedActionList; bool isProcessingTimedActionList; Creature* me; - uint64 meOrigGUID; + ObjectGuid meOrigGUID; GameObject* go; - uint64 goOrigGUID; + ObjectGuid goOrigGUID; AreaTriggerEntry const* trigger; SmartScriptType mScriptType; uint32 mEventPhase; diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 296c3161845..83e9377d3ca 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -1352,7 +1352,7 @@ struct SmartScriptHolder typedef std::unordered_map<uint32, WayPoint*> WPPath; typedef std::list<WorldObject*> ObjectList; -typedef std::list<uint64> GuidList; + class ObjectGuidList { ObjectList* m_objectList; @@ -1385,7 +1385,7 @@ public: if (WorldObject* obj = ObjectAccessor::GetWorldObject(*m_baseObject, *itr)) m_objectList->push_back(obj); else - TC_LOG_DEBUG("scripts.ai", "SmartScript::mTargetStorage stores a guid to an invalid object: " UI64FMTD, *itr); + TC_LOG_DEBUG("scripts.ai", "SmartScript::mTargetStorage stores a guid to an invalid object: %s", itr->ToString().c_str()); } } diff --git a/src/server/game/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp index ff30fe7ba35..0c90dde5ea8 100644 --- a/src/server/game/Accounts/AccountMgr.cpp +++ b/src/server/game/Accounts/AccountMgr.cpp @@ -81,8 +81,7 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accountId) { do { - uint32 guidLow = (*result)[0].GetUInt32(); - uint64 guid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER); + ObjectGuid guid(HIGHGUID_PLAYER, (*result)[0].GetUInt32()); // Kick if player is online if (Player* p = ObjectAccessor::FindPlayer(guid)) diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index 46e02f9547f..90e8d8de672 100644 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -457,7 +457,7 @@ void AchievementMgr::Reset() m_completedAchievements.clear(); m_criteriaProgress.clear(); - DeleteFromDB(m_player->GetGUIDLow()); + DeleteFromDB(m_player->GetGUID()); // re-fill data CheckAllAchievementCriteria(); @@ -495,16 +495,16 @@ void AchievementMgr::ResetAchievementCriteria(AchievementCriteriaTypes type, uin } } -void AchievementMgr::DeleteFromDB(uint32 lowguid) +void AchievementMgr::DeleteFromDB(ObjectGuid guid) { SQLTransaction trans = CharacterDatabase.BeginTransaction(); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT); - stmt->setUInt32(0, lowguid); + stmt->setUInt32(0, guid.GetCounter()); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT_PROGRESS); - stmt->setUInt32(0, lowguid); + stmt->setUInt32(0, guid.GetCounter()); trans->Append(stmt); CharacterDatabase.CommitTransaction(trans); @@ -521,11 +521,11 @@ void AchievementMgr::SaveToDB(SQLTransaction& trans) PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT_BY_ACHIEVEMENT); stmt->setUInt16(0, iter->first); - stmt->setUInt32(1, GetPlayer()->GetGUID()); + stmt->setUInt32(1, GetPlayer()->GetGUIDLow()); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_ACHIEVEMENT); - stmt->setUInt32(0, GetPlayer()->GetGUID()); + stmt->setUInt32(0, GetPlayer()->GetGUIDLow()); stmt->setUInt16(1, iter->first); stmt->setUInt32(2, uint32(iter->second.date)); trans->Append(stmt); @@ -542,14 +542,14 @@ void AchievementMgr::SaveToDB(SQLTransaction& trans) continue; PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT_PROGRESS_BY_CRITERIA); - stmt->setUInt32(0, GetPlayer()->GetGUID()); + stmt->setUInt32(0, GetPlayer()->GetGUIDLow()); stmt->setUInt16(1, iter->first); trans->Append(stmt); if (iter->second.counter) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_ACHIEVEMENT_PROGRESS); - stmt->setUInt32(0, GetPlayer()->GetGUID()); + stmt->setUInt32(0, GetPlayer()->GetGUIDLow()); stmt->setUInt16(1, iter->first); stmt->setUInt32(2, iter->second.counter); stmt->setUInt32(3, uint32(iter->second.date)); @@ -663,7 +663,7 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement) } WorldPacket data(SMSG_ACHIEVEMENT_EARNED, 8+4+8); - data.append(GetPlayer()->GetPackGUID()); + data << GetPlayer()->GetPackGUID(); data << uint32(achievement->ID); data.AppendPackedTime(time(NULL)); data << uint32(0); @@ -678,7 +678,7 @@ void AchievementMgr::SendCriteriaUpdate(AchievementCriteriaEntry const* entry, C // the counter is packed like a packed Guid data.appendPackGUID(progress->counter); - data.append(GetPlayer()->GetPackGUID()); + data << GetPlayer()->GetPackGUID(); if (!entry->timeLimit) data << uint32(0); else @@ -2102,7 +2102,7 @@ void AchievementMgr::SendAllAchievementData() const void AchievementMgr::SendRespondInspectAchievements(Player* player) const { WorldPacket data(SMSG_RESPOND_INSPECT_ACHIEVEMENTS, 9+m_completedAchievements.size()*8+4+m_criteriaProgress.size()*38+4); - data.append(GetPlayer()->GetPackGUID()); + data << GetPlayer()->GetPackGUID(); BuildAllDataPacket(&data); player->GetSession()->SendPacket(&data); } @@ -2128,7 +2128,7 @@ void AchievementMgr::BuildAllDataPacket(WorldPacket* data) const { *data << uint32(iter->first); data->appendPackGUID(iter->second.counter); - data->append(GetPlayer()->GetPackGUID()); + *data << GetPlayer()->GetPackGUID(); *data << uint32(0); data->AppendPackedTime(iter->second.date); *data << uint32(0); diff --git a/src/server/game/Achievements/AchievementMgr.h b/src/server/game/Achievements/AchievementMgr.h index 219a8fd52fb..a72152782c3 100644 --- a/src/server/game/Achievements/AchievementMgr.h +++ b/src/server/game/Achievements/AchievementMgr.h @@ -26,6 +26,7 @@ #include "DatabaseEnv.h" #include "DBCEnums.h" #include "DBCStores.h" +#include "ObjectGuid.h" class Unit; class Player; @@ -268,7 +269,7 @@ class AchievementMgr ~AchievementMgr(); void Reset(); - static void DeleteFromDB(uint32 lowguid); + static void DeleteFromDB(ObjectGuid lowguid); void LoadFromDB(PreparedQueryResult achievementResult, PreparedQueryResult criteriaResult); void SaveToDB(SQLTransaction& trans); void ResetAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1 = 0, uint32 miscValue2 = 0, bool evenIfCriteriaComplete = false); diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp index f4699f0519e..7b1dda89869 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -92,7 +92,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction& return; uint32 bidderAccId = 0; - uint64 bidderGuid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER); + ObjectGuid bidderGuid(HIGHGUID_PLAYER, auction->bidder); Player* bidder = ObjectAccessor::FindPlayer(bidderGuid); // data for gm.log std::string bidderName; @@ -115,11 +115,12 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction& if (logGmTrade) { + ObjectGuid ownerGuid = ObjectGuid(HIGHGUID_PLAYER, auction->owner); std::string ownerName; - if (!sObjectMgr->GetPlayerNameByGUID(auction->owner, ownerName)) + if (!sObjectMgr->GetPlayerNameByGUID(ownerGuid, ownerName)) ownerName = sObjectMgr->GetTrinityStringForDBCLocale(LANG_UNKNOWN); - uint32 ownerAccId = sObjectMgr->GetPlayerAccountIdByGUID(auction->owner); + uint32 ownerAccId = sObjectMgr->GetPlayerAccountIdByGUID(ownerGuid); sLog->outCommand(bidderAccId, "GM %s (Account: %u) won item in auction: %s (Entry: %u Count: %u) and pay money: %u. Original owner %s (Account: %u)", bidderName.c_str(), bidderAccId, pItem->GetTemplate()->Name1.c_str(), pItem->GetEntry(), pItem->GetCount(), auction->bid, ownerName.c_str(), ownerAccId); @@ -150,7 +151,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction& void AuctionHouseMgr::SendAuctionSalePendingMail(AuctionEntry* auction, SQLTransaction& trans) { - uint64 owner_guid = MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER); + ObjectGuid owner_guid(HIGHGUID_PLAYER, auction->owner); Player* owner = ObjectAccessor::FindPlayer(owner_guid); uint32 owner_accId = sObjectMgr->GetPlayerAccountIdByGUID(owner_guid); // owner exist (online or offline) @@ -162,7 +163,7 @@ void AuctionHouseMgr::SendAuctionSalePendingMail(AuctionEntry* auction, SQLTrans //call this method to send mail to auction owner, when auction is successful, it does not clear ram void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry* auction, SQLTransaction& trans) { - uint64 owner_guid = MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER); + ObjectGuid owner_guid(HIGHGUID_PLAYER, auction->owner); Player* owner = ObjectAccessor::FindPlayer(owner_guid); uint32 owner_accId = sObjectMgr->GetPlayerAccountIdByGUID(owner_guid); // owner exist @@ -193,7 +194,7 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, SQLTransacti if (!pItem) return; - uint64 owner_guid = MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER); + ObjectGuid owner_guid(HIGHGUID_PLAYER, auction->owner); Player* owner = ObjectAccessor::FindPlayer(owner_guid); uint32 owner_accId = sObjectMgr->GetPlayerAccountIdByGUID(owner_guid); // owner exist @@ -211,7 +212,7 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, SQLTransacti //this function sends mail to old bidder void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 newPrice, Player* newBidder, SQLTransaction& trans) { - uint64 oldBidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER); + ObjectGuid oldBidder_guid(HIGHGUID_PLAYER, auction->bidder); Player* oldBidder = ObjectAccessor::FindPlayer(oldBidder_guid); uint32 oldBidder_accId = 0; @@ -233,7 +234,7 @@ void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 new //this function sends mail, when auction is cancelled to old bidder void AuctionHouseMgr::SendAuctionCancelledToBidderMail(AuctionEntry* auction, SQLTransaction& trans) { - uint64 bidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER); + ObjectGuid bidder_guid = ObjectGuid(HIGHGUID_PLAYER, auction->bidder); Player* bidder = ObjectAccessor::FindPlayer(bidder_guid); uint32 bidder_accId = 0; @@ -288,7 +289,7 @@ void AuctionHouseMgr::LoadAuctionItems() } Item* item = NewItemOrBag(proto); - if (!item->LoadFromDB(item_guid, 0, fields, itemEntry)) + if (!item->LoadFromDB(item_guid, ObjectGuid::Empty, fields, itemEntry)) { delete item; continue; @@ -848,7 +849,7 @@ std::string AuctionEntry::BuildAuctionMailBody(uint32 lowGuid, uint32 bid, uint3 { std::ostringstream strm; strm.width(16); - strm << std::right << std::hex << MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER); // HIGHGUID_PLAYER always present, even for empty guids + strm << std::right << std::hex << ObjectGuid(HIGHGUID_PLAYER, lowGuid).GetRawValue(); // HIGHGUID_PLAYER always present, even for empty guids strm << std::dec << ':' << bid << ':' << buyout; strm << ':' << deposit << ':' << cut; return strm.str(); diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index b7ecd4b1e24..d54ce790c5b 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -56,7 +56,6 @@ Battlefield::Battlefield() m_LastResurrectTimer = 30 * IN_MILLISECONDS; m_StartGroupingTimer = 0; m_StartGrouping = false; - StalkerGuid = 0; } Battlefield::~Battlefield() @@ -299,7 +298,7 @@ void Battlefield::KickAfkPlayers() KickPlayerFromBattlefield(*itr); } -void Battlefield::KickPlayerFromBattlefield(uint64 guid) +void Battlefield::KickPlayerFromBattlefield(ObjectGuid guid) { if (Player* player = ObjectAccessor::FindPlayer(guid)) if (player->GetZoneId() == GetZoneId()) @@ -503,17 +502,17 @@ void Battlefield::ShowNpc(Creature* creature, bool aggressive) Group* Battlefield::GetFreeBfRaid(TeamId TeamId) { for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr) - if (Group* group = sGroupMgr->GetGroupByGUID(*itr)) + if (Group* group = sGroupMgr->GetGroupByGUID(itr->GetCounter())) if (!group->IsFull()) return group; return NULL; } -Group* Battlefield::GetGroupPlayer(uint64 guid, TeamId TeamId) +Group* Battlefield::GetGroupPlayer(ObjectGuid guid, TeamId TeamId) { for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr) - if (Group* group = sGroupMgr->GetGroupByGUID(*itr)) + if (Group* group = sGroupMgr->GetGroupByGUID(itr->GetCounter())) if (group->IsMember(guid)) return group; @@ -598,7 +597,7 @@ WorldSafeLocsEntry const* Battlefield::GetClosestGraveYard(Player* player) return NULL; } -void Battlefield::AddPlayerToResurrectQueue(uint64 npcGuid, uint64 playerGuid) +void Battlefield::AddPlayerToResurrectQueue(ObjectGuid npcGuid, ObjectGuid playerGuid) { for (uint8 i = 0; i < m_GraveyardList.size(); i++) { @@ -613,7 +612,7 @@ void Battlefield::AddPlayerToResurrectQueue(uint64 npcGuid, uint64 playerGuid) } } -void Battlefield::RemovePlayerFromResurrectQueue(uint64 playerGuid) +void Battlefield::RemovePlayerFromResurrectQueue(ObjectGuid playerGuid) { for (uint8 i = 0; i < m_GraveyardList.size(); i++) { @@ -628,7 +627,7 @@ void Battlefield::RemovePlayerFromResurrectQueue(uint64 playerGuid) } } -void Battlefield::SendAreaSpiritHealerQueryOpcode(Player* player, uint64 guid) +void Battlefield::SendAreaSpiritHealerQueryOpcode(Player* player, ObjectGuid guid) { WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12); uint32 time = m_LastResurrectTimer; // resurrect every 30 seconds @@ -645,8 +644,8 @@ BfGraveyard::BfGraveyard(Battlefield* battlefield) m_Bf = battlefield; m_GraveyardId = 0; m_ControlTeam = TEAM_NEUTRAL; - m_SpiritGuide[0] = 0; - m_SpiritGuide[1] = 0; + m_SpiritGuide[0].Clear(); + m_SpiritGuide[1].Clear(); } void BfGraveyard::Initialize(TeamId startControl, uint32 graveyardId) @@ -673,7 +672,7 @@ float BfGraveyard::GetDistance(Player* player) return player->GetDistance2d(safeLoc->x, safeLoc->y); } -void BfGraveyard::AddPlayer(uint64 playerGuid) +void BfGraveyard::AddPlayer(ObjectGuid playerGuid) { if (!m_ResurrectQueue.count(playerGuid)) { @@ -684,7 +683,7 @@ void BfGraveyard::AddPlayer(uint64 playerGuid) } } -void BfGraveyard::RemovePlayer(uint64 playerGuid) +void BfGraveyard::RemovePlayer(ObjectGuid playerGuid) { m_ResurrectQueue.erase(m_ResurrectQueue.find(playerGuid)); @@ -756,7 +755,7 @@ void BfGraveyard::RelocateDeadPlayers() } } -bool BfGraveyard::HasNpc(uint64 guid) +bool BfGraveyard::HasNpc(ObjectGuid guid) { if (!m_SpiritGuide[0] || !m_SpiritGuide[1]) return false; @@ -838,25 +837,25 @@ GameObject* Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z return go; } -Creature* Battlefield::GetCreature(uint64 GUID) +Creature* Battlefield::GetCreature(ObjectGuid guid) { if (!m_Map) return NULL; - return m_Map->GetCreature(GUID); + return m_Map->GetCreature(guid); } -GameObject* Battlefield::GetGameObject(uint64 GUID) +GameObject* Battlefield::GetGameObject(ObjectGuid guid) { if (!m_Map) return NULL; - return m_Map->GetGameObject(GUID); + return m_Map->GetGameObject(guid); } // ******************************************************* // ******************* CapturePoint ********************** // ******************************************************* -BfCapturePoint::BfCapturePoint(Battlefield* battlefield) : m_Bf(battlefield), m_capturePointGUID(0) +BfCapturePoint::BfCapturePoint(Battlefield* battlefield) : m_Bf(battlefield), m_capturePointGUID() { m_team = TEAM_NEUTRAL; m_value = 0; @@ -921,7 +920,7 @@ bool BfCapturePoint::SetCapturePointData(GameObject* capturePoint) TC_LOG_DEBUG("bg.battlefield", "Creating capture point %u", capturePoint->GetEntry()); - m_capturePointGUID = MAKE_NEW_GUID(capturePoint->GetGUIDLow(), capturePoint->GetEntry(), HIGHGUID_GAMEOBJECT); + m_capturePointGUID = ObjectGuid(HIGHGUID_GAMEOBJECT, capturePoint->GetEntry(), capturePoint->GetGUIDLow()); // check info existence GameObjectTemplate const* goinfo = capturePoint->GetGOInfo(); @@ -966,7 +965,7 @@ bool BfCapturePoint::DelCapturePoint() capturePoint->Delete(); capturePoint = NULL; } - m_capturePointGUID = 0; + m_capturePointGUID.Clear(); } return true; @@ -1102,7 +1101,7 @@ void BfCapturePoint::SendUpdateWorldState(uint32 field, uint32 value) player->SendUpdateWorldState(field, value); } -void BfCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid) +void BfCapturePoint::SendObjectiveComplete(uint32 id, ObjectGuid guid) { uint8 team; switch (m_State) diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h index c6bfee40cd2..c7322e63a21 100644 --- a/src/server/game/Battlefield/Battlefield.h +++ b/src/server/game/Battlefield/Battlefield.h @@ -64,9 +64,8 @@ class Unit; class Battlefield; class BfGraveyard; -typedef std::set<uint64> GuidSet; typedef std::vector<BfGraveyard*> GraveyardVect; -typedef std::map<uint64, time_t> PlayerTimerMap; +typedef std::map<ObjectGuid, time_t> PlayerTimerMap; class BfCapturePoint { @@ -81,7 +80,7 @@ class BfCapturePoint void SendUpdateWorldState(uint32 field, uint32 value); // Send kill notify to players in the controlling faction - void SendObjectiveComplete(uint32 id, uint64 guid); + void SendObjectiveComplete(uint32 id, ObjectGuid guid); // Used when player is activated/inactivated in the area virtual bool HandlePlayerEnter(Player* player); @@ -132,7 +131,7 @@ class BfCapturePoint uint32 m_capturePointEntry; // Gameobject related to that capture point - uint64 m_capturePointGUID; + ObjectGuid m_capturePointGUID; }; class BfGraveyard @@ -154,10 +153,10 @@ class BfGraveyard void SetSpirit(Creature* spirit, TeamId team); // Add a player to the graveyard - void AddPlayer(uint64 player_guid); + void AddPlayer(ObjectGuid player_guid); // Remove a player from the graveyard - void RemovePlayer(uint64 player_guid); + void RemovePlayer(ObjectGuid player_guid); // Resurrect players void Resurrect(); @@ -166,10 +165,10 @@ class BfGraveyard void RelocateDeadPlayers(); // Check if this graveyard has a spirit guide - bool HasNpc(uint64 guid); + bool HasNpc(ObjectGuid guid); // Check if a player is in this graveyard's resurrect queue - bool HasPlayer(uint64 guid) { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); } + bool HasPlayer(ObjectGuid guid) { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); } // Get the graveyard's ID. uint32 GetGraveyardId() const { return m_GraveyardId; } @@ -177,7 +176,7 @@ class BfGraveyard protected: TeamId m_ControlTeam; uint32 m_GraveyardId; - uint64 m_SpiritGuide[BG_TEAMS_COUNT]; + ObjectGuid m_SpiritGuide[BG_TEAMS_COUNT]; GuidSet m_ResurrectQueue; Battlefield* m_Bf; }; @@ -237,7 +236,7 @@ class Battlefield : public ZoneScript * \brief Kick player from battlefield and teleport him to kick-point location * \param guid : guid of player who must be kick */ - void KickPlayerFromBattlefield(uint64 guid); + void KickPlayerFromBattlefield(ObjectGuid guid); /// Called when player (player) enter in zone void HandlePlayerEnterZone(Player* player, uint32 zone); @@ -266,7 +265,7 @@ class Battlefield : public ZoneScript */ Group* GetFreeBfRaid(TeamId TeamId); /// Return battlefield group where player is. - Group* GetGroupPlayer(uint64 guid, TeamId TeamId); + Group* GetGroupPlayer(ObjectGuid guid, TeamId TeamId); /// Force player to join a battlefield group bool AddOrSetPlayerToCorrectBfGroup(Player* player); @@ -274,8 +273,8 @@ class Battlefield : public ZoneScript // Find which graveyard the player must be teleported to to be resurrected by spiritguide WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); - virtual void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid); - void RemovePlayerFromResurrectQueue(uint64 player_guid); + virtual void AddPlayerToResurrectQueue(ObjectGuid npc_guid, ObjectGuid player_guid); + void RemovePlayerFromResurrectQueue(ObjectGuid player_guid); void SetGraveyardNumber(uint32 number) { m_GraveyardList.resize(number); } BfGraveyard* GetGraveyardById(uint32 id) const; @@ -284,8 +283,8 @@ class Battlefield : public ZoneScript Creature* SpawnCreature(uint32 entry, Position const& pos, TeamId /*teamId*/); GameObject* SpawnGameObject(uint32 entry, float x, float y, float z, float o); - Creature* GetCreature(uint64 GUID); - GameObject* GetGameObject(uint64 GUID); + Creature* GetCreature(ObjectGuid guid); + GameObject* GetGameObject(ObjectGuid guid); // Script-methods @@ -321,7 +320,7 @@ class Battlefield : public ZoneScript /// Return if we can use mount in battlefield bool CanFlyIn() { return !m_isActive; } - void SendAreaSpiritHealerQueryOpcode(Player* player, uint64 guid); + void SendAreaSpiritHealerQueryOpcode(Player* player, ObjectGuid guid); void StartBattle(); void EndBattle(bool endByTimer); @@ -342,7 +341,7 @@ class Battlefield : public ZoneScript void InitStalker(uint32 entry, Position const& pos); protected: - uint64 StalkerGuid; + ObjectGuid StalkerGuid; uint32 m_Timer; // Global timer for event bool m_IsEnabled; bool m_isActive; diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index e05c918f501..a6eb0c24ece 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -301,7 +301,7 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer) if (m_titansRelicGUID) if (GameObject* relic = GetGameObject(m_titansRelicGUID)) relic->RemoveFromWorld(); - m_titansRelicGUID = 0; + m_titansRelicGUID.Clear(); // Remove turret for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr) @@ -1065,7 +1065,6 @@ BfWGGameObjectBuilding::BfWGGameObjectBuilding(BattlefieldWG* wg) { m_WG = wg; m_Team = 0; - m_BuildGUID = 0; m_Type = 0; m_WorldState = 0; m_State = 0; @@ -1119,11 +1118,11 @@ void BfWGGameObjectBuilding::Damaged() if (m_NameId) // tower damage + name m_WG->SendWarningToAllInZone(m_NameId); - for (uint64 guid : m_CreatureTopList[m_WG->GetAttackerTeam()]) + for (ObjectGuid guid : m_CreatureTopList[m_WG->GetAttackerTeam()]) if (Creature* creature = m_WG->GetCreature(guid)) m_WG->HideNpc(creature); - for (uint64 guid : m_TurretTopList) + for (ObjectGuid guid : m_TurretTopList) if (Creature* creature = m_WG->GetCreature(guid)) m_WG->HideNpc(creature); @@ -1331,34 +1330,34 @@ void BfWGGameObjectBuilding::Init(GameObject* go, uint32 type, uint32 worldstate void BfWGGameObjectBuilding::UpdateCreatureAndGo() { - for (uint64 guid : m_CreatureTopList[m_WG->GetDefenderTeam()]) + for (ObjectGuid guid : m_CreatureTopList[m_WG->GetDefenderTeam()]) if (Creature* creature = m_WG->GetCreature(guid)) m_WG->HideNpc(creature); - for (uint64 guid : m_CreatureTopList[m_WG->GetAttackerTeam()]) + for (ObjectGuid guid : m_CreatureTopList[m_WG->GetAttackerTeam()]) if (Creature* creature = m_WG->GetCreature(guid)) m_WG->ShowNpc(creature, true); - for (uint64 guid : m_CreatureBottomList[m_WG->GetDefenderTeam()]) + for (ObjectGuid guid : m_CreatureBottomList[m_WG->GetDefenderTeam()]) if (Creature* creature = m_WG->GetCreature(guid)) m_WG->HideNpc(creature); - for (uint64 guid : m_CreatureBottomList[m_WG->GetAttackerTeam()]) + for (ObjectGuid guid : m_CreatureBottomList[m_WG->GetAttackerTeam()]) if (Creature* creature = m_WG->GetCreature(guid)) m_WG->ShowNpc(creature, true); - for (uint64 guid : m_GameObjectList[m_WG->GetDefenderTeam()]) + for (ObjectGuid guid : m_GameObjectList[m_WG->GetDefenderTeam()]) if (GameObject* object = m_WG->GetGameObject(guid)) object->SetRespawnTime(RESPAWN_ONE_DAY); - for (uint64 guid : m_GameObjectList[m_WG->GetAttackerTeam()]) + for (ObjectGuid guid : m_GameObjectList[m_WG->GetAttackerTeam()]) if (GameObject* object = m_WG->GetGameObject(guid)) object->SetRespawnTime(RESPAWN_IMMEDIATELY); } void BfWGGameObjectBuilding::UpdateTurretAttack(bool disable) { - for (uint64 guid : m_TowerCannonBottomList) + for (ObjectGuid guid : m_TowerCannonBottomList) { if (Creature* creature = m_WG->GetCreature(guid)) { @@ -1391,7 +1390,7 @@ void BfWGGameObjectBuilding::UpdateTurretAttack(bool disable) } } - for (uint64 guid : m_TurretTopList) + for (ObjectGuid guid : m_TurretTopList) { if (Creature* creature = m_WG->GetCreature(guid)) { @@ -1492,7 +1491,6 @@ void WGWorkshop::Save() WintergraspWorkshopData::WintergraspWorkshopData(BattlefieldWG* wg) { m_WG = wg; - m_BuildGUID = 0; m_Type = 0; m_State = 0; m_WorldState = 0; @@ -1538,22 +1536,22 @@ void WintergraspWorkshopData::GiveControlTo(uint8 team, bool init) case BATTLEFIELD_WG_TEAM_ALLIANCE: { // Show Alliance creature - for (uint64 guid : m_CreatureOnPoint[TEAM_ALLIANCE]) + for (ObjectGuid guid : m_CreatureOnPoint[TEAM_ALLIANCE]) if (Creature* creature = m_WG->GetCreature(guid)) m_WG->ShowNpc(creature, creature->GetEntry() != 30499); // Hide Horde creature - for (uint64 guid : m_CreatureOnPoint[TEAM_HORDE]) + for (ObjectGuid guid : m_CreatureOnPoint[TEAM_HORDE]) if (Creature* creature = m_WG->GetCreature(guid)) m_WG->HideNpc(creature); // Show Alliance gameobject - for (uint64 guid : m_GameObjectOnPoint[TEAM_ALLIANCE]) + for (ObjectGuid guid : m_GameObjectOnPoint[TEAM_ALLIANCE]) if (GameObject* object = m_WG->GetGameObject(guid)) object->SetRespawnTime(RESPAWN_IMMEDIATELY); // Hide Horde gameobject - for (uint64 guid : m_GameObjectOnPoint[TEAM_HORDE]) + for (ObjectGuid guid : m_GameObjectOnPoint[TEAM_HORDE]) if (GameObject* object = m_WG->GetGameObject(guid)) object->SetRespawnTime(RESPAWN_ONE_DAY); @@ -1577,22 +1575,22 @@ void WintergraspWorkshopData::GiveControlTo(uint8 team, bool init) case BATTLEFIELD_WG_TEAM_HORDE: { // Show Horde creature - for (uint64 guid : m_CreatureOnPoint[TEAM_HORDE]) + for (ObjectGuid guid : m_CreatureOnPoint[TEAM_HORDE]) if (Creature* creature = m_WG->GetCreature(guid)) m_WG->ShowNpc(creature, creature->GetEntry() != 30400); // Hide Alliance creature - for (uint64 guid : m_CreatureOnPoint[TEAM_ALLIANCE]) + for (ObjectGuid guid : m_CreatureOnPoint[TEAM_ALLIANCE]) if (Creature* creature = m_WG->GetCreature(guid)) m_WG->HideNpc(creature); // Hide Alliance gameobject - for (uint64 guid : m_GameObjectOnPoint[TEAM_ALLIANCE]) + for (ObjectGuid guid : m_GameObjectOnPoint[TEAM_ALLIANCE]) if (GameObject* object = m_WG->GetGameObject(guid)) object->SetRespawnTime(RESPAWN_ONE_DAY); // Show Horde gameobject - for (uint64 guid : m_GameObjectOnPoint[TEAM_HORDE]) + for (ObjectGuid guid : m_GameObjectOnPoint[TEAM_HORDE]) if (GameObject* object = m_WG->GetGameObject(guid)) object->SetRespawnTime(RESPAWN_IMMEDIATELY); diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index 341ccdeb44c..f5fa9b24377 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -383,7 +383,7 @@ class BattlefieldWG : public Battlefield GameObject* GetRelic() { return GetGameObject(m_titansRelicGUID); } /// Define relic object - void SetRelic(uint64 relicGUID) { m_titansRelicGUID = relicGUID; } + void SetRelic(ObjectGuid relicGUID) { m_titansRelicGUID = relicGUID; } /// Check if players can interact with the relic (Only if the last door has been broken) bool CanInteractWithRelic() { return m_isRelicInteractible; } @@ -429,7 +429,7 @@ class BattlefieldWG : public Battlefield uint32 m_tenacityStack; uint32 m_saveTimer; - uint64 m_titansRelicGUID; + ObjectGuid m_titansRelicGUID; }; uint32 const VehNumWorldState[] = { 3680, 3490 }; @@ -578,7 +578,7 @@ struct WintergraspBuildingSpawnData struct WintergraspRebuildableBuildingData { - uint64 Guid; + ObjectGuid Guid; uint32 entry; uint32 WorldState; float x; @@ -1068,7 +1068,7 @@ struct BfWGGameObjectBuilding BattlefieldWG* m_WG; // Linked gameobject - uint64 m_BuildGUID; + ObjectGuid m_BuildGUID; // eWGGameObjectBuildingType uint32 m_Type; @@ -1132,7 +1132,7 @@ struct WGWorkshop struct WintergraspWorkshopData { BattlefieldWG* m_WG; // Pointer to wintergrasp - uint64 m_BuildGUID; + ObjectGuid m_BuildGUID; uint32 m_Type; uint32 m_State; // For worldstate uint32 m_WorldState; diff --git a/src/server/game/Battlegrounds/Arena.cpp b/src/server/game/Battlegrounds/Arena.cpp index cdc6fc3cac0..f523ec6a09b 100644 --- a/src/server/game/Battlegrounds/Arena.cpp +++ b/src/server/game/Battlegrounds/Arena.cpp @@ -60,7 +60,7 @@ void Arena::AddPlayer(Player* player) UpdateArenaWorldState(); } -void Arena::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/) +void Arena::RemovePlayer(Player* /*player*/, ObjectGuid /*guid*/, uint32 /*team*/) { if (GetStatus() == STATUS_WAIT_LEAVE) return; @@ -92,7 +92,7 @@ void Arena::HandleKillPlayer(Player* player, Player* killer) CheckWinConditions(); } -void Arena::RemovePlayerAtLeave(uint64 guid, bool transport, bool sendPacket) +void Arena::RemovePlayerAtLeave(ObjectGuid guid, bool transport, bool sendPacket) { if (isRated() && GetStatus() == STATUS_IN_PROGRESS) { @@ -177,7 +177,7 @@ void Arena::EndBattleground(uint32 winner) if (sWorld->getBoolConfig(CONFIG_ARENA_LOG_EXTENDED_INFO)) for (auto const& score : PlayerScores) - if (Player* player = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(score.first, 0, HIGHGUID_PLAYER))) + if (Player* player = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, score.first))) { TC_LOG_DEBUG("bg.arena", "Statistics match Type: %u for %s (GUID: %u, Team: %d, IP: %s): %s", GetArenaType(), player->GetName().c_str(), score.first, player->GetArenaTeamId(GetArenaType() == 5 ? 2 : GetArenaType() == 3), diff --git a/src/server/game/Battlegrounds/Arena.h b/src/server/game/Battlegrounds/Arena.h index 8aea92d496d..4f622618bd4 100644 --- a/src/server/game/Battlegrounds/Arena.h +++ b/src/server/game/Battlegrounds/Arena.h @@ -42,7 +42,7 @@ class Arena : public Battleground Arena(); void AddPlayer(Player* player) override; - void RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/) override; + void RemovePlayer(Player* /*player*/, ObjectGuid /*guid*/, uint32 /*team*/) override; void FillInitialWorldStates(WorldPacket& data) override; void UpdateArenaWorldState(); @@ -50,7 +50,7 @@ class Arena : public Battleground void HandleKillPlayer(Player* player, Player* killer) override; private: - void RemovePlayerAtLeave(uint64 guid, bool transport, bool sendPacket) override; + void RemovePlayerAtLeave(ObjectGuid guid, bool transport, bool sendPacket) override; void CheckWinConditions() override; void EndBattleground(uint32 winner) override; }; diff --git a/src/server/game/Battlegrounds/ArenaScore.h b/src/server/game/Battlegrounds/ArenaScore.h index bd0ea6b02e9..60800b890a1 100644 --- a/src/server/game/Battlegrounds/ArenaScore.h +++ b/src/server/game/Battlegrounds/ArenaScore.h @@ -26,7 +26,7 @@ struct ArenaScore : public BattlegroundScore friend class Arena; protected: - ArenaScore(uint64 playerGuid, uint32 team) : BattlegroundScore(playerGuid), TeamId(team == ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE) { } + ArenaScore(ObjectGuid playerGuid, uint32 team) : BattlegroundScore(playerGuid), TeamId(team == ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE) { } void AppendToPacket(WorldPacket& data) final override { diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp index e58c09251ba..ede8f663d10 100644 --- a/src/server/game/Battlegrounds/ArenaTeam.cpp +++ b/src/server/game/Battlegrounds/ArenaTeam.cpp @@ -27,7 +27,7 @@ #include "Opcodes.h" ArenaTeam::ArenaTeam() - : TeamId(0), Type(0), TeamName(), CaptainGuid(0), BackgroundColor(0), EmblemStyle(0), EmblemColor(0), + : TeamId(0), Type(0), TeamName(), CaptainGuid(), BackgroundColor(0), EmblemStyle(0), EmblemColor(0), BorderStyle(0), BorderColor(0) { Stats.WeekGames = 0; @@ -41,7 +41,7 @@ ArenaTeam::ArenaTeam() ArenaTeam::~ArenaTeam() { } -bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string const& teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor) +bool ArenaTeam::Create(ObjectGuid captainGuid, uint8 type, std::string const& teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor) { // Check if captain is present if (!ObjectAccessor::FindPlayer(captainGuid)) @@ -63,7 +63,7 @@ bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string const& teamNa EmblemColor = emblemColor; BorderStyle = borderStyle; BorderColor = borderColor; - uint32 captainLowGuid = GUID_LOPART(captainGuid); + uint32 captainLowGuid = captainGuid.GetCounter(); // Save arena team to db PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_TEAM); @@ -86,7 +86,7 @@ bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string const& teamNa return true; } -bool ArenaTeam::AddMember(uint64 playerGuid) +bool ArenaTeam::AddMember(ObjectGuid playerGuid) { std::string playerName; uint8 playerClass; @@ -107,7 +107,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid) // 0 1 // SELECT name, class FROM characters WHERE guid = ? PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME_CLASS); - stmt->setUInt32(0, GUID_LOPART(playerGuid)); + stmt->setUInt32(0, playerGuid.GetCounter()); PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) @@ -120,7 +120,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid) // Check if player is already in a similar arena team if ((player && player->GetArenaTeamId(GetSlot())) || Player::GetArenaTeamIdFromDB(playerGuid, GetType()) != 0) { - TC_LOG_DEBUG("bg.arena", "Arena: Player %s (guid: %u) already has an arena team of type %u", playerName.c_str(), GUID_LOPART(playerGuid), GetType()); + TC_LOG_DEBUG("bg.arena", "Arena: Player %s (guid: %u) already has an arena team of type %u", playerName.c_str(), playerGuid.GetCounter(), GetType()); return false; } @@ -134,7 +134,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid) // Try to get player's match maker rating from db and fall back to config setting if not found PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MATCH_MAKER_RATING); - stmt->setUInt32(0, GUID_LOPART(playerGuid)); + stmt->setUInt32(0, playerGuid.GetCounter()); stmt->setUInt8(1, GetSlot()); PreparedQueryResult result = CharacterDatabase.Query(stmt); @@ -165,7 +165,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid) // Save player's arena team membership to db stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_TEAM_MEMBER); stmt->setUInt32(0, TeamId); - stmt->setUInt32(1, GUID_LOPART(playerGuid)); + stmt->setUInt32(1, playerGuid.GetCounter()); CharacterDatabase.Execute(stmt); // Inform player if online @@ -179,7 +179,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid) player->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1); } - TC_LOG_INFO("bg.arena", "Player: %s [GUID: %u] joined arena team type: %u [Id: %u, Name: %s].", playerName.c_str(), GUID_LOPART(playerGuid), GetType(), GetId(), GetName().c_str()); + TC_LOG_INFO("bg.arena", "Player: %s [GUID: %u] joined arena team type: %u [Id: %u, Name: %s].", playerName.c_str(), playerGuid.GetCounter(), GetType(), GetId(), GetName().c_str()); return true; } @@ -193,7 +193,7 @@ bool ArenaTeam::LoadArenaTeamFromDB(QueryResult result) TeamId = fields[0].GetUInt32(); TeamName = fields[1].GetString(); - CaptainGuid = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER); + CaptainGuid = ObjectGuid(HIGHGUID_PLAYER, fields[2].GetUInt32()); Type = fields[3].GetUInt8(); BackgroundColor = fields[4].GetUInt32(); EmblemStyle = fields[5].GetUInt8(); @@ -232,7 +232,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result) break; ArenaTeamMember newMember; - newMember.Guid = MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_PLAYER); + newMember.Guid = ObjectGuid(HIGHGUID_PLAYER, fields[1].GetUInt32()); newMember.WeekGames = fields[2].GetUInt16(); newMember.WeekWins = fields[3].GetUInt16(); newMember.SeasonGames = fields[4].GetUInt16(); @@ -245,7 +245,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result) // Delete member if character information is missing if (newMember.Name.empty()) { - TC_LOG_ERROR("sql.sql", "ArenaTeam %u has member with empty name - probably player %u doesn't exist, deleting him from memberlist!", arenaTeamId, GUID_LOPART(newMember.Guid)); + TC_LOG_ERROR("sql.sql", "ArenaTeam %u has member with empty name - probably player %u doesn't exist, deleting him from memberlist!", arenaTeamId, newMember.Guid.GetCounter()); DelMember(newMember.Guid, true); continue; } @@ -282,7 +282,7 @@ bool ArenaTeam::SetName(std::string const& name) return true; } -void ArenaTeam::SetCaptain(uint64 guid) +void ArenaTeam::SetCaptain(ObjectGuid guid) { // Disable remove/promote buttons Player* oldCaptain = ObjectAccessor::FindPlayer(GetCaptain()); @@ -294,7 +294,7 @@ void ArenaTeam::SetCaptain(uint64 guid) // Update database PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ARENA_TEAM_CAPTAIN); - stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt32(0, guid.GetCounter()); stmt->setUInt32(1, GetId()); CharacterDatabase.Execute(stmt); @@ -311,7 +311,7 @@ void ArenaTeam::SetCaptain(uint64 guid) } } -void ArenaTeam::DelMember(uint64 guid, bool cleanDb) +void ArenaTeam::DelMember(ObjectGuid guid, bool cleanDb) { // Remove member from team for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr) @@ -336,7 +336,7 @@ void ArenaTeam::DelMember(uint64 guid, bool cleanDb) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ARENA_TEAM_MEMBER); stmt->setUInt32(0, GetId()); - stmt->setUInt32(1, GUID_LOPART(guid)); + stmt->setUInt32(1, guid.GetCounter()); CharacterDatabase.Execute(stmt); } } @@ -350,7 +350,7 @@ void ArenaTeam::Disband(WorldSession* session) // Broadcast update if (session) { - BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, 0, 2, session->GetPlayerName(), GetName(), ""); + BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, ObjectGuid::Empty, 2, session->GetPlayerName(), GetName(), ""); if (Player* player = session->GetPlayer()) TC_LOG_DEBUG("bg.arena", "Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u, Name: %s].", player->GetName().c_str(), player->GetGUIDLow(), GetType(), GetId(), GetName().c_str()); @@ -471,7 +471,7 @@ void ArenaTeam::NotifyStatsChanged() SendStats(player->GetSession()); } -void ArenaTeam::Inspect(WorldSession* session, uint64 guid) +void ArenaTeam::Inspect(WorldSession* session, ObjectGuid guid) { ArenaTeamMember* member = GetMember(guid); if (!member) @@ -518,7 +518,7 @@ void ArenaTeam::BroadcastPacket(WorldPacket* packet) player->GetSession()->SendPacket(packet); } -void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCount, std::string const& str1, std::string const& str2, std::string const& str3) +void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, ObjectGuid guid, uint8 strCount, std::string const& str1, std::string const& str2, std::string const& str3) { WorldPacket data(SMSG_ARENA_TEAM_EVENT, 1+1+1); data << uint8(event); @@ -558,7 +558,7 @@ void ArenaTeam::MassInviteToEvent(WorldSession* session) { if (itr->Guid != session->GetPlayer()->GetGUID()) { - data.appendPackGUID(itr->Guid); + data << itr->Guid.WriteAsPacked(); data << uint8(0); // unk } } @@ -580,7 +580,7 @@ uint8 ArenaTeam::GetSlotByType(uint32 type) return 0xFF; } -bool ArenaTeam::IsMember(uint64 guid) const +bool ArenaTeam::IsMember(ObjectGuid guid) const { for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr) if (itr->Guid == guid) @@ -793,7 +793,7 @@ void ArenaTeam::MemberLost(Player* player, uint32 againstMatchmakerRating, int32 } } -void ArenaTeam::OfflineMemberLost(uint64 guid, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange) +void ArenaTeam::OfflineMemberLost(ObjectGuid guid, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange) { // Called for offline player after ending rated arena match! for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr) @@ -860,15 +860,15 @@ void ArenaTeam::UpdateArenaPointsHelper(std::map<uint32, uint32>& playerPoints) if (itr->WeekGames >= requiredGames) pointsToAdd = GetPoints(itr->PersonalRating); - std::map<uint32, uint32>::iterator plr_itr = playerPoints.find(GUID_LOPART(itr->Guid)); + std::map<uint32, uint32>::iterator plr_itr = playerPoints.find(itr->Guid.GetCounter()); if (plr_itr != playerPoints.end()) { // Check if there is already more points if (plr_itr->second < pointsToAdd) - playerPoints[GUID_LOPART(itr->Guid)] = pointsToAdd; + playerPoints[itr->Guid.GetCounter()] = pointsToAdd; } else - playerPoints[GUID_LOPART(itr->Guid)] = pointsToAdd; + playerPoints[itr->Guid.GetCounter()] = pointsToAdd; } } @@ -898,11 +898,11 @@ void ArenaTeam::SaveToDB() stmt->setUInt16(3, itr->SeasonGames); stmt->setUInt16(4, itr->SeasonWins); stmt->setUInt32(5, GetId()); - stmt->setUInt32(6, GUID_LOPART(itr->Guid)); + stmt->setUInt32(6, itr->Guid.GetCounter()); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CHARACTER_ARENA_STATS); - stmt->setUInt32(0, GUID_LOPART(itr->Guid)); + stmt->setUInt32(0, itr->Guid.GetCounter()); stmt->setUInt8(1, GetSlot()); stmt->setUInt16(2, itr->MatchMakerRating); trans->Append(stmt); @@ -944,7 +944,7 @@ ArenaTeamMember* ArenaTeam::GetMember(const std::string& name) return NULL; } -ArenaTeamMember* ArenaTeam::GetMember(uint64 guid) +ArenaTeamMember* ArenaTeam::GetMember(ObjectGuid guid) { for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr) if (itr->Guid == guid) diff --git a/src/server/game/Battlegrounds/ArenaTeam.h b/src/server/game/Battlegrounds/ArenaTeam.h index d3b6342b273..2f6472eca90 100644 --- a/src/server/game/Battlegrounds/ArenaTeam.h +++ b/src/server/game/Battlegrounds/ArenaTeam.h @@ -20,6 +20,7 @@ #define TRINITYCORE_ARENATEAM_H #include "QueryResult.h" +#include "ObjectGuid.h" #include <list> #include <map> @@ -86,7 +87,7 @@ enum ArenaTeamTypes struct ArenaTeamMember { - uint64 Guid; + ObjectGuid Guid; std::string Name; uint8 Class; uint16 WeekGames; @@ -118,7 +119,7 @@ class ArenaTeam ArenaTeam(); ~ArenaTeam(); - bool Create(uint64 captainGuid, uint8 type, std::string const& teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor); + bool Create(ObjectGuid captainGuid, uint8 type, std::string const& teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor); void Disband(WorldSession* session); void Disband(); @@ -128,28 +129,25 @@ class ArenaTeam uint32 GetType() const { return Type; } uint8 GetSlot() const { return GetSlotByType(GetType()); } static uint8 GetSlotByType(uint32 type); - uint64 GetCaptain() const { return CaptainGuid; } + ObjectGuid GetCaptain() const { return CaptainGuid; } std::string const& GetName() const { return TeamName; } const ArenaTeamStats& GetStats() const { return Stats; } uint32 GetRating() const { return Stats.Rating; } uint32 GetAverageMMR(Group* group) const; - void SetCaptain(uint64 guid); + void SetCaptain(ObjectGuid guid); bool SetName(std::string const& name); - bool AddMember(uint64 PlayerGuid); - - // Shouldn't be uint64 ed, because than can reference guid from members on Disband - // and this method removes given record from list. So invalid reference can happen. - void DelMember(uint64 guid, bool cleanDb); + bool AddMember(ObjectGuid PlayerGuid); + void DelMember(ObjectGuid guid, bool cleanDb); size_t GetMembersSize() const { return Members.size(); } bool Empty() const { return Members.empty(); } MemberList::iterator m_membersBegin() { return Members.begin(); } MemberList::iterator m_membersEnd() { return Members.end(); } - bool IsMember(uint64 guid) const; + bool IsMember(ObjectGuid guid) const; - ArenaTeamMember* GetMember(uint64 guid); + ArenaTeamMember* GetMember(ObjectGuid guid); ArenaTeamMember* GetMember(std::string const& name); bool IsFighting() const; @@ -160,7 +158,7 @@ class ArenaTeam void SaveToDB(); void BroadcastPacket(WorldPacket* packet); - void BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCount, std::string const& str1, std::string const& str2, std::string const& str3); + void BroadcastEvent(ArenaTeamEvents event, ObjectGuid guid, uint8 strCount, std::string const& str1, std::string const& str2, std::string const& str3); void NotifyStatsChanged(); void MassInviteToEvent(WorldSession* session); @@ -168,7 +166,7 @@ class ArenaTeam void Roster(WorldSession* session); void Query(WorldSession* session); void SendStats(WorldSession* session); - void Inspect(WorldSession* session, uint64 guid); + void Inspect(WorldSession* session, ObjectGuid guid); uint32 GetPoints(uint32 MemberRating); int32 GetMatchmakerRatingMod(uint32 ownRating, uint32 opponentRating, bool won); @@ -178,7 +176,7 @@ class ArenaTeam void MemberWon(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange); int32 LostAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int32& rating_change); void MemberLost(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange = -12); - void OfflineMemberLost(uint64 guid, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange = -12); + void OfflineMemberLost(ObjectGuid guid, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange = -12); void UpdateArenaPointsHelper(std::map<uint32, uint32> & PlayerPoints); @@ -190,7 +188,7 @@ class ArenaTeam uint32 TeamId; uint8 Type; std::string TeamName; - uint64 CaptainGuid; + ObjectGuid CaptainGuid; uint32 BackgroundColor; // ARGB format uint8 EmblemStyle; // icon id diff --git a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp index cd49158b5d0..3bfd27c69b5 100644 --- a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp +++ b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp @@ -59,7 +59,7 @@ ArenaTeam* ArenaTeamMgr::GetArenaTeamByName(const std::string& arenaTeamName) co return NULL; } -ArenaTeam* ArenaTeamMgr::GetArenaTeamByCaptain(uint64 guid) const +ArenaTeam* ArenaTeamMgr::GetArenaTeamByCaptain(ObjectGuid guid) const { for (ArenaTeamContainer::const_iterator itr = ArenaTeamStore.begin(); itr != ArenaTeamStore.end(); ++itr) if (itr->second->GetCaptain() == guid) @@ -158,7 +158,7 @@ void ArenaTeamMgr::DistributeArenaPoints() for (std::map<uint32, uint32>::iterator playerItr = PlayerPoints.begin(); playerItr != PlayerPoints.end(); ++playerItr) { // Add points to player if online - if (Player* player = HashMapHolder<Player>::Find(playerItr->first)) + if (Player* player = HashMapHolder<Player>::Find(ObjectGuid(HIGHGUID_PLAYER, playerItr->first))) player->ModifyArenaPoints(playerItr->second, trans); else // Update database { diff --git a/src/server/game/Battlegrounds/ArenaTeamMgr.h b/src/server/game/Battlegrounds/ArenaTeamMgr.h index 118e9674fbf..8ac8c606584 100644 --- a/src/server/game/Battlegrounds/ArenaTeamMgr.h +++ b/src/server/game/Battlegrounds/ArenaTeamMgr.h @@ -37,7 +37,7 @@ public: ArenaTeam* GetArenaTeamById(uint32 arenaTeamId) const; ArenaTeam* GetArenaTeamByName(std::string const& arenaTeamName) const; - ArenaTeam* GetArenaTeamByCaptain(uint64 guid) const; + ArenaTeam* GetArenaTeamByCaptain(ObjectGuid guid) const; void LoadArenaTeams(); void AddArenaTeam(ArenaTeam* arenaTeam); diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index f2a112cbeba..88c0035d21d 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -327,10 +327,10 @@ inline void Battleground::_ProcessResurrect(uint32 diff) { if (GetReviveQueueSize()) { - for (std::map<uint64, std::vector<uint64> >::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr) + for (std::map<ObjectGuid, GuidVector>::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr) { Creature* sh = NULL; - for (std::vector<uint64>::const_iterator itr2 = (itr->second).begin(); itr2 != (itr->second).end(); ++itr2) + for (GuidVector::const_iterator itr2 = (itr->second).begin(); itr2 != (itr->second).end(); ++itr2) { Player* player = ObjectAccessor::FindPlayer(*itr2); if (!player) @@ -361,7 +361,7 @@ inline void Battleground::_ProcessResurrect(uint32 diff) } else if (m_LastResurrectTime > 500) // Resurrect players only half a second later, to see spirit heal effect on NPC { - for (std::vector<uint64>::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr) + for (GuidVector::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr) { Player* player = ObjectAccessor::FindPlayer(*itr); if (!player) @@ -560,7 +560,7 @@ inline void Battleground::_ProcessLeave(uint32 diff) } } -Player* Battleground::_GetPlayer(uint64 guid, bool offlineRemove, char const* context) const +Player* Battleground::_GetPlayer(ObjectGuid guid, bool offlineRemove, char const* context) const { Player* player = NULL; if (!offlineRemove) @@ -568,7 +568,7 @@ Player* Battleground::_GetPlayer(uint64 guid, bool offlineRemove, char const* co player = ObjectAccessor::FindPlayer(guid); if (!player) TC_LOG_ERROR("bg.battleground", "Battleground::%s: player (GUID: %u) not found for BG (map: %u, instance id: %u)!", - context, GUID_LOPART(guid), m_MapId, m_InstanceID); + context, guid.GetCounter(), m_MapId, m_InstanceID); } return player; } @@ -851,7 +851,7 @@ void Battleground::BlockMovement(Player* player) player->SetClientControl(player, 0); // movement disabled NOTE: the effect will be automatically removed by client when the player is teleported from the battleground, so no need to send with uint8(1) in RemovePlayerAtLeave() } -void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPacket) +void Battleground::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool SendPacket) { uint32 team = GetPlayerTeam(guid); bool participant = false; @@ -865,7 +865,7 @@ void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac participant = true; } - BattlegroundScoreMap::iterator itr2 = PlayerScores.find(GUID_LOPART(guid)); + BattlegroundScoreMap::iterator itr2 = PlayerScores.find(guid.GetCounter()); if (itr2 != PlayerScores.end()) { delete itr2->second; // delete player's score @@ -1014,7 +1014,6 @@ void Battleground::AddPlayer(Player* player) // score struct must be created in inherited class - uint64 guid = player->GetGUID(); uint32 team = player->GetBGTeam(); BattlegroundPlayer bp; @@ -1022,7 +1021,7 @@ void Battleground::AddPlayer(Player* player) bp.Team = team; // Add to list/maps - m_Players[guid] = bp; + m_Players[player->GetGUID()] = bp; UpdatePlayersCountByTeam(team, false); // +1 player @@ -1071,7 +1070,7 @@ void Battleground::AddPlayer(Player* player) // this method adds player to his team's bg group, or sets his correct group if player is already in bg group void Battleground::AddOrSetPlayerToCorrectBgGroup(Player* player, uint32 team) { - uint64 playerGuid = player->GetGUID(); + ObjectGuid playerGuid = player->GetGUID(); Group* group = GetBgRaid(team); if (!group) // first player joined { @@ -1102,9 +1101,9 @@ void Battleground::AddOrSetPlayerToCorrectBgGroup(Player* player, uint32 team) // This method should be called when player logs into running battleground void Battleground::EventPlayerLoggedIn(Player* player) { - uint64 guid = player->GetGUID(); + ObjectGuid guid = player->GetGUID(); // player is correct pointer - for (std::deque<uint64>::iterator itr = m_OfflineQueue.begin(); itr != m_OfflineQueue.end(); ++itr) + for (GuidDeque::iterator itr = m_OfflineQueue.begin(); itr != m_OfflineQueue.end(); ++itr) { if (*itr == guid) { @@ -1121,7 +1120,7 @@ void Battleground::EventPlayerLoggedIn(Player* player) // This method should be called when player logs out from running battleground void Battleground::EventPlayerLoggedOut(Player* player) { - uint64 guid = player->GetGUID(); + ObjectGuid guid = player->GetGUID(); if (!IsPlayerInBattleground(guid)) // Check if this player really is in battleground (might be a GM who teleported inside) return; @@ -1265,7 +1264,7 @@ bool Battleground::UpdatePlayerScore(Player* player, uint32 type, uint32 value, return true; } -void Battleground::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid) +void Battleground::AddPlayerToResurrectQueue(ObjectGuid npc_guid, ObjectGuid player_guid) { m_ReviveQueue[npc_guid].push_back(player_guid); @@ -1276,15 +1275,15 @@ void Battleground::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid player->CastSpell(player, SPELL_WAITING_FOR_RESURRECT, true); } -void Battleground::RemovePlayerFromResurrectQueue(uint64 player_guid) +void Battleground::RemovePlayerFromResurrectQueue(ObjectGuid player_guid) { - for (std::map<uint64, std::vector<uint64> >::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr) + for (std::map<ObjectGuid, GuidVector>::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr) { - for (std::vector<uint64>::iterator itr2 = (itr->second).begin(); itr2 != (itr->second).end(); ++itr2) + for (GuidVector::iterator itr2 = itr->second.begin(); itr2 != itr->second.end(); ++itr2) { if (*itr2 == player_guid) { - (itr->second).erase(itr2); + itr->second.erase(itr2); if (Player* player = ObjectAccessor::FindPlayer(player_guid)) player->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT); return; @@ -1293,14 +1292,14 @@ void Battleground::RemovePlayerFromResurrectQueue(uint64 player_guid) } } -void Battleground::RelocateDeadPlayers(uint64 queueIndex) +void Battleground::RelocateDeadPlayers(ObjectGuid guideGuid) { // Those who are waiting to resurrect at this node are taken to the closest own node's graveyard - std::vector<uint64>& ghostList = m_ReviveQueue[queueIndex]; + GuidVector& ghostList = m_ReviveQueue[guideGuid]; if (!ghostList.empty()) { WorldSafeLocsEntry const* closestGrave = NULL; - for (std::vector<uint64>::const_iterator itr = ghostList.begin(); itr != ghostList.end(); ++itr) + for (GuidVector::const_iterator itr = ghostList.begin(); itr != ghostList.end(); ++itr) { Player* player = ObjectAccessor::FindPlayer(*itr); if (!player) @@ -1388,7 +1387,7 @@ void Battleground::DoorClose(uint32 type) } else TC_LOG_ERROR("bg.battleground", "Battleground::DoorClose: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", - type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID); + type, BgObjects[type].GetCounter(), m_MapId, m_InstanceID); } void Battleground::DoorOpen(uint32 type) @@ -1400,7 +1399,7 @@ void Battleground::DoorOpen(uint32 type) } else TC_LOG_ERROR("bg.battleground", "Battleground::DoorOpen: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", - type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID); + type, BgObjects[type].GetCounter(), m_MapId, m_InstanceID); } GameObject* Battleground::GetBGObject(uint32 type, bool logError) @@ -1410,10 +1409,10 @@ GameObject* Battleground::GetBGObject(uint32 type, bool logError) { if (logError) TC_LOG_ERROR("bg.battleground", "Battleground::GetBGObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", - type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID); + type, BgObjects[type].GetCounter(), m_MapId, m_InstanceID); else TC_LOG_INFO("bg.battleground", "Battleground::GetBGObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", - type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID); + type, BgObjects[type].GetCounter(), m_MapId, m_InstanceID); } return obj; } @@ -1425,10 +1424,10 @@ Creature* Battleground::GetBGCreature(uint32 type, bool logError) { if (logError) TC_LOG_ERROR("bg.battleground", "Battleground::GetBGCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", - type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID); + type, BgCreatures[type].GetCounter(), m_MapId, m_InstanceID); else TC_LOG_INFO("bg.battleground", "Battleground::GetBGCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", - type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID); + type, BgCreatures[type].GetCounter(), m_MapId, m_InstanceID); } return creature; } @@ -1505,13 +1504,13 @@ bool Battleground::DelCreature(uint32 type) if (Creature* creature = GetBgMap()->GetCreature(BgCreatures[type])) { creature->AddObjectToRemoveList(); - BgCreatures[type] = 0; + BgCreatures[type].Clear(); return true; } TC_LOG_ERROR("bg.battleground", "Battleground::DelCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", - type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID); - BgCreatures[type] = 0; + type, BgCreatures[type].GetCounter(), m_MapId, m_InstanceID); + BgCreatures[type].Clear(); return false; } @@ -1524,12 +1523,12 @@ bool Battleground::DelObject(uint32 type) { obj->SetRespawnTime(0); // not save respawn time obj->Delete(); - BgObjects[type] = 0; + BgObjects[type].Clear(); return true; } TC_LOG_ERROR("bg.battleground", "Battleground::DelObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", - type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID); - BgObjects[type] = 0; + type, BgObjects[type].GetCounter(), m_MapId, m_InstanceID); + BgObjects[type].Clear(); return false; } @@ -1540,7 +1539,7 @@ bool Battleground::AddSpiritGuide(uint32 type, float x, float y, float z, float if (Creature* creature = AddCreature(entry, type, x, y, z, o, teamId)) { creature->setDeathState(DEAD); - creature->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, creature->GetGUID()); + creature->SetChannelObjectGuid(creature->GetGUID()); // aura /// @todo Fix display here // creature->SetVisibleAura(0, SPELL_SPIRIT_HEAL_CHANNEL); @@ -1637,7 +1636,7 @@ char const* Battleground::GetTrinityString(int32 entry) // IMPORTANT NOTICE: // buffs aren't spawned/despawned when players captures anything // buffs are in their positions when battleground starts -void Battleground::HandleTriggerBuff(uint64 go_guid) +void Battleground::HandleTriggerBuff(ObjectGuid go_guid) { GameObject* obj = GetBgMap()->GetGameObject(go_guid); if (!obj || obj->GetGoType() != GAMEOBJECT_TYPE_TRAP || !obj->isSpawned()) @@ -1650,7 +1649,7 @@ void Battleground::HandleTriggerBuff(uint64 go_guid) if (index < 0) { TC_LOG_ERROR("bg.battleground", "Battleground::HandleTriggerBuff: cannot find buff gameobject (GUID: %u, entry: %u, type: %u) in internal data for BG (map: %u, instance id: %u)!", - GUID_LOPART(go_guid), obj->GetEntry(), obj->GetGoType(), m_MapId, m_InstanceID); + go_guid.GetCounter(), obj->GetEntry(), obj->GetGoType(), m_MapId, m_InstanceID); return; } @@ -1710,7 +1709,7 @@ void Battleground::HandleKillPlayer(Player* victim, Player* killer) // Return the player's team based on battlegroundplayer info // Used in same faction arena matches mainly -uint32 Battleground::GetPlayerTeam(uint64 guid) const +uint32 Battleground::GetPlayerTeam(ObjectGuid guid) const { BattlegroundPlayerMap::const_iterator itr = m_Players.find(guid); if (itr != m_Players.end()) @@ -1723,7 +1722,7 @@ uint32 Battleground::GetOtherTeam(uint32 teamId) const return teamId ? ((teamId == ALLIANCE) ? HORDE : ALLIANCE) : 0; } -bool Battleground::IsPlayerInBattleground(uint64 guid) const +bool Battleground::IsPlayerInBattleground(ObjectGuid guid) const { BattlegroundPlayerMap::const_iterator itr = m_Players.find(guid); if (itr != m_Players.end()) @@ -1768,13 +1767,13 @@ void Battleground::SetHoliday(bool is_holiday) m_HonorMode = is_holiday ? BG_HOLIDAY : BG_NORMAL; } -int32 Battleground::GetObjectType(uint64 guid) +int32 Battleground::GetObjectType(ObjectGuid guid) { for (uint32 i = 0; i < BgObjects.size(); ++i) if (BgObjects[i] == guid) return i; TC_LOG_ERROR("bg.battleground", "Battleground::GetObjectType: player used gameobject (GUID: %u) which is not in internal data for BG (map: %u, instance id: %u), cheating?", - GUID_LOPART(guid), m_MapId, m_InstanceID); + guid.GetCounter(), m_MapId, m_InstanceID); return -1; } diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h index b14c18c9335..ab411e3cfc6 100644 --- a/src/server/game/Battlegrounds/Battleground.h +++ b/src/server/game/Battlegrounds/Battleground.h @@ -303,7 +303,7 @@ class Battleground bool isBattleground() const { return !m_IsArena; } bool isRated() const { return m_IsRated; } - typedef std::map<uint64, BattlegroundPlayer> BattlegroundPlayerMap; + typedef std::map<ObjectGuid, BattlegroundPlayer> BattlegroundPlayerMap; BattlegroundPlayerMap const& GetPlayers() const { return m_Players; } uint32 GetPlayersSize() const { return m_Players.size(); } @@ -312,11 +312,11 @@ class Battleground uint32 GetReviveQueueSize() const { return m_ReviveQueue.size(); } - void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid); - void RemovePlayerFromResurrectQueue(uint64 player_guid); + void AddPlayerToResurrectQueue(ObjectGuid npc_guid, ObjectGuid player_guid); + void RemovePlayerFromResurrectQueue(ObjectGuid player_guid); /// Relocate all players in ReviveQueue to the closest graveyard - void RelocateDeadPlayers(uint64 queueIndex); + void RelocateDeadPlayers(ObjectGuid guideGuid); void StartBattleground(); @@ -409,7 +409,7 @@ class Battleground virtual void ProcessEvent(WorldObject* /*obj*/, uint32 /*eventId*/, WorldObject* /*invoker*/ = NULL) { } // this function can be used by spell to interact with the BG map - virtual void DoAction(uint32 /*action*/, uint64 /*var*/) { } + virtual void DoAction(uint32 /*action*/, ObjectGuid /*var*/) { } virtual void HandlePlayerResurrect(Player* /*player*/) { } @@ -420,17 +420,15 @@ class Battleground void AddOrSetPlayerToCorrectBgGroup(Player* player, uint32 team); - virtual void RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPacket); + virtual void RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool SendPacket); // can be extended in in BG subclass - void HandleTriggerBuff(uint64 go_guid); + void HandleTriggerBuff(ObjectGuid go_guid); void SetHoliday(bool is_holiday); /// @todo make this protected: - typedef std::vector<uint64> BGObjects; - typedef std::vector<uint64> BGCreatures; - BGObjects BgObjects; - BGCreatures BgCreatures; + GuidVector BgObjects; + GuidVector BgCreatures; void SpawnBGObject(uint32 type, uint32 respawntime); virtual bool AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime = 0); bool AddObject(uint32 type, uint32 entry, Position const& pos, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime = 0); @@ -440,7 +438,7 @@ class Battleground bool DelObject(uint32 type); virtual bool AddSpiritGuide(uint32 type, float x, float y, float z, float o, TeamId teamId = TEAM_NEUTRAL); bool AddSpiritGuide(uint32 type, Position const& pos, TeamId teamId = TEAM_NEUTRAL); - int32 GetObjectType(uint64 guid); + int32 GetObjectType(ObjectGuid guid); void DoorOpen(uint32 type); void DoorClose(uint32 type); @@ -450,9 +448,9 @@ class Battleground virtual bool HandlePlayerUnderMap(Player* /*player*/) { return false; } // since arenas can be AvA or Hvh, we have to get the "temporary" team of a player - uint32 GetPlayerTeam(uint64 guid) const; + uint32 GetPlayerTeam(ObjectGuid guid) const; uint32 GetOtherTeam(uint32 teamId) const; - bool IsPlayerInBattleground(uint64 guid) const; + bool IsPlayerInBattleground(ObjectGuid guid) const; bool ToBeDeleted() const { return m_SetDeleteThis; } void SetDeleteThis() { m_SetDeleteThis = true; } @@ -460,8 +458,8 @@ class Battleground void RewardXPAtKill(Player* killer, Player* victim); bool CanAwardArenaPoints() const { return m_LevelMin >= BG_AWARD_ARENA_POINTS_MIN_LEVEL; } - virtual uint64 GetFlagPickerGUID(int32 /*team*/ = -1) const { return 0; } - virtual void SetDroppedFlagGUID(uint64 /*guid*/, int32 /*team*/ = -1) { } + virtual ObjectGuid GetFlagPickerGUID(int32 /*team*/ = -1) const { return ObjectGuid::Empty; } + virtual void SetDroppedFlagGUID(ObjectGuid /*guid*/, int32 /*team*/ = -1) { } virtual void HandleQuestComplete(uint32 /*questid*/, Player* /*player*/) { } virtual bool CanActivateGO(int32 /*entry*/, uint32 /*team*/) const { return true; } virtual bool IsSpellAllowed(uint32 /*spellId*/, Player const* /*player*/) const { return true; } @@ -477,7 +475,7 @@ class Battleground void EndNow(); void PlayerAddedToBGCheckIfBGIsRunning(Player* player); - Player* _GetPlayer(uint64 guid, bool offlineRemove, const char* context) const; + Player* _GetPlayer(ObjectGuid guid, bool offlineRemove, const char* context) const; Player* _GetPlayer(BattlegroundPlayerMap::iterator itr, const char* context) { return _GetPlayer(itr->first, itr->second.OfflineRemoveTime != 0, context); } Player* _GetPlayer(BattlegroundPlayerMap::const_iterator itr, const char* context) const { return _GetPlayer(itr->first, itr->second.OfflineRemoveTime != 0, context); } Player* _GetPlayerForTeam(uint32 teamId, BattlegroundPlayerMap::const_iterator itr, const char* context) const; @@ -492,12 +490,12 @@ class Battleground // Scorekeeping BattlegroundScoreMap PlayerScores; // Player scores // must be implemented in BG subclass - virtual void RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/) { } + virtual void RemovePlayer(Player* /*player*/, ObjectGuid /*guid*/, uint32 /*team*/) { } // Player lists, those need to be accessible by inherited classes - BattlegroundPlayerMap m_Players; + BattlegroundPlayerMap m_Players; // Spirit Guide guid + Player list GUIDS - std::map<uint64, std::vector<uint64> > m_ReviveQueue; + std::map<ObjectGuid, GuidVector> m_ReviveQueue; // these are important variables used for starting messages uint8 m_Events; @@ -568,8 +566,8 @@ class Battleground virtual void PostUpdateImpl(uint32 /* diff */) { } // Player lists - std::vector<uint64> m_ResurrectQueue; // Player GUID - std::deque<uint64> m_OfflineQueue; // Player GUID + GuidVector m_ResurrectQueue; // Player GUID + GuidDeque m_OfflineQueue; // Player GUID // Invited counters are useful for player invitation to BG - do not allow, if BG is started to one faction to have 2 more players than another faction // Invited counters will be changed only when removing already invited player from queue, removing player from battleground and inviting player to BG diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index 82ea0901875..f5ee1690588 100644 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -237,7 +237,7 @@ void BattlegroundMgr::BuildPlaySoundPacket(WorldPacket* data, uint32 soundid) *data << uint32(soundid); } -void BattlegroundMgr::BuildPlayerLeftBattlegroundPacket(WorldPacket* data, uint64 guid) +void BattlegroundMgr::BuildPlayerLeftBattlegroundPacket(WorldPacket* data, ObjectGuid guid) { data->Initialize(SMSG_BATTLEGROUND_PLAYER_LEFT, 8); *data << uint64(guid); @@ -626,7 +626,7 @@ void BattlegroundMgr::InitAutomaticArenaPointDistribution() TC_LOG_DEBUG("bg.battleground", "Automatic Arena Point Distribution initialized."); } -void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid, Player* player, BattlegroundTypeId bgTypeId, uint8 fromWhere) +void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, ObjectGuid guid, Player* player, BattlegroundTypeId bgTypeId, uint8 fromWhere) { if (!player) return; @@ -707,7 +707,7 @@ void BattlegroundMgr::SendToBattleground(Player* player, uint32 instanceId, Batt TC_LOG_ERROR("bg.battleground", "BattlegroundMgr::SendToBattleground: Instance %u (bgType %u) not found while trying to teleport player %s", instanceId, bgTypeId, player->GetName().c_str()); } -void BattlegroundMgr::SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, uint64 guid) +void BattlegroundMgr::SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, ObjectGuid guid) { WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12); uint32 time_ = 30000 - bg->GetLastResurrectTime(); // resurrect every 30 seconds diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.h b/src/server/game/Battlegrounds/BattlegroundMgr.h index c21c34d1a10..3b245cae47f 100644 --- a/src/server/game/Battlegrounds/BattlegroundMgr.h +++ b/src/server/game/Battlegrounds/BattlegroundMgr.h @@ -72,13 +72,13 @@ class BattlegroundMgr /* Packet Building */ void BuildPlayerJoinedBattlegroundPacket(WorldPacket* data, Player* player); - void BuildPlayerLeftBattlegroundPacket(WorldPacket* data, uint64 guid); - void BuildBattlegroundListPacket(WorldPacket* data, uint64 guid, Player* player, BattlegroundTypeId bgTypeId, uint8 fromWhere); + void BuildPlayerLeftBattlegroundPacket(WorldPacket* data, ObjectGuid guid); + void BuildBattlegroundListPacket(WorldPacket* data, ObjectGuid guid, Player* player, BattlegroundTypeId bgTypeId, uint8 fromWhere); void BuildGroupJoinedBattlegroundPacket(WorldPacket* data, GroupJoinBattlegroundResult result); void BuildUpdateWorldStatePacket(WorldPacket* data, uint32 field, uint32 value); void BuildBattlegroundStatusPacket(WorldPacket* data, Battleground* bg, uint8 queueSlot, uint8 statusId, uint32 time1, uint32 time2, uint8 arenaType, uint32 arenaFaction); void BuildPlaySoundPacket(WorldPacket* data, uint32 soundId); - void SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, uint64 guid); + void SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, ObjectGuid guid); /* Battlegrounds */ Battleground* GetBattlegroundThroughClientInstance(uint32 instanceId, BattlegroundTypeId bgTypeId); diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp index e52f75a1c41..46fbd43bfbb 100644 --- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp +++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp @@ -281,7 +281,7 @@ uint32 BattlegroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, Battleg } //remove player from queue and from group info, if group info is empty then remove it too -void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount) +void BattlegroundQueue::RemovePlayer(ObjectGuid guid, bool decreaseInvitedCount) { int32 bracket_id = -1; // signed for proper for-loop finish QueuedPlayersMap::iterator itr; @@ -293,7 +293,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount) std::string playerName = "Unknown"; if (Player* player = ObjectAccessor::FindPlayer(guid)) playerName = player->GetName(); - TC_LOG_ERROR("bg.battleground", "BattlegroundQueue: couldn't find player %s (GUID: %u)", playerName.c_str(), GUID_LOPART(guid)); + TC_LOG_ERROR("bg.battleground", "BattlegroundQueue: couldn't find player %s (GUID: %u)", playerName.c_str(), guid.GetCounter()); return; } @@ -328,10 +328,10 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount) //player can't be in queue without group, but just in case if (bracket_id == -1) { - TC_LOG_ERROR("bg.battleground", "BattlegroundQueue: ERROR Cannot find groupinfo for player GUID: %u", GUID_LOPART(guid)); + TC_LOG_ERROR("bg.battleground", "BattlegroundQueue: ERROR Cannot find groupinfo for player GUID: %u", guid.GetCounter()); return; } - TC_LOG_DEBUG("bg.battleground", "BattlegroundQueue: Removing player GUID %u, from bracket_id %u", GUID_LOPART(guid), (uint32)bracket_id); + TC_LOG_DEBUG("bg.battleground", "BattlegroundQueue: Removing player GUID %u, from bracket_id %u", guid.GetCounter(), (uint32)bracket_id); // ALL variables are correctly set // We can ignore leveling up in queue - it should not cause crash @@ -339,7 +339,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount) // if only one player there, remove group // remove player queue info from group queue info - std::map<uint64, PlayerQueueInfo*>::iterator pitr = group->Players.find(guid); + std::map<ObjectGuid, PlayerQueueInfo*>::iterator pitr = group->Players.find(guid); if (pitr != group->Players.end()) group->Players.erase(pitr); @@ -361,7 +361,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount) { if (ArenaTeam* at = sArenaTeamMgr->GetArenaTeamById(group->ArenaTeamId)) { - TC_LOG_DEBUG("bg.battleground", "UPDATING memberLost's personal arena rating for %u by opponents rating: %u", GUID_LOPART(guid), group->OpponentsTeamRating); + TC_LOG_DEBUG("bg.battleground", "UPDATING memberLost's personal arena rating for %u by opponents rating: %u", guid.GetCounter(), group->OpponentsTeamRating); if (Player* player = ObjectAccessor::FindPlayer(guid)) at->MemberLost(player, group->OpponentsMatchmakerRating); else @@ -402,7 +402,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount) } //returns true when player pl_guid is in queue and is invited to bgInstanceGuid -bool BattlegroundQueue::IsPlayerInvited(uint64 pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime) +bool BattlegroundQueue::IsPlayerInvited(ObjectGuid pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime) { QueuedPlayersMap::const_iterator qItr = m_QueuedPlayers.find(pl_guid); return (qItr != m_QueuedPlayers.end() @@ -410,7 +410,7 @@ bool BattlegroundQueue::IsPlayerInvited(uint64 pl_guid, const uint32 bgInstanceG && qItr->second.GroupInfo->RemoveInviteTime == removeTime); } -bool BattlegroundQueue::GetPlayerGroupInfoData(uint64 guid, GroupQueueInfo* ginfo) +bool BattlegroundQueue::GetPlayerGroupInfoData(ObjectGuid guid, GroupQueueInfo* ginfo) { QueuedPlayersMap::const_iterator qItr = m_QueuedPlayers.find(guid); if (qItr == m_QueuedPlayers.end()) @@ -446,7 +446,7 @@ bool BattlegroundQueue::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, ginfo->RemoveInviteTime = getMSTime() + INVITE_ACCEPT_WAIT_TIME; // loop through the players - for (std::map<uint64, PlayerQueueInfo*>::iterator itr = ginfo->Players.begin(); itr != ginfo->Players.end(); ++itr) + for (std::map<ObjectGuid, PlayerQueueInfo*>::iterator itr = ginfo->Players.begin(); itr != ginfo->Players.end(); ++itr) { // get the player Player* player = ObjectAccessor::FindPlayer(itr->first); diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.h b/src/server/game/Battlegrounds/BattlegroundQueue.h index f95e8bafd06..051ed06f27b 100644 --- a/src/server/game/Battlegrounds/BattlegroundQueue.h +++ b/src/server/game/Battlegrounds/BattlegroundQueue.h @@ -40,7 +40,7 @@ struct PlayerQueueInfo // stores informatio struct GroupQueueInfo // stores information about the group in queue (also used when joined as solo!) { - std::map<uint64, PlayerQueueInfo*> Players; // player queue info map + std::map<ObjectGuid, PlayerQueueInfo*> Players; // player queue info map uint32 Team; // Player team (ALLIANCE/HORDE) BattlegroundTypeId BgTypeId; // battleground type id bool IsRated; // rated @@ -79,13 +79,13 @@ class BattlegroundQueue bool CheckNormalMatch(Battleground* bg_template, BattlegroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers); bool CheckSkirmishForSameFaction(BattlegroundBracketId bracket_id, uint32 minPlayersPerTeam); GroupQueueInfo* AddGroup(Player* leader, Group* group, BattlegroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 ArenaType, bool isRated, bool isPremade, uint32 ArenaRating, uint32 MatchmakerRating, uint32 ArenaTeamId = 0); - void RemovePlayer(uint64 guid, bool decreaseInvitedCount); - bool IsPlayerInvited(uint64 pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime); - bool GetPlayerGroupInfoData(uint64 guid, GroupQueueInfo* ginfo); + void RemovePlayer(ObjectGuid guid, bool decreaseInvitedCount); + bool IsPlayerInvited(ObjectGuid pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime); + bool GetPlayerGroupInfoData(ObjectGuid guid, GroupQueueInfo* ginfo); void PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo, BattlegroundBracketId bracket_id); uint32 GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BattlegroundBracketId bracket_id) const; - typedef std::map<uint64, PlayerQueueInfo> QueuedPlayersMap; + typedef std::map<ObjectGuid, PlayerQueueInfo> QueuedPlayersMap; QueuedPlayersMap m_QueuedPlayers; //do NOT use deque because deque.erase() invalidates ALL iterators @@ -138,7 +138,7 @@ class BattlegroundQueue class BGQueueInviteEvent : public BasicEvent { public: - BGQueueInviteEvent(uint64 pl_guid, uint32 BgInstanceGUID, BattlegroundTypeId BgTypeId, uint8 arenaType, uint32 removeTime) : + BGQueueInviteEvent(ObjectGuid pl_guid, uint32 BgInstanceGUID, BattlegroundTypeId BgTypeId, uint8 arenaType, uint32 removeTime) : m_PlayerGuid(pl_guid), m_BgInstanceGUID(BgInstanceGUID), m_BgTypeId(BgTypeId), m_ArenaType(arenaType), m_RemoveTime(removeTime) { } virtual ~BGQueueInviteEvent() { } @@ -146,7 +146,7 @@ class BGQueueInviteEvent : public BasicEvent virtual bool Execute(uint64 e_time, uint32 p_time) override; virtual void Abort(uint64 e_time) override; private: - uint64 m_PlayerGuid; + ObjectGuid m_PlayerGuid; uint32 m_BgInstanceGUID; BattlegroundTypeId m_BgTypeId; uint8 m_ArenaType; @@ -161,7 +161,7 @@ class BGQueueInviteEvent : public BasicEvent class BGQueueRemoveEvent : public BasicEvent { public: - BGQueueRemoveEvent(uint64 pl_guid, uint32 bgInstanceGUID, BattlegroundTypeId BgTypeId, BattlegroundQueueTypeId bgQueueTypeId, uint32 removeTime) + BGQueueRemoveEvent(ObjectGuid pl_guid, uint32 bgInstanceGUID, BattlegroundTypeId BgTypeId, BattlegroundQueueTypeId bgQueueTypeId, uint32 removeTime) : m_PlayerGuid(pl_guid), m_BgInstanceGUID(bgInstanceGUID), m_RemoveTime(removeTime), m_BgTypeId(BgTypeId), m_BgQueueTypeId(bgQueueTypeId) { } @@ -170,7 +170,7 @@ class BGQueueRemoveEvent : public BasicEvent virtual bool Execute(uint64 e_time, uint32 p_time) override; virtual void Abort(uint64 e_time) override; private: - uint64 m_PlayerGuid; + ObjectGuid m_PlayerGuid; uint32 m_BgInstanceGUID; uint32 m_RemoveTime; BattlegroundTypeId m_BgTypeId; diff --git a/src/server/game/Battlegrounds/BattlegroundScore.h b/src/server/game/Battlegrounds/BattlegroundScore.h index f91c2aae579..acdeb44db84 100644 --- a/src/server/game/Battlegrounds/BattlegroundScore.h +++ b/src/server/game/Battlegrounds/BattlegroundScore.h @@ -19,6 +19,7 @@ #define TRINITY_BATTLEGROUND_SCORE_H #include "WorldPacket.h" +#include "ObjectGuid.h" enum ScoreType { @@ -55,7 +56,7 @@ struct BattlegroundScore friend class Battleground; protected: - BattlegroundScore(uint64 playerGuid) : PlayerGuid(playerGuid), KillingBlows(0), Deaths(0), + BattlegroundScore(ObjectGuid playerGuid) : PlayerGuid(playerGuid), KillingBlows(0), Deaths(0), HonorableKills(0), BonusHonor(0), DamageDone(0), HealingDone(0) { } virtual ~BattlegroundScore() { } @@ -120,7 +121,7 @@ struct BattlegroundScore virtual uint32 GetAttr4() const { return 0; } virtual uint32 GetAttr5() const { return 0; } - uint64 PlayerGuid; + ObjectGuid PlayerGuid; // Default score, present in every type uint32 KillingBlows; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp index 2622ab9501f..6828532f9af 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp @@ -227,7 +227,7 @@ void BattlegroundAB::AddPlayer(Player* player) PlayerScores[player->GetGUIDLow()] = new BattlegroundABScore(player->GetGUID()); } -void BattlegroundAB::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/) +void BattlegroundAB::RemovePlayer(Player* /*player*/, ObjectGuid /*guid*/, uint32 /*team*/) { } @@ -392,7 +392,7 @@ void BattlegroundAB::_NodeOccupied(uint8 node, Team team) if (capturedNodes >= 4) CastSpellOnTeam(SPELL_AB_QUEST_REWARD_4_BASES, team); - Creature* trigger = BgCreatures[node+7] ? GetBGCreature(node+7) : NULL; // 0-6 spirit guides + Creature* trigger = !BgCreatures[node + 7] ? GetBGCreature(node + 7) : NULL; // 0-6 spirit guides if (!trigger) trigger = AddCreature(WORLD_TRIGGER, node+7, BG_AB_NodePositions[node], GetTeamIndexByTeamId(team)); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h index aed82efd5cb..fcda571088e 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h @@ -242,7 +242,7 @@ struct BattlegroundABScore final : public BattlegroundScore friend class BattlegroundAB; protected: - BattlegroundABScore(uint64 playerGuid) : BattlegroundScore(playerGuid), BasesAssaulted(0), BasesDefended(0) { } + BattlegroundABScore(ObjectGuid playerGuid) : BattlegroundScore(playerGuid), BasesAssaulted(0), BasesDefended(0) { } void UpdateScore(uint32 type, uint32 value) override { @@ -283,7 +283,7 @@ class BattlegroundAB : public Battleground void AddPlayer(Player* player) override; void StartingEventCloseDoors() override; void StartingEventOpenDoors() override; - void RemovePlayer(Player* player, uint64 guid, uint32 team) override; + void RemovePlayer(Player* player, ObjectGuid guid, uint32 team) override; void HandleAreaTrigger(Player* Source, uint32 Trigger) override; bool SetupBattleground() override; void Reset() override; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp index fde358b4d61..c028698f5ae 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp @@ -480,7 +480,7 @@ void BattlegroundAV::EndBattleground(uint32 winner) Battleground::EndBattleground(winner); } -void BattlegroundAV::RemovePlayer(Player* player, uint64 /*guid*/, uint32 /*team*/) +void BattlegroundAV::RemovePlayer(Player* player, ObjectGuid /*guid*/, uint32 /*team*/) { if (!player) { diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h index 22534d2015b..07211bafab4 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h @@ -1554,7 +1554,7 @@ struct BattlegroundAVScore final : public BattlegroundScore friend class BattlegroundAV; protected: - BattlegroundAVScore(uint64 playerGuid) : BattlegroundScore(playerGuid), GraveyardsAssaulted(0), GraveyardsDefended(0), TowersAssaulted(0), TowersDefended(0), MinesCaptured(0) { } + BattlegroundAVScore(ObjectGuid playerGuid) : BattlegroundScore(playerGuid), GraveyardsAssaulted(0), GraveyardsDefended(0), TowersAssaulted(0), TowersDefended(0), MinesCaptured(0) { } void UpdateScore(uint32 type, uint32 value) override { @@ -1615,7 +1615,7 @@ class BattlegroundAV : public Battleground void StartingEventCloseDoors() override; void StartingEventOpenDoors() override; - void RemovePlayer(Player* player, uint64 guid, uint32 team) override; + void RemovePlayer(Player* player, ObjectGuid guid, uint32 team) override; void HandleAreaTrigger(Player* player, uint32 trigger) override; bool SetupBattleground() override; void ResetBGSubclass() override; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp index ca96140f5da..1a84c33095f 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp @@ -46,8 +46,8 @@ BattlegroundEY::BattlegroundEY() m_HonorScoreTics[TEAM_HORDE] = 0; m_TeamPointsCount[TEAM_ALLIANCE] = 0; m_TeamPointsCount[TEAM_HORDE] = 0; - m_FlagKeeper = 0; - m_DroppedFlagGUID = 0; + m_FlagKeeper.Clear(); + m_DroppedFlagGUID.Clear(); m_FlagCapturedBgObjectType = 0; m_FlagState = BG_EY_FLAG_STATE_ON_BASE; m_FlagsTimer = 0; @@ -171,7 +171,7 @@ void BattlegroundEY::CheckSomeoneJoinedPoint() Player* player = ObjectAccessor::FindPlayer(m_PlayersNearPoint[EY_POINTS_MAX][j]); if (!player) { - TC_LOG_ERROR("bg.battleground", "BattlegroundEY:CheckSomeoneJoinedPoint: Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[EY_POINTS_MAX][j])); + TC_LOG_ERROR("bg.battleground", "BattlegroundEY:CheckSomeoneJoinedPoint: Player (%s) not found!", m_PlayersNearPoint[EY_POINTS_MAX][j].ToString().c_str()); ++j; continue; } @@ -211,7 +211,7 @@ void BattlegroundEY::CheckSomeoneLeftPoint() Player* player = ObjectAccessor::FindPlayer(m_PlayersNearPoint[i][j]); if (!player) { - TC_LOG_ERROR("bg.battleground", "BattlegroundEY:CheckSomeoneLeftPoint Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[i][j])); + TC_LOG_ERROR("bg.battleground", "BattlegroundEY:CheckSomeoneLeftPoint Player (%s) not found!", m_PlayersNearPoint[i][j].ToString().c_str()); //move not existed player to "free space" - this will cause many error showing in log, but it is a very important bug m_PlayersNearPoint[EY_POINTS_MAX].push_back(m_PlayersNearPoint[i][j]); m_PlayersNearPoint[i].erase(m_PlayersNearPoint[i].begin() + j); @@ -368,7 +368,7 @@ void BattlegroundEY::AddPlayer(Player* player) m_PlayersNearPoint[EY_POINTS_MAX].push_back(player->GetGUID()); } -void BattlegroundEY::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/) +void BattlegroundEY::RemovePlayer(Player* player, ObjectGuid guid, uint32 /*team*/) { // sometimes flag aura not removed :( for (int j = EY_POINTS_MAX; j >= 0; --j) @@ -385,7 +385,7 @@ void BattlegroundEY::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/) EventPlayerDroppedFlag(player); else { - SetFlagPicker(0); + SetFlagPicker(ObjectGuid::Empty); RespawnFlag(true); } } @@ -548,8 +548,8 @@ void BattlegroundEY::Reset() m_HonorScoreTics[TEAM_HORDE] = 0; m_FlagState = BG_EY_FLAG_STATE_ON_BASE; m_FlagCapturedBgObjectType = 0; - m_FlagKeeper = 0; - m_DroppedFlagGUID = 0; + m_FlagKeeper.Clear(); + m_DroppedFlagGUID.Clear(); m_PointAddingTimer = 0; m_TowerCapCheckTimer = 0; bool isBGWeekend = sBattlegroundMgr->IsBGWeekend(GetTypeID()); @@ -593,9 +593,9 @@ void BattlegroundEY::RespawnFlagAfterDrop() if (obj) obj->Delete(); else - TC_LOG_ERROR("bg.battleground", "BattlegroundEY: Unknown dropped flag guid: %u", GUID_LOPART(GetDroppedFlagGUID())); + TC_LOG_ERROR("bg.battleground", "BattlegroundEY: Unknown dropped flag guid: %s", GetDroppedFlagGUID().ToString().c_str()); - SetDroppedFlagGUID(0); + SetDroppedFlagGUID(ObjectGuid::Empty); } void BattlegroundEY::HandleKillPlayer(Player* player, Player* killer) @@ -615,7 +615,7 @@ void BattlegroundEY::EventPlayerDroppedFlag(Player* player) // just take off the aura if (IsFlagPickedup() && GetFlagPickerGUID() == player->GetGUID()) { - SetFlagPicker(0); + SetFlagPicker(ObjectGuid::Empty); player->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL); } return; @@ -627,7 +627,7 @@ void BattlegroundEY::EventPlayerDroppedFlag(Player* player) if (GetFlagPickerGUID() != player->GetGUID()) return; - SetFlagPicker(0); + SetFlagPicker(ObjectGuid::Empty); player->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL); m_FlagState = BG_EY_FLAG_STATE_ON_GROUND; m_FlagsTimer = BG_EY_FLAG_RESPAWN_TIME; @@ -795,7 +795,7 @@ void BattlegroundEY::EventPlayerCapturedFlag(Player* player, uint32 BgObjectType if (GetStatus() != STATUS_IN_PROGRESS || GetFlagPickerGUID() != player->GetGUID()) return; - SetFlagPicker(0); + SetFlagPicker(ObjectGuid::Empty); m_FlagState = BG_EY_FLAG_STATE_WAIT_RESPAWN; player->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h index 408037b254e..0d6302e7f11 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h @@ -328,7 +328,7 @@ struct BattlegroundEYScore final : public BattlegroundScore friend class BattlegroundEY; protected: - BattlegroundEYScore(uint64 playerGuid) : BattlegroundScore(playerGuid), FlagCaptures(0) { } + BattlegroundEYScore(ObjectGuid playerGuid) : BattlegroundScore(playerGuid), FlagCaptures(0) { } void UpdateScore(uint32 type, uint32 value) override { @@ -366,15 +366,14 @@ class BattlegroundEY : public Battleground void StartingEventOpenDoors() override; /* BG Flags */ - uint64 GetFlagPickerGUID(int32 /*team*/ = -1) const override { return m_FlagKeeper; } - void SetFlagPicker(uint64 guid) { m_FlagKeeper = guid; } - bool IsFlagPickedup() const { return m_FlagKeeper != 0; } + ObjectGuid GetFlagPickerGUID(int32 /*team*/ = -1) const override { return m_FlagKeeper; } + void SetFlagPicker(ObjectGuid guid) { m_FlagKeeper = guid; } + bool IsFlagPickedup() const { return !m_FlagKeeper.IsEmpty(); } uint8 GetFlagState() const { return m_FlagState; } void RespawnFlag(bool send_message); void RespawnFlagAfterDrop(); - void RemovePlayer(Player* player, uint64 guid, uint32 team) override; - void HandleBuffUse(uint64 buff_guid); + void RemovePlayer(Player* player, ObjectGuid guid, uint32 team) override; void HandleAreaTrigger(Player* Source, uint32 Trigger) override; void HandleKillPlayer(Player* player, Player* killer) override; WorldSafeLocsEntry const* GetClosestGraveYard(Player* player) override; @@ -384,8 +383,8 @@ class BattlegroundEY : public Battleground void EndBattleground(uint32 winner) override; bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override; void FillInitialWorldStates(WorldPacket& data) override; - void SetDroppedFlagGUID(uint64 guid, int32 /*TeamID*/ = -1) override { m_DroppedFlagGUID = guid;} - uint64 GetDroppedFlagGUID() const { return m_DroppedFlagGUID;} + void SetDroppedFlagGUID(ObjectGuid guid, int32 /*TeamID*/ = -1) override { m_DroppedFlagGUID = guid; } + ObjectGuid GetDroppedFlagGUID() const { return m_DroppedFlagGUID; } /* Battleground Events */ void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj) override; @@ -420,8 +419,8 @@ class BattlegroundEY : public Battleground uint32 m_Points_Trigger[EY_POINTS_MAX]; - uint64 m_FlagKeeper; // keepers guid - uint64 m_DroppedFlagGUID; + ObjectGuid m_FlagKeeper; // keepers guid + ObjectGuid m_DroppedFlagGUID; uint32 m_FlagCapturedBgObjectType; // type that should be despawned when flag is captured uint8 m_FlagState; // for checking flag state int32 m_FlagsTimer; @@ -430,8 +429,7 @@ class BattlegroundEY : public Battleground uint32 m_PointOwnedByTeam[EY_POINTS_MAX]; uint8 m_PointState[EY_POINTS_MAX]; int32 m_PointBarStatus[EY_POINTS_MAX]; - typedef std::vector<uint64> PlayersNearPointType; - PlayersNearPointType m_PlayersNearPoint[EY_POINTS_MAX + 1]; + GuidVector m_PlayersNearPoint[EY_POINTS_MAX + 1]; uint8 m_CurrentPointPlayersCount[2*EY_POINTS_MAX]; int32 m_PointAddingTimer; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp index 41a37a8962f..7312b75944d 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp @@ -68,7 +68,7 @@ void BattlegroundIC::HandlePlayerResurrect(Player* player) player->CastSpell(player, SPELL_OIL_REFINERY, true); } -void BattlegroundIC::DoAction(uint32 action, uint64 var) +void BattlegroundIC::DoAction(uint32 action, ObjectGuid var) { if (action != ACTION_TELEPORT_PLAYER_TO_TRANSPORT) return; @@ -282,7 +282,7 @@ void BattlegroundIC::AddPlayer(Player* player) player->CastSpell(player, SPELL_OIL_REFINERY, true); } -void BattlegroundIC::RemovePlayer(Player* player, uint64 /*guid*/, uint32 /*team*/) +void BattlegroundIC::RemovePlayer(Player* player, ObjectGuid /*guid*/, uint32 /*team*/) { if (player) { diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h index c772078a647..1b1d71f362e 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h @@ -853,7 +853,7 @@ struct BattlegroundICScore final : public BattlegroundScore friend class BattlegroundIC; protected: - BattlegroundICScore(uint64 playerGuid) : BattlegroundScore(playerGuid), BasesAssaulted(0), BasesDefended(0) { } + BattlegroundICScore(ObjectGuid playerGuid) : BattlegroundScore(playerGuid), BasesAssaulted(0), BasesDefended(0) { } void UpdateScore(uint32 type, uint32 value) override { @@ -897,7 +897,7 @@ class BattlegroundIC : public Battleground void StartingEventOpenDoors() override; void PostUpdateImpl(uint32 diff) override; - void RemovePlayer(Player* player, uint64 guid, uint32 team) override; + void RemovePlayer(Player* player, ObjectGuid guid, uint32 team) override; void HandleAreaTrigger(Player* player, uint32 trigger) override; bool SetupBattleground() override; void SpawnLeader(uint32 teamid); @@ -913,7 +913,7 @@ class BattlegroundIC : public Battleground /* Scorekeeping */ void FillInitialWorldStates(WorldPacket& data) override; - void DoAction(uint32 action, uint64 var) override; + void DoAction(uint32 action, ObjectGuid var) override; void HandlePlayerResurrect(Player* player) override; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index 95a4642acd7..e0c5671778d 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -506,7 +506,7 @@ void BattlegroundSA::AddPlayer(Player* player) } } -void BattlegroundSA::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/) { } +void BattlegroundSA::RemovePlayer(Player* /*player*/, ObjectGuid /*guid*/, uint32 /*team*/) { } void BattlegroundSA::HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/) { diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h index eae9e02ba9e..23fa0d80147 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h @@ -513,7 +513,7 @@ struct BattlegroundSAScore final : public BattlegroundScore friend class BattlegroundSA; protected: - BattlegroundSAScore(uint64 playerGuid) : BattlegroundScore(playerGuid), DemolishersDestroyed(0), GatesDestroyed(0) { } + BattlegroundSAScore(ObjectGuid playerGuid) : BattlegroundScore(playerGuid), DemolishersDestroyed(0), GatesDestroyed(0) { } void UpdateScore(uint32 type, uint32 value) override { @@ -594,7 +594,7 @@ class BattlegroundSA : public Battleground void EndBattleground(uint32 winner) override; /// Called when a player leave battleground - void RemovePlayer(Player* player, uint64 guid, uint32 team) override; + void RemovePlayer(Player* player, ObjectGuid guid, uint32 team) override; void HandleAreaTrigger(Player* Source, uint32 Trigger) override; /* Scorekeeping */ diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp index c50669b137e..a6f807cb370 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp @@ -54,10 +54,10 @@ BattlegroundWS::BattlegroundWS() _flagSpellForceTimer = 0; _bothFlagsKept = false; _flagDebuffState = 0; - m_FlagKeepers[TEAM_ALLIANCE] = 0; - m_FlagKeepers[TEAM_HORDE] = 0; - m_DroppedFlagGUID[TEAM_ALLIANCE] = 0; - m_DroppedFlagGUID[TEAM_HORDE] = 0; + m_FlagKeepers[TEAM_ALLIANCE].Clear(); + m_FlagKeepers[TEAM_HORDE].Clear(); + m_DroppedFlagGUID[TEAM_ALLIANCE].Clear(); + m_DroppedFlagGUID[TEAM_HORDE].Clear(); _flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE; _flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE; _flagsTimer[TEAM_ALLIANCE] = 0; @@ -278,9 +278,9 @@ void BattlegroundWS::RespawnFlagAfterDrop(uint32 team) if (GameObject* obj = GetBgMap()->GetGameObject(GetDroppedFlagGUID(team))) obj->Delete(); else - TC_LOG_ERROR("bg.battleground", "unknown droped flag bg, guid: %u", GUID_LOPART(GetDroppedFlagGUID(team))); + TC_LOG_ERROR("bg.battleground", "unknown droped flag bg, guid: %s", GetDroppedFlagGUID(team).ToString().c_str()); - SetDroppedFlagGUID(0, GetTeamIndexByTeamId(team)); + SetDroppedFlagGUID(ObjectGuid::Empty, GetTeamIndexByTeamId(team)); _bothFlagsKept = false; } @@ -296,7 +296,7 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* player) { if (!IsHordeFlagPickedup()) return; - SetHordeFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time + SetHordeFlagPicker(ObjectGuid::Empty); // must be before aura remove to prevent 2 events (drop+capture) at the same time // horde flag in base (but not respawned yet) _flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN; // Drop Horde Flag from Player @@ -315,7 +315,7 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* player) { if (!IsAllianceFlagPickedup()) return; - SetAllianceFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time + SetAllianceFlagPicker(ObjectGuid::Empty); // must be before aura remove to prevent 2 events (drop+capture) at the same time // alliance flag in base (but not respawned yet) _flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN; // Drop Alliance Flag from Player @@ -385,7 +385,7 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* player) if (GetFlagPickerGUID(TEAM_HORDE) == player->GetGUID()) { - SetHordeFlagPicker(0); + SetHordeFlagPicker(ObjectGuid::Empty); player->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG); } } @@ -396,7 +396,7 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* player) if (GetFlagPickerGUID(TEAM_ALLIANCE) == player->GetGUID()) { - SetAllianceFlagPicker(0); + SetAllianceFlagPicker(ObjectGuid::Empty); player->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG); } } @@ -411,7 +411,7 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* player) return; if (GetFlagPickerGUID(TEAM_HORDE) == player->GetGUID()) { - SetHordeFlagPicker(0); + SetHordeFlagPicker(ObjectGuid::Empty); player->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG); if (_flagDebuffState == 1) player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); @@ -428,7 +428,7 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* player) return; if (GetFlagPickerGUID(TEAM_ALLIANCE) == player->GetGUID()) { - SetAllianceFlagPicker(0); + SetAllianceFlagPicker(ObjectGuid::Empty); player->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG); if (_flagDebuffState == 1) player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); @@ -583,7 +583,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* target player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); } -void BattlegroundWS::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/) +void BattlegroundWS::RemovePlayer(Player* player, ObjectGuid guid, uint32 /*team*/) { // sometimes flag aura not removed :( if (IsAllianceFlagPickedup() && m_FlagKeepers[TEAM_ALLIANCE] == guid) @@ -591,7 +591,7 @@ void BattlegroundWS::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/) if (!player) { TC_LOG_ERROR("bg.battleground", "BattlegroundWS: Removing offline player who has the FLAG!!"); - SetAllianceFlagPicker(0); + SetAllianceFlagPicker(ObjectGuid::Empty); RespawnFlag(ALLIANCE, false); } else @@ -602,7 +602,7 @@ void BattlegroundWS::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/) if (!player) { TC_LOG_ERROR("bg.battleground", "BattlegroundWS: Removing offline player who has the FLAG!!"); - SetHordeFlagPicker(0); + SetHordeFlagPicker(ObjectGuid::Empty); RespawnFlag(HORDE, false); } else @@ -731,10 +731,10 @@ void BattlegroundWS::Reset() //call parent's class reset Battleground::Reset(); - m_FlagKeepers[TEAM_ALLIANCE] = 0; - m_FlagKeepers[TEAM_HORDE] = 0; - m_DroppedFlagGUID[TEAM_ALLIANCE] = 0; - m_DroppedFlagGUID[TEAM_HORDE] = 0; + m_FlagKeepers[TEAM_ALLIANCE].Clear(); + m_FlagKeepers[TEAM_HORDE].Clear(); + m_DroppedFlagGUID[TEAM_ALLIANCE].Clear(); + m_DroppedFlagGUID[TEAM_HORDE].Clear(); _flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE; _flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE; m_TeamScores[TEAM_ALLIANCE] = 0; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h index 71bd5d53047..3db2ac941f3 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h @@ -152,7 +152,7 @@ struct BattlegroundWGScore final : public BattlegroundScore friend class BattlegroundWS; protected: - BattlegroundWGScore(uint64 playerGuid) : BattlegroundScore(playerGuid), FlagCaptures(0), FlagReturns(0) { } + BattlegroundWGScore(ObjectGuid playerGuid) : BattlegroundScore(playerGuid), FlagCaptures(0), FlagReturns(0) { } void UpdateScore(uint32 type, uint32 value) override { @@ -197,16 +197,16 @@ class BattlegroundWS : public Battleground void StartingEventOpenDoors() override; /* BG Flags */ - uint64 GetFlagPickerGUID(int32 team) const override + ObjectGuid GetFlagPickerGUID(int32 team) const override { if (team == TEAM_ALLIANCE || team == TEAM_HORDE) return m_FlagKeepers[team]; - return 0; + return ObjectGuid::Empty; } - void SetAllianceFlagPicker(uint64 guid) { m_FlagKeepers[TEAM_ALLIANCE] = guid; } - void SetHordeFlagPicker(uint64 guid) { m_FlagKeepers[TEAM_HORDE] = guid; } - bool IsAllianceFlagPickedup() const { return m_FlagKeepers[TEAM_ALLIANCE] != 0; } - bool IsHordeFlagPickedup() const { return m_FlagKeepers[TEAM_HORDE] != 0; } + void SetAllianceFlagPicker(ObjectGuid guid) { m_FlagKeepers[TEAM_ALLIANCE] = guid; } + void SetHordeFlagPicker(ObjectGuid guid) { m_FlagKeepers[TEAM_HORDE] = guid; } + bool IsAllianceFlagPickedup() const { return !m_FlagKeepers[TEAM_ALLIANCE].IsEmpty(); } + bool IsHordeFlagPickedup() const { return !m_FlagKeepers[TEAM_HORDE].IsEmpty(); } void RespawnFlag(uint32 Team, bool captured); void RespawnFlagAfterDrop(uint32 Team); uint8 GetFlagState(uint32 team) { return _flagState[GetTeamIndexByTeamId(team)]; } @@ -216,7 +216,7 @@ class BattlegroundWS : public Battleground void EventPlayerClickedOnFlag(Player* player, GameObject* target_obj) override; void EventPlayerCapturedFlag(Player* player); - void RemovePlayer(Player* player, uint64 guid, uint32 team) override; + void RemovePlayer(Player* player, ObjectGuid guid, uint32 team) override; void HandleAreaTrigger(Player* player, uint32 trigger) override; void HandleKillPlayer(Player* player, Player* killer) override; bool SetupBattleground() override; @@ -228,13 +228,13 @@ class BattlegroundWS : public Battleground void SetLastFlagCapture(uint32 team) { _lastFlagCaptureTeam = team; } void UpdateTeamScore(uint32 team); bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override; - void SetDroppedFlagGUID(uint64 guid, int32 team = -1) override + void SetDroppedFlagGUID(ObjectGuid guid, int32 team = -1) override { if (team == TEAM_ALLIANCE || team == TEAM_HORDE) m_DroppedFlagGUID[team] = guid; } - uint64 GetDroppedFlagGUID(uint32 TeamID) { return m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)];} + ObjectGuid GetDroppedFlagGUID(uint32 TeamID) { return m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)]; } void FillInitialWorldStates(WorldPacket& data) override; /* Scorekeeping */ @@ -248,8 +248,8 @@ class BattlegroundWS : public Battleground bool CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* source, Unit const* target = nullptr, uint32 miscvalue1 = 0) override; private: - uint64 m_FlagKeepers[2]; // 0 - alliance, 1 - horde - uint64 m_DroppedFlagGUID[2]; + ObjectGuid m_FlagKeepers[2]; // 0 - alliance, 1 - horde + ObjectGuid m_DroppedFlagGUID[2]; uint8 _flagState[2]; // for checking flag state int32 _flagsTimer[2]; int32 _flagsDropTimer[2]; diff --git a/src/server/game/Calendar/CalendarMgr.cpp b/src/server/game/Calendar/CalendarMgr.cpp index 92f19c0adeb..d85f3e7e9c5 100644 --- a/src/server/game/Calendar/CalendarMgr.cpp +++ b/src/server/game/Calendar/CalendarMgr.cpp @@ -58,7 +58,7 @@ void CalendarMgr::LoadFromDB() Field* fields = result->Fetch(); uint64 eventId = fields[0].GetUInt64(); - uint64 creatorGUID = MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_PLAYER); + ObjectGuid creatorGUID = ObjectGuid(HIGHGUID_PLAYER, fields[1].GetUInt32()); std::string title = fields[2].GetString(); std::string description = fields[3].GetString(); CalendarEventType type = CalendarEventType(fields[4].GetUInt8()); @@ -91,8 +91,8 @@ void CalendarMgr::LoadFromDB() uint64 inviteId = fields[0].GetUInt64(); uint64 eventId = fields[1].GetUInt64(); - uint64 invitee = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER); - uint64 senderGUID = MAKE_NEW_GUID(fields[3].GetUInt32(), 0, HIGHGUID_PLAYER); + ObjectGuid invitee = ObjectGuid(HIGHGUID_PLAYER, fields[2].GetUInt32()); + ObjectGuid senderGUID = ObjectGuid(HIGHGUID_PLAYER, fields[3].GetUInt32()); CalendarInviteStatus status = CalendarInviteStatus(fields[4].GetUInt8()); uint32 statusTime = fields[5].GetUInt32(); CalendarModerationRank rank = CalendarModerationRank(fields[6].GetUInt8()); @@ -146,7 +146,7 @@ void CalendarMgr::AddInvite(CalendarEvent* calendarEvent, CalendarInvite* invite } } -void CalendarMgr::RemoveEvent(uint64 eventId, uint64 remover) +void CalendarMgr::RemoveEvent(uint64 eventId, ObjectGuid remover) { CalendarEvent* calendarEvent = GetEvent(eventId); @@ -173,7 +173,7 @@ void CalendarMgr::RemoveEvent(uint64 eventId, uint64 remover) // guild events only? check invite status here? // When an event is deleted, all invited (accepted/declined? - verify) guildies are notified via in-game mail. (wowwiki) if (remover && invite->GetInviteeGUID() != remover) - mail.SendMailTo(trans, MailReceiver(invite->GetInviteeGUID()), calendarEvent, MAIL_CHECK_MASK_COPIED); + mail.SendMailTo(trans, MailReceiver(invite->GetInviteeGUID().GetCounter()), calendarEvent, MAIL_CHECK_MASK_COPIED); delete invite; } @@ -189,7 +189,7 @@ void CalendarMgr::RemoveEvent(uint64 eventId, uint64 remover) _events.erase(calendarEvent); } -void CalendarMgr::RemoveInvite(uint64 inviteId, uint64 eventId, uint64 /*remover*/) +void CalendarMgr::RemoveInvite(uint64 inviteId, uint64 eventId, ObjectGuid /*remover*/) { CalendarEvent* calendarEvent = GetEvent(eventId); @@ -228,7 +228,7 @@ void CalendarMgr::UpdateEvent(CalendarEvent* calendarEvent) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CALENDAR_EVENT); stmt->setUInt64(0, calendarEvent->GetEventId()); - stmt->setUInt32(1, GUID_LOPART(calendarEvent->GetCreatorGUID())); + stmt->setUInt32(1, calendarEvent->GetCreatorGUID().GetCounter()); stmt->setString(2, calendarEvent->GetTitle()); stmt->setString(3, calendarEvent->GetDescription()); stmt->setUInt8(4, calendarEvent->GetType()); @@ -250,8 +250,8 @@ void CalendarMgr::UpdateInvite(CalendarInvite* invite, SQLTransaction& trans) PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CALENDAR_INVITE); stmt->setUInt64(0, invite->GetInviteId()); stmt->setUInt64(1, invite->GetEventId()); - stmt->setUInt32(2, GUID_LOPART(invite->GetInviteeGUID())); - stmt->setUInt32(3, GUID_LOPART(invite->GetSenderGUID())); + stmt->setUInt32(2, invite->GetInviteeGUID().GetCounter()); + stmt->setUInt32(3, invite->GetSenderGUID().GetCounter()); stmt->setUInt8(4, invite->GetStatus()); stmt->setUInt32(5, uint32(invite->GetStatusTime())); stmt->setUInt8(6, invite->GetRank()); @@ -259,18 +259,18 @@ void CalendarMgr::UpdateInvite(CalendarInvite* invite, SQLTransaction& trans) CharacterDatabase.ExecuteOrAppend(trans, stmt); } -void CalendarMgr::RemoveAllPlayerEventsAndInvites(uint64 guid) +void CalendarMgr::RemoveAllPlayerEventsAndInvites(ObjectGuid guid) { for (CalendarEventStore::const_iterator itr = _events.begin(); itr != _events.end(); ++itr) if ((*itr)->GetCreatorGUID() == guid) - RemoveEvent((*itr)->GetEventId(), 0); // don't send mail if removing a character + RemoveEvent((*itr)->GetEventId(), ObjectGuid::Empty); // don't send mail if removing a character CalendarInviteStore playerInvites = GetPlayerInvites(guid); for (CalendarInviteStore::const_iterator itr = playerInvites.begin(); itr != playerInvites.end(); ++itr) RemoveInvite((*itr)->GetInviteId(), (*itr)->GetEventId(), guid); } -void CalendarMgr::RemovePlayerGuildEventsAndSignups(uint64 guid, uint32 guildId) +void CalendarMgr::RemovePlayerGuildEventsAndSignups(ObjectGuid guid, uint32 guildId) { for (CalendarEventStore::const_iterator itr = _events.begin(); itr != _events.end(); ++itr) if ((*itr)->GetCreatorGUID() == guid && ((*itr)->IsGuildEvent() || (*itr)->IsGuildAnnouncement())) @@ -340,7 +340,7 @@ uint64 CalendarMgr::GetFreeInviteId() return inviteId; } -CalendarEventStore CalendarMgr::GetPlayerEvents(uint64 guid) +CalendarEventStore CalendarMgr::GetPlayerEvents(ObjectGuid guid) { CalendarEventStore events; @@ -363,7 +363,7 @@ CalendarInviteStore const& CalendarMgr::GetEventInvites(uint64 eventId) return _invites[eventId]; } -CalendarInviteStore CalendarMgr::GetPlayerInvites(uint64 guid) +CalendarInviteStore CalendarMgr::GetPlayerInvites(ObjectGuid guid) { CalendarInviteStore invites; @@ -375,7 +375,7 @@ CalendarInviteStore CalendarMgr::GetPlayerInvites(uint64 guid) return invites; } -uint32 CalendarMgr::GetPlayerNumPending(uint64 guid) +uint32 CalendarMgr::GetPlayerNumPending(ObjectGuid guid) { CalendarInviteStore const& invites = GetPlayerInvites(guid); @@ -397,10 +397,10 @@ uint32 CalendarMgr::GetPlayerNumPending(uint64 guid) return pendingNum; } -std::string CalendarEvent::BuildCalendarMailSubject(uint64 remover) const +std::string CalendarEvent::BuildCalendarMailSubject(ObjectGuid remover) const { std::ostringstream strm; - strm << remover << ':' << _title; + strm << remover.GetRawValue() << ':' << _title; return strm.str(); } @@ -423,13 +423,13 @@ void CalendarMgr::SendCalendarEventInvite(CalendarInvite const& invite) time_t statusTime = invite.GetStatusTime(); bool hasStatusTime = statusTime != 946684800; // 01/01/2000 00:00:00 - uint64 invitee = invite.GetInviteeGUID(); + ObjectGuid invitee = invite.GetInviteeGUID(); Player* player = ObjectAccessor::FindPlayer(invitee); uint8 level = player ? player->getLevel() : Player::GetLevelFromDB(invitee); WorldPacket data(SMSG_CALENDAR_EVENT_INVITE, 8 + 8 + 8 + 1 + 1 + 1 + (statusTime ? 4 : 0) + 1); - data.appendPackGUID(invitee); + data << invitee.WriteAsPacked(); data << uint64(invite.GetEventId()); data << uint64(invite.GetInviteId()); data << uint8(level); @@ -474,7 +474,7 @@ void CalendarMgr::SendCalendarEventUpdateAlert(CalendarEvent const& calendarEven void CalendarMgr::SendCalendarEventStatus(CalendarEvent const& calendarEvent, CalendarInvite const& invite) { WorldPacket data(SMSG_CALENDAR_EVENT_STATUS, 8 + 8 + 4 + 4 + 1 + 1 + 4); - data.appendPackGUID(invite.GetInviteeGUID()); + data << invite.GetInviteeGUID().WriteAsPacked(); data << uint64(calendarEvent.GetEventId()); data.AppendPackedTime(calendarEvent.GetEventTime()); data << uint32(calendarEvent.GetFlags()); @@ -498,7 +498,7 @@ void CalendarMgr::SendCalendarEventRemovedAlert(CalendarEvent const& calendarEve void CalendarMgr::SendCalendarEventInviteRemove(CalendarEvent const& calendarEvent, CalendarInvite const& invite, uint32 flags) { WorldPacket data(SMSG_CALENDAR_EVENT_INVITE_REMOVED, 8 + 4 + 4 + 1); - data.appendPackGUID(invite.GetInviteeGUID()); + data << invite.GetInviteeGUID().WriteAsPacked(); data << uint64(invite.GetEventId()); data << uint32(flags); data << uint8(1); // FIXME @@ -509,7 +509,7 @@ void CalendarMgr::SendCalendarEventInviteRemove(CalendarEvent const& calendarEve void CalendarMgr::SendCalendarEventModeratorStatusAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite) { WorldPacket data(SMSG_CALENDAR_EVENT_MODERATOR_STATUS_ALERT, 8 + 8 + 1 + 1); - data.appendPackGUID(invite.GetInviteeGUID()); + data << invite.GetInviteeGUID().WriteAsPacked(); data << uint64(invite.GetEventId()); data << uint8(invite.GetRank()); data << uint8(1); // Unk boolean - Display to client? @@ -529,8 +529,8 @@ void CalendarMgr::SendCalendarEventInviteAlert(CalendarEvent const& calendarEven data << uint64(invite.GetInviteId()); data << uint8(invite.GetStatus()); data << uint8(invite.GetRank()); - data.appendPackGUID(calendarEvent.GetCreatorGUID()); - data.appendPackGUID(invite.GetSenderGUID()); + data << calendarEvent.GetCreatorGUID().WriteAsPacked(); + data << invite.GetSenderGUID().WriteAsPacked(); if (calendarEvent.IsGuildEvent() || calendarEvent.IsGuildAnnouncement()) { @@ -542,7 +542,7 @@ void CalendarMgr::SendCalendarEventInviteAlert(CalendarEvent const& calendarEven player->SendDirectMessage(&data); } -void CalendarMgr::SendCalendarEvent(uint64 guid, CalendarEvent const& calendarEvent, CalendarSendEventType sendType) +void CalendarMgr::SendCalendarEvent(ObjectGuid guid, CalendarEvent const& calendarEvent, CalendarSendEventType sendType) { Player* player = ObjectAccessor::FindPlayer(guid); if (!player) @@ -552,7 +552,7 @@ void CalendarMgr::SendCalendarEvent(uint64 guid, CalendarEvent const& calendarEv WorldPacket data(SMSG_CALENDAR_SEND_EVENT, 60 + eventInviteeList.size() * 32); data << uint8(sendType); - data.appendPackGUID(calendarEvent.GetCreatorGUID()); + data << calendarEvent.GetCreatorGUID().WriteAsPacked(); data << uint64(calendarEvent.GetEventId()); data << calendarEvent.GetTitle(); data << calendarEvent.GetDescription(); @@ -569,13 +569,13 @@ void CalendarMgr::SendCalendarEvent(uint64 guid, CalendarEvent const& calendarEv for (CalendarInviteStore::const_iterator itr = eventInviteeList.begin(); itr != eventInviteeList.end(); ++itr) { CalendarInvite const* calendarInvite = (*itr); - uint64 inviteeGuid = calendarInvite->GetInviteeGUID(); + ObjectGuid inviteeGuid = calendarInvite->GetInviteeGUID(); Player* invitee = ObjectAccessor::FindPlayer(inviteeGuid); uint8 inviteeLevel = invitee ? invitee->getLevel() : Player::GetLevelFromDB(inviteeGuid); uint32 inviteeGuildId = invitee ? invitee->GetGuildId() : Player::GetGuildIdFromDB(inviteeGuid); - data.appendPackGUID(inviteeGuid); + data << inviteeGuid.WriteAsPacked(); data << uint8(inviteeLevel); data << uint8(calendarInvite->GetStatus()); data << uint8(calendarInvite->GetRank()); @@ -588,7 +588,7 @@ void CalendarMgr::SendCalendarEvent(uint64 guid, CalendarEvent const& calendarEv player->SendDirectMessage(&data); } -void CalendarMgr::SendCalendarEventInviteRemoveAlert(uint64 guid, CalendarEvent const& calendarEvent, CalendarInviteStatus status) +void CalendarMgr::SendCalendarEventInviteRemoveAlert(ObjectGuid guid, CalendarEvent const& calendarEvent, CalendarInviteStatus status) { if (Player* player = ObjectAccessor::FindPlayer(guid)) { @@ -602,7 +602,7 @@ void CalendarMgr::SendCalendarEventInviteRemoveAlert(uint64 guid, CalendarEvent } } -void CalendarMgr::SendCalendarClearPendingAction(uint64 guid) +void CalendarMgr::SendCalendarClearPendingAction(ObjectGuid guid) { if (Player* player = ObjectAccessor::FindPlayer(guid)) { @@ -611,7 +611,7 @@ void CalendarMgr::SendCalendarClearPendingAction(uint64 guid) } } -void CalendarMgr::SendCalendarCommandResult(uint64 guid, CalendarError err, char const* param /*= NULL*/) +void CalendarMgr::SendCalendarCommandResult(ObjectGuid guid, CalendarError err, char const* param /*= NULL*/) { if (Player* player = ObjectAccessor::FindPlayer(guid)) { diff --git a/src/server/game/Calendar/CalendarMgr.h b/src/server/game/Calendar/CalendarMgr.h index 9bdb7c0a187..601190bac54 100644 --- a/src/server/game/Calendar/CalendarMgr.h +++ b/src/server/game/Calendar/CalendarMgr.h @@ -21,6 +21,7 @@ #include "Common.h" #include "DatabaseEnv.h" #include "WorldPacket.h" +#include "ObjectGuid.h" enum CalendarMailAnswers { @@ -140,10 +141,10 @@ struct CalendarInvite _text = calendarInvite.GetText(); } - CalendarInvite() : _inviteId(1), _eventId(0), _invitee(0), _senderGUID(0), _statusTime(time(NULL)), + CalendarInvite() : _inviteId(1), _eventId(0), _invitee(), _senderGUID(), _statusTime(time(NULL)), _status(CALENDAR_STATUS_INVITED), _rank(CALENDAR_RANK_PLAYER), _text("") { } - CalendarInvite(uint64 inviteId, uint64 eventId, uint64 invitee, uint64 senderGUID, time_t statusTime, + CalendarInvite(uint64 inviteId, uint64 eventId, ObjectGuid invitee, ObjectGuid senderGUID, time_t statusTime, CalendarInviteStatus status, CalendarModerationRank rank, std::string text) : _inviteId(inviteId), _eventId(eventId), _invitee(invitee), _senderGUID(senderGUID), _statusTime(statusTime), _status(status), _rank(rank), _text(text) { } @@ -156,11 +157,11 @@ struct CalendarInvite void SetEventId(uint64 eventId) { _eventId = eventId; } uint64 GetEventId() const { return _eventId; } - void SetSenderGUID(uint64 guid) { _senderGUID = guid; } - uint64 GetSenderGUID() const { return _senderGUID; } + void SetSenderGUID(ObjectGuid guid) { _senderGUID = guid; } + ObjectGuid GetSenderGUID() const { return _senderGUID; } - void SetInvitee(uint64 guid) { _invitee = guid; } - uint64 GetInviteeGUID() const { return _invitee; } + void SetInvitee(ObjectGuid guid) { _invitee = guid; } + ObjectGuid GetInviteeGUID() const { return _invitee; } void SetStatusTime(time_t statusTime) { _statusTime = statusTime; } time_t GetStatusTime() const { return _statusTime; } @@ -177,8 +178,8 @@ struct CalendarInvite private: uint64 _inviteId; uint64 _eventId; - uint64 _invitee; - uint64 _senderGUID; + ObjectGuid _invitee; + ObjectGuid _senderGUID; time_t _statusTime; CalendarInviteStatus _status; CalendarModerationRank _rank; @@ -202,13 +203,13 @@ struct CalendarEvent _description = calendarEvent.GetDescription(); } - CalendarEvent(uint64 eventId, uint64 creatorGUID, uint32 guildId, CalendarEventType type, int32 dungeonId, + CalendarEvent(uint64 eventId, ObjectGuid creatorGUID, uint32 guildId, CalendarEventType type, int32 dungeonId, time_t eventTime, uint32 flags, time_t timezoneTime, std::string title, std::string description) : _eventId(eventId), _creatorGUID(creatorGUID), _guildId(guildId), _type(type), _dungeonId(dungeonId), _eventTime(eventTime), _flags(flags), _timezoneTime(timezoneTime), _title(title), _description(description) { } - CalendarEvent() : _eventId(1), _creatorGUID(0), _guildId(0), _type(CALENDAR_TYPE_OTHER), _dungeonId(-1), _eventTime(0), + CalendarEvent() : _eventId(1), _creatorGUID(), _guildId(0), _type(CALENDAR_TYPE_OTHER), _dungeonId(-1), _eventTime(0), _flags(0), _timezoneTime(0), _title(""), _description("") { } ~CalendarEvent(); @@ -216,8 +217,8 @@ struct CalendarEvent void SetEventId(uint64 eventId) { _eventId = eventId; } uint64 GetEventId() const { return _eventId; } - void SetCreatorGUID(uint64 guid) { _creatorGUID = guid; } - uint64 GetCreatorGUID() const { return _creatorGUID; } + void SetCreatorGUID(ObjectGuid guid) { _creatorGUID = guid; } + ObjectGuid GetCreatorGUID() const { return _creatorGUID; } void SetGuildId(uint32 guildId) { _guildId = guildId; } uint32 GetGuildId() const { return _guildId; } @@ -246,12 +247,12 @@ struct CalendarEvent bool IsGuildEvent() const { return (_flags & CALENDAR_FLAG_GUILD_EVENT) != 0; } bool IsGuildAnnouncement() const { return (_flags & CALENDAR_FLAG_WITHOUT_INVITES) != 0; } - std::string BuildCalendarMailSubject(uint64 remover) const; + std::string BuildCalendarMailSubject(ObjectGuid remover) const; std::string BuildCalendarMailBody() const; private: uint64 _eventId; - uint64 _creatorGUID; + ObjectGuid _creatorGUID; uint32 _guildId; CalendarEventType _type; int32 _dungeonId; @@ -290,44 +291,44 @@ class CalendarMgr CalendarEvent* GetEvent(uint64 eventId) const; CalendarEventStore const& GetEvents() const { return _events; } - CalendarEventStore GetPlayerEvents(uint64 guid); + CalendarEventStore GetPlayerEvents(ObjectGuid guid); CalendarInvite* GetInvite(uint64 inviteId) const; CalendarEventInviteStore const& GetInvites() const { return _invites; } CalendarInviteStore const& GetEventInvites(uint64 eventId); - CalendarInviteStore GetPlayerInvites(uint64 guid); + CalendarInviteStore GetPlayerInvites(ObjectGuid guid); void FreeEventId(uint64 id); uint64 GetFreeEventId(); void FreeInviteId(uint64 id); uint64 GetFreeInviteId(); - uint32 GetPlayerNumPending(uint64 guid); + uint32 GetPlayerNumPending(ObjectGuid guid); void AddEvent(CalendarEvent* calendarEvent, CalendarSendEventType sendType); - void RemoveEvent(uint64 eventId, uint64 remover); + void RemoveEvent(uint64 eventId, ObjectGuid remover); void UpdateEvent(CalendarEvent* calendarEvent); void AddInvite(CalendarEvent* calendarEvent, CalendarInvite* invite); void AddInvite(CalendarEvent* calendarEvent, CalendarInvite* invite, SQLTransaction& trans); - void RemoveInvite(uint64 inviteId, uint64 eventId, uint64 remover); + void RemoveInvite(uint64 inviteId, uint64 eventId, ObjectGuid remover); void UpdateInvite(CalendarInvite* invite); void UpdateInvite(CalendarInvite* invite, SQLTransaction& trans); - void RemoveAllPlayerEventsAndInvites(uint64 guid); - void RemovePlayerGuildEventsAndSignups(uint64 guid, uint32 guildId); + void RemoveAllPlayerEventsAndInvites(ObjectGuid guid); + void RemovePlayerGuildEventsAndSignups(ObjectGuid guid, uint32 guildId); - void SendCalendarEvent(uint64 guid, CalendarEvent const& calendarEvent, CalendarSendEventType sendType); + void SendCalendarEvent(ObjectGuid guid, CalendarEvent const& calendarEvent, CalendarSendEventType sendType); void SendCalendarEventInvite(CalendarInvite const& invite); void SendCalendarEventInviteAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite); void SendCalendarEventInviteRemove(CalendarEvent const& calendarEvent, CalendarInvite const& invite, uint32 flags); - void SendCalendarEventInviteRemoveAlert(uint64 guid, CalendarEvent const& calendarEvent, CalendarInviteStatus status); + void SendCalendarEventInviteRemoveAlert(ObjectGuid guid, CalendarEvent const& calendarEvent, CalendarInviteStatus status); void SendCalendarEventUpdateAlert(CalendarEvent const& calendarEvent, time_t oldEventTime); void SendCalendarEventStatus(CalendarEvent const& calendarEvent, CalendarInvite const& invite); void SendCalendarEventRemovedAlert(CalendarEvent const& calendarEvent); void SendCalendarEventModeratorStatusAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite); - void SendCalendarClearPendingAction(uint64 guid); - void SendCalendarCommandResult(uint64 guid, CalendarError err, char const* param = NULL); + void SendCalendarClearPendingAction(ObjectGuid guid); + void SendCalendarCommandResult(ObjectGuid guid, CalendarError err, char const* param = NULL); void SendPacketToAllEventRelatives(WorldPacket& packet, CalendarEvent const& calendarEvent); }; diff --git a/src/server/game/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp index 3f6a40d825d..654ce8da2b9 100644 --- a/src/server/game/Chat/Channels/Channel.cpp +++ b/src/server/game/Chat/Channels/Channel.cpp @@ -32,7 +32,7 @@ Channel::Channel(std::string const& name, uint32 channelId, uint32 team): _flags(0), _channelId(channelId), _Team(team), - _ownerGUID(0), + _ownerGUID(), _name(name), _password("") { @@ -80,10 +80,10 @@ Channel::Channel(std::string const& name, uint32 channelId, uint32 team): Tokenizer tokens(db_BannedList, ' '); for (Tokenizer::const_iterator i = tokens.begin(); i != tokens.end(); ++i) { - uint64 banned_guid = atol(*i); + ObjectGuid banned_guid(uint64(strtoull(*i, NULL, 10))); if (banned_guid) { - TC_LOG_DEBUG("chat.system", "Channel(%s) loaded bannedStore guid:" UI64FMTD "", name.c_str(), banned_guid); + TC_LOG_DEBUG("chat.system", "Channel(%s) loaded bannedStore %s", name.c_str(), banned_guid.ToString().c_str()); bannedStore.insert(banned_guid); } } @@ -110,7 +110,7 @@ void Channel::UpdateChannelInDB() const std::ostringstream banlist; BannedContainer::const_iterator iter; for (iter = bannedStore.begin(); iter != bannedStore.end(); ++iter) - banlist << (*iter) << ' '; + banlist << iter->GetRawValue() << ' '; std::string banListStr = banlist.str(); @@ -149,7 +149,7 @@ void Channel::CleanOldChannelsInDB() void Channel::JoinChannel(Player* player, std::string const& pass) { - uint64 guid = player->GetGUID(); + ObjectGuid guid = player->GetGUID(); if (IsOn(guid)) { // Do not send error message for built-in channels @@ -227,7 +227,7 @@ void Channel::JoinChannel(Player* player, std::string const& pass) void Channel::LeaveChannel(Player* player, bool send) { - uint64 guid = player->GetGUID(); + ObjectGuid guid = player->GetGUID(); if (!IsOn(guid)) { if (send) @@ -269,7 +269,7 @@ void Channel::LeaveChannel(Player* player, bool send) // If the channel owner left and there are still playersStore inside, pick a new owner if (changeowner && _ownership && !playersStore.empty()) { - uint64 newowner = playersStore.begin()->second.player; + ObjectGuid newowner = playersStore.begin()->second.player; playersStore[newowner].SetModerator(true); SetOwner(newowner); } @@ -278,7 +278,7 @@ void Channel::LeaveChannel(Player* player, bool send) void Channel::KickOrBan(Player const* player, std::string const& badname, bool ban) { - uint64 good = player->GetGUID(); + ObjectGuid good = player->GetGUID(); if (!IsOn(good)) { @@ -297,7 +297,7 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b } Player* bad = sObjectAccessor->FindPlayerByName(badname); - uint64 victim = bad ? bad->GetGUID() : 0; + ObjectGuid victim = bad ? bad->GetGUID() : ObjectGuid::Empty; if (!victim || !IsOn(victim)) { WorldPacket data; @@ -340,7 +340,7 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b if (changeowner && _ownership && !playersStore.empty()) { - uint64 newowner = good; + ObjectGuid newowner = good; playersStore[newowner].SetModerator(true); SetOwner(newowner); } @@ -348,7 +348,7 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b void Channel::UnBan(Player const* player, std::string const& badname) { - uint64 good = player->GetGUID(); + ObjectGuid good = player->GetGUID(); if (!IsOn(good)) { @@ -367,7 +367,7 @@ void Channel::UnBan(Player const* player, std::string const& badname) } Player* bad = sObjectAccessor->FindPlayerByName(badname); - uint64 victim = bad ? bad->GetGUID(): 0; + ObjectGuid victim = bad ? bad->GetGUID() : ObjectGuid::Empty; if (!victim || !IsBanned(victim)) { @@ -388,7 +388,7 @@ void Channel::UnBan(Player const* player, std::string const& badname) void Channel::Password(Player const* player, std::string const& pass) { - uint64 guid = player->GetGUID(); + ObjectGuid guid = player->GetGUID(); ChatHandler chat(player->GetSession()); if (!IsOn(guid)) @@ -418,7 +418,7 @@ void Channel::Password(Player const* player, std::string const& pass) void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bool set) { - uint64 guid = player->GetGUID(); + ObjectGuid guid = player->GetGUID(); if (!IsOn(guid)) { @@ -440,7 +440,7 @@ void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bo return; Player* newp = sObjectAccessor->FindPlayerByName(p2n); - uint64 victim = newp ? newp->GetGUID() : 0; + ObjectGuid victim = newp ? newp->GetGUID() : ObjectGuid::Empty; if (!victim || !IsOn(victim) || (player->GetTeam() != newp->GetTeam() && @@ -469,7 +469,7 @@ void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bo void Channel::SetOwner(Player const* player, std::string const& newname) { - uint64 guid = player->GetGUID(); + ObjectGuid guid = player->GetGUID(); if (!IsOn(guid)) { @@ -488,7 +488,7 @@ void Channel::SetOwner(Player const* player, std::string const& newname) } Player* newp = sObjectAccessor->FindPlayerByName(newname); - uint64 victim = newp ? newp->GetGUID() : 0; + ObjectGuid victim = newp ? newp->GetGUID() : ObjectGuid::Empty; if (!victim || !IsOn(victim) || (player->GetTeam() != newp->GetTeam() && @@ -505,7 +505,7 @@ void Channel::SetOwner(Player const* player, std::string const& newname) SetOwner(victim); } -void Channel::SendWhoOwner(uint64 guid) +void Channel::SendWhoOwner(ObjectGuid guid) { WorldPacket data; if (IsOn(guid)) @@ -517,7 +517,7 @@ void Channel::SendWhoOwner(uint64 guid) void Channel::List(Player const* player) { - uint64 guid = player->GetGUID(); + ObjectGuid guid = player->GetGUID(); if (!IsOn(guid)) { @@ -565,7 +565,7 @@ void Channel::List(Player const* player) void Channel::Announce(Player const* player) { - uint64 guid = player->GetGUID(); + ObjectGuid guid = player->GetGUID(); if (!IsOn(guid)) { @@ -595,7 +595,7 @@ void Channel::Announce(Player const* player) UpdateChannelInDB(); } -void Channel::Say(uint64 guid, std::string const& what, uint32 lang) +void Channel::Say(ObjectGuid guid, std::string const& what, uint32 lang) { if (what.empty()) return; @@ -626,12 +626,12 @@ void Channel::Say(uint64 guid, std::string const& what, uint32 lang) else ChatHandler::BuildChatPacket(data, CHAT_MSG_CHANNEL, Language(lang), guid, guid, what, 0, "", "", 0, false, _name); - SendToAll(&data, !playersStore[guid].IsModerator() ? guid : false); + SendToAll(&data, !playersStore[guid].IsModerator() ? guid : ObjectGuid::Empty); } void Channel::Invite(Player const* player, std::string const& newname) { - uint64 guid = player->GetGUID(); + ObjectGuid guid = player->GetGUID(); if (!IsOn(guid)) { @@ -676,7 +676,7 @@ void Channel::Invite(Player const* player, std::string const& newname) return; } - if (!newp->GetSocial()->HasIgnore(GUID_LOPART(guid))) + if (!newp->GetSocial()->HasIgnore(guid.GetCounter())) { WorldPacket data; MakeInvite(&data, guid); @@ -689,7 +689,7 @@ void Channel::Invite(Player const* player, std::string const& newname) SendToOne(&data, guid); } -void Channel::SetOwner(uint64 guid, bool exclaim) +void Channel::SetOwner(ObjectGuid guid, bool exclaim) { if (_ownerGUID) { @@ -720,15 +720,15 @@ void Channel::SetOwner(uint64 guid, bool exclaim) } } -void Channel::SendToAll(WorldPacket* data, uint64 guid) +void Channel::SendToAll(WorldPacket* data, ObjectGuid guid) { for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i) if (Player* player = ObjectAccessor::FindPlayer(i->first)) - if (!guid || !player->GetSocial()->HasIgnore(GUID_LOPART(guid))) + if (!guid || !player->GetSocial()->HasIgnore(guid.GetCounter())) player->GetSession()->SendPacket(data); } -void Channel::SendToAllButOne(WorldPacket* data, uint64 who) +void Channel::SendToAllButOne(WorldPacket* data, ObjectGuid who) { for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i) if (i->first != who) @@ -736,18 +736,18 @@ void Channel::SendToAllButOne(WorldPacket* data, uint64 who) player->GetSession()->SendPacket(data); } -void Channel::SendToOne(WorldPacket* data, uint64 who) +void Channel::SendToOne(WorldPacket* data, ObjectGuid who) { if (Player* player = ObjectAccessor::FindPlayer(who)) player->GetSession()->SendPacket(data); } -void Channel::Voice(uint64 /*guid1*/, uint64 /*guid2*/) +void Channel::Voice(ObjectGuid /*guid1*/, ObjectGuid /*guid2*/) { } -void Channel::DeVoice(uint64 /*guid1*/, uint64 /*guid2*/) +void Channel::DeVoice(ObjectGuid /*guid1*/, ObjectGuid /*guid2*/) { } @@ -759,13 +759,13 @@ void Channel::MakeNotifyPacket(WorldPacket* data, uint8 notify_type) *data << _name; } -void Channel::MakeJoined(WorldPacket* data, uint64 guid) +void Channel::MakeJoined(WorldPacket* data, ObjectGuid guid) { MakeNotifyPacket(data, CHAT_JOINED_NOTICE); *data << uint64(guid); } -void Channel::MakeLeft(WorldPacket* data, uint64 guid) +void Channel::MakeLeft(WorldPacket* data, ObjectGuid guid) { MakeNotifyPacket(data, CHAT_LEFT_NOTICE); *data << uint64(guid); @@ -801,13 +801,13 @@ void Channel::MakeNotModerator(WorldPacket* data) MakeNotifyPacket(data, CHAT_NOT_MODERATOR_NOTICE); } -void Channel::MakePasswordChanged(WorldPacket* data, uint64 guid) +void Channel::MakePasswordChanged(WorldPacket* data, ObjectGuid guid) { MakeNotifyPacket(data, CHAT_PASSWORD_CHANGED_NOTICE); *data << uint64(guid); } -void Channel::MakeOwnerChanged(WorldPacket* data, uint64 guid) +void Channel::MakeOwnerChanged(WorldPacket* data, ObjectGuid guid) { MakeNotifyPacket(data, CHAT_OWNER_CHANGED_NOTICE); *data << uint64(guid); @@ -835,7 +835,7 @@ void Channel::MakeChannelOwner(WorldPacket* data) *data << ((IsConstant() || !_ownerGUID) ? "Nobody" : name); } -void Channel::MakeModeChange(WorldPacket* data, uint64 guid, uint8 oldflags) +void Channel::MakeModeChange(WorldPacket* data, ObjectGuid guid, uint8 oldflags) { MakeNotifyPacket(data, CHAT_MODE_CHANGE_NOTICE); *data << uint64(guid); @@ -843,13 +843,13 @@ void Channel::MakeModeChange(WorldPacket* data, uint64 guid, uint8 oldflags) *data << uint8(GetPlayerFlags(guid)); } -void Channel::MakeAnnouncementsOn(WorldPacket* data, uint64 guid) +void Channel::MakeAnnouncementsOn(WorldPacket* data, ObjectGuid guid) { MakeNotifyPacket(data, CHAT_ANNOUNCEMENTS_ON_NOTICE); *data << uint64(guid); } -void Channel::MakeAnnouncementsOff(WorldPacket* data, uint64 guid) +void Channel::MakeAnnouncementsOff(WorldPacket* data, ObjectGuid guid) { MakeNotifyPacket(data, CHAT_ANNOUNCEMENTS_OFF_NOTICE); *data << uint64(guid); @@ -860,7 +860,7 @@ void Channel::MakeMuted(WorldPacket* data) MakeNotifyPacket(data, CHAT_MUTED_NOTICE); } -void Channel::MakePlayerKicked(WorldPacket* data, uint64 bad, uint64 good) +void Channel::MakePlayerKicked(WorldPacket* data, ObjectGuid bad, ObjectGuid good) { MakeNotifyPacket(data, CHAT_PLAYER_KICKED_NOTICE); *data << uint64(bad); @@ -872,14 +872,14 @@ void Channel::MakeBanned(WorldPacket* data) MakeNotifyPacket(data, CHAT_BANNED_NOTICE); } -void Channel::MakePlayerBanned(WorldPacket* data, uint64 bad, uint64 good) +void Channel::MakePlayerBanned(WorldPacket* data, ObjectGuid bad, ObjectGuid good) { MakeNotifyPacket(data, CHAT_PLAYER_BANNED_NOTICE); *data << uint64(bad); *data << uint64(good); } -void Channel::MakePlayerUnbanned(WorldPacket* data, uint64 bad, uint64 good) +void Channel::MakePlayerUnbanned(WorldPacket* data, ObjectGuid bad, ObjectGuid good) { MakeNotifyPacket(data, CHAT_PLAYER_UNBANNED_NOTICE); *data << uint64(bad); @@ -892,13 +892,13 @@ void Channel::MakePlayerNotBanned(WorldPacket* data, const std::string &name) *data << name; } -void Channel::MakePlayerAlreadyMember(WorldPacket* data, uint64 guid) +void Channel::MakePlayerAlreadyMember(WorldPacket* data, ObjectGuid guid) { MakeNotifyPacket(data, CHAT_PLAYER_ALREADY_MEMBER_NOTICE); *data << uint64(guid); } -void Channel::MakeInvite(WorldPacket* data, uint64 guid) +void Channel::MakeInvite(WorldPacket* data, ObjectGuid guid) { MakeNotifyPacket(data, CHAT_INVITE_NOTICE); *data << uint64(guid); @@ -951,19 +951,19 @@ void Channel::MakeNotInLfg(WorldPacket* data) MakeNotifyPacket(data, CHAT_NOT_IN_LFG_NOTICE); } -void Channel::MakeVoiceOn(WorldPacket* data, uint64 guid) +void Channel::MakeVoiceOn(WorldPacket* data, ObjectGuid guid) { MakeNotifyPacket(data, CHAT_VOICE_ON_NOTICE); *data << uint64(guid); } -void Channel::MakeVoiceOff(WorldPacket* data, uint64 guid) +void Channel::MakeVoiceOff(WorldPacket* data, ObjectGuid guid) { MakeNotifyPacket(data, CHAT_VOICE_OFF_NOTICE); *data << uint64(guid); } -void Channel::JoinNotify(uint64 guid) +void Channel::JoinNotify(ObjectGuid guid) { WorldPacket data(IsConstant() ? SMSG_USERLIST_ADD : SMSG_USERLIST_UPDATE, 8 + 1 + 1 + 4 + GetName().size()); data << uint64(guid); @@ -978,7 +978,7 @@ void Channel::JoinNotify(uint64 guid) SendToAll(&data); } -void Channel::LeaveNotify(uint64 guid) +void Channel::LeaveNotify(ObjectGuid guid) { WorldPacket data(SMSG_USERLIST_REMOVE, 8 + 1 + 4 + GetName().size()); data << uint64(guid); diff --git a/src/server/game/Chat/Channels/Channel.h b/src/server/game/Chat/Channels/Channel.h index 877c1e826c9..6489c8b47ad 100644 --- a/src/server/game/Chat/Channels/Channel.h +++ b/src/server/game/Chat/Channels/Channel.h @@ -122,7 +122,7 @@ class Channel { struct PlayerInfo { - uint64 player; + ObjectGuid player; uint8 flags; bool HasFlag(uint8 flag) const { return (flags & flag) != 0; } @@ -169,21 +169,21 @@ class Channel void UnBan(Player const* player, std::string const& badname); void Password(Player const* player, std::string const& pass); void SetMode(Player const* player, std::string const& p2n, bool mod, bool set); - void SetOwner(uint64 guid, bool exclaim = true); + void SetOwner(ObjectGuid guid, bool exclaim = true); void SetOwner(Player const* player, std::string const& name); - void SendWhoOwner(uint64 guid); + void SendWhoOwner(ObjectGuid guid); void SetModerator(Player const* player, std::string const& newname) { SetMode(player, newname, true, true); } void UnsetModerator(Player const* player, std::string const& newname) { SetMode(player, newname, true, false); } void SetMute(Player const* player, std::string const& newname) { SetMode(player, newname, false, true); } void UnsetMute(Player const* player, std::string const& newname) { SetMode(player, newname, false, false); } void List(Player const* player); void Announce(Player const* player); - void Say(uint64 guid, std::string const& what, uint32 lang); + void Say(ObjectGuid guid, std::string const& what, uint32 lang); void Invite(Player const* player, std::string const& newp); - void Voice(uint64 guid1, uint64 guid2); - void DeVoice(uint64 guid1, uint64 guid2); - void JoinNotify(uint64 guid); // invisible notify - void LeaveNotify(uint64 guid); // invisible notify + void Voice(ObjectGuid guid1, ObjectGuid guid2); + void DeVoice(ObjectGuid guid1, ObjectGuid guid2); + void JoinNotify(ObjectGuid guid); // invisible notify + void LeaveNotify(ObjectGuid guid); // invisible notify void SetOwnership(bool ownership) { _ownership = ownership; }; static void CleanOldChannelsInDB(); @@ -191,29 +191,29 @@ class Channel // initial packet data (notify type and channel name) void MakeNotifyPacket(WorldPacket* data, uint8 notify_type); // type specific packet data - void MakeJoined(WorldPacket* data, uint64 guid); //+ 0x00 - void MakeLeft(WorldPacket* data, uint64 guid); //+ 0x01 + void MakeJoined(WorldPacket* data, ObjectGuid guid); //+ 0x00 + void MakeLeft(WorldPacket* data, ObjectGuid guid); //+ 0x01 void MakeYouJoined(WorldPacket* data); //+ 0x02 void MakeYouLeft(WorldPacket* data); //+ 0x03 void MakeWrongPassword(WorldPacket* data); //? 0x04 void MakeNotMember(WorldPacket* data); //? 0x05 void MakeNotModerator(WorldPacket* data); //? 0x06 - void MakePasswordChanged(WorldPacket* data, uint64 guid); //+ 0x07 - void MakeOwnerChanged(WorldPacket* data, uint64 guid); //? 0x08 - void MakePlayerNotFound(WorldPacket* data, std::string const& name); //+ 0x09 + void MakePasswordChanged(WorldPacket* data, ObjectGuid guid); //+ 0x07 + void MakeOwnerChanged(WorldPacket* data, ObjectGuid guid); //? 0x08 + void MakePlayerNotFound(WorldPacket* data, std::string const& name); //+ 0x09 void MakeNotOwner(WorldPacket* data); //? 0x0A void MakeChannelOwner(WorldPacket* data); //? 0x0B - void MakeModeChange(WorldPacket* data, uint64 guid, uint8 oldflags); //+ 0x0C - void MakeAnnouncementsOn(WorldPacket* data, uint64 guid); //+ 0x0D - void MakeAnnouncementsOff(WorldPacket* data, uint64 guid); //+ 0x0E + void MakeModeChange(WorldPacket* data, ObjectGuid guid, uint8 oldflags);//+ 0x0C + void MakeAnnouncementsOn(WorldPacket* data, ObjectGuid guid); //+ 0x0D + void MakeAnnouncementsOff(WorldPacket* data, ObjectGuid guid); //+ 0x0E void MakeMuted(WorldPacket* data); //? 0x11 - void MakePlayerKicked(WorldPacket* data, uint64 bad, uint64 good); //? 0x12 + void MakePlayerKicked(WorldPacket* data, ObjectGuid bad, ObjectGuid good);//? 0x12 void MakeBanned(WorldPacket* data); //? 0x13 - void MakePlayerBanned(WorldPacket* data, uint64 bad, uint64 good); //? 0x14 - void MakePlayerUnbanned(WorldPacket* data, uint64 bad, uint64 good); //? 0x15 - void MakePlayerNotBanned(WorldPacket* data, std::string const& name); //? 0x16 - void MakePlayerAlreadyMember(WorldPacket* data, uint64 guid); //+ 0x17 - void MakeInvite(WorldPacket* data, uint64 guid); //? 0x18 + void MakePlayerBanned(WorldPacket* data, ObjectGuid bad, ObjectGuid good);//? 0x14 + void MakePlayerUnbanned(WorldPacket* data, ObjectGuid bad, ObjectGuid good);//? 0x15 + void MakePlayerNotBanned(WorldPacket* data, std::string const& name); //? 0x16 + void MakePlayerAlreadyMember(WorldPacket* data, ObjectGuid guid); //+ 0x17 + void MakeInvite(WorldPacket* data, ObjectGuid guid); //? 0x18 void MakeInviteWrongFaction(WorldPacket* data); //? 0x19 void MakeWrongFaction(WorldPacket* data); //? 0x1A void MakeInvalidName(WorldPacket* data); //? 0x1B @@ -223,26 +223,26 @@ class Channel void MakeThrottled(WorldPacket* data); //? 0x1F void MakeNotInArea(WorldPacket* data); //? 0x20 void MakeNotInLfg(WorldPacket* data); //? 0x21 - void MakeVoiceOn(WorldPacket* data, uint64 guid); //+ 0x22 - void MakeVoiceOff(WorldPacket* data, uint64 guid); //+ 0x23 + void MakeVoiceOn(WorldPacket* data, ObjectGuid guid); //+ 0x22 + void MakeVoiceOff(WorldPacket* data, ObjectGuid guid); //+ 0x23 - void SendToAll(WorldPacket* data, uint64 guid = 0); - void SendToAllButOne(WorldPacket* data, uint64 who); - void SendToOne(WorldPacket* data, uint64 who); + void SendToAll(WorldPacket* data, ObjectGuid guid = ObjectGuid::Empty); + void SendToAllButOne(WorldPacket* data, ObjectGuid who); + void SendToOne(WorldPacket* data, ObjectGuid who); - bool IsOn(uint64 who) const { return playersStore.find(who) != playersStore.end(); } - bool IsBanned(uint64 guid) const { return bannedStore.find(guid) != bannedStore.end(); } + bool IsOn(ObjectGuid who) const { return playersStore.find(who) != playersStore.end(); } + bool IsBanned(ObjectGuid guid) const { return bannedStore.find(guid) != bannedStore.end(); } void UpdateChannelInDB() const; void UpdateChannelUseageInDB() const; - uint8 GetPlayerFlags(uint64 guid) const + uint8 GetPlayerFlags(ObjectGuid guid) const { PlayerContainer::const_iterator itr = playersStore.find(guid); return itr != playersStore.end() ? itr->second.flags : 0; } - void SetModerator(uint64 guid, bool set) + void SetModerator(ObjectGuid guid, bool set) { if (playersStore[guid].IsModerator() != set) { @@ -255,7 +255,7 @@ class Channel } } - void SetMute(uint64 guid, bool set) + void SetMute(ObjectGuid guid, bool set) { if (playersStore[guid].IsMuted() != set) { @@ -268,8 +268,8 @@ class Channel } } - typedef std::map<uint64, PlayerInfo> PlayerContainer; - typedef std::set<uint64> BannedContainer; + typedef std::map<ObjectGuid, PlayerInfo> PlayerContainer; + typedef GuidSet BannedContainer; bool _announce; bool _ownership; @@ -277,7 +277,7 @@ class Channel uint8 _flags; uint32 _channelId; uint32 _Team; - uint64 _ownerGUID; + ObjectGuid _ownerGUID; std::string _name; std::string _password; PlayerContainer playersStore; diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index 265197e9c3b..a50cf00ad9e 100644 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -125,7 +125,7 @@ bool ChatHandler::isAvailable(ChatCommand const& cmd) const return HasPermission(cmd.Permission); } -bool ChatHandler::HasLowerSecurity(Player* target, uint64 guid, bool strong) +bool ChatHandler::HasLowerSecurity(Player* target, ObjectGuid guid, bool strong) { WorldSession* target_session = NULL; uint32 target_account = 0; @@ -345,7 +345,7 @@ bool ChatHandler::ExecuteCommandInTable(ChatCommand* table, const char* text, st Player* player = m_session->GetPlayer(); if (!AccountMgr::IsPlayerAccount(m_session->GetSecurity())) { - uint64 guid = player->GetTarget(); + ObjectGuid guid = player->GetTarget(); uint32 areaId = player->GetAreaId(); std::string areaName = "Unknown"; std::string zoneName = "Unknown"; @@ -357,14 +357,14 @@ bool ChatHandler::ExecuteCommandInTable(ChatCommand* table, const char* text, st zoneName = zone->area_name[locale]; } - sLog->outCommand(m_session->GetAccountId(), "Command: %s [Player: %s (Guid: %u) (Account: %u) X: %f Y: %f Z: %f Map: %u (%s) Area: %u (%s) Zone: %s Selected %s: %s (GUID: %u)]", - fullcmd.c_str(), player->GetName().c_str(), GUID_LOPART(player->GetGUID()), + sLog->outCommand(m_session->GetAccountId(), "Command: %s [Player: %s (%s) (Account: %u) X: %f Y: %f Z: %f Map: %u (%s) Area: %u (%s) Zone: %s Selected: %s (%s)]", + fullcmd.c_str(), player->GetName().c_str(), player->GetGUID().ToString().c_str(), m_session->GetAccountId(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), player->GetMap() ? player->GetMap()->GetMapName() : "Unknown", - areaId, areaName.c_str(), zoneName.c_str(), GetLogNameForGuid(guid), + areaId, areaName.c_str(), zoneName.c_str(), (player->GetSelectedUnit()) ? player->GetSelectedUnit()->GetName().c_str() : "", - GUID_LOPART(guid)); + guid.ToString().c_str()); } } // some commands have custom error messages. Don't send the default one in these cases. @@ -629,7 +629,7 @@ bool ChatHandler::ShowHelpForCommand(ChatCommand* table, const char* cmd) return ShowHelpForSubCommands(table, "", cmd); } -size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, uint64 senderGUID, uint64 receiverGUID, std::string const& message, uint8 chatTag, +size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string const& message, uint8 chatTag, std::string const& senderName /*= ""*/, std::string const& receiverName /*= ""*/, uint32 achievementId /*= 0*/, bool gmMessage /*= false*/, std::string const& channelName /*= ""*/) { @@ -653,7 +653,7 @@ size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Languag data << senderName; receiverGUIDPos = data.wpos(); data << uint64(receiverGUID); - if (receiverGUID && !IS_PLAYER_GUID(receiverGUID) && !IS_PET_GUID(receiverGUID)) + if (receiverGUID && !receiverGUID.IsPlayer() && !receiverGUID.IsPet()) { data << uint32(receiverName.length() + 1); data << receiverName; @@ -670,7 +670,7 @@ size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Languag case CHAT_MSG_BG_SYSTEM_HORDE: receiverGUIDPos = data.wpos(); data << uint64(receiverGUID); - if (receiverGUID && !IS_PLAYER_GUID(receiverGUID)) + if (receiverGUID && !receiverGUID.IsPlayer()) { data << uint32(receiverName.length() + 1); data << receiverName; @@ -712,11 +712,11 @@ size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Languag size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, WorldObject const* sender, WorldObject const* receiver, std::string const& message, uint32 achievementId /*= 0*/, std::string const& channelName /*= ""*/, LocaleConstant locale /*= DEFAULT_LOCALE*/) { - uint64 senderGUID = 0; + ObjectGuid senderGUID; std::string senderName = ""; uint8 chatTag = 0; bool gmMessage = false; - uint64 receiverGUID = 0; + ObjectGuid receiverGUID; std::string receiverName = ""; if (sender) { @@ -743,7 +743,7 @@ Player* ChatHandler::getSelectedPlayer() if (!m_session) return NULL; - uint64 selected = m_session->GetPlayer()->GetTarget(); + ObjectGuid selected = m_session->GetPlayer()->GetTarget(); if (!selected) return m_session->GetPlayer(); @@ -766,9 +766,9 @@ WorldObject* ChatHandler::getSelectedObject() if (!m_session) return NULL; - uint64 guid = m_session->GetPlayer()->GetTarget(); + ObjectGuid guid = m_session->GetPlayer()->GetTarget(); - if (guid == 0) + if (!guid) return GetNearbyGameObject(); return ObjectAccessor::GetUnit(*m_session->GetPlayer(), guid); @@ -787,7 +787,7 @@ Player* ChatHandler::getSelectedPlayerOrSelf() if (!m_session) return NULL; - uint64 selected = m_session->GetPlayer()->GetTarget(); + ObjectGuid selected = m_session->GetPlayer()->GetTarget(); if (!selected) return m_session->GetPlayer(); @@ -932,7 +932,7 @@ GameObject* ChatHandler::GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid Player* pl = m_session->GetPlayer(); - GameObject* obj = pl->GetMap()->GetGameObject(MAKE_NEW_GUID(lowguid, entry, HIGHGUID_GAMEOBJECT)); + GameObject* obj = pl->GetMap()->GetGameObject(ObjectGuid(HIGHGUID_GAMEOBJECT, entry, lowguid)); if (!obj && sObjectMgr->GetGOData(lowguid)) // guid is DB guid of object { @@ -1053,7 +1053,7 @@ static char const* const guidKeys[] = nullptr }; -uint64 ChatHandler::extractGuidFromLink(char* text) +ObjectGuid ChatHandler::extractGuidFromLink(char* text) { int type = 0; @@ -1062,7 +1062,7 @@ uint64 ChatHandler::extractGuidFromLink(char* text) // |color|Hplayer:name|h[name]|h|r char* idS = extractKeyFromLink(text, guidKeys, &type); if (!idS) - return 0; + return ObjectGuid::Empty; switch (type) { @@ -1070,38 +1070,38 @@ uint64 ChatHandler::extractGuidFromLink(char* text) { std::string name = idS; if (!normalizePlayerName(name)) - return 0; + return ObjectGuid::Empty; if (Player* player = sObjectAccessor->FindPlayerByName(name)) return player->GetGUID(); - if (uint64 guid = sObjectMgr->GetPlayerGUIDByName(name)) + if (ObjectGuid guid = sObjectMgr->GetPlayerGUIDByName(name)) return guid; - return 0; + return ObjectGuid::Empty; } case SPELL_LINK_CREATURE: { uint32 lowguid = (uint32)atol(idS); if (CreatureData const* data = sObjectMgr->GetCreatureData(lowguid)) - return MAKE_NEW_GUID(lowguid, data->id, HIGHGUID_UNIT); + return ObjectGuid(HIGHGUID_UNIT, data->id, lowguid); else - return 0; + return ObjectGuid::Empty; } case SPELL_LINK_GAMEOBJECT: { uint32 lowguid = (uint32)atol(idS); if (GameObjectData const* data = sObjectMgr->GetGOData(lowguid)) - return MAKE_NEW_GUID(lowguid, data->id, HIGHGUID_GAMEOBJECT); + return ObjectGuid(HIGHGUID_GAMEOBJECT, data->id, lowguid); else - return 0; + return ObjectGuid::Empty; } } // unknown type? - return 0; + return ObjectGuid::Empty; } std::string ChatHandler::extractPlayerNameFromLink(char* text) @@ -1118,7 +1118,7 @@ std::string ChatHandler::extractPlayerNameFromLink(char* text) return name; } -bool ChatHandler::extractPlayerTarget(char* args, Player** player, uint64* player_guid /*=NULL*/, std::string* player_name /*= NULL*/) +bool ChatHandler::extractPlayerTarget(char* args, Player** player, ObjectGuid* player_guid /*=NULL*/, std::string* player_name /*= NULL*/) { if (args && *args) { @@ -1137,7 +1137,7 @@ bool ChatHandler::extractPlayerTarget(char* args, Player** player, uint64* playe *player = pl; // if need guid value from DB (in name case for check player existence) - uint64 guid = !pl && (player_guid || player_name) ? sObjectMgr->GetPlayerGUIDByName(name) : 0; + ObjectGuid guid = !pl && (player_guid || player_name) ? sObjectMgr->GetPlayerGUIDByName(name) : ObjectGuid::Empty; // if allowed player guid (if no then only online players allowed) if (player_guid) @@ -1154,7 +1154,7 @@ bool ChatHandler::extractPlayerTarget(char* args, Player** player, uint64* playe *player = pl; // if allowed player guid (if no then only online players allowed) if (player_guid) - *player_guid = pl ? pl->GetGUID() : 0; + *player_guid = pl ? pl->GetGUID() : ObjectGuid::Empty; if (player_name) *player_name = pl ? pl->GetName() : ""; @@ -1277,10 +1277,10 @@ bool CliHandler::needReportToTarget(Player* /*chr*/) const return true; } -bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player* &player, Group* &group, uint64 &guid, bool offline) +bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player*& player, Group*& group, ObjectGuid& guid, bool offline) { - player = NULL; - guid = 0; + player = NULL; + guid.Clear(); if (cname) { diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h index c0e3da32b3f..6ce4e01585f 100644 --- a/src/server/game/Chat/Chat.h +++ b/src/server/game/Chat/Chat.h @@ -54,7 +54,7 @@ class ChatHandler virtual ~ChatHandler() { } // Builds chat packet and returns receiver guid position in the packet to substitute in whisper builders - static size_t BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, uint64 senderGUID, uint64 receiverGUID, std::string const& message, uint8 chatTag, + static size_t BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string const& message, uint8 chatTag, std::string const& senderName = "", std::string const& receiverName = "", uint32 achievementId = 0, bool gmMessage = false, std::string const& channelName = ""); @@ -89,7 +89,7 @@ class ChatHandler virtual LocaleConstant GetSessionDbcLocale() const; virtual int GetSessionDbLocaleIndex() const; - bool HasLowerSecurity(Player* target, uint64 guid, bool strong = false); + bool HasLowerSecurity(Player* target, ObjectGuid guid, bool strong = false); bool HasLowerSecurityAccount(WorldSession* target, uint32 account, bool strong = false); void SendGlobalGMSysMessage(const char *str); @@ -108,12 +108,12 @@ class ChatHandler char* extractQuotedArg(char* args); uint32 extractSpellIdFromLink(char* text); - uint64 extractGuidFromLink(char* text); + ObjectGuid extractGuidFromLink(char* text); GameTele const* extractGameTeleFromLink(char* text); - bool GetPlayerGroupAndGUIDByName(const char* cname, Player* &player, Group* &group, uint64 &guid, bool offline = false); + bool GetPlayerGroupAndGUIDByName(const char* cname, Player*& player, Group*& group, ObjectGuid& guid, bool offline = false); std::string extractPlayerNameFromLink(char* text); // select by arg (name/link) or in-game selection online/offline player or self if a creature is selected - bool extractPlayerTarget(char* args, Player** player, uint64* player_guid = NULL, std::string* player_name = NULL); + bool extractPlayerTarget(char* args, Player** player, ObjectGuid* player_guid = NULL, std::string* player_name = NULL); std::string playerLink(std::string const& name) const { return m_session ? "|cffffffff|Hplayer:"+name+"|h["+name+"]|h|r" : name; } std::string GetNameLink(Player* chr) const; diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp index 339ec579b1a..7364dd84781 100644 --- a/src/server/game/Combat/ThreatManager.cpp +++ b/src/server/game/Combat/ThreatManager.cpp @@ -269,7 +269,7 @@ HostileReference* ThreatContainer::getReferenceByTarget(Unit* victim) const if (!victim) return NULL; - uint64 const guid = victim->GetGUID(); + ObjectGuid guid = victim->GetGUID(); for (ThreatContainer::StorageType::const_iterator i = iThreatList.begin(); i != iThreatList.end(); ++i) { HostileReference* ref = (*i); diff --git a/src/server/game/Combat/ThreatManager.h b/src/server/game/Combat/ThreatManager.h index f0741f81067..62b3d10e554 100644 --- a/src/server/game/Combat/ThreatManager.h +++ b/src/server/game/Combat/ThreatManager.h @@ -23,6 +23,7 @@ #include "SharedDefines.h" #include "LinkedReference/Reference.h" #include "UnitEvents.h" +#include "ObjectGuid.h" #include <list> @@ -103,7 +104,7 @@ class HostileReference : public Reference<Unit, ThreatManager> //================================================= - uint64 getUnitGuid() const { return iUnitGuid; } + ObjectGuid getUnitGuid() const { return iUnitGuid; } //================================================= // reference is not needed anymore. realy delete it ! @@ -132,7 +133,7 @@ class HostileReference : public Reference<Unit, ThreatManager> private: float iThreat; float iTempThreatModifier; // used for taunt - uint64 iUnitGuid; + ObjectGuid iUnitGuid; bool iOnline; bool iAccessible; }; diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 03051451193..094a8345395 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -166,12 +166,15 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) case INSTANCE_INFO_DATA: condMeets = instance->GetData(ConditionValue1) == ConditionValue2; break; - case INSTANCE_INFO_DATA64: - condMeets = instance->GetData64(ConditionValue1) == ConditionValue2; + case INSTANCE_INFO_GUID_DATA: + condMeets = instance->GetGuidData(ConditionValue1) == ObjectGuid(uint64(ConditionValue2)); break; case INSTANCE_INFO_BOSS_STATE: condMeets = instance->GetBossState(ConditionValue1) == EncounterState(ConditionValue2); break; + case INSTANCE_INFO_DATA64: + condMeets = instance->GetData64(ConditionValue1) == ConditionValue2; + break; } } } diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index ff508210fb1..24e44c662ba 100644 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -146,8 +146,9 @@ enum RelationType enum InstanceInfo { INSTANCE_INFO_DATA = 0, - INSTANCE_INFO_DATA64, - INSTANCE_INFO_BOSS_STATE + INSTANCE_INFO_GUID_DATA, + INSTANCE_INFO_BOSS_STATE, + INSTANCE_INFO_DATA64 }; enum MaxConditionTargets diff --git a/src/server/game/DungeonFinding/LFG.h b/src/server/game/DungeonFinding/LFG.h index 0030dfa6c4b..c99366ce179 100644 --- a/src/server/game/DungeonFinding/LFG.h +++ b/src/server/game/DungeonFinding/LFG.h @@ -19,6 +19,7 @@ #define _LFG_H #include "Common.h" +#include "ObjectGuid.h" namespace lfg { @@ -96,11 +97,9 @@ enum LfgAnswer typedef std::set<uint32> LfgDungeonSet; typedef std::map<uint32, uint32> LfgLockMap; -typedef std::map<uint64, LfgLockMap> LfgLockPartyMap; -typedef std::set<uint64> LfgGuidSet; -typedef std::list<uint64> LfgGuidList; -typedef std::map<uint64, uint8> LfgRolesMap; -typedef std::map<uint64, uint64> LfgGroupsMap; +typedef std::map<ObjectGuid, LfgLockMap> LfgLockPartyMap; +typedef std::map<ObjectGuid, uint8> LfgRolesMap; +typedef std::map<ObjectGuid, ObjectGuid> LfgGroupsMap; std::string ConcatenateDungeons(LfgDungeonSet const& dungeons); std::string GetRolesString(uint8 roles); diff --git a/src/server/game/DungeonFinding/LFGGroupData.cpp b/src/server/game/DungeonFinding/LFGGroupData.cpp index d7c9efeb70e..81859f4f946 100644 --- a/src/server/game/DungeonFinding/LFGGroupData.cpp +++ b/src/server/game/DungeonFinding/LFGGroupData.cpp @@ -22,7 +22,7 @@ namespace lfg { LfgGroupData::LfgGroupData(): m_State(LFG_STATE_NONE), m_OldState(LFG_STATE_NONE), - m_Leader(0), m_Dungeon(0), m_KicksLeft(LFG_GROUP_MAX_KICKS) + m_Leader(), m_Dungeon(0), m_KicksLeft(LFG_GROUP_MAX_KICKS) { } LfgGroupData::~LfgGroupData() @@ -54,14 +54,14 @@ void LfgGroupData::RestoreState() m_State = m_OldState; } -void LfgGroupData::AddPlayer(uint64 guid) +void LfgGroupData::AddPlayer(ObjectGuid guid) { m_Players.insert(guid); } -uint8 LfgGroupData::RemovePlayer(uint64 guid) +uint8 LfgGroupData::RemovePlayer(ObjectGuid guid) { - LfgGuidSet::iterator it = m_Players.find(guid); + GuidSet::iterator it = m_Players.find(guid); if (it != m_Players.end()) m_Players.erase(it); return uint8(m_Players.size()); @@ -72,7 +72,7 @@ void LfgGroupData::RemoveAllPlayers() m_Players.clear(); } -void LfgGroupData::SetLeader(uint64 guid) +void LfgGroupData::SetLeader(ObjectGuid guid) { m_Leader = guid; } @@ -98,7 +98,7 @@ LfgState LfgGroupData::GetOldState() const return m_OldState; } -LfgGuidSet const& LfgGroupData::GetPlayers() const +GuidSet const& LfgGroupData::GetPlayers() const { return m_Players; } @@ -108,7 +108,7 @@ uint8 LfgGroupData::GetPlayerCount() const return m_Players.size(); } -uint64 LfgGroupData::GetLeader() const +ObjectGuid LfgGroupData::GetLeader() const { return m_Leader; } diff --git a/src/server/game/DungeonFinding/LFGGroupData.h b/src/server/game/DungeonFinding/LFGGroupData.h index b2bffd5a13b..45df76aca2a 100644 --- a/src/server/game/DungeonFinding/LFGGroupData.h +++ b/src/server/game/DungeonFinding/LFGGroupData.h @@ -42,10 +42,10 @@ class LfgGroupData // General void SetState(LfgState state); void RestoreState(); - void AddPlayer(uint64 guid); - uint8 RemovePlayer(uint64 guid); + void AddPlayer(ObjectGuid guid); + uint8 RemovePlayer(ObjectGuid guid); void RemoveAllPlayers(); - void SetLeader(uint64 guid); + void SetLeader(ObjectGuid guid); // Dungeon void SetDungeon(uint32 dungeon); @@ -56,9 +56,9 @@ class LfgGroupData // General LfgState GetState() const; LfgState GetOldState() const; - LfgGuidSet const& GetPlayers() const; + GuidSet const& GetPlayers() const; uint8 GetPlayerCount() const; - uint64 GetLeader() const; + ObjectGuid GetLeader() const; // Dungeon uint32 GetDungeon(bool asId = true) const; @@ -70,8 +70,8 @@ class LfgGroupData // General LfgState m_State; ///< State if group in LFG LfgState m_OldState; ///< Old State - uint64 m_Leader; ///< Leader GUID - LfgGuidSet m_Players; ///< Players in group + ObjectGuid m_Leader; ///< Leader GUID + GuidSet m_Players; ///< Players in group // Dungeon uint32 m_Dungeon; ///< Dungeon entry // Vote Kick diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 076ac7982ec..c1f2fe33889 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -50,15 +50,15 @@ LFGMgr::~LFGMgr() delete itr->second; } -void LFGMgr::_LoadFromDB(Field* fields, uint64 guid) +void LFGMgr::_LoadFromDB(Field* fields, ObjectGuid guid) { if (!fields) return; - if (!IS_GROUP_GUID(guid)) + if (!guid.IsGroup()) return; - SetLeader(guid, MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER)); + SetLeader(guid, ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32())); uint32 dungeon = fields[17].GetUInt32(); uint8 state = fields[18].GetUInt8(); @@ -79,9 +79,9 @@ void LFGMgr::_LoadFromDB(Field* fields, uint64 guid) } } -void LFGMgr::_SaveToDB(uint64 guid, uint32 db_guid) +void LFGMgr::_SaveToDB(ObjectGuid guid, uint32 db_guid) { - if (!IS_GROUP_GUID(guid)) + if (!guid.IsGroup()) return; PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_LFG_DATA); @@ -278,7 +278,7 @@ void LFGMgr::Update(uint32 diff) for (LfgRolesMap::const_iterator itRoles = roleCheck.roles.begin(); itRoles != roleCheck.roles.end(); ++itRoles) { - uint64 guid = itRoles->first; + ObjectGuid guid = itRoles->first; RestoreState(guid, "Remove Obsolete RoleCheck"); SendLfgRoleCheckUpdate(guid, roleCheck); if (guid == roleCheck.leader) @@ -307,7 +307,7 @@ void LFGMgr::Update(uint32 diff) boot.inProgress = false; for (LfgAnswerContainer::const_iterator itVotes = boot.votes.begin(); itVotes != boot.votes.end(); ++itVotes) { - uint64 pguid = itVotes->first; + ObjectGuid pguid = itVotes->first; if (pguid != boot.victim) SendLfgBootProposalUpdate(pguid, boot); SetState(pguid, LFG_STATE_DUNGEON); @@ -331,12 +331,12 @@ void LFGMgr::Update(uint32 diff) uint32 proposalId = itProposal->first; LfgProposal& proposal = ProposalsStore[proposalId]; - uint64 guid = 0; + ObjectGuid guid; for (LfgProposalPlayerContainer::const_iterator itPlayers = proposal.players.begin(); itPlayers != proposal.players.end(); ++itPlayers) { guid = itPlayers->first; SetState(guid, LFG_STATE_PROPOSAL); - if (uint64 gguid = GetGroup(guid)) + if (ObjectGuid gguid = GetGroup(guid)) { SetState(gguid, LFG_STATE_PROPOSAL); SendLfgUpdateParty(guid, LfgUpdateData(LFG_UPDATETYPE_PROPOSAL_BEGIN, GetSelectedDungeons(guid), GetComment(guid))); @@ -378,10 +378,10 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const return; Group* grp = player->GetGroup(); - uint64 guid = player->GetGUID(); - uint64 gguid = grp ? grp->GetGUID() : guid; + ObjectGuid guid = player->GetGUID(); + ObjectGuid gguid = grp ? grp->GetGUID() : guid; LfgJoinResultData joinData; - LfgGuidSet players; + GuidSet players; uint32 rDungeonId = 0; bool isContinue = grp && grp->isLFGGroup() && GetState(gguid) != LFG_STATE_FINISHED_DUNGEON; @@ -493,7 +493,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const if (joinData.result != LFG_JOIN_OK) { TC_LOG_DEBUG("lfg.join", "%u joining with %u members. Result: %u, Dungeons: %s", - GUID_LOPART(guid), grp ? grp->GetMembersCount() : 1, joinData.result, ConcatenateDungeons(dungeons).c_str()); + guid.GetCounter(), grp ? grp->GetMembersCount() : 1, joinData.result, ConcatenateDungeons(dungeons).c_str()); if (!dungeons.empty()) // Only should show lockmap when have no dungeons available joinData.lockmap.clear(); @@ -505,7 +505,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const if (isRaid) { - TC_LOG_DEBUG("lfg.join", "%u trying to join raid browser and it's disabled.", GUID_LOPART(guid)); + TC_LOG_DEBUG("lfg.join", "%u trying to join raid browser and it's disabled.", guid.GetCounter()); return; } @@ -533,7 +533,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const { if (Player* plrg = itr->GetSource()) { - uint64 pguid = plrg->GetGUID(); + ObjectGuid pguid = plrg->GetGUID(); plrg->GetSession()->SendLfgUpdateParty(updateData); SetState(pguid, LFG_STATE_ROLECHECK); if (!isContinue) @@ -571,7 +571,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const debugNames.append(player->GetName()); } - TC_LOG_DEBUG("lfg.join", "%u joined (%s), Members: %s. Dungeons (%u): %s", GUID_LOPART(guid), + TC_LOG_DEBUG("lfg.join", "%u joined (%s), Members: %s. Dungeons (%u): %s", guid.GetCounter(), grp ? "group" : "player", debugNames.c_str(), uint32(dungeons.size()), ConcatenateDungeons(dungeons).c_str()); } @@ -581,11 +581,11 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const @param[in] guid Player or group guid */ -void LFGMgr::LeaveLfg(uint64 guid) +void LFGMgr::LeaveLfg(ObjectGuid guid) { - uint64 gguid = IS_GROUP_GUID(guid) ? guid : GetGroup(guid); + ObjectGuid gguid = guid.IsGroup() ? guid : GetGroup(guid); - TC_LOG_DEBUG("lfg.leave", "%u left (%s)", GUID_LOPART(guid), guid == gguid ? "group" : "player"); + TC_LOG_DEBUG("lfg.leave", "%u left (%s)", guid.GetCounter(), guid == gguid ? "group" : "player"); LfgState state = GetState(guid); switch (state) @@ -596,8 +596,8 @@ void LFGMgr::LeaveLfg(uint64 guid) LFGQueue& queue = GetQueue(gguid); queue.RemoveFromQueue(gguid); SetState(gguid, LFG_STATE_NONE); - const LfgGuidSet& players = GetPlayers(gguid); - for (LfgGuidSet::const_iterator it = players.begin(); it != players.end(); ++it) + GuidSet const& players = GetPlayers(gguid); + for (GuidSet::const_iterator it = players.begin(); it != players.end(); ++it) { SetState(*it, LFG_STATE_NONE); SendLfgUpdateParty(*it, LfgUpdateData(LFG_UPDATETYPE_REMOVED_FROM_QUEUE)); @@ -619,7 +619,7 @@ void LFGMgr::LeaveLfg(uint64 guid) { // Remove from Proposals LfgProposalContainer::iterator it = ProposalsStore.begin(); - uint64 pguid = gguid == guid ? GetLeader(gguid) : guid; + ObjectGuid pguid = gguid == guid ? GetLeader(gguid) : guid; while (it != ProposalsStore.end()) { LfgProposalPlayerContainer::iterator itPlayer = it->second.players.find(pguid); @@ -656,7 +656,7 @@ void LFGMgr::LeaveLfg(uint64 guid) @param[in] guid Player guid (0 = rolecheck failed) @param[in] roles Player selected roles */ -void LFGMgr::UpdateRoleCheck(uint64 gguid, uint64 guid /* = 0 */, uint8 roles /* = PLAYER_ROLE_NONE */) +void LFGMgr::UpdateRoleCheck(ObjectGuid gguid, ObjectGuid guid /* = ObjectGuid::Empty */, uint8 roles /* = PLAYER_ROLE_NONE */) { if (!gguid) return; @@ -699,7 +699,7 @@ void LFGMgr::UpdateRoleCheck(uint64 gguid, uint64 guid /* = 0 */, uint8 roles /* LfgJoinResultData joinData = LfgJoinResultData(LFG_JOIN_FAILED, roleCheck.state); for (LfgRolesMap::const_iterator it = roleCheck.roles.begin(); it != roleCheck.roles.end(); ++it) { - uint64 pguid = it->first; + ObjectGuid pguid = it->first; if (sendRoleChosen) SendLfgRoleChosen(pguid, guid, roles); @@ -744,12 +744,12 @@ void LFGMgr::UpdateRoleCheck(uint64 gguid, uint64 guid /* = 0 */, uint8 roles /* @param[in] players Set of players to check their dungeon restrictions @param[out] lockMap Map of players Lock status info of given dungeons (Empty if dungeons is not empty) */ -void LFGMgr::GetCompatibleDungeons(LfgDungeonSet& dungeons, LfgGuidSet const& players, LfgLockPartyMap& lockMap) +void LFGMgr::GetCompatibleDungeons(LfgDungeonSet& dungeons, GuidSet const& players, LfgLockPartyMap& lockMap) { lockMap.clear(); - for (LfgGuidSet::const_iterator it = players.begin(); it != players.end() && !dungeons.empty(); ++it) + for (GuidSet::const_iterator it = players.begin(); it != players.end() && !dungeons.empty(); ++it) { - uint64 guid = (*it); + ObjectGuid guid = (*it); LfgLockMap const& cachedLockMap = GetLockedDungeons(guid); for (LfgLockMap::const_iterator it2 = cachedLockMap.begin(); it2 != cachedLockMap.end() && !dungeons.empty(); ++it2) { @@ -845,12 +845,12 @@ bool LFGMgr::CheckGroupRoles(LfgRolesMap& groles, bool removeLeaderFlag /*= true */ void LFGMgr::MakeNewGroup(LfgProposal const& proposal) { - LfgGuidList players; - LfgGuidList playersToTeleport; + GuidList players; + GuidList playersToTeleport; for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it) { - uint64 guid = it->first; + ObjectGuid guid = it->first; if (guid == proposal.leader) players.push_front(guid); else @@ -864,10 +864,10 @@ void LFGMgr::MakeNewGroup(LfgProposal const& proposal) LFGDungeonData const* dungeon = GetLFGDungeon(proposal.dungeonId); ASSERT(dungeon); - Group* grp = proposal.group ? sGroupMgr->GetGroupByGUID(GUID_LOPART(proposal.group)) : NULL; - for (LfgGuidList::const_iterator it = players.begin(); it != players.end(); ++it) + Group* grp = proposal.group ? sGroupMgr->GetGroupByGUID(proposal.group.GetCounter()) : NULL; + for (GuidList::const_iterator it = players.begin(); it != players.end(); ++it) { - uint64 pguid = (*it); + ObjectGuid pguid = (*it); Player* player = ObjectAccessor::FindPlayer(pguid); if (!player) continue; @@ -881,7 +881,7 @@ void LFGMgr::MakeNewGroup(LfgProposal const& proposal) grp = new Group(); grp->ConvertToLFG(); grp->Create(player); - uint64 gguid = grp->GetGUID(); + ObjectGuid gguid = grp->GetGUID(); SetState(gguid, LFG_STATE_PROPOSAL); sGroupMgr->AddGroup(grp); } @@ -897,14 +897,14 @@ void LFGMgr::MakeNewGroup(LfgProposal const& proposal) ASSERT(grp); grp->SetDungeonDifficulty(Difficulty(dungeon->difficulty)); - uint64 gguid = grp->GetGUID(); + ObjectGuid gguid = grp->GetGUID(); SetDungeon(gguid, dungeon->Entry()); SetState(gguid, LFG_STATE_DUNGEON); _SaveToDB(gguid, grp->GetDbStoreId()); // Teleport Player - for (LfgGuidList::const_iterator it = playersToTeleport.begin(); it != playersToTeleport.end(); ++it) + for (GuidList::const_iterator it = playersToTeleport.begin(); it != playersToTeleport.end(); ++it) if (Player* player = ObjectAccessor::FindPlayer(*it)) TeleportPlayer(player, false); @@ -926,7 +926,7 @@ uint32 LFGMgr::AddProposal(LfgProposal& proposal) @param[in] guid Player guid to update answer @param[in] accept Player answer */ -void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept) +void LFGMgr::UpdateProposal(uint32 proposalId, ObjectGuid guid, bool accept) { // Check if the proposal exists LfgProposalContainer::iterator itProposal = ProposalsStore.find(proposalId); @@ -943,7 +943,7 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept) LfgProposalPlayer& player = itProposalPlayer->second; player.accept = LfgAnswer(accept); - TC_LOG_DEBUG("lfg.proposal.update", "Player %u, Proposal %u, Selection: %u", GUID_LOPART(guid), proposalId, accept); + TC_LOG_DEBUG("lfg.proposal.update", "Player %u, Proposal %u, Selection: %u", guid.GetCounter(), proposalId, accept); if (!accept) { RemoveProposal(itProposal, LFG_UPDATETYPE_PROPOSAL_DECLINED); @@ -972,8 +972,8 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept) LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_GROUP_FOUND); for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it) { - uint64 pguid = it->first; - uint64 gguid = it->second.group; + ObjectGuid pguid = it->first; + ObjectGuid gguid = it->second.group; uint32 dungeonId = (*GetSelectedDungeons(pguid).begin()); int32 waitTime = -1; if (sendUpdate) @@ -1016,7 +1016,7 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept) } // Remove players/groups from Queue - for (LfgGuidList::const_iterator it = proposal.queues.begin(); it != proposal.queues.end(); ++it) + for (GuidList::const_iterator it = proposal.queues.begin(); it != proposal.queues.end(); ++it) queue.RemoveFromQueue(*it); MakeNewGroup(proposal); @@ -1042,13 +1042,13 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate it->second.accept = LFG_ANSWER_DENY; // Mark players/groups to be removed - LfgGuidSet toRemove; + GuidSet toRemove; for (LfgProposalPlayerContainer::iterator it = proposal.players.begin(); it != proposal.players.end(); ++it) { if (it->second.accept == LFG_ANSWER_AGREE) continue; - uint64 guid = it->second.group ? it->second.group : it->first; + ObjectGuid guid = it->second.group ? it->second.group : it->first; // Player didn't accept or still pending when no secs left if (it->second.accept == LFG_ANSWER_DENY || type == LFG_UPDATETYPE_PROPOSAL_FAILED) { @@ -1060,8 +1060,8 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate // Notify players for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it) { - uint64 guid = it->first; - uint64 gguid = it->second.group ? it->second.group : guid; + ObjectGuid guid = it->first; + ObjectGuid gguid = it->second.group ? it->second.group : guid; SendLfgUpdateProposal(guid, proposal); @@ -1071,12 +1071,12 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate if (it->second.accept == LFG_ANSWER_DENY) { updateData.updateType = type; - TC_LOG_DEBUG("lfg.proposal.remove", "%u didn't accept. Removing from queue and compatible cache", GUID_LOPART(guid)); + TC_LOG_DEBUG("lfg.proposal.remove", "%u didn't accept. Removing from queue and compatible cache", guid.GetCounter()); } else { updateData.updateType = LFG_UPDATETYPE_REMOVED_FROM_QUEUE; - TC_LOG_DEBUG("lfg.proposal.remove", "%u in same group that someone that didn't accept. Removing from queue and compatible cache", GUID_LOPART(guid)); + TC_LOG_DEBUG("lfg.proposal.remove", "%u in same group that someone that didn't accept. Removing from queue and compatible cache", guid.GetCounter()); } RestoreState(guid, "Proposal Fail (didn't accepted or in group with someone that didn't accept"); @@ -1090,7 +1090,7 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate } else { - TC_LOG_DEBUG("lfg.proposal.remove", "Readding %u to queue.", GUID_LOPART(guid)); + TC_LOG_DEBUG("lfg.proposal.remove", "Readding %u to queue.", guid.GetCounter()); SetState(guid, LFG_STATE_QUEUED); if (gguid != guid) { @@ -1104,17 +1104,17 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate LFGQueue& queue = GetQueue(proposal.players.begin()->first); // Remove players/groups from queue - for (LfgGuidSet::const_iterator it = toRemove.begin(); it != toRemove.end(); ++it) + for (GuidSet::const_iterator it = toRemove.begin(); it != toRemove.end(); ++it) { - uint64 guid = *it; + ObjectGuid guid = *it; queue.RemoveFromQueue(guid); proposal.queues.remove(guid); } // Readd to queue - for (LfgGuidList::const_iterator it = proposal.queues.begin(); it != proposal.queues.end(); ++it) + for (GuidList::const_iterator it = proposal.queues.begin(); it != proposal.queues.end(); ++it) { - uint64 guid = *it; + ObjectGuid guid = *it; queue.AddToQueue(guid); } @@ -1129,7 +1129,7 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate @param[in] victim Victim guid @param[in] reason Kick reason */ -void LFGMgr::InitBoot(uint64 gguid, uint64 kicker, uint64 victim, std::string const& reason) +void LFGMgr::InitBoot(ObjectGuid gguid, ObjectGuid kicker, ObjectGuid victim, std::string const& reason) { SetState(gguid, LFG_STATE_BOOT); @@ -1139,12 +1139,12 @@ void LFGMgr::InitBoot(uint64 gguid, uint64 kicker, uint64 victim, std::string co boot.reason = reason; boot.victim = victim; - LfgGuidSet const& players = GetPlayers(gguid); + GuidSet const& players = GetPlayers(gguid); // Set votes - for (LfgGuidSet::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (GuidSet::const_iterator itr = players.begin(); itr != players.end(); ++itr) { - uint64 guid = (*itr); + ObjectGuid guid = (*itr); SetState(guid, LFG_STATE_BOOT); boot.votes[guid] = LFG_ANSWER_PENDING; } @@ -1153,7 +1153,7 @@ void LFGMgr::InitBoot(uint64 gguid, uint64 kicker, uint64 victim, std::string co boot.votes[kicker] = LFG_ANSWER_AGREE; // Kicker auto vote YES // Notify players - for (LfgGuidSet::const_iterator it = players.begin(); it != players.end(); ++it) + for (GuidSet::const_iterator it = players.begin(); it != players.end(); ++it) SendLfgBootProposalUpdate(*it, boot); } @@ -1163,9 +1163,9 @@ void LFGMgr::InitBoot(uint64 gguid, uint64 kicker, uint64 victim, std::string co @param[in] guid Player who has answered @param[in] player answer */ -void LFGMgr::UpdateBoot(uint64 guid, bool accept) +void LFGMgr::UpdateBoot(ObjectGuid guid, bool accept) { - uint64 gguid = GetGroup(guid); + ObjectGuid gguid = GetGroup(guid); if (!gguid) return; @@ -1200,7 +1200,7 @@ void LFGMgr::UpdateBoot(uint64 guid, bool accept) boot.inProgress = false; for (LfgAnswerContainer::const_iterator itVotes = boot.votes.begin(); itVotes != boot.votes.end(); ++itVotes) { - uint64 pguid = itVotes->first; + ObjectGuid pguid = itVotes->first; if (pguid != boot.victim) { SetState(pguid, LFG_STATE_DUNGEON); @@ -1211,7 +1211,7 @@ void LFGMgr::UpdateBoot(uint64 guid, bool accept) SetState(gguid, LFG_STATE_DUNGEON); if (agreeNum == LFG_GROUP_KICK_VOTES_NEEDED) // Vote passed - Kick player { - if (Group* group = sGroupMgr->GetGroupByGUID(GUID_LOPART(gguid))) + if (Group* group = sGroupMgr->GetGroupByGUID(gguid.GetCounter())) Player::RemoveFromGroup(group, boot.victim, GROUP_REMOVEMETHOD_KICK_LFG); DecreaseKicksLeft(gguid); } @@ -1318,30 +1318,30 @@ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false* @param[in] guid Group guid @param[in] dungeonId Dungeonid */ -void LFGMgr::FinishDungeon(uint64 gguid, const uint32 dungeonId) +void LFGMgr::FinishDungeon(ObjectGuid gguid, const uint32 dungeonId) { uint32 gDungeonId = GetDungeon(gguid); if (gDungeonId != dungeonId) { - TC_LOG_DEBUG("lfg.dungeon.finish", "Group %u finished dungeon %u but queued for %u", GUID_LOPART(gguid), dungeonId, gDungeonId); + TC_LOG_DEBUG("lfg.dungeon.finish", "Group %u finished dungeon %u but queued for %u", gguid.GetCounter(), dungeonId, gDungeonId); return; } if (GetState(gguid) == LFG_STATE_FINISHED_DUNGEON) // Shouldn't happen. Do not reward multiple times { - TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u already rewarded", GUID_LOPART(gguid)); + TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u already rewarded", gguid.GetCounter()); return; } SetState(gguid, LFG_STATE_FINISHED_DUNGEON); - const LfgGuidSet& players = GetPlayers(gguid); - for (LfgGuidSet::const_iterator it = players.begin(); it != players.end(); ++it) + GuidSet const& players = GetPlayers(gguid); + for (GuidSet::const_iterator it = players.begin(); it != players.end(); ++it) { - uint64 guid = (*it); + ObjectGuid guid = (*it); if (GetState(guid) == LFG_STATE_FINISHED_DUNGEON) { - TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u already rewarded", GUID_LOPART(gguid), GUID_LOPART(guid)); + TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u already rewarded", gguid.GetCounter(), guid.GetCounter()); continue; } @@ -1357,14 +1357,14 @@ void LFGMgr::FinishDungeon(uint64 gguid, const uint32 dungeonId) if (!dungeon || (dungeon->type != LFG_TYPE_RANDOM && !dungeon->seasonal)) { - TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u dungeon %u is not random or seasonal", GUID_LOPART(gguid), GUID_LOPART(guid), rDungeonId); + TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u dungeon %u is not random or seasonal", gguid.GetCounter(), guid.GetCounter(), rDungeonId); continue; } Player* player = ObjectAccessor::FindPlayer(guid); if (!player || !player->IsInWorld()) { - TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u not found in world", GUID_LOPART(gguid), GUID_LOPART(guid)); + TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u not found in world", gguid.GetCounter(), guid.GetCounter()); continue; } @@ -1373,7 +1373,7 @@ void LFGMgr::FinishDungeon(uint64 gguid, const uint32 dungeonId) if (player->GetMapId() != mapId) { - TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u is in map %u and should be in %u to get reward", GUID_LOPART(gguid), GUID_LOPART(guid), player->GetMapId(), mapId); + TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u is in map %u and should be in %u to get reward", gguid.GetCounter(), guid.GetCounter(), player->GetMapId(), mapId); continue; } @@ -1404,7 +1404,7 @@ void LFGMgr::FinishDungeon(uint64 gguid, const uint32 dungeonId) } // Give rewards - TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u done dungeon %u, %s previously done.", GUID_LOPART(gguid), GUID_LOPART(guid), GetDungeon(gguid), done? " " : " not"); + TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u done dungeon %u, %s previously done.", gguid.GetCounter(), guid.GetCounter(), GetDungeon(gguid), done? " " : " not"); LfgPlayerRewardData data = LfgPlayerRewardData(dungeon->Entry(), GetDungeon(gguid, false), done, quest); player->GetSession()->SendLfgPlayerReward(data); } @@ -1464,48 +1464,48 @@ LfgType LFGMgr::GetDungeonType(uint32 dungeonId) return LfgType(dungeon->type); } -LfgState LFGMgr::GetState(uint64 guid) +LfgState LFGMgr::GetState(ObjectGuid guid) { LfgState state; - if (IS_GROUP_GUID(guid)) + if (guid.IsGroup()) { state = GroupsStore[guid].GetState(); - TC_LOG_TRACE("lfg.data.group.state.get", "Group: %u, State: %u", GUID_LOPART(guid), state); + TC_LOG_TRACE("lfg.data.group.state.get", "Group: %u, State: %u", guid.GetCounter(), state); } else { state = PlayersStore[guid].GetState(); - TC_LOG_TRACE("lfg.data.player.state.get", "Player: %u, State: %u", GUID_LOPART(guid), state); + TC_LOG_TRACE("lfg.data.player.state.get", "Player: %u, State: %u", guid.GetCounter(), state); } return state; } -LfgState LFGMgr::GetOldState(uint64 guid) +LfgState LFGMgr::GetOldState(ObjectGuid guid) { LfgState state; - if (IS_GROUP_GUID(guid)) + if (guid.IsGroup()) { state = GroupsStore[guid].GetOldState(); - TC_LOG_TRACE("lfg.data.group.oldstate.get", "Group: %u, Old state: %u", GUID_LOPART(guid), state); + TC_LOG_TRACE("lfg.data.group.oldstate.get", "Group: %u, Old state: %u", guid.GetCounter(), state); } else { state = PlayersStore[guid].GetOldState(); - TC_LOG_TRACE("lfg.data.player.oldstate.get", "Player: %u, Old state: %u", GUID_LOPART(guid), state); + TC_LOG_TRACE("lfg.data.player.oldstate.get", "Player: %u, Old state: %u", guid.GetCounter(), state); } return state; } -uint32 LFGMgr::GetDungeon(uint64 guid, bool asId /*= true */) +uint32 LFGMgr::GetDungeon(ObjectGuid guid, bool asId /*= true */) { uint32 dungeon = GroupsStore[guid].GetDungeon(asId); - TC_LOG_TRACE("lfg.data.group.dungeon.get", "Group: %u, asId: %u, Dungeon: %u", GUID_LOPART(guid), asId, dungeon); + TC_LOG_TRACE("lfg.data.group.dungeon.get", "Group: %u, asId: %u, Dungeon: %u", guid.GetCounter(), asId, dungeon); return dungeon; } -uint32 LFGMgr::GetDungeonMapId(uint64 guid) +uint32 LFGMgr::GetDungeonMapId(ObjectGuid guid) { uint32 dungeonId = GroupsStore[guid].GetDungeon(true); uint32 mapId = 0; @@ -1513,38 +1513,38 @@ uint32 LFGMgr::GetDungeonMapId(uint64 guid) if (LFGDungeonData const* dungeon = GetLFGDungeon(dungeonId)) mapId = dungeon->map; - TC_LOG_TRACE("lfg.data.group.dungeon.map", "Group: %u, MapId: %u (DungeonId: %u)", GUID_LOPART(guid), mapId, dungeonId); + TC_LOG_TRACE("lfg.data.group.dungeon.map", "Group: %u, MapId: %u (DungeonId: %u)", guid.GetCounter(), mapId, dungeonId); return mapId; } -uint8 LFGMgr::GetRoles(uint64 guid) +uint8 LFGMgr::GetRoles(ObjectGuid guid) { uint8 roles = PlayersStore[guid].GetRoles(); - TC_LOG_TRACE("lfg.data.player.role.get", "Player: %u, Role: %u", GUID_LOPART(guid), roles); + TC_LOG_TRACE("lfg.data.player.role.get", "Player: %u, Role: %u", guid.GetCounter(), roles); return roles; } -const std::string& LFGMgr::GetComment(uint64 guid) +const std::string& LFGMgr::GetComment(ObjectGuid guid) { - TC_LOG_TRACE("lfg.data.player.comment.get", "Player: %u, Comment: %s", GUID_LOPART(guid), PlayersStore[guid].GetComment().c_str()); + TC_LOG_TRACE("lfg.data.player.comment.get", "Player: %u, Comment: %s", guid.GetCounter(), PlayersStore[guid].GetComment().c_str()); return PlayersStore[guid].GetComment(); } -LfgDungeonSet const& LFGMgr::GetSelectedDungeons(uint64 guid) +LfgDungeonSet const& LFGMgr::GetSelectedDungeons(ObjectGuid guid) { - TC_LOG_TRACE("lfg.data.player.dungeons.selected.get", "Player: %u, Selected Dungeons: %s", GUID_LOPART(guid), ConcatenateDungeons(PlayersStore[guid].GetSelectedDungeons()).c_str()); + TC_LOG_TRACE("lfg.data.player.dungeons.selected.get", "Player: %u, Selected Dungeons: %s", guid.GetCounter(), ConcatenateDungeons(PlayersStore[guid].GetSelectedDungeons()).c_str()); return PlayersStore[guid].GetSelectedDungeons(); } -LfgLockMap const LFGMgr::GetLockedDungeons(uint64 guid) +LfgLockMap const LFGMgr::GetLockedDungeons(ObjectGuid guid) { - TC_LOG_TRACE("lfg.data.player.dungeons.locked.get", "Player: %u, LockedDungeons.", GUID_LOPART(guid)); + TC_LOG_TRACE("lfg.data.player.dungeons.locked.get", "Player: %u, LockedDungeons.", guid.GetCounter()); LfgLockMap lock; Player* player = ObjectAccessor::FindPlayer(guid); if (!player) { - TC_LOG_WARN("lfg.data.player.dungeons.locked.get", "Player: %u not ingame while retrieving his LockedDungeons.", GUID_LOPART(guid)); + TC_LOG_WARN("lfg.data.player.dungeons.locked.get", "Player: %u not ingame while retrieving his LockedDungeons.", guid.GetCounter()); return lock; } @@ -1607,20 +1607,20 @@ LfgLockMap const LFGMgr::GetLockedDungeons(uint64 guid) return lock; } -uint8 LFGMgr::GetKicksLeft(uint64 guid) +uint8 LFGMgr::GetKicksLeft(ObjectGuid guid) { uint8 kicks = GroupsStore[guid].GetKicksLeft(); - TC_LOG_TRACE("lfg.data.group.kickleft.get", "Group: %u, Kicks left: %u", GUID_LOPART(guid), kicks); + TC_LOG_TRACE("lfg.data.group.kickleft.get", "Group: %u, Kicks left: %u", guid.GetCounter(), kicks); return kicks; } -void LFGMgr::RestoreState(uint64 guid, char const* debugMsg) +void LFGMgr::RestoreState(ObjectGuid guid, char const* debugMsg) { - if (IS_GROUP_GUID(guid)) + if (guid.IsGroup()) { LfgGroupData& data = GroupsStore[guid]; TC_LOG_TRACE("lfg.data.group.state.restore", "Group: %u (%s), State: %s, Old state: %s", - GUID_LOPART(guid), debugMsg, GetStateString(data.GetState()).c_str(), + guid.GetCounter(), debugMsg, GetStateString(data.GetState()).c_str(), GetStateString(data.GetOldState()).c_str()); data.RestoreState(); @@ -1629,20 +1629,20 @@ void LFGMgr::RestoreState(uint64 guid, char const* debugMsg) { LfgPlayerData& data = PlayersStore[guid]; TC_LOG_TRACE("lfg.data.player.state.restore", "Player: %u (%s), State: %s, Old state: %s", - GUID_LOPART(guid), debugMsg, GetStateString(data.GetState()).c_str(), + guid.GetCounter(), debugMsg, GetStateString(data.GetState()).c_str(), GetStateString(data.GetOldState()).c_str()); data.RestoreState(); } } -void LFGMgr::SetState(uint64 guid, LfgState state) +void LFGMgr::SetState(ObjectGuid guid, LfgState state) { - if (IS_GROUP_GUID(guid)) + if (guid.IsGroup()) { LfgGroupData& data = GroupsStore[guid]; TC_LOG_TRACE("lfg.data.group.state.set", "Group: %u, New state: %s, Previous: %s, Old state: %s", - GUID_LOPART(guid), GetStateString(state).c_str(), GetStateString(data.GetState()).c_str(), + guid.GetCounter(), GetStateString(state).c_str(), GetStateString(data.GetState()).c_str(), GetStateString(data.GetOldState()).c_str()); data.SetState(state); @@ -1651,64 +1651,64 @@ void LFGMgr::SetState(uint64 guid, LfgState state) { LfgPlayerData& data = PlayersStore[guid]; TC_LOG_TRACE("lfg.data.player.state.set", "Player: %u, New state: %s, Previous: %s, OldState: %s", - GUID_LOPART(guid), GetStateString(state).c_str(), GetStateString(data.GetState()).c_str(), + guid.GetCounter(), GetStateString(state).c_str(), GetStateString(data.GetState()).c_str(), GetStateString(data.GetOldState()).c_str()); data.SetState(state); } } -void LFGMgr::SetDungeon(uint64 guid, uint32 dungeon) +void LFGMgr::SetDungeon(ObjectGuid guid, uint32 dungeon) { - TC_LOG_TRACE("lfg.data.group.dungeon.set", "Group: %u, Dungeon: %u", GUID_LOPART(guid), dungeon); + TC_LOG_TRACE("lfg.data.group.dungeon.set", "Group: %u, Dungeon: %u", guid.GetCounter(), dungeon); GroupsStore[guid].SetDungeon(dungeon); } -void LFGMgr::SetRoles(uint64 guid, uint8 roles) +void LFGMgr::SetRoles(ObjectGuid guid, uint8 roles) { - TC_LOG_TRACE("lfg.data.player.role.set", "Player: %u, Roles: %u", GUID_LOPART(guid), roles); + TC_LOG_TRACE("lfg.data.player.role.set", "Player: %u, Roles: %u", guid.GetCounter(), roles); PlayersStore[guid].SetRoles(roles); } -void LFGMgr::SetComment(uint64 guid, std::string const& comment) +void LFGMgr::SetComment(ObjectGuid guid, std::string const& comment) { - TC_LOG_TRACE("lfg.data.player.comment.set", "Player: %u, Comment: %s", GUID_LOPART(guid), comment.c_str()); + TC_LOG_TRACE("lfg.data.player.comment.set", "Player: %u, Comment: %s", guid.GetCounter(), comment.c_str()); PlayersStore[guid].SetComment(comment); } -void LFGMgr::SetSelectedDungeons(uint64 guid, LfgDungeonSet const& dungeons) +void LFGMgr::SetSelectedDungeons(ObjectGuid guid, LfgDungeonSet const& dungeons) { - TC_LOG_TRACE("lfg.data.player.dungeon.selected.set", "Player: %u, Dungeons: %s", GUID_LOPART(guid), ConcatenateDungeons(dungeons).c_str()); + TC_LOG_TRACE("lfg.data.player.dungeon.selected.set", "Player: %u, Dungeons: %s", guid.GetCounter(), ConcatenateDungeons(dungeons).c_str()); PlayersStore[guid].SetSelectedDungeons(dungeons); } -void LFGMgr::DecreaseKicksLeft(uint64 guid) +void LFGMgr::DecreaseKicksLeft(ObjectGuid guid) { GroupsStore[guid].DecreaseKicksLeft(); - TC_LOG_TRACE("lfg.data.group.kicksleft.decrease", "Group: %u, Kicks: %u", GUID_LOPART(guid), GroupsStore[guid].GetKicksLeft()); + TC_LOG_TRACE("lfg.data.group.kicksleft.decrease", "Group: %u, Kicks: %u", guid.GetCounter(), GroupsStore[guid].GetKicksLeft()); } -void LFGMgr::RemovePlayerData(uint64 guid) +void LFGMgr::RemovePlayerData(ObjectGuid guid) { - TC_LOG_TRACE("lfg.data.player.remove", "Player: %u", GUID_LOPART(guid)); + TC_LOG_TRACE("lfg.data.player.remove", "Player: %u", guid.GetCounter()); LfgPlayerDataContainer::iterator it = PlayersStore.find(guid); if (it != PlayersStore.end()) PlayersStore.erase(it); } -void LFGMgr::RemoveGroupData(uint64 guid) +void LFGMgr::RemoveGroupData(ObjectGuid guid) { - TC_LOG_TRACE("lfg.data.group.remove", "Group: %u", GUID_LOPART(guid)); + TC_LOG_TRACE("lfg.data.group.remove", "Group: %u", guid.GetCounter()); LfgGroupDataContainer::iterator it = GroupsStore.find(guid); if (it == GroupsStore.end()) return; LfgState state = GetState(guid); // If group is being formed after proposal success do nothing more - LfgGuidSet const& players = it->second.GetPlayers(); - for (uint64 playerGUID : players) + GuidSet const& players = it->second.GetPlayers(); + for (ObjectGuid playerGUID : players) { - SetGroup(playerGUID, 0); + SetGroup(playerGUID, ObjectGuid::Empty); if (state != LFG_STATE_PROPOSAL) { SetState(playerGUID, LFG_STATE_NONE); @@ -1718,29 +1718,29 @@ void LFGMgr::RemoveGroupData(uint64 guid) GroupsStore.erase(it); } -uint8 LFGMgr::GetTeam(uint64 guid) +uint8 LFGMgr::GetTeam(ObjectGuid guid) { uint8 team = PlayersStore[guid].GetTeam(); - TC_LOG_TRACE("lfg.data.player.team.get", "Player: %u, Team: %u", GUID_LOPART(guid), team); + TC_LOG_TRACE("lfg.data.player.team.get", "Player: %u, Team: %u", guid.GetCounter(), team); return team; } -uint8 LFGMgr::RemovePlayerFromGroup(uint64 gguid, uint64 guid) +uint8 LFGMgr::RemovePlayerFromGroup(ObjectGuid gguid, ObjectGuid guid) { return GroupsStore[gguid].RemovePlayer(guid); } -void LFGMgr::AddPlayerToGroup(uint64 gguid, uint64 guid) +void LFGMgr::AddPlayerToGroup(ObjectGuid gguid, ObjectGuid guid) { GroupsStore[gguid].AddPlayer(guid); } -void LFGMgr::SetLeader(uint64 gguid, uint64 leader) +void LFGMgr::SetLeader(ObjectGuid gguid, ObjectGuid leader) { GroupsStore[gguid].SetLeader(leader); } -void LFGMgr::SetTeam(uint64 guid, uint8 team) +void LFGMgr::SetTeam(ObjectGuid guid, uint8 team) { if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP)) team = 0; @@ -1748,100 +1748,98 @@ void LFGMgr::SetTeam(uint64 guid, uint8 team) PlayersStore[guid].SetTeam(team); } -uint64 LFGMgr::GetGroup(uint64 guid) +ObjectGuid LFGMgr::GetGroup(ObjectGuid guid) { return PlayersStore[guid].GetGroup(); } -void LFGMgr::SetGroup(uint64 guid, uint64 group) +void LFGMgr::SetGroup(ObjectGuid guid, ObjectGuid group) { PlayersStore[guid].SetGroup(group); } -LfgGuidSet const& LFGMgr::GetPlayers(uint64 guid) +GuidSet const& LFGMgr::GetPlayers(ObjectGuid guid) { return GroupsStore[guid].GetPlayers(); } -uint8 LFGMgr::GetPlayerCount(uint64 guid) +uint8 LFGMgr::GetPlayerCount(ObjectGuid guid) { return GroupsStore[guid].GetPlayerCount(); } -uint64 LFGMgr::GetLeader(uint64 guid) +ObjectGuid LFGMgr::GetLeader(ObjectGuid guid) { return GroupsStore[guid].GetLeader(); } -bool LFGMgr::HasIgnore(uint64 guid1, uint64 guid2) +bool LFGMgr::HasIgnore(ObjectGuid guid1, ObjectGuid guid2) { Player* plr1 = ObjectAccessor::FindPlayer(guid1); Player* plr2 = ObjectAccessor::FindPlayer(guid2); - uint32 low1 = GUID_LOPART(guid1); - uint32 low2 = GUID_LOPART(guid2); - return plr1 && plr2 && (plr1->GetSocial()->HasIgnore(low2) || plr2->GetSocial()->HasIgnore(low1)); + return plr1 && plr2 && (plr1->GetSocial()->HasIgnore(guid2.GetCounter()) || plr2->GetSocial()->HasIgnore(guid1.GetCounter())); } -void LFGMgr::SendLfgRoleChosen(uint64 guid, uint64 pguid, uint8 roles) +void LFGMgr::SendLfgRoleChosen(ObjectGuid guid, ObjectGuid pguid, uint8 roles) { if (Player* player = ObjectAccessor::FindPlayer(guid)) player->GetSession()->SendLfgRoleChosen(pguid, roles); } -void LFGMgr::SendLfgRoleCheckUpdate(uint64 guid, LfgRoleCheck const& roleCheck) +void LFGMgr::SendLfgRoleCheckUpdate(ObjectGuid guid, LfgRoleCheck const& roleCheck) { if (Player* player = ObjectAccessor::FindPlayer(guid)) player->GetSession()->SendLfgRoleCheckUpdate(roleCheck); } -void LFGMgr::SendLfgUpdatePlayer(uint64 guid, LfgUpdateData const& data) +void LFGMgr::SendLfgUpdatePlayer(ObjectGuid guid, LfgUpdateData const& data) { if (Player* player = ObjectAccessor::FindPlayer(guid)) player->GetSession()->SendLfgUpdatePlayer(data); } -void LFGMgr::SendLfgUpdateParty(uint64 guid, LfgUpdateData const& data) +void LFGMgr::SendLfgUpdateParty(ObjectGuid guid, LfgUpdateData const& data) { if (Player* player = ObjectAccessor::FindPlayer(guid)) player->GetSession()->SendLfgUpdateParty(data); } -void LFGMgr::SendLfgJoinResult(uint64 guid, LfgJoinResultData const& data) +void LFGMgr::SendLfgJoinResult(ObjectGuid guid, LfgJoinResultData const& data) { if (Player* player = ObjectAccessor::FindPlayer(guid)) player->GetSession()->SendLfgJoinResult(data); } -void LFGMgr::SendLfgBootProposalUpdate(uint64 guid, LfgPlayerBoot const& boot) +void LFGMgr::SendLfgBootProposalUpdate(ObjectGuid guid, LfgPlayerBoot const& boot) { if (Player* player = ObjectAccessor::FindPlayer(guid)) player->GetSession()->SendLfgBootProposalUpdate(boot); } -void LFGMgr::SendLfgUpdateProposal(uint64 guid, LfgProposal const& proposal) +void LFGMgr::SendLfgUpdateProposal(ObjectGuid guid, LfgProposal const& proposal) { if (Player* player = ObjectAccessor::FindPlayer(guid)) player->GetSession()->SendLfgUpdateProposal(proposal); } -void LFGMgr::SendLfgQueueStatus(uint64 guid, LfgQueueStatusData const& data) +void LFGMgr::SendLfgQueueStatus(ObjectGuid guid, LfgQueueStatusData const& data) { if (Player* player = ObjectAccessor::FindPlayer(guid)) player->GetSession()->SendLfgQueueStatus(data); } -bool LFGMgr::IsLfgGroup(uint64 guid) +bool LFGMgr::IsLfgGroup(ObjectGuid guid) { - return guid && IS_GROUP_GUID(guid) && GroupsStore[guid].IsLfgGroup(); + return guid && guid.IsGroup() && GroupsStore[guid].IsLfgGroup(); } -LFGQueue& LFGMgr::GetQueue(uint64 guid) +LFGQueue& LFGMgr::GetQueue(ObjectGuid guid) { uint8 queueId = 0; - if (IS_GROUP_GUID(guid)) + if (guid.IsGroup()) { - LfgGuidSet const& players = GetPlayers(guid); - uint64 pguid = players.empty() ? 0 : (*players.begin()); + GuidSet const& players = GetPlayers(guid); + ObjectGuid pguid = players.empty() ? ObjectGuid::Empty : (*players.begin()); if (pguid) queueId = GetTeam(pguid); } @@ -1850,12 +1848,12 @@ LFGQueue& LFGMgr::GetQueue(uint64 guid) return QueuesStore[queueId]; } -bool LFGMgr::AllQueued(LfgGuidList const& check) +bool LFGMgr::AllQueued(GuidList const& check) { if (check.empty()) return false; - for (LfgGuidList::const_iterator it = check.begin(); it != check.end(); ++it) + for (GuidList::const_iterator it = check.begin(); it != check.end(); ++it) if (GetState(*it) != LFG_STATE_QUEUED) return false; return true; @@ -1882,7 +1880,7 @@ void LFGMgr::SetOptions(uint32 options) m_options = options; } -LfgUpdateData LFGMgr::GetLfgStatus(uint64 guid) +LfgUpdateData LFGMgr::GetLfgStatus(ObjectGuid guid) { LfgPlayerData& playerData = PlayersStore[guid]; return LfgUpdateData(LFG_UPDATETYPE_UPDATE_STATUS, playerData.GetState(), playerData.GetSelectedDungeons()); @@ -1920,7 +1918,7 @@ std::string LFGMgr::DumpQueueInfo(bool full) return o.str(); } -void LFGMgr::SetupGroupMember(uint64 guid, uint64 gguid) +void LFGMgr::SetupGroupMember(ObjectGuid guid, ObjectGuid gguid) { LfgDungeonSet dungeons; dungeons.insert(GetDungeon(gguid)); @@ -1930,7 +1928,7 @@ void LFGMgr::SetupGroupMember(uint64 guid, uint64 gguid) AddPlayerToGroup(gguid, guid); } -bool LFGMgr::selectedRandomLfgDungeon(uint64 guid) +bool LFGMgr::selectedRandomLfgDungeon(ObjectGuid guid) { if (GetState(guid) != LFG_STATE_NONE) { @@ -1946,9 +1944,9 @@ bool LFGMgr::selectedRandomLfgDungeon(uint64 guid) return false; } -bool LFGMgr::inLfgDungeonMap(uint64 guid, uint32 map, Difficulty difficulty) +bool LFGMgr::inLfgDungeonMap(ObjectGuid guid, uint32 map, Difficulty difficulty) { - if (!IS_GROUP_GUID(guid)) + if (!guid.IsGroup()) guid = GetGroup(guid); if (uint32 dungeonId = GetDungeon(guid, true)) diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h index 547d026dee0..b75686945a5 100644 --- a/src/server/game/DungeonFinding/LFGMgr.h +++ b/src/server/game/DungeonFinding/LFGMgr.h @@ -137,13 +137,13 @@ typedef std::map<uint8, LFGQueue> LfgQueueContainer; typedef std::multimap<uint32, LfgReward const*> LfgRewardContainer; typedef std::pair<LfgRewardContainer::const_iterator, LfgRewardContainer::const_iterator> LfgRewardContainerBounds; typedef std::map<uint8, LfgDungeonSet> LfgCachedDungeonContainer; -typedef std::map<uint64, LfgAnswer> LfgAnswerContainer; -typedef std::map<uint64, LfgRoleCheck> LfgRoleCheckContainer; +typedef std::map<ObjectGuid, LfgAnswer> LfgAnswerContainer; +typedef std::map<ObjectGuid, LfgRoleCheck> LfgRoleCheckContainer; typedef std::map<uint32, LfgProposal> LfgProposalContainer; -typedef std::map<uint64, LfgProposalPlayer> LfgProposalPlayerContainer; -typedef std::map<uint64, LfgPlayerBoot> LfgPlayerBootContainer; -typedef std::map<uint64, LfgGroupData> LfgGroupDataContainer; -typedef std::map<uint64, LfgPlayerData> LfgPlayerDataContainer; +typedef std::map<ObjectGuid, LfgProposalPlayer> LfgProposalPlayerContainer; +typedef std::map<ObjectGuid, LfgPlayerBoot> LfgPlayerBootContainer; +typedef std::map<ObjectGuid, LfgGroupData> LfgGroupDataContainer; +typedef std::map<ObjectGuid, LfgPlayerData> LfgPlayerDataContainer; typedef std::unordered_map<uint32, LFGDungeonData> LFGDungeonContainer; // Data needed by SMSG_LFG_JOIN_RESULT @@ -215,29 +215,29 @@ struct LfgReward /// Stores player data related to proposal to join struct LfgProposalPlayer { - LfgProposalPlayer(): role(0), accept(LFG_ANSWER_PENDING), group(0) { } + LfgProposalPlayer(): role(0), accept(LFG_ANSWER_PENDING), group() { } uint8 role; ///< Proposed role LfgAnswer accept; ///< Accept status (-1 not answer | 0 Not agree | 1 agree) - uint64 group; ///< Original group guid. 0 if no original group + ObjectGuid group; ///< Original group guid. 0 if no original group }; /// Stores group data related to proposal to join struct LfgProposal { LfgProposal(uint32 dungeon = 0): id(0), dungeonId(dungeon), state(LFG_PROPOSAL_INITIATING), - group(0), leader(0), cancelTime(0), encounters(0), isNew(true) + group(), leader(), cancelTime(0), encounters(0), isNew(true) { } uint32 id; ///< Proposal Id uint32 dungeonId; ///< Dungeon to join LfgProposalState state; ///< State of the proposal - uint64 group; ///< Proposal group (0 if new) - uint64 leader; ///< Leader guid. + ObjectGuid group; ///< Proposal group (0 if new) + ObjectGuid leader; ///< Leader guid. time_t cancelTime; ///< Time when we will cancel this proposal uint32 encounters; ///< Dungeon Encounters bool isNew; ///< Determines if it's new group or not - LfgGuidList queues; ///< Queue Ids to remove/readd - LfgGuidList showorder; ///< Show order in update window + GuidList queues; ///< Queue Ids to remove/readd + GuidList showorder; ///< Show order in update window LfgProposalPlayerContainer players; ///< Players data }; @@ -249,7 +249,7 @@ struct LfgRoleCheck LfgRoleCheckState state; ///< State of the rolecheck LfgDungeonSet dungeons; ///< Dungeons group is applying for (expanded random dungeons) uint32 rDungeonId; ///< Random Dungeon Id. - uint64 leader; ///< Leader of the group + ObjectGuid leader; ///< Leader of the group }; /// Stores information of a current vote to kick someone from a group @@ -258,7 +258,7 @@ struct LfgPlayerBoot time_t cancelTime; ///< Time left to vote bool inProgress; ///< Vote in progress LfgAnswerContainer votes; ///< Player votes (-1 not answer | 0 Not agree | 1 agree) - uint64 victim; ///< Player guid to be kicked (can't vote) + ObjectGuid victim; ///< Player guid to be kicked (can't vote) std::string reason; ///< kick reason }; @@ -307,7 +307,7 @@ class LFGMgr // World.cpp /// Finish the dungeon for the given group. All check are performed using internal lfg data - void FinishDungeon(uint64 gguid, uint32 dungeonId); + void FinishDungeon(ObjectGuid gguid, uint32 dungeonId); /// Loads rewards for random dungeons void LoadRewards(); /// Loads dungeons from dbc and adds teleport coords @@ -315,31 +315,31 @@ class LFGMgr // Multiple files /// Check if given guid applied for random dungeon - bool selectedRandomLfgDungeon(uint64 guid); + bool selectedRandomLfgDungeon(ObjectGuid guid); /// Check if given guid applied for given map and difficulty. Used to know - bool inLfgDungeonMap(uint64 guid, uint32 map, Difficulty difficulty); + bool inLfgDungeonMap(ObjectGuid guid, uint32 map, Difficulty difficulty); /// Get selected dungeons - LfgDungeonSet const& GetSelectedDungeons(uint64 guid); + LfgDungeonSet const& GetSelectedDungeons(ObjectGuid guid); /// Get current lfg state - LfgState GetState(uint64 guid); + LfgState GetState(ObjectGuid guid); /// Get current dungeon - uint32 GetDungeon(uint64 guid, bool asId = true); + uint32 GetDungeon(ObjectGuid guid, bool asId = true); /// Get the map id of the current dungeon - uint32 GetDungeonMapId(uint64 guid); + uint32 GetDungeonMapId(ObjectGuid guid); /// Get kicks left in current group - uint8 GetKicksLeft(uint64 gguid); + uint8 GetKicksLeft(ObjectGuid gguid); /// Load Lfg group info from DB - void _LoadFromDB(Field* fields, uint64 guid); + void _LoadFromDB(Field* fields, ObjectGuid guid); /// Initializes player data after loading group data from DB - void SetupGroupMember(uint64 guid, uint64 gguid); + void SetupGroupMember(ObjectGuid guid, ObjectGuid gguid); /// Return Lfg dungeon entry for given dungeon id uint32 GetLFGDungeonEntry(uint32 id); // cs_lfg /// Get current player roles - uint8 GetRoles(uint64 guid); + uint8 GetRoles(ObjectGuid guid); /// Get current player comment (used for LFR) - std::string const& GetComment(uint64 gguid); + std::string const& GetComment(ObjectGuid gguid); /// Gets current lfg options uint32 GetOptions(); /// Sets new lfg options @@ -353,27 +353,27 @@ class LFGMgr // LFGScripts /// Get leader of the group (using internal data) - uint64 GetLeader(uint64 guid); + ObjectGuid GetLeader(ObjectGuid guid); /// Sets player team - void SetTeam(uint64 guid, uint8 team); + void SetTeam(ObjectGuid guid, uint8 team); /// Sets player group - void SetGroup(uint64 guid, uint64 group); + void SetGroup(ObjectGuid guid, ObjectGuid group); /// Gets player group - uint64 GetGroup(uint64 guid); + ObjectGuid GetGroup(ObjectGuid guid); /// Sets the leader of the group - void SetLeader(uint64 gguid, uint64 leader); + void SetLeader(ObjectGuid gguid, ObjectGuid leader); /// Removes saved group data - void RemoveGroupData(uint64 guid); + void RemoveGroupData(ObjectGuid guid); /// Removes a player from a group - uint8 RemovePlayerFromGroup(uint64 gguid, uint64 guid); + uint8 RemovePlayerFromGroup(ObjectGuid gguid, ObjectGuid guid); /// Adds player to group - void AddPlayerToGroup(uint64 gguid, uint64 guid); + void AddPlayerToGroup(ObjectGuid gguid, ObjectGuid guid); // LFGHandler /// Get locked dungeons - LfgLockMap const GetLockedDungeons(uint64 guid); + LfgLockMap const GetLockedDungeons(ObjectGuid guid); /// Returns current lfg status - LfgUpdateData GetLfgStatus(uint64 guid); + LfgUpdateData GetLfgStatus(ObjectGuid guid); /// Checks if Seasonal dungeon is active bool IsSeasonActive(uint32 dungeonId); /// Gets the random dungeon reward corresponding to given dungeon and player level @@ -383,51 +383,51 @@ class LFGMgr /// Teleport a player to/from selected dungeon void TeleportPlayer(Player* player, bool out, bool fromOpcode = false); /// Inits new proposal to boot a player - void InitBoot(uint64 gguid, uint64 kguid, uint64 vguid, std::string const& reason); + void InitBoot(ObjectGuid gguid, ObjectGuid kguid, ObjectGuid vguid, std::string const& reason); /// Updates player boot proposal with new player answer - void UpdateBoot(uint64 guid, bool accept); + void UpdateBoot(ObjectGuid guid, bool accept); /// Updates proposal to join dungeon with player answer - void UpdateProposal(uint32 proposalId, uint64 guid, bool accept); + void UpdateProposal(uint32 proposalId, ObjectGuid guid, bool accept); /// Updates the role check with player answer - void UpdateRoleCheck(uint64 gguid, uint64 guid = 0, uint8 roles = PLAYER_ROLE_NONE); + void UpdateRoleCheck(ObjectGuid gguid, ObjectGuid guid = ObjectGuid::Empty, uint8 roles = PLAYER_ROLE_NONE); /// Sets player lfg roles - void SetRoles(uint64 guid, uint8 roles); + void SetRoles(ObjectGuid guid, uint8 roles); /// Sets player lfr comment - void SetComment(uint64 guid, std::string const& comment); + void SetComment(ObjectGuid guid, std::string const& comment); /// Join Lfg with selected roles, dungeons and comment void JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, std::string const& comment); /// Leaves lfg - void LeaveLfg(uint64 guid); + void LeaveLfg(ObjectGuid guid); // LfgQueue /// Get last lfg state (NONE, DUNGEON or FINISHED_DUNGEON) - LfgState GetOldState(uint64 guid); + LfgState GetOldState(ObjectGuid guid); /// Check if given group guid is lfg - bool IsLfgGroup(uint64 guid); + bool IsLfgGroup(ObjectGuid guid); /// Gets the player count of given group - uint8 GetPlayerCount(uint64 guid); + uint8 GetPlayerCount(ObjectGuid guid); /// Add a new Proposal uint32 AddProposal(LfgProposal& proposal); /// Checks if all players are queued - bool AllQueued(LfgGuidList const& check); + bool AllQueued(GuidList const& check); /// Checks if given roles match, modifies given roles map with new roles static bool CheckGroupRoles(LfgRolesMap &groles, bool removeLeaderFlag = true); /// Checks if given players are ignoring each other - static bool HasIgnore(uint64 guid1, uint64 guid2); + static bool HasIgnore(ObjectGuid guid1, ObjectGuid guid2); /// Sends queue status to player - static void SendLfgQueueStatus(uint64 guid, LfgQueueStatusData const& data); + static void SendLfgQueueStatus(ObjectGuid guid, LfgQueueStatusData const& data); private: - uint8 GetTeam(uint64 guid); - void RestoreState(uint64 guid, char const* debugMsg); - void ClearState(uint64 guid, char const* debugMsg); - void SetDungeon(uint64 guid, uint32 dungeon); - void SetSelectedDungeons(uint64 guid, LfgDungeonSet const& dungeons); - void DecreaseKicksLeft(uint64 guid); - void SetState(uint64 guid, LfgState state); - void RemovePlayerData(uint64 guid); - void GetCompatibleDungeons(LfgDungeonSet& dungeons, LfgGuidSet const& players, LfgLockPartyMap& lockMap); - void _SaveToDB(uint64 guid, uint32 db_guid); + uint8 GetTeam(ObjectGuid guid); + void RestoreState(ObjectGuid guid, char const* debugMsg); + void ClearState(ObjectGuid guid, char const* debugMsg); + void SetDungeon(ObjectGuid guid, uint32 dungeon); + void SetSelectedDungeons(ObjectGuid guid, LfgDungeonSet const& dungeons); + void DecreaseKicksLeft(ObjectGuid guid); + void SetState(ObjectGuid guid, LfgState state); + void RemovePlayerData(ObjectGuid guid); + void GetCompatibleDungeons(LfgDungeonSet& dungeons, GuidSet const& players, LfgLockPartyMap& lockMap); + void _SaveToDB(ObjectGuid guid, uint32 db_guid); LFGDungeonData const* GetLFGDungeon(uint32 id); // Proposals @@ -435,19 +435,19 @@ class LFGMgr void MakeNewGroup(LfgProposal const& proposal); // Generic - LFGQueue &GetQueue(uint64 guid); + LFGQueue &GetQueue(ObjectGuid guid); LfgDungeonSet const& GetDungeonsByRandom(uint32 randomdungeon); LfgType GetDungeonType(uint32 dungeon); - void SendLfgBootProposalUpdate(uint64 guid, LfgPlayerBoot const& boot); - void SendLfgJoinResult(uint64 guid, LfgJoinResultData const& data); - void SendLfgRoleChosen(uint64 guid, uint64 pguid, uint8 roles); - void SendLfgRoleCheckUpdate(uint64 guid, LfgRoleCheck const& roleCheck); - void SendLfgUpdateParty(uint64 guid, LfgUpdateData const& data); - void SendLfgUpdatePlayer(uint64 guid, LfgUpdateData const& data); - void SendLfgUpdateProposal(uint64 guid, LfgProposal const& proposal); + void SendLfgBootProposalUpdate(ObjectGuid guid, LfgPlayerBoot const& boot); + void SendLfgJoinResult(ObjectGuid guid, LfgJoinResultData const& data); + void SendLfgRoleChosen(ObjectGuid guid, ObjectGuid pguid, uint8 roles); + void SendLfgRoleCheckUpdate(ObjectGuid guid, LfgRoleCheck const& roleCheck); + void SendLfgUpdateParty(ObjectGuid guid, LfgUpdateData const& data); + void SendLfgUpdatePlayer(ObjectGuid guid, LfgUpdateData const& data); + void SendLfgUpdateProposal(ObjectGuid guid, LfgProposal const& proposal); - LfgGuidSet const& GetPlayers(uint64 guid); + GuidSet const& GetPlayers(ObjectGuid guid); // General variables uint32 m_QueueTimer; ///< used to check interval of update diff --git a/src/server/game/DungeonFinding/LFGPlayerData.cpp b/src/server/game/DungeonFinding/LFGPlayerData.cpp index 84b93543d7f..df9909fc4ce 100644 --- a/src/server/game/DungeonFinding/LFGPlayerData.cpp +++ b/src/server/game/DungeonFinding/LFGPlayerData.cpp @@ -21,7 +21,7 @@ namespace lfg { LfgPlayerData::LfgPlayerData(): m_State(LFG_STATE_NONE), m_OldState(LFG_STATE_NONE), - m_Team(0), m_Group(0), m_Roles(0), m_Comment("") + m_Team(0), m_Group(), m_Roles(0), m_Comment("") { } LfgPlayerData::~LfgPlayerData() { } @@ -59,7 +59,7 @@ void LfgPlayerData::SetTeam(uint8 team) m_Team = team; } -void LfgPlayerData::SetGroup(uint64 group) +void LfgPlayerData::SetGroup(ObjectGuid group) { m_Group = group; } @@ -94,7 +94,7 @@ uint8 LfgPlayerData::GetTeam() const return m_Team; } -uint64 LfgPlayerData::GetGroup() const +ObjectGuid LfgPlayerData::GetGroup() const { return m_Group; } diff --git a/src/server/game/DungeonFinding/LFGPlayerData.h b/src/server/game/DungeonFinding/LFGPlayerData.h index 996764e7620..160fd221630 100644 --- a/src/server/game/DungeonFinding/LFGPlayerData.h +++ b/src/server/game/DungeonFinding/LFGPlayerData.h @@ -36,7 +36,7 @@ class LfgPlayerData void SetState(LfgState state); void RestoreState(); void SetTeam(uint8 team); - void SetGroup(uint64 group); + void SetGroup(ObjectGuid group); // Queue void SetRoles(uint8 roles); @@ -47,7 +47,7 @@ class LfgPlayerData LfgState GetState() const; LfgState GetOldState() const; uint8 GetTeam() const; - uint64 GetGroup() const; + ObjectGuid GetGroup() const; // Queue uint8 GetRoles() const; @@ -60,7 +60,7 @@ class LfgPlayerData LfgState m_OldState; ///< Old State - Used to restore state after failed Rolecheck/Proposal // Player uint8 m_Team; ///< Player team - determines the queue to join - uint64 m_Group; ///< Original group of player when joined LFG + ObjectGuid m_Group; ///< Original group of player when joined LFG // Queue uint8 m_Roles; ///< Roles the player selected when joined LFG diff --git a/src/server/game/DungeonFinding/LFGQueue.cpp b/src/server/game/DungeonFinding/LFGQueue.cpp index 67a9f0afc69..f547aed3400 100644 --- a/src/server/game/DungeonFinding/LFGQueue.cpp +++ b/src/server/game/DungeonFinding/LFGQueue.cpp @@ -36,20 +36,20 @@ namespace lfg @param[in] check list of guids @returns Concatenated string */ -std::string ConcatenateGuids(LfgGuidList const& check) +std::string ConcatenateGuids(GuidList const& check) { if (check.empty()) return ""; // need the guids in order to avoid duplicates - LfgGuidSet guids(check.begin(), check.end()); + GuidSet guids(check.begin(), check.end()); std::ostringstream o; - LfgGuidSet::const_iterator it = guids.begin(); - o << (*it); + GuidSet::const_iterator it = guids.begin(); + o << it->GetRawValue(); for (++it; it != guids.end(); ++it) - o << '|' << (*it); + o << '|' << it->GetRawValue(); return o.str(); } @@ -83,26 +83,26 @@ char const* GetCompatibleString(LfgCompatibility compatibles) } } -void LFGQueue::AddToQueue(uint64 guid) +void LFGQueue::AddToQueue(ObjectGuid guid) { LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(guid); if (itQueue == QueueDataStore.end()) { - TC_LOG_ERROR("lfg.queue.add", "Queue data not found for [" UI64FMTD "]", guid); + TC_LOG_ERROR("lfg.queue.add", "Queue data not found for [%s]", guid.ToString().c_str()); return; } AddToNewQueue(guid); } -void LFGQueue::RemoveFromQueue(uint64 guid) +void LFGQueue::RemoveFromQueue(ObjectGuid guid) { RemoveFromNewQueue(guid); RemoveFromCurrentQueue(guid); RemoveFromCompatibles(guid); std::ostringstream o; - o << guid; + o << guid.GetRawValue(); std::string sguid = o.str(); LfgQueueDataContainer::iterator itDelete = QueueDataStore.end(); @@ -122,33 +122,33 @@ void LFGQueue::RemoveFromQueue(uint64 guid) QueueDataStore.erase(itDelete); } -void LFGQueue::AddToNewQueue(uint64 guid) +void LFGQueue::AddToNewQueue(ObjectGuid guid) { newToQueueStore.push_back(guid); } -void LFGQueue::RemoveFromNewQueue(uint64 guid) +void LFGQueue::RemoveFromNewQueue(ObjectGuid guid) { newToQueueStore.remove(guid); } -void LFGQueue::AddToCurrentQueue(uint64 guid) +void LFGQueue::AddToCurrentQueue(ObjectGuid guid) { currentQueueStore.push_back(guid); } -void LFGQueue::RemoveFromCurrentQueue(uint64 guid) +void LFGQueue::RemoveFromCurrentQueue(ObjectGuid guid) { currentQueueStore.remove(guid); } -void LFGQueue::AddQueueData(uint64 guid, time_t joinTime, LfgDungeonSet const& dungeons, LfgRolesMap const& rolesMap) +void LFGQueue::AddQueueData(ObjectGuid guid, time_t joinTime, LfgDungeonSet const& dungeons, LfgRolesMap const& rolesMap) { QueueDataStore[guid] = LfgQueueData(joinTime, dungeons, rolesMap); AddToQueue(guid); } -void LFGQueue::RemoveQueueData(uint64 guid) +void LFGQueue::RemoveQueueData(ObjectGuid guid) { LfgQueueDataContainer::iterator it = QueueDataStore.find(guid); if (it != QueueDataStore.end()) @@ -188,13 +188,13 @@ void LFGQueue::UpdateWaitTimeDps(int32 waitTime, uint32 dungeonId) @param[in] guid Guid to remove from compatible cache */ -void LFGQueue::RemoveFromCompatibles(uint64 guid) +void LFGQueue::RemoveFromCompatibles(ObjectGuid guid) { std::stringstream out; - out << guid; + out << guid.GetRawValue(); std::string strGuid = out.str(); - TC_LOG_DEBUG("lfg.queue.data.compatibles.remove", "Removing [" UI64FMTD "]", guid); + TC_LOG_DEBUG("lfg.queue.data.compatibles.remove", "Removing %s", guid.ToString().c_str()); for (LfgCompatibleContainer::iterator itNext = CompatibleMapStore.begin(); itNext != CompatibleMapStore.end();) { LfgCompatibleContainer::iterator it = itNext++; @@ -247,16 +247,18 @@ LfgCompatibilityData* LFGQueue::GetCompatibilityData(std::string const& key) uint8 LFGQueue::FindGroups() { uint8 proposals = 0; - LfgGuidList firstNew; + GuidList firstNew; while (!newToQueueStore.empty()) { - uint64 frontguid = newToQueueStore.front(); - TC_LOG_DEBUG("lfg.queue.match.check.new", "Checking [" UI64FMTD "] newToQueue(%u), currentQueue(%u)", frontguid, uint32(newToQueueStore.size()), uint32(currentQueueStore.size())); + ObjectGuid frontguid = newToQueueStore.front(); + TC_LOG_DEBUG("lfg.queue.match.check.new", "Checking [%s] newToQueue(%u), currentQueue(%u)", frontguid.ToString().c_str(), + uint32(newToQueueStore.size()), uint32(currentQueueStore.size())); + firstNew.clear(); firstNew.push_back(frontguid); RemoveFromNewQueue(frontguid); - LfgGuidList temporalList = currentQueueStore; + GuidList temporalList = currentQueueStore; LfgCompatibility compatibles = FindNewGroups(firstNew, temporalList); if (compatibles == LFG_COMPATIBLES_MATCH) @@ -274,7 +276,7 @@ uint8 LFGQueue::FindGroups() @param[in] all List of all other guids in main queue to match against @return LfgCompatibility type of compatibility between groups */ -LfgCompatibility LFGQueue::FindNewGroups(LfgGuidList& check, LfgGuidList& all) +LfgCompatibility LFGQueue::FindNewGroups(GuidList& check, GuidList& all) { std::string strGuids = ConcatenateGuids(check); LfgCompatibility compatibles = GetCompatibles(strGuids); @@ -312,7 +314,7 @@ LfgCompatibility LFGQueue::FindNewGroups(LfgGuidList& check, LfgGuidList& all) @param[in] check List of guids to check compatibilities @return LfgCompatibility type of compatibility */ -LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check) +LfgCompatibility LFGQueue::CheckCompatibility(GuidList check) { std::string strGuids = ConcatenateGuids(check); LfgProposal proposal; @@ -330,7 +332,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check) // Check all-but-new compatiblitity if (check.size() > 2) { - uint64 frontGuid = check.front(); + ObjectGuid frontGuid = check.front(); check.pop_front(); // Check all-but-new compatibilities (New, A, B, C, D) --> check(A, B, C, D) @@ -347,20 +349,20 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check) // Check if more than one LFG group and number of players joining uint8 numPlayers = 0; uint8 numLfgGroups = 0; - for (LfgGuidList::const_iterator it = check.begin(); it != check.end() && numLfgGroups < 2 && numPlayers <= MAXGROUPSIZE; ++it) + for (GuidList::const_iterator it = check.begin(); it != check.end() && numLfgGroups < 2 && numPlayers <= MAXGROUPSIZE; ++it) { - uint64 guid = (*it); + ObjectGuid guid = *it; LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(guid); if (itQueue == QueueDataStore.end()) { - TC_LOG_ERROR("lfg.queue.match.compatibility.check", "Guid: [" UI64FMTD "] is not queued but listed as queued!", guid); + TC_LOG_ERROR("lfg.queue.match.compatibility.check", "Guid: [%s] is not queued but listed as queued!", guid.ToString().c_str()); RemoveFromQueue(guid); return LFG_COMPATIBILITY_PENDING; } // Store group so we don't need to call Mgr to get it later (if it's player group will be 0 otherwise would have joined as group) for (LfgRolesMap::const_iterator it2 = itQueue->second.roles.begin(); it2 != itQueue->second.roles.end(); ++it2) - proposalGroups[it2->first] = IS_GROUP_GUID(itQueue->first) ? itQueue->first : 0; + proposalGroups[it2->first] = itQueue->first.IsGroup() ? itQueue->first : ObjectGuid::Empty; numPlayers += itQueue->second.roles.size(); @@ -404,16 +406,16 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check) // If it's single group no need to check for duplicate players, ignores, bad roles or bad dungeons as it's been checked before joining if (check.size() > 1) { - for (LfgGuidList::const_iterator it = check.begin(); it != check.end(); ++it) + for (GuidList::const_iterator it = check.begin(); it != check.end(); ++it) { - const LfgRolesMap &roles = QueueDataStore[(*it)].roles; + LfgRolesMap const& roles = QueueDataStore[(*it)].roles; for (LfgRolesMap::const_iterator itRoles = roles.begin(); itRoles != roles.end(); ++itRoles) { LfgRolesMap::const_iterator itPlayer; for (itPlayer = proposalRoles.begin(); itPlayer != proposalRoles.end(); ++itPlayer) { if (itRoles->first == itPlayer->first) - TC_LOG_ERROR("lfg.queue.match.compatibility.check", "Guids: ERROR! Player multiple times in queue! [" UI64FMTD "]", itRoles->first); + TC_LOG_ERROR("lfg.queue.match.compatibility.check", "Guids: ERROR! Player multiple times in queue! [%s]", itRoles->first.ToString().c_str()); else if (sLFGMgr->HasIgnore(itRoles->first, itPlayer->first)) break; } @@ -434,22 +436,22 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check) { std::ostringstream o; for (LfgRolesMap::const_iterator it = debugRoles.begin(); it != debugRoles.end(); ++it) - o << ", " << it->first << ": " << GetRolesString(it->second); + o << ", " << it->first.GetRawValue() << ": " << GetRolesString(it->second); TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) Roles not compatible%s", strGuids.c_str(), o.str().c_str()); SetCompatibles(strGuids, LFG_INCOMPATIBLES_NO_ROLES); return LFG_INCOMPATIBLES_NO_ROLES; } - LfgGuidList::iterator itguid = check.begin(); + GuidList::iterator itguid = check.begin(); proposalDungeons = QueueDataStore[*itguid].dungeons; std::ostringstream o; - o << ", " << *itguid << ": (" << ConcatenateDungeons(proposalDungeons) << ")"; + o << ", " << itguid->GetRawValue() << ": (" << ConcatenateDungeons(proposalDungeons) << ")"; for (++itguid; itguid != check.end(); ++itguid) { LfgDungeonSet temporal; - LfgDungeonSet &dungeons = QueueDataStore[*itguid].dungeons; - o << ", " << *itguid << ": (" << ConcatenateDungeons(dungeons) << ")"; + LfgDungeonSet& dungeons = QueueDataStore[*itguid].dungeons; + o << ", " << itguid->GetRawValue() << ": (" << ConcatenateDungeons(dungeons) << ")"; std::set_intersection(proposalDungeons.begin(), proposalDungeons.end(), dungeons.begin(), dungeons.end(), std::inserter(temporal, temporal.begin())); proposalDungeons = temporal; } @@ -463,7 +465,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check) } else { - uint64 gguid = *check.begin(); + ObjectGuid gguid = *check.begin(); const LfgQueueData &queue = QueueDataStore[gguid]; proposalDungeons = queue.dungeons; proposalRoles = queue.roles; @@ -477,14 +479,14 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check) LfgCompatibilityData data(LFG_COMPATIBLES_WITH_LESS_PLAYERS); data.roles = proposalRoles; - for (LfgGuidList::const_iterator itr = check.begin(); itr != check.end(); ++itr) + for (GuidList::const_iterator itr = check.begin(); itr != check.end(); ++itr) UpdateBestCompatibleInQueue(QueueDataStore.find(*itr), strGuids, data.roles); SetCompatibilityData(strGuids, data); return LFG_COMPATIBLES_WITH_LESS_PLAYERS; } - uint64 gguid = *check.begin(); + ObjectGuid gguid = *check.begin(); proposal.queues = check; proposal.isNew = numLfgGroups != 1 || sLFGMgr->GetOldState(gguid) != LFG_STATE_DUNGEON; @@ -498,7 +500,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check) // Create a new proposal proposal.cancelTime = time(NULL) + LFG_TIME_PROPOSAL; proposal.state = LFG_PROPOSAL_INITIATING; - proposal.leader = 0; + proposal.leader.Clear(); proposal.dungeonId = Trinity::Containers::SelectRandomContainerElement(proposalDungeons); bool leader = false; @@ -523,9 +525,9 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check) } // Mark proposal members as not queued (but not remove queue data) - for (LfgGuidList::const_iterator itQueue = proposal.queues.begin(); itQueue != proposal.queues.end(); ++itQueue) + for (GuidList::const_iterator itQueue = proposal.queues.begin(); itQueue != proposal.queues.end(); ++itQueue) { - uint64 guid = (*itQueue); + ObjectGuid guid = (*itQueue); RemoveFromNewQueue(guid); RemoveFromCurrentQueue(guid); } @@ -581,13 +583,13 @@ void LFGQueue::UpdateQueueTimers(time_t currTime) LfgQueueStatusData queueData(dungeonId, waitTime, wtAvg, wtTank, wtHealer, wtDps, queuedTime, queueinfo.tanks, queueinfo.healers, queueinfo.dps); for (LfgRolesMap::const_iterator itPlayer = queueinfo.roles.begin(); itPlayer != queueinfo.roles.end(); ++itPlayer) { - uint64 pguid = itPlayer->first; + ObjectGuid pguid = itPlayer->first; LFGMgr::SendLfgQueueStatus(pguid, queueData); } } } -time_t LFGQueue::GetJoinTime(uint64 guid) +time_t LFGQueue::GetJoinTime(ObjectGuid guid) { return QueueDataStore[guid].joinTime; } @@ -600,11 +602,11 @@ std::string LFGQueue::DumpQueueInfo() const for (uint8 i = 0; i < 2; ++i) { - LfgGuidList const& queue = i ? newToQueueStore : currentQueueStore; - for (LfgGuidList::const_iterator it = queue.begin(); it != queue.end(); ++it) + GuidList const& queue = i ? newToQueueStore : currentQueueStore; + for (GuidList::const_iterator it = queue.begin(); it != queue.end(); ++it) { - uint64 guid = *it; - if (IS_GROUP_GUID(guid)) + ObjectGuid guid = *it; + if (guid.IsGroup()) { groups++; playersInGroup += sLFGMgr->GetPlayerCount(guid); @@ -631,9 +633,9 @@ std::string LFGQueue::DumpCompatibleInfo(bool full /* = false */) const void LFGQueue::FindBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue) { - TC_LOG_DEBUG("lfg.queue.compatibles.find", "Guid: " UI64FMTD, itrQueue->first); + TC_LOG_DEBUG("lfg.queue.compatibles.find", "%s", itrQueue->first.ToString().c_str()); std::ostringstream o; - o << itrQueue->first; + o << itrQueue->first.GetRawValue(); std::string sguid = o.str(); for (LfgCompatibleContainer::const_iterator itr = CompatibleMapStore.begin(); itr != CompatibleMapStore.end(); ++itr) @@ -656,8 +658,8 @@ void LFGQueue::UpdateBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQu if (size <= storedSize) return; - TC_LOG_DEBUG("lfg.queue.compatibles.update", "Changed (%s) to (%s) as best compatible group for " UI64FMTD, - queueData.bestCompatible.c_str(), key.c_str(), itrQueue->first); + TC_LOG_DEBUG("lfg.queue.compatibles.update", "Changed (%s) to (%s) as best compatible group for %s", + queueData.bestCompatible.c_str(), key.c_str(), itrQueue->first.ToString().c_str()); queueData.bestCompatible = key; queueData.tanks = LFG_TANKS_NEEDED; diff --git a/src/server/game/DungeonFinding/LFGQueue.h b/src/server/game/DungeonFinding/LFGQueue.h index b66121802c6..5bc60478857 100644 --- a/src/server/game/DungeonFinding/LFGQueue.h +++ b/src/server/game/DungeonFinding/LFGQueue.h @@ -78,7 +78,7 @@ struct LfgWaitTime typedef std::map<uint32, LfgWaitTime> LfgWaitTimesContainer; typedef std::map<std::string, LfgCompatibilityData> LfgCompatibleContainer; -typedef std::map<uint64, LfgQueueData> LfgQueueDataContainer; +typedef std::map<ObjectGuid, LfgQueueData> LfgQueueDataContainer; /** Stores all data related to queue @@ -88,10 +88,10 @@ class LFGQueue public: // Add/Remove from queue - void AddToQueue(uint64 guid); - void RemoveFromQueue(uint64 guid); - void AddQueueData(uint64 guid, time_t joinTime, LfgDungeonSet const& dungeons, LfgRolesMap const& rolesMap); - void RemoveQueueData(uint64 guid); + void AddToQueue(ObjectGuid guid); + void RemoveFromQueue(ObjectGuid guid); + void AddQueueData(ObjectGuid guid, time_t joinTime, LfgDungeonSet const& dungeons, LfgRolesMap const& rolesMap); + void RemoveQueueData(ObjectGuid guid); // Update Timers (when proposal success) void UpdateWaitTimeAvg(int32 waitTime, uint32 dungeonId); @@ -101,7 +101,7 @@ class LFGQueue // Update Queue timers void UpdateQueueTimers(time_t currTime); - time_t GetJoinTime(uint64 guid); + time_t GetJoinTime(ObjectGuid guid); // Find new group uint8 FindGroups(); @@ -112,24 +112,23 @@ class LFGQueue private: void SetQueueUpdateData(std::string const& strGuids, LfgRolesMap const& proposalRoles); - LfgRolesMap const& RemoveFromQueueUpdateData(uint64 guid); - void AddToNewQueue(uint64 guid); - void AddToCurrentQueue(uint64 guid); - void RemoveFromNewQueue(uint64 guid); - void RemoveFromCurrentQueue(uint64 guid); + void AddToNewQueue(ObjectGuid guid); + void AddToCurrentQueue(ObjectGuid guid); + void RemoveFromNewQueue(ObjectGuid guid); + void RemoveFromCurrentQueue(ObjectGuid guid); void SetCompatibles(std::string const& key, LfgCompatibility compatibles); LfgCompatibility GetCompatibles(std::string const& key); - void RemoveFromCompatibles(uint64 guid); + void RemoveFromCompatibles(ObjectGuid guid); void SetCompatibilityData(std::string const& key, LfgCompatibilityData const& compatibles); LfgCompatibilityData* GetCompatibilityData(std::string const& key); void FindBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue); void UpdateBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue, std::string const& key, LfgRolesMap const& roles); - LfgCompatibility FindNewGroups(LfgGuidList& check, LfgGuidList& all); - LfgCompatibility CheckCompatibility(LfgGuidList check); + LfgCompatibility FindNewGroups(GuidList& check, GuidList& all); + LfgCompatibility CheckCompatibility(GuidList check); // Queue LfgQueueDataContainer QueueDataStore; ///< Queued groups @@ -139,8 +138,8 @@ class LFGQueue LfgWaitTimesContainer waitTimesTankStore; ///< Average wait time to find a group queuing as tank LfgWaitTimesContainer waitTimesHealerStore; ///< Average wait time to find a group queuing as healer LfgWaitTimesContainer waitTimesDpsStore; ///< Average wait time to find a group queuing as dps - LfgGuidList currentQueueStore; ///< Ordered list. Used to find groups - LfgGuidList newToQueueStore; ///< New groups to add to queue + GuidList currentQueueStore; ///< Ordered list. Used to find groups + GuidList newToQueueStore; ///< New groups to add to queue }; } // namespace lfg diff --git a/src/server/game/DungeonFinding/LFGScripts.cpp b/src/server/game/DungeonFinding/LFGScripts.cpp index 181e04e04fc..3a6b1eb0b71 100644 --- a/src/server/game/DungeonFinding/LFGScripts.cpp +++ b/src/server/game/DungeonFinding/LFGScripts.cpp @@ -52,16 +52,16 @@ void LFGPlayerScript::OnLogin(Player* player, bool /*loginFirst*/) return; // Temporal: Trying to determine when group data and LFG data gets desynched - uint64 guid = player->GetGUID(); - uint64 gguid = sLFGMgr->GetGroup(guid); + ObjectGuid guid = player->GetGUID(); + ObjectGuid gguid = sLFGMgr->GetGroup(guid); if (Group const* group = player->GetGroup()) { - uint64 gguid2 = group->GetGUID(); + ObjectGuid gguid2 = group->GetGUID(); if (gguid != gguid2) { TC_LOG_ERROR("lfg", "%s on group %u but LFG has group %u saved... Fixing.", - player->GetSession()->GetPlayerInfo().c_str(), GUID_LOPART(gguid2), GUID_LOPART(gguid)); + player->GetSession()->GetPlayerInfo().c_str(), gguid2.GetCounter(), gguid.GetCounter()); sLFGMgr->SetupGroupMember(guid, group->GetGUID()); } } @@ -104,24 +104,24 @@ void LFGPlayerScript::OnMapChanged(Player* player) LFGGroupScript::LFGGroupScript() : GroupScript("LFGGroupScript") { } -void LFGGroupScript::OnAddMember(Group* group, uint64 guid) +void LFGGroupScript::OnAddMember(Group* group, ObjectGuid guid) { if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER)) return; - uint64 gguid = group->GetGUID(); - uint64 leader = group->GetLeaderGUID(); + ObjectGuid gguid = group->GetGUID(); + ObjectGuid leader = group->GetLeaderGUID(); if (leader == guid) { - TC_LOG_DEBUG("lfg", "LFGScripts::OnAddMember [" UI64FMTD "]: added [" UI64FMTD "] leader " UI64FMTD "]", gguid, guid, leader); + TC_LOG_DEBUG("lfg", "LFGScripts::OnAddMember [%s]: added [%s] leader [%s]", gguid.ToString().c_str(), guid.ToString().c_str(), leader.ToString().c_str()); sLFGMgr->SetLeader(gguid, guid); } else { LfgState gstate = sLFGMgr->GetState(gguid); LfgState state = sLFGMgr->GetState(guid); - TC_LOG_DEBUG("lfg", "LFGScripts::OnAddMember [" UI64FMTD "]: added [" UI64FMTD "] leader " UI64FMTD "] gstate: %u, state: %u", gguid, guid, leader, gstate, state); + TC_LOG_DEBUG("lfg", "LFGScripts::OnAddMember [%s]: added [%s] leader [%s] gstate: %u, state: %u", gguid.ToString().c_str(), guid.ToString().c_str(), leader.ToString().c_str(), gstate, state); if (state == LFG_STATE_QUEUED) sLFGMgr->LeaveLfg(guid); @@ -134,13 +134,14 @@ void LFGGroupScript::OnAddMember(Group* group, uint64 guid) sLFGMgr->AddPlayerToGroup(gguid, guid); } -void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, char const* reason) +void LFGGroupScript::OnRemoveMember(Group* group, ObjectGuid guid, RemoveMethod method, ObjectGuid kicker, char const* reason) { if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER)) return; - uint64 gguid = group->GetGUID(); - TC_LOG_DEBUG("lfg", "LFGScripts::OnRemoveMember [" UI64FMTD "]: remove [" UI64FMTD "] Method: %d Kicker: [" UI64FMTD "] Reason: %s", gguid, guid, method, kicker, (reason ? reason : "")); + ObjectGuid gguid = group->GetGUID(); + TC_LOG_DEBUG("lfg", "LFGScripts::OnRemoveMember [%s]: remove [%s] Method: %d Kicker: [%s] Reason: %s", + gguid.ToString().c_str(), guid.ToString().c_str(), method, kicker.ToString().c_str(), (reason ? reason : "")); bool isLFG = group->isLFGGroup(); @@ -160,13 +161,13 @@ void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod meth if (state == LFG_STATE_PROPOSAL && method == GROUP_REMOVEMETHOD_DEFAULT) { // LfgData: Remove player from group - sLFGMgr->SetGroup(guid, 0); + sLFGMgr->SetGroup(guid, ObjectGuid::Empty); sLFGMgr->RemovePlayerFromGroup(gguid, guid); return; } sLFGMgr->LeaveLfg(guid); - sLFGMgr->SetGroup(guid, 0); + sLFGMgr->SetGroup(guid, ObjectGuid::Empty); uint8 players = sLFGMgr->RemovePlayerFromGroup(gguid, guid); if (Player* player = ObjectAccessor::FindPlayer(guid)) @@ -192,31 +193,35 @@ void LFGGroupScript::OnDisband(Group* group) if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER)) return; - uint64 gguid = group->GetGUID(); - TC_LOG_DEBUG("lfg", "LFGScripts::OnDisband [" UI64FMTD "]", gguid); + ObjectGuid gguid = group->GetGUID(); + TC_LOG_DEBUG("lfg", "LFGScripts::OnDisband [%s]", gguid.ToString().c_str()); sLFGMgr->RemoveGroupData(gguid); } -void LFGGroupScript::OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid) +void LFGGroupScript::OnChangeLeader(Group* group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid) { if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER)) return; - uint64 gguid = group->GetGUID(); + ObjectGuid gguid = group->GetGUID(); + + TC_LOG_DEBUG("lfg", "LFGScripts::OnChangeLeader [%s]: old [%s] new [%s]", + gguid.ToString().c_str(), newLeaderGuid.ToString().c_str(), oldLeaderGuid.ToString().c_str()); - TC_LOG_DEBUG("lfg", "LFGScripts::OnChangeLeader [" UI64FMTD "]: old [" UI64FMTD "] new [" UI64FMTD "]", gguid, newLeaderGuid, oldLeaderGuid); sLFGMgr->SetLeader(gguid, newLeaderGuid); } -void LFGGroupScript::OnInviteMember(Group* group, uint64 guid) +void LFGGroupScript::OnInviteMember(Group* group, ObjectGuid guid) { if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER)) return; - uint64 gguid = group->GetGUID(); - uint64 leader = group->GetLeaderGUID(); - TC_LOG_DEBUG("lfg", "LFGScripts::OnInviteMember [" UI64FMTD "]: invite [" UI64FMTD "] leader [" UI64FMTD "]", gguid, guid, leader); + ObjectGuid gguid = group->GetGUID(); + ObjectGuid leader = group->GetLeaderGUID(); + TC_LOG_DEBUG("lfg", "LFGScripts::OnInviteMember [%s]: invite [%s] leader [%s]", + gguid.ToString().c_str(), guid.ToString().c_str(), leader.ToString().c_str()); + // No gguid == new group being formed // No leader == after group creation first invite is new leader // leader and no gguid == first invite after leader is added to new group (this is the real invite) diff --git a/src/server/game/DungeonFinding/LFGScripts.h b/src/server/game/DungeonFinding/LFGScripts.h index 3f1dcbb218b..b4a626d5607 100644 --- a/src/server/game/DungeonFinding/LFGScripts.h +++ b/src/server/game/DungeonFinding/LFGScripts.h @@ -46,11 +46,11 @@ class LFGGroupScript : public GroupScript LFGGroupScript(); // Group Hooks - void OnAddMember(Group* group, uint64 guid) override; - void OnRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, char const* reason) override; + void OnAddMember(Group* group, ObjectGuid guid) override; + void OnRemoveMember(Group* group, ObjectGuid guid, RemoveMethod method, ObjectGuid kicker, char const* reason) override; void OnDisband(Group* group) override; - void OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid) override; - void OnInviteMember(Group* group, uint64 guid) override; + void OnChangeLeader(Group* group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid) override; + void OnInviteMember(Group* group, ObjectGuid guid) override; }; } // namespace lfg diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp index e41426edb3d..c00414e18d2 100644 --- a/src/server/game/Entities/Corpse/Corpse.cpp +++ b/src/server/game/Entities/Corpse/Corpse.cpp @@ -88,7 +88,7 @@ bool Corpse::Create(uint32 guidlow, Player* owner) WorldObject::_Create(guidlow, HIGHGUID_CORPSE, owner->GetPhaseMask()); SetObjectScale(1); - SetUInt64Value(CORPSE_FIELD_OWNER, owner->GetGUID()); + SetGuidValue(CORPSE_FIELD_OWNER, owner->GetGUID()); _gridCoord = Trinity::ComputeGridCoord(GetPositionX(), GetPositionY()); @@ -104,7 +104,7 @@ void Corpse::SaveToDB() uint16 index = 0; PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CORPSE); stmt->setUInt32(index++, GetGUIDLow()); // corpseGuid - stmt->setUInt32(index++, GUID_LOPART(GetOwnerGUID())); // guid + stmt->setUInt32(index++, GetOwnerGUID().GetCounter()); // guid stmt->setFloat (index++, GetPositionX()); // posX stmt->setFloat (index++, GetPositionY()); // posY stmt->setFloat (index++, GetPositionZ()); // posZ @@ -153,7 +153,7 @@ void Corpse::DeleteFromDB(SQLTransaction& trans) { // all corpses (not bones) stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_CORPSES); - stmt->setUInt32(0, GUID_LOPART(GetOwnerGUID())); + stmt->setUInt32(0, GetOwnerGUID().GetCounter()); } trans->Append(stmt); } @@ -179,7 +179,7 @@ bool Corpse::LoadCorpseFromDB(uint32 guid, Field* fields) SetUInt32Value(CORPSE_FIELD_GUILD, fields[9].GetUInt32()); SetUInt32Value(CORPSE_FIELD_FLAGS, fields[10].GetUInt8()); SetUInt32Value(CORPSE_FIELD_DYNAMIC_FLAGS, fields[11].GetUInt8()); - SetUInt64Value(CORPSE_FIELD_OWNER, MAKE_NEW_GUID(ownerGuid, 0, HIGHGUID_PLAYER)); + SetGuidValue(CORPSE_FIELD_OWNER, ObjectGuid(HIGHGUID_PLAYER, ownerGuid)); m_time = time_t(fields[12].GetUInt32()); @@ -194,8 +194,8 @@ bool Corpse::LoadCorpseFromDB(uint32 guid, Field* fields) if (!IsPositionValid()) { - TC_LOG_ERROR("entities.player", "Corpse (guid: %u, owner: %u) is not created, given coordinates are not valid (X: %f, Y: %f, Z: %f)", - GetGUIDLow(), GUID_LOPART(GetOwnerGUID()), posX, posY, posZ); + TC_LOG_ERROR("entities.player", "Corpse (guid: %s, owner: %s) is not created, given coordinates are not valid (X: %f, Y: %f, Z: %f)", + GetGUID().ToString().c_str(), GetOwnerGUID().ToString().c_str(), posX, posY, posZ); return false; } diff --git a/src/server/game/Entities/Corpse/Corpse.h b/src/server/game/Entities/Corpse/Corpse.h index 5039c85bcb9..4b2e9321a73 100644 --- a/src/server/game/Entities/Corpse/Corpse.h +++ b/src/server/game/Entities/Corpse/Corpse.h @@ -64,7 +64,7 @@ class Corpse : public WorldObject, public GridObject<Corpse> void DeleteBonesFromWorld(); void DeleteFromDB(SQLTransaction& trans); - uint64 GetOwnerGUID() const { return GetUInt64Value(CORPSE_FIELD_OWNER); } + ObjectGuid GetOwnerGUID() const { return GetGuidValue(CORPSE_FIELD_OWNER); } time_t const& GetGhostTime() const { return m_time; } void ResetGhostTime() { m_time = time(NULL); } diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index fa1f866120c..8b338351ab4 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -143,7 +143,7 @@ bool ForcedDespawnDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) Creature::Creature(bool isWorldObject): Unit(isWorldObject), MapObject(), m_groupLootTimer(0), lootingGroupLowGUID(0), m_PlayerDamageReq(0), -m_lootRecipient(0), m_lootRecipientGroup(0), _skinner(0), _pickpocketLootRestore(0), m_corpseRemoveTime(0), m_respawnTime(0), +m_lootRecipient(), m_lootRecipientGroup(0), _skinner(), _pickpocketLootRestore(0), m_corpseRemoveTime(0), m_respawnTime(0), m_respawnDelay(300), m_corpseDelay(60), m_respawnradius(0.0f), m_reactState(REACT_AGGRESSIVE), m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(0), m_originalEquipmentId(0), m_AlreadyCallAssistance(false), m_AlreadySearchedAssistance(false), m_regenHealth(true), m_AI_locked(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL), @@ -470,17 +470,17 @@ void Creature::Update(uint32 diff) if (!allowed) // Will be rechecked on next Update call break; - uint64 dbtableHighGuid = MAKE_NEW_GUID(m_DBTableGuid, GetEntry(), HIGHGUID_UNIT); + ObjectGuid dbtableHighGuid(HIGHGUID_UNIT, GetEntry(), m_DBTableGuid); time_t linkedRespawntime = GetMap()->GetLinkedRespawnTime(dbtableHighGuid); if (!linkedRespawntime) // Can respawn Respawn(); else // the master is dead { - uint64 targetGuid = sObjectMgr->GetLinkedRespawnGuid(dbtableHighGuid); + ObjectGuid targetGuid = sObjectMgr->GetLinkedRespawnGuid(dbtableHighGuid); if (targetGuid == dbtableHighGuid) // if linking self, never respawn (check delayed to next day) SetRespawnTime(DAY); else - m_respawnTime = (now > linkedRespawntime ? now : linkedRespawntime)+urand(5, MINUTE); // else copy time from master and add a little + m_respawnTime = (now > linkedRespawntime ? now : linkedRespawntime) + urand(5, MINUTE); // else copy time from master and add a little SaveRespawnTime(); // also save to DB immediately } } @@ -531,7 +531,7 @@ void Creature::Update(uint32 diff) if (Unit* charmer = ObjectAccessor::GetUnit(*this, LastCharmerGUID)) i_AI->AttackStart(charmer); - LastCharmerGUID = 0; + LastCharmerGUID.Clear(); } if (!IsInEvadeMode() && IsAIEnabled) @@ -889,7 +889,7 @@ void Creature::SetLootRecipient(Unit* unit) if (!unit) { - m_lootRecipient = 0; + m_lootRecipient.Clear(); m_lootRecipientGroup = 0; RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE|UNIT_DYNFLAG_TAPPED); return; @@ -1211,7 +1211,7 @@ bool Creature::LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap) m_DBTableGuid = guid; if (map->GetInstanceId() == 0) { - if (map->GetCreature(MAKE_NEW_GUID(guid, data->id, HIGHGUID_UNIT))) + if (map->GetCreature(ObjectGuid(HIGHGUID_UNIT, data->id, guid))) return false; } else @@ -1461,7 +1461,7 @@ void Creature::setDeathState(DeathState s) if (sWorld->getBoolConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY) || isWorldBoss()) SaveRespawnTime(); - SetTarget(0); // remove target selection in any cases (can be set at aura remove in Unit::setDeathState) + SetTarget(ObjectGuid::Empty); // remove target selection in any cases (can be set at aura remove in Unit::setDeathState) SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); setActive(false); @@ -1522,8 +1522,8 @@ void Creature::Respawn(bool force) if (m_DBTableGuid) GetMap()->RemoveCreatureRespawnTime(m_DBTableGuid); - TC_LOG_DEBUG("entities.unit", "Respawning creature %s (GuidLow: %u, Full GUID: " UI64FMTD " Entry: %u)", - GetName().c_str(), GetGUIDLow(), GetGUID(), GetEntry()); + TC_LOG_DEBUG("entities.unit", "Respawning creature %s (%s)", + GetName().c_str(), GetGUID().ToString().c_str()); m_respawnTime = 0; ResetPickPocketRefillTimer(); loot.clear(); @@ -2454,7 +2454,7 @@ bool Creature::SetWalk(bool enable) return false; WorldPacket data(enable ? SMSG_SPLINE_MOVE_SET_WALK_MODE : SMSG_SPLINE_MOVE_SET_RUN_MODE, 9); - data.append(GetPackGUID()); + data << GetPackGUID(); SendMessageToSet(&data, false); return true; } @@ -2470,7 +2470,7 @@ bool Creature::SetDisableGravity(bool disable, bool packetOnly/*=false*/) return true; WorldPacket data(disable ? SMSG_SPLINE_MOVE_GRAVITY_DISABLE : SMSG_SPLINE_MOVE_GRAVITY_ENABLE, 9); - data.append(GetPackGUID()); + data << GetPackGUID(); SendMessageToSet(&data, false); return true; } @@ -2484,7 +2484,7 @@ bool Creature::SetSwim(bool enable) return true; WorldPacket data(enable ? SMSG_SPLINE_MOVE_START_SWIM : SMSG_SPLINE_MOVE_STOP_SWIM); - data.append(GetPackGUID()); + data << GetPackGUID(); SendMessageToSet(&data, true); return true; } @@ -2498,7 +2498,7 @@ bool Creature::SetCanFly(bool enable) return true; WorldPacket data(enable ? SMSG_SPLINE_MOVE_SET_FLYING : SMSG_SPLINE_MOVE_UNSET_FLYING, 9); - data.append(GetPackGUID()); + data << GetPackGUID(); SendMessageToSet(&data, false); return true; } @@ -2512,7 +2512,7 @@ bool Creature::SetWaterWalking(bool enable, bool packetOnly /* = false */) return true; WorldPacket data(enable ? SMSG_SPLINE_MOVE_WATER_WALK : SMSG_SPLINE_MOVE_LAND_WALK); - data.append(GetPackGUID()); + data << GetPackGUID(); SendMessageToSet(&data, true); return true; } @@ -2526,7 +2526,7 @@ bool Creature::SetFeatherFall(bool enable, bool packetOnly /* = false */) return true; WorldPacket data(enable ? SMSG_SPLINE_MOVE_FEATHER_FALL : SMSG_SPLINE_MOVE_NORMAL_FALL); - data.append(GetPackGUID()); + data << GetPackGUID(); SendMessageToSet(&data, true); return true; } @@ -2547,7 +2547,7 @@ bool Creature::SetHover(bool enable, bool packetOnly /*= false*/) //! Not always a packet is sent WorldPacket data(enable ? SMSG_SPLINE_MOVE_SET_HOVER : SMSG_SPLINE_MOVE_UNSET_HOVER, 9); - data.append(GetPackGUID()); + data << GetPackGUID(); SendMessageToSet(&data, false); return true; } @@ -2670,10 +2670,10 @@ void Creature::SetDisplayId(uint32 modelId) } } -void Creature::SetTarget(uint64 guid) +void Creature::SetTarget(ObjectGuid guid) { if (!_focusSpell) - SetUInt64Value(UNIT_FIELD_TARGET, guid); + SetGuidValue(UNIT_FIELD_TARGET, guid); } void Creature::FocusTarget(Spell const* focusSpell, WorldObject const* target) @@ -2683,7 +2683,7 @@ void Creature::FocusTarget(Spell const* focusSpell, WorldObject const* target) return; _focusSpell = focusSpell; - SetUInt64Value(UNIT_FIELD_TARGET, target->GetGUID()); + SetGuidValue(UNIT_FIELD_TARGET, target->GetGUID()); if (focusSpell->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_DONT_TURN_DURING_CAST) AddUnitState(UNIT_STATE_ROTATING); @@ -2699,9 +2699,9 @@ void Creature::ReleaseFocus(Spell const* focusSpell) _focusSpell = NULL; if (Unit* victim = GetVictim()) - SetUInt64Value(UNIT_FIELD_TARGET, victim->GetGUID()); + SetGuidValue(UNIT_FIELD_TARGET, victim->GetGUID()); else - SetUInt64Value(UNIT_FIELD_TARGET, 0); + SetGuidValue(UNIT_FIELD_TARGET, ObjectGuid::Empty); if (focusSpell->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_DONT_TURN_DURING_CAST) ClearUnitState(UNIT_STATE_ROTATING); diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 9be71be1eed..4cebe5b03b3 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -554,11 +554,11 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject void StartPickPocketRefillTimer(); void ResetPickPocketRefillTimer() { _pickpocketLootRestore = 0; } bool CanGeneratePickPocketLoot() const { return _pickpocketLootRestore <= time(NULL); } - void SetSkinner(uint64 guid) { _skinner = guid; } - uint64 GetSkinner() const { return _skinner; } // Returns the player who skinned this creature + void SetSkinner(ObjectGuid guid) { _skinner = guid; } + ObjectGuid GetSkinner() const { return _skinner; } // Returns the player who skinned this creature Player* GetLootRecipient() const; Group* GetLootRecipientGroup() const; - bool hasLootRecipient() const { return m_lootRecipient || m_lootRecipientGroup; } + bool hasLootRecipient() const { return !m_lootRecipient.IsEmpty() || m_lootRecipientGroup; } bool isTappedBy(Player const* player) const; // return true if the creature is tapped by the player or a member of his party. void SetLootRecipient (Unit* unit); @@ -676,7 +676,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject bool m_isTempWorldObject; //true when possessed // Handling caster facing during spellcast - void SetTarget(uint64 guid) override; + void SetTarget(ObjectGuid guid) override; void FocusTarget(Spell const* focusSpell, WorldObject const* target); void ReleaseFocus(Spell const* focusSpell); @@ -689,9 +689,9 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject static float _GetHealthMod(int32 Rank); - uint64 m_lootRecipient; + ObjectGuid m_lootRecipient; uint32 m_lootRecipientGroup; - uint64 _skinner; + ObjectGuid _skinner; /// Timers time_t _pickpocketLootRestore; @@ -748,15 +748,15 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject class AssistDelayEvent : public BasicEvent { public: - AssistDelayEvent(uint64 victim, Unit& owner) : BasicEvent(), m_victim(victim), m_owner(owner) { } + AssistDelayEvent(ObjectGuid victim, Unit& owner) : BasicEvent(), m_victim(victim), m_owner(owner) { } bool Execute(uint64 e_time, uint32 p_time) override; - void AddAssistant(uint64 guid) { m_assistants.push_back(guid); } + void AddAssistant(ObjectGuid guid) { m_assistants.push_back(guid); } private: AssistDelayEvent(); - uint64 m_victim; - std::list<uint64> m_assistants; + ObjectGuid m_victim; + GuidList m_assistants; Unit& m_owner; }; diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp index 492d82c5a03..044c853c08b 100644 --- a/src/server/game/Entities/Creature/GossipDef.cpp +++ b/src/server/game/Entities/Creature/GossipDef.cpp @@ -28,7 +28,7 @@ GossipMenu::GossipMenu() { _menuId = 0; _locale = DEFAULT_LOCALE; - _senderGUID = 0; + _senderGUID.Clear(); } GossipMenu::~GossipMenu() @@ -188,7 +188,7 @@ void PlayerMenu::ClearMenus() _questMenu.ClearMenu(); } -void PlayerMenu::SendGossipMenu(uint32 titleTextId, uint64 objectGUID) +void PlayerMenu::SendGossipMenu(uint32 titleTextId, ObjectGuid objectGUID) { _gossipMenu.SetSenderGUID(objectGUID); @@ -248,7 +248,7 @@ void PlayerMenu::SendGossipMenu(uint32 titleTextId, uint64 objectGUID) void PlayerMenu::SendCloseGossip() { - _gossipMenu.SetSenderGUID(0); + _gossipMenu.SetSenderGUID(ObjectGuid::Empty); WorldPacket data(SMSG_GOSSIP_COMPLETE, 0); _session->SendPacket(&data); @@ -323,7 +323,7 @@ void QuestMenu::ClearMenu() _questMenuItems.clear(); } -void PlayerMenu::SendQuestGiverQuestList(QEmote const& eEmote, const std::string& Title, uint64 npcGUID) +void PlayerMenu::SendQuestGiverQuestList(QEmote const& eEmote, const std::string& Title, ObjectGuid npcGUID) { WorldPacket data(SMSG_QUESTGIVER_QUEST_LIST, 100); // guess size data << uint64(npcGUID); @@ -368,20 +368,20 @@ void PlayerMenu::SendQuestGiverQuestList(QEmote const& eEmote, const std::string data.put<uint8>(count_pos, count); _session->SendPacket(&data); - TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_LIST NPC Guid=%u", GUID_LOPART(npcGUID)); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_LIST NPC=%s", npcGUID.ToString().c_str()); } -void PlayerMenu::SendQuestGiverStatus(uint8 questStatus, uint64 npcGUID) const +void PlayerMenu::SendQuestGiverStatus(uint8 questStatus, ObjectGuid npcGUID) const { WorldPacket data(SMSG_QUESTGIVER_STATUS, 9); data << uint64(npcGUID); data << uint8(questStatus); _session->SendPacket(&data); - TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_STATUS NPC Guid=%u, status=%u", GUID_LOPART(npcGUID), questStatus); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_STATUS NPC=%s, status=%u", npcGUID.ToString().c_str(), questStatus); } -void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID, bool activateAccept) const +void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGUID, bool activateAccept) const { std::string questTitle = quest->GetTitle(); std::string questDetails = quest->GetDetails(); @@ -486,7 +486,7 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID, } _session->SendPacket(&data); - TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId()); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS NPC=%s, questid=%u", npcGUID.ToString().c_str(), quest->GetQuestId()); } void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const @@ -626,7 +626,7 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUEST_QUERY_RESPONSE questid=%u", quest->GetQuestId()); } -void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, bool enableNext) const +void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, ObjectGuid npcGUID, bool enableNext) const { std::string questTitle = quest->GetTitle(); std::string questOfferRewardText = quest->GetOfferRewardText(); @@ -717,10 +717,10 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, b data << uint32(quest->RewardFactionValueIdOverride[i]); _session->SendPacket(&data); - TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_OFFER_REWARD NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId()); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_OFFER_REWARD NPC=%s, questid=%u", npcGUID.ToString().c_str(), quest->GetQuestId()); } -void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID, bool canComplete, bool closeOnCancel) const +void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, ObjectGuid npcGUID, bool canComplete, bool closeOnCancel) const { // We can always call to RequestItems, but this packet only goes out if there are actually // items. Otherwise, we'll skip straight to the OfferReward @@ -794,7 +794,7 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID, data << uint32(0x10); _session->SendPacket(&data); - TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_REQUEST_ITEMS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId()); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_REQUEST_ITEMS NPC=%s, questid=%u", npcGUID.ToString().c_str(), quest->GetQuestId()); } void PlayerMenu::AddQuestLevelToTitle(std::string &title, int32 level) diff --git a/src/server/game/Entities/Creature/GossipDef.h b/src/server/game/Entities/Creature/GossipDef.h index e8fac878409..81fa5bc8203 100644 --- a/src/server/game/Entities/Creature/GossipDef.h +++ b/src/server/game/Entities/Creature/GossipDef.h @@ -20,6 +20,7 @@ #define TRINITYCORE_GOSSIP_H #include "Common.h" +#include "ObjectGuid.h" #include "QuestDef.h" #include "NPCHandler.h" @@ -167,8 +168,8 @@ class GossipMenu void SetMenuId(uint32 menu_id) { _menuId = menu_id; } uint32 GetMenuId() const { return _menuId; } - void SetSenderGUID(uint64 guid) { _senderGUID = guid; } - uint64 GetSenderGUID() const { return _senderGUID; } + void SetSenderGUID(ObjectGuid guid) { _senderGUID = guid; } + ObjectGuid GetSenderGUID() const { return _senderGUID; } void SetLocale(LocaleConstant locale) { _locale = locale; } LocaleConstant GetLocale() const { return _locale; } @@ -217,7 +218,7 @@ class GossipMenu GossipMenuItemContainer _menuItems; GossipMenuItemDataContainer _menuItemData; uint32 _menuId; - uint64 _senderGUID; + ObjectGuid _senderGUID; LocaleConstant _locale; }; @@ -267,22 +268,22 @@ class PlayerMenu uint32 GetGossipOptionAction(uint32 selection) const { return _gossipMenu.GetMenuItemAction(selection); } bool IsGossipOptionCoded(uint32 selection) const { return _gossipMenu.IsMenuItemCoded(selection); } - void SendGossipMenu(uint32 titleTextId, uint64 objectGUID); + void SendGossipMenu(uint32 titleTextId, ObjectGuid objectGUID); void SendCloseGossip(); void SendPointOfInterest(uint32 poiId) const; /*********************************************************/ /*** QUEST SYSTEM ***/ /*********************************************************/ - void SendQuestGiverStatus(uint8 questStatus, uint64 npcGUID) const; + void SendQuestGiverStatus(uint8 questStatus, ObjectGuid npcGUID) const; - void SendQuestGiverQuestList(QEmote const& eEmote, const std::string& Title, uint64 npcGUID); + void SendQuestGiverQuestList(QEmote const& eEmote, const std::string& Title, ObjectGuid npcGUID); void SendQuestQueryResponse(Quest const* quest) const; - void SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID, bool activateAccept) const; + void SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGUID, bool activateAccept) const; - void SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, bool enableNext) const; - void SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID, bool canComplete, bool closeOnCancel) const; + void SendQuestGiverOfferReward(Quest const* quest, ObjectGuid npcGUID, bool enableNext) const; + void SendQuestGiverRequestItems(Quest const* quest, ObjectGuid npcGUID, bool canComplete, bool closeOnCancel) const; static void AddQuestLevelToTitle(std::string &title, int32 level); diff --git a/src/server/game/Entities/Creature/TemporarySummon.cpp b/src/server/game/Entities/Creature/TemporarySummon.cpp index d31117c8381..31d4de2009b 100644 --- a/src/server/game/Entities/Creature/TemporarySummon.cpp +++ b/src/server/game/Entities/Creature/TemporarySummon.cpp @@ -28,7 +28,9 @@ TempSummon::TempSummon(SummonPropertiesEntry const* properties, Unit* owner, boo Creature(isWorldObject), m_Properties(properties), m_type(TEMPSUMMON_MANUAL_DESPAWN), m_timer(0), m_lifetime(0) { - m_summonerGUID = owner ? owner->GetGUID() : 0; + if (owner) + m_summonerGUID = owner->GetGUID(); + m_unitTypeMask |= UNIT_MASK_SUMMON; } @@ -271,7 +273,7 @@ void TempSummon::RemoveFromWorld() if (uint32 slot = m_Properties->Slot) if (Unit* owner = GetSummoner()) if (owner->m_SummonSlot[slot] == GetGUID()) - owner->m_SummonSlot[slot] = 0; + owner->m_SummonSlot[slot].Clear(); //if (GetOwnerGUID()) // TC_LOG_ERROR("entities.unit", "Unit %u has owner guid when removed from world", GetEntry()); diff --git a/src/server/game/Entities/Creature/TemporarySummon.h b/src/server/game/Entities/Creature/TemporarySummon.h index 58cc6eb7d0b..4780749899e 100644 --- a/src/server/game/Entities/Creature/TemporarySummon.h +++ b/src/server/game/Entities/Creature/TemporarySummon.h @@ -51,7 +51,7 @@ class TempSummon : public Creature void SaveToDB(uint32 /*mapid*/, uint8 /*spawnMask*/, uint32 /*phaseMask*/) override { } Unit* GetSummoner() const; Creature* GetSummonerCreatureBase() const; - uint64 GetSummonerGUID() const { return m_summonerGUID; } + ObjectGuid GetSummonerGUID() const { return m_summonerGUID; } TempSummonType const& GetSummonType() { return m_type; } uint32 GetTimer() { return m_timer; } @@ -60,7 +60,7 @@ class TempSummon : public Creature TempSummonType m_type; uint32 m_timer; uint32 m_lifetime; - uint64 m_summonerGUID; + ObjectGuid m_summonerGUID; }; class Minion : public TempSummon diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.cpp b/src/server/game/Entities/DynamicObject/DynamicObject.cpp index e008146bb85..a8ddac8f6f3 100644 --- a/src/server/game/Entities/DynamicObject/DynamicObject.cpp +++ b/src/server/game/Entities/DynamicObject/DynamicObject.cpp @@ -94,7 +94,7 @@ bool DynamicObject::CreateDynamicObject(uint32 guidlow, Unit* caster, uint32 spe SetEntry(spellId); SetObjectScale(1); - SetUInt64Value(DYNAMICOBJECT_CASTER, caster->GetGUID()); + SetGuidValue(DYNAMICOBJECT_CASTER, caster->GetGUID()); // The lower word of DYNAMICOBJECT_BYTES must be 0x0001. This value means that the visual radius will be overriden // by client for most of the "ground patch" visual effect spells and a few "skyfall" ones like Hurricane. diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.h b/src/server/game/Entities/DynamicObject/DynamicObject.h index 7816600b7a4..5485885c7e2 100644 --- a/src/server/game/Entities/DynamicObject/DynamicObject.h +++ b/src/server/game/Entities/DynamicObject/DynamicObject.h @@ -55,7 +55,7 @@ class DynamicObject : public WorldObject, public GridObject<DynamicObject>, publ void BindToCaster(); void UnbindFromCaster(); uint32 GetSpellId() const { return GetUInt32Value(DYNAMICOBJECT_SPELLID); } - uint64 GetCasterGUID() const { return GetUInt64Value(DYNAMICOBJECT_CASTER); } + ObjectGuid GetCasterGUID() const { return GetGuidValue(DYNAMICOBJECT_CASTER); } float GetRadius() const { return GetFloatValue(DYNAMICOBJECT_RADIUS); } protected: diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index f45d3a071e1..3ebe2bfe429 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -47,19 +47,16 @@ GameObject::GameObject() : WorldObject(false), MapObject(), m_respawnTime = 0; m_respawnDelayTime = 300; m_lootState = GO_NOT_READY; - m_lootStateUnitGUID = 0; m_spawnedByDefault = true; m_usetimes = 0; m_spellId = 0; m_cooldownTime = 0; m_goInfo = NULL; - m_ritualOwnerGUID = 0; m_goData = NULL; m_DBTableGuid = 0; m_rotation = 0; - m_lootRecipient = 0; m_lootRecipientGroup = 0; m_groupLootTimer = 0; lootingGroupLowGUID = 0; @@ -108,7 +105,7 @@ void GameObject::CleanupsBeforeDelete(bool finalCleanup) void GameObject::RemoveFromOwner() { - uint64 ownerGUID = GetOwnerGUID(); + ObjectGuid ownerGUID = GetOwnerGUID(); if (!ownerGUID) return; @@ -119,15 +116,9 @@ void GameObject::RemoveFromOwner() return; } - const char * ownerType = "creature"; - if (IS_PLAYER_GUID(ownerGUID)) - ownerType = "player"; - else if (IS_PET_GUID(ownerGUID)) - ownerType = "pet"; - - TC_LOG_FATAL("misc", "Removed GameObject (GUID: %u Entry: %u SpellId: %u LinkedGO: %u) that just lost any reference to the owner (GUID: %u Type: '%s') GO list", - GetGUIDLow(), GetGOInfo()->entry, m_spellId, GetGOInfo()->GetLinkedGameObjectEntry(), GUID_LOPART(ownerGUID), ownerType); - SetOwnerGUID(0); + TC_LOG_FATAL("misc", "Removed GameObject (GUID: %u Entry: %u SpellId: %u LinkedGO: %u) that just lost any reference to the owner (%s) GO list", + GetGUIDLow(), GetGOInfo()->entry, m_spellId, GetGOInfo()->GetLinkedGameObjectEntry(), ownerGUID.ToString().c_str()); + SetOwnerGUID(ObjectGuid::Empty); } void GameObject::AddToWorld() @@ -385,11 +376,11 @@ void GameObject::Update(uint32 diff) time_t now = time(NULL); if (m_respawnTime <= now) // timer expired { - uint64 dbtableHighGuid = MAKE_NEW_GUID(m_DBTableGuid, GetEntry(), HIGHGUID_GAMEOBJECT); + ObjectGuid dbtableHighGuid(HIGHGUID_GAMEOBJECT, GetEntry(), m_DBTableGuid); time_t linkedRespawntime = GetMap()->GetLinkedRespawnTime(dbtableHighGuid); if (linkedRespawntime) // Can't respawn, the master is dead { - uint64 targetGuid = sObjectMgr->GetLinkedRespawnGuid(dbtableHighGuid); + ObjectGuid targetGuid = sObjectMgr->GetLinkedRespawnGuid(dbtableHighGuid); if (targetGuid == dbtableHighGuid) // if linking self, never respawn (check delayed to next day) SetRespawnTime(DAY); else @@ -594,7 +585,7 @@ void GameObject::Update(uint32 diff) if (spellId) { - for (std::set<uint64>::const_iterator it = m_unique_users.begin(); it != m_unique_users.end(); ++it) + for (GuidSet::const_iterator it = m_unique_users.begin(); it != m_unique_users.end(); ++it) // m_unique_users can contain only player GUIDs if (Player* owner = ObjectAccessor::GetPlayer(*this, *it)) owner->CastSpell(owner, spellId, false); @@ -981,14 +972,15 @@ bool GameObject::IsAlwaysVisibleFor(WorldObject const* seer) const return false; // Always seen by owner and friendly units - if (uint64 guid = GetOwnerGUID()) + if (ObjectGuid guid = GetOwnerGUID()) { if (seer->GetGUID() == guid) return true; Unit* owner = GetOwner(); - if (owner && seer->isType(TYPEMASK_UNIT) && owner->IsFriendlyTo(((Unit*)seer))) - return true; + if (Unit const* unitSeer = seer->ToUnit()) + if (owner && owner->IsFriendlyTo(unitSeer)) + return true; } return false; @@ -1239,9 +1231,9 @@ void GameObject::Use(Unit* user) { if (info->chair.slots > 0) // sometimes chairs in DB have error in fields and we dont know number of slots for (uint32 i = 0; i < info->chair.slots; ++i) - ChairListSlots[i] = 0; // Last user of current slot set to 0 (none sit here yet) + ChairListSlots[i].Clear(); // Last user of current slot set to 0 (none sit here yet) else - ChairListSlots[0] = 0; // error in DB, make one default slot + ChairListSlots[0].Clear(); // error in DB, make one default slot } Player* player = user->ToPlayer(); @@ -1274,10 +1266,10 @@ void GameObject::Use(Unit* user) if (ChairUser->IsSitState() && ChairUser->getStandState() != UNIT_STAND_STATE_SIT && ChairUser->GetExactDist2d(x_i, y_i) < 0.1f) continue; // This seat is already occupied by ChairUser. NOTE: Not sure if the ChairUser->getStandState() != UNIT_STAND_STATE_SIT check is required. else - itr->second = 0; // This seat is unoccupied. + itr->second.Clear(); // This seat is unoccupied. } else - itr->second = 0; // The seat may of had an occupant, but they're offline. + itr->second.Clear(); // The seat may of had an occupant, but they're offline. } found_free_slot = true; @@ -1557,7 +1549,7 @@ void GameObject::Use(Unit* user) else { // reset ritual for this GO - m_ritualOwnerGUID = 0; + m_ritualOwnerGUID.Clear(); m_unique_users.clear(); m_usetimes = 0; } @@ -1798,7 +1790,7 @@ void GameObject::CastSpell(Unit* target, uint32 spellId, bool triggered /*= true trigger->setFaction(14); // Set owner guid for target if no owner available - needed by trigger auras // - trigger gets despawned and there's no caster avalible (see AuraEffect::TriggerSpell()) - trigger->CastSpell(target ? target : trigger, spellInfo, triggered, nullptr, nullptr, target ? target->GetGUID() : 0); + trigger->CastSpell(target ? target : trigger, spellInfo, triggered, nullptr, nullptr, target ? target->GetGUID() : ObjectGuid::Empty); } } @@ -1921,9 +1913,9 @@ void GameObject::ModifyHealth(int32 change, Unit* attackerOrHealer /*= NULL*/, u if (player) { WorldPacket data(SMSG_DESTRUCTIBLE_BUILDING_DAMAGE, 8 + 8 + 8 + 4 + 4); - data.appendPackGUID(GetGUID()); - data.appendPackGUID(attackerOrHealer->GetGUID()); - data.appendPackGUID(player->GetGUID()); + data << GetPackGUID(); + data << attackerOrHealer->GetPackGUID(); + data << player->GetPackGUID(); data << uint32(-change); // change < 0 triggers SPELL_BUILDING_HEAL combat log event // change >= 0 triggers SPELL_BUILDING_DAMAGE event data << uint32(spellId); @@ -2039,7 +2031,11 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player* void GameObject::SetLootState(LootState state, Unit* unit) { m_lootState = state; - m_lootStateUnitGUID = unit ? unit->GetGUID() : 0; + if (unit) + m_lootStateUnitGUID = unit->GetGUID(); + else + m_lootStateUnitGUID.Clear(); + AI()->OnStateChanged(state, unit); sScriptMgr->OnGameObjectLootStateChanged(this, state, unit); @@ -2134,7 +2130,7 @@ void GameObject::SetLootRecipient(Unit* unit) if (!unit) { - m_lootRecipient = 0; + m_lootRecipient.Clear(); m_lootRecipientGroup = 0; return; } diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index 6807fbf9387..09baae707ca 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -664,7 +664,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map bool LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap = true); void DeleteFromDB(); - void SetOwnerGUID(uint64 owner) + void SetOwnerGUID(ObjectGuid owner) { // Owner already found and different than expected owner - remove object from old owner if (owner && GetOwnerGUID() && GetOwnerGUID() != owner) @@ -672,9 +672,9 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map ASSERT(false); } m_spawnedByDefault = false; // all object with owner is despawned after delay - SetUInt64Value(OBJECT_FIELD_CREATED_BY, owner); + SetGuidValue(OBJECT_FIELD_CREATED_BY, owner); } - uint64 GetOwnerGUID() const { return GetUInt64Value(OBJECT_FIELD_CREATED_BY); } + ObjectGuid GetOwnerGUID() const { return GetGuidValue(OBJECT_FIELD_CREATED_BY); } Unit* GetOwner() const; void SetSpellId(uint32 id) @@ -764,7 +764,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map Group* GetLootRecipientGroup() const; void SetLootRecipient(Unit* unit); bool IsLootAllowedFor(Player const* player) const; - bool HasLootRecipient() const { return m_lootRecipient || m_lootRecipientGroup; } + bool HasLootRecipient() const { return !m_lootRecipient.IsEmpty() || m_lootRecipientGroup; } uint32 m_groupLootTimer; // (msecs)timer used for group loot uint32 lootingGroupLowGUID; // used to find group which is looting @@ -843,17 +843,17 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map time_t m_respawnTime; // (secs) time of next respawn (or despawn if GO have owner()), uint32 m_respawnDelayTime; // (secs) if 0 then current GO state no dependent from timer LootState m_lootState; - uint64 m_lootStateUnitGUID; // GUID of the unit passed with SetLootState(LootState, Unit*) + ObjectGuid m_lootStateUnitGUID; // GUID of the unit passed with SetLootState(LootState, Unit*) bool m_spawnedByDefault; time_t m_cooldownTime; // used as internal reaction delay time store (not state change reaction). // For traps this: spell casting cooldown, for doors/buttons: reset time. std::list<uint32> m_SkillupList; - uint64 m_ritualOwnerGUID; // used for GAMEOBJECT_TYPE_SUMMONING_RITUAL where GO is not summoned (no owner) - std::set<uint64> m_unique_users; + ObjectGuid m_ritualOwnerGUID; // used for GAMEOBJECT_TYPE_SUMMONING_RITUAL where GO is not summoned (no owner) + GuidSet m_unique_users; uint32 m_usetimes; - typedef std::map<uint32, uint64> ChairSlotAndUser; + typedef std::map<uint32, ObjectGuid> ChairSlotAndUser; ChairSlotAndUser ChairListSlots; uint32 m_DBTableGuid; ///< For new or temporary gameobjects is 0 for saved it is lowguid @@ -864,7 +864,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map uint64 m_rotation; Position m_stationaryPosition; - uint64 m_lootRecipient; + ObjectGuid m_lootRecipient; uint32 m_lootRecipientGroup; uint16 m_LootMode; // bitmask, default LOOT_MODE_DEFAULT, determines what loot will be lootable private: diff --git a/src/server/game/Entities/Item/Container/Bag.cpp b/src/server/game/Entities/Item/Container/Bag.cpp index 39f2c59fc29..3595f6fd9f6 100644 --- a/src/server/game/Entities/Item/Container/Bag.cpp +++ b/src/server/game/Entities/Item/Container/Bag.cpp @@ -81,8 +81,11 @@ bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner) SetEntry(itemid); SetObjectScale(1.0f); - SetUInt64Value(ITEM_FIELD_OWNER, owner ? owner->GetGUID() : 0); - SetUInt64Value(ITEM_FIELD_CONTAINED, owner ? owner->GetGUID() : 0); + if (owner) + { + SetGuidValue(ITEM_FIELD_OWNER, owner->GetGUID()); + SetGuidValue(ITEM_FIELD_CONTAINED, owner->GetGUID()); + } SetUInt32Value(ITEM_FIELD_MAXDURABILITY, itemProto->MaxDurability); SetUInt32Value(ITEM_FIELD_DURABILITY, itemProto->MaxDurability); @@ -94,7 +97,7 @@ bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner) // Cleaning 20 slots for (uint8 i = 0; i < MAX_BAG_SIZE; ++i) { - SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (i*2), 0); + SetGuidValue(CONTAINER_FIELD_SLOT_1 + (i*2), ObjectGuid::Empty); m_bagslot[i] = NULL; } @@ -106,7 +109,7 @@ void Bag::SaveToDB(SQLTransaction& trans) Item::SaveToDB(trans); } -bool Bag::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry) +bool Bag::LoadFromDB(uint32 guid, ObjectGuid owner_guid, Field* fields, uint32 entry) { if (!Item::LoadFromDB(guid, owner_guid, fields, entry)) return false; @@ -116,7 +119,7 @@ bool Bag::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry // cleanup bag content related item value fields (its will be filled correctly from `character_inventory`) for (uint8 i = 0; i < MAX_BAG_SIZE; ++i) { - SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (i*2), 0); + SetGuidValue(CONTAINER_FIELD_SLOT_1 + (i * 2), ObjectGuid::Empty); delete m_bagslot[i]; m_bagslot[i] = NULL; } @@ -151,7 +154,7 @@ void Bag::RemoveItem(uint8 slot, bool /*update*/) m_bagslot[slot]->SetContainer(NULL); m_bagslot[slot] = NULL; - SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (slot * 2), 0); + SetGuidValue(CONTAINER_FIELD_SLOT_1 + (slot * 2), ObjectGuid::Empty); } void Bag::StoreItem(uint8 slot, Item* pItem, bool /*update*/) @@ -161,9 +164,9 @@ void Bag::StoreItem(uint8 slot, Item* pItem, bool /*update*/) if (pItem && pItem->GetGUID() != this->GetGUID()) { m_bagslot[slot] = pItem; - SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (slot * 2), pItem->GetGUID()); - pItem->SetUInt64Value(ITEM_FIELD_CONTAINED, GetGUID()); - pItem->SetUInt64Value(ITEM_FIELD_OWNER, GetOwnerGUID()); + SetGuidValue(CONTAINER_FIELD_SLOT_1 + (slot * 2), pItem->GetGUID()); + pItem->SetGuidValue(ITEM_FIELD_CONTAINED, GetGUID()); + pItem->SetGuidValue(ITEM_FIELD_OWNER, GetOwnerGUID()); pItem->SetContainer(this); pItem->SetSlot(slot); } @@ -225,7 +228,7 @@ uint32 Bag::GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem) return count; } -uint8 Bag::GetSlotByItemGUID(uint64 guid) const +uint8 Bag::GetSlotByItemGUID(ObjectGuid guid) const { for (uint32 i = 0; i < GetBagSize(); ++i) if (m_bagslot[i] != 0) diff --git a/src/server/game/Entities/Item/Container/Bag.h b/src/server/game/Entities/Item/Container/Bag.h index db0c8edf556..65807628067 100644 --- a/src/server/game/Entities/Item/Container/Bag.h +++ b/src/server/game/Entities/Item/Container/Bag.h @@ -45,7 +45,7 @@ class Bag : public Item uint32 GetItemCount(uint32 item, Item* eItem = NULL) const; uint32 GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem = NULL) const; - uint8 GetSlotByItemGUID(uint64 guid) const; + uint8 GetSlotByItemGUID(ObjectGuid guid) const; bool IsEmpty() const; uint32 GetFreeSlots() const; uint32 GetBagSize() const { return GetUInt32Value(CONTAINER_FIELD_NUM_SLOTS); } @@ -54,7 +54,7 @@ class Bag : public Item // overwrite virtual Item::SaveToDB void SaveToDB(SQLTransaction& trans) override; // overwrite virtual Item::LoadFromDB - bool LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry) override; + bool LoadFromDB(uint32 guid, ObjectGuid owner_guid, Field* fields, uint32 entry) override; // overwrite virtual Item::DeleteFromDB void DeleteFromDB(SQLTransaction& trans) override; diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index 5a4ef765a6e..9305d98dce8 100644 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -262,8 +262,11 @@ bool Item::Create(uint32 guidlow, uint32 itemid, Player const* owner) SetEntry(itemid); SetObjectScale(1.0f); - SetUInt64Value(ITEM_FIELD_OWNER, owner ? owner->GetGUID() : 0); - SetUInt64Value(ITEM_FIELD_CONTAINED, owner ? owner->GetGUID() : 0); + if (owner) + { + SetGuidValue(ITEM_FIELD_OWNER, owner->GetGUID()); + SetGuidValue(ITEM_FIELD_CONTAINED, owner->GetGUID()); + } ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(itemid); if (!itemProto) @@ -323,9 +326,9 @@ void Item::SaveToDB(SQLTransaction& trans) uint8 index = 0; PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(uState == ITEM_NEW ? CHAR_REP_ITEM_INSTANCE : CHAR_UPD_ITEM_INSTANCE); stmt->setUInt32( index, GetEntry()); - stmt->setUInt32(++index, GUID_LOPART(GetOwnerGUID())); - stmt->setUInt32(++index, GUID_LOPART(GetUInt64Value(ITEM_FIELD_CREATOR))); - stmt->setUInt32(++index, GUID_LOPART(GetUInt64Value(ITEM_FIELD_GIFTCREATOR))); + stmt->setUInt32(++index, GetOwnerGUID().GetCounter()); + stmt->setUInt32(++index, GetGuidValue(ITEM_FIELD_CREATOR).GetCounter()); + stmt->setUInt32(++index, GetGuidValue(ITEM_FIELD_GIFTCREATOR).GetCounter()); stmt->setUInt32(++index, GetCount()); stmt->setUInt32(++index, GetUInt32Value(ITEM_FIELD_DURATION)); @@ -356,7 +359,7 @@ void Item::SaveToDB(SQLTransaction& trans) if ((uState == ITEM_CHANGED) && HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED)) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GIFT_OWNER); - stmt->setUInt32(0, GUID_LOPART(GetOwnerGUID())); + stmt->setUInt32(0, GetOwnerGUID().GetCounter()); stmt->setUInt32(1, guid); trans->Append(stmt); } @@ -395,7 +398,7 @@ void Item::SaveToDB(SQLTransaction& trans) CharacterDatabase.CommitTransaction(trans); } -bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry) +bool Item::LoadFromDB(uint32 guid, ObjectGuid owner_guid, Field* fields, uint32 entry) { // 0 1 2 3 4 5 6 7 8 9 10 //result = CharacterDatabase.PQuery("SELECT creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyId, durability, playedTime, text FROM item_instance WHERE guid = '%u'", guid); @@ -413,12 +416,12 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entr return false; // set owner (not if item is only loaded for gbank/auction/mail - if (owner_guid != 0) + if (owner_guid) SetOwnerGUID(owner_guid); bool need_save = false; // need explicit save data at load fixes - SetUInt64Value(ITEM_FIELD_CREATOR, MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER)); - SetUInt64Value(ITEM_FIELD_GIFTCREATOR, MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_PLAYER)); + SetGuidValue(ITEM_FIELD_CREATOR, ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32())); + SetGuidValue(ITEM_FIELD_GIFTCREATOR, ObjectGuid(HIGHGUID_PLAYER, fields[1].GetUInt32())); SetCount(fields[2].GetUInt32()); uint32 duration = fields[3].GetUInt32(); @@ -693,7 +696,7 @@ void Item::SetState(ItemUpdateState state, Player* forplayer) if (forplayer) { RemoveFromUpdateQueueOf(forplayer); - forplayer->DeleteRefundReference(GetGUIDLow()); + forplayer->DeleteRefundReference(GetGUID()); } delete this; return; @@ -725,7 +728,8 @@ void Item::AddToUpdateQueueOf(Player* player) if (player->GetGUID() != GetOwnerGUID()) { - TC_LOG_DEBUG("entities.player.items", "Item::AddToUpdateQueueOf - Owner's guid (%u) and player's guid (%u) don't match!", GUID_LOPART(GetOwnerGUID()), player->GetGUIDLow()); + TC_LOG_DEBUG("entities.player.items", "Item::AddToUpdateQueueOf - Owner's guid (%s) and player's guid (%s) don't match!", + GetOwnerGUID().ToString().c_str(), player->GetGUID().ToString().c_str()); return; } @@ -745,7 +749,8 @@ void Item::RemoveFromUpdateQueueOf(Player* player) if (player->GetGUID() != GetOwnerGUID()) { - TC_LOG_DEBUG("entities.player.items", "Item::RemoveFromUpdateQueueOf - Owner's guid (%u) and player's guid (%u) don't match!", GUID_LOPART(GetOwnerGUID()), player->GetGUIDLow()); + TC_LOG_DEBUG("entities.player.items", "Item::RemoveFromUpdateQueueOf - Owner's guid (%s) and player's guid (%s) don't match!", + GetOwnerGUID().ToString().c_str(), player->GetGUID().ToString().c_str()); return; } @@ -881,7 +886,7 @@ bool Item::IsFitToSpellRequirements(SpellInfo const* spellInfo) const return true; } -void Item::SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges, uint64 caster /*= 0*/) +void Item::SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges, ObjectGuid caster /*= ObjectGuid::Empty*/) { // Better lost small time at check in comparison lost time at item save to DB. if ((GetEnchantmentId(slot) == id) && (GetEnchantmentDuration(slot) == duration) && (GetEnchantmentCharges(slot) == charges)) @@ -891,7 +896,7 @@ void Item::SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint if (slot < MAX_INSPECTED_ENCHANTMENT_SLOT) { if (uint32 oldEnchant = GetEnchantmentId(slot)) - owner->GetSession()->SendEnchantmentLog(GetOwnerGUID(), 0, GetEntry(), oldEnchant); + owner->GetSession()->SendEnchantmentLog(GetOwnerGUID(), ObjectGuid::Empty, GetEntry(), oldEnchant); if (id) owner->GetSession()->SendEnchantmentLog(GetOwnerGUID(), caster, GetEntry(), id); @@ -1075,8 +1080,8 @@ Item* Item::CloneItem(uint32 count, Player const* player) const if (!newItem) return NULL; - newItem->SetUInt32Value(ITEM_FIELD_CREATOR, GetUInt32Value(ITEM_FIELD_CREATOR)); - newItem->SetUInt32Value(ITEM_FIELD_GIFTCREATOR, GetUInt32Value(ITEM_FIELD_GIFTCREATOR)); + newItem->SetGuidValue(ITEM_FIELD_CREATOR, GetGuidValue(ITEM_FIELD_CREATOR)); + newItem->SetGuidValue(ITEM_FIELD_GIFTCREATOR, GetGuidValue(ITEM_FIELD_GIFTCREATOR)); newItem->SetUInt32Value(ITEM_FIELD_FLAGS, GetUInt32Value(ITEM_FIELD_FLAGS) & ~(ITEM_FLAG_REFUNDABLE | ITEM_FLAG_BOP_TRADEABLE)); newItem->SetUInt32Value(ITEM_FIELD_DURATION, GetUInt32Value(ITEM_FIELD_DURATION)); // player CAN be NULL in which case we must not update random properties because that accesses player's item update queue @@ -1157,7 +1162,7 @@ void Item::SetNotRefundable(Player* owner, bool changestate /*=true*/, SQLTransa SetPaidExtendedCost(0); DeleteRefundDataFromDB(trans); - owner->DeleteRefundReference(GetGUIDLow()); + owner->DeleteRefundReference(GetGUID()); } void Item::UpdatePlayedTime(Player* owner) diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h index 32fbe9e35fd..49aea522225 100644 --- a/src/server/game/Entities/Item/Item.h +++ b/src/server/game/Entities/Item/Item.h @@ -217,8 +217,8 @@ class Item : public Object ItemTemplate const* GetTemplate() const; - uint64 GetOwnerGUID() const { return GetUInt64Value(ITEM_FIELD_OWNER); } - void SetOwnerGUID(uint64 guid) { SetUInt64Value(ITEM_FIELD_OWNER, guid); } + ObjectGuid GetOwnerGUID() const { return GetGuidValue(ITEM_FIELD_OWNER); } + void SetOwnerGUID(ObjectGuid guid) { SetGuidValue(ITEM_FIELD_OWNER, guid); } Player* GetOwner()const; void SetBinding(bool val) { ApplyModFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_SOULBOUND, val); } @@ -227,7 +227,7 @@ class Item : public Object bool IsBindedNotWith(Player const* player) const; bool IsBoundByEnchant() const; virtual void SaveToDB(SQLTransaction& trans); - virtual bool LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry); + virtual bool LoadFromDB(uint32 guid, ObjectGuid owner_guid, Field* fields, uint32 entry); static void DeleteFromDB(SQLTransaction& trans, uint32 itemGuid); virtual void DeleteFromDB(SQLTransaction& trans); static void DeleteFromInventoryDB(SQLTransaction& trans, uint32 itemGuid); @@ -289,7 +289,7 @@ class Item : public Object void SetItemRandomProperties(int32 randomPropId); void UpdateItemSuffixFactor(); static int32 GenerateItemRandomPropertyId(uint32 item_id); - void SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges, uint64 caster = 0); + void SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges, ObjectGuid caster = ObjectGuid::Empty); void SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration, Player* owner); void SetEnchantmentCharges(EnchantmentSlot slot, uint32 charges); void ClearEnchantment(EnchantmentSlot slot); diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index e402836f4c2..71ab2abeba8 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -82,8 +82,6 @@ Object::Object() : m_PackGUID(sizeof(uint64)+1) m_inWorld = false; m_objectUpdated = false; - - m_PackGUID.appendPackGUID(0); } WorldObject::~WorldObject() @@ -93,8 +91,8 @@ WorldObject::~WorldObject() { if (GetTypeId() == TYPEID_CORPSE) { - TC_LOG_FATAL("misc", "Object::~Object Corpse guid=" UI64FMTD ", type=%d, entry=%u deleted but still in map!!", - GetGUID(), ((Corpse*)this)->GetType(), GetEntry()); + TC_LOG_FATAL("misc", "Object::~Object Corpse type=%d deleted but still in map!!", + GetGUID().ToString().c_str(), ((Corpse*)this)->GetType()); ASSERT(false); } ResetMap(); @@ -105,7 +103,7 @@ Object::~Object() { if (IsInWorld()) { - TC_LOG_FATAL("misc", "Object::~Object - guid=" UI64FMTD ", typeid=%d, entry=%u deleted but still in world!!", GetGUID(), GetTypeId(), GetEntry()); + TC_LOG_FATAL("misc", "Object::~Object %s but still in world!!", GetGUID().ToString().c_str()); if (isType(TYPEMASK_ITEM)) TC_LOG_FATAL("misc", "Item slot %u", ((Item*)this)->GetSlot()); ASSERT(false); @@ -114,7 +112,7 @@ Object::~Object() if (m_objectUpdated) { - TC_LOG_FATAL("misc", "Object::~Object - guid=" UI64FMTD ", typeid=%d, entry=%u deleted but still in update list!!", GetGUID(), GetTypeId(), GetEntry()); + TC_LOG_FATAL("misc", "Object::~Object %s deleted but still in update list!!", GetGUID().ToString().c_str()); ASSERT(false); sObjectAccessor->RemoveUpdateObject(this); } @@ -137,11 +135,10 @@ void Object::_Create(uint32 guidlow, uint32 entry, HighGuid guidhigh) { if (!m_uint32Values) _InitValues(); - uint64 guid = MAKE_NEW_GUID(guidlow, entry, guidhigh); - SetUInt64Value(OBJECT_FIELD_GUID, guid); + ObjectGuid guid(guidhigh, entry, guidlow); + SetGuidValue(OBJECT_FIELD_GUID, guid); SetUInt32Value(OBJECT_FIELD_TYPE, m_objectType); - m_PackGUID.wpos(0); - m_PackGUID.appendPackGUID(GetGUID()); + m_PackGUID.Set(guid); } std::string Object::_ConcatFields(uint16 startIndex, uint16 size) const @@ -181,7 +178,7 @@ void Object::BuildMovementUpdateBlock(UpdateData* data, uint32 flags) const ByteBuffer buf(500); buf << uint8(UPDATETYPE_MOVEMENT); - buf.append(GetPackGUID()); + buf << GetPackGUID(); BuildMovementUpdate(&buf, flags); @@ -237,7 +234,7 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c ByteBuffer buf(500); buf << uint8(updateType); - buf.append(GetPackGUID()); + buf << GetPackGUID(); buf << uint8(m_objectTypeId); BuildMovementUpdate(&buf, flags); @@ -261,7 +258,7 @@ void Object::BuildValuesUpdateBlockForPlayer(UpdateData* data, Player* target) c ByteBuffer buf(500); buf << uint8(UPDATETYPE_VALUES); - buf.append(GetPackGUID()); + buf << GetPackGUID(); BuildValuesUpdate(UPDATETYPE_VALUES, &buf, target); @@ -336,6 +333,12 @@ uint16 Object::GetUInt16Value(uint16 index, uint8 offset) const return *(((uint16*)&m_uint32Values[index])+offset); } +ObjectGuid Object::GetGuidValue(uint16 index) const +{ + ASSERT(index + 1 < m_valuesCount || PrintIndexError(index, false)); + return *((ObjectGuid*)&(m_uint32Values[index])); +} + void Object::BuildMovementUpdate(ByteBuffer* data, uint16 flags) const { Unit const* unit = NULL; @@ -376,7 +379,7 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 flags) const Transport* transport = object->GetTransport(); if (transport) - data->append(transport->GetPackGUID()); + *data << transport->GetPackGUID(); else *data << uint8(0); @@ -465,7 +468,7 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 flags) const { ASSERT(unit); if (Unit* victim = unit->GetVictim()) - data->append(victim->GetPackGUID()); + *data << victim->GetPackGUID(); else *data << uint8(0); } @@ -687,13 +690,12 @@ void Object::SetUInt64Value(uint16 index, uint64 value) } } -bool Object::AddUInt64Value(uint16 index, uint64 value) +bool Object::AddGuidValue(uint16 index, ObjectGuid value) { ASSERT(index + 1 < m_valuesCount || PrintIndexError(index, true)); - if (value && !*((uint64*)&(m_uint32Values[index]))) + if (value && !*((ObjectGuid*)&(m_uint32Values[index]))) { - m_uint32Values[index] = PAIR64_LOPART(value); - m_uint32Values[index + 1] = PAIR64_HIPART(value); + *((ObjectGuid*)&(m_uint32Values[index])) = value; _changesMask.SetBit(index); _changesMask.SetBit(index + 1); @@ -709,10 +711,10 @@ bool Object::AddUInt64Value(uint16 index, uint64 value) return false; } -bool Object::RemoveUInt64Value(uint16 index, uint64 value) +bool Object::RemoveGuidValue(uint16 index, ObjectGuid value) { ASSERT(index + 1 < m_valuesCount || PrintIndexError(index, true)); - if (value && *((uint64*)&(m_uint32Values[index])) == value) + if (value && *((ObjectGuid*)&(m_uint32Values[index])) == value) { m_uint32Values[index] = 0; m_uint32Values[index + 1] = 0; @@ -796,6 +798,23 @@ void Object::SetUInt16Value(uint16 index, uint8 offset, uint16 value) } } +void Object::SetGuidValue(uint16 index, ObjectGuid value) +{ + ASSERT(index + 1 < m_valuesCount || PrintIndexError(index, true)); + if (*((ObjectGuid*)&(m_uint32Values[index])) != value) + { + *((ObjectGuid*)&(m_uint32Values[index])) = value; + _changesMask.SetBit(index); + _changesMask.SetBit(index + 1); + + if (m_inWorld && !m_objectUpdated) + { + sObjectAccessor->AddUpdateObject(this); + m_objectUpdated = true; + } + } +} + void Object::SetStatFloatValue(uint16 index, float value) { if (value < 0) @@ -1072,7 +1091,7 @@ ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYZOStreamer const& st void MovementInfo::OutDebug() { TC_LOG_INFO("misc", "MOVEMENT INFO"); - TC_LOG_INFO("misc", "guid " UI64FMTD, guid); + TC_LOG_INFO("misc", "guid %s", guid.ToString().c_str()); TC_LOG_INFO("misc", "flags %u", flags); TC_LOG_INFO("misc", "flags2 %u", flags2); TC_LOG_INFO("misc", "time %u current time " UI64FMTD "", flags2, uint64(::time(NULL))); @@ -1080,7 +1099,7 @@ void MovementInfo::OutDebug() if (flags & MOVEMENTFLAG_ONTRANSPORT) { TC_LOG_INFO("misc", "TRANSPORT:"); - TC_LOG_INFO("misc", "guid: " UI64FMTD, transport.guid); + TC_LOG_INFO("misc", "guid: %s", transport.guid.ToString().c_str()); TC_LOG_INFO("misc", "position: `%s`", transport.pos.ToString().c_str()); TC_LOG_INFO("misc", "seat: %i", transport.seat); TC_LOG_INFO("misc", "time: %u", transport.time); @@ -1892,7 +1911,7 @@ void Object::ForceValuesUpdateAtIndex(uint32 i) void Unit::BuildHeartBeatMsg(WorldPacket* data) const { data->Initialize(MSG_MOVE_HEARTBEAT, 32); - data->append(GetPackGUID()); + *data << GetPackGUID(); BuildMovementPacket(data); } @@ -1914,7 +1933,7 @@ void WorldObject::SendMessageToSet(WorldPacket* data, Player const* skipped_rcvr VisitNearbyWorldObject(GetVisibilityRange(), notifier); } -void WorldObject::SendObjectDeSpawnAnim(uint64 guid) +void WorldObject::SendObjectDeSpawnAnim(ObjectGuid guid) { WorldPacket data(SMSG_GAMEOBJECT_DESPAWN_ANIM, 8); data << uint64(guid); @@ -2611,7 +2630,7 @@ struct WorldObjectChangeAccumulator { UpdateDataMapType& i_updateDatas; WorldObject& i_object; - std::set<uint64> plr_list; + GuidSet plr_list; WorldObjectChangeAccumulator(WorldObject &obj, UpdateDataMapType &d) : i_updateDatas(d), i_object(obj) { } void Visit(PlayerMapType &m) { @@ -2652,13 +2671,13 @@ struct WorldObjectChangeAccumulator for (DynamicObjectMapType::iterator iter = m.begin(); iter != m.end(); ++iter) { source = iter->GetSource(); - uint64 guid = source->GetCasterGUID(); + ObjectGuid guid = source->GetCasterGUID(); - if (IS_PLAYER_GUID(guid)) + if (guid.IsPlayer()) { //Caster may be NULL if DynObj is in removelist if (Player* caster = ObjectAccessor::FindPlayer(guid)) - if (caster->GetUInt64Value(PLAYER_FARSIGHT) == source->GetGUID()) + if (caster->GetGuidValue(PLAYER_FARSIGHT) == source->GetGUID()) BuildPacket(caster); } } @@ -2691,9 +2710,9 @@ void WorldObject::BuildUpdate(UpdateDataMapType& data_map) ClearUpdateMask(false); } -uint64 WorldObject::GetTransGUID() const +ObjectGuid WorldObject::GetTransGUID() const { if (GetTransport()) return GetTransport()->GetGUID(); - return 0; + return ObjectGuid::Empty; } diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 652a4d4b71f..fcbb89408d0 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -46,33 +46,6 @@ #define NOMINAL_MELEE_RANGE 5.0f #define MELEE_RANGE (NOMINAL_MELEE_RANGE - MIN_MELEE_REACH * 2) //center to center for players -enum TypeMask -{ - TYPEMASK_OBJECT = 0x0001, - TYPEMASK_ITEM = 0x0002, - TYPEMASK_CONTAINER = 0x0006, // TYPEMASK_ITEM | 0x0004 - TYPEMASK_UNIT = 0x0008, // creature - TYPEMASK_PLAYER = 0x0010, - TYPEMASK_GAMEOBJECT = 0x0020, - TYPEMASK_DYNAMICOBJECT = 0x0040, - TYPEMASK_CORPSE = 0x0080, - TYPEMASK_SEER = TYPEMASK_PLAYER | TYPEMASK_UNIT | TYPEMASK_DYNAMICOBJECT -}; - -enum TypeID -{ - TYPEID_OBJECT = 0, - TYPEID_ITEM = 1, - TYPEID_CONTAINER = 2, - TYPEID_UNIT = 3, - TYPEID_PLAYER = 4, - TYPEID_GAMEOBJECT = 5, - TYPEID_DYNAMICOBJECT = 6, - TYPEID_CORPSE = 7 -}; - -#define NUM_CLIENT_OBJECT_TYPES 8 - uint32 GuidHigh2TypeId(uint32 guid_hi); enum TempSummonType @@ -128,11 +101,11 @@ class Object virtual void AddToWorld(); virtual void RemoveFromWorld(); - uint64 GetGUID() const { return GetUInt64Value(0); } - uint32 GetGUIDLow() const { return GUID_LOPART(GetUInt64Value(0)); } - uint32 GetGUIDMid() const { return GUID_ENPART(GetUInt64Value(0)); } - uint32 GetGUIDHigh() const { return GUID_HIPART(GetUInt64Value(0)); } - const ByteBuffer& GetPackGUID() const { return m_PackGUID; } + ObjectGuid GetGUID() const { return GetGuidValue(OBJECT_FIELD_GUID); } + uint32 GetGUIDLow() const { return GetGuidValue(OBJECT_FIELD_GUID).GetCounter(); } + uint32 GetGUIDMid() const { return GetGuidValue(OBJECT_FIELD_GUID).GetEntry(); } + uint32 GetGUIDHigh() const { return GetGuidValue(OBJECT_FIELD_GUID).GetHigh(); } + PackedGuid const& GetPackGUID() const { return m_PackGUID; } uint32 GetEntry() const { return GetUInt32Value(OBJECT_FIELD_ENTRY); } void SetEntry(uint32 entry) { SetUInt32Value(OBJECT_FIELD_ENTRY, entry); } @@ -157,6 +130,7 @@ class Object float GetFloatValue(uint16 index) const; uint8 GetByteValue(uint16 index, uint8 offset) const; uint16 GetUInt16Value(uint16 index, uint8 offset) const; + ObjectGuid GetGuidValue(uint16 index) const; void SetInt32Value(uint16 index, int32 value); void SetUInt32Value(uint16 index, uint32 value); @@ -166,11 +140,12 @@ class Object void SetByteValue(uint16 index, uint8 offset, uint8 value); void SetUInt16Value(uint16 index, uint8 offset, uint16 value); void SetInt16Value(uint16 index, uint8 offset, int16 value) { SetUInt16Value(index, offset, (uint16)value); } + void SetGuidValue(uint16 index, ObjectGuid value); void SetStatFloatValue(uint16 index, float value); void SetStatInt32Value(uint16 index, int32 value); - bool AddUInt64Value(uint16 index, uint64 value); - bool RemoveUInt64Value(uint16 index, uint64 value); + bool AddGuidValue(uint16 index, ObjectGuid value); + bool RemoveGuidValue(uint16 index, ObjectGuid value); void ApplyModUInt32Value(uint16 index, int32 val, bool apply); void ApplyModInt32Value(uint16 index, int32 val, bool apply); @@ -265,7 +240,7 @@ class Object private: bool m_inWorld; - ByteBuffer m_PackGUID; + PackedGuid m_PackGUID; // for output helpfull error messages from asserts bool PrintIndexError(uint32 index, bool set) const; @@ -410,7 +385,7 @@ ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYZOStreamer const& st struct MovementInfo { // common - uint64 guid; + ObjectGuid guid; uint32 flags; uint16 flags2; Position pos; @@ -421,14 +396,14 @@ struct MovementInfo { void Reset() { - guid = 0; + guid.Clear(); pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f); seat = -1; time = 0; time2 = 0; } - uint64 guid; + ObjectGuid guid; Position pos; int8 seat; uint32 time; @@ -457,7 +432,7 @@ struct MovementInfo float splineElevation; MovementInfo() : - guid(0), flags(0), flags2(0), time(0), pitch(0.0f), fallTime(0), splineElevation(0.0f) + guid(), flags(0), flags2(0), time(0), pitch(0.0f), fallTime(0), splineElevation(0.0f) { pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f); transport.Reset(); @@ -655,7 +630,7 @@ class WorldObject : public Object, public WorldLocation void PlayDistanceSound(uint32 sound_id, Player* target = NULL); void PlayDirectSound(uint32 sound_id, Player* target = NULL); - void SendObjectDeSpawnAnim(uint64 guid); + void SendObjectDeSpawnAnim(ObjectGuid guid); virtual void SaveRespawnTime() { } void AddObjectToRemoveList(); @@ -739,7 +714,7 @@ class WorldObject : public Object, public WorldLocation float GetTransOffsetO() const { return m_movementInfo.transport.pos.GetOrientation(); } uint32 GetTransTime() const { return m_movementInfo.transport.time; } int8 GetTransSeat() const { return m_movementInfo.transport.seat; } - virtual uint64 GetTransGUID() const; + virtual ObjectGuid GetTransGUID() const; void SetTransport(Transport* t) { m_transport = t; } MovementInfo m_movementInfo; diff --git a/src/server/game/Entities/Object/ObjectDefines.h b/src/server/game/Entities/Object/ObjectDefines.h index 236f77caf5a..3b7709bc1f1 100644 --- a/src/server/game/Entities/Object/ObjectDefines.h +++ b/src/server/game/Entities/Object/ObjectDefines.h @@ -20,22 +20,7 @@ #define TRINITY_OBJECTDEFINES_H #include "Define.h" - -enum HighGuid -{ - HIGHGUID_ITEM = 0x4000, // blizz 4000 - HIGHGUID_CONTAINER = 0x4000, // blizz 4000 - HIGHGUID_PLAYER = 0x0000, // blizz 0000 - HIGHGUID_GAMEOBJECT = 0xF110, // blizz F110 - HIGHGUID_TRANSPORT = 0xF120, // blizz F120 (for GAMEOBJECT_TYPE_TRANSPORT) - HIGHGUID_UNIT = 0xF130, // blizz F130 - HIGHGUID_PET = 0xF140, // blizz F140 - HIGHGUID_VEHICLE = 0xF150, // blizz F550 - HIGHGUID_DYNAMICOBJECT = 0xF100, // blizz F100 - HIGHGUID_CORPSE = 0xF101, // blizz F100 - HIGHGUID_MO_TRANSPORT = 0x1FC0, // blizz 1FC0 (for GAMEOBJECT_TYPE_MO_TRANSPORT) - HIGHGUID_GROUP = 0x1F50 -}; +#include "ObjectGuid.h" // used for creating values for respawn for example inline uint64 MAKE_PAIR64(uint32 l, uint32 h); @@ -46,35 +31,6 @@ inline uint32 MAKE_PAIR32(uint16 l, uint16 h); inline uint16 PAIR32_HIPART(uint32 x); inline uint16 PAIR32_LOPART(uint32 x); -inline bool IS_EMPTY_GUID(uint64 guid); -inline bool IS_CREATURE_GUID(uint64 guid); -inline bool IS_PET_GUID(uint64 guid); -inline bool IS_VEHICLE_GUID(uint64 guid); -inline bool IS_CRE_OR_VEH_GUID(uint64 guid); -inline bool IS_CRE_OR_VEH_OR_PET_GUID(uint64 guid); -inline bool IS_PLAYER_GUID(uint64 guid); -inline bool IS_UNIT_GUID(uint64 guid); -inline bool IS_ITEM_GUID(uint64 guid); -inline bool IS_GAMEOBJECT_GUID(uint64 guid); -inline bool IS_DYNAMICOBJECT_GUID(uint64 guid); -inline bool IS_CORPSE_GUID(uint64 guid); -inline bool IS_TRANSPORT_GUID(uint64 guid); -inline bool IS_MO_TRANSPORT_GUID(uint64 guid); -inline bool IS_GROUP_GUID(uint64 guid); - -// l - OBJECT_FIELD_GUID -// e - OBJECT_FIELD_ENTRY for GO (except GAMEOBJECT_TYPE_MO_TRANSPORT) and creatures or UNIT_FIELD_PETNUMBER for pets -// h - OBJECT_FIELD_GUID + 1 -inline uint64 MAKE_NEW_GUID(uint32 l, uint32 e, uint32 h); - -//#define GUID_HIPART(x) (uint32)((uint64(x) >> 52)) & 0x0000FFFF) -inline uint32 GUID_HIPART(uint64 guid); -inline uint32 GUID_ENPART(uint64 x); -inline uint32 GUID_LOPART(uint64 x); - -inline bool IsGuidHaveEnPart(uint64 guid); -inline char const* GetLogNameForGuid(uint64 guid); - uint64 MAKE_PAIR64(uint32 l, uint32 h) { return uint64(l | (uint64(h) << 32)); @@ -110,144 +66,4 @@ uint16 PAIR32_LOPART(uint32 x) return (uint16)(x & 0x0000FFFF); } -bool IS_EMPTY_GUID(uint64 guid) -{ - return guid == 0; -} - -bool IS_CREATURE_GUID(uint64 guid) -{ - return GUID_HIPART(guid) == HIGHGUID_UNIT; -} - -bool IS_PET_GUID(uint64 guid) -{ - return GUID_HIPART(guid) == HIGHGUID_PET; -} - -bool IS_VEHICLE_GUID(uint64 guid) -{ - return GUID_HIPART(guid) == HIGHGUID_VEHICLE; -} - -bool IS_CRE_OR_VEH_GUID(uint64 guid) -{ - return IS_CREATURE_GUID(guid) || IS_VEHICLE_GUID(guid); -} - -bool IS_CRE_OR_VEH_OR_PET_GUID(uint64 guid) -{ - return IS_CRE_OR_VEH_GUID(guid) || IS_PET_GUID(guid); -} - -bool IS_PLAYER_GUID(uint64 guid) -{ - return guid != 0 && GUID_HIPART(guid) == HIGHGUID_PLAYER; -} - -bool IS_UNIT_GUID(uint64 guid) -{ - return IS_CRE_OR_VEH_OR_PET_GUID(guid) || IS_PLAYER_GUID(guid); -} - -bool IS_ITEM_GUID(uint64 guid) -{ - return GUID_HIPART(guid) == HIGHGUID_ITEM; -} - -bool IS_GAMEOBJECT_GUID(uint64 guid) -{ - return GUID_HIPART(guid) == HIGHGUID_GAMEOBJECT; -} - -bool IS_DYNAMICOBJECT_GUID(uint64 guid) -{ - return GUID_HIPART(guid) == HIGHGUID_DYNAMICOBJECT; -} - -bool IS_CORPSE_GUID(uint64 guid) -{ - return GUID_HIPART(guid) == HIGHGUID_CORPSE; -} - -bool IS_TRANSPORT_GUID(uint64 guid) -{ - return GUID_HIPART(guid) == HIGHGUID_TRANSPORT; -} - -bool IS_MO_TRANSPORT_GUID(uint64 guid) -{ - return GUID_HIPART(guid) == HIGHGUID_MO_TRANSPORT; -} - -bool IS_GROUP_GUID(uint64 guid) -{ - return GUID_HIPART(guid) == HIGHGUID_GROUP; -} - -uint64 MAKE_NEW_GUID(uint32 l, uint32 e, uint32 h) -{ - return uint64(uint64(l) | (uint64(e) << 24) | (uint64(h) << 48)); -} - -uint32 GUID_HIPART(uint64 guid) -{ - return (uint32)((uint64(guid) >> 48) & 0x0000FFFF); -} - -uint32 GUID_ENPART(uint64 x) -{ - return IsGuidHaveEnPart(x) - ? (uint32)((x >> 24) & UI64LIT(0x0000000000FFFFFF)) - : 0; -} - -uint32 GUID_LOPART(uint64 x) -{ - return IsGuidHaveEnPart(x) - ? (uint32)(x & UI64LIT(0x0000000000FFFFFF)) - : (uint32)(x & UI64LIT(0x00000000FFFFFFFF)); -} - -bool IsGuidHaveEnPart(uint64 guid) -{ - switch (GUID_HIPART(guid)) - { - case HIGHGUID_ITEM: - case HIGHGUID_PLAYER: - case HIGHGUID_DYNAMICOBJECT: - case HIGHGUID_CORPSE: - case HIGHGUID_GROUP: - return false; - case HIGHGUID_GAMEOBJECT: - case HIGHGUID_TRANSPORT: - case HIGHGUID_UNIT: - case HIGHGUID_PET: - case HIGHGUID_VEHICLE: - case HIGHGUID_MO_TRANSPORT: - default: - return true; - } -} - -char const* GetLogNameForGuid(uint64 guid) -{ - switch (GUID_HIPART(guid)) - { - case HIGHGUID_ITEM: return "item"; - case HIGHGUID_PLAYER: return guid ? "player" : "none"; - case HIGHGUID_GAMEOBJECT: return "gameobject"; - case HIGHGUID_TRANSPORT: return "transport"; - case HIGHGUID_UNIT: return "creature"; - case HIGHGUID_PET: return "pet"; - case HIGHGUID_VEHICLE: return "vehicle"; - case HIGHGUID_DYNAMICOBJECT:return "dynobject"; - case HIGHGUID_CORPSE: return "corpse"; - case HIGHGUID_MO_TRANSPORT: return "mo_transport"; - case HIGHGUID_GROUP: return "group"; - default: - return "<unknown>"; - } -} - #endif diff --git a/src/server/game/Entities/Object/ObjectGuid.cpp b/src/server/game/Entities/Object/ObjectGuid.cpp new file mode 100644 index 00000000000..cf40e248808 --- /dev/null +++ b/src/server/game/Entities/Object/ObjectGuid.cpp @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "ObjectGuid.h" +#include "World.h" +#include "ObjectMgr.h" +#include <sstream> +#include <iomanip> + +ObjectGuid const ObjectGuid::Empty = ObjectGuid(); + +char const* ObjectGuid::GetTypeName(HighGuid high) +{ + switch (high) + { + case HIGHGUID_ITEM: return "Item"; + case HIGHGUID_PLAYER: return "Player"; + case HIGHGUID_GAMEOBJECT: return "Gameobject"; + case HIGHGUID_TRANSPORT: return "Transport"; + case HIGHGUID_UNIT: return "Creature"; + case HIGHGUID_PET: return "Pet"; + case HIGHGUID_VEHICLE: return "Vehicle"; + case HIGHGUID_DYNAMICOBJECT: return "DynObject"; + case HIGHGUID_CORPSE: return "Corpse"; + case HIGHGUID_MO_TRANSPORT: return "MoTransport"; + case HIGHGUID_INSTANCE: return "InstanceID"; + case HIGHGUID_GROUP: return "Group"; + default: + return "<unknown>"; + } +} + +std::string ObjectGuid::ToString() const +{ + std::ostringstream str; + str << "GUID Full: 0x" << std::hex << std::setw(16) << std::setfill('0') << m_guid << std::dec; + str << " Type: " << GetTypeName(); + if (HasEntry()) + str << (IsPet() ? " Pet number: " : " Entry: ") << GetEntry() << " "; + + str << " Low: " << GetCounter(); + return str.str(); +} + +template<HighGuid high> +uint32 ObjectGuidGenerator<high>::Generate() +{ + if (m_nextGuid >= ObjectGuid::GetMaxCounter(high) - 1) + { + TC_LOG_ERROR("", "%s guid overflow!! Can't continue, shutting down server. ", ObjectGuid::GetTypeName(high)); + World::StopNow(ERROR_EXIT_CODE); + } + return m_nextGuid++; +} + +ByteBuffer& operator<<(ByteBuffer& buf, ObjectGuid const& guid) +{ + buf << uint64(guid.GetRawValue()); + return buf; +} + +ByteBuffer& operator>>(ByteBuffer& buf, ObjectGuid& guid) +{ + guid.Set(buf.read<uint64>()); + return buf; +} + +ByteBuffer& operator<<(ByteBuffer& buf, PackedGuid const& guid) +{ + buf.append(guid.m_packedGuid); + return buf; +} + +ByteBuffer& operator>>(ByteBuffer& buf, PackedGuidReader const& guid) +{ + buf.readPackGUID(*reinterpret_cast<uint64*>(guid.m_guidPtr)); + return buf; +} + +template uint32 ObjectGuidGenerator<HIGHGUID_ITEM>::Generate(); +template uint32 ObjectGuidGenerator<HIGHGUID_PLAYER>::Generate(); +template uint32 ObjectGuidGenerator<HIGHGUID_GAMEOBJECT>::Generate(); +template uint32 ObjectGuidGenerator<HIGHGUID_TRANSPORT>::Generate(); +template uint32 ObjectGuidGenerator<HIGHGUID_UNIT>::Generate(); +template uint32 ObjectGuidGenerator<HIGHGUID_PET>::Generate(); +template uint32 ObjectGuidGenerator<HIGHGUID_VEHICLE>::Generate(); +template uint32 ObjectGuidGenerator<HIGHGUID_DYNAMICOBJECT>::Generate(); +template uint32 ObjectGuidGenerator<HIGHGUID_CORPSE>::Generate(); +template uint32 ObjectGuidGenerator<HIGHGUID_INSTANCE>::Generate(); +template uint32 ObjectGuidGenerator<HIGHGUID_GROUP>::Generate(); diff --git a/src/server/game/Entities/Object/ObjectGuid.h b/src/server/game/Entities/Object/ObjectGuid.h new file mode 100644 index 00000000000..30b7b1e0293 --- /dev/null +++ b/src/server/game/Entities/Object/ObjectGuid.h @@ -0,0 +1,262 @@ +/* + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef ObjectGuid_h__ +#define ObjectGuid_h__ + +#include "Common.h" +#include "ByteBuffer.h" + +#include <functional> + +enum TypeID +{ + TYPEID_OBJECT = 0, + TYPEID_ITEM = 1, + TYPEID_CONTAINER = 2, + TYPEID_UNIT = 3, + TYPEID_PLAYER = 4, + TYPEID_GAMEOBJECT = 5, + TYPEID_DYNAMICOBJECT = 6, + TYPEID_CORPSE = 7 +}; + +#define NUM_CLIENT_OBJECT_TYPES 8 + +enum TypeMask +{ + TYPEMASK_OBJECT = 0x0001, + TYPEMASK_ITEM = 0x0002, + TYPEMASK_CONTAINER = 0x0006, // TYPEMASK_ITEM | 0x0004 + TYPEMASK_UNIT = 0x0008, // creature + TYPEMASK_PLAYER = 0x0010, + TYPEMASK_GAMEOBJECT = 0x0020, + TYPEMASK_DYNAMICOBJECT = 0x0040, + TYPEMASK_CORPSE = 0x0080, + TYPEMASK_SEER = TYPEMASK_PLAYER | TYPEMASK_UNIT | TYPEMASK_DYNAMICOBJECT +}; + +enum HighGuid +{ + HIGHGUID_ITEM = 0x4000, // blizz 4000 + HIGHGUID_CONTAINER = 0x4000, // blizz 4000 + HIGHGUID_PLAYER = 0x0000, // blizz 0000 + HIGHGUID_GAMEOBJECT = 0xF110, // blizz F110 + HIGHGUID_TRANSPORT = 0xF120, // blizz F120 (for GAMEOBJECT_TYPE_TRANSPORT) + HIGHGUID_UNIT = 0xF130, // blizz F130 + HIGHGUID_PET = 0xF140, // blizz F140 + HIGHGUID_VEHICLE = 0xF150, // blizz F550 + HIGHGUID_DYNAMICOBJECT = 0xF100, // blizz F100 + HIGHGUID_CORPSE = 0xF101, // blizz F100 + HIGHGUID_MO_TRANSPORT = 0x1FC0, // blizz 1FC0 (for GAMEOBJECT_TYPE_MO_TRANSPORT) + HIGHGUID_INSTANCE = 0x1F40, // blizz 1F40 + HIGHGUID_GROUP = 0x1F50 +}; + +class ObjectGuid; +class PackedGuid; + +struct PackedGuidReader +{ + explicit PackedGuidReader(ObjectGuid& guid) : m_guidPtr(&guid) {} + ObjectGuid* m_guidPtr; +}; + +class ObjectGuid +{ + public: + static ObjectGuid const Empty; + + ObjectGuid() : m_guid(0) {} + explicit ObjectGuid(uint64 guid) : m_guid(guid) {} + ObjectGuid(HighGuid hi, uint32 entry, uint32 counter) : m_guid(counter ? uint64(counter) | (uint64(entry) << 24) | (uint64(hi) << 48) : 0) {} + ObjectGuid(HighGuid hi, uint32 counter) : m_guid(counter ? uint64(counter) | (uint64(hi) << 48) : 0) {} + + operator uint64() const { return m_guid; } + PackedGuidReader ReadAsPacked() { return PackedGuidReader(*this); } + + void Set(uint64 guid) { m_guid = guid; } + void Clear() { m_guid = 0; } + + PackedGuid WriteAsPacked() const; + + uint64 GetRawValue() const { return m_guid; } + HighGuid GetHigh() const { return HighGuid((m_guid >> 48) & 0x0000FFFF); } + uint32 GetEntry() const { return HasEntry() ? uint32((m_guid >> 24) & UI64LIT(0x0000000000FFFFFF)) : 0; } + uint32 GetCounter() const + { + return HasEntry() + ? uint32(m_guid & UI64LIT(0x0000000000FFFFFF)) + : uint32(m_guid & UI64LIT(0x00000000FFFFFFFF)); + } + + static uint32 GetMaxCounter(HighGuid high) + { + return HasEntry(high) + ? uint32(0x00FFFFFF) + : uint32(0xFFFFFFFF); + } + + uint32 GetMaxCounter() const { return GetMaxCounter(GetHigh()); } + + bool IsEmpty() const { return m_guid == 0; } + bool IsCreature() const { return GetHigh() == HIGHGUID_UNIT; } + bool IsPet() const { return GetHigh() == HIGHGUID_PET; } + bool IsVehicle() const { return GetHigh() == HIGHGUID_VEHICLE; } + bool IsCreatureOrPet() const { return IsCreature() || IsPet(); } + bool IsCreatureOrVehicle() const { return IsCreature() || IsVehicle(); } + bool IsAnyTypeCreature() const { return IsCreature() || IsPet() || IsVehicle(); } + bool IsPlayer() const { return !IsEmpty() && GetHigh() == HIGHGUID_PLAYER; } + bool IsUnit() const { return IsAnyTypeCreature() || IsPlayer(); } + bool IsItem() const { return GetHigh() == HIGHGUID_ITEM; } + bool IsGameObject() const { return GetHigh() == HIGHGUID_GAMEOBJECT; } + bool IsDynamicObject() const { return GetHigh() == HIGHGUID_DYNAMICOBJECT; } + bool IsCorpse() const { return GetHigh() == HIGHGUID_CORPSE; } + bool IsTransport() const { return GetHigh() == HIGHGUID_TRANSPORT; } + bool IsMOTransport() const { return GetHigh() == HIGHGUID_MO_TRANSPORT; } + bool IsAnyTypeGameObject() const { return IsGameObject() || IsTransport() || IsMOTransport(); } + bool IsInstance() const { return GetHigh() == HIGHGUID_INSTANCE; } + bool IsGroup() const { return GetHigh() == HIGHGUID_GROUP; } + + static TypeID GetTypeId(HighGuid high) + { + switch (high) + { + case HIGHGUID_ITEM: return TYPEID_ITEM; + //case HIGHGUID_CONTAINER: return TYPEID_CONTAINER; HIGHGUID_CONTAINER==HIGHGUID_ITEM currently + case HIGHGUID_UNIT: return TYPEID_UNIT; + case HIGHGUID_PET: return TYPEID_UNIT; + case HIGHGUID_PLAYER: return TYPEID_PLAYER; + case HIGHGUID_GAMEOBJECT: return TYPEID_GAMEOBJECT; + case HIGHGUID_DYNAMICOBJECT: return TYPEID_DYNAMICOBJECT; + case HIGHGUID_CORPSE: return TYPEID_CORPSE; + case HIGHGUID_MO_TRANSPORT: return TYPEID_GAMEOBJECT; + case HIGHGUID_VEHICLE: return TYPEID_UNIT; + // unknown + case HIGHGUID_INSTANCE: + case HIGHGUID_GROUP: + default: return TYPEID_OBJECT; + } + } + + TypeID GetTypeId() const { return GetTypeId(GetHigh()); } + + bool operator!() const { return IsEmpty(); } + bool operator== (ObjectGuid const& guid) const { return GetRawValue() == guid.GetRawValue(); } + bool operator!= (ObjectGuid const& guid) const { return GetRawValue() != guid.GetRawValue(); } + bool operator< (ObjectGuid const& guid) const { return GetRawValue() < guid.GetRawValue(); } + + static char const* GetTypeName(HighGuid high); + char const* GetTypeName() const { return !IsEmpty() ? GetTypeName(GetHigh()) : "None"; } + std::string ToString() const; + + private: + static bool HasEntry(HighGuid high) + { + switch (high) + { + case HIGHGUID_ITEM: + case HIGHGUID_PLAYER: + case HIGHGUID_DYNAMICOBJECT: + case HIGHGUID_CORPSE: + case HIGHGUID_MO_TRANSPORT: + case HIGHGUID_INSTANCE: + case HIGHGUID_GROUP: + return false; + case HIGHGUID_GAMEOBJECT: + case HIGHGUID_TRANSPORT: + case HIGHGUID_UNIT: + case HIGHGUID_PET: + case HIGHGUID_VEHICLE: + default: + return true; + } + } + + bool HasEntry() const { return HasEntry(GetHigh()); } + + explicit ObjectGuid(uint32 const&) = delete; // no implementation, used to catch wrong type assignment + ObjectGuid(HighGuid, uint32, uint64 counter) = delete; // no implementation, used to catch wrong type assignment + ObjectGuid(HighGuid, uint64 counter) = delete; // no implementation, used to catch wrong type assignment + + uint64 m_guid; +}; + +// Some Shared defines +typedef std::set<ObjectGuid> GuidSet; +typedef std::list<ObjectGuid> GuidList; +typedef std::deque<ObjectGuid> GuidDeque; +typedef std::vector<ObjectGuid> GuidVector; + +// minimum buffer size for packed guid is 9 bytes +#define PACKED_GUID_MIN_BUFFER_SIZE 9 + +class PackedGuid +{ + friend ByteBuffer& operator<<(ByteBuffer& buf, PackedGuid const& guid); + + public: // constructors + explicit PackedGuid() : m_packedGuid(PACKED_GUID_MIN_BUFFER_SIZE) { m_packedGuid.appendPackGUID(0); } + explicit PackedGuid(uint64 guid) : m_packedGuid(PACKED_GUID_MIN_BUFFER_SIZE) { m_packedGuid.appendPackGUID(guid); } + explicit PackedGuid(ObjectGuid guid) : m_packedGuid(PACKED_GUID_MIN_BUFFER_SIZE) { m_packedGuid.appendPackGUID(guid.GetRawValue()); } + + void Set(uint64 guid) { m_packedGuid.wpos(0); m_packedGuid.appendPackGUID(guid); } + void Set(ObjectGuid guid) { m_packedGuid.wpos(0); m_packedGuid.appendPackGUID(guid.GetRawValue()); } + + size_t size() const { return m_packedGuid.size(); } + + private: // fields + ByteBuffer m_packedGuid; +}; + +template<HighGuid high> +class ObjectGuidGenerator +{ + public: // constructors + explicit ObjectGuidGenerator(uint32 start = 1) : m_nextGuid(start) {} + + void Set(uint32 val) { m_nextGuid = val; } + uint32 Generate(); + uint32 GetNextAfterMaxUsed() const { return m_nextGuid; } + + private: // fields + uint32 m_nextGuid; +}; + +ByteBuffer& operator<<(ByteBuffer& buf, ObjectGuid const& guid); +ByteBuffer& operator>>(ByteBuffer& buf, ObjectGuid& guid); + +ByteBuffer& operator<<(ByteBuffer& buf, PackedGuid const& guid); +ByteBuffer& operator>>(ByteBuffer& buf, PackedGuidReader const& guid); + +inline PackedGuid ObjectGuid::WriteAsPacked() const { return PackedGuid(*this); } + +namespace std +{ + template<> + class hash<ObjectGuid> + { + public: + size_t operator()(ObjectGuid const& key) const + { + return hash<uint64>()(key.GetRawValue()); + } + }; +} + +#endif // ObjectGuid_h__ diff --git a/src/server/game/Entities/Object/Updates/UpdateData.cpp b/src/server/game/Entities/Object/Updates/UpdateData.cpp index f6ac0bc67cc..98eaa3184e4 100644 --- a/src/server/game/Entities/Object/Updates/UpdateData.cpp +++ b/src/server/game/Entities/Object/Updates/UpdateData.cpp @@ -27,12 +27,12 @@ UpdateData::UpdateData() : m_blockCount(0) { } -void UpdateData::AddOutOfRangeGUID(std::set<uint64>& guids) +void UpdateData::AddOutOfRangeGUID(GuidSet& guids) { m_outOfRangeGUIDs.insert(guids.begin(), guids.end()); } -void UpdateData::AddOutOfRangeGUID(uint64 guid) +void UpdateData::AddOutOfRangeGUID(ObjectGuid guid) { m_outOfRangeGUIDs.insert(guid); } @@ -109,13 +109,11 @@ bool UpdateData::BuildPacket(WorldPacket* packet) if (!m_outOfRangeGUIDs.empty()) { - buf << (uint8) UPDATETYPE_OUT_OF_RANGE_OBJECTS; - buf << (uint32) m_outOfRangeGUIDs.size(); + buf << uint8(UPDATETYPE_OUT_OF_RANGE_OBJECTS); + buf << uint32(m_outOfRangeGUIDs.size()); - for (std::set<uint64>::const_iterator i = m_outOfRangeGUIDs.begin(); i != m_outOfRangeGUIDs.end(); ++i) - { - buf.appendPackGUID(*i); - } + for (GuidSet::const_iterator i = m_outOfRangeGUIDs.begin(); i != m_outOfRangeGUIDs.end(); ++i) + buf << i->WriteAsPacked(); } buf.append(m_data); diff --git a/src/server/game/Entities/Object/Updates/UpdateData.h b/src/server/game/Entities/Object/Updates/UpdateData.h index 1ec86192fab..d1305deabd8 100644 --- a/src/server/game/Entities/Object/Updates/UpdateData.h +++ b/src/server/game/Entities/Object/Updates/UpdateData.h @@ -20,6 +20,7 @@ #define __UPDATEDATA_H #include "ByteBuffer.h" +#include "ObjectGuid.h" #include <set> class WorldPacket; @@ -59,18 +60,18 @@ class UpdateData { } - void AddOutOfRangeGUID(std::set<uint64>& guids); - void AddOutOfRangeGUID(uint64 guid); + void AddOutOfRangeGUID(GuidSet& guids); + void AddOutOfRangeGUID(ObjectGuid guid); void AddUpdateBlock(const ByteBuffer &block); bool BuildPacket(WorldPacket* packet); bool HasData() const { return m_blockCount > 0 || !m_outOfRangeGUIDs.empty(); } void Clear(); - std::set<uint64> const& GetOutOfRangeGUIDs() const { return m_outOfRangeGUIDs; } + GuidSet const& GetOutOfRangeGUIDs() const { return m_outOfRangeGUIDs; } protected: uint32 m_blockCount; - std::set<uint64> m_outOfRangeGUIDs; + GuidSet m_outOfRangeGUIDs; ByteBuffer m_data; void Compress(void* dst, uint32 *dst_size, void* src, int src_size); diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index 37087663328..508a9f27fc8 100644 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -300,8 +300,8 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c if (summonSpellId) { WorldPacket data(SMSG_SPELL_GO, (8+8+4+4+2)); - data.append(owner->GetPackGUID()); - data.append(owner->GetPackGUID()); + data << owner->GetPackGUID(); + data << owner->GetPackGUID(); data << uint8(0); data << uint32(summonSpellId); data << uint32(256); // CAST_FLAG_UNKNOWN3 @@ -379,7 +379,7 @@ void Pet::SavePetToDB(PetSaveMode mode) return; // not save not player pets - if (!IS_PLAYER_GUID(GetOwnerGUID())) + if (!GetOwnerGUID().IsPlayer()) return; Player* owner = GetOwner(); @@ -414,7 +414,7 @@ void Pet::SavePetToDB(PetSaveMode mode) // current/stable/not_in_slot if (mode >= PET_SAVE_AS_CURRENT) { - uint32 ownerLowGUID = GUID_LOPART(GetOwnerGUID()); + uint32 ownerLowGUID = GetOwnerGUID().GetCounter(); std::string name = m_name; CharacterDatabase.EscapeString(name); trans = CharacterDatabase.BeginTransaction(); @@ -1262,7 +1262,7 @@ void Pet::_LoadAuras(uint32 timediff) int32 damage[3]; int32 baseDamage[3]; Field* fields = result->Fetch(); - uint64 caster_guid = fields[0].GetUInt64(); + ObjectGuid caster_guid(fields[0].GetUInt64()); // NULL guid stored - pet is the caster of the spell - see Pet::_SaveAuras if (!caster_guid) caster_guid = GetGUID(); @@ -1357,13 +1357,13 @@ void Pet::_SaveAuras(SQLTransaction& trans) } // don't save guid of caster in case we are caster of the spell - guid for pet is generated every pet load, so it won't match saved guid anyways - uint64 casterGUID = (itr->second->GetCasterGUID() == GetGUID()) ? 0 : itr->second->GetCasterGUID(); + ObjectGuid casterGUID = (itr->second->GetCasterGUID() == GetGUID()) ? ObjectGuid::Empty : itr->second->GetCasterGUID(); uint8 index = 0; stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PET_AURA); stmt->setUInt32(index++, m_charmInfo->GetPetNumber()); - stmt->setUInt64(index++, casterGUID); + stmt->setUInt64(index++, casterGUID.GetRawValue()); stmt->setUInt32(index++, itr->second->GetId()); stmt->setUInt8(index++, effMask); stmt->setUInt8(index++, recalculateMask); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index a5b97cbee3c..1df449d50c9 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -300,7 +300,7 @@ Item* TradeData::GetItem(TradeSlots slot) const return m_items[slot] ? m_player->GetItemByGuid(m_items[slot]) : NULL; } -bool TradeData::HasItem(uint64 itemGuid) const +bool TradeData::HasItem(ObjectGuid itemGuid) const { for (uint8 i = 0; i < TRADE_SLOT_COUNT; ++i) if (m_items[i] == itemGuid) @@ -309,7 +309,7 @@ bool TradeData::HasItem(uint64 itemGuid) const return false; } -TradeSlots TradeData::GetTradeSlotForItem(uint64 itemGuid) const +TradeSlots TradeData::GetTradeSlotForItem(ObjectGuid itemGuid) const { for (uint8 i = 0; i < TRADE_SLOT_COUNT; ++i) if (m_items[i] == itemGuid) @@ -325,7 +325,9 @@ Item* TradeData::GetSpellCastItem() const void TradeData::SetItem(TradeSlots slot, Item* item) { - uint64 itemGuid = item ? item->GetGUID() : 0; + ObjectGuid itemGuid; + if (item) + itemGuid = item->GetGUID(); if (m_items[slot] == itemGuid) return; @@ -347,7 +349,7 @@ void TradeData::SetItem(TradeSlots slot, Item* item) void TradeData::SetSpell(uint32 spell_id, Item* castItem /*= NULL*/) { - uint64 itemGuid = castItem ? castItem->GetGUID() : 0; + ObjectGuid itemGuid = castItem ? castItem->GetGUID() : ObjectGuid::Empty; if (m_spell == spell_id && m_spellCastItem == itemGuid) return; @@ -457,7 +459,7 @@ KillRewarder::KillRewarder(Player* killer, Unit* victim, bool isBattleGround) : if (victim->GetTypeId() == TYPEID_PLAYER) _isPvP = true; // or if its owned by player and its not a vehicle - else if (IS_PLAYER_GUID(victim->GetCharmerOrOwnerGUID())) + else if (victim->GetCharmerOrOwnerGUID().IsPlayer()) _isPvP = !victim->IsVehicle(); _InitGroupData(); @@ -666,7 +668,6 @@ Player::Player(WorldSession* session): Unit(true) m_session = session; - m_divider = 0; m_ingametime = 0; m_ExtraFlags = 0; @@ -678,9 +679,6 @@ Player::Player(WorldSession* session): Unit(true) if (!GetSession()->HasPermission(rbac::RBAC_PERM_CAN_FILTER_WHISPERS)) SetAcceptWhispers(true); - m_lootGuid = 0; - - m_comboTarget = 0; m_comboPoints = 0; m_usedTalentCount = 0; @@ -775,13 +773,13 @@ Player::Player(WorldSession* session): Unit(true) m_lastpetnumber = 0; ////////////////////Rest System///////////////////// - time_inn_enter=0; - inn_pos_mapid=0; - inn_pos_x=0; - inn_pos_y=0; - inn_pos_z=0; - m_rest_bonus=0; - rest_type=REST_TYPE_NO; + time_inn_enter = 0; + inn_pos_mapid = 0; + inn_pos_x = 0.0f; + inn_pos_y = 0.0f; + inn_pos_z = 0.0f; + m_rest_bonus = 0; + rest_type = REST_TYPE_NO; ////////////////////Rest System///////////////////// m_mailsLoaded = false; @@ -1948,7 +1946,7 @@ bool Player::BuildEnumData(PreparedQueryResult result, WorldPacket* data) return false; } - *data << uint64(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER)); + *data << ObjectGuid(HIGHGUID_PLAYER, guid); *data << fields[1].GetString(); // name *data << uint8(plrRace); // race *data << uint8(plrClass); // class @@ -2101,7 +2099,7 @@ uint8 Player::GetChatTag() const void Player::SendTeleportAckPacket() { WorldPacket data(MSG_MOVE_TELEPORT_ACK, 41); - data.append(GetPackGUID()); + data << GetPackGUID(); data << uint32(0); // this value increments every time BuildMovementPacket(&data); GetSession()->SendPacket(&data); @@ -2169,7 +2167,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati // The player was ported to another map and loses the duel immediately. // We have to perform this check before the teleport, otherwise the // ObjectAccessor won't find the flag. - if (duel && GetMapId() != mapid && GetMap()->GetGameObject(GetUInt64Value(PLAYER_DUEL_ARBITER))) + if (duel && GetMapId() != mapid && GetMap()->GetGameObject(GetGuidValue(PLAYER_DUEL_ARBITER))) DuelComplete(DUEL_FLED); if (GetMapId() == mapid) @@ -2252,7 +2250,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati return true; } - SetSelection(0); + SetSelection(ObjectGuid::Empty); CombatStop(); @@ -2706,7 +2704,7 @@ bool Player::CanInteractWithQuestGiver(Object* questGiver) return false; } -Creature* Player::GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask) +Creature* Player::GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask) { // unit checks if (!guid) @@ -2757,7 +2755,7 @@ Creature* Player::GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask) return creature; } -GameObject* Player::GetGameObjectIfCanInteractWith(uint64 guid, GameobjectTypes type) const +GameObject* Player::GetGameObjectIfCanInteractWith(ObjectGuid guid, GameobjectTypes type) const { if (GameObject* go = GetMap()->GetGameObject(guid)) { @@ -2925,7 +2923,7 @@ void Player::UninviteFromGroup() } } -void Player::RemoveFromGroup(Group* group, uint64 guid, RemoveMethod method /* = GROUP_REMOVEMETHOD_DEFAULT*/, uint64 kicker /* = 0 */, const char* reason /* = NULL */) +void Player::RemoveFromGroup(Group* group, ObjectGuid guid, RemoveMethod method /* = GROUP_REMOVEMETHOD_DEFAULT*/, ObjectGuid kicker /* = ObjectGuid::Empty */, const char* reason /* = NULL */) { if (!group) return; @@ -2936,7 +2934,7 @@ void Player::RemoveFromGroup(Group* group, uint64 guid, RemoveMethod method /* = void Player::SendLogXPGain(uint32 GivenXP, Unit* victim, uint32 BonusXP, bool recruitAFriend, float /*group_rate*/) { WorldPacket data(SMSG_LOG_XPGAIN, 21); // guess size? - data << uint64(victim ? victim->GetGUID() : 0); // guid + data << uint64(victim ? victim->GetGUID() : ObjectGuid::Empty); data << uint32(GivenXP + BonusXP); // given experience data << uint8(victim ? 0 : 1); // 00-kill_xp type, 01-non_kill_xp type @@ -4621,19 +4619,19 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell * @param updateRealmChars when this flag is set, the amount of characters on that realm will be updated in the realmlist * @param deleteFinally if this flag is set, the config option will be ignored and the character will be permanently removed from the database */ -void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmChars, bool deleteFinally) +void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRealmChars, bool deleteFinally) { // Avoid realm-update for non-existing account if (accountId == 0) updateRealmChars = false; // Convert guid to low GUID for CharacterNameData, but also other methods on success - uint32 guid = GUID_LOPART(playerguid); + uint32 guid = playerguid.GetCounter(); uint32 charDelete_method = sWorld->getIntConfig(CONFIG_CHARDELETE_METHOD); if (deleteFinally) charDelete_method = CHAR_DELETE_REMOVE; - else if (CharacterNameData const* nameData = sWorld->GetCharacterNameData(guid)) // To avoid a query, we select loaded data. If it doesn't exist, return. + else if (CharacterNameData const* nameData = sWorld->GetCharacterNameData(playerguid)) // To avoid a query, we select loaded data. If it doesn't exist, return. { // Define the required variables uint32 charDelete_minLvl = sWorld->getIntConfig(nameData->m_class != CLASS_DEATH_KNIGHT ? CONFIG_CHARDELETE_MIN_LEVEL : CONFIG_CHARDELETE_HEROIC_MIN_LEVEL); @@ -4650,7 +4648,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC if (uint32 guildId = GetGuildIdFromDB(playerguid)) if (Guild* guild = sGuildMgr->GetGuildById(guildId)) - guild->DeleteMember(guid, false, false, true); + guild->DeleteMember(playerguid, false, false, true); // remove from arena teams LeaveAllArenaTeams(playerguid); @@ -4739,7 +4737,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC } Item* pItem = NewItemOrBag(itemProto); - if (!pItem->LoadFromDB(item_guidlow, MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER), itemFields, item_template)) + if (!pItem->LoadFromDB(item_guidlow, playerguid, itemFields, item_template)) { pItem->FSetState(ITEM_REMOVED); pItem->SaveToDB(trans); // it also deletes item object! @@ -4756,7 +4754,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC stmt->setUInt32(0, mail_id); trans->Append(stmt); - uint32 pl_account = sObjectMgr->GetPlayerAccountIdByGUID(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER)); + uint32 pl_account = sObjectMgr->GetPlayerAccountIdByGUID(playerguid); draft.AddMoney(money).SendReturnToSender(pl_account, guid, sender, trans); } @@ -4787,7 +4785,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC { do { - if (Player* pFriend = ObjectAccessor::FindPlayer(MAKE_NEW_GUID((*resultFriends)[0].GetUInt32(), 0, HIGHGUID_PLAYER))) + if (Player* pFriend = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, 0, (*resultFriends)[0].GetUInt32()))) { if (pFriend->IsInWorld()) { @@ -4960,7 +4958,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC if (updateRealmChars) sWorld->UpdateRealmCharCount(accountId); - sWorld->DeleteCharacterNameData(guid); + sWorld->DeleteCharacterNameData(playerguid); } /** @@ -4998,7 +4996,7 @@ void Player::DeleteOldCharacters(uint32 keepDays) do { Field* fields = result->Fetch(); - Player::DeleteFromDB(fields[0].GetUInt32(), fields[1].GetUInt32(), true, true); + Player::DeleteFromDB(ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32()), fields[1].GetUInt32(), true, true); } while (result->NextRow()); } @@ -5017,7 +5015,7 @@ void Player::SetMovement(PlayerMovementType pType) TC_LOG_ERROR("entities.player", "Player::SetMovement: Unsupported move type (%d), data not sent to client.", pType); return; } - data.append(GetPackGUID()); + data << GetPackGUID(); data << uint32(0); GetSession()->SendPacket(&data); } @@ -5029,7 +5027,7 @@ void Player::SetMovement(PlayerMovementType pType) void Player::BuildPlayerRepop() { WorldPacket data(SMSG_PRE_RESURRECT, GetPackGUID().size()); - data.append(GetPackGUID()); + data << GetPackGUID(); GetSession()->SendPacket(&data); if (getRace() == RACE_NIGHTELF) @@ -6627,13 +6625,13 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type) { if (button >= MAX_ACTION_BUTTONS) { - TC_LOG_ERROR("entities.player", "Action %u not added into button %u for player %s (GUID: %u): button must be < %u", action, button, GetName().c_str(), GUID_LOPART(GetGUID()), MAX_ACTION_BUTTONS ); + TC_LOG_ERROR("entities.player", "Action %u not added into button %u for player %s (GUID: %u): button must be < %u", action, button, GetName().c_str(), GetGUIDLow(), MAX_ACTION_BUTTONS ); return false; } if (action >= MAX_ACTION_BUTTON_ACTION_VALUE) { - TC_LOG_ERROR("entities.player", "Action %u not added into button %u for player %s (GUID: %u): action must be < %u", action, button, GetName().c_str(), GUID_LOPART(GetGUID()), MAX_ACTION_BUTTON_ACTION_VALUE); + TC_LOG_ERROR("entities.player", "Action %u not added into button %u for player %s (GUID: %u): action must be < %u", action, button, GetName().c_str(), GetGUIDLow(), MAX_ACTION_BUTTON_ACTION_VALUE); return false; } @@ -6642,20 +6640,20 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type) case ACTION_BUTTON_SPELL: if (!sSpellMgr->GetSpellInfo(action)) { - TC_LOG_ERROR("entities.player", "Spell action %u not added into button %u for player %s (GUID: %u): spell not exist", action, button, GetName().c_str(), GUID_LOPART(GetGUID())); + TC_LOG_ERROR("entities.player", "Spell action %u not added into button %u for player %s (GUID: %u): spell not exist", action, button, GetName().c_str(), GetGUIDLow()); return false; } if (!HasSpell(action)) { - TC_LOG_ERROR("entities.player", "Spell action %u not added into button %u for player %s (GUID: %u): player don't known this spell", action, button, GetName().c_str(), GUID_LOPART(GetGUID())); + TC_LOG_ERROR("entities.player", "Spell action %u not added into button %u for player %s (GUID: %u): player don't known this spell", action, button, GetName().c_str(), GetGUIDLow()); return false; } break; case ACTION_BUTTON_ITEM: if (!sObjectMgr->GetItemTemplate(action)) { - TC_LOG_ERROR("entities.player", "Item action %u not added into button %u for player %s (GUID: %u): item not exist", action, button, GetName().c_str(), GUID_LOPART(GetGUID())); + TC_LOG_ERROR("entities.player", "Item action %u not added into button %u for player %s (GUID: %u): item not exist", action, button, GetName().c_str(), GetGUIDLow()); return false; } break; @@ -7131,7 +7129,7 @@ bool Player::RewardHonor(Unit* victim, uint32 groupsize, int32 honor, bool pvpto if (HasAura(SPELL_AURA_PLAYER_INACTIVE)) return false; - uint64 victim_guid = 0; + ObjectGuid victim_guid; uint32 victim_rank = 0; // need call before fields update to have chance move yesterday data to appropriate fields before today data change. @@ -7176,13 +7174,13 @@ bool Player::RewardHonor(Unit* victim, uint32 groupsize, int32 honor, bool pvpto // title[15..28] -> rank[5..18] // title[other] -> 0 if (victim_title == 0) - victim_guid = 0; // Don't show HK: <rank> message, only log. + victim_guid.Clear(); // Don't show HK: <rank> message, only log. else if (victim_title < 15) victim_rank = victim_title + 4; else if (victim_title < 29) victim_rank = victim_title - 14 + 4; else - victim_guid = 0; // Don't show HK: <rank> message, only log. + victim_guid.Clear(); // Don't show HK: <rank> message, only log. honor_f = std::ceil(Trinity::Honor::hk_honor_at_level_f(k_level) * (v_level - k_grey) / (k_level - k_grey)); @@ -7318,10 +7316,10 @@ void Player::ModifyArenaPoints(int32 value, SQLTransaction trans) } } -uint32 Player::GetGuildIdFromDB(uint64 guid) +uint32 Player::GetGuildIdFromDB(ObjectGuid guid) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER); - stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt32(0, guid.GetCounter()); PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) @@ -7331,10 +7329,10 @@ uint32 Player::GetGuildIdFromDB(uint64 guid) return id; } -uint8 Player::GetRankFromDB(uint64 guid) +uint8 Player::GetRankFromDB(ObjectGuid guid) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER); - stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt32(0, guid.GetCounter()); PreparedQueryResult result = CharacterDatabase.Query(stmt); if (result) @@ -7356,10 +7354,10 @@ void Player::SetArenaTeamInfoField(uint8 slot, ArenaTeamInfoType type, uint32 va SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + type, value); } -uint32 Player::GetArenaTeamIdFromDB(uint64 guid, uint8 type) +uint32 Player::GetArenaTeamIdFromDB(ObjectGuid guid, uint8 type) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ARENA_TEAM_ID_BY_PLAYER_GUID); - stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt32(0, guid.GetCounter()); stmt->setUInt8(1, type); PreparedQueryResult result = CharacterDatabase.Query(stmt); @@ -7370,9 +7368,9 @@ uint32 Player::GetArenaTeamIdFromDB(uint64 guid, uint8 type) return id; } -uint32 Player::GetZoneIdFromDB(uint64 guid) +uint32 Player::GetZoneIdFromDB(ObjectGuid guid) { - uint32 guidLow = GUID_LOPART(guid); + uint32 guidLow = guid.GetCounter(); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_ZONE); stmt->setUInt32(0, guidLow); PreparedQueryResult result = CharacterDatabase.Query(stmt); @@ -7416,10 +7414,10 @@ uint32 Player::GetZoneIdFromDB(uint64 guid) return zone; } -uint32 Player::GetLevelFromDB(uint64 guid) +uint32 Player::GetLevelFromDB(ObjectGuid guid) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_LEVEL); - stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt32(0, guid.GetCounter()); PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) @@ -7583,7 +7581,7 @@ void Player::CheckDuelDistance(time_t currTime) if (!duel) return; - uint64 duelFlagGUID = GetUInt64Value(PLAYER_DUEL_ARBITER); + ObjectGuid duelFlagGUID = GetGuidValue(PLAYER_DUEL_ARBITER); GameObject* obj = GetMap()->GetGameObject(duelFlagGUID); if (!obj) return; @@ -7683,7 +7681,7 @@ void Player::DuelComplete(DuelCompleteType type) duel->opponent->CastSpell(duel->opponent, 52852, true); //Remove Duel Flag object - GameObject* obj = GetMap()->GetGameObject(GetUInt64Value(PLAYER_DUEL_ARBITER)); + GameObject* obj = GetMap()->GetGameObject(GetGuidValue(PLAYER_DUEL_ARBITER)); if (obj) duel->initiator->RemoveGameObject(obj, true); @@ -7720,9 +7718,9 @@ void Player::DuelComplete(DuelCompleteType type) duel->opponent->ClearComboPoints(); //cleanups - SetUInt64Value(PLAYER_DUEL_ARBITER, 0); + SetGuidValue(PLAYER_DUEL_ARBITER, ObjectGuid::Empty); SetUInt32Value(PLAYER_DUEL_TEAM, 0); - duel->opponent->SetUInt64Value(PLAYER_DUEL_ARBITER, 0); + duel->opponent->SetGuidValue(PLAYER_DUEL_ARBITER, ObjectGuid::Empty); duel->opponent->SetUInt32Value(PLAYER_DUEL_TEAM, 0); delete duel->opponent->duel; @@ -8728,23 +8726,23 @@ void Player::RemovedInsignia(Player* looterPlr) looterPlr->SendLoot(bones->GetGUID(), LOOT_INSIGNIA); } -void Player::SendLootRelease(uint64 guid) +void Player::SendLootRelease(ObjectGuid guid) { WorldPacket data(SMSG_LOOT_RELEASE_RESPONSE, (8+1)); data << uint64(guid) << uint8(1); SendDirectMessage(&data); } -void Player::SendLoot(uint64 guid, LootType loot_type) +void Player::SendLoot(ObjectGuid guid, LootType loot_type) { - if (uint64 lguid = GetLootGUID()) + if (ObjectGuid lguid = GetLootGUID()) m_session->DoLootRelease(lguid); Loot* loot = 0; PermissionTypes permission = ALL_PERMISSION; TC_LOG_DEBUG("loot", "Player::SendLoot"); - if (IS_GAMEOBJECT_GUID(guid)) + if (guid.IsGameObject()) { TC_LOG_DEBUG("loot", "IS_GAMEOBJECT_GUID(guid)"); GameObject* go = GetMap()->GetGameObject(guid); @@ -8841,7 +8839,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type) permission = ALL_PERMISSION; } } - else if (IS_ITEM_GUID(guid)) + else if (guid.IsItem()) { Item* item = GetItemByGuid(guid); @@ -8886,7 +8884,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type) } } } - else if (IS_CORPSE_GUID(guid)) // remove insignia + else if (guid.IsCorpse()) // remove insignia { Corpse* bones = ObjectAccessor::GetCorpse(*this, guid); @@ -9066,11 +9064,11 @@ void Player::SendLoot(uint64 guid, LootType loot_type) else SendLootError(GetLootGUID(), LOOT_ERROR_DIDNT_KILL); - if (loot_type == LOOT_CORPSE && !IS_ITEM_GUID(guid)) + if (loot_type == LOOT_CORPSE && !guid.IsItem()) SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_LOOTING); } -void Player::SendLootError(uint64 guid, LootError error) +void Player::SendLootError(ObjectGuid guid, LootError error) { WorldPacket data(SMSG_LOOT_RESPONSE, 10); data << uint64(guid); @@ -9762,14 +9760,14 @@ uint32 Player::GetXPRestBonus(uint32 xp) return rested_bonus; } -void Player::SetBindPoint(uint64 guid) +void Player::SetBindPoint(ObjectGuid guid) { WorldPacket data(SMSG_BINDER_CONFIRM, 8); data << uint64(guid); GetSession()->SendPacket(&data); } -void Player::SendTalentWipeConfirm(uint64 guid) +void Player::SendTalentWipeConfirm(ObjectGuid guid) { WorldPacket data(MSG_TALENT_WIPE_CONFIRM, (8+4)); data << uint64(guid); @@ -10160,7 +10158,7 @@ uint32 Player::GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipIte return count; } -Item* Player::GetItemByGuid(uint64 guid) const +Item* Player::GetItemByGuid(ObjectGuid guid) const { for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i) if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) @@ -12250,9 +12248,9 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool if (!pBag) { m_items[slot] = pItem; - SetUInt64Value(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), pItem->GetGUID()); - pItem->SetUInt64Value(ITEM_FIELD_CONTAINED, GetGUID()); - pItem->SetUInt64Value(ITEM_FIELD_OWNER, GetGUID()); + SetGuidValue(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), pItem->GetGUID()); + pItem->SetGuidValue(ITEM_FIELD_CONTAINED, GetGUID()); + pItem->SetGuidValue(ITEM_FIELD_OWNER, GetGUID()); pItem->SetSlot(slot); pItem->SetContainer(NULL); @@ -12497,9 +12495,9 @@ void Player::VisualizeItem(uint8 slot, Item* pItem) TC_LOG_DEBUG("entities.player.items", "STORAGE: EquipItem slot = %u, item = %u", slot, pItem->GetEntry()); m_items[slot] = pItem; - SetUInt64Value(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), pItem->GetGUID()); - pItem->SetUInt64Value(ITEM_FIELD_CONTAINED, GetGUID()); - pItem->SetUInt64Value(ITEM_FIELD_OWNER, GetGUID()); + SetGuidValue(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), pItem->GetGUID()); + pItem->SetGuidValue(ITEM_FIELD_CONTAINED, GetGUID()); + pItem->SetGuidValue(ITEM_FIELD_OWNER, GetGUID()); pItem->SetSlot(slot); pItem->SetContainer(NULL); @@ -12579,7 +12577,7 @@ void Player::RemoveItem(uint8 bag, uint8 slot, bool update) } m_items[slot] = NULL; - SetUInt64Value(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), 0); + SetGuidValue(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), ObjectGuid::Empty); if (slot < EQUIPMENT_SLOT_END) SetVisibleItemSlot(slot, NULL); @@ -12587,7 +12585,7 @@ void Player::RemoveItem(uint8 bag, uint8 slot, bool update) else if (Bag* pBag = GetBagByPos(bag)) pBag->RemoveItem(slot, update); - pItem->SetUInt64Value(ITEM_FIELD_CONTAINED, 0); + pItem->SetGuidValue(ITEM_FIELD_CONTAINED, ObjectGuid::Empty); // pItem->SetUInt64Value(ITEM_FIELD_OWNER, 0); not clear owner at remove (it will be set at store). This used in mail and auction code pItem->SetSlot(NULL_SLOT); if (IsInWorld() && update) @@ -12676,7 +12674,7 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update) if (bag == INVENTORY_SLOT_BAG_0) { - SetUInt64Value(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), 0); + SetGuidValue(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), ObjectGuid::Empty); // equipment and equipped bags can have applied bonuses if (slot < INVENTORY_SLOT_BAG_END) @@ -12733,7 +12731,7 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update) } //pItem->SetOwnerGUID(0); - pItem->SetUInt64Value(ITEM_FIELD_CONTAINED, 0); + pItem->SetGuidValue(ITEM_FIELD_CONTAINED, ObjectGuid::Empty); pItem->SetSlot(NULL_SLOT); pItem->SetState(ITEM_REMOVED, this); } @@ -13537,7 +13535,7 @@ void Player::AddItemToBuyBackSlot(Item* pItem) uint32 etime = uint32(base - m_logintime + (30 * 3600)); uint32 eslot = slot - BUYBACK_SLOT_START; - SetUInt64Value(PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + (eslot * 2), pItem->GetGUID()); + SetGuidValue(PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + (eslot * 2), pItem->GetGUID()); if (ItemTemplate const* proto = pItem->GetTemplate()) SetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, proto->SellPrice * pItem->GetCount()); else @@ -13574,7 +13572,7 @@ void Player::RemoveItemFromBuyBackSlot(uint32 slot, bool del) m_items[slot] = NULL; uint32 eslot = slot - BUYBACK_SLOT_START; - SetUInt64Value(PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + (eslot * 2), 0); + SetGuidValue(PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + (eslot * 2), ObjectGuid::Empty); SetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, 0); SetUInt32Value(PLAYER_FIELD_BUYBACK_TIMESTAMP_1 + eslot, 0); @@ -13592,8 +13590,8 @@ void Player::SendEquipError(InventoryResult msg, Item* pItem, Item* pItem2, uint if (msg != EQUIP_ERR_OK) { - data << uint64(pItem ? pItem->GetGUID() : 0); - data << uint64(pItem2 ? pItem2->GetGUID() : 0); + data << uint64(pItem ? pItem->GetGUID() : ObjectGuid::Empty); + data << uint64(pItem2 ? pItem2->GetGUID() : ObjectGuid::Empty); data << uint8(0); // bag type subclass, used with EQUIP_ERR_EVENT_AUTOEQUIP_BIND_CONFIRM and EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG2 switch (msg) @@ -13631,7 +13629,7 @@ void Player::SendBuyError(BuyResult msg, Creature* creature, uint32 item, uint32 { TC_LOG_DEBUG("network", "WORLD: Sent SMSG_BUY_FAILED"); WorldPacket data(SMSG_BUY_FAILED, (8+4+4+1)); - data << uint64(creature ? creature->GetGUID() : 0); + data << uint64(creature ? creature->GetGUID() : ObjectGuid::Empty); data << uint32(item); if (param > 0) data << uint32(param); @@ -13639,11 +13637,11 @@ void Player::SendBuyError(BuyResult msg, Creature* creature, uint32 item, uint32 GetSession()->SendPacket(&data); } -void Player::SendSellError(SellResult msg, Creature* creature, uint64 guid, uint32 param) +void Player::SendSellError(SellResult msg, Creature* creature, ObjectGuid guid, uint32 param) { TC_LOG_DEBUG("network", "WORLD: Sent SMSG_SELL_ITEM"); WorldPacket data(SMSG_SELL_ITEM, (8+8+(param?4:0)+1)); // last check 2.0.10 - data << uint64(creature ? creature->GetGUID() : 0); + data << uint64(creature ? creature->GetGUID() : ObjectGuid::Empty); data << uint64(guid); if (param > 0) data << uint32(param); @@ -14532,7 +14530,7 @@ void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 men return; uint32 gossipOptionId = item->OptionType; - uint64 guid = source->GetGUID(); + ObjectGuid guid = source->GetGUID(); if (source->GetTypeId() == TYPEID_GAMEOBJECT) { @@ -14699,7 +14697,7 @@ uint32 Player::GetDefaultGossipMenuForSource(WorldObject* source) /*** QUEST SYSTEM ***/ /*********************************************************/ -void Player::PrepareQuestMenu(uint64 guid) +void Player::PrepareQuestMenu(ObjectGuid guid) { QuestRelationBounds objectQR; QuestRelationBounds objectQIR; @@ -14759,7 +14757,7 @@ void Player::PrepareQuestMenu(uint64 guid) } } -void Player::SendPreparedQuest(uint64 guid) +void Player::SendPreparedQuest(ObjectGuid guid) { QuestMenu& questMenu = PlayerTalkClass->GetQuestMenu(); if (questMenu.Empty()) @@ -14850,7 +14848,7 @@ bool Player::IsActiveQuest(uint32 quest_id) const return m_QuestStatus.find(quest_id) != m_QuestStatus.end(); } -Quest const* Player::GetNextQuest(uint64 guid, Quest const* quest) +Quest const* Player::GetNextQuest(ObjectGuid guid, Quest const* quest) { QuestRelationBounds objectQR; @@ -16426,7 +16424,7 @@ void Player::ItemRemovedQuestCheck(uint32 entry, uint32 count) UpdateForQuestWorldObjects(); } -void Player::KilledMonster(CreatureTemplate const* cInfo, uint64 guid) +void Player::KilledMonster(CreatureTemplate const* cInfo, ObjectGuid guid) { ASSERT(cInfo); @@ -16435,10 +16433,10 @@ void Player::KilledMonster(CreatureTemplate const* cInfo, uint64 guid) for (uint8 i = 0; i < MAX_KILL_CREDIT; ++i) if (cInfo->KillCredit[i]) - KilledMonsterCredit(cInfo->KillCredit[i], 0); + KilledMonsterCredit(cInfo->KillCredit[i], ObjectGuid::Empty); } -void Player::KilledMonsterCredit(uint32 entry, uint64 guid /*= 0*/) +void Player::KilledMonsterCredit(uint32 entry, ObjectGuid guid /*= ObjectGuid::Empty*/) { uint16 addkillcount = 1; uint32 real_entry = entry; @@ -16540,7 +16538,7 @@ void Player::KilledPlayerCredit() } } -void Player::KillCreditGO(uint32 entry, uint64 guid) +void Player::KillCreditGO(uint32 entry, ObjectGuid guid) { uint16 addCastCount = 1; for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i) @@ -16594,7 +16592,7 @@ void Player::KillCreditGO(uint32 entry, uint64 guid) } } -void Player::TalkedToCreature(uint32 entry, uint64 guid) +void Player::TalkedToCreature(uint32 entry, ObjectGuid guid) { uint16 addTalkCount = 1; for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i) @@ -16904,11 +16902,11 @@ void Player::SendQuestUpdateAddItem(Quest const* /*quest*/, uint32 /*item_idx*/, GetSession()->SendPacket(&data); } -void Player::SendQuestUpdateAddCreatureOrGo(Quest const* quest, uint64 guid, uint32 creatureOrGO_idx, uint16 old_count, uint16 add_count) +void Player::SendQuestUpdateAddCreatureOrGo(Quest const* quest, ObjectGuid guid, uint32 creatureOrGO_idx, uint16 old_count, uint16 add_count) { ASSERT(old_count + add_count < 65536 && "mob/GO count store in 16 bits 2^16 = 65536 (0..65536)"); - int32 entry = quest->RequiredNpcOrGo[ creatureOrGO_idx ]; + int32 entry = quest->RequiredNpcOrGo[creatureOrGO_idx]; if (entry < 0) // client expected gameobject template id in form (id|0x80000000) entry = (-entry) | 0x80000000; @@ -16924,7 +16922,7 @@ void Player::SendQuestUpdateAddCreatureOrGo(Quest const* quest, uint64 guid, uin uint16 log_slot = FindQuestSlot(quest->GetQuestId()); if (log_slot < MAX_QUEST_LOG_SIZE) - SetQuestSlotCounter(log_slot, creatureOrGO_idx, GetQuestSlotCounter(log_slot, creatureOrGO_idx)+add_count); + SetQuestSlotCounter(log_slot, creatureOrGO_idx, GetQuestSlotCounter(log_slot, creatureOrGO_idx) + add_count); } void Player::SendQuestUpdateAddPlayer(Quest const* quest, uint16 old_count, uint16 add_count) @@ -17078,10 +17076,10 @@ void Player::_LoadBGData(PreparedQueryResult result) m_bgData.mountSpell = fields[9].GetUInt32(); } -bool Player::LoadPositionFromDB(uint32& mapid, float& x, float& y, float& z, float& o, bool& in_flight, uint64 guid) +bool Player::LoadPositionFromDB(uint32& mapid, float& x, float& y, float& z, float& o, bool& in_flight, ObjectGuid guid) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_POSITION); - stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt32(0, guid.GetCounter()); PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) @@ -17138,7 +17136,7 @@ bool Player::isBeingLoaded() const return GetSession()->PlayerLoading(); } -bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) +bool Player::LoadFromDB(ObjectGuid guid, SQLQueryHolder *holder) { //// 0 1 2 3 4 5 6 7 8 9 10 11 //QueryResult* result = CharacterDatabase.PQuery("SELECT guid, account, name, race, class, gender, level, xp, money, playerBytes, playerBytes2, playerFlags, " @@ -17155,7 +17153,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) { std::string name = "<unknown>"; sObjectMgr->GetPlayerNameByGUID(guid, name); - TC_LOG_ERROR("entities.player", "Player %s (GUID: %u) not found in table `characters`, can't load. ", name.c_str(), guid); + TC_LOG_ERROR("entities.player", "Player %s %s not found in table `characters`, can't load. ", name.c_str(), guid.ToString().c_str()); return false; } @@ -17167,17 +17165,17 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) // player should be able to load/delete character only with correct account! if (dbAccountId != GetSession()->GetAccountId()) { - TC_LOG_ERROR("entities.player", "Player (GUID: %u) loading from wrong account (is: %u, should be: %u)", guid, GetSession()->GetAccountId(), dbAccountId); + TC_LOG_ERROR("entities.player", "Player %s loading from wrong account (is: %u, should be: %u)", guid.ToString().c_str(), GetSession()->GetAccountId(), dbAccountId); return false; } if (holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_BANNED)) { - TC_LOG_ERROR("entities.player", "Player (GUID: %u) is banned, can't load.", guid); + TC_LOG_ERROR("entities.player", "%s is banned, can't load.", guid.ToString().c_str()); return false; } - Object::_Create(guid, 0, HIGHGUID_PLAYER); + Object::_Create(guid.GetCounter(), 0, HIGHGUID_PLAYER); m_name = fields[2].GetString(); @@ -17188,18 +17186,18 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG); stmt->setUInt16(0, uint16(AT_LOGIN_RENAME)); - stmt->setUInt32(1, guid); + stmt->setUInt32(1, guid.GetCounter()); CharacterDatabase.Execute(stmt); return false; } // overwrite possible wrong/corrupted guid - SetUInt64Value(OBJECT_FIELD_GUID, MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER)); + SetGuidValue(OBJECT_FIELD_GUID, guid); uint8 gender = fields[5].GetUInt8(); if (!IsValidGender(gender)) { - TC_LOG_ERROR("entities.player", "Player (GUID: %u) has wrong gender (%u), can't be loaded.", guid, gender); + TC_LOG_ERROR("entities.player", "Player %s has wrong gender (%u), can't be loaded.", guid.ToString().c_str(), gender); return false; } @@ -17214,7 +17212,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass()); if (!info) { - TC_LOG_ERROR("entities.player", "Player (GUID: %u) has wrong race/class (%u/%u), can't be loaded.", guid, getRace(), getClass()); + TC_LOG_ERROR("entities.player", "Player %s has wrong race/class (%u/%u), can't be loaded.", guid.ToString().c_str(), getRace(), getClass()); return false; } @@ -17254,7 +17252,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) // cleanup inventory related item value fields (its will be filled correctly in _LoadInventory) for (uint8 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; ++slot) { - SetUInt64Value(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), 0); + SetGuidValue(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), ObjectGuid::Empty); SetVisibleItemSlot(slot, NULL); delete m_items[slot]; @@ -17330,7 +17328,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) MapEntry const* mapEntry = sMapStore.LookupEntry(mapId); if (!mapEntry || !IsPositionValid()) { - TC_LOG_ERROR("entities.player", "Player (guidlow %d) have invalid coordinates (MapId: %u X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); + TC_LOG_ERROR("entities.player", "Player %s have invalid coordinates (MapId: %u X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.", + guid.ToString().c_str(), mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); RelocateToHomebind(); } // Player was saved in Arena or Bg @@ -17370,7 +17369,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) //if (mapId == MAPID_INVALID) -- code kept for reference if (int16(mapId) == int16(-1)) // Battleground Entry Point not found (???) { - TC_LOG_ERROR("entities.player", "Player (guidlow %d) was in BG in database, but BG was not found, and entry point was invalid! Teleport to default race/class locations.", guid); + TC_LOG_ERROR("entities.player", "Player %s was in BG in database, but BG was not found, and entry point was invalid! Teleport to default race/class locations.", + guid.ToString().c_str()); RelocateToHomebind(); } else @@ -17383,7 +17383,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) // currently we do not support transport in bg else if (transLowGUID) { - uint64 transGUID = MAKE_NEW_GUID(transLowGUID, 0, HIGHGUID_MO_TRANSPORT); + ObjectGuid transGUID(HIGHGUID_MO_TRANSPORT, transLowGUID); Transport* transport = NULL; if (GameObject* go = HashMapHolder<GameObject>::Find(transGUID)) @@ -17401,8 +17401,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) std::fabs(m_movementInfo.transport.pos.GetPositionY()) > 250.0f || std::fabs(m_movementInfo.transport.pos.GetPositionZ()) > 250.0f) { - TC_LOG_ERROR("entities.player", "Player (guidlow %d) have invalid transport coordinates (X: %f Y: %f Z: %f O: %f). Teleport to bind location.", - guid, x, y, z, o); + TC_LOG_ERROR("entities.player", "Player %s have invalid transport coordinates (X: %f Y: %f Z: %f O: %f). Teleport to bind location.", + guid.ToString().c_str(), x, y, z, o); m_movementInfo.transport.Reset(); @@ -17418,8 +17418,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) } else { - TC_LOG_ERROR("entities.player", "Player (guidlow %u) have problems with transport guid (%u). Teleport to bind location.", - guid, transLowGUID); + TC_LOG_ERROR("entities.player", "Player %s have problems with transport guid (%u). Teleport to bind location.", + guid.ToString().c_str(), transLowGUID); RelocateToHomebind(); } @@ -17527,7 +17527,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) } else { - TC_LOG_ERROR("entities.player", "Player %s (guid: %d) Map: %u, X: %f, Y: %f, Z: %f, O: %f. Areatrigger not found.", m_name.c_str(), guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); + TC_LOG_ERROR("entities.player", "Player %s %s Map: %u, X: %f, Y: %f, Z: %f, O: %f. Areatrigger not found.", + m_name.c_str(), guid.ToString().c_str(), mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); map = NULL; } } @@ -17539,7 +17540,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) map = sMapMgr->CreateMap(mapId, this); if (!map) { - TC_LOG_ERROR("entities.player", "Player %s (guid: %d) Map: %u, X: %f, Y: %f, Z: %f, O: %f. Invalid default map coordinates or instance couldn't be created.", m_name.c_str(), guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); + TC_LOG_ERROR("entities.player", "Player %s %s Map: %u, X: %f, Y: %f, Z: %f, O: %f. Invalid default map coordinates or instance couldn't be created.", + m_name.c_str(), guid.ToString().c_str(), mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); return false; } } @@ -17604,16 +17606,16 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) m_deathExpireTime = now + MAX_DEATH_COUNT * DEATH_EXPIRE_STEP - 1; // clear channel spell data (if saved at channel spell casting) - SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, 0); + SetChannelObjectGuid(ObjectGuid::Empty); SetUInt32Value(UNIT_CHANNEL_SPELL, 0); // clear charm/summon related fields - SetOwnerGUID(0); - SetUInt64Value(UNIT_FIELD_CHARMEDBY, 0); - SetUInt64Value(UNIT_FIELD_CHARM, 0); - SetUInt64Value(UNIT_FIELD_SUMMON, 0); - SetUInt64Value(PLAYER_FARSIGHT, 0); - SetCreatorGUID(0); + SetOwnerGUID(ObjectGuid::Empty); + SetGuidValue(UNIT_FIELD_CHARMEDBY, ObjectGuid::Empty); + SetGuidValue(UNIT_FIELD_CHARM, ObjectGuid::Empty); + SetGuidValue(UNIT_FIELD_SUMMON, ObjectGuid::Empty); + SetGuidValue(PLAYER_FARSIGHT, ObjectGuid::Empty); + SetCreatorGUID(ObjectGuid::Empty); RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVEMENT); @@ -17625,7 +17627,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) ClearInCombat(); // make sure the unit is considered not in duel for proper loading - SetUInt64Value(PLAYER_DUEL_ARBITER, 0); + SetGuidValue(PLAYER_DUEL_ARBITER, ObjectGuid::Empty); SetUInt32Value(PLAYER_DUEL_TEAM, 0); // reset stats before loading any modifiers @@ -17838,7 +17840,7 @@ bool Player::isAllowedToLoot(const Creature* creature) case ROUND_ROBIN: // may only loot if the player is the loot roundrobin player // or if there are free/quest/conditional item for the player - if (loot->roundRobinPlayer == 0 || loot->roundRobinPlayer == GetGUID()) + if (loot->roundRobinPlayer.IsEmpty() || loot->roundRobinPlayer == GetGUID()) return true; return loot->hasItemFor(this); @@ -17847,7 +17849,7 @@ bool Player::isAllowedToLoot(const Creature* creature) // may only loot if the player is the loot roundrobin player // or item over threshold (so roll(s) can be launched) // or if there are free/quest/conditional item for the player - if (loot->roundRobinPlayer == 0 || loot->roundRobinPlayer == GetGUID()) + if (loot->roundRobinPlayer.IsEmpty() || loot->roundRobinPlayer == GetGUID()) return true; if (loot->hasOverThresholdItem()) @@ -17902,7 +17904,7 @@ void Player::_LoadAuras(PreparedQueryResult result, uint32 timediff) Field* fields = result->Fetch(); int32 damage[3]; int32 baseDamage[3]; - uint64 caster_guid = fields[0].GetUInt64(); + ObjectGuid caster_guid(fields[0].GetUInt64()); uint32 spellid = fields[1].GetUInt32(); uint8 effmask = fields[2].GetUInt8(); uint8 recalculatemask = fields[3].GetUInt8(); @@ -18186,7 +18188,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F item->SetRefundRecipient((*result)[0].GetUInt32()); item->SetPaidMoney((*result)[1].GetUInt32()); item->SetPaidExtendedCost((*result)[2].GetUInt16()); - AddRefundReference(item->GetGUIDLow()); + AddRefundReference(item->GetGUID()); } else { @@ -18300,7 +18302,7 @@ void Player::_LoadMailedItems(Mail* mail) Item* item = NewItemOrBag(proto); - if (!item->LoadFromDB(itemGuid, MAKE_NEW_GUID(fields[13].GetUInt32(), 0, HIGHGUID_PLAYER), fields, itemTemplate)) + if (!item->LoadFromDB(itemGuid, ObjectGuid(HIGHGUID_PLAYER, fields[13].GetUInt32()), fields, itemTemplate)) { TC_LOG_ERROR("entities.player", "Player::_LoadMailedItems - Item in mail (%u) doesn't exist !!!! - item guid: %u, deleted from mail", mail->messageID, itemGuid); @@ -18726,7 +18728,7 @@ void Player::_LoadBoundInstances(PreparedQueryResult result) } else if (!perm && group) { - TC_LOG_ERROR("entities.player", "_LoadBoundInstances: player %s(%d) is in group %d but has a non-permanent character bind to map %d (%s), %d, %d", GetName().c_str(), GetGUIDLow(), GUID_LOPART(group->GetGUID()), mapId, mapname.c_str(), instanceId, difficulty); + TC_LOG_ERROR("entities.player", "_LoadBoundInstances: player %s(%d) is in group %d but has a non-permanent character bind to map %d (%s), %d, %d", GetName().c_str(), GetGUIDLow(), group->GetLowGUID(), mapId, mapname.c_str(), instanceId, difficulty); deleteInstance = true; } } @@ -19022,7 +19024,7 @@ bool Player::Satisfy(AccessRequirement const* ar, uint32 target_map, bool report uint32 missingAchievement = 0; Player* leader = this; - uint64 leaderGuid = GetGroup() ? GetGroup()->GetLeaderGUID() : GetGUID(); + ObjectGuid leaderGuid = GetGroup() ? GetGroup()->GetLeaderGUID() : GetGUID(); if (leaderGuid != GetGUID()) leader = ObjectAccessor::FindPlayer(leaderGuid); @@ -19548,8 +19550,8 @@ void Player::_SaveAuras(SQLTransaction& trans) uint8 index = 0; stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_AURA); stmt->setUInt32(index++, GetGUIDLow()); - stmt->setUInt64(index++, itr->second->GetCasterGUID()); - stmt->setUInt64(index++, itr->second->GetCastItemGUID()); + stmt->setUInt64(index++, itr->second->GetCasterGUID().GetRawValue()); + stmt->setUInt64(index++, itr->second->GetCastItemGUID().GetRawValue()); stmt->setUInt32(index++, itr->second->GetId()); stmt->setUInt8(index++, effMask); stmt->setUInt8(index++, recalculateMask); @@ -19592,14 +19594,14 @@ void Player::_SaveInventory(SQLTransaction& trans) // the client auto counts down in real time after having received the initial played time on the first // SMSG_ITEM_REFUND_INFO_RESPONSE packet. // Item::UpdatePlayedTime is only called when needed, which is in DB saves, and item refund info requests. - std::set<uint32>::iterator i_next; - for (std::set<uint32>::iterator itr = m_refundableItems.begin(); itr!= m_refundableItems.end(); itr = i_next) + GuidSet::iterator i_next; + for (GuidSet::iterator itr = m_refundableItems.begin(); itr!= m_refundableItems.end(); itr = i_next) { // use copy iterator because itr may be invalid after operations in this loop i_next = itr; ++i_next; - Item* iPtr = GetItemByGuid(MAKE_NEW_GUID(*itr, 0, HIGHGUID_ITEM)); + Item* iPtr = GetItemByGuid(*itr); if (iPtr) { iPtr->UpdatePlayedTime(this); @@ -19607,7 +19609,7 @@ void Player::_SaveInventory(SQLTransaction& trans) } else { - TC_LOG_ERROR("entities.player", "Can't find item guid %u but is in refundable storage for player %u ! Removing.", *itr, GetGUIDLow()); + TC_LOG_ERROR("entities.player", "Can't find %s but is in refundable storage for player %u ! Removing.", itr->ToString().c_str(), GetGUIDLow()); m_refundableItems.erase(itr); } } @@ -19648,7 +19650,7 @@ void Player::_SaveInventory(SQLTransaction& trans) // also THIS item should be somewhere else, cheat attempt item->FSetState(ITEM_REMOVED); // we are IN updateQueue right now, can't use SetState which modifies the queue - DeleteRefundReference(item->GetGUIDLow()); + DeleteRefundReference(item->GetGUID()); // don't skip, let the switch delete it //continue; } @@ -20153,7 +20155,7 @@ void Player::SendAttackSwingNotInRange() GetSession()->SendPacket(&data); } -void Player::SavePositionInDB(uint32 mapid, float x, float y, float z, float o, uint32 zone, uint64 guid) +void Player::SavePositionInDB(uint32 mapid, float x, float y, float z, float o, uint32 zone, ObjectGuid guid) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHARACTER_POSITION); @@ -20163,7 +20165,7 @@ void Player::SavePositionInDB(uint32 mapid, float x, float y, float z, float o, stmt->setFloat(3, o); stmt->setUInt16(4, uint16(mapid)); stmt->setUInt16(5, uint16(zone)); - stmt->setUInt32(6, GUID_LOPART(guid)); + stmt->setUInt32(6, guid.GetCounter()); CharacterDatabase.Execute(stmt); } @@ -20179,10 +20181,10 @@ void Player::SetUInt32ValueInArray(Tokenizer& tokens, uint16 index, uint32 value tokens[index] = buf; } -void Player::Customize(uint64 guid, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair) +void Player::Customize(ObjectGuid guid, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PLAYERBYTES2); - stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt32(0, guid.GetCounter()); PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) @@ -20199,7 +20201,7 @@ void Player::Customize(uint64 guid, uint8 gender, uint8 skin, uint8 face, uint8 stmt->setUInt8(0, gender); stmt->setUInt32(1, skin | (face << 8) | (hairStyle << 16) | (hairColor << 24)); stmt->setUInt32(2, playerBytes2); - stmt->setUInt32(3, GUID_LOPART(guid)); + stmt->setUInt32(3, guid.GetCounter()); CharacterDatabase.Execute(stmt); } @@ -20231,7 +20233,7 @@ void Player::SendAttackSwingBadFacingAttack() void Player::SendAutoRepeatCancel(Unit* target) { WorldPacket data(SMSG_CANCEL_AUTO_REPEAT, target->GetPackGUID().size()); - data.append(target->GetPackGUID()); // may be it's target guid + data << target->GetPackGUID(); // may be it's target guid GetSession()->SendPacket(&data); } @@ -20401,9 +20403,9 @@ void Player::UpdateDuelFlag(time_t currTime) Pet* Player::GetPet() const { - if (uint64 pet_guid = GetPetGUID()) + if (ObjectGuid pet_guid = GetPetGUID()) { - if (!IS_PET_GUID(pet_guid)) + if (!pet_guid.IsPet()) return NULL; Pet* pet = ObjectAccessor::GetPet(*this, pet_guid); @@ -20517,10 +20519,10 @@ void Player::StopCastingCharm() if (GetCharmGUID()) { - TC_LOG_FATAL("entities.player", "Player %s (GUID: " UI64FMTD " is not able to uncharm unit (GUID: " UI64FMTD " Entry: %u, Type: %u)", GetName().c_str(), GetGUID(), GetCharmGUID(), charm->GetEntry(), charm->GetTypeId()); + TC_LOG_FATAL("entities.player", "Player %s (%s) is not able to uncharm unit (%s)", GetName().c_str(), GetGUID().ToString().c_str(), GetCharmGUID().ToString().c_str()); if (charm->GetCharmerGUID()) { - TC_LOG_FATAL("entities.player", "Charmed unit has charmer guid " UI64FMTD, charm->GetCharmerGUID()); + TC_LOG_FATAL("entities.player", "Charmed unit has charmer %s", charm->GetCharmerGUID().ToString().c_str()); ASSERT(false); } else @@ -20710,7 +20712,7 @@ void Player::PossessSpellInitialize() if (!charmInfo) { - TC_LOG_ERROR("entities.player", "Player::PossessSpellInitialize(): charm (" UI64FMTD ") has no charminfo!", charm->GetGUID()); + TC_LOG_ERROR("entities.player", "Player::PossessSpellInitialize(): charm (%s) has no charminfo!", charm->GetGUID().ToString().c_str()); return; } @@ -20822,7 +20824,7 @@ void Player::CharmSpellInitialize() CharmInfo* charmInfo = charm->GetCharmInfo(); if (!charmInfo) { - TC_LOG_ERROR("entities.player", "Player::CharmSpellInitialize(): the player's charm (" UI64FMTD ") has no charminfo!", charm->GetGUID()); + TC_LOG_ERROR("entities.player", "Player::CharmSpellInitialize(): the player's charm (%s) has no charminfo!", charm->GetGUID().ToString().c_str()); return; } @@ -21070,7 +21072,7 @@ void Player::SendProficiency(ItemClass itemClass, uint32 itemSubclassMask) GetSession()->SendPacket(&data); } -void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type) +void Player::RemovePetitionsAndSigns(ObjectGuid guid, uint32 type) { PreparedStatement* stmt; @@ -21082,7 +21084,7 @@ void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type) stmt->setUInt8(1, uint8(type)); } - stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt32(0, guid.GetCounter()); PreparedQueryResult result = CharacterDatabase.Query(stmt); if (result) @@ -21090,8 +21092,8 @@ void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type) do // this part effectively does nothing, since the deletion / modification only takes place _after_ the PetitionQuery. Though I don't know if the result remains intact if I execute the delete query beforehand. { // and SendPetitionQueryOpcode reads data from the DB Field* fields = result->Fetch(); - uint64 ownerguid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER); - uint64 petitionguid = MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_ITEM); + ObjectGuid ownerguid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32()); + ObjectGuid petitionguid = ObjectGuid(HIGHGUID_ITEM, fields[1].GetUInt32()); // send update if charter owner in game Player* owner = ObjectAccessor::FindPlayer(ownerguid); @@ -21103,7 +21105,7 @@ void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ALL_PETITION_SIGNATURES); - stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt32(0, guid.GetCounter()); CharacterDatabase.Execute(stmt); } @@ -21111,7 +21113,7 @@ void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_SIGNATURE); - stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt32(0, guid.GetCounter()); stmt->setUInt8(1, uint8(type)); CharacterDatabase.Execute(stmt); @@ -21122,32 +21124,32 @@ void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type) if (type == 10) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_BY_OWNER); - stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt32(0, guid.GetCounter()); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_SIGNATURE_BY_OWNER); - stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt32(0, guid.GetCounter()); trans->Append(stmt); } else { stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_BY_OWNER_AND_TYPE); - stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt32(0, guid.GetCounter()); stmt->setUInt8(1, uint8(type)); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_SIGNATURE_BY_OWNER_AND_TYPE); - stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt32(0, guid.GetCounter()); stmt->setUInt8(1, uint8(type)); trans->Append(stmt); } CharacterDatabase.CommitTransaction(trans); } -void Player::LeaveAllArenaTeams(uint64 guid) +void Player::LeaveAllArenaTeams(ObjectGuid guid) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PLAYER_ARENA_TEAMS); - stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt32(0, guid.GetCounter()); PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) @@ -21629,14 +21631,14 @@ inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 c it->SetPaidMoney(price); it->SetPaidExtendedCost(crItem->ExtendedCost); it->SaveRefundDataToDB(); - AddRefundReference(it->GetGUIDLow()); + AddRefundReference(it->GetGUID()); } } return true; } // Return true is the bought item has a max count to force refresh of window by caller -bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot) +bool Player::BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot) { // cheating attempt if (count < 1) count = 1; @@ -21667,7 +21669,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 Creature* creature = GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR); if (!creature) { - TC_LOG_DEBUG("network", "WORLD: BuyItemFromVendor - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid))); + TC_LOG_DEBUG("network", "WORLD: BuyItemFromVendor - %s not found or you can't interact with him.", vendorguid.ToString().c_str()); SendBuyError(BUY_ERR_DISTANCE_TOO_FAR, NULL, item, 0); return false; } @@ -22115,7 +22117,7 @@ void Player::UpdatePotionCooldown(Spell* spell) m_lastPotionId = 0; } -void Player::setResurrectRequestData(uint64 guid, uint32 mapId, float X, float Y, float Z, uint32 health, uint32 mana) +void Player::setResurrectRequestData(ObjectGuid guid, uint32 mapId, float X, float Y, float Z, uint32 health, uint32 mana) { m_resurrectGUID = guid; m_resurrectMap = mapId; @@ -22443,7 +22445,7 @@ bool Player::CanAlwaysSee(WorldObject const* obj) const if (m_mover == obj) return true; - if (uint64 guid = GetUInt64Value(PLAYER_FARSIGHT)) + if (ObjectGuid guid = GetGuidValue(PLAYER_FARSIGHT)) if (obj->GetGUID() == guid) return true; @@ -22488,13 +22490,13 @@ bool Player::IsVisibleGloballyFor(Player const* u) const } template<class T> -inline void UpdateVisibilityOf_helper(std::set<uint64>& s64, T* target, std::set<Unit*>& /*v*/) +inline void UpdateVisibilityOf_helper(GuidSet& s64, T* target, std::set<Unit*>& /*v*/) { s64.insert(target->GetGUID()); } template<> -inline void UpdateVisibilityOf_helper(std::set<uint64>& s64, GameObject* target, std::set<Unit*>& /*v*/) +inline void UpdateVisibilityOf_helper(GuidSet& s64, GameObject* target, std::set<Unit*>& /*v*/) { // @HACK: This is to prevent objects like deeprun tram from disappearing when player moves far from its spawn point while riding it if ((target->GetGOInfo()->type != GAMEOBJECT_TYPE_TRANSPORT)) @@ -22502,14 +22504,14 @@ inline void UpdateVisibilityOf_helper(std::set<uint64>& s64, GameObject* target, } template<> -inline void UpdateVisibilityOf_helper(std::set<uint64>& s64, Creature* target, std::set<Unit*>& v) +inline void UpdateVisibilityOf_helper(GuidSet& s64, Creature* target, std::set<Unit*>& v) { s64.insert(target->GetGUID()); v.insert(target); } template<> -inline void UpdateVisibilityOf_helper(std::set<uint64>& s64, Player* target, std::set<Unit*>& v) +inline void UpdateVisibilityOf_helper(GuidSet& s64, Player* target, std::set<Unit*>& v) { s64.insert(target->GetGUID()); v.insert(target); @@ -22571,9 +22573,9 @@ void Player::UpdateTriggerVisibility() UpdateData udata; WorldPacket packet; - for (ClientGUIDs::iterator itr = m_clientGUIDs.begin(); itr != m_clientGUIDs.end(); ++itr) + for (GuidSet::iterator itr = m_clientGUIDs.begin(); itr != m_clientGUIDs.end(); ++itr) { - if (IS_CREATURE_GUID(*itr)) + if (itr->IsCreature()) { Creature* creature = GetMap()->GetCreature(*itr); // Update fields of triggers, transformed units or unselectable units (values dependent on GM state) @@ -22584,7 +22586,7 @@ void Player::UpdateTriggerVisibility() creature->BuildValuesUpdateBlockForPlayer(&udata, this); creature->RemoveFieldNotifyFlag(UF_FLAG_PUBLIC); } - else if (IS_GAMEOBJECT_GUID((*itr))) + else if (itr->IsGameObject()) { GameObject* go = GetMap()->GetGameObject(*itr); if (!go) @@ -22721,14 +22723,14 @@ bool Player::IsQuestRewarded(uint32 quest_id) const Unit* Player::GetSelectedUnit() const { - if (uint64 selectionGUID = GetUInt64Value(UNIT_FIELD_TARGET)) + if (ObjectGuid selectionGUID = GetTarget()) return ObjectAccessor::GetUnit(*this, selectionGUID); return NULL; } Player* Player::GetSelectedPlayer() const { - if (uint64 selectionGUID = GetUInt64Value(UNIT_FIELD_TARGET)) + if (ObjectGuid selectionGUID = GetTarget()) return ObjectAccessor::GetPlayer(*this, selectionGUID); return NULL; } @@ -22742,11 +22744,11 @@ void Player::SendComboPoints() if (m_mover != this) { data.Initialize(SMSG_PET_UPDATE_COMBO_POINTS, m_mover->GetPackGUID().size()+combotarget->GetPackGUID().size()+1); - data.append(m_mover->GetPackGUID()); + data << m_mover->GetPackGUID(); } else data.Initialize(SMSG_UPDATE_COMBO_POINTS, combotarget->GetPackGUID().size()+1); - data.append(combotarget->GetPackGUID()); + data << combotarget->GetPackGUID(); data << uint8(m_comboPoints); GetSession()->SendPacket(&data); } @@ -22768,7 +22770,7 @@ void Player::AddComboPoints(Unit* target, int8 count, Spell* spell) { if (m_comboTarget) if (Unit* target2 = ObjectAccessor::GetUnit(*this, m_comboTarget)) - target2->RemoveComboPointHolder(GetGUIDLow()); + target2->RemoveComboPointHolder(GetGUID()); // Spells will always add value to m_comboPoints eventualy, so it must be cleared first if (spell) @@ -22777,7 +22779,7 @@ void Player::AddComboPoints(Unit* target, int8 count, Spell* spell) m_comboTarget = target->GetGUID(); *comboPoints = count; - target->AddComboPointHolder(GetGUIDLow()); + target->AddComboPointHolder(GetGUID()); } if (*comboPoints > 5) @@ -22814,9 +22816,9 @@ void Player::ClearComboPoints() SendComboPoints(); if (Unit* target = ObjectAccessor::GetUnit(*this, m_comboTarget)) - target->RemoveComboPointHolder(GetGUIDLow()); + target->RemoveComboPointHolder(GetGUID()); - m_comboTarget = 0; + m_comboTarget.Clear(); } void Player::SetGroup(Group* group, int8 subgroup) @@ -22926,7 +22928,7 @@ void Player::SendInitialPacketsAfterAddToMap() if (HasAuraType(SPELL_AURA_MOD_ROOT)) { WorldPacket data2(SMSG_FORCE_MOVE_ROOT, 10); - data2.append(GetPackGUID()); + data2 << GetPackGUID(); data2 << (uint32)2; SendMessageToSet(&data2, true); } @@ -23323,7 +23325,7 @@ void Player::SendAurasForTarget(Unit* target) target->SetHover(true, true); WorldPacket data(SMSG_AURA_UPDATE_ALL); - data.append(target->GetPackGUID()); + data << target->GetPackGUID(); Unit::VisibleAuraMap const* visibleAuras = target->GetVisibleAuras(); for (Unit::VisibleAuraMap::const_iterator itr = visibleAuras->begin(); itr != visibleAuras->end(); ++itr) @@ -23630,14 +23632,14 @@ void Player::UpdateForQuestWorldObjects() UpdateData udata; WorldPacket packet; - for (ClientGUIDs::iterator itr = m_clientGUIDs.begin(); itr != m_clientGUIDs.end(); ++itr) + for (GuidSet::iterator itr = m_clientGUIDs.begin(); itr != m_clientGUIDs.end(); ++itr) { - if (IS_GAMEOBJECT_GUID(*itr)) + if (itr->IsGameObject()) { if (GameObject* obj = HashMapHolder<GameObject>::Find(*itr)) obj->BuildValuesUpdateBlockForPlayer(&udata, this); } - else if (IS_CRE_OR_VEH_GUID(*itr)) + else if (itr->IsCreatureOrVehicle()) { Creature* obj = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, *itr); if (!obj) @@ -23978,7 +23980,8 @@ void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewar { if (!pRewardSource) return; - uint64 creature_guid = (pRewardSource->GetTypeId() == TYPEID_UNIT) ? pRewardSource->GetGUID() : uint64(0); + + ObjectGuid creature_guid = (pRewardSource->GetTypeId() == TYPEID_UNIT) ? pRewardSource->GetGUID() : ObjectGuid::Empty; // prepare data for near group iteration if (Group* group = GetGroup()) @@ -24075,7 +24078,7 @@ void Player::ResurrectUsingRequestData() void Player::SetClientControl(Unit* target, bool allowMove) { WorldPacket data(SMSG_CLIENT_CONTROL_UPDATE, target->GetPackGUID().size()+1); - data.append(target->GetPackGUID()); + data << target->GetPackGUID(); data << uint8(allowMove ? 1 : 0); GetSession()->SendPacket(&data); @@ -24258,7 +24261,7 @@ PartyResult Player::CanUninviteFromGroup() const if (grp->isLFGGroup()) { - uint64 gguid = grp->GetGUID(); + ObjectGuid gguid = grp->GetGUID(); if (!sLFGMgr->GetKicksLeft(gguid)) return ERR_PARTY_LFG_BOOT_LIMIT; @@ -24466,7 +24469,7 @@ void Player::SetViewpoint(WorldObject* target, bool apply) { TC_LOG_DEBUG("maps", "Player::CreateViewpoint: Player %s create seer %u (TypeId: %u).", GetName().c_str(), target->GetEntry(), target->GetTypeId()); - if (!AddUInt64Value(PLAYER_FARSIGHT, target->GetGUID())) + if (!AddGuidValue(PLAYER_FARSIGHT, target->GetGUID())) { TC_LOG_FATAL("entities.player", "Player::CreateViewpoint: Player %s cannot add new viewpoint!", GetName().c_str()); return; @@ -24482,7 +24485,7 @@ void Player::SetViewpoint(WorldObject* target, bool apply) { TC_LOG_DEBUG("maps", "Player::CreateViewpoint: Player %s remove seer", GetName().c_str()); - if (!RemoveUInt64Value(PLAYER_FARSIGHT, target->GetGUID())) + if (!RemoveGuidValue(PLAYER_FARSIGHT, target->GetGUID())) { TC_LOG_FATAL("entities.player", "Player::CreateViewpoint: Player %s cannot remove current viewpoint!", GetName().c_str()); return; @@ -24501,7 +24504,7 @@ void Player::SetViewpoint(WorldObject* target, bool apply) WorldObject* Player::GetViewpoint() const { - if (uint64 guid = GetUInt64Value(PLAYER_FARSIGHT)) + if (ObjectGuid guid = GetGuidValue(PLAYER_FARSIGHT)) return (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*this, guid, TYPEMASK_SEER); return NULL; } @@ -25371,7 +25374,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank) SetFreeTalentPoints(CurTalentPoints - (talentRank - curtalent_maxrank + 1)); } -void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank) +void Player::LearnPetTalent(ObjectGuid petGuid, uint32 talentId, uint32 talentRank) { Pet* pet = GetPet(); @@ -25766,7 +25769,7 @@ void Player::BuildEnchantmentsInfoData(WorldPacket* data) data->put<uint16>(enchantmentMaskPos, enchantmentMask); *data << uint16(0); // unknown - data->appendPackGUID(item->GetUInt64Value(ITEM_FIELD_CREATOR)); // item creator + *data << item->GetGuidValue(ITEM_FIELD_CREATOR).WriteAsPacked(); // item creator *data << uint32(0); // seed? } @@ -25793,7 +25796,7 @@ void Player::SendEquipmentSetList() if (itr->second.IgnoreMask & (1 << i)) data.appendPackGUID(uint64(1)); else - data.appendPackGUID(MAKE_NEW_GUID(itr->second.Items[i], 0, HIGHGUID_ITEM)); + data << ObjectGuid(HIGHGUID_ITEM, 0, itr->second.Items[i]).WriteAsPacked(); } ++count; // client have limit but it checked at loading and set @@ -26299,18 +26302,16 @@ void Player::SendDuelCountdown(uint32 counter) GetSession()->SendPacket(&data); } -void Player::AddRefundReference(uint32 it) +void Player::AddRefundReference(ObjectGuid it) { m_refundableItems.insert(it); } -void Player::DeleteRefundReference(uint32 it) +void Player::DeleteRefundReference(ObjectGuid it) { - std::set<uint32>::iterator itr = m_refundableItems.find(it); + GuidSet::iterator itr = m_refundableItems.find(it); if (itr != m_refundableItems.end()) - { m_refundableItems.erase(itr); - } } void Player::SendRefundInfo(Item* item) @@ -26579,9 +26580,9 @@ void Player::_SaveInstanceTimeRestrictions(SQLTransaction& trans) } } -bool Player::IsInWhisperWhiteList(uint64 guid) +bool Player::IsInWhisperWhiteList(ObjectGuid guid) { - for (WhisperListContainer::const_iterator itr = WhisperList.begin(); itr != WhisperList.end(); ++itr) + for (GuidList::const_iterator itr = WhisperList.begin(); itr != WhisperList.end(); ++itr) if (*itr == guid) return true; @@ -26594,12 +26595,12 @@ bool Player::SetDisableGravity(bool disable, bool packetOnly /*= false*/) return false; WorldPacket data(disable ? SMSG_MOVE_GRAVITY_DISABLE : SMSG_MOVE_GRAVITY_ENABLE, 12); - data.append(GetPackGUID()); + data << GetPackGUID(); data << uint32(0); //! movement counter SendDirectMessage(&data); data.Initialize(MSG_MOVE_GRAVITY_CHNG, 64); - data.append(GetPackGUID()); + data << GetPackGUID(); BuildMovementPacket(&data); SendMessageToSet(&data, false); return true; @@ -26611,12 +26612,12 @@ bool Player::SetCanFly(bool apply) return false; WorldPacket data(apply ? SMSG_MOVE_SET_CAN_FLY : SMSG_MOVE_UNSET_CAN_FLY, 12); - data.append(GetPackGUID()); + data << GetPackGUID(); data << uint32(0); //! movement counter SendDirectMessage(&data); data.Initialize(MSG_MOVE_UPDATE_CAN_FLY, 64); - data.append(GetPackGUID()); + data << GetPackGUID(); BuildMovementPacket(&data); SendMessageToSet(&data, false); return true; @@ -26628,12 +26629,12 @@ bool Player::SetHover(bool apply, bool packetOnly /*= false*/) return false; WorldPacket data(apply ? SMSG_MOVE_SET_HOVER : SMSG_MOVE_UNSET_HOVER, 12); - data.append(GetPackGUID()); + data << GetPackGUID(); data << uint32(0); //! movement counter SendDirectMessage(&data); data.Initialize(MSG_MOVE_HOVER, 64); - data.append(GetPackGUID()); + data << GetPackGUID(); BuildMovementPacket(&data); SendMessageToSet(&data, false); return true; @@ -26645,12 +26646,12 @@ bool Player::SetWaterWalking(bool apply, bool packetOnly /*= false*/) return false; WorldPacket data(apply ? SMSG_MOVE_WATER_WALK : SMSG_MOVE_LAND_WALK, 12); - data.append(GetPackGUID()); + data << GetPackGUID(); data << uint32(0); //! movement counter SendDirectMessage(&data); data.Initialize(MSG_MOVE_WATER_WALK, 64); - data.append(GetPackGUID()); + data << GetPackGUID(); BuildMovementPacket(&data); SendMessageToSet(&data, false); return true; @@ -26662,12 +26663,12 @@ bool Player::SetFeatherFall(bool apply, bool packetOnly /*= false*/) return false; WorldPacket data(apply ? SMSG_MOVE_FEATHER_FALL : SMSG_MOVE_NORMAL_FALL, 12); - data.append(GetPackGUID()); + data << GetPackGUID(); data << uint32(0); //! movement counter SendDirectMessage(&data); data.Initialize(MSG_MOVE_FEATHER_FALL, 64); - data.append(GetPackGUID()); + data << GetPackGUID(); BuildMovementPacket(&data); SendMessageToSet(&data, false); return true; diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 5705d95190d..bb3fccaf35e 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -126,8 +126,6 @@ typedef std::unordered_map<uint32, PlayerTalent*> PlayerTalentMap; typedef std::unordered_map<uint32, PlayerSpell*> PlayerSpellMap; typedef std::list<SpellModifier*> SpellModList; -typedef std::list<uint64> WhisperListContainer; - struct SpellCooldown { time_t end; @@ -999,11 +997,11 @@ struct BGData struct TradeStatusInfo { - TradeStatusInfo() : Status(TRADE_STATUS_BUSY), TraderGuid(0), Result(EQUIP_ERR_OK), + TradeStatusInfo() : Status(TRADE_STATUS_BUSY), TraderGuid(), Result(EQUIP_ERR_OK), IsTargetResult(false), ItemLimitCategoryId(0), Slot(0) { } TradeStatus Status; - uint64 TraderGuid; + ObjectGuid TraderGuid; InventoryResult Result; bool IsTargetResult; uint32 ItemLimitCategoryId; @@ -1015,21 +1013,21 @@ class TradeData public: // constructors TradeData(Player* player, Player* trader) : m_player(player), m_trader(trader), m_accepted(false), m_acceptProccess(false), - m_money(0), m_spell(0), m_spellCastItem(0) { memset(m_items, 0, TRADE_SLOT_COUNT * sizeof(uint64)); } + m_money(0), m_spell(0), m_spellCastItem() { } Player* GetTrader() const { return m_trader; } TradeData* GetTraderData() const; Item* GetItem(TradeSlots slot) const; - bool HasItem(uint64 itemGuid) const; - TradeSlots GetTradeSlotForItem(uint64 itemGuid) const; + bool HasItem(ObjectGuid itemGuid) const; + TradeSlots GetTradeSlotForItem(ObjectGuid itemGuid) const; void SetItem(TradeSlots slot, Item* item); uint32 GetSpell() const { return m_spell; } void SetSpell(uint32 spell_id, Item* castItem = NULL); Item* GetSpellCastItem() const; - bool HasSpellCastItem() const { return m_spellCastItem != 0; } + bool HasSpellCastItem() const { return !m_spellCastItem.IsEmpty(); } uint32 GetMoney() const { return m_money; } void SetMoney(uint32 money); @@ -1055,9 +1053,9 @@ class TradeData uint32 m_money; // m_player place money to trade uint32 m_spell; // m_player apply spell to non-traded slot item - uint64 m_spellCastItem; // applied spell cast by item use + ObjectGuid m_spellCastItem; // applied spell cast by item use - uint64 m_items[TRADE_SLOT_COUNT]; // traded items from m_player side including non-traded slot + ObjectGuid m_items[TRADE_SLOT_COUNT]; // traded items from m_player side including non-traded slot }; class KillRewarder @@ -1139,8 +1137,8 @@ class Player : public Unit, public GridObject<Player> void SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint32 time); bool CanInteractWithQuestGiver(Object* questGiver); - Creature* GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask); - GameObject* GetGameObjectIfCanInteractWith(uint64 guid, GameobjectTypes type) const; + Creature* GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask); + GameObject* GetGameObjectIfCanInteractWith(ObjectGuid guid, GameobjectTypes type) const; void ToggleAFK(); void ToggleDND(); @@ -1232,7 +1230,7 @@ class Player : public Unit, public GridObject<Player> uint8 FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) const; uint32 GetItemCount(uint32 item, bool inBankAlso = false, Item* skipItem = NULL) const; uint32 GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem = NULL) const; - Item* GetItemByGuid(uint64 guid) const; + Item* GetItemByGuid(ObjectGuid guid) const; Item* GetItemByEntry(uint32 entry) const; Item* GetItemByPos(uint16 pos) const; Item* GetItemByPos(uint8 bag, uint8 slot) const; @@ -1289,8 +1287,8 @@ class Player : public Unit, public GridObject<Player> InventoryResult CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count = NULL, uint32* itemLimitCategory = NULL) const; InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item* pItem = NULL, bool swap = false, uint32* no_space_count = NULL) const; - void AddRefundReference(uint32 it); - void DeleteRefundReference(uint32 it); + void AddRefundReference(ObjectGuid it); + void DeleteRefundReference(ObjectGuid it); void ApplyEquipCooldown(Item* pItem); void SetAmmo(uint32 item); @@ -1320,7 +1318,7 @@ class Player : public Unit, public GridObject<Player> uint32 GetMaxKeyringSize() const { return KEYRING_SLOT_END-KEYRING_SLOT_START; } void SendEquipError(InventoryResult msg, Item* pItem, Item* pItem2 = NULL, uint32 itemid = 0); void SendBuyError(BuyResult msg, Creature* creature, uint32 item, uint32 param); - void SendSellError(SellResult msg, Creature* creature, uint64 guid, uint32 param); + void SendSellError(SellResult msg, Creature* creature, ObjectGuid guid, uint32 param); void AddWeaponProficiency(uint32 newflag) { m_WeaponProficiency |= newflag; } void AddArmorProficiency(uint32 newflag) { m_ArmorProficiency |= newflag; } uint32 GetWeaponProficiency() const { return m_WeaponProficiency; } @@ -1328,7 +1326,7 @@ class Player : public Unit, public GridObject<Player> bool IsUseEquipedWeapon(bool mainhand) const; bool IsTwoHandUsed() const; void SendNewItem(Item* item, uint32 count, bool received, bool created, bool broadcast = false); - bool BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot); + bool BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot); bool _StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot, int32 price, ItemTemplate const* pProto, Creature* pVendor, VendorItem const* crItem, bool bStore); float GetReputationPriceDiscount(Creature const* creature) const; @@ -1379,10 +1377,10 @@ class Player : public Unit, public GridObject<Player> int32 GetQuestLevel(Quest const* quest) const { return quest && (quest->GetQuestLevel() > 0) ? quest->GetQuestLevel() : getLevel(); } - void PrepareQuestMenu(uint64 guid); - void SendPreparedQuest(uint64 guid); + void PrepareQuestMenu(ObjectGuid guid); + void SendPreparedQuest(ObjectGuid guid); bool IsActiveQuest(uint32 quest_id) const; - Quest const* GetNextQuest(uint64 guid, Quest const* quest); + Quest const* GetNextQuest(ObjectGuid guid, Quest const* quest); bool CanSeeStartQuest(Quest const* quest); bool CanTakeQuest(Quest const* quest, bool msg); bool CanAddQuest(Quest const* quest, bool msg); @@ -1449,11 +1447,11 @@ class Player : public Unit, public GridObject<Player> void GroupEventHappens(uint32 questId, WorldObject const* pEventObject); void ItemAddedQuestCheck(uint32 entry, uint32 count); void ItemRemovedQuestCheck(uint32 entry, uint32 count); - void KilledMonster(CreatureTemplate const* cInfo, uint64 guid); - void KilledMonsterCredit(uint32 entry, uint64 guid = 0); + void KilledMonster(CreatureTemplate const* cInfo, ObjectGuid guid); + void KilledMonsterCredit(uint32 entry, ObjectGuid guid = ObjectGuid::Empty); void KilledPlayerCredit(); - void KillCreditGO(uint32 entry, uint64 guid = 0); - void TalkedToCreature(uint32 entry, uint64 guid); + void KillCreditGO(uint32 entry, ObjectGuid guid = ObjectGuid::Empty); + void TalkedToCreature(uint32 entry, ObjectGuid guid); void MoneyChanged(uint32 value); void ReputationChanged(FactionEntry const* factionEntry); void ReputationChanged2(FactionEntry const* factionEntry); @@ -1470,11 +1468,11 @@ class Player : public Unit, public GridObject<Player> void SendQuestConfirmAccept(Quest const* quest, Player* pReceiver); void SendPushToPartyResponse(Player* player, uint8 msg); void SendQuestUpdateAddItem(Quest const* quest, uint32 itemIdx, uint16 count); - void SendQuestUpdateAddCreatureOrGo(Quest const* quest, uint64 guid, uint32 creatureOrGOIdx, uint16 oldCount, uint16 addCount); + void SendQuestUpdateAddCreatureOrGo(Quest const* quest, ObjectGuid guid, uint32 creatureOrGOIdx, uint16 oldCount, uint16 addCount); void SendQuestUpdateAddPlayer(Quest const* quest, uint16 oldCount, uint16 addCount); - uint64 GetDivider() const { return m_divider; } - void SetDivider(uint64 guid) { m_divider = guid; } + ObjectGuid GetDivider() const { return m_divider; } + void SetDivider(ObjectGuid guid) { m_divider = guid; } uint32 GetInGameTime() const { return m_ingametime; } void SetInGameTime(uint32 time) { m_ingametime = time; } @@ -1488,15 +1486,15 @@ class Player : public Unit, public GridObject<Player> /*** LOAD SYSTEM ***/ /*********************************************************/ - bool LoadFromDB(uint32 guid, SQLQueryHolder *holder); + bool LoadFromDB(ObjectGuid guid, SQLQueryHolder *holder); bool isBeingLoaded() const override; void Initialize(uint32 guid); static uint32 GetUInt32ValueFromArray(Tokenizer const& data, uint16 index); static float GetFloatValueFromArray(Tokenizer const& data, uint16 index); - static uint32 GetZoneIdFromDB(uint64 guid); - static uint32 GetLevelFromDB(uint64 guid); - static bool LoadPositionFromDB(uint32& mapid, float& x, float& y, float& z, float& o, bool& in_flight, uint64 guid); + static uint32 GetZoneIdFromDB(ObjectGuid guid); + static uint32 GetLevelFromDB(ObjectGuid guid); + static bool LoadPositionFromDB(uint32& mapid, float& x, float& y, float& z, float& o, bool& in_flight, ObjectGuid guid); static bool IsValidGender(uint8 Gender) { return Gender <= GENDER_FEMALE; } @@ -1510,18 +1508,18 @@ class Player : public Unit, public GridObject<Player> static void SetUInt32ValueInArray(Tokenizer& data, uint16 index, uint32 value); static void SetFloatValueInArray(Tokenizer& data, uint16 index, float value); - static void Customize(uint64 guid, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair); - static void SavePositionInDB(uint32 mapid, float x, float y, float z, float o, uint32 zone, uint64 guid); + static void Customize(ObjectGuid guid, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair); + static void SavePositionInDB(uint32 mapid, float x, float y, float z, float o, uint32 zone, ObjectGuid guid); - static void DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmChars = true, bool deleteFinally = false); + static void DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRealmChars = true, bool deleteFinally = false); static void DeleteOldCharacters(); static void DeleteOldCharacters(uint32 keepDays); bool m_mailsLoaded; bool m_mailsUpdated; - void SetBindPoint(uint64 guid); - void SendTalentWipeConfirm(uint64 guid); + void SetBindPoint(ObjectGuid guid); + void SendTalentWipeConfirm(ObjectGuid guid); void ResetPetTalents(); void CalcRage(uint32 damage, bool attacker); void RegenerateAll(); @@ -1545,11 +1543,11 @@ class Player : public Unit, public GridObject<Player> Unit* GetSelectedUnit() const; Player* GetSelectedPlayer() const; - void SetTarget(uint64 /*guid*/) override { } /// Used for serverside target changes, does not apply to players - void SetSelection(uint64 guid) { SetUInt64Value(UNIT_FIELD_TARGET, guid); } + void SetTarget(ObjectGuid /*guid*/) override { } /// Used for serverside target changes, does not apply to players + void SetSelection(ObjectGuid guid) { SetGuidValue(UNIT_FIELD_TARGET, guid); } uint8 GetComboPoints() const { return m_comboPoints; } - uint64 GetComboTarget() const { return m_comboTarget; } + ObjectGuid GetComboTarget() const { return m_comboTarget; } void AddComboPoints(Unit* target, int8 count, Spell* spell = NULL); void GainSpellComboPoints(int8 count); @@ -1626,7 +1624,7 @@ class Player : public Unit, public GridObject<Player> void BuildPetTalentsInfoData(WorldPacket* data); void SendTalentsInfoData(bool pet); void LearnTalent(uint32 talentId, uint32 talentRank); - void LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank); + void LearnPetTalent(ObjectGuid petGuid, uint32 talentId, uint32 talentRank); bool AddTalent(uint32 spellId, uint8 spec, bool learning); bool HasTalent(uint32 spell_id, uint8 spec) const; @@ -1689,10 +1687,10 @@ class Player : public Unit, public GridObject<Player> void SetLastPotionId(uint32 item_id) { m_lastPotionId = item_id; } void UpdatePotionCooldown(Spell* spell = NULL); - void setResurrectRequestData(uint64 guid, uint32 mapId, float X, float Y, float Z, uint32 health, uint32 mana); - void clearResurrectRequestData() { setResurrectRequestData(0, 0, 0.0f, 0.0f, 0.0f, 0, 0); } - bool isResurrectRequestedBy(uint64 guid) const { return m_resurrectGUID == guid; } - bool isResurrectRequested() const { return m_resurrectGUID != 0; } + void setResurrectRequestData(ObjectGuid guid, uint32 mapId, float X, float Y, float Z, uint32 health, uint32 mana); + void clearResurrectRequestData() { setResurrectRequestData(ObjectGuid::Empty, 0, 0.0f, 0.0f, 0.0f, 0, 0); } + bool isResurrectRequestedBy(ObjectGuid guid) const { return m_resurrectGUID == guid; } + bool isResurrectRequested() const { return !m_resurrectGUID.IsEmpty(); } void ResurrectUsingRequestData(); uint8 getCinematic() { return m_cinematic; } @@ -1733,7 +1731,7 @@ class Player : public Unit, public GridObject<Player> bool IsInSameGroupWith(Player const* p) const; bool IsInSameRaidWith(Player const* p) const; void UninviteFromGroup(); - static void RemoveFromGroup(Group* group, uint64 guid, RemoveMethod method = GROUP_REMOVEMETHOD_DEFAULT, uint64 kicker = 0, const char* reason = NULL); + static void RemoveFromGroup(Group* group, ObjectGuid guid, RemoveMethod method = GROUP_REMOVEMETHOD_DEFAULT, ObjectGuid kicker = ObjectGuid::Empty, const char* reason = NULL); void RemoveFromGroup(RemoveMethod method = GROUP_REMOVEMETHOD_DEFAULT) { RemoveFromGroup(GetGroup(), GetGUID(), method); } void SendUpdateToOutOfRangeGroupMembers(); @@ -1743,16 +1741,16 @@ class Player : public Unit, public GridObject<Player> void SetGuildIdInvited(uint32 GuildId) { m_GuildIdInvited = GuildId; } uint32 GetGuildId() const { return GetUInt32Value(PLAYER_GUILDID); } Guild* GetGuild(); - static uint32 GetGuildIdFromDB(uint64 guid); - static uint8 GetRankFromDB(uint64 guid); + static uint32 GetGuildIdFromDB(ObjectGuid guid); + static uint8 GetRankFromDB(ObjectGuid guid); int GetGuildIdInvited() { return m_GuildIdInvited; } - static void RemovePetitionsAndSigns(uint64 guid, uint32 type); + static void RemovePetitionsAndSigns(ObjectGuid guid, uint32 type); // Arena Team void SetInArenaTeam(uint32 ArenaTeamId, uint8 slot, uint8 type); void SetArenaTeamInfoField(uint8 slot, ArenaTeamInfoType type, uint32 value); - static uint32 GetArenaTeamIdFromDB(uint64 guid, uint8 slot); - static void LeaveAllArenaTeams(uint64 guid); + static uint32 GetArenaTeamIdFromDB(ObjectGuid guid, uint8 slot); + static void LeaveAllArenaTeams(ObjectGuid guid); uint32 GetArenaTeamId(uint8 slot) const { return GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_ID); } uint32 GetArenaPersonalRating(uint8 slot) const { return GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING); } void SetArenaTeamIdInvited(uint32 ArenaTeamId) { m_ArenaTeamIdInvited = ArenaTeamId; } @@ -1831,8 +1829,8 @@ class Player : public Unit, public GridObject<Player> void UpdateManaRegen(); void UpdateRuneRegen(RuneType rune); - uint64 GetLootGUID() const { return m_lootGuid; } - void SetLootGUID(uint64 guid) { m_lootGuid = guid; } + ObjectGuid GetLootGUID() const { return m_lootGuid; } + void SetLootGUID(ObjectGuid guid) { m_lootGuid = guid; } void RemovedInsignia(Player* looterPlr); @@ -2040,9 +2038,9 @@ class Player : public Unit, public GridObject<Player> PlayerMenu* PlayerTalkClass; std::vector<ItemSetEffect*> ItemSetEff; - void SendLoot(uint64 guid, LootType loot_type); - void SendLootError(uint64 guid, LootError error); - void SendLootRelease(uint64 guid); + void SendLoot(ObjectGuid guid, LootType loot_type); + void SendLootError(ObjectGuid guid, LootError error); + void SendLootRelease(ObjectGuid guid); void SendNotifyLootItemRemoved(uint8 lootSlot); void SendNotifyLootMoneyRemoved(); @@ -2166,8 +2164,7 @@ class Player : public Unit, public GridObject<Player> WorldLocation GetStartPosition() const; // currently visible objects at player client - typedef std::set<uint64> ClientGUIDs; - ClientGUIDs m_clientGUIDs; + GuidSet m_clientGUIDs; bool HaveAtClient(WorldObject const* u) const; @@ -2322,9 +2319,9 @@ class Player : public Unit, public GridObject<Player> bool isDebugAreaTriggers; void ClearWhisperWhiteList() { WhisperList.clear(); } - void AddWhisperWhiteList(uint64 guid) { WhisperList.push_back(guid); } - bool IsInWhisperWhiteList(uint64 guid); - void RemoveFromWhisperWhiteList(uint64 guid) { WhisperList.remove(guid); } + void AddWhisperWhiteList(ObjectGuid guid) { WhisperList.push_back(guid); } + bool IsInWhisperWhiteList(ObjectGuid guid); + void RemoveFromWhisperWhiteList(ObjectGuid guid) { WhisperList.remove(guid); } bool SetDisableGravity(bool disable, bool packetOnly /* = false */) override; bool SetCanFly(bool apply) override; @@ -2344,7 +2341,7 @@ class Player : public Unit, public GridObject<Player> protected: // Gamemaster whisper whitelist - WhisperListContainer WhisperList; + GuidList WhisperList; uint32 m_regenTimerCount; float m_powerFraction[MAX_POWERS]; uint32 m_contestedPvPTimer; @@ -2380,7 +2377,7 @@ class Player : public Unit, public GridObject<Player> QuestSet m_monthlyquests; SeasonalEventQuestMap m_seasonalquests; - uint64 m_divider; + ObjectGuid m_divider; uint32 m_ingametime; /*********************************************************/ @@ -2452,7 +2449,7 @@ class Player : public Unit, public GridObject<Player> time_t m_lastHonorUpdateTime; void outDebugValues() const; - uint64 m_lootGuid; + ObjectGuid m_lootGuid; uint32 m_team; uint32 m_nextSave; @@ -2472,7 +2469,7 @@ class Player : public Unit, public GridObject<Player> uint32 m_ExtraFlags; - uint64 m_comboTarget; + ObjectGuid m_comboTarget; int8 m_comboPoints; QuestStatusMap m_QuestStatus; @@ -2517,7 +2514,7 @@ class Player : public Unit, public GridObject<Player> void ResetTimeSync(); void SendTimeSync(); - uint64 m_resurrectGUID; + ObjectGuid m_resurrectGUID; uint32 m_resurrectMap; float m_resurrectX, m_resurrectY, m_resurrectZ; uint32 m_resurrectHealth, m_resurrectMana; @@ -2612,7 +2609,7 @@ class Player : public Unit, public GridObject<Player> Item* _StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool update); Item* _LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, Field* fields); - std::set<uint32> m_refundableItems; + GuidSet m_refundableItems; void SendRefundInfo(Item* item); void RefundItem(Item* item); diff --git a/src/server/game/Entities/Player/SocialMgr.cpp b/src/server/game/Entities/Player/SocialMgr.cpp index f2c2ada5666..498cdfecf6e 100644 --- a/src/server/game/Entities/Player/SocialMgr.cpp +++ b/src/server/game/Entities/Player/SocialMgr.cpp @@ -205,7 +205,7 @@ void SocialMgr::GetFriendInfo(Player* player, uint32 friendGUID, FriendInfo &fri friendInfo.Level = 0; friendInfo.Class = 0; - Player* target = ObjectAccessor::FindPlayer(friendGUID); + Player* target = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, friendGUID)); if (!target) return; @@ -290,10 +290,10 @@ void SocialMgr::BroadcastToFriendListers(Player* player, WorldPacket* packet) AccountTypes gmSecLevel = AccountTypes(sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST)); for (SocialMap::const_iterator itr = m_socialMap.begin(); itr != m_socialMap.end(); ++itr) { - PlayerSocialMap::const_iterator itr2 = itr->second.m_playerSocialMap.find(player->GetGUID()); + PlayerSocialMap::const_iterator itr2 = itr->second.m_playerSocialMap.find(player->GetGUIDLow()); if (itr2 != itr->second.m_playerSocialMap.end() && (itr2->second.Flags & SOCIAL_FLAG_FRIEND)) { - Player* target = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)); + Player* target = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, 0, itr->first)); if (!target || !target->IsInWorld()) continue; diff --git a/src/server/game/Entities/Totem/Totem.cpp b/src/server/game/Entities/Totem/Totem.cpp index b8f5fd1833d..5d4ccf90e52 100644 --- a/src/server/game/Entities/Totem/Totem.cpp +++ b/src/server/game/Entities/Totem/Totem.cpp @@ -113,7 +113,7 @@ void Totem::UnSummon(uint32 msTime) { if (GetOwner()->m_SummonSlot[i] == GetGUID()) { - GetOwner()->m_SummonSlot[i] = 0; + GetOwner()->m_SummonSlot[i].Clear(); break; } } diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index e7633d1f097..777cd992c71 100644 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -609,7 +609,7 @@ bool Transport::TeleportTransport(uint32 newMapid, float x, float y, float z, fl switch (obj->GetTypeId()) { case TYPEID_UNIT: - if (!IS_PLAYER_GUID(obj->ToUnit()->GetOwnerGUID())) // pets should be teleported with player + if (!obj->ToUnit()->GetOwnerGUID().IsPlayer()) // pets should be teleported with player obj->ToCreature()->FarTeleportTo(newMap, destX, destY, destZ, destO); break; case TYPEID_GAMEOBJECT: diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 97b0bb75e4d..0431a2b2c42 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -159,7 +159,7 @@ ProcEventInfo::ProcEventInfo(Unit* actor, Unit* actionTarget, Unit* procTarget, Unit::Unit(bool isWorldObject) : WorldObject(isWorldObject), m_movedPlayer(NULL), m_lastSanctuaryTime(0), - IsAIEnabled(false), NeedChangeAI(false), LastCharmerGUID(0), + IsAIEnabled(false), NeedChangeAI(false), LastCharmerGUID(), m_ControlledByPlayer(false), movespline(new Movement::MoveSpline()), i_AI(NULL), i_disabledAI(NULL), m_AutoRepeatFirstCast(false), m_procDeep(0), m_removedAurasCount(0), i_motionMaster(new MotionMaster(this)), m_regenTimer(0), m_ThreatManager(this), @@ -190,10 +190,10 @@ Unit::Unit(bool isWorldObject) : m_currentSpells[i] = NULL; for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i) - m_SummonSlot[i] = 0; + m_SummonSlot[i].Clear(); for (uint8 i = 0; i < MAX_GAMEOBJECT_SLOT; ++i) - m_ObjectSlot[i] = 0; + m_ObjectSlot[i].Clear(); m_auraUpdateIterator = m_ownedAuras.end(); @@ -668,7 +668,7 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam TC_LOG_DEBUG("entities.unit", "DealDamageStart"); uint32 health = victim->GetHealth(); - TC_LOG_DEBUG("entities.unit", "Unit " UI64FMTD " dealt %u damage to unit " UI64FMTD, GetGUID(), damage, victim->GetGUID()); + TC_LOG_DEBUG("entities.unit", "%s dealt %u damage to %s", GetGUID().ToString().c_str(), damage, victim->GetGUID().ToString().c_str()); // duel ends when player has 1 or less hp bool duel_hasEnded = false; @@ -832,7 +832,7 @@ void Unit::CastStop(uint32 except_spellid) InterruptSpell(CurrentSpellTypes(i), false); } -void Unit::CastSpell(SpellCastTargets const& targets, SpellInfo const* spellInfo, CustomSpellValues const* value, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster) +void Unit::CastSpell(SpellCastTargets const& targets, SpellInfo const* spellInfo, CustomSpellValues const* value, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster) { if (!spellInfo) { @@ -854,12 +854,12 @@ void Unit::CastSpell(SpellCastTargets const& targets, SpellInfo const* spellInfo spell->prepare(&targets, triggeredByAura); } -void Unit::CastSpell(Unit* victim, uint32 spellId, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster) +void Unit::CastSpell(Unit* victim, uint32 spellId, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster) { CastSpell(victim, spellId, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster); } -void Unit::CastSpell(Unit* victim, uint32 spellId, TriggerCastFlags triggerFlags /*= TRIGGER_NONE*/, Item* castItem /*= NULL*/, AuraEffect const* triggeredByAura /*= NULL*/, uint64 originalCaster /*= 0*/) +void Unit::CastSpell(Unit* victim, uint32 spellId, TriggerCastFlags triggerFlags /*= TRIGGER_NONE*/, Item* castItem /*= NULL*/, AuraEffect const* triggeredByAura /*= NULL*/, ObjectGuid originalCaster /*= ObjectGuid::Empty*/) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) @@ -871,19 +871,19 @@ void Unit::CastSpell(Unit* victim, uint32 spellId, TriggerCastFlags triggerFlags CastSpell(victim, spellInfo, triggerFlags, castItem, triggeredByAura, originalCaster); } -void Unit::CastSpell(Unit* victim, SpellInfo const* spellInfo, bool triggered, Item* castItem/*= NULL*/, AuraEffect const* triggeredByAura /*= NULL*/, uint64 originalCaster /*= 0*/) +void Unit::CastSpell(Unit* victim, SpellInfo const* spellInfo, bool triggered, Item* castItem/*= NULL*/, AuraEffect const* triggeredByAura /*= NULL*/, ObjectGuid originalCaster /*= ObjectGuid::Empty*/) { CastSpell(victim, spellInfo, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster); } -void Unit::CastSpell(Unit* victim, SpellInfo const* spellInfo, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster) +void Unit::CastSpell(Unit* victim, SpellInfo const* spellInfo, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster) { SpellCastTargets targets; targets.SetUnitTarget(victim); CastSpell(targets, spellInfo, NULL, triggerFlags, castItem, triggeredByAura, originalCaster); } -void Unit::CastCustomSpell(Unit* target, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster) +void Unit::CastCustomSpell(Unit* target, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster) { CustomSpellValues values; if (bp0) @@ -895,21 +895,21 @@ void Unit::CastCustomSpell(Unit* target, uint32 spellId, int32 const* bp0, int32 CastCustomSpell(spellId, values, target, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster); } -void Unit::CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* target, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster) +void Unit::CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* target, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster) { CustomSpellValues values; values.AddSpellMod(mod, value); CastCustomSpell(spellId, values, target, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster); } -void Unit::CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* target, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster) +void Unit::CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* target, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster) { CustomSpellValues values; values.AddSpellMod(mod, value); CastCustomSpell(spellId, values, target, triggerFlags, castItem, triggeredByAura, originalCaster); } -void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit* victim, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster) +void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit* victim, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) @@ -923,7 +923,7 @@ void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit* CastSpell(targets, spellInfo, &value, triggerFlags, castItem, triggeredByAura, originalCaster); } -void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster) +void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) @@ -937,7 +937,7 @@ void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered, CastSpell(targets, spellInfo, NULL, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster); } -void Unit::CastSpell(GameObject* go, uint32 spellId, bool triggered, Item* castItem, AuraEffect* triggeredByAura, uint64 originalCaster) +void Unit::CastSpell(GameObject* go, uint32 spellId, bool triggered, Item* castItem, AuraEffect* triggeredByAura, ObjectGuid originalCaster) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) @@ -2223,9 +2223,9 @@ void Unit::SendMeleeAttackStart(Unit* victim) void Unit::SendMeleeAttackStop(Unit* victim) { WorldPacket data(SMSG_ATTACKSTOP, (8+8+4)); - data.append(GetPackGUID()); + data << GetPackGUID(); if (victim) - data.append(victim->GetPackGUID()); + data << victim->GetPackGUID(); else data << uint8(0); @@ -2917,7 +2917,7 @@ void Unit::_UpdateSpells(uint32 time) { if (!(*itr)->isSpawned()) { - (*itr)->SetOwnerGUID(0); + (*itr)->SetOwnerGUID(ObjectGuid::Empty); (*itr)->SetRespawnTime(0); (*itr)->Delete(); m_gameObj.erase(itr++); @@ -3215,7 +3215,7 @@ void Unit::DeMorph() SetDisplayId(GetNativeDisplayId()); } -Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount /*= NULL*/, Item* castItem /*= NULL*/, uint64 casterGUID /*= 0*/) +Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount /*= NULL*/, Item* castItem /*= NULL*/, ObjectGuid casterGUID /*= 0*/) { ASSERT(casterGUID || caster); @@ -3227,12 +3227,12 @@ Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 if (!newAura->IsMultiSlotAura()) { // check if cast item changed - uint64 castItemGUID = 0; + ObjectGuid castItemGUID; if (castItem) castItemGUID = castItem->GetGUID(); // find current aura from spell and change it's stackamount, or refresh it's duration - if (Aura* foundAura = GetOwnedAura(newAura->Id, casterGUID, (newAura->AttributesCu & SPELL_ATTR0_CU_ENCHANT_PROC) ? castItemGUID : 0, 0)) + if (Aura* foundAura = GetOwnedAura(newAura->Id, casterGUID, (newAura->AttributesCu & SPELL_ATTR0_CU_ENCHANT_PROC) ? castItemGUID : ObjectGuid::Empty, 0)) { // effect masks do not match // extremely rare case @@ -3259,7 +3259,7 @@ Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 // correct cast item guid if needed if (castItemGUID != foundAura->GetCastItemGUID()) { - uint64* oldGUID = const_cast<uint64 *>(&foundAura->m_castItemGuid); + ObjectGuid* oldGUID = const_cast<ObjectGuid*>(&foundAura->m_castItemGuid); *oldGUID = castItemGUID; } @@ -3568,7 +3568,7 @@ void Unit::RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode) i = m_ownedAuras.begin(); } -void Unit::RemoveOwnedAura(uint32 spellId, uint64 casterGUID, uint8 reqEffMask, AuraRemoveMode removeMode) +void Unit::RemoveOwnedAura(uint32 spellId, ObjectGuid casterGUID, uint8 reqEffMask, AuraRemoveMode removeMode) { for (AuraMap::iterator itr = m_ownedAuras.lower_bound(spellId); itr != m_ownedAuras.upper_bound(spellId);) if (((itr->second->GetEffectMask() & reqEffMask) == reqEffMask) && (!casterGUID || itr->second->GetCasterGUID() == casterGUID)) @@ -3602,7 +3602,7 @@ void Unit::RemoveOwnedAura(Aura* aura, AuraRemoveMode removeMode) ASSERT(false); } -Aura* Unit::GetOwnedAura(uint32 spellId, uint64 casterGUID, uint64 itemCasterGUID, uint8 reqEffMask, Aura* except) const +Aura* Unit::GetOwnedAura(uint32 spellId, ObjectGuid casterGUID, ObjectGuid itemCasterGUID, uint8 reqEffMask, Aura* except) const { AuraMapBounds range = m_ownedAuras.equal_range(spellId); for (AuraMap::const_iterator itr = range.first; itr != range.second; ++itr) @@ -3631,7 +3631,7 @@ void Unit::RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode) aura->Remove(mode); } -void Unit::RemoveAura(uint32 spellId, uint64 caster, uint8 reqEffMask, AuraRemoveMode removeMode) +void Unit::RemoveAura(uint32 spellId, ObjectGuid caster, uint8 reqEffMask, AuraRemoveMode removeMode) { AuraApplicationMapBoundsNonConst range = m_appliedAuras.equal_range(spellId); for (AuraApplicationMap::iterator iter = range.first; iter != range.second;) @@ -3691,7 +3691,7 @@ void Unit::RemoveAura(Aura* aura, AuraRemoveMode mode) RemoveAura(aurApp, mode); } -void Unit::RemoveAurasDueToSpell(uint32 spellId, uint64 casterGUID, uint8 reqEffMask, AuraRemoveMode removeMode) +void Unit::RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID, uint8 reqEffMask, AuraRemoveMode removeMode) { for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);) { @@ -3707,7 +3707,7 @@ void Unit::RemoveAurasDueToSpell(uint32 spellId, uint64 casterGUID, uint8 reqEff } } -void Unit::RemoveAuraFromStack(uint32 spellId, uint64 casterGUID, AuraRemoveMode removeMode) +void Unit::RemoveAuraFromStack(uint32 spellId, ObjectGuid casterGUID, AuraRemoveMode removeMode) { AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId); for (AuraMap::iterator iter = range.first; iter != range.second;) @@ -3724,7 +3724,7 @@ void Unit::RemoveAuraFromStack(uint32 spellId, uint64 casterGUID, AuraRemoveMode } } -void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId, uint64 casterGUID, Unit* dispeller, uint8 chargesRemoved/*= 1*/) +void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId, ObjectGuid casterGUID, Unit* dispeller, uint8 chargesRemoved/*= 1*/) { AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId); for (AuraMap::iterator iter = range.first; iter != range.second;) @@ -3752,7 +3752,7 @@ void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId } } -void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit* stealer) +void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, ObjectGuid casterGUID, Unit* stealer) { AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId); for (AuraMap::iterator iter = range.first; iter != range.second;) @@ -3828,7 +3828,7 @@ void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit* } } -void Unit::RemoveAurasDueToItemSpell(uint32 spellId, uint64 castItemGuid) +void Unit::RemoveAurasDueToItemSpell(uint32 spellId, ObjectGuid castItemGuid) { for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);) { @@ -3842,7 +3842,7 @@ void Unit::RemoveAurasDueToItemSpell(uint32 spellId, uint64 castItemGuid) } } -void Unit::RemoveAurasByType(AuraType auraType, uint64 casterGUID, Aura* except, bool negative, bool positive) +void Unit::RemoveAurasByType(AuraType auraType, ObjectGuid casterGUID, Aura* except, bool negative, bool positive) { for (AuraEffectList::iterator iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end();) { @@ -3943,7 +3943,7 @@ void Unit::RemoveAurasWithInterruptFlags(uint32 flag, uint32 except) UpdateInterruptMask(); } -void Unit::RemoveAurasWithFamily(SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID) +void Unit::RemoveAurasWithFamily(SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID) { for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();) { @@ -4135,7 +4135,7 @@ void Unit::RemoveAllAurasExceptType(AuraType type1, AuraType type2) } } -void Unit::DelayOwnedAuras(uint32 spellId, uint64 caster, int32 delaytime) +void Unit::DelayOwnedAuras(uint32 spellId, ObjectGuid caster, int32 delaytime) { AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId); for (; range.first != range.second; ++range.first) @@ -4167,7 +4167,7 @@ void Unit::_ApplyAllAuraStatMods() (*i).second->GetBase()->HandleAllEffects(i->second, AURA_EFFECT_HANDLE_STAT, true); } -AuraEffect* Unit::GetAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster) const +AuraEffect* Unit::GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid caster) const { AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId); for (AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr) @@ -4181,7 +4181,7 @@ AuraEffect* Unit::GetAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster) c return NULL; } -AuraEffect* Unit::GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, uint64 caster) const +AuraEffect* Unit::GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, ObjectGuid caster) const { uint32 rankSpell = sSpellMgr->GetFirstSpellInChain(spellId); while (rankSpell) @@ -4207,7 +4207,7 @@ AuraEffect* Unit::GetAuraEffect(AuraType type, SpellFamilyNames name, uint32 ico return NULL; } -AuraEffect* Unit::GetAuraEffect(AuraType type, SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID) const +AuraEffect* Unit::GetAuraEffect(AuraType type, SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID) const { AuraEffectList const& auras = GetAuraEffectsByType(type); for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i) @@ -4228,7 +4228,7 @@ AuraEffect* Unit::GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8 return GetAuraEffect(SPELL_AURA_DUMMY, name, iconId, effIndex); } -AuraApplication * Unit::GetAuraApplication(uint32 spellId, uint64 casterGUID, uint64 itemCasterGUID, uint8 reqEffMask, AuraApplication * except) const +AuraApplication * Unit::GetAuraApplication(uint32 spellId, ObjectGuid casterGUID, ObjectGuid itemCasterGUID, uint8 reqEffMask, AuraApplication * except) const { AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId); for (; range.first != range.second; ++range.first) @@ -4247,13 +4247,13 @@ AuraApplication * Unit::GetAuraApplication(uint32 spellId, uint64 casterGUID, ui return NULL; } -Aura* Unit::GetAura(uint32 spellId, uint64 casterGUID, uint64 itemCasterGUID, uint8 reqEffMask) const +Aura* Unit::GetAura(uint32 spellId, ObjectGuid casterGUID, ObjectGuid itemCasterGUID, uint8 reqEffMask) const { AuraApplication * aurApp = GetAuraApplication(spellId, casterGUID, itemCasterGUID, reqEffMask); return aurApp ? aurApp->GetBase() : NULL; } -AuraApplication * Unit::GetAuraApplicationOfRankedSpell(uint32 spellId, uint64 casterGUID, uint64 itemCasterGUID, uint8 reqEffMask, AuraApplication* except) const +AuraApplication * Unit::GetAuraApplicationOfRankedSpell(uint32 spellId, ObjectGuid casterGUID, ObjectGuid itemCasterGUID, uint8 reqEffMask, AuraApplication* except) const { uint32 rankSpell = sSpellMgr->GetFirstSpellInChain(spellId); while (rankSpell) @@ -4265,7 +4265,7 @@ AuraApplication * Unit::GetAuraApplicationOfRankedSpell(uint32 spellId, uint64 c return NULL; } -Aura* Unit::GetAuraOfRankedSpell(uint32 spellId, uint64 casterGUID, uint64 itemCasterGUID, uint8 reqEffMask) const +Aura* Unit::GetAuraOfRankedSpell(uint32 spellId, ObjectGuid casterGUID, ObjectGuid itemCasterGUID, uint8 reqEffMask) const { AuraApplication * aurApp = GetAuraApplicationOfRankedSpell(spellId, casterGUID, itemCasterGUID, reqEffMask); return aurApp ? aurApp->GetBase() : NULL; @@ -4310,7 +4310,7 @@ void Unit::GetDispellableAuraList(Unit* caster, uint32 dispelMask, DispelCharges } } -bool Unit::HasAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster) const +bool Unit::HasAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid caster) const { AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId); for (AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr) @@ -4340,7 +4340,7 @@ uint32 Unit::GetAuraCount(uint32 spellId) const return count; } -bool Unit::HasAura(uint32 spellId, uint64 casterGUID, uint64 itemCasterGUID, uint8 reqEffMask) const +bool Unit::HasAura(uint32 spellId, ObjectGuid casterGUID, ObjectGuid itemCasterGUID, uint8 reqEffMask) const { if (GetAuraApplication(spellId, casterGUID, itemCasterGUID, reqEffMask)) return true; @@ -4352,7 +4352,7 @@ bool Unit::HasAuraType(AuraType auraType) const return (!m_modAuras[auraType].empty()); } -bool Unit::HasAuraTypeWithCaster(AuraType auratype, uint64 caster) const +bool Unit::HasAuraTypeWithCaster(AuraType auratype, ObjectGuid caster) const { AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype); for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) @@ -4388,7 +4388,7 @@ bool Unit::HasAuraTypeWithValue(AuraType auratype, int32 value) const return false; } -bool Unit::HasNegativeAuraWithInterruptFlag(uint32 flag, uint64 guid) const +bool Unit::HasNegativeAuraWithInterruptFlag(uint32 flag, ObjectGuid guid) const { if (!(m_interruptMask & flag)) return false; @@ -4400,7 +4400,7 @@ bool Unit::HasNegativeAuraWithInterruptFlag(uint32 flag, uint64 guid) const return false; } -bool Unit::HasNegativeAuraWithAttribute(uint32 flag, uint64 guid) const +bool Unit::HasNegativeAuraWithAttribute(uint32 flag, ObjectGuid guid) const { for (AuraApplicationMap::const_iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end(); ++iter) { @@ -4440,7 +4440,7 @@ AuraEffect* Unit::IsScriptOverriden(SpellInfo const* spell, int32 script) const return NULL; } -uint32 Unit::GetDiseasesByCaster(uint64 casterGUID, bool remove) +uint32 Unit::GetDiseasesByCaster(ObjectGuid casterGUID, bool remove) { static const AuraType diseaseAuraTypes[] = { @@ -4473,7 +4473,7 @@ uint32 Unit::GetDiseasesByCaster(uint64 casterGUID, bool remove) return diseases; } -uint32 Unit::GetDoTsByCaster(uint64 casterGUID) const +uint32 Unit::GetDoTsByCaster(ObjectGuid casterGUID) const { static const AuraType diseaseAuraTypes[] = { @@ -4849,7 +4849,7 @@ GameObject* Unit::GetGameObject(uint32 spellId) const void Unit::AddGameObject(GameObject* gameObj) { - if (!gameObj || gameObj->GetOwnerGUID() != 0) + if (!gameObj || gameObj->GetOwnerGUID()) return; m_gameObj.push_back(gameObj); @@ -4870,13 +4870,13 @@ void Unit::RemoveGameObject(GameObject* gameObj, bool del) if (!gameObj || gameObj->GetOwnerGUID() != GetGUID()) return; - gameObj->SetOwnerGUID(0); + gameObj->SetOwnerGUID(ObjectGuid::Empty); for (uint8 i = 0; i < MAX_GAMEOBJECT_SLOT; ++i) { if (m_ObjectSlot[i] == gameObj->GetGUID()) { - m_ObjectSlot[i] = 0; + m_ObjectSlot[i].Clear(); break; } } @@ -4915,7 +4915,7 @@ void Unit::RemoveGameObject(uint32 spellid, bool del) next = i; if (spellid == 0 || (*i)->GetSpellId() == spellid) { - (*i)->SetOwnerGUID(0); + (*i)->SetOwnerGUID(ObjectGuid::Empty); if (del) { (*i)->SetRespawnTime(0); @@ -4935,7 +4935,7 @@ void Unit::RemoveAllGameObjects() while (!m_gameObj.empty()) { GameObjectList::iterator i = m_gameObj.begin(); - (*i)->SetOwnerGUID(0); + (*i)->SetOwnerGUID(ObjectGuid::Empty); (*i)->SetRespawnTime(0); (*i)->Delete(); m_gameObj.erase(i); @@ -4945,8 +4945,8 @@ void Unit::RemoveAllGameObjects() void Unit::SendSpellNonMeleeDamageLog(SpellNonMeleeDamage* log) { WorldPacket data(SMSG_SPELLNONMELEEDAMAGELOG, (16+4+4+4+1+4+4+1+1+4+4+1)); // we guess size - data.append(log->target->GetPackGUID()); - data.append(log->attacker->GetPackGUID()); + data << log->target->GetPackGUID(); + data << log->attacker->GetPackGUID(); data << uint32(log->SpellID); data << uint32(log->damage); // damage amount int32 overkill = log->damage - log->target->GetHealth(); @@ -4992,8 +4992,8 @@ void Unit::SendPeriodicAuraLog(SpellPeriodicAuraLogInfo* pInfo) AuraEffect const* aura = pInfo->auraEff; WorldPacket data(SMSG_PERIODICAURALOG, 30); - data.append(GetPackGUID()); - data.appendPackGUID(aura->GetCasterGUID()); + data << GetPackGUID(); + data << aura->GetCasterGUID().WriteAsPacked(); data << uint32(aura->GetId()); // spellId data << uint32(1); // count data << uint32(aura->GetAuraType()); // auraId @@ -5075,8 +5075,8 @@ void Unit::SendAttackStateUpdate(CalcDamageInfo* damageInfo) size_t maxsize = 4+5+5+4+4+1+4+4+4+4+4+1+4+4+4+4+4*12; WorldPacket data(SMSG_ATTACKERSTATEUPDATE, maxsize); // we guess size data << uint32(damageInfo->HitInfo); - data.append(damageInfo->attacker->GetPackGUID()); - data.append(damageInfo->target->GetPackGUID()); + data << damageInfo->attacker->GetPackGUID(); + data << damageInfo->target->GetPackGUID(); data << uint32(damageInfo->damage); // Full damage int32 overkill = damageInfo->damage - damageInfo->target->GetHealth(); data << uint32(overkill < 0 ? 0 : overkill); // Overkill @@ -5161,7 +5161,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere // otherwise, it's the triggered_spell_id by default Unit* target = victim; int32 basepoints0 = 0; - uint64 originalCaster = 0; + ObjectGuid originalCaster; switch (dummySpell->SpellFamilyName) { @@ -5619,7 +5619,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere { if (!target) return false; - target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE, 0, target->GetAura(32409)); // SW:D shall not be removed. + target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE, ObjectGuid::Empty, target->GetAura(32409)); // SW:D shall not be removed. target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT); target->RemoveAurasByType(SPELL_AURA_PERIODIC_LEECH); return true; @@ -5627,7 +5627,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere // Glyph of Icy Veins case 56374: { - RemoveAurasByType(SPELL_AURA_HASTE_SPELLS, 0, 0, true, false); + RemoveAurasByType(SPELL_AURA_HASTE_SPELLS, ObjectGuid::Empty, 0, true, false); RemoveAurasByType(SPELL_AURA_MOD_DECREASE_SPEED); return true; } @@ -5844,7 +5844,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere { if (!target) return false; - target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE, 0, target->GetAura(32409)); // SW:D shall not be removed. + target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE, ObjectGuid::Empty, target->GetAura(32409)); // SW:D shall not be removed. target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT); target->RemoveAurasByType(SPELL_AURA_PERIODIC_LEECH); return true; @@ -8671,19 +8671,12 @@ FactionTemplateEntry const* Unit::GetFactionTemplateEntry() const FactionTemplateEntry const* entry = sFactionTemplateStore.LookupEntry(getFaction()); if (!entry) { - static uint64 guid = 0; // prevent repeating spam same faction problem - - if (GetGUID() != guid) - { - if (Player const* player = ToPlayer()) - TC_LOG_ERROR("entities.unit", "Player %s has invalid faction (faction template id) #%u", player->GetName().c_str(), getFaction()); - else if (Creature const* creature = ToCreature()) - TC_LOG_ERROR("entities.unit", "Creature (template id: %u) has invalid faction (faction template id) #%u", creature->GetCreatureTemplate()->Entry, getFaction()); - else - TC_LOG_ERROR("entities.unit", "Unit (name=%s, type=%u) has invalid faction (faction template id) #%u", GetName().c_str(), uint32(GetTypeId()), getFaction()); - - guid = GetGUID(); - } + if (Player const* player = ToPlayer()) + TC_LOG_ERROR("entities.unit", "Player %s has invalid faction (faction template id) #%u", player->GetName().c_str(), getFaction()); + else if (Creature const* creature = ToCreature()) + TC_LOG_ERROR("entities.unit", "Creature (template id: %u) has invalid faction (faction template id) #%u", creature->GetCreatureTemplate()->Entry, getFaction()); + else + TC_LOG_ERROR("entities.unit", "Unit (name=%s, type=%u) has invalid faction (faction template id) #%u", GetName().c_str(), uint32(GetTypeId()), getFaction()); } return entry; } @@ -8999,7 +8992,7 @@ bool Unit::AttackStop() m_attacking = NULL; // Clear our target - SetTarget(0); + SetTarget(ObjectGuid::Empty); ClearUnitState(UNIT_STATE_MELEE_ATTACKING); @@ -9168,12 +9161,12 @@ bool Unit::HasAuraState(AuraStateType flag, SpellInfo const* spellProto, Unit co return HasFlag(UNIT_FIELD_AURASTATE, 1<<(flag-1)); } -void Unit::SetOwnerGUID(uint64 owner) +void Unit::SetOwnerGUID(ObjectGuid owner) { if (GetOwnerGUID() == owner) return; - SetUInt64Value(UNIT_FIELD_SUMMONEDBY, owner); + SetGuidValue(UNIT_FIELD_SUMMONEDBY, owner); if (!owner) return; @@ -9195,7 +9188,7 @@ void Unit::SetOwnerGUID(uint64 owner) Unit* Unit::GetOwner() const { - if (uint64 ownerGUID = GetOwnerGUID()) + if (ObjectGuid ownerGUID = GetOwnerGUID()) return ObjectAccessor::GetUnit(*this, ownerGUID); return NULL; @@ -9203,7 +9196,7 @@ Unit* Unit::GetOwner() const Unit* Unit::GetCharmer() const { - if (uint64 charmerGUID = GetCharmerGUID()) + if (ObjectGuid charmerGUID = GetCharmerGUID()) return ObjectAccessor::GetUnit(*this, charmerGUID); return NULL; @@ -9211,8 +9204,8 @@ Unit* Unit::GetCharmer() const Player* Unit::GetCharmerOrOwnerPlayerOrPlayerItself() const { - uint64 guid = GetCharmerOrOwnerGUID(); - if (IS_PLAYER_GUID(guid)) + ObjectGuid guid = GetCharmerOrOwnerGUID(); + if (guid.IsPlayer()) return ObjectAccessor::GetPlayer(*this, guid); return const_cast<Unit*>(this)->ToPlayer(); @@ -9231,14 +9224,14 @@ Player* Unit::GetAffectingPlayer() const Minion *Unit::GetFirstMinion() const { - if (uint64 pet_guid = GetMinionGUID()) + if (ObjectGuid pet_guid = GetMinionGUID()) { if (Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, pet_guid)) if (pet->HasUnitTypeMask(UNIT_MASK_MINION)) return (Minion*)pet; - TC_LOG_ERROR("entities.unit", "Unit::GetFirstMinion: Minion %u not exist.", GUID_LOPART(pet_guid)); - const_cast<Unit*>(this)->SetMinionGUID(0); + TC_LOG_ERROR("entities.unit", "Unit::GetFirstMinion: Minion %s not exist.", pet_guid.ToString().c_str()); + const_cast<Unit*>(this)->SetMinionGUID(ObjectGuid::Empty); } return NULL; @@ -9246,14 +9239,14 @@ Minion *Unit::GetFirstMinion() const Guardian* Unit::GetGuardianPet() const { - if (uint64 pet_guid = GetPetGUID()) + if (ObjectGuid pet_guid = GetPetGUID()) { if (Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, pet_guid)) if (pet->HasUnitTypeMask(UNIT_MASK_GUARDIAN)) return (Guardian*)pet; - TC_LOG_FATAL("entities.unit", "Unit::GetGuardianPet: Guardian " UI64FMTD " not exist.", pet_guid); - const_cast<Unit*>(this)->SetPetGUID(0); + TC_LOG_FATAL("entities.unit", "Unit::GetGuardianPet: Guardian %s not exist.", pet_guid.ToString().c_str()); + const_cast<Unit*>(this)->SetPetGUID(ObjectGuid::Empty); } return NULL; @@ -9261,13 +9254,13 @@ Guardian* Unit::GetGuardianPet() const Unit* Unit::GetCharm() const { - if (uint64 charm_guid = GetCharmGUID()) + if (ObjectGuid charm_guid = GetCharmGUID()) { if (Unit* pet = ObjectAccessor::GetUnit(*this, charm_guid)) return pet; - TC_LOG_ERROR("entities.unit", "Unit::GetCharm: Charmed creature %u not exist.", GUID_LOPART(charm_guid)); - const_cast<Unit*>(this)->SetUInt64Value(UNIT_FIELD_CHARM, 0); + TC_LOG_ERROR("entities.unit", "Unit::GetCharm: Charmed creature %s not exist.", charm_guid.ToString().c_str()); + const_cast<Unit*>(this)->SetGuidValue(UNIT_FIELD_CHARM, ObjectGuid::Empty); } return NULL; @@ -9321,19 +9314,19 @@ void Unit::SetMinion(Minion *minion, bool apply) else oldPet->UnSummon(); SetPetGUID(minion->GetGUID()); - SetMinionGUID(0); + SetMinionGUID(ObjectGuid::Empty); } } else { SetPetGUID(minion->GetGUID()); - SetMinionGUID(0); + SetMinionGUID(ObjectGuid::Empty); } } if (minion->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN)) { - if (AddUInt64Value(UNIT_FIELD_SUMMON, minion->GetGUID())) + if (AddGuidValue(UNIT_FIELD_SUMMON, minion->GetGUID())) { } } @@ -9373,15 +9366,13 @@ void Unit::SetMinion(Minion *minion, bool apply) m_Controlled.erase(minion); if (minion->m_Properties && minion->m_Properties->Type == SUMMON_TYPE_MINIPET) - { if (GetCritterGUID() == minion->GetGUID()) - SetCritterGUID(0); - } + SetCritterGUID(ObjectGuid::Empty); if (minion->IsGuardianPet()) { if (GetPetGUID() == minion->GetGUID()) - SetPetGUID(0); + SetPetGUID(ObjectGuid::Empty); } else if (minion->IsTotem()) { @@ -9406,7 +9397,7 @@ void Unit::SetMinion(Minion *minion, bool apply) //if (minion->HasUnitTypeMask(UNIT_MASK_GUARDIAN)) { - if (RemoveUInt64Value(UNIT_FIELD_SUMMON, minion->GetGUID())) + if (RemoveGuidValue(UNIT_FIELD_SUMMON, minion->GetGUID())) { // Check if there is another minion for (ControlList::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr) @@ -9428,7 +9419,7 @@ void Unit::SetMinion(Minion *minion, bool apply) if (!(*itr)->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN)) continue; - if (AddUInt64Value(UNIT_FIELD_SUMMON, (*itr)->GetGUID())) + if (AddGuidValue(UNIT_FIELD_SUMMON, (*itr)->GetGUID())) { // show another pet bar if there is no charm bar if (GetTypeId() == TYPEID_PLAYER && !GetCharmGUID()) @@ -9477,8 +9468,8 @@ void Unit::SetCharm(Unit* charm, bool apply) { if (GetTypeId() == TYPEID_PLAYER) { - if (!AddUInt64Value(UNIT_FIELD_CHARM, charm->GetGUID())) - TC_LOG_FATAL("entities.unit", "Player %s is trying to charm unit %u, but it already has a charmed unit " UI64FMTD "", GetName().c_str(), charm->GetEntry(), GetCharmGUID()); + if (!AddGuidValue(UNIT_FIELD_CHARM, charm->GetGUID())) + TC_LOG_FATAL("entities.unit", "Player %s is trying to charm unit %u, but it already has a charmed unit %s", GetName().c_str(), charm->GetEntry(), GetCharmGUID().ToString().c_str()); charm->m_ControlledByPlayer = true; /// @todo maybe we can use this flag to check if controlled by player @@ -9490,8 +9481,8 @@ void Unit::SetCharm(Unit* charm, bool apply) // PvP, FFAPvP charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, GetByteValue(UNIT_FIELD_BYTES_2, 1)); - if (!charm->AddUInt64Value(UNIT_FIELD_CHARMEDBY, GetGUID())) - TC_LOG_FATAL("entities.unit", "Unit %u is being charmed, but it already has a charmer " UI64FMTD "", charm->GetEntry(), charm->GetCharmerGUID()); + if (!charm->AddGuidValue(UNIT_FIELD_CHARMEDBY, GetGUID())) + TC_LOG_FATAL("entities.unit", "Unit %u is being charmed, but it already has a charmer %s", charm->GetEntry(), charm->GetCharmerGUID().ToString().c_str()); _isWalkingBeforeCharm = charm->IsWalking(); if (_isWalkingBeforeCharm) @@ -9506,12 +9497,12 @@ void Unit::SetCharm(Unit* charm, bool apply) { if (GetTypeId() == TYPEID_PLAYER) { - if (!RemoveUInt64Value(UNIT_FIELD_CHARM, charm->GetGUID())) - TC_LOG_FATAL("entities.unit", "Player %s is trying to uncharm unit %u, but it has another charmed unit " UI64FMTD "", GetName().c_str(), charm->GetEntry(), GetCharmGUID()); + if (!RemoveGuidValue(UNIT_FIELD_CHARM, charm->GetGUID())) + TC_LOG_FATAL("entities.unit", "Player %s is trying to uncharm unit %u, but it has another charmed unit %s", GetName().c_str(), charm->GetEntry(), GetCharmGUID().ToString().c_str()); } - if (!charm->RemoveUInt64Value(UNIT_FIELD_CHARMEDBY, GetGUID())) - TC_LOG_FATAL("entities.unit", "Unit %u is being uncharmed, but it has another charmer " UI64FMTD "", charm->GetEntry(), charm->GetCharmerGUID()); + if (!charm->RemoveGuidValue(UNIT_FIELD_CHARMEDBY, GetGUID())) + TC_LOG_FATAL("entities.unit", "Unit %u is being uncharmed, but it has another charmer %s", charm->GetEntry(), charm->GetCharmerGUID().ToString().c_str()); if (charm->GetTypeId() == TYPEID_PLAYER) { @@ -9634,7 +9625,7 @@ Unit* Unit::GetFirstControlled() const // Sequence: charmed, pet, other guardians Unit* unit = GetCharm(); if (!unit) - if (uint64 guid = GetMinionGUID()) + if (ObjectGuid guid = GetMinionGUID()) unit = ObjectAccessor::GetUnit(*this, guid); return unit; @@ -9658,16 +9649,16 @@ void Unit::RemoveAllControlled() TC_LOG_ERROR("entities.unit", "Unit %u is trying to release unit %u which is neither charmed nor owned by it", GetEntry(), target->GetEntry()); } if (GetPetGUID()) - TC_LOG_FATAL("entities.unit", "Unit %u is not able to release its pet " UI64FMTD, GetEntry(), GetPetGUID()); + TC_LOG_FATAL("entities.unit", "Unit %u is not able to release its pet %s", GetEntry(), GetPetGUID().ToString().c_str()); if (GetMinionGUID()) - TC_LOG_FATAL("entities.unit", "Unit %u is not able to release its minion " UI64FMTD, GetEntry(), GetMinionGUID()); + TC_LOG_FATAL("entities.unit", "Unit %u is not able to release its minion %s", GetEntry(), GetMinionGUID().ToString().c_str()); if (GetCharmGUID()) - TC_LOG_FATAL("entities.unit", "Unit %u is not able to release its charm " UI64FMTD, GetEntry(), GetCharmGUID()); + TC_LOG_FATAL("entities.unit", "Unit %u is not able to release its charm %s", GetEntry(), GetCharmGUID().ToString().c_str()); } bool Unit::isPossessedByPlayer() const { - return HasUnitState(UNIT_STATE_POSSESSED) && IS_PLAYER_GUID(GetCharmerGUID()); + return HasUnitState(UNIT_STATE_POSSESSED) && GetCharmerGUID().IsPlayer(); } bool Unit::isPossessing(Unit* u) const @@ -9786,8 +9777,8 @@ void Unit::SendHealSpellLog(Unit* victim, uint32 SpellID, uint32 Damage, uint32 { // we guess size WorldPacket data(SMSG_SPELLHEALLOG, 8 + 8 + 4 + 4 + 4 + 4 + 1 + 1); - data.append(victim->GetPackGUID()); - data.append(GetPackGUID()); + data << victim->GetPackGUID(); + data << GetPackGUID(); data << uint32(SpellID); data << uint32(Damage); data << uint32(OverHeal); @@ -9811,8 +9802,8 @@ int32 Unit::HealBySpell(Unit* victim, SpellInfo const* spellInfo, uint32 addHeal void Unit::SendEnergizeSpellLog(Unit* victim, uint32 spellId, int32 damage, Powers powerType) { WorldPacket data(SMSG_SPELLENERGIZELOG, (8+8+4+4+4+1)); - data.append(victim->GetPackGUID()); - data.append(GetPackGUID()); + data << victim->GetPackGUID(); + data << GetPackGUID(); data << uint32(spellId); data << uint32(powerType); data << int32(damage); @@ -10431,7 +10422,7 @@ float Unit::GetUnitSpellCriticalChance(Unit* victim, SpellInfo const* spellProto { //! Mobs can't crit with spells. Player Totems can //! Fire Elemental (from totem) can too - but this part is a hack and needs more research - if (IS_CRE_OR_VEH_GUID(GetGUID()) && !(IsTotem() && IS_PLAYER_GUID(GetOwnerGUID())) && GetEntry() != 15438) + if (GetGUID().IsCreatureOrVehicle() && !(IsTotem() && GetOwnerGUID().IsPlayer()) && GetEntry() != 15438) return 0.0f; // not critting spell @@ -11565,7 +11556,7 @@ void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry) { // Send others that we now have a vehicle WorldPacket data(SMSG_PLAYER_VEHICLE_DATA, GetPackGUID().size()+4); - data.appendPackGUID(GetGUID()); + data << GetPackGUID(); data << uint32(VehicleId); SendMessageToSet(&data, true); @@ -11590,7 +11581,7 @@ void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry) } WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4); - data.append(GetPackGUID()); + data << GetPackGUID(); data << uint32(sWorld->GetGameTime()); // Packet counter data << player->GetCollisionHeight(true); player->GetSession()->SendPacket(&data); @@ -11610,14 +11601,14 @@ void Unit::Dismount() if (Player* thisPlayer = ToPlayer()) { WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4); - data.append(GetPackGUID()); + data << GetPackGUID(); data << uint32(sWorld->GetGameTime()); // Packet counter data << thisPlayer->GetCollisionHeight(false); thisPlayer->GetSession()->SendPacket(&data); } WorldPacket data(SMSG_DISMOUNT, 8); - data.appendPackGUID(GetGUID()); + data << GetPackGUID(); SendMessageToSet(&data, true); // dismount as a vehicle @@ -11625,7 +11616,7 @@ void Unit::Dismount() { // Send other players that we are no longer a vehicle data.Initialize(SMSG_PLAYER_VEHICLE_DATA, 8+4); - data.appendPackGUID(GetGUID()); + data << GetPackGUID(); data << uint32(0); ToPlayer()->SendMessageToSet(&data, true); // Remove vehicle from player @@ -12131,7 +12122,7 @@ bool Unit::IsAlwaysVisibleFor(WorldObject const* seer) const return true; // Always seen by owner - if (uint64 guid = GetCharmerOrOwnerGUID()) + if (ObjectGuid guid = GetCharmerOrOwnerGUID()) if (seer->GetGUID() == guid) return true; @@ -12416,7 +12407,7 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced) TC_LOG_ERROR("entities.unit", "Unit::SetSpeed: Unsupported move type (%d), data not sent to client.", mtype); return; } - data.append(GetPackGUID()); + data << GetPackGUID(); data << (uint32)0; // moveEvent, NUM_PMOVE_EVTS = 0x39 if (mtype == MOVE_RUN) data << uint8(0); // new 2.1.0 @@ -12504,7 +12495,7 @@ bool Unit::CanHaveThreatList(bool skipAliveCheck) const // return false; // summons can not have a threat list, unless they are controlled by a creature - if (HasUnitTypeMask(UNIT_MASK_MINION | UNIT_MASK_GUARDIAN | UNIT_MASK_CONTROLABLE_GUARDIAN) && IS_PLAYER_GUID(((Pet*)this)->GetOwnerGUID())) + if (HasUnitTypeMask(UNIT_MASK_MINION | UNIT_MASK_GUARDIAN | UNIT_MASK_CONTROLABLE_GUARDIAN) && ((Pet*)this)->GetOwnerGUID().IsPlayer()) return false; return true; @@ -13322,7 +13313,7 @@ float Unit::GetWeaponDamageRange(WeaponAttackType attType, WeaponDamageRange typ bool Unit::CanFreeMove() const { return !HasUnitState(UNIT_STATE_CONFUSED | UNIT_STATE_FLEEING | UNIT_STATE_IN_FLIGHT | - UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DISTRACTED) && GetOwnerGUID() == 0; + UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DISTRACTED) && GetOwnerGUID().IsEmpty(); } void Unit::SetLevel(uint8 lvl) @@ -13335,7 +13326,7 @@ void Unit::SetLevel(uint8 lvl) if (player->GetGroup()) player->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_LEVEL); - sWorld->UpdateCharacterNameDataLevel(GetGUIDLow(), lvl); + sWorld->UpdateCharacterNameDataLevel(GetGUID(), lvl); } } @@ -13411,7 +13402,7 @@ void Unit::SetPower(Powers power, uint32 val) SetStatInt32Value(UNIT_FIELD_POWER1 + power, val); WorldPacket data(SMSG_POWER_UPDATE); - data.append(GetPackGUID()); + data << GetPackGUID(); data << uint8(power); data << uint32(val); SendMessageToSet(&data, GetTypeId() == TYPEID_PLAYER); @@ -14427,14 +14418,14 @@ SpellSchoolMask Unit::GetMeleeDamageSchoolMask() const return SPELL_SCHOOL_MASK_NORMAL; } -uint64 Unit::GetCharmerOrOwnerGUID() const +ObjectGuid Unit::GetCharmerOrOwnerGUID() const { return GetCharmerGUID() ? GetCharmerGUID() : GetOwnerGUID(); } -uint64 Unit::GetCharmerOrOwnerOrOwnGUID() const +ObjectGuid Unit::GetCharmerOrOwnerOrOwnGUID() const { - if (uint64 guid = GetCharmerOrOwnerGUID()) + if (ObjectGuid guid = GetCharmerOrOwnerGUID()) return guid; return GetGUID(); } @@ -14477,7 +14468,7 @@ void Unit::SendPetTalk(uint32 pettalk) owner->ToPlayer()->GetSession()->SendPacket(&data); } -void Unit::SendPetAIReaction(uint64 guid) +void Unit::SendPetAIReaction(ObjectGuid guid) { Unit* owner = GetOwner(); if (!owner || owner->GetTypeId() != TYPEID_PLAYER) @@ -14598,13 +14589,13 @@ void Unit::ClearComboPointHolders() { while (!m_ComboPointHolders.empty()) { - uint32 lowguid = *m_ComboPointHolders.begin(); + ObjectGuid guid = *m_ComboPointHolders.begin(); - Player* player = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(lowguid, 0, HIGHGUID_PLAYER)); + Player* player = ObjectAccessor::FindPlayer(guid); if (player && player->GetComboTarget() == GetGUID()) // recheck for safe player->ClearComboPoints(); // remove also guid from m_ComboPointHolders; else - m_ComboPointHolders.erase(lowguid); // or remove manually + m_ComboPointHolders.erase(guid); // or remove manually } } @@ -15111,7 +15102,7 @@ bool Unit::HandleAuraRaidProcFromChargeWithValue(AuraEffect* triggeredByAura) // aura can be deleted at casts SpellInfo const* spellProto = triggeredByAura->GetSpellInfo(); int32 heal = triggeredByAura->GetAmount(); - uint64 caster_guid = triggeredByAura->GetCasterGUID(); + ObjectGuid caster_guid = triggeredByAura->GetCasterGUID(); // Currently only Prayer of Mending if (!(spellProto->SpellFamilyName == SPELLFAMILY_PRIEST && spellProto->SpellFamilyFlags[1] & 0x20)) @@ -15170,7 +15161,7 @@ bool Unit::HandleAuraRaidProcFromCharge(AuraEffect* triggeredByAura) return false; } - uint64 caster_guid = triggeredByAura->GetCasterGUID(); + ObjectGuid caster_guid = triggeredByAura->GetCasterGUID(); // jumps int32 jumps = triggeredByAura->GetBase()->GetCharges()-1; @@ -15595,7 +15586,7 @@ void Unit::SetStunned(bool apply) { if (apply) { - SetTarget(0); + SetTarget(ObjectGuid::Empty); SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); // MOVEMENTFLAG_ROOT cannot be used in conjunction with MOVEMENTFLAG_MASK_MOVING (tested 3.3.5a) @@ -15611,7 +15602,7 @@ void Unit::SetStunned(bool apply) SetStandState(UNIT_STAND_STATE_STAND); WorldPacket data(SMSG_FORCE_MOVE_ROOT, 8); - data.append(GetPackGUID()); + data << GetPackGUID(); data << uint32(0); SendMessageToSet(&data, true); @@ -15630,7 +15621,7 @@ void Unit::SetStunned(bool apply) if (!HasUnitState(UNIT_STATE_ROOT)) // prevent moving if it also has root effect { WorldPacket data(SMSG_FORCE_MOVE_UNROOT, 8+4); - data.append(GetPackGUID()); + data << GetPackGUID(); data << uint32(0); SendMessageToSet(&data, true); @@ -15655,14 +15646,14 @@ void Unit::SetRooted(bool apply) if (GetTypeId() == TYPEID_PLAYER) { WorldPacket data(SMSG_FORCE_MOVE_ROOT, 10); - data.append(GetPackGUID()); + data << GetPackGUID(); data << m_rootTimes; SendMessageToSet(&data, true); } else { WorldPacket data(SMSG_SPLINE_MOVE_ROOT, 8); - data.append(GetPackGUID()); + data << GetPackGUID(); SendMessageToSet(&data, true); StopMoving(); } @@ -15674,14 +15665,14 @@ void Unit::SetRooted(bool apply) if (GetTypeId() == TYPEID_PLAYER) { WorldPacket data(SMSG_FORCE_MOVE_UNROOT, 10); - data.append(GetPackGUID()); + data << GetPackGUID(); data << ++m_rootTimes; SendMessageToSet(&data, true); } else { WorldPacket data(SMSG_SPLINE_MOVE_UNROOT, 8); - data.append(GetPackGUID()); + data << GetPackGUID(); SendMessageToSet(&data, true); } @@ -15694,7 +15685,7 @@ void Unit::SetFeared(bool apply) { if (apply) { - SetTarget(0); + SetTarget(ObjectGuid::Empty); Unit* caster = NULL; Unit::AuraEffectList const& fearAuras = GetAuraEffectsByType(SPELL_AURA_MOD_FEAR); @@ -15724,7 +15715,7 @@ void Unit::SetConfused(bool apply) { if (apply) { - SetTarget(0); + SetTarget(ObjectGuid::Empty); GetMotionMaster()->MoveConfused(); } else @@ -15977,7 +15968,7 @@ void Unit::RemoveCharmedBy(Unit* charmer) if (GetCharmInfo()) GetCharmInfo()->SetPetNumber(0, true); else - TC_LOG_ERROR("entities.unit", "Aura::HandleModCharm: target=" UI64FMTD " with typeid=%d has a charm aura but no charm info!", GetGUID(), GetTypeId()); + TC_LOG_ERROR("entities.unit", "Aura::HandleModCharm: %s has a charm aura but no charm info!", GetGUID().ToString().c_str()); } } break; @@ -16067,14 +16058,14 @@ Creature* Unit::GetVehicleCreatureBase() const return NULL; } -uint64 Unit::GetTransGUID() const +ObjectGuid Unit::GetTransGUID() const { if (GetVehicle()) return GetVehicleBase()->GetGUID(); if (GetTransport()) return GetTransport()->GetGUID(); - return 0; + return ObjectGuid::Empty; } TransportBase* Unit::GetDirectTransport() const @@ -16231,7 +16222,7 @@ void Unit::SendPlaySpellVisual(uint32 id) SendMessageToSet(&data, false); } -void Unit::SendPlaySpellImpact(uint64 guid, uint32 id) +void Unit::SendPlaySpellImpact(ObjectGuid guid, uint32 id) { WorldPacket data(SMSG_PLAY_SPELL_IMPACT, 8 + 4); data << uint64(guid); // target @@ -16442,7 +16433,7 @@ void Unit::KnockbackFrom(float x, float y, float speedXY, float speedZ) GetSinCos(x, y, vsin, vcos); WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8+4+4+4+4+4)); - data.append(GetPackGUID()); + data << GetPackGUID(); data << uint32(0); // counter data << float(vcos); // x direction data << float(vsin); // y direction @@ -16765,7 +16756,7 @@ void Unit::JumpTo(float speedXY, float speedZ, bool forward) float vsin = std::sin(angle+GetOrientation()); WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8+4+4+4+4+4)); - data.append(GetPackGUID()); + data << GetPackGUID(); data << uint32(0); // Sequence data << float(vcos); // x direction data << float(vsin); // y direction @@ -16803,7 +16794,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId) Unit* caster = (itr->second.castFlags & NPC_CLICK_CAST_CASTER_CLICKER) ? clicker : this; Unit* target = (itr->second.castFlags & NPC_CLICK_CAST_TARGET_CLICKER) ? clicker : this; - uint64 origCasterGUID = (itr->second.castFlags & NPC_CLICK_CAST_ORIG_CASTER_OWNER) ? GetOwnerGUID() : clicker->GetGUID(); + ObjectGuid origCasterGUID = (itr->second.castFlags & NPC_CLICK_CAST_ORIG_CASTER_OWNER) ? GetOwnerGUID() : clicker->GetGUID(); SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(itr->second.spellId); // if (!spellEntry) should be checked at npc_spellclick load @@ -16982,7 +16973,7 @@ void Unit::_ExitVehicle(Position const* exitPosition) else if (HasUnitMovementFlag(MOVEMENTFLAG_ROOT)) { WorldPacket data(SMSG_SPLINE_MOVE_UNROOT, 8); - data.append(GetPackGUID()); + data << GetPackGUID(); SendMessageToSet(&data, false); } @@ -17031,9 +17022,9 @@ void Unit::BuildMovementPacket(ByteBuffer *data) const if (GetUnitMovementFlags() & MOVEMENTFLAG_ONTRANSPORT) { if (m_vehicle) - data->append(m_vehicle->GetBase()->GetPackGUID()); + *data << m_vehicle->GetBase()->GetPackGUID(); else if (GetTransport()) - data->append(GetTransport()->GetPackGUID()); + *data << GetTransport()->GetPackGUID(); else *data << (uint8)0; @@ -17095,7 +17086,7 @@ void Unit::SendTeleportPacket(Position& pos) Relocate(&pos); WorldPacket data2(MSG_MOVE_TELEPORT, 38); - data2.append(GetPackGUID()); + data2 << GetPackGUID(); BuildMovementPacket(&data2); if (GetTypeId() == TYPEID_UNIT) Relocate(&oldPos); @@ -17169,13 +17160,13 @@ void Unit::SendThreatListUpdate() //TC_LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_UPDATE Message"); WorldPacket data(SMSG_THREAT_UPDATE, 8 + count * 8); - data.append(GetPackGUID()); + data << GetPackGUID(); data << uint32(count); ThreatContainer::StorageType const &tlist = getThreatManager().getThreatList(); for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr) { - data.appendPackGUID((*itr)->getUnitGuid()); - data << uint32((*itr)->getThreat()*100); + data << (*itr)->getUnitGuid().WriteAsPacked(); + data << uint32((*itr)->getThreat() * 100); } SendMessageToSet(&data, false); } @@ -17189,13 +17180,13 @@ void Unit::SendChangeCurrentVictimOpcode(HostileReference* pHostileReference) TC_LOG_DEBUG("entities.unit", "WORLD: Send SMSG_HIGHEST_THREAT_UPDATE Message"); WorldPacket data(SMSG_HIGHEST_THREAT_UPDATE, 8 + 8 + count * 8); - data.append(GetPackGUID()); - data.appendPackGUID(pHostileReference->getUnitGuid()); + data << GetPackGUID(); + data << pHostileReference->getUnitGuid().WriteAsPacked(); data << uint32(count); ThreatContainer::StorageType const &tlist = getThreatManager().getThreatList(); for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr) { - data.appendPackGUID((*itr)->getUnitGuid()); + data << (*itr)->getUnitGuid().WriteAsPacked(); data << uint32((*itr)->getThreat()); } SendMessageToSet(&data, false); @@ -17206,7 +17197,7 @@ void Unit::SendClearThreatListOpcode() { TC_LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_CLEAR Message"); WorldPacket data(SMSG_THREAT_CLEAR, 8); - data.append(GetPackGUID()); + data << GetPackGUID(); SendMessageToSet(&data, false); } @@ -17214,8 +17205,8 @@ void Unit::SendRemoveFromThreatListOpcode(HostileReference* pHostileReference) { TC_LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_REMOVE Message"); WorldPacket data(SMSG_THREAT_REMOVE, 8 + 8); - data.append(GetPackGUID()); - data.appendPackGUID(pHostileReference->getUnitGuid()); + data << GetPackGUID(); + data << pHostileReference->getUnitGuid().WriteAsPacked(); SendMessageToSet(&data, false); } @@ -17287,8 +17278,8 @@ void Unit::StopAttackFaction(uint32 faction_id) void Unit::OutDebugInfo() const { TC_LOG_ERROR("entities.unit", "Unit::OutDebugInfo"); - TC_LOG_INFO("entities.unit", "GUID " UI64FMTD ", entry %u, type %u, name %s", GetGUID(), GetEntry(), (uint32)GetTypeId(), GetName().c_str()); - TC_LOG_INFO("entities.unit", "OwnerGUID " UI64FMTD ", MinionGUID " UI64FMTD ", CharmerGUID " UI64FMTD ", CharmedGUID " UI64FMTD, GetOwnerGUID(), GetMinionGUID(), GetCharmerGUID(), GetCharmGUID()); + TC_LOG_INFO("entities.unit", "%s name %s", GetGUID().ToString().c_str(), GetName().c_str()); + TC_LOG_INFO("entities.unit", "Owner %s, Minion %s, Charmer %s, Charmed %s", GetOwnerGUID().ToString().c_str(), GetMinionGUID().ToString().c_str(), GetCharmerGUID().ToString().c_str(), GetCharmGUID().ToString().c_str()); TC_LOG_INFO("entities.unit", "In world %u, unit type mask %u", (uint32)(IsInWorld() ? 1 : 0), m_unitTypeMask); if (IsInWorld()) TC_LOG_INFO("entities.unit", "Mapid %u", GetMapId()); @@ -17296,14 +17287,14 @@ void Unit::OutDebugInfo() const std::ostringstream o; o << "Summon Slot: "; for (uint32 i = 0; i < MAX_SUMMON_SLOT; ++i) - o << m_SummonSlot[i] << ", "; + o << m_SummonSlot[i].ToString() << ", "; TC_LOG_INFO("entities.unit", "%s", o.str().c_str()); o.str(""); o << "Controlled List: "; for (ControlList::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr) - o << (*itr)->GetGUID() << ", "; + o << (*itr)->GetGUID().ToString() << ", "; TC_LOG_INFO("entities.unit", "%s", o.str().c_str()); o.str(""); @@ -17318,7 +17309,7 @@ void Unit::OutDebugInfo() const o << "Passenger List: "; for (SeatMap::iterator itr = GetVehicleKit()->Seats.begin(); itr != GetVehicleKit()->Seats.end(); ++itr) if (Unit* passenger = ObjectAccessor::GetUnit(*GetVehicleBase(), itr->second.Passenger.Guid)) - o << passenger->GetGUID() << ", "; + o << passenger->GetGUID().ToString() << ", "; TC_LOG_INFO("entities.unit", "%s", o.str().c_str()); } @@ -17326,7 +17317,7 @@ void Unit::OutDebugInfo() const TC_LOG_INFO("entities.unit", "On vehicle %u.", GetVehicleBase()->GetEntry()); } -uint32 Unit::GetRemainingPeriodicAmount(uint64 caster, uint32 spellId, AuraType auraType, uint8 effectIndex) const +uint32 Unit::GetRemainingPeriodicAmount(ObjectGuid caster, uint32 spellId, AuraType auraType, uint8 effectIndex) const { uint32 amount = 0; AuraEffectList const& periodicAuras = GetAuraEffectsByType(auraType); @@ -17344,7 +17335,7 @@ uint32 Unit::GetRemainingPeriodicAmount(uint64 caster, uint32 spellId, AuraType void Unit::SendClearTarget() { WorldPacket data(SMSG_BREAK_TARGET, GetPackGUID().size()); - data.append(GetPackGUID()); + data << GetPackGUID(); SendMessageToSet(&data, false); } diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 7d40b1c24db..d5ecc219be6 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -993,14 +993,14 @@ uint32 createProcExtendMask(SpellNonMeleeDamage* damageInfo, SpellMissInfo missC struct RedirectThreatInfo { - RedirectThreatInfo() : _targetGUID(0), _threatPct(0) { } - uint64 _targetGUID; + RedirectThreatInfo() : _threatPct(0) { } + ObjectGuid _targetGUID; uint32 _threatPct; - uint64 GetTargetGUID() const { return _targetGUID; } + ObjectGuid GetTargetGUID() const { return _targetGUID; } uint32 GetThreatPct() const { return _threatPct; } - void Set(uint64 guid, uint32 pct) + void Set(ObjectGuid guid, uint32 pct) { _targetGUID = guid; _threatPct = pct; @@ -1259,7 +1259,7 @@ class Unit : public WorldObject typedef std::set<Unit*> AttackerSet; typedef std::set<Unit*> ControlList; - typedef std::multimap<uint32, Aura*> AuraMap; + typedef std::multimap<uint32, Aura*> AuraMap; typedef std::pair<AuraMap::const_iterator, AuraMap::const_iterator> AuraMapBounds; typedef std::pair<AuraMap::iterator, AuraMap::iterator> AuraMapBoundsNonConst; @@ -1274,7 +1274,6 @@ class Unit : public WorldObject typedef std::list<Aura*> AuraList; typedef std::list<AuraApplication *> AuraApplicationList; typedef std::list<DiminishingReturn> Diminishing; - typedef std::set<uint32> ComboPointHolderSet; typedef std::map<uint8, AuraApplication*> VisibleAuraMap; @@ -1570,22 +1569,22 @@ class Unit : public WorldObject void EnergizeBySpell(Unit* victim, uint32 SpellID, int32 Damage, Powers powertype); uint32 SpellNonMeleeDamageLog(Unit* victim, uint32 spellID, uint32 damage); - void CastSpell(SpellCastTargets const& targets, SpellInfo const* spellInfo, CustomSpellValues const* value, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); - void CastSpell(Unit* victim, uint32 spellId, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); - void CastSpell(Unit* victim, uint32 spellId, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); - void CastSpell(Unit* victim, SpellInfo const* spellInfo, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); - void CastSpell(Unit* victim, SpellInfo const* spellInfo, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); - void CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); - void CastSpell(GameObject* go, uint32 spellId, bool triggered, Item* castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0); - void CastCustomSpell(Unit* victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); - void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* victim, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); - void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* victim = NULL, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); - void CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit* victim = NULL, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); + void CastSpell(SpellCastTargets const& targets, SpellInfo const* spellInfo, CustomSpellValues const* value, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid::Empty); + void CastSpell(Unit* victim, uint32 spellId, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid::Empty); + void CastSpell(Unit* victim, uint32 spellId, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid::Empty); + void CastSpell(Unit* victim, SpellInfo const* spellInfo, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid::Empty); + void CastSpell(Unit* victim, SpellInfo const* spellInfo, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid::Empty); + void CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid::Empty); + void CastSpell(GameObject* go, uint32 spellId, bool triggered, Item* castItem = NULL, AuraEffect* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid::Empty); + void CastCustomSpell(Unit* victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid::Empty); + void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* victim, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid::Empty); + void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* victim = NULL, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid::Empty); + void CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit* victim = NULL, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid::Empty); Aura* AddAura(uint32 spellId, Unit* target); Aura* AddAura(SpellInfo const* spellInfo, uint8 effMask, Unit* target); void SetAuraStack(uint32 spellId, Unit* target, uint32 stack); void SendPlaySpellVisual(uint32 id); - void SendPlaySpellImpact(uint64 guid, uint32 id); + void SendPlaySpellImpact(ObjectGuid guid, uint32 id); void BuildCooldownPacket(WorldPacket& data, uint8 flags, uint32 spellId, uint32 cooldown); void BuildCooldownPacket(WorldPacket& data, uint8 flags, PacketCooldowns const& cooldowns); @@ -1647,24 +1646,24 @@ class Unit : public WorldObject DeathState getDeathState() const { return m_deathState; } virtual void setDeathState(DeathState s); // overwrited in Creature/Player/Pet - uint64 GetOwnerGUID() const { return GetUInt64Value(UNIT_FIELD_SUMMONEDBY); } - void SetOwnerGUID(uint64 owner); - uint64 GetCreatorGUID() const { return GetUInt64Value(UNIT_FIELD_CREATEDBY); } - void SetCreatorGUID(uint64 creator) { SetUInt64Value(UNIT_FIELD_CREATEDBY, creator); } - uint64 GetMinionGUID() const { return GetUInt64Value(UNIT_FIELD_SUMMON); } - void SetMinionGUID(uint64 guid) { SetUInt64Value(UNIT_FIELD_SUMMON, guid); } - uint64 GetCharmerGUID() const { return GetUInt64Value(UNIT_FIELD_CHARMEDBY); } - void SetCharmerGUID(uint64 owner) { SetUInt64Value(UNIT_FIELD_CHARMEDBY, owner); } - uint64 GetCharmGUID() const { return GetUInt64Value(UNIT_FIELD_CHARM); } - void SetPetGUID(uint64 guid) { m_SummonSlot[SUMMON_SLOT_PET] = guid; } - uint64 GetPetGUID() const { return m_SummonSlot[SUMMON_SLOT_PET]; } - void SetCritterGUID(uint64 guid) { SetUInt64Value(UNIT_FIELD_CRITTER, guid); } - uint64 GetCritterGUID() const { return GetUInt64Value(UNIT_FIELD_CRITTER); } + ObjectGuid GetOwnerGUID() const { return GetGuidValue(UNIT_FIELD_SUMMONEDBY); } + void SetOwnerGUID(ObjectGuid owner); + ObjectGuid GetCreatorGUID() const { return GetGuidValue(UNIT_FIELD_CREATEDBY); } + void SetCreatorGUID(ObjectGuid creator) { SetGuidValue(UNIT_FIELD_CREATEDBY, creator); } + ObjectGuid GetMinionGUID() const { return GetGuidValue(UNIT_FIELD_SUMMON); } + void SetMinionGUID(ObjectGuid guid) { SetGuidValue(UNIT_FIELD_SUMMON, guid); } + ObjectGuid GetCharmerGUID() const { return GetGuidValue(UNIT_FIELD_CHARMEDBY); } + void SetCharmerGUID(ObjectGuid owner) { SetGuidValue(UNIT_FIELD_CHARMEDBY, owner); } + ObjectGuid GetCharmGUID() const { return GetGuidValue(UNIT_FIELD_CHARM); } + void SetPetGUID(ObjectGuid guid) { m_SummonSlot[SUMMON_SLOT_PET] = guid; } + ObjectGuid GetPetGUID() const { return m_SummonSlot[SUMMON_SLOT_PET]; } + void SetCritterGUID(ObjectGuid guid) { SetGuidValue(UNIT_FIELD_CRITTER, guid); } + ObjectGuid GetCritterGUID() const { return GetGuidValue(UNIT_FIELD_CRITTER); } bool IsControlledByPlayer() const { return m_ControlledByPlayer; } - uint64 GetCharmerOrOwnerGUID() const; - uint64 GetCharmerOrOwnerOrOwnGUID() const; - bool IsCharmedOwnedByPlayerOrPlayer() const { return IS_PLAYER_GUID(GetCharmerOrOwnerOrOwnGUID()); } + ObjectGuid GetCharmerOrOwnerGUID() const; + ObjectGuid GetCharmerOrOwnerOrOwnGUID() const; + bool IsCharmedOwnedByPlayerOrPlayer() const { return GetCharmerOrOwnerOrOwnGUID().IsPlayer(); } Player* GetSpellModOwner() const; @@ -1691,7 +1690,7 @@ class Unit : public WorldObject Unit* GetFirstControlled() const; void RemoveAllControlled(); - bool IsCharmed() const { return GetCharmerGUID() != 0; } + bool IsCharmed() const { return !GetCharmerGUID().IsEmpty(); } bool isPossessed() const { return HasUnitState(UNIT_STATE_POSSESSED); } bool isPossessedByPlayer() const; bool isPossessing() const; @@ -1715,7 +1714,7 @@ class Unit : public WorldObject bool InitTamedPet(Pet* pet, uint8 level, uint32 spell_id); // aura apply/remove helpers - you should better not use these - Aura* _TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount = NULL, Item* castItem = NULL, uint64 casterGUID = 0); + Aura* _TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount = NULL, Item* castItem = NULL, ObjectGuid casterGUID = ObjectGuid::Empty); void _AddAura(UnitAura* aura, Unit* caster); AuraApplication * _CreateAuraApplication(Aura* aura, uint8 effMask); void _ApplyAuraEffect(Aura* aura, uint8 effIndex); @@ -1732,31 +1731,31 @@ class Unit : public WorldObject AuraMap const& GetOwnedAuras() const { return m_ownedAuras; } void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT); - void RemoveOwnedAura(uint32 spellId, uint64 casterGUID = 0, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT); + void RemoveOwnedAura(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT); void RemoveOwnedAura(Aura* aura, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT); - Aura* GetOwnedAura(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0, Aura* except = NULL) const; + Aura* GetOwnedAura(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, ObjectGuid itemCasterGUID = ObjectGuid::Empty, uint8 reqEffMask = 0, Aura* except = NULL) const; // m_appliedAuras container management AuraApplicationMap & GetAppliedAuras() { return m_appliedAuras; } AuraApplicationMap const& GetAppliedAuras() const { return m_appliedAuras; } void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); - void RemoveAura(uint32 spellId, uint64 casterGUID = 0, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT); + void RemoveAura(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT); void RemoveAura(AuraApplication * aurApp, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); void RemoveAura(Aura* aur, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); - void RemoveAurasDueToSpell(uint32 spellId, uint64 casterGUID = 0, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT); - void RemoveAuraFromStack(uint32 spellId, uint64 casterGUID = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT); - void RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId, uint64 casterGUID, Unit* dispeller, uint8 chargesRemoved = 1); - void RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit* stealer); - void RemoveAurasDueToItemSpell(uint32 spellId, uint64 castItemGuid); - void RemoveAurasByType(AuraType auraType, uint64 casterGUID = 0, Aura* except = NULL, bool negative = true, bool positive = true); + void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT); + void RemoveAuraFromStack(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT); + void RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId, ObjectGuid casterGUID, Unit* dispeller, uint8 chargesRemoved = 1); + void RemoveAurasDueToSpellBySteal(uint32 spellId, ObjectGuid casterGUID, Unit* stealer); + void RemoveAurasDueToItemSpell(uint32 spellId, ObjectGuid castItemGuid); + void RemoveAurasByType(AuraType auraType, ObjectGuid casterGUID = ObjectGuid::Empty, Aura* except = NULL, bool negative = true, bool positive = true); void RemoveNotOwnSingleTargetAuras(uint32 newPhase = 0x0); void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except = 0); void RemoveAurasWithAttribute(uint32 flags); - void RemoveAurasWithFamily(SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID); - void RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemode = AURA_REMOVE_BY_DEFAULT, uint32 except=0); + void RemoveAurasWithFamily(SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID); + void RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemode = AURA_REMOVE_BY_DEFAULT, uint32 except = 0); void RemoveMovementImpairingAuras(); void RemoveAreaAurasDueToLeaveWorld(); @@ -1766,7 +1765,7 @@ class Unit : public WorldObject void RemoveAllAurasRequiringDeadTarget(); void RemoveAllAurasExceptType(AuraType type); void RemoveAllAurasExceptType(AuraType type1, AuraType type2); /// @todo: once we support variadic templates use them here - void DelayOwnedAuras(uint32 spellId, uint64 caster, int32 delaytime); + void DelayOwnedAuras(uint32 spellId, ObjectGuid caster, int32 delaytime); void _RemoveAllAuraStatMods(); void _ApplyAllAuraStatMods(); @@ -1775,35 +1774,35 @@ class Unit : public WorldObject AuraList & GetSingleCastAuras() { return m_scAuras; } AuraList const& GetSingleCastAuras() const { return m_scAuras; } - AuraEffect* GetAuraEffect(uint32 spellId, uint8 effIndex, uint64 casterGUID = 0) const; - AuraEffect* GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, uint64 casterGUID = 0) const; + AuraEffect* GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID = ObjectGuid::Empty) const; + AuraEffect* GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID = ObjectGuid::Empty) const; AuraEffect* GetAuraEffect(AuraType type, SpellFamilyNames name, uint32 iconId, uint8 effIndex) const; // spell mustn't have familyflags - AuraEffect* GetAuraEffect(AuraType type, SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID =0) const; + AuraEffect* GetAuraEffect(AuraType type, SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID = ObjectGuid::Empty) const; AuraEffect* GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const; - AuraApplication * GetAuraApplication(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0, AuraApplication * except = NULL) const; - Aura* GetAura(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0) const; + AuraApplication * GetAuraApplication(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, ObjectGuid itemCasterGUID = ObjectGuid::Empty, uint8 reqEffMask = 0, AuraApplication * except = NULL) const; + Aura* GetAura(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, ObjectGuid itemCasterGUID = ObjectGuid::Empty, uint8 reqEffMask = 0) const; - AuraApplication * GetAuraApplicationOfRankedSpell(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0, AuraApplication * except = NULL) const; - Aura* GetAuraOfRankedSpell(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0) const; + AuraApplication * GetAuraApplicationOfRankedSpell(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, ObjectGuid itemCasterGUID = ObjectGuid::Empty, uint8 reqEffMask = 0, AuraApplication * except = NULL) const; + Aura* GetAuraOfRankedSpell(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, ObjectGuid itemCasterGUID = ObjectGuid::Empty, uint8 reqEffMask = 0) const; void GetDispellableAuraList(Unit* caster, uint32 dispelMask, DispelChargesList& dispelList); - bool HasAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster = 0) const; + bool HasAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid caster = ObjectGuid::Empty) const; uint32 GetAuraCount(uint32 spellId) const; - bool HasAura(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0) const; + bool HasAura(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, ObjectGuid itemCasterGUID = ObjectGuid::Empty, uint8 reqEffMask = 0) const; bool HasAuraType(AuraType auraType) const; - bool HasAuraTypeWithCaster(AuraType auratype, uint64 caster) const; + bool HasAuraTypeWithCaster(AuraType auratype, ObjectGuid caster) const; bool HasAuraTypeWithMiscvalue(AuraType auratype, int32 miscvalue) const; bool HasAuraTypeWithAffectMask(AuraType auratype, SpellInfo const* affectedSpell) const; bool HasAuraTypeWithValue(AuraType auratype, int32 value) const; - bool HasNegativeAuraWithInterruptFlag(uint32 flag, uint64 guid = 0) const; - bool HasNegativeAuraWithAttribute(uint32 flag, uint64 guid = 0) const; + bool HasNegativeAuraWithInterruptFlag(uint32 flag, ObjectGuid guid = ObjectGuid::Empty) const; + bool HasNegativeAuraWithAttribute(uint32 flag, ObjectGuid guid = ObjectGuid::Empty) const; bool HasAuraWithMechanic(uint32 mechanicMask) const; AuraEffect* IsScriptOverriden(SpellInfo const* spell, int32 script) const; - uint32 GetDiseasesByCaster(uint64 casterGUID, bool remove = false); - uint32 GetDoTsByCaster(uint64 casterGUID) const; + uint32 GetDiseasesByCaster(ObjectGuid casterGUID, bool remove = false); + uint32 GetDoTsByCaster(ObjectGuid casterGUID) const; int32 GetTotalAuraModifier(AuraType auratype) const; float GetTotalAuraMultiplier(AuraType auratype) const; @@ -1842,6 +1841,9 @@ class Unit : public WorldObject float GetNegStat(Stats stat) const { return GetFloatValue(UNIT_FIELD_NEGSTAT0+stat); } float GetCreateStat(Stats stat) const { return m_createStats[stat]; } + ObjectGuid GetChannelObjectGuid() const { return GetGuidValue(UNIT_FIELD_CHANNEL_OBJECT); } + void SetChannelObjectGuid(ObjectGuid guid) { SetGuidValue(UNIT_FIELD_CHANNEL_OBJECT, guid); } + void SetCurrentCastSpell(Spell* pSpell); virtual void ProhibitSpellSchool(SpellSchoolMask /*idSchoolMask*/, uint32 /*unTimeMs*/) { } void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed = true, bool withInstant = true); @@ -1861,8 +1863,8 @@ class Unit : public WorldObject Spell* FindCurrentSpellBySpellId(uint32 spell_id) const; int32 GetCurrentSpellCastTime(uint32 spell_id) const; - uint64 m_SummonSlot[MAX_SUMMON_SLOT]; - uint64 m_ObjectSlot[MAX_GAMEOBJECT_SLOT]; + ObjectGuid m_SummonSlot[MAX_SUMMON_SLOT]; + ObjectGuid m_ObjectSlot[MAX_GAMEOBJECT_SLOT]; ShapeshiftForm GetShapeshiftForm() const { return ShapeshiftForm(GetByteValue(UNIT_FIELD_BYTES_2, 3)); } void SetShapeshiftForm(ShapeshiftForm form); @@ -2001,7 +2003,7 @@ class Unit : public WorldObject uint32 GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectType damagetype, uint32 CastingTime) const; float CalculateDefaultCoefficient(SpellInfo const* spellInfo, DamageEffectType damagetype) const; - uint32 GetRemainingPeriodicAmount(uint64 caster, uint32 spellId, AuraType auraType, uint8 effectIndex = 0) const; + uint32 GetRemainingPeriodicAmount(ObjectGuid caster, uint32 spellId, AuraType auraType, uint8 effectIndex = 0) const; void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply); void ApplySpellDispelImmunity(const SpellInfo* spellProto, DispelType type, bool apply); @@ -2054,14 +2056,14 @@ class Unit : public WorldObject void SetControlled(bool apply, UnitState state); - void AddComboPointHolder(uint32 lowguid) { m_ComboPointHolders.insert(lowguid); } - void RemoveComboPointHolder(uint32 lowguid) { m_ComboPointHolders.erase(lowguid); } + void AddComboPointHolder(ObjectGuid lowguid) { m_ComboPointHolders.insert(lowguid); } + void RemoveComboPointHolder(ObjectGuid lowguid) { m_ComboPointHolders.erase(lowguid); } void ClearComboPointHolders(); ///----------Pet responses methods----------------- void SendPetActionFeedback (uint8 msg); void SendPetTalk (uint32 pettalk); - void SendPetAIReaction(uint64 guid); + void SendPetAIReaction(ObjectGuid guid); ///----------End of Pet responses methods---------- void propagateSpeedChange() { GetMotionMaster()->propagateSpeedChange(); } @@ -2088,15 +2090,15 @@ class Unit : public WorldObject uint32 GetModelForTotem(PlayerTotemType totemType); // Redirect Threat - void SetRedirectThreat(uint64 guid, uint32 pct) { _redirectThreadInfo.Set(guid, pct); } - void ResetRedirectThreat() { SetRedirectThreat(0, 0); } + void SetRedirectThreat(ObjectGuid guid, uint32 pct) { _redirectThreadInfo.Set(guid, pct); } + void ResetRedirectThreat() { SetRedirectThreat(ObjectGuid::Empty, 0); } void ModifyRedirectThreat(int32 amount) { _redirectThreadInfo.ModifyThreatPct(amount); } uint32 GetRedirectThreatPercent() const { return _redirectThreadInfo.GetThreatPct(); } Unit* GetRedirectThreatTarget(); friend class VehicleJoinEvent; bool IsAIEnabled, NeedChangeAI; - uint64 LastCharmerGUID; + ObjectGuid LastCharmerGUID; bool CreateVehicleKit(uint32 id, uint32 creatureEntry); void RemoveVehicleKit(); Vehicle* GetVehicleKit()const { return m_vehicleKit; } @@ -2105,7 +2107,7 @@ class Unit : public WorldObject bool IsOnVehicle(const Unit* vehicle) const; Unit* GetVehicleBase() const; Creature* GetVehicleCreatureBase() const; - uint64 GetTransGUID() const override; + ObjectGuid GetTransGUID() const override; /// Returns the transport this unit is on directly (if on vehicle and transport, return vehicle) TransportBase* GetDirectTransport() const; @@ -2145,8 +2147,8 @@ class Unit : public WorldObject TempSummon* ToTempSummon() { if (IsSummon()) return reinterpret_cast<TempSummon*>(this); else return NULL; } TempSummon const* ToTempSummon() const { if (IsSummon()) return reinterpret_cast<TempSummon const*>(this); else return NULL; } - uint64 GetTarget() const { return GetUInt64Value(UNIT_FIELD_TARGET); } - virtual void SetTarget(uint64 /*guid*/) = 0; + ObjectGuid GetTarget() const { return GetGuidValue(UNIT_FIELD_TARGET); } + virtual void SetTarget(ObjectGuid /*guid*/) = 0; // Movement info Movement::MoveSpline * movespline; @@ -2279,7 +2281,7 @@ class Unit : public WorldObject FollowerRefManager m_FollowingRefManager; - ComboPointHolderSet m_ComboPointHolders; + GuidSet m_ComboPointHolders; RedirectThreatInfo _redirectThreadInfo; diff --git a/src/server/game/Entities/Vehicle/Vehicle.h b/src/server/game/Entities/Vehicle/Vehicle.h index be008330f0c..ffed8e2b677 100644 --- a/src/server/game/Entities/Vehicle/Vehicle.h +++ b/src/server/game/Entities/Vehicle/Vehicle.h @@ -29,8 +29,6 @@ struct VehicleEntry; class Unit; class VehicleJoinEvent; -typedef std::set<uint64> GuidSet; - class Vehicle : public TransportBase { protected: diff --git a/src/server/game/Entities/Vehicle/VehicleDefines.h b/src/server/game/Entities/Vehicle/VehicleDefines.h index fdc5c94282b..f16ad2c24ed 100644 --- a/src/server/game/Entities/Vehicle/VehicleDefines.h +++ b/src/server/game/Entities/Vehicle/VehicleDefines.h @@ -55,12 +55,12 @@ enum VehicleSpells struct PassengerInfo { - uint64 Guid; + ObjectGuid Guid; bool IsUnselectable; void Reset() { - Guid = 0; + Guid.Clear(); IsUnselectable = false; } }; @@ -72,7 +72,7 @@ struct VehicleSeat Passenger.Reset(); } - bool IsEmpty() const { return !Passenger.Guid; } + bool IsEmpty() const { return Passenger.Guid.IsEmpty(); } VehicleSeatEntry const* SeatInfo; PassengerInfo Passenger; diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index 9e1514f11bd..ea50b2d04ce 100644 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -1122,7 +1122,7 @@ void GameEventMgr::UpdateEventNPCFlags(uint16 event_id) // get the creature data from the low guid to get the entry, to be able to find out the whole guid if (CreatureData const* data = sObjectMgr->GetCreatureData(itr->first)) { - Creature* cr = HashMapHolder<Creature>::Find(MAKE_NEW_GUID(itr->first, data->id, HIGHGUID_UNIT)); + Creature* cr = HashMapHolder<Creature>::Find(ObjectGuid(HIGHGUID_UNIT, data->id, itr->first)); // if we found the creature, modify its npcflag if (cr) { @@ -1253,7 +1253,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) { sObjectMgr->RemoveCreatureFromGrid(*itr, data); - if (Creature* creature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_UNIT), (Creature*)NULL)) + if (Creature* creature = ObjectAccessor::GetObjectInWorld(ObjectGuid(HIGHGUID_UNIT, data->id, *itr), (Creature*)NULL)) creature->AddObjectToRemoveList(); } } @@ -1275,7 +1275,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) { sObjectMgr->RemoveGameobjectFromGrid(*itr, data); - if (GameObject* pGameobject = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_GAMEOBJECT), (GameObject*)NULL)) + if (GameObject* pGameobject = ObjectAccessor::GetObjectInWorld(ObjectGuid(HIGHGUID_GAMEOBJECT, data->id, *itr), (GameObject*)NULL)) pGameobject->AddObjectToRemoveList(); } } @@ -1301,7 +1301,7 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate) continue; // Update if spawned - Creature* creature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(itr->first, data->id, HIGHGUID_UNIT), (Creature*)NULL); + Creature* creature = ObjectAccessor::GetObjectInWorld(ObjectGuid(HIGHGUID_UNIT, data->id, itr->first), (Creature*)NULL); if (creature) { if (activate) diff --git a/src/server/game/Globals/ObjectAccessor.cpp b/src/server/game/Globals/ObjectAccessor.cpp index 931ec0e607d..05ddf366a6c 100644 --- a/src/server/game/Globals/ObjectAccessor.cpp +++ b/src/server/game/Globals/ObjectAccessor.cpp @@ -46,7 +46,7 @@ ObjectAccessor::ObjectAccessor() { } ObjectAccessor::~ObjectAccessor() { } -template<class T> T* ObjectAccessor::GetObjectInWorld(uint32 mapid, float x, float y, uint64 guid, T* /*fake*/) +template<class T> T* ObjectAccessor::GetObjectInWorld(uint32 mapid, float x, float y, ObjectGuid guid, T* /*fake*/) { T* obj = HashMapHolder<T>::Find(guid); if (!obj || obj->GetMapId() != mapid) @@ -75,15 +75,15 @@ template<class T> T* ObjectAccessor::GetObjectInWorld(uint32 mapid, float x, flo return NULL; } -Player* ObjectAccessor::GetObjectInWorld(uint64 guid, Player* /*typeSpecifier*/) +Player* ObjectAccessor::GetObjectInWorld(ObjectGuid guid, Player* /*typeSpecifier*/) { Player* player = HashMapHolder<Player>::Find(guid); return player && player->IsInWorld() ? player : NULL; } -WorldObject* ObjectAccessor::GetWorldObject(WorldObject const& p, uint64 guid) +WorldObject* ObjectAccessor::GetWorldObject(WorldObject const& p, ObjectGuid guid) { - switch (GUID_HIPART(guid)) + switch (guid.GetHigh()) { case HIGHGUID_PLAYER: return GetPlayer(p, guid); case HIGHGUID_TRANSPORT: @@ -98,9 +98,9 @@ WorldObject* ObjectAccessor::GetWorldObject(WorldObject const& p, uint64 guid) } } -Object* ObjectAccessor::GetObjectByTypeMask(WorldObject const& p, uint64 guid, uint32 typemask) +Object* ObjectAccessor::GetObjectByTypeMask(WorldObject const& p, ObjectGuid guid, uint32 typemask) { - switch (GUID_HIPART(guid)) + switch (guid.GetHigh()) { case HIGHGUID_ITEM: if (typemask & TYPEMASK_ITEM && p.GetTypeId() == TYPEID_PLAYER) @@ -136,72 +136,72 @@ Object* ObjectAccessor::GetObjectByTypeMask(WorldObject const& p, uint64 guid, u return NULL; } -Corpse* ObjectAccessor::GetCorpse(WorldObject const& u, uint64 guid) +Corpse* ObjectAccessor::GetCorpse(WorldObject const& u, ObjectGuid guid) { return GetObjectInMap(guid, u.GetMap(), (Corpse*)NULL); } -GameObject* ObjectAccessor::GetGameObject(WorldObject const& u, uint64 guid) +GameObject* ObjectAccessor::GetGameObject(WorldObject const& u, ObjectGuid guid) { return GetObjectInMap(guid, u.GetMap(), (GameObject*)NULL); } -Transport* ObjectAccessor::GetTransport(WorldObject const& u, uint64 guid) +Transport* ObjectAccessor::GetTransport(WorldObject const& u, ObjectGuid guid) { - if (GUID_HIPART(guid) != HIGHGUID_MO_TRANSPORT) + if (!guid.IsMOTransport()) return NULL; GameObject* go = GetGameObject(u, guid); return go ? go->ToTransport() : NULL; } -DynamicObject* ObjectAccessor::GetDynamicObject(WorldObject const& u, uint64 guid) +DynamicObject* ObjectAccessor::GetDynamicObject(WorldObject const& u, ObjectGuid guid) { return GetObjectInMap(guid, u.GetMap(), (DynamicObject*)NULL); } -Unit* ObjectAccessor::GetUnit(WorldObject const& u, uint64 guid) +Unit* ObjectAccessor::GetUnit(WorldObject const& u, ObjectGuid guid) { return GetObjectInMap(guid, u.GetMap(), (Unit*)NULL); } -Creature* ObjectAccessor::GetCreature(WorldObject const& u, uint64 guid) +Creature* ObjectAccessor::GetCreature(WorldObject const& u, ObjectGuid guid) { return GetObjectInMap(guid, u.GetMap(), (Creature*)NULL); } -Pet* ObjectAccessor::GetPet(WorldObject const& u, uint64 guid) +Pet* ObjectAccessor::GetPet(WorldObject const& u, ObjectGuid guid) { return GetObjectInMap(guid, u.GetMap(), (Pet*)NULL); } -Player* ObjectAccessor::GetPlayer(WorldObject const& u, uint64 guid) +Player* ObjectAccessor::GetPlayer(WorldObject const& u, ObjectGuid guid) { return GetObjectInMap(guid, u.GetMap(), (Player*)NULL); } -Creature* ObjectAccessor::GetCreatureOrPetOrVehicle(WorldObject const& u, uint64 guid) +Creature* ObjectAccessor::GetCreatureOrPetOrVehicle(WorldObject const& u, ObjectGuid guid) { - if (IS_PET_GUID(guid)) + if (guid.IsPet()) return GetPet(u, guid); - if (IS_CRE_OR_VEH_GUID(guid)) + if (guid.IsCreatureOrVehicle()) return GetCreature(u, guid); return NULL; } -Pet* ObjectAccessor::FindPet(uint64 guid) +Pet* ObjectAccessor::FindPet(ObjectGuid guid) { return GetObjectInWorld(guid, (Pet*)NULL); } -Player* ObjectAccessor::FindPlayer(uint64 guid) +Player* ObjectAccessor::FindPlayer(ObjectGuid guid) { return GetObjectInWorld(guid, (Player*)NULL); } -Unit* ObjectAccessor::FindUnit(uint64 guid) +Unit* ObjectAccessor::FindUnit(ObjectGuid guid) { return GetObjectInWorld(guid, (Unit*)NULL); } @@ -235,7 +235,7 @@ void ObjectAccessor::SaveAllPlayers() itr->second->SaveToDB(); } -Corpse* ObjectAccessor::GetCorpseForPlayerGUID(uint64 guid) +Corpse* ObjectAccessor::GetCorpseForPlayerGUID(ObjectGuid guid) { boost::shared_lock<boost::shared_mutex> lock(_corpseLock); @@ -280,7 +280,7 @@ void ObjectAccessor::RemoveCorpse(Corpse* corpse) // build mapid*cellid -> guid_set map CellCoord cellCoord = Trinity::ComputeCellCoord(corpse->GetPositionX(), corpse->GetPositionY()); - sObjectMgr->DeleteCorpseCellData(corpse->GetMapId(), cellCoord.GetId(), GUID_LOPART(corpse->GetOwnerGUID())); + sObjectMgr->DeleteCorpseCellData(corpse->GetMapId(), cellCoord.GetId(), corpse->GetOwnerGUID().GetCounter()); i_player2corpse.erase(iter); } @@ -299,7 +299,7 @@ void ObjectAccessor::AddCorpse(Corpse* corpse) // build mapid*cellid -> guid_set map CellCoord cellCoord = Trinity::ComputeCellCoord(corpse->GetPositionX(), corpse->GetPositionY()); - sObjectMgr->AddCorpseCellData(corpse->GetMapId(), cellCoord.GetId(), GUID_LOPART(corpse->GetOwnerGUID()), corpse->GetInstanceId()); + sObjectMgr->AddCorpseCellData(corpse->GetMapId(), cellCoord.GetId(), corpse->GetOwnerGUID().GetCounter(), corpse->GetInstanceId()); } } @@ -327,7 +327,7 @@ void ObjectAccessor::AddCorpsesToGrid(GridCoord const& gridpair, GridType& grid, } } -Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia /*=false*/) +Corpse* ObjectAccessor::ConvertCorpseForPlayer(ObjectGuid player_guid, bool insignia /*=false*/) { Corpse* corpse = GetCorpseForPlayerGUID(player_guid); if (!corpse) @@ -372,7 +372,7 @@ Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia bones->SetPhaseMask(corpse->GetPhaseMask(), false); bones->SetUInt32Value(CORPSE_FIELD_FLAGS, CORPSE_FLAG_UNK2 | CORPSE_FLAG_BONES); - bones->SetUInt64Value(CORPSE_FIELD_OWNER, 0); + bones->SetGuidValue(CORPSE_FIELD_OWNER, ObjectGuid::Empty); for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i) { @@ -438,7 +438,7 @@ void ObjectAccessor::UnloadAll() /// Define the static members of HashMapHolder -template <class T> std::unordered_map< uint64, T* > HashMapHolder<T>::_objectMap; +template <class T> typename HashMapHolder<T>::MapType HashMapHolder<T>::_objectMap; template <class T> boost::shared_mutex HashMapHolder<T>::_lock; /// Global definitions for the hashmap storage @@ -450,9 +450,9 @@ template class HashMapHolder<DynamicObject>; template class HashMapHolder<Creature>; template class HashMapHolder<Corpse>; -template Player* ObjectAccessor::GetObjectInWorld<Player>(uint32 mapid, float x, float y, uint64 guid, Player* /*fake*/); -template Pet* ObjectAccessor::GetObjectInWorld<Pet>(uint32 mapid, float x, float y, uint64 guid, Pet* /*fake*/); -template Creature* ObjectAccessor::GetObjectInWorld<Creature>(uint32 mapid, float x, float y, uint64 guid, Creature* /*fake*/); -template Corpse* ObjectAccessor::GetObjectInWorld<Corpse>(uint32 mapid, float x, float y, uint64 guid, Corpse* /*fake*/); -template GameObject* ObjectAccessor::GetObjectInWorld<GameObject>(uint32 mapid, float x, float y, uint64 guid, GameObject* /*fake*/); -template DynamicObject* ObjectAccessor::GetObjectInWorld<DynamicObject>(uint32 mapid, float x, float y, uint64 guid, DynamicObject* /*fake*/); +template Player* ObjectAccessor::GetObjectInWorld<Player>(uint32 mapid, float x, float y, ObjectGuid guid, Player* /*fake*/); +template Pet* ObjectAccessor::GetObjectInWorld<Pet>(uint32 mapid, float x, float y, ObjectGuid guid, Pet* /*fake*/); +template Creature* ObjectAccessor::GetObjectInWorld<Creature>(uint32 mapid, float x, float y, ObjectGuid guid, Creature* /*fake*/); +template Corpse* ObjectAccessor::GetObjectInWorld<Corpse>(uint32 mapid, float x, float y, ObjectGuid guid, Corpse* /*fake*/); +template GameObject* ObjectAccessor::GetObjectInWorld<GameObject>(uint32 mapid, float x, float y, ObjectGuid guid, GameObject* /*fake*/); +template DynamicObject* ObjectAccessor::GetObjectInWorld<DynamicObject>(uint32 mapid, float x, float y, ObjectGuid guid, DynamicObject* /*fake*/); diff --git a/src/server/game/Globals/ObjectAccessor.h b/src/server/game/Globals/ObjectAccessor.h index 849ae25a335..95d0b70f429 100644 --- a/src/server/game/Globals/ObjectAccessor.h +++ b/src/server/game/Globals/ObjectAccessor.h @@ -47,7 +47,7 @@ class HashMapHolder { public: - typedef std::unordered_map<uint64, T*> MapType; + typedef std::unordered_map<ObjectGuid, T*> MapType; static void Insert(T* o) { @@ -63,7 +63,7 @@ class HashMapHolder _objectMap.erase(o->GetGUID()); } - static T* Find(uint64 guid) + static T* Find(ObjectGuid guid) { boost::shared_lock<boost::shared_mutex> lock(_lock); @@ -100,44 +100,44 @@ class ObjectAccessor return &instance; } - template<class T> static T* GetObjectInOrOutOfWorld(uint64 guid, T* /*typeSpecifier*/) + template<class T> static T* GetObjectInOrOutOfWorld(ObjectGuid guid, T* /*typeSpecifier*/) { return HashMapHolder<T>::Find(guid); } - static Unit* GetObjectInOrOutOfWorld(uint64 guid, Unit* /*typeSpecifier*/) + static Unit* GetObjectInOrOutOfWorld(ObjectGuid guid, Unit* /*typeSpecifier*/) { - if (IS_PLAYER_GUID(guid)) + if (guid.IsPlayer()) return (Unit*)GetObjectInOrOutOfWorld(guid, (Player*)NULL); - if (IS_PET_GUID(guid)) + if (guid.IsPet()) return (Unit*)GetObjectInOrOutOfWorld(guid, (Pet*)NULL); return (Unit*)GetObjectInOrOutOfWorld(guid, (Creature*)NULL); } // returns object if is in world - template<class T> static T* GetObjectInWorld(uint64 guid, T* /*typeSpecifier*/) + template<class T> static T* GetObjectInWorld(ObjectGuid guid, T* /*typeSpecifier*/) { return HashMapHolder<T>::Find(guid); } // Player may be not in world while in ObjectAccessor - static Player* GetObjectInWorld(uint64 guid, Player* /*typeSpecifier*/); + static Player* GetObjectInWorld(ObjectGuid guid, Player* /*typeSpecifier*/); - static Unit* GetObjectInWorld(uint64 guid, Unit* /*typeSpecifier*/) + static Unit* GetObjectInWorld(ObjectGuid guid, Unit* /*typeSpecifier*/) { - if (IS_PLAYER_GUID(guid)) + if (guid.IsPlayer()) return (Unit*)GetObjectInWorld(guid, (Player*)NULL); - if (IS_PET_GUID(guid)) + if (guid.IsPet()) return (Unit*)GetObjectInWorld(guid, (Pet*)NULL); return (Unit*)GetObjectInWorld(guid, (Creature*)NULL); } // returns object if is in map - template<class T> static T* GetObjectInMap(uint64 guid, Map* map, T* /*typeSpecifier*/) + template<class T> static T* GetObjectInMap(ObjectGuid guid, Map* map, T* /*typeSpecifier*/) { ASSERT(map); if (T * obj = GetObjectInWorld(guid, (T*)NULL)) @@ -146,27 +146,27 @@ class ObjectAccessor return NULL; } - template<class T> static T* GetObjectInWorld(uint32 mapid, float x, float y, uint64 guid, T* /*fake*/); + template<class T> static T* GetObjectInWorld(uint32 mapid, float x, float y, ObjectGuid guid, T* /*fake*/); // these functions return objects only if in map of specified object - static WorldObject* GetWorldObject(WorldObject const&, uint64); - static Object* GetObjectByTypeMask(WorldObject const&, uint64, uint32 typemask); - static Corpse* GetCorpse(WorldObject const& u, uint64 guid); - static GameObject* GetGameObject(WorldObject const& u, uint64 guid); - static Transport* GetTransport(WorldObject const& u, uint64 guid); - static DynamicObject* GetDynamicObject(WorldObject const& u, uint64 guid); - static Unit* GetUnit(WorldObject const&, uint64 guid); - static Creature* GetCreature(WorldObject const& u, uint64 guid); - static Pet* GetPet(WorldObject const&, uint64 guid); - static Player* GetPlayer(WorldObject const&, uint64 guid); - static Creature* GetCreatureOrPetOrVehicle(WorldObject const&, uint64); + static WorldObject* GetWorldObject(WorldObject const&, ObjectGuid); + static Object* GetObjectByTypeMask(WorldObject const&, ObjectGuid, uint32 typemask); + static Corpse* GetCorpse(WorldObject const& u, ObjectGuid guid); + static GameObject* GetGameObject(WorldObject const& u, ObjectGuid guid); + static Transport* GetTransport(WorldObject const& u, ObjectGuid guid); + static DynamicObject* GetDynamicObject(WorldObject const& u, ObjectGuid guid); + static Unit* GetUnit(WorldObject const&, ObjectGuid guid); + static Creature* GetCreature(WorldObject const& u, ObjectGuid guid); + static Pet* GetPet(WorldObject const&, ObjectGuid guid); + static Player* GetPlayer(WorldObject const&, ObjectGuid guid); + static Creature* GetCreatureOrPetOrVehicle(WorldObject const&, ObjectGuid); // these functions return objects if found in whole world // ACCESS LIKE THAT IS NOT THREAD SAFE - static Pet* FindPet(uint64); - static Player* FindPlayer(uint64); - static Creature* FindCreature(uint64); - static Unit* FindUnit(uint64); + static Pet* FindPet(ObjectGuid); + static Player* FindPlayer(ObjectGuid); + static Creature* FindCreature(ObjectGuid); + static Unit* FindUnit(ObjectGuid); static Player* FindPlayerByName(std::string const& name); // when using this, you must use the hashmapholder's lock @@ -213,11 +213,11 @@ class ObjectAccessor } //Thread safe - Corpse* GetCorpseForPlayerGUID(uint64 guid); + Corpse* GetCorpseForPlayerGUID(ObjectGuid guid); void RemoveCorpse(Corpse* corpse); void AddCorpse(Corpse* corpse); void AddCorpsesToGrid(GridCoord const& gridpair, GridType& grid, Map* map); - Corpse* ConvertCorpseForPlayer(uint64 player_guid, bool insignia = false); + Corpse* ConvertCorpseForPlayer(ObjectGuid player_guid, bool insignia = false); //Thread unsafe void Update(uint32 diff); @@ -229,7 +229,7 @@ class ObjectAccessor static void _buildPacket(Player*, Object*, UpdateDataMapType&); void _update(); - typedef std::unordered_map<uint64, Corpse*> Player2CorpsesMapType; + typedef std::unordered_map<ObjectGuid, Corpse*> Player2CorpsesMapType; typedef std::unordered_map<Player*, UpdateData>::value_type UpdateDataValueType; std::set<Object*> i_objects; diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 20c20a883d2..4625a05ffdf 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -1296,7 +1296,7 @@ void ObjectMgr::LoadLinkedRespawn() uint32 linkedGuidLow = fields[1].GetUInt32(); uint8 linkType = fields[2].GetUInt8(); - uint64 guid = 0, linkedGuid = 0; + ObjectGuid guid, linkedGuid; bool error = false; switch (linkType) { @@ -1333,8 +1333,8 @@ void ObjectMgr::LoadLinkedRespawn() break; } - guid = MAKE_NEW_GUID(guidLow, slave->id, HIGHGUID_UNIT); - linkedGuid = MAKE_NEW_GUID(linkedGuidLow, master->id, HIGHGUID_UNIT); + guid = ObjectGuid(HIGHGUID_UNIT, slave->id, guidLow); + linkedGuid = ObjectGuid(HIGHGUID_UNIT, master->id, linkedGuidLow); break; } case CREATURE_TO_GO: @@ -1370,8 +1370,8 @@ void ObjectMgr::LoadLinkedRespawn() break; } - guid = MAKE_NEW_GUID(guidLow, slave->id, HIGHGUID_UNIT); - linkedGuid = MAKE_NEW_GUID(linkedGuidLow, master->id, HIGHGUID_GAMEOBJECT); + guid = ObjectGuid(HIGHGUID_UNIT, slave->id, guidLow); + linkedGuid = ObjectGuid(HIGHGUID_GAMEOBJECT, master->id, linkedGuidLow); break; } case GO_TO_GO: @@ -1407,8 +1407,8 @@ void ObjectMgr::LoadLinkedRespawn() break; } - guid = MAKE_NEW_GUID(guidLow, slave->id, HIGHGUID_GAMEOBJECT); - linkedGuid = MAKE_NEW_GUID(linkedGuidLow, master->id, HIGHGUID_GAMEOBJECT); + guid = ObjectGuid(HIGHGUID_GAMEOBJECT, slave->id, guidLow); + linkedGuid = ObjectGuid(HIGHGUID_GAMEOBJECT, master->id, linkedGuidLow); break; } case GO_TO_CREATURE: @@ -1444,8 +1444,8 @@ void ObjectMgr::LoadLinkedRespawn() break; } - guid = MAKE_NEW_GUID(guidLow, slave->id, HIGHGUID_GAMEOBJECT); - linkedGuid = MAKE_NEW_GUID(linkedGuidLow, master->id, HIGHGUID_UNIT); + guid = ObjectGuid(HIGHGUID_GAMEOBJECT, slave->id, guidLow); + linkedGuid = ObjectGuid(HIGHGUID_UNIT, master->id, linkedGuidLow); break; } } @@ -1463,9 +1463,9 @@ bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guidLow, uint32 linkedGuidLow) if (!guidLow) return false; - const CreatureData* master = GetCreatureData(guidLow); + CreatureData const* master = GetCreatureData(guidLow); ASSERT(master); - uint64 guid = MAKE_NEW_GUID(guidLow, master->id, HIGHGUID_UNIT); + ObjectGuid guid(HIGHGUID_UNIT, master->id, guidLow); if (!linkedGuidLow) // we're removing the linking { @@ -1476,14 +1476,14 @@ bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guidLow, uint32 linkedGuidLow) return true; } - const CreatureData* slave = GetCreatureData(linkedGuidLow); + CreatureData const* slave = GetCreatureData(linkedGuidLow); if (!slave) { TC_LOG_ERROR("sql.sql", "Creature '%u' linking to non-existent creature '%u'.", guidLow, linkedGuidLow); return false; } - const MapEntry* const map = sMapStore.LookupEntry(master->mapid); + MapEntry const* map = sMapStore.LookupEntry(master->mapid); if (!map || !map->Instanceable() || (master->mapid != slave->mapid)) { TC_LOG_ERROR("sql.sql", "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); @@ -1496,7 +1496,7 @@ bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guidLow, uint32 linkedGuidLow) return false; } - uint64 linkedGuid = MAKE_NEW_GUID(linkedGuidLow, slave->id, HIGHGUID_UNIT); + ObjectGuid linkedGuid(HIGHGUID_UNIT, slave->id, linkedGuidLow); _linkedRespawnStore[guid] = linkedGuid; PreparedStatement *stmt = WorldDatabase.GetPreparedStatement(WORLD_REP_CREATURE_LINKED_RESPAWN); @@ -2071,15 +2071,13 @@ void ObjectMgr::RemoveGameobjectFromGrid(uint32 guid, GameObjectData const* data Player* ObjectMgr::GetPlayerByLowGUID(uint32 lowguid) const { - uint64 guid = MAKE_NEW_GUID(lowguid, 0, HIGHGUID_PLAYER); + ObjectGuid guid(HIGHGUID_PLAYER, lowguid); return ObjectAccessor::FindPlayer(guid); } // name must be checked to correctness (if received) before call this function -uint64 ObjectMgr::GetPlayerGUIDByName(std::string const& name) const +ObjectGuid ObjectMgr::GetPlayerGUIDByName(std::string const& name) const { - uint64 guid = 0; - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_BY_NAME); stmt->setString(0, name); @@ -2087,12 +2085,12 @@ uint64 ObjectMgr::GetPlayerGUIDByName(std::string const& name) const PreparedQueryResult result = CharacterDatabase.Query(stmt); if (result) - guid = MAKE_NEW_GUID((*result)[0].GetUInt32(), 0, HIGHGUID_PLAYER); + return ObjectGuid(HIGHGUID_PLAYER, (*result)[0].GetUInt32()); - return guid; + return ObjectGuid::Empty; } -bool ObjectMgr::GetPlayerNameByGUID(uint64 guid, std::string& name) const +bool ObjectMgr::GetPlayerNameByGUID(ObjectGuid guid, std::string& name) const { // prevent DB access for online player if (Player* player = ObjectAccessor::FindPlayer(guid)) @@ -2103,7 +2101,7 @@ bool ObjectMgr::GetPlayerNameByGUID(uint64 guid, std::string& name) const PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME); - stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt32(0, guid.GetCounter()); PreparedQueryResult result = CharacterDatabase.Query(stmt); @@ -2116,7 +2114,7 @@ bool ObjectMgr::GetPlayerNameByGUID(uint64 guid, std::string& name) const return false; } -uint32 ObjectMgr::GetPlayerTeamByGUID(uint64 guid) const +uint32 ObjectMgr::GetPlayerTeamByGUID(ObjectGuid guid) const { // prevent DB access for online player if (Player* player = ObjectAccessor::FindPlayer(guid)) @@ -2126,7 +2124,7 @@ uint32 ObjectMgr::GetPlayerTeamByGUID(uint64 guid) const PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_RACE); - stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt32(0, guid.GetCounter()); PreparedQueryResult result = CharacterDatabase.Query(stmt); @@ -2139,7 +2137,7 @@ uint32 ObjectMgr::GetPlayerTeamByGUID(uint64 guid) const return 0; } -uint32 ObjectMgr::GetPlayerAccountIdByGUID(uint64 guid) const +uint32 ObjectMgr::GetPlayerAccountIdByGUID(ObjectGuid guid) const { // prevent DB access for online player if (Player* player = ObjectAccessor::FindPlayer(guid)) @@ -2149,7 +2147,7 @@ uint32 ObjectMgr::GetPlayerAccountIdByGUID(uint64 guid) const PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ACCOUNT_BY_GUID); - stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt32(0, guid.GetCounter()); PreparedQueryResult result = CharacterDatabase.Query(stmt); @@ -5469,7 +5467,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) Player* player = NULL; if (serverUp) - player = ObjectAccessor::FindPlayer((uint64)m->receiver); + player = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, m->receiver)); if (player && player->m_mailsLoaded) { // this code will run very improbably (the time is between 4 and 5 am, in game is online a player, who has old mail diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index d15ca257d67..a26e2959769 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -475,7 +475,7 @@ struct TrinityStringLocale StringVector Content; }; -typedef std::map<uint64, uint64> LinkedRespawnContainer; +typedef std::map<ObjectGuid, ObjectGuid> LinkedRespawnContainer; typedef std::unordered_map<uint32, CreatureData> CreatureDataContainer; typedef std::unordered_map<uint32, GameObjectData> GameObjectDataContainer; typedef std::map<TempSummonGroupKey, std::vector<TempSummonData> > TempSummonDataContainer; @@ -763,7 +763,7 @@ class ObjectMgr void GetPlayerLevelInfo(uint32 race, uint32 class_, uint8 level, PlayerLevelInfo* info) const; - uint64 GetPlayerGUIDByName(std::string const& name) const; + ObjectGuid GetPlayerGUIDByName(std::string const& name) const; /** * Retrieves the player name by guid. @@ -778,9 +778,9 @@ class ObjectMgr * * @return true if player was found, false otherwise */ - bool GetPlayerNameByGUID(uint64 guid, std::string& name) const; - uint32 GetPlayerTeamByGUID(uint64 guid) const; - uint32 GetPlayerAccountIdByGUID(uint64 guid) const; + bool GetPlayerNameByGUID(ObjectGuid guid, std::string& name) const; + uint32 GetPlayerTeamByGUID(ObjectGuid guid) const; + uint32 GetPlayerAccountIdByGUID(ObjectGuid guid) const; uint32 GetPlayerAccountIdByPlayerName(std::string const& name) const; uint32 GetNearestTaxiNode(float x, float y, float z, uint32 mapid, uint32 team); @@ -1117,10 +1117,10 @@ class ObjectMgr } CreatureData& NewOrExistCreatureData(uint32 guid) { return _creatureDataStore[guid]; } void DeleteCreatureData(uint32 guid); - uint64 GetLinkedRespawnGuid(uint64 guid) const + ObjectGuid GetLinkedRespawnGuid(ObjectGuid guid) const { LinkedRespawnContainer::const_iterator itr = _linkedRespawnStore.find(guid); - if (itr == _linkedRespawnStore.end()) return 0; + if (itr == _linkedRespawnStore.end()) return ObjectGuid::Empty; return itr->second; } CreatureLocale const* GetCreatureLocale(uint32 entry) const diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.cpp b/src/server/game/Grids/Notifiers/GridNotifiers.cpp index 270d598d53a..854e5cffe5d 100644 --- a/src/server/game/Grids/Notifiers/GridNotifiers.cpp +++ b/src/server/game/Grids/Notifiers/GridNotifiers.cpp @@ -65,12 +65,12 @@ void VisibleNotifier::SendToSelf() } } - for (Player::ClientGUIDs::const_iterator it = vis_guids.begin();it != vis_guids.end(); ++it) + for (GuidSet::const_iterator it = vis_guids.begin(); it != vis_guids.end(); ++it) { i_player.m_clientGUIDs.erase(*it); i_data.AddOutOfRangeGUID(*it); - if (IS_PLAYER_GUID(*it)) + if (it->IsPlayer()) { Player* player = ObjectAccessor::FindPlayer(*it); if (player && player->IsInWorld() && !player->isNeedNotify(NOTIFY_VISIBILITY_CHANGED)) diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index e9ba95f8fb6..5434105ce0e 100644 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -43,7 +43,7 @@ namespace Trinity Player &i_player; UpdateData i_data; std::set<Unit*> i_visibleNow; - Player::ClientGUIDs vis_guids; + GuidSet vis_guids; VisibleNotifier(Player &player) : i_player(player), vis_guids(player.m_clientGUIDs) { } template<class T> void Visit(GridRefManager<T> &m); @@ -1354,20 +1354,20 @@ namespace Trinity class ObjectGUIDCheck { public: - ObjectGUIDCheck(uint64 GUID) : _GUID(GUID) { } + ObjectGUIDCheck(ObjectGuid GUID) : _GUID(GUID) { } bool operator()(WorldObject* object) { return object->GetGUID() == _GUID; } private: - uint64 _GUID; + ObjectGuid _GUID; }; class UnitAuraCheck { public: - UnitAuraCheck(bool present, uint32 spellId, uint64 casterGUID = 0) : _present(present), _spellId(spellId), _casterGUID(casterGUID) { } + UnitAuraCheck(bool present, uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty) : _present(present), _spellId(spellId), _casterGUID(casterGUID) { } bool operator()(Unit* unit) const { return unit->HasAura(_spellId, _casterGUID) == _present; @@ -1381,7 +1381,7 @@ namespace Trinity private: bool _present; uint32 _spellId; - uint64 _casterGUID; + ObjectGuid _casterGUID; }; // Player checks and do diff --git a/src/server/game/Grids/ObjectGridLoader.cpp b/src/server/game/Grids/ObjectGridLoader.cpp index 51a1f2215f8..c18458139e2 100644 --- a/src/server/game/Grids/ObjectGridLoader.cpp +++ b/src/server/game/Grids/ObjectGridLoader.cpp @@ -140,7 +140,7 @@ void LoadHelper(CellCorpseSet const& cell_corpses, CellCoord &cell, CorpseMapTyp if (itr->second != map->GetInstanceId()) continue; - uint32 player_guid = itr->first; + ObjectGuid player_guid(HIGHGUID_PLAYER, itr->first); Corpse* obj = sObjectAccessor->GetCorpseForPlayerGUID(player_guid); if (!obj) diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index 4becedfe41a..df34c12e332 100644 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -36,7 +36,7 @@ #include "LFGMgr.h" #include "UpdateFieldFlags.h" -Roll::Roll(uint64 _guid, LootItem const& li) : itemGUID(_guid), itemid(li.itemid), +Roll::Roll(ObjectGuid _guid, LootItem const& li) : itemGUID(_guid), itemid(li.itemid), itemRandomPropId(li.randomPropertyId), itemRandomSuffix(li.randomSuffix), itemCount(li.count), totalPlayersRolling(0), totalNeed(0), totalGreed(0), totalPass(0), itemSlot(0), rollVoteMask(ROLL_ALL_TYPE_NO_DISENCHANT) { } @@ -53,13 +53,13 @@ Loot* Roll::getLoot() return getTarget(); } -Group::Group() : m_leaderGuid(0), m_leaderName(""), m_groupType(GROUPTYPE_NORMAL), +Group::Group() : m_leaderGuid(), m_leaderName(""), m_groupType(GROUPTYPE_NORMAL), m_dungeonDifficulty(DUNGEON_DIFFICULTY_NORMAL), m_raidDifficulty(RAID_DIFFICULTY_10MAN_NORMAL), -m_bgGroup(NULL), m_bfGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(0), -m_masterLooterGuid(0), m_subGroupsCounts(NULL), m_guid(0), m_counter(0), m_maxEnchantingLevel(0), m_dbStoreId(0) +m_bgGroup(NULL), m_bfGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(), +m_masterLooterGuid(), m_subGroupsCounts(NULL), m_guid(), m_counter(0), m_maxEnchantingLevel(0), m_dbStoreId(0) { for (uint8 i = 0; i < TARGETICONCOUNT; ++i) - m_targetIcons[i] = 0; + m_targetIcons[i].Clear(); } Group::~Group() @@ -91,10 +91,10 @@ Group::~Group() bool Group::Create(Player* leader) { - uint64 leaderGuid = leader->GetGUID(); + ObjectGuid leaderGuid = leader->GetGUID(); uint32 lowguid = sGroupMgr->GenerateGroupId(); - m_guid = MAKE_NEW_GUID(lowguid, 0, HIGHGUID_GROUP); + m_guid = ObjectGuid(HIGHGUID_GROUP, lowguid); m_leaderGuid = leaderGuid; m_leaderName = leader->GetName(); leader->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GROUP_LEADER); @@ -110,7 +110,7 @@ bool Group::Create(Player* leader) m_lootThreshold = ITEM_QUALITY_UNCOMMON; m_looterGuid = leaderGuid; - m_masterLooterGuid = 0; + m_masterLooterGuid.Clear(); m_dungeonDifficulty = DUNGEON_DIFFICULTY_NORMAL; m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL; @@ -130,22 +130,22 @@ bool Group::Create(Player* leader) uint8 index = 0; stmt->setUInt32(index++, m_dbStoreId); - stmt->setUInt32(index++, GUID_LOPART(m_leaderGuid)); + stmt->setUInt32(index++, m_leaderGuid.GetCounter()); stmt->setUInt8(index++, uint8(m_lootMethod)); - stmt->setUInt32(index++, GUID_LOPART(m_looterGuid)); + stmt->setUInt32(index++, m_looterGuid.GetCounter()); stmt->setUInt8(index++, uint8(m_lootThreshold)); - stmt->setUInt32(index++, uint32(m_targetIcons[0])); - stmt->setUInt32(index++, uint32(m_targetIcons[1])); - stmt->setUInt32(index++, uint32(m_targetIcons[2])); - stmt->setUInt32(index++, uint32(m_targetIcons[3])); - stmt->setUInt32(index++, uint32(m_targetIcons[4])); - stmt->setUInt32(index++, uint32(m_targetIcons[5])); - stmt->setUInt32(index++, uint32(m_targetIcons[6])); - stmt->setUInt32(index++, uint32(m_targetIcons[7])); + stmt->setUInt64(index++, m_targetIcons[0].GetRawValue()); + stmt->setUInt64(index++, m_targetIcons[1].GetRawValue()); + stmt->setUInt64(index++, m_targetIcons[2].GetRawValue()); + stmt->setUInt64(index++, m_targetIcons[3].GetRawValue()); + stmt->setUInt64(index++, m_targetIcons[4].GetRawValue()); + stmt->setUInt64(index++, m_targetIcons[5].GetRawValue()); + stmt->setUInt64(index++, m_targetIcons[6].GetRawValue()); + stmt->setUInt64(index++, m_targetIcons[7].GetRawValue()); stmt->setUInt8(index++, uint8(m_groupType)); stmt->setUInt32(index++, uint8(m_dungeonDifficulty)); stmt->setUInt32(index++, uint8(m_raidDifficulty)); - stmt->setUInt32(index++, GUID_LOPART(m_masterLooterGuid)); + stmt->setUInt32(index++, m_masterLooterGuid.GetCounter()); CharacterDatabase.Execute(stmt); @@ -163,19 +163,19 @@ bool Group::Create(Player* leader) void Group::LoadGroupFromDB(Field* fields) { m_dbStoreId = fields[16].GetUInt32(); - m_guid = MAKE_NEW_GUID(sGroupMgr->GenerateGroupId(), 0, HIGHGUID_GROUP); - m_leaderGuid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER); + m_guid = ObjectGuid(HIGHGUID_GROUP, sGroupMgr->GenerateGroupId()); + m_leaderGuid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32()); // group leader not exist - if (!sObjectMgr->GetPlayerNameByGUID(fields[0].GetUInt32(), m_leaderName)) + if (!sObjectMgr->GetPlayerNameByGUID(m_leaderGuid, m_leaderName)) return; m_lootMethod = LootMethod(fields[1].GetUInt8()); - m_looterGuid = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER); + m_looterGuid = ObjectGuid(HIGHGUID_PLAYER, fields[2].GetUInt32()); m_lootThreshold = ItemQualities(fields[3].GetUInt8()); for (uint8 i = 0; i < TARGETICONCOUNT; ++i) - m_targetIcons[i] = fields[4+i].GetUInt32(); + m_targetIcons[i].Set(fields[4 + i].GetUInt64()); m_groupType = GroupType(fields[12].GetUInt8()); if (m_groupType & GROUPTYPE_RAID) @@ -193,7 +193,7 @@ void Group::LoadGroupFromDB(Field* fields) else m_raidDifficulty = Difficulty(r_diff); - m_masterLooterGuid = MAKE_NEW_GUID(fields[15].GetUInt32(), 0, HIGHGUID_PLAYER); + m_masterLooterGuid = ObjectGuid(HIGHGUID_PLAYER, fields[15].GetUInt32()); if (m_groupType & GROUPTYPE_LFG) sLFGMgr->_LoadFromDB(fields, GetGUID()); @@ -202,7 +202,7 @@ void Group::LoadGroupFromDB(Field* fields) void Group::LoadMemberFromDB(uint32 guidLow, uint8 memberFlags, uint8 subgroup, uint8 roles) { MemberSlot member; - member.guid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER); + member.guid = ObjectGuid(HIGHGUID_PLAYER, guidLow); // skip non-existed member if (!sObjectMgr->GetPlayerNameByGUID(member.guid, member.name)) @@ -314,7 +314,7 @@ void Group::RemoveAllInvites() m_invitees.clear(); } -Player* Group::GetInvited(uint64 guid) const +Player* Group::GetInvited(ObjectGuid guid) const { for (InvitesList::const_iterator itr = m_invitees.begin(); itr != m_invitees.end(); ++itr) { @@ -383,7 +383,7 @@ bool Group::AddMember(Player* player) if (!isRaidGroup()) // reset targetIcons for non-raid-groups { for (uint8 i = 0; i < TARGETICONCOUNT; ++i) - m_targetIcons[i] = 0; + m_targetIcons[i].Clear(); } // insert into the table if we're not a battleground group @@ -392,7 +392,7 @@ bool Group::AddMember(Player* player) PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GROUP_MEMBER); stmt->setUInt32(0, m_dbStoreId); - stmt->setUInt32(1, GUID_LOPART(member.guid)); + stmt->setUInt32(1, member.guid.GetCounter()); stmt->setUInt8(2, member.flags); stmt->setUInt8(3, member.group); stmt->setUInt8(4, member.roles); @@ -482,7 +482,7 @@ bool Group::AddMember(Player* player) return true; } -bool Group::RemoveMember(uint64 guid, const RemoveMethod& method /*= GROUP_REMOVEMETHOD_DEFAULT*/, uint64 kicker /*= 0*/, const char* reason /*= NULL*/) +bool Group::RemoveMember(ObjectGuid guid, const RemoveMethod& method /*= GROUP_REMOVEMETHOD_DEFAULT*/, ObjectGuid kicker /*= 0*/, const char* reason /*= NULL*/) { BroadcastGroupUpdate(); @@ -534,7 +534,7 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod& method /*= GROUP_REMOV if (!isBGGroup() && !isBFGroup()) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER); - stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt32(0, guid.GetCounter()); CharacterDatabase.Execute(stmt); DelinkMember(guid); } @@ -613,7 +613,7 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod& method /*= GROUP_REMOV } } -void Group::ChangeLeader(uint64 newLeaderGuid) +void Group::ChangeLeader(ObjectGuid newLeaderGuid) { member_witerator slot = _getMemberWSlot(newLeaderGuid); @@ -817,7 +817,7 @@ void Group::SendLootStartRollToPlayer(uint32 countDown, uint32 mapId, Player* p, p->GetSession()->SendPacket(&data); } -void Group::SendLootRoll(uint64 sourceGuid, uint64 targetGuid, uint8 rollNumber, uint8 rollType, Roll const& roll) +void Group::SendLootRoll(ObjectGuid sourceGuid, ObjectGuid targetGuid, uint8 rollNumber, uint8 rollType, Roll const& roll) { WorldPacket data(SMSG_LOOT_ROLL, (8+4+8+4+4+4+1+1+1)); data << uint64(sourceGuid); // guid of the item rolled @@ -841,7 +841,7 @@ void Group::SendLootRoll(uint64 sourceGuid, uint64 targetGuid, uint8 rollNumber, } } -void Group::SendLootRollWon(uint64 sourceGuid, uint64 targetGuid, uint8 rollNumber, uint8 rollType, Roll const& roll) +void Group::SendLootRollWon(ObjectGuid sourceGuid, ObjectGuid targetGuid, uint8 rollNumber, uint8 rollType, Roll const& roll) { WorldPacket data(SMSG_LOOT_ROLL_WON, (8+4+4+4+4+8+1+1)); data << uint64(sourceGuid); // guid of the item rolled @@ -893,12 +893,12 @@ void Group::SendLooter(Creature* creature, Player* groupLooter) data << uint64(creature->GetGUID()); if (GetLootMethod() == MASTER_LOOT && creature->loot.hasOverThresholdItem()) - data.appendPackGUID(GetMasterLooterGuid()); + data << GetMasterLooterGuid().WriteAsPacked(); else data << uint8(0); if (groupLooter) - data.append(groupLooter->GetPackGUID()); + data << groupLooter->GetPackGUID(); else data << uint8(0); @@ -926,7 +926,7 @@ void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject) //roll for over-threshold item if it's one-player loot if (item->Quality >= uint32(m_lootThreshold)) { - uint64 newitemGUID = MAKE_NEW_GUID(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM); + ObjectGuid newitemGUID = ObjectGuid(HIGHGUID_ITEM, sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM)); Roll* r = new Roll(newitemGUID, *i); //a vector is filled with only near party members @@ -1010,7 +1010,7 @@ void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject) continue; } - uint64 newitemGUID = MAKE_NEW_GUID(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM); + ObjectGuid newitemGUID = ObjectGuid(HIGHGUID_ITEM, sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM)); Roll* r = new Roll(newitemGUID, *i); //a vector is filled with only near party members @@ -1071,7 +1071,7 @@ void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject) //roll for over-threshold item if it's one-player loot if (item->Quality >= uint32(m_lootThreshold)) { - uint64 newitemGUID = MAKE_NEW_GUID(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM); + ObjectGuid newitemGUID = ObjectGuid(HIGHGUID_ITEM, sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM)); Roll* r = new Roll(newitemGUID, *i); for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) @@ -1146,7 +1146,7 @@ void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject) continue; item = sObjectMgr->GetItemTemplate(i->itemid); - uint64 newitemGUID = MAKE_NEW_GUID(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM); + ObjectGuid newitemGUID = ObjectGuid(HIGHGUID_ITEM, sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM)); Roll* r = new Roll(newitemGUID, *i); for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) @@ -1249,7 +1249,7 @@ void Group::MasterLoot(Loot* loot, WorldObject* pLootedObject) } } -void Group::CountRollVote(uint64 playerGUID, uint64 Guid, uint8 Choice) +void Group::CountRollVote(ObjectGuid playerGUID, ObjectGuid Guid, uint8 Choice) { Rolls::iterator rollI = GetRoll(Guid); if (rollI == RollId.end()) @@ -1268,22 +1268,22 @@ void Group::CountRollVote(uint64 playerGUID, uint64 Guid, uint8 Choice) switch (Choice) { case ROLL_PASS: // Player choose pass - SendLootRoll(0, playerGUID, 128, ROLL_PASS, *roll); + SendLootRoll(ObjectGuid::Empty, playerGUID, 128, ROLL_PASS, *roll); ++roll->totalPass; itr->second = PASS; break; case ROLL_NEED: // player choose Need - SendLootRoll(0, playerGUID, 0, 0, *roll); + SendLootRoll(ObjectGuid::Empty, playerGUID, 0, 0, *roll); ++roll->totalNeed; itr->second = NEED; break; case ROLL_GREED: // player choose Greed - SendLootRoll(0, playerGUID, 128, ROLL_GREED, *roll); + SendLootRoll(ObjectGuid::Empty, playerGUID, 128, ROLL_GREED, *roll); ++roll->totalGreed; itr->second = GREED; break; case ROLL_DISENCHANT: // player choose Disenchant - SendLootRoll(0, playerGUID, 128, ROLL_DISENCHANT, *roll); + SendLootRoll(ObjectGuid::Empty, playerGUID, 128, ROLL_DISENCHANT, *roll); ++roll->totalGreed; itr->second = DISENCHANT; break; @@ -1323,7 +1323,7 @@ void Group::CountTheRoll(Rolls::iterator rollI) if (!roll->playerVote.empty()) { uint8 maxresul = 0; - uint64 maxguid = (*roll->playerVote.begin()).first; + ObjectGuid maxguid = (*roll->playerVote.begin()).first; Player* player; for (Roll::PlayerVote::const_iterator itr=roll->playerVote.begin(); itr != roll->playerVote.end(); ++itr) @@ -1332,14 +1332,14 @@ void Group::CountTheRoll(Rolls::iterator rollI) continue; uint8 randomN = urand(1, 100); - SendLootRoll(0, itr->first, randomN, ROLL_NEED, *roll); + SendLootRoll(ObjectGuid::Empty, itr->first, randomN, ROLL_NEED, *roll); if (maxresul < randomN) { maxguid = itr->first; maxresul = randomN; } } - SendLootRollWon(0, maxguid, maxresul, ROLL_NEED, *roll); + SendLootRollWon(ObjectGuid::Empty, maxguid, maxresul, ROLL_NEED, *roll); player = ObjectAccessor::FindPlayer(maxguid); if (player && player->GetSession()) @@ -1369,7 +1369,7 @@ void Group::CountTheRoll(Rolls::iterator rollI) if (!roll->playerVote.empty()) { uint8 maxresul = 0; - uint64 maxguid = (*roll->playerVote.begin()).first; + ObjectGuid maxguid = (*roll->playerVote.begin()).first; Player* player; RollVote rollvote = NOT_VALID; @@ -1380,7 +1380,7 @@ void Group::CountTheRoll(Rolls::iterator rollI) continue; uint8 randomN = urand(1, 100); - SendLootRoll(0, itr->first, randomN, itr->second, *roll); + SendLootRoll(ObjectGuid::Empty, itr->first, randomN, itr->second, *roll); if (maxresul < randomN) { maxguid = itr->first; @@ -1388,7 +1388,7 @@ void Group::CountTheRoll(Rolls::iterator rollI) rollvote = itr->second; } } - SendLootRollWon(0, maxguid, maxresul, rollvote, *roll); + SendLootRollWon(ObjectGuid::Empty, maxguid, maxresul, rollvote, *roll); player = ObjectAccessor::FindPlayer(maxguid); if (player && player->GetSession()) @@ -1457,16 +1457,16 @@ void Group::CountTheRoll(Rolls::iterator rollI) delete roll; } -void Group::SetTargetIcon(uint8 id, uint64 whoGuid, uint64 targetGuid) +void Group::SetTargetIcon(uint8 id, ObjectGuid whoGuid, ObjectGuid targetGuid) { if (id >= TARGETICONCOUNT) return; // clean other icons - if (targetGuid != 0) + if (targetGuid) for (int i=0; i<TARGETICONCOUNT; ++i) if (m_targetIcons[i] == targetGuid) - SetTargetIcon(i, 0, 0); + SetTargetIcon(i, ObjectGuid::Empty, ObjectGuid::Empty); m_targetIcons[id] = targetGuid; @@ -1488,7 +1488,7 @@ void Group::SendTargetIconList(WorldSession* session) for (uint8 i = 0; i < TARGETICONCOUNT; ++i) { - if (m_targetIcons[i] == 0) + if (m_targetIcons[i].IsEmpty()) continue; data << uint8(i); @@ -1504,7 +1504,7 @@ void Group::SendUpdate() SendUpdateToPlayer(witr->guid, &(*witr)); } -void Group::SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot) +void Group::SendUpdateToPlayer(ObjectGuid playerGUID, MemberSlot* slot) { Player* player = ObjectAccessor::FindPlayer(playerGUID); @@ -1591,12 +1591,12 @@ void Group::UpdatePlayerOutOfRange(Player* player) } } -void Group::BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int group, uint64 ignore) +void Group::BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int group, ObjectGuid ignore) { for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) { Player* player = itr->GetSource(); - if (!player || (ignore != 0 && player->GetGUID() == ignore) || (ignorePlayersInBGRaid && player->GetGroup() != this)) + if (!player || (!ignore.IsEmpty() && player->GetGUID() == ignore) || (ignorePlayersInBGRaid && player->GetGroup() != this)) continue; if (player->GetSession() && (group == -1 || itr->getSubGroup() == group)) @@ -1630,7 +1630,7 @@ void Group::OfflineReadyCheck() } } -bool Group::_setMembersGroup(uint64 guid, uint8 group) +bool Group::_setMembersGroup(ObjectGuid guid, uint8 group) { member_witerator slot = _getMemberWSlot(guid); if (slot == m_memberSlots.end()) @@ -1645,7 +1645,7 @@ bool Group::_setMembersGroup(uint64 guid, uint8 group) PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_MEMBER_SUBGROUP); stmt->setUInt8(0, group); - stmt->setUInt32(1, GUID_LOPART(guid)); + stmt->setUInt32(1, guid.GetCounter()); CharacterDatabase.Execute(stmt); } @@ -1665,7 +1665,7 @@ bool Group::SameSubGroup(Player const* member1, Player const* member2) const } // Allows setting sub groups both for online or offline members -void Group::ChangeMembersGroup(uint64 guid, uint8 group) +void Group::ChangeMembersGroup(ObjectGuid guid, uint8 group) { // Only raid groups have sub groups if (!isRaidGroup()) @@ -1696,7 +1696,7 @@ void Group::ChangeMembersGroup(uint64 guid, uint8 group) PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_MEMBER_SUBGROUP); stmt->setUInt8(0, group); - stmt->setUInt32(1, GUID_LOPART(guid)); + stmt->setUInt32(1, guid.GetCounter()); CharacterDatabase.Execute(stmt); } @@ -1736,7 +1736,7 @@ void Group::UpdateLooterGuid(WorldObject* pLootedObject, bool ifneed) if (GetLootMethod() == FREE_FOR_ALL) return; - uint64 oldLooterGUID = GetLooterGuid(); + ObjectGuid oldLooterGUID = GetLooterGuid(); member_citerator guid_itr = _getMemberCSlot(oldLooterGUID); if (guid_itr != m_memberSlots.end()) { @@ -1786,7 +1786,7 @@ void Group::UpdateLooterGuid(WorldObject* pLootedObject, bool ifneed) } else { - SetLooterGuid(0); + SetLooterGuid(ObjectGuid::Empty); SendUpdate(); } } @@ -2088,8 +2088,8 @@ InstanceGroupBind* Group::BindToInstance(InstanceSave* save, bool permanent, boo bind.save = save; bind.perm = permanent; if (!load) - TC_LOG_DEBUG("maps", "Group::BindToInstance: Group (guid: %u, storage id: %u) is now bound to map %d, instance %d, difficulty %d", - GUID_LOPART(GetGUID()), m_dbStoreId, save->GetMapId(), save->GetInstanceId(), save->GetDifficulty()); + TC_LOG_DEBUG("maps", "Group::BindToInstance: %s, storage id: %u is now bound to map %d, instance %d, difficulty %d", + GetGUID().ToString().c_str(), m_dbStoreId, save->GetMapId(), save->GetInstanceId(), save->GetDifficulty()); return &bind; } @@ -2153,12 +2153,12 @@ void Group::SetLootMethod(LootMethod method) m_lootMethod = method; } -void Group::SetLooterGuid(uint64 guid) +void Group::SetLooterGuid(ObjectGuid guid) { m_looterGuid = guid; } -void Group::SetMasterLooterGuid(uint64 guid) +void Group::SetMasterLooterGuid(ObjectGuid guid) { m_masterLooterGuid = guid; } @@ -2168,7 +2168,7 @@ void Group::SetLootThreshold(ItemQualities threshold) m_lootThreshold = threshold; } -void Group::SetLfgRoles(uint64 guid, const uint8 roles) +void Group::SetLfgRoles(ObjectGuid guid, uint8 roles) { member_witerator slot = _getMemberWSlot(guid); if (slot == m_memberSlots.end()) @@ -2208,19 +2208,19 @@ bool Group::IsCreated() const return GetMembersCount() > 0; } -uint64 Group::GetLeaderGUID() const +ObjectGuid Group::GetLeaderGUID() const { return m_leaderGuid; } -uint64 Group::GetGUID() const +ObjectGuid Group::GetGUID() const { return m_guid; } uint32 Group::GetLowGUID() const { - return GUID_LOPART(m_guid); + return m_guid.GetCounter(); } char const* Group::GetLeaderName() const @@ -2233,12 +2233,12 @@ LootMethod Group::GetLootMethod() const return m_lootMethod; } -uint64 Group::GetLooterGuid() const +ObjectGuid Group::GetLooterGuid() const { return m_looterGuid; } -uint64 Group::GetMasterLooterGuid() const +ObjectGuid Group::GetMasterLooterGuid() const { return m_masterLooterGuid; } @@ -2248,25 +2248,25 @@ ItemQualities Group::GetLootThreshold() const return m_lootThreshold; } -bool Group::IsMember(uint64 guid) const +bool Group::IsMember(ObjectGuid guid) const { return _getMemberCSlot(guid) != m_memberSlots.end(); } -bool Group::IsLeader(uint64 guid) const +bool Group::IsLeader(ObjectGuid guid) const { return (GetLeaderGUID() == guid); } -uint64 Group::GetMemberGUID(const std::string& name) +ObjectGuid Group::GetMemberGUID(const std::string& name) { for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr) if (itr->name == name) return itr->guid; - return 0; + return ObjectGuid::Empty; } -bool Group::IsAssistant(uint64 guid) const +bool Group::IsAssistant(ObjectGuid guid) const { member_citerator mslot = _getMemberCSlot(guid); if (mslot == m_memberSlots.end()) @@ -2274,7 +2274,7 @@ bool Group::IsAssistant(uint64 guid) const return mslot->flags & MEMBER_FLAG_ASSISTANT; } -bool Group::SameSubGroup(uint64 guid1, uint64 guid2) const +bool Group::SameSubGroup(ObjectGuid guid1, ObjectGuid guid2) const { member_citerator mslot2 = _getMemberCSlot(guid2); if (mslot2 == m_memberSlots.end()) @@ -2282,7 +2282,7 @@ bool Group::SameSubGroup(uint64 guid1, uint64 guid2) const return SameSubGroup(guid1, &*mslot2); } -bool Group::SameSubGroup(uint64 guid1, MemberSlot const* slot2) const +bool Group::SameSubGroup(ObjectGuid guid1, MemberSlot const* slot2) const { member_citerator mslot1 = _getMemberCSlot(guid1); if (mslot1 == m_memberSlots.end() || !slot2) @@ -2296,7 +2296,7 @@ bool Group::HasFreeSlotSubGroup(uint8 subgroup) const } -uint8 Group::GetMemberGroup(uint64 guid) const +uint8 Group::GetMemberGroup(ObjectGuid guid) const { member_citerator mslot = _getMemberCSlot(guid); if (mslot == m_memberSlots.end()) @@ -2314,7 +2314,7 @@ void Group::SetBattlefieldGroup(Battlefield *bg) m_bfGroup = bg; } -void Group::SetGroupMemberFlag(uint64 guid, bool apply, GroupMemberFlags flag) +void Group::SetGroupMemberFlag(ObjectGuid guid, bool apply, GroupMemberFlags flag) { // Assistants, main assistants and main tanks are only available in raid groups if (!isRaidGroup()) @@ -2346,7 +2346,7 @@ void Group::SetGroupMemberFlag(uint64 guid, bool apply, GroupMemberFlags flag) PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_MEMBER_FLAG); stmt->setUInt8(0, slot->flags); - stmt->setUInt32(1, GUID_LOPART(guid)); + stmt->setUInt32(1, guid.GetCounter()); CharacterDatabase.Execute(stmt); @@ -2374,7 +2374,7 @@ bool Group::isRollLootActive() const return !RollId.empty(); } -Group::Rolls::iterator Group::GetRoll(uint64 Guid) +Group::Rolls::iterator Group::GetRoll(ObjectGuid Guid) { Rolls::iterator iter; for (iter=RollId.begin(); iter != RollId.end(); ++iter) @@ -2388,7 +2388,7 @@ void Group::LinkMember(GroupReference* pRef) m_memberMgr.insertFirst(pRef); } -void Group::DelinkMember(uint64 guid) +void Group::DelinkMember(ObjectGuid guid) { GroupReference* ref = m_memberMgr.getFirst(); while (ref) @@ -2420,7 +2420,7 @@ void Group::_initRaidSubGroupsCounter() ++m_subGroupsCounts[itr->group]; } -Group::member_citerator Group::_getMemberCSlot(uint64 Guid) const +Group::member_citerator Group::_getMemberCSlot(ObjectGuid Guid) const { for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr) if (itr->guid == Guid) @@ -2428,7 +2428,7 @@ Group::member_citerator Group::_getMemberCSlot(uint64 Guid) const return m_memberSlots.end(); } -Group::member_witerator Group::_getMemberWSlot(uint64 Guid) +Group::member_witerator Group::_getMemberWSlot(ObjectGuid Guid) { for (member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr) if (itr->guid == Guid) diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h index 59f77a06308..6abfd5b667d 100644 --- a/src/server/game/Groups/Group.h +++ b/src/server/game/Groups/Group.h @@ -127,18 +127,18 @@ static const uint8 GroupUpdateLength[GROUP_UPDATE_FLAGS_COUNT] = { 0, 2, 2, 2, 1 class Roll : public LootValidatorRef { public: - Roll(uint64 _guid, LootItem const& li); + Roll(ObjectGuid _guid, LootItem const& li); ~Roll(); void setLoot(Loot* pLoot); Loot* getLoot(); void targetObjectBuildLink() override; - uint64 itemGUID; + ObjectGuid itemGUID; uint32 itemid; int32 itemRandomPropId; uint32 itemRandomSuffix; uint8 itemCount; - typedef std::map<uint64, RollVote> PlayerVote; + typedef std::map<ObjectGuid, RollVote> PlayerVote; PlayerVote playerVote; //vote position correspond with player position (in group) uint8 totalPlayersRolling; uint8 totalNeed; @@ -164,7 +164,7 @@ class Group public: struct MemberSlot { - uint64 guid; + ObjectGuid guid; std::string name; uint8 group; uint8 flags; @@ -193,15 +193,15 @@ class Group void RemoveAllInvites(); bool AddLeaderInvite(Player* player); bool AddMember(Player* player); - bool RemoveMember(uint64 guid, const RemoveMethod &method = GROUP_REMOVEMETHOD_DEFAULT, uint64 kicker = 0, const char* reason = NULL); - void ChangeLeader(uint64 guid); + bool RemoveMember(ObjectGuid guid, const RemoveMethod &method = GROUP_REMOVEMETHOD_DEFAULT, ObjectGuid kicker = ObjectGuid::Empty, const char* reason = NULL); + void ChangeLeader(ObjectGuid guid); void SetLootMethod(LootMethod method); - void SetLooterGuid(uint64 guid); - void SetMasterLooterGuid(uint64 guid); + void SetLooterGuid(ObjectGuid guid); + void SetMasterLooterGuid(ObjectGuid guid); void UpdateLooterGuid(WorldObject* pLootedObject, bool ifneed = false); void SetLootThreshold(ItemQualities threshold); - void Disband(bool hideDestroy=false); - void SetLfgRoles(uint64 guid, const uint8 roles); + void Disband(bool hideDestroy = false); + void SetLfgRoles(ObjectGuid guid, uint8 roles); // properties accessories bool IsFull() const; @@ -210,28 +210,28 @@ class Group bool isBGGroup() const; bool isBFGroup() const; bool IsCreated() const; - uint64 GetLeaderGUID() const; - uint64 GetGUID() const; + ObjectGuid GetLeaderGUID() const; + ObjectGuid GetGUID() const; uint32 GetLowGUID() const; const char * GetLeaderName() const; LootMethod GetLootMethod() const; - uint64 GetLooterGuid() const; - uint64 GetMasterLooterGuid() const; + ObjectGuid GetLooterGuid() const; + ObjectGuid GetMasterLooterGuid() const; ItemQualities GetLootThreshold() const; uint32 GetDbStoreId() const { return m_dbStoreId; }; // member manipulation methods - bool IsMember(uint64 guid) const; - bool IsLeader(uint64 guid) const; - uint64 GetMemberGUID(const std::string& name); - bool IsAssistant(uint64 guid) const; + bool IsMember(ObjectGuid guid) const; + bool IsLeader(ObjectGuid guid) const; + ObjectGuid GetMemberGUID(const std::string& name); + bool IsAssistant(ObjectGuid guid) const; - Player* GetInvited(uint64 guid) const; + Player* GetInvited(ObjectGuid guid) const; Player* GetInvited(const std::string& name) const; - bool SameSubGroup(uint64 guid1, uint64 guid2) const; - bool SameSubGroup(uint64 guid1, MemberSlot const* slot2) const; + bool SameSubGroup(ObjectGuid guid1, ObjectGuid guid2) const; + bool SameSubGroup(ObjectGuid guid1, MemberSlot const* slot2) const; bool SameSubGroup(Player const* member1, Player const* member2) const; bool HasFreeSlotSubGroup(uint8 subgroup) const; @@ -240,7 +240,7 @@ class Group GroupReference const* GetFirstMember() const { return m_memberMgr.getFirst(); } uint32 GetMembersCount() const { return m_memberSlots.size(); } - uint8 GetMemberGroup(uint64 guid) const; + uint8 GetMemberGroup(ObjectGuid guid) const; void ConvertToLFG(); void ConvertToRaid(); @@ -249,10 +249,9 @@ class Group void SetBattlefieldGroup(Battlefield* bf); GroupJoinBattlegroundResult CanJoinBattlegroundQueue(Battleground const* bgOrTemplate, BattlegroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot); - void ChangeMembersGroup(uint64 guid, uint8 group); - void ChangeMembersGroup(Player* player, uint8 group); - void SetTargetIcon(uint8 id, uint64 whoGuid, uint64 targetGuid); - void SetGroupMemberFlag(uint64 guid, bool apply, GroupMemberFlags flag); + void ChangeMembersGroup(ObjectGuid guid, uint8 group); + void SetTargetIcon(uint8 id, ObjectGuid whoGuid, ObjectGuid targetGuid); + void SetGroupMemberFlag(ObjectGuid guid, bool apply, GroupMemberFlags flag); void RemoveUniqueGroupMemberFlag(GroupMemberFlags flag); Difficulty GetDifficulty(bool isRaid) const; @@ -268,10 +267,10 @@ class Group //void SendInit(WorldSession* session); void SendTargetIconList(WorldSession* session); void SendUpdate(); - void SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot = NULL); + void SendUpdateToPlayer(ObjectGuid playerGUID, MemberSlot* slot = NULL); void UpdatePlayerOutOfRange(Player* player); // ignore: GUID of player that will be ignored - void BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int group = -1, uint64 ignore = 0); + void BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int group = -1, ObjectGuid ignore = ObjectGuid::Empty); void BroadcastReadyCheck(WorldPacket* packet); void OfflineReadyCheck(); @@ -282,23 +281,23 @@ class Group bool isRollLootActive() const; void SendLootStartRoll(uint32 CountDown, uint32 mapid, const Roll &r); void SendLootStartRollToPlayer(uint32 countDown, uint32 mapId, Player* p, bool canNeed, Roll const& r); - void SendLootRoll(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r); - void SendLootRollWon(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r); + void SendLootRoll(ObjectGuid SourceGuid, ObjectGuid TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r); + void SendLootRollWon(ObjectGuid SourceGuid, ObjectGuid TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r); void SendLootAllPassed(Roll const& roll); void SendLooter(Creature* creature, Player* pLooter); void GroupLoot(Loot* loot, WorldObject* pLootedObject); void NeedBeforeGreed(Loot* loot, WorldObject* pLootedObject); void MasterLoot(Loot* loot, WorldObject* pLootedObject); - Rolls::iterator GetRoll(uint64 Guid); + Rolls::iterator GetRoll(ObjectGuid Guid); void CountTheRoll(Rolls::iterator roll); - void CountRollVote(uint64 playerGUID, uint64 Guid, uint8 Choise); + void CountRollVote(ObjectGuid playerGUID, ObjectGuid Guid, uint8 Choise); void EndRoll(Loot* loot); // related to disenchant rolls void ResetMaxEnchantingLevel(); void LinkMember(GroupReference* pRef); - void DelinkMember(uint64 guid); + void DelinkMember(ObjectGuid guid); InstanceGroupBind* BindToInstance(InstanceSave* save, bool permanent, bool load = false); void UnbindInstance(uint32 mapid, uint8 difficulty, bool unload = false); @@ -312,12 +311,12 @@ class Group void BroadcastGroupUpdate(void); protected: - bool _setMembersGroup(uint64 guid, uint8 group); + bool _setMembersGroup(ObjectGuid guid, uint8 group); void _homebindIfInstance(Player* player); void _initRaidSubGroupsCounter(); - member_citerator _getMemberCSlot(uint64 Guid) const; - member_witerator _getMemberWSlot(uint64 Guid); + member_citerator _getMemberCSlot(ObjectGuid Guid) const; + member_witerator _getMemberWSlot(ObjectGuid Guid); void SubGroupCounterIncrease(uint8 subgroup); void SubGroupCounterDecrease(uint8 subgroup); void ToggleGroupMemberFlag(member_witerator slot, uint8 flag, bool apply); @@ -325,22 +324,22 @@ class Group MemberSlotList m_memberSlots; GroupRefManager m_memberMgr; InvitesList m_invitees; - uint64 m_leaderGuid; + ObjectGuid m_leaderGuid; std::string m_leaderName; GroupType m_groupType; Difficulty m_dungeonDifficulty; Difficulty m_raidDifficulty; Battleground* m_bgGroup; Battlefield* m_bfGroup; - uint64 m_targetIcons[TARGETICONCOUNT]; + ObjectGuid m_targetIcons[TARGETICONCOUNT]; LootMethod m_lootMethod; ItemQualities m_lootThreshold; - uint64 m_looterGuid; - uint64 m_masterLooterGuid; + ObjectGuid m_looterGuid; + ObjectGuid m_masterLooterGuid; Rolls RollId; BoundInstancesMap m_boundInstances[MAX_DIFFICULTY]; uint8* m_subGroupsCounts; - uint64 m_guid; + ObjectGuid m_guid; uint32 m_counter; // used only in SMSG_GROUP_LIST uint32 m_maxEnchantingLevel; uint32 m_dbStoreId; // Represents the ID used in database (Can be reused by other groups if group was disbanded) diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp index bace2ec1360..19f8d5cfd9a 100644 --- a/src/server/game/Guilds/Guild.cpp +++ b/src/server/game/Guilds/Guild.cpp @@ -194,10 +194,10 @@ void Guild::EventLogEntry::WritePacket(WorldPacket& data) const // Event type data << uint8(m_eventType); // Player 1 - data << uint64(MAKE_NEW_GUID(m_playerGuid1, 0, HIGHGUID_PLAYER)); + data << ObjectGuid(HIGHGUID_PLAYER, m_playerGuid1); // Player 2 not for left/join guild events if (m_eventType != GUILD_EVENT_LOG_JOIN_GUILD && m_eventType != GUILD_EVENT_LOG_LEAVE_GUILD) - data << uint64(MAKE_NEW_GUID(m_playerGuid2, 0, HIGHGUID_PLAYER)); + data << ObjectGuid(HIGHGUID_PLAYER, m_playerGuid2); // New Rank - only for promote/demote guild events if (m_eventType == GUILD_EVENT_LOG_PROMOTE_PLAYER || m_eventType == GUILD_EVENT_LOG_DEMOTE_PLAYER) data << uint8(m_newRank); @@ -233,7 +233,7 @@ void Guild::BankEventLogEntry::SaveToDB(SQLTransaction& trans) const void Guild::BankEventLogEntry::WritePacket(WorldPacket& data) const { data << uint8(m_eventType); - data << uint64(MAKE_NEW_GUID(m_playerGuid, 0, HIGHGUID_PLAYER)); + data << ObjectGuid(HIGHGUID_PLAYER, m_playerGuid); switch (m_eventType) { @@ -411,7 +411,7 @@ bool Guild::BankTab::LoadItemFromDB(Field* fields) } Item* pItem = NewItemOrBag(proto); - if (!pItem->LoadFromDB(itemGuid, 0, fields, itemEntry)) + if (!pItem->LoadFromDB(itemGuid, ObjectGuid::Empty, fields, itemEntry)) { TC_LOG_ERROR("guild", "Item (GUID %u, id: %u) not found in item_instance, deleting from guild bank!", itemGuid, itemEntry); @@ -557,8 +557,8 @@ bool Guild::BankTab::SetItem(SQLTransaction& trans, uint8 slotId, Item* item) stmt->setUInt32(3, item->GetGUIDLow()); CharacterDatabase.ExecuteOrAppend(trans, stmt); - item->SetUInt64Value(ITEM_FIELD_CONTAINED, 0); - item->SetUInt64Value(ITEM_FIELD_OWNER, 0); + item->SetGuidValue(ITEM_FIELD_CONTAINED, ObjectGuid::Empty); + item->SetGuidValue(ITEM_FIELD_OWNER, ObjectGuid::Empty); item->FSetState(ITEM_NEW); item->SaveToDB(trans); // Not in inventory and can be saved standalone } @@ -612,7 +612,7 @@ void Guild::Member::SetPublicNote(std::string const& publicNote) PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GUILD_MEMBER_PNOTE); stmt->setString(0, publicNote); - stmt->setUInt32(1, GUID_LOPART(m_guid)); + stmt->setUInt32(1, m_guid.GetCounter()); CharacterDatabase.Execute(stmt); } @@ -625,7 +625,7 @@ void Guild::Member::SetOfficerNote(std::string const& officerNote) PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GUILD_MEMBER_OFFNOTE); stmt->setString(0, officerNote); - stmt->setUInt32(1, GUID_LOPART(m_guid)); + stmt->setUInt32(1, m_guid.GetCounter()); CharacterDatabase.Execute(stmt); } @@ -639,7 +639,7 @@ void Guild::Member::ChangeRank(uint8 newRank) PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GUILD_MEMBER_RANK); stmt->setUInt8 (0, newRank); - stmt->setUInt32(1, GUID_LOPART(m_guid)); + stmt->setUInt32(1, m_guid.GetCounter()); CharacterDatabase.Execute(stmt); } @@ -647,7 +647,7 @@ void Guild::Member::SaveToDB(SQLTransaction& trans) const { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GUILD_MEMBER); stmt->setUInt32(0, m_guildId); - stmt->setUInt32(1, GUID_LOPART(m_guid)); + stmt->setUInt32(1, m_guid.GetCounter()); stmt->setUInt8 (2, m_rankId); stmt->setString(3, m_publicNote); stmt->setString(4, m_officerNote); @@ -677,7 +677,7 @@ bool Guild::Member::LoadFromDB(Field* fields) if (!m_zoneId) { - TC_LOG_DEBUG("guild", "Player (GUID: %u) has broken zone-data", GUID_LOPART(m_guid)); + TC_LOG_DEBUG("guild", "%s has broken zone-data", m_guid.ToString().c_str()); m_zoneId = Player::GetZoneIdFromDB(m_guid); } @@ -690,13 +690,13 @@ bool Guild::Member::CheckStats() const { if (m_level < 1) { - TC_LOG_ERROR("guild", "Player (GUID: %u) has a broken data in field `characters`.`level`, deleting him from guild!", GUID_LOPART(m_guid)); + TC_LOG_ERROR("guild", "%s has a broken data in field `characters`.`level`, deleting him from guild!", m_guid.ToString().c_str()); return false; } if (m_class < CLASS_WARRIOR || m_class >= MAX_CLASSES) { - TC_LOG_ERROR("guild", "Player (GUID: %u) has a broken data in field `characters`.`class`, deleting him from guild!", GUID_LOPART(m_guid)); + TC_LOG_ERROR("guild", "%s has a broken data in field `characters`.`class`, deleting him from guild!", m_guid.ToString().c_str()); return false; } return true; @@ -732,7 +732,7 @@ void Guild::Member::UpdateBankWithdrawValue(SQLTransaction& trans, uint8 tabId, m_bankWithdraw[tabId] += amount; PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GUILD_MEMBER_WITHDRAW); - stmt->setUInt32(0, GUID_LOPART(m_guid)); + stmt->setUInt32(0, m_guid.GetCounter()); for (uint8 i = 0; i <= GUILD_BANK_MAX_TABS;) { uint32 withdraw = m_bankWithdraw[i++]; @@ -1124,7 +1124,7 @@ InventoryResult Guild::BankMoveItemData::CanStore(Item* pItem, bool swap) // Guild Guild::Guild(): m_id(0), - m_leaderGuid(0), + m_leaderGuid(), m_createdDate(0), m_accountsNumber(0), m_bankMoney(0), @@ -1176,7 +1176,7 @@ bool Guild::Create(Player* pLeader, std::string const& name) _CreateLogHolders(); TC_LOG_DEBUG("guild", "GUILD: creating guild [%s] for leader %s (%u)", - name.c_str(), pLeader->GetName().c_str(), GUID_LOPART(m_leaderGuid)); + name.c_str(), pLeader->GetName().c_str(), m_leaderGuid.GetCounter()); SQLTransaction trans = CharacterDatabase.BeginTransaction(); @@ -1188,7 +1188,7 @@ bool Guild::Create(Player* pLeader, std::string const& name) stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GUILD); stmt->setUInt32( index, m_id); stmt->setString(++index, name); - stmt->setUInt32(++index, GUID_LOPART(m_leaderGuid)); + stmt->setUInt32(++index, m_leaderGuid.GetCounter()); stmt->setString(++index, m_info); stmt->setString(++index, m_motd); stmt->setUInt64(++index, uint32(m_createdDate)); @@ -1216,7 +1216,7 @@ void Guild::Disband() // Call scripts before guild data removed from database sScriptMgr->OnGuildDisband(this); - _BroadcastEvent(GE_DISBANDED, 0); + _BroadcastEvent(GE_DISBANDED, ObjectGuid::Empty); // Remove all members while (!m_members.empty()) { @@ -1364,7 +1364,7 @@ void Guild::HandleSetMOTD(WorldSession* session, std::string const& motd) stmt->setUInt32(1, m_id); CharacterDatabase.Execute(stmt); - _BroadcastEvent(GE_MOTD, 0, motd.c_str()); + _BroadcastEvent(GE_MOTD, ObjectGuid::Empty, motd.c_str()); } } @@ -1421,7 +1421,7 @@ void Guild::HandleSetLeader(WorldSession* session, std::string const& name) { _SetLeaderGUID(pNewLeader); pOldLeader->ChangeRank(GR_OFFICER); - _BroadcastEvent(GE_LEADER_CHANGED, 0, player->GetName().c_str(), name.c_str()); + _BroadcastEvent(GE_LEADER_CHANGED, ObjectGuid::Empty, player->GetName().c_str(), name.c_str()); } } } @@ -1440,7 +1440,7 @@ void Guild::HandleSetBankTabInfo(WorldSession* session, uint8 tabId, std::string sprintf(aux, "%u", tabId); tab->SetInfo(name, icon); - _BroadcastEvent(GE_BANK_TAB_UPDATED, 0, aux, name.c_str(), icon.c_str()); + _BroadcastEvent(GE_BANK_TAB_UPDATED, ObjectGuid::Empty, aux, name.c_str(), icon.c_str()); } void Guild::HandleSetMemberNote(WorldSession* session, std::string const& name, std::string const& note, bool isPublic) @@ -1477,7 +1477,7 @@ void Guild::HandleSetRankInfo(WorldSession* session, uint8 rankId, std::string c char aux[2]; sprintf(aux, "%u", rankId); - _BroadcastEvent(GE_RANK_UPDATED, 0, aux, name.c_str()); + _BroadcastEvent(GE_RANK_UPDATED, ObjectGuid::Empty, aux, name.c_str()); } } @@ -1507,7 +1507,7 @@ void Guild::HandleBuyBankTab(WorldSession* session, uint8 tabId) player->ModifyMoney(-int32(tabCost)); _CreateNewBankTab(); - _BroadcastEvent(GE_BANK_TAB_PURCHASED, 0); + _BroadcastEvent(GE_BANK_TAB_PURCHASED, ObjectGuid::Empty); SendPermissions(session); /// Hack to force client to update permissions } @@ -1626,11 +1626,11 @@ void Guild::HandleRemoveMember(WorldSession* session, std::string const& name) SendCommandResult(session, GUILD_COMMAND_REMOVE, ERR_GUILD_RANK_TOO_HIGH_S, name); else { - uint64 guid = member->GetGUID(); + ObjectGuid guid = member->GetGUID(); // After call to DeleteMember pointer to member becomes invalid DeleteMember(guid, false, true); - _LogEvent(GUILD_EVENT_LOG_UNINVITE_PLAYER, player->GetGUIDLow(), GUID_LOPART(guid)); - _BroadcastEvent(GE_REMOVED, 0, name.c_str(), player->GetName().c_str()); + _LogEvent(GUILD_EVENT_LOG_UNINVITE_PLAYER, player->GetGUIDLow(), guid.GetCounter()); + _BroadcastEvent(GE_REMOVED, ObjectGuid::Empty, name.c_str(), player->GetName().c_str()); } } } @@ -1683,8 +1683,8 @@ void Guild::HandleUpdateMemberRank(WorldSession* session, std::string const& nam uint32 newRankId = member->GetRankId() + (demote ? 1 : -1); member->ChangeRank(newRankId); - _LogEvent(demote ? GUILD_EVENT_LOG_DEMOTE_PLAYER : GUILD_EVENT_LOG_PROMOTE_PLAYER, player->GetGUIDLow(), GUID_LOPART(member->GetGUID()), newRankId); - _BroadcastEvent(demote ? GE_DEMOTION : GE_PROMOTION, 0, player->GetName().c_str(), name.c_str(), _GetRankName(newRankId).c_str()); + _LogEvent(demote ? GUILD_EVENT_LOG_DEMOTE_PLAYER : GUILD_EVENT_LOG_PROMOTE_PLAYER, player->GetGUIDLow(), member->GetGUID().GetCounter(), newRankId); + _BroadcastEvent(demote ? GE_DEMOTION : GE_PROMOTION, ObjectGuid::Empty, player->GetName().c_str(), name.c_str(), _GetRankName(newRankId).c_str()); } } @@ -1700,7 +1700,7 @@ void Guild::HandleAddNewRank(WorldSession* session, std::string const& name) { char aux[2]; sprintf(aux, "%u", size); - _BroadcastEvent(GE_RANK_UPDATED, 0, aux, name.c_str()); + _BroadcastEvent(GE_RANK_UPDATED, ObjectGuid::Empty, aux, name.c_str()); } } @@ -1728,7 +1728,7 @@ void Guild::HandleRemoveRank(WorldSession* session, uint8 rankId) m_ranks.pop_back(); - _BroadcastEvent(GE_RANK_DELETED, 0); + _BroadcastEvent(GE_RANK_DELETED, ObjectGuid::Empty); } void Guild::HandleMemberDepositMoney(WorldSession* session, uint32 amount) @@ -1748,7 +1748,7 @@ void Guild::HandleMemberDepositMoney(WorldSession* session, uint32 amount) CharacterDatabase.CommitTransaction(trans); std::string aux = ByteArrayToHexStr(reinterpret_cast<uint8*>(&m_bankMoney), 8, true); - _BroadcastEvent(GE_BANK_MONEY_SET, 0, aux.c_str()); + _BroadcastEvent(GE_BANK_MONEY_SET, ObjectGuid::Empty, aux.c_str()); if (player->GetSession()->HasPermission(rbac::RBAC_PERM_LOG_GM_TRADE)) { @@ -1798,7 +1798,7 @@ bool Guild::HandleMemberWithdrawMoney(WorldSession* session, uint32 amount, bool CharacterDatabase.CommitTransaction(trans); std::string aux = ByteArrayToHexStr(reinterpret_cast<uint8*>(&m_bankMoney), 8, true); - _BroadcastEvent(GE_BANK_MONEY_SET, 0, aux.c_str()); + _BroadcastEvent(GE_BANK_MONEY_SET, ObjectGuid::Empty, aux.c_str()); return true; } @@ -1942,7 +1942,7 @@ bool Guild::LoadFromDB(Field* fields) { m_id = fields[0].GetUInt32(); m_name = fields[1].GetString(); - m_leaderGuid = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER); + m_leaderGuid = ObjectGuid(HIGHGUID_PLAYER, fields[2].GetUInt32()); m_emblemInfo.LoadFromDB(fields); m_info = fields[8].GetString(); m_motd = fields[9].GetString(); @@ -1973,7 +1973,7 @@ void Guild::LoadRankFromDB(Field* fields) bool Guild::LoadMemberFromDB(Field* fields) { uint32 lowguid = fields[1].GetUInt32(); - Member *member = new Member(m_id, MAKE_NEW_GUID(lowguid, 0, HIGHGUID_PLAYER), fields[2].GetUInt8()); + Member *member = new Member(m_id, ObjectGuid(HIGHGUID_PLAYER, lowguid), fields[2].GetUInt8()); if (!member->LoadFromDB(fields)) { _DeleteMemberFromDB(lowguid); @@ -2194,7 +2194,7 @@ void Guild::MassInviteToEvent(WorldSession* session, uint32 minLevel, uint32 max if (member->GetGUID() != session->GetPlayer()->GetGUID() && level >= minLevel && level <= maxLevel && member->IsRankNotLower(minRank)) { - data.appendPackGUID(member->GetGUID()); + data.appendPackGUID(member->GetGUID().GetRawValue()); data << uint8(0); // unk ++count; } @@ -2206,7 +2206,7 @@ void Guild::MassInviteToEvent(WorldSession* session, uint32 minLevel, uint32 max } // Members handling -bool Guild::AddMember(uint64 guid, uint8 rankId) +bool Guild::AddMember(ObjectGuid guid, uint8 rankId) { Player* player = ObjectAccessor::FindPlayer(guid); // Player cannot be in guild @@ -2222,7 +2222,7 @@ bool Guild::AddMember(uint64 guid, uint8 rankId) // This will be prevent attempt to join many guilds and corrupt guild data integrity Player::RemovePetitionsAndSigns(guid, GUILD_CHARTER_TYPE); - uint32 lowguid = GUID_LOPART(guid); + uint32 lowguid = guid.GetCounter(); // If rank was not passed, assign lowest possible rank if (rankId == GUILD_RANK_NONE) @@ -2282,9 +2282,9 @@ bool Guild::AddMember(uint64 guid, uint8 rankId) return true; } -void Guild::DeleteMember(uint64 guid, bool isDisbanding, bool isKicked, bool canDeleteGuild) +void Guild::DeleteMember(ObjectGuid guid, bool isDisbanding, bool isKicked, bool canDeleteGuild) { - uint32 lowguid = GUID_LOPART(guid); + uint32 lowguid = guid.GetCounter(); Player* player = ObjectAccessor::FindPlayer(guid); // Guild master can be deleted when loading guild and guid doesn't exist in characters table @@ -2318,7 +2318,7 @@ void Guild::DeleteMember(uint64 guid, bool isDisbanding, bool isKicked, bool can // If leader does not exist (at guild loading with deleted leader) do not send broadcasts if (oldLeader) { - _BroadcastEvent(GE_LEADER_CHANGED, 0, oldLeader->GetName().c_str(), newLeader->GetName().c_str()); + _BroadcastEvent(GE_LEADER_CHANGED, ObjectGuid::Empty, oldLeader->GetName().c_str(), newLeader->GetName().c_str()); _BroadcastEvent(GE_LEFT, guid, oldLeader->GetName().c_str()); } } @@ -2341,7 +2341,7 @@ void Guild::DeleteMember(uint64 guid, bool isDisbanding, bool isKicked, bool can _UpdateAccountsNumber(); } -bool Guild::ChangeMemberRank(uint64 guid, uint8 newRank) +bool Guild::ChangeMemberRank(ObjectGuid guid, uint8 newRank) { if (newRank <= _GetLowestRankId()) // Validate rank (allow only existing ranks) if (Member* member = GetMember(guid)) @@ -2520,7 +2520,7 @@ void Guild::_SetLeaderGUID(Member* pLeader) pLeader->ChangeRank(GR_GUILDMASTER); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GUILD_LEADER); - stmt->setUInt32(0, GUID_LOPART(m_leaderGuid)); + stmt->setUInt32(0, m_leaderGuid.GetCounter()); stmt->setUInt32(1, m_id); CharacterDatabase.Execute(stmt); } @@ -2611,7 +2611,7 @@ inline int32 Guild::_GetMemberRemainingMoney(Member const* member) const return 0; } -inline void Guild::_UpdateMemberWithdrawSlots(SQLTransaction& trans, uint64 guid, uint8 tabId) +inline void Guild::_UpdateMemberWithdrawSlots(SQLTransaction& trans, ObjectGuid guid, uint8 tabId) { if (Member* member = GetMember(guid)) { @@ -2622,7 +2622,7 @@ inline void Guild::_UpdateMemberWithdrawSlots(SQLTransaction& trans, uint64 guid } } -inline bool Guild::_MemberHasTabRights(uint64 guid, uint8 tabId, uint32 rights) const +inline bool Guild::_MemberHasTabRights(ObjectGuid guid, uint8 tabId, uint32 rights) const { if (const Member* member = GetMember(guid)) { @@ -2786,7 +2786,7 @@ bool Guild::_DoItemsMove(MoveItemData* pSrc, MoveItemData* pDest, bool sendError void Guild::_SendBankContent(WorldSession* session, uint8 tabId) const { - uint64 guid = session->GetPlayer()->GetGUID(); + ObjectGuid guid = session->GetPlayer()->GetGUID(); if (!_MemberHasTabRights(guid, tabId, GUILD_BANK_RIGHT_VIEW_TAB)) return; @@ -2835,7 +2835,7 @@ void Guild::_SendBankContentUpdate(uint8 tabId, SlotIds slots) const _SendBankList(NULL, tabId, false, &slots); } -void Guild::_BroadcastEvent(GuildEvents guildEvent, uint64 guid, const char* param1, const char* param2, const char* param3) const +void Guild::_BroadcastEvent(GuildEvents guildEvent, ObjectGuid guid, const char* param1, const char* param2, const char* param3) const { uint8 count = !param3 ? (!param2 ? (!param1 ? 0 : 1) : 2) : 3; @@ -2923,5 +2923,5 @@ void Guild::ResetTimes() for (Members::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr) itr->second->ResetValues(); - _BroadcastEvent(GE_BANK_TAB_AND_MONEY_UPDATED, 0); + _BroadcastEvent(GE_BANK_TAB_AND_MONEY_UPDATED, ObjectGuid::Empty); } diff --git a/src/server/game/Guilds/Guild.h b/src/server/game/Guilds/Guild.h index 375d39cf232..f0daa257ae6 100644 --- a/src/server/game/Guilds/Guild.h +++ b/src/server/game/Guilds/Guild.h @@ -286,7 +286,7 @@ private: class Member { public: - Member(uint32 guildId, uint64 guid, uint8 rankId): + Member(uint32 guildId, ObjectGuid guid, uint8 rankId) : m_guildId(guildId), m_guid(guid), m_zoneId(0), @@ -317,7 +317,7 @@ private: void SaveToDB(SQLTransaction& trans) const; void WritePacket(WorldPacket& data, bool sendOfficerNote) const; - uint64 GetGUID() const { return m_guid; } + ObjectGuid GetGUID() const { return m_guid; } std::string const& GetName() const { return m_name; } uint32 GetAccountId() const { return m_accountId; } uint8 GetRankId() const { return m_rankId; } @@ -335,7 +335,7 @@ private: inline void UpdateLogoutTime() { m_logoutTime = ::time(NULL); } inline bool IsRank(uint8 rankId) const { return m_rankId == rankId; } inline bool IsRankNotLower(uint8 rankId) const { return m_rankId <= rankId; } - inline bool IsSamePlayer(uint64 guid) const { return m_guid == guid; } + inline bool IsSamePlayer(ObjectGuid guid) const { return m_guid == guid; } void UpdateBankWithdrawValue(SQLTransaction& trans, uint8 tabId, uint32 amount); int32 GetBankWithdrawValue(uint8 tabId) const; @@ -346,7 +346,7 @@ private: private: uint32 m_guildId; // Fields from characters table - uint64 m_guid; + ObjectGuid m_guid; std::string m_name; uint32 m_zoneId; uint8 m_level; @@ -653,7 +653,7 @@ public: // Getters uint32 GetId() const { return m_id; } - uint64 GetLeaderGUID() const { return m_leaderGuid; } + ObjectGuid GetLeaderGUID() const { return m_leaderGuid; } std::string const& GetName() const { return m_name; } std::string const& GetMOTD() const { return m_motd; } std::string const& GetInfo() const { return m_info; } @@ -730,9 +730,9 @@ public: // Members // Adds member to guild. If rankId == GUILD_RANK_NONE, lowest rank is assigned. - bool AddMember(uint64 guid, uint8 rankId = GUILD_RANK_NONE); - void DeleteMember(uint64 guid, bool isDisbanding = false, bool isKicked = false, bool canDeleteGuild = false); - bool ChangeMemberRank(uint64 guid, uint8 newRank); + bool AddMember(ObjectGuid guid, uint8 rankId = GUILD_RANK_NONE); + void DeleteMember(ObjectGuid guid, bool isDisbanding = false, bool isKicked = false, bool canDeleteGuild = false); + bool ChangeMemberRank(ObjectGuid guid, uint8 newRank); // Bank void SwapItems(Player* player, uint8 tabId, uint8 slotId, uint8 destTabId, uint8 destSlotId, uint32 splitedAmount); @@ -746,7 +746,7 @@ public: protected: uint32 m_id; std::string m_name; - uint64 m_leaderGuid; + ObjectGuid m_leaderGuid; std::string m_motd; std::string m_info; time_t m_createdDate; @@ -781,15 +781,15 @@ private: inline BankTab* GetBankTab(uint8 tabId) { return tabId < m_bankTabs.size() ? m_bankTabs[tabId] : NULL; } inline const BankTab* GetBankTab(uint8 tabId) const { return tabId < m_bankTabs.size() ? m_bankTabs[tabId] : NULL; } - inline const Member* GetMember(uint64 guid) const + inline const Member* GetMember(ObjectGuid guid) const { - Members::const_iterator itr = m_members.find(GUID_LOPART(guid)); + Members::const_iterator itr = m_members.find(guid.GetCounter()); return itr != m_members.end() ? itr->second : NULL; } - inline Member* GetMember(uint64 guid) + inline Member* GetMember(ObjectGuid guid) { - Members::iterator itr = m_members.find(GUID_LOPART(guid)); + Members::iterator itr = m_members.find(guid.GetCounter()); return itr != m_members.end() ? itr->second : NULL; } @@ -834,8 +834,8 @@ private: int32 _GetMemberRemainingSlots(Member const* member, uint8 tabId) const; int32 _GetMemberRemainingMoney(Member const* member) const; - void _UpdateMemberWithdrawSlots(SQLTransaction& trans, uint64 guid, uint8 tabId); - bool _MemberHasTabRights(uint64 guid, uint8 tabId, uint32 rights) const; + void _UpdateMemberWithdrawSlots(SQLTransaction& trans, ObjectGuid guid, uint8 tabId); + bool _MemberHasTabRights(ObjectGuid guid, uint8 tabId, uint32 rights) const; void _LogEvent(GuildEventLogTypes eventType, uint32 playerGuid1, uint32 playerGuid2 = 0, uint8 newRank = 0); void _LogBankEvent(SQLTransaction& trans, GuildBankEventLogTypes eventType, uint8 tabId, uint32 playerGuid, uint32 itemOrMoney, uint16 itemStackCount = 0, uint8 destTabId = 0); @@ -851,6 +851,6 @@ private: void _SendBankContentUpdate(uint8 tabId, SlotIds slots) const; void _SendBankList(WorldSession* session = NULL, uint8 tabId = 0, bool sendFullSlots = false, SlotIds *slots = NULL) const; - void _BroadcastEvent(GuildEvents guildEvent, uint64 guid, const char* param1 = NULL, const char* param2 = NULL, const char* param3 = NULL) const; + void _BroadcastEvent(GuildEvents guildEvent, ObjectGuid guid, const char* param1 = NULL, const char* param2 = NULL, const char* param3 = NULL) const; }; #endif diff --git a/src/server/game/Guilds/GuildMgr.cpp b/src/server/game/Guilds/GuildMgr.cpp index b9cb7d6dce9..3cce112e0ee 100644 --- a/src/server/game/Guilds/GuildMgr.cpp +++ b/src/server/game/Guilds/GuildMgr.cpp @@ -79,7 +79,7 @@ std::string GuildMgr::GetGuildNameById(uint32 guildId) const return ""; } -Guild* GuildMgr::GetGuildByLeader(uint64 guid) const +Guild* GuildMgr::GetGuildByLeader(ObjectGuid guid) const { for (GuildContainer::const_iterator itr = GuildStore.begin(); itr != GuildStore.end(); ++itr) if (itr->second->GetLeaderGUID() == guid) diff --git a/src/server/game/Guilds/GuildMgr.h b/src/server/game/Guilds/GuildMgr.h index 4aa418b7e73..2200cbf9944 100644 --- a/src/server/game/Guilds/GuildMgr.h +++ b/src/server/game/Guilds/GuildMgr.h @@ -33,7 +33,7 @@ public: return &instance; } - Guild* GetGuildByLeader(uint64 guid) const; + Guild* GetGuildByLeader(ObjectGuid guid) const; Guild* GetGuildById(uint32 guildId) const; Guild* GetGuildByName(std::string const& guildName) const; std::string GetGuildNameById(uint32 guildId) const; diff --git a/src/server/game/Handlers/ArenaTeamHandler.cpp b/src/server/game/Handlers/ArenaTeamHandler.cpp index 87febd8f1e7..b77a3fd41cc 100644 --- a/src/server/game/Handlers/ArenaTeamHandler.cpp +++ b/src/server/game/Handlers/ArenaTeamHandler.cpp @@ -33,9 +33,9 @@ void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket& recvData) { TC_LOG_DEBUG("network", "MSG_INSPECT_ARENA_TEAMS"); - uint64 guid; + ObjectGuid guid; recvData >> guid; - TC_LOG_DEBUG("network", "Inspect Arena stats (GUID: %u TypeId: %u)", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid))); + TC_LOG_DEBUG("network", "Inspect Arena stats %s", guid.ToString().c_str()); Player* player = ObjectAccessor::FindPlayer(guid); @@ -319,7 +319,7 @@ void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket& recvData) arenaTeam->DelMember(member->Guid, true); // Broadcast event - arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_REMOVE_SSS, 0, 3, name, arenaTeam->GetName(), _player->GetName()); + arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_REMOVE_SSS, ObjectGuid::Empty, 3, name, arenaTeam->GetName(), _player->GetName()); } void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket& recvData) @@ -362,7 +362,7 @@ void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket& recvData) arenaTeam->SetCaptain(member->Guid); // Broadcast event - arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_LEADER_CHANGED_SSS, 0, 3, _player->GetName(), name, arenaTeam->GetName()); + arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_LEADER_CHANGED_SSS, ObjectGuid::Empty, 3, _player->GetName(), name, arenaTeam->GetName()); } void WorldSession::SendArenaTeamCommandResult(uint32 teamAction, const std::string& team, const std::string& player, uint32 errorId) diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp index 86fa0429cce..d1d7b35cb43 100644 --- a/src/server/game/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Handlers/AuctionHouseHandler.cpp @@ -33,13 +33,13 @@ //void called when player click on auctioneer npc void WorldSession::HandleAuctionHelloOpcode(WorldPacket& recvData) { - uint64 guid; //NPC guid + ObjectGuid guid; //NPC guid recvData >> guid; Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER); if (!unit) { - TC_LOG_DEBUG("network", "WORLD: HandleAuctionHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleAuctionHelloOpcode - Unit (GUID: %s) not found or you can't interact with him.", guid.ToString().c_str()); return; } @@ -51,7 +51,7 @@ void WorldSession::HandleAuctionHelloOpcode(WorldPacket& recvData) } //this void causes that auction window is opened -void WorldSession::SendAuctionHello(uint64 guid, Creature* unit) +void WorldSession::SendAuctionHello(ObjectGuid guid, Creature* unit) { if (GetPlayer()->getLevel() < sWorld->getIntConfig(CONFIG_AUCTION_LEVEL_REQ)) { @@ -83,7 +83,7 @@ void WorldSession::SendAuctionCommandResult(uint32 auctionId, uint32 Action, uin } //this function sends notification, if bidder is online -void WorldSession::SendAuctionBidderNotification(uint32 location, uint32 auctionId, uint64 bidder, uint32 bidSum, uint32 diff, uint32 itemEntry) +void WorldSession::SendAuctionBidderNotification(uint32 location, uint32 auctionId, ObjectGuid bidder, uint32 bidSum, uint32 diff, uint32 itemEntry) { WorldPacket data(SMSG_AUCTION_BIDDER_NOTIFICATION, (8*4)); data << uint32(location); @@ -113,13 +113,12 @@ void WorldSession::SendAuctionOwnerNotification(AuctionEntry* auction) //this void creates new auction and adds auction to some auctionhouse void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) { - uint64 auctioneer; + ObjectGuid auctioneer; uint32 itemsCount, etime, bid, buyout; recvData >> auctioneer; recvData >> itemsCount; - uint64 itemGUIDs[MAX_AUCTION_ITEMS]; // 160 slot = 4x 36 slot bag + backpack 16 slot - memset(itemGUIDs, 0, sizeof(itemGUIDs)); + ObjectGuid itemGUIDs[MAX_AUCTION_ITEMS]; // 160 slot = 4x 36 slot bag + backpack 16 slot uint32 count[MAX_AUCTION_ITEMS]; memset(count, 0, sizeof(count)); @@ -160,14 +159,14 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER); if (!creature) { - TC_LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(auctioneer)); + TC_LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Unit (%s) not found or you can't interact with him.", auctioneer.ToString().c_str()); return; } AuctionHouseEntry const* auctionHouseEntry = AuctionHouseMgr::GetAuctionHouseEntry(creature->getFaction()); if (!auctionHouseEntry) { - TC_LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Unit (GUID: %u) has wrong faction.", GUID_LOPART(auctioneer)); + TC_LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Unit (%s) has wrong faction.", auctioneer.ToString().c_str()); return; } @@ -263,7 +262,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) AH->auctioneer = 23442; ///@TODO - HARDCODED DB GUID, BAD BAD BAD else - AH->auctioneer = GUID_LOPART(auctioneer); + AH->auctioneer = auctioneer.GetCounter(); // Required stack size of auction matches to current item stack size, just move item to auctionhouse if (itemsCount == 1 && item->GetCount() == count[0]) @@ -287,7 +286,8 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) AH->deposit = deposit; AH->auctionHouseEntry = auctionHouseEntry; - TC_LOG_INFO("network", "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", _player->GetName().c_str(), _player->GetGUIDLow(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetGUIDLow(), AH->auctioneer, item->GetCount(), bid, buyout, auctionTime, AH->GetHouseId()); + TC_LOG_INFO("network", "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", + _player->GetName().c_str(), _player->GetGUIDLow(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetGUIDLow(), AH->auctioneer, item->GetCount(), bid, buyout, auctionTime, AH->GetHouseId()); sAuctionMgr->AddAItem(item); auctionHouse->AddAuction(AH); @@ -334,7 +334,8 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) AH->deposit = deposit; AH->auctionHouseEntry = auctionHouseEntry; - TC_LOG_INFO("network", "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", _player->GetName().c_str(), _player->GetGUIDLow(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetGUIDLow(), AH->auctioneer, newItem->GetCount(), bid, buyout, auctionTime, AH->GetHouseId()); + TC_LOG_INFO("network", "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", + _player->GetName().c_str(), _player->GetGUIDLow(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetGUIDLow(), AH->auctioneer, newItem->GetCount(), bid, buyout, auctionTime, AH->GetHouseId()); sAuctionMgr->AddAItem(newItem); auctionHouse->AddAuction(AH); @@ -385,7 +386,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_PLACE_BID"); - uint64 auctioneer; + ObjectGuid auctioneer; uint32 auctionId; uint32 price; recvData >> auctioneer; @@ -397,7 +398,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData) Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER); if (!creature) { - TC_LOG_DEBUG("network", "WORLD: HandleAuctionPlaceBid - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer))); + TC_LOG_DEBUG("network", "WORLD: HandleAuctionPlaceBid - %s not found or you can't interact with him.", auctioneer.ToString().c_str()); return; } @@ -418,8 +419,9 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData) } // impossible have online own another character (use this for speedup check in case online owner) - Player* auction_owner = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER)); - if (!auction_owner && sObjectMgr->GetPlayerAccountIdByGUID(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER)) == player->GetSession()->GetAccountId()) + ObjectGuid ownerGuid(HIGHGUID_PLAYER, auction->owner); + Player* auction_owner = ObjectAccessor::FindPlayer(ownerGuid); + if (!auction_owner && sObjectMgr->GetPlayerAccountIdByGUID(ownerGuid) == player->GetSession()->GetAccountId()) { //you cannot bid your another character auction: SendAuctionCommandResult(0, AUCTION_PLACE_BID, ERR_AUCTION_BID_OWN); @@ -512,7 +514,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_REMOVE_ITEM"); - uint64 auctioneer; + ObjectGuid auctioneer; uint32 auctionId; recvData >> auctioneer; recvData >> auctionId; @@ -521,7 +523,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData) Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER); if (!creature) { - TC_LOG_DEBUG("network", "WORLD: HandleAuctionRemoveItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer))); + TC_LOG_DEBUG("network", "WORLD: HandleAuctionRemoveItem - %s not found or you can't interact with him.", auctioneer.ToString().c_str()); return; } @@ -589,7 +591,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_LIST_BIDDER_ITEMS"); - uint64 guid; //NPC guid + ObjectGuid guid; //NPC guid uint32 listfrom; //page of auctions uint32 outbiddedCount; //count of outbidded auctions @@ -605,7 +607,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket& recvData) Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER); if (!creature) { - TC_LOG_DEBUG("network", "WORLD: HandleAuctionListBidderItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleAuctionListBidderItems - %s not found or you can't interact with him.", guid.ToString().c_str()); recvData.rfinish(); return; } @@ -647,7 +649,7 @@ void WorldSession::HandleAuctionListOwnerItems(WorldPacket& recvData) TC_LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_LIST_OWNER_ITEMS"); uint32 listfrom; - uint64 guid; + ObjectGuid guid; recvData >> guid; recvData >> listfrom; // not used in fact (this list not have page control in client) @@ -655,7 +657,7 @@ void WorldSession::HandleAuctionListOwnerItems(WorldPacket& recvData) Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER); if (!creature) { - TC_LOG_DEBUG("network", "WORLD: HandleAuctionListOwnerItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleAuctionListOwnerItems - %s not found or you can't interact with him.", guid.ToString().c_str()); return; } @@ -686,7 +688,7 @@ void WorldSession::HandleAuctionListItems(WorldPacket& recvData) std::string searchedname; uint8 levelmin, levelmax, usable; uint32 listfrom, auctionSlotID, auctionMainCategory, auctionSubCategory, quality; - uint64 guid; + ObjectGuid guid; recvData >> guid; recvData >> listfrom; // start, used for page control listing by 50 elements @@ -710,7 +712,7 @@ void WorldSession::HandleAuctionListItems(WorldPacket& recvData) Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER); if (!creature) { - TC_LOG_DEBUG("network", "WORLD: HandleAuctionListItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleAuctionListItems - %s not found or you can't interact with him.", guid.ToString().c_str()); return; } diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp index 95e4dd3b5e0..ccea6f64a8d 100644 --- a/src/server/game/Handlers/BattleGroundHandler.cpp +++ b/src/server/game/Handlers/BattleGroundHandler.cpp @@ -37,9 +37,9 @@ void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; recvData >> guid; - TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_BATTLEMASTER_HELLO Message from (GUID: %u TypeId:%u)", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid))); + TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_BATTLEMASTER_HELLO Message from %s", guid.ToString().c_str()); Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); if (!unit) @@ -63,7 +63,7 @@ void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket& recvData) SendBattleGroundList(guid, bgTypeId); } -void WorldSession::SendBattleGroundList(uint64 guid, BattlegroundTypeId bgTypeId) +void WorldSession::SendBattleGroundList(ObjectGuid guid, BattlegroundTypeId bgTypeId) { WorldPacket data; sBattlegroundMgr->BuildBattlegroundListPacket(&data, guid, _player, bgTypeId, 0); @@ -72,7 +72,7 @@ void WorldSession::SendBattleGroundList(uint64 guid, BattlegroundTypeId bgTypeId void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; uint32 bgTypeId_; uint32 instanceId; uint8 joinAsGroup; @@ -98,7 +98,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recvData) BattlegroundTypeId bgTypeId = BattlegroundTypeId(bgTypeId_); - TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_BATTLEMASTER_JOIN Message from (GUID: %u TypeId:%u)", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid))); + TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_BATTLEMASTER_JOIN Message from %s", guid.ToString().c_str()); // can do this, since it's battleground, not arena BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(bgTypeId, 0); @@ -257,14 +257,14 @@ void WorldSession::HandleBattlegroundPlayerPositionsOpcode(WorldPacket& /*recvDa Player* allianceFlagCarrier = NULL; Player* hordeFlagCarrier = NULL; - if (uint64 guid = bg->GetFlagPickerGUID(TEAM_ALLIANCE)) + if (ObjectGuid guid = bg->GetFlagPickerGUID(TEAM_ALLIANCE)) { allianceFlagCarrier = ObjectAccessor::FindPlayer(guid); if (allianceFlagCarrier) ++flagCarrierCount; } - if (uint64 guid = bg->GetFlagPickerGUID(TEAM_HORDE)) + if (ObjectGuid guid = bg->GetFlagPickerGUID(TEAM_HORDE)) { hordeFlagCarrier = ObjectAccessor::FindPlayer(guid); if (hordeFlagCarrier) @@ -336,7 +336,7 @@ void WorldSession::HandleBattlefieldListOpcode(WorldPacket &recvData) } WorldPacket data; - sBattlegroundMgr->BuildBattlegroundListPacket(&data, 0, _player, BattlegroundTypeId(bgTypeId), fromWhere); + sBattlegroundMgr->BuildBattlegroundListPacket(&data, ObjectGuid::Empty, _player, BattlegroundTypeId(bgTypeId), fromWhere); SendPacket(&data); } @@ -485,7 +485,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recvData) ArenaTeam* at = sArenaTeamMgr->GetArenaTeamById(ginfo.Team); if (at) { - TC_LOG_DEBUG("bg.battleground", "UPDATING memberLost's personal arena rating for %u by opponents rating: %u, because he has left queue!", GUID_LOPART(_player->GetGUID()), ginfo.OpponentsTeamRating); + TC_LOG_DEBUG("bg.battleground", "UPDATING memberLost's personal arena rating for %s by opponents rating: %u, because he has left queue!", _player->GetGUID().ToString().c_str(), ginfo.OpponentsTeamRating); at->MemberLost(_player, ginfo.OpponentsMatchmakerRating); at->SaveToDB(); } @@ -587,7 +587,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: CMSG_BATTLEMASTER_JOIN_ARENA"); - uint64 guid; // arena Battlemaster guid + ObjectGuid guid; // arena Battlemaster guid uint8 arenaslot; // 2v2, 3v3 or 5v5 uint8 asGroup; // asGroup uint8 isRated; // isRated @@ -753,7 +753,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recvData) void WorldSession::HandleReportPvPAFK(WorldPacket& recvData) { - uint64 playerGuid; + ObjectGuid playerGuid; recvData >> playerGuid; Player* reportedPlayer = ObjectAccessor::FindPlayer(playerGuid); diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp index dd654fb3ad0..6d0caf9c072 100644 --- a/src/server/game/Handlers/CalendarHandler.cpp +++ b/src/server/game/Handlers/CalendarHandler.cpp @@ -50,8 +50,8 @@ Copied events should probably have a new owner void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/) { - uint64 guid = _player->GetGUID(); - TC_LOG_DEBUG("network", "CMSG_CALENDAR_GET_CALENDAR [" UI64FMTD "]", guid); + ObjectGuid guid = _player->GetGUID(); + TC_LOG_DEBUG("network", "CMSG_CALENDAR_GET_CALENDAR [%s]", guid.ToString().c_str()); time_t currTime = time(NULL); @@ -69,12 +69,12 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/) if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent((*itr)->GetEventId())) { data << uint8(calendarEvent->IsGuildEvent()); - data.appendPackGUID(calendarEvent->GetCreatorGUID()); + data << calendarEvent->GetCreatorGUID().WriteAsPacked(); } else { data << uint8(0); - data.appendPackGUID((*itr)->GetSenderGUID()); + data << (*itr)->GetSenderGUID().WriteAsPacked(); } } @@ -90,7 +90,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/) data.AppendPackedTime(calendarEvent->GetEventTime()); data << uint32(calendarEvent->GetFlags()); data << int32(calendarEvent->GetDungeonId()); - data.appendPackGUID(calendarEvent->GetCreatorGUID()); + data << calendarEvent->GetCreatorGUID().WriteAsPacked(); } data << uint32(currTime); // server time @@ -180,8 +180,7 @@ void WorldSession::HandleCalendarGetEvent(WorldPacket& recvData) uint64 eventId; recvData >> eventId; - TC_LOG_DEBUG("network", "CMSG_CALENDAR_GET_EVENT. Player [" - UI64FMTD "] Event [" UI64FMTD "]", _player->GetGUID(), eventId); + TC_LOG_DEBUG("network", "CMSG_CALENDAR_GET_EVENT. Player [%s] Event [" UI64FMTD "]", _player->GetGUID().ToString().c_str(), eventId); if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId)) sCalendarMgr->SendCalendarEvent(_player->GetGUID(), *calendarEvent, CALENDAR_SENDTYPE_GET); @@ -191,7 +190,7 @@ void WorldSession::HandleCalendarGetEvent(WorldPacket& recvData) void WorldSession::HandleCalendarGuildFilter(WorldPacket& recvData) { - TC_LOG_DEBUG("network", "CMSG_CALENDAR_GUILD_FILTER [" UI64FMTD "]", _player->GetGUID()); + TC_LOG_DEBUG("network", "CMSG_CALENDAR_GUILD_FILTER [%s]", _player->GetGUID().ToString().c_str()); uint32 minLevel; uint32 maxLevel; @@ -207,7 +206,7 @@ void WorldSession::HandleCalendarGuildFilter(WorldPacket& recvData) void WorldSession::HandleCalendarArenaTeam(WorldPacket& recvData) { - TC_LOG_DEBUG("network", "CMSG_CALENDAR_ARENA_TEAM [" UI64FMTD "]", _player->GetGUID()); + TC_LOG_DEBUG("network", "CMSG_CALENDAR_ARENA_TEAM [%s]", _player->GetGUID().ToString().c_str()); uint32 arenaTeamId; recvData >> arenaTeamId; @@ -218,7 +217,7 @@ void WorldSession::HandleCalendarArenaTeam(WorldPacket& recvData) void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData) { - uint64 guid = _player->GetGUID(); + ObjectGuid guid = _player->GetGUID(); std::string title; std::string description; @@ -253,7 +252,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData) if (calendarEvent->IsGuildAnnouncement()) { // 946684800 is 01/01/2000 00:00:00 - default response time - CalendarInvite invite(0, calendarEvent->GetEventId(), 0, guid, 946684800, CALENDAR_STATUS_NOT_SIGNED_UP, CALENDAR_RANK_PLAYER, ""); + CalendarInvite invite(0, calendarEvent->GetEventId(), ObjectGuid::Empty, guid, 946684800, CALENDAR_STATUS_NOT_SIGNED_UP, CALENDAR_RANK_PLAYER, ""); // WARNING: By passing pointer to a local variable, the underlying method(s) must NOT perform any kind // of storage of the pointer as it will lead to memory corruption sCalendarMgr->AddInvite(calendarEvent, &invite); @@ -264,11 +263,10 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData) const uint32 MaxPlayerInvites = 100; uint32 inviteCount; - uint64 invitee[MaxPlayerInvites]; + ObjectGuid invitee[MaxPlayerInvites]; uint8 status[MaxPlayerInvites]; uint8 rank[MaxPlayerInvites]; - memset(invitee, 0, sizeof(invitee)); memset(status, 0, sizeof(status)); memset(rank, 0, sizeof(rank)); @@ -278,7 +276,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData) for (uint32 i = 0; i < inviteCount && i < MaxPlayerInvites; ++i) { - recvData.readPackGUID(invitee[i]); + recvData >> invitee[i].ReadAsPacked(); recvData >> status[i] >> rank[i]; } } @@ -309,7 +307,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData) void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData) { - uint64 guid = _player->GetGUID(); + ObjectGuid guid = _player->GetGUID(); time_t oldEventTime; uint64 eventId; @@ -337,10 +335,10 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData) return; } - TC_LOG_DEBUG("network", "CMSG_CALENDAR_UPDATE_EVENT [" UI64FMTD "] EventId [" UI64FMTD + TC_LOG_DEBUG("network", "CMSG_CALENDAR_UPDATE_EVENT [%s] EventId [" UI64FMTD "], InviteId [" UI64FMTD "] Title %s, Description %s, type %u " "Repeatable %u, MaxInvites %u, Dungeon ID %d, Time %u " - "Time2 %u, Flags %u", guid, eventId, inviteId, title.c_str(), + "Time2 %u, Flags %u", guid.ToString().c_str(), eventId, inviteId, title.c_str(), description.c_str(), type, repetitionType, maxInvites, dungeonId, eventPackedTime, timeZoneTime, flags); @@ -365,7 +363,7 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData) void WorldSession::HandleCalendarRemoveEvent(WorldPacket& recvData) { - uint64 guid = _player->GetGUID(); + ObjectGuid guid = _player->GetGUID(); uint64 eventId; recvData >> eventId; @@ -376,15 +374,15 @@ void WorldSession::HandleCalendarRemoveEvent(WorldPacket& recvData) void WorldSession::HandleCalendarCopyEvent(WorldPacket& recvData) { - uint64 guid = _player->GetGUID(); + ObjectGuid guid = _player->GetGUID(); uint64 eventId; uint64 inviteId; uint32 eventTime; recvData >> eventId >> inviteId; recvData.ReadPackedTime(eventTime); - TC_LOG_DEBUG("network", "CMSG_CALENDAR_COPY_EVENT [" UI64FMTD "], EventId [" UI64FMTD - "] inviteId [" UI64FMTD "] Time: %u", guid, eventId, inviteId, eventTime); + TC_LOG_DEBUG("network", "CMSG_CALENDAR_COPY_EVENT [%s], EventId [" UI64FMTD + "] inviteId [" UI64FMTD "] Time: %u", guid.ToString().c_str(), eventId, inviteId, eventTime); // prevent events in the past // To Do: properly handle timezones and remove the "- time_t(86400L)" hack @@ -420,7 +418,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData) { TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_INVITE"); - uint64 playerGuid = _player->GetGUID(); + ObjectGuid playerGuid = _player->GetGUID(); uint64 eventId; uint64 inviteId; @@ -428,7 +426,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData) bool isPreInvite; bool isGuildEvent; - uint64 inviteeGuid = 0; + ObjectGuid inviteeGuid; uint32 inviteeTeam = 0; uint32 inviteeGuildId = 0; @@ -449,7 +447,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData) if (PreparedQueryResult result = CharacterDatabase.Query(stmt)) { Field* fields = result->Fetch(); - inviteeGuid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER); + inviteeGuid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32()); inviteeTeam = Player::TeamForRace(fields[1].GetUInt8()); inviteeGuildId = Player::GetGuildIdFromDB(inviteeGuid); } @@ -467,7 +465,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData) return; } - if (QueryResult result = CharacterDatabase.PQuery("SELECT flags FROM character_social WHERE guid = " UI64FMTD " AND friend = " UI64FMTD, inviteeGuid, playerGuid)) + if (QueryResult result = CharacterDatabase.PQuery("SELECT flags FROM character_social WHERE guid = %u AND friend = %u", inviteeGuid.GetCounter(), playerGuid.GetCounter())) { Field* fields = result->Fetch(); if (fields[0].GetUInt8() & SOCIAL_FLAG_IGNORED) @@ -511,12 +509,12 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData) void WorldSession::HandleCalendarEventSignup(WorldPacket& recvData) { - uint64 guid = _player->GetGUID(); + ObjectGuid guid = _player->GetGUID(); uint64 eventId; bool tentative; recvData >> eventId >> tentative; - TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_SIGNUP [" UI64FMTD "] EventId [" UI64FMTD "] Tentative %u", guid, eventId, tentative); + TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_SIGNUP [%s] EventId [" UI64FMTD "] Tentative %u", guid.ToString().c_str(), eventId, tentative); if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId)) { @@ -537,14 +535,14 @@ void WorldSession::HandleCalendarEventSignup(WorldPacket& recvData) void WorldSession::HandleCalendarEventRsvp(WorldPacket& recvData) { - uint64 guid = _player->GetGUID(); + ObjectGuid guid = _player->GetGUID(); uint64 eventId; uint64 inviteId; uint32 status; recvData >> eventId >> inviteId >> status; - TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_RSVP [" UI64FMTD "] EventId [" - UI64FMTD "], InviteId [" UI64FMTD "], status %u", guid, eventId, + TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_RSVP [%s] EventId [" + UI64FMTD "], InviteId [" UI64FMTD "], status %u", guid.ToString().c_str(), eventId, inviteId, status); if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId)) @@ -574,19 +572,18 @@ void WorldSession::HandleCalendarEventRsvp(WorldPacket& recvData) void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket& recvData) { - uint64 guid = _player->GetGUID(); - uint64 invitee; + ObjectGuid guid = _player->GetGUID(); + ObjectGuid invitee; uint64 eventId; uint64 ownerInviteId; // isn't it sender's inviteId? uint64 inviteId; - recvData.readPackGUID(invitee); + recvData >> invitee.ReadAsPacked(); recvData >> inviteId >> ownerInviteId >> eventId; - TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_REMOVE_INVITE [" - UI64FMTD "] EventId [" UI64FMTD "], ownerInviteId [" - UI64FMTD "], Invitee ([" UI64FMTD "] id: [" UI64FMTD "])", - guid, eventId, ownerInviteId, invitee, inviteId); + TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_REMOVE_INVITE [%s] EventId [" UI64FMTD + "], ownerInviteId [" UI64FMTD "], Invitee ([%s] id: [" UI64FMTD "])", + guid.ToString().c_str(), eventId, ownerInviteId, invitee.ToString().c_str(), inviteId); if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId)) { @@ -604,18 +601,18 @@ void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket& recvData) void WorldSession::HandleCalendarEventStatus(WorldPacket& recvData) { - uint64 guid = _player->GetGUID(); - uint64 invitee; + ObjectGuid guid = _player->GetGUID(); + ObjectGuid invitee; uint64 eventId; uint64 inviteId; uint64 ownerInviteId; // isn't it sender's inviteId? uint8 status; - recvData.readPackGUID(invitee); + recvData >> invitee.ReadAsPacked(); recvData >> eventId >> inviteId >> ownerInviteId >> status; - TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_STATUS [" UI64FMTD"] EventId [" - UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee ([" UI64FMTD "] id: [" - UI64FMTD "], status %u", guid, eventId, ownerInviteId, invitee, inviteId, status); + TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_STATUS [%s] EventId [" + UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee ([%s] id: [" + UI64FMTD "], status %u", guid.ToString().c_str(), eventId, ownerInviteId, invitee.ToString().c_str(), inviteId, status); if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId)) { @@ -638,18 +635,18 @@ void WorldSession::HandleCalendarEventStatus(WorldPacket& recvData) void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recvData) { - uint64 guid = _player->GetGUID(); - uint64 invitee; + ObjectGuid guid = _player->GetGUID(); + ObjectGuid invitee; uint64 eventId; uint64 inviteId; uint64 ownerInviteId; // isn't it sender's inviteId? uint8 rank; - recvData.readPackGUID(invitee); - recvData >> eventId >> inviteId >> ownerInviteId >> rank; - TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_MODERATOR_STATUS [" UI64FMTD "] EventId [" - UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee ([" UI64FMTD "] id: [" - UI64FMTD "], rank %u", guid, eventId, ownerInviteId, invitee, inviteId, rank); + recvData >> invitee.ReadAsPacked(); + recvData >> eventId >> inviteId >> ownerInviteId >> rank; + TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_MODERATOR_STATUS [%s] EventId [" + UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee ([%s] id: [" + UI64FMTD "], rank %u", guid.ToString().c_str(), eventId, ownerInviteId, invitee.ToString().c_str(), inviteId, rank); if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId)) { @@ -668,24 +665,23 @@ void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recvData) void WorldSession::HandleCalendarComplain(WorldPacket& recvData) { - uint64 guid = _player->GetGUID(); + ObjectGuid guid = _player->GetGUID(); uint64 eventId; - uint64 complainGUID; + ObjectGuid complainGUID; recvData >> eventId >> complainGUID; - TC_LOG_DEBUG("network", "CMSG_CALENDAR_COMPLAIN [" UI64FMTD "] EventId [" - UI64FMTD "] guid [" UI64FMTD "]", guid, eventId, complainGUID); + TC_LOG_DEBUG("network", "CMSG_CALENDAR_COMPLAIN [%s] EventId [" + UI64FMTD "] guid [%s]", guid.ToString().c_str(), eventId, complainGUID.ToString().c_str()); // what to do with complains? } void WorldSession::HandleCalendarGetNumPending(WorldPacket& /*recvData*/) { - uint64 guid = _player->GetGUID(); + ObjectGuid guid = _player->GetGUID(); uint32 pending = sCalendarMgr->GetPlayerNumPending(guid); - TC_LOG_DEBUG("network", "CMSG_CALENDAR_GET_NUM_PENDING: [" UI64FMTD - "] Pending: %u", guid, pending); + TC_LOG_DEBUG("network", "CMSG_CALENDAR_GET_NUM_PENDING: [%s] Pending: %u", guid.ToString().c_str(), pending); WorldPacket data(SMSG_CALENDAR_SEND_NUM_PENDING, 4); data << uint32(pending); @@ -736,9 +732,9 @@ void WorldSession::SendCalendarRaidLockoutUpdated(InstanceSave const* save) if (!save) return; - uint64 guid = _player->GetGUID(); - TC_LOG_DEBUG("network", "SMSG_CALENDAR_RAID_LOCKOUT_UPDATED [" UI64FMTD - "] Map: %u, Difficulty %u", guid, save->GetMapId(), save->GetDifficulty()); + ObjectGuid guid = _player->GetGUID(); + TC_LOG_DEBUG("network", "SMSG_CALENDAR_RAID_LOCKOUT_UPDATED [%s] Map: %u, Difficulty %u", + guid.ToString().c_str(), save->GetMapId(), save->GetDifficulty()); time_t currTime = time(NULL); diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index b2507877111..be8c4916e7c 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -52,11 +52,11 @@ class LoginQueryHolder : public SQLQueryHolder { private: uint32 m_accountId; - uint64 m_guid; + ObjectGuid m_guid; public: - LoginQueryHolder(uint32 accountId, uint64 guid) + LoginQueryHolder(uint32 accountId, ObjectGuid guid) : m_accountId(accountId), m_guid(guid) { } - uint64 GetGuid() const { return m_guid; } + ObjectGuid GetGuid() const { return m_guid; } uint32 GetAccountId() const { return m_accountId; } bool Initialize(); }; @@ -66,7 +66,7 @@ bool LoginQueryHolder::Initialize() SetSize(MAX_PLAYER_LOGIN_QUERY); bool res = true; - uint32 lowGuid = GUID_LOPART(m_guid); + uint32 lowGuid = m_guid.GetCounter(); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER); stmt->setUInt32(0, lowGuid); @@ -220,16 +220,16 @@ void WorldSession::HandleCharEnum(PreparedQueryResult result) { do { - uint32 guidlow = (*result)[0].GetUInt32(); - TC_LOG_INFO("network", "Loading char guid %u from account %u.", guidlow, GetAccountId()); + ObjectGuid guid(HIGHGUID_PLAYER, (*result)[0].GetUInt32()); + TC_LOG_INFO("network", "Loading %s from account %u.", guid.ToString().c_str(), GetAccountId()); if (Player::BuildEnumData(result, &data)) { // Do not allow banned characters to log in if (!(*result)[20].GetUInt32()) - _legitCharacters.insert(guidlow); + _legitCharacters.insert(guid); - if (!sWorld->HasCharacterNameData(guidlow)) // This can happen if characters are inserted into the database manually. Core hasn't loaded name data yet. - sWorld->AddCharacterNameData(guidlow, (*result)[1].GetString(), (*result)[4].GetUInt8(), (*result)[2].GetUInt8(), (*result)[3].GetUInt8(), (*result)[7].GetUInt8()); + if (!sWorld->HasCharacterNameData(guid)) // This can happen if characters are inserted into the database manually. Core hasn't loaded name data yet. + sWorld->AddCharacterNameData(guid, (*result)[1].GetString(), (*result)[4].GetUInt8(), (*result)[2].GetUInt8(), (*result)[3].GetUInt8(), (*result)[7].GetUInt8()); ++num; } } @@ -682,7 +682,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte std::string IP_str = GetRemoteAddress(); TC_LOG_INFO("entities.player.character", "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow()); sScriptMgr->OnPlayerCreate(&newChar); - sWorld->AddCharacterNameData(newChar.GetGUIDLow(), newChar.GetName(), newChar.getGender(), newChar.getRace(), newChar.getClass(), newChar.getLevel()); + sWorld->AddCharacterNameData(newChar.GetGUID(), newChar.GetName(), newChar.getGender(), newChar.getRace(), newChar.getClass(), newChar.getLevel()); newChar.CleanupsBeforeDelete(); delete createInfo; @@ -694,7 +694,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; recvData >> guid; // Initiating uint32 initAccountId = GetAccountId(); @@ -731,7 +731,7 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData) } PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_DATA_BY_GUID); - stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt32(0, guid.GetCounter()); if (PreparedQueryResult result = CharacterDatabase.Query(stmt)) { @@ -749,7 +749,7 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData) } std::string IP_str = GetRemoteAddress(); - TC_LOG_INFO("entities.player.character", "Account: %d, IP: %s deleted character: %s, GUID: %u, Level: %u", accountId, IP_str.c_str(), name.c_str(), GUID_LOPART(guid), level); + TC_LOG_INFO("entities.player.character", "Account: %d, IP: %s deleted character: %s, %s, Level: %u", accountId, IP_str.c_str(), name.c_str(), guid.ToString().c_str(), level); // To prevent hook failure, place hook before removing reference from DB sScriptMgr->OnPlayerDelete(guid, initAccountId); // To prevent race conditioning, but as it also makes sense, we hand the accountId over for successful delete. @@ -758,8 +758,8 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData) if (sLog->ShouldLog("entities.player.dump", LOG_LEVEL_INFO)) // optimize GetPlayerDump call { std::string dump; - if (PlayerDumpWriter().GetDump(GUID_LOPART(guid), dump)) - sLog->outCharDump(dump.c_str(), accountId, GUID_LOPART(guid), name.c_str()); + if (PlayerDumpWriter().GetDump(guid.GetCounter(), dump)) + sLog->outCharDump(dump.c_str(), accountId, guid.GetCounter(), name.c_str()); } sCalendarMgr->RemoveAllPlayerEventsAndInvites(guid); @@ -780,15 +780,15 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData) } m_playerLoading = true; - uint64 playerGuid = 0; + ObjectGuid playerGuid; TC_LOG_DEBUG("network", "WORLD: Recvd Player Logon Message"); recvData >> playerGuid; - if (!IsLegitCharacterForAccount(GUID_LOPART(playerGuid))) + if (!IsLegitCharacterForAccount(playerGuid)) { - TC_LOG_ERROR("network", "Account (%u) can't login with that character (%u).", GetAccountId(), GUID_LOPART(playerGuid)); + TC_LOG_ERROR("network", "Account (%u) can't login with that character (%s).", GetAccountId(), playerGuid.ToString().c_str()); KickPlayer(); return; } @@ -801,19 +801,19 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData) return; } - _charLoginCallback = CharacterDatabase.DelayQueryHolder((SQLQueryHolder*)holder); + _charLoginCallback = CharacterDatabase.DelayQueryHolder(holder); } void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) { - uint64 playerGuid = holder->GetGuid(); + ObjectGuid playerGuid = holder->GetGuid(); Player* pCurrChar = new Player(this); // for send server info and strings (config) ChatHandler chH = ChatHandler(pCurrChar->GetSession()); // "GetAccountId() == db stored account id" checked in LoadFromDB (prevent login not own character using cheating tools) - if (!pCurrChar->LoadFromDB(GUID_LOPART(playerGuid), holder)) + if (!pCurrChar->LoadFromDB(playerGuid, holder)) { SetPlayer(NULL); KickPlayer(); // disconnect client, player no set to session and it will not deleted or saved at kick @@ -1127,7 +1127,7 @@ void WorldSession::HandleShowingCloakOpcode(WorldPacket& recvData) void WorldSession::HandleCharRenameOpcode(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; std::string newName; recvData >> guid; @@ -1168,7 +1168,7 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recvData) PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_FREE_NAME); - stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt32(0, guid.GetCounter()); stmt->setUInt32(1, GetAccountId()); stmt->setUInt16(2, AT_LOGIN_RENAME); stmt->setUInt16(3, AT_LOGIN_RENAME); @@ -1192,7 +1192,7 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult resu uint32 guidLow = fields[0].GetUInt32(); std::string oldName = fields[1].GetString(); - uint64 guid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER); + ObjectGuid guid = ObjectGuid(HIGHGUID_PLAYER, guidLow); // Update name and at_login flag in the db PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_NAME); @@ -1210,7 +1210,7 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult resu CharacterDatabase.Execute(stmt); - TC_LOG_INFO("entities.player.character", "Account: %d (IP: %s) Character:[%s] (guid:%u) Changed name to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), guidLow, newName.c_str()); + TC_LOG_INFO("entities.player.character", "Account: %d (IP: %s) Character:[%s] (%s) Changed name to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), guid.ToString().c_str(), newName.c_str()); WorldPacket data(SMSG_CHAR_RENAME, 1+8+(newName.size()+1)); data << uint8(RESPONSE_SUCCESS); @@ -1218,12 +1218,12 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult resu data << newName; SendPacket(&data); - sWorld->UpdateCharacterNameData(guidLow, newName); + sWorld->UpdateCharacterNameData(guid, newName); } void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; recvData >> guid; @@ -1299,11 +1299,11 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recvData) SQLTransaction trans = CharacterDatabase.BeginTransaction(); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_DECLINED_NAME); - stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt32(0, guid.GetCounter()); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_DECLINED_NAME); - stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt32(0, guid.GetCounter()); for (uint8 i = 0; i < 5; i++) stmt->setString(i+1, declinedname.name[i]); @@ -1414,14 +1414,14 @@ void WorldSession::HandleRemoveGlyph(WorldPacket& recvData) void WorldSession::HandleCharCustomize(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; std::string newName; recvData >> guid; - if (!IsLegitCharacterForAccount(GUID_LOPART(guid))) + if (!IsLegitCharacterForAccount(guid)) { - TC_LOG_ERROR("network", "Account %u, IP: %s tried to customise character %u, but it does not belong to their account!", - GetAccountId(), GetRemoteAddress().c_str(), GUID_LOPART(guid)); + TC_LOG_ERROR("network", "Account %u, IP: %s tried to customise %s, but it does not belong to their account!", + GetAccountId(), GetRemoteAddress().c_str(), guid.ToString().c_str()); recvData.rfinish(); KickPlayer(); return; @@ -1434,7 +1434,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData) PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AT_LOGIN); - stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt32(0, guid.GetCounter()); // TODO: Make async with callback PreparedQueryResult result = CharacterDatabase.Query(stmt); @@ -1485,7 +1485,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData) } // character with this name already exist - if (uint64 newguid = sObjectMgr->GetPlayerGUIDByName(newName)) + if (ObjectGuid newguid = sObjectMgr->GetPlayerGUIDByName(newName)) { if (newguid != guid) { @@ -1497,13 +1497,13 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData) } stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME); - stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt32(0, guid.GetCounter()); result = CharacterDatabase.Query(stmt); if (result) { std::string oldname = result->Fetch()[0].GetString(); - TC_LOG_INFO("entities.player.character", "Account: %d (IP: %s), Character[%s] (guid:%u) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldname.c_str(), GUID_LOPART(guid), newName.c_str()); + TC_LOG_INFO("entities.player.character", "Account: %d (IP: %s), Character[%s] (%s) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldname.c_str(), guid.ToString().c_str(), newName.c_str()); } Player::Customize(guid, gender, skin, face, hairStyle, hairColor, facialHair); @@ -1512,17 +1512,17 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData) stmt->setString(0, newName); stmt->setUInt16(1, uint16(AT_LOGIN_CUSTOMIZE)); - stmt->setUInt32(2, GUID_LOPART(guid)); + stmt->setUInt32(2, guid.GetCounter()); CharacterDatabase.Execute(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_DECLINED_NAME); - stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt32(0, guid.GetCounter()); CharacterDatabase.Execute(stmt); - sWorld->UpdateCharacterNameData(GUID_LOPART(guid), newName, gender); + sWorld->UpdateCharacterNameData(guid, newName, gender); WorldPacket data(SMSG_CHAR_CUSTOMIZE, 1+8+(newName.size()+1)+6); data << uint8(RESPONSE_SUCCESS); @@ -1564,11 +1564,11 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket &recvData) for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i) { - uint64 itemGuid; - recvData.readPackGUID(itemGuid); + ObjectGuid itemGuid; + recvData >> itemGuid.ReadAsPacked(); // equipment manager sends "1" (as raw GUID) for slots set to "ignore" (don't touch slot at equip set) - if (itemGuid == 1) + if (itemGuid.GetRawValue() == 1) { // ignored slots saved as bit mask because we have no free special values for Items[i] eqSet.IgnoreMask |= 1 << i; @@ -1583,7 +1583,7 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket &recvData) if (item && item->GetGUID() != itemGuid) // cheating check 2 return; - eqSet.Items[i] = GUID_LOPART(itemGuid); + eqSet.Items[i] = itemGuid.GetCounter(); } _player->SetEquipmentSet(index, eqSet); @@ -1605,16 +1605,16 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recvData) for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i) { - uint64 itemGuid; - recvData.readPackGUID(itemGuid); + ObjectGuid itemGuid; + recvData >> itemGuid.ReadAsPacked(); uint8 srcbag, srcslot; recvData >> srcbag >> srcslot; - TC_LOG_DEBUG("entities.player.items", "Item " UI64FMTD ": srcbag %u, srcslot %u", itemGuid, srcbag, srcslot); + TC_LOG_DEBUG("entities.player.items", "%s: srcbag %u, srcslot %u", itemGuid.ToString().c_str(), srcbag, srcslot); // check if item slot is set to "ignored" (raw value == 1), must not be unequipped then - if (itemGuid == 1) + if (itemGuid.GetRawValue() == 1) continue; // Only equip weapons in combat @@ -1657,15 +1657,15 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recvData) void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; std::string newname; uint8 gender, skin, face, hairStyle, hairColor, facialHair, race; recvData >> guid; - if (!IsLegitCharacterForAccount(GUID_LOPART(guid))) + if (!IsLegitCharacterForAccount(guid)) { - TC_LOG_ERROR("network", "Account %u, IP: %s tried to factionchange character %u, but it does not belong to their account!", - GetAccountId(), GetRemoteAddress().c_str(), GUID_LOPART(guid)); + TC_LOG_ERROR("network", "Account %u, IP: %s tried to factionchange character %s, but it does not belong to their account!", + GetAccountId(), GetRemoteAddress().c_str(), guid.ToString().c_str()); recvData.rfinish(); KickPlayer(); return; @@ -1674,10 +1674,10 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) recvData >> newname; recvData >> gender >> skin >> hairColor >> hairStyle >> facialHair >> face >> race; - uint32 lowGuid = GUID_LOPART(guid); + uint32 lowGuid = guid.GetCounter(); // get the players old (at this moment current) race - CharacterNameData const* nameData = sWorld->GetCharacterNameData(lowGuid); + CharacterNameData const* nameData = sWorld->GetCharacterNameData(guid); if (!nameData) { WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1); @@ -1764,7 +1764,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) } // character with this name already exist - if (uint64 newguid = sObjectMgr->GetPlayerGUIDByName(newname)) + if (ObjectGuid newguid = sObjectMgr->GetPlayerGUIDByName(newname)) { if (newguid != guid) { @@ -1793,7 +1793,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) stmt->setUInt32(0, lowGuid); trans->Append(stmt); - sWorld->UpdateCharacterNameData(GUID_LOPART(guid), newname, gender, race); + sWorld->UpdateCharacterNameData(guid, newname, gender, race); if (oldRace != race) { @@ -1932,7 +1932,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) PreparedQueryResult result = CharacterDatabase.Query(stmt); if (result) if (Guild* guild = sGuildMgr->GetGuildById((result->Fetch()[0]).GetUInt32())) - guild->DeleteMember(MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER), false, false, true); + guild->DeleteMember(guid, false, false, true); Player::LeaveAllArenaTeams(guid); } @@ -1963,7 +1963,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) stmt->setFloat (3, -8867.68f); stmt->setFloat (4, 673.373f); stmt->setFloat (5, 97.9034f); - Player::SavePositionInDB(0, -8867.68f, 673.373f, 97.9034f, 0.0f, 1519, lowGuid); + Player::SavePositionInDB(0, -8867.68f, 673.373f, 97.9034f, 0.0f, 1519, guid); } else { @@ -1972,7 +1972,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) stmt->setFloat (3, 1633.33f); stmt->setFloat (4, -4439.11f); stmt->setFloat (5, 15.7588f); - Player::SavePositionInDB(1, 1633.33f, -4439.11f, 15.7588f, 0.0f, 1637, lowGuid); + Player::SavePositionInDB(1, 1633.33f, -4439.11f, 15.7588f, 0.0f, 1637, guid); } trans->Append(stmt); @@ -2003,13 +2003,13 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_INVENTORY_FACTION_CHANGE); stmt->setUInt32(0, (team == TEAM_ALLIANCE ? item_alliance : item_horde)); stmt->setUInt32(1, (team == TEAM_ALLIANCE ? item_horde : item_alliance)); - stmt->setUInt32(2, guid); + stmt->setUInt32(2, lowGuid); trans->Append(stmt); } // Delete all current quests stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS); - stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt32(0, lowGuid); trans->Append(stmt); // Quest conversion diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp index e820f23299d..b33f2364683 100644 --- a/src/server/game/Handlers/ChatHandler.cpp +++ b/src/server/game/Handlers/ChatHandler.cpp @@ -547,7 +547,7 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket& recvData) } uint32 text_emote, emoteNum; - uint64 guid; + ObjectGuid guid; recvData >> text_emote; recvData >> emoteNum; @@ -598,7 +598,7 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket& recvData) void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recvData) { - uint64 iguid; + ObjectGuid iguid; uint8 unk; //TC_LOG_DEBUG("network", "WORLD: Received CMSG_CHAT_IGNORED"); diff --git a/src/server/game/Handlers/CombatHandler.cpp b/src/server/game/Handlers/CombatHandler.cpp index e4d749d9ab0..152d6994949 100644 --- a/src/server/game/Handlers/CombatHandler.cpp +++ b/src/server/game/Handlers/CombatHandler.cpp @@ -30,10 +30,10 @@ void WorldSession::HandleAttackSwingOpcode(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; recvData >> guid; - TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_ATTACKSWING Message guidlow:%u guidhigh:%u", GUID_LOPART(guid), GUID_HIPART(guid)); + TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_ATTACKSWING Message %s", guid.ToString().c_str()); Unit* pEnemy = ObjectAccessor::GetUnit(*_player, guid); @@ -92,9 +92,9 @@ void WorldSession::HandleSetSheathedOpcode(WorldPacket& recvData) void WorldSession::SendAttackStop(Unit const* enemy) { WorldPacket data(SMSG_ATTACKSTOP, (8+8+4)); // we guess size - data.append(GetPlayer()->GetPackGUID()); + data << GetPlayer()->GetPackGUID(); if (enemy) - data.append(enemy->GetPackGUID()); + data << enemy->GetPackGUID(); else data << uint8(0); diff --git a/src/server/game/Handlers/DuelHandler.cpp b/src/server/game/Handlers/DuelHandler.cpp index b07df587fbf..f93fc7e8ce0 100644 --- a/src/server/game/Handlers/DuelHandler.cpp +++ b/src/server/game/Handlers/DuelHandler.cpp @@ -26,7 +26,7 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket) { - uint64 guid; + ObjectGuid guid; Player* player; Player* plTarget; @@ -35,7 +35,7 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket) if (!GetPlayer()->duel) // ignore accept from duel-sender return; - player = GetPlayer(); + player = GetPlayer(); plTarget = player->duel->opponent; if (player == player->duel->initiator || !plTarget || player == plTarget || player->duel->startTime != 0 || plTarget->duel->startTime != 0) @@ -56,7 +56,7 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket) void WorldSession::HandleDuelCancelledOpcode(WorldPacket& recvPacket) { TC_LOG_DEBUG("network", "WORLD: Received CMSG_DUEL_CANCELLED"); - uint64 guid; + ObjectGuid guid; recvPacket >> guid; // no duel requested diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp index 5b35da297c9..a7ce1f8533a 100644 --- a/src/server/game/Handlers/GroupHandler.cpp +++ b/src/server/game/Handlers/GroupHandler.cpp @@ -275,7 +275,7 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_UNINVITE_GUID"); - uint64 guid; + ObjectGuid guid; std::string reason; recvData >> guid; recvData >> reason; @@ -350,7 +350,7 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket& recvData) if (!grp) return; - if (uint64 guid = grp->GetMemberGUID(membername)) + if (ObjectGuid guid = grp->GetMemberGUID(membername)) { Player::RemoveFromGroup(grp, guid, GROUP_REMOVEMETHOD_KICK, GetPlayer()->GetGUID()); return; @@ -369,7 +369,7 @@ void WorldSession::HandleGroupSetLeaderOpcode(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_SET_LEADER"); - uint64 guid; + ObjectGuid guid; recvData >> guid; Player* player = ObjectAccessor::FindPlayer(guid); @@ -414,7 +414,7 @@ void WorldSession::HandleLootMethodOpcode(WorldPacket& recvData) TC_LOG_DEBUG("network", "WORLD: Received CMSG_LOOT_METHOD"); uint32 lootMethod; - uint64 lootMaster; + ObjectGuid lootMaster; uint32 lootThreshold; recvData >> lootMethod >> lootMaster >> lootThreshold; @@ -445,7 +445,7 @@ void WorldSession::HandleLootMethodOpcode(WorldPacket& recvData) void WorldSession::HandleLootRoll(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; uint32 itemSlot; uint8 rollType; recvData >> guid; // guid of the item rolled @@ -546,10 +546,10 @@ void WorldSession::HandleRaidTargetUpdateOpcode(WorldPacket& recvData) if (group->isRaidGroup() && !group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID())) return; - uint64 guid; + ObjectGuid guid; recvData >> guid; - if (IS_PLAYER_GUID(guid)) + if (guid.IsPlayer()) { Player* target = ObjectAccessor::FindPlayer(guid); @@ -599,7 +599,7 @@ void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket& recvData) if (groupNr >= MAX_RAID_SUBGROUPS) return; - uint64 senderGuid = GetPlayer()->GetGUID(); + ObjectGuid senderGuid = GetPlayer()->GetGUID(); if (!group->IsLeader(senderGuid) && !group->IsAssistant(senderGuid)) return; @@ -607,7 +607,7 @@ void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket& recvData) return; Player* movedPlayer = sObjectAccessor->FindPlayerByName(name); - uint64 guid; + ObjectGuid guid; if (movedPlayer) { guid = movedPlayer->GetGUID(); @@ -632,7 +632,7 @@ void WorldSession::HandleGroupAssistantLeaderOpcode(WorldPacket& recvData) if (!group->IsLeader(GetPlayer()->GetGUID())) return; - uint64 guid; + ObjectGuid guid; bool apply; recvData >> guid; recvData >> apply; @@ -648,13 +648,13 @@ void WorldSession::HandlePartyAssignmentOpcode(WorldPacket& recvData) if (!group) return; - uint64 senderGuid = GetPlayer()->GetGUID(); + ObjectGuid senderGuid = GetPlayer()->GetGUID(); if (!group->IsLeader(senderGuid) && !group->IsAssistant(senderGuid)) return; uint8 assignment; bool apply; - uint64 guid; + ObjectGuid guid; recvData >> assignment >> apply; recvData >> guid; @@ -740,7 +740,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke byteCount += GroupUpdateLength[i]; data->Initialize(SMSG_PARTY_MEMBER_STATS, 8 + 4 + byteCount); - data->append(player->GetPackGUID()); + *data << player->GetPackGUID(); *data << uint32(mask); if (mask & GROUP_UPDATE_FLAG_STATUS) @@ -910,7 +910,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket &recvData) { TC_LOG_DEBUG("network", "WORLD: Received CMSG_REQUEST_PARTY_MEMBER_STATS"); - uint64 Guid; + ObjectGuid Guid; recvData >> Guid; Player* player = HashMapHolder<Player>::Find(Guid); @@ -918,7 +918,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket &recvData) { WorldPacket data(SMSG_PARTY_MEMBER_STATS_FULL, 3+4+2); data << uint8(0); // only for SMSG_PARTY_MEMBER_STATS_FULL, probably arena/bg related - data.appendPackGUID(Guid); + data << Guid.WriteAsPacked(); data << uint32(GROUP_UPDATE_FLAG_STATUS); data << uint16(MEMBER_STATUS_OFFLINE); SendPacket(&data); @@ -930,7 +930,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket &recvData) WorldPacket data(SMSG_PARTY_MEMBER_STATS_FULL, 4+2+2+2+1+2*6+8+1+8); data << uint8(0); // only for SMSG_PARTY_MEMBER_STATS_FULL, probably arena/bg related - data.append(player->GetPackGUID()); + data << player->GetPackGUID(); uint32 updateFlags = GROUP_UPDATE_FLAG_STATUS | GROUP_UPDATE_FLAG_CUR_HP | GROUP_UPDATE_FLAG_MAX_HP | GROUP_UPDATE_FLAG_CUR_POWER | GROUP_UPDATE_FLAG_MAX_POWER | GROUP_UPDATE_FLAG_LEVEL diff --git a/src/server/game/Handlers/GuildHandler.cpp b/src/server/game/Handlers/GuildHandler.cpp index b652192bfd7..ac226f71e96 100644 --- a/src/server/game/Handlers/GuildHandler.cpp +++ b/src/server/game/Handlers/GuildHandler.cpp @@ -269,15 +269,14 @@ void WorldSession::HandleGuildChangeInfoTextOpcode(WorldPacket& recvPacket) void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket) { - uint64 vendorGuid; + ObjectGuid vendorGuid; recvPacket >> vendorGuid; EmblemInfo emblemInfo; emblemInfo.ReadPacket(recvPacket); - TC_LOG_DEBUG("guild", "MSG_SAVE_GUILD_EMBLEM [%s]: Guid: [" UI64FMTD - "] Style: %d, Color: %d, BorderStyle: %d, BorderColor: %d, BackgroundColor: %d" - , GetPlayerInfo().c_str(), vendorGuid, emblemInfo.GetStyle() + TC_LOG_DEBUG("guild", "MSG_SAVE_GUILD_EMBLEM [%s]: Guid: [%s] Style: %d, Color: %d, BorderStyle: %d, BorderColor: %d, BackgroundColor: %d" + , GetPlayerInfo().c_str(), vendorGuid.ToString().c_str(), emblemInfo.GetStyle() , emblemInfo.GetColor(), emblemInfo.GetBorderStyle() , emblemInfo.GetBorderColor(), emblemInfo.GetBackgroundColor()); @@ -323,12 +322,12 @@ void WorldSession::HandleGuildPermissions(WorldPacket& /* recvData */) // Called when clicking on Guild bank gameobject void WorldSession::HandleGuildBankerActivate(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; bool sendAllSlots; recvData >> guid >> sendAllSlots; - TC_LOG_DEBUG("guild", "CMSG_GUILD_BANKER_ACTIVATE [%s]: Go: [" UI64FMTD "] AllSlots: %u" - , GetPlayerInfo().c_str(), guid, sendAllSlots); + TC_LOG_DEBUG("guild", "CMSG_GUILD_BANKER_ACTIVATE [%s]: [%s] AllSlots: %u" + , GetPlayerInfo().c_str(), guid.ToString().c_str(), sendAllSlots); Guild* const guild = GetPlayer()->GetGuild(); if (!guild) @@ -343,14 +342,14 @@ void WorldSession::HandleGuildBankerActivate(WorldPacket& recvData) // Called when opening guild bank tab only (first one) void WorldSession::HandleGuildBankQueryTab(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; uint8 tabId; bool full; recvData >> guid >> tabId >> full; - TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_QUERY_TAB [%s]: Go: [" UI64FMTD "], TabId: %u, ShowTabs: %u" - , GetPlayerInfo().c_str(), guid, tabId, full); + TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_QUERY_TAB [%s]: %s, TabId: %u, ShowTabs: %u" + , GetPlayerInfo().c_str(), guid.ToString().c_str(), tabId, full); if (GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK)) if (Guild* guild = GetPlayer()->GetGuild()) @@ -359,12 +358,12 @@ void WorldSession::HandleGuildBankQueryTab(WorldPacket& recvData) void WorldSession::HandleGuildBankDepositMoney(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; uint32 money; recvData >> guid >> money; - TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_DEPOSIT_MONEY [%s]: Go: [" UI64FMTD "], money: %u", - GetPlayerInfo().c_str(), guid, money); + TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_DEPOSIT_MONEY [%s]: [%s], money: %u", + GetPlayerInfo().c_str(), guid.ToString().c_str(), money); if (GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK)) if (money && GetPlayer()->HasEnoughMoney(money)) @@ -374,12 +373,12 @@ void WorldSession::HandleGuildBankDepositMoney(WorldPacket& recvData) void WorldSession::HandleGuildBankWithdrawMoney(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; uint32 money; recvData >> guid >> money; - TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_WITHDRAW_MONEY [%s]: Go: [" UI64FMTD "], money: %u", - GetPlayerInfo().c_str(), guid, money); + TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_WITHDRAW_MONEY [%s]: [%s], money: %u", + GetPlayerInfo().c_str(), guid.ToString().c_str(), money); if (money && GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK)) if (Guild* guild = GetPlayer()->GetGuild()) @@ -390,7 +389,7 @@ void WorldSession::HandleGuildBankSwapItems(WorldPacket& recvData) { TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_SWAP_ITEMS [%s]", GetPlayerInfo().c_str()); - uint64 GoGuid; + ObjectGuid GoGuid; recvData >> GoGuid; if (!GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK)) @@ -469,12 +468,12 @@ void WorldSession::HandleGuildBankSwapItems(WorldPacket& recvData) void WorldSession::HandleGuildBankBuyTab(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; uint8 tabId; recvData >> guid >> tabId; - TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_BUY_TAB [%s]: Go: [" UI64FMTD "], TabId: %u", GetPlayerInfo().c_str(), guid, tabId); + TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_BUY_TAB [%s]: [%s[, TabId: %u", GetPlayerInfo().c_str(), guid.ToString().c_str(), tabId); if (GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK)) @@ -484,14 +483,14 @@ void WorldSession::HandleGuildBankBuyTab(WorldPacket& recvData) void WorldSession::HandleGuildBankUpdateTab(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; uint8 tabId; std::string name, icon; recvData >> guid >> tabId >> name >> icon; - TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_UPDATE_TAB [%s]: Go: [" UI64FMTD "], TabId: %u, Name: %s, Icon: %s" - , GetPlayerInfo().c_str(), guid, tabId, name.c_str(), icon.c_str()); + TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_UPDATE_TAB [%s]: [%s], TabId: %u, Name: %s, Icon: %s" + , GetPlayerInfo().c_str(), guid.ToString().c_str(), tabId, name.c_str(), icon.c_str()); if (!name.empty() && !icon.empty()) if (GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK)) diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp index 60966ace011..3172c7a3184 100644 --- a/src/server/game/Handlers/ItemHandler.cpp +++ b/src/server/game/Handlers/ItemHandler.cpp @@ -87,13 +87,13 @@ void WorldSession::HandleSwapInvItemOpcode(WorldPacket& recvData) if (_player->IsBankPos(INVENTORY_SLOT_BAG_0, srcslot) && !CanUseBank()) { - TC_LOG_DEBUG("network", "WORLD: HandleSwapInvItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID))); + TC_LOG_DEBUG("network", "WORLD: HandleSwapInvItemOpcode - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str()); return; } if (_player->IsBankPos(INVENTORY_SLOT_BAG_0, dstslot) && !CanUseBank()) { - TC_LOG_DEBUG("network", "WORLD: HandleSwapInvItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID))); + TC_LOG_DEBUG("network", "WORLD: HandleSwapInvItemOpcode - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str()); return; } @@ -105,7 +105,7 @@ void WorldSession::HandleSwapInvItemOpcode(WorldPacket& recvData) void WorldSession::HandleAutoEquipItemSlotOpcode(WorldPacket& recvData) { - uint64 itemguid; + ObjectGuid itemguid; uint8 dstslot; recvData >> itemguid >> dstslot; @@ -151,13 +151,13 @@ void WorldSession::HandleSwapItem(WorldPacket& recvData) if (_player->IsBankPos(srcbag, srcslot) && !CanUseBank()) { - TC_LOG_DEBUG("network", "WORLD: HandleSwapItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID))); + TC_LOG_DEBUG("network", "WORLD: HandleSwapItem - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str()); return; } if (_player->IsBankPos(dstbag, dstslot) && !CanUseBank()) { - TC_LOG_DEBUG("network", "WORLD: HandleSwapItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID))); + TC_LOG_DEBUG("network", "WORLD: HandleSwapItem - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str()); return; } @@ -497,7 +497,7 @@ void WorldSession::HandleReadItem(WorldPacket& recvData) void WorldSession::HandleSellItemOpcode(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: Received CMSG_SELL_ITEM"); - uint64 vendorguid, itemguid; + ObjectGuid vendorguid, itemguid; uint32 count; recvData >> vendorguid >> itemguid >> count; @@ -508,7 +508,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData) Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR); if (!creature) { - TC_LOG_DEBUG("network", "WORLD: HandleSellItemOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorguid))); + TC_LOG_DEBUG("network", "WORLD: HandleSellItemOpcode - %s not found or you can not interact with him.", vendorguid.ToString().c_str()); _player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, itemguid, 0); return; } @@ -609,7 +609,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData) void WorldSession::HandleBuybackItem(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: Received CMSG_BUYBACK_ITEM"); - uint64 vendorguid; + ObjectGuid vendorguid; uint32 slot; recvData >> vendorguid >> slot; @@ -617,8 +617,8 @@ void WorldSession::HandleBuybackItem(WorldPacket& recvData) Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR); if (!creature) { - TC_LOG_DEBUG("network", "WORLD: HandleBuybackItem - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorguid))); - _player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, 0, 0); + TC_LOG_DEBUG("network", "WORLD: HandleBuybackItem - Unit (GUID: %u) not found or you can not interact with him.", vendorguid.ToString().c_str()); + _player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, ObjectGuid::Empty, 0); return; } @@ -657,7 +657,7 @@ void WorldSession::HandleBuybackItem(WorldPacket& recvData) void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: Received CMSG_BUY_ITEM_IN_SLOT"); - uint64 vendorguid, bagguid; + ObjectGuid vendorguid, bagguid; uint32 item, slot, count; uint8 bagslot; @@ -699,7 +699,7 @@ void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket& recvData) void WorldSession::HandleBuyItemOpcode(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: Received CMSG_BUY_ITEM"); - uint64 vendorguid; + ObjectGuid vendorguid; uint32 item, slot, count; uint8 unk1; @@ -716,7 +716,7 @@ void WorldSession::HandleBuyItemOpcode(WorldPacket& recvData) void WorldSession::HandleListInventoryOpcode(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; recvData >> guid; @@ -728,15 +728,15 @@ void WorldSession::HandleListInventoryOpcode(WorldPacket& recvData) SendListInventory(guid); } -void WorldSession::SendListInventory(uint64 vendorGuid) +void WorldSession::SendListInventory(ObjectGuid vendorGuid) { TC_LOG_DEBUG("network", "WORLD: Sent SMSG_LIST_INVENTORY"); Creature* vendor = GetPlayer()->GetNPCIfCanInteractWith(vendorGuid, UNIT_NPC_FLAG_VENDOR); if (!vendor) { - TC_LOG_DEBUG("network", "WORLD: SendListInventory - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorGuid))); - _player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, 0, 0); + TC_LOG_DEBUG("network", "WORLD: SendListInventory - %s not found or you can not interact with him.", vendorGuid.ToString().c_str()); + _player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, ObjectGuid::Empty, 0); return; } @@ -879,12 +879,12 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket) { TC_LOG_DEBUG("network", "WORLD: CMSG_BUY_BANK_SLOT"); - uint64 guid; + ObjectGuid guid; recvPacket >> guid; if (!CanUseBank(guid)) { - TC_LOG_DEBUG("network", "WORLD: HandleBuyBankSlotOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleBuyBankSlotOpcode - %s not found or you can't interact with him.", guid.ToString().c_str()); return; } @@ -934,7 +934,7 @@ void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket) if (!CanUseBank()) { - TC_LOG_DEBUG("network", "WORLD: HandleAutoBankItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID))); + TC_LOG_DEBUG("network", "WORLD: HandleAutoBankItemOpcode - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str()); return; } @@ -971,7 +971,7 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket) if (!CanUseBank()) { - TC_LOG_DEBUG("network", "WORLD: HandleAutoStoreBankItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID))); + TC_LOG_DEBUG("network", "WORLD: HandleAutoStoreBankItemOpcode - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str()); return; } @@ -1035,17 +1035,17 @@ void WorldSession::HandleSetAmmoOpcode(WorldPacket& recvData) _player->RemoveAmmo(); } -void WorldSession::SendEnchantmentLog(uint64 target, uint64 caster, uint32 itemId, uint32 enchantId) +void WorldSession::SendEnchantmentLog(ObjectGuid target, ObjectGuid caster, uint32 itemId, uint32 enchantId) { WorldPacket data(SMSG_ENCHANTMENTLOG, (8+8+4+4)); // last check 2.0.10 - data.appendPackGUID(target); - data.appendPackGUID(caster); + data << target.WriteAsPacked(); + data << caster.WriteAsPacked(); data << uint32(itemId); data << uint32(enchantId); GetPlayer()->SendMessageToSet(&data, true); } -void WorldSession::SendItemEnchantTimeUpdate(uint64 Playerguid, uint64 Itemguid, uint32 slot, uint32 Duration) +void WorldSession::SendItemEnchantTimeUpdate(ObjectGuid Playerguid, ObjectGuid Itemguid, uint32 slot, uint32 Duration) { // last check 2.0.10 WorldPacket data(SMSG_ITEM_ENCHANT_TIME_UPDATE, (8+4+4+8)); @@ -1124,7 +1124,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData) return; } - if (item->GetUInt64Value(ITEM_FIELD_GIFTCREATOR)) // HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED); + if (!item->GetGuidValue(ITEM_FIELD_GIFTCREATOR).IsEmpty()) // HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED); { _player->SendEquipError(EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED, item, NULL); return; @@ -1158,7 +1158,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData) SQLTransaction trans = CharacterDatabase.BeginTransaction(); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_GIFT); - stmt->setUInt32(0, GUID_LOPART(item->GetOwnerGUID())); + stmt->setUInt32(0, item->GetOwnerGUID().GetCounter()); stmt->setUInt32(1, item->GetGUIDLow()); stmt->setUInt32(2, item->GetEntry()); stmt->setUInt32(3, item->GetUInt32Value(ITEM_FIELD_FLAGS)); @@ -1175,7 +1175,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData) case 17307: item->SetEntry(17308); break; case 21830: item->SetEntry(21831); break; } - item->SetUInt64Value(ITEM_FIELD_GIFTCREATOR, _player->GetGUID()); + item->SetGuidValue(ITEM_FIELD_GIFTCREATOR, _player->GetGUID()); item->SetUInt32Value(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED); item->SetState(ITEM_CHANGED, _player); @@ -1195,8 +1195,8 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: CMSG_SOCKET_GEMS"); - uint64 item_guid; - uint64 gem_guids[MAX_GEM_SOCKETS]; + ObjectGuid item_guid; + ObjectGuid gem_guids[MAX_GEM_SOCKETS]; recvData >> item_guid; if (!item_guid) @@ -1417,7 +1417,7 @@ void WorldSession::HandleItemRefundInfoRequest(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: CMSG_ITEM_REFUND_INFO"); - uint64 guid; + ObjectGuid guid; recvData >> guid; // item guid Item* item = _player->GetItemByGuid(guid); @@ -1433,7 +1433,7 @@ void WorldSession::HandleItemRefundInfoRequest(WorldPacket& recvData) void WorldSession::HandleItemRefund(WorldPacket &recvData) { TC_LOG_DEBUG("network", "WORLD: CMSG_ITEM_REFUND"); - uint64 guid; + ObjectGuid guid; recvData >> guid; // item guid Item* item = _player->GetItemByGuid(guid); @@ -1457,10 +1457,10 @@ void WorldSession::HandleItemRefund(WorldPacket &recvData) */ void WorldSession::HandleItemTextQuery(WorldPacket& recvData ) { - uint64 itemGuid; + ObjectGuid itemGuid; recvData >> itemGuid; - TC_LOG_DEBUG("network", "CMSG_ITEM_TEXT_QUERY item guid: %u", GUID_LOPART(itemGuid)); + TC_LOG_DEBUG("network", "CMSG_ITEM_TEXT_QUERY %s", itemGuid.ToString().c_str()); WorldPacket data(SMSG_ITEM_TEXT_QUERY_RESPONSE, (4+10)); // guess size @@ -1478,7 +1478,7 @@ void WorldSession::HandleItemTextQuery(WorldPacket& recvData ) SendPacket(&data); } -bool WorldSession::CanUseBank(uint64 bankerGUID) const +bool WorldSession::CanUseBank(ObjectGuid bankerGUID) const { // bankerGUID parameter is optional, set to 0 by default. if (!bankerGUID) diff --git a/src/server/game/Handlers/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp index a984c033872..65b4ef66c04 100644 --- a/src/server/game/Handlers/LFGHandler.cpp +++ b/src/server/game/Handlers/LFGHandler.cpp @@ -87,8 +87,8 @@ void WorldSession::HandleLfgJoinOpcode(WorldPacket& recvData) void WorldSession::HandleLfgLeaveOpcode(WorldPacket& /*recvData*/) { Group* group = GetPlayer()->GetGroup(); - uint64 guid = GetPlayer()->GetGUID(); - uint64 gguid = group ? group->GetGUID() : guid; + ObjectGuid guid = GetPlayer()->GetGUID(); + ObjectGuid gguid = group ? group->GetGUID() : guid; TC_LOG_DEBUG("lfg", "CMSG_LFG_LEAVE %s in group: %u", GetPlayerInfo().c_str(), group ? 1 : 0); @@ -114,7 +114,7 @@ void WorldSession::HandleLfgSetRolesOpcode(WorldPacket& recvData) { uint8 roles; recvData >> roles; // Player Group Roles - uint64 guid = GetPlayer()->GetGUID(); + ObjectGuid guid = GetPlayer()->GetGUID(); Group* group = GetPlayer()->GetGroup(); if (!group) { @@ -122,9 +122,9 @@ void WorldSession::HandleLfgSetRolesOpcode(WorldPacket& recvData) GetPlayerInfo().c_str()); return; } - uint64 gguid = group->GetGUID(); + ObjectGuid gguid = group->GetGUID(); TC_LOG_DEBUG("lfg", "CMSG_LFG_SET_ROLES: Group %u, Player %s, Roles: %u", - GUID_LOPART(gguid), GetPlayerInfo().c_str(), roles); + gguid.GetCounter(), GetPlayerInfo().c_str(), roles); sLFGMgr->UpdateRoleCheck(gguid, guid, roles); } @@ -144,7 +144,7 @@ void WorldSession::HandleLfgSetBootVoteOpcode(WorldPacket& recvData) bool agree; // Agree to kick player recvData >> agree; - uint64 guid = GetPlayer()->GetGUID(); + ObjectGuid guid = GetPlayer()->GetGUID(); TC_LOG_DEBUG("lfg", "CMSG_LFG_SET_BOOT_VOTE %s agree: %u", GetPlayerInfo().c_str(), agree ? 1 : 0); sLFGMgr->UpdateBoot(guid, agree); @@ -162,7 +162,7 @@ void WorldSession::HandleLfgTeleportOpcode(WorldPacket& recvData) void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recvData*/) { - uint64 guid = GetPlayer()->GetGUID(); + ObjectGuid guid = GetPlayer()->GetGUID(); TC_LOG_DEBUG("lfg", "CMSG_LFG_PLAYER_LOCK_INFO_REQUEST %s", GetPlayerInfo().c_str()); @@ -233,7 +233,7 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recvData* void WorldSession::HandleLfgPartyLockInfoRequestOpcode(WorldPacket& /*recvData*/) { - uint64 guid = GetPlayer()->GetGUID(); + ObjectGuid guid = GetPlayer()->GetGUID(); TC_LOG_DEBUG("lfg", "CMSG_LFG_PARTY_LOCK_INFO_REQUEST %s", GetPlayerInfo().c_str()); Group* group = GetPlayer()->GetGroup(); @@ -248,7 +248,7 @@ void WorldSession::HandleLfgPartyLockInfoRequestOpcode(WorldPacket& /*recvData* if (!plrg) continue; - uint64 pguid = plrg->GetGUID(); + ObjectGuid pguid = plrg->GetGUID(); if (pguid == guid) continue; @@ -287,7 +287,7 @@ void WorldSession::HandleLfgGetStatus(WorldPacket& /*recvData*/) { TC_LOG_DEBUG("lfg", "CMSG_LFG_GET_STATUS %s", GetPlayerInfo().c_str()); - uint64 guid = GetPlayer()->GetGUID(); + ObjectGuid guid = GetPlayer()->GetGUID(); lfg::LfgUpdateData updateData = sLFGMgr->GetLfgStatus(guid); if (GetPlayer()->GetGroup()) @@ -385,10 +385,10 @@ void WorldSession::SendLfgUpdateParty(const lfg::LfgUpdateData& updateData) SendPacket(&data); } -void WorldSession::SendLfgRoleChosen(uint64 guid, uint8 roles) +void WorldSession::SendLfgRoleChosen(ObjectGuid guid, uint8 roles) { TC_LOG_DEBUG("lfg", "SMSG_LFG_ROLE_CHOSEN %s guid: %u roles: %u", - GetPlayerInfo().c_str(), GUID_LOPART(guid), roles); + GetPlayerInfo().c_str(), guid.GetCounter(), roles); WorldPacket data(SMSG_LFG_ROLE_CHOSEN, 8 + 1 + 4); data << uint64(guid); // Guid @@ -419,7 +419,7 @@ void WorldSession::SendLfgRoleCheckUpdate(lfg::LfgRoleCheck const& roleCheck) if (!roleCheck.roles.empty()) { // Leader info MUST be sent 1st :S - uint64 guid = roleCheck.leader; + ObjectGuid guid = roleCheck.leader; uint8 roles = roleCheck.roles.find(guid)->second; data << uint64(guid); // Guid data << uint8(roles > 0); // Ready @@ -520,7 +520,7 @@ void WorldSession::SendLfgPlayerReward(lfg::LfgPlayerRewardData const& rewardDat void WorldSession::SendLfgBootProposalUpdate(lfg::LfgPlayerBoot const& boot) { - uint64 guid = GetPlayer()->GetGUID(); + ObjectGuid guid = GetPlayer()->GetGUID(); lfg::LfgAnswer playerVote = boot.votes.find(guid)->second; uint8 votesNum = 0; uint8 agreeNum = 0; @@ -538,7 +538,7 @@ void WorldSession::SendLfgBootProposalUpdate(lfg::LfgPlayerBoot const& boot) "didVote: %u - agree: %u - victim: %u votes: %u - agrees: %u - left: %u - " "needed: %u - reason %s", GetPlayerInfo().c_str(), uint8(boot.inProgress), uint8(playerVote != lfg::LFG_ANSWER_PENDING), - uint8(playerVote == lfg::LFG_ANSWER_AGREE), GUID_LOPART(boot.victim), votesNum, agreeNum, + uint8(playerVote == lfg::LFG_ANSWER_AGREE), boot.victim.GetCounter(), votesNum, agreeNum, secsleft, lfg::LFG_GROUP_KICK_VOTES_NEEDED, boot.reason.c_str()); WorldPacket data(SMSG_LFG_BOOT_PROPOSAL_UPDATE, 1 + 1 + 1 + 8 + 4 + 4 + 4 + 4 + boot.reason.length()); data << uint8(boot.inProgress); // Vote in progress @@ -555,8 +555,8 @@ void WorldSession::SendLfgBootProposalUpdate(lfg::LfgPlayerBoot const& boot) void WorldSession::SendLfgUpdateProposal(lfg::LfgProposal const& proposal) { - uint64 guid = GetPlayer()->GetGUID(); - uint64 gguid = proposal.players.find(guid)->second.group; + ObjectGuid guid = GetPlayer()->GetGUID(); + ObjectGuid gguid = proposal.players.find(guid)->second.group; bool silent = !proposal.isNew && gguid == proposal.group; uint32 dungeonEntry = proposal.dungeonId; diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp index 8bc9c5dc659..64c01075341 100644 --- a/src/server/game/Handlers/LootHandler.cpp +++ b/src/server/game/Handlers/LootHandler.cpp @@ -35,13 +35,13 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: CMSG_AUTOSTORE_LOOT_ITEM"); Player* player = GetPlayer(); - uint64 lguid = player->GetLootGUID(); + ObjectGuid lguid = player->GetLootGUID(); Loot* loot = NULL; uint8 lootSlot = 0; recvData >> lootSlot; - if (IS_GAMEOBJECT_GUID(lguid)) + if (lguid.IsGameObject()) { GameObject* go = player->GetMap()->GetGameObject(lguid); @@ -54,7 +54,7 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData) loot = &go->loot; } - else if (IS_ITEM_GUID(lguid)) + else if (lguid.IsItem()) { Item* pItem = player->GetItemByGuid(lguid); @@ -66,7 +66,7 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData) loot = &pItem->loot; } - else if (IS_CORPSE_GUID(lguid)) + else if (lguid.IsCorpse()) { Corpse* bones = ObjectAccessor::GetCorpse(*player, lguid); if (!bones) @@ -94,7 +94,7 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData) player->StoreLootItem(lootSlot, loot); // If player is removing the last LootItem, delete the empty container. - if (loot->isLooted() && IS_ITEM_GUID(lguid)) + if (loot->isLooted() && lguid.IsItem()) player->GetSession()->DoLootRelease(lguid); } @@ -103,14 +103,14 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recvData*/) TC_LOG_DEBUG("network", "WORLD: CMSG_LOOT_MONEY"); Player* player = GetPlayer(); - uint64 guid = player->GetLootGUID(); + ObjectGuid guid = player->GetLootGUID(); if (!guid) return; Loot* loot = NULL; bool shareMoney = true; - switch (GUID_HIPART(guid)) + switch (guid.GetHigh()) { case HIGHGUID_GAMEOBJECT: { @@ -211,7 +211,7 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recvData*/) loot->DeleteLootMoneyFromContainerItemDB(); // Delete container if empty - if (loot->isLooted() && IS_ITEM_GUID(guid)) + if (loot->isLooted() && guid.IsItem()) player->GetSession()->DoLootRelease(guid); } } @@ -220,11 +220,11 @@ void WorldSession::HandleLootOpcode(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: CMSG_LOOT"); - uint64 guid; + ObjectGuid guid; recvData >> guid; // Check possible cheat - if (!GetPlayer()->IsAlive() || !IS_CRE_OR_VEH_GUID(guid)) + if (!GetPlayer()->IsAlive() || !guid.IsCreatureOrVehicle()) return; GetPlayer()->SendLoot(guid, LOOT_CORPSE); @@ -240,20 +240,20 @@ void WorldSession::HandleLootReleaseOpcode(WorldPacket& recvData) // cheaters can modify lguid to prevent correct apply loot release code and re-loot // use internal stored guid - uint64 guid; + ObjectGuid guid; recvData >> guid; - if (uint64 lguid = GetPlayer()->GetLootGUID()) + if (ObjectGuid lguid = GetPlayer()->GetLootGUID()) if (lguid == guid) DoLootRelease(lguid); } -void WorldSession::DoLootRelease(uint64 lguid) +void WorldSession::DoLootRelease(ObjectGuid lguid) { Player *player = GetPlayer(); Loot *loot; - player->SetLootGUID(0); + player->SetLootGUID(ObjectGuid::Empty); player->SendLootRelease(lguid); player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_LOOTING); @@ -261,7 +261,7 @@ void WorldSession::DoLootRelease(uint64 lguid) if (!player->IsInWorld()) return; - if (IS_GAMEOBJECT_GUID(lguid)) + if (lguid.IsGameObject()) { GameObject* go = GetPlayer()->GetMap()->GetGameObject(lguid); @@ -298,10 +298,10 @@ void WorldSession::DoLootRelease(uint64 lguid) // if the round robin player release, reset it. if (player->GetGUID() == loot->roundRobinPlayer) - loot->roundRobinPlayer = 0; + loot->roundRobinPlayer.Clear(); } } - else if (IS_CORPSE_GUID(lguid)) // ONLY remove insignia at BG + else if (lguid.IsCorpse()) // ONLY remove insignia at BG { Corpse* corpse = ObjectAccessor::GetCorpse(*player, lguid); if (!corpse || !corpse->IsWithinDistInMap(_player, INTERACTION_DISTANCE)) @@ -315,7 +315,7 @@ void WorldSession::DoLootRelease(uint64 lguid) corpse->RemoveFlag(CORPSE_FIELD_DYNAMIC_FLAGS, CORPSE_DYNFLAG_LOOTABLE); } } - else if (IS_ITEM_GUID(lguid)) + else if (lguid.IsItem()) { Item* pItem = player->GetItemByGuid(lguid); if (!pItem) @@ -369,7 +369,7 @@ void WorldSession::DoLootRelease(uint64 lguid) // if the round robin player release, reset it. if (player->GetGUID() == loot->roundRobinPlayer) { - loot->roundRobinPlayer = 0; + loot->roundRobinPlayer.Clear(); if (Group* group = player->GetGroup()) { @@ -389,7 +389,7 @@ void WorldSession::DoLootRelease(uint64 lguid) void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData) { uint8 slotid; - uint64 lootguid, target_playerguid; + ObjectGuid lootguid, target_playerguid; recvData >> lootguid >> slotid >> target_playerguid; @@ -399,7 +399,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData) return; } - Player* target = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(target_playerguid, 0, HIGHGUID_PLAYER)); + Player* target = ObjectAccessor::FindPlayer(target_playerguid); if (!target) { _player->SendLootError(lootguid, LOOT_ERROR_PLAYER_NOT_FOUND); @@ -423,7 +423,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData) Loot* loot = NULL; - if (IS_CRE_OR_VEH_GUID(GetPlayer()->GetLootGUID())) + if (GetPlayer()->GetLootGUID().IsCreatureOrVehicle()) { Creature* creature = GetPlayer()->GetMap()->GetCreature(lootguid); if (!creature) @@ -431,7 +431,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData) loot = &creature->loot; } - else if (IS_GAMEOBJECT_GUID(GetPlayer()->GetLootGUID())) + else if (GetPlayer()->GetLootGUID().IsGameObject()) { GameObject* pGO = GetPlayer()->GetMap()->GetGameObject(lootguid); if (!pGO) diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp index 1270f4e6419..6ea3ae69786 100644 --- a/src/server/game/Handlers/MailHandler.cpp +++ b/src/server/game/Handlers/MailHandler.cpp @@ -29,7 +29,7 @@ #include "Item.h" #include "AccountMgr.h" -bool WorldSession::CanOpenMailBox(uint64 guid) +bool WorldSession::CanOpenMailBox(ObjectGuid guid) { if (guid == _player->GetGUID()) { @@ -39,12 +39,12 @@ bool WorldSession::CanOpenMailBox(uint64 guid) return false; } } - else if (IS_GAMEOBJECT_GUID(guid)) + else if (guid.IsGameObject()) { if (!_player->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_MAILBOX)) return false; } - else if (IS_CRE_OR_VEH_OR_PET_GUID(guid)) + else if (guid.IsAnyTypeCreature()) { if (!_player->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_MAILBOX)) return false; @@ -57,14 +57,14 @@ bool WorldSession::CanOpenMailBox(uint64 guid) void WorldSession::HandleSendMail(WorldPacket& recvData) { - uint64 mailbox, unk3; + ObjectGuid mailbox, unk3; std::string receiverName, subject, body; - uint32 unk1, unk2, money, COD; + uint32 stationery, package, money, COD; uint8 unk4; uint8 items_count; recvData >> mailbox >> receiverName >> subject >> body - >> unk1 // stationery? - >> unk2 // 0x00000000 + >> stationery // stationery? + >> package // 0x00000000 >> items_count; // attached items count if (items_count > MAX_MAIL_ITEMS) // client limit @@ -74,7 +74,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData) return; } - uint64 itemGUIDs[MAX_MAIL_ITEMS]; + ObjectGuid itemGUIDs[MAX_MAIL_ITEMS]; for (uint8 i = 0; i < items_count; ++i) { @@ -102,7 +102,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData) return; } - uint64 receiverGuid = 0; + ObjectGuid receiverGuid; if (normalizePlayerName(receiverName)) receiverGuid = sObjectMgr->GetPlayerGUIDByName(receiverName); @@ -111,15 +111,15 @@ void WorldSession::HandleSendMail(WorldPacket& recvData) TC_LOG_INFO("network", "Player %u is sending mail to %s (GUID: not existed!) with subject %s " "and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u", player->GetGUIDLow(), receiverName.c_str(), subject.c_str(), body.c_str(), - items_count, money, COD, unk1, unk2); + items_count, money, COD, stationery, package); player->SendMailResult(0, MAIL_SEND, MAIL_ERR_RECIPIENT_NOT_FOUND); return; } - TC_LOG_INFO("network", "Player %u is sending mail to %s (GUID: %u) with subject %s and body %s " + TC_LOG_INFO("network", "Player %u is sending mail to %s (%s) with subject %s and body %s " "includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u", - player->GetGUIDLow(), receiverName.c_str(), GUID_LOPART(receiverGuid), subject.c_str(), - body.c_str(), items_count, money, COD, unk1, unk2); + player->GetGUIDLow(), receiverName.c_str(), receiverGuid.ToString().c_str(), subject.c_str(), + body.c_str(), items_count, money, COD, stationery, package); if (player->GetGUID() == receiverGuid) { @@ -163,7 +163,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData) receiverTeam = sObjectMgr->GetPlayerTeamByGUID(receiverGuid); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_COUNT); - stmt->setUInt32(0, GUID_LOPART(receiverGuid)); + stmt->setUInt32(0, receiverGuid.GetCounter()); PreparedQueryResult result = CharacterDatabase.Query(stmt); if (result) @@ -173,7 +173,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData) } stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_LEVEL); - stmt->setUInt32(0, GUID_LOPART(receiverGuid)); + stmt->setUInt32(0, receiverGuid.GetCounter()); result = CharacterDatabase.Query(stmt); if (result) @@ -293,9 +293,9 @@ void WorldSession::HandleSendMail(WorldPacket& recvData) if (log) { sLog->outCommand(GetAccountId(), "GM %s (GUID: %u) (Account: %u) mail item: %s (Entry: %u Count: %u) " - "to player: %s (GUID: %u) (Account: %u)", GetPlayerName().c_str(), GetGuidLow(), GetAccountId(), + "to: %s (%s) (Account: %u)", GetPlayerName().c_str(), GetGuidLow(), GetAccountId(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount(), - receiverName.c_str(), GUID_LOPART(receiverGuid), receiverAccountId); + receiverName.c_str(), receiverGuid.ToString().c_str(), receiverAccountId); } item->SetNotRefundable(GetPlayer()); // makes the item no longer refundable @@ -314,8 +314,8 @@ void WorldSession::HandleSendMail(WorldPacket& recvData) if (log && money > 0) { - sLog->outCommand(GetAccountId(), "GM %s (GUID: %u) (Account: %u) mail money: %u to player: %s (GUID: %u) (Account: %u)", - GetPlayerName().c_str(), GetGuidLow(), GetAccountId(), money, receiverName.c_str(), GUID_LOPART(receiverGuid), receiverAccountId); + sLog->outCommand(GetAccountId(), "GM %s (GUID: %u) (Account: %u) mail money: %u to: %s (%s) (Account: %u)", + GetPlayerName().c_str(), GetGuidLow(), GetAccountId(), money, receiverName.c_str(), receiverGuid.ToString().c_str(), receiverAccountId); } } @@ -330,7 +330,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData) draft .AddMoney(money) .AddCOD(COD) - .SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), MailSender(player), body.empty() ? MAIL_CHECK_MASK_COPIED : MAIL_CHECK_MASK_HAS_BODY, deliver_delay); + .SendMailTo(trans, MailReceiver(receiver, receiverGuid.GetCounter()), MailSender(player), body.empty() ? MAIL_CHECK_MASK_COPIED : MAIL_CHECK_MASK_HAS_BODY, deliver_delay); player->SaveInventoryAndGoldToDB(trans); CharacterDatabase.CommitTransaction(trans); @@ -339,7 +339,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData) //called when mail is read void WorldSession::HandleMailMarkAsRead(WorldPacket& recvData) { - uint64 mailbox; + ObjectGuid mailbox; uint32 mailId; recvData >> mailbox; recvData >> mailId; @@ -362,7 +362,7 @@ void WorldSession::HandleMailMarkAsRead(WorldPacket& recvData) //called when client deletes mail void WorldSession::HandleMailDelete(WorldPacket& recvData) { - uint64 mailbox; + ObjectGuid mailbox; uint32 mailId; recvData >> mailbox; recvData >> mailId; @@ -390,7 +390,7 @@ void WorldSession::HandleMailDelete(WorldPacket& recvData) void WorldSession::HandleMailReturnToSender(WorldPacket& recvData) { - uint64 mailbox; + ObjectGuid mailbox; uint32 mailId; recvData >> mailbox; recvData >> mailId; @@ -454,7 +454,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket& recvData) //called when player takes item attached in mail void WorldSession::HandleMailTakeItem(WorldPacket& recvData) { - uint64 mailbox; + ObjectGuid mailbox; uint32 mailId; uint32 itemId; recvData >> mailbox; @@ -499,7 +499,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket& recvData) if (m->COD > 0) //if there is COD, take COD money from player and send them to sender by mail { - uint64 sender_guid = MAKE_NEW_GUID(m->sender, 0, HIGHGUID_PLAYER); + ObjectGuid sender_guid(HIGHGUID_PLAYER, m->sender); Player* receiver = ObjectAccessor::FindPlayer(sender_guid); uint32 sender_accId = 0; @@ -557,7 +557,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket& recvData) void WorldSession::HandleMailTakeMoney(WorldPacket& recvData) { - uint64 mailbox; + ObjectGuid mailbox; uint32 mailId; recvData >> mailbox; recvData >> mailId; @@ -596,7 +596,7 @@ void WorldSession::HandleMailTakeMoney(WorldPacket& recvData) //called when player lists his received mails void WorldSession::HandleGetMailList(WorldPacket& recvData) { - uint64 mailbox; + ObjectGuid mailbox; recvData >> mailbox; if (!CanOpenMailBox(mailbox)) @@ -649,7 +649,7 @@ void WorldSession::HandleGetMailList(WorldPacket& recvData) switch ((*itr)->messageType) { case MAIL_NORMAL: // sender guid - data << uint64(MAKE_NEW_GUID((*itr)->sender, 0, HIGHGUID_PLAYER)); + data << ObjectGuid(HIGHGUID_PLAYER, (*itr)->sender); break; case MAIL_CREATURE: case MAIL_GAMEOBJECT: @@ -716,7 +716,7 @@ void WorldSession::HandleGetMailList(WorldPacket& recvData) //used when player copies mail body to his inventory void WorldSession::HandleMailCreateTextItem(WorldPacket& recvData) { - uint64 mailbox; + ObjectGuid mailbox; uint32 mailId; recvData >> mailbox; @@ -756,7 +756,9 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket& recvData) else bodyItem->SetText(m->body); - bodyItem->SetUInt32Value(ITEM_FIELD_CREATOR, m->sender); + if (m->messageType == MAIL_NORMAL) + bodyItem->SetGuidValue(ITEM_FIELD_CREATOR, ObjectGuid(HIGHGUID_PLAYER, m->sender)); + bodyItem->SetFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_MAIL_TEXT_MASK); TC_LOG_INFO("network", "HandleMailCreateTextItem mailid=%u", mailId); @@ -810,7 +812,7 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket & /*recvData*/) if (sentSenders.count(m->sender)) continue; - data << uint64(m->messageType == MAIL_NORMAL ? m->sender : 0); // player guid + data << uint64(m->messageType == MAIL_NORMAL ? ObjectGuid(HIGHGUID_PLAYER, m->sender) : ObjectGuid::Empty); // player guid data << uint32(m->messageType != MAIL_NORMAL ? m->sender : 0); // non-player entries data << uint32(m->messageType); data << uint32(m->stationery); diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index b6c508e9e4c..7f6b6aeb9cc 100644 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -92,7 +92,7 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recvData) uint32 gossipListId; uint32 menuId; - uint64 guid; + ObjectGuid guid; std::string code = ""; recvData >> guid >> menuId >> gossipListId; @@ -112,27 +112,27 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recvData) Creature* unit = NULL; GameObject* go = NULL; - if (IS_CRE_OR_VEH_GUID(guid)) + if (guid.IsCreatureOrVehicle()) { unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE); if (!unit) { - TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - %s not found or you can't interact with him.", guid.ToString().c_str()); return; } } - else if (IS_GAMEOBJECT_GUID(guid)) + else if (guid.IsGameObject()) { go = _player->GetMap()->GetGameObject(guid); if (!go) { - TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - GameObject (GUID: %u) not found.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - %s not found.", guid.ToString().c_str()); return; } } else { - TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - unsupported GUID type for highguid %u. lowpart %u.", uint32(GUID_HIPART(guid)), uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - unsupported %s.", guid.ToString().c_str()); return; } @@ -376,7 +376,7 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket& /*recvData*/) { TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_LOGOUT_REQUEST Message, security - %u", GetSecurity()); - if (uint64 lguid = GetPlayer()->GetLootGUID()) + if (ObjectGuid lguid = GetPlayer()->GetLootGUID()) DoLootRelease(lguid); bool instantLogout = (GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) && !GetPlayer()->IsInCombat()) || @@ -417,7 +417,7 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket& /*recvData*/) GetPlayer()->SetStandState(UNIT_STAND_STATE_SIT); WorldPacket data(SMSG_FORCE_MOVE_ROOT, (8+4)); // guess size - data.append(GetPlayer()->GetPackGUID()); + data << GetPlayer()->GetPackGUID(); data << (uint32)2; SendPacket(&data); GetPlayer()->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); @@ -449,7 +449,7 @@ void WorldSession::HandleLogoutCancelOpcode(WorldPacket& /*recvData*/) { //!we can move again data.Initialize(SMSG_FORCE_MOVE_UNROOT, 8); // guess size - data.append(GetPlayer()->GetPackGUID()); + data << GetPlayer()->GetPackGUID(); data << uint32(0); SendPacket(&data); @@ -509,7 +509,7 @@ void WorldSession::HandleZoneUpdateOpcode(WorldPacket& recvData) void WorldSession::HandleSetSelectionOpcode(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; recvData >> guid; _player->SetSelection(guid); @@ -562,19 +562,18 @@ void WorldSession::HandleAddFriendOpcodeCallBack(PreparedQueryResult result, std if (!GetPlayer()) return; - uint64 friendGuid; + ObjectGuid friendGuid; uint32 friendAccountId; uint32 team; FriendsResult friendResult; friendResult = FRIEND_NOT_FOUND; - friendGuid = 0; if (result) { Field* fields = result->Fetch(); - friendGuid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER); + friendGuid = ObjectGuid(HIGHGUID_PLAYER, 0, fields[0].GetUInt32()); team = Player::TeamForRace(fields[1].GetUInt8()); friendAccountId = fields[2].GetUInt32(); @@ -586,7 +585,7 @@ void WorldSession::HandleAddFriendOpcodeCallBack(PreparedQueryResult result, std friendResult = FRIEND_SELF; else if (GetPlayer()->GetTeam() != team && !HasPermission(rbac::RBAC_PERM_TWO_SIDE_ADD_FRIEND)) friendResult = FRIEND_ENEMY; - else if (GetPlayer()->GetSocial()->HasFriend(GUID_LOPART(friendGuid))) + else if (GetPlayer()->GetSocial()->HasFriend(friendGuid.GetCounter())) friendResult = FRIEND_ALREADY; else { @@ -595,33 +594,33 @@ void WorldSession::HandleAddFriendOpcodeCallBack(PreparedQueryResult result, std friendResult = FRIEND_ADDED_ONLINE; else friendResult = FRIEND_ADDED_OFFLINE; - if (!GetPlayer()->GetSocial()->AddToSocialList(GUID_LOPART(friendGuid), false)) + if (!GetPlayer()->GetSocial()->AddToSocialList(friendGuid.GetCounter(), false)) { friendResult = FRIEND_LIST_FULL; TC_LOG_DEBUG("network", "WORLD: %s's friend list is full.", GetPlayer()->GetName().c_str()); } } - GetPlayer()->GetSocial()->SetFriendNote(GUID_LOPART(friendGuid), friendNote); + GetPlayer()->GetSocial()->SetFriendNote(friendGuid.GetCounter(), friendNote); } } } - sSocialMgr->SendFriendStatus(GetPlayer(), friendResult, GUID_LOPART(friendGuid), false); + sSocialMgr->SendFriendStatus(GetPlayer(), friendResult, friendGuid.GetCounter(), false); TC_LOG_DEBUG("network", "WORLD: Sent (SMSG_FRIEND_STATUS)"); } void WorldSession::HandleDelFriendOpcode(WorldPacket& recvData) { - uint64 FriendGUID; + ObjectGuid FriendGUID; TC_LOG_DEBUG("network", "WORLD: Received CMSG_DEL_FRIEND"); recvData >> FriendGUID; - _player->GetSocial()->RemoveFromSocialList(GUID_LOPART(FriendGUID), false); + _player->GetSocial()->RemoveFromSocialList(FriendGUID.GetCounter(), false); - sSocialMgr->SendFriendStatus(GetPlayer(), FRIEND_REMOVED, GUID_LOPART(FriendGUID), false); + sSocialMgr->SendFriendStatus(GetPlayer(), FRIEND_REMOVED, FriendGUID.GetCounter(), false); TC_LOG_DEBUG("network", "WORLD: Sent motd (SMSG_FRIEND_STATUS)"); } @@ -652,49 +651,48 @@ void WorldSession::HandleAddIgnoreOpcodeCallBack(PreparedQueryResult result) if (!GetPlayer()) return; - uint64 IgnoreGuid; + ObjectGuid IgnoreGuid; FriendsResult ignoreResult; ignoreResult = FRIEND_IGNORE_NOT_FOUND; - IgnoreGuid = 0; if (result) { - IgnoreGuid = MAKE_NEW_GUID((*result)[0].GetUInt32(), 0, HIGHGUID_PLAYER); + IgnoreGuid = ObjectGuid(HIGHGUID_PLAYER, (*result)[0].GetUInt32()); if (IgnoreGuid) { if (IgnoreGuid == GetPlayer()->GetGUID()) //not add yourself ignoreResult = FRIEND_IGNORE_SELF; - else if (GetPlayer()->GetSocial()->HasIgnore(GUID_LOPART(IgnoreGuid))) + else if (GetPlayer()->GetSocial()->HasIgnore(IgnoreGuid.GetCounter())) ignoreResult = FRIEND_IGNORE_ALREADY; else { ignoreResult = FRIEND_IGNORE_ADDED; // ignore list full - if (!GetPlayer()->GetSocial()->AddToSocialList(GUID_LOPART(IgnoreGuid), true)) + if (!GetPlayer()->GetSocial()->AddToSocialList(IgnoreGuid.GetCounter(), true)) ignoreResult = FRIEND_IGNORE_FULL; } } } - sSocialMgr->SendFriendStatus(GetPlayer(), ignoreResult, GUID_LOPART(IgnoreGuid), false); + sSocialMgr->SendFriendStatus(GetPlayer(), ignoreResult, IgnoreGuid.GetCounter(), false); TC_LOG_DEBUG("network", "WORLD: Sent (SMSG_FRIEND_STATUS)"); } void WorldSession::HandleDelIgnoreOpcode(WorldPacket& recvData) { - uint64 IgnoreGUID; + ObjectGuid IgnoreGUID; TC_LOG_DEBUG("network", "WORLD: Received CMSG_DEL_IGNORE"); recvData >> IgnoreGUID; - _player->GetSocial()->RemoveFromSocialList(GUID_LOPART(IgnoreGUID), true); + _player->GetSocial()->RemoveFromSocialList(IgnoreGUID.GetCounter(), true); - sSocialMgr->SendFriendStatus(GetPlayer(), FRIEND_IGNORE_REMOVED, GUID_LOPART(IgnoreGUID), false); + sSocialMgr->SendFriendStatus(GetPlayer(), FRIEND_IGNORE_REMOVED, IgnoreGUID.GetCounter(), false); TC_LOG_DEBUG("network", "WORLD: Sent motd (SMSG_FRIEND_STATUS)"); } @@ -702,10 +700,10 @@ void WorldSession::HandleDelIgnoreOpcode(WorldPacket& recvData) void WorldSession::HandleSetContactNotesOpcode(WorldPacket& recvData) { TC_LOG_DEBUG("network", "CMSG_SET_CONTACT_NOTES"); - uint64 guid; + ObjectGuid guid; std::string note; recvData >> guid >> note; - _player->GetSocial()->SetFriendNote(GUID_LOPART(guid), note); + _player->GetSocial()->SetFriendNote(guid.GetCounter(), note); } void WorldSession::HandleBugOpcode(WorldPacket& recvData) @@ -737,7 +735,7 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: Received CMSG_RECLAIM_CORPSE"); - uint64 guid; + ObjectGuid guid; recvData >> guid; if (_player->IsAlive()) @@ -774,7 +772,7 @@ void WorldSession::HandleResurrectResponseOpcode(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: Received CMSG_RESURRECT_RESPONSE"); - uint64 guid; + ObjectGuid guid; uint8 status; recvData >> guid; recvData >> status; @@ -1026,7 +1024,7 @@ void WorldSession::HandleRequestAccountData(WorldPacket& recvData) dest.resize(destSize); WorldPacket data(SMSG_UPDATE_ACCOUNT_DATA, 8+4+4+4+destSize); - data << uint64(_player ? _player->GetGUID() : 0); // player guid + data << uint64(_player ? _player->GetGUID() : ObjectGuid::Empty); data << uint32(type); // type (0-7) data << uint32(adata->Time); // unix time data << uint32(size); // decompressed length @@ -1062,8 +1060,8 @@ void WorldSession::HandleMoveTimeSkippedOpcode(WorldPacket& recvData) /* WorldSession::Update(getMSTime());*/ TC_LOG_DEBUG("network", "WORLD: Received CMSG_MOVE_TIME_SKIPPED"); - uint64 guid; - recvData.readPackGUID(guid); + ObjectGuid guid; + recvData >> guid.ReadAsPacked(); recvData.read_skip<uint32>(); /* uint64 guid; @@ -1167,7 +1165,7 @@ void WorldSession::HandlePlayedTime(WorldPacket& recvData) void WorldSession::HandleInspectOpcode(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; recvData >> guid; TC_LOG_DEBUG("network", "WORLD: Received CMSG_INSPECT"); @@ -1175,7 +1173,7 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recvData) Player* player = ObjectAccessor::FindPlayer(guid); if (!player) { - TC_LOG_DEBUG("network", "CMSG_INSPECT: No player found from GUID: " UI64FMTD, guid); + TC_LOG_DEBUG("network", "CMSG_INSPECT: No player found from %s", guid.ToString().c_str()); return; } @@ -1186,9 +1184,9 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recvData) return; uint32 talent_points = 0x47; - uint32 guid_size = player->GetPackGUID().wpos(); + uint32 guid_size = player->GetPackGUID().size(); WorldPacket data(SMSG_INSPECT_TALENT, guid_size+4+talent_points); - data.append(player->GetPackGUID()); + data << player->GetPackGUID(); if (sWorld->getBoolConfig(CONFIG_TALENTS_INSPECTING) || _player->IsGameMaster()) player->BuildPlayerTalentsInfoData(&data); @@ -1205,14 +1203,14 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recvData) void WorldSession::HandleInspectHonorStatsOpcode(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; recvData >> guid; Player* player = ObjectAccessor::FindPlayer(guid); if (!player) { - TC_LOG_DEBUG("network", "MSG_INSPECT_HONOR_STATS: No player found from GUID: " UI64FMTD, guid); + TC_LOG_DEBUG("network", "MSG_INSPECT_HONOR_STATS: No player found from %s", guid.ToString().c_str()); return; } @@ -1332,7 +1330,7 @@ void WorldSession::HandleComplainOpcode(WorldPacket& recvData) TC_LOG_DEBUG("network", "WORLD: CMSG_COMPLAIN"); uint8 spam_type; // 0 - mail, 1 - chat - uint64 spammer_guid; + ObjectGuid spammer_guid; uint32 unk1 = 0; uint32 unk2 = 0; uint32 unk3 = 0; @@ -1364,7 +1362,8 @@ void WorldSession::HandleComplainOpcode(WorldPacket& recvData) data << uint8(0); SendPacket(&data); - TC_LOG_DEBUG("network", "REPORT SPAM: type %u, guid %u, unk1 %u, unk2 %u, unk3 %u, unk4 %u, message %s", spam_type, GUID_LOPART(spammer_guid), unk1, unk2, unk3, unk4, description.c_str()); + TC_LOG_DEBUG("network", "REPORT SPAM: type %u, %s, unk1 %u, unk2 %u, unk3 %u, unk4 %u, message %s", + spam_type, spammer_guid.ToString().c_str(), unk1, unk2, unk3, unk4, description.c_str()); } void WorldSession::HandleRealmSplitOpcode(WorldPacket& recvData) @@ -1396,11 +1395,11 @@ void WorldSession::HandleFarSightOpcode(WorldPacket& recvData) if (apply) { - TC_LOG_DEBUG("network", "Added FarSight " UI64FMTD " to player %u", _player->GetUInt64Value(PLAYER_FARSIGHT), _player->GetGUIDLow()); + TC_LOG_DEBUG("network", "Added FarSight %s to player %u", _player->GetGuidValue(PLAYER_FARSIGHT).ToString().c_str(), _player->GetGUIDLow()); if (WorldObject* target = _player->GetViewpoint()) _player->SetSeer(target); else - TC_LOG_ERROR("network", "Player %s (GUID: %u) requests non-existing seer " UI64FMTD, _player->GetName().c_str(), GUID_LOPART(_player->GetGUID()), _player->GetUInt64Value(PLAYER_FARSIGHT)); + TC_LOG_ERROR("network", "Player %s (%s) requests non-existing seer %s", _player->GetName().c_str(), _player->GetGUID().ToString().c_str(), _player->GetGuidValue(PLAYER_FARSIGHT).ToString().c_str()); } else { @@ -1604,8 +1603,8 @@ void WorldSession::HandleMoveSetCanFlyAckOpcode(WorldPacket& recvData) // fly mode on/off TC_LOG_DEBUG("network", "WORLD: CMSG_MOVE_SET_CAN_FLY_ACK"); - uint64 guid; // guid - unused - recvData.readPackGUID(guid); + ObjectGuid guid; // guid - unused + recvData >> guid.ReadAsPacked(); recvData.read_skip<uint32>(); // unk @@ -1640,10 +1639,10 @@ void WorldSession::HandleSetTaxiBenchmarkOpcode(WorldPacket& recvData) void WorldSession::HandleQueryInspectAchievements(WorldPacket& recvData) { - uint64 guid; - recvData.readPackGUID(guid); + ObjectGuid guid; + recvData >> guid.ReadAsPacked(); - TC_LOG_DEBUG("network", "CMSG_QUERY_INSPECT_ACHIEVEMENTS [" UI64FMTD "] Inspected Player [" UI64FMTD "]", _player->GetGUID(), guid); + TC_LOG_DEBUG("network", "CMSG_QUERY_INSPECT_ACHIEVEMENTS [%s] Inspected Player [%s]", _player->GetGUID().ToString().c_str(), guid.ToString().c_str()); Player* player = ObjectAccessor::FindPlayer(guid); if (!player) return; @@ -1688,7 +1687,7 @@ void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket& recvData) Battleground* bg = _player->GetBattleground(); - uint64 guid; + ObjectGuid guid; recvData >> guid; Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); @@ -1711,7 +1710,7 @@ void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket& recvData) Battleground* bg = _player->GetBattleground(); - uint64 guid; + ObjectGuid guid; recvData >> guid; Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); @@ -1772,7 +1771,7 @@ void WorldSession::HandleUpdateMissileTrajectory(WorldPacket& recvPacket) { TC_LOG_DEBUG("network", "WORLD: CMSG_UPDATE_MISSILE_TRAJECTORY"); - uint64 guid; + ObjectGuid guid; uint32 spellId; float elevation, speed; float curX, curY, curZ; diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp index 64d0ae36e7a..68d89310a08 100644 --- a/src/server/game/Handlers/MovementHandler.cpp +++ b/src/server/game/Handlers/MovementHandler.cpp @@ -71,7 +71,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() if (GetPlayer()->IsInWorld()) { - TC_LOG_ERROR("network", "Player %s (GUID: %u) is still in world when teleported from map %s (%u) to new map %s (%u)", GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID()), oldMap->GetMapName(), oldMap->GetId(), newMap ? newMap->GetMapName() : "Unknown", loc.GetMapId()); + TC_LOG_ERROR("network", "%s %s is still in world when teleported from map %s (%u) to new map %s (%u)", GetPlayer()->GetGUID().ToString().c_str(), GetPlayer()->GetName().c_str(), oldMap->GetMapName(), oldMap->GetId(), newMap ? newMap->GetMapName() : "Unknown", loc.GetMapId()); oldMap->RemovePlayerFromMap(GetPlayer(), false); } @@ -198,14 +198,12 @@ void WorldSession::HandleMoveWorldportAckOpcode() void WorldSession::HandleMoveTeleportAck(WorldPacket& recvData) { TC_LOG_DEBUG("network", "MSG_MOVE_TELEPORT_ACK"); - uint64 guid; + ObjectGuid guid; - recvData.readPackGUID(guid); + recvData >> guid.ReadAsPacked(); uint32 flags, time; recvData >> flags >> time; - TC_LOG_DEBUG("network", "Guid " UI64FMTD, guid); - TC_LOG_DEBUG("network", "Flags %u, time %u", flags, time/IN_MILLISECONDS); Player* plMover = _player->m_mover->ToPlayer(); @@ -264,9 +262,9 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData) } /* extract packet */ - uint64 guid; + ObjectGuid guid; - recvData.readPackGUID(guid); + recvData >> guid.ReadAsPacked(); MovementInfo movementInfo; movementInfo.guid = guid; @@ -407,15 +405,12 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData) void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recvData) { - uint32 opcode = recvData.GetOpcode(); - TC_LOG_DEBUG("network", "WORLD: Recvd %s (%u, 0x%X) opcode", LookupOpcodeName(opcode), opcode, opcode); - /* extract packet */ - uint64 guid; + ObjectGuid guid; uint32 unk1; float newspeed; - recvData.readPackGUID(guid); + recvData >> guid.ReadAsPacked(); // now can skip not our packet if (_player->GetGUID() != guid) @@ -442,7 +437,7 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recvData) static char const* move_type_name[MAX_MOVE_TYPE] = { "Walk", "Run", "RunBack", "Swim", "SwimBack", "TurnRate", "Flight", "FlightBack", "PitchRate" }; - switch (opcode) + switch (recvData.GetOpcode()) { case CMSG_FORCE_WALK_SPEED_CHANGE_ACK: move_type = MOVE_WALK; force_move_type = MOVE_WALK; break; case CMSG_FORCE_RUN_SPEED_CHANGE_ACK: move_type = MOVE_RUN; force_move_type = MOVE_RUN; break; @@ -454,7 +449,7 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recvData) case CMSG_FORCE_FLIGHT_BACK_SPEED_CHANGE_ACK: move_type = MOVE_FLIGHT_BACK; force_move_type = MOVE_FLIGHT_BACK; break; case CMSG_FORCE_PITCH_RATE_CHANGE_ACK: move_type = MOVE_PITCH_RATE; force_move_type = MOVE_PITCH_RATE; break; default: - TC_LOG_ERROR("network", "WorldSession::HandleForceSpeedChangeAck: Unknown move type opcode: %u", opcode); + TC_LOG_ERROR("network", "WorldSession::HandleForceSpeedChangeAck: Unknown move type opcode: %u", recvData.GetOpcode()); return; } @@ -488,22 +483,20 @@ void WorldSession::HandleSetActiveMoverOpcode(WorldPacket &recvData) { TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_SET_ACTIVE_MOVER"); - uint64 guid; + ObjectGuid guid; recvData >> guid; if (GetPlayer()->IsInWorld()) - { if (_player->m_mover->GetGUID() != guid) - TC_LOG_DEBUG("network", "HandleSetActiveMoverOpcode: incorrect mover guid: mover is " UI64FMTD " (%s - Entry: %u) and should be " UI64FMTD, guid, GetLogNameForGuid(guid), GUID_ENPART(guid), _player->m_mover->GetGUID()); - } + TC_LOG_DEBUG("network", "HandleSetActiveMoverOpcode: incorrect mover guid: mover is %s and should be %s" , guid.ToString().c_str(), _player->m_mover->GetGUID().ToString().c_str()); } void WorldSession::HandleMoveNotActiveMover(WorldPacket &recvData) { TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_MOVE_NOT_ACTIVE_MOVER"); - uint64 old_mover_guid; - recvData.readPackGUID(old_mover_guid); + ObjectGuid old_mover_guid; + recvData >> old_mover_guid.ReadAsPacked(); MovementInfo mi; ReadMovementInfo(recvData, &mi); @@ -525,8 +518,8 @@ void WorldSession::HandleMoveKnockBackAck(WorldPacket& recvData) { TC_LOG_DEBUG("network", "CMSG_MOVE_KNOCK_BACK_ACK"); - uint64 guid; - recvData.readPackGUID(guid); + ObjectGuid guid; + recvData >> guid.ReadAsPacked(); if (_player->m_mover->GetGUID() != guid) return; @@ -539,7 +532,7 @@ void WorldSession::HandleMoveKnockBackAck(WorldPacket& recvData) _player->m_movementInfo = movementInfo; WorldPacket data(MSG_MOVE_KNOCK_BACK, 66); - data.appendPackGUID(guid); + data << guid.WriteAsPacked(); _player->BuildMovementPacket(&data); // knockback specific info @@ -555,30 +548,30 @@ void WorldSession::HandleMoveHoverAck(WorldPacket& recvData) { TC_LOG_DEBUG("network", "CMSG_MOVE_HOVER_ACK"); - uint64 guid; // guid - unused - recvData.readPackGUID(guid); + ObjectGuid guid; // guid - unused + recvData >> guid.ReadAsPacked(); - recvData.read_skip<uint32>(); // unk + recvData.read_skip<uint32>(); // unk MovementInfo movementInfo; ReadMovementInfo(recvData, &movementInfo); - recvData.read_skip<uint32>(); // unk2 + recvData.read_skip<uint32>(); // unk2 } void WorldSession::HandleMoveWaterWalkAck(WorldPacket& recvData) { TC_LOG_DEBUG("network", "CMSG_MOVE_WATER_WALK_ACK"); - uint64 guid; // guid - unused - recvData.readPackGUID(guid); + ObjectGuid guid; // guid - unused + recvData >> guid.ReadAsPacked(); - recvData.read_skip<uint32>(); // unk + recvData.read_skip<uint32>(); // unk MovementInfo movementInfo; ReadMovementInfo(recvData, &movementInfo); - recvData.read_skip<uint32>(); // unk2 + recvData.read_skip<uint32>(); // unk2 } void WorldSession::HandleSummonResponseOpcode(WorldPacket& recvData) @@ -586,7 +579,7 @@ void WorldSession::HandleSummonResponseOpcode(WorldPacket& recvData) if (!_player->IsAlive() || _player->IsInCombat()) return; - uint64 summoner_guid; + ObjectGuid summoner_guid; bool agree; recvData >> summoner_guid; recvData >> agree; diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp index 1311cda1ef9..d402cdd265e 100644 --- a/src/server/game/Handlers/NPCHandler.cpp +++ b/src/server/game/Handlers/NPCHandler.cpp @@ -50,13 +50,13 @@ enum StableResultCode void WorldSession::HandleTabardVendorActivateOpcode(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; recvData >> guid; Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TABARDDESIGNER); if (!unit) { - TC_LOG_DEBUG("network", "WORLD: HandleTabardVendorActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleTabardVendorActivateOpcode - %s not found or you can not interact with him.", guid.ToString().c_str()); return; } @@ -67,7 +67,7 @@ void WorldSession::HandleTabardVendorActivateOpcode(WorldPacket& recvData) SendTabardVendorActivate(guid); } -void WorldSession::SendTabardVendorActivate(uint64 guid) +void WorldSession::SendTabardVendorActivate(ObjectGuid guid) { WorldPacket data(MSG_TABARDVENDOR_ACTIVATE, 8); data << guid; @@ -76,7 +76,7 @@ void WorldSession::SendTabardVendorActivate(uint64 guid) void WorldSession::HandleBankerActivateOpcode(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; TC_LOG_DEBUG("network", "WORLD: Received CMSG_BANKER_ACTIVATE"); @@ -85,7 +85,7 @@ void WorldSession::HandleBankerActivateOpcode(WorldPacket& recvData) Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_BANKER); if (!unit) { - TC_LOG_DEBUG("network", "WORLD: HandleBankerActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleBankerActivateOpcode - %s not found or you can not interact with him.", guid.ToString().c_str()); return; } @@ -96,7 +96,7 @@ void WorldSession::HandleBankerActivateOpcode(WorldPacket& recvData) SendShowBank(guid); } -void WorldSession::SendShowBank(uint64 guid) +void WorldSession::SendShowBank(ObjectGuid guid) { WorldPacket data(SMSG_SHOW_BANK, 8); data << guid; @@ -104,7 +104,7 @@ void WorldSession::SendShowBank(uint64 guid) SendPacket(&data); } -void WorldSession::SendShowMailBox(uint64 guid) +void WorldSession::SendShowMailBox(ObjectGuid guid) { WorldPacket data(SMSG_SHOW_MAILBOX, 8); data << guid; @@ -113,26 +113,26 @@ void WorldSession::SendShowMailBox(uint64 guid) void WorldSession::HandleTrainerListOpcode(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; recvData >> guid; SendTrainerList(guid); } -void WorldSession::SendTrainerList(uint64 guid) +void WorldSession::SendTrainerList(ObjectGuid guid) { std::string str = GetTrinityString(LANG_NPC_TAINER_HELLO); SendTrainerList(guid, str); } -void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle) +void WorldSession::SendTrainerList(ObjectGuid guid, const std::string& strTitle) { TC_LOG_DEBUG("network", "WORLD: SendTrainerList"); Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER); if (!unit) { - TC_LOG_DEBUG("network", "WORLD: SendTrainerList - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: SendTrainerList - %s not found or you can not interact with him.", guid.ToString().c_str()); return; } @@ -140,19 +140,10 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle) if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); - CreatureTemplate const* ci = unit->GetCreatureTemplate(); - - if (!ci) - { - TC_LOG_DEBUG("network", "WORLD: SendTrainerList - (GUID: %u) NO CREATUREINFO!", GUID_LOPART(guid)); - return; - } - TrainerSpellData const* trainer_spells = unit->GetTrainerSpells(); if (!trainer_spells) { - TC_LOG_DEBUG("network", "WORLD: SendTrainerList - Training spells not found for creature (GUID: %u Entry: %u)", - GUID_LOPART(guid), unit->GetEntry()); + TC_LOG_DEBUG("network", "WORLD: SendTrainerList - Training spells not found for %s", guid.ToString().c_str()); return; } @@ -241,16 +232,16 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle) void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; uint32 spellId = 0; recvData >> guid >> spellId; - TC_LOG_DEBUG("network", "WORLD: Received CMSG_TRAINER_BUY_SPELL NpcGUID=%u, learn spell id is: %u", uint32(GUID_LOPART(guid)), spellId); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_TRAINER_BUY_SPELL %s, learn spell id is: %u", guid.ToString().c_str(), spellId); Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER); if (!unit) { - TC_LOG_DEBUG("network", "WORLD: HandleTrainerBuySpellOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleTrainerBuySpellOpcode - %s not found or you can not interact with him.", guid.ToString().c_str()); return; } @@ -300,13 +291,13 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: Received CMSG_GOSSIP_HELLO"); - uint64 guid; + ObjectGuid guid; recvData >> guid; Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE); if (!unit) { - TC_LOG_DEBUG("network", "WORLD: HandleGossipHelloOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleGossipHelloOpcode - %s not found or you can not interact with him.", guid.ToString().c_str()); return; } @@ -390,13 +381,13 @@ void WorldSession::HandleSpiritHealerActivateOpcode(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: CMSG_SPIRIT_HEALER_ACTIVATE"); - uint64 guid; + ObjectGuid guid; recvData >> guid; Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_SPIRITHEALER); if (!unit) { - TC_LOG_DEBUG("network", "WORLD: HandleSpiritHealerActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleSpiritHealerActivateOpcode - %s not found or you can not interact with him.", guid.ToString().c_str()); return; } @@ -441,7 +432,7 @@ void WorldSession::SendSpiritResurrect() void WorldSession::HandleBinderActivateOpcode(WorldPacket& recvData) { - uint64 npcGUID; + ObjectGuid npcGUID; recvData >> npcGUID; if (!GetPlayer()->IsInWorld() || !GetPlayer()->IsAlive()) @@ -450,7 +441,7 @@ void WorldSession::HandleBinderActivateOpcode(WorldPacket& recvData) Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_INNKEEPER); if (!unit) { - TC_LOG_DEBUG("network", "WORLD: HandleBinderActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(npcGUID))); + TC_LOG_DEBUG("network", "WORLD: HandleBinderActivateOpcode - %s not found or you can not interact with him.", npcGUID.ToString().c_str()); return; } @@ -483,7 +474,7 @@ void WorldSession::SendBindPoint(Creature* npc) void WorldSession::HandleListStabledPetsOpcode(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: Recv MSG_LIST_STABLED_PETS"); - uint64 npcGUID; + ObjectGuid npcGUID; recvData >> npcGUID; @@ -501,7 +492,7 @@ void WorldSession::HandleListStabledPetsOpcode(WorldPacket& recvData) SendStablePet(npcGUID); } -void WorldSession::SendStablePet(uint64 guid) +void WorldSession::SendStablePet(ObjectGuid guid) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_SLOTS_DETAIL); @@ -513,7 +504,7 @@ void WorldSession::SendStablePet(uint64 guid) _sendStabledPetCallback.SetFutureResult(CharacterDatabase.AsyncQuery(stmt)); } -void WorldSession::SendStablePetCallback(PreparedQueryResult result, uint64 guid) +void WorldSession::SendStablePetCallback(PreparedQueryResult result, ObjectGuid guid) { if (!GetPlayer()) return; @@ -522,7 +513,7 @@ void WorldSession::SendStablePetCallback(PreparedQueryResult result, uint64 guid WorldPacket data(MSG_LIST_STABLED_PETS, 200); // guess size - data << uint64 (guid); + data << uint64(guid); Pet* pet = _player->GetPet(); @@ -576,7 +567,7 @@ void WorldSession::SendStableResult(uint8 res) void WorldSession::HandleStablePet(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: Recv CMSG_STABLE_PET"); - uint64 npcGUID; + ObjectGuid npcGUID; recvData >> npcGUID; @@ -651,7 +642,7 @@ void WorldSession::HandleStablePetCallback(PreparedQueryResult result) void WorldSession::HandleUnstablePet(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: Recv CMSG_UNSTABLE_PET."); - uint64 npcGUID; + ObjectGuid npcGUID; uint32 petnumber; recvData >> npcGUID >> petnumber; @@ -732,7 +723,7 @@ void WorldSession::HandleUnstablePetCallback(PreparedQueryResult result, uint32 void WorldSession::HandleBuyStableSlot(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: Recv CMSG_BUY_STABLE_SLOT."); - uint64 npcGUID; + ObjectGuid npcGUID; recvData >> npcGUID; @@ -770,7 +761,7 @@ void WorldSession::HandleStableRevivePet(WorldPacket &/* recvData */) void WorldSession::HandleStableSwapPet(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: Recv CMSG_STABLE_SWAP_PET."); - uint64 npcGUID; + ObjectGuid npcGUID; uint32 petId; recvData >> npcGUID >> petId; @@ -863,7 +854,7 @@ void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: CMSG_REPAIR_ITEM"); - uint64 npcGUID, itemGUID; + ObjectGuid npcGUID, itemGUID; uint8 guildBank; // new in 2.3.2, bool that means from guild bank money recvData >> npcGUID >> itemGUID >> guildBank; @@ -871,7 +862,7 @@ void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData) Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_REPAIR); if (!unit) { - TC_LOG_DEBUG("network", "WORLD: HandleRepairItemOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(npcGUID))); + TC_LOG_DEBUG("network", "WORLD: HandleRepairItemOpcode - %s not found or you can not interact with him.", npcGUID.ToString().c_str()); return; } @@ -884,7 +875,7 @@ void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData) if (itemGUID) { - TC_LOG_DEBUG("network", "ITEM: Repair item, itemGUID = %u, npcGUID = %u", GUID_LOPART(itemGUID), GUID_LOPART(npcGUID)); + TC_LOG_DEBUG("network", "ITEM: Repair %s, at %s", itemGUID.ToString().c_str(), npcGUID.ToString().c_str()); Item* item = _player->GetItemByGuid(itemGUID); if (item) @@ -892,7 +883,7 @@ void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData) } else { - TC_LOG_DEBUG("network", "ITEM: Repair all items, npcGUID = %u", GUID_LOPART(npcGUID)); + TC_LOG_DEBUG("network", "ITEM: Repair all items at %s", npcGUID.ToString().c_str()); _player->DurabilityRepairAll(true, discountMod, guildBank != 0); } } diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp index 9346e982bd2..cb58d8968e8 100644 --- a/src/server/game/Handlers/PetHandler.cpp +++ b/src/server/game/Handlers/PetHandler.cpp @@ -35,17 +35,17 @@ void WorldSession::HandleDismissCritter(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; recvData >> guid; - TC_LOG_DEBUG("network", "WORLD: Received CMSG_DISMISS_CRITTER for GUID " UI64FMTD, guid); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_DISMISS_CRITTER for %s", guid.ToString().c_str()); Unit* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid); if (!pet) { - TC_LOG_DEBUG("network", "Vanitypet (guid: %u) does not exist - player '%s' (guid: %u / account: %u) attempted to dismiss it (possibly lagged out)", - uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow(), GetAccountId()); + TC_LOG_DEBUG("network", "Vanitypet (%s) does not exist - player '%s' (guid: %u / account: %u) attempted to dismiss it (possibly lagged out)", + guid.ToString().c_str(), GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow(), GetAccountId()); return; } @@ -58,9 +58,9 @@ void WorldSession::HandleDismissCritter(WorldPacket& recvData) void WorldSession::HandlePetAction(WorldPacket& recvData) { - uint64 guid1; + ObjectGuid guid1; uint32 data; - uint64 guid2; + ObjectGuid guid2; recvData >> guid1; //pet guid recvData >> data; recvData >> guid2; //tag guid @@ -69,18 +69,18 @@ void WorldSession::HandlePetAction(WorldPacket& recvData) uint8 flag = UNIT_ACTION_BUTTON_TYPE(data); //delete = 0x07 CastSpell = C1 // used also for charmed creature - Unit* pet= ObjectAccessor::GetUnit(*_player, guid1); - TC_LOG_INFO("network", "HandlePetAction: Pet %u - flag: %u, spellid: %u, target: %u.", uint32(GUID_LOPART(guid1)), uint32(flag), spellid, uint32(GUID_LOPART(guid2))); + Unit* pet = ObjectAccessor::GetUnit(*_player, guid1); + TC_LOG_INFO("network", "HandlePetAction: %s - flag: %u, spellid: %u, target: %s.", guid1.ToString().c_str(), uint32(flag), spellid, guid2.ToString().c_str()); if (!pet) { - TC_LOG_DEBUG("network", "HandlePetAction: Pet (GUID: %u) doesn't exist for player %s (GUID: %u)", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID())); + TC_LOG_DEBUG("network", "HandlePetAction: %s doesn't exist for %s %s", guid1.ToString().c_str(), GetPlayer()->GetGUID().ToString().c_str(), GetPlayer()->GetName().c_str()); return; } if (pet != GetPlayer()->GetFirstControlled()) { - TC_LOG_DEBUG("network", "HandlePetAction: Pet (GUID: %u) does not belong to player %s (GUID: %u)", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID())); + TC_LOG_DEBUG("network", "HandlePetAction: %s does not belong to %s %s", guid1.ToString().c_str(), GetPlayer()->GetGUID().ToString().c_str(), GetPlayer()->GetName().c_str()); return; } @@ -113,23 +113,23 @@ void WorldSession::HandlePetAction(WorldPacket& recvData) void WorldSession::HandlePetStopAttack(WorldPacket &recvData) { - uint64 guid; + ObjectGuid guid; recvData >> guid; - TC_LOG_DEBUG("network", "WORLD: Received CMSG_PET_STOP_ATTACK for GUID " UI64FMTD "", guid); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_PET_STOP_ATTACK for %s", guid.ToString().c_str()); Unit* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid); if (!pet) { - TC_LOG_ERROR("network", "HandlePetStopAttack: Pet %u does not exist", uint32(GUID_LOPART(guid))); + TC_LOG_ERROR("network", "HandlePetStopAttack: %s does not exist", guid.ToString().c_str()); return; } if (pet != GetPlayer()->GetPet() && pet != GetPlayer()->GetCharm()) { - TC_LOG_ERROR("network", "HandlePetStopAttack: Pet GUID %u isn't a pet or charmed creature of player %s", - uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str()); + TC_LOG_ERROR("network", "HandlePetStopAttack: %s isn't a pet or charmed creature of player %s", + guid.ToString().c_str(), GetPlayer()->GetName().c_str()); return; } @@ -139,13 +139,13 @@ void WorldSession::HandlePetStopAttack(WorldPacket &recvData) pet->AttackStop(); } -void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint32 spellid, uint16 flag, uint64 guid2) +void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spellid, uint16 flag, ObjectGuid guid2) { CharmInfo* charmInfo = pet->GetCharmInfo(); if (!charmInfo) { - TC_LOG_DEBUG("network", "WorldSession::HandlePetAction(petGuid: " UI64FMTD ", tagGuid: " UI64FMTD ", spellId: %u, flag: %u): object (GUID: %u Entry: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", - guid1, guid2, spellid, flag, pet->GetGUIDLow(), pet->GetEntry(), pet->GetTypeId()); + TC_LOG_DEBUG("network", "WorldSession::HandlePetAction(petGuid: %s, tagGuid: %s, spellId: %u, flag: %u): object (GUID: %u Entry: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", + guid1.ToString().c_str(), guid2.ToString().c_str(), spellid, flag, pet->GetGUIDLow(), pet->GetEntry(), pet->GetTypeId()); return; } @@ -401,7 +401,7 @@ void WorldSession::HandlePetNameQuery(WorldPacket& recvData) TC_LOG_INFO("network", "HandlePetNameQuery. CMSG_PET_NAME_QUERY"); uint32 petnumber; - uint64 petguid; + ObjectGuid petguid; recvData >> petnumber; recvData >> petguid; @@ -409,7 +409,7 @@ void WorldSession::HandlePetNameQuery(WorldPacket& recvData) SendPetNameQuery(petguid, petnumber); } -void WorldSession::SendPetNameQuery(uint64 petguid, uint32 petnumber) +void WorldSession::SendPetNameQuery(ObjectGuid petguid, uint32 petnumber) { Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, petguid); if (!pet) @@ -440,14 +440,14 @@ void WorldSession::SendPetNameQuery(uint64 petguid, uint32 petnumber) _player->GetSession()->SendPacket(&data); } -bool WorldSession::CheckStableMaster(uint64 guid) +bool WorldSession::CheckStableMaster(ObjectGuid guid) { // spell case or GM if (guid == GetPlayer()->GetGUID()) { if (!GetPlayer()->IsGameMaster() && !GetPlayer()->HasAuraType(SPELL_AURA_OPEN_STABLE)) { - TC_LOG_DEBUG("network", "Player (GUID:%u) attempt open stable in cheating way.", GUID_LOPART(guid)); + TC_LOG_DEBUG("network", "%s attempt open stable in cheating way.", guid.ToString().c_str()); return false; } } @@ -456,7 +456,7 @@ bool WorldSession::CheckStableMaster(uint64 guid) { if (!GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_STABLEMASTER)) { - TC_LOG_DEBUG("network", "Stablemaster (GUID:%u) not found or you can't interact with him.", GUID_LOPART(guid)); + TC_LOG_DEBUG("network", "Stablemaster %s not found or you can't interact with him.", guid.ToString().c_str()); return false; } } @@ -467,7 +467,7 @@ void WorldSession::HandlePetSetAction(WorldPacket& recvData) { TC_LOG_INFO("network", "HandlePetSetAction. CMSG_PET_SET_ACTION"); - uint64 petguid; + ObjectGuid petguid; uint8 count; recvData >> petguid; @@ -476,7 +476,7 @@ void WorldSession::HandlePetSetAction(WorldPacket& recvData) if (!pet || pet != _player->GetFirstControlled()) { - TC_LOG_ERROR("network", "HandlePetSetAction: Unknown pet (GUID: %u) or pet owner (GUID: %u)", GUID_LOPART(petguid), _player->GetGUIDLow()); + TC_LOG_ERROR("network", "HandlePetSetAction: Unknown %s or owner (%s)", petguid.ToString().c_str(), _player->GetGUID().ToString().c_str()); return; } @@ -584,7 +584,7 @@ void WorldSession::HandlePetRename(WorldPacket& recvData) { TC_LOG_INFO("network", "HandlePetRename. CMSG_PET_RENAME"); - uint64 petguid; + ObjectGuid petguid; uint8 isdeclined; std::string name; @@ -650,7 +650,7 @@ void WorldSession::HandlePetRename(WorldPacket& recvData) stmt->setUInt32(0, _player->GetGUIDLow()); for (uint8 i = 0; i < 5; i++) - stmt->setString(i+1, declinedname.name[i]); + stmt->setString(i + 1, declinedname.name[i]); trans->Append(stmt); } @@ -668,9 +668,9 @@ void WorldSession::HandlePetRename(WorldPacket& recvData) void WorldSession::HandlePetAbandon(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; recvData >> guid; //pet guid - TC_LOG_INFO("network", "HandlePetAbandon. CMSG_PET_ABANDON pet guid is %u", GUID_LOPART(guid)); + TC_LOG_INFO("network", "HandlePetAbandon. CMSG_PET_ABANDON %s", guid.ToString().c_str()); if (!_player->IsInWorld()) return; @@ -697,7 +697,7 @@ void WorldSession::HandlePetAbandon(WorldPacket& recvData) void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket) { TC_LOG_INFO("network", "CMSG_PET_SPELL_AUTOCAST"); - uint64 guid; + ObjectGuid guid; uint32 spellid; uint8 state; //1 for on, 0 for off recvPacket >> guid >> spellid >> state; @@ -712,7 +712,7 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket) if (!pet || (pet != _player->GetGuardianPet() && pet != _player->GetCharm())) { - TC_LOG_ERROR("network", "HandlePetSpellAutocastOpcode.Pet %u isn't pet of player %s (GUID: %u).", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID())); + TC_LOG_ERROR("network", "HandlePetSpellAutocastOpcode. %s isn't pet of player %s (%s).", guid.ToString().c_str(), GetPlayer()->GetName().c_str(), GetPlayer()->GetGUID().ToString().c_str()); return; } @@ -746,14 +746,14 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket) { TC_LOG_DEBUG("network", "WORLD: CMSG_PET_CAST_SPELL"); - uint64 guid; + ObjectGuid guid; uint8 castCount; uint32 spellId; uint8 castFlags; recvPacket >> guid >> castCount >> spellId >> castFlags; - TC_LOG_DEBUG("network", "WORLD: CMSG_PET_CAST_SPELL, guid: " UI64FMTD ", castCount: %u, spellId %u, castFlags %u", guid, castCount, spellId, castFlags); + TC_LOG_DEBUG("network", "WORLD: CMSG_PET_CAST_SPELL, %s, castCount: %u, spellId %u, castFlags %u", guid.ToString().c_str(), castCount, spellId, castFlags); // This opcode is also sent from charmed and possessed units (players and creatures) if (!_player->GetGuardianPet() && !_player->GetCharm()) @@ -763,7 +763,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket) if (!caster || (caster != _player->GetGuardianPet() && caster != _player->GetCharm())) { - TC_LOG_ERROR("network", "HandlePetCastSpellOpcode: Pet %u isn't pet of player %s (GUID: %u).", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID())); + TC_LOG_ERROR("network", "HandlePetCastSpellOpcode: %s isn't pet of player %s (%s).", guid.ToString().c_str(), GetPlayer()->GetName().c_str(), GetPlayer()->GetGUID().ToString().c_str()); return; } @@ -848,7 +848,7 @@ void WorldSession::HandlePetLearnTalent(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: CMSG_PET_LEARN_TALENT"); - uint64 guid; + ObjectGuid guid; uint32 talentId, requestedRank; recvData >> guid >> talentId >> requestedRank; @@ -860,7 +860,7 @@ void WorldSession::HandleLearnPreviewTalentsPet(WorldPacket& recvData) { TC_LOG_DEBUG("network", "CMSG_LEARN_PREVIEW_TALENTS_PET"); - uint64 guid; + ObjectGuid guid; recvData >> guid; uint32 talentsCount; diff --git a/src/server/game/Handlers/PetitionsHandler.cpp b/src/server/game/Handlers/PetitionsHandler.cpp index d02b8986e08..d8063c707d0 100644 --- a/src/server/game/Handlers/PetitionsHandler.cpp +++ b/src/server/game/Handlers/PetitionsHandler.cpp @@ -54,7 +54,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData) { TC_LOG_DEBUG("network", "Received opcode CMSG_PETITION_BUY"); - uint64 guidNPC; + ObjectGuid guidNPC; uint32 clientIndex; // 1 for guild and arenaslot+1 for arenas in client std::string name; @@ -81,13 +81,13 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData) recvData >> clientIndex; // index recvData.read_skip<uint32>(); // 0 - TC_LOG_DEBUG("network", "Petitioner with GUID %u tried sell petition: name %s", GUID_LOPART(guidNPC), name.c_str()); + TC_LOG_DEBUG("network", "Petitioner %s tried sell petition: name %s", guidNPC.ToString().c_str(), name.c_str()); // prevent cheating Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guidNPC, UNIT_NPC_FLAG_PETITIONER); if (!creature) { - TC_LOG_DEBUG("network", "WORLD: HandlePetitionBuyOpcode - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(guidNPC)); + TC_LOG_DEBUG("network", "WORLD: HandlePetitionBuyOpcode - %s not found or you can't interact with him.", guidNPC.ToString().c_str()); return; } @@ -250,11 +250,10 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recvData) TC_LOG_DEBUG("network", "Received opcode CMSG_PETITION_SHOW_SIGNATURES"); uint8 signs = 0; - uint64 petitionguid; + ObjectGuid petitionguid; recvData >> petitionguid; // petition guid - // solve (possible) some strange compile problems with explicit use GUID_LOPART(petitionguid) at some GCC versions (wrong code optimization in compiler?) - uint32 petitionGuidLow = GUID_LOPART(petitionguid); + uint32 petitionGuidLow = petitionguid.GetCounter(); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_TYPE); @@ -264,7 +263,7 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recvData) if (!result) { - TC_LOG_DEBUG("entities.player.items", "Petition %u is not found for player %u %s", GUID_LOPART(petitionguid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName().c_str()); + TC_LOG_DEBUG("entities.player.items", "Petition %u is not found for player %u %s", petitionguid.GetCounter(), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName().c_str()); return; } Field* fields = result->Fetch(); @@ -297,7 +296,7 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recvData) Field* fields2 = result->Fetch(); uint32 lowGuid = fields2[0].GetUInt32(); - data << uint64(MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER)); // Player GUID + data << ObjectGuid(HIGHGUID_PLAYER, 0, lowGuid); // Player GUID data << uint32(0); // there 0 ... result->NextRow(); @@ -310,41 +309,41 @@ void WorldSession::HandlePetitionQueryOpcode(WorldPacket& recvData) TC_LOG_DEBUG("network", "Received opcode CMSG_PETITION_QUERY"); // ok uint32 guildguid; - uint64 petitionguid; + ObjectGuid petitionguid; recvData >> guildguid; // in Trinity always same as GUID_LOPART(petitionguid) recvData >> petitionguid; // petition guid - TC_LOG_DEBUG("network", "CMSG_PETITION_QUERY Petition GUID %u Guild GUID %u", GUID_LOPART(petitionguid), guildguid); + TC_LOG_DEBUG("network", "CMSG_PETITION_QUERY Petition %s Guild GUID %u", petitionguid.ToString().c_str(), guildguid); SendPetitionQueryOpcode(petitionguid); } -void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid) +void WorldSession::SendPetitionQueryOpcode(ObjectGuid petitionguid) { - uint64 ownerguid = 0; + ObjectGuid ownerguid; uint32 type; std::string name = "NO_NAME_FOR_GUID"; PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION); - stmt->setUInt32(0, GUID_LOPART(petitionguid)); + stmt->setUInt32(0, petitionguid.GetCounter()); PreparedQueryResult result = CharacterDatabase.Query(stmt); if (result) { Field* fields = result->Fetch(); - ownerguid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER); + ownerguid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32()); name = fields[1].GetString(); type = fields[2].GetUInt8(); } else { - TC_LOG_DEBUG("network", "CMSG_PETITION_QUERY failed for petition (GUID: %u)", GUID_LOPART(petitionguid)); + TC_LOG_DEBUG("network", "CMSG_PETITION_QUERY failed for petition (%s)", petitionguid.ToString().c_str()); return; } WorldPacket data(SMSG_PETITION_QUERY_RESPONSE, (4+8+name.size()+1+1+4*12+2+10)); - data << uint32(GUID_LOPART(petitionguid)); // guild/team guid (in Trinity always same as GUID_LOPART(petition guid) + data << uint32(petitionguid.GetCounter()); // guild/team guid (in Trinity always same as GUID_LOPART(petition guid) data << uint64(ownerguid); // charter owner guid data << name; // name (guild/arena team) data << uint8(0); // some string @@ -384,7 +383,7 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket& recvData) { TC_LOG_DEBUG("network", "Received opcode MSG_PETITION_RENAME"); // ok - uint64 petitionGuid; + ObjectGuid petitionGuid; uint32 type; std::string newName; @@ -397,7 +396,7 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket& recvData) PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_TYPE); - stmt->setUInt32(0, GUID_LOPART(petitionGuid)); + stmt->setUInt32(0, petitionGuid.GetCounter()); PreparedQueryResult result = CharacterDatabase.Query(stmt); @@ -408,7 +407,7 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket& recvData) } else { - TC_LOG_DEBUG("network", "CMSG_PETITION_QUERY failed for petition (GUID: %u)", GUID_LOPART(petitionGuid)); + TC_LOG_DEBUG("network", "CMSG_PETITION_QUERY failed for petition %s", petitionGuid.ToString().c_str()); return; } @@ -442,11 +441,11 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket& recvData) stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_PETITION_NAME); stmt->setString(0, newName); - stmt->setUInt32(1, GUID_LOPART(petitionGuid)); + stmt->setUInt32(1, petitionGuid.GetCounter()); CharacterDatabase.Execute(stmt); - TC_LOG_DEBUG("network", "Petition (GUID: %u) renamed to '%s'", GUID_LOPART(petitionGuid), newName.c_str()); + TC_LOG_DEBUG("network", "Petition %s renamed to '%s'", petitionGuid.ToString().c_str(), newName.c_str()); WorldPacket data(MSG_PETITION_RENAME, (8+newName.size()+1)); data << uint64(petitionGuid); data << newName; @@ -458,31 +457,31 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData) TC_LOG_DEBUG("network", "Received opcode CMSG_PETITION_SIGN"); // ok Field* fields; - uint64 petitionGuid; + ObjectGuid petitionGuid; uint8 unk; recvData >> petitionGuid; // petition guid recvData >> unk; PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_SIGNATURES); - stmt->setUInt32(0, GUID_LOPART(petitionGuid)); - stmt->setUInt32(1, GUID_LOPART(petitionGuid)); + stmt->setUInt32(0, petitionGuid.GetCounter()); + stmt->setUInt32(1, petitionGuid.GetCounter()); PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) { - TC_LOG_ERROR("network", "Petition %u is not found for player %u %s", GUID_LOPART(petitionGuid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName().c_str()); + TC_LOG_ERROR("network", "Petition %s is not found for player %u %s", petitionGuid.ToString().c_str(), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName().c_str()); return; } fields = result->Fetch(); - uint64 ownerGuid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER); + ObjectGuid ownerGuid(HIGHGUID_PLAYER, fields[0].GetUInt32()); uint64 signs = fields[1].GetUInt64(); uint8 type = fields[2].GetUInt8(); uint32 playerGuid = _player->GetGUIDLow(); - if (GUID_LOPART(ownerGuid) == playerGuid) + if (ownerGuid == _player->GetGUID()) return; // not let enemies sign guild charter @@ -541,7 +540,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData) stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_SIG_BY_ACCOUNT); stmt->setUInt32(0, GetAccountId()); - stmt->setUInt32(1, GUID_LOPART(petitionGuid)); + stmt->setUInt32(1, petitionGuid.GetCounter()); result = CharacterDatabase.Query(stmt); @@ -563,14 +562,14 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData) stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PETITION_SIGNATURE); - stmt->setUInt32(0, GUID_LOPART(ownerGuid)); - stmt->setUInt32(1, GUID_LOPART(petitionGuid)); + stmt->setUInt32(0, ownerGuid.GetCounter()); + stmt->setUInt32(1, petitionGuid.GetCounter()); stmt->setUInt32(2, playerGuid); stmt->setUInt32(3, GetAccountId()); CharacterDatabase.Execute(stmt); - TC_LOG_DEBUG("network", "PETITION SIGN: GUID %u by player: %s (GUID: %u Account: %u)", GUID_LOPART(petitionGuid), _player->GetName().c_str(), playerGuid, GetAccountId()); + TC_LOG_DEBUG("network", "PETITION SIGN: %s by player: %s (GUID: %u Account: %u)", petitionGuid.ToString().c_str(), _player->GetName().c_str(), playerGuid, GetAccountId()); WorldPacket data(SMSG_PETITION_SIGN_RESULTS, (8+8+4)); data << uint64(petitionGuid); @@ -594,14 +593,13 @@ void WorldSession::HandlePetitionDeclineOpcode(WorldPacket& recvData) { TC_LOG_DEBUG("network", "Received opcode MSG_PETITION_DECLINE"); // ok - uint64 petitionguid; - uint64 ownerguid; + ObjectGuid petitionguid; recvData >> petitionguid; // petition guid - TC_LOG_DEBUG("network", "Petition %u declined by %u", GUID_LOPART(petitionguid), _player->GetGUIDLow()); + TC_LOG_DEBUG("network", "Petition %s declined by %u", petitionguid.ToString().c_str(), _player->GetGUIDLow()); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_OWNER_BY_GUID); - stmt->setUInt32(0, GUID_LOPART(petitionguid)); + stmt->setUInt32(0, petitionguid.GetCounter()); PreparedQueryResult result = CharacterDatabase.Query(stmt); @@ -609,7 +607,7 @@ void WorldSession::HandlePetitionDeclineOpcode(WorldPacket& recvData) return; Field* fields = result->Fetch(); - ownerguid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER); + ObjectGuid ownerguid(HIGHGUID_PLAYER, 0, fields[0].GetUInt32()); Player* owner = ObjectAccessor::FindPlayer(ownerguid); if (owner) // petition owner online @@ -625,7 +623,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recvData) TC_LOG_DEBUG("network", "Received opcode CMSG_OFFER_PETITION"); // ok uint8 signs = 0; - uint64 petitionguid, plguid; + ObjectGuid petitionguid, plguid; uint32 type, junk; Player* player; recvData >> junk; // this is not petition type! @@ -638,7 +636,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recvData) PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_TYPE); - stmt->setUInt32(0, GUID_LOPART(petitionguid)); + stmt->setUInt32(0, petitionguid.GetCounter()); PreparedQueryResult result = CharacterDatabase.Query(stmt); @@ -648,7 +646,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recvData) Field* fields = result->Fetch(); type = fields[0].GetUInt8(); - TC_LOG_DEBUG("network", "OFFER PETITION: type %u, GUID1 %u, to player id: %u", type, GUID_LOPART(petitionguid), GUID_LOPART(plguid)); + TC_LOG_DEBUG("network", "OFFER PETITION: type %u, %s, to %s", type, petitionguid.ToString().c_str(), plguid.ToString().c_str()); if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && GetPlayer()->GetTeam() != player->GetTeam()) { @@ -703,7 +701,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recvData) stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_SIGNATURE); - stmt->setUInt32(0, GUID_LOPART(petitionguid)); + stmt->setUInt32(0, petitionguid.GetCounter()); result = CharacterDatabase.Query(stmt); @@ -714,13 +712,13 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recvData) WorldPacket data(SMSG_PETITION_SHOW_SIGNATURES, (8+8+4+signs+signs*12)); data << uint64(petitionguid); // petition guid data << uint64(_player->GetGUID()); // owner guid - data << uint32(GUID_LOPART(petitionguid)); // guild guid + data << uint32(petitionguid.GetCounter()); // guild guid data << uint8(signs); // sign's count for (uint8 i = 1; i <= signs; ++i) { Field* fields2 = result->Fetch(); - data << uint64(MAKE_NEW_GUID(fields2[0].GetUInt32(), 0, HIGHGUID_PLAYER)); // Player GUID + data << uint64(ObjectGuid(HIGHGUID_PLAYER, fields2[0].GetUInt32())); // Player GUID data << uint32(0); // there 0 ... result->NextRow(); @@ -735,7 +733,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData) // Get petition guid from packet WorldPacket data; - uint64 petitionGuid; + ObjectGuid petitionGuid; recvData >> petitionGuid; @@ -744,7 +742,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData) if (!item) return; - TC_LOG_DEBUG("network", "Petition %u turned in by %u", GUID_LOPART(petitionGuid), _player->GetGUIDLow()); + TC_LOG_DEBUG("network", "Petition %s turned in by %u", petitionGuid.ToString().c_str(), _player->GetGUIDLow()); // Get petition data from db uint32 ownerguidlo; @@ -752,7 +750,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData) std::string name; PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION); - stmt->setUInt32(0, GUID_LOPART(petitionGuid)); + stmt->setUInt32(0, petitionGuid.GetCounter()); PreparedQueryResult result = CharacterDatabase.Query(stmt); if (result) @@ -764,7 +762,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData) } else { - TC_LOG_ERROR("network", "Player %s (guid: %u) tried to turn in petition (guid: %u) that is not present in the database", _player->GetName().c_str(), _player->GetGUIDLow(), GUID_LOPART(petitionGuid)); + TC_LOG_ERROR("network", "Player %s (guid: %u) tried to turn in petition (%s) that is not present in the database", _player->GetName().c_str(), _player->GetGUIDLow(), petitionGuid.ToString().c_str()); return; } @@ -817,7 +815,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData) uint8 signatures; stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_SIGNATURE); - stmt->setUInt32(0, GUID_LOPART(petitionGuid)); + stmt->setUInt32(0, petitionGuid.GetCounter()); result = CharacterDatabase.Query(stmt); if (result) @@ -865,7 +863,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData) for (uint8 i = 0; i < signatures; ++i) { Field* fields = result->Fetch(); - guild->AddMember(MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER)); + guild->AddMember(ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32())); result->NextRow(); } } @@ -892,9 +890,9 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData) for (uint8 i = 0; i < signatures; ++i) { Field* fields = result->Fetch(); - uint32 memberGUID = fields[0].GetUInt32(); - TC_LOG_DEBUG("network", "PetitionsHandler: Adding arena team (guid: %u) member %u", arenaTeam->GetId(), memberGUID); - arenaTeam->AddMember(MAKE_NEW_GUID(memberGUID, 0, HIGHGUID_PLAYER)); + ObjectGuid memberGUID(HIGHGUID_PLAYER, fields[0].GetUInt32()); + TC_LOG_DEBUG("network", "PetitionsHandler: Adding arena team (guid: %u) member %s", arenaTeam->GetId(), memberGUID.ToString().c_str()); + arenaTeam->AddMember(memberGUID); result->NextRow(); } } @@ -902,17 +900,17 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData) SQLTransaction trans = CharacterDatabase.BeginTransaction(); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_BY_GUID); - stmt->setUInt32(0, GUID_LOPART(petitionGuid)); + stmt->setUInt32(0, petitionGuid.GetCounter()); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_SIGNATURE_BY_GUID); - stmt->setUInt32(0, GUID_LOPART(petitionGuid)); + stmt->setUInt32(0, petitionGuid.GetCounter()); trans->Append(stmt); CharacterDatabase.CommitTransaction(trans); // created - TC_LOG_DEBUG("network", "TURN IN PETITION GUID %u", GUID_LOPART(petitionGuid)); + TC_LOG_DEBUG("network", "Player %s (%s) turning in petition %s", _player->GetName().c_str(), _player->GetGUID().ToString().c_str(), petitionGuid.ToString().c_str()); data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4); data << (uint32)PETITION_TURN_OK; @@ -923,18 +921,18 @@ void WorldSession::HandlePetitionShowListOpcode(WorldPacket& recvData) { TC_LOG_DEBUG("network", "Received CMSG_PETITION_SHOWLIST"); - uint64 guid; + ObjectGuid guid; recvData >> guid; SendPetitionShowList(guid); } -void WorldSession::SendPetitionShowList(uint64 guid) +void WorldSession::SendPetitionShowList(ObjectGuid guid) { Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_PETITIONER); if (!creature) { - TC_LOG_DEBUG("network", "WORLD: HandlePetitionShowListOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandlePetitionShowListOpcode - %s not found or you can't interact with him.", guid.ToString().c_str()); return; } diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp index dbcfb1c4970..661ecf4652e 100644 --- a/src/server/game/Handlers/QueryHandler.cpp +++ b/src/server/game/Handlers/QueryHandler.cpp @@ -31,13 +31,13 @@ #include "Pet.h" #include "MapManager.h" -void WorldSession::SendNameQueryOpcode(uint64 guid) +void WorldSession::SendNameQueryOpcode(ObjectGuid guid) { Player* player = ObjectAccessor::FindPlayer(guid); - CharacterNameData const* nameData = sWorld->GetCharacterNameData(GUID_LOPART(guid)); + CharacterNameData const* nameData = sWorld->GetCharacterNameData(guid); WorldPacket data(SMSG_NAME_QUERY_RESPONSE, (8+1+1+1+1+1+10)); - data.appendPackGUID(guid); + data << guid.WriteAsPacked(); if (!nameData) { data << uint8(1); // name unknown @@ -66,7 +66,7 @@ void WorldSession::SendNameQueryOpcode(uint64 guid) void WorldSession::HandleNameQueryOpcode(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; recvData >> guid; // This is disable by default to prevent lots of console spam @@ -93,13 +93,12 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket& recvData) { uint32 entry; recvData >> entry; - uint64 guid; + ObjectGuid guid; recvData >> guid; CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(entry); if (ci) { - std::string Name, SubName; Name = ci->Name; SubName = ci->SubName; @@ -142,8 +141,8 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket& recvData) } else { - TC_LOG_DEBUG("network", "WORLD: CMSG_CREATURE_QUERY - NO CREATURE INFO! (GUID: %u, ENTRY: %u)", - GUID_LOPART(guid), entry); + TC_LOG_DEBUG("network", "WORLD: CMSG_CREATURE_QUERY - NO CREATURE INFO! (%s, ENTRY: %u)", + guid.ToString().c_str(), entry); WorldPacket data(SMSG_CREATURE_QUERY_RESPONSE, 4); data << uint32(entry | 0x80000000); SendPacket(&data); @@ -156,7 +155,7 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket& recvData) { uint32 entry; recvData >> entry; - uint64 guid; + ObjectGuid guid; recvData >> guid; const GameObjectTemplate* info = sObjectMgr->GetGameObjectTemplate(entry); @@ -198,8 +197,8 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket& recvData) } else { - TC_LOG_DEBUG("network", "WORLD: CMSG_GAMEOBJECT_QUERY - Missing gameobject info for (GUID: %u, ENTRY: %u)", - GUID_LOPART(guid), entry); + TC_LOG_DEBUG("network", "WORLD: CMSG_GAMEOBJECT_QUERY - Missing gameobject info for (%s, ENTRY: %u)", + guid.ToString().c_str(), entry); WorldPacket data (SMSG_GAMEOBJECT_QUERY_RESPONSE, 4); data << uint32(entry | 0x80000000); SendPacket(&data); diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp index 50beaa65972..e4e1c9988f1 100644 --- a/src/server/game/Handlers/QuestHandler.cpp +++ b/src/server/game/Handlers/QuestHandler.cpp @@ -34,14 +34,14 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; recvData >> guid; uint32 questStatus = DIALOG_STATUS_NONE; Object* questGiver = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT); if (!questGiver) { - TC_LOG_INFO("network", "Error in CMSG_QUESTGIVER_STATUS_QUERY, called for non-existing questgiver (Typeid: %u GUID: %u)", GuidHigh2TypeId(GUID_HIPART(guid)), GUID_LOPART(guid)); + TC_LOG_INFO("network", "Error in CMSG_QUESTGIVER_STATUS_QUERY, called for non-existing questgiver (%s)", guid.ToString().c_str()); return; } @@ -71,16 +71,16 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket& recvData) void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; recvData >> guid; - TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_HELLO npc = %u", GUID_LOPART(guid)); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_HELLO %s", guid.ToString().c_str()); Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE); if (!creature) { - TC_LOG_DEBUG("network", "WORLD: HandleQuestgiverHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", - GUID_LOPART(guid)); + TC_LOG_DEBUG("network", "WORLD: HandleQuestgiverHelloOpcode - %s not found or you can't interact with him.", + guid.ToString().c_str()); return; } @@ -101,19 +101,19 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket& recvData) void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; uint32 questId; uint32 unk1; recvData >> guid >> questId >> unk1; - TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), questId, unk1); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST %s, quest = %u, unk1 = %u", guid.ToString().c_str(), questId, unk1); Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT|TYPEMASK_ITEM|TYPEMASK_PLAYER); #define CLOSE_GOSSIP_CLEAR_DIVIDER() \ do { \ _player->PlayerTalkClass->SendCloseGossip(); \ - _player->SetDivider(0); \ + _player->SetDivider(ObjectGuid::Empty); \ } while (0) // no or incorrect quest giver @@ -154,13 +154,13 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData) return; } - if (_player->GetDivider() != 0) + if (!_player->GetDivider().IsEmpty()) { Player* player = ObjectAccessor::FindPlayer(_player->GetDivider()); if (player) { player->SendPushToPartyResponse(_player, QUEST_PARTY_MSG_ACCEPT_QUEST); - _player->SetDivider(0); + _player->SetDivider(ObjectGuid::Empty); } } @@ -208,11 +208,11 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData) void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; uint32 questId; uint8 unk1; recvData >> guid >> questId >> unk1; - TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_QUERY_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), questId, unk1); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_QUERY_QUEST npc = %s, quest = %u, unk1 = %u", guid.ToString().c_str(), questId, unk1); // Verify that the guid is valid and is a questgiver or involved in the requested quest Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT | TYPEMASK_ITEM); @@ -256,7 +256,7 @@ void WorldSession::HandleQuestQueryOpcode(WorldPacket& recvData) void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket& recvData) { uint32 questId, reward; - uint64 guid; + ObjectGuid guid; recvData >> guid >> questId >> reward; if (reward >= QUEST_REWARD_CHOICES_COUNT) @@ -265,7 +265,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket& recvData) return; } - TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_CHOOSE_REWARD npc = %u, quest = %u, reward = %u", uint32(GUID_LOPART(guid)), questId, reward); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_CHOOSE_REWARD npc = %s, quest = %u, reward = %u", guid.ToString().c_str(), questId, reward); Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT); if (!object || !object->hasInvolvedQuest(questId)) @@ -346,10 +346,10 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket& recvData) void WorldSession::HandleQuestgiverRequestRewardOpcode(WorldPacket& recvData) { uint32 questId; - uint64 guid; + ObjectGuid guid; recvData >> guid >> questId; - TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_REQUEST_REWARD npc = %u, quest = %u", uint32(GUID_LOPART(guid)), questId); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_REQUEST_REWARD npc = %s, quest = %u", guid.ToString().c_str(), questId); Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT); if (!object || !object->hasInvolvedQuest(questId)) @@ -450,18 +450,18 @@ void WorldSession::HandleQuestConfirmAccept(WorldPacket& recvData) if (_player->CanAddQuest(quest, true)) _player->AddQuestAndCheckCompletion(quest, NULL); // NULL, this prevent DB script from duplicate running - _player->SetDivider(0); + _player->SetDivider(ObjectGuid::Empty); } } void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recvData) { uint32 questId; - uint64 guid; + ObjectGuid guid; recvData >> guid >> questId; - TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %u, quest = %u", uint32(GUID_LOPART(guid)), questId); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %s, quest = %u", guid.ToString().c_str(), questId); Quest const* quest = sObjectMgr->GetQuestTemplate(questId); if (!quest) @@ -557,7 +557,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket) continue; } - if (receiver->GetDivider() != 0) + if (receiver->GetDivider()) { sender->SendPushToPartyResponse(receiver, QUEST_PARTY_MSG_BUSY); continue; @@ -580,7 +580,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket) void WorldSession::HandleQuestPushResult(WorldPacket& recvPacket) { - uint64 guid; + ObjectGuid guid; uint32 questId; uint8 msg; recvPacket >> guid >> questId >> msg; @@ -596,7 +596,7 @@ void WorldSession::HandleQuestPushResult(WorldPacket& recvPacket) data << uint64(_player->GetGUID()); data << uint8(msg); // valid values: 0-8 player->SendDirectMessage(&data); - _player->SetDivider(0); + _player->SetDivider(ObjectGuid::Empty); } } } @@ -610,11 +610,11 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket WorldPacket data(SMSG_QUESTGIVER_STATUS_MULTIPLE, 4); data << uint32(count); // placeholder - for (Player::ClientGUIDs::const_iterator itr = _player->m_clientGUIDs.begin(); itr != _player->m_clientGUIDs.end(); ++itr) + for (GuidSet::const_iterator itr = _player->m_clientGUIDs.begin(); itr != _player->m_clientGUIDs.end(); ++itr) { uint32 questStatus = DIALOG_STATUS_NONE; - if (IS_CRE_OR_VEH_OR_PET_GUID(*itr)) + if (itr->IsAnyTypeCreature()) { // need also pet quests case support Creature* questgiver = ObjectAccessor::GetCreatureOrPetOrVehicle(*GetPlayer(), *itr); @@ -629,7 +629,7 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket data << uint8(questStatus); ++count; } - else if (IS_GAMEOBJECT_GUID(*itr)) + else if (itr->IsGameObject()) { GameObject* questgiver = GetPlayer()->GetMap()->GetGameObject(*itr); if (!questgiver || questgiver->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER) diff --git a/src/server/game/Handlers/ReferAFriendHandler.cpp b/src/server/game/Handlers/ReferAFriendHandler.cpp index 3b348b6e214..3ffc8df465e 100644 --- a/src/server/game/Handlers/ReferAFriendHandler.cpp +++ b/src/server/game/Handlers/ReferAFriendHandler.cpp @@ -25,8 +25,8 @@ void WorldSession::HandleGrantLevel(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: CMSG_GRANT_LEVEL"); - uint64 guid; - recvData.readPackGUID(guid); + ObjectGuid guid; + recvData >> guid.ReadAsPacked(); Player* target = ObjectAccessor::GetObjectInWorld(guid, _player); @@ -48,7 +48,8 @@ void WorldSession::HandleGrantLevel(WorldPacket& recvData) else if (target->GetGroup() != _player->GetGroup()) error = ERR_REFER_A_FRIEND_NOT_IN_GROUP; - if (error) { + if (error) + { WorldPacket data(SMSG_REFER_A_FRIEND_FAILURE, 24); data << uint32(error); if (error == ERR_REFER_A_FRIEND_NOT_IN_GROUP) @@ -59,7 +60,7 @@ void WorldSession::HandleGrantLevel(WorldPacket& recvData) } WorldPacket data2(SMSG_PROPOSE_LEVEL_GRANT, 8); - data2.append(_player->GetPackGUID()); + data2 << _player->GetPackGUID(); target->GetSession()->SendPacket(&data2); } @@ -67,8 +68,8 @@ void WorldSession::HandleAcceptGrantLevel(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: CMSG_ACCEPT_LEVEL_GRANT"); - uint64 guid; - recvData.readPackGUID(guid); + ObjectGuid guid; + recvData >> guid.ReadAsPacked(); Player* other = ObjectAccessor::GetObjectInWorld(guid, _player); if (!(other && other->GetSession())) diff --git a/src/server/game/Handlers/SkillHandler.cpp b/src/server/game/Handlers/SkillHandler.cpp index 92c7c60bca0..42d43e621b4 100644 --- a/src/server/game/Handlers/SkillHandler.cpp +++ b/src/server/game/Handlers/SkillHandler.cpp @@ -63,13 +63,13 @@ void WorldSession::HandleLearnPreviewTalents(WorldPacket& recvPacket) void WorldSession::HandleTalentWipeConfirmOpcode(WorldPacket& recvData) { TC_LOG_DEBUG("network", "MSG_TALENT_WIPE_CONFIRM"); - uint64 guid; + ObjectGuid guid; recvData >> guid; Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER); if (!unit) { - TC_LOG_DEBUG("network", "WORLD: HandleTalentWipeConfirmOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleTalentWipeConfirmOpcode - %s not found or you can't interact with him.", guid.ToString().c_str()); return; } diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp index 9cce494a522..61714d6f1e8 100644 --- a/src/server/game/Handlers/SpellHandler.cpp +++ b/src/server/game/Handlers/SpellHandler.cpp @@ -69,7 +69,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) uint8 bagIndex, slot, castFlags; uint8 castCount; // next cast if exists (single or not) - uint64 itemGUID; + ObjectGuid itemGUID; uint32 glyphIndex; // something to do with glyphs? uint32 spellId; // cast spell id @@ -242,7 +242,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) uint32 entry = fields[0].GetUInt32(); uint32 flags = fields[1].GetUInt32(); - item->SetUInt64Value(ITEM_FIELD_GIFTCREATOR, 0); + item->SetGuidValue(ITEM_FIELD_GIFTCREATOR, ObjectGuid::Empty); item->SetEntry(entry); item->SetUInt32Value(ITEM_FIELD_FLAGS, flags); item->SetState(ITEM_CHANGED, pUser); @@ -266,10 +266,10 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) void WorldSession::HandleGameObjectUseOpcode(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; recvData >> guid; - TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_GAMEOBJ_USE Message [guid=%u]", GUID_LOPART(guid)); + TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_GAMEOBJ_USE Message [%s]", guid.ToString().c_str()); if (GameObject* obj = GetPlayer()->GetMap()->GetGameObject(guid)) { @@ -287,10 +287,10 @@ void WorldSession::HandleGameObjectUseOpcode(WorldPacket& recvData) void WorldSession::HandleGameobjectReportUse(WorldPacket& recvPacket) { - uint64 guid; + ObjectGuid guid; recvPacket >> guid; - TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_GAMEOBJ_REPORT_USE Message [in game guid: %u]", GUID_LOPART(guid)); + TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_GAMEOBJ_REPORT_USE Message [%s]", guid.ToString().c_str()); // ignore for remote control state if (_player->m_mover != _player) @@ -391,7 +391,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) spellInfo = actualSpellInfo; } - Spell* spell = new Spell(caster, spellInfo, TRIGGERED_NONE, 0, false); + Spell* spell = new Spell(caster, spellInfo, TRIGGERED_NONE, ObjectGuid::Empty, false); spell->m_cast_count = castCount; // set count of casts spell->prepare(&targets); } @@ -436,7 +436,7 @@ void WorldSession::HandleCancelAuraOpcode(WorldPacket& recvPacket) return; // maybe should only remove one buff when there are multiple? - _player->RemoveOwnedAura(spellId, 0, 0, AURA_REMOVE_BY_CANCEL); + _player->RemoveOwnedAura(spellId, ObjectGuid::Empty, 0, AURA_REMOVE_BY_CANCEL); // If spell being removed is a resource tracker, see if player was tracking both (herbs / minerals) and remove the other if (sWorld->getBoolConfig(CONFIG_ALLOW_TRACK_BOTH_RESOURCES) && spellInfo->HasAura(SPELL_AURA_TRACK_RESOURCES)) @@ -453,14 +453,14 @@ void WorldSession::HandleCancelAuraOpcode(WorldPacket& recvPacket) // Remove all auras related to resource tracking (only Herbs and Minerals in 3.3.5a) for (std::list<uint32>::iterator it = spellIDs.begin(); it != spellIDs.end(); it++) - _player->RemoveOwnedAura(*it, 0, 0, AURA_REMOVE_BY_CANCEL); + _player->RemoveOwnedAura(*it, ObjectGuid::Empty, 0, AURA_REMOVE_BY_CANCEL); } } } void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket) { - uint64 guid; + ObjectGuid guid; uint32 spellId; recvPacket >> guid; @@ -477,13 +477,13 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket) if (!pet) { - TC_LOG_ERROR("network", "HandlePetCancelAura: Attempt to cancel an aura for non-existant pet %u by player '%s'", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str()); + TC_LOG_ERROR("network", "HandlePetCancelAura: Attempt to cancel an aura for non-existant %s by player '%s'", guid.ToString().c_str(), GetPlayer()->GetName().c_str()); return; } if (pet != GetPlayer()->GetGuardianPet() && pet != GetPlayer()->GetCharm()) { - TC_LOG_ERROR("network", "HandlePetCancelAura: Pet %u is not a pet of player '%s'", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str()); + TC_LOG_ERROR("network", "HandlePetCancelAura: %s is not a pet of player '%s'", guid.ToString().c_str(), GetPlayer()->GetName().c_str()); return; } @@ -493,7 +493,7 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket) return; } - pet->RemoveOwnedAura(spellId, 0, 0, AURA_REMOVE_BY_CANCEL); + pet->RemoveOwnedAura(spellId, ObjectGuid::Empty, 0, AURA_REMOVE_BY_CANCEL); pet->AddCreatureSpellCooldown(spellId); } @@ -561,7 +561,7 @@ void WorldSession::HandleSelfResOpcode(WorldPacket & /*recvData*/) void WorldSession::HandleSpellClick(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; recvData >> guid; // this will get something not in world. crash @@ -580,7 +580,7 @@ void WorldSession::HandleSpellClick(WorldPacket& recvData) void WorldSession::HandleMirrorImageDataRequest(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: CMSG_GET_MIRRORIMAGE_DATA"); - uint64 guid; + ObjectGuid guid; recvData >> guid; // Get unit for which data is needed by client @@ -668,7 +668,7 @@ void WorldSession::HandleUpdateProjectilePosition(WorldPacket& recvPacket) { TC_LOG_DEBUG("network", "WORLD: CMSG_UPDATE_PROJECTILE_POSITION"); - uint64 casterGuid; + ObjectGuid casterGuid; uint32 spellId; uint8 castCount; float x, y, z; // Position of missile hit diff --git a/src/server/game/Handlers/TaxiHandler.cpp b/src/server/game/Handlers/TaxiHandler.cpp index 34899fc23df..cc4599316e7 100644 --- a/src/server/game/Handlers/TaxiHandler.cpp +++ b/src/server/game/Handlers/TaxiHandler.cpp @@ -32,19 +32,19 @@ void WorldSession::HandleTaxiNodeStatusQueryOpcode(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: Received CMSG_TAXINODE_STATUS_QUERY"); - uint64 guid; + ObjectGuid guid; recvData >> guid; SendTaxiStatus(guid); } -void WorldSession::SendTaxiStatus(uint64 guid) +void WorldSession::SendTaxiStatus(ObjectGuid guid) { // cheating checks Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); if (!unit) { - TC_LOG_DEBUG("network", "WorldSession::SendTaxiStatus - Unit (GUID: %u) not found.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WorldSession::SendTaxiStatus - %s not found.", guid.ToString().c_str()); return; } @@ -67,14 +67,14 @@ void WorldSession::HandleTaxiQueryAvailableNodes(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: Received CMSG_TAXIQUERYAVAILABLENODES"); - uint64 guid; + ObjectGuid guid; recvData >> guid; // cheating checks Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER); if (!unit) { - TC_LOG_DEBUG("network", "WORLD: HandleTaxiQueryAvailableNodes - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleTaxiQueryAvailableNodes - %s not found or you can't interact with him.", guid.ToString().c_str()); return; } @@ -167,7 +167,7 @@ void WorldSession::HandleActivateTaxiExpressOpcode (WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: Received CMSG_ACTIVATETAXIEXPRESS"); - uint64 guid; + ObjectGuid guid; uint32 node_count; recvData >> guid >> node_count; @@ -175,7 +175,7 @@ void WorldSession::HandleActivateTaxiExpressOpcode (WorldPacket& recvData) Creature* npc = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER); if (!npc) { - TC_LOG_DEBUG("network", "WORLD: HandleActivateTaxiExpressOpcode - Unit (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleActivateTaxiExpressOpcode - %s not found or you can't interact with it.", guid.ToString().c_str()); return; } std::vector<uint32> nodes; @@ -285,7 +285,7 @@ void WorldSession::HandleActivateTaxiOpcode(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: Received CMSG_ACTIVATETAXI"); - uint64 guid; + ObjectGuid guid; std::vector<uint32> nodes; nodes.resize(2); @@ -294,7 +294,7 @@ void WorldSession::HandleActivateTaxiOpcode(WorldPacket& recvData) Creature* npc = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER); if (!npc) { - TC_LOG_DEBUG("network", "WORLD: HandleActivateTaxiOpcode - Unit (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleActivateTaxiOpcode - %s not found or you can't interact with it.", guid.ToString().c_str()); return; } diff --git a/src/server/game/Handlers/TicketHandler.cpp b/src/server/game/Handlers/TicketHandler.cpp index a2aa426c096..9c181233e3b 100644 --- a/src/server/game/Handlers/TicketHandler.cpp +++ b/src/server/game/Handlers/TicketHandler.cpp @@ -44,7 +44,7 @@ void WorldSession::HandleGMTicketCreateOpcode(WorldPacket& recvData) GmTicket* ticket = sTicketMgr->GetTicketByPlayer(GetPlayer()->GetGUID()); if (ticket && ticket->IsCompleted()) - sTicketMgr->CloseTicket(ticket->GetId(), GetPlayer()->GetGUID());; + sTicketMgr->CloseTicket(ticket->GetId(), GetPlayer()->GetGUID()); // Player must not have ticket if (!ticket || ticket->IsClosed()) @@ -218,7 +218,7 @@ void WorldSession::HandleGMSurveySubmit(WorldPacket& recvData) recvData >> comment; PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GM_SURVEY); - stmt->setUInt32(0, GUID_LOPART(GetPlayer()->GetGUID())); + stmt->setUInt32(0, GetPlayer()->GetGUIDLow()); stmt->setUInt32(1, nextSurveyID); stmt->setUInt32(2, mainSurvey); stmt->setString(3, comment); @@ -241,7 +241,7 @@ void WorldSession::HandleReportLag(WorldPacket& recvData) recvData >> z; PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_LAG_REPORT); - stmt->setUInt32(0, GUID_LOPART(GetPlayer()->GetGUID())); + stmt->setUInt32(0, GetPlayer()->GetGUIDLow()); stmt->setUInt8 (1, lagType); stmt->setUInt16(2, mapId); stmt->setFloat (3, x); diff --git a/src/server/game/Handlers/TradeHandler.cpp b/src/server/game/Handlers/TradeHandler.cpp index b4932496077..3a2796ceb95 100644 --- a/src/server/game/Handlers/TradeHandler.cpp +++ b/src/server/game/Handlers/TradeHandler.cpp @@ -94,13 +94,13 @@ void WorldSession::SendUpdateTrade(bool trader_data /*= true*/) data << uint32(item->GetCount()); // stack count // wrapped: hide stats but show giftcreator name data << uint32(item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED) ? 1 : 0); - data << uint64(item->GetUInt64Value(ITEM_FIELD_GIFTCREATOR)); + data << uint64(item->GetGuidValue(ITEM_FIELD_GIFTCREATOR)); // perm. enchantment and gems data << uint32(item->GetEnchantmentId(PERM_ENCHANTMENT_SLOT)); for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+MAX_GEM_SOCKETS; ++enchant_slot) data << uint32(item->GetEnchantmentId(EnchantmentSlot(enchant_slot))); // creator - data << uint64(item->GetUInt64Value(ITEM_FIELD_CREATOR)); + data << uint64(item->GetGuidValue(ITEM_FIELD_CREATOR)); data << uint32(item->GetSpellCharges()); // charges data << uint32(item->GetItemSuffixFactor()); // SuffixFactor data << uint32(item->GetItemRandomPropertyId());// random properties id @@ -475,12 +475,12 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) { if (myItems[i]) { - myItems[i]->SetUInt64Value(ITEM_FIELD_GIFTCREATOR, _player->GetGUID()); + myItems[i]->SetGuidValue(ITEM_FIELD_GIFTCREATOR, _player->GetGUID()); _player->MoveItemFromInventory(myItems[i]->GetBagSlot(), myItems[i]->GetSlot(), true); } if (hisItems[i]) { - hisItems[i]->SetUInt64Value(ITEM_FIELD_GIFTCREATOR, trader->GetGUID()); + hisItems[i]->SetGuidValue(ITEM_FIELD_GIFTCREATOR, trader->GetGUID()); trader->MoveItemFromInventory(hisItems[i]->GetBagSlot(), hisItems[i]->GetSlot(), true); } } @@ -584,7 +584,7 @@ void WorldSession::HandleCancelTradeOpcode(WorldPacket& /*recvPacket*/) void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket) { - uint64 ID; + ObjectGuid ID; recvPacket >> ID; if (GetPlayer()->m_trade) @@ -750,7 +750,7 @@ void WorldSession::HandleSetTradeItemOpcode(WorldPacket& recvPacket) return; } - uint64 iGUID = item->GetGUID(); + ObjectGuid iGUID = item->GetGUID(); // prevent place single item into many trade slots using cheating and client bugs if (my_trade->HasItem(iGUID)) diff --git a/src/server/game/Handlers/VehicleHandler.cpp b/src/server/game/Handlers/VehicleHandler.cpp index b3fa240e2d2..4ca5e2a4b35 100644 --- a/src/server/game/Handlers/VehicleHandler.cpp +++ b/src/server/game/Handlers/VehicleHandler.cpp @@ -27,7 +27,7 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recvData) { TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_DISMISS_CONTROLLED_VEHICLE"); - uint64 vehicleGUID = _player->GetCharmGUID(); + ObjectGuid vehicleGUID = _player->GetCharmGUID(); if (!vehicleGUID) // something wrong here... { @@ -35,9 +35,9 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recvData) return; } - uint64 guid; + ObjectGuid guid; - recvData.readPackGUID(guid); + recvData >> guid.ReadAsPacked(); MovementInfo mi; mi.guid = guid; @@ -78,15 +78,15 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recvData) break; case CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE: { - uint64 guid; // current vehicle guid - recvData.readPackGUID(guid); + ObjectGuid guid; // current vehicle guid + recvData >> guid.ReadAsPacked(); MovementInfo movementInfo; ReadMovementInfo(recvData, &movementInfo); vehicle_base->m_movementInfo = movementInfo; - uint64 accessory; // accessory guid - recvData.readPackGUID(accessory); + ObjectGuid accessory; // accessory guid + recvData >> accessory.ReadAsPacked(); int8 seatId; recvData >> seatId; @@ -106,8 +106,8 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recvData) } case CMSG_REQUEST_VEHICLE_SWITCH_SEAT: { - uint64 guid; // current vehicle guid - recvData.readPackGUID(guid); + ObjectGuid guid; // current vehicle guid + recvData >> guid.ReadAsPacked(); int8 seatId; recvData >> seatId; @@ -128,7 +128,7 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recvData) void WorldSession::HandleEnterPlayerVehicle(WorldPacket &data) { // Read guid - uint64 guid; + ObjectGuid guid; data >> guid; if (Player* player = ObjectAccessor::FindPlayer(guid)) @@ -150,63 +150,37 @@ void WorldSession::HandleEjectPassenger(WorldPacket &data) if (!vehicle) { data.rfinish(); // prevent warnings spam - TC_LOG_ERROR("network", "HandleEjectPassenger: Player %u is not in a vehicle!", GetPlayer()->GetGUIDLow()); + TC_LOG_ERROR("network", "HandleEjectPassenger: %s is not in a vehicle!", GetPlayer()->GetGUID().ToString().c_str()); return; } - uint64 guid; + ObjectGuid guid; data >> guid; - if (IS_PLAYER_GUID(guid)) - { - Player* player = ObjectAccessor::FindPlayer(guid); - if (!player) - { - TC_LOG_ERROR("network", "Player %u tried to eject player %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); - return; - } - - if (!player->IsOnVehicle(vehicle->GetBase())) - { - TC_LOG_ERROR("network", "Player %u tried to eject player %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); - return; - } - - VehicleSeatEntry const* seat = vehicle->GetSeatForPassenger(player); - ASSERT(seat); - if (seat->IsEjectable()) - player->ExitVehicle(); - else - TC_LOG_ERROR("network", "Player %u attempted to eject player %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); - } - - else if (IS_CREATURE_GUID(guid)) + if (guid.IsUnit()) { Unit* unit = ObjectAccessor::GetUnit(*_player, guid); if (!unit) // creatures can be ejected too from player mounts { - TC_LOG_ERROR("network", "Player %u tried to eject creature guid %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); + TC_LOG_ERROR("network", "%s tried to eject %s from vehicle, but the latter was not found in world!", GetPlayer()->GetGUID().ToString().c_str(), guid.ToString().c_str()); return; } if (!unit->IsOnVehicle(vehicle->GetBase())) { - TC_LOG_ERROR("network", "Player %u tried to eject unit %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); + TC_LOG_ERROR("network", "%s tried to eject %s, but they are not in the same vehicle", GetPlayer()->GetGUID().ToString().c_str(), guid.ToString().c_str()); return; } VehicleSeatEntry const* seat = vehicle->GetSeatForPassenger(unit); ASSERT(seat); if (seat->IsEjectable()) - { - ASSERT(GetPlayer() == vehicle->GetBase()); unit->ExitVehicle(); - } else - TC_LOG_ERROR("network", "Player %u attempted to eject creature GUID %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); + TC_LOG_ERROR("network", "Player %u attempted to eject %s from non-ejectable seat.", GetPlayer()->GetGUIDLow(), guid.ToString().c_str()); } else - TC_LOG_ERROR("network", "HandleEjectPassenger: Player %u tried to eject invalid GUID " UI64FMTD, GetPlayer()->GetGUIDLow(), guid); + TC_LOG_ERROR("network", "HandleEjectPassenger: %s tried to eject invalid %s ", GetPlayer()->GetGUID().ToString().c_str(), guid.ToString().c_str()); } void WorldSession::HandleRequestVehicleExit(WorldPacket& /*recvData*/) diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp index 6278e66baef..932c55559ad 100644 --- a/src/server/game/Instances/InstanceScript.cpp +++ b/src/server/game/Instances/InstanceScript.cpp @@ -206,7 +206,7 @@ bool InstanceScript::SetBossState(uint32 id, EncounterState state) return false; if (state == DONE) - for (MinionSet::iterator i = bossInfo->minion.begin(); i != bossInfo->minion.end(); ++i) + for (GuidSet::iterator i = bossInfo->minion.begin(); i != bossInfo->minion.end(); ++i) if (Creature* minion = instance->GetCreature(*i)) if (minion->isWorldBoss() && minion->IsAlive()) return false; @@ -216,11 +216,11 @@ bool InstanceScript::SetBossState(uint32 id, EncounterState state) } for (uint32 type = 0; type < MAX_DOOR_TYPES; ++type) - for (DoorSet::iterator i = bossInfo->door[type].begin(); i != bossInfo->door[type].end(); ++i) + for (GuidSet::iterator i = bossInfo->door[type].begin(); i != bossInfo->door[type].end(); ++i) if (GameObject* door = instance->GetGameObject(*i)) UpdateDoorState(door); - for (MinionSet::iterator i = bossInfo->minion.begin(); i != bossInfo->minion.end(); ++i) + for (GuidSet::iterator i = bossInfo->minion.begin(); i != bossInfo->minion.end(); ++i) if (Creature* minion = instance->GetCreature(*i)) UpdateMinionState(minion, state); @@ -308,7 +308,7 @@ void InstanceScript::WriteSaveDataBossStates(std::ostringstream& data) data << uint32(bossInfo.state) << ' '; } -void InstanceScript::HandleGameObject(uint64 guid, bool open, GameObject* go /*= nullptr*/) +void InstanceScript::HandleGameObject(ObjectGuid guid, bool open, GameObject* go /*= nullptr*/) { if (!go) go = instance->GetGameObject(guid); @@ -318,7 +318,7 @@ void InstanceScript::HandleGameObject(uint64 guid, bool open, GameObject* go /*= TC_LOG_DEBUG("scripts", "InstanceScript: HandleGameObject failed"); } -void InstanceScript::DoUseDoorOrButton(uint64 guid, uint32 withRestoreTime /*= 0*/, bool useAlternativeState /*= false*/) +void InstanceScript::DoUseDoorOrButton(ObjectGuid guid, uint32 withRestoreTime /*= 0*/, bool useAlternativeState /*= false*/) { if (!guid) return; @@ -339,7 +339,7 @@ void InstanceScript::DoUseDoorOrButton(uint64 guid, uint32 withRestoreTime /*= 0 TC_LOG_DEBUG("scripts", "InstanceScript: HandleGameObject failed"); } -void InstanceScript::DoRespawnGameObject(uint64 guid, uint32 timeToDespawn /*= MINUTE*/) +void InstanceScript::DoRespawnGameObject(ObjectGuid guid, uint32 timeToDespawn /*= MINUTE*/) { if (GameObject* go = instance->GetGameObject(guid)) { @@ -480,7 +480,7 @@ void InstanceScript::SendEncounterUnit(uint32 type, Unit* unit /*= NULL*/, uint8 case ENCOUNTER_FRAME_UPDATE_PRIORITY: if (!unit) return; - data.append(unit->GetPackGUID()); + data << unit->GetPackGUID(); data << uint8(param1); break; case ENCOUNTER_FRAME_ADD_TIMER: diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h index 41f62cfb5f2..81c6c588297 100644 --- a/src/server/game/Instances/InstanceScript.h +++ b/src/server/game/Instances/InstanceScript.h @@ -35,9 +35,6 @@ class Player; class GameObject; class Creature; -typedef std::set<uint64> DoorSet; -typedef std::set<uint64> MinionSet; - enum EncounterFrameType { ENCOUNTER_FRAME_ENGAGE = 0, @@ -103,8 +100,8 @@ struct BossInfo { BossInfo() : state(TO_BE_DECIDED) { } EncounterState state; - DoorSet door[MAX_DOOR_TYPES]; - MinionSet minion; + GuidSet door[MAX_DOOR_TYPES]; + GuidSet minion; BossBoundaryMap boundary; }; @@ -160,13 +157,13 @@ class InstanceScript : public ZoneScript // Handle open / close objects // * use HandleGameObject(0, boolen, GO); in OnObjectCreate in instance scripts // * use HandleGameObject(GUID, boolen, NULL); in any other script - void HandleGameObject(uint64 guid, bool open, GameObject* go = nullptr); + void HandleGameObject(ObjectGuid guid, bool open, GameObject* go = nullptr); // Change active state of doors or buttons - void DoUseDoorOrButton(uint64 guid, uint32 withRestoreTime = 0, bool useAlternativeState = false); + void DoUseDoorOrButton(ObjectGuid guid, uint32 withRestoreTime = 0, bool useAlternativeState = false); // Respawns a GO having negative spawntimesecs in gameobject-table - void DoRespawnGameObject(uint64 guid, uint32 timeToDespawn = MINUTE); + void DoRespawnGameObject(ObjectGuid guid, uint32 timeToDespawn = MINUTE); // Sends world state update to all players in instance void DoUpdateWorldState(uint32 worldstateId, uint32 worldstateValue); diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index 2d762b569bc..2732c02ae3c 100644 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -620,8 +620,8 @@ void Loot::NotifyItemRemoved(uint8 lootIndex) { // notify all players that are looting this that the item was removed // convert the index to the slot the player sees - std::set<uint64>::iterator i_next; - for (std::set<uint64>::iterator i = PlayersLooting.begin(); i != PlayersLooting.end(); i = i_next) + GuidSet::iterator i_next; + for (GuidSet::iterator i = PlayersLooting.begin(); i != PlayersLooting.end(); i = i_next) { i_next = i; ++i_next; @@ -635,8 +635,8 @@ void Loot::NotifyItemRemoved(uint8 lootIndex) void Loot::NotifyMoneyRemoved() { // notify all players that are looting this that the money was removed - std::set<uint64>::iterator i_next; - for (std::set<uint64>::iterator i = PlayersLooting.begin(); i != PlayersLooting.end(); i = i_next) + GuidSet::iterator i_next; + for (GuidSet::iterator i = PlayersLooting.begin(); i != PlayersLooting.end(); i = i_next) { i_next = i; ++i_next; @@ -654,8 +654,8 @@ void Loot::NotifyQuestItemRemoved(uint8 questIndex) // (other questitems can be looted by each group member) // bit inefficient but isn't called often - std::set<uint64>::iterator i_next; - for (std::set<uint64>::iterator i = PlayersLooting.begin(); i != PlayersLooting.end(); i = i_next) + GuidSet::iterator i_next; + for (GuidSet::iterator i = PlayersLooting.begin(); i != PlayersLooting.end(); i = i_next) { i_next = i; ++i_next; @@ -912,7 +912,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) continue; } } - else if (l.roundRobinPlayer == 0 || lv.viewer->GetGUID() == l.roundRobinPlayer || !l.items[i].is_underthreshold) + else if (l.roundRobinPlayer.IsEmpty() || lv.viewer->GetGUID() == l.roundRobinPlayer || !l.items[i].is_underthreshold) { // no round robin owner or he has released the loot // or it IS the round robin group owner @@ -936,7 +936,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) { if (!l.items[i].is_looted && !l.items[i].freeforall && l.items[i].conditions.empty() && l.items[i].AllowedForPlayer(lv.viewer)) { - if (l.roundRobinPlayer != 0 && lv.viewer->GetGUID() != l.roundRobinPlayer) + if (!l.roundRobinPlayer.IsEmpty() && lv.viewer->GetGUID() != l.roundRobinPlayer) // item shall not be displayed. continue; diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h index 09905572aae..673e5b6841e 100644 --- a/src/server/game/Loot/LootMgr.h +++ b/src/server/game/Loot/LootMgr.h @@ -24,7 +24,7 @@ #include "RefManager.h" #include "SharedDefines.h" #include "ConditionMgr.h" - +#include "ObjectGuid.h" #include <map> #include <vector> #include <list> @@ -318,7 +318,7 @@ struct Loot std::vector<LootItem> quest_items; uint32 gold; uint8 unlootedCount; - uint64 roundRobinPlayer; // GUID of the player having the Round-Robin ownership for the loot. If 0, round robin owner has released. + ObjectGuid roundRobinPlayer; // GUID of the player having the Round-Robin ownership for the loot. If 0, round robin owner has released. LootType loot_type; // required for achievement system uint8 maxDuplicates; // Max amount of items with the same entry that can drop (default is 1; on 25 man raid mode 3) @@ -326,7 +326,7 @@ struct Loot // Only set for inventory items that can be right-click looted uint32 containerID; - Loot(uint32 _gold = 0) : gold(_gold), unlootedCount(0), roundRobinPlayer(0), loot_type(LOOT_CORPSE), maxDuplicates(1), containerID(0) { } + Loot(uint32 _gold = 0) : gold(_gold), unlootedCount(0), roundRobinPlayer(), loot_type(LOOT_CORPSE), maxDuplicates(1), containerID(0) { } ~Loot() { clear(); } // For deleting items at loot removal since there is no backward interface to the Item() @@ -359,7 +359,7 @@ struct Loot quest_items.clear(); gold = 0; unlootedCount = 0; - roundRobinPlayer = 0; + roundRobinPlayer.Clear(); loot_type = LOOT_NONE; i_LootValidatorRefManager.clearReferences(); } @@ -370,8 +370,8 @@ struct Loot void NotifyItemRemoved(uint8 lootIndex); void NotifyQuestItemRemoved(uint8 questIndex); void NotifyMoneyRemoved(); - void AddLooter(uint64 GUID) { PlayersLooting.insert(GUID); } - void RemoveLooter(uint64 GUID) { PlayersLooting.erase(GUID); } + void AddLooter(ObjectGuid GUID) { PlayersLooting.insert(GUID); } + void RemoveLooter(ObjectGuid GUID) { PlayersLooting.erase(GUID); } void generateMoneyLoot(uint32 minAmount, uint32 maxAmount); bool FillLoot(uint32 lootId, LootStore const& store, Player* lootOwner, bool personal, bool noEmptyError = false, uint16 lootMode = LOOT_MODE_DEFAULT); @@ -390,7 +390,7 @@ struct Loot QuestItemList* FillQuestLoot(Player* player); QuestItemList* FillNonQuestNonFFAConditionalLoot(Player* player, bool presentAtLooting); - std::set<uint64> PlayersLooting; + GuidSet PlayersLooting; QuestItemMap PlayerQuestItems; QuestItemMap PlayerFFAItems; QuestItemMap PlayerNonQuestNonFFAConditionalItems; diff --git a/src/server/game/Mails/Mail.cpp b/src/server/game/Mails/Mail.cpp index 2c65e363dd5..2459e468c25 100644 --- a/src/server/game/Mails/Mail.cpp +++ b/src/server/game/Mails/Mail.cpp @@ -130,11 +130,12 @@ void MailDraft::deleteIncludedItems(SQLTransaction& trans, bool inDB /*= false*/ void MailDraft::SendReturnToSender(uint32 sender_acc, uint32 sender_guid, uint32 receiver_guid, SQLTransaction& trans) { - Player* receiver = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(receiver_guid, 0, HIGHGUID_PLAYER)); + ObjectGuid receiverGuid(HIGHGUID_PLAYER, receiver_guid); + Player* receiver = ObjectAccessor::FindPlayer(receiverGuid); uint32 rc_account = 0; if (!receiver) - rc_account = sObjectMgr->GetPlayerAccountIdByGUID(MAKE_NEW_GUID(receiver_guid, 0, HIGHGUID_PLAYER)); + rc_account = sObjectMgr->GetPlayerAccountIdByGUID(receiverGuid); if (!receiver && !rc_account) // sender not exist { diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 9e29fb01c3b..42a103eb944 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -305,7 +305,7 @@ void Map::SwitchGridContainers(Creature* obj, bool on) CellCoord p = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY()); if (!p.IsCoordValid()) { - TC_LOG_ERROR("maps", "Map::SwitchGridContainers: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); + TC_LOG_ERROR("maps", "Map::SwitchGridContainers: Object %s has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID().ToString().c_str(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); return; } @@ -313,7 +313,7 @@ void Map::SwitchGridContainers(Creature* obj, bool on) if (!IsGridLoaded(GridCoord(cell.data.Part.grid_x, cell.data.Part.grid_y))) return; - TC_LOG_DEBUG("maps", "Switch object " UI64FMTD " from grid[%u, %u] %u", obj->GetGUID(), cell.data.Part.grid_x, cell.data.Part.grid_y, on); + TC_LOG_DEBUG("maps", "Switch object %s from grid[%u, %u] %u", obj->GetGUID().ToString().c_str(), cell.data.Part.grid_x, cell.data.Part.grid_y, on); NGridType *ngrid = getNGrid(cell.GridX(), cell.GridY()); ASSERT(ngrid != NULL); @@ -342,7 +342,7 @@ void Map::SwitchGridContainers(GameObject* obj, bool on) CellCoord p = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY()); if (!p.IsCoordValid()) { - TC_LOG_ERROR("maps", "Map::SwitchGridContainers: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); + TC_LOG_ERROR("maps", "Map::SwitchGridContainers: Object %s has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID().ToString().c_str(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); return; } @@ -350,7 +350,7 @@ void Map::SwitchGridContainers(GameObject* obj, bool on) if (!IsGridLoaded(GridCoord(cell.data.Part.grid_x, cell.data.Part.grid_y))) return; - TC_LOG_DEBUG("maps", "Switch object " UI64FMTD " from grid[%u, %u] %u", obj->GetGUID(), cell.data.Part.grid_x, cell.data.Part.grid_y, on); + TC_LOG_DEBUG("maps", "Switch object %s from grid[%u, %u] %u", obj->GetGUID().ToString().c_str(), cell.data.Part.grid_x, cell.data.Part.grid_y, on); NGridType *ngrid = getNGrid(cell.GridX(), cell.GridY()); ASSERT(ngrid != NULL); @@ -426,7 +426,7 @@ void Map::EnsureGridLoadedForActiveObject(const Cell &cell, WorldObject* object) // refresh grid state & timer if (grid->GetGridState() != GRID_STATE_ACTIVE) { - TC_LOG_DEBUG("maps", "Active object " UI64FMTD " triggers loading of grid [%u, %u] on map %u", object->GetGUID(), cell.GridX(), cell.GridY(), GetId()); + TC_LOG_DEBUG("maps", "Active object %s triggers loading of grid [%u, %u] on map %u", object->GetGUID().ToString().c_str(), cell.GridX(), cell.GridY(), GetId()); ResetGridExpiry(*grid, 0.1f); grid->SetGridState(GRID_STATE_ACTIVE); } @@ -524,7 +524,7 @@ bool Map::AddToMap(T* obj) ASSERT(cellCoord.IsCoordValid()); if (!cellCoord.IsCoordValid()) { - TC_LOG_ERROR("maps", "Map::Add: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord); + TC_LOG_ERROR("maps", "Map::Add: Object %s has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID().ToString().c_str(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord); return false; //Should delete object } @@ -534,7 +534,7 @@ bool Map::AddToMap(T* obj) else EnsureGridCreated(GridCoord(cell.GridX(), cell.GridY())); AddToGrid(obj, cell); - TC_LOG_DEBUG("maps", "Object %u enters grid[%u, %u]", GUID_LOPART(obj->GetGUID()), cell.GridX(), cell.GridY()); + TC_LOG_DEBUG("maps", "Object %s enters grid[%u, %u]", obj->GetGUID().ToString().c_str(), cell.GridX(), cell.GridY()); //Must already be set before AddToMap. Usually during obj->Create. //obj->SetMap(this); @@ -561,7 +561,7 @@ bool Map::AddToMap(Transport* obj) CellCoord cellCoord = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY()); if (!cellCoord.IsCoordValid()) { - TC_LOG_ERROR("maps", "Map::Add: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord); + TC_LOG_ERROR("maps", "Map::Add: Object %s has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID().ToString().c_str(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord); return false; //Should delete object } @@ -2942,7 +2942,7 @@ bool InstanceMap::AddPlayerToMap(Player* player) InstanceGroupBind* groupBind = group->GetBoundInstance(this); if (playerBind && playerBind->save != mapSave) { - TC_LOG_ERROR("maps", "InstanceMap::Add: player %s(%d) is being put into instance %s %d, %d, %d, %d, %d, %d but he is in group %d and is bound to instance %d, %d, %d, %d, %d, %d!", player->GetName().c_str(), player->GetGUIDLow(), GetMapName(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset(), GUID_LOPART(group->GetLeaderGUID()), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset()); + TC_LOG_ERROR("maps", "InstanceMap::Add: player %s(%d) is being put into instance %s %d, %d, %d, %d, %d, %d but he is in group %d and is bound to instance %d, %d, %d, %d, %d, %d!", player->GetName().c_str(), player->GetGUIDLow(), GetMapName(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset(), group->GetLeaderGUID().GetCounter(), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset()); if (groupBind) TC_LOG_ERROR("maps", "InstanceMap::Add: the group is bound to the instance %s %d, %d, %d, %d, %d, %d", GetMapName(), groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty(), groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount(), groupBind->save->CanReset()); //ASSERT(false); @@ -2956,7 +2956,7 @@ bool InstanceMap::AddPlayerToMap(Player* player) // cannot jump to a different instance without resetting it if (groupBind->save != mapSave) { - TC_LOG_ERROR("maps", "InstanceMap::Add: player %s(%d) is being put into instance %d, %d, %d but he is in group %d which is bound to instance %d, %d, %d!", player->GetName().c_str(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), GUID_LOPART(group->GetLeaderGUID()), groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty()); + TC_LOG_ERROR("maps", "InstanceMap::Add: player %s(%d) is being put into instance %d, %d, %d but he is in group %d which is bound to instance %d, %d, %d!", player->GetName().c_str(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), group->GetLeaderGUID().GetCounter(), groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty()); TC_LOG_ERROR("maps", "MapSave players: %d, group count: %d", mapSave->GetPlayerCount(), mapSave->GetGroupCount()); if (groupBind->save) TC_LOG_ERROR("maps", "GroupBind save players: %d, group count: %d", groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount()); @@ -3270,26 +3270,26 @@ void BattlegroundMap::RemoveAllPlayers() player->TeleportTo(player->GetBattlegroundEntryPoint()); } -Creature* Map::GetCreature(uint64 guid) +Creature* Map::GetCreature(ObjectGuid guid) { return ObjectAccessor::GetObjectInMap(guid, this, (Creature*)NULL); } -GameObject* Map::GetGameObject(uint64 guid) +GameObject* Map::GetGameObject(ObjectGuid guid) { return ObjectAccessor::GetObjectInMap(guid, this, (GameObject*)NULL); } -Transport* Map::GetTransport(uint64 guid) +Transport* Map::GetTransport(ObjectGuid guid) { - if (GUID_HIPART(guid) != HIGHGUID_MO_TRANSPORT) + if (!guid.IsMOTransport()) return NULL; GameObject* go = GetGameObject(guid); return go ? go->ToTransport() : NULL; } -DynamicObject* Map::GetDynamicObject(uint64 guid) +DynamicObject* Map::GetDynamicObject(ObjectGuid guid) { return ObjectAccessor::GetObjectInMap(guid, this, (DynamicObject*)NULL); } @@ -3414,15 +3414,15 @@ void Map::DeleteRespawnTimesInDB(uint16 mapId, uint32 instanceId) CharacterDatabase.Execute(stmt); } -time_t Map::GetLinkedRespawnTime(uint64 guid) const +time_t Map::GetLinkedRespawnTime(ObjectGuid guid) const { - uint64 linkedGuid = sObjectMgr->GetLinkedRespawnGuid(guid); - switch (GUID_HIPART(linkedGuid)) + ObjectGuid linkedGuid = sObjectMgr->GetLinkedRespawnGuid(guid); + switch (linkedGuid.GetHigh()) { case HIGHGUID_UNIT: - return GetCreatureRespawnTime(GUID_LOPART(linkedGuid)); + return GetCreatureRespawnTime(linkedGuid.GetCounter()); case HIGHGUID_GAMEOBJECT: - return GetGORespawnTime(GUID_LOPART(linkedGuid)); + return GetGORespawnTime(linkedGuid.GetCounter()); default: break; } diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index fd9ec281709..87434d555aa 100644 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -30,6 +30,7 @@ #include "MapRefManager.h" #include "DynamicTree.h" #include "GameObjectModel.h" +#include "ObjectGuid.h" #include <bitset> #include <list> @@ -56,9 +57,9 @@ namespace Trinity { struct ObjectUpdater; } struct ScriptAction { - uint64 sourceGUID; - uint64 targetGUID; - uint64 ownerGUID; ///> owner of source if source is item + ObjectGuid sourceGUID; + ObjectGuid targetGUID; + ObjectGuid ownerGUID; ///> owner of source if source is item ScriptInfo const* script; ///> pointer to static script data }; @@ -451,10 +452,10 @@ class Map : public GridRefManager<NGridType> TempSummon* SummonCreature(uint32 entry, Position const& pos, SummonPropertiesEntry const* properties = NULL, uint32 duration = 0, Unit* summoner = NULL, uint32 spellId = 0, uint32 vehId = 0); void SummonCreatureGroup(uint8 group, std::list<TempSummon*>* list = NULL); - Creature* GetCreature(uint64 guid); - GameObject* GetGameObject(uint64 guid); - Transport* GetTransport(uint64 guid); - DynamicObject* GetDynamicObject(uint64 guid); + Creature* GetCreature(ObjectGuid guid); + GameObject* GetGameObject(ObjectGuid guid); + Transport* GetTransport(ObjectGuid guid); + DynamicObject* GetDynamicObject(ObjectGuid guid); MapInstanced* ToMapInstanced() { if (Instanceable()) return reinterpret_cast<MapInstanced*>(this); return NULL; } MapInstanced const* ToMapInstanced() const { if (Instanceable()) return reinterpret_cast<MapInstanced const*>(this); return NULL; } @@ -477,7 +478,7 @@ class Map : public GridRefManager<NGridType> /* RESPAWN TIMES */ - time_t GetLinkedRespawnTime(uint64 guid) const; + time_t GetLinkedRespawnTime(ObjectGuid guid) const; time_t GetCreatureRespawnTime(uint32 dbGuid) const { std::unordered_map<uint32 /*dbGUID*/, time_t>::const_iterator itr = _creatureRespawnTimes.find(dbGuid); diff --git a/src/server/game/Maps/ZoneScript.h b/src/server/game/Maps/ZoneScript.h index 5925806db75..9b1f7622b54 100644 --- a/src/server/game/Maps/ZoneScript.h +++ b/src/server/game/Maps/ZoneScript.h @@ -41,6 +41,9 @@ class ZoneScript virtual void OnUnitDeath(Unit*) { } //All-purpose data storage 64 bit + virtual ObjectGuid GetGuidData(uint32 /*DataId*/) const { return ObjectGuid::Empty; } + virtual void SetGuidData(uint32 /*DataId*/, ObjectGuid /*Value*/) { } + virtual uint64 GetData64(uint32 /*DataId*/) const { return 0; } virtual void SetData64(uint32 /*DataId*/, uint64 /*Value*/) { } diff --git a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h index c3bcfffb2a7..f2ff4c6839d 100755 --- a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h @@ -25,7 +25,7 @@ template<class T> class FleeingMovementGenerator : public MovementGeneratorMedium< T, FleeingMovementGenerator<T> > { public: - FleeingMovementGenerator(uint64 fright) : i_frightGUID(fright), i_nextCheckTime(0) { } + FleeingMovementGenerator(ObjectGuid fright) : i_frightGUID(fright), i_nextCheckTime(0) { } void DoInitialize(T*); void DoFinalize(T*); @@ -38,14 +38,14 @@ class FleeingMovementGenerator : public MovementGeneratorMedium< T, FleeingMovem void _setTargetLocation(T*); void _getPoint(T*, float &x, float &y, float &z); - uint64 i_frightGUID; + ObjectGuid i_frightGUID; TimeTracker i_nextCheckTime; }; class TimedFleeingMovementGenerator : public FleeingMovementGenerator<Creature> { public: - TimedFleeingMovementGenerator(uint64 fright, uint32 time) : + TimedFleeingMovementGenerator(ObjectGuid fright, uint32 time) : FleeingMovementGenerator<Creature>(fright), i_totalFleeTime(time) { } diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp index 4061998d47a..942996b8721 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp @@ -78,7 +78,7 @@ void WaypointMovementGenerator<Creature>::OnArrived(Creature* creature) if (i_path->at(i_currentNode)->event_id && urand(0, 99) < i_path->at(i_currentNode)->event_chance) { - TC_LOG_DEBUG("maps.script", "Creature movement start script %u at point %u for " UI64FMTD ".", i_path->at(i_currentNode)->event_id, i_currentNode, creature->GetGUID()); + TC_LOG_DEBUG("maps.script", "Creature movement start script %u at point %u for %s.", i_path->at(i_currentNode)->event_id, i_currentNode, creature->GetGUID().ToString().c_str()); creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE); creature->GetMap()->ScriptsStart(sWaypointScripts, i_path->at(i_currentNode)->event_id, creature, NULL); } diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp index 87d8e4a0c34..9619d478b7f 100644 --- a/src/server/game/Movement/Spline/MoveSplineInit.cpp +++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp @@ -117,11 +117,11 @@ namespace Movement move_spline.Initialize(args); WorldPacket data(SMSG_MONSTER_MOVE, 64); - data.append(unit->GetPackGUID()); + data << unit->GetPackGUID(); if (transport) { data.SetOpcode(SMSG_MONSTER_MOVE_TRANSPORT); - data.appendPackGUID(unit->GetTransGUID()); + data << unit->GetTransGUID().WriteAsPacked(); data << int8(unit->GetTransSeat()); } @@ -163,11 +163,11 @@ namespace Movement move_spline.Initialize(args); WorldPacket data(SMSG_MONSTER_MOVE, 64); - data.append(unit->GetPackGUID()); + data << unit->GetPackGUID(); if (transport) { data.SetOpcode(SMSG_MONSTER_MOVE_TRANSPORT); - data.appendPackGUID(unit->GetTransGUID()); + data << unit->GetTransGUID().WriteAsPacked(); data << int8(unit->GetTransSeat()); } @@ -188,7 +188,7 @@ namespace Movement void MoveSplineInit::SetFacing(const Unit* target) { args.flags.EnableFacingTarget(); - args.facing.target = target->GetGUID(); + args.facing.target = target->GetGUID().GetRawValue(); } void MoveSplineInit::SetFacing(float angle) diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp index 92a83f9d6f0..c6235839476 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp @@ -49,7 +49,7 @@ class DefenseMessageBuilder }; OPvPCapturePoint::OPvPCapturePoint(OutdoorPvP* pvp): - m_capturePointGUID(0), m_capturePoint(NULL), m_maxValue(0.0f), m_minValue(0.0f), m_maxSpeed(0), + m_capturePointGUID(), m_capturePoint(NULL), m_maxValue(0.0f), m_minValue(0.0f), m_maxSpeed(0), m_value(0), m_team(TEAM_NEUTRAL), m_OldState(OBJECTIVESTATE_NEUTRAL), m_State(OBJECTIVESTATE_NEUTRAL), m_neutralValuePct(0), m_PvP(pvp) { } @@ -89,25 +89,27 @@ void OPvPCapturePoint::AddGO(uint32 type, uint32 guid, uint32 entry) { if (!entry) { - const GameObjectData* data = sObjectMgr->GetGOData(guid); + GameObjectData const* data = sObjectMgr->GetGOData(guid); if (!data) return; entry = data->id; } - m_Objects[type] = MAKE_NEW_GUID(guid, entry, HIGHGUID_GAMEOBJECT); - m_ObjectTypes[m_Objects[type]]=type; + + m_Objects[type] = ObjectGuid(HIGHGUID_GAMEOBJECT, entry, guid); + m_ObjectTypes[m_Objects[type]] = type; } void OPvPCapturePoint::AddCre(uint32 type, uint32 guid, uint32 entry) { if (!entry) { - const CreatureData* data = sObjectMgr->GetCreatureData(guid); + CreatureData const* data = sObjectMgr->GetCreatureData(guid); if (!data) return; entry = data->id; } - m_Creatures[type] = MAKE_NEW_GUID(guid, entry, HIGHGUID_UNIT); + + m_Creatures[type] = ObjectGuid(HIGHGUID_UNIT, entry, guid); m_CreatureTypes[m_Creatures[type]] = type; } @@ -145,7 +147,7 @@ bool OPvPCapturePoint::SetCapturePointData(uint32 entry, uint32 map, float x, fl return false; } - m_capturePointGUID = sObjectMgr->AddGOData(entry, map, x, y, z, o, 0, rotation0, rotation1, rotation2, rotation3); + m_capturePointGUID = ObjectGuid(HIGHGUID_GAMEOBJECT, entry, sObjectMgr->AddGOData(entry, map, x, y, z, o, 0, rotation0, rotation1, rotation2, rotation3)); if (!m_capturePointGUID) return false; @@ -170,7 +172,7 @@ bool OPvPCapturePoint::DelCreature(uint32 type) if (!cr) { // can happen when closing the core - m_Creatures[type] = 0; + m_Creatures[type].Clear(); return false; } TC_LOG_DEBUG("outdoorpvp", "deleting opvp creature type %u", type); @@ -193,7 +195,7 @@ bool OPvPCapturePoint::DelCreature(uint32 type) cr->AddObjectToRemoveList(); sObjectMgr->DeleteCreatureData(guid); m_CreatureTypes[m_Creatures[type]] = 0; - m_Creatures[type] = 0; + m_Creatures[type].Clear(); return true; } @@ -205,7 +207,7 @@ bool OPvPCapturePoint::DelObject(uint32 type) GameObject* obj = HashMapHolder<GameObject>::Find(m_Objects[type]); if (!obj) { - m_Objects[type] = 0; + m_Objects[type].Clear(); return false; } uint32 guid = obj->GetDBTableGUIDLow(); @@ -213,14 +215,14 @@ bool OPvPCapturePoint::DelObject(uint32 type) obj->Delete(); sObjectMgr->DeleteGOData(guid); m_ObjectTypes[m_Objects[type]] = 0; - m_Objects[type] = 0; + m_Objects[type].Clear(); return true; } bool OPvPCapturePoint::DelCapturePoint() { - sObjectMgr->DeleteGOData(m_capturePointGUID); - m_capturePointGUID = 0; + sObjectMgr->DeleteGOData(m_capturePointGUID.GetCounter()); + m_capturePointGUID.Clear(); if (m_capturePoint) { @@ -233,9 +235,9 @@ bool OPvPCapturePoint::DelCapturePoint() void OPvPCapturePoint::DeleteSpawns() { - for (std::map<uint32, uint64>::iterator i = m_Objects.begin(); i != m_Objects.end(); ++i) + for (std::map<uint32, ObjectGuid>::iterator i = m_Objects.begin(); i != m_Objects.end(); ++i) DelObject(i->first); - for (std::map<uint32, uint64>::iterator i = m_Creatures.begin(); i != m_Creatures.end(); ++i) + for (std::map<uint32, ObjectGuid>::iterator i = m_Creatures.begin(); i != m_Creatures.end(); ++i) DelCreature(i->first); DelCapturePoint(); } @@ -296,9 +298,9 @@ bool OPvPCapturePoint::Update(uint32 diff) for (uint32 team = 0; team < 2; ++team) { - for (PlayerSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end();) + for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end();) { - uint64 playerGuid = *itr; + ObjectGuid playerGuid = *itr; ++itr; if (Player* player = ObjectAccessor::FindPlayer(playerGuid)) @@ -413,7 +415,7 @@ void OutdoorPvP::SendUpdateWorldState(uint32 field, uint32 value) { if (m_sendUpdate) for (int i = 0; i < 2; ++i) - for (PlayerSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr) + for (GuidSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr) if (Player* const player = ObjectAccessor::FindPlayer(*itr)) player->SendUpdateWorldState(field, value); } @@ -423,13 +425,13 @@ void OPvPCapturePoint::SendUpdateWorldState(uint32 field, uint32 value) for (uint32 team = 0; team < 2; ++team) { // send to all players present in the area - for (PlayerSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) + for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) if (Player* const player = ObjectAccessor::FindPlayer(*itr)) player->SendUpdateWorldState(field, value); } } -void OPvPCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid) +void OPvPCapturePoint::SendObjectiveComplete(uint32 id, ObjectGuid guid) { uint32 team; switch (m_State) @@ -445,7 +447,7 @@ void OPvPCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid) } // send to all players present in the area - for (PlayerSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) + for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) if (Player* const player = ObjectAccessor::FindPlayer(*itr)) player->KilledMonsterCredit(id, guid); } @@ -490,7 +492,7 @@ bool OutdoorPvP::IsInsideObjective(Player* player) const bool OPvPCapturePoint::IsInsideObjective(Player* player) const { - PlayerSet const &plSet = m_activePlayers[player->GetTeamId()]; + GuidSet const &plSet = m_activePlayers[player->GetTeamId()]; return plSet.find(player->GetGUID()) != plSet.end(); } @@ -510,7 +512,7 @@ bool OPvPCapturePoint::HandleCustomSpell(Player* player, uint32 /*spellId*/, Gam return false; } -bool OutdoorPvP::HandleOpenGo(Player* player, uint64 guid) +bool OutdoorPvP::HandleOpenGo(Player* player, ObjectGuid guid) { for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) if (itr->second->HandleOpenGo(player, guid) >= 0) @@ -519,7 +521,7 @@ bool OutdoorPvP::HandleOpenGo(Player* player, uint64 guid) return false; } -bool OutdoorPvP::HandleGossipOption(Player* player, uint64 guid, uint32 id) +bool OutdoorPvP::HandleGossipOption(Player* player, ObjectGuid guid, uint32 id) { for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) if (itr->second->HandleGossipOption(player, guid, id)) @@ -546,7 +548,7 @@ bool OutdoorPvP::HandleDropFlag(Player* player, uint32 id) return false; } -bool OPvPCapturePoint::HandleGossipOption(Player* /*player*/, uint64 /*guid*/, uint32 /*id*/) +bool OPvPCapturePoint::HandleGossipOption(Player* /*player*/, ObjectGuid /*guid*/, uint32 /*id*/) { return false; } @@ -561,9 +563,9 @@ bool OPvPCapturePoint::HandleDropFlag(Player* /*player*/, uint32 /*id*/) return false; } -int32 OPvPCapturePoint::HandleOpenGo(Player* /*player*/, uint64 guid) +int32 OPvPCapturePoint::HandleOpenGo(Player* /*player*/, ObjectGuid guid) { - std::map<uint64, uint32>::iterator itr = m_ObjectTypes.find(guid); + std::map<ObjectGuid, uint32>::iterator itr = m_ObjectTypes.find(guid); if (itr != m_ObjectTypes.end()) { return itr->second; @@ -580,7 +582,7 @@ void OutdoorPvP::BroadcastPacket(WorldPacket &data) const { // This is faster than sWorld->SendZoneMessage for (uint32 team = 0; team < 2; ++team) - for (PlayerSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) + for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) if (Player* const player = ObjectAccessor::FindPlayer(*itr)) player->GetSession()->SendPacket(&data); } @@ -592,7 +594,7 @@ void OutdoorPvP::RegisterZone(uint32 zoneId) bool OutdoorPvP::HasPlayer(Player const* player) const { - PlayerSet const &plSet = m_players[player->GetTeamId()]; + GuidSet const &plSet = m_players[player->GetTeamId()]; return plSet.find(player->GetGUID()) != plSet.end(); } @@ -600,13 +602,13 @@ void OutdoorPvP::TeamCastSpell(TeamId team, int32 spellId) { if (spellId > 0) { - for (PlayerSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) + for (GuidSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) if (Player* const player = ObjectAccessor::FindPlayer(*itr)) player->CastSpell(player, (uint32)spellId, true); } else { - for (PlayerSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) + for (GuidSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) if (Player* const player = ObjectAccessor::FindPlayer(*itr)) player->RemoveAura((uint32)-spellId); // by stack? } @@ -623,7 +625,7 @@ void OutdoorPvP::OnGameObjectCreate(GameObject* go) if (go->GetGoType() != GAMEOBJECT_TYPE_CAPTURE_POINT) return; - if (OPvPCapturePoint *cp = GetCapturePoint(go->GetDBTableGUIDLow())) + if (OPvPCapturePoint *cp = GetCapturePoint(go->GetGUID())) cp->m_capturePoint = go; } @@ -632,7 +634,7 @@ void OutdoorPvP::OnGameObjectRemove(GameObject* go) if (go->GetGoType() != GAMEOBJECT_TYPE_CAPTURE_POINT) return; - if (OPvPCapturePoint *cp = GetCapturePoint(go->GetDBTableGUIDLow())) + if (OPvPCapturePoint *cp = GetCapturePoint(go->GetGUID())) cp->m_capturePoint = NULL; } @@ -647,7 +649,7 @@ template<class Worker> void OutdoorPvP::BroadcastWorker(Worker& _worker, uint32 zoneId) { for (uint32 i = 0; i < BG_TEAMS_COUNT; ++i) - for (PlayerSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr) + for (GuidSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr) if (Player* player = ObjectAccessor::FindPlayer(*itr)) if (player->GetZoneId() == zoneId) _worker(player); diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.h b/src/server/game/OutdoorPvP/OutdoorPvP.h index 4d7d818936e..c2de1b08c48 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvP.h +++ b/src/server/game/OutdoorPvP/OutdoorPvP.h @@ -84,8 +84,6 @@ class Unit; struct GossipMenuItems; class OutdoorPvP; -typedef std::set<uint64> PlayerSet; - class OPvPCapturePoint { public: @@ -100,7 +98,7 @@ class OPvPCapturePoint void SendUpdateWorldState(uint32 field, uint32 value); // send kill notify to players in the controlling faction - void SendObjectiveComplete(uint32 id, uint64 guid); + void SendObjectiveComplete(uint32 id, ObjectGuid guid); // used when player is activated/inactivated in the area virtual bool HandlePlayerEnter(Player* player); @@ -111,7 +109,7 @@ class OPvPCapturePoint virtual bool HandleCustomSpell(Player* player, uint32 spellId, GameObject* go); - virtual int32 HandleOpenGo(Player* player, uint64 guid); + virtual int32 HandleOpenGo(Player* player, ObjectGuid guid); // returns true if the state of the objective has changed, in this case, the OutdoorPvP must send a world state ui update. virtual bool Update(uint32 diff); @@ -122,7 +120,7 @@ class OPvPCapturePoint virtual void SendChangePhase(); - virtual bool HandleGossipOption(Player* player, uint64 guid, uint32 gossipid); + virtual bool HandleGossipOption(Player* player, ObjectGuid guid, uint32 gossipid); virtual bool CanTalkTo(Player* player, Creature* c, GossipMenuItems const& gso); @@ -130,7 +128,7 @@ class OPvPCapturePoint virtual void DeleteSpawns(); - uint32 m_capturePointGUID; + ObjectGuid m_capturePointGUID; GameObject* m_capturePoint; @@ -154,7 +152,7 @@ class OPvPCapturePoint protected: // active players in the area of the objective, 0 - alliance, 1 - horde - PlayerSet m_activePlayers[2]; + GuidSet m_activePlayers[2]; // total shift needed to capture the objective float m_maxValue; @@ -180,10 +178,10 @@ class OPvPCapturePoint // map to store the various gameobjects and creatures spawned by the objective // type, guid - std::map<uint32, uint64> m_Objects; - std::map<uint32, uint64> m_Creatures; - std::map<uint64, uint32> m_ObjectTypes; - std::map<uint64, uint32> m_CreatureTypes; + std::map<uint32, ObjectGuid> m_Objects; + std::map<uint32, ObjectGuid> m_Creatures; + std::map<ObjectGuid, uint32> m_ObjectTypes; + std::map<ObjectGuid, uint32> m_CreatureTypes; }; // base class for specific outdoor pvp handlers @@ -202,7 +200,7 @@ class OutdoorPvP : public ZoneScript // deletes all gos/creatures spawned by the pvp void DeleteSpawns(); - typedef std::map<uint32/*lowguid*/, OPvPCapturePoint*> OPvPCapturePointMap; + typedef std::map<ObjectGuid/*guid*/, OPvPCapturePoint*> OPvPCapturePointMap; virtual void FillInitialWorldStates(WorldPacket & /*data*/) { } @@ -213,7 +211,7 @@ class OutdoorPvP : public ZoneScript virtual bool HandleCustomSpell(Player* player, uint32 spellId, GameObject* go); // called on go use - virtual bool HandleOpenGo(Player* player, uint64 guid); + virtual bool HandleOpenGo(Player* player, ObjectGuid guid); // setup stuff virtual bool SetupOutdoorPvP() {return true;} @@ -242,7 +240,7 @@ class OutdoorPvP : public ZoneScript virtual bool HandleDropFlag(Player* player, uint32 spellId); - virtual bool HandleGossipOption(Player* player, uint64 guid, uint32 gossipid); + virtual bool HandleGossipOption(Player* player, ObjectGuid guid, uint32 gossipid); virtual bool CanTalkTo(Player* player, Creature* c, GossipMenuItems const& gso); @@ -268,7 +266,7 @@ class OutdoorPvP : public ZoneScript // the map of the objectives belonging to this outdoorpvp OPvPCapturePointMap m_capturePoints; - PlayerSet m_players[2]; + GuidSet m_players[2]; uint32 m_TypeId; @@ -289,9 +287,9 @@ class OutdoorPvP : public ZoneScript m_capturePoints[cp->m_capturePointGUID] = cp; } - OPvPCapturePoint * GetCapturePoint(uint32 lowguid) const + OPvPCapturePoint * GetCapturePoint(ObjectGuid guid) const { - OutdoorPvP::OPvPCapturePointMap::const_iterator itr = m_capturePoints.find(lowguid); + OutdoorPvP::OPvPCapturePointMap::const_iterator itr = m_capturePoints.find(guid); if (itr != m_capturePoints.end()) return itr->second; return NULL; diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp index 5306a3ca3c1..4f423457b90 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp @@ -181,7 +181,7 @@ ZoneScript* OutdoorPvPMgr::GetZoneScript(uint32 zoneId) return NULL; } -bool OutdoorPvPMgr::HandleOpenGo(Player* player, uint64 guid) +bool OutdoorPvPMgr::HandleOpenGo(Player* player, ObjectGuid guid) { for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr) { @@ -191,7 +191,7 @@ bool OutdoorPvPMgr::HandleOpenGo(Player* player, uint64 guid) return false; } -void OutdoorPvPMgr::HandleGossipOption(Player* player, uint64 guid, uint32 gossipid) +void OutdoorPvPMgr::HandleGossipOption(Player* player, ObjectGuid guid, uint32 gossipid) { for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr) { diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.h b/src/server/game/OutdoorPvP/OutdoorPvPMgr.h index bf2f14a291f..bbcad8074e1 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.h +++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.h @@ -70,7 +70,7 @@ class OutdoorPvPMgr bool HandleCustomSpell(Player* player, uint32 spellId, GameObject* go); // handle custom go if registered - bool HandleOpenGo(Player* player, uint64 guid); + bool HandleOpenGo(Player* player, ObjectGuid guid); ZoneScript* GetZoneScript(uint32 zoneId); @@ -78,7 +78,7 @@ class OutdoorPvPMgr void Update(uint32 diff); - void HandleGossipOption(Player* player, uint64 guid, uint32 gossipid); + void HandleGossipOption(Player* player, ObjectGuid guid, uint32 gossipid); bool CanTalkTo(Player* player, Creature* creature, GossipMenuItems const& gso); diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp index b12b5f187ad..3ada9d9740b 100644 --- a/src/server/game/Pools/PoolMgr.cpp +++ b/src/server/game/Pools/PoolMgr.cpp @@ -221,7 +221,7 @@ void PoolGroup<Creature>::Despawn1Object(uint32 guid) { sObjectMgr->RemoveCreatureFromGrid(guid, data); - if (Creature* creature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(guid, data->id, HIGHGUID_UNIT), (Creature*)NULL)) + if (Creature* creature = ObjectAccessor::GetObjectInWorld(ObjectGuid(HIGHGUID_UNIT, data->id, guid), (Creature*)NULL)) creature->AddObjectToRemoveList(); } } @@ -234,7 +234,7 @@ void PoolGroup<GameObject>::Despawn1Object(uint32 guid) { sObjectMgr->RemoveGameobjectFromGrid(guid, data); - if (GameObject* pGameobject = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(guid, data->id, HIGHGUID_GAMEOBJECT), (GameObject*)NULL)) + if (GameObject* pGameobject = ObjectAccessor::GetObjectInWorld(ObjectGuid(HIGHGUID_GAMEOBJECT, data->id, guid), (GameObject*)NULL)) pGameobject->AddObjectToRemoveList(); } } @@ -510,7 +510,7 @@ template <> void PoolGroup<Creature>::ReSpawn1Object(PoolObject* obj) { if (CreatureData const* data = sObjectMgr->GetCreatureData(obj->guid)) - if (Creature* creature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(obj->guid, data->id, HIGHGUID_UNIT), (Creature*)NULL)) + if (Creature* creature = ObjectAccessor::GetObjectInWorld(ObjectGuid(HIGHGUID_UNIT, data->id, obj->guid), (Creature*)NULL)) creature->GetMap()->AddToMap(creature); } @@ -519,7 +519,7 @@ template <> void PoolGroup<GameObject>::ReSpawn1Object(PoolObject* obj) { if (GameObjectData const* data = sObjectMgr->GetGOData(obj->guid)) - if (GameObject* pGameobject = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(obj->guid, data->id, HIGHGUID_GAMEOBJECT), (GameObject*)NULL)) + if (GameObject* pGameobject = ObjectAccessor::GetObjectInWorld(ObjectGuid(HIGHGUID_GAMEOBJECT, data->id, obj->guid), (GameObject*)NULL)) pGameobject->GetMap()->AddToMap(pGameobject); } diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp index 888c1ec7e8d..db7c26fe5cb 100644 --- a/src/server/game/Scripting/MapScripts.cpp +++ b/src/server/game/Scripting/MapScripts.cpp @@ -40,9 +40,9 @@ void Map::ScriptsStart(ScriptMapMap const& scripts, uint32 id, Object* source, O return; // prepare static data - uint64 sourceGUID = source ? source->GetGUID() : uint64(0); //some script commands doesn't have source - uint64 targetGUID = target ? target->GetGUID() : uint64(0); - uint64 ownerGUID = (source && source->GetTypeId() == TYPEID_ITEM) ? ((Item*)source)->GetOwnerGUID() : uint64(0); + ObjectGuid sourceGUID = source ? source->GetGUID() : ObjectGuid::Empty; //some script commands doesn't have source + ObjectGuid targetGUID = target ? target->GetGUID() : ObjectGuid::Empty; + ObjectGuid ownerGUID = (source && source->GetTypeId() == TYPEID_ITEM) ? ((Item*)source)->GetOwnerGUID() : ObjectGuid::Empty; ///- Schedule script execution for all scripts in the script map ScriptMap const* s2 = &(s->second); @@ -75,9 +75,9 @@ void Map::ScriptCommandStart(ScriptInfo const& script, uint32 delay, Object* sou // NOTE: script record _must_ exist until command executed // prepare static data - uint64 sourceGUID = source ? source->GetGUID() : uint64(0); - uint64 targetGUID = target ? target->GetGUID() : uint64(0); - uint64 ownerGUID = (source && source->GetTypeId() == TYPEID_ITEM) ? ((Item*)source)->GetOwnerGUID() : uint64(0); + ObjectGuid sourceGUID = source ? source->GetGUID() : ObjectGuid::Empty; + ObjectGuid targetGUID = target ? target->GetGUID() : ObjectGuid::Empty; + ObjectGuid ownerGUID = (source && source->GetTypeId() == TYPEID_ITEM) ? ((Item*)source)->GetOwnerGUID() : ObjectGuid::Empty; ScriptAction sa; sa.sourceGUID = sourceGUID; @@ -299,7 +299,7 @@ void Map::ScriptsProcess() Object* source = NULL; if (step.sourceGUID) { - switch (GUID_HIPART(step.sourceGUID)) + switch (step.sourceGUID.GetHigh()) { case HIGHGUID_ITEM: // as well as HIGHGUID_CONTAINER if (Player* player = HashMapHolder<Player>::Find(step.ownerGUID)) @@ -329,8 +329,8 @@ void Map::ScriptsProcess() break; } default: - TC_LOG_ERROR("scripts", "%s source with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).", - step.script->GetDebugInfo().c_str(), step.sourceGUID, GUID_HIPART(step.sourceGUID)); + TC_LOG_ERROR("scripts", "%s source with unsupported high guid %s.", + step.script->GetDebugInfo().c_str(), step.sourceGUID.ToString().c_str()); break; } } @@ -338,7 +338,7 @@ void Map::ScriptsProcess() WorldObject* target = NULL; if (step.targetGUID) { - switch (GUID_HIPART(step.targetGUID)) + switch (step.targetGUID.GetHigh()) { case HIGHGUID_UNIT: case HIGHGUID_VEHICLE: @@ -364,8 +364,8 @@ void Map::ScriptsProcess() break; } default: - TC_LOG_ERROR("scripts", "%s target with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).", - step.script->GetDebugInfo().c_str(), step.targetGUID, GUID_HIPART(step.targetGUID)); + TC_LOG_ERROR("scripts", "%s target with unsupported high guid %s.", + step.script->GetDebugInfo().c_str(), step.targetGUID.ToString().c_str()); break; } } @@ -434,9 +434,9 @@ void Map::ScriptsProcess() { // Validate field number. if (step.script->FieldSet.FieldID <= OBJECT_FIELD_ENTRY || step.script->FieldSet.FieldID >= cSource->GetValuesCount()) - TC_LOG_ERROR("scripts", "%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.", + TC_LOG_ERROR("scripts", "%s wrong field %u (max count: %u) in object (TypeId: %u, %s) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->FieldSet.FieldID, - cSource->GetValuesCount(), cSource->GetTypeId(), cSource->GetEntry(), cSource->GetGUIDLow()); + cSource->GetValuesCount(), cSource->GetTypeId(), cSource->GetGUID().ToString().c_str()); else cSource->SetUInt32Value(step.script->FieldSet.FieldID, step.script->FieldSet.FieldValue); } @@ -565,7 +565,7 @@ void Map::ScriptsProcess() if (step.script->KillCredit.Flags & SF_KILLCREDIT_REWARD_GROUP) player->RewardPlayerAndGroupAtEvent(step.script->KillCredit.CreatureEntry, player); else - player->KilledMonsterCredit(step.script->KillCredit.CreatureEntry, 0); + player->KilledMonsterCredit(step.script->KillCredit.CreatureEntry); } break; @@ -805,7 +805,7 @@ void Map::ScriptsProcess() else //check hashmap holders { if (CreatureData const* data = sObjectMgr->GetCreatureData(step.script->CallScript.CreatureEntry)) - cTarget = ObjectAccessor::GetObjectInWorld<Creature>(data->mapid, data->posX, data->posY, MAKE_NEW_GUID(step.script->CallScript.CreatureEntry, data->id, HIGHGUID_UNIT), cTarget); + cTarget = ObjectAccessor::GetObjectInWorld<Creature>(data->mapid, data->posX, data->posY, ObjectGuid(HIGHGUID_UNIT, data->id, step.script->CallScript.CreatureEntry), cTarget); } if (!cTarget) diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index d13c81ed059..51100accf77 100644 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -1240,7 +1240,7 @@ void ScriptMgr::OnPlayerEmote(Player* player, uint32 emote) FOREACH_SCRIPT(PlayerScript)->OnEmote(player, emote); } -void ScriptMgr::OnPlayerTextEmote(Player* player, uint32 textEmote, uint32 emoteNum, uint64 guid) +void ScriptMgr::OnPlayerTextEmote(Player* player, uint32 textEmote, uint32 emoteNum, ObjectGuid guid) { FOREACH_SCRIPT(PlayerScript)->OnTextEmote(player, textEmote, emoteNum, guid); } @@ -1265,12 +1265,12 @@ void ScriptMgr::OnPlayerCreate(Player* player) FOREACH_SCRIPT(PlayerScript)->OnCreate(player); } -void ScriptMgr::OnPlayerDelete(uint64 guid, uint32 accountId) +void ScriptMgr::OnPlayerDelete(ObjectGuid guid, uint32 accountId) { FOREACH_SCRIPT(PlayerScript)->OnDelete(guid, accountId); } -void ScriptMgr::OnPlayerFailedDelete(uint64 guid, uint32 accountId) +void ScriptMgr::OnPlayerFailedDelete(ObjectGuid guid, uint32 accountId) { FOREACH_SCRIPT(PlayerScript)->OnFailedDelete(guid, accountId); } @@ -1384,25 +1384,25 @@ void ScriptMgr::OnGuildBankEvent(Guild* guild, uint8 eventType, uint8 tabId, uin } // Group -void ScriptMgr::OnGroupAddMember(Group* group, uint64 guid) +void ScriptMgr::OnGroupAddMember(Group* group, ObjectGuid guid) { ASSERT(group); FOREACH_SCRIPT(GroupScript)->OnAddMember(group, guid); } -void ScriptMgr::OnGroupInviteMember(Group* group, uint64 guid) +void ScriptMgr::OnGroupInviteMember(Group* group, ObjectGuid guid) { ASSERT(group); FOREACH_SCRIPT(GroupScript)->OnInviteMember(group, guid); } -void ScriptMgr::OnGroupRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, const char* reason) +void ScriptMgr::OnGroupRemoveMember(Group* group, ObjectGuid guid, RemoveMethod method, ObjectGuid kicker, const char* reason) { ASSERT(group); FOREACH_SCRIPT(GroupScript)->OnRemoveMember(group, guid, method, kicker, reason); } -void ScriptMgr::OnGroupChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid) +void ScriptMgr::OnGroupChangeLeader(Group* group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid) { ASSERT(group); FOREACH_SCRIPT(GroupScript)->OnChangeLeader(group, newLeaderGuid, oldLeaderGuid); diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index 499d7ff6c09..ae7b8f9947e 100644 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -738,7 +738,7 @@ class PlayerScript : public UnitScript // Both of the below are called on emote opcodes. virtual void OnEmote(Player* /*player*/, uint32 /*emote*/) { } - virtual void OnTextEmote(Player* /*player*/, uint32 /*textEmote*/, uint32 /*emoteNum*/, uint64 /*guid*/) { } + virtual void OnTextEmote(Player* /*player*/, uint32 /*textEmote*/, uint32 /*emoteNum*/, ObjectGuid /*guid*/) { } // Called in Spell::Cast. virtual void OnSpellCast(Player* /*player*/, Spell* /*spell*/, bool /*skipCheck*/) { } @@ -753,10 +753,10 @@ class PlayerScript : public UnitScript virtual void OnCreate(Player* /*player*/) { } // Called when a player is deleted. - virtual void OnDelete(uint64 /*guid*/, uint32 /*accountId*/) { } + virtual void OnDelete(ObjectGuid /*guid*/, uint32 /*accountId*/) { } // Called when a player delete failed - virtual void OnFailedDelete(uint64 /*guid*/, uint32 /*accountId*/) { } + virtual void OnFailedDelete(ObjectGuid /*guid*/, uint32 /*accountId*/) { } // Called when a player is about to be saved. virtual void OnSave(Player* /*player*/) { } @@ -855,16 +855,16 @@ class GroupScript : public ScriptObject bool IsDatabaseBound() const final override { return false; } // Called when a member is added to a group. - virtual void OnAddMember(Group* /*group*/, uint64 /*guid*/) { } + virtual void OnAddMember(Group* /*group*/, ObjectGuid /*guid*/) { } // Called when a member is invited to join a group. - virtual void OnInviteMember(Group* /*group*/, uint64 /*guid*/) { } + virtual void OnInviteMember(Group* /*group*/, ObjectGuid /*guid*/) { } // Called when a member is removed from a group. - virtual void OnRemoveMember(Group* /*group*/, uint64 /*guid*/, RemoveMethod /*method*/, uint64 /*kicker*/, const char* /*reason*/) { } + virtual void OnRemoveMember(Group* /*group*/, ObjectGuid /*guid*/, RemoveMethod /*method*/, ObjectGuid /*kicker*/, const char* /*reason*/) { } // Called when the leader of a group is changed. - virtual void OnChangeLeader(Group* /*group*/, uint64 /*newLeaderGuid*/, uint64 /*oldLeaderGuid*/) { } + virtual void OnChangeLeader(Group* /*group*/, ObjectGuid /*newLeaderGuid*/, ObjectGuid /*oldLeaderGuid*/) { } // Called when a group is disbanded. virtual void OnDisband(Group* /*group*/) { } @@ -1068,13 +1068,13 @@ class ScriptMgr void OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string& msg, Guild* guild); void OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string& msg, Channel* channel); void OnPlayerEmote(Player* player, uint32 emote); - void OnPlayerTextEmote(Player* player, uint32 textEmote, uint32 emoteNum, uint64 guid); + void OnPlayerTextEmote(Player* player, uint32 textEmote, uint32 emoteNum, ObjectGuid guid); void OnPlayerSpellCast(Player* player, Spell* spell, bool skipCheck); void OnPlayerLogin(Player* player, bool firstLogin); void OnPlayerLogout(Player* player); void OnPlayerCreate(Player* player); - void OnPlayerDelete(uint64 guid, uint32 accountId); - void OnPlayerFailedDelete(uint64 guid, uint32 accountId); + void OnPlayerDelete(ObjectGuid guid, uint32 accountId); + void OnPlayerFailedDelete(ObjectGuid guid, uint32 accountId); void OnPlayerSave(Player* player); void OnPlayerBindToInstance(Player* player, Difficulty difficulty, uint32 mapid, bool permanent); void OnPlayerUpdateZone(Player* player, uint32 newZone, uint32 newArea); @@ -1106,10 +1106,10 @@ class ScriptMgr public: /* GroupScript */ - void OnGroupAddMember(Group* group, uint64 guid); - void OnGroupInviteMember(Group* group, uint64 guid); - void OnGroupRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, const char* reason); - void OnGroupChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid); + void OnGroupAddMember(Group* group, ObjectGuid guid); + void OnGroupInviteMember(Group* group, ObjectGuid guid); + void OnGroupRemoveMember(Group* group, ObjectGuid guid, RemoveMethod method, ObjectGuid kicker, const char* reason); + void OnGroupChangeLeader(Group* group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid); void OnGroupDisband(Group* group); public: /* UnitScript */ diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 321bc707879..beb6ea54b32 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -124,7 +124,7 @@ WorldSession::WorldSession(uint32 id, std::shared_ptr<WorldSocket> sock, Account _RBACData(NULL), expireTime(60000), // 1 min after socket loss, session is deleted forceExit(false), - m_currentBankerGUID(0) + m_currentBankerGUID() { memset(m_Tutorials, 0, sizeof(m_Tutorials)); @@ -172,9 +172,11 @@ std::string WorldSession::GetPlayerInfo() const { std::ostringstream ss; - ss << "[Player: " << GetPlayerName() - << " (Guid: " << (_player != NULL ? _player->GetGUID() : 0) - << ", Account: " << GetAccountId() << ")]"; + ss << "[Player: " << GetPlayerName() << " ("; + if (_player != NULL) + ss << _player->GetGUID().ToString() << ", "; + + ss << "Account: " << GetAccountId() << ")]"; return ss.str(); } @@ -445,7 +447,7 @@ void WorldSession::LogoutPlayer(bool save) if (_player) { - if (uint64 lguid = _player->GetLootGUID()) + if (ObjectGuid lguid = _player->GetLootGUID()) DoLootRelease(lguid); ///- If the player just died before logging out, make him appear as a ghost @@ -512,7 +514,7 @@ void WorldSession::LogoutPlayer(bool save) for (int j = BUYBACK_SLOT_START; j < BUYBACK_SLOT_END; ++j) { eslot = j - BUYBACK_SLOT_START; - _player->SetUInt64Value(PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + (eslot * 2), 0); + _player->SetGuidValue(PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + (eslot * 2), ObjectGuid::Empty); _player->SetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, 0); _player->SetUInt32Value(PLAYER_FIELD_BUYBACK_TIMESTAMP_1 + eslot, 0); } @@ -796,8 +798,7 @@ void WorldSession::ReadMovementInfo(WorldPacket &data, MovementInfo* mi) if (mi->HasMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) { - data.readPackGUID(mi->transport.guid); - + data >> mi->transport.guid.ReadAsPacked(); data >> mi->transport.pos.PositionXYZOStream(); data >> mi->transport.time; data >> mi->transport.seat; @@ -904,8 +905,7 @@ void WorldSession::ReadMovementInfo(WorldPacket &data, MovementInfo* mi) void WorldSession::WriteMovementInfo(WorldPacket* data, MovementInfo* mi) { - data->appendPackGUID(mi->guid); - + *data << mi->guid.WriteAsPacked(); *data << mi->flags; *data << mi->flags2; *data << mi->time; @@ -913,8 +913,7 @@ void WorldSession::WriteMovementInfo(WorldPacket* data, MovementInfo* mi) if (mi->HasMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) { - data->appendPackGUID(mi->transport.guid); - + *data << mi->transport.guid.WriteAsPacked(); *data << mi->transport.pos.PositionXYZOStream(); *data << mi->transport.time; *data << mi->transport.seat; @@ -1148,7 +1147,7 @@ void WorldSession::ProcessQueryCallbacks() //- SendStabledPet if (_sendStabledPetCallback.IsReady()) { - uint64 param = _sendStabledPetCallback.GetParam(); + ObjectGuid param = _sendStabledPetCallback.GetParam(); _sendStabledPetCallback.GetResult(result); SendStablePetCallback(result, param); _sendStabledPetCallback.FreeResult(); diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 2e6a699fc7c..e46a58d5098 100644 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -281,38 +281,37 @@ class WorldSession /// Handle the authentication waiting queue (to be completed) void SendAuthWaitQue(uint32 position); - //void SendTestCreatureQueryOpcode(uint32 entry, uint64 guid, uint32 testvalue); - void SendNameQueryOpcode(uint64 guid); - - void SendTrainerList(uint64 guid); - void SendTrainerList(uint64 guid, std::string const& strTitle); - void SendListInventory(uint64 guid); - void SendShowBank(uint64 guid); - bool CanOpenMailBox(uint64 guid); - void SendShowMailBox(uint64 guid); - void SendTabardVendorActivate(uint64 guid); + void SendNameQueryOpcode(ObjectGuid guid); + + void SendTrainerList(ObjectGuid guid); + void SendTrainerList(ObjectGuid guid, std::string const& strTitle); + void SendListInventory(ObjectGuid guid); + void SendShowBank(ObjectGuid guid); + bool CanOpenMailBox(ObjectGuid guid); + void SendShowMailBox(ObjectGuid guid); + void SendTabardVendorActivate(ObjectGuid guid); void SendSpiritResurrect(); void SendBindPoint(Creature* npc); void SendAttackStop(Unit const* enemy); - void SendBattleGroundList(uint64 guid, BattlegroundTypeId bgTypeId = BATTLEGROUND_RB); + void SendBattleGroundList(ObjectGuid guid, BattlegroundTypeId bgTypeId = BATTLEGROUND_RB); void SendTradeStatus(TradeStatusInfo const& status); void SendUpdateTrade(bool trader_data = true); void SendCancelTrade(); - void SendPetitionQueryOpcode(uint64 petitionguid); + void SendPetitionQueryOpcode(ObjectGuid petitionguid); // Spell - void HandleClientCastFlags(WorldPacket& recvPacket, uint8 castFlags, SpellCastTargets & targets); + void HandleClientCastFlags(WorldPacket& recvPacket, uint8 castFlags, SpellCastTargets& targets); // Pet - void SendPetNameQuery(uint64 guid, uint32 petnumber); - void SendStablePet(uint64 guid); - void SendStablePetCallback(PreparedQueryResult result, uint64 guid); + void SendPetNameQuery(ObjectGuid guid, uint32 petnumber); + void SendStablePet(ObjectGuid guid); + void SendStablePetCallback(PreparedQueryResult result, ObjectGuid guid); void SendStableResult(uint8 guid); - bool CheckStableMaster(uint64 guid); + bool CheckStableMaster(ObjectGuid guid); // Account Data AccountData* GetAccountData(AccountDataType type) { return &m_accountData[type]; } @@ -336,17 +335,17 @@ class WorldSession //used with item_page table bool SendItemInfo(uint32 itemid, WorldPacket data); //auction - void SendAuctionHello(uint64 guid, Creature* unit); + void SendAuctionHello(ObjectGuid guid, Creature* unit); void SendAuctionCommandResult(uint32 auctionId, uint32 Action, uint32 ErrorCode, uint32 bidError = 0); - void SendAuctionBidderNotification(uint32 location, uint32 auctionId, uint64 bidder, uint32 bidSum, uint32 diff, uint32 item_template); + void SendAuctionBidderNotification(uint32 location, uint32 auctionId, ObjectGuid bidder, uint32 bidSum, uint32 diff, uint32 item_template); void SendAuctionOwnerNotification(AuctionEntry* auction); //Item Enchantment - void SendEnchantmentLog(uint64 target, uint64 caster, uint32 itemId, uint32 enchantId); - void SendItemEnchantTimeUpdate(uint64 Playerguid, uint64 Itemguid, uint32 slot, uint32 Duration); + void SendEnchantmentLog(ObjectGuid target, ObjectGuid caster, uint32 itemId, uint32 enchantId); + void SendItemEnchantTimeUpdate(ObjectGuid Playerguid, ObjectGuid Itemguid, uint32 slot, uint32 Duration); //Taxi - void SendTaxiStatus(uint64 guid); + void SendTaxiStatus(ObjectGuid guid); void SendTaxiMenu(Creature* unit); void SendDoFlight(uint32 mountDisplayId, uint32 path, uint32 pathNode = 0); bool SendLearnNewTaxiNode(Creature* unit); @@ -355,11 +354,11 @@ class WorldSession // Guild/Arena Team void SendArenaTeamCommandResult(uint32 team_action, std::string const& team, std::string const& player, uint32 error_id = 0); void SendNotInArenaTeamPacket(uint8 type); - void SendPetitionShowList(uint64 guid); + void SendPetitionShowList(ObjectGuid guid); void BuildPartyMemberStatsChangedPacket(Player* player, WorldPacket* data); - void DoLootRelease(uint64 lguid); + void DoLootRelease(ObjectGuid lguid); // Account mute time time_t m_muteTime; @@ -738,7 +737,7 @@ class WorldSession //Pet void HandlePetAction(WorldPacket& recvData); void HandlePetStopAttack(WorldPacket& recvData); - void HandlePetActionHelper(Unit* pet, uint64 guid1, uint32 spellid, uint16 flag, uint64 guid2); + void HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spellid, uint16 flag, ObjectGuid guid2); void HandlePetNameQuery(WorldPacket& recvData); void HandlePetSetAction(WorldPacket& recvData); void HandlePetAbandon(WorldPacket& recvData); @@ -811,7 +810,7 @@ class WorldSession void SendLfgUpdatePlayer(lfg::LfgUpdateData const& updateData); void SendLfgUpdateParty(lfg::LfgUpdateData const& updateData); - void SendLfgRoleChosen(uint64 guid, uint8 roles); + void SendLfgRoleChosen(ObjectGuid guid, uint8 roles); void SendLfgRoleCheckUpdate(lfg::LfgRoleCheck const& pRoleCheck); void SendLfgLfrList(bool update); void SendLfgJoinResult(lfg::LfgJoinResultData const& joinData); @@ -925,7 +924,7 @@ class WorldSession QueryCallback<PreparedQueryResult, std::string> _addFriendCallback; QueryCallback<PreparedQueryResult, uint32> _unstablePetCallback; QueryCallback<PreparedQueryResult, uint32> _stableSwapCallback; - QueryCallback<PreparedQueryResult, uint64> _sendStabledPetCallback; + QueryCallback<PreparedQueryResult, ObjectGuid> _sendStabledPetCallback; QueryCallback<PreparedQueryResult, CharacterCreateInfo*, true> _charCreateCallback; QueryResultHolderFuture _charLoginCallback; @@ -963,21 +962,21 @@ class WorldSession // private trade methods void moveItems(Item* myItems[], Item* hisItems[]); - bool CanUseBank(uint64 bankerGUID = 0) const; + bool CanUseBank(ObjectGuid bankerGUID = ObjectGuid::Empty) const; // logging helper void LogUnexpectedOpcode(WorldPacket* packet, const char* status, const char *reason); void LogUnprocessedTail(WorldPacket* packet); // EnumData helpers - bool IsLegitCharacterForAccount(uint32 lowGUID) + bool IsLegitCharacterForAccount(ObjectGuid lowGUID) { return _legitCharacters.find(lowGUID) != _legitCharacters.end(); } // this stores the GUIDs of the characters who can login // characters who failed on Player::BuildEnumData shouldn't login - std::set<uint32> _legitCharacters; + GuidSet _legitCharacters; uint32 m_GUIDLow; // set logined or recently logout player (while m_playerRecentlyLogout set) Player* _player; @@ -1014,7 +1013,7 @@ class WorldSession rbac::RBACData* _RBACData; uint32 expireTime; bool forceExit; - uint64 m_currentBankerGUID; + ObjectGuid m_currentBankerGUID; WorldSession(WorldSession const& right) = delete; WorldSession& operator=(WorldSession const& right) = delete; diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index c78830af43a..6f0298ee22f 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -423,7 +423,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster) // check item enchant aura cast if (!amount && caster) - if (uint64 itemGUID = GetBase()->GetCastItemGUID()) + if (ObjectGuid itemGUID = GetBase()->GetCastItemGUID()) if (Player* playerCaster = caster->ToPlayer()) if (Item* castItem = playerCaster->GetItemByGuid(itemGUID)) if (castItem->GetItemSuffixFactor()) @@ -704,7 +704,7 @@ void AuraEffect::ApplySpellMod(Unit* target, bool apply) case SPELLMOD_EFFECT2: case SPELLMOD_EFFECT3: { - uint64 guid = target->GetGUID(); + ObjectGuid guid = target->GetGUID(); Unit::AuraApplicationMap & auras = target->GetAppliedAuras(); for (Unit::AuraApplicationMap::iterator iter = auras.begin(); iter != auras.end(); ++iter) { @@ -1663,7 +1663,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo } // remove other shapeshift before applying a new one - target->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT, 0, GetBase()); + target->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT, ObjectGuid::Empty, GetBase()); // stop handling the effect if it was removed by linked event if (aurApp->GetRemoveMode()) @@ -2025,7 +2025,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode, { // for players, start regeneration after 1s (in polymorph fast regeneration case) // only if caster is Player (after patch 2.4.2) - if (IS_PLAYER_GUID(GetCasterGUID())) + if (GetCasterGUID().IsPlayer()) target->ToPlayer()->setRegenTimerCount(1*IN_MILLISECONDS); //dismount polymorphed target (after patch 2.4.2) @@ -3333,7 +3333,7 @@ void AuraEffect::HandleAuraModStateImmunity(AuraApplication const* aurApp, uint8 target->ApplySpellImmune(GetId(), IMMUNITY_STATE, GetMiscValue(), apply); if (apply && GetSpellInfo()->AttributesEx & SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY) - target->RemoveAurasByType(AuraType(GetMiscValue()), 0, GetBase()); + target->RemoveAurasByType(AuraType(GetMiscValue()), ObjectGuid::Empty, GetBase()); } void AuraEffect::HandleAuraModSchoolImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const @@ -5183,13 +5183,13 @@ void AuraEffect::HandleAuraLinked(AuraApplication const* aurApp, uint8 mode, boo } else { - uint64 casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? GetCasterGUID() : target->GetGUID(); + ObjectGuid casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? GetCasterGUID() : target->GetGUID(); target->RemoveAura(triggeredSpellId, casterGUID, 0, aurApp->GetRemoveMode()); } } else if (mode & AURA_EFFECT_HANDLE_REAPPLY && apply) { - uint64 casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? GetCasterGUID() : target->GetGUID(); + ObjectGuid casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? GetCasterGUID() : target->GetGUID(); // change the stack amount to be equal to stack amount of our aura if (Aura* triggeredAura = target->GetAura(triggeredSpellId, casterGUID)) triggeredAura->ModStackAmount(GetBase()->GetStackAmount() - triggeredAura->GetStackAmount()); @@ -5304,7 +5304,7 @@ void AuraEffect::HandleAuraSetVehicle(AuraApplication const* aurApp, uint8 mode, target->RemoveVehicleKit(); WorldPacket data(SMSG_PLAYER_VEHICLE_DATA, target->GetPackGUID().size()+4); - data.appendPackGUID(target->GetGUID()); + data << target->GetPackGUID(); data << uint32(apply ? vehicleId : 0); target->SendMessageToSet(&data, true); @@ -5629,7 +5629,7 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster) case 28820: { // Need remove self if Lightning Shield not active - if (!target->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_SHAMAN, 0x400)) + if (!target->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_SHAMAN, 0x400, 0, 0)) target->RemoveAurasDueToSpell(28820); return; } @@ -5918,8 +5918,8 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const caster->CalcAbsorbResist(target, GetSpellInfo()->GetSchoolMask(), DOT, damage, &absorb, &resist, GetSpellInfo()); - TC_LOG_INFO("spells", "PeriodicTick: %u (TypeId: %u) attacked %u (TypeId: %u) for %u dmg inflicted by %u abs is %u", - GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId(), absorb); + TC_LOG_INFO("spells", "PeriodicTick: %s attacked %s for %u dmg inflicted by %u absorb is %u", + GetCasterGUID().ToString().c_str(), target->GetGUID().ToString().c_str(), damage, GetId(), absorb); caster->DealDamageMods(target, damage, &absorb); @@ -6008,8 +6008,8 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c if (target->GetHealth() < damage) damage = uint32(target->GetHealth()); - TC_LOG_INFO("spells", "PeriodicTick: %u (TypeId: %u) health leech of %u (TypeId: %u) for %u dmg inflicted by %u abs is %u", - GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId(), absorb); + TC_LOG_INFO("spells", "PeriodicTick: %s health leech of %s for %u dmg inflicted by %u abs is %u", + GetCasterGUID().ToString().c_str(), target->GetGUID().ToString().c_str(), damage, GetId(), absorb); caster->SendSpellNonMeleeDamageLog(target, GetId(), damage, GetSpellInfo()->GetSchoolMask(), absorb, resist, false, 0, crit); @@ -6145,8 +6145,8 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const if (crit) damage = caster->SpellCriticalHealingBonus(m_spellInfo, damage, target); - TC_LOG_INFO("spells", "PeriodicTick: %u (TypeId: %u) heal of %u (TypeId: %u) for %u health inflicted by %u", - GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId()); + TC_LOG_INFO("spells", "PeriodicTick: %s heal of %s for %u health inflicted by %u", + GetCasterGUID().ToString().c_str(), target->GetGUID().ToString().c_str(), damage, GetId()); uint32 absorb = 0; uint32 heal = uint32(damage); @@ -6158,7 +6158,7 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellInfo()); - bool haveCastItem = GetBase()->GetCastItemGUID() != 0; + bool haveCastItem = !GetBase()->GetCastItemGUID().IsEmpty(); // Health Funnel // damage caster for heal amount @@ -6216,8 +6216,8 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con drainAmount = maxmana; } - TC_LOG_INFO("spells", "PeriodicTick: %u (TypeId: %u) power leech of %u (TypeId: %u) for %u dmg inflicted by %u", - GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), drainAmount, GetId()); + TC_LOG_INFO("spells", "PeriodicTick: %s power leech of %s for %u dmg inflicted by %u", + GetCasterGUID().ToString().c_str(), target->GetGUID().ToString().c_str(), drainAmount, GetId()); // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4) if (powerType == POWER_MANA) @@ -6277,8 +6277,8 @@ void AuraEffect::HandleObsModPowerAuraTick(Unit* target, Unit* caster) const // ignore negative values (can be result apply spellmods to aura damage uint32 amount = std::max(m_amount, 0) * target->GetMaxPower(powerType) /100; - TC_LOG_INFO("spells", "PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u", - GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), amount, GetId()); + TC_LOG_INFO("spells", "PeriodicTick: %s energize s for %u dmg inflicted by %u", + GetCasterGUID().ToString().c_str(), target->GetGUID().ToString().c_str(), amount, GetId()); SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false); target->SendPeriodicAuraLog(&pInfo); @@ -6315,8 +6315,8 @@ void AuraEffect::HandlePeriodicEnergizeAuraTick(Unit* target, Unit* caster) cons SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false); target->SendPeriodicAuraLog(&pInfo); - TC_LOG_INFO("spells", "PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u", - GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), amount, GetId()); + TC_LOG_INFO("spells", "PeriodicTick: %s energize %s for %u dmg inflicted by %u", + GetCasterGUID().ToString().c_str(), target->GetGUID().ToString().c_str(), amount, GetId()); int32 gain = target->ModifyPower(powerType, amount); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h index 5eec9021291..eae1bebab8b 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.h +++ b/src/server/game/Spells/Auras/SpellAuraEffects.h @@ -30,14 +30,14 @@ typedef void(AuraEffect::*pAuraEffectHandler)(AuraApplication const* aurApp, uin class AuraEffect { friend void Aura::_InitEffects(uint8 effMask, Unit* caster, int32 *baseAmount); - friend Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID); + friend Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount, Item* castItem, ObjectGuid casterGUID); friend Aura::~Aura(); private: ~AuraEffect(); explicit AuraEffect(Aura* base, uint8 effIndex, int32 *baseAmount, Unit* caster); public: Unit* GetCaster() const { return GetBase()->GetCaster(); } - uint64 GetCasterGUID() const { return GetBase()->GetCasterGUID(); } + ObjectGuid GetCasterGUID() const { return GetBase()->GetCasterGUID(); } Aura* GetBase() const { return m_base; } void GetTargetList(std::list<Unit*> & targetList) const; void GetApplicationList(std::list<AuraApplication*> & applicationList) const; diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 5bc2c41b6ce..1d21d3556ab 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -200,7 +200,7 @@ void AuraApplication::BuildUpdatePacket(ByteBuffer& data, bool remove) const data << uint8(aura->GetSpellInfo()->StackAmount ? aura->GetStackAmount() : aura->GetCharges()); if (!(flags & AFLAG_CASTER)) - data.appendPackGUID(aura->GetCasterGUID()); + data << aura->GetCasterGUID().WriteAsPacked(); if (flags & AFLAG_DURATION) { @@ -214,7 +214,7 @@ void AuraApplication::ClientUpdate(bool remove) _needClientUpdate = false; WorldPacket data(SMSG_AURA_UPDATE); - data.append(GetTarget()->GetPackGUID()); + data << GetTarget()->GetPackGUID(); BuildUpdatePacket(data, remove); _target->SendMessageToSet(&data, true); @@ -248,7 +248,7 @@ uint8 Aura::BuildEffectMaskForOwner(SpellInfo const* spellProto, uint8 avalibleE return effMask & avalibleEffectMask; } -Aura* Aura::TryRefreshStackOrCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount /*= NULL*/, Item* castItem /*= NULL*/, uint64 casterGUID /*= 0*/, bool* refresh /*= NULL*/) +Aura* Aura::TryRefreshStackOrCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount /*= NULL*/, Item* castItem /*= NULL*/, ObjectGuid casterGUID /*= ObjectGuid::Empty*/, bool* refresh /*= NULL*/) { ASSERT(spellproto); ASSERT(owner); @@ -274,7 +274,7 @@ Aura* Aura::TryRefreshStackOrCreate(SpellInfo const* spellproto, uint8 tryEffMas return Create(spellproto, effMask, owner, caster, baseAmount, castItem, casterGUID); } -Aura* Aura::TryCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount /*= NULL*/, Item* castItem /*= NULL*/, uint64 casterGUID /*= 0*/) +Aura* Aura::TryCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount /*= NULL*/, Item* castItem /*= NULL*/, ObjectGuid casterGUID /*= ObjectGuid::Empty*/) { ASSERT(spellproto); ASSERT(owner); @@ -286,7 +286,7 @@ Aura* Aura::TryCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject return Create(spellproto, effMask, owner, caster, baseAmount, castItem, casterGUID); } -Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID) +Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, ObjectGuid casterGUID) { ASSERT(effMask); ASSERT(spellproto); @@ -331,9 +331,9 @@ Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owne return aura; } -Aura::Aura(SpellInfo const* spellproto, WorldObject* owner, Unit* caster, Item* castItem, uint64 casterGUID) : +Aura::Aura(SpellInfo const* spellproto, WorldObject* owner, Unit* caster, Item* castItem, ObjectGuid casterGUID) : m_spellInfo(spellproto), m_casterGuid(casterGUID ? casterGUID : caster->GetGUID()), -m_castItemGuid(castItem ? castItem->GetGUID() : 0), m_applyTime(time(NULL)), +m_castItemGuid(castItem ? castItem->GetGUID() : ObjectGuid::Empty), m_applyTime(time(NULL)), m_owner(owner), m_timeCla(0), m_updateTargetMapInterval(0), m_casterLevel(caster ? caster->getLevel() : m_spellInfo->SpellLevel), m_procCharges(0), m_stackAmount(1), m_isRemoved(false), m_isSingleTarget(false), m_isUsingCharges(false), m_dropEvent(nullptr) @@ -2418,7 +2418,7 @@ void Aura::CallScriptAfterEffectProcHandlers(AuraEffect const* aurEff, AuraAppli } } -UnitAura::UnitAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID) +UnitAura::UnitAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, ObjectGuid casterGUID) : Aura(spellproto, owner, caster, castItem, casterGUID) { m_AuraDRGroup = DIMINISHING_NONE; @@ -2521,7 +2521,7 @@ void UnitAura::FillTargetMap(std::map<Unit*, uint8> & targets, Unit* caster) } } -DynObjAura::DynObjAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID) +DynObjAura::DynObjAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, ObjectGuid casterGUID) : Aura(spellproto, owner, caster, castItem, casterGUID) { LoadScripts(); diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h index 1266bf5c6ec..f69d9baafe0 100644 --- a/src/server/game/Spells/Auras/SpellAuras.h +++ b/src/server/game/Spells/Auras/SpellAuras.h @@ -84,23 +84,23 @@ class AuraApplication class Aura { - friend Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID); + friend Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32 *baseAmount, Item* castItem, ObjectGuid casterGUID); public: - typedef std::map<uint64, AuraApplication *> ApplicationMap; + typedef std::map<ObjectGuid, AuraApplication*> ApplicationMap; static uint8 BuildEffectMaskForOwner(SpellInfo const* spellProto, uint8 avalibleEffectMask, WorldObject* owner); - static Aura* TryRefreshStackOrCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount = NULL, Item* castItem = NULL, uint64 casterGUID = 0, bool* refresh = NULL); - static Aura* TryCreate(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount = NULL, Item* castItem = NULL, uint64 casterGUID = 0); - static Aura* Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID); - explicit Aura(SpellInfo const* spellproto, WorldObject* owner, Unit* caster, Item* castItem, uint64 casterGUID); + static Aura* TryRefreshStackOrCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount = NULL, Item* castItem = NULL, ObjectGuid casterGUID = ObjectGuid::Empty, bool* refresh = NULL); + static Aura* TryCreate(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount = NULL, Item* castItem = NULL, ObjectGuid casterGUID = ObjectGuid::Empty); + static Aura* Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, ObjectGuid casterGUID); + explicit Aura(SpellInfo const* spellproto, WorldObject* owner, Unit* caster, Item* castItem, ObjectGuid casterGUID); void _InitEffects(uint8 effMask, Unit* caster, int32 *baseAmount); virtual ~Aura(); SpellInfo const* GetSpellInfo() const { return m_spellInfo; } uint32 GetId() const{ return GetSpellInfo()->Id; } - uint64 GetCastItemGUID() const { return m_castItemGuid; } - uint64 GetCasterGUID() const { return m_casterGuid; } + ObjectGuid GetCastItemGUID() const { return m_castItemGuid; } + ObjectGuid GetCasterGUID() const { return m_casterGuid; } Unit* GetCaster() const; WorldObject* GetOwner() const { return m_owner; } Unit* GetUnitOwner() const { ASSERT(GetType() == UNIT_AURA_TYPE); return (Unit*)m_owner; } @@ -186,11 +186,11 @@ class Aura void HandleAllEffects(AuraApplication * aurApp, uint8 mode, bool apply); // Helpers for targets - ApplicationMap const & GetApplicationMap() {return m_applications;} + ApplicationMap const& GetApplicationMap() { return m_applications; } void GetApplicationList(Unit::AuraApplicationList& applicationList) const; - const AuraApplication * GetApplicationOfTarget (uint64 guid) const { ApplicationMap::const_iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return NULL; } - AuraApplication * GetApplicationOfTarget (uint64 guid) { ApplicationMap::iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return NULL; } - bool IsAppliedOnTarget(uint64 guid) const { return m_applications.find(guid) != m_applications.end(); } + const AuraApplication* GetApplicationOfTarget(ObjectGuid guid) const { ApplicationMap::const_iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return NULL; } + AuraApplication* GetApplicationOfTarget(ObjectGuid guid) { ApplicationMap::iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return NULL; } + bool IsAppliedOnTarget(ObjectGuid guid) const { return m_applications.find(guid) != m_applications.end(); } void SetNeedClientUpdateForTargets() const; void HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, bool apply, bool onReapply); @@ -246,10 +246,10 @@ class Aura void _DeleteRemovedApplications(); protected: SpellInfo const* const m_spellInfo; - uint64 const m_casterGuid; - uint64 const m_castItemGuid; // it is NOT safe to keep a pointer to the item because it may get deleted + ObjectGuid const m_casterGuid; + ObjectGuid const m_castItemGuid; // it is NOT safe to keep a pointer to the item because it may get deleted time_t const m_applyTime; - WorldObject* const m_owner; // + WorldObject* const m_owner; int32 m_maxDuration; // Max aura duration int32 m_duration; // Current time @@ -275,9 +275,9 @@ class Aura class UnitAura : public Aura { - friend Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID); + friend Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, ObjectGuid casterGUID); protected: - explicit UnitAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID); + explicit UnitAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, ObjectGuid casterGUID); public: void _ApplyForTarget(Unit* target, Unit* caster, AuraApplication * aurApp) override; void _UnapplyForTarget(Unit* target, Unit* caster, AuraApplication * aurApp) override; @@ -296,9 +296,9 @@ class UnitAura : public Aura class DynObjAura : public Aura { - friend Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID); + friend Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, ObjectGuid casterGUID); protected: - explicit DynObjAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID); + explicit DynObjAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, ObjectGuid casterGUID); public: void Remove(AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT) override; diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index bb68010ca12..18c066d2164 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -61,14 +61,14 @@ extern pEffect SpellEffects[TOTAL_SPELL_EFFECTS]; SpellDestination::SpellDestination() { _position.Relocate(0, 0, 0, 0); - _transportGUID = 0; + _transportGUID.Clear(); _transportOffset.Relocate(0, 0, 0, 0); } SpellDestination::SpellDestination(float x, float y, float z, float orientation, uint32 mapId) { _position.Relocate(x, y, z, orientation); - _transportGUID = 0; + _transportGUID.Clear(); _position.m_mapId = mapId; _transportOffset.Relocate(0, 0, 0, 0); } @@ -76,7 +76,7 @@ SpellDestination::SpellDestination(float x, float y, float z, float orientation, SpellDestination::SpellDestination(Position const& pos) { _position.Relocate(pos); - _transportGUID = 0; + _transportGUID.Clear(); _transportOffset.Relocate(0, 0, 0, 0); } @@ -111,8 +111,8 @@ SpellCastTargets::SpellCastTargets() : m_elevation(0), m_speed(0), m_strTarget() m_objectTarget = NULL; m_itemTarget = NULL; - m_objectTargetGUID = 0; - m_itemTargetGUID = 0; + m_objectTargetGUID.Clear(); + m_itemTargetGUID.Clear(); m_itemTargetEntry = 0; m_targetMask = 0; @@ -128,14 +128,14 @@ void SpellCastTargets::Read(ByteBuffer& data, Unit* caster) return; if (m_targetMask & (TARGET_FLAG_UNIT | TARGET_FLAG_UNIT_MINIPET | TARGET_FLAG_GAMEOBJECT | TARGET_FLAG_CORPSE_ENEMY | TARGET_FLAG_CORPSE_ALLY)) - data.readPackGUID(m_objectTargetGUID); + data >> m_objectTargetGUID.ReadAsPacked(); if (m_targetMask & (TARGET_FLAG_ITEM | TARGET_FLAG_TRADE_ITEM)) - data.readPackGUID(m_itemTargetGUID); + data >> m_itemTargetGUID.ReadAsPacked(); if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION) { - data.readPackGUID(m_src._transportGUID); + data >> m_src._transportGUID.ReadAsPacked(); if (m_src._transportGUID) data >> m_src._transportOffset.PositionXYZStream(); else @@ -152,7 +152,7 @@ void SpellCastTargets::Read(ByteBuffer& data, Unit* caster) if (m_targetMask & TARGET_FLAG_DEST_LOCATION) { - data.readPackGUID(m_dst._transportGUID); + data >> m_dst._transportGUID.ReadAsPacked(); if (m_dst._transportGUID) data >> m_dst._transportOffset.PositionXYZStream(); else @@ -178,19 +178,19 @@ void SpellCastTargets::Write(ByteBuffer& data) data << uint32(m_targetMask); if (m_targetMask & (TARGET_FLAG_UNIT | TARGET_FLAG_CORPSE_ALLY | TARGET_FLAG_GAMEOBJECT | TARGET_FLAG_CORPSE_ENEMY | TARGET_FLAG_UNIT_MINIPET)) - data.appendPackGUID(m_objectTargetGUID); + data << m_objectTargetGUID.WriteAsPacked(); if (m_targetMask & (TARGET_FLAG_ITEM | TARGET_FLAG_TRADE_ITEM)) { if (m_itemTarget) - data.append(m_itemTarget->GetPackGUID()); + data << m_itemTarget->GetPackGUID(); else data << uint8(0); } if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION) { - data.appendPackGUID(m_src._transportGUID); // relative position guid here - transport for example + data << m_src._transportGUID.WriteAsPacked(); // relative position guid here - transport for example if (m_src._transportGUID) data << m_src._transportOffset.PositionXYZStream(); else @@ -199,7 +199,7 @@ void SpellCastTargets::Write(ByteBuffer& data) if (m_targetMask & TARGET_FLAG_DEST_LOCATION) { - data.appendPackGUID(m_dst._transportGUID); // relative position guid here - transport for example + data << m_dst._transportGUID.WriteAsPacked(); // relative position guid here - transport for example if (m_dst._transportGUID) data << m_dst._transportOffset.PositionXYZStream(); else @@ -210,24 +210,19 @@ void SpellCastTargets::Write(ByteBuffer& data) data << m_strTarget; } -uint64 SpellCastTargets::GetUnitTargetGUID() const +ObjectGuid SpellCastTargets::GetUnitTargetGUID() const { - switch (GUID_HIPART(m_objectTargetGUID)) - { - case HIGHGUID_PLAYER: - case HIGHGUID_VEHICLE: - case HIGHGUID_UNIT: - case HIGHGUID_PET: - return m_objectTargetGUID; - default: - return 0LL; - } + if (m_objectTargetGUID.IsUnit()) + return m_objectTargetGUID; + + return ObjectGuid::Empty; } Unit* SpellCastTargets::GetUnitTarget() const { if (m_objectTarget) return m_objectTarget->ToUnit(); + return NULL; } @@ -241,27 +236,22 @@ void SpellCastTargets::SetUnitTarget(Unit* target) m_targetMask |= TARGET_FLAG_UNIT; } -uint64 SpellCastTargets::GetGOTargetGUID() const +ObjectGuid SpellCastTargets::GetGOTargetGUID() const { - switch (GUID_HIPART(m_objectTargetGUID)) - { - case HIGHGUID_TRANSPORT: - case HIGHGUID_MO_TRANSPORT: - case HIGHGUID_GAMEOBJECT: - return m_objectTargetGUID; - default: - return 0LL; - } + if (m_objectTargetGUID.IsAnyTypeGameObject()) + return m_objectTargetGUID; + + return ObjectGuid::Empty; } GameObject* SpellCastTargets::GetGOTarget() const { if (m_objectTarget) return m_objectTarget->ToGameObject(); + return NULL; } - void SpellCastTargets::SetGOTarget(GameObject* target) { if (!target) @@ -272,21 +262,19 @@ void SpellCastTargets::SetGOTarget(GameObject* target) m_targetMask |= TARGET_FLAG_GAMEOBJECT; } -uint64 SpellCastTargets::GetCorpseTargetGUID() const +ObjectGuid SpellCastTargets::GetCorpseTargetGUID() const { - switch (GUID_HIPART(m_objectTargetGUID)) - { - case HIGHGUID_CORPSE: - return m_objectTargetGUID; - default: - return 0LL; - } + if (m_objectTargetGUID.IsCorpse()) + return m_objectTargetGUID; + + return ObjectGuid::Empty; } Corpse* SpellCastTargets::GetCorpseTarget() const { if (m_objectTarget) return m_objectTarget->ToCorpse(); + return NULL; } @@ -295,7 +283,7 @@ WorldObject* SpellCastTargets::GetObjectTarget() const return m_objectTarget; } -uint64 SpellCastTargets::GetObjectTargetGUID() const +ObjectGuid SpellCastTargets::GetObjectTargetGUID() const { return m_objectTargetGUID; } @@ -303,7 +291,7 @@ uint64 SpellCastTargets::GetObjectTargetGUID() const void SpellCastTargets::RemoveObjectTarget() { m_objectTarget = NULL; - m_objectTargetGUID = 0LL; + m_objectTargetGUID.Clear(); m_targetMask &= ~(TARGET_FLAG_UNIT_MASK | TARGET_FLAG_CORPSE_MASK | TARGET_FLAG_GAMEOBJECT_MASK); } @@ -320,7 +308,7 @@ void SpellCastTargets::SetItemTarget(Item* item) void SpellCastTargets::SetTradeItemTarget(Player* caster) { - m_itemTargetGUID = uint64(TRADE_SLOT_NONTRADED); + m_itemTargetGUID.Set(uint64(TRADE_SLOT_NONTRADED)); m_itemTargetEntry = 0; m_targetMask |= TARGET_FLAG_TRADE_ITEM; @@ -443,7 +431,7 @@ void SpellCastTargets::Update(Unit* caster) if (m_targetMask & TARGET_FLAG_ITEM) m_itemTarget = player->GetItemByGuid(m_itemTargetGUID); else if (m_targetMask & TARGET_FLAG_TRADE_ITEM) - if (m_itemTargetGUID == TRADE_SLOT_NONTRADED) // here it is not guid but slot. Also prevents hacking slots + if (m_itemTargetGUID.GetRawValue() == TRADE_SLOT_NONTRADED) // here it is not guid but slot. Also prevents hacking slots if (TradeData* pTrade = player->GetTradeData()) m_itemTarget = pTrade->GetTraderData()->GetItem(TRADE_SLOT_NONTRADED); @@ -478,15 +466,15 @@ void SpellCastTargets::OutDebug() const TC_LOG_INFO("spells", "target mask: %u", m_targetMask); if (m_targetMask & (TARGET_FLAG_UNIT_MASK | TARGET_FLAG_CORPSE_MASK | TARGET_FLAG_GAMEOBJECT_MASK)) - TC_LOG_INFO("spells", "Object target: " UI64FMTD, m_objectTargetGUID); + TC_LOG_INFO("spells", "Object target: %s", m_objectTargetGUID.ToString().c_str()); if (m_targetMask & TARGET_FLAG_ITEM) - TC_LOG_INFO("spells", "Item target: " UI64FMTD, m_itemTargetGUID); + TC_LOG_INFO("spells", "Item target: %s", m_itemTargetGUID.ToString().c_str()); if (m_targetMask & TARGET_FLAG_TRADE_ITEM) - TC_LOG_INFO("spells", "Trade item target: " UI64FMTD, m_itemTargetGUID); + TC_LOG_INFO("spells", "Trade item target: %s", m_itemTargetGUID.ToString().c_str()); if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION) - TC_LOG_INFO("spells", "Source location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_src._transportGUID, m_src._transportOffset.ToString().c_str(), m_src._position.ToString().c_str()); + TC_LOG_INFO("spells", "Source location: transport guid:%s trans offset: %s position: %s", m_src._transportGUID.ToString().c_str(), m_src._transportOffset.ToString().c_str(), m_src._position.ToString().c_str()); if (m_targetMask & TARGET_FLAG_DEST_LOCATION) - TC_LOG_INFO("spells", "Destination location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_dst._transportGUID, m_dst._transportOffset.ToString().c_str(), m_dst._position.ToString().c_str()); + TC_LOG_INFO("spells", "Destination location: transport guid:%s trans offset: %s position: %s", m_dst._transportGUID.ToString().c_str(), m_dst._transportOffset.ToString().c_str(), m_dst._position.ToString().c_str()); if (m_targetMask & TARGET_FLAG_STRING) TC_LOG_INFO("spells", "String: %s", m_strTarget.c_str()); TC_LOG_INFO("spells", "speed: %f", m_speed); @@ -502,7 +490,7 @@ SpellValue::SpellValue(SpellInfo const* proto) AuraStackAmount = 1; } -Spell::Spell(Unit* caster, SpellInfo const* info, TriggerCastFlags triggerFlags, uint64 originalCasterGUID, bool skipCheck) : +Spell::Spell(Unit* caster, SpellInfo const* info, TriggerCastFlags triggerFlags, ObjectGuid originalCasterGUID, bool skipCheck) : m_spellInfo(sSpellMgr->GetSpellForDifficultyFromSpell(info, caster)), m_caster((info->AttributesEx6 & SPELL_ATTR6_CAST_BY_CHARMER && caster->GetCharmerOrOwner()) ? caster->GetCharmerOrOwner() : caster) , m_spellValue(new SpellValue(m_spellInfo)), m_preGeneratedPath(PathGenerator(m_caster)) @@ -570,7 +558,7 @@ m_caster((info->AttributesEx6 & SPELL_ATTR6_CAST_BY_CHARMER && caster->GetCharme _triggeredCastFlags = TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_EQUIPPED_ITEM_REQUIREMENT); m_CastItem = NULL; - m_castItemGUID = 0; + m_castItemGUID.Clear(); m_castItemEntry = 0; unitTarget = NULL; @@ -953,7 +941,7 @@ void Spell::SelectImplicitChannelTargets(SpellEffIndex effIndex, SpellImplicitTa { case TARGET_UNIT_CHANNEL_TARGET: { - WorldObject* target = ObjectAccessor::GetUnit(*m_caster, m_originalCaster->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT)); + WorldObject* target = ObjectAccessor::GetUnit(*m_caster, m_originalCaster->GetChannelObjectGuid()); CallScriptObjectTargetSelectHandlers(target, effIndex, targetType); // unit target may be no longer avalible - teleported out of map for example if (target && target->ToUnit()) @@ -965,7 +953,7 @@ void Spell::SelectImplicitChannelTargets(SpellEffIndex effIndex, SpellImplicitTa case TARGET_DEST_CHANNEL_TARGET: if (channeledSpell->m_targets.HasDst()) m_targets.SetDst(channeledSpell->m_targets); - else if (WorldObject* target = ObjectAccessor::GetWorldObject(*m_caster, m_originalCaster->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT))) + else if (WorldObject* target = ObjectAccessor::GetWorldObject(*m_caster, m_originalCaster->GetChannelObjectGuid())) { CallScriptObjectTargetSelectHandlers(target, effIndex, targetType); if (target) @@ -1063,7 +1051,7 @@ void Spell::SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTar AddUnitTarget(unitTarget, effMask, true, false); else { - TC_LOG_DEBUG("spells", "Spell::SelectImplicitNearbyTargets: OnObjectTargetSelect script hook for spell Id %u set object of wrong type, expected unit, got %s, effect %u", m_spellInfo->Id, GetLogNameForGuid(target->GetGUID()), effMask); + TC_LOG_DEBUG("spells", "Spell::SelectImplicitNearbyTargets: OnObjectTargetSelect script hook for spell Id %u set object of wrong type, expected unit, got %s, effect %u", m_spellInfo->Id, target->GetGUID().GetTypeName(), effMask); return; } break; @@ -1073,7 +1061,7 @@ void Spell::SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTar AddGOTarget(gobjTarget, effMask); else { - TC_LOG_DEBUG("spells", "Spell::SelectImplicitNearbyTargets: OnObjectTargetSelect script hook for spell Id %u set object of wrong type, expected gameobject, got %s, effect %u", m_spellInfo->Id, GetLogNameForGuid(target->GetGUID()), effMask); + TC_LOG_DEBUG("spells", "Spell::SelectImplicitNearbyTargets: OnObjectTargetSelect script hook for spell Id %u set object of wrong type, expected gameobject, got %s, effect %u", m_spellInfo->Id, target->GetGUID().GetTypeName(), effMask); return; } break; @@ -2019,7 +2007,7 @@ void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*= if (target->IsImmunedToSpellEffect(m_spellInfo, effIndex)) effectMask &= ~(1 << effIndex); - uint64 targetGUID = target->GetGUID(); + ObjectGuid targetGUID = target->GetGUID(); // Lookup target in already in list for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) @@ -2129,7 +2117,7 @@ void Spell::AddGOTarget(GameObject* go, uint32 effectMask) if (!effectMask) return; - uint64 targetGUID = go->GetGUID(); + ObjectGuid targetGUID = go->GetGUID(); // Lookup target in already in list for (std::list<GOTargetInfo>::iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit) @@ -2574,7 +2562,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA { bool refresh = false; m_spellAura = Aura::TryRefreshStackOrCreate(aurSpellInfo, effectMask, unit, - m_originalCaster, (aurSpellInfo == m_spellInfo)? &m_spellValue->EffectBasePoints[0] : &basePoints[0], m_CastItem, 0, &refresh); + m_originalCaster, (aurSpellInfo == m_spellInfo) ? &m_spellValue->EffectBasePoints[0] : &basePoints[0], m_CastItem, ObjectGuid::Empty, &refresh); if (m_spellAura) { // Set aura stack amount to desired value @@ -2818,7 +2806,7 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered } else { - m_castItemGUID = 0; + m_castItemGUID.Clear(); m_castItemEntry = 0; } @@ -3781,11 +3769,11 @@ void Spell::SendSpellStart() WorldPacket data(SMSG_SPELL_START, (8+8+4+4+2)); if (m_CastItem) - data.append(m_CastItem->GetPackGUID()); + data << m_CastItem->GetPackGUID(); else - data.append(m_caster->GetPackGUID()); + data << m_caster->GetPackGUID(); - data.append(m_caster->GetPackGUID()); + data << m_caster->GetPackGUID(); data << uint8(m_cast_count); // pending spell cast? data << uint32(m_spellInfo->Id); // spellId data << uint32(castFlags); // cast flags @@ -3852,11 +3840,11 @@ void Spell::SendSpellGo() WorldPacket data(SMSG_SPELL_GO, 50); // guess size if (m_CastItem) - data.append(m_CastItem->GetPackGUID()); + data << m_CastItem->GetPackGUID(); else - data.append(m_caster->GetPackGUID()); + data << m_caster->GetPackGUID(); - data.append(m_caster->GetPackGUID()); + data << m_caster->GetPackGUID(); data << uint8(m_cast_count); // pending spell cast? data << uint32(m_spellInfo->Id); // spellId data << uint32(castFlags); // cast flags @@ -4049,7 +4037,7 @@ void Spell::SendLogExecute() { WorldPacket data(SMSG_SPELLLOGEXECUTE, (8+4+4+4+4+8)); - data.append(m_caster->GetPackGUID()); + data << m_caster->GetPackGUID(); data << uint32(m_spellInfo->Id); @@ -4082,7 +4070,7 @@ void Spell::SendLogExecute() void Spell::ExecuteLogEffectTakeTargetPower(uint8 effIndex, Unit* target, uint32 powerType, uint32 powerTaken, float gainMultiplier) { InitEffectExecuteData(effIndex); - m_effectExecuteData[effIndex]->append(target->GetPackGUID()); + *m_effectExecuteData[effIndex] << target->GetPackGUID(); *m_effectExecuteData[effIndex] << uint32(powerTaken); *m_effectExecuteData[effIndex] << uint32(powerType); *m_effectExecuteData[effIndex] << float(gainMultiplier); @@ -4091,21 +4079,21 @@ void Spell::ExecuteLogEffectTakeTargetPower(uint8 effIndex, Unit* target, uint32 void Spell::ExecuteLogEffectExtraAttacks(uint8 effIndex, Unit* victim, uint32 attCount) { InitEffectExecuteData(effIndex); - m_effectExecuteData[effIndex]->append(victim->GetPackGUID()); + *m_effectExecuteData[effIndex] << victim->GetPackGUID(); *m_effectExecuteData[effIndex] << uint32(attCount); } void Spell::ExecuteLogEffectInterruptCast(uint8 effIndex, Unit* victim, uint32 spellId) { InitEffectExecuteData(effIndex); - m_effectExecuteData[effIndex]->append(victim->GetPackGUID()); + *m_effectExecuteData[effIndex] << victim->GetPackGUID(); *m_effectExecuteData[effIndex] << uint32(spellId); } void Spell::ExecuteLogEffectDurabilityDamage(uint8 effIndex, Unit* victim, int32 itemId, int32 slot) { InitEffectExecuteData(effIndex); - m_effectExecuteData[effIndex]->append(victim->GetPackGUID()); + *m_effectExecuteData[effIndex] << victim->GetPackGUID(); *m_effectExecuteData[effIndex] << int32(itemId); *m_effectExecuteData[effIndex] << int32(slot); } @@ -4113,7 +4101,7 @@ void Spell::ExecuteLogEffectDurabilityDamage(uint8 effIndex, Unit* victim, int32 void Spell::ExecuteLogEffectOpenLock(uint8 effIndex, Object* obj) { InitEffectExecuteData(effIndex); - m_effectExecuteData[effIndex]->append(obj->GetPackGUID()); + *m_effectExecuteData[effIndex] << obj->GetPackGUID(); } void Spell::ExecuteLogEffectCreateItem(uint8 effIndex, uint32 entry) @@ -4131,32 +4119,32 @@ void Spell::ExecuteLogEffectDestroyItem(uint8 effIndex, uint32 entry) void Spell::ExecuteLogEffectSummonObject(uint8 effIndex, WorldObject* obj) { InitEffectExecuteData(effIndex); - m_effectExecuteData[effIndex]->append(obj->GetPackGUID()); + *m_effectExecuteData[effIndex] << obj->GetPackGUID(); } void Spell::ExecuteLogEffectUnsummonObject(uint8 effIndex, WorldObject* obj) { InitEffectExecuteData(effIndex); - m_effectExecuteData[effIndex]->append(obj->GetPackGUID()); + *m_effectExecuteData[effIndex] << obj->GetPackGUID(); } void Spell::ExecuteLogEffectResurrect(uint8 effIndex, Unit* target) { InitEffectExecuteData(effIndex); - m_effectExecuteData[effIndex]->append(target->GetPackGUID()); + *m_effectExecuteData[effIndex] << target->GetPackGUID(); } void Spell::SendInterrupted(uint8 result) { WorldPacket data(SMSG_SPELL_FAILURE, (8+4+1)); - data.append(m_caster->GetPackGUID()); + data << m_caster->GetPackGUID(); data << uint8(m_cast_count); data << uint32(m_spellInfo->Id); data << uint8(result); m_caster->SendMessageToSet(&data, true); data.Initialize(SMSG_SPELL_FAILED_OTHER, (8+4)); - data.append(m_caster->GetPackGUID()); + data << m_caster->GetPackGUID(); data << uint8(m_cast_count); data << uint32(m_spellInfo->Id); data << uint8(result); @@ -4167,12 +4155,12 @@ void Spell::SendChannelUpdate(uint32 time) { if (time == 0) { - m_caster->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, 0); + m_caster->SetChannelObjectGuid(ObjectGuid::Empty); m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL, 0); } WorldPacket data(MSG_CHANNEL_UPDATE, 8+4); - data.append(m_caster->GetPackGUID()); + data << m_caster->GetPackGUID(); data << uint32(time); m_caster->SendMessageToSet(&data, true); @@ -4180,13 +4168,13 @@ void Spell::SendChannelUpdate(uint32 time) void Spell::SendChannelStart(uint32 duration) { - uint64 channelTarget = m_targets.GetObjectTargetGUID(); + ObjectGuid channelTarget = m_targets.GetObjectTargetGUID(); if (!channelTarget && !m_spellInfo->NeedsExplicitUnitTarget()) if (m_UniqueTargetInfo.size() + m_UniqueGOTargetInfo.size() == 1) // this is for TARGET_SELECT_CATEGORY_NEARBY channelTarget = !m_UniqueTargetInfo.empty() ? m_UniqueTargetInfo.front().targetGUID : m_UniqueGOTargetInfo.front().targetGUID; WorldPacket data(MSG_CHANNEL_START, (8+4+4)); - data.append(m_caster->GetPackGUID()); + data << m_caster->GetPackGUID(); data << uint32(m_spellInfo->Id); data << uint32(duration); @@ -4194,7 +4182,7 @@ void Spell::SendChannelStart(uint32 duration) m_timer = duration; if (channelTarget) - m_caster->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, channelTarget); + m_caster->SetChannelObjectGuid(channelTarget); m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL, m_spellInfo->Id); } @@ -4284,7 +4272,7 @@ void Spell::TakeCastItem() m_targets.SetItemTarget(NULL); m_CastItem = NULL; - m_castItemGUID = 0; + m_castItemGUID.Clear(); m_castItemEntry = 0; } } @@ -4306,7 +4294,7 @@ void Spell::TakePower() if (m_caster->GetTypeId() == TYPEID_PLAYER) { if (powerType == POWER_RAGE || powerType == POWER_ENERGY || powerType == POWER_RUNE) - if (uint64 targetGUID = m_targets.GetUnitTargetGUID()) + if (ObjectGuid targetGUID = m_targets.GetUnitTargetGUID()) for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) if (ihit->targetGUID == targetGUID) { @@ -4530,7 +4518,7 @@ void Spell::TakeReagents() } m_CastItem = NULL; - m_castItemGUID = 0; + m_castItemGUID.Clear(); m_castItemEntry = 0; } @@ -5123,7 +5111,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_targets.GetTargetMask() & TARGET_FLAG_TRADE_ITEM) { if (TradeData* pTrade = m_caster->ToPlayer()->GetTradeData()) - pTempItem = pTrade->GetTraderData()->GetItem(TradeSlots(m_targets.GetItemTargetGUID())); + pTempItem = pTrade->GetTraderData()->GetItem(TradeSlots(m_targets.GetItemTargetGUID().GetRawValue())); // at this point item target guid contains the trade slot } else if (m_targets.GetTargetMask() & TARGET_FLAG_ITEM) pTempItem = m_caster->ToPlayer()->GetItemByGuid(m_targets.GetItemTargetGUID()); @@ -5451,7 +5439,8 @@ SpellCastResult Spell::CheckCast(bool strict) if (!my_trade) return SPELL_FAILED_NOT_TRADING; - TradeSlots slot = TradeSlots(m_targets.GetItemTargetGUID()); + // Item target guid contains trade slot until m_targets.UpdateTradeSlotItem() is called + TradeSlots slot = TradeSlots(m_targets.GetItemTargetGUID().GetRawValue()); if (slot != TRADE_SLOT_NONTRADED) return SPELL_FAILED_BAD_TARGETS; @@ -5633,7 +5622,7 @@ SpellCastResult Spell::CheckCasterAuras() const bool Spell::CanAutoCast(Unit* target) { - uint64 targetguid = target->GetGUID(); + ObjectGuid targetguid = target->GetGUID(); for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j) { @@ -6311,7 +6300,7 @@ void Spell::Delayed() // only called in DealDamage() TC_LOG_INFO("spells", "Spell %u partially interrupted for (%d) ms at damage", m_spellInfo->Id, delaytime); WorldPacket data(SMSG_SPELL_DELAYED, 8+4); - data.append(m_caster->GetPackGUID()); + data << m_caster->GetPackGUID(); data << uint32(delaytime); m_caster->SendMessageToSet(&data, true); @@ -6486,7 +6475,7 @@ bool Spell::CheckEffectTarget(Unit const* target, uint32 eff, Position const* lo { // Get GO cast coordinates if original caster -> GO WorldObject* caster = NULL; - if (IS_GAMEOBJECT_GUID(m_originalCasterGUID)) + if (m_originalCasterGUID.IsGameObject()) caster = m_caster->GetMap()->GetGameObject(m_originalCasterGUID); if (!caster) caster = m_caster; diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index e1e16100141..372e7d239a2 100644 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -91,7 +91,7 @@ struct SpellDestination void RelocateOffset(Position const& offset); WorldLocation _position; - uint64 _transportGUID; + ObjectGuid _transportGUID; Position _transportOffset; }; @@ -109,22 +109,22 @@ class SpellCastTargets void SetTargetFlag(SpellCastTargetFlags flag) { m_targetMask |= flag; } - uint64 GetUnitTargetGUID() const; + ObjectGuid GetUnitTargetGUID() const; Unit* GetUnitTarget() const; void SetUnitTarget(Unit* target); - uint64 GetGOTargetGUID() const; + ObjectGuid GetGOTargetGUID() const; GameObject* GetGOTarget() const; void SetGOTarget(GameObject* target); - uint64 GetCorpseTargetGUID() const; + ObjectGuid GetCorpseTargetGUID() const; Corpse* GetCorpseTarget() const; WorldObject* GetObjectTarget() const; - uint64 GetObjectTargetGUID() const; + ObjectGuid GetObjectTargetGUID() const; void RemoveObjectTarget(); - uint64 GetItemTargetGUID() const { return m_itemTargetGUID; } + ObjectGuid GetItemTargetGUID() const { return m_itemTargetGUID; } Item* GetItemTarget() const { return m_itemTarget; } uint32 GetItemTargetEntry() const { return m_itemTargetEntry; } void SetItemTarget(Item* item); @@ -174,8 +174,8 @@ class SpellCastTargets Item* m_itemTarget; // object GUID/etc, can be used always - uint64 m_objectTargetGUID; - uint64 m_itemTargetGUID; + ObjectGuid m_objectTargetGUID; + ObjectGuid m_itemTargetGUID; uint32 m_itemTargetEntry; SpellDestination m_src; @@ -212,6 +212,8 @@ enum SpellEffectHandleMode SPELL_EFFECT_HANDLE_HIT_TARGET }; +typedef std::list<std::pair<uint32, ObjectGuid>> DispelList; + class Spell { friend void Unit::SetCurrentCastSpell(Spell* pSpell); @@ -346,7 +348,7 @@ class Spell typedef std::set<Aura*> UsedSpellMods; - Spell(Unit* caster, SpellInfo const* info, TriggerCastFlags triggerFlags, uint64 originalCasterGUID = 0, bool skipCheck = false); + Spell(Unit* caster, SpellInfo const* info, TriggerCastFlags triggerFlags, ObjectGuid originalCasterGUID = ObjectGuid::Empty, bool skipCheck = false); ~Spell(); void InitExplicitTargets(SpellCastTargets const& targets); @@ -450,7 +452,7 @@ class Spell SpellInfo const* const m_spellInfo; Item* m_CastItem; - uint64 m_castItemGUID; + ObjectGuid m_castItemGUID; uint32 m_castItemEntry; uint8 m_cast_count; uint32 m_glyphIndex; @@ -497,13 +499,13 @@ class Spell void TriggerGlobalCooldown(); void CancelGlobalCooldown(); - void SendLoot(uint64 guid, LootType loottype); + void SendLoot(ObjectGuid guid, LootType loottype); Unit* const m_caster; SpellValue* const m_spellValue; - uint64 m_originalCasterGUID; // real source of cast (aura caster/etc), used for spell targets selection + ObjectGuid m_originalCasterGUID; // real source of cast (aura caster/etc), used for spell targets selection // e.g. damage around area spell trigered by victim aura and damage enemies of aura caster Unit* m_originalCaster; // cached pointer for m_originalCaster, updated at Spell::UpdatePointers() @@ -576,7 +578,7 @@ class Spell // Targets store structures and data struct TargetInfo { - uint64 targetGUID; + ObjectGuid targetGUID; uint64 timeDelay; SpellMissInfo missCondition:8; SpellMissInfo reflectResult:8; @@ -592,7 +594,7 @@ class Spell struct GOTargetInfo { - uint64 targetGUID; + ObjectGuid targetGUID; uint64 timeDelay; uint8 effectMask:8; bool processed:1; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index adc120ade49..8cd1cb38fcd 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -1416,7 +1416,7 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/) if (!targetAura) { - TC_LOG_ERROR("spells", "Target(GUID:" UI64FMTD ") has aurastate AURA_STATE_SWIFTMEND but no matching aura.", unitTarget->GetGUID()); + TC_LOG_ERROR("spells", "Target (%s) has aurastate AURA_STATE_SWIFTMEND but no matching aura.", unitTarget->GetGUID().ToString().c_str()); return; } @@ -1628,7 +1628,7 @@ void Spell::DoCreateItem(uint32 /*i*/, uint32 itemtype) // set the "Crafted by ..." property of the item if (pItem->GetTemplate()->Class != ITEM_CLASS_CONSUMABLE && pItem->GetTemplate()->Class != ITEM_CLASS_QUEST && newitemid != 6265 && newitemid != 6948) - pItem->SetUInt32Value(ITEM_FIELD_CREATOR, player->GetGUIDLow()); + pItem->SetGuidValue(ITEM_FIELD_CREATOR, player->GetGUID()); // send info to the client player->SendNewItem(pItem, num_to_add, true, bgType == 0); @@ -1881,7 +1881,7 @@ void Spell::EffectEnergizePct(SpellEffIndex effIndex) m_caster->EnergizeBySpell(unitTarget, m_spellInfo->Id, gain, power); } -void Spell::SendLoot(uint64 guid, LootType loottype) +void Spell::SendLoot(ObjectGuid guid, LootType loottype) { Player* player = m_caster->ToPlayer(); if (!player) @@ -1963,7 +1963,7 @@ void Spell::EffectOpenLock(SpellEffIndex effIndex) Player* player = m_caster->ToPlayer(); uint32 lockId = 0; - uint64 guid = 0; + ObjectGuid guid; // Get lockId if (gameObjTarget) @@ -2106,7 +2106,7 @@ void Spell::EffectSummonChangeItem(SpellEffIndex effIndex) m_targets.SetItemTarget(NULL); m_CastItem = NULL; - m_castItemGUID = 0; + m_castItemGUID.Clear(); m_castItemEntry = 0; player->StoreItem(dest, pNewItem, true); @@ -2126,7 +2126,7 @@ void Spell::EffectSummonChangeItem(SpellEffIndex effIndex) m_targets.SetItemTarget(NULL); m_CastItem = NULL; - m_castItemGUID = 0; + m_castItemGUID.Clear(); m_castItemEntry = 0; player->BankItem(dest, pNewItem, true); @@ -2150,7 +2150,7 @@ void Spell::EffectSummonChangeItem(SpellEffIndex effIndex) m_targets.SetItemTarget(NULL); m_CastItem = NULL; - m_castItemGUID = 0; + m_castItemGUID.Clear(); m_castItemEntry = 0; player->EquipItem(dest, pNewItem, true); @@ -2388,7 +2388,6 @@ void Spell::EffectLearnSpell(SpellEffIndex effIndex) TC_LOG_DEBUG("spells", "Spell: Player %u has learned spell %u from NpcGUID=%u", player->GetGUIDLow(), spellToLearn, m_caster->GetGUIDLow()); } -typedef std::list< std::pair<uint32, uint64> > DispelList; void Spell::EffectDispel(SpellEffIndex effIndex) { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) @@ -2467,8 +2466,8 @@ void Spell::EffectDispel(SpellEffIndex effIndex) WorldPacket dataSuccess(SMSG_SPELLDISPELLOG, 8+8+4+1+4+success_list.size()*5); // Send packet header - dataSuccess.append(unitTarget->GetPackGUID()); // Victim GUID - dataSuccess.append(m_caster->GetPackGUID()); // Caster GUID + dataSuccess << unitTarget->GetPackGUID(); // Victim GUID + dataSuccess << m_caster->GetPackGUID(); // Caster GUID dataSuccess << uint32(m_spellInfo->Id); // dispel spell id dataSuccess << uint8(0); // not used dataSuccess << uint32(success_list.size()); // count @@ -2578,7 +2577,7 @@ void Spell::EffectUntrainTalents(SpellEffIndex /*effIndex*/) if (!unitTarget || m_caster->GetTypeId() == TYPEID_PLAYER) return; - if (uint64 guid = m_caster->GetGUID()) // the trainer is the caster + if (ObjectGuid guid = m_caster->GetGUID()) // the trainer is the caster unitTarget->ToPlayer()->SendTalentWipeConfirm(guid); } @@ -4208,8 +4207,8 @@ void Spell::EffectDuel(SpellEffIndex effIndex) duel2->isMounted = (GetSpellInfo()->Id == 62875); // Mounted Duel target->duel = duel2; - caster->SetUInt64Value(PLAYER_DUEL_ARBITER, pGameObj->GetGUID()); - target->SetUInt64Value(PLAYER_DUEL_ARBITER, pGameObj->GetGUID()); + caster->SetGuidValue(PLAYER_DUEL_ARBITER, pGameObj->GetGUID()); + target->SetGuidValue(PLAYER_DUEL_ARBITER, pGameObj->GetGUID()); sScriptMgr->OnPlayerDuelRequest(target, caster); } @@ -4485,7 +4484,7 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex) uint32 go_id = m_spellInfo->Effects[effIndex].MiscValue; uint8 slot = m_spellInfo->Effects[effIndex].Effect - SPELL_EFFECT_SUMMON_OBJECT_SLOT1; - if (uint64 guid = m_caster->m_ObjectSlot[slot]) + if (ObjectGuid guid = m_caster->m_ObjectSlot[slot]) { if (GameObject* obj = m_caster->GetMap()->GetGameObject(guid)) { @@ -4494,7 +4493,7 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex) obj->SetSpellId(0); m_caster->RemoveGameObject(obj, true); } - m_caster->m_ObjectSlot[slot] = 0; + m_caster->m_ObjectSlot[slot].Clear(); } GameObject* go = new GameObject(); @@ -4915,9 +4914,7 @@ void Spell::EffectDispelMechanic(SpellEffIndex effIndex) return; uint32 mechanic = m_spellInfo->Effects[effIndex].MiscValue; - - std::queue < std::pair < uint32, uint64 > > dispel_list; - + DispelList dispel_list; Unit::AuraMap const& auras = unitTarget->GetOwnedAuras(); for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) { @@ -4926,12 +4923,13 @@ void Spell::EffectDispelMechanic(SpellEffIndex effIndex) continue; if (roll_chance_i(aura->CalcDispelChance(unitTarget, !unitTarget->IsFriendlyTo(m_caster)))) if ((aura->GetSpellInfo()->GetAllEffectsMechanicMask() & (1 << mechanic))) - dispel_list.push(std::make_pair(aura->GetId(), aura->GetCasterGUID())); + dispel_list.push_back(std::make_pair(aura->GetId(), aura->GetCasterGUID())); } - for (; dispel_list.size(); dispel_list.pop()) + while (!dispel_list.empty()) { unitTarget->RemoveAura(dispel_list.front().first, dispel_list.front().second, 0, AURA_REMOVE_BY_ENEMY_SPELL); + dispel_list.pop_front(); } } @@ -5150,7 +5148,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex) { case GAMEOBJECT_TYPE_FISHINGNODE: { - m_caster->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, pGameObj->GetGUID()); + m_caster->SetChannelObjectGuid(pGameObj->GetGUID()); m_caster->AddGameObject(pGameObj); // will removed at spell cancel // end time of range when possible catch fish (FISHING_BOBBER_READY_TIME..GetDuration(m_spellInfo)) @@ -5411,8 +5409,8 @@ void Spell::EffectStealBeneficialBuff(SpellEffIndex effIndex) return; WorldPacket dataSuccess(SMSG_SPELLSTEALLOG, 8+8+4+1+4+damage*5); - dataSuccess.append(unitTarget->GetPackGUID()); // Victim GUID - dataSuccess.append(m_caster->GetPackGUID()); // Caster GUID + dataSuccess << unitTarget->GetPackGUID(); // Victim GUID + dataSuccess << m_caster->GetPackGUID(); // Caster GUID dataSuccess << uint32(m_spellInfo->Id); // dispel spell id dataSuccess << uint8(0); // not used dataSuccess << uint32(success_list.size()); // count @@ -5433,7 +5431,7 @@ void Spell::EffectKillCreditPersonal(SpellEffIndex effIndex) if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; - unitTarget->ToPlayer()->KilledMonsterCredit(m_spellInfo->Effects[effIndex].MiscValue, 0); + unitTarget->ToPlayer()->KilledMonsterCredit(m_spellInfo->Effects[effIndex].MiscValue); } void Spell::EffectKillCredit(SpellEffIndex effIndex) diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index 7132e0583e8..8ab3a72b47e 100644 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -972,7 +972,7 @@ uint32 AuraScript::GetId() const return m_aura->GetId(); } -uint64 AuraScript::GetCasterGUID() const +ObjectGuid AuraScript::GetCasterGUID() const { return m_aura->GetCasterGUID(); } diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index 756644dbd1b..653ae9ab5e9 100644 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -797,7 +797,7 @@ class AuraScript : public _SpellScript uint32 GetId() const; // returns guid of object which cast the aura (m_originalCaster of the Spell class) - uint64 GetCasterGUID() const; + ObjectGuid GetCasterGUID() const; // returns unit which cast the aura or NULL if not avalible (caster logged out for example) Unit* GetCaster() const; // returns object on which aura was cast, target for non-area auras, area aura source for area auras diff --git a/src/server/game/Texts/CreatureTextMgr.h b/src/server/game/Texts/CreatureTextMgr.h index 18dc7683b8d..49d83b91353 100644 --- a/src/server/game/Texts/CreatureTextMgr.h +++ b/src/server/game/Texts/CreatureTextMgr.h @@ -78,7 +78,7 @@ typedef std::map<CreatureTextId, CreatureTextLocale> LocaleCreatureTextMap; //used for handling non-repeatable random texts typedef std::vector<uint8> CreatureTextRepeatIds; typedef std::unordered_map<uint8, CreatureTextRepeatIds> CreatureTextRepeatGroup; -typedef std::unordered_map<uint64, CreatureTextRepeatGroup> CreatureTextRepeatMap;//guid based +typedef std::unordered_map<ObjectGuid, CreatureTextRepeatGroup> CreatureTextRepeatMap;//guid based class CreatureTextMgr { @@ -165,7 +165,7 @@ class CreatureTextLocalizer { case CHAT_MSG_MONSTER_WHISPER: case CHAT_MSG_RAID_BOSS_WHISPER: - data.put<uint64>(whisperGUIDpos, player->GetGUID()); + data.put<uint64>(whisperGUIDpos, player->GetGUID().GetRawValue()); break; default: break; diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp index d1f45ba88bf..93e6d152800 100644 --- a/src/server/game/Tickets/TicketMgr.cpp +++ b/src/server/game/Tickets/TicketMgr.cpp @@ -32,12 +32,12 @@ inline float GetAge(uint64 t) { return float(time(NULL) - t) / DAY; } /////////////////////////////////////////////////////////////////////////////////////////////////// // GM ticket -GmTicket::GmTicket() : _id(0), _playerGuid(0), _posX(0), _posY(0), _posZ(0), _mapId(0), _createTime(0), _lastModifiedTime(0), - _closedBy(0), _assignedTo(0), _completed(false), _escalatedStatus(TICKET_UNASSIGNED), _viewed(false), +GmTicket::GmTicket() : _id(0), _posX(0), _posY(0), _posZ(0), _mapId(0), _createTime(0), _lastModifiedTime(0), + _completed(false), _escalatedStatus(TICKET_UNASSIGNED), _viewed(false), _needResponse(false), _needMoreHelp(false) { } GmTicket::GmTicket(Player* player) : _posX(0), _posY(0), _posZ(0), _mapId(0), _createTime(time(NULL)), _lastModifiedTime(time(NULL)), - _closedBy(0), _assignedTo(0), _completed(false), _escalatedStatus(TICKET_UNASSIGNED), _viewed(false), + _completed(false), _escalatedStatus(TICKET_UNASSIGNED), _viewed(false), _needResponse(false), _needMoreHelp(false) { _id = sTicketMgr->GenerateTicketId(); @@ -53,7 +53,7 @@ bool GmTicket::LoadFromDB(Field* fields) // ticketId, guid, name, message, createTime, mapId, posX, posY, posZ, lastModifiedTime, closedBy, assignedTo, comment, response, completed, escalated, viewed, haveTicket uint8 index = 0; _id = fields[ index].GetUInt32(); - _playerGuid = MAKE_NEW_GUID(fields[++index].GetUInt32(), 0, HIGHGUID_PLAYER); + _playerGuid = ObjectGuid(HIGHGUID_PLAYER, fields[++index].GetUInt32()); _playerName = fields[++index].GetString(); _message = fields[++index].GetString(); _createTime = fields[++index].GetUInt32(); @@ -62,8 +62,8 @@ bool GmTicket::LoadFromDB(Field* fields) _posY = fields[++index].GetFloat(); _posZ = fields[++index].GetFloat(); _lastModifiedTime = fields[++index].GetUInt32(); - _closedBy = fields[++index].GetInt32(); - _assignedTo = MAKE_NEW_GUID(fields[++index].GetUInt32(), 0, HIGHGUID_PLAYER); + _closedBy = ObjectGuid(uint64(fields[++index].GetInt32())); + _assignedTo = ObjectGuid(HIGHGUID_PLAYER, fields[++index].GetUInt32()); _comment = fields[++index].GetString(); _response = fields[++index].GetString(); _completed = fields[++index].GetBool(); @@ -80,7 +80,7 @@ void GmTicket::SaveToDB(SQLTransaction& trans) const uint8 index = 0; PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_GM_TICKET); stmt->setUInt32( index, _id); - stmt->setUInt32(++index, GUID_LOPART(_playerGuid)); + stmt->setUInt32(++index, _playerGuid.GetCounter()); stmt->setString(++index, _playerName); stmt->setString(++index, _message); stmt->setUInt32(++index, uint32(_createTime)); @@ -89,8 +89,8 @@ void GmTicket::SaveToDB(SQLTransaction& trans) const stmt->setFloat (++index, _posY); stmt->setFloat (++index, _posZ); stmt->setUInt32(++index, uint32(_lastModifiedTime)); - stmt->setInt32 (++index, GUID_LOPART(_closedBy)); - stmt->setUInt32(++index, GUID_LOPART(_assignedTo)); + stmt->setInt32 (++index, int32(_closedBy.GetCounter())); + stmt->setUInt32(++index, _assignedTo.GetCounter()); stmt->setString(++index, _comment); stmt->setString(++index, _response); stmt->setBool (++index, _completed); @@ -199,7 +199,7 @@ std::string GmTicket::FormatMessageString(ChatHandler& handler, const char* szCl void GmTicket::SetUnassigned() { - _assignedTo = 0; + _assignedTo.Clear(); switch (_escalatedStatus) { case TICKET_ASSIGNED: _escalatedStatus = TICKET_UNASSIGNED; break; @@ -349,7 +349,7 @@ void TicketMgr::AddTicket(GmTicket* ticket) ticket->SaveToDB(trans); } -void TicketMgr::CloseTicket(uint32 ticketId, int64 source) +void TicketMgr::CloseTicket(uint32 ticketId, ObjectGuid source) { if (GmTicket* ticket = GetTicket(ticketId)) { diff --git a/src/server/game/Tickets/TicketMgr.h b/src/server/game/Tickets/TicketMgr.h index 8b1c8fbc0f9..d9b9b68d133 100644 --- a/src/server/game/Tickets/TicketMgr.h +++ b/src/server/game/Tickets/TicketMgr.h @@ -84,19 +84,19 @@ public: GmTicket(Player* player); ~GmTicket(); - bool IsClosed() const { return _closedBy != 0; } + bool IsClosed() const { return !_closedBy.IsEmpty(); } bool IsCompleted() const { return _completed; } - bool IsFromPlayer(uint64 guid) const { return guid == _playerGuid; } - bool IsAssigned() const { return _assignedTo != 0; } - bool IsAssignedTo(uint64 guid) const { return guid == _assignedTo; } - bool IsAssignedNotTo(uint64 guid) const { return IsAssigned() && !IsAssignedTo(guid); } + bool IsFromPlayer(ObjectGuid guid) const { return guid == _playerGuid; } + bool IsAssigned() const { return !_assignedTo.IsEmpty(); } + bool IsAssignedTo(ObjectGuid guid) const { return guid == _assignedTo; } + bool IsAssignedNotTo(ObjectGuid guid) const { return IsAssigned() && !IsAssignedTo(guid); } uint32 GetId() const { return _id; } Player* GetPlayer() const { return ObjectAccessor::FindPlayer(_playerGuid); } std::string const& GetPlayerName() const { return _playerName; } std::string const& GetMessage() const { return _message; } Player* GetAssignedPlayer() const { return ObjectAccessor::FindPlayer(_assignedTo); } - uint64 GetAssignedToGUID() const { return _assignedTo; } + ObjectGuid GetAssignedToGUID() const { return _assignedTo; } std::string GetAssignedToName() const { std::string name; @@ -110,7 +110,7 @@ public: GMTicketEscalationStatus GetEscalatedStatus() const { return _escalatedStatus; } void SetEscalatedStatus(GMTicketEscalationStatus escalatedStatus) { _escalatedStatus = escalatedStatus; } - void SetAssignedTo(uint64 guid, bool isAdmin) + void SetAssignedTo(ObjectGuid guid, bool isAdmin) { _assignedTo = guid; if (isAdmin && _escalatedStatus == TICKET_IN_ESCALATION_QUEUE) @@ -118,7 +118,7 @@ public: else if (_escalatedStatus == TICKET_UNASSIGNED) _escalatedStatus = TICKET_ASSIGNED; } - void SetClosedBy(int64 value) { _closedBy = value; } + void SetClosedBy(ObjectGuid value) { _closedBy = value; } void SetCompleted() { _completed = true; } void SetMessage(std::string const& message) { @@ -149,7 +149,7 @@ public: private: uint32 _id; - uint64 _playerGuid; + ObjectGuid _playerGuid; std::string _playerName; float _posX; float _posY; @@ -158,8 +158,8 @@ private: std::string _message; uint64 _createTime; uint64 _lastModifiedTime; - int64 _closedBy; // 0 = Open, -1 = Console, playerGuid = player abandoned ticket, other = GM who closed it. - uint64 _assignedTo; + ObjectGuid _closedBy; // 0 = Open, -1 = Console, playerGuid = player abandoned ticket, other = GM who closed it. + ObjectGuid _assignedTo; std::string _comment; bool _completed; GMTicketEscalationStatus _escalatedStatus; @@ -196,7 +196,7 @@ public: return NULL; } - GmTicket* GetTicketByPlayer(uint64 playerGuid) + GmTicket* GetTicketByPlayer(ObjectGuid playerGuid) { for (GmTicketList::const_iterator itr = _ticketList.begin(); itr != _ticketList.end(); ++itr) if (itr->second && itr->second->IsFromPlayer(playerGuid) && !itr->second->IsClosed()) @@ -215,7 +215,7 @@ public: } void AddTicket(GmTicket* ticket); - void CloseTicket(uint32 ticketId, int64 source = -1); + void CloseTicket(uint32 ticketId, ObjectGuid source); void RemoveTicket(uint32 ticketId); bool GetStatus() const { return _status; } diff --git a/src/server/game/Tools/PlayerDump.cpp b/src/server/game/Tools/PlayerDump.cpp index 6cec8ba0220..887a79fc9f9 100644 --- a/src/server/game/Tools/PlayerDump.cpp +++ b/src/server/game/Tools/PlayerDump.cpp @@ -676,7 +676,7 @@ DumpReturn PlayerDumpReader::LoadDump(std::string const& file, uint32 account, s CharacterDatabase.CommitTransaction(trans); // in case of name conflict player has to rename at login anyway - sWorld->AddCharacterNameData(guid, name, gender, race, playerClass, level); + sWorld->AddCharacterNameData(ObjectGuid(HIGHGUID_PLAYER, guid), name, gender, race, playerClass, level); sObjectMgr->_hiItemGuid += items.size(); sObjectMgr->_mailId += mails.size(); diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 35ad588c0aa..a34362ddacc 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -3118,15 +3118,15 @@ void World::ProcessQueryCallbacks() } /** -* @brief Loads several pieces of information on server startup with the low GUID +* @brief Loads several pieces of information on server startup with the GUID * There is no further database query necessary. * These are a number of methods that work into the calling function. * -* @param guid Requires a lowGUID to call +* @param guid Requires a guid to call * @return Name, Gender, Race, Class and Level of player character * Example Usage: * @code -* CharacterNameData const* nameData = sWorld->GetCharacterNameData(lowGUID); +* CharacterNameData const* nameData = sWorld->GetCharacterNameData(GUID); * if (!nameData) * return; * @@ -3154,7 +3154,7 @@ void World::LoadCharacterNameData() do { Field* fields = result->Fetch(); - AddCharacterNameData(fields[0].GetUInt32(), fields[1].GetString(), + AddCharacterNameData(ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32()), fields[1].GetString(), fields[3].GetUInt8() /*gender*/, fields[2].GetUInt8() /*race*/, fields[4].GetUInt8() /*class*/, fields[5].GetUInt8() /*level*/); ++count; } while (result->NextRow()); @@ -3162,7 +3162,7 @@ void World::LoadCharacterNameData() TC_LOG_INFO("server.loading", "Loaded name data for %u characters", count); } -void World::AddCharacterNameData(uint32 guid, std::string const& name, uint8 gender, uint8 race, uint8 playerClass, uint8 level) +void World::AddCharacterNameData(ObjectGuid guid, std::string const& name, uint8 gender, uint8 race, uint8 playerClass, uint8 level) { CharacterNameData& data = _characterNameDataMap[guid]; data.m_name = name; @@ -3172,9 +3172,9 @@ void World::AddCharacterNameData(uint32 guid, std::string const& name, uint8 gen data.m_level = level; } -void World::UpdateCharacterNameData(uint32 guid, std::string const& name, uint8 gender /*= GENDER_NONE*/, uint8 race /*= RACE_NONE*/) +void World::UpdateCharacterNameData(ObjectGuid guid, std::string const& name, uint8 gender /*= GENDER_NONE*/, uint8 race /*= RACE_NONE*/) { - std::map<uint32, CharacterNameData>::iterator itr = _characterNameDataMap.find(guid); + std::map<ObjectGuid, CharacterNameData>::iterator itr = _characterNameDataMap.find(guid); if (itr == _characterNameDataMap.end()) return; @@ -3187,22 +3187,22 @@ void World::UpdateCharacterNameData(uint32 guid, std::string const& name, uint8 itr->second.m_race = race; WorldPacket data(SMSG_INVALIDATE_PLAYER, 8); - data << MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER); + data << guid; SendGlobalMessage(&data); } -void World::UpdateCharacterNameDataLevel(uint32 guid, uint8 level) +void World::UpdateCharacterNameDataLevel(ObjectGuid guid, uint8 level) { - std::map<uint32, CharacterNameData>::iterator itr = _characterNameDataMap.find(guid); + std::map<ObjectGuid, CharacterNameData>::iterator itr = _characterNameDataMap.find(guid); if (itr == _characterNameDataMap.end()) return; itr->second.m_level = level; } -CharacterNameData const* World::GetCharacterNameData(uint32 guid) const +CharacterNameData const* World::GetCharacterNameData(ObjectGuid guid) const { - std::map<uint32, CharacterNameData>::const_iterator itr = _characterNameDataMap.find(guid); + std::map<ObjectGuid, CharacterNameData>::const_iterator itr = _characterNameDataMap.find(guid); if (itr != _characterNameDataMap.end()) return &itr->second; else diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index cc2078bc736..6394fa42327 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -24,6 +24,7 @@ #define __WORLD_H #include "Common.h" +#include "ObjectGuid.h" #include "Timer.h" #include "SharedDefines.h" #include "QueryResult.h" @@ -737,12 +738,12 @@ class World void UpdateAreaDependentAuras(); - CharacterNameData const* GetCharacterNameData(uint32 guid) const; - void AddCharacterNameData(uint32 guid, std::string const& name, uint8 gender, uint8 race, uint8 playerClass, uint8 level); - void UpdateCharacterNameData(uint32 guid, std::string const& name, uint8 gender = GENDER_NONE, uint8 race = RACE_NONE); - void UpdateCharacterNameDataLevel(uint32 guid, uint8 level); - void DeleteCharacterNameData(uint32 guid) { _characterNameDataMap.erase(guid); } - bool HasCharacterNameData(uint32 guid) { return _characterNameDataMap.find(guid) != _characterNameDataMap.end(); } + CharacterNameData const* GetCharacterNameData(ObjectGuid guid) const; + void AddCharacterNameData(ObjectGuid guid, std::string const& name, uint8 gender, uint8 race, uint8 playerClass, uint8 level); + void UpdateCharacterNameData(ObjectGuid guid, std::string const& name, uint8 gender = GENDER_NONE, uint8 race = RACE_NONE); + void UpdateCharacterNameDataLevel(ObjectGuid guid, uint8 level); + void DeleteCharacterNameData(ObjectGuid guid) { _characterNameDataMap.erase(guid); } + bool HasCharacterNameData(ObjectGuid guid) { return _characterNameDataMap.find(guid) != _characterNameDataMap.end(); } uint32 GetCleaningFlags() const { return m_CleaningFlags; } void SetCleaningFlags(uint32 flags) { m_CleaningFlags = flags; } @@ -847,7 +848,7 @@ class World typedef std::map<uint8, uint8> AutobroadcastsWeightMap; AutobroadcastsWeightMap m_AutobroadcastsWeights; - std::map<uint32, CharacterNameData> _characterNameDataMap; + std::map<ObjectGuid, CharacterNameData> _characterNameDataMap; void LoadCharacterNameData(); void ProcessQueryCallbacks(); diff --git a/src/server/scripts/Commands/cs_arena.cpp b/src/server/scripts/Commands/cs_arena.cpp index 5658701bd54..4db7c088d35 100644 --- a/src/server/scripts/Commands/cs_arena.cpp +++ b/src/server/scripts/Commands/cs_arena.cpp @@ -103,7 +103,7 @@ public: } sArenaTeamMgr->AddArenaTeam(arena); - handler->PSendSysMessage(LANG_ARENA_CREATE, arena->GetName().c_str(), arena->GetId(), arena->GetType(), arena->GetCaptain()); + handler->PSendSysMessage(LANG_ARENA_CREATE, arena->GetName().c_str(), arena->GetId(), arena->GetType(), arena->GetCaptain().GetCounter()); } else { @@ -232,7 +232,7 @@ public: return false; Player* target; - uint64 targetGuid; + ObjectGuid targetGuid; if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid)) return false; @@ -275,7 +275,7 @@ public: arena->SetCaptain(targetGuid); - CharacterNameData const* oldCaptainNameData = sWorld->GetCharacterNameData(GUID_LOPART(arena->GetCaptain())); + CharacterNameData const* oldCaptainNameData = sWorld->GetCharacterNameData(arena->GetCaptain()); if (!oldCaptainNameData) { handler->SetSentErrorMessage(true); @@ -313,7 +313,7 @@ public: handler->PSendSysMessage(LANG_ARENA_INFO_HEADER, arena->GetName().c_str(), arena->GetId(), arena->GetRating(), arena->GetType(), arena->GetType()); for (ArenaTeam::MemberList::iterator itr = arena->m_membersBegin(); itr != arena->m_membersEnd(); ++itr) - handler->PSendSysMessage(LANG_ARENA_INFO_MEMBERS, itr->Name.c_str(), GUID_LOPART(itr->Guid), itr->PersonalRating, (arena->GetCaptain() == itr->Guid ? "- Captain" : "")); + handler->PSendSysMessage(LANG_ARENA_INFO_MEMBERS, itr->Name.c_str(), itr->Guid.GetCounter(), itr->PersonalRating, (arena->GetCaptain() == itr->Guid ? "- Captain" : "")); return true; } diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp index 7722c330e5f..c6769493020 100644 --- a/src/server/scripts/Commands/cs_character.cpp +++ b/src/server/scripts/Commands/cs_character.cpp @@ -79,7 +79,7 @@ public: // Stores informations about a deleted character struct DeletedInfo { - uint32 lowGuid; ///< the low GUID from the character + ObjectGuid guid; ///< the GUID from the character std::string name; ///< the character name uint32 accountId; ///< the account id std::string accountName; ///< the account name @@ -133,7 +133,7 @@ public: DeletedInfo info; - info.lowGuid = fields[0].GetUInt32(); + info.guid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32()); info.name = fields[1].GetString(); info.accountId = fields[2].GetUInt32(); @@ -173,11 +173,11 @@ public: if (!handler->GetSession()) handler->PSendSysMessage(LANG_CHARACTER_DELETED_LIST_LINE_CONSOLE, - itr->lowGuid, itr->name.c_str(), itr->accountName.empty() ? "<Not existed>" : itr->accountName.c_str(), + itr->guid.GetCounter(), itr->name.c_str(), itr->accountName.empty() ? "<Not existed>" : itr->accountName.c_str(), itr->accountId, dateStr.c_str()); else handler->PSendSysMessage(LANG_CHARACTER_DELETED_LIST_LINE_CHAT, - itr->lowGuid, itr->name.c_str(), itr->accountName.empty() ? "<Not existed>" : itr->accountName.c_str(), + itr->guid.GetCounter(), itr->name.c_str(), itr->accountName.empty() ? "<Not existed>" : itr->accountName.c_str(), itr->accountId, dateStr.c_str()); } @@ -199,7 +199,7 @@ public: { if (delInfo.accountName.empty()) // account not exist { - handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_ACCOUNT, delInfo.name.c_str(), delInfo.lowGuid, delInfo.accountId); + handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_ACCOUNT, delInfo.name.c_str(), delInfo.guid.GetCounter(), delInfo.accountId); return; } @@ -207,29 +207,29 @@ public: uint32 charcount = AccountMgr::GetCharactersCount(delInfo.accountId); if (charcount >= 10) { - handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_FULL, delInfo.name.c_str(), delInfo.lowGuid, delInfo.accountId); + handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_FULL, delInfo.name.c_str(), delInfo.guid.GetCounter(), delInfo.accountId); return; } if (sObjectMgr->GetPlayerGUIDByName(delInfo.name)) { - handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_NAME, delInfo.name.c_str(), delInfo.lowGuid, delInfo.accountId); + handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_NAME, delInfo.name.c_str(), delInfo.guid.GetCounter(), delInfo.accountId); return; } PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_RESTORE_DELETE_INFO); stmt->setString(0, delInfo.name); stmt->setUInt32(1, delInfo.accountId); - stmt->setUInt32(2, delInfo.lowGuid); + stmt->setUInt32(2, delInfo.guid.GetCounter()); CharacterDatabase.Execute(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME_DATA); - stmt->setUInt32(0, delInfo.lowGuid); + stmt->setUInt32(0, delInfo.guid.GetCounter()); if (PreparedQueryResult result = CharacterDatabase.Query(stmt)) - sWorld->AddCharacterNameData(delInfo.lowGuid, delInfo.name, (*result)[2].GetUInt8(), (*result)[0].GetUInt8(), (*result)[1].GetUInt8(), (*result)[3].GetUInt8()); + sWorld->AddCharacterNameData(delInfo.guid, delInfo.name, (*result)[2].GetUInt8(), (*result)[0].GetUInt8(), (*result)[1].GetUInt8(), (*result)[3].GetUInt8()); } - static void HandleCharacterLevel(Player* player, uint64 playerGuid, uint32 oldLevel, uint32 newLevel, ChatHandler* handler) + static void HandleCharacterLevel(Player* player, ObjectGuid playerGuid, uint32 oldLevel, uint32 newLevel, ChatHandler* handler) { if (player) { @@ -252,7 +252,7 @@ public: // Update level and reset XP, everything else will be updated at login PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_LEVEL); stmt->setUInt8(0, uint8(newLevel)); - stmt->setUInt32(1, GUID_LOPART(playerGuid)); + stmt->setUInt32(1, playerGuid.GetCounter()); CharacterDatabase.Execute(stmt); } } @@ -303,7 +303,7 @@ public: static bool HandleCharacterRenameCommand(ChatHandler* handler, char const* args) { Player* target; - uint64 targetGuid; + ObjectGuid targetGuid; std::string targetName; if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) return false; @@ -318,7 +318,7 @@ public: if (target) { // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; playerOldName = target->GetName(); @@ -368,7 +368,7 @@ public: // Remove declined name from db stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_DECLINED_NAME); - stmt->setUInt32(0, targetGuid); + stmt->setUInt32(0, targetGuid.GetCounter()); CharacterDatabase.Execute(stmt); if (target) @@ -382,7 +382,7 @@ public: { stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_NAME_BY_GUID); stmt->setString(0, newName); - stmt->setUInt32(1, GUID_LOPART(targetGuid)); + stmt->setUInt32(1, targetGuid.GetCounter()); CharacterDatabase.Execute(stmt); } @@ -396,14 +396,14 @@ public: sLog->outCommand(session->GetAccountId(), "GM %s (Account: %u) forced rename %s to player %s (Account: %u)", player->GetName().c_str(), session->GetAccountId(), newName.c_str(), playerOldName.c_str(), sObjectMgr->GetPlayerAccountIdByGUID(targetGuid)); } else - sLog->outCommand(0, "CONSOLE forced rename '%s' to '%s' (GUID: %u)", playerOldName.c_str(), newName.c_str(), GUID_LOPART(targetGuid)); + sLog->outCommand(0, "CONSOLE forced rename '%s' to '%s' (%s)", playerOldName.c_str(), newName.c_str(), targetGuid.ToString().c_str()); } else { if (target) { // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; handler->PSendSysMessage(LANG_RENAME_PLAYER, handler->GetNameLink(target).c_str()); @@ -416,11 +416,11 @@ public: return false; std::string oldNameLink = handler->playerLink(targetName); - handler->PSendSysMessage(LANG_RENAME_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid)); + handler->PSendSysMessage(LANG_RENAME_PLAYER_GUID, oldNameLink.c_str(), targetGuid.GetCounter()); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG); stmt->setUInt16(0, uint16(AT_LOGIN_RENAME)); - stmt->setUInt32(1, GUID_LOPART(targetGuid)); + stmt->setUInt32(1, targetGuid.GetCounter()); CharacterDatabase.Execute(stmt); } } @@ -444,7 +444,7 @@ public: } Player* target; - uint64 targetGuid; + ObjectGuid targetGuid; std::string targetName; if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName)) return false; @@ -472,7 +472,7 @@ public: static bool HandleCharacterCustomizeCommand(ChatHandler* handler, char const* args) { Player* target; - uint64 targetGuid; + ObjectGuid targetGuid; std::string targetName; if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) return false; @@ -488,8 +488,8 @@ public: else { std::string oldNameLink = handler->playerLink(targetName); - stmt->setUInt32(1, GUID_LOPART(targetGuid)); - handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid)); + stmt->setUInt32(1, targetGuid.GetCounter()); + handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), targetGuid.GetCounter()); } CharacterDatabase.Execute(stmt); @@ -499,7 +499,7 @@ public: static bool HandleCharacterChangeFactionCommand(ChatHandler* handler, char const* args) { Player* target; - uint64 targetGuid; + ObjectGuid targetGuid; std::string targetName; if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) @@ -516,8 +516,8 @@ public: else { std::string oldNameLink = handler->playerLink(targetName); - handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid)); - stmt->setUInt32(1, GUID_LOPART(targetGuid)); + handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), targetGuid.GetCounter()); + stmt->setUInt32(1, targetGuid.GetCounter()); } CharacterDatabase.Execute(stmt); @@ -527,7 +527,7 @@ public: static bool HandleCharacterChangeRaceCommand(ChatHandler* handler, char const* args) { Player* target; - uint64 targetGuid; + ObjectGuid targetGuid; std::string targetName; if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) return false; @@ -545,8 +545,8 @@ public: { std::string oldNameLink = handler->playerLink(targetName); /// @todo add text into database - handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid)); - stmt->setUInt32(1, GUID_LOPART(targetGuid)); + handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), targetGuid.GetCounter()); + stmt->setUInt32(1, targetGuid.GetCounter()); } CharacterDatabase.Execute(stmt); @@ -721,7 +721,7 @@ public: // Call the appropriate function to delete them (current account for deleted characters is 0) for (DeletedInfoList::const_iterator itr = foundList.begin(); itr != foundList.end(); ++itr) - Player::DeleteFromDB(itr->lowGuid, 0, false, true); + Player::DeleteFromDB(itr->guid, 0, false, true); return true; } @@ -773,7 +773,7 @@ public: if (!normalizePlayerName(characterName)) return false; - uint64 characterGuid; + ObjectGuid characterGuid; uint32 accountId; Player* player = sObjectAccessor->FindPlayerByName(characterName); @@ -799,7 +799,7 @@ public: AccountMgr::GetName(accountId, accountName); Player::DeleteFromDB(characterGuid, accountId, true, true); - handler->PSendSysMessage(LANG_CHARACTER_DELETED, characterName.c_str(), GUID_LOPART(characterGuid), accountName.c_str(), accountId); + handler->PSendSysMessage(LANG_CHARACTER_DELETED, characterName.c_str(), characterGuid.GetCounter(), accountName.c_str(), accountId); return true; } @@ -818,7 +818,7 @@ public: } Player* target; - uint64 targetGuid; + ObjectGuid targetGuid; std::string targetName; if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName)) return false; @@ -921,7 +921,7 @@ public: return false; } - if (sObjectMgr->GetPlayerAccountIdByGUID(guid)) + if (sObjectMgr->GetPlayerAccountIdByGUID(ObjectGuid(HIGHGUID_PLAYER, guid))) { handler->PSendSysMessage(LANG_CHARACTER_GUID_IN_USE, guid); handler->SetSentErrorMessage(true); @@ -966,10 +966,10 @@ public: if (!fileStr || !playerStr) return false; - uint64 guid; + ObjectGuid guid; // character name can't start from number if (isNumeric(playerStr)) - guid = MAKE_NEW_GUID(atoi(playerStr), 0, HIGHGUID_PLAYER); + guid = ObjectGuid(HIGHGUID_PLAYER, uint32(atoi(playerStr))); else { std::string name = handler->extractPlayerNameFromLink(playerStr); diff --git a/src/server/scripts/Commands/cs_cheat.cpp b/src/server/scripts/Commands/cs_cheat.cpp index b61cf2c54fe..7ab414b0d63 100644 --- a/src/server/scripts/Commands/cs_cheat.cpp +++ b/src/server/scripts/Commands/cs_cheat.cpp @@ -227,7 +227,7 @@ public: if (!chr) chr = handler->GetSession()->GetPlayer(); - else if (handler->HasLowerSecurity(chr, 0)) // check online security + else if (handler->HasLowerSecurity(chr, ObjectGuid::Empty)) // check online security return false; if (argstr == "on") diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 1dc0cdef330..a2c71607eaa 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -239,7 +239,7 @@ public: return false; SellResult msg = SellResult(atoi(args)); - handler->GetSession()->GetPlayer()->SendSellError(msg, 0, 0, 0); + handler->GetSession()->GetPlayer()->SendSellError(msg, nullptr, ObjectGuid::Empty, 0); return true; } @@ -249,7 +249,7 @@ public: return false; BuyResult msg = BuyResult(atoi(args)); - handler->GetSession()->GetPlayer()->SendBuyError(msg, 0, 0, 0); + handler->GetSession()->GetPlayer()->SendBuyError(msg, nullptr, 0, 0); return true; } @@ -361,11 +361,11 @@ public: } else if (type == "appitsguid") { - data.append(unit->GetPackGUID()); + data << unit->GetPackGUID(); } else if (type == "appmyguid") { - data.append(player->GetPackGUID()); + data << player->GetPackGUID(); } else if (type == "appgoguid") { @@ -377,7 +377,7 @@ public: ifs.close(); return false; } - data.append(obj->GetPackGUID()); + data << obj->GetPackGUID(); } else if (type == "goguid") { @@ -558,10 +558,10 @@ public: for (uint8 j = 0; j < bag->GetBagSize(); ++j) if (Item* item2 = bag->GetItemByPos(j)) if (item2->GetState() == state) - handler->PSendSysMessage("bag: 255 slot: %d guid: %d owner: %d", item2->GetSlot(), item2->GetGUIDLow(), GUID_LOPART(item2->GetOwnerGUID())); + handler->PSendSysMessage("bag: 255 slot: %d guid: %d owner: %d", item2->GetSlot(), item2->GetGUIDLow(), item2->GetOwnerGUID().GetCounter()); } else if (item->GetState() == state) - handler->PSendSysMessage("bag: 255 slot: %d guid: %d owner: %d", item->GetSlot(), item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID())); + handler->PSendSysMessage("bag: 255 slot: %d guid: %d owner: %d", item->GetSlot(), item->GetGUIDLow(), item->GetOwnerGUID().GetCounter()); } } } @@ -623,7 +623,7 @@ public: if (item->GetOwnerGUID() != player->GetGUID()) { - handler->PSendSysMessage("The item with slot %d and itemguid %d does have non-matching owner guid (%d) and player guid (%d) !", item->GetSlot(), item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID()), player->GetGUIDLow()); + handler->PSendSysMessage("The item with slot %d and itemguid %d does have non-matching owner guid (%d) and player guid (%d) !", item->GetSlot(), item->GetGUIDLow(), item->GetOwnerGUID().GetCounter(), player->GetGUIDLow()); error = true; continue; } @@ -683,7 +683,7 @@ public: if (item2->GetOwnerGUID() != player->GetGUID()) { - handler->PSendSysMessage("The item in bag %d at slot %d and with itemguid %d, the owner's guid (%d) and the player's guid (%d) don't match!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), GUID_LOPART(item2->GetOwnerGUID()), player->GetGUIDLow()); + handler->PSendSysMessage("The item in bag %d at slot %d and with itemguid %d, the owner's guid (%d) and the player's guid (%d) don't match!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), item2->GetOwnerGUID().GetCounter(), player->GetGUIDLow()); error = true; continue; } @@ -745,7 +745,7 @@ public: if (item->GetOwnerGUID() != player->GetGUID()) { - handler->PSendSysMessage("queue(%zu): For the item with guid %d, the owner's guid (%d) and the player's guid (%d) don't match!", i, item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID()), player->GetGUIDLow()); + handler->PSendSysMessage("queue(%zu): For the item with guid %d, the owner's guid (%d) and the player's guid (%d) don't match!", i, item->GetGUIDLow(), item->GetOwnerGUID().GetCounter(), player->GetGUIDLow()); error = true; continue; } @@ -972,7 +972,7 @@ public: uint32 guid = (uint32)atoi(e); uint32 index = (uint32)atoi(f); - Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(MAKE_NEW_GUID(guid, 0, HIGHGUID_ITEM)); + Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, 0, guid)); if (!i) return false; @@ -1003,7 +1003,7 @@ public: uint32 index = (uint32)atoi(f); uint32 value = (uint32)atoi(g); - Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(MAKE_NEW_GUID(guid, 0, HIGHGUID_ITEM)); + Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, 0, guid)); if (!i) return false; @@ -1027,7 +1027,7 @@ public: uint32 guid = (uint32)atoi(e); - Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(MAKE_NEW_GUID(guid, 0, HIGHGUID_ITEM)); + Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, guid)); if (!i) return false; @@ -1106,12 +1106,12 @@ public: return false; } - uint64 guid = target->GetGUID(); + ObjectGuid guid = target->GetGUID(); uint32 field = (uint32)atoi(x); if (field >= target->GetValuesCount()) { - handler->PSendSysMessage(LANG_TOO_BIG_INDEX, field, GUID_LOPART(guid), target->GetValuesCount()); + handler->PSendSysMessage(LANG_TOO_BIG_INDEX, field, guid.GetCounter(), target->GetValuesCount()); return false; } @@ -1123,13 +1123,13 @@ public: { uint32 value = (uint32)atoi(y); target->SetUInt32Value(field, value); - handler->PSendSysMessage(LANG_SET_UINT_FIELD, GUID_LOPART(guid), field, value); + handler->PSendSysMessage(LANG_SET_UINT_FIELD, guid.GetCounter(), field, value); } else { float value = (float)atof(y); target->SetFloatValue(field, value); - handler->PSendSysMessage(LANG_SET_FLOAT_FIELD, GUID_LOPART(guid), field, value); + handler->PSendSysMessage(LANG_SET_FLOAT_FIELD, guid.GetCounter(), field, value); } return true; @@ -1154,12 +1154,12 @@ public: return false; } - uint64 guid = target->GetGUID(); + ObjectGuid guid = target->GetGUID(); uint32 opcode = (uint32)atoi(x); if (opcode >= target->GetValuesCount()) { - handler->PSendSysMessage(LANG_TOO_BIG_INDEX, opcode, GUID_LOPART(guid), target->GetValuesCount()); + handler->PSendSysMessage(LANG_TOO_BIG_INDEX, opcode, guid.GetCounter(), target->GetValuesCount()); return false; } @@ -1170,12 +1170,12 @@ public: if (isInt32) { uint32 value = target->GetUInt32Value(opcode); - handler->PSendSysMessage(LANG_GET_UINT_FIELD, GUID_LOPART(guid), opcode, value); + handler->PSendSysMessage(LANG_GET_UINT_FIELD, guid.GetCounter(), opcode, value); } else { float value = target->GetFloatValue(opcode); - handler->PSendSysMessage(LANG_GET_FLOAT_FIELD, GUID_LOPART(guid), opcode, value); + handler->PSendSysMessage(LANG_GET_FLOAT_FIELD, guid.GetCounter(), opcode, value); } return true; diff --git a/src/server/scripts/Commands/cs_gm.cpp b/src/server/scripts/Commands/cs_gm.cpp index 90fd0bdd71c..29f8c904f97 100644 --- a/src/server/scripts/Commands/cs_gm.cpp +++ b/src/server/scripts/Commands/cs_gm.cpp @@ -111,7 +111,7 @@ public: handler->SendSysMessage(LANG_USE_BOL); return false; } - data.append(target->GetPackGUID()); + data << target->GetPackGUID(); data << uint32(0); // unknown target->SendMessageToSet(&data, true); handler->PSendSysMessage(LANG_COMMAND_FLYMODE_STATUS, handler->GetNameLink(target).c_str(), args); @@ -211,7 +211,7 @@ public: if (param == "on") { - if (_player->HasAura(VISUAL_AURA, 0)) + if (_player->HasAura(VISUAL_AURA)) _player->RemoveAurasDueToSpell(VISUAL_AURA); _player->SetGMVisible(true); diff --git a/src/server/scripts/Commands/cs_go.cpp b/src/server/scripts/Commands/cs_go.cpp index 44ebb1ea4e0..d2b97e81479 100644 --- a/src/server/scripts/Commands/cs_go.cpp +++ b/src/server/scripts/Commands/cs_go.cpp @@ -140,7 +140,7 @@ public: Transport* transport = NULL; - if (Creature* creature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(guid, id, HIGHGUID_UNIT), (Creature*)NULL)) + if (Creature* creature = ObjectAccessor::GetObjectInWorld(ObjectGuid(HIGHGUID_UNIT, id, guid), (Creature*)NULL)) { x = creature->GetPositionX(); y = creature->GetPositionY(); diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index ed5b39e476d..f3ddc6f0137 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -324,7 +324,7 @@ public: return false; } - GameObject* target = handler->GetSession()->GetPlayer()->GetMap()->GetGameObject(MAKE_NEW_GUID(guidLow, id, HIGHGUID_GAMEOBJECT)); + GameObject* target = handler->GetSession()->GetPlayer()->GetMap()->GetGameObject(ObjectGuid(HIGHGUID_GAMEOBJECT, id, guidLow)); handler->PSendSysMessage(LANG_GAMEOBJECT_DETAIL, guidLow, objectInfo->name.c_str(), guidLow, id, x, y, z, mapId, o, phase); @@ -367,13 +367,13 @@ public: return false; } - uint64 ownerGuid = object->GetOwnerGUID(); + ObjectGuid ownerGuid = object->GetOwnerGUID(); if (ownerGuid) { Unit* owner = ObjectAccessor::GetUnit(*handler->GetSession()->GetPlayer(), ownerGuid); - if (!owner || !IS_PLAYER_GUID(ownerGuid)) + if (!owner || !ownerGuid.IsPlayer()) { - handler->PSendSysMessage(LANG_COMMAND_DELOBJREFERCREATURE, GUID_LOPART(ownerGuid), object->GetGUIDLow()); + handler->PSendSysMessage(LANG_COMMAND_DELOBJREFERCREATURE, ownerGuid.GetCounter(), object->GetGUIDLow()); handler->SetSentErrorMessage(true); return false; } diff --git a/src/server/scripts/Commands/cs_group.cpp b/src/server/scripts/Commands/cs_group.cpp index 470eb27bad2..e39aca6f6a7 100644 --- a/src/server/scripts/Commands/cs_group.cpp +++ b/src/server/scripts/Commands/cs_group.cpp @@ -57,7 +57,7 @@ public: return false; // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; Group* group = target->GetGroup(); @@ -95,7 +95,7 @@ public: continue; // check online security - if (handler->HasLowerSecurity(player, 0)) + if (handler->HasLowerSecurity(player, ObjectGuid::Empty)) return false; std::string plNameLink = handler->GetNameLink(player); @@ -147,7 +147,7 @@ public: { Player* player = NULL; Group* group = NULL; - uint64 guid = 0; + ObjectGuid guid; char* nameStr = strtok((char*)args, " "); if (!handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid)) @@ -173,7 +173,7 @@ public: { Player* player = NULL; Group* group = NULL; - uint64 guid = 0; + ObjectGuid guid; char* nameStr = strtok((char*)args, " "); if (!handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid)) @@ -194,7 +194,7 @@ public: { Player* player = NULL; Group* group = NULL; - uint64 guid = 0; + ObjectGuid guid; char* nameStr = strtok((char*)args, " "); if (!handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid)) @@ -220,8 +220,8 @@ public: Player* playerTarget = NULL; Group* groupSource = NULL; Group* groupTarget = NULL; - uint64 guidSource = 0; - uint64 guidTarget = 0; + ObjectGuid guidSource; + ObjectGuid guidTarget; char* nameplgrStr = strtok((char*)args, " "); char* nameplStr = strtok(NULL, " "); @@ -263,18 +263,18 @@ public: // Get ALL the variables! Player* playerTarget; uint32 phase = 0; - uint64 guidTarget; + ObjectGuid guidTarget; std::string nameTarget; std::string zoneName; const char* onlineState = ""; // Parse the guid to uint32... - uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER); + ObjectGuid parseGUID(HIGHGUID_PLAYER, uint32(atol((char*)args))); // ... and try to extract a player out of it. if (sObjectMgr->GetPlayerNameByGUID(parseGUID, nameTarget)) { - playerTarget = sObjectMgr->GetPlayerByLowGUID(parseGUID); + playerTarget = ObjectAccessor::FindPlayer(parseGUID); guidTarget = parseGUID; } // If not, we return false and end right away. @@ -292,7 +292,7 @@ public: if (!groupTarget) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GROUP_MEMBER); - stmt->setUInt32(0, guidTarget); + stmt->setUInt32(0, guidTarget.GetCounter()); PreparedQueryResult resultGroup = CharacterDatabase.Query(stmt); if (resultGroup) groupTarget = sGroupMgr->GetGroupByDbStoreId((*resultGroup)[0].GetUInt32()); @@ -368,7 +368,7 @@ public: // Now we can print those informations for every single member of each group! handler->PSendSysMessage(LANG_GROUP_PLAYER_NAME_GUID, slot.name.c_str(), onlineState, - zoneName.c_str(), phase, GUID_LOPART(slot.guid), flags.c_str(), + zoneName.c_str(), phase, slot.guid.GetCounter(), flags.c_str(), lfg::GetRolesString(slot.roles).c_str()); } diff --git a/src/server/scripts/Commands/cs_guild.cpp b/src/server/scripts/Commands/cs_guild.cpp index 7b074087c0f..f03be6e4530 100644 --- a/src/server/scripts/Commands/cs_guild.cpp +++ b/src/server/scripts/Commands/cs_guild.cpp @@ -130,7 +130,7 @@ public: return false; // if not guild name only (in "") then player name - uint64 targetGuid; + ObjectGuid targetGuid; if (!handler->extractPlayerTarget(*args != '"' ? (char*)args : NULL, NULL, &targetGuid)) return false; @@ -154,7 +154,7 @@ public: static bool HandleGuildUninviteCommand(ChatHandler* handler, char const* args) { Player* target; - uint64 targetGuid; + ObjectGuid targetGuid; if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid)) return false; @@ -179,7 +179,7 @@ public: return false; Player* target; - uint64 targetGuid; + ObjectGuid targetGuid; std::string target_name; if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &target_name)) return false; @@ -273,7 +273,7 @@ public: std::string guildMasterName; if (sObjectMgr->GetPlayerNameByGUID(guild->GetLeaderGUID(), guildMasterName)) - handler->PSendSysMessage(LANG_GUILD_INFO_GUILD_MASTER, guildMasterName.c_str(), guild->GetLeaderGUID()); // Guild Master + handler->PSendSysMessage(LANG_GUILD_INFO_GUILD_MASTER, guildMasterName.c_str(), guild->GetLeaderGUID().GetCounter()); // Guild Master // Format creation date char createdDateStr[20]; diff --git a/src/server/scripts/Commands/cs_honor.cpp b/src/server/scripts/Commands/cs_honor.cpp index 6b76f753403..eeaee40fea9 100644 --- a/src/server/scripts/Commands/cs_honor.cpp +++ b/src/server/scripts/Commands/cs_honor.cpp @@ -71,7 +71,7 @@ public: } // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; uint32 amount = (uint32)atoi(args); @@ -91,7 +91,7 @@ public: // check online security if (Player* player = target->ToPlayer()) - if (handler->HasLowerSecurity(player, 0)) + if (handler->HasLowerSecurity(player, ObjectGuid::Empty)) return false; handler->GetSession()->GetPlayer()->RewardHonor(target, 1); @@ -109,7 +109,7 @@ public: } // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; target->UpdateHonorFields(); diff --git a/src/server/scripts/Commands/cs_lfg.cpp b/src/server/scripts/Commands/cs_lfg.cpp index 2f6afd29e9f..1a4cce16d68 100644 --- a/src/server/scripts/Commands/cs_lfg.cpp +++ b/src/server/scripts/Commands/cs_lfg.cpp @@ -27,7 +27,7 @@ void GetPlayerInfo(ChatHandler* handler, Player* player) if (!player) return; - uint64 guid = player->GetGUID(); + ObjectGuid guid = player->GetGUID(); lfg::LfgDungeonSet dungeons = sLFGMgr->GetSelectedDungeons(guid); std::string const& state = lfg::GetStateString(sLFGMgr->GetState(guid)); @@ -86,7 +86,7 @@ public: return true; } - uint64 guid = grp->GetGUID(); + ObjectGuid guid = grp->GetGUID(); std::string const& state = lfg::GetStateString(sLFGMgr->GetState(guid)); handler->PSendSysMessage(LANG_LFG_GROUP_INFO, grp->isLFGGroup(), state.c_str(), sLFGMgr->GetDungeon(guid)); diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp index 6a0755b82e8..0f21200c22d 100644 --- a/src/server/scripts/Commands/cs_list.cpp +++ b/src/server/scripts/Commands/cs_list.cpp @@ -447,8 +447,8 @@ public: handler->PSendSysMessage(LANG_COMMAND_TARGET_AURADETAIL, aura->GetId(), (handler->GetSession() ? ss_name.str().c_str() : name), aurApp->GetEffectMask(), aura->GetCharges(), aura->GetStackAmount(), aurApp->GetSlot(), aura->GetDuration(), aura->GetMaxDuration(), (aura->IsPassive() ? passiveStr : ""), - (talent ? talentStr : ""), IS_PLAYER_GUID(aura->GetCasterGUID()) ? "player" : "creature", - GUID_LOPART(aura->GetCasterGUID())); + (talent ? talentStr : ""), aura->GetCasterGUID().IsPlayer() ? "player" : "creature", + aura->GetCasterGUID().GetCounter()); } for (uint16 i = 0; i < TOTAL_AURAS; ++i) @@ -469,25 +469,25 @@ public: static bool HandleListMailCommand(ChatHandler* handler, char const* args) { Player* target; - uint64 targetGuid; + ObjectGuid targetGuid; std::string targetName; PreparedStatement* stmt = NULL; if (!*args) return false; - uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER); + ObjectGuid parseGUID(HIGHGUID_PLAYER, uint32(atol((char*)args))); if (sObjectMgr->GetPlayerNameByGUID(parseGUID, targetName)) { - target = sObjectMgr->GetPlayerByLowGUID(parseGUID); + target = ObjectAccessor::FindPlayer(parseGUID); targetGuid = parseGUID; } else if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) return false; stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_LIST_COUNT); - stmt->setUInt32(0, targetGuid); + stmt->setUInt32(0, targetGuid.GetCounter()); PreparedQueryResult queryResult = CharacterDatabase.Query(stmt); if (queryResult) { @@ -495,11 +495,11 @@ public: uint32 countMail = fields[0].GetUInt64(); std::string nameLink = handler->playerLink(targetName); - handler->PSendSysMessage(LANG_LIST_MAIL_HEADER, countMail, nameLink.c_str(), targetGuid); + handler->PSendSysMessage(LANG_LIST_MAIL_HEADER, countMail, nameLink.c_str(), targetGuid.GetCounter()); handler->PSendSysMessage(LANG_ACCOUNT_LIST_BAR); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_LIST_INFO); - stmt->setUInt32(0, targetGuid); + stmt->setUInt32(0, targetGuid.GetCounter()); PreparedQueryResult queryResult = CharacterDatabase.Query(stmt); if (queryResult) diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index e248a835ee0..8e720e9faba 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -136,7 +136,7 @@ public: WorldObject* object = NULL; if (*args) { - uint64 guid = handler->extractGuidFromLink((char*)args); + ObjectGuid guid = handler->extractGuidFromLink((char*)args); if (guid) object = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT); @@ -266,7 +266,7 @@ public: static bool HandleAppearCommand(ChatHandler* handler, char const* args) { Player* target; - uint64 targetGuid; + ObjectGuid targetGuid; std::string targetName; if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) return false; @@ -282,7 +282,7 @@ public: if (target) { // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; std::string chrNameLink = handler->playerLink(targetName); @@ -408,7 +408,7 @@ public: static bool HandleSummonCommand(ChatHandler* handler, char const* args) { Player* target; - uint64 targetGuid; + ObjectGuid targetGuid; std::string targetName; if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) return false; @@ -425,7 +425,7 @@ public: { std::string nameLink = handler->playerLink(targetName); // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; if (target->IsBeingTeleported()) @@ -537,7 +537,7 @@ public: } if (Player* player = target->ToPlayer()) - if (handler->HasLowerSecurity(player, 0, false)) + if (handler->HasLowerSecurity(player, ObjectGuid::Empty, false)) return false; if (target->IsAlive()) @@ -554,7 +554,7 @@ public: static bool HandleReviveCommand(ChatHandler* handler, char const* args) { Player* target; - uint64 targetGuid; + ObjectGuid targetGuid; if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid)) return false; @@ -597,16 +597,16 @@ public: static bool HandleGUIDCommand(ChatHandler* handler, char const* /*args*/) { - uint64 guid = handler->GetSession()->GetPlayer()->GetTarget(); + ObjectGuid guid = handler->GetSession()->GetPlayer()->GetTarget(); - if (guid == 0) + if (guid.IsEmpty()) { handler->SendSysMessage(LANG_NO_SELECTION); handler->SetSentErrorMessage(true); return false; } - handler->PSendSysMessage(LANG_OBJECT_GUID, GUID_LOPART(guid), GUID_HIPART(guid)); + handler->PSendSysMessage(LANG_OBJECT_GUID, guid.GetCounter(), guid.GetHigh()); return true; } @@ -703,7 +703,7 @@ public: if (*args) { - uint64 guid = handler->extractGuidFromLink((char*)args); + ObjectGuid guid = handler->extractGuidFromLink((char*)args); if (guid) obj = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT); @@ -737,7 +737,7 @@ public: return false; // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; if (target->IsBeingTeleported()) @@ -805,7 +805,7 @@ public: } // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; std::string kickReasonStr = handler->GetTrinityString(LANG_NO_REASON); @@ -1380,17 +1380,17 @@ public: { // Define ALL the player variables! Player* target; - uint64 targetGuid; + ObjectGuid targetGuid; std::string targetName; PreparedStatement* stmt = NULL; // To make sure we get a target, we convert our guid to an omniversal... - uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER); + ObjectGuid parseGUID(HIGHGUID_PLAYER, uint32(atol((char*)args))); // ... and make sure we get a target, somehow. if (sObjectMgr->GetPlayerNameByGUID(parseGUID, targetName)) { - target = sObjectMgr->GetPlayerByLowGUID(parseGUID); + target = ObjectAccessor::FindPlayer(parseGUID); targetGuid = parseGUID; } // if not, then return false. Which shouldn't happen, now should it ? @@ -1432,7 +1432,7 @@ public: // Account data print variables std::string userName = handler->GetTrinityString(LANG_ERROR); uint32 accId = 0; - uint32 lowguid = GUID_LOPART(targetGuid); + uint32 lowguid = targetGuid.GetCounter(); std::string eMail = handler->GetTrinityString(LANG_ERROR); std::string regMail = handler->GetTrinityString(LANG_ERROR); uint32 security = 0; @@ -1486,7 +1486,7 @@ public: if (target) { // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; accId = target->GetSession()->GetAccountId(); @@ -1796,7 +1796,7 @@ public: muteReasonStr = muteReason; Player* target; - uint64 targetGuid; + ObjectGuid targetGuid; std::string targetName; if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName)) return false; @@ -1859,7 +1859,7 @@ public: static bool HandleUnmuteCommand(ChatHandler* handler, char const* args) { Player* target; - uint64 targetGuid; + ObjectGuid targetGuid; std::string targetName; if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) return false; @@ -2115,7 +2115,7 @@ public: } if (Player* player = target->ToPlayer()) - if (handler->HasLowerSecurity(player, 0, false)) + if (handler->HasLowerSecurity(player, ObjectGuid::Empty, false)) return false; if (!target->IsAlive()) @@ -2205,7 +2205,7 @@ public: } // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; target->CombatStop(); @@ -2226,7 +2226,7 @@ public: return false; // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; // Repair items diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index f70f17232eb..3c2f122324d 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -106,7 +106,7 @@ public: return false; } - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; handler->PSendSysMessage(LANG_YOU_CHANGE_HP, handler->GetNameLink(target).c_str(), hp, hpm); @@ -144,7 +144,7 @@ public: } // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; handler->PSendSysMessage(LANG_YOU_CHANGE_MANA, handler->GetNameLink(target).c_str(), mana, manam); @@ -193,7 +193,7 @@ public: } // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; handler->PSendSysMessage(LANG_YOU_CHANGE_ENERGY, handler->GetNameLink(target).c_str(), energy/10, energym/10); @@ -244,7 +244,7 @@ public: } // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; handler->PSendSysMessage(LANG_YOU_CHANGE_RAGE, handler->GetNameLink(target).c_str(), rage/10, ragem/10); @@ -398,7 +398,7 @@ public: } // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; handler->PSendSysMessage(LANG_YOU_CHANGE_SPELLFLATID, spellflatid, val, mark, handler->GetNameLink(target).c_str()); @@ -436,7 +436,7 @@ public: if (target->GetTypeId() == TYPEID_PLAYER) { // check online security - if (handler->HasLowerSecurity(target->ToPlayer(), 0)) + if (handler->HasLowerSecurity(target->ToPlayer(), ObjectGuid::Empty)) return false; target->ToPlayer()->SetFreeTalentPoints(tp); target->ToPlayer()->SendTalentsInfoData(false); @@ -448,7 +448,7 @@ public: if (owner && owner->GetTypeId() == TYPEID_PLAYER && ((Pet*)target)->IsPermanentPetFor(owner->ToPlayer())) { // check online security - if (handler->HasLowerSecurity(owner->ToPlayer(), 0)) + if (handler->HasLowerSecurity(owner->ToPlayer(), ObjectGuid::Empty)) return false; ((Pet*)target)->SetFreeTalentPoints(tp); owner->ToPlayer()->SendTalentsInfoData(true); @@ -485,7 +485,7 @@ public: } // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; std::string targetNameLink = handler->GetNameLink(target); @@ -533,7 +533,7 @@ public: } // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; std::string targetNameLink = handler->GetNameLink(target); @@ -578,7 +578,7 @@ public: } // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; std::string targetNameLink = handler->GetNameLink(target); @@ -623,7 +623,7 @@ public: } // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; std::string targetNameLink = handler->GetNameLink(target); @@ -668,7 +668,7 @@ public: } // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; handler->PSendSysMessage(LANG_YOU_CHANGE_FLY_SPEED, FSpeed, handler->GetNameLink(target).c_str()); @@ -705,7 +705,7 @@ public: if (Player* player = target->ToPlayer()) { // check online security - if (handler->HasLowerSecurity(player, 0)) + if (handler->HasLowerSecurity(player, ObjectGuid::Empty)) return false; handler->PSendSysMessage(LANG_YOU_CHANGE_SIZE, Scale, handler->GetNameLink(player).c_str()); @@ -953,7 +953,7 @@ public: } // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; handler->PSendSysMessage(LANG_YOU_GIVE_MOUNT, handler->GetNameLink(target).c_str()); @@ -964,14 +964,14 @@ public: target->Mount(mId); WorldPacket data(SMSG_FORCE_RUN_SPEED_CHANGE, (8+4+1+4)); - data.append(target->GetPackGUID()); + data << target->GetPackGUID(); data << (uint32)0; data << (uint8)0; //new 2.1.0 data << float(speed); target->SendMessageToSet(&data, true); data.Initialize(SMSG_FORCE_SWIM_SPEED_CHANGE, (8+4+4)); - data.append(target->GetPackGUID()); + data << target->GetPackGUID(); data << (uint32)0; data << float(speed); target->SendMessageToSet(&data, true); @@ -994,7 +994,7 @@ public: } // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; int32 moneyToAdd = 0; @@ -1061,7 +1061,7 @@ public: } // check online security - if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), 0)) + if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), ObjectGuid::Empty)) return false; char* pField = strtok((char*)args, " "); @@ -1115,7 +1115,7 @@ public: } // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; int32 amount = (uint32)atoi(args); @@ -1156,7 +1156,7 @@ public: } // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; char* factionTxt = handler->extractKeyFromLink((char*)args, "Hfaction"); @@ -1255,7 +1255,7 @@ public: target = handler->GetSession()->GetPlayer(); // check online security - else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), 0)) + else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), ObjectGuid::Empty)) return false; target->SetDisplayId(display_id); @@ -1276,7 +1276,7 @@ public: target = handler->GetSession()->GetPlayer(); // check online security - else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), 0)) + else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), ObjectGuid::Empty)) return false; target->SetPhaseMask(phasemask, true); @@ -1386,7 +1386,7 @@ public: target = handler->GetSession()->GetPlayer(); // check online security - else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), 0)) + else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), ObjectGuid::Empty)) return false; target->DeMorph(); diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 00e5fc22d92..5f4c8d0dfd4 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -521,7 +521,7 @@ public: return false; if (CreatureData const* cr_data = sObjectMgr->GetCreatureData(lowguid)) - unit = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT)); + unit = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, cr_data->id, lowguid)); } else unit = handler->getSelectedCreature(); @@ -682,7 +682,7 @@ public: creature->AI()->SetData(data_1, data_2); std::string AIorScript = creature->GetAIName() != "" ? "AI type: " + creature->GetAIName() : (creature->GetScriptName() != "" ? "Script Name: " + creature->GetScriptName() : "No AI or Script Name Set"); - handler->PSendSysMessage(LANG_NPC_SETDATA, creature->GetGUID(), creature->GetEntry(), creature->GetName().c_str(), data_1, data_2, AIorScript.c_str()); + handler->PSendSysMessage(LANG_NPC_SETDATA, creature->GetGUID().GetCounter(), creature->GetEntry(), creature->GetName().c_str(), data_1, data_2, AIorScript.c_str()); return true; } @@ -1321,11 +1321,11 @@ public: return false; } - uint64 receiver_guid = atol(receiver_str); + ObjectGuid receiver_guid(HIGHGUID_PLAYER, uint32(atol(receiver_str))); // check online security Player* receiver = ObjectAccessor::FindPlayer(receiver_guid); - if (handler->HasLowerSecurity(receiver, 0)) + if (handler->HasLowerSecurity(receiver, ObjectGuid::Empty)) return false; creature->Whisper(text, LANG_UNIVERSAL, receiver); diff --git a/src/server/scripts/Commands/cs_pet.cpp b/src/server/scripts/Commands/cs_pet.cpp index 82f99501a58..bb5e0764f2f 100644 --- a/src/server/scripts/Commands/cs_pet.cpp +++ b/src/server/scripts/Commands/cs_pet.cpp @@ -85,7 +85,7 @@ public: creatureTarget->RemoveCorpse(); creatureTarget->SetHealth(0); // just for nice GM-mode view - pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, player->GetGUID()); + pet->SetGuidValue(UNIT_FIELD_CREATEDBY, player->GetGUID()); pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, player->getFaction()); if (!pet->InitStatsForLevel(creatureTarget->getLevel())) diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp index 08603279824..dc75e0aedab 100644 --- a/src/server/scripts/Commands/cs_quest.cpp +++ b/src/server/scripts/Commands/cs_quest.cpp @@ -206,11 +206,11 @@ public: { if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creature)) for (uint16 z = 0; z < creatureCount; ++z) - player->KilledMonster(creatureInfo, 0); + player->KilledMonster(creatureInfo, ObjectGuid::Empty); } else if (creature < 0) for (uint16 z = 0; z < creatureCount; ++z) - player->KillCreditGO(creature, 0); + player->KillCreditGO(creature); } // If the quest requires reputation to complete diff --git a/src/server/scripts/Commands/cs_reset.cpp b/src/server/scripts/Commands/cs_reset.cpp index 00a669609f9..484d41a47d9 100644 --- a/src/server/scripts/Commands/cs_reset.cpp +++ b/src/server/scripts/Commands/cs_reset.cpp @@ -59,14 +59,14 @@ public: static bool HandleResetAchievementsCommand(ChatHandler* handler, char const* args) { Player* target; - uint64 targetGuid; + ObjectGuid targetGuid; if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid)) return false; if (target) target->ResetAchievements(); else - AchievementMgr::DeleteFromDB(GUID_LOPART(targetGuid)); + AchievementMgr::DeleteFromDB(targetGuid); return true; } @@ -158,7 +158,7 @@ public: static bool HandleResetSpellsCommand(ChatHandler* handler, char const* args) { Player* target; - uint64 targetGuid; + ObjectGuid targetGuid; std::string targetName; if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) return false; @@ -175,7 +175,7 @@ public: { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG); stmt->setUInt16(0, uint16(AT_LOGIN_RESET_SPELLS)); - stmt->setUInt32(1, GUID_LOPART(targetGuid)); + stmt->setUInt32(1, targetGuid.GetCounter()); CharacterDatabase.Execute(stmt); handler->PSendSysMessage(LANG_RESET_SPELLS_OFFLINE, targetName.c_str()); @@ -205,7 +205,7 @@ public: static bool HandleResetTalentsCommand(ChatHandler* handler, char const* args) { Player* target; - uint64 targetGuid; + ObjectGuid targetGuid; std::string targetName; if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) { @@ -249,7 +249,7 @@ public: { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG); stmt->setUInt16(0, uint16(AT_LOGIN_NONE | AT_LOGIN_RESET_PET_TALENTS)); - stmt->setUInt32(1, GUID_LOPART(targetGuid)); + stmt->setUInt32(1, targetGuid.GetCounter()); CharacterDatabase.Execute(stmt); std::string nameLink = handler->playerLink(targetName); diff --git a/src/server/scripts/Commands/cs_send.cpp b/src/server/scripts/Commands/cs_send.cpp index 486645df290..e27f09278fd 100644 --- a/src/server/scripts/Commands/cs_send.cpp +++ b/src/server/scripts/Commands/cs_send.cpp @@ -51,7 +51,7 @@ public: { // format: name "subject text" "mail text" Player* target; - uint64 targetGuid; + ObjectGuid targetGuid; std::string targetName; if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) return false; @@ -82,7 +82,7 @@ public: /// @todo Fix poor design SQLTransaction trans = CharacterDatabase.BeginTransaction(); MailDraft(subject, text) - .SendMailTo(trans, MailReceiver(target, GUID_LOPART(targetGuid)), sender); + .SendMailTo(trans, MailReceiver(target, targetGuid.GetCounter()), sender); CharacterDatabase.CommitTransaction(trans); @@ -96,7 +96,7 @@ public: { // format: name "subject text" "mail text" item1[:count1] item2[:count2] ... item12[:count12] Player* receiver; - uint64 receiverGuid; + ObjectGuid receiverGuid; std::string receiverName; if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName)) return false; @@ -192,7 +192,7 @@ public: } } - draft.SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), sender); + draft.SendMailTo(trans, MailReceiver(receiver, receiverGuid.GetCounter()), sender); CharacterDatabase.CommitTransaction(trans); std::string nameLink = handler->playerLink(receiverName); @@ -205,7 +205,7 @@ public: /// format: name "subject text" "mail text" money Player* receiver; - uint64 receiverGuid; + ObjectGuid receiverGuid; std::string receiverName; if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName)) return false; @@ -242,7 +242,7 @@ public: MailDraft(subject, text) .AddMoney(money) - .SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), sender); + .SendMailTo(trans, MailReceiver(receiver, receiverGuid.GetCounter()), sender); CharacterDatabase.CommitTransaction(trans); diff --git a/src/server/scripts/Commands/cs_tele.cpp b/src/server/scripts/Commands/cs_tele.cpp index ad77464b6e1..6b4fb7d104d 100644 --- a/src/server/scripts/Commands/cs_tele.cpp +++ b/src/server/scripts/Commands/cs_tele.cpp @@ -123,7 +123,7 @@ public: return false; Player* target; - uint64 target_guid; + ObjectGuid target_guid; std::string target_name; if (!handler->extractPlayerTarget(nameStr, &target, &target_guid, &target_name)) return false; @@ -135,7 +135,7 @@ public: else { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_HOMEBIND); - stmt->setUInt32(0, target_guid); + stmt->setUInt32(0, target_guid.GetCounter()); PreparedQueryResult resultDB = CharacterDatabase.Query(stmt); if (resultDB) @@ -166,7 +166,7 @@ public: if (target) { // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; std::string chrNameLink = handler->playerLink(target_name); @@ -225,7 +225,7 @@ public: } // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r @@ -263,7 +263,7 @@ public: continue; // check online security - if (handler->HasLowerSecurity(player, 0)) + if (handler->HasLowerSecurity(player, ObjectGuid::Empty)) return false; std::string plNameLink = handler->GetNameLink(player); diff --git a/src/server/scripts/Commands/cs_ticket.cpp b/src/server/scripts/Commands/cs_ticket.cpp index cbf0ae51a82..674658f41ff 100644 --- a/src/server/scripts/Commands/cs_ticket.cpp +++ b/src/server/scripts/Commands/cs_ticket.cpp @@ -95,7 +95,7 @@ public: return true; } - uint64 targetGuid = sObjectMgr->GetPlayerGUIDByName(target); + ObjectGuid targetGuid = sObjectMgr->GetPlayerGUIDByName(target); uint32 accountId = sObjectMgr->GetPlayerAccountIdByGUID(targetGuid); // Target must exist and have administrative rights if (!AccountMgr::HasPermission(accountId, rbac::RBAC_PERM_COMMANDS_BE_ASSIGNED_TICKET, realmID)) @@ -153,7 +153,7 @@ public: return true; } - sTicketMgr->CloseTicket(ticket->GetId(), player ? player->GetGUID() : -1); + sTicketMgr->CloseTicket(ticket->GetId(), player ? player->GetGUID() : ObjectGuid(uint64(-1))); sTicketMgr->UpdateLastChange(); std::string msg = ticket->FormatMessageString(*handler, player ? player->GetName().c_str() : "Console", NULL, NULL, NULL, NULL); @@ -376,7 +376,7 @@ public: security = assignedPlayer->GetSession()->GetSecurity(); else { - uint64 guid = ticket->GetAssignedToGUID(); + ObjectGuid guid = ticket->GetAssignedToGUID(); uint32 accountId = sObjectMgr->GetPlayerAccountIdByGUID(guid); security = AccountMgr::GetSecurity(accountId, realmID); } @@ -434,7 +434,7 @@ public: return false; // Detect target's GUID - uint64 guid = 0; + ObjectGuid guid; if (Player* player = sObjectAccessor->FindPlayerByName(name)) guid = player->GetGUID(); else diff --git a/src/server/scripts/Commands/cs_titles.cpp b/src/server/scripts/Commands/cs_titles.cpp index dee9c33ae99..e75a36cb913 100644 --- a/src/server/scripts/Commands/cs_titles.cpp +++ b/src/server/scripts/Commands/cs_titles.cpp @@ -80,7 +80,7 @@ public: } // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id); @@ -125,7 +125,7 @@ public: } // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id); @@ -171,7 +171,7 @@ public: } // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id); @@ -219,7 +219,7 @@ public: } // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; uint64 titles2 = titles; diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp index 0c11c77af6a..9b2667148a6 100644 --- a/src/server/scripts/Commands/cs_wp.cpp +++ b/src/server/scripts/Commands/cs_wp.cpp @@ -628,7 +628,7 @@ public: handler->PSendSysMessage("|cff00ff00DEBUG: wp modify del, PathID: |r|cff00ffff%u|r", pathid); if (wpGuid != 0) - if (Creature* wpCreature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT))) + if (Creature* wpCreature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, VISUAL_WAYPOINT, wpGuid))) { wpCreature->CombatStop(); wpCreature->DeleteFromDB(); @@ -661,7 +661,7 @@ public: // Respawn the owner of the waypoints if (wpGuid != 0) { - if (Creature* wpCreature = map->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT))) + if (Creature* wpCreature = map->GetCreature(ObjectGuid(HIGHGUID_UNIT, VISUAL_WAYPOINT, wpGuid))) { wpCreature->CombatStop(); wpCreature->DeleteFromDB(); @@ -842,7 +842,7 @@ public: { Field* fields = result2->Fetch(); uint32 wpguid = fields[0].GetUInt32(); - Creature* creature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpguid, VISUAL_WAYPOINT, HIGHGUID_UNIT)); + Creature* creature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, VISUAL_WAYPOINT, wpguid)); if (!creature) { @@ -1038,7 +1038,7 @@ public: { Field* fields = result->Fetch(); uint32 guid = fields[0].GetUInt32(); - Creature* creature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(guid, VISUAL_WAYPOINT, HIGHGUID_UNIT)); + Creature* creature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, VISUAL_WAYPOINT, guid)); if (!creature) { handler->PSendSysMessage(LANG_WAYPOINT_NOTREMOVED, guid); diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp index 651e487522d..c8717a73f16 100644 --- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp +++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp @@ -65,7 +65,7 @@ public: void Initialize() { - WaterElementalGUID = 0; + WaterElementalGUID.Clear(); HasCastIceblock = false; } @@ -177,7 +177,7 @@ public: private: EventMap events; SummonList summons; - uint64 WaterElementalGUID; + ObjectGuid WaterElementalGUID; bool HasCastIceblock; }; diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp index 51ca327738b..08b773bc61a 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp @@ -38,10 +38,10 @@ public: else instance->SetData(TYPE_LYCEUM, IN_PROGRESS); // If used brazier open linked doors (North or South) - if (go->GetGUID() == instance->GetData64(DATA_SF_BRAZIER_N)) - instance->HandleGameObject(instance->GetData64(DATA_GOLEM_DOOR_N), true); - else if (go->GetGUID() == instance->GetData64(DATA_SF_BRAZIER_S)) - instance->HandleGameObject(instance->GetData64(DATA_GOLEM_DOOR_S), true); + if (go->GetGUID() == instance->GetGuidData(DATA_SF_BRAZIER_N)) + instance->HandleGameObject(instance->GetGuidData(DATA_GOLEM_DOOR_N), true); + else if (go->GetGUID() == instance->GetGuidData(DATA_SF_BRAZIER_S)) + instance->HandleGameObject(instance->GetGuidData(DATA_GOLEM_DOOR_S), true); } return false; } @@ -138,9 +138,9 @@ public: MobDeath_Timer = 0; for (uint8 i = 0; i < MAX_NPC_AMOUNT; ++i) - RingMobGUID[i] = 0; + RingMobGUID[i].Clear(); - RingBossGUID = 0; + RingBossGUID.Clear(); CanWalk = false; } @@ -154,8 +154,8 @@ public: uint8 MobCount; uint32 MobDeath_Timer; - uint64 RingMobGUID[4]; - uint64 RingBossGUID; + ObjectGuid RingMobGUID[4]; + ObjectGuid RingBossGUID; bool CanWalk; @@ -222,7 +222,7 @@ public: void HandleGameObject(uint32 id, bool open) { - instance->HandleGameObject(instance->GetData64(id), open); + instance->HandleGameObject(instance->GetGuidData(id), open); } void UpdateAI(uint32 diff) override @@ -238,7 +238,7 @@ public: Creature* boss = ObjectAccessor::GetCreature(*me, RingBossGUID); if (boss && !boss->IsAlive() && boss->isDead()) { - RingBossGUID = 0; + RingBossGUID.Clear(); Event_Timer = 5000; MobDeath_Timer = 0; return; @@ -251,7 +251,7 @@ public: Creature* mob = ObjectAccessor::GetCreature(*me, RingMobGUID[i]); if (mob && !mob->IsAlive() && mob->isDead()) { - RingMobGUID[i] = 0; + RingMobGUID[i].Clear(); --MobCount; //seems all are gone, so set timer to continue and discontinue this @@ -1277,7 +1277,7 @@ public: void DoGo(uint32 id, uint32 state) { - if (GameObject* go = instance->instance->GetGameObject(instance->GetData64(id))) + if (GameObject* go = instance->instance->GetGameObject(instance->GetGuidData(id))) go->SetGoState((GOState)state); } @@ -1324,7 +1324,7 @@ public: DoGo(DATA_GO_BAR_KEG_TRAP, 0); //doesn't work very well, leaving code here for future //spell by trap has effect61, this indicate the bar go hostile - if (Unit* tmp = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_PHALANX))) + if (Unit* tmp = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_PHALANX))) tmp->setFaction(14); //for later, this event(s) has alot more to it. diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp index cec29bcd4d1..4b2434c73c9 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp @@ -70,7 +70,7 @@ class boss_emperor_dagran_thaurissan : public CreatureScript void JustDied(Unit* /*killer*/) override { - if (Creature* moira = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_MOIRA))) + if (Creature* moira = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_MOIRA))) { moira->AI()->EnterEvadeMode(); moira->setFaction(35); diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_magmus.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_magmus.cpp index e6bbbaa73a9..3230a700810 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_magmus.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_magmus.cpp @@ -96,7 +96,7 @@ class boss_magmus : public CreatureScript void JustDied(Unit* /*killer*/) override { if (InstanceScript* instance = me->GetInstanceScript()) - instance->HandleGameObject(instance->GetData64(DATA_THRONE_DOOR), true); + instance->HandleGameObject(instance->GetGuidData(DATA_THRONE_DOOR), true); } private: diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp index 77a8c68d28e..6706713698d 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp @@ -76,7 +76,7 @@ public: if (InstanceScript* instance = creature->GetInstanceScript()) { //are 5 minutes expected? go template may have data to despawn when used at quest - instance->DoRespawnGameObject(instance->GetData64(DATA_GO_CHALICE), MINUTE*5); + instance->DoRespawnGameObject(instance->GetGuidData(DATA_GO_CHALICE), MINUTE*5); } break; } @@ -139,7 +139,7 @@ class boss_doomrel : public CreatureScript creature->AI()->AttackStart(player); InstanceScript* instance = creature->GetInstanceScript(); if (instance) - instance->SetData64(DATA_EVENSTARTER, player->GetGUID()); + instance->SetGuidData(DATA_EVENSTARTER, player->GetGUID()); break; } return true; @@ -202,7 +202,7 @@ class boss_doomrel : public CreatureScript { ScriptedAI::EnterEvadeMode(); - _instance->SetData64(DATA_EVENSTARTER, 0); + _instance->SetGuidData(DATA_EVENSTARTER, ObjectGuid::Empty); } void JustDied(Unit* /*killer*/) override diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp index 67219a2990a..22999c221dd 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp @@ -81,37 +81,37 @@ public: uint32 encounter[MAX_ENCOUNTER]; std::string str_data; - uint64 EmperorGUID; - uint64 PhalanxGUID; - uint64 MagmusGUID; - uint64 MoiraGUID; - - uint64 GoArena1GUID; - uint64 GoArena2GUID; - uint64 GoArena3GUID; - uint64 GoArena4GUID; - uint64 GoShadowLockGUID; - uint64 GoShadowMechGUID; - uint64 GoShadowGiantGUID; - uint64 GoShadowDummyGUID; - uint64 GoBarKegGUID; - uint64 GoBarKegTrapGUID; - uint64 GoBarDoorGUID; - uint64 GoTombEnterGUID; - uint64 GoTombExitGUID; - uint64 GoLyceumGUID; - uint64 GoSFSGUID; - uint64 GoSFNGUID; - uint64 GoGolemNGUID; - uint64 GoGolemSGUID; - uint64 GoThroneGUID; - uint64 GoChestGUID; - uint64 GoSpectralChaliceGUID; + ObjectGuid EmperorGUID; + ObjectGuid PhalanxGUID; + ObjectGuid MagmusGUID; + ObjectGuid MoiraGUID; + + ObjectGuid GoArena1GUID; + ObjectGuid GoArena2GUID; + ObjectGuid GoArena3GUID; + ObjectGuid GoArena4GUID; + ObjectGuid GoShadowLockGUID; + ObjectGuid GoShadowMechGUID; + ObjectGuid GoShadowGiantGUID; + ObjectGuid GoShadowDummyGUID; + ObjectGuid GoBarKegGUID; + ObjectGuid GoBarKegTrapGUID; + ObjectGuid GoBarDoorGUID; + ObjectGuid GoTombEnterGUID; + ObjectGuid GoTombExitGUID; + ObjectGuid GoLyceumGUID; + ObjectGuid GoSFSGUID; + ObjectGuid GoSFNGUID; + ObjectGuid GoGolemNGUID; + ObjectGuid GoGolemSGUID; + ObjectGuid GoThroneGUID; + ObjectGuid GoChestGUID; + ObjectGuid GoSpectralChaliceGUID; uint32 BarAleCount; uint32 GhostKillCount; - uint64 TombBossGUIDs[7]; - uint64 TombEventStarterGUID; + ObjectGuid TombBossGUIDs[7]; + ObjectGuid TombEventStarterGUID; uint32 TombTimer; uint32 TombEventCounter; @@ -120,41 +120,10 @@ public: SetHeaders(DataHeader); memset(&encounter, 0, sizeof(encounter)); - EmperorGUID = 0; - PhalanxGUID = 0; - MagmusGUID = 0; - MoiraGUID = 0; - - GoArena1GUID = 0; - GoArena2GUID = 0; - GoArena3GUID = 0; - GoArena4GUID = 0; - GoShadowLockGUID = 0; - GoShadowMechGUID = 0; - GoShadowGiantGUID = 0; - GoShadowDummyGUID = 0; - GoBarKegGUID = 0; - GoBarKegTrapGUID = 0; - GoBarDoorGUID = 0; - GoTombEnterGUID = 0; - GoTombExitGUID = 0; - GoLyceumGUID = 0; - GoSFSGUID = 0; - GoSFNGUID = 0; - GoGolemNGUID = 0; - GoGolemSGUID = 0; - GoThroneGUID = 0; - GoChestGUID = 0; - GoSpectralChaliceGUID = 0; - BarAleCount = 0; GhostKillCount = 0; - TombEventStarterGUID = 0; TombTimer = TIMER_TOMBOFTHESEVEN; TombEventCounter = 0; - - for (uint8 i = 0; i < 7; ++i) - TombBossGUIDs[i] = 0; } void OnCreatureCreate(Creature* creature) override @@ -174,7 +143,7 @@ public: case NPC_MAGMUS: MagmusGUID = creature->GetGUID(); if (!creature->IsAlive()) - HandleGameObject(GetData64(DATA_THRONE_DOOR), true); // if Magmus is dead open door to last boss + HandleGameObject(GetGuidData(DATA_THRONE_DOOR), true); // if Magmus is dead open door to last boss break; } } @@ -198,9 +167,9 @@ public: case GO_TOMB_EXIT: GoTombExitGUID = go->GetGUID(); if (GhostKillCount >= 7) - HandleGameObject(0, true, go); + HandleGameObject(ObjectGuid::Empty, true, go); else - HandleGameObject(0, false, go); + HandleGameObject(ObjectGuid::Empty, false, go); break; case GO_LYCEUM: GoLyceumGUID = go->GetGUID(); break; case GO_SF_S: GoSFSGUID = go->GetGUID(); break; @@ -213,9 +182,9 @@ public: } } - void SetData64(uint32 type, uint64 data) override + void SetGuidData(uint32 type, ObjectGuid data) override { - TC_LOG_DEBUG("scripts", "Instance Blackrock Depths: SetData64 update (Type: %u Data " UI64FMTD ")", type, data); + TC_LOG_DEBUG("scripts", "Instance Blackrock Depths: SetGuidData update (Type: %u Data %s)", type, data.ToString().c_str()); switch (type) { @@ -301,7 +270,7 @@ public: return 0; } - uint64 GetData64(uint32 data) const override + ObjectGuid GetGuidData(uint32 data) const override { switch (data) { @@ -340,7 +309,7 @@ public: case DATA_GO_CHALICE: return GoSpectralChaliceGUID; } - return 0; + return ObjectGuid::Empty; } std::string GetSaveData() override @@ -409,7 +378,7 @@ public: } } GhostKillCount = 0; - TombEventStarterGUID = 0; + TombEventStarterGUID.Clear(); TombEventCounter = 0; TombTimer = TIMER_TOMBOFTHESEVEN; SetData(TYPE_TOMB_OF_SEVEN, NOT_STARTED); @@ -427,7 +396,7 @@ public: DoRespawnGameObject(GoChestGUID, DAY); HandleGameObject(GoTombExitGUID, true);//event done, open exit door HandleGameObject(GoTombEnterGUID, true);//event done, open entrance door - TombEventStarterGUID = 0; + TombEventStarterGUID.Clear(); SetData(TYPE_TOMB_OF_SEVEN, DONE); } void Update(uint32 diff) override diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp index 2bd43e7283c..92906009b9a 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp @@ -104,10 +104,10 @@ public: break; case 2: // Close these two doors on Blackhand Incarcerators aggro - if (GameObject* door1 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_IN))) + if (GameObject* door1 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_IN))) if (door1->GetGoState() == GO_STATE_ACTIVE) door1->SetGoState(GO_STATE_READY); - if (GameObject* door2 = me->GetMap()->GetGameObject(instance->GetData64(GO_DOORS))) + if (GameObject* door2 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_DOORS))) if (door2->GetGoState() == GO_STATE_ACTIVE) door2->SetGoState(GO_STATE_READY); break; @@ -166,33 +166,33 @@ public: void OpenDoors(bool Boss_Killed) { // These two doors reopen on reset or boss kill - if (GameObject* door1 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_IN))) + if (GameObject* door1 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_IN))) door1->SetGoState(GO_STATE_ACTIVE); - if (GameObject* door2 = me->GetMap()->GetGameObject(instance->GetData64(GO_DOORS))) + if (GameObject* door2 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_DOORS))) door2->SetGoState(GO_STATE_ACTIVE); // This door opens on boss kill if (Boss_Killed) - if (GameObject* door3 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_OUT))) + if (GameObject* door3 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_OUT))) door3->SetGoState(GO_STATE_ACTIVE); } void UpdateRunes(GOState state) { // update all runes - if (GameObject* rune1 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_RUNE_1))) + if (GameObject* rune1 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_RUNE_1))) rune1->SetGoState(state); - if (GameObject* rune2 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_RUNE_2))) + if (GameObject* rune2 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_RUNE_2))) rune2->SetGoState(state); - if (GameObject* rune3 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_RUNE_3))) + if (GameObject* rune3 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_RUNE_3))) rune3->SetGoState(state); - if (GameObject* rune4 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_RUNE_4))) + if (GameObject* rune4 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_RUNE_4))) rune4->SetGoState(state); - if (GameObject* rune5 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_RUNE_5))) + if (GameObject* rune5 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_RUNE_5))) rune5->SetGoState(state); - if (GameObject* rune6 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_RUNE_6))) + if (GameObject* rune6 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_RUNE_6))) rune6->SetGoState(state); - if (GameObject* rune7 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_RUNE_7))) + if (GameObject* rune7 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_RUNE_7))) rune7->SetGoState(state); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp index 94bf3e991f4..2018f12b613 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp @@ -167,16 +167,16 @@ public: boss_rend_blackhandAI(Creature* creature) : BossAI(creature, DATA_WARCHIEF_REND_BLACKHAND) { gythEvent = false; - victorGUID = 0; - portcullisGUID = 0; + victorGUID.Clear(); + portcullisGUID.Clear(); } void Reset() override { _Reset(); gythEvent = false; - victorGUID = 0; - portcullisGUID = 0; + victorGUID.Clear(); + portcullisGUID.Clear(); } void EnterCombat(Unit* /*who*/) override @@ -437,8 +437,8 @@ public: private: bool gythEvent; - uint64 victorGUID; - uint64 portcullisGUID; + ObjectGuid victorGUID; + ObjectGuid portcullisGUID; }; CreatureAI* GetAI(Creature* creature) const override diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp index e95fb8da42e..34d524a5470 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp @@ -52,29 +52,6 @@ public: { SetHeaders(DataHeader); SetBossNumber(EncounterCount); - HighlordOmokk = 0; - ShadowHunterVoshgajin = 0; - WarMasterVoone = 0; - MotherSmolderweb = 0; - UrokDoomhowl = 0; - QuartermasterZigris = 0; - GizrultheSlavener = 0; - Halycon = 0; - OverlordWyrmthalak = 0; - PyroguardEmberseer = 0; - WarchiefRendBlackhand = 0; - Gyth = 0; - LordVictorNefarius = 0; - TheBeast = 0; - GeneralDrakkisath = 0; - go_emberseerin = 0; - go_doors = 0; - go_emberseerout = 0; - go_blackrockaltar = 0; - go_portcullis_active = 0; - go_portcullis_tobossrooms = 0; - memset(go_roomrunes, 0, sizeof(go_roomrunes)); - memset(go_emberseerrunes, 0, sizeof(go_emberseerrunes)); } void OnCreatureCreate(Creature* creature) override @@ -145,97 +122,97 @@ public: case GO_EMBERSEER_IN: go_emberseerin = go->GetGUID(); if (GetBossState(DATA_DRAGONSPIRE_ROOM) == DONE) - HandleGameObject(0, true, go); + HandleGameObject(ObjectGuid::Empty, true, go); break; case GO_DOORS: go_doors = go->GetGUID(); if (GetBossState(DATA_DRAGONSPIRE_ROOM) == DONE) - HandleGameObject(0, true, go); + HandleGameObject(ObjectGuid::Empty, true, go); break; case GO_EMBERSEER_OUT: go_emberseerout = go->GetGUID(); if (GetBossState(DATA_PYROGAURD_EMBERSEER) == DONE) - HandleGameObject(0, true, go); + HandleGameObject(ObjectGuid::Empty, true, go); break; case GO_HALL_RUNE_1: go_roomrunes[0] = go->GetGUID(); if (GetBossState(DATA_HALL_RUNE_1) == DONE) - HandleGameObject(0, false, go); + HandleGameObject(ObjectGuid::Empty, false, go); break; case GO_HALL_RUNE_2: go_roomrunes[1] = go->GetGUID(); if (GetBossState(DATA_HALL_RUNE_2) == DONE) - HandleGameObject(0, false, go); + HandleGameObject(ObjectGuid::Empty, false, go); break; case GO_HALL_RUNE_3: go_roomrunes[2] = go->GetGUID(); if (GetBossState(DATA_HALL_RUNE_3) == DONE) - HandleGameObject(0, false, go); + HandleGameObject(ObjectGuid::Empty, false, go); break; case GO_HALL_RUNE_4: go_roomrunes[3] = go->GetGUID(); if (GetBossState(DATA_HALL_RUNE_4) == DONE) - HandleGameObject(0, false, go); + HandleGameObject(ObjectGuid::Empty, false, go); break; case GO_HALL_RUNE_5: go_roomrunes[4] = go->GetGUID(); if (GetBossState(DATA_HALL_RUNE_5) == DONE) - HandleGameObject(0, false, go); + HandleGameObject(ObjectGuid::Empty, false, go); break; case GO_HALL_RUNE_6: go_roomrunes[5] = go->GetGUID(); if (GetBossState(DATA_HALL_RUNE_6) == DONE) - HandleGameObject(0, false, go); + HandleGameObject(ObjectGuid::Empty, false, go); break; case GO_HALL_RUNE_7: go_roomrunes[6] = go->GetGUID(); if (GetBossState(DATA_HALL_RUNE_7) == DONE) - HandleGameObject(0, false, go); + HandleGameObject(ObjectGuid::Empty, false, go); break; case GO_EMBERSEER_RUNE_1: go_emberseerrunes[0] = go->GetGUID(); if (GetBossState(DATA_PYROGAURD_EMBERSEER) == DONE) - HandleGameObject(0, false, go); + HandleGameObject(ObjectGuid::Empty, false, go); break; case GO_EMBERSEER_RUNE_2: go_emberseerrunes[1] = go->GetGUID(); if (GetBossState(DATA_PYROGAURD_EMBERSEER) == DONE) - HandleGameObject(0, false, go); + HandleGameObject(ObjectGuid::Empty, false, go); break; case GO_EMBERSEER_RUNE_3: go_emberseerrunes[2] = go->GetGUID(); if (GetBossState(DATA_PYROGAURD_EMBERSEER) == DONE) - HandleGameObject(0, false, go); + HandleGameObject(ObjectGuid::Empty, false, go); break; case GO_EMBERSEER_RUNE_4: go_emberseerrunes[3] = go->GetGUID(); if (GetBossState(DATA_PYROGAURD_EMBERSEER) == DONE) - HandleGameObject(0, false, go); + HandleGameObject(ObjectGuid::Empty, false, go); break; case GO_EMBERSEER_RUNE_5: go_emberseerrunes[4] = go->GetGUID(); if (GetBossState(DATA_PYROGAURD_EMBERSEER) == DONE) - HandleGameObject(0, false, go); + HandleGameObject(ObjectGuid::Empty, false, go); break; case GO_EMBERSEER_RUNE_6: go_emberseerrunes[5] = go->GetGUID(); if (GetBossState(DATA_PYROGAURD_EMBERSEER) == DONE) - HandleGameObject(0, false, go); + HandleGameObject(ObjectGuid::Empty, false, go); break; case GO_EMBERSEER_RUNE_7: go_emberseerrunes[6] = go->GetGUID(); if (GetBossState(DATA_PYROGAURD_EMBERSEER) == DONE) - HandleGameObject(0, false, go); + HandleGameObject(ObjectGuid::Empty, false, go); break; case GO_PORTCULLIS_ACTIVE: go_portcullis_active = go->GetGUID(); if (GetBossState(DATA_GYTH) == DONE) - HandleGameObject(0, true, go); + HandleGameObject(ObjectGuid::Empty, true, go); break; case GO_PORTCULLIS_TOBOSSROOMS: go_portcullis_tobossrooms = go->GetGUID(); if (GetBossState(DATA_GYTH) == DONE) - HandleGameObject(0, true, go); + HandleGameObject(ObjectGuid::Empty, true, go); break; default: break; @@ -309,7 +286,7 @@ public: } } - uint64 GetData64(uint32 type) const override + ObjectGuid GetGuidData(uint32 type) const override { switch (type) { @@ -382,7 +359,7 @@ public: default: break; } - return 0; + return ObjectGuid::Empty; } void Update(uint32 diff) override @@ -459,7 +436,7 @@ public: if (!_mobAlive && rune->GetGoState() == GO_STATE_ACTIVE) { - HandleGameObject(0, false, rune); + HandleGameObject(ObjectGuid::Empty, false, rune); switch (rune->GetEntry()) { @@ -496,38 +473,38 @@ public: { SetBossState(DATA_DRAGONSPIRE_ROOM, DONE); if (GameObject* door1 = instance->GetGameObject(go_emberseerin)) - HandleGameObject(0, true, door1); + HandleGameObject(ObjectGuid::Empty, true, door1); if (GameObject* door2 = instance->GetGameObject(go_doors)) - HandleGameObject(0, true, door2); + HandleGameObject(ObjectGuid::Empty, true, door2); } } protected: EventMap Events; - uint64 HighlordOmokk; - uint64 ShadowHunterVoshgajin; - uint64 WarMasterVoone; - uint64 MotherSmolderweb; - uint64 UrokDoomhowl; - uint64 QuartermasterZigris; - uint64 GizrultheSlavener; - uint64 Halycon; - uint64 OverlordWyrmthalak; - uint64 PyroguardEmberseer; - uint64 WarchiefRendBlackhand; - uint64 Gyth; - uint64 LordVictorNefarius; - uint64 TheBeast; - uint64 GeneralDrakkisath; - uint64 go_emberseerin; - uint64 go_doors; - uint64 go_emberseerout; - uint64 go_blackrockaltar; - uint64 go_roomrunes[7]; - uint64 go_emberseerrunes[7]; - uint64 runecreaturelist[7][5]; - uint64 go_portcullis_active; - uint64 go_portcullis_tobossrooms; + ObjectGuid HighlordOmokk; + ObjectGuid ShadowHunterVoshgajin; + ObjectGuid WarMasterVoone; + ObjectGuid MotherSmolderweb; + ObjectGuid UrokDoomhowl; + ObjectGuid QuartermasterZigris; + ObjectGuid GizrultheSlavener; + ObjectGuid Halycon; + ObjectGuid OverlordWyrmthalak; + ObjectGuid PyroguardEmberseer; + ObjectGuid WarchiefRendBlackhand; + ObjectGuid Gyth; + ObjectGuid LordVictorNefarius; + ObjectGuid TheBeast; + ObjectGuid GeneralDrakkisath; + ObjectGuid go_emberseerin; + ObjectGuid go_doors; + ObjectGuid go_emberseerout; + ObjectGuid go_blackrockaltar; + ObjectGuid go_roomrunes[7]; + ObjectGuid go_emberseerrunes[7]; + ObjectGuid runecreaturelist[7][5]; + ObjectGuid go_portcullis_active; + ObjectGuid go_portcullis_tobossrooms; }; InstanceScript* GetInstanceScript(InstanceMap* map) const override diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp index b83cc4694ab..2efea4ae30c 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp @@ -175,7 +175,7 @@ public: { if (InstanceScript* instance = go->GetInstanceScript()) if (instance->GetData(DATA_EGG_EVENT) != DONE) - if (Creature* razor = ObjectAccessor::GetCreature(*go, instance->GetData64(DATA_RAZORGORE_THE_UNTAMED))) + if (Creature* razor = ObjectAccessor::GetCreature(*go, instance->GetGuidData(DATA_RAZORGORE_THE_UNTAMED))) { razor->Attack(player, true); player->CastSpell(razor, SPELL_MINDCONTROL); diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp index 1282cdcd313..6b2d6e1f11a 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp @@ -78,7 +78,7 @@ public: void Initialize() { - PlayerGUID = 0; + PlayerGUID.Clear(); HasYelled = false; } @@ -231,7 +231,7 @@ public: } private: - uint64 PlayerGUID; + ObjectGuid PlayerGUID; bool HasYelled; }; diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp index ae52e281c9d..bae3f1b9b5c 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp @@ -60,25 +60,6 @@ public: // Razorgore EggCount = 0; EggEvent = 0; - RazorgoreTheUntamedGUID = 0; - RazorgoreDoorGUID = 0; - // Vaelastrasz the Corrupt - VaelastraszTheCorruptGUID = 0; - VaelastraszDoorGUID = 0; - // Broodlord Lashlayer - BroodlordLashlayerGUID = 0; - BroodlordDoorGUID = 0; - // 3 Dragons - FiremawGUID = 0; - EbonrocGUID = 0; - FlamegorGUID = 0; - ChrommagusDoorGUID = 0; - // Chormaggus - ChromaggusGUID = 0; - NefarianDoorGUID = 0; - // Nefarian - LordVictorNefariusGUID = 0; - NefarianGUID = 0; SetBossNumber(EncounterCount); } @@ -87,26 +68,6 @@ public: // Razorgore EggCount = 0; EggEvent = 0; - RazorgoreTheUntamedGUID = 0; - RazorgoreDoorGUID = 0; - EggList.clear(); - // Vaelastrasz the Corrupt - VaelastraszTheCorruptGUID = 0; - VaelastraszDoorGUID = 0; - // Broodlord Lashlayer - BroodlordLashlayerGUID = 0; - BroodlordDoorGUID = 0; - // 3 Dragons - FiremawGUID = 0; - EbonrocGUID = 0; - FlamegorGUID = 0; - ChrommagusDoorGUID = 0; - // Chormaggus - ChromaggusGUID = 0; - NefarianDoorGUID = 0; - // Nefarian - LordVictorNefariusGUID = 0; - NefarianGUID = 0; } void OnCreatureCreate(Creature* creature) override @@ -162,23 +123,23 @@ public: break; case 175946: // Door RazorgoreDoorGUID = go->GetGUID(); - HandleGameObject(0, GetBossState(BOSS_RAZORGORE) == DONE, go); + HandleGameObject(ObjectGuid::Empty, GetBossState(BOSS_RAZORGORE) == DONE, go); break; case 175185: // Door VaelastraszDoorGUID = go->GetGUID(); - HandleGameObject(0, GetBossState(BOSS_VAELASTRAZ) == DONE, go); + HandleGameObject(ObjectGuid::Empty, GetBossState(BOSS_VAELASTRAZ) == DONE, go); break; case 180424: // Door BroodlordDoorGUID = go->GetGUID(); - HandleGameObject(0, GetBossState(BOSS_BROODLORD) == DONE, go); + HandleGameObject(ObjectGuid::Empty, GetBossState(BOSS_BROODLORD) == DONE, go); break; case 185483: // Door ChrommagusDoorGUID = go->GetGUID(); - HandleGameObject(0, GetBossState(BOSS_FIREMAW) == DONE && GetBossState(BOSS_EBONROC) == DONE && GetBossState(BOSS_FLAMEGOR) == DONE, go); + HandleGameObject(ObjectGuid::Empty, GetBossState(BOSS_FIREMAW) == DONE && GetBossState(BOSS_EBONROC) == DONE && GetBossState(BOSS_FLAMEGOR) == DONE, go); break; case 181125: // Door NefarianDoorGUID = go->GetGUID(); - HandleGameObject(0, GetBossState(BOSS_CHROMAGGUS) == DONE, go); + HandleGameObject(ObjectGuid::Empty, GetBossState(BOSS_CHROMAGGUS) == DONE, go); break; } } @@ -200,7 +161,7 @@ public: HandleGameObject(RazorgoreDoorGUID, state == DONE); if (state == DONE) { - for (std::list<uint64>::const_iterator itr = EggList.begin(); itr != EggList.end(); ++itr) + for (GuidList::const_iterator itr = EggList.begin(); itr != EggList.end(); ++itr) if (GameObject* egg = instance->GetGameObject((*itr))) egg->SetPhaseMask(2, true); } @@ -239,7 +200,7 @@ public: return true; } - uint64 GetData64(uint32 id) const override + ObjectGuid GetGuidData(uint32 id) const override { switch (id) { @@ -254,7 +215,7 @@ public: case DATA_NEFARIAN: return NefarianGUID; } - return 0; + return ObjectGuid::Empty; } void SetData(uint32 type, uint32 data) override @@ -340,31 +301,31 @@ public: // Razorgore uint8 EggCount; uint32 EggEvent; - uint64 RazorgoreTheUntamedGUID; - uint64 RazorgoreDoorGUID; - std::list<uint64> EggList; + ObjectGuid RazorgoreTheUntamedGUID; + ObjectGuid RazorgoreDoorGUID; + GuidList EggList; // Vaelastrasz the Corrupt - uint64 VaelastraszTheCorruptGUID; - uint64 VaelastraszDoorGUID; + ObjectGuid VaelastraszTheCorruptGUID; + ObjectGuid VaelastraszDoorGUID; // Broodlord Lashlayer - uint64 BroodlordLashlayerGUID; - uint64 BroodlordDoorGUID; + ObjectGuid BroodlordLashlayerGUID; + ObjectGuid BroodlordDoorGUID; // 3 Dragons - uint64 FiremawGUID; - uint64 EbonrocGUID; - uint64 FlamegorGUID; - uint64 ChrommagusDoorGUID; + ObjectGuid FiremawGUID; + ObjectGuid EbonrocGUID; + ObjectGuid FlamegorGUID; + ObjectGuid ChrommagusDoorGUID; // Chormaggus - uint64 ChromaggusGUID; - uint64 NefarianDoorGUID; + ObjectGuid ChromaggusGUID; + ObjectGuid NefarianDoorGUID; // Nefarian - uint64 LordVictorNefariusGUID; - uint64 NefarianGUID; + ObjectGuid LordVictorNefariusGUID; + ObjectGuid NefarianGUID; }; InstanceScript* GetInstanceScript(InstanceMap* map) const override diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_golemagg.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_golemagg.cpp index c8b33e48852..cdfe00c767f 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_golemagg.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_golemagg.cpp @@ -150,7 +150,7 @@ class npc_core_rager : public CreatureScript if (HealthAbovePct(50) || !instance) return; - if (Creature* pGolemagg = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_GOLEMAGG_THE_INCINERATOR))) + if (Creature* pGolemagg = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_GOLEMAGG_THE_INCINERATOR))) { if (pGolemagg->IsAlive()) { diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp index 4a0e22b1ba8..58f38ec4267 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp @@ -153,7 +153,7 @@ class boss_ragnaros : public CreatureScript break; case EVENT_INTRO_4: Talk(SAY_ARRIVAL5_RAG); - if (Creature* executus = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_MAJORDOMO_EXECUTUS))) + if (Creature* executus = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_MAJORDOMO_EXECUTUS))) me->Kill(executus); break; case EVENT_INTRO_5: diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/instance_molten_core.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/instance_molten_core.cpp index 800b6bb0edc..7de89b41b7f 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/instance_molten_core.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/instance_molten_core.cpp @@ -45,9 +45,6 @@ class instance_molten_core : public InstanceMapScript { SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); - _golemaggTheIncineratorGUID = 0; - _majordomoExecutusGUID = 0; - _cacheOfTheFirelordGUID = 0; _executusSchedule = false; _ragnarosAddDeaths = 0; } @@ -107,7 +104,7 @@ class instance_molten_core : public InstanceMapScript return 0; } - uint64 GetData64(uint32 type) const override + ObjectGuid GetGuidData(uint32 type) const override { switch (type) { @@ -117,7 +114,7 @@ class instance_molten_core : public InstanceMapScript return _majordomoExecutusGUID; } - return 0; + return ObjectGuid::Empty; } bool SetBossState(uint32 bossId, EncounterState state) override @@ -176,9 +173,9 @@ class instance_molten_core : public InstanceMapScript } private: - uint64 _golemaggTheIncineratorGUID; - uint64 _majordomoExecutusGUID; - uint64 _cacheOfTheFirelordGUID; + ObjectGuid _golemaggTheIncineratorGUID; + ObjectGuid _majordomoExecutusGUID; + ObjectGuid _cacheOfTheFirelordGUID; bool _executusSchedule; uint8 _ragnarosAddDeaths; }; diff --git a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp index 7338620a8b2..029c3f08a8d 100644 --- a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp +++ b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp @@ -133,7 +133,7 @@ public: ++uiHealth; DoCastAOE(SPELL_SMITE_STOMP, false); SetCombatMovement(false); - if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_SMITE_CHEST))) + if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_SMITE_CHEST))) { me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MovePoint(1, go->GetPositionX() - 3.0f, go->GetPositionY(), go->GetPositionZ()); diff --git a/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp b/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp index 4869ffc4756..d7667b37e87 100644 --- a/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp +++ b/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp @@ -58,32 +58,24 @@ class instance_deadmines : public InstanceMapScript { instance_deadmines_InstanceMapScript(Map* map) : InstanceScript(map) { } - uint64 FactoryDoorGUID; - uint64 IronCladDoorGUID; - uint64 DefiasCannonGUID; - uint64 DoorLeverGUID; - uint64 DefiasPirate1GUID; - uint64 DefiasPirate2GUID; - uint64 DefiasCompanionGUID; + ObjectGuid FactoryDoorGUID; + ObjectGuid IronCladDoorGUID; + ObjectGuid DefiasCannonGUID; + ObjectGuid DoorLeverGUID; + ObjectGuid DefiasPirate1GUID; + ObjectGuid DefiasPirate2GUID; + ObjectGuid DefiasCompanionGUID; uint32 State; uint32 CannonBlast_Timer; uint32 PiratesDelay_Timer; - uint64 uiSmiteChestGUID; + ObjectGuid uiSmiteChestGUID; void Initialize() override { SetHeaders(DataHeader); - FactoryDoorGUID = 0; - IronCladDoorGUID = 0; - DefiasCannonGUID = 0; - DoorLeverGUID = 0; - DefiasPirate1GUID = 0; - DefiasPirate2GUID = 0; - DefiasCompanionGUID = 0; State = CANNON_NOT_USED; - uiSmiteChestGUID = 0; } virtual void Update(uint32 diff) override @@ -227,7 +219,7 @@ class instance_deadmines : public InstanceMapScript return 0; } - uint64 GetData64(uint32 data) const override + ObjectGuid GetGuidData(uint32 data) const override { switch (data) { @@ -235,7 +227,7 @@ class instance_deadmines : public InstanceMapScript return uiSmiteChestGUID; } - return 0; + return ObjectGuid::Empty; } }; diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp index d009986651a..6d9d07fdd81 100644 --- a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp +++ b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp @@ -103,8 +103,8 @@ public: uint8 uiPhase; uint32 uiTimer; - std::list<uint64> SummonList; - std::list<uint64> GoSummonList; + GuidList SummonList; + GuidList GoSummonList; void Reset() override { @@ -147,7 +147,7 @@ public: if (GoSummonList.empty()) return; - for (std::list<uint64>::const_iterator itr = GoSummonList.begin(); itr != GoSummonList.end(); ++itr) + for (GuidList::const_iterator itr = GoSummonList.begin(); itr != GoSummonList.end(); ++itr) { if (GameObject* go = ObjectAccessor::GetGameObject(*me, *itr)) { @@ -162,33 +162,33 @@ public: } } - if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(isRight ? DATA_GO_CAVE_IN_RIGHT : DATA_GO_CAVE_IN_LEFT))) - instance->HandleGameObject(0, false, go); + if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(isRight ? DATA_GO_CAVE_IN_RIGHT : DATA_GO_CAVE_IN_LEFT))) + instance->HandleGameObject(ObjectGuid::Empty, false, go); } void SetInFace(bool isRight) { - if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(isRight ? DATA_GO_CAVE_IN_RIGHT : DATA_GO_CAVE_IN_LEFT))) + if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(isRight ? DATA_GO_CAVE_IN_RIGHT : DATA_GO_CAVE_IN_LEFT))) me->SetFacingToObject(go); } void RestoreAll() { - if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_RIGHT))) - instance->HandleGameObject(0, false, go); + if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_GO_CAVE_IN_RIGHT))) + instance->HandleGameObject(ObjectGuid::Empty, false, go); - if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_LEFT))) - instance->HandleGameObject(0, false, go); + if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_GO_CAVE_IN_LEFT))) + instance->HandleGameObject(ObjectGuid::Empty, false, go); if (!GoSummonList.empty()) - for (std::list<uint64>::const_iterator itr = GoSummonList.begin(); itr != GoSummonList.end(); ++itr) + for (GuidList::const_iterator itr = GoSummonList.begin(); itr != GoSummonList.end(); ++itr) { if (GameObject* go = ObjectAccessor::GetGameObject(*me, *itr)) go->RemoveFromWorld(); } if (!SummonList.empty()) - for (std::list<uint64>::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr) + for (GuidList::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr) { if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) { @@ -398,8 +398,8 @@ public: SetInFace(true); Talk(SAY_BLASTMASTER_5); Summon(1); - if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_RIGHT))) - instance->HandleGameObject(0, true, go); + if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_GO_CAVE_IN_RIGHT))) + instance->HandleGameObject(ObjectGuid::Empty, true, go); NextStep(3000, true); break; case 7: @@ -444,8 +444,8 @@ public: case 16: Talk(SAY_BLASTMASTER_14); SetInFace(false); - if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_LEFT))) - instance->HandleGameObject(0, true, go); + if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_GO_CAVE_IN_LEFT))) + instance->HandleGameObject(ObjectGuid::Empty, true, go); NextStep(2000, true); break; case 17: diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp index f8e00fab682..9cd6afaca78 100644 --- a/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp +++ b/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp @@ -41,19 +41,14 @@ public: uint32 m_auiEncounter[MAX_ENCOUNTER]; - uint64 uiCaveInLeftGUID; - uint64 uiCaveInRightGUID; + ObjectGuid uiCaveInLeftGUID; + ObjectGuid uiCaveInRightGUID; - uint64 uiBastmasterEmiShortfuseGUID; + ObjectGuid uiBastmasterEmiShortfuseGUID; void Initialize() override { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - uiCaveInLeftGUID = 0; - uiCaveInRightGUID = 0; - - uiBastmasterEmiShortfuseGUID = 0; } void Load(const char* in) override @@ -93,12 +88,12 @@ public: case GO_CAVE_IN_LEFT: uiCaveInLeftGUID = go->GetGUID(); if (m_auiEncounter[0] == DONE || m_auiEncounter[0] == NOT_STARTED) - HandleGameObject(0, false, go); + HandleGameObject(ObjectGuid::Empty, false, go); break; case GO_CAVE_IN_RIGHT: uiCaveInRightGUID = go->GetGUID(); if (m_auiEncounter[0] == DONE || m_auiEncounter[0] == NOT_STARTED) - HandleGameObject(0, false, go); + HandleGameObject(ObjectGuid::Empty, false, go); break; } } @@ -124,7 +119,7 @@ public: return 0; } - uint64 GetData64(uint32 uiType) const override + ObjectGuid GetGuidData(uint32 uiType) const override { switch (uiType) { @@ -133,7 +128,7 @@ public: case DATA_NPC_BASTMASTER_EMI_SHORTFUSE: return uiBastmasterEmiShortfuseGUID; } - return 0; + return ObjectGuid::Empty; } }; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp index bbddf0aa5f5..87f7ab5f07e 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp @@ -75,10 +75,10 @@ public: void Initialize() { ResetTimer = 0; - Midnight = 0; + Midnight.Clear(); } - uint64 Midnight; + ObjectGuid Midnight; uint8 Phase; uint32 CleaveTimer; uint32 CurseTimer; @@ -141,11 +141,11 @@ public: void Initialize() { Phase = 1; - Attumen = 0; + Attumen.Clear(); Mount_Timer = 0; } - uint64 Attumen; + ObjectGuid Attumen; uint8 Phase; uint32 Mount_Timer; @@ -242,7 +242,7 @@ public: Mount_Timer = 1000; } - void SetMidnight(Creature* pAttumen, uint64 value) + void SetMidnight(Creature* pAttumen, ObjectGuid value) { ENSURE_AI(boss_attumen::boss_attumenAI, pAttumen->AI())->Midnight = value; } @@ -262,7 +262,7 @@ void boss_attumen::boss_attumenAI::UpdateAI(uint32 diff) pMidnight->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); pMidnight->SetVisible(true); } - Midnight = 0; + Midnight.Clear(); me->SetVisible(false); me->Kill(me); } else ResetTimer -= diff; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp index 5b4f25aea44..0d9827d390c 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp @@ -107,7 +107,6 @@ public: { Initialize(); memset(AddId, 0, sizeof(AddId)); - memset(AddGUID, 0, sizeof(AddGUID)); instance = creature->GetInstanceScript(); } @@ -126,7 +125,7 @@ public: InstanceScript* instance; - uint64 AddGUID[4]; + ObjectGuid AddGUID[4]; uint32 Vanish_Timer; uint32 Blind_Timer; @@ -339,13 +338,10 @@ struct boss_moroes_guestAI : public ScriptedAI { InstanceScript* instance; - uint64 GuestGUID[4]; + ObjectGuid GuestGUID[4]; boss_moroes_guestAI(Creature* creature) : ScriptedAI(creature) { - for (uint8 i = 0; i < 4; ++i) - GuestGUID[i] = 0; - instance = creature->GetInstanceScript(); } @@ -356,15 +352,15 @@ struct boss_moroes_guestAI : public ScriptedAI void AcquireGUID() { - if (Creature* Moroes = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MOROES))) + if (Creature* Moroes = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MOROES))) for (uint8 i = 0; i < 4; ++i) - if (uint64 GUID = ENSURE_AI(boss_moroes::boss_moroesAI, Moroes->AI())->AddGUID[i]) + if (ObjectGuid GUID = ENSURE_AI(boss_moroes::boss_moroesAI, Moroes->AI())->AddGUID[i]) GuestGUID[i] = GUID; } Unit* SelectGuestTarget() { - uint64 TempGUID = GuestGUID[rand32() % 4]; + ObjectGuid TempGUID = GuestGUID[rand32() % 4]; if (TempGUID) { Unit* unit = ObjectAccessor::GetUnit(*me, TempGUID); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp index a928413fea0..77e9e3fe86d 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp @@ -81,13 +81,6 @@ public: Initialize(); instance = creature->GetInstanceScript(); - for (int i=0; i<3; ++i) - { - PortalGUID[i] = 0; - BeamTarget[i] = 0; - BeamerGUID[i] = 0; - } - PortalPhase = false; PhaseTimer = 0; EmpowermentTimer = 0; @@ -112,9 +105,9 @@ public: uint32 NetherbreathTimer; uint32 EmpowermentTimer; uint32 PortalTimer; // timer for beam checking - uint64 PortalGUID[3]; // guid's of portals - uint64 BeamerGUID[3]; // guid's of auxiliary beaming portals - uint64 BeamTarget[3]; // guid's of portals' current targets + ObjectGuid PortalGUID[3]; // guid's of portals + ObjectGuid BeamerGUID[3]; // guid's of auxiliary beaming portals + ObjectGuid BeamTarget[3]; // guid's of portals' current targets bool IsBetween(WorldObject* u1, WorldObject* target, WorldObject* u2) // the in-line checker { @@ -157,7 +150,7 @@ public: pos[GREEN_PORTAL] = ((r % 2) ? 0 : (r > 1 ? 2 : 1)); pos[BLUE_PORTAL] = (r > 1 ? 1 : 2); // Blue Portal not on the left side (0) - for (int i=0; i<3; ++i) + for (int i = 0; i < 3; ++i) if (Creature* portal = me->SummonCreature(PortalID[i], PortalCoord[pos[i]][0], PortalCoord[pos[i]][1], PortalCoord[pos[i]][2], 0, TEMPSUMMON_TIMED_DESPAWN, 60000)) { PortalGUID[i] = portal->GetGUID(); @@ -173,14 +166,14 @@ public: portal->DisappearAndDie(); if (Creature* portal = ObjectAccessor::GetCreature(*me, BeamerGUID[i])) portal->DisappearAndDie(); - PortalGUID[i] = 0; - BeamTarget[i] = 0; + PortalGUID[i].Clear(); + BeamTarget[i].Clear(); } } void UpdatePortals() // Here we handle the beams' behavior { - for (int j=0; j<3; ++j) // j = color + for (int j = 0; j < 3; ++j) // j = color if (Creature* portal = ObjectAccessor::GetCreature(*me, PortalGUID[j])) { // the one who's been cast upon before @@ -198,9 +191,9 @@ public: Player* p = i->GetSource(); if (p && p->IsAlive() // alive && (!target || target->GetDistance2d(portal)>p->GetDistance2d(portal)) // closer than current best - && !p->HasAura(PlayerDebuff[j], 0) // not exhausted - && !p->HasAura(PlayerBuff[(j+1)%3], 0) // not on another beam - && !p->HasAura(PlayerBuff[(j+2)%3], 0) + && !p->HasAura(PlayerDebuff[j]) // not exhausted + && !p->HasAura(PlayerBuff[(j + 1) % 3]) // not on another beam + && !p->HasAura(PlayerBuff[(j + 2) % 3]) && IsBetween(me, p, portal)) // on the beam target = p; } @@ -220,7 +213,7 @@ public: { beamer->CastSpell(target, PortalBeam[j], false); beamer->DisappearAndDie(); - BeamerGUID[j] = 0; + BeamerGUID[j].Clear(); } // create new one and start beaming on the target if (Creature* beamer = portal->SummonCreature(PortalID[j], portal->GetPositionX(), portal->GetPositionY(), portal->GetPositionZ(), portal->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 60000)) @@ -264,7 +257,7 @@ public: void HandleDoors(bool open) // Massive Door switcher { - if (GameObject* Door = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_GO_MASSIVE_DOOR) )) + if (GameObject* Door = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_GO_MASSIVE_DOOR) )) Door->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp index 7ce11653567..619e3c9cd15 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp @@ -159,8 +159,8 @@ public: void HandleTerraceDoors(bool open) { - instance->HandleGameObject(instance->GetData64(DATA_MASTERS_TERRACE_DOOR_1), open); - instance->HandleGameObject(instance->GetData64(DATA_MASTERS_TERRACE_DOOR_2), open); + instance->HandleGameObject(instance->GetGuidData(DATA_MASTERS_TERRACE_DOOR_1), open); + instance->HandleGameObject(instance->GetGuidData(DATA_MASTERS_TERRACE_DOOR_2), open); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp index c09b349f143..06e4859a931 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp @@ -110,11 +110,11 @@ public: struct netherspite_infernalAI : public ScriptedAI { netherspite_infernalAI(Creature* creature) : ScriptedAI(creature), - HellfireTimer(0), CleanupTimer(0), malchezaar(0), point(NULL) { } + HellfireTimer(0), CleanupTimer(0), point(NULL) { } uint32 HellfireTimer; uint32 CleanupTimer; - uint64 malchezaar; + ObjectGuid malchezaar; InfernalPoint *point; void Reset() override { } @@ -189,7 +189,6 @@ public: Initialize(); instance = creature->GetInstanceScript(); - memset(axes, 0, sizeof(axes)); } void Initialize() @@ -208,7 +207,7 @@ public: for (uint8 i = 0; i < 5; ++i) { - enfeeble_targets[i] = 0; + enfeeble_targets[i].Clear(); enfeeble_health[i] = 0; } } @@ -225,12 +224,12 @@ public: uint32 AxesTargetSwitchTimer; uint32 InfernalCleanupTimer; - std::vector<uint64> infernals; + GuidVector infernals; std::vector<InfernalPoint*> positions; - uint64 axes[2]; - uint64 enfeeble_targets[5]; - uint32 enfeeble_health[5]; + ObjectGuid axes[2]; + ObjectGuid enfeeble_targets[5]; + uint64 enfeeble_health[5]; uint32 phase; @@ -246,7 +245,7 @@ public: for (uint8 i = 0; i < TOTAL_INFERNAL_POINTS; ++i) positions.push_back(&InfernalPoints[i]); - instance->HandleGameObject(instance->GetData64(DATA_GO_NETHER_DOOR), true); + instance->HandleGameObject(instance->GetGuidData(DATA_GO_NETHER_DOOR), true); } void KilledUnit(Unit* /*victim*/) override @@ -266,20 +265,20 @@ public: for (uint8 i = 0; i < TOTAL_INFERNAL_POINTS; ++i) positions.push_back(&InfernalPoints[i]); - instance->HandleGameObject(instance->GetData64(DATA_GO_NETHER_DOOR), true); + instance->HandleGameObject(instance->GetGuidData(DATA_GO_NETHER_DOOR), true); } void EnterCombat(Unit* /*who*/) override { Talk(SAY_AGGRO); - instance->HandleGameObject(instance->GetData64(DATA_GO_NETHER_DOOR), false); // Open the door leading further in + instance->HandleGameObject(instance->GetGuidData(DATA_GO_NETHER_DOOR), false); // Open the door leading further in } void InfernalCleanup() { //Infernal Cleanup - for (std::vector<uint64>::const_iterator itr = infernals.begin(); itr != infernals.end(); ++itr) + for (GuidVector::const_iterator itr = infernals.begin(); itr != infernals.end(); ++itr) if (Unit* pInfernal = ObjectAccessor::GetUnit(*me, *itr)) if (pInfernal->IsAlive()) { @@ -297,7 +296,7 @@ public: Unit* axe = ObjectAccessor::GetUnit(*me, axes[i]); if (axe && axe->IsAlive()) axe->Kill(axe); - axes[i] = 0; + axes[i].Clear(); } } @@ -350,7 +349,7 @@ public: Unit* target = ObjectAccessor::GetUnit(*me, enfeeble_targets[i]); if (target && target->IsAlive()) target->SetHealth(enfeeble_health[i]); - enfeeble_targets[i] = 0; + enfeeble_targets[i].Clear(); enfeeble_health[i] = 0; } } @@ -398,7 +397,7 @@ public: if (me->HasUnitState(UNIT_STATE_STUNNED)) // While shifting to phase 2 malchezaar stuns himself return; - if (me->GetVictim() && me->GetUInt64Value(UNIT_FIELD_TARGET) != me->EnsureVictim()->GetGUID()) + if (me->GetVictim() && me->GetTarget() != me->EnsureVictim()->GetGUID()) me->SetTarget(me->EnsureVictim()->GetGUID()); if (phase == 1) @@ -576,11 +575,13 @@ public: void Cleanup(Creature* infernal, InfernalPoint *point) { - for (std::vector<uint64>::iterator itr = infernals.begin(); itr!= infernals.end(); ++itr) - if (*itr == infernal->GetGUID()) + for (GuidVector::iterator itr = infernals.begin(); itr!= infernals.end(); ++itr) { - infernals.erase(itr); - break; + if (*itr == infernal->GetGUID()) + { + infernals.erase(itr); + break; + } } positions.push_back(point); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp index c66f2b335c4..4cb0b61365d 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp @@ -134,7 +134,7 @@ public: uint32 FlameWreathTimer; uint32 FlameWreathCheckTime; - uint64 FlameWreathTarget[3]; + ObjectGuid FlameWreathTarget[3]; float FWTargPosX[3]; float FWTargPosY[3]; @@ -155,7 +155,7 @@ public: // Not in progress instance->SetData(TYPE_ARAN, NOT_STARTED); - instance->HandleGameObject(instance->GetData64(DATA_GO_LIBRARY_DOOR), true); + instance->HandleGameObject(instance->GetGuidData(DATA_GO_LIBRARY_DOOR), true); } void KilledUnit(Unit* /*victim*/) override @@ -168,7 +168,7 @@ public: Talk(SAY_DEATH); instance->SetData(TYPE_ARAN, DONE); - instance->HandleGameObject(instance->GetData64(DATA_GO_LIBRARY_DOOR), true); + instance->HandleGameObject(instance->GetGuidData(DATA_GO_LIBRARY_DOOR), true); } void EnterCombat(Unit* /*who*/) override @@ -176,7 +176,7 @@ public: Talk(SAY_AGGRO); instance->SetData(TYPE_ARAN, IN_PROGRESS); - instance->HandleGameObject(instance->GetData64(DATA_GO_LIBRARY_DOOR), false); + instance->HandleGameObject(instance->GetGuidData(DATA_GO_LIBRARY_DOOR), false); } void FlameWreathEffect() @@ -223,7 +223,7 @@ public: { if (CloseDoorTimer <= diff) { - instance->HandleGameObject(instance->GetData64(DATA_GO_LIBRARY_DOOR), false); + instance->HandleGameObject(instance->GetGuidData(DATA_GO_LIBRARY_DOOR), false); CloseDoorTimer = 0; } else CloseDoorTimer -= diff; } @@ -393,9 +393,9 @@ public: FlameWreathTimer = 20000; FlameWreathCheckTime = 500; - FlameWreathTarget[0] = 0; - FlameWreathTarget[1] = 0; - FlameWreathTarget[2] = 0; + FlameWreathTarget[0].Clear(); + FlameWreathTarget[1].Clear(); + FlameWreathTarget[2].Clear(); FlameWreathEffect(); break; @@ -465,7 +465,7 @@ public: { unit->CastSpell(unit, 20476, true, 0, 0, me->GetGUID()); unit->CastSpell(unit, 11027, true); - FlameWreathTarget[i] = 0; + FlameWreathTarget[i].Clear(); } } FlameWreathCheckTime = 500; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp index ed40c18f70e..db8b1327585 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp @@ -101,7 +101,7 @@ public: void JustDied(Unit* /*killer*/) override { - Creature* Terestian = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TERESTIAN)); + Creature* Terestian = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TERESTIAN)); if (Terestian && Terestian->IsAlive()) DoCast(Terestian, SPELL_BROKEN_PACT, true); } @@ -144,10 +144,10 @@ public: void Initialize() { - SacrificeGUID = 0; + SacrificeGUID.Clear(); } - uint64 SacrificeGUID; + ObjectGuid SacrificeGUID; void Reset() override { @@ -269,10 +269,8 @@ public: { boss_terestianAI(Creature* creature) : ScriptedAI(creature) { - Initialize(); - for (uint8 i = 0; i < 2; ++i) - PortalGUID[i] = 0; instance = creature->GetInstanceScript(); + Initialize(); } void Initialize() @@ -289,7 +287,7 @@ public: InstanceScript* instance; - uint64 PortalGUID[2]; + ObjectGuid PortalGUID[2]; uint8 PortalsCount; uint32 SacrificeTimer; @@ -312,7 +310,7 @@ public: pPortal->DespawnOrUnsummon(); } - PortalGUID[i] = 0; + PortalGUID[i].Clear(); } } @@ -367,7 +365,7 @@ public: if (Creature* pPortal = ObjectAccessor::GetCreature((*me), PortalGUID[i])) pPortal->DespawnOrUnsummon(); - PortalGUID[i] = 0; + PortalGUID[i].Clear(); } } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp index 7b51b61ba0a..63d543568fb 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp @@ -250,11 +250,11 @@ public: void Initialize() { - DorotheeGUID = 0; + DorotheeGUID.Clear(); YipTimer = 10000; } - uint64 DorotheeGUID; + ObjectGuid DorotheeGUID; uint32 YipTimer; void Reset() override @@ -710,10 +710,10 @@ public: Talk(SAY_CRONE_DEATH); instance->SetData(TYPE_OPERA, DONE); - instance->HandleGameObject(instance->GetData64(DATA_GO_STAGEDOORLEFT), true); - instance->HandleGameObject(instance->GetData64(DATA_GO_STAGEDOORRIGHT), true); + instance->HandleGameObject(instance->GetGuidData(DATA_GO_STAGEDOORLEFT), true); + instance->HandleGameObject(instance->GetGuidData(DATA_GO_STAGEDOORRIGHT), true); - if (GameObject* pSideEntrance = instance->instance->GetGameObject(instance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR))) + if (GameObject* pSideEntrance = instance->instance->GetGameObject(instance->GetGuidData(DATA_GO_SIDE_ENTRANCE_DOOR))) pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); } @@ -868,7 +868,7 @@ public: FearTimer = urand(25000, 35000); SwipeTimer = 5000; - HoodGUID = 0; + HoodGUID.Clear(); TempThreat = 0; IsChasing = false; @@ -880,7 +880,7 @@ public: uint32 FearTimer; uint32 SwipeTimer; - uint64 HoodGUID; + ObjectGuid HoodGUID; float TempThreat; bool IsChasing; @@ -910,10 +910,10 @@ public: DoPlaySoundToSet(me, SOUND_WOLF_DEATH); instance->SetData(TYPE_OPERA, DONE); - instance->HandleGameObject(instance->GetData64(DATA_GO_STAGEDOORLEFT), true); - instance->HandleGameObject(instance->GetData64(DATA_GO_STAGEDOORRIGHT), true); + instance->HandleGameObject(instance->GetGuidData(DATA_GO_STAGEDOORLEFT), true); + instance->HandleGameObject(instance->GetGuidData(DATA_GO_STAGEDOORRIGHT), true); - if (GameObject* pSideEntrance = instance->instance->GetGameObject(instance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR))) + if (GameObject* pSideEntrance = instance->instance->GetGameObject(instance->GetGuidData(DATA_GO_SIDE_ENTRANCE_DOOR))) pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); } @@ -947,7 +947,7 @@ public: if (Unit* target = ObjectAccessor::GetUnit(*me, HoodGUID)) { - HoodGUID = 0; + HoodGUID.Clear(); if (DoGetThreat(target)) DoModifyThreatPercent(target, -100); me->AddThreat(target, TempThreat); @@ -1073,7 +1073,7 @@ public: void Initialize() { - RomuloGUID = 0; + RomuloGUID.Clear(); Phase = PHASE_JULIANNE; BlindingPassionTimer = 30000; @@ -1093,7 +1093,7 @@ public: uint32 EntryYellTimer; uint32 AggroYellTimer; - uint64 RomuloGUID; + ObjectGuid RomuloGUID; uint32 Phase; @@ -1160,9 +1160,9 @@ public: Talk(SAY_JULIANNE_DEATH02); instance->SetData(TYPE_OPERA, DONE); - instance->HandleGameObject(instance->GetData64(DATA_GO_STAGEDOORLEFT), true); - instance->HandleGameObject(instance->GetData64(DATA_GO_STAGEDOORRIGHT), true); - if (GameObject* pSideEntrance = instance->instance->GetGameObject(instance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR))) + instance->HandleGameObject(instance->GetGuidData(DATA_GO_STAGEDOORLEFT), true); + instance->HandleGameObject(instance->GetGuidData(DATA_GO_STAGEDOORRIGHT), true); + if (GameObject* pSideEntrance = instance->instance->GetGameObject(instance->GetGuidData(DATA_GO_SIDE_ENTRANCE_DOOR))) pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); } @@ -1197,7 +1197,7 @@ public: void Initialize() { - JulianneGUID = 0; + JulianneGUID.Clear(); Phase = PHASE_ROMULO; BackwardLungeTimer = 15000; @@ -1212,7 +1212,7 @@ public: InstanceScript* instance; - uint64 JulianneGUID; + ObjectGuid JulianneGUID; uint32 Phase; uint32 EntryYellTimer; @@ -1318,10 +1318,10 @@ public: Talk(SAY_ROMULO_DEATH); instance->SetData(TYPE_OPERA, DONE); - instance->HandleGameObject(instance->GetData64(DATA_GO_STAGEDOORLEFT), true); - instance->HandleGameObject(instance->GetData64(DATA_GO_STAGEDOORRIGHT), true); + instance->HandleGameObject(instance->GetGuidData(DATA_GO_STAGEDOORLEFT), true); + instance->HandleGameObject(instance->GetGuidData(DATA_GO_STAGEDOORRIGHT), true); - if (GameObject* pSideEntrance = instance->instance->GetGameObject(instance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR))) + if (GameObject* pSideEntrance = instance->instance->GetGameObject(instance->GetGuidData(DATA_GO_SIDE_ENTRANCE_DOOR))) pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp index 8f6d142e22b..0d639df731a 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp @@ -64,21 +64,21 @@ public: uint32 m_uiOperaEvent; uint32 m_uiOzDeathCount; - uint64 m_uiCurtainGUID; - uint64 m_uiStageDoorLeftGUID; - uint64 m_uiStageDoorRightGUID; - uint64 m_uiKilrekGUID; - uint64 m_uiTerestianGUID; - uint64 m_uiMoroesGUID; - uint64 m_uiLibraryDoor; // Door at Shade of Aran - uint64 m_uiMassiveDoor; // Door at Netherspite - uint64 m_uiSideEntranceDoor; // Side Entrance - uint64 m_uiGamesmansDoor; // Door before Chess - uint64 m_uiGamesmansExitDoor; // Door after Chess - uint64 m_uiNetherspaceDoor; // Door at Malchezaar - uint64 MastersTerraceDoor[2]; - uint64 ImageGUID; - uint64 DustCoveredChest; + ObjectGuid m_uiCurtainGUID; + ObjectGuid m_uiStageDoorLeftGUID; + ObjectGuid m_uiStageDoorRightGUID; + ObjectGuid m_uiKilrekGUID; + ObjectGuid m_uiTerestianGUID; + ObjectGuid m_uiMoroesGUID; + ObjectGuid m_uiLibraryDoor; // Door at Shade of Aran + ObjectGuid m_uiMassiveDoor; // Door at Netherspite + ObjectGuid m_uiSideEntranceDoor; // Side Entrance + ObjectGuid m_uiGamesmansDoor; // Door before Chess + ObjectGuid m_uiGamesmansExitDoor; // Door after Chess + ObjectGuid m_uiNetherspaceDoor; // Door at Malchezaar + ObjectGuid MastersTerraceDoor[2]; + ObjectGuid ImageGUID; + ObjectGuid DustCoveredChest; void Initialize() override { @@ -88,25 +88,6 @@ public: // 1 - OZ, 2 - HOOD, 3 - RAJ, this never gets altered. m_uiOperaEvent = urand(1, 3); m_uiOzDeathCount = 0; - - m_uiCurtainGUID = 0; - m_uiStageDoorLeftGUID = 0; - m_uiStageDoorRightGUID = 0; - - m_uiKilrekGUID = 0; - m_uiTerestianGUID = 0; - m_uiMoroesGUID = 0; - - m_uiLibraryDoor = 0; - m_uiMassiveDoor = 0; - m_uiSideEntranceDoor = 0; - m_uiGamesmansDoor = 0; - m_uiGamesmansExitDoor = 0; - m_uiNetherspaceDoor = 0; - MastersTerraceDoor[0]= 0; - MastersTerraceDoor[1]= 0; - ImageGUID = 0; - DustCoveredChest = 0; } bool IsEncounterInProgress() const override @@ -183,7 +164,7 @@ public: } } - void SetData64(uint32 identifier, uint64 data) override + void SetGuidData(uint32 identifier, ObjectGuid data) override { switch (identifier) { @@ -265,7 +246,7 @@ public: return 0; } - uint64 GetData64(uint32 uiData) const override + ObjectGuid GetGuidData(uint32 uiData) const override { switch (uiData) { @@ -286,7 +267,7 @@ public: case DATA_IMAGE_OF_MEDIVH: return ImageGUID; } - return 0; + return ObjectGuid::Empty; } void Load(char const* chrIn) diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp index 716b32601be..159035c6eb3 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp @@ -139,7 +139,7 @@ public: void Initialize() { - m_uiSpotlightGUID = 0; + m_uiSpotlightGUID.Clear(); TalkCount = 0; TalkTimer = 2000; @@ -150,7 +150,7 @@ public: InstanceScript* instance; - uint64 m_uiSpotlightGUID; + ObjectGuid m_uiSpotlightGUID; uint32 TalkCount; uint32 TalkTimer; @@ -186,7 +186,7 @@ public: { case 0: DoCast(me, SPELL_TUXEDO, false); - instance->DoUseDoorOrButton(instance->GetData64(DATA_GO_STAGEDOORLEFT)); + instance->DoUseDoorOrButton(instance->GetGuidData(DATA_GO_STAGEDOORLEFT)); break; case 4: TalkCount = 0; @@ -202,12 +202,12 @@ public: } break; case 8: - instance->DoUseDoorOrButton(instance->GetData64(DATA_GO_STAGEDOORLEFT)); + instance->DoUseDoorOrButton(instance->GetGuidData(DATA_GO_STAGEDOORLEFT)); PerformanceReady = true; break; case 9: PrepareEncounter(); - instance->DoUseDoorOrButton(instance->GetData64(DATA_GO_CURTAINS)); + instance->DoUseDoorOrButton(instance->GetGuidData(DATA_GO_CURTAINS)); break; } } @@ -360,17 +360,17 @@ public: case GOSSIP_ACTION_INFO_DEF+3: player->CLOSE_GOSSIP_MENU(); pBarnesAI->m_uiEventId = EVENT_OZ; - TC_LOG_INFO("scripts", "player (GUID " UI64FMTD ") manually set Opera event to EVENT_OZ", player->GetGUID()); + TC_LOG_INFO("scripts", "player (%s) manually set Opera event to EVENT_OZ", player->GetGUID().ToString().c_str()); break; case GOSSIP_ACTION_INFO_DEF+4: player->CLOSE_GOSSIP_MENU(); pBarnesAI->m_uiEventId = EVENT_HOOD; - TC_LOG_INFO("scripts", "player (GUID " UI64FMTD ") manually set Opera event to EVENT_HOOD", player->GetGUID()); + TC_LOG_INFO("scripts", "player (%s) manually set Opera event to EVENT_HOOD", player->GetGUID().ToString().c_str()); break; case GOSSIP_ACTION_INFO_DEF+5: player->CLOSE_GOSSIP_MENU(); pBarnesAI->m_uiEventId = EVENT_RAJ; - TC_LOG_INFO("scripts", "player (GUID " UI64FMTD ") manually set Opera event to EVENT_RAJ", player->GetGUID()); + TC_LOG_INFO("scripts", "player (%s) manually set Opera event to EVENT_RAJ", player->GetGUID().ToString().c_str()); break; } @@ -491,14 +491,14 @@ public: void Initialize() { - ArcanagosGUID = 0; + ArcanagosGUID.Clear(); EventStarted = false; YellTimer = 0; } InstanceScript* instance; - uint64 ArcanagosGUID; + ObjectGuid ArcanagosGUID; uint32 YellTimer; uint32 Step; @@ -511,9 +511,9 @@ public: { Initialize(); - if (instance->GetData64(DATA_IMAGE_OF_MEDIVH) == 0) + if (instance->GetGuidData(DATA_IMAGE_OF_MEDIVH).IsEmpty()) { - instance->SetData64(DATA_IMAGE_OF_MEDIVH, me->GetGUID()); + instance->SetGuidData(DATA_IMAGE_OF_MEDIVH, me->GetGUID()); (*me).GetMotionMaster()->MovePoint(1, MedivPos[0], MedivPos[1], MedivPos[2]); Step = 0; } diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp index 1aafb32cef9..bae61f9b452 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp @@ -166,7 +166,7 @@ public: instance->SetBossState(DATA_KAELTHAS, DONE); // Enable the Translocation Orb Exit - if (GameObject* escapeOrb = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_ESCAPE_ORB))) + if (GameObject* escapeOrb = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_ESCAPE_ORB))) escapeOrb->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); } @@ -253,7 +253,7 @@ public: unit->CastSpell(unit, SPELL_GRAVITY_LAPSE_FLY, true, 0, 0, me->GetGUID()); // Use packet hack WorldPacket data(SMSG_MOVE_SET_CAN_FLY, 12); - data.append(unit->GetPackGUID()); + data << unit->GetPackGUID(); data << uint32(0); unit->SendMessageToSet(&data, true); } @@ -273,7 +273,7 @@ public: unit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_DOT); WorldPacket data(SMSG_MOVE_UNSET_CAN_FLY, 12); - data.append(unit->GetPackGUID()); + data << unit->GetPackGUID(); data << uint32(0); unit->SendMessageToSet(&data, true); } @@ -548,7 +548,7 @@ public: me->ModifyAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, false); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->ClearAllReactives(); - me->SetTarget(0); + me->SetTarget(ObjectGuid::Empty); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveIdle(); me->SetStandState(UNIT_STAND_STATE_DEAD); diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp index cc2af3dcea5..9acf82c312e 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp @@ -119,7 +119,6 @@ public: { Initialize(); instance = creature->GetInstanceScript(); - memset(&m_auiLackeyGUID, 0, sizeof(m_auiLackeyGUID)); LackeyEntryList.clear(); } @@ -138,7 +137,7 @@ public: InstanceScript* instance; std::vector<uint32> LackeyEntryList; - uint64 m_auiLackeyGUID[MAX_ACTIVE_LACKEY]; + ObjectGuid m_auiLackeyGUID[MAX_ACTIVE_LACKEY]; uint8 PlayersKilled; @@ -361,7 +360,6 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI { Initialize(); instance = creature->GetInstanceScript(); - memset(&m_auiLackeyGUIDs, 0, sizeof(m_auiLackeyGUIDs)); AcquireGUIDs(); } @@ -378,7 +376,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI InstanceScript* instance; - uint64 m_auiLackeyGUIDs[MAX_ACTIVE_LACKEY]; + ObjectGuid m_auiLackeyGUIDs[MAX_ACTIVE_LACKEY]; uint32 ResetThreatTimer; bool UsedPotion; @@ -388,7 +386,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI Initialize(); // in case she is not alive and Reset was for some reason called, respawn her (most likely party wipe after killing her) - if (Creature* pDelrissa = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DELRISSA))) + if (Creature* pDelrissa = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DELRISSA))) { if (!pDelrissa->IsAlive()) pDelrissa->Respawn(); @@ -412,7 +410,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI } } - if (Creature* pDelrissa = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DELRISSA))) + if (Creature* pDelrissa = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DELRISSA))) { if (pDelrissa->IsAlive() && !pDelrissa->GetVictim()) { @@ -424,7 +422,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI void JustDied(Unit* /*killer*/) override { - Creature* pDelrissa = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DELRISSA)); + Creature* pDelrissa = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DELRISSA)); uint32 uiLackeyDeathCount = instance->GetData(DATA_DELRISSA_DEATH_COUNT); if (!pDelrissa) @@ -453,13 +451,13 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI void KilledUnit(Unit* victim) override { - if (Creature* Delrissa = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DELRISSA))) + if (Creature* Delrissa = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DELRISSA))) Delrissa->AI()->KilledUnit(victim); } void AcquireGUIDs() { - if (Creature* Delrissa = (ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DELRISSA)))) + if (Creature* Delrissa = (ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DELRISSA)))) { for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) m_auiLackeyGUIDs[i] = ENSURE_AI(boss_priestess_delrissa::boss_priestess_delrissaAI, Delrissa->AI())->m_auiLackeyGUID[i]; @@ -1054,7 +1052,6 @@ public: boss_garaxxasAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) { Initialize(); - m_uiPetGUID = 0; } void Initialize() @@ -1067,7 +1064,7 @@ public: Freezing_Trap_Timer = 15000; } - uint64 m_uiPetGUID; + ObjectGuid m_uiPetGUID; uint32 Aimed_Shot_Timer; uint32 Shoot_Timer; diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp index d34123c58b2..c186470f2d5 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp @@ -71,7 +71,6 @@ class boss_selin_fireheart : public CreatureScript { boss_selin_fireheartAI(Creature* creature) : BossAI(creature, DATA_SELIN) { - CrystalGUID = 0; _scheduledEvents = false; } @@ -89,7 +88,7 @@ class boss_selin_fireheart : public CreatureScript } _Reset(); - CrystalGUID = 0; + CrystalGUID.Clear(); _scheduledEvents = false; } @@ -221,7 +220,7 @@ class boss_selin_fireheart : public CreatureScript if (CrystalChosen && CrystalChosen->IsAlive()) CrystalChosen->Kill(CrystalChosen); - CrystalGUID = 0; + CrystalGUID.Clear(); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveChase(me->GetVictim()); @@ -255,7 +254,7 @@ class boss_selin_fireheart : public CreatureScript private: std::list<Creature*> Crystals; - uint64 CrystalGUID; + ObjectGuid CrystalGUID; bool _scheduledEvents; }; @@ -278,7 +277,7 @@ class npc_fel_crystal : public CreatureScript { if (InstanceScript* instance = me->GetInstanceScript()) { - Creature* Selin = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SELIN)); + Creature* Selin = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SELIN)); if (Selin && Selin->IsAlive()) Selin->AI()->DoAction(ACTION_SWITCH_PHASE); } diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp index 01491c53f72..65fed52d998 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp @@ -50,12 +50,6 @@ class instance_magisters_terrace : public InstanceMapScript LoadDoorData(doorData); DelrissaDeathCount = 0; - - SelinGUID = 0; - DelrissaGUID = 0; - EscapeOrbGUID = 0; - - memset(KaelStatue, 0, 2 * sizeof(uint64)); } uint32 GetData(uint32 type) const override @@ -162,7 +156,7 @@ class instance_magisters_terrace : public InstanceMapScript return true; } - uint64 GetData64(uint32 type) const override + ObjectGuid GetGuidData(uint32 type) const override { switch (type) { @@ -179,14 +173,14 @@ class instance_magisters_terrace : public InstanceMapScript default: break; } - return 0; + return ObjectGuid::Empty; } protected: - uint64 SelinGUID; - uint64 DelrissaGUID; - uint64 KaelStatue[2]; - uint64 EscapeOrbGUID; + ObjectGuid SelinGUID; + ObjectGuid DelrissaGUID; + ObjectGuid KaelStatue[2]; + ObjectGuid EscapeOrbGUID; uint32 DelrissaDeathCount; }; diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp index a20f595183f..6cd14598a58 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp @@ -165,7 +165,7 @@ public: if (Player* player = i->GetSource()) { if (spell && spell->Effects[0].MiscValue) - player->KilledMonsterCredit(spell->Effects[0].MiscValue, 0); + player->KilledMonsterCredit(spell->Effects[0].MiscValue); } } } diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index 58ebef77425..e9039da892c 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -107,7 +107,6 @@ public: if (!me->GetCurrentEquipmentId()) me->SetCurrentEquipmentId(me->GetOriginalEquipmentId()); - playerGUID = 0; wait_timer = 0; anchorX = 0.f; anchorY = 0.f; @@ -115,15 +114,15 @@ public: void Initialize() { - anchorGUID = 0; + anchorGUID.Clear(); phase = PHASE_CHAINED; } - uint64 playerGUID; + ObjectGuid playerGUID; UnworthyInitiatePhase phase; uint32 wait_timer; float anchorX, anchorY; - uint64 anchorGUID; + ObjectGuid anchorGUID; EventMap events; @@ -300,17 +299,17 @@ public: struct npc_unworthy_initiate_anchorAI : public PassiveAI { - npc_unworthy_initiate_anchorAI(Creature* creature) : PassiveAI(creature), prisonerGUID(0) { } + npc_unworthy_initiate_anchorAI(Creature* creature) : PassiveAI(creature) { } - uint64 prisonerGUID; + ObjectGuid prisonerGUID; - void SetGUID(uint64 guid, int32 /*id*/) override + void SetGUID(ObjectGuid guid, int32 /*id*/) override { if (!prisonerGUID) prisonerGUID = guid; } - uint64 GetGUID(int32 /*id*/) const override + ObjectGuid GetGUID(int32 /*id*/) const override { return prisonerGUID; } @@ -325,7 +324,7 @@ public: bool OnGossipHello(Player* player, GameObject* go) override { if (Creature* anchor = go->FindNearestCreature(29521, 15)) - if (uint64 prisonerGUID = anchor->AI()->GetGUID()) + if (ObjectGuid prisonerGUID = anchor->AI()->GetGUID()) if (Creature* prisoner = ObjectAccessor::GetCreature(*player, prisonerGUID)) ENSURE_AI(npc_unworthy_initiate::npc_unworthy_initiateAI, prisoner->AI())->EventStart(anchor, player); @@ -532,14 +531,14 @@ public: void Initialize() { - m_uiDuelerGUID = 0; + m_uiDuelerGUID.Clear(); m_uiDuelTimer = 5000; m_bIsDuelInProgress = false; lose = false; } bool lose; - uint64 m_uiDuelerGUID; + ObjectGuid m_uiDuelerGUID; uint32 m_uiDuelTimer; bool m_bIsDuelInProgress; @@ -655,7 +654,7 @@ class npc_dark_rider_of_acherus : public CreatureScript PhaseTimer = 4000; Phase = 0; Intro = false; - TargetGUID = 0; + TargetGUID.Clear(); } void Reset() override @@ -716,7 +715,7 @@ class npc_dark_rider_of_acherus : public CreatureScript uint32 PhaseTimer; uint32 Phase; bool Intro; - uint64 TargetGUID; + ObjectGuid TargetGUID; }; CreatureAI* GetAI(Creature* creature) const override @@ -1010,7 +1009,7 @@ class npc_scarlet_miner_cart : public CreatureScript struct npc_scarlet_miner_cartAI : public PassiveAI { - npc_scarlet_miner_cartAI(Creature* creature) : PassiveAI(creature), _minerGUID(0), _playerGUID(0) + npc_scarlet_miner_cartAI(Creature* creature) : PassiveAI(creature) { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); // Modelid2 is a horse. @@ -1028,7 +1027,7 @@ class npc_scarlet_miner_cart : public CreatureScript void SummonedCreatureDespawn(Creature* summon) override { if (summon->GetEntry() == NPC_MINER) - _minerGUID = 0; + _minerGUID.Clear(); } void DoAction(int32 /*param*/) override @@ -1054,15 +1053,15 @@ class npc_scarlet_miner_cart : public CreatureScript } else { - _playerGUID = 0; + _playerGUID.Clear(); if (Creature* miner = ObjectAccessor::GetCreature(*me, _minerGUID)) miner->DespawnOrUnsummon(); } } private: - uint64 _minerGUID; - uint64 _playerGUID; + ObjectGuid _minerGUID; + ObjectGuid _playerGUID; }; CreatureAI* GetAI(Creature* creature) const override @@ -1096,14 +1095,14 @@ class npc_scarlet_miner : public CreatureScript void Initialize() { - carGUID = 0; + carGUID.Clear(); IntroTimer = 0; IntroPhase = 0; } uint32 IntroTimer; uint32 IntroPhase; - uint64 carGUID; + ObjectGuid carGUID; void Reset() override { @@ -1148,7 +1147,7 @@ class npc_scarlet_miner : public CreatureScript } } - void SetGUID(uint64 guid, int32 /*id = 0*/) override + void SetGUID(ObjectGuid guid, int32 /*id = 0*/) override { InitWaypoint(); Start(false, false, guid); diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp index ee624c4f6a5..fe433a6692d 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp @@ -60,12 +60,12 @@ public: { speechTimer = 0; speechCounter = 0; - playerGUID = 0; + playerGUID.Clear(); } uint32 speechTimer; uint32 speechCounter; - uint64 playerGUID; + ObjectGuid playerGUID; void Reset() override { @@ -223,7 +223,7 @@ public: { wave = 0; waveTimer = 3000; - valrothGUID = 0; + valrothGUID.Clear(); } void Reset() override @@ -357,7 +357,7 @@ public: private: uint8 wave; uint32 waveTimer; - uint64 valrothGUID; + ObjectGuid valrothGUID; }; @@ -642,12 +642,12 @@ public: { ExecuteSpeech_Timer = 0; ExecuteSpeech_Counter = 0; - PlayerGUID = 0; + PlayerGUID.Clear(); } uint32 ExecuteSpeech_Timer; uint32 ExecuteSpeech_Counter; - uint64 PlayerGUID; + ObjectGuid PlayerGUID; void Reset() override { diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp index f6757afd5bc..d67c28a3552 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp @@ -311,25 +311,6 @@ public: { npc_highlord_darion_mograineAI(Creature* creature) : npc_escortAI(creature) { - uiTirionGUID = 0; - uiAlexandrosGUID = 0; - uiDarionGUID = 0; - uiKorfaxGUID = 0; - uiMaxwellGUID = 0; - uiEligorGUID = 0; - uiRayneGUID = 0; - uiKoltiraGUID = 0; - uiOrbazGUID = 0; - uiThassarianGUID = 0; - uiLichKingGUID = 0; - - memset(uiDefenderGUID, 0, sizeof(uiDefenderGUID)); - memset(uiEarthshatterGUID, 0, sizeof(uiEarthshatterGUID)); - memset(uiAbominationGUID, 0, sizeof(uiAbominationGUID)); - memset(uiBehemothGUID, 0, sizeof(uiBehemothGUID)); - memset(uiGhoulGUID, 0, sizeof(uiGhoulGUID)); - memset(uiWarriorGUID, 0, sizeof(uiWarriorGUID)); - Reset(); } @@ -352,25 +333,25 @@ public: uint32 uiTargetcheck; // Dawn - uint64 uiTirionGUID; - uint64 uiAlexandrosGUID; - uint64 uiDarionGUID; - uint64 uiKorfaxGUID; - uint64 uiMaxwellGUID; - uint64 uiEligorGUID; - uint64 uiRayneGUID; - uint64 uiDefenderGUID[ENCOUNTER_DEFENDER_NUMBER]; - uint64 uiEarthshatterGUID[ENCOUNTER_EARTHSHATTER_NUMBER]; + ObjectGuid uiTirionGUID; + ObjectGuid uiAlexandrosGUID; + ObjectGuid uiDarionGUID; + ObjectGuid uiKorfaxGUID; + ObjectGuid uiMaxwellGUID; + ObjectGuid uiEligorGUID; + ObjectGuid uiRayneGUID; + ObjectGuid uiDefenderGUID[ENCOUNTER_DEFENDER_NUMBER]; + ObjectGuid uiEarthshatterGUID[ENCOUNTER_EARTHSHATTER_NUMBER]; // Death - uint64 uiKoltiraGUID; - uint64 uiOrbazGUID; - uint64 uiThassarianGUID; - uint64 uiLichKingGUID; - uint64 uiAbominationGUID[ENCOUNTER_ABOMINATION_NUMBER]; - uint64 uiBehemothGUID[ENCOUNTER_BEHEMOTH_NUMBER]; - uint64 uiGhoulGUID[ENCOUNTER_GHOUL_NUMBER]; - uint64 uiWarriorGUID[ENCOUNTER_WARRIOR_NUMBER]; + ObjectGuid uiKoltiraGUID; + ObjectGuid uiOrbazGUID; + ObjectGuid uiThassarianGUID; + ObjectGuid uiLichKingGUID; + ObjectGuid uiAbominationGUID[ENCOUNTER_ABOMINATION_NUMBER]; + ObjectGuid uiBehemothGUID[ENCOUNTER_BEHEMOTH_NUMBER]; + ObjectGuid uiGhoulGUID[ENCOUNTER_GHOUL_NUMBER]; + ObjectGuid uiWarriorGUID[ENCOUNTER_WARRIOR_NUMBER]; void Reset() override { @@ -413,23 +394,23 @@ public: if (Creature* temp = ObjectAccessor::GetCreature(*me, uiRayneGUID)) temp->setDeathState(JUST_DIED); - uiTirionGUID = 0; - uiKorfaxGUID = 0; - uiMaxwellGUID = 0; - uiEligorGUID = 0; - uiRayneGUID = 0; + uiTirionGUID.Clear(); + uiKorfaxGUID.Clear(); + uiMaxwellGUID.Clear(); + uiEligorGUID.Clear(); + uiRayneGUID.Clear(); for (uint8 i = 0; i < ENCOUNTER_DEFENDER_NUMBER; ++i) { if (Creature* temp = ObjectAccessor::GetCreature(*me, uiDefenderGUID[i])) temp->setDeathState(JUST_DIED); - uiDefenderGUID[i] = 0; + uiDefenderGUID[i].Clear(); } for (uint8 i = 0; i < ENCOUNTER_EARTHSHATTER_NUMBER; ++i) { if (Creature* temp = ObjectAccessor::GetCreature(*me, uiEarthshatterGUID[i])) temp->setDeathState(JUST_DIED); - uiEarthshatterGUID[i] = 0; + uiEarthshatterGUID[i].Clear(); } if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKoltiraGUID)) @@ -441,33 +422,33 @@ public: if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID)) temp->Respawn(); - uiKoltiraGUID = 0; - uiOrbazGUID = 0; - uiThassarianGUID = 0; - uiLichKingGUID = 0; + uiKoltiraGUID.Clear(); + uiOrbazGUID.Clear(); + uiThassarianGUID.Clear(); + uiLichKingGUID.Clear(); for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) { if (Creature* temp = ObjectAccessor::GetCreature(*me, uiAbominationGUID[i])) temp->setDeathState(JUST_DIED); - uiAbominationGUID[i] = 0; + uiAbominationGUID[i].Clear(); } for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) { if (Creature* temp = ObjectAccessor::GetCreature(*me, uiBehemothGUID[i])) temp->setDeathState(JUST_DIED); - uiBehemothGUID[i] = 0; + uiBehemothGUID[i].Clear(); } for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) { if (Creature* temp = ObjectAccessor::GetCreature(*me, uiGhoulGUID[i])) temp->setDeathState(JUST_DIED); - uiGhoulGUID[i] = 0; + uiGhoulGUID[i].Clear(); } for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) { if (Creature* temp = ObjectAccessor::GetCreature(*me, uiWarriorGUID[i])) temp->setDeathState(JUST_DIED); - uiWarriorGUID[i] = 0; + uiWarriorGUID[i].Clear(); } } } @@ -552,18 +533,18 @@ public: //Unit* pTirion = ObjectAccessor::GetCreature(*me, uiTirionGUID); Talk(EMOTE_LIGHT_OF_DAWN05); - if (me->HasAura(SPELL_THE_LIGHT_OF_DAWN, 0)) + if (me->HasAura(SPELL_THE_LIGHT_OF_DAWN)) me->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN); if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKoltiraGUID)) { - if (temp->HasAura(SPELL_THE_LIGHT_OF_DAWN, 0)) + if (temp->HasAura(SPELL_THE_LIGHT_OF_DAWN)) temp->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN); temp->SetWalk(true); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[19].x, LightofDawnLoc[19].y, LightofDawnLoc[19].z); } if (Creature* temp = ObjectAccessor::GetCreature(*me, uiThassarianGUID)) { - if (temp->HasAura(SPELL_THE_LIGHT_OF_DAWN, 0)) + if (temp->HasAura(SPELL_THE_LIGHT_OF_DAWN)) temp->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN); temp->SetWalk(true); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[21].x, LightofDawnLoc[21].y, LightofDawnLoc[21].z); @@ -1143,7 +1124,7 @@ public: me->SummonGameObject(GO_LIGHT_OF_DAWN, 2283.896f, -5287.914f, 83.066f, 0, 0, 0, 0, 0, 30); if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID)) { - if (temp->HasAura(SPELL_REBIRTH_OF_THE_ASHBRINGER, 0)) + if (temp->HasAura(SPELL_REBIRTH_OF_THE_ASHBRINGER)) temp->RemoveAurasDueToSpell(SPELL_REBIRTH_OF_THE_ASHBRINGER); temp->CastSpell(temp, 41542, false); // workarounds, light expoded, makes it cool temp->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); @@ -1433,7 +1414,7 @@ public: bIsBattle = false; uiFight_duration = 300000; - if (me->HasAura(SPELL_THE_MIGHT_OF_MOGRAINE, 0)) + if (me->HasAura(SPELL_THE_MIGHT_OF_MOGRAINE)) me->RemoveAurasDueToSpell(SPELL_THE_MIGHT_OF_MOGRAINE); me->RemoveAllAuras(); me->DeleteThreatList(); @@ -1532,7 +1513,7 @@ public: ++uiStep; } - void NPCChangeTarget(uint64 ui_GUID) + void NPCChangeTarget(ObjectGuid ui_GUID) { if (Creature* temp = ObjectAccessor::GetCreature(*me, ui_GUID)) if (temp->IsAlive()) @@ -1651,7 +1632,7 @@ public: } } - void DespawnNPC(uint64 pGUID) + void DespawnNPC(ObjectGuid pGUID) { if (Creature* temp = ObjectAccessor::GetCreature(*me, pGUID)) if (temp->IsAlive()) diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp index b9429954dea..58165df48ef 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp @@ -240,14 +240,14 @@ public: void Initialize() { Phase = 0; - bodyGUID = 0; + bodyGUID.Clear(); die = false; withbody = true; wait = 1000; laugh = urand(15000, 30000); } - uint64 bodyGUID; + ObjectGuid bodyGUID; uint32 Phase; uint32 laugh; @@ -390,8 +390,6 @@ public: { Initialize(); instance = creature->GetInstanceScript(); - headGUID = 0; - PlayerGUID = 0; id = 0; whirlwind = 0; wp_reached = false; @@ -417,8 +415,8 @@ public: InstanceScript* instance; - uint64 headGUID; - uint64 PlayerGUID; + ObjectGuid headGUID; + ObjectGuid PlayerGUID; uint32 Phase; uint32 id; @@ -446,9 +444,9 @@ public: if (headGUID) { if (Creature* Head = ObjectAccessor::GetCreature((*me), headGUID)) - Head->DisappearAndDie(); + Head->DespawnOrUnsummon(); - headGUID = 0; + headGUID.Clear(); } me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); @@ -806,18 +804,17 @@ public: npc_pulsing_pumpkinAI(Creature* creature) : ScriptedAI(creature) { sprouted = false; - debuffGUID = 0; } bool sprouted; - uint64 debuffGUID; + ObjectGuid debuffGUID; void Reset() override { float x, y, z; me->GetPosition(x, y, z); //this visual aura some under ground me->SetPosition(x, y, z + 0.35f, 0.0f); - debuffGUID = 0; + debuffGUID.Clear(); Despawn(); Creature* debuff = DoSpawnCreature(HELPER, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 14500); if (debuff) @@ -857,7 +854,7 @@ public: if (debuff) { debuff->SetVisible(false); - debuffGUID = 0; + debuffGUID.Clear(); } } diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp index 3e752858e63..4f0cdc2ec16 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp @@ -77,7 +77,7 @@ class boss_interrogator_vishas : public CreatureScript void JustDied(Unit* /*killer*/) override { _JustDied(); - if (Creature* vorrel = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VORREL))) + if (Creature* vorrel = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VORREL))) vorrel->AI()->Talk(SAY_TRIGGER_VORREL); } diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp index 02f7c815414..da32e535ab2 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp @@ -132,7 +132,7 @@ public: return; //On first death, fake death and open door, as well as initiate whitemane if exist - if (Unit* Whitemane = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_WHITEMANE))) + if (Unit* Whitemane = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_WHITEMANE))) { instance->SetBossState(DATA_MOGRAINE_AND_WHITE_EVENT, IN_PROGRESS); @@ -180,7 +180,7 @@ public: if (_bHasDied && !_bHeal && instance->GetBossState(DATA_MOGRAINE_AND_WHITE_EVENT) == SPECIAL) { //On resurrection, stop fake death and heal whitemane and resume fight - if (Unit* Whitemane = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_WHITEMANE))) + if (Unit* Whitemane = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_WHITEMANE))) { me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetStandState(UNIT_STAND_STATE_STAND); @@ -302,7 +302,7 @@ public: //When casting resuruction make sure to delay so on rez when reinstate battle deepsleep runs out if (Wait_Timer <= diff) { - if (Creature* mograine = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MOGRAINE))) + if (Creature* mograine = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MOGRAINE))) { DoCast(mograine, SPELL_SCARLETRESURRECTION); Talk(SAY_WH_RESURRECT); @@ -336,7 +336,7 @@ public: if (!HealthAbovePct(75)) target = me; - if (Creature* mograine = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MOGRAINE))) + if (Creature* mograine = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MOGRAINE))) { // checking _bCanResurrectCheck prevents her healing Mograine while he is "faking death" if (_bCanResurrectCheck && mograine->IsAlive() && !mograine->HealthAbovePct(75)) diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp index 3a79dac3a90..ab0a44b013d 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp @@ -38,13 +38,6 @@ class instance_scarlet_monastery : public InstanceMapScript SetBossNumber(EncounterCount); LoadDoorData(doorData); - PumpkinShrineGUID = 0; - HorsemanGUID = 0; - HeadGUID = 0; - MograineGUID = 0; - WhitemaneGUID = 0; - VorrelGUID = 0; - HorsemanAdds.clear(); } @@ -124,7 +117,7 @@ class instance_scarlet_monastery : public InstanceMapScript case DATA_HORSEMAN_EVENT: if (state == DONE) { - for (uint64 guid : HorsemanAdds) + for (ObjectGuid guid : HorsemanAdds) { Creature* add = instance->GetCreature(guid); if (add && add->IsAlive()) @@ -140,7 +133,7 @@ class instance_scarlet_monastery : public InstanceMapScript return true; } - uint64 GetData64(uint32 type) const override + ObjectGuid GetGuidData(uint32 type) const override { switch (type) { @@ -153,18 +146,18 @@ class instance_scarlet_monastery : public InstanceMapScript default: break; } - return 0; + return ObjectGuid::Empty; } protected: - uint64 PumpkinShrineGUID; - uint64 HorsemanGUID; - uint64 HeadGUID; - uint64 MograineGUID; - uint64 WhitemaneGUID; - uint64 VorrelGUID; - - std::set<uint64> HorsemanAdds; + ObjectGuid PumpkinShrineGUID; + ObjectGuid HorsemanGUID; + ObjectGuid HeadGUID; + ObjectGuid MograineGUID; + ObjectGuid WhitemaneGUID; + ObjectGuid VorrelGUID; + + GuidSet HorsemanAdds; }; InstanceScript* GetInstanceScript(InstanceMap* map) const override diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp index 0386341ed0c..24f7d90817d 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp @@ -59,14 +59,14 @@ class boss_darkmaster_gandling : public CreatureScript void Reset() override { _Reset(); - if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetData64(GO_GATE_GANDLING))) + if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetGuidData(GO_GATE_GANDLING))) gate->SetGoState(GO_STATE_ACTIVE); } void JustDied(Unit* /*killer*/) override { _JustDied(); - if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetData64(GO_GATE_GANDLING))) + if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetGuidData(GO_GATE_GANDLING))) gate->SetGoState(GO_STATE_ACTIVE); } @@ -78,7 +78,7 @@ class boss_darkmaster_gandling : public CreatureScript events.ScheduleEvent(EVENT_CURSE, 2000); events.ScheduleEvent(EVENT_SHADOW_PORTAL, 16000); - if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetData64(GO_GATE_GANDLING))) + if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetGuidData(GO_GATE_GANDLING))) gate->SetGoState(GO_STATE_READY); } @@ -181,32 +181,32 @@ class spell_shadow_portal : public SpellScriptLoader switch (urand(0, 5)) { case ROOM_HALL_OF_SECRETS: - if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetData64(GO_GATE_RAVENIAN))) + if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetGuidData(GO_GATE_RAVENIAN))) if (go->GetGoState() == GO_STATE_ACTIVE) spellId = SPELL_SHADOW_PORTAL_HALLOFSECRETS; break; case ROOM_HALL_OF_THE_DAMNED: - if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetData64(GO_GATE_THEOLEN))) + if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetGuidData(GO_GATE_THEOLEN))) if (go->GetGoState() == GO_STATE_ACTIVE) spellId = SPELL_SHADOW_PORTAL_HALLOFTHEDAMNED; break; case ROOM_THE_COVEN: - if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetData64(GO_GATE_MALICIA))) + if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetGuidData(GO_GATE_MALICIA))) if (go->GetGoState() == GO_STATE_ACTIVE) spellId = SPELL_SHADOW_PORTAL_THECOVEN; break; case ROOM_THE_SHADOW_VAULT: - if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetData64(GO_GATE_ILLUCIA))) + if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetGuidData(GO_GATE_ILLUCIA))) if (go->GetGoState() == GO_STATE_ACTIVE) spellId = SPELL_SHADOW_PORTAL_THESHADOWVAULT; break; case ROOM_BAROV_FAMILY_VAULT: - if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetData64(GO_GATE_BAROV))) + if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetGuidData(GO_GATE_BAROV))) if (go->GetGoState() == GO_STATE_ACTIVE) spellId = SPELL_SHADOW_PORTAL_BAROVFAMILYVAULT; break; case ROOM_VAULT_OF_THE_RAVENIAN: - if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetData64(GO_GATE_POLKELT))) + if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetGuidData(GO_GATE_POLKELT))) if (go->GetGoState() == GO_STATE_ACTIVE) spellId = SPELL_SHADOW_PORTAL_VAULTOFTHERAVENIAN; break; @@ -348,7 +348,7 @@ class spell_shadow_portal_rooms : public SpellScriptLoader } } - if (GameObject* gate = ObjectAccessor::GetGameObject(*caster, _instance->GetData64(gate_to_close))) + if (GameObject* gate = ObjectAccessor::GetGameObject(*caster, _instance->GetGuidData(gate_to_close))) gate->SetGoState(GO_STATE_READY); } } diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp index 3b423134f2a..05f5dcd9952 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp @@ -98,9 +98,9 @@ class boss_kirtonos_the_herald : public CreatureScript void JustDied(Unit* /*killer*/) override { - if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetData64(GO_GATE_KIRTONOS))) + if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetGuidData(GO_GATE_KIRTONOS))) gate->SetGoState(GO_STATE_ACTIVE); - if (GameObject* brazier = me->GetMap()->GetGameObject(instance->GetData64(GO_BRAZIER_OF_THE_HERALD))) + if (GameObject* brazier = me->GetMap()->GetGameObject(instance->GetGuidData(GO_BRAZIER_OF_THE_HERALD))) { brazier->ResetDoorOrButton(); brazier->SetGoState(GO_STATE_READY); @@ -110,9 +110,9 @@ class boss_kirtonos_the_herald : public CreatureScript void EnterEvadeMode() override { - if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetData64(GO_GATE_KIRTONOS))) + if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetGuidData(GO_GATE_KIRTONOS))) gate->SetGoState(GO_STATE_ACTIVE); - if (GameObject* brazier = me->GetMap()->GetGameObject(instance->GetData64(GO_BRAZIER_OF_THE_HERALD))) + if (GameObject* brazier = me->GetMap()->GetGameObject(instance->GetGuidData(GO_BRAZIER_OF_THE_HERALD))) { brazier->ResetDoorOrButton(); brazier->SetGoState(GO_STATE_READY); @@ -160,13 +160,13 @@ class boss_kirtonos_the_herald : public CreatureScript events.ScheduleEvent(INTRO_3, 1000); break; case INTRO_3: - if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetData64(GO_GATE_KIRTONOS))) + if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetGuidData(GO_GATE_KIRTONOS))) gate->SetGoState(GO_STATE_READY); me->SetFacingTo(0.01745329f); events.ScheduleEvent(INTRO_4, 3000); break; case INTRO_4: - if (GameObject* brazier = me->GetMap()->GetGameObject(instance->GetData64(GO_BRAZIER_OF_THE_HERALD))) + if (GameObject* brazier = me->GetMap()->GetGameObject(instance->GetGuidData(GO_BRAZIER_OF_THE_HERALD))) brazier->SetGoState(GO_STATE_READY); me->SetWalk(true); me->SetDisableGravity(false); diff --git a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp index f1959b6cf56..9565666cee8 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp @@ -38,15 +38,6 @@ class instance_scholomance : public InstanceMapScript { SetHeaders(DataHeader); SetBossNumber(EncounterCount); - GateKirtonosGUID = 0; - GateGandlingGUID = 0; - GateMiliciaGUID = 0; - GateTheolenGUID = 0; - GatePolkeltGUID = 0; - GateRavenianGUID = 0; - GateBarovGUID = 0; - GateIlluciaGUID = 0; - BrazierOfTheHeraldGUID = 0; } void OnGameObjectCreate(GameObject* go) override @@ -107,7 +98,7 @@ class instance_scholomance : public InstanceMapScript return true; } - uint64 GetData64(uint32 type) const override + ObjectGuid GetGuidData(uint32 type) const override { switch (type) { @@ -133,7 +124,7 @@ class instance_scholomance : public InstanceMapScript break; } - return 0; + return ObjectGuid::Empty; } bool CheckPreBosses(uint32 bossId) const @@ -175,15 +166,15 @@ class instance_scholomance : public InstanceMapScript } protected: - uint64 GateKirtonosGUID; - uint64 GateGandlingGUID; - uint64 GateMiliciaGUID; - uint64 GateTheolenGUID; - uint64 GatePolkeltGUID; - uint64 GateRavenianGUID; - uint64 GateBarovGUID; - uint64 GateIlluciaGUID; - uint64 BrazierOfTheHeraldGUID; + ObjectGuid GateKirtonosGUID; + ObjectGuid GateGandlingGUID; + ObjectGuid GateMiliciaGUID; + ObjectGuid GateTheolenGUID; + ObjectGuid GatePolkeltGUID; + ObjectGuid GateRavenianGUID; + ObjectGuid GateBarovGUID; + ObjectGuid GateIlluciaGUID; + ObjectGuid BrazierOfTheHeraldGUID; }; }; diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp index 10c4aedf103..ae8cb74ea49 100644 --- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp +++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp @@ -83,13 +83,13 @@ public: uint32 m_auiEncounter[MAX_ENCOUNTER]; std::string str_data; - uint64 uiAshGUID; - uint64 uiAdaGUID; - uint64 uiArchmageArugalGUID; + ObjectGuid uiAshGUID; + ObjectGuid uiAdaGUID; + ObjectGuid uiArchmageArugalGUID; - uint64 DoorCourtyardGUID; - uint64 DoorSorcererGUID; - uint64 DoorArugalGUID; + ObjectGuid DoorCourtyardGUID; + ObjectGuid DoorSorcererGUID; + ObjectGuid DoorArugalGUID; uint8 uiPhase; uint16 uiTimer; @@ -99,14 +99,6 @@ public: SetHeaders(DataHeader); memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - uiAshGUID = 0; - uiAdaGUID = 0; - uiArchmageArugalGUID = 0; - - DoorCourtyardGUID = 0; - DoorSorcererGUID = 0; - DoorArugalGUID = 0; - uiPhase = 0; uiTimer = 0; } @@ -128,17 +120,17 @@ public: case GO_COURTYARD_DOOR: DoorCourtyardGUID = go->GetGUID(); if (m_auiEncounter[0] == DONE) - HandleGameObject(0, true, go); + HandleGameObject(ObjectGuid::Empty, true, go); break; case GO_SORCERER_DOOR: DoorSorcererGUID = go->GetGUID(); if (m_auiEncounter[2] == DONE) - HandleGameObject(0, true, go); + HandleGameObject(ObjectGuid::Empty, true, go); break; case GO_ARUGAL_DOOR: DoorArugalGUID = go->GetGUID(); if (m_auiEncounter[3] == DONE) - HandleGameObject(0, true, go); + HandleGameObject(ObjectGuid::Empty, true, go); break; } } diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp index 0a09bc85ea3..e855b7e676f 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp @@ -132,7 +132,7 @@ public: if (instance->GetData(TYPE_SH_QUEST)) { if (Player* player = killer->ToPlayer()) - player->KilledMonsterCredit(SH_QUEST_CREDIT, 0); + player->KilledMonsterCredit(SH_QUEST_CREDIT); } } diff --git a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp index 43ce4d05297..927ca0b19ac 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp @@ -56,21 +56,21 @@ class instance_stratholme : public InstanceMapScript bool IsSilverHandDead[5]; - uint64 serviceEntranceGUID; - uint64 gauntletGate1GUID; - uint64 ziggurat1GUID; - uint64 ziggurat2GUID; - uint64 ziggurat3GUID; - uint64 ziggurat4GUID; - uint64 ziggurat5GUID; - uint64 portGauntletGUID; - uint64 portSlaugtherGUID; - uint64 portElderGUID; - - uint64 baronGUID; - uint64 ysidaTriggerGUID; - std::set<uint64> crystalsGUID; - std::set<uint64> abomnationGUID; + ObjectGuid serviceEntranceGUID; + ObjectGuid gauntletGate1GUID; + ObjectGuid ziggurat1GUID; + ObjectGuid ziggurat2GUID; + ObjectGuid ziggurat3GUID; + ObjectGuid ziggurat4GUID; + ObjectGuid ziggurat5GUID; + ObjectGuid portGauntletGUID; + ObjectGuid portSlaugtherGUID; + ObjectGuid portElderGUID; + + ObjectGuid baronGUID; + ObjectGuid ysidaTriggerGUID; + GuidSet crystalsGUID; + GuidSet abomnationGUID; EventMap events; void Initialize() override @@ -81,19 +81,6 @@ class instance_stratholme : public InstanceMapScript for (uint8 i = 0; i < 5; ++i) IsSilverHandDead[i] = false; - serviceEntranceGUID = 0; - gauntletGate1GUID = 0; - ziggurat1GUID = 0; - ziggurat2GUID = 0; - ziggurat3GUID = 0; - ziggurat4GUID = 0; - ziggurat5GUID = 0; - portGauntletGUID = 0; - portSlaugtherGUID = 0; - portElderGUID = 0; - - baronGUID = 0; - ysidaTriggerGUID = 0; crystalsGUID.clear(); abomnationGUID.clear(); } @@ -113,7 +100,7 @@ class instance_stratholme : public InstanceMapScript } //if withRestoreTime true, then newState will be ignored and GO should be restored to original state after 10 seconds - void UpdateGoState(uint64 goGuid, uint32 newState, bool withRestoreTime) + void UpdateGoState(ObjectGuid goGuid, uint32 newState, bool withRestoreTime) { if (!goGuid) return; @@ -176,37 +163,37 @@ class instance_stratholme : public InstanceMapScript case GO_ZIGGURAT1: ziggurat1GUID = go->GetGUID(); if (GetData(TYPE_BARONESS) == IN_PROGRESS) - HandleGameObject(0, true, go); + HandleGameObject(ObjectGuid::Empty, true, go); break; case GO_ZIGGURAT2: ziggurat2GUID = go->GetGUID(); if (GetData(TYPE_NERUB) == IN_PROGRESS) - HandleGameObject(0, true, go); + HandleGameObject(ObjectGuid::Empty, true, go); break; case GO_ZIGGURAT3: ziggurat3GUID = go->GetGUID(); if (GetData(TYPE_PALLID) == IN_PROGRESS) - HandleGameObject(0, true, go); + HandleGameObject(ObjectGuid::Empty, true, go); break; case GO_ZIGGURAT4: ziggurat4GUID = go->GetGUID(); if (GetData(TYPE_BARON) == DONE || GetData(TYPE_RAMSTEIN) == DONE) - HandleGameObject(0, true, go); + HandleGameObject(ObjectGuid::Empty, true, go); break; case GO_ZIGGURAT5: ziggurat5GUID = go->GetGUID(); if (GetData(TYPE_BARON) == DONE || GetData(TYPE_RAMSTEIN) == DONE) - HandleGameObject(0, true, go); + HandleGameObject(ObjectGuid::Empty, true, go); break; case GO_PORT_GAUNTLET: portGauntletGUID = go->GetGUID(); if (GetData(TYPE_BARONESS) == IN_PROGRESS && GetData(TYPE_NERUB) == IN_PROGRESS && GetData(TYPE_PALLID) == IN_PROGRESS) - HandleGameObject(0, true, go); + HandleGameObject(ObjectGuid::Empty, true, go); break; case GO_PORT_SLAUGTHER: portSlaugtherGUID = go->GetGUID(); if (GetData(TYPE_BARONESS) == IN_PROGRESS && GetData(TYPE_NERUB) == IN_PROGRESS && GetData(TYPE_PALLID) == IN_PROGRESS) - HandleGameObject(0, true, go); + HandleGameObject(ObjectGuid::Empty, true, go); break; case GO_PORT_ELDERS: portElderGUID = go->GetGUID(); @@ -276,7 +263,7 @@ class instance_stratholme : public InstanceMapScript HandleGameObject(portGauntletGUID, false); uint32 count = abomnationGUID.size(); - for (std::set<uint64>::const_iterator i = abomnationGUID.begin(); i != abomnationGUID.end(); ++i) + for (GuidSet::const_iterator i = abomnationGUID.begin(); i != abomnationGUID.end(); ++i) { if (Creature* pAbom = instance->GetCreature(*i)) if (!pAbom->IsAlive()) @@ -418,7 +405,7 @@ class instance_stratholme : public InstanceMapScript return 0; } - uint64 GetData64(uint32 data) const override + ObjectGuid GetGuidData(uint32 data) const override { switch (data) { @@ -427,7 +414,7 @@ class instance_stratholme : public InstanceMapScript case DATA_YSIDA_TRIGGER: return ysidaTriggerGUID; } - return 0; + return ObjectGuid::Empty; } void Update(uint32 diff) override diff --git a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp index 9c733677b42..384be9c90a8 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp @@ -117,12 +117,12 @@ public: void Initialize() { - Tagger = 0; + Tagger.Clear(); Die_Timer = 5000; Tagged = false; } - uint64 Tagger; + ObjectGuid Tagger; uint32 Die_Timer; bool Tagged; diff --git a/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp b/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp index ee16a662711..194f5790f44 100644 --- a/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp +++ b/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp @@ -63,13 +63,13 @@ public: SetHeaders(DataHeader); } - uint64 GOAtalaiStatue1; - uint64 GOAtalaiStatue2; - uint64 GOAtalaiStatue3; - uint64 GOAtalaiStatue4; - uint64 GOAtalaiStatue5; - uint64 GOAtalaiStatue6; - uint64 GOAtalaiIdol; + ObjectGuid GOAtalaiStatue1; + ObjectGuid GOAtalaiStatue2; + ObjectGuid GOAtalaiStatue3; + ObjectGuid GOAtalaiStatue4; + ObjectGuid GOAtalaiStatue5; + ObjectGuid GOAtalaiStatue6; + ObjectGuid GOAtalaiIdol; uint32 State; @@ -82,13 +82,6 @@ public: void Initialize() override { - GOAtalaiStatue1 = 0; - GOAtalaiStatue2 = 0; - GOAtalaiStatue3 = 0; - GOAtalaiStatue4 = 0; - GOAtalaiStatue5 = 0; - GOAtalaiStatue6 = 0; - GOAtalaiIdol = 0; State = 0; diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp index 4e401be7df3..1ad113456ac 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp @@ -147,7 +147,7 @@ public: if (!Intro || IsIntro) return; - if (Creature* Madrigosa = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MADRIGOSA))) + if (Creature* Madrigosa = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MADRIGOSA))) { Madrigosa->Respawn(); Madrigosa->setActive(true); @@ -182,7 +182,7 @@ public: void DoIntro() { - Creature* Madrigosa = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MADRIGOSA)); + Creature* Madrigosa = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MADRIGOSA)); if (!Madrigosa) return; @@ -285,7 +285,7 @@ public: { if (IntroFrostBoltTimer <= diff) { - if (Creature* Madrigosa = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MADRIGOSA))) + if (Creature* Madrigosa = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MADRIGOSA))) { Madrigosa->CastSpell(me, SPELL_INTRO_FROSTBOLT, true); IntroFrostBoltTimer = 2000; diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp index d2382cda37d..7613811e021 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp @@ -114,7 +114,7 @@ public: { Enraged = false; - if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ALYTHESS))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ALYTHESS))) { if (temp->isDead()) temp->Respawn(); @@ -134,7 +134,7 @@ public: { DoZoneInCombat(); - Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ALYTHESS)); + Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ALYTHESS)); if (temp && temp->IsAlive() && !temp->GetVictim()) temp->AI()->AttackStart(who); @@ -207,7 +207,7 @@ public: { if (!SisterDeath) { - Unit* Temp = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_ALYTHESS)); + Unit* Temp = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_ALYTHESS)); if (Temp && Temp->isDead()) { Talk(YELL_SISTER_ALYTHESS_DEAD); @@ -366,7 +366,7 @@ public: { Enraged = false; - if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SACROLASH))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SACROLASH))) { if (temp->isDead()) temp->Respawn(); @@ -386,7 +386,7 @@ public: { DoZoneInCombat(); - Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SACROLASH)); + Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SACROLASH)); if (temp && temp->IsAlive() && !temp->GetVictim()) temp->AI()->AttackStart(who); @@ -486,7 +486,7 @@ public: uint32 IntroStep(uint32 step) { - Creature* Sacrolash = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SACROLASH)); + Creature* Sacrolash = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SACROLASH)); switch (step) { case 0: @@ -535,7 +535,7 @@ public: if (!SisterDeath) { - Unit* Temp = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_SACROLASH)); + Unit* Temp = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_SACROLASH)); if (Temp && Temp->isDead()) { Talk(YELL_SISTER_SACROLASH_DEAD); @@ -546,7 +546,7 @@ public: } if (!me->GetVictim()) { - Creature* sisiter = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SACROLASH)); + Creature* sisiter = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SACROLASH)); if (sisiter && !sisiter->isDead() && sisiter->GetVictim()) { me->AddThreat(sisiter->GetVictim(), 0.0f); diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp index 4b17f698553..859a09aff78 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp @@ -288,7 +288,7 @@ public: { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); if (!target) - target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_PLAYER_GUID)); + target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_PLAYER_GUID)); if (!target) { @@ -314,7 +314,7 @@ public: Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); if (!target) - target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_PLAYER_GUID)); + target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_PLAYER_GUID)); if (!target) { @@ -343,7 +343,7 @@ public: { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); if (!target) - target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_PLAYER_GUID)); + target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_PLAYER_GUID)); if (!target) { diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp index 60bfae36f47..f88c9c6159e 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp @@ -115,7 +115,7 @@ public: void Initialize() { - SathGUID = 0; + SathGUID.Clear(); ArcaneBuffetTimer = 8000; FrostBreathTimer = 15000; WildMagicTimer = 10000; @@ -148,11 +148,11 @@ public: bool isBanished; bool bJustReset; - uint64 SathGUID; + ObjectGuid SathGUID; void Reset() override { - SathGUID = instance->GetData64(DATA_SATHROVARR); + SathGUID = instance->GetGuidData(DATA_SATHROVARR); instance->SetBossState(DATA_KALECGOS, NOT_STARTED); if (Creature* Sath = ObjectAccessor::GetCreature(*me, SathGUID)) @@ -456,7 +456,7 @@ public: uint32 YellTimer; uint32 YellSequence; - uint64 SathGUID; + ObjectGuid SathGUID; bool isEnraged; // if demon is enraged @@ -464,7 +464,6 @@ public: { Initialize(); instance = creature->GetInstanceScript(); - SathGUID = 0; } void Initialize() @@ -479,7 +478,7 @@ public: void Reset() override { - SathGUID = instance->GetData64(DATA_SATHROVARR); + SathGUID = instance->GetGuidData(DATA_SATHROVARR); Initialize(); } @@ -593,8 +592,6 @@ public: { Initialize(); instance = creature->GetInstanceScript(); - KalecGUID = 0; - KalecgosGUID = 0; } void Initialize() @@ -616,8 +613,8 @@ public: uint32 CheckTimer; uint32 ResetThreat; - uint64 KalecGUID; - uint64 KalecgosGUID; + ObjectGuid KalecGUID; + ObjectGuid KalecgosGUID; bool isEnraged; bool isBanished; @@ -626,13 +623,13 @@ public: { me->SetFullHealth();//dunno why it does not resets health at evade.. me->setActive(true); - KalecgosGUID = instance->GetData64(DATA_KALECGOS_DRAGON); + KalecgosGUID = instance->GetGuidData(DATA_KALECGOS_DRAGON); instance->SetBossState(DATA_KALECGOS, NOT_STARTED); if (KalecGUID) { if (Creature* Kalec = ObjectAccessor::GetCreature(*me, KalecGUID)) Kalec->setDeathState(JUST_DIED); - KalecGUID = 0; + KalecGUID.Clear(); } Initialize(); diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp index 79ebfa7b62b..9bddbcccf49 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp @@ -274,13 +274,13 @@ public: switch (index) { case 0: - return ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_1)); + return ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_1)); case 1: - return ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_2)); + return ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_2)); case 2: - return ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_3)); + return ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_3)); case 3: - return ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_4)); + return ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_4)); } return NULL; @@ -375,7 +375,7 @@ public: player->CastSpell(player, SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT, false); go->SetUInt32Value(GAMEOBJECT_FACTION, 0); - if (Creature* pKalec = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_KALECGOS_KJ))) + if (Creature* pKalec = ObjectAccessor::GetCreature(*player, instance->GetGuidData(DATA_KALECGOS_KJ))) ENSURE_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalec->AI())->SetRingOfBlueFlames(); go->Refresh(); @@ -437,7 +437,7 @@ public: { Initialize(); - if (Creature* pKalecKJ = ObjectAccessor::GetCreature((*me), instance->GetData64(DATA_KALECGOS_KJ))) + if (Creature* pKalecKJ = ObjectAccessor::GetCreature((*me), instance->GetGuidData(DATA_KALECGOS_KJ))) ENSURE_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalecKJ->AI())->ResetOrbs(); summons.DespawnAll(); } @@ -571,7 +571,7 @@ public: { Initialize(); - if (Creature* pKalec = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KALECGOS_KJ))) + if (Creature* pKalec = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KALECGOS_KJ))) pKalec->RemoveDynObject(SPELL_RING_OF_BLUE_FLAMES); me->SetFloatValue(UNIT_FIELD_COMBATREACH, 12); @@ -631,7 +631,7 @@ public: summons.DespawnAll(); // Reset the controller - if (Creature* pControl = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KILJAEDEN_CONTROLLER))) + if (Creature* pControl = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KILJAEDEN_CONTROLLER))) ENSURE_AI(npc_kiljaeden_controller::npc_kiljaeden_controllerAI, pControl->AI())->Reset(); } @@ -713,10 +713,10 @@ public: if (Speeches[speechCount].timer < SpeechTimer) { SpeechTimer = 0; - if (Creature* speechCreature = ObjectAccessor::GetCreature(*me, instance->GetData64(Speeches[speechCount].creature))) + if (Creature* speechCreature = ObjectAccessor::GetCreature(*me, instance->GetGuidData(Speeches[speechCount].creature))) speechCreature->AI()->Talk(Speeches[speechCount].textid); if (speechCount == 12) - if (Creature* pAnveena = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ANVEENA))) + if (Creature* pAnveena = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ANVEENA))) pAnveena->CastSpell(me, SPELL_SACRIFICE_OF_ANVEENA, false); // ChangeTimers(true, 10000); // Kil should do an emote while screaming without attacking for 10 seconds if (speechCount == speechPhaseEnd) @@ -742,7 +742,7 @@ public: for (uint8 z = 0; z < 6; ++z) { pRandomPlayer = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (!pRandomPlayer || !pRandomPlayer->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT, 0)) + if (!pRandomPlayer || !pRandomPlayer->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT)) break; } @@ -815,7 +815,7 @@ public: } break; case TIMER_ORBS_EMPOWER: //Phase 3 - if (Creature* pKalec = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KALECGOS_KJ))) + if (Creature* pKalec = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KALECGOS_KJ))) { switch (Phase) { @@ -835,7 +835,7 @@ public: for (uint8 z = 0; z < 6; ++z) { target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (!target || !target->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT, 0)) break; + if (!target || !target->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT)) break; } if (target) { @@ -941,7 +941,7 @@ public: void EnterCombat(Unit* who) override { instance->SetBossState(DATA_KILJAEDEN, IN_PROGRESS); - if (Creature* pControl = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KILJAEDEN_CONTROLLER))) + if (Creature* pControl = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KILJAEDEN_CONTROLLER))) pControl->AddThreat(who, 1.0f); me->InterruptNonMeleeSpells(true); @@ -949,7 +949,7 @@ public: void JustDied(Unit* /*killer*/) override { - if (Creature* pControl = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KILJAEDEN_CONTROLLER))) + if (Creature* pControl = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KILJAEDEN_CONTROLLER))) ++(ENSURE_AI(npc_kiljaeden_controller::npc_kiljaeden_controllerAI, pControl->AI())->deceiverDeathCount); } @@ -962,7 +962,7 @@ public: return; // Gain Shadow Infusion at 20% health - if (HealthBelowPct(20) && !me->HasAura(SPELL_SHADOW_INFUSION, 0)) + if (HealthBelowPct(20) && !me->HasAura(SPELL_SHADOW_INFUSION)) DoCast(me, SPELL_SHADOW_INFUSION, true); // Shadow Bolt Volley - Shoots Shadow Bolts at all enemies within 30 yards, for ~2k Shadow damage. @@ -1260,7 +1260,7 @@ public: if (uiTimer <= diff) { - if (Unit* random = ObjectAccessor::GetPlayer(*me, instance->GetData64(DATA_PLAYER_GUID))) + if (Unit* random = ObjectAccessor::GetPlayer(*me, instance->GetGuidData(DATA_PLAYER_GUID))) DoCast(random, SPELL_SHADOW_BOLT, false); uiTimer = urand(500, 1000); } else uiTimer -= diff; diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp index 823423fc3a8..99b710afb1e 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp @@ -153,7 +153,7 @@ public: void EnterEvadeMode() override { - if (Creature* muru = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MURU))) + if (Creature* muru = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MURU))) muru->AI()->Reset(); // Reset encounter. me->DisappearAndDie(); summons.DespawnAll(); @@ -183,7 +183,7 @@ public: { DarkFiend = false; HasEnraged = false; - EntropiusGUID = 0; + EntropiusGUID.Clear(); } void Reset() override @@ -278,7 +278,7 @@ public: private: bool DarkFiend; bool HasEnraged; - uint64 EntropiusGUID; + ObjectGuid EntropiusGUID; }; CreatureAI* GetAI(Creature* creature) const override @@ -334,7 +334,7 @@ public: void JustSummoned(Creature* summoned) override { - if (Player* target = ObjectAccessor::GetPlayer(*me, instance->GetData64(DATA_PLAYER_GUID))) + if (Player* target = ObjectAccessor::GetPlayer(*me, instance->GetGuidData(DATA_PLAYER_GUID))) summoned->AI()->AttackStart(target); Summons.Summon(summoned); @@ -555,7 +555,7 @@ public: { if (SpellTimer <= diff) { - Unit* Victim = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_PLAYER_GUID)); + Unit* Victim = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_PLAYER_GUID)); switch (NeedForAHack) { case 0: @@ -574,7 +574,7 @@ public: case 2: SpellTimer = 400; NeedForAHack = 3; - me->RemoveAura(SPELL_BLACKHOLE_GROW, 1); + me->RemoveAura(SPELL_BLACKHOLE_GROW); break; case 3: SpellTimer = urand(400, 900); diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp index 2066c4309b2..f0e785bad16 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp @@ -53,21 +53,7 @@ class instance_sunwell_plateau : public InstanceMapScript SetBossNumber(EncounterCount); LoadDoorData(doorData); - KalecgosDragonGUID = 0; - KalecgosHumanGUID = 0; - SathrovarrGUID = 0; - BrutallusGUID = 0; - MadrigosaGUID = 0; - FelmystGUID = 0; - AlythessGUID = 0; - SacrolashGUID = 0; - MuruGUID = 0; - KilJaedenGUID = 0; - KilJaedenControllerGUID = 0; - AnveenaGUID = 0; - KalecgosKjGUID = 0; SpectralPlayers = 0; - SpectralRealmTimer = 5000; } @@ -80,7 +66,7 @@ class instance_sunwell_plateau : public InstanceMapScript for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { Player* player = itr->GetSource(); - if (player && !player->HasAura(45839, 0)) + if (player && !player->HasAura(45839)) return player; } } @@ -172,7 +158,7 @@ class instance_sunwell_plateau : public InstanceMapScript } } - uint64 GetData64(uint32 id) const override + ObjectGuid GetGuidData(uint32 id) const override { switch (id) { @@ -205,32 +191,32 @@ class instance_sunwell_plateau : public InstanceMapScript case DATA_PLAYER_GUID: { Player const* target = GetPlayerInMap(); - return target ? target->GetGUID() : 0; + return target ? target->GetGUID() : ObjectGuid::Empty; } default: break; } - return 0; + return ObjectGuid::Empty; } protected: - uint64 KalecgosDragonGUID; - uint64 KalecgosHumanGUID; - uint64 SathrovarrGUID; - uint64 BrutallusGUID; - uint64 MadrigosaGUID; - uint64 FelmystGUID; - uint64 AlythessGUID; - uint64 SacrolashGUID; - uint64 MuruGUID; - uint64 KilJaedenGUID; - uint64 KilJaedenControllerGUID; - uint64 AnveenaGUID; - uint64 KalecgosKjGUID; + ObjectGuid KalecgosDragonGUID; + ObjectGuid KalecgosHumanGUID; + ObjectGuid SathrovarrGUID; + ObjectGuid BrutallusGUID; + ObjectGuid MadrigosaGUID; + ObjectGuid FelmystGUID; + ObjectGuid AlythessGUID; + ObjectGuid SacrolashGUID; + ObjectGuid MuruGUID; + ObjectGuid KilJaedenGUID; + ObjectGuid KilJaedenControllerGUID; + ObjectGuid AnveenaGUID; + ObjectGuid KalecgosKjGUID; uint32 SpectralPlayers; uint32 SpectralRealmTimer; - std::vector<uint64> SpectralRealmList; + GuidVector SpectralRealmList; }; InstanceScript* GetInstanceScript(InstanceMap* map) const override diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp index f82d71901ac..6986cb8d6e9 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp @@ -98,7 +98,7 @@ class boss_archaedas : public CreatureScript me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); } - void ActivateMinion(uint64 uiGuid, bool flag) + void ActivateMinion(ObjectGuid uiGuid, bool flag) { Unit* minion = ObjectAccessor::GetUnit(*me, uiGuid); @@ -145,7 +145,7 @@ class boss_archaedas : public CreatureScript } else if (bWakingUp && iAwakenTimer <= 0) { bWakingUp = false; - AttackStart(ObjectAccessor::GetUnit(*me, instance->GetData64(0))); + AttackStart(ObjectAccessor::GetUnit(*me, instance->GetGuidData(0))); return; // dont want to continue until we finish the AttackStart method } @@ -164,12 +164,12 @@ class boss_archaedas : public CreatureScript //If we are <66 summon the guardians if (!bGuardiansAwake && !HealthAbovePct(66)) { - ActivateMinion(instance->GetData64(5), true); // EarthenGuardian1 - ActivateMinion(instance->GetData64(6), true); // EarthenGuardian2 - ActivateMinion(instance->GetData64(7), true); // EarthenGuardian3 - ActivateMinion(instance->GetData64(8), true); // EarthenGuardian4 - ActivateMinion(instance->GetData64(9), true); // EarthenGuardian5 - ActivateMinion(instance->GetData64(10), false); // EarthenGuardian6 + ActivateMinion(instance->GetGuidData(5), true); // EarthenGuardian1 + ActivateMinion(instance->GetGuidData(6), true); // EarthenGuardian2 + ActivateMinion(instance->GetGuidData(7), true); // EarthenGuardian3 + ActivateMinion(instance->GetGuidData(8), true); // EarthenGuardian4 + ActivateMinion(instance->GetGuidData(9), true); // EarthenGuardian5 + ActivateMinion(instance->GetGuidData(10), false); // EarthenGuardian6 Talk(SAY_SUMMON_GUARDIANS); bGuardiansAwake = true; } @@ -177,10 +177,10 @@ class boss_archaedas : public CreatureScript //If we are <33 summon the vault walkers if (!bVaultWalkersAwake && !HealthAbovePct(33)) { - ActivateMinion(instance->GetData64(1), true); // VaultWalker1 - ActivateMinion(instance->GetData64(2), true); // VaultWalker2 - ActivateMinion(instance->GetData64(3), true); // VaultWalker3 - ActivateMinion(instance->GetData64(4), false); // VaultWalker4 + ActivateMinion(instance->GetGuidData(1), true); // VaultWalker1 + ActivateMinion(instance->GetGuidData(2), true); // VaultWalker2 + ActivateMinion(instance->GetGuidData(3), true); // VaultWalker3 + ActivateMinion(instance->GetGuidData(4), false); // VaultWalker4 Talk(SAY_SUMMON_VAULT_WALKERS); bVaultWalkersAwake = true; } @@ -297,7 +297,7 @@ class npc_archaedas_minions : public CreatureScript { bWakingUp = false; bAmIAwake = true; - // AttackStart(ObjectAccessor::GetUnit(*me, instance->GetData64(0))); // whoWokeArchaedasGUID + // AttackStart(ObjectAccessor::GetUnit(*me, instance->GetGuidData(0))); // whoWokeArchaedasGUID return; // dont want to continue until we finish the AttackStart method } @@ -401,7 +401,7 @@ class go_altar_of_archaedas : public GameObjectScript player->CastSpell (player, SPELL_BOSS_OBJECT_VISUAL, false); - instance->SetData64(0, player->GetGUID()); // activate archaedas + instance->SetGuidData(0, player->GetGUID()); // activate archaedas return false; } }; diff --git a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp index 17a6440702e..956f7099596 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp @@ -52,18 +52,6 @@ class instance_uldaman : public InstanceMapScript SetHeaders(DataHeader); memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - archaedasGUID = 0; - ironayaGUID = 0; - whoWokeuiArchaedasGUID = 0; - - altarOfTheKeeperTempleDoor = 0; - archaedasTempleDoor = 0; - ancientVaultDoor = 0; - - ironayaSealDoor = 0; - - keystoneGUID = 0; - ironayaSealDoorTimer = 27000; //animation time keystoneCheck = false; } @@ -77,25 +65,25 @@ class instance_uldaman : public InstanceMapScript return false; } - uint64 archaedasGUID; - uint64 ironayaGUID; - uint64 whoWokeuiArchaedasGUID; + ObjectGuid archaedasGUID; + ObjectGuid ironayaGUID; + ObjectGuid whoWokeuiArchaedasGUID; - uint64 altarOfTheKeeperTempleDoor; - uint64 archaedasTempleDoor; - uint64 ancientVaultDoor; - uint64 ironayaSealDoor; + ObjectGuid altarOfTheKeeperTempleDoor; + ObjectGuid archaedasTempleDoor; + ObjectGuid ancientVaultDoor; + ObjectGuid ironayaSealDoor; - uint64 keystoneGUID; + ObjectGuid keystoneGUID; uint32 ironayaSealDoorTimer; bool keystoneCheck; - std::vector<uint64> stoneKeepers; - std::vector<uint64> altarOfTheKeeperCounts; - std::vector<uint64> vaultWalkers; - std::vector<uint64> earthenGuardians; - std::vector<uint64> archaedasWallMinions; // minions lined up around the wall + GuidVector stoneKeepers; + GuidVector altarOfTheKeeperCounts; + GuidVector vaultWalkers; + GuidVector earthenGuardians; + GuidVector archaedasWallMinions; // minions lined up around the wall uint32 m_auiEncounter[MAX_ENCOUNTER]; std::string str_data; @@ -108,14 +96,14 @@ class instance_uldaman : public InstanceMapScript altarOfTheKeeperTempleDoor = go->GetGUID(); if (m_auiEncounter[0] == DONE) - HandleGameObject(0, true, go); + HandleGameObject(ObjectGuid::Empty, true, go); break; case GO_ARCHAEDAS_TEMPLE_DOOR: archaedasTempleDoor = go->GetGUID(); if (m_auiEncounter[0] == DONE) - HandleGameObject(0, true, go); + HandleGameObject(ObjectGuid::Empty, true, go); break; case GO_ANCIENT_VAULT_DOOR: @@ -124,14 +112,14 @@ class instance_uldaman : public InstanceMapScript ancientVaultDoor = go->GetGUID(); if (m_auiEncounter[1] == DONE) - HandleGameObject(0, true, go); + HandleGameObject(ObjectGuid::Empty, true, go); break; case GO_IRONAYA_SEAL_DOOR: ironayaSealDoor = go->GetGUID(); if (m_auiEncounter[2] == DONE) - HandleGameObject(0, true, go); + HandleGameObject(ObjectGuid::Empty, true, go); break; case GO_KEYSTONE: @@ -139,7 +127,7 @@ class instance_uldaman : public InstanceMapScript if (m_auiEncounter[2] == DONE) { - HandleGameObject(0, true, go); + HandleGameObject(ObjectGuid::Empty, true, go); go->SetUInt32Value(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND); } break; @@ -155,7 +143,7 @@ class instance_uldaman : public InstanceMapScript creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); } - void SetDoor(uint64 guid, bool open) + void SetDoor(ObjectGuid guid, bool open) { GameObject* go = instance->GetGameObject(guid); if (!go) @@ -164,7 +152,7 @@ class instance_uldaman : public InstanceMapScript HandleGameObject(guid, open); } - void BlockGO(uint64 guid) + void BlockGO(ObjectGuid guid) { GameObject* go = instance->GetGameObject(guid); if (!go) @@ -177,7 +165,7 @@ class instance_uldaman : public InstanceMapScript { if (GetData(DATA_ALTAR_DOORS) != DONE) { - for (std::vector<uint64>::const_iterator i = stoneKeepers.begin(); i != stoneKeepers.end(); ++i) + for (GuidVector::const_iterator i = stoneKeepers.begin(); i != stoneKeepers.end(); ++i) { Creature* target = instance->GetCreature(*i); if (!target || !target->IsAlive()) @@ -199,7 +187,7 @@ class instance_uldaman : public InstanceMapScript if (!archaedas) return; - for (std::vector<uint64>::const_iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i) + for (GuidVector::const_iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i) { Creature* target = instance->GetCreature(*i); if (!target || !target->IsAlive() || target->getFaction() == 14) @@ -217,7 +205,7 @@ class instance_uldaman : public InstanceMapScript void DeActivateMinions() { // first despawn any aggroed wall minions - for (std::vector<uint64>::const_iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i) + for (GuidVector::const_iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i) { Creature* target = instance->GetCreature(*i); if (!target || target->isDead() || target->getFaction() != 14) @@ -227,7 +215,7 @@ class instance_uldaman : public InstanceMapScript } // Vault Walkers - for (std::vector<uint64>::const_iterator i = vaultWalkers.begin(); i != vaultWalkers.end(); ++i) + for (GuidVector::const_iterator i = vaultWalkers.begin(); i != vaultWalkers.end(); ++i) { Creature* target = instance->GetCreature(*i); if (!target || target->isDead() || target->getFaction() != 14) @@ -237,7 +225,7 @@ class instance_uldaman : public InstanceMapScript } // Earthen Guardians - for (std::vector<uint64>::const_iterator i = earthenGuardians.begin(); i != earthenGuardians.end(); ++i) + for (GuidVector::const_iterator i = earthenGuardians.begin(); i != earthenGuardians.end(); ++i) { Creature* target = instance->GetCreature(*i); if (!target || target->isDead() || target->getFaction() != 14) @@ -247,7 +235,7 @@ class instance_uldaman : public InstanceMapScript } } - void ActivateArchaedas(uint64 target) + void ActivateArchaedas(ObjectGuid target) { Creature* archaedas = instance->GetCreature(archaedasGUID); if (!archaedas) @@ -274,7 +262,7 @@ class instance_uldaman : public InstanceMapScript void RespawnMinions() { // first respawn any aggroed wall minions - for (std::vector<uint64>::const_iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i) + for (GuidVector::const_iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i) { Creature* target = instance->GetCreature(*i); if (target && target->isDead()) @@ -286,7 +274,7 @@ class instance_uldaman : public InstanceMapScript } // Vault Walkers - for (std::vector<uint64>::const_iterator i = vaultWalkers.begin(); i != vaultWalkers.end(); ++i) + for (GuidVector::const_iterator i = vaultWalkers.begin(); i != vaultWalkers.end(); ++i) { Creature* target = instance->GetCreature(*i); if (target && target->isDead()) @@ -298,7 +286,7 @@ class instance_uldaman : public InstanceMapScript } // Earthen Guardians - for (std::vector<uint64>::const_iterator i = earthenGuardians.begin(); i != earthenGuardians.end(); ++i) + for (GuidVector::const_iterator i = earthenGuardians.begin(); i != earthenGuardians.end(); ++i) { Creature* target = instance->GetCreature(*i); if (target && target->isDead()) @@ -394,7 +382,7 @@ class instance_uldaman : public InstanceMapScript } } - void SetData64(uint32 type, uint64 data) override + void SetGuidData(uint32 type, ObjectGuid data) override { // Archaedas if (type == 0) @@ -470,7 +458,7 @@ class instance_uldaman : public InstanceMapScript } } - uint64 GetData64(uint32 identifier) const override + ObjectGuid GetGuidData(uint32 identifier) const override { switch (identifier) { @@ -492,8 +480,8 @@ class instance_uldaman : public InstanceMapScript break; } - return 0; - } // end GetData64 + return ObjectGuid::Empty; + } // end GetGuidData void ProcessEvent(WorldObject* /*gameObject*/, uint32 eventId) override { diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp index b15fdd85a00..275435121f1 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp @@ -93,10 +93,12 @@ class boss_akilzon : public CreatureScript void Initialize() { - TargetGUID = 0; - CloudGUID = 0; - CycloneGUID = 0; - memset(BirdGUIDs, 0, sizeof(BirdGUIDs)); + TargetGUID.Clear(); + CloudGUID.Clear(); + CycloneGUID.Clear(); + for (ObjectGuid& guid : BirdGUIDs) + guid.Clear(); + StormCount = 0; isRaining = false; } @@ -211,7 +213,7 @@ class boss_akilzon : public CreatureScript StormCount = 0; // finish events.ScheduleEvent(EVENT_SUMMON_EAGLES, 5000); me->InterruptNonMeleeSpells(false); - CloudGUID = 0; + CloudGUID.Clear(); if (Cloud) Cloud->DealDamage(Cloud, Cloud->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); SetWeather(WEATHER_STATE_FINE, 0.0f); @@ -364,10 +366,10 @@ class boss_akilzon : public CreatureScript } private: - uint64 BirdGUIDs[8]; - uint64 TargetGUID; - uint64 CycloneGUID; - uint64 CloudGUID; + ObjectGuid BirdGUIDs[8]; + ObjectGuid TargetGUID; + ObjectGuid CycloneGUID; + ObjectGuid CloudGUID; uint8 StormCount; bool isRaining; }; @@ -394,12 +396,12 @@ class npc_akilzon_eagle : public CreatureScript { EagleSwoop_Timer = urand(5000, 10000); arrived = true; - TargetGUID = 0; + TargetGUID.Clear(); } uint32 EagleSwoop_Timer; bool arrived; - uint64 TargetGUID; + ObjectGuid TargetGUID; void Reset() override { @@ -422,7 +424,7 @@ class npc_akilzon_eagle : public CreatureScript { if (Unit* target = ObjectAccessor::GetUnit(*me, TargetGUID)) DoCast(target, SPELL_EAGLE_SWOOP, true); - TargetGUID = 0; + TargetGUID.Clear(); me->SetSpeed(MOVE_RUN, 1.2f); EagleSwoop_Timer = urand(5000, 10000); } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp index 0cf1f932f10..6e38ca6a39e 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp @@ -85,7 +85,7 @@ class boss_halazzi : public CreatureScript void Initialize() { - LynxGUID = 0; + LynxGUID.Clear(); TransformCount = 0; BerserkTimer = 600000; CheckTimer = 1000; @@ -103,7 +103,7 @@ class boss_halazzi : public CreatureScript uint32 BerserkTimer; uint32 TransformCount; - uint64 LynxGUID; + ObjectGuid LynxGUID; void Reset() override { diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp index 077597e4706..55f7af71253 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp @@ -258,8 +258,8 @@ class boss_hexlord_malacrass : public CreatureScript instance = creature->GetInstanceScript(); SelectAddEntry(); for (uint8 i = 0; i < 4; ++i) - AddGUID[i] = 0; - PlayerGUID = 0; + AddGUID[i].Clear(); + PlayerGUID.Clear(); PlayerClass = CLASS_NONE; } @@ -275,10 +275,10 @@ class boss_hexlord_malacrass : public CreatureScript InstanceScript* instance; - uint64 AddGUID[4]; + ObjectGuid AddGUID[4]; uint32 AddEntry[4]; - uint64 PlayerGUID; + ObjectGuid PlayerGUID; uint32 SpiritBolts_Timer; uint32 DrainPower_Timer; diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp index 2e434ed6ab5..37b8b559895 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp @@ -141,7 +141,7 @@ class boss_janalai : public CreatureScript isFlameBreathing = false; for (uint8 i = 0; i < 40; ++i) - FireBombGUIDs[i] = 0; + FireBombGUIDs[i].Clear(); } InstanceScript* instance; @@ -159,7 +159,7 @@ class boss_janalai : public CreatureScript bool isFlameBreathing; - uint64 FireBombGUIDs[40]; + ObjectGuid FireBombGUIDs[40]; void Reset() override { diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp index 5b9957cb94d..dfb7f96ec4a 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp @@ -138,7 +138,6 @@ class boss_zuljin : public CreatureScript { Initialize(); instance = creature->GetInstanceScript(); - memset(SpiritGUID, 0, sizeof(SpiritGUID)); health_20 = 0; } @@ -164,15 +163,15 @@ class boss_zuljin : public CreatureScript Flame_Breath_Timer = 6000; Pillar_Of_Fire_Timer = 7000; - ClawTargetGUID = 0; - TankGUID = 0; + ClawTargetGUID.Clear(); + TankGUID.Clear(); } InstanceScript* instance; - uint64 SpiritGUID[4]; - uint64 ClawTargetGUID; - uint64 TankGUID; + ObjectGuid SpiritGUID[4]; + ObjectGuid ClawTargetGUID; + ObjectGuid TankGUID; uint32 Phase; uint32 health_20; @@ -299,7 +298,7 @@ class boss_zuljin : public CreatureScript temp->setDeathState(DEAD); } } - SpiritGUID[i] = 0; + SpiritGUID[i].Clear(); } } @@ -465,7 +464,7 @@ class boss_zuljin : public CreatureScript Claw_Rage_Timer = urand(15000, 20000); me->SetSpeed(MOVE_RUN, 1.2f); AttackStart(ObjectAccessor::GetUnit(*me, TankGUID)); - TankGUID = 0; + TankGUID.Clear(); return; } else @@ -513,7 +512,7 @@ class boss_zuljin : public CreatureScript Lynx_Rush_Timer = urand(15000, 20000); me->SetSpeed(MOVE_RUN, 1.2f); AttackStart(ObjectAccessor::GetUnit(*me, TankGUID)); - TankGUID = 0; + TankGUID.Clear(); } else AttackStart(SelectTarget(SELECT_TARGET_RANDOM, 0)); diff --git a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp index 6081887e609..72bd8446972 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp @@ -68,19 +68,19 @@ class instance_zulaman : public InstanceMapScript { instance_zulaman_InstanceMapScript(Map* map) : InstanceScript(map) { } - uint64 HarkorsSatchelGUID; - uint64 TanzarsTrunkGUID; - uint64 AshlisBagGUID; - uint64 KrazsPackageGUID; - uint64 StrangeGongGUID; - uint64 HarrisonJonesGUID; - - uint64 HexLordGateGUID; - uint64 ZulJinGateGUID; - uint64 MassiveGateGUID; - uint64 AkilzonDoorGUID; - uint64 ZulJinDoorGUID; - uint64 HalazziDoorGUID; + ObjectGuid HarkorsSatchelGUID; + ObjectGuid TanzarsTrunkGUID; + ObjectGuid AshlisBagGUID; + ObjectGuid KrazsPackageGUID; + ObjectGuid StrangeGongGUID; + ObjectGuid HarrisonJonesGUID; + + ObjectGuid HexLordGateGUID; + ObjectGuid ZulJinGateGUID; + ObjectGuid MassiveGateGUID; + ObjectGuid AkilzonDoorGUID; + ObjectGuid ZulJinDoorGUID; + ObjectGuid HalazziDoorGUID; uint32 QuestTimer; uint16 BossKilled; @@ -95,20 +95,6 @@ class instance_zulaman : public InstanceMapScript SetHeaders(DataHeader); memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - HarkorsSatchelGUID = 0; - TanzarsTrunkGUID = 0; - AshlisBagGUID = 0; - KrazsPackageGUID = 0; - StrangeGongGUID = 0; - HexLordGateGUID = 0; - ZulJinGateGUID = 0; - MassiveGateGUID = 0; - AkilzonDoorGUID = 0; - HalazziDoorGUID = 0; - ZulJinDoorGUID = 0; - - HarrisonJonesGUID = 0; - QuestTimer = 0; QuestMinute = 0; BossKilled = 0; @@ -351,7 +337,7 @@ class instance_zulaman : public InstanceMapScript } } - uint64 GetData64(uint32 type) const override + ObjectGuid GetGuidData(uint32 type) const override { switch (type) { @@ -361,7 +347,7 @@ class instance_zulaman : public InstanceMapScript return MassiveGateGUID; } - return 0; + return ObjectGuid::Empty; } }; diff --git a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp index 6784ff086c7..958cf0bd899 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp @@ -288,7 +288,7 @@ class npc_harrison_jones : public CreatureScript me->RemoveAllAuras(); me->SetEntry(NPC_HARRISON_JONES_2); me->SetDisplayId(MODEL_HARRISON_JONES_2); - me->SetTarget(0); + me->SetTarget(ObjectGuid::Empty); me->SetByteValue(UNIT_FIELD_BYTES_1, 0, UNIT_STAND_STATE_DEAD); me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); instance->SetData(DATA_GONGEVENT, DONE); @@ -318,14 +318,14 @@ class npc_harrison_jones : public CreatureScript _gongTimer = 4000; break; case GONG_EVENT_3: - if (GameObject* gong = me->GetMap()->GetGameObject(instance->GetData64(GO_STRANGE_GONG))) + if (GameObject* gong = me->GetMap()->GetGameObject(instance->GetGuidData(GO_STRANGE_GONG))) gong->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); _gongEvent = GONG_EVENT_4; _gongTimer = 105000; break; case GONG_EVENT_4: me->RemoveAura(SPELL_BANGING_THE_GONG); - if (GameObject* gong = me->GetMap()->GetGameObject(instance->GetData64(GO_STRANGE_GONG))) + if (GameObject* gong = me->GetMap()->GetGameObject(instance->GetGuidData(GO_STRANGE_GONG))) gong->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); // trigger or gong will need to be scripted to set IN_PROGRESS after enough hits. @@ -387,7 +387,7 @@ class npc_harrison_jones : public CreatureScript } } - if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetData64(GO_MASSIVE_GATE))) + if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetGuidData(GO_MASSIVE_GATE))) gate->SetGoState(GO_STATE_ACTIVE); _gongTimer = 2000; _gongEvent = GONG_EVENT_8; diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp index 0d780da6560..32aff72f435 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp @@ -95,8 +95,6 @@ class boss_arlokk : public CreatureScript boss_arlokkAI(Creature* creature) : BossAI(creature, DATA_ARLOKK) { Initialize(); - memset(_triggersSideAGUID, 0, sizeof(_triggersSideAGUID)); - memset(_triggersSideBGUID, 0, sizeof(_triggersSideBGUID)); } void Initialize() @@ -162,7 +160,7 @@ class boss_arlokk : public CreatureScript void EnterEvadeMode() override { BossAI::EnterEvadeMode(); - if (GameObject* object = ObjectAccessor::GetGameObject(*me, instance->GetData64(GO_GONG_OF_BETHEKK))) + if (GameObject* object = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_GONG_OF_BETHEKK))) object->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); me->DespawnOrUnsummon(4000); } @@ -305,8 +303,8 @@ class boss_arlokk : public CreatureScript private: uint8 _summonCountA; uint8 _summonCountB; - uint64 _triggersSideAGUID[5]; - uint64 _triggersSideBGUID[5]; + ObjectGuid _triggersSideAGUID[5]; + ObjectGuid _triggersSideBGUID[5]; }; CreatureAI* GetAI(Creature* creature) const override @@ -357,7 +355,7 @@ class npc_zulian_prowler : public CreatureScript DoCast(me, SPELL_SNEAK_RANK_1_1); DoCast(me, SPELL_SNEAK_RANK_1_2); - if (Unit* arlokk = ObjectAccessor::GetUnit(*me, _instance->GetData64(NPC_ARLOKK))) + if (Unit* arlokk = ObjectAccessor::GetUnit(*me, _instance->GetGuidData(NPC_ARLOKK))) me->GetMotionMaster()->MovePoint(0, arlokk->GetPositionX(), arlokk->GetPositionY(), arlokk->GetPositionZ()); _events.ScheduleEvent(EVENT_ATTACK, 6000); } @@ -377,7 +375,7 @@ class npc_zulian_prowler : public CreatureScript void JustDied(Unit* /*killer*/) override { - if (Unit* arlokk = ObjectAccessor::GetUnit(*me, _instance->GetData64(NPC_ARLOKK))) + if (Unit* arlokk = ObjectAccessor::GetUnit(*me, _instance->GetGuidData(NPC_ARLOKK))) { if (arlokk->IsAlive()) arlokk->GetAI()->SetData(_sideData, 0); diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp index d1c9579c027..3ffdf18d3d4 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp @@ -199,7 +199,7 @@ class npc_healing_ward : public CreatureScript // Heal_Timer if (Heal_Timer <= diff) { - if (Unit* jindo = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JINDO))) + if (Unit* jindo = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_JINDO))) DoCast(jindo, SPELL_HEAL); Heal_Timer = 3000; } else Heal_Timer -= diff; diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp index 6244d2b72b1..8238bc3d278 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp @@ -115,7 +115,6 @@ class boss_mandokir : public CreatureScript boss_mandokirAI(Creature* creature) : BossAI(creature, DATA_MANDOKIR) { Initialize(); - memset(chainedSpirtGUIDs, 0, sizeof(chainedSpirtGUIDs)); } void Initialize() @@ -131,7 +130,7 @@ class boss_mandokir : public CreatureScript Initialize(); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); events.ScheduleEvent(EVENT_CHECK_START, 1000); - if (Creature* speaker = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_VILEBRANCH_SPEAKER))) + if (Creature* speaker = ObjectAccessor::GetCreature(*me, instance->GetGuidData(NPC_VILEBRANCH_SPEAKER))) if (!speaker->IsAlive()) speaker->Respawn(true); } @@ -180,7 +179,7 @@ class boss_mandokir : public CreatureScript if (++killCount == 3) { Talk(SAY_DING_KILL); - if (Creature* jindo = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_JINDO))) + if (Creature* jindo = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_JINDO))) if (jindo->IsAlive()) jindo->AI()->Talk(SAY_GRATS_JINDO); DoCast(me, SPELL_LEVEL_UP, true); @@ -286,7 +285,7 @@ class boss_mandokir : public CreatureScript private: uint8 killCount; - uint64 chainedSpirtGUIDs[CHAINED_SPIRT_COUNT]; + ObjectGuid chainedSpirtGUIDs[CHAINED_SPIRT_COUNT]; }; CreatureAI* GetAI(Creature* creature) const override diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp index 57a286c1e58..4fa24786f3d 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp @@ -180,7 +180,7 @@ class boss_thekal : public CreatureScript if (instance->GetBossState(DATA_LORKHAN) == SPECIAL) { //Resurrect LorKhan - if (Unit* pLorKhan = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_LORKHAN))) + if (Unit* pLorKhan = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_LORKHAN))) { pLorKhan->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pLorKhan->setFaction(14); @@ -193,7 +193,7 @@ class boss_thekal : public CreatureScript if (instance->GetBossState(DATA_ZATH) == SPECIAL) { //Resurrect Zath - if (Unit* pZath = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_ZATH))) + if (Unit* pZath = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_ZATH))) { pZath->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pZath->setFaction(14); @@ -333,8 +333,8 @@ class npc_zealot_lorkhan : public CreatureScript //Casting Greaterheal to Thekal or Zath if they are in meele range. if (GreaterHeal_Timer <= diff) { - Unit* pThekal = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THEKAL)); - Unit* pZath = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_ZATH)); + Unit* pThekal = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THEKAL)); + Unit* pZath = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_ZATH)); if (!pThekal || !pZath) return; @@ -367,7 +367,7 @@ class npc_zealot_lorkhan : public CreatureScript if (instance->GetBossState(DATA_THEKAL) == SPECIAL) { //Resurrect Thekal - if (Unit* pThekal = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THEKAL))) + if (Unit* pThekal = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THEKAL))) { pThekal->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pThekal->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -379,7 +379,7 @@ class npc_zealot_lorkhan : public CreatureScript if (instance->GetBossState(DATA_ZATH) == SPECIAL) { //Resurrect Zath - if (Unit* pZath = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_ZATH))) + if (Unit* pZath = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_ZATH))) { pZath->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pZath->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -517,7 +517,7 @@ class npc_zealot_zath : public CreatureScript if (instance->GetBossState(DATA_LORKHAN) == SPECIAL) { //Resurrect LorKhan - if (Unit* pLorKhan = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_LORKHAN))) + if (Unit* pLorKhan = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_LORKHAN))) { pLorKhan->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pLorKhan->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -529,7 +529,7 @@ class npc_zealot_zath : public CreatureScript if (instance->GetBossState(DATA_THEKAL) == SPECIAL) { //Resurrect Thekal - if (Unit* pThekal = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THEKAL))) + if (Unit* pThekal = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THEKAL))) { pThekal->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pThekal->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp index 5aa37642798..57e4798b2da 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp @@ -46,17 +46,6 @@ class instance_zulgurub : public InstanceMapScript LoadDoorData(doorData); } - void Initialize() override - { - _zealotLorkhanGUID = 0; - _zealotZathGUID = 0; - _highPriestTekalGUID = 0; - _jindoTheHexxerGUID = 0; - _vilebranchSpeakerGUID = 0; - _arlokkGUID = 0; - _goGongOfBethekkGUID = 0; - } - bool IsEncounterInProgress() const override { // not active in Zul'Gurub @@ -119,7 +108,7 @@ class instance_zulgurub : public InstanceMapScript } } - uint64 GetData64(uint32 uiData) const override + ObjectGuid GetGuidData(uint32 uiData) const override { switch (uiData) { @@ -142,20 +131,20 @@ class instance_zulgurub : public InstanceMapScript return _goGongOfBethekkGUID; break; } - return 0; + return ObjectGuid::Empty; } private: //If all High Priest bosses were killed. Lorkhan, Zath and Ohgan are added too. //Storing Lorkhan, Zath and Thekal because we need to cast on them later. Jindo is needed for healfunction too. - uint64 _zealotLorkhanGUID; - uint64 _zealotZathGUID; - uint64 _highPriestTekalGUID; - uint64 _jindoTheHexxerGUID; - uint64 _vilebranchSpeakerGUID; - uint64 _arlokkGUID; - uint64 _goGongOfBethekkGUID; + ObjectGuid _zealotLorkhanGUID; + ObjectGuid _zealotZathGUID; + ObjectGuid _highPriestTekalGUID; + ObjectGuid _jindoTheHexxerGUID; + ObjectGuid _vilebranchSpeakerGUID; + ObjectGuid _arlokkGUID; + ObjectGuid _goGongOfBethekkGUID; }; InstanceScript* GetInstanceScript(InstanceMap* map) const override diff --git a/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp b/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp index 598717a1c3b..b725712d473 100644 --- a/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp +++ b/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp @@ -197,13 +197,13 @@ public: { Phase = 0; KillCount = 0; - PlayerGUID = 0; + PlayerGUID.Clear(); } uint32 Phase; int8 KillCount; uint32 WaitTimer; - uint64 PlayerGUID; + ObjectGuid PlayerGUID; SummonList Summons; bool QuestInProgress; diff --git a/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp b/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp index ee29c0a7b6e..b111923ae15 100644 --- a/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp +++ b/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp @@ -243,13 +243,13 @@ public: uiTimer = 0; uiPhase = 0; - MarzonGUID = 0; + MarzonGUID.Clear(); } uint32 uiTimer; uint32 uiPhase; - uint64 MarzonGUID; + ObjectGuid MarzonGUID; void Reset() override { diff --git a/src/server/scripts/EasternKingdoms/zone_swamp_of_sorrows.cpp b/src/server/scripts/EasternKingdoms/zone_swamp_of_sorrows.cpp index 20e9f28e0b7..c0717958640 100644 --- a/src/server/scripts/EasternKingdoms/zone_swamp_of_sorrows.cpp +++ b/src/server/scripts/EasternKingdoms/zone_swamp_of_sorrows.cpp @@ -46,7 +46,7 @@ public: { npc_galen_goodwardAI(Creature* creature) : npc_escortAI(creature) { - galensCageGUID = 0; + galensCageGUID.Clear(); Reset(); } @@ -135,7 +135,7 @@ public: } private: - uint64 galensCageGUID; + ObjectGuid galensCageGUID; uint32 periodicSay; }; diff --git a/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp b/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp index f953742b864..70d274b9f2f 100644 --- a/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp +++ b/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp @@ -77,12 +77,12 @@ public: { m_uiPhase = 0; m_uiPhaseTimer = 5000; - m_uiPlayerGUID = 0; + m_uiPlayerGUID.Clear(); } uint32 m_uiPhase; uint32 m_uiPhaseTimer; - uint64 m_uiPlayerGUID; + ObjectGuid m_uiPlayerGUID; void Reset() override { diff --git a/src/server/scripts/EasternKingdoms/zone_undercity.cpp b/src/server/scripts/EasternKingdoms/zone_undercity.cpp index ea997c5563f..48f614a73c0 100644 --- a/src/server/scripts/EasternKingdoms/zone_undercity.cpp +++ b/src/server/scripts/EasternKingdoms/zone_undercity.cpp @@ -108,7 +108,7 @@ public: { LamentEventTimer = 5000; LamentEvent = false; - targetGUID = 0; + targetGUID.Clear(); FadeTimer = 30000; SummonSkeletonTimer = 20000; @@ -119,7 +119,7 @@ public: uint32 LamentEventTimer; bool LamentEvent; - uint64 targetGUID; + ObjectGuid targetGUID; uint32 FadeTimer; uint32 SummonSkeletonTimer; diff --git a/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp b/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp index d242d17806c..952d191bd1a 100644 --- a/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp +++ b/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp @@ -322,7 +322,6 @@ public: npc_anchorite_truuenAI(Creature* creature) : npc_escortAI(creature) { Initialize(); - UghostGUID = 0; } void Initialize() @@ -332,7 +331,7 @@ public: uint32 m_uiChatTimer; - uint64 UghostGUID; + ObjectGuid UghostGUID; void Reset() override { diff --git a/src/server/scripts/Events/childrens_week.cpp b/src/server/scripts/Events/childrens_week.cpp index 4bc0642e348..6e95b9351fd 100644 --- a/src/server/scripts/Events/childrens_week.cpp +++ b/src/server/scripts/Events/childrens_week.cpp @@ -131,13 +131,13 @@ enum Misc DISPLAY_INVISIBLE = 11686 }; -uint64 getOrphanGUID(Player* player, uint32 orphan) +ObjectGuid getOrphanGUID(Player* player, uint32 orphan) { if (Aura* orphanOut = player->GetAura(SPELL_ORPHAN_OUT)) if (orphanOut->GetCaster() && orphanOut->GetCaster()->GetEntry() == orphan) return orphanOut->GetCaster()->GetGUID(); - return 0; + return ObjectGuid::Empty; } /*###### @@ -159,8 +159,8 @@ class npc_winterfin_playmate : public CreatureScript { timer = 0; phase = 0; - playerGUID = 0; - orphanGUID = 0; + playerGUID.Clear(); + orphanGUID.Clear(); } void Reset() override @@ -235,8 +235,8 @@ class npc_winterfin_playmate : public CreatureScript private: uint32 timer; int8 phase; - uint64 playerGUID; - uint64 orphanGUID; + ObjectGuid playerGUID; + ObjectGuid orphanGUID; }; @@ -265,8 +265,8 @@ class npc_snowfall_glade_playmate : public CreatureScript { timer = 0; phase = 0; - playerGUID = 0; - orphanGUID = 0; + playerGUID.Clear(); + orphanGUID.Clear(); } void Reset() override @@ -342,8 +342,8 @@ class npc_snowfall_glade_playmate : public CreatureScript private: uint32 timer; int8 phase; - uint64 playerGUID; - uint64 orphanGUID; + ObjectGuid playerGUID; + ObjectGuid orphanGUID; }; CreatureAI* GetAI(Creature* pCreature) const override @@ -372,8 +372,8 @@ class npc_the_biggest_tree : public CreatureScript { timer = 1000; phase = 0; - playerGUID = 0; - orphanGUID = 0; + playerGUID.Clear(); + orphanGUID.Clear(); } void Reset() override @@ -436,8 +436,8 @@ class npc_the_biggest_tree : public CreatureScript private: uint32 timer; uint8 phase; - uint64 playerGUID; - uint64 orphanGUID; + ObjectGuid playerGUID; + ObjectGuid orphanGUID; }; @@ -466,8 +466,8 @@ class npc_high_oracle_soo_roo : public CreatureScript { timer = 0; phase = 0; - playerGUID = 0; - orphanGUID = 0; + playerGUID.Clear(); + orphanGUID.Clear(); } void Reset() override @@ -533,8 +533,8 @@ class npc_high_oracle_soo_roo : public CreatureScript private: uint32 timer; int8 phase; - uint64 playerGUID; - uint64 orphanGUID; + ObjectGuid playerGUID; + ObjectGuid orphanGUID; }; @@ -563,8 +563,8 @@ class npc_elder_kekek : public CreatureScript { timer = 0; phase = 0; - playerGUID = 0; - orphanGUID = 0; + playerGUID.Clear(); + orphanGUID.Clear(); } void Reset() override @@ -628,8 +628,8 @@ class npc_elder_kekek : public CreatureScript private: uint32 timer; int8 phase; - uint64 playerGUID; - uint64 orphanGUID; + ObjectGuid playerGUID; + ObjectGuid orphanGUID; }; @@ -659,8 +659,8 @@ class npc_the_etymidian : public CreatureScript { timer = 0; phase = 0; - playerGUID = 0; - orphanGUID = 0; + playerGUID.Clear(); + orphanGUID.Clear(); } void Reset() override @@ -732,8 +732,8 @@ class npc_the_etymidian : public CreatureScript private: uint32 timer; int8 phase; - uint64 playerGUID; - uint64 orphanGUID; + ObjectGuid playerGUID; + ObjectGuid orphanGUID; }; @@ -762,8 +762,8 @@ class npc_alexstraza_the_lifebinder : public CreatureScript { timer = 0; phase = 0; - playerGUID = 0; - orphanGUID = 0; + playerGUID.Clear(); + orphanGUID.Clear(); } void Reset() override @@ -900,8 +900,8 @@ class npc_alexstraza_the_lifebinder : public CreatureScript private: int8 phase; uint32 timer; - uint64 playerGUID; - uint64 orphanGUID; + ObjectGuid playerGUID; + ObjectGuid orphanGUID; }; diff --git a/src/server/scripts/Examples/example_escort.cpp b/src/server/scripts/Examples/example_escort.cpp index 88188a45296..229d32e6c4a 100644 --- a/src/server/scripts/Examples/example_escort.cpp +++ b/src/server/scripts/Examples/example_escort.cpp @@ -166,7 +166,7 @@ class example_escort : public CreatureScript { if (m_uiChatTimer <= uiDiff) { - if (me->HasAura(SPELL_ELIXIR_OF_FORTITUDE, 0)) + if (me->HasAura(SPELL_ELIXIR_OF_FORTITUDE)) { Talk(SAY_RAND_1); DoCast(me, SPELL_BLUE_FIREWORK, false); diff --git a/src/server/scripts/Examples/example_spell.cpp b/src/server/scripts/Examples/example_spell.cpp index 9097f7cd650..f90cc069780 100644 --- a/src/server/scripts/Examples/example_spell.cpp +++ b/src/server/scripts/Examples/example_spell.cpp @@ -117,11 +117,11 @@ class spell_ex_5581 : public SpellScriptLoader void HandleDummyLaunchTarget(SpellEffIndex /*effIndex*/) { - uint64 targetGUID = 0; + ObjectGuid targetGUID; if (Unit* unitTarget = GetHitUnit()) targetGUID = unitTarget->GetGUID(); // we're handling SPELL_EFFECT_DUMMY in effIndex 0 here - TC_LOG_INFO("misc", "Spell %u with SPELL_EFFECT_DUMMY is just launched at it's target: " UI64FMTD "!", GetSpellInfo()->Id, targetGUID); + TC_LOG_INFO("misc", "Spell %u with SPELL_EFFECT_DUMMY is just launched at it's target: " UI64FMTD "!", GetSpellInfo()->Id, targetGUID.GetRawValue()); } void HandleDummyHit(SpellEffIndex /*effIndex*/) diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp index f8ba2ab6646..0fe3eee2805 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp @@ -210,7 +210,7 @@ public: { Talk(SAY_MORRIDUNE_1); me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - Start(false, false, 0); + Start(false); } void WaypointReached(uint32 waypointId) override diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp index 28b414ba9ca..b23d0cdaa3c 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp @@ -66,14 +66,14 @@ public: { instance_blackfathom_deeps_InstanceMapScript(Map* map) : InstanceScript(map) { } - uint64 twilightLordKelrisGUID; - uint64 shrine1GUID; - uint64 shrine2GUID; - uint64 shrine3GUID; - uint64 shrine4GUID; - uint64 shrineOfGelihastGUID; - uint64 altarOfTheDeepsGUID; - uint64 mainDoorGUID; + ObjectGuid twilightLordKelrisGUID; + ObjectGuid shrine1GUID; + ObjectGuid shrine2GUID; + ObjectGuid shrine3GUID; + ObjectGuid shrine4GUID; + ObjectGuid shrineOfGelihastGUID; + ObjectGuid altarOfTheDeepsGUID; + ObjectGuid mainDoorGUID; uint8 encounter[MAX_ENCOUNTER]; uint8 countFires; @@ -84,14 +84,6 @@ public: SetHeaders(DataHeader); memset(&encounter, 0, sizeof(encounter)); - twilightLordKelrisGUID = 0; - shrine1GUID = 0; - shrine2GUID = 0; - shrine3GUID = 0; - shrine4GUID = 0; - shrineOfGelihastGUID = 0; - altarOfTheDeepsGUID = 0; - mainDoorGUID = 0; countFires = 0; deathTimes = 0; } @@ -137,7 +129,7 @@ public: break; case GO_AKU_MAI_DOOR: if (encounter[2] == DONE) - HandleGameObject(0, true, go); + HandleGameObject(ObjectGuid::Empty, true, go); mainDoorGUID = go->GetGUID(); break; } @@ -234,7 +226,7 @@ public: return 0; } - uint64 GetData64(uint32 data) const override + ObjectGuid GetGuidData(uint32 data) const override { switch (data) { @@ -254,7 +246,7 @@ public: return mainDoorGUID; } - return 0; + return ObjectGuid::Empty; } }; }; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp index 782632602b3..131f875bc05 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp @@ -100,7 +100,7 @@ public: { if (waypointId == 7) { - Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } @@ -194,12 +194,12 @@ public: ImmolationTimer = 5000; CheckTimer = 5000; instance = creature->GetInstanceScript(); - AnetheronGUID = instance->GetData64(DATA_ANETHERON); + AnetheronGUID = instance->GetGuidData(DATA_ANETHERON); } uint32 ImmolationTimer; uint32 CheckTimer; - uint64 AnetheronGUID; + ObjectGuid AnetheronGUID; InstanceScript* instance; void Reset() override diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp index 2885a838cee..992b20d2580 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp @@ -97,18 +97,18 @@ public: void Initialize() { CheckTimer = 1000; - ArchimondeGUID = 0; + ArchimondeGUID.Clear(); } InstanceScript* instance; - uint64 ArchimondeGUID; + ObjectGuid ArchimondeGUID; uint32 CheckTimer; void Reset() override { Initialize(); - ArchimondeGUID = instance->GetData64(DATA_ARCHIMONDE); + ArchimondeGUID = instance->GetGuidData(DATA_ARCHIMONDE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } @@ -187,11 +187,11 @@ public: void Initialize() { - TargetGUID = 0; + TargetGUID.Clear(); ChangeTargetTimer = 5000; } - uint64 TargetGUID; + ObjectGuid TargetGUID; uint32 ChangeTargetTimer; void Reset() override @@ -222,7 +222,7 @@ public: if (Unit* temp = ObjectAccessor::GetUnit(*me, TargetGUID)) { me->GetMotionMaster()->MoveFollow(temp, 0.0f, 0.0f); - TargetGUID = 0; + TargetGUID.Clear(); } else { @@ -264,9 +264,9 @@ public: void Initialize() { - DoomfireSpiritGUID = 0; + DoomfireSpiritGUID.Clear(); damageTaken = 0; - WorldTreeGUID = 0; + WorldTreeGUID.Clear(); DrainNordrassilTimer = 0; FearTimer = 42000; @@ -290,8 +290,8 @@ public: InstanceScript* instance; - uint64 DoomfireSpiritGUID; - uint64 WorldTreeGUID; + ObjectGuid DoomfireSpiritGUID; + ObjectGuid WorldTreeGUID; uint32 DrainNordrassilTimer; uint32 FearTimer; @@ -429,7 +429,7 @@ public: if (Unit* DoomfireSpirit = ObjectAccessor::GetUnit(*me, DoomfireSpiritGUID)) { summoned->GetMotionMaster()->MoveFollow(DoomfireSpirit, 0.0f, 0.0f); - DoomfireSpiritGUID = 0; + DoomfireSpiritGUID.Clear(); } } } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp index 7e50fd7b775..aa411707952 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp @@ -105,7 +105,7 @@ public: { if (waypointId == 7 && instance) { - Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } @@ -201,13 +201,13 @@ public: WarstompTimer = 10000; CheckTimer = 5000; instance = creature->GetInstanceScript(); - AzgalorGUID = instance->GetData64(DATA_AZGALOR); + AzgalorGUID = instance->GetGuidData(DATA_AZGALOR); } uint32 CrippleTimer; uint32 WarstompTimer; uint32 CheckTimer; - uint64 AzgalorGUID; + ObjectGuid AzgalorGUID; InstanceScript* instance; void Reset() override diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp index d3c137b67e8..baa28dad2a2 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp @@ -100,7 +100,7 @@ public: { if (waypointId == 7 && instance) { - Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp index 5ce9b30eb58..cecad84e099 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp @@ -95,7 +95,7 @@ public: { if (waypointId == 7 && instance) { - Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp index b5c226b15cb..a4745eade7d 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp @@ -321,8 +321,6 @@ hyjalAI::hyjalAI(Creature* creature) : npc_escortAI(creature), Summons(me) instance = creature->GetInstanceScript(); VeinsSpawned[0] = false; VeinsSpawned[1] = false; - for (uint8 i=0; i<14; ++i) - VeinGUID[i] = 0; InfernalCount = 0; TeleportTimer = 1000; Overrun = false; @@ -335,7 +333,6 @@ hyjalAI::hyjalAI(Creature* creature) : npc_escortAI(creature), Summons(me) DoRespawn = false; MassTeleportTimer = 0; DoMassTeleport = false; - DummyGuid = 0; } void hyjalAI::Initialize() @@ -343,9 +340,9 @@ void hyjalAI::Initialize() IsDummy = false; // GUIDs - PlayerGUID = 0; - BossGUID[0] = 0; - BossGUID[1] = 0; + PlayerGUID.Clear(); + BossGUID[0].Clear(); + BossGUID[1].Clear(); // Timers NextWaveTimer = 10000; @@ -651,21 +648,23 @@ void hyjalAI::SpawnVeins() { if (VeinsSpawned[0])//prevent any buggers return; - for (uint8 i = 0; i<7; ++i) + for (uint8 i = 0; i < 7; ++i) { GameObject* gem = me->SummonGameObject(GO_ANCIENT_VEIN, VeinPos[i][0], VeinPos[i][1], VeinPos[i][2], VeinPos[i][3], VeinPos[i][4], VeinPos[i][5], VeinPos[i][6], VeinPos[i][7], 0); if (gem) VeinGUID[i]=gem->GetGUID(); } VeinsSpawned[0] = true; - }else{ + } + else + { if (VeinsSpawned[1]) return; - for (uint8 i = 7; i<14; ++i) + for (uint8 i = 7; i < 14; ++i) { GameObject* gem = me->SummonGameObject(GO_ANCIENT_VEIN, VeinPos[i][0], VeinPos[i][1], VeinPos[i][2], VeinPos[i][3], VeinPos[i][4], VeinPos[i][5], VeinPos[i][6], VeinPos[i][7], 0); if (gem) - VeinGUID[i]=gem->GetGUID(); + VeinGUID[i] = gem->GetGUID(); } VeinsSpawned[1] = true; } @@ -675,22 +674,25 @@ void hyjalAI::DeSpawnVeins() { if (Faction == 1) { - Creature* unit=ObjectAccessor::GetCreature((*me), instance->GetData64(DATA_JAINAPROUDMOORE)); + Creature* unit=ObjectAccessor::GetCreature((*me), instance->GetGuidData(DATA_JAINAPROUDMOORE)); if (!unit)return; hyjalAI* ai = CAST_AI(hyjalAI, unit->AI()); if (!ai)return; - for (uint8 i = 0; i<7; ++i) + for (uint8 i = 0; i < 7; ++i) { if (GameObject* gem = instance->instance->GetGameObject(ai->VeinGUID[i])) gem->Delete(); } - } else if (Faction) + } + else if (Faction) { - Creature* unit=ObjectAccessor::GetCreature((*me), instance->GetData64(DATA_THRALL)); - if (!unit)return; + Creature* unit=ObjectAccessor::GetCreature((*me), instance->GetGuidData(DATA_THRALL)); + if (!unit) + return; hyjalAI* ai = CAST_AI(hyjalAI, unit->AI()); - if (!ai)return; - for (uint8 i = 7; i<14; ++i) + if (!ai) + return; + for (uint8 i = 7; i < 14; ++i) { if (GameObject* gem = instance->instance->GetGameObject(ai->VeinGUID[i])) gem->Delete(); @@ -706,7 +708,9 @@ void hyjalAI::UpdateAI(uint32 diff) { DoCast(me, SPELL_MASS_TELEPORT, false); DoMassTeleport = false; - } else MassTeleportTimer -= diff; + } + else + MassTeleportTimer -= diff; return; } if (DoHide) @@ -830,7 +834,7 @@ void hyjalAI::UpdateAI(uint32 diff) EventBegun = false; CheckTimer = 0; me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - BossGUID[i] = 0; + BossGUID[i].Clear(); instance->DoUpdateWorldState(WORLD_STATE_ENEMY, 0); // Reset world state for enemies to disable it } } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h index 43afc58879c..468decbd43a 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h @@ -160,9 +160,9 @@ struct hyjalAI : public npc_escortAI public: InstanceScript* instance; - uint64 PlayerGUID; - uint64 BossGUID[2]; - uint64 VeinGUID[14]; + ObjectGuid PlayerGUID; + ObjectGuid BossGUID[2]; + ObjectGuid VeinGUID[14]; uint32 NextWaveTimer; uint32 WaveCount; @@ -193,7 +193,7 @@ struct hyjalAI : public npc_escortAI bool IsDummy; uint32 MassTeleportTimer; bool DoMassTeleport; - uint64 DummyGuid; + ObjectGuid DummyGuid; struct Spell { diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp index 8e1a78ea5f2..c6adbd58c4a 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp @@ -447,7 +447,7 @@ public: { if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall { - Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } @@ -486,7 +486,7 @@ public: CanMove = true; if (instance->GetData(DATA_ALLIANCE_RETREAT) && !instance->GetData(DATA_HORDE_RETREAT)) { - Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } else if (instance->GetData(DATA_ALLIANCE_RETREAT) && instance->GetData(DATA_HORDE_RETREAT)){ @@ -563,13 +563,13 @@ public: { if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall { - Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } else { - Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } @@ -662,13 +662,13 @@ public: { if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall { - Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } else { - Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } @@ -773,13 +773,13 @@ public: { if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall { - Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } else { - Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } @@ -886,13 +886,13 @@ public: { if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall { - Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } else { - Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } @@ -982,13 +982,13 @@ public: { if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall { - Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } else { - Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } @@ -1068,13 +1068,13 @@ public: { if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall { - Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } else { - Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } @@ -1160,7 +1160,7 @@ public: { if (waypointId == 2 && !IsOverrun) { - Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL)); if (target && target->IsAlive()) { me->AddThreat(target, 0.0f); @@ -1281,7 +1281,7 @@ public: { if (waypointId == 2 && !IsOverrun) { - Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL)); if (target && target->IsAlive()) { me->AddThreat(target, 0.0f); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp index 69eba98f406..55860d98cc5 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp @@ -61,18 +61,6 @@ public: SetHeaders(DataHeader); memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - m_uiAncientGemGUID.clear(); - - RageWinterchill = 0; - Anetheron = 0; - Kazrogal = 0; - Azgalor = 0; - Archimonde = 0; - JainaProudmoore = 0; - Thrall = 0; - TyrandeWhisperwind = 0; - HordeGate = 0; - ElfGate = 0; RaidDamage = 0; Trash = 0; hordeRetreat = 0; @@ -97,16 +85,16 @@ public: case GO_HORDE_ENCAMPMENT_PORTAL: HordeGate = go->GetGUID(); if (allianceRetreat) - HandleGameObject(0, true, go); + HandleGameObject(ObjectGuid::Empty, true, go); else - HandleGameObject(0, false, go); + HandleGameObject(ObjectGuid::Empty, false, go); break; case GO_NIGHT_ELF_VILLAGE_PORTAL: ElfGate = go->GetGUID(); if (hordeRetreat) - HandleGameObject(0, true, go); + HandleGameObject(ObjectGuid::Empty, true, go); else - HandleGameObject(0, false, go); + HandleGameObject(ObjectGuid::Empty, false, go); break; case GO_ANCIENT_GEM: m_uiAncientGemGUID.push_back(go->GetGUID()); @@ -129,7 +117,7 @@ public: } } - uint64 GetData64(uint32 identifier) const override + ObjectGuid GetGuidData(uint32 identifier) const override { switch (identifier) { @@ -143,7 +131,7 @@ public: case DATA_TYRANDEWHISPERWIND: return TyrandeWhisperwind; } - return 0; + return ObjectGuid::Empty; } void SetData(uint32 type, uint32 data) override @@ -215,7 +203,7 @@ public: { if (!m_uiAncientGemGUID.empty()) { - for (std::list<uint64>::const_iterator itr = m_uiAncientGemGUID.begin(); itr != m_uiAncientGemGUID.end(); ++itr) + for (GuidList::const_iterator itr = m_uiAncientGemGUID.begin(); itr != m_uiAncientGemGUID.end(); ++itr) { //don't know how long it expected DoRespawnGameObject(*itr, DAY); @@ -305,17 +293,17 @@ public: protected: uint32 m_auiEncounter[EncounterCount]; std::string str_data; - std::list<uint64> m_uiAncientGemGUID; - uint64 RageWinterchill; - uint64 Anetheron; - uint64 Kazrogal; - uint64 Azgalor; - uint64 Archimonde; - uint64 JainaProudmoore; - uint64 Thrall; - uint64 TyrandeWhisperwind; - uint64 HordeGate; - uint64 ElfGate; + GuidList m_uiAncientGemGUID; + ObjectGuid RageWinterchill; + ObjectGuid Anetheron; + ObjectGuid Kazrogal; + ObjectGuid Azgalor; + ObjectGuid Archimonde; + ObjectGuid JainaProudmoore; + ObjectGuid Thrall; + ObjectGuid TyrandeWhisperwind; + ObjectGuid HordeGate; + ObjectGuid ElfGate; uint32 Trash; uint32 hordeRetreat; uint32 allianceRetreat; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp index 7b3314ef4e9..3f74ed2eb88 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp @@ -150,7 +150,7 @@ public: return; } - if (Creature* pArthas = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ARTHAS))) + if (Creature* pArthas = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ARTHAS))) if (pArthas->isDead()) { EnterEvadeMode(); @@ -199,7 +199,7 @@ public: uiOutroTimer = 8000; break; case 2: - me->SetTarget(instance->GetData64(DATA_ARTHAS)); + me->SetTarget(instance->GetGuidData(DATA_ARTHAS)); me->HandleEmoteCommand(29); Talk(SAY_ESCAPE_SPEECH_2); ++uiOutroStep; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp index 3c80be2734a..ff104a28197 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp @@ -360,23 +360,23 @@ public: void Initialize() { - utherGUID = 0; - jainaGUID = 0; + utherGUID.Clear(); + jainaGUID.Clear(); for (uint8 i = 0; i < 2; ++i) - citymenGUID[i] = 0; + citymenGUID[i].Clear(); for (uint8 i = 0; i < ENCOUNTER_WAVES_MAX_SPAWNS; ++i) - waveGUID[i] = 0; + waveGUID[i].Clear(); for (uint8 i = 0; i < ENCOUNTER_DRACONIAN_NUMBER; ++i) - infiniteDraconianGUID[i] = 0; + infiniteDraconianGUID[i].Clear(); - stalkerGUID = 0; - bossGUID = 0; - epochGUID = 0; - malganisGUID = 0; - infiniteGUID = 0; + stalkerGUID.Clear(); + bossGUID.Clear(); + epochGUID.Clear(); + malganisGUID.Clear(); + infiniteGUID.Clear(); phaseTimer = 1000; exorcismTimer = 7300; @@ -393,17 +393,17 @@ public: uint32 wave; uint32 WavesCounter; - uint64 utherGUID; - uint64 jainaGUID; - uint64 citymenGUID[2]; - uint64 waveGUID[ENCOUNTER_WAVES_MAX_SPAWNS]; - uint64 infiniteDraconianGUID[ENCOUNTER_DRACONIAN_NUMBER]; - uint64 stalkerGUID; + ObjectGuid utherGUID; + ObjectGuid jainaGUID; + ObjectGuid citymenGUID[2]; + ObjectGuid waveGUID[ENCOUNTER_WAVES_MAX_SPAWNS]; + ObjectGuid infiniteDraconianGUID[ENCOUNTER_DRACONIAN_NUMBER]; + ObjectGuid stalkerGUID; - uint64 bossGUID; - uint64 epochGUID; - uint64 malganisGUID; - uint64 infiniteGUID; + ObjectGuid bossGUID; + ObjectGuid epochGUID; + ObjectGuid malganisGUID; + ObjectGuid infiniteGUID; uint32 exorcismTimer; @@ -436,7 +436,7 @@ public: instance->SetBossState(DATA_ARTHAS, FAIL); } - void SpawnTimeRift(uint32 timeRiftID, uint64* guidVector) + void SpawnTimeRift(uint32 timeRiftID, ObjectGuid* guidVector) { me->SummonCreature((uint32)RiftAndSpawnsLocations[timeRiftID][0], RiftAndSpawnsLocations[timeRiftID][1], RiftAndSpawnsLocations[timeRiftID][2], RiftAndSpawnsLocations[timeRiftID][3], RiftAndSpawnsLocations[timeRiftID][4], TEMPSUMMON_TIMED_DESPAWN, 11000); @@ -455,7 +455,7 @@ public: } } - void SpawnWaveGroup(uint32 waveID, uint64* guidVector) + void SpawnWaveGroup(uint32 waveID, ObjectGuid* guidVector) { for (uint32 i = 0; i < ENCOUNTER_WAVES_MAX_SPAWNS; ++i) { @@ -568,7 +568,7 @@ public: Talk(SAY_PHASE403); break; case 36: - if (GameObject* gate = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_SHKAF_GATE))) + if (GameObject* gate = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_SHKAF_GATE))) gate->SetGoState(GO_STATE_ACTIVE); break; case 45: @@ -736,7 +736,7 @@ public: case 21: SetEscortPaused(false); bStepping = false; - me->SetTarget(0); + me->SetTarget(ObjectGuid::Empty); JumpToNextStep(0); break; //After waypoint 3 @@ -756,7 +756,7 @@ public: if (Creature* uther = ObjectAccessor::GetCreature(*me, utherGUID)) uther->DisappearAndDie(); - me->SetTarget(0); + me->SetTarget(ObjectGuid::Empty); JumpToNextStep(0); break; //After Gossip 1 (waypoint 8) @@ -779,7 +779,7 @@ public: SetEscortPaused(false); bStepping = false; SetRun(false); - me->SetTarget(0); + me->SetTarget(ObjectGuid::Empty); JumpToNextStep(0); break; //After waypoint 9 @@ -938,7 +938,7 @@ public: uint32 deadCounter = 0; for (uint8 i = 0; i < ENCOUNTER_WAVES_MAX_SPAWNS; ++i) { - if (waveGUID[i] == 0) + if (waveGUID[i].IsEmpty()) break; ++mobCounter; Unit* temp = ObjectAccessor::GetCreature(*me, waveGUID[i]); @@ -1168,7 +1168,7 @@ public: malganisGUID = malganis->GetGUID(); malganis->SetReactState(REACT_PASSIVE); } - if (GameObject* gate = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_MAL_GANIS_GATE_1))) + if (GameObject* gate = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_MAL_GANIS_GATE_1))) gate->SetGoState(GO_STATE_ACTIVE); SetHoldState(false); bStepping = false; @@ -1208,7 +1208,7 @@ public: break; case 90: instance->SetBossState(DATA_ARTHAS, DONE); //Rewards: Achiev & Chest ;D - me->SetTarget(instance->GetData64(DATA_MAL_GANIS_GATE_2)); //Look behind + me->SetTarget(instance->GetGuidData(DATA_MAL_GANIS_GATE_2)); //Look behind Talk(SAY_PHASE504); bStepping = false; break; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp index ab86b5d8f42..ae0fa2aa564 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp @@ -61,19 +61,6 @@ class instance_culling_of_stratholme : public InstanceMapScript SetBossNumber(EncounterCount); LoadDoorData(doorData); - _chromieGUID = 0; - _arthasGUID = 0; - _meathookGUID = 0; - _salrammGUID = 0; - _epochGUID = 0; - _malGanisGUID = 0; - _infiniteGUID = 0; - _shkafGateGUID = 0; - _malGanisGate1GUID = 0; - _malGanisGate2GUID = 0; - _exitGateGUID = 0; - _malGanisChestGUID = 0; - _genericBunnyGUID = 0; _crateCount = 0; _eventTimer = 0; _infiniteCouterState = NOT_STARTED; @@ -242,7 +229,7 @@ class instance_culling_of_stratholme : public InstanceMapScript return 0; } - uint64 GetData64(uint32 identifier) const override + ObjectGuid GetGuidData(uint32 identifier) const override { switch (identifier) { @@ -271,7 +258,7 @@ class instance_culling_of_stratholme : public InstanceMapScript default: break; } - return 0; + return ObjectGuid::Empty; } void Update(uint32 diff) override @@ -331,19 +318,19 @@ class instance_culling_of_stratholme : public InstanceMapScript } private: - uint64 _chromieGUID; - uint64 _arthasGUID; - uint64 _meathookGUID; - uint64 _salrammGUID; - uint64 _epochGUID; - uint64 _malGanisGUID; - uint64 _infiniteGUID; - uint64 _shkafGateGUID; - uint64 _malGanisGate1GUID; - uint64 _malGanisGate2GUID; - uint64 _exitGateGUID; - uint64 _malGanisChestGUID; - uint64 _genericBunnyGUID; + ObjectGuid _chromieGUID; + ObjectGuid _arthasGUID; + ObjectGuid _meathookGUID; + ObjectGuid _salrammGUID; + ObjectGuid _epochGUID; + ObjectGuid _malGanisGUID; + ObjectGuid _infiniteGUID; + ObjectGuid _shkafGateGUID; + ObjectGuid _malGanisGate1GUID; + ObjectGuid _malGanisGate2GUID; + ObjectGuid _exitGateGUID; + ObjectGuid _malGanisChestGUID; + ObjectGuid _genericBunnyGUID; uint32 _crateCount; uint32 _eventTimer; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp index 32062be6f3c..0220ff98750 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp @@ -58,9 +58,9 @@ public: uint32 mBarrelCount; uint32 mThrallEventCount; - uint64 ThrallGUID; - uint64 TarethaGUID; - uint64 EpochGUID; + ObjectGuid ThrallGUID; + ObjectGuid TarethaGUID; + ObjectGuid EpochGUID; void Initialize() override { @@ -69,9 +69,6 @@ public: mBarrelCount = 0; mThrallEventCount = 0; - ThrallGUID = 0; - TarethaGUID = 0; - EpochGUID = 0; } Player* GetPlayerInMap() @@ -100,7 +97,7 @@ public: for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { if (Player* player = itr->GetSource()) - player->KilledMonsterCredit(LODGE_QUEST_TRIGGER, 0); + player->KilledMonsterCredit(LODGE_QUEST_TRIGGER); } } } @@ -115,9 +112,9 @@ public: case TARETHA_ENTRY: TarethaGUID = creature->GetGUID(); break; - case EPOCH_ENTRY: - EpochGUID = creature->GetGUID(); - break; + case EPOCH_ENTRY: + EpochGUID = creature->GetGUID(); + break; } } @@ -224,7 +221,7 @@ public: return 0; } - uint64 GetData64(uint32 data) const override + ObjectGuid GetGuidData(uint32 data) const override { switch (data) { @@ -232,10 +229,10 @@ public: return ThrallGUID; case DATA_TARETHA: return TarethaGUID; - case DATA_EPOCH: - return EpochGUID; + case DATA_EPOCH: + return EpochGUID; } - return 0; + return ObjectGuid::Empty; } }; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp index 56e95fafece..66ce5e93720 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp @@ -404,7 +404,7 @@ public: me->SummonCreature(NPC_INN_GUARDSMAN, 2656.39f, 659.77f, 61.93f, 2.61f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); break; case 94: - if (Creature* Taretha = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TARETHA))) + if (Creature* Taretha = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TARETHA))) Taretha->AI()->Talk(SAY_TA_ESCAPED, me); break; case 95: @@ -426,7 +426,7 @@ public: case 106: { //trigger taretha to run down outside - if (Creature* Taretha = instance->instance->GetCreature(instance->GetData64(DATA_TARETHA))) + if (Creature* Taretha = instance->instance->GetCreature(instance->GetGuidData(DATA_TARETHA))) { if (Player* player = GetPlayerForEscort()) ENSURE_AI(npc_escortAI, (Taretha->AI()))->Start(false, true, player->GetGUID()); @@ -440,7 +440,7 @@ public: for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { if (Player* player = itr->GetSource()) - player->KilledMonsterCredit(20156, 0); + player->KilledMonsterCredit(20156); } } @@ -588,10 +588,10 @@ public: if (instance->GetData(TYPE_THRALL_EVENT) == IN_PROGRESS) { instance->SetData(TYPE_THRALL_PART4, IN_PROGRESS); - if (instance->GetData64(DATA_EPOCH) == 0) + if (instance->GetGuidData(DATA_EPOCH).IsEmpty()) creature->SummonCreature(ENTRY_EPOCH, 2639.13f, 698.55f, 65.43f, 4.59f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000); - if (Creature* thrall = (ObjectAccessor::GetCreature(*creature, instance->GetData64(DATA_THRALL)))) + if (Creature* thrall = (ObjectAccessor::GetCreature(*creature, instance->GetGuidData(DATA_THRALL)))) ENSURE_AI(npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI, thrall->AI())->StartWP(); } } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp index 35497b1f9ce..ed49cc41c39 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp @@ -89,13 +89,12 @@ public: uint8 mRiftWaveCount; uint8 mRiftWaveId; - uint64 _medivhGUID; + ObjectGuid _medivhGUID; uint8 _currentRiftId; void Initialize() override { SetHeaders(DataHeader); - _medivhGUID = 0; Clear(); } @@ -253,12 +252,12 @@ public: return 0; } - uint64 GetData64(uint32 data) const override + ObjectGuid GetGuidData(uint32 data) const override { if (data == DATA_MEDIVH) return _medivhGUID; - return 0; + return ObjectGuid::Empty; } Creature* SummonedPortalBoss(Creature* me) diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp index 1fa104ada00..64d99c03dab 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp @@ -321,7 +321,7 @@ public: pos.m_positionZ = std::max(me->GetMap()->GetHeight(pos.m_positionX, pos.m_positionY, MAX_HEIGHT), me->GetMap()->GetWaterLevel(pos.m_positionX, pos.m_positionY)); if (Unit* Summon = DoSummon(creature_entry, pos, 30000, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT)) - if (Unit* temp = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_MEDIVH))) + if (Unit* temp = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_MEDIVH))) Summon->AddThreat(temp, 0.0f); } diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp index 0a6b2e88b26..5c083e43d3d 100644 --- a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp +++ b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp @@ -140,8 +140,8 @@ public: MovePoint = urand(0, 5); PointData = GetMoveData(); SummonWhelpCount = 0; - triggerGUID = 0; - tankGUID = 0; + triggerGUID.Clear(); + tankGUID.Clear(); IsMoving = false; } @@ -355,7 +355,7 @@ public: Trinity::GameObjectLastSearcher<Trinity::GameObjectInRangeCheck> searcher(me, Floor, check); me->VisitNearbyGridObject(30, searcher); if (Floor) - instance->SetData64(DATA_FLOOR_ERUPTION_GUID, Floor->GetGUID()); + instance->SetGuidData(DATA_FLOOR_ERUPTION_GUID, Floor->GetGUID()); events.ScheduleEvent(EVENT_BELLOWING_ROAR, 30000); break; } @@ -473,8 +473,8 @@ public: uint8 Phase; uint8 MovePoint; uint8 SummonWhelpCount; - uint64 triggerGUID; - uint64 tankGUID; + ObjectGuid triggerGUID; + ObjectGuid tankGUID; bool IsMoving; }; diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp index 6aa50e71b17..4bbbf26b84e 100644 --- a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp +++ b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp @@ -53,7 +53,6 @@ public: SetHeaders(DataHeader); SetBossNumber(EncounterCount); - onyxiaGUID = 0; onyxiaLiftoffTimer = 0; manyWhelpsCounter = 0; eruptTimer = 0; @@ -102,7 +101,7 @@ public: } } - void FloorEruption(uint64 floorEruptedGUID) + void FloorEruption(ObjectGuid floorEruptedGUID) { if (GameObject* floorEruption = instance->GetGameObject(floorEruptedGUID)) { @@ -121,7 +120,7 @@ public: { if (((*itr)->GetGOInfo()->displayId == 4392 || (*itr)->GetGOInfo()->displayId == 4472) && (*itr)->GetGOInfo()->trap.spellId == 17731) { - uint64 nearFloorGUID = (*itr)->GetGUID(); + ObjectGuid nearFloorGUID = (*itr)->GetGUID(); if (FloorEruptionGUID[1].find(nearFloorGUID) != FloorEruptionGUID[1].end() && (*FloorEruptionGUID[1].find(nearFloorGUID)).second == 0) { (*FloorEruptionGUID[1].find(nearFloorGUID)).second = (*FloorEruptionGUID[1].find(floorEruptedGUID)).second+1; @@ -173,7 +172,7 @@ public: } } - void SetData64(uint32 type, uint64 data) override + void SetGuidData(uint32 type, ObjectGuid data) override { switch (type) { @@ -185,7 +184,7 @@ public: } } - uint64 GetData64(uint32 data) const override + ObjectGuid GetGuidData(uint32 data) const override { switch (data) { @@ -193,7 +192,7 @@ public: return onyxiaGUID; } - return 0; + return ObjectGuid::Empty; } void Update(uint32 diff) override @@ -212,8 +211,8 @@ public: { if (eruptTimer <= diff) { - uint64 frontGuid = FloorEruptionGUIDQueue.front(); - std::map<uint64, uint32>::iterator itr = FloorEruptionGUID[1].find(frontGuid); + ObjectGuid frontGuid = FloorEruptionGUIDQueue.front(); + std::map<ObjectGuid, uint32>::iterator itr = FloorEruptionGUID[1].find(frontGuid); if (itr != FloorEruptionGUID[1].end()) { uint32 treeHeight = itr->second; @@ -252,11 +251,9 @@ public: } protected: - std::map<uint64, uint32> FloorEruptionGUID[2]; - std::queue<uint64> FloorEruptionGUIDQueue; - uint64 onyxiaGUID; - uint64 triggerGUID; - uint64 tankGUID; + std::map<ObjectGuid, uint32> FloorEruptionGUID[2]; + std::queue<ObjectGuid> FloorEruptionGUIDQueue; + ObjectGuid onyxiaGUID; uint32 onyxiaLiftoffTimer; uint32 manyWhelpsCounter; uint32 eruptTimer; diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp index ca5e6a9828c..8a82f782918 100644 --- a/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp +++ b/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp @@ -59,7 +59,6 @@ public: void Initialize() override { - goGongGUID = 0; gongWave = 0; fiendsKilled = 0; reaversKilled = 0; @@ -172,7 +171,7 @@ public: } protected: - uint64 goGongGUID; + ObjectGuid goGongGUID; uint16 gongWave; uint8 fiendsKilled; uint8 reaversKilled; diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp index 6f9ba0afa7b..07cb6e65ee9 100644 --- a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp +++ b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp @@ -44,14 +44,13 @@ public: { instance_razorfen_kraul_InstanceMapScript(Map* map) : InstanceScript(map) { } - uint64 DoorWardGUID; + ObjectGuid DoorWardGUID; int WardKeeperDeath; void Initialize() override { SetHeaders(DataHeader); WardKeeperDeath = 0; - DoorWardGUID = 0; } Player* GetPlayerInMap() diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp index e3021ff7a95..8cbd611a18a 100644 --- a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp +++ b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp @@ -159,13 +159,12 @@ public: npc_snufflenose_gopherAI(Creature* creature) : PetAI(creature) { IsMovementActive = false; - TargetTubberGUID = 0; } void Reset() override { IsMovementActive = false; - TargetTubberGUID = 0; + TargetTubberGUID.Clear(); } void MovementInform(uint32 type, uint32 id) override @@ -227,7 +226,7 @@ public: bool IsMovementActive; - uint64 TargetTubberGUID; + ObjectGuid TargetTubberGUID; }; }; diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp index 19cc5316fa4..1a09ef27b04 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp @@ -200,14 +200,14 @@ class boss_ayamiss : public CreatureScript if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true)) { DoCast(target, SPELL_PARALYZE); - instance->SetData64(DATA_PARALYZED, target->GetGUID()); + instance->SetGuidData(DATA_PARALYZED, target->GetGUID()); uint8 Index = urand(0, 1); me->SummonCreature(NPC_LARVA, LarvaPos[Index], TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); } events.ScheduleEvent(EVENT_PARALYZE, 15000); break; case EVENT_SWARMER_ATTACK: - for (std::list<uint64>::iterator i = _swarmers.begin(); i != _swarmers.end(); ++i) + for (GuidList::iterator i = _swarmers.begin(); i != _swarmers.end(); ++i) if (Creature* swarmer = me->GetMap()->GetCreature(*i)) if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) swarmer->AI()->AttackStart(target); @@ -234,7 +234,7 @@ class boss_ayamiss : public CreatureScript } } private: - std::list<uint64> _swarmers; + GuidList _swarmers; uint8 _phase; bool _enraged; }; @@ -261,7 +261,7 @@ class npc_hive_zara_larva : public CreatureScript { if (type == POINT_MOTION_TYPE) if (id == POINT_PARALYZE) - if (Player* target = ObjectAccessor::GetPlayer(*me, _instance->GetData64(DATA_PARALYZED))) + if (Player* target = ObjectAccessor::GetPlayer(*me, _instance->GetGuidData(DATA_PARALYZED))) DoCast(target, SPELL_FEED); // Omnomnom } diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp index cf6703a01f5..d6640b5a0ab 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp @@ -76,8 +76,8 @@ class boss_buru : public CreatureScript { BossAI::EnterEvadeMode(); - for (std::list<uint64>::iterator i = Eggs.begin(); i != Eggs.end(); ++i) - if (Creature* egg = me->GetMap()->GetCreature(*Eggs.begin())) + for (ObjectGuid eggGuid : Eggs) + if (Creature* egg = me->GetMap()->GetCreature(eggGuid)) egg->Respawn(); Eggs.clear(); @@ -127,7 +127,7 @@ class boss_buru : public CreatureScript } } - void ManageRespawn(uint64 EggGUID) + void ManageRespawn(ObjectGuid EggGUID) { ChaseNewVictim(); Eggs.push_back(EggGUID); @@ -183,8 +183,8 @@ class boss_buru : public CreatureScript DoMeleeAttackIfReady(); } private: + GuidList Eggs; uint8 _phase; - std::list<uint64> Eggs; }; CreatureAI* GetAI(Creature* creature) const override @@ -208,7 +208,7 @@ class npc_buru_egg : public CreatureScript void EnterCombat(Unit* attacker) override { - if (Creature* buru = me->GetMap()->GetCreature(_instance->GetData64(DATA_BURU))) + if (Creature* buru = me->GetMap()->GetCreature(_instance->GetGuidData(DATA_BURU))) if (!buru->IsInCombat()) buru->AI()->AttackStart(attacker); } @@ -216,7 +216,7 @@ class npc_buru_egg : public CreatureScript void JustSummoned(Creature* who) override { if (who->GetEntry() == NPC_HATCHLING) - if (Creature* buru = me->GetMap()->GetCreature(_instance->GetData64(DATA_BURU))) + if (Creature* buru = me->GetMap()->GetCreature(_instance->GetGuidData(DATA_BURU))) if (Unit* target = buru->AI()->SelectTarget(SELECT_TARGET_RANDOM)) who->AI()->AttackStart(target); } @@ -227,7 +227,7 @@ class npc_buru_egg : public CreatureScript DoCastAOE(SPELL_EXPLODE_2, true); // Unknown purpose DoCast(me, SPELL_SUMMON_HATCHLING, true); - if (Creature* buru = me->GetMap()->GetCreature(_instance->GetData64(DATA_BURU))) + if (Creature* buru = me->GetMap()->GetCreature(_instance->GetGuidData(DATA_BURU))) if (boss_buru::boss_buruAI* buruAI = dynamic_cast<boss_buru::boss_buruAI*>(buru->AI())) buruAI->ManageRespawn(me->GetGUID()); } diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp index adb6723d2af..776971b1f9f 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp @@ -83,7 +83,7 @@ class boss_kurinnaxx : public CreatureScript void JustDied(Unit* /*killer*/) override { _JustDied(); - if (Creature* Ossirian = me->GetMap()->GetCreature(instance->GetData64(DATA_OSSIRIAN))) + if (Creature* Ossirian = me->GetMap()->GetCreature(instance->GetGuidData(DATA_OSSIRIAN))) sCreatureTextMgr->SendChat(Ossirian, SAY_KURINAXX_DEATH, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_ZONE); } diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp index 0180bbeddac..2ba755d3c4e 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp @@ -95,12 +95,12 @@ class boss_ossirian : public CreatureScript void Initialize() { CrystalIterator = 0; - TriggerGUID = 0; - CrystalGUID = 0; + TriggerGUID.Clear(); + CrystalGUID.Clear(); } - uint64 TriggerGUID; - uint64 CrystalGUID; + ObjectGuid TriggerGUID; + ObjectGuid CrystalGUID; uint8 CrystalIterator; bool SaidIntro; diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp index 1b62527dab7..0e34f4a5595 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp @@ -30,14 +30,6 @@ class instance_ruins_of_ahnqiraj : public InstanceMapScript { SetHeaders(DataHeader); SetBossNumber(NUM_ENCOUNTER); - - _kurinaxxGUID = 0; - _rajaxxGUID = 0; - _moamGUID = 0; - _buruGUID = 0; - _ayamissGUID = 0; - _ossirianGUID = 0; - _paralyzedGUID = 0; } void OnCreatureCreate(Creature* creature) override @@ -73,13 +65,13 @@ class instance_ruins_of_ahnqiraj : public InstanceMapScript return true; } - void SetData64(uint32 type, uint64 data) override + void SetGuidData(uint32 type, ObjectGuid data) override { if (type == DATA_PARALYZED) _paralyzedGUID = data; } - uint64 GetData64(uint32 type) const override + ObjectGuid GetGuidData(uint32 type) const override { switch (type) { @@ -99,17 +91,17 @@ class instance_ruins_of_ahnqiraj : public InstanceMapScript return _paralyzedGUID; } - return 0; + return ObjectGuid::Empty; } private: - uint64 _kurinaxxGUID; - uint64 _rajaxxGUID; - uint64 _moamGUID; - uint64 _buruGUID; - uint64 _ayamissGUID; - uint64 _ossirianGUID; - uint64 _paralyzedGUID; + ObjectGuid _kurinaxxGUID; + ObjectGuid _rajaxxGUID; + ObjectGuid _moamGUID; + ObjectGuid _buruGUID; + ObjectGuid _ayamissGUID; + ObjectGuid _ossirianGUID; + ObjectGuid _paralyzedGUID; }; InstanceScript* GetInstanceScript(InstanceMap* map) const override diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp index be103541989..4ed4c3c2e26 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp @@ -315,11 +315,11 @@ public: switch (urand(0, 2)) { case 0: - if (Creature* kri = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KRI))) + if (Creature* kri = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KRI))) DoCast(kri, SPELL_HEAL); break; case 1: - if (Creature* vem = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VEM))) + if (Creature* vem = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VEM))) DoCast(vem, SPELL_HEAL); break; case 2: diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp index c9795133d14..218aa69304c 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp @@ -307,7 +307,7 @@ public: me->SetReactState(REACT_PASSIVE); //Remove any target - me->SetTarget(0); + me->SetTarget(ObjectGuid::Empty); //Select random target for dark beam to start on if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) @@ -384,7 +384,7 @@ public: //Transition phase case PHASE_CTHUN_TRANSITION: //Remove any target - me->SetTarget(0); + me->SetTarget(ObjectGuid::Empty); me->SetHealth(0); me->SetVisible(false); break; @@ -420,7 +420,7 @@ public: me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); //Remove Target field - me->SetTarget(0); + me->SetTarget(ObjectGuid::Empty); //Death animation/respawning; instance->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_TRANSITION); @@ -475,7 +475,7 @@ public: PhaseTimer = 10000; //Emerge in 10 seconds //No hold player for transition - HoldPlayer = 0; + HoldPlayer.Clear(); //Body Phase EyeTentacleTimer = 30000; @@ -485,7 +485,7 @@ public: StomachAcidTimer = 4000; //Every 4 seconds StomachEnterTimer = 10000; //Every 10 seconds StomachEnterVisTimer = 0; //Always 3.5 seconds after Stomach Enter Timer - StomachEnterTarget = 0; //Target to be teleported to stomach + StomachEnterTarget.Clear(); //Target to be teleported to stomach } InstanceScript* instance; @@ -499,7 +499,7 @@ public: //------------------- //Phase transition - uint64 HoldPlayer; + ObjectGuid HoldPlayer; //Body Phase uint32 EyeTentacleTimer; @@ -509,10 +509,10 @@ public: uint32 StomachAcidTimer; uint32 StomachEnterTimer; uint32 StomachEnterVisTimer; - uint64 StomachEnterTarget; + ObjectGuid StomachEnterTarget; //Stomach map, bool = true then in stomach - std::unordered_map<uint64, bool> Stomach_Map; + std::unordered_map<ObjectGuid, bool> Stomach_Map; void Reset() override { @@ -548,7 +548,7 @@ public: if (Stomach_Map.empty()) return NULL; - std::unordered_map<uint64, bool>::const_iterator i = Stomach_Map.begin(); + std::unordered_map<ObjectGuid, bool>::const_iterator i = Stomach_Map.begin(); std::list<Unit*> temp; std::list<Unit*>::const_iterator j; @@ -610,7 +610,7 @@ public: return; } - me->SetTarget(0); + me->SetTarget(ObjectGuid::Empty); uint32 currentPhase = instance->GetData(DATA_CTHUN_PHASE); if (currentPhase == PHASE_CTHUN_STOMACH || currentPhase == PHASE_CTHUN_WEAK) @@ -680,7 +680,7 @@ public: //Body Phase case PHASE_CTHUN_STOMACH: //Remove Target field - me->SetTarget(0); + me->SetTarget(ObjectGuid::Empty); //Weaken if (FleshTentaclesKilled > 1) @@ -692,7 +692,7 @@ public: DoCast(me, SPELL_PURPLE_COLORATION, true); - std::unordered_map<uint64, bool>::iterator i = Stomach_Map.begin(); + std::unordered_map<ObjectGuid, bool>::iterator i = Stomach_Map.begin(); //Kick all players out of stomach while (i != Stomach_Map.end()) @@ -724,7 +724,7 @@ public: if (StomachAcidTimer <= diff) { //Apply aura to all players in stomach - std::unordered_map<uint64, bool>::iterator i = Stomach_Map.begin(); + std::unordered_map<ObjectGuid, bool>::iterator i = Stomach_Map.begin(); while (i != Stomach_Map.end()) { @@ -786,7 +786,7 @@ public: DoTeleportPlayer(unit, STOMACH_X, STOMACH_Y, STOMACH_Z, STOMACH_O); } - StomachEnterTarget = 0; + StomachEnterTarget.Clear(); StomachEnterVisTimer = 0; } else StomachEnterVisTimer -= diff; } @@ -913,7 +913,6 @@ public: MindflayTimer = 500; KillSelfTimer = 35000; - Portal = 0; if (Creature* pPortal = me->SummonCreature(NPC_SMALL_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) { pPortal->SetReactState(REACT_PASSIVE); @@ -925,7 +924,7 @@ public: uint32 MindflayTimer; uint32 KillSelfTimer; - uint64 Portal; + ObjectGuid Portal; void JustDied(Unit* /*killer*/) override { @@ -995,7 +994,6 @@ public: SetCombatMovement(false); - Portal = 0; if (Creature* pPortal = me->SummonCreature(NPC_SMALL_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) { pPortal->SetReactState(REACT_PASSIVE); @@ -1006,7 +1004,7 @@ public: uint32 GroundRuptureTimer; uint32 HamstringTimer; uint32 EvadeTimer; - uint64 Portal; + ObjectGuid Portal; void JustDied(Unit* /*killer*/) override { @@ -1111,7 +1109,6 @@ public: SetCombatMovement(false); - Portal = 0; if (Creature* pPortal = me->SummonCreature(NPC_GIANT_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) { pPortal->SetReactState(REACT_PASSIVE); @@ -1123,7 +1120,7 @@ public: uint32 ThrashTimer; uint32 HamstringTimer; uint32 EvadeTimer; - uint64 Portal; + ObjectGuid Portal; void JustDied(Unit* /*killer*/) override { @@ -1233,7 +1230,6 @@ public: SetCombatMovement(false); - Portal = 0; if (Creature* pPortal = me->SummonCreature(NPC_GIANT_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) { pPortal->SetReactState(REACT_PASSIVE); @@ -1242,7 +1238,7 @@ public: } uint32 BeamTimer; - uint64 Portal; + ObjectGuid Portal; void JustDied(Unit* /*killer*/) override { diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp index e65dbacc1f2..c653064d62c 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp @@ -110,7 +110,7 @@ struct boss_twinemperorsAI : public ScriptedAI Creature* GetOtherBoss() { - return ObjectAccessor::GetCreature(*me, instance->GetData64(IAmVeklor() ? DATA_VEKNILASH : DATA_VEKLOR)); + return ObjectAccessor::GetCreature(*me, instance->GetGuidData(IAmVeklor() ? DATA_VEKNILASH : DATA_VEKLOR)); } void DamageTaken(Unit* /*done_by*/, uint32 &damage) override diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp index 7f223f21269..fe6e0a435a7 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp @@ -272,7 +272,7 @@ class npc_glob_of_viscidus : public CreatureScript { InstanceScript* Instance = me->GetInstanceScript(); - if (Creature* Viscidus = me->GetMap()->GetCreature(Instance->GetData64(DATA_VISCIDUS))) + if (Creature* Viscidus = me->GetMap()->GetCreature(Instance->GetGuidData(DATA_VISCIDUS))) { if (BossAI* ViscidusAI = dynamic_cast<BossAI*>(Viscidus->GetAI())) ViscidusAI->SummonedCreatureDespawn(me); diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp index e6d9bd86a4d..456ff749e84 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp @@ -45,12 +45,12 @@ class instance_temple_of_ahnqiraj : public InstanceMapScript bool IsBossDied[3]; //Storing Skeram, Vem and Kri. - uint64 SkeramGUID; - uint64 VemGUID; - uint64 KriGUID; - uint64 VeklorGUID; - uint64 VeknilashGUID; - uint64 ViscidusGUID; + ObjectGuid SkeramGUID; + ObjectGuid VemGUID; + ObjectGuid KriGUID; + ObjectGuid VeklorGUID; + ObjectGuid VeknilashGUID; + ObjectGuid ViscidusGUID; uint32 BugTrioDeathCount; @@ -63,13 +63,6 @@ class instance_temple_of_ahnqiraj : public InstanceMapScript IsBossDied[1] = false; IsBossDied[2] = false; - SkeramGUID = 0; - VemGUID = 0; - KriGUID = 0; - VeklorGUID = 0; - VeknilashGUID = 0; - ViscidusGUID = 0; - BugTrioDeathCount = 0; CthunPhase = 0; @@ -134,7 +127,7 @@ class instance_temple_of_ahnqiraj : public InstanceMapScript return 0; } - uint64 GetData64(uint32 identifier) const override + ObjectGuid GetGuidData(uint32 identifier) const override { switch (identifier) { @@ -151,8 +144,8 @@ class instance_temple_of_ahnqiraj : public InstanceMapScript case DATA_VISCIDUS: return ViscidusGUID; } - return 0; - } // end GetData64 + return ObjectGuid::Empty; + } // end GetGuidData void SetData(uint32 type, uint32 data) override { diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp index b8f6c0ed80e..7b20e5dd8a9 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp @@ -103,14 +103,16 @@ public: gatherOthersWhenAggro = true; } - uint64 NearbyGUID[3]; + ObjectGuid NearbyGUID[3]; void ClearBuddyList() { - NearbyGUID[0] = NearbyGUID[1] = NearbyGUID[2] = 0; + NearbyGUID[0].Clear(); + NearbyGUID[1].Clear(); + NearbyGUID[2].Clear(); } - void AddBuddyToList(uint64 CreatureGUID) + void AddBuddyToList(ObjectGuid CreatureGUID) { if (CreatureGUID == me->GetGUID()) return; @@ -130,7 +132,7 @@ public: void GiveBuddyMyList(Creature* c) { aqsentinelAI* cai = ENSURE_AI(aqsentinelAI, (c)->AI()); - for (int i=0; i<3; ++i) + for (int32 i = 0; i < 3; ++i) if (NearbyGUID[i] && NearbyGUID[i] != c->GetGUID()) cai->AddBuddyToList(NearbyGUID[i]); cai->AddBuddyToList(me->GetGUID()); @@ -138,14 +140,14 @@ public: void SendMyListToBuddies() { - for (int i=0; i<3; ++i) + for (int32 i = 0; i < 3; ++i) if (Creature* pNearby = ObjectAccessor::GetCreature(*me, NearbyGUID[i])) GiveBuddyMyList(pNearby); } void CallBuddiesToAttack(Unit* who) { - for (int i=0; i<3; ++i) + for (int32 i = 0; i < 3; ++i) { Creature* c = ObjectAccessor::GetCreature(*me, NearbyGUID[i]); if (c) @@ -222,7 +224,7 @@ public: { if (!me->isDead()) { - for (int i=0; i<3; ++i) + for (int i = 0; i < 3; ++i) { if (!NearbyGUID[i]) continue; @@ -252,7 +254,7 @@ public: void JustDied(Unit* /*killer*/) override { - for (int ni=0; ni<3; ++ni) + for (int ni = 0; ni < 3; ++ni) { Creature* sent = ObjectAccessor::GetCreature(*me, NearbyGUID[ni]); if (!sent) diff --git a/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp index bb2fc8bca20..5d7202588a9 100644 --- a/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp +++ b/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp @@ -46,7 +46,7 @@ public: uint32 m_auiEncounter[MAX_ENCOUNTER]; bool yelled; - uint64 NaralexGUID; + ObjectGuid NaralexGUID; void Initialize() override { @@ -54,7 +54,6 @@ public: memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); yelled = false; - NaralexGUID = 0; } void OnCreatureCreate(Creature* creature) override @@ -99,10 +98,10 @@ public: return 0; } - uint64 GetData64(uint32 data) const override + ObjectGuid GetGuidData(uint32 data) const override { if (data == DATA_NARALEX)return NaralexGUID; - return 0; + return ObjectGuid::Empty; } std::string GetSaveData() override diff --git a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp index bb872421197..522d6eee464 100644 --- a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp +++ b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp @@ -259,7 +259,7 @@ public: ++eventProgress; eventTimer = 15000; //CAST_AI(npc_escort::npc_escortAI, me->AI())->SetCanDefend(false); - if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX))) + if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX))) DoCast(naralex, SPELL_NARALEXS_AWAKENING, true); Talk(EMOTE_AWAKENING_RITUAL); } @@ -268,7 +268,7 @@ public: { ++eventProgress; eventTimer = 15000; - if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX))) + if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX))) naralex->AI()->Talk(EMOTE_TROUBLED_SLEEP); me->SummonCreature(NPC_DEVIATE_MOCCASIN, 135.943f, 199.701f, -103.529f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); me->SummonCreature(NPC_DEVIATE_MOCCASIN, 151.08f, 221.13f, -103.609f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); @@ -279,7 +279,7 @@ public: { ++eventProgress; eventTimer = 30000; - if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX))) + if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX))) naralex->AI()->Talk(EMOTE_WRITHE_IN_AGONY); me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 133.413f, 207.188f, -102.469f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 142.857f, 218.645f, -102.905f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); @@ -293,7 +293,7 @@ public: if (eventProgress == 5) { ++eventProgress; - if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX))) + if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX))) naralex->AI()->Talk(EMOTE_HORRENDOUS_VISION); me->SummonCreature(NPC_MUTANUS_THE_DEVOURER, 150.872f, 262.905f, -103.503f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); Talk(SAY_MUTANUS_THE_DEVOURER); @@ -304,7 +304,7 @@ public: { ++eventProgress; eventTimer = 3000; - if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX))) + if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX))) { if (me->HasAura(SPELL_NARALEXS_AWAKENING)) me->RemoveAura(SPELL_NARALEXS_AWAKENING); @@ -318,7 +318,7 @@ public: { ++eventProgress; eventTimer = 6000; - if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX))) + if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX))) naralex->AI()->Talk(SAY_THANK_YOU); } else @@ -326,7 +326,7 @@ public: { ++eventProgress; eventTimer = 8000; - if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX))) + if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX))) { naralex->AI()->Talk(SAY_FAREWELL); naralex->AddAura(SPELL_FLIGHT_FORM, naralex); @@ -340,7 +340,7 @@ public: { ++eventProgress; eventTimer = 1500; - if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX))) + if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX))) naralex->GetMotionMaster()->MovePoint(25, naralex->GetPositionX(), naralex->GetPositionY(), naralex->GetPositionZ()); } else @@ -348,7 +348,7 @@ public: { ++eventProgress; eventTimer = 2500; - if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX))) + if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX))) { naralex->GetMotionMaster()->MovePoint(0, 117.095512f, 247.107971f, -96.167870f); naralex->GetMotionMaster()->MovePoint(1, 90.388809f, 276.135406f, -83.389801f); @@ -359,7 +359,7 @@ public: else if (eventProgress == 11) { - if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX))) + if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX))) naralex->SetVisible(false); me->SetVisible(false); instance->SetData(TYPE_NARALEX_PART3, DONE); diff --git a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp index 83f1724130c..393028e0446 100644 --- a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp +++ b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp @@ -111,13 +111,13 @@ public: instance_zulfarrak_InstanceMapScript(Map* map) : InstanceScript(map) { } uint32 GahzRillaEncounter; - uint64 ZumrahGUID; - uint64 BlyGUID; - uint64 WeegliGUID; - uint64 OroGUID; - uint64 RavenGUID; - uint64 MurtaGUID; - uint64 EndDoorGUID; + ObjectGuid ZumrahGUID; + ObjectGuid BlyGUID; + ObjectGuid WeegliGUID; + ObjectGuid OroGUID; + ObjectGuid RavenGUID; + ObjectGuid MurtaGUID; + ObjectGuid EndDoorGUID; uint32 PyramidPhase; uint32 major_wave_Timer; uint32 minor_wave_Timer; @@ -127,14 +127,6 @@ public: void Initialize() override { SetHeaders(DataHeader); - GahzRillaEncounter = NOT_STARTED; - ZumrahGUID = 0; - BlyGUID = 0; - WeegliGUID = 0; - OroGUID = 0; - RavenGUID = 0; - MurtaGUID = 0; - EndDoorGUID = 0; PyramidPhase = 0; major_wave_Timer = 0; minor_wave_Timer = 0; @@ -198,7 +190,7 @@ public: return 0; } - uint64 GetData64(uint32 data) const override + ObjectGuid GetGuidData(uint32 data) const override { switch (data) { @@ -217,7 +209,7 @@ public: case GO_END_DOOR: return EndDoorGUID; } - return 0; + return ObjectGuid::Empty; } void SetData(uint32 type, uint32 data) override @@ -315,11 +307,11 @@ public: }; } - std::list<uint64> addsAtBase, movedadds; + GuidList addsAtBase, movedadds; void MoveNPCIfAlive(uint32 entry, float x, float y, float z, float o) { - if (Creature* npc = instance->GetCreature(GetData64(entry))) + if (Creature* npc = instance->GetCreature(GetGuidData(entry))) { if (npc->IsAlive()) { @@ -346,7 +338,7 @@ public: bool IsWaveAllDead() { - for (std::list<uint64>::iterator itr = addsAtBase.begin(); itr != addsAtBase.end(); ++itr) + for (GuidList::iterator itr = addsAtBase.begin(); itr != addsAtBase.end(); ++itr) { if (Creature* add = instance->GetCreature((*itr))) { @@ -354,7 +346,7 @@ public: return false; } } - for (std::list<uint64>::iterator itr = movedadds.begin(); itr != movedadds.end(); ++itr) + for (GuidList::iterator itr = movedadds.begin(); itr != movedadds.end(); ++itr) { if (Creature* add = instance->GetCreature(((*itr)))) { diff --git a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp index 47d269a00ff..443bd1578d7 100644 --- a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp +++ b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp @@ -108,7 +108,6 @@ public: instance = creature->GetInstanceScript(); postGossipStep = 0; Text_Timer = 0; - PlayerGUID = 0; } void Initialize() @@ -123,7 +122,7 @@ public: uint32 Text_Timer; uint32 ShieldBash_Timer; uint32 Revenge_Timer; //this is wrong, spell should never be used unless me->GetVictim() dodge, parry or block attack. Trinity support required. - uint64 PlayerGUID; + ObjectGuid PlayerGUID; void Reset() override { @@ -142,7 +141,7 @@ public: { case 1: //weegli doesn't fight - he goes & blows up the door - if (Creature* pWeegli = instance->instance->GetCreature(instance->GetData64(ENTRY_WEEGLI))) + if (Creature* pWeegli = instance->instance->GetCreature(instance->GetGuidData(ENTRY_WEEGLI))) pWeegli->AI()->DoAction(0); Talk(SAY_1); Text_Timer = 5000; @@ -195,7 +194,7 @@ public: void switchFactionIfAlive(uint32 entry) { - if (Creature* crew = ObjectAccessor::GetCreature(*me, instance->GetData64(entry))) + if (Creature* crew = ObjectAccessor::GetCreature(*me, instance->GetGuidData(entry))) if (crew->IsAlive()) crew->setFaction(FACTION_HOSTILE); } @@ -230,7 +229,7 @@ public: private: void initBlyCrewMember(InstanceScript* instance, uint32 entry, float x, float y, float z) { - if (Creature* crew = instance->instance->GetCreature(instance->GetData64(entry))) + if (Creature* crew = instance->instance->GetCreature(instance->GetGuidData(entry))) { crew->SetReactState(REACT_AGGRESSIVE); crew->SetWalk(true); @@ -370,7 +369,7 @@ public: else if (destroyingDoor) { - instance->DoUseDoorOrButton(instance->GetData64(GO_END_DOOR)); + instance->DoUseDoorOrButton(instance->GetGuidData(GO_END_DOOR)); /// @todo leave the area... me->DespawnOrUnsummon(); }; diff --git a/src/server/scripts/Kalimdor/zone_azshara.cpp b/src/server/scripts/Kalimdor/zone_azshara.cpp index cec94617454..542e04a7dd5 100644 --- a/src/server/scripts/Kalimdor/zone_azshara.cpp +++ b/src/server/scripts/Kalimdor/zone_azshara.cpp @@ -314,7 +314,7 @@ public: MustDieTimer = 3000; CurrWP = 0; - PlayerGUID = 0; + PlayerGUID.Clear(); MustDie = false; Escape = false; @@ -453,7 +453,7 @@ public: } private: - uint64 PlayerGUID; + ObjectGuid PlayerGUID; uint32 SpellEscapeTimer; uint32 TeleportTimer; uint32 CheckTimer; diff --git a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp index e6869dbf0f5..c6f4e9d0ee6 100644 --- a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp +++ b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp @@ -68,7 +68,7 @@ public: void Initialize() { - pCaster = 0; + pCaster.Clear(); SayThanksTimer = 0; RunAwayTimer = 0; @@ -77,7 +77,7 @@ public: CanSayHelp = true; } - uint64 pCaster; + ObjectGuid pCaster; uint32 SayThanksTimer; uint32 RunAwayTimer; @@ -431,13 +431,13 @@ public: void Initialize() { - SparkGUID = 0; + SparkGUID.Clear(); Step = 0; EventStarted = false; SayTimer = 0; } - uint64 SparkGUID; + ObjectGuid SparkGUID; uint8 Step; uint32 SayTimer; @@ -528,7 +528,7 @@ public: for (std::list<Player*>::const_iterator itr = players.begin(); itr != players.end(); ++itr) if ((*itr)->GetQuestStatus(QUEST_TREES_COMPANY) == QUEST_STATUS_INCOMPLETE && (*itr)->HasAura(SPELL_TREE_DISGUISE)) - (*itr)->KilledMonsterCredit(NPC_SPARK, 0); + (*itr)->KilledMonsterCredit(NPC_SPARK); } void DespawnNagaFlag(bool despawn) @@ -687,7 +687,7 @@ class npc_stillpine_capitive : public CreatureScript void Initialize() { - _playerGUID = 0; + _playerGUID.Clear(); _movementComplete = false; } @@ -737,7 +737,7 @@ class npc_stillpine_capitive : public CreatureScript } private: - uint64 _playerGUID; + ObjectGuid _playerGUID; EventMap _events; bool _movementComplete; }; diff --git a/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp b/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp index 81a175b57b7..5e2f4519b1e 100644 --- a/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp +++ b/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp @@ -64,7 +64,7 @@ public: { case 0: if (Player* player = killer->ToPlayer()) - player->KilledMonsterCredit(NPC_EXPEDITION_RESEARCHER, 0); + player->KilledMonsterCredit(NPC_EXPEDITION_RESEARCHER); break; case 1: case 2: diff --git a/src/server/scripts/Kalimdor/zone_desolace.cpp b/src/server/scripts/Kalimdor/zone_desolace.cpp index 0a56253cabd..7247286388a 100644 --- a/src/server/scripts/Kalimdor/zone_desolace.cpp +++ b/src/server/scripts/Kalimdor/zone_desolace.cpp @@ -103,7 +103,7 @@ public: { if (player->HasAura(SPELL_KODO_KOMBO_PLAYER_BUFF) && creature->HasAura(SPELL_KODO_KOMBO_DESPAWN_BUFF)) { - player->TalkedToCreature(creature->GetEntry(), 0); + player->TalkedToCreature(creature->GetEntry(), ObjectGuid::Empty); player->RemoveAurasDueToSpell(SPELL_KODO_KOMBO_PLAYER_BUFF); } diff --git a/src/server/scripts/Kalimdor/zone_durotar.cpp b/src/server/scripts/Kalimdor/zone_durotar.cpp index e2f8dd0854d..d0bda5d73cb 100644 --- a/src/server/scripts/Kalimdor/zone_durotar.cpp +++ b/src/server/scripts/Kalimdor/zone_durotar.cpp @@ -242,8 +242,7 @@ class npc_tiger_matriarch : public CreatureScript struct npc_tiger_matriarchAI : public ScriptedAI { - npc_tiger_matriarchAI(Creature* creature) : ScriptedAI(creature), - _tigerGuid(0) + npc_tiger_matriarchAI(Creature* creature) : ScriptedAI(creature) { } @@ -343,7 +342,7 @@ class npc_tiger_matriarch : public CreatureScript private: EventMap _events; - uint64 _tigerGuid; + ObjectGuid _tigerGuid; }; CreatureAI* GetAI(Creature* creature) const override diff --git a/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp index ee244e51b09..9f5e7bdf29d 100644 --- a/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp +++ b/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp @@ -655,7 +655,7 @@ public: if (Creature* prisoner = go->FindNearestCreature(NPC_THERAMORE_PRISONER, 1.0f)) { if (player) - player->KilledMonsterCredit(NPC_THERAMORE_PRISONER, 0); + player->KilledMonsterCredit(NPC_THERAMORE_PRISONER); prisoner->AI()->Talk(SAY_FREE); // We also emote cry here (handled in creature_text.emote) prisoner->DespawnOrUnsummon(6000); diff --git a/src/server/scripts/Kalimdor/zone_moonglade.cpp b/src/server/scripts/Kalimdor/zone_moonglade.cpp index 268db8da779..c8d880e66b7 100644 --- a/src/server/scripts/Kalimdor/zone_moonglade.cpp +++ b/src/server/scripts/Kalimdor/zone_moonglade.cpp @@ -299,7 +299,7 @@ public: npc_clintar_spiritAI(Creature* creature) : npc_escortAI(creature) { Initialize(); - PlayerGUID = 0; + PlayerGUID.Clear(); } void Initialize() @@ -307,7 +307,7 @@ public: Step = 0; CurrWP = 0; EventTimer = 0; - PlayerGUID = 0; + PlayerGUID.Clear(); checkPlayerTimer = 1000; EventOnWait = false; } @@ -317,7 +317,7 @@ public: uint32 EventTimer; uint32 checkPlayerTimer; - uint64 PlayerGUID; + ObjectGuid PlayerGUID; bool EventOnWait; @@ -358,7 +358,7 @@ public: if (player && player->GetQuestStatus(10965) == QUEST_STATUS_INCOMPLETE) { player->FailQuest(10965); - PlayerGUID = 0; + PlayerGUID.Clear(); Reset(); } } @@ -536,7 +536,7 @@ public: break; case 2: player->TalkedToCreature(me->GetEntry(), me->GetGUID()); - PlayerGUID = 0; + PlayerGUID.Clear(); Reset(); me->setDeathState(JUST_DIED); break; diff --git a/src/server/scripts/Kalimdor/zone_mulgore.cpp b/src/server/scripts/Kalimdor/zone_mulgore.cpp index 289d7282ac6..31f3dffe70a 100644 --- a/src/server/scripts/Kalimdor/zone_mulgore.cpp +++ b/src/server/scripts/Kalimdor/zone_mulgore.cpp @@ -71,14 +71,14 @@ public: { EventActive = false; IsMovingToLunch = false; - PlayerGUID = 0; + PlayerGUID.Clear(); EventTimer = 5000; EventPhase = 0; } bool EventActive; bool IsMovingToLunch; - uint64 PlayerGUID; + ObjectGuid PlayerGUID; uint32 EventTimer; uint8 EventPhase; diff --git a/src/server/scripts/Kalimdor/zone_orgrimmar.cpp b/src/server/scripts/Kalimdor/zone_orgrimmar.cpp index fd666b7fcd7..6097937f9d5 100644 --- a/src/server/scripts/Kalimdor/zone_orgrimmar.cpp +++ b/src/server/scripts/Kalimdor/zone_orgrimmar.cpp @@ -75,14 +75,14 @@ public: CanEmote = false; SaluteTimer = 6000; ResetTimer = 0; - PlayerGUID = 0; + PlayerGUID.Clear(); } bool CanTalk; bool CanEmote; uint32 SaluteTimer; uint32 ResetTimer; - uint64 PlayerGUID; + ObjectGuid PlayerGUID; void Reset() override { diff --git a/src/server/scripts/Kalimdor/zone_silithus.cpp b/src/server/scripts/Kalimdor/zone_silithus.cpp index 55f36779145..c977f1aee52 100644 --- a/src/server/scripts/Kalimdor/zone_silithus.cpp +++ b/src/server/scripts/Kalimdor/zone_silithus.cpp @@ -97,7 +97,7 @@ public: case GOSSIP_ACTION_INFO_DEF + 6: player->SEND_GOSSIP_MENU(7761, creature->GetGUID()); //'kill' our trigger to update quest status - player->KilledMonsterCredit(TRIGGER_RUTGAR, 0); + player->KilledMonsterCredit(TRIGGER_RUTGAR); break; case GOSSIP_ACTION_INFO_DEF + 9: @@ -123,7 +123,7 @@ public: case GOSSIP_ACTION_INFO_DEF + 14: player->SEND_GOSSIP_MENU(7767, creature->GetGUID()); //'kill' our trigger to update quest status - player->KilledMonsterCredit(TRIGGER_FRANKAL, 0); + player->KilledMonsterCredit(TRIGGER_FRANKAL); break; } return true; @@ -431,24 +431,24 @@ public: { AnimationTimer = 1500; AnimationCount = 0; - AnachronosQuestTriggerGUID = 0; - MerithraGUID = 0; - ArygosGUID = 0; - CaelestraszGUID = 0; - FandralGUID = 0; - PlayerGUID = 0; + AnachronosQuestTriggerGUID.Clear(); + MerithraGUID.Clear(); + ArygosGUID.Clear(); + CaelestraszGUID.Clear(); + FandralGUID.Clear(); + PlayerGUID.Clear(); eventEnd = false; } uint32 AnimationTimer; uint8 AnimationCount; - uint64 AnachronosQuestTriggerGUID; - uint64 MerithraGUID; - uint64 ArygosGUID; - uint64 CaelestraszGUID; - uint64 FandralGUID; - uint64 PlayerGUID; + ObjectGuid AnachronosQuestTriggerGUID; + ObjectGuid MerithraGUID; + ObjectGuid ArygosGUID; + ObjectGuid CaelestraszGUID; + ObjectGuid FandralGUID; + ObjectGuid PlayerGUID; bool eventEnd; void Reset() override @@ -485,7 +485,7 @@ public: Fandral->AI()->Talk(FANDRAL_SAY_1, me); break; case 2: - Fandral->SetTarget(0); + Fandral->SetTarget(ObjectGuid::Empty); Merithra->AI()->Talk(MERITHRA_EMOTE_1); break; case 3: @@ -502,7 +502,7 @@ public: Merithra->AI()->Talk(MERITHRA_SAY_2); break; case 7: - Caelestrasz->SetTarget(0); + Caelestrasz->SetTarget(ObjectGuid::Empty); Merithra->GetMotionMaster()->MoveCharge(-8065, 1530, 2.61f, 10); break; case 8: @@ -769,14 +769,14 @@ public: void Initialize() { - MobGUID = 0; - PlayerGUID = 0; + MobGUID.Clear(); + PlayerGUID.Clear(); Timers = false; hasTarget = false; } - uint64 MobGUID; - uint64 PlayerGUID; + ObjectGuid MobGUID; + ObjectGuid PlayerGUID; uint32 SpellTimer1, SpellTimer2, SpellTimer3, SpellTimer4; bool Timers; bool hasTarget; @@ -890,7 +890,7 @@ public: void Initialize() { - PlayerGUID = 0; + PlayerGUID.Clear(); WaveTimer = 2000; AnnounceTimer = 1000; @@ -902,7 +902,7 @@ public: Failed = false; } - uint64 PlayerGUID; + ObjectGuid PlayerGUID; uint32 WaveTimer; uint32 AnnounceTimer; diff --git a/src/server/scripts/Kalimdor/zone_tanaris.cpp b/src/server/scripts/Kalimdor/zone_tanaris.cpp index fce0608faaf..ec2fa7b398e 100644 --- a/src/server/scripts/Kalimdor/zone_tanaris.cpp +++ b/src/server/scripts/Kalimdor/zone_tanaris.cpp @@ -546,14 +546,14 @@ public: PostEventTimer = 1000; PhasePostEvent = 0; - TortaGUID = 0; + TortaGUID.Clear(); } uint32 CheckSpeechTimer; uint32 PostEventTimer; uint32 PhasePostEvent; - uint64 TortaGUID; + ObjectGuid TortaGUID; void Reset() override { diff --git a/src/server/scripts/Kalimdor/zone_the_barrens.cpp b/src/server/scripts/Kalimdor/zone_the_barrens.cpp index 03507c77efb..535253222e0 100644 --- a/src/server/scripts/Kalimdor/zone_the_barrens.cpp +++ b/src/server/scripts/Kalimdor/zone_the_barrens.cpp @@ -333,14 +333,14 @@ public: WaveTimer = 600000; ChallengerChecker = 0; Wave = 0; - PlayerGUID = 0; + PlayerGUID.Clear(); for (uint8 i = 0; i < 6; ++i) { - AffrayChallenger[i] = 0; + AffrayChallenger[i].Clear(); ChallengerDown[i] = false; } - BigWill = 0; + BigWill.Clear(); } bool EventInProgress; @@ -350,9 +350,9 @@ public: uint8 Wave; uint32 WaveTimer; uint32 ChallengerChecker; - uint64 PlayerGUID; - uint64 AffrayChallenger[6]; - uint64 BigWill; + ObjectGuid PlayerGUID; + ObjectGuid AffrayChallenger[6]; + ObjectGuid BigWill; void Reset() override { diff --git a/src/server/scripts/Kalimdor/zone_ungoro_crater.cpp b/src/server/scripts/Kalimdor/zone_ungoro_crater.cpp index ea4c743b8a5..9596f8a04f6 100644 --- a/src/server/scripts/Kalimdor/zone_ungoro_crater.cpp +++ b/src/server/scripts/Kalimdor/zone_ungoro_crater.cpp @@ -212,14 +212,14 @@ public: FaintTimer = urand(30000, 60000); EndEventProgress = 0; EndEventTimer = 1000; - SpraggleGUID = 0; + SpraggleGUID.Clear(); } uint32 FaintTimer; uint32 EndEventProgress; uint32 EndEventTimer; - uint64 SpraggleGUID; + ObjectGuid SpraggleGUID; void Reset() override { diff --git a/src/server/scripts/Kalimdor/zone_winterspring.cpp b/src/server/scripts/Kalimdor/zone_winterspring.cpp index 58d9b115398..ee73d9b27a9 100644 --- a/src/server/scripts/Kalimdor/zone_winterspring.cpp +++ b/src/server/scripts/Kalimdor/zone_winterspring.cpp @@ -318,11 +318,6 @@ public: DialogueHelper(introDialogue) { Initialize(); - _firstPriestessGUID = 0; - _secondPriestessGUID = 0; - _guardEluneGUID = 0; - _voiceEluneGUID = 0; - _altarGUID = 0; } void Initialize() @@ -332,11 +327,11 @@ public: uint32 _delayTimer; - uint64 _firstPriestessGUID; - uint64 _secondPriestessGUID; - uint64 _guardEluneGUID; - uint64 _voiceEluneGUID; - uint64 _altarGUID; + ObjectGuid _firstPriestessGUID; + ObjectGuid _secondPriestessGUID; + ObjectGuid _guardEluneGUID; + ObjectGuid _voiceEluneGUID; + ObjectGuid _altarGUID; void Reset() override { diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp index 7ae8730d57b..4cb401a6e16 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp @@ -107,8 +107,8 @@ public: if (!bFirstTime) instance->SetBossState(DATA_JEDOGA_SHADOWSEEKER, FAIL); - instance->SetData64(DATA_PL_JEDOGA_TARGET, 0); - instance->SetData64(DATA_ADD_JEDOGA_OPFER, 0); + instance->SetGuidData(DATA_PL_JEDOGA_TARGET, ObjectGuid::Empty); + instance->SetGuidData(DATA_ADD_JEDOGA_OPFER, ObjectGuid::Empty); instance->SetData(DATA_JEDOGA_RESET_INITIANDS, 0); MoveUp(); @@ -215,7 +215,7 @@ public: } else { - if (Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_PL_JEDOGA_TARGET))) + if (Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_PL_JEDOGA_TARGET))) { AttackStart(target); instance->SetData(DATA_JEDOGA_RESET_INITIANDS, 0); @@ -248,13 +248,14 @@ public: void OpferRufen() { - uint64 opfer = instance->GetData64(DATA_ADD_JEDOGA_INITIAND); + ObjectGuid opfer = instance->GetGuidData(DATA_ADD_JEDOGA_INITIAND); if (opfer) { Talk(TEXT_SACRIFICE_1); - instance->SetData64(DATA_ADD_JEDOGA_OPFER, opfer); - } else + instance->SetGuidData(DATA_ADD_JEDOGA_OPFER, opfer); + } + else bCanDown = true; } @@ -380,7 +381,7 @@ public: if (bWalking) { - if (Creature* boss = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_JEDOGA_SHADOWSEEKER))) + if (Creature* boss = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_JEDOGA_SHADOWSEEKER))) { if (!ENSURE_AI(boss_jedoga_shadowseeker::boss_jedoga_shadowseekerAI, boss->AI())->bOpFerok) ENSURE_AI(boss_jedoga_shadowseeker::boss_jedoga_shadowseekerAI, boss->AI())->bOpFerokFail = true; @@ -389,12 +390,12 @@ public: boss->AI()->DoAction(ACTION_INITIAND_KILLED); } - instance->SetData64(DATA_ADD_JEDOGA_OPFER, 0); + instance->SetGuidData(DATA_ADD_JEDOGA_OPFER, ObjectGuid::Empty); bWalking = false; } if (killer->GetTypeId() == TYPEID_PLAYER) - instance->SetData64(DATA_PL_JEDOGA_TARGET, killer->GetGUID()); + instance->SetGuidData(DATA_PL_JEDOGA_TARGET, killer->GetGUID()); } void EnterCombat(Unit* /*who*/) override @@ -427,7 +428,7 @@ public: { case 1: { - Creature* boss = me->GetMap()->GetCreature(instance->GetData64(DATA_JEDOGA_SHADOWSEEKER)); + Creature* boss = me->GetMap()->GetCreature(instance->GetGuidData(DATA_JEDOGA_SHADOWSEEKER)); if (boss) { ENSURE_AI(boss_jedoga_shadowseeker::boss_jedoga_shadowseekerAI, boss->AI())->bOpFerok = true; @@ -443,7 +444,7 @@ public: { if (bCheckTimer <= diff) { - if (me->GetGUID() == instance->GetData64(DATA_ADD_JEDOGA_OPFER) && !bWalking) + if (me->GetGUID() == instance->GetGuidData(DATA_ADD_JEDOGA_OPFER) && !bWalking) { me->RemoveAurasDueToSpell(SPELL_SPHERE_VISUAL); me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, false); diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp index 9cc8540342f..cf80f21d290 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp @@ -88,16 +88,14 @@ class boss_prince_taldaram : public CreatureScript boss_prince_taldaramAI(Creature* creature) : BossAI(creature, DATA_PRINCE_TALDARAM) { me->SetDisableGravity(true); - _flameSphereTargetGUID = 0; - _embraceTargetGUID = 0; _embraceTakenDamage = 0; } void Reset() override { _Reset(); - _flameSphereTargetGUID = 0; - _embraceTargetGUID = 0; + _flameSphereTargetGUID.Clear(); + _embraceTargetGUID.Clear(); _embraceTakenDamage = 0; } @@ -194,7 +192,7 @@ class boss_prince_taldaram : public CreatureScript events.ScheduleEvent(EVENT_FEEDING, 20000); break; case EVENT_FEEDING: - _embraceTargetGUID = 0; + _embraceTargetGUID.Clear(); break; default: break; @@ -213,7 +211,7 @@ class boss_prince_taldaram : public CreatureScript _embraceTakenDamage += damage; if (_embraceTakenDamage > DUNGEON_MODE<uint32>(DATA_EMBRACE_DMG, H_DATA_EMBRACE_DMG)) { - _embraceTargetGUID = 0; + _embraceTargetGUID.Clear(); me->CastStop(); } } @@ -231,7 +229,7 @@ class boss_prince_taldaram : public CreatureScript return; if (victim->GetGUID() == _embraceTargetGUID) - _embraceTargetGUID = 0; + _embraceTargetGUID.Clear(); Talk(SAY_SLAY); } @@ -263,12 +261,12 @@ class boss_prince_taldaram : public CreatureScript me->SetDisableGravity(false); me->GetMotionMaster()->MoveLand(0, me->GetHomePosition()); Talk(SAY_WARNING); - instance->HandleGameObject(instance->GetData64(DATA_PRINCE_TALDARAM_PLATFORM), true); + instance->HandleGameObject(instance->GetGuidData(DATA_PRINCE_TALDARAM_PLATFORM), true); } private: - uint64 _flameSphereTargetGUID; - uint64 _embraceTargetGUID; + ObjectGuid _flameSphereTargetGUID; + ObjectGuid _embraceTargetGUID; uint32 _embraceTakenDamage; }; @@ -288,7 +286,6 @@ class npc_prince_taldaram_flame_sphere : public CreatureScript { npc_prince_taldaram_flame_sphereAI(Creature* creature) : ScriptedAI(creature) { - _flameSphereTargetGUID = 0; } void Reset() override @@ -296,13 +293,13 @@ class npc_prince_taldaram_flame_sphere : public CreatureScript DoCast(me, SPELL_FLAME_SPHERE_SPAWN_EFFECT, true); DoCast(me, SPELL_FLAME_SPHERE_VISUAL, true); - _flameSphereTargetGUID = 0; + _flameSphereTargetGUID.Clear(); _events.Reset(); _events.ScheduleEvent(EVENT_START_MOVE, 3 * IN_MILLISECONDS); _events.ScheduleEvent(EVENT_DESPAWN, 13 * IN_MILLISECONDS); } - void SetGUID(uint64 guid, int32 /*id = 0*/) override + void SetGUID(ObjectGuid guid, int32 /*id = 0*/) override { _flameSphereTargetGUID = guid; } @@ -364,7 +361,7 @@ class npc_prince_taldaram_flame_sphere : public CreatureScript private: EventMap _events; - uint64 _flameSphereTargetGUID; + ObjectGuid _flameSphereTargetGUID; }; CreatureAI* GetAI(Creature* creature) const override @@ -385,7 +382,7 @@ class go_prince_taldaram_sphere : public GameObjectScript if (!instance) return false; - Creature* PrinceTaldaram = ObjectAccessor::GetCreature(*go, instance->GetData64(DATA_PRINCE_TALDARAM)); + Creature* PrinceTaldaram = ObjectAccessor::GetCreature(*go, instance->GetGuidData(DATA_PRINCE_TALDARAM)); if (PrinceTaldaram && PrinceTaldaram->IsAlive()) { go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp index 7c9ed240959..0bb2010a9d6 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp @@ -39,21 +39,10 @@ class instance_ahnkahet : public InstanceMapScript SetBossNumber(EncounterCount); LoadDoorData(doorData); - ElderNadoxGUID = 0; - PrinceTaldaramGUID = 0; - JedogaShadowseekerGUID = 0; - AmanitarGUID = 0; - HeraldVolazjGUID = 0; - - PrinceTaldaramPlatformGUID = 0; - JedogaSacrifices = 0; - JedogaTarget = 0; SwitchTrigger = 0; SpheresState[0] = 0; SpheresState[1] = 0; - - InitiandGUIDs.clear(); } void OnCreatureCreate(Creature* creature) override @@ -90,7 +79,7 @@ class instance_ahnkahet : public InstanceMapScript case GO_PRINCE_TALDARAM_PLATFORM: PrinceTaldaramPlatformGUID = go->GetGUID(); if (GetBossState(DATA_PRINCE_TALDARAM) == DONE) - HandleGameObject(0, true, go); + HandleGameObject(ObjectGuid::Empty, true, go); break; case GO_SPHERE_1: if (SpheresState[0]) @@ -142,7 +131,7 @@ class instance_ahnkahet : public InstanceMapScript SwitchTrigger = data; break; case DATA_JEDOGA_RESET_INITIANDS: - for (uint64 guid : InitiandGUIDs) + for (ObjectGuid guid : InitiandGUIDs) { if (Creature* creature = instance->GetCreature(guid)) { @@ -165,7 +154,7 @@ class instance_ahnkahet : public InstanceMapScript case DATA_SPHERE_2: return SpheresState[type - DATA_SPHERE_1]; case DATA_ALL_INITIAND_DEAD: - for (uint64 guid : InitiandGUIDs) + for (ObjectGuid guid : InitiandGUIDs) { Creature* cr = instance->GetCreature(guid); if (!cr || cr->IsAlive()) @@ -180,7 +169,7 @@ class instance_ahnkahet : public InstanceMapScript return 0; } - void SetData64(uint32 type, uint64 data) override + void SetGuidData(uint32 type, ObjectGuid data) override { switch (type) { @@ -195,7 +184,7 @@ class instance_ahnkahet : public InstanceMapScript } } - uint64 GetData64(uint32 type) const override + ObjectGuid GetGuidData(uint32 type) const override { switch (type) { @@ -213,16 +202,16 @@ class instance_ahnkahet : public InstanceMapScript return PrinceTaldaramPlatformGUID; case DATA_ADD_JEDOGA_INITIAND: { - std::vector<uint64> vInitiands; - vInitiands.clear(); - for (uint64 guid : InitiandGUIDs) + GuidVector vInitiands; + vInitiands.reserve(InitiandGUIDs.size()); + for (ObjectGuid guid : InitiandGUIDs) { Creature* cr = instance->GetCreature(guid); if (cr && cr->IsAlive()) vInitiands.push_back(guid); } if (vInitiands.empty()) - return 0; + return ObjectGuid::Empty; return Trinity::Containers::SelectRandomContainerElement(vInitiands); } @@ -233,7 +222,7 @@ class instance_ahnkahet : public InstanceMapScript default: break; } - return 0; + return ObjectGuid::Empty; } bool SetBossState(uint32 type, EncounterState state) override @@ -246,11 +235,9 @@ class instance_ahnkahet : public InstanceMapScript case DATA_JEDOGA_SHADOWSEEKER: if (state == DONE) { - for (uint64 guid : InitiandGUIDs) - { + for (ObjectGuid guid : InitiandGUIDs) if (Creature* cr = instance->GetCreature(guid)) cr->DespawnOrUnsummon(); - } } break; default: @@ -271,17 +258,17 @@ class instance_ahnkahet : public InstanceMapScript } protected: - uint64 ElderNadoxGUID; - uint64 PrinceTaldaramGUID; - uint64 JedogaShadowseekerGUID; - uint64 AmanitarGUID; - uint64 HeraldVolazjGUID; + ObjectGuid ElderNadoxGUID; + ObjectGuid PrinceTaldaramGUID; + ObjectGuid JedogaShadowseekerGUID; + ObjectGuid AmanitarGUID; + ObjectGuid HeraldVolazjGUID; - uint64 PrinceTaldaramPlatformGUID; - uint64 JedogaSacrifices; - uint64 JedogaTarget; + ObjectGuid PrinceTaldaramPlatformGUID; + ObjectGuid JedogaSacrifices; + ObjectGuid JedogaTarget; - std::set<uint64> InitiandGUIDs; + GuidSet InitiandGUIDs; uint32 SpheresState[2]; uint8 SwitchTrigger; diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp index 49d0840f08a..1d437fb18a5 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp @@ -96,7 +96,6 @@ public: VenomancerTimer = 0; DatterTimer = 0; DelayTimer = 0; - ImpaleTarget = 0; } void Initialize() @@ -110,6 +109,7 @@ public: UndergroundPhase = 0; Channeling = false; ImpalePhase = IMPALE_PHASE_TARGET; + ImpaleTarget.Clear(); } InstanceScript* instance; @@ -130,7 +130,7 @@ public: uint32 ImpaleTimer; uint32 ImpalePhase; - uint64 ImpaleTarget; + ObjectGuid ImpaleTarget; SummonList Summons; diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp index 00aa2120225..0982ea20f00 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp @@ -441,7 +441,7 @@ class npc_watcher_gashra : public CreatureScript void JustDied(Unit* /*killer*/) override { - Creature* krikthir = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_KRIKTHIR_THE_GATEWATCHER)); + Creature* krikthir = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_KRIKTHIR_THE_GATEWATCHER)); if (krikthir && krikthir->IsAlive()) krikthir->AI()->Talk(SAY_PREFIGHT); } @@ -514,7 +514,7 @@ class npc_watcher_narjil : public CreatureScript void JustDied(Unit* /*killer*/) override { - Creature* krikthir = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_KRIKTHIR_THE_GATEWATCHER)); + Creature* krikthir = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_KRIKTHIR_THE_GATEWATCHER)); if (krikthir && krikthir->IsAlive()) krikthir->AI()->Talk(SAY_PREFIGHT); } @@ -591,7 +591,7 @@ class npc_watcher_silthik : public CreatureScript void JustDied(Unit* /*killer*/) override { - Creature* krikthir = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_KRIKTHIR_THE_GATEWATCHER)); + Creature* krikthir = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_KRIKTHIR_THE_GATEWATCHER)); if (krikthir && krikthir->IsAlive()) krikthir->AI()->Talk(SAY_PREFIGHT); } @@ -660,7 +660,7 @@ class achievement_watch_him_die : public AchievementCriteriaScript for (uint8 n = 0; n < 3; ++n) { - if (Creature* watcher = ObjectAccessor::GetCreature(*target, instance->GetData64(DATA_WATCHER_GASHRA + n))) + if (Creature* watcher = ObjectAccessor::GetCreature(*target, instance->GetGuidData(DATA_WATCHER_GASHRA + n))) if (!watcher->IsAlive()) return false; } diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp index 1ae68f5a33e..0cb34f7b1d2 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp @@ -40,13 +40,6 @@ class instance_azjol_nerub : public InstanceMapScript SetHeaders(DataHeader); SetBossNumber(EncounterCount); LoadDoorData(doorData); - - KrikthirGUID = 0; - HadronoxGUID = 0; - AnubarakGUID = 0; - WatcherGashraGUID = 0; - WatcherSilthikGUID = 0; - WatcherNarjilGUID = 0; } void OnCreatureCreate(Creature* creature) override @@ -106,7 +99,7 @@ class instance_azjol_nerub : public InstanceMapScript } } - uint64 GetData64(uint32 type) const override + ObjectGuid GetGuidData(uint32 type) const override { switch (type) { @@ -126,16 +119,16 @@ class instance_azjol_nerub : public InstanceMapScript break; } - return 0; + return ObjectGuid::Empty; } protected: - uint64 KrikthirGUID; - uint64 HadronoxGUID; - uint64 AnubarakGUID; - uint64 WatcherGashraGUID; - uint64 WatcherSilthikGUID; - uint64 WatcherNarjilGUID; + ObjectGuid KrikthirGUID; + ObjectGuid HadronoxGUID; + ObjectGuid AnubarakGUID; + ObjectGuid WatcherGashraGUID; + ObjectGuid WatcherSilthikGUID; + ObjectGuid WatcherNarjilGUID; }; InstanceScript* GetInstanceScript(InstanceMap* map) const override diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp index 77ced6acef1..6afb56316b3 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp @@ -184,15 +184,15 @@ public: Talk(SAY_SARTHARION_DEATH); _JustDied(); - if (Creature* tenebron = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TENEBRON))) + if (Creature* tenebron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TENEBRON))) if (tenebron->IsAlive()) tenebron->DisappearAndDie(); - if (Creature* shadron = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADRON))) + if (Creature* shadron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SHADRON))) if (shadron->IsAlive()) shadron->DisappearAndDie(); - if (Creature* vesperon = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VESPERON))) + if (Creature* vesperon = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VESPERON))) if (vesperon->IsAlive()) vesperon->DisappearAndDie(); } @@ -217,7 +217,7 @@ public: void DrakeRespawn() // Drakes respawning system { - if (Creature* tenebron = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TENEBRON))) + if (Creature* tenebron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TENEBRON))) { tenebron->SetHomePosition(3239.07f, 657.235f, 86.8775f, 4.74729f); if (tenebron->IsAlive()) @@ -237,7 +237,7 @@ public: } } - if (Creature* shadron = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADRON))) + if (Creature* shadron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SHADRON))) { shadron->SetHomePosition(3363.06f, 525.28f, 98.362f, 4.76475f); if (shadron->IsAlive()) @@ -257,7 +257,7 @@ public: } } - if (Creature* vesperon = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VESPERON))) + if (Creature* vesperon = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VESPERON))) { vesperon->SetHomePosition(3145.68f, 520.71f, 89.7f, 4.64258f); if (vesperon->IsAlive()) @@ -286,7 +286,7 @@ public: //if at least one of the dragons are alive and are being called bool _canUseWill = false; - if (Creature* fetchTene = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TENEBRON))) + if (Creature* fetchTene = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TENEBRON))) { if (fetchTene->IsAlive() && !fetchTene->GetVictim()) { @@ -304,7 +304,7 @@ public: } } - if (Creature* fetchShad = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADRON))) + if (Creature* fetchShad = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SHADRON))) { if (fetchShad->IsAlive() && !fetchShad->GetVictim()) { @@ -322,7 +322,7 @@ public: } } - if (Creature* fetchVesp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VESPERON))) + if (Creature* fetchVesp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VESPERON))) { if (fetchVesp && fetchVesp->IsAlive() && !fetchVesp->GetVictim()) { @@ -346,7 +346,7 @@ public: void CallDragon(uint32 dataId) { - if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(dataId))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(dataId))) { if (temp->IsAlive() && !temp->GetVictim()) { diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp index 5e4a31d6b5e..9f55ca8dc17 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp @@ -35,10 +35,6 @@ public: void Initialize() override { SetHeaders(DataHeader); - sartharionGUID = 0; - tenebronGUID = 0; - shadronGUID = 0; - vesperonGUID = 0; } void OnCreatureCreate(Creature* creature) override @@ -83,7 +79,7 @@ public: return true; } - uint64 GetData64(uint32 Data) const override + ObjectGuid GetGuidData(uint32 Data) const override { switch (Data) { @@ -96,14 +92,14 @@ public: case DATA_VESPERON: return vesperonGUID; } - return 0; + return ObjectGuid::Empty; } protected: - uint64 sartharionGUID; - uint64 tenebronGUID; - uint64 shadronGUID; - uint64 vesperonGUID; + ObjectGuid sartharionGUID; + ObjectGuid tenebronGUID; + ObjectGuid shadronGUID; + ObjectGuid vesperonGUID; }; InstanceScript* GetInstanceScript(InstanceMap* map) const override diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp index 58d7c6141b4..f4ef869b0b4 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp @@ -359,7 +359,7 @@ struct dummy_dragonAI : public ScriptedAI return; // Twilight Revenge to main boss - if (Unit* sartharion = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_SARTHARION))) + if (Unit* sartharion = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_SARTHARION))) if (sartharion->IsAlive()) { sartharion->RemoveAurasDueToSpell(spellId); @@ -635,12 +635,12 @@ class npc_acolyte_of_shadron : public CreatureScript //if not solo fight, buff main boss, else place debuff on mini-boss. both spells TARGET_SCRIPT if (instance->GetBossState(DATA_SARTHARION) == IN_PROGRESS) { - if (Creature* sartharion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SARTHARION))) + if (Creature* sartharion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SARTHARION))) sartharion->AddAura(SPELL_GIFT_OF_TWILIGTH_SAR, sartharion); } else { - if (Creature* shadron = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADRON))) + if (Creature* shadron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SHADRON))) shadron->AddAura(SPELL_GIFT_OF_TWILIGTH_SHA, shadron); } @@ -649,7 +649,7 @@ class npc_acolyte_of_shadron : public CreatureScript void JustDied(Unit* /*killer*/) override { - if (ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADRON))) + if (ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SHADRON))) instance->SetBossState(DATA_PORTAL_OPEN, NOT_STARTED); Map* map = me->GetMap(); @@ -662,7 +662,7 @@ class npc_acolyte_of_shadron : public CreatureScript for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { - if (i->GetSource()->IsAlive() && i->GetSource()->HasAura(SPELL_TWILIGHT_SHIFT, 0) && !i->GetSource()->GetVictim()) + if (i->GetSource()->IsAlive() && i->GetSource()->HasAura(SPELL_TWILIGHT_SHIFT) && !i->GetSource()->GetVictim()) { i->GetSource()->CastSpell(i->GetSource(), SPELL_TWILIGHT_SHIFT_REMOVAL_ALL, true); i->GetSource()->CastSpell(i->GetSource(), SPELL_TWILIGHT_RESIDUE, true); @@ -673,12 +673,12 @@ class npc_acolyte_of_shadron : public CreatureScript } // not solo fight, so main boss has debuff - if (Creature* debuffTarget = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SARTHARION))) + if (Creature* debuffTarget = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SARTHARION))) if (debuffTarget->IsAlive() && debuffTarget->HasAura(SPELL_GIFT_OF_TWILIGTH_SAR)) debuffTarget->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SAR); // event not in progress, then solo fight and must remove debuff mini-boss - if (Creature* debuffTarget = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADRON))) + if (Creature* debuffTarget = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SHADRON))) if (debuffTarget->IsAlive() && debuffTarget->HasAura(SPELL_GIFT_OF_TWILIGTH_SHA)) debuffTarget->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SHA); } @@ -732,7 +732,7 @@ class npc_acolyte_of_vesperon : public CreatureScript me->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP_ACO); // remove twilight torment on Vesperon - if (Creature* vesperon = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VESPERON))) + if (Creature* vesperon = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VESPERON))) { instance->SetBossState(DATA_PORTAL_OPEN, NOT_STARTED); @@ -750,14 +750,14 @@ class npc_acolyte_of_vesperon : public CreatureScript for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { - if (i->GetSource()->IsAlive() && i->GetSource()->HasAura(SPELL_TWILIGHT_SHIFT, 0) && !i->GetSource()->GetVictim()) + if (i->GetSource()->IsAlive() && i->GetSource()->HasAura(SPELL_TWILIGHT_SHIFT) && !i->GetSource()->GetVictim()) { i->GetSource()->CastSpell(i->GetSource(), SPELL_TWILIGHT_SHIFT_REMOVAL_ALL, true); i->GetSource()->CastSpell(i->GetSource(), SPELL_TWILIGHT_RESIDUE, true); i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT); i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT_ENTER); } - if (i->GetSource()->IsAlive() && i->GetSource()->HasAura(SPELL_TWILIGHT_TORMENT_VESP, 0) && !i->GetSource()->GetVictim()) + if (i->GetSource()->IsAlive() && i->GetSource()->HasAura(SPELL_TWILIGHT_TORMENT_VESP) && !i->GetSource()->GetVictim()) i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP); } } @@ -836,7 +836,7 @@ public: if (events.ExecuteEvent() == EVENT_TWILIGHT_EGGS) { - if (ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TENEBRON))) + if (ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TENEBRON))) instance->SetBossState(DATA_PORTAL_OPEN, NOT_STARTED); SpawnWhelps(); diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp index 4e02b3ad2e8..c826b8fc9ef 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp @@ -132,7 +132,7 @@ class boss_baltharus_the_warborn : public CreatureScript { _JustDied(); Talk(SAY_DEATH); - if (Creature* xerestrasza = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_XERESTRASZA))) + if (Creature* xerestrasza = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_XERESTRASZA))) xerestrasza->AI()->DoAction(ACTION_BALTHARUS_DEATH); } @@ -190,7 +190,7 @@ class boss_baltharus_the_warborn : public CreatureScript Talk(SAY_BALTHARUS_INTRO); break; case EVENT_OOC_CHANNEL: - if (Creature* channelTarget = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_CRYSTAL_CHANNEL_TARGET))) + if (Creature* channelTarget = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_CRYSTAL_CHANNEL_TARGET))) DoCast(channelTarget, SPELL_BARRIER_CHANNEL); events.ScheduleEvent(EVENT_OOC_CHANNEL, 7000, 0, PHASE_INTRO); break; @@ -258,7 +258,7 @@ class npc_baltharus_the_warborn_clone : public CreatureScript void JustDied(Unit* killer) override { // This is here because DamageTaken wont trigger if the damage is deadly. - if (Creature* baltharus = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_BALTHARUS_THE_WARBORN))) + if (Creature* baltharus = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_BALTHARUS_THE_WARBORN))) killer->Kill(baltharus); } diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp index e41ea8de38b..f4e36b87f7d 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp @@ -163,10 +163,10 @@ class boss_general_zarithrian : public CreatureScript { case EVENT_SUMMON_ADDS: { - if (Creature* stalker1 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ZARITHRIAN_SPAWN_STALKER_1))) + if (Creature* stalker1 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ZARITHRIAN_SPAWN_STALKER_1))) stalker1->CastSpell(stalker1, SPELL_SUMMON_FLAMECALLER, false); - if (Creature* stalker2 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ZARITHRIAN_SPAWN_STALKER_2))) + if (Creature* stalker2 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ZARITHRIAN_SPAWN_STALKER_2))) stalker2->CastSpell(stalker2, SPELL_SUMMON_FLAMECALLER, false); Talk(SAY_ADDS); @@ -236,7 +236,7 @@ class npc_onyx_flamecaller : public CreatureScript void IsSummonedBy(Unit* /*summoner*/) override { // Let Zarithrian count as summoner. - if (Creature* zarithrian = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_GENERAL_ZARITHRIAN))) + if (Creature* zarithrian = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_GENERAL_ZARITHRIAN))) zarithrian->AI()->JustSummoned(me); } diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp index 9d44e7d884f..5a1e2adfe06 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp @@ -267,7 +267,7 @@ struct generic_halionAI : public BossAI // Rough radius, it is not an exactly perfect circle if (me->GetDistance2d(HalionControllerSpawnPos.GetPositionX(), HalionControllerSpawnPos.GetPositionY()) > 48.5f) { - if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER))) + if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HALION_CONTROLLER))) controller->AI()->EnterEvadeMode(); return false; } @@ -352,7 +352,7 @@ class boss_halion : public CreatureScript events.ScheduleEvent(EVENT_METEOR_STRIKE, urand(20000, 25000)); events.ScheduleEvent(EVENT_FIERY_COMBUSTION, urand(15000, 18000)); - if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER))) + if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HALION_CONTROLLER))) controller->AI()->SetData(DATA_FIGHT_PHASE, PHASE_ONE); } @@ -363,11 +363,11 @@ class boss_halion : public CreatureScript Talk(SAY_DEATH); instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); - if (Creature* twilightHalion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TWILIGHT_HALION))) + if (Creature* twilightHalion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TWILIGHT_HALION))) if (twilightHalion->IsAlive()) twilightHalion->Kill(twilightHalion); - if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER))) + if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HALION_CONTROLLER))) if (controller->IsAlive()) controller->Kill(controller); } @@ -385,7 +385,7 @@ class boss_halion : public CreatureScript me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); DoCast(me, SPELL_TWILIGHT_PHASING); - if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER))) + if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HALION_CONTROLLER))) controller->AI()->SetData(DATA_FIGHT_PHASE, PHASE_TWO); return; } @@ -396,7 +396,7 @@ class boss_halion : public CreatureScript if (!me->InSamePhase(attacker)) return; - if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER))) + if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HALION_CONTROLLER))) controller->AI()->SetData(DATA_MATERIAL_DAMAGE_TAKEN, damage); } } @@ -416,8 +416,8 @@ class boss_halion : public CreatureScript case EVENT_ACTIVATE_FIREWALL: // Flame ring is activated 5 seconds after starting encounter, DOOR_TYPE_ROOM is only instant. for (uint8 i = DATA_FLAME_RING; i <= DATA_TWILIGHT_FLAME_RING; ++i) - if (GameObject* flameRing = ObjectAccessor::GetGameObject(*me, instance->GetData64(i))) - instance->HandleGameObject(instance->GetData64(DATA_FLAME_RING), false, flameRing); + if (GameObject* flameRing = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(i))) + instance->HandleGameObject(instance->GetGuidData(DATA_FLAME_RING), false, flameRing); break; case EVENT_METEOR_STRIKE: { @@ -476,7 +476,7 @@ class boss_twilight_halion : public CreatureScript { boss_twilight_halionAI(Creature* creature) : generic_halionAI(creature, DATA_TWILIGHT_HALION) { - Creature* halion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION)); + Creature* halion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HALION)); if (!halion) return; @@ -516,7 +516,7 @@ class boss_twilight_halion : public CreatureScript void JustDied(Unit* killer) override { - if (Creature* halion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION))) + if (Creature* halion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HALION))) { // Ensure looting if (me->IsDamageEnoughForLootingAndReward()) @@ -526,7 +526,7 @@ class boss_twilight_halion : public CreatureScript killer->Kill(halion); } - if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER))) + if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HALION_CONTROLLER))) if (controller->IsAlive()) controller->Kill(controller); @@ -550,7 +550,7 @@ class boss_twilight_halion : public CreatureScript if (!me->InSamePhase(attacker)) return; - if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER))) + if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HALION_CONTROLLER))) controller->AI()->SetData(DATA_TWILIGHT_DAMAGE_TAKEN, damage); } } @@ -560,7 +560,7 @@ class boss_twilight_halion : public CreatureScript switch (spell->Id) { case SPELL_TWILIGHT_DIVISION: - if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER))) + if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HALION_CONTROLLER))) controller->AI()->DoAction(ACTION_MONITOR_CORPOREALITY); break; default: @@ -644,10 +644,10 @@ class npc_halion_controller : public CreatureScript void JustReachedHome() override { - if (Creature* twilightHalion = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_TWILIGHT_HALION))) + if (Creature* twilightHalion = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_TWILIGHT_HALION))) twilightHalion->DespawnOrUnsummon(); - if (Creature* halion = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_HALION))) + if (Creature* halion = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_HALION))) { halion->AI()->SetData(DATA_EVADE_METHOD, 1); halion->AI()->EnterEvadeMode(); @@ -669,7 +669,7 @@ class npc_halion_controller : public CreatureScript { for (uint8 itr = DATA_HALION; itr <= DATA_TWILIGHT_HALION; itr++) { - Creature* halion = ObjectAccessor::GetCreature(*me, _instance->GetData64(itr)); + Creature* halion = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(itr)); if (!halion) continue; @@ -721,14 +721,14 @@ class npc_halion_controller : public CreatureScript break; case EVENT_INTRO_PROGRESS_1: for (uint8 i = DATA_BURNING_TREE_3; i <= DATA_BURNING_TREE_4; ++i) - if (GameObject* tree = ObjectAccessor::GetGameObject(*me, _instance->GetData64(i))) - _instance->HandleGameObject(_instance->GetData64(i), true, tree); + if (GameObject* tree = ObjectAccessor::GetGameObject(*me, _instance->GetGuidData(i))) + _instance->HandleGameObject(_instance->GetGuidData(i), true, tree); _events.ScheduleEvent(EVENT_INTRO_PROGRESS_2, 4000); break; case EVENT_INTRO_PROGRESS_2: for (uint8 i = DATA_BURNING_TREE_1; i <= DATA_BURNING_TREE_2; ++i) - if (GameObject* tree = ObjectAccessor::GetGameObject(*me, _instance->GetData64(i))) - _instance->HandleGameObject(_instance->GetData64(i), true, tree); + if (GameObject* tree = ObjectAccessor::GetGameObject(*me, _instance->GetGuidData(i))) + _instance->HandleGameObject(_instance->GetGuidData(i), true, tree); _events.ScheduleEvent(EVENT_INTRO_PROGRESS_3, 4000); break; case EVENT_INTRO_PROGRESS_3: @@ -737,20 +737,20 @@ class npc_halion_controller : public CreatureScript halion->AI()->Talk(SAY_INTRO); break; case EVENT_TWILIGHT_MENDING: - if (ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_HALION))) // Just check if physical Halion is spawned - if (Creature* twilightHalion = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_TWILIGHT_HALION))) + if (ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_HALION))) // Just check if physical Halion is spawned + if (Creature* twilightHalion = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_TWILIGHT_HALION))) twilightHalion->CastSpell((Unit*)NULL, SPELL_TWILIGHT_MENDING, true); break; case EVENT_TRIGGER_BERSERK: for (uint8 i = DATA_HALION; i <= DATA_TWILIGHT_HALION; i++) - if (Creature* halion = ObjectAccessor::GetCreature(*me, _instance->GetData64(i))) + if (Creature* halion = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(i))) halion->CastSpell(halion, SPELL_BERSERK, true); break; case EVENT_SHADOW_PULSARS_SHOOT: - if (Creature* twilightHalion = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_TWILIGHT_HALION))) + if (Creature* twilightHalion = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_TWILIGHT_HALION))) twilightHalion->AI()->Talk(SAY_SPHERE_PULSE); - if (Creature* orbCarrier = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_ORB_CARRIER))) + if (Creature* orbCarrier = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_ORB_CARRIER))) orbCarrier->AI()->DoAction(ACTION_SHOOT); _events.ScheduleEvent(EVENT_SHADOW_PULSARS_SHOOT, 29000); @@ -861,7 +861,7 @@ class npc_halion_controller : public CreatureScript for (uint8 itr = DATA_HALION; itr <= DATA_TWILIGHT_HALION; itr++) { - if (Creature* halion = ObjectAccessor::GetCreature(*me, _instance->GetData64(itr))) + if (Creature* halion = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(itr))) { halion->CastSpell(halion, GetSpell(_materialCorporealityValue, itr == DATA_TWILIGHT_HALION), true); @@ -921,7 +921,7 @@ class npc_orb_carrier : public CreatureScript /// we are having two creatures involded here. This attribute is handled clientside, meaning the client /// sends orientation update itself. Here, no packet is sent, and the creature does not rotate. By /// forcing the carrier to always be facing the rotation focus, we ensure everything works as it should. - if (Creature* rotationFocus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ORB_ROTATION_FOCUS))) + if (Creature* rotationFocus = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ORB_ROTATION_FOCUS))) me->SetFacingToObject(rotationFocus); // setInFront } @@ -998,7 +998,7 @@ class npc_meteor_strike_initial : public CreatureScript return; // Let Halion Controller count as summoner - if (Creature* controller = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_HALION_CONTROLLER))) + if (Creature* controller = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_HALION_CONTROLLER))) controller->AI()->JustSummoned(me); DoCast(me, SPELL_METEOR_STRIKE_COUNTDOWN); @@ -1067,7 +1067,7 @@ class npc_meteor_strike : public CreatureScript void IsSummonedBy(Unit* /*summoner*/) override { // Let Halion Controller count as summoner. - if (Creature* controller = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_HALION_CONTROLLER))) + if (Creature* controller = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_HALION_CONTROLLER))) controller->AI()->JustSummoned(me); } @@ -1084,7 +1084,7 @@ class npc_meteor_strike : public CreatureScript if (Creature* flame = me->SummonCreature(NPC_METEOR_STRIKE_FLAME, pos, TEMPSUMMON_TIMED_DESPAWN, 25000)) { - if (Creature* controller = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_HALION_CONTROLLER))) + if (Creature* controller = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_HALION_CONTROLLER))) controller->AI()->JustSummoned(flame); flame->CastSpell(flame, SPELL_METEOR_STRIKE_FIRE_AURA_2, true); @@ -1116,7 +1116,7 @@ class npc_combustion_consumption : public CreatureScript struct npc_combustion_consumptionAI : public ScriptedAI { npc_combustion_consumptionAI(Creature* creature) : ScriptedAI(creature), - _instance(creature->GetInstanceScript()), _summonerGuid(0) + _instance(creature->GetInstanceScript()) { SetCombatMovement(false); @@ -1145,7 +1145,7 @@ class npc_combustion_consumption : public CreatureScript void IsSummonedBy(Unit* summoner) override { // Let Halion Controller count as summoner - if (Creature* controller = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_HALION_CONTROLLER))) + if (Creature* controller = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_HALION_CONTROLLER))) controller->AI()->JustSummoned(me); _summonerGuid = summoner->GetGUID(); @@ -1171,7 +1171,7 @@ class npc_combustion_consumption : public CreatureScript InstanceScript* _instance; uint32 _explosionSpell; uint32 _damageSpell; - uint64 _summonerGuid; + ObjectGuid _summonerGuid; }; CreatureAI* GetAI(Creature* creature) const override @@ -1195,7 +1195,7 @@ class npc_living_inferno : public CreatureScript me->CastSpell(me, SPELL_BLAZING_AURA, true); if (InstanceScript* instance = me->GetInstanceScript()) - if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER))) + if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HALION_CONTROLLER))) controller->AI()->JustSummoned(me); } @@ -1244,7 +1244,7 @@ class npc_living_ember : public CreatureScript void IsSummonedBy(Unit* /*summoner*/) override { if (InstanceScript* instance = me->GetInstanceScript()) - if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER))) + if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HALION_CONTROLLER))) controller->AI()->JustSummoned(me); } @@ -1394,7 +1394,7 @@ class spell_halion_combustion_consumption : public SpellScriptLoader return; if (GetTarget()->HasAura(_markSpell)) - GetTarget()->RemoveAurasDueToSpell(_markSpell, 0, 0, AURA_REMOVE_BY_EXPIRE); + GetTarget()->RemoveAurasDueToSpell(_markSpell, ObjectGuid::Empty, 0, AURA_REMOVE_BY_EXPIRE); } void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) @@ -1455,7 +1455,7 @@ class spell_halion_marks : public SpellScriptLoader if (Unit* dispelledUnit = GetUnitOwner()) if (dispelledUnit->HasAura(_removeSpellId)) - dispelledUnit->RemoveAurasDueToSpell(_removeSpellId, 0, 0, AURA_REMOVE_BY_EXPIRE); + dispelledUnit->RemoveAurasDueToSpell(_removeSpellId, ObjectGuid::Empty, 0, AURA_REMOVE_BY_EXPIRE); } void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) @@ -1558,7 +1558,7 @@ class spell_halion_twilight_realm_handlers : public SpellScriptLoader if (!target) return; - target->RemoveAurasDueToSpell(_beforeHitSpellId, 0, 0, AURA_REMOVE_BY_ENEMY_SPELL); + target->RemoveAurasDueToSpell(_beforeHitSpellId, ObjectGuid::Empty, 0, AURA_REMOVE_BY_ENEMY_SPELL); if (InstanceScript* instance = target->GetInstanceScript()) instance->SendEncounterUnit(ENCOUNTER_FRAME_UNK7); } @@ -1654,7 +1654,7 @@ class spell_halion_twilight_cutter : public SpellScriptLoader return; Unit* caster = GetCaster(); - if (Unit* channelTarget = ObjectAccessor::GetUnit(*caster, caster->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT))) + if (Unit* channelTarget = ObjectAccessor::GetUnit(*caster, caster->GetChannelObjectGuid())) { unitList.remove_if(TwilightCutterSelector(caster, channelTarget)); return; diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp index be756a8ab36..98aed37a1d2 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp @@ -41,28 +41,12 @@ class instance_ruby_sanctum : public InstanceMapScript SetHeaders(DataHeader); SetBossNumber(EncounterCount); LoadDoorData(doorData); - BaltharusTheWarbornGUID = 0; - GeneralZarithrianGUID = 0; - SavianaRagefireGUID = 0; - HalionGUID = 0; - TwilightHalionGUID = 0; - OrbCarrierGUID = 0; - OrbRotationFocusGUID = 0; - HalionControllerGUID = 0; - CrystalChannelTargetGUID = 0; - XerestraszaGUID = 0; BaltharusSharedHealth = 0; - FlameWallsGUID = 0; - FlameRingGUID = 0; - TwilightFlameRingGUID = 0; - - memset(ZarithrianSpawnStalkerGUID, 0, 2 * sizeof(uint64)); - memset(BurningTreeGUID, 0, 4 * sizeof(uint64)); } void OnPlayerEnter(Player* /*player*/) { - if (!GetData64(DATA_HALION_CONTROLLER) && GetBossState(DATA_HALION) != DONE && GetBossState(DATA_GENERAL_ZARITHRIAN) == DONE) + if (!GetGuidData(DATA_HALION_CONTROLLER) && GetBossState(DATA_HALION) != DONE && GetBossState(DATA_GENERAL_ZARITHRIAN) == DONE) { instance->LoadGrid(HalionControllerSpawnPos.GetPositionX(), HalionControllerSpawnPos.GetPositionY()); if (Creature* halionController = instance->SummonCreature(NPC_HALION_CONTROLLER, HalionControllerSpawnPos)) @@ -184,7 +168,7 @@ class instance_ruby_sanctum : public InstanceMapScript } } - uint64 GetData64(uint32 type) const override + ObjectGuid GetGuidData(uint32 type) const override { switch (type) { @@ -224,7 +208,7 @@ class instance_ruby_sanctum : public InstanceMapScript break; } - return 0; + return ObjectGuid::Empty; } bool SetBossState(uint32 type, EncounterState state) override @@ -305,21 +289,21 @@ class instance_ruby_sanctum : public InstanceMapScript } protected: - uint64 BaltharusTheWarbornGUID; - uint64 GeneralZarithrianGUID; - uint64 SavianaRagefireGUID; - uint64 HalionGUID; - uint64 TwilightHalionGUID; - uint64 HalionControllerGUID; - uint64 OrbCarrierGUID; - uint64 OrbRotationFocusGUID; - uint64 CrystalChannelTargetGUID; - uint64 XerestraszaGUID; - uint64 FlameWallsGUID; - uint64 ZarithrianSpawnStalkerGUID[2]; - uint64 BurningTreeGUID[4]; - uint64 FlameRingGUID; - uint64 TwilightFlameRingGUID; + ObjectGuid BaltharusTheWarbornGUID; + ObjectGuid GeneralZarithrianGUID; + ObjectGuid SavianaRagefireGUID; + ObjectGuid HalionGUID; + ObjectGuid TwilightHalionGUID; + ObjectGuid HalionControllerGUID; + ObjectGuid OrbCarrierGUID; + ObjectGuid OrbRotationFocusGUID; + ObjectGuid CrystalChannelTargetGUID; + ObjectGuid XerestraszaGUID; + ObjectGuid FlameWallsGUID; + ObjectGuid ZarithrianSpawnStalkerGUID[2]; + ObjectGuid BurningTreeGUID[4]; + ObjectGuid FlameRingGUID; + ObjectGuid TwilightFlameRingGUID; uint32 BaltharusSharedHealth; }; diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp index 0d2b98dbd1c..9f088a4cdfa 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp @@ -154,10 +154,10 @@ class at_baltharus_plateau : public AreaTriggerScript // Only trigger once if (InstanceScript* instance = player->GetInstanceScript()) { - if (Creature* xerestrasza = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_XERESTRASZA))) + if (Creature* xerestrasza = ObjectAccessor::GetCreature(*player, instance->GetGuidData(DATA_XERESTRASZA))) xerestrasza->AI()->DoAction(ACTION_INTRO_BALTHARUS); - if (Creature* baltharus = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_BALTHARUS_THE_WARBORN))) + if (Creature* baltharus = ObjectAccessor::GetCreature(*player, instance->GetGuidData(DATA_BALTHARUS_THE_WARBORN))) baltharus->AI()->DoAction(ACTION_INTRO_BALTHARUS); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp index f2d2c3e3d5b..abf57ad68d1 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp @@ -269,7 +269,6 @@ public: Initialize(); instance = creature->GetInstanceScript(); - MemoryGUID = 0; creature->SetReactState(REACT_PASSIVE); creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); creature->RestoreFaction(); @@ -288,7 +287,7 @@ public: } InstanceScript* instance; - uint64 MemoryGUID; + ObjectGuid MemoryGUID; bool bHealth; bool bDone; @@ -584,7 +583,7 @@ public: break; } - Start(false, true, 0); + Start(false, true); uiWaypoint = uiType; } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp index e342b3bbfb1..60b25a649ca 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp @@ -81,7 +81,7 @@ public: struct boss_black_knightAI : public ScriptedAI { - boss_black_knightAI(Creature* creature) : ScriptedAI(creature) + boss_black_knightAI(Creature* creature) : ScriptedAI(creature), summons(creature) { Initialize(); instance = creature->GetInstanceScript(); @@ -110,7 +110,7 @@ public: InstanceScript* instance; - std::list<uint64> SummonList; + SummonList summons; bool bEventInProgress; bool bEvent; @@ -132,31 +132,22 @@ public: void Reset() override { - RemoveSummons(); + summons.DespawnAll(); me->SetDisplayId(me->GetNativeDisplayId()); me->ClearUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED); Initialize(); } - void RemoveSummons() + void JustSummoned(Creature* summon) override { - if (SummonList.empty()) - return; - - for (std::list<uint64>::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr) - { - if (Creature* temp = ObjectAccessor::GetCreature(*me, *itr)) - if (temp) - temp->DisappearAndDie(); - } - SummonList.clear(); + summons.Summon(summon); + summon->AI()->AttackStart(me->GetVictim()); } - void JustSummoned(Creature* summon) override + void SummonedCreatureDespawn(Creature* summon) override { - SummonList.push_back(summon->GetGUID()); - summon->AI()->AttackStart(me->GetVictim()); + summons.Despawn(summon); } void UpdateAI(uint32 uiDiff) override @@ -281,7 +272,7 @@ public: uiDamage = 0; me->SetHealth(0); me->AddUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED); - RemoveSummons(); + summons.DespawnAll(); switch (uiPhase) { case PHASE_UNDEAD: @@ -367,20 +358,16 @@ public: { npc_black_knight_skeletal_gryphonAI(Creature* creature) : npc_escortAI(creature) { - Start(false, true, 0, NULL); + Start(false, true); } - void WaypointReached(uint32 /*waypointId*/) override - { - - } + void WaypointReached(uint32 /*waypointId*/) override { } void UpdateAI(uint32 uiDiff) override { npc_escortAI::UpdateAI(uiDiff); - if (!UpdateVictim()) - return; + UpdateVictim(); } }; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp index 027238be6d3..7e83c24e0dd 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp @@ -126,9 +126,9 @@ bool GrandChampionsOutVehicle(Creature* me) if (!instance) return false; - Creature* pGrandChampion1 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GRAND_CHAMPION_1)); - Creature* pGrandChampion2 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GRAND_CHAMPION_2)); - Creature* pGrandChampion3 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GRAND_CHAMPION_3)); + Creature* pGrandChampion1 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_GRAND_CHAMPION_1)); + Creature* pGrandChampion2 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_GRAND_CHAMPION_2)); + Creature* pGrandChampion3 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_GRAND_CHAMPION_3)); if (pGrandChampion1 && pGrandChampion2 && pGrandChampion3) { @@ -208,7 +208,7 @@ public: } if (uiType <= 3) - Start(false, true, 0, NULL); + Start(false, true); } void WaypointReached(uint32 waypointId) override @@ -375,11 +375,11 @@ public: { bDone = true; - if (me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_1)) + if (me->GetGUID() == instance->GetGuidData(DATA_GRAND_CHAMPION_1)) me->SetHomePosition(739.678f, 662.541f, 412.393f, 4.49f); - else if (me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_2)) + else if (me->GetGUID() == instance->GetGuidData(DATA_GRAND_CHAMPION_2)) me->SetHomePosition(746.71f, 661.02f, 411.69f, 4.6f); - else if (me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_3)) + else if (me->GetGUID() == instance->GetGuidData(DATA_GRAND_CHAMPION_3)) me->SetHomePosition(754.34f, 660.70f, 412.39f, 4.79f); EnterEvadeMode(); @@ -514,11 +514,11 @@ public: { bDone = true; - if (me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_1)) + if (me->GetGUID() == instance->GetGuidData(DATA_GRAND_CHAMPION_1)) me->SetHomePosition(739.678f, 662.541f, 412.393f, 4.49f); - else if (me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_2)) + else if (me->GetGUID() == instance->GetGuidData(DATA_GRAND_CHAMPION_2)) me->SetHomePosition(746.71f, 661.02f, 411.69f, 4.6f); - else if (me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_3)) + else if (me->GetGUID() == instance->GetGuidData(DATA_GRAND_CHAMPION_3)) me->SetHomePosition(754.34f, 660.70f, 412.39f, 4.79f); instance->SetData(BOSS_GRAND_CHAMPIONS, IN_PROGRESS); @@ -663,11 +663,11 @@ public: { bDone = true; - if (me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_1)) + if (me->GetGUID() == instance->GetGuidData(DATA_GRAND_CHAMPION_1)) me->SetHomePosition(739.678f, 662.541f, 412.393f, 4.49f); - else if (me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_2)) + else if (me->GetGUID() == instance->GetGuidData(DATA_GRAND_CHAMPION_2)) me->SetHomePosition(746.71f, 661.02f, 411.69f, 4.6f); - else if (me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_3)) + else if (me->GetGUID() == instance->GetGuidData(DATA_GRAND_CHAMPION_3)) me->SetHomePosition(754.34f, 660.70f, 412.39f, 4.79f); instance->SetData(BOSS_GRAND_CHAMPIONS, IN_PROGRESS); @@ -769,7 +769,7 @@ public: uiMultiShotTimer = 0; uiLightningArrowsTimer = 7000; - uiTargetGUID = 0; + uiTargetGUID.Clear(); bShoot = false; } @@ -783,7 +783,7 @@ public: uint32 uiMultiShotTimer; uint32 uiLightningArrowsTimer; - uint64 uiTargetGUID; + ObjectGuid uiTargetGUID; bool bShoot; bool bDone; @@ -813,11 +813,11 @@ public: { bDone = true; - if (me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_1)) + if (me->GetGUID() == instance->GetGuidData(DATA_GRAND_CHAMPION_1)) me->SetHomePosition(739.678f, 662.541f, 412.393f, 4.49f); - else if (me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_2)) + else if (me->GetGUID() == instance->GetGuidData(DATA_GRAND_CHAMPION_2)) me->SetHomePosition(746.71f, 661.02f, 411.69f, 4.6f); - else if (me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_3)) + else if (me->GetGUID() == instance->GetGuidData(DATA_GRAND_CHAMPION_3)) me->SetHomePosition(754.34f, 660.70f, 412.39f, 4.79f); instance->SetData(BOSS_GRAND_CHAMPIONS, IN_PROGRESS); @@ -965,11 +965,11 @@ public: { bDone = true; - if (me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_1)) + if (me->GetGUID() == instance->GetGuidData(DATA_GRAND_CHAMPION_1)) me->SetHomePosition(739.678f, 662.541f, 412.393f, 4.49f); - else if (me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_2)) + else if (me->GetGUID() == instance->GetGuidData(DATA_GRAND_CHAMPION_2)) me->SetHomePosition(746.71f, 661.02f, 411.69f, 4.6f); - else if (me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_3)) + else if (me->GetGUID() == instance->GetGuidData(DATA_GRAND_CHAMPION_3)) me->SetHomePosition(754.34f, 660.70f, 412.39f, 4.79f); instance->SetData(BOSS_GRAND_CHAMPIONS, IN_PROGRESS); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp index 021947db0f7..94bf20bc41f 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp @@ -49,18 +49,18 @@ public: uint16 uiGrandChampionsDeaths; uint8 uiArgentSoldierDeaths; - uint64 uiAnnouncerGUID; - uint64 uiMainGateGUID; - uint64 uiGrandChampionVehicle1GUID; - uint64 uiGrandChampionVehicle2GUID; - uint64 uiGrandChampionVehicle3GUID; - uint64 uiGrandChampion1GUID; - uint64 uiGrandChampion2GUID; - uint64 uiGrandChampion3GUID; - uint64 uiChampionLootGUID; - uint64 uiArgentChampionGUID; - - std::list<uint64> VehicleList; + ObjectGuid uiAnnouncerGUID; + ObjectGuid uiMainGateGUID; + ObjectGuid uiGrandChampionVehicle1GUID; + ObjectGuid uiGrandChampionVehicle2GUID; + ObjectGuid uiGrandChampionVehicle3GUID; + ObjectGuid uiGrandChampion1GUID; + ObjectGuid uiGrandChampion2GUID; + ObjectGuid uiGrandChampion3GUID; + ObjectGuid uiChampionLootGUID; + ObjectGuid uiArgentChampionGUID; + + GuidList VehicleList; std::string str_data; @@ -73,21 +73,8 @@ public: uiGrandChampionsDeaths = 0; uiArgentSoldierDeaths = 0; - uiAnnouncerGUID = 0; - uiMainGateGUID = 0; - uiGrandChampionVehicle1GUID = 0; - uiGrandChampionVehicle2GUID = 0; - uiGrandChampionVehicle3GUID = 0; - uiGrandChampion1GUID = 0; - uiGrandChampion2GUID = 0; - uiGrandChampion3GUID = 0; - uiChampionLootGUID = 0; - uiArgentChampionGUID = 0; - bDone = false; - VehicleList.clear(); - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); } @@ -183,7 +170,7 @@ public: m_auiEncounter[0] = uiData; if (uiData == IN_PROGRESS) { - for (std::list<uint64>::const_iterator itr = VehicleList.begin(); itr != VehicleList.end(); ++itr) + for (GuidList::const_iterator itr = VehicleList.begin(); itr != VehicleList.end(); ++itr) if (Creature* summon = instance->GetCreature(*itr)) summon->RemoveFromWorld(); }else if (uiData == DONE) @@ -252,7 +239,7 @@ public: return 0; } - uint64 GetData64(uint32 uiData) const override + ObjectGuid GetGuidData(uint32 uiData) const override { switch (uiData) { @@ -264,10 +251,10 @@ public: case DATA_GRAND_CHAMPION_3: return uiGrandChampion3GUID; } - return 0; + return ObjectGuid::Empty; } - void SetData64(uint32 uiType, uint64 uiData) override + void SetGuidData(uint32 uiType, ObjectGuid uiData) override { switch (uiType) { diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp index f601f06e16c..a66096ae615 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp @@ -80,14 +80,6 @@ public: uiPhase = 0; uiTimer = 0; - uiVehicle1GUID = 0; - uiVehicle2GUID = 0; - uiVehicle3GUID = 0; - - Champion1List.clear(); - Champion2List.clear(); - Champion3List.clear(); - me->SetReactState(REACT_PASSIVE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); @@ -111,13 +103,13 @@ public: uint32 uiPhase; uint32 uiTimer; - uint64 uiVehicle1GUID; - uint64 uiVehicle2GUID; - uint64 uiVehicle3GUID; + ObjectGuid uiVehicle1GUID; + ObjectGuid uiVehicle2GUID; + ObjectGuid uiVehicle3GUID; - std::list<uint64> Champion1List; - std::list<uint64> Champion2List; - std::list<uint64> Champion3List; + GuidList Champion1List; + GuidList Champion2List; + GuidList Champion3List; void NextStep(uint32 uiTimerStep, bool bNextStep = true, uint8 uiPhaseStep = 0) { @@ -138,14 +130,14 @@ public: break; case DATA_IN_POSITION: //movement done. me->GetMotionMaster()->MovePoint(1, 735.81f, 661.92f, 412.39f); - if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_MAIN_GATE))) + if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_MAIN_GATE))) instance->HandleGameObject(go->GetGUID(), false); NextStep(10000, false, 3); break; case DATA_LESSER_CHAMPIONS_DEFEATED: { ++uiLesserChampions; - std::list<uint64> TempList; + GuidList TempList; if (uiLesserChampions == 3 || uiLesserChampions == 6) { switch (uiLesserChampions) @@ -158,7 +150,7 @@ public: break; } - for (std::list<uint64>::const_iterator itr = TempList.begin(); itr != TempList.end(); ++itr) + for (GuidList::const_iterator itr = TempList.begin(); itr != TempList.end(); ++itr) if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) AggroAllPlayers(summon); }else if (uiLesserChampions == 9) @@ -230,36 +222,36 @@ public: case 1: { uiVehicle1GUID = pBoss->GetGUID(); - uint64 uiGrandChampionBoss1 = 0; + ObjectGuid uiGrandChampionBoss1; if (Vehicle* pVehicle = pBoss->GetVehicleKit()) if (Unit* unit = pVehicle->GetPassenger(0)) uiGrandChampionBoss1 = unit->GetGUID(); - instance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_1, uiVehicle1GUID); - instance->SetData64(DATA_GRAND_CHAMPION_1, uiGrandChampionBoss1); + instance->SetGuidData(DATA_GRAND_CHAMPION_VEHICLE_1, uiVehicle1GUID); + instance->SetGuidData(DATA_GRAND_CHAMPION_1, uiGrandChampionBoss1); pBoss->AI()->SetData(1, 0); break; } case 2: { uiVehicle2GUID = pBoss->GetGUID(); - uint64 uiGrandChampionBoss2 = 0; + ObjectGuid uiGrandChampionBoss2; if (Vehicle* pVehicle = pBoss->GetVehicleKit()) if (Unit* unit = pVehicle->GetPassenger(0)) uiGrandChampionBoss2 = unit->GetGUID(); - instance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_2, uiVehicle2GUID); - instance->SetData64(DATA_GRAND_CHAMPION_2, uiGrandChampionBoss2); + instance->SetGuidData(DATA_GRAND_CHAMPION_VEHICLE_2, uiVehicle2GUID); + instance->SetGuidData(DATA_GRAND_CHAMPION_2, uiGrandChampionBoss2); pBoss->AI()->SetData(2, 0); break; } case 3: { uiVehicle3GUID = pBoss->GetGUID(); - uint64 uiGrandChampionBoss3 = 0; + ObjectGuid uiGrandChampionBoss3; if (Vehicle* pVehicle = pBoss->GetVehicleKit()) if (Unit* unit = pVehicle->GetPassenger(0)) uiGrandChampionBoss3 = unit->GetGUID(); - instance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_3, uiVehicle3GUID); - instance->SetData64(DATA_GRAND_CHAMPION_3, uiGrandChampionBoss3); + instance->SetGuidData(DATA_GRAND_CHAMPION_VEHICLE_3, uiVehicle3GUID); + instance->SetGuidData(DATA_GRAND_CHAMPION_3, uiGrandChampionBoss3); pBoss->AI()->SetData(3, 0); break; } @@ -414,7 +406,7 @@ public: case 3: if (!Champion1List.empty()) { - for (std::list<uint64>::const_iterator itr = Champion1List.begin(); itr != Champion1List.end(); ++itr) + for (GuidList::const_iterator itr = Champion1List.begin(); itr != Champion1List.end(); ++itr) if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) AggroAllPlayers(summon); NextStep(0, false); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp index 2f29e03a2f2..cf33e08eeeb 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp @@ -346,7 +346,7 @@ class boss_anubarak_trial : public CreatureScript /* WORKAROUND * - The correct implementation is more likely the comment below but it needs spell knowledge */ - std::list<uint64>::iterator i = _burrowGUID.begin(); + GuidList::iterator i = _burrowGUID.begin(); uint32 at = urand(0, _burrowGUID.size()-1); for (uint32 k = 0; k < at; k++) ++i; @@ -421,8 +421,8 @@ class boss_anubarak_trial : public CreatureScript } private: - std::list<uint64> _burrowGUID; - uint64 _sphereGUID[6]; + GuidList _burrowGUID; + ObjectGuid _sphereGUID[6]; bool _intro; bool _reachedPhase3; }; @@ -458,7 +458,7 @@ class npc_swarm_scarab : public CreatureScript DoCast(me, SPELL_ACID_MANDIBLE); me->SetInCombatWithZone(); if (me->IsInCombat()) - if (Creature* Anubarak = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_ANUBARAK))) + if (Creature* Anubarak = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(NPC_ANUBARAK))) Anubarak->AI()->JustSummoned(me); } @@ -538,7 +538,7 @@ class npc_nerubian_burrower : public CreatureScript DoCast(me, SPELL_AWAKENED); me->SetInCombatWithZone(); if (me->IsInCombat()) - if (Creature* Anubarak = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_ANUBARAK))) + if (Creature* Anubarak = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(NPC_ANUBARAK))) Anubarak->AI()->JustSummoned(me); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp index 3d59f24b6dd..562e67f4b6a 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp @@ -483,7 +483,7 @@ class boss_toc_champion_controller : public CreatureScript SummonChampions((Team)uiData); break; case 1: - for (std::list<uint64>::iterator i = _summons.begin(); i != _summons.end(); ++i) + for (SummonList::iterator i = _summons.begin(); i != _summons.end(); ++i) { if (Creature* temp = ObjectAccessor::GetCreature(*me, *i)) { @@ -565,7 +565,7 @@ struct boss_faction_championsAI : public BossAI void JustReachedHome() override { - if (Creature* pChampionController = ObjectAccessor::GetCreature((*me), instance->GetData64(NPC_CHAMPIONS_CONTROLLER))) + if (Creature* pChampionController = ObjectAccessor::GetCreature((*me), instance->GetGuidData(NPC_CHAMPIONS_CONTROLLER))) pChampionController->AI()->SetData(2, FAIL); me->DespawnOrUnsummon(); } @@ -615,7 +615,7 @@ struct boss_faction_championsAI : public BossAI void JustDied(Unit* /*killer*/) override { if (_aiType != AI_PET) - if (Creature* pChampionController = ObjectAccessor::GetCreature((*me), instance->GetData64(NPC_CHAMPIONS_CONTROLLER))) + if (Creature* pChampionController = ObjectAccessor::GetCreature((*me), instance->GetGuidData(NPC_CHAMPIONS_CONTROLLER))) pChampionController->AI()->SetData(2, DONE); } @@ -623,7 +623,7 @@ struct boss_faction_championsAI : public BossAI { DoCast(me, SPELL_ANTI_AOE, true); _EnterCombat(); - if (Creature* pChampionController = ObjectAccessor::GetCreature((*me), instance->GetData64(NPC_CHAMPIONS_CONTROLLER))) + if (Creature* pChampionController = ObjectAccessor::GetCreature((*me), instance->GetGuidData(NPC_CHAMPIONS_CONTROLLER))) pChampionController->AI()->SetData(2, IN_PROGRESS); } @@ -640,11 +640,11 @@ struct boss_faction_championsAI : public BossAI if (TeamInInstance == ALLIANCE) { - if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_VARIAN))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(NPC_VARIAN))) temp->AI()->Talk(SAY_KILL_PLAYER); } else - if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_GARROSH))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(NPC_GARROSH))) temp->AI()->Talk(SAY_KILL_PLAYER); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp index f4112b7a43b..771151632ff 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp @@ -171,7 +171,7 @@ class boss_gormok : public CreatureScript void EnterEvadeMode() override { - instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); + instance->DoUseDoorOrButton(instance->GetGuidData(GO_MAIN_GATE_DOOR)); ScriptedAI::EnterEvadeMode(); } @@ -183,7 +183,7 @@ class boss_gormok : public CreatureScript switch (pointId) { case 0: - instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); + instance->DoUseDoorOrButton(instance->GetGuidData(GO_MAIN_GATE_DOOR)); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_AGGRESSIVE); me->SetInCombatWithZone(); @@ -200,7 +200,7 @@ class boss_gormok : public CreatureScript void JustReachedHome() override { - instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); + instance->DoUseDoorOrButton(instance->GetGuidData(GO_MAIN_GATE_DOOR)); instance->SetData(TYPE_NORTHREND_BEASTS, FAIL); me->DespawnOrUnsummon(); @@ -294,7 +294,6 @@ class npc_snobold_vassal : public CreatureScript { npc_snobold_vassalAI(Creature* creature) : ScriptedAI(creature) { - _targetGUID = 0; _targetDied = false; _instance = creature->GetInstanceScript(); _instance->SetData(DATA_SNOBOLD_COUNT, INCREASE); @@ -305,7 +304,7 @@ class npc_snobold_vassal : public CreatureScript _events.ScheduleEvent(EVENT_BATTER, 5*IN_MILLISECONDS); _events.ScheduleEvent(EVENT_HEAD_CRACK, 25*IN_MILLISECONDS); - _targetGUID = 0; + _targetGUID.Clear(); _targetDied = false; //Workaround for Snobold @@ -378,7 +377,7 @@ class npc_snobold_vassal : public CreatureScript { if (!target->IsAlive()) { - Unit* gormok = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_GORMOK)); + Unit* gormok = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(NPC_GORMOK)); if (gormok && gormok->IsAlive()) { SetCombatMovement(false); @@ -442,7 +441,7 @@ class npc_snobold_vassal : public CreatureScript private: EventMap _events; InstanceScript* _instance; - uint64 _targetGUID; + ObjectGuid _targetGUID; bool _targetDied; }; @@ -520,7 +519,7 @@ struct boss_jormungarAI : public BossAI void JustDied(Unit* /*killer*/) override { - if (Creature* otherWorm = ObjectAccessor::GetCreature(*me, instance->GetData64(OtherWormEntry))) + if (Creature* otherWorm = ObjectAccessor::GetCreature(*me, instance->GetGuidData(OtherWormEntry))) { if (!otherWorm->IsAlive()) { @@ -753,7 +752,7 @@ class boss_dreadscale : public CreatureScript switch (pointId) { case 0: - instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); + instance->DoUseDoorOrButton(instance->GetGuidData(GO_MAIN_GATE_DOOR)); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_AGGRESSIVE); me->SetInCombatWithZone(); @@ -765,13 +764,13 @@ class boss_dreadscale : public CreatureScript void EnterEvadeMode() override { - instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); + instance->DoUseDoorOrButton(instance->GetGuidData(GO_MAIN_GATE_DOOR)); boss_jormungarAI::EnterEvadeMode(); } void JustReachedHome() override { - instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); + instance->DoUseDoorOrButton(instance->GetGuidData(GO_MAIN_GATE_DOOR)); boss_jormungarAI::JustReachedHome(); } @@ -877,7 +876,7 @@ class boss_icehowl : public CreatureScript _movementStarted = false; _movementFinish = false; _trampleCast = false; - _trampleTargetGUID = 0; + _trampleTargetGUID.Clear(); _trampleTargetX = 0; _trampleTargetY = 0; _trampleTargetZ = 0; @@ -926,7 +925,7 @@ class boss_icehowl : public CreatureScript _movementFinish = true; break; case 2: - instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); + instance->DoUseDoorOrButton(instance->GetGuidData(GO_MAIN_GATE_DOOR)); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_AGGRESSIVE); me->SetInCombatWithZone(); @@ -938,13 +937,13 @@ class boss_icehowl : public CreatureScript void EnterEvadeMode() override { - instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); + instance->DoUseDoorOrButton(instance->GetGuidData(GO_MAIN_GATE_DOOR)); ScriptedAI::EnterEvadeMode(); } void JustReachedHome() override { - instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); + instance->DoUseDoorOrButton(instance->GetGuidData(GO_MAIN_GATE_DOOR)); instance->SetData(TYPE_NORTHREND_BEASTS, FAIL); me->DespawnOrUnsummon(); } @@ -1077,7 +1076,7 @@ class boss_icehowl : public CreatureScript if (Player* target = ObjectAccessor::GetPlayer(*me, _trampleTargetGUID)) Talk(EMOTE_TRAMPLE_START, target); me->GetMotionMaster()->MoveCharge(_trampleTargetX, _trampleTargetY, _trampleTargetZ, 42, 1); - me->SetTarget(0); + me->SetTarget(ObjectGuid::Empty); _stage = 5; break; case 5: @@ -1134,7 +1133,7 @@ class boss_icehowl : public CreatureScript private: float _trampleTargetX, _trampleTargetY, _trampleTargetZ; - uint64 _trampleTargetGUID; + ObjectGuid _trampleTargetGUID; bool _movementStarted; bool _movementFinish; bool _trampleCast; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp index 1118c1ec27b..a645f3ca666 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp @@ -267,7 +267,7 @@ struct boss_twin_baseAI : public BossAI // Called when sister pointer needed Creature* GetSister() { - return ObjectAccessor::GetCreature((*me), instance->GetData64(SisterNpcId)); + return ObjectAccessor::GetCreature((*me), instance->GetGuidData(SisterNpcId)); } void EnterCombat(Unit* /*who*/) override @@ -447,13 +447,13 @@ class boss_fjola : public CreatureScript void EnterEvadeMode() override { - instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); + instance->DoUseDoorOrButton(instance->GetGuidData(GO_MAIN_GATE_DOOR)); boss_twin_baseAI::EnterEvadeMode(); } void JustReachedHome() override { - instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); + instance->DoUseDoorOrButton(instance->GetGuidData(GO_MAIN_GATE_DOOR)); boss_twin_baseAI::JustReachedHome(); } @@ -864,7 +864,7 @@ class spell_power_of_the_twins : public SpellScriptLoader { if (InstanceScript* instance = GetCaster()->GetInstanceScript()) { - if (Creature* Valk = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(GetCaster()->GetEntry()))) + if (Creature* Valk = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(GetCaster()->GetEntry()))) ENSURE_AI(boss_twin_baseAI, Valk->AI())->EnableDualWield(true); } } @@ -873,7 +873,7 @@ class spell_power_of_the_twins : public SpellScriptLoader { if (InstanceScript* instance = GetCaster()->GetInstanceScript()) { - if (Creature* Valk = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(GetCaster()->GetEntry()))) + if (Creature* Valk = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(GetCaster()->GetEntry()))) ENSURE_AI(boss_twin_baseAI, Valk->AI())->EnableDualWield(false); } } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp index a8d3f223664..30d831da30c 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp @@ -45,29 +45,6 @@ class instance_trial_of_the_crusader : public InstanceMapScript MistressOfPainCount = 0; TributeToImmortalityEligible = true; NeedSave = false; - - TirionFordringGUID = 0; - BarrentGUID = 0; - TirionGUID = 0; - FizzlebangGUID = 0; - GarroshGUID = 0; - VarianGUID = 0; - GormokGUID = 0; - AcidmawGUID = 0; - DreadscaleGUID = 0; - IcehowlGUID = 0; - JaraxxusGUID = 0; - ChampionsControllerGUID = 0; - DarkbaneGUID = 0; - LightbaneGUID = 0; - AnubarakGUID = 0; - - TributeChestGUID = 0; - MainGateDoorGUID = 0; - EastPortcullisGUID = 0; - WebDoorGUID = 0; - CrusadersCacheGUID = 0; - FloorGUID = 0; } bool IsEncounterInProgress() const override @@ -96,15 +73,15 @@ class instance_trial_of_the_crusader : public InstanceMapScript // make sure Anub'arak isnt missing and floor is destroyed after a crash if (GetBossState(BOSS_LICH_KING) == DONE && TrialCounter && GetBossState(BOSS_ANUBARAK) != DONE) { - if (Creature* anubArak = ObjectAccessor::GetCreature(*player, GetData64(NPC_ANUBARAK))) + if (Creature* anubArak = ObjectAccessor::GetCreature(*player, GetGuidData(NPC_ANUBARAK))) anubArak = player->SummonCreature(NPC_ANUBARAK, AnubarakLoc[0].GetPositionX(), AnubarakLoc[0].GetPositionY(), AnubarakLoc[0].GetPositionZ(), 3, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME); - if (GameObject* floor = ObjectAccessor::GetGameObject(*player, GetData64(GO_ARGENT_COLISEUM_FLOOR))) + if (GameObject* floor = ObjectAccessor::GetGameObject(*player, GetGuidData(GO_ARGENT_COLISEUM_FLOOR))) floor->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED); } } - void OpenDoor(uint64 guid) + void OpenDoor(ObjectGuid guid) { if (!guid) return; @@ -113,7 +90,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript go->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); } - void CloseDoor(uint64 guid) + void CloseDoor(ObjectGuid guid) { if (!guid) return; @@ -356,13 +333,13 @@ class instance_trial_of_the_crusader : public InstanceMapScript if (IsEncounterInProgress()) { - CloseDoor(GetData64(GO_EAST_PORTCULLIS)); - CloseDoor(GetData64(GO_WEB_DOOR)); + CloseDoor(GetGuidData(GO_EAST_PORTCULLIS)); + CloseDoor(GetGuidData(GO_WEB_DOOR)); } else { - OpenDoor(GetData64(GO_EAST_PORTCULLIS)); - OpenDoor(GetData64(GO_WEB_DOOR)); + OpenDoor(GetGuidData(GO_EAST_PORTCULLIS)); + OpenDoor(GetGuidData(GO_WEB_DOOR)); } if (type < MAX_ENCOUNTERS) @@ -382,10 +359,10 @@ class instance_trial_of_the_crusader : public InstanceMapScript // if theres no more attemps allowed if (!TrialCounter) { - if (Unit* announcer = instance->GetCreature(GetData64(NPC_BARRENT))) + if (Unit* announcer = instance->GetCreature(GetGuidData(NPC_BARRENT))) announcer->ToCreature()->DespawnOrUnsummon(); - if (Creature* anubArak = instance->GetCreature(GetData64(NPC_ANUBARAK))) + if (Creature* anubArak = instance->GetCreature(GetGuidData(NPC_ANUBARAK))) anubArak->DespawnOrUnsummon(); } } @@ -396,7 +373,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript if (state == DONE || NeedSave) { - if (Unit* announcer = instance->GetCreature(GetData64(NPC_BARRENT))) + if (Unit* announcer = instance->GetCreature(GetGuidData(NPC_BARRENT))) announcer->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); Save(); } @@ -473,7 +450,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript } } - uint64 GetData64(uint32 type) const override + ObjectGuid GetGuidData(uint32 type) const override { switch (type) { @@ -521,7 +498,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript break; } - return 0; + return ObjectGuid::Empty; } uint32 GetData(uint32 type) const override @@ -743,29 +720,29 @@ class instance_trial_of_the_crusader : public InstanceMapScript bool NeedSave; std::string SaveDataBuffer; - uint64 BarrentGUID; - uint64 TirionGUID; - uint64 TirionFordringGUID; - uint64 FizzlebangGUID; - uint64 GarroshGUID; - uint64 VarianGUID; - - uint64 GormokGUID; - uint64 AcidmawGUID; - uint64 DreadscaleGUID; - uint64 IcehowlGUID; - uint64 JaraxxusGUID; - uint64 ChampionsControllerGUID; - uint64 DarkbaneGUID; - uint64 LightbaneGUID; - uint64 AnubarakGUID; - - uint64 CrusadersCacheGUID; - uint64 FloorGUID; - uint64 TributeChestGUID; - uint64 MainGateDoorGUID; - uint64 EastPortcullisGUID; - uint64 WebDoorGUID; + ObjectGuid BarrentGUID; + ObjectGuid TirionGUID; + ObjectGuid TirionFordringGUID; + ObjectGuid FizzlebangGUID; + ObjectGuid GarroshGUID; + ObjectGuid VarianGUID; + + ObjectGuid GormokGUID; + ObjectGuid AcidmawGUID; + ObjectGuid DreadscaleGUID; + ObjectGuid IcehowlGUID; + ObjectGuid JaraxxusGUID; + ObjectGuid ChampionsControllerGUID; + ObjectGuid DarkbaneGUID; + ObjectGuid LightbaneGUID; + ObjectGuid AnubarakGUID; + + ObjectGuid CrusadersCacheGUID; + ObjectGuid FloorGUID; + ObjectGuid TributeChestGUID; + ObjectGuid MainGateDoorGUID; + ObjectGuid EastPortcullisGUID; + ObjectGuid WebDoorGUID; // Achievement stuff uint32 NotOneButTwoJormungarsTimer; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp index b068b458073..d8ec322c57c 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp @@ -173,7 +173,7 @@ class npc_announcer_toc10 : public CreatureScript else if (instance->GetBossState(BOSS_JARAXXUS) != DONE) { // if Jaraxxus is spawned, but the raid wiped - if (Creature* jaraxxus = ObjectAccessor::GetCreature(*player, instance->GetData64(NPC_JARAXXUS))) + if (Creature* jaraxxus = ObjectAccessor::GetCreature(*player, instance->GetGuidData(NPC_JARAXXUS))) { jaraxxus->RemoveAurasDueToSpell(SPELL_JARAXXUS_CHAINS); jaraxxus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); @@ -201,13 +201,13 @@ class npc_announcer_toc10 : public CreatureScript } else if (instance->GetBossState(BOSS_LICH_KING) != DONE) { - if (GameObject* floor = ObjectAccessor::GetGameObject(*player, instance->GetData64(GO_ARGENT_COLISEUM_FLOOR))) + if (GameObject* floor = ObjectAccessor::GetGameObject(*player, instance->GetGuidData(GO_ARGENT_COLISEUM_FLOOR))) floor->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED); creature->CastSpell(creature, SPELL_CORPSE_TELEPORT, false); creature->CastSpell(creature, SPELL_DESTROY_FLOOR_KNOCKUP, false); - Creature* anubArak = ObjectAccessor::GetCreature(*creature, instance->GetData64(NPC_ANUBARAK)); + Creature* anubArak = ObjectAccessor::GetCreature(*creature, instance->GetGuidData(NPC_ANUBARAK)); if (!anubArak || !anubArak->IsAlive()) anubArak = creature->SummonCreature(NPC_ANUBARAK, AnubarakLoc[0].GetPositionX(), AnubarakLoc[0].GetPositionY(), AnubarakLoc[0].GetPositionZ(), 3, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME); @@ -318,7 +318,7 @@ class boss_lich_king_toc : public CreatureScript break; case 5080: { - if (GameObject* go = ObjectAccessor::GetGameObject(*me, _instance->GetData64(GO_ARGENT_COLISEUM_FLOOR))) + if (GameObject* go = ObjectAccessor::GetGameObject(*me, _instance->GetGuidData(GO_ARGENT_COLISEUM_FLOOR))) { go->SetDisplayId(DISPLAYID_DESTROYED_FLOOR); go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED | GO_FLAG_NODESPAWN); @@ -329,7 +329,7 @@ class boss_lich_king_toc : public CreatureScript me->CastSpell(me, SPELL_DESTROY_FLOOR_KNOCKUP, false); _instance->SetBossState(BOSS_LICH_KING, DONE); - Creature* temp = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_ANUBARAK)); + Creature* temp = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(NPC_ANUBARAK)); if (!temp || !temp->IsAlive()) temp = me->SummonCreature(NPC_ANUBARAK, AnubarakLoc[0].GetPositionX(), AnubarakLoc[0].GetPositionY(), AnubarakLoc[0].GetPositionZ(), 3, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME); @@ -368,21 +368,14 @@ class npc_fizzlebang_toc : public CreatureScript { npc_fizzlebang_tocAI(Creature* creature) : ScriptedAI(creature), _summons(me) { - Initialize(); _instance = me->GetInstanceScript(); - _triggerGUID = 0; - } - - void Initialize() - { - _portalGUID = 0; } void JustDied(Unit* killer) override { Talk(SAY_STAGE_1_06, killer); _instance->SetData(TYPE_EVENT, 1180); - if (Creature* temp = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(NPC_JARAXXUS))) { temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); temp->SetReactState(REACT_AGGRESSIVE); @@ -392,8 +385,8 @@ class npc_fizzlebang_toc : public CreatureScript void Reset() override { + _portalGUID.Clear(); me->SetWalk(true); - Initialize(); me->GetMotionMaster()->MovePoint(1, ToCCommonLoc[10].GetPositionX(), ToCCommonLoc[10].GetPositionY()-60, ToCCommonLoc[10].GetPositionZ()); } @@ -406,7 +399,7 @@ class npc_fizzlebang_toc : public CreatureScript { case 1: me->SetWalk(false); - _instance->DoUseDoorOrButton(_instance->GetData64(GO_MAIN_GATE_DOOR)); + _instance->DoUseDoorOrButton(_instance->GetGuidData(GO_MAIN_GATE_DOOR)); _instance->SetData(TYPE_EVENT, 1120); _instance->SetData(TYPE_EVENT_TIMER, 1*IN_MILLISECONDS); break; @@ -489,7 +482,7 @@ class npc_fizzlebang_toc : public CreatureScript _updateTimer = 5*IN_MILLISECONDS; break; case 1142: - if (Creature* temp = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(NPC_JARAXXUS))) temp->SetTarget(me->GetGUID()); if (Creature* pTrigger = ObjectAccessor::GetCreature(*me, _triggerGUID)) pTrigger->DespawnOrUnsummon(); @@ -499,13 +492,13 @@ class npc_fizzlebang_toc : public CreatureScript _updateTimer = 10*IN_MILLISECONDS; break; case 1144: - if (Creature* temp = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(NPC_JARAXXUS))) temp->AI()->Talk(SAY_STAGE_1_05); _instance->SetData(TYPE_EVENT, 1150); _updateTimer = 5*IN_MILLISECONDS; break; case 1150: - if (Creature* temp = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(NPC_JARAXXUS))) { //1-shot Fizzlebang temp->CastSpell(me, 67888, false); @@ -526,8 +519,8 @@ class npc_fizzlebang_toc : public CreatureScript private: InstanceScript* _instance; SummonList _summons; - uint64 _portalGUID; - uint64 _triggerGUID; + ObjectGuid _portalGUID; + ObjectGuid _triggerGUID; }; CreatureAI* GetAI(Creature* creature) const override @@ -581,7 +574,7 @@ class npc_tirion_toc : public CreatureScript me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); if (_instance->GetBossState(BOSS_BEASTS) != DONE) { - _instance->DoUseDoorOrButton(_instance->GetData64(GO_MAIN_GATE_DOOR)); + _instance->DoUseDoorOrButton(_instance->GetGuidData(GO_MAIN_GATE_DOOR)); if (Creature* temp = me->SummonCreature(NPC_GORMOK, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 5, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30*IN_MILLISECONDS)) { @@ -603,7 +596,7 @@ class npc_tirion_toc : public CreatureScript Talk(SAY_STAGE_0_04); if (_instance->GetBossState(BOSS_BEASTS) != DONE) { - _instance->DoUseDoorOrButton(_instance->GetData64(GO_MAIN_GATE_DOOR)); + _instance->DoUseDoorOrButton(_instance->GetGuidData(GO_MAIN_GATE_DOOR)); if (Creature* temp = me->SummonCreature(NPC_DREADSCALE, ToCSpawnLoc[1].GetPositionX(), ToCSpawnLoc[1].GetPositionY(), ToCSpawnLoc[1].GetPositionZ(), 5, TEMPSUMMON_MANUAL_DESPAWN)) { temp->GetMotionMaster()->MovePoint(0, ToCCommonLoc[5].GetPositionX(), ToCCommonLoc[5].GetPositionY(), ToCCommonLoc[5].GetPositionZ()); @@ -621,7 +614,7 @@ class npc_tirion_toc : public CreatureScript Talk(SAY_STAGE_0_05); if (_instance->GetBossState(BOSS_BEASTS) != DONE) { - _instance->DoUseDoorOrButton(_instance->GetData64(GO_MAIN_GATE_DOOR)); + _instance->DoUseDoorOrButton(_instance->GetGuidData(GO_MAIN_GATE_DOOR)); if (Creature* temp = me->SummonCreature(NPC_ICEHOWL, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 5, TEMPSUMMON_DEAD_DESPAWN)) { temp->GetMotionMaster()->MovePoint(2, ToCCommonLoc[5].GetPositionX(), ToCCommonLoc[5].GetPositionY(), ToCCommonLoc[5].GetPositionZ()); @@ -649,7 +642,7 @@ class npc_tirion_toc : public CreatureScript case 1010: Talk(SAY_STAGE_1_01); _updateTimer = 7*IN_MILLISECONDS; - _instance->DoUseDoorOrButton(_instance->GetData64(GO_MAIN_GATE_DOOR)); + _instance->DoUseDoorOrButton(_instance->GetGuidData(GO_MAIN_GATE_DOOR)); me->SummonCreature(NPC_FIZZLEBANG, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 2, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME); _instance->SetData(TYPE_EVENT, 0); break; @@ -703,7 +696,7 @@ class npc_tirion_toc : public CreatureScript _instance->SetData(TYPE_EVENT, 3092); break; case 3092: - if (Creature* pChampionController = ObjectAccessor::GetCreature((*me), _instance->GetData64(NPC_CHAMPIONS_CONTROLLER))) + if (Creature* pChampionController = ObjectAccessor::GetCreature((*me), _instance->GetGuidData(NPC_CHAMPIONS_CONTROLLER))) pChampionController->AI()->SetData(1, NOT_STARTED); _instance->SetData(TYPE_EVENT, 3095); break; @@ -738,13 +731,13 @@ class npc_tirion_toc : public CreatureScript _instance->SetData(TYPE_EVENT, 4015); break; case 4015: - _instance->DoUseDoorOrButton(_instance->GetData64(GO_MAIN_GATE_DOOR)); - if (Creature* temp = ObjectAccessor::GetCreature((*me), _instance->GetData64(NPC_LIGHTBANE))) + _instance->DoUseDoorOrButton(_instance->GetGuidData(GO_MAIN_GATE_DOOR)); + if (Creature* temp = ObjectAccessor::GetCreature((*me), _instance->GetGuidData(NPC_LIGHTBANE))) { temp->GetMotionMaster()->MovePoint(1, ToCCommonLoc[8].GetPositionX(), ToCCommonLoc[8].GetPositionY(), ToCCommonLoc[8].GetPositionZ()); temp->SetVisible(true); } - if (Creature* temp = ObjectAccessor::GetCreature((*me), _instance->GetData64(NPC_DARKBANE))) + if (Creature* temp = ObjectAccessor::GetCreature((*me), _instance->GetGuidData(NPC_DARKBANE))) { temp->GetMotionMaster()->MovePoint(1, ToCCommonLoc[9].GetPositionX(), ToCCommonLoc[9].GetPositionY(), ToCCommonLoc[9].GetPositionZ()); temp->SetVisible(true); @@ -753,7 +746,7 @@ class npc_tirion_toc : public CreatureScript _instance->SetData(TYPE_EVENT, 4016); break; case 4016: - _instance->DoUseDoorOrButton(_instance->GetData64(GO_MAIN_GATE_DOOR)); + _instance->DoUseDoorOrButton(_instance->GetGuidData(GO_MAIN_GATE_DOOR)); _instance->SetData(TYPE_EVENT, 4017); break; case 4040: @@ -783,7 +776,7 @@ class npc_tirion_toc : public CreatureScript _instance->SetData(TYPE_EVENT, 6005); break; case 6005: - if (Creature* tirionFordring = ObjectAccessor::GetCreature((*me), _instance->GetData64(NPC_TIRION_FORDRING))) + if (Creature* tirionFordring = ObjectAccessor::GetCreature((*me), _instance->GetGuidData(NPC_TIRION_FORDRING))) tirionFordring->AI()->Talk(SAY_STAGE_4_06); _updateTimer = 20*IN_MILLISECONDS; _instance->SetData(TYPE_EVENT, 6010); @@ -791,7 +784,7 @@ class npc_tirion_toc : public CreatureScript case 6010: if (IsHeroic()) { - if (Creature* tirionFordring = ObjectAccessor::GetCreature((*me), _instance->GetData64(NPC_TIRION_FORDRING))) + if (Creature* tirionFordring = ObjectAccessor::GetCreature((*me), _instance->GetGuidData(NPC_TIRION_FORDRING))) tirionFordring->AI()->Talk(SAY_STAGE_4_07); _updateTimer = 1*MINUTE*IN_MILLISECONDS; _instance->SetBossState(BOSS_ANUBARAK, SPECIAL); diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_king_dred.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_king_dred.cpp index 694e502e508..9c6d9082db4 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_king_dred.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_king_dred.cpp @@ -211,7 +211,7 @@ class npc_drakkari_gutripper : public CreatureScript void JustDied(Unit* /*killer*/) override { - if (Creature* Dred = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KING_DRED))) + if (Creature* Dred = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KING_DRED))) Dred->AI()->DoAction(ACTION_RAPTOR_KILLED); } }; @@ -267,7 +267,7 @@ class npc_drakkari_scytheclaw : public CreatureScript void JustDied(Unit* /*killer*/) override { - if (Creature* Dred = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KING_DRED))) + if (Creature* Dred = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KING_DRED))) Dred->AI()->DoAction(ACTION_RAPTOR_KILLED); } }; diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp index 6b26143745b..6c3b4378bec 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp @@ -216,7 +216,7 @@ public: void SetSummonerStatus(bool active) { for (uint8 i = 0; i < 4; i++) - if (uint64 guid = instance->GetData64(summoners[i].data)) + if (ObjectGuid guid = instance->GetGuidData(summoners[i].data)) if (Creature* crystalChannelTarget = ObjectAccessor::GetCreature(*me, guid)) { if (active) @@ -229,7 +229,7 @@ public: void SetCrystalsStatus(bool active) { for (uint8 i = 0; i < 4; i++) - if (uint64 guid = instance->GetData64(DATA_NOVOS_CRYSTAL_1 + i)) + if (ObjectGuid guid = instance->GetGuidData(DATA_NOVOS_CRYSTAL_1 + i)) if (GameObject* crystal = ObjectAccessor::GetGameObject(*me, guid)) SetCrystalStatus(crystal, active); } @@ -249,7 +249,7 @@ public: void CrystalHandlerDied() { for (uint8 i = 0; i < 4; i++) - if (uint64 guid = instance->GetData64(DATA_NOVOS_CRYSTAL_1 + i)) + if (ObjectGuid guid = instance->GetGuidData(DATA_NOVOS_CRYSTAL_1 + i)) if (GameObject* crystal = ObjectAccessor::GetGameObject(*me, guid)) if (crystal->GetGoState() == GO_STATE_ACTIVE) { @@ -266,7 +266,7 @@ public: if (IsHeroic()) events.ScheduleEvent(EVENT_SUMMON_MINIONS, 15000); } - else if (uint64 guid = instance->GetData64(DATA_NOVOS_SUMMONER_4)) + else if (ObjectGuid guid = instance->GetGuidData(DATA_NOVOS_SUMMONER_4)) if (Creature* crystalChannelTarget = ObjectAccessor::GetCreature(*me, guid)) crystalChannelTarget->AI()->SetData(SPELL_SUMMON_CRYSTAL_HANDLER, 15000); } @@ -330,7 +330,7 @@ public: void JustSummoned(Creature* summon) override { if (InstanceScript* instance = me->GetInstanceScript()) - if (uint64 guid = instance->GetData64(DATA_NOVOS)) + if (ObjectGuid guid = instance->GetGuidData(DATA_NOVOS)) if (Creature* novos = ObjectAccessor::GetCreature(*me, guid)) novos->AI()->JustSummoned(summon); diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp index a8f083c97ee..b91ca893955 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp @@ -135,7 +135,7 @@ class boss_trollgore : public CreatureScript break; case EVENT_SPAWN: for (uint8 i = 0; i < 3; ++i) - if (Creature* trigger = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TROLLGORE_INVADER_SUMMONER_1 + i))) + if (Creature* trigger = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TROLLGORE_INVADER_SUMMONER_1 + i))) trigger->CastSpell(trigger, RAND(SPELL_SUMMON_INVADER_A, SPELL_SUMMON_INVADER_B, SPELL_SUMMON_INVADER_C), true, NULL, NULL, me->GetGUID()); events.ScheduleEvent(EVENT_SPAWN, urand(30000, 40000)); diff --git a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp index 30b473b6ebc..4e58d4dac03 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp @@ -31,15 +31,6 @@ class instance_drak_tharon_keep : public InstanceMapScript { SetHeaders(DataHeader); SetBossNumber(EncounterCount); - - TrollgoreGUID = 0; - NovosGUID = 0; - KingDredGUID = 0; - TharonJaGUID = 0; - - memset(TrollgoreInvaderSummonerGuids, 0, 3 * sizeof(uint64)); - memset(NovosCrystalGUIDs, 0, 4 * sizeof(uint64)); - memset(NovosSummonerGUIDs, 0, 4 * sizeof(uint64)); } void OnCreatureCreate(Creature* creature) override @@ -122,7 +113,7 @@ class instance_drak_tharon_keep : public InstanceMapScript NovosSummonerGUIDs[3] = creature->GetGUID(); } - uint64 GetData64(uint32 type) const override + ObjectGuid GetGuidData(uint32 type) const override { switch (type) { @@ -150,7 +141,7 @@ class instance_drak_tharon_keep : public InstanceMapScript return NovosSummonerGUIDs[type - DATA_NOVOS_SUMMONER_1]; } - return 0; + return ObjectGuid::Empty; } void OnUnitDeath(Unit* unit) override @@ -161,14 +152,14 @@ class instance_drak_tharon_keep : public InstanceMapScript } protected: - uint64 TrollgoreGUID; - uint64 NovosGUID; - uint64 KingDredGUID; - uint64 TharonJaGUID; - - uint64 TrollgoreInvaderSummonerGuids[3]; - uint64 NovosCrystalGUIDs[4]; - uint64 NovosSummonerGUIDs[4]; + ObjectGuid TrollgoreGUID; + ObjectGuid NovosGUID; + ObjectGuid KingDredGUID; + ObjectGuid TharonJaGUID; + + ObjectGuid TrollgoreInvaderSummonerGuids[3]; + ObjectGuid NovosCrystalGUIDs[4]; + ObjectGuid NovosSummonerGUIDs[4]; }; InstanceScript* GetInstanceScript(InstanceMap* map) const override diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp index 670591a058c..77c97cc8342 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp @@ -203,8 +203,8 @@ class npc_corrupted_soul_fragment : public CreatureScript if (TempSummon* summ = me->ToTempSummon()) { - uint64 BronjahmGUID = instance->GetData64(DATA_BRONJAHM); - if (GUID_LOPART(BronjahmGUID) != id) + ObjectGuid BronjahmGUID(instance->GetGuidData(DATA_BRONJAHM)); + if (BronjahmGUID.GetCounter() != id) return; if (Creature* bronjahm = ObjectAccessor::GetCreature(*me, BronjahmGUID)) diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp index 4b4fd398e72..32590135f27 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp @@ -301,7 +301,7 @@ class boss_devourer_of_souls : public CreatureScript me->SetReactState(REACT_PASSIVE); //Remove any target - me->SetTarget(0); + me->SetTarget(ObjectGuid::Empty); me->GetMotionMaster()->Clear(); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp index f3034fa0796..97c9d407622 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp @@ -38,8 +38,6 @@ class instance_forge_of_souls : public InstanceMapScript { SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); - bronjahm = 0; - devourerOfSouls = 0; teamInInstance = 0; } @@ -96,7 +94,7 @@ class instance_forge_of_souls : public InstanceMapScript return 0; } - uint64 GetData64(uint32 type) const override + ObjectGuid GetGuidData(uint32 type) const override { switch (type) { @@ -108,12 +106,12 @@ class instance_forge_of_souls : public InstanceMapScript break; } - return 0; + return ObjectGuid::Empty; } private: - uint64 bronjahm; - uint64 devourerOfSouls; + ObjectGuid bronjahm; + ObjectGuid devourerOfSouls; uint32 teamInInstance; }; diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp index b4d1ee2f09b..555a75a33a7 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp @@ -347,8 +347,6 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript npc_jaina_or_sylvanas_intro_horAI(Creature* creature) : ScriptedAI(creature) { _instance = me->GetInstanceScript(); - _utherGUID = 0; - _lichkingGUID = 0; } void sGossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override @@ -376,8 +374,8 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript { _events.Reset(); - _utherGUID = 0; - _lichkingGUID = 0; + _utherGUID.Clear(); + _lichkingGUID.Clear(); me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER); me->SetStandState(UNIT_STAND_STATE_STAND); @@ -391,7 +389,7 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript switch (_events.ExecuteEvent()) { case EVENT_WALK_INTRO1: - if (Creature* korelnOrLoralen = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_KORELN_LORALEN))) + if (Creature* korelnOrLoralen = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_KORELN_LORALEN))) korelnOrLoralen->GetMotionMaster()->MovePoint(0, KorelnOrLoralenPos[0]); if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) @@ -415,7 +413,7 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER); break; case EVENT_START_INTRO: - if (Creature* korelnOrLoralen = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_KORELN_LORALEN))) + if (Creature* korelnOrLoralen = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_KORELN_LORALEN))) korelnOrLoralen->GetMotionMaster()->MovePoint(0, KorelnOrLoralenPos[1]); // Begining of intro is differents between factions as the speech sequence and timers are differents. if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) @@ -441,7 +439,7 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript case EVENT_INTRO_A2_3: me->CastSpell(me, SPELL_CAST_VISUAL, false); me->CastSpell(me, SPELL_FROSTMOURNE_SOUNDS, true); - _instance->HandleGameObject(_instance->GetData64(DATA_FROSTMOURNE), true); + _instance->HandleGameObject(_instance->GetGuidData(DATA_FROSTMOURNE), true); _events.ScheduleEvent(EVENT_INTRO_A2_4, 10000); break; case EVENT_INTRO_A2_4: @@ -533,7 +531,7 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript Talk(SAY_SYLVANAS_INTRO_3); me->CastSpell(me, SPELL_CAST_VISUAL, false); me->CastSpell(me, SPELL_FROSTMOURNE_SOUNDS, true); - _instance->HandleGameObject(_instance->GetData64(DATA_FROSTMOURNE), true); + _instance->HandleGameObject(_instance->GetGuidData(DATA_FROSTMOURNE), true); _events.ScheduleEvent(EVENT_INTRO_H2_4, 6000); break; case EVENT_INTRO_H2_4: @@ -627,7 +625,7 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript { uther->CastSpell(uther, SPELL_UTHER_DESPAWN, true); uther->DespawnOrUnsummon(5000); - _utherGUID = 0; + _utherGUID.Clear(); } _events.ScheduleEvent(EVENT_INTRO_LK_4, 9000); break; @@ -635,7 +633,7 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript // He steps forward and removes the runeblade from the heap of skulls. if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID)) { - if (GameObject* frostmourne = ObjectAccessor::GetGameObject(*me, _instance->GetData64(DATA_FROSTMOURNE))) + if (GameObject* frostmourne = ObjectAccessor::GetGameObject(*me, _instance->GetGuidData(DATA_FROSTMOURNE))) frostmourne->SetPhaseMask(2, true); lichking->CastSpell(lichking, SPELL_TAKE_FROSTMOURNE, true); lichking->CastSpell(lichking, SPELL_FROSTMOURNE_VISUAL, true); @@ -649,12 +647,12 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript break; case EVENT_INTRO_LK_6: // summon Falric and Marwyn. then go back to the door - if (Creature* falric = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_FALRIC))) + if (Creature* falric = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_FALRIC))) { falric->CastSpell(falric, SPELL_BOSS_SPAWN_AURA, true); falric->SetVisible(true); } - if (Creature* marwyn = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_MARWYN))) + if (Creature* marwyn = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_MARWYN))) { marwyn->CastSpell(marwyn, SPELL_BOSS_SPAWN_AURA, true); marwyn->SetVisible(true); @@ -669,7 +667,7 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript _events.ScheduleEvent(EVENT_OPEN_IMPENETRABLE_DOOR, 5000); break; case EVENT_INTRO_LK_7: - if (Creature* marwyn = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_MARWYN))) + if (Creature* marwyn = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_MARWYN))) { marwyn->AI()->Talk(SAY_MARWYN_INTRO_1); marwyn->SetWalk(true); @@ -678,7 +676,7 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript _events.ScheduleEvent(EVENT_INTRO_LK_8, 1000); break; case EVENT_INTRO_LK_8: - if (Creature* falric = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_FALRIC))) + if (Creature* falric = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_FALRIC))) { falric->AI()->Talk(SAY_FALRIC_INTRO_1); falric->SetWalk(true); @@ -687,7 +685,7 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript _events.ScheduleEvent(EVENT_INTRO_LK_9, 5000); break; case EVENT_INTRO_LK_9: - if (Creature* falric = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_FALRIC))) + if (Creature* falric = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_FALRIC))) falric->AI()->Talk(SAY_FALRIC_INTRO_2); _instance->ProcessEvent(0, EVENT_SPAWN_WAVES); _events.ScheduleEvent(EVENT_INTRO_LK_10, 4000); @@ -699,7 +697,7 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript Talk(SAY_SYLVANAS_INTRO_END); me->GetMotionMaster()->MovePoint(0, LichKingMoveAwayPos); /// @todo: needs some improvements - if (Creature* korelnOrLoralen = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_KORELN_LORALEN))) + if (Creature* korelnOrLoralen = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_KORELN_LORALEN))) korelnOrLoralen->GetMotionMaster()->MovePoint(1, KorelnOrLoralenPos[2]); _events.ScheduleEvent(EVENT_INTRO_LK_11, 5000); break; @@ -719,7 +717,7 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID)) { lichking->DespawnOrUnsummon(5000); - _lichkingGUID = 0; + _lichkingGUID.Clear(); } me->DespawnOrUnsummon(10000); _events.ScheduleEvent(EVENT_CLOSE_IMPENETRABLE_DOOR, 7000); @@ -730,7 +728,7 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript else me->GetMotionMaster()->MovePoint(0, SylvanasIntroPosition[2]); - if (Creature* korelnOrLoralen = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_KORELN_LORALEN))) + if (Creature* korelnOrLoralen = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_KORELN_LORALEN))) korelnOrLoralen->GetMotionMaster()->MovePoint(0, KorelnOrLoralenPos[1]); if (Creature* lichking = me->SummonCreature(NPC_THE_LICH_KING_INTRO, LichKingIntroPosition[0], TEMPSUMMON_MANUAL_DESPAWN)) @@ -745,13 +743,13 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript _events.ScheduleEvent(EVENT_INTRO_LK_4, 15000); break; case EVENT_OPEN_IMPENETRABLE_DOOR: - _instance->HandleGameObject(_instance->GetData64(DATA_IMPENETRABLE_DOOR), true); + _instance->HandleGameObject(_instance->GetGuidData(DATA_IMPENETRABLE_DOOR), true); break; case EVENT_CLOSE_IMPENETRABLE_DOOR: - _instance->HandleGameObject(_instance->GetData64(DATA_IMPENETRABLE_DOOR), false); + _instance->HandleGameObject(_instance->GetGuidData(DATA_IMPENETRABLE_DOOR), false); break; case EVENT_KORELN_LORALEN_DEATH: - if (Creature* korelnOrLoralen = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_KORELN_LORALEN))) + if (Creature* korelnOrLoralen = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_KORELN_LORALEN))) korelnOrLoralen->CastSpell(korelnOrLoralen, SPELL_FEIGN_DEATH); break; default: @@ -762,8 +760,8 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript private: InstanceScript* _instance; EventMap _events; - uint64 _utherGUID; - uint64 _lichkingGUID; + ObjectGuid _utherGUID; + ObjectGuid _lichkingGUID; }; CreatureAI* GetAI(Creature* creature) const override @@ -807,7 +805,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript void JustDied(Unit* /*killer*/) override { - if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING_ESCAPE))) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING_ESCAPE))) lichking->AI()->EnterEvadeMode(); // event failed } @@ -868,10 +866,10 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript else me->RemoveAurasDueToSpell(SPELL_SYLVANAS_DESTROY_ICE_WALL); - _instance->HandleGameObject(_instance->GetData64(DATA_ICEWALL), true); - me->m_Events.AddEvent(new GameObjectDeleteDelayEvent(me, _instance->GetData64(DATA_ICEWALL)), me->m_Events.CalculateTime(5000)); + _instance->HandleGameObject(_instance->GetGuidData(DATA_ICEWALL), true); + me->m_Events.AddEvent(new GameObjectDeleteDelayEvent(me, _instance->GetGuidData(DATA_ICEWALL)), me->m_Events.CalculateTime(5000)); - if (Creature* wallTarget = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_ICEWALL_TARGET))) + if (Creature* wallTarget = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_ICEWALL_TARGET))) wallTarget->DespawnOrUnsummon(); } @@ -879,7 +877,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript { if (_icewall < 4) { - if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING_ESCAPE))) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING_ESCAPE))) { lichking->StopMoving(); if (Creature* wallTarget = me->SummonCreature(NPC_ICE_WALL_TARGET, IceWallTargetPosition[_icewall], TEMPSUMMON_MANUAL_DESPAWN, 720000)) @@ -895,7 +893,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript if (_icewall < 4) Talk(SAY_JAINA_SYLVANAS_ESCAPE_2 + _icewall); - if (Creature* wallTarget = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_ICEWALL_TARGET))) + if (Creature* wallTarget = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_ICEWALL_TARGET))) me->SetFacingToObject(wallTarget); if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) @@ -925,7 +923,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript break; case POINT_TRAP: Talk(SAY_JAINA_SYLVANAS_ESCAPE_8); - if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING_ESCAPE))) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING_ESCAPE))) me->SetFacingToObject(lichking); break; default: @@ -933,7 +931,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript } } - void DeleteAllFromThreatList(Unit* target, uint64 except) + void DeleteAllFromThreatList(Unit* target, ObjectGuid except) { ThreatContainer::StorageType threatlist = target->getThreatManager().getThreatList(); for (auto i : threatlist) @@ -959,7 +957,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript else DoCast(me, SPELL_SYLVANAS_CLOAK_OF_DARKNESS); - if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING_ESCAPE))) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING_ESCAPE))) { me->CastSpell(lichking, SPELL_TAUNT_ARTHAS, true); lichking->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); @@ -971,7 +969,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER); break; case EVENT_ESCAPE_1: - if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING_ESCAPE))) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING_ESCAPE))) { if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) lichking->AI()->Talk(SAY_LK_ESCAPE_1); @@ -990,7 +988,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript else DoCast(me, SPELL_SYLVANAS_BLINDING_RETREAT, true); - if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING_ESCAPE))) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING_ESCAPE))) { lichking->SetReactState(REACT_PASSIVE); lichking->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); @@ -1010,7 +1008,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript DoCast(me, SPELL_CREDIT_FINDING_SYLVANAS); Talk(SAY_JAINA_SYLVANAS_ESCAPE_1); - if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING_ESCAPE))) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING_ESCAPE))) { lichking->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); lichking->RemoveAllAttackers(); @@ -1024,7 +1022,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript me->GetMotionMaster()->MovePoint(POINT_SHADOW_THRONE_DOOR, SylvanasShadowThroneDoorPosition); break; case EVENT_ESCAPE_6: - if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING_ESCAPE))) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING_ESCAPE))) { lichking->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_PACIFIED); @@ -1044,13 +1042,13 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript _events.ScheduleEvent(EVENT_ESCAPE_7, 1000); break; case EVENT_ESCAPE_7: - if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING_ESCAPE))) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING_ESCAPE))) lichking->HandleEmoteCommand(TEXT_EMOTE_ROAR); me->GetMotionMaster()->MovePoint(0, NpcJainaOrSylvanasEscapeRoute[0]); _events.ScheduleEvent(EVENT_ESCAPE_8, 3000); break; case EVENT_ESCAPE_8: - if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING_ESCAPE))) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING_ESCAPE))) lichking->GetMotionMaster()->MovePoint(0, NpcJainaOrSylvanasEscapeRoute[0]); _events.ScheduleEvent(EVENT_ESCAPE_9, 1000); break; @@ -1060,7 +1058,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript break; case EVENT_ESCAPE_10: me->GetMotionMaster()->MovePoint(0, NpcJainaOrSylvanasEscapeRoute[2]); - if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING_ESCAPE))) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING_ESCAPE))) lichking->GetMotionMaster()->MovePoint(1, LichKingFirstSummon); _events.ScheduleEvent(EVENT_ESCAPE_11, 6000); break; @@ -1069,7 +1067,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript _events.ScheduleEvent(EVENT_ESCAPE_12, 4000); break; case EVENT_ESCAPE_12: - if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING_ESCAPE))) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING_ESCAPE))) lichking->CastSpell(lichking, SPELL_PAIN_AND_SUFFERING, true); me->GetMotionMaster()->MovePoint(POINT_ATTACK_ICEWALL, NpcJainaOrSylvanasEscapeRoute[3]); @@ -1089,7 +1087,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript Talk(SAY_JAINA_SYLVANAS_ESCAPE_6); - if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING_ESCAPE))) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING_ESCAPE))) { lichking->GetMotionMaster()->MovePoint(2, LichKingFinalPos); lichking->RemoveAurasDueToSpell(SPELL_REMORSELESS_WINTER); @@ -1100,7 +1098,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript me->RemoveAurasDueToSpell(SPELL_HARVEST_SOUL); if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) Talk(SAY_JAINA_ESCAPE_9); - if (Transport* gunship = ObjectAccessor::GetTransport(*me, _instance->GetData64(DATA_GUNSHIP))) + if (Transport* gunship = ObjectAccessor::GetTransport(*me, _instance->GetGuidData(DATA_GUNSHIP))) gunship->EnableMovement(true); _instance->SetBossState(DATA_THE_LICH_KING_ESCAPE, DONE); break; @@ -1163,16 +1161,16 @@ class npc_the_lich_king_escape_hor : public CreatureScript switch (pointId) { case 1: - if (Creature* target = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_ESCAPE_LEADER))) + if (Creature* target = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_ESCAPE_LEADER))) me->GetMotionMaster()->MoveChase(target); break; case 2: Talk(SAY_LK_ESCAPE_HARVEST_SOUL); - if (Creature* target = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_ESCAPE_LEADER))) + if (Creature* target = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_ESCAPE_LEADER))) DoCast(target, SPELL_HARVEST_SOUL); - if (Transport* gunship = ObjectAccessor::GetTransport(*me, _instance->GetData64(DATA_GUNSHIP))) + if (Transport* gunship = ObjectAccessor::GetTransport(*me, _instance->GetGuidData(DATA_GUNSHIP))) gunship->EnableMovement(true); break; default: @@ -1197,7 +1195,7 @@ class npc_the_lich_king_escape_hor : public CreatureScript // All summons dead and no summon events scheduled if (!_summonsCount && _events.Empty()) { - if (Creature* jainaOrSylvanas = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_ESCAPE_LEADER))) + if (Creature* jainaOrSylvanas = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_ESCAPE_LEADER))) jainaOrSylvanas->AI()->DoAction(ACTION_WALL_BROKEN); } } @@ -2023,12 +2021,12 @@ class at_hor_waves_restarter : public AreaTriggerScript { _instance->ProcessEvent(0, EVENT_SPAWN_WAVES); - if (Creature* falric = ObjectAccessor::GetCreature(*player, _instance->GetData64(DATA_FALRIC))) + if (Creature* falric = ObjectAccessor::GetCreature(*player, _instance->GetGuidData(DATA_FALRIC))) { falric->CastSpell(falric, SPELL_BOSS_SPAWN_AURA, true); falric->SetVisible(true); } - if (Creature* marwyn = ObjectAccessor::GetCreature(*player, _instance->GetData64(DATA_MARWYN))) + if (Creature* marwyn = ObjectAccessor::GetCreature(*player, _instance->GetGuidData(DATA_MARWYN))) { marwyn->CastSpell(marwyn, SPELL_BOSS_SPAWN_AURA, true); marwyn->SetVisible(true); @@ -2133,7 +2131,7 @@ struct npc_escape_event_trash : public ScriptedAI void IsSummonedBy(Unit* /*summoner*/) override { DoZoneInCombat(me, 0.0f); - if (Creature* leader = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_ESCAPE_LEADER))) + if (Creature* leader = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_ESCAPE_LEADER))) { me->SetInCombatWith(leader); leader->SetInCombatWith(me); diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h index 578cf4f84fa..e44bf1d5aed 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h @@ -213,7 +213,7 @@ struct boss_horAI : BossAI class GameObjectDeleteDelayEvent : public BasicEvent { public: - GameObjectDeleteDelayEvent(Unit* owner, uint64 gameObjectGUID) : _owner(owner), _gameObjectGUID(gameObjectGUID) { } + GameObjectDeleteDelayEvent(Unit* owner, ObjectGuid gameObjectGUID) : _owner(owner), _gameObjectGUID(gameObjectGUID) { } void DeleteGameObject() { @@ -234,7 +234,7 @@ class GameObjectDeleteDelayEvent : public BasicEvent private: Unit* _owner; - uint64 _gameObjectGUID; + ObjectGuid _gameObjectGUID; }; template<class AI> diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp index 51502b8a336..9dbc801f76d 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp @@ -85,27 +85,6 @@ class instance_halls_of_reflection : public InstanceMapScript SetHeaders(DataHeader); SetBossNumber(EncounterCount); - JainaOrSylvanasIntroGUID = 0; - KorelnOrLoralenGUID = 0; - TheLichkingIntroGUID = 0; - FalricGUID = 0; - MarwynGUID = 0; - FrostmourneAltarBunnyGUID = 0; - FrostswornGeneralGUID = 0; - JainaOrSylvanasEscapeGUID = 0; - TheLichKingEscapeGUID = 0; - - FrostmourneGUID = 0; - EntranceDoorGUID = 0; - ImpenetrableDoorGUID = 0; - ShadowThroneDoorGUID = 0; - CaveInGUID = 0; - GunshipGUID = 0; - CaptainsChestGUID = 0; - CaptainGUID = 0; - IcewallGUID = 0; - IcewallTargetGUID = 0; - _teamInInstance = 0; _waveCount = 0; _introState = NOT_STARTED; @@ -200,7 +179,7 @@ class instance_halls_of_reflection : public InstanceMapScript break; } case NPC_ICE_WALL_TARGET: - IcewallTargetGUID = 0; + IcewallTargetGUID.Clear(); break; case NPC_WORLD_TRIGGER: case NPC_GUNSHIP_CANNON_HORDE: @@ -256,11 +235,11 @@ class instance_halls_of_reflection : public InstanceMapScript break; case GO_IMPENETRABLE_DOOR: ImpenetrableDoorGUID = go->GetGUID(); - HandleGameObject(0, GetBossState(DATA_MARWYN) == DONE, go); + HandleGameObject(ObjectGuid::Empty, GetBossState(DATA_MARWYN) == DONE, go); break; case GO_SHADOW_THRONE_DOOR: ShadowThroneDoorGUID = go->GetGUID(); - HandleGameObject(0, GetData(DATA_FROSTSWORN_GENERAL) == DONE, go); + HandleGameObject(ObjectGuid::Empty, GetData(DATA_FROSTSWORN_GENERAL) == DONE, go); break; case GO_CAVE_IN: CaveInGUID = go->GetGUID(); @@ -282,7 +261,7 @@ class instance_halls_of_reflection : public InstanceMapScript CaptainsChestGUID = go->GetGUID(); break; case GO_ICE_WALL: - HandleGameObject(0, false, go); + HandleGameObject(ObjectGuid::Empty, false, go); IcewallGUID = go->GetGUID(); break; default: @@ -483,7 +462,7 @@ class instance_halls_of_reflection : public InstanceMapScript case NPC_WAVE_MAGE: { uint32 waveId = creature->AI()->GetData(0); - for (uint64 guid : waveGuidList[waveId]) + for (ObjectGuid guid : waveGuidList[waveId]) { if (Creature* npc = instance->GetCreature(guid)) if (npc->IsAlive()) @@ -539,7 +518,7 @@ class instance_halls_of_reflection : public InstanceMapScript { tempList = possibilityList; - uint64 bossGuid = i <= 3 ? FalricGUID : MarwynGUID; + ObjectGuid bossGuid = i <= 3 ? FalricGUID : MarwynGUID; if (!i) Trinity::Containers::RandomResizeList(tempList, 3); @@ -571,7 +550,7 @@ class instance_halls_of_reflection : public InstanceMapScript if (_waveCount % 5) { uint32 internalWaveId = _waveCount - ((_waveCount < 5) ? 1 : 2); - for (uint64 guid : waveGuidList[internalWaveId]) + for (ObjectGuid guid : waveGuidList[internalWaveId]) { if (Creature* temp = instance->GetCreature(guid)) { @@ -610,7 +589,7 @@ class instance_halls_of_reflection : public InstanceMapScript // despawn wave npcs for (uint8 i = 0; i < 8; ++i) { - for (uint64 guid : waveGuidList[i]) + for (ObjectGuid guid : waveGuidList[i]) if (Creature* creature = instance->GetCreature(guid)) creature->DespawnOrUnsummon(1); waveGuidList[i].clear(); @@ -630,9 +609,9 @@ class instance_halls_of_reflection : public InstanceMapScript if (Creature* captain = instance->GetCreature(CaptainGUID)) captain->AI()->Talk(SAY_CAPTAIN_FIRE); - for (uint64 guid : GunshipCannonGUIDs) + for (ObjectGuid guid : GunshipCannonGUIDs) { - uint32 entry = GUID_ENPART(guid); + uint32 entry = guid.GetEntry(); if ((entry == NPC_WORLD_TRIGGER && _teamInInstance == ALLIANCE) || (entry == NPC_GUNSHIP_CANNON_HORDE && _teamInInstance == HORDE)) if (Creature* cannon = instance->GetCreature(guid)) cannon->CastSpell(cannon, SPELL_GUNSHIP_CANNON_FIRE, true); @@ -642,7 +621,7 @@ class instance_halls_of_reflection : public InstanceMapScript if (Transport* gunship = instance->GetTransport(GunshipGUID)) gunship->EnableMovement(false); - for (uint64 guid : GunshipStairGUIDs) + for (ObjectGuid guid : GunshipStairGUIDs) if (GameObject* stairs = instance->GetGameObject(guid)) stairs->SetRespawnTime(DAY); @@ -677,7 +656,7 @@ class instance_halls_of_reflection : public InstanceMapScript return 0; } - uint64 GetData64(uint32 type) const override + ObjectGuid GetGuidData(uint32 type) const override { switch (type) { @@ -707,7 +686,7 @@ class instance_halls_of_reflection : public InstanceMapScript break; } - return 0; + return ObjectGuid::Empty; } void WriteSaveDataMore(std::ostringstream& data) override @@ -732,21 +711,21 @@ class instance_halls_of_reflection : public InstanceMapScript } private: - uint64 JainaOrSylvanasIntroGUID; // unused - uint64 KorelnOrLoralenGUID; - uint64 TheLichkingIntroGUID; // unused - uint64 FalricGUID; - uint64 MarwynGUID; - uint64 FrostmourneAltarBunnyGUID; - uint64 FrostswornGeneralGUID; - uint64 JainaOrSylvanasEscapeGUID; - uint64 TheLichKingEscapeGUID; - - uint64 FrostmourneGUID; - uint64 EntranceDoorGUID; - uint64 ImpenetrableDoorGUID; - uint64 ShadowThroneDoorGUID; - uint64 CaveInGUID; + ObjectGuid JainaOrSylvanasIntroGUID; // unused + ObjectGuid KorelnOrLoralenGUID; + ObjectGuid TheLichkingIntroGUID; // unused + ObjectGuid FalricGUID; + ObjectGuid MarwynGUID; + ObjectGuid FrostmourneAltarBunnyGUID; + ObjectGuid FrostswornGeneralGUID; + ObjectGuid JainaOrSylvanasEscapeGUID; + ObjectGuid TheLichKingEscapeGUID; + + ObjectGuid FrostmourneGUID; + ObjectGuid EntranceDoorGUID; + ObjectGuid ImpenetrableDoorGUID; + ObjectGuid ShadowThroneDoorGUID; + ObjectGuid CaveInGUID; uint32 _teamInInstance; uint32 _waveCount; @@ -754,16 +733,16 @@ class instance_halls_of_reflection : public InstanceMapScript uint32 _frostswornGeneralState; EventMap events; - std::set<uint64> waveGuidList[8]; + GuidSet waveGuidList[8]; - uint64 GunshipGUID; - uint64 CaptainsChestGUID; - uint64 CaptainGUID; - uint64 IcewallGUID; - uint64 IcewallTargetGUID; + ObjectGuid GunshipGUID; + ObjectGuid CaptainsChestGUID; + ObjectGuid CaptainGUID; + ObjectGuid IcewallGUID; + ObjectGuid IcewallTargetGUID; - std::set<uint64> GunshipCannonGUIDs; - std::set<uint64> GunshipStairGUIDs; + GuidSet GunshipCannonGUIDs; + GuidSet GunshipStairGUIDs; }; InstanceScript* GetInstanceScript(InstanceMap* map) const override diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp index 62a6ac41074..3ac5ec3070a 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp @@ -121,7 +121,7 @@ class boss_garfrost : public CreatureScript Talk(SAY_DEATH); me->RemoveAllGameObjects(); - if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TYRANNUS))) + if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TYRANNUS))) tyrannus->AI()->Talk(SAY_TYRANNUS_DEATH); } diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp index 5b147344a59..327ea2c9b7b 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp @@ -151,7 +151,7 @@ class boss_ick : public CreatureScript Creature* GetKrick() { - return ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KRICK)); + return ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KRICK)); } void EnterCombat(Unit* /*who*/) override @@ -293,8 +293,8 @@ class boss_krick : public CreatureScript void Initialize() { _phase = PHASE_COMBAT; - _outroNpcGUID = 0; - _tyrannusGUID = 0; + _outroNpcGUID.Clear(); + _tyrannusGUID.Clear(); } void Reset() override @@ -308,7 +308,7 @@ class boss_krick : public CreatureScript Creature* GetIck() { - return ObjectAccessor::GetCreature(*me, _instanceScript->GetData64(DATA_ICK)); + return ObjectAccessor::GetCreature(*me, _instanceScript->GetGuidData(DATA_ICK)); } void KilledUnit(Unit* victim) override @@ -333,7 +333,7 @@ class boss_krick : public CreatureScript { if (actionId == ACTION_OUTRO) { - Creature* tyrannusPtr = ObjectAccessor::GetCreature(*me, _instanceScript->GetData64(DATA_TYRANNUS_EVENT)); + Creature* tyrannusPtr = ObjectAccessor::GetCreature(*me, _instanceScript->GetGuidData(DATA_TYRANNUS_EVENT)); if (tyrannusPtr) tyrannusPtr->NearTeleportTo(outroPos[1].GetPositionX(), outroPos[1].GetPositionY(), outroPos[1].GetPositionZ(), outroPos[1].GetOrientation()); else @@ -369,7 +369,7 @@ class boss_krick : public CreatureScript { case EVENT_OUTRO_1: { - if (Creature* temp = ObjectAccessor::GetCreature(*me, _instanceScript->GetData64(DATA_JAINA_SYLVANAS_1))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, _instanceScript->GetGuidData(DATA_JAINA_SYLVANAS_1))) temp->DespawnOrUnsummon(); Creature* jainaOrSylvanas = NULL; @@ -417,7 +417,7 @@ class boss_krick : public CreatureScript _events.ScheduleEvent(EVENT_OUTRO_6, 1000); break; case EVENT_OUTRO_6: - if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _instanceScript->GetData64(DATA_TYRANNUS_EVENT))) + if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _instanceScript->GetGuidData(DATA_TYRANNUS_EVENT))) { tyrannus->SetSpeed(MOVE_FLIGHT, 3.5f, true); tyrannus->GetMotionMaster()->MovePoint(1, outroPos[4]); @@ -494,8 +494,8 @@ class boss_krick : public CreatureScript EventMap _events; KrickPhase _phase; - uint64 _outroNpcGUID; - uint64 _tyrannusGUID; + ObjectGuid _outroNpcGUID; + ObjectGuid _tyrannusGUID; }; CreatureAI* GetAI(Creature* creature) const override diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp index f392b21b173..c2b1b91a200 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp @@ -153,7 +153,7 @@ class boss_tyrannus : public CreatureScript Creature* GetRimefang() { - return ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_RIMEFANG)); + return ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_RIMEFANG)); } void EnterCombat(Unit* /*who*/) override @@ -235,7 +235,7 @@ class boss_tyrannus : public CreatureScript me->GetMotionMaster()->MovePoint(0, miscPos); break; case EVENT_COMBAT_START: - if (Creature* rimefang = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_RIMEFANG))) + if (Creature* rimefang = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_RIMEFANG))) rimefang->AI()->DoAction(ACTION_START_RIMEFANG); //set rimefang also infight events.SetPhase(PHASE_COMBAT); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); @@ -299,7 +299,7 @@ class boss_rimefang : public CreatureScript void Initialize() { _currentWaypoint = 0; - _hoarfrostTargetGUID = 0; + _hoarfrostTargetGUID.Clear(); } void Reset() override @@ -330,7 +330,7 @@ class boss_rimefang : public CreatureScript _EnterEvadeMode(); } - void SetGUID(uint64 guid, int32 type) override + void SetGUID(ObjectGuid guid, int32 type) override { if (type == GUID_HOARFROST) { @@ -366,7 +366,7 @@ class boss_rimefang : public CreatureScript if (Unit* target = ObjectAccessor::GetUnit(*me, _hoarfrostTargetGUID)) { DoCast(target, SPELL_HOARFROST); - _hoarfrostTargetGUID = 0; + _hoarfrostTargetGUID.Clear(); } break; default: @@ -377,7 +377,7 @@ class boss_rimefang : public CreatureScript private: Vehicle* _vehicle; - uint64 _hoarfrostTargetGUID; + ObjectGuid _hoarfrostTargetGUID; EventMap _events; uint8 _currentWaypoint; }; @@ -391,7 +391,7 @@ class boss_rimefang : public CreatureScript class player_overlord_brandAI : public PlayerAI { public: - player_overlord_brandAI(Player* player, uint64 casterGUID) : PlayerAI(player), _tyrannusGUID(casterGUID) { } + player_overlord_brandAI(Player* player, ObjectGuid casterGUID) : PlayerAI(player), _tyrannusGUID(casterGUID) { } void DamageDealt(Unit* /*victim*/, uint32& damage, DamageEffectType /*damageType*/) override { @@ -409,7 +409,7 @@ class player_overlord_brandAI : public PlayerAI void UpdateAI(uint32 /*diff*/) override { } private: - uint64 _tyrannusGUID; + ObjectGuid _tyrannusGUID; }; class spell_tyrannus_overlord_brand : public SpellScriptLoader @@ -480,7 +480,7 @@ class spell_tyrannus_mark_of_rimefang : public SpellScriptLoader return; if (InstanceScript* instance = caster->GetInstanceScript()) - if (Creature* rimefang = ObjectAccessor::GetCreature(*caster, instance->GetData64(DATA_RIMEFANG))) + if (Creature* rimefang = ObjectAccessor::GetCreature(*caster, instance->GetGuidData(DATA_RIMEFANG))) rimefang->AI()->SetGUID(GetTarget()->GetGUID(), GUID_HOARFROST); } @@ -545,7 +545,7 @@ class at_tyrannus_event_starter : public AreaTriggerScript return false; if (instance->GetBossState(DATA_TYRANNUS) != IN_PROGRESS && instance->GetBossState(DATA_TYRANNUS) != DONE) - if (Creature* tyrannus = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_TYRANNUS))) + if (Creature* tyrannus = ObjectAccessor::GetCreature(*player, instance->GetGuidData(DATA_TYRANNUS))) { tyrannus->AI()->DoAction(ACTION_START_INTRO); return true; diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp index d829b98f926..29fbc0be2b3 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp @@ -44,15 +44,7 @@ class instance_pit_of_saron : public InstanceMapScript SetHeaders(DataHeader); SetBossNumber(EncounterCount); LoadDoorData(Doors); - _garfrostGUID = 0; - _krickGUID = 0; - _ickGUID = 0; - _tyrannusGUID = 0; - _rimefangGUID = 0; - _jainaOrSylvanas1GUID = 0; - _jainaOrSylvanas2GUID = 0; _teamInInstance = 0; - _tyrannusEventGUID = 0; } void OnPlayerEnter(Player* player) override @@ -239,7 +231,7 @@ class instance_pit_of_saron : public InstanceMapScript return 0; } - uint64 GetData64(uint32 type) const override + ObjectGuid GetGuidData(uint32 type) const override { switch (type) { @@ -263,19 +255,19 @@ class instance_pit_of_saron : public InstanceMapScript break; } - return 0; + return ObjectGuid::Empty; } private: - uint64 _garfrostGUID; - uint64 _krickGUID; - uint64 _ickGUID; - uint64 _tyrannusGUID; - uint64 _rimefangGUID; + ObjectGuid _garfrostGUID; + ObjectGuid _krickGUID; + ObjectGuid _ickGUID; + ObjectGuid _tyrannusGUID; + ObjectGuid _rimefangGUID; - uint64 _tyrannusEventGUID; - uint64 _jainaOrSylvanas1GUID; - uint64 _jainaOrSylvanas2GUID; + ObjectGuid _tyrannusEventGUID; + ObjectGuid _jainaOrSylvanas1GUID; + ObjectGuid _jainaOrSylvanas2GUID; uint32 _teamInInstance; }; diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp index 4d2ebd44db8..062d6a13390 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp @@ -230,7 +230,7 @@ class spell_trash_npc_glacial_strike : public SpellScriptLoader { if (GetTarget()->IsFullHealth()) { - GetTarget()->RemoveAura(GetId(), 0, 0, AURA_REMOVE_BY_ENEMY_SPELL); + GetTarget()->RemoveAura(GetId(), ObjectGuid::Empty, 0, AURA_REMOVE_BY_ENEMY_SPELL); PreventDefaultAction(); } } diff --git a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp index 001f19679c4..e3daf32212a 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp @@ -278,7 +278,7 @@ class boss_drakkari_elemental : public CreatureScript if (killer == me) return; - if (Creature* colossus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DRAKKARI_COLOSSUS))) + if (Creature* colossus = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DRAKKARI_COLOSSUS))) killer->Kill(colossus); } @@ -314,7 +314,7 @@ class boss_drakkari_elemental : public CreatureScript { case ACTION_RETURN_TO_COLOSSUS: DoCast(SPELL_SURGE_VISUAL); - if (Creature* colossus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DRAKKARI_COLOSSUS))) + if (Creature* colossus = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DRAKKARI_COLOSSUS))) // what if the elemental is more than 80 yards from drakkari colossus ? DoCast(colossus, SPELL_MERGE, true); break; @@ -325,7 +325,7 @@ class boss_drakkari_elemental : public CreatureScript { if (HealthBelowPct(50) && instance) { - if (Creature* colossus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DRAKKARI_COLOSSUS))) + if (Creature* colossus = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DRAKKARI_COLOSSUS))) { if (colossus->AI()->GetData(DATA_COLOSSUS_PHASE) == COLOSSUS_PHASE_FIRST_ELEMENTAL_SUMMON) { @@ -429,7 +429,7 @@ public: if (id == 1) { - if (Creature* colossus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DRAKKARI_COLOSSUS))) + if (Creature* colossus = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DRAKKARI_COLOSSUS))) { colossus->AI()->DoAction(ACTION_UNFREEZE_COLOSSUS); if (!colossus->AI()->GetData(DATA_INTRO_DONE)) @@ -446,7 +446,7 @@ public: return; // we do this checks to see if the creature is one of the creatures that sorround the boss - if (Creature* colossus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DRAKKARI_COLOSSUS))) + if (Creature* colossus = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DRAKKARI_COLOSSUS))) { Position homePosition = me->GetHomePosition(); diff --git a/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp b/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp index 22e7ac280fd..992de8c5402 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp @@ -104,7 +104,7 @@ public: uint32 uiImpalingChargeTimer; uint32 uiStompTimer; uint32 uiTransformationTimer; - std::list<uint64> impaledList; + GuidList impaledList; uint8 shareTheLove; CombatPhase Phase; @@ -247,10 +247,10 @@ public: } // 5 UNIQUE party members - void CheckAchievement(uint64 guid) + void CheckAchievement(ObjectGuid guid) { bool playerExists = false; - for (std::list<uint64>::iterator itr = impaledList.begin(); itr != impaledList.end(); ++itr) + for (GuidList::iterator itr = impaledList.begin(); itr != impaledList.end(); ++itr) if (guid != *itr) playerExists = true; diff --git a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp index 5db49415604..6c247b08097 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp @@ -103,7 +103,7 @@ public: uint8 uiPhase; - std::set<uint64> lWrappedPlayers; + GuidSet lWrappedPlayers; SummonList lSummons; InstanceScript* instance; @@ -199,13 +199,13 @@ public: lSummons.Summon(summoned); } - void SetGUID(uint64 guid, int32 type) override + void SetGUID(ObjectGuid guid, int32 type) override { if (type == DATA_SNAKES_WHYD_IT_HAVE_TO_BE_SNAKES) lWrappedPlayers.insert(guid); } - bool WasWrapped(uint64 guid) + bool WasWrapped(ObjectGuid guid) { return lWrappedPlayers.count(guid) != 0; } diff --git a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp index 388d43e8dca..0fa26a3dee3 100644 --- a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp +++ b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp @@ -56,28 +56,28 @@ public: uint32 timer; uint32 phase; - uint64 toActivate; - - uint64 sladRanGUID; - uint64 moorabiGUID; - uint64 drakkariColossusGUID; - uint64 galDarahGUID; - uint64 eckTheFerociousGUID; - - uint64 sladRanAltarGUID; - uint64 moorabiAltarGUID; - uint64 drakkariColossusAltarGUID; - uint64 sladRanStatueGUID; - uint64 moorabiStatueGUID; - uint64 drakkariColossusStatueGUID; - uint64 galDarahStatueGUID; - uint64 eckTheFerociousDoorGUID; - uint64 eckTheFerociousDoorBehindGUID; - uint64 galDarahDoor1GUID; - uint64 galDarahDoor2GUID; - uint64 galDarahDoor3GUID; - uint64 bridgeGUID; - uint64 collisionGUID; + ObjectGuid toActivate; + + ObjectGuid sladRanGUID; + ObjectGuid moorabiGUID; + ObjectGuid drakkariColossusGUID; + ObjectGuid galDarahGUID; + ObjectGuid eckTheFerociousGUID; + + ObjectGuid sladRanAltarGUID; + ObjectGuid moorabiAltarGUID; + ObjectGuid drakkariColossusAltarGUID; + ObjectGuid sladRanStatueGUID; + ObjectGuid moorabiStatueGUID; + ObjectGuid drakkariColossusStatueGUID; + ObjectGuid galDarahStatueGUID; + ObjectGuid eckTheFerociousDoorGUID; + ObjectGuid eckTheFerociousDoorBehindGUID; + ObjectGuid galDarahDoor1GUID; + ObjectGuid galDarahDoor2GUID; + ObjectGuid galDarahDoor3GUID; + ObjectGuid bridgeGUID; + ObjectGuid collisionGUID; uint32 m_auiEncounter[MAX_ENCOUNTER]; @@ -88,7 +88,7 @@ public: GOState bridgeState; GOState collisionState; - std::set<uint64> DwellerGUIDs; + GuidSet DwellerGUIDs; std::string str_data; @@ -98,31 +98,6 @@ public: timer = 0; phase = 0; - toActivate = 0; - - sladRanGUID = 0; - moorabiGUID = 0; - drakkariColossusGUID = 0; - galDarahGUID = 0; - eckTheFerociousGUID = 0; - - sladRanAltarGUID = 0; - moorabiAltarGUID = 0; - drakkariColossusAltarGUID = 0; - - sladRanStatueGUID = 0; - moorabiStatueGUID = 0; - drakkariColossusStatueGUID = 0; - galDarahStatueGUID = 0; - - eckTheFerociousDoorGUID = 0; - eckTheFerociousDoorBehindGUID = 0; - galDarahDoor1GUID = 0; - galDarahDoor2GUID = 0; - galDarahDoor3GUID = 0; - - bridgeGUID = 0; - collisionGUID = 0; sladRanStatueState = GO_STATE_ACTIVE; moorabiStatueState = GO_STATE_ACTIVE; @@ -131,8 +106,6 @@ public: bridgeState = GO_STATE_ACTIVE; collisionState = GO_STATE_READY; - DwellerGUIDs.clear(); - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); } @@ -239,22 +212,22 @@ public: case GO_ECK_THE_FEROCIOUS_DOOR: eckTheFerociousDoorGUID = go->GetGUID(); if (isHeroic && m_auiEncounter[1] == DONE) - HandleGameObject(0, true, go); + HandleGameObject(ObjectGuid::Empty, true, go); break; case GO_ECK_THE_FEROCIOUS_DOOR_BEHIND: eckTheFerociousDoorBehindGUID = go->GetGUID(); if (isHeroic && m_auiEncounter[4] == DONE) - HandleGameObject(0, true, go); + HandleGameObject(ObjectGuid::Empty, true, go); break; case GO_GALDARAH_DOOR1: galDarahDoor1GUID = go->GetGUID(); if (m_auiEncounter[3] == DONE) - HandleGameObject(0, true, go); + HandleGameObject(ObjectGuid::Empty, true, go); break; case GO_GALDARAH_DOOR2: galDarahDoor2GUID = go->GetGUID(); if (m_auiEncounter[3] == DONE) - HandleGameObject(0, true, go); + HandleGameObject(ObjectGuid::Empty, true, go); break; case GO_BRIDGE: bridgeGUID = go->GetGUID(); @@ -340,7 +313,7 @@ public: SaveToDB(); } - void SetData64(uint32 type, uint64 data) override + void SetGuidData(uint32 type, ObjectGuid data) override { if (type == DATA_STATUE_ACTIVATE) { @@ -369,7 +342,7 @@ public: return 0; } - uint64 GetData64(uint32 type) const override + ObjectGuid GetGuidData(uint32 type) const override { switch (type) { @@ -391,7 +364,7 @@ public: return toActivate; } - return 0; + return ObjectGuid::Empty; } std::string GetSaveData() override @@ -476,7 +449,7 @@ public: GameObject* drakkariColossusStatue = instance->GetGameObject(drakkariColossusStatueGUID); GameObject* galDarahStatue = instance->GetGameObject(galDarahStatueGUID); - toActivate = 0; + toActivate.Clear(); if (bridge && collision && sladRanStatue && moorabiStatue && drakkariColossusStatue && galDarahStatue) { @@ -525,10 +498,10 @@ public: if (GameObject* statueGO = instance->GetGameObject(toActivate)) statueGO->SetGoState(GO_STATE_READY); - toActivate = 0; + toActivate.Clear(); if (phase == 3) - SetData64(DATA_STATUE_ACTIVATE, bridgeGUID); + SetGuidData(DATA_STATUE_ACTIVATE, bridgeGUID); else SaveToDB(); // Don't save in between last statue and bridge turning in case of crash leading to stuck instance } @@ -537,7 +510,7 @@ public: timer -= diff; } - GOState GetObjState(uint64 guid) + GOState GetObjState(ObjectGuid guid) { if (GameObject* go = instance->GetGameObject(guid)) return go->GetGoState(); @@ -555,7 +528,7 @@ public: bool OnGossipHello(Player* /*player*/, GameObject* go) override { InstanceScript* instance = go->GetInstanceScript(); - uint64 statueGUID = 0; + ObjectGuid statueGUID; go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); go->SetGoState(GO_STATE_ACTIVE); @@ -565,19 +538,19 @@ public: switch (go->GetEntry()) { case GO_SLADRAN_ALTAR: - statueGUID = instance->GetData64(DATA_SLAD_RAN_STATUE); + statueGUID = instance->GetGuidData(DATA_SLAD_RAN_STATUE); break; case GO_MOORABI_ALTAR: - statueGUID = instance->GetData64(DATA_MOORABI_STATUE); + statueGUID = instance->GetGuidData(DATA_MOORABI_STATUE); break; case GO_DRAKKARI_COLOSSUS_ALTAR: - statueGUID = instance->GetData64(DATA_DRAKKARI_COLOSSUS_STATUE); + statueGUID = instance->GetGuidData(DATA_DRAKKARI_COLOSSUS_STATUE); break; } - if (!instance->GetData64(DATA_STATUE_ACTIVATE)) + if (!instance->GetGuidData(DATA_STATUE_ACTIVATE)) { - instance->SetData64(DATA_STATUE_ACTIVATE, statueGUID); + instance->SetGuidData(DATA_STATUE_ACTIVATE, statueGUID); go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); go->SetGoState(GO_STATE_ACTIVE); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp index 4b3c50d1388..640c06b1c28 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp @@ -216,19 +216,19 @@ class boss_blood_council_controller : public CreatureScript DoCast(me, SPELL_INVOCATION_OF_BLOOD_VALANAR); - if (Creature* keleseth = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_KELESETH_GUID))) + if (Creature* keleseth = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PRINCE_KELESETH_GUID))) { instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, keleseth); DoZoneInCombat(keleseth); } - if (Creature* taldaram = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_TALDARAM_GUID))) + if (Creature* taldaram = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PRINCE_TALDARAM_GUID))) { instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, taldaram); DoZoneInCombat(taldaram); } - if (Creature* valanar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_VALANAR_GUID))) + if (Creature* valanar = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PRINCE_VALANAR_GUID))) { instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, valanar); DoZoneInCombat(valanar); @@ -236,16 +236,16 @@ class boss_blood_council_controller : public CreatureScript events.ScheduleEvent(EVENT_INVOCATION_OF_BLOOD, 46500); - _invocationOrder[0] = InvocationData(instance->GetData64(DATA_PRINCE_VALANAR_GUID), SPELL_INVOCATION_OF_BLOOD_VALANAR, EMOTE_VALANAR_INVOCATION, 71070); + _invocationOrder[0] = InvocationData(instance->GetGuidData(DATA_PRINCE_VALANAR_GUID), SPELL_INVOCATION_OF_BLOOD_VALANAR, EMOTE_VALANAR_INVOCATION, 71070); if (urand(0, 1)) { - _invocationOrder[1] = InvocationData(instance->GetData64(DATA_PRINCE_TALDARAM_GUID), SPELL_INVOCATION_OF_BLOOD_TALDARAM, EMOTE_TALDARAM_INVOCATION, 71081); - _invocationOrder[2] = InvocationData(instance->GetData64(DATA_PRINCE_KELESETH_GUID), SPELL_INVOCATION_OF_BLOOD_KELESETH, EMOTE_KELESETH_INVOCATION, 71080); + _invocationOrder[1] = InvocationData(instance->GetGuidData(DATA_PRINCE_TALDARAM_GUID), SPELL_INVOCATION_OF_BLOOD_TALDARAM, EMOTE_TALDARAM_INVOCATION, 71081); + _invocationOrder[2] = InvocationData(instance->GetGuidData(DATA_PRINCE_KELESETH_GUID), SPELL_INVOCATION_OF_BLOOD_KELESETH, EMOTE_KELESETH_INVOCATION, 71080); } else { - _invocationOrder[1] = InvocationData(instance->GetData64(DATA_PRINCE_KELESETH_GUID), SPELL_INVOCATION_OF_BLOOD_KELESETH, EMOTE_KELESETH_INVOCATION, 71080); - _invocationOrder[2] = InvocationData(instance->GetData64(DATA_PRINCE_TALDARAM_GUID), SPELL_INVOCATION_OF_BLOOD_TALDARAM, EMOTE_TALDARAM_INVOCATION, 71081); + _invocationOrder[1] = InvocationData(instance->GetGuidData(DATA_PRINCE_KELESETH_GUID), SPELL_INVOCATION_OF_BLOOD_KELESETH, EMOTE_KELESETH_INVOCATION, 71080); + _invocationOrder[2] = InvocationData(instance->GetGuidData(DATA_PRINCE_TALDARAM_GUID), SPELL_INVOCATION_OF_BLOOD_TALDARAM, EMOTE_TALDARAM_INVOCATION, 71081); } } @@ -259,13 +259,13 @@ class boss_blood_council_controller : public CreatureScript void JustReachedHome() override { _resetCounter = 0; - if (Creature* keleseth = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_KELESETH_GUID))) + if (Creature* keleseth = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PRINCE_KELESETH_GUID))) keleseth->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (Creature* taldaram = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_TALDARAM_GUID))) + if (Creature* taldaram = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PRINCE_TALDARAM_GUID))) taldaram->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (Creature* valanar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_VALANAR_GUID))) + if (Creature* valanar = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PRINCE_VALANAR_GUID))) valanar->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } @@ -335,12 +335,12 @@ class boss_blood_council_controller : public CreatureScript private: struct InvocationData { - uint64 guid; + ObjectGuid guid; uint32 spellId; uint32 textId; uint32 visualSpell; - InvocationData(uint64 _guid, uint32 _spellId, uint32 _textId, uint32 _visualSpell) + InvocationData(ObjectGuid _guid, uint32 _spellId, uint32 _textId, uint32 _visualSpell) { guid = _guid; spellId = _spellId; @@ -348,7 +348,7 @@ class boss_blood_council_controller : public CreatureScript visualSpell = _visualSpell; } - InvocationData() : guid(0), spellId(0), textId(0), visualSpell(0) { } + InvocationData() : spellId(0), textId(0), visualSpell(0) { } } _invocationOrder[3]; uint32 _invocationStage; @@ -400,7 +400,7 @@ class boss_prince_keleseth_icc : public CreatureScript void EnterCombat(Unit* /*who*/) override { - if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BLOOD_PRINCES_CONTROL))) + if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BLOOD_PRINCES_CONTROL))) DoZoneInCombat(controller); events.ScheduleEvent(EVENT_BERSERK, 600000); @@ -428,7 +428,7 @@ class boss_prince_keleseth_icc : public CreatureScript instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); me->SetHealth(_spawnHealth); _isEmpowered = false; - if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BLOOD_PRINCES_CONTROL))) + if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BLOOD_PRINCES_CONTROL))) { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); controller->AI()->SetData(0, 1); @@ -515,10 +515,10 @@ class boss_prince_keleseth_icc : public CreatureScript if (!CheckBoundary(me)) { EnterEvadeMode(); - if (Creature* taldaram = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_TALDARAM_GUID))) + if (Creature* taldaram = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PRINCE_TALDARAM_GUID))) taldaram->AI()->EnterEvadeMode(); - if (Creature* valanar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_VALANAR_GUID))) + if (Creature* valanar = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PRINCE_VALANAR_GUID))) valanar->AI()->EnterEvadeMode(); return false; @@ -620,7 +620,7 @@ class boss_prince_taldaram_icc : public CreatureScript void EnterCombat(Unit* /*who*/) override { - if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BLOOD_PRINCES_CONTROL))) + if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BLOOD_PRINCES_CONTROL))) DoZoneInCombat(controller); events.ScheduleEvent(EVENT_BERSERK, 600000); @@ -644,7 +644,7 @@ class boss_prince_taldaram_icc : public CreatureScript instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); me->SetHealth(_spawnHealth); _isEmpowered = false; - if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BLOOD_PRINCES_CONTROL))) + if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BLOOD_PRINCES_CONTROL))) { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); controller->AI()->SetData(0, 1); @@ -734,10 +734,10 @@ class boss_prince_taldaram_icc : public CreatureScript if (!CheckBoundary(me)) { EnterEvadeMode(); - if (Creature* keleseth = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_KELESETH_GUID))) + if (Creature* keleseth = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PRINCE_KELESETH_GUID))) keleseth->AI()->EnterEvadeMode(); - if (Creature* valanar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_VALANAR_GUID))) + if (Creature* valanar = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PRINCE_VALANAR_GUID))) valanar->AI()->EnterEvadeMode(); return false; @@ -844,7 +844,7 @@ class boss_prince_valanar_icc : public CreatureScript void EnterCombat(Unit* /*who*/) override { - if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BLOOD_PRINCES_CONTROL))) + if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BLOOD_PRINCES_CONTROL))) DoZoneInCombat(controller); events.ScheduleEvent(EVENT_BERSERK, 600000); @@ -868,7 +868,7 @@ class boss_prince_valanar_icc : public CreatureScript instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); me->SetHealth(me->GetMaxHealth()); _isEmpowered = false; - if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BLOOD_PRINCES_CONTROL))) + if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BLOOD_PRINCES_CONTROL))) { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); controller->AI()->SetData(0, 1); @@ -973,10 +973,10 @@ class boss_prince_valanar_icc : public CreatureScript if (!CheckBoundary(me)) { EnterEvadeMode(); - if (Creature* keleseth = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_KELESETH_GUID))) + if (Creature* keleseth = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PRINCE_KELESETH_GUID))) keleseth->AI()->EnterEvadeMode(); - if (Creature* taldaram = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_TALDARAM_GUID))) + if (Creature* taldaram = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PRINCE_TALDARAM_GUID))) taldaram->AI()->EnterEvadeMode(); return false; @@ -1112,13 +1112,13 @@ class npc_blood_queen_lana_thel : public CreatureScript _events.Reset(); // remove Feign Death from princes - if (Creature* keleseth = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_PRINCE_KELESETH_GUID))) + if (Creature* keleseth = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_PRINCE_KELESETH_GUID))) keleseth->AI()->DoAction(ACTION_STAND_UP); - if (Creature* taldaram = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_PRINCE_TALDARAM_GUID))) + if (Creature* taldaram = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_PRINCE_TALDARAM_GUID))) taldaram->AI()->DoAction(ACTION_STAND_UP); - if (Creature* valanar = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_PRINCE_VALANAR_GUID))) + if (Creature* valanar = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_PRINCE_VALANAR_GUID))) { valanar->AI()->DoAction(ACTION_STAND_UP); valanar->SetHealth(valanar->GetMaxHealth()); @@ -1148,7 +1148,6 @@ class npc_ball_of_flame : public CreatureScript npc_ball_of_flameAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { _despawnTimer = 0; - _chaseGUID = 0; } void Reset() override @@ -1163,16 +1162,16 @@ class npc_ball_of_flame : public CreatureScript void MovementInform(uint32 type, uint32 id) override { - if (type == CHASE_MOTION_TYPE && id == GUID_LOPART(_chaseGUID) && _chaseGUID) + if (type == CHASE_MOTION_TYPE && id == _chaseGUID.GetCounter() && _chaseGUID) { me->RemoveAurasDueToSpell(SPELL_BALL_OF_FLAMES_PERIODIC); DoCast(me, SPELL_FLAMES); _despawnTimer = 1000; - _chaseGUID = 0; + _chaseGUID.Clear(); } } - void SetGUID(uint64 guid, int32 /*type*/) override + void SetGUID(ObjectGuid guid, int32 /*type*/) override { _chaseGUID = guid; } @@ -1213,7 +1212,7 @@ class npc_ball_of_flame : public CreatureScript } private: - uint64 _chaseGUID; + ObjectGuid _chaseGUID; InstanceScript* _instance; uint32 _despawnTimer; }; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp index 29d50f1db2a..8a325dee7b4 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp @@ -148,7 +148,7 @@ class boss_blood_queen_lana_thel : public CreatureScript void Initialize() { - _offtankGUID = 0; + _offtankGUID.Clear(); _creditBloodQuickening = false; _killMinchar = false; } @@ -210,7 +210,7 @@ class boss_blood_queen_lana_thel : public CreatureScript minchar->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND); minchar->SetCanFly(false); minchar->RemoveAllAuras(); - minchar->GetMotionMaster()->MoveCharge(4629.3711f, 2782.6089f, 401.5301f, SPEED_CHARGE/3.0f); + minchar->GetMotionMaster()->MoveCharge(4629.3711f, 2782.6089f, 401.5301f, SPEED_CHARGE / 3.0f); } } } @@ -278,7 +278,7 @@ class boss_blood_queen_lana_thel : public CreatureScript Talk(SAY_KILL); } - void SetGUID(uint64 guid, int32 type = 0) override + void SetGUID(ObjectGuid guid, int32 type = 0) override { switch (type) { @@ -390,7 +390,7 @@ class boss_blood_queen_lana_thel : public CreatureScript } } else - _offtankGUID = 0; + _offtankGUID.Clear(); } events.ScheduleEvent(EVENT_BLOOD_MIRROR, 2500, EVENT_GROUP_CANCELLABLE); break; @@ -458,12 +458,12 @@ class boss_blood_queen_lana_thel : public CreatureScript DoMeleeAttackIfReady(); } - bool WasVampire(uint64 guid) + bool WasVampire(ObjectGuid guid) const { return _vampires.count(guid) != 0; } - bool WasBloodbolted(uint64 guid) + bool WasBloodbolted(ObjectGuid guid) const { return _bloodboltedPlayers.count(guid) != 0; } @@ -501,9 +501,9 @@ class boss_blood_queen_lana_thel : public CreatureScript return Trinity::Containers::SelectRandomContainerElement(tempTargets); } - std::set<uint64> _vampires; - std::set<uint64> _bloodboltedPlayers; - uint64 _offtankGUID; + GuidSet _vampires; + GuidSet _bloodboltedPlayers; + ObjectGuid _offtankGUID; bool _creditBloodQuickening; bool _killMinchar; }; @@ -554,7 +554,7 @@ class spell_blood_queen_vampiric_bite : public SpellScriptLoader return; uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(SPELL_FRENZIED_BLOODTHIRST, GetCaster()); - GetCaster()->RemoveAura(spellId, 0, 0, AURA_REMOVE_BY_ENEMY_SPELL); + GetCaster()->RemoveAura(spellId, ObjectGuid::Empty, 0, AURA_REMOVE_BY_ENEMY_SPELL); GetCaster()->CastSpell(GetCaster(), SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_PLR, TRIGGERED_FULL_MASK); // Shadowmourne questline @@ -570,7 +570,7 @@ class spell_blood_queen_vampiric_bite : public SpellScriptLoader } if (InstanceScript* instance = GetCaster()->GetInstanceScript()) - if (Creature* bloodQueen = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_BLOOD_QUEEN_LANA_THEL))) + if (Creature* bloodQueen = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(DATA_BLOOD_QUEEN_LANA_THEL))) bloodQueen->AI()->SetGUID(GetHitUnit()->GetGUID(), GUID_VAMPIRE); } @@ -606,7 +606,7 @@ class spell_blood_queen_frenzied_bloodthirst : public SpellScriptLoader void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (InstanceScript* instance = GetTarget()->GetInstanceScript()) - if (Creature* bloodQueen = ObjectAccessor::GetCreature(*GetTarget(), instance->GetData64(DATA_BLOOD_QUEEN_LANA_THEL))) + if (Creature* bloodQueen = ObjectAccessor::GetCreature(*GetTarget(), instance->GetGuidData(DATA_BLOOD_QUEEN_LANA_THEL))) bloodQueen->AI()->Talk(EMOTE_BLOODTHIRST, GetTarget()); } @@ -615,7 +615,7 @@ class spell_blood_queen_frenzied_bloodthirst : public SpellScriptLoader Unit* target = GetTarget(); if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE) if (InstanceScript* instance = target->GetInstanceScript()) - if (Creature* bloodQueen = ObjectAccessor::GetCreature(*target, instance->GetData64(DATA_BLOOD_QUEEN_LANA_THEL))) + if (Creature* bloodQueen = ObjectAccessor::GetCreature(*target, instance->GetGuidData(DATA_BLOOD_QUEEN_LANA_THEL))) { // this needs to be done BEFORE charm aura or we hit an assert in Unit::SetCharmedBy if (target->GetVehicleKit()) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp index 2909946a0db..15cf0d31af9 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp @@ -299,7 +299,7 @@ class boss_deathbringer_saurfang : public CreatureScript if (!_introDone) { DoCast(me, SPELL_GRIP_OF_AGONY); - if (Creature* creature = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SAURFANG_EVENT_NPC))) + if (Creature* creature = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SAURFANG_EVENT_NPC))) creature->AI()->DoAction(ACTION_INTERRUPT_INTRO); } @@ -375,7 +375,7 @@ class boss_deathbringer_saurfang : public CreatureScript //instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_MARK_OF_THE_FALLEN_CHAMPION); DoCast(me, SPELL_PERMANENT_FEIGN_DEATH); - if (Creature* creature = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SAURFANG_EVENT_NPC))) + if (Creature* creature = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SAURFANG_EVENT_NPC))) creature->AI()->DoAction(ACTION_START_OUTRO); } } @@ -410,7 +410,7 @@ class boss_deathbringer_saurfang : public CreatureScript if (type != POINT_MOTION_TYPE && id != POINT_SAURFANG) return; - instance->HandleGameObject(instance->GetData64(GO_SAURFANG_S_DOOR), false); + instance->HandleGameObject(instance->GetGuidData(GO_SAURFANG_S_DOOR), false); } void SpellHitTarget(Unit* target, SpellInfo const* spell) override @@ -650,8 +650,8 @@ class npc_high_overlord_saurfang_icc : public CreatureScript Talk(SAY_INTRO_HORDE_1); _events.SetPhase(PHASE_INTRO_H); _events.ScheduleEvent(EVENT_INTRO_HORDE_3, 18500, 0, PHASE_INTRO_H); - _instance->HandleGameObject(_instance->GetData64(GO_SAURFANG_S_DOOR), true); - if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG))) + _instance->HandleGameObject(_instance->GetGuidData(GO_SAURFANG_S_DOOR), true); + if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_DEATHBRINGER_SAURFANG))) deathbringer->AI()->DoAction(PHASE_INTRO_H); break; } @@ -703,11 +703,11 @@ class npc_high_overlord_saurfang_icc : public CreatureScript _events.ScheduleEvent(EVENT_INTRO_HORDE_6, 29500, 0, PHASE_INTRO_H); _events.ScheduleEvent(EVENT_INTRO_HORDE_7, 43800, 0, PHASE_INTRO_H); _events.ScheduleEvent(EVENT_INTRO_HORDE_8, 47000, 0, PHASE_INTRO_H); - if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG))) + if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_DEATHBRINGER_SAURFANG))) deathbringer->AI()->DoAction(ACTION_CONTINUE_INTRO); break; case POINT_CORPSE: - if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG))) + if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_DEATHBRINGER_SAURFANG))) { deathbringer->CastSpell(me, SPELL_RIDE_VEHICLE, true); // for the packet logs. deathbringer->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -717,7 +717,7 @@ class npc_high_overlord_saurfang_icc : public CreatureScript _events.ScheduleEvent(EVENT_OUTRO_HORDE_6, 4000); // say break; case POINT_FINAL: - if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG))) + if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_DEATHBRINGER_SAURFANG))) deathbringer->DespawnOrUnsummon(); me->DespawnOrUnsummon(); break; @@ -762,7 +762,7 @@ class npc_high_overlord_saurfang_icc : public CreatureScript me->GetMotionMaster()->MoveCharge(chargePos[0].GetPositionX(), chargePos[0].GetPositionY(), chargePos[0].GetPositionZ(), 8.5f, POINT_CHARGE); break; case EVENT_OUTRO_HORDE_2: // say - if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG))) + if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_DEATHBRINGER_SAURFANG))) me->SetFacingToObject(deathbringer); Talk(SAY_OUTRO_HORDE_2); break; @@ -770,7 +770,7 @@ class npc_high_overlord_saurfang_icc : public CreatureScript Talk(SAY_OUTRO_HORDE_3); break; case EVENT_OUTRO_HORDE_4: // move - if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG))) + if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_DEATHBRINGER_SAURFANG))) { float x, y, z; deathbringer->GetClosePoint(x, y, z, deathbringer->GetObjectSize()); @@ -859,8 +859,8 @@ class npc_muradin_bronzebeard_icc : public CreatureScript me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); Talk(SAY_INTRO_ALLIANCE_1); _events.ScheduleEvent(EVENT_INTRO_ALLIANCE_4, 2500+17500+9500, 0, PHASE_INTRO_A); - _instance->HandleGameObject(_instance->GetData64(GO_SAURFANG_S_DOOR), true); - if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG))) + _instance->HandleGameObject(_instance->GetGuidData(GO_SAURFANG_S_DOOR), true); + if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_DEATHBRINGER_SAURFANG))) deathbringer->AI()->DoAction(PHASE_INTRO_A); break; } @@ -874,7 +874,7 @@ class npc_muradin_bronzebeard_icc : public CreatureScript (*itr)->AI()->DoAction(ACTION_DESPAWN); // temp until outro fully done - to put deathbringer on respawn timer (until next reset) - if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG))) + if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_DEATHBRINGER_SAURFANG))) deathbringer->DespawnOrUnsummon(5000); break; } @@ -902,7 +902,7 @@ class npc_muradin_bronzebeard_icc : public CreatureScript me->SetWalk(false); Talk(SAY_INTRO_ALLIANCE_4); _events.ScheduleEvent(EVENT_INTRO_ALLIANCE_5, 5000, 0, PHASE_INTRO_A); - if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG))) + if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_DEATHBRINGER_SAURFANG))) deathbringer->AI()->DoAction(ACTION_CONTINUE_INTRO); } else if (type == WAYPOINT_MOTION_TYPE && id == POINT_EXIT) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp index 90d91199e7a..b1f6a4a5e83 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp @@ -88,7 +88,6 @@ class boss_festergut : public CreatureScript { _maxInoculatedStack = 0; _inhaleCounter = 0; - _gasDummyGUID = 0; } void Reset() override @@ -126,7 +125,7 @@ class boss_festergut : public CreatureScript Talk(SAY_AGGRO); if (Creature* gasDummy = me->FindNearestCreature(NPC_GAS_DUMMY, 100.0f, true)) _gasDummyGUID = gasDummy->GetGUID(); - if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) + if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PROFESSOR_PUTRICIDE))) professor->AI()->DoAction(ACTION_FESTERGUT_COMBAT); DoZoneInCombat(); } @@ -135,7 +134,7 @@ class boss_festergut : public CreatureScript { _JustDied(); Talk(SAY_DEATH); - if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) + if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PROFESSOR_PUTRICIDE))) professor->AI()->DoAction(ACTION_FESTERGUT_DEATH); RemoveBlight(); @@ -150,7 +149,7 @@ class boss_festergut : public CreatureScript void EnterEvadeMode() override { ScriptedAI::EnterEvadeMode(); - if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) + if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PROFESSOR_PUTRICIDE))) professor->AI()->EnterEvadeMode(); } @@ -189,7 +188,7 @@ class boss_festergut : public CreatureScript Talk(SAY_PUNGENT_BLIGHT); DoCast(me, SPELL_PUNGENT_BLIGHT); _inhaleCounter = 0; - if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) + if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PROFESSOR_PUTRICIDE))) professor->AI()->DoAction(ACTION_FESTERGUT_GAS); events.RescheduleEvent(EVENT_GAS_SPORE, urand(20000, 25000)); } @@ -279,7 +278,7 @@ class boss_festergut : public CreatureScript } private: - uint64 _gasDummyGUID; + ObjectGuid _gasDummyGUID; uint32 _maxInoculatedStack; uint32 _inhaleCounter; }; @@ -346,7 +345,7 @@ class npc_stinky_icc : public CreatureScript void JustDied(Unit* /*killer*/) override { - if (Creature* festergut = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_FESTERGUT))) + if (Creature* festergut = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_FESTERGUT))) if (festergut->IsAlive()) festergut->AI()->Talk(SAY_STINKY_DEAD); } @@ -456,7 +455,7 @@ class spell_festergut_blighted_spores : public SpellScriptLoader { GetTarget()->CastSpell(GetTarget(), SPELL_INOCULATED, true); if (InstanceScript* instance = GetTarget()->GetInstanceScript()) - if (Creature* festergut = ObjectAccessor::GetCreature(*GetTarget(), instance->GetData64(DATA_FESTERGUT))) + if (Creature* festergut = ObjectAccessor::GetCreature(*GetTarget(), instance->GetGuidData(DATA_FESTERGUT))) festergut->AI()->SetData(DATA_INOCULATED_STACK, GetStackAmount()); HandleResidue(); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp index 535ace3259c..74a09887dd2 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp @@ -383,7 +383,9 @@ public: void ResetSlots(uint32 team) { _transport = NULL; - memset(_controlledSlots, 0, sizeof(uint64)* MAX_SLOTS); + for (uint32 i = 0; i < MAX_SLOTS; ++i) + _controlledSlots[i].Clear(); + memset(_respawnCooldowns, 0, sizeof(time_t)* MAX_SLOTS); _spawnPoint = team == HORDE ? &OrgrimsHammerAddsSpawnPos : &SkybreakerAddsSpawnPos; _slotInfo = team == HORDE ? OrgrimsHammerSlotInfo : SkybreakerSlotInfo; @@ -422,7 +424,7 @@ public: void ClearSlot(PassengerSlots slot) { - _controlledSlots[slot] = 0; + _controlledSlots[slot].Clear(); _respawnCooldowns[slot] = time(NULL) + _slotInfo[slot].Cooldown; } @@ -448,7 +450,7 @@ private: } Transport* _transport; - uint64 _controlledSlots[MAX_SLOTS]; + ObjectGuid _controlledSlots[MAX_SLOTS]; time_t _respawnCooldowns[MAX_SLOTS]; Position const* _spawnPoint; SlotInfo const* _slotInfo; @@ -482,7 +484,7 @@ private: class ResetEncounterEvent : public BasicEvent { public: - ResetEncounterEvent(Unit* caster, uint32 spellId, uint64 otherTransport) : _caster(caster), _spellId(spellId), _otherTransport(otherTransport) { } + ResetEncounterEvent(Unit* caster, uint32 spellId, ObjectGuid otherTransport) : _caster(caster), _spellId(spellId), _otherTransport(otherTransport) { } bool Execute(uint64, uint32) override { @@ -498,7 +500,7 @@ public: private: Unit* _caster; uint32 _spellId; - uint64 _otherTransport; + ObjectGuid _otherTransport; }; class BattleExperienceEvent : public BasicEvent @@ -744,7 +746,7 @@ class npc_gunship : public CreatureScript cannon->CastSpell(cannon, SPELL_EJECT_ALL_PASSENGERS_BELOW_ZERO, TRIGGERED_FULL_MASK); WorldPacket data(SMSG_PLAYER_VEHICLE_DATA, cannon->GetPackGUID().size() + 4); - data.append(cannon->GetPackGUID()); + data << cannon->GetPackGUID(); data << uint32(0); cannon->SendMessageToSet(&data, true); @@ -767,7 +769,7 @@ class npc_gunship : public CreatureScript if (isVictory) { - if (GameObject* go = HashMapHolder<GameObject>::Find(instance->GetData64(DATA_ICECROWN_GUNSHIP_BATTLE))) + if (GameObject* go = HashMapHolder<GameObject>::Find(instance->GetGuidData(DATA_ICECROWN_GUNSHIP_BATTLE))) if (Transport* otherTransport = go->ToTransport()) otherTransport->EnableMovement(true); @@ -791,17 +793,17 @@ class npc_gunship : public CreatureScript else { uint32 teleportSpellId = _teamInInstance == HORDE ? SPELL_TELEPORT_PLAYERS_ON_RESET_H : SPELL_TELEPORT_PLAYERS_ON_RESET_A; - me->m_Events.AddEvent(new ResetEncounterEvent(me, teleportSpellId, me->GetInstanceScript()->GetData64(DATA_ENEMY_GUNSHIP)), + me->m_Events.AddEvent(new ResetEncounterEvent(me, teleportSpellId, me->GetInstanceScript()->GetGuidData(DATA_ENEMY_GUNSHIP)), me->m_Events.CalculateTime(8000)); } } - void SetGUID(uint64 guid, int32 id/* = 0*/) override + void SetGUID(ObjectGuid guid, int32 id/* = 0*/) override { if (id != ACTION_SHIP_VISITS) return; - std::map<uint64, uint32>::iterator itr = _shipVisits.find(guid); + std::map<ObjectGuid, uint32>::iterator itr = _shipVisits.find(guid); if (itr == _shipVisits.end()) _shipVisits[guid] = 1; else @@ -814,7 +816,7 @@ class npc_gunship : public CreatureScript return 0; uint32 max = 0; - for (std::map<uint64, uint32>::const_iterator itr = _shipVisits.begin(); itr != _shipVisits.end(); ++itr) + for (std::map<ObjectGuid, uint32>::const_iterator itr = _shipVisits.begin(); itr != _shipVisits.end(); ++itr) max = std::max(max, itr->second); return max; @@ -822,7 +824,7 @@ class npc_gunship : public CreatureScript private: uint32 _teamInInstance; - std::map<uint64, uint32> _shipVisits; + std::map<ObjectGuid, uint32> _shipVisits; bool _summonedFirstMage; bool _died; }; @@ -1032,7 +1034,7 @@ class npc_high_overlord_saurfang_igb : public CreatureScript if (Transport* orgrimsHammer = me->GetTransport()) orgrimsHammer->SummonPassenger(NPC_TELEPORT_PORTAL, OrgrimsHammerTeleportPortal, TEMPSUMMON_TIMED_DESPAWN, NULL, 21000); - if (GameObject* go = HashMapHolder<GameObject>::Find(_instance->GetData64(DATA_ICECROWN_GUNSHIP_BATTLE))) + if (GameObject* go = HashMapHolder<GameObject>::Find(_instance->GetGuidData(DATA_ICECROWN_GUNSHIP_BATTLE))) if (Transport* skybreaker = go->ToTransport()) skybreaker->SummonPassenger(NPC_TELEPORT_EXIT, SkybreakerTeleportExit, TEMPSUMMON_TIMED_DESPAWN, NULL, 23000); @@ -1305,7 +1307,7 @@ class npc_muradin_bronzebeard_igb : public CreatureScript if (Transport* skybreaker = me->GetTransport()) skybreaker->SummonPassenger(NPC_TELEPORT_PORTAL, SkybreakerTeleportPortal, TEMPSUMMON_TIMED_DESPAWN, NULL, 21000); - if (GameObject* go = HashMapHolder<GameObject>::Find(_instance->GetData64(DATA_ICECROWN_GUNSHIP_BATTLE))) + if (GameObject* go = HashMapHolder<GameObject>::Find(_instance->GetGuidData(DATA_ICECROWN_GUNSHIP_BATTLE))) if (Transport* orgrimsHammer = go->ToTransport()) orgrimsHammer->SummonPassenger(NPC_TELEPORT_EXIT, OrgrimsHammerTeleportExit, TEMPSUMMON_TIMED_DESPAWN, NULL, 23000); @@ -1451,7 +1453,7 @@ struct npc_gunship_boarding_addAI : public gunship_npc_AI if (!myTransport) return; - if (GameObject* go = HashMapHolder<GameObject>::Find(Instance->GetData64(DATA_ICECROWN_GUNSHIP_BATTLE))) + if (GameObject* go = HashMapHolder<GameObject>::Find(Instance->GetGuidData(DATA_ICECROWN_GUNSHIP_BATTLE))) if (Transport* destTransport = go->ToTransport()) destTransport->CalculatePassengerPosition(x, y, z, &o); @@ -2085,7 +2087,7 @@ class spell_igb_overheat : public SpellScriptLoader if (Player* player = passenger->ToPlayer()) { WorldPacket data(SMSG_CLIENT_CONTROL_UPDATE, GetUnitOwner()->GetPackGUID().size() + 1); - data.append(GetUnitOwner()->GetPackGUID()); + data << GetUnitOwner()->GetPackGUID(); data << uint8(value); player->GetSession()->SendPacket(&data); } @@ -2335,7 +2337,7 @@ class spell_igb_gunship_fall_teleport : public SpellScriptLoader void SelectTransport(WorldObject*& target) { if (InstanceScript* instance = target->GetInstanceScript()) - target = HashMapHolder<GameObject>::Find(instance->GetData64(DATA_ICECROWN_GUNSHIP_BATTLE)); + target = HashMapHolder<GameObject>::Find(instance->GetGuidData(DATA_ICECROWN_GUNSHIP_BATTLE)); } void RelocateDest(SpellEffIndex /*effIndex*/) @@ -2426,7 +2428,7 @@ class spell_igb_teleport_players_on_victory : public SpellScriptLoader InstanceScript* instance = GetCaster()->GetInstanceScript(); targets.remove_if([instance](WorldObject* target) -> bool { - return target->GetTransGUID() != instance->GetData64(DATA_ENEMY_GUNSHIP); + return target->GetTransGUID() != instance->GetGuidData(DATA_ENEMY_GUNSHIP); }); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp index bbdca1fa8c5..55d6edd7b2d 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp @@ -224,8 +224,8 @@ class boss_lady_deathwhisper : public CreatureScript void Initialize() { _waveCounter = 0; - _nextVengefulShadeTargetGUID = 0; - _darnavanGUID = 0; + _nextVengefulShadeTargetGUID.Clear(); + _darnavanGUID.Clear(); } void Reset() override @@ -329,10 +329,10 @@ class boss_lady_deathwhisper : public CreatureScript { for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) if (Player* member = itr->GetSource()) - member->KilledMonsterCredit(NPC_DARNAVAN_CREDIT, 0); + member->KilledMonsterCredit(NPC_DARNAVAN_CREDIT); } else - owner->KilledMonsterCredit(NPC_DARNAVAN_CREDIT, 0); + owner->KilledMonsterCredit(NPC_DARNAVAN_CREDIT); } } } @@ -349,7 +349,7 @@ class boss_lady_deathwhisper : public CreatureScript if (Creature* darnavan = ObjectAccessor::GetCreature(*me, _darnavanGUID)) { darnavan->DespawnOrUnsummon(); - _darnavanGUID = 0; + _darnavanGUID.Clear(); } } @@ -396,7 +396,7 @@ class boss_lady_deathwhisper : public CreatureScript if (summon->GetEntry() == NPC_VENGEFUL_SHADE) { target = ObjectAccessor::GetUnit(*me, _nextVengefulShadeTargetGUID); // Vengeful Shade - _nextVengefulShadeTargetGUID = 0; + _nextVengefulShadeTargetGUID.Clear(); } else target = SelectTarget(SELECT_TARGET_RANDOM); // Wave adds @@ -554,7 +554,7 @@ class boss_lady_deathwhisper : public CreatureScript summon->CastSpell(summon, SPELL_TELEPORT_VISUAL); } - void SetGUID(uint64 guid, int32 id/* = 0*/) override + void SetGUID(ObjectGuid guid, int32 id/* = 0*/) override { if (id != GUID_CULTIST) return; @@ -568,7 +568,7 @@ class boss_lady_deathwhisper : public CreatureScript if (_reanimationQueue.empty()) return; - uint64 cultistGUID = _reanimationQueue.front(); + ObjectGuid cultistGUID = _reanimationQueue.front(); Creature* cultist = ObjectAccessor::GetCreature(*me, cultistGUID); _reanimationQueue.pop_front(); if (!cultist) @@ -615,9 +615,9 @@ class boss_lady_deathwhisper : public CreatureScript } private: - uint64 _nextVengefulShadeTargetGUID; - uint64 _darnavanGUID; - std::deque<uint64> _reanimationQueue; + ObjectGuid _nextVengefulShadeTargetGUID; + ObjectGuid _darnavanGUID; + GuidDeque _reanimationQueue; uint32 _waveCounter; uint8 const _dominateMindCount; bool _introDone; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp index b7bf27177ea..7ab8c956757 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp @@ -133,7 +133,6 @@ class boss_lord_marrowgar : public CreatureScript _coldflameLastPos.Relocate(creature); _introDone = false; _boneSlice = false; - _coldflameTarget = 0; } void Reset() override @@ -211,7 +210,7 @@ class boss_lord_marrowgar : public CreatureScript break; case EVENT_COLDFLAME: _coldflameLastPos.Relocate(me); - _coldflameTarget = 0LL; + _coldflameTarget.Clear(); if (!me->HasAura(SPELL_BONE_STORM)) DoCastAOE(SPELL_COLDFLAME_NORMAL); else @@ -289,7 +288,7 @@ class boss_lord_marrowgar : public CreatureScript return &_coldflameLastPos; } - uint64 GetGUID(int32 type /*= 0 */) const override + ObjectGuid GetGUID(int32 type /*= 0 */) const override { switch (type) { @@ -307,10 +306,10 @@ class boss_lord_marrowgar : public CreatureScript } } - return 0LL; + return ObjectGuid::Empty; } - void SetGUID(uint64 guid, int32 type /*= 0 */) override + void SetGUID(ObjectGuid guid, int32 type /*= 0 */) override { switch (type) { @@ -333,8 +332,8 @@ class boss_lord_marrowgar : public CreatureScript private: Position _coldflameLastPos; - std::vector<uint64> _boneSpikeImmune; - uint64 _coldflameTarget; + GuidVector _boneSpikeImmune; + ObjectGuid _coldflameTarget; uint32 _boneStormDuration; float _baseSpeed; bool _introDone; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index c1a13c90780..2e353e5f9dc 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -174,7 +174,7 @@ class AbominationDespawner public: explicit AbominationDespawner(Unit* owner) : _owner(owner) { } - bool operator()(uint64 guid) + bool operator()(ObjectGuid guid) { if (Unit* summon = ObjectAccessor::GetUnit(*_owner, guid)) { @@ -373,7 +373,7 @@ class boss_professor_putricide : public CreatureScript instance->SetBossState(DATA_FESTERGUT, IN_PROGRESS); // needed here for delayed gate close me->SetSpeed(MOVE_RUN, _baseSpeed, true); DoAction(ACTION_FESTERGUT_GAS); - if (Creature* festergut = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_FESTERGUT))) + if (Creature* festergut = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_FESTERGUT))) festergut->CastSpell(festergut, SPELL_GASEOUS_BLIGHT_LARGE, false, NULL, NULL, festergut->GetGUID()); break; case POINT_ROTFACE: @@ -386,7 +386,7 @@ class boss_professor_putricide : public CreatureScript // stop attack me->GetMotionMaster()->MoveIdle(); me->SetSpeed(MOVE_RUN, _baseSpeed, true); - if (GameObject* table = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_PUTRICIDE_TABLE))) + if (GameObject* table = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_PUTRICIDE_TABLE))) me->SetFacingToObject(table); // operating on new phase already switch (_phase) @@ -443,7 +443,7 @@ class boss_professor_putricide : public CreatureScript _oozeFloodStage = 0; DoZoneInCombat(me); // init random sequence of floods - if (Creature* rotface = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ROTFACE))) + if (Creature* rotface = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ROTFACE))) { std::list<Creature*> list; GetCreatureListWithEntryInGrid(list, rotface, NPC_PUDDLE_STALKER, 50.0f); @@ -702,7 +702,7 @@ class boss_professor_putricide : public CreatureScript events.SetPhase(newPhase); } - uint64 _oozeFloodDummyGUIDs[4]; + ObjectGuid _oozeFloodDummyGUIDs[4]; Phases _phase; // external of EventMap because event phase gets reset on evade float const _baseSpeed; uint8 _oozeFloodStage; @@ -1152,7 +1152,7 @@ class spell_putricide_unbound_plague : public SpellScriptLoader if (!GetHitUnit()->HasAura(plagueId)) { - if (Creature* professor = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) + if (Creature* professor = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(DATA_PROFESSOR_PUTRICIDE))) { if (Aura* oldPlague = GetCaster()->GetAura(plagueId, professor->GetGUID())) { @@ -1307,7 +1307,7 @@ class spell_putricide_mutation_init : public SpellScriptLoader if (!instance) return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; - Creature* professor = ObjectAccessor::GetCreature(*GetExplTargetUnit(), instance->GetData64(DATA_PROFESSOR_PUTRICIDE)); + Creature* professor = ObjectAccessor::GetCreature(*GetExplTargetUnit(), instance->GetGuidData(DATA_PROFESSOR_PUTRICIDE)); if (!professor) return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; @@ -1428,7 +1428,7 @@ class spell_putricide_mutated_transformation : public SpellScriptLoader if (!instance) return; - Creature* putricide = ObjectAccessor::GetCreature(*caster, instance->GetData64(DATA_PROFESSOR_PUTRICIDE)); + Creature* putricide = ObjectAccessor::GetCreature(*caster, instance->GetGuidData(DATA_PROFESSOR_PUTRICIDE)); if (!putricide) return; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp index 2f2889a9cf3..205b90fa159 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp @@ -126,7 +126,7 @@ class boss_rotface : public CreatureScript me->setActive(true); Talk(SAY_AGGRO); - if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) + if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PROFESSOR_PUTRICIDE))) professor->AI()->DoAction(ACTION_ROTFACE_COMBAT); DoZoneInCombat(); @@ -138,7 +138,7 @@ class boss_rotface : public CreatureScript instance->DoRemoveAurasDueToSpellOnPlayers(MUTATED_INFECTION); _JustDied(); Talk(SAY_DEATH); - if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) + if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PROFESSOR_PUTRICIDE))) professor->AI()->DoAction(ACTION_ROTFACE_DEATH); } @@ -158,7 +158,7 @@ class boss_rotface : public CreatureScript void EnterEvadeMode() override { ScriptedAI::EnterEvadeMode(); - if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) + if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PROFESSOR_PUTRICIDE))) professor->AI()->EnterEvadeMode(); } @@ -176,7 +176,7 @@ class boss_rotface : public CreatureScript void JustSummoned(Creature* summon) override { if (summon->GetEntry() == NPC_VILE_GAS_STALKER) - if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) + if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PROFESSOR_PUTRICIDE))) professor->CastSpell(summon, SPELL_VILE_GAS_H, true); } @@ -308,13 +308,13 @@ class npc_big_ooze : public CreatureScript DoCast(me, SPELL_GREEN_ABOMINATION_HITTIN__YA_PROC, true); events.ScheduleEvent(EVENT_STICKY_OOZE, 5000); // register in Rotface's summons - not summoned with Rotface as owner - if (Creature* rotface = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ROTFACE))) + if (Creature* rotface = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ROTFACE))) rotface->AI()->JustSummoned(me); } void JustDied(Unit* /*killer*/) override { - if (Creature* rotface = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ROTFACE))) + if (Creature* rotface = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ROTFACE))) rotface->AI()->SummonedCreatureDespawn(me); me->DespawnOrUnsummon(); } @@ -395,7 +395,7 @@ class npc_precious_icc : public CreatureScript void JustDied(Unit* /*killer*/) override { _summons.DespawnAll(); - if (Creature* rotface = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_ROTFACE))) + if (Creature* rotface = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_ROTFACE))) if (rotface->IsAlive()) rotface->AI()->Talk(SAY_PRECIOUS_DIES); } @@ -469,7 +469,7 @@ class spell_rotface_ooze_flood : public SpellScriptLoader return; triggers.sort(Trinity::ObjectDistanceOrderPred(GetHitUnit())); - GetHitUnit()->CastSpell(triggers.back(), uint32(GetEffectValue()), false, NULL, NULL, GetOriginalCaster() ? GetOriginalCaster()->GetGUID() : 0); + GetHitUnit()->CastSpell(triggers.back(), uint32(GetEffectValue()), false, NULL, NULL, GetOriginalCaster() ? GetOriginalCaster()->GetGUID() : ObjectGuid::Empty); } void FilterTargets(std::list<WorldObject*>& targets) @@ -657,7 +657,7 @@ class spell_rotface_large_ooze_buff_combine : public SpellScriptLoader GetCaster()->RemoveAurasDueToSpell(SPELL_LARGE_OOZE_BUFF_COMBINE); GetCaster()->RemoveAurasDueToSpell(SPELL_LARGE_OOZE_COMBINE); if (InstanceScript* instance = GetCaster()->GetInstanceScript()) - if (Creature* rotface = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_ROTFACE))) + if (Creature* rotface = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(DATA_ROTFACE))) if (rotface->IsAlive()) { rotface->AI()->Talk(EMOTE_UNSTABLE_EXPLOSION); @@ -748,7 +748,7 @@ class spell_rotface_unstable_ooze_explosion : public SpellScriptLoader GetExplTargetDest()->GetPosition(x, y, z); // let Rotface handle the cast - caster dies before this executes if (InstanceScript* script = GetCaster()->GetInstanceScript()) - if (Creature* rotface = script->instance->GetCreature(script->GetData64(DATA_ROTFACE))) + if (Creature* rotface = script->instance->GetCreature(script->GetGuidData(DATA_ROTFACE))) rotface->CastSpell(x, y, z, triggered_spell_id, true, NULL, NULL, GetCaster()->GetGUID()); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index 3b65c10aaa9..551ec9ad0a2 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -182,7 +182,7 @@ class FrostwyrmLandEvent : public BasicEvent class FrostBombExplosion : public BasicEvent { public: - FrostBombExplosion(Creature* owner, uint64 sindragosaGUID) : _owner(owner), _sindragosaGUID(sindragosaGUID) { } + FrostBombExplosion(Creature* owner, ObjectGuid sindragosaGUID) : _owner(owner), _sindragosaGUID(sindragosaGUID) { } bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) { @@ -193,7 +193,7 @@ class FrostBombExplosion : public BasicEvent private: Creature* _owner; - uint64 _sindragosaGUID; + ObjectGuid _sindragosaGUID; }; class FrostBeaconSelector @@ -563,7 +563,6 @@ class npc_ice_tomb : public CreatureScript { npc_ice_tombAI(Creature* creature) : ScriptedAI(creature) { - _trappedPlayerGUID = 0; _existenceCheckTimer = 0; SetCombatMovement(false); } @@ -573,7 +572,7 @@ class npc_ice_tomb : public CreatureScript me->SetReactState(REACT_PASSIVE); } - void SetGUID(uint64 guid, int32 type/* = 0 */) override + void SetGUID(ObjectGuid guid, int32 type/* = 0 */) override { if (type == DATA_TRAPPED_PLAYER) { @@ -595,7 +594,7 @@ class npc_ice_tomb : public CreatureScript if (Player* player = ObjectAccessor::GetPlayer(*me, _trappedPlayerGUID)) { - _trappedPlayerGUID = 0; + _trappedPlayerGUID.Clear(); player->RemoveAurasDueToSpell(SPELL_ICE_TOMB_DAMAGE); player->RemoveAurasDueToSpell(SPELL_ASPHYXIATION); } @@ -623,7 +622,7 @@ class npc_ice_tomb : public CreatureScript } private: - uint64 _trappedPlayerGUID; + ObjectGuid _trappedPlayerGUID; uint32 _existenceCheckTimer; }; @@ -1574,14 +1573,14 @@ class at_sindragosa_lair : public AreaTriggerScript if (InstanceScript* instance = player->GetInstanceScript()) { if (!instance->GetData(DATA_SPINESTALKER)) - if (Creature* spinestalker = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_SPINESTALKER))) + if (Creature* spinestalker = ObjectAccessor::GetCreature(*player, instance->GetGuidData(DATA_SPINESTALKER))) spinestalker->AI()->DoAction(ACTION_START_FROSTWYRM); if (!instance->GetData(DATA_RIMEFANG)) - if (Creature* rimefang = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_RIMEFANG))) + if (Creature* rimefang = ObjectAccessor::GetCreature(*player, instance->GetGuidData(DATA_RIMEFANG))) rimefang->AI()->DoAction(ACTION_START_FROSTWYRM); - if (!instance->GetData(DATA_SINDRAGOSA_FROSTWYRMS) && !instance->GetData64(DATA_SINDRAGOSA) && instance->GetBossState(DATA_SINDRAGOSA) != DONE) + if (!instance->GetData(DATA_SINDRAGOSA_FROSTWYRMS) && !instance->GetGuidData(DATA_SINDRAGOSA) && instance->GetBossState(DATA_SINDRAGOSA) != DONE) { if (player->GetMap()->IsHeroic() && !instance->GetData(DATA_HEROIC_ATTEMPTS)) return true; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index e2fe441dae2..5addfd672b4 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -567,7 +567,7 @@ class boss_the_lich_king : public CreatureScript // Restore Tirion's gossip only after The Lich King fully resets to prevent // restarting the encounter while LK still runs back to spawn point - if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING))) + if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HIGHLORD_TIRION_FORDRING))) tirion->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); // Reset any light override @@ -584,7 +584,7 @@ class boss_the_lich_king : public CreatureScript { instance->SetBossState(DATA_THE_LICH_KING, FAIL); BossAI::EnterEvadeMode(); - if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING))) + if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HIGHLORD_TIRION_FORDRING))) tirion->AI()->EnterEvadeMode(); DoCastAOE(SPELL_KILL_FROSTMOURNE_PLAYERS); EntryCheckPredicate pred(NPC_STRANGULATE_VEHICLE); @@ -823,7 +823,7 @@ class boss_the_lich_king : public CreatureScript events.ScheduleEvent(EVENT_INTRO_MOVE_3, 1, 0, PHASE_INTRO); break; case POINT_LK_INTRO_3: - if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING))) + if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HIGHLORD_TIRION_FORDRING))) tirion->AI()->DoAction(ACTION_CONTINUE_INTRO); events.ScheduleEvent(EVENT_INTRO_TALK_1, 9000, 0, PHASE_INTRO); break; @@ -864,7 +864,7 @@ class boss_the_lich_king : public CreatureScript events.ScheduleEvent(EVENT_OUTRO_TALK_5, 29000, 0, PHASE_OUTRO); break; case POINT_LK_OUTRO_2: - if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING))) + if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HIGHLORD_TIRION_FORDRING))) tirion->AI()->Talk(SAY_TIRION_OUTRO_2); if (Creature* frostmourne = me->FindNearestCreature(NPC_FROSTMOURNE_TRIGGER, 50.0f)) frostmourne->AI()->DoAction(ACTION_SUMMON_TERENAS); @@ -1070,7 +1070,7 @@ class boss_the_lich_king : public CreatureScript me->HandleEmoteCommand(EMOTE_ONESHOT_TALK_NO_SHEATHE); break; case EVENT_OUTRO_TALK_3: - if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING))) + if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HIGHLORD_TIRION_FORDRING))) me->SetFacingToObject(tirion); Talk(SAY_LK_OUTRO_3); break; @@ -1088,12 +1088,12 @@ class boss_the_lich_king : public CreatureScript break; case EVENT_OUTRO_TALK_5: Talk(SAY_LK_OUTRO_5); - if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING))) + if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HIGHLORD_TIRION_FORDRING))) tirion->AI()->DoAction(ACTION_OUTRO); break; case EVENT_OUTRO_TALK_6: Talk(SAY_LK_OUTRO_6); - if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING))) + if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HIGHLORD_TIRION_FORDRING))) tirion->SetFacingToObject(me); me->CastSpell((Unit*)NULL, SPELL_SUMMON_BROKEN_FROSTMOURNE_3, TRIGGERED_IGNORE_CAST_IN_PROGRESS); SetEquipmentSlots(false, EQUIP_UNEQUIP); @@ -1163,7 +1163,7 @@ class npc_tirion_fordring_tft : public CreatureScript { case POINT_TIRION_INTRO: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); - if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING))) theLichKing->AI()->DoAction(ACTION_START_ENCOUNTER); break; case POINT_TIRION_OUTRO_1: @@ -1249,7 +1249,7 @@ class npc_tirion_fordring_tft : public CreatureScript case EVENT_OUTRO_REMOVE_ICE: me->RemoveAurasDueToSpell(SPELL_ICE_LOCK); SetEquipmentSlots(false, EQUIP_ASHBRINGER_GLOWING); - if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING))) { me->SetFacingToObject(lichKing); lichKing->AI()->DoAction(ACTION_PLAY_MUSIC); @@ -1376,13 +1376,13 @@ class npc_raging_spirit : public CreatureScript void IsSummonedBy(Unit* /*summoner*/) override { // player is the spellcaster so register summon manually - if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING))) lichKing->AI()->JustSummoned(me); } void JustDied(Unit* /*killer*/) override { - if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING))) lichKing->AI()->SummonedCreatureDespawn(me); if (TempSummon* summon = me->ToTempSummon()) summon->SetTempSummonType(TEMPSUMMON_CORPSE_DESPAWN); @@ -1433,7 +1433,7 @@ class npc_valkyr_shadowguard : public CreatureScript struct npc_valkyr_shadowguardAI : public ScriptedAI { npc_valkyr_shadowguardAI(Creature* creature) : ScriptedAI(creature), - _grabbedPlayer(0), _instance(creature->GetInstanceScript()) + _instance(creature->GetInstanceScript()) { } @@ -1495,7 +1495,7 @@ class npc_valkyr_shadowguard : public CreatureScript if (Player* target = ObjectAccessor::GetPlayer(*me, _grabbedPlayer)) { me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - if (GameObject* platform = ObjectAccessor::GetGameObject(*me, _instance->GetData64(DATA_ARTHAS_PLATFORM))) + if (GameObject* platform = ObjectAccessor::GetGameObject(*me, _instance->GetGuidData(DATA_ARTHAS_PLATFORM))) { std::list<Creature*> triggers; GetCreatureListWithEntryInGrid(triggers, me, NPC_WORLD_TRIGGER, 150.0f); @@ -1518,7 +1518,7 @@ class npc_valkyr_shadowguard : public CreatureScript } } - void SetGUID(uint64 guid, int32 /* = 0*/) override + void SetGUID(ObjectGuid guid, int32 /* = 0*/) override { _grabbedPlayer = guid; } @@ -1563,7 +1563,7 @@ class npc_valkyr_shadowguard : public CreatureScript private: EventMap _events; Position _dropPoint; - uint64 _grabbedPlayer; + ObjectGuid _grabbedPlayer; InstanceScript* _instance; }; @@ -1594,7 +1594,7 @@ class npc_strangulate_vehicle : public CreatureScript _events.ScheduleEvent(EVENT_TELEPORT, 6000); // this will let us easily access all creatures of this entry on heroic mode when its time to teleport back - if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING))) lichKing->AI()->JustSummoned(me); } @@ -1612,7 +1612,7 @@ class npc_strangulate_vehicle : public CreatureScript } } - if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING))) lichKing->AI()->SummonedCreatureDespawn(me); } @@ -1640,7 +1640,7 @@ class npc_strangulate_vehicle : public CreatureScript else { summoner->CastSpell(summoner, SPELL_HARVEST_SOULS_TELEPORT, true); - summoner->RemoveAurasDueToSpell(HARVEST_SOUL, 0, 0, AURA_REMOVE_BY_EXPIRE); + summoner->RemoveAurasDueToSpell(HARVEST_SOUL, ObjectGuid::Empty, 0, AURA_REMOVE_BY_EXPIRE); } } } @@ -1648,7 +1648,7 @@ class npc_strangulate_vehicle : public CreatureScript _events.ScheduleEvent(EVENT_DESPAWN_SELF, 65000); break; case EVENT_MOVE_TO_LICH_KING: - if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING))) { if (me->GetExactDist(lichKing) > 10.0f) { @@ -1658,7 +1658,7 @@ class npc_strangulate_vehicle : public CreatureScript } break; case EVENT_DESPAWN_SELF: - if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING))) lichKing->AI()->SummonedCreatureDespawn(me); me->DespawnOrUnsummon(1); break; @@ -1758,7 +1758,7 @@ class npc_terenas_menethil : public CreatureScript { _events.Reset(); _events.SetPhase(PHASE_OUTRO); - if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING))) me->SetFacingToObject(lichKing); _events.ScheduleEvent(EVENT_OUTRO_TERENAS_TALK_1, 2000, 0, PHASE_OUTRO); @@ -1792,11 +1792,11 @@ class npc_terenas_menethil : public CreatureScript case EVENT_OUTRO_TERENAS_TALK_2: Talk(SAY_TERENAS_OUTRO_2); DoCastAOE(SPELL_MASS_RESURRECTION); - if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING))) { lichKing->AI()->DoAction(ACTION_FINISH_OUTRO); lichKing->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); - if (Creature* tirion = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING))) + if (Creature* tirion = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_HIGHLORD_TIRION_FORDRING))) tirion->AI()->AttackStart(lichKing); } break; @@ -1808,7 +1808,7 @@ class npc_terenas_menethil : public CreatureScript _events.ScheduleEvent(EVENT_TELEPORT_BACK, 1000); break; case EVENT_TELEPORT_BACK: - if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING))) lichKing->AI()->DoAction(ACTION_TELEPORT_BACK); break; default: @@ -1853,7 +1853,7 @@ class npc_spirit_warden : public CreatureScript void JustDied(Unit* /*killer*/) override { - if (Creature* terenas = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_TERENAS_MENETHIL))) + if (Creature* terenas = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_TERENAS_MENETHIL))) terenas->AI()->DoAction(ACTION_TELEPORT_BACK); } @@ -2288,7 +2288,7 @@ class spell_the_lich_king_quake : public SpellScriptLoader void FilterTargets(std::list<WorldObject*>& targets) { - if (GameObject* platform = ObjectAccessor::GetGameObject(*GetCaster(), GetCaster()->GetInstanceScript()->GetData64(DATA_ARTHAS_PLATFORM))) + if (GameObject* platform = ObjectAccessor::GetGameObject(*GetCaster(), GetCaster()->GetInstanceScript()->GetGuidData(DATA_ARTHAS_PLATFORM))) targets.remove_if(HeightDifferenceCheck(platform, 5.0f, false)); } @@ -2804,7 +2804,7 @@ class spell_the_lich_king_harvest_soul : public SpellScriptLoader { // m_originalCaster to allow stacking from different casters, meh if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH) - GetTarget()->CastSpell((Unit*)NULL, SPELL_HARVESTED_SOUL, true, NULL, NULL, GetTarget()->GetInstanceScript()->GetData64(DATA_THE_LICH_KING)); + GetTarget()->CastSpell((Unit*)NULL, SPELL_HARVESTED_SOUL, true, NULL, NULL, GetTarget()->GetInstanceScript()->GetGuidData(DATA_THE_LICH_KING)); } void Register() override @@ -2902,7 +2902,7 @@ class spell_the_lich_king_restore_soul : public SpellScriptLoader void HandleScript(SpellEffIndex /*effIndex*/) { - if (Creature* lichKing = ObjectAccessor::GetCreature(*GetCaster(), _instance->GetData64(DATA_THE_LICH_KING))) + if (Creature* lichKing = ObjectAccessor::GetCreature(*GetCaster(), _instance->GetGuidData(DATA_THE_LICH_KING))) lichKing->AI()->DoAction(ACTION_TELEPORT_BACK); if (Creature* spawner = GetCaster()->FindNearestCreature(NPC_WORLD_TRIGGER_INFINITE_AOI, 50.0f)) spawner->RemoveAllAuras(); @@ -2991,7 +2991,7 @@ class spell_the_lich_king_in_frostmourne_room : public SpellScriptLoader { // m_originalCaster to allow stacking from different casters, meh if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH) - GetTarget()->CastSpell((Unit*)NULL, SPELL_HARVESTED_SOUL, true, NULL, NULL, GetTarget()->GetInstanceScript()->GetData64(DATA_THE_LICH_KING)); + GetTarget()->CastSpell((Unit*)NULL, SPELL_HARVESTED_SOUL, true, NULL, NULL, GetTarget()->GetInstanceScript()->GetGuidData(DATA_THE_LICH_KING)); } void Register() override diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp index 2d58a6eeb26..5b3dd67072a 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp @@ -175,7 +175,7 @@ struct ManaVoidSelector : public std::unary_function<Unit*, bool> class DelayedCastEvent : public BasicEvent { public: - DelayedCastEvent(Creature* trigger, uint32 spellId, uint64 originalCaster, uint32 despawnTime) : _trigger(trigger), _originalCaster(originalCaster), _spellId(spellId), _despawnTime(despawnTime) + DelayedCastEvent(Creature* trigger, uint32 spellId, ObjectGuid originalCaster, uint32 despawnTime) : _trigger(trigger), _originalCaster(originalCaster), _spellId(spellId), _despawnTime(despawnTime) { } @@ -189,7 +189,7 @@ class DelayedCastEvent : public BasicEvent private: Creature* _trigger; - uint64 _originalCaster; + ObjectGuid _originalCaster; uint32 _spellId; uint32 _despawnTime; }; @@ -353,7 +353,7 @@ class boss_valithria_dreamwalker : public CreatureScript DoCast(me, SPELL_ACHIEVEMENT_CHECK); DoCastAOE(SPELL_DREAMWALKERS_RAGE); _events.ScheduleEvent(EVENT_DREAM_SLIP, 3500); - if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_LICH_KING))) + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VALITHRIA_LICH_KING))) lichKing->AI()->EnterEvadeMode(); } else if (!_over75PercentTalkDone && me->HealthAbovePctHealed(75, heal)) @@ -384,7 +384,7 @@ class boss_valithria_dreamwalker : public CreatureScript _justDied = true; Talk(SAY_VALITHRIA_DEATH); _instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); - if (Creature* trigger = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_TRIGGER))) + if (Creature* trigger = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VALITHRIA_TRIGGER))) trigger->AI()->DoAction(ACTION_DEATH); } } @@ -401,10 +401,10 @@ class boss_valithria_dreamwalker : public CreatureScript me->SetDisplayId(11686); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->DespawnOrUnsummon(4000); - if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_LICH_KING))) + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VALITHRIA_LICH_KING))) lichKing->CastSpell(lichKing, SPELL_SPAWN_CHEST, false); - if (Creature* trigger = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_TRIGGER))) + if (Creature* trigger = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VALITHRIA_TRIGGER))) me->Kill(trigger); } } @@ -522,7 +522,7 @@ class npc_green_dragon_combat_trigger : public CreatureScript me->setActive(true); DoZoneInCombat(); instance->SetBossState(DATA_VALITHRIA_DREAMWALKER, IN_PROGRESS); - if (Creature* valithria = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VALITHRIA_DREAMWALKER))) + if (Creature* valithria = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VALITHRIA_DREAMWALKER))) valithria->AI()->DoAction(ACTION_ENTER_COMBAT); } @@ -721,10 +721,10 @@ class npc_risen_archmage : public CreatureScript for (std::list<Creature*>::iterator itr = archmages.begin(); itr != archmages.end(); ++itr) (*itr)->AI()->DoAction(ACTION_ENTER_COMBAT); - if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_LICH_KING))) + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VALITHRIA_LICH_KING))) lichKing->AI()->DoZoneInCombat(); - if (Creature* trigger = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_TRIGGER))) + if (Creature* trigger = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VALITHRIA_TRIGGER))) trigger->AI()->DoZoneInCombat(); } } @@ -742,7 +742,7 @@ class npc_risen_archmage : public CreatureScript void JustSummoned(Creature* summon) override { if (summon->GetEntry() == NPC_COLUMN_OF_FROST) - summon->m_Events.AddEvent(new DelayedCastEvent(summon, SPELL_COLUMN_OF_FROST_DAMAGE, 0, 8000), summon->m_Events.CalculateTime(2000)); + summon->m_Events.AddEvent(new DelayedCastEvent(summon, SPELL_COLUMN_OF_FROST_DAMAGE, ObjectGuid::Empty, 8000), summon->m_Events.CalculateTime(2000)); else if (summon->GetEntry() == NPC_MANA_VOID) summon->DespawnOrUnsummon(36000); } @@ -880,7 +880,7 @@ class npc_suppresser : public CreatureScript void IsSummonedBy(Unit* /*summoner*/) override { - if (Creature* valithria = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_DREAMWALKER))) + if (Creature* valithria = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VALITHRIA_DREAMWALKER))) AttackStart(valithria); } @@ -1099,7 +1099,7 @@ class npc_dream_cloud : public CreatureScript case EVENT_EXPLODE: me->GetMotionMaster()->MoveIdle(); // must use originalCaster the same for all clouds to allow stacking - me->CastSpell(me, EMERALD_VIGOR, false, NULL, NULL, _instance->GetData64(DATA_VALITHRIA_DREAMWALKER)); + me->CastSpell(me, EMERALD_VIGOR, false, NULL, NULL, _instance->GetGuidData(DATA_VALITHRIA_DREAMWALKER)); me->DespawnOrUnsummon(100); break; default: @@ -1220,7 +1220,7 @@ class spell_dreamwalker_summoner : public SpellScriptLoader if (!GetHitUnit()) return; - GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, true, NULL, NULL, GetCaster()->GetInstanceScript()->GetData64(DATA_VALITHRIA_LICH_KING)); + GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, true, NULL, NULL, GetCaster()->GetInstanceScript()->GetGuidData(DATA_VALITHRIA_LICH_KING)); } void Register() override @@ -1299,7 +1299,7 @@ class spell_dreamwalker_summon_suppresser_effect : public SpellScriptLoader if (!GetHitUnit()) return; - GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, true, NULL, NULL, GetCaster()->GetInstanceScript()->GetData64(DATA_VALITHRIA_LICH_KING)); + GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, true, NULL, NULL, GetCaster()->GetInstanceScript()->GetGuidData(DATA_VALITHRIA_LICH_KING)); } void Register() override @@ -1428,7 +1428,7 @@ class spell_dreamwalker_twisted_nightmares : public SpellScriptLoader // return; if (InstanceScript* instance = GetHitUnit()->GetInstanceScript()) - GetHitUnit()->CastSpell((Unit*)NULL, GetSpellInfo()->Effects[effIndex].TriggerSpell, true, NULL, NULL, instance->GetData64(DATA_VALITHRIA_DREAMWALKER)); + GetHitUnit()->CastSpell((Unit*)NULL, GetSpellInfo()->Effects[effIndex].TriggerSpell, true, NULL, NULL, instance->GetGuidData(DATA_VALITHRIA_DREAMWALKER)); } void Register() override diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index 23569ba77c2..c2007730cdc 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -390,9 +390,9 @@ class npc_highlord_tirion_fordring_lh : public CreatureScript void Initialize() { - _theLichKing = 0; - _bolvarFordragon = 0; - _factionNPC = 0; + _theLichKing.Clear(); + _bolvarFordragon.Clear(); + _factionNPC.Clear(); _damnedKills = 0; } @@ -581,9 +581,9 @@ class npc_highlord_tirion_fordring_lh : public CreatureScript private: EventMap _events; InstanceScript* const _instance; - uint64 _theLichKing; - uint64 _bolvarFordragon; - uint64 _factionNPC; + ObjectGuid _theLichKing; + ObjectGuid _bolvarFordragon; + ObjectGuid _factionNPC; uint16 _damnedKills; }; @@ -760,7 +760,7 @@ class boss_sister_svalna : public CreatureScript uint64 delay = 1; for (uint32 i = 0; i < 4; ++i) { - if (Creature* crusader = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_CAPTAIN_ARNATH + i))) + if (Creature* crusader = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_CAPTAIN_ARNATH + i))) { if (crusader->IsAlive() && crusader->GetEntry() == crusader->GetCreatureData()->id) { @@ -774,7 +774,7 @@ class boss_sister_svalna : public CreatureScript void EnterCombat(Unit* /*attacker*/) override { _EnterCombat(); - if (Creature* crok = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_CROK_SCOURGEBANE))) + if (Creature* crok = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_CROK_SCOURGEBANE))) crok->AI()->Talk(SAY_CROK_COMBAT_SVALNA); events.ScheduleEvent(EVENT_SVALNA_COMBAT, 9000); events.ScheduleEvent(EVENT_IMPALING_SPEAR, urand(40000, 50000)); @@ -979,7 +979,7 @@ class npc_crok_scourgebane : public CreatureScript _isEventDone = true; // Load Grid with Sister Svalna me->GetMap()->LoadGrid(4356.71f, 2484.33f); - if (Creature* svalna = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_SISTER_SVALNA))) + if (Creature* svalna = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_SISTER_SVALNA))) svalna->AI()->DoAction(ACTION_START_GAUNTLET); Talk(SAY_CROK_INTRO_1); _events.ScheduleEvent(EVENT_ARNATH_INTRO_2, 7000); @@ -987,7 +987,7 @@ class npc_crok_scourgebane : public CreatureScript _events.ScheduleEvent(EVENT_START_PATHING, 37000); me->setActive(true); for (uint32 i = 0; i < 4; ++i) - if (Creature* crusader = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_CAPTAIN_ARNATH + i))) + if (Creature* crusader = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_CAPTAIN_ARNATH + i))) crusader->AI()->DoAction(ACTION_START_GAUNTLET); } else if (action == ACTION_RESET_EVENT) @@ -1000,7 +1000,7 @@ class npc_crok_scourgebane : public CreatureScript } } - void SetGUID(uint64 guid, int32 type/* = 0*/) override + void SetGUID(ObjectGuid guid, int32 type/* = 0*/) override { if (type == ACTION_VRYKUL_DEATH) { @@ -1013,7 +1013,7 @@ class npc_crok_scourgebane : public CreatureScript _isEventActive = false; me->setActive(false); Talk(SAY_CROK_FINAL_WP); - if (Creature* svalna = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_SISTER_SVALNA))) + if (Creature* svalna = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_SISTER_SVALNA))) svalna->AI()->DoAction(ACTION_RESURRECT_CAPTAINS); } } @@ -1041,7 +1041,7 @@ class npc_crok_scourgebane : public CreatureScript _isEventActive = false; me->setActive(false); Talk(SAY_CROK_FINAL_WP); - if (Creature* svalna = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_SISTER_SVALNA))) + if (Creature* svalna = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_SISTER_SVALNA))) svalna->AI()->DoAction(ACTION_RESURRECT_CAPTAINS); } break; @@ -1067,7 +1067,7 @@ class npc_crok_scourgebane : public CreatureScript minY -= 50.0f; maxY -= 50.0f; // at waypoints 1 and 2 she kills one captain - if (Creature* svalna = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_SISTER_SVALNA))) + if (Creature* svalna = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_SISTER_SVALNA))) svalna->AI()->DoAction(ACTION_KILL_CAPTAIN); } else if (waypointId == 4) @@ -1090,7 +1090,7 @@ class npc_crok_scourgebane : public CreatureScript } // at waypoints 1 and 2 she kills one captain case 2: - if (Creature* svalna = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_SISTER_SVALNA))) + if (Creature* svalna = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_SISTER_SVALNA))) svalna->AI()->DoAction(ACTION_KILL_CAPTAIN); break; default: @@ -1160,7 +1160,7 @@ class npc_crok_scourgebane : public CreatureScript switch (eventId) { case EVENT_ARNATH_INTRO_2: - if (Creature* arnath = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_CAPTAIN_ARNATH))) + if (Creature* arnath = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_CAPTAIN_ARNATH))) arnath->AI()->Talk(SAY_ARNATH_INTRO_2); break; case EVENT_CROK_INTRO_3: @@ -1206,7 +1206,7 @@ class npc_crok_scourgebane : public CreatureScript private: EventMap _events; - std::set<uint64> _aliveTrash; + GuidSet _aliveTrash; InstanceScript* _instance; uint32 _currentWPid; uint32 _wipeCheckTimer; @@ -1254,7 +1254,7 @@ struct npc_argent_captainAI : public ScriptedAI { if (action == ACTION_START_GAUNTLET) { - if (Creature* crok = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_CROK_SCOURGEBANE))) + if (Creature* crok = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_CROK_SCOURGEBANE))) { me->SetReactState(REACT_DEFENSIVE); FollowAngle = me->GetAngle(crok) + me->GetOrientation(); @@ -1298,7 +1298,7 @@ struct npc_argent_captainAI : public ScriptedAI if (!me->GetVehicle()) { me->GetMotionMaster()->Clear(false); - if (Creature* crok = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_CROK_SCOURGEBANE))) + if (Creature* crok = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_CROK_SCOURGEBANE))) me->GetMotionMaster()->MoveFollow(crok, FollowDist, FollowAngle, MOTION_SLOT_IDLE); } @@ -2148,7 +2148,7 @@ class at_icc_start_frostwing_gauntlet : public AreaTriggerScript bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/) override { if (InstanceScript* instance = player->GetInstanceScript()) - if (Creature* crok = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_CROK_SCOURGEBANE))) + if (Creature* crok = ObjectAccessor::GetCreature(*player, instance->GetGuidData(DATA_CROK_SCOURGEBANE))) crok->AI()->DoAction(ACTION_START_GAUNTLET); return true; } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp index 3f429183fa0..f1a1aae030f 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp @@ -120,52 +120,6 @@ class instance_icecrown_citadel : public InstanceMapScript LoadDoorData(doorData); TeamInInstance = 0; HeroicAttempts = MaxHeroicAttempts; - LadyDeathwisperElevatorGUID = 0; - GunshipGUID = 0; - EnemyGunshipGUID = 0; - GunshipArmoryGUID = 0; - DeathbringerSaurfangGUID = 0; - DeathbringerSaurfangDoorGUID = 0; - DeathbringerSaurfangEventGUID = 0; - DeathbringersCacheGUID = 0; - TeleporterLichKingGUID = 0; - TeleporterUpperSpireGUID = 0; - TeleporterLightsHammerGUID = 0; - TeleporterRampartsGUID = 0; - TeleporterDeathBringerGUID = 0; - TeleporterOratoryGUID = 0; - TeleporterSindragosaGUID = 0; - PlagueSigilGUID = 0; - BloodwingSigilGUID = 0; - FrostwingSigilGUID = 0; - memset(PutricidePipeGUIDs, 0, 2 * sizeof(uint64)); - memset(PutricideGateGUIDs, 0, 2 * sizeof(uint64)); - PutricideCollisionGUID = 0; - FestergutGUID = 0; - RotfaceGUID = 0; - ProfessorPutricideGUID = 0; - PutricideTableGUID = 0; - memset(BloodCouncilGUIDs, 0, 3 * sizeof(uint64)); - BloodCouncilControllerGUID = 0; - BloodQueenLanaThelGUID = 0; - CrokScourgebaneGUID = 0; - memset(CrokCaptainGUIDs, 0, 4 * sizeof(uint64)); - SisterSvalnaGUID = 0; - ValithriaDreamwalkerGUID = 0; - ValithriaLichKingGUID = 0; - ValithriaTriggerGUID = 0; - SindragosaGUID = 0; - SpinestalkerGUID = 0; - RimefangGUID = 0; - TheLichKingTeleportGUID = 0; - TheLichKingGUID = 0; - HighlordTirionFordringGUID = 0; - TerenasMenethilGUID = 0; - ArthasPlatformGUID = 0; - ArthasPrecipiceGUID = 0; - FrozenThroneEdgeGUID = 0; - FrozenThroneWindGUID = 0; - FrozenThroneWarningGUID = 0; IsBonedEligible = true; IsOozeDanceEligible = true; IsNauseaEligible = true; @@ -174,9 +128,6 @@ class instance_icecrown_citadel : public InstanceMapScript UpperSpireTeleporterActiveState = NOT_STARTED; BloodQuickeningState = NOT_STARTED; BloodQuickeningMinutes = 0; - FrozenBolvarGUID = 0; - PillarsChainedGUID = 0; - PillarsUnchainedGUID = 0; } // A function to help reduce the number of lines for teleporter management. @@ -362,7 +313,7 @@ class instance_icecrown_citadel : public InstanceMapScript void OnCreatureRemove(Creature* creature) override { if (creature->GetEntry() == NPC_SINDRAGOSA) - SindragosaGUID = 0; + SindragosaGUID.Clear(); } // Weekly quest spawn prevention @@ -725,7 +676,7 @@ class instance_icecrown_citadel : public InstanceMapScript break; case GO_THE_SKYBREAKER_A: case GO_ORGRIMS_HAMMER_H: - GunshipGUID = 0; + GunshipGUID.Clear(); break; default: break; @@ -759,7 +710,7 @@ class instance_icecrown_citadel : public InstanceMapScript return 0; } - uint64 GetData64(uint32 type) const override + ObjectGuid GetGuidData(uint32 type) const override { switch (type) { @@ -824,7 +775,7 @@ class instance_icecrown_citadel : public InstanceMapScript break; } - return 0; + return ObjectGuid::Empty; } bool SetBossState(uint32 type, EncounterState state) override @@ -1476,55 +1427,55 @@ class instance_icecrown_citadel : public InstanceMapScript protected: EventMap Events; - uint64 LadyDeathwisperElevatorGUID; - uint64 GunshipGUID; - uint64 EnemyGunshipGUID; - uint64 GunshipArmoryGUID; - uint64 DeathbringerSaurfangGUID; - uint64 DeathbringerSaurfangDoorGUID; - uint64 DeathbringerSaurfangEventGUID; // Muradin Bronzebeard or High Overlord Saurfang - uint64 DeathbringersCacheGUID; - uint64 TeleporterLichKingGUID; - uint64 TeleporterUpperSpireGUID; - uint64 TeleporterLightsHammerGUID; - uint64 TeleporterRampartsGUID; - uint64 TeleporterDeathBringerGUID; - uint64 TeleporterOratoryGUID; - uint64 TeleporterSindragosaGUID; - uint64 PlagueSigilGUID; - uint64 BloodwingSigilGUID; - uint64 FrostwingSigilGUID; - uint64 PutricidePipeGUIDs[2]; - uint64 PutricideGateGUIDs[2]; - uint64 PutricideCollisionGUID; - uint64 FestergutGUID; - uint64 RotfaceGUID; - uint64 ProfessorPutricideGUID; - uint64 PutricideTableGUID; - uint64 BloodCouncilGUIDs[3]; - uint64 BloodCouncilControllerGUID; - uint64 BloodQueenLanaThelGUID; - uint64 CrokScourgebaneGUID; - uint64 CrokCaptainGUIDs[4]; - uint64 SisterSvalnaGUID; - uint64 ValithriaDreamwalkerGUID; - uint64 ValithriaLichKingGUID; - uint64 ValithriaTriggerGUID; - uint64 SindragosaGUID; - uint64 SpinestalkerGUID; - uint64 RimefangGUID; - uint64 TheLichKingTeleportGUID; - uint64 TheLichKingGUID; - uint64 HighlordTirionFordringGUID; - uint64 TerenasMenethilGUID; - uint64 ArthasPlatformGUID; - uint64 ArthasPrecipiceGUID; - uint64 FrozenThroneEdgeGUID; - uint64 FrozenThroneWindGUID; - uint64 FrozenThroneWarningGUID; - uint64 FrozenBolvarGUID; - uint64 PillarsChainedGUID; - uint64 PillarsUnchainedGUID; + ObjectGuid LadyDeathwisperElevatorGUID; + ObjectGuid GunshipGUID; + ObjectGuid EnemyGunshipGUID; + ObjectGuid GunshipArmoryGUID; + ObjectGuid DeathbringerSaurfangGUID; + ObjectGuid DeathbringerSaurfangDoorGUID; + ObjectGuid DeathbringerSaurfangEventGUID; // Muradin Bronzebeard or High Overlord Saurfang + ObjectGuid DeathbringersCacheGUID; + ObjectGuid TeleporterLichKingGUID; + ObjectGuid TeleporterUpperSpireGUID; + ObjectGuid TeleporterLightsHammerGUID; + ObjectGuid TeleporterRampartsGUID; + ObjectGuid TeleporterDeathBringerGUID; + ObjectGuid TeleporterOratoryGUID; + ObjectGuid TeleporterSindragosaGUID; + ObjectGuid PlagueSigilGUID; + ObjectGuid BloodwingSigilGUID; + ObjectGuid FrostwingSigilGUID; + ObjectGuid PutricidePipeGUIDs[2]; + ObjectGuid PutricideGateGUIDs[2]; + ObjectGuid PutricideCollisionGUID; + ObjectGuid FestergutGUID; + ObjectGuid RotfaceGUID; + ObjectGuid ProfessorPutricideGUID; + ObjectGuid PutricideTableGUID; + ObjectGuid BloodCouncilGUIDs[3]; + ObjectGuid BloodCouncilControllerGUID; + ObjectGuid BloodQueenLanaThelGUID; + ObjectGuid CrokScourgebaneGUID; + ObjectGuid CrokCaptainGUIDs[4]; + ObjectGuid SisterSvalnaGUID; + ObjectGuid ValithriaDreamwalkerGUID; + ObjectGuid ValithriaLichKingGUID; + ObjectGuid ValithriaTriggerGUID; + ObjectGuid SindragosaGUID; + ObjectGuid SpinestalkerGUID; + ObjectGuid RimefangGUID; + ObjectGuid TheLichKingTeleportGUID; + ObjectGuid TheLichKingGUID; + ObjectGuid HighlordTirionFordringGUID; + ObjectGuid TerenasMenethilGUID; + ObjectGuid ArthasPlatformGUID; + ObjectGuid ArthasPrecipiceGUID; + ObjectGuid FrozenThroneEdgeGUID; + ObjectGuid FrozenThroneWindGUID; + ObjectGuid FrozenThroneWarningGUID; + ObjectGuid FrozenBolvarGUID; + ObjectGuid PillarsChainedGUID; + ObjectGuid PillarsUnchainedGUID; uint32 TeamInInstance; uint32 ColdflameJetsState; uint32 UpperSpireTeleporterActiveState; diff --git a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp index ec273d5f6e8..dcb004cc3a0 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp @@ -201,7 +201,7 @@ class npc_faerlina_add : public CreatureScript void JustDied(Unit* /*killer*/) override { if (_instance && GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) - if (Creature* faerlina = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_FAERLINA))) + if (Creature* faerlina = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_FAERLINA))) DoCast(faerlina, SPELL_WIDOWS_EMBRACE); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp index a8de1418cc4..c715bd8aad7 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp @@ -106,7 +106,7 @@ public: void Initialize() { - uiEventStarterGUID = 0; + uiEventStarterGUID.Clear(); nextWP = 0; punishTimer = 2000; nextMovementStarted = false; @@ -118,7 +118,7 @@ public: } Horsemen id; - uint64 uiEventStarterGUID; + ObjectGuid uiEventStarterGUID; uint8 nextWP; uint32 punishTimer; bool caster; @@ -143,10 +143,10 @@ public: bool DoEncounteraction(Unit* who, bool attack, bool reset, bool checkAllDead) { - Creature* Thane = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_THANE)); - Creature* Lady = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_LADY)); - Creature* Baron = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BARON)); - Creature* Sir = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SIR)); + Creature* Thane = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_THANE)); + Creature* Lady = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_LADY)); + Creature* Baron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BARON)); + Creature* Sir = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SIR)); if (Thane && Lady && Baron && Sir) { diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp index de9d85db70b..39381f38d67 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp @@ -182,8 +182,8 @@ class boss_gothik : public CreatureScript bool phaseTwo; bool thirtyPercentReached; - std::vector<uint64> LiveTriggerGUID; - std::vector<uint64> DeadTriggerGUID; + GuidVector LiveTriggerGUID; + GuidVector DeadTriggerGUID; void Reset() override { diff --git a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp index 2d0e8a6d2b2..aac59761626 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp @@ -135,7 +135,7 @@ public: me->NearTeleportTo(x, y, z, o - (float(M_PI) / 2)); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveIdle(); - me->SetTarget(0); + me->SetTarget(ObjectGuid::Empty); DoCastAOE(SPELL_PLAGUE_CLOUD); events.ScheduleEvent(EVENT_PHASE, 45000); events.ScheduleEvent(EVENT_ERUPT, 8000); @@ -204,7 +204,7 @@ class spell_heigan_eruption : public SpellScriptLoader if (GetHitDamage() >= int32(GetHitPlayer()->GetHealth())) if (InstanceScript* instance = caster->GetInstanceScript()) - if (Creature* Heigan = ObjectAccessor::GetCreature(*caster, instance->GetData64(DATA_HEIGAN))) + if (Creature* Heigan = ObjectAccessor::GetCreature(*caster, instance->GetGuidData(DATA_HEIGAN))) Heigan->AI()->SetData(DATA_SAFETY_DANCE, 0); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp index 1c4320fd48b..6fe7bb30056 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp @@ -285,13 +285,13 @@ public: uint8 nAbomination; uint8 nWeaver; - std::map<uint64, float> chained; + std::map<ObjectGuid, float> chained; SummonList spawns; // adds spawn by the trigger. kept in separated list (i.e. not in summons) void ResetPlayerScale() { - std::map<uint64, float>::const_iterator itr; + std::map<ObjectGuid, float>::const_iterator itr; for (itr = chained.begin(); itr != chained.end(); ++itr) { if (Player* charmed = ObjectAccessor::GetPlayer(*me, itr->first)) @@ -313,7 +313,7 @@ public: instance->SetData(DATA_ABOMINATION_KILLED, 0); - if (GameObject* trigger = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_KELTHUZAD_TRIGGER))) + if (GameObject* trigger = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_KELTHUZAD_TRIGGER))) { trigger->ResetDoorOrButton(); trigger->SetPhaseMask(1, true); @@ -321,7 +321,7 @@ public: for (uint8 i = 0; i <= 3; ++i) { - if (GameObject* portal = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_KELTHUZAD_PORTAL01 + i))) + if (GameObject* portal = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_KELTHUZAD_PORTAL01 + i))) if (!((portal->getLootState() == GO_READY) || (portal->getLootState() == GO_NOT_READY))) portal->ResetDoorOrButton(); } @@ -349,7 +349,7 @@ public: _EnterCombat(); for (uint8 i = 0; i <= 3; ++i) { - if (GameObject* portal = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_KELTHUZAD_PORTAL01 + i))) + if (GameObject* portal = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_KELTHUZAD_PORTAL01 + i))) portal->ResetDoorOrButton(); } DoCast(me, SPELL_KELTHUZAD_CHANNEL, false); @@ -399,7 +399,7 @@ public: } break; case EVENT_TRIGGER: - if (GameObject* trigger = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_KELTHUZAD_TRIGGER))) + if (GameObject* trigger = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_KELTHUZAD_TRIGGER))) trigger->SetPhaseMask(2, true); break; case EVENT_PHASE: @@ -439,7 +439,7 @@ public: for (uint8 i = 0; i <= 3; ++i) { - if (GameObject* portal = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_KELTHUZAD_PORTAL01 + i))) + if (GameObject* portal = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_KELTHUZAD_PORTAL01 + i))) if (portal->getLootState() == GO_READY) portal->UseDoorOrButton(); } @@ -495,7 +495,7 @@ public: } case EVENT_CHAINED_SPELL: { - std::map<uint64, float>::iterator itr; + std::map<ObjectGuid, float>::iterator itr; for (itr = chained.begin(); itr != chained.end();) { if (Unit* player = ObjectAccessor::GetPlayer(*me, itr->first)) @@ -503,7 +503,7 @@ public: if (!player->IsCharmed()) { player->SetObjectScale(itr->second); - std::map<uint64, float>::iterator next = itr; + std::map<ObjectGuid, float>::iterator next = itr; ++next; chained.erase(itr); itr = next; @@ -639,7 +639,7 @@ public: if (!instance || instance->IsEncounterInProgress() || instance->GetBossState(BOSS_KELTHUZAD) == DONE) return false; - Creature* pKelthuzad = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_KELTHUZAD)); + Creature* pKelthuzad = ObjectAccessor::GetCreature(*player, instance->GetGuidData(DATA_KELTHUZAD)); if (!pKelthuzad) return false; @@ -648,7 +648,7 @@ public: return false; pKelthuzadAI->AttackStart(player); - if (GameObject* trigger = ObjectAccessor::GetGameObject(*player, instance->GetData64(DATA_KELTHUZAD_TRIGGER))) + if (GameObject* trigger = ObjectAccessor::GetGameObject(*player, instance->GetGuidData(DATA_KELTHUZAD_TRIGGER))) { if (trigger->getLootState() == GO_READY) trigger->UseDoorOrButton(); diff --git a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp index 209e689e615..aa284f1aaee 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp @@ -165,11 +165,11 @@ public: struct npc_webwrapAI : public NullCreatureAI { - npc_webwrapAI(Creature* creature) : NullCreatureAI(creature), victimGUID(0) { } + npc_webwrapAI(Creature* creature) : NullCreatureAI(creature) { } - uint64 victimGUID; + ObjectGuid victimGUID; - void SetGUID(uint64 guid, int32 /*param*/) override + void SetGUID(ObjectGuid guid, int32 /*param*/) override { victimGUID = guid; if (me->m_spells[0] && victimGUID) diff --git a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp index ce5010c972f..97c7d7c4052 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp @@ -80,7 +80,7 @@ enum Misc MAX_FROST_RESISTANCE = 100 }; -typedef std::map<uint64, uint64> IceBlockMap; +typedef std::map<ObjectGuid, ObjectGuid> IceBlockMap; class boss_sapphiron : public CreatureScript { @@ -320,7 +320,7 @@ class boss_sapphiron : public CreatureScript { std::vector<Unit*>::const_iterator itr = targets.begin(); advance(itr, rand32() % targets.size()); - _iceblocks.insert(std::make_pair((*itr)->GetGUID(), 0)); + _iceblocks.insert(std::make_pair((*itr)->GetGUID(), ObjectGuid::Empty)); DoCast(*itr, SPELL_ICEBOLT); --_iceboltCount; } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp index 8ae3b5790db..650777a8815 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp @@ -120,11 +120,11 @@ public: // Moreover, the adds may not yet be spawn. So just track down the status if mob is spawn // and each mob will send its status at reset (meaning that it is alive) checkFeugenAlive = false; - if (Creature* pFeugen = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_FEUGEN))) + if (Creature* pFeugen = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_FEUGEN))) checkFeugenAlive = pFeugen->IsAlive(); checkStalaggAlive = false; - if (Creature* pStalagg = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_STALAGG))) + if (Creature* pStalagg = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_STALAGG))) checkStalaggAlive = pStalagg->IsAlive(); if (!checkFeugenAlive && !checkStalaggAlive) @@ -230,12 +230,12 @@ public: { if (!checkStalaggAlive) { - if (Creature* pStalagg = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_STALAGG))) + if (Creature* pStalagg = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_STALAGG))) pStalagg->Respawn(); } else { - if (Creature* pFeugen = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_FEUGEN))) + if (Creature* pFeugen = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_FEUGEN))) pFeugen->Respawn(); } } @@ -307,7 +307,7 @@ public: void Reset() override { - if (Creature* pThaddius = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_THADDIUS))) + if (Creature* pThaddius = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_THADDIUS))) if (pThaddius->AI()) pThaddius->AI()->DoAction(ACTION_STALAGG_RESET); Initialize(); @@ -328,7 +328,7 @@ public: void JustDied(Unit* /*killer*/) override { Talk(SAY_STAL_DEATH); - if (Creature* pThaddius = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_THADDIUS))) + if (Creature* pThaddius = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_THADDIUS))) if (pThaddius->AI()) pThaddius->AI()->DoAction(ACTION_STALAGG_DIED); } @@ -340,7 +340,7 @@ public: if (magneticPullTimer <= uiDiff) { - if (Creature* pFeugen = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_FEUGEN))) + if (Creature* pFeugen = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_FEUGEN))) { Unit* pStalaggVictim = me->GetVictim(); Unit* pFeugenVictim = pFeugen->GetVictim(); @@ -403,7 +403,7 @@ public: void Reset() override { - if (Creature* pThaddius = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_THADDIUS))) + if (Creature* pThaddius = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_THADDIUS))) if (pThaddius->AI()) pThaddius->AI()->DoAction(ACTION_FEUGEN_RESET); Initialize(); @@ -424,7 +424,7 @@ public: void JustDied(Unit* /*killer*/) override { Talk(SAY_FEUG_DEATH); - if (Creature* pThaddius = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_THADDIUS))) + if (Creature* pThaddius = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_THADDIUS))) if (pThaddius->AI()) pThaddius->AI()->DoAction(ACTION_FEUGEN_DIED); } diff --git a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp index 2fc49be0903..4151c4a85a7 100644 --- a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp +++ b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp @@ -112,27 +112,11 @@ class instance_naxxramas : public InstanceMapScript LoadDoorData(doorData); LoadMinionData(minionData); - GothikGateGUID = 0; - HorsemenChestGUID = 0; - FaerlinaGUID = 0; - ThaneGUID = 0; - LadyGUID = 0; - BaronGUID = 0; - SirGUID = 0; - ThaddiusGUID = 0; - HeiganGUID = 0; - FeugenGUID = 0; - StalaggGUID = 0; - SapphironGUID = 0; - KelthuzadGUID = 0; - KelthuzadTriggerGUID = 0; minHorsemenDiedTime = 0; maxHorsemenDiedTime = 0; AbominationCount = 0; playerDied = 0; - - memset(PortalsGUID, 0, sizeof(PortalsGUID)); } void OnCreatureCreate(Creature* creature) override @@ -309,7 +293,7 @@ class instance_naxxramas : public InstanceMapScript return 0; } - uint64 GetData64(uint32 id) const override + ObjectGuid GetGuidData(uint32 id) const override { switch (id) { @@ -345,7 +329,7 @@ class instance_naxxramas : public InstanceMapScript return KelthuzadTriggerGUID; } - return 0; + return ObjectGuid::Empty; } bool SetBossState(uint32 id, EncounterState state) override @@ -372,7 +356,7 @@ class instance_naxxramas : public InstanceMapScript if (i == section) continue; - for (uint64 guid : HeiganEruptionGUID[i]) + for (ObjectGuid guid : HeiganEruptionGUID[i]) { if (GameObject* heiganEruption = instance->GetGameObject(guid)) { @@ -434,38 +418,38 @@ class instance_naxxramas : public InstanceMapScript protected: /* The Arachnid Quarter */ // Grand Widow Faerlina - uint64 FaerlinaGUID; + ObjectGuid FaerlinaGUID; /* The Plague Quarter */ // Heigan the Unclean - std::set<uint64> HeiganEruptionGUID[4]; - uint64 HeiganGUID; + GuidSet HeiganEruptionGUID[4]; + ObjectGuid HeiganGUID; /* The Military Quarter */ // Gothik the Harvester - uint64 GothikGateGUID; + ObjectGuid GothikGateGUID; // The Four Horsemen - uint64 ThaneGUID; - uint64 LadyGUID; - uint64 BaronGUID; - uint64 SirGUID; - uint64 HorsemenChestGUID; + ObjectGuid ThaneGUID; + ObjectGuid LadyGUID; + ObjectGuid BaronGUID; + ObjectGuid SirGUID; + ObjectGuid HorsemenChestGUID; time_t minHorsemenDiedTime; time_t maxHorsemenDiedTime; /* The Construct Quarter */ // Thaddius - uint64 ThaddiusGUID; - uint64 FeugenGUID; - uint64 StalaggGUID; + ObjectGuid ThaddiusGUID; + ObjectGuid FeugenGUID; + ObjectGuid StalaggGUID; /* Frostwyrm Lair */ // Sapphiron - uint64 SapphironGUID; + ObjectGuid SapphironGUID; // Kel'Thuzad - uint64 KelthuzadGUID; - uint64 KelthuzadTriggerGUID; - uint64 PortalsGUID[4]; + ObjectGuid KelthuzadGUID; + ObjectGuid KelthuzadTriggerGUID; + ObjectGuid PortalsGUID[4]; uint8 AbominationCount; /* The Immortal / The Undying */ diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp index 9ba0806ffd2..5862453731e 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp @@ -330,7 +330,7 @@ enum MiscData class VehicleCheckPredicate { public: - bool operator()(uint64 guid) { return IS_VEHICLE_GUID(guid); } + bool operator()(ObjectGuid guid) { return guid.IsVehicle(); } }; class boss_malygos : public CreatureScript @@ -351,9 +351,10 @@ public: { _summonDeaths = 0; _preparingPulsesChecker = 0; - _arcaneOverloadGUID = 0; - _lastHitByArcaneBarrageGUID = 0; - memset(_surgeTargetGUID, 0, sizeof(_surgeTargetGUID)); + _arcaneOverloadGUID.Clear(); + _lastHitByArcaneBarrageGUID.Clear(); + for (ObjectGuid& guid : _surgeTargetGUID) + guid.Clear(); _killSpamFilter = false; _canAttack = false; @@ -423,17 +424,17 @@ public: } } - uint64 GetGUID(int32 type) const override + ObjectGuid GetGUID(int32 type) const override { if (type >= DATA_FIRST_SURGE_TARGET_GUID && type < DATA_FIRST_SURGE_TARGET_GUID + NUM_MAX_SURGE_TARGETS) return _surgeTargetGUID[type - DATA_FIRST_SURGE_TARGET_GUID]; else if (type == DATA_LAST_TARGET_BARRAGE_GUID) return _lastHitByArcaneBarrageGUID; - return 0; + return ObjectGuid::Empty; } - void SetGUID(uint64 guid, int32 type) override + void SetGUID(ObjectGuid guid, int32 type) override { switch (type) { @@ -447,6 +448,7 @@ public: break; case DATA_LAST_TARGET_BARRAGE_GUID: _lastHitByArcaneBarrageGUID = guid; + break; } } @@ -456,7 +458,7 @@ public: { case ACTION_LAND_ENCOUNTER_START: events.CancelEventGroup(1); - if (Creature* alexstraszaBunny = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ALEXSTRASZA_BUNNY_GUID))) + if (Creature* alexstraszaBunny = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ALEXSTRASZA_BUNNY_GUID))) { Position pos; pos.m_positionZ = alexstraszaBunny->GetPositionZ(); @@ -720,7 +722,7 @@ public: { _firstCyclicMovementStarted = true; me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - if (Creature* alexstraszaBunny = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ALEXSTRASZA_BUNNY_GUID))) + if (Creature* alexstraszaBunny = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ALEXSTRASZA_BUNNY_GUID))) me->SetFacingToObject(alexstraszaBunny); events.ScheduleEvent(EVENT_SUMMON_ARCANE_BOMB, 1*IN_MILLISECONDS, 0, PHASE_TWO); } @@ -730,7 +732,7 @@ public: break; case POINT_PHASE_ONE_TO_TWO_TRANSITION: me->SetDisableGravity(true); - if (Creature* alexstraszaBunny = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ALEXSTRASZA_BUNNY_GUID))) + if (Creature* alexstraszaBunny = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ALEXSTRASZA_BUNNY_GUID))) me->SetFacingToObject(alexstraszaBunny); me->GetMap()->SetZoneOverrideLight(AREA_EYE_OF_ETERNITY, LIGHT_ARCANE_RUNES, 5 * IN_MILLISECONDS); events.ScheduleEvent(EVENT_FLY_OUT_OF_PLATFORM, 18 * IN_MILLISECONDS, 0, PHASE_TWO); @@ -789,7 +791,7 @@ public: me->CastCustomSpell(SPELL_RANDOM_PORTAL, SPELLVALUE_MAX_TARGETS, 1); break; case EVENT_LAND_START_ENCOUNTER: - if (GameObject* iris = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_FOCUSING_IRIS_GUID))) + if (GameObject* iris = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_FOCUSING_IRIS_GUID))) { me->SetFacingToObject(iris); iris->Delete(); // this is not the best way. @@ -846,7 +848,7 @@ public: case EVENT_FLY_OUT_OF_PLATFORM: if (!_performingDestroyPlatform) { - if (Creature* alexstraszaBunny = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ALEXSTRASZA_BUNNY_GUID))) + if (Creature* alexstraszaBunny = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ALEXSTRASZA_BUNNY_GUID))) { Position randomPosOnRadius; // Hardcodded retail value, reason is Z getters can fail... (TO DO: Change to getter when height calculation works on 100%!) @@ -1002,7 +1004,7 @@ public: { _JustDied(); Talk(SAY_DEATH); - if (Creature* alexstraszaGiftBoxBunny = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GIFT_BOX_BUNNY_GUID))) + if (Creature* alexstraszaGiftBoxBunny = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_GIFT_BOX_BUNNY_GUID))) { if (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) alexstraszaGiftBoxBunny->SummonGameObject(GO_HEART_OF_MAGIC_10, HeartOfMagicSpawnPos.GetPositionX(), HeartOfMagicSpawnPos.GetPositionY(), @@ -1036,9 +1038,9 @@ public: uint8 _phase; // Counter for phases used with a getter. uint8 _summonDeaths; // Keeps count of arcane trash. uint8 _preparingPulsesChecker; // In retail they use 2 preparing pulses with 7 sec CD, after they pass 2 seconds. - uint64 _arcaneOverloadGUID; // Last Arcane Overload summoned to know to which should visual be cast to (the purple ball, not bubble). - uint64 _lastHitByArcaneBarrageGUID; // Last hit player by Arcane Barrage, will be removed if targets > 1. - uint64 _surgeTargetGUID[3]; // All these three are used to keep current tagets to which warning should be sent. + ObjectGuid _arcaneOverloadGUID; // Last Arcane Overload summoned to know to which should visual be cast to (the purple ball, not bubble). + ObjectGuid _lastHitByArcaneBarrageGUID; // Last hit player by Arcane Barrage, will be removed if targets > 1. + ObjectGuid _surgeTargetGUID[3]; // All these three are used to keep current tagets to which warning should be sent. bool _killSpamFilter; // Prevent text spamming on killed player by helping implement a CD. bool _canAttack; // Used to control attacking (Move Chase not being applied after Stop Attack, only few times should act like this). @@ -1075,7 +1077,7 @@ public: { if (spell->Id == SPELL_PORTAL_OPENED) { - if (Creature* malygos = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_MALYGOS))) + if (Creature* malygos = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_MALYGOS))) { if (malygos->AI()->GetData(DATA_PHASE) == PHASE_ONE) DoCast(me, SPELL_SUMMON_POWER_PARK, true); @@ -1089,7 +1091,7 @@ public: if (!me->HasAura(SPELL_PORTAL_VISUAL_CLOSED) && !me->HasAura(SPELL_PORTAL_OPENED)) DoCast(me, SPELL_PORTAL_VISUAL_CLOSED, true); - if (Creature* malygos = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_MALYGOS))) + if (Creature* malygos = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_MALYGOS))) { if (malygos->AI()->GetData(DATA_PHASE) != PHASE_ONE && me->HasAura(SPELL_PORTAL_OPENED)) { @@ -1127,7 +1129,7 @@ public: { me->GetMotionMaster()->MoveIdle(); - if (Creature* malygos = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_MALYGOS))) + if (Creature* malygos = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_MALYGOS))) me->GetMotionMaster()->MoveFollow(malygos, 0.0f, 0.0f); } @@ -1136,7 +1138,7 @@ public: if (!_instance) return; - if (Creature* malygos = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_MALYGOS))) + if (Creature* malygos = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_MALYGOS))) { if (malygos->AI()->GetData(DATA_PHASE) != PHASE_ONE || _instance->GetBossState(DATA_MALYGOS_EVENT) == FAIL) { @@ -1421,7 +1423,7 @@ class npc_nexus_lord : public CreatureScript void JustDied(Unit* /*killer*/) override { - if (Creature* malygos = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_MALYGOS))) + if (Creature* malygos = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_MALYGOS))) malygos->AI()->SetData(DATA_SUMMON_DEATHS, malygos->AI()->GetData(DATA_SUMMON_DEATHS) + 1); } @@ -1488,7 +1490,7 @@ class npc_scion_of_eternity : public CreatureScript void JustDied(Unit* /*killer*/) override { - if (Creature* malygos = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_MALYGOS))) + if (Creature* malygos = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_MALYGOS))) malygos->AI()->SetData(DATA_SUMMON_DEATHS, malygos->AI()->GetData(DATA_SUMMON_DEATHS) + 1); } @@ -1528,7 +1530,7 @@ public: void DoAction(int32 /*action*/) override { - if (Creature* malygos = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_MALYGOS))) + if (Creature* malygos = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_MALYGOS))) { if (malygos->AI()->GetData(DATA_PHASE) == PHASE_TWO) me->DespawnOrUnsummon(6*IN_MILLISECONDS); @@ -1886,7 +1888,7 @@ class spell_malygos_vortex_visual : public SpellScriptLoader if (InstanceScript* instance = caster->GetInstanceScript()) { // Teleport spell - I'm not sure but might be it must be cast by each vehicle when it's passenger leaves it. - if (Creature* trigger = caster->GetMap()->GetCreature(instance->GetData64(DATA_TRIGGER))) + if (Creature* trigger = caster->GetMap()->GetCreature(instance->GetGuidData(DATA_TRIGGER))) trigger->CastSpell(targetPlayer, SPELL_VORTEX_6, true); } } @@ -2032,7 +2034,7 @@ class spell_scion_of_eternity_arcane_barrage : public SpellScriptLoader Creature* caster = GetCaster()->ToCreature(); InstanceScript* instance = caster->GetInstanceScript(); - Creature* malygos = ObjectAccessor::GetCreature(*caster, instance->GetData64(DATA_MALYGOS)); + Creature* malygos = ObjectAccessor::GetCreature(*caster, instance->GetGuidData(DATA_MALYGOS)); // If max possible targets are more than 1 then Scions wouldn't select previosly selected target, // in longer terms this means if spell picks target X then 2nd cast of this spell will pick smth else @@ -2121,7 +2123,7 @@ class spell_malygos_destroy_platform_channel : public SpellScriptLoader { if (Creature* target = GetTarget()->ToCreature()) if (InstanceScript* instance = target->GetInstanceScript()) - if (Creature* platformTrigger = target->GetMap()->GetCreature(instance->GetData64(DATA_ALEXSTRASZA_BUNNY_GUID))) + if (Creature* platformTrigger = target->GetMap()->GetCreature(instance->GetGuidData(DATA_ALEXSTRASZA_BUNNY_GUID))) platformTrigger->CastSpell(platformTrigger, SPELL_DESTROY_PLATFORM_BOOM_VISUAL); } @@ -2195,7 +2197,7 @@ class spell_alexstrasza_bunny_destroy_platform_event : public SpellScriptLoader { Creature* caster = GetCaster()->ToCreature(); if (InstanceScript* instance = caster->GetInstanceScript()) - if (GameObject* platform = caster->GetMap()->GetGameObject(instance->GetData64(DATA_PLATFORM))) + if (GameObject* platform = caster->GetMap()->GetGameObject(instance->GetGuidData(DATA_PLATFORM))) platform->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DESTROYED); } @@ -2478,7 +2480,7 @@ class spell_alexstrasza_gift_beam_visual : public SpellScriptLoader if (InstanceScript* instance = GetCaster()->GetInstanceScript()) { _alexstraszaGift->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - if (GameObject* heartMagic = target->GetMap()->GetGameObject(instance->GetData64(DATA_HEART_OF_MAGIC_GUID))) + if (GameObject* heartMagic = target->GetMap()->GetGameObject(instance->GetGuidData(DATA_HEART_OF_MAGIC_GUID))) { heartMagic->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); // TO DO: This is hack, core doesn't have support for these flags, diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp index d8a5cfae60d..834297aa123 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp @@ -37,19 +37,7 @@ public: { SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); - - vortexTriggers.clear(); - portalTriggers.clear(); - - malygosGUID = 0; - irisGUID = 0; - lastPortalGUID = 0; - platformGUID = 0; - exitPortalGUID = 0; - alexstraszaBunnyGUID = 0; - heartOfMagicGUID = 0; - giftBoxBunnyGUID = 0; - }; + } bool SetBossState(uint32 type, EncounterState state) override { @@ -60,7 +48,7 @@ public: { if (state == FAIL) { - for (std::list<uint64>::const_iterator itr_trigger = portalTriggers.begin(); itr_trigger != portalTriggers.end(); ++itr_trigger) + for (GuidList::const_iterator itr_trigger = portalTriggers.begin(); itr_trigger != portalTriggers.end(); ++itr_trigger) { if (Creature* trigger = instance->GetCreature(*itr_trigger)) { @@ -191,7 +179,7 @@ public: if (Creature* malygos = instance->GetCreature(malygosGUID)) { std::list<HostileReference*> m_threatlist = malygos->getThreatManager().getThreatList(); - for (std::list<uint64>::const_iterator itr_vortex = vortexTriggers.begin(); itr_vortex != vortexTriggers.end(); ++itr_vortex) + for (GuidList::const_iterator itr_vortex = vortexTriggers.begin(); itr_vortex != vortexTriggers.end(); ++itr_vortex) { if (m_threatlist.empty()) return; @@ -225,7 +213,7 @@ public: { bool next = (lastPortalGUID == portalTriggers.back() || !lastPortalGUID ? true : false); - for (std::list<uint64>::const_iterator itr_trigger = portalTriggers.begin(); itr_trigger != portalTriggers.end(); ++itr_trigger) + for (GuidList::const_iterator itr_trigger = portalTriggers.begin(); itr_trigger != portalTriggers.end(); ++itr_trigger) { if (next) { @@ -258,7 +246,7 @@ public: } } - uint64 GetData64(uint32 data) const override + ObjectGuid GetGuidData(uint32 data) const override { switch (data) { @@ -278,20 +266,20 @@ public: return giftBoxBunnyGUID; } - return 0; + return ObjectGuid::Empty; } private: - std::list<uint64> vortexTriggers; - std::list<uint64> portalTriggers; - uint64 malygosGUID; - uint64 irisGUID; - uint64 lastPortalGUID; - uint64 platformGUID; - uint64 exitPortalGUID; - uint64 heartOfMagicGUID; - uint64 alexstraszaBunnyGUID; - uint64 giftBoxBunnyGUID; + GuidList vortexTriggers; + GuidList portalTriggers; + ObjectGuid malygosGUID; + ObjectGuid irisGUID; + ObjectGuid lastPortalGUID; + ObjectGuid platformGUID; + ObjectGuid exitPortalGUID; + ObjectGuid heartOfMagicGUID; + ObjectGuid alexstraszaBunnyGUID; + ObjectGuid giftBoxBunnyGUID; Position focusingIrisPosition; Position exitPortalPosition; }; diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp index 399f2eb8ac2..ed08296acd8 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp @@ -85,7 +85,7 @@ class boss_anomalus : public CreatureScript { Phase = 0; uiSparkTimer = 5000; - uiChaoticRiftGUID = 0; + uiChaoticRiftGUID.Clear(); chaosTheory = true; } @@ -93,7 +93,7 @@ class boss_anomalus : public CreatureScript uint8 Phase; uint32 uiSparkTimer; - uint64 uiChaoticRiftGUID; + ObjectGuid uiChaoticRiftGUID; bool chaosTheory; void Reset() override @@ -151,13 +151,13 @@ class boss_anomalus : public CreatureScript if (Rift && Rift->isDead()) { me->RemoveAurasDueToSpell(SPELL_RIFT_SHIELD); - uiChaoticRiftGUID = 0; + uiChaoticRiftGUID.Clear(); } return; } } else - uiChaoticRiftGUID = 0; + uiChaoticRiftGUID.Clear(); if ((Phase == 0) && HealthBelowPct(50)) { @@ -232,7 +232,7 @@ class npc_chaotic_rift : public CreatureScript if (uiChaoticEnergyBurstTimer <= diff) { - Creature* Anomalus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ANOMALUS)); + Creature* Anomalus = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ANOMALUS)); if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { if (Anomalus && Anomalus->HasAura(SPELL_RIFT_SHIELD)) @@ -250,7 +250,7 @@ class npc_chaotic_rift : public CreatureScript if (Creature* Wraith = me->SummonCreature(NPC_CRAZED_MANA_WRAITH, me->GetPositionX() + 1, me->GetPositionY() + 1, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000)) if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) Wraith->AI()->AttackStart(target); - Creature* Anomalus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ANOMALUS)); + Creature* Anomalus = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ANOMALUS)); if (Anomalus && Anomalus->HasAura(SPELL_RIFT_SHIELD)) uiSummonCrazedManaWraithTimer = 5000; else diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp index 7bc4174260b..6b3df5ef665 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp @@ -84,8 +84,8 @@ public: InstanceScript* instance; - std::list<uint64> intenseColdList; - uint64 auiContainmentSphereGUIDs[DATA_CONTAINMENT_SPHERES]; + GuidList intenseColdList; + ObjectGuid auiContainmentSphereGUIDs[DATA_CONTAINMENT_SPHERES]; uint32 uiCrystalfireBreathTimer; uint32 uiCrystalChainsCrystalizeTimer; uint32 uiTailSweepTimer; @@ -127,9 +127,9 @@ public: bool CheckContainmentSpheres(bool remove_prison = false) { - auiContainmentSphereGUIDs[0] = instance->GetData64(ANOMALUS_CONTAINMET_SPHERE); - auiContainmentSphereGUIDs[1] = instance->GetData64(ORMOROKS_CONTAINMET_SPHERE); - auiContainmentSphereGUIDs[2] = instance->GetData64(TELESTRAS_CONTAINMET_SPHERE); + auiContainmentSphereGUIDs[0] = instance->GetGuidData(ANOMALUS_CONTAINMET_SPHERE); + auiContainmentSphereGUIDs[1] = instance->GetGuidData(ORMOROKS_CONTAINMET_SPHERE); + auiContainmentSphereGUIDs[2] = instance->GetGuidData(TELESTRAS_CONTAINMET_SPHERE); GameObject* ContainmentSpheres[DATA_CONTAINMENT_SPHERES]; @@ -163,7 +163,7 @@ public: } } - void SetGUID(uint64 guid, int32 id/* = 0 */) override + void SetGUID(ObjectGuid guid, int32 id/* = 0 */) override { if (id == DATA_INTENSE_COLD) intenseColdList.push_back(guid); @@ -219,7 +219,7 @@ public: { InstanceScript* instance = go->GetInstanceScript(); - Creature* pKeristrasza = ObjectAccessor::GetCreature(*go, instance->GetData64(DATA_KERISTRASZA)); + Creature* pKeristrasza = ObjectAccessor::GetCreature(*go, instance->GetGuidData(DATA_KERISTRASZA)); if (pKeristrasza && pKeristrasza->IsAlive()) { // maybe these are hacks :( @@ -277,9 +277,9 @@ class achievement_intense_cold : public AchievementCriteriaScript if (!target) return false; - std::list<uint64> intenseColdList = ENSURE_AI(boss_keristrasza::boss_keristraszaAI, target->ToCreature()->AI())->intenseColdList; + GuidList intenseColdList = ENSURE_AI(boss_keristrasza::boss_keristraszaAI, target->ToCreature()->AI())->intenseColdList; if (!intenseColdList.empty()) - for (std::list<uint64>::iterator itr = intenseColdList.begin(); itr != intenseColdList.end(); ++itr) + for (GuidList::iterator itr = intenseColdList.begin(); itr != intenseColdList.end(); ++itr) if (player->GetGUID() == *itr) return false; diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp index c08fd97a76f..8c58a65cdbe 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp @@ -89,9 +89,9 @@ public: uiGravityWellTimer = 15 * IN_MILLISECONDS; uiCooldown = 0; - uiFireMagusGUID = 0; - uiFrostMagusGUID = 0; - uiArcaneMagusGUID = 0; + uiFireMagusGUID.Clear(); + uiFrostMagusGUID.Clear(); + uiArcaneMagusGUID.Clear(); for (uint8 n = 0; n < 3; ++n) time[n] = 0; @@ -102,9 +102,9 @@ public: InstanceScript* instance; - uint64 uiFireMagusGUID; - uint64 uiFrostMagusGUID; - uint64 uiArcaneMagusGUID; + ObjectGuid uiFireMagusGUID; + ObjectGuid uiFrostMagusGUID; + ObjectGuid uiArcaneMagusGUID; bool bFireMagusDead; bool bFrostMagusDead; @@ -173,7 +173,7 @@ public: return 0; } - uint64 SplitPersonality(uint32 entry) + ObjectGuid SplitPersonality(uint32 entry) { if (Creature* Summoned = me->SummonCreature(entry, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1*IN_MILLISECONDS)) { @@ -199,7 +199,7 @@ public: Summoned->AI()->AttackStart(target); return Summoned->GetGUID(); } - return 0; + return ObjectGuid::Empty; } void SummonedCreatureDespawn(Creature* summon) override @@ -256,9 +256,9 @@ public: Phase = 2; if (Phase == 3) Phase = 4; - uiFireMagusGUID = 0; - uiFrostMagusGUID = 0; - uiArcaneMagusGUID = 0; + uiFireMagusGUID.Clear(); + uiFrostMagusGUID.Clear(); + uiArcaneMagusGUID.Clear(); bIsWaitingToAppear = true; uiIsWaitingToAppearTimer = 4*IN_MILLISECONDS; Talk(SAY_MERGE); diff --git a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp index 663f4bca6ac..91a40d43f12 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp @@ -44,12 +44,12 @@ public: uint32 m_auiEncounter[NUMBER_OF_ENCOUNTERS]; - uint64 Anomalus; - uint64 Keristrasza; + ObjectGuid Anomalus; + ObjectGuid Keristrasza; - uint64 AnomalusContainmentSphere; - uint64 OrmoroksContainmentSphere; - uint64 TelestrasContainmentSphere; + ObjectGuid AnomalusContainmentSphere; + ObjectGuid OrmoroksContainmentSphere; + ObjectGuid TelestrasContainmentSphere; std::string strInstData; @@ -57,12 +57,6 @@ public: { SetHeaders(DataHeader); memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - Anomalus = 0; - Keristrasza = 0; - AnomalusContainmentSphere = 0; - OrmoroksContainmentSphere = 0; - TelestrasContainmentSphere = 0; } void OnCreatureCreate(Creature* creature) override @@ -222,7 +216,7 @@ public: } } - uint64 GetData64(uint32 uiIdentifier) const override + ObjectGuid GetGuidData(uint32 uiIdentifier) const override { switch (uiIdentifier) { @@ -232,7 +226,7 @@ public: case ORMOROKS_CONTAINMET_SPHERE: return OrmoroksContainmentSphere; case TELESTRAS_CONTAINMET_SPHERE: return TelestrasContainmentSphere; } - return 0; + return ObjectGuid::Empty; } std::string GetSaveData() override diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp index 17508517f44..0119b81796e 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp @@ -184,7 +184,7 @@ class npc_azure_ring_captain : public CreatureScript void Initialize() { - targetGUID = 0; + targetGUID.Clear(); } void Reset() override @@ -231,7 +231,7 @@ class npc_azure_ring_captain : public CreatureScript switch (action) { case ACTION_CALL_DRAGON_EVENT: - if (Creature* varos = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VAROS))) + if (Creature* varos = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VAROS))) { if (Unit* victim = varos->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0)) { @@ -246,7 +246,7 @@ class npc_azure_ring_captain : public CreatureScript } private: - uint64 targetGUID; + ObjectGuid targetGUID; InstanceScript* instance; }; diff --git a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp index b758f9c678c..1c5aadc3581 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp @@ -44,20 +44,7 @@ class instance_oculus : public InstanceMapScript SetBossNumber(EncounterCount); LoadDoorData(doorData); - DrakosGUID = 0; - VarosGUID = 0; - UromGUID = 0; - EregosGUID = 0; - CentrifugueConstructCounter = 0; - - EregosCacheGUID = 0; - - GreaterWhelpList.clear(); - - BelgaristraszGUID = 0; - EternosGUID = 0; - VerdisaGUID = 0; } void OnCreatureCreate(Creature* creature) override @@ -240,7 +227,7 @@ class instance_oculus : public InstanceMapScript return true; } - uint64 GetData64(uint32 type) const override + ObjectGuid GetGuidData(uint32 type) const override { switch (type) { @@ -256,7 +243,7 @@ class instance_oculus : public InstanceMapScript break; } - return 0; + return ObjectGuid::Empty; } void FreeDragons() @@ -282,26 +269,26 @@ class instance_oculus : public InstanceMapScript void GreaterWhelps() { - for (uint64 guid : GreaterWhelpList) + for (ObjectGuid guid : GreaterWhelpList) if (Creature* gwhelp = instance->GetCreature(guid)) gwhelp->SetPhaseMask(1, true); } protected: - uint64 DrakosGUID; - uint64 VarosGUID; - uint64 UromGUID; - uint64 EregosGUID; + ObjectGuid DrakosGUID; + ObjectGuid VarosGUID; + ObjectGuid UromGUID; + ObjectGuid EregosGUID; - uint64 BelgaristraszGUID; - uint64 EternosGUID; - uint64 VerdisaGUID; + ObjectGuid BelgaristraszGUID; + ObjectGuid EternosGUID; + ObjectGuid VerdisaGUID; uint8 CentrifugueConstructCounter; - uint64 EregosCacheGUID; + ObjectGuid EregosCacheGUID; - std::list<uint64> GreaterWhelpList; + GuidList GreaterWhelpList; }; InstanceScript* GetInstanceScript(InstanceMap* map) const override diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp index 29de693bf3a..b5079d8cf4f 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp @@ -109,7 +109,6 @@ public: Initialize(); instance = creature->GetInstanceScript(); m_uiStance = STANCE_DEFENSIVE; - memset(&m_auiStormforgedLieutenantGUID, 0, sizeof(m_auiStormforgedLieutenantGUID)); canBuff = true; } @@ -158,7 +157,7 @@ public: uint32 m_uiMortalStrike_Timer; uint32 m_uiSlam_Timer; - uint64 m_auiStormforgedLieutenantGUID[2]; + ObjectGuid m_auiStormforgedLieutenantGUID[2]; void Reset() override { @@ -170,6 +169,7 @@ public: for (uint8 i = 0; i < 2; ++i) { + // Something isn't right here - m_auiStormforgedLieutenantGUID is never assinged to if (Creature* pStormforgedLieutenant = ObjectAccessor::GetCreature(*me, m_auiStormforgedLieutenantGUID[i])) if (!pStormforgedLieutenant->IsAlive()) pStormforgedLieutenant->Respawn(); @@ -421,7 +421,7 @@ public: void EnterCombat(Unit* who) override { - if (Creature* pBjarngrim = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BJARNGRIM))) + if (Creature* pBjarngrim = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BJARNGRIM))) { if (pBjarngrim->IsAlive() && !pBjarngrim->GetVictim()) pBjarngrim->AI()->AttackStart(who); @@ -444,7 +444,7 @@ public: if (m_uiRenewSteel_Timer <= uiDiff) { - if (Creature* pBjarngrim = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BJARNGRIM))) + if (Creature* pBjarngrim = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BJARNGRIM))) { if (pBjarngrim->IsAlive()) DoCast(pBjarngrim, SPELL_RENEW_STEEL_N); diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp index ddd88681a05..274fbed0fc9 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp @@ -168,7 +168,7 @@ public: Position pos = me->GetPosition(); - for (uint64 guid : lSparkList) + for (ObjectGuid guid : lSparkList) { if (Creature* pSpark = ObjectAccessor::GetCreature(*me, guid)) { @@ -348,7 +348,7 @@ public: // Prevent them to follow players through the whole instance if (uiCheckTimer <= uiDiff) { - Creature* ionar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_IONAR)); + Creature* ionar = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_IONAR)); if (ionar && ionar->IsAlive()) { if (me->GetDistance(ionar) > DATA_MAX_SPARK_DISTANCE) diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp index 4ca94f69c5b..d63d5e87923 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp @@ -100,7 +100,7 @@ public: InstanceScript* instance; - std::list<uint64> m_lGolemGUIDList; + GuidList m_lGolemGUIDList; bool m_bHasTemper; bool m_bIsStriking; @@ -164,7 +164,7 @@ public: if (m_lGolemGUIDList.empty()) return; - for (uint64 guid : m_lGolemGUIDList) + for (ObjectGuid guid : m_lGolemGUIDList) { if (Creature* temp = ObjectAccessor::GetCreature(*me, guid)) if (temp->IsAlive()) @@ -179,7 +179,7 @@ public: if (m_lGolemGUIDList.empty()) return; - for (uint64 guid : m_lGolemGUIDList) + for (ObjectGuid guid : m_lGolemGUIDList) { if (Creature* temp = ObjectAccessor::GetCreature(*me, guid)) { diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp index 0f44f935d24..0d39a8921e8 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp @@ -39,13 +39,6 @@ class instance_halls_of_lightning : public InstanceMapScript SetHeaders(DataHeader); SetBossNumber(EncounterCount); LoadDoorData(doorData); - - GeneralBjarngrimGUID = 0; - VolkhanGUID = 0; - IonarGUID = 0; - LokenGUID = 0; - - LokenGlobeGUID = 0; } void OnCreatureCreate(Creature* creature) override @@ -119,7 +112,7 @@ class instance_halls_of_lightning : public InstanceMapScript return true; } - uint64 GetData64(uint32 type) const override + ObjectGuid GetGuidData(uint32 type) const override { switch (type) { @@ -134,16 +127,16 @@ class instance_halls_of_lightning : public InstanceMapScript default: break; } - return 0; + return ObjectGuid::Empty; } protected: - uint64 GeneralBjarngrimGUID; - uint64 VolkhanGUID; - uint64 IonarGUID; - uint64 LokenGUID; + ObjectGuid GeneralBjarngrimGUID; + ObjectGuid VolkhanGUID; + ObjectGuid IonarGUID; + ObjectGuid LokenGUID; - uint64 LokenGlobeGUID; + ObjectGuid LokenGlobeGUID; }; InstanceScript* GetInstanceScript(InstanceMap* map) const override diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp index 63000df133e..ac3df1e49aa 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp @@ -281,7 +281,7 @@ class npc_iron_sludge : public CreatureScript void JustDied(Unit* /*killer*/) override { - if (Creature* sjonnir = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SJONNIR))) + if (Creature* sjonnir = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SJONNIR))) sjonnir->AI()->DoAction(ACTION_OOZE_DEAD); } }; diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp index 11f616e8550..f98a6e40a07 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp @@ -164,16 +164,16 @@ public: bool bMarnakActivated; bool bAbedneumActivated; - std::list<uint64> KaddrakGUIDList; + GuidList KaddrakGUIDList; void Reset() override { Initialize(); - instance->HandleGameObject(instance->GetData64(DATA_GO_KADDRAK), false); - instance->HandleGameObject(instance->GetData64(DATA_GO_MARNAK), false); - instance->HandleGameObject(instance->GetData64(DATA_GO_ABEDNEUM), false); - instance->HandleGameObject(instance->GetData64(DATA_GO_SKY_FLOOR), false); + instance->HandleGameObject(instance->GetGuidData(DATA_GO_KADDRAK), false); + instance->HandleGameObject(instance->GetGuidData(DATA_GO_MARNAK), false); + instance->HandleGameObject(instance->GetGuidData(DATA_GO_ABEDNEUM), false); + instance->HandleGameObject(instance->GetGuidData(DATA_GO_SKY_FLOOR), false); KaddrakGUIDList.clear(); } @@ -212,7 +212,7 @@ public: { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) if (!KaddrakGUIDList.empty()) - for (std::list<uint64>::const_iterator itr = KaddrakGUIDList.begin(); itr != KaddrakGUIDList.end(); ++itr) + for (GuidList::const_iterator itr = KaddrakGUIDList.begin(); itr != KaddrakGUIDList.end(); ++itr) { if (Creature* pKaddrak = ObjectAccessor::GetCreature(*me, *itr)) { @@ -306,15 +306,15 @@ public: bIsBattle = false; uiStep = 0; uiPhaseTimer = 0; - uiControllerGUID = 0; + uiControllerGUID.Clear(); brannSparklinNews = true; } uint32 uiStep; uint32 uiPhaseTimer; - uint64 uiControllerGUID; - std::list<uint64> lDwarfGUIDList; + ObjectGuid uiControllerGUID; + GuidList lDwarfGUIDList; InstanceScript* instance; @@ -338,9 +338,9 @@ public: { if (lDwarfGUIDList.empty()) return; - for (std::list<uint64>::const_iterator itr = lDwarfGUIDList.begin(); itr != lDwarfGUIDList.end(); ++itr) + for (GuidList::const_iterator itr = lDwarfGUIDList.begin(); itr != lDwarfGUIDList.end(); ++itr) { - Creature* temp = ObjectAccessor::GetCreature(*me, instance ? (*itr) : 0); + Creature* temp = ObjectAccessor::GetCreature(*me, instance ? (*itr) : ObjectGuid::Empty); if (temp && temp->IsAlive()) temp->DespawnOrUnsummon(); } @@ -367,7 +367,7 @@ public: break; case 17: Talk(SAY_EVENT_INTRO_2); - instance->HandleGameObject(instance->GetData64(DATA_GO_TRIBUNAL_CONSOLE), true); + instance->HandleGameObject(instance->GetGuidData(DATA_GO_TRIBUNAL_CONSOLE), true); me->SetStandState(UNIT_STAND_STATE_KNEEL); SetEscortPaused(true); JumpToNextStep(8500); @@ -455,7 +455,7 @@ public: JumpToNextStep(0); break; case 5: - if (Creature* temp = (ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))) + if (Creature* temp = (ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ABEDNEUM)))) temp->AI()->Talk(SAY_EVENT_INTRO_3_ABED); JumpToNextStep(8500); break; @@ -464,13 +464,13 @@ public: JumpToNextStep(6500); break; case 7: - if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KADDRAK))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KADDRAK))) temp->AI()->Talk(SAY_EVENT_A_2_KADD); JumpToNextStep(12500); break; case 8: Talk(SAY_EVENT_A_3); - instance->HandleGameObject(instance->GetData64(DATA_GO_KADDRAK), true); + instance->HandleGameObject(instance->GetGuidData(DATA_GO_KADDRAK), true); if (Creature* temp = ObjectAccessor::GetCreature(*me, uiControllerGUID)) ENSURE_AI(npc_tribuna_controller::npc_tribuna_controllerAI, temp->AI())->bKaddrakActivated = true; JumpToNextStep(5000); @@ -485,14 +485,14 @@ public: JumpToNextStep(6000); break; case 11: - if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MARNAK))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MARNAK))) temp->AI()->Talk(SAY_EVENT_B_2_MARN); SpawnDwarf(1); JumpToNextStep(20000); break; case 12: Talk(SAY_EVENT_B_3); - instance->HandleGameObject(instance->GetData64(DATA_GO_MARNAK), true); + instance->HandleGameObject(instance->GetGuidData(DATA_GO_MARNAK), true); if (Creature* temp = ObjectAccessor::GetCreature(*me, uiControllerGUID)) ENSURE_AI(npc_tribuna_controller::npc_tribuna_controllerAI, temp->AI())->bMarnakActivated = true; JumpToNextStep(10000); @@ -515,14 +515,14 @@ public: JumpToNextStep(20000); break; case 17: - if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ABEDNEUM))) temp->AI()->Talk(SAY_EVENT_C_2_ABED); SpawnDwarf(1); JumpToNextStep(20000); break; case 18: Talk(SAY_EVENT_C_3); - instance->HandleGameObject(instance->GetData64(DATA_GO_ABEDNEUM), true); + instance->HandleGameObject(instance->GetGuidData(DATA_GO_ABEDNEUM), true); if (Creature* temp = ObjectAccessor::GetCreature(*me, uiControllerGUID)) ENSURE_AI(npc_tribuna_controller::npc_tribuna_controllerAI, temp->AI())->bAbedneumActivated = true; JumpToNextStep(5000); @@ -541,7 +541,7 @@ public: JumpToNextStep(20000); break; case 22: - if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ABEDNEUM))) temp->AI()->Talk(SAY_EVENT_D_2_ABED); SpawnDwarf(1); JumpToNextStep(5000); @@ -564,7 +564,7 @@ public: JumpToNextStep(10000); break; case 27: - if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ABEDNEUM))) temp->AI()->Talk(SAY_EVENT_D_4_ABED); SpawnDwarf(1); JumpToNextStep(10000); @@ -573,7 +573,7 @@ public: me->SetReactState(REACT_DEFENSIVE); Talk(SAY_EVENT_END_01); me->SetStandState(UNIT_STAND_STATE_STAND); - instance->HandleGameObject(instance->GetData64(DATA_GO_SKY_FLOOR), true); + instance->HandleGameObject(instance->GetGuidData(DATA_GO_SKY_FLOOR), true); if (Creature* temp = ObjectAccessor::GetCreature(*me, uiControllerGUID)) temp->DealDamage(temp, temp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); bIsBattle = true; @@ -587,7 +587,7 @@ public: JumpToNextStep(5500); break; case 30: - if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ABEDNEUM))) temp->AI()->Talk(SAY_EVENT_END_03_ABED); JumpToNextStep(8500); break; @@ -596,7 +596,7 @@ public: JumpToNextStep(11500); break; case 32: - if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ABEDNEUM))) temp->AI()->Talk(SAY_EVENT_END_05_ABED); JumpToNextStep(11500); break; @@ -605,7 +605,7 @@ public: JumpToNextStep(4500); break; case 34: - if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ABEDNEUM))) temp->AI()->Talk(SAY_EVENT_END_07_ABED); JumpToNextStep(22500); break; @@ -614,7 +614,7 @@ public: JumpToNextStep(7500); break; case 36: - if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KADDRAK))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KADDRAK))) temp->AI()->Talk(SAY_EVENT_END_09_KADD); JumpToNextStep(18500); break; @@ -623,7 +623,7 @@ public: JumpToNextStep(5500); break; case 38: - if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KADDRAK))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KADDRAK))) temp->AI()->Talk(SAY_EVENT_END_11_KADD); JumpToNextStep(20500); break; @@ -632,7 +632,7 @@ public: JumpToNextStep(2500); break; case 40: - if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KADDRAK))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KADDRAK))) temp->AI()->Talk(SAY_EVENT_END_13_KADD); JumpToNextStep(19500); break; @@ -641,7 +641,7 @@ public: JumpToNextStep(10500); break; case 42: - if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MARNAK))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MARNAK))) temp->AI()->Talk(SAY_EVENT_END_15_MARN); JumpToNextStep(6500); break; @@ -650,7 +650,7 @@ public: JumpToNextStep(6500); break; case 44: - if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MARNAK))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MARNAK))) temp->AI()->Talk(SAY_EVENT_END_17_MARN); JumpToNextStep(25500); break; @@ -659,7 +659,7 @@ public: JumpToNextStep(23500); break; case 46: - if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MARNAK))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MARNAK))) temp->AI()->Talk(SAY_EVENT_END_19_MARN); JumpToNextStep(3500); break; @@ -668,16 +668,16 @@ public: JumpToNextStep(8500); break; case 48: - if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ABEDNEUM))) temp->AI()->Talk(SAY_EVENT_END_21_ABED); JumpToNextStep(5500); break; case 49: { - instance->HandleGameObject(instance->GetData64(DATA_GO_KADDRAK), false); - instance->HandleGameObject(instance->GetData64(DATA_GO_MARNAK), false); - instance->HandleGameObject(instance->GetData64(DATA_GO_ABEDNEUM), false); - instance->HandleGameObject(instance->GetData64(DATA_GO_SKY_FLOOR), false); + instance->HandleGameObject(instance->GetGuidData(DATA_GO_KADDRAK), false); + instance->HandleGameObject(instance->GetGuidData(DATA_GO_MARNAK), false); + instance->HandleGameObject(instance->GetGuidData(DATA_GO_ABEDNEUM), false); + instance->HandleGameObject(instance->GetGuidData(DATA_GO_SKY_FLOOR), false); Player* player = GetPlayerForEscort(); if (player) player->GroupEventHappens(QUEST_HALLS_OF_STONE, me); diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp index b7aa606aeeb..d5849d43e37 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp @@ -39,22 +39,6 @@ class instance_halls_of_stone : public InstanceMapScript SetHeaders(DataHeader); SetBossNumber(EncounterCount); LoadDoorData(doorData); - - KrystallusGUID = 0; - MaidenOfGriefGUID = 0; - SjonnirGUID = 0; - - KaddrakGUID = 0; - AbedneumGUID = 0; - MarnakGUID = 0; - BrannGUID = 0; - - TribunalConsoleGUID = 0; - TribunalChestGUID = 0; - TribunalSkyFloorGUID = 0; - KaddrakGoGUID = 0; - AbedneumGoGUID = 0; - MarnakGoGUID = 0; } void OnCreatureCreate(Creature* creature) override @@ -132,7 +116,7 @@ class instance_halls_of_stone : public InstanceMapScript } } - uint64 GetData64(uint32 type) const override + ObjectGuid GetGuidData(uint32 type) const override { switch (type) { @@ -162,7 +146,7 @@ class instance_halls_of_stone : public InstanceMapScript break; } - return 0; + return ObjectGuid::Empty; } bool SetBossState(uint32 type, EncounterState state) override @@ -205,21 +189,21 @@ class instance_halls_of_stone : public InstanceMapScript } protected: - uint64 KrystallusGUID; - uint64 MaidenOfGriefGUID; - uint64 SjonnirGUID; - - uint64 KaddrakGUID; - uint64 AbedneumGUID; - uint64 MarnakGUID; - uint64 BrannGUID; - - uint64 TribunalConsoleGUID; - uint64 TribunalChestGUID; - uint64 TribunalSkyFloorGUID; - uint64 KaddrakGoGUID; - uint64 AbedneumGoGUID; - uint64 MarnakGoGUID; + ObjectGuid KrystallusGUID; + ObjectGuid MaidenOfGriefGUID; + ObjectGuid SjonnirGUID; + + ObjectGuid KaddrakGUID; + ObjectGuid AbedneumGUID; + ObjectGuid MarnakGUID; + ObjectGuid BrannGUID; + + ObjectGuid TribunalConsoleGUID; + ObjectGuid TribunalChestGUID; + ObjectGuid TribunalSkyFloorGUID; + ObjectGuid KaddrakGoGUID; + ObjectGuid AbedneumGoGUID; + ObjectGuid MarnakGoGUID; }; InstanceScript* GetInstanceScript(InstanceMap* map) const override diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp index 3c073578d49..bd5b61e227f 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp @@ -403,7 +403,7 @@ class boss_algalon_the_observer : public CreatureScript { _firstPull = false; Talk(SAY_ALGALON_START_TIMER); - if (Creature* brann = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BRANN_BRONZEBEARD_ALG))) + if (Creature* brann = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BRANN_BRONZEBEARD_ALG))) brann->AI()->DoAction(ACTION_FINISH_INTRO); me->setActive(true); @@ -1008,10 +1008,10 @@ class go_celestial_planetarium_access : public GameObjectScript if (InstanceScript* instance = go->GetInstanceScript()) { instance->SetData(DATA_ALGALON_SUMMON_STATE, 1); - if (GameObject* sigil = ObjectAccessor::GetGameObject(*go, instance->GetData64(DATA_SIGILDOOR_01))) + if (GameObject* sigil = ObjectAccessor::GetGameObject(*go, instance->GetGuidData(DATA_SIGILDOOR_01))) sigil->SetGoState(GO_STATE_ACTIVE); - if (GameObject* sigil = ObjectAccessor::GetGameObject(*go, instance->GetData64(DATA_SIGILDOOR_02))) + if (GameObject* sigil = ObjectAccessor::GetGameObject(*go, instance->GetGuidData(DATA_SIGILDOOR_02))) sigil->SetGoState(GO_STATE_ACTIVE); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp index 80b3882593c..bb7a8592e04 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp @@ -210,11 +210,11 @@ class boss_steelbreaker : public CreatureScript Talk(SAY_STEELBREAKER_DEATH); //DoCastAOE(SPELL_SUPERCHARGE, true); - if (Creature* Brundir = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BRUNDIR))) + if (Creature* Brundir = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BRUNDIR))) if (Brundir->IsAlive()) Brundir->AI()->DoAction(ACTION_SUPERCHARGE); - if (Creature* Molgeim = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MOLGEIM))) + if (Creature* Molgeim = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MOLGEIM))) if (Molgeim->IsAlive()) Molgeim->AI()->DoAction(ACTION_SUPERCHARGE); } @@ -355,11 +355,11 @@ class boss_runemaster_molgeim : public CreatureScript Talk(SAY_MOLGEIM_DEATH); //DoCastAOE(SPELL_SUPERCHARGE, true); - if (Creature* Brundir = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BRUNDIR))) + if (Creature* Brundir = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BRUNDIR))) if (Brundir->IsAlive()) Brundir->AI()->DoAction(ACTION_SUPERCHARGE); - if (Creature* Steelbreaker = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_STEELBREAKER))) + if (Creature* Steelbreaker = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_STEELBREAKER))) if (Steelbreaker->IsAlive()) Steelbreaker->AI()->DoAction(ACTION_SUPERCHARGE); } @@ -396,12 +396,12 @@ class boss_runemaster_molgeim : public CreatureScript switch (urand(0, 2)) { case 1: - if (Creature* Steelbreaker = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_STEELBREAKER))) + if (Creature* Steelbreaker = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_STEELBREAKER))) if (Steelbreaker->IsAlive()) target = Steelbreaker; break; case 2: - if (Creature* Brundir = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_STEELBREAKER))) + if (Creature* Brundir = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_STEELBREAKER))) if (Brundir->IsAlive()) target = Brundir; break; @@ -528,11 +528,11 @@ class boss_stormcaller_brundir : public CreatureScript Talk(SAY_BRUNDIR_DEATH); //DoCastAOE(SPELL_SUPERCHARGE, true); - if (Creature* Molgeim = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MOLGEIM))) + if (Creature* Molgeim = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MOLGEIM))) if (Molgeim->IsAlive()) Molgeim->AI()->DoAction(ACTION_SUPERCHARGE); - if (Creature* Steelbreaker = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_STEELBREAKER))) + if (Creature* Steelbreaker = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_STEELBREAKER))) if (Steelbreaker->IsAlive()) Steelbreaker->AI()->DoAction(ACTION_SUPERCHARGE); } @@ -689,7 +689,7 @@ class spell_assembly_meltdown : public SpellScriptLoader void HandleInstaKill(SpellEffIndex /*effIndex*/) { if (InstanceScript* instance = GetCaster()->GetInstanceScript()) - if (Creature* Steelbreaker = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_STEELBREAKER))) + if (Creature* Steelbreaker = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(DATA_STEELBREAKER))) Steelbreaker->AI()->DoAction(ACTION_ADD_CHARGE); } @@ -724,7 +724,7 @@ class spell_assembly_rune_of_summoning : public SpellScriptLoader void HandlePeriodic(AuraEffect const* aurEff) { PreventDefaultAction(); - GetTarget()->CastSpell(GetTarget(), SPELL_RUNE_OF_SUMMONING_SUMMON, true, NULL, aurEff, GetTarget()->IsSummon() ? GetTarget()->ToTempSummon()->GetSummonerGUID() : 0); + GetTarget()->CastSpell(GetTarget(), SPELL_RUNE_OF_SUMMONING_SUMMON, true, NULL, aurEff, GetTarget()->IsSummon() ? GetTarget()->ToTempSummon()->GetSummonerGUID() : ObjectGuid::Empty); } void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp index 34c5344e1cf..b84ba45951e 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp @@ -112,7 +112,7 @@ class boss_auriaya : public CreatureScript void Initialize() { - DefenderGUID = 0; + DefenderGUID.Clear(); defenderLives = 8; crazyCatLady = true; nineLives = false; @@ -279,7 +279,7 @@ class boss_auriaya : public CreatureScript } private: - uint64 DefenderGUID; + ObjectGuid DefenderGUID; uint8 defenderLives; bool crazyCatLady; bool nineLives; @@ -385,7 +385,7 @@ class npc_sanctum_sentry : public CreatureScript void JustDied(Unit* /*killer*/) override { - if (Creature* Auriaya = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_AURIAYA))) + if (Creature* Auriaya = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_AURIAYA))) Auriaya->AI()->DoAction(ACTION_CRAZY_CAT_LADY); } @@ -461,7 +461,7 @@ class npc_feral_defender : public CreatureScript void JustDied(Unit* /*killer*/) override { DoCast(me, SPELL_SUMMON_ESSENCE); - if (Creature* Auriaya = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_AURIAYA))) + if (Creature* Auriaya = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_AURIAYA))) Auriaya->AI()->DoAction(ACTION_RESPAWN_DEFENDER); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp index 8091f77a531..959cb73a996 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp @@ -227,7 +227,6 @@ class boss_flame_leviathan : public CreatureScript boss_flame_leviathanAI(Creature* creature) : BossAI(creature, BOSS_LEVIATHAN), vehicle(creature->GetVehicleKit()) { Initialize(); - _pursueTarget = 0; } void Initialize() @@ -273,7 +272,7 @@ class boss_flame_leviathan : public CreatureScript _Reset(); //resets shutdown counter to 0. 2 or 4 depending on raid mode Shutdown = 0; - _pursueTarget = 0; + _pursueTarget.Clear(); me->SetReactState(REACT_DEFENSIVE); } @@ -557,7 +556,7 @@ class boss_flame_leviathan : public CreatureScript } } - uint64 _pursueTarget; + ObjectGuid _pursueTarget; }; CreatureAI* GetAI(Creature* creature) const override @@ -1003,7 +1002,7 @@ public: npc_escortAI::UpdateAI(diff); if (!HasEscortState(STATE_ESCORT_ESCORTING)) - Start(false, true, 0, NULL, false, true); + Start(false, true, ObjectGuid::Empty, NULL, false, true); else { if (infernoTimer <= diff) @@ -1208,7 +1207,7 @@ class npc_lorekeeper : public CreatureScript player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+2: - if (Creature* leviathan = instance->instance->GetCreature(instance->GetData64(BOSS_LEVIATHAN))) + if (Creature* leviathan = instance->instance->GetCreature(instance->GetGuidData(BOSS_LEVIATHAN))) { leviathan->AI()->DoAction(ACTION_START_HARD_MODE); creature->SetVisible(false); @@ -1670,7 +1669,7 @@ class FlameLeviathanPursuedTargetSelector //! Vehicle must be in use by player bool playerFound = false; for (SeatMap::const_iterator itr = vehicle->Seats.begin(); itr != vehicle->Seats.end() && !playerFound; ++itr) - if (IS_PLAYER_GUID(itr->second.Passenger.Guid)) + if (itr->second.Passenger.Guid.IsPlayer()) playerFound = true; return !playerFound; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp index ecebeb8d4e5..93fee8d1964 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp @@ -226,7 +226,6 @@ class npc_iron_roots : public CreatureScript me->ApplySpellImmune(0, IMMUNITY_ID, 49560, true); // Death Grip me->setFaction(14); me->SetReactState(REACT_PASSIVE); - summonerGUID = 0; } void IsSummonedBy(Unit* summoner) override @@ -251,7 +250,7 @@ class npc_iron_roots : public CreatureScript } private: - uint64 summonerGUID; + ObjectGuid summonerGUID; }; CreatureAI* GetAI(Creature* creature) const override @@ -284,7 +283,7 @@ class boss_freya : public CreatureScript for (uint8 i = 0; i < 3; ++i) for (uint8 n = 0; n < 2; ++n) - ElementalGUID[i][n] = 0; + ElementalGUID[i][n].Clear(); for (uint8 i = 0; i < 6; ++i) for (uint8 n = 0; n < 2; ++n) deforestation[i][n] = 0; @@ -297,7 +296,7 @@ class boss_freya : public CreatureScript random[n] = false; } - uint64 ElementalGUID[3][2]; + ObjectGuid ElementalGUID[3][2]; uint32 deforestation[6][2]; uint32 elementalTimer[2]; @@ -340,7 +339,7 @@ class boss_freya : public CreatureScript Creature* Elder[3]; for (uint8 n = 0; n < 3; ++n) { - Elder[n] = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_BRIGHTLEAF + n)); + Elder[n] = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_BRIGHTLEAF + n)); if (Elder[n] && Elder[n]->IsAlive()) { me->AddAura(SPELL_DRAINED_OF_POWER, Elder[n]); @@ -615,7 +614,7 @@ class boss_freya : public CreatureScript Creature* Elder[3]; for (uint8 n = 0; n < 3; ++n) { - Elder[n] = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_BRIGHTLEAF + n)); + Elder[n] = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_BRIGHTLEAF + n)); if (Elder[n] && Elder[n]->IsAlive()) { Elder[n]->RemoveAllAuras(); @@ -715,10 +714,10 @@ class boss_elder_brightleaf : public CreatureScript if (killer->GetTypeId() == TYPEID_PLAYER) { - if (Creature* Ironbranch = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_IRONBRANCH))) + if (Creature* Ironbranch = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_IRONBRANCH))) Ironbranch->AI()->DoAction(ACTION_ELDER_DEATH); - if (Creature* Stonebark = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_STONEBARK))) + if (Creature* Stonebark = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_STONEBARK))) Stonebark->AI()->DoAction(ACTION_ELDER_DEATH); } } @@ -822,10 +821,10 @@ class boss_elder_stonebark : public CreatureScript if (killer->GetTypeId() == TYPEID_PLAYER) { - if (Creature* Ironbranch = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_IRONBRANCH))) + if (Creature* Ironbranch = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_IRONBRANCH))) Ironbranch->AI()->DoAction(ACTION_ELDER_DEATH); - if (Creature* Brightleaf = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_BRIGHTLEAF))) + if (Creature* Brightleaf = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_BRIGHTLEAF))) Brightleaf->AI()->DoAction(ACTION_ELDER_DEATH); } } @@ -935,10 +934,10 @@ class boss_elder_ironbranch : public CreatureScript if (killer->GetTypeId() == TYPEID_PLAYER) { - if (Creature* Brightleaf = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_BRIGHTLEAF))) + if (Creature* Brightleaf = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_BRIGHTLEAF))) Brightleaf->AI()->DoAction(ACTION_ELDER_DEATH); - if (Creature* Stonebark = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_STONEBARK))) + if (Creature* Stonebark = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_STONEBARK))) Stonebark->AI()->DoAction(ACTION_ELDER_DEATH); } } @@ -1076,7 +1075,7 @@ class npc_ancient_water_spirit : public CreatureScript { Initialize(); instance = me->GetInstanceScript(); - if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_FREYA))) + if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_FREYA))) waveCount = ENSURE_AI(boss_freya::boss_freyaAI, Freya->AI())->trioWaveCount; else waveCount = 0; @@ -1114,7 +1113,7 @@ class npc_ancient_water_spirit : public CreatureScript void JustDied(Unit* /*killer*/) override { - if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_FREYA))) + if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_FREYA))) { ENSURE_AI(boss_freya::boss_freyaAI, Freya->AI())->checkElementalAlive[waveCount] = false; ENSURE_AI(boss_freya::boss_freyaAI, Freya->AI())->LasherDead(1); @@ -1144,7 +1143,7 @@ class npc_storm_lasher : public CreatureScript { Initialize(); instance = me->GetInstanceScript(); - if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_FREYA))) + if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_FREYA))) waveCount = ENSURE_AI(boss_freya::boss_freyaAI, Freya->AI())->trioWaveCount; else waveCount = 0; @@ -1188,7 +1187,7 @@ class npc_storm_lasher : public CreatureScript void JustDied(Unit* /*killer*/) override { - if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_FREYA))) + if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_FREYA))) { ENSURE_AI(boss_freya::boss_freyaAI, Freya->AI())->checkElementalAlive[waveCount] = false; ENSURE_AI(boss_freya::boss_freyaAI, Freya->AI())->LasherDead(2); @@ -1218,7 +1217,7 @@ class npc_snaplasher : public CreatureScript npc_snaplasherAI(Creature* creature) : ScriptedAI(creature) { instance = me->GetInstanceScript(); - if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_FREYA))) + if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_FREYA))) waveCount = ENSURE_AI(boss_freya::boss_freyaAI, Freya->AI())->trioWaveCount; else waveCount = 0; @@ -1237,7 +1236,7 @@ class npc_snaplasher : public CreatureScript void JustDied(Unit* /*killer*/) override { - if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_FREYA))) + if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_FREYA))) { ENSURE_AI(boss_freya::boss_freyaAI, Freya->AI())->checkElementalAlive[waveCount] = false; ENSURE_AI(boss_freya::boss_freyaAI, Freya->AI())->LasherDead(4); @@ -1543,17 +1542,17 @@ class spell_freya_attuned_to_nature_dose_reduction : public SpellScriptLoader case SPELL_ATTUNED_TO_NATURE_2_DOSE_REDUCTION: if (target->HasAura(GetEffectValue())) for (uint8 n = 0; n < 2; ++n) - target->RemoveAuraFromStack(GetEffectValue(), 0, AURA_REMOVE_BY_DEFAULT); + target->RemoveAuraFromStack(GetEffectValue()); break; case SPELL_ATTUNED_TO_NATURE_10_DOSE_REDUCTION: if (target->HasAura(GetEffectValue())) for (uint8 n = 0; n < 10; ++n) - target->RemoveAuraFromStack(GetEffectValue(), 0, AURA_REMOVE_BY_DEFAULT); + target->RemoveAuraFromStack(GetEffectValue()); break; case SPELL_ATTUNED_TO_NATURE_25_DOSE_REDUCTION: if (target->HasAura(GetEffectValue())) for (uint8 n = 0; n < 25; ++n) - target->RemoveAuraFromStack(GetEffectValue(), 0, AURA_REMOVE_BY_DEFAULT); + target->RemoveAuraFromStack(GetEffectValue()); break; default: break; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp index 5d4ddf1865c..9cb5e71b471 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp @@ -338,7 +338,7 @@ class boss_saronite_animus : public CreatureScript void JustDied(Unit* /*killer*/) override { - if (Creature* Vezax = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_VEZAX))) + if (Creature* Vezax = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_VEZAX))) Vezax->AI()->DoAction(ACTION_ANIMUS_DIE); } @@ -433,7 +433,7 @@ class npc_saronite_vapors : public CreatureScript DoCast(me, SPELL_SARONITE_VAPORS); me->DespawnOrUnsummon(30000); - if (Creature* Vezax = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_VEZAX))) + if (Creature* Vezax = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_VEZAX))) Vezax->AI()->DoAction(ACTION_VAPORS_DIE); } } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp index 42c0323a714..f1cfea0e58f 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp @@ -189,13 +189,13 @@ class npc_flash_freeze : public CreatureScript void Initialize() { - targetGUID = 0; + targetGUID.Clear(); checkDespawnTimer = 1000; } InstanceScript* instance; - uint64 targetGUID; + ObjectGuid targetGUID; uint32 checkDespawnTimer; void Reset() override @@ -236,7 +236,7 @@ class npc_flash_freeze : public CreatureScript // Prevents to have Ice Block on other place than target is me->NearTeleportTo(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation()); if (target->GetTypeId() == TYPEID_PLAYER) - if (Creature* Hodir = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_HODIR))) + if (Creature* Hodir = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_HODIR))) Hodir->AI()->DoAction(ACTION_CHEESE_THE_FREEZE); } } @@ -260,12 +260,11 @@ class npc_ice_block : public CreatureScript instance = me->GetInstanceScript(); me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_STUNNED | UNIT_FLAG_PACIFIED); - targetGUID = 0; } InstanceScript* instance; - uint64 targetGUID; + ObjectGuid targetGUID; void IsSummonedBy(Unit* summoner) override { @@ -288,7 +287,7 @@ class npc_ice_block : public CreatureScript { Helper->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_STUNNED | UNIT_FLAG_PACIFIED); - if (Creature* Hodir = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_HODIR))) + if (Creature* Hodir = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_HODIR))) { if (!Hodir->IsInCombat()) { @@ -691,7 +690,7 @@ class npc_hodir_priest : public CreatureScript void JustDied(Unit* /*killer*/) override { - if (Creature* Hodir = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_HODIR))) + if (Creature* Hodir = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_HODIR))) Hodir->AI()->DoAction(ACTION_I_HAVE_THE_COOLEST_FRIENDS); } @@ -753,7 +752,7 @@ class npc_hodir_shaman : public CreatureScript void JustDied(Unit* /*killer*/) override { - if (Creature* Hodir = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_HODIR))) + if (Creature* Hodir = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_HODIR))) Hodir->AI()->DoAction(ACTION_I_HAVE_THE_COOLEST_FRIENDS); } @@ -814,7 +813,7 @@ class npc_hodir_druid : public CreatureScript void JustDied(Unit* /*killer*/) override { - if (Creature* Hodir = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_HODIR))) + if (Creature* Hodir = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_HODIR))) Hodir->AI()->DoAction(ACTION_I_HAVE_THE_COOLEST_FRIENDS); } @@ -894,7 +893,7 @@ class npc_hodir_mage : public CreatureScript void JustDied(Unit* /*killer*/) override { - if (Creature* Hodir = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_HODIR))) + if (Creature* Hodir = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_HODIR))) Hodir->AI()->DoAction(ACTION_I_HAVE_THE_COOLEST_FRIENDS); } @@ -990,7 +989,7 @@ class spell_biting_cold : public SpellScriptLoader } private: - typedef std::list< std::pair<uint64, uint8> > TargetList; + typedef std::list<std::pair<ObjectGuid, uint8>> TargetList; TargetList listOfTargets; }; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp index f0f918f7e39..d4fbf959c53 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp @@ -124,7 +124,7 @@ class boss_ignis : public CreatureScript void Initialize() { - _slagPotGUID = 0; + _slagPotGUID.Clear(); _shattered = false; _firstConstructKill = 0; } @@ -251,7 +251,7 @@ class boss_ignis : public CreatureScript { slagPotTarget->ExitVehicle(); slagPotTarget = NULL; - _slagPotGUID = 0; + _slagPotGUID.Clear(); events.CancelEvent(EVENT_END_POT); } break; @@ -282,7 +282,7 @@ class boss_ignis : public CreatureScript } private: - uint64 _slagPotGUID; + ObjectGuid _slagPotGUID; Vehicle* _vehicle; time_t _firstConstructKill; bool _shattered; @@ -323,7 +323,7 @@ class npc_iron_construct : public CreatureScript if (me->HasAura(SPELL_BRITTLE) && damage >= 5000) { DoCast(SPELL_SHATTER); - if (Creature* ignis = ObjectAccessor::GetCreature(*me, _instance->GetData64(BOSS_IGNIS))) + if (Creature* ignis = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(BOSS_IGNIS))) if (ignis->AI()) ignis->AI()->DoAction(ACTION_REMOVE_BUFF); @@ -385,7 +385,7 @@ class npc_scorch_ground : public CreatureScript void Initialize() { _heat = false; - _constructGUID = 0; + _constructGUID.Clear(); _heatTimer = 0; } @@ -429,7 +429,7 @@ class npc_scorch_ground : public CreatureScript } private: - uint64 _constructGUID; + ObjectGuid _constructGUID; uint32 _heatTimer; bool _heat; }; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp index 71a89c0e508..9486d95639f 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp @@ -115,7 +115,7 @@ class boss_kologarn : public CreatureScript Vehicle* vehicle; bool left, right; - uint64 eyebeamTarget; + ObjectGuid eyebeamTarget; void EnterCombat(Unit* /*who*/) override { @@ -139,7 +139,7 @@ class boss_kologarn : public CreatureScript { _Reset(); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - eyebeamTarget = 0; + eyebeamTarget.Clear(); } void JustDied(Unit* /*killer*/) override @@ -339,7 +339,7 @@ class spell_ulduar_rubble_summon : public SpellScriptLoader if (!caster) return; - uint64 originalCaster = caster->GetInstanceScript() ? caster->GetInstanceScript()->GetData64(BOSS_KOLOGARN) : 0; + ObjectGuid originalCaster = caster->GetInstanceScript() ? caster->GetInstanceScript()->GetGuidData(BOSS_KOLOGARN) : ObjectGuid::Empty; uint32 spellId = GetEffectValue(); for (uint8 i = 0; i < 5; ++i) caster->CastSpell(caster, spellId, true, NULL, NULL, originalCaster); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp index 3a137a8658e..880eeba206b 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp @@ -347,9 +347,9 @@ static bool IsEncounterFinished(Unit* who) { InstanceScript* instance = who->GetInstanceScript(); - Creature* mkii = ObjectAccessor::GetCreature(*who, instance->GetData64(DATA_LEVIATHAN_MK_II)); - Creature* vx001 = ObjectAccessor::GetCreature(*who, instance->GetData64(DATA_VX_001)); - Creature* aerial = ObjectAccessor::GetCreature(*who, instance->GetData64(DATA_AERIAL_COMMAND_UNIT)); + Creature* mkii = ObjectAccessor::GetCreature(*who, instance->GetGuidData(DATA_LEVIATHAN_MK_II)); + Creature* vx001 = ObjectAccessor::GetCreature(*who, instance->GetGuidData(DATA_VX_001)); + Creature* aerial = ObjectAccessor::GetCreature(*who, instance->GetGuidData(DATA_AERIAL_COMMAND_UNIT)); if (!mkii || !vx001 || !aerial) return false; @@ -363,7 +363,7 @@ static bool IsEncounterFinished(Unit* who) mkii->DespawnOrUnsummon(120000); vx001->DespawnOrUnsummon(120000); aerial->DespawnOrUnsummon(120000); - if (Creature* mimiron = ObjectAccessor::GetCreature(*who, instance->GetData64(BOSS_MIMIRON))) + if (Creature* mimiron = ObjectAccessor::GetCreature(*who, instance->GetGuidData(BOSS_MIMIRON))) mimiron->AI()->JustDied(who); return true; } @@ -395,7 +395,7 @@ class boss_mimiron : public CreatureScript break; case DO_ACTIVATE_V0L7R0N_1: Talk(SAY_AERIAL_DEATH); - if (Creature* mkii = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_LEVIATHAN_MK_II))) + if (Creature* mkii = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_LEVIATHAN_MK_II))) mkii->GetMotionMaster()->MovePoint(WP_MKII_P4_POS_1, VehicleRelocation[WP_MKII_P4_POS_1]); break; case DO_ACTIVATE_V0L7R0N_2: @@ -420,7 +420,7 @@ class boss_mimiron : public CreatureScript me->RemoveAurasDueToSpell(SPELL_WELD); DoCast(me->GetVehicleBase(), SPELL_SEAT_6); - if (GameObject* button = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_MIMIRON_BUTTON))) + if (GameObject* button = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_MIMIRON_BUTTON))) button->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); if (_fireFighter) @@ -450,14 +450,14 @@ class boss_mimiron : public CreatureScript _Reset(); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (GameObject* elevator = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_MIMIRON_ELEVATOR))) + if (GameObject* elevator = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_MIMIRON_ELEVATOR))) elevator->SetGoState(GO_STATE_ACTIVE); if (_fireFighter) - if (Creature* computer = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_COMPUTER))) + if (Creature* computer = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_COMPUTER))) computer->AI()->DoAction(DO_DEACTIVATE_COMPUTER); - if (GameObject* button = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_MIMIRON_BUTTON))) + if (GameObject* button = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_MIMIRON_BUTTON))) { button->SetGoState(GO_STATE_READY); button->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); @@ -466,7 +466,7 @@ class boss_mimiron : public CreatureScript _fireFighter = false; DoCast(me, SPELL_WELD); - if (Unit* mkii = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_LEVIATHAN_MK_II))) + if (Unit* mkii = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_LEVIATHAN_MK_II))) DoCast(mkii, SPELL_SEAT_3); } @@ -485,7 +485,7 @@ class boss_mimiron : public CreatureScript switch (eventId) { case EVENT_SUMMON_FLAMES: - if (Unit* worldtrigger = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_MIMIRON_WORLD_TRIGGER))) + if (Unit* worldtrigger = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_MIMIRON_WORLD_TRIGGER))) worldtrigger->CastCustomSpell(SPELL_SCRIPT_EFFECT_SUMMON_FLAMES_INITIAL, SPELLVALUE_MAX_TARGETS, 3, NULL, true, NULL, NULL, me->GetGUID()); events.RescheduleEvent(EVENT_SUMMON_FLAMES, 28000); break; @@ -521,21 +521,21 @@ class boss_mimiron : public CreatureScript events.ScheduleEvent(EVENT_VX001_ACTIVATION_4, 5000); break; case EVENT_VX001_ACTIVATION_4: - if (GameObject* elevator = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_MIMIRON_ELEVATOR))) + if (GameObject* elevator = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_MIMIRON_ELEVATOR))) elevator->SetGoState(GO_STATE_READY); - if (Unit* worldtrigger = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_MIMIRON_WORLD_TRIGGER))) + if (Unit* worldtrigger = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_MIMIRON_WORLD_TRIGGER))) worldtrigger->CastSpell(worldtrigger, SPELL_ELEVATOR_KNOCKBACK); events.ScheduleEvent(EVENT_VX001_ACTIVATION_5, 6000); break; case EVENT_VX001_ACTIVATION_5: - if (GameObject* elevator = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_MIMIRON_ELEVATOR))) + if (GameObject* elevator = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_MIMIRON_ELEVATOR))) elevator->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); if (Creature* vx001 = me->SummonCreature(NPC_VX_001, VX001SummonPos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 120000)) vx001->CastSpell(vx001, SPELL_FREEZE_ANIM); events.ScheduleEvent(EVENT_VX001_ACTIVATION_6, 19000); break; case EVENT_VX001_ACTIVATION_6: - if (Unit* vx001 = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_VX_001))) + if (Unit* vx001 = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_VX_001))) DoCast(vx001, SPELL_SEAT_1); events.ScheduleEvent(EVENT_VX001_ACTIVATION_7, 3500); break; @@ -566,7 +566,7 @@ class boss_mimiron : public CreatureScript events.ScheduleEvent(EVENT_AERIAL_ACTIVATION_4, 5000); break; case EVENT_AERIAL_ACTIVATION_4: - if (Unit* aerial = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_AERIAL_COMMAND_UNIT))) + if (Unit* aerial = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_AERIAL_COMMAND_UNIT))) me->CastSpell(aerial, SPELL_SEAT_1); events.ScheduleEvent(EVENT_AERIAL_ACTIVATION_5, 2000); break; @@ -579,14 +579,14 @@ class boss_mimiron : public CreatureScript acu->AI()->DoAction(_fireFighter? DO_HARDMODE_AERIAL : DO_START_AERIAL); break; case EVENT_VOL7RON_ACTIVATION_1: - if (Creature* mkii = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_LEVIATHAN_MK_II))) + if (Creature* mkii = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_LEVIATHAN_MK_II))) mkii->SetFacingTo(float(M_PI)); events.ScheduleEvent(EVENT_VOL7RON_ACTIVATION_2, 1000); break; case EVENT_VOL7RON_ACTIVATION_2: - if (Creature* mkii = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_LEVIATHAN_MK_II))) + if (Creature* mkii = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_LEVIATHAN_MK_II))) { - if (Creature* vx001 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VX_001))) + if (Creature* vx001 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VX_001))) { vx001->RemoveAurasDueToSpell(SPELL_TORSO_DISABLED); vx001->CastSpell(mkii, SPELL_MOUNT_MKII); @@ -595,14 +595,14 @@ class boss_mimiron : public CreatureScript events.ScheduleEvent(EVENT_VOL7RON_ACTIVATION_3, 4500); break; case EVENT_VOL7RON_ACTIVATION_3: - if (Creature* mkii = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_LEVIATHAN_MK_II))) + if (Creature* mkii = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_LEVIATHAN_MK_II))) mkii->GetMotionMaster()->MovePoint(WP_MKII_P4_POS_4, VehicleRelocation[WP_MKII_P4_POS_4]); events.ScheduleEvent(EVENT_VOL7RON_ACTIVATION_4, 5000); break; case EVENT_VOL7RON_ACTIVATION_4: - if (Creature* vx001 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VX_001))) + if (Creature* vx001 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VX_001))) { - if (Creature* aerial = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_AERIAL_COMMAND_UNIT))) + if (Creature* aerial = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_AERIAL_COMMAND_UNIT))) { aerial->GetMotionMaster()->MoveLand(0, (aerial->GetPositionX(), aerial->GetPositionY(), aerial->GetPositionZMinusOffset())); aerial->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); @@ -617,13 +617,13 @@ class boss_mimiron : public CreatureScript events.ScheduleEvent(EVENT_VOL7RON_ACTIVATION_6, 3000); break; case EVENT_VOL7RON_ACTIVATION_6: - if (Creature* vx001 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VX_001))) + if (Creature* vx001 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VX_001))) DoCast(vx001, SPELL_SEAT_2); events.ScheduleEvent(EVENT_VOL7RON_ACTIVATION_7, 5000); break; case EVENT_VOL7RON_ACTIVATION_7: for (uint8 data = DATA_LEVIATHAN_MK_II; data <= DATA_AERIAL_COMMAND_UNIT; ++data) - if (Creature* mimironVehicle = ObjectAccessor::GetCreature(*me, instance->GetData64(data))) + if (Creature* mimironVehicle = ObjectAccessor::GetCreature(*me, instance->GetGuidData(data))) mimironVehicle->AI()->DoAction(DO_ASSEMBLED_COMBAT); break; case EVENT_OUTTRO_1: @@ -636,7 +636,7 @@ class boss_mimiron : public CreatureScript Talk(SAY_V07TRON_DEATH); if (_fireFighter) { - if (Creature* computer = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_COMPUTER))) + if (Creature* computer = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_COMPUTER))) computer->AI()->DoAction(DO_DEACTIVATE_COMPUTER); me->SummonGameObject(RAID_MODE(GO_CACHE_OF_INNOVATION_FIREFIGHTER, GO_CACHE_OF_INNOVATION_FIREFIGHTER_HERO), 2744.040f, 2569.352f, 364.3135f, 3.124123f, 0.f, 0.f, 0.9999619f, 0.008734641f, 604800); } @@ -772,7 +772,7 @@ class boss_leviathan_mk_ii : public CreatureScript void KilledUnit(Unit* victim) override { if (victim->GetTypeId() == TYPEID_PLAYER) - if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_MIMIRON))) + if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_MIMIRON))) mimiron->AI()->Talk(events.IsInPhase(PHASE_LEVIATHAN_MK_II) ? SAY_MKII_SLAY : SAY_V07TRON_SLAY); } @@ -787,7 +787,7 @@ class boss_leviathan_mk_ii : public CreatureScript me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); DoCast(me, SPELL_HALF_HEAL); - if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_MIMIRON))) + if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_MIMIRON))) mimiron->AI()->DoAction(DO_ACTIVATE_VX001); break; case WP_MKII_P4_POS_1: @@ -797,7 +797,7 @@ class boss_leviathan_mk_ii : public CreatureScript events.ScheduleEvent(EVENT_MOVE_POINT_3, 1); break; case WP_MKII_P4_POS_3: - if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_MIMIRON))) + if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_MIMIRON))) mimiron->AI()->DoAction(DO_ACTIVATE_V0L7R0N_2); break; case WP_MKII_P4_POS_4: @@ -937,7 +937,7 @@ class boss_vx_001 : public CreatureScript me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); // | UNIT_FLAG_NOT_SELECTABLE); DoCast(me, SPELL_HALF_HEAL); // has no effect, wat DoCast(me, SPELL_TORSO_DISABLED); - if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_MIMIRON))) + if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_MIMIRON))) mimiron->AI()->DoAction(DO_ACTIVATE_AERIAL); } else if (events.IsInPhase(PHASE_VOL7RON)) @@ -1008,7 +1008,7 @@ class boss_vx_001 : public CreatureScript void KilledUnit(Unit* victim) override { if (victim->GetTypeId() == TYPEID_PLAYER) - if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_MIMIRON))) + if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_MIMIRON))) mimiron->AI()->Talk(events.IsInPhase(PHASE_VX_001) ? SAY_VX001_SLAY : SAY_V07TRON_SLAY); } @@ -1028,7 +1028,7 @@ class boss_vx_001 : public CreatureScript // Handle rotation during SPELL_SPINNING_UP, SPELL_P3WX2_LASER_BARRAGE, SPELL_RAPID_BURST, and SPELL_HAND_PULSE_LEFT/RIGHT if (me->HasUnitState(UNIT_STATE_CASTING)) { - if (Creature* channelTarget = ObjectAccessor::GetCreature(*me, me->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT))) + if (Creature* channelTarget = ObjectAccessor::GetCreature(*me, me->GetChannelObjectGuid())) me->SetFacingToObject(channelTarget); return; } @@ -1183,7 +1183,7 @@ class boss_aerial_command_unit : public CreatureScript void KilledUnit(Unit* victim) override { if (victim->GetTypeId() == TYPEID_PLAYER) - if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_MIMIRON))) + if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_MIMIRON))) mimiron->AI()->Talk(events.IsInPhase(PHASE_AERIAL_COMMAND_UNIT) ? SAY_AERIAL_SLAY : SAY_V07TRON_SLAY); } @@ -1193,7 +1193,7 @@ class boss_aerial_command_unit : public CreatureScript { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_MIMIRON))) + if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_MIMIRON))) mimiron->AI()->DoAction(DO_ACTIVATE_V0L7R0N_1); } } @@ -1414,7 +1414,7 @@ class npc_mimiron_computer : public CreatureScript { case EVENT_SELF_DESTRUCT_10: Talk(SAY_SELF_DESTRUCT_10); - if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_MIMIRON))) + if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_MIMIRON))) mimiron->AI()->DoAction(DO_ACTIVATE_HARD_MODE); events.ScheduleEvent(EVENT_SELF_DESTRUCT_9, 60000); break; @@ -1456,7 +1456,7 @@ class npc_mimiron_computer : public CreatureScript break; case EVENT_SELF_DESTRUCT_FINALIZED: Talk(SAY_SELF_DESTRUCT_FINALIZED); - if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_MIMIRON))) + if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_MIMIRON))) mimiron->AI()->DoAction(DO_ACTIVATE_SELF_DESTRUCT); DoCast(me, SPELL_SELF_DESTRUCTION_AURA); DoCast(me, SPELL_SELF_DESTRUCTION_VISUAL); @@ -1634,7 +1634,7 @@ class go_mimiron_hardmode_button : public GameObjectScript if (!instance) return false; - if (Creature* computer = ObjectAccessor::GetCreature(*go, instance->GetData64(DATA_COMPUTER))) + if (Creature* computer = ObjectAccessor::GetCreature(*go, instance->GetGuidData(DATA_COMPUTER))) computer->AI()->DoAction(DO_ACTIVATE_COMPUTER); go->SetGoState(GO_STATE_ACTIVE); go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); @@ -1656,7 +1656,7 @@ class spell_mimiron_bomb_bot : public SpellScriptLoader { if (GetHitPlayer()) if (InstanceScript* instance = GetCaster()->GetInstanceScript()) - if (Creature* mkii = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_LEVIATHAN_MK_II))) + if (Creature* mkii = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(DATA_LEVIATHAN_MK_II))) mkii->AI()->SetData(DATA_SETUP_BOMB, 0); } @@ -1953,7 +1953,7 @@ class spell_mimiron_p3wx2_laser_barrage : public SpellScriptLoader void OnHit(SpellEffIndex /*effIndex*/) { - GetCaster()->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, GetHitUnit()->GetGUID()); + GetCaster()->SetChannelObjectGuid(GetHitUnit()->GetGUID()); } void Register() override @@ -2022,7 +2022,7 @@ class spell_mimiron_proximity_explosion : public SpellScriptLoader { if (GetHitPlayer()) if (InstanceScript* instance = GetCaster()->GetInstanceScript()) - if (Creature* mkII = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_LEVIATHAN_MK_II))) + if (Creature* mkII = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(DATA_LEVIATHAN_MK_II))) mkII->AI()->SetData(DATA_SETUP_MINE, 0); } @@ -2239,7 +2239,7 @@ class spell_mimiron_rocket_strike_damage : public SpellScriptLoader { if (GetHitPlayer()) if (InstanceScript* instance = GetCaster()->GetInstanceScript()) - if (Creature* mkii = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_LEVIATHAN_MK_II))) + if (Creature* mkii = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(DATA_LEVIATHAN_MK_II))) mkii->AI()->SetData(DATA_SETUP_ROCKET, 0); } @@ -2298,7 +2298,7 @@ class spell_mimiron_rocket_strike_target_select : public SpellScriptLoader void HandleScript(SpellEffIndex /*effIndex*/) { if (InstanceScript* instance = GetCaster()->GetInstanceScript()) - GetCaster()->CastSpell(GetHitUnit(), SPELL_SUMMON_ROCKET_STRIKE, true, NULL, NULL, instance->GetData64(DATA_VX_001)); + GetCaster()->CastSpell(GetHitUnit(), SPELL_SUMMON_ROCKET_STRIKE, true, NULL, NULL, instance->GetGuidData(DATA_VX_001)); GetCaster()->SetDisplayId(11686); } @@ -2357,7 +2357,7 @@ class spell_mimiron_spinning_up : public SpellScriptLoader void OnHit(SpellEffIndex /*effIndex*/) { if (GetHitUnit() != GetCaster()) - GetCaster()->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, GetHitUnit()->GetGUID()); + GetCaster()->SetChannelObjectGuid(GetHitUnit()->GetGUID()); } void Register() override @@ -2394,7 +2394,7 @@ class spell_mimiron_summon_assault_bot : public SpellScriptLoader if (Unit* caster = GetCaster()) if (InstanceScript* instance = caster->GetInstanceScript()) if (instance->GetBossState(BOSS_MIMIRON) == IN_PROGRESS) - caster->CastSpell(caster, SPELL_SUMMON_ASSAULT_BOT, false, NULL, aurEff, instance->GetData64(DATA_AERIAL_COMMAND_UNIT)); + caster->CastSpell(caster, SPELL_SUMMON_ASSAULT_BOT, false, NULL, aurEff, instance->GetGuidData(DATA_AERIAL_COMMAND_UNIT)); } void Register() override @@ -2466,7 +2466,7 @@ class spell_mimiron_summon_fire_bot : public SpellScriptLoader if (Unit* caster = GetCaster()) if (InstanceScript* instance = caster->GetInstanceScript()) if (instance->GetBossState(BOSS_MIMIRON) == IN_PROGRESS) - caster->CastSpell(caster, SPELL_SUMMON_FIRE_BOT, false, NULL, aurEff, instance->GetData64(DATA_AERIAL_COMMAND_UNIT)); + caster->CastSpell(caster, SPELL_SUMMON_FIRE_BOT, false, NULL, aurEff, instance->GetGuidData(DATA_AERIAL_COMMAND_UNIT)); } void Register() override @@ -2662,7 +2662,7 @@ class spell_mimiron_summon_junk_bot : public SpellScriptLoader if (Unit* caster = GetCaster()) if (InstanceScript* instance = caster->GetInstanceScript()) if (instance->GetBossState(BOSS_MIMIRON) == IN_PROGRESS) - caster->CastSpell(caster, SPELL_SUMMON_JUNK_BOT, false, NULL, aurEff, instance->GetData64(DATA_AERIAL_COMMAND_UNIT)); + caster->CastSpell(caster, SPELL_SUMMON_JUNK_BOT, false, NULL, aurEff, instance->GetGuidData(DATA_AERIAL_COMMAND_UNIT)); } void Register() override diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp index d53ac6d91d6..cad6b045120 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp @@ -203,13 +203,13 @@ class boss_razorscale_controller : public CreatureScript switch (spell->Id) { case SPELL_FLAMED: - if (GameObject* Harpoon1 = ObjectAccessor::GetGameObject(*me, instance->GetData64(GO_RAZOR_HARPOON_1))) + if (GameObject* Harpoon1 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_RAZOR_HARPOON_1))) Harpoon1->RemoveFromWorld(); - if (GameObject* Harpoon2 = ObjectAccessor::GetGameObject(*me, instance->GetData64(GO_RAZOR_HARPOON_2))) + if (GameObject* Harpoon2 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_RAZOR_HARPOON_2))) Harpoon2->RemoveFromWorld(); - if (GameObject* Harpoon3 = ObjectAccessor::GetGameObject(*me, instance->GetData64(GO_RAZOR_HARPOON_3))) + if (GameObject* Harpoon3 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_RAZOR_HARPOON_3))) Harpoon3->RemoveFromWorld(); - if (GameObject* Harpoon4 = ObjectAccessor::GetGameObject(*me, instance->GetData64(GO_RAZOR_HARPOON_4))) + if (GameObject* Harpoon4 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_RAZOR_HARPOON_4))) Harpoon4->RemoveFromWorld(); DoAction(ACTION_HARPOON_BUILD); DoAction(ACTION_PLACE_BROKEN_HARPOON); @@ -312,7 +312,7 @@ class go_razorscale_harpoon : public GameObjectScript bool OnGossipHello(Player* /*player*/, GameObject* go) override { InstanceScript* instance = go->GetInstanceScript(); - if (ObjectAccessor::GetCreature(*go, instance->GetData64(BOSS_RAZORSCALE))) + if (ObjectAccessor::GetCreature(*go, instance->GetGuidData(BOSS_RAZORSCALE))) go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); return false; } @@ -357,14 +357,14 @@ class boss_razorscale : public CreatureScript me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_PASSIVE); Initialize(); - if (Creature* commander = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EXPEDITION_COMMANDER))) + if (Creature* commander = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_EXPEDITION_COMMANDER))) commander->AI()->DoAction(ACTION_COMMANDER_RESET); } void EnterCombat(Unit* /*who*/) override { _EnterCombat(); - if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_RAZORSCALE_CONTROL))) + if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_RAZORSCALE_CONTROL))) controller->AI()->DoAction(ACTION_HARPOON_BUILD); me->SetSpeed(MOVE_FLIGHT, 3.0f, true); me->SetReactState(REACT_PASSIVE); @@ -379,7 +379,7 @@ class boss_razorscale : public CreatureScript void JustDied(Unit* /*killer*/) override { _JustDied(); - if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_RAZORSCALE_CONTROL))) + if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_RAZORSCALE_CONTROL))) controller->AI()->Reset(); } @@ -455,7 +455,7 @@ class boss_razorscale : public CreatureScript me->SetCanFly(false); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED | UNIT_FLAG_PACIFIED); - if (Creature* commander = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EXPEDITION_COMMANDER))) + if (Creature* commander = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_EXPEDITION_COMMANDER))) commander->AI()->DoAction(ACTION_GROUND_PHASE); events.ScheduleEvent(EVENT_BREATH, 30000, 0, PHASE_GROUND); events.ScheduleEvent(EVENT_BUFFET, 33000, 0, PHASE_GROUND); @@ -471,7 +471,7 @@ class boss_razorscale : public CreatureScript return; case EVENT_BUFFET: DoCastAOE(SPELL_WINGBUFFET); - if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_RAZORSCALE_CONTROL))) + if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_RAZORSCALE_CONTROL))) controller->CastSpell(controller, SPELL_FLAMED, true); events.CancelEvent(EVENT_BUFFET); return; @@ -602,12 +602,10 @@ class npc_expedition_commander : public CreatureScript struct npc_expedition_commanderAI : public ScriptedAI { - npc_expedition_commanderAI(Creature* creature) : ScriptedAI(creature) + npc_expedition_commanderAI(Creature* creature) : ScriptedAI(creature), summons(creature) { Initialize(); instance = me->GetInstanceScript(); - memset(Engineer, 0, sizeof(Engineer)); - memset(Defender, 0, sizeof(Defender)); } void Initialize() @@ -618,18 +616,18 @@ class npc_expedition_commander : public CreatureScript } InstanceScript* instance; - std::list<uint64> summons; + SummonList summons; bool Greet; uint32 AttackStartTimer; uint8 Phase; - uint64 Engineer[4]; - uint64 Defender[4]; + ObjectGuid Engineer[4]; + ObjectGuid Defender[4]; void Reset() override { Initialize(); - summons.clear(); + summons.DespawnAll(); } void MoveInLineOfSight(Unit* who) override @@ -644,7 +642,7 @@ class npc_expedition_commander : public CreatureScript void JustSummoned(Creature* summoned) override { - summons.push_back(summoned->GetGUID()); + summons.Summon(summoned); } void DoAction(int32 action) override @@ -655,7 +653,7 @@ class npc_expedition_commander : public CreatureScript Talk(SAY_GROUND_PHASE); break; case ACTION_COMMANDER_RESET: - summons.clear(); + summons.DespawnAll(); me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); break; } @@ -669,7 +667,7 @@ class npc_expedition_commander : public CreatureScript { case 1: instance->SetBossState(BOSS_RAZORSCALE, IN_PROGRESS); - summons.clear(); + summons.DespawnAll(); AttackStartTimer = 1000; Phase = 2; break; @@ -715,7 +713,7 @@ class npc_expedition_commander : public CreatureScript Phase = 5; break; case 5: - if (Creature* Razorscale = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_RAZORSCALE))) + if (Creature* Razorscale = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_RAZORSCALE))) { Razorscale->AI()->DoAction(ACTION_EVENT_START); me->SetInCombatWith(Razorscale); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp index 18b9a3040fe..2032c7b861d 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp @@ -460,7 +460,7 @@ class npc_xt002_heart : public CreatureScript void JustDied(Unit* /*killer*/) override { - Creature* xt002 = _instance ? ObjectAccessor::GetCreature(*me, _instance->GetData64(BOSS_XT002)) : NULL; + Creature* xt002 = _instance ? ObjectAccessor::GetCreature(*me, _instance->GetGuidData(BOSS_XT002)) : NULL; if (!xt002 || !xt002->AI()) return; @@ -512,7 +512,7 @@ class npc_scrapbot : public CreatureScript Initialize(); - if (Creature* pXT002 = ObjectAccessor::GetCreature(*me, _instance->GetData64(BOSS_XT002))) + if (Creature* pXT002 = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(BOSS_XT002))) me->GetMotionMaster()->MoveFollow(pXT002, 0.0f, 0.0f); } @@ -520,7 +520,7 @@ class npc_scrapbot : public CreatureScript { if (_rangeCheckTimer <= diff) { - if (Creature* xt002 = ObjectAccessor::GetCreature(*me, _instance->GetData64(BOSS_XT002))) + if (Creature* xt002 = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(BOSS_XT002))) { if (me->IsWithinMeleeRange(xt002)) { @@ -575,7 +575,7 @@ class npc_pummeller : public CreatureScript { Initialize(); - if (Creature* xt002 = ObjectAccessor::GetCreature(*me, _instance->GetData64(BOSS_XT002))) + if (Creature* xt002 = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(BOSS_XT002))) { Position pos = xt002->GetPosition(); me->GetMotionMaster()->MovePoint(0, pos); @@ -689,7 +689,7 @@ class npc_boombot : public CreatureScript me->SetFloatValue(UNIT_FIELD_MAXDAMAGE, 18000.0f); /// @todo proper waypoints? - if (Creature* pXT002 = ObjectAccessor::GetCreature(*me, _instance->GetData64(BOSS_XT002))) + if (Creature* pXT002 = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(BOSS_XT002))) me->GetMotionMaster()->MoveFollow(pXT002, 0.0f, 0.0f); } @@ -939,7 +939,7 @@ class spell_xt002_heart_overload_periodic : public SpellScriptLoader { if (InstanceScript* instance = caster->GetInstanceScript()) { - if (Unit* toyPile = ObjectAccessor::GetUnit(*caster, instance->GetData64(DATA_TOY_PILE_0 + urand(0, 3)))) + if (Unit* toyPile = ObjectAccessor::GetUnit(*caster, instance->GetGuidData(DATA_TOY_PILE_0 + urand(0, 3)))) { caster->CastSpell(toyPile, SPELL_ENERGY_ORB, true); @@ -952,7 +952,7 @@ class spell_xt002_heart_overload_periodic : public SpellScriptLoader { uint8 a = urand(0, 4); uint32 spellId = spells[a]; - toyPile->CastSpell(toyPile, spellId, true, NULL, NULL, instance->GetData64(BOSS_XT002)); + toyPile->CastSpell(toyPile, spellId, true, NULL, NULL, instance->GetGuidData(BOSS_XT002)); } } } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp index d3012dc99ba..391aebf9229 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp @@ -451,7 +451,7 @@ class boss_voice_of_yogg_saron : public CreatureScript BossAI::EnterEvadeMode(); for (uint8 i = DATA_SARA; i <= DATA_MIMIRON_YS; ++i) - if (Creature* creature = ObjectAccessor::GetCreature(*me, instance->GetData64(i))) + if (Creature* creature = ObjectAccessor::GetCreature(*me, instance->GetGuidData(i))) creature->AI()->EnterEvadeMode(); // not sure, spoken by Sara (sound), regarding to wowwiki Voice whispers it @@ -490,11 +490,11 @@ class boss_voice_of_yogg_saron : public CreatureScript void EnterCombat(Unit* /*who*/) override { - if (Creature* sara = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SARA))) + if (Creature* sara = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SARA))) sara->SetInCombatWith(me); for (uint8 i = DATA_FREYA_YS; i <= DATA_MIMIRON_YS; ++i) - if (Creature* keeper = ObjectAccessor::GetCreature(*me, instance->GetData64(i))) + if (Creature* keeper = ObjectAccessor::GetCreature(*me, instance->GetGuidData(i))) keeper->SetInCombatWith(me); instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); @@ -510,7 +510,7 @@ class boss_voice_of_yogg_saron : public CreatureScript void JustDied(Unit* killer) override { // don't despawn Yogg-Saron's corpse, remove him from SummonList! - if (Creature* yogg = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_YOGG_SARON))) + if (Creature* yogg = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_YOGG_SARON))) summons.Despawn(yogg); BossAI::JustDied(killer); @@ -535,7 +535,7 @@ class boss_voice_of_yogg_saron : public CreatureScript instance->SetBossState(BOSS_YOGG_SARON, IN_PROGRESS); break; case EVENT_EXTINGUISH_ALL_LIFE: - if (Creature* yogg = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_YOGG_SARON))) + if (Creature* yogg = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_YOGG_SARON))) { yogg->AI()->Talk(EMOTE_YOGG_SARON_EXTINGUISH_ALL_LIFE, me); yogg->CastSpell((Unit*)NULL, SPELL_EXTINGUISH_ALL_LIFE, true); @@ -563,7 +563,7 @@ class boss_voice_of_yogg_saron : public CreatureScript break; case EVENT_ILLUSION: { - if (Creature* yogg = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_YOGG_SARON))) + if (Creature* yogg = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_YOGG_SARON))) { yogg->AI()->Talk(EMOTE_YOGG_SARON_MADNESS); yogg->AI()->Talk(SAY_YOGG_SARON_MADNESS); @@ -576,7 +576,7 @@ class boss_voice_of_yogg_saron : public CreatureScript uint8 illusion = urand(CHAMBER_ILLUSION, STORMWIND_ILLUSION); instance->SetData(DATA_ILLUSION, illusion); - if (Creature* brain = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BRAIN_OF_YOGG_SARON))) + if (Creature* brain = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BRAIN_OF_YOGG_SARON))) brain->AI()->DoAction(ACTION_INDUCE_MADNESS); events.ScheduleEvent(EVENT_ILLUSION, 80000, 0, PHASE_TWO); // wowwiki says 80 secs, wowhead says something about 90 secs break; @@ -602,7 +602,7 @@ class boss_voice_of_yogg_saron : public CreatureScript case ACTION_PHASE_TWO: events.SetPhase(PHASE_TWO); me->SummonCreature(NPC_YOGG_SARON, YoggSaronSpawnPos); - if (Creature* brain = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BRAIN_OF_YOGG_SARON))) + if (Creature* brain = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BRAIN_OF_YOGG_SARON))) brain->SetInCombatWithZone(); events.ScheduleEvent(EVENT_SUMMON_CORRUPTOR_TENTACLE, 1, EVENT_GROUP_SUMMON_TENTACLES, PHASE_TWO); events.ScheduleEvent(EVENT_SUMMON_CONSTRICTOR_TENTACLE, 1, EVENT_GROUP_SUMMON_TENTACLES, PHASE_TWO); @@ -672,23 +672,23 @@ class boss_sara : public CreatureScript { boss_saraAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { } - uint64 GetLinkedPlayerGUID(uint64 guid) const + ObjectGuid GetLinkedPlayerGUID(ObjectGuid guid) const { - std::map<uint64, uint64>::const_iterator itr = _linkData.find(guid); + std::map<ObjectGuid, ObjectGuid>::const_iterator itr = _linkData.find(guid); if (itr != _linkData.end()) return itr->second; - return 0; + return ObjectGuid::Empty; } - void SetLinkBetween(uint64 player1, uint64 player2) + void SetLinkBetween(ObjectGuid player1, ObjectGuid player2) { _linkData[player1] = player2; _linkData[player2] = player1; } // called once for each target on aura remove - void RemoveLinkFrom(uint64 player1) + void RemoveLinkFrom(ObjectGuid player1) { _linkData.erase(player1); } @@ -699,7 +699,7 @@ class boss_sara : public CreatureScript { damage = 0; - if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VOICE_OF_YOGG_SARON))) + if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VOICE_OF_YOGG_SARON))) voice->AI()->DoAction(ACTION_PHASE_TRANSFORM); Talk(SAY_SARA_TRANSFORM_1); @@ -794,14 +794,14 @@ class boss_sara : public CreatureScript Talk(SAY_SARA_TRANSFORM_4); DoCast(me, SPELL_FULL_HEAL); me->setFaction(16); - if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VOICE_OF_YOGG_SARON))) + if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VOICE_OF_YOGG_SARON))) voice->AI()->DoAction(ACTION_PHASE_TWO); - if (Creature* mimiron = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_MIMIRON_YS))) + if (Creature* mimiron = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_MIMIRON_YS))) mimiron->AI()->DoAction(ACTION_PHASE_TWO); break; case EVENT_TRANSFORM_4: DoCast(me, SPELL_PHASE_2_TRANSFORM); - if (Creature* yogg = ObjectAccessor::GetCreature(*me, _instance->GetData64(BOSS_YOGG_SARON))) + if (Creature* yogg = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(BOSS_YOGG_SARON))) DoCast(yogg, SPELL_RIDE_YOGG_SARON_VEHICLE); DoCast(me, SPELL_SHADOWY_BARRIER_SARA); _events.SetPhase(PHASE_TWO); @@ -857,7 +857,7 @@ class boss_sara : public CreatureScript break; } - if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VOICE_OF_YOGG_SARON))) + if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VOICE_OF_YOGG_SARON))) voice->AI()->JustSummoned(summon); } @@ -876,7 +876,7 @@ class boss_sara : public CreatureScript private: EventMap _events; InstanceScript* _instance; - std::map<uint64, uint64> _linkData; + std::map<ObjectGuid, ObjectGuid> _linkData; }; CreatureAI* GetAI(Creature* creature) const override @@ -926,15 +926,15 @@ class boss_yogg_saron : public CreatureScript { Talk(SAY_YOGG_SARON_DEATH); - if (Creature* creature = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VOICE_OF_YOGG_SARON))) + if (Creature* creature = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VOICE_OF_YOGG_SARON))) me->Kill(creature); for (uint8 i = DATA_SARA; i <= DATA_BRAIN_OF_YOGG_SARON; ++i) - if (Creature* creature = ObjectAccessor::GetCreature(*me, _instance->GetData64(i))) + if (Creature* creature = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(i))) creature->DisappearAndDie(); for (uint8 i = DATA_FREYA_YS; i <= DATA_MIMIRON_YS; ++i) - if (Creature* creature = ObjectAccessor::GetCreature(*me, _instance->GetData64(i))) + if (Creature* creature = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(i))) creature->AI()->EnterEvadeMode(); Map::PlayerList const& players = me->GetMap()->GetPlayers(); @@ -1043,15 +1043,15 @@ class boss_brain_of_yogg_saron : public CreatureScript DoCast(me, SPELL_BRAIN_HURT_VISUAL, true); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); - if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VOICE_OF_YOGG_SARON))) + if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VOICE_OF_YOGG_SARON))) voice->AI()->DoAction(ACTION_PHASE_THREE); - if (Creature* sara = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_SARA))) + if (Creature* sara = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_SARA))) sara->AI()->DoAction(ACTION_PHASE_THREE); - if (Creature* yogg = ObjectAccessor::GetCreature(*me, _instance->GetData64(BOSS_YOGG_SARON))) + if (Creature* yogg = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(BOSS_YOGG_SARON))) yogg->AI()->DoAction(ACTION_PHASE_THREE); for (uint8 i = DATA_THORIM_YS; i <= DATA_MIMIRON_YS; ++i) - if (Creature* keeper = ObjectAccessor::GetCreature(*me, _instance->GetData64(i))) + if (Creature* keeper = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(i))) keeper->AI()->DoAction(ACTION_PHASE_THREE); } } @@ -1070,7 +1070,7 @@ class boss_brain_of_yogg_saron : public CreatureScript // make sure doors won't be opened for (uint32 i = GO_BRAIN_ROOM_DOOR_1; i <= GO_BRAIN_ROOM_DOOR_3; ++i) - _instance->HandleGameObject(_instance->GetData64(i), false); + _instance->HandleGameObject(_instance->GetGuidData(i), false); DoCastAOE(SPELL_INDUCE_MADNESS); break; @@ -1083,9 +1083,9 @@ class boss_brain_of_yogg_saron : public CreatureScript sCreatureTextMgr->SendChat(me, EMOTE_BRAIN_ILLUSION_SHATTERED, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_AREA); _summons.DespawnAll(); DoCastAOE(SPELL_SHATTERED_ILLUSION, true); - _instance->HandleGameObject(_instance->GetData64(GO_BRAIN_ROOM_DOOR_1 + illusion), true); + _instance->HandleGameObject(_instance->GetGuidData(GO_BRAIN_ROOM_DOOR_1 + illusion), true); - if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VOICE_OF_YOGG_SARON))) + if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VOICE_OF_YOGG_SARON))) voice->AI()->DoAction(ACTION_TOGGLE_SHATTERED_ILLUSION); } break; @@ -1211,7 +1211,7 @@ class npc_guardian_of_yogg_saron : public CreatureScript return; // Guardian can be summoned both by Voice of Yogg-Saron and by Ominous Cloud - if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VOICE_OF_YOGG_SARON))) + if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VOICE_OF_YOGG_SARON))) voice->AI()->JustSummoned(me); } @@ -1314,7 +1314,7 @@ class npc_constrictor_tentacle : public CreatureScript void IsSummonedBy(Unit* /*summoner*/) override { - if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VOICE_OF_YOGG_SARON))) + if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VOICE_OF_YOGG_SARON))) voice->AI()->JustSummoned(me); } @@ -1405,7 +1405,7 @@ class npc_influence_tentacle : public CreatureScript void JustDied(Unit* /*killer*/) override { - if (Creature* brain = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_BRAIN_OF_YOGG_SARON))) + if (Creature* brain = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_BRAIN_OF_YOGG_SARON))) brain->AI()->DoAction(ACTION_TENTACLE_KILLED); } @@ -2791,7 +2791,7 @@ class spell_yogg_saron_induce_madness : public SpellScriptLoader // 64059 if (Unit* target = GetHitUnit()) { target->CastSpell(target, SPELL_TELEPORT_BACK_TO_MAIN_ROOM); - target->RemoveAurasDueToSpell(SPELL_SANITY, 0, 0, AURA_REMOVE_BY_ENEMY_SPELL); + target->RemoveAurasDueToSpell(SPELL_SANITY, ObjectGuid::Empty, 0, AURA_REMOVE_BY_ENEMY_SPELL); target->RemoveAurasDueToSpell(uint32(GetEffectValue())); } } @@ -2801,7 +2801,7 @@ class spell_yogg_saron_induce_madness : public SpellScriptLoader // 64059 GetCaster()->CastSpell((Unit*)NULL, SPELL_SHATTERED_ILLUSION_REMOVE); if (InstanceScript* instance = GetCaster()->GetInstanceScript()) - if (Creature* voice = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_VOICE_OF_YOGG_SARON))) + if (Creature* voice = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(DATA_VOICE_OF_YOGG_SARON))) voice->AI()->DoAction(ACTION_TOGGLE_SHATTERED_ILLUSION); } @@ -3081,7 +3081,7 @@ class spell_yogg_saron_in_the_maws_of_the_old_god : public SpellScriptLoader SpellCastResult CheckRequirement() { if (InstanceScript* instance = GetCaster()->GetInstanceScript()) - if (Creature* yogg = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(BOSS_YOGG_SARON))) + if (Creature* yogg = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(BOSS_YOGG_SARON))) if (yogg->FindCurrentSpellBySpellId(SPELL_DEAFENING_ROAR)) { if (GetCaster()->GetDistance(yogg) > 20.0f) diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp index 56f5c19c574..d00208b0d6f 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp @@ -63,50 +63,50 @@ class instance_ulduar : public InstanceMapScript instance_ulduar_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { } // Creatures - uint64 LeviathanGUID; - uint64 IgnisGUID; - uint64 RazorscaleGUID; - uint64 RazorscaleController; - uint64 ExpeditionCommanderGUID; - uint64 XT002GUID; - uint64 XTToyPileGUIDs[4]; - uint64 AssemblyGUIDs[3]; - uint64 KologarnGUID; - uint64 AuriayaGUID; - uint64 HodirGUID; - uint64 ThorimGUID; - uint64 FreyaGUID; - uint64 ElderGUIDs[3]; - uint64 MimironGUID; - uint64 MimironVehicleGUIDs[3]; - uint64 MimironComputerGUID; - uint64 MimironWorldTriggerGUID; - uint64 VezaxGUID; - uint64 YoggSaronGUID; - uint64 VoiceOfYoggSaronGUID; - uint64 SaraGUID; - uint64 BrainOfYoggSaronGUID; - uint64 KeeperGUIDs[4]; - uint64 AlgalonGUID; - uint64 BrannBronzebeardAlgGUID; + ObjectGuid LeviathanGUID; + ObjectGuid IgnisGUID; + ObjectGuid RazorscaleGUID; + ObjectGuid RazorscaleController; + ObjectGuid ExpeditionCommanderGUID; + ObjectGuid XT002GUID; + ObjectGuid XTToyPileGUIDs[4]; + ObjectGuid AssemblyGUIDs[3]; + ObjectGuid KologarnGUID; + ObjectGuid AuriayaGUID; + ObjectGuid HodirGUID; + ObjectGuid ThorimGUID; + ObjectGuid FreyaGUID; + ObjectGuid ElderGUIDs[3]; + ObjectGuid MimironGUID; + ObjectGuid MimironVehicleGUIDs[3]; + ObjectGuid MimironComputerGUID; + ObjectGuid MimironWorldTriggerGUID; + ObjectGuid VezaxGUID; + ObjectGuid YoggSaronGUID; + ObjectGuid VoiceOfYoggSaronGUID; + ObjectGuid SaraGUID; + ObjectGuid BrainOfYoggSaronGUID; + ObjectGuid KeeperGUIDs[4]; + ObjectGuid AlgalonGUID; + ObjectGuid BrannBronzebeardAlgGUID; // GameObjects - uint64 LeviathanGateGUID; - uint64 RazorHarpoonGUIDs[4]; - uint64 KologarnChestGUID; - uint64 KologarnBridgeGUID; - uint64 ThorimChestGUID; - uint64 HodirRareCacheGUID; - uint64 HodirChestGUID; - uint64 MimironTramGUID; - uint64 MimironElevatorGUID; - uint64 MimironButtonGUID; - uint64 BrainRoomDoorGUIDs[3]; - uint64 AlgalonSigilDoorGUID[3]; - uint64 AlgalonFloorGUID[2]; - uint64 AlgalonUniverseGUID; - uint64 AlgalonTrapdoorGUID; - uint64 GiftOfTheObserverGUID; + ObjectGuid LeviathanGateGUID; + ObjectGuid RazorHarpoonGUIDs[4]; + ObjectGuid KologarnChestGUID; + ObjectGuid KologarnBridgeGUID; + ObjectGuid ThorimChestGUID; + ObjectGuid HodirRareCacheGUID; + ObjectGuid HodirChestGUID; + ObjectGuid MimironTramGUID; + ObjectGuid MimironElevatorGUID; + ObjectGuid MimironButtonGUID; + ObjectGuid BrainRoomDoorGUIDs[3]; + ObjectGuid AlgalonSigilDoorGUID[3]; + ObjectGuid AlgalonFloorGUID[2]; + ObjectGuid AlgalonUniverseGUID; + ObjectGuid AlgalonTrapdoorGUID; + ObjectGuid GiftOfTheObserverGUID; // Miscellaneous uint32 TeamInInstance; @@ -119,47 +119,12 @@ class instance_ulduar : public InstanceMapScript bool Unbroken; bool IsDriveMeCrazyEligible; - std::set<uint64> mRubbleSpawns; - void Initialize() override { SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); LoadDoorData(doorData); LoadMinionData(minionData); - LeviathanGUID = 0; - IgnisGUID = 0; - RazorscaleGUID = 0; - RazorscaleController = 0; - ExpeditionCommanderGUID = 0; - XT002GUID = 0; - KologarnGUID = 0; - AuriayaGUID = 0; - MimironGUID = 0; - MimironComputerGUID = 0; - MimironWorldTriggerGUID = 0; - HodirGUID = 0; - ThorimGUID = 0; - FreyaGUID = 0; - VezaxGUID = 0; - YoggSaronGUID = 0; - VoiceOfYoggSaronGUID = 0; - SaraGUID = 0; - BrainOfYoggSaronGUID = 0; - AlgalonGUID = 0; - KologarnChestGUID = 0; - KologarnBridgeGUID = 0; - ThorimChestGUID = 0; - HodirRareCacheGUID = 0; - HodirChestGUID = 0; - MimironTramGUID = 0; - MimironElevatorGUID = 0; - MimironButtonGUID = 0; - LeviathanGateGUID = 0; - AlgalonUniverseGUID = 0; - AlgalonTrapdoorGUID = 0; - BrannBronzebeardAlgGUID = 0; - GiftOfTheObserverGUID = 0; _algalonTimer = 61; _maxArmorItemLevel = 0; _maxWeaponItemLevel = 0; @@ -175,15 +140,6 @@ class instance_ulduar : public InstanceMapScript _algalonSummoned = false; _summonAlgalon = false; - memset(AlgalonSigilDoorGUID, 0, sizeof(AlgalonSigilDoorGUID)); - memset(AlgalonFloorGUID, 0, sizeof(AlgalonFloorGUID)); - memset(XTToyPileGUIDs, 0, sizeof(XTToyPileGUIDs)); - memset(AssemblyGUIDs, 0, sizeof(AssemblyGUIDs)); - memset(RazorHarpoonGUIDs, 0, sizeof(RazorHarpoonGUIDs)); - memset(ElderGUIDs, 0, sizeof(ElderGUIDs)); - memset(MimironVehicleGUIDs, 0, sizeof(MimironVehicleGUIDs)); - memset(BrainRoomDoorGUIDs, 0, sizeof(BrainRoomDoorGUIDs)); - memset(KeeperGUIDs, 0, sizeof(KeeperGUIDs)); memset(_summonObservationRingKeeper, false, sizeof(_summonObservationRingKeeper)); memset(_summonYSKeeper, false, sizeof(_summonYSKeeper)); } @@ -460,7 +416,7 @@ class instance_ulduar : public InstanceMapScript for (uint8 i = 0; i < 4; ++i) if (XTToyPileGUIDs[i] == creature->GetGUID()) { - XTToyPileGUIDs[i] = 0; + XTToyPileGUIDs[i].Clear(); break; } break; @@ -471,7 +427,7 @@ class instance_ulduar : public InstanceMapScript break; case NPC_BRANN_BRONZBEARD_ALG: if (BrannBronzebeardAlgGUID == creature->GetGUID()) - BrannBronzebeardAlgGUID = 0; + BrannBronzebeardAlgGUID.Clear(); break; default: break; @@ -489,7 +445,7 @@ class instance_ulduar : public InstanceMapScript case GO_KOLOGARN_BRIDGE: KologarnBridgeGUID = gameObject->GetGUID(); if (GetBossState(BOSS_KOLOGARN) == DONE) - HandleGameObject(0, false, gameObject); + HandleGameObject(ObjectGuid::Empty, false, gameObject); break; case GO_THORIM_CHEST_HERO: case GO_THORIM_CHEST: @@ -844,11 +800,11 @@ class instance_ulduar : public InstanceMapScript } } - void SetData64(uint32 /*type*/, uint64 /*data*/) override + void SetGuidData(uint32 /*type*/, ObjectGuid /*data*/) override { } - uint64 GetData64(uint32 data) const override + ObjectGuid GetGuidData(uint32 data) const override { switch (data) { @@ -975,7 +931,7 @@ class instance_ulduar : public InstanceMapScript return BrannBronzebeardAlgGUID; } - return 0; + return ObjectGuid::Empty; } uint32 GetData(uint32 type) const override diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp index ee52df58c80..c08e1934552 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp @@ -287,7 +287,7 @@ class npc_annhylde_the_caller : public CreatureScript { case 1: Talk(YELL_RESURRECT); - if (Creature* ingvar = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_INGVAR))) + if (Creature* ingvar = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_INGVAR))) { ingvar->RemoveAura(SPELL_SUMMON_BANSHEE); ingvar->CastSpell(ingvar, SPELL_SCOURG_RESURRECTION_DUMMY, true); @@ -316,7 +316,7 @@ class npc_annhylde_the_caller : public CreatureScript switch (eventId) { case EVENT_RESURRECT_1: - if (Creature* ingvar = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_INGVAR))) + if (Creature* ingvar = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_INGVAR))) { ingvar->RemoveAura(SPELL_INGVAR_FEIGN_DEATH); ingvar->CastSpell(ingvar, SPELL_SCOURG_RESURRECTION_HEAL, false); @@ -324,7 +324,7 @@ class npc_annhylde_the_caller : public CreatureScript _events.ScheduleEvent(EVENT_RESURRECT_2, 3000); break; case EVENT_RESURRECT_2: - if (Creature* ingvar = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_INGVAR))) + if (Creature* ingvar = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_INGVAR))) { ingvar->RemoveAurasDueToSpell(SPELL_SCOURG_RESURRECTION_DUMMY); ingvar->AI()->DoAction(ACTION_START_PHASE_2); diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp index 6e0dbecafb4..02cf5ade52a 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp @@ -94,7 +94,7 @@ class npc_frost_tomb : public CreatureScript void JustDied(Unit* /*killer*/) override { - if (Creature* keleseth = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_PRINCE_KELESETH))) + if (Creature* keleseth = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_PRINCE_KELESETH))) keleseth->AI()->SetData(DATA_ON_THE_ROCKS, false); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp index c6a91e3ff33..bf11e3cca7b 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp @@ -116,7 +116,7 @@ struct generic_boss_controllerAI : public BossAI void JustDied(Unit* /*killer*/) override { - if (Creature* otherBoss = ObjectAccessor::GetCreature(*me, instance->GetData64(OtherBossData))) + if (Creature* otherBoss = ObjectAccessor::GetCreature(*me, instance->GetGuidData(OtherBossData))) { if (otherBoss->IsAlive()) { diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp index 78df568d144..360befc02af 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp @@ -45,11 +45,6 @@ class instance_utgarde_keep : public InstanceMapScript SetBossNumber(EncounterCount); LoadDoorData(doorData); LoadMinionData(minionData); - - PrinceKelesethGUID = 0; - SkarvaldGUID = 0; - DalronnGUID = 0; - IngvarGUID = 0; } void OnCreatureCreate(Creature* creature) override @@ -94,39 +89,39 @@ class instance_utgarde_keep : public InstanceMapScript { case GO_BELLOW_1: Forges[0].BellowGUID = go->GetGUID(); - HandleGameObject(0, Forges[0].Event != NOT_STARTED, go); + HandleGameObject(ObjectGuid::Empty, Forges[0].Event != NOT_STARTED, go); break; case GO_BELLOW_2: Forges[1].BellowGUID = go->GetGUID(); - HandleGameObject(0, Forges[1].Event != NOT_STARTED, go); + HandleGameObject(ObjectGuid::Empty, Forges[1].Event != NOT_STARTED, go); break; case GO_BELLOW_3: Forges[2].BellowGUID = go->GetGUID(); - HandleGameObject(0, Forges[2].Event != NOT_STARTED, go); + HandleGameObject(ObjectGuid::Empty, Forges[2].Event != NOT_STARTED, go); break; case GO_FORGEFIRE_1: Forges[0].FireGUID = go->GetGUID(); - HandleGameObject(0, Forges[0].Event != NOT_STARTED, go); + HandleGameObject(ObjectGuid::Empty, Forges[0].Event != NOT_STARTED, go); break; case GO_FORGEFIRE_2: Forges[1].FireGUID = go->GetGUID(); - HandleGameObject(0, Forges[1].Event != NOT_STARTED, go); + HandleGameObject(ObjectGuid::Empty, Forges[1].Event != NOT_STARTED, go); break; case GO_FORGEFIRE_3: Forges[2].FireGUID = go->GetGUID(); - HandleGameObject(0, Forges[2].Event != NOT_STARTED, go); + HandleGameObject(ObjectGuid::Empty, Forges[2].Event != NOT_STARTED, go); break; case GO_GLOWING_ANVIL_1: Forges[0].AnvilGUID = go->GetGUID(); - HandleGameObject(0, Forges[0].Event != NOT_STARTED, go); + HandleGameObject(ObjectGuid::Empty, Forges[0].Event != NOT_STARTED, go); break; case GO_GLOWING_ANVIL_2: Forges[1].AnvilGUID = go->GetGUID(); - HandleGameObject(0, Forges[1].Event != NOT_STARTED, go); + HandleGameObject(ObjectGuid::Empty, Forges[1].Event != NOT_STARTED, go); break; case GO_GLOWING_ANVIL_3: Forges[2].AnvilGUID = go->GetGUID(); - HandleGameObject(0, Forges[2].Event != NOT_STARTED, go); + HandleGameObject(ObjectGuid::Empty, Forges[2].Event != NOT_STARTED, go); break; case GO_GIANT_PORTCULLIS_1: case GO_GIANT_PORTCULLIS_2: @@ -150,7 +145,7 @@ class instance_utgarde_keep : public InstanceMapScript } } - uint64 GetData64(uint32 type) const override + ObjectGuid GetGuidData(uint32 type) const override { switch (type) { @@ -166,7 +161,7 @@ class instance_utgarde_keep : public InstanceMapScript break; } - return 0; + return ObjectGuid::Empty; } void SetData(uint32 type, uint32 data) override @@ -207,10 +202,10 @@ class instance_utgarde_keep : public InstanceMapScript protected: ForgeInfo Forges[3]; - uint64 PrinceKelesethGUID; - uint64 SkarvaldGUID; - uint64 DalronnGUID; - uint64 IngvarGUID; + ObjectGuid PrinceKelesethGUID; + ObjectGuid SkarvaldGUID; + ObjectGuid DalronnGUID; + ObjectGuid IngvarGUID; }; InstanceScript* GetInstanceScript(InstanceMap* map) const override diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h index 751239755cf..5b52072b07f 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h @@ -76,11 +76,11 @@ enum GameObjectIds struct ForgeInfo { - ForgeInfo() : AnvilGUID(0), BellowGUID(0), FireGUID(0), Event(NOT_STARTED) { }; + ForgeInfo() : Event(NOT_STARTED) { }; - uint64 AnvilGUID; - uint64 BellowGUID; - uint64 FireGUID; + ObjectGuid AnvilGUID; + ObjectGuid BellowGUID; + ObjectGuid FireGUID; uint32 Event; }; diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp index b3285bd492e..061499f2025 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp @@ -129,11 +129,11 @@ public: me->GetMotionMaster()->MoveTargetedHome(); for (uint8 i = DATA_FRENZIED_WORGEN; i <= DATA_FEROCIOUS_RHINO; ++i) - if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(i))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(i))) if (!temp->IsAlive()) temp->Respawn(); - if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_GORTOK_PALEHOOF_SPHERE))) + if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_GORTOK_PALEHOOF_SPHERE))) { go->SetGoState(GO_STATE_READY); go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); @@ -224,7 +224,7 @@ public: move = Sequence[AddCount++]; // send orb to summon spot - if (Creature* orb = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_ORB))) + if (Creature* orb = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_GORTOK_ORB))) if (orb->IsAlive()) orb->GetMotionMaster()->MovePoint(move, moveLocs[move]); @@ -293,7 +293,7 @@ public: if (instance->GetBossState(DATA_GORTOK_PALEHOOF) == IN_PROGRESS) { - Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF)); + Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_GORTOK_PALEHOOF)); if (palehoof && palehoof->IsAlive()) palehoof->AI()->Reset(); } @@ -345,7 +345,7 @@ public: void JustDied(Unit* /*killer*/) override { - if (Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF))) + if (Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_GORTOK_PALEHOOF))) palehoof->AI()->DoAction(ACTION_NEXT_PHASE); } @@ -407,7 +407,7 @@ public: if (instance->GetBossState(DATA_GORTOK_PALEHOOF) == IN_PROGRESS) { - Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF)); + Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_GORTOK_PALEHOOF)); if (palehoof && palehoof->IsAlive()) palehoof->AI()->Reset(); } @@ -460,7 +460,7 @@ public: void JustDied(Unit* /*killer*/) override { - if (Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF))) + if (Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_GORTOK_PALEHOOF))) palehoof->AI()->DoAction(ACTION_NEXT_PHASE); } @@ -523,7 +523,7 @@ public: if (instance->GetBossState(DATA_GORTOK_PALEHOOF) == IN_PROGRESS) { - Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF)); + Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_GORTOK_PALEHOOF)); if (palehoof && palehoof->IsAlive()) palehoof->AI()->Reset(); } @@ -576,7 +576,7 @@ public: void JustDied(Unit* /*killer*/) override { - if (Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF))) + if (Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_GORTOK_PALEHOOF))) palehoof->AI()->DoAction(ACTION_NEXT_PHASE); } @@ -644,7 +644,7 @@ public: if (instance->GetBossState(DATA_GORTOK_PALEHOOF) == IN_PROGRESS) { - Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF)); + Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_GORTOK_PALEHOOF)); if (palehoof && palehoof->IsAlive()) palehoof->AI()->Reset(); } @@ -698,7 +698,7 @@ public: void JustDied(Unit* /*killer*/) override { - if (Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF))) + if (Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_GORTOK_PALEHOOF))) palehoof->AI()->DoAction(ACTION_NEXT_PHASE); } @@ -778,7 +778,7 @@ public: return; } - if (Creature* nextBoss = ObjectAccessor::GetCreature(*me, instance->GetData64(nextBossId))) + if (Creature* nextBoss = ObjectAccessor::GetCreature(*me, instance->GetGuidData(nextBossId))) { nextBoss->RemoveAurasDueToSpell(SPELL_FREEZE); nextBoss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC); @@ -822,7 +822,7 @@ public: return; } - if (Creature* nextBoss = ObjectAccessor::GetCreature(*me, instance->GetData64(nextBossId))) + if (Creature* nextBoss = ObjectAccessor::GetCreature(*me, instance->GetGuidData(nextBossId))) DoCast(nextBoss, SPELL_ORB_CHANNEL, false); currentPhase = Phase(id); @@ -843,7 +843,7 @@ class go_palehoof_sphere : public GameObjectScript if (!instance) return false; - Creature* palehoof = ObjectAccessor::GetCreature(*go, instance->GetData64(DATA_GORTOK_PALEHOOF)); + Creature* palehoof = ObjectAccessor::GetCreature(*go, instance->GetGuidData(DATA_GORTOK_PALEHOOF)); if (palehoof && palehoof->IsAlive()) { go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp index af5dc4a4e03..5d6a2416d73 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp @@ -171,7 +171,6 @@ public: { Initialize(); instance = creature->GetInstanceScript(); - m_uiGraufGUID = 0; m_uiMovementTimer = 0; m_uiSummonTimer = 0; } @@ -191,8 +190,7 @@ public: InstanceScript* instance; SummonList Summons; - uint64 m_uiGraufGUID; - std::vector<uint64> triggersGUID; + ObjectGuid m_uiGraufGUID; uint32 m_uiCrushTimer; uint32 m_uiPoisonedSpearTimer; @@ -208,8 +206,6 @@ public: void Reset() override { - triggersGUID.clear(); - Initialize(); Summons.DespawnAll(); @@ -274,7 +270,7 @@ public: void SummonedCreatureDespawn(Creature* summoned) override { if (summoned->GetEntry() == NPC_GRAUF) - m_uiGraufGUID = 0; + m_uiGraufGUID.Clear(); Summons.Despawn(summoned); } @@ -477,7 +473,7 @@ public: if (!instance) return false; - if (Creature* pSkadi = ObjectAccessor::GetCreature(*go, instance->GetData64(DATA_SKADI_THE_RUTHLESS))) + if (Creature* pSkadi = ObjectAccessor::GetCreature(*go, instance->GetGuidData(DATA_SKADI_THE_RUTHLESS))) player->CastSpell(pSkadi, SPELL_RAPID_FIRE, true); return false; diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp index a31aff259d1..bf9d9eaa43b 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp @@ -143,7 +143,7 @@ class boss_svala : public CreatureScript void Initialize() { - _arthasGUID = 0; + _arthasGUID.Clear(); _sacrificed = false; } @@ -162,7 +162,7 @@ class boss_svala : public CreatureScript Initialize(); - instance->SetData64(DATA_SACRIFICED_PLAYER, 0); + instance->SetGuidData(DATA_SACRIFICED_PLAYER, ObjectGuid::Empty); } void EnterCombat(Unit* /*who*/) override @@ -188,7 +188,7 @@ class boss_svala : public CreatureScript events.SetPhase(INTRO); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (GameObject* mirror = ObjectAccessor::GetGameObject(*me, DATA_UTGARDE_MIRROR)) + if (GameObject* mirror = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_UTGARDE_MIRROR))) mirror->SetGoState(GO_STATE_READY); if (Creature* arthas = me->SummonCreature(NPC_ARTHAS, ArthasPos, TEMPSUMMON_MANUAL_DESPAWN)) @@ -331,12 +331,12 @@ class boss_svala : public CreatureScript break; } case EVENT_INTRO_DESPAWN_ARTHAS: - if (GameObject* mirror = ObjectAccessor::GetGameObject(*me, DATA_UTGARDE_MIRROR)) + if (GameObject* mirror = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_UTGARDE_MIRROR))) mirror->SetGoState(GO_STATE_ACTIVE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); if (Creature* arthas = ObjectAccessor::GetCreature(*me, _arthasGUID)) arthas->DespawnOrUnsummon(); - _arthasGUID = 0; + _arthasGUID.Clear(); events.SetPhase(NORMAL); _introCompleted = true; events.ScheduleEvent(EVENT_SINISTER_STRIKE, 7 * IN_MILLISECONDS, 0, NORMAL); @@ -354,7 +354,7 @@ class boss_svala : public CreatureScript case EVENT_RITUAL_PREPARATION: if (Unit* sacrificeTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 80.0f, true)) { - instance->SetData64(DATA_SACRIFICED_PLAYER, sacrificeTarget->GetGUID()); + instance->SetGuidData(DATA_SACRIFICED_PLAYER, sacrificeTarget->GetGUID()); Talk(SAY_SACRIFICE_PLAYER); DoCast(sacrificeTarget, SPELL_RITUAL_PREPARATION); SetCombatMovement(false); @@ -385,7 +385,7 @@ class boss_svala : public CreatureScript } private: - uint64 _arthasGUID; + ObjectGuid _arthasGUID; bool _sacrificed; bool _introCompleted; }; @@ -434,7 +434,7 @@ class npc_ritual_channeler : public CreatureScript if (paralyzeTimer <= diff) { - if (Unit* victim = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_SACRIFICED_PLAYER))) + if (Unit* victim = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_SACRIFICED_PLAYER))) DoCast(victim, SPELL_PARALYZE, false); paralyzeTimer = 200; @@ -487,7 +487,7 @@ class RitualTargetCheck bool operator() (WorldObject* obj) const { if (InstanceScript* instance = obj->GetInstanceScript()) - if (instance->GetData64(DATA_SACRIFICED_PLAYER) == obj->GetGUID()) + if (instance->GetGuidData(DATA_SACRIFICED_PLAYER) == obj->GetGUID()) return false; return true; diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp index 1d3fcba09de..c4312e08704 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp @@ -124,8 +124,8 @@ public: ActivedNumber = 0; HealthAmountModifier = 1; HealthAmountMultipler = DUNGEON_MODE(20, 25); - ActiveAncestorGUID = 0; - SpiritFountGUID = 0; + ActiveAncestorGUID.Clear(); + SpiritFountGUID.Clear(); } void Reset() override @@ -283,14 +283,14 @@ public: Talk(SAY_SLAY); } - void DespawnBoatGhosts(uint64& CreatureGUID) + void DespawnBoatGhosts(ObjectGuid& CreatureGUID) { // @todo: fire visual after ancestor despawns. if (CreatureGUID) if (Creature* temp = ObjectAccessor::GetCreature(*me, CreatureGUID)) temp->DisappearAndDie(); - CreatureGUID = 0; + CreatureGUID.Clear(); } private: @@ -299,8 +299,8 @@ public: uint8 ActivedNumber; uint32 HealthAmountModifier; uint32 HealthAmountMultipler; - uint64 ActiveAncestorGUID; - uint64 SpiritFountGUID; + ObjectGuid ActiveAncestorGUID; + ObjectGuid SpiritFountGUID; }; CreatureAI* GetAI(Creature* creature) const override diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp index 1bc3f20c3fe..519cc3b7202 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp @@ -38,23 +38,6 @@ class instance_utgarde_pinnacle : public InstanceMapScript SetHeaders(DataHeader); SetBossNumber(EncounterCount); LoadDoorData(doorData); - - SvalaSorrowgraveGUID = 0; - GortokPalehoofGUID = 0; - SkadiTheRuthlessGUID = 0; - KingYmironGUID = 0; - - UtgardeMirrorGUID = 0; - GortokPalehoofSphereGUID = 0; - - FrenziedWorgenGUID = 0; - RavenousFurbolgGUID = 0; - FerociousRhinoGUID = 0; - MassiveJormungarGUID = 0; - PalehoofOrbGUID = 0; - - SvalaGUID = 0; - SacrificedPlayerGUID = 0; } void OnCreatureCreate(Creature* creature) override @@ -107,7 +90,7 @@ class instance_utgarde_pinnacle : public InstanceMapScript GortokPalehoofSphereGUID = go->GetGUID(); if (GetBossState(DATA_GORTOK_PALEHOOF) == DONE) { - HandleGameObject(0, true, go); + HandleGameObject(ObjectGuid::Empty, true, go); go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); } break; @@ -133,7 +116,7 @@ class instance_utgarde_pinnacle : public InstanceMapScript } } - void SetData64(uint32 type, uint64 data) override + void SetGuidData(uint32 type, ObjectGuid data) override { switch (type) { @@ -145,7 +128,7 @@ class instance_utgarde_pinnacle : public InstanceMapScript } } - uint64 GetData64(uint32 type) const override + ObjectGuid GetGuidData(uint32 type) const override { switch (type) { @@ -179,27 +162,27 @@ class instance_utgarde_pinnacle : public InstanceMapScript break; } - return 0; + return ObjectGuid::Empty; } protected: - uint64 SvalaSorrowgraveGUID; - uint64 GortokPalehoofGUID; - uint64 SkadiTheRuthlessGUID; - uint64 KingYmironGUID; + ObjectGuid SvalaSorrowgraveGUID; + ObjectGuid GortokPalehoofGUID; + ObjectGuid SkadiTheRuthlessGUID; + ObjectGuid KingYmironGUID; - uint64 UtgardeMirrorGUID; - uint64 GortokPalehoofSphereGUID; + ObjectGuid UtgardeMirrorGUID; + ObjectGuid GortokPalehoofSphereGUID; - uint64 FrenziedWorgenGUID; - uint64 RavenousFurbolgGUID; - uint64 FerociousRhinoGUID; - uint64 MassiveJormungarGUID; + ObjectGuid FrenziedWorgenGUID; + ObjectGuid RavenousFurbolgGUID; + ObjectGuid FerociousRhinoGUID; + ObjectGuid MassiveJormungarGUID; - uint64 PalehoofOrbGUID; + ObjectGuid PalehoofOrbGUID; - uint64 SvalaGUID; - uint64 SacrificedPlayerGUID; + ObjectGuid SvalaGUID; + ObjectGuid SacrificedPlayerGUID; }; InstanceScript* GetInstanceScript(InstanceMap* map) const override diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp index 8a88abb9d06..bacb63b73bc 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp @@ -101,7 +101,7 @@ class boss_emalon : public CreatureScript { if (!summons.empty()) { - for (std::list<uint64>::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) { Creature* minion = ObjectAccessor::GetCreature(*me, *itr); if (minion && minion->IsAlive() && !minion->GetVictim() && minion->AI()) @@ -201,7 +201,7 @@ class npc_tempest_minion : public CreatureScript void JustDied(Unit* /*killer*/) override { - if (Creature* emalon = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EMALON))) + if (Creature* emalon = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_EMALON))) { if (emalon->IsAlive()) { @@ -216,7 +216,7 @@ class npc_tempest_minion : public CreatureScript DoZoneInCombat(); events.ScheduleEvent(EVENT_SHOCK, 20000); - if (Creature* pEmalon = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EMALON))) + if (Creature* pEmalon = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_EMALON))) { if (!pEmalon->GetVictim() && pEmalon->AI()) pEmalon->AI()->AttackStart(who); diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp index 36c952d14a1..a7895b8d506 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp @@ -262,7 +262,7 @@ class npc_frozen_orb_stalker : public CreatureScript return; spawned = true; - Unit* toravon = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TORAVON)); + Unit* toravon = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TORAVON)); if (!toravon) return; diff --git a/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp index 959c8b7724d..846ecc1226a 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp @@ -38,8 +38,6 @@ class instance_vault_of_archavon : public InstanceMapScript SetHeaders(DataHeader); SetBossNumber(EncounterCount); - EmalonGUID = 0; - ToravonGUID = 0; ArchavonDeath = 0; EmalonDeath = 0; KoralonDeath = 0; @@ -60,7 +58,7 @@ class instance_vault_of_archavon : public InstanceMapScript } } - uint64 GetData64(uint32 identifier) const override + ObjectGuid GetGuidData(uint32 identifier) const override { switch (identifier) { @@ -72,7 +70,7 @@ class instance_vault_of_archavon : public InstanceMapScript break; } - return 0; + return ObjectGuid::Empty; } bool SetBossState(uint32 type, EncounterState state) override @@ -127,8 +125,8 @@ class instance_vault_of_archavon : public InstanceMapScript } private: - uint64 EmalonGUID; - uint64 ToravonGUID; + ObjectGuid EmalonGUID; + ObjectGuid ToravonGUID; time_t ArchavonDeath; time_t EmalonDeath; time_t KoralonDeath; diff --git a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp index 6cc90bcd4ed..bbb8c758bb1 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp @@ -85,12 +85,12 @@ public: else if (instance->GetData(DATA_WAVE_COUNT) == 12) instance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); - if (Creature* pGuard1 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EREKEM_GUARD_1))) + if (Creature* pGuard1 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_EREKEM_GUARD_1))) { if (!pGuard1->IsAlive()) pGuard1->Respawn(); } - if (Creature* pGuard2 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EREKEM_GUARD_2))) + if (Creature* pGuard2 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_EREKEM_GUARD_2))) { if (!pGuard2->IsAlive()) pGuard2->Respawn(); @@ -109,13 +109,13 @@ public: who->SetInCombatWith(me); DoStartMovement(who); - if (Creature* pGuard1 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EREKEM_GUARD_1))) + if (Creature* pGuard1 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_EREKEM_GUARD_1))) { pGuard1->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NON_ATTACKABLE); if (!pGuard1->GetVictim() && pGuard1->AI()) pGuard1->AI()->AttackStart(who); } - if (Creature* pGuard2 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EREKEM_GUARD_2))) + if (Creature* pGuard2 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_EREKEM_GUARD_2))) { pGuard2->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NON_ATTACKABLE); if (!pGuard2->GetVictim() && pGuard2->AI()) @@ -129,7 +129,7 @@ public: Talk(SAY_AGGRO); DoCast(me, SPELL_EARTH_SHIELD); - if (GameObject* pDoor = instance->instance->GetGameObject(instance->GetData64(DATA_EREKEM_CELL))) + if (GameObject* pDoor = instance->instance->GetGameObject(instance->GetGuidData(DATA_EREKEM_CELL))) if (pDoor->GetGoState() == GO_STATE_READY) { EnterEvadeMode(); @@ -154,9 +154,9 @@ public: //spam stormstrike in hc mode if spawns are dead if (IsHeroic()) { - if (Creature* pGuard1 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EREKEM_GUARD_1))) + if (Creature* pGuard1 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_EREKEM_GUARD_1))) { - if (Creature* pGuard2 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EREKEM_GUARD_2))) + if (Creature* pGuard2 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_EREKEM_GUARD_2))) { if (!pGuard1->IsAlive() && !pGuard2->IsAlive()) DoCastVictim(SPELL_STORMSTRIKE); @@ -172,14 +172,14 @@ public: if (uiChainHealTimer <= diff) { - if (uint64 TargetGUID = GetChainHealTargetGUID()) + if (ObjectGuid TargetGUID = GetChainHealTargetGUID()) { if (Creature* target = ObjectAccessor::GetCreature(*me, TargetGUID)) DoCast(target, SPELL_CHAIN_HEAL); //If one of the adds is dead spawn heals faster - Creature* pGuard1 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EREKEM_GUARD_1)); - Creature* pGuard2 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EREKEM_GUARD_2)); + Creature* pGuard1 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_EREKEM_GUARD_1)); + Creature* pGuard2 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_EREKEM_GUARD_2)); uiChainHealTimer = ((pGuard1 && !pGuard1->IsAlive()) || (pGuard2 && !pGuard2->IsAlive()) ? 3000 : 8000) + rand32() % 3000; } } else uiChainHealTimer -= diff; @@ -230,20 +230,20 @@ public: Talk(SAY_SLAY); } - uint64 GetChainHealTargetGUID() + ObjectGuid GetChainHealTargetGUID() { if (HealthBelowPct(85)) return me->GetGUID(); - Creature* pGuard1 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EREKEM_GUARD_1)); + Creature* pGuard1 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_EREKEM_GUARD_1)); if (pGuard1 && pGuard1->IsAlive() && !pGuard1->HealthAbovePct(75)) return pGuard1->GetGUID(); - Creature* pGuard2 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EREKEM_GUARD_2)); + Creature* pGuard2 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_EREKEM_GUARD_2)); if (pGuard2 && pGuard2->IsAlive() && !pGuard2->HealthAbovePct(75)) return pGuard2->GetGUID(); - return 0; + return ObjectGuid::Empty; } }; diff --git a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp index ba72f6f52ca..50a65920876 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp @@ -128,7 +128,7 @@ public: DoCast(me, SPELL_PROTECTIVE_BUBBLE); - if (GameObject* pDoor = instance->instance->GetGameObject(instance->GetData64(DATA_ICHORON_CELL))) + if (GameObject* pDoor = instance->instance->GetGameObject(instance->GetGuidData(DATA_ICHORON_CELL))) if (pDoor->GetGoState() == GO_STATE_READY) { EnterEvadeMode(); @@ -227,7 +227,7 @@ public: { if (!bIsExploded) { - if (!me->HasAura(SPELL_PROTECTIVE_BUBBLE, 0)) + if (!me->HasAura(SPELL_PROTECTIVE_BUBBLE)) { Talk(SAY_SHATTER); DoCast(me, SPELL_WATER_BLAST); @@ -247,7 +247,7 @@ public: bool bIsWaterElementsAlive = false; if (!m_waterElements.empty()) { - for (std::list<uint64>::const_iterator itr = m_waterElements.begin(); itr != m_waterElements.end(); ++itr) + for (SummonList::const_iterator itr = m_waterElements.begin(); itr != m_waterElements.end(); ++itr) if (Creature* temp = ObjectAccessor::GetCreature(*me, *itr)) if (temp->IsAlive()) { @@ -308,7 +308,7 @@ public: summoned->SetSpeed(MOVE_RUN, 0.3f); summoned->GetMotionMaster()->MoveFollow(me, 0, 0); m_waterElements.Summon(summoned); - instance->SetData64(DATA_ADD_TRASH_MOB, summoned->GetGUID()); + instance->SetGuidData(DATA_ADD_TRASH_MOB, summoned->GetGUID()); } } @@ -317,7 +317,7 @@ public: if (summoned) { m_waterElements.Despawn(summoned); - instance->SetData64(DATA_DEL_TRASH_MOB, summoned->GetGUID()); + instance->SetGuidData(DATA_DEL_TRASH_MOB, summoned->GetGUID()); } } @@ -374,7 +374,7 @@ public: { if (uiRangeCheck_Timer < uiDiff) { - if (Creature* pIchoron = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ICHORON))) + if (Creature* pIchoron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ICHORON))) { if (me->IsWithinDist(pIchoron, 2.0f, false)) { @@ -391,7 +391,7 @@ public: void JustDied(Unit* /*killer*/) override { DoCast(me, SPELL_SPLASH); - if (Creature* pIchoron = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ICHORON))) + if (Creature* pIchoron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ICHORON))) if (pIchoron->AI()) pIchoron->AI()->DoAction(ACTION_WATER_ELEMENT_KILLED); } diff --git a/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp b/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp index 3a08a4510ca..5d8756bcffc 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp @@ -68,7 +68,7 @@ public: void EnterCombat(Unit* /*who*/) override { - if (GameObject* pDoor = instance->instance->GetGameObject(instance->GetData64(DATA_LAVANTHOR_CELL))) + if (GameObject* pDoor = instance->instance->GetGameObject(instance->GetGuidData(DATA_LAVANTHOR_CELL))) if (pDoor->GetGoState() == GO_STATE_READY) { EnterEvadeMode(); diff --git a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp index 12ace1b1c38..67d71cad24c 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp @@ -61,7 +61,7 @@ public: void EnterCombat(Unit* /*who*/) override { - if (GameObject* pDoor = instance->instance->GetGameObject(instance->GetData64(DATA_MORAGG_CELL))) + if (GameObject* pDoor = instance->instance->GetGameObject(instance->GetGuidData(DATA_MORAGG_CELL))) if (pDoor->GetGoState() == GO_STATE_READY) { EnterEvadeMode(); diff --git a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp index 734c20000eb..79c535979d7 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp @@ -134,7 +134,7 @@ public: void EnterCombat(Unit* /*who*/) override { Talk(SAY_AGGRO); - if (GameObject* pDoor = instance->instance->GetGameObject(instance->GetData64(DATA_XEVOZZ_CELL))) + if (GameObject* pDoor = instance->instance->GetGameObject(instance->GetGuidData(DATA_XEVOZZ_CELL))) if (pDoor->GetGoState() == GO_STATE_READY) { EnterEvadeMode(); @@ -254,7 +254,7 @@ public: if (uiRangeCheck_Timer < uiDiff) { - if (Creature* pXevozz = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_XEVOZZ))) + if (Creature* pXevozz = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_XEVOZZ))) { float fDistance = me->GetDistance2d(pXevozz); if (fDistance <= 3) diff --git a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp index 7ae1c7840db..e155c4d2e71 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp @@ -105,7 +105,7 @@ public: void EnterCombat(Unit* /*who*/) override { Talk(SAY_AGGRO); - if (GameObject* pDoor = instance->instance->GetGameObject(instance->GetData64(DATA_ZURAMAT_CELL))) + if (GameObject* pDoor = instance->instance->GetGameObject(instance->GetGuidData(DATA_ZURAMAT_CELL))) if (pDoor->GetGoState() == GO_STATE_READY) { EnterEvadeMode(); diff --git a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp index 9c81e664fd4..cddf6ce3c25 100644 --- a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp @@ -114,35 +114,35 @@ public: { instance_violet_hold_InstanceMapScript(Map* map) : InstanceScript(map) { } - uint64 uiMoragg; - uint64 uiErekem; - uint64 uiErekemGuard[2]; - uint64 uiIchoron; - uint64 uiLavanthor; - uint64 uiXevozz; - uint64 uiZuramat; - uint64 uiCyanigosa; - uint64 uiSinclari; - - uint64 uiMoraggCell; - uint64 uiErekemCell; - uint64 uiErekemLeftGuardCell; - uint64 uiErekemRightGuardCell; - uint64 uiIchoronCell; - uint64 uiLavanthorCell; - uint64 uiXevozzCell; - uint64 uiZuramatCell; - uint64 uiMainDoor; - uint64 uiTeleportationPortal; - uint64 uiSaboteurPortal; - - uint64 uiActivationCrystal[4]; + ObjectGuid uiMoragg; + ObjectGuid uiErekem; + ObjectGuid uiErekemGuard[2]; + ObjectGuid uiIchoron; + ObjectGuid uiLavanthor; + ObjectGuid uiXevozz; + ObjectGuid uiZuramat; + ObjectGuid uiCyanigosa; + ObjectGuid uiSinclari; + + ObjectGuid uiMoraggCell; + ObjectGuid uiErekemCell; + ObjectGuid uiErekemLeftGuardCell; + ObjectGuid uiErekemRightGuardCell; + ObjectGuid uiIchoronCell; + ObjectGuid uiLavanthorCell; + ObjectGuid uiXevozzCell; + ObjectGuid uiZuramatCell; + ObjectGuid uiMainDoor; + ObjectGuid uiTeleportationPortal; + ObjectGuid uiSaboteurPortal; + + ObjectGuid uiActivationCrystal[4]; uint32 uiActivationTimer; uint32 uiCyanigosaEventTimer; uint32 uiDoorSpellTimer; - std::set<uint64> trashMobs; // to kill with crystal + GuidSet trashMobs; // to kill with crystal uint8 uiWaveCount; uint8 uiLocation; @@ -171,28 +171,6 @@ public: void Initialize() override { SetHeaders(DataHeader); - uiMoragg = 0; - uiErekem = 0; - uiIchoron = 0; - uiLavanthor = 0; - uiXevozz = 0; - uiZuramat = 0; - uiCyanigosa = 0; - uiSinclari = 0; - - uiMoraggCell = 0; - uiErekemCell = 0; - uiErekemGuard[0] = 0; - uiErekemGuard[1] = 0; - uiIchoronCell = 0; - uiLavanthorCell = 0; - uiXevozzCell = 0; - uiZuramatCell = 0; - uiMainDoor = 0; - uiTeleportationPortal = 0; - uiSaboteurPortal = 0; - - trashMobs.clear(); uiRemoveNpc = 0; @@ -266,11 +244,14 @@ public: break; } + /* + BEWARE - SHIT. if (creature->GetGUID() == uiFirstBoss || creature->GetGUID() == uiSecondBoss) { creature->AllLootRemovedFromCorpse(); creature->RemoveLootMode(1); } + */ } void OnGameObjectCreate(GameObject* go) override @@ -407,7 +388,7 @@ public: } } - void SetData64(uint32 type, uint64 data) override + void SetGuidData(uint32 type, ObjectGuid data) override { switch (type) { @@ -441,7 +422,7 @@ public: return 0; } - uint64 GetData64(uint32 identifier) const override + ObjectGuid GetGuidData(uint32 identifier) const override { switch (identifier) { @@ -468,7 +449,7 @@ public: case DATA_SABOTEUR_PORTAL: return uiSaboteurPortal; } - return 0; + return ObjectGuid::Empty; } void SpawnPortal() @@ -813,8 +794,8 @@ public: // visuals trigger->CastSpell(trigger, spellInfoLightning, true, 0, 0, trigger->GetGUID()); - // Kill all mobs registered with SetData64(ADD_TRASH_MOB) - for (std::set<uint64>::const_iterator itr = trashMobs.begin(); itr != trashMobs.end(); ++itr) + // Kill all mobs registered with SetGuidData(ADD_TRASH_MOB) + for (GuidSet::const_iterator itr = trashMobs.begin(); itr != trashMobs.end(); ++itr) { Creature* creature = instance->GetCreature(*itr); if (creature && creature->IsAlive()) diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp index 1c106f399de..76a7b701717 100644 --- a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp @@ -526,7 +526,7 @@ public: { me->CastSpell(me, SABOTEUR_SHIELD_DISRUPTION, false); me->DisappearAndDie(); - Creature* pSaboPort = ObjectAccessor::GetCreature((*me), instance->GetData64(DATA_SABOTEUR_PORTAL)); + Creature* pSaboPort = ObjectAccessor::GetCreature((*me), instance->GetGuidData(DATA_SABOTEUR_PORTAL)); if (pSaboPort) pSaboPort->DisappearAndDie(); instance->SetData(DATA_START_BOSS_ENCOUNTER, 1); @@ -653,13 +653,13 @@ public: void JustSummoned(Creature* summoned) override { listOfMobs.Summon(summoned); - instance->SetData64(DATA_ADD_TRASH_MOB, summoned->GetGUID()); + instance->SetGuidData(DATA_ADD_TRASH_MOB, summoned->GetGUID()); } void SummonedCreatureDies(Creature* summoned, Unit* /*killer*/) override { listOfMobs.Despawn(summoned); - instance->SetData64(DATA_DEL_TRASH_MOB, summoned->GetGUID()); + instance->SetGuidData(DATA_DEL_TRASH_MOB, summoned->GetGUID()); } }; diff --git a/src/server/scripts/Northrend/zone_borean_tundra.cpp b/src/server/scripts/Northrend/zone_borean_tundra.cpp index f02edbb5584..7824fe86c87 100644 --- a/src/server/scripts/Northrend/zone_borean_tundra.cpp +++ b/src/server/scripts/Northrend/zone_borean_tundra.cpp @@ -71,13 +71,13 @@ public: uint32 phaseTimer; uint8 phase; - uint64 casterGuid; + ObjectGuid casterGuid; void Reset() override { phaseTimer = 500; phase = 0; - casterGuid = 0; + casterGuid.Clear(); } void SpellHit(Unit* caster, const SpellInfo* spell) override @@ -391,7 +391,7 @@ public: if (uiRand < 25) { player->CastSpell(me, SPELL_FREED_WARSONG_PEON, true); - player->KilledMonsterCredit(NPC_WARSONG_PEON, 0); + player->KilledMonsterCredit(NPC_WARSONG_PEON); } else if (uiRand < 75) player->CastSpell(me, nerubarVictims[urand(0, 2)], true); @@ -449,7 +449,7 @@ public: { npc_nesingwary_trapperAI(Creature* creature) : ScriptedAI(creature) { creature->SetVisible(false); } - uint64 go_caribouGUID; + ObjectGuid go_caribouGUID; uint8 phase; uint32 phaseTimer; @@ -458,7 +458,7 @@ public: me->SetVisible(false); phaseTimer = 2500; phase = 1; - go_caribouGUID = 0; + go_caribouGUID.Clear(); } void EnterCombat(Unit* /*who*/) override { } @@ -474,7 +474,7 @@ public: if (summon->IsSummon()) if (Unit* temp = summon->GetSummoner()) if (Player* player = temp->ToPlayer()) - player->KilledMonsterCredit(me->GetEntry(), 0); + player->KilledMonsterCredit(me->GetEntry()); if (GameObject* go_caribou = me->GetMap()->GetGameObject(go_caribouGUID)) go_caribou->SetGoState(GO_STATE_READY); @@ -723,10 +723,9 @@ public: { npc_nexus_drake_hatchlingAI(Creature* creature) : FollowerAI(creature) { - HarpoonerGUID = 0; } - uint64 HarpoonerGUID; + ObjectGuid HarpoonerGUID; bool WithRedDragonBlood; void Reset() override @@ -764,10 +763,10 @@ public: { if (Player* pHarpooner = ObjectAccessor::GetPlayer(*me, HarpoonerGUID)) { - pHarpooner->KilledMonsterCredit(26175, 0); + pHarpooner->KilledMonsterCredit(26175); pHarpooner->RemoveAura(SPELL_DRAKE_HATCHLING_SUBDUED); SetFollowComplete(); - HarpoonerGUID = 0; + HarpoonerGUID.Clear(); me->DisappearAndDie(); } } @@ -793,7 +792,7 @@ public: if ((me->getFaction() == 35) && (!me->HasAura(SPELL_SUBDUED))) { - HarpoonerGUID = 0; + HarpoonerGUID.Clear(); me->DisappearAndDie(); } @@ -865,10 +864,10 @@ public: { npc_thassarianAI(Creature* creature) : npc_escortAI(creature) { } - uint64 arthasGUID; - uint64 talbotGUID; - uint64 leryssaGUID; - uint64 arlosGUID; + ObjectGuid arthasGUID; + ObjectGuid talbotGUID; + ObjectGuid leryssaGUID; + ObjectGuid arlosGUID; bool arthasInPosition; bool arlosInPosition; @@ -883,10 +882,10 @@ public: me->RestoreFaction(); me->RemoveStandFlags(UNIT_STAND_STATE_SIT); - arthasGUID = 0; - talbotGUID = 0; - leryssaGUID = 0; - arlosGUID = 0; + arthasGUID.Clear(); + talbotGUID.Clear(); + leryssaGUID.Clear(); + arlosGUID.Clear(); arthasInPosition = false; arlosInPosition = false; @@ -1242,8 +1241,8 @@ public: { npc_counselor_talbotAI(Creature* creature) : ScriptedAI(creature) { } - uint64 leryssaGUID; - uint64 arlosGUID; + ObjectGuid leryssaGUID; + ObjectGuid arlosGUID; bool bCheck; @@ -1253,8 +1252,8 @@ public: void Reset() override { - leryssaGUID = 0; - arlosGUID = 0; + leryssaGUID.Clear(); + arlosGUID.Clear(); bCheck = false; shadowBoltTimer = urand(5000, 12000); deflectionTimer = urand(20000, 25000); @@ -1609,15 +1608,11 @@ public: void SpellHit(Unit* unit, const SpellInfo* spell) override { if (spell->Id == SPELL_NEURAL_NEEDLE && unit->GetTypeId() == TYPEID_PLAYER) - { if (Player* player = unit->ToPlayer()) - { GotStinged(player->GetGUID()); - } - } } - void GotStinged(uint64 casterGUID) + void GotStinged(ObjectGuid casterGUID) { if (Player* caster = ObjectAccessor::GetPlayer(*me, casterGUID)) { @@ -1644,7 +1639,7 @@ public: break; case 7: Talk(SAY_IMPRISIONED_BERYL_7); - caster->KilledMonsterCredit(NPC_IMPRISONED_BERYL_SORCERER, 0); + caster->KilledMonsterCredit(NPC_IMPRISONED_BERYL_SORCERER); break; } } @@ -1980,7 +1975,7 @@ public: { Quest const* qInfo = sObjectMgr->GetQuestTemplate(QUEST_YOU_RE_NOT_SO_BIG_NOW); if (qInfo) - player->KilledMonsterCredit(qInfo->RequiredNpcOrGo[0], 0); + player->KilledMonsterCredit(qInfo->RequiredNpcOrGo[0]); } } }; @@ -2195,7 +2190,7 @@ public: uint32 uiEventTimer; uint8 uiEventPhase; - uint64 uiPlayerGUID; + ObjectGuid uiPlayerGUID; void Reset() override { @@ -2208,7 +2203,7 @@ public: uiEventTimer = 0; uiEventPhase = 0; - uiPlayerGUID = 0; + uiPlayerGUID.Clear(); DoCast(SPELL_SHROUD_OF_THE_DEATH_CULTIST); @@ -2225,7 +2220,7 @@ public: uiEventPhase = 1; } - void SetGUID(uint64 uiGuid, int32 /*iId*/) override + void SetGUID(ObjectGuid uiGuid, int32 /*iId*/) override { uiPlayerGUID = uiGuid; } diff --git a/src/server/scripts/Northrend/zone_crystalsong_forest.cpp b/src/server/scripts/Northrend/zone_crystalsong_forest.cpp index 7d680ecd071..9cad60f8766 100644 --- a/src/server/scripts/Northrend/zone_crystalsong_forest.cpp +++ b/src/server/scripts/Northrend/zone_crystalsong_forest.cpp @@ -56,11 +56,11 @@ public: SetCombatMovement(false); } - uint64 targetGUID; + ObjectGuid targetGUID; void Reset() override { - targetGUID = 0; + targetGUID.Clear(); } void UpdateAI(uint32 /*diff*/) override diff --git a/src/server/scripts/Northrend/zone_dragonblight.cpp b/src/server/scripts/Northrend/zone_dragonblight.cpp index 80e496a6e13..68c0ce3acc4 100644 --- a/src/server/scripts/Northrend/zone_dragonblight.cpp +++ b/src/server/scripts/Northrend/zone_dragonblight.cpp @@ -158,8 +158,12 @@ class npc_commander_eligor_dawnbringer : public CreatureScript void Reset() override { talkWing = 0; - memset(audienceList, 0, sizeof(audienceList)); - memset(imageList, 0, sizeof(imageList)); + for (ObjectGuid& guid : audienceList) + guid.Clear(); + + for (ObjectGuid& guid : imageList) + guid.Clear(); + _events.ScheduleEvent(EVENT_GET_TARGETS, 5000); _events.ScheduleEvent(EVENT_START_RANDOM, 20000); } @@ -351,8 +355,8 @@ class npc_commander_eligor_dawnbringer : public CreatureScript } private: EventMap _events; - uint64 audienceList[10]; - uint64 imageList[5]; + ObjectGuid audienceList[10]; + ObjectGuid imageList[5]; uint8 talkWing; }; @@ -652,13 +656,12 @@ class npc_torturer_lecraft : public CreatureScript npc_torturer_lecraftAI(Creature* creature) : ScriptedAI(creature) { _textCounter = 1; - _playerGUID = 0; } void Reset() override { _textCounter = 1; - _playerGUID = 0; + _playerGUID.Clear(); } void EnterCombat(Unit* who) override @@ -686,7 +689,7 @@ class npc_torturer_lecraft : public CreatureScript Talk(_textCounter, player); if (_textCounter == 5) - player->KilledMonsterCredit(NPC_TORTURER_LECRAFT, 0); + player->KilledMonsterCredit(NPC_TORTURER_LECRAFT); ++_textCounter; @@ -723,7 +726,7 @@ class npc_torturer_lecraft : public CreatureScript private: EventMap _events; uint8 _textCounter; - uint64 _playerGUID; + ObjectGuid _playerGUID; }; CreatureAI* GetAI(Creature* creature) const diff --git a/src/server/scripts/Northrend/zone_grizzly_hills.cpp b/src/server/scripts/Northrend/zone_grizzly_hills.cpp index 6d41a2e9b21..e06bf32d7d8 100644 --- a/src/server/scripts/Northrend/zone_grizzly_hills.cpp +++ b/src/server/scripts/Northrend/zone_grizzly_hills.cpp @@ -116,7 +116,7 @@ public: case 19: if (Creature* Mrfloppy = ObjectAccessor::GetCreature(*me, _mrfloppyGUID)) { - if (Mrfloppy->HasAura(SPELL_MRFLOPPY, 0)) + if (Mrfloppy->HasAura(SPELL_MRFLOPPY)) { if (Creature* RWORG = ObjectAccessor::GetCreature(*me, _RavenousworgGUID)) Mrfloppy->EnterVehicle(RWORG); @@ -180,13 +180,13 @@ public: void Reset() override { - _mrfloppyGUID = 0; - _RavenousworgGUID = 0; + _mrfloppyGUID.Clear(); + _RavenousworgGUID.Clear(); } private: - uint64 _RavenousworgGUID; - uint64 _mrfloppyGUID; + ObjectGuid _RavenousworgGUID; + ObjectGuid _mrfloppyGUID; }; bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) override @@ -542,7 +542,7 @@ public: void Reset() override { - _playerGUID = 0; + _playerGUID.Clear(); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); me->SetReactState(REACT_AGGRESSIVE); @@ -604,7 +604,7 @@ public: private: EventMap _events; - uint64 _playerGUID; + ObjectGuid _playerGUID; }; CreatureAI* GetAI(Creature* creature) const override diff --git a/src/server/scripts/Northrend/zone_howling_fjord.cpp b/src/server/scripts/Northrend/zone_howling_fjord.cpp index 96fdcbfe990..53dc2a62f90 100644 --- a/src/server/scripts/Northrend/zone_howling_fjord.cpp +++ b/src/server/scripts/Northrend/zone_howling_fjord.cpp @@ -179,7 +179,7 @@ public: void Reset() override { - uint64 summonerGUID = 0; + ObjectGuid summonerGUID; if (me->IsSummon()) if (Unit* summoner = me->ToTempSummon()->GetSummoner()) @@ -321,15 +321,15 @@ public: npc_daegarnAI(Creature* creature) : ScriptedAI(creature) { } bool bEventInProgress; - uint64 uiPlayerGUID; + ObjectGuid uiPlayerGUID; void Reset() override { bEventInProgress = false; - uiPlayerGUID = 0; + uiPlayerGUID.Clear(); } - void StartEvent(uint64 uiGUID) + void StartEvent(ObjectGuid uiGUID) { if (bEventInProgress) return; diff --git a/src/server/scripts/Northrend/zone_icecrown.cpp b/src/server/scripts/Northrend/zone_icecrown.cpp index 32b9805470e..a43df0dc3f0 100644 --- a/src/server/scripts/Northrend/zone_icecrown.cpp +++ b/src/server/scripts/Northrend/zone_icecrown.cpp @@ -234,7 +234,7 @@ public: { if (who->HasAura(SPELL_SUBDUED_LITHE_STALKER)) { - owner->ToPlayer()->KilledMonsterCredit(NPC_GEIST_RETURN_BUNNY_KC, 0); + owner->ToPlayer()->KilledMonsterCredit(NPC_GEIST_RETURN_BUNNY_KC); who->ToCreature()->DisappearAndDie(); } @@ -505,7 +505,6 @@ public: { HalofSpawned = false; PhaseCount = 0; - Summons.DespawnAll(); SetCombatMovement(false); } @@ -518,10 +517,10 @@ public: SummonList Summons; - uint64 guidDalfors; - uint64 guidPriest[3]; - uint64 guidMason[3]; - uint64 guidHalof; + ObjectGuid guidDalfors; + ObjectGuid guidPriest[3]; + ObjectGuid guidMason[3]; + ObjectGuid guidHalof; void Reset() override { @@ -912,7 +911,7 @@ class npc_margrave_dhakar : public CreatureScript struct npc_margrave_dhakarAI : public ScriptedAI { - npc_margrave_dhakarAI(Creature* creature) : ScriptedAI(creature) , _summons(me), _lichKingGuid(0) { } + npc_margrave_dhakarAI(Creature* creature) : ScriptedAI(creature) , _summons(me) { } void Reset() override { @@ -1026,7 +1025,7 @@ class npc_margrave_dhakar : public CreatureScript private: EventMap _events; SummonList _summons; - uint64 _lichKingGuid; + ObjectGuid _lichKingGuid; }; CreatureAI* GetAI(Creature* creature) const override diff --git a/src/server/scripts/Northrend/zone_sholazar_basin.cpp b/src/server/scripts/Northrend/zone_sholazar_basin.cpp index 3f35fc0e172..53fe1500624 100644 --- a/src/server/scripts/Northrend/zone_sholazar_basin.cpp +++ b/src/server/scripts/Northrend/zone_sholazar_basin.cpp @@ -374,8 +374,8 @@ public: sayStep = 0; timer = 0; phase = 0; - playerGUID = 0; - orphanGUID = 0; + playerGUID.Clear(); + orphanGUID.Clear(); } void MoveInLineOfSight(Unit* who) override @@ -489,7 +489,7 @@ public: if (itr->second.CreatureOrGOCount[i] != 0) continue; - player->KilledMonsterCredit(me->GetEntry(), 0); + player->KilledMonsterCredit(me->GetEntry()); player->Say(SAY_OFFER, LANG_UNIVERSAL); sayStep = 1; break; @@ -501,8 +501,8 @@ public: uint8 sayStep; uint32 timer; int8 phase; - uint64 playerGUID; - uint64 orphanGUID; + ObjectGuid playerGUID; + ObjectGuid orphanGUID; }; CreatureAI* GetAI(Creature* creature) const override @@ -783,7 +783,7 @@ public: apple->CastSpell(apple, SPELL_APPLE_FALL); wilhelm->AI()->Talk(SAY_WILHELM_HIT); if (Player* player = shooter->ToPlayer()) - player->KilledMonsterCredit(NPC_APPLE, 0); + player->KilledMonsterCredit(NPC_APPLE); apple->DespawnOrUnsummon(); break; diff --git a/src/server/scripts/Northrend/zone_storm_peaks.cpp b/src/server/scripts/Northrend/zone_storm_peaks.cpp index cfee2e0f187..a183d0997d4 100644 --- a/src/server/scripts/Northrend/zone_storm_peaks.cpp +++ b/src/server/scripts/Northrend/zone_storm_peaks.cpp @@ -454,17 +454,16 @@ public: { npc_brann_bronzebeard_keystoneAI(Creature* creature) : ScriptedAI(creature) { - memset(&objectGUID, 0, sizeof(objectGUID)); - playerGUID = 0; - voiceGUID = 0; objectCounter = 0; } void Reset() override { - memset(&objectGUID, 0, sizeof(objectGUID)); - playerGUID = 0; - voiceGUID = 0; + for (ObjectGuid& guid : objectGUID) + guid.Clear(); + + playerGUID.Clear(); + voiceGUID.Clear(); objectCounter = 0; } @@ -583,9 +582,9 @@ public: private: EventMap events; - uint64 playerGUID; - uint64 objectGUID[5]; - uint64 voiceGUID; + ObjectGuid playerGUID; + ObjectGuid objectGUID[5]; + ObjectGuid voiceGUID; uint8 objectCounter; }; @@ -643,13 +642,12 @@ public: { npc_king_jokkum_vehicleAI(Creature* creature) : VehicleAI(creature) { - playerGUID = 0; pathEnd = false; } void Reset() override { - playerGUID = 0; + playerGUID.Clear(); pathEnd = false; } @@ -715,7 +713,7 @@ public: private: EventMap events; - uint64 playerGUID; + ObjectGuid playerGUID; bool pathEnd; }; diff --git a/src/server/scripts/Northrend/zone_zuldrak.cpp b/src/server/scripts/Northrend/zone_zuldrak.cpp index 2e75b10c0e8..44f559bfa79 100644 --- a/src/server/scripts/Northrend/zone_zuldrak.cpp +++ b/src/server/scripts/Northrend/zone_zuldrak.cpp @@ -51,7 +51,7 @@ public: void Reset() override { - _rageclawGUID = 0; + _rageclawGUID.Clear(); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); float x, y, z; @@ -104,7 +104,7 @@ public: } private: - uint64 _rageclawGUID; + ObjectGuid _rageclawGUID; }; CreatureAI* GetAI(Creature* creature) const override @@ -455,13 +455,12 @@ public: { npc_alchemist_finklesteinAI(Creature* creature) : ScriptedAI(creature) { - _playerGUID = 0; _getingredienttry = 0; } void Reset() override { - _playerGUID = 0; + _playerGUID.Clear(); _getingredienttry = 0; _events.ScheduleEvent(EVENT_TURN_TO_POT, urand(15000, 26000)); } @@ -556,7 +555,7 @@ public: private: EventMap _events; - uint64 _playerGUID; + ObjectGuid _playerGUID; uint8 _getingredienttry; }; diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp index 4fb84fa0759..4431a924ac6 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp @@ -85,7 +85,7 @@ void OPvPCapturePointEP_EWT::ChangeState() // complete quest objective if (m_TowerState == EP_TS_A || m_TowerState == EP_TS_H) - SendObjectiveComplete(EP_EWT_CM, 0); + SendObjectiveComplete(EP_EWT_CM, ObjectGuid::Empty); } void OPvPCapturePointEP_EWT::FillInitialWorldStates(WorldPacket &data) @@ -195,7 +195,7 @@ void OPvPCapturePointEP_NPT::ChangeState() // complete quest objective if (m_TowerState == EP_TS_A || m_TowerState == EP_TS_H) - SendObjectiveComplete(EP_NPT_CM, 0); + SendObjectiveComplete(EP_NPT_CM, ObjectGuid::Empty); } void OPvPCapturePointEP_NPT::FillInitialWorldStates(WorldPacket &data) @@ -289,7 +289,7 @@ void OPvPCapturePointEP_CGT::ChangeState() // complete quest objective if (m_TowerState == EP_TS_A || m_TowerState == EP_TS_H) - SendObjectiveComplete(EP_CGT_CM, 0); + SendObjectiveComplete(EP_CGT_CM, ObjectGuid::Empty); } void OPvPCapturePointEP_CGT::FillInitialWorldStates(WorldPacket &data) @@ -390,7 +390,7 @@ void OPvPCapturePointEP_PWT::ChangeState() // complete quest objective if (m_TowerState == EP_TS_A || m_TowerState == EP_TS_H) - SendObjectiveComplete(EP_PWT_CM, 0); + SendObjectiveComplete(EP_PWT_CM, ObjectGuid::Empty); } void OPvPCapturePointEP_PWT::FillInitialWorldStates(WorldPacket &data) @@ -537,7 +537,7 @@ void OutdoorPvPEP::HandlePlayerLeaveZone(Player* player, uint32 zone) void OutdoorPvPEP::BuffTeams() { - for (PlayerSet::iterator itr = m_players[0].begin(); itr != m_players[0].end(); ++itr) + for (GuidSet::iterator itr = m_players[0].begin(); itr != m_players[0].end(); ++itr) { if (Player* player = ObjectAccessor::FindPlayer(*itr)) { @@ -547,7 +547,7 @@ void OutdoorPvPEP::BuffTeams() player->CastSpell(player, EP_AllianceBuffs[m_AllianceTowersControlled-1], true); } } - for (PlayerSet::iterator itr = m_players[1].begin(); itr != m_players[1].end(); ++itr) + for (GuidSet::iterator itr = m_players[1].begin(); itr != m_players[1].end(); ++itr) { if (Player* player = ObjectAccessor::FindPlayer(*itr)) { diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp index b3492b8334b..252a2cc8e85 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp @@ -255,7 +255,7 @@ void OPvPCapturePointHP::ChangeState() // complete quest objective if (m_State == OBJECTIVESTATE_ALLIANCE || m_State == OBJECTIVESTATE_HORDE) - SendObjectiveComplete(HP_CREDITMARKER[m_TowerType], 0); + SendObjectiveComplete(HP_CREDITMARKER[m_TowerType], ObjectGuid::Empty); } void OPvPCapturePointHP::FillInitialWorldStates(WorldPacket &data) diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp index 1b4828dec51..b16ced348ec 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp @@ -32,7 +32,7 @@ void OutdoorPvPNA::HandleKillImpl(Player* player, Unit* killed) { if (killed->GetTypeId() == TYPEID_PLAYER && player->GetTeam() != killed->ToPlayer()->GetTeam()) { - player->KilledMonsterCredit(NA_CREDIT_MARKER, 0); // 0 guid, btw it isn't even used in killedmonster function :S + player->KilledMonsterCredit(NA_CREDIT_MARKER); // 0 guid, btw it isn't even used in killedmonster function :S if (player->GetTeam() == ALLIANCE) player->CastSpell(player, NA_KILL_TOKEN_ALLIANCE, true); else @@ -43,7 +43,7 @@ void OutdoorPvPNA::HandleKillImpl(Player* player, Unit* killed) uint32 OPvPCapturePointNA::GetAliveGuardsCount() { uint32 cnt = 0; - for (std::map<uint32, uint64>::iterator itr = m_Creatures.begin(); itr != m_Creatures.end(); ++itr) + for (std::map<uint32, ObjectGuid>::iterator itr = m_Creatures.begin(); itr != m_Creatures.end(); ++itr) { switch (itr->first) { @@ -372,7 +372,7 @@ bool OPvPCapturePointNA::HandleCustomSpell(Player* player, uint32 spellId, GameO return false; } -int32 OPvPCapturePointNA::HandleOpenGo(Player* player, uint64 guid) +int32 OPvPCapturePointNA::HandleOpenGo(Player* player, ObjectGuid guid) { int32 retval = OPvPCapturePoint::HandleOpenGo(player, guid); if (retval >= 0) diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h index aa52c8135e7..8d327da4b0f 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h @@ -269,7 +269,7 @@ class OPvPCapturePointNA : public OPvPCapturePoint bool HandleCustomSpell(Player* player, uint32 spellId, GameObject* go); - int32 HandleOpenGo(Player* player, uint64 guid); + int32 HandleOpenGo(Player* player, ObjectGuid guid) override; uint32 GetAliveGuardsCount(); uint32 GetControllingFaction() const; diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp index 539f54ab421..cb4a7aebc3d 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp @@ -109,7 +109,7 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 trigger) // add 20 cenarion circle repu player->GetReputationMgr().ModifyReputation(sFactionStore.LookupEntry(609), 20); // complete quest - player->KilledMonsterCredit(SI_TURNIN_QUEST_CM_A, 0); + player->KilledMonsterCredit(SI_TURNIN_QUEST_CM_A); } return true; case SI_AREATRIGGER_H: @@ -135,7 +135,7 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 trigger) // add 20 cenarion circle repu player->GetReputationMgr().ModifyReputation(sFactionStore.LookupEntry(609), 20); // complete quest - player->KilledMonsterCredit(SI_TURNIN_QUEST_CM_H, 0); + player->KilledMonsterCredit(SI_TURNIN_QUEST_CM_H); } return true; } diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp index e089dfdb7d5..476abe012ce 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp @@ -281,7 +281,7 @@ void OPvPCapturePointTF::ChangeState() m_PvP->SendDefenseMessage(OutdoorPvPTFBuffZones[0], TEXT_SPIRIT_TOWER_TAKEN_ALLIANCE); - for (PlayerSet::iterator itr = m_activePlayers[0].begin(); itr != m_activePlayers[0].end(); ++itr) + for (GuidSet::iterator itr = m_activePlayers[0].begin(); itr != m_activePlayers[0].end(); ++itr) if (Player* player = ObjectAccessor::FindPlayer(*itr)) player->AreaExploredOrEventHappens(TF_ALLY_QUEST); break; @@ -296,7 +296,7 @@ void OPvPCapturePointTF::ChangeState() m_PvP->SendDefenseMessage(OutdoorPvPTFBuffZones[0], TEXT_SPIRIT_TOWER_TAKEN_HORDE); - for (PlayerSet::iterator itr = m_activePlayers[1].begin(); itr != m_activePlayers[1].end(); ++itr) + for (GuidSet::iterator itr = m_activePlayers[1].begin(); itr != m_activePlayers[1].end(); ++itr) if (Player* player = ObjectAccessor::FindPlayer(*itr)) player->AreaExploredOrEventHappens(TF_HORDE_QUEST); break; diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp index d6ee91ff2a9..89012b56b82 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp @@ -181,7 +181,7 @@ bool OPvPCapturePointZM_GraveYard::Update(uint32 /*diff*/) return retval; } -int32 OPvPCapturePointZM_GraveYard::HandleOpenGo(Player* player, uint64 guid) +int32 OPvPCapturePointZM_GraveYard::HandleOpenGo(Player* player, ObjectGuid guid) { int32 retval = OPvPCapturePoint::HandleOpenGo(player, guid); if (retval >= 0) @@ -218,7 +218,7 @@ OPvPCapturePointZM_GraveYard::OPvPCapturePointZM_GraveYard(OutdoorPvP* pvp) { m_BothControllingFaction = 0; m_GraveYardState = ZM_GRAVEYARD_N; - m_FlagCarrierGUID = 0; + m_FlagCarrierGUID.Clear(); // add field scouts here AddCreature(ZM_ALLIANCE_FIELD_SCOUT, ZM_AllianceFieldScout.entry, ZM_AllianceFieldScout.map, ZM_AllianceFieldScout.x, ZM_AllianceFieldScout.y, ZM_AllianceFieldScout.z, ZM_AllianceFieldScout.o); AddCreature(ZM_HORDE_FIELD_SCOUT, ZM_HordeFieldScout.entry, ZM_HordeFieldScout.map, ZM_HordeFieldScout.x, ZM_HordeFieldScout.y, ZM_HordeFieldScout.z, ZM_HordeFieldScout.o); @@ -286,7 +286,7 @@ void OPvPCapturePointZM_GraveYard::SetBeaconState(uint32 controlling_faction) p->RemoveAurasDueToSpell(ZM_BATTLE_STANDARD_A); p->RemoveAurasDueToSpell(ZM_BATTLE_STANDARD_H); } - m_FlagCarrierGUID = 0; + m_FlagCarrierGUID.Clear(); } } break; @@ -297,8 +297,8 @@ void OPvPCapturePointZM_GraveYard::SetBeaconState(uint32 controlling_faction) bool OPvPCapturePointZM_GraveYard::CanTalkTo(Player* player, Creature* c, GossipMenuItems const& /*gso*/) { - uint64 guid = c->GetGUID(); - std::map<uint64, uint32>::iterator itr = m_CreatureTypes.find(guid); + ObjectGuid guid = c->GetGUID(); + std::map<ObjectGuid, uint32>::iterator itr = m_CreatureTypes.find(guid); if (itr != m_CreatureTypes.end()) { if (itr->second == ZM_ALLIANCE_FIELD_SCOUT && player->GetTeam() == ALLIANCE && m_BothControllingFaction == ALLIANCE && !m_FlagCarrierGUID && m_GraveYardState != ZM_GRAVEYARD_A) @@ -309,9 +309,9 @@ bool OPvPCapturePointZM_GraveYard::CanTalkTo(Player* player, Creature* c, Gossip return false; } -bool OPvPCapturePointZM_GraveYard::HandleGossipOption(Player* player, uint64 guid, uint32 /*gossipid*/) +bool OPvPCapturePointZM_GraveYard::HandleGossipOption(Player* player, ObjectGuid guid, uint32 /*gossipid*/) { - std::map<uint64, uint32>::iterator itr = m_CreatureTypes.find(guid); + std::map<ObjectGuid, uint32>::iterator itr = m_CreatureTypes.find(guid); if (itr != m_CreatureTypes.end()) { Creature* cr = HashMapHolder<Creature>::Find(guid); @@ -342,10 +342,10 @@ bool OPvPCapturePointZM_GraveYard::HandleDropFlag(Player* /*player*/, uint32 spe switch (spellId) { case ZM_BATTLE_STANDARD_A: - m_FlagCarrierGUID = 0; + m_FlagCarrierGUID.Clear(); return true; case ZM_BATTLE_STANDARD_H: - m_FlagCarrierGUID = 0; + m_FlagCarrierGUID.Clear(); return true; } return false; diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h index eef1ff9cc3b..5910a88f476 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h @@ -192,11 +192,11 @@ class OPvPCapturePointZM_GraveYard : public OPvPCapturePoint void UpdateTowerState(); - int32 HandleOpenGo(Player* player, uint64 guid); + int32 HandleOpenGo(Player* player, ObjectGuid guid) override; void SetBeaconState(uint32 controlling_team); // not good atm - bool HandleGossipOption(Player* player, uint64 guid, uint32 gossipid); + bool HandleGossipOption(Player* player, ObjectGuid guid, uint32 gossipid); bool HandleDropFlag(Player* player, uint32 spellId); @@ -210,7 +210,7 @@ class OPvPCapturePointZM_GraveYard : public OPvPCapturePoint protected: uint32 m_BothControllingFaction; - uint64 m_FlagCarrierGUID; + ObjectGuid m_FlagCarrierGUID; }; class OutdoorPvPZM : public OutdoorPvP diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp index 7ba0a452941..1cfd7a23f39 100644 --- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp +++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp @@ -174,7 +174,7 @@ public: } uint32 soulmodel; - uint64 soulholder; + ObjectGuid soulholder; uint8 soulclass; uint32 Fear_timer; @@ -187,7 +187,7 @@ public: void Reset() override { soulmodel = 0; - soulholder = 0; + soulholder.Clear(); soulclass = 0; Fear_timer = 15000 + rand32() % 5000; diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp index 683b253d8a1..9a94096c2de 100644 --- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp +++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp @@ -69,7 +69,7 @@ public: uint32 Carnivorousbite_Timer; uint32 FocusFire_Timer; - uint64 FocusedTargetGUID; + ObjectGuid FocusedTargetGUID; void Reset() override { @@ -77,7 +77,7 @@ public: Attractmagic_Timer = 28000; Carnivorousbite_Timer = 10000; FocusFire_Timer = 17000; - FocusedTargetGUID = 0; + FocusedTargetGUID.Clear(); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp index a48f5245273..6ff92bcdb0b 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp @@ -115,7 +115,7 @@ class boss_ambassador_hellmaw : public CreatureScript me->RemoveAurasDueToSpell(SPELL_BANISH); Talk(SAY_INTRO); - Start(true, false, 0, NULL, false, true); + Start(true, false, ObjectGuid::Empty, NULL, false, true); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp index 905fe67af97..b3aac6becc4 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp @@ -238,7 +238,7 @@ class npc_voidtraveler : public CreatureScript { if (_moveTimer <= diff) { - Creature* Vorpil = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_GRANDMASTER_VORPIL)); + Creature* Vorpil = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_GRANDMASTER_VORPIL)); if (!Vorpil) return; diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp index 9bd985130a9..6fea892abea 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp @@ -40,8 +40,6 @@ class instance_shadow_labyrinth : public InstanceMapScript SetBossNumber(EncounterCount); LoadDoorData(doorData); - AmbassadorHellmawGUID = 0; - GrandmasterVorpilGUID = 0; FelOverseerCount = 0; } @@ -123,7 +121,7 @@ class instance_shadow_labyrinth : public InstanceMapScript return 0; } - uint64 GetData64(uint32 type) const override + ObjectGuid GetGuidData(uint32 type) const override { switch (type) { @@ -132,12 +130,12 @@ class instance_shadow_labyrinth : public InstanceMapScript default: break; } - return 0; + return ObjectGuid::Empty; } protected: - uint64 AmbassadorHellmawGUID; - uint64 GrandmasterVorpilGUID; + ObjectGuid AmbassadorHellmawGUID; + ObjectGuid GrandmasterVorpilGUID; uint32 FelOverseerCount; }; diff --git a/src/server/scripts/Outland/BlackTemple/black_temple.cpp b/src/server/scripts/Outland/BlackTemple/black_temple.cpp index 3a33561e998..5302aa34a29 100644 --- a/src/server/scripts/Outland/BlackTemple/black_temple.cpp +++ b/src/server/scripts/Outland/BlackTemple/black_temple.cpp @@ -156,11 +156,11 @@ public: } case EVENT_SET_CHANNELERS: { - for (uint64 guid : _bloodmageList) + for (ObjectGuid guid : _bloodmageList) if (Creature* bloodmage = ObjectAccessor::GetCreature(*me, guid)) bloodmage->CastSpell((Unit*)NULL, SPELL_SUMMON_CHANNEL); - for (uint64 guid : _deathshaperList) + for (ObjectGuid guid : _deathshaperList) if (Creature* deathshaper = ObjectAccessor::GetCreature(*me, guid)) deathshaper->CastSpell((Unit*)NULL, SPELL_SUMMON_CHANNEL); @@ -202,8 +202,8 @@ public: private: InstanceScript* _instance; EventMap _events; - std::list<uint64> _bloodmageList; - std::list<uint64> _deathshaperList; + GuidList _bloodmageList; + GuidList _deathshaperList; bool _enteredCombat; }; diff --git a/src/server/scripts/Outland/BlackTemple/boss_gurtogg_bloodboil.cpp b/src/server/scripts/Outland/BlackTemple/boss_gurtogg_bloodboil.cpp index f03caa37cb2..b41e7e77452 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_gurtogg_bloodboil.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_gurtogg_bloodboil.cpp @@ -73,7 +73,7 @@ public: InstanceScript* instance; - uint64 TargetGUID; + ObjectGuid TargetGUID; float TargetThreat; @@ -94,7 +94,7 @@ public: { instance->SetBossState(DATA_GURTOGG_BLOODBOIL, NOT_STARTED); - TargetGUID = 0; + TargetGUID.Clear(); TargetThreat = 0; @@ -134,7 +134,7 @@ public: Talk(SAY_DEATH); } - void RevertThreatOnTarget(uint64 guid) + void RevertThreatOnTarget(ObjectGuid guid) { if (Unit* unit = ObjectAccessor::GetUnit(*me, guid)) { @@ -258,7 +258,7 @@ public: { if (TargetGUID) RevertThreatOnTarget(TargetGUID); - TargetGUID = 0; + TargetGUID.Clear(); Phase1 = true; BloodboilTimer = 10000; BloodboilCount = 0; diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp index 22cd886d99b..4ec6aed9655 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp @@ -381,7 +381,7 @@ public: { FlameBlastTimer = 15000; CheckTimer = 5000; - GlaiveGUID = 0; + GlaiveGUID.Clear(); } void EnterCombat(Unit* /*who*/) override @@ -424,7 +424,7 @@ public: } } - void SetGlaiveGUID(uint64 guid) + void SetGlaiveGUID(ObjectGuid guid) { GlaiveGUID = guid; } @@ -455,7 +455,7 @@ public: private: uint32 FlameBlastTimer; uint32 CheckTimer; - uint64 GlaiveGUID; + ObjectGuid GlaiveGUID; }; CreatureAI* GetAI(Creature* creature) const override @@ -476,7 +476,6 @@ public: { instance = creature->GetInstanceScript(); DoCast(me, SPELL_DUAL_WIELD, true); - AkamaGUID = 0; } void Reset() override; @@ -489,7 +488,7 @@ public: { for (uint8 i = 0; i < 2; ++i) if (summon->GetGUID() == FlameGUID[i]) - FlameGUID[i] = 0; + FlameGUID[i].Clear(); if (!FlameGUID[0] && !FlameGUID[1] && Phase != PHASE_ILLIDAN_NULL) { @@ -542,7 +541,7 @@ public: instance->SetBossState(DATA_ILLIDAN_STORMRAGE, DONE); for (uint8 i = DATA_GO_ILLIDAN_DOOR_R; i < DATA_GO_ILLIDAN_DOOR_L + 1; ++i) - instance->HandleGameObject(instance->GetData64(i), true); + instance->HandleGameObject(instance->GetGuidData(i), true); } void KilledUnit(Unit* victim) override @@ -573,7 +572,7 @@ public: } } - void DeleteFromThreatList(uint64 TargetGUID) + void DeleteFromThreatList(ObjectGuid TargetGUID) { ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList(); for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) @@ -849,7 +848,7 @@ public: if (Creature* glaive = ObjectAccessor::GetCreature(*me, GlaiveGUID[i])) glaive->DespawnOrUnsummon(); - GlaiveGUID[i] = 0; + GlaiveGUID[i].Clear(); } } Timer[EVENT_FLIGHT_SEQUENCE] = 2000; @@ -1102,7 +1101,7 @@ public: } public: - uint64 AkamaGUID; + ObjectGuid AkamaGUID; uint32 Timer[EVENT_ENRAGE + 1]; PhaseIllidan Phase; private: @@ -1112,9 +1111,9 @@ public: uint32 TransformCount; uint32 FlightCount; uint32 HoverPoint; - uint64 MaievGUID; - uint64 FlameGUID[2]; - uint64 GlaiveGUID[2]; + ObjectGuid MaievGUID; + ObjectGuid FlameGUID[2]; + ObjectGuid GlaiveGUID[2]; SummonList Summons; }; @@ -1140,7 +1139,7 @@ public: { MaxTimer = 0; Phase = PHASE_NORMAL_MAIEV; - IllidanGUID = 0; + IllidanGUID.Clear(); Timer[EVENT_MAIEV_STEALTH] = 0; Timer[EVENT_MAIEV_TAUNT] = urand(22, 43) * 1000; Timer[EVENT_MAIEV_SHADOW_STRIKE] = 30000; @@ -1153,7 +1152,7 @@ public: void EnterEvadeMode() override { } - void GetIllidanGUID(uint64 guid) + void GetIllidanGUID(ObjectGuid guid) { IllidanGUID = guid; } @@ -1333,7 +1332,7 @@ public: } private: - uint64 IllidanGUID; + ObjectGuid IllidanGUID; PhaseIllidan Phase; EventMaiev Event; uint32 Timer[5]; @@ -1364,10 +1363,10 @@ public: WalkCount = 0; instance->SetBossState(DATA_ILLIDAN_STORMRAGE, NOT_STARTED); - IllidanGUID = instance->GetData64(DATA_ILLIDAN_STORMRAGE); - GateGUID = instance->GetData64(DATA_GO_ILLIDAN_GATE); - DoorGUID[0] = instance->GetData64(DATA_GO_ILLIDAN_DOOR_R); - DoorGUID[1] = instance->GetData64(DATA_GO_ILLIDAN_DOOR_L); + IllidanGUID = instance->GetGuidData(DATA_ILLIDAN_STORMRAGE); + GateGUID = instance->GetGuidData(DATA_GO_ILLIDAN_GATE); + DoorGUID[0] = instance->GetGuidData(DATA_GO_ILLIDAN_DOOR_R); + DoorGUID[1] = instance->GetGuidData(DATA_GO_ILLIDAN_DOOR_L); if (JustCreated) // close all doors at create { @@ -1385,9 +1384,9 @@ public: instance->HandleGameObject(DoorGUID[i], true); } - ChannelGUID = 0; - SpiritGUID[0] = 0; - SpiritGUID[1] = 0; + ChannelGUID.Clear(); + SpiritGUID[0].Clear(); + SpiritGUID[1].Clear(); Phase = PHASE_AKAMA_NULL; Timer = 0; @@ -1758,11 +1757,11 @@ public: PhaseAkama Phase; bool Event; uint32 Timer; - uint64 IllidanGUID; - uint64 ChannelGUID; - uint64 SpiritGUID[2]; - uint64 GateGUID; - uint64 DoorGUID[2]; + ObjectGuid IllidanGUID; + ObjectGuid ChannelGUID; + ObjectGuid SpiritGUID[2]; + ObjectGuid GateGUID; + ObjectGuid DoorGUID[2]; uint32 ChannelCount; uint32 WalkCount; uint32 TalkCount; @@ -1787,11 +1786,11 @@ void boss_illidan_stormrage::boss_illidan_stormrageAI::Reset() akama->AI()->EnterEvadeMode(); } - MaievGUID = 0; + MaievGUID.Clear(); for (uint8 i = 0; i < 2; ++i) { - FlameGUID[i] = 0; - GlaiveGUID[i] = 0; + FlameGUID[i].Clear(); + GlaiveGUID[i].Clear(); } Phase = PHASE_ILLIDAN_NULL; @@ -1956,7 +1955,7 @@ public: void Reset() override { - IllidanGUID = 0; + IllidanGUID.Clear(); Active = false; SummonedBeams = false; @@ -1985,7 +1984,7 @@ public: DespawnTimer = 5000; if (who->HasAura(SPELL_ENRAGE)) who->RemoveAurasDueToSpell(SPELL_ENRAGE); // Dispel his enrage - // if (GameObject* CageTrap = instance->instance->GetGameObject(instance->GetData64(CageTrapGUID))) + // if (GameObject* CageTrap = instance->instance->GetGameObject(instance->GetGuidData(CageTrapGUID))) // CageTrap->SetLootState(GO_JUST_DEACTIVATED); } @@ -2014,7 +2013,7 @@ public: public: bool Active; private: - uint64 IllidanGUID; + ObjectGuid IllidanGUID; uint32 DespawnTimer; bool SummonedBeams; }; @@ -2059,7 +2058,7 @@ public: void Reset() override { - TargetGUID = 0; + TargetGUID.Clear(); DoCast(me, SPELL_SHADOW_DEMON_PASSIVE, true); } @@ -2090,7 +2089,7 @@ public: } private: - uint64 TargetGUID; + ObjectGuid TargetGUID; }; CreatureAI* GetAI(Creature* creature) const override @@ -2136,7 +2135,7 @@ public: void Reset() override { - IllidanGUID = instance->GetData64(DATA_ILLIDAN_STORMRAGE); + IllidanGUID = instance->GetGuidData(DATA_ILLIDAN_STORMRAGE); CheckTimer = 5000; DoCast(me, SPELL_SHADOWFIEND_PASSIVE, true); @@ -2195,7 +2194,7 @@ public: private: InstanceScript* instance; - uint64 IllidanGUID; + ObjectGuid IllidanGUID; uint32 CheckTimer; }; diff --git a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp index 60162188f7e..39aac706acc 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp @@ -112,8 +112,8 @@ public: void Initialize() { - for (uint8 i = 0; i<3; ++i) - TargetGUID[i] = 0; + for (uint8 i = 0; i < 3; ++i) + TargetGUID[i].Clear(); BeamCount = 0; CurrentBeam = SINISTER_BEAM; // 0 - Sinister, 1 - Vile, 2 - Wicked, 3 - Sinful @@ -236,7 +236,7 @@ public: { if (Unit* unit = ObjectAccessor::GetUnit(*me, TargetGUID[i])) unit->CastSpell(unit, SPELL_ATTRACTION, true); - TargetGUID[i] = 0; + TargetGUID[i].Clear(); } } ++ExplosionCount; @@ -267,7 +267,7 @@ public: } private: - uint64 TargetGUID[3]; + ObjectGuid TargetGUID[3]; uint32 BeamCount; uint32 CurrentBeam; uint32 ExplosionCount; diff --git a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp index f3c8af50328..c5989f4df64 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp @@ -113,9 +113,12 @@ public: { npc_enslaved_soulAI(Creature* creature) : ScriptedAI(creature) { } - uint64 ReliquaryGUID; + ObjectGuid ReliquaryGUID; - void Reset() override { ReliquaryGUID = 0; } + void Reset() override + { + ReliquaryGUID.Clear(); + } void EnterCombat(Unit* /*who*/) override { @@ -142,12 +145,11 @@ public: boss_reliquary_of_soulsAI(Creature* creature) : ScriptedAI(creature) { instance = creature->GetInstanceScript(); - EssenceGUID = 0; } InstanceScript* instance; - uint64 EssenceGUID; + ObjectGuid EssenceGUID; uint32 Phase; uint32 Counter; @@ -165,7 +167,7 @@ public: if (Creature* essence = ObjectAccessor::GetCreature(*me, EssenceGUID)) essence->DespawnOrUnsummon(); - EssenceGUID = 0; + EssenceGUID.Clear(); } Phase = 0; @@ -334,17 +336,15 @@ public: if (Essence) { if (Phase == 1) - { Essence->AI()->Talk(SUFF_SAY_AFTER); - } else - { Essence->AI()->Talk(DESI_SAY_AFTER); - } + Essence->DespawnOrUnsummon(); } + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); - EssenceGUID = 0; + EssenceGUID.Clear(); SoulCount = 0; SoulDeathCount = 0; Timer = 3000; @@ -624,7 +624,7 @@ public: { boss_essence_of_angerAI(Creature* creature) : ScriptedAI(creature) { } - uint64 AggroTargetGUID; + ObjectGuid AggroTargetGUID; uint32 CheckTankTimer; uint32 SoulScreamTimer; @@ -636,7 +636,7 @@ public: void Reset() override { - AggroTargetGUID = 0; + AggroTargetGUID.Clear(); CheckTankTimer = 5000; SoulScreamTimer = 10000; diff --git a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp index f1e170c0705..6b337e42087 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp @@ -175,11 +175,11 @@ public: { if (!HasKilledAkamaAndReseting) { - for (std::list<uint64>::const_iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr) + for (GuidList::const_iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr) if (Creature* Channeler = ObjectAccessor::GetCreature(*me, *itr)) Channeler->DespawnOrUnsummon(); - for (std::list<uint64>::const_iterator itr = Spawners.begin(); itr != Spawners.end(); ++itr) + for (GuidList::const_iterator itr = Spawners.begin(); itr != Spawners.end(); ++itr) if (Creature* Spawner = ObjectAccessor::GetCreature(*me, *itr)) Spawner->AI()->SetData(SETDATA_DATA, SETDATA_DESPAWN_ALL_SPAWNS); @@ -207,7 +207,7 @@ public: { if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) { - if (Creature* Akama = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_AKAMA_SHADE))) + if (Creature* Akama = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_AKAMA_SHADE))) if (Akama->IsAlive()) ScriptedAI::AttackStart(Akama); } @@ -231,7 +231,7 @@ public: events.ScheduleEvent(EVENT_START_ATTACK_AKAMA, 500); events.ScheduleEvent(EVENT_SET_CHANNELERS_SPAWNERS, 1000); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); - if (Creature* Akama = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_AKAMA_SHADE))) + if (Creature* Akama = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_AKAMA_SHADE))) me->AddThreat(Akama, 10000000.0f); } else if (spell->Id == SPELL_SHADE_SOUL_CHANNEL_2) @@ -267,7 +267,7 @@ public: switch (eventId) { case EVENT_RESET_ENCOUNTER: - if (Creature* Akama = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_AKAMA_SHADE))) + if (Creature* Akama = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_AKAMA_SHADE))) if (!Akama->IsAlive()) Akama->Respawn(); break; @@ -307,17 +307,13 @@ public: { case EVENT_SET_CHANNELERS_SPAWNERS: { - for (std::list<uint64>::const_iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr) - { + for (GuidList::const_iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr) if (Creature* Channeler = ObjectAccessor::GetCreature(*me, *itr)) Channeler->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } - for (std::list<uint64>::const_iterator itr = Spawners.begin(); itr != Spawners.end(); ++itr) - { + for (GuidList::const_iterator itr = Spawners.begin(); itr != Spawners.end(); ++itr) if (Creature* Spawner = ObjectAccessor::GetCreature(*me, *itr)) Spawner->AI()->SetData(SETDATA_DATA, SETDATA_START_SPAWNING); - } break; } case EVENT_START_ATTACK_AKAMA: @@ -347,14 +343,14 @@ public: me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); combatStarted = false; - if (Creature* Akama = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_AKAMA_SHADE))) + if (Creature* Akama = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_AKAMA_SHADE))) Akama->DespawnOrUnsummon(); - for (std::list<uint64>::const_iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr) + for (GuidList::const_iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr) if (Creature* Channeler = ObjectAccessor::GetCreature(*me, *itr)) Channeler->DespawnOrUnsummon(); - for (std::list<uint64>::const_iterator itr = Spawners.begin(); itr != Spawners.end(); ++itr) + for (GuidList::const_iterator itr = Spawners.begin(); itr != Spawners.end(); ++itr) if (Creature* Spawner = ObjectAccessor::GetCreature(*me, *itr)) Spawner->AI()->SetData(SETDATA_DATA, SETDATA_DESPAWN_ALL_SPAWNS); @@ -365,7 +361,7 @@ public: if (!akamaReached) { - if (Creature* Akama = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_AKAMA_SHADE))) + if (Creature* Akama = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_AKAMA_SHADE))) { if (me->IsWithinDist(Akama, 2.0f, false)) { @@ -379,7 +375,7 @@ public: events.CancelEvent(EVENT_START_ATTACK_AKAMA); events.ScheduleEvent(EVENT_ADD_THREAT, 100); - for (std::list<uint64>::const_iterator itr = Spawners.begin(); itr != Spawners.end(); ++itr) + for (GuidList::const_iterator itr = Spawners.begin(); itr != Spawners.end(); ++itr) if (Creature* Spawner = ObjectAccessor::GetCreature(*me, *itr)) Spawner->AI()->SetData(SETDATA_DATA, SETDATA_STOP_SPAWNING); } @@ -395,8 +391,8 @@ public: private: InstanceScript* instance; EventMap events; - std::list<uint64> Channelers; - std::list<uint64> Spawners; + GuidList Channelers; + GuidList Spawners; bool akamaReached; bool combatStarted; bool HasKilledAkamaAndReseting; @@ -437,7 +433,7 @@ public: void JustDied(Unit* /*killer*/) override { - if (Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADE_OF_AKAMA))) + if (Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SHADE_OF_AKAMA))) if (Shade->IsAlive()) ENSURE_AI(boss_shade_of_akama::boss_shade_of_akamaAI, Shade->AI())->HasKilledAkama = true; me->GetMotionMaster()->Clear(true); @@ -451,7 +447,7 @@ public: me->ClearUnitState(UNIT_STATE_ROOT); me->RemoveAura(SPELL_AKAMA_SOUL_CHANNEL); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); - if (Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADE_OF_AKAMA))) + if (Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SHADE_OF_AKAMA))) Shade->RemoveAura(SPELL_AKAMA_SOUL_CHANNEL); StartCombat = true; } @@ -577,7 +573,7 @@ public: void JustDied(Unit* /*killer*/) override { - if (Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADE_OF_AKAMA))) + if (Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SHADE_OF_AKAMA))) Shade->AI()->SetData(SETDATA_DATA, SETDATA_CHANNELER_DIED); } @@ -593,7 +589,7 @@ public: switch (eventId) { case EVENT_CHANNEL: - if (Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADE_OF_AKAMA))) + if (Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SHADE_OF_AKAMA))) { if (Shade->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) DoCast(me, SPELL_SHADE_SOUL_CHANNEL); @@ -751,26 +747,26 @@ public: { if (!startedBanishing) { - if (Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADE_OF_AKAMA))) + if (Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SHADE_OF_AKAMA))) { if (Shade->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) me->GetMotionMaster()->MovePoint(0, Shade->GetPositionX(), Shade->GetPositionY(), Shade->GetPositionZ(), false); else { - if (Unit* target = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_AKAMA_SHADE))) + if (Unit* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_AKAMA_SHADE))) AttackStart(target); } } } - summonerGuid = 0; + summonerGuid.Clear(); startedBanishing = false; switchToCombat = false; } void JustDied(Unit* /*killer*/) override { - if (Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADE_OF_AKAMA))) + if (Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SHADE_OF_AKAMA))) Shade->AI()->SetData(SETDATA_DATA, SETDATA_CHANNELER_DIED); me->DespawnOrUnsummon(5000); } @@ -799,7 +795,7 @@ public: switch (eventId) { case EVENT_SORCERER_CHANNEL: - if (Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADE_OF_AKAMA))) + if (Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SHADE_OF_AKAMA))) { if (Shade->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) { @@ -812,7 +808,7 @@ public: me->InterruptSpell(CURRENT_CHANNELED_SPELL); Shade->AI()->SetData(SETDATA_DATA, SETDATA_CHANNELER_DIED); switchToCombat = true; - if (Unit* target = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_AKAMA_SHADE))) + if (Unit* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_AKAMA_SHADE))) AttackStart(target); } } @@ -824,7 +820,7 @@ public: if (!startedBanishing) { - Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADE_OF_AKAMA)); + Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SHADE_OF_AKAMA)); if (me->IsWithinDist(Shade, 20.0f, false)) { me->StopMoving(); @@ -841,7 +837,7 @@ public: private: InstanceScript* instance; EventMap events; - uint64 summonerGuid; + ObjectGuid summonerGuid; bool startedBanishing; bool switchToCombat; }; @@ -870,9 +866,9 @@ public: void Reset() override { - summonerGuid = 0; + summonerGuid.Clear(); - if (Unit* target = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_AKAMA_SHADE))) + if (Unit* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_AKAMA_SHADE))) AttackStart(target); } @@ -933,7 +929,7 @@ public: private: InstanceScript* instance; EventMap events; - uint64 summonerGuid; + ObjectGuid summonerGuid; }; CreatureAI* GetAI(Creature* creature) const override @@ -960,9 +956,9 @@ public: void Reset() override { - summonerGuid = 0; + summonerGuid.Clear(); - if (Unit* target = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_AKAMA_SHADE))) + if (Unit* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_AKAMA_SHADE))) AttackStart(target); } @@ -1013,7 +1009,7 @@ public: private: InstanceScript* instance; EventMap events; - uint64 summonerGuid; + ObjectGuid summonerGuid; }; CreatureAI* GetAI(Creature* creature) const override @@ -1040,9 +1036,9 @@ public: void Reset() override { - summonerGuid = 0; + summonerGuid.Clear(); - if (Unit* target = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_AKAMA_SHADE))) + if (Unit* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_AKAMA_SHADE))) AttackStart(target); } @@ -1093,7 +1089,7 @@ public: private: InstanceScript* instance; EventMap events; - uint64 summonerGuid; + ObjectGuid summonerGuid; }; CreatureAI* GetAI(Creature* creature) const override @@ -1122,9 +1118,9 @@ public: { spiritMend = false; chainHeal = false; - summonerGuid = 0; + summonerGuid.Clear(); - if (Unit* target = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_AKAMA_SHADE))) + if (Unit* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_AKAMA_SHADE))) AttackStart(target); } @@ -1188,7 +1184,7 @@ public: private: InstanceScript* instance; EventMap events; - uint64 summonerGuid; + ObjectGuid summonerGuid; bool spiritMend; bool chainHeal; }; diff --git a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp index 0bbf2cb2a96..081dbc079a7 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp @@ -67,13 +67,13 @@ public: uint32 CheckTeronTimer; uint32 ShadowBoltTimer; - uint64 TeronGUID; + ObjectGuid TeronGUID; void Reset() override { CheckTeronTimer = 5000; ShadowBoltTimer = 12000; - TeronGUID = 0; + TeronGUID.Clear(); } void EnterCombat(Unit* /*who*/) override { } @@ -113,7 +113,7 @@ public: return; } - void SetTeronGUID(uint64 guid) + void SetTeronGUID(ObjectGuid guid) { TeronGUID = guid; } @@ -134,16 +134,16 @@ public: { npc_shadowy_constructAI(Creature* creature) : ScriptedAI(creature) { } - uint64 GhostGUID; - uint64 TeronGUID; + ObjectGuid GhostGUID; + ObjectGuid TeronGUID; uint32 CheckPlayerTimer; uint32 CheckTeronTimer; void Reset() override { - GhostGUID = 0; - TeronGUID = 0; + GhostGUID.Clear(); + TeronGUID.Clear(); CheckPlayerTimer = 2000; CheckTeronTimer = 5000; @@ -238,8 +238,8 @@ public: uint32 RandomYellTimer; uint32 AggroTimer; - uint64 AggroTargetGUID; - uint64 GhostGUID; // Player that gets killed by Shadow of Death and gets turned into a ghost + ObjectGuid AggroTargetGUID; + ObjectGuid GhostGUID; // Player that gets killed by Shadow of Death and gets turned into a ghost bool Intro; bool Done; @@ -260,7 +260,7 @@ public: me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); AggroTimer = 20000; - AggroTargetGUID = 0; + AggroTargetGUID.Clear(); Intro = false; Done = false; } diff --git a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp index c998bfed2dc..0f80e541261 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp @@ -1,145 +1,144 @@ -/* - * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "ScriptMgr.h" -#include "ScriptedCreature.h" -#include "black_temple.h" -#include "Player.h" -#include "SpellInfo.h" - -enum Texts -{ - SAY_AGGRO = 0, - SAY_NEEDLE = 1, - SAY_SLAY = 2, - SAY_SPECIAL = 3, - SAY_ENRAGE = 4, - SAY_DEATH = 5 -}; - -enum Spells -{ - SPELL_NEEDLE_SPINE = 39992, - SPELL_TIDAL_BURST = 39878, - SPELL_TIDAL_SHIELD = 39872, - SPELL_IMPALING_SPINE = 39837, - SPELL_CREATE_NAJENTUS_SPINE = 39956, - SPELL_HURL_SPINE = 39948, - SPELL_BERSERK = 26662 - -}; - -enum Events -{ - EVENT_BERSERK = 1, - EVENT_YELL = 2, - EVENT_NEEDLE = 3, - EVENT_SPINE = 4, - EVENT_SHIELD = 5 -}; - -enum EventGroups -{ - GCD_CAST = 1, - GCD_YELL = 2 -}; - -class boss_najentus : public CreatureScript -{ -public: - boss_najentus() : CreatureScript("boss_najentus") { } - - struct boss_najentusAI : public BossAI - { - boss_najentusAI(Creature* creature) : BossAI(creature, DATA_HIGH_WARLORD_NAJENTUS) - { - SpineTargetGUID = 0; - } - - void Reset() override - { - _Reset(); - SpineTargetGUID = 0; - } - - void KilledUnit(Unit* /*victim*/) override - { - Talk(SAY_SLAY); - events.DelayEvents(5000, GCD_YELL); - } - - void JustDied(Unit* /*killer*/) override - { - _JustDied(); - Talk(SAY_DEATH); - } - - void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override - { - if (spell->Id == SPELL_HURL_SPINE && me->HasAura(SPELL_TIDAL_SHIELD)) - { - me->RemoveAurasDueToSpell(SPELL_TIDAL_SHIELD); - DoCast(me, SPELL_TIDAL_BURST, true); - ResetTimer(); - } - } - - void EnterCombat(Unit* /*who*/) override - { - _EnterCombat(); - Talk(SAY_AGGRO); - events.ScheduleEvent(EVENT_BERSERK, 480000, GCD_CAST); - events.ScheduleEvent(EVENT_YELL, 45000 + (rand32() % 76) * 1000, GCD_YELL); - ResetTimer(); - } - - bool RemoveImpalingSpine() - { - if (!SpineTargetGUID) - return false; - - Unit* target = ObjectAccessor::GetUnit(*me, SpineTargetGUID); - if (target && target->HasAura(SPELL_IMPALING_SPINE)) - target->RemoveAurasDueToSpell(SPELL_IMPALING_SPINE); - SpineTargetGUID=0; - return true; - } - - void ResetTimer(uint32 inc = 0) - { - events.RescheduleEvent(EVENT_NEEDLE, 10000 + inc, GCD_CAST); - events.RescheduleEvent(EVENT_SPINE, 20000 + inc, GCD_CAST); - events.RescheduleEvent(EVENT_SHIELD, 60000 + inc); - } - - void ExecuteEvent(uint32 eventId) override - { - switch (eventId) - { - case EVENT_SHIELD: - DoCast(me, SPELL_TIDAL_SHIELD, true); - ResetTimer(45000); - break; - case EVENT_BERSERK: - Talk(SAY_ENRAGE); - DoCast(me, SPELL_BERSERK, true); - events.DelayEvents(15000, GCD_YELL); - break; - case EVENT_SPINE: +/*
+ * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "black_temple.h"
+#include "Player.h"
+#include "SpellInfo.h"
+
+enum Texts
+{
+ SAY_AGGRO = 0,
+ SAY_NEEDLE = 1,
+ SAY_SLAY = 2,
+ SAY_SPECIAL = 3,
+ SAY_ENRAGE = 4,
+ SAY_DEATH = 5
+};
+
+enum Spells
+{
+ SPELL_NEEDLE_SPINE = 39992,
+ SPELL_TIDAL_BURST = 39878,
+ SPELL_TIDAL_SHIELD = 39872,
+ SPELL_IMPALING_SPINE = 39837,
+ SPELL_CREATE_NAJENTUS_SPINE = 39956,
+ SPELL_HURL_SPINE = 39948,
+ SPELL_BERSERK = 26662
+
+};
+
+enum Events
+{
+ EVENT_BERSERK = 1,
+ EVENT_YELL = 2,
+ EVENT_NEEDLE = 3,
+ EVENT_SPINE = 4,
+ EVENT_SHIELD = 5
+};
+
+enum EventGroups
+{
+ GCD_CAST = 1,
+ GCD_YELL = 2
+};
+
+class boss_najentus : public CreatureScript
+{
+public:
+ boss_najentus() : CreatureScript("boss_najentus") { }
+
+ struct boss_najentusAI : public BossAI
+ {
+ boss_najentusAI(Creature* creature) : BossAI(creature, DATA_HIGH_WARLORD_NAJENTUS)
+ {
+ }
+
+ void Reset() override
+ {
+ _Reset();
+ SpineTargetGUID.Clear();
+ }
+
+ void KilledUnit(Unit* /*victim*/) override
+ {
+ Talk(SAY_SLAY);
+ events.DelayEvents(5000, GCD_YELL);
+ }
+
+ void JustDied(Unit* /*killer*/) override
+ {
+ _JustDied();
+ Talk(SAY_DEATH);
+ }
+
+ void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override
+ {
+ if (spell->Id == SPELL_HURL_SPINE && me->HasAura(SPELL_TIDAL_SHIELD))
+ {
+ me->RemoveAurasDueToSpell(SPELL_TIDAL_SHIELD);
+ DoCast(me, SPELL_TIDAL_BURST, true);
+ ResetTimer();
+ }
+ }
+
+ void EnterCombat(Unit* /*who*/) override
+ {
+ _EnterCombat();
+ Talk(SAY_AGGRO);
+ events.ScheduleEvent(EVENT_BERSERK, 480000, GCD_CAST);
+ events.ScheduleEvent(EVENT_YELL, 45000 + (rand32() % 76) * 1000, GCD_YELL);
+ ResetTimer();
+ }
+
+ bool RemoveImpalingSpine()
+ {
+ if (!SpineTargetGUID)
+ return false;
+
+ Unit* target = ObjectAccessor::GetUnit(*me, SpineTargetGUID);
+ if (target && target->HasAura(SPELL_IMPALING_SPINE))
+ target->RemoveAurasDueToSpell(SPELL_IMPALING_SPINE);
+ SpineTargetGUID.Clear();
+ return true;
+ }
+
+ void ResetTimer(uint32 inc = 0)
+ {
+ events.RescheduleEvent(EVENT_NEEDLE, 10000 + inc, GCD_CAST);
+ events.RescheduleEvent(EVENT_SPINE, 20000 + inc, GCD_CAST);
+ events.RescheduleEvent(EVENT_SHIELD, 60000 + inc);
+ }
+
+ void ExecuteEvent(uint32 eventId) override
+ {
+ switch (eventId)
+ {
+ case EVENT_SHIELD:
+ DoCast(me, SPELL_TIDAL_SHIELD, true);
+ ResetTimer(45000);
+ break;
+ case EVENT_BERSERK:
+ Talk(SAY_ENRAGE);
+ DoCast(me, SPELL_BERSERK, true);
+ events.DelayEvents(15000, GCD_YELL);
+ break;
+ case EVENT_SPINE:
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1);
@@ -158,59 +157,59 @@ public: }
events.ScheduleEvent(EVENT_SPINE, 21000, GCD_CAST);
return;
- } - case EVENT_NEEDLE: - { - //DoCast(me, SPELL_NEEDLE_SPINE, true); - std::list<Unit*> targets; - SelectTargetList(targets, 3, SELECT_TARGET_RANDOM, 80, true); - for (std::list<Unit*>::const_iterator i = targets.begin(); i != targets.end(); ++i) - DoCast(*i, 39835, true); - events.ScheduleEvent(EVENT_NEEDLE, urand(15000, 25000), GCD_CAST); - events.DelayEvents(1500, GCD_CAST); - return; - } - case EVENT_YELL: - Talk(SAY_SPECIAL); - events.ScheduleEvent(EVENT_YELL, urand(25000, 100000), GCD_YELL); - events.DelayEvents(15000, GCD_YELL); - break; - default: - break; - } - } - - private: - uint64 SpineTargetGUID; - }; - - CreatureAI* GetAI(Creature* creature) const override - { - return GetBlackTempleAI<boss_najentusAI>(creature); - } -}; - -class go_najentus_spine : public GameObjectScript -{ -public: - go_najentus_spine() : GameObjectScript("go_najentus_spine") { } - - bool OnGossipHello(Player* player, GameObject* go) override - { - if (InstanceScript* instance = go->GetInstanceScript()) - if (Creature* Najentus = ObjectAccessor::GetCreature(*go, instance->GetData64(DATA_HIGH_WARLORD_NAJENTUS))) - if (ENSURE_AI(boss_najentus::boss_najentusAI, Najentus->AI())->RemoveImpalingSpine()) - { - player->CastSpell(player, SPELL_CREATE_NAJENTUS_SPINE, true); - go->Delete(); - } - return true; - } - -}; - -void AddSC_boss_najentus() -{ - new boss_najentus(); - new go_najentus_spine(); -} + }
+ case EVENT_NEEDLE:
+ {
+ //DoCast(me, SPELL_NEEDLE_SPINE, true);
+ std::list<Unit*> targets;
+ SelectTargetList(targets, 3, SELECT_TARGET_RANDOM, 80, true);
+ for (std::list<Unit*>::const_iterator i = targets.begin(); i != targets.end(); ++i)
+ DoCast(*i, 39835, true);
+ events.ScheduleEvent(EVENT_NEEDLE, urand(15000, 25000), GCD_CAST);
+ events.DelayEvents(1500, GCD_CAST);
+ return;
+ }
+ case EVENT_YELL:
+ Talk(SAY_SPECIAL);
+ events.ScheduleEvent(EVENT_YELL, urand(25000, 100000), GCD_YELL);
+ events.DelayEvents(15000, GCD_YELL);
+ break;
+ default:
+ break;
+ }
+ }
+
+ private:
+ ObjectGuid SpineTargetGUID;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return GetBlackTempleAI<boss_najentusAI>(creature);
+ }
+};
+
+class go_najentus_spine : public GameObjectScript
+{
+public:
+ go_najentus_spine() : GameObjectScript("go_najentus_spine") { }
+
+ bool OnGossipHello(Player* player, GameObject* go) override
+ {
+ if (InstanceScript* instance = go->GetInstanceScript())
+ if (Creature* Najentus = ObjectAccessor::GetCreature(*go, instance->GetGuidData(DATA_HIGH_WARLORD_NAJENTUS)))
+ if (ENSURE_AI(boss_najentus::boss_najentusAI, Najentus->AI())->RemoveImpalingSpine())
+ {
+ player->CastSpell(player, SPELL_CREATE_NAJENTUS_SPINE, true);
+ go->Delete();
+ }
+ return true;
+ }
+
+};
+
+void AddSC_boss_najentus()
+{
+ new boss_najentus();
+ new go_najentus_spine();
+}
diff --git a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp index 2c6bac4c9d9..a14a4c576cb 100644 --- a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp +++ b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp @@ -129,11 +129,9 @@ public: { npc_blood_elf_council_voice_triggerAI(Creature* creature) : ScriptedAI(creature) { - for (uint8 i = 0; i < 4; ++i) - Council[i] = 0; } - uint64 Council[4]; + ObjectGuid Council[4]; uint32 EnrageTimer; uint32 AggroYellTimer; @@ -157,10 +155,10 @@ public: { if (InstanceScript* instance = me->GetInstanceScript()) { - Council[0] = instance->GetData64(DATA_GATHIOS_THE_SHATTERER); - Council[1] = instance->GetData64(DATA_VERAS_DARKSHADOW); - Council[2] = instance->GetData64(DATA_LADY_MALANDE); - Council[3] = instance->GetData64(DATA_HIGH_NETHERMANCER_ZEREVOR); + Council[0] = instance->GetGuidData(DATA_GATHIOS_THE_SHATTERER); + Council[1] = instance->GetGuidData(DATA_VERAS_DARKSHADOW); + Council[2] = instance->GetGuidData(DATA_LADY_MALANDE); + Council[3] = instance->GetGuidData(DATA_HIGH_NETHERMANCER_ZEREVOR); } else TC_LOG_ERROR("scripts", ERROR_INST_DATA); } @@ -226,13 +224,11 @@ public: npc_illidari_councilAI(Creature* creature) : ScriptedAI(creature) { instance = creature->GetInstanceScript(); - for (uint8 i = 0; i < 4; ++i) - Council[i] = 0; } InstanceScript* instance; - uint64 Council[4]; + ObjectGuid Council[4]; uint32 CheckTimer; uint32 EndEventTimer; @@ -264,7 +260,7 @@ public: } instance->SetBossState(DATA_ILLIDARI_COUNCIL, NOT_STARTED); - if (Creature* VoiceTrigger = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BLOOD_ELF_COUNCIL_VOICE))) + if (Creature* VoiceTrigger = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BLOOD_ELF_COUNCIL_VOICE))) VoiceTrigger->AI()->EnterEvadeMode(); EventBegun = false; @@ -283,13 +279,13 @@ public: { if (target && target->IsAlive()) { - Council[0] = instance->GetData64(DATA_GATHIOS_THE_SHATTERER); - Council[1] = instance->GetData64(DATA_HIGH_NETHERMANCER_ZEREVOR); - Council[2] = instance->GetData64(DATA_LADY_MALANDE); - Council[3] = instance->GetData64(DATA_VERAS_DARKSHADOW); + Council[0] = instance->GetGuidData(DATA_GATHIOS_THE_SHATTERER); + Council[1] = instance->GetGuidData(DATA_HIGH_NETHERMANCER_ZEREVOR); + Council[2] = instance->GetGuidData(DATA_LADY_MALANDE); + Council[3] = instance->GetGuidData(DATA_VERAS_DARKSHADOW); // Start the event for the Voice Trigger - if (Creature* VoiceTrigger = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BLOOD_ELF_COUNCIL_VOICE))) + if (Creature* VoiceTrigger = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BLOOD_ELF_COUNCIL_VOICE))) { ENSURE_AI(npc_blood_elf_council_voice_trigger::npc_blood_elf_council_voice_triggerAI, VoiceTrigger->AI())->LoadCouncilGUIDs(); ENSURE_AI(npc_blood_elf_council_voice_trigger::npc_blood_elf_council_voice_triggerAI, VoiceTrigger->AI())->EventStarted = true; @@ -322,7 +318,7 @@ public: { if (DeathCount > 3) { - if (Creature* VoiceTrigger = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BLOOD_ELF_COUNCIL_VOICE))) + if (Creature* VoiceTrigger = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BLOOD_ELF_COUNCIL_VOICE))) VoiceTrigger->DealDamage(VoiceTrigger, VoiceTrigger->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); instance->SetBossState(DATA_ILLIDARI_COUNCIL, DONE); //me->SummonCreature(AKAMAID, 746.466980f, 304.394989f, 311.90208f, 6.272870f, TEMPSUMMON_DEAD_DESPAWN, 0); @@ -379,12 +375,10 @@ struct boss_illidari_councilAI : public ScriptedAI boss_illidari_councilAI(Creature* creature) : ScriptedAI(creature) { instance = creature->GetInstanceScript(); - for (uint8 i = 0; i < 4; ++i) - Council[i] = 0; LoadedGUIDs = false; } - uint64 Council[4]; + ObjectGuid Council[4]; InstanceScript* instance; @@ -392,7 +386,7 @@ struct boss_illidari_councilAI : public ScriptedAI void EnterCombat(Unit* who) override { - if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ILLIDARI_COUNCIL))) + if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ILLIDARI_COUNCIL))) ENSURE_AI(npc_illidari_council::npc_illidari_councilAI, controller->AI())->StartEvent(who); DoZoneInCombat(); // Load GUIDs on first aggro because the Creature guids are only set as the creatures are created in world- @@ -436,10 +430,10 @@ struct boss_illidari_councilAI : public ScriptedAI void LoadGUIDs() { - Council[0] = instance->GetData64(DATA_LADY_MALANDE); - Council[1] = instance->GetData64(DATA_HIGH_NETHERMANCER_ZEREVOR); - Council[2] = instance->GetData64(DATA_GATHIOS_THE_SHATTERER); - Council[3] = instance->GetData64(DATA_VERAS_DARKSHADOW); + Council[0] = instance->GetGuidData(DATA_LADY_MALANDE); + Council[1] = instance->GetGuidData(DATA_HIGH_NETHERMANCER_ZEREVOR); + Council[2] = instance->GetGuidData(DATA_GATHIOS_THE_SHATTERER); + Council[3] = instance->GetGuidData(DATA_VERAS_DARKSHADOW); LoadedGUIDs = true; } diff --git a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp index 55ad45597ea..7067ca659d3 100644 --- a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp +++ b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp @@ -47,23 +47,6 @@ class instance_black_temple : public InstanceMapScript SetHeaders(DataHeader); SetBossNumber(EncounterCount); LoadDoorData(doorData); - - NajentusGUID = 0; - SupremusGUID = 0; - ShadeOfAkamaGUID = 0; - AkamaShadeGUID = 0; - AkamaGUID = 0; - GathiosTheShattererGUID = 0; - HighNethermancerZerevorGUID = 0; - LadyMalandeGUID = 0; - VerasDarkshadowGUID = 0; - IllidariCouncilGUID = 0; - BloodElfCouncilVoiceGUID = 0; - IllidanStormrageGUID = 0; - - IllidanGateGUID = 0; - - memset(IllidanDoorGUIDs, 0, 2 * sizeof(uint64)); } void OnCreatureCreate(Creature* creature) override @@ -162,7 +145,7 @@ class instance_black_temple : public InstanceMapScript } } - uint64 GetData64(uint32 type) const override + ObjectGuid GetGuidData(uint32 type) const override { switch (type) { @@ -200,28 +183,28 @@ class instance_black_temple : public InstanceMapScript break; } - return 0; + return ObjectGuid::Empty; } protected: - uint64 NajentusGUID; - uint64 SupremusGUID; - uint64 ShadeOfAkamaGUID; - uint64 AkamaShadeGUID; - uint64 AkamaGUID; + ObjectGuid NajentusGUID; + ObjectGuid SupremusGUID; + ObjectGuid ShadeOfAkamaGUID; + ObjectGuid AkamaShadeGUID; + ObjectGuid AkamaGUID; - uint64 GathiosTheShattererGUID; - uint64 HighNethermancerZerevorGUID; - uint64 LadyMalandeGUID; - uint64 VerasDarkshadowGUID; + ObjectGuid GathiosTheShattererGUID; + ObjectGuid HighNethermancerZerevorGUID; + ObjectGuid LadyMalandeGUID; + ObjectGuid VerasDarkshadowGUID; - uint64 IllidariCouncilGUID; - uint64 BloodElfCouncilVoiceGUID; + ObjectGuid IllidariCouncilGUID; + ObjectGuid BloodElfCouncilVoiceGUID; - uint64 IllidanStormrageGUID; + ObjectGuid IllidanStormrageGUID; - uint64 IllidanGateGUID; - uint64 IllidanDoorGUIDs[2]; + ObjectGuid IllidanGateGUID; + ObjectGuid IllidanDoorGUIDs[2]; }; InstanceScript* GetInstanceScript(InstanceMap* map) const override diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp index 683efcdbcf0..05db2c12b90 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp @@ -112,9 +112,6 @@ public: boss_fathomlord_karathressAI(Creature* creature) : ScriptedAI(creature) { instance = creature->GetInstanceScript(); - Advisors[0] = 0; - Advisors[1] = 0; - Advisors[2] = 0; } InstanceScript* instance; @@ -125,7 +122,7 @@ public: bool BlessingOfTides; - uint64 Advisors[MAX_ADVISORS]; + ObjectGuid Advisors[MAX_ADVISORS]; void Reset() override { @@ -135,10 +132,10 @@ public: BlessingOfTides = false; - uint64 RAdvisors[MAX_ADVISORS]; - RAdvisors[0] = instance->GetData64(DATA_SHARKKIS); - RAdvisors[1] = instance->GetData64(DATA_TIDALVESS); - RAdvisors[2] = instance->GetData64(DATA_CARIBDIS); + ObjectGuid RAdvisors[MAX_ADVISORS]; + RAdvisors[0] = instance->GetGuidData(DATA_SHARKKIS); + RAdvisors[1] = instance->GetGuidData(DATA_TIDALVESS); + RAdvisors[2] = instance->GetGuidData(DATA_CARIBDIS); // Respawn of the 3 Advisors for (uint8 i = 0; i < MAX_ADVISORS; ++i) if (RAdvisors[i]) @@ -175,9 +172,9 @@ public: void GetAdvisors() { - Advisors[0] = instance->GetData64(DATA_SHARKKIS); - Advisors[1] = instance->GetData64(DATA_TIDALVESS); - Advisors[2] = instance->GetData64(DATA_CARIBDIS); + Advisors[0] = instance->GetGuidData(DATA_SHARKKIS); + Advisors[1] = instance->GetGuidData(DATA_TIDALVESS); + Advisors[2] = instance->GetGuidData(DATA_CARIBDIS); } void StartEvent(Unit* who) @@ -187,7 +184,7 @@ public: Talk(SAY_AGGRO); DoZoneInCombat(); - instance->SetData64(DATA_KARATHRESSEVENT_STARTER, who->GetGUID()); + instance->SetGuidData(DATA_KARATHRESSEVENT_STARTER, who->GetGUID()); instance->SetData(DATA_KARATHRESSEVENT, IN_PROGRESS); } @@ -216,7 +213,7 @@ public: //Only if not incombat check if the event is started if (!me->IsInCombat() && instance->GetData(DATA_KARATHRESSEVENT)) { - if (Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER))) + if (Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_KARATHRESSEVENT_STARTER))) { AttackStart(target); GetAdvisors(); @@ -308,7 +305,6 @@ public: boss_fathomguard_sharkkisAI(Creature* creature) : ScriptedAI(creature) { instance = creature->GetInstanceScript(); - SummonedPet = 0; } InstanceScript* instance; @@ -320,7 +316,7 @@ public: bool pet; - uint64 SummonedPet; + ObjectGuid SummonedPet; void Reset() override { @@ -335,20 +331,20 @@ public: if (Pet && Pet->IsAlive()) Pet->DealDamage(Pet, Pet->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - SummonedPet = 0; + SummonedPet.Clear(); instance->SetData(DATA_KARATHRESSEVENT, NOT_STARTED); } void JustDied(Unit* /*killer*/) override { - if (Creature* Karathress = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KARATHRESS))) + if (Creature* Karathress = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KARATHRESS))) ENSURE_AI(boss_fathomlord_karathress::boss_fathomlord_karathressAI, Karathress->AI())->EventSharkkisDeath(); } void EnterCombat(Unit* who) override { - instance->SetData64(DATA_KARATHRESSEVENT_STARTER, who->GetGUID()); + instance->SetGuidData(DATA_KARATHRESSEVENT_STARTER, who->GetGUID()); instance->SetData(DATA_KARATHRESSEVENT, IN_PROGRESS); } @@ -357,7 +353,7 @@ public: //Only if not incombat check if the event is started if (!me->IsInCombat() && instance->GetData(DATA_KARATHRESSEVENT)) { - if (Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER))) + if (Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_KARATHRESSEVENT_STARTER))) AttackStart(target); } @@ -468,13 +464,13 @@ public: void JustDied(Unit* /*killer*/) override { - if (Creature* Karathress = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KARATHRESS))) + if (Creature* Karathress = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KARATHRESS))) ENSURE_AI(boss_fathomlord_karathress::boss_fathomlord_karathressAI, Karathress->AI())->EventTidalvessDeath(); } void EnterCombat(Unit* who) override { - instance->SetData64(DATA_KARATHRESSEVENT_STARTER, who->GetGUID()); + instance->SetGuidData(DATA_KARATHRESSEVENT_STARTER, who->GetGUID()); instance->SetData(DATA_KARATHRESSEVENT, IN_PROGRESS); DoCast(me, SPELL_WINDFURY_WEAPON); } @@ -484,7 +480,7 @@ public: //Only if not incombat check if the event is started if (!me->IsInCombat() && instance->GetData(DATA_KARATHRESSEVENT)) { - if (Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER))) + if (Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_KARATHRESSEVENT_STARTER))) AttackStart(target); } @@ -515,7 +511,7 @@ public: if (Spitfire_Timer <= diff) { DoCast(me, SPELL_SPITFIRE_TOTEM); - if (Unit* SpitfireTotem = ObjectAccessor::GetUnit(*me, CREATURE_SPITFIRE_TOTEM)) + if (Unit* SpitfireTotem = me->FindNearestCreature(CREATURE_SPITFIRE_TOTEM, 100.0f)) SpitfireTotem->ToCreature()->AI()->AttackStart(me->GetVictim()); Spitfire_Timer = 60000; @@ -584,13 +580,13 @@ public: void JustDied(Unit* /*killer*/) override { - if (Creature* Karathress = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KARATHRESS))) + if (Creature* Karathress = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KARATHRESS))) ENSURE_AI(boss_fathomlord_karathress::boss_fathomlord_karathressAI, Karathress->AI())->EventCaribdisDeath(); } void EnterCombat(Unit* who) override { - instance->SetData64(DATA_KARATHRESSEVENT_STARTER, who->GetGUID()); + instance->SetGuidData(DATA_KARATHRESSEVENT_STARTER, who->GetGUID()); instance->SetData(DATA_KARATHRESSEVENT, IN_PROGRESS); } @@ -599,7 +595,7 @@ public: //Only if not incombat check if the event is started if (!me->IsInCombat() && instance->GetData(DATA_KARATHRESSEVENT)) { - if (Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER))) + if (Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_KARATHRESSEVENT_STARTER))) AttackStart(target); } @@ -675,13 +671,13 @@ public: switch (rand32() % 4) { case 0: - unit = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_KARATHRESS)); + unit = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_KARATHRESS)); break; case 1: - unit = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_SHARKKIS)); + unit = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_SHARKKIS)); break; case 2: - unit = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_TIDALVESS)); + unit = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_TIDALVESS)); break; case 3: unit = me; diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp index bcde75584fb..cea6a1854a1 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp @@ -94,13 +94,11 @@ public: boss_hydross_the_unstableAI(Creature* creature) : ScriptedAI(creature), Summons(me) { instance = creature->GetInstanceScript(); - beams[0] = 0; - beams[1] = 0; } InstanceScript* instance; - uint64 beams[2]; + ObjectGuid beams[2]; uint32 PosCheck_Timer; uint32 MarkOfHydross_Timer; uint32 MarkOfCorruption_Timer; @@ -116,8 +114,8 @@ public: void Reset() override { DeSummonBeams(); - beams[0] = 0; - beams[1] = 0; + beams[0].Clear(); + beams[1].Clear(); PosCheck_Timer = 2500; MarkOfHydross_Timer = 15000; MarkOfCorruption_Timer = 15000; @@ -147,7 +145,7 @@ public: beamer->CastSpell(me, SPELL_BLUE_BEAM, true); beamer->SetDisplayId(11686); //invisible beamer->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - beams[0]=beamer->GetGUID(); + beams[0] = beamer->GetGUID(); } beamer = me->SummonCreature(ENTRY_BEAM_DUMMY, -219.918f, -371.308f, 22.0042f, 2.73072f, TEMPSUMMON_CORPSE_DESPAWN, 0); if (beamer) @@ -155,7 +153,7 @@ public: beamer->CastSpell(me, SPELL_BLUE_BEAM, true); beamer->SetDisplayId(11686); //invisible beamer->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - beams[1]=beamer->GetGUID(); + beams[1] = beamer->GetGUID(); } } void DeSummonBeams() diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp index a241f2bea37..4630620c585 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp @@ -151,13 +151,11 @@ public: Intro = false; JustCreated = true; creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); // set it only once on Creature create (no need do intro if wiped) - for (uint8 i = 0; i < 4; ++i) - ShieldGeneratorChannel[i] = 0; } InstanceScript* instance; - uint64 ShieldGeneratorChannel[4]; + ObjectGuid ShieldGeneratorChannel[4]; uint32 AggroTimer; uint32 ShockBlastTimer; @@ -210,7 +208,7 @@ public: if (Unit* remo = ObjectAccessor::GetUnit(*me, ShieldGeneratorChannel[i])) { remo->setDeathState(JUST_DIED); - ShieldGeneratorChannel[i] = 0; + ShieldGeneratorChannel[i].Clear(); } } } @@ -565,7 +563,7 @@ public: uint32 Phase; float X, Y, Z; - uint64 VashjGUID; + ObjectGuid VashjGUID; void Reset() override { @@ -589,7 +587,7 @@ public: } } - VashjGUID = instance->GetData64(DATA_LADYVASHJ); + VashjGUID = instance->GetGuidData(DATA_LADYVASHJ); } void EnterCombat(Unit* /*who*/) override { } @@ -662,7 +660,7 @@ public: void JustDied(Unit* /*killer*/) override { - if (Creature* vashj = ObjectAccessor::GetCreature((*me), instance->GetData64(DATA_LADYVASHJ))) + if (Creature* vashj = ObjectAccessor::GetCreature((*me), instance->GetGuidData(DATA_LADYVASHJ))) ENSURE_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->EventTaintedElementalDeath(); } @@ -778,7 +776,7 @@ public: if (CheckTimer <= diff) { // check if vashj is death - Unit* Vashj = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_LADYVASHJ)); + Unit* Vashj = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_LADYVASHJ)); if (!Vashj || !Vashj->IsAlive() || ENSURE_AI(boss_lady_vashj::boss_lady_vashjAI, Vashj->ToCreature()->AI())->Phase != 3) { // remove @@ -833,7 +831,7 @@ public: { if (CheckTimer <= diff) { - Unit* vashj = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_LADYVASHJ)); + Unit* vashj = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_LADYVASHJ)); if (vashj && vashj->IsAlive()) { @@ -865,7 +863,7 @@ public: return true; } - Creature* vashj = ObjectAccessor::GetCreature((*player), instance->GetData64(DATA_LADYVASHJ)); + Creature* vashj = ObjectAccessor::GetCreature((*player), instance->GetGuidData(DATA_LADYVASHJ)); if (vashj && (ENSURE_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->Phase == 2)) { if (GameObject* gObj = targets.GetGOTarget()) diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp index fb5b4579942..9f51155b334 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp @@ -83,13 +83,12 @@ public: { npc_inner_demonAI(Creature* creature) : ScriptedAI(creature) { - victimGUID = 0; } uint32 ShadowBolt_Timer; uint32 Link_Timer; - uint64 victimGUID; + ObjectGuid victimGUID; void Reset() override { @@ -97,17 +96,17 @@ public: Link_Timer = 1000; } - void SetGUID(uint64 guid, int32 id/* = 0 */) override + void SetGUID(ObjectGuid guid, int32 id/* = 0 */) override { if (id == INNER_DEMON_VICTIM) victimGUID = guid; } - uint64 GetGUID(int32 id/* = 0 */) const override + ObjectGuid GetGUID(int32 id/* = 0 */) const override { if (id == INNER_DEMON_VICTIM) return victimGUID; - return 0; + return ObjectGuid::Empty; } void JustDied(Unit* /*killer*/) override @@ -190,10 +189,6 @@ public: { creature->GetPosition(x, y, z); instance = creature->GetInstanceScript(); - Demon = 0; - - for (uint8 i = 0; i < 3; ++i)//clear guids - SpellBinderGUID[i] = 0; } InstanceScript* instance; @@ -213,10 +208,10 @@ public: bool EnrageUsed; float x, y, z; - uint64 InnderDemon[5]; + ObjectGuid InnderDemon[5]; uint32 InnerDemon_Count; - uint64 Demon; - uint64 SpellBinderGUID[3]; + ObjectGuid Demon; + ObjectGuid SpellBinderGUID[3]; void Reset() override { @@ -317,10 +312,10 @@ public: // and reseting equipment me->LoadEquipment(); - if (instance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)) + if (instance->GetGuidData(DATA_LEOTHERAS_EVENT_STARTER)) { Unit* victim = NULL; - victim = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)); + victim = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_LEOTHERAS_EVENT_STARTER)); if (victim) me->getThreatManager().addThreat(victim, 1); StartEvent(); @@ -349,13 +344,12 @@ public: { if (InnderDemon[i]) { - //delete creature - Creature* creature = ObjectAccessor::GetCreature((*me), InnderDemon[i]); - if (creature && creature->IsAlive()) - { - creature->DespawnOrUnsummon(); - } - InnderDemon[i] = 0; + //delete creature + Creature* creature = ObjectAccessor::GetCreature((*me), InnderDemon[i]); + if (creature && creature->IsAlive()) + creature->DespawnOrUnsummon(); + + InnderDemon[i].Clear(); } } @@ -364,9 +358,9 @@ public: void CastConsumingMadness() //remove this once SPELL_INSIDIOUS_WHISPER is supported by core { - for (uint8 i=0; i<5; ++i) + for (uint8 i = 0; i < 5; ++i) { - if (InnderDemon[i] > 0) + if (InnderDemon[i]) { Creature* unit = ObjectAccessor::GetCreature((*me), InnderDemon[i]); if (unit && unit->IsAlive()) @@ -481,7 +475,7 @@ public: if (SwitchToDemon_Timer <= diff) { //switch to demon form - me->RemoveAurasDueToSpell(SPELL_WHIRLWIND, 0); + me->RemoveAurasDueToSpell(SPELL_WHIRLWIND); me->SetDisplayId(MODEL_DEMON); Talk(SAY_SWITCH_TO_DEMON); me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID , 0); @@ -576,8 +570,8 @@ public: Creature* Copy = NULL; Copy = DoSpawnCreature(DEMON_FORM, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 6000); if (Copy) - { - Demon = Copy->GetGUID(); + { + Demon = Copy->GetGUID(); if (me->GetVictim()) Copy->AI()->AttackStart(me->GetVictim()); } @@ -682,13 +676,12 @@ public: npc_greyheart_spellbinderAI(Creature* creature) : ScriptedAI(creature) { instance = creature->GetInstanceScript(); - leotherasGUID = 0; AddedBanish = false; } InstanceScript* instance; - uint64 leotherasGUID; + ObjectGuid leotherasGUID; uint32 Mindblast_Timer; uint32 Earthshock_Timer; @@ -700,7 +693,7 @@ public: Mindblast_Timer = urand(3000, 8000); Earthshock_Timer = urand(5000, 10000); - instance->SetData64(DATA_LEOTHERAS_EVENT_STARTER, 0); + instance->SetGuidData(DATA_LEOTHERAS_EVENT_STARTER, ObjectGuid::Empty); Creature* leotheras = ObjectAccessor::GetCreature(*me, leotherasGUID); if (leotheras && leotheras->IsAlive()) ENSURE_AI(boss_leotheras_the_blind::boss_leotheras_the_blindAI, leotheras->AI())->CheckChannelers(/*false*/); @@ -709,7 +702,7 @@ public: void EnterCombat(Unit* who) override { me->InterruptNonMeleeSpells(false); - instance->SetData64(DATA_LEOTHERAS_EVENT_STARTER, who->GetGUID()); + instance->SetGuidData(DATA_LEOTHERAS_EVENT_STARTER, who->GetGUID()); } void JustRespawned() override @@ -734,12 +727,12 @@ public: void UpdateAI(uint32 diff) override { if (!leotherasGUID) - leotherasGUID = instance->GetData64(DATA_LEOTHERAS); + leotherasGUID = instance->GetGuidData(DATA_LEOTHERAS); - if (!me->IsInCombat() && instance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)) + if (!me->IsInCombat() && instance->GetGuidData(DATA_LEOTHERAS_EVENT_STARTER)) { Unit* victim = NULL; - victim = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)); + victim = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_LEOTHERAS_EVENT_STARTER)); if (victim) AttackStart(victim); } @@ -750,7 +743,7 @@ public: return; } - if (!instance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)) + if (!instance->GetGuidData(DATA_LEOTHERAS_EVENT_STARTER)) { EnterEvadeMode(); return; diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp index d501b919614..0a538ac0c39 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp @@ -215,8 +215,8 @@ public: { //Teleport 4 players under the waterfalls Unit* target; - std::set<uint64> list; - std::set<uint64>::const_iterator itr; + GuidSet targets; + GuidSet::const_iterator itr; for (uint8 i = 0; i < 4; ++i) { counter = 0; @@ -226,13 +226,13 @@ public: if (counter < Playercount) break; if (target) - itr = list.find(target->GetGUID()); + itr = targets.find(target->GetGUID()); ++counter; - } while (itr != list.end()); + } while (itr != targets.end()); if (target) { - list.insert(target->GetGUID()); + targets.insert(target->GetGUID()); ApplyWateryGrave(target, i); } } @@ -253,8 +253,8 @@ public: if (WateryGlobules_Timer <= diff) { Unit* pGlobuleTarget; - std::set<uint64> globulelist; - std::set<uint64>::const_iterator itr; + GuidSet globules; + GuidSet::const_iterator itr; for (uint8 g = 0; g < 4; g++) //one unit can't cast more than one spell per update, so some players have to cast for us XD { counter = 0; @@ -262,14 +262,14 @@ public: { pGlobuleTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true); if (pGlobuleTarget) - itr = globulelist.find(pGlobuleTarget->GetGUID()); + itr = globules.find(pGlobuleTarget->GetGUID()); if (counter > Playercount) break; ++counter; - } while (itr != globulelist.end()); + } while (itr != globules.end()); if (pGlobuleTarget) { - globulelist.insert(pGlobuleTarget->GetGUID()); + globules.insert(pGlobuleTarget->GetGUID()); pGlobuleTarget->CastSpell(pGlobuleTarget, globulespell[g], true); } } diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp index a3577f40d68..3fb090ab94c 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp @@ -94,20 +94,6 @@ class instance_serpent_shrine : public InstanceMapScript { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - LurkerBelow = 0; - Sharkkis = 0; - Tidalvess = 0; - Caribdis = 0; - LadyVashj = 0; - Karathress = 0; - KarathressEvent_Starter = 0; - LeotherasTheBlind = 0; - LeotherasEventStarter = 0; - - ControlConsole = 0; - BridgePart[0] = 0; - BridgePart[1] = 0; - BridgePart[2] = 0; StrangePool = 0; Water = WATERSTATE_FRENZY; @@ -247,7 +233,7 @@ class instance_serpent_shrine : public InstanceMapScript } } - void SetData64(uint32 type, uint64 data) override + void SetGuidData(uint32 type, ObjectGuid data) override { if (type == DATA_KARATHRESSEVENT_STARTER) KarathressEvent_Starter = data; @@ -255,7 +241,7 @@ class instance_serpent_shrine : public InstanceMapScript LeotherasEventStarter = data; } - uint64 GetData64(uint32 identifier) const override + ObjectGuid GetGuidData(uint32 identifier) const override { switch (identifier) { @@ -280,7 +266,7 @@ class instance_serpent_shrine : public InstanceMapScript default: break; } - return 0; + return ObjectGuid::Empty; } void SetData(uint32 type, uint32 data) override @@ -297,7 +283,6 @@ class instance_serpent_shrine : public InstanceMapScript HandleGameObject(BridgePart[0], true); HandleGameObject(BridgePart[0], true); } - ControlConsole = data; break; case DATA_TRASH: if (data == 1 && TrashCount < MIN_KILLS) @@ -424,18 +409,18 @@ class instance_serpent_shrine : public InstanceMapScript } private: - uint64 LurkerBelow; - uint64 Sharkkis; - uint64 Tidalvess; - uint64 Caribdis; - uint64 LadyVashj; - uint64 Karathress; - uint64 KarathressEvent_Starter; - uint64 LeotherasTheBlind; - uint64 LeotherasEventStarter; - - uint64 ControlConsole; - uint64 BridgePart[3]; + ObjectGuid LurkerBelow; + ObjectGuid Sharkkis; + ObjectGuid Tidalvess; + ObjectGuid Caribdis; + ObjectGuid LadyVashj; + ObjectGuid Karathress; + ObjectGuid KarathressEvent_Starter; + ObjectGuid LeotherasTheBlind; + ObjectGuid LeotherasEventStarter; + + ObjectGuid ControlConsole; + ObjectGuid BridgePart[3]; uint32 StrangePool; uint32 FishingTimer; uint32 WaterCheckTimer; diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp index 78a14539e25..3207727b5d1 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp @@ -226,7 +226,7 @@ public: { if (instance->GetBossState(DATA_MEKGINEER_STEAMRIGGER) == IN_PROGRESS) { - if (Creature* mekgineer = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MEKGINEER_STEAMRIGGER))) + if (Creature* mekgineer = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MEKGINEER_STEAMRIGGER))) { if (me->IsWithinDistInMap(mekgineer, MAX_REPAIR_RANGE)) { diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp index 40bc8dd69d7..f0884e83baa 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp @@ -58,11 +58,6 @@ class instance_steam_vault : public InstanceMapScript SetHeaders(DataHeader); SetBossNumber(EncounterCount); - ThespiaGUID = 0; - MekgineerGUID = 0; - KalithreshGUID = 0; - - MainChambersDoorGUID = 0; DistillerState = 0; } @@ -96,7 +91,7 @@ class instance_steam_vault : public InstanceMapScript } } - uint64 GetData64(uint32 type) const override + ObjectGuid GetGuidData(uint32 type) const override { switch (type) { @@ -109,7 +104,7 @@ class instance_steam_vault : public InstanceMapScript default: break; } - return 0; + return ObjectGuid::Empty; } void SetData(uint32 type, uint32 data) override @@ -158,11 +153,11 @@ class instance_steam_vault : public InstanceMapScript } protected: - uint64 ThespiaGUID; - uint64 MekgineerGUID; - uint64 KalithreshGUID; + ObjectGuid ThespiaGUID; + ObjectGuid MekgineerGUID; + ObjectGuid KalithreshGUID; - uint64 MainChambersDoorGUID; + ObjectGuid MainChambersDoorGUID; uint8 DistillerState; }; diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp index 7090a693876..d3b11d481fb 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp @@ -54,7 +54,7 @@ public: struct boss_the_black_stalkerAI : public ScriptedAI { - boss_the_black_stalkerAI(Creature* creature) : ScriptedAI(creature) + boss_the_black_stalkerAI(Creature* creature) : ScriptedAI(creature), Striders(creature) { } @@ -62,11 +62,11 @@ public: uint32 Levitate_Timer; uint32 ChainLightning_Timer; uint32 StaticCharge_Timer; - uint64 LevitatedTarget; + ObjectGuid LevitatedTarget; uint32 LevitatedTarget_Timer; bool InAir; uint32 check_Timer; - std::list<uint64> Striders; + SummonList Striders; void Reset() override { @@ -75,9 +75,9 @@ public: StaticCharge_Timer = 10000; SporeStriders_Timer = 10000 + rand32() % 5000; check_Timer = 5000; - LevitatedTarget = 0; + LevitatedTarget.Clear(); LevitatedTarget_Timer = 0; - Striders.clear(); + Striders.DespawnAll(); } void EnterCombat(Unit* /*who*/) override { } @@ -86,7 +86,7 @@ public: { if (summon && summon->GetEntry() == ENTRY_SPORE_STRIDER) { - Striders.push_back(summon->GetGUID()); + Striders.Summon(summon); if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) summon->AI()->AttackStart(target); else @@ -97,9 +97,7 @@ public: void JustDied(Unit* /*killer*/) override { - for (std::list<uint64>::const_iterator i = Striders.begin(); i != Striders.end(); ++i) - if (Creature* strider = ObjectAccessor::GetCreature(*me, *i)) - strider->DisappearAndDie(); + Striders.DespawnAll(); } void UpdateAI(uint32 diff) override @@ -136,13 +134,13 @@ public: { if (!target->HasAura(SPELL_LEVITATE)) { - LevitatedTarget = 0; + LevitatedTarget.Clear(); return; } if (InAir) { target->AddAura(SPELL_SUSPENSION, target); - LevitatedTarget = 0; + LevitatedTarget.Clear(); } else { @@ -152,7 +150,7 @@ public: } } else - LevitatedTarget = 0; + LevitatedTarget.Clear(); } else LevitatedTarget_Timer -= diff; } if (Levitate_Timer <= diff) diff --git a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp index 3b7bb0c4312..0fcc7310d07 100644 --- a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp +++ b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp @@ -250,7 +250,7 @@ public: void JustDied(Unit* /*killer*/) override { - if (Creature* maulgar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MAULGAR))) + if (Creature* maulgar = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MAULGAR))) maulgar->AI()->DoAction(ACTION_ADD_DEATH); instance->SetBossState(DATA_MAULGAR, DONE); @@ -333,7 +333,7 @@ public: void JustDied(Unit* /*killer*/) override { - if (Creature* maulgar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MAULGAR))) + if (Creature* maulgar = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MAULGAR))) maulgar->AI()->DoAction(ACTION_ADD_DEATH); instance->SetBossState(DATA_MAULGAR, DONE); @@ -419,7 +419,7 @@ public: void JustDied(Unit* /*killer*/) override { - if (Creature* maulgar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MAULGAR))) + if (Creature* maulgar = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MAULGAR))) maulgar->AI()->DoAction(ACTION_ADD_DEATH); instance->SetBossState(DATA_MAULGAR, DONE); @@ -496,7 +496,7 @@ public: void JustDied(Unit* /*killer*/) override { - if (Creature* maulgar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MAULGAR))) + if (Creature* maulgar = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MAULGAR))) maulgar->AI()->DoAction(ACTION_ADD_DEATH); instance->SetBossState(DATA_MAULGAR, DONE); diff --git a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp index 3337ce47fd6..5f8bafc736b 100644 --- a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp +++ b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp @@ -48,8 +48,6 @@ class instance_gruuls_lair : public InstanceMapScript SetBossNumber(EncounterCount); LoadDoorData(doorData); LoadMinionData(minionData); - - MaulgarGUID = 0; } void OnCreatureCreate(Creature* creature) override @@ -112,7 +110,7 @@ class instance_gruuls_lair : public InstanceMapScript } } - uint64 GetData64(uint32 type) const override + ObjectGuid GetGuidData(uint32 type) const override { switch (type) { @@ -121,11 +119,11 @@ class instance_gruuls_lair : public InstanceMapScript default: break; } - return 0; + return ObjectGuid::Empty; } protected: - uint64 MaulgarGUID; + ObjectGuid MaulgarGUID; }; InstanceScript* GetInstanceScript(InstanceMap* map) const override diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp index 15c660b4ad7..a0673d4aced 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp @@ -133,7 +133,7 @@ class go_broggok_lever : public GameObjectScript if (instance->GetBossState(DATA_BROGGOK) != DONE && instance->GetBossState(DATA_BROGGOK) != IN_PROGRESS) { instance->SetBossState(DATA_BROGGOK, IN_PROGRESS); - if (Creature* broggok = ObjectAccessor::GetCreature(*go, instance->GetData64(DATA_BROGGOK))) + if (Creature* broggok = ObjectAccessor::GetCreature(*go, instance->GetGuidData(DATA_BROGGOK))) broggok->AI()->DoAction(ACTION_PREPARE_BROGGOK); } diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp index b2f199008d0..da7074b131f 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp @@ -65,8 +65,6 @@ class boss_kelidan_the_breaker : public CreatureScript { boss_kelidan_the_breakerAI(Creature* creature) : BossAI(creature, DATA_KELIDAN_THE_BREAKER) { - for (uint8 i = 0; i < 5; ++i) - Channelers[i] = 0; } uint32 ShadowVolley_Timer; @@ -76,7 +74,7 @@ class boss_kelidan_the_breaker : public CreatureScript uint32 check_Timer; bool Firenova; bool addYell; - uint64 Channelers[5]; + ObjectGuid Channelers[5]; void Reset() override { @@ -116,7 +114,7 @@ class boss_kelidan_the_breaker : public CreatureScript addYell = true; Talk(SAY_ADD_AGGRO); } - for (uint8 i=0; i<5; ++i) + for (uint8 i = 0; i<5; ++i) { Creature* channeler = ObjectAccessor::GetCreature(*me, Channelers[i]); if (who && channeler && !channeler->IsInCombat()) @@ -126,7 +124,7 @@ class boss_kelidan_the_breaker : public CreatureScript void ChannelerDied(Unit* killer) { - for (uint8 i=0; i<5; ++i) + for (uint8 i = 0; i < 5; ++i) { Creature* channeler = ObjectAccessor::GetCreature(*me, Channelers[i]); if (channeler && channeler->IsAlive()) @@ -138,25 +136,25 @@ class boss_kelidan_the_breaker : public CreatureScript AttackStart(killer); } - uint64 GetChanneled(Creature* channeler1) + ObjectGuid GetChanneled(Creature* channeler1) { SummonChannelers(); if (!channeler1) - return 0; + return ObjectGuid::Empty; uint8 i; - for (i=0; i<5; ++i) + for (i = 0; i < 5; ++i) { Creature* channeler = ObjectAccessor::GetCreature(*me, Channelers[i]); if (channeler && channeler->GetGUID() == channeler1->GetGUID()) break; } - return Channelers[(i+2)%5]; + return Channelers[(i + 2) % 5]; } void SummonChannelers() { - for (uint8 i=0; i<5; ++i) + for (uint8 i = 0; i < 5; ++i) { Creature* channeler = ObjectAccessor::GetCreature(*me, Channelers[i]); if (!channeler || channeler->isDead()) @@ -164,7 +162,7 @@ class boss_kelidan_the_breaker : public CreatureScript if (channeler) Channelers[i] = channeler->GetGUID(); else - Channelers[i] = 0; + Channelers[i].Clear(); } } @@ -310,16 +308,19 @@ class npc_shadowmoon_channeler : public CreatureScript if (check_Timer <= diff) { if (!me->IsNonMeleeSpellCast(false)) + { if (Creature* Kelidan = me->FindNearestCreature(ENTRY_KELIDAN, 100)) { - uint64 channeler = ENSURE_AI(boss_kelidan_the_breaker::boss_kelidan_the_breakerAI, Kelidan->AI())->GetChanneled(me); + ObjectGuid channeler = ENSURE_AI(boss_kelidan_the_breaker::boss_kelidan_the_breakerAI, Kelidan->AI())->GetChanneled(me); if (Unit* channeled = ObjectAccessor::GetUnit(*me, channeler)) DoCast(channeled, SPELL_CHANNELING); } + } check_Timer = 5000; } else check_Timer -= diff; + return; } diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp index d88594d9c1e..8e9018a99c9 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp @@ -44,20 +44,6 @@ class instance_blood_furnace : public InstanceMapScript SetBossNumber(EncounterCount); LoadDoorData(doorData); - TheMakerGUID = 0; - BroggokGUID = 0; - KelidanTheBreakerGUID = 0; - - BroggokLeverGUID = 0; - PrisonDoor4GUID = 0; - - memset(PrisonCellGUIDs, 0, 8 * sizeof(uint64)); - - PrisonersCell5.clear(); - PrisonersCell6.clear(); - PrisonersCell7.clear(); - PrisonersCell8.clear(); - PrisonerCounter5 = 0; PrisonerCounter6 = 0; PrisonerCounter7 = 0; @@ -154,7 +140,7 @@ class instance_blood_furnace : public InstanceMapScript } } - uint64 GetData64(uint32 type) const override + ObjectGuid GetGuidData(uint32 type) const override { switch (type) { @@ -168,7 +154,7 @@ class instance_blood_furnace : public InstanceMapScript return BroggokLeverGUID; } - return 0; + return ObjectGuid::Empty; } bool SetBossState(uint32 type, EncounterState state) override @@ -219,9 +205,9 @@ class instance_blood_furnace : public InstanceMapScript HandleGameObject(PrisonCellGUIDs[DATA_PRISON_CELL8 - DATA_PRISON_CELL1], false); } - void ResetPrisoners(const std::set<uint64>& prisoners) + void ResetPrisoners(GuidSet const& prisoners) { - for (std::set<uint64>::const_iterator i = prisoners.begin(); i != prisoners.end(); ++i) + for (GuidSet::const_iterator i = prisoners.begin(); i != prisoners.end(); ++i) if (Creature* prisoner = instance->GetCreature(*i)) ResetPrisoner(prisoner); } @@ -273,7 +259,7 @@ class instance_blood_furnace : public InstanceMapScript ResetPrisoner(creature); } - void PrisonerDied(uint64 guid) + void PrisonerDied(ObjectGuid guid) { if (PrisonersCell5.find(guid) != PrisonersCell5.end() && --PrisonerCounter5 <= 0) ActivateCell(DATA_PRISON_CELL6); @@ -313,9 +299,9 @@ class instance_blood_furnace : public InstanceMapScript } } - void ActivatePrisoners(std::set<uint64> const& prisoners) + void ActivatePrisoners(GuidSet const& prisoners) { - for (std::set<uint64>::const_iterator i = prisoners.begin(); i != prisoners.end(); ++i) + for (GuidSet::const_iterator i = prisoners.begin(); i != prisoners.end(); ++i) if (Creature* prisoner = instance->GetCreature(*i)) { prisoner->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE); @@ -324,19 +310,19 @@ class instance_blood_furnace : public InstanceMapScript } protected: - uint64 TheMakerGUID; - uint64 BroggokGUID; - uint64 KelidanTheBreakerGUID; + ObjectGuid TheMakerGUID; + ObjectGuid BroggokGUID; + ObjectGuid KelidanTheBreakerGUID; - uint64 BroggokLeverGUID; - uint64 PrisonDoor4GUID; + ObjectGuid BroggokLeverGUID; + ObjectGuid PrisonDoor4GUID; - uint64 PrisonCellGUIDs[8]; + ObjectGuid PrisonCellGUIDs[8]; - std::set<uint64>PrisonersCell5; - std::set<uint64>PrisonersCell6; - std::set<uint64>PrisonersCell7; - std::set<uint64>PrisonersCell8; + GuidSet PrisonersCell5; + GuidSet PrisonersCell6; + GuidSet PrisonersCell7; + GuidSet PrisonersCell8; uint8 PrisonerCounter5; uint8 PrisonerCounter6; diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp index 237aa506589..061d6a6a9a8 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp @@ -74,7 +74,7 @@ class boss_omor_the_unscarred : public CreatureScript Shadowbolt_Timer = 2000; Summon_Timer = 10000; SummonedCount = 0; - PlayerGUID = 0; + PlayerGUID.Clear(); CanPullBack = false; _Reset(); @@ -141,7 +141,7 @@ class boss_omor_the_unscarred : public CreatureScript DoCast(temp, SPELL_SHADOW_WHIP); } } - PlayerGUID = 0; + PlayerGUID.Clear(); ShadowWhip_Timer = 2000; CanPullBack = false; } @@ -218,7 +218,7 @@ class boss_omor_the_unscarred : public CreatureScript uint32 Shadowbolt_Timer; uint32 Summon_Timer; uint32 SummonedCount; - uint64 PlayerGUID; + ObjectGuid PlayerGUID; bool CanPullBack; }; diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp index d2a93caf7a3..44c93dc77c9 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp @@ -70,7 +70,6 @@ class boss_nazan : public CreatureScript { boss_nazanAI(Creature* creature) : BossAI(creature, DATA_NAZAN) { - VazrudenGUID = 0; flight = true; } @@ -183,7 +182,7 @@ class boss_nazan : public CreatureScript uint32 Fly_Timer; uint32 Turn_Timer; bool flight; - uint64 VazrudenGUID; + ObjectGuid VazrudenGUID; }; CreatureAI* GetAI(Creature* creature) const override @@ -282,8 +281,6 @@ class boss_vazruden_the_herald : public CreatureScript summoned = false; sentryDown = false; lootSpawned = false; - NazanGUID = 0; - VazrudenGUID = 0; } void Reset() override @@ -304,7 +301,7 @@ class boss_vazruden_the_herald : public CreatureScript if (Nazan) { Nazan->DisappearAndDie(); - NazanGUID = 0; + NazanGUID.Clear(); } Creature* Vazruden = ObjectAccessor::GetCreature(*me, VazrudenGUID); @@ -313,7 +310,7 @@ class boss_vazruden_the_herald : public CreatureScript if (Vazruden) { Vazruden->DisappearAndDie(); - VazrudenGUID = 0; + VazrudenGUID.Clear(); } summoned = false; me->ClearUnitState(UNIT_STATE_ROOT); @@ -435,8 +432,8 @@ class boss_vazruden_the_herald : public CreatureScript uint32 waypoint; uint32 check; bool sentryDown; - uint64 NazanGUID; - uint64 VazrudenGUID; + ObjectGuid NazanGUID; + ObjectGuid VazrudenGUID; bool summoned; bool lootSpawned; }; diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp index c8ffc7d495a..1c3eb6d8c34 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp @@ -40,7 +40,6 @@ class instance_ramparts : public InstanceMapScript { SetHeaders(DataHeader); SetBossNumber(EncounterCount); - felIronChestGUID = 0; } void OnGameObjectCreate(GameObject* go) override @@ -74,7 +73,7 @@ class instance_ramparts : public InstanceMapScript } protected: - uint64 felIronChestGUID; + ObjectGuid felIronChestGUID; bool spawned; }; diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp index 8a5d6e41780..50cdcfe121b 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp @@ -85,7 +85,7 @@ enum Spells //count of clickers needed to interrupt blast nova #define CLICKERS_COUNT 5 -typedef std::map<uint64, uint64> CubeMap; +typedef std::map<ObjectGuid, ObjectGuid> CubeMap; class npc_abyssal : public CreatureScript { @@ -253,10 +253,10 @@ class boss_magtheridon : public CreatureScript instance->SetData(DATA_COLLAPSE, false); } - void SetClicker(uint64 cubeGUID, uint64 clickerGUID) + void SetClicker(ObjectGuid cubeGUID, ObjectGuid clickerGUID) { // to avoid multiclicks from 1 cube - if (uint64 guid = Cube[cubeGUID]) + if (ObjectGuid guid = Cube[cubeGUID]) DebuffClicker(ObjectAccessor::GetUnit(*me, guid)); Cube[cubeGUID] = clickerGUID; NeedCheckCube = true; @@ -284,7 +284,7 @@ class boss_magtheridon : public CreatureScript if (!clicker || !clicker->HasAura(SPELL_SHADOW_GRASP)) { DebuffClicker(clicker); - (*i).second = 0; + (*i).second.Clear(); } else ++ClickerNum; @@ -588,7 +588,7 @@ public: if (instance->GetData(DATA_MAGTHERIDON_EVENT) != IN_PROGRESS) return true; - Creature* Magtheridon =ObjectAccessor::GetCreature(*go, instance->GetData64(DATA_MAGTHERIDON)); + Creature* Magtheridon =ObjectAccessor::GetCreature(*go, instance->GetGuidData(DATA_MAGTHERIDON)); if (!Magtheridon || !Magtheridon->IsAlive()) return true; diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp index 45262f9109c..db0159d1a2d 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp @@ -58,10 +58,10 @@ class instance_magtheridons_lair : public InstanceMapScript uint32 m_auiEncounter[MAX_ENCOUNTER]; - uint64 MagtheridonGUID; - std::set<uint64> ChannelerGUID; - uint64 DoorGUID; - std::set<uint64> ColumnGUID; + ObjectGuid MagtheridonGUID; + GuidSet ChannelerGUID; + ObjectGuid DoorGUID; + GuidSet ColumnGUID; uint32 CageTimer; uint32 RespawnTimer; @@ -71,11 +71,6 @@ class instance_magtheridons_lair : public InstanceMapScript SetHeaders(DataHeader); memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - MagtheridonGUID = 0; - ChannelerGUID.clear(); - DoorGUID = 0; - ColumnGUID.clear(); - CageTimer = 0; RespawnTimer = 0; } @@ -124,14 +119,14 @@ class instance_magtheridons_lair : public InstanceMapScript } } - uint64 GetData64(uint32 type) const override + ObjectGuid GetGuidData(uint32 type) const override { switch (type) { case DATA_MAGTHERIDON: return MagtheridonGUID; } - return 0; + return ObjectGuid::Empty; } void SetData(uint32 type, uint32 data) override @@ -152,7 +147,7 @@ class instance_magtheridons_lair : public InstanceMapScript if (m_auiEncounter[1] != NOT_STARTED) { m_auiEncounter[1] = NOT_STARTED; - for (std::set<uint64>::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) + for (GuidSet::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) { if (Creature* Channeler = instance->GetCreature(*i)) { @@ -171,7 +166,7 @@ class instance_magtheridons_lair : public InstanceMapScript { m_auiEncounter[1] = IN_PROGRESS; // Let all five channelers aggro. - for (std::set<uint64>::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) + for (GuidSet::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) { Creature* Channeler = instance->GetCreature(*i); if (Channeler && Channeler->IsAlive()) @@ -188,7 +183,7 @@ class instance_magtheridons_lair : public InstanceMapScript } break; case DONE: // Add buff and check if all channelers are dead. - for (std::set<uint64>::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) + for (GuidSet::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) { Creature* Channeler = instance->GetCreature(*i); if (Channeler && Channeler->IsAlive()) @@ -204,7 +199,7 @@ class instance_magtheridons_lair : public InstanceMapScript break; case DATA_COLLAPSE: // true - collapse / false - reset - for (std::set<uint64>::const_iterator i = ColumnGUID.begin(); i != ColumnGUID.end(); ++i) + for (GuidSet::const_iterator i = ColumnGUID.begin(); i != ColumnGUID.end(); ++i) DoUseDoorOrButton(*i); break; default: @@ -239,7 +234,7 @@ class instance_magtheridons_lair : public InstanceMapScript { if (RespawnTimer <= diff) { - for (std::set<uint64>::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) + for (GuidSet::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) { if (Creature* Channeler = instance->GetCreature(*i)) { diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp index 9a8f83fa1c2..741d5b78285 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp @@ -323,7 +323,7 @@ class npc_fel_orc_convert : public CreatureScript { events.ScheduleEvent(EVENT_HEMORRHAGE, 3000); - if (Creature* Kurse = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_GRAND_WARLOCK_NETHEKURSE))) + if (Creature* Kurse = ObjectAccessor::GetCreature(*me, instance->GetGuidData(NPC_GRAND_WARLOCK_NETHEKURSE))) if (me->IsWithinDist(Kurse, 45.0f)) Kurse->AI()->SetData(SETDATA_DATA, SETDATA_PEON_AGGRO); } @@ -333,7 +333,7 @@ class npc_fel_orc_convert : public CreatureScript if (instance->GetBossState(DATA_NETHEKURSE) != IN_PROGRESS) return; - if (Creature* Kurse = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_GRAND_WARLOCK_NETHEKURSE))) + if (Creature* Kurse = ObjectAccessor::GetCreature(*me, instance->GetGuidData(NPC_GRAND_WARLOCK_NETHEKURSE))) Kurse->AI()->SetData(SETDATA_DATA, SETDATA_PEON_DEATH); } diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp index d61c40f8e3b..f60c65b0b7a 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp @@ -136,8 +136,6 @@ class boss_warbringer_omrogg : public CreatureScript { boss_warbringer_omroggAI(Creature* creature) : BossAI(creature, DATA_OMROGG) { - LeftHeadGUID = 0; - RightHeadGUID = 0; } void Reset() override @@ -145,13 +143,13 @@ class boss_warbringer_omrogg : public CreatureScript if (Unit* LeftHead = ObjectAccessor::GetUnit(*me, LeftHeadGUID)) { LeftHead->setDeathState(JUST_DIED); - LeftHeadGUID = 0; + LeftHeadGUID.Clear(); } if (Unit* RightHead = ObjectAccessor::GetUnit(*me, RightHeadGUID)) { RightHead->setDeathState(JUST_DIED); - RightHeadGUID = 0; + RightHeadGUID.Clear(); } AggroYell = false; @@ -363,8 +361,8 @@ class boss_warbringer_omrogg : public CreatureScript } private: - uint64 LeftHeadGUID; - uint64 RightHeadGUID; + ObjectGuid LeftHeadGUID; + ObjectGuid RightHeadGUID; int iaggro; int ithreat; int ikilling; diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp index f1dfcc2b391..7145ebfd7aa 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp @@ -143,7 +143,7 @@ class boss_warchief_kargath_bladefist : public CreatureScript void removeAdds() { - for (std::vector<uint64>::const_iterator itr = adds.begin(); itr!= adds.end(); ++itr) + for (GuidVector::const_iterator itr = adds.begin(); itr!= adds.end(); ++itr) { Creature* creature = ObjectAccessor::GetCreature(*me, *itr); if (creature && creature->IsAlive()) @@ -155,7 +155,7 @@ class boss_warchief_kargath_bladefist : public CreatureScript } adds.clear(); - for (std::vector<uint64>::const_iterator itr = assassins.begin(); itr!= assassins.end(); ++itr) + for (GuidVector::const_iterator itr = assassins.begin(); itr!= assassins.end(); ++itr) { Creature* creature = ObjectAccessor::GetCreature(*me, *itr); if (creature && creature->IsAlive()) @@ -295,8 +295,8 @@ class boss_warchief_kargath_bladefist : public CreatureScript } private: - std::vector<uint64> adds; - std::vector<uint64> assassins; + GuidVector adds; + GuidVector assassins; uint32 Charge_timer; uint32 Blade_Dance_Timer; uint32 Summon_Assistant_Timer; diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp index 8ee63ff03a2..838297aa21f 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp @@ -45,9 +45,6 @@ class instance_shattered_halls : public InstanceMapScript { SetHeaders(DataHeader); SetBossNumber(EncounterCount); - nethekurseGUID = 0; - nethekurseDoor1GUID = 0; - nethekurseDoor2GUID = 0; } void OnGameObjectCreate(GameObject* go) override @@ -98,7 +95,7 @@ class instance_shattered_halls : public InstanceMapScript return true; } - uint64 GetData64(uint32 data) const override + ObjectGuid GetGuidData(uint32 data) const override { switch (data) { @@ -112,13 +109,13 @@ class instance_shattered_halls : public InstanceMapScript return nethekurseDoor2GUID; break; } - return 0; + return ObjectGuid::Empty; } protected: - uint64 nethekurseGUID; - uint64 nethekurseDoor1GUID; - uint64 nethekurseDoor2GUID; + ObjectGuid nethekurseGUID; + ObjectGuid nethekurseDoor1GUID; + ObjectGuid nethekurseDoor2GUID; }; }; diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp index 09cb72f1a47..8dd1aad5d4d 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp @@ -178,7 +178,7 @@ class boss_alar : public CreatureScript me->RemoveAllAuras(); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->AttackStop(); - me->SetTarget(0); + me->SetTarget(ObjectGuid::Empty); me->SetSpeed(MOVE_RUN, 5.0f); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MovePoint(0, waypoint[5][0], waypoint[5][1], waypoint[5][2]); @@ -494,7 +494,7 @@ class npc_ember_of_alar : public CreatureScript me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); if (instance->GetData(DATA_ALAREVENT) == 2) { - if (Unit* Alar = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_ALAR))) + if (Unit* Alar = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_ALAR))) { int32 AlarHealth = int32(Alar->GetHealth()) - int32(Alar->CountPctFromMaxHealth(3)); if (AlarHealth > 0) diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp index 63c01540af2..0a9e5665ec8 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp @@ -464,7 +464,7 @@ class npc_solarium_priest : public CreatureScript switch (urand(0, 1)) { case 0: - target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_ASTROMANCER)); + target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_ASTROMANCER)); break; case 1: target = me; diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp index 64deebce8b8..8b23ee172af 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp @@ -163,7 +163,7 @@ struct advisorbase_ai : public ScriptedAI bool FakeDeath; bool m_bDoubled_Health; uint32 DelayRes_Timer; - uint64 DelayRes_Target; + ObjectGuid DelayRes_Target; void Reset() override { @@ -175,7 +175,7 @@ struct advisorbase_ai : public ScriptedAI FakeDeath = false; DelayRes_Timer = 0; - DelayRes_Target = 0; + DelayRes_Target.Clear(); me->SetStandState(UNIT_STAND_STATE_STAND); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); @@ -183,7 +183,7 @@ struct advisorbase_ai : public ScriptedAI //reset encounter if (instance->GetData(DATA_KAELTHASEVENT) == 1 || instance->GetData(DATA_KAELTHASEVENT) == 3) - if (Creature* Kaelthas = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KAELTHAS))) + if (Creature* Kaelthas = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KAELTHAS))) Kaelthas->AI()->EnterEvadeMode(); } @@ -245,7 +245,7 @@ struct advisorbase_ai : public ScriptedAI me->ModifyAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, false); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->ClearAllReactives(); - me->SetTarget(0); + me->SetTarget(ObjectGuid::Empty); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveIdle(); me->SetStandState(UNIT_STAND_STATE_DEAD); @@ -290,7 +290,6 @@ class boss_kaelthas : public CreatureScript boss_kaelthasAI(Creature* creature) : ScriptedAI(creature), summons(me) { instance = creature->GetInstanceScript(); - memset(&m_auiAdvisorGuid, 0, sizeof(m_auiAdvisorGuid)); } InstanceScript* instance; @@ -316,7 +315,7 @@ class boss_kaelthas : public CreatureScript SummonList summons; - uint64 m_auiAdvisorGuid[MAX_ADVISORS]; + ObjectGuid m_auiAdvisorGuid[MAX_ADVISORS]; void Reset() override { @@ -363,10 +362,10 @@ class boss_kaelthas : public CreatureScript void StartEvent() { - m_auiAdvisorGuid[0] = instance->GetData64(DATA_THALADREDTHEDARKENER); - m_auiAdvisorGuid[1] = instance->GetData64(DATA_LORDSANGUINAR); - m_auiAdvisorGuid[2] = instance->GetData64(DATA_GRANDASTROMANCERCAPERNIAN); - m_auiAdvisorGuid[3] = instance->GetData64(DATA_MASTERENGINEERTELONICUS); + m_auiAdvisorGuid[0] = instance->GetGuidData(DATA_THALADREDTHEDARKENER); + m_auiAdvisorGuid[1] = instance->GetGuidData(DATA_LORDSANGUINAR); + m_auiAdvisorGuid[2] = instance->GetGuidData(DATA_GRANDASTROMANCERCAPERNIAN); + m_auiAdvisorGuid[3] = instance->GetGuidData(DATA_MASTERENGINEERTELONICUS); if (!m_auiAdvisorGuid[0] || !m_auiAdvisorGuid[1] || !m_auiAdvisorGuid[2] || !m_auiAdvisorGuid[3]) { @@ -927,7 +926,7 @@ class boss_kaelthas : public CreatureScript //Using packet workaround WorldPacket data(SMSG_MOVE_SET_CAN_FLY, 12); - data.append(unit->GetPackGUID()); + data << unit->GetPackGUID(); data << uint32(0); unit->SendMessageToSet(&data, true); } @@ -953,7 +952,7 @@ class boss_kaelthas : public CreatureScript { //Using packet workaround WorldPacket data(SMSG_MOVE_UNSET_CAN_FLY, 12); - data.append(unit->GetPackGUID()); + data << unit->GetPackGUID(); data << uint32(0); unit->SendMessageToSet(&data, true); } diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp index 6b78706b437..b518eb1cb8b 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp @@ -137,7 +137,7 @@ class boss_void_reaver : public CreatureScript target = me->GetVictim(); if (target) - me->CastSpell(target, SPELL_ARCANE_ORB, false, NULL, NULL, 0); + me->CastSpell(target, SPELL_ARCANE_ORB, false, NULL, NULL); ArcaneOrb_Timer = 3000; } else diff --git a/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp b/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp index 07cbd68f741..2234547c76a 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp @@ -48,13 +48,13 @@ class instance_the_eye : public InstanceMapScript { instance_the_eye_InstanceMapScript(Map* map) : InstanceScript(map) { } - uint64 ThaladredTheDarkener; - uint64 LordSanguinar; - uint64 GrandAstromancerCapernian; - uint64 MasterEngineerTelonicus; - uint64 Kaelthas; - uint64 Astromancer; - uint64 Alar; + ObjectGuid ThaladredTheDarkener; + ObjectGuid LordSanguinar; + ObjectGuid GrandAstromancerCapernian; + ObjectGuid MasterEngineerTelonicus; + ObjectGuid Kaelthas; + ObjectGuid Astromancer; + ObjectGuid Alar; uint8 KaelthasEventPhase; uint8 AlarEventPhase; @@ -65,14 +65,6 @@ class instance_the_eye : public InstanceMapScript SetHeaders(DataHeader); memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - ThaladredTheDarkener = 0; - LordSanguinar = 0; - GrandAstromancerCapernian = 0; - MasterEngineerTelonicus = 0; - Kaelthas = 0; - Astromancer = 0; - Alar = 0; - KaelthasEventPhase = 0; AlarEventPhase = 0; } @@ -114,7 +106,7 @@ class instance_the_eye : public InstanceMapScript } } - uint64 GetData64(uint32 identifier) const override + ObjectGuid GetGuidData(uint32 identifier) const override { switch (identifier) { @@ -126,7 +118,7 @@ class instance_the_eye : public InstanceMapScript case DATA_ASTROMANCER: return Astromancer; case DATA_ALAR: return Alar; } - return 0; + return ObjectGuid::Empty; } void SetData(uint32 type, uint32 data) override diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp index 3befc3742ff..1a8658c8fbc 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp @@ -322,7 +322,7 @@ class npc_warden_mellichar : public CreatureScript DoCast(me, SPELL_BUBBLE_VISUAL); instance->SetBossState(DATA_HARBINGER_SKYRISS, IN_PROGRESS); - instance->HandleGameObject(instance->GetData64(DATA_WARDENS_SHIELD), false); + instance->HandleGameObject(instance->GetGuidData(DATA_WARDENS_SHIELD), false); IsRunning = true; } @@ -356,7 +356,7 @@ class npc_warden_mellichar : public CreatureScript case 2: DoCast(me, SPELL_TARGET_ALPHA); instance->SetData(DATA_WARDEN_1, IN_PROGRESS); - instance->HandleGameObject(instance->GetData64(DATA_WARDENS_SHIELD), false); + instance->HandleGameObject(instance->GetGuidData(DATA_WARDENS_SHIELD), false); break; case 3: DoCast(me, SPELL_TARGET_BETA); diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_dalliah_the_doomsayer.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_dalliah_the_doomsayer.cpp index 41bc93cfdfe..71e23a65d66 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_dalliah_the_doomsayer.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_dalliah_the_doomsayer.cpp @@ -77,7 +77,7 @@ class boss_dalliah_the_doomsayer : public CreatureScript _JustDied(); Talk(SAY_DEATH); - if (Creature* soccothrates = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SOCCOTHRATES))) + if (Creature* soccothrates = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SOCCOTHRATES))) if (soccothrates->IsAlive() && !soccothrates->IsInCombat()) soccothrates->AI()->SetData(1, 1); } @@ -163,7 +163,7 @@ class boss_dalliah_the_doomsayer : public CreatureScript events.ScheduleEvent(EVENT_SHADOW_WAVE, urand(11000, 16000)); break; case EVENT_ME_FIRST: - if (Creature* soccothrates = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SOCCOTHRATES))) + if (Creature* soccothrates = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SOCCOTHRATES))) if (soccothrates->IsAlive() && !soccothrates->IsInCombat()) soccothrates->AI()->Talk(SAY_AGGRO_DALLIAH_FIRST); break; @@ -174,7 +174,7 @@ class boss_dalliah_the_doomsayer : public CreatureScript if (HealthBelowPct(25) && !soccothratesTaunt) { - if (Creature* soccothrates = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SOCCOTHRATES))) + if (Creature* soccothrates = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SOCCOTHRATES))) soccothrates->AI()->Talk(SAY_DALLIAH_25_PERCENT); soccothratesTaunt = true; } diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp index 7563ecb40db..ec22baf2d4e 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp @@ -158,18 +158,18 @@ class boss_harbinger_skyriss : public CreatureScript { case 1: Talk(SAY_INTRO); - instance->HandleGameObject(instance->GetData64(DATA_WARDENS_SHIELD), true); + instance->HandleGameObject(instance->GetGuidData(DATA_WARDENS_SHIELD), true); ++Intro_Phase; Intro_Timer = 25000; break; case 2: Talk(SAY_AGGRO); - if (Unit* mellic = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_MELLICHAR))) + if (Unit* mellic = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_MELLICHAR))) { //should have a better way to do this. possibly spell exist. mellic->setDeathState(JUST_DIED); mellic->SetHealth(0); - instance->HandleGameObject(instance->GetData64(DATA_WARDENS_SHIELD), false); + instance->HandleGameObject(instance->GetGuidData(DATA_WARDENS_SHIELD), false); } ++Intro_Phase; Intro_Timer = 3000; diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp index a519ec7207c..27de2786243 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp @@ -103,7 +103,7 @@ class boss_wrath_scryer_soccothrates : public CreatureScript _JustDied(); Talk(SAY_DEATH); - if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALLIAH))) + if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DALLIAH))) if (dalliah->IsAlive() && !dalliah->IsInCombat()) dalliah->AI()->SetData(1, 1); } @@ -161,7 +161,7 @@ class boss_wrath_scryer_soccothrates : public CreatureScript switch (eventId) { case EVENT_PREFIGHT_1: - if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALLIAH))) + if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DALLIAH))) dalliah->AI()->Talk(SAY_DALLIAH_CONVO_1); events.ScheduleEvent(EVENT_PREFIGHT_2, 3000); break; @@ -170,7 +170,7 @@ class boss_wrath_scryer_soccothrates : public CreatureScript events.ScheduleEvent(EVENT_PREFIGHT_3, 3000); break; case EVENT_PREFIGHT_3: - if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALLIAH))) + if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DALLIAH))) dalliah->AI()->Talk(SAY_DALLIAH_CONVO_2); events.ScheduleEvent(EVENT_PREFIGHT_4, 6000); break; @@ -179,7 +179,7 @@ class boss_wrath_scryer_soccothrates : public CreatureScript events.ScheduleEvent(EVENT_PREFIGHT_5, 2000); break; case EVENT_PREFIGHT_5: - if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALLIAH))) + if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DALLIAH))) dalliah->AI()->Talk(SAY_DALLIAH_CONVO_3); events.ScheduleEvent(EVENT_PREFIGHT_6, 3000); break; @@ -188,7 +188,7 @@ class boss_wrath_scryer_soccothrates : public CreatureScript events.ScheduleEvent(EVENT_PREFIGHT_7, 2000); break; case EVENT_PREFIGHT_7: - if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALLIAH))) + if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DALLIAH))) dalliah->GetMotionMaster()->MovePoint(0, 118.6048f, 96.84852f, 22.44115f); events.ScheduleEvent(EVENT_PREFIGHT_8, 4000); break; @@ -197,7 +197,7 @@ class boss_wrath_scryer_soccothrates : public CreatureScript events.ScheduleEvent(EVENT_PREFIGHT_9, 4000); break; case EVENT_PREFIGHT_9: - if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALLIAH))) + if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DALLIAH))) { dalliah->SetFacingToObject(me); me->SetFacingToObject(dalliah); @@ -251,7 +251,7 @@ class boss_wrath_scryer_soccothrates : public CreatureScript events.ScheduleEvent(EVENT_KNOCK_AWAY, urand(11000, 12000)); break; case EVENT_ME_FIRST: - if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALLIAH))) + if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DALLIAH))) if (dalliah->IsAlive() && !dalliah->IsInCombat()) dalliah->AI()->Talk(SAY_AGGRO_SOCCOTHRATES_FIRST); break; @@ -262,7 +262,7 @@ class boss_wrath_scryer_soccothrates : public CreatureScript if (HealthBelowPct(25) && !dalliahTaunt) { - if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALLIAH))) + if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DALLIAH))) dalliah->AI()->Talk(SAY_SOCCOTHRATES_25_PERCENT); dalliahTaunt = true; } diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp index b092243637b..984af86e645 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp @@ -39,14 +39,8 @@ class instance_arcatraz : public InstanceMapScript SetBossNumber(EncounterCount); LoadDoorData(doorData); - DalliahGUID = 0; - SoccothratesGUID = 0; - MellicharGUID = 0; - WardensShieldGUID = 0; - ConversationState = NOT_STARTED; - memset(StasisPodGUIDs, 0, 5 * sizeof(uint64)); memset(StasisPodStates, NOT_STARTED, 5 * sizeof(uint8)); } @@ -151,7 +145,7 @@ class instance_arcatraz : public InstanceMapScript return 0; } - uint64 GetData64(uint32 data) const override + ObjectGuid GetGuidData(uint32 data) const override { switch (data) { @@ -166,7 +160,7 @@ class instance_arcatraz : public InstanceMapScript default: break; } - return 0; + return ObjectGuid::Empty; } bool SetBossState(uint32 type, EncounterState state) override @@ -193,11 +187,11 @@ class instance_arcatraz : public InstanceMapScript } protected: - uint64 DalliahGUID; - uint64 SoccothratesGUID; - uint64 StasisPodGUIDs[5]; - uint64 MellicharGUID; - uint64 WardensShieldGUID; + ObjectGuid DalliahGUID; + ObjectGuid SoccothratesGUID; + ObjectGuid StasisPodGUIDs[5]; + ObjectGuid MellicharGUID; + ObjectGuid WardensShieldGUID; uint8 ConversationState; uint8 StasisPodStates[5]; diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp index 0c322877808..c0591f7b874 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp +++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp @@ -66,8 +66,6 @@ class boss_high_botanist_freywinn : public CreatureScript { boss_high_botanist_freywinnAI(Creature* creature) : BossAI(creature, DATA_HIGH_BOTANIST_FREYWINN) { } - std::list<uint64> Adds_List; - uint32 SummonSeedling_Timer; uint32 TreeForm_Timer; uint32 MoveCheck_Timer; @@ -76,7 +74,7 @@ class boss_high_botanist_freywinn : public CreatureScript void Reset() override { - Adds_List.clear(); + summons.DespawnAll(); SummonSeedling_Timer = 6000; TreeForm_Timer = 30000; @@ -93,7 +91,12 @@ class boss_high_botanist_freywinn : public CreatureScript void JustSummoned(Creature* summoned) override { if (summoned->GetEntry() == NPC_FRAYER) - Adds_List.push_back(summoned->GetGUID()); + summons.Summon(summoned); + } + + void SummonedCreatureDespawn(Creature* summon) override + { + summons.Despawn(summon); } void DoSummonSeedling() @@ -147,18 +150,15 @@ class boss_high_botanist_freywinn : public CreatureScript { if (MoveCheck_Timer <= diff) { - if (!Adds_List.empty()) + for (SummonList::iterator itr = summons.begin(); itr != summons.end(); ++itr) { - for (std::list<uint64>::iterator itr = Adds_List.begin(); itr != Adds_List.end(); ++itr) + if (Unit* temp = ObjectAccessor::GetUnit(*me, *itr)) { - if (Unit* temp = ObjectAccessor::GetUnit(*me, *itr)) + if (!temp->IsAlive()) { - if (!temp->IsAlive()) - { - Adds_List.erase(itr); - ++DeadAddsCount; - break; - } + summons.erase(itr); + ++DeadAddsCount; + break; } } } @@ -168,7 +168,7 @@ class boss_high_botanist_freywinn : public CreatureScript if (DeadAddsCount >= 3) { - Adds_List.clear(); + summons.DespawnAll(); DeadAddsCount = 0; me->InterruptNonMeleeSpells(true); diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp index 8bc9d0982e3..56c62bbf50f 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp +++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp @@ -74,10 +74,9 @@ class npc_warp_splinter_treant : public CreatureScript { npc_warp_splinter_treantAI(Creature* creature) : ScriptedAI(creature) { - WarpGuid = 0; } - uint64 WarpGuid; + ObjectGuid WarpGuid; uint32 check_Timer; void Reset() override diff --git a/src/server/scripts/Outland/TempestKeep/botanica/instance_the_botanica.cpp b/src/server/scripts/Outland/TempestKeep/botanica/instance_the_botanica.cpp index eb46211fa59..19453bd3925 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/instance_the_botanica.cpp +++ b/src/server/scripts/Outland/TempestKeep/botanica/instance_the_botanica.cpp @@ -29,11 +29,6 @@ class instance_the_botanica : public InstanceMapScript instance_the_botanica_InstanceMapScript(Map* map) : InstanceScript(map) { SetHeaders(DataHeader); - CommanderSarannisGUID = 0; - HighBotanistFreywinnGUID = 0; - ThorngrinTheTenderGUID = 0; - LajGUID = 0; - WarpSplinterGUID = 0; } void OnCreatureCreate(Creature* creature) override @@ -60,7 +55,7 @@ class instance_the_botanica : public InstanceMapScript } } - uint64 GetData64(uint32 type) const override + ObjectGuid GetGuidData(uint32 type) const override { switch (type) { @@ -78,7 +73,7 @@ class instance_the_botanica : public InstanceMapScript break; } - return 0; + return ObjectGuid::Empty; } bool SetBossState(uint32 type, EncounterState state) override @@ -102,11 +97,11 @@ class instance_the_botanica : public InstanceMapScript } protected: - uint64 CommanderSarannisGUID; - uint64 HighBotanistFreywinnGUID; - uint64 ThorngrinTheTenderGUID; - uint64 LajGUID; - uint64 WarpSplinterGUID; + ObjectGuid CommanderSarannisGUID; + ObjectGuid HighBotanistFreywinnGUID; + ObjectGuid ThorngrinTheTenderGUID; + ObjectGuid LajGUID; + ObjectGuid WarpSplinterGUID; }; InstanceScript* GetInstanceScript(InstanceMap* map) const override diff --git a/src/server/scripts/Outland/boss_doomwalker.cpp b/src/server/scripts/Outland/boss_doomwalker.cpp index a193e8ff880..7b72da0b02e 100644 --- a/src/server/scripts/Outland/boss_doomwalker.cpp +++ b/src/server/scripts/Outland/boss_doomwalker.cpp @@ -94,7 +94,7 @@ class boss_doomwalker : public CreatureScript { if (who && who->GetTypeId() == TYPEID_PLAYER && me->IsValidAttackTarget(who)) - if (who->HasAura(SPELL_MARK_DEATH, 0)) + if (who->HasAura(SPELL_MARK_DEATH)) who->CastSpell(who, SPELL_AURA_DEATH, 1); } diff --git a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp index 03b8e7e69c8..b5e54fe85f0 100644 --- a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp +++ b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp @@ -115,13 +115,12 @@ public: { npc_bloodmaul_bruteAI(Creature* creature) : ScriptedAI(creature) { - PlayerGUID = 0; hp30 = false; } void Reset() override { - PlayerGUID = 0; + PlayerGUID.Clear(); hp30 = false; } @@ -207,7 +206,7 @@ public: private: EventMap events; - uint64 PlayerGUID; + ObjectGuid PlayerGUID; bool hp30; }; @@ -617,7 +616,7 @@ class npc_simon_bunny : public CreatureScript uint8 gameLevel; uint8 fails; uint8 gameTicks; - uint64 playerGUID; + ObjectGuid playerGUID; uint32 clusterIds[SIMON_MAX_COLORS]; float zCoordCorrection; float searchDistance; @@ -727,7 +726,7 @@ class npc_simon_bunny : public CreatureScript } // Used for getting involved player guid. Parameter id is used for defining if is a large(Monument) or small(Relic) node - void SetGUID(uint64 guid, int32 id) override + void SetGUID(ObjectGuid guid, int32 id) override { me->SetCanFly(true); @@ -1131,7 +1130,6 @@ public: { npc_oscillating_frequency_scanner_master_bunnyAI(Creature* creature) : ScriptedAI(creature) { - playerGuid = 0; timer = 500; } @@ -1170,7 +1168,7 @@ public: } private: - uint64 playerGuid; + ObjectGuid playerGuid; uint32 timer; }; diff --git a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp index 0da70207a04..01ad2ce334f 100644 --- a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp +++ b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp @@ -310,7 +310,7 @@ public: void Reset() override { checkTimer = 5000; //check for creature every 5 sec - helboarGUID = 0; + helboarGUID.Clear(); } void MovementInform(uint32 type, uint32 id) override @@ -352,7 +352,7 @@ public: private: uint32 checkTimer; - uint64 helboarGUID; + ObjectGuid helboarGUID; }; CreatureAI* GetAI(Creature* creature) const override diff --git a/src/server/scripts/Outland/zone_nagrand.cpp b/src/server/scripts/Outland/zone_nagrand.cpp index a8a99d757e7..b8dd1393600 100644 --- a/src/server/scripts/Outland/zone_nagrand.cpp +++ b/src/server/scripts/Outland/zone_nagrand.cpp @@ -299,7 +299,7 @@ public: { corki->GetMotionMaster()->MovePoint(1, go->GetPositionX()+5, go->GetPositionY(), go->GetPositionZ()); if (player) - player->KilledMonsterCredit(NPC_CORKI_CREDIT_1, 0); + player->KilledMonsterCredit(NPC_CORKI_CREDIT_1); } } @@ -309,7 +309,7 @@ public: { corki->GetMotionMaster()->MovePoint(1, go->GetPositionX()-5, go->GetPositionY(), go->GetPositionZ()); if (player) - player->KilledMonsterCredit(NPC_CORKI_2, 0); + player->KilledMonsterCredit(NPC_CORKI_2); } } @@ -319,7 +319,7 @@ public: { corki->GetMotionMaster()->MovePoint(1, go->GetPositionX()+4, go->GetPositionY(), go->GetPositionZ()); if (player) - player->KilledMonsterCredit(NPC_CORKI_CREDIT_3, 0); + player->KilledMonsterCredit(NPC_CORKI_CREDIT_3); } } return true; @@ -594,7 +594,7 @@ class go_warmaul_prison : public GameObjectScript if (Creature* prisoner = go->FindNearestCreature(NPC_MAGHAR_PRISONER, 5.0f)) { - player->KilledMonsterCredit(NPC_MAGHAR_PRISONER, 0); + player->KilledMonsterCredit(NPC_MAGHAR_PRISONER); prisoner->AI()->Talk(SAY_FREE, player); prisoner->DespawnOrUnsummon(6000); diff --git a/src/server/scripts/Outland/zone_netherstorm.cpp b/src/server/scripts/Outland/zone_netherstorm.cpp index f82c1f5fb58..eb2fae03202 100644 --- a/src/server/scripts/Outland/zone_netherstorm.cpp +++ b/src/server/scripts/Outland/zone_netherstorm.cpp @@ -83,9 +83,9 @@ public: { npc_commander_dawnforgeAI(Creature* creature) : ScriptedAI(creature) { } - uint64 PlayerGUID; - uint64 ardonisGUID; - uint64 pathaleonGUID; + ObjectGuid PlayerGUID; + ObjectGuid ardonisGUID; + ObjectGuid pathaleonGUID; uint32 Phase; uint32 PhaseSubphase; @@ -94,9 +94,9 @@ public: void Reset() override { - PlayerGUID = 0; - ardonisGUID = 0; - pathaleonGUID = 0; + PlayerGUID.Clear(); + ardonisGUID.Clear(); + pathaleonGUID.Clear(); Phase = 1; PhaseSubphase = 0; @@ -415,7 +415,6 @@ public: Materialize = false; Drained = false; WeakPercent = 25; - PlayerGUID = 0; ManaBurnTimer = 5000; } @@ -424,7 +423,7 @@ public: bool Drained; uint8 WeakPercent; - uint64 PlayerGUID; + ObjectGuid PlayerGUID; uint32 ManaBurnTimer; @@ -435,7 +434,7 @@ public: Drained = false; WeakPercent = 25 + (rand32() % 16); // 25-40 - PlayerGUID = 0; + PlayerGUID.Clear(); ManaBurnTimer = 5000 + (rand32() % 3 * 1000); // 5-8 sec cd @@ -725,7 +724,7 @@ class go_captain_tyralius_prison : public GameObjectScript go->UseDoorOrButton(); if (Creature* tyralius = go->FindNearestCreature(NPC_CAPTAIN_TYRALIUS, 1.0f)) { - player->KilledMonsterCredit(NPC_CAPTAIN_TYRALIUS, 0); + player->KilledMonsterCredit(NPC_CAPTAIN_TYRALIUS); tyralius->AI()->Talk(SAY_FREE); tyralius->DespawnOrUnsummon(8000); } diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp index db34665e641..358b5d44387 100644 --- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp @@ -80,7 +80,7 @@ public: { npc_mature_netherwing_drakeAI(Creature* creature) : ScriptedAI(creature) { } - uint64 uiPlayerGUID; + ObjectGuid uiPlayerGUID; bool bCanEat; bool bIsEating; @@ -90,7 +90,7 @@ public: void Reset() override { - uiPlayerGUID = 0; + uiPlayerGUID.Clear(); bCanEat = false; bIsEating = false; @@ -154,7 +154,7 @@ public: if (Player* player = ObjectAccessor::GetPlayer(*me, uiPlayerGUID)) { - player->KilledMonsterCredit(NPC_EVENT_PINGER, 0); + player->KilledMonsterCredit(NPC_EVENT_PINGER); if (GameObject* go = player->FindNearestGameObject(GO_CARCASS, 10)) go->Delete(); @@ -218,12 +218,11 @@ public: { npc_enslaved_netherwing_drakeAI(Creature* creature) : ScriptedAI(creature) { - PlayerGUID = 0; Tapped = false; Reset(); } - uint64 PlayerGUID; + ObjectGuid PlayerGUID; uint32 FlyTimer; bool Tapped; @@ -276,7 +275,7 @@ public: if (player) DoCast(player, SPELL_FORCE_OF_NELTHARAKU, true); - PlayerGUID = 0; + PlayerGUID.Clear(); } me->SetVisible(false); me->SetDisableGravity(false); @@ -349,13 +348,13 @@ public: { npc_dragonmaw_peonAI(Creature* creature) : ScriptedAI(creature) { } - uint64 PlayerGUID; + ObjectGuid PlayerGUID; bool Tapped; uint32 PoisonTimer; void Reset() override { - PlayerGUID = 0; + PlayerGUID.Clear(); Tapped = false; PoisonTimer = 0; } @@ -400,7 +399,7 @@ public: { Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID); if (player && player->GetQuestStatus(11020) == QUEST_STATUS_INCOMPLETE) - player->KilledMonsterCredit(23209, 0); + player->KilledMonsterCredit(23209); } PoisonTimer = 0; me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); @@ -583,8 +582,8 @@ public: { npc_overlord_morghorAI(Creature* creature) : ScriptedAI(creature) { } - uint64 PlayerGUID; - uint64 IllidanGUID; + ObjectGuid PlayerGUID; + ObjectGuid IllidanGUID; uint32 ConversationTimer; uint32 Step; @@ -593,8 +592,8 @@ public: void Reset() override { - PlayerGUID = 0; - IllidanGUID = 0; + PlayerGUID.Clear(); + IllidanGUID.Clear(); ConversationTimer = 0; Step = 0; @@ -798,7 +797,7 @@ public: case 30: { if (Creature* Yarzill = me->FindNearestCreature(C_YARZILL, 50.0f)) - Yarzill->SetTarget(0); + Yarzill->SetTarget(ObjectGuid::Empty); return 5000; } break; @@ -814,7 +813,7 @@ public: return 5000; break; case 33: - me->SetTarget(0); + me->SetTarget(ObjectGuid::Empty); Reset(); return 100; break; @@ -1123,8 +1122,8 @@ public: uint8 AnimationCount; - uint64 LordIllidanGUID; - uint64 AggroTargetGUID; + ObjectGuid LordIllidanGUID; + ObjectGuid AggroTargetGUID; bool Timers; @@ -1132,13 +1131,13 @@ public: { AnimationTimer = 4000; AnimationCount = 0; - LordIllidanGUID = 0; - AggroTargetGUID = 0; + LordIllidanGUID.Clear(); + AggroTargetGUID.Clear(); Timers = false; me->AddUnitState(UNIT_STATE_ROOT); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetTarget(0); + me->SetTarget(ObjectGuid::Empty); } void EnterCombat(Unit* /*who*/) override { } @@ -1274,7 +1273,7 @@ public: { npc_lord_illidan_stormrageAI(Creature* creature) : ScriptedAI(creature) { } - uint64 PlayerGUID; + ObjectGuid PlayerGUID; uint32 WaveTimer; uint32 AnnounceTimer; @@ -1288,7 +1287,7 @@ public: void Reset() override { - PlayerGUID = 0; + PlayerGUID.Clear(); WaveTimer = 10000; AnnounceTimer = 7000; @@ -1416,13 +1415,13 @@ public: { npc_illidari_spawnAI(Creature* creature) : ScriptedAI(creature) { } - uint64 LordIllidanGUID; + ObjectGuid LordIllidanGUID; uint32 SpellTimer1, SpellTimer2, SpellTimer3; bool Timers; void Reset() override { - LordIllidanGUID = 0; + LordIllidanGUID.Clear(); Timers = false; } @@ -1727,7 +1726,7 @@ public: if (Unit* owner = totemOspirits->GetOwner()) if (Player* player = owner->ToPlayer()) - player->KilledMonsterCredit(credit, 0); + player->KilledMonsterCredit(credit); DoCast(totemOspirits, SPELL_SOUL_CAPTURED); } } diff --git a/src/server/scripts/Outland/zone_terokkar_forest.cpp b/src/server/scripts/Outland/zone_terokkar_forest.cpp index da7ae03a8ee..223a144e33b 100644 --- a/src/server/scripts/Outland/zone_terokkar_forest.cpp +++ b/src/server/scripts/Outland/zone_terokkar_forest.cpp @@ -323,7 +323,7 @@ public: if (rand32() % 100 < 25) { me->SummonCreature(QUEST_TARGET, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); - player->KilledMonsterCredit(QUEST_TARGET, 0); + player->KilledMonsterCredit(QUEST_TARGET); } else me->SummonCreature(netherwebVictims[rand32() % 6], 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); diff --git a/src/server/scripts/Pet/pet_dk.cpp b/src/server/scripts/Pet/pet_dk.cpp index b24336cb33c..edbec51f4b1 100644 --- a/src/server/scripts/Pet/pet_dk.cpp +++ b/src/server/scripts/Pet/pet_dk.cpp @@ -59,7 +59,7 @@ class npc_pet_dk_ebon_gargoyle : public CreatureScript Initialize(); CasterAI::InitializeAI(); - uint64 ownerGuid = me->GetOwnerGUID(); + ObjectGuid ownerGuid = me->GetOwnerGUID(); if (!ownerGuid) return; @@ -69,7 +69,7 @@ class npc_pet_dk_ebon_gargoyle : public CreatureScript Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(me, targets, u_check); me->VisitNearbyObject(30.0f, searcher); for (std::list<Unit*>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter) - if ((*iter)->GetAura(SPELL_DK_SUMMON_GARGOYLE_1, ownerGuid)) + if ((*iter)->HasAura(SPELL_DK_SUMMON_GARGOYLE_1, ownerGuid)) { me->Attack((*iter), false); break; diff --git a/src/server/scripts/Pet/pet_generic.cpp b/src/server/scripts/Pet/pet_generic.cpp index d0e950dec32..538dca8e4b9 100644 --- a/src/server/scripts/Pet/pet_generic.cpp +++ b/src/server/scripts/Pet/pet_generic.cpp @@ -41,17 +41,11 @@ class npc_pet_gen_mojo : public CreatureScript { npc_pet_gen_mojoAI(Creature* creature) : ScriptedAI(creature) { - Initialize(); - } - - void Initialize() - { - _victimGUID = 0; } void Reset() override { - Initialize(); + _victimGUID.Clear(); if (Unit* owner = me->GetOwner()) me->GetMotionMaster()->MoveFollow(owner, 0.0f, 0.0f); @@ -84,7 +78,7 @@ class npc_pet_gen_mojo : public CreatureScript } private: - uint64 _victimGUID; + ObjectGuid _victimGUID; }; CreatureAI* GetAI(Creature* creature) const override diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 681a659ae71..36bf8389cc2 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -353,7 +353,7 @@ class spell_dk_bloodworms : public SpellScriptLoader class CorpseExplosionCheck { public: - explicit CorpseExplosionCheck(uint64 casterGUID, bool allowGhoul) : _casterGUID(casterGUID), + explicit CorpseExplosionCheck(ObjectGuid casterGUID, bool allowGhoul) : _casterGUID(casterGUID), _allowGhoul(allowGhoul) { } bool operator()(WorldObject* obj) const @@ -370,7 +370,7 @@ public: } private: - uint64 _casterGUID; + ObjectGuid _casterGUID; bool _allowGhoul; }; diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index e14a9934fac..e5ef3d5b7b7 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -217,7 +217,7 @@ class spell_gen_animal_blood : public SpellScriptLoader void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { // Remove all auras with spell id 46221, except the one currently being applied - while (Aura* aur = GetUnitOwner()->GetOwnedAura(SPELL_ANIMAL_BLOOD, 0, 0, 0, GetAura())) + while (Aura* aur = GetUnitOwner()->GetOwnedAura(SPELL_ANIMAL_BLOOD, ObjectGuid::Empty, ObjectGuid::Empty, 0, GetAura())) GetUnitOwner()->RemoveOwnedAura(aur); } @@ -1866,7 +1866,7 @@ class spell_gen_mount : public SpellScriptLoader if (Player* target = GetHitPlayer()) { // Prevent stacking of mounts and client crashes upon dismounting - target->RemoveAurasByType(SPELL_AURA_MOUNTED, 0, GetHitAura()); + target->RemoveAurasByType(SPELL_AURA_MOUNTED, ObjectGuid::Empty, GetHitAura()); // Triggered spell id dependent on riding skill and zone bool canFly = false; diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index a128c30ad50..ba3d6ce490a 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -504,7 +504,7 @@ class spell_pri_mind_sear : public SpellScriptLoader void FilterTargets(std::list<WorldObject*>& unitList) { - unitList.remove_if(Trinity::ObjectGUIDCheck(GetCaster()->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT))); + unitList.remove_if(Trinity::ObjectGUIDCheck(GetCaster()->GetChannelObjectGuid())); } void Register() override diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 92eeef5e8a8..00ce2cb280e 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -754,7 +754,7 @@ class spell_q12937_relief_for_the_fallen : public SpellScriptLoader if (Creature* target = GetHitCreature()) { caster->CastSpell(caster, SPELL_TRIGGER_AID_OF_THE_EARTHEN, true, NULL); - caster->KilledMonsterCredit(NPC_FALLEN_EARTHEN_DEFENDER, 0); + caster->KilledMonsterCredit(NPC_FALLEN_EARTHEN_DEFENDER); target->DespawnOrUnsummon(); } } @@ -885,7 +885,7 @@ class spell_q12659_ahunaes_knife : public SpellScriptLoader if (Creature* target = GetHitCreature()) { target->DespawnOrUnsummon(); - caster->KilledMonsterCredit(NPC_SCALPS_KC_BUNNY, 0); + caster->KilledMonsterCredit(NPC_SCALPS_KC_BUNNY); } } @@ -929,7 +929,7 @@ class spell_q9874_liquid_fire : public SpellScriptLoader if (Creature* target = GetHitCreature()) if (target && !target->HasAura(SPELL_FLAMES)) { - caster->KilledMonsterCredit(NPC_VILLAGER_KILL_CREDIT, 0); + caster->KilledMonsterCredit(NPC_VILLAGER_KILL_CREDIT); target->CastSpell(target, SPELL_FLAMES, true); target->DespawnOrUnsummon(60000); } @@ -973,7 +973,7 @@ class spell_q12805_lifeblood_dummy : public SpellScriptLoader Player* caster = GetCaster()->ToPlayer(); if (Creature* target = GetHitCreature()) { - caster->KilledMonsterCredit(NPC_SHARD_KILL_CREDIT, 0); + caster->KilledMonsterCredit(NPC_SHARD_KILL_CREDIT); target->CastSpell(target, uint32(GetEffectValue()), true); target->DespawnOrUnsummon(2000); } @@ -1016,7 +1016,7 @@ class spell_q13280_13283_plant_battle_standard: public SpellScriptLoader Unit* caster = GetCaster(); if (caster->IsVehicle()) if (Unit* player = caster->GetVehicleKit()->GetPassenger(0)) - player->ToPlayer()->KilledMonsterCredit(NPC_KING_OF_THE_MOUNTAINT_KC, 0); + player->ToPlayer()->KilledMonsterCredit(NPC_KING_OF_THE_MOUNTAINT_KC); } void Register() override @@ -1356,7 +1356,7 @@ class spell_q12372_destabilize_azure_dragonshrine_dummy : public SpellScriptLoad if (Vehicle* vehicle = caster->GetVehicleKit()) if (Unit* passenger = vehicle->GetPassenger(0)) if (Player* player = passenger->ToPlayer()) - player->KilledMonsterCredit(NPC_WYRMREST_TEMPLE_CREDIT, 0); + player->KilledMonsterCredit(NPC_WYRMREST_TEMPLE_CREDIT); } void Register() override diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index a04fdba57b9..9c9a75d853b 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -314,7 +314,7 @@ class spell_rog_killing_spree : public SpellScriptLoader { while (!_targets.empty()) { - uint64 guid = Trinity::Containers::SelectRandomContainerElement(_targets); + ObjectGuid guid = Trinity::Containers::SelectRandomContainerElement(_targets); if (Unit* target = ObjectAccessor::GetUnit(*GetTarget(), guid)) { GetTarget()->CastSpell(target, SPELL_ROGUE_KILLING_SPREE_TELEPORT, true); @@ -345,7 +345,7 @@ class spell_rog_killing_spree : public SpellScriptLoader } private: - std::list<uint64> _targets; + GuidList _targets; }; AuraScript* GetAuraScript() const override diff --git a/src/server/scripts/World/action_ip_logger.cpp b/src/server/scripts/World/action_ip_logger.cpp index 057f3d6ee36..2977f4e974a 100644 --- a/src/server/scripts/World/action_ip_logger.cpp +++ b/src/server/scripts/World/action_ip_logger.cpp @@ -252,24 +252,24 @@ public: CharacterDeleteActionIpLogger() : PlayerScript("CharacterDeleteActionIpLogger") { } // CHARACTER_DELETE = 10 - void OnDelete(uint64 guid, uint32 accountId) override + void OnDelete(ObjectGuid guid, uint32 accountId) override { DeleteIPLogAction(guid, accountId, CHARACTER_DELETE); } // CHARACTER_FAILED_DELETE = 11 - void OnFailedDelete(uint64 guid, uint32 accountId) override + void OnFailedDelete(ObjectGuid guid, uint32 accountId) override { DeleteIPLogAction(guid, accountId, CHARACTER_FAILED_DELETE); } - void DeleteIPLogAction(uint64 guid, uint32 playerGuid, IPLoggingTypes aType) + void DeleteIPLogAction(ObjectGuid guid, uint32 playerGuid, IPLoggingTypes aType) { // Action IP Logger is only intialized if config is set up // Else, this script isn't loaded in the first place: We require no config check. // We declare all the required variables - uint32 characterGuid = GUID_LOPART(guid); // We have no access to any member function of Player* or WorldSession*. So use old-fashioned way. + uint32 characterGuid = guid.GetCounter(); // We have no access to any member function of Player* or WorldSession*. So use old-fashioned way. // Query playerGuid/accountId, as we only have characterGuid std::string systemNote = "ERROR"; // "ERROR" is a placeholder here. We change it later. diff --git a/src/server/scripts/World/areatrigger_scripts.cpp b/src/server/scripts/World/areatrigger_scripts.cpp index dcba4cf9573..a1e328ebaf0 100644 --- a/src/server/scripts/World/areatrigger_scripts.cpp +++ b/src/server/scripts/World/areatrigger_scripts.cpp @@ -431,8 +431,8 @@ class AreaTrigger_at_frostgrips_hollow : public AreaTriggerScript public: AreaTrigger_at_frostgrips_hollow() : AreaTriggerScript("at_frostgrips_hollow") { - stormforgedMonitorGUID = 0; - stormforgedEradictorGUID = 0; + stormforgedMonitorGUID.Clear(); + stormforgedEradictorGUID.Clear(); } bool OnTrigger(Player* player, AreaTriggerEntry const* /* trigger */) override @@ -469,8 +469,8 @@ public: } private: - uint64 stormforgedMonitorGUID; - uint64 stormforgedEradictorGUID; + ObjectGuid stormforgedMonitorGUID; + ObjectGuid stormforgedEradictorGUID; }; void AddSC_areatrigger_scripts() diff --git a/src/server/scripts/World/boss_emerald_dragons.cpp b/src/server/scripts/World/boss_emerald_dragons.cpp index a00c9465a05..01d36783d20 100644 --- a/src/server/scripts/World/boss_emerald_dragons.cpp +++ b/src/server/scripts/World/boss_emerald_dragons.cpp @@ -418,7 +418,7 @@ class npc_spirit_shade : public CreatureScript struct npc_spirit_shadeAI : public PassiveAI { - npc_spirit_shadeAI(Creature* creature) : PassiveAI(creature), _summonerGuid(0) + npc_spirit_shadeAI(Creature* creature) : PassiveAI(creature), _summonerGuid() { } @@ -430,7 +430,7 @@ class npc_spirit_shade : public CreatureScript void MovementInform(uint32 moveType, uint32 data) override { - if (moveType == FOLLOW_MOTION_TYPE && data == _summonerGuid) + if (moveType == FOLLOW_MOTION_TYPE && data == _summonerGuid.GetCounter()) { me->CastSpell((Unit*)NULL, SPELL_DARK_OFFERING, false); me->DespawnOrUnsummon(1000); @@ -438,7 +438,7 @@ class npc_spirit_shade : public CreatureScript } private: - uint64 _summonerGuid; + ObjectGuid _summonerGuid; }; CreatureAI* GetAI(Creature* creature) const override diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index 7ba043f2a2e..63562436196 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -770,7 +770,7 @@ public: return false; pPrisoner->DisappearAndDie(); - player->KilledMonsterCredit(NPC_EBON_BLADE_PRISONER_HUMAN, 0); + player->KilledMonsterCredit(NPC_EBON_BLADE_PRISONER_HUMAN); switch (pPrisoner->GetEntry()) { case NPC_EBON_BLADE_PRISONER_HUMAN: @@ -988,7 +988,7 @@ public: if (qInfo) { /// @todo prisoner should help player for a short period of time - player->KilledMonsterCredit(qInfo->RequiredNpcOrGo[0], 0); + player->KilledMonsterCredit(qInfo->RequiredNpcOrGo[0]); pPrisoner->DisappearAndDie(); } return true; @@ -1020,7 +1020,7 @@ public: if (pTadpole) { pTadpole->DisappearAndDie(); - player->KilledMonsterCredit(NPC_WINTERFIN_TADPOLE, 0); + player->KilledMonsterCredit(NPC_WINTERFIN_TADPOLE); //FIX: Summon minion tadpole } } @@ -1154,7 +1154,7 @@ class go_gjalerbron_cage : public GameObjectScript { if (Creature* prisoner = go->FindNearestCreature(NPC_GJALERBRON_PRISONER, 5.0f)) { - player->KilledMonsterCredit(NPC_GJALERBRON_PRISONER, 0); + player->KilledMonsterCredit(NPC_GJALERBRON_PRISONER); prisoner->AI()->Talk(SAY_FREE); prisoner->DespawnOrUnsummon(6000); diff --git a/src/server/scripts/World/guards.cpp b/src/server/scripts/World/guards.cpp index bd953a285ab..13d811f3ff1 100644 --- a/src/server/scripts/World/guards.cpp +++ b/src/server/scripts/World/guards.cpp @@ -280,7 +280,7 @@ public: { banishTimer = 5000; exileTimer = 8500; - playerGUID = 0; + playerGUID.Clear(); canTeleport = false; } @@ -303,7 +303,7 @@ public: temp->CastSpell(temp, SPELL_EXILE, true); temp->CastSpell(temp, SPELL_BANISH_TELEPORT, true); } - playerGUID = 0; + playerGUID.Clear(); exileTimer = 8500; canTeleport = false; } else exileTimer -= diff; @@ -327,7 +327,7 @@ public: private: uint32 exileTimer; uint32 banishTimer; - uint64 playerGUID; + ObjectGuid playerGUID; bool canTeleport; }; @@ -353,7 +353,7 @@ public: { banishTimer = 5000; exileTimer = 8500; - playerGUID = 0; + playerGUID.Clear(); canTeleport = false; } @@ -376,7 +376,7 @@ public: temp->CastSpell(temp, SPELL_EXILE, true); temp->CastSpell(temp, SPELL_BANISH_TELEPORT, true); } - playerGUID = 0; + playerGUID.Clear(); exileTimer = 8500; canTeleport = false; } else exileTimer -= diff; @@ -399,7 +399,7 @@ public: private: uint32 exileTimer; uint32 banishTimer; - uint64 playerGUID; + ObjectGuid playerGUID; bool canTeleport; }; diff --git a/src/server/scripts/World/item_scripts.cpp b/src/server/scripts/World/item_scripts.cpp index a191f37c76c..423ac2e7c54 100644 --- a/src/server/scripts/World/item_scripts.cpp +++ b/src/server/scripts/World/item_scripts.cpp @@ -351,7 +351,7 @@ public: { pMammoth->AI()->DoAction(1); pTrap->SetGoState(GO_STATE_READY); - player->KilledMonsterCredit(NPC_TRAPPED_MAMMOTH_CALF, 0); + player->KilledMonsterCredit(NPC_TRAPPED_MAMMOTH_CALF); return true; } } diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index ff42743c496..f613704164e 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -124,7 +124,7 @@ public: npc_air_force_botsAI(Creature* creature) : ScriptedAI(creature) { SpawnAssoc = NULL; - SpawnedGUID = 0; + SpawnedGUID.Clear(); // find the correct spawnhandling static uint32 entryCount = sizeof(spawnAssociations) / sizeof(SpawnAssociation); @@ -154,7 +154,7 @@ public: } SpawnAssociation* SpawnAssoc; - uint64 SpawnedGUID; + ObjectGuid SpawnedGUID; void Reset() override { } @@ -196,11 +196,11 @@ public: if (!playerTarget) return; - Creature* lastSpawnedGuard = SpawnedGUID == 0 ? NULL : GetSummonedGuard(); + Creature* lastSpawnedGuard = SpawnedGUID.IsEmpty() ? NULL : GetSummonedGuard(); // prevent calling Unit::GetUnit at next MoveInLineOfSight call - speedup if (!lastSpawnedGuard) - SpawnedGUID = 0; + SpawnedGUID.Clear(); switch (SpawnAssoc->spawnType) { @@ -597,7 +597,7 @@ public: void Initialize() { - PlayerGUID = 0; + PlayerGUID.Clear(); SummonPatientTimer = 10000; SummonPatientCount = 0; @@ -610,7 +610,7 @@ public: Event = false; } - uint64 PlayerGUID; + ObjectGuid PlayerGUID; uint32 SummonPatientTimer; uint32 SummonPatientCount; @@ -619,7 +619,7 @@ public: bool Event; - std::list<uint64> Patients; + GuidList Patients; std::vector<Location*> Coordinates; void Reset() override @@ -690,10 +690,9 @@ public: { if (!Patients.empty()) { - std::list<uint64>::const_iterator itr; - for (itr = Patients.begin(); itr != Patients.end(); ++itr) + for (GuidList::const_iterator itr = Patients.begin(); itr != Patients.end(); ++itr) { - if (Creature* patient = ObjectAccessor::GetCreature((*me), *itr)) + if (Creature* patient = ObjectAccessor::GetCreature(*me, *itr)) patient->setDeathState(JUST_DIED); } } @@ -749,11 +748,11 @@ public: void Initialize() { - DoctorGUID = 0; + DoctorGUID.Clear(); Coord = NULL; } - uint64 DoctorGUID; + ObjectGuid DoctorGUID; Location* Coord; void Reset() override @@ -950,7 +949,7 @@ public: Reset(); } - uint64 CasterGUID; + ObjectGuid CasterGUID; bool IsHealed; bool CanRun; @@ -959,7 +958,7 @@ public: void Reset() override { - CasterGUID = 0; + CasterGUID.Clear(); IsHealed = false; CanRun = false; @@ -1107,7 +1106,7 @@ public: break; } - Start(false, true, true); + Start(false, true); } else EnterEvadeMode(); //something went wrong @@ -1479,7 +1478,7 @@ public: } EventMap _events; - std::unordered_map<uint64, time_t> _damageTimes; + std::unordered_map<ObjectGuid, time_t> _damageTimes; void Reset() override { @@ -1526,7 +1525,7 @@ public: case EVENT_TD_CHECK_COMBAT: { time_t now = time(NULL); - for (std::unordered_map<uint64, time_t>::iterator itr = _damageTimes.begin(); itr != _damageTimes.end();) + for (std::unordered_map<ObjectGuid, time_t>::iterator itr = _damageTimes.begin(); itr != _damageTimes.end();) { // If unit has not dealt damage to training dummy for 5 seconds, remove him from combat if (itr->second < now - 5) @@ -2262,7 +2261,7 @@ public: void Initialize() { inLove = false; - rabbitGUID = 0; + rabbitGUID.Clear(); jumpTimer = urand(5000, 10000); bunnyTimer = urand(10000, 20000); searchTimer = urand(5000, 10000); @@ -2272,7 +2271,7 @@ public: uint32 jumpTimer; uint32 bunnyTimer; uint32 searchTimer; - uint64 rabbitGUID; + ObjectGuid rabbitGUID; void Reset() override { @@ -2347,7 +2346,7 @@ public: { npc_imp_in_a_ballAI(Creature* creature) : ScriptedAI(creature) { - summonerGUID = 0; + summonerGUID.Clear(); } void IsSummonedBy(Unit* summoner) override @@ -2375,7 +2374,7 @@ public: private: EventMap events; - uint64 summonerGUID; + ObjectGuid summonerGUID; }; CreatureAI* GetAI(Creature* creature) const override diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h index 046fdc0c8e9..3d44c975c96 100644 --- a/src/server/shared/Packets/ByteBuffer.h +++ b/src/server/shared/Packets/ByteBuffer.h @@ -32,6 +32,7 @@ #include <cstring> #include <time.h> #include <cmath> +#include <type_traits> #include <boost/asio/buffer.hpp> class MessageBuffer; @@ -113,12 +114,14 @@ class ByteBuffer template <typename T> void append(T value) { + static_assert(std::is_fundamental<T>::value, "append(compound)"); EndianConvert(value); append((uint8 *)&value, sizeof(value)); } template <typename T> void put(size_t pos, T value) { + static_assert(std::is_fundamental<T>::value, "append(compound)"); EndianConvert(value); put(pos, (uint8 *)&value, sizeof(value)); } |