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);
}
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;
}
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;
}
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;
}
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;
}
Aggregations