当前位置: 首页>>代码示例>>C++>>正文


C++ ArenaTeam::GetPlayersPerTeam方法代码示例

本文整理汇总了C++中ArenaTeam::GetPlayersPerTeam方法的典型用法代码示例。如果您正苦于以下问题:C++ ArenaTeam::GetPlayersPerTeam方法的具体用法?C++ ArenaTeam::GetPlayersPerTeam怎么用?C++ ArenaTeam::GetPlayersPerTeam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ArenaTeam的用法示例。


在下文中一共展示了ArenaTeam::GetPlayersPerTeam方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: HandleArenaTeamDisbandOpcode

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();
}
开发者ID:pfchrono,项目名称:rs-ascent,代码行数:29,代码来源:ArenaTeam.cpp

示例2: HandleArenaTeamRemoveMemberOpcode

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());
	}
}
开发者ID:pfchrono,项目名称:rs-ascent,代码行数:54,代码来源:ArenaTeam.cpp

示例3: HandleArenaTeamPromoteOpcode

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);
}
开发者ID:pfchrono,项目名称:rs-ascent,代码行数:49,代码来源:ArenaTeam.cpp

示例4: HandleArenaTeamLeaveOpcode

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);
}
开发者ID:pfchrono,项目名称:rs-ascent,代码行数:41,代码来源:ArenaTeam.cpp

示例5: HandleArenaTeamAddMemberOpcode

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);
}
开发者ID:pfchrono,项目名称:rs-ascent,代码行数:66,代码来源:ArenaTeam.cpp


注:本文中的ArenaTeam::GetPlayersPerTeam方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。