generic RPG container #9338

Parent #2409Owner Flags Source rpg_march_2006/contain.txt

Aliases: generic RPG container

14 verbs · 15 properties · 2 children

Verbs

VerbSpecFlagsDefinerLines
encumbrancethis none this#933810
acceptablethis none this#93389
re*move ex*tract rec*over ge*t ta*keany from thisrxd#933829
look_selfthis none this#93384
transfer_allthis none this#933824
@opacitythis is any#93388
list_contentsthis none thisrx#933818
tell_contentsthis none thisrx#933810
set_opaquethis none this#933810
is_useful_forthis none this#93381
acceptable(obsolete)this none this#93387
transfer_fundsthis none this#93384
pu*t ins*ert st*ore ca*cheany in thisrxd#933839
put(old)this none thisrd#933833

Properties

PropertyDefinerFlagsOwnerValue
percent#9338r100
max#9338r0
accept_gem_payment#9338rc1
store_action#9338rc"stores"
nostash#9338rc{#27481}
manufactured#9338923451666
worth#9338-1
condition#9338100
odrop_failed_msg#9338"%<tries> to drop %t but fails!"
odrop_succeeded_msg#9338"%<drops> %t."
otake_succeeded_msg#9338"%<picks> up %t."
key#9338not readable (E_PERM)
aliases#9338{"generic RPG container"}
description#9338"A non-weapon, non-armour piece of equipment that an end user of the system (player) might use in a VR way."
object_size#9338{14157, 1141286561}

Ancestry

Ancestors (nearest first): #2409 LRPG Adventuring Gear#112297 Generic Dyable LRPG Thing#517 Generic LRPG Thing

Children: #2803 generic corpse, #43001 generic openable/closable RPG container

Call graph

calls n9338_0 #9338:encumbrance n9338_9 #9338:is_useful_for n9338_0->n9338_9 n9338_2 #9338:re*move n9338_4 #9338:transfer_all n9338_2->n9338_4 n517_32 #517:do_update n9338_2->n517_32 n9338_3 #9338:look_self n517_14 #517:look_self n9338_3->n517_14 n9338_7 #9338:tell_contents n9338_3->n9338_7 n9338_6 #9338:list_contents n9338_7->n9338_6 n9338_5 #9338:@opacity n9338_8 #9338:set_opaque n9338_5->n9338_8 n9338_12 #9338:pu*t n9338_12->n9338_4 n9338_12->n517_32 n9338_13 #9338:put(old) n9338_13->n9338_4 n9338_13->n517_32

Source

encumbrance

Spec this none thisDefiner #9338

Referenced by

none

Source

1".percent is amount of encumbrance offset by the container.";
2".max is the maximum amount of encumbrance that can be offset.";
3{?doll = $nothing} = args;
4load = this.encumbrance + $local.rpg:weight(this, doll);
5if (this:is_useful_for(this.location))
6  offset = ((percent = (load * this.percent) / 100) > this.max) ? this.max | percent;
7  return load - offset;
8else
9  return load;
10endif

acceptable

Spec this none thisDefiner #9338

Referenced by

Source

1"Hacked to allow kids of $thing (including $local.rpg.equipment) only.";
2{item} = args;
3if ((item == #63585) && (this == #101591))
4  return 1;
5endif
6if ($object_utils:isoneof(item, this.nostash))
7  return 0;
8endif
9return $local.rpg.object_db:is_thing(item);

re*move ex*tract rec*over ge*t ta*ke

Spec any from thisFlags rxdDefiner #9338

Referenced by

Source

1dobj = $match_utils:match(dobjstr, this.contents);
2if ((!(caller in {this, player, $match_utils})) && (!$local.rpg:trusted(caller_perms())))
3  player:tell("See Grand_Master about remote calls to this verb.");
4elseif (!(this.location in {player, player.location}))
5  player:tell("You don't have ", this.name, " with you.");
6elseif (!valid(doll = $local.rpg:get_doll(player)))
7  player:tell(this.name, " seems to have some sort of childproof lock.");
8elseif (doll:cannot_move(1))
9elseif (!($local.rpg:trusted_verb(this, "opened") ? this:opened() | this:is_unlocked_for(player)))
10  player:tell(this.name, " seems to be locked.");
11elseif (dobjstr in {"all", "everything"})
12  this:transfer_all(verb, this);
13elseif ($command_utils:object_match_failed(dobj, dobjstr))
14  return;
15elseif (dobj.location != this)
16  player:tell(this.name, " doesn't contain ", dobj.name, ".");
17elseif ((!$object_utils:isa(dobj, $local.rpg.equipment)) || dobj:ok_exchange(this, player))
18  dobjname = dobj.name;
19  dobj:moveto(player);
20  if (dobj.location == player)
21    player:tell("You remove ", dobjname, " from ", this.name, ".");
22    player.location:announce(player.name, " removes ", dobjname, " from ", this.name, ".");
23    this.last_action && this:do_update();
24    "doll:invite(doll.slowness / 2)";
25  else
26    player:tell("You can't seem to get ", dobjname, " out of ", this.name, ".");
27  endif
28endif
29"Quinn 01-AUG-93 0325: Hacked to handle 'all', and to check :ok_exchange.";

look_self

Spec this none thisDefiner #9338

Referenced by

Source

1pass(@args);
2this:tell_contents(this:contents());
3"Quinn 01-AUG-93 0219: Re-written, cleaned up; will eliminate improper calls to :contents after informing those who've programmed the verbs.";
4"Quinn 01-DEC-93 0219: oH screw it.  Just made a call to :tell_contents.  Let the tbks report the sorry folk who used :contents wrong.";

transfer_all

Spec this none thisDefiner #9338

Referenced by

Source

1":transfer_all(verb, from) -- Handle cache/retrieve 'all' or 'everything'.";
2"'verb' each object in the contents of 'from'.";
3(rpg = $local.rpg):secure();
4{xfer, from} = args;
5gms = rpg.gms;
6equipment = rpg.equipment;
7ou = $object_utils;
8if (contents = setremove(from.contents, this))
9  while (contents && (this.location in {player, player.location}))
10    if (((thing = contents[1]).owner in gms) && ou:isa(thing, equipment))
11      this:(xfer)(dobjstr = tostr(dobj = thing));
12    endif
13    rpg:s_i_n(0);
14    "if ((seconds_left() < 2) || (ticks_left() < 8000))";
15    "  rpg:stop_time(0);";
16    "endif";
17    contents = listdelete(contents, 1);
18  endwhile
19else
20  player:tell(from.name, " is empty", valid(rpg:get_doll(from)) ? "-handed." | ".");
21endif
22"Quinn 01-AUG-93 0326: Added.";
23"Quinn 09-AUG-93 0735: Changed to xfer RPG equipment only.";
24"THX 26-Oct-1997  -- Updated code to 1.8.0 and hacked to 'get' tostr(objnum) instead of object.name to avoid duplicity problems.  Also check for gm ownership to reduce :isa() calls.";

@opacity

Spec this is anyDefiner #9338

Referenced by

none

Source

1"Copied from generic container (#8):@opacity by Nosredna (#2487) Sat Jan 20 05:59:53 1996 PST";
2if (!$perm_utils:controls(player, this))
3  player:tell("Can't set opacity of something you don't own.");
4elseif ((iobjstr != "0") && (!tonum(iobjstr)))
5  player:tell("Opacity must be an integer (0, 1, 2).");
6else
7  player:tell("Opacity changed:  Now " + {"transparent.", "opaque.", "a black hole."}[1 + this:set_opaque(tonum(iobjstr))]);
8endif

list_contents

Spec this none thisFlags rxDefiner #9338

Referenced by

Source

1"Copied from Isagi's orb (#21327):list_contents by Isagi (#21077) Sat Jul 20 17:03:16 1996 PDT";
2item_list = args[1];
3temp = {};
4for item in (item_list)
5  temp = listappend(temp, item:title());
6endfor
7temp2 = {};
8for item in (temp)
9  number = length(temp) - length(temp = $list_utils:setremove_all(temp, item));
10  if (number == 1)
11    temp2 = listappend(temp2, item);
12  endif
13  if (number > 1)
14    temp2 = listappend(temp2, ($string_utils:english_number(number) + " ") + $local.rpg.user_utils.isagi:plural(substitute("%3", match(item, "%(%<%(a%|an%) +%)?%(.*%)"))));
15  endif
16endfor
17return temp2;
18"Profane (#30788) - Wed Mar 13, 2002 - strip indefinite article in titles for plural items";

tell_contents

Spec this none thisFlags rxDefiner #9338

Referenced by

Source

1"Copied from Isagi's orb (#21327):tell_contents by Isagi (#21077) Sat Jul 20 17:03:24 1996 PDT";
2if (contents = this:contents())
3  player:tell("Contents:");
4  su = $string_utils;
5  string = su:english_list(this:list_contents(contents));
6  string = su:capitalize(string) + ".";
7  player:tell(string);
8elseif (msg = this:empty_msg())
9  player:tell(msg);
10endif

set_opaque

Spec this none thisDefiner #9338

Referenced by

Source

1"Copied from generic container (#8):set_opaque by Nosredna (#2487) Mon Jul  7 19:41:01 1997 PDT";
2if (!$perm_utils:controls(caller.owner, this))
3  return E_PERM;
4elseif (typeof(number = args[1]) != INT)
5  return E_INVARG;
6else
7  number = (number < 0) ? 0 | ((number > 2) ? 2 | number);
8  this.dark = number > this.opened;
9  return this.opaque = number;
10endif

is_useful_for

Spec this none thisDefiner #9338

Referenced by

Source

1return 1;

acceptable(obsolete)

Spec this none thisDefiner #9338

Referenced by

none

Source

1"Hacked to allow kids of $thing (including $local.rpg.equipment) only.";
2if ((item == #63585) && (this == #101591))
3  return 1;
4endif
5{item} = args;
6return $local.rpg.object_db:is_thing(item);
7"return !(is_player(args[1]) || valid(#46:get_doll(args[1])));";

transfer_funds

Spec this none thisDefiner #9338

Referenced by

none

Source

1if (caller == this)
2  $local.rpg:log_error(tostr($string_utils:nn(this), "  Argstr: ", argstr, " ", $string_utils:nn($object_utils:locations(this)), " ", $string_utils:nn(player), " ", $string_utils:nn(player.location), " ", toliteral(callers(1))));
3endif
4return 0;

pu*t ins*ert st*ore ca*che

Spec any in thisFlags rxdDefiner #9338

Referenced by

Source

1if (!valid(dobj))
2  dobj = $match_utils:match(dobjstr, player.contents);
3  "dobj = player.location:match(dobjstr);";
4endif
5{str_u} = {$string_utils};
6if ((!(caller in {this, player, $match_utils})) && (!$local.rpg:trusted(caller_perms())))
7  player:tell("See Grand_Master about remote calls to this verb.");
8elseif ((this.location != player) && (this.location != player.location))
9  player:tell(str_u:pronoun_sub("You don't have %t with you."));
10elseif (!valid(doll = (rpg = $local.rpg):get_doll(player)))
11  player:tell(str_u:pronoun_sub("%T seems to have some sort of childproof lock."));
12elseif (doll:cannot_move(1))
13elseif (!this:is_unlocked_for(player))
14  player:tell(str_u:pronoun_sub("%T seems to be locked."));
15elseif (dobjstr in {"all", "everything"})
16  this:transfer_all(verb, player);
17elseif ($command_utils:object_match_failed(dobj, dobjstr))
18  return;
19elseif (dobj.location != player)
20  player:tell("You don't have that.");
21else
22  dobj_name = dobj.name;
23  dobj:moveto(this);
24  if (dobj.location == this)
25    fork (0)
26      rpg:say_action(("%N %<" + this.store_action) + "> %d in %t.");
27      if (rpg.object_db:is_money(dobj) || rpg.object_db:is_missile_ammo(dobj))
28        player:tell(str_u:pronoun_sub("%T now contains %d."));
29      endif
30    endfork
31    this.last_action && this:do_update();
32    "doll:invite(doll.slowness / 2)";
33  else
34    player:tell(str_u:pronoun_sub("You can't seem to fit %d into %t."));
35  endif
36endif
37"Quinn 01-AUG-93 0325: Hacked to handle 'all'.";
38"Hydros (#106189) - Sun Nov  27, 2004 - Changed to use $match_utils:match() instead of player.location:match() to allow for precise matching even when not in the RPG.";
39"Hydros (#106189) - Tue Mar 8, 2005 - Split the storing message into two parts: how much we put in, and how much we end up with total.";

put(old)

Spec this none thisFlags rdDefiner #9338

Referenced by

none

Source

1"Args used to be any in this";
2if (!valid(dobj))
3  dobj = $match_utils:match(dobjstr, player.contents);
4  "dobj = player.location:match(dobjstr);";
5endif
6if ((!(caller in {this, player, $match_utils})) && (!$local.rpg:trusted(caller_perms())))
7  player:tell("See Grand_Master about remote calls to this verb.");
8elseif ((this.location != player) && (this.location != player.location))
9  player:tell("You don't have ", this.name, " with you.");
10elseif (!valid(doll = $local.rpg:get_doll(player)))
11  player:tell(this.name, " seems to have some sort of childproof lock.");
12elseif (doll:cannot_move(1))
13elseif (!this:is_unlocked_for(player))
14  player:tell(this.name, " seems to be locked.");
15elseif (dobjstr in {"all", "everything"})
16  this:transfer_all(verb, player);
17elseif ($command_utils:object_match_failed(dobj, dobjstr))
18  return;
19elseif (dobj.location != player)
20  player:tell("You don't have that.");
21else
22  dobj:moveto(this);
23  if (dobj.location == this)
24    player:tell("You", this.store_action, " ", dobj.name, " in ", this.name, ".");
25    player.location:announce(player.name, this.store_action, "s ", dobj.name, " in ", this.name, ".");
26    this.last_action && this:do_update();
27    "doll:invite(doll.slowness / 2)";
28  else
29    player:tell("You can't seem to fit ", dobj.name, " into ", this.name, ".");
30  endif
31endif
32"Quinn 01-AUG-93 0325: Hacked to handle 'all'.";
33"Hydros (#106189) - Sun Nov  27, 2004 - Changed to use $match_utils:match() instead of player.location:match() to allow for precise matching even when not in the RPG.";