From ff9d0ccef4d0a494da2eae4e1f68a0bc0d1df25c Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sat, 25 May 2019 00:06:14 -0300 Subject: Recipe System + Recipe Book + bugfix --- db/re/item_db.conf | 14 +++++++++++++- npc/craft/recipes.txt | 29 +++++++++++++++++++---------- npc/guilds/logs.txt | 10 +++++----- 3 files changed, 37 insertions(+), 16 deletions(-) diff --git a/db/re/item_db.conf b/db/re/item_db.conf index db6d53496..30cac165e 100644 --- a/db/re/item_db.conf +++ b/db/re/item_db.conf @@ -1133,7 +1133,19 @@ item_db: ( doevent "rand_sc_heal::OnUse"; "> }, -// Id 557 is free +{ + Id: 557 + AegisName: "RecipeBook" + Name: "Recipe Book" + Type: "IT_USABLE" + Buy: 0 + Sell: 0 + Weight: 20 + KeepAfterUse: true + Script: <" + doevent "#RecipeBook::OnUse"; + "> +}, { Id: 558 AegisName: "Mashmallow" diff --git a/npc/craft/recipes.txt b/npc/craft/recipes.txt index e388c794f..016d1ceec 100644 --- a/npc/craft/recipes.txt +++ b/npc/craft/recipes.txt @@ -36,18 +36,18 @@ OnUse: close; // Expects: @scope$ -// showRecipe( Craft, Bonus, {item 1, amount 1}, {item 2, amount 2}... ) +// 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 (getd("RECIPES_"+@scope$+"["+getarg(0)+"]")) { if (getarg(1)) { - mesn l(".:: @@ Recipe ::.", getitemlink(getarg(1))); + mes l(".:: @@ Recipe ::.", getitemlink(getarg(1))); for (.@i=2;.@i < getargcount(); .@i++) { - mesc l("@@/@@ @@", countitem(getarg(.@i)), getarg(.@i+1), getitemlink(getarg(.@i))); + mesc l("@@/@@ @@", countitem(getarg(.@i+1)), getarg(.@i), getitemlink(getarg(.@i+1))); .@i++; } mes ""; @@ -75,7 +75,7 @@ function readCooking { } // =============================== Cooking Functions -function readCooking { +function readAlchemy { setnpcdialogtitle l("Alchemy Recipes"); @scope$="ALCHEMY"; @@ -109,35 +109,35 @@ function readCooking { // Stats Boosts mesc "----------"+l("Stat Boost Recipes")+"----------", 2; showRecipe(CraftLukPotionA, LukPotionA, - 1, EmeraldPower, 1, HerbalTea); + 1, EmeraldPowder, 1, HerbalTea); showRecipe(CraftLukPotionB, LukPotionB, 1, Emerald, 2, HerbalTea); showRecipe(CraftLukPotionC, LukPotionC, 1, PolishedEmerald, 3, HerbalTea); showRecipe(CraftDexPotionA, DexPotionA, - 1, AmethystPower, 1, HerbalTea); + 1, AmethystPowder, 1, HerbalTea); showRecipe(CraftDexPotionB, DexPotionB, 1, Amethyst, 2, HerbalTea); showRecipe(CraftDexPotionC, DexPotionC, 1, PolishedAmethyst, 3, HerbalTea); showRecipe(CraftIntPotionA, IntPotionA, - 1, SapphirePower, 1, HerbalTea); + 1, SapphirePowder, 1, HerbalTea); showRecipe(CraftIntPotionB, IntPotionB, 1, Sapphire, 2, HerbalTea); showRecipe(CraftIntPotionC, IntPotionC, 1, PolishedSapphire, 3, HerbalTea); showRecipe(CraftVitPotionA, VitPotionA, - 1, DiamondPower, 1, HerbalTea); + 1, DiamondPowder, 1, HerbalTea); showRecipe(CraftVitPotionB, VitPotionB, 1, Diamond, 2, HerbalTea); showRecipe(CraftVitPotionC, VitPotionC, 1, PolishedDiamond, 3, HerbalTea); showRecipe(CraftAgiPotionA, AgiPotionA, - 1, TopazPower, 1, HerbalTea); + 1, TopazPowder, 1, HerbalTea); showRecipe(CraftAgiPotionB, AgiPotionB, 1, Topaz, 2, HerbalTea); showRecipe(CraftAgiPotionC, AgiPotionC, @@ -211,6 +211,15 @@ function script MakeBlueprint { array_push(.@recipes, CraftAgiPotionC); array_push(.@recipes, CraftVitPotionC); } + + // Now you'll learn some recipe! + .@rcp=any_of(.@recipes); + if (RECIPES_ALCHEMY[.@rcp]) + dispbottom l("It was a recipe you already knew..."); + else + dispbottom l("Learned a new recipe!"); + + RECIPES_ALCHEMY[.@rcp]=true; break; default: return Exception("Invalid blueprint type "+.@type+" - item was lost."); diff --git a/npc/guilds/logs.txt b/npc/guilds/logs.txt index 47befc0ad..a255eb566 100644 --- a/npc/guilds/logs.txt +++ b/npc/guilds/logs.txt @@ -39,35 +39,35 @@ guilds,47,39,0 script Guild Logs NPC_NO_SPRITE,{ // Stats Boosts .@s+=showRecipe(CraftLukPotionA, LukPotionA, - 1, EmeraldPower, 1, HerbalTea); + 1, EmeraldPowder, 1, HerbalTea); .@s+=showRecipe(CraftLukPotionB, LukPotionB, 1, Emerald, 2, HerbalTea); .@s+=showRecipe(CraftLukPotionC, LukPotionC, 1, PolishedEmerald, 3, HerbalTea); .@s+=showRecipe(CraftDexPotionA, DexPotionA, - 1, AmethystPower, 1, HerbalTea); + 1, AmethystPowder, 1, HerbalTea); .@s+=showRecipe(CraftDexPotionB, DexPotionB, 1, Amethyst, 2, HerbalTea); .@s+=showRecipe(CraftDexPotionC, DexPotionC, 1, PolishedAmethyst, 3, HerbalTea); .@s+=showRecipe(CraftIntPotionA, IntPotionA, - 1, SapphirePower, 1, HerbalTea); + 1, SapphirePowder, 1, HerbalTea); .@s+=showRecipe(CraftIntPotionB, IntPotionB, 1, Sapphire, 2, HerbalTea); .@s+=showRecipe(CraftIntPotionC, IntPotionC, 1, PolishedSapphire, 3, HerbalTea); .@s+=showRecipe(CraftVitPotionA, VitPotionA, - 1, DiamondPower, 1, HerbalTea); + 1, DiamondPowder, 1, HerbalTea); .@s+=showRecipe(CraftVitPotionB, VitPotionB, 1, Diamond, 2, HerbalTea); .@s+=showRecipe(CraftVitPotionC, VitPotionC, 1, PolishedDiamond, 3, HerbalTea); .@s+=showRecipe(CraftAgiPotionA, AgiPotionA, - 1, TopazPower, 1, HerbalTea); + 1, TopazPowder, 1, HerbalTea); .@s+=showRecipe(CraftAgiPotionB, AgiPotionB, 1, Topaz, 2, HerbalTea); .@s+=showRecipe(CraftAgiPotionC, AgiPotionC, -- cgit v1.2.3-60-g2f50