summaryrefslogtreecommitdiff
path: root/npc/events/whiteday.txt
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/events/whiteday.txt
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/events/whiteday.txt')
-rw-r--r--npc/events/whiteday.txt22
1 files changed, 12 insertions, 10 deletions
diff --git a/npc/events/whiteday.txt b/npc/events/whiteday.txt
index 58655bf11..b7bae2d97 100644
--- a/npc/events/whiteday.txt
+++ b/npc/events/whiteday.txt
@@ -118,16 +118,18 @@ S_Purchase:
.@price = getarg(0);
.@item_id = getarg(1);
while (true) {
- input .@amount;
- if (.@amount <= 5)
- break;
- mes "[Sugar]";
- mes "???";
- mes "You seem to have a failure on hearing.";
- mes "I will tell you once again?";
- mes "You can only purchase";
- mes "^ff0000 5 pieces^000000 at once.";
- next;
+ input(.@amount);
+ if (.@amount < 0 || .@amount > 5) {
+ mes "[Sugar]";
+ mes "???";
+ mes "You seem to have a failure on hearing.";
+ mes "I will tell you once again?";
+ mes "You can only purchase";
+ mes "^ff0000 5 pieces^000000 at once.";
+ next;
+ continue;
+ }
+ break;
}
if (.@amount == 0) // Cancel
return;