summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-07-06 17:42:06 -0300
committerJesusaves <cpntb1@ymail.com>2020-07-06 17:42:06 -0300
commitd66cdb876508417f898d88c20ecbd4c1bec01219 (patch)
tree33ded7c4c17be0dbdd9a2cb43e09b9b2da1bfdad
parent2a9ee36a9855ed7df670a4797d517c7f3b590868 (diff)
downloadserverdata-d66cdb876508417f898d88c20ecbd4c1bec01219.tar.gz
serverdata-d66cdb876508417f898d88c20ecbd4c1bec01219.tar.bz2
serverdata-d66cdb876508417f898d88c20ecbd4c1bec01219.tar.xz
serverdata-d66cdb876508417f898d88c20ecbd4c1bec01219.zip
Refactor code
-rw-r--r--npc/items/recipes.txt90
1 files changed, 64 insertions, 26 deletions
diff --git a/npc/items/recipes.txt b/npc/items/recipes.txt
index a8a80ca6..ceec3be4 100644
--- a/npc/items/recipes.txt
+++ b/npc/items/recipes.txt
@@ -26,10 +26,32 @@ function showRecipe {
return false;
}
+// For Cooking Recipes (completly parallel implementation)
+// showCooking( Craft, Bonus, {amount 1, item 1}, {amount 2, item 2}... )
+function showCooking {
+ if (getargcount() < 3 || getargcount() % 2 != 0)
+ return false;//Exception("Faulty recipe skill command invoked - error");
+
+ if (getd("COOKING_RECIPES["+getarg(0)+"]")) {
+ if (getarg(1)) {
+ mes l(".:: %s Recipe ::.", getitemlink(getarg(1)));
+
+ for (.@i=2;.@i < getargcount(); .@i++) {
+ mesc l("%d/%d %s", countitem(getarg(.@i+1)), getarg(.@i), getitemlink(getarg(.@i+1)));
+ .@i++;
+ }
+ mes "";
+ }
+ return true;
+ }
+ return false;
+}
+
- script #RecipeBook NPC_HIDDEN,{
end;
function read_book {
+ setnpcdialogtitle l(.book_name$);
mesc l("This book has several bookmarks. Which one will you open?");
next;
menuint
@@ -47,12 +69,14 @@ function read_book {
mesc l("Perhaps, in future, someone adds it to this world.");
break;
}
+ next;
return;
}
+///////////////////////////////////////////////////////////////////////////////
function read_cooking {
- setnpcdialogtitle l(.book_name$);
+ setnpcdialogtitle l("Cooking Recipes");
mesc l("Eating is a necessity, but cooking is an art.");
mesc l("(All items must be placed exactly in this order for cooking work.)");
@@ -61,34 +85,48 @@ function read_cooking {
mes "";
mes ".:: " + l("Sandwiches") + " ::.";
mes "";
- if (COOKING_RECIPES[CraftCarpSandwich]) {
- mes l("@@", getitemlink(CarpSandwich));
- mesc l("* @@ @@", 1, getitemlink(Bread));
- mesc l("* @@ @@", 3, getitemlink(LettuceLeaf));
- mesc l("* @@ @@", 2, getitemlink(Cheese));
- mesc l("* @@ @@", 1, getitemlink(CommonCarp));
- mes "";
- }
- if (COOKING_RECIPES[CraftPioulegSandwich]) {
- mes l("@@", getitemlink(PioulegSandwich));
- mesc l("* @@ @@", 1, getitemlink(Bread));
- mesc l("* @@ @@", 3, getitemlink(LettuceLeaf));
- mesc l("* @@ @@", 2, getitemlink(Cheese));
- mesc l("* @@ @@", 1, getitemlink(PiouLegs));
- mes "";
- }
- if (COOKING_RECIPES[CraftMananaSandwich]) {
- mes l("@@", getitemlink(MananaSandwich));
- mesc l("* @@ @@", 1, getitemlink(Bread));
- mesc l("* @@ @@", 3, getitemlink(LettuceLeaf));
- mesc l("* @@ @@", 2, getitemlink(Cheese));
- mesc l("* @@ @@", 1, getitemlink(Manana));
- mes "";
- }
+ showCooking(CraftCarpSandwich, CarpSandwich,
+ 1, Bread,
+ 3, LettuceLeaf,
+ 2, Cheese,
+ 1, CommonCarp);
+ showCooking(CraftPioulegSandwich, PioulegSandwich,
+ 1, Bread,
+ 3, LettuceLeaf,
+ 2, Cheese,
+ 1, PiouLegs);
+ showCooking(CraftMananaSandwich, MananaSandwich,
+ 1, Bread,
+ 3, LettuceLeaf,
+ 2, Cheese,
+ 1, Manana);
- close;
+ return;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+function read_smithery {
+
+ setnpcdialogtitle l("Smithery Recipes");
+
+ mesc l("You will trust your life to this, so you better do a good job!");
+ mesc l("(All items must be placed exactly in this order.)");
+ next;
+ mesc l("List of known smithery recipes:");
+
+ mes "";
+ mes ".:: " + l("Helmets") + " ::.";
+ mes "";
+ showRecipe(CraftInfantryHelmet, InfantryHelmet,
+ 12, IronOre,
+ 3, Coal,
+ 2, Moss,
+ 1, Dagger);
+
+ return;
}
+
OnUse:
if (openbook())
read_book();