aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/features
diff options
context:
space:
mode:
authorsyeyoung <cyong06@naver.com>2021-01-04 21:45:04 +0900
committersyeyoung <cyong06@naver.com>2021-01-04 21:45:04 +0900
commit04d414547e4d932f4db9a74dbc4aea8d75b96960 (patch)
treeacfccab2803dc6161e4ce099021d2fa972967ace /src/main/java/kr/syeyoung/dungeonsguide/features
parentece0af65a8bba6c722ac6f0853c570d2e8cad784 (diff)
downloadSkyblock-Dungeons-Guide-04d414547e4d932f4db9a74dbc4aea8d75b96960.tar.gz
Skyblock-Dungeons-Guide-04d414547e4d932f4db9a74dbc4aea8d75b96960.tar.bz2
Skyblock-Dungeons-Guide-04d414547e4d932f4db9a74dbc4aea8d75b96960.zip
Various things
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/features')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java23
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java14
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonDeaths.java96
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonMilestone.java74
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonRealTime.java57
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonSBTime.java92
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonScore.java167
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonSecrets.java71
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonTombs.java50
9 files changed, 628 insertions, 16 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java
index 6a66a13f..04e938ab 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java
@@ -30,6 +30,9 @@ public class FeatureRegistry {
return abstractFeature;
}
+ public static final SimpleFeature DEBUG = register(new SimpleFeature("hidden", "Debug", "Toggles debug mode", "debug", false));
+
+ public static final SimpleFeature ADVANCED_ROOMEDIT = register(new SimpleFeature("advanced", "Room Edit", "Allow editing dungeon rooms\n\nWarning: using this feature can break or freeze your Minecraft\nThis is only for advanced users only", "advanced.roomedit", false));
public static final SimpleFeature SOLVER_RIDDLE = register(new SimpleFeature("solver", "Riddle Puzzle (3 weirdo) Solver", "Highlights the correct box after clicking on all 3 weirdos", "solver.riddle"));
public static final SimpleFeature SOLVER_KAHOOT = register(new SimpleFeature("solver", "Trivia Puzzle (Omnicrescent) Solver", "Highlights the correct solution for trivia puzzle", "solver.trivia"));
@@ -42,17 +45,21 @@ public class FeatureRegistry {
public static final SimpleFeature SOLVER_CREEPER = register(new SimpleFeature("solver", "Creeper Puzzle Solver", "Draws line between prismarine lamps in creeper room", "solver.creeper"));
public static final SimpleFeature SOLVER_TELEPORT = register(new SimpleFeature("solver", "Teleport Puzzle Solver", "Shows teleport pads you've visited in a teleport maze room", "solver.teleport"));
- public static final FeatureTooltipDungeonStat TOOLTIP_DUNGEONSTAT = register(new FeatureTooltipDungeonStat());
- public static final FeatureTooltipPrice TOOLTIP_PRICE = register(new FeatureTooltipPrice());
-
- public static final SimpleFeature ADVANCED_ROOMEDIT = register(new SimpleFeature("advanced", "Room Edit", "Allow editing dungeon rooms\n\nWarning: using this feature can break or freeze your Minecraft\nThis is only for advanced users only", "advanced.roomedit", false));
+ public static final FeatureTooltipDungeonStat ETC_DUNGEONSTAT = register(new FeatureTooltipDungeonStat());
+ public static final FeatureTooltipPrice ETC_PRICE = register(new FeatureTooltipPrice());
+ public static final FeatureCooldownCounter ETC_COOLDOWN = register(new FeatureCooldownCounter());
+ 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 SimpleFeature DEBUG = register(new SimpleFeature("hidden", "Debug", "Toggles debug mode", "debug", false));
+ public static final SimpleFeature BOSSFIGHT_CHESTPRICE = register(new FeatureChestPrice());
- public static final FeatureCooldownCounter HUD_COOLDOWN = register(new FeatureCooldownCounter());
public static final FeatureInstaCloseChest DUNGEON_INSTACLOSE = register(new FeatureInstaCloseChest());
public static final FeatureBoxSkelemaster DUNGEON_BOXSKELEMASTER = register(new FeatureBoxSkelemaster());
- 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 SimpleFeature BOSSFIGHT_CHESTPRICE = register(new FeatureChestPrice());
+ public static final FeatureDungeonDeaths DUNGEON_DEATHS = register(new FeatureDungeonDeaths());
+ public static final FeatureDungeonMilestone DUNGEON_MILESTONE = register(new FeatureDungeonMilestone());
+ 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 FeatureDungeonTombs DUNGEON_TOMBS = register(new FeatureDungeonTombs());
+ public static final FeatureDungeonScore DUNGEON_SCORE = register(new FeatureDungeonScore());
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java
index d9d964c1..192ad10c 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java
@@ -9,6 +9,7 @@ import lombok.Setter;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import org.lwjgl.opengl.GL11;
@@ -39,21 +40,18 @@ public abstract class GuiFeature extends AbstractFeature implements ScreenRender
@Override
public void drawScreen(float partialTicks) {
if (!isEnabled()) return;
- GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
+ GL11.glPushMatrix();
+// GL11.glColor4f(1,1,1,1);
+ GlStateManager.disableFog();
+ GlStateManager.disableLighting();
clip(new ScaledResolution(Minecraft.getMinecraft()), featureRect.x, featureRect.y, featureRect.width, featureRect.height);
GL11.glEnable(GL11.GL_SCISSOR_TEST);
-// GL11.glEnable(GL11.GL_BLEND);
-// OpenGlHelper.glBlendFunc(770, 771, 1, 0);
-// GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
-
- GL11.glPushMatrix();
GL11.glTranslated(featureRect.x, featureRect.y, 0);
drawHUD(partialTicks);
- GL11.glPopMatrix();
GL11.glDisable(GL11.GL_SCISSOR_TEST);
- GL11.glPopAttrib();
+ GL11.glPopMatrix();
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonDeaths.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonDeaths.java
new file mode 100644
index 00000000..ff3be74b
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonDeaths.java
@@ -0,0 +1,96 @@
+package kr.syeyoung.dungeonsguide.features.impl;
+
+import kr.syeyoung.dungeonsguide.SkyblockStatus;
+import kr.syeyoung.dungeonsguide.dungeon.DungeonContext;
+import kr.syeyoung.dungeonsguide.e;
+import kr.syeyoung.dungeonsguide.features.FeatureParameter;
+import kr.syeyoung.dungeonsguide.features.GuiFeature;
+import kr.syeyoung.dungeonsguide.features.listener.ChatListener;
+import kr.syeyoung.dungeonsguide.features.listener.TickListener;
+import kr.syeyoung.dungeonsguide.utils.TextUtils;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.util.ChatComponentText;
+import net.minecraftforge.client.event.ClientChatReceivedEvent;
+import org.lwjgl.opengl.GL11;
+
+import java.awt.*;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class FeatureDungeonDeaths extends GuiFeature implements ChatListener {
+ public FeatureDungeonDeaths() {
+ super("Dungeon", "Display Deaths", "Display names of player and death count in dungeon run", "dungeon.stats.deaths", false, getFontRenderer().getStringWidth("longestplayernamepos: 100"), getFontRenderer().FONT_HEIGHT * 6);
+ this.setEnabled(false);
+ parameters.put("color", new FeatureParameter<Color>("color", "Color", "Color of text", Color.orange, "color"));
+ }
+
+ SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus();
+ @Override
+ public void drawHUD(float partialTicks) {
+ if (!skyblockStatus.isOnDungeon()) return;
+ DungeonContext context = skyblockStatus.getContext();
+ if (context == null) return;
+ Map<String, Integer> deaths = context.getDeaths();
+ int i = 0;
+ int deathsCnt = 0;
+ FontRenderer fr = getFontRenderer();
+ for (Map.Entry<String, Integer> death:deaths.entrySet()) {
+ fr.drawString(death.getKey()+": "+death.getValue(), 0,i, this.<Color>getParameter("color").getValue().getRGB());
+ i += 8;
+ deathsCnt += death.getValue();
+ }
+ fr.drawString("Total Deaths: "+deathsCnt, 0,i, this.<Color>getParameter("color").getValue().getRGB());
+ }
+
+ public int getTotalDeaths() {
+ if (!skyblockStatus.isOnDungeon()) return 0;
+ DungeonContext context = skyblockStatus.getContext();
+ if (context == null) return 0;
+ int d = 0;
+ for (Integer value : context.getDeaths().values()) {
+ d += value;
+ }
+ return d;
+ }
+
+ @Override
+ public void drawDemo(float partialTicks) {
+ FontRenderer fr = getFontRenderer();
+ fr.drawString("syeyoung: -130", 0,0, this.<Color>getParameter("color").getValue().getRGB());
+ fr.drawString("notsyeyoung: -13", 0,8, this.<Color>getParameter("color").getValue().getRGB());
+ fr.drawString("dungeonsguide: -42", 0,16, this.<Color>getParameter("color").getValue().getRGB());
+ fr.drawString("--not more--", 0,24, this.<Color>getParameter("color").getValue().getRGB());
+ fr.drawString("--maybe more--", 0,32, this.<Color>getParameter("color").getValue().getRGB());
+ fr.drawString("Total Deaths: 0", 0,40, this.<Color>getParameter("color").getValue().getRGB());
+ }
+
+ Pattern deathPattern = Pattern.compile("§r§c ☠ (.+?)§r§7 .+and became a ghost.+");
+ Pattern meDeathPattern = Pattern.compile("§r§c ☠ §r§7You .+and became a ghost.+");
+
+ @Override
+ public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) {
+ if (clientChatReceivedEvent.type == 2) return;
+ System.out.println("HUH");
+ if (!skyblockStatus.isOnDungeon()) return;
+ DungeonContext context = skyblockStatus.getContext();
+ if (context == null) return;
+
+ String txt = clientChatReceivedEvent.message.getFormattedText();
+ System.out.println(txt);
+ 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;
+ context.getDeaths().put(nickname, deaths + 1);
+ e.sendDebugChat(new ChatComponentText("Death verified :: "+nickname+" / "+(deaths + 1)));
+ }
+ Matcher m2 = meDeathPattern.matcher(txt);
+ if (m2.matches()) {
+ String nickname = "me";
+ int deaths = context.getDeaths().containsKey(nickname) ? context.getDeaths().get(nickname) : 0;
+ context.getDeaths().put(nickname, deaths + 1);
+ e.sendDebugChat(new ChatComponentText("Death verified :: me / "+(deaths + 1)));
+ }
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonMilestone.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonMilestone.java
new file mode 100644
index 00000000..9ccd5e18
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonMilestone.java
@@ -0,0 +1,74 @@
+package kr.syeyoung.dungeonsguide.features.impl;
+
+import kr.syeyoung.dungeonsguide.SkyblockStatus;
+import kr.syeyoung.dungeonsguide.dungeon.DungeonContext;
+import kr.syeyoung.dungeonsguide.e;
+import kr.syeyoung.dungeonsguide.features.FeatureParameter;
+import kr.syeyoung.dungeonsguide.features.FeatureRegistry;
+import kr.syeyoung.dungeonsguide.features.GuiFeature;
+import kr.syeyoung.dungeonsguide.features.listener.ChatListener;
+import kr.syeyoung.dungeonsguide.features.listener.TickListener;
+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.ScorePlayerTeam;
+import net.minecraft.util.ChatComponentText;
+import net.minecraftforge.client.event.ClientChatReceivedEvent;
+import org.lwjgl.opengl.GL11;
+
+import java.awt.*;
+import java.util.regex.Pattern;
+
+public class FeatureDungeonMilestone extends GuiFeature implements ChatListener {
+ public FeatureDungeonMilestone() {
+ super("Dungeon", "Display Current Class Milestone", "Display current class milestone of yourself", "dungeon.stats.milestone", true, getFontRenderer().getStringWidth("Milestone: 12"), getFontRenderer().FONT_HEIGHT);
+ this.setEnabled(false);
+ parameters.put("color", new FeatureParameter<Color>("color", "Color", "Color of text", Color.orange, "color"));
+ }
+
+ SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus();
+ @Override
+ public void drawHUD(float partialTicks) {
+ if (!skyblockStatus.isOnDungeon()) return;
+ FontRenderer fr = getFontRenderer();
+ double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT;
+ GL11.glScaled(scale, scale, 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.startsWith("§r Milestone: §r")) {
+ String milestone = TextUtils.stripColor(name).substring(13);
+ fr.drawString("Milestone: "+milestone, 0,0, this.<Color>getParameter("color").getValue().getRGB());
+ return;
+ }
+ }
+ fr.drawString("Milestone: ?", 0,0, this.<Color>getParameter("color").getValue().getRGB());
+ }
+
+ @Override
+ public void drawDemo(float partialTicks) {
+ FontRenderer fr = getFontRenderer();
+ double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT;
+ GL11.glScaled(scale, scale, 0);
+ fr.drawString("Milestone: 9", 0,0, this.<Color>getParameter("color").getValue().getRGB());
+ }
+ public static final Pattern milestone_pattern = Pattern.compile("§r§e§l(.+) Milestone §r§e(.)§r§7: .+ §r§a(.+)§r");
+
+
+ @Override
+ public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) {
+ if (clientChatReceivedEvent.type == 2) return;;
+ if (!skyblockStatus.isOnDungeon()) return;
+ DungeonContext context = skyblockStatus.getContext();
+ if (context == null) return;
+ String txt = clientChatReceivedEvent.message.getFormattedText();
+ System.out.println(txt);
+ if (milestone_pattern.matcher(txt).matches()) {
+ context.getMilestoneReached().add(new String[] {
+ TextUtils.formatTime(FeatureRegistry.DUNGEON_REALTIME.getTimeElapsed()),
+ TextUtils.formatTime(FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed())
+ });
+ e.sendDebugChat(new ChatComponentText("Reached Milestone At " + TextUtils.formatTime(FeatureRegistry.DUNGEON_REALTIME.getTimeElapsed()) + " / "+TextUtils.formatTime(FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed())));
+ }
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonRealTime.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonRealTime.java
new file mode 100644
index 00000000..9b2620e4
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonRealTime.java
@@ -0,0 +1,57 @@
+package kr.syeyoung.dungeonsguide.features.impl;
+
+import kr.syeyoung.dungeonsguide.SkyblockStatus;
+import kr.syeyoung.dungeonsguide.e;
+import kr.syeyoung.dungeonsguide.features.FeatureParameter;
+import kr.syeyoung.dungeonsguide.features.GuiFeature;
+import kr.syeyoung.dungeonsguide.features.listener.ChatListener;
+import kr.syeyoung.dungeonsguide.features.listener.TickListener;
+import kr.syeyoung.dungeonsguide.utils.TextUtils;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraftforge.client.event.ClientChatReceivedEvent;
+import org.lwjgl.opengl.GL11;
+
+import java.awt.*;
+import java.text.SimpleDateFormat;
+
+public class FeatureDungeonRealTime extends GuiFeature implements TickListener {
+ public FeatureDungeonRealTime() {
+ super("Dungeon", "Display Real Time-Dungeon Time", "Display how much real time has passed since dungeon run started", "dungeon.stats.realtime", true, getFontRenderer().getStringWidth("Time(Real): 59m 59s"), getFontRenderer().FONT_HEIGHT);
+ this.setEnabled(false);
+ parameters.put("color", new FeatureParameter<Color>("color", "Color", "Color of text", Color.orange, "color"));
+ }
+
+ private long started = -1;
+ @Override
+ public void drawHUD(float partialTicks) {
+ if (started == -1) return;
+ FontRenderer fr = getFontRenderer();
+ double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT;
+ GL11.glScaled(scale, scale, 0);
+ fr.drawString("Time(Real): "+TextUtils.formatTime(getTimeElapsed()), 0,0, this.<Color>getParameter("color").getValue().getRGB());
+ }
+
+ public long getTimeElapsed() {
+ return System.currentTimeMillis() - started;
+ }
+
+ @Override
+ public void drawDemo(float partialTicks) {
+ FontRenderer fr = getFontRenderer();
+ double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT;
+ GL11.glScaled(scale, scale, 0);
+ fr.drawString("Time(Real): -42h", 0,0, this.<Color>getParameter("color").getValue().getRGB());
+ }
+
+ SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus();
+ private boolean wasInDungeon = false;
+ @Override
+ public void onTick() {
+ if (wasInDungeon && !skyblockStatus.isOnDungeon()) {
+ if (skyblockStatus.isOnSkyblock()) started = -1;
+ } else if (!wasInDungeon && skyblockStatus.isOnDungeon()) {
+ started = System.currentTimeMillis();
+ }
+ wasInDungeon = skyblockStatus.isOnDungeon();
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonSBTime.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonSBTime.java
new file mode 100644
index 00000000..65f06f58
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonSBTime.java
@@ -0,0 +1,92 @@
+package kr.syeyoung.dungeonsguide.features.impl;
+
+import kr.syeyoung.dungeonsguide.SkyblockStatus;
+import kr.syeyoung.dungeonsguide.e;
+import kr.syeyoung.dungeonsguide.features.FeatureParameter;
+import kr.syeyoung.dungeonsguide.features.GuiFeature;
+import kr.syeyoung.dungeonsguide.features.listener.ChatListener;
+import kr.syeyoung.dungeonsguide.features.listener.TickListener;
+import kr.syeyoung.dungeonsguide.utils.TextUtils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.scoreboard.Score;
+import net.minecraft.scoreboard.ScoreObjective;
+import net.minecraft.scoreboard.ScorePlayerTeam;
+import net.minecraft.scoreboard.Scoreboard;
+import net.minecraftforge.client.event.ClientChatReceivedEvent;
+import org.lwjgl.opengl.GL11;
+
+import java.awt.*;
+import java.util.Collection;
+
+public class FeatureDungeonSBTime extends GuiFeature implements TickListener {
+ public FeatureDungeonSBTime() {
+ super("Dungeon", "Display Ingame Dungeon Time", "Display how much time skyblock thinks has passed since dungeon run started", "dungeon.stats.igtime", true, getFontRenderer().getStringWidth("Time(IG): 1h 59m 59s"), getFontRenderer().FONT_HEIGHT);
+ this.setEnabled(false);
+ parameters.put("color", new FeatureParameter<Color>("color", "Color", "Color of text", Color.orange, "color"));
+ }
+
+ private long started = -1;
+ @Override
+ public void drawHUD(float partialTicks) {
+ if (started == -1) return;
+ FontRenderer fr = getFontRenderer();
+ double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT;
+ GL11.glScaled(scale, scale, 0);
+ Scoreboard scoreboard = Minecraft.getMinecraft().theWorld.getScoreboard();
+ ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(1);
+ Collection<Score> scores = scoreboard.getSortedScores(objective);
+ String time = "idkyet";
+ for (Score sc:scores) {
+ ScorePlayerTeam scorePlayerTeam = scoreboard.getPlayersTeam(sc.getPlayerName());
+ String strippedLine = TextUtils.keepScoreboardCharacters(TextUtils.stripColor(ScorePlayerTeam.formatPlayerName(scorePlayerTeam, sc.getPlayerName()))).trim();
+ if (strippedLine.startsWith("Time Elapsed: ")) {
+ time = strippedLine.substring(14);
+ }
+ }
+ fr.drawString("Time(Ig): "+time, 0,0, this.<Color>getParameter("color").getValue().getRGB());
+ }
+ public int getTimeElapsed() {
+ Scoreboard scoreboard = Minecraft.getMinecraft().theWorld.getScoreboard();
+ ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(1);
+ Collection<Score> scores = scoreboard.getSortedScores(objective);
+ String time = "idkyet";
+ for (Score sc:scores) {
+ ScorePlayerTeam scorePlayerTeam = scoreboard.getPlayersTeam(sc.getPlayerName());
+ String strippedLine = TextUtils.keepScoreboardCharacters(TextUtils.stripColor(ScorePlayerTeam.formatPlayerName(scorePlayerTeam, sc.getPlayerName()))).trim();
+ if (strippedLine.startsWith("Time Elapsed: ")) {
+ time = strippedLine.substring(14);
+ }
+ }
+ time = time.replace(" ", "");
+ int hour = time.indexOf('h') == -1 ? 0 : Integer.parseInt(time.substring(0, time.indexOf('h')));
+ if (time.contains("h")) time = time.substring(time.indexOf('h') + 1);
+ int minute = time.indexOf('m') == -1 ? 0 : Integer.parseInt(time.substring(0, time.indexOf('m')));
+ if (time.contains("m")) time = time.substring(time.indexOf('m') + 1);
+ int second = time.indexOf('s') == -1 ? 0 : Integer.parseInt(time.substring(0, time.indexOf('s')));
+
+ int time2 = hour * 60 * 60 + minute * 60 + second;
+ return time2 * 1000;
+ }
+
+ @Override
+ public void drawDemo(float partialTicks) {
+ FontRenderer fr = getFontRenderer();
+ double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT;
+ GL11.glScaled(scale, scale, 0);
+
+ fr.drawString("Time(Ig): -42h", 0,0, this.<Color>getParameter("color").getValue().getRGB());
+ }
+
+ SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus();
+ private boolean wasInDungeon = false;
+ @Override
+ public void onTick() {
+ if (wasInDungeon && !skyblockStatus.isOnDungeon()) {
+ if (skyblockStatus.isOnSkyblock()) started = -1;
+ } else if (!wasInDungeon && skyblockStatus.isOnDungeon()) {
+ started = System.currentTimeMillis();
+ }
+ wasInDungeon = skyblockStatus.isOnDungeon();
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonScore.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonScore.java
new file mode 100644
index 00000000..024ccb67
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonScore.java
@@ -0,0 +1,167 @@
+package kr.syeyoung.dungeonsguide.features.impl;
+
+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.FeatureParameter;
+import kr.syeyoung.dungeonsguide.features.FeatureRegistry;
+import kr.syeyoung.dungeonsguide.features.GuiFeature;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.util.MathHelper;
+import org.lwjgl.opengl.GL11;
+
+import java.awt.*;
+
+public class FeatureDungeonScore extends GuiFeature {
+ public FeatureDungeonScore() {
+ super("Dungeon", "Display Current Score", "Calculate and Display current score\nThis data is from pure calculation and can be different from actual score.", "dungeon.stats.score", false, 200, getFontRenderer().FONT_HEIGHT * 4);
+ this.setEnabled(false);
+ parameters.put("color", new FeatureParameter<Color>("color", "Color", "Color of text", Color.orange, "color"));
+ parameters.put("verbose", new FeatureParameter<Boolean>("verbose", "Show each score instead of sum", "Skill: 100 Explore: 58 S->S+(5 tombs) instead of Score: 305", true, "boolean"));
+ }
+
+ SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus();
+ @Override
+ public void drawHUD(float partialTicks) {
+ if (!skyblockStatus.isOnDungeon()) return;
+ FontRenderer fr = getFontRenderer();
+ ScoreCalculation score = calculateScore();
+ int sum = score.time + score.skill + score.explorer + score.bonus;
+ if (this.<Boolean>getParameter("verbose").getValue()) {
+ String req = buildRequirement(score);
+ int rgb = this.<Color>getParameter("color").getValue().getRGB();
+ fr.drawString("Skill: "+score.skill+" ("+score.deaths+" Deaths)", 0, 0, rgb);
+ fr.drawString("Explorer: "+score.explorer+" (Rooms "+(score.fullyCleared ? "O" : "X") + " secrets "+score.secrets+"/"+score.totalSecrets+(score.totalSecretsKnown ? "": "?")+")", 0, 8, rgb);
+ fr.drawString("Time: "+score.time+" Bonus: "+score.bonus+" ::: Total: "+sum, 0, 16, rgb);
+ fr.drawString(req, 0, 24, rgb);
+ } else {
+ double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT;
+ GL11.glScaled(scale, scale, 0);
+ String letter = getLetter(sum);
+ fr.drawString("Score: "+score + "("+letter+")", 0,0, this.<Color>getParameter("color").getValue().getRGB());
+ }
+ }
+
+ @Override
+ public void drawDemo(float partialTicks) {
+ FontRenderer fr = getFontRenderer();
+ if (this.<Boolean>getParameter("verbose").getValue()) {
+ int rgb = this.<Color>getParameter("color").getValue().getRGB();
+ fr.drawString("Skill: 100 (0 Deaths)", 0, 0, rgb);
+ fr.drawString("Explorer: 99 (Rooms O 39/40)", 0, 8, rgb);
+ fr.drawString("Time: 100 Bonus: 0 Total: 299", 0, 16, rgb);
+ fr.drawString("S->S+ (1 Required 1 tomb)", 0, 24, rgb);
+ } else {
+ double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT;
+ GL11.glScaled(scale, scale, 0);
+ fr.drawString("Score: 305 (S+)", 0,0, this.<Color>getParameter("color").getValue().getRGB());
+ }
+ }
+
+ @Data
+ @AllArgsConstructor
+ public static class ScoreCalculation {
+ private int skill, explorer, time, bonus, tombs;
+ private boolean fullyCleared;
+ private int secrets, totalSecrets;
+ private boolean totalSecretsKnown;
+ private int deaths;
+ }
+
+ public ScoreCalculation calculateScore() {
+ if (!skyblockStatus.isOnDungeon()) return null;
+ DungeonContext context = skyblockStatus.getContext();
+ if (context == null) return null;
+ int skill = 100;
+ int deaths = 0;
+ {
+ deaths = FeatureRegistry.DUNGEON_DEATHS.getTotalDeaths();
+ skill -= FeatureRegistry.DUNGEON_DEATHS.getTotalDeaths() * 2;
+ for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) {
+ skill += dungeonRoom.getCurrentState().getScoreModifier();
+ }
+ }
+ int explorer = 0;
+ boolean fullyCleared = false;
+ boolean totalSecretsKnown = true;
+ int totalSecrets = 0;
+ int secrets = 0;
+ {
+ int clearedRooms = 0;
+ for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) {
+ if (!(dungeonRoom.getCurrentState() == DungeonRoom.RoomState.DISCOVERED)) {
+ clearedRooms ++;
+ }
+ if (dungeonRoom.getTotalSecrets() != -1)
+ totalSecrets += dungeonRoom.getTotalSecrets();
+ else totalSecretsKnown = false;
+ }
+ fullyCleared = clearedRooms == context.getDungeonRoomList().size() && context.getMapProcessor().getUndiscoveredRoom() == 0;
+ explorer += MathHelper.clamp_int((int) Math.floor(60 * (clearedRooms / ((double)context.getDungeonRoomList().size() + context.getMapProcessor().getUndiscoveredRoom()))), 0, 60);
+ explorer += MathHelper.clamp_int((int) Math.floor(40 * ((secrets = FeatureRegistry.DUNGEON_SECRETS.getSecretsFound()) / (double)totalSecrets)),0,40);
+ }
+ int time = 0;
+ {
+ double timeModifier;
+ if (context.getMapProcessor().isInBossRoom()) {
+ timeModifier = Math.max(0, context.getBossRoomEnterSeconds() - 1200);
+ } else {
+ timeModifier = Math.max(0, FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed() / 1000 - 1200);
+ }
+ time = (int) Math.floor(100 - 2.2 * timeModifier);
+ }
+ int bonus = 0;
+ int tombs;
+ {
+ bonus += tombs = MathHelper.clamp_int(FeatureRegistry.DUNGEON_TOMBS.getTombsFound(), 0, 5);
+ }
+
+ // amazing thing
+ return new ScoreCalculation(skill, explorer, time, bonus, tombs, fullyCleared, secrets, totalSecrets, totalSecretsKnown, deaths);
+ }
+ public String getLetter(int score) {
+ if (score <= 99) return "D";
+ if (score <= 159) return "C";
+ if (score <= 229) return "B";
+ if (score <= 269) return "A";
+ if (score <= 299) return "S";
+ return "S+";
+ }
+ public int getScoreRequirement(String letter) {
+ if (letter.equals("D")) return 0;
+ if (letter.equals("C")) return 100;
+ if (letter.equals("B")) return 160;
+ if (letter.equals("A")) return 230;
+ if (letter.equals("S")) return 270;
+ if (letter.equals("S+")) return 300;
+ return -1;
+ }
+ public String getNextLetter(String letter) {
+ if (letter.equals("D")) return "C";
+ if (letter.equals("C")) return "B";
+ if (letter.equals("B")) return "A";
+ if (letter.equals("A")) return "S";
+ if (letter.equals("S")) return "S+";
+ else return null;
+ }
+ public String buildRequirement(ScoreCalculation calculation) {
+ int current = calculation.time + calculation.bonus + calculation.explorer + calculation.skill;
+ String currentLetter = getLetter(current);
+ String nextLetter= getNextLetter(currentLetter);
+ if (nextLetter == null) return "S+ Expected";
+ int req = getScoreRequirement(nextLetter);
+ int reqPT2 = req- current;
+ int reqPT = req - current;
+
+ int tombsBreakable = Math.min(5 - calculation.tombs, reqPT);
+ reqPT -= tombsBreakable;
+
+ double secretPer = 40.0 / calculation.totalSecrets;
+ int secrets = (int) Math.ceil(reqPT / secretPer);
+
+ return currentLetter+"->"+nextLetter+" ("+reqPT2+" Req "+tombsBreakable+" crypts "+secrets+" secrets"+(calculation.totalSecretsKnown ? "" : "?")+")";
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonSecrets.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonSecrets.java
new file mode 100644
index 00000000..afe8da07
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonSecrets.java
@@ -0,0 +1,71 @@
+package kr.syeyoung.dungeonsguide.features.impl;
+
+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.FeatureParameter;
+import kr.syeyoung.dungeonsguide.features.FeatureRegistry;
+import kr.syeyoung.dungeonsguide.features.GuiFeature;
+import kr.syeyoung.dungeonsguide.features.listener.ChatListener;
+import kr.syeyoung.dungeonsguide.features.listener.TickListener;
+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.ScorePlayerTeam;
+import net.minecraft.util.ChatComponentText;
+import net.minecraftforge.client.event.ClientChatReceivedEvent;
+import org.lwjgl.opengl.GL11;
+
+import java.awt.*;
+import java.util.regex.Pattern;
+
+public class FeatureDungeonSecrets extends GuiFeature {
+ 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);
+ this.setEnabled(false);
+ parameters.put("color", new FeatureParameter<Color>("color", "Color", "Color of text", Color.orange, "color"));
+ }
+
+ SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus();
+ @Override
+ public void drawHUD(float partialTicks) {
+ if (!skyblockStatus.isOnDungeon()) return;
+ FontRenderer fr = getFontRenderer();
+ double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT;
+ GL11.glScaled(scale, scale, 0);
+ fr.drawString("Secrets: "+getSecretsFound() +"/"+getTotalSecrets(), 0,0, this.<Color>getParameter("color").getValue().getRGB());
+ }
+
+ @Override
+ public void drawDemo(float partialTicks) {
+ FontRenderer fr = getFontRenderer();
+ double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT;
+ GL11.glScaled(scale, scale, 0);
+ fr.drawString("Secrets: 999/2+", 0,0, this.<Color>getParameter("color").getValue().getRGB());
+ }
+
+ 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")) {
+ String noColor = TextUtils.stripColor(name);
+ return Integer.parseInt(noColor.substring(16));
+ }
+ }
+ return 0;
+ }
+
+ public String getTotalSecrets() {
+ DungeonContext context = skyblockStatus.getContext();
+ int totalSecrets = 0;
+ boolean allknown = true;
+ for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) {
+ if (dungeonRoom.getTotalSecrets() != -1)
+ totalSecrets += dungeonRoom.getTotalSecrets();
+ else allknown = false;
+ }
+ return totalSecrets + (allknown ? "":"+");
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonTombs.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonTombs.java
new file mode 100644
index 00000000..511e971f
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonTombs.java
@@ -0,0 +1,50 @@
+package kr.syeyoung.dungeonsguide.features.impl;
+
+import kr.syeyoung.dungeonsguide.SkyblockStatus;
+import kr.syeyoung.dungeonsguide.e;
+import kr.syeyoung.dungeonsguide.features.FeatureParameter;
+import kr.syeyoung.dungeonsguide.features.GuiFeature;
+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.ScorePlayerTeam;
+import org.lwjgl.opengl.GL11;
+
+import java.awt.*;
+
+public class FeatureDungeonTombs extends GuiFeature {
+ public FeatureDungeonTombs() {
+ super("Dungeon", "Display #Crypts", "Display how much total crypts have been blown up in a dungeon run", "dungeon.stats.tombs", true, getFontRenderer().getStringWidth("Crypts: 42"), getFontRenderer().FONT_HEIGHT);
+ this.setEnabled(false);
+ parameters.put("color", new FeatureParameter<Color>("color", "Color", "Color of text", Color.orange, "color"));
+ }
+
+ SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus();
+ @Override
+ public void drawHUD(float partialTicks) {
+ if (!skyblockStatus.isOnDungeon()) return;
+ FontRenderer fr = getFontRenderer();
+ double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT;
+ GL11.glScaled(scale, scale, 0);
+ fr.drawString("Crypts: "+getTombsFound(), 0,0, this.<Color>getParameter("color").getValue().getRGB());
+ }
+
+ @Override
+ public void drawDemo(float partialTicks) {
+ FontRenderer fr = getFontRenderer();
+ double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT;
+ GL11.glScaled(scale, scale, 0);
+ fr.drawString("Crypts: 42", 0,0, this.<Color>getParameter("color").getValue().getRGB());
+ }
+
+ public int getTombsFound() {
+ 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 Crypts: §r§6")) {
+ return Integer.parseInt(TextUtils.stripColor(name).substring(9));
+ }
+ }
+ return 0;
+ }
+}