From 5642dea82f99181dce45b83b9e9bcfd6a903175b Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Mon, 12 Apr 2021 10:57:46 -0300 Subject: Enable some logging and keep it around for a short period because whinners. Chat log retention: 24~48 hours item log retention: 2 months (same for money) --- npc/functions/main.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'npc/functions/main.txt') diff --git a/npc/functions/main.txt b/npc/functions/main.txt index ead3a99d..25d20edc 100644 --- a/npc/functions/main.txt +++ b/npc/functions/main.txt @@ -633,3 +633,24 @@ function script learnskill { return; } +// sqldate({day variation, month variation}) +function script sqldate { + .@d=gettime(GETTIME_DAYOFMONTH)+getarg(0, 0); + .@m=gettime(GETTIME_MONTH)+getarg(1, 0); + .@y=gettime(GETTIME_YEAR); + // Overflow prevention + if (.@d <= 0) { + .@d=1; + } + while (.@m > 12) { + .@y+=1; + .@m-=12; + } + while (.@m < 1) { + .@y-=1; + .@m+=12; + } + .@strdate$=sprintf("%04d-%02d-%02d %02d:%02d:%02d", .@y, .@m, .@d, gettime(GETTIME_HOUR), gettime(GETTIME_MINUTE), gettime(GETTIME_SECOND)); + return .@strdate$; +} + -- cgit v1.2.3-60-g2f50