本文整理汇总了C++中PlayerbotAI::GetBot方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerbotAI::GetBot方法的具体用法?C++ PlayerbotAI::GetBot怎么用?C++ PlayerbotAI::GetBot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerbotAI
的用法示例。
在下文中一共展示了PlayerbotAI::GetBot方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessBot
bool RandomPlayerbotMgr::ProcessBot(uint32 bot)
{
uint32 isValid = GetEventValue(bot, "add");
if (!isValid)
{
Player* player = GetPlayerBot(bot);
if (!player || !player->GetGroup())
{
sLog.outDetail("Bot %d expired", bot);
SetEventValue(bot, "add", 0, 0);
}
return true;
}
if (!GetPlayerBot(bot))
{
sLog.outDetail("Bot %d logged in", bot);
AddPlayerBot(bot, 0);
if (!GetEventValue(bot, "online"))
{
SetEventValue(bot, "online", 1, sPlayerbotAIConfig.minRandomBotInWorldTime);
}
return true;
}
Player* player = GetPlayerBot(bot);
if (!player)
return false;
PlayerbotAI* ai = player->GetPlayerbotAI();
if (!ai)
return false;
if (player->GetGroup())
{
sLog.outDetail("Skipping bot %d as it is in group", bot);
return false;
}
if (player->IsDead())
{
if (!GetEventValue(bot, "dead"))
{
sLog.outDetail("Setting dead flag for bot %d", bot);
uint32 randomTime = urand(sPlayerbotAIConfig.minRandomBotReviveTime, sPlayerbotAIConfig.maxRandomBotReviveTime);
SetEventValue(bot, "dead", 1, randomTime);
SetEventValue(bot, "revive", 1, randomTime - 60);
return false;
}
if (!GetEventValue(bot, "revive"))
{
sLog.outDetail("Reviving dead bot %d", bot);
SetEventValue(bot, "dead", 0, 0);
SetEventValue(bot, "revive", 0, 0);
RandomTeleport(player, player->GetMapId(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
return true;
}
return false;
}
uint32 randomize = GetEventValue(bot, "randomize");
if (!randomize)
{
sLog.outDetail("Randomizing bot %d", bot);
Randomize(player);
uint32 randomTime = urand(sPlayerbotAIConfig.minRandomBotRandomizeTime, sPlayerbotAIConfig.maxRandomBotRandomizeTime);
ScheduleRandomize(bot, randomTime);
return true;
}
uint32 logout = GetEventValue(bot, "logout");
if (!logout)
{
sLog.outDetail("Logging out bot %d", bot);
LogoutPlayerBot(bot);
SetEventValue(bot, "logout", 1, sPlayerbotAIConfig.maxRandomBotInWorldTime);
return true;
}
uint32 teleport = GetEventValue(bot, "teleport");
if (!teleport)
{
sLog.outDetail("Random teleporting bot %d", bot);
RandomTeleportForLevel(ai->GetBot());
SetEventValue(bot, "teleport", 1, sPlayerbotAIConfig.maxRandomBotInWorldTime);
return true;
}
return false;
}
示例2: ProcessBot
bool RandomPlayerbotMgr::ProcessBot(uint32 bot)
{
uint32 isValid = GetEventValue(bot, "add");
if (!isValid)
{
Player* player = GetPlayerBot(bot);
if (!player || !player->GetGroup())
{
sLog->outMessage("playerbot", LOG_LEVEL_INFO, "Bot %d expired", bot);
SetEventValue(bot, "add", 0, 0);
}
return true;
}
if (!GetPlayerBot(bot))
{
sLog->outMessage("playerbot", LOG_LEVEL_INFO, "Bot %d logged in", bot);
AddPlayerBot(bot, 0);
if (!GetEventValue(bot, "online"))
{
SetEventValue(bot, "online", 1, sPlayerbotAIConfig.minRandomBotInWorldTime);
}
return true;
}
Player* player = GetPlayerBot(bot);
if (!player)
return false;
PlayerbotAI* ai = player->GetPlayerbotAI();
if (!ai)
return false;
if (player->GetGroup())
{
sLog->outMessage("playerbot", LOG_LEVEL_INFO, "Skipping bot %d as it is in group", bot);
return false;
}
if (player->isDead())
{
if (!GetEventValue(bot, "dead"))
{
sLog->outMessage("playerbot", LOG_LEVEL_INFO, "Setting dead flag for bot %d", bot);
uint32 randomTime = urand(sPlayerbotAIConfig.minRandomBotReviveTime, sPlayerbotAIConfig.maxRandomBotReviveTime);
SetEventValue(bot, "dead", 1, randomTime);
SetEventValue(bot, "revive", 1, randomTime - 60);
return false;
}
if (!GetEventValue(bot, "revive"))
{
sLog->outMessage("playerbot", LOG_LEVEL_INFO, "Reviving dead bot %d", bot);
SetEventValue(bot, "dead", 0, 0);
SetEventValue(bot, "revive", 0, 0);
RandomTeleport(player, player->GetMapId(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
return true;
}
return false;
}
if (player->GetGuild() && player->GetGuild()->GetLeaderGUID() == player->GetGUID())
{
for (vector<Player*>::iterator i = players.begin(); i != players.end(); ++i)
sGuildTaskMgr.Update(*i, player);
}
uint32 randomize = GetEventValue(bot, "randomize");
if (!randomize)
{
sLog->outMessage("playerbot", LOG_LEVEL_INFO, "Randomizing bot %d", bot);
Randomize(player);
uint32 randomTime = urand(sPlayerbotAIConfig.minRandomBotRandomizeTime, sPlayerbotAIConfig.maxRandomBotRandomizeTime);
ScheduleRandomize(bot, randomTime);
return true;
}
uint32 logout = GetEventValue(bot, "logout");
if (!logout)
{
sLog->outMessage("playerbot", LOG_LEVEL_INFO, "Logging out bot %d", bot);
LogoutPlayerBot(bot);
SetEventValue(bot, "logout", 1, sPlayerbotAIConfig.maxRandomBotInWorldTime);
return true;
}
uint32 teleport = GetEventValue(bot, "teleport");
if (!teleport)
{
sLog->outMessage("playerbot", LOG_LEVEL_INFO, "Random teleporting bot %d", bot);
RandomTeleportForLevel(ai->GetBot());
SetEventValue(bot, "teleport", 1, sPlayerbotAIConfig.maxRandomBotInWorldTime);
return true;
}
return false;
}