summaryrefslogtreecommitdiff
path: root/npc/custom/etc
diff options
context:
space:
mode:
authorEmistry Haoyan <equinox1991@gmail.com>2019-06-16 18:44:45 +0800
committerHaru <haru@dotalux.com>2019-07-28 18:17:09 +0200
commit371d056df80b6f83484534f64883c3d020c4112d (patch)
tree20d38a8581f3a6159157bfa6644027d4007485bc /npc/custom/etc
parentef8bc3a8375d4fe9a5f75faf951b3deecb891d57 (diff)
downloadhercules-371d056df80b6f83484534f64883c3d020c4112d.tar.gz
hercules-371d056df80b6f83484534f64883c3d020c4112d.tar.bz2
hercules-371d056df80b6f83484534f64883c3d020c4112d.tar.xz
hercules-371d056df80b6f83484534f64883c3d020c4112d.zip
Sanitize handling of the input() values.
- avoid potential hacks for old scripts that use `input()` script commands. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'npc/custom/etc')
-rw-r--r--npc/custom/etc/bank.txt38
-rw-r--r--npc/custom/etc/bank_kafra.txt6
-rw-r--r--npc/custom/etc/lottery.txt150
-rw-r--r--npc/custom/etc/marriage.txt2
-rw-r--r--npc/custom/etc/monster_arena.txt9
-rw-r--r--npc/custom/etc/quest_warper.txt34
-rw-r--r--npc/custom/etc/shifty_assassin.txt7
-rw-r--r--npc/custom/etc/stock_market.txt15
8 files changed, 148 insertions, 113 deletions
diff --git a/npc/custom/etc/bank.txt b/npc/custom/etc/bank.txt
index c5bed187b..4135ed192 100644
--- a/npc/custom/etc/bank.txt
+++ b/npc/custom/etc/bank.txt
@@ -28,27 +28,25 @@ switch(select("I'd like to make a deposit.", "I'd like to make a withdrawl.", "W
mes "Oh, and do realize there is a " +@cost + " Zeny charge on all transactions!";
next;
}
- input @deposit;
+ input(@deposit);
if (@deposit < 1) {
mes "Make sure you ask me to deposit a real amount.";
close;
}
- else if (@deposit > Zeny) {
+ if (@deposit > Zeny) {
mes "It does not appear like you have the amount of zeny you're trying to deposit!";
close;
}
- else if (@deposit > (Zeny - @cost)) {
+ if (@deposit > Zeny - @cost) {
mes "You need " + @cost + " Zeny to cover the transaction fee!";
close;
}
- else {
Zeny -= @deposit;
Zeny -= @cost;
- set #bankstorage,#bankstorage + @deposit;
+ #bankstorage += @deposit;
mes "[Banker]";
mes "Thank you very much... Your zeny is in good hands.";
close;
- }
case 2:
mes "[Banker]";
@@ -59,16 +57,16 @@ switch(select("I'd like to make a deposit.", "I'd like to make a withdrawl.", "W
mes "Oh, and do realize there is a " +@cost + " Zeny charge on all transactions!";
next;
}
- input @withdrawl;
+ input(@withdrawl);
if (@withdrawl < 1) {
mes "Please don't play games. I need a real amount to withdraw.";
close;
}
- else if (@withdrawl > #bankstorage) {
+ if (@withdrawl > #bankstorage) {
mes "I show you only have ^00FF00" + #bankstorage +"^000000 zeny in your account!";
close;
}
- else if ((@cost > Zeny) && ((Zeny + @withdrawl) > @cost)) {
+ if (@cost > Zeny && Zeny + @withdrawl > @cost) {
mes "[Banker]";
mes "You don't have the Zeny for the transaction fee right now. Would you like me to take the fee directly from your withdrawl?";
next;
@@ -76,13 +74,13 @@ switch(select("I'd like to make a deposit.", "I'd like to make a withdrawl.", "W
case 1:
mes "[Banker]";
mes "Removing " + @cost + " from your withdrawl to cover the deposit fee...";
- set @withdrawl,@withdrawl - @cost;
- set #bankstorage,#bankstorage - @cost;
- set @cost,0;
+ @withdrawl -= @cost;
+ #bankstorage -= @cost;
+ @cost = 0;
next;
Zeny -= @cost;
Zeny += @withdrawl;
- set #bankstorage,#bankstorage - @withdrawl;
+ #bankstorage -= @withdrawl;
mes "[Banker]";
mes "There's your Zeny. Have a good day.";
close;
@@ -92,14 +90,12 @@ switch(select("I'd like to make a deposit.", "I'd like to make a withdrawl.", "W
close;
}
}
- else {
- Zeny -= @cost;
- Zeny += @withdrawl;
- set #bankstorage,#bankstorage - @withdrawl;
- mes "[Banker]";
- mes "There's your Zeny. Have a good day.";
- close;
- }
+ Zeny -= @cost;
+ Zeny += @withdrawl;
+ #bankstorage -= @withdrawl;
+ mes "[Banker]";
+ mes "There's your Zeny. Have a good day.";
+ close;
case 3:
mes "[Banker]";
mes "Hmmmm let me check some paper work.";
diff --git a/npc/custom/etc/bank_kafra.txt b/npc/custom/etc/bank_kafra.txt
index 375a9f611..a970f8302 100644
--- a/npc/custom/etc/bank_kafra.txt
+++ b/npc/custom/etc/bank_kafra.txt
@@ -44,7 +44,8 @@ L_NoIncomeToday:
mes"[Maniss]";
mes "Please, tell me how much zeny you would like to deposit.";
next;
- if(input(@kafrabank) == 1) goto L_TOO_BIG_AMOUNT;
+ if (input(@kafrabank, 0) == 1)
+ goto L_TOO_BIG_AMOUNT;
if(@kafrabank<1000) goto L_LESS_1000;
if(@kafrabank>Zeny) goto L_NOT_ENOUGH;
@@ -62,7 +63,8 @@ M_WITHDRAW:
mes "Your account: ^135445" + #kafrabank + "^000000 zeny.";
mes "How much zeny would you like to withdraw?";
next;
- if(input(@kafrabank) == 1) goto L_TOO_BIG_AMOUNT;
+ if (input(@kafrabank, 0) == 1)
+ goto L_TOO_BIG_AMOUNT;
if(@kafrabank<1) goto B_EXIT2;
if(@kafrabank>#kafrabank) goto L_NOT_ENOUGH;
diff --git a/npc/custom/etc/lottery.txt b/npc/custom/etc/lottery.txt
index 421fccc78..0c6c987a5 100644
--- a/npc/custom/etc/lottery.txt
+++ b/npc/custom/etc/lottery.txt
@@ -171,43 +171,64 @@ L_HandPick:
set @L5,0;
set @L6,0;
Input1:
- input @L1;
- if (@L1 < 1 || @L1 > 40) goto Input1;
+ input(@L1);
+ if (@L1 < 1 || @L1 > 40)
+ goto Input1;
mes @L1;
Input2:
- input @L2;
- if (@L2 < 1 || @L2 > 40) goto Input2;
- if (@L2 == @L1) goto Input2;
+ input(@L2);
+ if (@L2 < 1 || @L2 > 40)
+ goto Input2;
+ if (@L2 == @L1)
+ goto Input2;
mes @L2;
Input3:
- input @L3;
- if (@L3 < 1 || @L3 > 40) goto Input3;
- if (@L3 == @L1) goto Input3;
- if (@L3 == @L2) goto Input3;
+ input(@L3);
+ if (@L3 < 1 || @L3 > 40)
+ goto Input3;
+ if (@L3 == @L1)
+ goto Input3;
+ if (@L3 == @L2)
+ goto Input3;
mes @L3;
Input4:
- input @L4;
- if (@L4 < 1 || @L4 > 40) goto Input4;
- if (@L4 == @L1) goto Input4;
- if (@L4 == @L2) goto Input4;
- if (@L4 == @L3) goto Input4;
+ input(@L4);
+ if (@L4 < 1 || @L4 > 40)
+ goto Input4;
+ if (@L4 == @L1)
+ goto Input4;
+ if (@L4 == @L2)
+ goto Input4;
+ if (@L4 == @L3)
+ goto Input4;
mes @L4;
Input5:
- input @L5;
- if (@L5 < 1 || @L5 > 40) goto Input5;
- if (@L5 == @L1) goto Input5;
- if (@L5 == @L2) goto Input5;
- if (@L5 == @L3) goto Input5;
- if (@L5 == @L4) goto Input5;
+ input(@L5);
+ if (@L5 < 1 || @L5 > 40)
+ goto Input5;
+ if (@L5 == @L1)
+ goto Input5;
+ if (@L5 == @L2)
+ goto Input5;
+ if (@L5 == @L3)
+ goto Input5;
+ if (@L5 == @L4)
+ goto Input5;
mes @L5;
Input6:
- input @L6;
- if (@L6 < 1 || @L6 > 40) goto Input6;
- if (@L6 == @L1) goto Input6;
- if (@L6 == @L2) goto Input6;
- if (@L6 == @L3) goto Input6;
- if (@L6 == @L4) goto Input6;
- if (@L6 == @L5) goto Input6;
+ input(@L6);
+ if (@L6 < 1 || @L6 > 40)
+ goto Input6;
+ if (@L6 == @L1)
+ goto Input6;
+ if (@L6 == @L2)
+ goto Input6;
+ if (@L6 == @L3)
+ goto Input6;
+ if (@L6 == @L4)
+ goto Input6;
+ if (@L6 == @L5)
+ goto Input6;
mes @L6;
next;
mes "[Lottery]";
@@ -406,43 +427,64 @@ L_GM_Rig:
set $LR5,0;
set $LR6,0;
GMInput1:
- input $LR1;
- if ($LR1 < 1 || $LR1 > 40) goto GMInput1;
+ input($LR1);
+ if ($LR1 < 1 || $LR1 > 40)
+ goto GMInput1;
mes $LR1;
GMInput2:
- input $LR2;
- if ($LR2 < 1 || $LR2 > 40) goto GMInput2;
- if ($LR2 == $LR1) goto GMInput2;
+ input($LR2);
+ if ($LR2 < 1 || $LR2 > 40)
+ goto GMInput2;
+ if ($LR2 == $LR1)
+ goto GMInput2;
mes $LR2;
GMInput3:
- input $LR3;
- if ($LR3 < 1 || $LR3 > 40) goto GMInput3;
- if ($LR3 == $LR1) goto GMInput3;
- if ($LR3 == $LR2) goto GMInput3;
+ input($LR3);
+ if ($LR3 < 1 || $LR3 > 40)
+ goto GMInput3;
+ if ($LR3 == $LR1)
+ goto GMInput3;
+ if ($LR3 == $LR2)
+ goto GMInput3;
mes $LR3;
GMInput4:
- input $LR4;
- if ($LR4 < 1 || $LR4 > 40) goto GMInput4;
- if ($LR4 == $LR1) goto GMInput4;
- if ($LR4 == $LR2) goto GMInput4;
- if ($LR4 == $LR3) goto GMInput4;
+ input($LR4);
+ if ($LR4 < 1 || $LR4 > 40)
+ goto GMInput4;
+ if ($LR4 == $LR1)
+ goto GMInput4;
+ if ($LR4 == $LR2)
+ goto GMInput4;
+ if ($LR4 == $LR3)
+ goto GMInput4;
mes $LR4;
GMInput5:
- input $LR5;
- if ($LR5 < 1 || $LR5 > 40) goto GMInput5;
- if ($LR5 == $LR1) goto GMInput5;
- if ($LR5 == $LR2) goto GMInput5;
- if ($LR5 == $LR3) goto GMInput5;
- if ($LR5 == $LR4) goto GMInput5;
+ input($LR5);
+ if ($LR5 < 1 || $LR5 > 40)
+ goto GMInput5;
+ if ($LR5 == $LR1)
+ goto GMInput5;
+ if ($LR5 == $LR2)
+ goto GMInput5;
+ if ($LR5 == $LR3)
+ goto GMInput5;
+ if ($LR5 == $LR4)
+ goto GMInput5;
mes $LR5;
GMInput6:
- input $LR6;
- if ($LR6 < 1 || $LR6 > 40) goto GMInput6;
- if ($LR6 == $LR1) goto GMInput6;
- if ($LR6 == $LR2) goto GMInput6;
- if ($LR6 == $LR3) goto GMInput6;
- if ($LR6 == $LR4) goto GMInput6;
- if ($LR6 == $LR5) goto GMInput6;
+ input($LR6);
+ if ($LR6 < 1 || $LR6 > 40)
+ goto GMInput6;
+ if ($LR6 == $LR1)
+ goto GMInput6;
+ if ($LR6 == $LR2)
+ goto GMInput6;
+ if ($LR6 == $LR3)
+ goto GMInput6;
+ if ($LR6 == $LR4)
+ goto GMInput6;
+ if ($LR6 == $LR5)
+ goto GMInput6;
mes $LR6;
next;
mes "[Lottery]";
diff --git a/npc/custom/etc/marriage.txt b/npc/custom/etc/marriage.txt
index 4e521ec55..c392c5ff1 100644
--- a/npc/custom/etc/marriage.txt
+++ b/npc/custom/etc/marriage.txt
@@ -105,7 +105,7 @@ prt_church,100,123,4 script Vomars 1_M_PASTOR,{
npctalk "Ladies and gentlemen, "+strcharinfo(PC_NAME)+" has an objection to the wedding!";
SF_wed_end();
mes "Why should they not be wed?";
- input $@msg$;
+ input($@msg$);
npctalk strcharinfo(PC_NAME)+"'s objection is: "+$@msg$;
emotion e_sob;
mes "I see...";
diff --git a/npc/custom/etc/monster_arena.txt b/npc/custom/etc/monster_arena.txt
index 8420cd544..249e5518d 100644
--- a/npc/custom/etc/monster_arena.txt
+++ b/npc/custom/etc/monster_arena.txt
@@ -322,10 +322,11 @@ L_Sell:
mes "You have: ^FF0000" + #monpoints + "^000000 experience points";
mes "How many would you like to sell?";
next;
- input @sellexp;
- if (@sellexp > #monpoints) goto L_NoExp;
- set #monpoints,#monpoints-@sellexp;
- set @sellearn,100*@sellexp; // Price of exp
+ input(@sellexp, 0);
+ if (@sellexp > #monpoints)
+ goto L_NoExp;
+ #monpoints -= @sellexp;
+ @sellearn = 100 * @sellexp; // Price of exp
Zeny += @sellearn;
mes "[Monster Trainer]";
mes "You earned ^0000FF" + @sellearn + "^000000z.";
diff --git a/npc/custom/etc/quest_warper.txt b/npc/custom/etc/quest_warper.txt
index 2ae2e7f7f..fec9c6b14 100644
--- a/npc/custom/etc/quest_warper.txt
+++ b/npc/custom/etc/quest_warper.txt
@@ -173,19 +173,19 @@ Setprice:
next;
mes "Basic - Warps are = "+(($QW_BW_PRICE)?"^00FF00"+$QW_BW_PRICE:"^FF0000Free")+"^000000";
mes "Basic - Warps are starter towns and related dungeons.";
- input $QW_BW_PRICE;
+ input($QW_BW_PRICE, 0);
goto Setprice;
case 2:
next;
mes "Advanced - Warps are = "+(($QW_AW_PRICE)?"^00FF00"+$QW_AW_PRICE:"^FF0000Free")+"^000000";
mes "Advanced - Warps are towns and dungeons on the same island but not close to any starter town.";
- input $QW_AW_PRICE;
+ input($QW_AW_PRICE, 0);
goto Setprice;
case 3:
next;
mes "Overseas - Warps are = "+(($QW_OW_PRICE)?"^00FF00"+$QW_OW_PRICE:"^FF0000Free")+"^000000";
mes "Overseas - Warps are towns and dungeons overseas reachable by boat from Alberta.";
- input $QW_OW_PRICE;
+ input($QW_OW_PRICE, 0);
goto Setprice;
case 4:
next;
@@ -193,7 +193,7 @@ Setprice:
mes "Basic - Warps are starter town related dungeons.";
mes "Dungeon warp fees are calculated by maps away from entrance of the dungeon times Dungeon warp fee.";
mes "These costs are on top of the regular Warp costs.";
- input $QW_BW_FEE;
+ input($QW_BW_FEE, 0);
goto Setprice;
case 5:
next;
@@ -201,7 +201,7 @@ Setprice:
mes "Advanced - Warps are dungeons not close to any starter town.";
mes "Dungeon warp fees are calculated by maps away from entrance of the dungeon times Dungeon warp fee.";
mes "These costs are on top of the regular Warp costs.";
- input $QW_AW_FEE;
+ input($QW_AW_FEE, 0);
goto Setprice;
case 6:
next;
@@ -209,13 +209,13 @@ Setprice:
mes "Overseas - Warps are dungeons related to towns overseas reachable by boat from Alberta.";
mes "Dungeon warp fees are calculated by maps away from entrance of the dungeon times Dungeon warp fee.";
mes "These costs are on top of the regular Warp costs.";
- input $QW_OW_FEE;
+ input($QW_OW_FEE, 0);
goto Setprice;
case 7:
next;
mes "Full Healing = "+(($QW_HF_PRICE)?"^00FF00"+$QW_HF_PRICE:"^FF0000Free")+"^000000";
mes "Instant full healing 1 price.";
- input $QW_HF_PRICE;
+ input($QW_HF_PRICE, 0);
goto Setprice;
case 8:
next;
@@ -224,8 +224,8 @@ Setprice:
mes "Healing price per 1 HP.";
mes "Healing price per 1 SP.";
mes "2 inputs, first HP then SP.";
- input $QW_HP_H_PRICE;
- input $QW_HP_S_PRICE;
+ input($QW_HP_H_PRICE, 0);
+ input($QW_HP_S_PRICE, 0);
goto Setprice;
case 9:
next;
@@ -233,13 +233,13 @@ Setprice:
if (!$QW_S_PRICE) mes "Storage = ^FF0000 Free ^000000";
if ($QW_S_PRICE == 60) mes "Storage = ^0000FF Kafra Mode ^000000";
mes "Storage cost, if set to 60 Kafra pricing will be handled.";
- input $QW_S_PRICE;
+ input($QW_S_PRICE, 0);
goto Setprice;
case 10:
next;
mes "Guild Storage = "+(($QW_GS_PRICE)?"^00FF00"+$QW_GS_PRICE:"^FF0000Free")+"^000000";
mes "Guild Storage, free on Guild Kafras.";
- input $QW_GS_PRICE;
+ input($QW_GS_PRICE, 0);
goto Setprice;
case 11:
goto GM_Menu;
@@ -264,21 +264,21 @@ SpecialWarpMenu:
case 1:
next;
mes "Set the name to show in the menu as option.";
- input $QW_SP_Warpname$;
+ input($QW_SP_Warpname$, 0);
goto SpecialWarpMenu;
case 2:
next;
mes "Set the map in the ^0000FFmapname^000000 format.";
mes "When this warpmap is set the option for players will show once they meet the requirments.";
mes "To disable Special Warp Menu option, clear this!";
- input $QW_SP_WarpMap$;
+ input($QW_SP_WarpMap$, 0);
goto SpecialWarpMenu;
case 3:
next;
mes "First input = Xcoord";
mes "Second input = Ycoord";
- input $QW_SP_WarpX;
- input $QW_SP_WarpY;
+ input($QW_SP_WarpX, 0);
+ input($QW_SP_WarpY, 0);
goto SpecialWarpMenu;
case 4:
goto GM_Menu;
@@ -301,7 +301,7 @@ DungeonLevelLimit:
mes "Set limit of Dungeon Depth 0 = entrance";
mes "Depth 1 is a map connected to 0 and so on";
mes "Shortest Route to map counts as depth";
- input $QW_DDL;
+ input($QW_DDL, 0);
goto DungeonLevelLimit;
case 3: goto GM_Menu;
default:
@@ -464,7 +464,7 @@ L_Storage:
if(#kafra_code) {
mes "Enter your storage password:";
set @code_,0;
- input @code_;
+ input(@code_, 0);
if(@code_ != #kafra_code) {
dispbottom "Wrong storage password.";
close;
diff --git a/npc/custom/etc/shifty_assassin.txt b/npc/custom/etc/shifty_assassin.txt
index 4acf7c8ac..cc92d3fce 100644
--- a/npc/custom/etc/shifty_assassin.txt
+++ b/npc/custom/etc/shifty_assassin.txt
@@ -27,7 +27,7 @@ morocc,148,86,5 script Shifty Assassin 4_F_JOB_ASSASSIN,{
mes "They cost ^0000FF" + $ninja_price + " zeny ^000000each.";
set @buy,0;
- input @buy;
+ input(@buy, 0);
next;
if ($ninja_avail < 1) {
mes "[Shifty Assassin]";
@@ -83,8 +83,7 @@ morocc,148,86,5 script Shifty Assassin 4_F_JOB_ASSASSIN,{
mes "Active Ninjas: "+#ninjas;
mes "Resting Ninjas: "+#ninjasr;
mes "How many do you want to send?";
- set @number,0;
- input @number;
+ input(@number);
if (@number < 1) {
mes "[Shifty Assassin]";
mes "You can't kill anyone without ninjas.";
@@ -144,7 +143,7 @@ morocc,148,86,5 script Shifty Assassin 4_F_JOB_ASSASSIN,{
mes "How many ninjas do you want to make available?";
next;
set @add,0;
- input @add;
+ input(@add, 0);
set $ninja_avail,$ninja_avail+@add;
mes @add + " ninjas added.";
close;
diff --git a/npc/custom/etc/stock_market.txt b/npc/custom/etc/stock_market.txt
index 465840dfe..b761d8d16 100644
--- a/npc/custom/etc/stock_market.txt
+++ b/npc/custom/etc/stock_market.txt
@@ -323,11 +323,8 @@ prontera,140,181,5 script Stock Market::stockmarket 4_M_MANAGER,{
mes "Enter the name of the share company";
mes "Transaction fee of ^FF0000" + $S_Trans + "z^000000 will apply.";
- set @buyname$,"0";
- input @buyname$;
-
- set @buyamount,0;
- input @buyamount;
+ input(@buyname$);
+ input(@buyamount);
// Checks valid number //
if (@buyamount < $S_BuyMin) {
mes "^FF0000Minimum of " + $S_BuyMin + " shares can be bought at a time.^000000";
@@ -476,10 +473,8 @@ prontera,140,181,5 script Stock Market::stockmarket 4_M_MANAGER,{
if (#S8 > 0) mes "^0000FF"+$S8N$+"^FF0000" + " x " + #S8 + " [" + $S8 + "z]";
if (#S9 > 0) mes "^0000FF"+$S9N$+"^FF0000" + " x " + #S9 + " [" + $S9 + "z]";
if (#S10 > 0) mes "^0000FF"+$S10N$+"^FF0000" + " x " + #S10 + " [" + $S10 + "z]";
- set @sellname$,"0";
- input @sellname$;
- set @sellamount,0;
- input @sellamount;
+ input(@sellname$);
+ input(@sellamount);
if (@sellamount < 1) {
mes "^FF0000Invalid integer.^000000";
next;
@@ -756,7 +751,7 @@ OnGMOpen:
if (select("Yes", "No") != 1)
return;
set @gmset,0;
- input @gmset;
+ input(@gmset, 0);
set $S1,@gmset;
set $S2,@gmset;
set $S3,@gmset;