From 91b5f6b813fa509fdf767f8f2818f9ad0acaa4d8 Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Fri, 14 Oct 2022 00:33:09 +0200 Subject: [PATCH] Made passive skill binding optionnal. --- .../mmocore/api/player/stats/PlayerStats.java | 8 ++++++++ .../Indyuce/mmocore/manager/ConfigManager.java | 6 +++--- MMOCore-Dist/src/main/resources/config.yml | 6 ++++++ .../main/resources/default/gui/skill-list.yml | 16 ++-------------- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/stats/PlayerStats.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/stats/PlayerStats.java index 5e5c2941..8915540b 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/stats/PlayerStats.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/stats/PlayerStats.java @@ -97,8 +97,16 @@ public class PlayerStats { * This updates the player's PASSIVE skills */ + final PassiveSkillMap skillMap = data.getMMOPlayerData().getPassiveSkillMap(); + if(!MMOCore.plugin.configManager.passiveSkillNeedBound) { + skillMap.removeModifiers("MMOCorePassiveSkill"); + for (ClassSkill skill : data.getProfess().getSkills()) + if (skill.getSkill().getTrigger().isPassive()) + skillMap.addModifier(skill.toPassive(data)); + } + // This updates the player's class SCRIPTS skillMap.removeModifiers("MMOCoreClassScript"); for (PassiveSkill script : data.getProfess().getScripts()) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java index 42ed06f8..6c99ef09 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java @@ -22,7 +22,7 @@ import java.util.logging.Level; public class ConfigManager { public final CommandVerbose commandVerbose = new CommandVerbose(); - public boolean overrideVanillaExp, canCreativeCast, cobbleGeneratorXP, saveDefaultClassInfo, attributesAsClassInfo, splitProfessionExp, disableQuestBossBar; + public boolean overrideVanillaExp, canCreativeCast, passiveSkillNeedBound, cobbleGeneratorXP, saveDefaultClassInfo, attributesAsClassInfo, splitProfessionExp, disableQuestBossBar; public String partyChatPrefix, noSkillBoundPlaceholder; public ChatColor staminaFull, staminaHalf, staminaEmpty; public long combatLogTimer, lootChestExpireTime, lootChestPlayerCooldown, globalSkillCooldown; @@ -115,7 +115,7 @@ public class ConfigManager { staminaFull = getColorOrDefault("stamina-whole", ChatColor.GREEN); staminaHalf = getColorOrDefault("stamina-half", ChatColor.DARK_GREEN); staminaEmpty = getColorOrDefault("stamina-empty", ChatColor.WHITE); - + passiveSkillNeedBound = MMOCore.plugin.getConfig().getBoolean("passive-skill-need-bound"); canCreativeCast = MMOCore.plugin.getConfig().getBoolean("can-creative-cast"); cobbleGeneratorXP = MMOCore.plugin.getConfig().getBoolean("should-cobblestone-generators-give-exp"); saveDefaultClassInfo = MMOCore.plugin.getConfig().getBoolean("save-default-class-info"); @@ -135,7 +135,7 @@ public class ConfigManager { @Deprecated public PlayerInput newPlayerInput(Player player, InputType type, Consumer output) { - return new ChatInput(player, type, output) ; + return new ChatInput(player, type, output); } public void loadDefaultFile(String name) { diff --git a/MMOCore-Dist/src/main/resources/config.yml b/MMOCore-Dist/src/main/resources/config.yml index 8787d144..40a456b7 100644 --- a/MMOCore-Dist/src/main/resources/config.yml +++ b/MMOCore-Dist/src/main/resources/config.yml @@ -188,6 +188,12 @@ death-exp-loss: #Default max bound active and passive skills. #These value can be modified for each class in the class yml. max-bound-active-skills: 6 + +#If you want players to bound their passive skills. +#If false, all the passive skills unlocked will be active +#Also set max-bound-passive-skills to 0 if seting passive-skill-need-bound to false. +passive-skill-need-bound: true + max-bound-passive-skills: 3 # Fun extra RPG feature that switches the player's hotbar with diff --git a/MMOCore-Dist/src/main/resources/default/gui/skill-list.yml b/MMOCore-Dist/src/main/resources/default/gui/skill-list.yml index 8256097d..ccb46c65 100644 --- a/MMOCore-Dist/src/main/resources/default/gui/skill-list.yml +++ b/MMOCore-Dist/src/main/resources/default/gui/skill-list.yml @@ -34,7 +34,7 @@ items: lore: { } reallocate: - slots: [26] + slots: [45] function: reallocation item: CAULDRON name: '&aReallocate Skill Points' @@ -46,19 +46,7 @@ items: - '&eCosts 1 skill reallocation point.' - '&e◆ Skill Reallocation Points: &6{points}' - #switch: - # - # slots: [28] - # function: switch - # item: PLAYER_HEAD - # binding: - # item: PINK_STAINED_GLASS - # name: '&aSwitch to Binding' - # lore: {} - # upgrading: - # item: PINK_STAINED_GLASS - # name: '&aSwitch to Upgrading' - # lore: {} + passive-skill-slot: slots: [ 7,16,25,34,43,52 ] function: passive-slot