From dc9c104ad231e6ba9f695072d36d586e2e3d3d4c Mon Sep 17 00:00:00 2001 From: Fedja Beader Date: Wed, 10 Apr 2024 16:43:21 +0200 Subject: Add server-wide drop rates modifier --- tools/config.py | 1 + 1 file changed, 1 insertion(+) (limited to 'tools') diff --git a/tools/config.py b/tools/config.py index a187c06..49339bd 100755 --- a/tools/config.py +++ b/tools/config.py @@ -601,6 +601,7 @@ def build_config(): battle_conf.opt('item_third_get_time', milliseconds, '1_s') battle_conf.opt('base_exp_rate', percent, '100') battle_conf.opt('job_exp_rate', percent, '100') + battle_conf.opt('drop_rate', percent, '100') battle_conf.opt('death_penalty_type', i32, '0', min='0', max='2') battle_conf.opt('death_penalty_base', per10kd, '0') battle_conf.opt('death_penalty_job', per10kd, '0') -- cgit v1.2.3-70-g09d2 From 45d4a85fe4b9e6804a454daab19bd41638aec874 Mon Sep 17 00:00:00 2001 From: Fedja Beader Date: Fri, 12 Apr 2024 01:13:10 +0200 Subject: Add battle_config.max_rate limit (500). GMs cannot go above this Blame Ledmitz (: --- src/map/atcommand.cpp | 63 ++++++++++++++++++++++++++++----------------------- tools/config.py | 1 + 2 files changed, 36 insertions(+), 28 deletions(-) (limited to 'tools') diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp index 20743dd..311ca76 100644 --- a/src/map/atcommand.cpp +++ b/src/map/atcommand.cpp @@ -1667,20 +1667,38 @@ ATCE atcommand_pvpoff(Session *s, dumb_ptr sd, return ATCE::OKAY; } + + +static int extract_rate(Session *s, ZString message) +{ + int rate; + AString output; + + if (!extract(message, &rate)) + { + clif_displaymessage(s, "Please enter the new rate"_s); + return -1; + } + if (rate <= 0 || rate > battle_config.max_rate) + { + output = STRPRINTF("Rate adjustment must be between 1 and %d%%"_fmt, + battle_config.max_rate); + clif_displaymessage(s, output); + return -1; + } + return rate; +} + // Command not removed during bexprate/jexprate split // because serverdata calls it. static ATCE atcommand_exprate(Session *s, dumb_ptr, ZString message) { - int rate; - - if (!extract(message, &rate) || !rate) - { - clif_displaymessage(s, - "Please, enter a rate adjustement (usage: @exprate )."_s); + int rate = extract_rate(s, message); + if (rate < 0) return ATCE::USAGE; - } + battle_config.base_exp_rate = rate; battle_config.job_exp_rate = rate; AString output = STRPRINTF("Base & job XP rates now at %d percent"_fmt, rate); @@ -1692,14 +1710,10 @@ static ATCE atcommand_bexprate(Session *s, dumb_ptr, ZString message) { - int rate; - - if (!extract(message, &rate) || !rate) - { - clif_displaymessage(s, - "Please, enter a rate adjustement (usage: @bexprate )."_s); + int rate = extract_rate(s, message); + if (rate < 0) return ATCE::USAGE; - } + battle_config.base_exp_rate = rate; AString output = STRPRINTF("Base XP rate now at %d percent"_fmt, rate); clif_displaymessage(s, output); @@ -1710,14 +1724,10 @@ static ATCE atcommand_jexprate(Session *s, dumb_ptr, ZString message) { - int rate; - - if (!extract(message, &rate) || !rate) - { - clif_displaymessage(s, - "Please, enter a rate adjustement (usage: @jexprate )."_s); + int rate = extract_rate(s, message); + if (rate < 0) return ATCE::USAGE; - } + battle_config.job_exp_rate = rate; AString output = STRPRINTF("Job XP rate now at %d percent"_fmt, rate); clif_displaymessage(s, output); @@ -1728,14 +1738,10 @@ static ATCE atcommand_droprate(Session *s, dumb_ptr, ZString message) { - int rate; - - if (!extract(message, &rate) || !rate) - { - clif_displaymessage(s, - "Please, enter a rate adjustement (usage: @droprate )."_s); + int rate = extract_rate(s, message); + if (rate < 0) return ATCE::USAGE; - } + battle_config.drop_rate = rate; AString output = STRPRINTF("Drops rate now at %d percent"_fmt, rate); clif_displaymessage(s, output); @@ -1754,6 +1760,7 @@ ATCE atcommand_rates(Session *s, dumb_ptr, return ATCE::OKAY; } + static ATCE atcommand_pvpon(Session *s, dumb_ptr sd, ZString) diff --git a/tools/config.py b/tools/config.py index 49339bd..2f0781d 100755 --- a/tools/config.py +++ b/tools/config.py @@ -602,6 +602,7 @@ def build_config(): battle_conf.opt('base_exp_rate', percent, '100') battle_conf.opt('job_exp_rate', percent, '100') battle_conf.opt('drop_rate', percent, '100') + battle_conf.opt('max_rate', percent, '500') battle_conf.opt('death_penalty_type', i32, '0', min='0', max='2') battle_conf.opt('death_penalty_base', per10kd, '0') battle_conf.opt('death_penalty_job', per10kd, '0') -- cgit v1.2.3-70-g09d2 From 1841311e6302ff88e53446744e571bed703d2087 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Fri, 31 May 2024 09:02:44 +0200 Subject: Change char_conf.max_connect_user back to signed integer This configuration variable changed from signed to unsigned with the move to Python-generated config file parsing in e1418f378c66343a35db3791cbf0d54a4be3fbd3 and c482e420bcf447073ffe3ff8a106a0561e0baadd. Changing it back to signed because it is compared to a signed integer returned from count_users. Also, having it as signed integer allows setting it to a negative value to refuse any user connection. --- tools/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/config.py b/tools/config.py index 2f0781d..f87fe77 100755 --- a/tools/config.py +++ b/tools/config.py @@ -544,7 +544,7 @@ def build_config(): char_conf.opt('char_ip', IP4Address, '{}') char_conf.opt('char_port', u16, '6121', min='1024') char_conf.opt('char_txt', RString, '{}') - char_conf.opt('max_connect_user', u32, '0') + char_conf.opt('max_connect_user', i32, '0') char_conf.opt('autosave_time', seconds, 'DEFAULT_AUTOSAVE_INTERVAL', {char_h}, min='1_s') char_conf.opt('start_point', Point, '{ {"001-1.gat"_s}, 273, 354 }') char_conf.opt('unknown_char_name', CharName, 'stringish("Unknown"_s)') -- cgit v1.2.3-70-g09d2