summaryrefslogtreecommitdiff
path: root/npc/custom/events
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/custom/events
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/custom/events')
-rw-r--r--npc/custom/events/cluckers.txt4
-rw-r--r--npc/custom/events/disguise.txt10
-rw-r--r--npc/custom/events/valentinesdayexp.txt33
3 files changed, 27 insertions, 20 deletions
diff --git a/npc/custom/events/cluckers.txt b/npc/custom/events/cluckers.txt
index 7047ca00e..2e6170693 100644
--- a/npc/custom/events/cluckers.txt
+++ b/npc/custom/events/cluckers.txt
@@ -74,11 +74,11 @@ prontera,156,219,4 script Cluckers 4_NFCOCK,{
case 3:
mes "[Cluckers]";
mes "Cluck cluck? Cluck??? ^FF0000~What should the prize for winning be? Please input the ID.~^000000";
- input $cluck_item_id;
+ input($cluck_item_id, 0);
next;
mes "[Cluckers]";
mes "Cluck? cluuuck? ^FF0000~How many if this item should I give away?~^000000";
- input $cluck_item_amount;
+ input($cluck_item_amount, 0);
next;
mes "[Cluckers]";
mes "Cluck cluck..? Cluck. ^FF0000~So, the prize is^000000 ^008000"+ $cluck_item_amount +" "+ getitemname($cluck_item_id) +"^000000? ^FF0000Great.~^000000";
diff --git a/npc/custom/events/disguise.txt b/npc/custom/events/disguise.txt
index fde5e544a..37f8a4f99 100644
--- a/npc/custom/events/disguise.txt
+++ b/npc/custom/events/disguise.txt
@@ -67,7 +67,7 @@ prontera,160,155,4 script Disguise Event 4_M_NFDEADMAN,{
mes "Input the number of rounds you want the event to last.";
mes "Current number: [^0000FF"+.Rounds+"^000000]";
next;
- input .@Rounds;
+ input(.@Rounds, 0);
set .Rounds,.@Rounds;
mes .@n$;
mes "The number of rounds has been changed to "+.Rounds+".";
@@ -77,7 +77,7 @@ prontera,160,155,4 script Disguise Event 4_M_NFDEADMAN,{
mes "Input the Item ID of the prize given each round.";
mes "Current item: [^0000FF"+getitemname(.Prize)+"^000000] (ID #"+.Prize+")";
next;
- input .@Prize;
+ input(.@Prize, 0);
mes .@n$;
if (getitemname(.@Prize)=="" || getitemname(.@Prize)=="null") {
mes "That item does not exist. Please try again.";
@@ -86,11 +86,11 @@ prontera,160,155,4 script Disguise Event 4_M_NFDEADMAN,{
set .Prize,.@Prize;
mes "Input the amount to be given.";
next;
- input .@amount;
+ input(.@amount);
mes .@n$;
- if (.@amount<=0 || .@amount>=10000) {
+ if (.@amount <= 0 || .@amount >= 10000) {
mes "That amount is invalid. Using default ammount of 1.";
- set .@amount,1;
+ .@amount = 1;
next;
mes .@n$;
}
diff --git a/npc/custom/events/valentinesdayexp.txt b/npc/custom/events/valentinesdayexp.txt
index 33339dcd9..195f20275 100644
--- a/npc/custom/events/valentinesdayexp.txt
+++ b/npc/custom/events/valentinesdayexp.txt
@@ -95,12 +95,15 @@ alberta,26,243,4 script Stephen#val1 1_M_MERCHANT,{
mes "you can come back again.";
mes "So how many do you want?";
next;
- set @needmon,0;
- input @flag_num;
- if (@flag_num <= 0) goto L_NONE;
- if (@flag_num > 5) goto L_ERR;
- set @needmon,@flag_num*5000;
- if (Zeny < @needmon) goto L_NOTENO;
+ @needmon = 0;
+ input(@flag_num);
+ if (@flag_num <= 0)
+ goto L_NONE;
+ if (@flag_num > 5)
+ goto L_ERR;
+ @needmon = @flag_num * 5000;
+ if (Zeny < @needmon)
+ goto L_NOTENO;
Zeny -= @needmon;
getitem 558,@flag_num;
mes "[Stephen]";
@@ -154,13 +157,17 @@ alberta,29,243,4 script Jainie#val1 1_M_INNKEEPER,{
mes "you can come back again.";
mes "So how many do you want? 1 portion is 4500z + 1 Milk.";
next;
- set @needmon,0;
- input @flag_num;
- if (@flag_num == 0) goto L_NONE;
- if (@flag_num > 5) goto L_ERR;
- set @needmon,@flag_num*4500;
- if (Zeny < @needmon) goto L_NOTENO;
- if (countitem(Milk) < @flag_num) goto L_NOMILK;
+ @needmon = 0;
+ input(@flag_num);
+ if (@flag_num == 0)
+ goto L_NONE;
+ if (@flag_num > 5)
+ goto L_ERR;
+ @needmon = @flag_num * 4500;
+ if (Zeny < @needmon)
+ goto L_NOTENO;
+ if (countitem(Milk) < @flag_num)
+ goto L_NOMILK;
Zeny -= @needmon;
delitem 519,@flag_num;
getitem 561,@flag_num;