diff --git a/include/game/game_handler.hpp b/include/game/game_handler.hpp index 27cd9e04..9603b548 100644 --- a/include/game/game_handler.hpp +++ b/include/game/game_handler.hpp @@ -800,6 +800,12 @@ public: */ void update(float deltaTime); + /** + * Reset DBC-backed caches so they reload from new expansion data. + * Called by Application when the expansion profile changes. + */ + void resetDbcCaches(); + private: void autoTargetAttacker(uint64_t attackerGuid); diff --git a/src/core/application.cpp b/src/core/application.cpp index fb823150..6fd873de 100644 --- a/src/core/application.cpp +++ b/src/core/application.cpp @@ -516,6 +516,11 @@ void Application::reloadExpansionData() { // Reset map name cache so it reloads from new expansion's Map.dbc mapNameCacheLoaded_ = false; mapNameById_.clear(); + + // Reset game handler DBC caches so they reload from new expansion data + if (gameHandler) { + gameHandler->resetDbcCaches(); + } } void Application::logoutToLogin() { diff --git a/src/game/game_handler.cpp b/src/game/game_handler.cpp index 242d1364..b3e6250d 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -220,6 +220,24 @@ void GameHandler::disconnect() { LOG_INFO("Disconnected from world server"); } +void GameHandler::resetDbcCaches() { + spellNameCacheLoaded_ = false; + spellNameCache_.clear(); + skillLineDbcLoaded_ = false; + skillLineNames_.clear(); + skillLineCategories_.clear(); + skillLineAbilityLoaded_ = false; + spellToSkillLine_.clear(); + taxiDbcLoaded_ = false; + taxiNodes_.clear(); + taxiPathEdges_.clear(); + taxiPathNodes_.clear(); + talentDbcLoaded_ = false; + talentCache_.clear(); + talentTabCache_.clear(); + LOG_INFO("GameHandler: DBC caches cleared for expansion switch"); +} + bool GameHandler::isConnected() const { return socket && socket->isConnected(); }