diff options
author | syeyoung <cyougn06@naver.com> | 2021-12-19 02:29:11 +0900 |
---|---|---|
committer | syeyoung <cyougn06@naver.com> | 2021-12-19 02:29:11 +0900 |
commit | 5fd8d7844b5a77f2a85c9a92aaea967dd2a8932d (patch) | |
tree | c12e07dc3dbc21516e44127b3be14b16203274c2 /src/main/java/kr/syeyoung/dungeonsguide/dungeon | |
parent | 7b7d13ede25aa3022cfbd03763ca9ee82ca12656 (diff) | |
download | Skyblock-Dungeons-Guide-5fd8d7844b5a77f2a85c9a92aaea967dd2a8932d.tar.gz Skyblock-Dungeons-Guide-5fd8d7844b5a77f2a85c9a92aaea967dd2a8932d.tar.bz2 Skyblock-Dungeons-Guide-5fd8d7844b5a77f2a85c9a92aaea967dd2a8932d.zip |
- Collect Score
- New Score Update
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/dungeon')
5 files changed, 112 insertions, 2 deletions
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 |