// TMW-2 script.
// Author:
// Jesusalva
// Description:
// Recipe Books in TMW2
- script #RecipeBook NPC_HIDDEN,{
function showRecipe;
function readCooking;
function readAlchemy;
function readCrafting;
OnUse:
setnpcdialogtitle l("Recipe Book");
mesc l("You open the Recipe Book. Each recipe you get can be put here.");
next;
do {
mesc l("Which recipes do you want to read?");
select
l("Nothing."),
l("Cooking Recipes."),
l("Alchemy Recipes."),
l("Crafting Recipes.");
mes "";
switch (@menu) {
case 2:
readCooking(); break;
case 3:
readAlchemy(); break;
case 4:
readCrafting(); break;
}
} while (@menu != 1);
closeclientdialog;
close;
// Expects: @scope$
// showRecipe( Craft, Bonus, {amount 1, item 1}, {amount 2, item 2}... )
function showRecipe {
if (getargcount() < 3 || getargcount() % 2 != 0 || @scope$ == "")
return Exception("Faulty recipe skill command invoked - error");
// getd("$RECIPES_ALCHEMY_"+getcharid(2)+"["+getarg(0)+"]")
if (getd("RECIPES_"+@scope$+"["+getarg(0)+"]")) {
if (getarg(1)) {
mes l(".:: @@ Recipe ::.", getitemlink(getarg(1)));
for (.@i=2;.@i < getargcount(); .@i++) {
mesc l("@@/@@ @@", countitem(getarg(.@i+1)), getarg(.@i), getitemlink(getarg(.@i+1)));
.@i++;
}
mes "";
}
return 1;
}
//debugmes "Nope, nothing here";
return 0;
}
// =============================== Cooking Functions
function readCooking {
setnpcdialogtitle l("Cooking Recipes");
@scope$="COOKING";
mesc l("Eating is a necessity, but cooking is an art.");
mesc l("(All items must be placed exactly in this order.)");
next;
mesc l("List of known cooking recipes:");
mes "";
showRecipe(0, Iten, WarpedLog, 9999);
next;
@scope$="";
return;
}
// =============================== Cooking Functions
function readAlchemy {
setnpcdialogtitle l("Alchemy Recipes");
@scope$="ALCHEMY";
mesc l("Alchemy. The art of having quasi-magical effects without magic.");
mesc l("(All items must be placed exactly in this order.)");
next;
mesc l("List of known alchemy recipes:");
mes "";
// Healing
mesc "----------"+l("Healing Recipes")+"----------", 2;
showRecipe(CraftPiberriesInfusion, PiberriesInfusion,
5, Piberries, 1, Curshroom);
dnext;
// General Boosts
mesc "----------"+l("General Recipes")+"----------", 2;
showRecipe(CraftHastePotion, HastePotion,
15, Plushroom);
showRecipe(CraftStrengthPotion, StrengthPotion,
15, Chagashroom);
showRecipe(CraftResetPotion, StatusResetPotion,
90, ManaPiouFeathers, 10, Curshroom);
showRecipe(CraftSpeedPotion, MoveSpeedPotion,
1, GemPowder, 5, FluoPowder);
showRecipe(CraftPrecisionPotion, PrecisionPotion,
3, Piberries, 1, MountainSnakeEgg);
showRecipe(CraftDodgePotion, DodgePotion,
3, Piberries, 1, SnakeEgg);
dnext;
// Stats Boosts
mesc "----------"+l("Stat Boost Recipes")+"----------", 2;
showRecipe(CraftLukPotionA, LukPotionA,
1, EmeraldPowder, 1, HerbalTea);
showRecipe(CraftLukPotionB, LukPotionB,
1, Emerald, 2, HerbalTea);
showRecipe(CraftLukPotionC, LukPotionC,
1, PolishedEmerald, 3, HerbalTea);
showRecipe(CraftDexPotionA, DexPotionA,
1, AmethystPowder, 1, HerbalTea);
showRecipe(CraftDexPotionB, DexPotionB,
1, Amethyst, 2, HerbalTea);
showRecipe(CraftDexPotionC, DexPotionC,
1, PolishedAmethyst, 3, HerbalTea);
showRecipe(CraftIntPotionA, IntPotionA,
1, SapphirePowder, 1, HerbalTea);
showRecipe(CraftIntPotionB, IntPotionB,
1, Sapphire, 2, HerbalTea);
showRecipe(CraftIntPotionC, IntPotionC,
1, PolishedSapphire, 3, HerbalTea);
showRecipe(CraftVitPotionA, VitPotionA,
1, DiamondPowder, 1, HerbalTea);
showRecipe(CraftVitPotionB, VitPotionB,
1, Diamond, 2, HerbalTea);
showRecipe(CraftVitPotionC, VitPotionC,
1, PolishedDiamond, 3, HerbalTea);
showRecipe(CraftAgiPotionA, AgiPotionA,
1, TopazPowder, 1, HerbalTea);
showRecipe(CraftAgiPotionB, AgiPotionB,
1, Topaz, 2, HerbalTea);
showRecipe(CraftAgiPotionC, AgiPotionC,
1, PolishedTopaz, 3, HerbalTea);
next;
@scope$="";
return;
}
// =============================== Crafting Functions
function readCrafting {
setnpcdialogtitle l("Crafting Recipes");
@scope$="EQUIPMENT";
mesc l("There is only one way towards the best equipment: Smith away!");
mesc l("(All items must be placed exactly in this order.)");
next;
mesc l("List of known crafting recipes:");
mes "";
// Melee Weapons: Never use Titanium nor Lead. Iron-based, no silver
mesc "----------"+l("One Hand Weapon Recipes")+"----------", 2;
showRecipe(CraftDagger, Dagger,
1, IronIngot,
3, Coal,
1, SulfurPowder);
showRecipe(CraftWoodenSword, WoodenSword,
20, WoodenLog,
5, RawLog,
1, SharpKnife);
showRecipe(CraftBugSlayer, BugSlayer,
8, IronIngot,
12, Coal,
1, EverburnPowder);
showRecipe(CraftShortGladius, ShortGladius,
12, IronIngot,
16, Coal,
1, EverburnPowder);
showRecipe(CraftBacksword, Backsword,
18, IronIngot,
3, TinIngot,
20, Coal,
1, EverburnPowder);
showRecipe(CraftShortsword, ShortSword,
24, IronIngot,
5, TinIngot,
24, Coal,
1, EverburnPowder);
showRecipe(CraftKitana, Kitana,
30, IronIngot,
9, TinIngot,
30, Coal,
1, EverburnPowder);
showRecipe(CraftBoneKnife, BoneKnife,
36, IronIngot,
90, Bone,
30, Coal,
1, EverburnPowder);
showRecipe(CraftLongSword, LongSword,
42, IronIngot,
1, PlatinumIngot,
1, IridiumIngot,
32, Coal);
showRecipe(CraftRockKnife, RockKnife,
50, TerraniteOre,
2, PlatinumIngot,
3, IridiumIngot,
40, Coal);
showRecipe(CraftDivineSword, DivineSword,
2, DivineApple,
3, PlatinumIngot,
5, IridiumIngot,
60, Coal);
dnext;
// Two Hands Melee Weapons: Never use Titanium nor Lead. Silver-based.
mesc "----------"+l("Two Hands Weapon Recipes")+"----------", 2;
showRecipe(CraftMiereCleaver, MiereCleaver,
12, SilverIngot,
1, TinIngot,
8, Coal,
1, EverburnPowder);
showRecipe(CraftBroadsword, Broadsword,
27, SilverIngot,
1, TinIngot,
20, Coal,
1, EverburnPowder);
// Reserved ID 63 and 64
// Halberd is really cheap as it doesn't uses Platinum/Iridium :P
showRecipe(CraftHalberd, Halberd,
45, SilverIngot,
5, TinIngot,
34, Coal,
1, EverburnPowder);
showRecipe(CraftImmortalSword, ImmortalSword,
40, SilverIngot,
2, PlatinumIngot,
3, IridiumIngot,
1, BlueManaPearl);
dnext;
// Archery Weapons: Always use Wood, Root and Carp.
mesc "----------"+l("Archery Weapon Recipes")+"----------", 2;
showRecipe(CraftShortBow, ShortBow,
18, WoodenLog,
12, Root,
3, LeatherPatch,
1, CommonCarp);
showRecipe(CraftForestBow, ForestBow,
24, WoodenLog,
16, Root,
5, LeatherPatch,
3, CommonCarp);
showRecipe(CraftElficBow, ElficBow,
33, WoodenLog,
22, Root,
1, IronIngot,
4, CommonCarp);
showRecipe(CraftChampionshipBow, ChampionshipBow,
48, WoodenLog,
32, Root,
1, GoldIngot,
5, CommonCarp);
showRecipe(CraftBansheeBow, BansheeBow,
70, WoodenLog,
45, Root,
5, DarkCrystal,
5, CommonCarp);
dnext;
// Magical Weapons: Wood + powders
mesc "----------"+l("Magical Weapon Recipes")+"----------", 2;
showRecipe(CraftTrainingWand, TrainingWand,
20, WoodenLog,
30, ManaPiouFeathers,
5, FluoPowder,
1, GemPowder);
showRecipe(CraftNoviceWand, NoviceWand,
40, WoodenLog,
60, ManaPiouFeathers,
8, FluoPowder,
1, GemPowder);
showRecipe(CraftApprenticeWand, ApprenticeWand,
60, WoodenLog,
90, ManaPiouFeathers,
12, FluoPowder,
1, GemPowder);
showRecipe(CraftLeaderWand, LeaderWand,
100, WoodenLog,
120, ManaPiouFeathers,
15, FluoPowder,
1, GemPowder);
showRecipe(CraftLegendaryWand, LegendaryWand,
110, WoodenLog,
3, GoldenApple,
20, FluoPowder,
1, GemPowder);
dnext;
// Firestaff Weapons: Lead + Titanium
mesc "----------"+l("Fire Staffs Recipes")+"----------", 2;
showRecipe(CraftPynRevolver, PynRevolver,
4, LeadIngot,
5, TitaniumIngot,
11, Coal,
1, EverburnPowder);
showRecipe(CraftPynRifle, PynRifle,
6, LeadIngot,
7, TitaniumIngot,
14, Coal,
1, EverburnPowder);
showRecipe(CraftPynGatling, PynGatling,
7, LeadIngot,
7, TitaniumIngot,
14, Coal,
1, EverburnPowder);
showRecipe(CraftPynShotgun, PynShotgun,
9, LeadIngot,
10, TitaniumIngot,
16, Coal,
1, EverburnPowder);
dnext;
// Shields: May use Leather. Titanium or Lead, but never both
mesc "----------"+l("Shield Recipes")+"----------", 2;
showRecipe(CraftWoodenShield, WoodenShield,
40, WoodenLog,
2, LeatherPatch,
1, SharpKnife);
showRecipe(CraftBladeShield, BladeShield,
14, IronIngot,
2, TitaniumIngot,
5, Coal,
1, EverburnPowder);
// Exception to shield rule: Braknar Shield
showRecipe(CraftBraknarShield, BraknarShield,
18, CopperIngot,
2, TinIngot,
5, Coal,
1, EverburnPowder);
showRecipe(CraftBritShield, BritShield,
20, CopperIngot,
3, TitaniumIngot,
7, Coal,
1, EverburnPowder);
showRecipe(CraftBromenalShield, BromenalShield,
24, CopperIngot,
4, TitaniumIngot,
10, Coal,
1, EverburnPowder);
showRecipe(CraftBlueKnightShield, BlueKnightShield,
30, CopperIngot,
5, TitaniumIngot,
15, Coal,
1, EverburnPowder);
showRecipe(CraftSteelShield, SteelShield,
20, TinIngot,
7, TitaniumIngot,
20, Coal,
1, EverburnPowder);
showRecipe(CraftDragonShield, DragonShield,
80, DragonScales,
10, TitaniumIngot,
30, Coal,
1, EverburnPowder);
showRecipe(CraftSaviorShield, SaviorShield,
1, MylarinDust,
15, TitaniumIngot,
40, Coal,
1, EverburnPowder);
dnext;
// Gloves: Gloves items
mesc "----------"+l("Gloves Recipes")+"----------", 2;
showRecipe(CraftSilkGloves, SilkGloves,
40, SilkCocoon,
5, PiouFeathers,
1, WhiteFur,
1, EarthPowder);
showRecipe(CraftLeatherGloves, LeatherGloves,
10, LeatherPatch,
10, PiouFeathers,
5, WhiteFur,
1, EarthPowder);
showRecipe(CraftBromenalGloves, BromenalGloves,
30, LeatherPatch,
3, AnimalBones,
15, WhiteFur,
1, EarthPowder);
showRecipe(CraftManaGloves, ManaGloves,
1, SacredManaPotion,
1, BlueManaPearl,
45, WhiteFur,
1, EarthPowder);
showRecipe(CraftWarlordGloves, WarlordGloves,
1, IridiumIngot,
1, PlatinumIngot,
60, WhiteFur,
1, EarthPowder);
showRecipe(CraftAssassinGloves, AssassinGloves,
1, IridiumIngot,
1, PlatinumIngot,
150, WhiteFur,
1, EarthPowder);
dnext;
// Helmets: Helmet items
mesc "----------"+l("Helmet Recipes")+"----------", 2;
showRecipe(CraftInfantryHelmet, InfantryHelmet,
3, IronIngot,
3, CopperIngot,
5, Lifestone,
1, EarthPowder);
showRecipe(CraftDesertHelmet, DesertHelmet,
4, IronIngot,
4, CopperIngot,
7, Lifestone,
1, EarthPowder);
showRecipe(CraftBromenalHelmet, BromenalHelmet,
7, CopperIngot,
2, SilverIngot,
8, Lifestone,
1, EarthPowder);
showRecipe(CraftCandleHelmet, CandleHelmet,
2, EverburnPowder,
1, DesertHelmet,
10, Lifestone,
1, EarthPowder);
showRecipe(CraftCrusadeHelmet, CrusadeHelmet,
7, SilverIngot,
5, TinIngot,
14, Lifestone,
1, EarthPowder);
showRecipe(CraftWarlordHelmet, WarlordHelmet,
7, SilverIngot,
2, TitaniumIngot,
20, Lifestone,
1, EarthPowder);
showRecipe(CraftVikingHelmet, VikingHelmet,
1, IridiumIngot,
5, TitaniumIngot,
27, Lifestone,
1, EarthPowder);
showRecipe(CraftTerraniteHelmet, TerraniteHelmet,
3, TerraniteIngot,
30, Coal,
32, Lifestone,
1, EarthPowder);
showRecipe(CraftCenturionHelmet, CenturionHelmet,
2, IridiumIngot,
10, TitaniumIngot,
32, Lifestone,
1, EarthPowder);
showRecipe(CraftBullHelmet, BullHelmet,
3, IridiumIngot,
10, LeadIngot,
36, Lifestone,
1, EarthPowder);
showRecipe(CraftDarkHelm, DarkHelm,
3, IridiumIngot,
12, LeadIngot,
40, Lifestone,
1, EarthPowder);
showRecipe(CraftDarkKnightHelmet, DarkKnightHelmet,
5, IridiumIngot,
3, PlatinumIngot,
50, Lifestone,
1, EarthPowder);
showRecipe(CraftSamuraiHelmet, SamuraiHelmet,
3, IridiumIngot,
5, PlatinumIngot,
50, Lifestone,
1, EarthPowder);
dnext;
// Misc: Misc items
mesc "----------"+l("Miscellaneous Recipes")+"----------", 2;
showRecipe(CraftGoldenRing, GoldenRing,
5, GoldPieces,
1, TitaniumIngot,
8, Coal,
1, EverburnPowder);
showRecipe(CraftTerranitePants, TerranitePants,
2, TerraniteIngot,
15, Coal,
32, LeatherPatch,
1, EarthPowder);
showRecipe(CraftTerraniteArmor, TerraniteArmor,
4, TerraniteIngot,
45, Coal,
32, IronPowder,
1, EarthPowder);
next;
@scope$="";
return;
}
OnInit:
.sex = G_OTHER;
.distance = 1;
end;
}
// Below this line are utils for Gacha. We use callfunc() on itemDB.
// Types: CRAFT_COOKING, CRAFT_ALCHEMY, CRAFT_EQUIPMENT
// Rarity: 1 - basic, 2 - intermediary, 4 - advanced, 8 - expert, 16 - master
// Level equivalents: 1: (1~20) 2: (21~44), 3: (45~75), 4: (76~99), 5: 100+
function script MakeBlueprint {
.@type=getarg(0, -1);
.@rarity=getarg(1, 1);
switch (.@type) {
/////////////////////////////////////////////////////
///// Alchemy Recipes
/////////////////////////////////////////////////////
case CRAFT_ALCHEMY:
if (.@rarity & CRAFT_BASIC) {
array_push(.@recipes, CraftPiberriesInfusion);
array_push(.@recipes, CraftHastePotion);
array_push(.@recipes, CraftStrengthPotion);
}
if (.@rarity & CRAFT_INTERMEDIARY) {
array_push(.@recipes, CraftLukPotionA);
array_push(.@recipes, CraftDexPotionA);
array_push(.@recipes, CraftIntPotionA);
array_push(.@recipes, CraftAgiPotionA);
array_push(.@recipes, CraftVitPotionA);
array_push(.@recipes, CraftSpeedPotion);
}
if (.@rarity & CRAFT_ADVANCED) {
array_push(.@recipes, CraftResetPotion);
array_push(.@recipes, CraftPrecisionPotion);
array_push(.@recipes, CraftDodgePotion);
}
if (.@rarity & CRAFT_EXPERT) {
array_push(.@recipes, CraftLukPotionB);
array_push(.@recipes, CraftDexPotionB);
array_push(.@recipes, CraftIntPotionB);
array_push(.@recipes, CraftAgiPotionB);
array_push(.@recipes, CraftVitPotionB);
}
if (.@rarity & CRAFT_MASTER) {
array_push(.@recipes, CraftLukPotionC);
array_push(.@recipes, CraftDexPotionC);
array_push(.@recipes, CraftIntPotionC);
array_push(.@recipes, CraftAgiPotionC);
array_push(.@recipes, CraftVitPotionC);
}
// Now you'll learn some recipe!
.@rcp=any_of(.@recipes);
if (RECIPES_ALCHEMY[.@rcp]) {
.@mpot=rand2(900, 1000*.@rarity);
dispbottom l("It was a recipe you already knew... (+ @@ Mobpt)", .@mpot);
getexp (BaseLevel+JobLevel)*rand2(1,.@rarity), JobLevel+rand2(1,.@rarity);
// Give you some Monster Points to use with Intense Beard
// You do NOT need to be registered with Aidan for this.
Mobpt+=.@mpot;
} else {
dispbottom l("Learned a new recipe!");
RECIPES_ALCHEMY[.@rcp]=true;
}
break;
/////////////////////////////////////////////////////
///// Equipment Recipes
/////////////////////////////////////////////////////
// array_push(.@recipes, Craft);
case CRAFT_EQUIPMENT:
if (.@rarity & CRAFT_BASIC) {
array_push(.@recipes, CraftWoodenSword);
array_push(.@recipes, CraftWoodenShield);
array_push(.@recipes, CraftTrainingWand);
array_push(.@recipes, CraftShortBow);
array_push(.@recipes, CraftSilkGloves);
array_push(.@recipes, CraftInfantryHelmet);
}
if (.@rarity & CRAFT_INTERMEDIARY) {
array_push(.@recipes, CraftBugSlayer);
array_push(.@recipes, CraftShortGladius);
array_push(.@recipes, CraftMiereCleaver);
array_push(.@recipes, CraftBladeShield);
array_push(.@recipes, CraftNoviceWand);
array_push(.@recipes, CraftForestBow);
array_push(.@recipes, CraftLeatherGloves);
array_push(.@recipes, CraftDesertHelmet);
array_push(.@recipes, CraftBromenalHelmet);
}
if (.@rarity & CRAFT_ADVANCED) {
array_push(.@recipes, CraftBacksword);
array_push(.@recipes, CraftShortsword);
array_push(.@recipes, CraftBoneKnife);
array_push(.@recipes, CraftKitana);
array_push(.@recipes, CraftBroadsword);
array_push(.@recipes, CraftPynRevolver);
array_push(.@recipes, CraftApprenticeWand);
array_push(.@recipes, CraftElficBow);
array_push(.@recipes, CraftBritShield);
array_push(.@recipes, CraftBromenalShield);
array_push(.@recipes, CraftBlueKnightShield);
array_push(.@recipes, CraftBromenalGloves);
array_push(.@recipes, CraftCandleHelmet);
array_push(.@recipes, CraftCrusadeHelmet);
array_push(.@recipes, CraftWarlordHelmet);
array_push(.@recipes, CraftVikingHelmet);
}
if (.@rarity & CRAFT_EXPERT) {
array_push(.@recipes, CraftGoldenRing);
array_push(.@recipes, CraftLongSword);
array_push(.@recipes, CraftRockKnife);
array_push(.@recipes, CraftHalberd);
array_push(.@recipes, CraftPynRifle);
array_push(.@recipes, CraftPynGatling);
array_push(.@recipes, CraftLeaderWand);
array_push(.@recipes, CraftChampionshipBow);
array_push(.@recipes, CraftSteelShield);
array_push(.@recipes, CraftDragonShield);
array_push(.@recipes, CraftManaGloves);
array_push(.@recipes, CraftWarlordGloves);
array_push(.@recipes, CraftTerraniteHelmet);
array_push(.@recipes, CraftCenturionHelmet);
array_push(.@recipes, CraftBullHelmet);
array_push(.@recipes, CraftDarkHelm);
array_push(.@recipes, CraftTerraniteArmor);
array_push(.@recipes, CraftTerranitePants);
}
if (.@rarity & CRAFT_MASTER) {
array_push(.@recipes, CraftDivineSword);
array_push(.@recipes, CraftImmortalSword);
array_push(.@recipes, CraftPynShotgun);
array_push(.@recipes, CraftLegendaryWand);
array_push(.@recipes, CraftBansheeBow);
array_push(.@recipes, CraftSaviorShield);
array_push(.@recipes, CraftAssassinGloves);
array_push(.@recipes, CraftDarkKnightHelmet);
array_push(.@recipes, CraftSamuraiHelmet);
}
// Now you'll learn some recipe!
.@rcp=any_of(.@recipes);
// Double precision failsafe
if (RECIPES_EQUIPMENT[.@rcp])
.@rcp=any_of(.@recipes);
// Maybe you already knew it?
if (RECIPES_EQUIPMENT[.@rcp]) {
.@mpot=rand2(900*.@rarity, 1000*.@rarity);
dispbottom l("It was a recipe you already knew... (+ @@ Mobpt)", .@mpot);
getexp (BaseLevel+JobLevel)*rand2(1,.@rarity), JobLevel+rand2(1,.@rarity);
// Give you some Monster Points to use with Intense Beard
// You do NOT need to be registered with Aidan for this.
Mobpt+=.@mpot;
} else {
dispbottom l("Learned a new recipe!");
RECIPES_EQUIPMENT[.@rcp]=true;
}
break;
default:
return Exception("Invalid blueprint type "+.@type+" - item was lost.");
}
return;
}
// Create a blueprint based on level. Extra chance for weaker Blueprint.
// Level equivalents: 1: (1~20) 2: (21~44), 3: (45~75), 4: (76~99), 5: 100+
function script MakeRandomBlueprint {
array_push(.@blueprints, AlchemyBlueprintA);
array_push(.@blueprints, EquipmentBlueprintA);
if (BaseLevel > 20) {
array_push(.@blueprints, AlchemyBlueprintB);
array_push(.@blueprints, EquipmentBlueprintB);
}
if (BaseLevel > 44) {
array_push(.@blueprints, AlchemyBlueprintB);
array_push(.@blueprints, EquipmentBlueprintB);
array_push(.@blueprints, AlchemyBlueprintC);
array_push(.@blueprints, EquipmentBlueprintC);
}
if (BaseLevel > 75) {
array_push(.@blueprints, AlchemyBlueprintC);
array_push(.@blueprints, EquipmentBlueprintC);
array_push(.@blueprints, AlchemyBlueprintD);
array_push(.@blueprints, EquipmentBlueprintD);
}
if (BaseLevel > 100) {
array_push(.@blueprints, AlchemyBlueprintD);
array_push(.@blueprints, EquipmentBlueprintD);
array_push(.@blueprints, AlchemyBlueprintE);
array_push(.@blueprints, EquipmentBlueprintE);
}
getitem any_of(.@blueprints), 1;
return;
}