From 45e390c9d4aefeb2cd6b6e5cd18f400dd674e7c1 Mon Sep 17 00:00:00 2001 From: slawkens1 Date: Tue, 23 May 2017 21:50:18 +0200 Subject: [PATCH] fixed https://otland.net/threads/myaac-v0-0-1.251454/page-7#post-2444034 and https://otland.net/threads/myaac-v0-0-1.251454/page-7#post-2444035 --- system/init.php | 10 ++++++---- system/pages/guilds.php | 4 ++-- system/pages/online.php | 12 +++++++++--- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/system/init.php b/system/init.php index 5bebe93a..72419473 100644 --- a/system/init.php +++ b/system/init.php @@ -120,6 +120,7 @@ define('USE_ACCOUNT_NAME', fieldExist('name', 'accounts')); $tmp = ''; if($cache->enabled() && $cache->fetch('vocations', $tmp)) { $config['vocations'] = unserialize($tmp); + $config['vocation_last'] = $cache->get('vocation_last'); } else { $vocations = new DOMDocument(); @@ -135,14 +136,15 @@ else { $config['vocations'] = array(); foreach($vocations->getElementsByTagName('vocation') as $vocation) { $id = $vocation->getAttribute('id'); - //if($id == $vocation->getAttribute('fromvoc')) - $config['vocations'][$id] = $vocation->getAttribute('name'); - //else - // $config['vocations'][$id] = $vocation->getAttribute('name'); + if($id == $vocation->getAttribute('fromvoc')) + $config['vocation_last'] = $id; + + $config['vocations'][$id] = $vocation->getAttribute('name'); } if($cache->enabled()) { $cache->set('vocations', serialize($config['vocations']), 120); + $cache->set('vocation_last', $config['vocation_last'], 120); } } unset($tmp, $id, $vocation); diff --git a/system/pages/guilds.php b/system/pages/guilds.php index 03c96aa0..429d9c53 100644 --- a/system/pages/guilds.php +++ b/system/pages/guilds.php @@ -316,8 +316,8 @@ if($action == 'show') if($level_in_guild > $rank->getLevel() || $guild_leader) if($guild_leader_char->getName() != $player->getName()) echo ' {KICK}'; - if($player->isOnline()) - $s_members_online++; + //if($player->isOnline()) + // $s_members_online++; echo ''.$player->getLevel().'Online' : 'red">Offline').''; } echo ''; diff --git a/system/pages/online.php b/system/pages/online.php index 3bd19169..7880aa7e 100644 --- a/system/pages/online.php +++ b/system/pages/online.php @@ -52,7 +52,12 @@ if($config['online_outfit']) { } } -$vocs = array(0, 0, 0, 0, 0); +if($config['online_vocations']) { + $vocs = array(); + foreach($config['vocations'] as $id => $name) + $vocs[$id] = 0; +} + if(tableExist('players_online')) // tfs 1.0 $playersOnline = $db->query('SELECT `accounts`.`country`, `players`.`name`, `level`, `vocation`' . $outfit . ', `' . $skull_time . '` as `skulltime`, `' . $skull_type . '` as `skull` FROM `accounts`, `players`, `players_online` WHERE `players`.`id` = `players_online`.`player_id` AND `accounts`.`id` = `players`.`account_id` ORDER BY ' . $order); else @@ -90,7 +95,8 @@ foreach($playersOnline as $player) '.$config['vocations'][$player['vocation']].' '; - $vocs[$player['vocation']]++; + if($config['online_vocations']) + $vocs[$player['vocation']]++; } if(!$players): ?> @@ -180,7 +186,7 @@ if($config['online_vocations']): ?> ' . $config['vocations'][$i] . ' ' . $vocs[$i] . '