Skip to content

Example: Individual monster (e.g. demon.xml)

Chris edited this page May 10, 2016 · 3 revisions

Options

The parser implementation (pandaac\Exporter\Parsers\Monster 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.

Syntax
new pandaac\Exporter\Parsers\Monster([
  'health' => false,
  'loot' => false,
])
Defaults
  • health true
  • look true
  • targetchange false
  • flags false
  • attacks false
  • defenses false
  • elements false
  • immunities false
  • voices false
  • summons false
  • loot true

Example

use pandaac\Exporter\Exporter;
use pandaac\Exporter\Parsers\Monster;

try {

  $demon = new Exporter(
    './data/monster/Demons/demon.xml',
    new Monster
  );

  $response = $demon->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 = $demon->export()->toJson();
$response = $demon->export()->toArray();

Example output with all options enabled (JSON)

{
  "name": "Demon",
  "nameDescription": "a demon",
  "race": "fire",
  "experience": 6000,
  "speed": 280,
  "health": {
    "now": 8200,
    "max": 8200
  },
  "look": {
    "type": 35,
    "corpse": 5995
  },
  "targetchange": {
    "interval": 4000,
    "chance": 20
  },
  "flags": {
    "attackable": 1,
    "hostile": 1,
    "canpushitems": 1,
    "canpushcreatures": 1,
    "targetdistance": 1,
    "staticattack": 70
  },
  "attacks": [
    {
      "name": "melee",
      "interval": 2000,
      "skill": 70,
      "attack": 130,
      "attributes": [
        
      ]
    },
    {
      "name": "manadrain",
      "interval": 2000,
      "max": -120,
      "chance": 10,
      "range": 7,
      "attributes": [
        
      ]
    },
    {
      "name": "fire",
      "interval": 2000,
      "min": -150,
      "max": -250,
      "chance": 20,
      "range": 7,
      "radius": 7,
      "target": 1,
      "attributes": {
        "shootEffect": "fire",
        "areaEffect": "firearea"
      }
    },
    {
      "name": "firefield",
      "interval": 2000,
      "chance": 10,
      "range": 7,
      "radius": 1,
      "target": 1,
      "attributes": {
        "shootEffect": "fire"
      }
    },
    {
      "name": "lifedrain",
      "interval": 2000,
      "min": -300,
      "max": -490,
      "chance": 10,
      "attributes": {
        "areaEffect": "purpleenergy"
      }
    },
    {
      "name": "energy strike",
      "interval": 2000,
      "min": -210,
      "max": -300,
      "chance": 10,
      "range": 1,
      "attributes": [
        
      ]
    },
    {
      "name": "speed",
      "interval": 2000,
      "chance": 15,
      "radius": 1,
      "target": 1,
      "speedchange": -700,
      "duration": 30000,
      "attributes": {
        "areaEffect": "redshimmer"
      }
    }
  ],
  "defenses": {
    "armor": 55,
    "defense": 55,
    "defenses": [
      {
        "name": "healing",
        "interval": 2000,
        "min": 180,
        "max": 250,
        "chance": 15,
        "attributes": {
          "areaEffect": "blueshimmer"
        }
      },
      {
        "name": "speed",
        "interval": 2000,
        "chance": 15,
        "speedchange": 320,
        "duration": 5000,
        "attributes": {
          "areaEffect": "redshimmer"
        }
      }
    ]
  },
  "elements": {
    "physical": 30,
    "death": 30,
    "energy": 50,
    "earth": 40,
    "ice": -10,
    "holy": -10
  },
  "immunities": {
    "fire": 1,
    "drown": 1,
    "lifedrain": 1,
    "paralyze": 1,
    "invisible": 1
  },
  "voices": {
    "interval": 5000,
    "chance": 10,
    "sentences": [
      "Your soul will be mine!",
      "MUHAHAHAHA!",
      "CHAMEK ATH UTHUL ARAK!",
      "I SMELL FEEEEAAAAAR!",
      "Your resistance is futile!"
    ]
  },
  "summons": {
    "maxSummons": 1,
    "summons": [
      {
        "name": "fire elemental",
        "interval": 2000,
        "chance": 10
      }
    ]
  },
  "loot": [
    {
      "id": 2148,
      "countmax": 100,
      "chance": 60000,
      "comment": "gold coin"
    },
    {
      "id": 2148,
      "countmax": 99,
      "chance": 60000,
      "comment": "gold coin"
    },
    {
      "id": 2152,
      "countmax": 6,
      "chance": 100000,
      "comment": "platinum coin"
    },
    {
      "id": 2795,
      "countmax": 6,
      "chance": 20740,
      "comment": "fire mushroom"
    },
    {
      "id": 8473,
      "countmax": 3,
      "chance": 20000,
      "comment": "ultimate health potion"
    },
    {
      "id": 7590,
      "countmax": 3,
      "chance": 14285,
      "comment": "great mana potion"
    },
    {
      "id": 2387,
      "chance": 14285,
      "comment": "double axe"
    },
    {
      "id": 2149,
      "chance": 10000,
      "comment": "small emerald"
    },
    {
      "id": 7368,
      "countmax": 5,
      "chance": 5263,
      "comment": "assassin star"
    },
    {
      "id": 2432,
      "chance": 3703,
      "comment": "fire axe"
    },
    {
      "id": 2151,
      "chance": 3571,
      "comment": "talon"
    },
    {
      "id": 2176,
      "chance": 2854,
      "comment": "orb"
    },
    {
      "id": 2393,
      "chance": 2000,
      "comment": "giant sword"
    },
    {
      "id": 2418,
      "chance": 1428,
      "comment": "golden sickle"
    },
    {
      "id": 2165,
      "chance": 1333,
      "comment": "stealth ring"
    },
    {
      "id": 2462,
      "chance": 1204,
      "comment": "devil helmet"
    },
    {
      "id": 1982,
      "chance": 1190,
      "comment": "purple tome"
    },
    {
      "id": 2179,
      "chance": 1010,
      "comment": "gold ring"
    },
    {
      "id": 2171,
      "chance": 813,
      "comment": "platinum amulet"
    },
    {
      "id": 2396,
      "chance": 666,
      "comment": "ice rapier"
    },
    {
      "id": 2520,
      "chance": 649,
      "comment": "demon shield"
    },
    {
      "id": 2214,
      "chance": 473,
      "comment": "ring of healing"
    },
    {
      "id": 5954,
      "chance": 467,
      "comment": "demon horn"
    },
    {
      "id": 2470,
      "chance": 413,
      "comment": "golden legs"
    },
    {
      "id": 2514,
      "chance": 389,
      "comment": "mastermind shield"
    },
    {
      "id": 2164,
      "chance": 170,
      "comment": "might ring"
    },
    {
      "id": 2472,
      "chance": 70,
      "comment": "magic plate armor"
    },
    {
      "id": 7393,
      "chance": 100,
      "comment": "demon trophy"
    },
    {
      "id": 7382,
      "chance": 80,
      "comment": "demonrage sword"
    }
  ]
}

Please note that the comments provided in the loot array are merely guidelines and may be faulty.

Clone this wiki locally