From 5f555afa3f14ca43ca3e5ea49faeea396bb726fd Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Wed, 24 Feb 2021 20:45:37 -0300 Subject: Legendary Weapons now auto-expire if owner fails to login within 15 days. A mail warning will be sent after a week inactivity. --- npc/commands/grantpower.txt | 105 ++++++++++++++++++++++++++++++++++++++++++++ npc/commands/ucp.txt | 2 +- 2 files changed, 106 insertions(+), 1 deletion(-) (limited to 'npc/commands') diff --git a/npc/commands/grantpower.txt b/npc/commands/grantpower.txt index 48d0f4140..812b9b870 100644 --- a/npc/commands/grantpower.txt +++ b/npc/commands/grantpower.txt @@ -81,5 +81,110 @@ OnCall: OnInit: bindatcmd "grantpower", "@grantpower::OnCall", 0, 100, 1; + end; + +// 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$); + .@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$; + api_send(API_SENDMAIL, .@msg$); + return; +} + +function legendaryRodexWarning { + .@cid=getarg(0); + rodex_sendmail(.@cid, "Legendary Weapon", "Inactivity Warning", "You have not logged in the past 2 days. Shall you fail to login for 15 days, the weapon will be destroyed!"); + return; +} + +OnThu0008: + .@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); + if (.@login < .@kban) { + // Destroy the item by force + 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) { + // Send warning via API + legendaryAPIWarning(.@aid); + } else if (.@login < .@warn) { + // Send warning ingame + legendaryRodexWarning(.@cid); + } + } + ////////////////////////////////////////// + if ($DEMUR_HOLDER$ != "") { + .@nb = query_sql("SELECT last_login, char_id, account_id FROM `char` WHERE `name` == "+$DEMUR_HOLDER$+" LIMIT 1", .@login, .@cid, .@aid); + if (.@login < .@kban) { + // Destroy the item by force + 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) { + // Send warning via API + legendaryAPIWarning(.@aid); + } else if (.@login < .@warn) { + // Send warning ingame + legendaryRodexWarning(.@cid); + } + } + ////////////////////////////////////////// + if ($TYRAN_HOLDER$ != "") { + .@nb = query_sql("SELECT last_login, char_id, account_id FROM `char` WHERE `name` == "+$TYRAN_HOLDER$+" LIMIT 1", .@login, .@cid, .@aid); + if (.@login < .@kban) { + // Destroy the item by force + 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) { + // Send warning via API + legendaryAPIWarning(.@aid); + } else if (.@login < .@warn) { + // Send warning ingame + legendaryRodexWarning(.@cid); + } + } + ////////////////////////////////////////// + if ($RUNES_HOLDER$ != "") { + .@nb = query_sql("SELECT last_login, char_id, account_id FROM `char` WHERE `name` == "+$RUNES_HOLDER$+" LIMIT 1", .@login, .@cid, .@aid); + if (.@login < .@kban) { + // Destroy the item by force + 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) { + // Send warning via API + legendaryAPIWarning(.@aid); + } else if (.@login < .@warn) { + // Send warning ingame + legendaryRodexWarning(.@cid); + } + } + ////////////////////////////////////////// + if ($AEGIS_HOLDER$ != "") { + .@nb = query_sql("SELECT last_login, char_id, account_id FROM `char` WHERE `name` == "+$AEGIS_HOLDER$+" LIMIT 1", .@login, .@cid, .@aid); + if (.@login < .@kban) { + // Destroy the item by force + 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) { + // Send warning via API + legendaryAPIWarning(.@aid); + } else if (.@login < .@warn) { + // Send warning ingame + legendaryRodexWarning(.@cid); + } + } + ////////////////////////////////////////// + end; } diff --git a/npc/commands/ucp.txt b/npc/commands/ucp.txt index f2dfd166f..6386a850b 100644 --- a/npc/commands/ucp.txt +++ b/npc/commands/ucp.txt @@ -59,7 +59,7 @@ function script UserCtrlPanel { "accid", getcharid(3), "pin", rand2(10000)); debugmes .@msg$; - api_send(302, .@msg$); + api_send(API_PINCODE, .@msg$); #FIRST_TIME=2; mesc l("PinCode created, an email should arrive within 15 minutes."), 3; next; -- cgit v1.2.3-60-g2f50