From 371d056df80b6f83484534f64883c3d020c4112d Mon Sep 17 00:00:00 2001 From: Emistry Haoyan Date: Sun, 16 Jun 2019 18:44:45 +0800 Subject: Sanitize handling of the input() values. - avoid potential hacks for old scripts that use `input()` script commands. Signed-off-by: Haru --- npc/jobs/2-2/alchemist.txt | 155 +++++++++++++++++++++++++++------------------ npc/jobs/2-2/bard.txt | 60 +++++++++--------- npc/jobs/2-2/rogue.txt | 15 ++--- 3 files changed, 129 insertions(+), 101 deletions(-) (limited to 'npc/jobs/2-2') diff --git a/npc/jobs/2-2/alchemist.txt b/npc/jobs/2-2/alchemist.txt index 634e0753b..3db39f11c 100644 --- a/npc/jobs/2-2/alchemist.txt +++ b/npc/jobs/2-2/alchemist.txt @@ -567,33 +567,39 @@ alde_alche,175,107,3 script Fastidious Alchemist#am 4_M_ALCHE_B,{ mes "[Raspuchin Gregory]"; mes "12 + 23 + 34 + 45 = ?"; next; - input .@input; - if (.@input != 114) .@w_point += 1; + input(.@input); + if (.@input != 114) + .@w_point += 1; mes "[Raspuchin Gregory]"; mes "1000 - 36 - 227 - 348 = ?"; next; - input .@input; - if (.@input != 389) .@w_point += 1; + input(.@input); + if (.@input != 389) + .@w_point += 1; mes "[Raspuchin Gregory]"; mes "14 * 17 * 3 = ?"; next; - input .@input; - if (.@input != 714) .@w_point += 1; + input(.@input); + if (.@input != 714) + .@w_point += 1; mes "[Raspuchin Gregory]"; mes "9765 / 3 / 5 / 7 = ?"; next; - input .@input; - if (.@input != 93) .@w_point += 1; + input(.@input); + if (.@input != 93) + .@w_point += 1; mes "[Raspuchin Gregory]"; mes "(47 * 28) - (1376 / 4) = ?"; next; - input .@input; - if (.@input != 972) .@w_point += 1; + input(.@input); + if (.@input != 972) + .@w_point += 1; mes "[Raspuchin Gregory]"; mes "(2646 / 7) + (13 * 28) = ?"; next; - input .@input; - if (.@input != 742) .@w_point += 1; + input(.@input); + if (.@input != 742) + .@w_point += 1; mes "[Raspuchin Gregory]"; mesf("How much do\r" "12 %s,\r" @@ -604,8 +610,9 @@ alde_alche,175,107,3 script Fastidious Alchemist#am 4_M_ALCHE_B,{ getitemname(Wing_Of_Butterfly), getitemname(Wing_Of_Fly)); next; - input .@input; - if (.@input != 909) .@w_point += 1; + input(.@input); + if (.@input != 909) + .@w_point += 1; mes "[Raspuchin Gregory]"; mesf("What is the\r" "total weight of\r" @@ -615,8 +622,9 @@ alde_alche,175,107,3 script Fastidious Alchemist#am 4_M_ALCHE_B,{ getitemname(Helm), getitemname(Coat)); next; - input .@input; - if (.@input != 450) .@w_point += 1; + input(.@input); + if (.@input != 450) + .@w_point += 1; mes "[Raspuchin Gregory]"; mesf("What is the\r" "total defense of\r" @@ -632,8 +640,9 @@ alde_alche,175,107,3 script Fastidious Alchemist#am 4_M_ALCHE_B,{ getitemname(Boots), getitemname(Ear_Mufs)); next; - input .@input; - if (.@input != 20) .@w_point += 1; + input(.@input); + if (.@input != 20) + .@w_point += 1; mes "[Raspuchin Gregory]"; mesf("If you buy 5 %s\r" "with a 24%% discount\r" @@ -642,45 +651,53 @@ alde_alche,175,107,3 script Fastidious Alchemist#am 4_M_ALCHE_B,{ "do you earn?", getitemname(Helm)); next; - input .@input; - if (.@input != 8800) .@w_point += 1; + input(.@input); + if (.@input != 8800) + .@w_point += 1; break; case 2: mes "[Raspuchin Gregory]"; mes "13 + 25 + 37 + 48 = ?"; next; - input .@input; - if (.@input != 123) .@w_point += 1; + input(.@input); + if (.@input != 123) + .@w_point += 1; mes "[Raspuchin Gregory]"; mes "1000 - 58 - 214 - 416 = ?"; next; - input .@input; - if (.@input != 312) .@w_point += 1; + input(.@input); + if (.@input != 312) + .@w_point += 1; mes "[Raspuchin Gregory]"; mes "12 * 24 * 3 = ?"; next; - input .@input; - if (.@input != 864) .@w_point += 1; + input(.@input); + if (.@input != 864) + .@w_point += 1; mes "[Raspuchin Gregory]"; mes "10530 / 3 / 5 / 2 = ?"; next; - input .@input; - if (.@input != 351) .@w_point += 1; + input(.@input); + if (.@input != 351) + .@w_point += 1; mes "[Raspuchin Gregory]"; mes "(35 * 19) - (1792 / 7) = ?"; next; - input .@input; - if (.@input != 409) .@w_point += 1; + input(.@input); + if (.@input != 409) + .@w_point += 1; mes "[Raspuchin Gregory]"; mes "(2368 / 8) + (24 * 17) = ?"; next; - input .@input; - if (.@input != 704) .@w_point += 1; + input(.@input); + if (.@input != 704) + .@w_point += 1; mes "[Raspuchin Gregory]"; mes "(2646 / 7) + (13 * 28) = ?"; next; - input .@input; - if (.@input != 742) .@w_point += 1; + input(.@input); + if (.@input != 742) + .@w_point += 1; mes "[Raspuchin Gregory]"; mesf("What is the\r" "total price of\r" @@ -692,8 +709,9 @@ alde_alche,175,107,3 script Fastidious Alchemist#am 4_M_ALCHE_B,{ getitemname(Spectacles), getitemname(Booby_Trap)); next; - input .@input; - if (.@input != 934) .@w_point += 1; + input(.@input); + if (.@input != 934) + .@w_point += 1; mes "[Raspuchin Gregory]"; mesf("What is the\r" "total weight of\r" @@ -703,8 +721,9 @@ alde_alche,175,107,3 script Fastidious Alchemist#am 4_M_ALCHE_B,{ getitemname(Cap), getitemname(Boots)); next; - input .@input; - if (.@input != 550) .@w_point += 1; + input(.@input); + if (.@input != 550) + .@w_point += 1; mes "[Raspuchin Gregory]"; mesf("What is the\r" "total defense of\r" @@ -720,8 +739,9 @@ alde_alche,175,107,3 script Fastidious Alchemist#am 4_M_ALCHE_B,{ getitemname(Sahkkat), getitemname(Glasses)); next; - input .@input; - if (.@input != 16) .@w_point += 1; + input(.@input); + if (.@input != 16) + .@w_point += 1; mes "[Raspuchin Gregory]"; mesf("How much profit do you\r" "make if you buy %s\r" @@ -730,40 +750,47 @@ alde_alche,175,107,3 script Fastidious Alchemist#am 4_M_ALCHE_B,{ "the normal price?", getitemname(Tights)); next; - input .@input; - if (.@input != 8520) .@w_point += 1; + input(.@input); + if (.@input != 8520) + .@w_point += 1; break; case 3: mes "[Raspuchin Gregory]"; mes "12 + 23 + 34 + 45 = ?"; next; - input .@input; - if (.@input != 114) .@w_point += 1; + input(.@input); + if (.@input != 114) + .@w_point += 1; mes "[Raspuchin Gregory]"; mes "1000 - 58 - 214 - 416 = ?"; next; - input .@input; - if (.@input != 312) .@w_point += 1; + input(.@input); + if (.@input != 312) + .@w_point += 1; mes "[Raspuchin Gregory]"; mes "14 * 17 * 3 = ?"; next; - input .@input; - if (.@input != 714) .@w_point += 1; + input(.@input); + if (.@input != 714) + .@w_point += 1; mes "[Raspuchin Gregory]"; mes "10530 / 3 / 5 / 2 = ?"; next; - input .@input; - if (.@input != 351) .@w_point += 1; + input(.@input); + if (.@input != 351) + .@w_point += 1; mes "[Raspuchin Gregory]"; mes "(47 * 28) - (1376 / 4) = ?"; next; - input .@input; - if (.@input != 972) .@w_point += 1; + input(.@input); + if (.@input != 972) + .@w_point += 1; mes "[Raspuchin Gregory]"; mes "(2646 / 7) + (13 * 28) = ?"; next; - input .@input; - if (.@input != 742) .@w_point += 1; + input(.@input); + if (.@input != 742) + .@w_point += 1; mes "[Raspuchin Gregory]"; mesf("What is the\r" "total cost of\r" @@ -775,8 +802,9 @@ alde_alche,175,107,3 script Fastidious Alchemist#am 4_M_ALCHE_B,{ getitemname(Green_Potion), getitemname(Wing_Of_Fly)); next; - input .@input; - if (.@input != 798) .@w_point += 1; + input(.@input); + if (.@input != 798) + .@w_point += 1; mes "[Raspuchin Gregory]"; mesf("What is the\r" "total weight of\r" @@ -786,8 +814,9 @@ alde_alche,175,107,3 script Fastidious Alchemist#am 4_M_ALCHE_B,{ getitemname(Cap), getitemname(Boots)); next; - input .@input; - if (.@input != 480) .@w_point += 1; + input(.@input); + if (.@input != 480) + .@w_point += 1; mes "[Raspuchin Gregory]"; mesf("What is the\r" "total defense of\r" @@ -800,8 +829,9 @@ alde_alche,175,107,3 script Fastidious Alchemist#am 4_M_ALCHE_B,{ getitemname(Muffler), getitemname(Eye_Bandage)); next; - input .@input; - if (.@input != 12) .@w_point += 1; + input(.@input); + if (.@input != 12) + .@w_point += 1; mes "[Raspuchin Gregory]"; mesf("If you buy 4 Padded Armors\r" "at a 24%% discount and sell\r" @@ -810,8 +840,9 @@ alde_alche,175,107,3 script Fastidious Alchemist#am 4_M_ALCHE_B,{ "you make from this sale?", getitemname(Padded_Armor)); next; - input .@input; - if (.@input != 7680) .@w_point += 1; + input(.@input); + if (.@input != 7680) + .@w_point += 1; } if (.@w_point == 0) { mes "[Raspuchin Gregory]"; diff --git a/npc/jobs/2-2/bard.txt b/npc/jobs/2-2/bard.txt index e44299193..d75ec7458 100644 --- a/npc/jobs/2-2/bard.txt +++ b/npc/jobs/2-2/bard.txt @@ -499,7 +499,7 @@ comodo,226,123,5 script Wandering Bard 2_M_BARD_ORIENT,{ mes "The evil giant Papner,"; mes "Turned into a dragon and ate him."; next; - input .@Song$; + input(.@Song$); if (.@Song$ != "There was a man") .@w_point += 1; @@ -510,7 +510,7 @@ comodo,226,123,5 script Wandering Bard 2_M_BARD_ORIENT,{ mes "The evil giant Papner,"; mes "Turned into a dragon and ate him."; next; - input .@Song$; + input(.@Song$); if (.@Song$ != "who was said to be immortal.") .@w_point += 1; @@ -521,7 +521,7 @@ comodo,226,123,5 script Wandering Bard 2_M_BARD_ORIENT,{ mes "The evil giant Papner,"; mes "Turned into a dragon and ate him."; next; - input .@Song$; + input(.@Song$); if (.@Song$ != "His name Jichfreid,") .@w_point += 1; @@ -532,7 +532,7 @@ comodo,226,123,5 script Wandering Bard 2_M_BARD_ORIENT,{ mes "The evil giant Papner,"; mes "Turned into a dragon and ate him."; next; - input .@Song$; + input(.@Song$); if (.@Song$ != "Son of the hero Jichmunt.") .@w_point += 1; @@ -543,7 +543,7 @@ comodo,226,123,5 script Wandering Bard 2_M_BARD_ORIENT,{ mes "The evil giant Papner,^000000"; mes "Turned into a dragon and ate him."; next; - input .@Song$; + input(.@Song$); if (.@Song$ != "The evil giant Papner,") .@w_point += 1; @@ -554,7 +554,7 @@ comodo,226,123,5 script Wandering Bard 2_M_BARD_ORIENT,{ mes "The evil giant Papner,"; mes "Turned into a dragon and ate him.^000000"; next; - input .@Song$; + input(.@Song$); if (.@Song$ != "Turned into a dragon and ate him.") .@w_point += 1; } @@ -566,7 +566,7 @@ comodo,226,123,5 script Wandering Bard 2_M_BARD_ORIENT,{ mes "At first he only sold Red Potions."; mes "Some say he sold Sweet Potatoes, too."; next; - input .@Song$; + input(.@Song$); if (.@Song$ != "A Merchant without money or equipment,") .@w_point += 1; @@ -577,7 +577,7 @@ comodo,226,123,5 script Wandering Bard 2_M_BARD_ORIENT,{ mes "At first he only sold Red Potions."; mes "Some say he sold Sweet Potatoes, too."; next; - input .@Song$; + input(.@Song$); if (.@Song$ != "a Merchant that couldn't sell anything.") .@w_point += 1; @@ -588,7 +588,7 @@ comodo,226,123,5 script Wandering Bard 2_M_BARD_ORIENT,{ mes "At first he only sold Red Potions."; mes "Some say he sold Sweet Potatoes, too."; next; - input .@Song$; + input(.@Song$); if (.@Song$ != "But he was too proud to beg.") .@w_point += 1; @@ -599,7 +599,7 @@ comodo,226,123,5 script Wandering Bard 2_M_BARD_ORIENT,{ mes "At first he only sold Red Potions."; mes "Some say he sold Sweet Potatoes, too."; next; - input .@Song$; + input(.@Song$); if (.@Song$ != "So he gathered some money selling items.") .@w_point += 1; @@ -610,7 +610,7 @@ comodo,226,123,5 script Wandering Bard 2_M_BARD_ORIENT,{ mes "At first he only sold Red Potions.^000000"; mes "Some say he sold Sweet Potatoes, too."; next; - input .@Song$; + input(.@Song$); if (.@Song$ != "At first he only sold Red Potions.") .@w_point += 1; @@ -621,7 +621,7 @@ comodo,226,123,5 script Wandering Bard 2_M_BARD_ORIENT,{ mes "At first he only sold Red Potions."; mes "Some say he sold Sweet Potatoes, too.^000000"; next; - input .@Song$; + input(.@Song$); if (.@Song$ != "Some say he sold Sweet Potatoes, too.") .@w_point += 1; } @@ -633,7 +633,7 @@ comodo,226,123,5 script Wandering Bard 2_M_BARD_ORIENT,{ mes "Her sweet apples in her basket,"; mes "All thanks to her sweet apples."; next; - input .@Song$; + input(.@Song$); if (.@Song$ != "All Gods never age.") .@w_point += 1; @@ -644,7 +644,7 @@ comodo,226,123,5 script Wandering Bard 2_M_BARD_ORIENT,{ mes "Her sweet apples in her basket,"; mes "All thanks to her sweet apples."; next; - input .@Song$; + input(.@Song$); if (.@Song$ != "The ever so Beautiful Goddess Eden,") .@w_point += 1; @@ -655,7 +655,7 @@ comodo,226,123,5 script Wandering Bard 2_M_BARD_ORIENT,{ mes "Her sweet apples in her basket,"; mes "All thanks to her sweet apples."; next; - input .@Song$; + input(.@Song$); if (.@Song$ != "Beautiful and graceful Goddess Eden,") .@w_point += 1; @@ -666,7 +666,7 @@ comodo,226,123,5 script Wandering Bard 2_M_BARD_ORIENT,{ mes "Her sweet apples in her basket,"; mes "All thanks to her sweet apples."; next; - input .@Song$; + input(.@Song$); if (.@Song$ != "Odin's daughter-in-law and Bragi's wife.") .@w_point += 1; @@ -677,7 +677,7 @@ comodo,226,123,5 script Wandering Bard 2_M_BARD_ORIENT,{ mes "Her sweet apples in her basket,^000000"; mes "All thanks to her sweet apples."; next; - input .@Song$; + input(.@Song$); if (.@Song$ != "Her sweet apples in her basket,") .@w_point += 1; @@ -688,7 +688,7 @@ comodo,226,123,5 script Wandering Bard 2_M_BARD_ORIENT,{ mes "Her sweet apples in her basket,"; mes "All thanks to her sweet apples.^000000"; next; - input .@Song$; + input(.@Song$); if (.@Song$ != "All thanks to her sweet apples.") .@w_point += 1; } @@ -700,7 +700,7 @@ comodo,226,123,5 script Wandering Bard 2_M_BARD_ORIENT,{ mes "All wandering poets are his people,"; mes "And all praise shall go to him."; next; - input .@Song$; + input(.@Song$); if (.@Song$ != "Bragi, Bragi,") .@w_point += 1; @@ -711,7 +711,7 @@ comodo,226,123,5 script Wandering Bard 2_M_BARD_ORIENT,{ mes "All wandering poets are his people,"; mes "And all praise shall go to him."; next; - input .@Song$; + input(.@Song$); if (.@Song$ != "Forever call the poets name.") .@w_point += 1; @@ -722,7 +722,7 @@ comodo,226,123,5 script Wandering Bard 2_M_BARD_ORIENT,{ mes "All wandering poets are his people,"; mes "And all praise shall go to him."; next; - input .@Song$; + input(.@Song$); if (.@Song$ != "My songs are his breath,") .@w_point += 1; @@ -733,7 +733,7 @@ comodo,226,123,5 script Wandering Bard 2_M_BARD_ORIENT,{ mes "All wandering poets are his people,"; mes "And all praise shall go to him."; next; - input .@Song$; + input(.@Song$); if (.@Song$ != "My mind is his will,") .@w_point += 1; @@ -744,7 +744,7 @@ comodo,226,123,5 script Wandering Bard 2_M_BARD_ORIENT,{ mes "All wandering poets are his people,^000000"; mes "And all praise shall go to him."; next; - input .@Song$; + input(.@Song$); if (.@Song$ != "All wandering poets are his people,") .@w_point += 1; @@ -755,7 +755,7 @@ comodo,226,123,5 script Wandering Bard 2_M_BARD_ORIENT,{ mes "All wandering poets are his people,"; mes "And all praise shall go to him.^000000"; next; - input .@Song$; + input(.@Song$); if (.@Song$ != "And all praise shall go to him.") .@w_point += 1; } @@ -767,7 +767,7 @@ comodo,226,123,5 script Wandering Bard 2_M_BARD_ORIENT,{ mes "Let the castle walls ring."; mes "This day will never come again!"; next; - input .@Song$; + input(.@Song$); if (.@Song$ != "Louder, louder, louder.") .@w_point += 1; @@ -778,7 +778,7 @@ comodo,226,123,5 script Wandering Bard 2_M_BARD_ORIENT,{ mes "Let the castle walls ring."; mes "This day will never come again!"; next; - input .@Song$; + input(.@Song$); if (.@Song$ != "Give strength to the warriors!") .@w_point += 1; @@ -789,7 +789,7 @@ comodo,226,123,5 script Wandering Bard 2_M_BARD_ORIENT,{ mes "Let the castle walls ring."; mes "This day will never come again!"; next; - input .@Song$; + input(.@Song$); if (.@Song$ != "Shake the sky and roar through the land.") .@w_point += 1; @@ -800,7 +800,7 @@ comodo,226,123,5 script Wandering Bard 2_M_BARD_ORIENT,{ mes "Let the castle walls ring."; mes "This day will never come again!"; next; - input .@Song$; + input(.@Song$); if (.@Song$ != "Make my heart pound again!") .@w_point += 1; @@ -811,7 +811,7 @@ comodo,226,123,5 script Wandering Bard 2_M_BARD_ORIENT,{ mes "Let the castle walls ring.^000000"; mes "This day will never come again!"; next; - input .@Song$; + input(.@Song$); if (.@Song$ != "Let the castle walls ring.") .@w_point += 1; @@ -822,7 +822,7 @@ comodo,226,123,5 script Wandering Bard 2_M_BARD_ORIENT,{ mes "Let the castle walls ring."; mes "This day will never come again!^000000"; next; - input .@Song$; + input(.@Song$); if (.@Song$ != "This day will never come again!") .@w_point += 1; } diff --git a/npc/jobs/2-2/rogue.txt b/npc/jobs/2-2/rogue.txt index 311915097..656b9eed4 100644 --- a/npc/jobs/2-2/rogue.txt +++ b/npc/jobs/2-2/rogue.txt @@ -1292,7 +1292,7 @@ in_rogue,270,130,0 script he_to_rogue#rg WARPNPC,1,1,{ OnTouch: mes "^3355FFThe door is locked. You'll need to enter the four number combination to open it.^000000"; next; - input .@input; + input(.@input); if (.@input < 1 || .@input > 10000) { if (ROGUE_Q == 12) mes "^3355FFIt didn't work. Please re-enter the four number combination.^000000"; @@ -1300,7 +1300,7 @@ OnTouch: mes "^3355FFPlease enter a combination of four numbers.^000000"; close; } - else if (.@input == 3019) { + if (.@input == 3019) { if (ROGUE_Q == 12) { mes "^3355FFThe door"; mes "has opened.^000000"; @@ -1308,8 +1308,7 @@ OnTouch: warp "in_rogue",10,21; ROGUE_Q = 12; end; - } - else { + } else { mes "[HermanthornJr.]"; mes "Well..."; mes "Didn't I tell you"; @@ -1318,11 +1317,9 @@ OnTouch: close; } } - else { - mes "^3355FFThe door"; - mes "is still locked.^000000"; - close; - } + mes "^3355FFThe door"; + mes "is still locked.^000000"; + close; } in_rogue,200,389,0 script gen_ro#1 FAKE_NPC,3,3,{ -- cgit v1.2.3-70-g09d2