* @copyright 2019 MyAAC * @link https://my-aac.org */ use MyAAC\Forum; use MyAAC\Models\Player; defined('MYAAC') or die('Direct access not allowed!'); $title = 'Player editor'; csrfProtect(); $player_base = ADMIN_URL . '?p=players'; $use_datatable = true; $skills = array( POT::SKILL_FIST => array('Fist fighting', 'fist'), POT::SKILL_CLUB => array('Club fighting', 'club'), POT::SKILL_SWORD => array('Sword fighting', 'sword'), POT::SKILL_AXE => array('Axe fighting', 'axe'), POT::SKILL_DIST => array('Distance fighting', 'dist'), POT::SKILL_SHIELD => array('Shielding', 'shield'), POT::SKILL_FISH => array('Fishing', 'fish') ); $hasBlessingsColumn = $db->hasColumn('players', 'blessings'); $hasBlessingColumn = $db->hasColumn('players', 'blessings1'); $hasLookAddons = $db->hasColumn('players', 'lookaddons'); $skull_type = array("None", "Yellow", "Green", "White", "Red", "Black", "Orange"); ?> orderBy('name')->limit(11)->get(['id', 'name']); if (count($query) == 0) { echo_error('No entries found.'); } else if (count($query) == 1) { $id = $query->first()->getKey(); } else if (count($query) > 10) { echo_error('Specified name resulted with too many players.'); } else { $str_construct = 'Do you mean?'; echo_error($str_construct); } } } ?>
0) { $player = new OTS_Player(); $player->load($id); if ($player->isLoaded() && isset($_POST['save'])) {// we want to save $error = false; if ($player->isOnline()) echo_error('This player is actually online. You can\'t edit online players.'); $name = $_POST['name']; $_error = ''; if (!Validator::characterName($name)) echo_error(Validator::getLastError()); //if(!Validator::newCharacterName($name) // echo_error(Validator::getLastError()); $player_db = new OTS_Player(); $player_db->find($name); if ($player_db->isLoaded() && $player->getName() != $name) echo_error('This name is already used. Please choose another name!'); $account_id = $_POST['account_id']; verify_number($account_id, 'Account id', 11); $account_db = new OTS_Account(); $account_db->load($account_id); if (!$account_db->isLoaded()) echo_error('Account with this id doesn\'t exist.'); $group = $_POST['group']; if ($groups->getGroup($group) == false) echo_error('Group with this id doesn\'t exist'); $level = $_POST['level']; verify_number($level, 'Level', 11); $experience = $_POST['experience']; verify_number($experience, 'Experience', 20); $vocation = $_POST['vocation']; verify_number($vocation, 'Vocation id', 11); if (!isset($config['vocations'][$vocation])) { echo_error("Vocation with this id doesn't exist."); } // health $health = $_POST['health']; verify_number($health, 'Health', 11); $health_max = $_POST['health_max']; verify_number($health_max, 'Health max', 11); // mana $magic_level = $_POST['magic_level']; verify_number($magic_level, 'Magic_level', 11); $mana = $_POST['mana']; verify_number($mana, 'Mana', 11); $mana_max = $_POST['mana_max']; verify_number($mana_max, 'Mana max', 11); $mana_spent = $_POST['mana_spent']; verify_number($mana_spent, 'Mana spent', 11); // look $look_body = $_POST['look_body']; verify_number($look_body, 'Look body', 11); $look_feet = $_POST['look_feet']; verify_number($look_feet, 'Look feet', 11); $look_head = $_POST['look_head']; verify_number($look_head, 'Look head', 11); $look_legs = $_POST['look_legs']; verify_number($look_legs, 'Look legs', 11); $look_type = $_POST['look_type']; verify_number($look_type, 'Look type', 11); if ($hasLookAddons) { $look_addons = $_POST['look_addons']; verify_number($look_addons, 'Look addons', 11); } // pos $pos_x = $_POST['pos_x']; verify_number($pos_x, 'Position x', 11); $pos_y = $_POST['pos_y']; verify_number($pos_y, 'Position y', 11); $pos_z = $_POST['pos_z']; verify_number($pos_z, 'Position z', 11); $soul = $_POST['soul']; verify_number($soul, 'Soul', 10); $town = $_POST['town']; verify_number($town, 'Town', 11); $capacity = $_POST['capacity']; verify_number($capacity, 'Capacity', 11); $sex = $_POST['sex']; verify_number($sex, 'Sex', 1); $lastlogin = strtotime($_POST['lastlogin']); verify_number($lastlogin, 'Last login', 20); $lastlogout = strtotime($_POST['lastlogout']); verify_number($lastlogout, 'Last logout', 20); $skull = $_POST['skull']; verify_number($skull, 'Skull', 1); $skull_time = $_POST['skull_time']; verify_number($skull_time, 'Skull time', 11); if ($db->hasColumn('players', 'loss_experience')) { $loss_experience = $_POST['loss_experience']; verify_number($loss_experience, 'Loss experience', 11); $loss_mana = $_POST['loss_mana']; verify_number($loss_mana, 'Loss mana', 11); $loss_skills = $_POST['loss_skills']; verify_number($loss_skills, 'Loss skills', 11); $loss_containers = $_POST['loss_containers']; verify_number($loss_containers, 'Loss loss_containers', 11); $loss_items = $_POST['loss_items']; verify_number($loss_items, 'Loss items', 11); } if ($db->hasColumn('players', 'offlinetraining_time')) { $offlinetraining = $_POST['offlinetraining']; verify_number($offlinetraining, 'Offline Training time', 11); } if ($hasBlessingsColumn) { $blessings = $_POST['blessings']; verify_number($blessings, 'Blessings', 3); } $balance = $_POST['balance']; verify_number($balance, 'Balance', 20); if ($db->hasColumn('players', 'stamina')) { $stamina = $_POST['stamina']; verify_number($stamina, 'Stamina', 20); } $deleted = (isset($_POST['deleted']) && $_POST['deleted'] == 'true'); $hide = (isset($_POST['hide']) && $_POST['hide'] == 'true'); $created = strtotime($_POST['created']); verify_number($created, 'Created', 11); $comment = isset($_POST['comment']) ? htmlspecialchars(stripslashes(substr($_POST['comment'], 0, 2000))) : NULL; foreach ($_POST['skills'] as $skill => $value) verify_number($value, $skills[$skill][0], 10); foreach ($_POST['skills_tries'] as $skill => $value) verify_number($value, $skills[$skill][0] . ' tries', 10); if ($hasBlessingColumn) { $bless_count = $_POST['blesscount']; for ($i = 1; $i <= $bless_count; $i++) { $a = 'blessing' . $i; ${'blessing' . $i} = (isset($_POST[$a]) && $_POST[$a] == 'true'); } } if (!$error) { $player->setName($name); $player->setAccount($account_db); $player->setGroup($groups->getGroup($group)); $player->setLevel($level); $player->setExperience($experience); $player->setVocation($vocation); $player->setHealth($health); $player->setHealthMax($health_max); $player->setMagLevel($magic_level); $player->setMana($mana); $player->setManaMax($mana_max); $player->setManaSpent($mana_spent); $player->setLookBody($look_body); $player->setLookFeet($look_feet); $player->setLookHead($look_head); $player->setLookLegs($look_legs); $player->setLookType($look_type); if ($hasLookAddons) $player->setLookAddons($look_addons); if ($db->hasColumn('players', 'offlinetraining_time')) $player->setCustomField('offlinetraining_time', $offlinetraining); $player->setPosX($pos_x); $player->setPosY($pos_y); $player->setPosZ($pos_z); $player->setSoul($soul); $player->setTownId($town); $player->setCap($capacity); $player->setSex($sex); $player->setLastLogin($lastlogin); $player->setLastLogout($lastlogout); //$player->setLastIP(ip2long($lastip)); $player->setSkull($skull); $player->setSkullTime($skull_time); if ($db->hasColumn('players', 'loss_experience')) { $player->setLossExperience($loss_experience); $player->setLossMana($loss_mana); $player->setLossSkills($loss_skills); $player->setLossContainers($loss_containers); $player->setLossItems($loss_items); } if ($hasBlessingsColumn) $player->setBlessings($blessings); if ($hasBlessingColumn) { for ($i = 1; $i <= $bless_count; $i++) { $a = 'blessing' . $i; $player->setCustomField('blessings' . $i, ${'blessing' . $i} ? '1' : '0'); } } $player->setBalance($balance); if ($db->hasColumn('players', 'stamina')) $player->setStamina($stamina); if ($db->hasColumn('players', 'deletion')) $player->setCustomField('deletion', $deleted ? '1' : '0'); else $player->setCustomField('deleted', $deleted ? '1' : '0'); $player->setCustomField('hide', $hide ? '1' : '0'); $player->setCustomField('created', $created); if (isset($comment)) $player->setCustomField('comment', $comment); foreach ($_POST['skills'] as $skill => $value) { $player->setSkill($skill, $value); } foreach ($_POST['skills_tries'] as $skill => $value) { $player->setSkillTries($skill, $value); } $player->save(); echo_success('Player saved at: ' . date('G:i')); $player->load($id); } } } else if ($id == 0) { $players_db = Player::orderBy('id')->get(['id','name', 'level']); ?>
Players
ID Name Level Edit
id; ?> name; ?> level; ?>
isLoaded()) { $account = $player->getAccount(); ?>
countBlessings(); $bless = $player->checkBlessings($bless_count); ?>

getCustomField($db->hasColumn('players', 'deletion') ? 'deletion' : 'deleted') == '1' ? ' checked' : ''); ?>>
isHidden() ? ' checked' : ''); ?>>
hasColumn('players', 'stamina')): ?>
hasColumn('players', 'offlinetraining_time')): ?>
$info) { ?>
' . $info[0] . ' '; ?>
' . $info[0] . ' tries '; ?>
getLookType() . ($hasLookAddons ? '&addons=' . $player->getLookAddons() : '') . '&head=' . $player->getLookHead() . '&body=' . $player->getLookBody() . '&legs=' . $player->getLookLegs() . '&feet=' . $player->getLookFeet(); ?>
player outfit
Position:
Look:
getCustomField('created')); ?>"/>
getLastLogin()); ?>"/>
getLastLogout()); ?>"/>
hasColumn('players', 'loss_experience')): ?>
[max. length: 2000 chars, 50 lines (ENTERs)]
query('SELECT `author_guid`,`section`,`first_post`,`post_text`,`post_date`, `post_topic`,`post_html`,`post_smile`,`' . TABLE_PREFIX . 'forum_boards`.`name` AS `forum_Name` FROM `' . TABLE_PREFIX . 'forum` LEFT JOIN `' . TABLE_PREFIX . 'forum_boards` ON `' . TABLE_PREFIX . 'forum`.section = `' . TABLE_PREFIX . 'forum_boards`.id WHERE `author_guid` = "' . $player->getId() . '" ORDER BY `post_date` DESC LIMIT 10'); if ($posts->rowCount() > 0) { $posts = $posts->fetchAll(); foreach ($posts as $post) { $text = ($post['post_html'] > 0 ? $post['post_text'] : htmlspecialchars($post['post_text'])); $post['content'] = ($post['post_html'] > 0 ? $text : Forum::parseBBCode(nl2br($text), $post['post_smile'] == 0)); ?> '; }; ?>
Topic Content


Topic: Link
Forum:
This user has no posts
isLoaded()) { $account_players = Player::where('account_id', $account->getId())->orderBy('id')->get(); if (isset($account_players)) { ?> $player): ?>
# Name Level Vocation Edit
name; ?> level; ?> vocation_name; ?>
Search Player