summaryrefslogtreecommitdiff
path: root/npc
diff options
context:
space:
mode:
Diffstat (limited to 'npc')
-rw-r--r--npc/commands/grantpower.txt105
-rw-r--r--npc/commands/ucp.txt2
2 files changed, 106 insertions, 1 deletions
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;