feat(Core/Misc): implement ObjectGuid class (port from TC) (#4885)

This commit is contained in:
UltraNix
2021-04-25 22:18:03 +02:00
committed by GitHub
parent 91081f4ad8
commit f4c226423d
568 changed files with 10655 additions and 11019 deletions

View File

@@ -30,7 +30,7 @@
#include "WorldPacket.h"
#include "WorldSession.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)
@@ -51,15 +51,13 @@ Loot* Roll::getLoot()
return getTarget();
}
Group::Group() : m_leaderGuid(0), m_leaderName(""), m_groupType(GROUPTYPE_NORMAL),
Group::Group() : m_leaderName(""), m_groupType(GROUPTYPE_NORMAL),
m_dungeonDifficulty(DUNGEON_DIFFICULTY_NORMAL), m_raidDifficulty(RAID_DIFFICULTY_10MAN_NORMAL),
m_bfGroup(nullptr), m_bgGroup(nullptr), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(0),
m_masterLooterGuid(0), m_subGroupsCounts(nullptr), m_guid(0), m_counter(0), m_maxEnchantingLevel(0), _difficultyChangePreventionTime(0),
m_bfGroup(nullptr), m_bgGroup(nullptr), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON),
m_subGroupsCounts(nullptr), m_counter(0), m_maxEnchantingLevel(0), _difficultyChangePreventionTime(0),
_difficultyChangePreventionType(DIFFICULTY_PREVENTION_CHANGE_NONE)
{
for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
m_targetIcons[i] = 0;
sScriptMgr->OnConstructGroup(this);
sScriptMgr->OnConstructGroup(this);
}
Group::~Group()
@@ -90,10 +88,10 @@ Group::~Group()
bool Group::Create(Player* leader)
{
uint64 leaderGuid = leader->GetGUID();
uint32 lowguid = sGroupMgr->GenerateGroupId();
ObjectGuid leaderGuid = leader->GetGUID();
ObjectGuid::LowType lowguid = sGroupMgr->GenerateGroupId();
m_guid = MAKE_NEW_GUID(lowguid, 0, HIGHGUID_GROUP);
m_guid = ObjectGuid::Create<HighGuid::Group>(lowguid);
m_leaderGuid = leaderGuid;
m_leaderName = leader->GetName();
leader->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GROUP_LEADER);
@@ -109,7 +107,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;
@@ -125,22 +123,22 @@ bool Group::Create(Player* leader)
uint8 index = 0;
stmt->setUInt32(index++, lowguid);
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);
@@ -156,13 +154,14 @@ bool Group::Create(Player* leader)
bool Group::LoadGroupFromDB(Field* fields)
{
m_guid = MAKE_NEW_GUID(fields[16].GetUInt32(), 0, HIGHGUID_GROUP);
m_leaderGuid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
ObjectGuid::LowType groupLowGuid = fields[16].GetUInt32();
m_guid = ObjectGuid::Create<HighGuid::Group>(groupLowGuid);
m_leaderGuid = ObjectGuid::Create<HighGuid::Player>(fields[0].GetUInt32());
// group leader not exist
if (!sObjectMgr->GetPlayerNameByGUID(fields[0].GetUInt32(), m_leaderName))
{
uint32 groupLowGuid = fields[16].GetUInt32();
SQLTransaction trans = CharacterDatabase.BeginTransaction();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP);
stmt->setUInt32(0, groupLowGuid);
@@ -178,11 +177,11 @@ bool Group::LoadGroupFromDB(Field* fields)
}
m_lootMethod = LootMethod(fields[1].GetUInt8());
m_looterGuid = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER);
m_looterGuid = ObjectGuid::Create<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)
@@ -200,7 +199,7 @@ bool Group::LoadGroupFromDB(Field* fields)
else
m_raidDifficulty = Difficulty(r_diff);
m_masterLooterGuid = MAKE_NEW_GUID(fields[15].GetUInt32(), 0, HIGHGUID_PLAYER);
m_masterLooterGuid = ObjectGuid::Create<HighGuid::Player>(fields[15].GetUInt32());
if (m_groupType & GROUPTYPE_LFG)
sLFGMgr->_LoadFromDB(fields, GetGUID());
@@ -208,17 +207,17 @@ bool Group::LoadGroupFromDB(Field* fields)
return true;
}
void Group::LoadMemberFromDB(uint32 guidLow, uint8 memberFlags, uint8 subgroup, uint8 roles)
void Group::LoadMemberFromDB(ObjectGuid::LowType guidLow, uint8 memberFlags, uint8 subgroup, uint8 roles)
{
MemberSlot member;
member.guid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER);
member.guid = ObjectGuid::Create<HighGuid::Player>(guidLow);
// skip non-existed member
if (!sObjectMgr->GetPlayerNameByGUID(member.guid, member.name))
if (!sObjectMgr->GetPlayerNameByGUID(member.guid.GetCounter(), member.name))
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER);
stmt->setUInt32(0, guidLow);
stmt->setUInt32(1, GetLowGUID());
stmt->setUInt32(1, GetGUID().GetCounter());
CharacterDatabase.Execute(stmt);
return;
}
@@ -229,7 +228,7 @@ void Group::LoadMemberFromDB(uint32 guidLow, uint8 memberFlags, uint8 subgroup,
m_memberSlots.push_back(member);
if (!isBGGroup() && !isBFGroup())
sWorld->UpdateGlobalPlayerGroup(guidLow, GetLowGUID());
sWorld->UpdateGlobalPlayerGroup(guidLow, GetGUID().GetCounter());
SubGroupCounterIncrease(subgroup);
@@ -245,7 +244,7 @@ void Group::ConvertToLFG()
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_TYPE);
stmt->setUInt8(0, uint8(m_groupType));
stmt->setUInt32(1, GetLowGUID());
stmt->setUInt32(1, GetGUID().GetCounter());
CharacterDatabase.Execute(stmt);
}
@@ -264,7 +263,7 @@ void Group::ConvertToRaid()
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_TYPE);
stmt->setUInt8(0, uint8(m_groupType));
stmt->setUInt32(1, GetLowGUID());
stmt->setUInt32(1, GetGUID().GetCounter());
CharacterDatabase.Execute(stmt);
}
@@ -331,7 +330,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)
{
@@ -382,7 +381,7 @@ bool Group::AddMember(Player* player)
member.roles = 0;
m_memberSlots.push_back(member);
if (!isBGGroup() && !isBFGroup())
sWorld->UpdateGlobalPlayerGroup(player->GetGUIDLow(), GetLowGUID());
sWorld->UpdateGlobalPlayerGroup(player->GetGUID().GetCounter(), GetGUID().GetCounter());
SubGroupCounterIncrease(subGroup);
@@ -403,14 +402,14 @@ 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();
}
if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_GROUP_MEMBER);
stmt->setUInt32(0, GetLowGUID());
stmt->setUInt32(1, GUID_LOPART(member.guid));
stmt->setUInt32(0, GetGUID().GetCounter());
stmt->setUInt32(1, member.guid.GetCounter());
stmt->setUInt8(2, member.flags);
stmt->setUInt8(3, member.group);
stmt->setUInt8(4, member.roles);
@@ -425,7 +424,7 @@ bool Group::AddMember(Player* player)
if (!IsLeader(player->GetGUID()) && !isBGGroup() && !isBFGroup())
{
Player::ResetInstances(player->GetGUIDLow(), INSTANCE_RESET_GROUP_JOIN, false);
Player::ResetInstances(player->GetGUID(), INSTANCE_RESET_GROUP_JOIN, false);
if (player->GetDungeonDifficulty() != GetDungeonDifficulty())
{
@@ -440,7 +439,7 @@ bool Group::AddMember(Player* player)
}
else if (IsLeader(player->GetGUID()) && isLFGGroup()) // pussywizard
{
Player::ResetInstances(player->GetGUIDLow(), INSTANCE_RESET_GROUP_JOIN, false);
Player::ResetInstances(player->GetGUID(), INSTANCE_RESET_GROUP_JOIN, false);
}
player->SetGroupUpdateFlag(GROUP_UPDATE_FULL);
@@ -502,7 +501,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 /*= nullptr*/)
bool Group::RemoveMember(ObjectGuid guid, const RemoveMethod& method /*= GROUP_REMOVEMETHOD_DEFAULT*/, ObjectGuid kicker /*= ObjectGuid::Empty*/, const char* reason /*= nullptr*/)
{
BroadcastGroupUpdate();
@@ -516,7 +515,7 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod& method /*= GROUP_REMOV
// remove member and change leader (if need) only if strong more 2 members _before_ member remove (BG/BF allow 1 member group)
if (GetMembersCount() > ((isBGGroup() || isLFGGroup() || isBFGroup()) ? 1u : 2u))
{
Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(guid);
Player* player = ObjectAccessor::FindConnectedPlayer(guid);
if (player)
{
// Battleground group handling
@@ -545,7 +544,7 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod& method /*= GROUP_REMOV
// Do we really need to send this opcode?
data.Initialize(SMSG_GROUP_LIST, 1 + 1 + 1 + 1 + 8 + 4 + 4 + 8);
data << uint8(0x10) << uint8(0) << uint8(0) << uint8(0);
data << uint64(m_guid) << uint32(m_counter) << uint32(0) << uint64(0);
data << m_guid << uint32(m_counter) << uint32(0) << uint64(0);
player->GetSession()->SendPacket(&data);
}
@@ -553,8 +552,8 @@ 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(1, GetLowGUID());
stmt->setUInt32(0, guid.GetCounter());
stmt->setUInt32(1, GetGUID().GetCounter());
CharacterDatabase.Execute(stmt);
}
@@ -600,7 +599,7 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod& method /*= GROUP_REMOV
SubGroupCounterDecrease(slot->group);
m_memberSlots.erase(slot);
if (!isBGGroup() && !isBFGroup())
sWorld->UpdateGlobalPlayerGroup(GUID_LOPART(guid), 0);
sWorld->UpdateGlobalPlayerGroup(guid.GetCounter(), 0);
}
// Pick new leader if necessary
@@ -610,7 +609,7 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod& method /*= GROUP_REMOV
validLeader = false;
for (member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
{
if (ObjectAccessor::FindPlayerInOrOutOfWorld(itr->guid))
if (ObjectAccessor::FindConnectedPlayer(itr->guid))
{
ChangeLeader(itr->guid);
validLeader = true;
@@ -636,7 +635,7 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod& method /*= GROUP_REMOV
if (isLFGGroup() && GetMembersCount() == 1)
{
Player* leader = ObjectAccessor::FindPlayerInOrOutOfWorld(GetLeaderGUID());
Player* leader = ObjectAccessor::FindConnectedPlayer(GetLeaderGUID());
uint32 mapId = sLFGMgr->GetDungeonMapId(GetGUID());
lfg::LfgState state = sLFGMgr->GetState(GetGUID());
if (!mapId || !leader || (leader->IsAlive() && leader->GetMapId() != mapId) || state == lfg::LFG_STATE_NONE)
@@ -663,14 +662,14 @@ 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);
if (slot == m_memberSlots.end())
return;
Player* newLeader = ObjectAccessor::FindPlayerInOrOutOfWorld(slot->guid);
Player* newLeader = ObjectAccessor::FindConnectedPlayer(slot->guid);
// Don't allow switching leader to offline players
if (!newLeader)
@@ -681,15 +680,15 @@ void Group::ChangeLeader(uint64 newLeaderGuid)
SQLTransaction trans = CharacterDatabase.BeginTransaction();
// Update the group leader
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_LEADER);
stmt->setUInt32(0, newLeader->GetGUIDLow());
stmt->setUInt32(1, GetLowGUID());
stmt->setUInt32(0, newLeader->GetGUID().GetCounter());
stmt->setUInt32(1, GetGUID().GetCounter());
trans->Append(stmt);
CharacterDatabase.CommitTransaction(trans);
sInstanceSaveMgr->CopyBinds(m_leaderGuid, newLeaderGuid, newLeader);
}
if (Player* oldLeader = ObjectAccessor::FindPlayerInOrOutOfWorld(m_leaderGuid))
if (Player* oldLeader = ObjectAccessor::FindConnectedPlayer(m_leaderGuid))
oldLeader->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_GROUP_LEADER);
newLeader->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GROUP_LEADER);
@@ -712,9 +711,9 @@ void Group::Disband(bool hideDestroy /* = false */)
for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
{
if (!isBGGroup() && !isBFGroup())
sWorld->UpdateGlobalPlayerGroup(GUID_LOPART(citr->guid), 0);
sWorld->UpdateGlobalPlayerGroup(citr->guid.GetCounter(), 0);
player = ObjectAccessor::FindPlayerInOrOutOfWorld(citr->guid);
player = ObjectAccessor::FindConnectedPlayer(citr->guid);
_homebindIfInstance(player);
if (!isBGGroup() && !isBFGroup())
@@ -756,7 +755,7 @@ void Group::Disband(bool hideDestroy /* = false */)
{
data.Initialize(SMSG_GROUP_LIST, 1 + 1 + 1 + 1 + 8 + 4 + 4 + 8);
data << uint8(0x10) << uint8(0) << uint8(0) << uint8(0);
data << uint64(m_guid) << uint32(m_counter) << uint32(0) << uint64(0);
data << m_guid << uint32(m_counter) << uint32(0) << uint64(0);
player->GetSession()->SendPacket(&data);
}
}
@@ -770,17 +769,17 @@ void Group::Disband(bool hideDestroy /* = false */)
SQLTransaction trans = CharacterDatabase.BeginTransaction();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP);
stmt->setUInt32(0, GetLowGUID());
stmt->setUInt32(0, GetGUID().GetCounter());
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER_ALL);
stmt->setUInt32(0, GetLowGUID());
stmt->setUInt32(0, GetGUID().GetCounter());
trans->Append(stmt);
CharacterDatabase.CommitTransaction(trans);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_LFG_DATA);
stmt->setUInt32(0, GetLowGUID());
stmt->setUInt32(0, GetGUID().GetCounter());
CharacterDatabase.Execute(stmt);
}
@@ -795,7 +794,7 @@ void Group::Disband(bool hideDestroy /* = false */)
void Group::SendLootStartRoll(uint32 CountDown, uint32 mapid, const Roll& r)
{
WorldPacket data(SMSG_LOOT_START_ROLL, (8 + 4 + 4 + 4 + 4 + 4 + 4 + 1));
data << uint64(r.itemGUID); // guid of rolled item
data << r.itemGUID; // guid of rolled item
data << uint32(mapid); // 3.3.3 mapid
data << uint32(r.itemSlot); // itemslot
data << uint32(r.itemid); // the itemEntryId for the item that shall be rolled for
@@ -807,7 +806,7 @@ void Group::SendLootStartRoll(uint32 CountDown, uint32 mapid, const Roll& r)
for (Roll::PlayerVote::const_iterator itr = r.playerVote.begin(); itr != r.playerVote.end(); ++itr)
{
Player* p = ObjectAccessor::FindPlayerInOrOutOfWorld(itr->first);
Player* p = ObjectAccessor::FindConnectedPlayer(itr->first);
if (!p)
continue;
@@ -822,7 +821,7 @@ void Group::SendLootStartRollToPlayer(uint32 countDown, uint32 mapId, Player* p,
return;
WorldPacket data(SMSG_LOOT_START_ROLL, (8 + 4 + 4 + 4 + 4 + 4 + 4 + 1));
data << uint64(r.itemGUID); // guid of rolled item
data << r.itemGUID; // guid of rolled item
data << uint32(mapId); // 3.3.3 mapid
data << uint32(r.itemSlot); // itemslot
data << uint32(r.itemid); // the itemEntryId for the item that shall be rolled for
@@ -838,12 +837,12 @@ 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
data << sourceGuid; // guid of the item rolled
data << uint32(roll.itemSlot); // slot
data << uint64(targetGuid);
data << targetGuid;
data << uint32(roll.itemid); // the itemEntryId for the item that shall be rolled for
data << uint32(roll.itemRandomSuffix); // randomSuffix
data << uint32(roll.itemRandomPropId); // Item random property ID
@@ -853,7 +852,7 @@ void Group::SendLootRoll(uint64 sourceGuid, uint64 targetGuid, uint8 rollNumber,
for (Roll::PlayerVote::const_iterator itr = roll.playerVote.begin(); itr != roll.playerVote.end(); ++itr)
{
Player* p = ObjectAccessor::FindPlayerInOrOutOfWorld(itr->first);
Player* p = ObjectAccessor::FindConnectedPlayer(itr->first);
if (!p)
continue;
@@ -862,21 +861,21 @@ 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
data << sourceGuid; // guid of the item rolled
data << uint32(roll.itemSlot); // slot
data << uint32(roll.itemid); // the itemEntryId for the item that shall be rolled for
data << uint32(roll.itemRandomSuffix); // randomSuffix
data << uint32(roll.itemRandomPropId); // Item random property
data << uint64(targetGuid); // guid of the player who won.
data << targetGuid; // guid of the player who won.
data << uint8(rollNumber); // rollnumber realted to SMSG_LOOT_ROLL
data << uint8(rollType); // rollType related to SMSG_LOOT_ROLL
for (Roll::PlayerVote::const_iterator itr = roll.playerVote.begin(); itr != roll.playerVote.end(); ++itr)
{
Player* p = ObjectAccessor::FindPlayerInOrOutOfWorld(itr->first);
Player* p = ObjectAccessor::FindConnectedPlayer(itr->first);
if (!p)
continue;
@@ -888,7 +887,7 @@ void Group::SendLootRollWon(uint64 sourceGuid, uint64 targetGuid, uint8 rollNumb
void Group::SendLootAllPassed(Roll const& roll)
{
WorldPacket data(SMSG_LOOT_ALL_PASSED, (8 + 4 + 4 + 4 + 4));
data << uint64(roll.itemGUID); // Guid of the item rolled
data << roll.itemGUID; // Guid of the item rolled
data << uint32(roll.itemSlot); // Item loot slot
data << uint32(roll.itemid); // The itemEntryId for the item that shall be rolled for
data << uint32(roll.itemRandomPropId); // Item random property ID
@@ -896,7 +895,7 @@ void Group::SendLootAllPassed(Roll const& roll)
for (Roll::PlayerVote::const_iterator itr = roll.playerVote.begin(); itr != roll.playerVote.end(); ++itr)
{
Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(itr->first);
Player* player = ObjectAccessor::FindConnectedPlayer(itr->first);
if (!player)
continue;
@@ -911,15 +910,15 @@ void Group::SendLooter(Creature* creature, Player* groupLooter)
ASSERT(creature);
WorldPacket data(SMSG_LOOT_LIST, (8 + 8));
data << uint64(creature->GetGUID());
data << creature->GetGUID();
if (GetLootMethod() == MASTER_LOOT && creature->loot.hasOverThresholdItem())
data.appendPackGUID(GetMasterLooterGuid());
data << GetMasterLooterGuid().WriteAsPacked();
else
data << uint8(0);
if (groupLooter)
data.append(groupLooter->GetPackGUID());
data << groupLooter->GetPackGUID();
else
data << uint8(0);
@@ -943,10 +942,10 @@ void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject)
continue;
}
//roll for over-threshold item if it's one-player loot
// 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::Create<HighGuid::Item>(sObjectMgr->GetGenerator<HighGuid::Item>().Generate());
Roll* r = new Roll(newitemGUID, *i);
//a vector is filled with only near party members
@@ -1003,12 +1002,12 @@ void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject)
if (Creature* creature = pLootedObject->ToCreature())
{
creature->m_groupLootTimer = 60000;
creature->lootingGroupLowGUID = GetLowGUID();
creature->lootingGroupLowGUID = GetGUID().GetCounter();
}
else if (GameObject* go = pLootedObject->ToGameObject())
{
go->m_groupLootTimer = 60000;
go->lootingGroupLowGUID = GetLowGUID();
go->lootingGroupLowGUID = GetGUID().GetCounter();
}
}
else
@@ -1029,7 +1028,7 @@ void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject)
continue;
}
uint64 newitemGUID = MAKE_NEW_GUID(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM);
ObjectGuid newitemGUID = ObjectGuid::Create<HighGuid::Item>(sObjectMgr->GetGenerator<HighGuid::Item>().Generate());
Roll* r = new Roll(newitemGUID, *i);
//a vector is filled with only near party members
@@ -1063,12 +1062,12 @@ void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject)
if (Creature* creature = pLootedObject->ToCreature())
{
creature->m_groupLootTimer = 60000;
creature->lootingGroupLowGUID = GetLowGUID();
creature->lootingGroupLowGUID = GetGUID().GetCounter();
}
else if (GameObject* go = pLootedObject->ToGameObject())
{
go->m_groupLootTimer = 60000;
go->lootingGroupLowGUID = GetLowGUID();
go->lootingGroupLowGUID = GetGUID().GetCounter();
}
}
else
@@ -1090,7 +1089,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::Create<HighGuid::Item>(sObjectMgr->GetGenerator<HighGuid::Item>().Generate());
Roll* r = new Roll(newitemGUID, *i);
for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
@@ -1143,12 +1142,12 @@ void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject)
if (Creature* creature = lootedObject->ToCreature())
{
creature->m_groupLootTimer = 60000;
creature->lootingGroupLowGUID = GetLowGUID();
creature->lootingGroupLowGUID = GetGUID().GetCounter();
}
else if (GameObject* go = lootedObject->ToGameObject())
{
go->m_groupLootTimer = 60000;
go->lootingGroupLowGUID = GetLowGUID();
go->lootingGroupLowGUID = GetGUID().GetCounter();
}
}
else
@@ -1164,7 +1163,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::Create<HighGuid::Item>(sObjectMgr->GetGenerator<HighGuid::Item>().Generate());
Roll* r = new Roll(newitemGUID, *i);
for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
@@ -1205,12 +1204,12 @@ void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject)
if (Creature* creature = lootedObject->ToCreature())
{
creature->m_groupLootTimer = 60000;
creature->lootingGroupLowGUID = GetLowGUID();
creature->lootingGroupLowGUID = GetGUID().GetCounter();
}
else if (GameObject* go = lootedObject->ToGameObject())
{
go->m_groupLootTimer = 60000;
go->lootingGroupLowGUID = GetLowGUID();
go->lootingGroupLowGUID = GetGUID().GetCounter();
}
}
else
@@ -1253,7 +1252,7 @@ void Group::MasterLoot(Loot* loot, WorldObject* pLootedObject)
if (looter->IsAtGroupRewardDistance(pLootedObject))
{
data << uint64(looter->GetGUID());
data << looter->GetGUID();
++real_count;
}
}
@@ -1268,7 +1267,7 @@ void Group::MasterLoot(Loot* loot, WorldObject* pLootedObject)
}
}
bool Group::CountRollVote(uint64 playerGUID, uint64 Guid, uint8 Choice)
bool Group::CountRollVote(ObjectGuid playerGUID, ObjectGuid Guid, uint8 Choice)
{
Rolls::iterator rollI = GetRoll(Guid);
if (rollI == RollId.end())
@@ -1289,22 +1288,22 @@ bool 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;
@@ -1349,7 +1348,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, Map* allowedMap)
if (!roll->playerVote.empty())
{
uint8 maxresul = 0;
uint64 maxguid = 0; // pussywizard: start with 0 >_>
ObjectGuid maxguid; // pussywizard: start with 0 >_>
Player* player = nullptr;
for (Roll::PlayerVote::const_iterator itr = roll->playerVote.begin(); itr != roll->playerVote.end(); ++itr)
@@ -1365,7 +1364,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, Map* allowedMap)
}
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;
@@ -1375,7 +1374,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, Map* allowedMap)
if (maxguid) // pussywizard: added condition
{
SendLootRollWon(0, maxguid, maxresul, ROLL_NEED, *roll);
SendLootRollWon(ObjectGuid::Empty, maxguid, maxresul, ROLL_NEED, *roll);
player = ObjectAccessor::FindPlayer(maxguid);
if (player)
@@ -1411,7 +1410,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, Map* allowedMap)
if (!roll->playerVote.empty())
{
uint8 maxresul = 0;
uint64 maxguid = 0; // pussywizard: start with 0
ObjectGuid maxguid; // pussywizard: start with 0
Player* player = nullptr;
RollVote rollvote = NOT_VALID;
@@ -1429,7 +1428,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, Map* allowedMap)
}
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;
@@ -1440,7 +1439,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, Map* allowedMap)
if (maxguid) // pussywizard: added condition
{
SendLootRollWon(0, maxguid, maxresul, rollvote, *roll);
SendLootRollWon(ObjectGuid::Empty, maxguid, maxresul, rollvote, *roll);
player = ObjectAccessor::FindPlayer(maxguid);
if (player)
@@ -1498,24 +1497,24 @@ void Group::CountTheRoll(Rolls::iterator rollI, Map* allowedMap)
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;
WorldPacket data(MSG_RAID_TARGET_UPDATE, (1 + 8 + 1 + 8));
data << uint8(0); // set targets
data << uint64(whoGuid);
data << whoGuid;
data << uint8(id);
data << uint64(targetGuid);
data << targetGuid;
BroadcastPacket(&data, true);
}
@@ -1529,11 +1528,11 @@ void Group::SendTargetIconList(WorldSession* session)
for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
{
if (m_targetIcons[i] == 0)
if (!m_targetIcons[i])
continue;
data << uint8(i);
data << uint64(m_targetIcons[i]);
data << m_targetIcons[i];
}
session->SendPacket(&data);
@@ -1545,9 +1544,9 @@ void Group::SendUpdate()
SendUpdateToPlayer(witr->guid, &(*witr));
}
void Group::SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot)
void Group::SendUpdateToPlayer(ObjectGuid playerGUID, MemberSlot* slot)
{
Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(playerGUID);
Player* player = ObjectAccessor::FindConnectedPlayer(playerGUID);
if (!player || player->GetGroup() != this)
return;
@@ -1574,7 +1573,7 @@ void Group::SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot)
data << uint32(sLFGMgr->GetDungeon(m_guid));
}
data << uint64(m_guid);
data << m_guid;
data << uint32(m_counter++); // 3.3, value increases every time this packet gets sent
data << uint32(GetMembersCount() - 1);
for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
@@ -1582,27 +1581,27 @@ void Group::SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot)
if (slot->guid == citr->guid)
continue;
Player* member = ObjectAccessor::FindPlayerInOrOutOfWorld(citr->guid);
Player* member = ObjectAccessor::FindConnectedPlayer(citr->guid);
uint8 onlineState = (member && !member->GetSession()->PlayerLogout()) ? MEMBER_STATUS_ONLINE : MEMBER_STATUS_OFFLINE;
onlineState = onlineState | ((isBGGroup() || isBFGroup()) ? MEMBER_STATUS_PVP : 0);
data << citr->name;
data << uint64(citr->guid); // guid
data << citr->guid; // guid
data << uint8(onlineState); // online-state
data << uint8(citr->group); // groupid
data << uint8(citr->flags); // See enum GroupMemberFlags
data << uint8(citr->roles); // Lfg Roles
}
data << uint64(m_leaderGuid); // leader guid
data << m_leaderGuid; // leader guid
if (GetMembersCount() - 1)
{
data << uint8(m_lootMethod); // loot method
if (m_lootMethod == MASTER_LOOT)
data << uint64(m_masterLooterGuid); // master looter guid
data << m_masterLooterGuid; // master looter guid
else
data << uint64(0); // looter guid
@@ -1632,12 +1631,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 != nullptr; itr = itr->next())
{
Player* player = itr->GetSource();
if (!player || (ignore != 0 && player->GetGUID() == ignore) || (ignorePlayersInBGRaid && player->GetGroup() != this))
if (!player || (ignore && player->GetGUID() == ignore) || (ignorePlayersInBGRaid && player->GetGroup() != this))
continue;
if (group == -1 || itr->getSubGroup() == group)
@@ -1660,11 +1659,11 @@ void Group::OfflineReadyCheck()
{
for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
{
Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(citr->guid);
Player* player = ObjectAccessor::FindConnectedPlayer(citr->guid);
if (!player)
{
WorldPacket data(MSG_RAID_READY_CHECK_CONFIRM, 9);
data << uint64(citr->guid);
data << citr->guid;
data << uint8(0);
BroadcastReadyCheck(&data);
}
@@ -1683,7 +1682,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())
@@ -1714,13 +1713,13 @@ 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);
}
// In case the moved player is online, update the player object with the new sub group references
if (Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(guid))
if (Player* player = ObjectAccessor::FindConnectedPlayer(guid))
{
if (player->GetGroup() == this)
player->GetGroupRef().setSubGroup(group);
@@ -1750,7 +1749,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())
{
@@ -1800,7 +1799,7 @@ void Group::UpdateLooterGuid(WorldObject* pLootedObject, bool ifneed)
}
else
{
SetLooterGuid(0);
SetLooterGuid(ObjectGuid::Empty);
SendUpdate();
}
}
@@ -1913,7 +1912,7 @@ void Group::SetDungeonDifficulty(Difficulty difficulty)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_DIFFICULTY);
stmt->setUInt8(0, uint8(m_dungeonDifficulty));
stmt->setUInt32(1, GetLowGUID());
stmt->setUInt32(1, GetGUID().GetCounter());
CharacterDatabase.Execute(stmt);
}
@@ -1934,7 +1933,7 @@ void Group::SetRaidDifficulty(Difficulty difficulty)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_RAID_DIFFICULTY);
stmt->setUInt8(0, uint8(m_raidDifficulty));
stmt->setUInt32(1, GetLowGUID());
stmt->setUInt32(1, GetGUID().GetCounter());
CharacterDatabase.Execute(stmt);
}
@@ -1959,7 +1958,7 @@ void Group::ResetInstances(uint8 method, bool isRaid, Player* leader)
if (leader->GetDifficulty(false) != DUNGEON_DIFFICULTY_NORMAL)
break;
std::vector<InstanceSave*> toUnbind;
BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(leader->GetGUIDLow(), Difficulty(DUNGEON_DIFFICULTY_NORMAL));
BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(leader->GetGUID(), Difficulty(DUNGEON_DIFFICULTY_NORMAL));
for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr)
{
InstanceSave* instanceSave = itr->second.save;
@@ -1983,7 +1982,7 @@ void Group::ResetInstances(uint8 method, bool isRaid, Player* leader)
case INSTANCE_RESET_CHANGE_DIFFICULTY:
{
std::vector<InstanceSave*> toUnbind;
BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(leader->GetGUIDLow(), leader->GetDifficulty(isRaid));
BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(leader->GetGUID(), leader->GetDifficulty(isRaid));
for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr)
{
InstanceSave* instanceSave = itr->second.save;
@@ -2018,7 +2017,7 @@ void Group::_cancelHomebindIfInstance(Player* player)
// if player is reinvited to group and in the instance - cancel homebind timer
if (!player->FindMap() || !player->FindMap()->IsDungeon())
return;
InstancePlayerBind* bind = sInstanceSaveMgr->PlayerGetBoundInstance(player->GetGUIDLow(), player->FindMap()->GetId(), player->GetDifficulty(player->FindMap()->IsRaid()));
InstancePlayerBind* bind = sInstanceSaveMgr->PlayerGetBoundInstance(player->GetGUID(), player->FindMap()->GetId(), player->GetDifficulty(player->FindMap()->IsRaid()));
if (bind && bind->save->GetInstanceId() == player->GetInstanceId())
player->m_InstanceValid = true;
}
@@ -2058,12 +2057,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;
}
@@ -2073,7 +2072,7 @@ void Group::SetLootThreshold(ItemQualities threshold)
m_lootThreshold = threshold;
}
void Group::SetLfgRoles(uint64 guid, const uint8 roles)
void Group::SetLfgRoles(ObjectGuid guid, const uint8 roles)
{
member_witerator slot = _getMemberWSlot(guid);
if (slot == m_memberSlots.end())
@@ -2113,21 +2112,16 @@ 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);
}
const char* Group::GetLeaderName() const
{
return m_leaderName.c_str();
@@ -2138,12 +2132,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;
}
@@ -2153,25 +2147,26 @@ 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())
@@ -2179,7 +2174,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())
@@ -2187,7 +2182,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)
@@ -2200,7 +2195,7 @@ bool Group::HasFreeSlotSubGroup(uint8 subgroup) const
return (m_subGroupsCounts && m_subGroupsCounts[subgroup] < MAXGROUPSIZE);
}
uint8 Group::GetMemberGroup(uint64 guid) const
uint8 Group::GetMemberGroup(ObjectGuid guid) const
{
member_citerator mslot = _getMemberCSlot(guid);
if (mslot == m_memberSlots.end())
@@ -2218,7 +2213,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())
@@ -2251,7 +2246,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);
@@ -2279,7 +2274,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)
@@ -2305,7 +2300,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)
@@ -2313,7 +2308,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)