Is in real guild function

This commit is contained in:
郑佩茹
2022-09-22 16:46:39 -06:00
parent c2553dff76
commit fccfcb7266
3 changed files with 19 additions and 6 deletions

View File

@@ -26,6 +26,7 @@
#include "SpellAuraEffects.h" #include "SpellAuraEffects.h"
#include "UpdateTime.h" #include "UpdateTime.h"
#include "Vehicle.h" #include "Vehicle.h"
#include "GuildMgr.h"
std::vector<std::string>& split(std::string const s, char delim, std::vector<std::string>& elems); std::vector<std::string>& split(std::string const s, char delim, std::vector<std::string>& elems);
std::vector<std::string> split(std::string const s, char delim); std::vector<std::string> split(std::string const s, char delim);
@@ -241,8 +242,6 @@ void PlayerbotAI::UpdateAI(uint32 elapsed, bool minimal)
} }
bool min = minimal; bool min = minimal;
if (HasRealPlayerMaster())
min = false;
UpdateAIInternal(elapsed, min); UpdateAIInternal(elapsed, min);
@@ -250,6 +249,9 @@ void PlayerbotAI::UpdateAI(uint32 elapsed, bool minimal)
if (bot && !inCombat) if (bot && !inCombat)
min = true; min = true;
if (HasRealPlayerMaster())
min = false;
YieldThread(min); YieldThread(min);
} }
@@ -3508,3 +3510,16 @@ bool PlayerbotAI::CanMove()
return bot->GetMotionMaster()->GetCurrentMovementGeneratorType() != FLIGHT_MOTION_TYPE; return bot->GetMotionMaster()->GetCurrentMovementGeneratorType() != FLIGHT_MOTION_TYPE;
} }
bool PlayerbotAI::IsInRealGuild()
{
if (!bot->GetGuildId())
return false;
Guild* guild = sGuildMgr->GetGuildById(bot->GetGuildId());
uint32 leaderAccount = sCharacterCache->GetCharacterAccountIdByGuid(guild->GetLeaderGUID());
if (!leaderAccount)
return false;
return sPlayerbotAIConfig->IsInRandomAccountList(leaderAccount);
}

View File

@@ -366,6 +366,7 @@ class PlayerbotAI : public PlayerbotAIBase
void ResetJumpDestination() { jumpDestination = Position(); } void ResetJumpDestination() { jumpDestination = Position(); }
bool CanMove(); bool CanMove();
bool IsInRealGuild();
private: private:
void _fillGearScoreData(Player* player, Item* item, std::vector<uint32>* gearScore, uint32& twoHandScore); void _fillGearScoreData(Player* player, Item* item, std::vector<uint32>* gearScore, uint32& twoHandScore);

View File

@@ -50,10 +50,7 @@ bool PlayerbotAIBase::CanUpdateAI()
void PlayerbotAIBase::YieldThread(bool delay) void PlayerbotAIBase::YieldThread(bool delay)
{ {
if (nextAICheckDelay < sPlayerbotAIConfig->reactDelay) if (nextAICheckDelay < sPlayerbotAIConfig->reactDelay)
nextAICheckDelay = sPlayerbotAIConfig->reactDelay; nextAICheckDelay = delay ? sPlayerbotAIConfig->reactDelay * 10 : sPlayerbotAIConfig->reactDelay;
if (delay && nextAICheckDelay <= sPlayerbotAIConfig->reactDelay * 10)
nextAICheckDelay = sPlayerbotAIConfig->reactDelay * 10;
} }
bool PlayerbotAIBase::IsActive() bool PlayerbotAIBase::IsActive()