summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2018-07-15 00:47:29 -0300
committerJesusaves <cpntb1@ymail.com>2018-07-15 00:47:29 -0300
commit508a29cffb838b0cbd712ce1c955708fc553f503 (patch)
tree984e99505f24ca774e129f40fd7e41fc21ea949e
parentb6378edc428dd0ae55af85d0a17b8cf428fb860a (diff)
downloadserverdata-508a29cffb838b0cbd712ce1c955708fc553f503.tar.gz
serverdata-508a29cffb838b0cbd712ce1c955708fc553f503.tar.bz2
serverdata-508a29cffb838b0cbd712ce1c955708fc553f503.tar.xz
serverdata-508a29cffb838b0cbd712ce1c955708fc553f503.zip
Hack santime() so it works
-rw-r--r--npc/functions/time.txt27
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 {