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/re/cities | |
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/re/cities')
-rw-r--r-- | npc/re/cities/brasilis.txt | 10 | ||||
-rw-r--r-- | npc/re/cities/dewata.txt | 7 | ||||
-rw-r--r-- | npc/re/cities/mora.txt | 12 |
3 files changed, 16 insertions, 13 deletions
diff --git a/npc/re/cities/brasilis.txt b/npc/re/cities/brasilis.txt index eb30a3225..7c29265e0 100644 --- a/npc/re/cities/brasilis.txt +++ b/npc/re/cities/brasilis.txt @@ -133,22 +133,22 @@ brasilis,137,77,5 script Ice-Cream Maker 4_M_03,{ mes "So how many d'ya want?"; next; while(1) { - input .@input; //,1,5; - if (.@input == 0) { + input(.@input); + if (.@input <= 0) { mes "[Ice Cream Maker]"; mes "None?"; mes "Fine get outta the way, I have customers to serve."; close; } - else if ((.@input < 0) || (.@input > 5)) { + if (.@input > 5) { mes "[Ice Cream Maker]"; mes "Wow."; mes "You ordered too much."; mes "If you eat over 5 you might need to fight with a monster in your stomach. Calm down buddy."; next; + continue; } - else - break; + break; } .@icecream_hap = .@input*100; if (Zeny < .@icecream_hap) { diff --git a/npc/re/cities/dewata.txt b/npc/re/cities/dewata.txt index d8bac5986..70e60a274 100644 --- a/npc/re/cities/dewata.txt +++ b/npc/re/cities/dewata.txt @@ -489,11 +489,12 @@ dewata,89,191,6 script Small Shrine#dew1 CLEAR_NPC,{ mes "^FF00001,000 ~ 100,000 Zeny^000000"; mes "How much do you want to donate?"; next; - input .@input,0,100000; + input(.@input, 0, 100000); if (.@input < 1000) { mes "- Cancelled. -"; close; - } else if (.@input <= 50000) + } + if (.@input <= 50000) .@good_luck = rand(1,10000); else .@good_luck = rand(1,5000); @@ -557,7 +558,7 @@ dewata,89,191,6 script Small Shrine#dew1 CLEAR_NPC,{ case 2: mes "What is your wish?"; next; - input .@wish$; + input(.@wish$); mes "You have made your wish for ^0000FF" + .@wish$ + "^000000 to the small shrine."; next; callsub L_Wish; diff --git a/npc/re/cities/mora.txt b/npc/re/cities/mora.txt index a58ee4463..d3f5b6ed3 100644 --- a/npc/re/cities/mora.txt +++ b/npc/re/cities/mora.txt @@ -452,16 +452,18 @@ mora,140,186,3 script Raffle Philosopher 4_M_RAFLE_OLD,{ mes "You can pay me in the currencies listed below."; mes "Enter the sum you're willing to pay. Enter 0 if you don't want to pay anything."; next; - input .@input; + input(.@input); if (.@input == 0) { mes "[Raffle Philosopher]"; mes "So you don't want to hear a quote, eh?"; close; - } else if (.@input < 100 || .@input > 1000000) { + } + if (.@input < 100 || .@input > 1000000) { mes "[Raffle Philosopher]"; mes "You can pay between ^FF0000100 and 1000000^000000."; close; - } else if (Zeny < .@input) { + } + if (Zeny < .@input) { mes "[Raffle Philosopher]"; mes "So you think this is what my time is worth?"; close; @@ -908,7 +910,7 @@ mora,140,186,3 script Raffle Philosopher 4_M_RAFLE_OLD,{ mes "I wonder what you think"; mes "about what I've told you."; next; - input .@inputstr$; + input(.@inputstr$); mes "[Raffle Philosopher]"; mes "So you think that "+.@inputstr$+"."; next; @@ -1146,7 +1148,7 @@ mora,43,127,3 script Innkeeper#mora_inn 4_M_RAFLE_OR,{ close; } case 3: - input .@inputstr$; + input(.@inputstr$); mes "["+strcharinfo(PC_NAME)+"]"; mes "I come from a place called "+.@inputstr$+"."; next; |