mirror of
https://github.com/mangosfour/server.git
synced 2025-12-18 01:37:01 +00:00
[9353] Some fixes to guild/arenateam events.
This commit is contained in:
parent
1aa6c8eac9
commit
0bd88dd55a
12 changed files with 317 additions and 347 deletions
|
|
@ -99,7 +99,7 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recv_data)
|
|||
|
||||
if(player->getLevel() < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
{
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", player->GetName(), ERR_ARENA_TEAM_PLAYER_TO_LOW);
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", player->GetName(), ERR_ARENA_TEAM_TARGET_TOO_LOW_S);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -134,7 +134,7 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recv_data)
|
|||
|
||||
if(arenateam->GetMembersSize() >= arenateam->GetType() * 2)
|
||||
{
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S,arenateam->GetName(),"",ERR_ARENA_TEAM_FULL);
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, arenateam->GetName(), "", ERR_ARENA_TEAM_TOO_MANY_MEMBERS_S);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -160,26 +160,27 @@ void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket & /*recv_data*/)
|
|||
|
||||
if(_player->GetArenaTeamId(at->GetSlot()))
|
||||
{
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S,"","",ERR_ALREADY_IN_ARENA_TEAM); // already in arena team that size
|
||||
// already in arena team that size
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ALREADY_IN_ARENA_TEAM);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && _player->GetTeam() != sObjectMgr.GetPlayerTeamByGUID(at->GetCaptain()))
|
||||
{
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S,"","",ERR_ARENA_TEAM_NOT_ALLIED);// not let enemies sign petition
|
||||
// not let enemies sign petition
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_NOT_ALLIED);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!at->AddMember(_player->GetGUID()))
|
||||
{
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S,"","",ERR_ARENA_TEAM_INTERNAL);// arena team not found
|
||||
// arena team not found
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S,"","",ERR_ARENA_TEAM_INTERNAL);
|
||||
return;
|
||||
}
|
||||
|
||||
// event
|
||||
WorldPacket data;
|
||||
BuildArenaTeamEventPacket(&data, ERR_ARENA_TEAM_JOIN_SS, 2, _player->GetName(), at->GetName(), "");
|
||||
at->BroadcastPacket(&data);
|
||||
at->BroadcastEvent(ERR_ARENA_TEAM_JOIN_SS, _player->GetGUID(), 2, _player->GetName(), at->GetName(), "");
|
||||
}
|
||||
|
||||
void WorldSession::HandleArenaTeamDeclineOpcode(WorldPacket & /*recv_data*/)
|
||||
|
|
@ -218,11 +219,9 @@ void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recv_data)
|
|||
at->DelMember(_player->GetGUID());
|
||||
|
||||
// event
|
||||
WorldPacket data;
|
||||
BuildArenaTeamEventPacket(&data, ERR_ARENA_TEAM_LEAVE_SS, 2, _player->GetName(), at->GetName(), "");
|
||||
at->BroadcastPacket(&data);
|
||||
at->BroadcastEvent(ERR_ARENA_TEAM_LEAVE_SS, _player->GetGUID(), 2, _player->GetName(), at->GetName(), "");
|
||||
|
||||
//send you are no longer member of team
|
||||
// send you are no longer member of team
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, at->GetName(), "", 0);
|
||||
}
|
||||
|
||||
|
|
@ -285,9 +284,7 @@ void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket & recv_data)
|
|||
at->DelMember(member->guid);
|
||||
|
||||
// event
|
||||
WorldPacket data;
|
||||
BuildArenaTeamEventPacket(&data, ERR_ARENA_TEAM_REMOVE_SSS, 3, name, at->GetName(), _player->GetName());
|
||||
at->BroadcastPacket(&data);
|
||||
at->BroadcastEvent(ERR_ARENA_TEAM_REMOVE_SSS, 0, 3, name, at->GetName(), _player->GetName());
|
||||
}
|
||||
|
||||
void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket & recv_data)
|
||||
|
|
@ -326,9 +323,7 @@ void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket & recv_data)
|
|||
at->SetCaptain(member->guid);
|
||||
|
||||
// event
|
||||
WorldPacket data;
|
||||
BuildArenaTeamEventPacket(&data, ERR_ARENA_TEAM_LEADER_CHANGED_SSS, 3, _player->GetName(), name, at->GetName());
|
||||
at->BroadcastPacket(&data);
|
||||
at->BroadcastEvent(ERR_ARENA_TEAM_LEADER_CHANGED_SSS, 0, 3, _player->GetName(), name, at->GetName());
|
||||
}
|
||||
|
||||
void WorldSession::SendArenaTeamCommandResult(uint32 team_action, const std::string& team, const std::string& player, uint32 error_id)
|
||||
|
|
@ -341,31 +336,6 @@ void WorldSession::SendArenaTeamCommandResult(uint32 team_action, const std::str
|
|||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::BuildArenaTeamEventPacket(WorldPacket *data, uint8 eventid, uint8 str_count, const std::string& str1, const std::string& str2, const std::string& str3)
|
||||
{
|
||||
data->Initialize(SMSG_ARENA_TEAM_EVENT, 1+1+1);
|
||||
*data << eventid;
|
||||
*data << str_count;
|
||||
switch(str_count)
|
||||
{
|
||||
case 1:
|
||||
*data << str1;
|
||||
break;
|
||||
case 2:
|
||||
*data << str1;
|
||||
*data << str2;
|
||||
break;
|
||||
case 3:
|
||||
*data << str1;
|
||||
*data << str2;
|
||||
*data << str3;
|
||||
break;
|
||||
default:
|
||||
sLog.outError("Unhandled str_count %u in SendArenaTeamEvent()", str_count);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::SendNotInArenaTeamPacket(uint8 type)
|
||||
{
|
||||
WorldPacket data(SMSG_ARENA_ERROR, 4+1); // 886 - You are not in a %uv%u arena team
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue