From 4fdc890fb6fa3a041a6d01690ec117e1f43a1d0b Mon Sep 17 00:00:00 2001 From: mostlikely4r Date: Fri, 4 Oct 2024 11:45:24 +0200 Subject: [PATCH] -Nowar fix: Bots now properly remove the at-war flag again with the 'nowar' strategy. --- playerbot/strategy/actions/CheckValuesAction.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/playerbot/strategy/actions/CheckValuesAction.cpp b/playerbot/strategy/actions/CheckValuesAction.cpp index 0b9aed64..bf1f81a6 100644 --- a/playerbot/strategy/actions/CheckValuesAction.cpp +++ b/playerbot/strategy/actions/CheckValuesAction.cpp @@ -43,21 +43,23 @@ bool CheckValuesAction::Execute(Event& event) ReputationMgr& mgr = bot->GetReputationMgr(); for (auto & faction : mgr.GetStateList()) { - uint32 id = faction.first; + uint32 factionId = faction.second.ID; + uint32 replistId = faction.first; - if (!mgr.IsAtWar(id)) - continue; #ifdef MANGOSBOT_ZERO const FactionEntry* thisFactionEntry = sFactionStore.LookupEntry(id); #else - const FactionEntry* thisFactionEntry = sFactionStore.LookupEntry(id); + const FactionEntry* thisFactionEntry = sFactionStore.LookupEntry(factionId); #endif + if (!mgr.IsAtWar(factionId)) + continue; + if (!thisFactionEntry) continue; - if (bot->GetReputationMgr().GetRank(thisFactionEntry) < REP_HOSTILE) - bot->GetReputationMgr().SetAtWar(id, false); + if (bot->GetReputationMgr().GetRank(thisFactionEntry) > REP_HATED) + bot->GetReputationMgr().SetAtWar(replistId, false); } }