Esempio n. 1
0
 /**
  * Grabs data from external state for other methods to us
  *
  * @return ShopController
  */
 public function __construct()
 {
     $this->itemCosts = $this->itemForSaleCosts();
     $this->sessionData = ['username' => self_name(), 'char_id' => self_char_id(), 'is_logged_in' => is_logged_in()];
 }
Esempio n. 2
0
/**
 * Returns a char name from a char id.
 *
 * @return string
 */
function get_char_name($char_id = null)
{
    if ($char_id === null) {
        if (defined('DEBUG') && DEBUG && $char_id === null) {
            nw_error('Deprecated call to get_char_name(null) with a null argument.  For clarity reasons, this is now deprecated, use self_name() instead.');
        }
        return self_name();
    } else {
        // Determine some other character's username and return it.
        $sql = "SELECT uname FROM players WHERE player_id = :player";
        return query_item($sql, array(':player' => $char_id));
    }
}
Esempio n. 3
0
$newprofile = trim(in('newprofile', null, null));
// Unfiltered input.
$profile_changed = (bool) in('profile_changed');
$changed = (bool) in('changed');
$dev = (bool) DEBUG;
// Update a player's OOC profile
function update_profile($char_id, $new_profile)
{
    DatabaseConnection::getInstance();
    $statement = DatabaseConnection::$pdo->prepare('UPDATE players SET messages = :profile WHERE player_id = :char_id');
    $statement->bindValue(':profile', $new_profile);
    $statement->bindValue(':char_id', $char_id);
    $statement->execute();
    return true;
}
$username = self_name();
$char_id = self_char_id();
// Password and email changing systems exist in account.php (& account.tpl).
$char = new Player($char_id);
$profile_max_length = 500;
// Should match the limit in limitStatChars.js - ajv: No, limitStatChars.js should be dynamically generated with this number from a common location -
$successMessage = null;
$description = post('description', $char->description());
$goals = post('goals', $char->goals());
$instincts = post('instincts', $char->instincts());
$beliefs = post('beliefs', $char->beliefs());
$traits = post('traits', $char->traits());
if ($changedetails) {
    // Limit the profile length.
    if ($newprofile != '') {
        $profile_changed = update_profile($char_id, $newprofile);
Esempio n. 4
0
 /**
  * Gathers data from session and makes it available to internal methods
  *
  * @return DoshinController
  */
 public function __construct()
 {
     $this->sessionData = ['username' => self_name(), 'char_id' => self_char_id()];
 }
Esempio n. 5
0
 /**
  * Grabs data from external state for other methods to us
  *
  * @return ShopController
  * @see item_for_sale_costs
  */
 public function __construct()
 {
     $this->itemCosts = item_for_sale_costs();
     $this->sessionData = ['username' => self_name(), 'char_id' => self_char_id(), 'is_logged_in' => is_logged_in(), 'quantity_setting' => get_setting('items_quantity')];
 }
Esempio n. 6
0
<?php

require_once LIB_ROOT . "control/lib_player_list.php";
require_once LIB_ROOT . "control/lib_grouping.php";
require_once LIB_ROOT . "data/lib_npc.php";
$private = true;
$alive = false;
if ($error = init($private, $alive)) {
    header('Location: list.php');
} else {
    $char_name = self_name();
    $peers = nearby_peers(self_char_id());
    $active_ninjas = get_active_players(5, true);
    // Get the currently active ninjas
    $char_info = self_info();
    $char = new Player(self_char_id());
    $match_string = in('enemy_match', null, 'no filter');
    $add_enemy = in('add_enemy', null, 'toInt');
    $remove_enemy = in('remove_enemy', null, 'toInt');
    $enemy_limit = 20;
    $max_enemies = false;
    $enemy_list = null;
    if ($match_string) {
        $found_enemies = get_enemy_matches($match_string);
    } else {
        $found_enemies = null;
    }
    if (is_numeric($remove_enemy) && $remove_enemy != 0) {
        remove_enemy($remove_enemy);
    }
    if (is_numeric($add_enemy) && $add_enemy != 0) {