diff options
author | Reid <reidyaro@gmail.com> | 2017-08-23 00:27:37 +0200 |
---|---|---|
committer | Reid <reidyaro@gmail.com> | 2017-08-23 00:30:47 +0200 |
commit | 2642522b257f812b3f0cddba7a9aff93b3de9f02 (patch) | |
tree | 0c6392f625cb8c093080b06e2ffbac5dade52ee4 /npc/functions/util.txt | |
parent | 35ddc787d3a377487bece2cef051913f344d32c2 (diff) | |
download | serverdata-2642522b257f812b3f0cddba7a9aff93b3de9f02.tar.gz serverdata-2642522b257f812b3f0cddba7a9aff93b3de9f02.tar.bz2 serverdata-2642522b257f812b3f0cddba7a9aff93b3de9f02.tar.xz serverdata-2642522b257f812b3f0cddba7a9aff93b3de9f02.zip |
Replace tabs by space on confused-tree.
Add different directions according to the season.
Change the confused tree NPC ID to 400.
Diffstat (limited to 'npc/functions/util.txt')
-rw-r--r-- | npc/functions/util.txt | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/npc/functions/util.txt b/npc/functions/util.txt new file mode 100644 index 00000000..fb4541f8 --- /dev/null +++ b/npc/functions/util.txt @@ -0,0 +1,35 @@ +// Evol functions. +// Authors: +// Reid +// Description: +// Util functions + + +// season_direction({day, month}) +// returns the direction that represents our current season (approximation) +// DOWN: Winter, 21/12 +// DOWNLEFT: Spring, 20/03 +// LEFT: Summer, 21/06 +// LEFTUP: Autumn, 22/09 + +function script season_direction { + .@current_month = getarg(0, gettime(GETTIME_MONTH)); + + if (.@current_month % 3 == 0) + { + .@current_day = getarg(1, gettime(GETTIME_DAYOFMONTH)); + + switch (.@current_month) + { + case MARCH: .@season_day = 20; break; + case JUNE: .@season_day = 21; break; + case SEPTEMBER: .@season_day = 22; break; + case DECEMBER: .@season_day = 21; break; + default: break; + } + + .@is_after_season_day = .@current_day >= .@season_day ? 0 : -1; + } + + return (.@current_month / 3 + .@is_after_season_day) % 4; +} |