mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[6897] Avoid DB access on uninvite from group.
Signed-off-by: hunuza <hunuza@gmail.com>
This commit is contained in:
parent
bc816b70fc
commit
ac2748a141
8 changed files with 113 additions and 79 deletions
|
|
@ -2024,23 +2024,23 @@ bool Player::IsInSameGroupWith(Player const* p) const
|
|||
/// \todo Shouldn't we also check if there is no other invitees before disbanding the group?
|
||||
void Player::UninviteFromGroup()
|
||||
{
|
||||
if(GetGroupInvite()) // uninvited invitee
|
||||
Group* group = GetGroupInvite();
|
||||
if(!group)
|
||||
return;
|
||||
|
||||
group->RemoveInvite(this);
|
||||
|
||||
if(group->GetMembersCount() <= 1) // group has just 1 member => disband
|
||||
{
|
||||
Group* group = GetGroupInvite();
|
||||
group->RemoveInvite(this);
|
||||
|
||||
if(group->GetMembersCount() <= 1) // group has just 1 member => disband
|
||||
if(group->IsCreated())
|
||||
{
|
||||
if(group->IsCreated())
|
||||
{
|
||||
group->Disband(true);
|
||||
objmgr.RemoveGroup(group);
|
||||
}
|
||||
else
|
||||
group->RemoveAllInvites();
|
||||
|
||||
delete group;
|
||||
group->Disband(true);
|
||||
objmgr.RemoveGroup(group);
|
||||
}
|
||||
else
|
||||
group->RemoveAllInvites();
|
||||
|
||||
delete group;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -18237,6 +18237,21 @@ Player* Player::GetNextRandomRaidMember(float radius)
|
|||
return nearMembers[randTarget];
|
||||
}
|
||||
|
||||
PartyResult Player::CanUninviteFromGroup() const
|
||||
{
|
||||
const Group* grp = GetGroup();
|
||||
if(!grp)
|
||||
return PARTY_RESULT_YOU_NOT_IN_GROUP;
|
||||
|
||||
if(!grp->IsLeader(GetGUID()) && !grp->IsAssistant(GetGUID()))
|
||||
return PARTY_RESULT_YOU_NOT_LEADER;
|
||||
|
||||
if(InBattleGround())
|
||||
return PARTY_RESULT_INVITE_RESTRICTED;
|
||||
|
||||
return PARTY_RESULT_OK;
|
||||
}
|
||||
|
||||
void Player::UpdateUnderwaterState( Map* m, float x, float y, float z )
|
||||
{
|
||||
float water_z = m->GetWaterLevel(x,y);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue