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/events/halloween_2009.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/events/halloween_2009.txt')
-rw-r--r-- | npc/events/halloween_2009.txt | 140 |
1 files changed, 69 insertions, 71 deletions
diff --git a/npc/events/halloween_2009.txt b/npc/events/halloween_2009.txt index e71abeaef..532e04b2e 100644 --- a/npc/events/halloween_2009.txt +++ b/npc/events/halloween_2009.txt @@ -349,8 +349,8 @@ prontera,220,72,5 duplicate(09Treats) Trick or Treater#iRO8 4_M_KID1,2,2 mes "[Halloween Wizard]"; mes "How many Fabrics or Jack o' Pumpkins do you want to use? Don't go over 100 because that is the max amount that I can use."; next; - input .@input; - if (.@input == 0) { + input(.@input); + if (.@input <= 0) { mes "[Halloween Wizard]"; mes "You have no definite idea."; mes "It's not a big deal."; @@ -358,91 +358,89 @@ prontera,220,72,5 duplicate(09Treats) Trick or Treater#iRO8 4_M_KID1,2,2 next; break; } - else if (.@input > 100) { + if (.@input > 100) { mes "[Halloween Wizard]"; mes "I told you that it must be between 1 to 100!"; mes "You didn't pay attention!"; next; break; } - else { - .@fabric = countitem(Transparent_Cloth); - .@jack = countitem(Pumpkin_Head); - .@worn = countitem(Worn_Cloth_Piece); - .@crushed = countitem(Pumpkin_Head_Crushed); - .@whispers = 0; - .@darklords = 0; + .@fabric = countitem(Transparent_Cloth); + .@jack = countitem(Pumpkin_Head); + .@worn = countitem(Worn_Cloth_Piece); + .@crushed = countitem(Pumpkin_Head_Crushed); + .@whispers = 0; + .@darklords = 0; - .@total = .@fabric + .@jack + .@worn + .@crushed; + .@total = .@fabric + .@jack + .@worn + .@crushed; - if(.@total < .@input) { - mes "[Halloween Wizard]"; - mes "Recount the number of items you have and tell me the total."; - mes "Huhuhuhuhuhu..."; - next; - break; - } + if(.@total < .@input) { + mes "[Halloween Wizard]"; + mes "Recount the number of items you have and tell me the total."; + mes "Huhuhuhuhuhu..."; + next; + break; + } - if(.@fabric > 0) { - if(.@fabric >= .@input) { - delitem 1059,.@input; - .@whispers += .@input; - .@input = 0; - } - else{ - delitem 1059,.@fabric; - .@input -= .@fabric; - .@whispers += .@fabric; - } + if(.@fabric > 0) { + if(.@fabric >= .@input) { + delitem 1059,.@input; + .@whispers += .@input; + .@input = 0; } - if(.@worn > 0 && .@input != 0) { - if(.@worn >= .@input) { - delitem 6299,.@input; - .@whispers += .@input; - .@input = 0; - } - else{ - delitem 6299,.@worn; - .@input -= .@worn; - .@whispers += .@worn; - } + else{ + delitem 1059,.@fabric; + .@input -= .@fabric; + .@whispers += .@fabric; } - if(.@jack > 0 && .@input != 0) { - if(.@jack >= .@input) { - delitem 1062,.@input; - .@darklords += .@input; - .@input = 0; - } - else{ - delitem 1062,.@jack; - .@input -= .@jack; - .@darklords += .@jack; - } + } + if(.@worn > 0 && .@input != 0) { + if(.@worn >= .@input) { + delitem 6299,.@input; + .@whispers += .@input; + .@input = 0; } - if(.@crushed > 0 && .@input != 0) { - if(.@crushed >= .@input) { - delitem 6298,.@input; - .@darklords += .@input; - .@input = 0; - } - else{ - delitem 6298,.@crushed; - .@input -= .@crushed; - .@darklords += .@crushed; - } + else{ + delitem 6299,.@worn; + .@input -= .@worn; + .@whispers += .@worn; } - if (.@input > 0) { - mes "Theres a problem."; - close; + } + if(.@jack > 0 && .@input != 0) { + if(.@jack >= .@input) { + delitem 1062,.@input; + .@darklords += .@input; + .@input = 0; } - monster ""+.@HallowTowns$[.@HallowTown]+"",0,0,"Halloween Whisper",3014,.@whispers; - monster ""+.@HallowTowns$[.@HallowTown]+"",0,0,"Halloween Dark Lord",3015,.@darklords; - mes "[Halloween Wizard]"; - mes "Here's what you wanted."; - mes "Imagine what the people must be thinking in the other villages?"; - mes "Muahahaha"; + else{ + delitem 1062,.@jack; + .@input -= .@jack; + .@darklords += .@jack; + } + } + if(.@crushed > 0 && .@input != 0) { + if(.@crushed >= .@input) { + delitem 6298,.@input; + .@darklords += .@input; + .@input = 0; + } + else{ + delitem 6298,.@crushed; + .@input -= .@crushed; + .@darklords += .@crushed; + } + } + if (.@input > 0) { + mes "Theres a problem."; close; } + monster ""+.@HallowTowns$[.@HallowTown]+"",0,0,"Halloween Whisper",3014,.@whispers; + monster ""+.@HallowTowns$[.@HallowTown]+"",0,0,"Halloween Dark Lord",3015,.@darklords; + mes "[Halloween Wizard]"; + mes "Here's what you wanted."; + mes "Imagine what the people must be thinking in the other villages?"; + mes "Muahahaha"; + close; case 3: mes "[Halloween Wizard]"; mes "If you change your mind, come back here..."; |