From 91611102940c34aaf1d94dc31981f5210579c60b Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sat, 9 Dec 2023 13:49:10 -0300 Subject: Theoretically, Drop Rate events can now happen. Except they don't. Untested. --- npc/commands/rate-management.txt | 51 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'npc/commands') diff --git a/npc/commands/rate-management.txt b/npc/commands/rate-management.txt index 52151777b..14c45509d 100644 --- a/npc/commands/rate-management.txt +++ b/npc/commands/rate-management.txt @@ -309,6 +309,57 @@ OnCall: end; +OnPlayerCall: + if ($@CI_MODE) + end; + /* + // GM calls take precedence at any time! + if (.max_hours > 0 || .hours > 0) + end; + */ + // $@DROP_EVENT will determine the boost and should not be above 25% + // Default duration is one hour, or whatever $@DROP_EVENT_TIME is + $@DROP_EVENT=limit(0, $@DROP_EVENT, 100); + $@DROP_EVENT+=.current_rate; + if ($@DROP_EVENT_TIME > 6) { + consolewarn("Tried to set DROP Event Time to %d hours, but max is 6 (no exceptions allowed)", $@DROP_EVENT_TIME); + $@DROP_EVENT_TIME=limit(1, $@DROP_EVENT_TIME, 6); + } + + // If a GM rate-up was running, we will sum the time, too. + // It'll be rounded down. (so 1h + 30m = 1h) FIXME average is better + if (.hours || .max_hours) { + $@DROP_EVENT_TIME+=max(0, .max_hours-.hours-1); + } + + // Default duration is one hour, or whatever $@EXP_EVENT_TIME is + .hours = 0; + .max_hours = $@DROP_EVENT_TIME; + .current_rate = $@DROP_EVENT; + .@new_rate = $@DROP_EVENT; + setbattleflag("item_rate_common", dropRecalc(.@new_rate)); + setbattleflag("item_rate_common_boss", dropRecalc(.@new_rate)); + setbattleflag("item_rate_heal", dropRecalc(.@new_rate)); + setbattleflag("item_rate_heal_boss", dropRecalc(.@new_rate)); + setbattleflag("item_rate_use", dropRecalc(.@new_rate)); + setbattleflag("item_rate_use_boss", dropRecalc(.@new_rate)); + setbattleflag("item_rate_equip", dropRecalc(.@new_rate)); + setbattleflag("item_rate_equip_boss", dropRecalc(.@new_rate)); + setbattleflag("item_rate_card", dropRecalc(.@new_rate)); + setbattleflag("item_rate_card_boss", dropRecalc(.@new_rate)); + charcommand("@reloadmobdb"); + SeasonReload(1); + initnpctimer; // start counting + + .@msg$="Drop Rate was modified to "+$@DROP_EVENT+"% for "+$@DROP_EVENT_TIME+" hour(s)!"; + + announce .@msg$, bc_all; + channelmes("#world", .@msg$); + + $@DROP_EVENT=0; + $@DROP_EVENT_TIME=0; + end; + OnTimer3600000: // runs every hour if (++.hours == .max_hours) { -- cgit v1.2.3-60-g2f50