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/pre-re/jobs/1-1/mage.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/pre-re/jobs/1-1/mage.txt')
-rw-r--r-- | npc/pre-re/jobs/1-1/mage.txt | 91 |
1 files changed, 45 insertions, 46 deletions
diff --git a/npc/pre-re/jobs/1-1/mage.txt b/npc/pre-re/jobs/1-1/mage.txt index 47ae792fe..684c7335e 100644 --- a/npc/pre-re/jobs/1-1/mage.txt +++ b/npc/pre-re/jobs/1-1/mage.txt @@ -437,50 +437,50 @@ geffen_in,164,112,4 script Mixing Machine HIDDEN_NPC,{ switch(select("Jellopy.", "Fluff.", "Milk.", "Ready to Mix.")) { case 1: while(1) { - input .@input; + input(.@input, 0); if (.@input > 10000) { next; mes "[Mixing Machine]"; mes "Error: Item limit exceeded. Please enter values less than 10,000 try again."; next; + continue; } - else { - if (countitem(Jellopy) > 0) .@mixitem1_1 += .@input; - .@progress = 2; - break; - } + if (countitem(Jellopy) > 0) + .@mixitem1_1 += .@input; + .@progress = 2; + break; } break; case 2: while(1) { - input .@input; + input(.@input, 0); if (.@input > 10000) { next; mes "[Mixing Machine]"; mes "Error: Item limit exceeded. Please enter values less than 10,000 try again."; next; + continue; } - else { - if (countitem(Fluff) > 0) .@mixitem1_2 += .@input; - .@progress = 2; - break; - } + if (countitem(Fluff) > 0) + .@mixitem1_2 += .@input; + .@progress = 2; + break; } break; case 3: while(1) { - input .@input; + input(.@input, 0); if (.@input > 10000) { next; mes "[Mixing Machine]"; mes "Error: Item limit exceeded. Please enter values less than 10,000 try again."; next; + continue; } - else { - if (countitem(Milk) > 0) .@mixitem1_3 += .@input; - .@progress = 2; - break; - } + if (countitem(Milk) > 0) + .@mixitem1_3 += .@input; + .@progress = 2; + break; } break; @@ -499,40 +499,39 @@ geffen_in,164,112,4 script Mixing Machine HIDDEN_NPC,{ mes "the Magic Powder."; next; while(1) { - input .@input; - if (.@input < 1000 || .@input > 9999) { + input(.@input); + if (.@input == 0) { mes "[Mixing Machine]"; - if (.@input == 0) { - mes "Do you want to skip this Menu?"; - next; - if (select("Yes.", "No.") == 1) { - break; - } - } - else { - mes "Invalid Serial Number."; - mes "Please try again."; - next; + mes "Do you want to skip this Menu?"; + next; + if (select("Yes.", "No.") == 1) { + break; } + continue; } - else { + if (.@input < 1000 || .@input > 9999) { mes "[Mixing Machine]"; - mes "The Serial Number is #" + .@input + ", correct?"; + mes "Invalid Serial Number."; + mes "Please try again."; next; - if (select("Confirm.", "Cancel.") == 1) { - if (.@input == 8472) - .@magic_powder = 1; - else if (.@input == 3735) - .@magic_powder = 2; - else if (.@input == 2750) - .@magic_powder = 3; - else if (.@input == 5429) - .@magic_powder = 4; - else - .@magic_powder = 5; - } - break; + continue; } + mes "[Mixing Machine]"; + mes "The Serial Number is #" + .@input + ", correct?"; + next; + if (select("Confirm.", "Cancel.") == 1) { + if (.@input == 8472) + .@magic_powder = 1; + else if (.@input == 3735) + .@magic_powder = 2; + else if (.@input == 2750) + .@magic_powder = 3; + else if (.@input == 5429) + .@magic_powder = 4; + else + .@magic_powder = 5; + } + break; } mes "[Mixing Machine]"; mes "Choose a"; |