mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 04:37:00 +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
|
|
@ -110,7 +110,7 @@ void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data )
|
|||
if(group)
|
||||
{
|
||||
// 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);
|
||||
return;
|
||||
|
|
@ -172,9 +172,10 @@ void WorldSession::HandleGroupAcceptOpcode( WorldPacket & recv_data )
|
|||
if (!group)
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -191,21 +192,21 @@ void WorldSession::HandleGroupAcceptOpcode( WorldPacket & recv_data )
|
|||
return;
|
||||
}
|
||||
|
||||
Player* leader = sObjectMgr.GetPlayer(group->GetLeaderGUID());
|
||||
Player* leader = sObjectMgr.GetPlayer(group->GetLeaderGuid());
|
||||
|
||||
// forming a new group, create it
|
||||
if(!group->IsCreated())
|
||||
if (!group->IsCreated())
|
||||
{
|
||||
if (leader)
|
||||
group->RemoveInvite(leader);
|
||||
if (group->Create(group->GetLeaderGUID(), group->GetLeaderName()))
|
||||
if (group->Create(group->GetLeaderGuid(), group->GetLeaderName()))
|
||||
sObjectMgr.AddGroup(group);
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
|
@ -216,12 +217,12 @@ void WorldSession::HandleGroupDeclineOpcode( WorldPacket & /*recv_data*/ )
|
|||
return;
|
||||
|
||||
// remember leader if online
|
||||
Player *leader = sObjectMgr.GetPlayer(group->GetLeaderGUID());
|
||||
Player *leader = sObjectMgr.GetPlayer(group->GetLeaderGuid());
|
||||
|
||||
// uninvite, group can be deleted
|
||||
GetPlayer()->UninviteFromGroup();
|
||||
|
||||
if(!leader || !leader->GetSession())
|
||||
if (!leader || !leader->GetSession())
|
||||
return;
|
||||
|
||||
// report
|
||||
|
|
@ -232,19 +233,19 @@ void WorldSession::HandleGroupDeclineOpcode( WorldPacket & /*recv_data*/ )
|
|||
|
||||
void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket & recv_data)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recv_data >> guid;
|
||||
recv_data.read_skip<std::string>(); // reason
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
PartyResult res = GetPlayer()->CanUninviteFromGroup();
|
||||
if(res != ERR_PARTY_RESULT_OK)
|
||||
if (res != ERR_PARTY_RESULT_OK)
|
||||
{
|
||||
SendPartyResult(PARTY_OP_LEAVE, "", res);
|
||||
return;
|
||||
|
|
@ -254,13 +255,13 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket & recv_data)
|
|||
if(!grp)
|
||||
return;
|
||||
|
||||
if(grp->IsMember(guid))
|
||||
if (grp->IsMember(guid))
|
||||
{
|
||||
Player::RemoveFromGroup(grp, guid);
|
||||
return;
|
||||
}
|
||||
|
||||
if(Player* plr = grp->GetInvited(guid))
|
||||
if (Player* plr = grp->GetInvited(guid))
|
||||
{
|
||||
plr->UninviteFromGroup();
|
||||
return;
|
||||
|
|
@ -275,34 +276,35 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket & recv_data)
|
|||
recv_data >> membername;
|
||||
|
||||
// player not found
|
||||
if(!normalizePlayerName(membername))
|
||||
if (!normalizePlayerName(membername))
|
||||
return;
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
PartyResult res = GetPlayer()->CanUninviteFromGroup();
|
||||
if(res != ERR_PARTY_RESULT_OK)
|
||||
if (res != ERR_PARTY_RESULT_OK)
|
||||
{
|
||||
SendPartyResult(PARTY_OP_LEAVE, "", res);
|
||||
return;
|
||||
}
|
||||
|
||||
Group* grp = GetPlayer()->GetGroup();
|
||||
if(!grp)
|
||||
if (!grp)
|
||||
return;
|
||||
|
||||
if(uint64 guid = grp->GetMemberGUID(membername))
|
||||
ObjectGuid guid = grp->GetMemberGUID(membername);
|
||||
if (!guid.IsEmpty())
|
||||
{
|
||||
Player::RemoveFromGroup(grp, guid);
|
||||
return;
|
||||
}
|
||||
|
||||
if(Player* plr = grp->GetInvited(membername))
|
||||
if (Player* plr = grp->GetInvited(membername))
|
||||
{
|
||||
plr->UninviteFromGroup();
|
||||
return;
|
||||
|
|
@ -313,17 +315,17 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket & recv_data)
|
|||
|
||||
void WorldSession::HandleGroupSetLeaderOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recv_data >> guid;
|
||||
|
||||
Group *group = GetPlayer()->GetGroup();
|
||||
if(!group)
|
||||
if (!group)
|
||||
return;
|
||||
|
||||
Player *player = sObjectMgr.GetPlayer(guid);
|
||||
|
||||
/** error handling **/
|
||||
if (!player || !group->IsLeader(GetPlayer()->GetGUID()) || player->GetGroup() != group)
|
||||
if (!player || !group->IsLeader(GetPlayer()->GetObjectGuid()) || player->GetGroup() != group)
|
||||
return;
|
||||
/********************/
|
||||
|
||||
|
|
@ -354,16 +356,16 @@ void WorldSession::HandleGroupDisbandOpcode( WorldPacket & /*recv_data*/ )
|
|||
void WorldSession::HandleLootMethodOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
uint32 lootMethod;
|
||||
uint64 lootMaster;
|
||||
ObjectGuid lootMaster;
|
||||
uint32 lootThreshold;
|
||||
recv_data >> lootMethod >> lootMaster >> lootThreshold;
|
||||
|
||||
Group *group = GetPlayer()->GetGroup();
|
||||
if(!group)
|
||||
if (!group)
|
||||
return;
|
||||
|
||||
/** error handling **/
|
||||
if(!group->IsLeader(GetPlayer()->GetGUID()))
|
||||
if (!group->IsLeader(GetPlayer()->GetObjectGuid()))
|
||||
return;
|
||||
/********************/
|
||||
|
||||
|
|
@ -427,7 +429,7 @@ void WorldSession::HandleMinimapPingOpcode(WorldPacket& recv_data)
|
|||
data << uint64(GetPlayer()->GetGUID());
|
||||
data << float(x);
|
||||
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)
|
||||
|
|
@ -476,12 +478,14 @@ void WorldSession::HandleRaidTargetUpdateOpcode( WorldPacket & recv_data )
|
|||
}
|
||||
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;
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid 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;
|
||||
|
||||
/** error handling **/
|
||||
if(!group->IsLeader(GetPlayer()->GetGUID()) || group->GetMembersCount() < 2)
|
||||
if (!group->IsLeader(GetPlayer()->GetObjectGuid()) || group->GetMembersCount() < 2)
|
||||
return;
|
||||
/********************/
|
||||
|
||||
|
|
@ -521,7 +525,8 @@ void WorldSession::HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data )
|
|||
return;
|
||||
|
||||
/** error handling **/
|
||||
if(!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
|
||||
if (!group->IsLeader(GetPlayer()->GetObjectGuid()) &&
|
||||
!group->IsAssistant(GetPlayer()->GetObjectGuid()))
|
||||
return;
|
||||
|
||||
if (!group->HasFreeSlotSubGroup(groupNr))
|
||||
|
|
@ -531,23 +536,23 @@ void WorldSession::HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data )
|
|||
// everything is fine, do it
|
||||
if (Player* player = sObjectMgr.GetPlayer(name.c_str()))
|
||||
group->ChangeMembersGroup(player, groupNr);
|
||||
else
|
||||
group->ChangeMembersGroup(sObjectMgr.GetPlayerGUIDByName(name.c_str()), groupNr);
|
||||
else if (uint64 guid = sObjectMgr.GetPlayerGUIDByName(name.c_str()))
|
||||
group->ChangeMembersGroup(guid, groupNr);
|
||||
}
|
||||
|
||||
void WorldSession::HandleGroupAssistantLeaderOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
uint8 flag;
|
||||
recv_data >> guid;
|
||||
recv_data >> flag;
|
||||
|
||||
Group *group = GetPlayer()->GetGroup();
|
||||
if(!group)
|
||||
if (!group)
|
||||
return;
|
||||
|
||||
/** error handling **/
|
||||
if(!group->IsLeader(GetPlayer()->GetGUID()))
|
||||
if (!group->IsLeader(GetPlayer()->GetObjectGuid()))
|
||||
return;
|
||||
/********************/
|
||||
|
||||
|
|
@ -559,18 +564,18 @@ void WorldSession::HandlePartyAssignmentOpcode( WorldPacket & recv_data )
|
|||
{
|
||||
uint8 role;
|
||||
uint8 apply;
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recv_data >> role >> apply; // role 0 = Main Tank, 1 = Main Assistant
|
||||
recv_data >> guid;
|
||||
|
||||
DEBUG_LOG("MSG_PARTY_ASSIGNMENT");
|
||||
|
||||
Group *group = GetPlayer()->GetGroup();
|
||||
if(!group)
|
||||
if (!group)
|
||||
return;
|
||||
|
||||
/** error handling **/
|
||||
if(!group->IsLeader(GetPlayer()->GetGUID()))
|
||||
if (!group->IsLeader(GetPlayer()->GetObjectGuid()))
|
||||
return;
|
||||
/********************/
|
||||
|
||||
|
|
@ -586,10 +591,10 @@ void WorldSession::HandlePartyAssignmentOpcode( WorldPacket & recv_data )
|
|||
}
|
||||
else
|
||||
{
|
||||
if (group->GetMainTank() == guid)
|
||||
group->SetMainTank(0);
|
||||
if (group->GetMainAssistant() == guid)
|
||||
group->SetMainAssistant(0);
|
||||
if (group->GetMainTankGuid() == guid)
|
||||
group->SetMainTank(ObjectGuid());
|
||||
if (group->GetMainAssistantGuid() == guid)
|
||||
group->SetMainAssistant(ObjectGuid());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -602,7 +607,8 @@ void WorldSession::HandleRaidReadyCheckOpcode( WorldPacket & recv_data )
|
|||
return;
|
||||
|
||||
/** error handling **/
|
||||
if(!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
|
||||
if (!group->IsLeader(GetPlayer()->GetObjectGuid()) &&
|
||||
!group->IsAssistant(GetPlayer()->GetObjectGuid()))
|
||||
return;
|
||||
/********************/
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue