diff options
17 files changed, 276 insertions, 9 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java index 6f162a5c..49d3da4e 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java @@ -3,6 +3,7 @@ package kr.syeyoung.dungeonsguide.dungeon; import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonSpecificDataProvider; import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonSpecificDataProviderRegistry; +import kr.syeyoung.dungeonsguide.dungeon.events.*; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.events.BossroomEnterEvent; @@ -61,9 +62,17 @@ public class DungeonContext { private boolean trapRoomGen = false; @Getter - @Setter private boolean gotMimic = false; + private int latestSecretCnt = 0; + private int latestTotalSecret = 0; + private int latestCrypts = 0; + + public void setGotMimic(boolean gotMimic) { + this.gotMimic = gotMimic; + createEvent(new DungeonNodataEvent("MIMIC_KILLED")); + } + @Getter @Setter private BossfightProcessor bossfightProcessor; @@ -71,12 +80,18 @@ public class DungeonContext { @Getter private Set<String> players = new HashSet<String>(); + private List<DungeonEvent> events = new ArrayList<DungeonEvent>(); + public DungeonContext(World world) { this.world = world; + createEvent(new DungeonNodataEvent("DUNGEON_CONTEXT_CREATION")); mapProcessor = new MapProcessor(this); DungeonSpecificDataProvider doorFinder = DungeonSpecificDataProviderRegistry.getDoorFinder(((SkyblockStatus) e.getDungeonsGuide().getSkyblockStatus()).getDungeonName()); trapRoomGen = doorFinder.isTrapSpawn(e.getDungeonsGuide().getSkyblockStatus().getDungeonName()); + } + public void createEvent(DungeonEventData eventData) { + events.add(new DungeonEvent(eventData)); } @@ -89,6 +104,7 @@ public class DungeonContext { BossRoomEnterSeconds = FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed() / 1000; bossroomSpawnPos = Minecraft.getMinecraft().thePlayer.getPosition(); MinecraftForge.EVENT_BUS.post(new BossroomEnterEvent()); + createEvent(new DungeonNodataEvent("BOSSROOM_ENTER")); DungeonSpecificDataProvider doorFinder = DungeonSpecificDataProviderRegistry.getDoorFinder(((SkyblockStatus) e.getDungeonsGuide().getSkyblockStatus()).getDungeonName()); if (doorFinder != null) { bossfightProcessor = doorFinder.createBossfightProcessor(world, e.getDungeonsGuide().getSkyblockStatus().getDungeonName()); @@ -105,11 +121,27 @@ public class DungeonContext { players.add(TextUtils.stripColor(name).trim().split(" ")[0]); } } catch (Exception e) {} + + if (latestSecretCnt != FeatureRegistry.DUNGEON_SECRETS.getSecretsFound()) { + int newSecretCnt = FeatureRegistry.DUNGEON_SECRETS.getSecretsFound(); + createEvent(new DungeonSecretCountChangeEvent(latestSecretCnt, newSecretCnt, latestTotalSecret, FeatureRegistry.DUNGEON_SECRETS.sureOfTotalSecrets())); + latestSecretCnt = newSecretCnt; + } + if (latestTotalSecret != FeatureRegistry.DUNGEON_SECRETS.getTotalSecretsInt()) { + latestTotalSecret = FeatureRegistry.DUNGEON_SECRETS.getTotalSecretsInt(); + createEvent(new DungeonSecretCountChangeEvent(latestSecretCnt, latestSecretCnt, latestTotalSecret, FeatureRegistry.DUNGEON_SECRETS.sureOfTotalSecrets())); + } + if (latestCrypts != FeatureRegistry.DUNGEON_TOMBS.getTombsFound()) { + int newlatestCrypts = FeatureRegistry.DUNGEON_TOMBS.getTombsFound(); + createEvent(new DungeonCryptBrokenEvent(latestCrypts, newlatestCrypts)); + this.latestCrypts = newlatestCrypts; + } } public void onChat(ClientChatReceivedEvent event) { IChatComponent component = event.message; - if (component.getFormattedText().contains("$DG-Comm")) { + String formatted = component.getFormattedText(); + if (formatted.contains("$DG-Comm")) { event.setCanceled(true); String data = component.getFormattedText().substring(component.getFormattedText().indexOf("$DG-Comm")); String actual = TextUtils.stripColor(data); @@ -124,8 +156,12 @@ public class DungeonContext { if (dr != null) { dr.setTotalSecrets(secrets2); } - } else if (component.getFormattedText().contains("$DG-Mimic")) { - gotMimic = true; + } else if (formatted.contains("$DG-Mimic")) { + setGotMimic(true); + } else if (formatted.startsWith("§r§c§lPUZZLE FAIL! ") && formatted.endsWith(" §r§4Y§r§ci§r§6k§r§ee§r§as§r§2!§r")) { + createEvent(new DungeonPuzzleFailureEvent(TextUtils.stripColor(formatted.split(" ")[2]), formatted)); + } else if (formatted.contains("§6> §e§lEXTRA STATS §6<")) { + createEvent(new DungeonNodataEvent("DUNGEON_END")); } } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java index 2515698f..ad8de026 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java @@ -4,6 +4,9 @@ import com.google.common.collect.BiMap; import com.google.common.collect.EnumHashBiMap; import com.google.common.collect.HashBiMap; import com.google.common.collect.Sets; +import kr.syeyoung.dungeonsguide.dungeon.events.DungeonMapUpdateEvent; +import kr.syeyoung.dungeonsguide.dungeon.events.DungeonNodataEvent; +import kr.syeyoung.dungeonsguide.dungeon.events.DungeonRoomDiscoverEvent; import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; @@ -157,6 +160,7 @@ public class MapProcessor { e.sendDebugChat(new ChatComponentText("Dimension:"+unitRoomDimension)); e.sendDebugChat(new ChatComponentText("top Left:"+topLeftMapPoint)); e.sendDebugChat(new ChatComponentText("door dimension:"+doorDimension)); + context.createEvent(new DungeonNodataEvent("MAP_PROCESSOR_INIT")); initialized = true; MinecraftForge.EVENT_BUS.post(new DungeonContextInitializationEvent()); } @@ -225,6 +229,7 @@ public class MapProcessor { MapUtils.record(mapData, mapPoint.x, mapPoint.y, new Color(0,255,255,80)); DungeonRoom rooms = buildRoom(mapData, new Point(x,y)); if (rooms == null) continue; + context.createEvent(new DungeonRoomDiscoverEvent(rooms.getUnitPoints().get(0), rooms.getRoomMatcher().getRotation(), rooms.getMin(), rooms.getShape(),rooms.getColor(), rooms.getDungeonRoomInfo().getUuid(), rooms.getDungeonRoomInfo().getName(), rooms.getDungeonRoomInfo().getProcessorId())); e.sendDebugChat(new ChatComponentText("New Map discovered! shape: "+rooms.getShape()+ " color: "+rooms.getColor()+" unitPos: "+x+","+y)); e.sendDebugChat(new ChatComponentText("New Map discovered! mapMin: "+rooms.getMin() + " mapMx: "+rooms.getMax())); StringBuilder builder = new StringBuilder(); @@ -342,6 +347,7 @@ public class MapProcessor { if (isThereDifference(lastMapData, mapData)) { stabilizationTick =0; + context.createEvent(new DungeonMapUpdateEvent(mapData)); } else { stabilizationTick++; } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonCryptBrokenEvent.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonCryptBrokenEvent.java new file mode 100644 index 00000000..53f833df --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonCryptBrokenEvent.java @@ -0,0 +1,19 @@ +package kr.syeyoung.dungeonsguide.dungeon.events; + +import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import lombok.AllArgsConstructor; +import lombok.Data; + +import java.awt.*; + +@Data +@AllArgsConstructor +public class DungeonCryptBrokenEvent implements DungeonEventData { + private int prevCrypts; + private int newCrypts; + + @Override + public String getEventName() { + return "CRYPTS_CHANGE"; + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonDeathEvent.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonDeathEvent.java new file mode 100644 index 00000000..dfbfa0d3 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonDeathEvent.java @@ -0,0 +1,20 @@ +package kr.syeyoung.dungeonsguide.dungeon.events; + +import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import lombok.AllArgsConstructor; +import lombok.Data; + +import java.awt.*; + +@Data +@AllArgsConstructor +public class DungeonDeathEvent implements DungeonEventData { + private String playerName; + private String message; + private int cnt; + + @Override + public String getEventName() { + return "PLAYER_DEATH"; + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonEvent.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonEvent.java new file mode 100644 index 00000000..cb2b3f57 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonEvent.java @@ -0,0 +1,21 @@ +package kr.syeyoung.dungeonsguide.dungeon.events; + +import kr.syeyoung.dungeonsguide.features.FeatureRegistry; +import lombok.Data; + +@Data +public class DungeonEvent { + private long UTCTime = System.currentTimeMillis(); + private long realTimeElapsed; + private long skyblockTimeElapsed; + + private String eventName; + private DungeonEventData data; + + public DungeonEvent(DungeonEventData eventData){ + this.data = eventData; + this.realTimeElapsed = FeatureRegistry.DUNGEON_REALTIME.getTimeElapsed(); + this.skyblockTimeElapsed = FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed(); + this.eventName = eventData.getEventName(); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonEventData.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonEventData.java new file mode 100644 index 00000000..2aa5ff68 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonEventData.java @@ -0,0 +1,5 @@ +package kr.syeyoung.dungeonsguide.dungeon.events; + +public interface DungeonEventData { + String getEventName(); +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonMapUpdateEvent.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonMapUpdateEvent.java new file mode 100644 index 00000000..39e6382b --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonMapUpdateEvent.java @@ -0,0 +1,15 @@ +package kr.syeyoung.dungeonsguide.dungeon.events; + +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +public class DungeonMapUpdateEvent implements DungeonEventData { + private byte[] map; + + @Override + public String getEventName() { + return "MAP_UPDATE"; + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonNodataEvent.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonNodataEvent.java new file mode 100644 index 00000000..9820627d --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonNodataEvent.java @@ -0,0 +1,10 @@ +package kr.syeyoung.dungeonsguide.dungeon.events; + +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +public class DungeonNodataEvent implements DungeonEventData { + private String eventName; +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonPuzzleFailureEvent.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonPuzzleFailureEvent.java new file mode 100644 index 00000000..49ef1cfa --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonPuzzleFailureEvent.java @@ -0,0 +1,15 @@ +package kr.syeyoung.dungeonsguide.dungeon.events; + +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +public class DungeonPuzzleFailureEvent implements DungeonEventData { + private String playerName; + private String message; + @Override + public String getEventName() { + return "PUZZLE_FAILURE"; + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonRoomDiscoverEvent.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonRoomDiscoverEvent.java new file mode 100644 index 00000000..44f3713f --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonRoomDiscoverEvent.java @@ -0,0 +1,26 @@ +package kr.syeyoung.dungeonsguide.dungeon.events; + +import lombok.AllArgsConstructor; +import lombok.Data; +import net.minecraft.util.BlockPos; + +import java.awt.*; +import java.util.UUID; + +@Data +@AllArgsConstructor +public class DungeonRoomDiscoverEvent implements DungeonEventData { + private Point unitPt; + private int rotation; + private BlockPos min; + private int shape; + private int color; + private UUID roomUID; + private String roomName; + private String roomProc; + + @Override + public String getEventName() { + return "ROOM_DISCOVER"; + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonSecretCountChangeEvent.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonSecretCountChangeEvent.java new file mode 100644 index 00000000..e25b8dc0 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonSecretCountChangeEvent.java @@ -0,0 +1,21 @@ +package kr.syeyoung.dungeonsguide.dungeon.events; + +import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import lombok.AllArgsConstructor; +import lombok.Data; + +import java.awt.*; + +@Data +@AllArgsConstructor +public class DungeonSecretCountChangeEvent implements DungeonEventData { + private int prevCount; + private int newCount; + private int totalSecret; + private boolean sureTotalSecret; + + @Override + public String getEventName() { + return "SECRET_CNT_CHANGE"; + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonStateChangeEvent.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonStateChangeEvent.java new file mode 100644 index 00000000..cc895b49 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonStateChangeEvent.java @@ -0,0 +1,23 @@ +package kr.syeyoung.dungeonsguide.dungeon.events; + +import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import lombok.AllArgsConstructor; +import lombok.Data; +import net.minecraft.util.BlockPos; + +import java.awt.*; +import java.util.UUID; + +@Data +@AllArgsConstructor +public class DungeonStateChangeEvent implements DungeonEventData { + private Point unitPt; + private String roomName; + private DungeonRoom.RoomState from; + private DungeonRoom.RoomState to; + + @Override + public String getEventName() { + return "ROOM_STATE_CHANGE"; + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java index 691926f7..9a3c42bc 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java @@ -5,6 +5,7 @@ import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.dungeon.MapProcessor; import kr.syeyoung.dungeonsguide.dungeon.data.DungeonRoomInfo; import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonDoor; +import kr.syeyoung.dungeonsguide.dungeon.events.DungeonStateChangeEvent; import kr.syeyoung.dungeonsguide.pathfinding.NodeProcessorDungeonRoom; import kr.syeyoung.dungeonsguide.roomprocessor.ProcessorFactory; import kr.syeyoung.dungeonsguide.roomprocessor.RoomProcessor; @@ -42,9 +43,13 @@ public class DungeonRoom { @Setter private int totalSecrets = -1; - @Setter private RoomState currentState = RoomState.DISCOVERED; + public void setCurrentState(RoomState currentState) { + context.createEvent(new DungeonStateChangeEvent(unitPoints.get(0), dungeonRoomInfo.getName(), this.currentState, currentState)); + this.currentState = currentState; + } + @Getter private PathFinder pathFinder; @Getter diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java index e5fbafbd..4712f8aa 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java @@ -6,10 +6,7 @@ import kr.syeyoung.dungeonsguide.features.impl.advanced.FeatureRoomDebugInfo; import kr.syeyoung.dungeonsguide.features.impl.boss.*; import kr.syeyoung.dungeonsguide.features.impl.boss.terminal.FeatureTerminalSolvers; import kr.syeyoung.dungeonsguide.features.impl.dungeon.*; -import kr.syeyoung.dungeonsguide.features.impl.etc.FeatureCooldownCounter; -import kr.syeyoung.dungeonsguide.features.impl.etc.FeatureDisableMessage; -import kr.syeyoung.dungeonsguide.features.impl.etc.FeatureTooltipDungeonStat; -import kr.syeyoung.dungeonsguide.features.impl.etc.FeatureTooltipPrice; +import kr.syeyoung.dungeonsguide.features.impl.etc.*; import kr.syeyoung.dungeonsguide.features.impl.secret.FeatureActions; import kr.syeyoung.dungeonsguide.features.impl.secret.FeatureMechanicBrowse; import lombok.Getter; @@ -68,6 +65,7 @@ public class FeatureRegistry { public static final SimpleFeature FIX_SPIRIT_BOOTS = register(new SimpleFeature("fixes", "Spirit Boots Fixer", "Fix Spirit boots messing up with inventory", "fixes.spirit", true)); public static final FeatureDisableMessage FIX_MESSAGES = register(new FeatureDisableMessage()); + public static final FeatureCopyMessages ETC_COPY_MSG = register(new FeatureCopyMessages()); public static final SimpleFeature BOSSFIGHT_CHESTPRICE = register(new FeatureChestPrice()); public static final FeatureAutoReparty BOSSFIGHT_AUTOREPARTY = register(new FeatureAutoReparty()); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonDeaths.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonDeaths.java index 33b88be8..46827fce 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonDeaths.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonDeaths.java @@ -2,6 +2,7 @@ package kr.syeyoung.dungeonsguide.features.impl.dungeon; import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.dungeon.events.DungeonDeathEvent; import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.GuiFeature; @@ -10,6 +11,7 @@ import kr.syeyoung.dungeonsguide.features.listener.TickListener; import kr.syeyoung.dungeonsguide.features.text.StyledText; import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; import kr.syeyoung.dungeonsguide.utils.TextUtils; +import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.util.ChatComponentText; import net.minecraftforge.client.event.ClientChatReceivedEvent; @@ -125,6 +127,7 @@ public class FeatureDungeonDeaths extends TextHUDFeature implements ChatListener String nickname = TextUtils.stripColor(m.group(1)); int deaths = context.getDeaths().containsKey(nickname) ? context.getDeaths().get(nickname) : 0; context.getDeaths().put(nickname, deaths + 1); + context.createEvent(new DungeonDeathEvent(nickname, txt, deaths)); e.sendDebugChat(new ChatComponentText("Death verified :: "+nickname+" / "+(deaths + 1))); } Matcher m2 = meDeathPattern.matcher(txt); @@ -132,6 +135,7 @@ public class FeatureDungeonDeaths extends TextHUDFeature implements ChatListener String nickname = "me"; int deaths = context.getDeaths().containsKey(nickname) ? context.getDeaths().get(nickname) : 0; context.getDeaths().put(nickname, deaths + 1); + context.createEvent(new DungeonDeathEvent(Minecraft.getMinecraft().thePlayer.getName(), txt, deaths)); e.sendDebugChat(new ChatComponentText("Death verified :: me / "+(deaths + 1))); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonSecrets.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonSecrets.java index 71261369..443e5d79 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonSecrets.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonSecrets.java @@ -45,6 +45,25 @@ public class FeatureDungeonSecrets extends TextHUDFeature { return 0; } + public int getTotalSecretsInt() { + DungeonContext context = skyblockStatus.getContext(); + int totalSecrets = 0; + for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { + if (dungeonRoom.getTotalSecrets() != -1) + totalSecrets += dungeonRoom.getTotalSecrets(); + } + return totalSecrets; + } + public boolean sureOfTotalSecrets() { + DungeonContext context = skyblockStatus.getContext(); + if (context.getMapProcessor().getUndiscoveredRoom() > 0) return false; + boolean allknown = true; + for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { + if (dungeonRoom.getTotalSecrets() == -1) allknown = false; + } + return allknown; + } + public String getTotalSecrets() { DungeonContext context = skyblockStatus.getContext(); int totalSecrets = 0; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureCopyMessages.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureCopyMessages.java new file mode 100644 index 00000000..bb91ddf1 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureCopyMessages.java @@ -0,0 +1,24 @@ +package kr.syeyoung.dungeonsguide.features.impl.etc; + +import kr.syeyoung.dungeonsguide.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.features.listener.ChatListener; +import kr.syeyoung.dungeonsguide.utils.TextUtils; +import net.minecraft.event.ClickEvent; +import net.minecraft.event.HoverEvent; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatStyle; +import net.minecraftforge.client.event.ClientChatReceivedEvent; + +public class FeatureCopyMessages extends SimpleFeature implements ChatListener { + public FeatureCopyMessages() { + super("ETC", "Copy Chat Messages", "Click on copy to copy", "etc.copymsg"); + setEnabled(false); + } + @Override + public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { + if (!isEnabled()) return; + if (clientChatReceivedEvent.type == 2) return; + + clientChatReceivedEvent.message.appendSibling(new ChatComponentText(" §7[Copy]").setChatStyle(new ChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, TextUtils.stripColor(clientChatReceivedEvent.message.getFormattedText()))).setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText("§eCopy Message"))))); + } +} |