mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-12-25 18:17:46 +01:00
Cleaning up Herbalism & Mining commands.
This commit is contained in:
parent
b4fffe154d
commit
65d71db72f
@ -64,15 +64,13 @@ public class HerbalismCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck() {
|
||||
Config configInstance = Config.getInstance();
|
||||
|
||||
hasHylianLuck = Permissions.hylianLuck(player);
|
||||
canGreenTerra = Permissions.greenTerra(player);
|
||||
canGreenThumbWheat = Permissions.greenThumbWheat(player);
|
||||
canGreenThumbBlocks = Permissions.greenThumbBlocks(player);
|
||||
canFarmersDiet = Permissions.farmersDiet(player);
|
||||
canDoubleDrop = Permissions.herbalismDoubleDrops(player);
|
||||
doubleDropsDisabled = configInstance.herbalismDoubleDropsDisabled();
|
||||
doubleDropsDisabled = Herbalism.doubleDropsDisabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,16 +1,14 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.commands.SkillCommand;
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.mining.BlastMining;
|
||||
import com.gmail.nossr50.skills.mining.Mining;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Skills;
|
||||
|
||||
public class MiningCommand extends SkillCommand {
|
||||
AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
|
||||
private String doubleDropChance;
|
||||
private String doubleDropChanceLucky;
|
||||
private String superBreakerLength;
|
||||
@ -19,27 +17,12 @@ public class MiningCommand extends SkillCommand {
|
||||
private String blastRadiusIncrease;
|
||||
private String blastDamageDecrease;
|
||||
|
||||
private int blastMiningRank1 = advancedConfig.getBlastMiningRank1();
|
||||
private int blastMiningRank2 = advancedConfig.getBlastMiningRank2();
|
||||
private int blastMiningRank3 = advancedConfig.getBlastMiningRank3();
|
||||
private int blastMiningRank4 = advancedConfig.getBlastMiningRank4();
|
||||
private int blastMiningRank5 = advancedConfig.getBlastMiningRank5();
|
||||
private int blastMiningRank6 = advancedConfig.getBlastMiningRank6();
|
||||
private int blastMiningRank7 = advancedConfig.getBlastMiningRank7();
|
||||
private int blastMiningRank8 = advancedConfig.getBlastMiningRank8();
|
||||
|
||||
private double doubleDropsMaxBonus = advancedConfig.getMiningDoubleDropChance();
|
||||
private int doubleDropsMaxLevel = advancedConfig.getMiningDoubleDropMaxLevel();
|
||||
public int abilityLengthIncreaseLevel = advancedConfig.getAbilityLength();
|
||||
|
||||
private boolean canSuperBreaker;
|
||||
private boolean canDoubleDrop;
|
||||
private boolean canBlast;
|
||||
private boolean canBiggerBombs;
|
||||
private boolean canDemoExpert;
|
||||
private boolean doubleDropsDisabled;
|
||||
private boolean lucky;
|
||||
private boolean endurance;
|
||||
|
||||
public MiningCommand() {
|
||||
super(SkillType.MINING);
|
||||
@ -47,69 +30,53 @@ public class MiningCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void dataCalculations() {
|
||||
float doubleDropChanceF;
|
||||
//Super Breaker
|
||||
int length = 2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel);
|
||||
superBreakerLength = String.valueOf(length);
|
||||
//SUPER BREAKER
|
||||
String[] superBreakerStrings = calculateLengthDisplayValues();
|
||||
superBreakerLength = superBreakerStrings[0];
|
||||
superBreakerLengthEndurance = superBreakerStrings[1];
|
||||
|
||||
if (Permissions.activationTwelve(player)) {
|
||||
length = length + 12;
|
||||
}
|
||||
else if (Permissions.activationEight(player)) {
|
||||
length = length + 8;
|
||||
}
|
||||
else if (Permissions.activationFour(player)) {
|
||||
length = length + 4;
|
||||
}
|
||||
int maxLength = SkillType.MINING.getAbility().getMaxTicks();
|
||||
if (maxLength != 0 && length > maxLength) {
|
||||
length = maxLength;
|
||||
}
|
||||
superBreakerLengthEndurance = String.valueOf(length);
|
||||
//Double Drops
|
||||
if (skillValue >= doubleDropsMaxLevel) doubleDropChanceF = (float) (doubleDropsMaxBonus);
|
||||
else doubleDropChanceF = (float) ((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue);
|
||||
doubleDropChance = percent.format(doubleDropChanceF / 100D);
|
||||
if (doubleDropChanceF * 1.3333D >= 100D) doubleDropChanceLucky = percent.format(1D);
|
||||
else doubleDropChanceLucky = percent.format(doubleDropChanceF * 1.3333D / 100D);
|
||||
//DOUBLE DROPS
|
||||
String[] doubleDropStrings = calculateAbilityDisplayValues(Mining.doubleDropsMaxLevel, Mining.doubleDropsMaxChance);
|
||||
doubleDropChance = doubleDropStrings[0];
|
||||
doubleDropChanceLucky = doubleDropStrings[1];
|
||||
|
||||
//Blast Mining
|
||||
if (skillValue >= blastMiningRank8) {
|
||||
//BLAST MINING
|
||||
if (skillValue >= BlastMining.rank8) {
|
||||
blastMiningRank = "8";
|
||||
blastDamageDecrease = "100.00%";
|
||||
blastRadiusIncrease = "4";
|
||||
}
|
||||
else if (skillValue >= blastMiningRank7) {
|
||||
else if (skillValue >= BlastMining.rank7) {
|
||||
blastMiningRank = "7";
|
||||
blastDamageDecrease = "50.00%";
|
||||
blastRadiusIncrease = "3";
|
||||
}
|
||||
else if (skillValue >= blastMiningRank6) {
|
||||
else if (skillValue >= BlastMining.rank6) {
|
||||
blastMiningRank = "6";
|
||||
blastDamageDecrease = "50.00%";
|
||||
blastRadiusIncrease = "3";
|
||||
}
|
||||
else if (skillValue >= blastMiningRank5) {
|
||||
else if (skillValue >= BlastMining.rank5) {
|
||||
blastMiningRank = "5";
|
||||
blastDamageDecrease = "25.00%";
|
||||
blastRadiusIncrease = "2";
|
||||
}
|
||||
else if (skillValue >= blastMiningRank4) {
|
||||
else if (skillValue >= BlastMining.rank4) {
|
||||
blastMiningRank = "4";
|
||||
blastDamageDecrease = "25.00%";
|
||||
blastRadiusIncrease = "2";
|
||||
}
|
||||
else if (skillValue >= blastMiningRank3) {
|
||||
else if (skillValue >= BlastMining.rank3) {
|
||||
blastMiningRank = "3";
|
||||
blastDamageDecrease = "0.00%";
|
||||
blastRadiusIncrease = "1";
|
||||
}
|
||||
else if (skillValue >= blastMiningRank2) {
|
||||
else if (skillValue >= BlastMining.rank2) {
|
||||
blastMiningRank = "2";
|
||||
blastDamageDecrease = "0.00%";
|
||||
blastRadiusIncrease = "1";
|
||||
}
|
||||
else if (skillValue >= blastMiningRank1) {
|
||||
else if (skillValue >= BlastMining.rank1) {
|
||||
blastMiningRank = "1";
|
||||
blastDamageDecrease = "0.00%";
|
||||
blastRadiusIncrease = "0";
|
||||
@ -123,16 +90,12 @@ public class MiningCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck() {
|
||||
Config configInstance = Config.getInstance();
|
||||
|
||||
canBiggerBombs = Permissions.biggerBombs(player);
|
||||
canBlast = Permissions.blastMining(player);
|
||||
canDemoExpert = Permissions.demolitionsExpertise(player);
|
||||
canDoubleDrop = Permissions.miningDoubleDrops(player);
|
||||
canSuperBreaker = Permissions.superBreaker(player);
|
||||
doubleDropsDisabled = configInstance.miningDoubleDropsDisabled();
|
||||
lucky = Permissions.luckyMining(player);
|
||||
endurance = Permissions.activationTwelve(player) || Permissions.activationEight(player) || Permissions.activationFour(player);
|
||||
doubleDropsDisabled = Mining.doubleDropsDisabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -142,10 +105,7 @@ public class MiningCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void effectsDisplay() {
|
||||
if (lucky) {
|
||||
String perkPrefix = LocaleLoader.getString("MOTD.PerksPrefix");
|
||||
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.lucky.name"), LocaleLoader.getString("Perks.lucky.desc", new Object[] { Skills.localizeSkillName(SkillType.MINING) }) }));
|
||||
}
|
||||
luckyEffectsDisplay();
|
||||
|
||||
if (canSuperBreaker) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Mining.Effect.0"), LocaleLoader.getString("Mining.Effect.1") }));
|
||||
@ -176,22 +136,26 @@ public class MiningCommand extends SkillCommand {
|
||||
@Override
|
||||
protected void statsDisplay() {
|
||||
if (canDoubleDrop && !doubleDropsDisabled) {
|
||||
if (lucky)
|
||||
if (isLucky) {
|
||||
player.sendMessage(LocaleLoader.getString("Mining.Effect.DropChance", new Object[] { doubleDropChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { doubleDropChanceLucky }));
|
||||
else
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Mining.Effect.DropChance", new Object[] { doubleDropChance }));
|
||||
}
|
||||
}
|
||||
|
||||
if (canSuperBreaker) {
|
||||
if (endurance)
|
||||
if (hasEndurance) {
|
||||
player.sendMessage(LocaleLoader.getString("Mining.Ability.Length", new Object[] { superBreakerLength }) + LocaleLoader.getString("Perks.activationtime.bonus", new Object[] { superBreakerLengthEndurance }));
|
||||
else
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Mining.Ability.Length", new Object[] { superBreakerLength }));
|
||||
}
|
||||
}
|
||||
|
||||
if (canBlast) {
|
||||
if (skillValue < blastMiningRank1) {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Mining.Ability.Locked.0", new Object[] { blastMiningRank1 }) }));
|
||||
if (skillValue < BlastMining.rank1) {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Mining.Ability.Locked.0", new Object[] { BlastMining.rank1 }) }));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Mining.Blast.Rank", new Object[] { blastMiningRank, LocaleLoader.getString("Mining.Blast.Effect." + (Misc.getInt(blastMiningRank) - 1)) }));
|
||||
@ -199,8 +163,8 @@ public class MiningCommand extends SkillCommand {
|
||||
}
|
||||
|
||||
if (canBiggerBombs) {
|
||||
if (skillValue < blastMiningRank2) {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Mining.Ability.Locked.1", new Object[] { blastMiningRank2 }) }));
|
||||
if (skillValue < BlastMining.rank2) {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Mining.Ability.Locked.1", new Object[] { BlastMining.rank2 }) }));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Mining.Blast.Radius.Increase", new Object[] { blastRadiusIncrease }));
|
||||
@ -208,8 +172,8 @@ public class MiningCommand extends SkillCommand {
|
||||
}
|
||||
|
||||
if (canDemoExpert) {
|
||||
if (skillValue < blastMiningRank4) {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Mining.Ability.Locked.2", new Object[] { blastMiningRank4 }) }));
|
||||
if (skillValue < BlastMining.rank4) {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Mining.Ability.Locked.2", new Object[] { BlastMining.rank4 }) }));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Mining.Effect.Decrease", new Object[] { blastDamageDecrease }));
|
||||
|
@ -39,6 +39,7 @@ public class Herbalism {
|
||||
|
||||
public static double doubleDropsMaxChance = AdvancedConfig.getInstance().getHerbalismDoubleDropsChanceMax();
|
||||
public static int doubleDropsMaxLevel = AdvancedConfig.getInstance().getHerbalismDoubleDropsMaxLevel();
|
||||
public static boolean doubleDropsDisabled = Config.getInstance().herbalismDoubleDropsDisabled();
|
||||
|
||||
public static double hylianLuckMaxChance = AdvancedConfig.getInstance().getHylianLuckChanceMax();
|
||||
public static int hylianLuckMaxLevel = AdvancedConfig.getInstance().getHylianLucksMaxLevel();
|
||||
|
@ -17,20 +17,20 @@ public class BiggerBombsEventHandler {
|
||||
}
|
||||
|
||||
protected void calculateRadiusIncrease() {
|
||||
if (skillLevel < BlastMining.BLAST_MINING_RANK_2) {
|
||||
if (skillLevel < BlastMining.rank2) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (skillLevel >= BlastMining.BLAST_MINING_RANK_8) {
|
||||
if (skillLevel >= BlastMining.rank8) {
|
||||
radiusModifier = 4.0f;
|
||||
}
|
||||
else if (skillLevel >= BlastMining.BLAST_MINING_RANK_6) {
|
||||
else if (skillLevel >= BlastMining.rank6) {
|
||||
radiusModifier = 3.0f;
|
||||
}
|
||||
else if (skillLevel >= BlastMining.BLAST_MINING_RANK_4) {
|
||||
else if (skillLevel >= BlastMining.rank4) {
|
||||
radiusModifier = 2.0f;
|
||||
}
|
||||
else if (skillLevel >= BlastMining.BLAST_MINING_RANK_2) {
|
||||
else if (skillLevel >= BlastMining.rank2) {
|
||||
radiusModifier = 1.0f;
|
||||
}
|
||||
}
|
||||
|
@ -3,16 +3,14 @@ package com.gmail.nossr50.skills.mining;
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
|
||||
public class BlastMining {
|
||||
private static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
|
||||
|
||||
public final static int BLAST_MINING_RANK_1 = advancedConfig.getBlastMiningRank1();
|
||||
public final static int BLAST_MINING_RANK_2 = advancedConfig.getBlastMiningRank2();
|
||||
public final static int BLAST_MINING_RANK_3 = advancedConfig.getBlastMiningRank3();
|
||||
public final static int BLAST_MINING_RANK_4 = advancedConfig.getBlastMiningRank4();
|
||||
public final static int BLAST_MINING_RANK_5 = advancedConfig.getBlastMiningRank5();
|
||||
public final static int BLAST_MINING_RANK_6 = advancedConfig.getBlastMiningRank6();
|
||||
public final static int BLAST_MINING_RANK_7 = advancedConfig.getBlastMiningRank7();
|
||||
public final static int BLAST_MINING_RANK_8 = advancedConfig.getBlastMiningRank8();
|
||||
public static int rank1 = AdvancedConfig.getInstance().getBlastMiningRank1();
|
||||
public static int rank2 = AdvancedConfig.getInstance().getBlastMiningRank2();
|
||||
public static int rank3 = AdvancedConfig.getInstance().getBlastMiningRank3();
|
||||
public static int rank4 = AdvancedConfig.getInstance().getBlastMiningRank4();
|
||||
public static int rank5 = AdvancedConfig.getInstance().getBlastMiningRank5();
|
||||
public static int rank6 = AdvancedConfig.getInstance().getBlastMiningRank6();
|
||||
public static int rank7 = AdvancedConfig.getInstance().getBlastMiningRank7();
|
||||
public static int rank8 = AdvancedConfig.getInstance().getBlastMiningRank8();
|
||||
|
||||
public final static int MAXIMUM_REMOTE_DETONATION_DISTANCE = 100;
|
||||
}
|
||||
|
@ -101,25 +101,25 @@ public class BlastMiningDropEventHandler {
|
||||
}
|
||||
|
||||
private void calculateOreBonus() {
|
||||
if (skillLevel >= BlastMining.BLAST_MINING_RANK_8) {
|
||||
if (skillLevel >= BlastMining.rank8) {
|
||||
oreBonus = .70f;
|
||||
}
|
||||
else if (skillLevel >= BlastMining.BLAST_MINING_RANK_7) {
|
||||
else if (skillLevel >= BlastMining.rank7) {
|
||||
oreBonus = .65f;
|
||||
}
|
||||
else if (skillLevel >= BlastMining.BLAST_MINING_RANK_6) {
|
||||
else if (skillLevel >= BlastMining.rank6) {
|
||||
oreBonus = .60f;
|
||||
}
|
||||
else if (skillLevel >= BlastMining.BLAST_MINING_RANK_5) {
|
||||
else if (skillLevel >= BlastMining.rank5) {
|
||||
oreBonus = .55f;
|
||||
}
|
||||
else if (skillLevel >= BlastMining.BLAST_MINING_RANK_4) {
|
||||
else if (skillLevel >= BlastMining.rank4) {
|
||||
oreBonus = .50f;
|
||||
}
|
||||
else if (skillLevel >= BlastMining.BLAST_MINING_RANK_3) {
|
||||
else if (skillLevel >= BlastMining.rank3) {
|
||||
oreBonus = .45f;
|
||||
}
|
||||
else if (skillLevel >= BlastMining.BLAST_MINING_RANK_2) {
|
||||
else if (skillLevel >= BlastMining.rank2) {
|
||||
oreBonus = .40f;
|
||||
}
|
||||
else {
|
||||
@ -128,10 +128,10 @@ public class BlastMiningDropEventHandler {
|
||||
}
|
||||
|
||||
private void calculateDebrisReduction() {
|
||||
if (skillLevel >= BlastMining.BLAST_MINING_RANK_3) {
|
||||
if (skillLevel >= BlastMining.rank3) {
|
||||
debrisReduction = .30f;
|
||||
}
|
||||
else if (skillLevel >= BlastMining.BLAST_MINING_RANK_2) {
|
||||
else if (skillLevel >= BlastMining.rank2) {
|
||||
debrisReduction = .20f;
|
||||
}
|
||||
else {
|
||||
@ -140,10 +140,10 @@ public class BlastMiningDropEventHandler {
|
||||
}
|
||||
|
||||
private void calculateDropMultiplier() {
|
||||
if (skillLevel >= BlastMining.BLAST_MINING_RANK_7) {
|
||||
if (skillLevel >= BlastMining.rank7) {
|
||||
dropMultiplier = 3;
|
||||
}
|
||||
else if (skillLevel >= BlastMining.BLAST_MINING_RANK_5) {
|
||||
else if (skillLevel >= BlastMining.rank5) {
|
||||
dropMultiplier = 2;
|
||||
}
|
||||
else {
|
||||
|
@ -17,13 +17,13 @@ public class DemoltionsExpertiseEventHandler {
|
||||
}
|
||||
|
||||
protected void calculateDamageModifier() {
|
||||
if (skillLevel >= BlastMining.BLAST_MINING_RANK_8) {
|
||||
if (skillLevel >= BlastMining.rank8) {
|
||||
damageModifier = 0.0;
|
||||
}
|
||||
else if (skillLevel >= BlastMining.BLAST_MINING_RANK_6) {
|
||||
else if (skillLevel >= BlastMining.rank6) {
|
||||
damageModifier = 0.25;
|
||||
}
|
||||
else if (skillLevel >= BlastMining.BLAST_MINING_RANK_4) {
|
||||
else if (skillLevel >= BlastMining.rank4) {
|
||||
damageModifier = 0.5;
|
||||
}
|
||||
else {
|
||||
|
@ -22,8 +22,9 @@ public class Mining {
|
||||
private static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
|
||||
private static Config config = Config.getInstance();
|
||||
|
||||
public static final int DOUBLE_DROPS_MAX_BONUS_LEVEL = advancedConfig.getMiningDoubleDropMaxLevel();
|
||||
public static final double DOUBLE_DROPS_MAX_CHANCE = advancedConfig.getMiningDoubleDropChance();
|
||||
public static int doubleDropsMaxLevel = advancedConfig.getMiningDoubleDropMaxLevel();
|
||||
public static double doubleDropsMaxChance = advancedConfig.getMiningDoubleDropChance();
|
||||
public static boolean doubleDropsDisabled = config.miningDoubleDropsDisabled();
|
||||
|
||||
public static final int DIAMOND_TOOL_TIER = 4;
|
||||
public static final int IRON_TOOL_TIER = 3;
|
||||
|
@ -30,7 +30,7 @@ public class MiningBlockEventHandler {
|
||||
}
|
||||
|
||||
private void calculateSkillModifier() {
|
||||
this.skillModifier = Misc.skillCheck(manager.getSkillLevel(), Mining.DOUBLE_DROPS_MAX_BONUS_LEVEL);
|
||||
this.skillModifier = Misc.skillCheck(manager.getSkillLevel(), Mining.doubleDropsMaxLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -31,7 +31,7 @@ public class MiningManager extends SkillManager{
|
||||
return;
|
||||
}
|
||||
|
||||
if (skillLevel < BlastMining.BLAST_MINING_RANK_1) {
|
||||
if (skillLevel < BlastMining.rank1) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ public class MiningManager extends SkillManager{
|
||||
return;
|
||||
}
|
||||
|
||||
if (skillLevel < BlastMining.BLAST_MINING_RANK_1) {
|
||||
if (skillLevel < BlastMining.rank1) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -132,7 +132,7 @@ public class MiningManager extends SkillManager{
|
||||
return;
|
||||
}
|
||||
|
||||
float chance = ((float) Mining.DOUBLE_DROPS_MAX_CHANCE / Mining.DOUBLE_DROPS_MAX_BONUS_LEVEL) * eventHandler.skillModifier;
|
||||
float chance = ((float) Mining.doubleDropsMaxChance / Mining.doubleDropsMaxLevel) * eventHandler.skillModifier;
|
||||
|
||||
if (chance > Misc.getRandom().nextInt(activationChance)) {
|
||||
eventHandler.processDrops();
|
||||
|
Loading…
Reference in New Issue
Block a user