diff options
-rwxr-xr-x | logmaster.py | 4 | ||||
-rw-r--r-- | npc/003-3/malindou.txt | 1 | ||||
-rw-r--r-- | npc/032-3/_import.txt | 1 | ||||
-rw-r--r-- | npc/032-3/episode.txt | 6 | ||||
-rw-r--r-- | npc/032-4/_import.txt | 1 | ||||
-rw-r--r-- | npc/032-4/episode.txt | 7 | ||||
-rw-r--r-- | npc/032-5/_import.txt | 1 | ||||
-rw-r--r-- | npc/032-5/episode.txt | 7 | ||||
-rw-r--r-- | npc/commands/discord.txt | 24 |
9 files changed, 46 insertions, 6 deletions
diff --git a/logmaster.py b/logmaster.py index cdd59df16..89071ffa3 100755 --- a/logmaster.py +++ b/logmaster.py @@ -185,6 +185,10 @@ while running: w.execute(bf) #stdout("Query OK: %s" % bf) bf="" + ## Command: PING + ## Description: Does nothing + elif cmd == "PING": + pass ## TODO: Integration with the API else: stdout("Unrecognized command: %s" % cmd, ERR) diff --git a/npc/003-3/malindou.txt b/npc/003-3/malindou.txt index 657026e80..8edc01769 100644 --- a/npc/003-3/malindou.txt +++ b/npc/003-3/malindou.txt @@ -809,6 +809,7 @@ OnPCBaseLvUpEvent: // NPC ID might have changed. OnInterIfInitOnce: atcommand("@channel setopt #world MessageDelay 1"); + $@HAS_API=apiasync("PING", ""); query_sql("DELETE FROM `char_reg_num_db` WHERE `key`='RNGTREASURE_DATE'"); query_sql("DELETE FROM `char_reg_num_db` WHERE `key`='PVP_COOLDOWN'"); query_sql("DELETE FROM `char_reg_num_db` WHERE `key`='CHAREG_CLEANUP'"); diff --git a/npc/032-3/_import.txt b/npc/032-3/_import.txt index 68dfe2eae..7fee888c7 100644 --- a/npc/032-3/_import.txt +++ b/npc/032-3/_import.txt @@ -1,3 +1,4 @@ // Map 032-3: Beasts Dungeon // This file is generated automatically. All manually added changes will be removed when running the Converter. "npc/032-3/_warps.txt", +"npc/032-3/episode.txt", diff --git a/npc/032-3/episode.txt b/npc/032-3/episode.txt new file mode 100644 index 000000000..9134fb059 --- /dev/null +++ b/npc/032-3/episode.txt @@ -0,0 +1,6 @@ +// TMW2 scripts. +// Authors: +// Jesusalva +// Description: +// Part of the Doctor's Quest. + diff --git a/npc/032-4/_import.txt b/npc/032-4/_import.txt index 8c4d4817c..c9f1499a8 100644 --- a/npc/032-4/_import.txt +++ b/npc/032-4/_import.txt @@ -1,3 +1,4 @@ // Map 032-4: Crypt // This file is generated automatically. All manually added changes will be removed when running the Converter. "npc/032-4/_warps.txt", +"npc/032-4/episode.txt", diff --git a/npc/032-4/episode.txt b/npc/032-4/episode.txt new file mode 100644 index 000000000..406c974c5 --- /dev/null +++ b/npc/032-4/episode.txt @@ -0,0 +1,7 @@ +// TMW2 scripts. +// Authors: +// Jesusalva +// Description: +// Part of the Doctor's Quest. + + diff --git a/npc/032-5/_import.txt b/npc/032-5/_import.txt index 9599db65b..f9f3133df 100644 --- a/npc/032-5/_import.txt +++ b/npc/032-5/_import.txt @@ -1,3 +1,4 @@ // Map 032-5: Inner Chamber // This file is generated automatically. All manually added changes will be removed when running the Converter. "npc/032-5/_warps.txt", +"npc/032-5/episode.txt", diff --git a/npc/032-5/episode.txt b/npc/032-5/episode.txt new file mode 100644 index 000000000..406c974c5 --- /dev/null +++ b/npc/032-5/episode.txt @@ -0,0 +1,7 @@ +// TMW2 scripts. +// Authors: +// Jesusalva +// Description: +// Part of the Doctor's Quest. + + diff --git a/npc/commands/discord.txt b/npc/commands/discord.txt index e411de419..963acb4b3 100644 --- a/npc/commands/discord.txt +++ b/npc/commands/discord.txt @@ -23,7 +23,7 @@ OnCall: } // Bot cannot (or should not) alter staff data - if (is_staff()) { + if (is_staff() && !is_admin()) { dispbottom l("Staff is not allowed to use this command."); end; } @@ -90,17 +90,29 @@ OnCall: // Run SQL query (will halt execution on dupe) if (.@link) { - query_sql(sprintf("UPDATE `discord` SET `discord_name` = '%s', `verified` = '0', `discord_id` = '' WHERE `account_id`='%d'", + if ($@HAS_API) { + apiasync("SQL", sprintf("UPDATE `discord` SET `discord_name` = '?1', `verified` = '0', `discord_id` = '' WHERE `account_id`='%d'", getcharid(3))); + apiasync("SAD1", .@discord$); + apiasync("SQLRUN", ""); + } else { + query_sql(sprintf("UPDATE `discord` SET `discord_name` = '%s', `verified` = '0', `discord_id` = '' WHERE `account_id`='%d'", escape_sql(.@discord$), getcharid(3))); + } } else { - query_sql(sprintf("INSERT INTO `discord` (`discord_name`, `verified`, `discord_id`, `account_id`) VALUES ('%s', '0', '', '%d')", + if ($@HAS_API) { + apiasync("SQL", sprintf("INSERT INTO `discord` (`discord_name`, `verified`, `discord_id`, `account_id`) VALUES ('?1', '0', '', '%d')", getcharid(3))); + apiasync("SAD1", .@discord$); + apiasync("SQLRUN", ""); + } else { + query_sql(sprintf("INSERT INTO `discord` (`discord_name`, `verified`, `discord_id`, `account_id`) VALUES ('%s', '0', '', '%d')", escape_sql(.@discord$), getcharid(3))); + } } // Encode JSON data .@p$=json_encode("name", strcharinfo(0), "accId", getcharid(3), - "disc", .@discord$); + "disc", escape_sql(.@discord$)); // Send to API and update cache api_send(API_DISCORD, .@p$); @@ -108,9 +120,9 @@ OnCall: consoleinfo("%s linked discord account \"%s\".", strcharinfo(0), .@discord$); // Prevent changing for the next 3 days - DISCTRL=gettimeparam(GETTIME_DAYOFMONTH)+2; + DISCTRL=gettimeparam(GETTIME_DAYOFMONTH)+1; mesc l("Linking requested."), 1; - mesc l("This setting can only be changed every %d days.", 2), 1; + mesc l("This setting can only be changed every %d days.", 1), 1; break; ///////////////////////////////////////////////////////////////////// case 2: |