diff options
author | Haru <haru@dotalux.com> | 2015-12-31 20:57:59 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2016-06-25 17:29:50 +0200 |
commit | ec2bd3849cc74373fed43ebf5ca29e8c67e81af5 (patch) | |
tree | 235fa83b31d3854010bbb84ea8b1908c28375c2d | |
parent | e8da81580ebb3367aca276d062ac86e208ae7bda (diff) | |
download | hercules-ec2bd3849cc74373fed43ebf5ca29e8c67e81af5.tar.gz hercules-ec2bd3849cc74373fed43ebf5ca29e8c67e81af5.tar.bz2 hercules-ec2bd3849cc74373fed43ebf5ca29e8c67e81af5.tar.xz hercules-ec2bd3849cc74373fed43ebf5ca29e8c67e81af5.zip |
Proof-of-concept best scripting practices for HULD (draft)
- Replaced hardcoded item names with getitemname()
Only the npc/jobs/2-2/alchemist.txt script was modified, as a proof of
concept.
Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r-- | npc/jobs/2-2/alchemist.txt | 261 |
1 files changed, 159 insertions, 102 deletions
diff --git a/npc/jobs/2-2/alchemist.txt b/npc/jobs/2-2/alchemist.txt index 5c87cde27..ab7833986 100644 --- a/npc/jobs/2-2/alchemist.txt +++ b/npc/jobs/2-2/alchemist.txt @@ -190,8 +190,9 @@ alde_alche,27,185,5 script Alchemist Guildsman#am 4_F_ALCHE,{ "training."; next; mes "[Parmy Gianino]"; - mes "But if you bring an ^551A8BOld Magic Book^000000 and ^551A8BHammer of Blacksmith^000000,\r" - "we will accept that as a substitute for the item requirement."; + mesf("But if you bring an ^551A8B%s^000000 and ^551A8B%s^000000,\r" + "we will accept that as a substitute for the item requirement.", + getitemname(Old_Magic_Book), getitemname(Hammer_Of_Blacksmith)); next; mes "[Parmy Gianino]"; mes "Now..."; @@ -222,17 +223,17 @@ alde_alche,27,185,5 script Alchemist Guildsman#am 4_F_ALCHE,{ case 1: ALCH_Q = 1; setquest 2028; - mes "^551A8B7 Berserk Potions^000000."; + mesf("^551A8B7 %s^000000.", getitemname(Berserk_Potion)); break; case 2: ALCH_Q = 2; setquest 2029; - mes "^551A8B100 Mini Furnaces^000000."; + mesf("^551A8B100 %s^000000.", getitemname(Portable_Furnace)); break; case 3: ALCH_Q = 3; setquest 2030; - mes "^551A8B7,500 Fire Arrows^000000."; + mesf("^551A8B7,500 %s^000000.", getitemname(Fire_Arrow)); } next; mes "[Parmy Gianino]"; @@ -259,9 +260,11 @@ alde_alche,27,185,5 script Alchemist Guildsman#am 4_F_ALCHE,{ else if (ALCH_Q >= 1 && ALCH_Q <= 3) { if (countitem(Old_Magic_Book) > 0 && countitem(Hammer_Of_Blacksmith) > 0) { mes "Well now~!"; - mes "You've brought an\r" - "Old Magic Book and\r" - "a Hammer of Blacksmith."; + mesf("You've brought an\r" + "%s and\r" + "a %s.", + getitemname(Old_Magic_Book), + getitemname(Hammer_Of_Blacksmith)); mes "We'll put these items\r" "to good use."; next; @@ -592,38 +595,52 @@ alde_alche,175,107,3 script Fastidious Alchemist#am 4_M_ALCHE_B,{ input .@input; if (.@input != 742) .@w_point += 1; mes "[Raspuchin Gregory]"; - mes "How much do\r" - "12 Red Potions,\r" - "1 Butterfly Wing\r" - "and 5 Fly Wings cost\r" - "after a 24 % discount?"; + mesf("How much do\r" + "12 %s,\r" + "1 %s\r" + "and 5 %s cost\r" + "after a 24%% discount?", + getitemname(Red_Potion), + getitemname(Wing_Of_Butterfly), + getitemname(Wing_Of_Fly)); next; input .@input; if (.@input != 909) .@w_point += 1; mes "[Raspuchin Gregory]"; - mes "What is the\r" + mesf("What is the\r" "total weight of\r" - "3 Scimiters, 2 Helms\r" - "and 1 Long Coat?"; + "3 %s, 2 %s\r" + "and 1 %s?", + getitemname(Scimiter), + getitemname(Helm), + getitemname(Coat)); next; input .@input; if (.@input != 450) .@w_point += 1; mes "[Raspuchin Gregory]"; - mes "What is the\r" + mesf("What is the\r" "total defense of\r" - "a Biretta, Mantle,\r" - "Opera Mask, Ribbon,\r" - "Muffler, Boots, and\r" - "Ear Muffs?"; + "a %s, %s,\r" + "%s, %s,\r" + "%s, %s, and\r" + "%s?", + getitemname(Biretta), + getitemname(Mantle), + getitemname(Phantom_Of_Opera), + getitemname(Ribbon), + getitemname(Muffler), + getitemname(Boots), + getitemname(Ear_Mufs)); next; input .@input; if (.@input != 20) .@w_point += 1; mes "[Raspuchin Gregory]"; - mes "If you buy 5 Helms\r" - "with a 24 % discount\r" + mesf("If you buy 5 %s\r" + "with a 24%% discount\r" "and sell it at 20\r" "how much profit\r" - "do you earn?"; + "do you earn?", + getitemname(Helm)); next; input .@input; if (.@input != 8800) .@w_point += 1; @@ -665,39 +682,53 @@ alde_alche,175,107,3 script Fastidious Alchemist#am 4_M_ALCHE_B,{ input .@input; if (.@input != 742) .@w_point += 1; mes "[Raspuchin Gregory]"; - mes "What is the\r" + mesf("What is the\r" "total price of\r" - "15 Green Potions,\r" - "6 Magnifiers and\r" - "4 Traps after\r" - "a 24 % discount?"; + "15 %s,\r" + "6 %s and\r" + "4 %s after\r" + "a 24%% discount?", + getitemname(Green_Potion), + getitemname(Spectacles), + getitemname(Booby_Trap)); next; input .@input; if (.@input != 934) .@w_point += 1; mes "[Raspuchin Gregory]"; - mes "What is the\r" + mesf("What is the\r" "total weight of\r" - "3 Ring Pommel Sabers,\r" - "4 Caps, and 2 Boots?"; + "3 %s,\r" + "4 %s, and 2 %s?", + getitemname(Ring_Pommel_Saber), + getitemname(Cap), + getitemname(Boots)); next; input .@input; if (.@input != 550) .@w_point += 1; mes "[Raspuchin Gregory]"; - mes "What is the\r" + mesf("What is the\r" "total defense of\r" - "a Buckler, Long Coat,\r" - "Gas Mask, Big Ribbon,\r" - "Cute Ribbon, Sakkat,\r" - "and Glasses?"; + "a %s, %s,\r" + "%s, %s.\r" + "%s, %s,\r" + "and %s?", + getitemname(Buckler), + getitemname(Coat), + getitemname(Gas_Mask), + getitemname(Big_Sis'_Ribbon), + getitemname(Fillet), + getitemname(Sahkkat), + getitemname(Glasses)); next; input .@input; if (.@input != 16) .@w_point += 1; mes "[Raspuchin Gregory]"; - mes "How much profit do you\r" - "make if you buy Tights\r" - "at a 24 % discount and\r" - "sell it at 20 % of\r" - "the normal price?"; + mesf("How much profit do you\r" + "make if you buy %s\r" + "at a 24%% discount and\r" + "sell it at 20%% of\r" + "the normal price?", + getitemname(Tights)); next; input .@input; if (.@input != 8520) .@w_point += 1; @@ -734,37 +765,50 @@ alde_alche,175,107,3 script Fastidious Alchemist#am 4_M_ALCHE_B,{ input .@input; if (.@input != 742) .@w_point += 1; mes "[Raspuchin Gregory]"; - mes "What is the\r" + mesf("What is the\r" "total cost of\r" - "6 Red Potions,\r" - "7 Green Potions,\r" - "and 8 Fly Wings\r" - "after a 24 % discount?"; + "6 %s,\r" + "7 %s,\r" + "and 8 %s\r" + "after a 24%% discount?", + getitemname(Red_Potion), + getitemname(Green_Potion), + getitemname(Wing_Of_Fly)); next; input .@input; if (.@input != 798) .@w_point += 1; mes "[Raspuchin Gregory]"; - mes "What is the\r" + mesf("What is the\r" "total weight of\r" - "2 Ring Pommel Sabers,\r" - "3 Caps, and 3 boots?"; + "2 %s,\r" + "3 %s, and 3 %s?", + getitemname(Ring_Pommel_Saber), + getitemname(Cap), + getitemname(Boots)); next; input .@input; if (.@input != 480) .@w_point += 1; mes "[Raspuchin Gregory]"; - mes "What is the\r" + mesf("What is the\r" "total defense of\r" - "a Mirror Shield, Mr. Smile, Leather Jacket, Silk Robe, Wedding Veil, Muffler, and Eye " - "Patch?"; + "a %s, %s, %s, %s, %s, %s, and %s?", + getitemname(Mirror_Shield), + getitemname(Mr_Smile), + getitemname(Leather_Jacket), + getitemname(Silk_Robe), + getitemname(Wedding_Veil), + getitemname(Muffler), + getitemname(Eye_Bandage)); next; input .@input; if (.@input != 12) .@w_point += 1; mes "[Raspuchin Gregory]"; - mes "If you buy 4 Padded Armors\r" - "at a 24% discount and sell\r" - "them at 20% of the original\r" + mesf("If you buy 4 Padded Armors\r" + "at a 24%% discount and sell\r" + "them at 20%% of the original\r" "price, how much profit would\r" - "you make from this sale?"; + "you make from this sale?", + getitemname(Padded_Armor)); next; input .@input; if (.@input != 7680) .@w_point += 1; @@ -961,11 +1005,11 @@ alde_alche,13,15,7 script Studying Man#am 4_M_ALCHE_C,{ "materials right away."; next; mes "[Darwin]"; - mes "^551A8B3 Medicine Bowls^000000,"; - mes "^551A8B3 Empty Bottles^000000,"; - mes "^551A8B1 Red Herb^000000,"; - mes "^551A8B1 Yellow Herb^000000 and"; - mes "^551A8B1 White Herb^000000."; + mesf("^551A8B3 %s^000000,", getitemname(Medicine_Bowl)); + mesf("^551A8B3 %s^000000,", getitemname(Empty_Bottle)); + mesf("^551A8B1 %s^000000,", getitemname(Red_Herb)); + mesf("^551A8B1 %s^000000 and", getitemname(Yellow_Herb)); + mesf("^551A8B1 %s^000000.", getitemname(White_Herb)); ALCH_Q = 7; changequest 2032,2033; next; @@ -999,7 +1043,7 @@ alde_alche,13,15,7 script Studying Man#am 4_M_ALCHE_C,{ mes "It was a flower."; mes "With its shine, it was said\r" "to let you see paradise."; - mes "The ^551A8BIllusion Flower^000000..."; + mesf("The ^551A8B%s^000000...", getitemname(Illusion_Flower)); next; mes "[Darwin]"; mes "I even made"; @@ -1045,7 +1089,7 @@ alde_alche,13,15,7 script Studying Man#am 4_M_ALCHE_C,{ if (countitem(Illusion_Flower) > 0) { mes "[Darwin]"; mes "Wait."; - mes "That Illusion Flower."; + mesf("That %s.", getitemname(Illusion_Flower)); mes "How did you get that?"; next; mes "[Darwin]"; @@ -1058,7 +1102,7 @@ alde_alche,13,15,7 script Studying Man#am 4_M_ALCHE_C,{ mes "[Darwin]"; mes "Th-That flower..."; mes "Please let me see it."; - mes "The Illusion Flower!"; + mesf("The %s!", getitemname(Illusion_Flower)); mes "Uwaaaaaaah!!"; next; mes "[Darwin]"; @@ -1154,8 +1198,9 @@ alde_alche,13,15,7 script Studying Man#am 4_M_ALCHE_C,{ "medicine."; next; mes "[Darwin]"; - mes "First, prepare the Medicine Bowl. Then, you put the Herbs inside, like this, and slowly " - "crush them."; + mesf("First, prepare the %s. Then, you put the Herbs inside, like this, and slowly " + "crush them.", + getitemname(Medicine_Bowl)); next; mes "[Darwin]"; mes "Pour small amounts\r" @@ -1180,9 +1225,9 @@ alde_alche,13,15,7 script Studying Man#am 4_M_ALCHE_C,{ "I just explained to you."; .@w_point = 0; next; - switch (select("Prepare the Medicine Bowl.", - "Put the Medicine Bowl on your head.", - "Kick the Medicine Bowl.")) { + switch (select(sprintf(_("Prepare the %s."), getitemname(Medicine_Bowl)), + sprintf(_("Put the %s on your head."), getitemname(Medicine_Bowl)), + sprintf(_("Kick the %s."), getitemname(Medicine_Bowl)))) { case 1: break; case 2: @@ -1198,9 +1243,9 @@ alde_alche,13,15,7 script Studying Man#am 4_M_ALCHE_C,{ next; break; } - switch (select("Put some dirt in the Medicine Bowl.", - "Put some Herbs in the Medicine Bowl.", - "Put a Harp in the Medicine Bowl.")) { + switch (select(sprintf(_("Put some dirt in the %s."), getitemname(Medicine_Bowl)), + sprintf(_("Put some Herbs in the %s."), getitemname(Medicine_Bowl)), + sprintf(_("Put a Harp in the %s."), getitemname(Medicine_Bowl)))) { case 1: ++.@w_point; mes "[Darwin]"; @@ -1221,7 +1266,7 @@ alde_alche,13,15,7 script Studying Man#am 4_M_ALCHE_C,{ break; } switch (select("Crush the Herbs.", - "Crush the Medicine Bowl.", + sprintf(_("Crush the %s."), getitemname(Medicine_Bowl)), "Crush Darwin's foot.")) { case 1: break; @@ -1289,7 +1334,7 @@ alde_alche,13,15,7 script Studying Man#am 4_M_ALCHE_C,{ } switch (select("Put noodles in and fry it.", "Pour it in an empty bottle.", - "Hold the Medicine Bowl and drink it.")) { + sprintf(_("Hold the %s and drink it."), getitemname(Medicine_Bowl)))) { case 1: ++.@w_point; mes "[Darwin]"; @@ -1348,11 +1393,11 @@ alde_alche,13,15,7 script Studying Man#am 4_M_ALCHE_C,{ "back with..."; next; mes "[Darwin]"; - mes "^551A8B3 Medicine Bowls^000000,"; - mes "^551A8B3 Empty Bottle^000000,"; - mes "^551A8B1 Red Herb^000000,"; - mes "^551A8B1 Yellow Herb^000000 and"; - mes "^551A8B1 White Herb^000000."; + mesf("^551A8B3 %s^000000,", getitemname(Medicine_Bowl)); + mesf("^551A8B3 %s^000000,", getitemname(Empty_Bottle)); + mesf("^551A8B1 %s^000000,", getitemname(Red_Herb)); + mesf("^551A8B1 %s^000000 and", getitemname(Yellow_Herb)); + mesf("^551A8B1 %s^000000.", getitemname(White_Herb)); next; mes "[Darwin]"; mes "Come back\r" @@ -1499,9 +1544,11 @@ alde_alche,79,19,5 script Experiment Expert#am 4_M_ALCHE_A,{ next; mes "[Van Helmont]"; mes "Okay, I got it."; - mes "Go learn how to make\r" - "a Counteragent and Mixture\r" - "from Molgenstein."; + mesf("Go learn how to make\r" + "a %s and %s\r" + "from Molgenstein.", + getitemname(Counteragent), + getitemname(Mixture)); next; mes "[Van Helmont]"; mes "You don't need to bring anything. Just go watch him at work and have him tell you how he " @@ -1543,8 +1590,12 @@ alde_alche,79,19,5 script Experiment Expert#am 4_M_ALCHE_A,{ close; } else if (ALCH_Q == 9) { - mes "Alright, if I make an incision here in the Tentacle, and add a Jellopy and Sticky Mucus solution " - "into the... Where the hell did my Medicine Bowl go?"; + mesf("Alright, if I make an incision here in the %s, and add a %s and %s solution into the... " + "Where the hell did my %s go?", + getitemname(Tentacle), + getitemname(Jellopy), + getitemname(Sticky_Mucus), + getitemname(Medicine_Bowl)); next; mes "[Van Helmont]"; mes "Did I use them all at a time like this?! I wonder if Nicholas has any left. Ugh, what a pain. " @@ -1581,18 +1632,20 @@ alde_alche,79,19,5 script Experiment Expert#am 4_M_ALCHE_A,{ next; if(MISC_QUEST & 4) { mes "[Van Helmont]"; - mes "Which item is not\r" + mesf("Which item is not\r" "necessary to make\r" - "a Counteragent?"; + "a %s?", + getitemname(Counteragent)); next; - if (select("Karvodailnirol", "Detrimindexta", "Alcohol") != 1) + if (select(getitemname(Karvodailnirol), getitemname(Detrimindexta), getitemname(Alchol)) != 1) .@w_point += 1; mes "[Van Helmont]"; - mes "What item is not\r" + mesf("What item is not\r" "necessary to make\r" - "a Mixture?"; + "a %s?", + getitemname(Mixture)); next; - if (select("Karvodailnirol", "Detrimindexta", "Alcohol") != 2) + if (select(getitemname(Karvodailnirol), getitemname(Detrimindexta), getitemname(Alchol)) != 2) .@w_point += 1; if (.@w_point > 0) { mes "[Van Helmont]"; @@ -1625,17 +1678,21 @@ alde_alche,79,19,5 script Experiment Expert#am 4_M_ALCHE_A,{ } else { mes "[Van Helmont]"; - mes "What item do\r" + mesf("What item do\r" "you need to make\r" - "a Counteragent?"; + "a %s?", + getitemname(Counteragent)); next; - select("Feather", "Sticky Mucus", "Animal Gore"); + select(getitemname(Feather), getitemname(Sticky_Mucus), getitemname(Animal_Blood)); mes "[Van Helmont]"; - mes "What item do\r" + mesf("What item do\r" "you need to make\r" - "a Mixture?"; + "a %s?", + getitemname(Mixture)); next; - select("Monster Feed", "Ancient Lips", "Rotten Bandage"); + select(getitemname(Monster's_Feed), + getitemname(Lip_Of_Ancient_Fish), + getitemname(Rotten_Bandage)); mes "[Van Helmont]"; mes "Be honest. You don't know, do you?! Didn't I say to go to Molgenstein and have him teach " "you?!"; @@ -2034,11 +2091,11 @@ alde_alche,145,19,1 script Chief Researcher#am 1_M_LIBRARYMASTER,{ ALCH_Q = 23; changequest 2037,2038; mes "[Nicholas Flamel]"; - mes "1 Mixture,"; - mes "5 Burnt Tree,"; - mes "5 Fine Sand,"; - mes "3 Rough Oridecon"; - mes "and 3 Rough Elunium."; + mesf("1 %s,", getitemname(Mixture)); + mesf("5 %s,", getitemname(Burn_Tree)); + mesf("5 %s,", getitemname(Fine_Sand)); + mesf("3 %s", getitemname(Oridecon_Stone)); + mesf("and 3 %s.", getitemname(Elunium_Stone)); getitem Mixture,1; getitem Burn_Tree,5; getitem Fine_Sand,5; |