2013-01-30 17:53:51 +01:00
|
|
|
package com.gmail.nossr50.skills.utilities;
|
2012-01-09 20:00:13 +01:00
|
|
|
|
2013-02-13 04:18:47 +01:00
|
|
|
import com.gmail.nossr50.mcMMO;
|
2012-04-26 16:27:57 +02:00
|
|
|
import com.gmail.nossr50.config.Config;
|
2013-02-15 15:26:01 +01:00
|
|
|
import com.gmail.nossr50.locale.LocaleLoader;
|
|
|
|
import com.gmail.nossr50.util.StringUtils;
|
2012-02-27 23:28:32 +01:00
|
|
|
|
2012-03-30 05:08:51 +02:00
|
|
|
public enum SkillType {
|
2013-02-20 22:44:15 +01:00
|
|
|
ACROBATICS,
|
|
|
|
ARCHERY,
|
|
|
|
AXES(AbilityType.SKULL_SPLITTER, ToolType.AXE),
|
|
|
|
EXCAVATION(AbilityType.GIGA_DRILL_BREAKER, ToolType.SHOVEL),
|
|
|
|
FISHING,
|
|
|
|
HERBALISM(AbilityType.GREEN_TERRA, ToolType.HOE),
|
|
|
|
MINING(AbilityType.SUPER_BREAKER, ToolType.PICKAXE),
|
|
|
|
REPAIR,
|
|
|
|
SMELTING,
|
|
|
|
SWORDS(AbilityType.SERRATED_STRIKES, ToolType.SWORD),
|
|
|
|
TAMING,
|
|
|
|
UNARMED(AbilityType.BERSERK, ToolType.FISTS),
|
|
|
|
WOODCUTTING(AbilityType.TREE_FELLER, ToolType.AXE);
|
2012-03-30 05:08:51 +02:00
|
|
|
|
|
|
|
private AbilityType ability;
|
|
|
|
private ToolType tool;
|
|
|
|
|
|
|
|
private SkillType() {
|
|
|
|
this.ability = null;
|
|
|
|
this.tool = null;
|
|
|
|
}
|
|
|
|
|
2013-02-20 22:44:15 +01:00
|
|
|
private SkillType(AbilityType ability, ToolType tool) {
|
2012-03-30 05:08:51 +02:00
|
|
|
this.ability = ability;
|
|
|
|
this.tool = tool;
|
|
|
|
}
|
|
|
|
|
|
|
|
public AbilityType getAbility() {
|
|
|
|
return ability;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the max level of this skill.
|
|
|
|
*
|
|
|
|
* @return the max level of this skill
|
|
|
|
*/
|
|
|
|
public int getMaxLevel() {
|
2013-02-20 22:44:15 +01:00
|
|
|
return Config.getInstance().getLevelCap(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean getPVPEnabled() {
|
|
|
|
return Config.getInstance().getPVPEnabled(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean getPVEEnabled() {
|
|
|
|
return Config.getInstance().getPVEEnabled(this);
|
|
|
|
}
|
2013-01-10 04:43:21 +01:00
|
|
|
|
2013-02-20 22:44:15 +01:00
|
|
|
public boolean getDoubleDropsDisabled() {
|
|
|
|
return Config.getInstance().getDoubleDropsDisabled(this);
|
2012-03-30 05:08:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public ToolType getTool() {
|
|
|
|
return tool;
|
|
|
|
}
|
|
|
|
|
2012-03-26 23:31:15 +02:00
|
|
|
public double getXpModifier() {
|
2013-02-20 22:44:15 +01:00
|
|
|
return Config.getInstance().getForumulaMultiplier(this);
|
2012-03-26 23:31:15 +02:00
|
|
|
}
|
2013-01-21 23:22:54 +01:00
|
|
|
|
2013-01-15 23:49:20 +01:00
|
|
|
public static SkillType getSkill(String skillName) {
|
2013-02-15 15:26:01 +01:00
|
|
|
if (!Config.getInstance().getLocale().equalsIgnoreCase("en_US")) {
|
|
|
|
for (SkillType type : values()) {
|
|
|
|
if (skillName.equalsIgnoreCase(LocaleLoader.getString(StringUtils.getCapitalized(type.name()) + ".SkillName"))) {
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-07 18:17:18 +01:00
|
|
|
for (SkillType type : values()) {
|
2013-01-21 23:15:53 +01:00
|
|
|
if (type.name().equalsIgnoreCase(skillName)) {
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-13 04:18:47 +01:00
|
|
|
mcMMO.p.getLogger().warning("[DEBUG] Invalid mcMMO skill (" + skillName + ")");
|
2013-01-21 23:15:53 +01:00
|
|
|
return null;
|
2013-01-15 23:49:20 +01:00
|
|
|
}
|
2012-03-27 05:01:51 +02:00
|
|
|
|
2013-02-01 11:49:44 +01:00
|
|
|
// TODO: This is a little "hacky", we probably need to add something to distinguish child skills in the enum, or to use another enum for them
|
2013-01-23 22:34:01 +01:00
|
|
|
public boolean isChildSkill() {
|
|
|
|
switch (this) {
|
|
|
|
case SMELTING:
|
|
|
|
return true;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2012-01-09 20:00:13 +01:00
|
|
|
}
|