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/gemstone.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/gemstone.txt')
-rw-r--r-- | npc/merchants/gemstone.txt | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/npc/merchants/gemstone.txt b/npc/merchants/gemstone.txt index 6028d9ddb..44be2569c 100644 --- a/npc/merchants/gemstone.txt +++ b/npc/merchants/gemstone.txt @@ -84,31 +84,33 @@ S_TradeGems: mes "that you can enter is 100."; next; while(1) { - input .@input,0,101; - if (.@input == 0) { + input(.@input); + if (.@input <= 0) { mes "[Jade]"; mes "None at all?"; mes "I guess you"; mes "changed your mind..."; close; } - else if (.@input > 100) { + if (.@input > 100) { mes "[Jade]"; mes "Errm..."; mes "I asked you to enter"; mes "an amount no greater"; mes "than 100, remember...?"; next; + continue; } - else if (.@gems < .@input) { + if (.@gems < .@input) { // Custom dialogue mes "[Jade]"; mes "Errm..."; mes "You don't have that"; mes "many gems to trade..."; next; + continue; } - else break; + break; } delitem getarg(0),.@input * 2; getitem getarg(1),.@input; |