Merge pull request #5377 from kandera/wintergrasp_cleanup

Wintergrasp cleanup
This commit is contained in:
Machiavelli
2012-02-22 13:39:31 -08:00
3 changed files with 16 additions and 14 deletions
+3 -11
View File
@@ -103,17 +103,9 @@ void Battlefield::HandlePlayerLeaveZone(Player *plr, uint32 /*zone */ )
{
m_PlayersInWar[plr->GetTeamId()].erase(plr->GetGUID());
plr->GetSession()->SendBfLeaveMessage(m_BattleId);
if (Group* group = GetGroupPlayer(plr->GetGUID(), plr->GetTeamId())) // remove from raid group if player is member
{
// I think that now is not a hack
if (!group->RemoveMember(plr->GetGUID())) // group was disbanded
{
m_Groups[plr->GetTeamId()].erase(group->GetGUID());
group->SetBattlefieldGroup(NULL);
sGroupMgr->RemoveGroup(group);
delete group;
}
}
if (Group* group = plr->GetGroup()) // remove from raid group if player is member
group->RemoveMember(plr->GetGUID());
OnPlayerLeaveWar(plr); //For scripting
}
}
@@ -84,11 +84,11 @@ void WorldSession::SendBfEntered(uint32 BattleId)
SendPacket(&data);
}
void WorldSession::SendBfLeaveMessage(uint32 BattleId, uint8 reason)
void WorldSession::SendBfLeaveMessage(uint32 BattleId, BFLeaveReason reason)
{
WorldPacket data(SMSG_BATTLEFIELD_MGR_EJECTED, 7);
data << uint32(BattleId);
data << uint8(reason);//byte Reason (1=close invite,8="exited",10="to low level")
data << uint8(reason);//byte Reason
data << uint8(2);//byte BattleStatus
data << uint8(0);//bool Relocated
SendPacket(&data);
+11 -1
View File
@@ -123,6 +123,16 @@ enum PartyResult
ERR_PARTY_LFG_TELEPORT_IN_COMBAT = 30
};
enum BFLeaveReason
{
BF_LEAVE_REASON_CLOSE = 0x00000001,
//BF_LEAVE_REASON_UNK1 = 0x00000002, (not used)
//BF_LEAVE_REASON_UNK2 = 0x00000004, (not used)
BF_LEAVE_REASON_EXITED = 0x00000008,
BF_LEAVE_REASON_LOW_LEVEL = 0x00000010,
};
enum ChatRestrictionType
{
ERR_CHAT_RESTRICTED = 0,
@@ -789,7 +799,7 @@ class WorldSession
void SendBfInvitePlayerToQueue(uint32 BattleId);
void SendBfQueueInviteResponce(uint32 BattleId,uint32 ZoneId, bool CanQueue = true, bool Full = false);
void SendBfEntered(uint32 BattleId);
void SendBfLeaveMessage(uint32 BattleId, uint8 reason = 8);
void SendBfLeaveMessage(uint32 BattleId, BFLeaveReason reason = BF_LEAVE_REASON_EXITED);
void HandleBfQueueInviteResponse(WorldPacket &recv_data);
void HandleBfEntryInviteResponse(WorldPacket &recv_data);
void HandleBfExitRequest(WorldPacket &recv_data);