mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-27 03:04:44 +02:00
All skills should be on the new rank system now
This commit is contained in:
@ -1,8 +1,10 @@
|
||||
package com.gmail.nossr50.skills.alchemy;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.runnables.skills.AlchemyBrewTask;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import org.bukkit.Location;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -11,7 +13,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public final class Alchemy {
|
||||
public enum Tier {
|
||||
/*public enum Tier {
|
||||
EIGHT(8),
|
||||
SEVEN(7),
|
||||
SIX(6),
|
||||
@ -43,11 +45,11 @@ public final class Alchemy {
|
||||
protected int getLevel() {
|
||||
return AdvancedConfig.getInstance().getConcoctionsTierLevel(this);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
public static final int INGREDIENT_SLOT = 3;
|
||||
|
||||
public static int catalysisUnlockLevel = AdvancedConfig.getInstance().getCatalysisUnlockLevel();
|
||||
public static int catalysisUnlockLevel = RankUtils.getUnlockLevel(SubSkillType.ALCHEMY_CATALYSIS);
|
||||
public static int catalysisMaxBonusLevel = AdvancedConfig.getInstance().getCatalysisMaxBonusLevel();
|
||||
public static double catalysisMinSpeed = AdvancedConfig.getInstance().getCatalysisMinSpeed();
|
||||
public static double catalysisMaxSpeed = AdvancedConfig.getInstance().getCatalysisMaxSpeed();
|
||||
@ -70,4 +72,4 @@ public final class Alchemy {
|
||||
alchemyBrewTask.finishImmediately();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -4,10 +4,12 @@ import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.config.skills.alchemy.PotionConfig;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
@ -20,13 +22,7 @@ public class AlchemyManager extends SkillManager {
|
||||
}
|
||||
|
||||
public int getTier() {
|
||||
for (Alchemy.Tier tier : Alchemy.Tier.values()) {
|
||||
if (getSkillLevel() >= tier.getLevel()) {
|
||||
return tier.toNumerical();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return RankUtils.getRank(getPlayer(), SubSkillType.ALCHEMY_CONCOCTIONS);
|
||||
}
|
||||
|
||||
public List<ItemStack> getIngredients() {
|
||||
@ -58,4 +54,4 @@ public class AlchemyManager extends SkillManager {
|
||||
public void handlePotionBrewSuccesses(PotionStage potionStage, int amount) {
|
||||
applyXpGain((float) (ExperienceConfig.getInstance().getPotionXP(potionStage) * amount), XPGainReason.PVE);
|
||||
}
|
||||
}
|
||||
}
|
@ -17,33 +17,6 @@ import java.util.Set;
|
||||
|
||||
public final class Fishing {
|
||||
|
||||
// The order of the values is extremely important, a few methods depend on it to work properly
|
||||
public enum Tier {
|
||||
EIGHT(8), SEVEN(7), SIX(6), FIVE(5), FOUR(4), THREE(3), TWO(2), ONE(1);
|
||||
|
||||
int numerical;
|
||||
|
||||
private Tier(int numerical) {
|
||||
this.numerical = numerical;
|
||||
}
|
||||
|
||||
public int toNumerical() {
|
||||
return numerical;
|
||||
}
|
||||
|
||||
protected int getLevel() {
|
||||
return AdvancedConfig.getInstance().getFishingTierLevel(this);
|
||||
}
|
||||
|
||||
protected double getShakeChance() {
|
||||
return AdvancedConfig.getInstance().getShakeChance(this);
|
||||
}
|
||||
|
||||
protected int getVanillaXPBoostModifier() {
|
||||
return AdvancedConfig.getInstance().getFishingVanillaXPModifier(this);
|
||||
}
|
||||
}
|
||||
|
||||
protected static final HashMap<Material, List<Enchantment>> ENCHANTABLE_CACHE = new HashMap<Material, List<Enchantment>>();
|
||||
|
||||
public static int fishermansDietRankLevel1 = AdvancedConfig.getInstance().getFishermanDietRankChange();
|
||||
|
@ -19,10 +19,10 @@ import com.gmail.nossr50.events.skills.secondaryabilities.SubSkillWeightedActiva
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.runnables.skills.KrakenAttackTask;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.skills.fishing.Fishing.Tier;
|
||||
import com.gmail.nossr50.util.*;
|
||||
import com.gmail.nossr50.util.player.NotificationManager;
|
||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
@ -56,11 +56,11 @@ public class FishingManager extends SkillManager {
|
||||
}
|
||||
|
||||
public boolean canShake(Entity target) {
|
||||
return target instanceof LivingEntity && getSkillLevel() >= Tier.ONE.getLevel() && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.FISHING_SHAKE);
|
||||
return target instanceof LivingEntity && RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.FISHING_SHAKE) && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.FISHING_SHAKE);
|
||||
}
|
||||
|
||||
public boolean canMasterAngler() {
|
||||
return getSkillLevel() >= AdvancedConfig.getInstance().getMasterAnglerUnlockLevel() && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.FISHING_MASTER_ANGLER);
|
||||
return getSkillLevel() >= RankUtils.getUnlockLevel(SubSkillType.FISHING_MASTER_ANGLER) && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.FISHING_MASTER_ANGLER);
|
||||
}
|
||||
|
||||
public boolean unleashTheKraken() {
|
||||
@ -173,7 +173,7 @@ public class FishingManager extends SkillManager {
|
||||
}
|
||||
|
||||
public boolean canIceFish(Block block) {
|
||||
if (getSkillLevel() < AdvancedConfig.getInstance().getIceFishingUnlockLevel()) {
|
||||
if (getSkillLevel() < RankUtils.getUnlockLevel(SubSkillType.FISHING_ICE_FISHING)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -201,15 +201,15 @@ public class FishingManager extends SkillManager {
|
||||
* @return the loot tier
|
||||
*/
|
||||
public int getLootTier() {
|
||||
int skillLevel = getSkillLevel();
|
||||
return RankUtils.getRank(getPlayer(), SubSkillType.FISHING_TREASURE_HUNTER);
|
||||
}
|
||||
|
||||
for (Tier tier : Tier.values()) {
|
||||
if (skillLevel >= tier.getLevel()) {
|
||||
return tier.toNumerical();
|
||||
}
|
||||
}
|
||||
protected double getShakeChance() {
|
||||
return AdvancedConfig.getInstance().getShakeChance(getLootTier());
|
||||
}
|
||||
|
||||
return 0;
|
||||
protected int getVanillaXPBoostModifier() {
|
||||
return AdvancedConfig.getInstance().getFishingVanillaXPModifier(getLootTier());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -218,15 +218,7 @@ public class FishingManager extends SkillManager {
|
||||
* @return Shake Mob probability
|
||||
*/
|
||||
public double getShakeProbability() {
|
||||
int skillLevel = getSkillLevel();
|
||||
|
||||
for (Tier tier : Tier.values()) {
|
||||
if (skillLevel >= tier.getLevel()) {
|
||||
return tier.getShakeChance();
|
||||
}
|
||||
}
|
||||
|
||||
return 0.0;
|
||||
return getShakeChance();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -428,7 +420,7 @@ public class FishingManager extends SkillManager {
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
McMMOPlayerShakeEvent shakeEvent = new McMMOPlayerShakeEvent(getPlayer(), drop);
|
||||
@ -459,7 +451,7 @@ public class FishingManager extends SkillManager {
|
||||
}
|
||||
else {
|
||||
// We know something was caught, so if the rod wasn't in the main hand it must be in the offhand
|
||||
luck = getPlayer().getInventory().getItemInOffHand().getEnchantmentLevel(Enchantment.LUCK);
|
||||
luck = getPlayer().getInventory().getItemInOffHand().getEnchantmentLevel(Enchantment.LUCK);
|
||||
}
|
||||
|
||||
// Rather than subtracting luck (and causing a minimum 3% chance for every drop), scale by luck.
|
||||
@ -634,14 +626,6 @@ public class FishingManager extends SkillManager {
|
||||
* @return the vanilla XP multiplier
|
||||
*/
|
||||
private int getVanillaXpMultiplier() {
|
||||
int skillLevel = getSkillLevel();
|
||||
|
||||
for (Tier tier : Tier.values()) {
|
||||
if (skillLevel >= tier.getLevel()) {
|
||||
return tier.getVanillaXPBoostModifier();
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
return getVanillaXPBoostModifier();
|
||||
}
|
||||
}
|
||||
}
|
@ -2,8 +2,10 @@ package com.gmail.nossr50.skills.mining;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
@ -15,7 +17,7 @@ import java.util.List;
|
||||
|
||||
public class BlastMining {
|
||||
// The order of the values is extremely important, a few methods depend on it to work properly
|
||||
public enum Tier {
|
||||
/* public enum Tier {
|
||||
EIGHT(8),
|
||||
SEVEN(7),
|
||||
SIX(6),
|
||||
@ -39,52 +41,58 @@ public class BlastMining {
|
||||
return AdvancedConfig.getInstance().getBlastMiningRankLevel(this);
|
||||
}
|
||||
|
||||
protected double getBlastRadiusModifier() {
|
||||
return AdvancedConfig.getInstance().getBlastRadiusModifier(this);
|
||||
}
|
||||
|
||||
protected double getOreBonus() {
|
||||
return AdvancedConfig.getInstance().getOreBonus(this);
|
||||
}
|
||||
|
||||
protected double getDebrisReduction() {
|
||||
return AdvancedConfig.getInstance().getDebrisReduction(this);
|
||||
}
|
||||
|
||||
protected double getBlastDamageDecrease() {
|
||||
return AdvancedConfig.getInstance().getBlastDamageDecrease(this);
|
||||
}
|
||||
|
||||
protected int getDropMultiplier() {
|
||||
return AdvancedConfig.getInstance().getDropMultiplier(this);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
public static Material detonator = Config.getInstance().getDetonatorItem();
|
||||
|
||||
public final static int MAXIMUM_REMOTE_DETONATION_DISTANCE = 100;
|
||||
|
||||
public static double getBlastRadiusModifier(int rank) {
|
||||
return AdvancedConfig.getInstance().getBlastRadiusModifier(rank);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static double getBlastDamageDecrease(int rank) {
|
||||
return AdvancedConfig.getInstance().getBlastDamageDecrease(rank);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static int getDemolitionExpertUnlockLevel() {
|
||||
List<Tier> tierList = Arrays.asList(Tier.values());
|
||||
/*List<Tier> tierList = Arrays.asList(Tier.values());
|
||||
for (Tier tier : tierList) {
|
||||
if (tier.getBlastDamageDecrease() > 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return tier == Tier.EIGHT ? tier.getLevel() : tierList.get(tierList.indexOf(tier) - 1).getLevel();
|
||||
}*/
|
||||
|
||||
for(int i = 0; i < SubSkillType.MINING_BLAST_MINING.getNumRanks()-1; i++)
|
||||
{
|
||||
if(getBlastDamageDecrease(i+1) > 0)
|
||||
return RankUtils.getRankUnlockLevel(SubSkillType.MINING_BLAST_MINING, i+1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int getBiggerBombsUnlockLevel() {
|
||||
List<Tier> tierList = Arrays.asList(Tier.values());
|
||||
/*List<Tier> tierList = Arrays.asList(Tier.values());
|
||||
for (Tier tier : tierList) {
|
||||
if (tier.getBlastRadiusModifier() > 1.0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return tier == Tier.EIGHT ? tier.getLevel() : tierList.get(tierList.indexOf(tier) - 1).getLevel();
|
||||
}*/
|
||||
|
||||
for(int i = 0; i < SubSkillType.MINING_BLAST_MINING.getNumRanks()-1; i++)
|
||||
{
|
||||
if(getBlastRadiusModifier(i+1) > 0)
|
||||
return RankUtils.getRankUnlockLevel(SubSkillType.MINING_BLAST_MINING, i+1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.gmail.nossr50.skills.mining;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
@ -10,12 +11,12 @@ import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.runnables.skills.AbilityCooldownTask;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.skills.mining.BlastMining.Tier;
|
||||
import com.gmail.nossr50.util.BlockUtils;
|
||||
import com.gmail.nossr50.util.EventUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.NotificationManager;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import org.bukkit.Material;
|
||||
@ -45,7 +46,8 @@ public class MiningManager extends SkillManager {
|
||||
}
|
||||
|
||||
public boolean canUseBlastMining() {
|
||||
return getSkillLevel() >= BlastMining.Tier.ONE.getLevel();
|
||||
//Not checking permissions?
|
||||
return RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.MINING_BLAST_MINING);
|
||||
}
|
||||
|
||||
public boolean canUseBiggerBombs() {
|
||||
@ -193,15 +195,7 @@ public class MiningManager extends SkillManager {
|
||||
* @return the Blast Mining tier
|
||||
*/
|
||||
public int getBlastMiningTier() {
|
||||
int skillLevel = getSkillLevel();
|
||||
|
||||
for (Tier tier : Tier.values()) {
|
||||
if (skillLevel >= tier.getLevel()) {
|
||||
return tier.toNumerical();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return RankUtils.getRank(getPlayer(), SubSkillType.MINING_BLAST_MINING);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -210,15 +204,15 @@ public class MiningManager extends SkillManager {
|
||||
* @return the Blast Mining tier
|
||||
*/
|
||||
public double getOreBonus() {
|
||||
int skillLevel = getSkillLevel();
|
||||
return getOreBonus(getBlastMiningTier());
|
||||
}
|
||||
|
||||
for (Tier tier : Tier.values()) {
|
||||
if (skillLevel >= tier.getLevel()) {
|
||||
return tier.getOreBonus();
|
||||
}
|
||||
}
|
||||
public static double getOreBonus(int rank) {
|
||||
return AdvancedConfig.getInstance().getOreBonus(rank);
|
||||
}
|
||||
|
||||
return 0;
|
||||
public static double getDebrisReduction(int rank) {
|
||||
return AdvancedConfig.getInstance().getDebrisReduction(rank);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -227,15 +221,11 @@ public class MiningManager extends SkillManager {
|
||||
* @return the Blast Mining tier
|
||||
*/
|
||||
public double getDebrisReduction() {
|
||||
int skillLevel = getSkillLevel();
|
||||
return getDebrisReduction(getBlastMiningTier());
|
||||
}
|
||||
|
||||
for (Tier tier : Tier.values()) {
|
||||
if (skillLevel >= tier.getLevel()) {
|
||||
return tier.getDebrisReduction();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
public static int getDropMultiplier(int rank) {
|
||||
return AdvancedConfig.getInstance().getDropMultiplier(rank);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -244,15 +234,7 @@ public class MiningManager extends SkillManager {
|
||||
* @return the Blast Mining tier
|
||||
*/
|
||||
public int getDropMultiplier() {
|
||||
int skillLevel = getSkillLevel();
|
||||
|
||||
for (Tier tier : Tier.values()) {
|
||||
if (skillLevel >= tier.getLevel()) {
|
||||
return tier.getDropMultiplier();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return getDropMultiplier(getBlastMiningTier());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -261,15 +243,7 @@ public class MiningManager extends SkillManager {
|
||||
* @return the Blast Mining tier
|
||||
*/
|
||||
public double getBlastRadiusModifier() {
|
||||
int skillLevel = getSkillLevel();
|
||||
|
||||
for (Tier tier : Tier.values()) {
|
||||
if (skillLevel >= tier.getLevel()) {
|
||||
return tier.getBlastRadiusModifier();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return BlastMining.getBlastRadiusModifier(getBlastMiningTier());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -278,15 +252,7 @@ public class MiningManager extends SkillManager {
|
||||
* @return the Blast Mining tier
|
||||
*/
|
||||
public double getBlastDamageModifier() {
|
||||
int skillLevel = getSkillLevel();
|
||||
|
||||
for (Tier tier : Tier.values()) {
|
||||
if (skillLevel >= tier.getLevel()) {
|
||||
return tier.getBlastDamageDecrease();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return BlastMining.getBlastDamageDecrease(getBlastMiningTier());
|
||||
}
|
||||
|
||||
private boolean blastMiningCooldownOver() {
|
||||
|
@ -3,39 +3,6 @@ package com.gmail.nossr50.skills.repair;
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
|
||||
public class ArcaneForging {
|
||||
// The order of the values is extremely important, a few methods depend on it to work properly
|
||||
public enum Tier {
|
||||
EIGHT(8),
|
||||
SEVEN(7),
|
||||
SIX(6),
|
||||
FIVE(5),
|
||||
FOUR(4),
|
||||
THREE(3),
|
||||
TWO(2),
|
||||
ONE(1);
|
||||
|
||||
int numerical;
|
||||
|
||||
private Tier(int numerical) {
|
||||
this.numerical = numerical;
|
||||
}
|
||||
|
||||
public int toNumerical() {
|
||||
return numerical;
|
||||
}
|
||||
|
||||
protected int getLevel() {
|
||||
return AdvancedConfig.getInstance().getArcaneForgingRankLevel(this);
|
||||
}
|
||||
|
||||
protected double getKeepEnchantChance() {
|
||||
return AdvancedConfig.getInstance().getArcaneForgingKeepEnchantsChance(this);
|
||||
}
|
||||
|
||||
protected double getDowngradeEnchantChance() {
|
||||
return AdvancedConfig.getInstance().getArcaneForgingDowngradeChance(this);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean arcaneForgingDowngrades = AdvancedConfig.getInstance().getArcaneForgingDowngradeEnabled();
|
||||
public static boolean arcaneForgingEnchantLoss = AdvancedConfig.getInstance().getArcaneForgingEnchantLossEnabled();
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.gmail.nossr50.skills.repair;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||
@ -10,13 +11,13 @@ import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.skills.repair.ArcaneForging.Tier;
|
||||
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||
import com.gmail.nossr50.util.EventUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.player.NotificationManager;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
@ -67,7 +68,7 @@ public class RepairManager extends SkillManager {
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILURE, "Anvil.Unbreakable");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Permissions checks on material and item types
|
||||
if (!Permissions.repairMaterialType(player, repairable.getRepairMaterialType())) {
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.NO_PERMISSION, "mcMMO.NoPermission");
|
||||
@ -194,15 +195,7 @@ public class RepairManager extends SkillManager {
|
||||
* @return the current Arcane Forging rank
|
||||
*/
|
||||
public int getArcaneForgingRank() {
|
||||
int skillLevel = getSkillLevel();
|
||||
|
||||
for (Tier tier : Tier.values()) {
|
||||
if (skillLevel >= tier.getLevel()) {
|
||||
return tier.toNumerical();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return RankUtils.getRank(getPlayer(), SubSkillType.REPAIR_ARCANE_FORGING);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -211,6 +204,24 @@ public class RepairManager extends SkillManager {
|
||||
* @return The chance of keeping the enchantment
|
||||
*/
|
||||
public double getKeepEnchantChance() {
|
||||
return AdvancedConfig.getInstance().getArcaneForgingKeepEnchantsChance(getArcaneForgingRank());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets chance of enchantment being downgraded during repair.
|
||||
*
|
||||
* @return The chance of the enchantment being downgraded
|
||||
*/
|
||||
public double getDowngradeEnchantChance() {
|
||||
return AdvancedConfig.getInstance().getArcaneForgingDowngradeChance(getArcaneForgingRank());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets chance of keeping enchantment during repair.
|
||||
*
|
||||
* @return The chance of keeping the enchantment
|
||||
*/
|
||||
/*public double getKeepEnchantChance() {
|
||||
int skillLevel = getSkillLevel();
|
||||
|
||||
for (Tier tier : Tier.values()) {
|
||||
@ -220,14 +231,14 @@ public class RepairManager extends SkillManager {
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Gets chance of enchantment being downgraded during repair.
|
||||
*
|
||||
* @return The chance of the enchantment being downgraded
|
||||
*/
|
||||
public double getDowngradeEnchantChance() {
|
||||
/*public double getDowngradeEnchantChance() {
|
||||
int skillLevel = getSkillLevel();
|
||||
|
||||
for (Tier tier : Tier.values()) {
|
||||
@ -237,7 +248,7 @@ public class RepairManager extends SkillManager {
|
||||
}
|
||||
|
||||
return 100;
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Computes repair bonuses.
|
||||
@ -365,4 +376,4 @@ public class RepairManager extends SkillManager {
|
||||
public void actualizeLastAnvilUse() {
|
||||
lastClick = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
||||
}
|
||||
}
|
||||
}
|
@ -2,49 +2,17 @@ package com.gmail.nossr50.skills.salvage;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import org.bukkit.Material;
|
||||
|
||||
public class Salvage {
|
||||
// The order of the values is extremely important, a few methods depend on it to work properly
|
||||
public enum Tier {
|
||||
EIGHT(8),
|
||||
SEVEN(7),
|
||||
SIX(6),
|
||||
FIVE(5),
|
||||
FOUR(4),
|
||||
THREE(3),
|
||||
TWO(2),
|
||||
ONE(1);
|
||||
|
||||
int numerical;
|
||||
|
||||
private Tier(int numerical) {
|
||||
this.numerical = numerical;
|
||||
}
|
||||
|
||||
public int toNumerical() {
|
||||
return numerical;
|
||||
}
|
||||
|
||||
protected int getLevel() {
|
||||
return AdvancedConfig.getInstance().getArcaneSalvageRankLevel(this);
|
||||
}
|
||||
|
||||
protected double getExtractFullEnchantChance() {
|
||||
return AdvancedConfig.getInstance().getArcaneSalvageExtractFullEnchantsChance(this);
|
||||
}
|
||||
|
||||
protected double getExtractPartialEnchantChance() {
|
||||
return AdvancedConfig.getInstance().getArcaneSalvageExtractPartialEnchantsChance(this);
|
||||
}
|
||||
}
|
||||
|
||||
public static Material anvilMaterial = Config.getInstance().getSalvageAnvilMaterial();
|
||||
|
||||
public static int salvageMaxPercentageLevel = AdvancedConfig.getInstance().getSalvageMaxPercentageLevel();
|
||||
public static double salvageMaxPercentage = AdvancedConfig.getInstance().getSalvageMaxPercentage();
|
||||
|
||||
public static int advancedSalvageUnlockLevel = AdvancedConfig.getInstance().getAdvancedSalvageUnlockLevel();
|
||||
public static int advancedSalvageUnlockLevel = RankUtils.getRankUnlockLevel(SubSkillType.SALVAGE_ADVANCED_SALVAGE, 1);
|
||||
|
||||
public static boolean arcaneSalvageDowngrades = AdvancedConfig.getInstance().getArcaneSalvageEnchantDowngradeEnabled();
|
||||
public static boolean arcaneSalvageEnchantLoss = AdvancedConfig.getInstance().getArcaneSalvageEnchantLossEnabled();
|
||||
@ -54,4 +22,4 @@ public class Salvage {
|
||||
|
||||
return (int) Math.floor(baseAmount * percentDamaged);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,19 +1,21 @@
|
||||
package com.gmail.nossr50.skills.salvage;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.skills.salvage.Salvage.Tier;
|
||||
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
|
||||
import com.gmail.nossr50.util.EventUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.player.NotificationManager;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
@ -65,7 +67,7 @@ public class SalvageManager extends SkillManager {
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILURE, "Anvil.Unbreakable");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Permissions checks on material and item types
|
||||
if (!Permissions.salvageItemType(player, salvageable.getSalvageItemType())) {
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.NO_PERMISSION, "mcMMO.NoPermission");
|
||||
@ -145,18 +147,10 @@ public class SalvageManager extends SkillManager {
|
||||
* @return the current Arcane Salvage rank
|
||||
*/
|
||||
public int getArcaneSalvageRank() {
|
||||
int skillLevel = getSkillLevel();
|
||||
|
||||
for (Tier tier : Tier.values()) {
|
||||
if (skillLevel >= tier.getLevel()) {
|
||||
return tier.toNumerical();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return RankUtils.getRank(getPlayer(), SubSkillType.SALVAGE_ARCANE_SALVAGE);
|
||||
}
|
||||
|
||||
public double getExtractFullEnchantChance() {
|
||||
/*public double getExtractFullEnchantChance() {
|
||||
int skillLevel = getSkillLevel();
|
||||
|
||||
for (Tier tier : Tier.values()) {
|
||||
@ -178,6 +172,14 @@ public class SalvageManager extends SkillManager {
|
||||
}
|
||||
|
||||
return 0;
|
||||
}*/
|
||||
|
||||
public double getExtractFullEnchantChance() {
|
||||
return AdvancedConfig.getInstance().getArcaneSalvageExtractFullEnchantsChance(getArcaneSalvageRank());
|
||||
}
|
||||
|
||||
public double getExtractPartialEnchantChance() {
|
||||
return AdvancedConfig.getInstance().getArcaneSalvageExtractPartialEnchantsChance(getArcaneSalvageRank());
|
||||
}
|
||||
|
||||
private ItemStack arcaneSalvageCheck(Map<Enchantment, Integer> enchants) {
|
||||
|
@ -3,44 +3,23 @@ package com.gmail.nossr50.skills.smelting;
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class Smelting {
|
||||
// The order of the values is extremely important, a few methods depend on it to work properly
|
||||
public enum Tier {
|
||||
EIGHT(8),
|
||||
SEVEN(7),
|
||||
SIX(6),
|
||||
FIVE(5),
|
||||
FOUR(4),
|
||||
THREE(3),
|
||||
TWO(2),
|
||||
ONE(1);
|
||||
|
||||
int numerical;
|
||||
|
||||
Tier(int numerical) {
|
||||
this.numerical = numerical;
|
||||
}
|
||||
|
||||
public int toNumerical() {
|
||||
return numerical;
|
||||
}
|
||||
|
||||
protected int getLevel() {
|
||||
return AdvancedConfig.getInstance().getSmeltingRankLevel(this);
|
||||
}
|
||||
|
||||
protected int getVanillaXPBoostModifier() {
|
||||
return AdvancedConfig.getInstance().getSmeltingVanillaXPBoostMultiplier(this);
|
||||
}
|
||||
public static int getRank(Player player)
|
||||
{
|
||||
return RankUtils.getRank(player, SubSkillType.SMELTING_UNDERSTANDING_THE_ART);
|
||||
}
|
||||
|
||||
public static int burnModifierMaxLevel = AdvancedConfig.getInstance().getBurnModifierMaxLevel();
|
||||
public static double burnTimeMultiplier = AdvancedConfig.getInstance().getBurnTimeMultiplier();
|
||||
|
||||
public static int fluxMiningUnlockLevel = AdvancedConfig.getInstance().getFluxMiningUnlockLevel();
|
||||
public static int fluxMiningUnlockLevel = RankUtils.getUnlockLevel(SubSkillType.SMELTING_FLUX_MINING);
|
||||
public static double fluxMiningChance = AdvancedConfig.getInstance().getFluxMiningChance();
|
||||
|
||||
protected static int getResourceXp(ItemStack smelting) {
|
||||
|
@ -10,12 +10,12 @@ import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.skills.mining.Mining;
|
||||
import com.gmail.nossr50.skills.smelting.Smelting.Tier;
|
||||
import com.gmail.nossr50.util.BlockUtils;
|
||||
import com.gmail.nossr50.util.EventUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
@ -75,7 +75,7 @@ public class SmeltingManager extends SkillManager {
|
||||
if (item == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (!EventUtils.simulateBlockBreak(blockState.getBlock(), player, true)) {
|
||||
return false;
|
||||
}
|
||||
@ -154,14 +154,6 @@ public class SmeltingManager extends SkillManager {
|
||||
* @return the vanilla XP multiplier
|
||||
*/
|
||||
public int getVanillaXpMultiplier() {
|
||||
int skillLevel = getSkillLevel();
|
||||
|
||||
for (Tier tier : Tier.values()) {
|
||||
if (skillLevel >= tier.getLevel()) {
|
||||
return tier.getVanillaXPBoostModifier();
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
return RankUtils.getRank(getPlayer(), SubSkillType.SMELTING_UNDERSTANDING_THE_ART);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,26 +1,28 @@
|
||||
package com.gmail.nossr50.skills.taming;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import org.bukkit.EntityEffect;
|
||||
import org.bukkit.entity.*;
|
||||
|
||||
public class Taming {
|
||||
public static int environmentallyAwareUnlockLevel = AdvancedConfig.getInstance().getEnviromentallyAwareUnlock();
|
||||
public static int holyHoundUnlockLevel = AdvancedConfig.getInstance().getHolyHoundUnlock();
|
||||
public static int holyHoundUnlockLevel = RankUtils.getUnlockLevel(SubSkillType.TAMING_HOLY_HOUND);
|
||||
|
||||
public static int fastFoodServiceUnlockLevel = AdvancedConfig.getInstance().getFastFoodUnlock();
|
||||
public static int fastFoodServiceUnlockLevel = RankUtils.getUnlockLevel(SubSkillType.TAMING_FAST_FOOD_SERVICE);
|
||||
public static double fastFoodServiceActivationChance = AdvancedConfig.getInstance().getFastFoodChance();
|
||||
|
||||
public static int goreBleedTicks = AdvancedConfig.getInstance().getGoreBleedTicks();
|
||||
public static double goreModifier = AdvancedConfig.getInstance().getGoreModifier();
|
||||
|
||||
public static int sharpenedClawsUnlockLevel = AdvancedConfig.getInstance().getSharpenedClawsUnlock();
|
||||
public static int sharpenedClawsUnlockLevel = RankUtils.getUnlockLevel(SubSkillType.TAMING_SHARPENED_CLAWS);
|
||||
public static double sharpenedClawsBonusDamage = AdvancedConfig.getInstance().getSharpenedClawsBonus();
|
||||
|
||||
public static int shockProofUnlockLevel = AdvancedConfig.getInstance().getShockProofUnlock();
|
||||
public static int shockProofUnlockLevel = RankUtils.getUnlockLevel(SubSkillType.TAMING_SHOCK_PROOF);
|
||||
public static double shockProofModifier = AdvancedConfig.getInstance().getShockProofModifier();
|
||||
|
||||
public static int thickFurUnlockLevel = AdvancedConfig.getInstance().getThickFurUnlock();
|
||||
public static int thickFurUnlockLevel = RankUtils.getUnlockLevel(SubSkillType.TAMING_THICK_FUR);
|
||||
public static double thickFurModifier = AdvancedConfig.getInstance().getThickFurModifier();
|
||||
|
||||
public static boolean canPreventDamage(Tameable pet, AnimalTamer owner) {
|
||||
@ -64,4 +66,4 @@ public class Taming {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user