-
Notifications
You must be signed in to change notification settings - Fork 3
Example: Spell list (spells.xml)
Chris edited this page Feb 15, 2017
·
2 revisions
DEPRECATED!
This wiki page has been deprecated and refers to version
1.0of the project. Please refer to the mainREADMEfor the latest documentation.
The parser implementation (pandaac\Exporter\Parsers\Spells 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\Spells([
'instant' => false,
'conjure' => false,
])-
instant
true -
runes
true -
conjure
true
use pandaac\Exporter\Exporter;
use pandaac\Exporter\Parsers\Spells;
try {
$spells = new Exporter(
'./data/spells/spells.xml',
new Spells
);
$response = $spells->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 = $spells->export()->toJson();$response = $spells->export()->toArray(); "instant": [
{
"name": "Annihilation",
"script": "attack/annihilation.lua",
"spellid": 62,
"group": "attack",
"groupcooldown": 4000,
"lvl": 110,
"mana": 300,
"range": 1,
"cooldown": 30000,
"prem": 1,
"needtarget": 1,
"needweapon": 1,
"needlearn": 0,
"blockwalls": 1,
"words": "exori gran ico",
"vocations": [
"Knight",
"Elite Knight"
]
},
{
"name": "Apprentice's Strike",
"script": "attack/apprentices strike.lua",
"spellid": 169,
"group": "attack",
"groupcooldown": 2000,
"lvl": 8,
"mana": 6,
"range": 3,
"cooldown": 2000,
"prem": 0,
"needlearn": 0,
"casterTargetOrDirection": 1,
"blockwalls": 1,
"words": "exori min flam",
"vocations": [
"Sorcerer",
"Druid",
"Master Sorcerer",
"Elder Druid"
]
},
...
],
"runes": [
{
"name": "Poison Field",
"script": "attack/poison field.lua",
"spellid": 26,
"group": "attack",
"groupcooldown": 2000,
"lvl": 14,
"maglv": 0,
"cooldown": 2000,
"blocktype": "solid",
"id": 2285,
"charges": 3,
"allowfaruse": 1,
"vocations": [
]
},
{
"name": "Poison Bomb",
"script": "attack/poison bomb.lua",
"spellid": 91,
"group": "attack",
"groupcooldown": 2000,
"lvl": 25,
"maglv": 4,
"cooldown": 2000,
"blocktype": "solid",
"id": 2286,
"charges": 2,
"allowfaruse": 1,
"vocations": [
]
},
...
],
"conjure": [
{
"name": "Blank Rune",
"group": "support",
"groupcooldown": 2000,
"lvl": 20,
"mana": 50,
"soul": 1,
"cooldown": 2000,
"needlearn": 0,
"conjureId": 2260,
"conjureCount": 1,
"words": "adori blank",
"vocations": [
"Druid",
"Elder Druid",
"Paladin",
"Royal Paladin",
"Sorcerer",
"Master Sorcerer"
]
},
{
"name": "Conjure Arrow",
"spellid": 51,
"group": "support",
"groupcooldown": 2000,
"lvl": 13,
"mana": 100,
"soul": 1,
"cooldown": 2000,
"needlearn": 0,
"conjureId": 2544,
"conjureCount": 10,
"words": "exevo con",
"vocations": [
"Paladin",
"Royal Paladin"
]
},
...
]