en en en en en en en en en en en en en en en en en en en en en en en en en en en de en en en en de en de en de en de en de de pl de en fr fr ca fr en en en pt en en en en en en en de en hu en en en en en en en en en en en en en en nl en de en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en ja en en en en en en en en en en en en sv en en en en en en en en en en en en en en en en en en en en en en en id en en en
It is strongly recommended that you cache the response rather than parsing it over and over again.
As of right now, this exporter assumes that you're using The Forgotten Server 1.1. I have no immediate plans to expand this to any other distrobutions until I expand the distrobution range for pandaac itself. However, if there's enough public pressure for a specific distrobution, I may reconsider.
Pass the absolute path to your Open Tibia server as the first argument of the Exporter object and specify which parser you would like to use as the first argument of the parse method of the Exporter object.
The parse method also accepts a second argument for additional attributes (depends on the parser), and a third argument for overriding the default filepath (or providing a specific parser with a filepath).
Optionally, you may pass through engine specific settings as the second argument of the \pandaac\Exporter\Exporter object.
$exporter = new Exporter('/home/pandaac/theforgottenserver', $settings);
Available settings are as follows (the selected values are the default values):
$settings = [ 'xml' => [ // The XML engine will automatically validate any file it tries to parse, // and if the data is invalid, an exception will be thrown. You may // disable this behaviour by setting `validate` to `false`. 'validate' => true, // The XML engine will not throw exceptions on missing files when // parsing through a recursive structure. You may enable this // behaviour by setting `strict` to `true`. 'strict' => false, ], ]
Each parser returns an Illuminate Collection object. Please refer to the Laravel documentation for details on how to utilise it.
Parsers are what decides how to parse a certain file, and how to structure its response. It is important you use the correct parser for the correct file.
You must specify the relative filename as the third argument.
$exporter->parse(new \pandaac\Exporter\Parsers\MapHouses, [], 'forgotten-house.xml');
You must specify the relative filename as the third argument.
$exporter->parse(new \pandaac\Exporter\Parsers\MapSpawns, [], 'forgotten-spawn.xml');
You must specify the relative filename as the third argument.
$exporter->parse(new \pandaac\Exporter\Parsers\Monster, [], 'Demons/Demon.xml');
You may also load the data from within each individual monster file by setting the recursive attribute to true.
$exporter->parse(new \pandaac\Exporter\Parsers\Monsters, [ 'recursive' => true ]);
You must specify the relative filename as the third argument.
$exporter->parse(new \pandaac\Exporter\Parsers\NPC, [], 'The Oracle.xml');
You must specify the relative filename as the third argument.
$exporter->parse(new \pandaac\Exporter\Parsers\Raid, [], 'testraid.xml');
You may also load the data from within each individual raid file by setting the recursive attribute to true.
$exporter->parse(new \pandaac\Exporter\Parsers\Raids, [ 'recursive' => true ]);
If you have a string containing XML, you may also parse that using the following setup.
use pandaac\Exporter\Parsers\XMLSource; use pandaac\Exporter\Sources\StringContent; $exporter->parse(new XMLSource( new StringContent('    ') ));
The OTBM engine has not yet been developed, and thus the following parsers are rendered obsolete for the time being.
Please refer to the PSR-2 guidelines and squash your commits together into one before submitting a pull request.