diff options
author | Emistry Haoyan <equinox1991@gmail.com> | 2019-06-16 18:44:45 +0800 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2019-07-28 18:17:09 +0200 |
commit | 371d056df80b6f83484534f64883c3d020c4112d (patch) | |
tree | 20d38a8581f3a6159157bfa6644027d4007485bc /npc/merchants/refine.txt | |
parent | ef8bc3a8375d4fe9a5f75faf951b3deecb891d57 (diff) | |
download | hercules-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/merchants/refine.txt')
-rw-r--r-- | npc/merchants/refine.txt | 68 |
1 files changed, 31 insertions, 37 deletions
diff --git a/npc/merchants/refine.txt b/npc/merchants/refine.txt index 19ebf4a8e..87b5270a8 100644 --- a/npc/merchants/refine.txt +++ b/npc/merchants/refine.txt @@ -120,20 +120,19 @@ geffen_in,110,172,0 script Christopher#1 1_M_SMITH,{ mes "It's a much needed tool fer refining metal! So, How many do ye wish to buy? If ye want to quit, just type the number '0.'"; next; while(1) { - input .@input; - if (.@input == 0) { + input(.@input); + if (.@input <= 0) { mes "[Christopher Guillenrow]"; mes "Aye, the deal is canceled. Fare ye well."; close; } - else if ((.@input < 0) || (.@input > 500)) { + if (.@input > 500) { mes "[Christopher Guillenrow]"; mes "Ye can buy 500, er less."; next; + continue; } - else { - break; - } + break; } .@sell = .@input * 150; if (Zeny < .@sell) { @@ -199,22 +198,21 @@ geffen_in,110,172,0 script Christopher#1 1_M_SMITH,{ mes "So, How many do ye wish to buy? If ye dont want anything, just type the number as '0.'"; next; while(1) { - input .@input; - if (.@input == 0) { + input(.@input); + if (.@input <= 0) { mes "[Christopher Guillenrow]"; mes "Deal has"; mes "been canceled."; mes "Fare ye well."; close; } - else if ((.@input < 0) || (.@input > 500)) { + if (.@input > 500) { mes "[Christopher Guillenrow]"; mes "Ye can buy 500, er less."; next; + continue; } - else { - break; - } + break; } .@sell = .@input * 200; if (Zeny < .@sell) { @@ -237,22 +235,21 @@ geffen_in,110,172,0 script Christopher#1 1_M_SMITH,{ mes "So, how many do ye wish to buy? If ye dont want anything at all, just type the number as '0.'"; next; while(1) { - input .@input; - if (.@input == 0) { + input(.@input); + if (.@input <= 0) { mes "[Christopher Guillenrow]"; mes "Deal has"; mes "been canceled."; mes "Fare ye well."; close; } - else if ((.@input < 0) || (.@input > 500)) { + if (.@input > 500) { mes "[Christopher Guillenrow]"; mes "Ye can buy 500, er less."; next; + continue; } - else { - break; - } + break; } .@sell = .@input * 1000; if (Zeny < .@sell) { @@ -424,20 +421,19 @@ ein_in01,38,29,0 script Paul Spanner 1_M_SMITH,{ mes "So, how many do you need? If you want to cancel the trade, enter '0'."; next; while(1) { - input .@input; - if (.@input == 0) { + input(.@input); + if (.@input <= 0) { mes "[Paul Spanner]"; mes "You have canceled the trade. If you need anything, just let me know."; close; } - else if ((.@input < 0) || (.@input > 500)) { + if (.@input > 500) { mes "[Paul Spanner]"; mes "You can only buy 500 or less at a time."; next; + continue; } - else { - break; - } + break; } .@sell = .@input * .@item_cost; if (Zeny < .@sell) { @@ -478,20 +474,19 @@ ein_in01,38,29,0 script Paul Spanner 1_M_SMITH,{ mes "So, how many of them do you need? If you want to cancel the trade, enter '0'."; next; while(1) { - input .@input; - if (.@input == 0) { + input(.@input); + if (.@input <= 0) { mes "[Paul Spanner]"; mes "The trade has been canceled. If you need anything, just let me know."; close; } - else if ((.@input < 0) || (.@input > 500)) { + if (.@input > 500) { mes "[Paul Spanner]"; mes "You can buy 500 or less at a time."; next; + continue; } - else { - break; - } + break; } .@sell = .@input * .@item_price; if (Zeny < .@sell) { @@ -808,7 +803,7 @@ function script refinemain { mes "[" + getarg(0) + "]"; mes "How many times would you like me to refine your item?"; next; - input .@refinecnt; + input(.@refinecnt); .@refinecheck = .@refinecnt + getequiprefinerycnt(.@part); if (.@refinecnt < 1 || .@refinecheck > 10) { mes "[" + getarg(0) + "]"; @@ -954,24 +949,23 @@ function script phramain { mes "If you don't want any, please enter the number, '0.'"; next; while(1) { - input .@input; - if (.@input == 0) { + input(.@input); + if (.@input <= 0) { mes "[" + getarg(0) + "]"; mes "The deal has"; mes "been cancelled."; close; } - else if (.@input < 0 || .@input > 500) { + if (.@input > 500) { mes "[" + getarg(0) + "]"; mes "Alright, you can"; mes "puchase up to 500."; mes "No more than that,"; mes "got it? Good."; next; + continue; } - else { - break; - } + break; } .@sell = .@input * .@price; if (Zeny < .@sell) { |