• 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 znote monster_loot.php

Manigold

Active Member
Joined
Nov 2, 2017
Messages
198
Solutions
8
Reaction score
48
Hello , i'm using znote aac and the page monster_loot is not showing the loot that drop inside bags. I hope someone can help me with this .

heres the php:
PHP:
<?php require_once 'engine/init.php'; include 'layout/overall/header.php'; ?>

<?php
###### MONSTER LOOT CHECKER ######
###### VERSION: 1.5
$otdir = 'misc/';
// In percent (highest first).
$rarity = array(
    'Not Rare'    => 7,
    'Semi Rare'    => 2,
    'Rare'        => 0.5,
    'Very Rare' => 0
);
?>
<script language="javascript">
     function toggleVisibility(obj) {
         var el = document.getElementById('d' + obj.id);
         var name = obj.innerHTML.substring(4);
     
         if(el.style.display == 'none') {
             obj.innerHTML = '[ -]';
             el.style.display = 'block';
         } else {
             obj.innerHTML = '[+]';
             el.style.display = 'none';
         }
         obj.innerHTML += ' ' + name;
     }
</script>

<?php
    if(isset($_GET['lootrate']))
        $add = '&lootrate';
    echo '<a href="' . htmlspecialchars($_SERVER['PHP_SELF'] . ($add ? '?lootrate' : '')) . '">Hide None</a> | ';
    echo '<a href="?hidefail' . $add . '">Hide Not Found</a> | ';
    echo '<a href="?hideempty' . $add . '">Hide Monsters Without Loot</a> | ';
    echo '<a href="?hideempty&hidefail' . $add . '">Hide All</a> | ';
    echo '<a href="monsters_loot.php">Use Normal Loot Rate</a> | ';
    echo '<a href="?lootrate">Use Server Loot Rate</a>';
?>
<br><br>

<?php
    $items = simplexml_load_file($otdir . '/data/items/items.xml') or die('<b>Could not load items!</b>');
    foreach($items->item as $v)
        $itemList[(int)$v['id']] = $v['name'];
   
    if(isset($_GET['lootrate'])) {
        $config = parse_ini_file($otdir . '/config.lua');
        $lootRate = $config['rate_loot'];
    }

    $monsters = simplexml_load_file($otdir . '/data/monster/monsters.xml') or die('<b>Could not load monsters!</b>');
    foreach($monsters->monster as $monster) {
        $loot = simplexml_load_file($otdir . '/data/monster/' . $monster['file']);
        if($loot) {
            if($item = $loot->loot->item) {
                echo '
                    <a id="' . ++$i . '" style="text-decoration: none; font: bold 14px verdana; color: orange;" href="javascript:void(0);" onclick="toggleVisibility(this)">[+] ' . $monster['name'] . '</a>
                    <br><div style="display: none;" id="d' . $i . '"><br>';
                addLoot($item);
                echo '<br></pre></div>';
            } elseif(!isset($_GET['hideempty']))
                echo '<span style="font: bold 14px verdana; color: red;">[x] ' . $monster['name'] . '</span><br>';
        } elseif(!isset($_GET['hidefail']))
            echo '<span style="color: white;">Failed to load monster <b>' . $monster[name] . '</b> <i>(' . $monster[file] . ')</i><br>';
    }
function addLoot($loot, $level=1) {
    foreach($loot as $test) {
        $chance = $test['chance'];
        if(!$chance)
            $chance = $test['chance1'];
        printLoot($level, $test['id'], $test['countmax'], $chance);
        foreach($test as $k => $v)
            addLoot($v->item, $level + 1);
    }
}

function printLoot($level, $itemid, $count, $chance) {
    global $itemList, $rarity;
   
    $chance /= 1000;
    if(isset($_GET['lootrate'])) {
        global $lootRate;
        $chance *= $lootRate;
    }
   
    foreach($rarity as $lootRarity => $percent){
        if($chance >= $percent) {
            echo str_repeat("... ", $level) . '<u>' . ($count ? $count : 1) . '</u> <span style="color: #7878FF; font-weight: bold;">' . $itemList[(int)$itemid] . '</span> - <span style="color: #C45; font-weight: bold;">' . $lootRarity . '</span> (<span style="color: #FF9A9A;">' . $chance . '%</span>)<br>';
            break;
        }
    }
}
?>
<?php include 'layout/overall/footer.php'; ?>

Edit: forgot to say , i'm using tfs 1.2 and here is an exemple of my monsters loot.
Lua:
    <loot>
        <item id="2148" countmax="100" chance="60000" />
        <item id="2152" countmax="6" chance="100000" />
        <item id="2678" countmax="6" chance="20740" />
        <item id="2387" chance="14285" />
        <item id="2149" chance="10000" />   
        <item id="7368" countmax="5" chance="5263" />
        <item id="2432" chance="2400" /> 
        <item id="2151" chance="3571" /> 
        <item id="2393" chance="2856" /> 
        <item id="2418" chance="1428" /> 
        <item id="1982" chance="1190" />
        <item id="1987" chance="100000"> <!-- bag -->
        <item id="2179" chance="1010" /> 
        <item id="2396" chance="1200" />
        <item id="2520" chance="2000" /> 
        <item id="2214" chance="473" /> 
        <item id="5906" countmax="1" chance="2000"/>
        <item id="5954" chance="2000" /> 
        <item id="2470" chance="1000" /> 
        <item id="2514" chance="1000" /> 
        <item id="2472" chance="660" /> 
        <item id="7393" chance="100" /> 
        <item id="7382" chance="1000" /> 
        </item>
    </loot>
 
Last edited:
Bump ,i find out that with old monsters file the loot inside bags are shown correctly , example of old monster file :
the only diference is the <inside></inside> after bag and the items inside bag , unfortunatly this monster files ,doesn't work with tfs 1.2 =( ,still need help.

Code:
   <loot> 
      <item id="2148" countmax="100" chance1="100000" chancemax="0"/>
      <item id="2672" countmax="2" chance1="20000" chancemax="0"/>
      <item id="2033" chance="1818"/>
      <item id="1976" chance="3333"/>
      <item id="2413" chance="5000"/>
      <item id="2498" chance="888"/>
      <item id="2492" chance="733"/>
      <item id="2414" chance="1000"/>
      <item id="2546" countmax="5" chance1="2222" chancemax="0"/>
      <item id="2796" countmax="1" chance1="6666" chancemax="0"/>
      <item id="1987" chance="50000">  <!-- bag -->
        <inside>
          <item id="2148" countmax="100" chance1="100000" chancemax="0"/>
          <item id="2149" countmax="2" chance1="893" chancemax="0"/>
          <item id="2392" chance="1428"/>
          <item id="2146" countmax="2" chance1="3222" chancemax="0"/>
          <item id="2528" chance="2333"/>
        </inside>
      </item>
    </loot>
  </monster>
 
when was monster loot added? I didn't know they even had it.

You could just edit the xml files copiued into your web dir to find and remove any record of <inside> or </inside> from the mosnter files so it doesn't break the webpage.
 
when was monster loot added? I didn't know they even had it.

You could just edit the xml files copiued into your web dir to find and remove any record of <inside> or </inside> from the mosnter files so it doesn't break the webpage.
The files with the tag <inside> </inside> show the loot in bags correctly , but the monster files from tfs 1x don't use this tags ,that's the problem.Probably is something silly but i don't know how to solve this.
If i change this :
PHP:
if($item = $loot->loot->item) {
to this :
PHP:
if($item = $loot->loot->item->item) {
the loots inside bags are shown , but only inside bags ,the loot that drops outside are not shown
 
Try this?

PHP:
<?php require_once 'engine/init.php'; include 'layout/overall/header.php'; ?>

<?php
###### MONSTER LOOT CHECKER ######
###### VERSION: 1.5
$otdir = 'misc/';
// In percent (highest first).
$rarity = array(
    'Not Rare'    => 7,
    'Semi Rare'    => 2,
    'Rare'        => 0.5,
    'Very Rare' => 0
);
?>
<script language="javascript">
     function toggleVisibility(obj) {
         var el = document.getElementById('d' + obj.id);
         var name = obj.innerHTML.substring(4);
    
         if(el.style.display == 'none') {
             obj.innerHTML = '[ -]';
             el.style.display = 'block';
         } else {
             obj.innerHTML = '[+]';
             el.style.display = 'none';
         }
         obj.innerHTML += ' ' + name;
     }
</script>

<?php
    if(isset($_GET['lootrate']))
        $add = '&lootrate';
    echo '<a href="' . htmlspecialchars($_SERVER['PHP_SELF'] . ($add ? '?lootrate' : '')) . '">Hide None</a> | ';
    echo '<a href="?hidefail' . $add . '">Hide Not Found</a> | ';
    echo '<a href="?hideempty' . $add . '">Hide Monsters Without Loot</a> | ';
    echo '<a href="?hideempty&hidefail' . $add . '">Hide All</a> | ';
    echo '<a href="monsters_loot.php">Use Normal Loot Rate</a> | ';
    echo '<a href="?lootrate">Use Server Loot Rate</a>';
?>
<br><br>

<?php
    $items = simplexml_load_file($otdir . '/data/items/items.xml') or die('<b>Could not load items!</b>');
    foreach($items->item as $v)
        $itemList[(int)$v['id']] = $v['name'];
  
    if(isset($_GET['lootrate'])) {
        $config = parse_ini_file($otdir . '/config.lua');
        $lootRate = $config['rate_loot'];
    }

    $monsters = simplexml_load_file($otdir . '/data/monster/monsters.xml') or die('<b>Could not load monsters!</b>');
    foreach($monsters->monster as $monster) {
        $loot = simplexml_load_file($otdir . '/data/monster/' . $monster['file']);
        if($loot) {
            if($item = $loot->loot->item) {
                echo '
                    <a id="' . ++$i . '" style="text-decoration: none; font: bold 14px verdana; color: orange;" href="javascript:void(0);" onclick="toggleVisibility(this)">[+] ' . $monster['name'] . '</a>
                    <br><div style="display: none;" id="d' . $i . '"><br>';
                addLoot($item);
                echo '<br></pre></div>';
            }elseif($item = $loot->loot->item->item) {
                echo '
                    <a id="' . ++$i . '" style="text-decoration: none; font: bold 14px verdana; color: orange;" href="javascript:void(0);" onclick="toggleVisibility(this)">[+] ' . $monster['name'] . '</a>
                    <br><div style="display: none;" id="d' . $i . '"><br>';
                addLoot($item);
                echo '<br></pre></div>';
            } elseif(!isset($_GET['hideempty']))
                echo '<span style="font: bold 14px verdana; color: red;">[x] ' . $monster['name'] . '</span><br>';
        } elseif(!isset($_GET['hidefail']))
            echo '<span style="color: white;">Failed to load monster <b>' . $monster[name] . '</b> <i>(' . $monster[file] . ')</i><br>';
    }
function addLoot($loot, $level=1) {
    foreach($loot as $test) {
        $chance = $test['chance'];
        if(!$chance)
            $chance = $test['chance1'];
        printLoot($level, $test['id'], $test['countmax'], $chance);
        foreach($test as $k => $v)
            addLoot($v->item, $level + 1);
    }
}

function printLoot($level, $itemid, $count, $chance) {
    global $itemList, $rarity;
  
    $chance /= 1000;
    if(isset($_GET['lootrate'])) {
        global $lootRate;
        $chance *= $lootRate;
    }
  
    foreach($rarity as $lootRarity => $percent){
        if($chance >= $percent) {
            echo str_repeat("... ", $level) . '<u>' . ($count ? $count : 1) . '</u> <span style="color: #7878FF; font-weight: bold;">' . $itemList[(int)$itemid] . '</span> - <span style="color: #C45; font-weight: bold;">' . $lootRarity . '</span> (<span style="color: #FF9A9A;">' . $chance . '%</span>)<br>';
            break;
        }
    }
}
?>
<?php include 'layout/overall/footer.php'; ?>
 
Try this?

PHP:
<?php require_once 'engine/init.php'; include 'layout/overall/header.php'; ?>

<?php
###### MONSTER LOOT CHECKER ######
###### VERSION: 1.5
$otdir = 'misc/';
// In percent (highest first).
$rarity = array(
    'Not Rare'    => 7,
    'Semi Rare'    => 2,
    'Rare'        => 0.5,
    'Very Rare' => 0
);
?>
<script language="javascript">
     function toggleVisibility(obj) {
         var el = document.getElementById('d' + obj.id);
         var name = obj.innerHTML.substring(4);
   
         if(el.style.display == 'none') {
             obj.innerHTML = '[ -]';
             el.style.display = 'block';
         } else {
             obj.innerHTML = '[+]';
             el.style.display = 'none';
         }
         obj.innerHTML += ' ' + name;
     }
</script>

<?php
    if(isset($_GET['lootrate']))
        $add = '&lootrate';
    echo '<a href="' . htmlspecialchars($_SERVER['PHP_SELF'] . ($add ? '?lootrate' : '')) . '">Hide None</a> | ';
    echo '<a href="?hidefail' . $add . '">Hide Not Found</a> | ';
    echo '<a href="?hideempty' . $add . '">Hide Monsters Without Loot</a> | ';
    echo '<a href="?hideempty&hidefail' . $add . '">Hide All</a> | ';
    echo '<a href="monsters_loot.php">Use Normal Loot Rate</a> | ';
    echo '<a href="?lootrate">Use Server Loot Rate</a>';
?>
<br><br>

<?php
    $items = simplexml_load_file($otdir . '/data/items/items.xml') or die('<b>Could not load items!</b>');
    foreach($items->item as $v)
        $itemList[(int)$v['id']] = $v['name'];
 
    if(isset($_GET['lootrate'])) {
        $config = parse_ini_file($otdir . '/config.lua');
        $lootRate = $config['rate_loot'];
    }

    $monsters = simplexml_load_file($otdir . '/data/monster/monsters.xml') or die('<b>Could not load monsters!</b>');
    foreach($monsters->monster as $monster) {
        $loot = simplexml_load_file($otdir . '/data/monster/' . $monster['file']);
        if($loot) {
            if($item = $loot->loot->item) {
                echo '
                    <a id="' . ++$i . '" style="text-decoration: none; font: bold 14px verdana; color: orange;" href="javascript:void(0);" onclick="toggleVisibility(this)">[+] ' . $monster['name'] . '</a>
                    <br><div style="display: none;" id="d' . $i . '"><br>';
                addLoot($item);
                echo '<br></pre></div>';
            }elseif($item = $loot->loot->item->item) {
                echo '
                    <a id="' . ++$i . '" style="text-decoration: none; font: bold 14px verdana; color: orange;" href="javascript:void(0);" onclick="toggleVisibility(this)">[+] ' . $monster['name'] . '</a>
                    <br><div style="display: none;" id="d' . $i . '"><br>';
                addLoot($item);
                echo '<br></pre></div>';
            } elseif(!isset($_GET['hideempty']))
                echo '<span style="font: bold 14px verdana; color: red;">[x] ' . $monster['name'] . '</span><br>';
        } elseif(!isset($_GET['hidefail']))
            echo '<span style="color: white;">Failed to load monster <b>' . $monster[name] . '</b> <i>(' . $monster[file] . ')</i><br>';
    }
function addLoot($loot, $level=1) {
    foreach($loot as $test) {
        $chance = $test['chance'];
        if(!$chance)
            $chance = $test['chance1'];
        printLoot($level, $test['id'], $test['countmax'], $chance);
        foreach($test as $k => $v)
            addLoot($v->item, $level + 1);
    }
}

function printLoot($level, $itemid, $count, $chance) {
    global $itemList, $rarity;
 
    $chance /= 1000;
    if(isset($_GET['lootrate'])) {
        global $lootRate;
        $chance *= $lootRate;
    }
 
    foreach($rarity as $lootRarity => $percent){
        if($chance >= $percent) {
            echo str_repeat("... ", $level) . '<u>' . ($count ? $count : 1) . '</u> <span style="color: #7878FF; font-weight: bold;">' . $itemList[(int)$itemid] . '</span> - <span style="color: #C45; font-weight: bold;">' . $lootRarity . '</span> (<span style="color: #FF9A9A;">' . $chance . '%</span>)<br>';
            break;
        }
    }
}
?>
<?php include 'layout/overall/footer.php'; ?>
Did not work =(
loot.png
 
Back
Top