-
Notifications
You must be signed in to change notification settings - Fork 3
Example: Vocation list (vocations.xml)
Chris edited this page May 26, 2016
·
2 revisions
The parser implementation (pandaac\Exporter\Parsers\Vocations in this case) accepts an array of options as its first parameter. By default they are as shown below, but you may pass either of them to change it.
new pandaac\Exporter\Parsers\Vocations([
'formula' => false,
'skills' => false,
])-
formula
true -
skills
true
use pandaac\Exporter\Exporter;
use pandaac\Exporter\Parsers\Vocations;
try {
$vocations = new Exporter(
'./data/XML/vocations.xml',
new Vocations
);
$response = $vocations->export();
} catch (Exception $e) {
// Log errors...
}The export() method returns a Illuminate\Support\Collection object, please refer to its documentation. If you would prefer a JSON or an array response however, you may do as follows...
$response = $vocations->export()->toJson();$response = $vocations->export()->toArray(); {
"id": 0,
"name": "None",
"clientid": 0,
"description": "none",
"gaincap": 10,
"gainhp": 5,
"gainmana": 5,
"gainhpticks": 6,
"gainhpamount": 1,
"gainmanaticks": 6,
"gainmanaamount": 1,
"manamultiplier": "4.0",
"attackspeed": 2000,
"basespeed": 220,
"soulmax": 100,
"gainsoulticks": 120,
"fromvoc": 0,
"formula": {
"meleeDamage": "1.0",
"distDamage": "1.0",
"defense": "1.0",
"armor": "1.0"
},
"skills": [
{
"id": 0,
"multiplier": "1.5"
},
{
"id": 1,
"multiplier": "2.0"
},
{
"id": 2,
"multiplier": "2.0"
},
{
"id": 3,
"multiplier": "2.0"
},
{
"id": 4,
"multiplier": "2.0"
},
{
"id": 5,
"multiplier": "1.5"
},
{
"id": 6,
"multiplier": "1.1"
}
]
},
{
"id": 1,
"name": "Sorcerer",
"clientid": 3,
"description": "a sorcerer",
"gaincap": 10,
"gainhp": 5,
"gainmana": 30,
"gainhpticks": 6,
"gainhpamount": 5,
"gainmanaticks": 3,
"gainmanaamount": 5,
"manamultiplier": "1.1",
"attackspeed": 2000,
"basespeed": 220,
"soulmax": 100,
"gainsoulticks": 120,
"fromvoc": 1,
"formula": {
"meleeDamage": "1.0",
"distDamage": "1.0",
"defense": "1.0",
"armor": "1.0"
},
"skills": [
{
"id": 0,
"multiplier": "1.5"
},
{
"id": 1,
"multiplier": "2.0"
},
{
"id": 2,
"multiplier": "2.0"
},
{
"id": 3,
"multiplier": "2.0"
},
{
"id": 4,
"multiplier": "2.0"
},
{
"id": 5,
"multiplier": "1.5"
},
{
"id": 6,
"multiplier": "1.1"
}
]
},
...
]