//#################################################################################
//#
//# Nicholas the Smith.
//# Participates in iron ore smithery and the following quests:
//# - Together with Pachua: Iron Shield quest (repeatable)
//# (6 iron ingots, 2 infantry helmets, 20000 GP, leather patch) -> iron shield
//# - Primary participant in the Setzer quest (monster oil/golden stinger subquests)
//#
//# Variables used: @QUEST_Forestbow_state, nibble 3 (setzer quest)
//# @QUEST_Forestbow_state, nibble 4 (iron shield quest)
//#
//#################################################################################
009-2.gat,185,55,0|script|Nicholas|135,
{
set @SETZER_XP, 100000;
set @SHIELD_XP, 20000;
set @SHIELD_INITIAL, 0;
set @SHIELD_KNOWS_PATCH, 1; // knows that a leather patch is needed
set @SHIELD_COMPLETED, 2; // shield completed once
set @SETZER_INITIAL, 0;
set @SETZER_KNOWS_OIL, 1;
set @SETZER_KNOWS_STINGER, 2;
set @SETZER_FLAG_MADE_OIL, 4;
set @SETZER_FLAG_MADE_SETZER, 8;
set @Q_SETZER_MASK, NIBBLE_3_MASK;
set @Q_SETZER_SHIFT, NIBBLE_3_SHIFT;
set @Q_SHIELD_MASK, NIBBLE_4_MASK;
set @Q_SHIELD_SHIFT, NIBBLE_4_SHIFT;
set @Q_SETZER_status, (QUEST_Forestbow_state & @Q_SETZER_MASK) >> @Q_SETZER_SHIFT;
set @Q_SHIELD_status, (QUEST_Forestbow_state & @Q_SHIELD_MASK) >> @Q_SHIELD_SHIFT;
mes "[Nicholas]";
mes "\"Hello, there! I'm an expert blacksmith. If you get me some Coal and Iron Ingots, I could make you a very valuable shield or helmet.\"";
next;
menu
"I have Iron Ingots!", L_Check,
"Where can I get Coal and Iron Ingots?", L_Info,
"I'm okay, thanks.", L_Pass;
L_Check:
mes "[Nicholas]";
mes "\"Let me take a look at how much you have...\"";
next;
if ( (countitem("IronIngot")<3) || (countitem("Coal") < 6) )
goto L_NoItem;
if ( (countitem("IronIngot")<6) || (countitem("Coal") < 12) )
goto L_StageA;
if ( (countitem("IronIngot")<9) || (countitem("Coal") < 18) )
goto L_StageB;
goto L_StageC;
L_Info:
mes "[Nicholas]";
mes "\"You can find Coal and Iron Ore in mines. Once you have Coal and Iron Ore, find a smith that will smelt the Iron Ore and cast them into Iron Ingots.\"";
next;
mes "[Nicholas]";
mes "\"Come back here with some Coal and Iron Ingots, and I'll make something nice for you.\"";
close;
L_Pass:
mes "[Nicholas]";
mes "\"Oh, okay. Come back any time.\"";
close;
L_StageA:
mes "[Nicholas]";
mes "\"That's just enough for me to make you a winged Knight's Helmet, but it'll cost you 10,000GP, 6 Coal and 3 Iron Ingots.\"";
next;
goto L_main_menu;
L_StageB:
mes "[Nicholas]";
mes "\"Ahh, with that much Coal and Iron Ingots I can make you one of two helmets, for only 10,000GP, or I can make you a shield, for 20,000GP.\"";
mes "";
mes "\"What would you like?\"";
next;
goto L_main_menu;
L_StageC:
mes "[Nicholas]";
mes "\"Excellent, that's enough to make three different types of helmet. My fee is 10,000GP. I can also make a shield, but that will cost you 20,000 GP.\"";
mes "";
mes "\"Which will it be?\"";
next;
goto L_main_menu;
L_main_menu:
set @CHOICE_KNIGHT, 1;
set @CHOICE_CRUSADE, 2;
set @CHOICE_WARLORD, 3;
set @CHOICE_SHIELD, 4;
set @CHOICE_SETZER, 5;
set @CHOICE_CANCEL, 6;
setarray @choice$, "", "", "", "", "", "";
set @choices_nr, 0;
setarray @choice_idx, 0, 0, 0, 0, 0, 0;
if (countitem("ShortSword") < 1)
goto L_main_menu_post_setzer;
set @choice$[@choices_nr], "Can you make my Short Sword better?";
set @choice_idx[@choices_nr], @CHOICE_SETZER;
set @choices_nr, 1 + @choices_nr;
goto L_main_menu_post_setzer;
L_main_menu_post_setzer:
if ( (countitem("IronIngot")<3) || (countitem("Coal") <6) )
goto L_no_more_helmets;
set @choice$[@choices_nr], "Knight's Helmet (3 Iron Ingots & 6 Coal).";
set @choice_idx[@choices_nr], @CHOICE_KNIGHT;
set @choices_nr, 1 + @choices_nr;
if ( (countitem("IronIngot")<6) || (countitem("Coal") < 12) )
goto L_no_more_helmets;
set @choice$[@choices_nr], "Crusade Helmet (6 Iron Ingots & 12 Coal).";
set @choice_idx[@choices_nr], @CHOICE_CRUSADE;
set @choices_nr, 1 + @choices_nr;
set @choice$[@choices_nr], "Steel Shield (6 Iron Ingots & 12 Coal).";
set @choice_idx[@choices_nr], @CHOICE_SHIELD;
set @choices_nr, 1 + @choices_nr;
if ( (countitem("IronIngot")<9) || (countitem("Coal") < 18) )
goto L_no_more_helmets;
set @choice$[@choices_nr], "Warlord Helmet (9 Iron Ingots & 18 Coal).";
set @choice_idx[@choices_nr], @CHOICE_WARLORD;
set @choices_nr, 1 + @choices_nr;
goto L_no_more_helmets;
L_no_more_helmets:
set @choice$[@choices_nr], "No thanks.";
set @choice_idx[@choices_nr], @CHOICE_CANCEL;
set @choices_nr, 1 + @choices_nr;
menu
@choice$[0], L_MenuItems,
@choice$[1], L_MenuItems,
@choice$[2], L_MenuItems,
@choice$[3], L_MenuItems,
@choice$[4], L_MenuItems,
@choice$[5], L_MenuItems;
L_MenuItems:
set @menu, @menu - 1;
if (@menu >= @choices_nr)
close;
set @choice, @choice_idx[@menu];
if (@choice == @CHOICE_KNIGHT)
goto L_YesKnight;
if (@choice == @CHOICE_CRUSADE)
goto L_YesCrusade;
if (@choice == @CHOICE_WARLORD)
goto L_YesWarlord;
if (@choice == @CHOICE_SHIELD)
goto L_YesShield;
if (@choice == @CHOICE_SETZER)
goto L_SetzerQuest;
if (@choice == @CHOICE_CANCEL)
goto L_end;
close;
L_NoItem:
mes "[Nicholas]";
mes "\"It appears you don't have enough Coal and Iron Ingots for me to work with. Please do come back when you have more, though.\"";
close;
L_ComeBack:
mes "[Nicholas]";
mes "\"Come back any time.\"";
close;
L_NoMoney:
mes "[Nicholas]";
mes "\"Oh dear, it seems you don't have enough money.\"";
close;
L_YesKnight:
if (Zeny < 10000)
goto L_NoMoney;
if ( (countitem("IronIngot")<3) || (countitem("Coal") < 6) )
goto L_NoItem;
getinventorylist;
if (@inventorylist_count == 100)
goto L_TooMany;
set Zeny, Zeny - 10000;
delitem "IronIngot", 3;
delitem "Coal", 6;
getitem "KnightsHelmet", 1;
goto L_Done;
L_YesCrusade:
if (Zeny < 10000) goto L_NoMoney;
if ( (countitem("IronIngot")<6) || (countitem("Coal") < 12) )
goto L_NoItem;
getinventorylist;
if (@inventorylist_count == 100)
goto L_TooMany;
set Zeny, Zeny-10000;
delitem "IronIngot", 6;
delitem "Coal", 12;
getitem "CrusadeHelmet", 1;
goto L_Done;
L_YesWarlord:
if (Zeny < 10000) goto L_NoMoney;
if ( (countitem("IronIngot")<9) || (countitem("Coal") < 18) )
goto L_NoItem;
getinventorylist;
if (@inventorylist_count == 100)
goto L_TooMany;
set Zeny, Zeny-10000;
delitem "IronIngot", 9;
delitem "Coal", 18;
getitem "WarlordHelmet", 1;
goto L_Done;
L_YesShield:
mes "[Nicholas]";
mes "Nicholas examines your Iron Ingots.";
mes "\"No, this iron is too brittle; for something as large as a shield I need to mix in softer iron. Can I see if you have anything suitable?\"";
next;
menu
"Sure, have a look!", L_Next,
"No.", L_Pass;
L_Next:
if (countitem("InfantryHelmet") == 1)
goto L_MoreInfantry;
if (countitem("InfantryHelmet") == 0)
goto L_NoInfantry;
mes "[Nicholas]";
mes "Nicholas pulls out two of your Infantry Helmets.";
mes "\"I can use those... yes, that should work. Now all I need is a Leather Patch for the handle, and 20,000 GP.\"";
if (@Q_SHIELD_status < @SHIELD_KNOWS_PATCH)
set @Q_SHIELD_status, @SHIELD_KNOWS_PATCH;
callsub L_Update_Var;
next;
menu
"Here you are!", L_Next1,
"Where can I get a Leather Patch?", L_WhereLeather,
"No way.", L_Pass;
L_Next1:
if (Zeny < 20000)
goto L_ShieldNoZeny;
if (countitem("InfantryHelmet") < 2)
goto L_ShieldNoInfantry;
if (countitem("IronIngot") < 6)
goto L_ShieldNoIngot;
if (countitem("Coal") < 12)
goto L_ShieldNoCoal;
if (countitem("LeatherPatch") < 1)
goto L_ShieldNoLeatherPatch;
// No inventory check needed, as infantry helms are removed, opening two slots
mes "[Nicholas]";
mes "\"Yes, it looks as if you have all that is needed!\"";
mes "You watch Nicholas melt the ingots and helmets and form a shield out of the resulting iron. He then cuts your Leather Patch apart and adds it to the handles.";
mes "\"Here is your shield!\"";
delitem "InfantryHelmet", 1;
delitem "InfantryHelmet", 1;
delitem "LeatherPatch", 1;
delitem "IronIngot", 6;
delitem "Coal", 12;
set Zeny, Zeny - 20000;
if (@Q_SHIELD_status < @SHIELD_COMPLETED)
getexp @SHIELD_XP, 0;
if (@Q_SHIELD_status < @SHIELD_COMPLETED)
mes "[" + @SHIELD_XP + " experience points]";
set @Q_SHIELD_status, @SHIELD_COMPLETED; // get XP only once
callsub L_Update_Var;
getitem "SteelShield", 1;
close;
L_ShieldNoZeny:
mes "[Nicholas]";
mes "\"I am sorry, but I must ask that you pay 20,000 GP; this is quality work.\"";
close;
L_ShieldNoInfantry:
mes "[Nicholas]";
mes "\"Now this is strange... I could have sworn that you had two Infantry Helmets right here. Well, come back if you have some more!\"";
close;
L_ShieldNoIngot:
mes "[Nicholas]";
mes "\"How odd... didn't I put your Iron Ingots on the table right here? Well, I will need them back to make the shield.\"";
close;
L_ShieldNoCoal:
mes "[Nicholas]";
mes "\"How odd... didn't I put your Coal on the table right here? Well, I will need it back to make the shield.\"";
close;
L_ShieldNoLeatherPatch:
mes "[Nicholas]";
mes "\"You don't have a suitable Leather Patch. I'm sorry, but a shield without one would chafe terribly.\"";
close;
L_MoreInfantry:
mes "[Nicholas]";
mes "Nicholas takes your Infantry Helmet and examines it.";
mes "\"Yes, this is perfect! If you can bring me another one of those, I can make your shield.\"";
close;
L_NoInfantry:
mes "[Nicholas]";
mes "Nicholas shakes his head.";
mes "\"No, none of these items are suitable. Try looking for somewhat large metal items.\"";
close;
L_WhereLeather:
mes "[Nicholas]";
mes "\"Hmm. You should look for someone who can work with some kind of leather. Rumor has it that there is someone in the eastern desert who can, but I haven't been there.\"";
close;
L_SetzerQuest:
mes "[Nicholas]";
if (@Q_SETZER_status & @SETZER_FLAG_MADE_SETZER)
mes "\"Another one? Sure, why not.\"";
mes "Nicholas examines your Short Sword, then nods.";
mes "\"This is good quality. I can make something special out of it, with three ingot bars of iron, six lumps of coal and 50,000 GP -- but I will also need a potion of monster oil.\"";
if (@Q_SETZER_status < @SETZER_KNOWS_OIL)
set @Q_SETZER_status, @SETZER_KNOWS_OIL;
callsub L_Update_Var;
next;
menu
"Here you are.", L_Next2,
"Monster oil? What's that?", L_ExplainMonsterOil,
"HOW much? Nevermind then!", L_Pass;
L_Next2:
if (Zeny < 50000)
goto L_SetzerNoZeny;
if ( (countitem("IronIngot") < 3) || (countitem("Coal") < 6) )
goto L_SetzerNoIngot;
if (countitem("MonsterOilPotion") < 1)
goto L_SetzerNoMonsterOil;
if (countitem("ShortSword") < 1)
goto L_SetzerNoSword;
// No inventory check needed, as the short sword is removed, opening a slot
mes "[Nicholas]";
mes "Nicholas takes the items, heats up your sword and pounds it with a heavy hammer. As you watch, it turns thinner and flatter. Finally he pours the monster oil over it, heats the metal up again and douses it in water.";
set Zeny, Zeny - 50000;
delitem "IronIngot", 3;
delitem "Coal", 6;
delitem "MonsterOilPotion", 1;
delitem "ShortSword", 1;
getitem "Setzer", 1;
if (!(@Q_SETZER_status & @SETZER_FLAG_MADE_SETZER))
mes "[" + @SETZER_XP + " experience points]";
if (!(@Q_SETZER_status & @SETZER_FLAG_MADE_SETZER))
getexp @SETZER_XP, 1;
set @Q_SETZER_status, @Q_SETZER_status | @SETZER_FLAG_MADE_SETZER;
callsub L_Update_Var;
next;
mes "[Nicholas]";
mes "Nicholas hands you the completed sword. It feels strangely light in your hands.";
mes "\"I made it lighter and faster, it should also cut a little better now. This kind of sword is called a Setzer, after a famous gambler who invented it as a weapon in between a knife and a sword.\"";
next;
mes "[Nicholas]";
mes "\"I'm quite happy with this one. Be careful around the edge, though, it is quite sharp!\"";
close;
L_ExplainMonsterOil:
mes "[Nicholas]";
mes "\"Monster oil is a special oil that can be used to harden thin sheets of metal, if used properly. Unfortunately, it is very hard to get. Perhaps one of our local alchemists can help you with it?\"";
close;
L_SetzerNoZeny:
mes "[Nicholas]";
mes "\"I am sorry, but I must ask that you pay 50,000 GP; the kind of weapon I am thinking of is not easy to make.\"";
close;
L_SetzerNoIngot:
mes "[Nicholas]";
mes "\"Without 3 ingots of iron, and six lumps of coal, I can't improve your sword.\"";
close;
L_SetzerNoMonsterOil:
mes "[Nicholas]";
mes "\"I know that monster oil is hard to come by, but I can't do much without it. Ask an alchemist if you need help making it.\"";
close;
L_SetzerNoSword:
mes "[Nicholas]";
mes "\"I will need your old Short Sword as a basis. Please bring it to me first.\"";
close;
L_end:
close;
L_Done:
mes "[Nicholas]";
mes "\"Here you go!\"";
mes "";
mes "\"Come back any time.\"";
close;
L_Update_Var:
set QUEST_Forestbow_state, (QUEST_Forestbow_state & ~(@Q_SHIELD_MASK | @Q_SETZER_MASK) | (@Q_SHIELD_status << @Q_SHIELD_SHIFT) | (@Q_SETZER_status << @Q_SETZER_SHIFT));
return;
L_TooMany:
mes "[Nicholas]";
mes "\"You don't have room for it. Come back later when you do.\"";
close;
}