From 5fdfc36fcc8c83eadb9030cc9dc8cc2697c9452d Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Fri, 21 Apr 2023 08:06:40 +0100 Subject: [PATCH] Renaming for skill tree GUI. --- .../gui/skilltree/SkillTreeViewer.java | 12 +- .../gui/skilltree/display/NodeType.java | 68 +++++----- .../gui/skilltree/display/PathType.java | 40 +++--- .../main/resources/default/gui/skill-tree.yml | 124 +++++++++--------- 4 files changed, 122 insertions(+), 122 deletions(-) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/skilltree/SkillTreeViewer.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/skilltree/SkillTreeViewer.java index 4c3a0305..4db8f3fe 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/skilltree/SkillTreeViewer.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/skilltree/SkillTreeViewer.java @@ -338,10 +338,10 @@ public class SkillTreeViewer extends EditableInventory { } public Icon getIcon(IntegerCoordinates coordinates) { - boolean hasNorthPath = skillTree.isPath(new IntegerCoordinates(coordinates.getX(), coordinates.getY() - 1)); - boolean hasSouthPath = skillTree.isPath(new IntegerCoordinates(coordinates.getX(), coordinates.getY() + 1)); - boolean hasEastPath = skillTree.isPath(new IntegerCoordinates(coordinates.getX() + 1, coordinates.getY())); - boolean hasWestPath = skillTree.isPath(new IntegerCoordinates(coordinates.getX() - 1, coordinates.getY())); + boolean hasUpPath = skillTree.isPath(new IntegerCoordinates(coordinates.getX(), coordinates.getY() - 1)); + boolean hasDownPath = skillTree.isPath(new IntegerCoordinates(coordinates.getX(), coordinates.getY() + 1)); + boolean hasRightPath = skillTree.isPath(new IntegerCoordinates(coordinates.getX() + 1, coordinates.getY())); + boolean hasLeftPath = skillTree.isPath(new IntegerCoordinates(coordinates.getX() - 1, coordinates.getY())); if (skillTree.isNode(coordinates)) { SkillTreeNode node = skillTree.getNode(coordinates); @@ -349,10 +349,10 @@ public class SkillTreeViewer extends EditableInventory { if(node.getItem()!=null) return new Icon(node.getItem(),node.getCustomModelData()); - NodeType nodeType = NodeType.getNodeType(hasNorthPath, hasEastPath, hasSouthPath, hasWestPath); + NodeType nodeType = NodeType.getNodeType(hasUpPath, hasRightPath, hasDownPath, hasLeftPath); return icons.get(new NodeDisplayInfo(nodeType, playerData.getNodeState(node))); } else { - PathType pathType = PathType.getPathType(hasNorthPath, hasEastPath, hasSouthPath, hasWestPath); + PathType pathType = PathType.getPathType(hasUpPath, hasRightPath, hasDownPath, hasLeftPath); SkillTreePath path = skillTree.getPath(coordinates); return icons.get(new PathDisplayInfo(pathType, path.getStatus(playerData))); } diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/skilltree/display/NodeType.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/skilltree/display/NodeType.java index 80a7011f..89d99764 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/skilltree/display/NodeType.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/skilltree/display/NodeType.java @@ -1,42 +1,42 @@ package net.Indyuce.mmocore.gui.skilltree.display; public enum NodeType { - NORTH_EAST_SOUTH_WEST, - NORTH_EAST_SOUTH, - NORTH_EAST_WEST, - NORTH_SOUTH_WEST, - SOUTH_EAST_WEST, - NORTH_EAST, - NORTH_SOUTH, - NORTH_WEST, - SOUTH_EAST, - SOUTH_WEST, - EAST_WEST, + UP_RIGHT_DOWN_LEFT, + UP_RIGHT_DOWN, + UP_RIGHT_LEFT, + UP_DOWN_LEFT, + DOWN_RIGHT_LEFT, + UP_RIGHT, + UP_DOWN, + UP_LEFT, + DOWN_RIGHT, + DOWN_LEFT, + RIGHT_LEFT, NO_PATH; - public static NodeType getNodeType(boolean hasNorthPath, boolean hasEastPath, boolean hasSouthPath, boolean hasWestPath) { - if (hasNorthPath && hasEastPath && hasSouthPath && hasWestPath) { - return NORTH_EAST_SOUTH_WEST; - } else if (hasNorthPath && hasEastPath && hasSouthPath) { - return NORTH_EAST_SOUTH; - } else if (hasNorthPath && hasEastPath && hasWestPath) { - return NORTH_EAST_WEST; - } else if (hasNorthPath && hasSouthPath && hasWestPath) { - return NORTH_SOUTH_WEST; - } else if (hasSouthPath && hasEastPath && hasWestPath) { - return SOUTH_EAST_WEST; - } else if (hasNorthPath && hasEastPath) { - return NORTH_EAST; - } else if (hasNorthPath && hasSouthPath) { - return NORTH_SOUTH; - } else if (hasNorthPath && hasWestPath) { - return NORTH_WEST; - } else if (hasSouthPath && hasEastPath) { - return SOUTH_EAST; - } else if (hasSouthPath && hasWestPath) { - return SOUTH_WEST; - } else if (hasEastPath && hasWestPath) { - return EAST_WEST; + public static NodeType getNodeType(boolean hasUpPath, boolean hasRightPath, boolean hasDownPath, boolean hasLeftPath) { + if (hasUpPath && hasRightPath && hasDownPath && hasLeftPath) { + return UP_RIGHT_DOWN_LEFT; + } else if (hasUpPath && hasRightPath && hasDownPath) { + return UP_RIGHT_DOWN; + } else if (hasUpPath && hasRightPath && hasLeftPath) { + return UP_RIGHT_LEFT; + } else if (hasUpPath && hasDownPath && hasLeftPath) { + return UP_DOWN_LEFT; + } else if (hasDownPath && hasRightPath && hasLeftPath) { + return DOWN_RIGHT_LEFT; + } else if (hasUpPath && hasRightPath) { + return UP_RIGHT; + } else if (hasUpPath && hasDownPath) { + return UP_DOWN; + } else if (hasUpPath && hasLeftPath) { + return UP_LEFT; + } else if (hasDownPath && hasRightPath) { + return DOWN_RIGHT; + } else if (hasDownPath && hasLeftPath) { + return DOWN_LEFT; + } else if (hasRightPath && hasLeftPath) { + return RIGHT_LEFT; } return NO_PATH; } diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/skilltree/display/PathType.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/skilltree/display/PathType.java index 79758a50..1769fb20 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/skilltree/display/PathType.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/skilltree/display/PathType.java @@ -5,34 +5,34 @@ package net.Indyuce.mmocore.gui.skilltree.display; */ public enum PathType { - NORTH, + UP, /** - * Goes to north then east/ goes to west then south. + * Goes to up then east/ goes to left then down. */ - NORTH_EAST, - NORTH_WEST, - SOUTH_EAST, - SOUTH_WEST, - EAST, + UP_RIGHT, + UP_LEFT, + DOWN_RIGHT, + DOWN_LEFT, + RIGHT, DEFAULT; - public static PathType getPathType(boolean hasNorth,boolean hasEast,boolean hasSouth,boolean hasWest) { - if ((hasNorth || hasSouth) && !hasWest && hasEast) { - return NORTH; - } else if ((hasEast || hasWest)&& !hasNorth && !hasSouth) { - return EAST; - } else if (hasNorth && hasEast) { - return NORTH_EAST; + public static PathType getPathType(boolean hasUp,boolean hasRight,boolean hasDown,boolean hasLeft) { + if ((hasUp || hasDown) && !hasLeft && hasRight) { + return UP; + } else if ((hasRight || hasLeft)&& !hasUp && !hasDown) { + return RIGHT; + } else if (hasUp && hasRight) { + return UP_RIGHT; } - else if (hasNorth && hasWest) { - return NORTH_WEST; + else if (hasUp && hasLeft) { + return UP_LEFT; } - else if (hasSouth && hasEast) { - return SOUTH_EAST; + else if (hasDown && hasRight) { + return DOWN_RIGHT; } - else if (hasSouth && hasWest) { - return SOUTH_WEST; + else if (hasDown && hasLeft) { + return DOWN_LEFT; } return DEFAULT; } diff --git a/MMOCore-Dist/src/main/resources/default/gui/skill-tree.yml b/MMOCore-Dist/src/main/resources/default/gui/skill-tree.yml index 55f0d2ae..68385469 100644 --- a/MMOCore-Dist/src/main/resources/default/gui/skill-tree.yml +++ b/MMOCore-Dist/src/main/resources/default/gui/skill-tree.yml @@ -102,66 +102,66 @@ items: display: paths: unlocked: - north: + up: item: "WHITE_DYE" custom-model-data: 0 - north-east: + up-right: item: "WHITE_DYE" custom-model-data: 0 - north-west: + up-left: item: "WHITE_DYE" custom-model-data: 0 - south-east: + down-right: item: "WHITE_DYE" custom-model-data: 0 - south-west: + down-left: item: "WHITE_DYE" custom-model-data: 0 - east: + right: item: "WHITE_DYE" custom-model-data: 0 default: item: "WHITE_DYE" custom-model-data: 0 locked: - north: + up: item: "GRAY_DYE" custom-model-data: 0 - north-east: + up-right: item: "GRAY_DYE" custom-model-data: 0 - north-west: + up-left: item: "GRAY_DYE" custom-model-data: 0 - south-east: + down-right: item: "GRAY_DYE" custom-model-data: 0 - south-west: + down-left: item: "GRAY_DYE" custom-model-data: 0 - east: + right: item: "GRAY_DYE" custom-model-data: 0 default: item: "GRAY_DYE" custom-model-data: 0 fully-locked: - north: + up: item: "BLACK_DYE" custom-model-data: 0 - north-east: + up-right: item: "BLACK_DYE" custom-model-data: 0 - north-west: + up-left: item: "BLACK_DYE" custom-model-data: 0 - south-east: + down-right: item: "BLACK_DYE" custom-model-data: 0 - south-west: + down-left: item: "BLACK_DYE" custom-model-data: 0 - east: + right: item: "BLACK_DYE" custom-model-data: 0 default: @@ -169,148 +169,148 @@ display: custom-model-data: 0 nodes: unlocked: - north-east-south-west: + up-right-down-left: item: "WHITE_CONCRETE" custom-model-data: 0 - north-east-south: + up-right-down: item: "WHITE_CONCRETE" custom-model-data: 0 - north-east-west: + up-right-left: item: "WHITE_CONCRETE" custom-model-data: 0 - north-south-west: + up-down-left: item: "WHITE_CONCRETE" custom-model-data: 0 - south-east-west: + down-right-left: item: "WHITE_CONCRETE" custom-model-data: 0 - north-east: + up-right: item: "WHITE_CONCRETE" custom-model-data: 0 - north-south: + up-down: item: "WHITE_CONCRETE" custom-model-data: 0 - north-west: + up-left: item: "WHITE_CONCRETE" custom-model-data: 0 - south-east: + down-right: item: "WHITE_CONCRETE" custom-model-data: 0 - south-west: + down-left: item: "WHITE_CONCRETE" custom-model-data: 0 - east-west: + right-left: item: "WHITE_CONCRETE" custom-model-data: 0 no-path: item: "WHITE_CONCRETE" custom-model-data: 0 locked: - north-east-south-west: + up-right-down-left: item: "GRAY_CONCRETE" custom-model-data: 0 - north-east-south: + up-right-down: item: "GRAY_CONCRETE" custom-model-data: 0 - north-east-west: + up-right-left: item: "GRAY_CONCRETE" custom-model-data: 0 - north-south-west: + up-down-left: item: "GRAY_CONCRETE" custom-model-data: 0 - south-east-west: + down-right-left: item: "GRAY_CONCRETE" custom-model-data: 0 - north-east: + up-right: item: "GRAY_CONCRETE" custom-model-data: 0 - north-south: + up-down: item: "GRAY_CONCRETE" custom-model-data: 0 - north-west: + up-left: item: "GRAY_CONCRETE" custom-model-data: 0 - south-east: + down-right: item: "GRAY_CONCRETE" custom-model-data: 0 - south-west: + down-left: item: "GRAY_CONCRETE" custom-model-data: 0 - east-west: + right-left: item: "GRAY_CONCRETE" custom-model-data: 0 no-path: item: "GRAY_CONCRETE" custom-model-data: 0 unlockable: - north-east-south-west: + up-right-down-left: item: "BLUE_CONCRETE" custom-model-data: 0 - north-east-south: + up-right-down: item: "BLUE_CONCRETE" custom-model-data: 0 - north-east-west: + up-right-left: item: "BLUE_CONCRETE" custom-model-data: 0 - north-south-west: + up-down-left: item: "BLUE_CONCRETE" custom-model-data: 0 - south-east-west: + down-right-left: item: "BLUE_CONCRETE" custom-model-data: 0 - north-east: + up-right: item: "BLUE_CONCRETE" custom-model-data: 0 - north-south: + up-down: item: "BLUE_CONCRETE" custom-model-data: 0 - north-west: + up-left: item: "BLUE_CONCRETE" custom-model-data: 0 - south-east: + down-right: item: "BLUE_CONCRETE" custom-model-data: 0 - south-west: + down-left: item: "BLUE_CONCRETE" custom-model-data: 0 - east-west: + right-left: item: "BLUE_CONCRETE" custom-model-data: 0 no-path: item: "BLUE_CONCRETE" custom-model-data: 0 fully-locked: - north-east-south-west: + up-right-down-left: item: "BLACK_CONCRETE" custom-model-data: 0 - north-east-south: + up-right-down: item: "BLACK_CONCRETE" custom-model-data: 0 - north-east-west: + up-right-left: item: "BLACK_CONCRETE" custom-model-data: 0 - north-south-west: + up-down-left: item: "BLACK_CONCRETE" custom-model-data: 0 - south-east-west: + down-right-left: item: "BLACK_CONCRETE" custom-model-data: 0 - north-east: + up-right: item: "BLACK_CONCRETE" custom-model-data: 0 - north-south: + up-down: item: "BLACK_CONCRETE" custom-model-data: 0 - north-west: + up-left: item: "BLACK_CONCRETE" custom-model-data: 0 - south-east: + down-right: item: "BLACK_CONCRETE" custom-model-data: 0 - south-west: + down-left: item: "BLACK_CONCRETE" custom-model-data: 0 - east-west: + right-left: item: "BLACK_CONCRETE" custom-model-data: 0 no-path: