/
ColdCore-3.0a9.02/
ColdCore-3.0a9.02/src/
new object $player: $user;

var $channel_ui active_channels = #[];
var $channel_ui channel_dict = #[];
var $command_aliases command_aliases = [];
var $described prose = [];
var $has_commands local = \
	#[["@sheet|@score", [["@sheet|@score", "*", "@sheet|@score <any>", 'sheet_cmd, #[[1, ['any, []]]]]]],\
  ["@new-char?acter",\
    [["@new-char?acter", "*", "@new-char?acter <any>", 'new_character_cmd, #[[1, ['any, []]]]]]]];
var $has_commands remote = #[];
var $has_commands shortcuts = #[];
var $has_name name = ['proper, "player", "player"];
var $located location = $body_cave;
var $located obvious = 1;
var $location contents = [];
var $mail_list mail = [];
var $mail_list notify = [$player];
var $mail_list readers = [$player];
var $mail_list senders = 1;
var $mail_ui current = #[['location, 0], ['list, $player]];
var $mail_ui subscribed = #[[$player, [813278562, 0]], [$mail_list_news, [813278562, 0]]];
var $player character = 0;
var $player characters = 0;
var $root created_on = 809926794;
var $root fertile = 1;
var $root flags = ['core, 'methods, 'code, 'command_cache, 'variables];
var $root inited = 1;
var $root managed = [$player];
var $root manager = $player;
var $root quota = 75000;
var $root settings = #[["home", $body_cave]];
var $thing gender = $gender_neuter;
var $user action = "";
var $user connected_at = 0;
var $user connections = [];
var $user formatter = $plain_format;
var $user last_command_at = 0;
var $user parsers = [$command_parser];
var $user password = "*";
var $user task_connections = #[];

public method .attribute(): nooverride, synchronized  {
    arg attribute;
    
    if (caller() != definer())
        (> .perms(sender(), $storyteller) <);
    return get_var(attribute);
};

public method .dead() {
    return dead;
};

public method .format_score() {
    arg base, cur;
    
    return pad((base == cur) ? tostr(base) : ((cur + "/") + base), 8);
};

public method .help_charcmd() {
    arg @args;
    
    .tell("** Special commands: help, lower, raise, sheet and done");
    .tell("** As well as +X and -X as shortcuts for raise and lower");
    .tell("** All other normal commands are available");
};

protected method .lower_attribute() {
    arg attribute, difference;
    var new;
    
    new = (get_var(attribute)[1]) - difference;
    set_var(attribute, get_var(attribute).replace(1, new));
};

public method .new_character_cmd() {
    arg @args;
    
    (> .perms(caller(), 'command) <);
    (.location()).announce((.name()) + " fades away to generate a new character.", this());
    .move_to($nowhere);
    .add_parser($chargen_parser);
    .tell("** raw character generation subsystem, will get better later **");
    .tell("** type 'help' for help **");
};

protected method .raise_attribute() {
    arg attribute, difference;
    var new;
    
    new = (get_var(attribute)[1]) + difference;
    if (new > (get_var(attribute)[2]))
        new = get_var(attribute)[2];
    set_var(attribute, get_var(attribute).replace(1, new));
};

public method .set_attribute() {
    arg attribute, value;
    
    (> .perms(sender()) <);
    set_var(attribute, [value, value]);
};

protected method .sheet_cmd() {
    arg cmdstr, cmd, args;
    var t, out, g;
    
    (> .perms(caller(), 'command) <);
    if (args && (!(.is($storyteller))))
        return "Only storytellers can see other players stats.";
    if (!character)
        return "You do not have a character active.";
    return character.format_sheet();
};