use of fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_groups_group_id in project JCELechat by guiguilechat.
the class ShowTank method showGroup.
public static void showGroup(String nameFilter, int... groupIds) {
// preload the group
IntStream.of(groupIds).parallel().flatMap(groupId -> IntStream.of(ESIStatic.INSTANCE.cache().universe.groups(groupId).get().types)).forEach(i -> ESIStatic.INSTANCE.cache().universe.types(i));
System.out.println("name\tid\tgroup\tEMEHP\tTHEHP\tKIEHP\tEXEHP");
for (int groupId : groupIds) {
R_get_universe_groups_group_id group = ESIStatic.INSTANCE.cache().universe.groups(groupId).get();
for (int typeId : group.types) {
showEntity(nameFilter, typeId);
}
}
}
use of fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_groups_group_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));
}
use of fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_groups_group_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);
}
}
use of fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_groups_group_id in project JCELechat by guiguilechat.
the class ShowAttributes method showGroups.
public static void showGroups(String nameFilter, int... groupids) {
IntStream.of(groupids).parallel().flatMap(gid -> IntStream.of(ESIStatic.INSTANCE.cache().universe.groups(gid).get().types)).forEach(tid -> ESIStatic.INSTANCE.cache().universe.types(tid));
for (int groupId : groupids) {
R_get_universe_groups_group_id group = ESIStatic.INSTANCE.cache().universe.groups(groupId).get();
for (int typeId : group.types) {
R_get_universe_types_type_id type = ESIStatic.INSTANCE.cache().universe.types(typeId).get();
if (nameFilter != null && !type.name.matches(nameFilter)) {
continue;
}
showEntity(type, (String[]) null);
}
}
}
use of fr.guiguilechat.jcelechat.model.jcesi.compiler.compiled.responses.R_get_universe_groups_group_id in project JCELechat by guiguilechat.
the class ShowBestKinTankInGroup method showTankGroup.
public static void showTankGroup(int groupId) {
R_get_universe_groups_group_id group = ESIStatic.INSTANCE.cache().universe.groups(groupId).get();
System.out.println("group " + group.name);
Map<R_get_universe_types_type_id, Double> map = IntStream.of(group.types).mapToObj(i -> ESIStatic.INSTANCE.cache().universe.types(i).get()).parallel().collect(Collectors.toMap(entity -> entity, ShowBestKinTankInGroup::getKinEVHPType));
ArrayList<Entry<R_get_universe_types_type_id, Double>> list = new ArrayList<>(map.entrySet());
Collections.sort(list, (e1, e2) -> e1.getValue().compareTo(e2.getValue()));
for (Entry<R_get_universe_types_type_id, Double> e : list) {
System.out.println("\t" + e.getKey().name + "\t" + e.getValue());
}
}
Aggregations