aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java5
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java5
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java4
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonMechanic.java3
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java6
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java5
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java4
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java4
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java6
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java163
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiClickListener.java7
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java1
12 files changed, 213 insertions, 0 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java
index 19f711cb..b2577371 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java
@@ -96,4 +96,9 @@ public class DungeonBreakableWall implements DungeonMechanic, RouteBlocker {
public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) {
return Sets.newHashSet("open", "closed");
}
+
+ @Override
+ public OffsetPoint getRepresentingPoint() {
+ return secretPoint.getOffsetPointList().size() == 0 ? null : secretPoint.getOffsetPointList().get(0);
+ }
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java
index 25aedb7e..39d53931 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java
@@ -99,4 +99,9 @@ public class DungeonDoor implements DungeonMechanic, RouteBlocker {
public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) {
return Sets.newHashSet("open", "closed");
}
+
+ @Override
+ public OffsetPoint getRepresentingPoint() {
+ return secretPoint.getOffsetPointList().size() == 0 ? null : secretPoint.getOffsetPointList().get(0);
+ }
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java
index 2d29be31..a87d21fc 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java
@@ -93,4 +93,8 @@ public class DungeonLever implements DungeonMechanic {
public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) {
return Sets.newHashSet("triggered", "untriggered");
}
+ @Override
+ public OffsetPoint getRepresentingPoint() {
+ return leverPoint;
+ }
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonMechanic.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonMechanic.java
index 26c75997..7dd91ae6 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonMechanic.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonMechanic.java
@@ -1,6 +1,7 @@
package kr.syeyoung.dungeonsguide.dungeon.mechanics;
import kr.syeyoung.dungeonsguide.dungeon.actions.Action;
+import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import java.awt.*;
@@ -16,4 +17,6 @@ public interface DungeonMechanic extends Serializable {
Set<String> getPossibleStates(DungeonRoom dungeonRoom);
Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom);
+
+ OffsetPoint getRepresentingPoint();
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java
index 3710b7f9..ca7ca9e3 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java
@@ -87,4 +87,10 @@ public class DungeonOnewayDoor implements DungeonMechanic, RouteBlocker {
public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) {
return Sets.newHashSet("open", "closed");
}
+
+
+ @Override
+ public OffsetPoint getRepresentingPoint() {
+ return secretPoint.getOffsetPointList().size() == 0 ? null : secretPoint.getOffsetPointList().get(0);
+ }
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java
index ae8f594b..dc9b6fcb 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java
@@ -91,4 +91,9 @@ public class DungeonOnewayLever implements DungeonMechanic {
public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) {
return Sets.newHashSet("triggered", "untriggered");
}
+
+ @Override
+ public OffsetPoint getRepresentingPoint() {
+ return leverPoint;
+ }
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java
index 4eeeab35..2677bc3b 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java
@@ -95,4 +95,8 @@ public class DungeonPressurePlate implements DungeonMechanic {
public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) {
return Sets.newHashSet("triggered", "untriggered");
}
+ @Override
+ public OffsetPoint getRepresentingPoint() {
+ return platePoint;
+ }
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java
index 4e8d8658..c12c066e 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java
@@ -121,4 +121,8 @@ public class DungeonSecret implements DungeonMechanic {
public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) {
return Sets.newHashSet("found"/*, "definitely_not", "not_sure", "created", "error"*/);
}
+ @Override
+ public OffsetPoint getRepresentingPoint() {
+ return secretPoint;
+ }
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java
index 9fad7caf..26f8f5f9 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java
@@ -94,4 +94,10 @@ public class DungeonTomb implements DungeonMechanic, RouteBlocker {
public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) {
return Sets.newHashSet("open", "closed");
}
+
+
+ @Override
+ public OffsetPoint getRepresentingPoint() {
+ return secretPoint.getOffsetPointList().size() == 0 ? null : secretPoint.getOffsetPointList().get(0);
+ }
}
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
new file mode 100644
index 00000000..ac730878
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java
@@ -0,0 +1,163 @@
+package kr.syeyoung.dungeonsguide.features.impl.secret;
+
+import kr.syeyoung.dungeonsguide.SkyblockStatus;
+import kr.syeyoung.dungeonsguide.dungeon.DungeonContext;
+import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonMechanic;
+import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.e;
+import kr.syeyoung.dungeonsguide.features.GuiFeature;
+import kr.syeyoung.dungeonsguide.features.listener.GuiClickListener;
+import kr.syeyoung.dungeonsguide.features.listener.GuiPostRenderListener;
+import kr.syeyoung.dungeonsguide.roomprocessor.GeneralRoomProcessor;
+import kr.syeyoung.dungeonsguide.roomprocessor.RoomProcessor;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.entity.EntityPlayerSP;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraftforge.client.event.GuiScreenEvent;
+import org.lwjgl.input.Mouse;
+import org.lwjgl.opengl.GL11;
+
+import java.awt.*;
+import java.util.List;
+import java.util.ArrayList;
+
+public class FeatureMechanicBrowse extends GuiFeature implements GuiPostRenderListener, GuiClickListener {
+
+ protected FeatureMechanicBrowse(String category, String name, String description, String key, boolean keepRatio, int width, int height) {
+ 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();
+ @Override
+ public void drawHUD(float partialTicks) {
+ if (Minecraft.getMinecraft().currentScreen != null) return;
+ if (!skyblockStatus.isOnDungeon()) return;
+ if (skyblockStatus.getContext() == null || !skyblockStatus.getContext().getMapProcessor().isInitialized()) return;
+ 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;
+ if (!(dungeonRoom.getRoomProcessor() instanceof GeneralRoomProcessor)) return;
+
+ GeneralRoomProcessor grp = (GeneralRoomProcessor) dungeonRoom.getRoomProcessor();
+
+ Rectangle feature = getFeatureRect();
+ FontRenderer fr = getFontRenderer();
+
+ Gui.drawRect(0, 0, feature.width, fr.FONT_HEIGHT + 4, 0xFF444444);
+ Gui.drawRect(1, 1, feature.width - 1, fr.FONT_HEIGHT + 3, 0xFF262626);
+ fr.drawString("Selected: ", 2,2, 0xFFAAAAAA);
+ if (grp.getPath() == null)
+ fr.drawString("Nothing", fr.getStringWidth("Selected: ") + 2,2, 0xFFAA0000);
+ else {
+ ActionRoute route = grp.getPath();
+ fr.drawString(route.getMechanic()+" -> "+route.getState(), fr.getStringWidth("Selected: ") + 2,2, 0xFFFFFF00);
+ }
+ fr.drawString("Press T to browse mechanic", 2, fr.FONT_HEIGHT + 5, 0xFFAAAAAA);
+ }
+
+ @Override
+ public void drawDemo(float partialTicks) {
+ Rectangle feature = getFeatureRect();
+ FontRenderer fr = getFontRenderer();
+
+ Gui.drawRect(0, 0, feature.width, fr.FONT_HEIGHT + 4, 0xFF444444);
+ Gui.drawRect(1, 1, feature.width - 1, fr.FONT_HEIGHT + 3, 0xFF262626);
+ fr.drawString("Selected: ", 2,2, 0xFFAAAAAA);
+ fr.drawString("Nothing", fr.getStringWidth("Selected: ") + 2,2, 0xFFAA0000);
+ fr.drawString("Press T to browse mechanic", 2, fr.FONT_HEIGHT + 5, 0xFFAAAAAA);
+ }
+
+ @Override
+ public void onGuiPostRender(GuiScreenEvent.DrawScreenEvent.Post rendered) {
+ if (!skyblockStatus.isOnDungeon()) return;
+ if (skyblockStatus.getContext() == null || !skyblockStatus.getContext().getMapProcessor().isInitialized()) return;
+ 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;
+ if (!(dungeonRoom.getRoomProcessor() instanceof GeneralRoomProcessor)) return;
+
+
+ GeneralRoomProcessor grp = (GeneralRoomProcessor) dungeonRoom.getRoomProcessor();
+
+ Rectangle feature = getFeatureRect();
+ FontRenderer fr = getFontRenderer();
+ GlStateManager.translate(feature.x, feature.y, 0);
+ Gui.drawRect(0, 0, feature.width, fr.FONT_HEIGHT + 4, 0xFF444444);
+ Gui.drawRect(1, 1, feature.width - 1, fr.FONT_HEIGHT + 3, 0xFF262626);
+ fr.drawString("Selected: ", 2,2, 0xFFAAAAAA);
+ if (grp.getPath() == null)
+ fr.drawString("Nothing", fr.getStringWidth("Selected: ") + 2,2, 0xFFAA0000);
+ else {
+ ActionRoute route = grp.getPath();
+ fr.drawString(route.getMechanic()+" -> "+route.getState(), fr.getStringWidth("Selected: ") + 2,2, 0xFFFFFF00);
+ }
+ clip(new ScaledResolution(Minecraft.getMinecraft()), 0, fr.FONT_HEIGHT + 4, feature.width, fr.FONT_HEIGHT * 10 + 4);
+
+ Gui.drawRect(0, fr.FONT_HEIGHT + 4, feature.width, fr.FONT_HEIGHT * 10 + 4, 0xFF444444);
+ Gui.drawRect(1, fr.FONT_HEIGHT + 5, feature.width - 1, fr.FONT_HEIGHT * 10 + 3, 0xFF262626);
+
+ }
+
+ private void clip(ScaledResolution resolution, int x, int y, int width, int height) {
+ int scale = resolution.getScaleFactor();
+ GL11.glScissor((x ) * scale, Minecraft.getMinecraft().displayHeight - (y + height) * scale, (width) * scale, height * scale);
+ }
+
+ private int dy = 0;
+ private int selected = -1;
+ private List<Object> sortedMechanics = new ArrayList<Object>();
+ private void setupMechanics() {
+ sortedMechanics.clear();
+
+ if (!skyblockStatus.isOnDungeon()) return;
+ if (skyblockStatus.getContext() == null || !skyblockStatus.getContext().getMapProcessor().isInitialized()) return;
+ 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;
+ if (!(dungeonRoom.getRoomProcessor() instanceof GeneralRoomProcessor)) return;
+
+ for (DungeonMechanic value : ((GeneralRoomProcessor) dungeonRoom.getRoomProcessor()).getDungeonRoom().getDungeonRoomInfo().getMechanics().values()) {
+ value.
+ }
+ }
+
+ @Override
+ public void onMouseInput(GuiScreenEvent.MouseInputEvent.Pre mouseInputEvent) {
+ ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ int width = scaledResolution.getScaledWidth();
+ int height = scaledResolution.getScaledHeight();
+ int mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth;
+ int mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1;
+
+ Rectangle feature = getFeatureRect();
+ FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
+ if (feature.contains(mouseX, mouseY)) {
+ mouseInputEvent.setCanceled(true);
+
+ int wheel = Mouse.getDWheel();
+ if (wheel > 0) dy ++;
+ else if (wheel < 0) dy --;
+
+ if (Mouse.getEventButton() != -1) {
+ int yDiff = mouseY - feature.y - fr.FONT_HEIGHT - 7;
+ selected = yDiff / fr.FONT_HEIGHT + dy;
+ }
+ } else if (new Rectangle(feature.x + feature.width, (selected - dy) * fr.FONT_HEIGHT + 7 + feature.y, feature.x + feature.width + feature.width, (selected - dy) * fr.FONT_HEIGHT + 7 + feature.y + fr.FONT_HEIGHT).contains(mouseX, mouseY)) {
+ mouseInputEvent.setCanceled(true);
+
+ }
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiClickListener.java b/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiClickListener.java
new file mode 100644
index 00000000..4d40594b
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiClickListener.java
@@ -0,0 +1,7 @@
+package kr.syeyoung.dungeonsguide.features.listener;
+
+import net.minecraftforge.client.event.GuiScreenEvent;
+
+public interface GuiClickListener {
+ void onMouseInput(GuiScreenEvent.MouseInputEvent.Pre mouseInputEvent);
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java
index 6e96788a..04490a1c 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java
@@ -137,6 +137,7 @@ public class GeneralRoomProcessor implements RoomProcessor {
return false;
}
+ @Getter
private ActionRoute path;
public void pathfind(String mechanic, String state) {