From eda227006f9b4760a0fd19451a467d9110f4c18f Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 4 Feb 2021 14:56:06 -0800 Subject: [PATCH] endgame progression WIP --- Changelog.txt | 14 ++++++++ .../nossr50/commands/CommandManager.java | 34 ++++++++++++++++++- .../commands/skills/PowerLevelCommand.java | 31 +++++++++++++++++ .../java/com/gmail/nossr50/config/Config.java | 1 + .../datatypes/skills/SubSkillType.java | 17 +++++++++- src/main/resources/config.yml | 3 ++ src/main/resources/plugin.yml | 5 +++ 7 files changed, 103 insertions(+), 2 deletions(-) create mode 100644 src/main/java/com/gmail/nossr50/commands/skills/PowerLevelCommand.java diff --git a/Changelog.txt b/Changelog.txt index 80ebd177f..b771abfc4 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,4 +1,18 @@ Version 2.1.175 + Added a new mastery sub-skill to each skill (see notes) + Added /mmopower command (aliases /mmopowerlevel /powerlevel) + Added 'mcmmo.commands.mmopower' permission node + Added 'General.PowerLevel.Skill_Mastery.Enabled' to config.yml which is used to enable or disable the mastery skills (will also disable the new power level command) + + NOTES: + Most skills have a mastery sub-skill, this mastery subskill provides a small benefit that scales to level 10,000 (or 1,000 for standard) and does not have ranks (other than the initial rank to unlock it) + Mastery skills unlock at level 1000 for RetroMode (the default setting), and 100 for Standard + Mastery skills are meant to provide an "end-game" to skills, a reason to continue leveling a skill past its "max". + This system is brand new, it is entirely possible I will completely change, remove, or add more mastery skills in the future. + + New Power Level Command + This power level command gives you a view of all your current masteries, it also provides a summary of your power level. + Version 2.1.174 Some legacy color codes in our locale file were swapped to &-code equivalents (thanks ViaSnake) diff --git a/src/main/java/com/gmail/nossr50/commands/CommandManager.java b/src/main/java/com/gmail/nossr50/commands/CommandManager.java index ea72fc2f9..b1bb5abf4 100644 --- a/src/main/java/com/gmail/nossr50/commands/CommandManager.java +++ b/src/main/java/com/gmail/nossr50/commands/CommandManager.java @@ -5,7 +5,9 @@ import co.aikar.commands.BukkitCommandManager; import co.aikar.commands.ConditionFailedException; import com.gmail.nossr50.commands.chat.AdminChatCommand; import com.gmail.nossr50.commands.chat.PartyChatCommand; +import com.gmail.nossr50.commands.skills.PowerLevelCommand; import com.gmail.nossr50.config.ChatConfig; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.chat.ChatChannel; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.locale.LocaleLoader; @@ -20,9 +22,14 @@ import org.jetbrains.annotations.NotNull; * For now this class will only handle ACF converted commands, all other commands will be handled elsewhere */ public class CommandManager { + public static final @NotNull String MMO_DATA_LOADED = "mmoDataLoaded"; + + //CHAT public static final @NotNull String ADMIN_CONDITION = "adminCondition"; public static final @NotNull String PARTY_CONDITION = "partyCondition"; - public static final @NotNull String MMO_DATA_LOADED = "mmoDataLoaded"; + + //SKILLS + public static final @NotNull String POWER_LEVEL_CONDITION = "powerLevelCondition"; private final @NotNull mcMMO pluginRef; private final @NotNull BukkitCommandManager bukkitCommandManager; @@ -36,9 +43,16 @@ public class CommandManager { } private void registerCommands() { + registerSkillCommands(); //TODO: Implement other skills not just power level registerChatCommands(); } + private void registerSkillCommands() { + if(Config.getInstance().isMasterySystemEnabled()) { + bukkitCommandManager.registerCommand(new PowerLevelCommand(pluginRef)); + } + } + /** * Registers chat commands if the chat system is enabled */ @@ -54,6 +68,23 @@ public class CommandManager { } public void registerConditions() { + registerChatCommandConditions(); //Chat Commands + registerSkillConditions(); + } + + private void registerSkillConditions() { + bukkitCommandManager.getCommandConditions().addCondition(POWER_LEVEL_CONDITION, (context) -> { + BukkitCommandIssuer issuer = context.getIssuer(); + + if(issuer.getIssuer() instanceof Player) { + validateLoadedData(issuer.getPlayer()); + } else { + throw new ConditionFailedException(LocaleLoader.getString("Commands.NoConsole")); + } + }); + } + + private void registerChatCommandConditions() { // Method or Class based - Can only be used on methods bukkitCommandManager.getCommandConditions().addCondition(ADMIN_CONDITION, (context) -> { BukkitCommandIssuer issuer = context.getIssuer(); @@ -78,6 +109,7 @@ public class CommandManager { if(bukkitCommandIssuer.getIssuer() instanceof Player) { validateLoadedData(bukkitCommandIssuer.getPlayer()); validatePlayerParty(bukkitCommandIssuer.getPlayer()); + //TODO: Is there even a point in validating permission? look into this later validatePermission("mcmmo.chat.partychat", bukkitCommandIssuer.getPlayer()); } }); diff --git a/src/main/java/com/gmail/nossr50/commands/skills/PowerLevelCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/PowerLevelCommand.java new file mode 100644 index 000000000..a418b4b09 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/commands/skills/PowerLevelCommand.java @@ -0,0 +1,31 @@ +package com.gmail.nossr50.commands.skills; + +import co.aikar.commands.BaseCommand; +import co.aikar.commands.BukkitCommandIssuer; +import co.aikar.commands.annotation.CommandAlias; +import co.aikar.commands.annotation.CommandPermission; +import co.aikar.commands.annotation.Conditions; +import co.aikar.commands.annotation.Default; +import com.gmail.nossr50.commands.CommandManager; +import com.gmail.nossr50.mcMMO; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; + +@CommandPermission("mcmmo.commands.mmopower") +@CommandAlias("mmopowerlevel|powerlevel") //Kept for historical reasons +public class PowerLevelCommand extends BaseCommand { + private final @NotNull mcMMO pluginRef; + + public PowerLevelCommand(@NotNull mcMMO pluginRef) { + this.pluginRef = pluginRef; + } + + @Default + @Conditions(CommandManager.ADMIN_CONDITION) + public void processCommand(String[] args) { + BukkitCommandIssuer bukkitCommandIssuer = (BukkitCommandIssuer) getCurrentCommandIssuer(); + Player player = bukkitCommandIssuer.getPlayer(); + + //TODO: impl + } +} \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/Config.java b/src/main/java/com/gmail/nossr50/config/Config.java index cc8549303..a59a0e81f 100644 --- a/src/main/java/com/gmail/nossr50/config/Config.java +++ b/src/main/java/com/gmail/nossr50/config/Config.java @@ -597,4 +597,5 @@ public class Config extends AutoUpdateConfigLoader { public int getPowerLevelUpBroadcastRadius() { return config.getInt("General.Level_Up_Chat_Broadcasts.Broadcast_Powerlevels.Broadcast_Targets.Distance_Restrictions.Restricted_Radius", 100); } public int getPowerLevelUpBroadcastInterval() { return config.getInt("General.Level_Up_Chat_Broadcasts.Broadcast_Powerlevels.Milestone_Interval", 100); } + public boolean isMasterySystemEnabled() { return config.getBoolean( "General.PowerLevel.Skill_Mastery.Enabled"); } } diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/SubSkillType.java b/src/main/java/com/gmail/nossr50/datatypes/skills/SubSkillType.java index 059df8db9..823f6b664 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/SubSkillType.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/SubSkillType.java @@ -11,16 +11,19 @@ public enum SubSkillType { /* ACROBATICS */ ACROBATICS_DODGE(1), ACROBATICS_ROLL, + ACROBATICS_MASTERY(1), /* ALCHEMY */ ALCHEMY_CATALYSIS(1), ALCHEMY_CONCOCTIONS(8), + ALCHEMY_MASTERY(1), /* ARCHERY */ ARCHERY_ARROW_RETRIEVAL(1), ARCHERY_DAZE, ARCHERY_SKILL_SHOT(20), ARCHERY_ARCHERY_LIMIT_BREAK(10), + ARCHERY_MASTERY(1), /* Axes */ AXES_ARMOR_IMPACT(20), @@ -29,10 +32,12 @@ public enum SubSkillType { AXES_CRITICAL_STRIKES(1), AXES_GREATER_IMPACT(1), AXES_SKULL_SPLITTER(1), + AXES_MASTERY(1), /* Excavation */ EXCAVATION_ARCHAEOLOGY(8), EXCAVATION_GIGA_DRILL_BREAKER(1), + EXCAVATION_MASTERY(1), /* Fishing */ FISHING_FISHERMANS_DIET(5), @@ -41,6 +46,7 @@ public enum SubSkillType { FISHING_MASTER_ANGLER(8), FISHING_TREASURE_HUNTER(8), FISHING_SHAKE(1), + FISHING_MASTERY(1), /* Herbalism */ HERBALISM_DOUBLE_DROPS(1), @@ -49,6 +55,7 @@ public enum SubSkillType { HERBALISM_GREEN_THUMB(4), HERBALISM_HYLIAN_LUCK, HERBALISM_SHROOM_THUMB, + HERBALISM_MASTERY(1), /* Mining */ MINING_BIGGER_BOMBS(1), @@ -56,11 +63,13 @@ public enum SubSkillType { MINING_DEMOLITIONS_EXPERTISE(1), MINING_DOUBLE_DROPS(1), MINING_SUPER_BREAKER(1), + MINING_MASTERY(1), /* Repair */ REPAIR_ARCANE_FORGING(8), REPAIR_REPAIR_MASTERY(1), REPAIR_SUPER_REPAIR(1), + REPAIR_MASTERY(1), /* Salvage */ SALVAGE_SCRAP_COLLECTOR(8), @@ -77,6 +86,7 @@ public enum SubSkillType { SWORDS_SERRATED_STRIKES(1), SWORDS_STAB(2), SWORDS_SWORDS_LIMIT_BREAK(10), + SWORDS_MASTERY(1), /* Taming */ TAMING_BEAST_LORE(1), @@ -89,6 +99,7 @@ public enum SubSkillType { TAMING_SHARPENED_CLAWS(1), TAMING_SHOCK_PROOF(1), TAMING_THICK_FUR(1), + TAMING_MASTERY(1), /* Unarmed */ UNARMED_ARROW_DEFLECT(1), @@ -98,6 +109,7 @@ public enum SubSkillType { UNARMED_STEEL_ARM_STYLE(20), UNARMED_IRON_GRIP(1), UNARMED_UNARMED_LIMIT_BREAK(10), + UNARMED_MASTERY(1), /* Woodcutting */ /* WOODCUTTING_BARK_SURGEON(3),*/ @@ -106,7 +118,10 @@ public enum SubSkillType { WOODCUTTING_LEAF_BLOWER(1), /* WOODCUTTING_NATURES_BOUNTY(3), WOODCUTTING_SPLINTER(3),*/ - WOODCUTTING_TREE_FELLER(1); + WOODCUTTING_TREE_FELLER(1), + WOODCUTTING_MASTERY(1), + + POWER_LEVEL_MASTERY(1); private final int numRanks; //TODO: SuperAbilityType should also contain flags for active by default? Not sure if it should work that way. diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index ad1a09e69..10b9dd572 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -49,6 +49,9 @@ General: RetroMode: Enabled: true Locale: en_US + PowerLevel: + Skill_Mastery: + Enabled: true AprilFoolsEvent: true MOTD_Enabled: true EventBroadcasts: true diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 70499738e..a63be2f84 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -149,6 +149,10 @@ commands: salvage: description: Detailed mcMMO skill info permission: mcmmo.commands.salvage + mmopower: + description: Shows skill mastery and power level info + permission: mcmmo.commands.mmopower + aliases: [mmopowerlevel, powerlevel] adminchat: aliases: [ac, a] description: Toggle Admin chat or send admin chat messages @@ -825,6 +829,7 @@ permissions: mcmmo.commands.taming: true mcmmo.commands.unarmed: true mcmmo.commands.woodcutting: true + mcmmo.commands.mmopower: true mcmmo.commands.defaultsop: description: Implies all default op mcmmo.commands permissions. children: