From 833e0c8834b8df95b33e44f579a66d58b53679c3 Mon Sep 17 00:00:00 2001 From: syeyoung Date: Sun, 28 Mar 2021 16:52:01 +0900 Subject: fix bugs --- .../features/impl/boss/FeatureBoxRealLivid.java | 2 +- .../features/impl/dungeon/FeatureDungeonDeaths.java | 21 +++++++++++++++------ .../features/impl/dungeon/FeatureDungeonScore.java | 16 ++++++++++------ 3 files changed, 26 insertions(+), 13 deletions(-) (limited to 'src/main/java/kr/syeyoung/dungeonsguide/features/impl') diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBoxRealLivid.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBoxRealLivid.java index 93332f09..29060c1e 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBoxRealLivid.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBoxRealLivid.java @@ -38,6 +38,6 @@ public class FeatureBoxRealLivid extends SimpleFeature implements WorldRenderLis AColor c = this.getParameter("color").getValue(); if (playerMP != null) - RenderUtils.highlightBox(playerMP, AxisAlignedBB.fromBounds(-0.4,-1.5,-0.4,0.4,0,0.4), c, partialTicks, true); + RenderUtils.highlightBox(playerMP, AxisAlignedBB.fromBounds(-0.4,0,-0.4,0.4,1.8,0.4), c, partialTicks, true); } } 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 7557820c..9d61c382 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 @@ -15,15 +15,18 @@ import kr.syeyoung.dungeonsguide.features.text.TextStyle; import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.scoreboard.Score; +import net.minecraft.scoreboard.ScoreObjective; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.scoreboard.Scoreboard; import net.minecraft.util.ChatComponentText; import net.minecraftforge.client.event.ClientChatReceivedEvent; import org.lwjgl.opengl.GL11; import java.awt.*; -import java.util.ArrayList; -import java.util.Arrays; +import java.util.*; import java.util.List; -import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -76,7 +79,7 @@ public class FeatureDungeonDeaths extends TextHUDFeature implements ChatListener } text.add(new StyledText("Total Deaths","total")); text.add(new StyledText(": ","separator")); - text.add(new StyledText(deathsCnt+"","totalDeaths")); + text.add(new StyledText(getTotalDeaths()+"","totalDeaths")); return text; } @@ -110,6 +113,12 @@ public class FeatureDungeonDeaths extends TextHUDFeature implements ChatListener public int getTotalDeaths() { if (!skyblockStatus.isOnDungeon()) return 0; + for (NetworkPlayerInfo networkPlayerInfoIn : Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()) { + String name = networkPlayerInfoIn.getDisplayName() != null ? networkPlayerInfoIn.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfoIn.getPlayerTeam(), networkPlayerInfoIn.getGameProfile().getName()); + if (name.contains("Deaths")) { + return Integer.parseInt(TextUtils.keepIntegerCharactersOnly(TextUtils.keepScoreboardCharacters(TextUtils.stripColor(name)))); + } + } DungeonContext context = skyblockStatus.getContext(); if (context == null) return 0; int d = 0; @@ -133,7 +142,7 @@ public class FeatureDungeonDeaths extends TextHUDFeature implements ChatListener Matcher m = deathPattern.matcher(txt); if (m.matches()) { String nickname = TextUtils.stripColor(m.group(1)); - int deaths = context.getDeaths().containsKey(nickname) ? context.getDeaths().get(nickname) : 0; + int deaths = context.getDeaths().getOrDefault(nickname, 0); context.getDeaths().put(nickname, deaths + 1); context.createEvent(new DungeonDeathEvent(nickname, txt, deaths)); e.sendDebugChat(new ChatComponentText("Death verified :: "+nickname+" / "+(deaths + 1))); @@ -141,7 +150,7 @@ public class FeatureDungeonDeaths extends TextHUDFeature implements ChatListener Matcher m2 = meDeathPattern.matcher(txt); if (m2.matches()) { String nickname = "me"; - int deaths = context.getDeaths().containsKey(nickname) ? context.getDeaths().get(nickname) : 0; + int deaths = context.getDeaths().getOrDefault(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/FeatureDungeonScore.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonScore.java index c3439727..6bee931d 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonScore.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonScore.java @@ -233,11 +233,11 @@ public class FeatureDungeonScore extends TextHUDFeature implements StompConnecte if (dungeonRoom.getColor() == 62) traproomFound = true; if (dungeonRoom.getCurrentState() != DungeonRoom.RoomState.DISCOVERED) totalCompRooms += dungeonRoom.getUnitPoints().size(); - if (dungeonRoom.getColor() == 66 && dungeonRoom.getCurrentState() == DungeonRoom.RoomState.DISCOVERED) + if (dungeonRoom.getColor() == 66 && dungeonRoom.getCurrentState() == DungeonRoom.RoomState.DISCOVERED) // INCOMPLETE PUZZLE ON MAP skill -= 10; - if (dungeonRoom.getColor() == 74 && dungeonRoom.getCurrentState() == DungeonRoom.RoomState.DISCOVERED) + if (dungeonRoom.getColor() == 74 && dungeonRoom.getCurrentState() == DungeonRoom.RoomState.DISCOVERED) // INCOMPLETE BOSSROOM YELLOW skill += 1; - if (dungeonRoom.getColor() == 62 && dungeonRoom.getCurrentState() == DungeonRoom.RoomState.DISCOVERED) + if (dungeonRoom.getColor() == 62 && dungeonRoom.getCurrentState() == DungeonRoom.RoomState.DISCOVERED) // INCOMPLETE TRAP ROOM skill += 1; skill += dungeonRoom.getCurrentState().getScoreModifier(); @@ -245,7 +245,7 @@ public class FeatureDungeonScore extends TextHUDFeature implements StompConnecte if (!bossroomFound) skill += 1; if (!traproomFound && context.isTrapRoomGen()) skill += 1; skill -= getUndiscoveredPuzzles() * 10; - skill -= (getTotalRooms() - totalCompRooms) * 4; + skill -= Math.max(0, (getTotalRooms() - totalCompRooms) * 4); skill = MathHelper.clamp_int(skill, 0, 100); } int explorer = 0; @@ -255,15 +255,19 @@ public class FeatureDungeonScore extends TextHUDFeature implements StompConnecte int secrets = 0; { int completed = 0; + double total = 0; + for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { if (dungeonRoom.getTotalSecrets() != -1) totalSecrets += dungeonRoom.getTotalSecrets(); else totalSecretsKnown = false; - if (dungeonRoom.getCurrentState() != DungeonRoom.RoomState.DISCOVERED) + if (dungeonRoom.getCurrentState() != DungeonRoom.RoomState.DISCOVERED && dungeonRoom.getCurrentState() != DungeonRoom.RoomState.FAILED) completed += dungeonRoom.getUnitPoints().size(); + total += dungeonRoom.getUnitPoints().size(); } + fullyCleared = completed >= getTotalRooms() && context.getMapProcessor().getUndiscoveredRoom() == 0; - explorer += MathHelper.clamp_int((int) Math.floor(6.0 / 10.0 * getPercentage()), 0, 60); + explorer += MathHelper.clamp_int((int) Math.floor(6.0 / 10.0 * (context.getMapProcessor().getUndiscoveredRoom() != 0 ? getPercentage() : completed / total * 100)), 0, 60); explorer += MathHelper.clamp_int((int) Math.floor(40 * ((secrets = FeatureRegistry.DUNGEON_SECRETS.getSecretsFound()) / (double)totalSecrets)),0,40); } int time = 0; -- cgit