summaryrefslogtreecommitdiff
path: root/npc/commands
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2021-04-10 03:00:20 -0300
committerJesusaves <cpntb1@ymail.com>2021-04-10 03:00:20 -0300
commitba1e827b6b4c17c35a163e6b55be8c122de632b8 (patch)
tree819f93d0ffee3697e336471710afb9681f0b8d86 /npc/commands
parent6e7f3113c0faad9edd4367d100ba9dd77e8d3130 (diff)
downloadserverdata-ba1e827b6b4c17c35a163e6b55be8c122de632b8.tar.gz
serverdata-ba1e827b6b4c17c35a163e6b55be8c122de632b8.tar.bz2
serverdata-ba1e827b6b4c17c35a163e6b55be8c122de632b8.tar.xz
serverdata-ba1e827b6b4c17c35a163e6b55be8c122de632b8.zip
Add several convenience functions. Fix some bugs regarding misuse of readparam()
Diffstat (limited to 'npc/commands')
-rwxr-xr-xnpc/commands/changesex.txt31
-rwxr-xr-xnpc/commands/class.txt30
-rw-r--r--npc/commands/debug-quest.txt93
-rwxr-xr-xnpc/commands/debug.txt312
-rwxr-xr-xnpc/commands/destroynpc.txt34
-rwxr-xr-xnpc/commands/hug.txt24
-rw-r--r--npc/commands/ipcheck.txt71
-rw-r--r--npc/commands/kami.txt86
-rw-r--r--npc/commands/language.txt60
-rwxr-xr-xnpc/commands/marry.txt68
-rwxr-xr-xnpc/commands/music.txt33
-rwxr-xr-xnpc/commands/mute.txt92
-rwxr-xr-xnpc/commands/npctalk.txt22
-rwxr-xr-xnpc/commands/numa.txt43
-rwxr-xr-xnpc/commands/pullrabbit.txt25
-rw-r--r--npc/commands/python.txt27
-rwxr-xr-xnpc/commands/remotecmd.txt61
-rw-r--r--npc/commands/resync.txt45
-rwxr-xr-xnpc/commands/warp.txt56
-rwxr-xr-xnpc/commands/zeny.txt78
20 files changed, 396 insertions, 895 deletions
diff --git a/npc/commands/changesex.txt b/npc/commands/changesex.txt
deleted file mode 100755
index de20d91b..00000000
--- a/npc/commands/changesex.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-- script @changesex NPC32767,{
- callfunc "argv_splitter";
- .@n$ = if_then_else(@argv$[1] != "", "char", "") + "changecharsex()";
- if (GM < CMD_CHANGESex && GM < G_SYSOP) goto L_GM; // check if you can use it on self
- .@target_id = BL_ID;
- if (@argv$[1] != "") set .@target_id, getcharid(3, @argv$[1]);
- if (@argv$[1] != "" && !(isloggedin(.@target_id))) goto L_Failed; // do NOT fallback to self
- if (@argv$[1] != "" && GM < CMD_CHARCHANGESex && GM < G_SYSOP) goto L_GM; // when target is not self, use charchangecharsex() permission
-
- set .@s, 3; // default to non-binary
- if (@argv$[0] == "M" || @argv$[0] == "m") set .@s, 1;
- if (@argv$[0] == "F" || @argv$[0] == "f") set .@s, 0;
- Sex = .@s, .@target_id;
- gmlog "@"+.@n$+" " + @args$;
- message strcharinfo(0), .@n$+" : The operation succeeded.";
- end;
-
-L_Failed:
- // XXX: should we allow GMs to change Sex of users that are not logged in?
- message strcharinfo(0), .@n$+" : Impossible to attach to the target player. Did you try putting the name in \"quotation marks\"?";
- end;
-
-L_GM:
- message strcharinfo(0), .@n$+" : GM command is level "+ if_then_else(@argv$[1] != "", CMD_CHARCHANGESex, CMD_CHANGESex) +", but you are level " + GM;
- end;
-
-OnInit:
- registercmd chr(ATCMD_SYMBOL) + "changecharsex()", strnpcinfo(0);
- registercmd chr(ATCMD_SYMBOL) + "charchangecharsex()", strnpcinfo(0);
- end;
-}
diff --git a/npc/commands/class.txt b/npc/commands/class.txt
deleted file mode 100755
index 81ac0c7c..00000000
--- a/npc/commands/class.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-- script @class NPC32767,{
- callfunc "argv_splitter";
- .@n$ = if_then_else(@argv$[1] != "", "char", "") + "class";
- if (GM < CMD_CLASS && GM < G_SYSOP) goto L_GM; // check if you can use it on self
- .@target_id = BL_ID;
- if (@argv$[1] != "") set .@target_id, getcharid(3, @argv$[1]);
- if (@argv$[1] != "" && !(isloggedin(.@target_id))) goto L_Failed; // do NOT fallback to self
- if (@argv$[1] != "" && GM < CMD_CHARCLASS && GM < G_SYSOP) goto L_GM; // when target is not self, use charclass permission
-
- set .@c, 1; // default to human
- if (@argv[0] >= 1 || @argv[0] <= 32767) set .@c, @argv[0];
- Class = .@c, .@target_id;
- gmlog "@"+.@n$+" " + @args$;
- message strcharinfo(0), .@n$+" : The operation succeeded.";
- end;
-
-L_Failed:
- // XXX: should we allow GMs to change class of users that are not logged in?
- message strcharinfo(0), .@n$+" : Impossible to attach to the target player. Did you try putting the name in \"quotation marks\"?";
- end;
-
-L_GM:
- message strcharinfo(0), .@n$+" : GM command is level "+ if_then_else(@argv$[1] != "", CMD_CHARCLASS, CMD_CLASS) +", but you are level " + GM;
- end;
-
-OnInit:
- registercmd chr(ATCMD_SYMBOL) + "class", strnpcinfo(0);
- registercmd chr(ATCMD_SYMBOL) + "charclass", strnpcinfo(0);
- end;
-}
diff --git a/npc/commands/debug-quest.txt b/npc/commands/debug-quest.txt
new file mode 100644
index 00000000..a4c6572f
--- /dev/null
+++ b/npc/commands/debug-quest.txt
@@ -0,0 +1,93 @@
+// Evol Script
+// Author: Gumi, Jesusalva
+
+// TODO: This script must be auto-generated from db/quests.conf to be of any use
+function script GlobalQuestDebug {
+ do
+ {
+ clear;
+ setnpcdialogtitle l("Quest debug") + " - " + l("Other");
+ mes l("This menu gives access to quest debug menus for @@ quests.", strtolower(l("Other")));
+ next;
+ mes l("Please select a quest:");
+
+ menuint
+ menuimage("actions/back", l("Go back")), -1,
+ l("Custom"), -136;
+
+ switch (@menuret)
+ {
+ case -1: return;
+ case -136:
+ mes "Determine the quest number, as stated in db/quests.conf";
+ input .@quest;
+ if (!.@quest) return;
+ mes "";
+ mes l("DEBUG: Changing @@, Values: (@@, @@, @@).", getquestlink(.@quest), getq(.@quest), getq2(.@quest), getq3(.@quest));
+ select
+ "set 1",
+ "set 2",
+ "set 3",
+ "reset";
+ mes l("DEBUG: Changing @@ field @@ to something else.", getquestlink(.@quest), @menu);
+ mes "";
+ mes "Determine the new value (numeric only)";
+ input .@value;
+ if (.@value < 0) return;
+ if (@menu == 1)
+ setq1 .@quest, .@value;
+ if (@menu == 2)
+ setq2 .@quest, .@value;
+ if (@menu == 3)
+ setq3 .@quest, .@value;
+ if (@menu == 4)
+ setq .@quest, .@value, 0, 0;
+
+ return;
+ default: return;
+ }
+ } while (1);
+ return;
+}
+
+
+
+- script @qdebug 32767,{
+ end;
+
+OnCall:
+ if (!is_gm()) {
+ end;
+ }
+ GlobalQuestDebug;
+ closedialog;
+ end;
+
+OnSetq:
+ if (.@atcmd_numparameters < 2) {
+ dispbottom "setq called with invalid arguments (min. 2)";
+ dispbottom "GM Command syntax: @setq <quest_id> <val1> <val2> <val3>";
+ end;
+ }
+ .@q=atoi(.@atcmd_parameters$[0]);
+ switch (.@atcmd_numparameters) {
+ case 4:
+ setq3 .@q, atoi(.@atcmd_parameters$[3]);
+ case 3:
+ setq2 .@q, atoi(.@atcmd_parameters$[2]);
+ case 2:
+ setq1 .@q, atoi(.@atcmd_parameters$[1]);
+ dispbottom l("Quest @@ modified by GM", getquestlink(.@q));
+ specialeffect 50, SELF, playerattached();
+ break;
+ default:
+ dispbottom "setq called with invalid arguments (max. 4)";
+ dispbottom "GM Command syntax: @setq <quest_id> <val1> <val2> <val3>";
+ break;
+ }
+ end;
+
+OnInit:
+ bindatcmd "qdebug", "@qdebug::OnCall", 99, 99, 1;
+ bindatcmd "setq", "@qdebug::OnSetq", 99, 99, 1;
+}
diff --git a/npc/commands/debug.txt b/npc/commands/debug.txt
index c1ebf81d..f14d1363 100755
--- a/npc/commands/debug.txt
+++ b/npc/commands/debug.txt
@@ -1,11 +1,6 @@
function script Debug {
- if(!@debug_npc) goto L_Begin;
- mes "The debug NPCs have been deprecated. Please use this command instead:";
- mes "";
- mes "%%E ##a@debug##0";
- @debug_npc = 0;
- goto L_close;
+ goto L_Begin;
L_Begin:
@debug_mask = 65535;
@@ -13,8 +8,8 @@ L_Begin:
@mexp = ((MAGIC_EXPERIENCE & @debug_mask) >> @debug_shift);
mes "What do you want to do?";
menu
+ "Reset stat points.", L_Level,
"Change my level.", L_Level,
- "Change my stats.", L_Status,
"Change my basic skills.", L_BasicSkills,
"Change my focus skills.", L_FocusSkills,
"Change my magic skills.", L_MagicSkills,
@@ -51,188 +46,6 @@ L_SameLevel:
next;
goto L_Begin;
-L_Status:
- mes "What do you want to do?";
- menu
- "Set all of my stats myself.", L_ChangeStrength,
- "Set one of my stats myself.", L_ChangeSingleStat,
- "Get maximum points in all stats.", L_ChangeAllStats,
- "Reset my status points.", L_ResetStatusPoints,
- "Back to the main menu.", L_Begin,
- "Close.", L_close;
-
-L_ChangeAllStats:
- Str = 99;
- Agi = 99;
- Vit = 99;
- Int = 99;
- Dex = 99;
- Luk = 99;
- mes "You now have 99 in all stats.";
- next;
- goto L_Begin;
-
-L_ChangeStrength:
- mes "How much strength do you want to have (min: 1 - max: 99)?";
- input @str;
- if (@str < 1)
- goto L_StatTooLow;
- if (@str > 99)
- goto L_StatTooHigh;
- Str = @str;
- goto L_ChangeAgility;
-
-L_ChangeAgility:
- mes "How much agility do you want to have (min: 1 - max: 99)?";
- input @agi;
- if (@agi < 1)
- goto L_StatTooLow;
- if (@agi > 99)
- goto L_StatTooHigh;
- Agi = @agi;
- goto L_ChangeVitality;
-
-L_ChangeVitality:
- mes "How much vitality do you want to have (min: 1 - max: 99)?";
- input @vit;
- if (@vit < 1)
- goto L_StatTooLow;
- if (@vit > 99)
- goto L_StatTooHigh;
- Vit = @vit;
- goto L_ChangeIntelligence;
-
-L_ChangeIntelligence:
- mes "How much intelligence do you want to have (min: 1 - max: 99)?";
- input @int;
- if (@int < 1)
- goto L_StatTooLow;
- if (@int > 99)
- goto L_StatTooHigh;
- Int = @int;
- goto L_ChangeDexterity;
-
-L_ChangeDexterity:
- mes "How much dexterity do you want to have (min: 1 - max: 99)?";
- input @dex;
- if (@dex < 1)
- goto L_StatTooLow;
- if (@dex > 99)
- goto L_StatTooHigh;
- Dex = @dex;
- goto L_ChangeLuck;
-
-L_ChangeLuck:
- mes "How much luck do you want to have (min: 1 - max: 99)?";
- input @luk;
- if (@luk < 1)
- goto L_StatTooLow;
- if (@luk > 99)
- goto L_StatTooHigh;
- Luk = @luk;
- mes "You now have " + Str + " in strength.";
- mes "You now have " + Agi + " in agility.";
- mes "You now have " + Vit + " in vitality.";
- mes "You now have " + Int + " in intelligence.";
- mes "You now have " + Dex + " in dexterity.";
- mes "You now have " + Luk + " in luck.";
- next;
- goto L_Begin;
-
-L_StatTooLow:
- mes "Bad choice. Minimum stat value is 1. Aborting.";
- next;
- goto L_Status;
-
-L_StatTooHigh:
- mes "Bad choice. Maximum stat value is 99. Aborting.";
- next;
- goto L_Status;
-
-L_ChangeSingleStat:
- mes "Which stat do you want to change?";
- menu
- "Strength.", L_ChangeStrengthSingle,
- "Agility.", L_ChangeAgilitySingle,
- "Vitality.", L_ChangeVitalitySingle,
- "Intelligence.", L_ChangeIntelligenceSingle,
- "Dexterity.", L_ChangeDexteritySingle,
- "Luck.", L_ChangeLuckSingle,
- "Back to the main menu.", L_Begin,
- "Close.", L_close;
-
-L_ChangeStrengthSingle:
- mes "How much strength do you want to have (min: 1 - max: 99)?";
- input @str;
- if (@str < 1)
- goto L_StatTooLow;
- if (@str > 99)
- goto L_StatTooHigh;
- Str = @str;
- mes "You now have " + Str + " in strength.";
- next;
- goto L_Begin;
-
-L_ChangeAgilitySingle:
- mes "How much agility do you want to have (min: 1 - max: 99)?";
- input @agi;
- if (@agi < 1)
- goto L_StatTooLow;
- if (@agi > 99)
- goto L_StatTooHigh;
- Agi = @agi;
- mes "You now have " + Agi + " in agility.";
- next;
- goto L_Begin;
-
-L_ChangeVitalitySingle:
- mes "How much vitality do you want to have (min: 1 - max: 99)?";
- input @vit;
- if (@vit < 1)
- goto L_StatTooLow;
- if (@vit > 99)
- goto L_StatTooHigh;
- Vit = @vit;
- mes "You now have " + Vit + " in vitality.";
- next;
- goto L_Begin;
-
-L_ChangeIntelligenceSingle:
- mes "How much intelligence do you want to have (min: 1 - max: 99)?";
- input @int;
- if (@int < 1)
- goto L_StatTooLow;
- if (@int > 99)
- goto L_StatTooHigh;
- Int = @int;
- mes "You now have " + Int + " in intelligence.";
- next;
- goto L_Begin;
-
-L_ChangeDexteritySingle:
- mes "How much dexterity do you want to have (min: 1 - max: 99)?";
- input @dex;
- if (@dex < 1)
- goto L_StatTooLow;
- if (@dex > 99)
- goto L_StatTooHigh;
- Dex = @dex;
- mes "You now have " + Dex + " in dexterity.";
- next;
- goto L_Begin;
-
-L_ChangeLuckSingle:
- mes "How much luck do you want to have (min: 1 - max: 99)?";
- input @luk;
- if (@luk < 1)
- goto L_StatTooLow;
- if (@luk > 99)
- goto L_StatTooHigh;
- Luk = @luk;
- mes "You now have " + Luk + " in luck.";
- next;
- goto L_Begin;
-
L_ResetStatusPoints:
resetstatus;
mes "Stats successfully resetted.";
@@ -240,113 +53,13 @@ L_ResetStatusPoints:
goto L_Begin;
L_BasicSkills:
- @emote = getskilllv(SKILL_EMOTE);
- @trade = getskilllv(SKILL_TRADE);
- @party = getskilllv(SKILL_PARTY);
- menu
- "Overview of my basic skills.", L_BasicSkillsOverview,
- "Add basic skills.", L_AddBasicSkills,
- "Reset basic skills.", L_ResetBasicSkills,
- "Back to main menu.", L_Begin,
- "Close.", L_close;
-
-L_BasicSkillsOverview:
- mes "Your level in the emote skill is " + @emote + ".";
- mes "Your level in the trade skill is " + @trade + ".";
- mes "Your level in the party skill is " + @party + ".";
- next;
- goto L_BasicSkills;
-
-L_AddBasicSkills:
- menu
- "Emote", L_ChangeEmoteSkill,
- "Trade.", L_ChangeTradeSkill,
- "Party.", L_ChangePartySkill,
- "All basic skills to their maximum level.", L_AllBasicSkills,
- "Back to the basic skills menu.", L_BasicSkills,
- "Close.", L_close;
-
-L_ChangeEmoteSkill:
- mes "Your level in the emote skill is " + @emote + ". What do you want to do?";
- menu
- "Get level 0.", L_Next,
- "Get level 1.", L_ChangeEmoteSkill1;
-
-L_Next:
- if (@menu == 1)
- addtoskill SKILL_EMOTE, 0;
- mes "Emote skill changed to level 0.";
- next;
- goto L_BasicSkills;
-
-L_ChangeEmoteSkill1:
- addtoskill SKILL_EMOTE, 1;
- mes "Emote skill changed to level 1.";
- next;
- goto L_BasicSkills;
-
-L_ChangeTradeSkill:
- mes "Your level in the trade skill is " + @trade + ". What do you want to do?";
- menu
- "Get level 0.", L_Next1,
- "Get level 1.", L_ChangeTradeSkill1;
-
-L_Next1:
- if (@menu == 1)
- addtoskill SKILL_TRADE, 0;
- mes "Trade skill changed to level 0.";
- next;
- goto L_BasicSkills;
-
-L_ChangeTradeSkill1:
- addtoskill SKILL_TRADE, 1;
- mes "Trade skill changed to level 1.";
- next;
- goto L_BasicSkills;
-
-L_ChangePartySkill:
- mes "Your level in the party skill is " + @trade + ". What do you want to do?";
- menu
- "Get level 0.", L_Next2,
- "Get level 1.", L_ChangePartySkill1,
- "Get level 2.", L_ChangePartySkill2;
-
-L_Next2:
- if (@menu == 1)
- addtoskill SKILL_PARTY, 0;
- mes "Party skill changed to level 0.";
- next;
- goto L_BasicSkills;
-
-L_ChangePartySkill1:
- addtoskill SKILL_PARTY, 1;
- mes "Party skill changed to level 1.";
- next;
- goto L_BasicSkills;
-
-L_ChangePartySkill2:
- addtoskill SKILL_PARTY, 2;
- mes "Party skill changed to level 2.";
- next;
- goto L_BasicSkills;
-
-L_AllBasicSkills:
- addtoskill SKILL_EMOTE, 1;
- addtoskill SKILL_TRADE, 1;
- addtoskill SKILL_PARTY, 2;
- mes "Basic skills added.";
- next;
- goto L_BasicSkills;
-
-L_ResetBasicSkills:
- addtoskill SKILL_EMOTE, 0;
- addtoskill SKILL_TRADE, 0;
- addtoskill SKILL_PARTY, 0;
- mes "Basic skills removed.";
- next;
- goto L_BasicSkills;
+ skill SKILL_EMOTE, 6, 0;
+ //addtoskill SKILL_TRADE, 0;
+ //addtoskill SKILL_PARTY, 0;
+ goto L_Begin;
L_FocusSkills:
+ /*
@pool = getskilllv(SKILL_POOL);
@mallard = getskilllv(SKILL_MALLARDS_EYE);
@brawling = getskilllv(SKILL_BRAWLING);
@@ -546,6 +259,8 @@ L_ResetFocusSkills:
mes "Focus skills removed.";
next;
goto L_FocusSkills;
+ */
+ goto L_Begin;
L_MagicSkills:
@general = getskilllv(SKILL_MAGIC);
@@ -973,12 +688,3 @@ OnInit:
end;
}
-027-2,125,103,0 script Debug#5 NPC154,{
- @debug_npc = 1;
- callfunc "Debug";
- end;
-OnInit:
- if (!debug)
- disablenpc "Debug#5";
- end;
-}
diff --git a/npc/commands/destroynpc.txt b/npc/commands/destroynpc.txt
deleted file mode 100755
index 156c8200..00000000
--- a/npc/commands/destroynpc.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-- script @destroynpc NPC32767,{
- callfunc "argv_splitter";
- if (GM < CMD_DESTROYNPC && GM < G_SYSOP)
- goto L_GM;
-
- .@id = getnpcid(@argv$[0]);
- if (@argv$[0] == "" || .@id < 1)
- goto L_Failed;
- if (gettimetick(2) - @destroynpc[0] > 300 || @destroynpc[1] != .@id)
- goto L_Confirm;
-
- gmlog "@destroynpc " + @args$;
- message strcharinfo(0), "destroynpc : The operation succeeded.";
- debugmes "!!! => npc destroyed: `"+@argv$[0]+"` ("+.@id+")";
- if (1==1) destroy .@id; // FIXME: allow destroy to work as a non-terminator when arg0 is given (TMWA)
- end;
-
-L_Confirm:
- message strcharinfo(0), "destroynpc : ##BDANGER ZONE!##b This command permanently destroys a npc and its puppets (if any). Use the command again to confirm.";
- setarray @destroynpc[0], gettimetick(2), .@id;
- end;
-
-L_Failed:
- message strcharinfo(0), "destroynpc : Impossible to find the target npc. Did you try putting the name in \"quotation marks\"? Some npcs also have an invisible postfix in their name, ie `#_M`.";
- end;
-
-L_GM:
- message strcharinfo(0), "destroynpc : GM command is level "+ CMD_DESTROYNPC +", but you are level " + GM;
- end;
-
-OnInit:
- registercmd chr(ATCMD_SYMBOL) + "destroynpc", strnpcinfo(0);
- end;
-}
diff --git a/npc/commands/hug.txt b/npc/commands/hug.txt
deleted file mode 100755
index 4f7c086d..00000000
--- a/npc/commands/hug.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-- script nonmagic-hug NPC32767,{
- explode .@name$[0], @args$, "*"; // strip the trailing *
- @target_id = if_then_else(.@name$[0] != "", getcharid(3, .@name$[0]), BL_ID);
- if (@target_id < 1 || !(isloggedin(@target_id))) set @target_id, BL_ID; // fallback to self
- if (.@name$[0] == "Tree" || .@name$[0] == "tree") set @target_id, .tree_id;
- .@range = if_then_else(@target_id == .tree_id, 3, 6);
- if (distance(BL_ID, @target_id) >= .@range) end;
- if (gettimetick(2) - @hugspell_time < 3) end;
-
- @hugspell_time = gettimetick(2);
- misceffect FX_HUG, strcharinfo(0);
- if (@target_id != BL_ID) misceffect FX_HUG, @target_id;
-
- if (@target_id != .tree_id) end;
- @flag = 2;
- callfunc "QuestTreeTrigger";
- close;
-
-OnInit:
- .tree_id = getnpcid("#DruidTree0#_M");
- registercmd "*hugs", strnpcinfo(0); // eq: /me hugs (target)
- registercmd "*hugs*", strnpcinfo(0); // eq: /me hugs
- end;
-}
diff --git a/npc/commands/ipcheck.txt b/npc/commands/ipcheck.txt
new file mode 100644
index 00000000..a241d3c0
--- /dev/null
+++ b/npc/commands/ipcheck.txt
@@ -0,0 +1,71 @@
+// TMW2 script
+// Author: Jesusalva <admin@tmw2.org>
+//
+// @ipcheck <player_name>
+// #ipcheck <player_name>
+//
+// Returns user IP
+
+
+- script @ipcheck 32767,{
+ end;
+
+OnCall:
+ if (.@atcmd_numparameters == 0)
+ .@request$ = strcharinfo(0);
+ else
+ .@request$ = implode(.@atcmd_parameters$, " ");
+ dispbottom strip(.@request$)+": IP "+getcharip(.@request$);
+ //dispbottom strcharinfo(0)+": IP "+getcharip(.@request$);
+ end;
+
+OnBan:
+ if (.@atcmd_numparameters == 0) {
+ dispbottom col("Syntax: #ipban <reason>", 1);
+ }
+ // Do not allow banning high-level staff
+ if (is_admin() || is_gm())
+ end;
+ .@target$=strcharinfo(0);
+ .@reason$ = implode(.@atcmd_parameters$, " ");
+ dispbottom col(l("You were permanently banned by the GM Team."), 1);
+ sleep2(200);
+ query_sql "INSERT INTO ipbanlist (list,btime,rtime,reason) VALUES ('"+getcharip(.@target$)+"','"+gettime(7)+"-"+gettime(6)+"-"+gettime(5)+" "+gettime(3)+":"+gettime(2)+":"+gettime(1)+"','2037-01-01 00:00:00','"+.@reason$+"')";
+ logmes("was IP-Blocked, and will not connect again."), LOGMES_ATCOMMAND;
+ sleep2(2000);
+ charcommand("@kick "+.@target$);
+ end;
+
+OnInit:
+ bindatcmd "ipcheck", "@ipcheck::OnCall", 60, 100, 0;
+ bindatcmd "ipban", "@ipcheck::OnBan", 99, 100, 1;
+ end;
+}
+
+// TMW2 script
+// Author: Jesusalva <admin@tmw2.org>
+//
+// @checkidle <player_name>
+// #checkidle <player_name>
+//
+// Returns user idle time in seconds.
+// Useful when the game prohibits warping to player.
+
+
+- script @checkidle 32767,{
+ end;
+
+OnCall:
+ if (.@atcmd_numparameters == 0)
+ .@request$ = strcharinfo(0);
+ else
+ .@request$ = implode(.@atcmd_parameters$, " ");
+ dispbottom strip(.@request$)+" idle time: "+checkidle(.@request$);
+ //dispbottom strcharinfo(0)+": IP "+getcharip(.@request$);
+ end;
+
+OnInit:
+ bindatcmd "checkidle", "@checkidle::OnCall", 60, 80, 0;
+ end;
+}
+
diff --git a/npc/commands/kami.txt b/npc/commands/kami.txt
new file mode 100644
index 00000000..1211fae0
--- /dev/null
+++ b/npc/commands/kami.txt
@@ -0,0 +1,86 @@
+// TMW2 Script
+//
+// @k <message>
+// Broadcast, and broadcast to #world too
+//
+// @servmsg <message>
+// Experimental, uses servicemessage() - requires up to date server
+
+- script @k 32767,{
+ end;
+
+OnCall:
+ .@request$ = strcharinfo(0)+": ";
+ .@request$ += implode(.@atcmd_parameters$, " ");
+ channelmes("#world", .@request$);
+ announce l(.@request$), bc_all|bc_npc;
+ end;
+
+OnServMsg:
+ .@request$ = strcharinfo(0)+": ";
+ .@request$ += implode(.@atcmd_parameters$, " ");
+ // This can be slow, beware
+ .@c = getunits(BL_PC, .@players, MAX_CYCLE_PC);
+ for (.@i = 0; .@i < .@c; .@i++) {
+ message(.@players[.@i], .@request$);
+ }
+ end;
+
+OnBuff:
+ // Disabled command, used for debug purposes
+ .@c = getunits(BL_PC, .@players, MAX_CYCLE_PC);
+ for (.@i = 0; .@i < .@c; .@i++) {
+ attachrid(.@players[.@i]);
+ sc_start SC_INCMHPRATE, 300000, 100;
+ sc_start SC_INCMSPRATE, 300000, 100;
+ sc_start SC_INCFLEERATE, 300000, 100;
+ sc_start SC_INCHITRATE, 300000, 100;
+ sc_start SC_WALKSPEED, 300000, 150;
+ sc_start SC_ATTHASTE_POTION3, 300000, 50;
+ percentheal 100, 100;
+ dispbottom l("YOU WERE BLESSED BY JESUSALVA");
+ dispbottom l("YOU CAN FEEL THE POWER FLOWING TROUGH YOU.");
+ detachrid();
+ }
+ end;
+
+OnInstDestroy:
+ .@request = implode(.@atcmd_parameters$, " ");
+ if (.@request != 0)
+ instance_destroy(.@request);
+ end;
+
+OnInstCheck:
+ .@request$ = implode(.@atcmd_parameters$, " ");
+ dispbottom has_instance2(.@request$);
+ end;
+
+OnInit:
+ bindatcmd "k", "@k::OnCall", 60, 80, 1;
+ bindatcmd "servmsg", "@k::OnServMsg", 80, 99, 1;
+
+ bindatcmd "blessing", "@k::OnBuff", 99, 100, 1;
+ bindatcmd "instcheck", "@k::OnInstCheck", 99, 100, 1;
+ bindatcmd "instdestr", "@k::OnInstDestroy", 99, 100, 1;
+ end;
+}
+
+// kamibroadcast( message{, sender} )
+function script kamibroadcast {
+ .@msg$=getarg(0);
+ .@snd$=getarg(1, "");
+
+ // Send to #world
+ if (.@snd$ == "")
+ channelmes("#world", " "+.@msg$);
+ else
+ channelmes("#world", "[ "+.@snd$+" ] : "+.@msg$);
+
+ // Make an announce
+ if (.@snd$ == "")
+ announce .@msg$, bc_all|bc_npc;
+ else
+ announce .@snd$+" : "+.@msg$, bc_all|bc_npc;
+
+ return;
+}
diff --git a/npc/commands/language.txt b/npc/commands/language.txt
new file mode 100644
index 00000000..ce7122f5
--- /dev/null
+++ b/npc/commands/language.txt
@@ -0,0 +1,60 @@
+// TMW2 Script
+// Author: Jesusalva
+// With code parts from Julia (Evol)
+
+// @lang atcommand
+// Changes Language
+//
+// group lv: 0
+// group char lv: 0
+// log: False
+//
+// usage:
+// @lang
+//
+
+function script CMD_lang {
+ callfunc "checkclientversion";
+ mesq l("Which language do you speak?");
+ next;
+ asklanguage(LANG_IN_SHIP);
+ mes "";
+ mesn;
+ mesq l("Ok, done.");
+ return;
+}
+
+- script @lang 32767,{
+ end;
+
+OnCall:
+ CMD_lang();
+ close;
+
+OnTranslate:
+ // Implode, using a slash at whitespaces
+ .@request$ = implode(.@atcmd_parameters$, "%2F");
+ // No NPC provided?
+ if (.@request$ == "") {
+ dispbottom l("Usage: @translate <npc file>");
+ dispbottom l("Example: @translate Nard");
+ dispbottom l("Example: @translate Elmo");
+ dispbottom l("Example: @translate npc/002-1/arpan");
+ dispbottom l("PS. Doesn't always work. You need an account at %s and to be at ManaPlus Team.", "@@https://www.transifex.com/arctic-games|Transifex@@");
+ end;
+ }
+ // Add .txt extension of needed
+ if (!compare(.@request$, ".txt"))
+ .@request$ += ".txt";
+ // Fix stuff for URL format
+ .@request$ = replacestr(.@request$, "/", "%2F");
+ .@request$ = strtolower(.@request$);
+ // Give your translation link
+ dispbottom "@@https://www.transifex.com/arctic-games/moubootaur-legends/translate/#"+languagecode()+"/serverdata?q=occurrence%3A"+.@request$+"|Translate with Transifex@@";
+ close;
+
+OnInit:
+ bindatcmd "lang", "@lang::OnCall", 0, 60, 0;
+ bindatcmd "translate", "@lang::OnTranslate", 0, 60, 0;
+ end;
+}
diff --git a/npc/commands/marry.txt b/npc/commands/marry.txt
deleted file mode 100755
index ad2ed5fc..00000000
--- a/npc/commands/marry.txt
+++ /dev/null
@@ -1,68 +0,0 @@
-- script special-marry NPC32767,{
- .@target_id = getcharid(3, @args$);
- if (.@target_id < 1 || !(isloggedin(.@target_id)) || .@target_id == BL_ID) goto L_NotFound;
- if (PARTNER || get(PARTNER, .@target_id)) goto L_AlreadyMarried;
- if (isin("014-1",29,36,34,39) == 0 && isin("001-1",20,27,22,27) == 0) goto L_NotInArea;
- if (distance(BL_ID, .@target_id) != 1) goto L_AwayFromPartner;
- if (BaseLevel < WEDDING_MIN_LEVEL || get(BaseLevel, .@target_id) < WEDDING_MIN_LEVEL) goto L_TooYoung;
- if (getequipid(equip_shield) != 702 || getequipid(equip_shield, @args$) != 702) goto L_NoRing;
-
- if (get(@marriage[0], .@target_id) == BL_ID) goto L_Proceed;
-
- setarray @marriage[0], .@target_id, gettimetick(2);
- addtimer (.timeout * 1000), strnpcinfo(0) + "::OnTimeout";
- announce strcharinfo(0) + " is asking " + strcharinfo(0, .@target_id) + " for marriage.", 2;
- message strcharinfo(0, .@target_id), "Marriage : ##3##B" + strcharinfo(0) + " wishes to marry you. To accept, write `##1#marry "+strcharinfo(0)+"##3` within the next "+.timeout+" seconds.";
- end;
-
-L_NotFound:
- message strcharinfo(0), "Marriage : ##3##BThe target player is either not found or yourself.";
- end;
-
-L_TooYoung:
- message strcharinfo(0), "Marriage : ##3##BYou and your partner need to be at least level "+ WEDDING_MIN_LEVEL +".";
- end;
-
-L_NoRing:
- message strcharinfo(0), "Marriage : ##3##BYou and your partner need to have ["+ getitemlink("WeddingRing") +"] equipped.";
- end;
-
-L_AwayFromPartner:
- message strcharinfo(0), "Marriage : ##3##BYou and your partner need to be standing next to each other.";
- end;
-
-L_NotInArea:
- message strcharinfo(0), "Marriage : ##3##BYou are not standing in a designated marriage area.";
- end;
-
-L_Proceed:
- if ((gettimetick(2) - .timeout) > get(@marriage[1], .@target_id)) goto L_TooLate;
- PARTNER = CHAR_ID, .@target_id;
- if (PARTNER == get(CHAR_ID, .@target_id)) goto L_Success;
- PARTNER = 0, .@target_id;
- PARTNER = 0;
- end;
-
-L_Success:
- announce strcharinfo(0) + " and " + strcharinfo(0, .@target_id) + " are now married.", 2;
- end;
-
-OnTimeout:
- goto L_TooLate;
-
-L_TooLate:
- message strcharinfo(0), "Marriage : ##3##BThe proposal expired. Please try again.";
- message strcharinfo(0, @marriage[0]), "Marriage : ##3##BThe proposal expired. Please try again.";
- @marriage[0] = 0, @marriage[0];
- @marriage[0] = 0;
- end;
-
-L_AlreadyMarried:
- message strcharinfo(0), "Marriage : ##3##BYou"+ if_then_else(PARTNER, " are", "r partner is") +" already married.";
- end;
-
-OnInit:
- set .timeout, 30; // timeout for proposal
- registercmd "#marry", strnpcinfo(0); // we NEED to use a # before `marry` because otherwise manaplus does not strip colors
- end;
-}
diff --git a/npc/commands/music.txt b/npc/commands/music.txt
deleted file mode 100755
index 5c62f008..00000000
--- a/npc/commands/music.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-- script @music NPC32767,{
- callfunc "argv_splitter";
- if (GM < CMD_MUSIC && GM < G_SYSOP) goto L_GM;
- if (@argv$[0] == "") goto L_Failed;
-
- gmlog "@music " + @args$;
- .@find = array_search(@argv$[0], .find$);
- if (.@find >= 0)
- @argv$[0] = .replace$[max(.@find, 0)];
- .file$ = @argv$[0];
- areatimer 0, getmapname(), (POS_X - .range), (POS_Y - .range), (POS_X + .range), (POS_Y + .range), 0, strnpcinfo(0)+"::OnPC";
- message strcharinfo(0), "music : The music has ben temporarily changed.";
- end;
-
-OnPC:
- music .file$ + ".ogg";
- end;
-
-L_Failed:
- message strcharinfo(0), "music : You must specify a music file.";
- end;
-
-L_GM:
- message strcharinfo(0), "music : GM command is level "+ CMD_MUSIC +", but you are level " + GM;
- end;
-
-OnInit:
- setarray .find$, "this", "cave", "chilling", "clouds", "dimond", "explorers", "gy", "reid", "magick", "mystique", "night", "ride", "sail", "snow", "forest", "xmas";
- setarray .replace$, "this", "cavesong", "chilling-environment", "clouds-calling", "dimonds-cove", "explorers-melody", "graveyard", "inquisitive-inn", "magick-real", "mystique-forest", "night-is-calling", "ride-of-the-valkyries", "sail-away", "snow-village", "the-forest", "white-christmas";
- set .range, 14; // FIXME: make this a const
- registercmd chr(ATCMD_SYMBOL) + "music", strnpcinfo(0);
- end;
-}
diff --git a/npc/commands/mute.txt b/npc/commands/mute.txt
deleted file mode 100755
index 555fa724..00000000
--- a/npc/commands/mute.txt
+++ /dev/null
@@ -1,92 +0,0 @@
-- script @mute NPC32767,{
- callfunc "argv_splitter";
- if (GM < CMD_MUTE && GM < G_SYSOP) goto L_GM;
- if (@argv$[1] == "") goto L_Failed;
-
- .@target_id = getcharid(3, @argv$[1]);
- if (.@target_id < 1 || !(isloggedin(.@target_id))) goto L_Failed;
-
- if (@argv[0] > 120)
- set @argv[0], 120; // max 2 hours
-
- gmlog "@mute " + @args$;
- if (@argv[0] == 0) goto L_UnMute;
-
- message strcharinfo(0, .@target_id), "Server : ##BYou have been muted by a GM for "+@argv[0]+" minutes.";
- MUTE_GLOBAL = 1, .@target_id;
- #MUTE_UNTIL = (gettimetick(2) + (@argv[0] * 60)), .@target_id;
- addtimer (@argv[0] * 60000) + 100, strnpcinfo(0) + "::OnCheckMute", .@target_id;
- message strcharinfo(0), "mute : Player `"+strcharinfo(0, .@target_id)+"` has been muted for "+@argv[0]+" minutes.";
- end;
-
-OnSTFU:
- if (GM < CMD_MUTE && GM < G_SYSOP) goto L_GM;
- callfunc "argv_splitter";
- if (@argv[0] < 1) set @argv[0], 1;
- if (@argv[0] > 10) set @argv[0], 10;
- gmlog "@stfu " + @argv[0];
- @stfu_nr = 0;
- foreach 0, getmapname(), (POS_X - .range), (POS_Y - .range), (POS_X + .range), (POS_Y + .range), strnpcinfo(0)+"::OnSTFUPC";
- message strcharinfo(0), "mute : Every player within "+.range+" tiles have been muted for "+@argv[0]+" minutes. ["+@stfu_nr+"]";
- @stfu_nr = 0;
- end;
-
-OnSTFUPC:
- if (@target_id == BL_ID) end;
- .@future = (gettimetick(2) + (@argv[0] * 60));
- if (get(#MUTE_UNTIL, @target_id) > .@future) end; // if player already has a mute, don't reduce it
- MUTE_GLOBAL = 1, @target_id;
- #MUTE_UNTIL = .@future, @target_id;
- addtimer (@argv[0] * 60000) + 100, strnpcinfo(0) + "::OnCheckMute", @target_id;
- @stfu_nr = @stfu_nr + 1;
- end;
-
-OnPCLoginEvent:
- if (#MUTE_UNTIL < 1) end;
- .@s = (#MUTE_UNTIL - gettimetick(2));
- if (.@s < 5) goto L_ClearMute;
- .@m = .@s / 60;
- message strcharinfo(0), "Server : ##BYou have been muted for "+ max(1, .@m) +" minutes.";
- MUTE_GLOBAL = 1;
- addtimer (.@s * 1000) + 100, strnpcinfo(0) + "::OnCheckMute";
- end;
-
-L_ClearMute:
- message strcharinfo(0), "Server : ##BYour mute has expired while you were away. You have been automatically unmuted.";
- if ((#MUTE_UNTIL - gettimetick(2)) >= (0 - 900))
- wgm "=> Player `"+ strcharinfo(0) +"` has been automatically unmuted."; // only send if unmuted 15 minutes ago or less
- #MUTE_UNTIL = 0;
- end;
-
-OnCheckMute:
- if (#MUTE_UNTIL < 1) end;
- if (gettimetick(2) - #MUTE_UNTIL < 0) end;
- message strcharinfo(0), "Server : ##BYou have been automatically unmuted.";
- wgm "=> Player `"+ strcharinfo(0) +"` has been automatically unmuted.";
- MUTE_GLOBAL = 0;
- #MUTE_UNTIL = 0;
- end;
-
-L_UnMute:
- if (get(MUTE_GLOBAL, .@target_id))
- message strcharinfo(0, .@target_id), "Server : ##BYou have been unmuted by a GM.";
- MUTE_GLOBAL = 0, .@target_id;
- #MUTE_UNTIL = 0, .@target_id;
- message strcharinfo(0), "mute : Player `"+strcharinfo(0, .@target_id)+"` has been unmuted.";
- end;
-
-L_Failed:
- message strcharinfo(0), "mute : Impossible to attach to the target player. Did you try putting the name in \"quotation marks\"?";
- end;
-
-L_GM:
- message strcharinfo(0), "mute : GM command is level "+ CMD_MUTE +", but you are level " + GM;
- end;
-
-OnInit:
- set .range, 14; // FIXME: this should be a const
- registercmd chr(ATCMD_SYMBOL) + "mute", strnpcinfo(0);
- registercmd chr(ATCMD_SYMBOL) + "stfu", strnpcinfo(0) + "::OnSTFU";
- registercmd chr(ATCMD_SYMBOL) + "areamute", strnpcinfo(0) + "::OnSTFU"; // alias of STFU
- end;
-}
diff --git a/npc/commands/npctalk.txt b/npc/commands/npctalk.txt
deleted file mode 100755
index b1179dc6..00000000
--- a/npc/commands/npctalk.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-- script @npctalk NPC32767,{
- callfunc "argv_splitter";
- if (GM < CMD_NPCTALK && GM < G_SYSOP) goto L_GM;
- if (@argv$[0] == "" || @argv$[1] == "") goto L_Failed;
- if (getnpcid(@argv$[0]) < 1) goto L_Failed;
-
- gmlog "@npctalk " + @args$;
- npctalk @argv$[0], @argv$[1];
- end;
-
-L_Failed:
- message strcharinfo(0), "npctalk : Impossible to attach to the target npc. Did you try putting the name in \"quotation marks\"?";
- end;
-
-L_GM:
- message strcharinfo(0), "npctalk : GM command is level "+ CMD_NPCTALK +", but you are level " + GM;
- end;
-
-OnInit:
- registercmd chr(ATCMD_SYMBOL) + "npctalk", strnpcinfo(0);
- end;
-}
diff --git a/npc/commands/numa.txt b/npc/commands/numa.txt
index 92cd5c9d..b8b0a924 100755
--- a/npc/commands/numa.txt
+++ b/npc/commands/numa.txt
@@ -1,8 +1,8 @@
- script SuperDebug NPC32767,{
if (GM < MAP_LOUNGE && GM < G_SYSOP && !debug) goto L_GM2; // make sure you can enter the gm lounge
- if (target(BL_ID,getnpcid("Numa"),1)) goto L_Main;
- npcaction 6, 12;
+ //if (target(BL_ID,getnpcid("Numa"),1)) goto L_Main;
+ //npcaction 6, 12;
title "Numa";
goto L_Main;
@@ -78,51 +78,18 @@ L_GM:
goto L_close;
L_Quest:
- callfunc "QuestDebug";
+ callfunc "GlobalQuestDebug";
goto L_close;
L_close:
close;
OnInit:
- registercmd chr(ATCMD_SYMBOL) + "numa", strnpcinfo(0);
- registercmd chr(ATCMD_SYMBOL) + "superdebug", strnpcinfo(0);
+ registercmd "numa", strnpcinfo(0);
+ registercmd "superdebug", strnpcinfo(0);
end;
}
017-9,30,28,0 duplicate(SuperDebug) Numa NPC393
-function script QuestDebug {
- goto L_ChooseContinent;
-L_ChooseContinent:
- mes "Choose a continent.";
- next;
- menu
- "Argeas", L_Argeas,
- "Close", L_Return;
-
-L_Argeas:
- mes "Choose an area.";
- next;
- menu
- "Woodland", L_Woodland,
- "Choose a continent", L_ChooseContinent,
- "Close", L_Return;
-
-L_Woodland:
- mes "Choose a quest.";
- next;
- menu
- "Illia Sisters", L_Valia,
- "Choose an area", L_Argeas,
- "Close", L_Return;
-
-L_Return:
- return;
-
-
-L_Valia:
- callfunc "IlliaDebug";
- goto L_Return;
-}
diff --git a/npc/commands/pullrabbit.txt b/npc/commands/pullrabbit.txt
deleted file mode 100755
index 8ca0a69a..00000000
--- a/npc/commands/pullrabbit.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-- script @pullrabbit NPC32767,{
- if (GM < EVT_KILLTHEGM && GM < G_SYSOP) end;
- if (getequipid(equip_head) != 888) end;
- getinventorylist;
- if ((checkweight("MurdererCrown", 1) == 0) || (@inventorylist_count == 100))
- goto L_Inventory;
- // Get the current reward of the event. This may be changed later
- getitem "MurdererCrown", 1;
- // Set HP and SP to max
- heal MaxHp, MaxSp;
- // Display an effect
- misceffect FX_CHANNELLING_CAST, strcharinfo(0);
- // Log the usage of this spell
- gmlog strcharinfo(0)+" used the Magic GM Top Hat.";
- end;
-
-L_Inventory:
- message strcharinfo(0), "You cannot create this item. You're too heavy or you don't have a free slot.";
- end;
-
-OnInit:
- registercmd chr(ATCMD_SYMBOL) + "pullrabbit", strnpcinfo(0);
- registercmd chr(MAGIC_SYMBOL) + "pullrabbit", strnpcinfo(0); // former pullrabbit invocation
- end;
-}
diff --git a/npc/commands/python.txt b/npc/commands/python.txt
new file mode 100644
index 00000000..5273731c
--- /dev/null
+++ b/npc/commands/python.txt
@@ -0,0 +1,27 @@
+// The Mana World script
+// Author: Gumi <gumi@themanaworld.org>
+// Author: Jesusalva <jesusalva@themanaworld.org>
+//
+// Stomp stomp stomp (use with caution)
+
+- script @python 32767,{
+ end;
+
+OnCall:
+ specialeffect(34, AREA, playerattached());
+ .@zone$=getmapinfo(MAPINFO_ZONE, .@mapa$);
+ if (.@zone$ == "MMO")
+ end;
+ sc_start SC_CASH_DEATHPENALTY, 1000, 1;
+ addtimer 380, .name$+"::OnKill";
+ end;
+
+OnKill:
+ percentheal -100, -100;
+ //dispbottom l("Oh look, it is Cupid!");
+ end;
+
+OnInit:
+ bindatcmd "python", "@python::OnCall", 60, 60, 1;
+ end;
+}
diff --git a/npc/commands/remotecmd.txt b/npc/commands/remotecmd.txt
deleted file mode 100755
index 20f33f8c..00000000
--- a/npc/commands/remotecmd.txt
+++ /dev/null
@@ -1,61 +0,0 @@
-- script @remotecmd NPC32767,{
- callfunc "argv_splitter";
- if (GM < CMD_REMOTECMD && GM < G_SYSOP) goto L_GM; // check if you can use it on self
- .@target_id = BL_ID;
- .@t$ = @argv$[1];
- setarray @remotecmd[0], 0, 1, 1; // nr, to_self, multi_target
- if (.@t$ == "map") goto L_Map;
- if (.@t$ == "map!") goto L_AllMap;
- if (.@t$ == "area") goto L_Area;
- if (.@t$ == "area!") goto L_AllArea;
- if (.@t$ != "") set .@target_id, getcharid(3, @argv$[1]);
- if (.@t$ != "" && !(isloggedin(.@target_id))) goto L_Failed; // do NOT fallback to self
-
- @target_id = .@target_id;
- set @remotecmd[2], 0; // only one target
- addtimer 0, strnpcinfo(0) + "::OnPC";
- end;
-
-L_Map:
- set @remotecmd[1], 0; // do not include self
- goto L_AllMap;
-
-L_AllMap:
- foreach 0, getmapname(), 0, 0, 32767, 32767, strnpcinfo(0)+"::OnPC";
- goto L_Success;
-
-L_Area:
- set @remotecmd[1], 0; // do not include self
- goto L_AllMap;
-
-L_AllArea:
- foreach 0, getmapname(), (POS_X - .range), (POS_Y - .range), (POS_X + .range), (POS_Y + .range), strnpcinfo(0)+"::OnPC";
- goto L_Success;
-
-OnPC:
- if (@target_id == BL_ID && @remotecmd[1] < 1)
- end;
- remotecmd @argv$[0], strcharinfo(0, @target_id);
- @remotecmd[0] = @remotecmd[0] + 1;
- if (@remotecmd[2] < 1)
- goto L_Success;
- end;
-
-L_Success:
- gmlog "@remotecmd " + @args$;
- message strcharinfo(0), "remotecmd : The operation succeeded. ["+ @remotecmd[0] + "]";
- end;
-
-L_Failed:
- message strcharinfo(0), "remotecmd : Impossible to attach to the target player. Did you try putting the name in \"quotation marks\"?";
- end;
-
-L_GM:
- message strcharinfo(0), "remotecmd : GM command is level "+ CMD_REMOTECMD +", but you are level " + GM;
- end;
-
-OnInit:
- set .range, 14; // visible range
- registercmd chr(ATCMD_SYMBOL) + "remotecmd", strnpcinfo(0);
- end;
-}
diff --git a/npc/commands/resync.txt b/npc/commands/resync.txt
new file mode 100644
index 00000000..246bfa88
--- /dev/null
+++ b/npc/commands/resync.txt
@@ -0,0 +1,45 @@
+// TMW2 script
+// Author: Jesusalva <admin@tmw2.org>
+//
+// Introduces @resync
+//
+// It'll cast slide to your own position
+// Hopefully making client update your real position without causing server warning
+//
+// This also introduces @resyncall
+// Which is an alias for @refresh and causes client to reload the whole map,
+// Including yourself and monsters.
+
+- script @resync 32767,{
+ end;
+
+// Soft Resync
+OnCall:
+ if (ispcdead()) {
+ dispbottom l("Impossible to resync: You are dead.");
+ end;
+ }
+ if (@rsync_delay > gettimetick(2)) {
+ dispbottom l("Not resync'ing to prevent flood.");
+ end;
+ }
+ getmapxy(.@m$, .@x, .@y, 0);
+ slide .@x, .@y;
+ @rsync_delay=gettimetick(2)+rand2(3,5);
+ end;
+
+// Hard Resync
+OnCallRefresh:
+ if (@rsync_delay > gettimetick(2)) {
+ dispbottom l("Not resync'ing to prevent flood.");
+ end;
+ }
+ @rsync_delay=gettimetick(2)+rand2(3,5);
+ atcommand("@refresh");
+ end;
+
+OnInit:
+ bindatcmd "resync", "@resync::OnCall", 0, 60, 0;
+ bindatcmd "resyncall", "@resync::OnCallRefresh", 0, 60, 0;
+ end;
+}
diff --git a/npc/commands/warp.txt b/npc/commands/warp.txt
deleted file mode 100755
index d2eee4e2..00000000
--- a/npc/commands/warp.txt
+++ /dev/null
@@ -1,56 +0,0 @@
-- script @warp NPC32767,{
- callfunc "argv_splitter";
- if (@argv$[3] == "" && @argv$[2] == "" && @argv$[1] != "" && @argv[1] < 2)
- @argv$[3] = @argv$[1];
-
- .@n$ = if_then_else(@argv$[3] != "", "char", "") + "warp";
- if (GM < CMD_WARP && GM < G_SYSOP) goto L_GM; // check if you can use it on self
- .@target_id = BL_ID;
- if (@argv$[3] != "") set .@target_id, getcharid(3, @argv$[3]);
- if (@argv$[3] != "" && !(isloggedin(.@target_id))) goto L_Failed; // do NOT fallback to self
- if (@argv$[3] != "" && GM < CMD_CHARWARP && GM < G_SYSOP) goto L_GM; // when target is not self, use charwarp permission
-
- if (@argv$[0] == "")
- @argv$[0] = getmapname();
-
- setarray @map_anchor$[0], "", "", "", "";
- callfunc "map2anchor";
-
- gmlog "@"+.@n$+" " + @args$;
- if (.@target_id != BL_ID)
- message strcharinfo(0), .@n$+" : The operation succeeded.";
-
- @GMWARP_map$ = @map_anchor$[0];
- @GMWARP_x = if_then_else(@argv[1] > 1, @argv[1], @map_anchor$[1]);
- @GMWARP_y = if_then_else(@argv[2] > 1, @argv[2], @map_anchor$[2]);
- addtimer 0, strnpcinfo(0) + "::OnWarp", .@target_id;
-
- if (@map_anchor$[3] == "no" && @knows_anchors < 1)
- goto L_SuggestAnchors;
- end;
-
-L_SuggestAnchors:
- message strcharinfo(0), .@n$+" : The warp command has been improved. You might want to consider using [@@https://www.themanaworld.org/index.php/Dev:GM_Commands/anchors|map anchors@@].";
- @knows_anchors = 1;
- end;
-
-OnWarp:
- warp @GMWARP_map$, @GMWARP_x, @GMWARP_y;
- @GMWARP_map$ = "";
- @GMWARP_x = 0;
- @GMWARP_y = 0;
- end;
-
-L_Failed:
- message strcharinfo(0), .@n$+" : Impossible to attach to the target player. Did you try putting the name in \"quotation marks\"?";
- end;
-
-L_GM:
- message strcharinfo(0), .@n$+" : GM command is level "+ if_then_else(@argv$[1] != "", CMD_CHARWARP, CMD_WARP) +", but you are level " + GM;
- end;
-
-OnInit:
- registercmd chr(ATCMD_SYMBOL) + "warp", strnpcinfo(0);
- registercmd chr(ATCMD_SYMBOL) + "charwarp", strnpcinfo(0);
- end;
-}
diff --git a/npc/commands/zeny.txt b/npc/commands/zeny.txt
deleted file mode 100755
index de1013eb..00000000
--- a/npc/commands/zeny.txt
+++ /dev/null
@@ -1,78 +0,0 @@
-- script @zeny NPC32767,{
- callfunc "argv_splitter";
- .@n$ = if_then_else(@argv$[1] != "", "char", "") + "Zeny";
- if (GM < CMD_ZENY && GM < G_SYSOP) goto L_GM; // check if you can use it on self
- .@target_id = BL_ID;
- if (@argv$[1] != "") set .@target_id, getcharid(3, @argv$[1]);
- if (@argv$[1] != "" && !(isloggedin(.@target_id))) goto L_Failed; // do NOT fallback to self
- if (@argv$[1] != "" && GM < CMD_CHARZENY && GM < G_SYSOP) goto L_GM; // when target is not self, use charZeny permission
- if (@argv$[0] == "--") goto L_Remove;
- if (@argv$[0] == "---") goto L_RemoveAll;
- if (@argv$[0] == "++") goto L_Max;
- if (@argv$[0] == "+++") goto L_MaxAll;
- set .@delta, @argv[0]; // ± Zeny
- set .@Zeny, get(Zeny, .@target_id); // get the number of Zeny in char
- set .@bank, get(#BankAccount, .@target_id); // get number of Zeny in (world) account
- set .@new_Zeny, .@Zeny + .@delta; // new balance in char
- if (.@new_Zeny < 0) goto L_MaybeRemoveBank; // Zeny would be below 0 so check if we can take from bank
- if (.@new_Zeny > .max_Zeny) goto L_MaybeAddBank; // Zeny would be over the limit so check if we can store in bank
- Zeny = (.@Zeny + .@delta), .@target_id;
- goto L_Success;
-
-L_Remove:
- Zeny = 0, .@target_id;
- goto L_Success;
-
-L_RemoveAll:
- Zeny = 0, .@target_id;
- #BankAccount = 0, .@target_id;
- goto L_Success;
-
-L_Max:
- Zeny = .max_Zeny, .@target_id;
- goto L_Success;
-
-L_MaxAll:
- Zeny = .max_Zeny, .@target_id;
- #BankAccount = .max_int, .@target_id;
- goto L_Success;
-
-L_MaybeAddBank:
- .@new_bank = (.@bank + (.@new_Zeny - .max_Zeny));
- if (.@new_bank > .max_int || .@new_bank < 0) goto L_OutOfBounds;
- Zeny = .max_Zeny, .@target_id;
- #BankAccount = .@new_bank, .@target_id;
- goto L_Success;
-
-L_MaybeRemoveBank:
- if ((.@bank + .@new_Zeny) < 0) goto L_OutOfBounds;
- Zeny = 0, .@target_id;
- #BankAccount = (.@bank + .@new_Zeny), .@target_id;
- goto L_Success;
-
-L_OutOfBounds:
- // XXX: maybe we could also take from other chars from the same accout?
- message strcharinfo(0), .@n$+" : Impossible to proceed! This would cause the player to have less than 0 Zeny or more than " + .max_int + ".";
- end;
-
-L_Failed:
- // XXX: should we allow GMs to change Zeny of users that are not logged in?
- message strcharinfo(0), .@n$+" : Impossible to attach to the target player. Did you try putting the name in \"quotation marks\"?";
- end;
-
-L_Success:
- gmlog "@Zeny " + @args$;
- message strcharinfo(0), .@n$+" : The operation succeeded.";
- end;
-
-L_GM:
- message strcharinfo(0), .@n$+" : GM command is level "+ if_then_else(@argv$[1] != "", CMD_CHARZENY, CMD_ZENY) +", but you are level " + GM;
- end;
-
-OnInit:
- set .max_Zeny, 1000000000; // hardcoded in tmwa
- set .max_int, 2147483647; // max int32 value
- registercmd chr(ATCMD_SYMBOL) + "Zeny", strnpcinfo(0);
- registercmd chr(ATCMD_SYMBOL) + "charZeny", strnpcinfo(0);
- end;
-}