2012-01-09 20:00:13 +01:00
|
|
|
package com.gmail.nossr50.commands.skills;
|
|
|
|
|
2012-05-31 20:42:02 +02:00
|
|
|
import com.gmail.nossr50.commands.SkillCommand;
|
2012-05-01 21:56:09 +02:00
|
|
|
import com.gmail.nossr50.config.Config;
|
2012-01-09 20:00:13 +01:00
|
|
|
import com.gmail.nossr50.datatypes.SkillType;
|
2012-04-27 11:47:11 +02:00
|
|
|
import com.gmail.nossr50.locale.LocaleLoader;
|
2012-05-01 16:39:50 +02:00
|
|
|
import com.gmail.nossr50.util.Misc;
|
2012-01-09 20:00:13 +01:00
|
|
|
|
2012-05-31 20:42:02 +02:00
|
|
|
public class MiningCommand extends SkillCommand {
|
2012-04-25 17:06:55 +02:00
|
|
|
private String doubleDropChance;
|
|
|
|
private String superBreakerLength;
|
2012-05-01 16:39:50 +02:00
|
|
|
private String blastMiningRank;
|
|
|
|
private String blastRadiusIncrease;
|
|
|
|
private String blastDamageDecrease;
|
|
|
|
|
|
|
|
private boolean canSuperBreaker;
|
|
|
|
private boolean canDoubleDrop;
|
|
|
|
private boolean canBlast;
|
|
|
|
private boolean canBiggerBombs;
|
|
|
|
private boolean canDemoExpert;
|
2012-05-01 21:56:09 +02:00
|
|
|
private boolean doubleDropsDisabled;
|
2012-04-25 17:06:55 +02:00
|
|
|
|
2012-05-31 20:42:02 +02:00
|
|
|
public MiningCommand() {
|
|
|
|
super(SkillType.MINING);
|
2012-04-25 17:06:55 +02:00
|
|
|
}
|
|
|
|
|
2012-05-31 20:42:02 +02:00
|
|
|
@Override
|
|
|
|
protected void dataCalculations() {
|
2012-04-25 17:06:55 +02:00
|
|
|
superBreakerLength = String.valueOf(2 + ((int) skillValue / 50));
|
|
|
|
|
|
|
|
if (skillValue >= 1000) {
|
2012-05-01 16:39:50 +02:00
|
|
|
blastMiningRank = "8";
|
|
|
|
blastDamageDecrease = "100.00%";
|
|
|
|
blastRadiusIncrease = "4";
|
|
|
|
doubleDropChance = "100.00%";
|
2012-04-25 17:06:55 +02:00
|
|
|
}
|
|
|
|
else if (skillValue >= 875) {
|
2012-05-01 16:39:50 +02:00
|
|
|
blastMiningRank = "7";
|
|
|
|
blastDamageDecrease = "50.00%";
|
|
|
|
blastRadiusIncrease = "3";
|
|
|
|
doubleDropChance = percent.format(skillValue / 1000);
|
2012-04-25 17:06:55 +02:00
|
|
|
}
|
|
|
|
else if (skillValue >= 750) {
|
2012-05-01 16:39:50 +02:00
|
|
|
blastMiningRank = "6";
|
|
|
|
blastDamageDecrease = "50.00%";
|
|
|
|
blastRadiusIncrease = "3";
|
|
|
|
doubleDropChance = percent.format(skillValue / 1000);
|
2012-04-25 17:06:55 +02:00
|
|
|
}
|
|
|
|
else if (skillValue >= 625) {
|
2012-05-01 16:39:50 +02:00
|
|
|
blastMiningRank = "5";
|
|
|
|
blastDamageDecrease = "25.00%";
|
|
|
|
blastRadiusIncrease = "2";
|
|
|
|
doubleDropChance = percent.format(skillValue / 1000);
|
2012-04-25 17:06:55 +02:00
|
|
|
}
|
|
|
|
else if (skillValue >= 500) {
|
2012-05-01 16:39:50 +02:00
|
|
|
blastMiningRank = "4";
|
|
|
|
blastDamageDecrease = "25.00%";
|
|
|
|
blastRadiusIncrease = "2";
|
|
|
|
doubleDropChance = percent.format(skillValue / 1000);
|
2012-04-25 17:06:55 +02:00
|
|
|
}
|
|
|
|
else if (skillValue >= 375) {
|
2012-05-01 16:39:50 +02:00
|
|
|
blastMiningRank = "3";
|
|
|
|
blastDamageDecrease = "0.00%";
|
|
|
|
blastRadiusIncrease = "1";
|
|
|
|
doubleDropChance = percent.format(skillValue / 1000);
|
2012-04-25 17:06:55 +02:00
|
|
|
}
|
|
|
|
else if (skillValue >= 250) {
|
2012-05-01 16:39:50 +02:00
|
|
|
blastMiningRank = "2";
|
|
|
|
blastDamageDecrease = "0.00%";
|
|
|
|
blastRadiusIncrease = "1";
|
|
|
|
doubleDropChance = percent.format(skillValue / 1000);
|
2012-04-25 17:06:55 +02:00
|
|
|
}
|
|
|
|
else if (skillValue >= 125) {
|
2012-05-01 16:39:50 +02:00
|
|
|
blastMiningRank = "1";
|
|
|
|
blastDamageDecrease = "0.00%";
|
|
|
|
blastRadiusIncrease = "0";
|
|
|
|
doubleDropChance = percent.format(skillValue / 1000);
|
2012-04-25 17:06:55 +02:00
|
|
|
}
|
|
|
|
else {
|
2012-05-01 16:39:50 +02:00
|
|
|
blastMiningRank = "0";
|
|
|
|
blastDamageDecrease = "0.00%";
|
|
|
|
blastRadiusIncrease = "0";
|
|
|
|
doubleDropChance = percent.format(skillValue / 1000);
|
2012-04-25 17:06:55 +02:00
|
|
|
}
|
|
|
|
}
|
2012-05-01 16:39:50 +02:00
|
|
|
|
2012-05-31 20:42:02 +02:00
|
|
|
@Override
|
|
|
|
protected void permissionsCheck() {
|
2012-05-01 21:56:09 +02:00
|
|
|
Config configInstance = Config.getInstance();
|
2012-05-01 16:39:50 +02:00
|
|
|
|
|
|
|
canBiggerBombs = permInstance.biggerBombs(player);
|
|
|
|
canBlast = permInstance.blastMining(player);
|
|
|
|
canDemoExpert = permInstance.demolitionsExpertise(player);
|
|
|
|
canDoubleDrop = permInstance.miningDoubleDrops(player);
|
|
|
|
canSuperBreaker = permInstance.superBreaker(player);
|
2012-05-01 21:56:09 +02:00
|
|
|
doubleDropsDisabled = configInstance.miningDoubleDropsDisabled();
|
2012-05-01 16:39:50 +02:00
|
|
|
}
|
2012-05-31 20:42:02 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
protected boolean effectsHeaderPermissions() {
|
|
|
|
return canBiggerBombs || canBlast || canDemoExpert || (canDoubleDrop && !doubleDropsDisabled) || canSuperBreaker;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void effectsDisplay() {
|
|
|
|
if (canSuperBreaker) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Mining.Effect.0"), LocaleLoader.getString("Mining.Effect.1") }));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (canDoubleDrop && !doubleDropsDisabled) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Mining.Effect.2"), LocaleLoader.getString("Mining.Effect.3") }));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (canBlast) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Mining.Effect.4"), LocaleLoader.getString("Mining.Effect.5") }));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (canBiggerBombs) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Mining.Effect.6"), LocaleLoader.getString("Mining.Effect.7") }));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (canDemoExpert) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Mining.Effect.8"), LocaleLoader.getString("Mining.Effect.9") }));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected boolean statsHeaderPermissions() {
|
|
|
|
return canBiggerBombs || canBlast || canDemoExpert || (canDoubleDrop && !doubleDropsDisabled) || canSuperBreaker;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void statsDisplay() {
|
|
|
|
if (canDoubleDrop && !doubleDropsDisabled) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Mining.Effect.DropChance", new Object[] { doubleDropChance }));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (canSuperBreaker) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Mining.Ability.Length", new Object[] { superBreakerLength }));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (canBlast) {
|
|
|
|
if (skillValue < 125) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Mining.Ability.Locked.0") }));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Mining.Blast.Rank", new Object[] { blastMiningRank, LocaleLoader.getString("Mining.Blast.Effect." + (Misc.getInt(blastMiningRank) - 1)) }));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (canBiggerBombs) {
|
|
|
|
if (skillValue < 250) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Mining.Ability.Locked.1") }));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Mining.Blast.Radius.Increase", new Object[] { blastRadiusIncrease }));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (canDemoExpert) {
|
|
|
|
if (skillValue < 500) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Mining.Ability.Locked.2") }));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Mining.Effect.Decrease", new Object[] { blastDamageDecrease }));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-01-09 20:00:13 +01:00
|
|
|
}
|