From 841ad18e8e29ff9ffc6e2086baf7e0bd99585a1e Mon Sep 17 00:00:00 2001 From: xdnw Date: Tue, 28 May 2024 18:16:46 +0100 Subject: [PATCH 1/3] Update GuildHandler.java --- .../link/locutus/discord/db/GuildHandler.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/main/java/link/locutus/discord/db/GuildHandler.java b/src/main/java/link/locutus/discord/db/GuildHandler.java index e4e7ec74..19b56680 100644 --- a/src/main/java/link/locutus/discord/db/GuildHandler.java +++ b/src/main/java/link/locutus/discord/db/GuildHandler.java @@ -1857,22 +1857,20 @@ public Boolean apply(IMessageBuilder msg) { tips.add("Deposit your excess money in the bank or it will be stolen: " + bankUrl + " (only $" + MathMan.format(unraidable) + " is unraidable)"); } if (faRole != null) { - tips.add("Please ping @\u200B" + faRole.getName() + " to get help negotiating peace"); + String enemyStr = "(Or mark as enemy " + CM.coalition.create.cmd.create(attacker.getAlliance_id() + "", "enemies") + ")"; + tips.add("Please ping @\u200B" + faRole.getName() + " to get help negotiating peace. " + (attacker.al)); } if (milcomRole != null) { tips.add("Please ping @\u200B" + milcomRole.getName() + " to get military advice"); } } - Map defCities = defender.getCityMap(false, false); - if (attacker.getSoldiers() > defender.getSoldiers()) { - for (JavaCity value : defCities.values()) { - if (value.getBuilding(Buildings.BARRACKS) != 5) { - tips.add("Buy max barracks and soldiers (you may need to sell off some mines)"); - break; - } - } + if (defender.getMMRBuildingArr()[0] <= 4) { + tips.add("Buy max barracks and soldiers (you may need to sell off some mines)"); + } else if (defender.getSoldierPct() < 0.8) { + tips.add("Buy more soldiers to help defend yourself"); } if (attacker.getShips() > 0 && defender.getShips() == 0 && defender.getAvg_infra() >= 1450 && defender.getAircraft() > attacker.getAircraft()) { + Map defCities = defender.getCityMap(false, false); boolean hasDock = false; for (JavaCity value : defCities.values()) { if (value.getBuilding(Buildings.DRYDOCK) != 0) { From 77d084414f12f8353aa2c92a0d4e1ca2ac132d09 Mon Sep 17 00:00:00 2001 From: xdnw Date: Tue, 28 May 2024 18:17:52 +0100 Subject: [PATCH 2/3] Update GuildHandler.java --- src/main/java/link/locutus/discord/db/GuildHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/link/locutus/discord/db/GuildHandler.java b/src/main/java/link/locutus/discord/db/GuildHandler.java index 19b56680..844f1a5b 100644 --- a/src/main/java/link/locutus/discord/db/GuildHandler.java +++ b/src/main/java/link/locutus/discord/db/GuildHandler.java @@ -1858,7 +1858,7 @@ public Boolean apply(IMessageBuilder msg) { } if (faRole != null) { String enemyStr = "(Or mark as enemy " + CM.coalition.create.cmd.create(attacker.getAlliance_id() + "", "enemies") + ")"; - tips.add("Please ping @\u200B" + faRole.getName() + " to get help negotiating peace. " + (attacker.al)); + tips.add("Please ping @\u200B" + faRole.getName() + " to get help negotiating peace. " + (attacker.getAlliance_id() == 0 ? "" : enemyStr)); } if (milcomRole != null) { tips.add("Please ping @\u200B" + milcomRole.getName() + " to get military advice"); From 910138cc7f840db306544682a94db4bd79e21429 Mon Sep 17 00:00:00 2001 From: xdnw Date: Tue, 28 May 2024 20:01:56 +0100 Subject: [PATCH 3/3] Update UtilityCommands.java --- .../manager/v2/impl/pw/commands/UtilityCommands.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/link/locutus/discord/commands/manager/v2/impl/pw/commands/UtilityCommands.java b/src/main/java/link/locutus/discord/commands/manager/v2/impl/pw/commands/UtilityCommands.java index 560f4c93..79799335 100644 --- a/src/main/java/link/locutus/discord/commands/manager/v2/impl/pw/commands/UtilityCommands.java +++ b/src/main/java/link/locutus/discord/commands/manager/v2/impl/pw/commands/UtilityCommands.java @@ -76,12 +76,13 @@ import java.awt.image.BufferedImage; import java.io.IOException; import java.security.GeneralSecurityException; +import java.text.DateFormat; import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.*; import java.util.List; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; -import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeUnit; import java.util.function.BiConsumer; import java.util.function.Consumer; @@ -2250,6 +2251,7 @@ public static String vmHistory(@Me IMessageIO io, Set nations, @Switch CompletableFuture msgFuture = io.send("Mounting nation snapshots..."); DataDumpParser parser = Locutus.imp().getDataDumper(true); + List validDays = parser.getDays(true, false); long today = TimeUtil.getDay(); long finalMinDay = minDay; @@ -2284,6 +2286,7 @@ public void accept(Long day) { }); Map> changesByNation = new LinkedHashMap<>(); + for (DBNation nation : nations) { long dayStart = TimeUtil.getDay(nation.getDate()); long lastStatus = -1; // -1 indicates no previous status @@ -2306,8 +2309,9 @@ public void accept(Long day) { case 2 -> "VM"; default -> "UNKNOWN"; }; + long timeMs = TimeUtil.getTimeFromDay(day); changesByNation.computeIfAbsent(nation.getNation_id(), k -> new ArrayList<>()) - .add(new String[]{new Date(TimeUtil.getTimeFromDay(day)).toString(), statusString}); + .add(new String[]{TimeUtil.DD_MM_YYYY.format(new Date(timeMs)), statusString}); } lastStatus = currentStatus; }