GM Equipment Dispenser #52766

Parent Owner Flags Source rpg_march_2006/grabber.txt

Aliases: GM Equipment Dispenser, GMED, Grabber, unlicensed particle accelerator

18 verbs · 10 properties · 0 children

Verbs

VerbSpecFlagsDefinerLines
rem*ove_dispensed remove_dispensesthis none this#5276612
add*_dispensed add_dispensesthis none this#5276615
may_editthis none this#527662
match_dispensedthis none this#527669
destroythis none this#527668
createthis none this#5276614
set_limitthis none this#527668
get_limitthis none this#527667
gem jewel pearlthis none this#5276652
g_m_grabthis none this#527665
distributorthis none this#5276631
add_dispensed(old)this none this#5276613
remove_dispensed(old)this none this#527669
set_distributorthis none this#527669
grab(old)this none this#5276626
request grabthis none this#5276624
grab_bulkthis none this#5276625
_grabthis none this#5276614

Properties

PropertyDefinerFlagsOwnerValue
dispenses#52766rc
value (1945 chars){#1247, #2138, #457, #20864, #20865, #283, #76, #155, #243, #1660, #331, #2231, #1454, #1394, #154, #3791, #159, #370, #3089, #4038, #8751, #10902, #20769, #20868, #4318, #8833, #8909, #9350, #21543, #20847, #43337, #38579, #38584, #40308, #40305, #5506, #47326, #20253, #52610, #58135, #58137, #42517, #21564, #4878, #53156, #51818, #64134, #11636, #45865, #22841, #52728, #60226, #60608, #69882, #52618, #1804, #28065, #16268, #11901, #60126, #26790, #60614, #37646, #73064, #38427, #60590, #58725, #4399, #84829, #978, #7439, #75686, #4100, #11312, #87471, #2895, #26994, #101305, #65042, #11332, #85875, #77953, #13557, #437, #79903, #99588, #93776, #65063, #2061, #66228, #66229, #13947, #22272, #22276, #13940, #13950, #13944, #35976, #14579, #87306, #8169, #56319, #77202, #14282, #55016, #51879, #16609, #77297, #1511, #3533, #3303, #104057, #1723, #1722, #1764, #1765, #1766, #1265, #7775, #1325, #1920, #99908, #1053, #3277, #9511, #99354, #35169, #1770, #7015, #5892, #69056, #67470, #97530, #22618, #5277, #75317, #7385, #1197, #1252, #114120, #2423, #6838, #4297, #9023, #3528, #3863, #5570, #1868, #5109, #5012, #7714, #9662, #7695, #8252, #6871, #2571, #7905, #6571, #8948, #88919, #54610, #101242, #84168, #40580, #5364, #1231, #90527, #1032, #7709, #58931, #587, #1219, #1320, #7911, #4110, #9714, #4432, #6894, #94008, #422, #7491, #7581, #4471, #9139, #21331, #44096, #5604, #1357, #90498, #90044, #6276, #19959, #63893, #116539, #115169, #102014, #99526, #34028, #114455, #3836, #63044, #5625, #8336, #2686, #3395, #27714, #9173, #1927, #22227, #2267, #77111, #73777, #1484, #1508, #14444, #1061, #1483, #1532, #10601, #117772, #118881, #118884, #118886, #77337, #115550, #70303, #77877, #108557, #89482, #77977, #9698, #76260, #53021, #11760, #73452, #103732, #72086, #90160, #8912, #32051, #121187, #10260, #38852, #15904, #16993, #2401, #8806, #3804, #24166, #96770, #119789, #55075, #107867, #9167, #5658, #57581, #60254}
vacuum#52766rc#10161
limit#52766rc
value (852 chars){0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, 99, 99, 0, 99, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 99, 99, 99, 0, 99, 0, 0, 0, 0, 0, 0, 0, 99, 0, 99, 0, 0, 0, 0, 0, 0, 0, 99, 150, 100, 49, 99, 0, 0, 0, 33, 99, 99, 125, 0, 0, 0, 0, 0, 0, 0, 80, 30, 35, 40, 50, 30, 0, 10, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 35, 0, 99, 99, 0, 0, 0, 0, 20, 0, 0, 0, 25, 0, 0, 0, 0, 0, 0, 25, 16, 16, 20, 0, 0, 0, 999, 20, 30, 99, 0, 99, 0, 0, 0, 6, 0, 99, 0, 0, 150, 0, 27, 25, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 55, 20, 20, 0, 6, 20, 0, 15, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 44, 0, 0, 0, 99, 0, 33, 7, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 15, 50, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 99, 100}
pearl_data#52766rc
value (625 chars){{"%color1", {"%color1", "pearl"}, "A %shape %luster pearl with a %color2 hue. It is %size."}, {{"%color1", "%color2"}, {0, "grey pearl", "light gray"}, {50, "white pearl", "pure white"}, {200, "gold pearl", "pale gold"}, {250, "green pearl", "delicate green"}, {300, "pink pearl", "pretty pink"}, {350, "blue pearl", "lovely blue"}, {400, "black pearl", "pure black"}}, {{"%size"}, {0, "very tiny"}, {60, "quite small"}, {120, "average sized"}, {220, "rather large"}}, {{"%luster"}, {0, "dull"}, {70, "shiny"}, {140, "brilliantly lustrous"}}, {{"%shape"}, {0, "malformed"}, {30, "slightly lumpy"}, {50, "perfectly round"}}}
gem_data#52766rc
value (1378 chars){{"%gem", {"%gem", "gem", "jewel"}, "A %size %color %comp. This %opaque gem %process."}, {{"%gem", "%opaque", "%color", "%comp"}, {0, "azurite", "translucent", "blue", "copper carbonate gemstone"}, {40, "amber", "transparent", "yellow", "fossil resin gemstone"}, {80, "onyx", "translucent", "black", "quartz gemstone"}, {120, "carnelian", "transparent", "red", "quartz gemstone"}, {160, "opal", "translucent", "white", "hydrated silicon dioxide gemstone"}, {200, "turquoise", "opaque", "green-blue", "cuprous aluminate gemstone"}, {240, "topaz", "translucent", "yellow", "aluminum silicate gemstone"}, {280, "jade", "translucent", "green", "nephrite or jadeite gemstone"}, {320, "amethyst", "transparent", "purple", "corundum"}, {360, "garnet", "transparent", "pomegranate-red", "crystalline silicate gemstone"}, {400, "aquamarine", "transparent", "blue-green", "beryl"}, {440, "emerald", "transparent", "green", "beryl"}, {500, "sapphire", "translucent", "deep-blue", "corundum"}, {560, "ruby", "translucent", "deep-red", "corundum"}, {620, "diamond", "transparent", "blueish", "crystalline carbon gemstone"}}, {{"%size"}, {0, "rather small"}, {120, "medium sized"}, {300, "high carat-weight"}}, {{"%process"}, {0, "is uncut"}, {80, "has been cleaned but is still uncut"}, {160, "has been roughly cut to maximize convex volume"}, {240, "has been expertly cut and polished."}}}
distributor#52766not readable (E_PERM)
key#52766not readable (E_PERM)
aliases#52766{"GM Equipment Dispenser", "GMED", "Grabber", "unlicensed particle accelerator"}
description#52766
value (208 chars)"A facility through which Gamemasters can grab weapons directly, without having to walk to the Academy each time they wish to arm a monster. Also a quick way to put non-traditional weapons into circulation."
object_size#52766{26666, 1141286561}

Ancestry

Ancestors (nearest first): none

Children: none

Call graph

calls n52766_0 #52766:rem*ove_dispensed n52766_2 #52766:may_edit n52766_0->n52766_2 n52766_1 #52766:add*_dispensed n52766_1->n52766_2 n52766_6 #52766:set_limit n52766_6->n52766_2 n52766_3 #52766:match_dispensed n52766_6->n52766_3 n52766_7 #52766:get_limit n52766_7->n52766_3 n52766_9 #52766:g_m_grab n52766_15 #52766:request n52766_9->n52766_15 n52766_15->n52766_3 n52766_16 #52766:grab_bulk n52766_15->n52766_16 n52766_17 #52766:_grab n52766_15->n52766_17 n52766_11 #52766:add_dispensed(old) n52766_11->n52766_2 n52766_12 #52766:remove_dispensed(old) n52766_12->n52766_2 n52766_13 #52766:set_distributor n52766_13->n52766_2 n52766_13->n52766_3 n52766_14 #52766:grab(old) n52766_14->n52766_3 n52766_5 #52766:create n52766_14->n52766_5 n52766_16->n52766_3 n52766_16->n52766_17 n52766_17->n52766_5

Source

rem*ove_dispensed remove_dispenses

Spec this none thisDefiner #52766

Referenced by

none

Source

1":rem_dispensed(OBJ parent_object) -- Removes the object from this.dispenses, so that it's kids are no longer available for grabbing.";
2{item} = args;
3if (l = item in this.dispenses)
4  if (!(this:may_edit(caller_perms()) || (item.owner == caller_perms())))
5    return E_PERM;
6  else
7    this.dispenses = listdelete(this.dispenses, l);
8    this.limit = listdelete(this.limit, l);
9    this.distributor = listdelete(this.distributor, l);
10  endif
11endif
12"Profane (#30788) - Fri Feb 15, 2002 - let gms remove their own crap";

add*_dispensed add_dispenses

Spec this none thisDefiner #52766

Referenced by

none

Source

1":add_dispensed(OBJ parent_object, [NUM limit, [OBJ distributor_object]]) -- Adds the object to this.dispenses, making its children available for grabbing.";
2"Limit defaults to 0 (no limit), and limits the total number of objects that may be grabbed.";
3{what, ?limit = 0, ?distributor = $nothing} = args;
4if (!this:may_edit(caller_perms()))
5  return E_PERM;
6else
7  if (valid(thing = toobj(what)))
8    if (!(thing in this.dispenses))
9      this.dispenses = listappend(this.dispenses, thing);
10      this.limit = listappend(this.limit, limit);
11      this.distributor = listappend(this.distributor, distributor);
12    endif
13  endif
14  return thing in this.dispenses;
15endif

may_edit

Spec this none thisDefiner #52766

Referenced by

Source

1":may_edit(OBJ caller_perms) => True if given player can modify properties on this object.";
2return $local.rpg:is_grandmaster(args[1]);

match_dispensed

Spec this none thisDefiner #52766

Referenced by

Source

1":match_dispensed(STR|OBJ what)";
2available = this.dispenses;
3if (typeof(target = args[1]) == OBJ)
4  return (target in available) ? target | ((parent(target) in available) ? parent(target) | $failed_match);
5elseif (possibles = $match_utils:match_list(target, available))
6  return possibles[1];
7else
8  return $failed_match;
9endif

destroy

Spec this none thisDefiner #52766

Referenced by

none

Source

1":destroy(equipment) => result -- Destroys killable RPG equipment.";
2if (!$local.rpg:trusted(caller_perms()))
3  return E_PERM;
4elseif (!this.vacuum:killable(args[1]))
5  return E_NACC;
6else
7  return $local.rpg.recycler:_recycle(@args);
8endif

create

Spec this none thisDefiner #52766

Referenced by

Source

1":create(item) => A kid of given item.  Calls :make_fertile just in case.";
2{what, @extra} = args;
3if (caller != this)
4  return E_PERM;
5else
6  rpg = $local.rpg;
7  if (what.owner != this.owner)
8    `what:make_fertile() ! ANY';
9  endif
10  r = rpg.recycler:_create(@args);
11  `what:make_fertile(1) ! ANY';
12  return r;
13endif
14"Mooshie (#106469) - Mon Nov 17 06:35:34 1997 PST - Updated a bit, and added the new :make_fertile patch.";

set_limit

Spec this none thisDefiner #52766

Referenced by

none

Source

1":set_limit(OBJ dispensed object, NUM limit) -- sets how many TOTAL of a certain item may be grabbed via the grabber.";
2if (!this:may_edit(caller_perms()))
3  return E_PERM;
4elseif (!$recycler:valid(what = this:match_dispensed(args[1])))
5  return E_INVARG;
6else
7  return this.limit[what in this.dispenses] = tonum(args[2]);
8endif

get_limit

Spec this none thisDefiner #52766

Referenced by

none

Source

1":get_limit(OBJ thing) => NUM number of things allowed to be created.";
2if ((!args) || (!valid(what = this:match_dispensed(args[1]))))
3  return E_INVARG;
4else
5  l = this.limit[what in this.dispenses];
6  return (l == 0) ? $maxint | l;
7endif

gem jewel pearl

Spec this none thisDefiner #52766

Referenced by

none

Source

1"(verb)(<value>, <towhere>) => random pearl, with value <value> goes <towhere>";
2"The following data structure for 'info', or the default gem/pearl data structures would allow creation of any other generic gems we should want or anything else, for that matter.";
3"{{<name>, <aliases>, <desc>}, [{{[<sub for>]*}, [{<min>, [<sub in>]*}]*}]*}";
4"<name> == STR, name of item, potentially with one or more possible subs in it.";
5"<aliases> == LIST of STR, aliases, possibly with subs.";
6"<desc> == STR, description, with subs if any.";
7"A LIST of zero or more sub descriptions, each of which consists of the following:";
8"    [<sub for>]* == One or more STR to replace in the above";
9"    A list of one or more of the following:";
10"    <min> == INT, minimum value for the sub in to show.";
11"    [<sub in>]* == A number of STR equal to the length of <sub for>.  These will replace instances of <sub for> if <min> is greater than the unallocated value of the gem.";
12"Example:  {{\"%color gem\", {\"%color gem\", \"gem\"}, \"A gem.  It is %color.\"}, {{\"%color\"}, {0, \"blue\"}, {100, \"red\"}, {200, \"green\"}}}";
13"Obviously, to create a more interesting gem, you'd need a more complicated data structure.  See the default gem and pearl structures for better examples.";
14rpg = $local.rpg;
15$local.rpg:secure();
16{value, ?dest = caller, ?info = 0, ?jewel = rpg.gem, ?jewel_maker = rpg.gem_dispenser} = args;
17{stuff, @data} = info ? info | this.((verb == "pearl") ? "pearl_data" | "gem_data");
18{name, aliases, desc} = stuff;
19desc = $list_utils:random_element(desc) || desc;
20total = value;
21sub_list = {};
22for item in (data)
23  {sub_words, @choices} = item;
24  r = random(total);
25  total = max(total - r, 1);
26  high = 0;
27  for choice in (choices)
28    {v, @words} = choice;
29    if (v < r)
30      high = words;
31    endif
32  endfor
33  if (high)
34    for sub in (sub_words)
35      {d, @high} = high;
36      sub_list = listappend(sub_list, {sub, d});
37    endfor
38  endif
39endfor
40for sub in (sub_list)
41  {sub_for, sub_in} = sub;
42  name = strsub(name, sub_for, sub_in);
43  newaliases = {};
44  for alias in (aliases)
45    newaliases = setadd(newaliases, strsub(alias, sub_for, sub_in));
46  endfor
47  aliases = newaliases;
48  desc = strsub(desc, sub_for, sub_in);
49endfor
50value = ((value > 999) && (dest in rpg.vacuum.monsters)) ? random(value) | value;
51return jewel_maker:grab_gem(dest, value, name, aliases, desc);
52"THX (#105941) - Sun Apr 29, 2001 - Put a soft limit on the value of gemstones created on critters.  If the requested value exceeds 1000 gold (!) then random(value) is used instead.";

g_m_grab

Spec this none thisDefiner #52766

Referenced by

none

Source

1if (caller_perms() in $local.rpg.grand_masters)
2  return this:grab(@args);
3else
4  return E_PERM;
5endif

distributor

Spec this none thisDefiner #52766

Referenced by

none

Source

1{item} = args;
2(rpg = $local.rpg):secure();
3keeps = {};
4{NSK, Moriah} = rpg.object_db.shopkeeper;
5if (indx = item in this.dispenses)
6  valid(t = this.distributor[indx]) && (keeps = {t});
7endif
8for t in (children(rpg.object_db.OBJ_dispenser[1]))
9  if ((item in t.dispenses) && valid(t.location))
10    keeps = setadd(keeps, t);
11  endif
12endfor
13for t in (children(NSK))
14  things = {};
15  for s in (t.inventory_items)
16    (typeof(s) == LIST) || (things = setadd(things, s));
17  endfor
18  if (item in things)
19    keeps = setadd(keeps, t);
20  endif
21endfor
22for t in (children(Moriah))
23  if (item in $list_utils:slice(t.inventory, 1))
24    keeps = setadd(keeps, t);
25  endif
26endfor
27for t in (rpg.vacuum.monsters)
28  (item in t.generic_equipment) && (keeps = setadd(keeps, t));
29endfor
30valid(caller) || player:tell($string_utils:nn(item), " is distributed by: ", $string_utils:nn(keeps));
31return {item, keeps};

add_dispensed(old)

Spec this none thisDefiner #52766

Referenced by

none

Source

1":add_dispensed(OBJ parent_object, [NUM limit]) -- Adds the object to this.dispenses, making its children available for grabbing.";
2"Limit defaults to 0 (no limit), and limits the total number of objects that may be grabbed.";
3if (!this:may_edit(caller_perms()))
4  return E_PERM;
5else
6  if (valid(thing = toobj(args[1])))
7    if (!(thing in this.dispenses))
8      this.dispenses = listappend(this.dispenses, thing);
9      this.limit = listappend(this.limit, (length(args) > 1) ? args[2] | 0);
10    endif
11  endif
12  return thing in this.dispenses;
13endif

remove_dispensed(old)

Spec this none thisDefiner #52766

Referenced by

none

Source

1":rem_dispensed(OBJ parent_object) -- Removes the object from this.dispenses, so that it's kids are no longer available for grabbing.";
2if (!this:may_edit(caller_perms()))
3  return E_PERM;
4else
5  for item in (args)
6    this.dispenses = listdelete(this.dispenses, l = item in this.dispenses);
7    this.limit = listdelete(this.limit, l);
8  endfor
9endif

set_distributor

Spec this none thisDefiner #52766

Referenced by

none

Source

1":set_distributor(OBJ dispensed object, OBJ distributor) -- sets an OBJ set as the distributor of the dispensed object for bookkeeping purposes.";
2{item, distributor} = args;
3if (!this:may_edit(caller_perms()))
4  return E_PERM;
5elseif ((typeof(distributor) != OBJ) || (!$recycler:valid(what = this:match_dispensed(item))))
6  return E_INVARG;
7else
8  return this.distributor[what in this.dispenses] = distributor;
9endif

grab(old)

Spec this none thisDefiner #52766

Referenced by

none

Source

1":grab(STR|OBJ parent[, OBJ recipient]) -- Grabs a weapon/armour with the given parent (as object or name), and moves it to `recipient' (which defaults to caller).";
2" => E_PERM if a non-GM calls the verb";
3" => $failed_match if the given object is not available";
4" => $ambiguous_match if an ambiguous string-reference is given";
5" => object number of item found if the `grab' was successful.";
6(rpg = $local.rpg):secure();
7{what, ?where = valid(caller) ? caller | caller_perms()} = args;
8what = this:match_dispensed(what);
9if ((!valid(what)) || (parent(what) == $garbage))
10  return what;
11elseif (`caller.owner != rpg.owner ! ANY' && (limit = this.limit[what in this.dispenses]))
12  if (length(children(what)) >= limit)
13    return E_QUOTA;
14  endif
15endif
16new = this:create(what, @listdelete(args, 1));
17if (valid(new) && (parent(new) != $garbage))
18  new.name = what.name;
19  new.aliases = what.aliases;
20  what.unique && (new.unique = 0);
21  new:moveto(where);
22endif
23return new;
24"StarDancer 19-NOV-95 -- Dispenser will no longer produce unique items.";
25"Profane 19-APR-96 2232EST -- Added support for limiting # of items.";
26"THX1138 30-Nov-1997  -- Ok, hacked this so that the dispenser limits don't apply to Grand_Master Emself.  Primary Reason: The academy gives out some items when players train there ... some are limited.  G_M should be exempted.";

request grab

Spec this none thisDefiner #52766

Referenced by

Source

1":grab(STR|OBJ parent[, OBJ recipient, NUM bulk]) -- Grabs a weapon/armour with the given parent (as object or name), and moves it to `recipient' (which defaults to caller). If `bulk' is supplied, it creates and moves that many copies.";
2" => E_PERM if a non-GM calls the verb";
3" => $failed_match if the given object is not available";
4" => $ambiguous_match if an ambiguous string-reference is given";
5" => object number of item found if the `grab' was successful.";
6(rpg = $local.rpg):secure();
7{what, ?where = valid(caller) ? caller | caller_perms(), ?bulk = 0} = args;
8if (bulk)
9  return this:grab_bulk(what, where, bulk);
10endif
11what = this:match_dispensed(what);
12if ((!valid(what)) || (parent(what) == $garbage))
13  return what;
14elseif (`caller.owner != rpg.owner ! ANY' && (limit = this.limit[what in this.dispenses]))
15  if (length(children(what)) >= limit)
16    return E_QUOTA;
17  endif
18endif
19return this:_grab(what, where);
20"StarDancer 19-NOV-95 -- Dispenser will no longer produce unique items.";
21"Profane 19-APR-96 2232EST -- Added support for limiting # of items.";
22"THX1138 30-Nov-1997  -- Ok, hacked this so that the dispenser limits don't apply to Grand_Master Emself.  Primary Reason: The academy gives out some items when players train there ... some are limited.  G_M should be exempted.";
23"Hydros (#106189) - Tues June 29, 2005 - Rewritten, adding a call to this:grab_bulk() to make shopkeeps quicker. Old code moved to this:grab(old).";
24"                                      - Moved the grunt work of the verb to the newly defined :_grab(), for use with both this and :grab_bulk().";

grab_bulk

Spec this none thisDefiner #52766

Referenced by

Source

1"Called from this:grab().  Grabs several copies of an item at once, with a limit of 50.";
2(rpg = $local.rpg):secure();
3{what, where, bulk} = args;
4what = this:match_dispensed(what);
5newlist = {};
6if ((!valid(what)) || (parent(what) == $garbage))
7  return what;
8elseif (typeof(bulk) != NUM)
9  return E_TYPE;
10elseif (bulk > 25)
11  raise(E_QUOTA, "Be responsible.  That's too many objects.");
12elseif (bulk < 0)
13  raise(E_QUOTA, "Nothing less than zero, thanks.");
14elseif (`caller.owner != rpg.owner ! ANY' && (limit = this.limit[what in this.dispenses]))
15  if ((length(children(what)) >= limit) || ((length(children(what)) + bulk) > limit))
16    return E_QUOTA;
17  endif
18endif
19for x in [1..bulk]
20  rpg:s_i_n();
21  new = this:_grab(what, where);
22  newlist = setadd(newlist, new);
23endfor
24return newlist;
25"Hydros (#106189) - Tues June 29, 2005 - Added to make shopkeeps quicker.";

_grab

Spec this none thisDefiner #52766

Referenced by

Source

1"The grunt work of :grab and :grab_bulk.";
2if ((callers()[1][1] == this) && (callers()[1][2] in {"request", "grab", "grab_bulk"}))
3  $local.rpg:secure();
4  {what, where} = args;
5  new = this:create(@args);
6  if (valid(new) && (parent(new) != $garbage))
7    new.name = what.name;
8    new.aliases = what.aliases;
9    what.unique && (new.unique = 0);
10    new:moveto(where);
11  endif
12  return new;
13endif
14"Hydros (#106189) - Tues June 29, 2005 - Added to handle the grunt work for :grab and :grab_bulk, the only verbs that can call this.";