Search in sources :

Example 11 with XLinkedMap

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

the class VendorListsPanel method initListMap.

public Map<String, HC_PagedListPanel> initListMap(String tabName) {
    List<String> group = getListGroup(tabName);
    ArrayList<String> specialLists = new ArrayList<>();
    Map<String, HC_PagedListPanel> map = new XLinkedMap<>();
    for (String listName : group) {
        if (checkSpecial(listName)) {
            specialLists.add(listName);
            continue;
        }
        if (!responsive) {
            if (!checkList(listName, false)) {
                continue;
            }
        }
        if (!showAll) {
            if (!checkList(listName, true)) {
                continue;
            }
        }
        List<String> types = DataManager.getTypesSubGroupNames(TYPE, listName);
        if (Launcher.ILYA_MODE) {
            if (TYPE == DC_TYPE.SPELLS || TYPE == DC_TYPE.SKILLS) {
                FilterMaster.filterByProp(types, G_PROPS.WORKSPACE_GROUP.getName(), "" + MetaEnums.WORKSPACE_GROUP.DESIGN, TYPE, true);
                FilterMaster.filterByProp(types, G_PROPS.WORKSPACE_GROUP.getName(), "" + MetaEnums.WORKSPACE_GROUP.IMPLEMENT, TYPE, true);
                FilterMaster.filterByProp(types, PROPS.ITEM_SHOP_CATEGORY.getName(), "" + ItemEnums.ITEM_SHOP_CATEGORY.SPECIAL, TYPE, true);
            // so you see, it wouldn't be hard to filter the items for
            // each shop in macro
            }
        }
        if (types == null) {
            // shot in the leg!
            continue;
        }
        if (types.isEmpty()) {
            continue;
        }
        List<ObjType> data;
        // if (checkSpecial(listName))
        // data = getSpecialData();
        // else {
        OBJ_TYPE T = TYPE;
        if (T instanceof C_OBJ_TYPE) {
            if (tabName.equalsIgnoreCase(DC_TYPE.JEWELRY.getName())) {
                T = DC_TYPE.JEWELRY;
            }
            if (tabName.equalsIgnoreCase(ItemEnums.ITEM_TYPE.ALCHEMY.toString())) {
                T = DC_TYPE.ITEMS;
            }
            // if (TYPE != OBJ_TYPES.SPELLS)
            if (tabName.equalsIgnoreCase(ItemEnums.ARMOR_TYPE.LIGHT.toString()) || tabName.equalsIgnoreCase(ItemEnums.ARMOR_TYPE.HEAVY.toString())) {
                T = DC_TYPE.ARMOR;
            }
        }
        // TODO is there a
        data = DataManager.toTypeList(types, T);
        if (getFilter() != null) {
            data = getFilter().filter(data);
        }
        if (getSpecialFilter() != null) {
            data = getSpecialFilter().filter(data);
        }
        if (getSorter() != null) {
            try {
                Collections.sort(data, getSorter());
            } catch (Exception e) {
                main.system.ExceptionMaster.printStackTrace(e);
            // main.system.ExceptionMaster.printStackTrace(e);
            }
        }
        putList(listName, data, map);
    }
    for (String listName : specialLists) {
        List<ObjType> data = getSpecialData();
        if (getSorter() != null) {
            Collections.sort(data, getSorter());
        }
        putList(listName, data, map);
    }
    return map;
}
Also used : C_OBJ_TYPE(main.content.C_OBJ_TYPE) C_OBJ_TYPE(main.content.C_OBJ_TYPE) OBJ_TYPE(main.content.OBJ_TYPE) ObjType(main.entity.type.ObjType) XLinkedMap(main.data.XLinkedMap) HC_PagedListPanel(eidolons.client.cc.gui.pages.HC_PagedListPanel)

Example 12 with XLinkedMap

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

the class Loader method getPropsFromNode.

private static Map<PROPERTY, String> getPropsFromNode(String sub) {
    Node node = XML_Converter.findNode(sub, TypeBuilder.PROPS_NODE);
    Map<PROPERTY, String> map = new XLinkedMap<>();
    XML_Converter.getNodeList(node).forEach(subNode -> {
        PROPERTY prop = ContentManager.getPROP(subNode.getNodeName());
        String value = subNode.getTextContent();
        map.put(prop, value);
    });
    return map;
}
Also used : PROPERTY(main.content.values.properties.PROPERTY) XLinkedMap(main.data.XLinkedMap) Node(org.w3c.dom.Node)

Example 13 with XLinkedMap

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

the class MusicCore method getGroupedView.

public static MusicListPanel getGroupedView(int option, Class<?> constClass) {
    if (option == -1) {
        return null;
    }
    PROPERTY filterProp = ContentManager.getPROP(constClass.getSimpleName());
    // String[] array = (AHK_Master.qwerty + " " +
    // AHK_Master.qwerty.substring(1).toUpperCase() + " 123")
    // .split(" ");
    String viewName = "All " + StringMaster.getWellFormattedString(constClass.getSimpleName());
    Map<String, List<String>> map = new XLinkedMap<>();
    List<String> musicConsts = EnumMaster.getEnumConstantNames(constClass);
    if (option != 0) {
        musicConsts = getMusicConsts(constClass, option);
        viewName = getViewName(constClass, option);
    }
    Map<ObjType, String> multiPropMap = new HashMap<>();
    loop: for (String g : musicConsts) {
        // map.
        List<String> list = new ArrayList<>();
        // for (MusicList musList : listTypeMap.values()) {
        typeLoop: for (ObjType type : DataManager.getTypes(AT_OBJ_TYPE.MUSIC_LIST)) {
            if (type.checkProperty(filterProp, g)) {
                if (filterProp.isContainer()) {
                    containerLoop: for (String sub : StringMaster.open(type.getProperty(filterProp))) {
                        for (String c : musicConsts) {
                            if (StringMaster.compare(c, sub)) {
                                if (c.equalsIgnoreCase(g)) {
                                    break containerLoop;
                                } else {
                                    multiPropMap.put(type, c);
                                    continue typeLoop;
                                }
                            }
                        }
                    }
                }
                list.add(AHK_Master.getScriptLineForList(type));
            }
        }
        map.put(g, list);
    }
    for (ObjType sub : multiPropMap.keySet()) {
        for (String c : map.keySet()) {
            if (multiPropMap.get(sub).equals(c)) {
                map.get(c).add(AHK_Master.getScriptLineForList(sub));
            }
        }
    }
    for (String sub : map.keySet()) {
        map.put(sub, new ArrayList<>(new LinkedHashSet<>(map.get(sub))));
    }
    // TODO adapt to max list size also
    int wrap = 5 - map.size() / 2;
    MusicListPanel musicListPanel = new MusicListPanel("", null);
    G_Panel view = // AHK_Master.getPanel()
    musicListPanel.initView(map, false, wrap, musicConsts);
    musicListPanel.setView(view);
    view.setName(viewName);
    return musicListPanel;
}
Also used : PROPERTY(main.content.values.properties.PROPERTY) XLinkedMap(main.data.XLinkedMap) G_Panel(main.swing.generic.components.G_Panel) ObjType(main.entity.type.ObjType) MusicListPanel(main.music.gui.MusicListPanel) MusicList(main.music.entity.MusicList) List(java.util.List)

Example 14 with XLinkedMap

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

the class VersionMaster method getVersionDifferenceMap.

public static Map<VALUE, String> getVersionDifferenceMap(VERSION_PERIOD period, int n, ArcaneEntity type) {
    Map<VALUE, String> map = new XLinkedMap<>();
    ObjType oldType = getOlderVersion(type, period, n);
    for (PARAMETER p : oldType.getParamMap().keySet()) {
        int diff = type.getIntParam(p) - oldType.getIntParam(p);
        map.put(p, diff + "");
    }
    return map;
}
Also used : ObjType(main.entity.type.ObjType) XLinkedMap(main.data.XLinkedMap) VALUE(main.content.VALUE) PARAMETER(main.content.values.parameters.PARAMETER)

Example 15 with XLinkedMap

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

the class XML_Reader method constructTypeMap.

private static void constructTypeMap(Document doc, String key, Map<String, Set<String>> tabGroupMap, Map<String, Set<String>> treeSubGroupMap) {
    key = key.replace("_", " ").toLowerCase();
    LogMaster.log(LogMaster.DATA_DEBUG, "type map: " + key);
    Map<String, ObjType> typeMap = typeMaps.computeIfAbsent(key, k -> new XLinkedMap<>());
    NodeList nl = doc.getFirstChild().getChildNodes();
    Set<String> groupSet = new LinkedHashSet<>();
    for (int i = 0; i < nl.getLength(); i++) {
        Node node = nl.item(i);
        NodeList nl1 = node.getChildNodes();
        String aspect = node.getNodeName();
        PROPERTY groupingKey = DataManager.getGroupingKey(key);
        PROPERTY subGroupingKey = DataManager.getSubGroupingKey(key);
        for (int a = 0; a < nl1.getLength(); a++) {
            Node typeNode = nl1.item(a);
            String name = typeNode.getNodeName();
            if ("#text".equals(name)) {
                continue;
            }
            ObjType type = TypeBuilder.buildType(typeNode, key);
            if (type != null) {
                name = type.getName();
                // TAB GROUPS
                if (type.getProperty(groupingKey) == null) {
                    type.setProperty(G_PROPS.ASPECT, aspect);
                }
                groupSet.add(type.getProperty(groupingKey));
                aspect = type.getProperty(groupingKey);
                // TREE SUB GROUPS
                String subKey = type.getProperty(subGroupingKey);
                treeSubGroupMap.computeIfAbsent(aspect, k -> new HashSet<>()).add(subKey);
                typeMap.put(name, type);
                LogMaster.log(LogMaster.DATA_DEBUG, typeNode.getNodeName() + " has been put into map as " + type);
            }
        }
    }
    if (tabGroupMap.get(key) == null) {
        tabGroupMap.put(key, groupSet);
    } else {
        tabGroupMap.get(key).addAll(groupSet);
    }
// if (key.equals(StringS.ABILS.getName())) {
// Err.info(set + "");
// }
}
Also used : DC_TYPE(main.content.DC_TYPE) LogMaster(main.system.auxiliary.log.LogMaster) java.util(java.util) ObjType(main.entity.type.ObjType) NodeList(org.w3c.dom.NodeList) PROPERTY(main.content.values.properties.PROPERTY) DequeImpl(main.system.datatypes.DequeImpl) Game(main.game.core.game.Game) XLinkedMap(main.data.XLinkedMap) CoreEngine(main.system.launch.CoreEngine) File(java.io.File) PARAMETER(main.content.values.parameters.PARAMETER) MapMaster(main.system.auxiliary.data.MapMaster) TypeBuilder(main.system.launch.TypeBuilder) DataManager(main.data.DataManager) Document(org.w3c.dom.Document) Node(org.w3c.dom.Node) Chronos(main.system.auxiliary.log.Chronos) FileManager(main.system.auxiliary.data.FileManager) OBJ_TYPE(main.content.OBJ_TYPE) G_PROPS(main.content.values.properties.G_PROPS) PathFinder(main.data.filesys.PathFinder) ObjType(main.entity.type.ObjType) PROPERTY(main.content.values.properties.PROPERTY) NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node)

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