}*/ $changed = PlayerDAO::saveDetails($char); redirect('/stats.php?changed=' . (int) $changed . ($profile_changed ? '&profile_changed=1' : '')); } /* if(false && DEBUG){ $description = 'This is a description here and all'; $goals = 'Kill ninja of the ramen clan'; $beliefs = 'I believe in a one true ninja god'; $instincts = 'When I hear whistling, I duck'; $traits = 'Hardy, nervous, meaty, silent'; } */ $player = self_info(); //$player['created_date']=$player['created_date']? date("c", strtotime($player['created_date'])) : null; $class_theme = class_theme($char->class_identity()); $level_category = level_category($player['level']); $status_list = get_status_list(); $gravatar_url = generate_gravatar_url($player['player_id']); $gurl = $gravatar_url; $rank_display = get_rank($char_id); // rank display. $profile_editable = $player['messages']; $parts = get_certain_vars(get_defined_vars(), ['player', 'level_category', 'status_list', 'description', 'goals', 'beliefs', 'instincts', 'traits', 'dev', 'changed']); // Set the parts array's player clan if any is found. if ($parts['player_clan'] = get_clan_by_player_id($char_id)) { // Set the char clan name and id for later usage. $parts['clan_name'] = $parts['player_clan']->getName(); $parts['clan_id'] = $parts['player_clan']->getID(); } display_page('stats.tpl', 'Ninja Stats', $parts, array('quickstat' => 'player'));
function render_level_and_category($level) { $res = ''; $level_and_cat = level_category($level); $res .= "<span class='player-level-category {$level_and_cat['css']}'>\n\t\t{$level_and_cat['display']} [{$level}]\n\t</span>"; return $res; }
//$microtimes[7] = microtime(); $active_ninja = ''; if (!$searched) { // Will not display active ninja on a search page. $active_ninja = render_active(5, $alive_only); // Display the currently active ninjas } //$microtimes[8] = microtime(); $players = $sql->FetchAll(); //$microtimes[9] = microtime(); // Render each of the player rows. $i = 0; $player_rows = ''; foreach ($players as $a_player) { $i++; $level_cat = level_category($a_player['level']); $parts = array('alive_class' => $a_player['alive'] == 1 ? "AliveRow" : "DeadRow", 'odd_or_even' => $i % 2 ? "odd" : "even", 'player_rank' => $a_player['rank_id'], 'player_id' => $a_player['player_id'], 'page' => $page, 'uname' => $a_player['uname'], 'level_cat_css' => $level_cat['css'], 'level_cat' => $level_cat['display'], 'level' => $a_player['level'], 'class' => $a_player['class'], 'WEB_ROOT' => WEB_ROOT, 'clan' => $a_player['clan'], 'alive' => $a_player['alive'] ? " " : "Dead"); $player_rows .= render_template('player_list_row.tpl', $parts); // Add all the player rows on to a big list of 'em. } //$microtimes[10] = microtime(); $parts = get_certain_vars(get_defined_vars()); echo render_template('player_list.tpl', $parts); //$microtimes[11] = microtime(); include SERVER_ROOT . "interface/footer.php"; /*$microtimes[12] = microtime(); $start=true; foreach($microtimes as $num => $time){ //echo "<!-- Benchmark times"; if($start){ var_dump('start: '.$time);
function format_ninja_row($a_player) { $level_cat = level_category($a_player['level']); $row = array('alive_class' => $a_player['alive'] == 1 ? "AliveRow" : "DeadRow", 'player_rank' => $a_player['rank_id'], 'player_id' => $a_player['player_id'], 'uname' => $a_player['uname'], 'level_cat_css' => $level_cat['css'], 'level_cat' => $level_cat['display'], 'level' => $a_player['level'], 'class' => $a_player['class'], 'class_theme' => $a_player['class_theme'], 'class_identity' => $a_player['class_identity'], 'clan_id' => $a_player['clan_id'], 'clan_name' => $a_player['clan_name'], 'alive' => $a_player['alive'] ? " " : "Dead"); return $row; }
// "message sent" notice will be displayed by the template itself. } // Get the player's kills for this date. $kills_today = query_item('select sum(killpoints) from levelling_log where _player_id = :player_id and killsdate = CURRENT_DATE and killpoints > 0', array(':player_id' => $target_id)); $viewers_clan = $viewing_player_obj instanceof Player && $viewing_player_obj->vo ? get_clan_by_player_id($viewing_player_obj->vo->player_id) : null; // Attack Legal section $params = array('required_turns' => 0, 'ignores_stealth' => true); // 0 for unstealth. $AttackLegal = new AttackLegal($username, $target, $params); $attack_allowed = $AttackLegal->check(false); $attack_error = $AttackLegal->getError(); $sel_rank_spot = "SELECT rank_id FROM rankings WHERE player_id = :char_id limit 1"; $rank_spot = query_item($sel_rank_spot, array(':char_id' => $player_info['player_id'])); // Display the player info. $status_list = get_status_list($player); $level_category = level_category($player_info['level']); $gurl = $gravatar_url = generate_gravatar_url($target_player_obj); if ($char_id && !$attack_error && !$self) { // They're not dead or otherwise unattackable. // Attack or Duel $skillDAO = new SkillDAO(); $combat_skills = $skillDAO->getSkillsByTypeAndClass($viewing_player_obj->vo->_class_id, 'combat', $viewing_player_obj->vo->level)->fetchAll(); $targeted_skills = $skillDAO->getSkillsByTypeAndClass($viewing_player_obj->vo->_class_id, 'targeted', $viewing_player_obj->vo->level)->fetchAll(); // *** todo When Smarty3 is released, remove fetch all and change template to new foreach-as syntax *** // Check all the combat toggles to see if they should be checked on the profile page. foreach ($combat_skills as &$skill) { $skill['checked'] = 0; if (isset($combat_toggles[$skill['skill_internal_name']]) && $combat_toggles[$skill['skill_internal_name']]) { $skill['checked'] = 1; // Save the setting associatively back to the original array. }