本文整理汇总了C++中ArenaTeam::IsMember方法的典型用法代码示例。如果您正苦于以下问题:C++ ArenaTeam::IsMember方法的具体用法?C++ ArenaTeam::IsMember怎么用?C++ ArenaTeam::IsMember使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArenaTeam
的用法示例。
在下文中一共展示了ArenaTeam::IsMember方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleArenaCaptainCommand
static bool HandleArenaCaptainCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
char* idStr;
char* nameStr;
handler->extractOptFirstArg((char*)args, &idStr, &nameStr);
if (!idStr)
return false;
uint32 teamId = atoi(idStr);
if (!teamId)
return false;
Player* target;
ObjectGuid targetGuid;
if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid))
return false;
ArenaTeam* arena = sArenaTeamMgr->GetArenaTeamById(teamId);
if (!arena)
{
handler->PSendSysMessage(LANG_ARENA_ERROR_NOT_FOUND, teamId);
handler->SetSentErrorMessage(true);
return false;
}
if (!target)
{
handler->PSendSysMessage(LANG_PLAYER_NOT_EXIST_OR_OFFLINE, nameStr);
handler->SetSentErrorMessage(true);
return false;
}
if (arena->IsFighting())
{
handler->SendSysMessage(LANG_ARENA_ERROR_COMBAT);
handler->SetSentErrorMessage(true);
return false;
}
if (!arena->IsMember(targetGuid))
{
handler->PSendSysMessage(LANG_ARENA_ERROR_NOT_MEMBER, nameStr, arena->GetName().c_str());
handler->SetSentErrorMessage(true);
return false;
}
if (arena->GetCaptain() == targetGuid)
{
handler->PSendSysMessage(LANG_ARENA_ERROR_CAPTAIN, nameStr, arena->GetName().c_str());
handler->SetSentErrorMessage(true);
return false;
}
arena->SetCaptain(targetGuid);
CharacterNameData const* oldCaptainNameData = sWorld->GetCharacterNameData(arena->GetCaptain());
if (!oldCaptainNameData)
{
handler->SetSentErrorMessage(true);
return false;
}
handler->PSendSysMessage(LANG_ARENA_CAPTAIN, arena->GetName().c_str(), arena->GetId(), oldCaptainNameData->m_name.c_str(), target->GetName().c_str());
if (handler->GetSession())
TC_LOG_DEBUG("bg.arena", "GameMaster: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team \"%s\"[Id: %u]",
handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUID().GetCounter(), target->GetName().c_str(), target->GetGUID().GetCounter(), arena->GetName().c_str(), arena->GetId());
else
TC_LOG_DEBUG("bg.arena", "Console: promoted player: %s [GUID: %u] to leader of arena team \"%s\"[Id: %u]",
target->GetName().c_str(), target->GetGUID().GetCounter(), arena->GetName().c_str(), arena->GetId());
return true;
}