diff options
Diffstat (limited to 'npc')
-rw-r--r-- | npc/functions/time.txt | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/npc/functions/time.txt b/npc/functions/time.txt index a8c8e8d3d..be04902a6 100644 --- a/npc/functions/time.txt +++ b/npc/functions/time.txt @@ -3,16 +3,27 @@ function script now { } // Composite time for quests -// Returns gettimetick(2), but counting since 2018 in commercial date. +// Max value is 16,777,215, so we reduce 1514772000 which is the number of seconds +// elapsed from 01/01/1970 00:00 CET to 01/01/2018 00:00 GMT -0200 +// That would only hold 194 days, or 6.47 months, so we reduce 6 in 6 months when +// we hit limit, looping monthly // This value is NOT reversable to FuzzyTime -// ( time to be checked ) function script santime { - .@day=60*24; - .@year=.@day*30*360; - .@fact=.@year*(2017-1970); - debugmes "Current "+gettimetick(2); - debugmes "Elapsed "+.@fact; - return gettimetick(2)-(.@fact); + .@limit=getarg(0, 16777214); + .@base=1514772000; + .@red=(60*60*24*30*6); + .@val=gettimetick(2)-.@base; + do + { + .@val-=.@red; + } while (.@val > .@limit); + + return .@val; +} + +// Grace period when the month from santime is not matching +function script gcsantime { + return 0; } function script time_from_ms { |