# 1 "bin/root_obj.cl" # 1 "<built-in>" # 1 "<command line>" # 1 "bin/root_obj.cl" # 1 "bin/boot.clh" 1 # 2 "bin/root_obj.cl" 2 object #1 list owners; num public = 1; str name = "Root Object"; verb "@rename" : "to" = rename_verb; method init if (this == #1) this.add_owner(#11); elseif ((caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners)) owners = {}; else raise E_PERM; endif endmethod method clone var new; if (!(caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners) && !public) raise(E_PERM); else new = clone(); new.init(); new.add_owner(player); if (args) new.set_name(args[1]); endif return new; endif endmethod method destroy var owner; if ((caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners)) for owner in (owners) owner.rm_creation(this); endfor destroy(); else raise(E_PERM); endif endmethod method name return name; endmethod method id return (name + "(" + tostr(this) + ")"); endmethod method sdesc return ("You see " + name + " here."); endmethod method set_name if ((caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners)) name = args[1]; else raise(E_PERM); endif endmethod method rename_verb var r; ignore E_RANGE; if (!this.match(args[2])) return 1; elseif (!(caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners)) player.tell("You can't rename that."); return 0; endif r = this.set_name(args[4]); if (r == E_RANGE) player.tell("You can't use that new name."); else player.tell("Name set."); endif endmethod method publish if (!(caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners)) raise(E_PERM); else public = 1; endif endmethod method unpublish if (!(caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners)) raise(E_PERM); else public = 0; endif endmethod method add_parent if (!(caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners)) raise(E_PERM); else chparents(parents + args[1]); endif endmethod method rm_parent if (!(caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners)) raise(E_PERM); else chparents(parents - args[1]); endif endmethod method chparents if (!(caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners)) raise(E_PERM); else chparents(args[1]); endif endmethod method add_verb if (!(caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners)) raise(E_PERM); else return add_verb(args[1], args[2], args[3]); endif endmethod method rm_verb if (!(caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners)) raise(E_PERM); else return rm_verb(args[1]); endif endmethod method rm_method if (!(caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners)) raise(E_PERM); else return rm_method(args[1]); endif endmethod method rm_var if (!(caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners)) raise(E_PERM); else return rm_var(args[1]); endif endmethod method owners return owners; endmethod method add_owner if ((caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners)) owners = owners + args[1]; args[1].add_creation(this); else raise(E_PERM); endif endmethod method rm_owner if ((caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners)) owners = owners - args[1]; args[1].rm_creation(this); else raise E_PERM; endif endmethod method show var vars; var item; player.tell(this.id + " Size: " + tostr(objsize()) + " bytes"); if (parents) player.tell("Parents: " + tostr(parents)); else player.tell("No parents."); endif if (!public && !(caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners)) player.tell("The rest of the object is not public."); return; endif vars = vars(); if (vars) for item in (vars) player.tell(" " + item + ": " + tostr(getvar(item))); endfor else player.tell("No vars."); endif endmethod method verbs if ((caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners) || public) return verbs(); endif endmethod method methods if ((caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners) || public) return methods(); endif endmethod method spew_method var code; ignore E_METHODNF; if (!(caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners) && !public) raise E_PERM; endif code = spew_method(args[1]); if (code == E_METHODNF); return "That object does not define that method."; else return code; endif endmethod method list_method var code, parent; ignore E_METHODNF; if (!(caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners) && !public) raise E_PERM; endif code = list_method(args[1], 0, 0); if (code) return code; endif parent = find_method(args[1]); if (parent) code = parent.list_method(args[1]); if (code) return "That object does not define that method, but its ancestor " + parent.id + " does:\n" + code; endif endif return "That object does not define that method."; endmethod endobject # 1 "bin/sys_obj.cl" # 1 "<built-in>" # 1 "<command line>" # 1 "bin/sys_obj.cl" # 1 "bin/boot.clh" 1 # 2 "bin/sys_obj.cl" 2 object #0 parents #1; name = "The System Object"; list players = { #11 } , connected_players; list connected_servers; list wizards = { #11 }; list visitors; obj player_class; num dbtop; method init if (caller != #0) raise(E_PERM); else this.add_owner(#11); endif endmethod method boot_server if (caller != #0) raise(E_PERM); endif connected_players = {}; connected_servers = { #0 }; player_class = #10; endmethod method resynch var item, dummy; if (caller != #0) raise(E_PERM); endif for item in (visitors) if (serverof(item[1].location)) dummy = item[2].remove(item[1]); visitors = visitors - item; endif endfor endmethod method add_wizard if (!(caller in wizards)) player.tell("Permission denied."); else wizards = wizards + args[1]; player.tell("Wizard added."); endif endmethod method rm_wizard if (!(caller in wizards)) player.tell("Permission denied."); else wizards = wizards - args[1]; player.tell("Wizard removed."); endif endmethod method wizards return wizards; endmethod method convtime var r, time, howmany; if (lengthof(args) != 1) raise(E_RANGE); elseif (typeof(args[1]) != NUM) raise(E_TYPE); else time = args[1]; if (time > (24 * 60 * 60)) r = " day"; howmany = time / (24 * 60 * 60); elseif (time > (60 * 60)) r = " hour"; howmany = time / (60 * 60); elseif (time > 60) r = " minute"; howmany = time / 60; else r = " second"; howmany = time; endif if(howmany != 1) r = r + "s"; endif return tostr(howmany) + r; endif endmethod method who var dude; if (args) player.tell(args[1]); endif player.tell("Player Name On For Idle"); for dude in (connected_players) player.tell(pad(dude.name, 17) + " " + pad(this.convtime(time() - dude.connected_at), 11) + " " + pad(this.convtime(time() - dude.last_cmd_at), 11)); endfor endmethod method add_visitor visitors = visitors + {args[1], args[2]}; endmethod method rm_visitor visitors = visitors + {args[1], args[2]}; endmethod method visitors return visitors; endmethod method connect_player if (caller != #0) raise E_PERM; else connected_players = connected_players + args[1]; args[1].connect(); endif endmethod method create_player ignore E_METHODNF; if (caller != #0) raise E_PERM; else connected_players = connected_players + args[1]; players = players + args[1]; args[1].connect(); endif endmethod method disconnect_player if (caller != #0) raise E_PERM; else connected_players = connected_players - args[1]; args[1].disconnect(); endif endmethod method rm_player if ((caller in wizards) || caller == args[1]) players = players - args[1]; else raise E_PERM; endif endmethod method players return players; endmethod method connected_players return connected_players; endmethod method find_player var dude; for dude in (players) if (dude.name == args[1]) return dude; endif endfor return #-1; endmethod method find_connected_player var dude; for dude in (connected_players) if (dude.name == args[1]) return dude; endif endfor return #-1; endmethod method connect_server connected_servers = connected_servers + args[1]; #0 .resynch(); endmethod method disconnect_server connected_servers = connected_servers - args[1]; endmethod endobject # 1 "bin/located_obj.cl" # 1 "<built-in>" # 1 "<command line>" # 1 "bin/located_obj.cl" # 1 "bin/boot.clh" 1 # 2 "bin/located_obj.cl" 2 object #2 parents #1; name = "Generic Located Object"; obj location; list contents; method init if (this == #2) this.add_owner(#11); else location = #-1; contents = {}; pass(); endif endmethod method destroy var thing, thome; ignore E_SERVERDN, E_OBJNF, E_METHODNF; if ((caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners)) if (location) location.remove(this); endif for thing in (contents) thome = thing.home; if (thome) thing.moveto(thome); else thing.moveto(#-1); endif endfor pass(); else raise(E_PERM); endif endmethod blocked method location return location; endmethod method contained_by if (location == args[1]) return 1; elseif (!location) return 0; else return location.contained_by(args[1]); endif endmethod method contents return contents; endmethod method match_contents var thing; for thing in (contents) if (thing.match(args[1])) return thing; endif endfor return #-1; endmethod method moveto var dest; ignore E_SERVERDN, E_OBJNF, E_METHODNF; dest = args[1]; if (dest == location) return 1; elseif (dest == this) return 0; elseif (dest.contained_by(this)) return 0; endif lock ("moveto"); if (dest && !dest.accept(this)) return 0; endif if (location) location.remove(this); endif location = dest; return 1; endmethod method accept var what; what = args[1]; contents = contents + what; if (serverof(what)) #0 .add_visitor(what, this); endif return 1; endmethod method remove var what; what = args[1]; contents = contents - what; if (serverof(what)) #0 .rm_visitor(what, this); endif endmethod endobject # 1 "bin/described_obj.cl" # 1 "<built-in>" # 1 "<command line>" # 1 "bin/described_obj.cl" # 1 "bin/boot.clh" 1 # 2 "bin/described_obj.cl" 2 object #3 parents #1; str name = "Generic Described Object"; str desc = ""; verb "l*ook ex*amine" = look_verb; verb "@desc*ribe" : "as" = desc_verb; method init if (this == #3) this.add_owner(#11); else pass(); endif endmethod method match var word; if (!args[1]) return 0; elseif (args[1][1] == "#" && toobj(args[1]) == this) return 1; endif for word in (explode(args[1])) if (!match(name, word)) return 0; endif endfor return 1; endmethod method desc return desc; endmethod method sdesc return ("You see " + name + " here."); endmethod method desc_verb if (!this.match(args[2])) return 1; elseif (!(caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners)) player.tell("Permission denied."); else desc = args[4]; player.tell("Description set."); endif endmethod method look_verb if (!this.match(args[2])) return 1; endif this.look(); endmethod method look if (desc) player.tell(desc); else player.tell("You see nothing special."); endif endmethod endobject # 1 "bin/thing.cl" # 1 "<built-in>" # 1 "<command line>" # 1 "bin/thing.cl" # 1 "bin/boot.clh" 1 # 2 "bin/thing.cl" 2 object #4 parents #2, #3; name = "Generic Thing"; obj home; verb "get take" = get; verb "drop throw" = drop; method location return #-1; endmethod method init ignore E_METHODNF; if (this == #4) this.add_owner(#11); else if (player.home) home = player.home; else home = player; endif pass(); this.moveto(player); endif endmethod method id return pass() to #3; endmethod method accept return 0; endmethod method get var result; if (args[1] != "all" && !this.match(args[2])) return 1; elseif (location == player) result = "You already have that!"; elseif (location != player.location) result = "I don't see that here."; elseif (this.moveto(player)) result = "Taken."; player.location.announce(player.name + " takes " + this.name + ".", {player}); else result = "You can't get that."; endif if (args[1] == "all") player.tell(name + ": " + result); else player.tell(result); endif endmethod method drop var result; if (args[1] != "all" && !this.match(args[2])) return 1; elseif (location != player) result = "You don't have that!"; elseif (this.moveto(player.location)) result = "Dropped."; player.location.announce(player.name + " drops " + this.name + ".", {player}); else result = "You can't drop that."; endif if (args[1] == "all") player.tell(name + ": " + result); else player.tell(result); endif endmethod endobject # 1 "bin/container.cl" # 1 "<built-in>" # 1 "<command line>" # 1 "bin/container.cl" # 1 "bin/boot.clh" 1 # 2 "bin/container.cl" 2 object #5 parents #4; name = "Generic Container"; verb "put place insert" : "in into" = put_in; verb "get remove take" : "from in" = remove_from; verb "l*ook" : "in into inside" = look_in; method init if (this == #5) this.add_owner(#11); endif pass(); endmethod method accept return pass(args[1]) to #2; endmethod method put_in var what; if (!this.match(args[4])) return 1; endif what = player.match_contents(args[2]); if (!what) player.tell("You don't have that."); elseif (what.moveto(this)) player.tell("You put " + what.name + " into " + this.name + "."); else player.tell("You can't put " + what.name + " into " + this.name + "."); endif endmethod method remove_from var what; if (!this.match(args[4])) return 1; endif what = this.match_contents(args[2]); if (!what) player.tell("That object is not inside " + this.name + "."); elseif (what.moveto(player)) player.tell("You remove " + what.name + " from " + this.name + "."); else player.tell("You can't remove that."); endif endmethod method look var thing; pass() to #3; if (this.contents) player.tell("Containing:"); for thing in (this.contents) player.tell(" " + thing.name); endfor endif endmethod method look_in var thing; if (!this.match(args[4])) return 1; endif if (contents) player.tell("Inside " + name + " you see:"); for thing in (contents) player.tell(" " + thing.name); endfor else player.tell("You see nothing inside " + name + "."); endif endmethod endobject # 1 "bin/room.cl" # 1 "<built-in>" # 1 "<command line>" # 1 "bin/room.cl" # 1 "bin/boot.clh" 1 # 2 "bin/room.cl" 2 object #6 parents #2, #3; list exits; name = "Generic Room"; verb "go move" = go_verb; method init if (this == #6) this.add_owner(#11); elseif ((caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners)) exits = {}; pass(); else raise E_PERM; endif endmethod method destroy var exit, thing; ignore E_SERVERDN, E_OBJNF; if (!(caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners)) raise E_PERM; else for exit in (exits) exit.destroy(); endfor pass() to #2; endif endmethod method id return pass() to #3; endmethod method exits return exits; endmethod method announce var dude; ignore E_METHODNF, E_SERVERDN; for dude in (contents) if (lengthof(args) == 1 || !(dude in args[2])) dude.tell(args[1]); endif endfor endmethod method go_verb if (!args[2]) player.tell("Go where?"); elseif(this.go(args[2])) player.tell("There is no passage in that direction."); endif endmethod method go var exit; for exit in (exits) if (exit.match(args[1]) && exit.dest) exit.activate(); return 0; endif endfor return -1; endmethod method look var thing; var nm; ignore E_SERVERDN, E_OBJNF; player.tell(name); if (desc) player.tell(desc); endif if (contents) for thing in (contents) if (thing != player) nm = thing.sdesc; if (nm == E_SERVERDN || nm == E_OBJNF) player.tell("(Ghost of " + tostr(thing) + " is here.)"); else player.tell(nm); endif endif endfor endif endmethod method match return (args[1] == "here" && player.location == this); endmethod method match_exit var exit; for exit in (exits) if (exit.match(args[1])) return exit; endif endfor return #-1; endmethod method link_ok return ((caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners)); endmethod method open_ok return ((caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners)); endmethod method add_exit if ((caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners)) exits = exits + args[1]; else raise (E_PERM); endif endmethod method rm_exit if ((caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners) || caller in exits) exits = exits - args[1]; else raise(E_PERM); endif endmethod endobject # 1 "bin/exit.cl" # 1 "<built-in>" # 1 "<command line>" # 1 "bin/exit.cl" # 1 "bin/boot.clh" 1 # 2 "bin/exit.cl" 2 object #7 parents #3; name = "Generic Exit"; obj source; obj dest; str leave; str oleave; str arrive; str oarrive; method init if (this == #7) this.add_owner(#11); elseif ((caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners)) source = #-1; dest = #-1; pass(); else raise E_PERM; endif endmethod method destroy if ((caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners) || caller == source) source.rm_exit(this); pass(); else raise E_PERM; endif endmethod method match return match_full(name, args[1], ";"); endmethod method dest return dest; endmethod method set_dest if ((caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners)) dest = args[1]; else raise(E_PERM); endif endmethod method set_source if ((caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners)) source = args[1]; else raise(E_PERM); endif endmethod method activate var pname; ignore E_SERVERDN; pname = player.name; if (dest.name == E_SERVERDN) player.tell("You can't go that way right now."); return; elseif (!player.moveto(dest, leave, oleave, arrive, oarrive)) player.tell("You can't go that way."); return; endif endmethod endobject # 1 "bin/player.cl" # 1 "<built-in>" # 1 "<command line>" # 1 "bin/player.cl" # 1 "bin/boot.clh" 1 # 2 "bin/player.cl" 2 object #8 parents #2, #3; name = "Generic Player"; str password; str gender; num connected_at, last_cmd_at; obj home; list creations; num reading; str read_input; str done_reading; obj nick_root = #1; obj nick_desc = #3; obj nick_loc = #2; obj nick_thing = #4; obj nick_cont = #5; obj nick_room = #6; obj nick_exit = #7; obj nick_player = #8; obj nick_builder = #9; obj nick_prog = #10; obj nick_wizard = #11; verb "dr*op th*row" = drop_cmd; verb "get ta*ke" = get_cmd; verb "help" = help_cmd; verb "home" = gohome_cmd; verb "i inv*entory" = inventory_cmd; verb "l*ook" = look_cmd; verb "news" = news_cmd; verb "pa*ge" = page_cmd; verb "pa*ge" : "with" = page_cmd; verb "@password password" : "to" = password_cmd; verb "@password password" = password_cmd; verb "po*se" = pose_cmd; verb "quit" = quit_cmd; verb "rwho" = rwho_cmd; verb "sa*y" = say_cmd; verb "who" = who_cmd; verb "wh*isper" : "to" = whisper_cmd; verb "wiz*ards" = wizards_cmd; method init if (this == #8) this.add_owner(#11); elseif ((caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners)) pass(); this.add_owner(this); home = #12; this.moveto(home); last_cmd_at = time(); else raise E_PERM; endif endmethod method destroy var thing, tid; ignore E_SERVERDN, E_OBJNF, E_METHODNF; if ((caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners)) for thing in (creations) tid = thing.id; if (tid == E_OBJNF || tid == E_SERVERDN) continue; endif if (thing != this) thing.rm_owner(this); if (!thing.owners) thing.destroy(); endif endif endfor #0 .rm_player(this); pass() to #2; else raise E_PERM; endif endmethod method id return pass() to #3; endmethod method psub var n, s, o, p, q, r; n = name; if (gender && gender[1] == "m") s = "he"; o = "him"; p = "his"; q = "his"; r = "himself"; elseif (gender && gender[1] == "f") s = "she"; o = "her"; p = "her"; q = "hers"; r = "herself"; else s = "it"; o = "it"; p = "its"; q = "its"; r = "itself"; endif return psub(args[1]); endmethod method moveto var oldloc; ignore E_METHODNF; oldloc = location; if (pass(args[1])) if (lengthof(args) > 1 && args[2]) echo(args[2]); endif if (lengthof(args) > 2 && args[3]) oldloc.announce(this.psub(args[3]), {this, location}); endif oldloc.announce(name + " has left.", {this, location}); this.look_around(); if (lengthof(args) > 3 && args[4]) echo(args[4]); endif if (lengthof(args) > 4 && args[5]) location.announce(this.psub(args[5]), {this, oldloc}); endif location.announce(name + " has arrived.", {this, oldloc}); return 1; else return 0; endif endmethod method drop_cmd var thing; ignore E_SERVERDN, E_METHODNF, E_OBJNF; if (caller != this) return 1; elseif (args[2] == "all" || args[2] == "everything") if (!contents) echo("You are empty-handed."); else for thing in (contents) if (thing.drop("all") == E_METHODNF) echo(thing.name + ": You can't drop that."); endif endfor endif else return 1; endif endmethod method get_cmd var cont, thing; ignore E_SERVERDN, E_METHODNF, E_OBJNF; if (caller != this) return 1; elseif (args[2] == "all" || args[2] == "everything") cont = location.contents - this; if (!cont) echo("There's nothing here to get!"); else for thing in (cont) if (thing.get("all", "") == E_METHODNF) echo(thing.name + ": You can't get that."); endif endfor endif else return 1; endif endmethod method input_to if (caller != this && !(caller in #0 .wizards)) raise(E_PERM); endif reading = 1; read_input = ""; done_reading = args[1]; endmethod method parse var thing, cmd, r; ignore E_SERVERDN; if (caller != this && !(caller in #0 .wizards)) raise(E_PERM); endif lock("parse"); last_cmd_at = time(); cmd = args[1]; if (reading) if (cmd == ".") reading = 0; this.(done_reading)(read_input); read_input = ""; else read_input = read_input + cmd + "\n"; endif return; endif if (!cmd) return; elseif (cmd[1] == "\"") if (lengthof(cmd) > 1) cmd = "say " + cmd[2..]; else cmd = "say "; endif elseif (cmd[1] == ":") if (lengthof(cmd) > 1) cmd = "pose " + cmd[2..]; else cmd = "pose "; endif elseif (cmd[1] == ";") if (lengthof(cmd) > 1) cmd = "eval " + cmd[2..]; else cmd = "eval "; endif endif if (!this.call_verb(cmd)) return; endif for thing in (contents) if (thing.call_verb(cmd) == 0) return; endif endfor if (location) if (location.call_verb(cmd) == 0) return; endif for thing in (location.contents) if (thing != this) if (thing.call_verb(cmd) == 0) return; endif endif endfor if (location.go(cmd) == 0) return; endif for thing in (location.exits) if (thing.call_verb(cmd) == 0) return; endif endfor endif echo("I don't understand that."); endmethod method home return home; endmethod method match if (args[1] == "me" && player == this) return 1; else return (pass(args[1]) to #3); endif endmethod method match_env var s, what, loc; ignore E_SERVERDN, E_VARNF; s = args[1]; if (!s) return #-1; elseif (s[1] == "#") return toobj(s); elseif (s == "me") return player; elseif (s == "here" && location) return location; elseif (s == "nowhere") return #-1; elseif (s[1] == "$" && lengthof(s) > 1) what = getvar("nick_" + s[2..]); if (what == E_VARNF || typeof(what) != OBJ) return #-1; else return what; endif endif what = this.match_contents(s); if (what) return what; endif if (location) what = location.match_contents(s); if (what) return what; endif endif return #-1; endmethod method disconnect location.announce(name + " has disconnected.", {player}); endmethod method connect connected_at = time(); this.look_around(); if (location) location.announce(name + " has connected.", {player}); endif endmethod method connected_at return connected_at; endmethod method last_cmd_at return last_cmd_at; endmethod method tell echo(args[1]); endmethod method add_creation creations = creations + args[1]; endmethod method rm_creation creations = creations - args[1]; endmethod method sdesc return (name + " is here."); endmethod method set_name var existing; existing = #0 .find_player(args[1]); if (existing && existing != this) raise(E_RANGE); elseif (" " in args[1]) raise(E_RANGE); else pass(args[1]) to #3; endif endmethod method look pass() to #3; if (contents) player.tell("Carrying:"); this.inv(); endif endmethod method help_cmd var filename, what; ignore E_FILE, E_METHODNF; if (caller != this) return 1; endif if(args[2]) filename = "help/" + args[2] + ".txt"; else filename = "help/intro.txt"; endif if (echo_file(filename) == 0) return; endif what = this.match_env(args[2]); if (what) if (!what.help()) echo("There is no help on that object."); endif else echo("There is no help on that topic."); endif endmethod method inv var thing, nm; ignore E_SERVERDN; for thing in (contents) nm = thing.name; if (nm == E_SERVERDN) player.tell(" (Ghost of " + tostr(thing) + ")"); else player.tell(" " + nm); endif endfor endmethod method gohome_cmd ignore E_SERVERDN; if (caller != this) return 1; endif this.moveto(home, "Click click click...", name + " goes home.", "", name + " comes home."); endmethod method inventory_cmd var item; if (contents) echo("You are carrying:"); this.inv(); else echo("You are empty-handed."); endif endmethod method look_around ignore E_SERVERDN, E_OBJNF; var r; player = this; r = location.look(); if (r == E_SERVERDN) echo("The outlines of the room you are in have suddenly become hazy and indistinct. Going \"home\" might be useful about now."); elseif (r == E_OBJNF) echo("You're absolutely nowhere. Go home."); endif endmethod method look_cmd if (!args[2]) this.look_around(); elseif (this.match(args[2])) this.look(); else return 1; endif endmethod method news_cmd var what; ignore E_FILE; if (caller != this) return 1; elseif (!args[2]) what = "news/intro.txt"; else what = "news/" + args[2] + ".txt"; endif if (echo_file(what) == E_FILE) echo("There is no news on that topic."); endif endmethod method page_cmd var who, locname; ignore E_SERVERDN, E_METHODNF, E_OBJNF; if (caller != this) return 1; elseif (!args[2]) echo("Usage: page <player>"); echo(" page <player> with <message>"); endif locname = location.name; who = #0 .find_connected_player(args[2]); if (!who) echo("That player is not connected."); elseif (args[4]) who.tell(name + " pages, \"" + args[4] + "\""); echo("Your message has been sent."); elseif (typeof(locname) == STR) who.tell("You sense that " + name + " is looking for you in " + locname + "."); echo("Your message has been sent."); else who.tell("You sense that " + name + " is looking for you."); echo("Your message has been sent."); endif endmethod method password_cmd if (caller != this) return 1; elseif (!args[2] || !args[4]) echo("Usage: @password <oldpasswd> to <newpasswd>"); elseif (crypt(args[2], password[1..2]) != password) echo("Incorrect old password."); else password = crypt(args[4]); echo("Password changed."); endif endmethod method pose_cmd if (caller != this) return 1; endif location.announce(name + " " + args[2]); endmethod method rwho_cmd var sysobj, header; ignore E_SERVERDN; for sysobj in (servers()) header = "Server \"" + servername(sysobj) + "\": "; if (sysobj.who(header) == E_SERVERDN) echo(header + "Server down."); else echo("---"); endif endfor endmethod method say_cmd if (caller != this) return 1; endif echo("You say, \"" + args[2] + "\""); location.announce(name + " says, \"" + args[2] + "\"", {player}); endmethod method teleport_cmd var what, dest; what = this.match_env(args[2]); dest = this.match_env(args[4]); if (!what) echo("Teleport what?"); elseif (!dest && args[4] != "nowhere") echo("Teleport it where?"); elseif(!what.moveto(dest, "You feel a wrenching sensation..")) echo("You can't teleport that."); else echo("Teleported."); endif endmethod method quit_cmd if (caller != this && !(caller in #0 .wizards)) return 1; endif quit(); endmethod method wizards_cmd var wiz; echo("Your wizards are:"); for wiz in (#0 .wizards) echo(" " + wiz.name); endfor endmethod method who_cmd if (caller != this) return 1; endif #0 .who; endmethod method whisper_cmd var who; ignore E_METHODNF; if (caller != this) return 1; endif who = this.match_env(args[4]); if (!who) echo("I don't see that here."); elseif (who.tell(name + " whispers, \"" + args[2] + "\"") == 0) echo("You whisper, \"" + args[2] + "\" to " + who.name); else echo("You can't whisper to that!"); endif endmethod endobject # 1 "bin/builder.cl" # 1 "<built-in>" # 1 "<command line>" # 1 "bin/builder.cl" # 1 "bin/boot.clh" 1 # 2 "bin/builder.cl" 2 object #9 parents #8; verb "@addo*wner" : "on to onto" = addowner_cmd; verb "@addo*wner" = addowner_cmd; verb "@addp*arent" : "on to onto" = addparent_cmd; verb "@addp*arent" = addparent_cmd; verb "@clone" = clone_cmd; verb "@clone" : "named" = clone_cmd; verb "@create" = create_cmd; verb "@destroy" = destroy_cmd; verb "@dig" = dig_cmd; verb "@find" = find_cmd; verb "@link" = link_cmd; verb "@link" : "to" = link_cmd; verb "@list" : "on" = list_cmd; verb "@list" = list_cmd; verb "@open" = open_cmd; verb "@open" : "to" = open_cmd; verb "@methods" = methods_cmd; verb "@mutate" : "to into" = mutate_cmd; verb "@mutate" = mutate_cmd; verb "@nick*name" : "is as to" = nickname_cmd; verb "@nick*name" = nickname_cmd; verb "@pub*lish" = publish_cmd; verb "@unpub*lish" = unpublish_cmd; verb "@rmp*arent" : "from on to onto" = rmparent_cmd; verb "@rmp*arent" = rmparent_cmd; verb "@rmo*wner" : "from on to onto" = rmowner_cmd; verb "@rmo*wner" = rmowner_cmd; verb "@show" = show_cmd; verb "@spew" : "on" = spew_cmd; verb "@spew" = spew_cmd; verb "@tel*eport" : "to" = teleport_cmd; verb "@ve*rbs" = verbs_cmd; name = "Generic Builder"; method init if (this == #9) this.add_owner(#11); else pass(); endif endmethod method clone_cmd var parent, new; if (caller != this) return 1; elseif (!args[2] || (args[3] && !args[4])) echo("Usage: @clone <thing>"); echo(" @clone <thing> named <name>"); return 0; endif parent = this.match_env(args[2]); if (!parent) echo("I don't see that here."); else new = parent.clone(args[4]); if (!new) echo("You can't clone that."); else echo("New \"" + parent.name + "\" cloned: " + new.id); endif endif endmethod method mutate_cmd var r, what, newparent; ignore E_MAXREC, E_RANGE, E_INVIND, E_OBJNF, E_PERM; if (caller != this) return 1; elseif (!args[2] || !args[3] || !args[4]) echo("Usage: @mutate <thing> into <what>"); return 0; endif what = this.match_env(args[2]); newparent = this.match_env(args[4]); if (!what || !newparent) echo("I don't see that here."); else r = what.chparents({newparent}); if (typeof(r) == ERR && r != E_NONE) this.parent_result(r); else echo("Mutated."); endif endif endmethod method nickname_cmd var what; if (caller != this) return 1; elseif (!args[2] || !args[3] || !args[4]) echo("Usage: @nickname <thing> is <nickname>"); return 0; endif what = this.match_env(args[2]); if (!what) echo("I don't see that here."); else setvar("nick_" + args[4], what); echo("Nickname set."); endif endmethod method publish_cmd var what; if (caller != this) return 1; elseif (!args[2]) echo("Usage: @publish <thing>"); return 0; endif what = this.match_env(args[2]); if (!what) echo("I don't see that here."); elseif (what.publish()) echo("You can't publish that."); else echo(what.id + " published."); endif endmethod method unpublish_cmd var what; if (caller != this) return 1; elseif (!args[2]) echo("Usage: @unpublish <thing>"); return 0; endif what = this.match_env(args[2]); if (!what) echo("I don't see that here."); elseif (what.unpublish()) echo("You can't publish that."); else echo(what.id + " unpublished."); endif endmethod method addowner_cmd var what, owner; ignore E_PERM; if (caller != this) return 1; elseif (!args[2] || !args[3] || !args[4]) echo("Usage: @addowner <what> to <thing>"); return 0; endif owner = #0 .find_player(args[2]); what = this.match_env(args[4]); if (!owner) echo("\"" + args[2] + "\" is not the name of any player."); elseif (!what) echo("I don't see that here."); elseif (what.add_owner(owner) == E_PERM) echo("Permission denied."); else echo("Owner added."); endif endmethod method rmowner_cmd var what, owner; ignore E_PERM; if (caller != this) return 1; elseif (!args[2] || !args[3] || !args[4]) echo("Usage: @rmowner <what> from <thing>"); return 0; endif owner = #0 .find_player(args[2]); what = this.match_env(args[4]); if (!owner) echo("\"" + args[2] + "\" is not the name of any player."); elseif (!what) echo("I don't see that here."); elseif (what.rm_owner(owner) == E_PERM) echo("Permission denied"); else echo("Owner removed."); endif endmethod method addparent_cmd var r, what, parent; ignore E_MAXREC, E_RANGE, E_INVIND, E_OBJNF, E_PERM; if (caller != this) return 1; elseif (!args[2] || !args[3] || !args[4]) echo("Usage: @addparent <what> to <thing>"); return 0; endif what = this.match_env(args[4]); parent = this.match_env(args[2]); if (!what || !parent) echo("I don't see that here."); else r = what.add_parent(parent); if (typeof(r) == ERR && r != E_NONE) this.parent_result(r); else echo("Parent added."); endif endif endmethod method rmparent_cmd var r, what, parent; ignore E_MAXREC, E_RANGE, E_INVIND, E_OBJNF, E_PERM; if (caller != this) return 1; elseif (!args[2] || !args[3] || !args[4]) echo("Usage: @rmparent <what> from <thing>"); return 0; endif what = this.match_env(args[4]); parent = this.match_env(args[2]); if (!what || !parent) echo("I don't see that here."); else r = what.rm_parent(parent); if (typeof(r) == ERR && r != E_NONE) this.parent_result(r); else echo("Parent removed."); endif endif endmethod method parent_result if (args[1] == E_OBJNF) echo("Parent does not exist."); elseif (args[1] == E_INVIND) echo("Parent must be local."); elseif (args[1] == E_PERM) echo("Parent permission denied."); elseif (args[1] == E_RANGE) echo("Object must have at least one parent."); elseif (args[1] == E_MAXREC) echo("New parent would cause a loop."); else echo("Parent invalid."); endif endmethod method create_cmd var new; if (caller != this) return 1; elseif (!args[2]) echo("Usage: @create <name>"); else new = #4 .clone(args[2]); echo("Thing created: " + new.id); endif endmethod method destroy_cmd var what; if (caller != this) return 1; endif what = this.match_env(args[2]); if (!what) echo("What's a " + args[2] + "?"); else what.destroy(); echo("Destroyed."); endif endmethod method dig_cmd var new; if (caller != this) return 1; elseif (!args[2]) echo("Dig what?"); return 0; endif new = #6 .clone(args[2]); echo("Room dug: " + new.id); endmethod method spew_cmd var what; if (caller != this) return 1; elseif (!args[2] || !args[4]) echo("Usage: @spew <method> on <object>"); else what = this.match_env(args[4]); if (!what) echo("I don't see that here."); else echo(what.spew_method(args[2])); endif endif endmethod method link_cmd var exit; if (caller != this) return 1; elseif (!args[2]) echo("Link what?"); elseif (!args[3]) echo("Usage: @link <exit name> to <room #>"); else exit = location.match_exit(args[2]); if (!exit) echo("I don't know what you want to link!"); else this.link(exit, args[4]); endif endif endmethod method link var new_dest; ignore E_METHODNF; if (!(caller == this || caller in owners || caller in parents || caller == #0 || caller in #0 .wizards || !owners)) echo("Permission denied."); else new_dest = this.match_env(args[2]); if (!new_dest) echo("Link to where?"); elseif (!new_dest.link_ok) echo("You can't link to that!"); else args[1].set_dest(new_dest); echo("Linked."); endif endif endmethod method find_cmd var nm, thing; ignore E_METHODNF; if (caller != this) return 1; endif for thing in (creations) if (args[2]) nm = thing.name; if (lengthof(args[2]) > lengthof(nm)) if (args[2][1..lengthof(nm)] == nm) echo(thing.id); endif elseif (nm[1..lengthof(args[2])] == args[2]) echo(thing.id); endif else echo(thing.id); endif endfor echo("---"); endmethod method list_cmd var what; if (caller != this) return 1; elseif (!args[2] || !args[4]) echo("Usage: @list <method> on <object>"); else what = this.match_env(args[4]); if (!what) echo("I don't see that here."); else echo(what.list_method(args[2])); endif endif endmethod method open_cmd var exit; if (caller != this) return 1; elseif (!args[2]) player.tell("Open an exit in what direction?"); else if (!location.open_ok) echo("You can't open an exit here!"); else exit = #7 .clone(args[2]); location.add_exit(exit); exit.set_source(location); echo("Exit " + exit.id + " opened."); if (args[3]) this.link(exit, args[4]); endif endif endif endmethod method methods_cmd var what, m; if (caller != this) return 1; elseif (!args[2]) echo("Usage: @methods <object>"); return 0; endif what = this.match_env(args[2]); if (!what) echo("I don't see that here."); else for m in (what.methods) echo(" " + m); endfor echo("---"); endif endmethod method show_cmd var r, what; ignore E_SERVERDN, E_METHODNF, E_OBJNF; if (caller != this) return 1; elseif (!args[2]) echo("Usage: @show <object>"); return 0; endif what = this.match_env(args[2]); if (!what || what.name == E_OBJNF) echo("I don't see that here."); else r = what.show(args[1], args[2]); if (r == E_SERVERDN || r == E_METHODNF) echo("You can't show that."); endif endif endmethod method verbs_cmd var what, v; if (caller != this) return 1; elseif(!args[2]) echo("Usage: @verbs <object>"); return 0; endif what = this.match_env(args[2]); if (!what) echo("I don't see that here."); else for v in (what.verbs) if (v[2]) echo(" " + v[1] + " : " + v[2] + " = " + v[3]); else echo(" " + v[1] + " = " + v[3]); endif endfor echo("---"); endif endmethod endobject # 1 "bin/programmer.cl" # 1 "<built-in>" # 1 "<command line>" # 1 "bin/programmer.cl" # 1 "bin/boot.clh" 1 # 2 "bin/programmer.cl" 2 object #10 parents #9; name = "Generic Programmer"; obj prog_obj; str prog_method; verb "eval" = eval_cmd; verb "@prog*ram" = program_cmd; verb "@prog*ram" : "on" = program_cmd; verb "@ps" = ps_cmd; verb "@kill" = kill_cmd; verb "@verb" = verb_cmd; verb "@verb" : "on" = verb_cmd; verb "@rmv*erb" = rmverb_cmd; verb "@rmv*erb" : "on" = rmverb_cmd; verb "@rmm*ethod" = rmmethod_cmd; verb "@rmm*ethod" : "on" = rmmethod_cmd; verb "@rmva*r" = rmvar_cmd; verb "@rmva*r" : "on" = rmvar_cmd; method init if (this == #10) this.add_owner(#11); else pass(); endif endmethod method eval_cmd if (caller != this) return 1; endif if (!compile(this, "eval_tmp", args[2])) echo("--> " + tostr(this.eval_tmp())); rm_method("eval_tmp"); endif endmethod method program_cmd var what; ignore E_METHODNF; if (caller != this) return 1; elseif (!args[2] && !args[3]) echo("Entering programming mode. Use \".\" to end"); prog_obj = #-1; this.input_to("done_programming"); elseif (!args[2] || !args[3]) echo("Usage: @program <method> on <object>"); echo(" @program"); else what = this.match_env(args[4]); if (!what) echo("I don't see that here."); else prog_obj = what; prog_method = args[2]; echo("Programming " + args[2] + " on " + what.id); echo("Entering programming mode. Use \".\" to end"); this.input_to("done_programming"); endif endif endmethod method done_programming if (prog_obj == #-1) compile(args[1]); else if (!compile(prog_obj, prog_method, args[1])) echo("Method programmed."); endif endif endmethod method verb_cmd var r, newargs, what, prep; if (caller != this) return 1; endif newargs = explode(args[2]); if (!args[2] || !args[3] || !args[4] || (lengthof(newargs)) < 2 || (lengthof(newargs) > 3)) echo("Usage: @verb <verb> <method-to-call> on <obj>"); echo(" @verb <verb> <preposition> <method-to-call> on <obj>"); return 0; endif what = this.match_env(args[4]); if (!what) echo("I don't see that here."); return 0; elseif (lengthof(newargs) == 2) r = what.add_verb(newargs[1], "", newargs[2]); else r = what.add_verb(newargs[1], newargs[2], newargs[3]); endif if (r == E_PERM) echo("Permission denied."); else echo("Verb added."); endif return 0; endmethod method rmverb_cmd var what; if (caller != this) return 1; endif if (!args[2] || !args[3] || !args[4]) echo("Usage: @rmverb <verb> on <obj>"); return 0; endif what = this.match_env(args[4]); if (!what) echo("I don't see that here."); elseif (what.rm_verb(args[2]) == E_PERM) echo("Permission denied."); else echo("Verb removed."); endif return 0; endmethod method rmmethod_cmd var r, what; ignore E_PERM, E_METHODNF; if (caller != this) return 1; endif if (!args[2] || !args[3] || !args[4]) echo("Usage: @rmmethod <method> on <obj>"); return; endif what = this.match_env(args[4]); if (!what) echo("I don't see that here."); else r = what.rm_method(args[2]); if (typeof(r) == ERR) echo(tostr(r)); else echo("Method removed."); endif endif return 0; endmethod method rmvar_cmd var r, what; ignore E_PERM, E_VARNF; if (caller != this) return 1; endif if (!args[2] || !args[3] || !args[4]) echo("Usage: @rmvar <var> on <obj>"); return; endif what = this.match_env(args[4]); if (!what) echo("I don't see that here."); else r = what.rm_var(args[2]); if (typeof(r) == ERR) echo(tostr(r)); else echo("Variable removed."); endif endif return 0; endmethod method ps_cmd var i, line, task; echo("PID PLAYER METHOD STATUS"); for task in (ps()) if (task[4] != this && !("a" in args[2])) continue; endif line = pad(tostr(task[1]),7) + " " + pad(task[4].id, 15) + " " + pad(tostr(task[6]) + "." + task[9], 15) + " "; if (task[10] == 0) line = line + "MSG "; elseif (task[10] == 1) line = line + "LOCK "; elseif (task[10] == 2) line = line + "TIMER "; elseif (task[10] == 3) line = line + "SYS_MSG"; endif echo(line); endfor endmethod method kill_cmd var r, pid; ignore E_PERM; pid = tonum(args[2]); r = kill(pid); if (r == E_PERM); echo("Permission denied."); elseif (r != 0) echo("No such process."); else echo("Killed."); endif endmethod endobject # 1 "bin/wizard.cl" # 1 "<built-in>" # 1 "<command line>" # 1 "bin/wizard.cl" # 1 "bin/boot.clh" 1 # 2 "bin/wizard.cl" 2 object #11 parents #10; verb "@wiz*ard" = wiz_cmd; verb "@dewiz*ard" = dewiz_cmd; verb "@force" : "to" = force_cmd; verb "@force" = force_cmd; verb "@mem" = mem_cmd; verb "@cachestats @cache_stats @cs" = cachestats_cmd; verb "@vis*itors" = visitors_cmd; verb "@boot" = boot_cmd; verb "@shout" = shout_cmd; verb "@shutdown" = shutdown_cmd; method init if (this == #11) name = "Wizard"; password = "83pil1MP02An."; desc = "A short, aged guy with a pointy hat."; this.add_owner(#11); endif pass() to #8; endmethod method cachestats_cmd echo(cache_stats()); endmethod method wiz_cmd var who; if (caller != this) return 1; elseif(!args[2]) echo("Usage: @wizard <player>"); return 0; endif who = #0 .find_player(args[2]); if (!who) echo("I couldn't find that player."); elseif (who in #0 .wizards) echo(who.name + " is already a wizard."); elseif (!(who in #0 .players)) echo("That's not a player."); else #0 .add_wizard(who); endif endmethod method dewiz_cmd var who; if (caller != this) return 1; elseif(!args[2]) echo("Usage: @dewizard <player>"); return 0; endif who = #0 .find_player(args[2]); if (!who) echo("I couldn't find that player."); elseif (!(who in #0 .wizards)) echo("That's not a wizard."); elseif (who == player) echo("You can't dewiz yourself; ask another wizard."); else #0 .rm_wizard(who); endif endmethod method force_cmd var who; if (caller != this) return 1; elseif (!args[2] || !args[3] || !args[4]) echo("Usage: @force <player> to <cmd>"); return 0; endif who = this.match_env(args[2]); if (!who) echo("Force whom?"); else player = who; player.parse(args[4]); endif endmethod method mem_cmd if (caller != this) return 1; endif echo(checkmem()); endmethod method visitors_cmd var item, id; ignore E_SERVERDN; if (caller != this) return 1; endif echo("Remote objects:"); for item in (#0 .visitors()) id = item[1].id; if (id == E_SERVERDN) echo("(Ghost of " + tostr(item[1]) + ") is in " + item[2].id); else echo(item[1].id + " is in " + item[2].id); endif endfor echo("---"); endmethod method boot_cmd var who; if (caller != this) return 1; elseif (!args[2]) echo("Usage: @boot <player>"); return 0; endif who = #0 .find_connected_player(args[2]); if (!who) echo("That player is not connected."); else if (who.quit_cmd()) echo("You can't boot that player."); else echo("Player booted."); endif endif endmethod method shout_cmd var dude, msg; if (caller != this) return 1; endif msg = name + " shouts, \"" + args[2] + "\""; for dude in (#0 .connected_players) dude.tell(msg); endfor endmethod method shutdown_cmd if (caller != this) return 1; endif writelog("SHUTDOWN by " + this.id); shutdown(); endmethod endobject # 1 "bin/west.cl" # 1 "<built-in>" # 1 "<command line>" # 1 "bin/west.cl" # 1 "bin/boot.clh" 1 # 2 "bin/west.cl" 2 # 1 "bin/common.clh" 1 # 3 "bin/west.cl" 2 object #12@west parents #6; name = "Western Room"; desc = "Y'all are in the western room, cowboy."; exits = { #13@west }; method init this.add_owner(#11); endmethod endobject object #13@west parents #7; name = "e;east"; leave = "You go east."; oleave = "%n goes east."; oarrive = "%n comes in from the west."; source = #12@west; dest = #12@east; method init this.add_owner(#11); endmethod endobject object #14@west parents #4; home = #12@west; name = "a punching bag"; desc = "A punching bag with a picture of Brian Mulroney taped to it."; verb "hit punch smack whomp sock" = hit; method init this.moveto(home); this.add_owner(#11); endmethod method sdesc return ("There is " + name + " here, just waiting to be hit."); endmethod method hit if (!this.match(args[2])) return 1; endif player.tell("You sock the punching bag on da nose! How satisfying."); location.announce(player.name + " socks the punching bag on da nose!", {player}); at (time() + 5) location.announce("The punching bag winds up..", {}); endat at (time() + 10) if (player.location == location) player.tell("The punching bag whomps you on da shnozz!"); location.announce("The punching bag whomps " + player.name + " on da shnozz!", {player}); else location.announce("The punching bag appears confused, as " + player.name + " has left the room.", {}); endif endat endmethod endobject object #15@west parents #5; name = "a brown paper bag"; desc = "A very ordinary-looking brown paper bag."; home = #12@west; method init this.add_owner(#11); this.moveto(home); endmethod endobject