diff options
Diffstat (limited to 'src/main')
16 files changed, 262 insertions, 37 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java index d7bee24f..50f5aa7f 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java @@ -469,6 +469,16 @@ public class CommandDungeonsGuide extends CommandBase { public boolean isTrapSpawn(String dungeonName) { return false; } + + @Override + public double secretPercentage(String dungeonName) { + return 0; + } + + @Override + public int speedSecond(String dungeonName) { + return 0; + } }); SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); skyblockStatus.setDungeonName("TEST DG"); @@ -539,7 +549,30 @@ public class CommandDungeonsGuide extends CommandBase { } System.out.println(stringBuilder.toString()); System.out.println(stringBuilder2.toString()); - } else{ + } else if (args[0].equals("readMap")) { + try { + int fromX = Integer.parseInt(args[1]); + int fromY = Integer.parseInt(args[2]); + sender.addChatMessage(new ChatComponentText(MapUtils.readDigit(MapUtils.getColors(), fromX, fromY)+"-")); +// int cntY = Integer.parseInt(args[3]); +// int target = Integer.parseInt(args[4]); +// StringBuilder sb = new StringBuilder("{"); +// for (int y = fromY; y < fromY + cntY; y++) { +// int curr = 0; +// for (int x = fromX; x < fromX+8; x++) { +// byte clr = MapUtils.getMapColorAt(MapUtils.getColors(), x,y); +// if (clr == target) curr = (curr << 1) | 1; +// else curr <<= 1; +// } +// sb.append("0x").append(Integer.toHexString(curr).toUpperCase()); +// if (y != fromY + cntY - 1) sb.append(", "); +// } +// sb.append("}"); +// System.out.println("\n"+sb.toString()); + } catch (Exception e) { + e.printStackTrace(); + } + } else { sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg §7-§fOpens configuration gui")); sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg gui §7-§fOpens configuration gui")); sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg help §7-§fShows command help")); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java index 026be921..c037ec78 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java @@ -88,6 +88,11 @@ public class DungeonContext { private int latestTotalSecret = 0; private int latestCrypts = 0; + @Getter + private int maxSpeed = 600; + @Getter + private double secretPercentage = 1.0; + public void setGotMimic(boolean gotMimic) { this.gotMimic = gotMimic; createEvent(new DungeonNodataEvent("MIMIC_KILLED")); @@ -108,9 +113,12 @@ public class DungeonContext { createEvent(new DungeonNodataEvent("DUNGEON_CONTEXT_CREATION")); mapProcessor = new MapProcessor(this); DungeonSpecificDataProvider doorFinder = DungeonSpecificDataProviderRegistry.getDoorFinder(DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName()); - if (doorFinder != null) + if (doorFinder != null) { trapRoomGen = doorFinder.isTrapSpawn(DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName()); - else mapProcessor.setBugged(true); + + secretPercentage = doorFinder.secretPercentage(DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName()); + maxSpeed = doorFinder.speedSecond(DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName()); + } else mapProcessor.setBugged(true); init = System.currentTimeMillis(); } @@ -162,6 +170,8 @@ public class DungeonContext { } } + @Getter + private boolean ended = false; public void onChat(ClientChatReceivedEvent event) { IChatComponent component = event.message; String formatted = component.getFormattedText(); @@ -186,6 +196,7 @@ public class DungeonContext { createEvent(new DungeonPuzzleFailureEvent(TextUtils.stripColor(formatted.split(" ")[2]), formatted)); } else if (formatted.contains("§6> §e§lEXTRA STATS §6<")) { createEvent(new DungeonNodataEvent("DUNGEON_END")); + ended = true; } } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java index dece169d..08be4b8e 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java @@ -31,7 +31,11 @@ import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonSpecificDataProviderRegistry; import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonSpecificDataProvider; import kr.syeyoung.dungeonsguide.events.DungeonContextInitializationEvent; +import kr.syeyoung.dungeonsguide.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.stomp.StompPayload; import kr.syeyoung.dungeonsguide.utils.MapUtils; +import kr.syeyoung.dungeonsguide.wsresource.StaticResource; +import kr.syeyoung.dungeonsguide.wsresource.StaticResourceCache; import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; @@ -41,12 +45,14 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.*; import net.minecraft.world.storage.MapData; import net.minecraftforge.common.MinecraftForge; +import org.json.JSONObject; import javax.vecmath.Vector2d; import javax.vecmath.Vector2f; import java.awt.*; import java.util.*; import java.util.List; +import java.util.concurrent.ExecutionException; public class MapProcessor { @@ -382,6 +388,39 @@ public class MapProcessor { } private int stabilizationTick = 0; + private boolean processed = false; + private void processFinishedMap(byte[] mapData) { + if (MapUtils.getMapColorAt(mapData, 0, 0) == 0) return; + if (processed) return; + processed = true; + MapUtils.clearMap(); + MapUtils.record(mapData, 0, 0, Color.GREEN); + + int skill = MapUtils.readNumber(mapData, 51, 35, 9); + int exp = MapUtils.readNumber(mapData, 51, 54, 9); + int time = MapUtils.readNumber(mapData, 51, 73, 9); + int bonus = MapUtils.readNumber(mapData, 51, 92, 9); + DungeonsGuide.sendDebugChat(new ChatComponentText(("skill: " + skill + " / exp: " + exp + " / time: " + time + " / bonus : " + bonus))); + + System.out.println(new JSONObject().put("timeSB", FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed()) + .put("timeR", FeatureRegistry.DUNGEON_REALTIME.getTimeElapsed()) + .put("timeScore", time) + .put("floor", DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName()).toString()); + + try { + String target = StaticResourceCache.INSTANCE.getResource(StaticResourceCache.DATA_COLLECTION).get().getValue(); + if (FeatureRegistry.ETC_COLLECT_SCORE.isEnabled() && !target.contains("false")) { + + DungeonsGuide.getDungeonsGuide().getStompConnection().send(new StompPayload().payload(new JSONObject().put("timeSB", FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed()) + .put("timeR", FeatureRegistry.DUNGEON_REALTIME.getTimeElapsed()) + .put("timeScore", time) + .put("floor", DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName()).toString()).header("destination", target.trim())); + } + } catch (Throwable e) { + e.printStackTrace(); + } + } + public void tick() { if (waitCnt < 5) { waitCnt++; @@ -409,6 +448,10 @@ public class MapProcessor { if (stabilizationTick > 20) { if (doorDimension == null) buildMap(mapData); else processMap(mapData); + + if (context.isEnded()) { + processFinishedMap(mapData); + } } lastMapData = mapData; } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDataProvider.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDataProvider.java index 79277c98..92bfd218 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDataProvider.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDataProvider.java @@ -124,4 +124,46 @@ public class CatacombDataProvider implements DungeonSpecificDataProvider { return true; } else return floor.equals("F7"); } + + @Override + public double secretPercentage(String dungeonName) { + String floor = dungeonName.substring(14).trim(); + if (floor.equals("F1")) { + return 0.3; + } else if (floor.equals("F2")) { + return 0.4; + } else if (floor.equals("F3")) { + return 0.5; + } else if (floor.equals("F4")) { + return 0.6; + } else if (floor.equals("F5")) { + return 0.7; + } else if (floor.equals("F6")) { + return 0.85; + } else if (floor.equals("F7")) { + return 1.0; + } + return 1.0; + } + + @Override + public int speedSecond(String dungeonName) { + String floor = dungeonName.substring(14).trim(); + if (floor.equals("F1")) { + return 600; + } else if (floor.equals("F2")) { + return 600; + } else if (floor.equals("F3")) { + return 600; + } else if (floor.equals("F4")) { + return 720; + } else if (floor.equals("F5")) { + return 600; + } else if (floor.equals("F6")) { + return 720; + } else if (floor.equals("F7")) { + return 720; + } + return 600; + } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombMasterDataProvider.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombMasterDataProvider.java index 54c8f3dd..4e535246 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombMasterDataProvider.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombMasterDataProvider.java @@ -109,4 +109,14 @@ public class CatacombMasterDataProvider implements DungeonSpecificDataProvider { return true; } else return floor.equals("M7"); } + + @Override + public double secretPercentage(String dungeonName) { + return 1.0; + } + + @Override + public int speedSecond(String dungeonName) { + return 480; + } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/DungeonSpecificDataProvider.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/DungeonSpecificDataProvider.java index 94af0922..dfdd0e3e 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/DungeonSpecificDataProvider.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/DungeonSpecificDataProvider.java @@ -32,4 +32,8 @@ public interface DungeonSpecificDataProvider { BossfightProcessor createBossfightProcessor(World w, String dungeonName); boolean isTrapSpawn(String dungeonName); + + double secretPercentage(String dungeonName); + + int speedSecond(String dungeonName); }
\ No newline at end of file diff --git a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java index 9f2e0c61..bc6380b2 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java @@ -198,7 +198,8 @@ public class DungeonListener { if ((isOnDungeon && !skyblockStatus.isOnDungeon())) { MinecraftForge.EVENT_BUS.post(new DungeonLeftEvent()); skyblockStatus.setContext(null); - MapUtils.clearMap(); + if (!FeatureRegistry.ADVANCED_DEBUGGABLE_MAP.isEnabled()) + MapUtils.clearMap(); return; } if (isOnSkyblock) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java index bb04bba9..16201dcb 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java @@ -182,6 +182,8 @@ public class FeatureRegistry { public static final FeaturePenguins ETC_PENGUIN = register(new FeaturePenguins()); + public static final FeatureCollectScore ETC_COLLECT_SCORE = register(new FeatureCollectScore()); + diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebuggableMap.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebuggableMap.java index 2ff3ec28..2a2b1a39 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebuggableMap.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebuggableMap.java @@ -55,12 +55,14 @@ public class FeatureDebuggableMap extends GuiFeature { SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); @Override public void drawHUD(float partialTicks) { - if (!skyblockStatus.isOnDungeon()) return; +// if (!skyblockStatus.isOnDungeon()) return; if (!FeatureRegistry.DEBUG.isEnabled()) return; - DungeonContext context = skyblockStatus.getContext(); - if (context == null) return; +// DungeonContext context = skyblockStatus.getContext(); +// if (context == null) return; GlStateManager.pushMatrix(); + double factor = getFeatureRect().getRectangle().getWidth() / 128; + GlStateManager.scale(factor, factor, 1); int[] textureData = dynamicTexture.getTextureData(); MapUtils.getImage().getRGB(0, 0, 128, 128, textureData, 0, 128); dynamicTexture.updateDynamicTexture(); @@ -73,10 +75,10 @@ public class FeatureDebuggableMap extends GuiFeature { if (!(Minecraft.getMinecraft().currentScreen instanceof GuiChat)) return; Rectangle featureRect = this.getFeatureRect().getRectangleNoScale(); - int i = (int) (Mouse.getEventX() - featureRect.getX()); - int j = (int) (Minecraft.getMinecraft().displayHeight - Mouse.getEventY() - featureRect.getY()); + int i = (int) ((int) (Mouse.getEventX() - featureRect.getX()) / factor); + int j = (int) ((int) (Minecraft.getMinecraft().displayHeight - Mouse.getEventY() - featureRect.getY())/ factor); if (i >= 0 && j>= 0 && i <= 128 && j <= 128 && MapUtils.getColors() != null) { - GuiUtils.drawHoveringText(Arrays.asList("Color: "+MapUtils.getColors()[j * 128 + i]),i, j, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight, -1, Minecraft.getMinecraft().fontRendererObj); + GuiUtils.drawHoveringText(Arrays.asList(i+","+j,"Color: "+MapUtils.getColors()[j * 128 + i]),(int)(Mouse.getEventX() - featureRect.getX()), (int) (Minecraft.getMinecraft().displayHeight - Mouse.getEventY() - featureRect.getY()), Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight, -1, Minecraft.getMinecraft().fontRendererObj); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureWarningOnPortal.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureWarningOnPortal.java index 4edd5cf1..2c852fdd 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureWarningOnPortal.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureWarningOnPortal.java @@ -56,7 +56,7 @@ public class FeatureWarningOnPortal extends SimpleFeature implements StyledTextP dummyText.add(new StyledText("Total Secrets","field_name")); dummyText.add(new StyledText(": ","field_separator")); - dummyText.add(new StyledText("103/100 ","field_value")); + dummyText.add(new StyledText("103/100 of 50","field_value")); dummyText.add(new StyledText("(103% 41.2 Explorer)","field_etc")); @@ -121,8 +121,8 @@ public class FeatureWarningOnPortal extends SimpleFeature implements StyledTextP texts.add(new StyledText("Total Secrets","field_name")); texts.add(new StyledText(": ","field_separator")); - texts.add(new StyledText(scoreCalculation.getSecrets() +"/" + scoreCalculation.getTotalSecrets(),"field_value")); - texts.add(new StyledText(" ("+(int)(scoreCalculation.getSecrets() / (float)scoreCalculation.getTotalSecrets() * 100.0f)+"% "+(int)(scoreCalculation.getSecrets() / (float)scoreCalculation.getTotalSecrets() * 40.0f)+" Explorer)\n","field_etc")); + texts.add(new StyledText(scoreCalculation.getSecrets() +"/" + scoreCalculation.getEffectiveTotalSecrets()+" of "+scoreCalculation.getTotalSecrets(),"field_value")); + texts.add(new StyledText(" ("+(int)(scoreCalculation.getSecrets() / (float)scoreCalculation.getEffectiveTotalSecrets() * 100.0f)+"% "+(int)(scoreCalculation.getSecrets() / (float)scoreCalculation.getEffectiveTotalSecrets() * 40.0f)+" Explorer)\n","field_etc")); texts.add(new StyledText("Crypts","field_name")); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureCollectScore.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureCollectScore.java new file mode 100644 index 00000000..f7e92262 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureCollectScore.java @@ -0,0 +1,28 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.features.impl.dungeon; + +import kr.syeyoung.dungeonsguide.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.features.listener.DungeonEndListener; + +public class FeatureCollectScore extends SimpleFeature { + public FeatureCollectScore() { + super("Misc", "Collect Speed Score", "Collect Speed score, run time, and floor and send that to developer's server for speed formula. This data is completely anonymous, opt out of the feature by disabling this feature", "misc.gatherscoredata", true); + } +} 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 e43b96ca..95ccd689 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 @@ -146,7 +146,7 @@ public class FeatureDungeonScore extends TextHUDFeature { actualBit.add(new StyledText(": ", "separator")); actualBit.add(new StyledText(score.explorer + " ", "score")); actualBit.add(new StyledText("(", "brackets")); - actualBit.add(new StyledText("Rooms " + (score.fullyCleared ? "O" : "X") + " Secrets " + score.secrets + "/" + score.totalSecrets + (score.totalSecretsKnown ? "" : "?"), "etc")); + actualBit.add(new StyledText("Rooms " + (score.fullyCleared ? "O" : "X") + " Secrets " + score.secrets + "/" + score.effectiveTotalSecrets +" of "+score.getTotalSecrets() + (score.totalSecretsKnown ? "" : "?"), "etc")); actualBit.add(new StyledText(")\n", "brackets")); actualBit.add(new StyledText("Time", "scorename")); actualBit.add(new StyledText(": ", "separator")); @@ -176,7 +176,7 @@ public class FeatureDungeonScore extends TextHUDFeature { public static class ScoreCalculation { private int skill, explorer, time, bonus, tombs; private boolean fullyCleared; - private int secrets, totalSecrets; + private int secrets, totalSecrets, effectiveTotalSecrets; private boolean totalSecretsKnown; private int deaths; } @@ -259,33 +259,27 @@ public class FeatureDungeonScore extends TextHUDFeature { double total = 0; for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { - if (dungeonRoom.getTotalSecrets() != -1) - totalSecrets += dungeonRoom.getTotalSecrets(); - else totalSecretsKnown = false; if (dungeonRoom.getCurrentState() != DungeonRoom.RoomState.DISCOVERED && dungeonRoom.getCurrentState() != DungeonRoom.RoomState.FAILED) completed += dungeonRoom.getUnitPoints().size(); total += dungeonRoom.getUnitPoints().size(); } + totalSecrets = FeatureRegistry.DUNGEON_SECRETS.getTotalSecretsInt() ; + totalSecretsKnown = FeatureRegistry.DUNGEON_SECRETS.sureOfTotalSecrets(); + fullyCleared = completed >= getTotalRooms() && context.getMapProcessor().getUndiscoveredRoom() == 0; 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); + explorer += MathHelper.clamp_int((int) Math.floor(40 * (secrets = FeatureRegistry.DUNGEON_SECRETS.getSecretsFound()) / (totalSecrets * context.getSecretPercentage())),0,40); } int time = 0; { - double timeModifier; - int timeModifierModifier = - DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName().substring(14).trim().equals("F2") ? -120 : 0; - if (context.getBossRoomEnterSeconds() != -1) { - timeModifier = Math.max(0, context.getBossRoomEnterSeconds() - timeModifierModifier); - } else { - timeModifier = Math.max(0, FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed() / 1000 - timeModifierModifier); - } + int maxTime = context.getMaxSpeed(); + int timeSec = FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed() / 1000; - if (timeModifier <= 1320) time = 100; - else if (timeModifier <= 1420) time = (int) Math.ceil(232 - 0.1 * timeModifier); - else if (timeModifier <= 1820) time = (int) Math.ceil(161 - 0.05 * timeModifier); - else if (timeModifier < 3920) time = (int) Math.ceil(392/3.0 - (1/30.0) * timeModifier); + if (timeSec <= maxTime) time = 100; + else if (timeSec <= maxTime+100) time = (int) Math.ceil(232 - 0.1 * timeSec); + else if (timeSec <= maxTime+500) time = (int) Math.ceil(161 - 0.05 * timeSec); + else if (timeSec < maxTime+2600) time = (int) Math.ceil(392/3.0 - (1/30.0) * timeSec); } int bonus = 0; int tombs; @@ -303,7 +297,7 @@ public class FeatureDungeonScore extends TextHUDFeature { } // amazing thing - return new ScoreCalculation(skill, explorer, time, bonus, tombs, fullyCleared, secrets, totalSecrets, totalSecretsKnown, deaths); + return new ScoreCalculation(skill, explorer, time, bonus, tombs, fullyCleared, secrets, totalSecrets, (int) (totalSecrets * context.getSecretPercentage()), totalSecretsKnown, deaths); } public String getLetter(int score) { if (score <= 99) return "D"; @@ -346,7 +340,7 @@ public class FeatureDungeonScore extends TextHUDFeature { int tombsBreakable = Math.min(5 - calculation.tombs, reqPT); reqPT -= tombsBreakable; - double secretPer = 40.0 / calculation.totalSecrets; + double secretPer = 40.0 / calculation.effectiveTotalSecrets; int secrets = (int) Math.ceil(reqPT / secretPer); actualBit.add(new StyledText(currentLetter,"currentScore")); 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 75498427..b35d93d9 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 @@ -37,7 +37,7 @@ import java.util.List; public class FeatureDungeonSecrets extends TextHUDFeature { public FeatureDungeonSecrets() { - super("Dungeon.Dungeon Information", "Display Total # of 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.Dungeon Information", "Display Total # of 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+ of 999+"), getFontRenderer().FONT_HEIGHT); this.setEnabled(false); 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)); @@ -51,15 +51,26 @@ public class FeatureDungeonSecrets extends TextHUDFeature { public int getSecretsFound() { 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.startsWith("§r Secrets Found: §r§b")) { + if (name.startsWith("§r Secrets Found: §r§b") && !name.contains("%")) { String noColor = TextUtils.stripColor(name); return Integer.parseInt(noColor.substring(16)); } } return 0; } + public double getSecretPercentage() { + 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.startsWith("§r Secrets Found: §r") && name.contains("%")) { + String noColor = TextUtils.stripColor(name); + return Double.parseDouble(noColor.substring(16).replace("%", "")); + } + } + return 0; + } public int getTotalSecretsInt() { + if (getSecretsFound() != 0) return (int) (getSecretsFound() / getSecretPercentage() * 100); DungeonContext context = skyblockStatus.getContext(); int totalSecrets = 0; for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { @@ -69,6 +80,7 @@ public class FeatureDungeonSecrets extends TextHUDFeature { return totalSecrets; } public boolean sureOfTotalSecrets() { + if (getSecretsFound() != 0) return true; DungeonContext context = skyblockStatus.getContext(); if (context.getMapProcessor().getUndiscoveredRoom() > 0) return false; boolean allknown = true; @@ -124,7 +136,7 @@ public class FeatureDungeonSecrets extends TextHUDFeature { actualBit.add(new StyledText(": ","separator")); actualBit.add(new StyledText(getSecretsFound() +"","currentSecrets")); actualBit.add(new StyledText("/","separator2")); - actualBit.add(new StyledText(getTotalSecrets().replace("+", ""),"totalSecrets")); + actualBit.add(new StyledText((int)(getTotalSecretsInt() * DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getContext().getSecretPercentage())+" of "+getTotalSecretsInt(),"totalSecrets")); actualBit.add(new StyledText(getTotalSecrets().contains("+") ? "+" : "","unknown")); return actualBit; } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/FeatureCustomPartyFinder.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/FeatureCustomPartyFinder.java index ef8dd47e..37669835 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/FeatureCustomPartyFinder.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/FeatureCustomPartyFinder.java @@ -103,7 +103,6 @@ public class FeatureCustomPartyFinder extends SimpleFeature implements GuiOpenLi for (int i = 0; i < nbttaglist1.tagCount(); i++) { String str = nbttaglist1.getStringTagAt(i); - System.out.println(str); if (str.startsWith("§aCurrently Selected")) { lastClass = str.substring(24); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/utils/MapUtils.java b/src/main/java/kr/syeyoung/dungeonsguide/utils/MapUtils.java index f3bf6065..8fb90ec1 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/utils/MapUtils.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/utils/MapUtils.java @@ -132,4 +132,46 @@ public class MapUtils { return -1; } + + public static boolean matches(byte[] colors, byte[] stencil, int targetColor, int x, int y) { + for (int i = y; i < y + stencil.length; i++) { + for (int j = x; j < x + 8; j++) { + boolean current = getMapColorAt(colors, j, i) == targetColor; + boolean expected = ((stencil[i - y] >> (7-(j-x))) & 0x1) == 1; + if (current != expected) return false; + } + } + return true; + } + + public static int readDigit(byte[] colors, int x, int y) { + for (int i = 0; i < NUMBER_STENCIL.length; i++) { + if (matches(colors, NUMBER_STENCIL[i],34, x, y)) return i; + } + return -1; + } + public static int readNumber(byte[] colors, int x, int y, int gap) { + int number = 0; + for (int i = x; i < 128; i += gap) { + int digit = readDigit(colors, i, y); + if (digit != -1) number = number * 10 + digit; + } + return number; + } + + private static final byte[][] NUMBER_STENCIL = { + {0x0, 0x7F, 0x7F, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x7F, 0x7F, 0x0}, + {0x0, 0x1E, 0x1E, 0x1E, 0xE, 0xE, 0xE, 0xE, 0xE, 0xE, 0xE, 0xE, 0xE, 0x0}, + {0x0, 0x7F, 0x7F, 0x7F, 0x77, 0x77, 0x7, 0x7F, 0x7F, 0x70, 0x7F, 0x7F, 0x7F, 0x0}, + {0x0, 0x7F, 0x7F, 0x7F, 0x7, 0x7, 0x1F, 0x1F, 0x7, 0x7, 0x7F, 0x7F, 0x7F, 0x0}, + {0x0, 0x6E, 0x6E, 0x6E, 0x6E, 0x6E, 0x6E, 0x7F, 0x7F, 0x7F, 0xE, 0xE, 0xE, 0x0}, + {0x0, 0x7F, 0x7F, 0x7F, 0x70, 0x7F, 0x7F, 0x7, 0x77, 0x77, 0x7F, 0x7F, 0x7F, 0x0}, + {0x0, 0x7F, 0x7F, 0x7F, 0x70, 0x7F, 0x7F, 0x77, 0x77, 0x77, 0x77, 0x7F, 0x7F, 0x0}, + {0x0, 0x7F, 0x7F, 0x7F, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x0}, + {0x0, 0x7F, 0x7F, 0x77, 0x77, 0x77, 0x3E, 0x77, 0x77, 0x77, 0x77, 0x7F, 0x7F, 0x0}, + {0x0, 0x7F, 0x7F, 0x77, 0x77, 0x77, 0x77, 0x7F, 0x7F, 0x7, 0x7F, 0x7F, 0x7F, 0x0} + }; + + + } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/wsresource/StaticResourceCache.java b/src/main/java/kr/syeyoung/dungeonsguide/wsresource/StaticResourceCache.java index b134b7c3..db781844 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/wsresource/StaticResourceCache.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/wsresource/StaticResourceCache.java @@ -74,8 +74,10 @@ public class StaticResourceCache implements StompMessageHandler { getResource(BONUS_SCORE); getResource(TRIVIA_ANSWERS); + getResource(DATA_COLLECTION); } public static final UUID BONUS_SCORE = UUID.fromString("13f10001-66b5-46e5-94f9-1a5161a23429"); public static final UUID TRIVIA_ANSWERS = UUID.fromString("5657f2cc-2bb8-4fcd-b55c-ffc0a35b9349"); + public static final UUID DATA_COLLECTION = UUID.fromString("c11f026f-9f26-4d14-8d52-88325dd6397a"); } |