summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFedja Beader <fedja@protonmail.ch>2024-04-10 16:43:21 +0200
committerFedja Beader <fedja@protonmail.ch>2024-04-10 16:43:57 +0200
commitdc9c104ad231e6ba9f695072d36d586e2e3d3d4c (patch)
tree4c59694522a5c8f25bc06de6daa1e6804df5d293 /src
parent0fb2ce09aeec67550a41f7027db5b68a6a8b06d7 (diff)
downloadtmwa-dc9c104ad231e6ba9f695072d36d586e2e3d3d4c.tar.gz
tmwa-dc9c104ad231e6ba9f695072d36d586e2e3d3d4c.tar.bz2
tmwa-dc9c104ad231e6ba9f695072d36d586e2e3d3d4c.tar.xz
tmwa-dc9c104ad231e6ba9f695072d36d586e2e3d3d4c.zip
Add server-wide drop rates modifier
Diffstat (limited to 'src')
-rw-r--r--src/map/atcommand.cpp28
-rw-r--r--src/map/mob.cpp3
2 files changed, 28 insertions, 3 deletions
diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp
index 6901437..20743dd 100644
--- a/src/map/atcommand.cpp
+++ b/src/map/atcommand.cpp
@@ -1725,12 +1725,31 @@ ATCE atcommand_jexprate(Session *s, dumb_ptr<map_session_data>,
}
static
+ATCE atcommand_droprate(Session *s, dumb_ptr<map_session_data>,
+ ZString message)
+{
+ int rate;
+
+ if (!extract(message, &rate) || !rate)
+ {
+ clif_displaymessage(s,
+ "Please, enter a rate adjustement (usage: @droprate <percent>)."_s);
+ return ATCE::USAGE;
+ }
+ battle_config.drop_rate = rate;
+ AString output = STRPRINTF("Drops rate now at %d percent"_fmt, rate);
+ clif_displaymessage(s, output);
+ return ATCE::OKAY;
+}
+
+static
ATCE atcommand_rates(Session *s, dumb_ptr<map_session_data>,
ZString message)
{
AString output = STRPRINTF(
- "Experience rates: Base %d%% / Job %d%%. Drop rate: 100%%"_fmt,
- battle_config.base_exp_rate, battle_config.job_exp_rate);
+ "Experience rates: Base %d%% / Job %d%%. Drop rate: %d%%"_fmt,
+ battle_config.base_exp_rate, battle_config.job_exp_rate,
+ battle_config.drop_rate);
clif_displaymessage(s, output);
return ATCE::OKAY;
}
@@ -5644,9 +5663,12 @@ Map<XString, AtCommandInfo> atcommand_info =
{"jexprate"_s, {"<percent>"_s,
60, atcommand_jexprate,
"Set job exp rate"_s}},
+ {"droprate"_s, {"<percent>"_s,
+ 60, atcommand_droprate,
+ "Set drop rate"_s}},
{"rates"_s, {""_s,
0, atcommand_rates,
- "Show base and job exp rates"_s}},
+ "Show base and job exp and drop rates"_s}},
{"pvpon"_s, {""_s,
60, atcommand_pvpon,
"Disable PvP on your map"_s}},
diff --git a/src/map/mob.cpp b/src/map/mob.cpp
index 4fd9d6d..f2f6815 100644
--- a/src/map/mob.cpp
+++ b/src/map/mob.cpp
@@ -2736,6 +2736,9 @@ int mob_damage(dumb_ptr<block_list> src, dumb_ptr<mob_data> md, int damage,
if (sd && md && battle_config.pk_mode == 1
&& (get_mob_db(md->mob_class).lv - sd->status.base_level >= 20))
drop_rate.num *= 1.25; // pk_mode increase drops if 20 level difference [Valaris]
+
+ // server-wide drop rate scaling
+ drop_rate.num = (drop_rate.num * battle_config.drop_rate) / 100;
if (!random_::chance(drop_rate))
continue;