aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Entities')
-rw-r--r--src/server/game/Entities/Corpse/Corpse.cpp12
-rw-r--r--src/server/game/Entities/Corpse/Corpse.h2
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp26
-rw-r--r--src/server/game/Entities/Creature/Creature.h20
-rw-r--r--src/server/game/Entities/Creature/GossipDef.cpp26
-rw-r--r--src/server/game/Entities/Creature/GossipDef.h18
-rw-r--r--src/server/game/Entities/Creature/TemporarySummon.cpp6
-rw-r--r--src/server/game/Entities/Creature/TemporarySummon.h4
-rw-r--r--src/server/game/Entities/DynamicObject/DynamicObject.cpp2
-rw-r--r--src/server/game/Entities/DynamicObject/DynamicObject.h2
-rw-r--r--src/server/game/Entities/GameObject/GameObject.cpp50
-rw-r--r--src/server/game/Entities/GameObject/GameObject.h18
-rw-r--r--src/server/game/Entities/Item/Container/Bag.cpp23
-rw-r--r--src/server/game/Entities/Item/Container/Bag.h4
-rw-r--r--src/server/game/Entities/Item/Item.cpp41
-rw-r--r--src/server/game/Entities/Item/Item.h8
-rw-r--r--src/server/game/Entities/Object/Object.cpp48
-rw-r--r--src/server/game/Entities/Object/Object.h27
-rw-r--r--src/server/game/Entities/Object/ObjectDefines.h169
-rw-r--r--src/server/game/Entities/Object/ObjectGuid.cpp20
-rw-r--r--src/server/game/Entities/Object/ObjectGuid.h49
-rw-r--r--src/server/game/Entities/Object/Updates/UpdateData.cpp14
-rw-r--r--src/server/game/Entities/Object/Updates/UpdateData.h8
-rw-r--r--src/server/game/Entities/Pet/Pet.cpp10
-rw-r--r--src/server/game/Entities/Player/Player.cpp387
-rw-r--r--src/server/game/Entities/Player/Player.h131
-rw-r--r--src/server/game/Entities/Player/SocialMgr.cpp6
-rw-r--r--src/server/game/Entities/Totem/Totem.cpp2
-rw-r--r--src/server/game/Entities/Transport/Transport.cpp2
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp247
-rw-r--r--src/server/game/Entities/Unit/Unit.h152
-rw-r--r--src/server/game/Entities/Vehicle/Vehicle.h2
-rw-r--r--src/server/game/Entities/Vehicle/VehicleDefines.h6
33 files changed, 694 insertions, 848 deletions
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 258b353f702..08756f96f0d 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);
@@ -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..5f8cf8e1355 100644
--- a/src/server/game/Entities/Creature/GossipDef.h
+++ b/src/server/game/Entities/Creature/GossipDef.h
@@ -167,8 +167,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 +217,7 @@ class GossipMenu
GossipMenuItemContainer _menuItems;
GossipMenuItemDataContainer _menuItemData;
uint32 _menuId;
- uint64 _senderGUID;
+ ObjectGuid _senderGUID;
LocaleConstant _locale;
};
@@ -267,22 +267,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 3717248afda..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);
}
}
@@ -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 acdc72c8f04..18f222158c6 100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -135,8 +135,8 @@ 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.Set(guid);
}
@@ -333,7 +333,7 @@ uint16 Object::GetUInt16Value(uint16 index, uint8 offset) const
return *(((uint16*)&m_uint32Values[index])+offset);
}
-ObjectGuid const& Object::GetGuidValue(uint16 index) const
+ObjectGuid Object::GetGuidValue(uint16 index) const
{
ASSERT(index + 1 < m_valuesCount || PrintIndexError(index, false));
return *((ObjectGuid*)&(m_uint32Values[index]));
@@ -690,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);
@@ -712,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;
@@ -799,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)
@@ -2070,7 +2086,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);
@@ -2767,7 +2783,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)
{
@@ -2808,13 +2824,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);
}
}
@@ -2847,9 +2863,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 48147b693c5..b23ea4d8dfa 100644
--- a/src/server/game/Entities/Object/Object.h
+++ b/src/server/game/Entities/Object/Object.h
@@ -101,10 +101,10 @@ class Object
virtual void AddToWorld();
virtual void RemoveFromWorld();
- uint64 GetGUID() const { return GetUInt64Value(OBJECT_FIELD_GUID); }
- uint32 GetGUIDLow() const { return GUID_LOPART(GetUInt64Value(OBJECT_FIELD_GUID)); }
- uint32 GetGUIDMid() const { return GUID_ENPART(GetUInt64Value(OBJECT_FIELD_GUID)); }
- uint32 GetGUIDHigh() const { return GUID_HIPART(GetUInt64Value(OBJECT_FIELD_GUID)); }
+ 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); }
@@ -130,7 +130,7 @@ class Object
float GetFloatValue(uint16 index) const;
uint8 GetByteValue(uint16 index, uint8 offset) const;
uint16 GetUInt16Value(uint16 index, uint8 offset) const;
- ObjectGuid const& GetGuidValue(uint16 index) const;
+ ObjectGuid GetGuidValue(uint16 index) const;
void SetInt32Value(uint16 index, int32 value);
void SetUInt32Value(uint16 index, uint32 value);
@@ -140,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);
@@ -384,7 +385,7 @@ ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYZOStreamer const& st
struct MovementInfo
{
// common
- uint64 guid;
+ ObjectGuid guid;
uint32 flags;
uint16 flags2;
Position pos;
@@ -395,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;
@@ -431,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();
@@ -638,7 +639,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();
@@ -725,7 +726,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 1ccedbaaf9f..3b7709bc1f1 100644
--- a/src/server/game/Entities/Object/ObjectDefines.h
+++ b/src/server/game/Entities/Object/ObjectDefines.h
@@ -31,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));
@@ -95,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
index 68e6ca1b3ce..63d2b5c2dae 100644
--- a/src/server/game/Entities/Object/ObjectGuid.cpp
+++ b/src/server/game/Entities/Object/ObjectGuid.cpp
@@ -20,6 +20,9 @@
#include "World.h"
#include "ObjectMgr.h"
#include <sstream>
+#include <iomanip>
+
+ObjectGuid const ObjectGuid::Empty = ObjectGuid();
char const* ObjectGuid::GetTypeName(HighGuid high)
{
@@ -45,19 +48,12 @@ char const* ObjectGuid::GetTypeName(HighGuid high)
std::string ObjectGuid::ToString() const
{
std::ostringstream str;
- str << GetTypeName();
-
- if (IsPlayer())
- {
- std::string name;
- if (sObjectMgr->GetPlayerNameByGUID(m_guid, name))
- str << " " << name;
- }
-
- str << " (";
+ str << "GUID Full: 0x" << std::hex << std::setw(16) << std::setfill('0') << m_guid;
+ str << " Type: " << GetTypeName();
if (HasEntry())
- str << (IsPet() ? "Petnumber: " : "Entry: ") << GetEntry() << " ";
- str << "Guid: " << GetCounter() << ")";
+ str << (IsPet() ? " Pet number: " : " Entry: ") << GetEntry() << " ";
+
+ str << " Low: " << GetCounter();
return str.str();
}
diff --git a/src/server/game/Entities/Object/ObjectGuid.h b/src/server/game/Entities/Object/ObjectGuid.h
index a073113db90..f1966007d74 100644
--- a/src/server/game/Entities/Object/ObjectGuid.h
+++ b/src/server/game/Entities/Object/ObjectGuid.h
@@ -79,13 +79,15 @@ struct PackedGuidReader
class ObjectGuid
{
- public: // constructors
+ 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; }
+ explicit operator uint64() const { return m_guid; }
PackedGuidReader ReadAsPacked() { return PackedGuidReader(*this); }
void Set(uint64 guid) { m_guid = guid; }
@@ -94,7 +96,7 @@ class ObjectGuid
PackedGuid WriteAsPacked() const;
uint64 GetRawValue() const { return m_guid; }
- HighGuid GetHigh() const { return HighGuid((m_guid >> 48) & 0x00000FFF); }
+ HighGuid GetHigh() const { return HighGuid((m_guid >> 48) & 0x0000FFFF); }
uint32 GetEntry() const { return HasEntry() ? uint32((m_guid >> 24) & UI64LIT(0x0000000000FFFFFF)) : 0; }
uint32 GetCounter() const
{
@@ -112,23 +114,24 @@ class ObjectGuid
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 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 IsInstance() const { return GetHigh() == HIGHGUID_INSTANCE; }
- bool IsGroup() const { return GetHigh() == HIGHGUID_GROUP; }
+ 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)
{
@@ -153,7 +156,7 @@ class ObjectGuid
TypeID GetTypeId() const { return GetTypeId(GetHigh()); }
- bool operator!() const { return IsEmpty(); }
+ //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(); }
@@ -194,6 +197,12 @@ class ObjectGuid
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
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..57d0c06d376 100644
--- a/src/server/game/Entities/Object/Updates/UpdateData.h
+++ b/src/server/game/Entities/Object/Updates/UpdateData.h
@@ -59,18 +59,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 7012b25373e..508a9f27fc8 100644
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -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 df306120a37..018282cb6bc 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
@@ -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());
}
@@ -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);
}
@@ -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);
@@ -20558,7 +20560,7 @@ void Player::TextEmote(const std::string& text)
SendMessageToSetInRange(&data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), true, !GetSession()->HasPermission(rbac::RBAC_PERM_TWO_SIDE_INTERACTION_CHAT));
}
-void Player::Whisper(const std::string& text, uint32 language, uint64 receiver)
+void Player::Whisper(const std::string& text, uint32 language, ObjectGuid receiver)
{
bool isAddonMessage = language == LANG_ADDON;
@@ -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;
}
@@ -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)
@@ -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())
@@ -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;
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 27ea8355345..92639c0589d 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();
@@ -1221,7 +1219,7 @@ class Player : public Unit, public GridObject<Player>
/// Outputs an universal text which is supposed to be an action.
void TextEmote(std::string const& text);
/// Handles whispers from Addons and players based on sender, receiver's guid and language.
- void Whisper(std::string const& text, const uint32 language, uint64 receiver);
+ void Whisper(std::string const& text, const uint32 language, ObjectGuid receiver);
/*********************************************************/
/*** STORAGE SYSTEM ***/
@@ -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 67ea9c63d78..4952d1bd6a4 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -158,7 +158,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),
@@ -189,10 +189,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();
@@ -831,7 +831,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)
{
@@ -853,12 +853,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)
@@ -870,19 +870,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)
@@ -894,21 +894,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)
@@ -922,7 +922,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)
@@ -936,7 +936,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)
@@ -2916,7 +2916,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++);
@@ -3214,7 +3214,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);
@@ -3226,12 +3226,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
@@ -3258,7 +3258,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;
}
@@ -3567,7 +3567,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))
@@ -3601,7 +3601,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)
@@ -3630,7 +3630,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;)
@@ -3690,7 +3690,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);)
{
@@ -3706,7 +3706,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;)
@@ -3723,7 +3723,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;)
@@ -3751,7 +3751,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;)
@@ -3827,7 +3827,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);)
{
@@ -3841,7 +3841,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();)
{
@@ -3942,7 +3942,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();)
{
@@ -4134,7 +4134,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)
@@ -4166,7 +4166,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)
@@ -4180,7 +4180,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)
@@ -4206,7 +4206,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)
@@ -4227,7 +4227,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)
@@ -4246,13 +4246,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)
@@ -4264,7 +4264,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;
@@ -4309,7 +4309,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)
@@ -4339,7 +4339,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;
@@ -4351,7 +4351,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)
@@ -4387,7 +4387,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;
@@ -4399,7 +4399,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)
{
@@ -4439,7 +4439,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[] =
{
@@ -4472,7 +4472,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[] =
{
@@ -4848,7 +4848,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);
@@ -4869,13 +4869,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;
}
}
@@ -4914,7 +4914,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);
@@ -4934,7 +4934,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);
@@ -4992,7 +4992,7 @@ void Unit::SendPeriodicAuraLog(SpellPeriodicAuraLogInfo* pInfo)
WorldPacket data(SMSG_PERIODICAURALOG, 30);
data << GetPackGUID();
- data.appendPackGUID(aura->GetCasterGUID());
+ data << aura->GetCasterGUID().WriteAsPacked();
data << uint32(aura->GetId()); // spellId
data << uint32(1); // count
data << uint32(aura->GetAuraType()); // auraId
@@ -5160,7 +5160,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)
{
@@ -5618,7 +5618,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;
@@ -5626,7 +5626,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;
}
@@ -5843,7 +5843,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;
@@ -8670,19 +8670,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;
}
@@ -8998,7 +8991,7 @@ bool Unit::AttackStop()
m_attacking = NULL;
// Clear our target
- SetTarget(0);
+ SetTarget(ObjectGuid::Empty);
ClearUnitState(UNIT_STATE_MELEE_ATTACKING);
@@ -9167,12 +9160,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;
@@ -9194,7 +9187,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;
@@ -9202,7 +9195,7 @@ Unit* Unit::GetOwner() const
Unit* Unit::GetCharmer() const
{
- if (uint64 charmerGUID = GetCharmerGUID())
+ if (ObjectGuid charmerGUID = GetCharmerGUID())
return ObjectAccessor::GetUnit(*this, charmerGUID);
return NULL;
@@ -9210,8 +9203,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();
@@ -9230,14 +9223,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;
@@ -9245,14 +9238,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;
@@ -9260,13 +9253,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;
@@ -9320,19 +9313,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()))
{
}
}
@@ -9372,15 +9365,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())
{
@@ -9405,7 +9396,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)
@@ -9427,7 +9418,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())
@@ -9476,7 +9467,7 @@ void Unit::SetCharm(Unit* charm, bool apply)
{
if (GetTypeId() == TYPEID_PLAYER)
{
- if (!AddUInt64Value(UNIT_FIELD_CHARM, charm->GetGUID()))
+ 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 " UI64FMTD "", GetName().c_str(), charm->GetEntry(), GetCharmGUID());
charm->m_ControlledByPlayer = true;
@@ -9489,7 +9480,7 @@ 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()))
+ if (!charm->AddGuidValue(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());
_isWalkingBeforeCharm = charm->IsWalking();
@@ -9505,11 +9496,11 @@ void Unit::SetCharm(Unit* charm, bool apply)
{
if (GetTypeId() == TYPEID_PLAYER)
{
- if (!RemoveUInt64Value(UNIT_FIELD_CHARM, charm->GetGUID()))
+ 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 " UI64FMTD "", GetName().c_str(), charm->GetEntry(), GetCharmGUID());
}
- if (!charm->RemoveUInt64Value(UNIT_FIELD_CHARMEDBY, GetGUID()))
+ if (!charm->RemoveGuidValue(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->GetTypeId() == TYPEID_PLAYER)
@@ -9633,7 +9624,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;
@@ -9666,7 +9657,7 @@ void Unit::RemoveAllControlled()
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
@@ -10430,7 +10421,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
@@ -12130,7 +12121,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;
@@ -12503,7 +12494,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;
@@ -13321,7 +13312,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)
@@ -13334,7 +13325,7 @@ void Unit::SetLevel(uint8 lvl)
if (player->GetGroup())
player->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_LEVEL);
- sWorld->UpdateCharacterNameDataLevel(GetGUIDLow(), lvl);
+ sWorld->UpdateCharacterNameDataLevel(GetGUID(), lvl);
}
}
@@ -14426,14 +14417,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();
}
@@ -14476,7 +14467,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)
@@ -14597,13 +14588,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
}
}
@@ -15110,7 +15101,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))
@@ -15169,7 +15160,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;
@@ -15586,7 +15577,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)
@@ -15685,7 +15676,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);
@@ -15715,7 +15706,7 @@ void Unit::SetConfused(bool apply)
{
if (apply)
{
- SetTarget(0);
+ SetTarget(ObjectGuid::Empty);
GetMotionMaster()->MoveConfused();
}
else
@@ -16058,14 +16049,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
@@ -16222,7 +16213,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
@@ -16794,7 +16785,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
@@ -17165,8 +17156,8 @@ void Unit::SendThreatListUpdate()
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);
}
@@ -17181,12 +17172,12 @@ 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 << GetPackGUID();
- data.appendPackGUID(pHostileReference->getUnitGuid());
+ 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::SendRemoveFromThreatListOpcode(HostileReference* pHostileReference)
TC_LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_REMOVE Message");
WorldPacket data(SMSG_THREAT_REMOVE, 8 + 8);
data << GetPackGUID();
- data.appendPackGUID(pHostileReference->getUnitGuid());
+ data << pHostileReference->getUnitGuid().WriteAsPacked();
SendMessageToSet(&data, false);
}
@@ -17287,14 +17278,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("");
@@ -17309,7 +17300,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());
}
@@ -17317,7 +17308,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);
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index a18bc3b0848..3ffab32492f 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);
@@ -1646,24 +1645,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;
@@ -1690,7 +1689,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;
@@ -1714,7 +1713,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);
@@ -1731,31 +1730,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();
@@ -1765,7 +1764,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();
@@ -1774,35 +1773,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;
@@ -1841,6 +1840,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);
@@ -1860,8 +1862,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);
@@ -2000,7 +2002,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);
@@ -2053,14 +2055,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(); }
@@ -2087,15 +2089,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; }
@@ -2104,7 +2106,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;
@@ -2144,8 +2146,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;
@@ -2267,7 +2269,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;