diff --git a/conf/login_athena.conf b/conf/login_athena.conf index 969b83bda2..5ec9b57a99 100644 --- a/conf/login_athena.conf +++ b/conf/login_athena.conf @@ -110,6 +110,16 @@ start_limited_time: -1 // NOTE: Will not work with clients that use use_MD5_passwords: no +// User count colorization on login window (requires PACKETVER >= 20170726) +// Disable colorization and description in general? +usercount_disable: no +// Amount of users that will display in green +usercount_low: 200 +// Amount of users that will display in yellow +usercount_medium: 500 +// Amount of users that will display in red +usercount_high: 1000 + // Ipban features ipban_enable: yes // Dynamic password failure ipban system diff --git a/src/login/login.cpp b/src/login/login.cpp index a3f9da5719..8b2bd26130 100644 --- a/src/login/login.cpp +++ b/src/login/login.cpp @@ -439,6 +439,24 @@ bool login_check_password(const char* md5key, int passwdenc, const char* passwd, } } +int login_get_usercount( int users ){ +#if PACKETVER >= 20170726 + if( login_config.usercount_disable ){ + return 4; // Removes count and colorization completely + }else if( users <= login_config.usercount_low ){ + return 0; // Green => Smooth + }else if( users <= login_config.usercount_medium ){ + return 1; // Yellow => Normal + }else if( users <= login_config.usercount_high ){ + return 2; // Red => Busy + }else{ + return 3; // Purple => Crowded + } +#else + return users; +#endif +} + /** * Test to determine if an IP come from LAN or WAN. * @param ip: ip to check if in auth network @@ -628,7 +646,15 @@ bool login_config_read(const char* cfgName, bool normal) { nnode->next = login_config.client_hash_nodes; login_config.client_hash_nodes = nnode; } - } else if(strcmpi(w1, "chars_per_account") == 0) { //maxchars per account [Sirius] + } else if (!strcmpi(w1, "usercount_disable")) + login_config.usercount_disable = config_switch(w2); + else if (!strcmpi(w1, "usercount_low")) + login_config.usercount_low = atoi(w2); + else if (!strcmpi(w1, "usercount_medium")) + login_config.usercount_medium = atoi(w2); + else if (!strcmpi(w1, "usercount_high")) + login_config.usercount_high = atoi(w2); + else if(strcmpi(w1, "chars_per_account") == 0) { //maxchars per account [Sirius] login_config.char_per_account = atoi(w2); if( login_config.char_per_account <= 0 || login_config.char_per_account > MAX_CHARS ) { if( login_config.char_per_account > MAX_CHARS ) { @@ -699,6 +725,10 @@ void login_set_defaults() { login_config.client_hash_check = 0; login_config.client_hash_nodes = NULL; + login_config.usercount_disable = false; + login_config.usercount_low = 200; + login_config.usercount_medium = 500; + login_config.usercount_high = 1000; login_config.char_per_account = MAX_CHARS - MAX_CHAR_VIP - MAX_CHAR_BILLING; #ifdef VIP_ENABLE login_config.vip_sys.char_increase = MAX_CHAR_VIP; diff --git a/src/login/login.hpp b/src/login/login.hpp index aeb51e9403..e40273a609 100644 --- a/src/login/login.hpp +++ b/src/login/login.hpp @@ -97,6 +97,11 @@ struct Login_Config { char msgconf_name[256]; /// name of msg_conf config file char lanconf_name[256]; /// name of lan config file + bool usercount_disable; /// Disable colorization and description in general? + int usercount_low; /// Amount of users that will display in green + int usercount_medium; /// Amount of users that will display in yellow + int usercount_high; /// Amount of users that will display in red + int char_per_account; /// number of characters an account can have #ifdef VIP_ENABLE struct { @@ -228,4 +233,6 @@ int login_mmo_auth_new(const char* userid, const char* pass, const char sex, con */ int login_mmo_auth(struct login_session_data* sd, bool isServer); +int login_get_usercount( int users ); + #endif /* LOGIN_HPP */ diff --git a/src/login/loginclif.cpp b/src/login/loginclif.cpp index 05c5a46cea..13ffac0e6f 100644 --- a/src/login/loginclif.cpp +++ b/src/login/loginclif.cpp @@ -139,7 +139,7 @@ static void logclif_auth_ok(struct login_session_data* sd) { WFIFOL(fd,header+n*size) = htonl((subnet_char_ip) ? subnet_char_ip : ch_server[i].ip); WFIFOW(fd,header+n*size+4) = ntows(htons(ch_server[i].port)); // [!] LE byte order here [!] memcpy(WFIFOP(fd,header+n*size+6), ch_server[i].name, 20); - WFIFOW(fd,header+n*size+26) = ch_server[i].users; + WFIFOW(fd,header+n*size+26) = login_get_usercount( ch_server[i].users ); WFIFOW(fd,header+n*size+28) = ch_server[i].type; WFIFOW(fd,header+n*size+30) = ch_server[i].new_; #if PACKETVER >= 20170315