From 989cc409840cd1d7f18cb738f4dd9b1fe092c3ed Mon Sep 17 00:00:00 2001 From: Tb Date: Fri, 12 Jan 2024 18:32:18 -0500 Subject: [PATCH] Add a new override to reload "-3" for cache only. --- PlayerHooks.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/PlayerHooks.cpp b/PlayerHooks.cpp index a99f28674f..4aed46893b 100644 --- a/PlayerHooks.cpp +++ b/PlayerHooks.cpp @@ -84,6 +84,7 @@ bool Eluna::OnCommand(Player* player, const char* text) const std::string reload_command = "reload eluna"; if (reload.find(reload_command) == 0) { + const int mapid_reload_cache_only = -3; const int mapid_reload_all = -2; // reserved for reloading all states (default if no args) const int mapid_reload_global = -1; // reserved for reloading global state // otherwise reload the state of the specific mapid @@ -95,17 +96,20 @@ bool Eluna::OnCommand(Player* player, const char* text) mapId = strtol(args.c_str(), nullptr, 10); sElunaLoader->LoadScripts(); - if (mapId == mapid_reload_global || mapId == mapid_reload_all) - sWorld->GetEluna()->ReloadEluna(); - sMapMgr->DoForAllMaps([&](Map* map) - { - if (mapId == mapid_reload_all || mapId == static_cast(map->GetId())) + if (mapid_reload_cache_only != mapId) + { + if (mapId == mapid_reload_global || mapId == mapid_reload_all) + sWorld->GetEluna()->ReloadEluna(); + sMapMgr->DoForAllMaps([&](Map* map) { - if (map->GetEluna()) - map->GetEluna()->ReloadEluna(); + if (mapId == mapid_reload_all || mapId == static_cast(map->GetId())) + { + if (map->GetEluna()) + map->GetEluna()->ReloadEluna(); + } } - } - ); + ); + } return false; } }