diff options
author | syeyoung <cyong06@naver.com> | 2021-05-01 14:36:48 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-05-01 14:36:48 +0900 |
commit | 4d858161e0321c479927e7f28bf516189781914e (patch) | |
tree | 42ee5394f90afec98acdd74fbedea7971a0b195a /src/main/java/kr/syeyoung | |
parent | c60485da3704c1ac91f614f8020c79f5a92a599e (diff) | |
download | Skyblock-Dungeons-Guide-4d858161e0321c479927e7f28bf516189781914e.tar.gz Skyblock-Dungeons-Guide-4d858161e0321c479927e7f28bf516189781914e.tar.bz2 Skyblock-Dungeons-Guide-4d858161e0321c479927e7f28bf516189781914e.zip |
all tested.
Diffstat (limited to 'src/main/java/kr/syeyoung')
15 files changed, 192 insertions, 17 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/RichPresenceManager.java b/src/main/java/kr/syeyoung/dungeonsguide/RichPresenceManager.java index 7a2f43e1..ec7a9ce5 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/RichPresenceManager.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/RichPresenceManager.java @@ -60,7 +60,7 @@ public class RichPresenceManager implements Runnable { public void updatePresence() { - if (!skyblockStatus.isOnHypixel() || !FeatureRegistry.ADVANCED_RICHPRESENCE.isEnabled()) { + if (!skyblockStatus.isOnHypixel() || !FeatureRegistry.ADVANCED_RICHPRESENCE.isEnabled() || (!skyblockStatus.isOnSkyblock() && FeatureRegistry.ADVANCED_RICHPRESENCE.<Boolean>getParameter("disablenotskyblock").getValue())) { DiscordRPC.discordClearPresence(); } else { DiscordRichPresence.Builder richPresenceBuilder = new DiscordRichPresence.Builder(skyblockStatus.getDungeonName()); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java index 9f97adbb..2a7ebd38 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java @@ -62,7 +62,7 @@ public class ActionMove extends AbstractAction { private Future<List<BlockPos>> latestFuture; @Override public void onTick(DungeonRoom dungeonRoom) { - tick = (tick+1) % 10; + tick = (tick+1) % Math.max(1, FeatureRegistry.SECRET_BROWSE.getRefreshRate()); if (latestFuture != null && latestFuture.isDone()) { try { poses = latestFuture.get(); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java index 3c2131ee..3a49005d 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java @@ -60,7 +60,7 @@ public class ActionMoveNearestAir extends AbstractAction { private Future<List<BlockPos>> latestFuture; @Override public void onTick(DungeonRoom dungeonRoom) { - tick = (tick+1) % 10; + tick = (tick+1) % Math.max(1, FeatureRegistry.SECRET_BROWSE.getRefreshRate()); if (latestFuture != null && latestFuture.isDone()) { try { poses = latestFuture.get(); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java index 7148b054..3bf26d86 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java @@ -27,6 +27,7 @@ import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.InputEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import org.lwjgl.opengl.GL11; @@ -358,6 +359,18 @@ public class FeatureListener { } } @SubscribeEvent + public void onKey(GuiScreenEvent.KeyboardInputEvent event) { + try { + for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { + if (abstractFeature instanceof KeyInputListener) { + ((KeyInputListener) abstractFeature).onKeyInput(event); + } + } + } catch (Throwable t) { + t.printStackTrace(); + } + } + @SubscribeEvent public void onDungeonStart(DungeonStartedEvent leftEvent) { try { for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java index bf2779d9..b38bf1b7 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java @@ -52,7 +52,11 @@ public class FeatureRegistry { public static final FeatureRoomDebugInfo ADVANCED_DEBUG_ROOM = register(new FeatureRoomDebugInfo()); public static final FeatureDebuggableMap ADVANCED_DEBUGGABLE_MAP = register(new FeatureDebuggableMap()); public static final FeatureRoomCoordDisplay ADVANCED_COORDS = register(new FeatureRoomCoordDisplay()); - public static final SimpleFeature ADVANCED_RICHPRESENCE = register(new SimpleFeature("Advanced", "Discord Rich presence", "Discord rich presence with ASK-TO-JOIN Support!\n\nSimply type /dg asktojoin or /dg atj to toggle whether ask-to-join would be presented as option on discord!", "advanced.richpresence", true)); + public static final SimpleFeature ADVANCED_RICHPRESENCE = register(new SimpleFeature("Advanced", "Discord Rich presence", "Discord rich presence with ASK-TO-JOIN Support!\n\nSimply type /dg asktojoin or /dg atj to toggle whether ask-to-join would be presented as option on discord!", "advanced.richpresence", true) { + { + parameters.put("disablenotskyblock", new FeatureParameter<Boolean>("disablenotskyblock", "Disable When not on Skyblock", "Disable When not on skyblock", false, "boolean")); + } + }); public static final SimpleFeature SOLVER_RIDDLE = register(new SimpleFeature("Solver", "Riddle Puzzle (3 weirdo) Solver", "Highlights the correct box after clicking on all 3 weirdos", "solver.riddle")); public static final SimpleFeature SOLVER_KAHOOT = register(new SimpleFeature("Solver", "Trivia Puzzle (Omnicrescent) Solver", "Highlights the correct solution for trivia puzzle", "solver.trivia")); @@ -97,12 +101,14 @@ public class FeatureRegistry { public static final FeatureHideAnimals BOSSFIGHT_HIDE_ANIMALS = register(new FeatureHideAnimals()); public static final FeatureThornBearPercentage BOSSFIGHT_BEAR_PERCENT = register(new FeatureThornBearPercentage()); public static final FeatureThornSpiritBowTimer BOSSFIGHT_BOW_TIMER = register(new FeatureThornSpiritBowTimer()); + public static final FeatureTerracotaTimer BOSSFIGHT_TERRACOTTA_TIMER = register(new FeatureTerracotaTimer()); public static final FeatureCurrentPhase BOSSFIGHT_CURRENT_PHASE = register(new FeatureCurrentPhase()); public static final FeatureTerminalSolvers BOSSFIGHT_TERMINAL_SOLVERS = register(new FeatureTerminalSolvers()); public static final FeatureSimonSaysSolver BOSSFIGHT_SIMONSAYS_SOLVER = register(new FeatureSimonSaysSolver()); public static final FeatureDungeonMap DUNGEON_MAP = register(new FeatureDungeonMap()); + public static final FeaturePressAnyKeyToCloseChest DUNGEON_CLOSECHEST = register(new FeaturePressAnyKeyToCloseChest()); public static final FeatureBoxSkelemaster DUNGEON_BOXSKELEMASTER = register(new FeatureBoxSkelemaster()); public static final FeatureBoxBats DUNGEON_BOXBAT = register(new FeatureBoxBats()); public static final FeatureBoxStarMobs DUNGEON_BOXSTARMOBS = register(new FeatureBoxStarMobs()); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureTerracotaTimer.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureTerracotaTimer.java new file mode 100644 index 00000000..bb59419d --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureTerracotaTimer.java @@ -0,0 +1,62 @@ +package kr.syeyoung.dungeonsguide.features.impl.boss; + +import kr.syeyoung.dungeonsguide.SkyblockStatus; +import kr.syeyoung.dungeonsguide.config.types.AColor; +import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.features.text.StyledText; +import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.features.text.TextStyle; +import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorSadan; +import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorThorn; +import kr.syeyoung.dungeonsguide.utils.TextUtils; +import net.minecraft.entity.boss.BossStatus; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class FeatureTerracotaTimer extends TextHUDFeature { + public FeatureTerracotaTimer() { + super("Bossfight", "Display Terracotta phase timer", "Displays Terracotta phase timer", "bossfight.terracota", true, getFontRenderer().getStringWidth("Terracottas: 1m 99s"), getFontRenderer().FONT_HEIGHT); + this.setEnabled(true); + getStyles().add(new TextStyle("title", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); + getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); + getStyles().add(new TextStyle("time", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); + } + + SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + + private static final List<StyledText> dummyText= new ArrayList<StyledText>(); + static { + dummyText.add(new StyledText("Terracottas","title")); + dummyText.add(new StyledText(": ","separator")); + dummyText.add(new StyledText("1m 99s","time")); + } + @Override + public boolean isHUDViewable() { + return skyblockStatus.isOnDungeon() && skyblockStatus.getContext() != null && skyblockStatus.getContext().getBossfightProcessor() instanceof BossfightProcessorSadan && + "fight-1".equalsIgnoreCase(skyblockStatus.getContext().getBossfightProcessor().getCurrentPhase()); + } + + @Override + public List<String> getUsedTextStyle() { + return Arrays.asList(new String[] { + "title", "separator", "number", "unit" + }); + } + + @Override + public List<StyledText> getDummyText() { + return dummyText; + } + + @Override + public List<StyledText> getText() { + List<StyledText> actualBit = new ArrayList<StyledText>(); + actualBit.add(new StyledText("Terracottas","title")); + actualBit.add(new StyledText(": ","separator")); + actualBit.add(new StyledText(TextUtils.formatTime((long) (BossStatus.healthScale * 1000 * 60 * 1.5)),"time")); + return actualBit; + } + +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeaturePressAnyKeyToCloseChest.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeaturePressAnyKeyToCloseChest.java new file mode 100644 index 00000000..1e9b4989 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeaturePressAnyKeyToCloseChest.java @@ -0,0 +1,41 @@ +package kr.syeyoung.dungeonsguide.features.impl.dungeon; + +import kr.syeyoung.dungeonsguide.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.features.impl.boss.FeatureChestPrice; +import kr.syeyoung.dungeonsguide.features.listener.KeyInputListener; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.inventory.ContainerChest; +import net.minecraft.inventory.IInventory; +import net.minecraftforge.client.event.GuiScreenEvent; +import net.minecraftforge.fml.common.gameevent.InputEvent; + +public class FeaturePressAnyKeyToCloseChest extends SimpleFeature implements KeyInputListener { + public FeaturePressAnyKeyToCloseChest() { + super("Dungeon", "Press Any Key to close Secret Chest", "dungeon.presskeytoclose"); + parameters.put("threshold", new FeatureParameter<Integer>("threshold", "Price Threshold", "The maximum price of item for chest to be closed. Default 1m", 1000000, "integer")); + } + + @Override + public void onKeyInput(GuiScreenEvent.KeyboardInputEvent keyboardInputEvent) { + GuiScreen screen = Minecraft.getMinecraft().currentScreen; + if (screen instanceof GuiChest){ + ContainerChest ch = (ContainerChest) ((GuiChest)screen).inventorySlots; + if (!("Large Chest".equals(ch.getLowerChestInventory().getName()) + || "Chest".equals(ch.getLowerChestInventory().getName()))) return; + IInventory actualChest = ch.getLowerChestInventory(); + + int priceSum = 0; + for (int i = 0; i < actualChest.getSizeInventory(); i++) { + priceSum += FeatureChestPrice.getPrice(actualChest.getStackInSlot(i)); + } + + int threshold = this.<Integer>getParameter("threshold").getValue(); + if (priceSum < threshold) { + Minecraft.getMinecraft().thePlayer.closeScreen(); + } + } + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/FeatureGoodParties.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/FeatureGoodParties.java index ae7b0b45..912e0c6a 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/FeatureGoodParties.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/FeatureGoodParties.java @@ -66,18 +66,33 @@ public class FeatureGoodParties extends SimpleFeature implements GuiPostRenderLi int classLvReq = 0; int cataLvReq = 0; boolean Req = false; + String note = ""; for (int n = 0; n < lore.tagCount(); n++) { String str = lore.getStringTagAt(n); if (str.startsWith("§7Dungeon Level Required: §b")) cataLvReq = Integer.parseInt(str.substring(28)); if (str.startsWith("§7Class Level Required: §b")) classLvReq = Integer.parseInt(str.substring(26)); + if (str.startsWith("§7§7Note:")) note = TextUtils.stripColor(str.substring(10)); if (str.startsWith("§cRequires")) Req = true; } - System.out.println(classLvReq + " / "+cataLvReq); + int x = s.xDisplayPosition; + int y = s.yDisplayPosition; if (Req) { - int x = s.xDisplayPosition; - int y = s.yDisplayPosition; Gui.drawRect(x, y, x + 16, y + 16, 0x77AA0000); + } else { + + if (note.toLowerCase().contains("car")) { + fr.drawStringWithShadow("C", x + 1, y + 1, 0xFFFF0000); + } else if (note.toLowerCase().replace(" ", "").contains("s/s+")) { + fr.drawStringWithShadow("S+", x + 1, y + 1, 0xFFFFFF00); + } else if (note.toLowerCase().contains("s+")) { + fr.drawStringWithShadow("S+", x + 1, y + 1, 0xFF00FF00); + } else if (note.toLowerCase().contains(" s") || note.toLowerCase().contains(" s ")) { + fr.drawStringWithShadow("S", x + 1, y + 1, 0xFFFFFF00); + } else if (note.toLowerCase().contains("rush")) { + fr.drawStringWithShadow("R", x + 1, y + 1, 0xFFFF0000); + } + fr.drawStringWithShadow("§e"+Integer.max(classLvReq, cataLvReq), x + 1, y + fr.FONT_HEIGHT, 0xFFFFFFFF); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSecrets.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSecrets.java index 73426287..dfb2f6fb 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSecrets.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSecrets.java @@ -5,19 +5,23 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import java.awt.*; +import java.util.stream.Collectors; public class DataRendererSecrets implements DataRenderer { @Override public Dimension renderData(PlayerProfile playerProfile) { FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - fr.drawString("§eSecrets §b"+playerProfile.getTotalSecrets(), 0,0,-1); + double theint = playerProfile.getTotalSecrets()/ (double)playerProfile.getDungeonStats().values().stream().flatMap(s -> s.getData().getPlays().values().stream()) + .map(fs -> fs.getData().getWatcherKills()).reduce(0, Integer::sum); + fr.drawString("§eSecrets §b"+playerProfile.getTotalSecrets()+" §7("+ + String.format("%.2f", theint)+"/run)", 0,0,-1); return new Dimension(100, fr.FONT_HEIGHT); } @Override public Dimension renderDummy() { FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - fr.drawString("§eSecrets §b99999", 0,0,-1); + fr.drawString("§eSecrets §b99999 §7(X/run)", 0,0,-1); return new Dimension(100, fr.FONT_HEIGHT); } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java index 54353e34..19f39b1f 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java @@ -42,6 +42,7 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis super("Secret","Mechanic(Secret) Browser", "Browse and Pathfind secrets and mechanics in the current room", "secret.mechanicbrowse", false, 100, 300); parameters.put("linecolor", new FeatureParameter<Color>("linecolor", "Color", "Color of Pathfind line", Color.green, "color")); parameters.put("linethickness", new FeatureParameter<Float>("linethickness", "Thickness", "Thickness of Pathfind line", 1.0f, "float")); + parameters.put("refreshrate", new FeatureParameter<Integer>("refreshrate", "Line Refreshrate", "How many ticks per line refresh?", 10, "integer")); } public Color getColor() { @@ -50,6 +51,9 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis public float getThickness() { return this.<Float>getParameter("linethickness").getValue(); } + public int getRefreshRate() { + return this.<Integer>getParameter("refreshrate").getValue(); + } SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); private UUID lastRoomUID = null; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/listener/KeyInputListener.java b/src/main/java/kr/syeyoung/dungeonsguide/features/listener/KeyInputListener.java new file mode 100644 index 00000000..5462c4cb --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/listener/KeyInputListener.java @@ -0,0 +1,8 @@ +package kr.syeyoung.dungeonsguide.features.listener; + +import net.minecraftforge.client.event.GuiScreenEvent; +import net.minecraftforge.fml.common.gameevent.InputEvent; + +public interface KeyInputListener { + void onKeyInput(GuiScreenEvent.KeyboardInputEvent keyboardInputEvent); +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/party/PartyManager.java b/src/main/java/kr/syeyoung/dungeonsguide/party/PartyManager.java index 8f938ca3..1083248c 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/party/PartyManager.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/party/PartyManager.java @@ -114,7 +114,6 @@ public class PartyManager implements StompMessageHandler { if (chatReceivedEvent.type == 2) return; String str = chatReceivedEvent.message.getFormattedText(); - System.out.println(str); try { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorRiddle.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorRiddle.java index bab5ba42..ceaff8a2 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorRiddle.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorRiddle.java @@ -54,7 +54,7 @@ public class RoomProcessorRiddle extends GeneralRoomProcessor { } if (foundMatch) { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §eRiddle §7:: "+ch2.split(":")[0].trim()+" §fhas the reward!")); - final String name = TextUtils.stripColor(ch2.split(":")[0]).replace("[NPC] ","").toLowerCase(); + final String name = TextUtils.stripColor(ch2.split(":")[0]).replace("[NPC] ","").trim(); final BlockPos low = getDungeonRoom().getMin(); final BlockPos high = getDungeonRoom().getMax(); World w = getDungeonRoom().getContext().getWorld(); @@ -63,7 +63,7 @@ public class RoomProcessorRiddle extends GeneralRoomProcessor { public boolean apply(@Nullable EntityArmorStand input) { BlockPos pos = input.getPosition(); return low.getX() < pos.getX() && pos.getX() < high.getX() - && low.getZ() < pos.getZ() && pos.getZ() < high.getZ() && input.getName().toLowerCase().contains(name); + && low.getZ() < pos.getZ() && pos.getZ() < high.getZ() && TextUtils.stripColor(input.getName()).equalsIgnoreCase(name); } }); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTicTacToeSolver.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTicTacToeSolver.java index 19911a34..b3511dec 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTicTacToeSolver.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTicTacToeSolver.java @@ -170,7 +170,20 @@ public class RoomProcessorTicTacToeSolver extends GeneralRoomProcessor { if (!FeatureRegistry.SOLVER_TICTACTOE.isEnabled()) return; if (chosePos != -1) { BlockPos block = board.getOffsetPointList().get(chosePos).getBlockPos(getDungeonRoom()); - RenderUtils.highlightBlock(block, new Color(0,255,255,50), partialTicks, true); + boolean whoseturn = false; // false => hype true => me + if (lastBoard != null) { + int ones = 0; + int negativeones = 0; + for (byte[] bytes : lastBoard) { + for (byte aByte : bytes) { + if (aByte == 1) ones++; + else if (aByte == -1) negativeones++; + } + } + whoseturn = ones < negativeones; + } + RenderUtils.highlightBlock(block, whoseturn ? new Color(0,255,255,50) + : new Color(255, 201, 0,50), partialTicks, true); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/GeneralBossfightProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/GeneralBossfightProcessor.java index 652206c2..c529670e 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/GeneralBossfightProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/GeneralBossfightProcessor.java @@ -58,10 +58,10 @@ public abstract class GeneralBossfightProcessor implements BossfightProcessor { for (String nextPhase : currentPhase.getNextPhases()) { PhaseData phaseData = phases.get(nextPhase); if (phaseData == null) continue; - if (phaseData.signatureMsgs.contains(chat.getFormattedText())) { - currentPhase = phaseData; - onPhaseChange(); - return; + if (phaseData.signatureMsgs.contains(chat.getFormattedText().replace(" ", ""))) { + currentPhase = phaseData; + onPhaseChange(); + return; } } } @@ -115,10 +115,20 @@ public abstract class GeneralBossfightProcessor implements BossfightProcessor { @Data @Builder public static class PhaseData { + private PhaseData(String phase, Set<String> signatureMsgs, Set<String> nextPhase) { + this.phase = phase; + this.nextPhases = new HashSet<>(nextPhase); + this.signatureMsgs = new HashSet<>(); + for (String signatureMsg : signatureMsgs) { + this.signatureMsgs.add(signatureMsg.replace(" ", "")); + } + } + private String phase; @Singular private Set<String> signatureMsgs; @Singular private Set<String> nextPhases; + } } |