diff options
Diffstat (limited to 'npc')
-rw-r--r-- | npc/003-3/malindou.txt | 9 | ||||
-rw-r--r-- | npc/commands/discord.txt | 57 | ||||
-rw-r--r-- | npc/scripts.conf | 1 |
3 files changed, 67 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", |