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::HandleArenaTeamLeaveOpcode(WorldPacket & recv_data) { ArenaTeam * team; uint32 teamId; recv_data >> teamId; team = objmgr.GetArenaTeamById(teamId); if( !team || team->m_type >= NUM_ARENA_TEAM_TYPES ) { GetPlayer()->SoftDisconnect(); return; } team = _player->m_arenaTeams[team->m_type]; if( team == NULL ) { SystemMessage("You are not in an arena team of this type."); return; } //if there is anyone inside an arena match then do not destroy it if( _player->m_bg && IS_ARENA( _player->m_bg->GetType() ) ) { SystemMessage("You cannot leave team while inside arena."); return; } if (team->m_leader == _player->GetLowGUID() && team->m_memberCount == 1) { team->Destroy(); return; } if(team->m_leader == _player->GetLowGUID()) { SystemMessage("You cannot leave the team yet, promote someone else to captain first."); return; } if(team->RemoveMember(_player->m_playerInfo)) { char buffer[1024]; WorldPacket * data; snprintf(buffer,1024,"%s left the arena team, '%s'.", _player->GetName(), team->m_name.c_str()); data = sChatHandler.FillSystemMessageData(buffer); team->SendPacket(data); delete data; data = NULL; SystemMessage("You have left the arena team, '%s'.", team->m_name.c_str()); } }
void WorldSession::HandleArenaTeamInviteAcceptOpcode(WorldPacket & recv_data) { CHECK_INWORLD_RETURN ArenaTeam* team; if(_player->m_arenateaminviteguid == 0) { SystemMessage("You have not been invited into another arena team."); return; } team = objmgr.GetArenaTeamById(_player->m_arenateaminviteguid); _player->m_arenateaminviteguid = 0; if(team == 0) { SystemMessage("That arena team no longer exists."); return; } if(team->m_memberCount >= team->m_slots) { SystemMessage("That team is now full."); return; } if(_player->m_arenaTeams[team->m_type] != NULL) /* shouldn't happen */ { SystemMessage("You have already been in an arena team of that size."); return; } if(team->AddMember(_player->m_playerInfo)) { char buffer[1024]; WorldPacket* data; snprintf(buffer, 1024, "%s joined the arena team, '%s'.", _player->GetName(), team->m_name.c_str()); data = sChatHandler.FillSystemMessageData(buffer); team->SendPacket(data); delete data; } else { SendNotification("Internal error."); } }
void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recv_data) { CHECK_INWORLD_RETURN ArenaTeam* team; uint32 teamId; recv_data >> teamId; team = objmgr.GetArenaTeamById(teamId); if(!team) { GetPlayer()->SoftDisconnect(); return; } if((team = _player->m_arenaTeams[team->m_type]) == NULL) { SystemMessage("You are not in an arena team of this type."); return; } if(team->m_leader == _player->GetLowGUID() && team->m_memberCount == 1) { team->Destroy(); return; } if(team->m_leader == _player->GetLowGUID()) { SystemMessage("You cannot leave the team yet, promote someone else to captain first."); return; } if(team->RemoveMember(_player->m_playerInfo)) { char buffer[1024]; WorldPacket* data; snprintf(buffer, 1024, "%s left the arena team, '%s'.", _player->GetName(), team->m_name.c_str()); data = sChatHandler.FillSystemMessageData(buffer); team->SendPacket(data); delete data; SystemMessage("You have left the arena team, '%s'.", 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 || 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()); } }