Core Object-Quota Utilities (#325)

(an instance of Generic Utilities Package made by Quota)

     This is the default package that interfaces to the $player/$prog quota manipulation verbs.

Go to location of this object, Quota.



VERB SOURCE CODE:

initialize_quota:
if (!caller_perms().wizard)
    return E_PERM;
else
    args[1].ownership_quota = $wiz_utils.default_player_quota;
endif
.


init_for_core:
if (!caller_perms().wizard)
    return E_PERM;
else
    $quota_utils = this;
endif
.


adjust_quota_for_programmer:
if (!caller_perms().wizard)
    return E_PERM;
else
    victim = args[1];
    oldquota = victim.ownership_quota;
    if ($object_utils:has_property($local, "second_char_registry") && $local.second_char_registry:is_second_char(victim))
        "don't increment quota for 2nd chars when programmering";
        victim.ownership_quota = oldquota;
    else
        victim.ownership_quota = oldquota + ($wiz_utils.default_programmer_quota 
- $wiz_utils.default_player_quota);
    endif
endif
.


bi_create:
"Calls built-in create.";
set_task_perms(caller_perms());
return create(@args);
.


creation_permitted:
return args[1].ownership_quota > 0;
.


verb_addition_permitted property_addition_permitted:
return 1;
.


display_quota:
who = args[1];
if (caller_perms() == who)
    q = who.ownership_quota;
    total = (typeof(who.owned_objects) == LIST) ? length(setremove(who.owned_objects, 
who)) | 0;
    if (q == 0)
        player:tell(tostr("You can't create any more objects", (total < 1) ? "." 
| tostr(" until you recycle some of the ", total, " you already own.")));
    else
        player:tell(tostr("You can create ", q, " new object", (q == 1) ? "" | "s", 
(total == 0) ? "." | tostr(" without recycling any of the ", total, " that you already 
own.")));
    endif
else
    if ($perm_utils:controls(caller_perms(), who))
        player:tell(tostr(who.name, "'s quota is currently ", who.ownership_quota, 
"."));
    else
        player:tell("Permission denied.");
    endif
endif
.


get_quota quota_remaining:
if ($perm_utils:controls(caller_perms(), args[1]) || (caller == this))
    return args[1].ownership_quota;
else
    return E_PERM;
endif
.


charge_quota:
"Charge args[1] for the quota required to own args[2]";
if ((caller == this) || caller_perms().wizard)
    args[1].ownership_quota = args[1].ownership_quota - 1;
else
    return E_PERM;
endif
.


reimburse_quota:
"Reimburse args[1] for the quota required to own args[2]";
if ((caller == this) || caller_perms().wizard)
    args[1].ownership_quota = args[1].ownership_quota + 1;
else
    return E_PERM;
endif
.


set_quota:
"Set args[1]'s quota to args[2]";
if (caller_perms().wizard || (caller == this))
    return args[1].ownership_quota = args[2];
else
    return E_PERM;
endif
.


preliminary_reimburse_quota:
return 0;
.


can_peek:
"Is args[1] permitted to examine args[2]'s quota information?";
return $perm_utils:controls(args[1], args[2]);
.


can_touch:
"Is args[1] permitted to examine args[2]'s quota information?";
return args[1].wizard;
.



PROPERTY DATA:
      byte_based