• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[Modern AAC] SkillPix Gold (displays % of skills, loads from vocations.xml)

hodleo

Formerly cbrm -Crypto enthusiast, Retired scripter
Staff member
Global Moderator
Joined
Jan 6, 2009
Messages
6,598
Solutions
3
Reaction score
955
Location
Caribbean Sea
hPjidHo2Rj.png

doIzaj7RO4.png

91va9a9cN.png


Changelog:
*fixed center aligment of skills levels
*reduced code with iterators
*added a javascript to generate the percentage bars
*added % left to level up message
----------------------------------------------------------------
*now script loads multipliers from parsed vocations.xml
*added some vars as globals
*added promoted vocation check

This is a new version of my Skill Pics code. This new edition is an important fix to the last one released (SkillPix Deluxe) for premium users, now available for everyo
ne :w00t:

The formulas used to measure the percentages are accurate, I made them based on TibiaWiki statistics and TFS sources.

The skills multipliers are the ones from vocations.xml, so you just have to type your vocations.xml file path here:

PHP:
//Load vocations.xml
$GLOBALS['XML'] = simplexml_load_file('C:/Users/CyberM/Desktop/Server/data/XML/vocations.xml');


  • Create a new folder @ /injections/character_view/askills and inside there put the files from the ZIP download located at the bottom of this thread.

  • Then create this new script @/injections/character_view/askills/injection.php :
PHP:
<!-- 
     #####################################################
    #SkillPix Gold Injection for ModernAAC, by Cybermaster#
     #####################################################
-->  

<!-- Progress bar widget, by Matthew Harvey (matt at smallish.com) --> 
<!-- Licensed under a Creative Commons Attribution-Share Alike 2.5 
License (http://creativecommons.org/licenses/by-sa/2.5/) -->
<style type="text/css"> 
    div.smallish-progress-wrapper 
    { 
        /* Don't change the following lines. */ 
        position: relative; 
    }
    div.smallish-progress-bar 
    { 
        /* Don't change the following lines. */ 
        position: absolute; 
        top: 0; 
        left: 0; 
        height: 100%; 
    } 
    div.smallish-progress-text 
    { 
        text-align: center; 
        position: relative; 
        font-weight: bold;
        text-shadow: 0 0 0.2em #FFFAFA, 0 0 0.2em #FFFAFA, 0 0 0.2em #FFFAFA;        
    } 
    div.skill-progress {
        border: 1px solid #ccc; 
        width: 38px; 
        background: #FFFAFA;
        margin: 0px auto -1px auto;
    }    
</style>  

<!-- Progress bar widget, by Matthew Harvey (matt at smallish.com) --> 
<!-- Licensed under a Creative Commons Attribution-Share Alike 2.5 
License (http://creativecommons.org/licenses/by-sa/2.5/) --> 
<script type="text/javascript"> 
    function drawProgressBar(color, width, percent, amount) 
    { 
        var pixels = width * (percent / 100);
        document.write('<div class="smallish-progress-wrapper" style="width: ' + width + 'px">'); 
        document.write('<div class="smallish-progress-bar" style="width: ' + pixels + 'px; background-color: ' + color + ';"></div>'); 
        document.write('<div class="smallish-progress-text" style="width: ' + width + 'px">' + amount + '</div>'); 
        document.write('</div>'); 
    } 
</script> 

<?php
    if (!defined('BASEPATH')) exit('No direct script access allowed');
    $player = $GLOBALS['player'];
    $GLOBALS['SQL'] = POT::getInstance()->getDBHandle();
    $DIR = '../../../injections/character_view/askills/';
    //Load vocations.xml
    $GLOBALS['XML'] = simplexml_load_file('C:/Users/CyberM/Desktop/Server/data/XML/vocations.xml');

    //BG-COLORS
    $BG1 = '#F5F5F5'; //WhiteSmoke 
    $BG2 = '#E6E6FA'; //Lavender
    $BG3 = '#FFF8DC'; //Cornsilk
    $GLOBALS['base'] = array(50,50,50,50,30,100,20);            
    $bars = array('DEB887','ADFF2F','E9967A','D8BFD8','00FF7F','40E0D0','87CEEB');

    $skill = array
    (
        0 => array('Level','The level of a character is perhaps the single most important characteristic. As a rule, characters grow in power whenever their level increases, so the level is a good indicator of a character\'s overall strength. To advance in level characters must collect experience points. Whenever they have amassed enough points they will advance to the next level automatically.'),
        1 => array('Mag.Lv.','The magic level is similar to regular weapon skills in that it directly influences the power of a character\'s spells. Thus, a druid with a high magic level will restore more hit points when casting a healing spell than a druid of comparable experience who has a lower magic level. This way it is even possible for a low-level spellcaster to cast spells that are more powerful than those of some high-level characters.'),
        2 => array('Fist','This skill determines your character\'s ability to fight with bare hands. Needless to say, characters do not cause much damage when fighting unarmed, even if they have a considerable fist fighting skill.'),
        3 => array('Club','This is a weapon skill. It covers blunt weapons such as clubs, maces, staffs and hammers.'),
        4 => array('Sword','Another weapon skill. This skill is needed to use any kind of edged weapons, from puny knives to mighty giant swords.'),
        5 => array('Axe','Similar to other weapon skills, your character will need the corresponding skill to successfully wield any kinds of axe, from hatchets to the legendary Stonecutter Axe. Also, this skill covers pole weapons such as halberds and lances.'),
        6 => array('Dist.','This weapon skill covers all distance weapons. This includes thrown weapons such as stones and spears as well as bows and crossbows.'),
        7 => array('Shield','Shielding is the ability to successfully block enemy attacks with a shield. Of course, characters need to hold shields in their hands in order to use this skill. Note that it is not possible to block more than 2 opponents at a time.'),
        8 => array('Fishing','Fishing differs from other skills in that you must actively use it every single time you try to catch a fish. To use this skill characters need a fishing rod and some worms in their inventory. Worms can be found in some monsters or can be bought at shops that also sell fishing rods. Equipped with the fishing gear, you will have to find a place close to a river or some other body of water that contains fish. Once you have found a suitable place all you need to do is to use  the fishing rod on the water. Do not worry if you do not catch a fish immediately - your chance to catch one will increase with your fishing skill.')
    );
        
    function getTries($player_id, $skill_id) 
    {
        global $SQL;
        $result = $SQL->query('SELECT `count` FROM `player_skills` WHERE `player_id` = '.$player_id.' AND `skillid` = '.$skill_id.' LIMIT 1;')->fetch();
        return $result[0];
    }

    function getExperiencePercent($level, $exp) 
    {    
        $lv = $level-1;$eX = (((50*$lv*$lv*$lv)-(150*$lv*$lv)+(400*$lv))/3);
        $eXx = (((50*$level*$level*$level)-(150*$level*$level)+(400*$level))/3);
        return floor((($exp-$eX)/($eXx-$eX)*100));
    }

    function getManaSpentPercentage($level, $spent, $vocation, $promotion) 
    {    
        global $XML;
        $array = array();
        foreach($XML->vocation as $key=>$value){$array[] = $value['manamultiplier'];}
        $formula = floor(($spent/(1600*pow($array[$vocation+($promotion*4)],($level+1)-1)))*100);
        return $formula > 99 ? 99 : $formula;
    }

    function getSkillTriesPercentage($skill, $level, $tries, $voc, $promotion) 
    {
        global $XML;
        global $base;
        $array = array();    
        foreach($XML->vocation as $vocation)
        {
            $tmp = array();
            foreach($vocation->skill->attributes() as $val)
            {
                $tmp[] = $val;
            }
            $array[] = $tmp;
        }
        $formula = floor(($tries/($base[$skill]*pow($array[$voc+($promotion*4)][$skill],($level+1)-11))*100));
        return $formula > 99 ? 99 : $formula;
    }
        
    echo'<div class="message"><div class="title">Skills</div><div class="content"><center>
        <table align="center" width="80% border="0" cellpadding="4" cellspacing="0" class="houses_list_box">
        <tr align="center" bgcolor="'.$BG1.'">';
        
    //Skills Pics and Descriptions
    foreach($skill as $key=>$value){echo'<td><img src="'.$DIR.$key.'.gif" title="'.$value[1].'"/></td>';}

    //Skills Names
    echo '<tr align="center" bgcolor="'.$BG2.'">';
    foreach($skill as $key=>$value){echo'<td>'.$value[0].'</td>';}
    echo'</tr>';

    //Skills Stripes
    $a = 100;
    $b = getExperiencePercent($player->getLevel(),$player->getExperience());
    $c = $a-$b;
    echo'<tr bgcolor="'.$BG3.'">';
    echo'<td><div class="skill-progress" title="Needs '.$c.'% to level up.">
            <script type="text/javascript">drawProgressBar("#FFD700",38,'.$b.','.$player->getLevel().');</script>
        </div>
        </td>';

    $b = getManaSpentPercentage($player->getMagLevel(),$player->getManaSpent(), $player->getVocation(), $player->getPromotion());
    $c = $a-$b;
    echo'<td><div class="skill-progress" title="Needs '.$c.'% to level up.">
            <script type="text/javascript">drawProgressBar("#1E90FF",38,'.$b.','.$player->getMagLevel().');</script>
        </div></td>';
            
    foreach($bars as $key=>$value)
    {
        $b = getSkillTriesPercentage($key,$player->getSkill($key),getTries($player->getId(),$key),$player->getVocation(), $player->getPromotion());
        $c = $a-$b;
        echo'<td>';
        echo'
        
        <div class="skill-progress" title="Needs '.$c.'% to level up.">
            <script type="text/javascript">drawProgressBar("#'.$value.'",38,'.$b.','.$player->getSkill($key).');</script>
        </div>';
        echo'</td>';
    }
    echo'</tr></table></center></div></div>';
?>
I plan to code this later for both ArchezAAC & pandaac as soon they become public. No plans to code this for GesiorAAC, so don't request it to me, do it by yourself.
 

Attachments

  • SkillPix GOLD.zip
    37.2 KB · Views: 497 · VirusTotal
Last edited:
WOW! already saw it on premium board, but thanks for releasing for those who don't have premium :p
 
Yeh, but that old one was pretty ugly =( this new one is much much better ;) And this new one looks fine on all templates not like the old one.
 
Sorry for doubleposting:

What if i have third promotion like:

Code:
	<vocation id="9" name="third sorcerer" description="a magus spritus" needpremium="1" gaincap="10" gainhp="10" gainmana="60" gainhpticks="8" gainhpamount="20" gainmanaticks="4" gainmanaamount="20" manamultiplier="1.5" attackspeed="1500" soulmax="300" gainsoulticks="30" fromvoc="5" lessloss="40">
		<formula meleeDamage="1.0" distDamage="1.0" wandDamage="2.0" magDamage="2.0" magHealingDamage="2.0" defense="1.0" magDefense="2.0" armor="1.5"/>
		<skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="2.0" fishing="1.1" experience="1.0"/>
	</vocation>
	<vocation id="10" name="third druid" description="an natura blaster" needpremium="1" gaincap="10" gainhp="15" gainmana="60" gainhpticks="10" gainhpamount="25" gainmanaticks="4" gainmanaamount="15" manamultiplier="1.5" attackspeed="1500" soulmax="300" gainsoulticks="130" fromvoc="6" lessloss="40">
		<formula meleeDamage="1.0" distDamage="1.0" wandDamage="2.0" magDamage="2.0" magHealingDamage="3.0" defense="1.3" magDefense="1.2" armor="1.0"/>
		<skill fist="1.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="1.0"/>
	</vocation>
	<vocation id="11" name="third paladin" description="a hastatus leonadio" needpremium="1" gaincap="20" gainhp="20" gainmana="25" gainhpticks="10" gainhpamount="15" gainmanaticks="8" gainmanaamount="10" manamultiplier="1.4" attackspeed="1500" soulmax="300" gainsoulticks="30" fromvoc="7" lessloss="40">
		<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
		<skill fist="1.2" club="1.2" sword="1.2" axe="1.2" distance="3.1" shielding="1.5" fishing="1.1" experience="1.0"/>
	</vocation>
	<vocation id="12" name="third knight" description="an templar knight" needpremium="1" gaincap="25" gainhp="50" gainmana="15" gainhpticks="10" gainhpamount="50" gainmanaticks="8" gainmanaamount="15" manamultiplier="3.0" attackspeed="1500" soulmax="300" gainsoulticks="30" fromvoc="8" lessloss="40">
		<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
		<skill fist="2.1" club="3.1" sword="3.1" axe="3.1" distance="1.4" shielding="3.1" fishing="1.1" experience="1.0"/>
	</vocation>

Is it the same?

or do i have to change this:

Code:
        $base = array(0=>50,1=>50,2=>50,3=>50,4=>30,5=>100,6=>20);
        $array = array(//skill multipliers from vocations.xml
            0 => array(1.5,2.0,2.0,2.0,2.0,1.5,1.1),//none,rookie
            1 => array(1.5,2.0,2.0,2.0,2.0,1.5,1.1),//sorcerer
            2 => array(1.5,1.8,1.8,1.8,1.8,1.5,1.1),//druid
            3 => array(1.2,1.2,1.2,1.2,1.1,1.1,1.1),//paladin
            4 => array(1.1,1.1,1.1,1.1,1.4,1.1,1.1));//knight
        $formula = floor(($tries/($base[$skill]*pow($array[$voc][$skill],($level+1)-11))*100));
        return $formula > 100 ? 99 : $formula;

Code:
             4 => array(1.1,1.1,1.1,1.1,1.4,1.1,1.1));//knight

to

Code:
             5 => array(2.1,3.1,3.1,1.4,1.4,3.1,1.1));//third knight

?
 
maybe
Code:
9 => array(2.1,3.1,3.1,1.4,1.4,3.1,1.1));//third knight
and etc.. ;d
 
pm me your vocations.xml
 
@Mooosie
This script does not check player promotion level. Your player with vocation id 12 (3rd knight) has:
MySQL `players` table said:
vocation: 4
promotion: 2
because in your vocations.xml is fromvoc="8" and in vocation id 8 is fromvoc="4" (it's default config), so it is vocation id 4 upgraded 2 times ;)
 
Pho0wned thanks alot. But... It's is still like this:

If i am sorcerer with magic level 9. It is 18% left to level 10.
Same as master sorcerer
but when i am the third vocation of sorcerer i have 95% to level 10 in magic level... ;/
is it supposed to be like that?
 
Pho0wned thanks alot. But... It's is still like this:

If i am sorcerer with magic level 9. It is 18% left to level 10.
Same as master sorcerer
but when i am the third vocation of sorcerer i have 95% to level 10 in magic level... ;/
is it supposed to be like that?
No, but once I finish the new version which loads the values from parsed vocations.xml, I'll see what's the issue when there are more than 8 vocs.
 
my gain for promoted vocations are slightly different then base voc's. maybe just the best bet is letting us have to fill in values for all the vocations.

ex.
0 => array(1.5,2.0,2.0,2.0,2.0,1.5,1.1),//none,rookie
1 => array(1.5,2.0,2.0,2.0,2.0,1.5,1.1),//sorcerer
2 => array(1.5,1.8,1.8,1.8,1.8,1.5,1.1),//druid
3 => array(1.2,1.2,1.2,1.2,1.1,1.1,1.1),//paladin
4 => array(1.1,1.1,1.1,1.1,1.4,1.1,1.1));//knight
5 => array(1.5,2.0,2.3,2.0,2.0,1.5,1.1),//master sorcerer
6 => array(1.5,1.8,1.3,1.8,1.8,1.5,1.1),//elder druid
7 => array(1.2,1.2,1.3,1.2,1.1,1.1,1.1),//rp
8 => array(1.1,1.1,1.2,1.1,1.4,1.1,1.1));//ek

or arrays of vocations that use that array of values. if possible something like this. then even for someone like me with different gains for different promotions can use this method. and if you have 2 promotions that could be easily added and that information would be less repetitive
{0} => array(1.5,2.0,2.0,2.0,2.0,1.5,1.1),//none,rookie
{1,4} => array(1.5,2.0,2.0,2.0,2.0,1.5,1.1),//sorcerer
{2,6} => array(1.5,1.8,1.8,1.8,1.8,1.5,1.1),//druid
{3,7} => array(1.2,1.2,1.2,1.2,1.1,1.1,1.1),//paladin
{4,8} => array(1.1,1.1,1.1,1.1,1.4,1.1,1.1));//knight
 
my gain for promoted vocations are slightly different then base voc's. maybe just the best bet is letting us have to fill in values for all the vocations.

ex.


or arrays of vocations that use that array of values. if possible something like this. then even for someone like me with different gains for different promotions can use this method. and if you have 2 promotions that could be easily added and that information would be less repetitive
That isn't necessary in the new version that loads values from parsed vocations.xml (check edited main post.) Though if you have modified skills bases that can be a problem in the script.
 
Last edited:
*Updated script, now loads multipliers from parsed vocations.xml file, and checks the correct values if there's promoted vocation in player. Take into account that for some servers it may not display an accurate result (I'm still checking what's the problem, though the formulas seem to be exact).
 
A PHP Error was encountered

Severity: Warning

Message: Division by zero

Filename: askills/injection.php

Line Number: 118

A PHP Error was encountered

Severity: Notice

Message: Undefined offset: 2

Filename: askills/injection.php

Line Number: 118

i have problems in skills formula:

$formula = floor(($tries/($base[$skill]*pow($array[$voc+($promotion*4)][$skill],($level+1)-11))*100));
return $formula > 99 ? 99 : $formula;
 
Back
Top