summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2018-10-16 17:28:24 -0300
committerJesusaves <cpntb1@ymail.com>2018-10-16 17:28:24 -0300
commitc60dc31c74313d2de85bf88b7edb17d6f75d2fff (patch)
tree445f7bf2932531c78390bb81ae5b167255025c9b
parente3e4bc9d918a86c3b3699a7256fc229231c0de72 (diff)
downloadserverdata-c60dc31c74313d2de85bf88b7edb17d6f75d2fff.tar.gz
serverdata-c60dc31c74313d2de85bf88b7edb17d6f75d2fff.tar.bz2
serverdata-c60dc31c74313d2de85bf88b7edb17d6f75d2fff.tar.xz
serverdata-c60dc31c74313d2de85bf88b7edb17d6f75d2fff.zip
Put some lawn on my cables. :>
-rw-r--r--npc/003-3/malindou.txt9
-rw-r--r--npc/commands/discord.txt57
-rw-r--r--npc/scripts.conf1
-rw-r--r--sql-files/main.sql9
-rw-r--r--sql-files/upgrades/2018-08-03--11-37.sql7
5 files changed, 83 insertions, 0 deletions
diff --git a/npc/003-3/malindou.txt b/npc/003-3/malindou.txt
index 4d8933a91..7f242e96a 100644
--- a/npc/003-3/malindou.txt
+++ b/npc/003-3/malindou.txt
@@ -127,6 +127,15 @@ OnInit:
debugmes "";
setarray $REFERRAL_IDS, 0;
}
+ // Current UPDATE value: Ter Out 16 17:17:20 -03 2018
+ // This is a hack because I'm too lazy to be bothered with standard SQL Upgrade system
+ if ($UPDATE < 1539721040) {
+ query_sql("CREATE TABLE IF NOT EXISTS `discord` (`account_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',`discord_id` VARCHAR(255) NOT NULL DEFAULT '') ENGINE=MyISAM");
+ $UPDATE=1539721040;
+ debugmes "";
+ debugmes "* SQL Upgrade (will not work on new installations)";
+ debugmes "";
+ }
diff --git a/npc/commands/discord.txt b/npc/commands/discord.txt
new file mode 100644
index 000000000..b5ab69fef
--- /dev/null
+++ b/npc/commands/discord.txt
@@ -0,0 +1,57 @@
+// TMW-2 Script.
+// Author:
+// Jesusalva
+// LawnCable
+// Notes:
+// Controls `discord` table with @discord command.
+// Only useful for TMW2-Discord integration.
+
+- script @discord 32767,{
+ end;
+
+OnCall:
+ // Anti-Flood System
+ if (@discord) {
+ mesc l("You already ran this command today. Please try again at a later time."), 1;
+ close;
+ }
+
+ if (!validatepin())
+ close;
+
+ @discord=1;
+ .@nb = query_sql("select `discord_id` from `discord` WHERE `account_id` == "+getcharid(3), .@discord$);
+
+
+ do
+ {
+ mesn "Lawn Cable";
+ mesq l("Current linked Discord account: @@", .@discord$);
+ next;
+ select
+ l("Change Linked Discord Account"),
+ l("Disconnect"),
+ l("Quit");
+
+ switch (@menu) {
+ case 1:
+ mesc l("Please insert your Discord ID, on the following format: "), 1;
+ mesc l("Usename#0000"), 2;
+ input .@discord$;
+ mes "";
+ query_sql("UPDATE `discord` SET `discord_id` = '"+.@discord$+"' WHERE `account_id` == "+getcharid(3));
+ break;
+ case 2:
+ query_sql("DELETE FROM `discord` WHERE `account_id` == "+getcharid(3));
+ .@discord$="";
+ break;
+ }
+
+ } while (@menu != 3);
+ close;
+
+OnInit:
+ bindatcmd "discord", "@discord::OnCall", 0, 0, 1;
+ end;
+}
+
diff --git a/npc/scripts.conf b/npc/scripts.conf
index 467e038aa..b6b741ddd 100644
--- a/npc/scripts.conf
+++ b/npc/scripts.conf
@@ -65,6 +65,7 @@
"npc/commands/debug-quest.txt",
"npc/commands/debug-skill.txt",
"npc/commands/debug.txt",
+"npc/commands/discord.txt",
"npc/commands/event.txt",
"npc/commands/ipcheck.txt",
"npc/commands/kami.txt",
diff --git a/sql-files/main.sql b/sql-files/main.sql
index 2d4de5237..eba0291a0 100644
--- a/sql-files/main.sql
+++ b/sql-files/main.sql
@@ -278,6 +278,15 @@ CREATE TABLE IF NOT EXISTS `charlog` (
) ENGINE=MyISAM;
--
+-- Table structure for table `discord`
+--
+
+CREATE TABLE IF NOT EXISTS `discord` (
+ `account_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
+ `discord_id` VARCHAR(255) NOT NULL DEFAULT ''
+) ENGINE=MyISAM;
+
+--
-- Table structure for table `elemental`
--
diff --git a/sql-files/upgrades/2018-08-03--11-37.sql b/sql-files/upgrades/2018-08-03--11-37.sql
index 1dde29fd6..c9a532b26 100644
--- a/sql-files/upgrades/2018-08-03--11-37.sql
+++ b/sql-files/upgrades/2018-08-03--11-37.sql
@@ -21,4 +21,11 @@
ALTER TABLE `quest` CHANGE `count1` `count1` INT(11) UNSIGNED NOT NULL DEFAULT '0';
ALTER TABLE `quest` CHANGE `count2` `count2` INT(11) UNSIGNED NOT NULL DEFAULT '0';
ALTER TABLE `quest` CHANGE `count3` `count3` INT(11) UNSIGNED NOT NULL DEFAULT '0';
+
+CREATE TABLE IF NOT EXISTS `discord` (
+ `account_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
+ `discord_id` VARCHAR(255) NOT NULL DEFAULT ''
+) ENGINE=MyISAM;
+
+
INSERT INTO `sql_updates` (`timestamp`) VALUES (1533307076);