diff --git a/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java b/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java index 7f9f7043c..e5481470a 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java +++ b/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java @@ -912,9 +912,23 @@ public class PlayerProfile { */ public int getSkillLevel(SkillType skillType) { + if (skillType.isChildSkill()) { + return getChildSkillLevel(skillType); + } + return skills.get(skillType); } + public int getChildSkillLevel(SkillType skillType) { + switch (skillType) { + case SMELTING: + return ((getSkillLevel(SkillType.MINING) / 4) + (getSkillLevel(SkillType.REPAIR) / 4)); //TODO: Make this cleaner somehow + + default: + return 0; + } + } + public int getSkillXpLevel(SkillType skillType) { return skillsXp.get(skillType); } diff --git a/src/main/java/com/gmail/nossr50/skills/SkillManager.java b/src/main/java/com/gmail/nossr50/skills/SkillManager.java index 60e98772a..2e7f3853e 100644 --- a/src/main/java/com/gmail/nossr50/skills/SkillManager.java +++ b/src/main/java/com/gmail/nossr50/skills/SkillManager.java @@ -19,13 +19,6 @@ public abstract class SkillManager { this.skillLevel = profile.getSkillLevel(skill); this.activationChance = Misc.calculateActivationChance(Permissions.lucky(player, skill)); } - - public SkillManager(Player player, SkillType child, SkillType parent1, SkillType parent2) { - this.player = player; - this.profile = Users.getProfile(player); - this.skillLevel = (profile.getSkillLevel(parent1) / 4) + (profile.getSkillLevel(parent2) / 4); //TODO: Make this cleaner somehow - this.activationChance = Misc.calculateActivationChance(Permissions.lucky(player, child)); - } public Player getPlayer() { return player; diff --git a/src/main/java/com/gmail/nossr50/skills/smelting/SmeltingCommand.java b/src/main/java/com/gmail/nossr50/skills/smelting/SmeltingCommand.java index f8ec67ecf..6fc695889 100644 --- a/src/main/java/com/gmail/nossr50/skills/smelting/SmeltingCommand.java +++ b/src/main/java/com/gmail/nossr50/skills/smelting/SmeltingCommand.java @@ -20,7 +20,6 @@ public class SmeltingCommand extends SkillCommand { public SmeltingCommand() { super(SkillType.SMELTING); - this.skillValue = (profile.getSkillLevel(SkillType.MINING) / 4) + (profile.getSkillLevel(SkillType.REPAIR) / 4); //TODO: Make this cleaner somehow } @Override