diff --git a/common/content/world_content_service.cpp b/common/content/world_content_service.cpp index e636d8854..6ff504ebd 100644 --- a/common/content/world_content_service.cpp +++ b/common/content/world_content_service.cpp @@ -22,7 +22,7 @@ WorldContentService::WorldContentService() { - SetCurrentExpansion(0); + SetCurrentExpansion(Expansion::EXPANSION_ALL); } int WorldContentService::GetCurrentExpansion() const @@ -44,3 +44,16 @@ void WorldContentService::SetContentFlags(std::vector content_flags { WorldContentService::content_flags = content_flags; } + +std::string WorldContentService::GetCurrentExpansionName() +{ + if (content_service.GetCurrentExpansion() == Expansion::EXPANSION_ALL) { + return "All Expansions"; + } + + if (current_expansion >= Expansion::Classic && current_expansion <= Expansion::MaxId) { + return Expansion::ExpansionName[content_service.GetCurrentExpansion()]; + } + + return "Unknown Expansion"; +} diff --git a/common/content/world_content_service.h b/common/content/world_content_service.h index 9faa6847e..a1b6438cd 100644 --- a/common/content/world_content_service.h +++ b/common/content/world_content_service.h @@ -25,6 +25,8 @@ #include namespace Expansion { + static const int EXPANSION_ALL = -1; + enum ExpansionNumber { Classic = 0, TheRuinsOfKunark, @@ -95,6 +97,7 @@ public: WorldContentService(); + std::string GetCurrentExpansionName(); int GetCurrentExpansion() const; void SetCurrentExpansion(int current_expansion); diff --git a/common/ruletypes.h b/common/ruletypes.h index 281fc35fb..f3650d156 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -776,7 +776,7 @@ RULE_BOOL(HotReload, QuestsResetTimersWithReload, true, "When a hot reload is tr RULE_CATEGORY_END() RULE_CATEGORY(Expansion) -RULE_INT(Expansion, CurrentExpansion, 0, "The current expansion enabled for the server [0 = Classic, 1 = Kunark etc.]") +RULE_INT(Expansion, CurrentExpansion, -1, "The current expansion enabled for the server [-1 = ALL, 0 = Classic, 1 = Kunark etc.]") RULE_CATEGORY_END() #undef RULE_CATEGORY diff --git a/zone/main.cpp b/zone/main.cpp index 53c3b52d1..ad520bf35 100644 --- a/zone/main.cpp +++ b/zone/main.cpp @@ -403,7 +403,7 @@ int main(int argc, char** argv) { LogInfo( "Current expansion is [{}] ({})", content_service.GetCurrentExpansion(), - Expansion::ExpansionName[content_service.GetCurrentExpansion()] + content_service.GetCurrentExpansionName() ); #ifdef BOTS diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 36a2ee5a2..ac453fefc 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -290,24 +290,26 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { /** * Expansion check */ - auto zones = ZoneRepository::GetWhere( - fmt::format( - "expansion <= {} AND short_name = '{}'", + if (content_service.GetCurrentExpansion() >= Expansion::Classic && !GetGM()) { + auto zones = ZoneRepository::GetWhere( + fmt::format( + "expansion <= {} AND short_name = '{}'", + (content_service.GetCurrentExpansion() + 1), + target_zone_name + ) + ); + + LogInfo( + "Checking zone request [{}] for expansion [{}] ({}) success [{}]", + target_zone_name, (content_service.GetCurrentExpansion() + 1), - target_zone_name - ) - ); + content_service.GetCurrentExpansionName(), + !zones.empty() ? "true" : "false" + ); - LogInfo( - "Checking zone request [{}] for expansion [{}] ({}) success [{}]", - target_zone_name, - (content_service.GetCurrentExpansion() + 1), - Expansion::ExpansionName[content_service.GetCurrentExpansion()], - !zones.empty() ? "true" : "false" - ); - - if (zones.empty()) { - myerror = ZONE_ERROR_NOEXPANSION; + if (zones.empty()) { + myerror = ZONE_ERROR_NOEXPANSION; + } } if(myerror == 1) {