generic recipe #145

Parent #5Owner #29Flags read, fertileSource hellcore/hellcore.db

Aliases: generic recipe, recipe

12 verbs · 46 properties · 0 children

Verbs

VerbSpecFlagsDefinerLines
tell_componentsthis none thisrxd#14516
look_selfthis none thisrxd#14543
discovered_bythis none thisrxd#1454
tree_tagthis none thisrxd#1455
ingredient_valuethis none thisrxd#1457
readthis none nonerxd#1451
find_ingredientsthis none thisrxd#14542
xp_valuethis none thisrxd#14514
validatethis none thisrxd#14520
recyclethis none thisrxd#14514
make_durationthis none thisrxd#14510
random_ingredientthis none thisrxd#1459

Properties

PropertyDefinerFlagsOwnerValue
makes#145rc#29#-1
ingredients#145rc#29{}
skill_required#145rc#29{}
help_msg#145rc#29
list of 13{"Instructions for making end-products out of component parts. Requires a $workbench to assemble or whatever.", "", "SEE ALSO: $workbench", "", "PROPERTIES", "$recipe.makes => OBJ product", "\t- The thing the recipe is for", "", "$recipe.ingredients => {{OBJ ingredient, INT quantity}, ...}", "\t- Constituent ingredients required for the $recipe", "", "$recipe.skill_required => {{STR skill, INT difficulty}, ...}", "\t-> Skills required to fulfill the $recipe."}
researchable#145rc#291
discoverer#145rc#29#-1
reversible#145rc#291
player_owned#145rc#290
needs_bench#145rc#29#-1
make_msg#145rc#29""
makes_count#145rc#291
catalysts#145rc#29{}
discoverers#145rc#29{}
breakdown_ingredients#145rc#29{}
continue_msg#145rc#29{"%DN works on %p %t.", "%DN attaches %il to %p %t.", "%DN adjusts %il on %dt."}
time_mod#145rc#291.0
handed#5rc#29<clear>
wield_msg#5rc#29<clear>
unwield_msg#5rc#29<clear>
size#5rc#29<clear>
look_place_msg#5rc#29<clear>
value#5rc#29<clear>
get_msg#5rc#29<clear>
drop_msg#5rc#29<clear>
get_fail_msg#5rc#29<clear>
junk_ok#5rc#29<clear>
floats#5rc#29<clear>
long_name_msg#5rc#29<clear>
article#5rc#29<clear>
setup_list#5rc#29<clear>
health#5rc#29<clear>
health_max#5rc#29<clear>
min_skill#5rc#29<clear>
skill#5rc#29#329
recipe_for#5rc#29<clear>
carried_msg#5rc#29<clear>
aliases#1rc#29{"generic recipe", "recipe"}
description#1rc#29"A laminated sheet giving instructions and an ingredient list for making something."
object_size#1r#29{9876, 1298433820}
hidden_verbs#1rc#29<clear>
phelp_msg#1rc#29{"This is a recipe for making a new item. However, it's not much use to you if you don't have the listed ingredients, plus an appropriate workbench."}
weight#1rc#2910
owner_verbs#1rc#29<clear>
plural_name#1rc#29<clear>
client_image#1rc#29<clear>
listening#1rc#29<clear>

Ancestry

Ancestors (nearest first): #5 generic thing#1 root

Children: none

Call graph

calls n145_0 #145:tell_components n107_43 #107:tell n145_0->n107_43 n20_2 #20:right n145_0->n20_2 n20_1 #20:left n145_0->n20_1 n145_1 #145:look_self n145_1->n145_0 n145_1->n107_43 n1_9 #1:look_self n145_1->n1_9 n20_27 #20:english_number n145_1->n20_27 n20_6 #20:english_list n145_1->n20_6 n145_3 #145:tree_tag n5_18 #5:tree_tag n145_3->n5_18 n145_5 #145:read n145_5->n145_1 n145_8 #145:validate n145_8->n107_43 n145_9 #145:recycle n45_26 #45:leaves_suspended n145_9->n45_26 n45_27 #45:branches_suspended n145_9->n45_27 n5_8 #5:recycle n145_9->n5_8

Source

tell_components

Spec this none thisFlags rxdOwner #29Definer #145

Referenced by

Source

1ing = ((args && (args[1] == "catalysts")) && this.catalysts) ? this.catalysts | this.ingredients;
2for ingredient in (ing)
3{ingredient, qty} = ingredient;
4n = (qty > 1) ? ingredient:plural_name() | ingredient:name();
5if (index(n, "generic"))
6n = strsub(n, "generic ", "");
7n = n + " (any kind)";
8endif
9if (is_a(ingredient, $liquid))
10player:tell($su:right(tostr(qty) + "u ", 5) + "of ", $su:left(ingredient:name(), 40));
11elseif (qty > 1)
12player:tell($su:right(tostr(qty), 5), " - ", $su:left(n, 40));
13else
14player:tell($su:right(tostr(qty), 5), " - ", $su:left(n, 40));
15endif
16endfor

look_self

Spec this none thisFlags rxdOwner #29Definer #145

Referenced by

Source

1pass(@args);
2if (valid(this.makes))
3m = (this.makes_count > 1) ? ($su:english_number(this.makes_count) + " ") + this.makes:plural_name() | this.makes:iname();
4player:tell("It tells you how to make ", m, " with the following components:");
5endif
6if (this.ingredients)
7this:tell_components();
8endif
9if (this.catalysts)
10player:tell("You will also need the following catalysts: ");
11this:tell_components("catalysts");
12endif
13ss = {};
14for x in (this.skill_required)
15skill = (typeof(x[1]) == OBJ) ? x[1].name | x[1];
16mod = x[2];
17if (mod < -10)
18m = "a complete mastery of";
19elseif (mod < -8)
20m = "massive expertise in";
21elseif (mod < -6)
22m = "serious expertise in";
23elseif (mod < -4)
24m = "expertise in";
25elseif (mod < -2)
26m = "good familiarity with";
27elseif (mod < 0)
28m = "decent familiarity with";
29elseif (mod < 2)
30m = "some familiarity with";
31else
32m = "a little knowledge of";
33endif
34s = (m + " ") + skill;
35ss = {@ss, s};
36endfor
37player:tell("Making this would take ", $su:english_list(ss), ".");
38if (valid(this.needs_bench))
39player:tell("You realize you'd have to make this on ", this.needs_bench:iname(), ".");
40endif
41if (valid(this.discoverer))
42player:tell((("In the upper right corner is a note: 'First discovered by " + this.doctor_msg) + this.discoverer.name) + ".'");
43endif

discovered_by

Spec this none thisFlags rxdOwner #361Definer #145

Referenced by

none

Source

1who = args[1];
2if (!is_a(this.discoverer, $creature))
3this.discoverer = who;
4endif

tree_tag

Spec this none thisFlags rxdOwner #29Definer #145

Referenced by

none

Source

1r = pass(@args);
2if (this.researchable == 0)
3r = r + (((("  " + $ansi.red) + $ansi.bold_on) + "!research") + $ansi.reset);
4endif
5return r;

ingredient_value

Spec this none thisFlags rxdOwner #361Definer #145

Referenced by

none

Source

1v = 0;
2for x in (this.ingredients)
3if (is_a(x[1], $thing))
4v = v + (x[1].value * x[2]);
5endif
6endfor
7return v;

read

Spec this none noneFlags rxdOwner #361Definer #145

Referenced by

none

Source

1this:look_self(player);

find_ingredients

Spec this none thisFlags rxdOwner #361Definer #145

Referenced by

none

Source

1"Return a list of items in 'where' this recipe will use to assemble.";
2"If a parent is not found, that parent is returned.";
3where = args[1];
4cand = where.contents;
5ingredients = {};
6for x in ({@this.ingredients, @this.catalysts})
7c = (typeof(x) == LIST) ? x[2] | 1;
8parent = (typeof(x) == LIST) ? x[1] | x;
9if (is_a(parent, $liquid))
10found = #-1;
11for y in (cand)
12yield;
13if (liq = y:occupants(parent))
14if (liq[1].accumulation >= c)
15found = liq[1];
16endif
17endif
18endfor
19if (!valid(found))
20return parent;
21endif
22ingredients = setadd(ingredients, found);
23else
24for y in [1..c]
25yield;
26found = #-1;
27for z in (cand)
28if ((!valid(found)) && is_a(z, parent))
29found = z;
30endif
31yield;
32endfor
33if (!valid(found))
34return parent;
35endif
36cand = setremove(cand, found);
37ingredients = setadd(ingredients, found);
38endfor
39endif
40yield;
41endfor
42return ingredients;

xp_value

Spec this none thisFlags rxdOwner #361Definer #145

Referenced by

none

Source

1":xp_value(OBJ who) => value in XP when crafted by 'who'.";
2who = args[1];
3if (!is_player(who))
4return 0;
5endif
6base = this.xp_award;
7curve = $rpg.recipe_xp_curve;
8xp_total = who.xp_total - who:quest_xp();
9xp_total = max(0, xp_total);
10if (xp_total > (xbase = base * curve))
11extra = xp_total - xbase;
12base = base - (extra / $rpg.recipe_xp_drop);
13endif
14return max(0, base);

validate

Spec this none thisFlags rxdOwner #361Definer #145

Referenced by

none

Source

1ni = {};
2for x in (this.ingredients)
3i = x[1];
4if (!is_a(i, #1))
5player:tell("FATAL: recycled ingredient");
6return;
7elseif (!i.f)
8player:tell("FIXING: ", i:dname(), " not fertile -- changing to parent");
9ni = {@ni, {parent(i), x[2]}};
10else
11ni = {@ni, x};
12endif
13endfor
14this.ingredients = ni;
15if (!valid(this.makes))
16player:tell("You forgot to set .makes to something!");
17elseif (!this.makes.f)
18player:tell(".makes is set to a non-fertile, you idiot.");
19endif
20player:tell("DONE");

recycle

Spec this none thisFlags rxdOwner #361Definer #145

Referenced by

none

Source

1if (this.f)
2for m in ($ou:leaves_suspended(#248098))
3m.known_recipes = setremove(m.known_recipes, this);
4endfor
5for cookbook in ($ou:branches_suspended($cookbook))
6if (is_a(this, cookbook.recipe_type))
7for x in ($ou:leaves_suspended(cookbook))
8x.pages = setremove(x.pages, this);
9yield;
10endfor
11endif
12endfor
13endif
14return pass(@args);

make_duration

Spec this none thisFlags rxdOwner #361Definer #145

Referenced by

none

Source

1parts = 0;
2for x in (this.ingredients)
3parts = parts + (x[2] * 3);
4endfor
5hard = 0;
6for x in (this.skill_required)
7hard = hard - (x[2] * 4);
8endfor
9d = (parts + hard) + 6;
10d = toint(tofloat(d) * this.time_mod);

random_ingredient

Spec this none thisFlags rxdOwner #361Definer #145

Referenced by

none

Source

1parts = this.ingredients;
2if (!parts)
3return #-1;
4endif
5part = parts[random($)][1];
6while ((part.f && (index(part.name, "generic ") == 1)) && (c = children(part)))
7part = c[random($)];
8endwhile
9return part;