From f48edef881fc4245f1c5e76f503ceb50b0279c7a Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Tue, 21 Jan 2020 20:54:57 -0300 Subject: EXP/DROP rates now are readjusted at day/night cycle changes During night: EXP +4%, DROP +7% --- npc/commands/rate-management.txt | 82 ++++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 42 deletions(-) (limited to 'npc') diff --git a/npc/commands/rate-management.txt b/npc/commands/rate-management.txt index cff24adeb..a8df73380 100644 --- a/npc/commands/rate-management.txt +++ b/npc/commands/rate-management.txt @@ -2,13 +2,20 @@ - script @exprate 32767,{ end; + function expRateReal { + if (is_night()) + return BCONFN_EXPR; + else + return BCONFD_EXPR; + } + function rateCleanUp { stopnpctimer; .hours = 0; .max_hours = 0; - .current_rate = .original_exp_rate; - setbattleflag("base_exp_rate", .original_exp_rate); - setbattleflag("job_exp_rate", .original_exp_rate); + .current_rate = expRateReal(); + setbattleflag("base_exp_rate", expRateReal()); + setbattleflag("job_exp_rate", expRateReal()); charcommand("@reloadmobdb"); // this is on purpose (callable without RID) SeasonReload(1); channelmes("#world", "The EXP Rate Bonus is now over."); @@ -32,7 +39,7 @@ OnCall: if (.@new_rate > 0) { // Overwriting previous rate? // Confirmation Required - if (.current_rate != .original_exp_rate) { + if (.current_rate != expRateReal()) { setnpcdialogtitle("@rate-managment"); mesc l("WARNING!"), 1; mesc l("A previous exp rate up event is already ongoing."), 1; @@ -63,18 +70,18 @@ OnCall: channelmes("#world", .@msg$); //dispbottom l("You successfully set the exp rate to @@%. It will reset to @@% (default value) in @@.", - // .@new_rate, .original_exp_rate, FuzzyTime(time_from_hours(.max_hours), 2, 2)); + // .@new_rate, expRateReal(), FuzzyTime(time_from_hours(.max_hours), 2, 2)); dispbottom l("You can also manually stop it at any time with: @exprate default"); } else if (.@new_rate == 0 && .@special$ == "") { // get current exp rate - if (.current_rate == .original_exp_rate) { + if (.current_rate == expRateReal()) { atcommand("@rates"); dispbottom col(l("Usage of @exprate without argument is deprecated, please use \"@rates\" instead."), 1); } else { dispbottom l("Current exp rate is set to @@%, and will reset to @@% (default value) in @@.", - .current_rate, .original_exp_rate, remainingTime()); + .current_rate, expRateReal(), remainingTime()); dispbottom l("If you meant to reset the exp rate to its default value: @exprate default"); } @@ -84,7 +91,7 @@ OnCall: // reset rateCleanUp; dispbottom l("Exp rate has been reset to @@% (default value).", - .original_exp_rate); + expRateReal()); } end; @@ -146,8 +153,7 @@ OnInit: bindatcmd "exprate", "@exprate::OnCall", 80, 80, 1; // change exp rate // WARNING: using @reloadscript will change the "original" value - .original_exp_rate = 100;//getbattleflag("base_exp_rate"); - .current_rate = .original_exp_rate; + .current_rate = expRateReal(); // XXX: maybe in the future: //.original_job_rate = getbattleflag("base_job_rate"); @@ -169,21 +175,28 @@ OnReload: - script @droprate 32767,{ end; + function dropRateReal { + if (is_night()) + return BCONFN_DROP; + else + return BCONFD_DROP; + } + function rateCleanUp { stopnpctimer; .hours = 0; .max_hours = 0; - .current_rate = 100; - setbattleflag("item_rate_common", 100); - setbattleflag("item_rate_common_boss", 100); - setbattleflag("item_rate_heal", 100); - setbattleflag("item_rate_heal_boss", 100); - setbattleflag("item_rate_use", 100); - setbattleflag("item_rate_use_boss", 100); - setbattleflag("item_rate_equip", 100); - setbattleflag("item_rate_equip_boss", 100); - setbattleflag("item_rate_card", 100); - setbattleflag("item_rate_card_boss", 100); + .current_rate = dropRateReal(); + setbattleflag("item_rate_common", dropRateReal()); + setbattleflag("item_rate_common_boss", dropRateReal()); + setbattleflag("item_rate_heal", dropRateReal()); + setbattleflag("item_rate_heal_boss", dropRateReal()); + setbattleflag("item_rate_use", dropRateReal()); + setbattleflag("item_rate_use_boss", dropRateReal()); + setbattleflag("item_rate_equip", dropRateReal()); + setbattleflag("item_rate_equip_boss", dropRateReal()); + setbattleflag("item_rate_card", dropRateReal()); + setbattleflag("item_rate_card_boss", dropRateReal()); charcommand("@reloadmobdb"); // this is on purpose (callable without RID) - no idea what is the purpose SeasonReload(1); channelmes("#world", "The Drop Rate Bonus is now over."); @@ -225,22 +238,22 @@ OnCall: SeasonReload(1); initnpctimer; // start counting - .@msg$=strcharinfo(0)+" increased drop rates to "+str(.@new_rate)+"%. It will only last "+str(FuzzyTime(time_from_hours(.max_hours), 2, 2))+"!"; + .@msg$=strcharinfo(0)+" modified drop rates to "+str(.@new_rate)+"%. It will only last "+str(FuzzyTime(time_from_hours(.max_hours), 2, 2))+"!"; announce .@msg$, bc_all; channelmes("#world", .@msg$); //dispbottom l("You successfully set the drop rate to @@%. It will reset to @@% (default value) in @@.", - // .@new_rate, .org_dcn, FuzzyTime(time_from_hours(.max_hours), 2, 2)); + // .@new_rate, dropRateReal(), FuzzyTime(time_from_hours(.max_hours), 2, 2)); dispbottom l("You can also manually stop it at any time with: @droprate default"); } else if (.@new_rate == 0 && .@special$ == "") { // get current exp rate - if (.current_rate == .org_dcn) { + if (.current_rate == dropRateReal()) { atcommand("@rates"); dispbottom col(l("Usage of @exprate without argument is deprecated, please use \"@rates\" instead."), 1); } else { dispbottom l("Current drop rate is set to @@%, and will reset to @@% (default value) in @@.", - .current_rate, .org_dcn, remainingTime()); + .current_rate, dropRateReal(), remainingTime()); dispbottom l("If you meant to reset the drop rate to its default value: @droprate default"); } } @@ -250,7 +263,7 @@ OnCall: // reset rateCleanUp; dispbottom l("Drop rate has been reset to @@% (default value).", - .org_dcn); + dropRateReal()); } end; @@ -275,22 +288,7 @@ OnInit: bindatcmd "droprate", "@droprate::OnCall", 80, 80, 1; // change drop rate // WARNING: using @reloadscript will change the "original" value, use @reloadbattleconf before! - .org_dcn = 100;//getbattleflag("item_rate_common"); - .org_dcb = 100;//getbattleflag("item_rate_common_boss"); - .org_dhn = 100;//getbattleflag("item_rate_heal"); - .org_dhb = 100;//getbattleflag("item_rate_heal_boss"); - .org_dun = 100;//getbattleflag("item_rate_use"); - .org_dub = 100;//getbattleflag("item_rate_use_boss"); - .org_den = 100;//getbattleflag("item_rate_equip"); - .org_deb = 100;//getbattleflag("item_rate_equip_boss"); - .org_dxn = 100;//getbattleflag("item_rate_card"); - .org_dxb = 100;//getbattleflag("item_rate_card_boss"); - .current_rate = 100; - - // XXX: maybe in the future: - //.original_job_rate = getbattleflag("base_job_rate"); - //.original_pk_mode = getbattleflag("pk_mode"); - //.original_death_penalty = getbattleflag("death_penalty_type"); + .current_rate = dropRateReal(); //force_refreshall(); end; -- cgit v1.2.3-60-g2f50