Search in sources :

Example 1 with R_get_universe_types_type_id

use of fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_types_type_id in project JCELechat by guiguilechat.

the class TypeAttributesController method attribute.

@RequestMapping(value = "/attribute/{attId}", produces = MediaType.APPLICATION_XML_VALUE)
public String attribute(@PathVariable int attId, int... typeIds) {
    R_get_dogma_attributes_attribute_id attr = ESIStatic.INSTANCE.cache().dogma.attributes(attId).get();
    if (attr == null) {
        return "invalid attribute";
    }
    if (typeIds != null) {
        for (int typeId : typeIds) {
            ESIStatic.INSTANCE.cache().universe.types(typeId);
        }
    }
    StringBuilder sb = new StringBuilder("<attribute id=\"" + attId + "\" name=\"" + attr.name + "\">\n");
    if (typeIds != null) {
        for (int typeId : typeIds) {
            float value = attr.default_value;
            R_get_universe_types_type_id type = ESIStatic.INSTANCE.cache().universe.types(typeId).get();
            if (type != null && type.dogma_attributes != null) {
                for (get_dogma_dynamic_items_type_id_item_id_dogma_attributes att : type.dogma_attributes) {
                    if (att.attribute_id == attId) {
                        value = att.value;
                        break;
                    }
                }
            }
            sb.append("<type id=\"" + typeId + "\">").append("<value>").append(value).append("</value></type>\n");
        }
    }
    sb.append("</attribute>");
    return sb.toString();
}
Also used : 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) R_get_universe_types_type_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_types_type_id) R_get_dogma_attributes_attribute_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_dogma_attributes_attribute_id) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with R_get_universe_types_type_id

use of fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_types_type_id in project JCELechat by guiguilechat.

the class ShowTank method showEntity.

public static void showEntity(String nameFilter, int typeId) {
    R_get_universe_types_type_id type = ESIStatic.INSTANCE.cache().universe.types(typeId).get();
    if (nameFilter != null && !type.name.matches(nameFilter)) {
        return;
    }
    R_get_universe_groups_group_id group = ESIStatic.INSTANCE.cache().universe.groups(type.group_id).get();
    Map<Integer, Double> attIdToValue = Stream.of(type.dogma_attributes != null ? type.dogma_attributes : new get_dogma_dynamic_items_type_id_item_id_dogma_attributes[0]).collect(Collectors.toMap(att -> att.attribute_id, att -> (double) att.value));
    // shield
    double shieldEMResonnance = attIdToValue.getOrDefault(271, 1.0);
    double shieldTHResonnance = attIdToValue.getOrDefault(274, 1.0);
    double shieldKIResonnance = attIdToValue.getOrDefault(273, 1.0);
    double shieldEXResonnance = attIdToValue.getOrDefault(272, 1.0);
    double shieldHP = attIdToValue.getOrDefault(263, 0.0);
    // armor
    double armorEMResonnance = attIdToValue.getOrDefault(267, 1.0);
    double armorTHResonnance = attIdToValue.getOrDefault(270, 1.0);
    double armorKIResonnance = attIdToValue.getOrDefault(269, 1.0);
    double armorEXResonnance = attIdToValue.getOrDefault(268, 1.0);
    double armorHP = attIdToValue.getOrDefault(265, 0.0);
    // hull
    double hullEMResonnance = attIdToValue.getOrDefault(113, 1.0);
    double hullTHResonnance = attIdToValue.getOrDefault(110, 1.0);
    double hullKIResonnance = attIdToValue.getOrDefault(109, 1.0);
    double hullEXResonnance = attIdToValue.getOrDefault(111, 1.0);
    double hullHP = attIdToValue.getOrDefault(9, 0.0);
    // total ehp
    double EMEHP = shieldHP / shieldEMResonnance + armorHP / armorEMResonnance + hullHP / hullEMResonnance;
    double THEHP = shieldHP / shieldTHResonnance + armorHP / armorTHResonnance + hullHP / hullTHResonnance;
    double KIEHP = shieldHP / shieldKIResonnance + armorHP / armorKIResonnance + hullHP / hullKIResonnance;
    double EXEHP = shieldHP / shieldEXResonnance + armorHP / armorEXResonnance + hullHP / hullEXResonnance;
    System.out.println(type.name + "\t" + typeId + "\t" + group.name + "\t" + nf.format(EMEHP) + "\t" + nf.format(THEHP) + "\t" + nf.format(KIEHP) + "\t" + nf.format(EXEHP));
}
Also used : IntStream(java.util.stream.IntStream) Stream(java.util.stream.Stream) DecimalFormatSymbols(java.text.DecimalFormatSymbols) Locale(java.util.Locale) R_get_universe_types_type_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_types_type_id) Map(java.util.Map) DecimalFormat(java.text.DecimalFormat) 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) ESIStatic(fr.guiguilechat.jcelechat.jcesi.disconnected.ESIStatic) Collectors(java.util.stream.Collectors) R_get_universe_groups_group_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_groups_group_id) 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)

Example 3 with R_get_universe_types_type_id

use of fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_types_type_id in project JCELechat by guiguilechat.

the class TypeGrouper method semantic.

public int semantic(int typeid) {
    if (!semantics.containsKey(typeid)) {
        synchronized (semantics) {
            if (!semantics.containsKey(typeid)) {
                R_get_universe_types_type_id type = access.universe.types(typeid).get();
                R_get_universe_types_type_id sem = semantic(type);
                semantics.put(typeid, sem.type_id);
                return sem.type_id;
            }
        }
    }
    return semantics.get(typeid);
}
Also used : R_get_universe_types_type_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_types_type_id)

Example 4 with R_get_universe_types_type_id

use of fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_types_type_id in project JCELechat by guiguilechat.

the class TypeGrouper method semantic.

private R_get_universe_types_type_id semantic(R_get_universe_types_type_id type) {
    // replace a bp by its type
    R_get_universe_types_type_id product = type;
    if (BPGROUPS.contains(type.group_id)) {
        fr.guiguilechat.jcelechat.model.sde.industry.Blueprint bp = fr.guiguilechat.jcelechat.model.sde.industry.Blueprint.of(type.type_id);
        product = access.universe.types(bp.manufacturing.products.get(0).id).get();
    }
    Map<Integer, Double> atts = new HashMap<>();
    atts.put(0, (double) product.group_id);
    if (product.dogma_attributes == null) {
        atts.put(-1, (double) product.type_id);
    } else {
        for (get_dogma_dynamic_items_type_id_item_id_dogma_attributes att : product.dogma_attributes) {
            atts.put(att.attribute_id, (double) att.value);
        }
    }
    Set<R_get_universe_types_type_id> set = semantic2Types.computeIfAbsent(atts, o -> new LinkedHashSet<>());
    set.add(type);
    return set.iterator().next();
}
Also used : HashMap(java.util.HashMap) 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) R_get_universe_types_type_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_types_type_id)

Example 5 with R_get_universe_types_type_id

use of fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_types_type_id in project JCELechat by guiguilechat.

the class ShowAttributes method showEntity.

public static void showEntity(R_get_universe_types_type_id type, String... filters) {
    R_get_universe_groups_group_id group = ESIStatic.INSTANCE.cache().universe.groups(type.group_id).get();
    R_get_universe_categories_category_id cat = ESIStatic.INSTANCE.cache().universe.categories(group.category_id).get();
    System.out.println(type.name + "(" + type.type_id + ") group=" + group.name + "(" + group.group_id + ") category=" + cat.name + "(" + cat.category_id + ")");
    Set<Integer> usedAttIds = new HashSet<>();
    Map<Integer, Float> attIdToValue = Stream.of(type.dogma_attributes != null ? type.dogma_attributes : new get_dogma_dynamic_items_type_id_item_id_dogma_attributes[0]).collect(Collectors.toMap(att -> att.attribute_id, att -> att.value));
    if (type.dogma_effects != null) {
        List<ObjHolder<R_get_dogma_effects_effect_id>> effects = Stream.of(type.dogma_effects).map(eff -> ESIStatic.INSTANCE.cache().dogma.effects(eff.effect_id)).collect(Collectors.toList());
        for (ObjHolder<R_get_dogma_effects_effect_id> h : effects) {
            R_get_dogma_effects_effect_id e = h.get();
            if (filters != null && filters.length != 0) {
                // effect.
                if (Stream.of(filters).filter(filter -> !e.name.toLowerCase().contains(filter.toLowerCase())).findAny().isPresent()) {
                    continue;
                }
            }
            System.out.print("\t" + e.name + "(" + e.effect_id + ")" + "category=" + e.effect_category + " " + e.description);
            List<String> flags = new ArrayList<>();
            if (e.disallow_auto_repeat) {
                flags.add("disallow_auto_repeat");
            }
            if (e.electronic_chance) {
                flags.add("electronic_chance");
            }
            if (e.is_assistance) {
                flags.add("is_assistance");
            }
            if (e.is_offensive) {
                flags.add("is_offensive");
            }
            if (e.is_warp_safe) {
                flags.add("is_warp_safe");
            }
            if (e.range_chance) {
                flags.add("range_chance");
            }
            if (!flags.isEmpty()) {
                System.out.println("[" + flags.stream().collect(Collectors.joining("|")) + "]");
            } else {
                System.out.println();
            }
            if (e.modifiers != null && e.modifiers.length != 0) {
                for (get_dogma_effects_effect_id_modifiers m : e.modifiers) {
                    if (m.modified_attribute_id != 0 && m.modifying_attribute_id != 0) {
                        R_get_dogma_attributes_attribute_id modified = ESIStatic.INSTANCE.cache().dogma.attributes(m.modified_attribute_id).get();
                        usedAttIds.add(m.modifying_attribute_id);
                        System.out.println("\t\t\t" + m.func + " : " + m.domain + "." + modified.display_name + " " + getOperator(m.operator) + " " + getAttValue(attIdToValue, m.modifying_attribute_id));
                    }
                }
            }
            if (e.range_attribute_id != 0) {
                usedAttIds.add(e.range_attribute_id);
                System.out.println("\t\trange(" + e.range_attribute_id + ")=" + printAttValue(attIdToValue, e.range_attribute_id));
            }
            if (e.falloff_attribute_id != 0) {
                usedAttIds.add(e.falloff_attribute_id);
                System.out.println("\t\tfalloff(" + e.falloff_attribute_id + ")=" + printAttValue(attIdToValue, e.falloff_attribute_id));
            }
            if (e.tracking_speed_attribute_id != 0) {
                usedAttIds.add(e.tracking_speed_attribute_id);
                System.out.println("\t\ttracking speed(" + e.tracking_speed_attribute_id + ")=" + printAttValue(attIdToValue, e.tracking_speed_attribute_id));
            }
            if (e.duration_attribute_id != 0) {
                usedAttIds.add(e.duration_attribute_id);
                System.out.println("\t\tduration(" + e.duration_attribute_id + ")=" + printAttValue(attIdToValue, e.duration_attribute_id));
            }
            if (e.discharge_attribute_id != 0) {
                usedAttIds.add(e.discharge_attribute_id);
                System.out.println("\t\tdischarge(" + e.discharge_attribute_id + ")=" + printAttValue(attIdToValue, e.discharge_attribute_id));
            }
            if (e.pre_expression != 0) {
                System.out.println("\t\tpre=" + e.pre_expression);
            }
            if (e.post_expression != 0) {
                System.out.println("\t\tpost=" + e.post_expression);
            }
        }
    }
    if (type.dogma_attributes != null) {
        Stream.of(type.dogma_attributes).sorted((a1, a2) -> a1.attribute_id - a2.attribute_id).parallel().map(att -> {
            R_get_dogma_attributes_attribute_id dogattr = ESIStatic.INSTANCE.cache().dogma.attributes(att.attribute_id).get();
            if (filters != null) {
                for (String filter : filters) {
                    if (filter != null && !dogattr.name.toLowerCase().contains(filter.toLowerCase())) {
                        return null;
                    }
                }
            }
            if (usedAttIds.contains(att.attribute_id)) {
                return null;
            }
            return "\t" + dogattr.name + "(" + att.attribute_id + ")=" + printAttValue(attIdToValue, att.attribute_id);
        }).filter(s -> s != null).forEachOrdered(System.out::println);
    }
}
Also used : IntStream(java.util.stream.IntStream) R_get_dogma_effects_effect_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_dogma_effects_effect_id) ObjHolder(fr.lelouet.tools.holders.interfaces.ObjHolder) 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) 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) Set(java.util.Set) ESIStatic(fr.guiguilechat.jcelechat.jcesi.disconnected.ESIStatic) fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.get_dogma_effects_effect_id_modifiers(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.get_dogma_effects_effect_id_modifiers) Unit(fr.guiguilechat.jcelechat.model.sde.meta.Unit) Collectors(java.util.stream.Collectors) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) List(java.util.List) Stream(java.util.stream.Stream) Map(java.util.Map) 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) R_get_universe_groups_group_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_groups_group_id) ArrayList(java.util.ArrayList) fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.get_dogma_effects_effect_id_modifiers(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.get_dogma_effects_effect_id_modifiers) R_get_dogma_effects_effect_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_dogma_effects_effect_id) R_get_dogma_attributes_attribute_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_dogma_attributes_attribute_id) ObjHolder(fr.lelouet.tools.holders.interfaces.ObjHolder) R_get_universe_categories_category_id(fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_categories_category_id) HashSet(java.util.HashSet)

Aggregations

R_get_universe_types_type_id (fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_types_type_id)19 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)13 R_get_universe_groups_group_id (fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_groups_group_id)11 ESIStatic (fr.guiguilechat.jcelechat.jcesi.disconnected.ESIStatic)8 Collectors (java.util.stream.Collectors)8 IntStream (java.util.stream.IntStream)8 R_get_dogma_attributes_attribute_id (fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_dogma_attributes_attribute_id)7 R_get_universe_categories_category_id (fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_categories_category_id)7 Map (java.util.Map)7 HashSet (java.util.HashSet)6 List (java.util.List)6 ArrayList (java.util.ArrayList)5 Stream (java.util.stream.Stream)5 ObjHolder (fr.lelouet.tools.holders.interfaces.ObjHolder)4 Entry (java.util.Map.Entry)4 Set (java.util.Set)4 MapHolder (fr.lelouet.tools.holders.interfaces.collections.MapHolder)3 HashMap (java.util.HashMap)3 CacheStatic (fr.guiguilechat.jcelechat.jcesi.disconnected.CacheStatic)2 ESIAccess (fr.guiguilechat.jcelechat.jcesi.disconnected.modeled.ESIAccess)2