本文整理汇总了C++中ArenaTeam::GetName方法的典型用法代码示例。如果您正苦于以下问题:C++ ArenaTeam::GetName方法的具体用法?C++ ArenaTeam::GetName怎么用?C++ ArenaTeam::GetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArenaTeam
的用法示例。
在下文中一共展示了ArenaTeam::GetName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EndBattleground
void ArenaMap::EndBattleground(BattlegroundWinner winner)
{
BattlegroundMap::EndBattleground(winner);
BattlegroundWinner loser = winner == WINNER_ALLIANCE ? WINNER_HORDE : WINNER_ALLIANCE;
ArenaTeam* winnerTeam = _arenaTeams[winner];
ArenaTeam* loserTeam = _arenaTeams[loser];
if (_rated && winner != WINNER_NONE)
{
uint32 loserTeamRating = loserTeam->GetRating();
uint32 loserMMR = loserTeam->GetAverageMMR(GetGroupForTeam(loser));
uint32 winnerTeamRating = winnerTeam->GetRating();
uint32 winnerMMR = winnerTeam->GetAverageMMR(GetGroupForTeam(winner));
uint32 winnerChange = winnerTeam->WonAgainst(loserMMR);
uint32 loserChange = loserTeam->WonAgainst(winnerMMR);
sLog->outArena("Winner rating: %u, Loser rating: %u, Winner MMR: %u, Loser MMR: %u, Winner change: %d, Loser change: %d",
winnerTeamRating, loserTeamRating, winnerMMR, loserMMR, winnerChange, loserChange);
_arenaTeamScores[winner]->Assign(winnerChange, winnerMMR, winnerTeam->GetName());
_arenaTeamScores[loser]->Assign(loserChange, loserMMR, loserTeam->GetName());
}
// TODO: if WINNER_NONE - remove rating for both parties?
}
示例2: HandleArenaLookupCommand
static bool HandleArenaLookupCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
std::string namepart = args;
std::wstring wnamepart;
if (!Utf8toWStr(namepart, wnamepart))
return false;
wstrToLower(wnamepart);
bool found = false;
ArenaTeamMgr::ArenaTeamContainer::const_iterator i = sArenaTeamMgr->GetArenaTeamMapBegin();
for (; i != sArenaTeamMgr->GetArenaTeamMapEnd(); ++i)
{
ArenaTeam* arena = i->second;
if (Utf8FitTo(arena->GetName(), wnamepart))
{
if (handler->GetSession())
{
handler->PSendSysMessage(LANG_ARENA_LOOKUP, arena->GetName().c_str(), arena->GetId(), arena->GetType(), arena->GetType());
found = true;
continue;
}
}
}
if (!found)
handler->PSendSysMessage(LANG_AREAN_ERROR_NAME_NOT_FOUND, namepart.c_str());
return true;
}
示例3: HandleArenaTeamRemoveFromTeamOpcode
void WorldSession::HandleArenaTeamRemoveFromTeamOpcode(WorldPacket & recv_data)
{
sLog.outDebug("CMSG_ARENA_TEAM_REMOVE_FROM_TEAM");
//recv_data.hexlike();
CHECK_PACKET_SIZE(recv_data, 1+1);
uint8 team_slot;
std::string name;
recv_data >> team_slot;
recv_data >> name;
uint32 at_id = _player->GetArenaTeamId(team_slot);
if(!at_id)
{
// arena team id not found
return;
}
ArenaTeam *at = objmgr.GetArenaTeamById(at_id);
if(!at)
{
// arena team not found
return;
}
uint64 guid = objmgr.GetPlayerGUIDByName(name);
if(!guid)
{
// player guid not found
return;
}
if(at->GetCaptain() == guid)
{
// unsure
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS);
return;
}
if(at->GetCaptain() != _player->GetGUID())
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS);
return;
}
if(at->GetCaptain() == guid)
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_LEADER_LEAVE_S);
return;
}
at->DelMember(guid);
// event
WorldPacket data;
BuildArenaTeamEventPacket(&data, ERR_ARENA_TEAM_REMOVE_SSS, 3, name, at->GetName(), _player->GetName());
at->BroadcastPacket(&data);
}
示例4: HandleArenaTeamInviteAcceptOpcode
void WorldSession::HandleArenaTeamInviteAcceptOpcode(WorldPacket & /*recv_data*/)
{
sLog.outDebug("CMSG_ARENA_TEAM_INVITE_ACCEPT"); // empty opcode
ArenaTeam *at = sObjectMgr.GetArenaTeamById(_player->GetArenaTeamIdInvited());
if (!at)
return;
if (_player->GetArenaTeamIdFromDB(_player->GetGUIDLow(), at->GetType()))
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S,"","",ERR_ALREADY_IN_ARENA_TEAM); // already in arena team that size
return;
}
if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && _player->GetTeam() != sObjectMgr.GetPlayerTeamByGUID(at->GetCaptain()))
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S,"","",ERR_ARENA_TEAM_NOT_ALLIED);// not let enemies sign petition
return;
}
if (!at->AddMember(_player->GetGUID()))
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S,"","",ERR_ARENA_TEAM_INTERNAL);// arena team not found
return;
}
// event
WorldPacket data;
BuildArenaTeamEventPacket(&data, ERR_ARENA_TEAM_JOIN_SS, 2, _player->GetName(), at->GetName(), "");
at->BroadcastPacket(&data);
}
示例5: HandleArenaTeamInviteAcceptOpcode
void WorldSession::HandleArenaTeamInviteAcceptOpcode(WorldPacket & /*recv_data*/)
{
sLog.outDebug("CMSG_ARENA_TEAM_INVITE_ACCEPT"); // empty opcode
ArenaTeam *at = objmgr.GetArenaTeamById(_player->GetArenaTeamIdInvited());
if(!at)
{
// arena team not exist
return;
}
if(_player->GetArenaTeamId(at->GetSlot()))
{
// already in arena team that size
return;
}
// not let enemies sign petition
if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && _player->GetTeam() != objmgr.GetPlayerTeamByGUID(at->GetCaptain()))
return;
if(!at->AddMember(_player->GetGUID()))
return;
// event
WorldPacket data;
BuildArenaTeamEventPacket(&data, ERR_ARENA_TEAM_JOIN_SS, 2, _player->GetName(), at->GetName(), "");
at->BroadcastPacket(&data);
}
示例6: HandleArenaCreateCommand
static bool HandleArenaCreateCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
Player* target;
if (!handler->extractPlayerTarget(*args != '"' ? (char*)args : NULL, &target))
return false;
char* tailStr = *args != '"' ? strtok(NULL, "") : (char*)args;
if (!tailStr)
return false;
char* name = handler->extractQuotedArg(tailStr);
if (!name)
return false;
char* typeStr = strtok(NULL, "");
if (!typeStr)
return false;
int8 type = atoi(typeStr);
if (sArenaTeamMgr->GetArenaTeamByName(name))
{
handler->PSendSysMessage(LANG_ARENA_ERROR_NAME_EXISTS, name);
handler->SetSentErrorMessage(true);
return false;
}
if (type == 2 || type == 3 || type == 5 )
{
if (Player::GetArenaTeamIdFromDB(target->GetGUID(), type) != 0)
{
handler->PSendSysMessage(LANG_ARENA_ERROR_SIZE, target->GetName().c_str());
handler->SetSentErrorMessage(true);
return false;
}
ArenaTeam* arena = new ArenaTeam();
if (!arena->Create(target->GetGUID(), type, name, 4293102085, 101, 4293253939, 4, 4284049911))
{
delete arena;
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
return false;
}
sArenaTeamMgr->AddArenaTeam(arena);
handler->PSendSysMessage(LANG_ARENA_CREATE, arena->GetName().c_str(), arena->GetId(), arena->GetType(), arena->GetCaptain().GetCounter());
}
else
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
return false;
}
return true;
}
示例7: HandleArenaTeamRemoveOpcode
void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket & recvData)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_REMOVE");
#endif
uint32 arenaTeamId;
std::string name;
recvData >> arenaTeamId;
recvData >> name;
// Check for valid arena team
ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId);
if (!arenaTeam)
return;
// Only captain can remove members
if (arenaTeam->GetCaptain() != _player->GetGUID())
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS);
return;
}
if (!normalizePlayerName(name))
return;
// Check if team member exists
ArenaTeamMember* member = arenaTeam->GetMember(name);
if (!member)
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", name, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S);
return;
}
// Captain cannot be removed
if (arenaTeam->GetCaptain() == member->Guid)
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAM_LEADER_LEAVE_S);
return;
}
// Player cannot be removed during fights
if (arenaTeam->IsFighting())
return;
arenaTeam->DelMember(member->Guid, true);
// Broadcast event
arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_REMOVE_SSS, 0, 3, name, arenaTeam->GetName(), _player->GetName());
}
示例8: HandleArenaTeamRemoveFromTeamOpcode
void WorldSession::HandleArenaTeamRemoveFromTeamOpcode(WorldPacket & recv_data)
{
sLog.outDebug("CMSG_ARENA_TEAM_REMOVE_FROM_TEAM");
CHECK_PACKET_SIZE(recv_data, 4+1);
uint32 ArenaTeamId;
std::string name;
recv_data >> ArenaTeamId;
recv_data >> name;
ArenaTeam *at = sObjectMgr.GetArenaTeamById(ArenaTeamId);
if (!at) // arena team not found
return;
if (at->GetCaptain() != _player->GetGUID())
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS);
return;
}
if (!normalizePlayerName(name))
return;
ArenaTeamMember* member = at->GetMember(name);
if (!member) // member not found
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", name, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S);
return;
}
if (at->GetCaptain() == member->guid)
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAM_LEADER_LEAVE_S);
return;
}
Player *player = ObjectAccessor::FindPlayer(member->guid);
if (player && player->InArena())
return;
at->DelMember(member->guid);
// event
WorldPacket data;
BuildArenaTeamEventPacket(&data, ERR_ARENA_TEAM_REMOVE_SSS, 3, name, at->GetName(), _player->GetName());
at->BroadcastPacket(&data);
}
示例9: HandleArenaTeamLeaveOpcode
void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_LEAVE");
time_t now = time(NULL);
if (now - timeLastArenaTeamCommand < 5)
return;
else
timeLastArenaTeamCommand = now;
uint32 arenaTeamId;
recvData >> arenaTeamId;
ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId);
if (!arenaTeam)
return;
// Disallow leave team while in arena
if (_player->InArena())
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAM_CREATED);
return;
}
// Team captain can't leave the team if other members are still present
if (_player->GetGUID() == arenaTeam->GetCaptain() && arenaTeam->GetMembersSize() > 1)
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAM_LEADER_LEAVE_S);
return;
}
// If team consists only of the captain, disband the team
if (_player->GetGUID() == arenaTeam->GetCaptain())
{
arenaTeam->Disband(this);
delete arenaTeam;
return;
}
else
arenaTeam->DelMember(_player->GetGUID(), true);
// Broadcast event
arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_LEAVE_SS, _player->GetGUID(), 2, _player->GetName(), arenaTeam->GetName(), "");
// Inform player who left
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, arenaTeam->GetName(), "", 0);
}
示例10: HandleArenaTeamRemoveOpcode
void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket& recvData)
{
SF_LOG_DEBUG("network", "CMSG_ARENA_TEAM_REMOVE");
uint32 arenaTeamId;
std::string name;
recvData >> arenaTeamId;
recvData >> name;
// Check for valid arena team
ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId);
if (!arenaTeam)
return;
// Only captain can remove members
if (arenaTeam->GetCaptain() != _player->GetGUID())
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS);
return;
}
if (!normalizePlayerName(name))
return;
// Check if team member exists
ArenaTeamMember* member = arenaTeam->GetMember(name);
if (!member)
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", name, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S);
return;
}
// Captain cannot be removed
if (arenaTeam->GetCaptain() == member->Guid)
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAM_LEADER_LEAVE_S);
return;
}
arenaTeam->DelMember(member->Guid, true);
// Broadcast event
arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_REMOVE_SSS, 0, 3, name, arenaTeam->GetName(), _player->GetName());
}
示例11: HandleArenaTeamLeaveOpcode
void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recv_data)
{
sLog.outDebug("CMSG_ARENA_TEAM_LEAVE");
//recv_data.hexlike();
CHECK_PACKET_SIZE(recv_data, 1);
uint8 team_slot; // slot?
recv_data >> team_slot;
uint32 at_id = _player->GetArenaTeamId(team_slot);
if(!at_id) // not in arena team
{
// send command result
return;
}
ArenaTeam *at = objmgr.GetArenaTeamById(at_id);
if(!at)
{
// send command result
return;
}
if(_player->GetGUID() == at->GetCaptain() && at->GetMembersSize() > 1)
{
// check for correctness
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAM_LEADER_LEAVE_S);
return;
}
// arena team has only one member (=captain)
if(_player->GetGUID() == at->GetCaptain())
{
at->Disband(this);
delete at;
return;
}
at->DelMember(_player->GetGUID());
// event
WorldPacket data;
BuildArenaTeamEventPacket(&data, ERR_ARENA_TEAM_LEAVE_SS, 2, _player->GetName(), at->GetName(), "");
at->BroadcastPacket(&data);
//SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, at->GetName(), "", 0);
}
示例12: HandleArenaTeamLeaveOpcode
void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recvData)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_LEAVE");
#endif
uint32 arenaTeamId;
recvData >> arenaTeamId;
ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId);
if (!arenaTeam)
return;
// Disallow leave team while in arena
if (arenaTeam->IsFighting())
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAM_INTERNAL);
return;
}
// Team captain can't leave the team if other members are still present
if (_player->GetGUID() == arenaTeam->GetCaptain() && arenaTeam->GetMembersSize() > 1)
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAM_LEADER_LEAVE_S);
return;
}
// If team consists only of the captain, disband the team
if (_player->GetGUID() == arenaTeam->GetCaptain())
{
arenaTeam->Disband(this);
delete arenaTeam;
return;
}
else
arenaTeam->DelMember(_player->GetGUID(), true);
// Broadcast event
arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_LEAVE_SS, _player->GetGUID(), 2, _player->GetName().c_str(), arenaTeam->GetName(), "");
// Inform player who left
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, arenaTeam->GetName(), "", 0);
}
示例13: HandleArenaTeamRemoveOpcode
void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket & recv_data)
{
DEBUG_LOG("CMSG_ARENA_TEAM_REMOVE");
uint32 ArenaTeamId;
std::string name;
recv_data >> ArenaTeamId;
recv_data >> name;
ArenaTeam *at = sObjectMgr.GetArenaTeamById(ArenaTeamId);
if (!at) // arena team not found
return;
if (at->GetCaptainGuid() != _player->GetObjectGuid())
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS);
return;
}
if (!normalizePlayerName(name))
return;
ArenaTeamMember* member = at->GetMember(name);
if (!member) // member not found
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", name, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S);
return;
}
if (at->GetCaptainGuid() == member->guid)
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAM_LEADER_LEAVE_S);
return;
}
at->DelMember(member->guid);
// event
at->BroadcastEvent(ERR_ARENA_TEAM_REMOVE_SSS, name.c_str(), at->GetName().c_str(), _player->GetName());
}
示例14: HandleArenaTeamLeaveOpcode
void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recv_data)
{
DEBUG_LOG("CMSG_ARENA_TEAM_LEAVE");
uint32 ArenaTeamId; // arena team id
recv_data >> ArenaTeamId;
ArenaTeam *at = sObjectMgr.GetArenaTeamById(ArenaTeamId);
if (!at)
return;
// Disallow leave team while in arena
if (_player->InArena())
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAM_INTERNAL);
return;
}
if (_player->GetObjectGuid() == at->GetCaptainGuid() && at->GetMembersSize() > 1)
{
// check for correctness
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAM_LEADER_LEAVE_S);
return;
}
// arena team has only one member (=captain)
if (_player->GetObjectGuid() == at->GetCaptainGuid())
{
at->Disband(this);
delete at;
return;
}
at->DelMember(_player->GetObjectGuid());
// event
at->BroadcastEvent(ERR_ARENA_TEAM_LEAVE_SS, _player->GetObjectGuid(), _player->GetName(), at->GetName().c_str());
// send you are no longer member of team
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, at->GetName(), "", 0);
}
示例15: HandleArenaDisbandCommand
static bool HandleArenaDisbandCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
uint32 teamId = atoi((char*)args);
if (!teamId)
return false;
ArenaTeam* arena = sArenaTeamMgr->GetArenaTeamById(teamId);
if (!arena)
{
handler->PSendSysMessage(LANG_ARENA_ERROR_NOT_FOUND, teamId);
handler->SetSentErrorMessage(true);
return false;
}
if (arena->IsFighting())
{
handler->SendSysMessage(LANG_ARENA_ERROR_COMBAT);
handler->SetSentErrorMessage(true);
return false;
}
std::string name = arena->GetName();
arena->Disband();
if (handler->GetSession())
TC_LOG_DEBUG("bg.arena", "GameMaster: %s [GUID: %u] disbanded arena team type: %u [Id: %u].",
handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUID().GetCounter(), arena->GetType(), teamId);
else
TC_LOG_DEBUG("bg.arena", "Console: disbanded arena team type: %u [Id: %u].", arena->GetType(), teamId);
delete(arena);
handler->PSendSysMessage(LANG_ARENA_DISBAND, name.c_str(), teamId);
return true;
}