本文整理汇总了C++中Battlefield类的典型用法代码示例。如果您正苦于以下问题:C++ Battlefield类的具体用法?C++ Battlefield怎么用?C++ Battlefield使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Battlefield类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleBattlefieldTimer
static bool HandleBattlefieldTimer(ChatHandler* handler, const char* args)
{
uint32 battleid = 0;
uint32 time = 0;
char* battleid_str = strtok((char*)args, " ");
if (!battleid_str)
return false;
char* time_str = strtok(NULL, " ");
if (!time_str)
return false;
battleid = atoi(battleid_str);
time = atoi(time_str);
Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid);
if (!bf)
return false;
bf->SetTimer(time * IN_MILLISECONDS);
bf->SendInitWorldStatesToAll();
if (battleid == 1)
handler->SendGlobalGMSysMessage("Wintergrasp (Command timer used)");
return true;
}
示例2: TC_LOG_ERROR
//Send by client on clicking in accept or refuse of invitation windows for join game
void WorldSession::HandleBfEntryInviteResponse(WorldPacket& recvData)
{
uint8 accepted;
ObjectGuid guid;
guid[0] = recvData.ReadBit();
guid[7] = recvData.ReadBit();
accepted = recvData.ReadBit();
guid[4] = recvData.ReadBit();
guid[3] = recvData.ReadBit();
guid[1] = recvData.ReadBit();
guid[6] = recvData.ReadBit();
guid[2] = recvData.ReadBit();
guid[5] = recvData.ReadBit();
recvData.ReadByteSeq(guid[1]);
recvData.ReadByteSeq(guid[6]);
recvData.ReadByteSeq(guid[2]);
recvData.ReadByteSeq(guid[5]);
recvData.ReadByteSeq(guid[3]);
recvData.ReadByteSeq(guid[4]);
recvData.ReadByteSeq(guid[7]);
recvData.ReadByteSeq(guid[0]);
TC_LOG_ERROR("misc", "HandleBattlefieldInviteResponse: GUID:"UI64FMTD" Accepted:%u", (uint64)guid, accepted);
Battlefield* bf = sBattlefieldMgr->GetBattlefieldByGUID(guid);
if (!bf)
return;
if (accepted)
bf->PlayerAcceptInviteToWar(_player);
else if (_player->GetZoneId() == bf->GetZoneId())
bf->KickPlayerFromBattlefield(_player->GetGUID());
}
示例3: BattlefieldWG
void BattlefieldMgr::InitBattlefield()
{
Battlefield* wg = new BattlefieldWG();
// respawn, init variables
if (!wg->SetupBattlefield())
{
TC_LOG_INFO("bg.battlefield", "Battlefield: Wintergrasp init failed.");
delete wg;
}
else
{
_battlefieldSet.push_back(wg);
TC_LOG_INFO("bg.battlefield", "Battlefield: Wintergrasp successfully initiated.");
}
/*
For Cataclysm: Tol Barad
Battlefield* tb = new BattlefieldTB;
// respawn, init variables
if (!tb->SetupBattlefield())
{
TC_LOG_DEBUG("bg.battlefield", "Battlefield: Tol Barad init failed.");
delete tb;
}
else
{
_battlefieldSet.push_back(tb);
TC_LOG_DEBUG("bg.battlefield", "Battlefield: Tol Barad successfully initiated.");
}
*/
}
示例4: InitBattlefield
void BattlefieldMgr::InitBattlefield()
{
Battlefield* pBf = new BattlefieldWG;
// respawn, init variables
if (!pBf->SetupBattlefield())
{
sLog->outString();
sLog->outString("Battlefield : Wintergrasp init failed.");
delete pBf;
}
else
{
m_BattlefieldSet.push_back(pBf);
sLog->outString();
sLog->outString("Battlefield : Wintergrasp successfully initiated.");
}
/* For Cataclysm: Tol Barad
pBf = new BattlefieldTB;
// respawn, init variables
if(!pBf->SetupBattlefield())
{
;//sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Battlefield : Tol Barad init failed.");
delete pBf;
}
else
{
m_BattlefieldSet.push_back(pBf);
;//sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Battlefield : Tol Barad successfully initiated.");
} */
}
示例5: TC_LOG_ERROR
//Send by client when he click on accept for queue
void WorldSession::HandleBfQueueInviteResponse(WorldPacket& recvData)
{
uint8 accepted;
ObjectGuid guid;
guid[2] = recvData.ReadBit();
guid[0] = recvData.ReadBit();
guid[4] = recvData.ReadBit();
guid[3] = recvData.ReadBit();
guid[5] = recvData.ReadBit();
guid[7] = recvData.ReadBit();
accepted = recvData.ReadBit();
guid[1] = recvData.ReadBit();
guid[6] = recvData.ReadBit();
recvData.ReadByteSeq(guid[1]);
recvData.ReadByteSeq(guid[3]);
recvData.ReadByteSeq(guid[2]);
recvData.ReadByteSeq(guid[4]);
recvData.ReadByteSeq(guid[6]);
recvData.ReadByteSeq(guid[7]);
recvData.ReadByteSeq(guid[0]);
recvData.ReadByteSeq(guid[5]);
TC_LOG_ERROR(LOG_FILTER_GENERAL, "HandleQueueInviteResponse: GUID:"UI64FMTD" Accepted:%u", (uint64)guid, accepted);
Battlefield* bf = sBattlefieldMgr->GetBattlefieldByGUID(guid);
if (!bf)
return;
if (accepted)
bf->PlayerAcceptInviteToQueue(_player);
}
示例6: TC_LOG_ERROR
/**
* @fn void WorldSession::HandleBfExitRequest(WorldPacket& recvData)
*
* @brief Send by client when exited battlefield
*/
void WorldSession::HandleBfExitRequest(WorldPacket& recvData)
{
ObjectGuid guid;
guid[2] = recvData.ReadBit();
guid[0] = recvData.ReadBit();
guid[3] = recvData.ReadBit();
guid[7] = recvData.ReadBit();
guid[4] = recvData.ReadBit();
guid[5] = recvData.ReadBit();
guid[6] = recvData.ReadBit();
guid[1] = recvData.ReadBit();
recvData.ReadByteSeq(guid[5]);
recvData.ReadByteSeq(guid[2]);
recvData.ReadByteSeq(guid[0]);
recvData.ReadByteSeq(guid[1]);
recvData.ReadByteSeq(guid[4]);
recvData.ReadByteSeq(guid[3]);
recvData.ReadByteSeq(guid[7]);
recvData.ReadByteSeq(guid[6]);
TC_LOG_ERROR("misc", "HandleBfExitRequest: GUID: %s", guid.ToString().c_str());
Battlefield* bf = sBattlefieldMgr->GetBattlefieldByGUID(guid);
if (!bf)
return;
bf->AskToLeaveQueue(_player);
}
示例7: OnConditionCheck
bool OnConditionCheck(Condition const* /* condition */, ConditionSourceInfo& /* sourceInfo */)
{
Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
if (wintergrasp->IsEnabled() && wintergrasp->GetDefenderTeam() == TEAM_ALLIANCE)
return true;
return false;
}
示例8: HandleBattlefieldEnable
static bool HandleBattlefieldEnable(ChatHandler* handler, const char* args)
{
uint32 battleid = 0;
char* battleid_str = strtok((char*)args, " ");
if (!battleid_str)
return false;
battleid = atoi(battleid_str);
Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid);
if (!bf)
return false;
if (bf->IsEnabled())
{
bf->ToggleBattlefield(false);
if (battleid == 1)
handler->SendGlobalGMSysMessage("Wintergrasp is disabled");
}
else
{
bf->ToggleBattlefield(true);
if (battleid == 1)
handler->SendGlobalGMSysMessage("Wintergrasp is enabled");
}
return true;
}
示例9: HandlePeriodicDummy
void HandlePeriodicDummy(AuraEffect const* /*aurEff*/)
{
Unit* target = GetTarget();
Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(target->GetZoneId());
bool enable = !Bf || !Bf->IsWarTime();
target->SetPhaseMask(enable ? 1 : 512, true);
PreventDefaultAction();
}
示例10: OnCheck
bool OnCheck(Player* /*source*/, Unit* /*target*/)
{
Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
if (!wintergrasp)
return false;
return wintergrasp->GetTimer() >= (20 * MINUTE * IN_MILLISECONDS);
}
示例11: HandleBfQueueExitRequest
/**
* @fn void WorldSession::HandleBfExitRequest(WorldPackets::Battlefield::BFMgrQueueExitRequest& bfMgrQueueExitRequest)
*
* @brief Send by client when exited battlefield
*/
void WorldSession::HandleBfQueueExitRequest(WorldPackets::Battlefield::BFMgrQueueExitRequest& bfMgrQueueExitRequest)
{
Battlefield* bf = sBattlefieldMgr->GetBattlefieldByQueueId(bfMgrQueueExitRequest.QueueID);
if (!bf)
return;
bf->AskToLeaveQueue(_player);
}
示例12: HandleBfExitRequest
void WorldSession::HandleBfExitRequest(WorldPacket& recvData)
{
sLog->outError(LOG_FILTER_GENERAL, "HandleBfExitRequest");
Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId());
if (bf)
bf->KickPlayerFromBattlefield(_player->GetGUID());
}
示例13: HandleBfQueueInviteResponse
/**
* @fn void WorldSession::HandleBfQueueInviteResponse(WorldPackets::Battlefield::BFMgrQueueInviteResponse& bfMgrQueueInviteResponse)
*
* @brief Send by client when he click on accept for queue.
*/
void WorldSession::HandleBfQueueInviteResponse(WorldPackets::Battlefield::BFMgrQueueInviteResponse& bfMgrQueueInviteResponse)
{
Battlefield* bf = sBattlefieldMgr->GetBattlefieldByQueueId(bfMgrQueueInviteResponse.QueueID);
if (!bf)
return;
if (bfMgrQueueInviteResponse.AcceptedInvite)
bf->PlayerAcceptInviteToQueue(_player);
}
示例14: HandleScript
void HandleScript(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
Player* target = GetHitPlayer();
Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
if (!wintergrasp || !target || target->getLevel() < 75 || (wintergrasp->GetDefenderTeam() != target->GetTeamId()))
return;
target->CastSpell(target, SPELL_TELEPORT_TO_FORTRESS, true);
}
示例15: HandleBfExitRequest
void WorldSession::HandleBfExitRequest(WorldPacket & recv_data)
{
uint32 BattleId;
recv_data >> BattleId;
sLog->outDebug(LOG_FILTER_BATTLEFIELD, "HandleBfExitRequest: BattleID:%u ", BattleId);
Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId);
if (!Bf)
return;
Bf->AskToLeaveQueue(_player);
}