Adding AdvancedConfig

This commit is contained in:
TfT_02
2012-11-21 21:49:54 +01:00
parent 8e3320ad72
commit 0d2abb95b5
37 changed files with 910 additions and 442 deletions

View File

@@ -1,14 +1,23 @@
package com.gmail.nossr50.commands.skills;
import java.text.DecimalFormat;
import com.gmail.nossr50.commands.SkillCommand;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
public class WoodcuttingCommand extends SkillCommand {
AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
private String treeFellerLength;
private String doubleDropChance;
private int abilityLengthIncreaseLevel = advancedConfig.getAbilityLength();
private double doubleDropsMaxBonus = advancedConfig.getWoodcuttingDoubleDropChance();
private int doubleDropsMaxLevel = advancedConfig.getWoodcuttingDoubleDropMaxLevel();
private int leafBlowUnlock = advancedConfig.getLeafBlowUnlockLevel();
private boolean canTreeFell;
private boolean canLeafBlow;
private boolean canDoubleDrop;
@@ -20,14 +29,11 @@ public class WoodcuttingCommand extends SkillCommand {
@Override
protected void dataCalculations() {
treeFellerLength = String.valueOf(2 + ((int) skillValue / 50));
DecimalFormat df = new DecimalFormat("0.0");
if (skillValue >= 1000) {
doubleDropChance = "100.00%";
}
else {
doubleDropChance = percent.format(skillValue / 1000);
}
treeFellerLength = String.valueOf(2 + ((int) skillValue / abilityLengthIncreaseLevel));
if(skillValue >= doubleDropsMaxLevel) doubleDropChance = df.format(doubleDropsMaxBonus);
else doubleDropChance = df.format((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue);
}
@Override
@@ -69,8 +75,8 @@ public class WoodcuttingCommand extends SkillCommand {
protected void statsDisplay() {
//TODO: Remove? Basically duplicates the above.
if (canLeafBlow) {
if (skillValue < 100) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Woodcutting.Ability.Locked.0") }));
if (skillValue < leafBlowUnlock) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Woodcutting.Ability.Locked.0", new Object[] { leafBlowUnlock }) }));
}
else {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Woodcutting.Ability.0"), LocaleLoader.getString("Woodcutting.Ability.1") }));