From 7eb1d43201dd4684a78017a112aac8cc12276f08 Mon Sep 17 00:00:00 2001 From: GJ Date: Tue, 21 Feb 2012 02:19:59 -0500 Subject: [PATCH] Making fishing drops customizable (WIP) --- .../gmail/nossr50/config/LoadProperties.java | 23 ++++++++++++++++--- .../com/gmail/nossr50/skills/Fishing.java | 14 ++++------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/LoadProperties.java b/src/main/java/com/gmail/nossr50/config/LoadProperties.java index d53f05c38..354d9a42f 100644 --- a/src/main/java/com/gmail/nossr50/config/LoadProperties.java +++ b/src/main/java/com/gmail/nossr50/config/LoadProperties.java @@ -77,7 +77,7 @@ public class LoadProperties { levelCapAcrobatics, levelCapArchery, levelCapAxes, levelCapExcavation, levelCapFishing, levelCapHerbalism, levelCapMining, levelCapRepair, levelCapSwords, levelCapTaming, levelCapUnarmed, levelCapWoodcutting, - anvilID, saveInterval; + anvilID, saveInterval, fishingTier1, fishingTier2, fishingTier3, fishingTier4; public static double xpbackground_r, xpbackground_g, xpbackground_b, xpborder_r, xpborder_g, xpborder_b, fishing_r, fishing_g, @@ -100,7 +100,10 @@ public class LoadProperties { public static List excavationFromClay = new ArrayList(); public static List excavationFromMycel = new ArrayList(); public static List excavationFromSoulSand = new ArrayList(); - public static List fishingRewards = new ArrayList(); + public static List fishingRewardsTier1 = new ArrayList(); + public static List fishingRewardsTier2 = new ArrayList(); + public static List fishingRewardsTier3 = new ArrayList(); + public static List fishingRewardsTier4 = new ArrayList(); public static HUDType defaulthud; protected static File configFile; @@ -377,6 +380,10 @@ public class LoadProperties { keepEnchantsRank4 = readInteger("Arcane_Forging.Keep_Enchants.Chance.Rank_4", 40); fishingDrops = readBoolean("Fishing.Drops.Item_Drops_Enabled", true); + fishingTier1 = readInteger("Fishing.Drop_Level.Tier1", 200); + fishingTier2 = readInteger("Fishing.Drop_Level.Tier1", 400); + fishingTier3 = readInteger("Fishing.Drop_Level.Tier1", 600); + fishingTier4 = readInteger("Fishing.Drop_Level.Tier1", 800); fishingDropChanceTier1 = readInteger("Fishing.Drops.Drop_Chance.Tier_1", 20); fishingDropChanceTier2 = readInteger("Fishing.Drops.Drop_Chance.Tier_2", 25); fishingDropChanceTier3 = readInteger("Fishing.Drops.Drop_Chance.Tier_3", 30); @@ -513,7 +520,17 @@ public class LoadProperties { if(!fishingTreasures.contains(treasureKey)) continue; FishingTreasure fTreasure = (FishingTreasure) treasure; - fishingRewards.add(fTreasure); + int dropLevel = fTreasure.getDropLevel(); + int maxLevel = fTreasure.getMaxLevel(); + + if(dropLevel <= fishingTier1 && maxLevel >= fishingTier1) + fishingRewardsTier1.add(fTreasure); + if(dropLevel <= fishingTier2 && maxLevel >= fishingTier2) + fishingRewardsTier2.add(fTreasure); + if(dropLevel <= fishingTier3 && maxLevel >= fishingTier3) + fishingRewardsTier3.add(fTreasure); + if(dropLevel <= fishingTier4 && maxLevel >= fishingTier4) + fishingRewardsTier4.add(fTreasure); } else if(treasure instanceof ExcavationTreasure) { if(!excavationTreasures.contains(treasureKey)) continue; diff --git a/src/main/java/com/gmail/nossr50/skills/Fishing.java b/src/main/java/com/gmail/nossr50/skills/Fishing.java index 09e423e0c..19e4aa512 100644 --- a/src/main/java/com/gmail/nossr50/skills/Fishing.java +++ b/src/main/java/com/gmail/nossr50/skills/Fishing.java @@ -39,21 +39,18 @@ public class Fishing { { int lvl = PP.getSkillLevel(SkillType.FISHING); - if(lvl < 100) + if(lvl >= LoadProperties.fishingTier1 && lvl < LoadProperties.fishingTier2) { return 1; - } else if (lvl >= 100 && lvl < 300) + } else if (lvl >= LoadProperties.fishingTier2 && lvl < LoadProperties.fishingTier3) { return 2; - } else if (lvl >= 300 && lvl < 600) + } else if (lvl >= LoadProperties.fishingTier3 && lvl < LoadProperties.fishingTier4) { return 3; - } else if (lvl >= 600 && lvl < 900) - { - return 4; } else { - return 5; + return 4; } } @@ -73,9 +70,6 @@ public class Fishing { case 4: getFishingResultsTier4(player, event); break; - case 5: - getFishingResultsTier5(player, event); - break; } m.mcDropItem(player.getLocation(), new ItemStack(Material.RAW_FISH, 1)); Users.getProfile(player).addXP(SkillType.FISHING, LoadProperties.mfishing, player);