aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Groups
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2014-09-14 16:14:12 +0200
committerShauren <shauren.trinity@gmail.com>2014-09-14 16:14:12 +0200
commita0e50ea35fca61447bf07fc45d93c98234ba59f7 (patch)
treeb4ee69a63866f42e466a3c03fc031ce0710ac762 /src/server/game/Groups
parentce67a097bf3c0c3241f4441a808e32639ddbaafb (diff)
Core/Entities: Use ObjectGuid class in game project
Diffstat (limited to 'src/server/game/Groups')
-rw-r--r--src/server/game/Groups/Group.cpp174
-rw-r--r--src/server/game/Groups/Group.h81
2 files changed, 127 insertions, 128 deletions
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp
index bf11885c024..df34c12e332 100644
--- a/src/server/game/Groups/Group.cpp
+++ b/src/server/game/Groups/Group.cpp
@@ -36,7 +36,7 @@
#include "LFGMgr.h"
#include "UpdateFieldFlags.h"
-Roll::Roll(uint64 _guid, LootItem const& li) : itemGUID(_guid), itemid(li.itemid),
+Roll::Roll(ObjectGuid _guid, LootItem const& li) : itemGUID(_guid), itemid(li.itemid),
itemRandomPropId(li.randomPropertyId), itemRandomSuffix(li.randomSuffix), itemCount(li.count),
totalPlayersRolling(0), totalNeed(0), totalGreed(0), totalPass(0), itemSlot(0),
rollVoteMask(ROLL_ALL_TYPE_NO_DISENCHANT) { }
@@ -53,13 +53,13 @@ Loot* Roll::getLoot()
return getTarget();
}
-Group::Group() : m_leaderGuid(0), m_leaderName(""), m_groupType(GROUPTYPE_NORMAL),
+Group::Group() : m_leaderGuid(), m_leaderName(""), m_groupType(GROUPTYPE_NORMAL),
m_dungeonDifficulty(DUNGEON_DIFFICULTY_NORMAL), m_raidDifficulty(RAID_DIFFICULTY_10MAN_NORMAL),
-m_bgGroup(NULL), m_bfGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(0),
-m_masterLooterGuid(0), m_subGroupsCounts(NULL), m_guid(0), m_counter(0), m_maxEnchantingLevel(0), m_dbStoreId(0)
+m_bgGroup(NULL), m_bfGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(),
+m_masterLooterGuid(), m_subGroupsCounts(NULL), m_guid(), m_counter(0), m_maxEnchantingLevel(0), m_dbStoreId(0)
{
for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
- m_targetIcons[i] = 0;
+ m_targetIcons[i].Clear();
}
Group::~Group()
@@ -91,10 +91,10 @@ Group::~Group()
bool Group::Create(Player* leader)
{
- uint64 leaderGuid = leader->GetGUID();
+ ObjectGuid leaderGuid = leader->GetGUID();
uint32 lowguid = sGroupMgr->GenerateGroupId();
- m_guid = MAKE_NEW_GUID(lowguid, 0, HIGHGUID_GROUP);
+ m_guid = ObjectGuid(HIGHGUID_GROUP, lowguid);
m_leaderGuid = leaderGuid;
m_leaderName = leader->GetName();
leader->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GROUP_LEADER);
@@ -110,7 +110,7 @@ bool Group::Create(Player* leader)
m_lootThreshold = ITEM_QUALITY_UNCOMMON;
m_looterGuid = leaderGuid;
- m_masterLooterGuid = 0;
+ m_masterLooterGuid.Clear();
m_dungeonDifficulty = DUNGEON_DIFFICULTY_NORMAL;
m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL;
@@ -130,22 +130,22 @@ bool Group::Create(Player* leader)
uint8 index = 0;
stmt->setUInt32(index++, m_dbStoreId);
- stmt->setUInt32(index++, GUID_LOPART(m_leaderGuid));
+ stmt->setUInt32(index++, m_leaderGuid.GetCounter());
stmt->setUInt8(index++, uint8(m_lootMethod));
- stmt->setUInt32(index++, GUID_LOPART(m_looterGuid));
+ stmt->setUInt32(index++, m_looterGuid.GetCounter());
stmt->setUInt8(index++, uint8(m_lootThreshold));
- stmt->setUInt32(index++, uint32(m_targetIcons[0]));
- stmt->setUInt32(index++, uint32(m_targetIcons[1]));
- stmt->setUInt32(index++, uint32(m_targetIcons[2]));
- stmt->setUInt32(index++, uint32(m_targetIcons[3]));
- stmt->setUInt32(index++, uint32(m_targetIcons[4]));
- stmt->setUInt32(index++, uint32(m_targetIcons[5]));
- stmt->setUInt32(index++, uint32(m_targetIcons[6]));
- stmt->setUInt32(index++, uint32(m_targetIcons[7]));
+ stmt->setUInt64(index++, m_targetIcons[0].GetRawValue());
+ stmt->setUInt64(index++, m_targetIcons[1].GetRawValue());
+ stmt->setUInt64(index++, m_targetIcons[2].GetRawValue());
+ stmt->setUInt64(index++, m_targetIcons[3].GetRawValue());
+ stmt->setUInt64(index++, m_targetIcons[4].GetRawValue());
+ stmt->setUInt64(index++, m_targetIcons[5].GetRawValue());
+ stmt->setUInt64(index++, m_targetIcons[6].GetRawValue());
+ stmt->setUInt64(index++, m_targetIcons[7].GetRawValue());
stmt->setUInt8(index++, uint8(m_groupType));
stmt->setUInt32(index++, uint8(m_dungeonDifficulty));
stmt->setUInt32(index++, uint8(m_raidDifficulty));
- stmt->setUInt32(index++, GUID_LOPART(m_masterLooterGuid));
+ stmt->setUInt32(index++, m_masterLooterGuid.GetCounter());
CharacterDatabase.Execute(stmt);
@@ -163,19 +163,19 @@ bool Group::Create(Player* leader)
void Group::LoadGroupFromDB(Field* fields)
{
m_dbStoreId = fields[16].GetUInt32();
- m_guid = MAKE_NEW_GUID(sGroupMgr->GenerateGroupId(), 0, HIGHGUID_GROUP);
- m_leaderGuid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
+ m_guid = ObjectGuid(HIGHGUID_GROUP, sGroupMgr->GenerateGroupId());
+ m_leaderGuid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
// group leader not exist
- if (!sObjectMgr->GetPlayerNameByGUID(fields[0].GetUInt32(), m_leaderName))
+ if (!sObjectMgr->GetPlayerNameByGUID(m_leaderGuid, m_leaderName))
return;
m_lootMethod = LootMethod(fields[1].GetUInt8());
- m_looterGuid = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER);
+ m_looterGuid = ObjectGuid(HIGHGUID_PLAYER, fields[2].GetUInt32());
m_lootThreshold = ItemQualities(fields[3].GetUInt8());
for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
- m_targetIcons[i] = fields[4+i].GetUInt32();
+ m_targetIcons[i].Set(fields[4 + i].GetUInt64());
m_groupType = GroupType(fields[12].GetUInt8());
if (m_groupType & GROUPTYPE_RAID)
@@ -193,7 +193,7 @@ void Group::LoadGroupFromDB(Field* fields)
else
m_raidDifficulty = Difficulty(r_diff);
- m_masterLooterGuid = MAKE_NEW_GUID(fields[15].GetUInt32(), 0, HIGHGUID_PLAYER);
+ m_masterLooterGuid = ObjectGuid(HIGHGUID_PLAYER, fields[15].GetUInt32());
if (m_groupType & GROUPTYPE_LFG)
sLFGMgr->_LoadFromDB(fields, GetGUID());
@@ -202,7 +202,7 @@ void Group::LoadGroupFromDB(Field* fields)
void Group::LoadMemberFromDB(uint32 guidLow, uint8 memberFlags, uint8 subgroup, uint8 roles)
{
MemberSlot member;
- member.guid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER);
+ member.guid = ObjectGuid(HIGHGUID_PLAYER, guidLow);
// skip non-existed member
if (!sObjectMgr->GetPlayerNameByGUID(member.guid, member.name))
@@ -314,7 +314,7 @@ void Group::RemoveAllInvites()
m_invitees.clear();
}
-Player* Group::GetInvited(uint64 guid) const
+Player* Group::GetInvited(ObjectGuid guid) const
{
for (InvitesList::const_iterator itr = m_invitees.begin(); itr != m_invitees.end(); ++itr)
{
@@ -383,7 +383,7 @@ bool Group::AddMember(Player* player)
if (!isRaidGroup()) // reset targetIcons for non-raid-groups
{
for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
- m_targetIcons[i] = 0;
+ m_targetIcons[i].Clear();
}
// insert into the table if we're not a battleground group
@@ -392,7 +392,7 @@ bool Group::AddMember(Player* player)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GROUP_MEMBER);
stmt->setUInt32(0, m_dbStoreId);
- stmt->setUInt32(1, GUID_LOPART(member.guid));
+ stmt->setUInt32(1, member.guid.GetCounter());
stmt->setUInt8(2, member.flags);
stmt->setUInt8(3, member.group);
stmt->setUInt8(4, member.roles);
@@ -482,7 +482,7 @@ bool Group::AddMember(Player* player)
return true;
}
-bool Group::RemoveMember(uint64 guid, const RemoveMethod& method /*= GROUP_REMOVEMETHOD_DEFAULT*/, uint64 kicker /*= 0*/, const char* reason /*= NULL*/)
+bool Group::RemoveMember(ObjectGuid guid, const RemoveMethod& method /*= GROUP_REMOVEMETHOD_DEFAULT*/, ObjectGuid kicker /*= 0*/, const char* reason /*= NULL*/)
{
BroadcastGroupUpdate();
@@ -534,7 +534,7 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod& method /*= GROUP_REMOV
if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
CharacterDatabase.Execute(stmt);
DelinkMember(guid);
}
@@ -613,7 +613,7 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod& method /*= GROUP_REMOV
}
}
-void Group::ChangeLeader(uint64 newLeaderGuid)
+void Group::ChangeLeader(ObjectGuid newLeaderGuid)
{
member_witerator slot = _getMemberWSlot(newLeaderGuid);
@@ -817,7 +817,7 @@ void Group::SendLootStartRollToPlayer(uint32 countDown, uint32 mapId, Player* p,
p->GetSession()->SendPacket(&data);
}
-void Group::SendLootRoll(uint64 sourceGuid, uint64 targetGuid, uint8 rollNumber, uint8 rollType, Roll const& roll)
+void Group::SendLootRoll(ObjectGuid sourceGuid, ObjectGuid targetGuid, uint8 rollNumber, uint8 rollType, Roll const& roll)
{
WorldPacket data(SMSG_LOOT_ROLL, (8+4+8+4+4+4+1+1+1));
data << uint64(sourceGuid); // guid of the item rolled
@@ -841,7 +841,7 @@ void Group::SendLootRoll(uint64 sourceGuid, uint64 targetGuid, uint8 rollNumber,
}
}
-void Group::SendLootRollWon(uint64 sourceGuid, uint64 targetGuid, uint8 rollNumber, uint8 rollType, Roll const& roll)
+void Group::SendLootRollWon(ObjectGuid sourceGuid, ObjectGuid targetGuid, uint8 rollNumber, uint8 rollType, Roll const& roll)
{
WorldPacket data(SMSG_LOOT_ROLL_WON, (8+4+4+4+4+8+1+1));
data << uint64(sourceGuid); // guid of the item rolled
@@ -893,7 +893,7 @@ void Group::SendLooter(Creature* creature, Player* groupLooter)
data << uint64(creature->GetGUID());
if (GetLootMethod() == MASTER_LOOT && creature->loot.hasOverThresholdItem())
- data.appendPackGUID(GetMasterLooterGuid());
+ data << GetMasterLooterGuid().WriteAsPacked();
else
data << uint8(0);
@@ -926,7 +926,7 @@ void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject)
//roll for over-threshold item if it's one-player loot
if (item->Quality >= uint32(m_lootThreshold))
{
- uint64 newitemGUID = MAKE_NEW_GUID(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM);
+ ObjectGuid newitemGUID = ObjectGuid(HIGHGUID_ITEM, sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM));
Roll* r = new Roll(newitemGUID, *i);
//a vector is filled with only near party members
@@ -1010,7 +1010,7 @@ void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject)
continue;
}
- uint64 newitemGUID = MAKE_NEW_GUID(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM);
+ ObjectGuid newitemGUID = ObjectGuid(HIGHGUID_ITEM, sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM));
Roll* r = new Roll(newitemGUID, *i);
//a vector is filled with only near party members
@@ -1071,7 +1071,7 @@ void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject)
//roll for over-threshold item if it's one-player loot
if (item->Quality >= uint32(m_lootThreshold))
{
- uint64 newitemGUID = MAKE_NEW_GUID(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM);
+ ObjectGuid newitemGUID = ObjectGuid(HIGHGUID_ITEM, sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM));
Roll* r = new Roll(newitemGUID, *i);
for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
@@ -1146,7 +1146,7 @@ void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject)
continue;
item = sObjectMgr->GetItemTemplate(i->itemid);
- uint64 newitemGUID = MAKE_NEW_GUID(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM);
+ ObjectGuid newitemGUID = ObjectGuid(HIGHGUID_ITEM, sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM));
Roll* r = new Roll(newitemGUID, *i);
for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
@@ -1249,7 +1249,7 @@ void Group::MasterLoot(Loot* loot, WorldObject* pLootedObject)
}
}
-void Group::CountRollVote(uint64 playerGUID, uint64 Guid, uint8 Choice)
+void Group::CountRollVote(ObjectGuid playerGUID, ObjectGuid Guid, uint8 Choice)
{
Rolls::iterator rollI = GetRoll(Guid);
if (rollI == RollId.end())
@@ -1268,22 +1268,22 @@ void Group::CountRollVote(uint64 playerGUID, uint64 Guid, uint8 Choice)
switch (Choice)
{
case ROLL_PASS: // Player choose pass
- SendLootRoll(0, playerGUID, 128, ROLL_PASS, *roll);
+ SendLootRoll(ObjectGuid::Empty, playerGUID, 128, ROLL_PASS, *roll);
++roll->totalPass;
itr->second = PASS;
break;
case ROLL_NEED: // player choose Need
- SendLootRoll(0, playerGUID, 0, 0, *roll);
+ SendLootRoll(ObjectGuid::Empty, playerGUID, 0, 0, *roll);
++roll->totalNeed;
itr->second = NEED;
break;
case ROLL_GREED: // player choose Greed
- SendLootRoll(0, playerGUID, 128, ROLL_GREED, *roll);
+ SendLootRoll(ObjectGuid::Empty, playerGUID, 128, ROLL_GREED, *roll);
++roll->totalGreed;
itr->second = GREED;
break;
case ROLL_DISENCHANT: // player choose Disenchant
- SendLootRoll(0, playerGUID, 128, ROLL_DISENCHANT, *roll);
+ SendLootRoll(ObjectGuid::Empty, playerGUID, 128, ROLL_DISENCHANT, *roll);
++roll->totalGreed;
itr->second = DISENCHANT;
break;
@@ -1323,7 +1323,7 @@ void Group::CountTheRoll(Rolls::iterator rollI)
if (!roll->playerVote.empty())
{
uint8 maxresul = 0;
- uint64 maxguid = (*roll->playerVote.begin()).first;
+ ObjectGuid maxguid = (*roll->playerVote.begin()).first;
Player* player;
for (Roll::PlayerVote::const_iterator itr=roll->playerVote.begin(); itr != roll->playerVote.end(); ++itr)
@@ -1332,14 +1332,14 @@ void Group::CountTheRoll(Rolls::iterator rollI)
continue;
uint8 randomN = urand(1, 100);
- SendLootRoll(0, itr->first, randomN, ROLL_NEED, *roll);
+ SendLootRoll(ObjectGuid::Empty, itr->first, randomN, ROLL_NEED, *roll);
if (maxresul < randomN)
{
maxguid = itr->first;
maxresul = randomN;
}
}
- SendLootRollWon(0, maxguid, maxresul, ROLL_NEED, *roll);
+ SendLootRollWon(ObjectGuid::Empty, maxguid, maxresul, ROLL_NEED, *roll);
player = ObjectAccessor::FindPlayer(maxguid);
if (player && player->GetSession())
@@ -1369,7 +1369,7 @@ void Group::CountTheRoll(Rolls::iterator rollI)
if (!roll->playerVote.empty())
{
uint8 maxresul = 0;
- uint64 maxguid = (*roll->playerVote.begin()).first;
+ ObjectGuid maxguid = (*roll->playerVote.begin()).first;
Player* player;
RollVote rollvote = NOT_VALID;
@@ -1380,7 +1380,7 @@ void Group::CountTheRoll(Rolls::iterator rollI)
continue;
uint8 randomN = urand(1, 100);
- SendLootRoll(0, itr->first, randomN, itr->second, *roll);
+ SendLootRoll(ObjectGuid::Empty, itr->first, randomN, itr->second, *roll);
if (maxresul < randomN)
{
maxguid = itr->first;
@@ -1388,7 +1388,7 @@ void Group::CountTheRoll(Rolls::iterator rollI)
rollvote = itr->second;
}
}
- SendLootRollWon(0, maxguid, maxresul, rollvote, *roll);
+ SendLootRollWon(ObjectGuid::Empty, maxguid, maxresul, rollvote, *roll);
player = ObjectAccessor::FindPlayer(maxguid);
if (player && player->GetSession())
@@ -1457,16 +1457,16 @@ void Group::CountTheRoll(Rolls::iterator rollI)
delete roll;
}
-void Group::SetTargetIcon(uint8 id, uint64 whoGuid, uint64 targetGuid)
+void Group::SetTargetIcon(uint8 id, ObjectGuid whoGuid, ObjectGuid targetGuid)
{
if (id >= TARGETICONCOUNT)
return;
// clean other icons
- if (targetGuid != 0)
+ if (targetGuid)
for (int i=0; i<TARGETICONCOUNT; ++i)
if (m_targetIcons[i] == targetGuid)
- SetTargetIcon(i, 0, 0);
+ SetTargetIcon(i, ObjectGuid::Empty, ObjectGuid::Empty);
m_targetIcons[id] = targetGuid;
@@ -1488,7 +1488,7 @@ void Group::SendTargetIconList(WorldSession* session)
for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
{
- if (m_targetIcons[i] == 0)
+ if (m_targetIcons[i].IsEmpty())
continue;
data << uint8(i);
@@ -1504,7 +1504,7 @@ void Group::SendUpdate()
SendUpdateToPlayer(witr->guid, &(*witr));
}
-void Group::SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot)
+void Group::SendUpdateToPlayer(ObjectGuid playerGUID, MemberSlot* slot)
{
Player* player = ObjectAccessor::FindPlayer(playerGUID);
@@ -1591,12 +1591,12 @@ void Group::UpdatePlayerOutOfRange(Player* player)
}
}
-void Group::BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int group, uint64 ignore)
+void Group::BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int group, ObjectGuid ignore)
{
for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* player = itr->GetSource();
- if (!player || (ignore != 0 && player->GetGUID() == ignore) || (ignorePlayersInBGRaid && player->GetGroup() != this))
+ if (!player || (!ignore.IsEmpty() && player->GetGUID() == ignore) || (ignorePlayersInBGRaid && player->GetGroup() != this))
continue;
if (player->GetSession() && (group == -1 || itr->getSubGroup() == group))
@@ -1630,7 +1630,7 @@ void Group::OfflineReadyCheck()
}
}
-bool Group::_setMembersGroup(uint64 guid, uint8 group)
+bool Group::_setMembersGroup(ObjectGuid guid, uint8 group)
{
member_witerator slot = _getMemberWSlot(guid);
if (slot == m_memberSlots.end())
@@ -1645,7 +1645,7 @@ bool Group::_setMembersGroup(uint64 guid, uint8 group)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_MEMBER_SUBGROUP);
stmt->setUInt8(0, group);
- stmt->setUInt32(1, GUID_LOPART(guid));
+ stmt->setUInt32(1, guid.GetCounter());
CharacterDatabase.Execute(stmt);
}
@@ -1665,7 +1665,7 @@ bool Group::SameSubGroup(Player const* member1, Player const* member2) const
}
// Allows setting sub groups both for online or offline members
-void Group::ChangeMembersGroup(uint64 guid, uint8 group)
+void Group::ChangeMembersGroup(ObjectGuid guid, uint8 group)
{
// Only raid groups have sub groups
if (!isRaidGroup())
@@ -1696,7 +1696,7 @@ void Group::ChangeMembersGroup(uint64 guid, uint8 group)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_MEMBER_SUBGROUP);
stmt->setUInt8(0, group);
- stmt->setUInt32(1, GUID_LOPART(guid));
+ stmt->setUInt32(1, guid.GetCounter());
CharacterDatabase.Execute(stmt);
}
@@ -1736,7 +1736,7 @@ void Group::UpdateLooterGuid(WorldObject* pLootedObject, bool ifneed)
if (GetLootMethod() == FREE_FOR_ALL)
return;
- uint64 oldLooterGUID = GetLooterGuid();
+ ObjectGuid oldLooterGUID = GetLooterGuid();
member_citerator guid_itr = _getMemberCSlot(oldLooterGUID);
if (guid_itr != m_memberSlots.end())
{
@@ -1786,7 +1786,7 @@ void Group::UpdateLooterGuid(WorldObject* pLootedObject, bool ifneed)
}
else
{
- SetLooterGuid(0);
+ SetLooterGuid(ObjectGuid::Empty);
SendUpdate();
}
}
@@ -2088,8 +2088,8 @@ InstanceGroupBind* Group::BindToInstance(InstanceSave* save, bool permanent, boo
bind.save = save;
bind.perm = permanent;
if (!load)
- TC_LOG_DEBUG("maps", "Group::BindToInstance: Group (guid: %u, storage id: %u) is now bound to map %d, instance %d, difficulty %d",
- GUID_LOPART(GetGUID()), m_dbStoreId, save->GetMapId(), save->GetInstanceId(), save->GetDifficulty());
+ TC_LOG_DEBUG("maps", "Group::BindToInstance: %s, storage id: %u is now bound to map %d, instance %d, difficulty %d",
+ GetGUID().ToString().c_str(), m_dbStoreId, save->GetMapId(), save->GetInstanceId(), save->GetDifficulty());
return &bind;
}
@@ -2153,12 +2153,12 @@ void Group::SetLootMethod(LootMethod method)
m_lootMethod = method;
}
-void Group::SetLooterGuid(uint64 guid)
+void Group::SetLooterGuid(ObjectGuid guid)
{
m_looterGuid = guid;
}
-void Group::SetMasterLooterGuid(uint64 guid)
+void Group::SetMasterLooterGuid(ObjectGuid guid)
{
m_masterLooterGuid = guid;
}
@@ -2168,7 +2168,7 @@ void Group::SetLootThreshold(ItemQualities threshold)
m_lootThreshold = threshold;
}
-void Group::SetLfgRoles(uint64 guid, const uint8 roles)
+void Group::SetLfgRoles(ObjectGuid guid, uint8 roles)
{
member_witerator slot = _getMemberWSlot(guid);
if (slot == m_memberSlots.end())
@@ -2208,19 +2208,19 @@ bool Group::IsCreated() const
return GetMembersCount() > 0;
}
-uint64 Group::GetLeaderGUID() const
+ObjectGuid Group::GetLeaderGUID() const
{
return m_leaderGuid;
}
-uint64 Group::GetGUID() const
+ObjectGuid Group::GetGUID() const
{
return m_guid;
}
uint32 Group::GetLowGUID() const
{
- return GUID_LOPART(m_guid);
+ return m_guid.GetCounter();
}
char const* Group::GetLeaderName() const
@@ -2233,12 +2233,12 @@ LootMethod Group::GetLootMethod() const
return m_lootMethod;
}
-uint64 Group::GetLooterGuid() const
+ObjectGuid Group::GetLooterGuid() const
{
return m_looterGuid;
}
-uint64 Group::GetMasterLooterGuid() const
+ObjectGuid Group::GetMasterLooterGuid() const
{
return m_masterLooterGuid;
}
@@ -2248,25 +2248,25 @@ ItemQualities Group::GetLootThreshold() const
return m_lootThreshold;
}
-bool Group::IsMember(uint64 guid) const
+bool Group::IsMember(ObjectGuid guid) const
{
return _getMemberCSlot(guid) != m_memberSlots.end();
}
-bool Group::IsLeader(uint64 guid) const
+bool Group::IsLeader(ObjectGuid guid) const
{
return (GetLeaderGUID() == guid);
}
-uint64 Group::GetMemberGUID(const std::string& name)
+ObjectGuid Group::GetMemberGUID(const std::string& name)
{
for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
if (itr->name == name)
return itr->guid;
- return 0;
+ return ObjectGuid::Empty;
}
-bool Group::IsAssistant(uint64 guid) const
+bool Group::IsAssistant(ObjectGuid guid) const
{
member_citerator mslot = _getMemberCSlot(guid);
if (mslot == m_memberSlots.end())
@@ -2274,7 +2274,7 @@ bool Group::IsAssistant(uint64 guid) const
return mslot->flags & MEMBER_FLAG_ASSISTANT;
}
-bool Group::SameSubGroup(uint64 guid1, uint64 guid2) const
+bool Group::SameSubGroup(ObjectGuid guid1, ObjectGuid guid2) const
{
member_citerator mslot2 = _getMemberCSlot(guid2);
if (mslot2 == m_memberSlots.end())
@@ -2282,7 +2282,7 @@ bool Group::SameSubGroup(uint64 guid1, uint64 guid2) const
return SameSubGroup(guid1, &*mslot2);
}
-bool Group::SameSubGroup(uint64 guid1, MemberSlot const* slot2) const
+bool Group::SameSubGroup(ObjectGuid guid1, MemberSlot const* slot2) const
{
member_citerator mslot1 = _getMemberCSlot(guid1);
if (mslot1 == m_memberSlots.end() || !slot2)
@@ -2296,7 +2296,7 @@ bool Group::HasFreeSlotSubGroup(uint8 subgroup) const
}
-uint8 Group::GetMemberGroup(uint64 guid) const
+uint8 Group::GetMemberGroup(ObjectGuid guid) const
{
member_citerator mslot = _getMemberCSlot(guid);
if (mslot == m_memberSlots.end())
@@ -2314,7 +2314,7 @@ void Group::SetBattlefieldGroup(Battlefield *bg)
m_bfGroup = bg;
}
-void Group::SetGroupMemberFlag(uint64 guid, bool apply, GroupMemberFlags flag)
+void Group::SetGroupMemberFlag(ObjectGuid guid, bool apply, GroupMemberFlags flag)
{
// Assistants, main assistants and main tanks are only available in raid groups
if (!isRaidGroup())
@@ -2346,7 +2346,7 @@ void Group::SetGroupMemberFlag(uint64 guid, bool apply, GroupMemberFlags flag)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_MEMBER_FLAG);
stmt->setUInt8(0, slot->flags);
- stmt->setUInt32(1, GUID_LOPART(guid));
+ stmt->setUInt32(1, guid.GetCounter());
CharacterDatabase.Execute(stmt);
@@ -2374,7 +2374,7 @@ bool Group::isRollLootActive() const
return !RollId.empty();
}
-Group::Rolls::iterator Group::GetRoll(uint64 Guid)
+Group::Rolls::iterator Group::GetRoll(ObjectGuid Guid)
{
Rolls::iterator iter;
for (iter=RollId.begin(); iter != RollId.end(); ++iter)
@@ -2388,7 +2388,7 @@ void Group::LinkMember(GroupReference* pRef)
m_memberMgr.insertFirst(pRef);
}
-void Group::DelinkMember(uint64 guid)
+void Group::DelinkMember(ObjectGuid guid)
{
GroupReference* ref = m_memberMgr.getFirst();
while (ref)
@@ -2420,7 +2420,7 @@ void Group::_initRaidSubGroupsCounter()
++m_subGroupsCounts[itr->group];
}
-Group::member_citerator Group::_getMemberCSlot(uint64 Guid) const
+Group::member_citerator Group::_getMemberCSlot(ObjectGuid Guid) const
{
for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
if (itr->guid == Guid)
@@ -2428,7 +2428,7 @@ Group::member_citerator Group::_getMemberCSlot(uint64 Guid) const
return m_memberSlots.end();
}
-Group::member_witerator Group::_getMemberWSlot(uint64 Guid)
+Group::member_witerator Group::_getMemberWSlot(ObjectGuid Guid)
{
for (member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
if (itr->guid == Guid)
diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h
index 59f77a06308..6abfd5b667d 100644
--- a/src/server/game/Groups/Group.h
+++ b/src/server/game/Groups/Group.h
@@ -127,18 +127,18 @@ static const uint8 GroupUpdateLength[GROUP_UPDATE_FLAGS_COUNT] = { 0, 2, 2, 2, 1
class Roll : public LootValidatorRef
{
public:
- Roll(uint64 _guid, LootItem const& li);
+ Roll(ObjectGuid _guid, LootItem const& li);
~Roll();
void setLoot(Loot* pLoot);
Loot* getLoot();
void targetObjectBuildLink() override;
- uint64 itemGUID;
+ ObjectGuid itemGUID;
uint32 itemid;
int32 itemRandomPropId;
uint32 itemRandomSuffix;
uint8 itemCount;
- typedef std::map<uint64, RollVote> PlayerVote;
+ typedef std::map<ObjectGuid, RollVote> PlayerVote;
PlayerVote playerVote; //vote position correspond with player position (in group)
uint8 totalPlayersRolling;
uint8 totalNeed;
@@ -164,7 +164,7 @@ class Group
public:
struct MemberSlot
{
- uint64 guid;
+ ObjectGuid guid;
std::string name;
uint8 group;
uint8 flags;
@@ -193,15 +193,15 @@ class Group
void RemoveAllInvites();
bool AddLeaderInvite(Player* player);
bool AddMember(Player* player);
- bool RemoveMember(uint64 guid, const RemoveMethod &method = GROUP_REMOVEMETHOD_DEFAULT, uint64 kicker = 0, const char* reason = NULL);
- void ChangeLeader(uint64 guid);
+ bool RemoveMember(ObjectGuid guid, const RemoveMethod &method = GROUP_REMOVEMETHOD_DEFAULT, ObjectGuid kicker = ObjectGuid::Empty, const char* reason = NULL);
+ void ChangeLeader(ObjectGuid guid);
void SetLootMethod(LootMethod method);
- void SetLooterGuid(uint64 guid);
- void SetMasterLooterGuid(uint64 guid);
+ void SetLooterGuid(ObjectGuid guid);
+ void SetMasterLooterGuid(ObjectGuid guid);
void UpdateLooterGuid(WorldObject* pLootedObject, bool ifneed = false);
void SetLootThreshold(ItemQualities threshold);
- void Disband(bool hideDestroy=false);
- void SetLfgRoles(uint64 guid, const uint8 roles);
+ void Disband(bool hideDestroy = false);
+ void SetLfgRoles(ObjectGuid guid, uint8 roles);
// properties accessories
bool IsFull() const;
@@ -210,28 +210,28 @@ class Group
bool isBGGroup() const;
bool isBFGroup() const;
bool IsCreated() const;
- uint64 GetLeaderGUID() const;
- uint64 GetGUID() const;
+ ObjectGuid GetLeaderGUID() const;
+ ObjectGuid GetGUID() const;
uint32 GetLowGUID() const;
const char * GetLeaderName() const;
LootMethod GetLootMethod() const;
- uint64 GetLooterGuid() const;
- uint64 GetMasterLooterGuid() const;
+ ObjectGuid GetLooterGuid() const;
+ ObjectGuid GetMasterLooterGuid() const;
ItemQualities GetLootThreshold() const;
uint32 GetDbStoreId() const { return m_dbStoreId; };
// member manipulation methods
- bool IsMember(uint64 guid) const;
- bool IsLeader(uint64 guid) const;
- uint64 GetMemberGUID(const std::string& name);
- bool IsAssistant(uint64 guid) const;
+ bool IsMember(ObjectGuid guid) const;
+ bool IsLeader(ObjectGuid guid) const;
+ ObjectGuid GetMemberGUID(const std::string& name);
+ bool IsAssistant(ObjectGuid guid) const;
- Player* GetInvited(uint64 guid) const;
+ Player* GetInvited(ObjectGuid guid) const;
Player* GetInvited(const std::string& name) const;
- bool SameSubGroup(uint64 guid1, uint64 guid2) const;
- bool SameSubGroup(uint64 guid1, MemberSlot const* slot2) const;
+ bool SameSubGroup(ObjectGuid guid1, ObjectGuid guid2) const;
+ bool SameSubGroup(ObjectGuid guid1, MemberSlot const* slot2) const;
bool SameSubGroup(Player const* member1, Player const* member2) const;
bool HasFreeSlotSubGroup(uint8 subgroup) const;
@@ -240,7 +240,7 @@ class Group
GroupReference const* GetFirstMember() const { return m_memberMgr.getFirst(); }
uint32 GetMembersCount() const { return m_memberSlots.size(); }
- uint8 GetMemberGroup(uint64 guid) const;
+ uint8 GetMemberGroup(ObjectGuid guid) const;
void ConvertToLFG();
void ConvertToRaid();
@@ -249,10 +249,9 @@ class Group
void SetBattlefieldGroup(Battlefield* bf);
GroupJoinBattlegroundResult CanJoinBattlegroundQueue(Battleground const* bgOrTemplate, BattlegroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot);
- void ChangeMembersGroup(uint64 guid, uint8 group);
- void ChangeMembersGroup(Player* player, uint8 group);
- void SetTargetIcon(uint8 id, uint64 whoGuid, uint64 targetGuid);
- void SetGroupMemberFlag(uint64 guid, bool apply, GroupMemberFlags flag);
+ void ChangeMembersGroup(ObjectGuid guid, uint8 group);
+ void SetTargetIcon(uint8 id, ObjectGuid whoGuid, ObjectGuid targetGuid);
+ void SetGroupMemberFlag(ObjectGuid guid, bool apply, GroupMemberFlags flag);
void RemoveUniqueGroupMemberFlag(GroupMemberFlags flag);
Difficulty GetDifficulty(bool isRaid) const;
@@ -268,10 +267,10 @@ class Group
//void SendInit(WorldSession* session);
void SendTargetIconList(WorldSession* session);
void SendUpdate();
- void SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot = NULL);
+ void SendUpdateToPlayer(ObjectGuid playerGUID, MemberSlot* slot = NULL);
void UpdatePlayerOutOfRange(Player* player);
// ignore: GUID of player that will be ignored
- void BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int group = -1, uint64 ignore = 0);
+ void BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int group = -1, ObjectGuid ignore = ObjectGuid::Empty);
void BroadcastReadyCheck(WorldPacket* packet);
void OfflineReadyCheck();
@@ -282,23 +281,23 @@ class Group
bool isRollLootActive() const;
void SendLootStartRoll(uint32 CountDown, uint32 mapid, const Roll &r);
void SendLootStartRollToPlayer(uint32 countDown, uint32 mapId, Player* p, bool canNeed, Roll const& r);
- void SendLootRoll(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r);
- void SendLootRollWon(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r);
+ void SendLootRoll(ObjectGuid SourceGuid, ObjectGuid TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r);
+ void SendLootRollWon(ObjectGuid SourceGuid, ObjectGuid TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r);
void SendLootAllPassed(Roll const& roll);
void SendLooter(Creature* creature, Player* pLooter);
void GroupLoot(Loot* loot, WorldObject* pLootedObject);
void NeedBeforeGreed(Loot* loot, WorldObject* pLootedObject);
void MasterLoot(Loot* loot, WorldObject* pLootedObject);
- Rolls::iterator GetRoll(uint64 Guid);
+ Rolls::iterator GetRoll(ObjectGuid Guid);
void CountTheRoll(Rolls::iterator roll);
- void CountRollVote(uint64 playerGUID, uint64 Guid, uint8 Choise);
+ void CountRollVote(ObjectGuid playerGUID, ObjectGuid Guid, uint8 Choise);
void EndRoll(Loot* loot);
// related to disenchant rolls
void ResetMaxEnchantingLevel();
void LinkMember(GroupReference* pRef);
- void DelinkMember(uint64 guid);
+ void DelinkMember(ObjectGuid guid);
InstanceGroupBind* BindToInstance(InstanceSave* save, bool permanent, bool load = false);
void UnbindInstance(uint32 mapid, uint8 difficulty, bool unload = false);
@@ -312,12 +311,12 @@ class Group
void BroadcastGroupUpdate(void);
protected:
- bool _setMembersGroup(uint64 guid, uint8 group);
+ bool _setMembersGroup(ObjectGuid guid, uint8 group);
void _homebindIfInstance(Player* player);
void _initRaidSubGroupsCounter();
- member_citerator _getMemberCSlot(uint64 Guid) const;
- member_witerator _getMemberWSlot(uint64 Guid);
+ member_citerator _getMemberCSlot(ObjectGuid Guid) const;
+ member_witerator _getMemberWSlot(ObjectGuid Guid);
void SubGroupCounterIncrease(uint8 subgroup);
void SubGroupCounterDecrease(uint8 subgroup);
void ToggleGroupMemberFlag(member_witerator slot, uint8 flag, bool apply);
@@ -325,22 +324,22 @@ class Group
MemberSlotList m_memberSlots;
GroupRefManager m_memberMgr;
InvitesList m_invitees;
- uint64 m_leaderGuid;
+ ObjectGuid m_leaderGuid;
std::string m_leaderName;
GroupType m_groupType;
Difficulty m_dungeonDifficulty;
Difficulty m_raidDifficulty;
Battleground* m_bgGroup;
Battlefield* m_bfGroup;
- uint64 m_targetIcons[TARGETICONCOUNT];
+ ObjectGuid m_targetIcons[TARGETICONCOUNT];
LootMethod m_lootMethod;
ItemQualities m_lootThreshold;
- uint64 m_looterGuid;
- uint64 m_masterLooterGuid;
+ ObjectGuid m_looterGuid;
+ ObjectGuid m_masterLooterGuid;
Rolls RollId;
BoundInstancesMap m_boundInstances[MAX_DIFFICULTY];
uint8* m_subGroupsCounts;
- uint64 m_guid;
+ ObjectGuid m_guid;
uint32 m_counter; // used only in SMSG_GROUP_LIST
uint32 m_maxEnchantingLevel;
uint32 m_dbStoreId; // Represents the ID used in database (Can be reused by other groups if group was disbanded)