diff options
author | syeyoung <cyoung06@naver.com> | 2021-10-02 16:24:43 +0900 |
---|---|---|
committer | syeyoung <cyoung06@naver.com> | 2021-10-02 16:24:43 +0900 |
commit | 5469f3041832885ccf33b5b1d9959d610e1bd6c2 (patch) | |
tree | f43a7ecbddf7ac63d03f0d3a3bcae8af2aaa0633 /src | |
parent | 0ed047c0944ae2b4c519d628d4159a0ece547745 (diff) | |
download | Skyblock-Dungeons-Guide-5469f3041832885ccf33b5b1d9959d610e1bd6c2.tar.gz Skyblock-Dungeons-Guide-5469f3041832885ccf33b5b1d9959d610e1bd6c2.tar.bz2 Skyblock-Dungeons-Guide-5469f3041832885ccf33b5b1d9959d610e1bd6c2.zip |
- Added FeatureCreateRefreshLine
- PathfindLineProperties now has parent to it
Diffstat (limited to 'src')
5 files changed, 108 insertions, 25 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java index 438e9b80..ef258b5d 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java @@ -158,30 +158,33 @@ public class FeatureRegistry { public static final FeatureSoulRoomWarning DUNGEON_FAIRYSOUL = register(new FeatureSoulRoomWarning()); + public static final PathfindLineProperties SECRET_LINE_PROPERTIES_GLOBAL = register(new PathfindLineProperties("Dungeon Secrets", "Global Line Settings", "Global Line Settings", "secret.lineproperties.global", true, null)); + public static final FeatureMechanicBrowse SECRET_BROWSE = register(new FeatureMechanicBrowse()); - public static final PathfindLineProperties SECRET_LINE_PROPERTIES_SECRET_BROWSER = register(new PathfindLineProperties("Dungeon Secrets.Secret Browser", "Line Settings", "Line Settings when pathfinding using Secret Browser", "secret.lineproperties.secretbrowser", true)); + public static final PathfindLineProperties SECRET_LINE_PROPERTIES_SECRET_BROWSER = register(new PathfindLineProperties("Dungeon Secrets.Secret Browser", "Line Settings", "Line Settings when pathfinding using Secret Browser", "secret.lineproperties.secretbrowser", true, SECRET_LINE_PROPERTIES_GLOBAL)); public static final FeatureActions SECRET_ACTIONS = register(new FeatureActions()); public static final SimpleFeature SECRET_PATHFIND_STRATEGY = register(new SimpleFeature("Dungeon Secrets", "Use NEW JPS Optimization instead of standard A Star", "Faster, and accurate routes.", "secret.secretpathfind.algorithm", true)); public static final SimpleFeature SECRET_TOGGLE_KEY = register(new SimpleFeature("Dungeon Secrets.Keybinds", "Toggle Pathfind Lines", "A key for toggling pathfound line visibility.\nChange key at your key settings (Settings -> Controls)", "secret.togglePathfind")); public static final SimpleFeature SECRET_FREEZE_LINES = register(new FeatureFreezePathfind()); + public static final FeatureCreateRefreshLine SECRET_CREATE_REFRESH_LINE = register(new FeatureCreateRefreshLine()); static { - categoryDescription.put("ROOT.Dungeon Secrets.Keybinds", "Useful keybinds / Toggle Pathfind lines, Freeze Pathfind lines"); + categoryDescription.put("ROOT.Dungeon Secrets.Keybinds", "Useful keybinds / Toggle Pathfind lines, Freeze Pathfind lines, Refresh pathfind line or Trigger pathfind (you would want to use it, if you're using Pathfind to All)"); } - public static final PathfindLineProperties SECRET_LINE_PROPERTIES_GLOBAL = register(new PathfindLineProperties("Dungeon Secrets", "Global Line Settings", "Global Line Settings", "secret.lineproperties.global", true)); public static final SimpleFeature SECRET_AUTO_BROWSE_NEXT = register(new SimpleFeature("Dungeon Secrets.Legacy AutoPathfind", "Auto Pathfind to next secret", "Auto browse best next secret after current one completes.\nthe first pathfinding of first secret needs to be triggered first in order for this option to work", "secret.autobrowse", false)); public static final SimpleFeature SECRET_AUTO_START = register(new SimpleFeature("Dungeon Secrets.Legacy AutoPathfind", "Auto pathfind to new secret", "Auto browse best secret upon entering the room.", "secret.autouponenter", false)); public static final SimpleFeature SECRET_NEXT_KEY = register(new SimpleFeature("Dungeon Secrets.Legacy AutoPathfind", "Auto Pathfind to new secret upon pressing a key", "Auto browse the best next secret when you press key.\nChange key at your key settings (Settings -> Controls)", "secret.keyfornext", false)); - public static final PathfindLineProperties SECRET_LINE_PROPERTIES_AUTOPATHFIND = register(new PathfindLineProperties("Dungeon Secrets.Legacy AutoPathfind", "Line Settings", "Line Settings when pathfinding using above features", "secret.lineproperties.autopathfind", true)); + public static final PathfindLineProperties SECRET_LINE_PROPERTIES_AUTOPATHFIND = register(new PathfindLineProperties("Dungeon Secrets.Legacy AutoPathfind", "Line Settings", "Line Settings when pathfinding using above features", "secret.lineproperties.autopathfind", true, SECRET_LINE_PROPERTIES_GLOBAL)); public static final FeaturePathfindToAll SECRET_PATHFIND_ALL = register(new FeaturePathfindToAll()); - public static final PathfindLineProperties SECRET_LINE_PROPERTIES_PATHFINDALL_BAT = register(new PathfindLineProperties("Dungeon Secrets.Pathfind To All", "Bat Line Settings", "Line Settings when pathfind to Bat, when using above feature", "secret.lineproperties.apf.bat", false)); - public static final PathfindLineProperties SECRET_LINE_PROPERTIES_PATHFINDALL_CHEST = register(new PathfindLineProperties("Dungeon Secrets.Pathfind To All", "Chest Line Settings", "Line Settings when pathfind to Chest, when using above feature", "secret.lineproperties.apf.chest", false)); - public static final PathfindLineProperties SECRET_LINE_PROPERTIES_PATHFINDALL_ESSENCE = register(new PathfindLineProperties("Dungeon Secrets.Pathfind To All", "Essence Line Settings", "Line Settings when pathfind to Essence, when using above feature", "secret.lineproperties.apf.essence", false)); - public static final PathfindLineProperties SECRET_LINE_PROPERTIES_PATHFINDALL_ITEM_DROP = register(new PathfindLineProperties("Dungeon Secrets.Pathfind To All", "Item Drop Line Settings", "Line Settings when pathfind to Item Drop, when using above feature", "secret.lineproperties.apf.itemdrop", false)); + public static final PathfindLineProperties SECRET_LINE_PROPERTIES_PATHFINDALL_PARENT = register(new PathfindLineProperties("Dungeon Secrets.Pathfind To All", "Parent Line Settings", "Line Settings to be used by default", "secret.lineproperties.apf.parent", false, SECRET_LINE_PROPERTIES_GLOBAL)); + public static final PathfindLineProperties SECRET_LINE_PROPERTIES_PATHFINDALL_BAT = register(new PathfindLineProperties("Dungeon Secrets.Pathfind To All", "Bat Line Settings", "Line Settings when pathfind to Bat, when using above feature", "secret.lineproperties.apf.bat", true, SECRET_LINE_PROPERTIES_PATHFINDALL_PARENT)); + public static final PathfindLineProperties SECRET_LINE_PROPERTIES_PATHFINDALL_CHEST = register(new PathfindLineProperties("Dungeon Secrets.Pathfind To All", "Chest Line Settings", "Line Settings when pathfind to Chest, when using above feature", "secret.lineproperties.apf.chest", true, SECRET_LINE_PROPERTIES_PATHFINDALL_PARENT)); + public static final PathfindLineProperties SECRET_LINE_PROPERTIES_PATHFINDALL_ESSENCE = register(new PathfindLineProperties("Dungeon Secrets.Pathfind To All", "Essence Line Settings", "Line Settings when pathfind to Essence, when using above feature", "secret.lineproperties.apf.essence", true, SECRET_LINE_PROPERTIES_PATHFINDALL_PARENT)); + public static final PathfindLineProperties SECRET_LINE_PROPERTIES_PATHFINDALL_ITEM_DROP = register(new PathfindLineProperties("Dungeon Secrets.Pathfind To All", "Item Drop Line Settings", "Line Settings when pathfind to Item Drop, when using above feature", "secret.lineproperties.apf.itemdrop", true, SECRET_LINE_PROPERTIES_PATHFINDALL_PARENT)); public static final FeatureNicknamePrefix COSMETIC_PREFIX = register(new FeatureNicknamePrefix()); public static final FeatureNicknameColor COSMETIC_NICKNAMECOLOR = register(new FeatureNicknameColor()); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureCreateRefreshLine.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureCreateRefreshLine.java new file mode 100644 index 00000000..15a5ee4d --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureCreateRefreshLine.java @@ -0,0 +1,65 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.features.impl.secret; + +import com.google.common.base.Supplier; +import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; +import kr.syeyoung.dungeonsguide.config.guiconfig.MFeatureEdit; +import kr.syeyoung.dungeonsguide.config.guiconfig.MParameterEdit; +import kr.syeyoung.dungeonsguide.config.guiconfig.RootConfigPanel; +import kr.syeyoung.dungeonsguide.config.types.AColor; +import kr.syeyoung.dungeonsguide.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.gui.MPanel; + +public class FeatureCreateRefreshLine extends SimpleFeature { + public FeatureCreateRefreshLine() { + super("Dungeon Secrets.Keybinds", "Refresh pathfind line or Trigger pathfind", "A keybind for creating or refresh pathfind lines for pathfind contexts that doesn't have line, or contexts that has refresh rate set to -1.\nChange key at your key settings (Settings -> Controls)", "secret.refreshPathfind", true); + + this.parameters.put("pathfind", new FeatureParameter<Boolean>("pathfind", "Enable Pathfinding", "Force Enable pathfind for future actions when used", false, "boolean")); + this.parameters.put("refreshrate", new FeatureParameter<Integer>("refreshrate", "Line Refreshrate", "Ticks to wait per line refresh, to be overriden. If the line already has pathfind enabled, this value does nothing. Specify it to -1 to don't refresh line at all", 10, "integer")); + } + public boolean isPathfind() { + return this.<Boolean>getParameter("pathfind").getValue(); + } + public int getRefreshRate() { + return this.<Integer>getParameter("refreshrate").getValue(); + } + + + public String getEditRoute(RootConfigPanel rootConfigPanel) { + ConfigPanelCreator.map.put("base." + getKey() , new Supplier<MPanel>() { + @Override + public MPanel get() { + MFeatureEdit featureEdit = new MFeatureEdit(FeatureCreateRefreshLine.this, rootConfigPanel); + for (FeatureParameter parameter: getParameters()) { + if (parameter.getKey().equals("refreshrate")) + featureEdit.addParameterEdit(parameter.getKey(), new MParameterEdit(FeatureCreateRefreshLine.this, parameter, rootConfigPanel, a -> !isPathfind())); + else + featureEdit.addParameterEdit(parameter.getKey(), new MParameterEdit(FeatureCreateRefreshLine.this, parameter, rootConfigPanel, a -> false)); + } + return featureEdit; + } + }); + return "base." + getKey() ; + } + + + +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/PathfindLineProperties.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/PathfindLineProperties.java index e389cbd7..c5f388db 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/PathfindLineProperties.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/PathfindLineProperties.java @@ -34,18 +34,20 @@ import kr.syeyoung.dungeonsguide.gui.MPanel; import java.util.LinkedHashMap; public class PathfindLineProperties extends SimpleFeature { - public PathfindLineProperties(String category, String name, String description, String key, boolean useGlobal) { + private PathfindLineProperties parent; + public PathfindLineProperties(String category, String name, String description, String key, boolean useParent, PathfindLineProperties parent) { super(category, name, description, key); + this.parent = parent; this.parameters = new LinkedHashMap<>(); - if (!key.equals("secret.lineproperties.global")) - this.parameters.put("useGlobal", new FeatureParameter<Boolean>("useGlobal", "Use Global Settings instead of this", "Completely ignore these settings, then use the global one", useGlobal, "boolean")); - this.parameters.put("pathfind", new FeatureParameter<Boolean>("pathfind", "Enable Pathfinding", "Enable pathfind for secrets", useGlobal, "boolean")); + if (parent != null) + this.parameters.put("useGlobal", new FeatureParameter<Boolean>("useGlobal", "Use Global Settings instead of this", "Completely ignore these settings, then use the parent one:: '"+parent.getName()+"'", useParent, "boolean")); + this.parameters.put("pathfind", new FeatureParameter<Boolean>("pathfind", "Enable Pathfinding", "Enable pathfind for secrets", useParent, "boolean")); this.parameters.put("lineColor", new FeatureParameter<AColor>("lineColor", "Line Color", "Color of the pathfind line", new AColor(0xFFFF0000, true), "acolor")); this.parameters.put("lineWidth", new FeatureParameter<Float>("lineWidth", "Line Thickness", "Thickness of the pathfind line",1.0f, "float")); - this.parameters.put("refreshrate", new FeatureParameter<Integer>("refreshrate", "Line Refreshrate", "Ticks to wait per line refresh. Specify it to -1 to don't refresh line at all", 10, "integer")); + this.parameters.put("linerefreshrate", new FeatureParameter<Integer>("linerefreshrate", "Line Refreshrate", "Ticks to wait per line refresh. Specify it to -1 to don't refresh line at all", 10, "integer")); this.parameters.put("beacon", new FeatureParameter<Boolean>("beacon", "Enable Beacons", "Enable beacons for pathfind line targets", true, "boolean")); this.parameters.put("beamColor", new FeatureParameter<AColor>("beamColor", "Beam Color", "Color of the beacon beam", new AColor(0x77FF0000, true), "acolor")); - this.parameters.put("targetColor", new FeatureParameter<AColor>("targetColor", "Target Color", "Color of the target", new AColor(0x33FF0000, true), "acolor")); + this.parameters.put("beamTargetColor", new FeatureParameter<AColor>("beamTargetColor", "Target Color", "Color of the target", new AColor(0x33FF0000, true), "acolor")); } @@ -55,7 +57,14 @@ public class PathfindLineProperties extends SimpleFeature { public MPanel get() { MFeatureEdit featureEdit = new MFeatureEdit(PathfindLineProperties.this, rootConfigPanel); for (FeatureParameter parameter: getParameters()) { - featureEdit.addParameterEdit(parameter.getKey(), new MParameterEdit(PathfindLineProperties.this, parameter, rootConfigPanel, a -> !a.getKey().equals("useGlobal") && isGlobal())); + if (parameter.getKey().startsWith("line")) + featureEdit.addParameterEdit(parameter.getKey(), new MParameterEdit(PathfindLineProperties.this, parameter, rootConfigPanel, a -> isGlobal() || !isPathfind())); + else if (parameter.getKey().startsWith("beam")) + featureEdit.addParameterEdit(parameter.getKey(), new MParameterEdit(PathfindLineProperties.this, parameter, rootConfigPanel, a -> isGlobal() || !isBeacon())); + else if (!parameter.getKey().equals("useGlobal")) + featureEdit.addParameterEdit(parameter.getKey(), new MParameterEdit(PathfindLineProperties.this, parameter, rootConfigPanel, a -> isGlobal())); + else + featureEdit.addParameterEdit(parameter.getKey(), new MParameterEdit(PathfindLineProperties.this, parameter, rootConfigPanel, a -> false)); } return featureEdit; } @@ -69,30 +78,30 @@ public class PathfindLineProperties extends SimpleFeature { } public boolean isGlobal() { - if (getKey().equals("secret.lineproperties.global")) return false; + if (parent == null) return false; return this.<Boolean>getParameter("useGlobal").getValue(); } public boolean isPathfind() { - return isGlobal() ? FeatureRegistry.SECRET_LINE_PROPERTIES_GLOBAL.isPathfind() : this.<Boolean>getParameter("pathfind").getValue(); + return isGlobal() ? parent.isPathfind() : this.<Boolean>getParameter("pathfind").getValue(); } public AColor getLineColor() { - return isGlobal() ? FeatureRegistry.SECRET_LINE_PROPERTIES_GLOBAL.getLineColor() : this.<AColor>getParameter("lineColor").getValue(); + return isGlobal() ? parent.getLineColor() : this.<AColor>getParameter("lineColor").getValue(); } public float getLineWidth() { - return isGlobal() ? FeatureRegistry.SECRET_LINE_PROPERTIES_GLOBAL.getLineWidth() : this.<Float>getParameter("lineWidth").getValue(); + return isGlobal() ? parent.getLineWidth() : this.<Float>getParameter("lineWidth").getValue(); } public int getRefreshRate() { - return isGlobal() ? FeatureRegistry.SECRET_LINE_PROPERTIES_GLOBAL.getRefreshRate() : this.<Integer>getParameter("refreshrate").getValue(); + return isGlobal() ? parent.getRefreshRate() : this.<Integer>getParameter("linerefreshrate").getValue(); } public boolean isBeacon() { - return isGlobal() ? FeatureRegistry.SECRET_LINE_PROPERTIES_GLOBAL.isBeacon() : this.<Boolean>getParameter("beacon").getValue(); + return isGlobal() ? parent.isBeacon() : this.<Boolean>getParameter("beacon").getValue(); } public AColor getBeamColor() { - return isGlobal() ? FeatureRegistry.SECRET_LINE_PROPERTIES_GLOBAL.getBeamColor() : this.<AColor>getParameter("beamColor").getValue(); + return isGlobal() ? parent.getBeamColor() : this.<AColor>getParameter("beamColor").getValue(); } public AColor getTargetColor() { - return isGlobal() ? FeatureRegistry.SECRET_LINE_PROPERTIES_GLOBAL.getTargetColor() : this.<AColor>getParameter("targetColor").getValue(); + return isGlobal() ? parent.getTargetColor() : this.<AColor>getParameter("beamTargetColor").getValue(); } public ActionRoute.ActionRouteProperties getRouteProperties() { ActionRoute.ActionRouteProperties actionRouteProperties = new ActionRoute.ActionRouteProperties(); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/JPSPathfinder.java b/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/JPSPathfinder.java index 3d3e5f2a..f3f058a7 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/JPSPathfinder.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/JPSPathfinder.java @@ -324,7 +324,8 @@ public class JPSPathfinder { Block b = iblockstate1.getBlock(); if (!b.getMaterial().blocksMovement())continue; if (b.isFullCube() && i2 == k-1) continue; - if (b.isFullCube() && !iblockstate1.equals( NodeProcessorDungeonRoom.preBuilt)) { + if (iblockstate1.equals( NodeProcessorDungeonRoom.preBuilt)) continue; + if (b.isFullCube()) { theBit |= (3L << bitStart); arr[location] = theBit; return true; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java index 259d956b..c0696a9e 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java @@ -322,7 +322,7 @@ public class GeneralRoomProcessor implements RoomProcessor { public void onKeyPress(InputEvent.KeyInputEvent keyInputEvent) { if (FeatureRegistry.SECRET_NEXT_KEY.isEnabled() && Keybinds.nextSecret.isKeyDown()) { searchForNextTarget(); - } else if (Keybinds.refreshPathfind.isKeyDown()) { + } else if (Keybinds.refreshPathfind.isKeyDown() && FeatureRegistry.SECRET_CREATE_REFRESH_LINE.isEnabled()) { ActionRoute actionRoute = getBestFit(0); if (actionRoute.getCurrentAction() instanceof ActionMove) { ActionMove ac = (ActionMove) actionRoute.getCurrentAction(); @@ -335,6 +335,11 @@ public class GeneralRoomProcessor implements RoomProcessor { } else if (actionRoute.getCurrent() >= 1 && actionRoute.getActions().get(actionRoute.getCurrent()-1) instanceof ActionMoveNearestAir) { ((ActionMoveNearestAir)actionRoute.getActions().get(actionRoute.getCurrent()-1)).forceRefresh(dungeonRoom); } + + if (FeatureRegistry.SECRET_CREATE_REFRESH_LINE.isPathfind() && !actionRoute.getActionRouteProperties().isPathfind()) { + actionRoute.getActionRouteProperties().setPathfind(true); + actionRoute.getActionRouteProperties().setLineRefreshRate(FeatureRegistry.SECRET_CREATE_REFRESH_LINE.getRefreshRate()); + } } } |