Switch to edit mode.
Name(s): @grant @grants* @transfer*e1: "Copied from Generic Wizard (#58):@grant by Slacker (#2) Aug 19 03:36:35 1996"
2: "@grant <object> to <player>"
3: "@grants <object> to <player> --- same as @grant but may suspend."
4: "@transfer <expression> to <player> -- like 'grant', but evalutes a possible list of objects to transfer, and modifies quota."
5: "Ownership of the object changes as in @chown and :set_owner (i.e., .owner and all c properties change). In addition all verbs and !c properties owned by the original owner change ownership as well. Finally, for !c properties, instances on descendant objects change ownership (as in :set_property_owner)."
6: if (!iobjstr || !dobjstr)
7: return player:notify(tostr("Usage: ", verb, " <object> to <player>"))
8: endif
9: if ($command_utils:player_match_failed(newowner = $string_utils:match_player(iobjstr), iobjstr))
10: "...newowner is bogus..."
11: return
12: endif
13: if ($command_utils:player_match_failed(dobj = player:my_match_object(dobjstr), dobjstr))
14: return
15: endif
16: iobj = newowner
17: if (player != this || (!$perm_utils:controls(player, iobj) && !$perm_utils:controls(player, iobj.owner)) || (!$perm_utils:controls(player, dobj) && !$perm_utils:controls(player, dobj.owner)))
18: player:notify("Sorry.")
19: return
20: endif
21: if (verb == "@transfer")
22: objlist = $no_one:eval_cmd_string(dobjstr, 0)
23: if (!objlist[1])
24: player:notify(tostr("Had trouble reading `", dobjstr, "': "))
25: player:notify(@objlist[2])
26: return
27: elseif (typeof(objlist[2]) == $OBJ)
28: objlist = objlist[2..2]
29: elseif (typeof(objlist[2]) != $LIST)
30: player:notify(tostr("Value of `", dobjstr, "' is not an object or list: ", toliteral(objlist[2])))
31: return
32: else
33: objlist = objlist[2]
34: endif
35: elseif ($command_utils:object_match_failed(object = this:my_match_object(dobjstr), dobjstr))
36: "...object is bogus..."
37: return
38: else
39: objlist = {object}
40: endif
41: if (newowner:free_objects() < length(objlist))
42: player:tell("Sorry, ", $string_utils:nn(newowner), " doesn't have enough quota.")
43: return
44: endif
45: suspendok = verb != "@grant"
46: player:tell("Transfering ", toliteral(objlist), " to ", $string_utils:nn(newowner))
47: set_task_perms(player)
48: for object in (objlist)
49: errcode = $wiz_utils:grant(object, newowner, suspendok)
50: if (errcode == E_QUOTA)
51: return player:sub_tell("%1 ran out of %2 quota at object %3.", newowner:title(), newowner:_get_max_obj() ? "byte" | "object", $string_utils:nn(object))
52: elseif (errcode == E_NONE)
53: player:sub_tell("%1 already owned everything %2 was entitled to on %3.", newowner:title(), $cecil_utils:pronoun(newowner, "he"), object:title())
54: else
55: player:sub_tell("%1 transferred to %2 successfully.", object, newowner)
56: endif
57: endfor
58: "Last modified by Dax (#789) on Wed May 4 06:46:00 2005 MDT."