aboutsummaryrefslogtreecommitdiff
path: root/src/game/ArenaTeamHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/ArenaTeamHandler.cpp')
-rw-r--r--src/game/ArenaTeamHandler.cpp56
1 files changed, 13 insertions, 43 deletions
diff --git a/src/game/ArenaTeamHandler.cpp b/src/game/ArenaTeamHandler.cpp
index ef1117e1f13..ac35acc0fac 100644
--- a/src/game/ArenaTeamHandler.cpp
+++ b/src/game/ArenaTeamHandler.cpp
@@ -102,7 +102,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;
}
@@ -137,7 +137,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;
}
@@ -163,26 +163,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() != objmgr.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*/)
@@ -221,11 +222,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);
}
@@ -288,9 +287,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)
@@ -329,9 +326,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)
@@ -344,31 +339,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