OTS – generating list of monster names

In OTS folder data/monsters create new file list.php

<?php
$monsters = simplexml_load_file('monsters.xml');

$list = [];
foreach($monsters->monster as $monsterData) {
    $monster = simplexml_load_file((string) $monsterData['file']);
    $list[] = (string) $monster['name'];
}

echo ',' . implode(',', $list) . ',' . PHP_EOL;

Now run that code in console. On machines with PHP installed just type:

php list.php

and it will generate list like:

,Sinister Bunny,Kindra,Necron,Terros,Christmass Destroyer,Christmass Destroyer,C hristmass Destroyer,Christmass Destroyer,Christmass Destroyer,Christmass Destroy er,Christmass Destroyer,Christmass Destroyer,Christmass Destroyer,Christmass Des troyer,Christmass Destroyer,Christmass Destroyer,Corrupted Santa,Tasselis,Laevis ,Dianthis,Saul,Hunlath,Khor,Apocalypse,Pumin,Tafariel,Ashfalor,Infernatil,Vermin or,Bazir,Bazir,Apocalypse Envoy,Training Dummy,Midnight Asura,Dawnfire Asura,Mus hroom Sniffer,Angry Destroyer,Fu…

Leave a Reply

Your email address will not be published.