diff options
author | syeyoung <cyong06@naver.com> | 2021-02-12 00:03:42 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-02-12 00:03:42 +0900 |
commit | 89c82ad1fea9fd0a8e32a5e818c6c01856cdd660 (patch) | |
tree | eb989b2e58b2b18480d41a262b9cabf1a0ba387d /src/main/java/kr/syeyoung/dungeonsguide/features | |
parent | 505cb6fc92e7d2c7412b43f459796791ca36e5a3 (diff) | |
download | Skyblock-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')
6 files changed, 175 insertions, 9 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java index d34e7eee..b507ba47 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java @@ -9,6 +9,7 @@ import kr.syeyoung.dungeonsguide.features.impl.etc.FeatureCooldownCounter; import kr.syeyoung.dungeonsguide.features.impl.etc.FeatureDisableMessage; import kr.syeyoung.dungeonsguide.features.impl.etc.FeatureTooltipDungeonStat; import kr.syeyoung.dungeonsguide.features.impl.etc.FeatureTooltipPrice; +import kr.syeyoung.dungeonsguide.features.impl.secret.FeatureActions; import kr.syeyoung.dungeonsguide.features.impl.secret.FeatureMechanicBrowse; import lombok.Getter; @@ -88,5 +89,6 @@ public class FeatureRegistry { public static final FeatureDungeonMap DUNGEON_MAP = register(new FeatureDungeonMap()); public static final FeatureMechanicBrowse SECRET_BROWSE = register(new FeatureMechanicBrowse()); + public static final FeatureActions SECRET_ACTIONS = register(new FeatureActions()); } 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; } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/text/PanelTextParameterConfig.java b/src/main/java/kr/syeyoung/dungeonsguide/features/text/PanelTextParameterConfig.java index 06ac0fca..3a87075c 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/text/PanelTextParameterConfig.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/text/PanelTextParameterConfig.java @@ -13,6 +13,7 @@ import kr.syeyoung.dungeonsguide.gui.MPanel; import kr.syeyoung.dungeonsguide.gui.elements.MButton; import kr.syeyoung.dungeonsguide.gui.elements.MColor; import kr.syeyoung.dungeonsguide.gui.elements.MEditableAColor; +import kr.syeyoung.dungeonsguide.gui.elements.MToggleButton; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; @@ -35,6 +36,7 @@ public class PanelTextParameterConfig extends MPanel { private MEditableAColor currentColor; private MEditableAColor backgroundColor; + private MToggleButton shadow; @Override public void onBoundsUpdate() { @@ -77,6 +79,17 @@ public class PanelTextParameterConfig extends MPanel { } }); add(backgroundColor); + shadow = new MToggleButton(); + shadow.setSize(new Dimension(20, 10)); + shadow.setBounds(new Rectangle(275 , 30, 20, 10)); + shadow.setOnToggle(new Runnable() { + @Override + public void run() { + for (String se:selected) + feature.getStylesMap().get(se).setShadow(shadow.isEnabled()); + } + }); + add(shadow); } @@ -132,6 +145,7 @@ public class PanelTextParameterConfig extends MPanel { GlStateManager.popMatrix(); fr.drawString("Text Color: ", 0, 10, 0xFFFFFFFF); fr.drawString("Background Color: ", 100, 10, 0xFFFFFFFF); + fr.drawString("Shadow: ", 0, 26, 0xFFFFFFFF); GlStateManager.popMatrix(); } @@ -177,15 +191,18 @@ public class PanelTextParameterConfig extends MPanel { if (selected.size() != 0) { currentColor.setColor(styles.get(selected.iterator().next()).getColor()); backgroundColor.setColor(styles.get(selected.iterator().next()).getBackground()); + shadow.setEnabled(styles.get(selected.iterator().next()).isShadow()); } else { currentColor.setColor(new AColor(0xff555555, true)); backgroundColor.setColor(new AColor(0xff555555, true)); + shadow.setEnabled(false); } } if (selected.size() == 1) { currentColor.setColor(styles.get(selected.iterator().next()).getColor()); backgroundColor.setColor(styles.get(selected.iterator().next()).getBackground()); + shadow.setEnabled(styles.get(selected.iterator().next()).isShadow()); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java index 4ab41379..c0e521f0 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java @@ -90,7 +90,7 @@ public abstract class TextHUDFeature extends GuiFeature { } for (String str : getUsedTextStyle()) { if (!res.containsKey(str)) - res.put(str, new TextStyle(str, new AColor(0xffffffff, true), new AColor(0x00777777, true))); + res.put(str, new TextStyle(str, new AColor(0xffffffff, true), new AColor(0x00777777, true), false)); } stylesMap = res; } @@ -175,13 +175,13 @@ public abstract class TextHUDFeature extends GuiFeature { Gui.drawRect(x,y, x+fr.getStringWidth(content), y + fr.FONT_HEIGHT, RenderUtils.getColorAt(x,y, style.getBackground())); if (!style.getColor().isChroma()) { - fr.drawString(content, x, y, style.getColor().getRGB()); + fr.drawString(content, x, y, style.getColor().getRGB(), style.isShadow()); return new Dimension(fr.getStringWidth(content), fr.FONT_HEIGHT); }else { char[] charArr = content.toCharArray(); int width = 0; for (int i = 0; i < charArr.length; i++) { - fr.drawString(String.valueOf(charArr[i]), x + width, y, RenderUtils.getColorAt(x + width, y, style.getColor())); + fr.drawString(String.valueOf(charArr[i]), x + width, y, RenderUtils.getColorAt(x + width, y, style.getColor()), style.isShadow()); width += fr.getCharWidth(charArr[i]); } return new Dimension(width, fr.FONT_HEIGHT); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextStyle.java b/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextStyle.java index 0df4c9a5..74ee297b 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextStyle.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextStyle.java @@ -14,4 +14,5 @@ public class TextStyle { private String groupName; private AColor color; private AColor background; + private boolean shadow = false; } |