summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2025-08-12 20:00:43 -0300
committerJesusaves <cpntb1@ymail.com>2025-08-12 20:00:43 -0300
commit8d56bd93a5ad1d912b03408601018ccaee190e47 (patch)
tree10621433c35eca7433a1d8e5a1abe21617f3093e
parenta7159627a9c35fbfb0b5101168393748d633f055 (diff)
downloadserverdata-8d56bd93a5ad1d912b03408601018ccaee190e47.tar.gz
serverdata-8d56bd93a5ad1d912b03408601018ccaee190e47.tar.bz2
serverdata-8d56bd93a5ad1d912b03408601018ccaee190e47.tar.xz
serverdata-8d56bd93a5ad1d912b03408601018ccaee190e47.zip
Account Anniversary rewards \o/ As promised, but nerfed
-rw-r--r--npc/functions/clientversion.txt25
-rw-r--r--npc/functions/daily.txt40
2 files changed, 52 insertions, 13 deletions
diff --git a/npc/functions/clientversion.txt b/npc/functions/clientversion.txt
index d2c7ca688..4942b0ca7 100644
--- a/npc/functions/clientversion.txt
+++ b/npc/functions/clientversion.txt
@@ -1355,7 +1355,30 @@ function script clientupdater {
UPDATE=1744995155;
getitem KiraraLemon, 1;
}
- // TODO: Anniversary (leap years disregarded)
+ // Anniversary (leap years disregarded)
+ // ter 12 ago 2025 19:47:50 -03
+ if (UPDATE < 1755038870) {
+ UPDATE=1755038870;
+ // No account could exist before release date
+ if (TUT_VAR < 1519873200) {
+ consolebug("[%d:%d] %04d-%02d-%02d is invalid TUT_VAR, resetting %d to %d", getcharid(3), getcharid(0), gettime(GETTIME_YEAR, TUT_VAR), gettime(GETTIME_MONTH, TUT_VAR), gettime(GETTIME_DAYOFMONTH, TUT_VAR), TUT_VAR, 1519873200);
+ TUT_VAR = 1519873200;
+ }
+ // Calculate your account age
+ .@accage = gettime(GETTIME_YEAR) - gettime(GETTIME_YEAR, TUT_VAR);
+ // Case if your account anniversary didn't happen yet...
+ if (gettime(GETTIME_DAYOFYEAR) < min(gettime(GETTIME_DAYOFYEAR, TUT_VAR),365))
+ .@accage -= 1;
+ // Give previous anniversary gifts
+ .@i = 0;
+ while (.@i < .@accage) {
+ .@i += 1;
+ getitem StrangeCoin, .@i;
+ }
+ // Inform how many you got
+ if (.@accage)
+ dispbottom l("Happy %dth anniversary! You have received retroactive gifts.", .@accage);
+ }
// :// End of Regular Update System
////////////////////////////////////
diff --git a/npc/functions/daily.txt b/npc/functions/daily.txt
index bdca3178b..715b2f34d 100644
--- a/npc/functions/daily.txt
+++ b/npc/functions/daily.txt
@@ -18,6 +18,21 @@ function script daily_login_bonus_handler {
// Number of times you claimed the top prize (27 days streak)
//debugmes "DLBH";
+ // This should not happen, but if it does, do not give daily login rewards.
+ if (TUT_VAR < 1519873200) {
+ Exception(sprintf("Character %d created on %d which is before server release. Daily login rewards will *not* be given.", getcharid(0), TUT_VAR), RB_DEBUGMES|RB_DISPBOTTOM);
+ consolebug("[%d:%d] %04d-%02d-%02d is invalid TUT_VAR", getcharid(3), getcharid(0), gettime(GETTIME_YEAR, TUT_VAR), gettime(GETTIME_MONTH, TUT_VAR), gettime(GETTIME_DAYOFMONTH, TUT_VAR));
+ return;
+ }
+
+ // Some debug code to be removed later
+ if ($@GM_OVERRIDE) {
+ .@cur_yr = gettime(GETTIME_YEAR); //gettimetick(2) / 31536000;
+ .@org_yr = gettime(GETTIME_YEAR, TUT_VAR); //TUT_VAR / 31536000;
+ debugmes "Happy %dth anniversary!", (.@cur_yr - .@org_yr);
+ debugmes "%d / %d", gettime(GETTIME_DAYOFYEAR), min(gettime(GETTIME_DAYOFYEAR, TUT_VAR),365);
+ }
+
// GMs can receive Strange Coins
if (GSET_AUTORECEIVE_COINS) {
if (is_gm()) {
@@ -135,20 +150,21 @@ function script daily_login_bonus_handler {
dispbottom l("##2Daily login bonus: ##B%d Job Exp.##b", .@value);
}
- // TODO: Handle player anniversary? Prism Gift on day, warning a day before
- // But what about multiple chars? This is why, for now, no prize is given.
+ // Handle player anniversary. Originally meant to give a Prism gift box
+ // use #REG_DATE (per account) but changed to use TUT_VAR (per char)
+ // as this code runs by character. Prize therefore nerfed as well.
// A year has 31,536,000 seconds
- // TUT_VAR or #REG_DATE ? Both seem to be fed...
- .@cur_yr = gettimetick(2) / 31536000;
- .@org_yr = TUT_VAR / 31536000;
- .@diff = gettimetick(2) - (.@cur_yr * 31536000); // secs since 1970-01-01
- .@doff = TUT_VAR - (.@org_yr * 31536000); // secs since 1970-01-01
- // NOTE: This ignore leap years altogether and tracks "a full year".
- // This means the anniversary is not "a year" but "365 days".
- // Each leap year shall throw the anniversary a day behind, Julian style.
- if (legendaryTimeCheck(.@diff, .@doff)) {
+ .@accage = gettime(GETTIME_YEAR) - gettime(GETTIME_YEAR, TUT_VAR);
+
+ // We use the day of the year, so it works funny around leap years
+ // But still works roughly every 365 days, so "fair enough" I guess
+ if (gettime(GETTIME_DAYOFYEAR) == min(gettime(GETTIME_DAYOFYEAR, TUT_VAR),365)) {
//getitem PrismGift, 1;
- dispbottom l("Happy %dth anniversary!", (.@cur_yr - .@org_yr));
+ getitem StrangeCoin, .@accage;
+ dispbottom l("Happy %dth anniversary!", .@accage);
+ // Give a warning a day before so you may login
+ } else if (gettime(GETTIME_DAYOFYEAR)+1 == min(gettime(GETTIME_DAYOFYEAR, TUT_VAR),365)) {
+ dispbottom l("Don't forget to login tomorrow to collect your anniversary gift!");
}
// Client_updater: if #REG_DATE < gettimetick(2) - 31536000 then gift
// Should go live on 01-01-2024 for sake of fairness?