Search in sources :

Example 6 with XLinkedMap

use of main.data.XLinkedMap in project Eidolons by IDemiurge.

the class MusicListPanel method initCustomViews.

protected void initCustomViews() {
    List<File> topList = new ArrayList<>();
    Map<String, List<String>> customMap = new XLinkedMap<>();
    for (File file : FileManager.getFilesFromDirectory(AHK_Master.CUSTOM_LISTS_FOLDER, true)) {
        if (file.isDirectory()) {
            String name = file.getName();
            G_Panel view = initView(getCustomMap(name, FileManager.getFilesFromDirectory(file.getPath(), false), customMap), isLetterShown());
        // viewsPanel.addView(file.getName(), view);
        } else {
            topList.add(file);
        }
    }
    // add root to the subpanel map
    Map<String, List<String>> map = getCustomMap(topList, customMap);
    MusicListPanel panel = new MusicListPanel(key, map);
    panel.setView(panel.initView(map, isLetterShown()));
    viewsPanel.addView("Custom", panel);
}
Also used : XLinkedMap(main.data.XLinkedMap) G_Panel(main.swing.generic.components.G_Panel) List(java.util.List) File(java.io.File)

Example 7 with XLinkedMap

use of main.data.XLinkedMap in project Eidolons by IDemiurge.

the class MusicCore method getFilterView.

public static MusicListPanel getFilterView(String filterVal, PROPERTY filterProp) {
    Map<String, List<String>> map = new XLinkedMap<>();
    String name = filterProp.getName() + " by " + filterVal;
    MusicListPanel panel = new MusicListPanel(name, map);
    int maxSize = 0;
    int i = 0;
    for (String substring : StringMaster.open(filterVal)) {
        List<String> list = new ArrayList<>();
        for (ObjType type : DataManager.getTypes(AT_OBJ_TYPE.MUSIC_LIST)) {
            if (type.checkProperty(filterProp, substring)) {
                list.add(type.getProperty(G_PROPS.HOTKEY) + "::" + type.getProperty(AT_PROPS.PATH));
            }
        }
        if (maxSize < list.size()) {
            maxSize = list.size();
        }
        map.put(i + "", list);
        i++;
    }
    List<String> musicConsts = StringMaster.openContainer(filterVal);
    int customWrap = 2 + maxSize / 14;
    if (customWrap < 0) {
        customWrap = 0;
    }
    G_Panel v = panel.initView(map, false, customWrap, musicConsts);
    panel.setView(v);
    panel.setName(name);
    v.setName(name);
    return panel;
}
Also used : ObjType(main.entity.type.ObjType) XLinkedMap(main.data.XLinkedMap) G_Panel(main.swing.generic.components.G_Panel) MusicListPanel(main.music.gui.MusicListPanel) MusicList(main.music.entity.MusicList) List(java.util.List)

Example 8 with XLinkedMap

use of main.data.XLinkedMap in project Eidolons by IDemiurge.

the class EncounterMaster method getWaveSequence.

private static Map<Wave, Integer> getWaveSequence(Encounter e) {
    Map<Wave, Integer> waves = new XLinkedMap<>();
    int i = 0;
    for (String typeName : StringMaster.open(e.getTypeNames())) {
        ObjType waveType = DataManager.getType(typeName, DC_TYPE.ENCOUNTERS);
        Wave wave = new Wave(waveType, DC_Game.game, new Ref(), DC_Game.game.getPlayer(false));
        // TODO is the field ready for coordinates?
        wave.initUnitMap();
        int j = i;
        // + DC_Game.game.getBattleMaster().getBattleConstructor().getRoundsToFight(
        // waveType);
        Integer round = RandomWizard.getRandomIntBetween(i, j);
        i += round;
        waves.put(wave, round);
    }
    return waves;
}
Also used : Wave(eidolons.game.battlecraft.logic.battle.arena.Wave) Ref(main.entity.Ref) MacroRef(eidolons.game.module.adventure.MacroRef) ObjType(main.entity.type.ObjType) XLinkedMap(main.data.XLinkedMap)

Example 9 with XLinkedMap

use of main.data.XLinkedMap in project Eidolons by IDemiurge.

the class ArenaBattleConstructor method constructWaveSequence.

public Map<Wave, Integer> constructWaveSequence(ENCOUNTER_TYPE[] encounter_sequence) {
    Integer round = getRoundNumber();
    if (SkirmishMaster.isSkirmish()) {
        return SkirmishMaster.constructWaveSequences(round);
    }
    Map<Wave, Integer> map = new XLinkedMap<>();
    if (alt != null) {
        alt = !alt;
    } else {
        alt = checkAltEncounter();
    }
    List<ObjType> waves = getWaveTypes(getDungeon().getType(), alt);
    List<ObjType> waveBuffer = new ArrayList<>(waves);
    for (ENCOUNTER_TYPE type : encounter_sequence) {
        if (waveBuffer.isEmpty()) {
            waveBuffer = DataManager.getTypesGroup(DC_TYPE.ENCOUNTERS, StringMaster.getWellFormattedString(type.toString()));
        }
        waves = new ArrayList<>(waveBuffer);
        Conditions conditions = new Conditions(getEncounterTypeCondition(type));
        List<ObjType> filteredWaves = new Filter<ObjType>(game, conditions).filter(waves);
        if (!filteredWaves.isEmpty()) {
            waves = filteredWaves;
        } else {
            continue;
        }
        ObjType waveType = getWaveType(waves, type);
        waveType = new ObjType(waveType);
        FACING_DIRECTION side = null;
        // getMaster().getDungeonMaster().getPositioner().nextSide();
        waveType.setProperty(PROPS.SPAWNING_SIDE, side.getName());
        Coordinates c = pickSpawnCoordinateForWave(type, round, waveType);
        Wave wave = new Wave(c, waveType, game, new Ref(game), game.getPlayer(false));
        wave.initUnitMap();
        map.put(wave, round);
        if (Eidolons.DEV_MODE) {
            game.getLogManager().logInfo(wave.toString() + " on round #" + round);
        }
        LogMaster.log(1, wave.toString() + " on round #" + round);
        // TODO subtract from
        round += getRoundsToFight(waveType, type);
    // total pool
    }
    setIndex(getIndex() + 1);
    return map;
}
Also used : XLinkedMap(main.data.XLinkedMap) ENCOUNTER_TYPE(main.content.enums.EncounterEnums.ENCOUNTER_TYPE) Coordinates(main.game.bf.Coordinates) ArrayList(java.util.ArrayList) Conditions(main.elements.conditions.Conditions) FACING_DIRECTION(main.game.bf.Coordinates.FACING_DIRECTION) Ref(main.entity.Ref) ObjType(main.entity.type.ObjType)

Example 10 with XLinkedMap

use of main.data.XLinkedMap in project Eidolons by IDemiurge.

the class ShopListsPanel method initListMap.

// to be used
public Map<String, HC_PagedListPanel> initListMap(String tabName) {
    if (!Launcher.getMainManager().isMacroMode()) {
        return super.initListMap(tabName);
    }
    if (getTown() == null) {
        return new HashMap<>();
    }
    Map<String, HC_PagedListPanel> map = new XLinkedMap<>();
    List<ObjType> items = new ArrayList<>();
    Shop shop = getShop(tabName);
    shop.setVendorPanel(this);
    for (ObjType t : shop.getItems()) {
        items.add(t);
    }
    for (String group : getListGroup(tabName)) {
        List<ObjType> data = new ArrayList<>();
        for (ObjType t : items) {
            if (checkType(t, group, shop)) {
                data.add(t);
            }
        }
        if (!data.isEmpty()) {
            putList(group, data, map);
        }
    }
    // sorting?
    return map;
}
Also used : Shop(eidolons.game.module.adventure.town.Shop) ObjType(main.entity.type.ObjType) XLinkedMap(main.data.XLinkedMap) HC_PagedListPanel(eidolons.client.cc.gui.pages.HC_PagedListPanel)

Aggregations

XLinkedMap (main.data.XLinkedMap)21 ObjType (main.entity.type.ObjType)11 PARAMETER (main.content.values.parameters.PARAMETER)4 Node (org.w3c.dom.Node)4 List (java.util.List)3 PROPERTY (main.content.values.properties.PROPERTY)3 Ref (main.entity.Ref)3 G_Panel (main.swing.generic.components.G_Panel)3 HC_PagedListPanel (eidolons.client.cc.gui.pages.HC_PagedListPanel)2 Wave (eidolons.game.battlecraft.logic.battle.arena.Wave)2 File (java.io.File)2 OBJ_TYPE (main.content.OBJ_TYPE)2 Coordinates (main.game.bf.Coordinates)2 MusicList (main.music.entity.MusicList)2 MusicListPanel (main.music.gui.MusicListPanel)2 Document (org.w3c.dom.Document)2 ClassTreeCondition (eidolons.ability.conditions.req.ClassTreeCondition)1 MultiClassCondition (eidolons.ability.conditions.req.MultiClassCondition)1 SkillPointCondition (eidolons.ability.conditions.req.SkillPointCondition)1 ValueGroupCondition (eidolons.ability.conditions.req.ValueGroupCondition)1