fetchOne("SELECT SUM(`value`) AS `sum` FROM `player_storage` WHERE `key` LIKE '30___' AND `player_id` = ? LIMIT 1", [$user_id]);
}
$profile_znote_data = user_znote_character_data($user_id, 'created', 'hide_char', 'comment');
$guild_exist = false;
if (get_character_guild_rank($user_id) > 0) {
$guild_exist = true;
$guild = get_player_guild_data($user_id);
$guild_name = get_guild_name($guild['guild_id']);
}
$position = '';
if ($profile_data['group_id'] > 1) {
$position_data = db()->fetchOne("
SELECT `a`.`type`
FROM `players` AS `p`
INNER JOIN `accounts` AS `a`
ON `p`.`account_id` = `a`.`id`
WHERE
`a`.`type` > 1
AND `p`.`id` = ?
", [$user_id]);
$position_type = ($position_data !== false) ? $position_data['type'] : null;
$position = (isset($config['ingame_positions'][$position_type])) ? $config['ingame_positions'][$position_type] : t('common.unknown');
}
$deletion_time = db()->fetchOne("SELECT `time` FROM `znote_deleted_characters` WHERE `character_name` = ? AND `done` = '0' LIMIT 1;", [$name]);
$houses = db()->fetchAll("
SELECT `id`, `owner`, `name`, `town_id` AS `town_id`
FROM `houses`
WHERE `owner` = ?;
", [$user_id]);
?>
fetchAll("
SELECT
`player_id`,
`pid`,
`itemtype`,
`count`
FROM `player_items`
WHERE `player_id` = ?
AND `pid` < '11'
", [$user_id]);
$soulStamina = " `soul`, `stamina`,";
if ($config['client'] < 780) {
$soulStamina = " 0 AS `soul`, 0 AS `stamina`,";
}
$player_query = "
SELECT
`health`, `healthmax`,
`mana`, `manamax`,
`cap`,
`experience`, `level`,
{$soulStamina}
`maglevel`,
`skill_fist`,
`skill_club`,
`skill_sword`,
`skill_axe`,
`skill_dist`,
`skill_shielding`,
`skill_fishing`
FROM `players`
WHERE `id` = ?
LIMIT 1;
";
$playerstats = db()->fetchOne($player_query, [$user_id]);
$player_experience_raw = (int)$playerstats['experience'];
$profile_flag = '';
$flags = $config['country_flags'];
if ($flags['enabled'] && $flags['characterprofile']) {
$flag_account = user_znote_account_data($profile_data['account_id'], 'flag');
if ($flag_account !== false && strlen($flag_account['flag']) > 0) {
$profile_flag = (string)$flag_account['flag'];
}
}
$profile_houses = array();
if ($houses !== false) {
foreach ($houses as $h) {
$profile_houses[] = $h['name'] . ', ' . ($config['towns'][$h['town_id']] ?? $h['town_id']);
}
}
$profile_account = user_data((int)$profile_data['account_id'], 'premium_ends_at');
$premium_until = ($profile_account !== false) ? (int)($profile_account['premium_ends_at'] ?? 0) : 0;
$account_status = ((bool)($config['freePremium'] ?? false) || $premium_until > time()) ? t('char.premium_active') : t('char.premium_inactive');
$profile_lookaddons = (int)($profile_data['lookaddons'] ?? 0);
$current_outfit_src = $loadOutfits
? $config['show_outfits']['imageServer'] . '?id=' . (int)$profile_data['looktype'] . '&addons=' . $profile_lookaddons . '&head=' . (int)$profile_data['lookhead'] . '&body=' . (int)$profile_data['lookbody'] . '&legs=' . (int)$profile_data['looklegs'] . '&feet=' . (int)$profile_data['lookfeet']
: '';
$health_percent = ((int)$playerstats['healthmax'] > 0) ? min(100, max(0, round(((int)$playerstats['health'] / (int)$playerstats['healthmax']) * 100, 2))) : 100;
$mana_percent = ((int)$playerstats['manamax'] > 0) ? min(100, max(0, round(((int)$playerstats['mana'] / (int)$playerstats['manamax']) * 100, 2))) : 100;
$experience_raw = $player_experience_raw;
$level_raw = (int)$playerstats['level'];
$level_start_exp = (int)level_to_experience($level_raw);
$level_next_exp = (int)level_to_experience($level_raw + 1);
$level_exp_span = max(1, $level_next_exp - $level_start_exp);
$level_exp_done = min($level_exp_span, max(0, $experience_raw - $level_start_exp));
$level_percent = round(($level_exp_done / $level_exp_span) * 100, 2);
$level_needed = max(0, $level_next_exp - $experience_raw);
$detail_skill_rows = array(
array('label' => t('common.level'), 'value' => $playerstats['level']),
array('label' => t('char.magic_level'), 'value' => $playerstats['maglevel']),
array('label' => t('skill.fist'), 'value' => $playerstats['skill_fist']),
array('label' => t('skill.club'), 'value' => $playerstats['skill_club']),
array('label' => t('skill.sword'), 'value' => $playerstats['skill_sword']),
array('label' => t('skill.axe'), 'value' => $playerstats['skill_axe']),
array('label' => t('skill.distance'), 'value' => $playerstats['skill_dist']),
array('label' => t('skill.shielding'), 'value' => $playerstats['skill_shielding']),
array('label' => t('skill.fishing'), 'value' => $playerstats['skill_fishing']),
);
?>
= t('char.flagged_delete2') ?> .
= t('char.info_title') ?>
= t('common.name') ?>
= t('char.position') ?>
= t('common.country') ?>
= t('common.sex') ?>
= t('common.vocation') ?>
= t('common.level') ?>
= t('char.ach_points') ?>
= t('char.residence') ?>
= t('char.house_label') ?>
= t('char.guild_label') ?>
= t('char.guild_of') ?>
= t('char.last_login') ?>
= t('char.created') ?>
= t('char.account_status') ?>
= t('skill.soul') ?>
= t('skill.cap') ?>
= t('skill.experience') ?> - = t('common.level') ?> % to
= t('char.need_exp', ['amount' => '' . number_format($level_needed,0,'',',') . ' ', 'level' => (int)$playerstats['level'] + 1]) ?>
fetchAll("
SELECT `player_id`, `value`, `key`
FROM `player_storage`
WHERE `player_id` = ?
AND `key` LIKE '30___';
", [$user_id]);
$c_achs = $config['achievements'];
$toggle = array(
'show' => '' . t('common.show') . ' ',
'hide' => '' . t('common.hide') . ' '
);
if ($achievements !== false): ?>
= t('char.achievements') ?>
= t('common.name') ?>
= t('common.description') ?>
= t('common.points') ?>
= t('char.death_list') ?>
fetchAll("
SELECT
`player_id`,
`time`,
`level`,
`killed_by`,
`is_player`,
`mostdamage_by`,
`mostdamage_is_player`,
`unjustified`,
`mostdamage_unjustified`
FROM `player_deaths`
WHERE `player_id` = ?
ORDER BY `time` DESC
LIMIT 10;
", [$user_id]);
if ($deaths) {
foreach ($deaths as $d) {
$lasthit = ($d['is_player'])
? "".$d['killed_by']." "
: $d['killed_by'];
?>
$d['level'], 'killer' => $lasthit]);
if ($d['unjustified']) {
echo " " . t('char.unjustified') . " ";
}
$mostdmg = ($d['mostdamage_by'] !== $d['killed_by']) ? true : false;
if ($mostdmg) {
$mostdmg = ($d['mostdamage_is_player'])
? "".$d['mostdamage_by']." "
: $d['mostdamage_by'];
echo " " . t('char.and_by', ['name' => $mostdmg]);
if ($d['mostdamage_unjustified']) {
echo " " . t('char.unjustified') . " ";
}
} else {
echo " " . t('char.soloed') . " ";
}
?>
= t('char.never_died') ?>
fetchAll("
SELECT `player_id`, `key`, `value`
FROM player_storage
WHERE `player_id` = ?
", [$user_id]);
if (isset($config['quests']) && !empty($config['quests'])) {
foreach ($config['quests'] as $cquest) {
$totalquests = $totalquests + 1;
if ($sqlquests !== false) {
foreach ($sqlquests as $dbquest) {
if ($cquest[0] == $dbquest['key'] && $cquest[1] == $dbquest['value']) {
$completedquests = $completedquests + 1;
}
}
}
if ($cquest[3] == 1) {
if ($completedquests != 0) {
if ($firstrun == 1): ?>
= t('char.quest_progression') ?>
= t('char.quest_label') ?>
= t('char.progression_label') ?>
%
fetchAll("
SELECT
`p`.`id`,
`p`.`name`,
`p`.`level`,
`p`.`vocation`,
`p`.`lastlogin`,
CASE WHEN `l`.`player_id` IS NULL THEN 0 else 1 END as `online`
FROM `players` as `o`
JOIN `players` as `p`
ON `o`.`account_id` = `p`.`account_id`
LEFT JOIN `znote_players` as `z`
ON `p`.`id` = `z`.`player_id`
LEFT JOIN `znote_players` as `z2`
ON `o`.`id` = `z2`.`player_id`
LEFT JOIN `players_online` as `l` ON `p`.`id` = `l`.`player_id`
WHERE `o`.`id` = ?
AND `p`.`id` != `o`.`id`
AND `z`.`hide_char` = 0
AND `z2`.`hide_char` = 0
ORDER BY `p`.`experience` DESC;
", [$user_id]);
// Render table if there are any characters to show
if ($otherChars !== false) {
?>
= t('char.other_chars') ?>
= t('common.name_label') ?>
= t('common.level_label') ?>
= t('common.vocation_label') ?>
= t('char.last_login_label') ?>
= t('common.status_label') ?>
= t('char.address') ?> ">
htmlentities(strip_tags($name, ENT_QUOTES))]);
}
} else {
view('character_search');
}
theme_close(); ?>