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

AAC [MyAAC] - 3 Problems with Storages and Guilds.

DukeeH

Active Member
Joined
Dec 6, 2010
Messages
550
Solutions
3
Reaction score
38
I'm trying to show rebirths on highscores box and characters page on MyAAC (Last version).

PHP:
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td>Resets:</td>
<td>{{ player.getStorage(14310) }}</td>
</tr>

On characters page i've tried this, but no success. Always blank.
I found this function to show storage, but it doesn't work.

On my highscores box it's a bit harder, since I use storage and getTopPlayers doesn't gets it.
I have no idea how to do. Can someone help?

Highscores box:
PHP:
<div>
<div id="Topbar" class="Themebox" style="background-image:url(templates/tibiacom/images/themeboxes/bg_top.png); margin-left:7px; height:320px; margin-top:-11px;" >
<div class="top_level">
<?php
foreach(getTopPlayers(5) as $player) {
echo '<div style="text-align:left"><a href="'.getPlayerLink($player['name'], false).'" class="topfont ' . ($player['online'] == 1 ? 'online' : 'offline') . '">
<img src="'. $config['outfit_images_url'] . '?id='.$player['looktype'].'&amp;addons='.$player['lookaddons'].'&amp;head='.$player['lookhead'].'&amp;body='.$player['lookbody'].'&amp;legs='.$player['looklegs'].'&amp;feet='.$player['lookfeet'].'" width="64" height="64" style="width: 64px; height: 64px; position: relative; margin-left: -30px; margin-top: -26px;">
<span style="margin-left: 3px; margin-top: 13px; position: absolute"><font color="white">'.$player['rank'].' -</font> '. (strlen($player['name']) > 15 ? substr($player['name'], 0, 15) . "..." : $player['name'] ) .'</span>
<span style="margin-left: 3px; margin-top: 26px; color: white; position: absolute"><small>Level: ('.$player['level'].')</span></small>
</div>';
}
?>
</div>
</div>

And the last one, is guilds are not being created through website, no errors on creating, but they don't work.

Where I can find some log that shows what is wrong with guilds? System/logs is clean.

Thanks!
 

Leesne

i r peekay
Premium User
Joined
Dec 4, 2017
Messages
340
Solutions
33
Reaction score
186
Location
UK
I have been rewriting the highscores etc to use the OTS_PLAYER to get all the information but never got around to finishing as with alot of the work I do on MyAAC.

characters page works fine for me:
1619122925723.png

1619122935193.png



Highscores:

1619122049021.png

HTML:
<small>Level: ('.$player['resets'].')</span>

add this in the "foreach($players as &$player) {" array.
PHP:
$resets = 0;
$query = $db->query('SELECT `value` FROM `player_storage` WHERE `key` = 14310 and `player_id` = ' . $player['id']);
if($query->rowCount() > 0) {
   $query = $query->fetch();
   $resets = $query['value'];
}
$player['resets'] = $resets;
its sloppy as I'm sure you can use a join somewhere instead.

Once i finish my bootstrap theme I'll include the updated getTopPlayers in MyAAC dev git.
 
Last edited:
OP
OP
DukeeH

DukeeH

Active Member
Joined
Dec 6, 2010
Messages
550
Solutions
3
Reaction score
38
@Leesne - Thank you so much highscores worked perfectly.
If I want to order by reborns and then level, i'd need to do some changes on getTopPlayers, right?

Second problem:
Using this on characters.html.twig
1619130473157.png

@slaw Cleared cache through admin panel, and through system folders, but still blank.
1619130560824.png

What about the guild problem? Where I can find some log or anything?
Players were trying, it said it was sucessfully, but it didn't.
 

slaw

Developer
Joined
Aug 27, 2007
Messages
3,282
Solutions
101
Reaction score
767
Location
Germany
GitHub
slawkens
@Leesne - Thank you so much highscores worked perfectly.
If I want to order by reborns and then level, i'd need to do some changes on getTopPlayers, right?

Second problem:
Using this on characters.html.twig
View attachment 57925

@slaw Cleared cache through admin panel, and through system folders, but still blank.
View attachment 57927

What about the guild problem? Where I can find some log or anything?
Players were trying, it said it was sucessfully, but it didn't.

That means this player don't have this storage, or its null.

About guilds problem: show me the structure of your guilds table:
1619132058867.png
 

Leesne

i r peekay
Premium User
Joined
Dec 4, 2017
Messages
340
Solutions
33
Reaction score
186
Location
UK
@Leesne - Thank you so much highscores worked perfectly.
If I want to order by reborns and then level, i'd need to do some changes on getTopPlayers, right?

Second problem:
Using this on characters.html.twig
View attachment 57925

@slaw Cleared cache through admin panel, and through system folders, but still blank.
View attachment 57927

What about the guild problem? Where I can find some log or anything?
Players were trying, it said it was sucessfully, but it didn't.
Because you use getstorage for your resets, you would need to reorder the array.

You need to replace code in highscores.twig
PHP:
{{ player['rank'] }}
with
PHP:
{{ loop.index }}

then add this code at the bottom of the gettopplayers function.
PHP:
    array_multisort(array_column($players, 'resets'),  SORT_DESC,
            array_column($players, 'experience'), SORT_DESC,
            $players);

Depending on how you would want it ordered
1619366839096.png


PHP:
<tr bgcolor="{{ getStyle(rows) }}">
    <td>Resets:</td>
    <td>{{ player.getStorage(14310) }}</td>
</tr>
is working fine for me.

In characters.php
try adding
PHP:
$resets = $player->getStorage(14310);

then under
PHP:
$twig->display('characters.html.twig', array(

add

PHP:
'resets' => $resets,
then on the twig file

HTML:
<tr bgcolor="{{ getStyle(rows) }}">
   <td>Resets:</td>
   <td>{{ resets) }}</td>
</tr>

(you shouldn't need to have to do this as its working fine on my test site and public site)
 
OP
OP
DukeeH

DukeeH

Active Member
Joined
Dec 6, 2010
Messages
550
Solutions
3
Reaction score
38
Because you use getstorage for your resets, you would need to reorder the array.

You need to replace code in highscores.twig
PHP:
{{ player['rank'] }}
with
PHP:
{{ loop.index }}

then add this code at the bottom of the gettopplayers function.
PHP:
    array_multisort(array_column($players, 'resets'),  SORT_DESC,
            array_column($players, 'experience'), SORT_DESC,
            $players);

Depending on how you would want it ordered
View attachment 58016


PHP:
<tr bgcolor="{{ getStyle(rows) }}">
    <td>Resets:</td>
    <td>{{ player.getStorage(14310) }}</td>
</tr>
is working fine for me.

In characters.php
try adding
PHP:
$resets = $player->getStorage(14310);

then under
PHP:
$twig->display('characters.html.twig', array(

add

PHP:
'resets' => $resets,
then on the twig file

HTML:
<tr bgcolor="{{ getStyle(rows) }}">
   <td>Resets:</td>
   <td>{{ resets) }}</td>
</tr>

(you shouldn't need to have to do this as its working fine on my test site and public site)

really weird on the storage part.
still not working, is there a way to debug it?
it shows blank, tried clearing cache trough admin panel and cache folder, nothing.
 

Leesne

i r peekay
Premium User
Joined
Dec 4, 2017
Messages
340
Solutions
33
Reaction score
186
Location
UK
You could try adding some "echo"s inside the getstorage function itself.
see if it printers the char ID and value within the function rather than when called.
 
OP
OP
DukeeH

DukeeH

Active Member
Joined
Dec 6, 2010
Messages
550
Solutions
3
Reaction score
38
@slaw
It creates the guild, but not even the leader is on it, and it doesn't show ingame.
Is there any sort of log that I can see?

1619723698727.png
 

slaw

Developer
Joined
Aug 27, 2007
Messages
3,282
Solutions
101
Reaction score
767
Location
Germany
GitHub
slawkens
Last edited:
OP
OP
DukeeH

DukeeH

Active Member
Joined
Dec 6, 2010
Messages
550
Solutions
3
Reaction score
38
Where to download?
Post automatically merged:



Btw. Shouldn't it show like it is? Without the guild leader in "Guild Members"?

No, it should have leader.
It creates the guild, but not even the leader joins it.
 
Top