aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/features/impl
diff options
context:
space:
mode:
authorsyeyoung <cyong06@naver.com>2021-02-12 00:03:42 +0900
committersyeyoung <cyong06@naver.com>2021-02-12 00:03:42 +0900
commit89c82ad1fea9fd0a8e32a5e818c6c01856cdd660 (patch)
treeeb989b2e58b2b18480d41a262b9cabf1a0ba387d /src/main/java/kr/syeyoung/dungeonsguide/features/impl
parent505cb6fc92e7d2c7412b43f459796791ca36e5a3 (diff)
downloadSkyblock-Dungeons-Guide-89c82ad1fea9fd0a8e32a5e818c6c01856cdd660.tar.gz
Skyblock-Dungeons-Guide-89c82ad1fea9fd0a8e32a5e818c6c01856cdd660.tar.bz2
Skyblock-Dungeons-Guide-89c82ad1fea9fd0a8e32a5e818c6c01856cdd660.zip
YES
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/features/impl')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureActions.java123
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java35
2 files changed, 152 insertions, 6 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureActions.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureActions.java
new file mode 100644
index 00000000..888f4d8c
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureActions.java
@@ -0,0 +1,123 @@
+package kr.syeyoung.dungeonsguide.features.impl.secret;
+
+import kr.syeyoung.dungeonsguide.SkyblockStatus;
+import kr.syeyoung.dungeonsguide.dungeon.DungeonContext;
+import kr.syeyoung.dungeonsguide.dungeon.actions.Action;
+import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute;
+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.text.StyledText;
+import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature;
+import kr.syeyoung.dungeonsguide.roomprocessor.GeneralRoomProcessor;
+import kr.syeyoung.dungeonsguide.utils.TextUtils;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.entity.EntityPlayerSP;
+import net.minecraft.client.network.NetworkPlayerInfo;
+import net.minecraft.scoreboard.ScorePlayerTeam;
+import net.minecraft.util.MathHelper;
+
+import java.awt.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class FeatureActions extends TextHUDFeature {
+ public FeatureActions() {
+ super("Secret", "Action Viewer", "View List of actions that needs to be taken", "secret.actionview", false, 200, getFontRenderer().FONT_HEIGHT * 10);
+ }
+
+ SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus();
+
+ @Override
+ public boolean doesScaleWithHeight() {
+ return false;
+ }
+
+ @Override
+ public boolean isHUDViewable() {
+ if (Minecraft.getMinecraft().currentScreen != null) return false;
+ if (!skyblockStatus.isOnDungeon()) return false;
+ if (skyblockStatus.getContext() == null || !skyblockStatus.getContext().getMapProcessor().isInitialized()) return false;
+ DungeonContext context = skyblockStatus.getContext();
+
+ EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer;
+ Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition());
+ DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt);
+ if (dungeonRoom == null) return false;
+ if (!(dungeonRoom.getRoomProcessor() instanceof GeneralRoomProcessor)) return false;
+ return true;
+ }
+
+ private static final List<StyledText> dummyText= new ArrayList<StyledText>();
+ static {
+ dummyText.add(new StyledText("Pathfinding ","pathfinding"));
+ dummyText.add(new StyledText("Secret ","mechanic"));
+ dummyText.add(new StyledText("-> ","separator"));
+ dummyText.add(new StyledText("Found\n","state"));
+ dummyText.add(new StyledText("> ","current"));
+ dummyText.add(new StyledText("1","number"));
+ dummyText.add(new StyledText(". ","dot"));
+ dummyText.add(new StyledText("Move ","action"));
+ dummyText.add(new StyledText("OffsetPoint{x=1,y=42,z=1} \n","afterline"));
+ dummyText.add(new StyledText(" ","current"));
+ dummyText.add(new StyledText("2","number"));
+ dummyText.add(new StyledText(". ","dot"));
+ dummyText.add(new StyledText("Click ","action"));
+ dummyText.add(new StyledText("OffsetPoint{x=1,y=42,z=1} \n","afterline"));
+ dummyText.add(new StyledText(" ","current"));
+ dummyText.add(new StyledText("3","number"));
+ dummyText.add(new StyledText(". ","dot"));
+ dummyText.add(new StyledText("Profit ","action"));
+ }
+
+ @Override
+ public List<String> getUsedTextStyle() {
+ return Arrays.asList(new String[] {
+ "pathfinding","mechanic","separator","state","current", "number", "dot", "action", "afterline"
+ });
+ }
+
+ @Override
+ public List<StyledText> getDummyText() {
+ return dummyText;
+ }
+
+
+ @Override
+ public List<StyledText> getText() {
+ List<StyledText> actualBit = new ArrayList<StyledText>();
+
+ DungeonContext context = skyblockStatus.getContext();
+
+ EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer;
+ Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition());
+ DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt);
+
+ ActionRoute path = ((GeneralRoomProcessor)dungeonRoom.getRoomProcessor()).getPath();
+
+ if (path != null) {
+ actualBit.add(new StyledText("Pathfinding ","pathfinding"));
+ actualBit.add(new StyledText(path.getMechanic()+" ","mechanic"));
+ actualBit.add(new StyledText("-> ","separator"));
+ actualBit.add(new StyledText(path.getState()+"\n","state"));
+
+ for (int i = 0; i < path.getActions().size(); i++) {
+ actualBit.add(new StyledText((i == path.getCurrent() ? ">" : " ") +" ","current"));
+ actualBit.add(new StyledText(i+"","number"));
+ actualBit.add(new StyledText(". ","dot"));
+ Action action = path.getActions().get(i);
+ String[] str = action.toString().split(" ");
+ actualBit.add(new StyledText(str[0] + " ","action"));
+ for (int i1 = 1; i1 < str.length; i1++) {
+ actualBit.add(new StyledText(str[i1]+" ","afterline"));
+ }
+ actualBit.add(new StyledText("\n","afterline"));
+ }
+ }
+ return actualBit;
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java
index 95ac96e2..6436d0e0 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java
@@ -39,7 +39,7 @@ import java.util.Set;
public class FeatureMechanicBrowse extends GuiFeature implements GuiPostRenderListener, GuiClickListener, WorldRenderListener {
public FeatureMechanicBrowse() {
- super("secret","Mechanic(Secret) Browser", "Browse and Pathfind secrets and mechanics in the current room", "secret.mechanicbrowse", false, 100, 300);
+ super("Secret","Mechanic(Secret) Browser", "Browse and Pathfind secrets and mechanics in the current room", "secret.mechanicbrowse", false, 100, 300);
}
SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus();
@@ -124,11 +124,11 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPostRenderLi
ActionRoute route = grp.getPath();
fr.drawString(route.getMechanic()+" -> "+route.getState(), fr.getStringWidth("Selected: ") + 2,2, 0xFFFFFF00);
}
- clip(new ScaledResolution(Minecraft.getMinecraft()), feature.x, feature.y + fr.FONT_HEIGHT + 4, feature.width , fr.FONT_HEIGHT * 10 + 4);
- GL11.glEnable(GL11.GL_SCISSOR_TEST);
GlStateManager.translate(0, fr.FONT_HEIGHT + 4, 0);
- Gui.drawRect(0, 0, feature.width, fr.FONT_HEIGHT * 9 + 4, 0xFF444444);
- Gui.drawRect(1, 1, feature.width - 1, fr.FONT_HEIGHT * 9 + 3, 0xFF262626);
+ Gui.drawRect(0, 0, feature.width, feature.height - fr.FONT_HEIGHT - 4, 0xFF444444);
+ Gui.drawRect(1, 1, feature.width - 1,feature.height - fr.FONT_HEIGHT - 5, 0xFF262626);
+ clip(new ScaledResolution(Minecraft.getMinecraft()), feature.x, feature.y + fr.FONT_HEIGHT + 5, feature.width , feature.height - fr.FONT_HEIGHT - 6);
+ GL11.glEnable(GL11.GL_SCISSOR_TEST);
GlStateManager.translate(0, -dy, 0);
GlStateManager.pushMatrix();
@@ -155,11 +155,11 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPostRenderLi
}
GlStateManager.popMatrix();;
- clip(new ScaledResolution(Minecraft.getMinecraft()), feature.x + feature.width, feature.y + fr.FONT_HEIGHT + 4, feature.width, fr.FONT_HEIGHT * 10 + 4);
if (selected != -1) {
GlStateManager.translate(feature.width, selected * fr.FONT_HEIGHT, 0);
Gui.drawRect(0, 0, feature.width, fr.FONT_HEIGHT * possibleStates.size() + 4, 0xFF444444);
Gui.drawRect(-1, 1, feature.width - 1, fr.FONT_HEIGHT * possibleStates.size() + 3, 0xFF262626);
+ clip(new ScaledResolution(Minecraft.getMinecraft()), feature.x + feature.width, feature.y + fr.FONT_HEIGHT + 5, feature.width , feature.height - fr.FONT_HEIGHT - 6);
GlStateManager.translate(2,2, 0);
Point popupStart = new Point(feature.x + feature.width, (selected + 1) * fr.FONT_HEIGHT +6 + feature.y - dy + 2);
@@ -248,6 +248,18 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPostRenderLi
}
found = false;
for (Map.Entry<String, DungeonMechanic> value : ((GeneralRoomProcessor) dungeonRoom.getRoomProcessor()).getDungeonRoom().getDungeonRoomInfo().getMechanics().entrySet()) {
+ if (value.getValue() instanceof DungeonJournal) {
+ if (!found) {
+ sortedMechanics.add("Journals");
+ sortedMechanicsName.add("");
+ found = true;
+ }
+ sortedMechanics.add(value.getValue());
+ sortedMechanicsName.add(value.getKey());
+ }
+ }
+ found = false;
+ for (Map.Entry<String, DungeonMechanic> value : ((GeneralRoomProcessor) dungeonRoom.getRoomProcessor()).getDungeonRoom().getDungeonRoomInfo().getMechanics().entrySet()) {
if (value.getValue() instanceof DungeonDoor || value.getValue() instanceof DungeonBreakableWall || value.getValue() instanceof DungeonLever
|| value.getValue() instanceof DungeonOnewayDoor || value.getValue() instanceof DungeonOnewayLever || value.getValue() instanceof DungeonPressurePlate) {
if (!found) {
@@ -263,6 +275,14 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPostRenderLi
@Override
public void onMouseInput(GuiScreenEvent.MouseInputEvent.Pre mouseInputEvent) {
+ if (Minecraft.getMinecraft().currentScreen instanceof GuiGuiLocationConfig
+ || Minecraft.getMinecraft().currentScreen instanceof GuiConfig
+ || Minecraft.getMinecraft().currentScreen instanceof GuiDungeonRoomEdit
+ || Minecraft.getMinecraft().currentScreen instanceof GuiDungeonAddSet
+ || Minecraft.getMinecraft().currentScreen instanceof GuiDungeonParameterEdit
+ || Minecraft.getMinecraft().currentScreen instanceof GuiDungeonValueEdit) return;
+
+
if (!skyblockStatus.isOnDungeon()) return;
if (skyblockStatus.getContext() == null || !skyblockStatus.getContext().getMapProcessor().isInitialized()) return;
DungeonContext context = skyblockStatus.getContext();
@@ -319,6 +339,9 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPostRenderLi
if (preSelectedState == selectedState && preSelectedState != -1) {
((GeneralRoomProcessor) dungeonRoom.getRoomProcessor()).pathfind(sortedMechanicsName.get(selected),
possibleStates.get(selectedState));
+ selected = -1;
+ selectedState = -1;
+ possibleStates.clear();
}
selectedState = preSelectedState;
}