diff --git a/config.php b/config.php
index 1740c523..161044c5 100644
--- a/config.php
+++ b/config.php
@@ -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
diff --git a/system/functions.php b/system/functions.php
index 2f4b8c12..93d7909b 100644
--- a/system/functions.php
+++ b/system/functions.php
@@ -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) {
diff --git a/system/init.php b/system/init.php
index 72419473..05a97501 100644
--- a/system/init.php
+++ b/system/init.php
@@ -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 vocations.xml 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);
diff --git a/system/libs/pot/OTS_Player.php b/system/libs/pot/OTS_Player.php
index efb34a94..bd677986 100644
--- a/system/libs/pot/OTS_Player.php
+++ b/system/libs/pot/OTS_Player.php
@@ -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']);
diff --git a/system/pages/accountmanagement.php b/system/pages/accountmanagement.php
index 5f420594..9001c98b 100644
--- a/system/pages/accountmanagement.php
+++ b/system/pages/accountmanagement.php
@@ -1106,6 +1106,9 @@ Please enter your account name and your password.
">