diff options
author | Jesusaves <cpntb1@ymail.com> | 2023-07-18 00:09:19 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2023-07-18 00:09:19 -0300 |
commit | 22420de81ee7221e86a0b907b25316d1787b9caf (patch) | |
tree | fa718c7fb36995c4e6dc06a1beb5e0ed706f08f5 /npc/commands/grantpower.txt | |
parent | 3bd02a8af3845663b62ae1182a6f5a90fbb75354 (diff) | |
download | serverdata-22420de81ee7221e86a0b907b25316d1787b9caf.tar.gz serverdata-22420de81ee7221e86a0b907b25316d1787b9caf.tar.bz2 serverdata-22420de81ee7221e86a0b907b25316d1787b9caf.tar.xz serverdata-22420de81ee7221e86a0b907b25316d1787b9caf.zip |
Update grantpower to be more precise, and fix a typo along the way
Diffstat (limited to 'npc/commands/grantpower.txt')
-rw-r--r-- | npc/commands/grantpower.txt | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/npc/commands/grantpower.txt b/npc/commands/grantpower.txt index 56c0828bd..406d1a111 100644 --- a/npc/commands/grantpower.txt +++ b/npc/commands/grantpower.txt @@ -79,7 +79,7 @@ OnInit: // Legendary Controls: Interact over legendary holders and determine their status function legendaryAPIWarning { .@aid=getarg(0); - .@nb = query_sql("SELECT email FROM `login` WHERE `account_id` == "+.@aid+" LIMIT 1", .@email$); + .@nb = query_sql("SELECT email FROM `login` WHERE `account_id` = '"+.@aid+"' LIMIT 1", .@email$); .@msg$=sprintf("[\"%s\", \"Good evening!\nYou have been inactive for a week on Moubootaur Legends.\n\nYou are currently possessing a Legendary Weapon.\nIf you do not login within seven days, your legendary weapon will be returned so the player community can obtain it again.\n\nYour TMW2 Team\", \"Legendary item expiration notice\"]", .@email$); debugmes .@msg$; consoleinfo("%d notified for Legendary weapon inactivity. (L:2)", .@aid); @@ -94,11 +94,30 @@ function legendaryRodexWarning { return; } +function legendaryTimeCheck { + .@min = getarg(1)-86400; + .@max = getarg(1)+86400; + // getarg(0) is last_login, and getarg(1) the tolerance + // if last_login < tolerance (older), then ban + // But we don't want this to repeat. + // Tolerance: day 10 -> min = 10-1=9; max=10+1=11 + // Day 8: (8 < 11? yes; 8 > 9? no) + // Day 9: (9 < 11? yes; 9 > 9? no) + // Day 10: (10 < 11? yes; 10 > 9? yes) -> Message sent + // Day 11: (11 < 11? no; 11 > 9? yes) + // Day 12: (12 < 11? no; 12 > 9? yes) + if (getarg(0) < .@max && getarg(0) > .@min) + return true; + else + return false; +} + OnClock0238: .@date=gettimetick(2); .@warn=.@date-(86400*2); .@kick=.@date-(86400*7); .@kban=.@date-(86400*15); + ////////////////////////////////////////// if ($LIGHT_HOLDER$ != "") { .@nb = query_sql("SELECT last_login, char_id, account_id FROM `char` WHERE `name` = '"+$LIGHT_HOLDER$+"' LIMIT 1", .@login, .@cid, .@aid); @@ -107,10 +126,10 @@ OnClock0238: DelItemFromEveryPlayer(Lightbringer); $LIGHT_HOLDER$=""; kamibroadcast("The Lightbringer has given up on its previous owner and is now available for someone worthier."); - } else if (.@login < .@kick) { + } else if (legendaryTimeCheck(.@login, .@kick)) { // Send warning via API legendaryAPIWarning(.@aid); - } else if (.@login < .@warn) { + } else if (legendaryTimeCheck(.@login, .@warn)) { // Send warning ingame legendaryRodexWarning(.@cid); } @@ -123,10 +142,10 @@ OnClock0238: DelItemFromEveryPlayer(DemureAxe); $DEMUR_HOLDER$=""; kamibroadcast("The Demure Axe has given up on its previous owner and is now available for someone worthier."); - } else if (.@login < .@kick) { + } else if (legendaryTimeCheck(.@login, .@kick)) { // Send warning via API legendaryAPIWarning(.@aid); - } else if (.@login < .@warn) { + } else if (legendaryTimeCheck(.@login, .@warn)) { // Send warning ingame legendaryRodexWarning(.@cid); } @@ -139,10 +158,10 @@ OnClock0238: DelItemFromEveryPlayer(Tyranny); $TYRAN_HOLDER$=""; kamibroadcast("The Tyranny has given up on its previous owner and is now available for someone worthier."); - } else if (.@login < .@kick) { + } else if (legendaryTimeCheck(.@login, .@kick)) { // Send warning via API legendaryAPIWarning(.@aid); - } else if (.@login < .@warn) { + } else if (legendaryTimeCheck(.@login, .@warn)) { // Send warning ingame legendaryRodexWarning(.@cid); } @@ -155,10 +174,10 @@ OnClock0238: DelItemFromEveryPlayer(Runestaff); $RUNES_HOLDER$=""; kamibroadcast("The Runestaff has given up on its previous owner and is now available for someone worthier."); - } else if (.@login < .@kick) { + } else if (legendaryTimeCheck(.@login, .@kick)) { // Send warning via API legendaryAPIWarning(.@aid); - } else if (.@login < .@warn) { + } else if (legendaryTimeCheck(.@login, .@warn)) { // Send warning ingame legendaryRodexWarning(.@cid); } @@ -171,10 +190,10 @@ OnClock0238: DelItemFromEveryPlayer(AegisShield); $AEGIS_HOLDER$=""; kamibroadcast("The Aegis Shield has given up on its previous owner and is now available for someone worthier."); - } else if (.@login < .@kick) { + } else if (legendaryTimeCheck(.@login, .@kick)) { // Send warning via API legendaryAPIWarning(.@aid); - } else if (.@login < .@warn) { + } else if (legendaryTimeCheck(.@login, .@warn)) { // Send warning ingame legendaryRodexWarning(.@cid); } |