diff options
Diffstat (limited to 'src/main/java')
3 files changed, 94 insertions, 1 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java index b3c22c2b..9e630601 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java @@ -84,6 +84,7 @@ public class FeatureRegistry { public static final FeatureDungeonRealTime DUNGEON_REALTIME = register(new FeatureDungeonRealTime()); public static final FeatureDungeonSBTime DUNGEON_SBTIME = register(new FeatureDungeonSBTime()); public static final FeatureDungeonSecrets DUNGEON_SECRETS = register(new FeatureDungeonSecrets()); + public static final FeatureDungeonCurrentRoomSecrets DUNGEON_SECRETS_ROOM = register(new FeatureDungeonCurrentRoomSecrets()); public static final FeatureDungeonTombs DUNGEON_TOMBS = register(new FeatureDungeonTombs()); public static final FeatureDungeonScore DUNGEON_SCORE = register(new FeatureDungeonScore()); public static final FeatureWarnLowHealth DUNGEON_LOWHEALTH_WARN = register(new FeatureWarnLowHealth()); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonCurrentRoomSecrets.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonCurrentRoomSecrets.java new file mode 100644 index 00000000..6b65246f --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonCurrentRoomSecrets.java @@ -0,0 +1,92 @@ +package kr.syeyoung.dungeonsguide.features.impl.dungeon; + +import kr.syeyoung.dungeonsguide.SkyblockStatus; +import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.features.listener.ChatListener; +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.network.NetworkPlayerInfo; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.util.BlockPos; +import net.minecraftforge.client.event.ClientChatReceivedEvent; + +import java.awt.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class FeatureDungeonCurrentRoomSecrets extends TextHUDFeature implements ChatListener { + public FeatureDungeonCurrentRoomSecrets() { + super("Dungeon", "Display #Secrets in current room", "Display what your actionbar says", "dungeon.stats.secretsroom", true, getFontRenderer().getStringWidth("Secrets: 8/8"), getFontRenderer().FONT_HEIGHT); + this.setEnabled(false); + } + + SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + + + private static final List<StyledText> dummyText= new ArrayList<StyledText>(); + static { + dummyText.add(new StyledText("Secrets","title")); + dummyText.add(new StyledText(": ","separator")); + dummyText.add(new StyledText("5","currentSecrets")); + dummyText.add(new StyledText("/","separator2")); + dummyText.add(new StyledText("8","totalSecrets")); + } + + @Override + public boolean isHUDViewable() { + return skyblockStatus.isOnDungeon(); + } + + @Override + public List<String> getUsedTextStyle() { + return Arrays.asList(new String[] { + "title", "separator", "currentSecrets", "separator2", "totalSecrets" + }); + } + + @Override + public List<StyledText> getDummyText() { + return dummyText; + } + + private int latestCurrSecrets = 0; + private int latestTotalSecrets = 0; + + + @Override + public List<StyledText> getText() { + List<StyledText> actualBit = new ArrayList<StyledText>(); + actualBit.add(new StyledText("Secrets","title")); + actualBit.add(new StyledText(": ","separator")); + actualBit.add(new StyledText(latestCurrSecrets +"","currentSecrets")); + actualBit.add(new StyledText("/","separator2")); + actualBit.add(new StyledText(latestTotalSecrets +"","totalSecrets")); + return actualBit; + } + + @Override + public void onChat(ClientChatReceivedEvent chat) { + if (chat.type != 2) return; + String text = chat.message.getFormattedText(); + if (!text.contains("/")) return; + + int secretsIndex = text.indexOf("Secrets"); + if (secretsIndex != -1) { + int theindex = 0; + for (int i = secretsIndex; i >= 0; i--) { + if (text.startsWith("ยง7", i)) { + theindex = i; + } + } + String it = text.substring(theindex + 2, secretsIndex - 1); + + latestCurrSecrets = Integer.parseInt(it.split("/")[0]); + latestTotalSecrets = Integer.parseInt(it.split("/")[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 443e5d79..68e68053 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 @@ -29,7 +29,7 @@ import java.util.regex.Pattern; public class FeatureDungeonSecrets extends TextHUDFeature { public FeatureDungeonSecrets() { - super("Dungeon", "Display #Secrets", "Display how much total secrets have been found in a dungeon run.\n+ sign means DG does not know the correct number, but it's somewhere above that number.", "dungeon.stats.secrets", true, getFontRenderer().getStringWidth("Secrets: 999/999+"), getFontRenderer().FONT_HEIGHT); + super("Dungeon", "Display #Secrets in total", "Display how much total secrets have been found in a dungeon run.\n+ sign means DG does not know the correct number, but it's somewhere above that number.", "dungeon.stats.secrets", true, getFontRenderer().getStringWidth("Secrets: 999/999+"), getFontRenderer().FONT_HEIGHT); this.setEnabled(false); } |