mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 01:09:21 +02:00
more fixes to loading of creatures
fixed when there are spaces at beginning of the file fixed when file is unable to parse
This commit is contained in:
parent
57c2547098
commit
649facc5ab
@ -39,6 +39,16 @@
|
||||
*/
|
||||
class OTS_Monster extends DOMDocument
|
||||
{
|
||||
private $loaded = false;
|
||||
public function loadXML($source , $options = 0)
|
||||
{
|
||||
$this->loaded = parent::loadXML($source, $options);
|
||||
}
|
||||
|
||||
public function loaded()
|
||||
{
|
||||
return $this->loaded;
|
||||
}
|
||||
/**
|
||||
* Returns monster name.
|
||||
*
|
||||
|
@ -117,7 +117,8 @@ class OTS_MonstersList implements Iterator, Countable, ArrayAccess
|
||||
{
|
||||
// loads file
|
||||
$monster = new OTS_Monster();
|
||||
$monster->load($this->monstersPath . $this->monsters[$name]);
|
||||
//echo $this->monstersPath . $this->monsters[$name];
|
||||
$monster->loadXML(trim(file_get_contents($this->monstersPath . $this->monsters[$name])));
|
||||
return $monster;
|
||||
}
|
||||
|
||||
|
@ -72,6 +72,10 @@ if(isset($_POST['reload_monsters']) && $canEdit)
|
||||
//add monsters
|
||||
foreach($allmonsters as $lol) {
|
||||
$monster = $allmonsters->current();
|
||||
if(!$monster->loaded()) {
|
||||
warning('Error while adding monster: ' . $allmonsters->currentFile());
|
||||
continue;
|
||||
}
|
||||
//load monster mana needed to summon/convince
|
||||
$mana = $monster->getManaCost();
|
||||
//load monster experience
|
||||
|
Loading…
x
Reference in New Issue
Block a user