void WorldSession::HandleArenaTeamAddMemberOpcode(WorldPacket & recv_data) { WorldPacket data(SMSG_ARENA_TEAM_INVITE, 40); string player_name; uint32 teamId; recv_data >> teamId >> player_name; ArenaTeam * pTeam = objmgr.GetArenaTeamById(teamId); if( !pTeam ) return; if(!pTeam->HasMember(GetPlayer()->GetLowGUID())) { GetPlayer()->SoftDisconnect(); return; } Player * plr = objmgr.GetPlayer(player_name.c_str(), false); if(plr == NULL) { SystemMessage("Player `%s` is non-existent or not online.", player_name.c_str()); return; } if(pTeam->m_leader != _player->GetLowGUID()) { SystemMessage("You are not the captain of this arena team."); return; } if( plr->getLevel() < PLAYER_ARENA_MIN_LEVEL ) { SystemMessage( "Player must be level %u to join an arena team.", PLAYER_ARENA_MIN_LEVEL ); return; } if(plr->m_arenaTeams[pTeam->m_type] != NULL) { SystemMessage("That player is already in an arena team of this type."); return; } if(plr->m_arenateaminviteguid != 0) { SystemMessage("That player is already invited to an arena team"); return; } if(plr->GetTeam() != _player->GetTeam() && !HasGMPermissions()) { SystemMessage("That player is a member of a different faction."); return; } plr->m_arenateaminviteguid = _player->m_arenaTeams[pTeam->m_type]->m_id; data << _player->GetName(); data << _player->m_arenaTeams[pTeam->m_type]->m_name; plr->GetSession()->SendPacket(&data); }
void WorldSession::HandleArenaTeamRemoveMemberOpcode(WorldPacket & recv_data) { CHECK_INWORLD_RETURN ArenaTeam* team; uint8 slot; uint32 teamId; string name; PlayerInfo* inf; recv_data >> teamId >> name; team = objmgr.GetArenaTeamById(teamId); if(!team) { GetPlayer()->SoftDisconnect(); return; } slot = static_cast<uint8>(team->m_type); if((team = _player->m_arenaTeams[slot]) == NULL) { SystemMessage("You are not in an arena team of this type."); return; } if(team->m_leader != _player->GetLowGUID()) { SystemMessage("You are not the leader of this team."); return; } if((inf = objmgr.GetPlayerInfoByName(name.c_str())) == NULL) { SystemMessage("That player cannot be found."); return; } if(!team->HasMember(inf->guid)) { SystemMessage("That player is not in your arena team."); return; } if(team->RemoveMember(inf)) { char buffer[1024]; WorldPacket* data; snprintf(buffer, 1024, "%s was removed from the arena team '%s'.", inf->name, team->m_name.c_str()); data = sChatHandler.FillSystemMessageData(buffer); team->SendPacket(data); delete data; SystemMessage("Removed %s from the arena team '%s'.", inf->name, team->m_name.c_str()); } }
void WorldSession::HandleArenaTeamRemoveMemberOpcode(WorldPacket & recv_data) { ArenaTeam * team; uint8 slot; uint32 teamId; string name; PlayerInfo * inf; recv_data >> teamId >> name; team = objmgr.GetArenaTeamById(teamId); if(!team) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PLAYER_NOT_IN_TEAM); return; } slot = team->m_type; if( (team = _player->m_playerInfo->arenaTeam[slot]) == NULL ) { SendNotInArenaTeamPacket(uint8(team->GetPlayersPerTeam())); return; } if(team->m_leader != _player->GetLowGUID()) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS); return; } if( (inf = objmgr.GetPlayerInfoByName(name.c_str())) == NULL ) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", name.c_str(), ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S); return; } if( inf->guid == team->m_leader ) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_LEADER_LEAVE); return; } if(!team->HasMember(inf->guid)) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, inf->name, team->m_name, ERR_ARENA_TEAM_PLAYER_NOT_IN_TEAM_SS); return; } if(team->RemoveMember(inf)) { team->SendArenaTeamEventPacket(ERR_ARENA_TEAM_REMOVE, 3, inf->name, team->m_name, _player->GetName()); SystemMessage("Removed %s from the arena team '%s'.", inf->name, team->m_name.c_str()); } }
void WorldSession::HandleArenaTeamPromoteOpcode(WorldPacket & recv_data) { uint32 teamId; uint8 slot; string name; ArenaTeam * team; PlayerInfo * inf; recv_data >> teamId >> name; team = objmgr.GetArenaTeamById(teamId); if(!team) { GetPlayer()->SoftDisconnect(); return; } slot = team->m_type; if( slot >= NUM_ARENA_TEAM_TYPES ) { return; } if( (team = _player->m_arenaTeams[slot]) == NULL ) { SystemMessage("You are not in an arena team of this type."); return; } if(team->m_leader != _player->GetLowGUID()) { SystemMessage("You aren't the captain of this team."); return; } if( (inf = objmgr.GetPlayerInfoByName(name.c_str())) == NULL ) { SystemMessage("That player cannot be found."); return; } if(!team->HasMember(inf->guid)) { SystemMessage("That player is not a member of your arena team."); return; } team->SetLeader(inf); }
void WorldSession::HandleArenaTeamPromoteOpcode(WorldPacket & recv_data) { uint32 teamId; uint8 slot; string name; ArenaTeam * team; PlayerInfo * inf; recv_data >> teamId >> name; team = objmgr.GetArenaTeamById(teamId); if(!team) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_INTERNAL); return; } slot = team->m_type; if( slot >= NUM_ARENA_TEAM_TYPES ) return; if( (team = _player->m_playerInfo->arenaTeam[slot]) == NULL ) { SendNotInArenaTeamPacket(uint8(team->GetPlayersPerTeam())); return; } if(team->m_leader != _player->GetLowGUID()) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS); return; } if( (inf = objmgr.GetPlayerInfoByName(name.c_str())) == NULL ) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", name.c_str(), ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S); return; } if(!team->HasMember(inf->guid)) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, inf->name, team->m_name, ERR_ARENA_TEAM_PLAYER_NOT_IN_TEAM_SS); return; } team->SendArenaTeamEventPacket(ERR_ARENA_TEAM_LEADER_CHANGED, 3, _player->GetName(), inf->name, team->m_name); team->SetLeader(inf); }
void WorldSession::HandleArenaTeamRemoveMemberOpcode(WorldPacket & recv_data) { ArenaTeam * team; uint8 slot; uint32 teamId; string name; PlayerInfo * inf; recv_data >> teamId >> name; team = objmgr.GetArenaTeamById(teamId); if( !team || team->m_type >= NUM_ARENA_TEAM_TYPES ) { GetPlayer()->SoftDisconnect(); return; } slot = team->m_type; if( (team = _player->m_arenaTeams[slot]) == NULL ) { SystemMessage("You are not in an arena team of this type."); return; } if(team->m_leader != _player->GetLowGUID()) { SystemMessage("You are not the leader of this team."); return; } if( (inf = objmgr.GetPlayerInfoByName(name.c_str())) == NULL ) { SystemMessage("That player cannot be found."); return; } if(!team->HasMember(inf->guid)) { SystemMessage("That player is not in your arena team."); return; } //if there is anyone inside an arena match then do not destroy it if( inf->m_loggedInPlayer && inf->m_loggedInPlayer->m_bg && IS_ARENA( inf->m_loggedInPlayer->m_bg->GetType() ) ) { SystemMessage("The player is playing an active match."); return; } if(team->RemoveMember(inf)) { char buffer[1024]; WorldPacket * data; snprintf(buffer,1024,"%s was removed from the arena team '%s'.", inf->name, team->m_name.c_str()); data = sChatHandler.FillSystemMessageData(buffer); team->SendPacket(data); delete data; data = NULL; SystemMessage("Removed %s from the arena team '%s'.", inf->name, team->m_name.c_str()); } }
void WorldSession::HandleArenaTeamAddMemberOpcode(WorldPacket & recv_data) { string player_name; uint32 teamId; recv_data >> teamId >> player_name; ArenaTeam * pTeam = objmgr.GetArenaTeamById(teamId); if( !pTeam ) return; if(!pTeam->HasMember(GetPlayer()->GetLowGUID())) { SendNotInArenaTeamPacket(uint8(pTeam->GetPlayersPerTeam())); return; } Player * plr = objmgr.GetPlayer(player_name.c_str(), false); if(plr == NULL) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", player_name, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S); return; } if(pTeam->m_leader != _player->GetLowGUID()) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS); return; } if(plr->getLevel() < 70) { SystemMessage("%s is not high enough level to join your team", plr->GetName()); return; } if(plr->m_playerInfo->arenaTeam[pTeam->m_type] != NULL) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, plr->GetName(), "", ERR_ALREADY_IN_ARENA_TEAM_S); return; } if(plr->m_arenateaminviteguid != 0) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, plr->GetName(), "", ERR_ALREADY_INVITED_TO_ARENA_TEAM_S); return; } if(plr->GetTeam() != _player->GetTeam() && !HasGMPermissions()) { SystemMessage("You cannot invite players from the opposing alliance"); return; } if(pTeam->m_memberCount >= pTeam->GetPlayersPerTeam()) { SystemMessage("%s is full.", pTeam->m_name); return; } plr->m_arenateaminviteguid = _player->m_playerInfo->arenaTeam[pTeam->m_type]->m_id; WorldPacket data(SMSG_ARENA_TEAM_INVITE, 40); data << _player->GetName(); data << _player->m_playerInfo->arenaTeam[pTeam->m_type]->m_name; plr->GetSession()->SendPacket(&data); }