From a2045d6d76138824e302f091c411c10da6ace707 Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Wed, 26 Jul 2023 13:17:48 +0800 Subject: [PATCH] miscs: CMSG received correctly (quest, loot etc.) --- conf/playerbots.conf.dist | 2 +- src/strategy/actions/MovementActions.cpp | 3 +++ src/strategy/actions/WorldPacketActionContext.h | 4 ++-- src/strategy/deathknight/FrostDKStrategy.cpp | 2 +- src/strategy/values/NearestGameObjects.cpp | 4 ++-- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/conf/playerbots.conf.dist b/conf/playerbots.conf.dist index e6369053..6352e7c5 100644 --- a/conf/playerbots.conf.dist +++ b/conf/playerbots.conf.dist @@ -122,7 +122,7 @@ AiPlayerbot.AutoPickReward = yes # Bots equip upgrades (Bots will equip any item obtained from looting or a quest if they are upgrades) # Default: 0 (disabled) -AiPlayerbot.AutoEquipUpgradeLoot = 1 +AiPlayerbot.AutoEquipUpgradeLoot = 0 # Sync quests with player (Bots will complete quests the moment you hand them in. Bots will ignore looting quest items.) # Default: 0 (disabled) diff --git a/src/strategy/actions/MovementActions.cpp b/src/strategy/actions/MovementActions.cpp index 054f2f87..ca09cae7 100644 --- a/src/strategy/actions/MovementActions.cpp +++ b/src/strategy/actions/MovementActions.cpp @@ -1226,6 +1226,9 @@ void MovementAction::ClearIdleState() bool MovementAction::MoveAway(Unit* target) { + if (!target) { + return false; + } float angle = target->GetAngle(bot); float dx = bot->GetPositionX() + cos(angle) * sPlayerbotAIConfig->fleeDistance; float dy = bot->GetPositionY() + sin(angle) * sPlayerbotAIConfig->fleeDistance; diff --git a/src/strategy/actions/WorldPacketActionContext.h b/src/strategy/actions/WorldPacketActionContext.h index a6cd931b..276b84e7 100644 --- a/src/strategy/actions/WorldPacketActionContext.h +++ b/src/strategy/actions/WorldPacketActionContext.h @@ -123,8 +123,8 @@ class WorldPacketActionContext : public NamedObjectContext static Action* accept_quest(PlayerbotAI* botAI) { return new AcceptQuestAction(botAI); } static Action* accept_all_quests(PlayerbotAI* botAI) { return new AcceptAllQuestsAction(botAI); } static Action* accept_quest_share(PlayerbotAI* botAI) { return new AcceptQuestShareAction(botAI); } - static Action* loot_roll(PlayerbotAI* botAI) { return (QueryItemUsageAction*)new LootRollAction(botAI); } - static Action* master_loot_roll(PlayerbotAI* botAI) { return (QueryItemUsageAction*)new MasterLootRollAction(botAI); } + static Action* loot_roll(PlayerbotAI* botAI) { return new LootRollAction(botAI); } + static Action* master_loot_roll(PlayerbotAI* botAI) { return new MasterLootRollAction(botAI); } static Action* bg_join(PlayerbotAI* botAI) { return new BGJoinAction(botAI); } static Action* bg_leave(PlayerbotAI* botAI) { return new BGLeaveAction(botAI); } static Action* bg_status(PlayerbotAI* botAI) { return new BGStatusAction(botAI); } diff --git a/src/strategy/deathknight/FrostDKStrategy.cpp b/src/strategy/deathknight/FrostDKStrategy.cpp index e9827ee2..13f6737e 100644 --- a/src/strategy/deathknight/FrostDKStrategy.cpp +++ b/src/strategy/deathknight/FrostDKStrategy.cpp @@ -89,5 +89,5 @@ void FrostDKStrategy::InitTriggers(std::vector& triggers) void FrostDKAoeStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("light aoe", NextAction::array(0, new NextAction("howling blast", ACTION_NORMAL + 4), nullptr))); + triggers.push_back(new TriggerNode("high aoe", NextAction::array(0, new NextAction("howling blast", ACTION_NORMAL + 4), nullptr))); } diff --git a/src/strategy/values/NearestGameObjects.cpp b/src/strategy/values/NearestGameObjects.cpp index b4f8222a..842b6a63 100644 --- a/src/strategy/values/NearestGameObjects.cpp +++ b/src/strategy/values/NearestGameObjects.cpp @@ -36,8 +36,8 @@ GuidVector NearestGameObjects::Calculate() GuidVector result; for (GameObject* go : targets) { - if (ignoreLos || bot->IsWithinLOSInMap(go)) - result.push_back(go->GetGUID()); + // if (ignoreLos || bot->IsWithinLOSInMap(go)) + result.push_back(go->GetGUID()); } return result;