mcMMO/src/main/java/com/gmail/nossr50/skills/smelting/SmeltingCommand.java

134 lines
5.5 KiB
Java
Raw Normal View History

2013-01-23 22:34:01 +01:00
package com.gmail.nossr50.skills.smelting;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.SkillCommand;
import com.gmail.nossr50.skills.utilities.SkillType;
2013-01-23 22:34:01 +01:00
import com.gmail.nossr50.util.Permissions;
public class SmeltingCommand extends SkillCommand {
private String burnTimeModifier;
private String secondSmeltChance;
private String secondSmeltChanceLucky;
private String fluxMiningChance;
private String fluxMiningChanceLucky;
private String vanillaXPModifier;
private boolean canFuelEfficiency;
private boolean canSecondSmelt;
private boolean canFluxMine;
private boolean canVanillaXPBoost;
public SmeltingCommand() {
super(SkillType.SMELTING);
}
@Override
protected void dataCalculations() {
//FUEL EFFICIENCY
burnTimeModifier = decimal.format(1 + ((skillValue / Smelting.burnModifierMaxLevel) * Smelting.burnTimeMultiplier));
2013-01-23 22:34:01 +01:00
//SECOND SMELT
String[] secondSmeltStrings = calculateAbilityDisplayValues(Smelting.secondSmeltMaxLevel, Smelting.secondSmeltMaxChance);
secondSmeltChance = secondSmeltStrings[0];
secondSmeltChanceLucky = secondSmeltStrings[1];
//FLUX MINING
String[] fluxMiningStrings = calculateAbilityDisplayValues(Smelting.fluxMiningChance);
fluxMiningChance = fluxMiningStrings[0];
fluxMiningChanceLucky = fluxMiningStrings[1];
//VANILLA XP BOOST
if (skillValue >= Smelting.vanillaXPBoostRank5Level) {
vanillaXPModifier = String.valueOf(Smelting.vanillaXPBoostRank5Multiplier);
2013-01-23 22:34:01 +01:00
}
else if (skillValue >= Smelting.vanillaXPBoostRank4Level) {
vanillaXPModifier = String.valueOf(Smelting.vanillaXPBoostRank4Multiplier);
2013-01-23 22:34:01 +01:00
}
else if (skillValue >= Smelting.vanillaXPBoostRank3Level) {
vanillaXPModifier = String.valueOf(Smelting.vanillaXPBoostRank3Multiplier);
2013-01-23 22:34:01 +01:00
}
else if (skillValue >= Smelting.vanillaXPBoostRank2Level) {
vanillaXPModifier = String.valueOf(Smelting.vanillaXPBoostRank2Multiplier);
2013-01-23 22:34:01 +01:00
}
else {
vanillaXPModifier = String.valueOf(Smelting.vanillaXPBoostRank1Multiplier);
2013-01-23 22:34:01 +01:00
}
}
@Override
protected void permissionsCheck() {
canFuelEfficiency = Permissions.fuelEfficiency(player);
canSecondSmelt = Permissions.doubleDrops(player, skill);
2013-01-23 22:34:01 +01:00
canFluxMine = Permissions.fluxMining(player);
canVanillaXPBoost = Permissions.vanillaXpBoost(player, skill);
2013-01-23 22:34:01 +01:00
}
@Override
protected boolean effectsHeaderPermissions() {
return canFluxMine || canFuelEfficiency || canSecondSmelt || canVanillaXPBoost;
}
@Override
protected void effectsDisplay() {
luckyEffectsDisplay();
if (canFuelEfficiency) {
2013-02-02 08:55:49 +01:00
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Smelting.Effect.0"), LocaleLoader.getString("Smelting.Effect.1")));
2013-01-23 22:34:01 +01:00
}
if (canSecondSmelt) {
2013-02-02 08:55:49 +01:00
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Smelting.Effect.2"), LocaleLoader.getString("Smelting.Effect.3")));
2013-01-23 22:34:01 +01:00
}
if (canVanillaXPBoost) {
2013-02-02 08:55:49 +01:00
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Smelting.Effect.4"), LocaleLoader.getString("Smelting.Effect.5")));
2013-01-23 22:34:01 +01:00
}
if (canFluxMine) {
2013-02-02 08:55:49 +01:00
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Smelting.Effect.6"), LocaleLoader.getString("Smelting.Effect.7")));
2013-01-23 22:34:01 +01:00
}
}
@Override
protected boolean statsHeaderPermissions() {
return canFluxMine || canFuelEfficiency || canSecondSmelt || canVanillaXPBoost;
}
@Override
protected void statsDisplay() {
if (canFuelEfficiency) {
2013-02-02 08:55:49 +01:00
player.sendMessage(LocaleLoader.getString("Smelting.Ability.FuelEfficiency", burnTimeModifier));
2013-01-23 22:34:01 +01:00
}
if (canSecondSmelt) {
if (isLucky) {
2013-02-02 08:55:49 +01:00
player.sendMessage(LocaleLoader.getString("Smelting.Ability.SecondSmelt", secondSmeltChance) + LocaleLoader.getString("Perks.lucky.bonus", secondSmeltChanceLucky));
2013-01-23 22:34:01 +01:00
}
else {
2013-02-02 08:55:49 +01:00
player.sendMessage(LocaleLoader.getString("Smelting.Ability.SecondSmelt", secondSmeltChance));
2013-01-23 22:34:01 +01:00
}
}
if (canVanillaXPBoost) {
if (skillValue < Smelting.vanillaXPBoostRank1Level) {
2013-02-02 08:55:49 +01:00
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Smelting.Ability.Locked.0", Smelting.vanillaXPBoostRank1Level)));
2013-01-23 22:34:01 +01:00
}
else {
2013-02-02 08:55:49 +01:00
player.sendMessage(LocaleLoader.getString("Smelting.Ability.VanillaXPBoost", vanillaXPModifier));
2013-01-23 22:34:01 +01:00
}
}
if (canFluxMine) {
if (skillValue < Smelting.fluxMiningUnlockLevel) {
2013-02-02 08:55:49 +01:00
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Smelting.Ability.Locked.1", Smelting.fluxMiningUnlockLevel)));
2013-01-23 22:34:01 +01:00
}
else if (isLucky) {
2013-02-02 08:55:49 +01:00
player.sendMessage(LocaleLoader.getString("Smelting.Ability.FluxMining", fluxMiningChance) + LocaleLoader.getString("Perks.lucky.bonus", fluxMiningChanceLucky));
2013-01-23 22:34:01 +01:00
}
else {
2013-02-02 08:55:49 +01:00
player.sendMessage(LocaleLoader.getString("Smelting.Ability.FluxMining", fluxMiningChance));
2013-01-23 22:34:01 +01:00
}
}
}
}