Search in sources :

Example 1 with EtypeIDs

use of fr.guiguilechat.jcelechat.model.sde.load.fsd.EtypeIDs in project JCELechat by guiguilechat.

the class CheckESISDE method main.

public static void main(String[] args) {
    long start = System.currentTimeMillis();
    // first preload everything
    Universe universe = ESIStatic.INSTANCE.cache().universe;
    Dogma dogma = ESIStatic.INSTANCE.cache().dogma;
    MapHolder<Integer, R_get_universe_categories_category_id> catMap = universe.categories().mapItems(catid -> universe.categories(catid)).toMap(h -> h.get().category_id, h -> h.get());
    MapHolder<Integer, R_get_universe_groups_group_id> groupMap = universe.groups().mapItems(groupID -> universe.groups(groupID)).toMap(h -> h.get().group_id, h -> h.get());
    MapHolder<Integer, R_get_universe_types_type_id> typeMap = universe.types().mapItems(typeID -> universe.types(typeID)).toMap(h -> h.get().type_id, h -> h.get());
    MapHolder<Integer, R_get_dogma_attributes_attribute_id> attMap = dogma.attributes().mapItems(typeID -> dogma.attributes(typeID)).toMap(h -> h.get().attribute_id, h -> h.get());
    EcategoryIDs.load();
    EgroupIDs.load();
    EtypeIDs.load();
    EdogmaAttributes.load();
    long postLoad = System.currentTimeMillis();
    System.out.println("loaded in " + (postLoad - start) + "ms");
    int errors = 0;
    for (Entry<Integer, EcategoryIDs> e : EcategoryIDs.load().entrySet()) {
        EcategoryIDs sdeEntry = e.getValue();
        R_get_universe_categories_category_id esiEntry = catMap.get().get(e.getKey());
        if (sdeEntry.published != esiEntry.published) {
            System.out.println("cat=" + e.getKey() + "(" + esiEntry.name + ")" + " esi=" + esiEntry.published + " sde=" + sdeEntry.published);
            errors++;
        }
    }
    for (Entry<Integer, EgroupIDs> e : EgroupIDs.load().entrySet()) {
        EgroupIDs sdeEntry = e.getValue();
        R_get_universe_groups_group_id esiEntry = groupMap.get().get(e.getKey());
        if (sdeEntry.published != esiEntry.published) {
            System.out.println("group=" + e.getKey() + "(" + esiEntry.name + ")" + " esi=" + esiEntry.published + " sde=" + sdeEntry.published);
            errors++;
        }
    }
    for (Entry<Integer, EtypeIDs> e : EtypeIDs.load().entrySet()) {
        EtypeIDs sdeEntry = e.getValue();
        R_get_universe_types_type_id esiEntry = typeMap.get().get(e.getKey());
        if (sdeEntry.published != esiEntry.published) {
            System.out.println("type=" + e.getKey() + "(" + esiEntry.name + ")" + " esi=" + esiEntry.published + " sde=" + sdeEntry.published);
            errors++;
        }
    }
    Set<Integer> attributeIds = new HashSet<>();
    Map<Integer, EdogmaAttributes> attSDEMap = EdogmaAttributes.load();
    attributeIds.addAll(attSDEMap.keySet());
    attributeIds.addAll(attMap.get().keySet());
    for (int attId : attributeIds) {
        EdogmaAttributes sdeEntry = attSDEMap.get(attId);
        R_get_dogma_attributes_attribute_id esiEntry = attMap.get().get(attId);
        if (sdeEntry == null) {
            System.out.println("attid=" + attId + " null in SDE, name in ESI=" + esiEntry.name);
            errors++;
        }
        if (esiEntry == null) {
            System.out.println("attid=" + attId + " null in ESI, name in SDE=" + sdeEntry.name);
            errors++;
        }
        if (sdeEntry != null && esiEntry != null) {
            if (sdeEntry.published != esiEntry.published) {
                System.out.println("att=" + attId + "(" + esiEntry.name + ")" + " esi=" + esiEntry.published + " sde=" + sdeEntry.published);
                errors++;
            }
            if (!sdeEntry.name.equals(esiEntry.name)) {
                System.out.println("att=" + attId + " esiname=" + esiEntry.name + " sdename=" + sdeEntry.name);
                errors++;
            }
        }
    }
    System.out.println("found " + errors + " errors in " + (System.currentTimeMillis() - postLoad) + " ms");
}
Also used : EgroupIDs(fr.guiguilechat.jcelechat.model.sde.load.fsd.EgroupIDs) EcategoryIDs(fr.guiguilechat.jcelechat.model.sde.load.fsd.EcategoryIDs) R_get_universe_types_type_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_types_type_id) R_get_universe_categories_category_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_categories_category_id) Set(java.util.Set) ESIStatic(fr.guiguilechat.jcelechat.jcesi.disconnected.ESIStatic) MapHolder(fr.lelouet.tools.holders.interfaces.collections.MapHolder) EdogmaAttributes(fr.guiguilechat.jcelechat.model.sde.load.fsd.EdogmaAttributes) HashSet(java.util.HashSet) Universe(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.disconnected.Universe) Map(java.util.Map) Entry(java.util.Map.Entry) Dogma(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.disconnected.Dogma) R_get_dogma_attributes_attribute_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_dogma_attributes_attribute_id) EtypeIDs(fr.guiguilechat.jcelechat.model.sde.load.fsd.EtypeIDs) R_get_universe_groups_group_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_groups_group_id) Dogma(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.disconnected.Dogma) R_get_universe_groups_group_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_groups_group_id) R_get_universe_types_type_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_types_type_id) Universe(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.disconnected.Universe) EtypeIDs(fr.guiguilechat.jcelechat.model.sde.load.fsd.EtypeIDs) R_get_dogma_attributes_attribute_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_dogma_attributes_attribute_id) EdogmaAttributes(fr.guiguilechat.jcelechat.model.sde.load.fsd.EdogmaAttributes) EcategoryIDs(fr.guiguilechat.jcelechat.model.sde.load.fsd.EcategoryIDs) R_get_universe_categories_category_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_categories_category_id) EgroupIDs(fr.guiguilechat.jcelechat.model.sde.load.fsd.EgroupIDs) HashSet(java.util.HashSet)

Example 2 with EtypeIDs

use of fr.guiguilechat.jcelechat.model.sde.load.fsd.EtypeIDs in project JCELechat by guiguilechat.

the class SDELoader method load.

public static TypeHierarchy load() {
    Map<Integer, EdogmaAttributes> attTypes = EdogmaAttributes.load();
    TypeHierarchy ret = new TypeHierarchy();
    // categories
    for (Entry<Integer, EcategoryIDs> e : EcategoryIDs.load().entrySet()) {
        CatDetails det = new CatDetails();
        det.id = e.getKey();
        det.name = e.getValue().enName();
        det.published = e.getValue().published;
        ret.catID2Details.put(e.getKey(), det);
        ret.catID2GroupIDs.put(det.id, new HashSet<>());
    }
    // groups
    for (Entry<Integer, EgroupIDs> e : EgroupIDs.load().entrySet()) {
        GroupDetails det = new GroupDetails();
        det.id = e.getKey();
        det.catID = e.getValue().categoryID;
        det.name = e.getValue().enName();
        det.published = e.getValue().published;
        ret.groupID2Details.put(e.getKey(), det);
        ret.groupID2TypeIDs.put(det.id, new HashSet<>());
        ret.catID2GroupIDs.computeIfAbsent(e.getValue().categoryID, i -> new HashSet<>()).add(e.getKey());
    }
    // types
    for (Entry<Integer, EtypeIDs> e : EtypeIDs.load().entrySet()) {
        TypeDetails det = new TypeDetails();
        det.name = e.getValue().enName();
        det.id = e.getKey();
        det.basePrice = e.getValue().basePrice;
        det.marketGroupID = e.getValue().marketGroupID;
        det.groupID = e.getValue().groupID;
        det.mass = e.getValue().mass;
        // no packaged volume in sde ?
        det.portionSize = e.getValue().portionSize;
        det.published = e.getValue().published;
        det.volume = e.getValue().volume;
        ret.typeID2Details.put(e.getKey(), det);
        ret.groupID2TypeIDs.computeIfAbsent(e.getValue().groupID, i -> new HashSet<>()).add(e.getKey());
    }
    // Attributes
    HashSet<Integer> floatAttributeIds = new HashSet<>();
    HashSet<Integer> allAttributesIds = new HashSet<>();
    for (Entry<Integer, EtypeDogma> e : EtypeDogma.load().entrySet()) {
        int typeID = e.getKey();
        TypeDetails td = ret.typeID2Details.get(typeID);
        if (td == null) {
            td = new TypeDetails();
            td.name = "unknown_" + typeID;
            ret.typeID2Details.put(typeID, td);
        }
        EtypeDogma etd = e.getValue();
        if (etd.dogmaAttributes != null) {
            for (EAttributes tatt : etd.dogmaAttributes) {
                int attId = tatt.attributeID;
                float value = tatt.value;
                td.definition.put(attId, value);
                // add the attribute to the list of those with a float value
                if ((int) value != value) {
                    floatAttributeIds.add(attId);
                }
                allAttributesIds.add(attId);
            }
        }
    }
    for (int attId : allAttributesIds) {
        EdogmaAttributes eattr = attTypes.get(attId);
        AttributeDetails det = new AttributeDetails();
        det.defaultValue = eattr.defaultValue;
        det.description = eattr.description;
        det.hasFloat = floatAttributeIds.contains(attId);
        det.highIsGood = eattr.highIsGood;
        det.id = attId;
        det.name = eattr.name;
        det.published = eattr.published;
        det.stackable = eattr.stackable;
        ret.attID2Details.put(attId, det);
    }
    return ret;
}
Also used : EgroupIDs(fr.guiguilechat.jcelechat.model.sde.load.fsd.EgroupIDs) Logger(org.slf4j.Logger) EcategoryIDs(fr.guiguilechat.jcelechat.model.sde.load.fsd.EcategoryIDs) LoggerFactory(org.slf4j.LoggerFactory) TypeDetails(fr.guiguilechat.jcelechat.model.sde.hierarchy.TypeDetails) EdogmaAttributes(fr.guiguilechat.jcelechat.model.sde.load.fsd.EdogmaAttributes) HashSet(java.util.HashSet) EAttributes(fr.guiguilechat.jcelechat.model.sde.load.fsd.EtypeDogma.EAttributes) EtypeDogma(fr.guiguilechat.jcelechat.model.sde.load.fsd.EtypeDogma) CatDetails(fr.guiguilechat.jcelechat.model.sde.hierarchy.CatDetails) Map(java.util.Map) GroupDetails(fr.guiguilechat.jcelechat.model.sde.hierarchy.GroupDetails) Entry(java.util.Map.Entry) TypeHierarchy(fr.guiguilechat.jcelechat.model.sde.hierarchy.TypeHierarchy) AttributeDetails(fr.guiguilechat.jcelechat.model.sde.hierarchy.AttributeDetails) EtypeIDs(fr.guiguilechat.jcelechat.model.sde.load.fsd.EtypeIDs) CatDetails(fr.guiguilechat.jcelechat.model.sde.hierarchy.CatDetails) EtypeIDs(fr.guiguilechat.jcelechat.model.sde.load.fsd.EtypeIDs) EtypeDogma(fr.guiguilechat.jcelechat.model.sde.load.fsd.EtypeDogma) EdogmaAttributes(fr.guiguilechat.jcelechat.model.sde.load.fsd.EdogmaAttributes) TypeDetails(fr.guiguilechat.jcelechat.model.sde.hierarchy.TypeDetails) GroupDetails(fr.guiguilechat.jcelechat.model.sde.hierarchy.GroupDetails) AttributeDetails(fr.guiguilechat.jcelechat.model.sde.hierarchy.AttributeDetails) TypeHierarchy(fr.guiguilechat.jcelechat.model.sde.hierarchy.TypeHierarchy) EcategoryIDs(fr.guiguilechat.jcelechat.model.sde.load.fsd.EcategoryIDs) EgroupIDs(fr.guiguilechat.jcelechat.model.sde.load.fsd.EgroupIDs) HashSet(java.util.HashSet) EAttributes(fr.guiguilechat.jcelechat.model.sde.load.fsd.EtypeDogma.EAttributes)

Aggregations

EcategoryIDs (fr.guiguilechat.jcelechat.model.sde.load.fsd.EcategoryIDs)2 EdogmaAttributes (fr.guiguilechat.jcelechat.model.sde.load.fsd.EdogmaAttributes)2 EgroupIDs (fr.guiguilechat.jcelechat.model.sde.load.fsd.EgroupIDs)2 EtypeIDs (fr.guiguilechat.jcelechat.model.sde.load.fsd.EtypeIDs)2 HashSet (java.util.HashSet)2 Map (java.util.Map)2 Entry (java.util.Map.Entry)2 ESIStatic (fr.guiguilechat.jcelechat.jcesi.disconnected.ESIStatic)1 Dogma (fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.disconnected.Dogma)1 Universe (fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.disconnected.Universe)1 R_get_dogma_attributes_attribute_id (fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_dogma_attributes_attribute_id)1 R_get_universe_categories_category_id (fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_categories_category_id)1 R_get_universe_groups_group_id (fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_groups_group_id)1 R_get_universe_types_type_id (fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_types_type_id)1 AttributeDetails (fr.guiguilechat.jcelechat.model.sde.hierarchy.AttributeDetails)1 CatDetails (fr.guiguilechat.jcelechat.model.sde.hierarchy.CatDetails)1 GroupDetails (fr.guiguilechat.jcelechat.model.sde.hierarchy.GroupDetails)1 TypeDetails (fr.guiguilechat.jcelechat.model.sde.hierarchy.TypeDetails)1 TypeHierarchy (fr.guiguilechat.jcelechat.model.sde.hierarchy.TypeHierarchy)1 EtypeDogma (fr.guiguilechat.jcelechat.model.sde.load.fsd.EtypeDogma)1