本文整理汇总了C++中PlayerbotAI::ResetStrategies方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerbotAI::ResetStrategies方法的具体用法?C++ PlayerbotAI::ResetStrategies怎么用?C++ PlayerbotAI::ResetStrategies使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerbotAI
的用法示例。
在下文中一共展示了PlayerbotAI::ResetStrategies方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnPlayerLogin
void RandomPlayerbotMgr::OnPlayerLogin(Player* player)
{
for (PlayerBotMap::const_iterator it = GetPlayerBotsBegin(); it != GetPlayerBotsEnd(); ++it)
{
Player* const bot = it->second;
if (player == bot || player->GetPlayerbotAI())
continue;
Group* group = bot->GetGroup();
if (!group)
continue;
for (GroupReference *gref = group->GetFirstMember(); gref; gref = gref->next())
{
Player* member = gref->getSource();
PlayerbotAI* ai = bot->GetPlayerbotAI();
if (member == player && (!ai->GetMaster() || ai->GetMaster()->GetPlayerbotAI()))
{
ai->SetMaster(player);
ai->ResetStrategies();
ai->TellMaster("Hello");
break;
}
}
}
if (!player->GetPlayerbotAI())
players.push_back(player);
}
示例2: DoNextAction
void PlayerbotAI::DoNextAction()
{
if (bot->IsBeingTeleported() /*|| bot->IsBeingTeleportedDelayEvent()*/|| (GetMaster() && GetMaster()->IsBeingTeleported()))
return;
currentEngine->DoNextAction(NULL);
/*if (!bot->GetAurasByType(SPELL_AURA_MOD_FLIGHT_SPEED_MOUNTED).empty())
{
bot->m_movementInfo.SetMovementFlags((MovementFlags)(MOVEFLAG_FLYING|MOVEFLAG_CAN_FLY));
WorldPacket packet(CMSG_MOVE_SET_FLY);
packet << bot->GetObjectGuid().WriteAsPacked();
packet << bot->m_movementInfo;
bot->SetMover(bot);
bot->GetSession()->HandleMovementOpcodes(packet);
}*/
Player* master = GetMaster();
if (bot->IsMounted() && bot->IsFlying())
{
bot->m_movementInfo.SetMovementFlags((MovementFlags)(MOVEFLAG_FLYING|MOVEFLAG_CAN_FLY));
//bot->SetSpeedRate(MOVE_FLIGHT, 1.0f, true);
bot->SetSpeedRate(MOVE_RUN, 1.0f, true);
if (master)
{
//bot->SetSpeedRate(MOVE_FLIGHT, master->GetSpeedRate(MOVE_FLIGHT), true);
//bot->SetSpeedRate(MOVE_RUN, master->GetSpeedRate(MOVE_FLIGHT), true);
}
}
if (currentEngine != engines[BOT_STATE_DEAD] && !bot->IsAlive())
ChangeEngine(BOT_STATE_DEAD);
if (currentEngine == engines[BOT_STATE_DEAD] && bot->IsAlive())
ChangeEngine(BOT_STATE_NON_COMBAT);
Group *group = bot->GetGroup();
if (!master && group)
{
for (GroupReference *gref = group->GetFirstMember(); gref; gref = gref->next())
{
Player* member = gref->getSource();
PlayerbotAI* ai = bot->GetPlayerbotAI();
if (member && member->IsInWorld() && !member->GetPlayerbotAI() && (!master || master->GetPlayerbotAI()))
{
ai->SetMaster(member);
ai->ResetStrategies();
ai->TellMaster("Hello");
break;
}
}
}
}
示例3: OnPlayerLogout
void RandomPlayerbotMgr::OnPlayerLogout(Player* player)
{
for (PlayerBotMap::const_iterator it = GetPlayerBotsBegin(); it != GetPlayerBotsEnd(); ++it)
{
Player* const bot = it->second;
PlayerbotAI* ai = bot->GetPlayerbotAI();
if (player == ai->GetMaster())
{
ai->SetMaster(NULL);
ai->ResetStrategies();
}
}
if (!player->GetPlayerbotAI())
{
vector<Player*>::iterator i = find(players.begin(), players.end(), player);
if (i != players.end())
players.erase(i);
}
}