Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions app/src/main/java/de/twonirwana/infinity/ExportAll.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
public class ExportAll {

static void main() {
// Database db = DatabaseImp.createWithoutUpdate("resources");
Database db = DatabaseImp.createTimedUpdate();
Database db = DatabaseImp.createWithoutUpdate("resources");


//Database db = DatabaseImp.createTimedUpdate();


HtmlPrinter htmlPrinter = new HtmlPrinter(LocalDateTime::now);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void setup() {
new ExtraValue(3, "extra distance", ExtraValue.Type.Distance, 10f)
)
));
TrooperProfile trooperProfile = new TrooperProfile(sectorial, 1, 2, 3, 4, "name", List.of(10, 10), 10, 10, 10, 10, 3, 3, 2, false, 2, "notes", "type", 3, weapons, skills, equipments, List.of("char1", "char2"), "logo.png", List.of("image.png"), List.of(new Order(Order.Type.REGULAR, 0, 1)));
TrooperProfile trooperProfile = new TrooperProfile(sectorial, 1, 2, 3, 4, "name", List.of(10, 10), 10, 10, 10, 10, 3, 3, 2, false, 2, "notes", "type", 3, weapons, skills, equipments, List.of("char1", "char2"), "logo.png", List.of("image.png"), List.of("box 1"), List.of(new Order(Order.Type.REGULAR, 0, 1)));
Trooper trooper = new Trooper(sectorial, 1, 2, 3, "optionName", "category", "0.5", 20, List.of(trooperProfile), List.of(), "note", "groupNote");
martialArtLevels = List.of(new MartialArtLevel("-3", "-", "+3", "3", "+1SD"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public class TrooperProfile {
@NonNull
List<String> imageNames;
@NonNull
List<String> products;
@NonNull
List<Order> orders;

public String getCombinedProfileId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public static void printList(String name, List<UnitOption> printableUnits) {
"MOV", "CC", "BS", "PH", "WIP", "ARM", "BTS", "Wounds", "Silhouette", "Orders", "AVA",
"Points", "SWC",
"Skills", "Equipment", "Weapons", "Characteristics",
"CB Image"
};

try {
Expand Down Expand Up @@ -114,8 +113,8 @@ private static void printUnitOptionProfile(CSVPrinter csvPrinter, UnitOption uni
equipment,
weapons,
String.join(", ", profile.getCharacteristics()),
!profile.getImageNames().isEmpty()

String.join(", ", profile.getImageNames()),
String.join(", ", profile.getProducts())
);
} catch (IOException e) {
throw new RuntimeException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public DataLoader(UpdateOption updateOption, String resourcesFolder) throws IOEx
.sorted(Comparator.comparing(UnitOption::getCombinedId))
.toList();

CsvPrinter.printList(DATE_TIME_FORMATTER.format(LocalDateTime.now()) + "_" + unitOptions.hashCode(), unitOptions);
CsvPrinter.printList(DATE_TIME_FORMATTER.format(LocalDateTime.now()) + "_" + unitOptions.toString().hashCode(), unitOptions);
}
//todo ref image
}
Expand Down Expand Up @@ -412,7 +412,7 @@ private static Optional<BufferedInputStream> getStreamForURL(String urlString) {
urlConnection.setRequestProperty("Referer", "https://infinityuniverse.com/");
return Optional.of(new BufferedInputStream(urlConnection.getInputStream()));
} catch (Exception e) {
log.error("Error downloading {}: {}", urlString, e.getMessage());
log.error("Error downloading: {}", urlString, e);
return Optional.empty();
}
}
Expand Down
26 changes: 24 additions & 2 deletions data/core/src/main/java/de/twonirwana/infinity/db/UnitMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import de.twonirwana.infinity.Sectorial;
import de.twonirwana.infinity.model.*;
import de.twonirwana.infinity.model.image.ImgOption;
import de.twonirwana.infinity.model.image.Product;
import de.twonirwana.infinity.model.image.SectorialImage;
import de.twonirwana.infinity.model.unit.*;
import de.twonirwana.infinity.unit.api.ExtraValue;
Expand Down Expand Up @@ -88,7 +89,6 @@ public static Map<Sectorial, List<UnitOption>> getUnits(Map<Sectorial, Sectorial
).stream())
: Stream.empty()
)

.toList()
));
}
Expand Down Expand Up @@ -483,6 +483,7 @@ public static de.twonirwana.infinity.unit.api.Weapon mapWeapon(Weapon weapon, In
weapon.getSavingNum(),
Optional.ofNullable(weapon.getProperties()).orElse(List.of()).stream()
.filter(Objects::nonNull)
.sorted()
.toList(),
getUpToRangeModi(weapon.getDistance(), 20),
getUpToRangeModi(weapon.getDistance(), 40),
Expand All @@ -495,6 +496,7 @@ public static de.twonirwana.infinity.unit.api.Weapon mapWeapon(Weapon weapon, In
quantity,
Optional.ofNullable(extras).orElse(List.of()).stream()
.filter(Objects::nonNull)
.sorted(Comparator.comparing(ExtraValue::getId))
.toList()
);
}
Expand Down Expand Up @@ -525,6 +527,7 @@ private static List<de.twonirwana.infinity.unit.api.Skill> getUnitSkills(Unit un
List<ExtraValue> extras = Optional.ofNullable(pi.getExtra()).stream()
.flatMap(Collection::stream)
.map(extraFilter::get)
.sorted(Comparator.comparing(ExtraValue::getId))
.toList();
if (s != null) {
return Stream.of(s).map(skill -> mapSkill(skill, pi.getQ(), extras));
Expand All @@ -550,6 +553,7 @@ private static de.twonirwana.infinity.unit.api.Skill mapSkill(Skill skill, Integ
quantity, // quantity is always null or 1
extras.stream()
.filter(Objects::nonNull)
.sorted(Comparator.comparing(ExtraValue::getId))
.toList()
);
}
Expand All @@ -570,6 +574,7 @@ private static List<de.twonirwana.infinity.unit.api.Equipment> getUnitEquipments
List<ExtraValue> extras = Optional.ofNullable(pi.getExtra()).stream()
.flatMap(Collection::stream)
.map(extraFilter::get)
.sorted(Comparator.comparing(ExtraValue::getId))
.toList();
if (e != null) {
return Stream.of(e).map(equip -> mapEquipment(equip, pi.getQ(), extras));
Expand All @@ -595,6 +600,7 @@ private static de.twonirwana.infinity.unit.api.Equipment mapEquipment(Equipment
quantity,
extras.stream()
.filter(Objects::nonNull)
.sorted(Comparator.comparing(ExtraValue::getId))
.toList()
);
}
Expand Down Expand Up @@ -642,16 +648,28 @@ private static TrooperProfile getOptionProfile(Sectorial sectorial,
sectorial.getName());
String type = sectorialFilter.typeFilter().get(profile.getType());
List<String> characteristics = getUnitCharacteristics(profileOption, profile, sectorialFilter.characteristicsFilter());
List<String> imageNames = sectorialImage.getUnits().stream()

List<ImgOption> imgOptions = sectorialImage.getUnits().stream()
.filter(u -> u.getId() == unit.getId())
.flatMap(u -> u.getProfileGroups().stream())
.filter(pg -> pg.getId() == profileGroupId)
.flatMap(pg -> pg.getImgOptions().stream())
.filter(io -> io.getOptions().contains(profileOption.getId()))
.toList();

List<String> imageNames = imgOptions.stream()
.map(ImgOption::getUrl)
.map(Utils::getFileNameFromUrl)
.filter(Objects::nonNull)
.sorted()
.toList();

List<String> products = imgOptions.stream()
.flatMap(s -> s.getProducts().stream())
.map(Product::getName)
.sorted()
.toList();

List<de.twonirwana.infinity.unit.api.Order> orders = profileOption.getOrders().stream()
.map(UnitMapper::mapOrder)
.sorted(Comparator.comparing(de.twonirwana.infinity.unit.api.Order::getType))
Expand Down Expand Up @@ -683,6 +701,7 @@ private static TrooperProfile getOptionProfile(Sectorial sectorial,
characteristics,
Utils.getFileNameFromUrl(profile.getLogo()),
imageNames,
products,
orders);
}

Expand Down Expand Up @@ -820,11 +839,13 @@ private static List<Weapon> mapTurrets(Unit unit, List<Weapon> turretWeapons, Li
String turretName = extra2WeaponModeNameMapping.getOrDefault(turretTypeExtra.get().getText(), turretTypeExtra.get().getText());
List<Weapon> turrets = turretWeapons.stream()
.filter(w -> Objects.equals(w.getMode(), turretName))
.sorted(Comparator.comparing(Weapon::getName))
.toList();
//fallback to all weapons
if (turrets.isEmpty()) {
turrets = allWeapons.stream()
.filter(w -> Objects.equals(w.getName(), turretName))
.sorted(Comparator.comparing(Weapon::getName))
.toList();
}
if (turrets.isEmpty()) {
Expand All @@ -844,6 +865,7 @@ private static List<Weapon> mapTurrets(Unit unit, List<Weapon> turretWeapons, Li
//use only base version
return turretWeapons.stream()
.filter(w -> Strings.isNullOrEmpty(w.getMode()))
.sorted(Comparator.comparing(Weapon::getName))
.toList();
}
}
Expand Down
Binary file modified web/playwright/expected/chromium_a4_image_expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified web/playwright/expected/chromium_a4_overview_expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified web/playwright/expected/chromium_a7_image_expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified web/playwright/expected/chromium_c6onA4_image_expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified web/playwright/expected/chromium_letter_image_expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified web/playwright/expected/firefox_a4_image_expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified web/playwright/expected/firefox_a4_overview_expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified web/playwright/expected/firefox_a7_image_expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified web/playwright/expected/firefox_c6onA4_image_expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified web/playwright/expected/firefox_letter_image_expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified web/playwright/expected/webkit_a4_image_expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified web/playwright/expected/webkit_a4_overview_expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified web/playwright/expected/webkit_a7_image_expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified web/playwright/expected/webkit_c6onA4_image_expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified web/playwright/expected/webkit_letter_image_expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading