Size-Prospectus FO (#542)

(an instance of Generic Feature Object made by Dred)

     A feature for @auditing players including the sizes of each objects, the number of verbs, and whether they have kids.

Go to location of this object, Features Feature Object.


HELP MANUAL:
     Simple feature, one verb: @ps  shows an audit of them including object sizes.



VERB SOURCE CODE:

@size-prospectus @sp @sp-sum @ps:
"@sp ";
"@sp-sum ";
"  an elaborate 'prospectus' of a player's objects, including their sizes:";
"  The first column is the size of the each object in kilobytes (rounded)";
"  See `help @prospectus' for what the rest of the columns mean.";
"The last line shows the total size of the player's objects.";
"Sizes aren't recomputed, rather it just shows the oldest time.";
"@sp  ";
"  will update any size information  or more days old, so";
"   @sp  1";
"  will give recent size information";
"@sp-sum is an abbreviated display which only shows totals of objects that have no 
verbs or children.";
if (!args)
    who = player;
else
    who = $string_utils:match_player(args[1]);
    if ($command_utils:player_match_result(who, args[1])[1])
        return;
    endif
endif
if (length(args) > 1)
    days = tonum(args[2]) || 5;
else
    days = 100;
endif
player:tell("Objects owned by ", who.name, ": ");
count = 0;
sum = 0;
minage = $maxint;
ecounts = {};
summary = verb == "@sp-sum";
ll = player:linelen();
for o in (who.owned_objects)
    $command_utils:suspend_if_needed(3);
    sz = $quota_utils:recent_object_bytes(o, days);
    count = count + 1;
    sum = sum + sz;
    if (summary && this:ignorable(o))
        if (which = $list_utils:iassoc(parent(o), ecounts))
            ecounts[which][2] = ecounts[which][2] + 1;
            ecounts[which][3] = ecounts[which][3] + sz;
        else
            ecounts[0..0] = {{parent(o), 1, sz}};
        endif
    else
        oas = $building_utils:object_audit_string(o, 1);
        szstr = $string_utils:right((sz + 500) / 1000, 4);
        minage = min(((o.object_size[2] + 1) || 1) - 1, minage);
        if (length(oas) >= (ll - 5))
            oas = oas[1..ll - 5];
        endif
        player:tell(szstr, " ", oas);
    endif
endfor
if (ecounts)
    player:tell("- sz - cnt -- children of these objects --");
    for x in (ecounts)
        $command_utils:suspend_if_needed(3);
        player:tell($string_utils:right((x[3] + 500) / 1000, 4), $string_utils:right(x[2], 
4), " ", $string_utils:nn(x[1]));
    endfor
endif
player:tell($string_utils:left(tostr("-- ", count, " object", (count == 1) ? ", " 
| "s, ", (sum + 500) / 1000, "K (", (((time() - minage) / 60) / 60) / 24, " max days 
old size info)"), ll - 1, "-"));
.


ignorable:
what = args[1];
return ((((!children(what)) && (!what.r)) && (!what.f)) && (!verbs(what))) && ((!properties(what)) 
&& (length(children(parent(what))) > 2));
.


@kidsizes:
sum = 0;
if ((!valid(dobj)) && (!valid(dobj = player:match_oject(dobjstr))))
    player:tell("I don't know what ", dobjstr, " is.");
    return;
endif
if (!(objs = $object_utils:descendents_suspended(dobj)))
    player:tell($string_utils:nn(dobj), " has no kids.");
else
    for x in (objs)
        $command_utils:suspend_if_needed(0);
        sum = sum + $quota_utils:recent_object_bytes(x, 14);
    endfor
    player:tell("The ", length(objs), " kids of ", $string_utils:nn(dobj), " take 
", sum, " bytes");
endif
.



PROPERTY DATA:
      exceptions