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

[Gesior AAC] Most Creature Killers! [update! fixed with 1 query]

In case you want to create the whole monster list, here you go:

PHP:
<?php
        $strg_num = 9541;

        if(file_exists($path = '/home/migxxx/tfs/data/monster/monsters.xml') && $xml = simplexml_load_file($path))
                foreach($xml as $xmlx)
                        echo('["'.strtolower($xmlx['name']).'"] = '.$strg_num++.',<br />');
?>

PHP:
   <?php
        $strg_num = 9541;

        if(file_exists($path = '/data/monster/monsters.xml') && $xml = simplexml_load_file($path))
                foreach($xml as $xmlx)
                        echo('\''.strtolower($xmlx['name']).'\' => '.$strg_num++.', ');
?>
Use this one to generate the one to put in config.php.
 
2791-monsterkills.png


Bug: The order type is fucked up. As you see, it orders with the first biggest number.

E.g dragon lords:
1st: 8 kills
2nd: 62 kills.

Reason: The first letter "8" is higher than the first letter in "62" which is "6".

My friend is working on the fix now.

Order fix by my awesome web developer AKA Invisible_Elf:
PHP:
<?php
/* Scrip by zonet */
$kills = $config['site']['creatureKills'];
$limit = $config['site']['creatureKillShowLimit'];
$main_content .= '<table border="0px" cellspacing="1px" cellpadding="4px" width="100%">
            <tr bgcolor="#505050" style="color: white;"><th width="10%">Creature</th><th>Creature name</th><th>Most Killer ( '.$limit.' )</th></tr>';
$row = 1;
    foreach($kills as $name => $storage) {
    $qa = $SQL->query('SELECT `player_storage`.`player_id`, `player_storage`.`key`, `player_storage`.`value` AS `value`, `players`.`id`, `players`.`name` AS `name` FROM `player_storage` LEFT JOIN `players` ON `player_storage`.`player_id` = `players`.`id` WHERE `player_storage`.`key` = '.$storage.' ORDER BY ABS(value) DESC LIMIT '.$limit)->fetchAll();
    $color = ( $row % 2 ? $config['site']['darkborder'] : $config['site']['lightborder']);
    $row++;
    $main_content .= '<tr bgcolor="'.$color.'"><td><img src="/monsters/'.(str_replace(" ", "" , $name)).'.gif"></td><td width="20%" style="font-size: 13pt; font-weight: bold; color: darkorange;"><center>'.(ucfirst($name)).'</center></td><td>';
        $a = 0;
        foreach( $qa as $q )
        {
            $a++;
            if($a == 1)
                $main_content .= '<font color="green">';
            if($a == $limit)
                $main_content .= '<font color="red">';
            if($a == $limit/2)
                $main_content .= '<font color="darkorange">';

            $main_content .= '<b>'.$a.'. Name:</b> <a href="?subtopic=characters&name='.urlencode($q['name']).'">'.$q['name'].'</a> (Kills:  '.$q['value'].') </font></font></font><br />';
        }
    }
    $main_content .= '</td></table>';
?>

Bugs fixed:
When clicking on a name, you will actually get to the names profile instead of "character search".
Order fix.
 
Last edited:
I believe there is no need to use this creatureevent, because all can be taken from `environment_killers` & `killers`. But I'm not good in such queries so I can't help you, maybe Elf can do it.

Anyway - good idea & script.

it will work on 0.3.5? xd

Should work.
 
I believe there is no need to use this creatureevent, because all can be taken from `environment_killers` & `killers`. But I'm not good in such queries so I can't help you, maybe Elf can do it.

Anyway - good idea & script.



Should work.

Yeah, I'm sure it can, but I'm new to LEFT JOIN etc. :)
#Se~
You can change the monsters & add new monsters (Not hard)
 
How would I go about finding a monster's ID?
Like for example I want to add Orshabaal/Morgaroth/ & Ferumbras.

Anyway very nice <3
 
How would I go about finding a monster's ID?
Like for example I want to add Orshabaal/Morgaroth/ & Ferumbras.

Anyway very nice <3

There is no monster id, you have just to add the storage for the monster, any storage that is not taken, then name of the monster, and do the same in the lua part. ;)
Try doing it yourself, if you couldn't then tell me name of the monsters ;)
 
There is no monster id, you have just to add the storage for the monster, any storage that is not taken, then name of the monster, and do the same in the lua part. ;)
Try doing it yourself, if you couldn't then tell me name of the monsters ;)

Yeh I ended up understanding it and wanted to reedit my post but no reedit thanks :)

Very nice~ I like it alot! :p
 
Back
Top