diff options
-rwxr-xr-x | git/hooks/post-merge | 17 | ||||
-rw-r--r-- | npc/annuals/fathertime.txt | 46 |
2 files changed, 42 insertions, 21 deletions
diff --git a/git/hooks/post-merge b/git/hooks/post-merge deleted file mode 100755 index 8a8b6bfc..00000000 --- a/git/hooks/post-merge +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# Copy or symlink this into your .git/hooks directory. -# E.g., from the top: -# ln -s ../../git/hooks/post-merge .git/hooks -# or cp git/hooks/post-merge .git/hooks -# It may also be beneficial to install as a post-checkout hook - -# If we have local changes in the submodule, rebase or merge them -# (rebase is better but dangerous in some circumstances) -# git submodule update --rebase -git submodule update --merge -make news - -# WARNING: to people with push access. -# it is essential that changes to the client data be pushed before changes to server data -# Also, you may find this useful: (you should always clone using the git:// url) -# git config --global url.git@github.com:.pushInsteadOf git://github.com diff --git a/npc/annuals/fathertime.txt b/npc/annuals/fathertime.txt index 6a92e7dc..bb2361a1 100644 --- a/npc/annuals/fathertime.txt +++ b/npc/annuals/fathertime.txt @@ -2,17 +2,55 @@ end; OnInit: + .evtc = htnew; // event : time in seconds if (debug >= 2) end; - donpcevent strnpcinfo(0) + "::OnTimer20000"; - end; OnClock0000: -OnTimer20000: donpcevent "#XmasConfig::OnCommandRestartQuest"; donpcevent "#HalloweenConfig::OnCommandRestartQuest"; donpcevent "Easter Eggs::OnCheckEaster"; - //initnpctimer; + initnpctimer; + end; + +OnTimer1000: + // There are no NPC timers ongoing, loop forever + if (!htsize(.evtc)) { + initnpctimer; + end; + } + // Otherwise, we got a job to do + .@hti = htiterator(.evtc); + .@cur = gettimetick(2); + for (.@key$ = htinextkey(.@hti); hticheck(.@hti); .@key$ = htinextkey(.@hti)) + { + .@target=htget(.evtc, .@key$, 0); + // Not yet expired + if (.@target > .@cur) + continue; + // Execute NPC Event after removing it from hashtable + htput(.evtc, .@key$, 0); + donpcevent(.@key$); + } + // Deallocate memory and cycle forever + htidelete(.@hti); + initnpctimer; end; + +public function addnpcevent { + .@ev$=getarg(1); + .@t=getarg(0); + htput(.evtc, .@ev$, gettimetick(2)+.@t); + return true; +} + +// NPC Father Time end +} + +function script addnpctimer { + .@t=getarg(0)/1000; + .@ev$=getarg(1); + "#HolidayConfig"::addnpcevent(.@t, .@ev$); + return true; } function script TMWBirthday { |