diff --git a/conf/playerbots.conf.dist b/conf/playerbots.conf.dist index 09969ccb..57f5548d 100644 --- a/conf/playerbots.conf.dist +++ b/conf/playerbots.conf.dist @@ -369,8 +369,8 @@ AiPlayerbot.SyncQuestForPlayer = 0 # # -# Bot can flee for enemy -AiPlayerbot.FleeingEnabled = 1 +# Auto add dungeon/raid strategies when entering the instance if implemented +AiPlayerbot.ApplyInstanceStrategies = 1 # Enable auto avoid aoe (experimental) # Default: 1 (enable) @@ -388,6 +388,9 @@ AiPlayerbot.AutoSaveMana = 1 # Default: 60 (60%) AiPlayerbot.SaveManaThreshold = 60 +# Bot can flee for enemy +AiPlayerbot.FleeingEnabled = 1 + # # # diff --git a/src/PlayerbotAI.cpp b/src/PlayerbotAI.cpp index d319b05f..4fb38ed9 100644 --- a/src/PlayerbotAI.cpp +++ b/src/PlayerbotAI.cpp @@ -136,6 +136,8 @@ PlayerbotAI::PlayerbotAI(Player* bot) engines[BOT_STATE_COMBAT] = AiFactory::createCombatEngine(bot, this, aiObjectContext); engines[BOT_STATE_NON_COMBAT] = AiFactory::createNonCombatEngine(bot, this, aiObjectContext); engines[BOT_STATE_DEAD] = AiFactory::createDeadEngine(bot, this, aiObjectContext); + if (sPlayerbotAIConfig->applyInstanceStrategies) + ApplyInstanceStrategies(bot->GetMapId()); currentEngine = engines[BOT_STATE_NON_COMBAT]; currentState = BOT_STATE_NON_COMBAT; @@ -650,10 +652,11 @@ void PlayerbotAI::HandleTeleportAck() bot->GetSession()->HandleMoveWorldportAck(); } SetNextCheckDelay(urand(2000, 5000)); + if (sPlayerbotAIConfig->applyInstanceStrategies) + ApplyInstanceStrategies(bot->GetMapId(), true); } SetNextCheckDelay(sPlayerbotAIConfig->globalCoolDown); - Reset(); } @@ -1487,6 +1490,34 @@ std::vector PlayerbotAI::GetStrategies(BotState type) return e->GetStrategies(); } +void PlayerbotAI::ApplyInstanceStrategies(uint32 mapId, bool tellMaster) +{ + std::string strategyName; + switch (mapId) + { + case 533: + strategyName = "naxx"; + break; + case 603: + strategyName = "uld"; + break; + case 469: + strategyName = "bwl"; + break; + default: + break; + } + + engines[BOT_STATE_COMBAT]->addStrategy(strategyName); + engines[BOT_STATE_NON_COMBAT]->addStrategy(strategyName); + if (tellMaster && !strategyName.empty()) + { + std::ostringstream out; + out << "Add " << strategyName << " instance strategy"; + TellMaster(out.str()); + } +} + bool PlayerbotAI::DoSpecificAction(std::string const name, Event event, bool silent, std::string const qualifier) { std::ostringstream out; @@ -1584,6 +1615,8 @@ void PlayerbotAI::ResetStrategies(bool load) AiFactory::AddDefaultCombatStrategies(bot, this, engines[BOT_STATE_COMBAT]); AiFactory::AddDefaultNonCombatStrategies(bot, this, engines[BOT_STATE_NON_COMBAT]); AiFactory::AddDefaultDeadStrategies(bot, this, engines[BOT_STATE_DEAD]); + if (sPlayerbotAIConfig->applyInstanceStrategies) + ApplyInstanceStrategies(bot->GetMapId()); for (uint8 i = 0; i < BOT_STATE_MAX; i++) engines[i]->Init(); @@ -5736,7 +5769,7 @@ uint32 PlayerbotAI::GetReactDelay() bool isResting = bot->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING); if (!isResting) { - multiplier = urand(5, 20); + multiplier = urand(10, 30); return base * multiplier; } diff --git a/src/PlayerbotAI.h b/src/PlayerbotAI.h index fb76b5cc..61242629 100644 --- a/src/PlayerbotAI.h +++ b/src/PlayerbotAI.h @@ -129,26 +129,25 @@ enum ChatChannelSource SRC_UNDEFINED }; static std::map ChatChannelSourceStr = { - { SRC_GUILD, "SRC_GUILD"}, - { SRC_WORLD, "SRC_WORLD"}, - { SRC_GENERAL, "SRC_GENERAL"}, - { SRC_TRADE, "SRC_TRADE"}, - { SRC_LOOKING_FOR_GROUP, "SRC_LOOKING_FOR_GROUP"}, - { SRC_LOCAL_DEFENSE, "SRC_LOCAL_DEFENSE"}, - { SRC_WORLD_DEFENSE, "SRC_WORLD_DEFENSE"}, - { SRC_GUILD_RECRUITMENT, "SRC_GUILD_RECRUITMENT"}, + {SRC_GUILD, "SRC_GUILD"}, + {SRC_WORLD, "SRC_WORLD"}, + {SRC_GENERAL, "SRC_GENERAL"}, + {SRC_TRADE, "SRC_TRADE"}, + {SRC_LOOKING_FOR_GROUP, "SRC_LOOKING_FOR_GROUP"}, + {SRC_LOCAL_DEFENSE, "SRC_LOCAL_DEFENSE"}, + {SRC_WORLD_DEFENSE, "SRC_WORLD_DEFENSE"}, + {SRC_GUILD_RECRUITMENT, "SRC_GUILD_RECRUITMENT"}, - { SRC_SAY, "SRC_SAY"}, - { SRC_WHISPER, "SRC_WHISPER"}, - { SRC_EMOTE, "SRC_EMOTE"}, - { SRC_TEXT_EMOTE, "SRC_TEXT_EMOTE"}, - { SRC_YELL, "SRC_YELL"}, + {SRC_SAY, "SRC_SAY"}, + {SRC_WHISPER, "SRC_WHISPER"}, + {SRC_EMOTE, "SRC_EMOTE"}, + {SRC_TEXT_EMOTE, "SRC_TEXT_EMOTE"}, + {SRC_YELL, "SRC_YELL"}, - { SRC_PARTY, "SRC_PARTY"}, - { SRC_RAID, "SRC_RAID"}, + {SRC_PARTY, "SRC_PARTY"}, + {SRC_RAID, "SRC_RAID"}, - { SRC_UNDEFINED, "SRC_UNDEFINED"} -}; + {SRC_UNDEFINED, "SRC_UNDEFINED"}}; enum ChatChannelId { GENERAL = 1, @@ -384,16 +383,18 @@ public: std::string const HandleRemoteCommand(std::string const command); void HandleCommand(uint32 type, std::string const text, Player* fromPlayer); void QueueChatResponse(const ChatQueuedReply reply); - void HandleBotOutgoingPacket(WorldPacket const& packet); + void HandleBotOutgoingPacket(WorldPacket const& packet); void HandleMasterIncomingPacket(WorldPacket const& packet); void HandleMasterOutgoingPacket(WorldPacket const& packet); void HandleTeleportAck(); void ChangeEngine(BotState type); void DoNextAction(bool minimal = false); - virtual bool DoSpecificAction(std::string const name, Event event = Event(), bool silent = false, std::string const qualifier = ""); + virtual bool DoSpecificAction(std::string const name, Event event = Event(), bool silent = false, + std::string const qualifier = ""); void ChangeStrategy(std::string const name, BotState type); void ClearStrategies(BotState type); std::vector GetStrategies(BotState type); + void ApplyInstanceStrategies(uint32 mapId, bool tellMaster = false); bool ContainsStrategy(StrategyType type); bool HasStrategy(std::string const name, BotState type); BotState GetState() { return currentState; }; @@ -434,8 +435,10 @@ public: bool TellMaster(std::ostringstream& stream, PlayerbotSecurityLevel securityLevel = PLAYERBOT_SECURITY_ALLOW_ALL); bool TellMaster(std::string const text, PlayerbotSecurityLevel securityLevel = PLAYERBOT_SECURITY_ALLOW_ALL); - bool TellMasterNoFacing(std::ostringstream& stream, PlayerbotSecurityLevel securityLevel = PLAYERBOT_SECURITY_ALLOW_ALL); - bool TellMasterNoFacing(std::string const text, PlayerbotSecurityLevel securityLevel = PLAYERBOT_SECURITY_ALLOW_ALL); + bool TellMasterNoFacing(std::ostringstream& stream, + PlayerbotSecurityLevel securityLevel = PLAYERBOT_SECURITY_ALLOW_ALL); + bool TellMasterNoFacing(std::string const text, + PlayerbotSecurityLevel securityLevel = PLAYERBOT_SECURITY_ALLOW_ALL); bool TellError(std::string const text, PlayerbotSecurityLevel securityLevel = PLAYERBOT_SECURITY_ALLOW_ALL); bool SayToGuild(const std::string& msg); bool SayToWorld(const std::string& msg); @@ -523,12 +526,16 @@ public: bool AllowActive(ActivityType activityType); bool AllowActivity(ActivityType activityType = ALL_ACTIVITY, bool checkNow = false); - //Check if player is safe to use. + // Check if player is safe to use. bool IsSafe(Player* player); bool IsSafe(WorldObject* obj); ChatChannelSource GetChatChannelSource(Player* bot, uint32 type, std::string channelName); - bool HasCheat(BotCheatMask mask) { return ((uint32)mask & (uint32)cheatMask) != 0 || ((uint32)mask & (uint32)sPlayerbotAIConfig->botCheatMask) != 0; } + bool HasCheat(BotCheatMask mask) + { + return ((uint32)mask & (uint32)cheatMask) != 0 || + ((uint32)mask & (uint32)sPlayerbotAIConfig->botCheatMask) != 0; + } BotCheatMask GetCheat() { return cheatMask; } void SetCheat(BotCheatMask mask) { cheatMask = mask; } @@ -561,9 +568,10 @@ public: std::set GetAllCurrentQuestIds(); std::set GetCurrentIncompleteQuestIds(); void PetFollow(); - + private: - static void _fillGearScoreData(Player* player, Item* item, std::vector* gearScore, uint32& twoHandScore, bool mixed = false); + static void _fillGearScoreData(Player* player, Item* item, std::vector* gearScore, uint32& twoHandScore, + bool mixed = false); bool IsTellAllowed(PlayerbotSecurityLevel securityLevel = PLAYERBOT_SECURITY_ALLOW_ALL); void HandleCommands(); @@ -571,8 +579,8 @@ private: protected: Player* bot; - Player* master; - uint32 accountId; + Player* master; + uint32 accountId; AiObjectContext* aiObjectContext; Engine* currentEngine; Engine* engines[BOT_STATE_MAX]; diff --git a/src/PlayerbotAIConfig.cpp b/src/PlayerbotAIConfig.cpp index 7803fafb..41c0360c 100644 --- a/src/PlayerbotAIConfig.cpp +++ b/src/PlayerbotAIConfig.cpp @@ -286,6 +286,7 @@ bool PlayerbotAIConfig::Initialize() randomBotNonCombatStrategies = sConfigMgr->GetOption("AiPlayerbot.RandomBotNonCombatStrategies", ""); combatStrategies = sConfigMgr->GetOption("AiPlayerbot.CombatStrategies", "+custom::say"); nonCombatStrategies = sConfigMgr->GetOption("AiPlayerbot.NonCombatStrategies", "+custom::say,+return"); + applyInstanceStrategies = sConfigMgr->GetOption("AiPlayerbot.ApplyInstanceStrategies", true); commandPrefix = sConfigMgr->GetOption("AiPlayerbot.CommandPrefix", ""); commandSeparator = sConfigMgr->GetOption("AiPlayerbot.CommandSeparator", "\\\\"); @@ -477,11 +478,11 @@ bool PlayerbotAIConfig::Initialize() { return true; } - PlayerbotFactory::Init(); sRandomItemMgr->Init(); sRandomItemMgr->InitAfterAhBot(); sPlayerbotTextMgr->LoadBotTexts(); sPlayerbotTextMgr->LoadBotTextChance(); + PlayerbotFactory::Init(); if (!sPlayerbotAIConfig->autoDoQuests) { diff --git a/src/PlayerbotAIConfig.h b/src/PlayerbotAIConfig.h index e7fd94cd..21dbee67 100644 --- a/src/PlayerbotAIConfig.h +++ b/src/PlayerbotAIConfig.h @@ -184,6 +184,7 @@ public: bool summonAtInnkeepersEnabled; std::string combatStrategies, nonCombatStrategies; std::string randomBotCombatStrategies, randomBotNonCombatStrategies; + bool applyInstanceStrategies; uint32 randomBotMinLevel, randomBotMaxLevel; float randomChangeMultiplier; diff --git a/src/RandomItemMgr.cpp b/src/RandomItemMgr.cpp index 7a62891a..2d9f3d5b 100644 --- a/src/RandomItemMgr.cpp +++ b/src/RandomItemMgr.cpp @@ -949,7 +949,6 @@ void RandomItemMgr::BuildItemInfoCache() PlayerbotsDatabaseTransaction trans = PlayerbotsDatabase.BeginTransaction(); - // generate stat weights for classes/specs for (auto const& itr : *itemTemplate) { ItemTemplate const* proto = &itr.second; @@ -958,11 +957,12 @@ void RandomItemMgr::BuildItemInfoCache() // skip non armor/weapon if (proto->Class != ITEM_CLASS_WEAPON && proto->Class != ITEM_CLASS_ARMOR && - proto->Class != ITEM_CLASS_CONTAINER && proto->Class != ITEM_CLASS_PROJECTILE) + proto->Class != ITEM_CLASS_CONTAINER && proto->Class != ITEM_CLASS_PROJECTILE && + proto->Class != ITEM_CLASS_GEM) continue; - if (!CanEquipItemNew(proto)) - continue; + // if (!CanEquipItemNew(proto)) + // continue; // skip test items if (strstr(proto->Name1.c_str(), "(Test)") || strstr(proto->Name1.c_str(), "(TEST)") || @@ -990,29 +990,29 @@ void RandomItemMgr::BuildItemInfoCache() proto->RequiredReputationRank > 0) continue;*/ - if (proto->RequiredHonorRank > 0 || proto->RequiredSkillRank > 0 || proto->RequiredCityRank > 0) - continue; + // if (proto->RequiredHonorRank > 0 || proto->RequiredSkillRank > 0 || proto->RequiredCityRank > 0) + // continue; - // skip random enchant items - if (proto->RandomProperty) - continue; + // // skip random enchant items + // if (proto->RandomProperty) + // continue; - // skip heirloom items - if (proto->Quality == ITEM_QUALITY_HEIRLOOM) - continue; + // // skip heirloom items + // if (proto->Quality == ITEM_QUALITY_HEIRLOOM) + // continue; - // check possible equip slots - EquipmentSlots slot = EQUIPMENT_SLOT_START; - for (std::map >::iterator i = viableSlots.begin(); - i != viableSlots.end(); ++i) - { - std::set slots = viableSlots[(EquipmentSlots)i->first]; - if (slots.find((InventoryType)proto->InventoryType) != slots.end()) - slot = i->first; - } + // // check possible equip slots + // EquipmentSlots slot = EQUIPMENT_SLOT_START; + // for (std::map >::iterator i = viableSlots.begin(); + // i != viableSlots.end(); ++i) + // { + // std::set slots = viableSlots[(EquipmentSlots)i->first]; + // if (slots.find((InventoryType)proto->InventoryType) != slots.end()) + // slot = i->first; + // } - if (slot == EQUIPMENT_SLOT_START) - continue; + // if (slot == EQUIPMENT_SLOT_START) + // continue; // Init Item cache // ItemInfoEntry cacheInfo; diff --git a/src/RandomItemMgr.h b/src/RandomItemMgr.h index 8ce7dc88..110074f1 100644 --- a/src/RandomItemMgr.h +++ b/src/RandomItemMgr.h @@ -8,6 +8,7 @@ #include #include +#include #include #include "AiFactory.h" @@ -203,7 +204,7 @@ private: std::map weightStatLink; std::map weightRatingLink; std::map itemInfoCache; - std::set itemForTest; + std::unordered_set itemForTest; static std::set itemCache; // equipCacheNew[RequiredLevel][InventoryType] std::map>> equipCacheNew; diff --git a/src/factory/PlayerbotFactory.cpp b/src/factory/PlayerbotFactory.cpp index 7c969b95..dfe4e757 100644 --- a/src/factory/PlayerbotFactory.cpp +++ b/src/factory/PlayerbotFactory.cpp @@ -135,15 +135,17 @@ void PlayerbotFactory::Init() { continue; } - if (gemId == 49110) - { // unique gem - continue; - } ItemTemplate const* proto = sObjectMgr->GetItemTemplate(gemId); + + if (proto->ItemLevel < 60) + continue; + if (proto->Flags & ITEM_FLAG_UNIQUE_EQUIPPABLE) - { // unique gem + { continue; } + if (sRandomItemMgr->IsTestItem(gemId)) + continue; if (!proto || !sGemPropertiesStore.LookupEntry(proto->GemProperties)) { continue; @@ -403,7 +405,7 @@ void PlayerbotFactory::Randomize(bool incremental) bot->SetMoney(urand(level * 100000, level * 5 * 100000)); bot->SetHealth(bot->GetMaxHealth()); bot->SetPower(POWER_MANA, bot->GetMaxPower(POWER_MANA)); - bot->SaveToDB(false, false); + // bot->SaveToDB(false, false); LOG_INFO("playerbots", "Initialization Done."); if (pmo) pmo->finish(); @@ -438,7 +440,7 @@ void PlayerbotFactory::Refresh() uint32 money = urand(level * 1000, level * 5 * 1000); if (bot->GetMoney() < money) bot->SetMoney(money); - bot->SaveToDB(false, false); + // bot->SaveToDB(false, false); } void PlayerbotFactory::AddConsumables() @@ -805,17 +807,13 @@ void PlayerbotFactory::ClearSkills() void PlayerbotFactory::ClearEverything() { - bot->SaveToDB(false, false); bot->GiveLevel(bot->getClass() == CLASS_DEATH_KNIGHT ? sWorld->getIntConfig(CONFIG_START_HEROIC_PLAYER_LEVEL) : sWorld->getIntConfig(CONFIG_START_PLAYER_LEVEL)); bot->SetUInt32Value(PLAYER_XP, 0); LOG_INFO("playerbots", "Resetting player..."); bot->resetTalents(true); - bot->SaveToDB(false, false); ClearSkills(); - // bot->SaveToDB(false, false); ClearSpells(); - bot->SaveToDB(false, false); ClearInventory(); ResetQuests(); bot->SaveToDB(false, false); @@ -2027,6 +2025,7 @@ void PlayerbotFactory::InitSkills() SetRandomSkill(SKILL_THROWN); bot->SetSkill(SKILL_DUAL_WIELD, 0, dualWieldLevel, dualWieldLevel); bot->SetSkill(SKILL_PLATE_MAIL, 0, skillLevel, skillLevel); + bot->SetCanDualWield(dualWieldLevel); break; case CLASS_PALADIN: SetRandomSkill(SKILL_SWORDS); @@ -2079,8 +2078,9 @@ void PlayerbotFactory::InitSkills() SetRandomSkill(SKILL_POLEARMS); SetRandomSkill(SKILL_FIST_WEAPONS); SetRandomSkill(SKILL_THROWN); - bot->SetSkill(SKILL_MAIL, 0, skillLevel, skillLevel); bot->SetSkill(SKILL_DUAL_WIELD, 0, dualWieldLevel, dualWieldLevel); + bot->SetSkill(SKILL_MAIL, 0, skillLevel, skillLevel); + bot->SetCanDualWield(dualWieldLevel); break; case CLASS_ROGUE: SetRandomSkill(SKILL_SWORDS); @@ -2093,6 +2093,7 @@ void PlayerbotFactory::InitSkills() SetRandomSkill(SKILL_FIST_WEAPONS); SetRandomSkill(SKILL_THROWN); bot->SetSkill(SKILL_DUAL_WIELD, 0, 1, 1); + bot->SetCanDualWield(true); break; case CLASS_DEATH_KNIGHT: SetRandomSkill(SKILL_SWORDS); @@ -2103,6 +2104,7 @@ void PlayerbotFactory::InitSkills() SetRandomSkill(SKILL_2H_AXES); SetRandomSkill(SKILL_POLEARMS); bot->SetSkill(SKILL_DUAL_WIELD, 0, dualWieldLevel, dualWieldLevel); + bot->SetCanDualWield(dualWieldLevel); break; default: break; @@ -2572,7 +2574,6 @@ void PlayerbotFactory::InitInstanceQuests() ClearInventory(); bot->SetUInt32Value(PLAYER_XP, currentXP); - bot->SaveToDB(false, false); } void PlayerbotFactory::ClearInventory() @@ -3329,7 +3330,7 @@ void PlayerbotFactory::InitGuild() if (bot->GetGuildId()) return; - bot->SaveToDB(false, false); + // bot->SaveToDB(false, false); // add guild tabard if (bot->GetGuildId() && !bot->HasItemCount(5976, 1)) @@ -3365,7 +3366,7 @@ void PlayerbotFactory::InitGuild() if (bot->GetGuildId() && bot->GetLevel() > 9 && urand(0, 4) && !bot->HasItemCount(5976, 1)) StoreItem(5976, 1); - bot->SaveToDB(false, false); + // bot->SaveToDB(false, false); } void PlayerbotFactory::InitImmersive() @@ -3554,7 +3555,7 @@ void PlayerbotFactory::InitArenaTeam() arenateams.erase(arenateams.begin() + index); } - bot->SaveToDB(false, false); + // bot->SaveToDB(false, false); } void PlayerbotFactory::ApplyEnchantTemplate() @@ -3670,6 +3671,9 @@ void PlayerbotFactory::ApplyEnchantAndGemsNew(bool destoryOld) if (!gemProperties) continue; + if (sPlayerbotAIConfig->limitEnchantExpansion && bot->GetLevel() <= 70 && enchantGem >= 39900) + continue; + uint32 requiredLevel = gemTemplate->ItemLevel; if (requiredLevel > bot->GetLevel()) diff --git a/src/factory/StatsWeightCalculator.cpp b/src/factory/StatsWeightCalculator.cpp index 6f6166e1..543de321 100644 --- a/src/factory/StatsWeightCalculator.cpp +++ b/src/factory/StatsWeightCalculator.cpp @@ -431,7 +431,8 @@ void StatsWeightCalculator::CalculateItemTypePenalty(ItemTemplate const* proto) // spec with double hand // fury without duel wield, arms, bear, retribution, blood dk if (isDoubleHand && - ((cls == CLASS_WARRIOR && tab == WARRIOR_TAB_FURY && !player_->CanDualWield()) || + ((cls == CLASS_HUNTER && !player_->CanDualWield()) || + (cls == CLASS_WARRIOR && tab == WARRIOR_TAB_FURY && !player_->CanDualWield()) || (cls == CLASS_WARRIOR && tab == WARRIOR_TAB_ARMS) || (cls == CLASS_DRUID && tab == DRUID_TAB_FERAL) || (cls == CLASS_PALADIN && tab == PALADIN_TAB_RETRIBUTION) || (cls == CLASS_DEATH_KNIGHT && tab == DEATHKNIGHT_TAB_BLOOD) || diff --git a/src/strategy/actions/MovementActions.cpp b/src/strategy/actions/MovementActions.cpp index cf51e144..8c5eccb1 100644 --- a/src/strategy/actions/MovementActions.cpp +++ b/src/strategy/actions/MovementActions.cpp @@ -197,6 +197,7 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle, { VehicleSeatEntry const* seat = vehicle->GetSeatForPassenger(bot); Unit* vehicleBase = vehicle->GetBase(); + generatePath = vehicleBase->CanFly(); if (!vehicleBase || !seat || !seat->CanControl()) // is passenger and cant move anyway return false; @@ -815,7 +816,6 @@ bool MovementAction::ReachCombatTo(Unit* target, float distance) if (target->HasUnitMovementFlag(MOVEMENTFLAG_FORWARD)) // target is moving forward, predict the position { - float needToGo = bot->GetExactDist(target) - distance; float timeToGo = MoveDelay(abs(needToGo)) + sPlayerbotAIConfig->reactDelay / 1000.0f; float targetMoveDist = timeToGo * target->GetSpeed(MOVE_RUN); @@ -848,7 +848,8 @@ bool MovementAction::ReachCombatTo(Unit* target, float distance) return false; path.ShortenPathUntilDist(G3D::Vector3(tx, ty, tz), distance); G3D::Vector3 endPos = path.GetPath().back(); - return MoveTo(target->GetMapId(), endPos.x, endPos.y, endPos.z, false, false, false, false, MovementPriority::MOVEMENT_COMBAT); + return MoveTo(target->GetMapId(), endPos.x, endPos.y, endPos.z, false, false, false, false, + MovementPriority::MOVEMENT_COMBAT); } float MovementAction::GetFollowAngle() @@ -893,7 +894,7 @@ bool MovementAction::IsMovingAllowed(uint32 mapId, float x, float y, float z) // removed sqrt as means distance limit was effectively 22500 (ReactDistance�) // leaving it commented incase we find ReactDistance limit causes problems // float distance = sqrt(bot->GetDistance(x, y, z)); - + // Remove react distance limit // if (!bot->InBattleground()) // return false; @@ -924,7 +925,6 @@ bool MovementAction::IsWaitingForLastMove(MovementPriority priority) if (lastMove.lastdelayTime + lastMove.msTime > getMSTime()) return true; - return false; } @@ -1516,7 +1516,7 @@ bool MovementAction::MoveAway(Unit* target) float dz = bot->GetPositionZ(); bool exact = true; if (!bot->GetMap()->CheckCollisionAndGetValidCoords(bot, bot->GetPositionX(), bot->GetPositionY(), - bot->GetPositionZ(), dx, dy, dz)) + bot->GetPositionZ(), dx, dy, dz)) { // disable prediction if position is invalid dx = bot->GetPositionX() + cos(angle) * sPlayerbotAIConfig->fleeDistance; @@ -1538,7 +1538,7 @@ bool MovementAction::MoveAway(Unit* target) dy = bot->GetPositionY() + sin(angle) * sPlayerbotAIConfig->fleeDistance; dz = bot->GetPositionZ(); if (!bot->GetMap()->CheckCollisionAndGetValidCoords(bot, bot->GetPositionX(), bot->GetPositionY(), - bot->GetPositionZ(), dx, dy, dz)) + bot->GetPositionZ(), dx, dy, dz)) { // disable prediction if position is invalid dx = bot->GetPositionX() + cos(angle) * sPlayerbotAIConfig->fleeDistance; @@ -2403,7 +2403,8 @@ bool MoveInsideAction::Execute(Event event) { return MoveInside(bot->GetMapId(), bool RotateAroundTheCenterPointAction::Execute(Event event) { uint32 next_point = GetCurrWaypoint(); - if (MoveTo(bot->GetMapId(), waypoints[next_point].first, waypoints[next_point].second, bot->GetPositionZ(), false, false, false, false, MovementPriority::MOVEMENT_COMBAT)) + if (MoveTo(bot->GetMapId(), waypoints[next_point].first, waypoints[next_point].second, bot->GetPositionZ(), false, + false, false, false, MovementPriority::MOVEMENT_COMBAT)) { call_counters += 1; return true; diff --git a/src/strategy/actions/ReviveFromCorpseAction.cpp b/src/strategy/actions/ReviveFromCorpseAction.cpp index 1022beb5..4f522104 100644 --- a/src/strategy/actions/ReviveFromCorpseAction.cpp +++ b/src/strategy/actions/ReviveFromCorpseAction.cpp @@ -319,7 +319,6 @@ bool SpiritHealerAction::Execute(Event event) PlayerbotChatHandler ch(bot); bot->ResurrectPlayer(0.5f); bot->SpawnCorpseBones(); - bot->SaveToDB(false, false); context->GetValue("current target")->Set(nullptr); bot->SetTarget(); botAI->TellMaster("Hello");