• 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!

Look at promo level instead of vocation(Znote AAC)

dominique120

Science & Reason
Senator
Premium User
Joined
Jun 16, 2013
Messages
3,881
Solutions
3
Reaction score
1,043
Location
Númenor
My promotion NPCs promote the player using:

Code:
  node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 200000, level = 20, [U][B]promotion = 1[/B][/U], text = '...'})

So in my database what changes is the promo level, not the vocation.

Is there a way to have Znote's AAC look at promo level instead of vocation?

Or maybe someone could make an npc that changes vocations instead of the promo level?

Thanks
 
Hello,

you can change your SQL queries to include promotion, then if you want to show example Elite Knight at the character profile just check if promotion != 0 then if vocation is 1 or Knight write Elite Knight etc.

Example:
characterprofile.php row 10:
Code:
$profile_data = user_character_data($user_id, 'name', 'level', 'vocation', 'promotion', 'lastlogin', 'online', 'town_id', 'account_id');

row 21 and below //PROFILE MARKUP
Code:
<li><font class="profile_font" name="profile_font_vocation"><b>Vocation:</b> <?php
                    if ($profile_data['promotion'] != 0) {
                        if (vocation_id_to_name($profile_data['vocation']) == 'Knight') {
                        echo 'Elite Knight';
                        }
?></font></li>
 
Hello,

you can change your SQL queries to include promotion, then if you want to show example Elite Knight at the character profile just check if promotion != 0 then if vocation is 1 or Knight write Elite Knight etc.

Example:
characterprofile.php row 10:
Code:
$profile_data = user_character_data($user_id, 'name', 'level', 'vocation', 'promotion', 'lastlogin', 'online', 'town_id', 'account_id');

row 21 and below //PROFILE MARKUP
Code:
<li><font class="profile_font" name="profile_font_vocation"><b>Vocation:</b> <?php
                    if ($profile_data['promotion'] != 0) {
                        if (vocation_id_to_name($profile_data['vocation']) == 'Knight') {
                        echo 'Elite Knight';
                        }
?></font></li>

Could you show me more or less what would I have to replace and how?

I'm using Znote's AAC v1.5
 
In engine/function/general.php add this function.

Code:
function getPlayerPromotion($user_id)
{
    $user_id = sanitize($user_id);
    $data = mysql_select_single("SELECT `promotion` FROM `players` WHERE `id` = $user_id;");
    switch($data['promotion'])
    {
        case 1: $ret = 1;
        case 2: $ret = 2;
        default: $ret = 0;
    }
    return $ret;
}

Before

Code:
echo vocation_id_to_name($profile_data['vocation'].....

Add

Code:
<?php
switch(getPlayerPromotion($user_id))
    {
        case 1: $extra = 4;
        case 2: $extra = 8;
        default: $extra = 0;
    }
?>

Then replace your echo by this echo.

Code:
echo vocation_id_to_name($profile_data['vocation']+$extra);
 
I did changes to lines 13, from 23 to 32 and 39, but it is still not working, the vocations are set up properly in config.php, I attached it, if you could check it out I would be grateful.

Remove the .txt extension to view it as php, I cant upload php here. Thanks
 

Attachments

  • characterprofile.php.txt
    7.8 KB · Views: 8 · VirusTotal
I using tfs 1.0 and Guild War page not work because its only tfs 0.2 and 0.3...
How can i fix it?
 
Back
Top