mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[10371] More wide use ObjectGuid in group code.
Also drop some unused functions. And fix some uint32 -> uint6 guid assigns.
This commit is contained in:
parent
acdaac3587
commit
dbe9c6f190
19 changed files with 354 additions and 346 deletions
|
|
@ -1169,7 +1169,7 @@ void BattleGround::AddPlayer(Player *plr)
|
||||||
|
|
||||||
// score struct must be created in inherited class
|
// score struct must be created in inherited class
|
||||||
|
|
||||||
uint64 guid = plr->GetGUID();
|
ObjectGuid guid = plr->GetObjectGuid();
|
||||||
uint32 team = plr->GetBGTeam();
|
uint32 team = plr->GetBGTeam();
|
||||||
|
|
||||||
BattleGroundPlayer bp;
|
BattleGroundPlayer bp;
|
||||||
|
|
@ -1177,7 +1177,7 @@ void BattleGround::AddPlayer(Player *plr)
|
||||||
bp.Team = team;
|
bp.Team = team;
|
||||||
|
|
||||||
// Add to list/maps
|
// Add to list/maps
|
||||||
m_Players[guid] = bp;
|
m_Players[guid.GetRawValue()] = bp;
|
||||||
|
|
||||||
UpdatePlayersCountByTeam(team, false); // +1 player
|
UpdatePlayersCountByTeam(team, false); // +1 player
|
||||||
|
|
||||||
|
|
@ -1235,16 +1235,9 @@ void BattleGround::AddPlayer(Player *plr)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this method adds player to his team's bg group, or sets his correct group if player is already in bg group */
|
/* this method adds player to his team's bg group, or sets his correct group if player is already in bg group */
|
||||||
void BattleGround::AddOrSetPlayerToCorrectBgGroup(Player *plr, uint64 plr_guid, uint32 team)
|
void BattleGround::AddOrSetPlayerToCorrectBgGroup(Player *plr, ObjectGuid plr_guid, uint32 team)
|
||||||
{
|
{
|
||||||
Group* group = GetBgRaid(team);
|
if (Group* group = GetBgRaid(team)) // raid already exist
|
||||||
if(!group) // first player joined
|
|
||||||
{
|
|
||||||
group = new Group;
|
|
||||||
SetBgRaid(team, group);
|
|
||||||
group->Create(plr_guid, plr->GetName());
|
|
||||||
}
|
|
||||||
else // raid already exist
|
|
||||||
{
|
{
|
||||||
if (group->IsMember(plr_guid))
|
if (group->IsMember(plr_guid))
|
||||||
{
|
{
|
||||||
|
|
@ -1259,6 +1252,12 @@ void BattleGround::AddOrSetPlayerToCorrectBgGroup(Player *plr, uint64 plr_guid,
|
||||||
group->ChangeLeader(plr_guid);
|
group->ChangeLeader(plr_guid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else // first player joined
|
||||||
|
{
|
||||||
|
group = new Group;
|
||||||
|
SetBgRaid(team, group);
|
||||||
|
group->Create(plr_guid, plr->GetName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method should be called when player logs into running battleground
|
// This method should be called when player logs into running battleground
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
#include "SharedDefines.h"
|
#include "SharedDefines.h"
|
||||||
#include "Map.h"
|
#include "Map.h"
|
||||||
#include "ByteBuffer.h"
|
#include "ByteBuffer.h"
|
||||||
|
#include "ObjectGuid.h"
|
||||||
|
|
||||||
// magic event-numbers
|
// magic event-numbers
|
||||||
#define BG_EVENT_NONE 255
|
#define BG_EVENT_NONE 255
|
||||||
|
|
@ -481,7 +482,7 @@ class BattleGround
|
||||||
|
|
||||||
virtual void AddPlayer(Player *plr); // must be implemented in BG subclass
|
virtual void AddPlayer(Player *plr); // must be implemented in BG subclass
|
||||||
|
|
||||||
void AddOrSetPlayerToCorrectBgGroup(Player *plr, uint64 plr_guid, uint32 team);
|
void AddOrSetPlayerToCorrectBgGroup(Player *plr, ObjectGuid plr_guid, uint32 team);
|
||||||
|
|
||||||
virtual void RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPacket);
|
virtual void RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPacket);
|
||||||
// can be extended in in BG subclass
|
// can be extended in in BG subclass
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data )
|
||||||
// no group found, error
|
// no group found, error
|
||||||
if (!grp)
|
if (!grp)
|
||||||
return;
|
return;
|
||||||
if(grp->GetLeaderGUID() != _player->GetGUID())
|
if (grp->GetLeaderGuid() != _player->GetObjectGuid())
|
||||||
return;
|
return;
|
||||||
err = grp->CanJoinBattleGroundQueue(bg, bgQueueTypeId, 0, bg->GetMaxPlayersPerTeam(), false, 0);
|
err = grp->CanJoinBattleGroundQueue(bg, bgQueueTypeId, 0, bg->GetMaxPlayersPerTeam(), false, 0);
|
||||||
isPremade = (grp->GetMembersCount() >= bg->GetMinPlayersPerTeam());
|
isPremade = (grp->GetMembersCount() >= bg->GetMinPlayersPerTeam());
|
||||||
|
|
@ -670,7 +670,7 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
|
||||||
// no group found, error
|
// no group found, error
|
||||||
if (!grp)
|
if (!grp)
|
||||||
return;
|
return;
|
||||||
if(grp->GetLeaderGUID() != _player->GetGUID())
|
if (grp->GetLeaderGuid() != _player->GetObjectGuid())
|
||||||
return;
|
return;
|
||||||
// may be Group::CanJoinBattleGroundQueue should be moved to player class...
|
// may be Group::CanJoinBattleGroundQueue should be moved to player class...
|
||||||
err = grp->CanJoinBattleGroundQueue(bg, bgQueueTypeId, arenatype, arenatype, (bool)isRated, arenaslot);
|
err = grp->CanJoinBattleGroundQueue(bg, bgQueueTypeId, arenatype, arenatype, (bool)isRated, arenaslot);
|
||||||
|
|
|
||||||
|
|
@ -254,12 +254,12 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((type == CHAT_MSG_PARTY_LEADER) && !group->IsLeader(_player->GetGUID()))
|
if ((type == CHAT_MSG_PARTY_LEADER) && !group->IsLeader(_player->GetObjectGuid()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
ChatHandler::FillMessageData(&data, this, type, lang, NULL, 0, msg.c_str(), NULL);
|
ChatHandler::FillMessageData(&data, this, type, lang, NULL, 0, msg.c_str(), NULL);
|
||||||
group->BroadcastPacket(&data, false, group->GetMemberGroup(GetPlayer()->GetGUID()));
|
group->BroadcastPacket(&data, false, group->GetMemberGroup(GetPlayer()->GetObjectGuid()));
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case CHAT_MSG_GUILD:
|
case CHAT_MSG_GUILD:
|
||||||
|
|
@ -355,10 +355,10 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
||||||
|
|
||||||
// if player is in battleground, he cannot say to battleground members by /ra
|
// if player is in battleground, he cannot say to battleground members by /ra
|
||||||
Group *group = GetPlayer()->GetOriginalGroup();
|
Group *group = GetPlayer()->GetOriginalGroup();
|
||||||
if(!group)
|
if (!group)
|
||||||
{
|
{
|
||||||
group = GetPlayer()->GetGroup();
|
group = GetPlayer()->GetGroup();
|
||||||
if(!group || group->isBGGroup() || !group->isRaidGroup() || !group->IsLeader(_player->GetGUID()))
|
if (!group || group->isBGGroup() || !group->isRaidGroup() || !group->IsLeader(_player->GetObjectGuid()))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -379,7 +379,8 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
Group *group = GetPlayer()->GetGroup();
|
Group *group = GetPlayer()->GetGroup();
|
||||||
if(!group || !group->isRaidGroup() || !(group->IsLeader(GetPlayer()->GetGUID()) || group->IsAssistant(GetPlayer()->GetGUID())))
|
if (!group || !group->isRaidGroup() ||
|
||||||
|
!(group->IsLeader(GetPlayer()->GetObjectGuid()) || group->IsAssistant(GetPlayer()->GetObjectGuid())))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
|
|
@ -422,7 +423,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
||||||
|
|
||||||
// battleground raid is always in Player->GetGroup(), never in GetOriginalGroup()
|
// battleground raid is always in Player->GetGroup(), never in GetOriginalGroup()
|
||||||
Group *group = GetPlayer()->GetGroup();
|
Group *group = GetPlayer()->GetGroup();
|
||||||
if(!group || !group->isBGGroup() || !group->IsLeader(GetPlayer()->GetGUID()))
|
if (!group || !group->isBGGroup() || !group->IsLeader(GetPlayer()->GetObjectGuid()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
|
|
|
||||||
|
|
@ -74,13 +74,11 @@ RollVoteMask Roll::GetVoteMaskFor(Player* player) const
|
||||||
//============== Group ==============================
|
//============== Group ==============================
|
||||||
//===================================================
|
//===================================================
|
||||||
|
|
||||||
Group::Group() : m_Id(0), m_leaderGuid(0), m_mainTank(0), m_mainAssistant(0), m_groupType(GROUPTYPE_NORMAL),
|
Group::Group() : m_Id(0), m_groupType(GROUPTYPE_NORMAL),
|
||||||
m_dungeonDifficulty(REGULAR_DIFFICULTY), m_raidDifficulty(REGULAR_DIFFICULTY),
|
m_dungeonDifficulty(REGULAR_DIFFICULTY), m_raidDifficulty(REGULAR_DIFFICULTY),
|
||||||
m_bgGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_looterGuid(0), m_lootThreshold(ITEM_QUALITY_UNCOMMON),
|
m_bgGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON),
|
||||||
m_subGroupsCounts(NULL)
|
m_subGroupsCounts(NULL)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < TARGET_ICON_COUNT; ++i)
|
|
||||||
m_targetIcons[i] = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Group::~Group()
|
Group::~Group()
|
||||||
|
|
@ -116,7 +114,7 @@ Group::~Group()
|
||||||
delete[] m_subGroupsCounts;
|
delete[] m_subGroupsCounts;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Group::Create(const uint64 &guid, const char * name)
|
bool Group::Create(ObjectGuid guid, const char * name)
|
||||||
{
|
{
|
||||||
m_leaderGuid = guid;
|
m_leaderGuid = guid;
|
||||||
m_leaderName = name;
|
m_leaderName = name;
|
||||||
|
|
@ -132,7 +130,7 @@ bool Group::Create(const uint64 &guid, const char * name)
|
||||||
|
|
||||||
m_dungeonDifficulty = DUNGEON_DIFFICULTY_NORMAL;
|
m_dungeonDifficulty = DUNGEON_DIFFICULTY_NORMAL;
|
||||||
m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL;
|
m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL;
|
||||||
if(!isBGGroup())
|
if (!isBGGroup())
|
||||||
{
|
{
|
||||||
m_Id = sObjectMgr.GenerateGroupId();
|
m_Id = sObjectMgr.GenerateGroupId();
|
||||||
|
|
||||||
|
|
@ -151,14 +149,19 @@ bool Group::Create(const uint64 &guid, const char * name)
|
||||||
CharacterDatabase.PExecute("DELETE FROM group_member WHERE groupId ='%u'", m_Id);
|
CharacterDatabase.PExecute("DELETE FROM group_member WHERE groupId ='%u'", m_Id);
|
||||||
CharacterDatabase.PExecute("INSERT INTO groups (groupId,leaderGuid,mainTank,mainAssistant,lootMethod,looterGuid,lootThreshold,icon1,icon2,icon3,icon4,icon5,icon6,icon7,icon8,groupType,difficulty,raiddifficulty) "
|
CharacterDatabase.PExecute("INSERT INTO groups (groupId,leaderGuid,mainTank,mainAssistant,lootMethod,looterGuid,lootThreshold,icon1,icon2,icon3,icon4,icon5,icon6,icon7,icon8,groupType,difficulty,raiddifficulty) "
|
||||||
"VALUES ('%u','%u','%u','%u','%u','%u','%u','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','%u','%u','%u')",
|
"VALUES ('%u','%u','%u','%u','%u','%u','%u','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','%u','%u','%u')",
|
||||||
m_Id, GUID_LOPART(m_leaderGuid), GUID_LOPART(m_mainTank), GUID_LOPART(m_mainAssistant), uint32(m_lootMethod),
|
m_Id, m_leaderGuid.GetCounter(), m_mainTankGuid.GetCounter(), m_mainAssistantGuid.GetCounter(), uint32(m_lootMethod),
|
||||||
GUID_LOPART(m_looterGuid), uint32(m_lootThreshold), m_targetIcons[0], m_targetIcons[1], m_targetIcons[2], m_targetIcons[3], m_targetIcons[4], m_targetIcons[5], m_targetIcons[6], m_targetIcons[7], uint8(m_groupType), uint32(m_dungeonDifficulty), uint32(m_raidDifficulty));
|
m_looterGuid.GetCounter(), uint32(m_lootThreshold),
|
||||||
|
m_targetIcons[0].GetRawValue(), m_targetIcons[1].GetRawValue(),
|
||||||
|
m_targetIcons[2].GetRawValue(), m_targetIcons[3].GetRawValue(),
|
||||||
|
m_targetIcons[4].GetRawValue(), m_targetIcons[5].GetRawValue(),
|
||||||
|
m_targetIcons[6].GetRawValue(), m_targetIcons[7].GetRawValue(),
|
||||||
|
uint8(m_groupType), uint32(m_dungeonDifficulty), uint32(m_raidDifficulty));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!AddMember(guid, name))
|
if (!AddMember(guid, name))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(!isBGGroup())
|
if (!isBGGroup())
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -170,10 +173,10 @@ bool Group::LoadGroupFromDB(Field* fields)
|
||||||
// result = CharacterDatabase.Query("SELECT mainTank, mainAssistant, lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, groupType, difficulty, raiddifficulty, leaderGuid, groupId FROM groups");
|
// result = CharacterDatabase.Query("SELECT mainTank, mainAssistant, lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, groupType, difficulty, raiddifficulty, leaderGuid, groupId FROM groups");
|
||||||
|
|
||||||
m_Id = fields[17].GetUInt32();
|
m_Id = fields[17].GetUInt32();
|
||||||
m_leaderGuid = MAKE_NEW_GUID(fields[16].GetUInt32(),0,HIGHGUID_PLAYER);
|
m_leaderGuid = ObjectGuid(HIGHGUID_PLAYER, fields[16].GetUInt32());
|
||||||
|
|
||||||
// group leader not exist
|
// group leader not exist
|
||||||
if(!sObjectMgr.GetPlayerNameByGUID(m_leaderGuid, m_leaderName))
|
if (!sObjectMgr.GetPlayerNameByGUID(m_leaderGuid, m_leaderName))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_groupType = GroupType(fields[13].GetUInt8());
|
m_groupType = GroupType(fields[13].GetUInt8());
|
||||||
|
|
@ -191,14 +194,14 @@ bool Group::LoadGroupFromDB(Field* fields)
|
||||||
r_diff = RAID_DIFFICULTY_10MAN_NORMAL;
|
r_diff = RAID_DIFFICULTY_10MAN_NORMAL;
|
||||||
m_raidDifficulty = Difficulty(r_diff);
|
m_raidDifficulty = Difficulty(r_diff);
|
||||||
|
|
||||||
m_mainTank = fields[0].GetUInt64();
|
m_mainTankGuid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
|
||||||
m_mainAssistant = fields[1].GetUInt64();
|
m_mainAssistantGuid = ObjectGuid(HIGHGUID_PLAYER, fields[1].GetUInt32());
|
||||||
m_lootMethod = (LootMethod)fields[2].GetUInt8();
|
m_lootMethod = LootMethod(fields[2].GetUInt8());
|
||||||
m_looterGuid = MAKE_NEW_GUID(fields[3].GetUInt32(), 0, HIGHGUID_PLAYER);
|
m_looterGuid = ObjectGuid(HIGHGUID_PLAYER, fields[3].GetUInt32());
|
||||||
m_lootThreshold = (ItemQualities)fields[4].GetUInt16();
|
m_lootThreshold = ItemQualities(fields[4].GetUInt16());
|
||||||
|
|
||||||
for(int i = 0; i < TARGET_ICON_COUNT; ++i)
|
for(int i = 0; i < TARGET_ICON_COUNT; ++i)
|
||||||
m_targetIcons[i] = fields[5+i].GetUInt64();
|
m_targetIcons[i] = ObjectGuid(fields[5+i].GetUInt64());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -206,10 +209,10 @@ bool Group::LoadGroupFromDB(Field* fields)
|
||||||
bool Group::LoadMemberFromDB(uint32 guidLow, uint8 subgroup, bool assistant)
|
bool Group::LoadMemberFromDB(uint32 guidLow, uint8 subgroup, bool assistant)
|
||||||
{
|
{
|
||||||
MemberSlot member;
|
MemberSlot member;
|
||||||
member.guid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER);
|
member.guid = ObjectGuid(HIGHGUID_PLAYER, guidLow);
|
||||||
|
|
||||||
// skip nonexistent member
|
// skip nonexistent member
|
||||||
if(!sObjectMgr.GetPlayerNameByGUID(member.guid, member.name))
|
if (!sObjectMgr.GetPlayerNameByGUID(member.guid, member.name))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
member.group = subgroup;
|
member.group = subgroup;
|
||||||
|
|
@ -261,7 +264,7 @@ bool Group::AddLeaderInvite(Player *player)
|
||||||
if(!AddInvite(player))
|
if(!AddInvite(player))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_leaderGuid = player->GetGUID();
|
m_leaderGuid = player->GetObjectGuid();
|
||||||
m_leaderName = player->GetName();
|
m_leaderName = player->GetName();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -282,13 +285,12 @@ void Group::RemoveAllInvites()
|
||||||
m_invitees.clear();
|
m_invitees.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
Player* Group::GetInvited(const uint64& guid) const
|
Player* Group::GetInvited(ObjectGuid guid) const
|
||||||
{
|
{
|
||||||
for(InvitesList::const_iterator itr = m_invitees.begin(); itr != m_invitees.end(); ++itr)
|
for(InvitesList::const_iterator itr = m_invitees.begin(); itr != m_invitees.end(); ++itr)
|
||||||
{
|
if ((*itr)->GetObjectGuid() == guid)
|
||||||
if((*itr)->GetGUID() == guid)
|
|
||||||
return (*itr);
|
return (*itr);
|
||||||
}
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -302,17 +304,16 @@ Player* Group::GetInvited(const std::string& name) const
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Group::AddMember(const uint64 &guid, const char* name)
|
bool Group::AddMember(ObjectGuid guid, const char* name)
|
||||||
{
|
{
|
||||||
if(!_addMember(guid, name))
|
if (!_addMember(guid, name))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
SendUpdate();
|
SendUpdate();
|
||||||
|
|
||||||
Player *player = sObjectMgr.GetPlayer(guid);
|
if (Player *player = sObjectMgr.GetPlayer(guid))
|
||||||
if(player)
|
|
||||||
{
|
{
|
||||||
if(!IsLeader(player->GetGUID()) && !isBGGroup())
|
if (!IsLeader(player->GetObjectGuid()) && !isBGGroup())
|
||||||
{
|
{
|
||||||
// reset the new member's instances, unless he is currently in one of them
|
// reset the new member's instances, unless he is currently in one of them
|
||||||
// including raid/heroic instances that they are not permanently bound to!
|
// including raid/heroic instances that they are not permanently bound to!
|
||||||
|
|
@ -344,29 +345,29 @@ bool Group::AddMember(const uint64 &guid, const char* name)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 Group::RemoveMember(const uint64 &guid, const uint8 &method)
|
uint32 Group::RemoveMember(ObjectGuid guid, uint8 method)
|
||||||
{
|
{
|
||||||
// remove member and change leader (if need) only if strong more 2 members _before_ member remove
|
// remove member and change leader (if need) only if strong more 2 members _before_ member remove
|
||||||
if(GetMembersCount() > uint32(isBGGroup() ? 1 : 2)) // in BG group case allow 1 members group
|
if (GetMembersCount() > uint32(isBGGroup() ? 1 : 2)) // in BG group case allow 1 members group
|
||||||
{
|
{
|
||||||
bool leaderChanged = _removeMember(guid);
|
bool leaderChanged = _removeMember(guid);
|
||||||
|
|
||||||
if(Player *player = sObjectMgr.GetPlayer( guid ))
|
if (Player *player = sObjectMgr.GetPlayer( guid ))
|
||||||
{
|
{
|
||||||
// quest related GO state dependent from raid membership
|
// quest related GO state dependent from raid membership
|
||||||
if(isRaidGroup())
|
if (isRaidGroup())
|
||||||
player->UpdateForQuestWorldObjects();
|
player->UpdateForQuestWorldObjects();
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
|
|
||||||
if(method == 1)
|
if (method == 1)
|
||||||
{
|
{
|
||||||
data.Initialize( SMSG_GROUP_UNINVITE, 0 );
|
data.Initialize( SMSG_GROUP_UNINVITE, 0 );
|
||||||
player->GetSession()->SendPacket( &data );
|
player->GetSession()->SendPacket( &data );
|
||||||
}
|
}
|
||||||
|
|
||||||
//we already removed player from group and in player->GetGroup() is his original group!
|
//we already removed player from group and in player->GetGroup() is his original group!
|
||||||
if( Group* group = player->GetGroup() )
|
if (Group* group = player->GetGroup())
|
||||||
{
|
{
|
||||||
group->SendUpdate();
|
group->SendUpdate();
|
||||||
}
|
}
|
||||||
|
|
@ -381,7 +382,7 @@ uint32 Group::RemoveMember(const uint64 &guid, const uint8 &method)
|
||||||
_homebindIfInstance(player);
|
_homebindIfInstance(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(leaderChanged)
|
if (leaderChanged)
|
||||||
{
|
{
|
||||||
WorldPacket data(SMSG_GROUP_SET_LEADER, (m_memberSlots.front().name.size()+1));
|
WorldPacket data(SMSG_GROUP_SET_LEADER, (m_memberSlots.front().name.size()+1));
|
||||||
data << m_memberSlots.front().name;
|
data << m_memberSlots.front().name;
|
||||||
|
|
@ -397,11 +398,10 @@ uint32 Group::RemoveMember(const uint64 &guid, const uint8 &method)
|
||||||
return m_memberSlots.size();
|
return m_memberSlots.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Group::ChangeLeader(const uint64 &guid)
|
void Group::ChangeLeader(ObjectGuid guid)
|
||||||
{
|
{
|
||||||
member_citerator slot = _getMemberCSlot(guid);
|
member_citerator slot = _getMemberCSlot(guid);
|
||||||
|
if (slot == m_memberSlots.end())
|
||||||
if(slot == m_memberSlots.end())
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_setLeader(guid);
|
_setLeader(guid);
|
||||||
|
|
@ -479,7 +479,7 @@ void Group::Disband(bool hideDestroy)
|
||||||
ResetInstances(INSTANCE_RESET_GROUP_DISBAND, true, NULL);
|
ResetInstances(INSTANCE_RESET_GROUP_DISBAND, true, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_leaderGuid = 0;
|
m_leaderGuid.Clear();
|
||||||
m_leaderName = "";
|
m_leaderName = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -692,7 +692,7 @@ bool Group::CountRollVote(ObjectGuid const& playerGUID, Rolls::iterator& rollI,
|
||||||
{
|
{
|
||||||
Roll* roll = *rollI;
|
Roll* roll = *rollI;
|
||||||
|
|
||||||
Roll::PlayerVote::iterator itr = roll->playerVote.find(playerGUID.GetRawValue());
|
Roll::PlayerVote::iterator itr = roll->playerVote.find(playerGUID);
|
||||||
// this condition means that player joins to the party after roll begins
|
// this condition means that player joins to the party after roll begins
|
||||||
if (itr == roll->playerVote.end())
|
if (itr == roll->playerVote.end())
|
||||||
return true; // result used for need iterator ++, so avoid for end of list
|
return true; // result used for need iterator ++, so avoid for end of list
|
||||||
|
|
@ -766,7 +766,7 @@ void Group::StartLootRool(Creature* lootTarget, LootMethod method, Loot* loot, u
|
||||||
{
|
{
|
||||||
if (playerToRoll->IsWithinDist(lootTarget, sWorld.getConfig(CONFIG_FLOAT_GROUP_XP_DISTANCE), false))
|
if (playerToRoll->IsWithinDist(lootTarget, sWorld.getConfig(CONFIG_FLOAT_GROUP_XP_DISTANCE), false))
|
||||||
{
|
{
|
||||||
r->playerVote[playerToRoll->GetGUID()] = ROLL_NOT_EMITED_YET;
|
r->playerVote[playerToRoll->GetObjectGuid()] = ROLL_NOT_EMITED_YET;
|
||||||
++r->totalPlayersRolling;
|
++r->totalPlayersRolling;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -824,7 +824,7 @@ void Group::CountTheRoll(Rolls::iterator& rollI)
|
||||||
ObjectGuid maxguid = (*roll->playerVote.begin()).first;
|
ObjectGuid maxguid = (*roll->playerVote.begin()).first;
|
||||||
Player *player;
|
Player *player;
|
||||||
|
|
||||||
for( Roll::PlayerVote::const_iterator itr = roll->playerVote.begin(); itr != roll->playerVote.end(); ++itr)
|
for(Roll::PlayerVote::const_iterator itr = roll->playerVote.begin(); itr != roll->playerVote.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (itr->second != ROLL_NEED)
|
if (itr->second != ROLL_NEED)
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -867,7 +867,7 @@ void Group::CountTheRoll(Rolls::iterator& rollI)
|
||||||
if(!roll->playerVote.empty())
|
if(!roll->playerVote.empty())
|
||||||
{
|
{
|
||||||
uint8 maxresul = 0;
|
uint8 maxresul = 0;
|
||||||
uint64 maxguid = (*roll->playerVote.begin()).first;
|
ObjectGuid maxguid = (*roll->playerVote.begin()).first;
|
||||||
Player *player;
|
Player *player;
|
||||||
RollVote rollvote = ROLL_PASS; //Fixed: Using uninitialized memory 'rollvote'
|
RollVote rollvote = ROLL_PASS; //Fixed: Using uninitialized memory 'rollvote'
|
||||||
|
|
||||||
|
|
@ -934,24 +934,24 @@ void Group::CountTheRoll(Rolls::iterator& rollI)
|
||||||
delete roll;
|
delete roll;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Group::SetTargetIcon(uint8 id, uint64 whoGuid, uint64 targetGuid)
|
void Group::SetTargetIcon(uint8 id, ObjectGuid whoGuid, ObjectGuid targetGuid)
|
||||||
{
|
{
|
||||||
if(id >= TARGET_ICON_COUNT)
|
if (id >= TARGET_ICON_COUNT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// clean other icons
|
// clean other icons
|
||||||
if( targetGuid != 0 )
|
if (!targetGuid.IsEmpty())
|
||||||
for(int i = 0; i < TARGET_ICON_COUNT; ++i)
|
for(int i = 0; i < TARGET_ICON_COUNT; ++i)
|
||||||
if( m_targetIcons[i] == targetGuid )
|
if (m_targetIcons[i] == targetGuid)
|
||||||
SetTargetIcon(i, 0, 0);
|
SetTargetIcon(i, ObjectGuid(), ObjectGuid());
|
||||||
|
|
||||||
m_targetIcons[id] = targetGuid;
|
m_targetIcons[id] = targetGuid;
|
||||||
|
|
||||||
WorldPacket data(MSG_RAID_TARGET_UPDATE, (1+8+1+8));
|
WorldPacket data(MSG_RAID_TARGET_UPDATE, (1+8+1+8));
|
||||||
data << uint8(0); // set targets
|
data << uint8(0); // set targets
|
||||||
data << uint64(whoGuid);
|
data << whoGuid;
|
||||||
data << uint8(id);
|
data << uint8(id);
|
||||||
data << uint64(targetGuid);
|
data << targetGuid;
|
||||||
BroadcastPacket(&data, true);
|
BroadcastPacket(&data, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1006,11 +1006,11 @@ void Group::SendTargetIconList(WorldSession *session)
|
||||||
|
|
||||||
for(int i = 0; i < TARGET_ICON_COUNT; ++i)
|
for(int i = 0; i < TARGET_ICON_COUNT; ++i)
|
||||||
{
|
{
|
||||||
if(m_targetIcons[i] == 0)
|
if (m_targetIcons[i].IsEmpty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
data << uint8(i);
|
data << uint8(i);
|
||||||
data << uint64(m_targetIcons[i]);
|
data << m_targetIcons[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
session->SendPacket(&data);
|
session->SendPacket(&data);
|
||||||
|
|
@ -1048,18 +1048,18 @@ void Group::SendUpdate()
|
||||||
onlineState = onlineState | ((isBGGroup()) ? MEMBER_STATUS_PVP : 0);
|
onlineState = onlineState | ((isBGGroup()) ? MEMBER_STATUS_PVP : 0);
|
||||||
|
|
||||||
data << citr2->name;
|
data << citr2->name;
|
||||||
data << uint64(citr2->guid);
|
data << citr2->guid;
|
||||||
data << uint8(onlineState); // online-state
|
data << uint8(onlineState); // online-state
|
||||||
data << uint8(citr2->group); // groupid
|
data << uint8(citr2->group); // groupid
|
||||||
data << uint8(GetFlags(*citr2)); // group flags
|
data << uint8(GetFlags(*citr2)); // group flags
|
||||||
data << uint8(0); // 3.3, role?
|
data << uint8(0); // 3.3, role?
|
||||||
}
|
}
|
||||||
|
|
||||||
data << uint64(m_leaderGuid); // leader guid
|
data << m_leaderGuid; // leader guid
|
||||||
if(GetMembersCount()-1)
|
if(GetMembersCount()-1)
|
||||||
{
|
{
|
||||||
data << uint8(m_lootMethod); // loot method
|
data << uint8(m_lootMethod); // loot method
|
||||||
data << uint64(m_looterGuid); // looter guid
|
data << m_looterGuid; // looter guid
|
||||||
data << uint8(m_lootThreshold); // loot threshold
|
data << uint8(m_lootThreshold); // loot threshold
|
||||||
data << uint8(m_dungeonDifficulty); // Dungeon Difficulty
|
data << uint8(m_dungeonDifficulty); // Dungeon Difficulty
|
||||||
data << uint8(m_raidDifficulty); // Raid Difficulty
|
data << uint8(m_raidDifficulty); // Raid Difficulty
|
||||||
|
|
@ -1086,12 +1086,12 @@ void Group::UpdatePlayerOutOfRange(Player* pPlayer)
|
||||||
player->GetSession()->SendPacket(&data);
|
player->GetSession()->SendPacket(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
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())
|
for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
|
||||||
{
|
{
|
||||||
Player *pl = itr->getSource();
|
Player *pl = itr->getSource();
|
||||||
if(!pl || (ignore != 0 && pl->GetGUID() == ignore) || (ignorePlayersInBGRaid && pl->GetGroup() != this) )
|
if (!pl || (!ignore.IsEmpty() && pl->GetObjectGuid() == ignore) || (ignorePlayersInBGRaid && pl->GetGroup() != this) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (pl->GetSession() && (group == -1 || itr->getSubGroup() == group))
|
if (pl->GetSession() && (group == -1 || itr->getSubGroup() == group))
|
||||||
|
|
@ -1104,8 +1104,8 @@ void Group::BroadcastReadyCheck(WorldPacket *packet)
|
||||||
for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
|
for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
|
||||||
{
|
{
|
||||||
Player *pl = itr->getSource();
|
Player *pl = itr->getSource();
|
||||||
if(pl && pl->GetSession())
|
if (pl && pl->GetSession())
|
||||||
if(IsLeader(pl->GetGUID()) || IsAssistant(pl->GetGUID()))
|
if (IsLeader(pl->GetObjectGuid()) || IsAssistant(pl->GetObjectGuid()))
|
||||||
pl->GetSession()->SendPacket(packet);
|
pl->GetSession()->SendPacket(packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1118,14 +1118,14 @@ void Group::OfflineReadyCheck()
|
||||||
if (!pl || !pl->GetSession())
|
if (!pl || !pl->GetSession())
|
||||||
{
|
{
|
||||||
WorldPacket data(MSG_RAID_READY_CHECK_CONFIRM, 9);
|
WorldPacket data(MSG_RAID_READY_CHECK_CONFIRM, 9);
|
||||||
data << uint64(citr->guid);
|
data << citr->guid;
|
||||||
data << uint8(0);
|
data << uint8(0);
|
||||||
BroadcastReadyCheck(&data);
|
BroadcastReadyCheck(&data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Group::_addMember(const uint64 &guid, const char* name, bool isAssistant)
|
bool Group::_addMember(ObjectGuid guid, const char* name, bool isAssistant)
|
||||||
{
|
{
|
||||||
// get first not-full group
|
// get first not-full group
|
||||||
uint8 groupid = 0;
|
uint8 groupid = 0;
|
||||||
|
|
@ -1148,12 +1148,12 @@ bool Group::_addMember(const uint64 &guid, const char* name, bool isAssistant)
|
||||||
return _addMember(guid, name, isAssistant, groupid);
|
return _addMember(guid, name, isAssistant, groupid);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Group::_addMember(const uint64 &guid, const char* name, bool isAssistant, uint8 group)
|
bool Group::_addMember(ObjectGuid guid, const char* name, bool isAssistant, uint8 group)
|
||||||
{
|
{
|
||||||
if(IsFull())
|
if(IsFull())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(!guid)
|
if (guid.IsEmpty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Player *player = sObjectMgr.GetPlayer(guid);
|
Player *player = sObjectMgr.GetPlayer(guid);
|
||||||
|
|
@ -1188,30 +1188,31 @@ bool Group::_addMember(const uint64 &guid, const char* name, bool isAssistant, u
|
||||||
if(!isRaidGroup()) // reset targetIcons for non-raid-groups
|
if(!isRaidGroup()) // reset targetIcons for non-raid-groups
|
||||||
{
|
{
|
||||||
for(int i = 0; i < TARGET_ICON_COUNT; ++i)
|
for(int i = 0; i < TARGET_ICON_COUNT; ++i)
|
||||||
m_targetIcons[i] = 0;
|
m_targetIcons[i].Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isBGGroup())
|
if(!isBGGroup())
|
||||||
{
|
{
|
||||||
// insert into group table
|
// insert into group table
|
||||||
CharacterDatabase.PExecute("INSERT INTO group_member(groupId,memberGuid,assistant,subgroup) VALUES('%u','%u','%u','%u')", m_Id, GUID_LOPART(member.guid), ((member.assistant==1)?1:0), member.group);
|
CharacterDatabase.PExecute("INSERT INTO group_member(groupId,memberGuid,assistant,subgroup) VALUES('%u','%u','%u','%u')",
|
||||||
|
m_Id, member.guid.GetCounter(), ((member.assistant==1)?1:0), member.group);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Group::_removeMember(const uint64 &guid)
|
bool Group::_removeMember(ObjectGuid guid)
|
||||||
{
|
{
|
||||||
Player *player = sObjectMgr.GetPlayer(guid);
|
Player *player = sObjectMgr.GetPlayer(guid);
|
||||||
if (player)
|
if (player)
|
||||||
{
|
{
|
||||||
//if we are removing player from battleground raid
|
//if we are removing player from battleground raid
|
||||||
if( isBGGroup() )
|
if (isBGGroup())
|
||||||
player->RemoveFromBattleGroundRaid();
|
player->RemoveFromBattleGroundRaid();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//we can remove player who is in battleground from his original group
|
//we can remove player who is in battleground from his original group
|
||||||
if( player->GetOriginalGroup() == this )
|
if (player->GetOriginalGroup() == this)
|
||||||
player->SetOriginalGroup(NULL);
|
player->SetOriginalGroup(NULL);
|
||||||
else
|
else
|
||||||
player->SetGroup(NULL);
|
player->SetGroup(NULL);
|
||||||
|
|
@ -1228,12 +1229,12 @@ bool Group::_removeMember(const uint64 &guid)
|
||||||
m_memberSlots.erase(slot);
|
m_memberSlots.erase(slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isBGGroup())
|
if (!isBGGroup())
|
||||||
CharacterDatabase.PExecute("DELETE FROM group_member WHERE memberGuid='%u'", GUID_LOPART(guid));
|
CharacterDatabase.PExecute("DELETE FROM group_member WHERE memberGuid='%u'", guid.GetCounter());
|
||||||
|
|
||||||
if(m_leaderGuid == guid) // leader was removed
|
if (m_leaderGuid == guid) // leader was removed
|
||||||
{
|
{
|
||||||
if(GetMembersCount() > 0)
|
if (GetMembersCount() > 0)
|
||||||
_setLeader(m_memberSlots.front().guid);
|
_setLeader(m_memberSlots.front().guid);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1241,14 +1242,18 @@ bool Group::_removeMember(const uint64 &guid)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Group::_setLeader(const uint64 &guid)
|
void Group::_setLeader(ObjectGuid guid)
|
||||||
{
|
{
|
||||||
member_citerator slot = _getMemberCSlot(guid);
|
member_citerator slot = _getMemberCSlot(guid);
|
||||||
if(slot == m_memberSlots.end())
|
if (slot == m_memberSlots.end())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!isBGGroup())
|
if (!isBGGroup())
|
||||||
{
|
{
|
||||||
|
uint32 slot_lowguid = slot->guid.GetCounter();
|
||||||
|
|
||||||
|
uint32 leader_lowguid = m_leaderGuid.GetCounter();
|
||||||
|
|
||||||
// TODO: set a time limit to have this function run rarely cause it can be slow
|
// TODO: set a time limit to have this function run rarely cause it can be slow
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
|
|
||||||
|
|
@ -1260,11 +1265,11 @@ void Group::_setLeader(const uint64 &guid)
|
||||||
CharacterDatabase.PExecute(
|
CharacterDatabase.PExecute(
|
||||||
"DELETE FROM group_instance WHERE leaderguid='%u' AND (permanent = 1 OR "
|
"DELETE FROM group_instance WHERE leaderguid='%u' AND (permanent = 1 OR "
|
||||||
"instance IN (SELECT instance FROM character_instance WHERE guid = '%u')"
|
"instance IN (SELECT instance FROM character_instance WHERE guid = '%u')"
|
||||||
")", GUID_LOPART(m_leaderGuid), GUID_LOPART(slot->guid)
|
")", leader_lowguid, slot_lowguid);
|
||||||
);
|
|
||||||
|
|
||||||
Player *player = sObjectMgr.GetPlayer(slot->guid);
|
Player *player = sObjectMgr.GetPlayer(slot->guid);
|
||||||
if(player)
|
|
||||||
|
if (player)
|
||||||
{
|
{
|
||||||
for(uint8 i = 0; i < MAX_DIFFICULTY; ++i)
|
for(uint8 i = 0; i < MAX_DIFFICULTY; ++i)
|
||||||
{
|
{
|
||||||
|
|
@ -1282,7 +1287,8 @@ void Group::_setLeader(const uint64 &guid)
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the group's solo binds to the new leader
|
// update the group's solo binds to the new leader
|
||||||
CharacterDatabase.PExecute("UPDATE group_instance SET leaderGuid='%u' WHERE leaderGuid = '%u'", GUID_LOPART(slot->guid), GUID_LOPART(m_leaderGuid));
|
CharacterDatabase.PExecute("UPDATE group_instance SET leaderGuid='%u' WHERE leaderGuid = '%u'",
|
||||||
|
slot_lowguid, leader_lowguid);
|
||||||
|
|
||||||
// copy the permanent binds from the new leader to the group
|
// copy the permanent binds from the new leader to the group
|
||||||
// overwriting the solo binds with permanent ones if necessary
|
// overwriting the solo binds with permanent ones if necessary
|
||||||
|
|
@ -1290,7 +1296,7 @@ void Group::_setLeader(const uint64 &guid)
|
||||||
Player::ConvertInstancesToGroup(player, this, slot->guid);
|
Player::ConvertInstancesToGroup(player, this, slot->guid);
|
||||||
|
|
||||||
// update the group leader
|
// update the group leader
|
||||||
CharacterDatabase.PExecute("UPDATE groups SET leaderGuid='%u' WHERE groupId='%u'", GUID_LOPART(slot->guid), m_Id);
|
CharacterDatabase.PExecute("UPDATE groups SET leaderGuid='%u' WHERE groupId='%u'", slot_lowguid, m_Id);
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1298,7 +1304,7 @@ void Group::_setLeader(const uint64 &guid)
|
||||||
m_leaderName = slot->name;
|
m_leaderName = slot->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Group::_removeRolls(const uint64 &guid)
|
void Group::_removeRolls(ObjectGuid guid)
|
||||||
{
|
{
|
||||||
for (Rolls::iterator it = RollId.begin(); it != RollId.end(); )
|
for (Rolls::iterator it = RollId.begin(); it != RollId.end(); )
|
||||||
{
|
{
|
||||||
|
|
@ -1326,76 +1332,77 @@ void Group::_removeRolls(const uint64 &guid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Group::_setMembersGroup(const uint64 &guid, uint8 group)
|
bool Group::_setMembersGroup(ObjectGuid guid, uint8 group)
|
||||||
{
|
{
|
||||||
member_witerator slot = _getMemberWSlot(guid);
|
member_witerator slot = _getMemberWSlot(guid);
|
||||||
if(slot == m_memberSlots.end())
|
if (slot == m_memberSlots.end())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
slot->group = group;
|
slot->group = group;
|
||||||
|
|
||||||
SubGroupCounterIncrease(group);
|
SubGroupCounterIncrease(group);
|
||||||
|
|
||||||
if(!isBGGroup())
|
if (!isBGGroup())
|
||||||
CharacterDatabase.PExecute("UPDATE group_member SET subgroup='%u' WHERE memberGuid='%u'", group, GUID_LOPART(guid));
|
CharacterDatabase.PExecute("UPDATE group_member SET subgroup='%u' WHERE memberGuid='%u'", group, guid.GetCounter());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Group::_setAssistantFlag(const uint64 &guid, const bool &state)
|
bool Group::_setAssistantFlag(ObjectGuid guid, const bool &state)
|
||||||
{
|
{
|
||||||
member_witerator slot = _getMemberWSlot(guid);
|
member_witerator slot = _getMemberWSlot(guid);
|
||||||
if(slot == m_memberSlots.end())
|
if (slot == m_memberSlots.end())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
slot->assistant = state;
|
slot->assistant = state;
|
||||||
if(!isBGGroup())
|
if (!isBGGroup())
|
||||||
CharacterDatabase.PExecute("UPDATE group_member SET assistant='%u' WHERE memberGuid='%u'", (state==true)?1:0, GUID_LOPART(guid));
|
CharacterDatabase.PExecute("UPDATE group_member SET assistant='%u' WHERE memberGuid='%u'", (state==true)?1:0, guid.GetCounter());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Group::_setMainTank(const uint64 &guid)
|
bool Group::_setMainTank(ObjectGuid guid)
|
||||||
{
|
{
|
||||||
if (m_mainTank == guid)
|
if (m_mainTankGuid == guid)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (guid)
|
if (!guid.IsEmpty())
|
||||||
{
|
{
|
||||||
member_citerator slot = _getMemberCSlot(guid);
|
member_citerator slot = _getMemberCSlot(guid);
|
||||||
if(slot == m_memberSlots.end())
|
if (slot == m_memberSlots.end())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(m_mainAssistant == guid)
|
if (m_mainAssistantGuid == guid)
|
||||||
_setMainAssistant(0);
|
_setMainAssistant(ObjectGuid());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_mainTank = guid;
|
m_mainTankGuid = guid;
|
||||||
|
|
||||||
if(!isBGGroup())
|
if (!isBGGroup())
|
||||||
CharacterDatabase.PExecute("UPDATE groups SET mainTank='%u' WHERE groupId='%u'", GUID_LOPART(m_mainTank), m_Id);
|
CharacterDatabase.PExecute("UPDATE groups SET mainTank='%u' WHERE groupId='%u'", m_mainTankGuid.GetCounter(), m_Id);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Group::_setMainAssistant(const uint64 &guid)
|
bool Group::_setMainAssistant(ObjectGuid guid)
|
||||||
{
|
{
|
||||||
if (m_mainAssistant == guid)
|
if (m_mainAssistantGuid == guid)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (guid)
|
if (!guid.IsEmpty())
|
||||||
{
|
{
|
||||||
member_witerator slot = _getMemberWSlot(guid);
|
member_witerator slot = _getMemberWSlot(guid);
|
||||||
if(slot == m_memberSlots.end())
|
if (slot == m_memberSlots.end())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(m_mainTank == guid)
|
if (m_mainTankGuid == guid)
|
||||||
_setMainTank(0);
|
_setMainTank(ObjectGuid());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_mainAssistant = guid;
|
m_mainAssistantGuid = guid;
|
||||||
|
|
||||||
if(!isBGGroup())
|
if (!isBGGroup())
|
||||||
CharacterDatabase.PExecute("UPDATE groups SET mainAssistant='%u' WHERE groupId='%u'", GUID_LOPART(m_mainAssistant), m_Id);
|
CharacterDatabase.PExecute("UPDATE groups SET mainAssistant='%u' WHERE groupId='%u'",
|
||||||
|
m_mainAssistantGuid.GetCounter(), m_Id);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1411,7 +1418,7 @@ bool Group::SameSubGroup(Player const* member1, Player const* member2) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// allows setting subgroup for offline members
|
// allows setting subgroup for offline members
|
||||||
void Group::ChangeMembersGroup(const uint64 &guid, uint8 group)
|
void Group::ChangeMembersGroup(ObjectGuid guid, uint8 group)
|
||||||
{
|
{
|
||||||
if (!isRaidGroup())
|
if (!isRaidGroup())
|
||||||
return;
|
return;
|
||||||
|
|
@ -1424,7 +1431,7 @@ void Group::ChangeMembersGroup(const uint64 &guid, uint8 group)
|
||||||
if (prevSubGroup == group)
|
if (prevSubGroup == group)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(_setMembersGroup(guid, group))
|
if (_setMembersGroup(guid, group))
|
||||||
{
|
{
|
||||||
SubGroupCounterDecrease(prevSubGroup);
|
SubGroupCounterDecrease(prevSubGroup);
|
||||||
SendUpdate();
|
SendUpdate();
|
||||||
|
|
@ -1445,7 +1452,7 @@ void Group::ChangeMembersGroup(Player *player, uint8 group)
|
||||||
if (prevSubGroup == group)
|
if (prevSubGroup == group)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_setMembersGroup(player->GetGUID(), group))
|
if (_setMembersGroup(player->GetObjectGuid(), group))
|
||||||
{
|
{
|
||||||
if (player->GetGroup() == this)
|
if (player->GetGroup() == this)
|
||||||
player->GetGroupRef().setSubGroup(group);
|
player->GetGroupRef().setSubGroup(group);
|
||||||
|
|
@ -1493,35 +1500,35 @@ void Group::UpdateLooterGuid( Creature* creature, bool ifneed )
|
||||||
}
|
}
|
||||||
|
|
||||||
member_citerator guid_itr = _getMemberCSlot(GetLooterGuid());
|
member_citerator guid_itr = _getMemberCSlot(GetLooterGuid());
|
||||||
if(guid_itr != m_memberSlots.end())
|
if (guid_itr != m_memberSlots.end())
|
||||||
{
|
{
|
||||||
if(ifneed)
|
if (ifneed)
|
||||||
{
|
{
|
||||||
// not update if only update if need and ok
|
// not update if only update if need and ok
|
||||||
Player* looter = ObjectAccessor::FindPlayer(guid_itr->guid);
|
Player* looter = ObjectAccessor::FindPlayer(guid_itr->guid);
|
||||||
if(looter && looter->IsWithinDist(creature, sWorld.getConfig(CONFIG_FLOAT_GROUP_XP_DISTANCE), false))
|
if (looter && looter->IsWithinDist(creature, sWorld.getConfig(CONFIG_FLOAT_GROUP_XP_DISTANCE), false))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
++guid_itr;
|
++guid_itr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// search next after current
|
// search next after current
|
||||||
if(guid_itr != m_memberSlots.end())
|
if (guid_itr != m_memberSlots.end())
|
||||||
{
|
{
|
||||||
for(member_citerator itr = guid_itr; itr != m_memberSlots.end(); ++itr)
|
for(member_citerator itr = guid_itr; itr != m_memberSlots.end(); ++itr)
|
||||||
{
|
{
|
||||||
if(Player* pl = ObjectAccessor::FindPlayer(itr->guid))
|
if (Player* pl = ObjectAccessor::FindPlayer(itr->guid))
|
||||||
{
|
{
|
||||||
if (pl->IsWithinDist(creature, sWorld.getConfig(CONFIG_FLOAT_GROUP_XP_DISTANCE), false))
|
if (pl->IsWithinDist(creature, sWorld.getConfig(CONFIG_FLOAT_GROUP_XP_DISTANCE), false))
|
||||||
{
|
{
|
||||||
bool refresh = pl->GetLootGUID() == creature->GetGUID();
|
bool refresh = pl->GetLootGUID() == creature->GetGUID();
|
||||||
|
|
||||||
//if(refresh) // update loot for new looter
|
//if(refresh) // update loot for new looter
|
||||||
// pl->GetSession()->DoLootRelease(pl->GetLootGUID());
|
// pl->GetSession()->DoLootRelease(pl->GetLootGUID());
|
||||||
SetLooterGuid(pl->GetGUID());
|
SetLooterGuid(pl->GetObjectGuid());
|
||||||
SendUpdate();
|
SendUpdate();
|
||||||
if(refresh) // update loot for new looter
|
if (refresh) // update loot for new looter
|
||||||
pl->SendLoot(creature->GetGUID(), LOOT_CORPSE);
|
pl->SendLoot(creature->GetObjectGuid(), LOOT_CORPSE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1531,7 +1538,7 @@ void Group::UpdateLooterGuid( Creature* creature, bool ifneed )
|
||||||
// search from start
|
// search from start
|
||||||
for(member_citerator itr = m_memberSlots.begin(); itr != guid_itr; ++itr)
|
for(member_citerator itr = m_memberSlots.begin(); itr != guid_itr; ++itr)
|
||||||
{
|
{
|
||||||
if(Player* pl = ObjectAccessor::FindPlayer(itr->guid))
|
if (Player* pl = ObjectAccessor::FindPlayer(itr->guid))
|
||||||
{
|
{
|
||||||
if (pl->IsWithinDist(creature, sWorld.getConfig(CONFIG_FLOAT_GROUP_XP_DISTANCE), false))
|
if (pl->IsWithinDist(creature, sWorld.getConfig(CONFIG_FLOAT_GROUP_XP_DISTANCE), false))
|
||||||
{
|
{
|
||||||
|
|
@ -1539,16 +1546,16 @@ void Group::UpdateLooterGuid( Creature* creature, bool ifneed )
|
||||||
|
|
||||||
//if(refresh) // update loot for new looter
|
//if(refresh) // update loot for new looter
|
||||||
// pl->GetSession()->DoLootRelease(pl->GetLootGUID());
|
// pl->GetSession()->DoLootRelease(pl->GetLootGUID());
|
||||||
SetLooterGuid(pl->GetGUID());
|
SetLooterGuid(pl->GetObjectGuid());
|
||||||
SendUpdate();
|
SendUpdate();
|
||||||
if(refresh) // update loot for new looter
|
if (refresh) // update loot for new looter
|
||||||
pl->SendLoot(creature->GetGUID(), LOOT_CORPSE);
|
pl->SendLoot(creature->GetObjectGuid(), LOOT_CORPSE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SetLooterGuid(0);
|
SetLooterGuid(ObjectGuid());
|
||||||
SendUpdate();
|
SendUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1753,18 +1760,20 @@ InstanceGroupBind* Group::GetBoundInstance(Map* aMap, Difficulty difficulty)
|
||||||
|
|
||||||
InstanceGroupBind* Group::BindToInstance(InstanceSave *save, bool permanent, bool load)
|
InstanceGroupBind* Group::BindToInstance(InstanceSave *save, bool permanent, bool load)
|
||||||
{
|
{
|
||||||
if(save && !isBGGroup())
|
if (save && !isBGGroup())
|
||||||
{
|
{
|
||||||
InstanceGroupBind& bind = m_boundInstances[save->GetDifficulty()][save->GetMapId()];
|
InstanceGroupBind& bind = m_boundInstances[save->GetDifficulty()][save->GetMapId()];
|
||||||
if(bind.save)
|
if (bind.save)
|
||||||
{
|
{
|
||||||
// when a boss is killed or when copying the players's binds to the group
|
// when a boss is killed or when copying the players's binds to the group
|
||||||
if(permanent != bind.perm || save != bind.save)
|
if (permanent != bind.perm || save != bind.save)
|
||||||
if(!load)
|
if (!load)
|
||||||
CharacterDatabase.PExecute("UPDATE group_instance SET instance = '%u', permanent = '%u' WHERE leaderGuid = '%u' AND instance = '%u'", save->GetInstanceId(), permanent, GUID_LOPART(GetLeaderGUID()), bind.save->GetInstanceId());
|
CharacterDatabase.PExecute("UPDATE group_instance SET instance = '%u', permanent = '%u' WHERE leaderGuid = '%u' AND instance = '%u'",
|
||||||
|
save->GetInstanceId(), permanent, GetLeaderGuid().GetCounter(), bind.save->GetInstanceId());
|
||||||
}
|
}
|
||||||
else if(!load)
|
else if (!load)
|
||||||
CharacterDatabase.PExecute("INSERT INTO group_instance (leaderGuid, instance, permanent) VALUES ('%u', '%u', '%u')", GUID_LOPART(GetLeaderGUID()), save->GetInstanceId(), permanent);
|
CharacterDatabase.PExecute("INSERT INTO group_instance (leaderGuid, instance, permanent) VALUES ('%u', '%u', '%u')",
|
||||||
|
GetLeaderGuid().GetCounter(), save->GetInstanceId(), permanent);
|
||||||
|
|
||||||
if(bind.save != save)
|
if(bind.save != save)
|
||||||
{
|
{
|
||||||
|
|
@ -1775,8 +1784,9 @@ InstanceGroupBind* Group::BindToInstance(InstanceSave *save, bool permanent, boo
|
||||||
|
|
||||||
bind.save = save;
|
bind.save = save;
|
||||||
bind.perm = permanent;
|
bind.perm = permanent;
|
||||||
if(!load)
|
if (!load)
|
||||||
DEBUG_LOG("Group::BindToInstance: %d is now bound to map %d, instance %d, difficulty %d", GUID_LOPART(GetLeaderGUID()), save->GetMapId(), save->GetInstanceId(), save->GetDifficulty());
|
DEBUG_LOG("Group::BindToInstance: Group (Id: %d) is now bound to map %d, instance %d, difficulty %d",
|
||||||
|
GetId(), save->GetMapId(), save->GetInstanceId(), save->GetDifficulty());
|
||||||
return &bind;
|
return &bind;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -1786,10 +1796,11 @@ InstanceGroupBind* Group::BindToInstance(InstanceSave *save, bool permanent, boo
|
||||||
void Group::UnbindInstance(uint32 mapid, uint8 difficulty, bool unload)
|
void Group::UnbindInstance(uint32 mapid, uint8 difficulty, bool unload)
|
||||||
{
|
{
|
||||||
BoundInstancesMap::iterator itr = m_boundInstances[difficulty].find(mapid);
|
BoundInstancesMap::iterator itr = m_boundInstances[difficulty].find(mapid);
|
||||||
if(itr != m_boundInstances[difficulty].end())
|
if (itr != m_boundInstances[difficulty].end())
|
||||||
{
|
{
|
||||||
if(!unload)
|
if (!unload)
|
||||||
CharacterDatabase.PExecute("DELETE FROM group_instance WHERE leaderGuid = '%u' AND instance = '%u'", GUID_LOPART(GetLeaderGUID()), itr->second.save->GetInstanceId());
|
CharacterDatabase.PExecute("DELETE FROM group_instance WHERE leaderGuid = '%u' AND instance = '%u'",
|
||||||
|
GetLeaderGuid().GetCounter(), itr->second.save->GetInstanceId());
|
||||||
itr->second.save->RemoveGroup(this); // save can become invalid
|
itr->second.save->RemoveGroup(this); // save can become invalid
|
||||||
m_boundInstances[difficulty].erase(itr);
|
m_boundInstances[difficulty].erase(itr);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
136
src/game/Group.h
136
src/game/Group.h
|
|
@ -154,7 +154,7 @@ class Roll : public LootValidatorRef
|
||||||
int32 itemRandomPropId;
|
int32 itemRandomPropId;
|
||||||
uint32 itemRandomSuffix;
|
uint32 itemRandomSuffix;
|
||||||
uint8 itemCount;
|
uint8 itemCount;
|
||||||
typedef std::map<uint64, RollVote> PlayerVote;
|
typedef UNORDERED_MAP<ObjectGuid, RollVote> PlayerVote;
|
||||||
PlayerVote playerVote; //vote position correspond with player position (in group)
|
PlayerVote playerVote; //vote position correspond with player position (in group)
|
||||||
uint8 totalPlayersRolling;
|
uint8 totalPlayersRolling;
|
||||||
uint8 totalNeed;
|
uint8 totalNeed;
|
||||||
|
|
@ -183,7 +183,7 @@ class MANGOS_DLL_SPEC Group
|
||||||
public:
|
public:
|
||||||
struct MemberSlot
|
struct MemberSlot
|
||||||
{
|
{
|
||||||
uint64 guid;
|
ObjectGuid guid;
|
||||||
std::string name;
|
std::string name;
|
||||||
uint8 group;
|
uint8 group;
|
||||||
bool assistant;
|
bool assistant;
|
||||||
|
|
@ -203,19 +203,18 @@ class MANGOS_DLL_SPEC Group
|
||||||
~Group();
|
~Group();
|
||||||
|
|
||||||
// group manipulation methods
|
// group manipulation methods
|
||||||
bool Create(const uint64 &guid, const char * name);
|
bool Create(ObjectGuid guid, const char * name);
|
||||||
bool LoadGroupFromDB(Field *fields);
|
bool LoadGroupFromDB(Field *fields);
|
||||||
bool LoadMemberFromDB(uint32 guidLow, uint8 subgroup, bool assistant);
|
bool LoadMemberFromDB(uint32 guidLow, uint8 subgroup, bool assistant);
|
||||||
bool AddInvite(Player *player);
|
bool AddInvite(Player *player);
|
||||||
uint32 RemoveInvite(Player *player);
|
uint32 RemoveInvite(Player *player);
|
||||||
void RemoveAllInvites();
|
void RemoveAllInvites();
|
||||||
bool AddLeaderInvite(Player *player);
|
bool AddLeaderInvite(Player *player);
|
||||||
bool AddMember(const uint64 &guid, const char* name);
|
bool AddMember(ObjectGuid guid, const char* name);
|
||||||
// method: 0=just remove, 1=kick
|
uint32 RemoveMember(ObjectGuid guid, uint8 method); // method: 0=just remove, 1=kick
|
||||||
uint32 RemoveMember(const uint64 &guid, const uint8 &method);
|
void ChangeLeader(ObjectGuid guid);
|
||||||
void ChangeLeader(const uint64 &guid);
|
|
||||||
void SetLootMethod(LootMethod method) { m_lootMethod = method; }
|
void SetLootMethod(LootMethod method) { m_lootMethod = method; }
|
||||||
void SetLooterGuid(const uint64 &guid) { m_looterGuid = guid; }
|
void SetLooterGuid(ObjectGuid guid) { m_looterGuid = guid; }
|
||||||
void UpdateLooterGuid( Creature* creature, bool ifneed = false );
|
void UpdateLooterGuid( Creature* creature, bool ifneed = false );
|
||||||
void SetLootThreshold(ItemQualities threshold) { m_lootThreshold = threshold; }
|
void SetLootThreshold(ItemQualities threshold) { m_lootThreshold = threshold; }
|
||||||
void Disband(bool hideDestroy=false);
|
void Disband(bool hideDestroy=false);
|
||||||
|
|
@ -226,55 +225,34 @@ class MANGOS_DLL_SPEC Group
|
||||||
bool isRaidGroup() const { return m_groupType & GROUPTYPE_RAID; }
|
bool isRaidGroup() const { return m_groupType & GROUPTYPE_RAID; }
|
||||||
bool isBGGroup() const { return m_bgGroup != NULL; }
|
bool isBGGroup() const { return m_bgGroup != NULL; }
|
||||||
bool IsCreated() const { return GetMembersCount() > 0; }
|
bool IsCreated() const { return GetMembersCount() > 0; }
|
||||||
const uint64& GetLeaderGUID() const { return m_leaderGuid; }
|
ObjectGuid GetLeaderGuid() const { return m_leaderGuid; }
|
||||||
const char * GetLeaderName() const { return m_leaderName.c_str(); }
|
const char * GetLeaderName() const { return m_leaderName.c_str(); }
|
||||||
LootMethod GetLootMethod() const { return m_lootMethod; }
|
LootMethod GetLootMethod() const { return m_lootMethod; }
|
||||||
const uint64& GetLooterGuid() const { return m_looterGuid; }
|
ObjectGuid GetLooterGuid() const { return m_looterGuid; }
|
||||||
ItemQualities GetLootThreshold() const { return m_lootThreshold; }
|
ItemQualities GetLootThreshold() const { return m_lootThreshold; }
|
||||||
|
|
||||||
// member manipulation methods
|
// member manipulation methods
|
||||||
bool IsMember(const uint64& guid) const { return _getMemberCSlot(guid) != m_memberSlots.end(); }
|
bool IsMember(ObjectGuid guid) const { return _getMemberCSlot(guid) != m_memberSlots.end(); }
|
||||||
bool IsLeader(const uint64& guid) const { return (GetLeaderGUID() == guid); }
|
bool IsLeader(ObjectGuid guid) const { return GetLeaderGuid() == guid; }
|
||||||
uint64 GetMemberGUID(const std::string& name)
|
ObjectGuid GetMemberGUID(const std::string& name)
|
||||||
{
|
{
|
||||||
for(member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
|
for(member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
|
||||||
{
|
if (itr->name == name)
|
||||||
if(itr->name == name)
|
|
||||||
{
|
|
||||||
return itr->guid;
|
return itr->guid;
|
||||||
}
|
|
||||||
}
|
return ObjectGuid();
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
bool IsAssistant(uint64 guid) const
|
bool IsAssistant(ObjectGuid guid) const
|
||||||
{
|
{
|
||||||
member_citerator mslot = _getMemberCSlot(guid);
|
member_citerator mslot = _getMemberCSlot(guid);
|
||||||
if(mslot==m_memberSlots.end())
|
if (mslot==m_memberSlots.end())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return mslot->assistant;
|
return mslot->assistant;
|
||||||
}
|
}
|
||||||
Player* GetInvited(const uint64& guid) const;
|
Player* GetInvited(ObjectGuid guid) const;
|
||||||
Player* GetInvited(const std::string& name) const;
|
Player* GetInvited(const std::string& name) const;
|
||||||
|
|
||||||
bool SameSubGroup(uint64 guid1,const uint64& guid2) const
|
|
||||||
{
|
|
||||||
member_citerator mslot2 = _getMemberCSlot(guid2);
|
|
||||||
if(mslot2==m_memberSlots.end())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return SameSubGroup(guid1,&*mslot2);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SameSubGroup(uint64 guid1, MemberSlot const* slot2) const
|
|
||||||
{
|
|
||||||
member_citerator mslot1 = _getMemberCSlot(guid1);
|
|
||||||
if(mslot1==m_memberSlots.end() || !slot2)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return (mslot1->group==slot2->group);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool HasFreeSlotSubGroup(uint8 subgroup) const
|
bool HasFreeSlotSubGroup(uint8 subgroup) const
|
||||||
{
|
{
|
||||||
return (m_subGroupsCounts && m_subGroupsCounts[subgroup] < MAX_GROUP_SIZE);
|
return (m_subGroupsCounts && m_subGroupsCounts[subgroup] < MAX_GROUP_SIZE);
|
||||||
|
|
@ -286,10 +264,10 @@ class MANGOS_DLL_SPEC Group
|
||||||
GroupReference* GetFirstMember() { return m_memberMgr.getFirst(); }
|
GroupReference* GetFirstMember() { return m_memberMgr.getFirst(); }
|
||||||
uint32 GetMembersCount() const { return m_memberSlots.size(); }
|
uint32 GetMembersCount() const { return m_memberSlots.size(); }
|
||||||
void GetDataForXPAtKill(Unit const* victim, uint32& count,uint32& sum_level, Player* & member_with_max_level, Player* & not_gray_member_with_max_level, Player* additional = NULL);
|
void GetDataForXPAtKill(Unit const* victim, uint32& count,uint32& sum_level, Player* & member_with_max_level, Player* & not_gray_member_with_max_level, Player* additional = NULL);
|
||||||
uint8 GetMemberGroup(uint64 guid) const
|
uint8 GetMemberGroup(ObjectGuid guid) const
|
||||||
{
|
{
|
||||||
member_citerator mslot = _getMemberCSlot(guid);
|
member_citerator mslot = _getMemberCSlot(guid);
|
||||||
if(mslot==m_memberSlots.end())
|
if (mslot == m_memberSlots.end())
|
||||||
return MAX_RAID_SUBGROUPS + 1;
|
return MAX_RAID_SUBGROUPS + 1;
|
||||||
|
|
||||||
return mslot->group;
|
return mslot->group;
|
||||||
|
|
@ -301,37 +279,37 @@ class MANGOS_DLL_SPEC Group
|
||||||
void SetBattlegroundGroup(BattleGround *bg) { m_bgGroup = bg; }
|
void SetBattlegroundGroup(BattleGround *bg) { m_bgGroup = bg; }
|
||||||
GroupJoinBattlegroundResult CanJoinBattleGroundQueue(BattleGround const* bgOrTemplate, BattleGroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot);
|
GroupJoinBattlegroundResult CanJoinBattleGroundQueue(BattleGround const* bgOrTemplate, BattleGroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot);
|
||||||
|
|
||||||
void ChangeMembersGroup(const uint64 &guid, uint8 group);
|
void ChangeMembersGroup(ObjectGuid guid, uint8 group);
|
||||||
void ChangeMembersGroup(Player *player, uint8 group);
|
void ChangeMembersGroup(Player *player, uint8 group);
|
||||||
|
|
||||||
uint64 const& GetMainTank() const { return m_mainTank; }
|
ObjectGuid GetMainTankGuid() const { return m_mainTankGuid; }
|
||||||
uint64 const& GetMainAssistant() const { return m_mainAssistant; }
|
ObjectGuid GetMainAssistantGuid() const { return m_mainAssistantGuid; }
|
||||||
|
|
||||||
void SetAssistant(uint64 guid, bool state)
|
void SetAssistant(ObjectGuid guid, bool state)
|
||||||
{
|
{
|
||||||
if(!isRaidGroup())
|
if (!isRaidGroup())
|
||||||
return;
|
return;
|
||||||
if(_setAssistantFlag(guid, state))
|
if (_setAssistantFlag(guid, state))
|
||||||
SendUpdate();
|
SendUpdate();
|
||||||
}
|
}
|
||||||
void SetMainTank(uint64 guid)
|
void SetMainTank(ObjectGuid guid)
|
||||||
{
|
{
|
||||||
if(!isRaidGroup())
|
if (!isRaidGroup())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(_setMainTank(guid))
|
if (_setMainTank(guid))
|
||||||
SendUpdate();
|
SendUpdate();
|
||||||
}
|
}
|
||||||
void SetMainAssistant(uint64 guid)
|
void SetMainAssistant(ObjectGuid guid)
|
||||||
{
|
{
|
||||||
if(!isRaidGroup())
|
if (!isRaidGroup())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(_setMainAssistant(guid))
|
if (_setMainAssistant(guid))
|
||||||
SendUpdate();
|
SendUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetTargetIcon(uint8 id, uint64 whoGuid, uint64 targetGuid);
|
void SetTargetIcon(uint8 id, ObjectGuid whoGuid, ObjectGuid targetGuid);
|
||||||
|
|
||||||
Difficulty GetDifficulty(bool isRaid) const { return isRaid ? m_raidDifficulty : m_dungeonDifficulty; }
|
Difficulty GetDifficulty(bool isRaid) const { return isRaid ? m_raidDifficulty : m_dungeonDifficulty; }
|
||||||
Difficulty GetDungeonDifficulty() const { return m_dungeonDifficulty; }
|
Difficulty GetDungeonDifficulty() const { return m_dungeonDifficulty; }
|
||||||
|
|
@ -346,7 +324,7 @@ class MANGOS_DLL_SPEC Group
|
||||||
void SendUpdate();
|
void SendUpdate();
|
||||||
void UpdatePlayerOutOfRange(Player* pPlayer);
|
void UpdatePlayerOutOfRange(Player* pPlayer);
|
||||||
// ignore: GUID of player that will be ignored
|
// 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());
|
||||||
void BroadcastReadyCheck(WorldPacket *packet);
|
void BroadcastReadyCheck(WorldPacket *packet);
|
||||||
void OfflineReadyCheck();
|
void OfflineReadyCheck();
|
||||||
|
|
||||||
|
|
@ -377,17 +355,17 @@ class MANGOS_DLL_SPEC Group
|
||||||
BoundInstancesMap& GetBoundInstances(Difficulty difficulty) { return m_boundInstances[difficulty]; }
|
BoundInstancesMap& GetBoundInstances(Difficulty difficulty) { return m_boundInstances[difficulty]; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool _addMember(const uint64 &guid, const char* name, bool isAssistant=false);
|
bool _addMember(ObjectGuid guid, const char* name, bool isAssistant=false);
|
||||||
bool _addMember(const uint64 &guid, const char* name, bool isAssistant, uint8 group);
|
bool _addMember(ObjectGuid guid, const char* name, bool isAssistant, uint8 group);
|
||||||
bool _removeMember(const uint64 &guid); // returns true if leader has changed
|
bool _removeMember(ObjectGuid guid); // returns true if leader has changed
|
||||||
void _setLeader(const uint64 &guid);
|
void _setLeader(ObjectGuid guid);
|
||||||
|
|
||||||
void _removeRolls(const uint64 &guid);
|
void _removeRolls(ObjectGuid guid);
|
||||||
|
|
||||||
bool _setMembersGroup(const uint64 &guid, uint8 group);
|
bool _setMembersGroup(ObjectGuid guid, uint8 group);
|
||||||
bool _setAssistantFlag(const uint64 &guid, const bool &state);
|
bool _setAssistantFlag(ObjectGuid guid, const bool &state);
|
||||||
bool _setMainTank(const uint64 &guid);
|
bool _setMainTank(ObjectGuid guid);
|
||||||
bool _setMainAssistant(const uint64 &guid);
|
bool _setMainAssistant(ObjectGuid guid);
|
||||||
|
|
||||||
void _homebindIfInstance(Player *player);
|
void _homebindIfInstance(Player *player);
|
||||||
|
|
||||||
|
|
@ -403,23 +381,21 @@ class MANGOS_DLL_SPEC Group
|
||||||
++m_subGroupsCounts[itr->group];
|
++m_subGroupsCounts[itr->group];
|
||||||
}
|
}
|
||||||
|
|
||||||
member_citerator _getMemberCSlot(uint64 Guid) const
|
member_citerator _getMemberCSlot(ObjectGuid guid) const
|
||||||
{
|
{
|
||||||
for(member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
|
for(member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
|
||||||
{
|
if (itr->guid == guid)
|
||||||
if (itr->guid == Guid)
|
|
||||||
return itr;
|
return itr;
|
||||||
}
|
|
||||||
return m_memberSlots.end();
|
return m_memberSlots.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
member_witerator _getMemberWSlot(uint64 Guid)
|
member_witerator _getMemberWSlot(ObjectGuid guid)
|
||||||
{
|
{
|
||||||
for(member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
|
for(member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
|
||||||
{
|
if (itr->guid == guid)
|
||||||
if (itr->guid == Guid)
|
|
||||||
return itr;
|
return itr;
|
||||||
}
|
|
||||||
return m_memberSlots.end();
|
return m_memberSlots.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -445,9 +421,9 @@ class MANGOS_DLL_SPEC Group
|
||||||
uint8 flags = 0;
|
uint8 flags = 0;
|
||||||
if (slot.assistant)
|
if (slot.assistant)
|
||||||
flags |= GROUP_ASSISTANT;
|
flags |= GROUP_ASSISTANT;
|
||||||
if (slot.guid == m_mainAssistant)
|
if (slot.guid == m_mainAssistantGuid)
|
||||||
flags |= GROUP_MAIN_ASSISTANT;
|
flags |= GROUP_MAIN_ASSISTANT;
|
||||||
if (slot.guid == m_mainTank)
|
if (slot.guid == m_mainTankGuid)
|
||||||
flags |= GROUP_MAIN_TANK;
|
flags |= GROUP_MAIN_TANK;
|
||||||
return GroupFlagMask(flags);
|
return GroupFlagMask(flags);
|
||||||
}
|
}
|
||||||
|
|
@ -456,18 +432,18 @@ class MANGOS_DLL_SPEC Group
|
||||||
MemberSlotList m_memberSlots;
|
MemberSlotList m_memberSlots;
|
||||||
GroupRefManager m_memberMgr;
|
GroupRefManager m_memberMgr;
|
||||||
InvitesList m_invitees;
|
InvitesList m_invitees;
|
||||||
uint64 m_leaderGuid;
|
ObjectGuid m_leaderGuid;
|
||||||
std::string m_leaderName;
|
std::string m_leaderName;
|
||||||
uint64 m_mainTank;
|
ObjectGuid m_mainTankGuid;
|
||||||
uint64 m_mainAssistant;
|
ObjectGuid m_mainAssistantGuid;
|
||||||
GroupType m_groupType;
|
GroupType m_groupType;
|
||||||
Difficulty m_dungeonDifficulty;
|
Difficulty m_dungeonDifficulty;
|
||||||
Difficulty m_raidDifficulty;
|
Difficulty m_raidDifficulty;
|
||||||
BattleGround* m_bgGroup;
|
BattleGround* m_bgGroup;
|
||||||
uint64 m_targetIcons[TARGET_ICON_COUNT];
|
ObjectGuid m_targetIcons[TARGET_ICON_COUNT];
|
||||||
LootMethod m_lootMethod;
|
LootMethod m_lootMethod;
|
||||||
ItemQualities m_lootThreshold;
|
ItemQualities m_lootThreshold;
|
||||||
uint64 m_looterGuid;
|
ObjectGuid m_looterGuid;
|
||||||
Rolls RollId;
|
Rolls RollId;
|
||||||
BoundInstancesMap m_boundInstances[MAX_DIFFICULTY];
|
BoundInstancesMap m_boundInstances[MAX_DIFFICULTY];
|
||||||
uint8* m_subGroupsCounts;
|
uint8* m_subGroupsCounts;
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data )
|
||||||
if(group)
|
if(group)
|
||||||
{
|
{
|
||||||
// not have permissions for invite
|
// not have permissions for invite
|
||||||
if(!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
|
if (!group->IsLeader(GetPlayer()->GetObjectGuid()) && !group->IsAssistant(GetPlayer()->GetObjectGuid()))
|
||||||
{
|
{
|
||||||
SendPartyResult(PARTY_OP_INVITE, "", ERR_NOT_LEADER);
|
SendPartyResult(PARTY_OP_INVITE, "", ERR_NOT_LEADER);
|
||||||
return;
|
return;
|
||||||
|
|
@ -172,9 +172,10 @@ void WorldSession::HandleGroupAcceptOpcode( WorldPacket & recv_data )
|
||||||
if (!group)
|
if (!group)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(group->GetLeaderGUID() == GetPlayer()->GetGUID())
|
if (group->GetLeaderGuid() == GetPlayer()->GetObjectGuid())
|
||||||
{
|
{
|
||||||
sLog.outError("HandleGroupAcceptOpcode: player %s(%d) tried to accept an invite to his own group", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
|
sLog.outError("HandleGroupAcceptOpcode: %s tried to accept an invite to his own group",
|
||||||
|
GetPlayer()->GetObjectGuid().GetString().c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -191,21 +192,21 @@ void WorldSession::HandleGroupAcceptOpcode( WorldPacket & recv_data )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player* leader = sObjectMgr.GetPlayer(group->GetLeaderGUID());
|
Player* leader = sObjectMgr.GetPlayer(group->GetLeaderGuid());
|
||||||
|
|
||||||
// forming a new group, create it
|
// forming a new group, create it
|
||||||
if(!group->IsCreated())
|
if (!group->IsCreated())
|
||||||
{
|
{
|
||||||
if (leader)
|
if (leader)
|
||||||
group->RemoveInvite(leader);
|
group->RemoveInvite(leader);
|
||||||
if (group->Create(group->GetLeaderGUID(), group->GetLeaderName()))
|
if (group->Create(group->GetLeaderGuid(), group->GetLeaderName()))
|
||||||
sObjectMgr.AddGroup(group);
|
sObjectMgr.AddGroup(group);
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// everything is fine, do it, PLAYER'S GROUP IS SET IN ADDMEMBER!!!
|
// everything is fine, do it, PLAYER'S GROUP IS SET IN ADDMEMBER!!!
|
||||||
if(!group->AddMember(GetPlayer()->GetGUID(), GetPlayer()->GetName()))
|
if(!group->AddMember(GetPlayer()->GetObjectGuid(), GetPlayer()->GetName()))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -216,12 +217,12 @@ void WorldSession::HandleGroupDeclineOpcode( WorldPacket & /*recv_data*/ )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// remember leader if online
|
// remember leader if online
|
||||||
Player *leader = sObjectMgr.GetPlayer(group->GetLeaderGUID());
|
Player *leader = sObjectMgr.GetPlayer(group->GetLeaderGuid());
|
||||||
|
|
||||||
// uninvite, group can be deleted
|
// uninvite, group can be deleted
|
||||||
GetPlayer()->UninviteFromGroup();
|
GetPlayer()->UninviteFromGroup();
|
||||||
|
|
||||||
if(!leader || !leader->GetSession())
|
if (!leader || !leader->GetSession())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// report
|
// report
|
||||||
|
|
@ -232,19 +233,19 @@ void WorldSession::HandleGroupDeclineOpcode( WorldPacket & /*recv_data*/ )
|
||||||
|
|
||||||
void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket & recv_data)
|
void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket & recv_data)
|
||||||
{
|
{
|
||||||
uint64 guid;
|
ObjectGuid guid;
|
||||||
recv_data >> guid;
|
recv_data >> guid;
|
||||||
recv_data.read_skip<std::string>(); // reason
|
recv_data.read_skip<std::string>(); // reason
|
||||||
|
|
||||||
// can't uninvite yourself
|
// can't uninvite yourself
|
||||||
if(guid == GetPlayer()->GetGUID())
|
if (guid == GetPlayer()->GetObjectGuid())
|
||||||
{
|
{
|
||||||
sLog.outError("WorldSession::HandleGroupUninviteGuidOpcode: leader %s(%d) tried to uninvite himself from the group.", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
|
sLog.outError("WorldSession::HandleGroupUninviteGuidOpcode: leader %s tried to uninvite himself from the group.", GetPlayer()->GetName(), GetPlayer()->GetObjectGuid().GetString().c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PartyResult res = GetPlayer()->CanUninviteFromGroup();
|
PartyResult res = GetPlayer()->CanUninviteFromGroup();
|
||||||
if(res != ERR_PARTY_RESULT_OK)
|
if (res != ERR_PARTY_RESULT_OK)
|
||||||
{
|
{
|
||||||
SendPartyResult(PARTY_OP_LEAVE, "", res);
|
SendPartyResult(PARTY_OP_LEAVE, "", res);
|
||||||
return;
|
return;
|
||||||
|
|
@ -254,13 +255,13 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket & recv_data)
|
||||||
if(!grp)
|
if(!grp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(grp->IsMember(guid))
|
if (grp->IsMember(guid))
|
||||||
{
|
{
|
||||||
Player::RemoveFromGroup(grp, guid);
|
Player::RemoveFromGroup(grp, guid);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Player* plr = grp->GetInvited(guid))
|
if (Player* plr = grp->GetInvited(guid))
|
||||||
{
|
{
|
||||||
plr->UninviteFromGroup();
|
plr->UninviteFromGroup();
|
||||||
return;
|
return;
|
||||||
|
|
@ -275,34 +276,35 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket & recv_data)
|
||||||
recv_data >> membername;
|
recv_data >> membername;
|
||||||
|
|
||||||
// player not found
|
// player not found
|
||||||
if(!normalizePlayerName(membername))
|
if (!normalizePlayerName(membername))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// can't uninvite yourself
|
// can't uninvite yourself
|
||||||
if(GetPlayer()->GetName() == membername)
|
if (GetPlayer()->GetName() == membername)
|
||||||
{
|
{
|
||||||
sLog.outError("WorldSession::HandleGroupUninviteOpcode: leader %s(%d) tried to uninvite himself from the group.", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
|
sLog.outError("WorldSession::HandleGroupUninviteOpcode: leader %s tried to uninvite himself from the group.", GetPlayer()->GetName(), GetPlayer()->GetObjectGuid().GetString().c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PartyResult res = GetPlayer()->CanUninviteFromGroup();
|
PartyResult res = GetPlayer()->CanUninviteFromGroup();
|
||||||
if(res != ERR_PARTY_RESULT_OK)
|
if (res != ERR_PARTY_RESULT_OK)
|
||||||
{
|
{
|
||||||
SendPartyResult(PARTY_OP_LEAVE, "", res);
|
SendPartyResult(PARTY_OP_LEAVE, "", res);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Group* grp = GetPlayer()->GetGroup();
|
Group* grp = GetPlayer()->GetGroup();
|
||||||
if(!grp)
|
if (!grp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(uint64 guid = grp->GetMemberGUID(membername))
|
ObjectGuid guid = grp->GetMemberGUID(membername);
|
||||||
|
if (!guid.IsEmpty())
|
||||||
{
|
{
|
||||||
Player::RemoveFromGroup(grp, guid);
|
Player::RemoveFromGroup(grp, guid);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Player* plr = grp->GetInvited(membername))
|
if (Player* plr = grp->GetInvited(membername))
|
||||||
{
|
{
|
||||||
plr->UninviteFromGroup();
|
plr->UninviteFromGroup();
|
||||||
return;
|
return;
|
||||||
|
|
@ -313,17 +315,17 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket & recv_data)
|
||||||
|
|
||||||
void WorldSession::HandleGroupSetLeaderOpcode( WorldPacket & recv_data )
|
void WorldSession::HandleGroupSetLeaderOpcode( WorldPacket & recv_data )
|
||||||
{
|
{
|
||||||
uint64 guid;
|
ObjectGuid guid;
|
||||||
recv_data >> guid;
|
recv_data >> guid;
|
||||||
|
|
||||||
Group *group = GetPlayer()->GetGroup();
|
Group *group = GetPlayer()->GetGroup();
|
||||||
if(!group)
|
if (!group)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player *player = sObjectMgr.GetPlayer(guid);
|
Player *player = sObjectMgr.GetPlayer(guid);
|
||||||
|
|
||||||
/** error handling **/
|
/** error handling **/
|
||||||
if (!player || !group->IsLeader(GetPlayer()->GetGUID()) || player->GetGroup() != group)
|
if (!player || !group->IsLeader(GetPlayer()->GetObjectGuid()) || player->GetGroup() != group)
|
||||||
return;
|
return;
|
||||||
/********************/
|
/********************/
|
||||||
|
|
||||||
|
|
@ -354,16 +356,16 @@ void WorldSession::HandleGroupDisbandOpcode( WorldPacket & /*recv_data*/ )
|
||||||
void WorldSession::HandleLootMethodOpcode( WorldPacket & recv_data )
|
void WorldSession::HandleLootMethodOpcode( WorldPacket & recv_data )
|
||||||
{
|
{
|
||||||
uint32 lootMethod;
|
uint32 lootMethod;
|
||||||
uint64 lootMaster;
|
ObjectGuid lootMaster;
|
||||||
uint32 lootThreshold;
|
uint32 lootThreshold;
|
||||||
recv_data >> lootMethod >> lootMaster >> lootThreshold;
|
recv_data >> lootMethod >> lootMaster >> lootThreshold;
|
||||||
|
|
||||||
Group *group = GetPlayer()->GetGroup();
|
Group *group = GetPlayer()->GetGroup();
|
||||||
if(!group)
|
if (!group)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/** error handling **/
|
/** error handling **/
|
||||||
if(!group->IsLeader(GetPlayer()->GetGUID()))
|
if (!group->IsLeader(GetPlayer()->GetObjectGuid()))
|
||||||
return;
|
return;
|
||||||
/********************/
|
/********************/
|
||||||
|
|
||||||
|
|
@ -427,7 +429,7 @@ void WorldSession::HandleMinimapPingOpcode(WorldPacket& recv_data)
|
||||||
data << uint64(GetPlayer()->GetGUID());
|
data << uint64(GetPlayer()->GetGUID());
|
||||||
data << float(x);
|
data << float(x);
|
||||||
data << float(y);
|
data << float(y);
|
||||||
GetPlayer()->GetGroup()->BroadcastPacket(&data, true, -1, GetPlayer()->GetGUID());
|
GetPlayer()->GetGroup()->BroadcastPacket(&data, true, -1, GetPlayer()->GetObjectGuid());
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleRandomRollOpcode(WorldPacket& recv_data)
|
void WorldSession::HandleRandomRollOpcode(WorldPacket& recv_data)
|
||||||
|
|
@ -476,12 +478,14 @@ void WorldSession::HandleRaidTargetUpdateOpcode( WorldPacket & recv_data )
|
||||||
}
|
}
|
||||||
else // target icon update
|
else // target icon update
|
||||||
{
|
{
|
||||||
if(group->isRaidGroup() && !group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
|
if (group->isRaidGroup() &&
|
||||||
|
!group->IsLeader(GetPlayer()->GetObjectGuid()) &&
|
||||||
|
!group->IsAssistant(GetPlayer()->GetObjectGuid()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint64 guid;
|
ObjectGuid guid;
|
||||||
recv_data >> guid;
|
recv_data >> guid;
|
||||||
group->SetTargetIcon(x, _player->GetGUID(), guid);
|
group->SetTargetIcon(x, _player->GetObjectGuid(), guid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -495,7 +499,7 @@ void WorldSession::HandleGroupRaidConvertOpcode( WorldPacket & /*recv_data*/ )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/** error handling **/
|
/** error handling **/
|
||||||
if(!group->IsLeader(GetPlayer()->GetGUID()) || group->GetMembersCount() < 2)
|
if (!group->IsLeader(GetPlayer()->GetObjectGuid()) || group->GetMembersCount() < 2)
|
||||||
return;
|
return;
|
||||||
/********************/
|
/********************/
|
||||||
|
|
||||||
|
|
@ -521,7 +525,8 @@ void WorldSession::HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/** error handling **/
|
/** error handling **/
|
||||||
if(!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
|
if (!group->IsLeader(GetPlayer()->GetObjectGuid()) &&
|
||||||
|
!group->IsAssistant(GetPlayer()->GetObjectGuid()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!group->HasFreeSlotSubGroup(groupNr))
|
if (!group->HasFreeSlotSubGroup(groupNr))
|
||||||
|
|
@ -531,23 +536,23 @@ void WorldSession::HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data )
|
||||||
// everything is fine, do it
|
// everything is fine, do it
|
||||||
if (Player* player = sObjectMgr.GetPlayer(name.c_str()))
|
if (Player* player = sObjectMgr.GetPlayer(name.c_str()))
|
||||||
group->ChangeMembersGroup(player, groupNr);
|
group->ChangeMembersGroup(player, groupNr);
|
||||||
else
|
else if (uint64 guid = sObjectMgr.GetPlayerGUIDByName(name.c_str()))
|
||||||
group->ChangeMembersGroup(sObjectMgr.GetPlayerGUIDByName(name.c_str()), groupNr);
|
group->ChangeMembersGroup(guid, groupNr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleGroupAssistantLeaderOpcode( WorldPacket & recv_data )
|
void WorldSession::HandleGroupAssistantLeaderOpcode( WorldPacket & recv_data )
|
||||||
{
|
{
|
||||||
uint64 guid;
|
ObjectGuid guid;
|
||||||
uint8 flag;
|
uint8 flag;
|
||||||
recv_data >> guid;
|
recv_data >> guid;
|
||||||
recv_data >> flag;
|
recv_data >> flag;
|
||||||
|
|
||||||
Group *group = GetPlayer()->GetGroup();
|
Group *group = GetPlayer()->GetGroup();
|
||||||
if(!group)
|
if (!group)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/** error handling **/
|
/** error handling **/
|
||||||
if(!group->IsLeader(GetPlayer()->GetGUID()))
|
if (!group->IsLeader(GetPlayer()->GetObjectGuid()))
|
||||||
return;
|
return;
|
||||||
/********************/
|
/********************/
|
||||||
|
|
||||||
|
|
@ -559,18 +564,18 @@ void WorldSession::HandlePartyAssignmentOpcode( WorldPacket & recv_data )
|
||||||
{
|
{
|
||||||
uint8 role;
|
uint8 role;
|
||||||
uint8 apply;
|
uint8 apply;
|
||||||
uint64 guid;
|
ObjectGuid guid;
|
||||||
recv_data >> role >> apply; // role 0 = Main Tank, 1 = Main Assistant
|
recv_data >> role >> apply; // role 0 = Main Tank, 1 = Main Assistant
|
||||||
recv_data >> guid;
|
recv_data >> guid;
|
||||||
|
|
||||||
DEBUG_LOG("MSG_PARTY_ASSIGNMENT");
|
DEBUG_LOG("MSG_PARTY_ASSIGNMENT");
|
||||||
|
|
||||||
Group *group = GetPlayer()->GetGroup();
|
Group *group = GetPlayer()->GetGroup();
|
||||||
if(!group)
|
if (!group)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/** error handling **/
|
/** error handling **/
|
||||||
if(!group->IsLeader(GetPlayer()->GetGUID()))
|
if (!group->IsLeader(GetPlayer()->GetObjectGuid()))
|
||||||
return;
|
return;
|
||||||
/********************/
|
/********************/
|
||||||
|
|
||||||
|
|
@ -586,10 +591,10 @@ void WorldSession::HandlePartyAssignmentOpcode( WorldPacket & recv_data )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (group->GetMainTank() == guid)
|
if (group->GetMainTankGuid() == guid)
|
||||||
group->SetMainTank(0);
|
group->SetMainTank(ObjectGuid());
|
||||||
if (group->GetMainAssistant() == guid)
|
if (group->GetMainAssistantGuid() == guid)
|
||||||
group->SetMainAssistant(0);
|
group->SetMainAssistant(ObjectGuid());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -602,7 +607,8 @@ void WorldSession::HandleRaidReadyCheckOpcode( WorldPacket & recv_data )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/** error handling **/
|
/** error handling **/
|
||||||
if(!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
|
if (!group->IsLeader(GetPlayer()->GetObjectGuid()) &&
|
||||||
|
!group->IsAssistant(GetPlayer()->GetObjectGuid()))
|
||||||
return;
|
return;
|
||||||
/********************/
|
/********************/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
static void AttemptJoin(Player* _player)
|
static void AttemptJoin(Player* _player)
|
||||||
{
|
{
|
||||||
// skip not can autojoin cases and player group case
|
// skip not can autojoin cases and player group case
|
||||||
if(!_player->m_lookingForGroup.canAutoJoin() || _player->GetGroup())
|
if (!_player->m_lookingForGroup.canAutoJoin() || _player->GetGroup())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//TODO: Guard Player Map
|
//TODO: Guard Player Map
|
||||||
|
|
@ -37,26 +37,26 @@ static void AttemptJoin(Player* _player)
|
||||||
Player *plr = iter->second;
|
Player *plr = iter->second;
|
||||||
|
|
||||||
// skip enemies and self
|
// skip enemies and self
|
||||||
if(!plr || plr==_player || plr->GetTeam() != _player->GetTeam())
|
if (!plr || plr==_player || plr->GetTeam() != _player->GetTeam())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//skip players not in world
|
//skip players not in world
|
||||||
if(!plr->IsInWorld())
|
if (!plr->IsInWorld())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// skip not auto add, not group leader cases
|
// skip not auto add, not group leader cases
|
||||||
if (!plr->GetSession()->LookingForGroup_auto_add || (plr->GetGroup() && plr->GetGroup()->GetLeaderGUID()!=plr->GetGUID()))
|
if (!plr->GetSession()->LookingForGroup_auto_add || (plr->GetGroup() && plr->GetGroup()->GetLeaderGuid() != plr->GetObjectGuid()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// skip non auto-join or empty slots, or non compatible slots
|
// skip non auto-join or empty slots, or non compatible slots
|
||||||
if(!plr->m_lookingForGroup.more.canAutoJoin() || !_player->m_lookingForGroup.HaveInSlot(plr->m_lookingForGroup.more))
|
if (!plr->m_lookingForGroup.more.canAutoJoin() || !_player->m_lookingForGroup.HaveInSlot(plr->m_lookingForGroup.more))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// attempt create group, or skip
|
// attempt create group, or skip
|
||||||
if(!plr->GetGroup())
|
if (!plr->GetGroup())
|
||||||
{
|
{
|
||||||
Group* group = new Group;
|
Group* group = new Group;
|
||||||
if(!group->Create(plr->GetGUID(), plr->GetName()))
|
if (!group->Create(plr->GetObjectGuid(), plr->GetName()))
|
||||||
{
|
{
|
||||||
delete group;
|
delete group;
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -66,7 +66,7 @@ static void AttemptJoin(Player* _player)
|
||||||
}
|
}
|
||||||
|
|
||||||
// stop at success join
|
// stop at success join
|
||||||
if(plr->GetGroup()->AddMember(_player->GetGUID(), _player->GetName()))
|
if(plr->GetGroup()->AddMember(_player->GetObjectGuid(), _player->GetName()))
|
||||||
{
|
{
|
||||||
if( sWorld.getConfig(CONFIG_BOOL_RESTRICTED_LFG_CHANNEL) && _player->GetSession()->GetSecurity() == SEC_PLAYER )
|
if( sWorld.getConfig(CONFIG_BOOL_RESTRICTED_LFG_CHANNEL) && _player->GetSession()->GetSecurity() == SEC_PLAYER )
|
||||||
_player->LeaveLFGChannel();
|
_player->LeaveLFGChannel();
|
||||||
|
|
@ -84,7 +84,7 @@ static void AttemptJoin(Player* _player)
|
||||||
static void AttemptAddMore(Player* _player)
|
static void AttemptAddMore(Player* _player)
|
||||||
{
|
{
|
||||||
// skip not group leader case
|
// skip not group leader case
|
||||||
if(_player->GetGroup() && _player->GetGroup()->GetLeaderGUID()!=_player->GetGUID())
|
if (_player->GetGroup() && _player->GetGroup()->GetLeaderGuid() != _player->GetObjectGuid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!_player->m_lookingForGroup.more.canAutoJoin())
|
if(!_player->m_lookingForGroup.more.canAutoJoin())
|
||||||
|
|
@ -97,7 +97,7 @@ static void AttemptAddMore(Player* _player)
|
||||||
Player *plr = iter->second;
|
Player *plr = iter->second;
|
||||||
|
|
||||||
// skip enemies and self
|
// skip enemies and self
|
||||||
if(!plr || plr==_player || plr->GetTeam() != _player->GetTeam())
|
if (!plr || plr==_player || plr->GetTeam() != _player->GetTeam())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(!plr->IsInWorld())
|
if(!plr->IsInWorld())
|
||||||
|
|
@ -114,7 +114,7 @@ static void AttemptAddMore(Player* _player)
|
||||||
if(!_player->GetGroup())
|
if(!_player->GetGroup())
|
||||||
{
|
{
|
||||||
Group* group = new Group;
|
Group* group = new Group;
|
||||||
if(!group->Create(_player->GetGUID(), _player->GetName()))
|
if(!group->Create(_player->GetObjectGuid(), _player->GetName()))
|
||||||
{
|
{
|
||||||
delete group;
|
delete group;
|
||||||
return; // can't create group (??)
|
return; // can't create group (??)
|
||||||
|
|
@ -124,7 +124,7 @@ static void AttemptAddMore(Player* _player)
|
||||||
}
|
}
|
||||||
|
|
||||||
// stop at join fail (full)
|
// stop at join fail (full)
|
||||||
if(!_player->GetGroup()->AddMember(plr->GetGUID(), plr->GetName()) )
|
if(!_player->GetGroup()->AddMember(plr->GetObjectGuid(), plr->GetName()) )
|
||||||
{
|
{
|
||||||
if( sWorld.getConfig(CONFIG_BOOL_RESTRICTED_LFG_CHANNEL) && _player->GetSession()->GetSecurity() == SEC_PLAYER )
|
if( sWorld.getConfig(CONFIG_BOOL_RESTRICTED_LFG_CHANNEL) && _player->GetSession()->GetSecurity() == SEC_PLAYER )
|
||||||
_player->LeaveLFGChannel();
|
_player->LeaveLFGChannel();
|
||||||
|
|
|
||||||
|
|
@ -415,8 +415,8 @@ bool ChatHandler::HandleNamegoCommand(char* args)
|
||||||
|
|
||||||
// we are in instance, and can summon only player in our group with us as lead
|
// we are in instance, and can summon only player in our group with us as lead
|
||||||
if (!m_session->GetPlayer()->GetGroup() || !target->GetGroup() ||
|
if (!m_session->GetPlayer()->GetGroup() || !target->GetGroup() ||
|
||||||
(target->GetGroup()->GetLeaderGUID() != m_session->GetPlayer()->GetGUID()) ||
|
(target->GetGroup()->GetLeaderGuid() != m_session->GetPlayer()->GetObjectGuid()) ||
|
||||||
(m_session->GetPlayer()->GetGroup()->GetLeaderGUID() != m_session->GetPlayer()->GetGUID()))
|
(m_session->GetPlayer()->GetGroup()->GetLeaderGuid() != m_session->GetPlayer()->GetObjectGuid()))
|
||||||
// the last check is a bit excessive, but let it be, just in case
|
// the last check is a bit excessive, but let it be, just in case
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST,nameLink.c_str());
|
PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST,nameLink.c_str());
|
||||||
|
|
@ -1931,8 +1931,8 @@ bool ChatHandler::HandleGroupgoCommand(char* args)
|
||||||
|
|
||||||
// we are in instance, and can summon only player in our group with us as lead
|
// we are in instance, and can summon only player in our group with us as lead
|
||||||
if ( to_instance && (
|
if ( to_instance && (
|
||||||
!m_session->GetPlayer()->GetGroup() || (grp->GetLeaderGUID() != m_session->GetPlayer()->GetGUID()) ||
|
!m_session->GetPlayer()->GetGroup() || (grp->GetLeaderGuid() != m_session->GetPlayer()->GetObjectGuid()) ||
|
||||||
(m_session->GetPlayer()->GetGroup()->GetLeaderGUID() != m_session->GetPlayer()->GetGUID()) ) )
|
(m_session->GetPlayer()->GetGroup()->GetLeaderGuid() != m_session->GetPlayer()->GetObjectGuid()) ) )
|
||||||
// the last check is a bit excessive, but let it be, just in case
|
// the last check is a bit excessive, but let it be, just in case
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_CANNOT_SUMMON_TO_INST);
|
SendSysMessage(LANG_CANNOT_SUMMON_TO_INST);
|
||||||
|
|
|
||||||
|
|
@ -437,7 +437,7 @@ void WorldSession::DoLootRelease(ObjectGuid lguid)
|
||||||
|
|
||||||
// update next looter
|
// update next looter
|
||||||
if(Group* group = pCreature->GetGroupLootRecipient())
|
if(Group* group = pCreature->GetGroupLootRecipient())
|
||||||
if (group->GetLooterGuid() == player->GetGUID())
|
if (group->GetLooterGuid() == player->GetObjectGuid())
|
||||||
group->UpdateLooterGuid(pCreature);
|
group->UpdateLooterGuid(pCreature);
|
||||||
|
|
||||||
if (loot->isLooted())
|
if (loot->isLooted())
|
||||||
|
|
@ -469,19 +469,19 @@ void WorldSession::HandleLootMasterGiveOpcode( WorldPacket & recv_data )
|
||||||
|
|
||||||
recv_data >> lootguid >> slotid >> target_playerguid;
|
recv_data >> lootguid >> slotid >> target_playerguid;
|
||||||
|
|
||||||
if(!_player->GetGroup() || _player->GetGroup()->GetLooterGuid() != _player->GetGUID())
|
if (!_player->GetGroup() || _player->GetGroup()->GetLooterGuid() != _player->GetObjectGuid())
|
||||||
{
|
{
|
||||||
_player->SendLootRelease(GetPlayer()->GetLootGUID());
|
_player->SendLootRelease(GetPlayer()->GetLootGUID());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player *target = ObjectAccessor::FindPlayer(target_playerguid);
|
Player *target = ObjectAccessor::FindPlayer(target_playerguid);
|
||||||
if(!target)
|
if (!target)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DEBUG_LOG("WorldSession::HandleLootMasterGiveOpcode (CMSG_LOOT_MASTER_GIVE, 0x02A3) Target = %s [%s].", target_playerguid.GetString().c_str(), target->GetName());
|
DEBUG_LOG("WorldSession::HandleLootMasterGiveOpcode (CMSG_LOOT_MASTER_GIVE, 0x02A3) Target = %s [%s].", target_playerguid.GetString().c_str(), target->GetName());
|
||||||
|
|
||||||
if(_player->GetLootGUID() != lootguid.GetRawValue())
|
if (_player->GetLootGUID() != lootguid.GetRawValue())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Loot *pLoot = NULL;
|
Loot *pLoot = NULL;
|
||||||
|
|
|
||||||
|
|
@ -1724,15 +1724,16 @@ bool InstanceMap::Add(Player *player)
|
||||||
InstanceGroupBind *groupBind = pGroup->GetBoundInstance(this,GetDifficulty());
|
InstanceGroupBind *groupBind = pGroup->GetBoundInstance(this,GetDifficulty());
|
||||||
if (playerBind)
|
if (playerBind)
|
||||||
{
|
{
|
||||||
sLog.outError("InstanceMap::Add: player %s(%d) is being put in instance %d,%d,%d,%d,%d,%d but he is in group %d and is bound to instance %d,%d,%d,%d,%d,%d!",
|
sLog.outError("InstanceMap::Add: %s is being put in instance %d,%d,%d,%d,%d,%d but he is in group (Id: %d) and is bound to instance %d,%d,%d,%d,%d,%d!",
|
||||||
player->GetName(), player->GetGUIDLow(), GetInstanceSave()->GetMapId(), GetInstanceSave()->GetInstanceId(),
|
player->GetObjectGuid().GetString().c_str(), GetInstanceSave()->GetMapId(), GetInstanceSave()->GetInstanceId(),
|
||||||
GetInstanceSave()->GetDifficulty(), GetInstanceSave()->GetPlayerCount(), GetInstanceSave()->GetGroupCount(),
|
GetInstanceSave()->GetDifficulty(), GetInstanceSave()->GetPlayerCount(), GetInstanceSave()->GetGroupCount(),
|
||||||
GetInstanceSave()->CanReset(), GUID_LOPART(pGroup->GetLeaderGUID()),
|
GetInstanceSave()->CanReset(), pGroup->GetId(),
|
||||||
playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(),
|
playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(),
|
||||||
playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset());
|
playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset());
|
||||||
|
|
||||||
if (groupBind)
|
if (groupBind)
|
||||||
sLog.outError("InstanceMap::Add: the group is bound to instance %d,%d,%d,%d,%d,%d",
|
sLog.outError("InstanceMap::Add: the group (Id: %d) is bound to instance %d,%d,%d,%d,%d,%d",
|
||||||
|
pGroup->GetId(),
|
||||||
groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty(),
|
groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty(),
|
||||||
groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount(), groupBind->save->CanReset());
|
groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount(), groupBind->save->CanReset());
|
||||||
ASSERT(false);
|
ASSERT(false);
|
||||||
|
|
@ -1745,10 +1746,10 @@ bool InstanceMap::Add(Player *player)
|
||||||
// cannot jump to a different instance without resetting it
|
// cannot jump to a different instance without resetting it
|
||||||
if (groupBind->save != GetInstanceSave())
|
if (groupBind->save != GetInstanceSave())
|
||||||
{
|
{
|
||||||
sLog.outError("InstanceMap::Add: player %s(%d) is being put in instance %d,%d,%d but he is in group %d which is bound to instance %d,%d,%d!",
|
sLog.outError("InstanceMap::Add: %s is being put in instance %d,%d,%d but he is in group (Id: %d) which is bound to instance %d,%d,%d!",
|
||||||
player->GetName(), player->GetGUIDLow(), GetInstanceSave()->GetMapId(),
|
player->GetObjectGuid().GetString().c_str(), GetInstanceSave()->GetMapId(),
|
||||||
GetInstanceSave()->GetInstanceId(), GetInstanceSave()->GetDifficulty(),
|
GetInstanceSave()->GetInstanceId(), GetInstanceSave()->GetDifficulty(),
|
||||||
GUID_LOPART(pGroup->GetLeaderGUID()), groupBind->save->GetMapId(),
|
pGroup->GetId(), groupBind->save->GetMapId(),
|
||||||
groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty());
|
groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty());
|
||||||
|
|
||||||
if (GetInstanceSave())
|
if (GetInstanceSave())
|
||||||
|
|
@ -1913,7 +1914,7 @@ bool InstanceMap::Reset(uint8 method)
|
||||||
|
|
||||||
void InstanceMap::PermBindAllPlayers(Player *player)
|
void InstanceMap::PermBindAllPlayers(Player *player)
|
||||||
{
|
{
|
||||||
if(!IsDungeon())
|
if (!IsDungeon())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Group *group = player->GetGroup();
|
Group *group = player->GetGroup();
|
||||||
|
|
@ -1924,7 +1925,7 @@ void InstanceMap::PermBindAllPlayers(Player *player)
|
||||||
// players inside an instance cannot be bound to other instances
|
// players inside an instance cannot be bound to other instances
|
||||||
// some players may already be permanently bound, in this case nothing happens
|
// some players may already be permanently bound, in this case nothing happens
|
||||||
InstancePlayerBind *bind = plr->GetBoundInstance(GetId(), GetDifficulty());
|
InstancePlayerBind *bind = plr->GetBoundInstance(GetId(), GetDifficulty());
|
||||||
if(!bind || !bind->perm)
|
if (!bind || !bind->perm)
|
||||||
{
|
{
|
||||||
plr->BindToInstance(GetInstanceSave(), true);
|
plr->BindToInstance(GetInstanceSave(), true);
|
||||||
WorldPacket data(SMSG_INSTANCE_SAVE_CREATED, 4);
|
WorldPacket data(SMSG_INSTANCE_SAVE_CREATED, 4);
|
||||||
|
|
@ -1933,7 +1934,7 @@ void InstanceMap::PermBindAllPlayers(Player *player)
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the leader is not in the instance the group will not get a perm bind
|
// if the leader is not in the instance the group will not get a perm bind
|
||||||
if(group && group->GetLeaderGUID() == plr->GetGUID())
|
if (group && group->GetLeaderGuid() == plr->GetObjectGuid())
|
||||||
group->BindToInstance(GetInstanceSave(), true);
|
group->BindToInstance(GetInstanceSave(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1347,9 +1347,9 @@ void WorldSession::HandleResetInstancesOpcode( WorldPacket & /*recv_data*/ )
|
||||||
{
|
{
|
||||||
DEBUG_LOG("WORLD: CMSG_RESET_INSTANCES");
|
DEBUG_LOG("WORLD: CMSG_RESET_INSTANCES");
|
||||||
|
|
||||||
if(Group *pGroup = _player->GetGroup())
|
if (Group *pGroup = _player->GetGroup())
|
||||||
{
|
{
|
||||||
if(pGroup->IsLeader(_player->GetGUID()))
|
if (pGroup->IsLeader(_player->GetObjectGuid()))
|
||||||
{
|
{
|
||||||
pGroup->ResetInstances(INSTANCE_RESET_ALL, false, _player);
|
pGroup->ResetInstances(INSTANCE_RESET_ALL, false, _player);
|
||||||
pGroup->ResetInstances(INSTANCE_RESET_ALL, true,_player);
|
pGroup->ResetInstances(INSTANCE_RESET_ALL, true,_player);
|
||||||
|
|
@ -1386,12 +1386,12 @@ void WorldSession::HandleSetDungeonDifficultyOpcode( WorldPacket & recv_data )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_player->getLevel() < LEVELREQUIREMENT_HEROIC)
|
if (_player->getLevel() < LEVELREQUIREMENT_HEROIC)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(Group *pGroup = _player->GetGroup())
|
if (Group *pGroup = _player->GetGroup())
|
||||||
{
|
{
|
||||||
if(pGroup->IsLeader(_player->GetGUID()))
|
if (pGroup->IsLeader(_player->GetObjectGuid()))
|
||||||
{
|
{
|
||||||
// the difficulty is set even if the instances can't be reset
|
// the difficulty is set even if the instances can't be reset
|
||||||
//_player->SendDungeonDifficulty(true);
|
//_player->SendDungeonDifficulty(true);
|
||||||
|
|
@ -1430,12 +1430,12 @@ void WorldSession::HandleSetRaidDifficultyOpcode( WorldPacket & recv_data )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_player->getLevel() < LEVELREQUIREMENT_HEROIC)
|
if (_player->getLevel() < LEVELREQUIREMENT_HEROIC)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(Group *pGroup = _player->GetGroup())
|
if (Group *pGroup = _player->GetGroup())
|
||||||
{
|
{
|
||||||
if(pGroup->IsLeader(_player->GetGUID()))
|
if (pGroup->IsLeader(_player->GetObjectGuid()))
|
||||||
{
|
{
|
||||||
// the difficulty is set even if the instances can't be reset
|
// the difficulty is set even if the instances can't be reset
|
||||||
//_player->SendDungeonDifficulty(true);
|
//_player->SendDungeonDifficulty(true);
|
||||||
|
|
|
||||||
|
|
@ -467,7 +467,7 @@ void WorldSession::HandleListStabledPetsOpcode( WorldPacket & recv_data )
|
||||||
|
|
||||||
recv_data >> npcGUID;
|
recv_data >> npcGUID;
|
||||||
|
|
||||||
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID.GetRawValue(), UNIT_NPC_FLAG_STABLEMASTER);
|
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_STABLEMASTER);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
{
|
{
|
||||||
DEBUG_LOG( "WORLD: HandleListStabledPetsOpcode - %s not found or you can't interact with him.", npcGUID.GetString().c_str());
|
DEBUG_LOG( "WORLD: HandleListStabledPetsOpcode - %s not found or you can't interact with him.", npcGUID.GetString().c_str());
|
||||||
|
|
|
||||||
|
|
@ -3310,6 +3310,7 @@ void ObjectMgr::LoadGroups()
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
uint32 memberGuidlow = fields[0].GetUInt32();
|
uint32 memberGuidlow = fields[0].GetUInt32();
|
||||||
|
ObjectGuid memberGuid = ObjectGuid(HIGHGUID_PLAYER, memberGuidlow);
|
||||||
bool assistent = fields[1].GetBool();
|
bool assistent = fields[1].GetBool();
|
||||||
uint8 subgroup = fields[2].GetUInt8();
|
uint8 subgroup = fields[2].GetUInt8();
|
||||||
uint32 groupId = fields[3].GetUInt32();
|
uint32 groupId = fields[3].GetUInt32();
|
||||||
|
|
@ -3318,7 +3319,8 @@ void ObjectMgr::LoadGroups()
|
||||||
group = GetGroupById(groupId);
|
group = GetGroupById(groupId);
|
||||||
if (!group)
|
if (!group)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Incorrect entry in group_member table : no group with Id %d for member %d!", groupId, memberGuidlow);
|
sLog.outErrorDb("Incorrect entry in group_member table : no group with Id %d for member %s!",
|
||||||
|
groupId, memberGuid.GetString().c_str());
|
||||||
CharacterDatabase.PExecute("DELETE FROM group_member WHERE memberGuid = '%d'", memberGuidlow);
|
CharacterDatabase.PExecute("DELETE FROM group_member WHERE memberGuid = '%d'", memberGuidlow);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -3326,7 +3328,8 @@ void ObjectMgr::LoadGroups()
|
||||||
|
|
||||||
if (!group->LoadMemberFromDB(memberGuidlow, subgroup, assistent))
|
if (!group->LoadMemberFromDB(memberGuidlow, subgroup, assistent))
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Incorrect entry in group_member table : member %d cannot be added to player %d's group (Id: %u)!", memberGuidlow, GUID_LOPART(group->GetLeaderGUID()), groupId);
|
sLog.outErrorDb("Incorrect entry in group_member table : member %s cannot be added to group (Id: %u)!",
|
||||||
|
memberGuid.GetString().c_str(), groupId);
|
||||||
CharacterDatabase.PExecute("DELETE FROM group_member WHERE memberGuid = '%d'", memberGuidlow);
|
CharacterDatabase.PExecute("DELETE FROM group_member WHERE memberGuid = '%d'", memberGuidlow);
|
||||||
}
|
}
|
||||||
}while( result->NextRow() );
|
}while( result->NextRow() );
|
||||||
|
|
|
||||||
|
|
@ -2479,9 +2479,9 @@ void Player::UninviteFromGroup()
|
||||||
|
|
||||||
void Player::RemoveFromGroup(Group* group, ObjectGuid guid)
|
void Player::RemoveFromGroup(Group* group, ObjectGuid guid)
|
||||||
{
|
{
|
||||||
if(group)
|
if (group)
|
||||||
{
|
{
|
||||||
if (group->RemoveMember(guid.GetRawValue(), 0) <= 1)
|
if (group->RemoveMember(guid, 0) <= 1)
|
||||||
{
|
{
|
||||||
// group->Disband(); already disbanded in RemoveMember
|
// group->Disband(); already disbanded in RemoveMember
|
||||||
sObjectMgr.RemoveGroup(group);
|
sObjectMgr.RemoveGroup(group);
|
||||||
|
|
@ -8049,7 +8049,7 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)
|
||||||
{
|
{
|
||||||
if (group->GetLootMethod() == FREE_FOR_ALL)
|
if (group->GetLootMethod() == FREE_FOR_ALL)
|
||||||
permission = ALL_PERMISSION;
|
permission = ALL_PERMISSION;
|
||||||
else if (group->GetLooterGuid() == GetGUID())
|
else if (group->GetLooterGuid() == GetObjectGuid())
|
||||||
{
|
{
|
||||||
if (group->GetLootMethod() == MASTER_LOOT)
|
if (group->GetLootMethod() == MASTER_LOOT)
|
||||||
permission = MASTER_PERMISSION;
|
permission = MASTER_PERMISSION;
|
||||||
|
|
@ -15188,7 +15188,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
||||||
|
|
||||||
//join player to battleground group
|
//join player to battleground group
|
||||||
currentBg->EventPlayerLoggedIn(this, GetGUID());
|
currentBg->EventPlayerLoggedIn(this, GetGUID());
|
||||||
currentBg->AddOrSetPlayerToCorrectBgGroup(this, GetGUID(), m_bgData.bgTeam);
|
currentBg->AddOrSetPlayerToCorrectBgGroup(this, GetObjectGuid(), m_bgData.bgTeam);
|
||||||
|
|
||||||
SetInviteForBattleGroundQueueType(bgQueueTypeId,currentBg->GetInstanceID());
|
SetInviteForBattleGroundQueueType(bgQueueTypeId,currentBg->GetInstanceID());
|
||||||
}
|
}
|
||||||
|
|
@ -16376,7 +16376,7 @@ void Player::_LoadGroup(QueryResult *result)
|
||||||
|
|
||||||
if (Group* group = sObjectMgr.GetGroupById(groupId))
|
if (Group* group = sObjectMgr.GetGroupById(groupId))
|
||||||
{
|
{
|
||||||
uint8 subgroup = group->GetMemberGroup(GetGUID());
|
uint8 subgroup = group->GetMemberGroup(GetObjectGuid());
|
||||||
SetGroup(group, subgroup);
|
SetGroup(group, subgroup);
|
||||||
if (getLevel() >= LEVELREQUIREMENT_HEROIC)
|
if (getLevel() >= LEVELREQUIREMENT_HEROIC)
|
||||||
{
|
{
|
||||||
|
|
@ -16436,8 +16436,10 @@ void Player::_LoadBoundInstances(QueryResult *result)
|
||||||
|
|
||||||
if(!perm && group)
|
if(!perm && group)
|
||||||
{
|
{
|
||||||
sLog.outError("_LoadBoundInstances: player %s(%d) is in group %d but has a non-permanent character bind to map %d,%d,%d", GetName(), GetGUIDLow(), GUID_LOPART(group->GetLeaderGUID()), mapId, instanceId, difficulty);
|
sLog.outError("_LoadBoundInstances: %s is in group (Id: %d) but has a non-permanent character bind to map %d,%d,%d",
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%d' AND instance = '%d'", GetGUIDLow(), instanceId);
|
GetObjectGuid().GetString().c_str(), group->GetId(), mapId, instanceId, difficulty);
|
||||||
|
CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%d' AND instance = '%d'",
|
||||||
|
GetGUIDLow(), instanceId);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -16609,13 +16611,19 @@ void Player::SendSavedInstances()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// convert the player's binds to the group
|
/// convert the player's binds to the group
|
||||||
void Player::ConvertInstancesToGroup(Player *player, Group *group, uint64 player_guid)
|
void Player::ConvertInstancesToGroup(Player *player, Group *group, ObjectGuid player_guid)
|
||||||
{
|
{
|
||||||
bool has_binds = false;
|
bool has_binds = false;
|
||||||
bool has_solo = false;
|
bool has_solo = false;
|
||||||
|
|
||||||
if(player) { player_guid = player->GetGUID(); if(!group) group = player->GetGroup(); }
|
if (player)
|
||||||
ASSERT(player_guid);
|
{
|
||||||
|
player_guid = player->GetGUID();
|
||||||
|
if (!group)
|
||||||
|
group = player->GetGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
ASSERT(!player_guid.IsEmpty());
|
||||||
|
|
||||||
// copy all binds to the group, when changing leader it's assumed the character
|
// copy all binds to the group, when changing leader it's assumed the character
|
||||||
// will not have any solo binds
|
// will not have any solo binds
|
||||||
|
|
@ -16641,13 +16649,15 @@ void Player::ConvertInstancesToGroup(Player *player, Group *group, uint64 player
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32 player_lowguid = player_guid.GetCounter();
|
||||||
|
|
||||||
// if the player's not online we don't know what binds it has
|
// if the player's not online we don't know what binds it has
|
||||||
if(!player || !group || has_binds)
|
if(!player || !group || has_binds)
|
||||||
CharacterDatabase.PExecute("INSERT INTO group_instance SELECT guid, instance, permanent FROM character_instance WHERE guid = '%u'", GUID_LOPART(player_guid));
|
CharacterDatabase.PExecute("INSERT INTO group_instance SELECT guid, instance, permanent FROM character_instance WHERE guid = '%u'", player_lowguid);
|
||||||
|
|
||||||
// the following should not get executed when changing leaders
|
// the following should not get executed when changing leaders
|
||||||
if(!player || has_solo)
|
if(!player || has_solo)
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%d' AND permanent = 0", GUID_LOPART(player_guid));
|
CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%d' AND permanent = 0", player_lowguid);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Player::_LoadHomeBind(QueryResult *result)
|
bool Player::_LoadHomeBind(QueryResult *result)
|
||||||
|
|
@ -20588,13 +20598,13 @@ Player* Player::GetNextRandomRaidMember(float radius)
|
||||||
PartyResult Player::CanUninviteFromGroup() const
|
PartyResult Player::CanUninviteFromGroup() const
|
||||||
{
|
{
|
||||||
const Group* grp = GetGroup();
|
const Group* grp = GetGroup();
|
||||||
if(!grp)
|
if (!grp)
|
||||||
return ERR_NOT_IN_GROUP;
|
return ERR_NOT_IN_GROUP;
|
||||||
|
|
||||||
if(!grp->IsLeader(GetGUID()) && !grp->IsAssistant(GetGUID()))
|
if (!grp->IsLeader(GetObjectGuid()) && !grp->IsAssistant(GetObjectGuid()))
|
||||||
return ERR_NOT_LEADER;
|
return ERR_NOT_LEADER;
|
||||||
|
|
||||||
if(InBattleGround())
|
if (InBattleGround())
|
||||||
return ERR_INVITE_RESTRICTED;
|
return ERR_INVITE_RESTRICTED;
|
||||||
|
|
||||||
return ERR_PARTY_RESULT_OK;
|
return ERR_PARTY_RESULT_OK;
|
||||||
|
|
|
||||||
|
|
@ -2333,7 +2333,7 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||||
InstancePlayerBind* BindToInstance(InstanceSave *save, bool permanent, bool load = false);
|
InstancePlayerBind* BindToInstance(InstanceSave *save, bool permanent, bool load = false);
|
||||||
void SendRaidInfo();
|
void SendRaidInfo();
|
||||||
void SendSavedInstances();
|
void SendSavedInstances();
|
||||||
static void ConvertInstancesToGroup(Player *player, Group *group = NULL, uint64 player_guid = 0);
|
static void ConvertInstancesToGroup(Player *player, Group *group = NULL, ObjectGuid player_guid = ObjectGuid());
|
||||||
InstanceSave* GetBoundInstanceSaveForSelfOrGroup(uint32 mapid);
|
InstanceSave* GetBoundInstanceSaveForSelfOrGroup(uint32 mapid);
|
||||||
|
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
|
|
|
||||||
|
|
@ -2017,13 +2017,13 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
|
||||||
if( targetOwner->GetTypeId() == TYPEID_PLAYER &&
|
if( targetOwner->GetTypeId() == TYPEID_PLAYER &&
|
||||||
target->GetTypeId() == TYPEID_UNIT && (((Creature*)target)->isPet()) &&
|
target->GetTypeId() == TYPEID_UNIT && (((Creature*)target)->isPet()) &&
|
||||||
target->GetOwnerGUID() == targetOwner->GetGUID() &&
|
target->GetOwnerGUID() == targetOwner->GetGUID() &&
|
||||||
pGroup->IsMember(((Player*)targetOwner)->GetGUID()))
|
pGroup->IsMember(((Player*)targetOwner)->GetObjectGuid()))
|
||||||
{
|
{
|
||||||
targetUnitMap.push_back(target);
|
targetUnitMap.push_back(target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 1Our target can be a player who is on our group
|
// 1Our target can be a player who is on our group
|
||||||
else if (target->GetTypeId() == TYPEID_PLAYER && pGroup->IsMember(((Player*)target)->GetGUID()))
|
else if (target->GetTypeId() == TYPEID_PLAYER && pGroup->IsMember(((Player*)target)->GetObjectGuid()))
|
||||||
{
|
{
|
||||||
targetUnitMap.push_back(target);
|
targetUnitMap.push_back(target);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -690,7 +690,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
||||||
data << pVictim->GetObjectGuid(); //victim
|
data << pVictim->GetObjectGuid(); //victim
|
||||||
|
|
||||||
if (group_tap)
|
if (group_tap)
|
||||||
group_tap->BroadcastPacket(&data, false, group_tap->GetMemberGroup(player_tap->GetGUID()),player_tap->GetGUID());
|
group_tap->BroadcastPacket(&data, false, group_tap->GetMemberGroup(player_tap->GetObjectGuid()),player_tap->GetObjectGuid());
|
||||||
|
|
||||||
player_tap->SendDirectMessage(&data);
|
player_tap->SendDirectMessage(&data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "10370"
|
#define REVISION_NR "10371"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue