mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
Add std::string WorldContentService::GetCurrentExpansionName() [skip ci]
This commit is contained in:
parent
e0363a8fe1
commit
77cacf5cd1
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
WorldContentService::WorldContentService()
|
WorldContentService::WorldContentService()
|
||||||
{
|
{
|
||||||
SetCurrentExpansion(0);
|
SetCurrentExpansion(Expansion::EXPANSION_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int WorldContentService::GetCurrentExpansion() const
|
int WorldContentService::GetCurrentExpansion() const
|
||||||
@ -44,3 +44,16 @@ void WorldContentService::SetContentFlags(std::vector<std::string> content_flags
|
|||||||
{
|
{
|
||||||
WorldContentService::content_flags = 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";
|
||||||
|
}
|
||||||
|
|||||||
@ -25,6 +25,8 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace Expansion {
|
namespace Expansion {
|
||||||
|
static const int EXPANSION_ALL = -1;
|
||||||
|
|
||||||
enum ExpansionNumber {
|
enum ExpansionNumber {
|
||||||
Classic = 0,
|
Classic = 0,
|
||||||
TheRuinsOfKunark,
|
TheRuinsOfKunark,
|
||||||
@ -95,6 +97,7 @@ public:
|
|||||||
|
|
||||||
WorldContentService();
|
WorldContentService();
|
||||||
|
|
||||||
|
std::string GetCurrentExpansionName();
|
||||||
int GetCurrentExpansion() const;
|
int GetCurrentExpansion() const;
|
||||||
void SetCurrentExpansion(int current_expansion);
|
void SetCurrentExpansion(int current_expansion);
|
||||||
|
|
||||||
|
|||||||
@ -776,7 +776,7 @@ RULE_BOOL(HotReload, QuestsResetTimersWithReload, true, "When a hot reload is tr
|
|||||||
RULE_CATEGORY_END()
|
RULE_CATEGORY_END()
|
||||||
|
|
||||||
RULE_CATEGORY(Expansion)
|
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()
|
RULE_CATEGORY_END()
|
||||||
|
|
||||||
#undef RULE_CATEGORY
|
#undef RULE_CATEGORY
|
||||||
|
|||||||
@ -403,7 +403,7 @@ int main(int argc, char** argv) {
|
|||||||
LogInfo(
|
LogInfo(
|
||||||
"Current expansion is [{}] ({})",
|
"Current expansion is [{}] ({})",
|
||||||
content_service.GetCurrentExpansion(),
|
content_service.GetCurrentExpansion(),
|
||||||
Expansion::ExpansionName[content_service.GetCurrentExpansion()]
|
content_service.GetCurrentExpansionName()
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifdef BOTS
|
#ifdef BOTS
|
||||||
|
|||||||
@ -290,24 +290,26 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) {
|
|||||||
/**
|
/**
|
||||||
* Expansion check
|
* Expansion check
|
||||||
*/
|
*/
|
||||||
auto zones = ZoneRepository::GetWhere(
|
if (content_service.GetCurrentExpansion() >= Expansion::Classic && !GetGM()) {
|
||||||
fmt::format(
|
auto zones = ZoneRepository::GetWhere(
|
||||||
"expansion <= {} AND short_name = '{}'",
|
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),
|
(content_service.GetCurrentExpansion() + 1),
|
||||||
target_zone_name
|
content_service.GetCurrentExpansionName(),
|
||||||
)
|
!zones.empty() ? "true" : "false"
|
||||||
);
|
);
|
||||||
|
|
||||||
LogInfo(
|
if (zones.empty()) {
|
||||||
"Checking zone request [{}] for expansion [{}] ({}) success [{}]",
|
myerror = ZONE_ERROR_NOEXPANSION;
|
||||||
target_zone_name,
|
}
|
||||||
(content_service.GetCurrentExpansion() + 1),
|
|
||||||
Expansion::ExpansionName[content_service.GetCurrentExpansion()],
|
|
||||||
!zones.empty() ? "true" : "false"
|
|
||||||
);
|
|
||||||
|
|
||||||
if (zones.empty()) {
|
|
||||||
myerror = ZONE_ERROR_NOEXPANSION;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(myerror == 1) {
|
if(myerror == 1) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user