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

Simple monster loot for znote

Azakelis

Premium User
Premium User
Joined
Feb 17, 2014
Messages
232
Solutions
17
Reaction score
319
Since znote's monster plugin didn't work for me that well I've done a quick version of mine.
Features comparing to znote's default (monster_loot.php):
  • properly reads item names from monster's xml file if it isn't represented by id
  • displays basic monster info (health, experience)
  • paging
  • cache
  • monster own subpage
  • a bit easier to read display

Usage:
install:
1. unpack php files into main znote directory
2. change data directory in monster_loader.php
3. execute monster_loader.php
4. add monsters.php to layout

cache update:
1. remove /monsters/ directory from main znote directory
2. execute monster_loader.php

screens:
1610669864145.png
 

Attachments

  • simple_monster_loot_for_znote.zip
    2.4 KB · Views: 124 · VirusTotal
Could you explain a little more how to add the monsters, it's the only thing I don't understand, it comes out empty.
 

Attachments

Last edited:
Sounds awesome, any chance for work in Gesior 2012?
 
if i use lodeader i see a white website then i go to monsters.php i see nothing can somebody help?
 
monster_loader.php -> u see white
monster.php is page for search u monsters
yeah nothing appears in there ( is there something that should be created / edited?
i edited monster_loader.php in order to fit my monsters folder
 
what i'm doing wrong?
Lua:
/* CONFIG */
$data_location = 'C:/Users/pasturryx/OneDrive/Documentos/GitHub/pro-ot/data';
$monster_dir = '/monster/';
$items_dir = '/items/';
$monsters_file = 'monsters.xml';
$items_file = 'items.xml';
$cache_dir = 'monsters';
/* CONFIG */
 
what i'm doing wrong?
Lua:
/* CONFIG */
$data_location = 'C:/Users/pasturryx/OneDrive/Documentos/GitHub/pro-ot/data';
$monster_dir = '/monster/';
$items_dir = '/items/';
$monsters_file = 'monsters.xml';
$items_file = 'items.xml';
$cache_dir = 'monsters';
/* CONFIG */
this config looks right
what's your problem?
 
try with this monster_loader.php (change the config), this should say what happens:
PHP:
<?php
echo "(0) starting ";
require_once('monster_classes.php');

/* CONFIG */
$data_location = 'C:/forgottenserver/data';
$monster_dir = '/monster/';
$items_dir = '/items/';
$monsters_file = 'monsters.xml';
$items_file = 'items.xml';
$cache_dir = 'monsters';
/* CONFIG */

if (file_exists($cache_dir)) {
    echo "(1) cache exists ";
    die();
}
mkdir($cache_dir, 0777, true);
echo "(2) mkdir done ";

$items_loaded = array();
$items_xml = simplexml_load_file($data_location . $items_dir . $items_file);
echo "(3) loaded items.xml ";
foreach ($items_xml->children() as $item) {
    if (empty(strval($item['fromid']))) {
    $items_loaded[(int)strval($item['id'])] = strval($item['name']);
    continue;
    }
    $fromid = (int) strval($item['fromid']);
    $toid = (int) strval($item['toid']);
    for ($i = $fromid; $i <= $toid; $i++) {
        $items_loaded[$i] = strval($item['name']);
    }
    
}
echo "(4) loaded items ";

$monsters_xml = simplexml_load_file($data_location . $monster_dir . $monsters_file);
echo "(5) loaded monsters.xml ";

$monsters_paths = array();

foreach ($monsters_xml->children() as $monster) {
    array_push($monsters_paths, $data_location . $monster_dir . $monster['file']);
}

echo "(6) loaded monsters ";

$monsters_loaded = array();
foreach ($monsters_paths as $monster_path) {
    $monster_xml = simplexml_load_file($monster_path);
    $monster = new Monster();
    $basename = basename($monster_path, '.xml');
    $basename = str_replace('_'," ",$basename);
    $monster->setName($basename);
    $monster->setExperience((int)strval($monster_xml['experience']));
    $monster->setHealth((int)strval($monster_xml->health['max']));
    if ($monster_xml->loot->item == null) {
        array_push($monsters_loaded, $monster);
        continue;
    }
    foreach ($monster_xml->loot->item as $item) {
        $item_o = new Item();
        if (!empty(strval($item['name']))) {
            $item_o->setName(strval($item['name']));
        }
        if (!empty(strval($item['id']))) {
            $offset = (int)strval($item['id']);
            if (array_key_exists($offset, $items_loaded)) {
                $item_o->setName($items_loaded[$offset]);
            }
        }
        if (!empty(strval($item['countmax']))) {
            $item_o->setCountMax((int)strval($item['countmax']));
        }
        if (!empty(strval($item['chance']))) {
            $item_o->setChance((int)strval($item['chance']));
        }
        $monster->addToLoot($item_o);
    }
    array_push($monsters_loaded, $monster);
}

echo "(7) monster classes done ";

foreach ($monsters_loaded as $monster) {
    $cache_file = fopen($cache_dir . '/' . $monster->getName() . '.cache', "w");
    fwrite($cache_file, serialize($monster));
}

echo "(8) cache files done ";

?>
 
hello thank you for your quick replyget this
Lua:
(0) starting (2) mkdir done (3) loaded items.xml (4) loaded items (5) loaded monsters.xml (6) loaded monsters
Warning: simplexml_load_file(): I/O warning : failed to load external entity "file:/C:/Users/pasturryx/OneDrive/Documentos/GitHub/pro-ot/data/monster/orcs/Orc%20Sambackpack.xml" in C:\xampp\htdocs\monster_loader.php on line 52

Warning: Trying to access array offset on value of type bool in C:\xampp\htdocs\monster_loader.php on line 57

Warning: Attempt to read property "health" on bool in C:\xampp\htdocs\monster_loader.php on line 58

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\monster_loader.php on line 58

Warning: Attempt to read property "loot" on bool in C:\xampp\htdocs\monster_loader.php on line 59

Warning: Attempt to read property "item" on null in C:\xampp\htdocs\monster_loader.php on line 59

Warning: simplexml_load_file(): I/O warning : failed to load external entity "C:/Users/pasturryx/OneDrive/Documentos/GitHub/pro-ot/data/monster/orcs/orcarmor.xml" in C:\xampp\htdocs\monster_loader.php on line 52

Warning: Trying to access array offset on value of type bool in C:\xampp\htdocs\monster_loader.php on line 57

Warning: Attempt to read property "health" on bool in C:\xampp\htdocs\monster_loader.php on line 58

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\monster_loader.php on line 58

Warning: Attempt to read property "loot" on bool in C:\xampp\htdocs\monster_loader.php on line 59

Warning: Attempt to read property "item" on null in C:\xampp\htdocs\monster_loader.php on line 59

Warning: simplexml_load_file(): I/O warning : failed to load external entity "C:/Users/pasturryx/OneDrive/Documentos/GitHub/pro-ot/data/monster/orcs/orchelmet.xml" in C:\xampp\htdocs\monster_loader.php on line 52

Warning: Trying to access array offset on value of type bool in C:\xampp\htdocs\monster_loader.php on line 57

Warning: Attempt to read property "health" on bool in C:\xampp\htdocs\monster_loader.php on line 58

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\monster_loader.php on line 58

Warning: Attempt to read property "loot" on bool in C:\xampp\htdocs\monster_loader.php on line 59

Warning: Attempt to read property "item" on null in C:\xampp\htdocs\monster_loader.php on line 59

Warning: simplexml_load_file(): I/O warning : failed to load external entity "C:/Users/pasturryx/OneDrive/Documentos/GitHub/pro-ot/data/monster/orcs/orcshield.xml" in C:\xampp\htdocs\monster_loader.php on line 52

Warning: Trying to access array offset on value of type bool in C:\xampp\htdocs\monster_loader.php on line 57

Warning: Attempt to read property "health" on bool in C:\xampp\htdocs\monster_loader.php on line 58

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\monster_loader.php on line 58

Warning: Attempt to read property "loot" on bool in C:\xampp\htdocs\monster_loader.php on line 59

Warning: Attempt to read property "item" on null in C:\xampp\htdocs\monster_loader.php on line 59

Warning: simplexml_load_file(): I/O warning : failed to load external entity "file:/C:/Users//pasturryx/OneDrive/Documentos/GitHub/pro-ot/data/monster/monsters/zao/zao%20elite.xml" in C:\xampp\htdocs\monster_loader.php on line 52

Warning: Trying to access array offset on value of type bool in C:\xampp\htdocs\monster_loader.php on line 57

Warning: Attempt to read property "health" on bool in C:\xampp\htdocs\monster_loader.php on line 58

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\monster_loader.php on line 58

Warning: Attempt to read property "loot" on bool in C:\xampp\htdocs\monster_loader.php on line 59

Warning: Attempt to read property "item" on null in C:\xampp\htdocs\monster_loader.php on line 59

Warning: simplexml_load_file(): I/O warning : failed to load external entity "file:/C:/Users/pasturryx/OneDrive/Documentos/GitHub/pro-ot/data/monster/monsters/Lizards/draken%20spellweaver.xml" in C:\xampp\htdocs\monster_loader.php on line 52

Warning: Trying to access array offset on value of type bool in C:\xampp\htdocs\monster_loader.php on line 57

Warning: Attempt to read property "health" on bool in C:\xampp\htdocs\monster_loader.php on line 58

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\monster_loader.php on line 58

Warning: Attempt to read property "loot" on bool in C:\xampp\htdocs\monster_loader.php on line 59

Warning: Attempt to read property "item" on null in C:\xampp\htdocs\monster_loader.php on line 59
(7) monster classes done (8) cache files done

if i review monsters.php
Code:
Fatal error: Uncaught Error: Call to undefined method Monster::getItemLevelRange() in C:\xampp\htdocs\monsters.php:16 Stack trace: #0 {main} thrown in C:\xampp\htdocs\monsters.php on line 16

edit: seems to be working now my bad
Code:
(0) starting (2) mkdir done (3) loaded items.xml (4) loaded items (5) loaded monsters.xml (6) loaded monsters (7) monster classes done (8) cache files done

but the loot is buggy yet
Code:
Fatal error: Uncaught Error: Call to undefined method Monster::getItemLevelRange() in C:\xampp\htdocs\monsters.php:16 Stack trace: #0 {main} thrown in C:\xampp\htdocs\monsters.php on line 16
 
Last edited:
probably these files dont exist if thats the case remove them from monsters.xml
 
huh now that i see that remove this line from monsters.php, it seems i left out something unfinished here lol:
PHP:
        $item_range = $monster->getItemLevelRange();
 
Back
Top