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/novice_exchange.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/novice_exchange.txt')
-rw-r--r-- | npc/merchants/novice_exchange.txt | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/npc/merchants/novice_exchange.txt b/npc/merchants/novice_exchange.txt index c27fc6570..7e023588d 100644 --- a/npc/merchants/novice_exchange.txt +++ b/npc/merchants/novice_exchange.txt @@ -355,8 +355,8 @@ function script F_PotExchange { mes "mind, just enter '0' to cancel."; next; while(1) { - input .@input,0,101; - if (.@input == 0) { + input(.@input); + if (.@input <= 0) { mes "[Merchant]"; mes "What...?"; mes "Why the hell do you"; @@ -364,17 +364,16 @@ function script F_PotExchange { mes "Pretty indecisive, aren't you?"; close; } - else if (.@input > 100) { + if (.@input > 100) { mes "[Merchant]"; mes "I can't give you more"; mes "than 100 Red Potions"; mes "at once. Let's try"; mes "this again."; next; + continue; } - else { - break; - } + break; } .@put_out_item = .@input * getarg(1); if (countitem(getarg(0)) < .@put_out_item) { |