2013-03-01 06:52:01 +01:00
|
|
|
package com.gmail.nossr50.commands.skills;
|
|
|
|
|
2013-10-29 20:38:20 +01:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
2013-03-01 06:52:01 +01:00
|
|
|
import com.gmail.nossr50.config.AdvancedConfig;
|
2013-11-22 18:48:53 +01:00
|
|
|
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
2013-03-01 06:52:01 +01:00
|
|
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
|
|
import com.gmail.nossr50.locale.LocaleLoader;
|
|
|
|
import com.gmail.nossr50.skills.smelting.Smelting;
|
2013-10-01 14:57:21 +02:00
|
|
|
import com.gmail.nossr50.skills.smelting.Smelting.Tier;
|
2013-03-01 06:52:01 +01:00
|
|
|
import com.gmail.nossr50.util.Permissions;
|
2013-10-29 20:38:20 +01:00
|
|
|
import com.gmail.nossr50.util.player.UserManager;
|
2013-03-01 06:52:01 +01:00
|
|
|
|
|
|
|
public class SmeltingCommand extends SkillCommand {
|
|
|
|
private String burnTimeModifier;
|
|
|
|
private String secondSmeltChance;
|
|
|
|
private String secondSmeltChanceLucky;
|
|
|
|
private String fluxMiningChance;
|
|
|
|
private String fluxMiningChanceLucky;
|
|
|
|
|
|
|
|
private boolean canFuelEfficiency;
|
|
|
|
private boolean canSecondSmelt;
|
|
|
|
private boolean canFluxMine;
|
|
|
|
private boolean canVanillaXPBoost;
|
|
|
|
|
|
|
|
public SmeltingCommand() {
|
|
|
|
super(SkillType.SMELTING);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2013-10-29 20:38:20 +01:00
|
|
|
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
|
2013-03-01 06:52:01 +01:00
|
|
|
// FUEL EFFICIENCY
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canFuelEfficiency) {
|
|
|
|
burnTimeModifier = decimal.format(1 + ((skillValue / Smelting.burnModifierMaxLevel) * Smelting.burnTimeMultiplier));
|
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
|
|
|
|
// SECOND SMELT
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canSecondSmelt) {
|
2013-11-22 18:48:53 +01:00
|
|
|
String[] secondSmeltStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.SECOND_SMELT, isLucky);
|
2013-03-12 21:25:42 +01:00
|
|
|
secondSmeltChance = secondSmeltStrings[0];
|
|
|
|
secondSmeltChanceLucky = secondSmeltStrings[1];
|
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
|
|
|
|
// FLUX MINING
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canFluxMine) {
|
2013-10-29 20:38:20 +01:00
|
|
|
String[] fluxMiningStrings = calculateAbilityDisplayValues(Smelting.fluxMiningChance, isLucky);
|
2013-03-12 21:25:42 +01:00
|
|
|
fluxMiningChance = fluxMiningStrings[0];
|
|
|
|
fluxMiningChanceLucky = fluxMiningStrings[1];
|
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2013-10-29 20:38:20 +01:00
|
|
|
protected void permissionsCheck(Player player) {
|
2013-11-22 18:48:53 +01:00
|
|
|
canFuelEfficiency = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FUEL_EFFICIENCY);
|
|
|
|
canSecondSmelt = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SECOND_SMELT);
|
|
|
|
canFluxMine = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FLUX_MINING);
|
2013-03-01 06:52:01 +01:00
|
|
|
canVanillaXPBoost = Permissions.vanillaXpBoost(player, skill);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2013-10-29 20:38:20 +01:00
|
|
|
protected List<String> effectsDisplay() {
|
|
|
|
List<String> messages = new ArrayList<String>();
|
2013-03-01 06:52:01 +01:00
|
|
|
|
|
|
|
if (canFuelEfficiency) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Smelting.Effect.0"), LocaleLoader.getString("Smelting.Effect.1")));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (canSecondSmelt) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Smelting.Effect.2"), LocaleLoader.getString("Smelting.Effect.3")));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (canVanillaXPBoost) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Smelting.Effect.4"), LocaleLoader.getString("Smelting.Effect.5")));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (canFluxMine) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Smelting.Effect.6"), LocaleLoader.getString("Smelting.Effect.7")));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
2013-10-29 20:38:20 +01:00
|
|
|
return messages;
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2013-10-29 20:38:20 +01:00
|
|
|
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
|
|
|
List<String> messages = new ArrayList<String>();
|
|
|
|
|
2013-03-01 06:52:01 +01:00
|
|
|
if (canFuelEfficiency) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Smelting.Ability.FuelEfficiency", burnTimeModifier));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (canSecondSmelt) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Smelting.Ability.SecondSmelt", secondSmeltChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", secondSmeltChanceLucky) : ""));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (canVanillaXPBoost) {
|
2013-10-01 17:01:11 +02:00
|
|
|
int unlockLevel = AdvancedConfig.getInstance().getSmeltingRankLevel(Tier.ONE);
|
2013-03-12 21:25:42 +01:00
|
|
|
|
|
|
|
if (skillValue < unlockLevel) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Smelting.Ability.Locked.0", unlockLevel)));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
else {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Smelting.Ability.VanillaXPBoost", UserManager.getPlayer(player).getSmeltingManager().getVanillaXpMultiplier()));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (canFluxMine) {
|
|
|
|
if (skillValue < Smelting.fluxMiningUnlockLevel) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Smelting.Ability.Locked.1", Smelting.fluxMiningUnlockLevel)));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
else {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Smelting.Ability.FluxMining", fluxMiningChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", fluxMiningChanceLucky) : ""));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
}
|
2013-10-29 20:38:20 +01:00
|
|
|
|
|
|
|
return messages;
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
}
|