2013-03-01 06:52:01 +01:00
|
|
|
package com.gmail.nossr50.commands.skills;
|
|
|
|
|
|
|
|
import com.gmail.nossr50.config.AdvancedConfig;
|
|
|
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
|
|
import com.gmail.nossr50.locale.LocaleLoader;
|
|
|
|
import com.gmail.nossr50.skills.mining.Mining;
|
|
|
|
import com.gmail.nossr50.skills.mining.MiningManager;
|
|
|
|
import com.gmail.nossr50.util.Permissions;
|
|
|
|
|
|
|
|
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
|
|
|
|
protected void dataCalculations() {
|
|
|
|
// SUPER BREAKER
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canSuperBreaker) {
|
|
|
|
String[] superBreakerStrings = calculateLengthDisplayValues();
|
|
|
|
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) {
|
|
|
|
String[] doubleDropStrings = calculateAbilityDisplayValues(Mining.doubleDropsMaxLevel, Mining.doubleDropsMaxChance);
|
|
|
|
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) {
|
|
|
|
MiningManager miningManager = mcMMOPlayer.getMiningManager();
|
|
|
|
|
|
|
|
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
|
|
|
|
protected void permissionsCheck() {
|
|
|
|
canBiggerBombs = Permissions.biggerBombs(player);
|
|
|
|
canBlast = Permissions.remoteDetonation(player);
|
|
|
|
canDemoExpert = Permissions.demolitionsExpertise(player);
|
2013-03-12 21:25:42 +01:00
|
|
|
canDoubleDrop = Permissions.doubleDrops(player, skill) && !skill.getDoubleDropsDisabled();
|
2013-03-01 06:52:01 +01:00
|
|
|
canSuperBreaker = Permissions.superBreaker(player);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected boolean effectsHeaderPermissions() {
|
2013-03-12 21:25:42 +01:00
|
|
|
return canBiggerBombs || canBlast || canDemoExpert || canDoubleDrop || canSuperBreaker;
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void effectsDisplay() {
|
|
|
|
luckyEffectsDisplay();
|
|
|
|
|
|
|
|
if (canSuperBreaker) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Mining.Effect.0"), LocaleLoader.getString("Mining.Effect.1")));
|
|
|
|
}
|
|
|
|
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canDoubleDrop) {
|
2013-03-01 06:52:01 +01:00
|
|
|
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Mining.Effect.2"), LocaleLoader.getString("Mining.Effect.3")));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (canBlast) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Mining.Effect.4"), LocaleLoader.getString("Mining.Effect.5")));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (canBiggerBombs) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Mining.Effect.6"), LocaleLoader.getString("Mining.Effect.7")));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (canDemoExpert) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Mining.Effect.8"), LocaleLoader.getString("Mining.Effect.9")));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected boolean statsHeaderPermissions() {
|
2013-03-12 21:25:42 +01:00
|
|
|
return canBiggerBombs || canBlast || canDemoExpert || canDoubleDrop || canSuperBreaker;
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void statsDisplay() {
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canDoubleDrop) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Mining.Effect.DropChance", doubleDropChance) + (isLucky ? LocaleLoader.getString("Perks.lucky.bonus", doubleDropChanceLucky) : ""));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (canSuperBreaker) {
|
2013-03-12 21:25:42 +01:00
|
|
|
player.sendMessage(LocaleLoader.getString("Mining.Ability.Length", superBreakerLength) + (hasEndurance ? LocaleLoader.getString("Perks.activationtime.bonus", superBreakerLengthEndurance) : ""));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (canBlast) {
|
2013-03-12 21:25:42 +01:00
|
|
|
int unlockLevel = AdvancedConfig.getInstance().getBlastMiningRank1();
|
|
|
|
|
|
|
|
if (skillValue < unlockLevel) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Mining.Ability.Locked.0", unlockLevel)));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Mining.Blast.Rank", blastMiningRank, LocaleLoader.getString("Mining.Blast.Effect", oreBonus, debrisReduction, bonusTNTDrops)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (canBiggerBombs) {
|
2013-03-12 21:25:42 +01:00
|
|
|
int unlockLevel = AdvancedConfig.getInstance().getBlastMiningRank2();
|
|
|
|
|
|
|
|
if (skillValue < unlockLevel) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Mining.Ability.Locked.1", unlockLevel)));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Mining.Blast.Radius.Increase", blastRadiusIncrease));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (canDemoExpert) {
|
2013-03-12 21:25:42 +01:00
|
|
|
int unlockLevel = AdvancedConfig.getInstance().getBlastMiningRank4();
|
|
|
|
|
|
|
|
if (skillValue < unlockLevel) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Mining.Ability.Locked.2", unlockLevel)));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Mining.Effect.Decrease", blastDamageDecrease));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|