mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 17:29:21 +02:00
* important fix for servers with promotion column (#36)
* caused player.vocation to be resetted when saving player, for example: on change name, accept invite to guild, leave guild * fixed empty success message on leave guild * (internal) using $player->getVocationName() where possible instead of older method * fixed some warning in guild show
This commit is contained in:
parent
acf2e2fb4a
commit
4102b44352
@ -559,7 +559,7 @@ function getCreatureName($killer, $showStatus = false, $extendedInfo = false)
|
||||
|
||||
$str .= '<font color="'.($player->isOnline() ? 'green' : 'red').'">' . $player->getName() . '</font></b></a>';
|
||||
if($extendedInfo) {
|
||||
$str .= '<br><small>'.$player->getLevel().' '.$config['vocations'][$player->getVocation()].'</small>';
|
||||
$str .= '<br><small>'.$player->getLevel().' '.$player->getVocationName().'</small>';
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
@ -241,11 +241,6 @@ class OTS_Player extends OTS_Row_DAO
|
||||
if(!isset($this->data['rank_id']) || $this->data['rank_id'] == NULL)
|
||||
$this->data['rank_id'] = 0;
|
||||
|
||||
if(isset($this->data['promotion'])) {
|
||||
global $config;
|
||||
if((int)$this->data['promotion'] > 0)
|
||||
$this->data['vocation'] += ($this->data['promotion'] * $config['vocations_amount']);
|
||||
}
|
||||
// loads skills
|
||||
if( $this->isLoaded() && $load_skills)
|
||||
{
|
||||
@ -845,6 +840,12 @@ class OTS_Player extends OTS_Row_DAO
|
||||
throw new E_OTS_NotLoaded();
|
||||
}
|
||||
|
||||
if(isset($this->data['promotion'])) {
|
||||
global $config;
|
||||
if((int)$this->data['promotion'] > 0)
|
||||
return ($this->data['vocation'] + ($this->data['promotion'] * $config['vocations_amount']));
|
||||
}
|
||||
|
||||
return $this->data['vocation'];
|
||||
}
|
||||
|
||||
@ -2920,7 +2921,12 @@ class OTS_Player extends OTS_Row_DAO
|
||||
}
|
||||
|
||||
global $config;
|
||||
return $config['vocations'][$this->data['vocation']];
|
||||
$voc = $this->getVocation();
|
||||
if(!isset($config['vocations'][$voc])) {
|
||||
return 'Unknown';
|
||||
}
|
||||
|
||||
return $config['vocations'][$voc];
|
||||
//return POT::getInstance()->getVocationsList()->getVocationName($this->data['vocation']);
|
||||
}
|
||||
|
||||
|
@ -386,7 +386,7 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil
|
||||
'sex' => $player_sex,
|
||||
'marriage_enabled' => $config['characters']['marriage_info'] && $db->hasColumn('players', 'marriage'),
|
||||
'marital_status' => $marital_status,
|
||||
'vocation' => $config['vocations'][$player->getVocation()],
|
||||
'vocation' => $player->getVocationName(),
|
||||
'frags_enabled' => $frags_enabled,
|
||||
'frags_count' => $frags_count,
|
||||
'town' => isset($config['towns'][$player->getTownId()]) ? $config['towns'][$player->getTownId()] : null,
|
||||
|
@ -63,10 +63,7 @@ foreach($posts as &$post)
|
||||
$post['group'] = $groupName;
|
||||
$post['player_link'] = getPlayerLink($player->getName());
|
||||
|
||||
$post['vocation'] = 'Unknown';
|
||||
if(isset($config['vocations'][$player->getVocation()])) {
|
||||
$post['vocation'] = $config['vocations'][$player->getVocation()];
|
||||
}
|
||||
$post['vocation'] = $player->getVocationName();
|
||||
|
||||
$rank = $player->getRank();
|
||||
if($rank->isLoaded())
|
||||
|
@ -94,7 +94,7 @@ else
|
||||
{
|
||||
if(isset($_REQUEST['todo']) && $_REQUEST['todo'] == 'save') {
|
||||
$player->setRank();
|
||||
$twig->render('success.html.twig', array(
|
||||
echo $twig->render('success.html.twig', array(
|
||||
'title' => 'Leave guild',
|
||||
'description' => 'Player with name <b>'.$player->getName().'</b> leaved guild <b>'.$guild->getName().'</b>.',
|
||||
'custom_buttons' => $twig->render('guilds.back_button.html.twig', array(
|
||||
|
@ -10,6 +10,7 @@
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
||||
$title = 'Guilds';
|
||||
$guild_name = isset($_REQUEST['guild']) ? urldecode($_REQUEST['guild']) : null;
|
||||
if(!Validator::guildName($guild_name))
|
||||
$errors[] = Validator::getLastError();
|
||||
@ -41,6 +42,7 @@ else
|
||||
$players_from_account_in_guild = array();
|
||||
if($logged)
|
||||
{
|
||||
$players_from_account_ids = array();
|
||||
$account_players = $account_logged->getPlayers();
|
||||
foreach($account_players as $player)
|
||||
{
|
||||
|
@ -164,7 +164,7 @@
|
||||
{% for player in players %}
|
||||
{% set i = i + 1 %}
|
||||
<tr bgcolor="{{ getStyle(i) }}">
|
||||
<td><a href="{{ getLink('characters/' ~ player.getName()|urlencode) }}">{{ player.getName() }}</a></td><td>{{ player.getLevel() }}</td><td>{{ config.vocations[player.getVocation()] }}</td><td>{{ config.towns[player.getTownId()] }}</td><td>{% if player.getLastLogin() > 0 %}{{ player.getLastLogin|date('d F Y (H:i)') }}{% else %}Never.{% endif %}</td><td>{% if player.isOnline() %}<font color="green">ONLINE</font>{% else %}<font color="red">Offline</font>{% endif %}</td><td>{% if player.isHidden() %}Hidden{% else %}Visible{% endif %}</td><td>[<a href="{{ getLink('account/character/comment/' ~ player.getName|urlencode) }}" >Edit</a>]</td>
|
||||
<td><a href="{{ getLink('characters/' ~ player.getName()|urlencode) }}">{{ player.getName() }}</a></td><td>{{ player.getLevel() }}</td><td>{{ player.getVocationName() }}</td><td>{{ config.towns[player.getTownId()] }}</td><td>{% if player.getLastLogin() > 0 %}{{ player.getLastLogin|date('d F Y (H:i)') }}{% else %}Never.{% endif %}</td><td>{% if player.isOnline() %}<font color="green">ONLINE</font>{% else %}<font color="red">Offline</font>{% endif %}</td><td>{% if player.isHidden() %}Hidden{% else %}Visible{% endif %}</td><td>[<a href="{{ getLink('account/character/comment/' ~ player.getName|urlencode) }}" >Edit</a>]</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
@ -385,12 +385,8 @@
|
||||
<td>
|
||||
<nobr>{{ i }}. {{ player.getName() }}{% if player.isDeleted() %}<font color="red"> [DELETED]</font>{% endif %}</nobr>
|
||||
</td>
|
||||
{% set vocation = 'Unknown' %}
|
||||
{% if config.vocations[player.getVocation()] is defined %}
|
||||
{% set vocation = config.vocations[player.getVocation()] %}
|
||||
{% endif %}
|
||||
|
||||
<td>{{ player.getLevel() }} {{ vocation }}</td>
|
||||
<td>{{ player.getLevel() }} {{ player.getVocationName() }}</td>
|
||||
<td>{% if player.isOnline() %}<b><font color="green">Online</font></b>{% endif %}</td>
|
||||
<td>
|
||||
<table border="0" cellspacing="0" cellpadding="0">
|
||||
|
Loading…
x
Reference in New Issue
Block a user