View/Edit #12:set_aliases _set_aliases

Switch to edit mode.

Name(s): set_aliases _set_aliases
1:  "set_aliases(alias_list)"
2:  "For changing player aliases, we check to make sure that none of the aliases match existing player names/aliases.  Aliases containing spaces are not entered in the $player_db and so are not subject to this restriction ($string_utils:match_player will not match on them, however, so they only match if used in the immediate room, e.g., with match_object() or somesuch)."
3:  "Also we make sure that the .name is included in the .alias list.  In any situation where .name and .aliases are both being changed, do the name change first."
4:  "  => E_PERM   if you don't own this"
5:  "  => E_NACC   if the player database is not taking new aliases right now."
6:  "  => E_TYPE   if alias_list is not a list"
7:  "  => E_QUOTA  if alias_list is stupidly long"
8:  "  => E_INVARG if any element of alias_list is not a string"
9:  if (!$perm_utils:controls(caller_perms(), this) && !(this == caller))
10:   raise(E_PERM)
11: elseif (!is_player(this))
12:   "we don't worry about the names of player classes."
13:   return pass(@args)
14:   "This used to be 'raise(pass(@args))', if you see need to change it back, do so.  - Lao (900602760) "
15: elseif ($player_db.frozen)
16:   raise(E_NACC)
17: elseif (typeof(aliases = args[1]) != $LIST)
18:   raise(E_TYPE)
19: elseif (!caller_perms().wizard && length(aliases) > $max_num_aliases && length(aliases) > length(this.aliases))
20:   raise(E_QUOTA)
21:   "Only those with Multiple Personality Disorder need more than 'n' aliases!"
22: else
23:   r = {}
24:   for a in (aliases)
25:     typeof(a) == $STR || raise(E_INVARG)
26:     if (index(a, " ") || !($player_db:available(a) in {this, 1}) || (length(a) <= 1 && a != this.name))
27:       r = setadd(r, tostr(a, " is not an available alias, ", $player_db:why_not_available(a)))
28:       aliases = setremove(aliases, a)
29:     endif
30:   endfor
31:   aliases = setadd(aliases, this.name)
32:   old = this.aliases
33:   this.aliases = aliases
34:   for a in (old)
35:     if (!(a in aliases))
36:       $player_db:delete2(a, this)
37:     endif
38:   endfor
39:   for a in (aliases)
40:     if (!index(a, " "))
41:       $player_db:insert(a, this)
42:     endif
43:   endfor
44:   return r || 1
45: endif
46: "Last modified by Dax (#789) on Wed May  4 06:45:59 2005 MDT."

Verb arguments: this none this
Verb perms: Readable eXecutable NOT-Debug
Verb owned by: Slacker (#55)

You are not logged in.

[home | help | who | search | setup | code]