summaryrefslogtreecommitdiff
path: root/npc
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2018-12-23 15:38:59 -0200
committerJesusaves <cpntb1@ymail.com>2018-12-23 15:38:59 -0200
commit9f4f607e4a88b651ca1cd6eb38ea69c77d6633a8 (patch)
tree21eac1d9257d2a424ca1433e6f3806d380393fe2 /npc
parent5db3f4ef79f98bf8987be3e569b54ca03b0e317f (diff)
downloadserverdata-9f4f607e4a88b651ca1cd6eb38ea69c77d6633a8.tar.gz
serverdata-9f4f607e4a88b651ca1cd6eb38ea69c77d6633a8.tar.bz2
serverdata-9f4f607e4a88b651ca1cd6eb38ea69c77d6633a8.tar.xz
serverdata-9f4f607e4a88b651ca1cd6eb38ea69c77d6633a8.zip
Handle exp/drop rate changes on day/night cycle changes.
Diffstat (limited to 'npc')
-rw-r--r--npc/commands/rate-management.txt73
-rw-r--r--npc/functions/weather.txt4
2 files changed, 49 insertions, 28 deletions
diff --git a/npc/commands/rate-management.txt b/npc/commands/rate-management.txt
index d2ef19ec7..dea8eec76 100644
--- a/npc/commands/rate-management.txt
+++ b/npc/commands/rate-management.txt
@@ -89,15 +89,24 @@ OnInit:
bindatcmd "exprate", "@exprate::OnCall", 80, 80, 1; // change exp rate
// WARNING: using @reloadscript will change the "original" value
- .original_exp_rate = getbattleflag("base_exp_rate");
- .original_quest_rate = getbattleflag("quest_exp_rate");
+ .original_exp_rate = 100;//getbattleflag("base_exp_rate");
+ .original_quest_rate = 100;//getbattleflag("quest_exp_rate");
.current_rate = .original_exp_rate;
// XXX: maybe in the future:
- //.original_item_rate = getbattleflag("item_rate_common");
//.original_job_rate = getbattleflag("base_job_rate");
//.original_pk_mode = getbattleflag("pk_mode");
//.original_death_penalty = getbattleflag("death_penalty_type");
+ end;
+
+OnReload:
+ .@new_rate = .current_rate;
+ setbattleflag("base_exp_rate", .@new_rate);
+ //setbattleflag("quest_exp_rate", .@new_rate);
+ charcommand("@reloadmobdb");
+ //charcommand("@reloadquestdb");
+ SeasonReload(1);
+ end;
}
@@ -165,21 +174,13 @@ OnCall:
//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));
dispbottom l("You can also manually stop it at any time with: @droprate default");
- }
-
- else if (.@new_rate == 0 && .@special$ == "")
- {
+ } else if (.@new_rate == 0 && .@special$ == "") {
// get current exp rate
- if (.current_rate == .org_dcn)
- {
+ if (.current_rate == .org_dcn) {
dispbottom l("Current drop rate is set to @@% (default value).", .current_rate);
- }
-
- else
- {
+ } else {
dispbottom l("Current drop rate is set to @@%, and will reset to @@% (default value) in @@.",
.current_rate, .org_dcn, remainingTime());
-
dispbottom l("If you meant to reset the drop rate to its default value: @droprate default");
}
}
@@ -196,8 +197,7 @@ OnCall:
OnTimer3600000:
// runs every hour
- if (++.hours == .max_hours)
- {
+ if (++.hours == .max_hours) {
rateCleanUp;
end;
}
@@ -205,8 +205,7 @@ OnTimer3600000:
end;
OnPCLoginEvent:
- if (.max_hours > 0)
- {
+ if (.max_hours > 0) {
dispbottom col(l("Drop rate is set to @@% for the next @@.",
.current_rate, remainingTime()), 6);
}
@@ -216,20 +215,38 @@ OnInit:
bindatcmd "droprate", "@droprate::OnCall", 80, 80, 1; // change drop rate
// WARNING: using @reloadscript will change the "original" value, use @reloadbattleconf before!
- .org_dcn = getbattleflag("item_rate_common");
- .org_dcb = getbattleflag("item_rate_common_boss");
- .org_dhn = getbattleflag("item_rate_heal");
- .org_dhb = getbattleflag("item_rate_heal_boss");
- .org_dun = getbattleflag("item_rate_use");
- .org_dub = getbattleflag("item_rate_use_boss");
- .org_den = getbattleflag("item_rate_equip");
- .org_deb = getbattleflag("item_rate_equip_boss");
- .org_dxn = getbattleflag("item_rate_card");
- .org_dxb = getbattleflag("item_rate_card_boss");
+ .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 = .org_dcn;
// 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");
+ end;
+
+OnReload:
+ .@new_rate = .current_rate;
+ setbattleflag("item_rate_common", .@new_rate);
+ setbattleflag("item_rate_common_boss", .@new_rate);
+ setbattleflag("item_rate_heal", .@new_rate);
+ setbattleflag("item_rate_heal_boss", .@new_rate);
+ setbattleflag("item_rate_use", .@new_rate);
+ setbattleflag("item_rate_use_boss", .@new_rate);
+ setbattleflag("item_rate_equip", .@new_rate);
+ setbattleflag("item_rate_equip_boss", .@new_rate);
+ setbattleflag("item_rate_card", .@new_rate);
+ setbattleflag("item_rate_card_boss", .@new_rate);
+ charcommand("@reloadmobdb");
+ SeasonReload(1);
+ end;
+
}
diff --git a/npc/functions/weather.txt b/npc/functions/weather.txt
index 9fbaec805..06770e948 100644
--- a/npc/functions/weather.txt
+++ b/npc/functions/weather.txt
@@ -165,10 +165,14 @@ OnMinute45:
announce("The night falls.", bc_all|bc_npc);
setbattleflag("mob_spawn_delay", 70);
charcommand("@reloadbattleconf"); // Careful!
+ donpcevent("@exprate::OnReload");
+ donpcevent("@droprate::OnReload");
} else if (!is_night() && $@WEATHER_NIGHT) {
announce("The day rises.", bc_all|bc_npc);
setbattleflag("mob_spawn_delay", 100);
charcommand("@reloadbattleconf"); // Careful!
+ donpcevent("@exprate::OnReload");
+ donpcevent("@droprate::OnReload");
}
$@WEATHER_NIGHT=is_night();