From 00844985eb197933555c2447464772af9fa9d722 Mon Sep 17 00:00:00 2001 From: Atidot3 Date: Sat, 27 Jul 2024 14:39:30 +0200 Subject: [PATCH] Fix chain link broken (random) unknown + dbc local enus force in some case (spell / chathelper etc) --- src/ChatHelper.cpp | 8 ++++---- src/RandomPlayerbotMgr.cpp | 4 ++-- src/strategy/actions/LfgActions.cpp | 2 +- src/strategy/actions/MovementActions.cpp | 6 +++--- src/strategy/actions/SuggestWhatToDoAction.h | 1 - src/strategy/actions/TellLosAction.cpp | 2 +- src/strategy/generic/EmoteStrategy.cpp | 2 +- 7 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/ChatHelper.cpp b/src/ChatHelper.cpp index 630bfca9..92daa117 100644 --- a/src/ChatHelper.cpp +++ b/src/ChatHelper.cpp @@ -288,7 +288,7 @@ std::string const ChatHelper::FormatQuest(Quest const* quest) std::string const ChatHelper::FormatGameobject(GameObject* go) { std::ostringstream out; - out << "|cFFFFFF00|Hfound:" << go->GetGUID().GetRawValue() << ":" << go->GetEntry() << ":" << "|h[" << go->GetNameForLocaleIdx(sWorld->GetDefaultDbcLocale()) << "]|h|r"; + out << "|cFFFFFF00|Hfound:" << go->GetGUID().GetRawValue() << ":" << go->GetEntry() << ":" << "|h[" << go->GetNameForLocaleIdx(LOCALE_enUS) << "]|h|r"; return out.str(); } @@ -296,7 +296,7 @@ std::string const ChatHelper::FormatWorldobject(WorldObject* wo) { std::ostringstream out; out << "|cFFFFFF00|Hfound:" << wo->GetGUID().GetRawValue() << ":" << wo->GetEntry() << ":" << "|h["; - out << (wo->ToGameObject() ? ((GameObject*)wo)->GetNameForLocaleIdx(sWorld->GetDefaultDbcLocale()) : wo->GetNameForLocaleIdx(sWorld->GetDefaultDbcLocale())) << "]|h|r"; + out << (wo->ToGameObject() ? ((GameObject*)wo)->GetNameForLocaleIdx(LOCALE_enUS) : wo->GetNameForLocaleIdx(LOCALE_enUS)) << "]|h|r"; return out.str(); } @@ -327,7 +327,7 @@ std::string const ChatHelper::FormatWorldEntry(int32 entry) std::string const ChatHelper::FormatSpell(SpellInfo const* spellInfo) { std::ostringstream out; - out << "|cffffffff|Hspell:" << spellInfo->Id << "|h[" << spellInfo->SpellName[sWorld->GetDefaultDbcLocale()] << "]|h|r"; + out << "|cffffffff|Hspell:" << spellInfo->Id << "|h[" << spellInfo->SpellName[LOCALE_enUS] << "]|h|r"; return out.str(); } @@ -336,7 +336,7 @@ std::string const ChatHelper::FormatItem(ItemTemplate const* proto, uint32 count char color[32]; sprintf(color, "%x", ItemQualityColors[proto->Quality]); - // const std::string &name = sObjectMgr->GetItemLocale(proto->ItemId)->Name[sWorld->GetDefaultDbcLocale()]; + // const std::string &name = sObjectMgr->GetItemLocale(proto->ItemId)->Name[LOCALE_enUS]; std::ostringstream out; out << "|c" << color << "|Hitem:" << proto->ItemId diff --git a/src/RandomPlayerbotMgr.cpp b/src/RandomPlayerbotMgr.cpp index 5e6891e5..639acd52 100644 --- a/src/RandomPlayerbotMgr.cpp +++ b/src/RandomPlayerbotMgr.cpp @@ -1228,8 +1228,8 @@ void RandomPlayerbotMgr::RandomTeleport(Player* bot, std::vector& if (bot->GetLevel() <= 18 && (loc.GetMapId() != pInfo->mapId || dis > 10000.0f)) { continue; } - LocaleConstant locale = sWorld->GetDefaultDbcLocale(); - + + const LocaleConstant& locale = sWorld->GetDefaultDbcLocale(); LOG_INFO("playerbots", "Random teleporting bot {} (level {}) to Map: {} ({}) Zone: {} ({}) Area: {} ({}) {},{},{} ({}/{} locations)", bot->GetName().c_str(), bot->GetLevel(), map->GetId(), map->GetMapName(), diff --git a/src/strategy/actions/LfgActions.cpp b/src/strategy/actions/LfgActions.cpp index 4cb0bada..d7e7b865 100644 --- a/src/strategy/actions/LfgActions.cpp +++ b/src/strategy/actions/LfgActions.cpp @@ -105,7 +105,7 @@ bool LfgJoinAction::JoinLFG() const auto& botLevel = bot->GetLevel(); - /*LFG_TYPE_RANDOM on classic is 15-58 so bot over level 25 will never queue*/ + /*LFG_TYPE_RANDOM on classic is 15-58 so bot over level 25 will never queue*/ if (dungeon->MinLevel && (botLevel < dungeon->MinLevel || botLevel > dungeon->MaxLevel) || (botLevel > dungeon->MinLevel + 10 && dungeon->TypeID == LFG_TYPE_DUNGEON) diff --git a/src/strategy/actions/MovementActions.cpp b/src/strategy/actions/MovementActions.cpp index ed002f53..9f7799b1 100644 --- a/src/strategy/actions/MovementActions.cpp +++ b/src/strategy/actions/MovementActions.cpp @@ -1555,7 +1555,7 @@ bool AvoidAoeAction::AvoidAuraWithDynamicObj() return false; } std::ostringstream name; - name << spellInfo->SpellName[sWorld->GetDefaultDbcLocale()]; // << "] (aura)"; + name << spellInfo->SpellName[LOCALE_enUS]; // << "] (aura)"; if (FleePosition(dynOwner->GetPosition(), radius)) { if (sPlayerbotAIConfig->tellWhenAvoidAoe && lastTellTimer < time(NULL) - 10) { lastTellTimer = time(NULL); @@ -1613,7 +1613,7 @@ bool AvoidAoeAction::AvoidGameObjectWithDamage() continue; } std::ostringstream name; - name << spellInfo->SpellName[sWorld->GetDefaultDbcLocale()]; // << "] (object)"; + name << spellInfo->SpellName[LOCALE_enUS]; // << "] (object)"; if (FleePosition(go->GetPosition(), radius)) { if (sPlayerbotAIConfig->tellWhenAvoidAoe && lastTellTimer < time(NULL) - 10) { lastTellTimer = time(NULL); @@ -1662,7 +1662,7 @@ bool AvoidAoeAction::AvoidUnitWithDamageAura() break; } std::ostringstream name; - name << triggerSpellInfo->SpellName[sWorld->GetDefaultDbcLocale()]; //<< "] (unit)"; + name << triggerSpellInfo->SpellName[LOCALE_enUS]; //<< "] (unit)"; if (FleePosition(unit->GetPosition(), radius)) { if (sPlayerbotAIConfig->tellWhenAvoidAoe && lastTellTimer < time(NULL) - 10) { lastTellTimer = time(NULL); diff --git a/src/strategy/actions/SuggestWhatToDoAction.h b/src/strategy/actions/SuggestWhatToDoAction.h index f3a57b89..46391ff2 100644 --- a/src/strategy/actions/SuggestWhatToDoAction.h +++ b/src/strategy/actions/SuggestWhatToDoAction.h @@ -20,7 +20,6 @@ class SuggestWhatToDoAction : public InventoryAction protected: using Suggestion = std::function; std::vector suggestions; - void instance(); void specificQuest(); void grindReputation(); void grindMaterials(); diff --git a/src/strategy/actions/TellLosAction.cpp b/src/strategy/actions/TellLosAction.cpp index 688599ff..8917d2ed 100644 --- a/src/strategy/actions/TellLosAction.cpp +++ b/src/strategy/actions/TellLosAction.cpp @@ -138,4 +138,4 @@ bool TellExpectedDpsAction::Execute(Event event) float dps = AI_VALUE(float, "expected group dps"); botAI->TellMaster("Expected Group DPS: " + std::to_string(dps)); return true; -} \ No newline at end of file +} diff --git a/src/strategy/generic/EmoteStrategy.cpp b/src/strategy/generic/EmoteStrategy.cpp index 57f400c9..002fdc41 100644 --- a/src/strategy/generic/EmoteStrategy.cpp +++ b/src/strategy/generic/EmoteStrategy.cpp @@ -22,7 +22,7 @@ void EmoteStrategy::InitTriggers(std::vector& triggers) } if (sPlayerbotAIConfig->randomBotSuggestDungeons) - triggers.push_back(new TriggerNode("random", NextAction::array(0, new NextAction("suggest dungeon", 1.0f), nullptr))); + triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("suggest dungeon", 1.0f), nullptr))); if (sPlayerbotAIConfig->enableGreet) triggers.push_back(new TriggerNode("new player nearby", NextAction::array(0, new NextAction("greet", 1.0f), nullptr)));