Просмотр исходного кода

Setup the hardcore/vampirism config

nossr50 6 лет назад
Родитель
Сommit
c698bed05e

+ 19 - 0
src/main/java/com/gmail/nossr50/config/hocon/hardcore/ConfigHardcore.java

@@ -1,7 +1,26 @@
 package com.gmail.nossr50.config.hocon.hardcore;
 package com.gmail.nossr50.config.hocon.hardcore;
 
 
+import ninja.leaping.configurate.objectmapping.Setting;
 import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
 import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
 
 
 @ConfigSerializable
 @ConfigSerializable
 public class ConfigHardcore {
 public class ConfigHardcore {
+
+    @Setting(value = "Hardcore-Death-Penalty", comment = "Hardcore penalizes players for dying by removing mcMMO levels from them." +
+            "\nThis mechanic was inspired by a popular Action-RPG, it was one of the last things I added when I left the mcMMO project in 2013." +
+            "\nFeels good to be back :D")
+    private ConfigHardcoreDeathPenalty deathPenalty = new ConfigHardcoreDeathPenalty();
+
+    @Setting(value = "Vampirism", comment = "Vampirism allows players to steal levels from another in PVP." +
+            "\nVampirism requires hardcore mode to be enabled to function.")
+    private ConfigVampirism vampirism = new ConfigVampirism();
+
+    public ConfigHardcoreDeathPenalty getDeathPenalty() {
+        return deathPenalty;
+    }
+
+    public ConfigVampirism getVampirism() {
+        return vampirism;
+    }
+
 }
 }

+ 51 - 0
src/main/java/com/gmail/nossr50/config/hocon/hardcore/ConfigHardcoreDeathPenalty.java

@@ -0,0 +1,51 @@
+package com.gmail.nossr50.config.hocon.hardcore;
+
+import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
+import ninja.leaping.configurate.objectmapping.Setting;
+import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
+
+import java.util.HashMap;
+
+@ConfigSerializable
+public class ConfigHardcoreDeathPenalty {
+    private static final double PENALTY_PERCENTAGE_DEFAULT = 75.0D;
+    private static final int LEVEL_THRESHOLD_DEFAULT = 0;
+    private static final HashMap<PrimarySkillType, Boolean> HARDCORE_SKILL_TOGGLE_MAP_DEFAULT;
+
+    static {
+        HARDCORE_SKILL_TOGGLE_MAP_DEFAULT = new HashMap<>();
+
+        for(PrimarySkillType primarySkillType : PrimarySkillType.values()) {
+            if(primarySkillType.isChildSkill())
+                continue;
+
+            HARDCORE_SKILL_TOGGLE_MAP_DEFAULT.put(primarySkillType, false);
+        }
+
+    }
+
+    @Setting(value = "Death-Penalty-Percentage", comment = "The amount of levels a player will lose when they die with Hardcore mode enabled." +
+            "\nWith default settings, a player who died at level 100 would have their skills reduced to 25 after death." +
+            "\nDefault value: "+PENALTY_PERCENTAGE_DEFAULT)
+    private double penaltyPercentage = PENALTY_PERCENTAGE_DEFAULT;
+
+    @Setting(value = "Safe-Level-Threshold", comment = "Players will not be subject to hardcore penalties for skills below this level." +
+            "\nDefault value: "+LEVEL_THRESHOLD_DEFAULT)
+    private int levelThreshold = LEVEL_THRESHOLD_DEFAULT;
+
+    @Setting(value = "Skills-Using-Hardcore-Mode", comment = "Hardcore mode is enabled on a per skill basis" +
+            "\nYou can choose which skills participate in this list.")
+    private HashMap<PrimarySkillType, Boolean> skillToggleMap = HARDCORE_SKILL_TOGGLE_MAP_DEFAULT;
+
+    public double getPenaltyPercentage() {
+        return penaltyPercentage;
+    }
+
+    public int getLevelThreshold() {
+        return levelThreshold;
+    }
+
+    public HashMap<PrimarySkillType, Boolean> getSkillToggleMap() {
+        return skillToggleMap;
+    }
+}

+ 51 - 0
src/main/java/com/gmail/nossr50/config/hocon/hardcore/ConfigVampirism.java

@@ -0,0 +1,51 @@
+package com.gmail.nossr50.config.hocon.hardcore;
+
+import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
+import ninja.leaping.configurate.objectmapping.Setting;
+import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
+
+import java.util.HashMap;
+
+@ConfigSerializable
+public class ConfigVampirism {
+    private static final double PENALTY_PERCENTAGE_DEFAULT = 5.0D;
+    private static final int LEVEL_THRESHOLD_DEFAULT = 0;
+    private static final HashMap<PrimarySkillType, Boolean> HARDCORE_SKILL_TOGGLE_MAP_DEFAULT;
+
+    static {
+        HARDCORE_SKILL_TOGGLE_MAP_DEFAULT = new HashMap<>();
+
+        for(PrimarySkillType primarySkillType : PrimarySkillType.values()) {
+            if(primarySkillType.isChildSkill())
+                continue;
+
+            HARDCORE_SKILL_TOGGLE_MAP_DEFAULT.put(primarySkillType, false);
+        }
+
+    }
+
+    @Setting(value = "Vampirism-Level-Theft-Percentage", comment = "The amount of levels a player will steal from another player when they die with hardcore mode enabled." +
+            "\nDefault value: "+PENALTY_PERCENTAGE_DEFAULT)
+    private double penaltyPercentage = PENALTY_PERCENTAGE_DEFAULT;
+
+    @Setting(value = "Safe-Level-Threshold", comment = "Players will not be subject to vampirism penalties for skills below this level." +
+            "\nDefault value: "+LEVEL_THRESHOLD_DEFAULT)
+    private int levelThreshold = LEVEL_THRESHOLD_DEFAULT;
+
+    @Setting(value = "Skills-Using-Vampirism-Mode", comment = "Vampirism mode is enabled on a per skill basis" +
+            "\nYou can choose which skills participate in this list." +
+            "\nOnly skills that are also enabled in hardcore mode will work, so make sure to turn hardcore mode on for said skills as well.")
+    private HashMap<PrimarySkillType, Boolean> skillToggleMap = HARDCORE_SKILL_TOGGLE_MAP_DEFAULT;
+
+    public double getPenaltyPercentage() {
+        return penaltyPercentage;
+    }
+
+    public int getLevelThreshold() {
+        return levelThreshold;
+    }
+
+    public HashMap<PrimarySkillType, Boolean> getSkillToggleMap() {
+        return skillToggleMap;
+    }
+}