can't not find anything related to getitemlevelrangehuh 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();
Lua:
<?php
echo "(0) starting ";
require_once('monster_classes.php');
/* CONFIG */
$data_location = 'C:/Users/felip/OneDrive/Documentos/GitHub/pro-ot/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 ";
?>
Code: