Skip to content

Commit

Permalink
Implement Configurable Realm Flag (#202)
Browse files Browse the repository at this point in the history
* Implement configurable realm status flags

* Using 'REALM_FLAG_NONE' instead of ~REALM_FLAG_OFFLINE

- REALM_FLAG_NONE outputs 0, which the flag is set too when realm is online.

* Fix some typos
  • Loading branch information
Meltie2013 authored and billy1arm committed Aug 19, 2024
1 parent 5ebc86e commit 6269bf2
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmake/MangosParams.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
set(MANGOS_EXP "WOTLK")
set(MANGOS_PKG "Mangos Two")
set(MANGOS_WORLD_VER 2023062700)
set(MANGOS_WORLD_VER 2024061600)
set(MANGOS_REALM_VER 2021010100)
set(MANGOS_AHBOT_VER 2021010100)
4 changes: 4 additions & 0 deletions src/game/WorldHandlers/World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,10 @@ void World::LoadConfigSettings(bool reload)
setConfig(CONFIG_UINT32_WARDEN_CLIENT_RESPONSE_DELAY, "Warden.ClientResponseDelay", 600);
setConfig(CONFIG_UINT32_WARDEN_DB_LOGLEVEL, "Warden.DBLogLevel", 0);

// Recommended Or New Flag
setConfig(CONFIG_BOOL_REALM_RECOMMENDED_OR_NEW_ENABLED, "Realm.RecommendedOrNew.Enabled", false);
setConfig(CONFIG_BOOL_REALM_RECOMMENDED_OR_NEW, "Realm.RecommendedOrNew", false);

m_relocation_ai_notify_delay = sConfig.GetIntDefault("Visibility.AIRelocationNotifyDelay", 1000u);
m_relocation_lower_limit_sq = pow(sConfig.GetFloatDefault("Visibility.RelocationLowerLimit", 10), 2);

Expand Down
4 changes: 4 additions & 0 deletions src/game/WorldHandlers/World.h
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,10 @@ enum eConfigBoolValues
// Warden
CONFIG_BOOL_WARDEN_WIN_ENABLED,
CONFIG_BOOL_WARDEN_OSX_ENABLED,

// Recommended Or New Flag
CONFIG_BOOL_REALM_RECOMMENDED_OR_NEW_ENABLED,
CONFIG_BOOL_REALM_RECOMMENDED_OR_NEW,
CONFIG_BOOL_VALUE_COUNT
};

Expand Down
20 changes: 20 additions & 0 deletions src/mangosd/mangosd.conf.dist.in
Original file line number Diff line number Diff line change
Expand Up @@ -1883,6 +1883,26 @@ Warden.ClientCheckFailAction = 1
Warden.BanDuration = 86400
Warden.DBLogLevel = 0

###################################################################################################
# REALM STATUS FLAG
#
# Realm.RecommendedOrNew.Enabled
# Enable setting to set realm flag after initial startup
# Default: 0 (Disabled)
# 1 (Enabled)
#
# Realm.RecommendedOrNew
# Sets the recommended or new flag on realm.
# Default: 0 (Recommended)
# 1 (New)
#
# Note: Recommended will display as 'New Players' for Wrath of the Lich King
#
###################################################################################################

Realm.RecommendedOrNew.Enabled = 0
Realm.RecommendedOrNew = 0

###################################################################################################################
# ELUNA SETTINGS
#
Expand Down
6 changes: 5 additions & 1 deletion src/mangosd/mangosd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,10 +464,14 @@ int main(int argc, char** argv)
detachDaemon();
#endif

// set realm flag by configuration boolean
uint8 recommendedornew = sWorld.getConfig(CONFIG_BOOL_REALM_RECOMMENDED_OR_NEW) ? REALM_FLAG_NEW_PLAYERS : REALM_FLAG_RECOMMENDED;
uint8 realmstatus = sWorld.getConfig(CONFIG_BOOL_REALM_RECOMMENDED_OR_NEW_ENABLED) ? recommendedornew : uint8(REALM_FLAG_NONE);

// set realmbuilds depend on mangosd expected builds, and set server online
std::string builds = AcceptableClientBuildsListStr();
LoginDatabase.escape_string(builds);
LoginDatabase.DirectPExecute("UPDATE `realmlist` SET `realmflags` = `realmflags` & ~(%u), `population` = 0, `realmbuilds` = '%s' WHERE `id` = '%u'", REALM_FLAG_OFFLINE, builds.c_str(), realmID);
LoginDatabase.DirectPExecute("UPDATE `realmlist` SET `realmflags` = %u, `population` = 0, `realmbuilds` = '%s' WHERE `id` = '%u'", realmstatus, builds.c_str(), realmID);

// server loaded successfully => enable async DB requests
// this is done to forbid any async transactions during server startup!
Expand Down

0 comments on commit 6269bf2

Please sign in to comment.