Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/xdnw/locutus
Browse files Browse the repository at this point in the history
  • Loading branch information
xdnw committed May 28, 2024
2 parents ddb886d + 910138c commit ae1cb7a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -2250,6 +2251,7 @@ public static String vmHistory(@Me IMessageIO io, Set<DBNation> nations, @Switch
CompletableFuture<IMessageBuilder> msgFuture = io.send("Mounting nation snapshots...");

DataDumpParser parser = Locutus.imp().getDataDumper(true);
List<Long> validDays = parser.getDays(true, false);
long today = TimeUtil.getDay();

long finalMinDay = minDay;
Expand Down Expand Up @@ -2284,6 +2286,7 @@ public void accept(Long day) {
});

Map<Integer, List<String[]>> changesByNation = new LinkedHashMap<>();

for (DBNation nation : nations) {
long dayStart = TimeUtil.getDay(nation.getDate());
long lastStatus = -1; // -1 indicates no previous status
Expand All @@ -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;
}
Expand Down
16 changes: 7 additions & 9 deletions src/main/java/link/locutus/discord/db/GuildHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.getAlliance_id() == 0 ? "" : enemyStr));
}
if (milcomRole != null) {
tips.add("Please ping @\u200B" + milcomRole.getName() + " to get military advice");
}
}
Map<Integer, JavaCity> 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<Integer, JavaCity> defCities = defender.getCityMap(false, false);
boolean hasDock = false;
for (JavaCity value : defCities.values()) {
if (value.getBuilding(Buildings.DRYDOCK) != 0) {
Expand Down

0 comments on commit ae1cb7a

Please sign in to comment.