diff options
author | Jesusaves <cpntb1@ymail.com> | 2019-05-11 17:01:29 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2019-05-11 17:01:29 -0300 |
commit | d6f939f0072cac5d8988a0a7f67d39a048f77194 (patch) | |
tree | 373a67243da31cca00c22158e8f4149dcc768776 /npc/functions/util.txt | |
parent | b10f74c33d3d6021f26b31ba4ce6a030ee6c1609 (diff) | |
parent | 1a51dc5fb3d0f3525e48bb255500d665ed5f93b4 (diff) | |
download | serverdata-jesusalva/feather.tar.gz serverdata-jesusalva/feather.tar.bz2 serverdata-jesusalva/feather.tar.xz serverdata-jesusalva/feather.zip |
Merge branch 'master' into jesusalva/featherjesusalva/feather
Diffstat (limited to 'npc/functions/util.txt')
-rw-r--r-- | npc/functions/util.txt | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/npc/functions/util.txt b/npc/functions/util.txt index d5fe8bc4..a8e157b2 100644 --- a/npc/functions/util.txt +++ b/npc/functions/util.txt @@ -107,6 +107,40 @@ function script get_race { return .@allskins$[.@g]; else return .@allskins$[.@g] + " " + .@allraces$[.@g]; - } +// gettimeparam(GETTIME_X) +// Returns the number of seconds/minutes/hours/days/months/years since 01/01/1970 +// This is for truly daily quests, which doesn't imposes a timed wait in hours +function script gettimeparam { + .@p=getarg(0, GETTIME_MINUTE); + + // Seconds (same as gettimetick(2) - use that instead) + .@t=gettimetick(2); + if (.@p == GETTIME_SECOND) + return .@t; + + // Minutes (default) + .@t=.@t/60; + if (.@p == GETTIME_MINUTE) + return .@t; + + // Hours + .@t=.@t/60; + if (.@p == GETTIME_HOUR) + return .@t; + + // Days + .@t=.@t/24; + if (.@p == GETTIME_DAYOFMONTH) + return .@t; + + // Months (estimative) + .@t=.@t/30; + if (.@p == GETTIME_MONTH) + return .@t; + + // Years (estimative, unused, fallback) + .@t=.@t/12; + return .@t; +} |