From 965dbda1015271531535ac9d10134bb30532e682 Mon Sep 17 00:00:00 2001 From: GJ Date: Wed, 12 Jun 2013 19:20:05 -0400 Subject: [PATCH] Clean up some stuff with our DATS. --- .../gmail/nossr50/skills/mining/MiningManager.java | 5 +---- .../com/gmail/nossr50/util/skills/SkillUtils.java | 13 ++----------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java b/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java index 846c698ae..fe84be382 100644 --- a/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java +++ b/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java @@ -284,10 +284,7 @@ public class MiningManager extends SkillManager { private boolean blastMiningCooldownOver() { Player player = getPlayer(); PlayerProfile profile = getProfile(); - - long oldTime = profile.getSkillDATS(AbilityType.BLAST_MINING) * Misc.TIME_CONVERSION_FACTOR; - int cooldown = AbilityType.BLAST_MINING.getCooldown(); - int timeRemaining = SkillUtils.calculateTimeLeft(oldTime, cooldown, player); + int timeRemaining = SkillUtils.calculateTimeLeft(profile.getSkillDATS(AbilityType.BLAST_MINING) * Misc.TIME_CONVERSION_FACTOR, AbilityType.BLAST_MINING.getCooldown(), player); if (timeRemaining > 0) { player.sendMessage(LocaleLoader.getString("Skills.TooTired", timeRemaining)); diff --git a/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java b/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java index a3ae85b1d..8e998a55e 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java @@ -392,14 +392,8 @@ public class SkillUtils { } McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); - int ticks = 0; - - if (mcMMOPlayer.getAbilityMode(AbilityType.SUPER_BREAKER)) { - ticks = ((int) (mcMMOPlayer.getProfile().getSkillDATS(AbilityType.SUPER_BREAKER) - (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR))) * 20; - } - else if (mcMMOPlayer.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER)) { - ticks = ((int) (mcMMOPlayer.getProfile().getSkillDATS(AbilityType.GIGA_DRILL_BREAKER) - (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR))) * 20; - } + SkillType skill = mcMMOPlayer.getAbilityMode(AbilityType.SUPER_BREAKER) ? SkillType.MINING : SkillType.EXCAVATION; + int ticks = PerksUtils.handleActivationPerks(player, 2 + (mcMMOPlayer.getProfile().getSkillLevel(skill) / AdvancedConfig.getInstance().getAbilityLength()), skill.getAbility().getMaxTicks()) * 20; PotionEffect abilityBuff = new PotionEffect(PotionEffectType.FAST_DIGGING, duration + ticks, amplifier + 10); player.addPotionEffect(abilityBuff, true); @@ -415,9 +409,6 @@ public class SkillUtils { playerInventory.setItem(i, removeAbilityBuff(item)); } } - else { - player.removePotionEffect(PotionEffectType.FAST_DIGGING); - } } public static ItemStack removeAbilityBuff(ItemStack item) {