"A dump of #517 on Sun Dec 17 12:57:58 1995 PST @create $thing named Generic LRPG Thing:Generic LRPG Thing,thing @prop #517."unique" 0 rc @prop #517."encumbrance" 0 rc @prop #517."manufactured" 743932381 r @prop #517."user_settable_messages" {} rc ;;#517.("user_settable_messages") = {"bully"} @prop #517."worth" 0 r @prop #517."keep_at_death" 0 r @prop #517."condition" E_NONE r @prop #517."claimed_by" #-1 r ;;#517.("odrop_failed_msg") = "% to drop %t but fails!" ;;#517.("odrop_succeeded_msg") = "% %t." ;;#517.("otake_succeeded_msg") = "% up %t." ;;#517.("key") = 0 ;;#517.("aliases") = {"Generic LRPG Thing", "thing"} ;;#517.("description") = "A tangible object for use in the LambdaMOO RPG." ;;#517.("object_size") = {24591, 819192257} @verb #517:"gi*ve ha*nd" this to any rxd @program #517:give "give -- Special RPG give makes sure the exchange is allowed."; if ((iobj == $nothing) || (iobj == $failed_match)) player:tell("Who do you want to give it to?"); elseif (iobj == $ambiguous_match) player:tell("I don't know which '", iobjstr, "' you mean."); elseif (this.location != player) player:tell("You don't have that!"); elseif (iobj.location != player.location) player:tell("I don't see that person here."); elseif (!iobj:acceptable(dobj)) player:tell(iobj.name, " does not want that item."); elseif (this:ok_exchange(player, iobj)) this:moveto(iobj); if (this.location == iobj) player:tell("You hand ", this.name, " to ", iobj.name, "."); iobj:tell(player.name, " hands you ", this.name, "."); player:room_announce_all_but({player, iobj}, player:title(), " hands ", this:title(), " to ", iobj:title(), "."); else player:tell("You can't give ", this:title(), " to ", iobj.name, "."); endif endif . @verb #517:"stat*istics" this none none r @program #517:statistics if ($local.rpg:trust()) a = listinsert($object_utils:ancestors(this), this); a = a[1..#517 in a]; for y in (a) if ((y.owner == #517.owner) || y.r) for z in (properties(y)) player:tell($string_utils:left(z, 20), $string_utils:from_value(this.(z ))); endfor endif endfor else player:tell("No permission to examine ", this.name, "."); endif . @verb #517:"encumbrance" this none this @program #517:encumbrance return this.encumbrance; . @verb #517:"get_value" this none this @program #517:get_value if ($local.rpg:trust()) return this.(args[1]); else return E_PERM; endif . @verb #517:"set_value(old)" this none this @program #517:set_value(old) if ((caller_perms() in {this.owner, #517.owner}) && $local.rpg:trust()) prop = args[1]; old = this.(prop); new = args[2]; des = (length(args) > 2) && args[3]; this.(prop) = new; n = {this}; if (des) for k in ($object_utils:descendants(this)) if (k.(prop) == old) k.(prop) = new; n = listappend(n, k); endif endfor endif return n; else return E_PERM; endif . @verb #517:"make_readable" this none this @program #517:make_readable "Temporarily makes a piece of adventure gear readable. Should be used thus: foo:make_readable(); bar=create(foo);"; if ($local.rpg:trust() && (this.owner == #517.owner)) if (!this.r) this.r = 1; fork (0) this.r = 0; endfork endif endif . @verb #517:"location" this none this @program #517:location return this.location; . @verb #517:"make_fertile" this none this @program #517:make_fertile ":make_fertile() -- Temporarily toggles the 'f' bit, allowing GMs (and not builders in general) to create a child of adventure gear. To be used as follows:"; ";;#equipment:make_fertile();return player:_create(#equipment)"; "Where '#equipment' is the number of the object you're wanting to create. The blank object returned will be your child. Congratulations, Mommy."; if ($local.rpg:trusted(caller_perms())) if (!this.f) this.f = 1; fork (0) this.f = 0; endfork endif return this.f; endif "Quinn 09-JUL-93 0343: Changed :trust call to :trusted(caller_perms()); Updated comment lines; eliminated check for ownership in first 'if'. Let it crash if a kid not owned by GM uses the parent; Now returns status of f-bit."; . @verb #517:"set_value" this none this @program #517:set_value ":set_value(STR property_name, value) -- Sets this.(property_name) to `value'"; db = $local.rpg; if ((caller_perms() in {this.owner, db.thing.owner}) && db:trust()) this.(args[1]) = args[2]; "...old code deleted, obsolete with clear_properties..."; "...i don't really see the point in returning {this}..."; "...but for backwards compatiblity (Quinn 05-JAN-93)..."; return {this}; else return E_PERM; endif . @verb #517:"moveto" this none this @program #517:moveto db = $local.rpg; dest = args[1]; doll = db:get_doll(place = this.location); if ((valid(dest) && (valid(doll) && (dest.location == place))) && (!(dest.owner in db.gms))) return E_PERM; elseif ((!valid(place = this.location)) || (!valid(dest))) ok = db:trust(); elseif (place.location in {dest, dest.location}) ok = db:trust(place.owner, place); elseif (place == dest.location) ok = db:trust(dest); else ok = db:trust(); endif if (!ok) return E_PERM; endif pass(dest); if (place != this.location) if (valid(doll)) doll.wielding = setremove(doll.wielding, this); doll.wearing = setremove(doll.wearing, this); endif for location in ({place, this.location}) where = location; while (where != $nothing) if (valid(doll = db:get_doll(where))) doll.weight = $nothing; endif where = where.location; endwhile endfor endif "Quinn 31-JUL-93 0636: Crushed two repetitive while-loops into one for-loop."; "Quinn 11-AUG-93 1733: Added check to prevent puppets 'porting into characters and stealing their equipment/cash."; . @verb #517:"recycle" this none this rx @program #517:recycle "Added to remove invalid equipment from wielding/wearing. Quinn (02-MAR-93)"; if ((caller != this) && (!$perm_utils:controls(caller_perms(), this))) return E_PERM; endif if (valid(doll = $local.rpg:get_doll(this.location))) doll.wielding = setremove(doll.wielding, this); doll.wearing = setremove(doll.wearing, this); endif who = this:claimed_by(); if (valid(who)) this:unclaim_for(who); endif return pass(@args); . @verb #517:"initialize" this none this @program #517:initialize if ((caller == this) || $perm_utils:controls(caller_perms(), this)) pass(@args); this:set_name(parent(this).name); this:set_aliases(parent(this).aliases); this.manufactured = time(); this.claimed_by = #-1; $quota_utils:object_bytes(this); else return E_PERM; endif "Quinn 11-MAR-93 xxxx-ET: Hacked to install default names/aliases of the parent, helpful for GMs who must create from eval. "; "Quinn 29-JUL-93 0136-ET: Manufactured stamp added to aid in determining weapon depreciation in the form of rust, dullness."; "Quinn 16-DEC-93 1300-ET: $quota_utils:object_size."; "Slither 2-June-95 Added initialization of .claimed_by"; . @verb #517:"moveto(old)" this none this @program #517:moveto(old) where = args[1]; if (!valid(place = this.location)) ok = $local.rpg:trust(); elseif (!valid(where)) ok = $local.rpg:trust(); elseif (place.location in {where, where.location}) ok = $local.rpg:trust(place.owner, place); elseif (place == where.location) ok = $local.rpg:trust(where); "ok = 1;"; else ok = $local.rpg:trust(); endif if (ok) pass(@args); if (place != this.location) if (valid(doll = $local.rpg:get_doll(place))) doll.wielding = setremove(doll.wielding, this); doll.wearing = setremove(doll.wearing, this); endif where = place; while (where != $nothing) if (valid(doll = $local.rpg:get_doll(where))) doll.weight = $nothing; endif where = where.location; endwhile where = this.location; while (where != $nothing) if (valid(doll = $local.rpg:get_doll(where))) doll.weight = $nothing; endif where = where.location; endwhile endif else return E_PERM; endif . @verb #517:"set_message" this none this @program #517:set_message ":set_message(msgname, newvalue)"; "Allow adventurers to set certain messages on their equipment."; msgname = args[1]; who = caller_perms(); if ((caller == this) || $perm_utils:controls(who, this)) "... No questions asked."; return pass(@args); elseif (!(msgname in (settable = this.user_settable_messages))) return tostr("Sorry, but you aren't allowed to set that message. You may set the following: ", $string_utils:english_list(settable), "."); elseif (this.unique || children(this)) return tostr($string_utils:nn(this), " is a unique artifact! It'd be a crime to alter it."); elseif (this.location != who) "... Only allow em to set the message if e's holding the item."; return tostr("You must be holding ", this:title(), " in order to set its messages."); elseif (args[2]) return pass(@args); else "... If empty string, we'll clear the message. Note this will crash if Grand_Master doesn't own the property. Temp until I petition for a clearing protocol in $root_class:set_message."; clear_property(this, msgname + "_msg"); return 0; endif "Quinn 31-JUL-93 0244-ET: Added to facilitate customisation by players."; . @verb #517:"ok_exchange" this none this @program #517:ok_exchange ":ok_exchange(origin, destination)"; "Is it okay to move this from 'origin' to 'destination'?"; "Usually called from thing:give and :get."; db = $local.rpg; origin = args[1]; dest = args[2]; if (!db:trusted(caller_perms())) return E_PERM; elseif (!valid(origin)) player:tell("I don't understand that."); return 0; elseif (valid(doll = db:get_doll(dest))) "... Although we can hack the :get verb, we cannot hack the :give, so may as well put the check here. (and :tell, since we can't leave it a mystery why the object didn't move)"; if (!is_player(who = doll.character)) "... Don't bother checking monsters? The problem is that they can't think freely, and thus adjust their inventory. Incongruous, yes; but necessary for the time being. Auto-adjustment would mean extra code, extra ticks, and extra hassle."; elseif ((!doll:hands_free()) && (length(doll.wielding) < doll.hands)) "Allow players wielding 2-handed weapons to use 1 hand to pick things up."; if (player == who) player:tell(tostr("You juggle your inventory in vain, unable to pick up ", this.name, ". Try emptying your hands.")); else player:tell(tostr("Sorry, but ", who.name, " has ", who.pp, " hands full.")); who:tell(tostr(player.name, " tries to give you ", this.name, " but your hands are full.")); endif return 0; elseif ((0 && (!(player in $object_utils:contains(player, this)))) && (doll:encumbrance() > 10)) "... Removed for now because of very high tick usage and unprofitable reality margin."; "... Too encumbered to carry anything more."; if (player == who) player:tell(tostr("You try to pick up ", this.name, " but the load is too great. Try dropping something.")); else player:tell(tostr("Sorry, but ", who.name, " is carrying too much already.")); who:tell(tostr(player.name, " tries to give you ", this.name, " but you can't bear the extra burden.")); endif return 0; endif "Quinn 29-JUL-93 0134-ET: Added to :moveto()."; "Quinn 31-JUL-93 2210-ET: Code removed from :moveto(), placed in this verb, called by :give and :get."; endif return 1; . @verb #517:"give(old)" this to any rxd @program #517:give(old) if ((iobj == $nothing) || (iobj == $failed_match)) player:tell("Who do you want to give it to?"); elseif (iobj == $ambiguous_match) player:tell("I don't know which '", iobjstr, "' you mean."); elseif (this.location != player) player:tell("You don't have that!"); elseif (iobj.location != player.location) player:tell("I don't see that person here."); elseif (!iobj:accept(dobj)) player:tell(iobj.name, " does not want that item."); else this:moveto(iobj); if (this.location == iobj) player:tell("You hand ", this.name, " to ", iobj.name, "."); iobj:tell(player.name, " hands you ", this.name, "."); else player:tell("You find ", this:title(), " back in your hands again."); endif endif . @verb #517:"g*et t*ake" this none none rxd @program #517:get "get/take -- Special RPG get/take makes sure the exchange is allowed."; if (this.location == player) player:tell("You already have that!"); elseif ((!valid(this.location)) || (this.location != player.location)) player:tell("I don't see that here."); elseif (this:ok_exchange(this.location, player)) this:moveto(player); if (this.location == player) player:tell(this:take_succeeded_msg() || tostr("You take ", this.name, ".")); if (msg = this:otake_succeeded_msg()) player.location:announce(player.name, " ", msg); endif else player:tell(this:take_failed_msg() || "You can't pick that up."); if (msg = this:otake_failed_msg()) player.location:announce(player.name, " ", msg); endif endif endif "Profane 12-1-95 1216EST Added Validity check line 4"; . @verb #517:"worth" this none this @program #517:worth ":worth() => The worth of this item in the lowest possible monetary unit, which on LambdaMOO is copper (a penny)."; return this.worth; "Quinn 22-AUG-93 1751: Verb and property Added."; . @verb #517:"condition" this none this @program #517:condition ":condition() => Return the condition of this object as a percentage of its original 'potency'. Defaults to 100%. Leave it to the owner/programmer to hack depreciation."; "Probably used most often for purposes of approximating worth. A basic equation for this would be:"; " worth = item:worth() * item:condition() / 100"; "Provided in consideration of all the math-morons out there. (Like me!)"; return this.condition; "Quinn 22-AUG-93 1751: Added."; "Quinn 30-NOV-93 0429: Return .condition instead of the default 100."; . @verb #517:"keep_at_death" this none this @program #517:keep_at_death ":keep_at_death([killer])"; "False if the item be dropped at death."; "True if it is a 'natural' weapon, or otherwise shouldn't be left as loot."; "The killer is sent, if eir identity is known."; return this.keep_at_death; . @verb #517:"tell_condition" this none this @program #517:tell_condition ":tell_condition([condition]) -- Tell player the condition of this item."; c = args ? args[1] | this:condition(); if (typeof(c) != NUM) return; endif if (c > 99) player:tell("It is practically new."); elseif (c > 90) player:tell("It is in excellent shape."); elseif (c > 80) player:tell("It is in very good condition."); elseif (c > 60) player:tell("It is in pretty good shape."); elseif (c > 40) player:tell("It isn't in terrible shape, but shows obvious signs of wear."); elseif (c > 25) player:tell("It has seen quite a lot of use, and it shows."); elseif (c > 15) player:tell("It's old and neglected and in pretty bad shape."); else player:tell("It's in really bad shape, but you might be able to sell it for scrap."); endif "Quinn 01-DEC-93 0230: Provided for condition being non-numeric, in which case nothing is printed."; . @verb #517:"look_self" this none this @program #517:look_self ":look_self() -- Show condition of an RPG item."; pass(@args); this:tell_condition(); if (valid(who = this:claimed_by())) player:tell(((who:titlec() + " has scratched ") + who.pp) + " crude insignia onto the object."); endif . @verb #517:"hide_from_look_gear" this none this @program #517:hide_from_look_gear ":hide_from_look_gear(doll)"; "Return true if this equipment (when used by the given voodoo doll's character) should not show up in :look_gear displays."; return 0; . @verb #517:"look_gear_msg" this none this @program #517:look_gear_msg ":look_gear_msg(doll)"; "A special message to be displayed in the :look_gear output when this equipment is being used by the given voodoo doll's character."; "Should be a string which, if given, will be the only mention of the item in the :look_gear display."; . @verb #517:"claimed_by" this none this rx @program #517:claimed_by ":claimed_by()"; "Return who claims this object. If the property contains a player who no longer has an RPG doll, then return $nothing."; if (valid(who = this.claimed_by)) if (valid(doll = $local.rpg:get_doll(who))) "if (!(this in doll:claimed_objects()))"; "if (doll:add_claimed_object(this) == E_QUOTA)"; "this.claimed_by = $nothing;"; "endif"; "endif"; else this.claimed_by = $nothing; endif endif return this.claimed_by; "Profane 11-APR-95 23:38EST - Rewrote. Add objects to doll's list if they somehow aren't on 'em."; "Slither 6/7/95 -- commented out code to add object to doll's list."; " There shouldn't be any such leaks, and if there is, I want to know!"; . @verb #517:"claim_for" this none this @program #517:claim_for ":claim_for(who[, ignore_quota])"; "-> E_PERM, caller is not a GM."; "-> E_NONE, this is already claimed by given person."; "-> E_NACC, claimed by someone else who won't let it go."; "-> E_INVARG, who is not illuminated."; "If ignore_quota is given and true, the E_QUOTA condition will not occur."; "-> E_QUOTA, who has claimed eir max amount of objects."; who = args[1]; rpg = $local.rpg; if (!rpg:trusted(caller_perms())) return E_PERM; elseif (valid(old = this:claimed_by())) if (old == who) return E_NONE; else this:unclaim_for(old); endif endif if (valid(this:claimed_by())) return E_NACC; elseif (!valid(doll = rpg:get_doll(who))) return E_INVARG; endif ignore_quota = (length(args) > 1) && args[2]; if (!(result = doll:add_claimed_object(this, ignore_quota))) return result; else this.claimed_by = who; return 1; endif . @verb #517:"claim" this none none rxd @program #517:claim "claim "; "Claim this item as your own, preventing it from being swept."; "One may only claim as many objects as their doll's max_claims allows."; rpg = $local.rpg; who = valid(cp = caller_perms()) ? rpg:trusted(cp) ? player | cp | player; if (this.location != who) who:tell("You aren't holding ", this.name, "."); return E_RANGE; endif if (children(this)) "Keep players from claiming items that have kids."; return player:tell("this is a generic ", this.name, " and shouldn't be claimed. Please report to a GM or G_M how you got it, because these items should not be out of the vault."); endif result = this:claim_for(who); if (result == E_NONE) who:tell("You already hold a claim to ", this.name, "."); elseif (result == E_INVARG) who:tell("You have no need for such an item. Perhaps if you were involved in ancient bovine cult..."); elseif (result == E_QUOTA) who:tell("No more claims can be accepted until you revoke some of your earlier ones. Go to the Department of Environmental Protection for more info."); elseif (result == E_NACC) old = this.claimed_by; who:tell(old:titlec(), " won't give up ", old.pp, " claim."); elseif (this.claimed_by == who) who:tell("You stake your claim to ", this:title(), "."); else who:tell("You can't seem to claim that object. Please contact a GM."); endif return result; . @verb #517:"unclaim_for" this none this @program #517:unclaim_for ":unclaim_for(who)"; "-> E_PERM, caller is not a GM."; "-> E_NONE, this is not currently claimed by the given person."; who = args[1]; rpg = $local.rpg; if (!rpg:trusted(caller_perms())) return E_PERM; elseif (this.claimed_by != who) return E_NONE; endif if (valid(doll = rpg:get_doll(who))) doll:remove_claimed_object(this); endif this.claimed_by = #-1; return 1; . @verb #517:"unclaim" this none none rxd @program #517:unclaim "unclaim "; "Remove all claims you have to the object, freeing it to be claimed by someone else, or swept up."; rpg = $local.rpg; who = valid(cp = caller_perms()) ? rpg:trusted(cp) ? player | cp | player; result = this:unclaim_for(who); if (result == E_NONE) who:tell("You don't hold any claim to that."); elseif (this.claimed_by != who) who:tell("You revoke your claim to ", this:title(), "."); else who:tell("You can't seem to revoke your claim to that object. Please contact a GM."); endif return result; . @verb #517:"recycle(old)" this none this @program #517:recycle(old) "Added to remove invalid equipment from wielding/wearing. Quinn (02-MAR-93)"; if ((caller != this) && (!$perm_utils:controls(caller_perms(), this))) return E_PERM; endif if (valid(doll = $local.rpg:get_doll(this.location))) doll.wielding = setremove(doll.wielding, this); doll.wearing = setremove(doll.wearing, this); endif who = this:claimed_by(); if (valid(who)) this:unclaim_for(who); endif return pass(@args); . @verb #517:"set_cond*ition" this none this @program #517:set_condition ":set_condition(NUM) => NUM condition -- Set the .condition of the object."; if (!$local.rpg:trusted(caller_perms())) return E_PERM; elseif (children(this)) return E_NACC; elseif (typeof(this.condition) != NUM) return E_INVIND; elseif (typeof(cond = args[1]) != NUM) return E_INVARG; else return this.condition = cond; endif . @verb #517:"recycle_isagi" this none this rx @program #517:recycle_isagi "Copied from rpg_utils (#61176):rpg_recycle by Isagi (#21077) Sun Nov 27 08:39:51 1994 PST"; "Copied from Generic LRPG Thing (#517):recycle by Grand_Master (#2693) Sun Nov 27 08:13:46 1994 PST"; "Added to remove invalid equipment from wielding/wearing. Quinn (02-MAR-93)"; if ((caller != this) && (!$perm_utils:controls(caller_perms(), this))) return E_PERM; endif if (valid(doll = $local.rpg:get_doll(this.location))) doll.wielding = setremove(doll.wielding, this); doll.wearing = setremove(doll.wearing, this); endif who = this:claimed_by(); if (valid(who)) this:unclaim_for(who); endif G8_kobolds = #21077.rpg_utils.G8_kobolds; clear = 1; for kobold in (G8_kobolds) if (this in kobold.mine) clear = 0; string1 = (" !!!! " + tostr(this)) + ":recycle - invalid recycle caught"; string2 = (((" !!!! Object is in " + kobold.name) + " (") + tostr(kobold)) + ")'s mine list"; string3 = " !!!! Callers: " + $string_utils:from_value(callers(), 1, 8); #21077:log(string1); #21077:log(string2); #21077:log(string3); endif endfor if (clear) return pass(@args); else return -1; endif "Isagi 11-27-94 1145A Added check to trap when kobolds get their items recycled."; . "***finished***