2000 @verb #7165:"@d-old" any none none rdo #55 @program #7165:"@d-old" any none none "Copied from Generic Builder (#13):@d by Slacker (#55)Jul 15 02:37:42 1998" "@display [.[property]]*[,[inherited_property]]*[:[verb]]*[;[inherited_verb]]*[![file]]*" "null names for properties and verbs are interpreted as meaning all of them." if (player != this) return $msg:mtell("huh") endif player:isa($guardian) || set_task_perms(player) opivuf = {{}, {}, {}, {}, {}, {}} string = "" punc = 1 literal = 0 argstr = $string_utils:trimr(argstr) for jj in [1..length(argstr)] j = argstr[jj] if (literal) string = string + j literal = 0 elseif (j == "\\") literal = 1 elseif (j == "." && punc == 6) "File names can contain periods. Thanks Hobbes (#9299)" string = string + j elseif (y = index(".,:;!", j)) opivuf[punc] = {@opivuf[punc], string} punc = 1 + y string = "" else string = string + j endif endfor opivuf[punc] = {@opivuf[punc], string} "1. Find the object" objname = opivuf[1][1] it = this:my_match_object(objname) if (!valid(it) && string == objname && (spec = $code_utils:parse_verbref(objname))) "Simple hack to allow $verbs. spec = {'#0', 'verb'}" "Also allows $props that aren't obj numbers." if (spec[1] != "#0") return player:notify("There is a bug in @d. Tell a wizard what you did.") elseif ($has_property(spec[2])) opivuf = {{"#0"}, {spec[2]}, {}, {}, {}} punc = 2 elseif ($has_verb(spec[2])) opivuf = {{"#0"}, {}, {}, {spec[2]}, {}} punc = 4 else return player:tell("No such property or verb, \"", spec[2], "\" on #0") endif string = spec[2] objname = "#0" it = #0 elseif ($command_utils:object_match_failed(it, objname)) return endif readable = `properties(it) ! E_PERM' != E_PERM cant = {} "3. Verify all the inherited properties." specific_prop = {} inh = {} if ("" in opivuf[3]) for what in ({it, @$object_utils:ancestors(it)}) if ((cache = `properties(what) ! E_PERM') != E_PERM) for x in (cache) inh = {@inh, {what, x}} endfor else cant = setadd(cant, what) endif endfor "We already have all the props." opivuf[2] = {} else specific_prop = {@specific_prop, @opivuf[3]} endif "2. Verify all the defined properties." prop = {} if ("" in opivuf[2]) if (readable) prop = properties(it) else cant = setadd(cant, it) endif what = it if (!this:display_option("thisonly")) while (!prop && valid(what = parent(what))) if ((cache = `properties(what) ! E_PERM') != E_PERM) prop = cache else cant = setadd(cant, what) endif endwhile endif for n in [1..length(prop)] prop[n] = {what, prop[n]} endfor else specific_prop = {@specific_prop, @opivuf[2]} endif "These properties were specifically asked for by name." for x in (specific_prop) if (y = it:property_location(x)) if (y[1] == it) prop = setadd(prop, {it, x}) else inh = setadd(inh, {y[1], x}) endif else this:notify(tostr("No such property, \"", x, "\"")) endif endfor "5. Verify all the inherited verbs." specific_verb = {} vrb = {} if ("" in opivuf[5]) for what in ({it, @it:ancestors()}) if ((cache = `verbs(what) ! E_PERM') != E_PERM) for n in [1..length(cache)] vrb = setadd(vrb, {what, n}) endfor else cant = setadd(cant, what) endif endfor "We already have all the verbs." opivuf[4] = {} else specific_verb = {@specific_verb, @opivuf[5]} endif "4. Verify all the defined verbs." if ("" in opivuf[4]) if (readable) vrb = verbs(it) else cant = setadd(cant, it) endif what = it if (!this:display_option("thisonly")) while (!vrb && valid(what = parent(what))) if ((cache = `verbs(what) ! E_PERM') != E_PERM) vrb = cache else cant = setadd(cant, what) endif endwhile endif for n in [1..length(vrb)] vrb[n] = {what, n} endfor else specific_verb = {@specific_verb, @opivuf[4]} endif for x in (specific_verb) if (y = it:has_verb(x)) vrb = setadd(vrb, {y[1], x}) else this:notify(tostr("No such verb, \"", x, "\"")) endif endfor "6. Verify all the files." file = {} if ("" in opivuf[6]) if (readable) for x in (it:filelist()) file = {@file, {it, x}} endfor else cant = setadd(cant, it) endif what = it else for x in (opivuf[6]) if (it:fileexists(x)) file = setadd(file, {it, x}) else this:notify(tostr("No such file, \"", x, "\"")) endif endfor endif "Print general information." if ({""} in opivuf || opivuf[2..6] == {{}, {}, {}, {}, {}}) this:notify(tostr(it.name, " (", it, ") [ ", it.r ? "readable " | "", it.w ? "writable " | "", it.f ? "fertile " | "", is_player(it) ? "(player) " | "", it.programmer ? "programmer " | "", it.wizard ? "wizard " | "", "]")) if (it.owner != (is_player(it) ? it | this)) this:tell(" Owned by ", valid(p = it.owner) ? p.name | "** extinct **", " (", p, ").") endif this:tell(" Child of ", valid(p = parent(it)) ? p.name | "** none **", " (", p, ").") if (it.location != $nothing) this:tell(" Location ", valid(p = it.location) ? p.name | "** unplace **", " (", p, ").") endif endif "Print the verbs." blankargs = this:display_option("blank_tnt") ? {"this", "none", "this"} | #-1 for b in (vrb) $command_utils:suspend_if_needed() {where, q} = b if (typeof(q) == $STR) short = strsub(y = index(q, " ") ? q[1..y - 1] | q, "*", "") else short = q endif inf = `verb_info(where, short) ! E_PERM' if (typeof(inf) == $LIST || inf == E_PERM) name = typeof(inf) == $LIST ? inf[3] | tostr(q) name = index(name, " ") ? "\"" + name + "\"" | name line = $string_utils:left(tostr($string_utils:right(tostr(where), 6), ":", $html_utils:literal_text(name), " "), 32) if (inf == E_PERM) line = line + " ** unreadable **" else inf[2] = inf[2] + " " inf[2][1] != "r" && (inf[2][1..0] = " ") "(inf[2][2] != \"w\") && (inf[2][2..1] = \" \");" inf[2][2] != "x" && (inf[2][2..1] = " ") inf[2][3] != "d" && (inf[2][3..2] = " ") line = $string_utils:left(tostr(line, $string_utils:nn(inf[1]), " "), 53) + inf[2][1..5] vargs = verb_args(where, short) if (vargs != blankargs) if (this:display_option("shortprep") && !(vargs[2] in {"any", "none"})) vargs[2] = $code_utils:short_prep(vargs[2]) endif line = $string_utils:left(line + " ", 60) + $string_utils:from_list(vargs, " ") endif endif this:notify(line) else this:notify("There is a bug in @d. Tell a wizard what you did.") endif endfor "Print the props." all = {@prop, @inh} max = length(all) < 4 ? 999 | this:linelength() - 56 depth = length(all) < 4 ? -1 | 1 truncate_owner_names = length(all) > 1 for b in (all) $command_utils:suspend_if_needed() {where, q} = b inf = `property_info(it, q) ! E_PERM, E_PROPNF' if (!player.wizard && (typeof(inf) == $LIST && inf[1].wizard) && !index(inf[2], "r")) "Guardians may see -r props, but not if they are wiz owned." inf = E_PERM endif if (inf == E_PROPNF) if (q in $code_utils.builtin_props) prop_data = it.(q) this:notify(tostr($string_utils:left("," + q, 25), "Built in property ", length(y = $string_utils:from_value(prop_data, 1, depth)) > max ? y[1..max] + ".." | y)) else this:notify("There is a bug in @d. Tell a wizard what you did.") endif else pname = $string_utils:left(tostr($string_utils:right(tostr(where), 6), it == where ? "." | (inf != E_PERM && is_clear_property(it, q) ? " " | ","), $html_utils:literal_text(q), " "), 25) if (inf == E_PERM) this:notify(pname + " ** unreadable **") else oname = $msg:get_language(inf[1]:title()) truncate_owner_names && (length(oname) > 12 && (oname = oname[1..12])) inf[2] = inf[2] + " " 57c inf[2][1] != "r" && (inf[2][1..0] = " ") "(inf[2][2] != \"w\") && (inf[2][2..1] = \" \");" prop_data = it.(q) typeof(prop_data) == $LIST && length(prop_data) > 100 && (prop_data = prop_data[1..100]) this:notify($string_utils:left(tostr($string_utils:left(tostr(pname, oname, " (", inf[1], ") "), 47), inf[2][1..3], " "), 54) + (length(y = $string_utils:from_value(prop_data, 1, depth)) > max ? y[1..max] + ".." | y)) endif endif endfor "Print the files." for b in (file) $command_utils:suspend_if_needed() {where, q} = b "This file should exist (unless it was deleted while we were suspended...)." perms = (it:fileaccess(q) + " ")[1] bytes = $string_utils:group_number(it:filesize(q)) + " bytes" fname = $string_utils:left(tostr($string_utils:right(tostr(where), 6), "!", $html_utils:literal_text(q), " "), 40) this:notify(tostr(fname, perms, $string_utils:right(bytes, 16))) endfor "Gripe about not being able to read various -r objects" if (cant) failed = {} for k in (cant) failed = listappend(failed, tostr(k.name, " (", k, ")")) endfor this:notify($string_utils:centre(tostr(" no permission to read ", $string_utils:english_list(failed, ", ", " or ", " or "), ". "), 75, "-")) else this:notify($string_utils:centre(" finished ", 75, "-")) endif "Last modified by Dax (#789) on Sat May 21 03:39:56 2005 MDT." . 0