Example #1
0
void WorldSession::HandleArenaTeamDisbandOpcode(WorldPacket & recv_data)
{
	ArenaTeam * team;
	uint32 teamId;
	recv_data >> teamId;

	team = objmgr.GetArenaTeamById(teamId);
	if(!team)
	{
		SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_INTERNAL);
		return;
	}

	if( (team = _player->m_playerInfo->arenaTeam[team->m_type]) == NULL )
	{
		SendNotInArenaTeamPacket(uint8(team->GetPlayersPerTeam()));
		return;
	}

	if(team->m_leader != _player->GetLowGUID())
	{
		SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS);
		return;
	}

	team->SendArenaTeamEventPacket(ERR_ARENA_TEAM_DISBANDED, 2, _player->GetName(), team->m_name, "");

	team->Destroy();
}
Example #2
0
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());
	}
}
Example #3
0
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);
}
Example #4
0
void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recv_data)
{
	ArenaTeam * team;
	uint32 teamId;
	recv_data >> teamId;

	team = objmgr.GetArenaTeamById(teamId);

	if(!team)
	{
		SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_INTERNAL);
		return;
	}

	if( (team = _player->m_playerInfo->arenaTeam[team->m_type]) == NULL )
	{
		SendNotInArenaTeamPacket(uint8(team->GetPlayersPerTeam()));
		return;
	}

	if(team->m_leader == _player->GetLowGUID())
	{
		if( team->m_memberCount > 1 )
		{
			SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAM_LEADER_LEAVE);
			return;
		}
		else if( team->m_memberCount == 1 )
		{
			team->Destroy();
			return;
		}
	}

	if(team->RemoveMember(_player->m_playerInfo))
	{
		team->SendArenaTeamEventPacket(ERR_ARENA_TEAM_LEAVE, 2, _player->GetName(), team->m_name, "");
	}

	SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, team->m_name, "", 0);
}
Example #5
0
void WorldSession::HandleArenaTeamInviteAcceptOpcode(WorldPacket & recv_data)
{
	ArenaTeam * team;

	if(_player->m_arenateaminviteguid == 0)
	{
		SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_INTERNAL);
		return;
	}

	team = objmgr.GetArenaTeamById(_player->m_arenateaminviteguid);
	_player->m_arenateaminviteguid=0;
	if(team == 0)
	{
		return;
	}

	if(team->m_memberCount >= team->m_slots)
	{
		SystemMessage("That team is now full.");
		return;
	}

	if(_player->m_playerInfo->arenaTeam[team->m_type] != NULL)		/* shouldn't happen */
	{
		SendArenaTeamCommandResult(ERR_ARENA_TEAM_JOIN, "", "", ERR_ALREADY_IN_ARENA_TEAM);
		return;
	}

	if(team->AddMember(_player->m_playerInfo))
	{
		team->SendArenaTeamEventPacket(ERR_ARENA_TEAM_JOIN, 2, _player->GetName(), team->m_name);
	}
	else
	{
		SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_INTERNAL);
	}
}