diff options
author | Jesusaves <cpntb1@ymail.com> | 2021-02-24 20:45:37 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2021-02-24 20:45:37 -0300 |
commit | 5f555afa3f14ca43ca3e5ea49faeea396bb726fd (patch) | |
tree | c97b9e7c800e9d883f6fc1da44c6a7e7101fd012 | |
parent | 48cfe363e122b8840b93259f552a23914ea6f08f (diff) | |
download | serverdata-5f555afa3f14ca43ca3e5ea49faeea396bb726fd.tar.gz serverdata-5f555afa3f14ca43ca3e5ea49faeea396bb726fd.tar.bz2 serverdata-5f555afa3f14ca43ca3e5ea49faeea396bb726fd.tar.xz serverdata-5f555afa3f14ca43ca3e5ea49faeea396bb726fd.zip |
Legendary Weapons now auto-expire if owner fails to login within 15 days.
A mail warning will be sent after a week inactivity.
-rw-r--r-- | db/constants.conf | 4 | ||||
-rw-r--r-- | npc/commands/grantpower.txt | 105 | ||||
-rw-r--r-- | npc/commands/ucp.txt | 2 |
3 files changed, 110 insertions, 1 deletions
diff --git a/db/constants.conf b/db/constants.conf index 14c14618c..ccbe0dfd6 100644 --- a/db/constants.conf +++ b/db/constants.conf @@ -1518,6 +1518,10 @@ constants_db: { /* ==================================================== */ /** evol constants **/ + comment__: "API codes" + API_PINCODE: 302 + API_SENDMAIL: 501 + comment__: "outdated constants. must be removed" // >>> equip_head: 1 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; |