some fixes

* set default skills to 10 when creating new character
* fixed displaying of "Create forum thread" in newses
* fixed deleting guild
* fixed displaying vocation amount on online page
* better support for custom vocations, you just need to set in config
vocations_amount to yours.
This commit is contained in:
slawkens1 2017-05-31 23:10:35 +02:00
parent 6f10ee1965
commit e69ff12966
9 changed files with 24 additions and 22 deletions

View File

@ -24,6 +24,8 @@ $config = array(
'template' => 'kathrine', // template used by website (kathrine, tibiacom)
'template_allow_change' => true, // allow users to choose their own template while browsing website?
'vocations_amount' => 4, // how much basic vocations your server got (without promotion)
// what client version are you using on this OT?
// used for the Downloads page and some templates aswell
'client' => 1098, // 954 = client 9.54

View File

@ -379,12 +379,12 @@ function delete_guild($id)
global $db, $ots;
foreach($rank_list as $rank_in_guild) {
if(fieldExist('rank_id', 'players'))
$players_with_rank = $db->query('SELECT `id`, `rank_id` FROM `players` WHERE `rank_id` = ' . $rank->getId() . ' AND `deleted` = 0;');
else if(tableExist('guild_members'))
if(tableExist('guild_members'))
$players_with_rank = $db->query('SELECT `players`.`id` as `id`, `guild_members`.`rank_id` as `rank_id` FROM `players`, `guild_members` WHERE `guild_members`.`rank_id` = ' . $rank_in_guild->getId() . ' AND `players`.`id` = `guild_members`.`player_id` ORDER BY `name`;');
else
else if(tableExist('guild_membership'))
$players_with_rank = $db->query('SELECT `players`.`id` as `id`, `guild_membership`.`rank_id` as `rank_id` FROM `players`, `guild_membership` WHERE `guild_membership`.`rank_id` = ' . $rank_in_guild->getId() . ' AND `players`.`id` = `guild_membership`.`player_id` ORDER BY `name`;');
else
$players_with_rank = $db->query('SELECT `id`, `rank_id` FROM `players` WHERE `rank_id` = ' . $rank_in_guild->getId() . ' AND `deleted` = 0;');
$players_with_rank_number = $players_with_rank->rowCount();
if($players_with_rank_number > 0) {

View File

@ -120,15 +120,14 @@ 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();
$path_extra = 'XML/';
if($config['otserv_version'] >= OTSERV_FIRST && $config['otserv_version'] <= OTSERV_LAST)
$path_extra = '';
$file = $config['data_path'] . 'XML/vocations.xml';
if(!@file_exists($file))
$file = $config['data_path'] . 'vocations.xml'
$vocations->load($config['data_path'] . $path_extra . 'vocations.xml');
$vocations->load($file);
if(!$vocations)
die('ERROR: Cannot load <i>vocations.xml</i> file.');
@ -136,15 +135,11 @@ else {
$config['vocations'] = array();
foreach($vocations->getElementsByTagName('vocation') as $vocation) {
$id = $vocation->getAttribute('id');
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);

View File

@ -217,8 +217,9 @@ class OTS_Player extends OTS_Row_DAO
$this->data['rank_id'] = 0;
if(isset($this->data['promotion'])) {
global $config;
if((int)$this->data['promotion'] > 0)
$this->data['vocation'] + ($this->data['promotion'] * 4);
$this->data['vocation'] += ($this->data['promotion'] * $config['vocations_amount']);
}
// loads skills
if( $this->isLoaded() )
@ -472,7 +473,6 @@ class OTS_Player extends OTS_Row_DAO
if($id != $i - 1)
$set .= ',';
}
$skills = $this->db->query('UPDATE `players` SET ' . $set . ' WHERE `id` = ' . $this->data['id']);

View File

@ -1106,6 +1106,9 @@ Please enter your account name and your password.<br/><a href="?subtopic=createa
$player->setManaSpent($char_to_copy->getManaSpent());
$player->setSoul($char_to_copy->getSoul());
for($skill = POT::SKILL_FIRST; $skill <= POT::SKILL_LAST; $skill++)
$player->setSkill($skill, 10);
$player->setLookBody($char_to_copy->getLookBody());
$player->setLookFeet($char_to_copy->getLookFeet());
$player->setLookHead($char_to_copy->getLookHead());

View File

@ -711,7 +711,7 @@ else
foreach($query as $player) {
if(isset($player['promotion'])) {
if((int)$player['promotion'] > 0)
$player['vocation'] + ($player['promotion'] * 4);
$player['vocation'] += ($player['promotion'] * $config['vocations_amount']);
}
echo '<li>' . getPlayerLink($player['name']) . ' (<small><strong>level ' . $player['level'] . ', ' . $config['vocations'][$player['vocation']] . '</strong></small>)</li>';
}

View File

@ -209,7 +209,7 @@ echo '
if($config['highscores_vocation']) {
if(isset($player['promotion'])) {
if((int)$player['promotion'] > 0)
$player['vocation'] + ($player['promotion'] * 4);
$player['vocation'] += ($player['promotion'] * $config['vocations_amount']);
}
echo '<br/><small>' . $config['vocations'][$player['vocation']] . '</small>';

View File

@ -372,7 +372,7 @@ if(!$news_cached)
</td>
</tr>
<?php
if($action == 'add'):
if($action == ''):
?>
<tr bgcolor="<?php echo getStyle($rows++); ?>">
<td><b>Create forum thread in section:</b></td>

View File

@ -80,9 +80,9 @@ foreach($playersOnline as $player)
if(isset($player['promotion'])) {
if((int)$player['promotion'] > 0)
$player['vocation'] + ($player['promotion'] * 4);
$player['vocation'] += ($player['promotion'] * $config['vocations_amount']);
}
$data .= '<tr bgcolor="' . getStyle(++$players) . '">';
if($config['account_country'])
$data .= '<td>' . getFlagImage($player['country']) . '</td>';
@ -96,7 +96,7 @@ foreach($playersOnline as $player)
</tr>';
if($config['online_vocations'])
$vocs[$player['vocation']]++;
$vocs[($player['vocation'] > $config['vocations_amount'] ? $player['vocation'] - $config['vocations_amount'] : $player['vocation'])]++;
}
if(!$players): ?>
@ -141,6 +141,8 @@ if(!$players): ?>
else if(tableExist('server_config')) { // tfs 1.0
$query = $db->query('SELECT `value` as `record` FROM `server_config` WHERE `config` = ' . $db->quote('players_record'));
}
else
$query = NULL;
if(isset($query) && $query->rowCount() > 0)
{
@ -186,7 +188,7 @@ if($config['online_vocations']): ?>
</tr>
<?php
for($i = 1; $i <= $config['vocation_last']; $i++)
for($i = 1; $i <= $config['vocations_amount']; $i++)
echo '<tr bgcolor="' . getStyle($i) . '">
<td width="25%">' . $config['vocations'][$i] . '</td>
<td width="75%">' . $vocs[$i] . '</td>