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/main/java/kr/syeyoung/dungeonsguide/features/impl/secret | |
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/main/java/kr/syeyoung/dungeonsguide/features/impl/secret')
2 files changed, 89 insertions, 15 deletions
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(); |