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
2 changes: 1 addition & 1 deletion resourcepack
4 changes: 2 additions & 2 deletions src/main/java/dev/boarbot/bot/config/StringConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,8 @@ public class StringConfig {
private String trophyGuessReplyStr;
private String trophyTitle;
private String easterMessage = "";
private String easterGuessStr = "";
private String easterGuessReplyStr = "";
private String[] easterGuessStrs = {};
private String[] easterGuessReplyStrs = {};
private String easterTitle = "";
private String incorrectGuess = "";
private String activityStatus = "";
Expand Down
31 changes: 23 additions & 8 deletions src/main/java/dev/boarbot/commands/boar/GuessSubcommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,14 @@ public class GuessSubcommand extends Subcommand implements Synchronizable {
private static final List<String> halloweenBoarStrs = new ArrayList<>();
private static final String spookyBoarStr = "<>%s<>%s"
.formatted(BoarUtil.findRarityKey("spooky"), BOARS.get("spooky").getName());
private static final List<String> easterGuesses = Arrays.asList(STRS.getEasterGuessStrs());
private static final List<String> easterReplies = Arrays.asList(STRS.getEasterGuessReplyStrs());
private static final List<String> easterBoarIDs = new ArrayList<>();
private static final List<String> easterBoarStrs = new ArrayList<>();

private boolean isTrophyGuess = false;
private int spookIndex = -1;
private boolean isEasterGuess = false;
private int easterIndex = -1;
private boolean failedSynchronized = false;

private final EmbedImageGenerator embedImageGenerator = new EmbedImageGenerator(
Expand All @@ -47,10 +51,18 @@ public class GuessSubcommand extends Subcommand implements Synchronizable {

static {
String[] curHalloweenBoarIDs = RARITIES.get("halloween").getBoars();

for (int i=curHalloweenBoarIDs.length-spookGuesses.size(); i<curHalloweenBoarIDs.length; i++) {
halloweenBoarStrs.add("<>halloween<>" + BOARS.get(curHalloweenBoarIDs[i]).getName());
halloweenBoarIDs.add(curHalloweenBoarIDs[i]);
}

for (String eventBoarID : RARITIES.get("event").getBoars()) {
if (BOARS.get(eventBoarID).getName().toLowerCase().contains("egg")) {
easterBoarStrs.add("<>event<>" + BOARS.get(eventBoarID).getName());
easterBoarIDs.add(eventBoarID);
}
}
}

public GuessSubcommand(SlashCommandInteractionEvent event) {
Expand Down Expand Up @@ -79,15 +91,15 @@ public void execute() {
this.spookIndex = spookGuesses.indexOf(input);
}

if (TimeUtil.isEaster() && input.equals(STRS.getEasterGuessStr())) {
this.isEasterGuess = true;
if (TimeUtil.isEaster() && easterGuesses.contains(input)) {
this.easterIndex = easterGuesses.indexOf(input);
}

if (input.equals(STRS.getTrophyGuessStr())) {
this.isTrophyGuess = true;
}

if (this.spookIndex != -1 || this.isEasterGuess || this.isTrophyGuess) {
if (this.spookIndex != -1 || this.easterIndex != -1 || this.isTrophyGuess) {
try {
BoarUser boarUser = BoarUserFactory.getBoarUser(this.user);
boarUser.passSynchronizedAction(this);
Expand Down Expand Up @@ -159,13 +171,16 @@ public void doSynchronizedAction(BoarUser boarUser) {

this.embedImageGenerator.setStr(spookReply);
}
} else if (this.isEasterGuess) {
obtainType = "EASTER_%d".formatted(TimeUtil.getYear());
} else if (this.easterIndex != -1) {
obtainType = "EASTER_%d_%d".formatted(this.easterIndex+1, TimeUtil.getYear());

if (!boarUser.boarQuery().hasBoarWithTag(connection, obtainType)) {
boarIDs.add("egg");
String easterReply = easterReplies.get(this.easterIndex) + " " + STRS.getSpookExtraStr()
.formatted(easterBoarStrs.get(this.easterIndex), POWS.get("transmute").getName());

boarIDs.add(easterBoarIDs.get(this.easterIndex));
boarUser.powQuery().addPowerup(connection, "transmute", 1);
this.embedImageGenerator.setStr(STRS.getEasterGuessReplyStr());
this.embedImageGenerator.setStr(easterReply);
}
}

Expand Down
8 changes: 6 additions & 2 deletions src/main/resources/config/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,12 @@
"spookHasExtraStr": "You received %s<>font<> and <>powerup<>3 %s<>font<>!",
"spookTitle": "Boar-O-Ween Hunt!",
"easterMessage": "PLACEHOLDER",
"easterGuessStr": "PLACEHOLDER",
"easterGuessReplyStr": "PLACEHOLDER",
"easterGuessStrs": [
"PLACEHOLDER"
],
"easterGuessReplyStrs": [
"PLACEHOLDER"
],
"easterTitle": "Egg Hunt!",
"incorrectGuess": "Your guess didn't match any secret phrases!"
}
Loading