Search in sources :

Example 1 with MapHolder

use of fr.lelouet.tools.holders.interfaces.collections.MapHolder in project JCELechat by guiguilechat.

the class ShowDeathPerShipRatio method main.

public static void main(String[] args) {
    CacheStatic cache = ESIStatic.INSTANCE.cache();
    for (Integer r : cache.universe.systems().get()) {
        cache.universe.systems(r);
    }
    MapHolder<Integer, R_get_universe_system_kills> kills = cache.universe.system_kills().toMap(sys -> sys.system_id);
    MapHolder<Integer, R_get_universe_system_jumps> jumps_m = cache.universe.system_jumps().toMap(sys -> sys.system_id);
    // useless because wh are not given their kill statistics
    Set<Integer> whconstels = IntStream.range(11000001, 11000033 + 1).parallel().mapToObj(r_i -> cache.universe.regions(r_i)).flatMapToInt(h -> IntStream.of(h.get().constellations)).mapToObj(i -> i).collect(Collectors.toSet());
    Set<Integer> abyssConstels = IntStream.range(12000001, 12000005 + 1).parallel().mapToObj(r_i -> cache.universe.regions(r_i)).flatMapToInt(h -> IntStream.of(h.get().constellations)).mapToObj(i -> i).collect(Collectors.toSet());
    // System.err.println("constel ids=" + whconstels);
    // HS, LS, NS, WH, abyssal
    String[] indexNames = { "HS", "LS", "NS", "WS", "abyss" };
    long[] npc_kills = new long[indexNames.length];
    long[] ship_kills = new long[indexNames.length];
    long[] jumps = new long[indexNames.length];
    int[] totalsystems = new int[indexNames.length];
    int[] nokills = new int[indexNames.length];
    int[] nojumps = new int[indexNames.length];
    int[] nokilljump = new int[indexNames.length];
    for (Integer sys_id : cache.universe.systems().get()) {
        R_get_universe_systems_system_id system = cache.universe.systems(sys_id).get();
        int index = 0;
        if (whconstels.contains(system.constellation_id)) {
            index = 3;
        } else if (abyssConstels.contains(system.constellation_id)) {
            index = 4;
        } else {
            index = system.security_status > 0.45 ? 0 : system.security_status > 0.0 ? 1 : 2;
        }
        R_get_universe_system_kills syskills = kills.get().get(system.system_id);
        if (syskills != null) {
            npc_kills[index] += syskills.npc_kills;
            ship_kills[index] += syskills.ship_kills;
        } else {
            nokills[index]++;
        }
        R_get_universe_system_jumps sysjumps = jumps_m.get().get(system.system_id);
        if (sysjumps != null) {
            jumps[index] += sysjumps.ship_jumps;
        } else {
            nojumps[index]++;
        }
        if (syskills == null && sysjumps == null) {
            nokilljump[index]++;
            nokills[index]--;
            nojumps[index]--;
        }
        totalsystems[index]++;
    }
    System.out.println("space\tship kills\tnpc kills\tjumps\tnpc / ship\tnpc / jumps\t#systems\tnokilldata\tnojumpdata\tnok&j");
    for (int i = 0; i < indexNames.length; i++) {
        System.out.println(indexNames[i] + "\t" + ship_kills[i] + "\t" + npc_kills[i] + "\t" + jumps[i] + "\t" + 1.0f * npc_kills[i] / ship_kills[i] + "\t" + 1.0f * npc_kills[i] / jumps[i] + "\t" + totalsystems[i] + "\t" + nokills[i] + "\t" + nojumps[i] + "\t" + nokilljump[i]);
    }
}
Also used : IntStream(java.util.stream.IntStream) R_get_universe_system_kills(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_system_kills) Set(java.util.Set) R_get_universe_systems_system_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_systems_system_id) MapHolder(fr.lelouet.tools.holders.interfaces.collections.MapHolder) Collectors(java.util.stream.Collectors) R_get_universe_system_jumps(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_system_jumps) R_get_universe_system_jumps(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_system_jumps) R_get_universe_systems_system_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_systems_system_id) R_get_universe_system_kills(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_system_kills)

Example 2 with MapHolder

use of fr.lelouet.tools.holders.interfaces.collections.MapHolder in project JCELechat by guiguilechat.

the class InsuranceEval method main.

@SuppressWarnings("unused")
public static void main(String[] args) {
    CacheStatic cache = ESIStatic.INSTANCE.cache();
    ListHolder<R_get_insurance_prices> prices = cache.insurance.prices().filter(ins -> ins.levels[0].cost > 0);
    MapHolder<Integer, R_get_insurance_prices> id2Data = prices.toMap(price -> price.type_id);
    MapHolder<Integer, Float> id2Payout0 = prices.toMap(price -> price.type_id, price -> price.levels[0].payout);
    MapHolder<Integer, R_get_universe_types_type_id> id2Type = id2Data.keys().unpackItems(id -> cache.universe.types(id)).toMap(t -> t.type_id);
    Map<Integer, R_get_universe_types_type_id> types = id2Type.get();
// for (Entry<Integer, R_get_insurance_prices> e : id2Data.entries().get())
// {
// R_get_insurance_prices_levels level0 = e.getValue().levels[0];
// System.out.println(types.get(e.getKey()).name + "\t" + level0.payout /
// level0.cost + "\t" + level0.cost
// + "\t" + level0.payout + "\t" + level0.name);
// }
}
Also used : R_get_insurance_prices(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_insurance_prices) R_get_universe_types_type_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_types_type_id) Map(java.util.Map) ListHolder(fr.lelouet.tools.holders.interfaces.collections.ListHolder) CacheStatic(fr.guiguilechat.jcelechat.jcesi.disconnected.CacheStatic) ESIStatic(fr.guiguilechat.jcelechat.jcesi.disconnected.ESIStatic) MapHolder(fr.lelouet.tools.holders.interfaces.collections.MapHolder) R_get_insurance_prices(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_insurance_prices) CacheStatic(fr.guiguilechat.jcelechat.jcesi.disconnected.CacheStatic) R_get_universe_types_type_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_types_type_id)

Example 3 with MapHolder

use of fr.lelouet.tools.holders.interfaces.collections.MapHolder in project JCELechat by guiguilechat.

the class NPCsTranslater method translate.

private static void translate(LinkedHashMap<Integer, Eagents> eagents, LinkedHashMap<String, Agent> agents, LinkedHashMap<String, Corporation> corporations, LinkedHashMap<Integer, LPOffer> offers) {
    ESIAccess esi = ESIAccess.INSTANCE;
    CacheStatic cache = ESIStatic.INSTANCE.cache();
    // prefetch
    MapHolder<Integer, R_get_corporations_corporation_id> corporationsHolder = ((ListHolder<Integer>) cache.corporations.npccorps().follow(l -> {
        l.parallelStream().forEach(cache.corporations::get);
    })).toMap(i -> i, i -> cache.corporations.get(i).get());
    MapHolder<Integer, R_get_universe_factions> factionsHolder = cache.universe.factions().toMap(f -> f.faction_id);
    eagents.values().parallelStream().map(ag -> ag.locationID).distinct().forEach(lid -> Location.resolve(null, lid).system());
    // 
    LinkedHashMap<Integer, EnpcCorporations> ecorps = EnpcCorporations.load();
    Map<Integer, String> idx2name = EinvNames.loadById();
    Map<Integer, R_get_corporations_corporation_id> npcCorps = corporationsHolder.get();
    Map<Integer, R_get_universe_factions> factionById = factionsHolder.get();
    Map<Integer, Location> agentsLocation = eagents.entrySet().parallelStream().collect(Collectors.toMap(eag -> eag.getKey(), eag -> Location.resolve(null, eag.getValue().locationID)));
    logger.info("NPC prefetch received");
    for (Entry<Integer, Eagents> eagt : eagents.entrySet()) {
        Agent agent = new Agent();
        Eagents agt = eagt.getValue();
        agent.id = eagt.getKey();
        agent.corporation = ecorps.get(agt.corporationID).enName();
        agent.name = idx2name.get(agent.id);
        agent.isLocator = agt.isLocator;
        agent.level = agt.level;
        agent.type = AGENT_TYPE.of(agt.agentTypeID);
        if (agent.type == null) {
            logger.warn("no type for agent " + agent.name + " typeID=" + agt.agentTypeID);
        }
        agent.division = AGENT_DIVISION.of(agt.divisionID);
        if (agent.division == null) {
            logger.warn("no division for agent " + agent.name + " divisionID=" + agt.divisionID);
        }
        Location loc = agentsLocation.get(agent.id);
        if (loc != null) {
            agent.system = loc.system().name;
            R_get_universe_stations_station_id station = loc.station();
            if (station != null) {
                agent.station = station.name;
                agent.stationId = agt.locationID;
            }
            agents.put(agent.name, agent);
        } else {
            logger.warn("invalid location for agent " + agent.name + " locid=" + agt.locationID);
        }
    }
    logger.info("translated agents data");
    for (Entry<Integer, EnpcCorporations> e : ecorps.entrySet()) {
        Corporation add = new Corporation();
        add.id = e.getKey();
        EnpcCorporations snpc = e.getValue();
        add.name = snpc.enName();
        R_get_universe_factions faction = factionById.get(snpc.factionID);
        if (faction == null) {
            logger.debug("can't find faction from id " + snpc.factionID + " for corporation " + add.name);
        } else {
            add.faction = faction.name;
        }
        R_get_corporations_corporation_id esicorp = npcCorps.get(add.id);
        if (esicorp != null && esicorp.faction_id != 0) {
            add.warfare = factionById.get(esicorp.faction_id).name;
        }
        add.concordRate = EnpcCorporations.concordRates().getOrDefault(add.id, 0.0);
        if (add.id == EnpcCorporations.CONCORD_ID) {
            add.concordRate = 1.0;
        }
        corporations.put(add.name, add);
    }
    Map<Integer, LPOffer> covertedOffers = corporations.values().stream().parallel().flatMap(c -> {
        Requested<R_get_loyalty_stores_corporation_id_offers[]> req = esi.connection.get_loyalty_stores_offers(c.id, null);
        return req.isOk() ? Stream.of(req.getOK()) : Stream.empty();
    }).map(offer -> makeOffer(offer)).filter(o -> o != null).collect(Collectors.toMap(off -> off.id, off -> off, (o1, o2) -> o1));
    offers.putAll(covertedOffers);
    corporations.values().stream().parallel().forEach(c -> loadCorpOffers(c, esi.connection, offers));
}
Also used : R_get_universe_stations_station_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_stations_station_id) ItemRef(fr.guiguilechat.jcelechat.model.sde.npcs.LPOffer.ItemRef) FileTools(fr.guiguilechat.jcelechat.model.FileTools) Corporation(fr.guiguilechat.jcelechat.model.sde.npcs.Corporation) LoggerFactory(org.slf4j.LoggerFactory) AGENT_DIVISION(fr.guiguilechat.jcelechat.model.sde.npcs.Agent.AGENT_DIVISION) EinvNames(fr.guiguilechat.jcelechat.model.sde.load.bsd.EinvNames) ESIStatic(fr.guiguilechat.jcelechat.jcesi.disconnected.ESIStatic) Agent(fr.guiguilechat.jcelechat.model.sde.npcs.Agent) LPOffer(fr.guiguilechat.jcelechat.model.sde.npcs.LPOffer) MapHolder(fr.lelouet.tools.holders.interfaces.collections.MapHolder) ESIAccess(fr.guiguilechat.jcelechat.jcesi.disconnected.modeled.ESIAccess) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) Eblueprints(fr.guiguilechat.jcelechat.model.sde.load.fsd.Eblueprints) R_get_universe_factions(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_factions) Map(java.util.Map) ListHolder(fr.lelouet.tools.holders.interfaces.collections.ListHolder) Location(fr.guiguilechat.jcelechat.jcesi.tools.locations.Location) Material(fr.guiguilechat.jcelechat.model.sde.load.fsd.Eblueprints.Material) CacheStatic(fr.guiguilechat.jcelechat.jcesi.disconnected.CacheStatic) Collectors(java.util.stream.Collectors) File(java.io.File) R_get_loyalty_stores_corporation_id_offers(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_loyalty_stores_corporation_id_offers) AGENT_TYPE(fr.guiguilechat.jcelechat.model.sde.npcs.Agent.AGENT_TYPE) Eagents(fr.guiguilechat.jcelechat.model.sde.load.fsd.Eagents) Requested(fr.guiguilechat.jcelechat.jcesi.interfaces.Requested) Stream(java.util.stream.Stream) R_get_corporations_corporation_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_corporations_corporation_id) Entry(java.util.Map.Entry) EnpcCorporations(fr.guiguilechat.jcelechat.model.sde.load.fsd.EnpcCorporations) Comparator(java.util.Comparator) Collections(java.util.Collections) EtypeIDs(fr.guiguilechat.jcelechat.model.sde.load.fsd.EtypeIDs) Requested(fr.guiguilechat.jcelechat.jcesi.interfaces.Requested) R_get_corporations_corporation_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_corporations_corporation_id) R_get_loyalty_stores_corporation_id_offers(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_loyalty_stores_corporation_id_offers) R_get_universe_stations_station_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_stations_station_id) ListHolder(fr.lelouet.tools.holders.interfaces.collections.ListHolder) R_get_universe_factions(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_factions) CacheStatic(fr.guiguilechat.jcelechat.jcesi.disconnected.CacheStatic) EnpcCorporations(fr.guiguilechat.jcelechat.model.sde.load.fsd.EnpcCorporations) LPOffer(fr.guiguilechat.jcelechat.model.sde.npcs.LPOffer) Agent(fr.guiguilechat.jcelechat.model.sde.npcs.Agent) Corporation(fr.guiguilechat.jcelechat.model.sde.npcs.Corporation) ESIAccess(fr.guiguilechat.jcelechat.jcesi.disconnected.modeled.ESIAccess) Eagents(fr.guiguilechat.jcelechat.model.sde.load.fsd.Eagents) Location(fr.guiguilechat.jcelechat.jcesi.tools.locations.Location)

Example 4 with MapHolder

use of fr.lelouet.tools.holders.interfaces.collections.MapHolder in project JCELechat by guiguilechat.

the class ESILoader method load.

public static TypeHierarchy load() {
    TypeHierarchy ret = new TypeHierarchy();
    // 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());
    for (Entry<Integer, R_get_universe_categories_category_id> e : catMap.get().entrySet()) {
        CatDetails det = new CatDetails();
        det.id = e.getKey();
        det.name = e.getValue().name;
        det.published = e.getValue().published;
        ret.catID2Details.put(e.getKey(), det);
        ret.catID2GroupIDs.put(det.id, new HashSet<>());
    }
    for (Entry<Integer, R_get_universe_groups_group_id> e : groupMap.get().entrySet()) {
        GroupDetails det = new GroupDetails();
        det.id = e.getKey();
        det.catID = e.getValue().category_id;
        det.name = e.getValue().name;
        det.published = e.getValue().published;
        ret.groupID2Details.put(e.getKey(), det);
        ret.groupID2TypeIDs.put(det.id, new HashSet<>());
        ret.catID2GroupIDs.computeIfAbsent(e.getValue().category_id, i -> new HashSet<>()).add(e.getKey());
    }
    // types and their attributes
    HashSet<Integer> floatAttributeIds = new HashSet<>();
    HashSet<Integer> allAttributesIds = new HashSet<>();
    for (Entry<Integer, R_get_universe_types_type_id> e : typeMap.get().entrySet()) {
        TypeDetails det = new TypeDetails();
        det.name = e.getValue().name;
        det.id = e.getKey();
        // TODO
        // det.basePrice = e.getValue().;
        det.marketGroupID = e.getValue().market_group_id;
        det.groupID = e.getValue().group_id;
        det.mass = e.getValue().mass;
        det.packagedVolume = e.getValue().packaged_volume;
        det.published = e.getValue().published;
        det.portionSize = e.getValue().portion_size;
        det.volume = e.getValue().volume;
        ret.typeID2Details.put(e.getKey(), det);
        ret.groupID2TypeIDs.computeIfAbsent(det.groupID, i -> new HashSet<>()).add(e.getKey());
        if (e.getValue().dogma_attributes != null) {
            for (get_dogma_dynamic_items_type_id_item_id_dogma_attributes attribute : e.getValue().dogma_attributes) {
                if (attribute.attribute_id == 161) {
                    det.volume = attribute.value;
                } else if (attribute.attribute_id == 4) {
                    det.mass = attribute.value;
                } else {
                    int attId = attribute.attribute_id;
                    float floatValue = attribute.value;
                    det.definition.put(attId, floatValue);
                    if ((int) floatValue != floatValue) {
                        floatAttributeIds.add(attId);
                    }
                    allAttributesIds.add(attId);
                }
            }
        }
    }
    for (int attId : allAttributesIds) {
        R_get_dogma_attributes_attribute_id eattr = attMap.get().get(attId);
        AttributeDetails det = new AttributeDetails();
        det.defaultValue = eattr.default_value;
        det.description = eattr.description;
        det.hasFloat = floatAttributeIds.contains(attId);
        det.highIsGood = eattr.high_is_good;
        det.id = attId;
        det.name = eattr.name;
        det.published = eattr.published;
        det.stackable = eattr.stackable;
        ret.attID2Details.put(attId, det);
    }
    return ret;
}
Also used : Logger(org.slf4j.Logger) 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) LoggerFactory(org.slf4j.LoggerFactory) fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.get_dogma_dynamic_items_type_id_item_id_dogma_attributes(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.get_dogma_dynamic_items_type_id_item_id_dogma_attributes) TypeDetails(fr.guiguilechat.jcelechat.model.sde.hierarchy.TypeDetails) ESIStatic(fr.guiguilechat.jcelechat.jcesi.disconnected.ESIStatic) MapHolder(fr.lelouet.tools.holders.interfaces.collections.MapHolder) HashSet(java.util.HashSet) Universe(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.disconnected.Universe) CatDetails(fr.guiguilechat.jcelechat.model.sde.hierarchy.CatDetails) GroupDetails(fr.guiguilechat.jcelechat.model.sde.hierarchy.GroupDetails) Entry(java.util.Map.Entry) Dogma(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.disconnected.Dogma) TypeHierarchy(fr.guiguilechat.jcelechat.model.sde.hierarchy.TypeHierarchy) AttributeDetails(fr.guiguilechat.jcelechat.model.sde.hierarchy.AttributeDetails) R_get_dogma_attributes_attribute_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_dogma_attributes_attribute_id) 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_types_type_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_types_type_id) TypeDetails(fr.guiguilechat.jcelechat.model.sde.hierarchy.TypeDetails) AttributeDetails(fr.guiguilechat.jcelechat.model.sde.hierarchy.AttributeDetails) HashSet(java.util.HashSet) R_get_universe_groups_group_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_groups_group_id) fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.get_dogma_dynamic_items_type_id_item_id_dogma_attributes(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.get_dogma_dynamic_items_type_id_item_id_dogma_attributes) Universe(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.disconnected.Universe) CatDetails(fr.guiguilechat.jcelechat.model.sde.hierarchy.CatDetails) R_get_dogma_attributes_attribute_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_dogma_attributes_attribute_id) GroupDetails(fr.guiguilechat.jcelechat.model.sde.hierarchy.GroupDetails) TypeHierarchy(fr.guiguilechat.jcelechat.model.sde.hierarchy.TypeHierarchy) R_get_universe_categories_category_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_categories_category_id)

Example 5 with MapHolder

use of fr.lelouet.tools.holders.interfaces.collections.MapHolder 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)

Aggregations

MapHolder (fr.lelouet.tools.holders.interfaces.collections.MapHolder)6 ESIStatic (fr.guiguilechat.jcelechat.jcesi.disconnected.ESIStatic)4 R_get_universe_types_type_id (fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_types_type_id)4 Map (java.util.Map)4 Entry (java.util.Map.Entry)4 CacheStatic (fr.guiguilechat.jcelechat.jcesi.disconnected.CacheStatic)2 Dogma (fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.disconnected.Dogma)2 Universe (fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.disconnected.Universe)2 R_get_dogma_attributes_attribute_id (fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_dogma_attributes_attribute_id)2 R_get_universe_categories_category_id (fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_categories_category_id)2 R_get_universe_groups_group_id (fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_groups_group_id)2 fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.get_dogma_dynamic_items_type_id_item_id_dogma_attributes (fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.get_dogma_dynamic_items_type_id_item_id_dogma_attributes)2 EtypeIDs (fr.guiguilechat.jcelechat.model.sde.load.fsd.EtypeIDs)2 ListHolder (fr.lelouet.tools.holders.interfaces.collections.ListHolder)2 Collectors (java.util.stream.Collectors)2 LoggerFactory (org.slf4j.LoggerFactory)2 ESITools (fr.guiguilechat.jcelechat.jcesi.ESITools)1 Assets (fr.guiguilechat.jcelechat.jcesi.connected.modeled.character.Assets)1 Attributes (fr.guiguilechat.jcelechat.jcesi.connected.modeled.character.Attributes)1 CharBookmarks (fr.guiguilechat.jcelechat.jcesi.connected.modeled.character.CharBookmarks)1