本文整理汇总了C++中ArenaTeam::Disband方法的典型用法代码示例。如果您正苦于以下问题:C++ ArenaTeam::Disband方法的具体用法?C++ ArenaTeam::Disband怎么用?C++ ArenaTeam::Disband使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArenaTeam
的用法示例。
在下文中一共展示了ArenaTeam::Disband方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleArenaTeamDisbandOpcode
void WorldSession::HandleArenaTeamDisbandOpcode(WorldPacket & recv_data)
{
sLog.outDebug("CMSG_ARENA_TEAM_DISBAND");
CHECK_PACKET_SIZE(recv_data, 4);
uint32 ArenaTeamId; // arena team id
recv_data >> ArenaTeamId;
if (GetPlayer()->InArena())
return;
ArenaTeam *at = sObjectMgr.GetArenaTeamById(ArenaTeamId);
if (!at)
return;
if (at->GetCaptain() != _player->GetGUID())
return;
if (at->IsFighting())
return;
at->Disband(this);
delete at;
}
示例2: 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;
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);
}
示例3: HandleArenaTeamDisbandOpcode
void WorldSession::HandleArenaTeamDisbandOpcode(WorldPacket & recv_data)
{
sLog.outDebug("CMSG_ARENA_TEAM_DISBAND");
//recv_data.hexlike();
CHECK_PACKET_SIZE(recv_data, 4);
uint32 ArenaTeamId; // arena team id
recv_data >> ArenaTeamId;
ArenaTeam *at = objmgr.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;
}
at->Disband(this);
delete at;
}
示例4: HandleArenaTeamLeaveOpcode
void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recv_data)
{
sLog.outDebug("CMSG_ARENA_TEAM_LEAVE");
uint32 ArenaTeamId; // arena team id
recv_data >> ArenaTeamId;
ArenaTeam *at = objmgr.GetArenaTeamById(ArenaTeamId);
if(!at)
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);
//send you are no longer member of team
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, at->GetName(), "", 0);
}
示例5: LoadArenaTeams
void ArenaTeamMgr::LoadArenaTeams()
{
uint32 oldMSTime = getMSTime();
// Clean out the trash before loading anything
CharacterDatabase.Execute("DELETE FROM arena_team_member WHERE arenaTeamId NOT IN (SELECT arenaTeamId FROM arena_team)"); // One-time query
// 0 1 2 3 4 5 6 7 8
QueryResult result = CharacterDatabase.Query("SELECT arenaTeamId, name, captainGuid, type, backgroundColor, emblemStyle, emblemColor, borderStyle, borderColor, "
// 9 10 11 12 13 14
"rating, weekGames, weekWins, seasonGames, seasonWins, rank FROM arena_team ORDER BY arenaTeamId ASC");
if (!result)
{
sLog->outString(">> Loaded 0 arena teams. DB table `arena_team` is empty!");
sLog->outString();
return;
}
QueryResult result2 = CharacterDatabase.Query(
// 0 1 2 3 4 5 6 7 8 9 10
"SELECT arenaTeamId, atm.guid, atm.weekGames, atm.weekWins, atm.seasonGames, atm.seasonWins, c.name, class, personalRating, matchMakerRating, maxMMR FROM arena_team_member atm"
" INNER JOIN arena_team ate USING (arenaTeamId)"
" LEFT JOIN characters AS c ON atm.guid = c.guid"
" LEFT JOIN character_arena_stats AS cas ON c.guid = cas.guid AND (cas.slot = 0 AND ate.type = 2 OR cas.slot = 1 AND ate.type = 3 OR cas.slot = 2 AND ate.type = 5)"
" ORDER BY atm.arenateamid ASC");
uint32 count = 0;
do
{
ArenaTeam* newArenaTeam = new ArenaTeam;
if (!newArenaTeam->LoadArenaTeamFromDB(result) || !newArenaTeam->LoadMembersFromDB(result2))
{
newArenaTeam->Disband(NULL);
delete newArenaTeam;
continue;
}
AddArenaTeam(newArenaTeam);
++count;
}
while (result->NextRow());
sLog->outString(">> Loaded %u arena teams in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
示例6: 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);
}
示例7: 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);
}
示例8: 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);
}
示例9: 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;
}