Search in sources :

Example 1 with R_get_dogma_effects_effect_id

use of fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_dogma_effects_effect_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

ESIStatic (fr.guiguilechat.jcelechat.jcesi.disconnected.ESIStatic)1 R_get_dogma_attributes_attribute_id (fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_dogma_attributes_attribute_id)1 R_get_dogma_effects_effect_id (fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_dogma_effects_effect_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 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)1 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)1 Unit (fr.guiguilechat.jcelechat.model.sde.meta.Unit)1 ObjHolder (fr.lelouet.tools.holders.interfaces.ObjHolder)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 IntStream (java.util.stream.IntStream)1 Stream (java.util.stream.Stream)1