mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-29 18:59:21 +02:00
* fixed displaying of percent bar on tibian signature
This commit is contained in:
parent
e4110a6981
commit
cf12265cd8
@ -3152,6 +3152,14 @@ class OTS_Player extends OTS_Row_DAO
|
|||||||
$this->db->query('DELETE FROM ' . $this->db->tableName('player_spells') . ' WHERE ' . $this->db->fieldName('player_id') . ' = ' . $this->data['id'] . ' AND ' . $this->db->fieldName('name') . ' = ' . $this->db->quote( $spell->getName() ) );
|
$this->db->query('DELETE FROM ' . $this->db->tableName('player_spells') . ' WHERE ' . $this->db->fieldName('player_id') . ' = ' . $this->data['id'] . ' AND ' . $this->db->fieldName('name') . ' = ' . $this->db->quote( $spell->getName() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getPercentLevel($count, $nextLevelCount)
|
||||||
|
{
|
||||||
|
if($nextLevelCount > 0)
|
||||||
|
return min(100, max(0, $count * 100 / $nextLevelCount));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Magic PHP5 method.
|
* Magic PHP5 method.
|
||||||
*
|
*
|
||||||
|
@ -30,11 +30,9 @@ class OTS_Toolbox
|
|||||||
*/
|
*/
|
||||||
public static function experienceForLevel($level, $experience = 0)
|
public static function experienceForLevel($level, $experience = 0)
|
||||||
{
|
{
|
||||||
return 50 * ($level - 1) * ($level * $level - 5 * $level + 12) / 3 - $experience;
|
//return 50 * ($level - 1) * ($level * $level - 5 * $level + 12) / 3 - $experience;
|
||||||
/*
|
|
||||||
$level = $level - 1;
|
$level = $level - 1;
|
||||||
return ((50 * $level * $level * $level) - (150 * $level * $level) + (400 * $level)) / 3;
|
return ((50 * $level * $level * $level) - (150 * $level * $level) + (400 * $level)) / 3;
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -406,10 +406,6 @@ foreach($config['menu_categories'] as $id => $cat) {
|
|||||||
</div>
|
</div>
|
||||||
<div id="ThemeboxesColumn">
|
<div id="ThemeboxesColumn">
|
||||||
<div id="RightArtwork">
|
<div id="RightArtwork">
|
||||||
<?php
|
|
||||||
//$tmp_link =
|
|
||||||
//if($config['friendly_urls'])
|
|
||||||
?>
|
|
||||||
<img id="Monster" src="images/monsters/<?php echo logo_monster() ?>.gif" onClick="window.location = '?subtopic=creatures&creature=<?php echo $config['logo_monster'] ?>';" alt="Monster of the Week" />
|
<img id="Monster" src="images/monsters/<?php echo logo_monster() ?>.gif" onClick="window.location = '?subtopic=creatures&creature=<?php echo $config['logo_monster'] ?>';" alt="Monster of the Week" />
|
||||||
<img id="PedestalAndOnline" src="<?php echo $template_path; ?>/images/header/pedestal-and-online.gif" alt="Monster Pedestal and Players Online Box"/>
|
<img id="PedestalAndOnline" src="<?php echo $template_path; ?>/images/header/pedestal-and-online.gif" alt="Monster Pedestal and Players Online Box"/>
|
||||||
<div id="PlayersOnline" onClick="window.location = '<?php echo getLink('online'); ?>'">
|
<div id="PlayersOnline" onClick="window.location = '<?php echo getLink('online'); ?>'">
|
||||||
@ -430,8 +426,7 @@ foreach($config['menu_categories'] as $id => $cat) {
|
|||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
<?php
|
|
||||||
if($config['template_allow_change'])
|
if($config['template_allow_change'])
|
||||||
echo '<font color="white">Template:</font><br/>' . template_form();
|
echo '<font color="white">Template:</font><br/>' . template_form();
|
||||||
?>
|
?>
|
||||||
|
@ -30,12 +30,17 @@
|
|||||||
imagettftext($img, $fontsize, 0, 100, 43, $text, $font, number_format($player->getLevel()));
|
imagettftext($img, $fontsize, 0, 100, 43, $text, $font, number_format($player->getLevel()));
|
||||||
|
|
||||||
// experience bar
|
// experience bar
|
||||||
$exppercent = round($experience / $needexp * 100);
|
$currLevelExp = OTS_Toolbox::experienceForLevel($player->getLevel());
|
||||||
imagerectangle($img, 14, 46, 166, 50, $bar);
|
$nextLevelExp = OTS_Toolbox::experienceForLevel($player->getLevel() + 1);
|
||||||
if($exppercent > 0)
|
$levelPercent = 0;
|
||||||
imagefilledrectangle($img, 15, 47, $exppercent * 1.5 + 15, 49, $barfill);
|
if($nextLevelExp > $currLevelExp)
|
||||||
|
$levelPercent = (int)OTS_Player::getPercentLevel($experience - $currLevelExp, $nextLevelExp - $currLevelExp);
|
||||||
|
|
||||||
imagettftext($img, $fontsize, 0, 170, 51, $text, $font, $exppercent . '%');
|
imagerectangle($img, 14, 46, 166, 50, $bar);
|
||||||
|
if($levelPercent > 0)
|
||||||
|
imagefilledrectangle($img, 15, 47, $levelPercent * 1.5 + 15, 49, $barfill);
|
||||||
|
|
||||||
|
imagettftext($img, $fontsize, 0, 170, 51, $text, $font, $levelPercent . '%');
|
||||||
|
|
||||||
// vocation
|
// vocation
|
||||||
$vocation = 'Unknown';
|
$vocation = 'Unknown';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user