AAC How can i put a description in create character part?

roriscrave

Intermediate OT User
Joined
Dec 7, 2011
Messages
628
Best answers
17
Reaction score
74
Hi!
Im using GesiorAAc!
How can i put a description like:
Knight (Tanker)
Mage (Healer)
etc
1566710787005.png
 

Jacobs

Webdev, mapper
Joined
Jun 22, 2014
Messages
403
Best answers
2
Reaction score
275
Location
Slovakia
I've never worked with Gesior AAC but I've looked through the sources on Github:

If I'm correct, the vocations that display there are taken from config:

PHP:
$config['site']['newchar_vocations'] = array(1 => 'Sorcerer Sample', 2 => 'Druid Sample', 3 => 'Paladin Sample', 4 => 'Knight Sample');
Found here
 
OP
R

roriscrave

Intermediate OT User
Joined
Dec 7, 2011
Messages
628
Best answers
17
Reaction score
74
I've never worked with Gesior AAC but I've looked through the sources on Github:

If I'm correct, the vocations that display there are taken from config:

PHP:
$config['site']['newchar_vocations'] = array(1 => 'Sorcerer Sample', 2 => 'Druid Sample', 3 => 'Paladin Sample', 4 => 'Knight Sample');
Found here
Yes, you are sure, but how i can add the "description"? like i said?
 

Jacobs

Webdev, mapper
Joined
Jun 22, 2014
Messages
403
Best answers
2
Reaction score
275
Location
Slovakia
Well the thing is, you can't just add the description there as the element won't be styled.
From what I see, the variable $config['site']['newchar_vocations'] isn't used anywhere else but character creation.
Possibly the simpliest solution would be to edit the array and add some wrapping element.

However the echoing of that value from the config array is escaped via the function htmlspecialchars(), so this is not possible without editing pages/accountmanagement.php

So, probably, the simpliest solution is:
In pages/accountmanagement.php line 673

Replace
PHP:
                        $main_content .= '>'.htmlspecialchars($vocation_name[$char_vocation_key]).'</td></tr>';
with
PHP:
                        $main_content .= '>' . $vocation_name[$char_vocation_key] . '</td></tr>';
And in your config, update the config to e.g.:

PHP:
$config['site']['newchar_vocations'] = array(1 => 'Knight <span style="color: rgb(184, 49, 47)">(Tanker)</span>', 2 => 'Mage <span style="color: rgb(184, 49, 47)">(Tanker)</span>');
Making sure you've got the HTML elements closed properly, as this could break your html if configured inproperly.

So the config array contains an additional html element that now gets rendered thanks to removal of the PHP function htmlspecialchars()
 
OP
R

roriscrave

Intermediate OT User
Joined
Dec 7, 2011
Messages
628
Best answers
17
Reaction score
74
Well the thing is, you can't just add the description there as the element won't be styled.
From what I see, the variable $config['site']['newchar_vocations'] isn't used anywhere else but character creation.
Possibly the simpliest solution would be to edit the array and add some wrapping element.

However the echoing of that value from the config array is escaped via the function htmlspecialchars(), so this is not possible without editing pages/accountmanagement.php

So, probably, the simpliest solution is:
In pages/accountmanagement.php line 673

Replace
PHP:
                        $main_content .= '>'.htmlspecialchars($vocation_name[$char_vocation_key]).'</td></tr>';
with
PHP:
                        $main_content .= '>' . $vocation_name[$char_vocation_key] . '</td></tr>';
And in your config, update the config to e.g.:

PHP:
$config['site']['newchar_vocations'] = array(1 => 'Knight <span style="color: rgb(184, 49, 47)">(Tanker)</span>', 2 => 'Mage <span style="color: rgb(184, 49, 47)">(Tanker)</span>');
Making sure you've got the HTML elements closed properly, as this could break your html if configured inproperly.

So the config array contains an additional html element that now gets rendered thanks to removal of the PHP function htmlspecialchars()
I just copied it as you submitted, but nothing changed.
still only Knight, Mage.
the tab opens normal, no errors, but no modifications too :( but thx for try to help!!
 

Yalasari

Member
Joined
Jul 16, 2017
Messages
58
Best answers
5
Reaction score
32
Inside config.php add this line:
PHP:
$config['site']['vocation_descriptions'] = array(1 => 'Sorcerer Title', 2 => 'Druid Title', 3 => 'Paladin Title', 4 => 'Knight Title');
then inside accountmanagment.php

PHP:
$main_content .= '<td><table class="TableContent" width="100%" ><tr class="Odd" valign="top"><td width="160"><br /><b>Select your vocation:</b></td><td><table class="TableContent" width="100%" >';
                    foreach($config['site']['newchar_vocations'] as $char_vocation_key => $sample_char)
                    {
                        $main_content .= '<tr><td><input type="radio" name="newcharvocation" value="'.$char_vocation_key.'" ';
                        if($newchar_vocation == $char_vocation_key)
                            $main_content .= 'checked="checked" ';
                        $main_content .= '>'.htmlspecialchars($vocation_name[$char_vocation_key]).'</td></tr>';
                    }
                    $main_content .= '</table></table></td>';
replace this line
PHP:
 $main_content .= '>'.htmlspecialchars($vocation_name[$char_vocation_key]).'</td></tr>';
with this
PHP:
 $main_content .= '>'.htmlspecialchars($vocation_name[$char_vocation_key]).' '.$config['site']['vocation_descriptions'][$char_vocation_key].'</td></tr>';
It should display something like this now:
Code:
Sorcerer Sorcerer Title
Druid Druid Title
Paladin Paladin Title
Knight Knight Title
You can now adjust description inside Your config.php
Array which You pasted inside config.php contains text which will be displayed next to vocation name,
so something like this (<a style="color: red">Healer</a>) should output (Healer)
 
Last edited:
Top