Fix Fishing using values from the wrong config

This commit is contained in:
nossr50 2020-12-29 12:03:57 -08:00
parent ac31a3dc0e
commit bdee0278a5
3 changed files with 10 additions and 20 deletions

View File

@ -1,6 +1,6 @@
package com.gmail.nossr50.commands.skills; package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.config.treasure.TreasureConfig; import com.gmail.nossr50.config.treasure.FishingTreasureConfig;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.treasure.Rarity; import com.gmail.nossr50.datatypes.treasure.Rarity;
@ -55,19 +55,19 @@ public class FishingCommand extends SkillCommand {
lootTier = fishingManager.getLootTier(); lootTier = fishingManager.getLootTier();
// Item drop rates // Item drop rates
commonTreasure = percent.format(TreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.COMMON) / 100.0); commonTreasure = percent.format(FishingTreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.COMMON) / 100.0);
uncommonTreasure = percent.format(TreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.UNCOMMON) / 100.0); uncommonTreasure = percent.format(FishingTreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.UNCOMMON) / 100.0);
rareTreasure = percent.format(TreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.RARE) / 100.0); rareTreasure = percent.format(FishingTreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.RARE) / 100.0);
epicTreasure = percent.format(TreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.EPIC) / 100.0); epicTreasure = percent.format(FishingTreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.EPIC) / 100.0);
legendaryTreasure = percent.format(TreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.LEGENDARY) / 100.0); legendaryTreasure = percent.format(FishingTreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.LEGENDARY) / 100.0);
mythicTreasure = percent.format(TreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.MYTHIC) / 100.0); mythicTreasure = percent.format(FishingTreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.MYTHIC) / 100.0);
// Magic hunter drop rates // Magic hunter drop rates
double totalEnchantChance = 0; double totalEnchantChance = 0;
for (Rarity rarity : Rarity.values()) { for (Rarity rarity : Rarity.values()) {
if (rarity != Rarity.MYTHIC) { if (rarity != Rarity.MYTHIC) {
totalEnchantChance += TreasureConfig.getInstance().getEnchantmentDropRate(lootTier, rarity); totalEnchantChance += FishingTreasureConfig.getInstance().getEnchantmentDropRate(lootTier, rarity);
} }
} }

View File

@ -3,7 +3,6 @@ package com.gmail.nossr50.config.treasure;
import com.gmail.nossr50.config.ConfigLoader; import com.gmail.nossr50.config.ConfigLoader;
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure; import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
import com.gmail.nossr50.datatypes.treasure.HylianTreasure; import com.gmail.nossr50.datatypes.treasure.HylianTreasure;
import com.gmail.nossr50.datatypes.treasure.Rarity;
import com.gmail.nossr50.util.text.StringUtils; import com.gmail.nossr50.util.text.StringUtils;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
@ -234,12 +233,4 @@ public class TreasureConfig extends ConfigLoader {
hylianMap.put(dropper, new ArrayList<>()); hylianMap.put(dropper, new ArrayList<>());
hylianMap.get(dropper).add(treasure); hylianMap.get(dropper).add(treasure);
} }
public double getItemDropRate(int tier, Rarity rarity) {
return config.getDouble("Item_Drop_Rates.Tier_" + tier + "." + rarity.toString());
}
public double getEnchantmentDropRate(int tier, Rarity rarity) {
return config.getDouble("Enchantment_Drop_Rates.Tier_" + tier + "." + rarity.toString());
}
} }

View File

@ -5,7 +5,6 @@ import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.config.treasure.FishingTreasureConfig; import com.gmail.nossr50.config.treasure.FishingTreasureConfig;
import com.gmail.nossr50.config.treasure.TreasureConfig;
import com.gmail.nossr50.datatypes.experience.XPGainReason; import com.gmail.nossr50.datatypes.experience.XPGainReason;
import com.gmail.nossr50.datatypes.interactions.NotificationType; import com.gmail.nossr50.datatypes.interactions.NotificationType;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
@ -609,7 +608,7 @@ public class FishingManager extends SkillManager {
FishingTreasure treasure = null; FishingTreasure treasure = null;
for (Rarity rarity : Rarity.values()) { for (Rarity rarity : Rarity.values()) {
double dropRate = TreasureConfig.getInstance().getItemDropRate(getLootTier(), rarity); double dropRate = FishingTreasureConfig.getInstance().getItemDropRate(getLootTier(), rarity);
if (diceRoll <= dropRate) { if (diceRoll <= dropRate) {
@ -660,7 +659,7 @@ public class FishingManager extends SkillManager {
for (Rarity rarity : Rarity.values()) { for (Rarity rarity : Rarity.values()) {
double dropRate = TreasureConfig.getInstance().getEnchantmentDropRate(getLootTier(), rarity); double dropRate = FishingTreasureConfig.getInstance().getEnchantmentDropRate(getLootTier(), rarity);
if (diceRoll <= dropRate) { if (diceRoll <= dropRate) {
// Make sure enchanted books always get some kind of enchantment. --hoorigan // Make sure enchanted books always get some kind of enchantment. --hoorigan