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

PHP Top Outfits Ranking

Engradiel

Member
Joined
May 3, 2009
Messages
130
Reaction score
9
Location
Brazil
I found this code I saw on the server very good and interesting. However, when I do it, it is slow and poorly optimized. Can someone with knowledge adjust the optimization?

https://www.epicwarserver.com/?subtopic=rank_outfit


My code:
PHP:
<?php
//echo 'Manutenção';return;
?>
                                                    
                                                    
                                                    <div class="TableContainer">
     <table class="Table3" cellpadding="0" cellspacing="0">
          <div class="CaptionContainer">
                <div class="CaptionInnerContainer">
                     <span class="CaptionEdgeLeftTop" style="background-image:url(./layouts/tibiacom/images/global/content/box-frame-edge.gif);" /></span>
                     <span class="CaptionEdgeRightTop" style="background-image:url(./layouts/tibiacom/images/global/content/box-frame-edge.gif);" /></span>
                     <span class="CaptionBorderTop" style="background-image:url(./layouts/tibiacom/images/global/content/table-headline-border.gif);"></span>
                     <span class="CaptionVerticalLeft" style="background-image:url(./layouts/tibiacom/images/global/content/box-frame-vertical.gif);" /></span>
                     <div class="Text">Top Outfits</div>
                     <span class="CaptionVerticalRight" style="background-image:url(./layouts/tibiacom/images/global/content/box-frame-vertical.gif);" /></span>
                     <span class="CaptionBorderBottom" style="background-image:url(./layouts/tibiacom/images/global/content/table-headline-border.gif);"></span>
                     <span class="CaptionEdgeLeftBottom" style="background-image:url(./layouts/tibiacom/images/global/content/box-frame-edge.gif);" /></span>
                     <span class="CaptionEdgeRightBottom" style="background-image:url(./layouts/tibiacom/images/global/content/box-frame-edge.gif);" /></span>
                </div>
          </div>
          <tr>
                <td>
                     <div class="InnerTableContainer">
                          <table style="width:100%;">
                                <tr>
                                     <td>

                                          <div class="TableContentAndRightShadow" style="background-image:url(./layouts/tibiacom/images/global/content/table-shadow-rm.gif);">
                                                <div class="TableContentContainer">
                                                     <table class="TableContent" width="100%">
                                            <tr>
                                            </tr>
                                                          <tr>
                                                                <table class="Table1" cellpadding="2" cellspacing="0">
                                                                 <td style="text-align: center; font-weight: bold;">#</td>
                                                                     <td style="text-align: center; font-weight: bold;">Name</td>
                                                                     <td width = 5% style="text-align: center; font-weight: bold;">Outfits</td>
                                                                     <td style="text-align: center; font-weight: bold;">Count</td>
                                                                
                                            </tr>
                                            
                                            
                                <?php





include_once "system/load.newclasses.php";

    $get_outfits = $SQL->query('SELECT * FROM player_storage WHERE `key` >= 10001001 and `key` <= 10001500 and player_id > 1500;')->fetchAll();
    $vet = 0;
    
    foreach($get_outfits as $result) {
        if ((in_array($result[player_id], $test) == false)) {
            $test[$vet] = $result[player_id];
            $vet++;           
        }
    }               


$vet = 0;
foreach ($test as $result) {
    
    $player = new Player();
    $player->loadById($result);
    $sex = $player->getSex();
    $p = [];
    for ($i = 1; $i <= 500; $i++) {
        $var = (10000000 + 1000);
        $var = $var + $i;
        if ($player->getStorage($var) != NULL) {
            $p[] = $player->getStorage($var);
        }
    }
    

    $outfits_list = "";
    
    $count = 0;
    if ($p != NULL) {
        $t = [];
        
        //if ($sex == 0) {
            foreach ($p as $key => $value) {
                $q = $outfits->getOutfitByLooktype(0, $value >> 16);
                if ($q != NULL and $sex == 1) {
                    
                    if ($q['name'] != "Void Master" and $q['name'] != "Veteran Paladin" and $q['name'] != "Lion of War") {
                        $count++;
                        $q['addon'] = $value - $q['storage'];
                        //print "Storage Female: ".$q['storage'].", looktype: ".$q['looktype'].", addon: ".$q['name']."<br>";
                        $outfits_list = ''.$outfits_list.'<img title="'.$q['name'].'" id="ImagemOutfit" alt="img" src="/AnimatedOutfits/animoutfit.php?id='.$q['looktype'].'&addons='.$q['addon'].'&head=' . $player->getLookHead() . '&body=' . $player->getLookBody() . '&legs=' . $player->getLookLegs() . '&feet=' . $player->getLookFeet() . '"/>';
                        $t[] = $q;
                    }
                    
                    
                }
            }
        //} else {
        foreach ($p as $key => $value) {
            $q = $outfits->getOutfitByLooktype(1, $value >> 16);
            if ($q != NULL and $sex == 0) {
                
                if ($q['name'] != "Void Master" and $q['name'] != "Veteran Paladin" and $q['name'] != "Lion of War") {
                $q['addon'] = $value - $q['storage'];
                $count++;
                //print "Storage Female: ".$q['storage'].", looktype: ".$q['looktype'].", addon: ".$q['name']."<br>";
                $outfits_list = ''.$outfits_list.'<img title="'.$q['name'].'" id="ImagemOutfit" alt="img" src="/AnimatedOutfits/animoutfit.php?id='.$q['looktype'].'&addons='.$q['addon'].'&head=' . $player->getLookHead() . '&body=' . $player->getLookBody() . '&legs=' . $player->getLookLegs() . '&feet=' . $player->getLookFeet() . '"/>';
                $t[] = $q;
                }
            }
        }
        //}
    }
    $vet++;   
    //print "".$vet.". ".$player->getName()." - ".$outfits_list."<br>";
    $lista[$vet] = "".$count.",".$player->getName().",".$outfits_list."";
}


rsort($lista,SORT_NUMERIC );





$vet = 0;
foreach ($lista as $result) {
    
    $vet++;
    $pieces = explode(",", $result);
    if ($pieces[0] == 0) { continue;}
    print '
<tr bgcolor="' . (is_int($vet / 2) ? $config['site']['darkborder'] : $config['site']['lightborder']) . '">
<td style="text-align: center;">'.$vet.'.</td>
<td style="text-align: center;"><a href="?subtopic=characters&name='.$pieces[1].'">'.$pieces[1].'</a>
</td>
</span>
<td style="text-align: center;">
<img id="ButtonMounts'.$vet.'" onMouseDown="ToggleMaskedText(\'Mounts'.$vet.'\');" style="vertical-align:middle;cursor:pointer;" src="'.$layout_name.'/images/global/general/show.gif"/>
</td>
<td style="text-align: center;">'.$pieces[0].'</td>
<tr>
<td colspan="4">
<span class="itemStroke"></span>
<span id="DisplayMounts'.$vet.'" ></span>
<span id="MaskedMounts'.$vet.'" style="visibility:hidden;display:none" ></span>
<span id="ReadableMounts'.$vet.'" style="visibility:hidden;display:none">';



    
    
    print "".$pieces[2]."</tr></span>
    
    
    ";
    
    

    
    
    
    
    
    
    

}


    print '        </table>
                                </div>
                                </div>
                                <div class="TableShadowContainer">
                                     <div class="TableBottomShadow" style="background-image:url(./layouts/tibiacom/images/global/content/table-shadow-bm.gif);">
                                          <div class="TableBottomLeftShadow" style="background-image:url(./layouts/tibiacom/images/global/content/table-shadow-bl.gif);"></div>
                                          <div class="TableBottomRightShadow" style="background-image:url(./layouts/tibiacom/images/global/content/table-shadow-br.gif);"></div>
                                     </div>
                                </div>
                                </td>
          </tr>
          </table>
          </div>
          </td>
          </tr>
          </table>
</div>';
return;


$frequencies = array_count_values($test);
$vet = 0;
foreach ($frequencies as $id => $count) {
        //$get_name = $SQL->query('SELECT name from players where id = '.$id.' limit 1;')->fetch();
        $test2[$vet] = "".$count."  , ".$id."";
        $test2[$vet] = "".$count."  , ".$id."";
        //print "".$test2[$vet]."<br>";
        $vet++;
}

rsort($test2,SORT_NUMERIC );


    
foreach ($test2 as $result) {
    print "".$result."<br>";
    
}
return;









$get_outfits = $SQL->query('SELECT * FROM player_storage WHERE `key` >= 10001001 and `key` <= 10001500 and player_id != 419;')->fetchAll();
    $vet = 0;
    foreach($get_outfits as $result) {
        $storaged_id = $result[value];
        
        //if ($result[key]!= '78839811' and $result[key]!= '78970883' and $result[key]!= '79101955') {
        $repeat = 0;
        //foreach($outfit_list as $v) {
            //if ($outfit_list[$storaged_id]) {
                if ($repeat==0) {
                //$test[$vet] = ''.$vet.' - player '.$result[player_id].' tem o storage: '.$storaged_id.'<br>';
                $test[$vet] = $result[player_id];
                //$get_name = $SQL->query('SELECT name from players where id = '.$result[player_id].' limit 1;')->fetch();
                //echo 'Player: '.$get_name[0].' tem o storage: '.$storaged_id.'<br>';
                $repeat = 1;
                $vet++;
                }
            //}
        //}
        //}
    }               


$frequencies = array_count_values($test);
$vet = 0;
foreach ($frequencies as $id => $count) {
        //$get_name = $SQL->query('SELECT name from players where id = '.$id.' limit 1;')->fetch();
        $test2[$vet] = "".$count.",".$id."";
        //print "".$test2[$vet]."<br>";
        $vet++;
}

rsort($test2,SORT_NUMERIC );




include_once "system/load.newclasses.php";
foreach ($test2 as $result) {
    $count = 0;
    $outfits_list = "";
    $pieces = explode(",", $result);
    $player = new Player();
    $player->loadById($pieces[1]);
    $sex = $player->getSex();
    $p = [];
    for ($i = 1; $i <= 500; $i++) {
        $var = (10000000 + 1000);
        $var = $var + $i;
        if ($player->getStorage($var) != NULL) {
            $p[] = $player->getStorage($var);
        }
    }
    
    $x++;
    
    if ($p != NULL) {
        $t = [];
        
        //if ($sex == 0) {
            foreach ($p as $key => $value) {
                $q = $outfits->getOutfitByLooktype(0, $value >> 16);
                if ($q != NULL and $sex == 1) {
                    
                    if ($q['name'] != "Void Master" and $q['name'] != "Veteran Paladin" and $q['name'] != "Lion of War") {
                        $count++;
                        $q['addon'] = $value - $q['storage'];
                        //print "Storage Female: ".$q['storage'].", looktype: ".$q['looktype'].", addon: ".$q['name']."<br>";
                        $outfits_list = ''.$outfits_list.'<img title="'.$q['name'].'" id="ImagemOutfit" alt="img" src="/AnimatedOutfits/animoutfit.php?id='.$q['looktype'].'&addons='.$q['addon'].'&head=' . $player->getLookHead() . '&body=' . $player->getLookBody() . '&legs=' . $player->getLookLegs() . '&feet=' . $player->getLookFeet() . '"/>';
                        $t[] = $q;
                    }
                    
                    
                }
            }
        //} else {
        foreach ($p as $key => $value) {
            $q = $outfits->getOutfitByLooktype(1, $value >> 16);
            if ($q != NULL and $sex == 0) {
                
                if ($q['name'] != "Void Master" and $q['name'] != "Veteran Paladin" and $q['name'] != "Lion of War") {
                $q['addon'] = $value - $q['storage'];
                $count++;
                //print "Storage Female: ".$q['storage'].", looktype: ".$q['looktype'].", addon: ".$q['name']."<br>";
                $outfits_list = ''.$outfits_list.'<img title="'.$q['name'].'" id="ImagemOutfit" alt="img" src="/AnimatedOutfits/animoutfit.php?id='.$q['looktype'].'&addons='.$q['addon'].'&head=' . $player->getLookHead() . '&body=' . $player->getLookBody() . '&legs=' . $player->getLookLegs() . '&feet=' . $player->getLookFeet() . '"/>';
                $t[] = $q;
                }
            }
        }
        //}
    }
    
    if ($count>0 and $x <= 30) {
    
    
    print '
<tr bgcolor="' . (is_int($x / 2) ? $config['site']['darkborder'] : $config['site']['lightborder']) . '">
<td style="text-align: center;">'.$x.'.</td>
<td style="text-align: center;"><a href="?subtopic=characters&name='.$player->getName().'">'.$player->getName().'</a>
</td>
</span>
<td style="text-align: center;">
<img id="ButtonMounts'.$x.'" onMouseDown="ToggleMaskedText(\'Mounts'.$x.'\');" style="vertical-align:middle;cursor:pointer;" src="'.$layout_name.'/images/global/general/show.gif"/>
</td>
<td style="text-align: center;">'.$count.'</td>
<tr>
<td colspan="4">
<span class="itemStroke"></span>
<span id="DisplayMounts'.$x.'" ></span>
<span id="MaskedMounts'.$x.'" style="visibility:hidden;display:none" ></span>
<span id="ReadableMounts'.$x.'" style="visibility:hidden;display:none">';



    
    
    print "".$outfits_list."</tr></span>
    
    
    ";
    
    
    
    }
    
}




    

                                            
                        print '        </table>
                                </div>
                                </div>
                                <div class="TableShadowContainer">
                                     <div class="TableBottomShadow" style="background-image:url(./layouts/tibiacom/images/global/content/table-shadow-bm.gif);">
                                          <div class="TableBottomLeftShadow" style="background-image:url(./layouts/tibiacom/images/global/content/table-shadow-bl.gif);"></div>
                                          <div class="TableBottomRightShadow" style="background-image:url(./layouts/tibiacom/images/global/content/table-shadow-br.gif);"></div>
                                     </div>
                                </div>
                                </td>
          </tr>
          </table>
          </div>
          </td>
          </tr>
          </table>
</div>';
 
I found this code I saw on the server very good and interesting. However, when I do it, it is slow and poorly optimized. Can someone with knowledge adjust the optimization?

https://www.epicwarserver.com/?subtopic=rank_outfit


My code:
PHP:
<?php
//echo 'Manutenção';return;
?>
                                                
                                                
                                                    <div class="TableContainer">
     <table class="Table3" cellpadding="0" cellspacing="0">
          <div class="CaptionContainer">
                <div class="CaptionInnerContainer">
                     <span class="CaptionEdgeLeftTop" style="background-image:url(./layouts/tibiacom/images/global/content/box-frame-edge.gif);" /></span>
                     <span class="CaptionEdgeRightTop" style="background-image:url(./layouts/tibiacom/images/global/content/box-frame-edge.gif);" /></span>
                     <span class="CaptionBorderTop" style="background-image:url(./layouts/tibiacom/images/global/content/table-headline-border.gif);"></span>
                     <span class="CaptionVerticalLeft" style="background-image:url(./layouts/tibiacom/images/global/content/box-frame-vertical.gif);" /></span>
                     <div class="Text">Top Outfits</div>
                     <span class="CaptionVerticalRight" style="background-image:url(./layouts/tibiacom/images/global/content/box-frame-vertical.gif);" /></span>
                     <span class="CaptionBorderBottom" style="background-image:url(./layouts/tibiacom/images/global/content/table-headline-border.gif);"></span>
                     <span class="CaptionEdgeLeftBottom" style="background-image:url(./layouts/tibiacom/images/global/content/box-frame-edge.gif);" /></span>
                     <span class="CaptionEdgeRightBottom" style="background-image:url(./layouts/tibiacom/images/global/content/box-frame-edge.gif);" /></span>
                </div>
          </div>
          <tr>
                <td>
                     <div class="InnerTableContainer">
                          <table style="width:100%;">
                                <tr>
                                     <td>

                                          <div class="TableContentAndRightShadow" style="background-image:url(./layouts/tibiacom/images/global/content/table-shadow-rm.gif);">
                                                <div class="TableContentContainer">
                                                     <table class="TableContent" width="100%">
                                            <tr>
                                            </tr>
                                                          <tr>
                                                                <table class="Table1" cellpadding="2" cellspacing="0">
                                                                 <td style="text-align: center; font-weight: bold;">#</td>
                                                                     <td style="text-align: center; font-weight: bold;">Name</td>
                                                                     <td width = 5% style="text-align: center; font-weight: bold;">Outfits</td>
                                                                     <td style="text-align: center; font-weight: bold;">Count</td>
                                                            
                                            </tr>
                                        
                                        
                                <?php





include_once "system/load.newclasses.php";

    $get_outfits = $SQL->query('SELECT * FROM player_storage WHERE `key` >= 10001001 and `key` <= 10001500 and player_id > 1500;')->fetchAll();
    $vet = 0;
 
    foreach($get_outfits as $result) {
        if ((in_array($result[player_id], $test) == false)) {
            $test[$vet] = $result[player_id];
            $vet++;       
        }
    }           


$vet = 0;
foreach ($test as $result) {
 
    $player = new Player();
    $player->loadById($result);
    $sex = $player->getSex();
    $p = [];
    for ($i = 1; $i <= 500; $i++) {
        $var = (10000000 + 1000);
        $var = $var + $i;
        if ($player->getStorage($var) != NULL) {
            $p[] = $player->getStorage($var);
        }
    }
 

    $outfits_list = "";
 
    $count = 0;
    if ($p != NULL) {
        $t = [];
    
        //if ($sex == 0) {
            foreach ($p as $key => $value) {
                $q = $outfits->getOutfitByLooktype(0, $value >> 16);
                if ($q != NULL and $sex == 1) {
                
                    if ($q['name'] != "Void Master" and $q['name'] != "Veteran Paladin" and $q['name'] != "Lion of War") {
                        $count++;
                        $q['addon'] = $value - $q['storage'];
                        //print "Storage Female: ".$q['storage'].", looktype: ".$q['looktype'].", addon: ".$q['name']."<br>";
                        $outfits_list = ''.$outfits_list.'<img title="'.$q['name'].'" id="ImagemOutfit" alt="img" src="/AnimatedOutfits/animoutfit.php?id='.$q['looktype'].'&addons='.$q['addon'].'&head=' . $player->getLookHead() . '&body=' . $player->getLookBody() . '&legs=' . $player->getLookLegs() . '&feet=' . $player->getLookFeet() . '"/>';
                        $t[] = $q;
                    }
                
                
                }
            }
        //} else {
        foreach ($p as $key => $value) {
            $q = $outfits->getOutfitByLooktype(1, $value >> 16);
            if ($q != NULL and $sex == 0) {
            
                if ($q['name'] != "Void Master" and $q['name'] != "Veteran Paladin" and $q['name'] != "Lion of War") {
                $q['addon'] = $value - $q['storage'];
                $count++;
                //print "Storage Female: ".$q['storage'].", looktype: ".$q['looktype'].", addon: ".$q['name']."<br>";
                $outfits_list = ''.$outfits_list.'<img title="'.$q['name'].'" id="ImagemOutfit" alt="img" src="/AnimatedOutfits/animoutfit.php?id='.$q['looktype'].'&addons='.$q['addon'].'&head=' . $player->getLookHead() . '&body=' . $player->getLookBody() . '&legs=' . $player->getLookLegs() . '&feet=' . $player->getLookFeet() . '"/>';
                $t[] = $q;
                }
            }
        }
        //}
    }
    $vet++;
    //print "".$vet.". ".$player->getName()." - ".$outfits_list."<br>";
    $lista[$vet] = "".$count.",".$player->getName().",".$outfits_list."";
}


rsort($lista,SORT_NUMERIC );





$vet = 0;
foreach ($lista as $result) {
 
    $vet++;
    $pieces = explode(",", $result);
    if ($pieces[0] == 0) { continue;}
    print '
<tr bgcolor="' . (is_int($vet / 2) ? $config['site']['darkborder'] : $config['site']['lightborder']) . '">
<td style="text-align: center;">'.$vet.'.</td>
<td style="text-align: center;"><a href="?subtopic=characters&name='.$pieces[1].'">'.$pieces[1].'</a>
</td>
</span>
<td style="text-align: center;">
<img id="ButtonMounts'.$vet.'" onMouseDown="ToggleMaskedText(\'Mounts'.$vet.'\');" style="vertical-align:middle;cursor:pointer;" src="'.$layout_name.'/images/global/general/show.gif"/>
</td>
<td style="text-align: center;">'.$pieces[0].'</td>
<tr>
<td colspan="4">
<span class="itemStroke"></span>
<span id="DisplayMounts'.$vet.'" ></span>
<span id="MaskedMounts'.$vet.'" style="visibility:hidden;display:none" ></span>
<span id="ReadableMounts'.$vet.'" style="visibility:hidden;display:none">';



 
 
    print "".$pieces[2]."</tr></span>
 
 
    ";
 
 

 
 
 
 
 
 
 

}


    print '        </table>
                                </div>
                                </div>
                                <div class="TableShadowContainer">
                                     <div class="TableBottomShadow" style="background-image:url(./layouts/tibiacom/images/global/content/table-shadow-bm.gif);">
                                          <div class="TableBottomLeftShadow" style="background-image:url(./layouts/tibiacom/images/global/content/table-shadow-bl.gif);"></div>
                                          <div class="TableBottomRightShadow" style="background-image:url(./layouts/tibiacom/images/global/content/table-shadow-br.gif);"></div>
                                     </div>
                                </div>
                                </td>
          </tr>
          </table>
          </div>
          </td>
          </tr>
          </table>
</div>';
return;


$frequencies = array_count_values($test);
$vet = 0;
foreach ($frequencies as $id => $count) {
        //$get_name = $SQL->query('SELECT name from players where id = '.$id.' limit 1;')->fetch();
        $test2[$vet] = "".$count."  , ".$id."";
        $test2[$vet] = "".$count."  , ".$id."";
        //print "".$test2[$vet]."<br>";
        $vet++;
}

rsort($test2,SORT_NUMERIC );


 
foreach ($test2 as $result) {
    print "".$result."<br>";
 
}
return;









$get_outfits = $SQL->query('SELECT * FROM player_storage WHERE `key` >= 10001001 and `key` <= 10001500 and player_id != 419;')->fetchAll();
    $vet = 0;
    foreach($get_outfits as $result) {
        $storaged_id = $result[value];
    
        //if ($result[key]!= '78839811' and $result[key]!= '78970883' and $result[key]!= '79101955') {
        $repeat = 0;
        //foreach($outfit_list as $v) {
            //if ($outfit_list[$storaged_id]) {
                if ($repeat==0) {
                //$test[$vet] = ''.$vet.' - player '.$result[player_id].' tem o storage: '.$storaged_id.'<br>';
                $test[$vet] = $result[player_id];
                //$get_name = $SQL->query('SELECT name from players where id = '.$result[player_id].' limit 1;')->fetch();
                //echo 'Player: '.$get_name[0].' tem o storage: '.$storaged_id.'<br>';
                $repeat = 1;
                $vet++;
                }
            //}
        //}
        //}
    }           


$frequencies = array_count_values($test);
$vet = 0;
foreach ($frequencies as $id => $count) {
        //$get_name = $SQL->query('SELECT name from players where id = '.$id.' limit 1;')->fetch();
        $test2[$vet] = "".$count.",".$id."";
        //print "".$test2[$vet]."<br>";
        $vet++;
}

rsort($test2,SORT_NUMERIC );




include_once "system/load.newclasses.php";
foreach ($test2 as $result) {
    $count = 0;
    $outfits_list = "";
    $pieces = explode(",", $result);
    $player = new Player();
    $player->loadById($pieces[1]);
    $sex = $player->getSex();
    $p = [];
    for ($i = 1; $i <= 500; $i++) {
        $var = (10000000 + 1000);
        $var = $var + $i;
        if ($player->getStorage($var) != NULL) {
            $p[] = $player->getStorage($var);
        }
    }
 
    $x++;
 
    if ($p != NULL) {
        $t = [];
    
        //if ($sex == 0) {
            foreach ($p as $key => $value) {
                $q = $outfits->getOutfitByLooktype(0, $value >> 16);
                if ($q != NULL and $sex == 1) {
                
                    if ($q['name'] != "Void Master" and $q['name'] != "Veteran Paladin" and $q['name'] != "Lion of War") {
                        $count++;
                        $q['addon'] = $value - $q['storage'];
                        //print "Storage Female: ".$q['storage'].", looktype: ".$q['looktype'].", addon: ".$q['name']."<br>";
                        $outfits_list = ''.$outfits_list.'<img title="'.$q['name'].'" id="ImagemOutfit" alt="img" src="/AnimatedOutfits/animoutfit.php?id='.$q['looktype'].'&addons='.$q['addon'].'&head=' . $player->getLookHead() . '&body=' . $player->getLookBody() . '&legs=' . $player->getLookLegs() . '&feet=' . $player->getLookFeet() . '"/>';
                        $t[] = $q;
                    }
                
                
                }
            }
        //} else {
        foreach ($p as $key => $value) {
            $q = $outfits->getOutfitByLooktype(1, $value >> 16);
            if ($q != NULL and $sex == 0) {
            
                if ($q['name'] != "Void Master" and $q['name'] != "Veteran Paladin" and $q['name'] != "Lion of War") {
                $q['addon'] = $value - $q['storage'];
                $count++;
                //print "Storage Female: ".$q['storage'].", looktype: ".$q['looktype'].", addon: ".$q['name']."<br>";
                $outfits_list = ''.$outfits_list.'<img title="'.$q['name'].'" id="ImagemOutfit" alt="img" src="/AnimatedOutfits/animoutfit.php?id='.$q['looktype'].'&addons='.$q['addon'].'&head=' . $player->getLookHead() . '&body=' . $player->getLookBody() . '&legs=' . $player->getLookLegs() . '&feet=' . $player->getLookFeet() . '"/>';
                $t[] = $q;
                }
            }
        }
        //}
    }
 
    if ($count>0 and $x <= 30) {
 
 
    print '
<tr bgcolor="' . (is_int($x / 2) ? $config['site']['darkborder'] : $config['site']['lightborder']) . '">
<td style="text-align: center;">'.$x.'.</td>
<td style="text-align: center;"><a href="?subtopic=characters&name='.$player->getName().'">'.$player->getName().'</a>
</td>
</span>
<td style="text-align: center;">
<img id="ButtonMounts'.$x.'" onMouseDown="ToggleMaskedText(\'Mounts'.$x.'\');" style="vertical-align:middle;cursor:pointer;" src="'.$layout_name.'/images/global/general/show.gif"/>
</td>
<td style="text-align: center;">'.$count.'</td>
<tr>
<td colspan="4">
<span class="itemStroke"></span>
<span id="DisplayMounts'.$x.'" ></span>
<span id="MaskedMounts'.$x.'" style="visibility:hidden;display:none" ></span>
<span id="ReadableMounts'.$x.'" style="visibility:hidden;display:none">';



 
 
    print "".$outfits_list."</tr></span>
 
 
    ";
 
 
 
    }
 
}




 

                                        
                        print '        </table>
                                </div>
                                </div>
                                <div class="TableShadowContainer">
                                     <div class="TableBottomShadow" style="background-image:url(./layouts/tibiacom/images/global/content/table-shadow-bm.gif);">
                                          <div class="TableBottomLeftShadow" style="background-image:url(./layouts/tibiacom/images/global/content/table-shadow-bl.gif);"></div>
                                          <div class="TableBottomRightShadow" style="background-image:url(./layouts/tibiacom/images/global/content/table-shadow-br.gif);"></div>
                                     </div>
                                </div>
                                </td>
          </tr>
          </table>
          </div>
          </td>
          </tr>
          </table>
</div>';
This is an example of how not to write PHP code...

Should at least cache the player's storages for 1 hour.
 
Last edited:
Back
Top