summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2018-12-22 21:48:45 -0200
committerJesusaves <cpntb1@ymail.com>2018-12-22 21:48:45 -0200
commit4801b4da599426399eb54efaad78d1ac8aa892fc (patch)
treeef09a62488838a95ec1b9d8d2645cf6bc5aad55e
parent953bb7a4ed1a224501318eb35fa4ff6e02a096d0 (diff)
downloadserverdata-4801b4da599426399eb54efaad78d1ac8aa892fc.tar.gz
serverdata-4801b4da599426399eb54efaad78d1ac8aa892fc.tar.bz2
serverdata-4801b4da599426399eb54efaad78d1ac8aa892fc.tar.xz
serverdata-4801b4da599426399eb54efaad78d1ac8aa892fc.zip
Move the security-critical functions from commands/event to functions/util
Add header to commands/event.txt
-rw-r--r--npc/commands/event.txt45
-rw-r--r--npc/functions/util.txt40
2 files changed, 47 insertions, 38 deletions
diff --git a/npc/commands/event.txt b/npc/commands/event.txt
index 82862e01a..843a7ffa6 100644
--- a/npc/commands/event.txt
+++ b/npc/commands/event.txt
@@ -1,41 +1,10 @@
-// Delete item ID on inventories, storages, guild storages and carts. Also affects mails.
-// WARNING, irreversible and dangerous!
-// DelItemFromEveryPlayer( ID )
-function script DelItemFromEveryPlayer {
- if (getarg(0, -1) < 0)
- return;
-
- query_sql("DELETE FROM `inventory` WHERE `nameid`="+getarg(0));
- query_sql("DELETE FROM `cart_inventory` WHERE `nameid`="+getarg(0));
- query_sql("DELETE FROM `storage` WHERE `nameid`="+getarg(0));
- query_sql("DELETE FROM `guild_storage` WHERE `nameid`="+getarg(0));
- query_sql("DELETE FROM `rodex_items` WHERE `nameid`="+getarg(0));
- query_sql("DELETE FROM `auction` WHERE `nameid`="+getarg(0));
- return;
-}
-
-// Delete an acc_reg entry from all players. Full arrays only. Affect num and str db.
-// WARNING, irreversible and dangerous!
-// DelAccRegFromEveryPlayer( KEY )
-function script DelAccRegFromEveryPlayer {
- if (getarg(0, -1) < 0)
- return;
-
- query_sql("DELETE FROM `acc_reg_num_db` WHERE `key`="+getarg(0));
- query_sql("DELETE FROM `acc_reg_str_db` WHERE `key`="+getarg(0));
- return;
-}
-
-// Delete a quest entry from all players. This includes all counters. Use with caution.
-// WARNING, irreversible and dangerous!
-// DelQuestFromEveryPlayer( ID )
-function script DelQuestFromEveryPlayer {
- if (getarg(0, -1) < 0)
- return;
-
- query_sql("DELETE FROM `quest` WHERE `quest_id`="+getarg(0));
- return;
-}
+// TMW2 Script
+// Author:
+// Evol Team
+// Saulc
+// Jesusalva
+// Description:
+// Handles all major events on TMW2 (Christmas, Easter, Worker Day, etc.)
// Christmas cannot be on GlobalEventMenu because it affects seasons system
function script sChristmas {
diff --git a/npc/functions/util.txt b/npc/functions/util.txt
index 807aa6df9..589a73262 100644
--- a/npc/functions/util.txt
+++ b/npc/functions/util.txt
@@ -4,8 +4,48 @@
// Description:
// Util functions
+/////////////////////////////////////////////////////////////////////////////////
+// Delete item ID on inventories, storages, guild storages and carts. Also affects mails.
+// WARNING, irreversible and dangerous!
+// DelItemFromEveryPlayer( ID )
+function script DelItemFromEveryPlayer {
+ if (getarg(0, -1) < 0)
+ return;
+
+ query_sql("DELETE FROM `inventory` WHERE `nameid`="+getarg(0));
+ query_sql("DELETE FROM `cart_inventory` WHERE `nameid`="+getarg(0));
+ query_sql("DELETE FROM `storage` WHERE `nameid`="+getarg(0));
+ query_sql("DELETE FROM `guild_storage` WHERE `nameid`="+getarg(0));
+ query_sql("DELETE FROM `rodex_items` WHERE `nameid`="+getarg(0));
+ query_sql("DELETE FROM `auction` WHERE `nameid`="+getarg(0));
+ return;
+}
+
+// Delete an acc_reg entry from all players. Full arrays only. Affect num and str db.
+// WARNING, irreversible and dangerous!
+// DelAccRegFromEveryPlayer( KEY )
+function script DelAccRegFromEveryPlayer {
+ if (getarg(0, -1) < 0)
+ return;
+
+ query_sql("DELETE FROM `acc_reg_num_db` WHERE `key`="+getarg(0));
+ query_sql("DELETE FROM `acc_reg_str_db` WHERE `key`="+getarg(0));
+ return;
+}
+
+// Delete a quest entry from all players. This includes all counters. Use with caution.
+// WARNING, irreversible and dangerous!
+// DelQuestFromEveryPlayer( ID )
+function script DelQuestFromEveryPlayer {
+ if (getarg(0, -1) < 0)
+ return;
+
+ query_sql("DELETE FROM `quest` WHERE `quest_id`="+getarg(0));
+ return;
+}
+/////////////////////////////////////////////////////////////////////////////////
// Returns Nard reputation for discounts
// Currently ranges from 0 to 16.
function script nard_reputation {