Search in sources :

Example 1 with DataUnitFactory

use of main.system.data.DataUnitFactory in project Eidolons by IDemiurge.

the class Dungeon method getPoint.

public Coordinates getPoint(String arg) {
    Coordinates c = null;
    if (arg.contains(ScriptSyntax.SPAWN_POINT) || StringMaster.isInteger(arg)) {
        arg = arg.replace(ScriptSyntax.SPAWN_POINT, "");
        Integer i = StringMaster.getInteger(arg) - 1;
        List<String> spawnPoints = StringMaster.openContainer(getProperty(PROPS.COORDINATE_POINTS));
        c = new Coordinates(spawnPoints.get(i));
    } else {
        Map<String, String> map = new DataUnitFactory(true).deconstructDataString(getProperty(PROPS.NAMED_COORDINATE_POINTS));
        String string = map.get(arg);
        if (string == null) {
            // find
            Object key = new SearchMaster<>().findClosest(arg, map.keySet());
            string = map.get(key);
        }
        return new Coordinates(string);
    }
    return c;
// getProperty(PROPS.ENCOUNTER_SPAWN_POINTS)
}
Also used : Coordinates(main.game.bf.Coordinates) DataUnitFactory(main.system.data.DataUnitFactory)

Example 2 with DataUnitFactory

use of main.system.data.DataUnitFactory in project Eidolons by IDemiurge.

the class Loader method initDungeon.

private static void initDungeon(Node dungeonNode) {
    String xml = XML_Converter.toString(dungeonNode);
    String name = XML_Converter.findNode(xml, "Name").getTextContent();
    String path = XML_Converter.findNode(xml, "LevelFilePath").getTextContent();
    DataUnitFactory factory = new DataUnitFactory(DungeonData.FORMAT);
    factory.setValueNames(DUNGEON_VALUE.TYPE_NAME, DUNGEON_VALUE.PATH);
    factory.setValues(name, path);
    DungeonData data = new DungeonData(factory.constructDataString());
    getGame().getDataKeeper().setDungeonData(data);
// ObjType type = DataManager.getType(XML_Converter.findNode(
// xml, "Name")
// .getTextContent(), DC_TYPE.DUNGEONS);
// Map<PROPERTY, String> props = getPropsFromNode(xml);
// Map<PARAMETER, String> params = getParamsFromNode(xml);
// getGame().getDungeonMaster().s
}
Also used : DataUnitFactory(main.system.data.DataUnitFactory) DungeonData(eidolons.game.battlecraft.logic.dungeon.universal.DungeonData)

Aggregations

DataUnitFactory (main.system.data.DataUnitFactory)2 DungeonData (eidolons.game.battlecraft.logic.dungeon.universal.DungeonData)1 Coordinates (main.game.bf.Coordinates)1