summaryrefslogtreecommitdiff
path: root/npc
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-03-12 11:20:58 -0300
committerJesusaves <cpntb1@ymail.com>2019-03-12 11:20:58 -0300
commit96798d71698a168dc2eb4d8d6ec7637957fb9230 (patch)
treedb4f490d443d35e975dd83debfacf90194127b45 /npc
parent5963941a6950d0941ca7d6ba8c0ed81155652d79 (diff)
downloadserverdata-96798d71698a168dc2eb4d8d6ec7637957fb9230.tar.gz
serverdata-96798d71698a168dc2eb4d8d6ec7637957fb9230.tar.bz2
serverdata-96798d71698a168dc2eb4d8d6ec7637957fb9230.tar.xz
serverdata-96798d71698a168dc2eb4d8d6ec7637957fb9230.zip
In theory, this implements St. Patrick Day.
And sets all Events to start on their own so GMs can miss the date. This script takes precedence over @event.
Diffstat (limited to 'npc')
-rw-r--r--npc/commands/event.txt105
-rw-r--r--npc/functions/event.txt253
-rw-r--r--npc/scripts.conf1
3 files changed, 309 insertions, 50 deletions
diff --git a/npc/commands/event.txt b/npc/commands/event.txt
index ace0c1ba3..48dd5bef5 100644
--- a/npc/commands/event.txt
+++ b/npc/commands/event.txt
@@ -6,56 +6,8 @@
// Description:
// Handles all major events on TMW2 (Christmas, Easter, Worker Day, etc.)
-function script GlobalEventMenu {
-
- function resetCandor {
- $@FEFE_CAVE_LEVEL=0;
- $@FEFE_DELAY=0;
- $@FEFE_DIFFICULTY=0;
- $@FEFE_CAVE_HERO$="";
- mesc "Candor Fight Reset!";
- return;
- }
-
- function rateManagement {
- clear;
- mes l("To get the current rate:");
- mes col(" @exprate", 7);
- next;
- mes l("To set the exp rate:");
- mes col(" @exprate ##Brate##b hours", 7);
- next;
- mes l("To reset back to normal:");
- mes col(" @exprate default", 7); // note to translators: any non-numerical value will reset so "default" is safe to translate
- next;
- return;
- }
-
- function dropManagement {
- clear;
- mes l("To get the current rate:");
- mes col(" @rates", 7);
- next;
- mes l("To set the drop rate:");
- mes col(" @droprate ##Brate##b hours", 7);
- next;
- mes l("To reset back to normal:");
- mes col(" @droprate default", 7); // note to translators: any non-numerical value will reset so "default" is safe to translate
- next;
- return;
- }
-
- // Easter is map-only, so it can be handled here instead of seasons.txt
- function sEaster {
-
- // Enable event
- set $EVENT$, "Easter";
- logmes "Enabled EASTER event.", LOGMES_ATCOMMAND;
- return;
- }
-
- // WARNING, possibly dangerous.
- function sClear {
+// WARNING, possibly dangerous.
+function script sClear {
// Delete all Easter Stuff
if ($EVENT$ != "Easter") {
DelItemFromEveryPlayer(GoldenEasteregg);
@@ -102,11 +54,64 @@ function script GlobalEventMenu {
enablenpc "Demure#ValentineFinal";
}
+ // Simpler events
+ $PATRICK_DAYCTRL=0;
+ $PATRICK_DAYMAX=0;
+
// We must remove any event drop
charcommand("@reloadmobdb");
SeasonReload(1);
}
+function script GlobalEventMenu {
+
+ function resetCandor {
+ $@FEFE_CAVE_LEVEL=0;
+ $@FEFE_DELAY=0;
+ $@FEFE_DIFFICULTY=0;
+ $@FEFE_CAVE_HERO$="";
+ mesc "Candor Fight Reset!";
+ return;
+ }
+
+ function rateManagement {
+ clear;
+ mes l("To get the current rate:");
+ mes col(" @exprate", 7);
+ next;
+ mes l("To set the exp rate:");
+ mes col(" @exprate ##Brate##b hours", 7);
+ next;
+ mes l("To reset back to normal:");
+ mes col(" @exprate default", 7); // note to translators: any non-numerical value will reset so "default" is safe to translate
+ next;
+ return;
+ }
+
+ function dropManagement {
+ clear;
+ mes l("To get the current rate:");
+ mes col(" @rates", 7);
+ next;
+ mes l("To set the drop rate:");
+ mes col(" @droprate ##Brate##b hours", 7);
+ next;
+ mes l("To reset back to normal:");
+ mes col(" @droprate default", 7); // note to translators: any non-numerical value will reset so "default" is safe to translate
+ next;
+ return;
+ }
+
+ // Easter is map-only, so it can be handled here instead of seasons.txt
+ function sEaster {
+
+ // Enable event
+ set $EVENT$, "Easter";
+ logmes "Enabled EASTER event.", LOGMES_ATCOMMAND;
+ return;
+ }
+
+
diff --git a/npc/functions/event.txt b/npc/functions/event.txt
new file mode 100644
index 000000000..2ed0a60c8
--- /dev/null
+++ b/npc/functions/event.txt
@@ -0,0 +1,253 @@
+// TMW2 scripts.
+// Authors:
+// Jesusalva
+// Description:
+// Controls world events so Saulc and I can take vacations.
+// The event specifics are more often scattered accross seasons.txt, command/event.txt
+// 003-1/events.txt, soulmenhir.txt and, of course, the event maps (if any).
+// Schedule, if needed to change, can be found in the OnInit loop.
+// An event, obviously, cannot last more than 7... 15 days at WORST.
+// Therefore, month checks aren't included in day checks.
+
+- script sPatrick NPC_HIDDEN,{
+OnInit:
+ setarray .maps$,
+ "005-1",
+ "013-1",
+ "014-1",
+ "014-2",
+ "014-3",
+ "014-4",
+ "014-5",
+ "017-1",
+ "018-2",
+ "018-4",
+ "018-5",
+ "soren";
+ end;
+OnMyMobDeath:
+ end;
+OnClock0000:
+OnClock6000:
+OnClock1200:
+OnClock1800:
+ .@d=gettime(GETTIME_DAYOFMONTH);
+ // Patrick Day should work only in 2 luck days according to Saulc
+ // If this is required use $PATRICK_DAYCTRL so the days before $@PATRICK_DAYMAX
+ // act with 100% chances (determinism).
+ // As it is being spawn 4 times at a day (like TMW-BR events), because it is
+ // flatly and outright IMPOSSIBLE to add a permanent spawn, that is not required.
+ if ($EVENT$ == "St. Patrick" && .@d <= $@PATRICK_DAYMAX) {
+ for (.@i=0; .@i < getarraysize(.maps$); .@i++) {
+ .@m$=.maps$[.@i];
+ .@x=getmapinfo(MAPINFO_SIZE_X, .@m$)-20;
+ .@y=getmapinfo(MAPINFO_SIZE_Y, .@m$)-20;
+
+ // Remove previously spawned clovers
+ killmonster(.@m$, "sPatrick::OnMyMobDeath");
+ // It is one clover for each 225 tiles (about a 25x25 square)
+ .@maparea=(.@x-20)*(.@y-20);
+ .@mobs=max(1, .@maparea/225);
+ areamonster .@m$, 20, 20, .@x, .@y, strmobinfo(1, StPatricksClover), StPatricksClover, .@mobs, "sPatrick::OnMyMobDeath";
+ }
+ }
+ end;
+
+// Remove previously spawned clovers for event end
+// And then disables the NPC
+OnCleanUp:
+ for (.@i=0; .@i < getarraysize(.maps$); .@i++) {
+ .@m$=.maps$[.@i];
+ killmonster(.@m$, "sPatrick::OnMyMobDeath");
+ }
+ disablenpc "sPatrick";
+ end;
+}
+
+000-0,0,0,0 script #EventCore NPC_HIDDEN,{
+ end;
+
+// Event Schedule (all dates are inclusive)
+OnInit:
+ .valentine_stday=12;
+ .valentine_stmon=FEBRUARY;
+ .valentine_endday=15;
+ .valentine_endmon=FEBRUARY;
+
+ .patrick_stday=15;
+ .patrick_stmon=MARCH;
+ .patrick_endday=19;
+ .patrick_endmon=MARCH;
+
+ .easter_stday=17;
+ .easter_stmon=APRIL;
+ .easter_endday=24;
+ .easter_endmon=APRIL;
+
+ .worker_stday=27;
+ .worker_stmon=APRIL;
+ .worker_endday=3;
+ .worker_endmon=MAY;
+
+ .xmas_stday=19;
+ .xmas_stmon=DECEMBER;
+ .xmas_endday=2;
+ .xmas_endmon=JANUARY;
+
+ // Some setup
+ disablenpc "sPatrick";
+
+// Check for events every midnight
+OnClock0000:
+ .@d=gettime(GETTIME_DAYOFMONTH);
+ .@m=gettime(GETTIME_MONTH);
+
+ // Handle Valentine Day
+ if (.@m >=.valentine_stmon && .@m <= .valentine_endmon) {
+ // It's tomorrow: Send out an announcement
+ if (.@d == .valentine_stday - 1) {
+ channelmes("#world", "Valentine Day will start tomorrow!");
+ announce l("Valentine Day will start tomorrow!"), bc_all|bc_npc;
+ }
+ // Last Day: Send out an announcement
+ if (.@d == .valentine_endday - 1) {
+ channelmes("#world", "It's the last day for Valentine Event! Hurry up!");
+ announce l("t's the last day for Valentine Event! Hurry up!"), bc_all|bc_npc;
+ }
+ // Begin the event
+ if (.@d == .valentine_stday) {
+ channelmes("#world", "Valentine Day begun!");
+ announce l("Valentine Day begun!"), bc_all|bc_npc;
+ $EVENT$="Valentine";
+ $@VALENTINE_LOVELETTER = htnew();
+ $@VALENTINE_GIFTSTACKS = htnew();
+ }
+ // End the event the day after
+ if (.@d == .valentine_endday+1) {
+ channelmes("#world", "Valentine Day ended!");
+ announce l("Valentine Day ended!"), bc_all|bc_npc;
+ sClear();
+ $EVENT$="";
+ }
+ }
+
+
+ // Handle St. Patrick Day
+ // During this day, a special four leaf clover is spawned daily, at 4 times in the day
+ // in all forests: 6:00, 12:00, 18:00 and 00:00.
+ // $PATRICK_DAYMAX
+ if (.@m >=.patrick_stmon && .@m <= .patrick_endmon) {
+ // It's tomorrow: Send out an announcement
+ if (.@d == .patrick_stday - 1) {
+ channelmes("#world", "St. Patrick Day will start tomorrow!");
+ announce l("St. Patrick Day will start tomorrow!"), bc_all|bc_npc;
+ }
+ // Last Day: Send out an announcement
+ if (.@d == .patrick_endday - 1) {
+ channelmes("#world", "It's the last day for St. Patrick Event! Hurry up!");
+ announce l("t's the last day for St. Patrick Event! Hurry up!"), bc_all|bc_npc;
+ }
+ // Begin the event
+ if (.@d == .patrick_stday) {
+ channelmes("#world", "St. Patrick Day begun!");
+ announce l("St. Patrick Day begun!"), bc_all|bc_npc;
+ $EVENT$="St. Patrick";
+ $@PATRICK_DAYMAX=.patrick_endday;
+ enablenpc "sPatrick";
+ }
+ // End the event the day after
+ if (.@d == .patrick_endday+1) {
+ channelmes("#world", "St. Patrick Day ended!");
+ announce l("St. Patrick Day ended!"), bc_all|bc_npc;
+ sClear();
+ $EVENT$="";
+ donpcevent "sPatrick::OnCleanUp";
+ }
+ }
+
+ // Handle Easter
+ if (.@m >=.easter_stmon && .@m <= .easter_endmon) {
+ // It's tomorrow: Send out an announcement
+ if (.@d == .easter_stday - 1) {
+ channelmes("#world", "Easter will start tomorrow!");
+ announce l("Easter will start tomorrow!"), bc_all|bc_npc;
+ }
+ // Last Day: Send out an announcement
+ if (.@d == .easter_endday - 1) {
+ channelmes("#world", "It's the last day for Easter Event! Hurry up!");
+ announce l("t's the last day for Easter Event! Hurry up!"), bc_all|bc_npc;
+ }
+ // Begin the event
+ if (.@d == .easter_stday) {
+ channelmes("#world", "Easter begun!");
+ announce l("Easter begun!"), bc_all|bc_npc;
+ $EVENT$="Easter";
+ }
+ // End the event the day after
+ if (.@d == .easter_endday+1) {
+ channelmes("#world", "Easter ended!");
+ announce l("Easter ended!"), bc_all|bc_npc;
+ sClear();
+ $EVENT$="";
+ }
+ }
+
+ // Handle Worker Day
+ if (.@m >=.worker_stmon && .@m <= .worker_endmon) {
+ // It's tomorrow: Send out an announcement
+ if (.@d == .worker_stday - 1) {
+ channelmes("#world", "Worker Day will start tomorrow!");
+ announce l("Worker Day will start tomorrow!"), bc_all|bc_npc;
+ }
+ // Last Day: Send out an announcement
+ if (.@d == .worker_endday - 1) {
+ channelmes("#world", "It's the last day for Worker Day Event! Hurry up!");
+ announce l("t's the last day for Worker Day Event! Hurry up!"), bc_all|bc_npc;
+ }
+ // Begin the event
+ if (.@d == .worker_stday) {
+ channelmes("#world", "Worker Day begun!");
+ announce l("Worker Day begun!"), bc_all|bc_npc;
+ $EVENT$="Worker Day";
+ }
+ // End the event the day after
+ if (.@d == .worker_endday+1) {
+ channelmes("#world", "Worker Day ended!");
+ announce l("Worker Day ended!"), bc_all|bc_npc;
+ sClear();
+ $EVENT$="";
+ }
+ }
+
+
+ // Handle Christmas
+ if (.@m >=.xmas_stmon && .@m <= .xmas_endmon) {
+ // It's tomorrow: Send out an announcement
+ if (.@d == .xmas_stday - 1) {
+ channelmes("#world", "Christmas will start tomorrow!");
+ announce l("Christmas will start tomorrow!"), bc_all|bc_npc;
+ }
+ // Last Day: Send out an announcement
+ if (.@d == .xmas_endday - 1) {
+ channelmes("#world", "It's the last day for Christmas Event! Hurry up!");
+ announce l("t's the last day for Christmas Event! Hurry up!"), bc_all|bc_npc;
+ }
+ // Begin the event
+ if (.@d == .xmas_stday) {
+ channelmes("#world", "Christmas begun!");
+ announce l("Christmas begun!"), bc_all|bc_npc;
+ $EVENT$="Christmas";
+ query_sql("DELETE FROM `quest` WHERE `quest_id` = '"+SQuest_Christmas+"'");
+ sChristmas();
+ }
+ // End the event the day after
+ if (.@d == .xmas_endday+1) {
+ channelmes("#world", "Christmas ended!");
+ announce l("Christmas ended!"), bc_all|bc_npc;
+ sClear();
+ $EVENT$="";
+ }
+ }
+ end;
+}
+
diff --git a/npc/scripts.conf b/npc/scripts.conf
index 59b8168df..dd0397c48 100644
--- a/npc/scripts.conf
+++ b/npc/scripts.conf
@@ -38,6 +38,7 @@
"npc/functions/bank.txt",
"npc/functions/daily.txt",
"npc/functions/doors.txt",
+"npc/functions/event.txt",
"npc/functions/fishing.txt",
"npc/functions/hammocks.txt",
"npc/functions/lockpicks.txt",