From eff9873272bec1dddf763286dc300f6e5b0c7ad0 Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Mon, 21 Jul 2025 11:39:22 +0800 Subject: [PATCH] General improvement --- src/strategy/rpg/NewRpgBaseAction.cpp | 6 +++--- src/strategy/values/GrindTargetValue.cpp | 16 ++++++++-------- src/strategy/values/NearestCorpsesValue.h | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/strategy/rpg/NewRpgBaseAction.cpp b/src/strategy/rpg/NewRpgBaseAction.cpp index 7c50ed46e..329296d71 100644 --- a/src/strategy/rpg/NewRpgBaseAction.cpp +++ b/src/strategy/rpg/NewRpgBaseAction.cpp @@ -78,7 +78,7 @@ bool NewRpgBaseAction::MoveFarTo(WorldPosition dest) float rx, ry, rz; bool found = false; int attempt = 3; - while (--attempt) + while (attempt--) { float angle = bot->GetAngle(&dest); float delta = urand(1, 100) <= 75 ? (rand_norm() - 0.5) * M_PI * 0.5 : (rand_norm() - 0.5) * M_PI * 2; @@ -157,8 +157,8 @@ bool NewRpgBaseAction::MoveRandomNear(float moveStep, MovementPriority priority) const float x = bot->GetPositionX(); const float y = bot->GetPositionY(); const float z = bot->GetPositionZ(); - int attempts = 5; - while (--attempts) + int attempts = 1; + while (attempts--) { float angle = (float)rand_norm() * 2 * static_cast(M_PI); float dx = x + distance * cos(angle); diff --git a/src/strategy/values/GrindTargetValue.cpp b/src/strategy/values/GrindTargetValue.cpp index 71b5dbf60..c3b6791f0 100644 --- a/src/strategy/values/GrindTargetValue.cpp +++ b/src/strategy/values/GrindTargetValue.cpp @@ -195,16 +195,16 @@ bool GrindTargetValue::needForQuest(Unit* target) return true; } } + } + } - if (CreatureTemplate const* data = sObjectMgr->GetCreatureTemplate(target->GetEntry())) + if (CreatureTemplate const* data = sObjectMgr->GetCreatureTemplate(target->GetEntry())) + { + if (uint32 lootId = data->lootid) + { + if (LootTemplates_Creature.HaveQuestLootForPlayer(lootId, bot)) { - if (uint32 lootId = data->lootid) - { - if (LootTemplates_Creature.HaveQuestLootForPlayer(lootId, bot)) - { - return true; - } - } + return true; } } } diff --git a/src/strategy/values/NearestCorpsesValue.h b/src/strategy/values/NearestCorpsesValue.h index 9bda863bd..6453bb09f 100644 --- a/src/strategy/values/NearestCorpsesValue.h +++ b/src/strategy/values/NearestCorpsesValue.h @@ -15,7 +15,7 @@ class NearestCorpsesValue : public NearestUnitsValue { public: NearestCorpsesValue(PlayerbotAI* botAI, float range = sPlayerbotAIConfig->sightDistance) - : NearestUnitsValue(botAI, "nearest corpses", range) + : NearestUnitsValue(botAI, "nearest corpses", range, true) { }