Player Database #39
Aliases: Player Database, player_db, plyrdb, pdb
7 verbs · 13 properties · 0 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
load | this none this | rxd | #39 | 39 |
check | this none none | rxd | #39 | 18 |
init_for_core | this none this | rxd | #39 | 5 |
available | this none this | rxd | #39 | 16 |
suspend_restart | this none this | rxd | #39 | 16 |
why_bad_name | this none this | rxd | #39 | 26 |
insert | this none this | rxd | #39 | 3 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
stupid_names | #39 | rc | #36 | list of 28{"with", "using", "at", "to", "in", "into", "on", "onto", "upon", "out", "from", "inside", "over", "through", "under", "underneath", "beneath", "behind", "beside", "for", "about", "is", "as", "off", "of", "me", "you", "here"} |
frozen | #39 | rc | #36 | 0 |
reserved | #39 | r | #36 | {} |
H | #39 | r | #36 | {"", "", {"Hacker", "housekeeper"}, {#36, #71}} |
e | #39 | r | #36 | {"very", "", {"everyone", "Everyman"}, {#38, #38}} |
n | #39 | r | #36 | {"o", "", {"noone", "no_one"}, {#38, #38}} |
node_perms | #37 | rc | #36 | <clear> |
data | #37 | r | #36 | <clear> |
| #37 | | #36 | {"", "Hen", {"Wizard"}, {#2}} |
key | #1 | c | #36 | <clear> |
aliases | #1 | rc | #36 | {"Player Database", "player_db", "plyrdb", "pdb"} |
description | #1 | rc | #36 | {"A database containing all player names and aliases. ", "See `help $player_db' for more information."} |
object_size | #1 | r | #36 | {9983, -1090650497} |
Ancestry
Ancestors (nearest first): #37 Generic Database → #1 Root Class
Children: none
Call graph
Source
load
Referenced by
- #39:init_for_core line 4:
this:load - #39:suspend_restart line 12:
this:load
Source
1":load() -- reloads the player_db with the names of all existing players."; 2"This routine calls suspend() if it runs out of time."; 3".frozen is set to 1 while the load is in progress so that other routines are warned and don't try to do any updates. Sometimes, an update is unavoidable (e.g., player gets recycled) in which case the offending routine should set .frozen to 2, causing the load to start over at the beginning."; 4if ((caller != this) && (!$perm_utils:controls(caller_perms(), this))) 5return E_PERM; 6endif 7"...N.B. clearall suspends, therefore we put the .frozen mark on FIRST..."; 8this.frozen = 1; 9this:clearall(); 10for p in (players()) 11this:suspend_restart(p); 12"... note that if a player is recycled or toaded during the suspension,..."; 13"... it won't be removed from the for loop iteration; thus this test: "; 14if (valid(p) && is_player(p)) 15if (typeof(po = this:find_exact(p.name)) == ERR) 16player:tell(p.name, ": ", po); 17return; 18elseif (po != p) 19if (valid(po) && is_player(po)) 20player:tell("name `", p.name, "' for ", p, " subsumes alias for ", po.name, "(", po, ")."); 21endif 22this:insert(p.name, p); 23endif 24for a in (p.aliases) 25this:suspend_restart(p); 26if (index(a, " ") || index(a, " ")) 27"don't bother, space or tab"; 28elseif (typeof(ao = this:find_exact(a)) == ERR) 29player:tell(a, ": ", ao); 30return; 31elseif (!(valid(ao) && is_player(ao))) 32this:insert(a, p); 33elseif (ao != p) 34player:tell("alias `", a, "' for ", p.name, "(", p, ") used by ", ao.name, "(", ao, ")."); 35endif 36endfor 37endif 38endfor 39this.frozen = 0;
check
Referenced by
none
Source
1":check() -- checks for recycled and toaded players that managed not to get expunged from the db."; 2for p in (properties($player_db)) 3if ((ticks_left() < 500) || (seconds_left() < 2)) 4player:tell("...", p); 5suspend(0); 6endif 7if (p[1] == " ") 8nlist = this.(p)[3]; 9olist = this.(p)[4]; 10for i in [1..length(nlist)] 11if (valid(olist[i]) && (is_player(olist[i]) && (nlist[i] in olist[i].aliases))) 12else 13player:tell(".", p[2..$], " <- ", nlist[i], " ", olist[i]); 14endif 15endfor 16endif 17endfor 18player:tell("done.");
init_for_core
Referenced by
none
Source
1if (caller_perms().wizard) 2pass(); 3this.reserved = {}; 4this:load(); 5endif
available
Referenced by
- #6:set_name line 16:
$player_db:available - #6:set_aliases line 26:
$player_db:available - #10:cr*eate line 23:
$player_db:available - #24:set_player line 15:
$player_db:available - #24:set_player line 31:
$player_db:available - #24:check_player_request line 25:
$player_db:available - #57:@make-guest line 13:
$player_db:available - #57:@make-guest line 22:
$player_db:available - #57:@make-guest line 25:
$player_db:available
Source
1":available(name,who) => 1 if a name is available for use, or the object id of whoever is currently using it, or 0 if the name is otherwise forbidden."; 2"If $player_db is not .frozen and :available returns 1, then $player:set_name will succeed."; 3{name, ?target = valid(caller) ? caller | player} = args; 4if ((name in this.stupid_names) || (name in this.reserved)) 5return 0; 6elseif (((((!name) || index(name, " ")) || index(name, "\\")) || index(name, "\"")) || index(name, " ")) 7return 0; 8elseif (index("*#()", name[1])) 9return 0; 10elseif (valid(who = this:find_exact(name)) && is_player(who)) 11return who; 12elseif ($object_utils:has_callable_verb($local, "legal_name") && (!$local:legal_name(name, target))) 13return 0; 14else 15return 1; 16endif
suspend_restart
Referenced by
Source
1"used during :load to do the usual out-of-time check."; 2"if someone makes a modification during the suspension (indicated by this.frozen being set to 2), we have to restart the entire load."; 3if (caller != this) 4return E_PERM; 5elseif ($command_utils:running_out_of_time()) 6player:tell("...", args[1]); 7set_task_perms($byte_quota_utils:task_perms()); 8suspend(0); 9if (this.frozen != 1) 10player:tell("...argh... restarting $player_db:load..."); 11fork (0) 12this:load(); 13endfork 14kill_task(task_id()); 15endif 16endif
why_bad_name
Referenced by
- #6:@rename*# line 80:
$player_db:why_bad_name
Source
1":why_bad_name(player, namespec) => Returns a message explaining why a player name change is invalid. Stolen from APHiD's #15411:name_okay."; 2who = args[1]; 3name = $building_utils:parse_names(args[2])[1]; 4si = index(name, " "); 5qi = index(name, "\""); 6bi = index(name, "\\"); 7ti = index(name, " "); 8if ((si || qi) || bi) 9return tostr("You may not use a name containing ", $string_utils:english_list({@si ? {"spaces"} | {}, @qi ? {"quotation marks"} | {}, @bi ? {"backslashes"} | {}, @ti ? {"tabs"} | {}}, "ERROR", " or "), ". Try \"", strsub(strsub(strsub(name, " ", "_"), "\"", "'"), "\\", "/"), "\" instead."); 10elseif (name == "") 11return tostr("You may not use a blank name."); 12elseif (i = index("*#()", name[1])) 13return tostr("You may not begin a name with the \"", "*#()"[i], "\" character."); 14elseif (name in $player_db.stupid_names) 15return tostr("The name \"", name, "\" would probably cause problems in command parsing or similar usage."); 16elseif (name in $player_db.reserved) 17return tostr("The name \"", name, "\" is reserved."); 18elseif (length(name) > $login.max_player_name) 19return tostr("The name \"", name, "\" is too long. Maximum name length is ", $login.max_player_name, " characters."); 20elseif ((valid(match = $player_db:find_exact(name)) && is_player(match)) && (who != match)) 21return tostr("The name \"", name, "\" is already being used by ", match.name, "(", match, ")."); 22elseif ($player_db.frozen) 23return tostr("$player_db is not accepting new changes at the moment."); 24elseif ($object_utils:has_callable_verb($local, "legal_name") && (!$local:legal_name(name, who))) 25return "That name is reserved."; 26endif
insert
Referenced by
- #6:set_name line 24:
$player_db:insert - #6:set_aliases line 41:
$player_db:insert - #10:cr*eate line 45:
$player_db:insert - #24:set_player line 27:
$player_db:insert - #24:set_player line 32:
$player_db:insert - #39:load line 22:
this:insert - #39:load line 32:
this:insert
Source
1((typeof(args[1]) == NUM) && (typeof(args[2]) == STR)) && (args[2] = $ansi_utils:delete(args[2])); 2(typeof(args[1]) == STR) && (args[1] = $ansi_utils:delete(args[1])); 3return pass(@args);