Setup the hardcore/vampirism config

This commit is contained in:
nossr50 2019-06-06 05:25:37 -07:00
parent 237311a98f
commit c698bed05e
3 changed files with 121 additions and 0 deletions

View File

@ -1,7 +1,26 @@
package com.gmail.nossr50.config.hocon.hardcore;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}