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:32:23 +01:00
|
|
|
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType;
|
2013-03-01 06:52:01 +01:00
|
|
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
|
|
import com.gmail.nossr50.locale.LocaleLoader;
|
2013-10-01 14:57:21 +02:00
|
|
|
import com.gmail.nossr50.skills.mining.BlastMining.Tier;
|
2013-03-01 06:52:01 +01:00
|
|
|
import com.gmail.nossr50.skills.mining.MiningManager;
|
|
|
|
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 MiningCommand extends SkillCommand {
|
|
|
|
private String doubleDropChance;
|
|
|
|
private String doubleDropChanceLucky;
|
|
|
|
private String superBreakerLength;
|
|
|
|
private String superBreakerLengthEndurance;
|
|
|
|
|
|
|
|
private int blastMiningRank;
|
|
|
|
private int bonusTNTDrops;
|
|
|
|
private double blastRadiusIncrease;
|
|
|
|
private String oreBonus;
|
|
|
|
private String debrisReduction;
|
|
|
|
private String blastDamageDecrease;
|
|
|
|
|
|
|
|
private boolean canSuperBreaker;
|
|
|
|
private boolean canDoubleDrop;
|
|
|
|
private boolean canBlast;
|
|
|
|
private boolean canBiggerBombs;
|
|
|
|
private boolean canDemoExpert;
|
|
|
|
|
|
|
|
public MiningCommand() {
|
|
|
|
super(SkillType.MINING);
|
|
|
|
}
|
|
|
|
|
|
|
|
@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
|
|
|
// SUPER BREAKER
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canSuperBreaker) {
|
2013-10-29 20:38:20 +01:00
|
|
|
String[] superBreakerStrings = calculateLengthDisplayValues(player, skillValue);
|
2013-03-12 21:25:42 +01:00
|
|
|
superBreakerLength = superBreakerStrings[0];
|
|
|
|
superBreakerLengthEndurance = superBreakerStrings[1];
|
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
|
|
|
|
// DOUBLE DROPS
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canDoubleDrop) {
|
2013-11-22 18:32:23 +01:00
|
|
|
String[] doubleDropStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbilityType.MINING_DOUBLE_DROPS, isLucky);
|
2013-03-12 21:25:42 +01:00
|
|
|
doubleDropChance = doubleDropStrings[0];
|
|
|
|
doubleDropChanceLucky = doubleDropStrings[1];
|
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
|
|
|
|
// BLAST MINING
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canBlast || canDemoExpert || canBiggerBombs) {
|
2013-10-29 20:38:20 +01:00
|
|
|
MiningManager miningManager = UserManager.getPlayer(player).getMiningManager();
|
2013-03-12 21:25:42 +01:00
|
|
|
|
|
|
|
blastMiningRank = miningManager.getBlastMiningTier();
|
|
|
|
bonusTNTDrops = miningManager.getDropMultiplier();
|
|
|
|
oreBonus = percent.format(miningManager.getOreBonus() / 30.0D); // Base received in TNT is 30%
|
|
|
|
debrisReduction = percent.format(miningManager.getDebrisReduction() / 30.0D); // Base received in TNT is 30%
|
|
|
|
blastDamageDecrease = percent.format(miningManager.getBlastDamageModifier() / 100.0D);
|
|
|
|
blastRadiusIncrease = miningManager.getBlastRadiusModifier();
|
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2013-10-29 20:38:20 +01:00
|
|
|
protected void permissionsCheck(Player player) {
|
2013-03-01 06:52:01 +01:00
|
|
|
canBiggerBombs = Permissions.biggerBombs(player);
|
|
|
|
canBlast = Permissions.remoteDetonation(player);
|
|
|
|
canDemoExpert = Permissions.demolitionsExpertise(player);
|
2013-11-22 18:32:23 +01:00
|
|
|
canDoubleDrop = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.MINING_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled();
|
2013-03-01 06:52:01 +01:00
|
|
|
canSuperBreaker = Permissions.superBreaker(player);
|
|
|
|
}
|
|
|
|
|
|
|
|
@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 (canSuperBreaker) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Mining.Effect.0"), LocaleLoader.getString("Mining.Effect.1")));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canDoubleDrop) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Mining.Effect.2"), LocaleLoader.getString("Mining.Effect.3")));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (canBlast) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Mining.Effect.4"), LocaleLoader.getString("Mining.Effect.5")));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (canBiggerBombs) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Mining.Effect.6"), LocaleLoader.getString("Mining.Effect.7")));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (canDemoExpert) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Mining.Effect.8"), LocaleLoader.getString("Mining.Effect.9")));
|
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-12 21:25:42 +01:00
|
|
|
if (canDoubleDrop) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Mining.Effect.DropChance", doubleDropChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : ""));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (canSuperBreaker) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Mining.Ability.Length", superBreakerLength) + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", superBreakerLengthEndurance) : ""));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (canBlast) {
|
2013-10-01 14:57:21 +02:00
|
|
|
int unlockLevel = AdvancedConfig.getInstance().getBlastMiningRankLevel(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("Mining.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("Mining.Blast.Rank", blastMiningRank, Tier.EIGHT.toNumerical(), LocaleLoader.getString("Mining.Blast.Effect", oreBonus, debrisReduction, bonusTNTDrops)));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (canBiggerBombs) {
|
2013-10-01 14:57:21 +02:00
|
|
|
int unlockLevel = AdvancedConfig.getInstance().getBlastMiningRankLevel(Tier.TWO);
|
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("Mining.Ability.Locked.1", unlockLevel)));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
else {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Mining.Blast.Radius.Increase", blastRadiusIncrease));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (canDemoExpert) {
|
2013-10-01 14:57:21 +02:00
|
|
|
int unlockLevel = AdvancedConfig.getInstance().getBlastMiningRankLevel(Tier.FOUR);
|
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("Mining.Ability.Locked.2", unlockLevel)));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
else {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Mining.Effect.Decrease", blastDamageDecrease));
|
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
|
|
|
}
|
|
|
|
}
|