From 2bdeeb2d6eb42b9731121d652aded67faefa1cc8 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Wed, 7 Nov 2012 13:30:20 +0100 Subject: [PATCH 1/6] Changed shake drops from guaranteed to based upon fishing level and perks. --- .../nossr50/skills/gathering/Fishing.java | 409 +++++++++--------- 1 file changed, 207 insertions(+), 202 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java b/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java index dcbba60d8..eb9494d0f 100755 --- a/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java @@ -207,237 +207,242 @@ public class Fishing { randomChance = (int) (randomChance * 0.75); } + final Player player = event.getPlayer(); + final PlayerProfile profile = Users.getProfile(player); + + int dropChance = 10; + + switch (getFishingLootTier(profile)) { + case 1: + dropChance = 10; + break; + + case 2: + dropChance = 30; + break; + + case 3: + dropChance = 50; + break; + + case 4: + dropChance = 60; + break; + + case 5: + dropChance = 75; + break; + + default: + break; + } + if (event.getPlayer().hasPermission("mcmmo.perks.lucky.fishing")) { + dropChance = (int) (dropChance * 1.25); //With lucky perk on max level tier, its 100% + } + + final int DROP_CHANCE = random.nextInt(100); final int DROP_NUMBER = random.nextInt(randomChance) + 1; LivingEntity le = (LivingEntity) event.getCaught(); EntityType type = le.getType(); Location location = le.getLocation(); - switch (type) { - case BLAZE: - Misc.dropItem(location, new ItemStack(Material.BLAZE_ROD)); - break; + if (DROP_CHANCE < dropChance) { - case CAVE_SPIDER: - if (DROP_NUMBER > 50) { - Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE)); - } - else { - Misc.dropItem(location, new ItemStack(Material.STRING)); - } - break; + switch (type) { + case BLAZE: + Misc.dropItem(location, new ItemStack(Material.BLAZE_ROD)); + break; - case CHICKEN: - if (DROP_NUMBER > 66) { - Misc.dropItem(location, new ItemStack(Material.FEATHER)); - } - else if (DROP_NUMBER > 33) { - Misc.dropItem(location, new ItemStack(Material.RAW_CHICKEN)); - } - else { - Misc.dropItem(location, new ItemStack(Material.EGG)); - } - break; + case CAVE_SPIDER: + if (DROP_NUMBER > 50) { + Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE)); + } else { + Misc.dropItem(location, new ItemStack(Material.STRING)); + } + break; - case COW: - if (DROP_NUMBER > 99) { - Misc.dropItem(location, new ItemStack(Material.MILK_BUCKET)); - } - else if (DROP_NUMBER > 50) { - Misc.dropItem(location, new ItemStack(Material.LEATHER)); - } - else { - Misc.dropItem(location, new ItemStack(Material.RAW_BEEF)); - } - break; + case CHICKEN: + if (DROP_NUMBER > 66) { + Misc.dropItem(location, new ItemStack(Material.FEATHER)); + } else if (DROP_NUMBER > 33) { + Misc.dropItem(location, new ItemStack(Material.RAW_CHICKEN)); + } else { + Misc.dropItem(location, new ItemStack(Material.EGG)); + } + break; - case CREEPER: - if (DROP_NUMBER > 99) { - Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 4)); - } - else { - Misc.dropItem(location, new ItemStack(Material.SULPHUR)); - } - break; + case COW: + if (DROP_NUMBER > 99) { + Misc.dropItem(location, new ItemStack(Material.MILK_BUCKET)); + } else if (DROP_NUMBER > 50) { + Misc.dropItem(location, new ItemStack(Material.LEATHER)); + } else { + Misc.dropItem(location, new ItemStack(Material.RAW_BEEF)); + } + break; - case ENDERMAN: - Misc.dropItem(location, new ItemStack(Material.ENDER_PEARL)); - break; + case CREEPER: + if (DROP_NUMBER > 99) { + Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 4)); + } else { + Misc.dropItem(location, new ItemStack(Material.SULPHUR)); + } + break; - case GHAST: - if (DROP_NUMBER > 50) { - Misc.dropItem(location, new ItemStack(Material.SULPHUR)); - } - else { - Misc.dropItem(location, new ItemStack(Material.GHAST_TEAR)); - } - break; + case ENDERMAN: + Misc.dropItem(location, new ItemStack(Material.ENDER_PEARL)); + break; - case IRON_GOLEM: - if (DROP_NUMBER > 99) { - Misc.dropItem(location, new ItemStack(Material.PUMPKIN)); - } - else if (DROP_NUMBER > 90) { - Misc.dropItem(location, new ItemStack(Material.IRON_INGOT)); - } - else { - Misc.dropItem(location, new ItemStack(Material.RED_ROSE)); - } - break; + case GHAST: + if (DROP_NUMBER > 50) { + Misc.dropItem(location, new ItemStack(Material.SULPHUR)); + } else { + Misc.dropItem(location, new ItemStack(Material.GHAST_TEAR)); + } + break; - case MAGMA_CUBE: - Misc.dropItem(location, new ItemStack(Material.MAGMA_CREAM)); - break; + case IRON_GOLEM: + if (DROP_NUMBER > 99) { + Misc.dropItem(location, new ItemStack(Material.PUMPKIN)); + } else if (DROP_NUMBER > 90) { + Misc.dropItem(location, new ItemStack(Material.IRON_INGOT)); + } else { + Misc.dropItem(location, new ItemStack(Material.RED_ROSE)); + } + break; - case MUSHROOM_COW: - if (DROP_NUMBER > 99) { - Misc.dropItem(location, new ItemStack(Material.MILK_BUCKET)); - } - else if (DROP_NUMBER > 98) { - Misc.dropItem(location, new ItemStack(Material.MUSHROOM_SOUP)); - } - else if (DROP_NUMBER > 66) { - Misc.dropItem(location, new ItemStack(Material.LEATHER)); - } - else if (DROP_NUMBER > 33) { - Misc.dropItem(location, new ItemStack(Material.RAW_BEEF)); - } - else { - Misc.dropItems(location, new ItemStack(Material.RED_MUSHROOM), 3); - } - break; + case MAGMA_CUBE: + Misc.dropItem(location, new ItemStack(Material.MAGMA_CREAM)); + break; - case PIG: - Misc.dropItem(location, new ItemStack(Material.PORK)); - break; + case MUSHROOM_COW: + if (DROP_NUMBER > 99) { + Misc.dropItem(location, new ItemStack(Material.MILK_BUCKET)); + } else if (DROP_NUMBER > 98) { + Misc.dropItem(location, new ItemStack(Material.MUSHROOM_SOUP)); + } else if (DROP_NUMBER > 66) { + Misc.dropItem(location, new ItemStack(Material.LEATHER)); + } else if (DROP_NUMBER > 33) { + Misc.dropItem(location, new ItemStack(Material.RAW_BEEF)); + } else { + Misc.dropItems(location, new ItemStack(Material.RED_MUSHROOM), 3); + } + break; - case PIG_ZOMBIE: - if (DROP_NUMBER > 50) { - Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH)); - } - else { - Misc.dropItem(location, new ItemStack(Material.GOLD_NUGGET)); - } - break; + case PIG: + Misc.dropItem(location, new ItemStack(Material.PORK)); + break; - case SHEEP: - Sheep sheep = (Sheep) le; + case PIG_ZOMBIE: + if (DROP_NUMBER > 50) { + Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH)); + } else { + Misc.dropItem(location, new ItemStack(Material.GOLD_NUGGET)); + } + break; - if (!sheep.isSheared()) { - Wool wool = new Wool(); - wool.setColor(sheep.getColor()); + case SHEEP: + final Sheep sheep = (Sheep) le; - ItemStack theWool = wool.toItemStack(); - theWool.setAmount(1 + random.nextInt(6)); + if (!sheep.isSheared()) { + final Wool wool = new Wool(); + wool.setColor(sheep.getColor()); - Misc.dropItem(location, theWool); - sheep.setSheared(true); - } - break; + final ItemStack theWool = wool.toItemStack(); + theWool.setAmount(1 + random.nextInt(6)); - case SKELETON: - if(((CraftSkeleton) le).getHandle().getSkeletonType() == 1) { - if (DROP_NUMBER > 97) { - Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 1)); - } - else if (DROP_NUMBER > 50) { - Misc.dropItem(location, new ItemStack(Material.BONE)); - } - else { - Misc.dropItems(location, new ItemStack(Material.COAL), 3); - } - } - else { - if (DROP_NUMBER > 99) { - Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM)); - } - else if (DROP_NUMBER > 50) { - Misc.dropItem(location, new ItemStack(Material.BONE)); - } - else { - Misc.dropItems(location, new ItemStack(Material.ARROW), 3); - } - } - break; + Misc.dropItem(location, theWool); + sheep.setSheared(true); + } + break; - case SLIME: - Misc.dropItem(location, new ItemStack(Material.SLIME_BALL)); - break; + case SKELETON: + if (((CraftSkeleton) le).getHandle().getSkeletonType() == 1) { + if (DROP_NUMBER > 97) { + Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 1)); + } else if (DROP_NUMBER > 50) { + Misc.dropItem(location, new ItemStack(Material.BONE)); + } else { + Misc.dropItems(location, new ItemStack(Material.COAL), 3); + } + } else { + if (DROP_NUMBER > 99) { + Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM)); + } else if (DROP_NUMBER > 50) { + Misc.dropItem(location, new ItemStack(Material.BONE)); + } else { + Misc.dropItems(location, new ItemStack(Material.ARROW), 3); + } + } + break; - case SNOWMAN: - if (DROP_NUMBER > 99) { - Misc.dropItem(location, new ItemStack(Material.PUMPKIN)); - } - else { - Misc.dropItems(location, new ItemStack(Material.SNOW_BALL), 5); - } - break; + case SLIME: + Misc.dropItem(location, new ItemStack(Material.SLIME_BALL)); + break; - case SPIDER: - if (DROP_NUMBER > 50) { - Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE)); - } - else { - Misc.dropItem(location, new ItemStack(Material.STRING)); - } - break; + case SNOWMAN: + if (DROP_NUMBER > 99) { + Misc.dropItem(location, new ItemStack(Material.PUMPKIN)); + } else { + Misc.dropItems(location, new ItemStack(Material.SNOW_BALL), 5); + } + break; - case SQUID: - Misc.dropItem(location, new ItemStack(Material.INK_SACK, 1, (short) 0, (byte) 0x0)); - break; + case SPIDER: + if (DROP_NUMBER > 50) { + Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE)); + } else { + Misc.dropItem(location, new ItemStack(Material.STRING)); + } + break; - case WITCH: - final int DROP_NUMBER_2 = random.nextInt(randomChance) + 1; - if (DROP_NUMBER > 97) { - if(DROP_NUMBER_2 > 66) { - Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8197)); - } - else if(DROP_NUMBER_2 > 33) { - Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8195)); - } - else { - Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8194)); - } - } - else { - if(DROP_NUMBER_2 > 88) { - Misc.dropItem(location, new ItemStack(Material.GLASS_BOTTLE)); - } - else if(DROP_NUMBER_2 > 75) { - Misc.dropItem(location, new ItemStack(Material.GLOWSTONE_DUST)); - } - else if(DROP_NUMBER_2 > 63) { - Misc.dropItem(location, new ItemStack(Material.SULPHUR)); - } - else if(DROP_NUMBER_2 > 50) { - Misc.dropItem(location, new ItemStack(Material.REDSTONE)); - } - else if(DROP_NUMBER_2 > 38) { - Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE)); - } - else if(DROP_NUMBER_2 > 25) { - Misc.dropItem(location, new ItemStack(Material.STICK)); - } - else if(DROP_NUMBER_2 > 13) { - Misc.dropItem(location, new ItemStack(Material.SUGAR)); - } - else { - Misc.dropItem(location, new ItemStack(Material.POTION)); - } - } - break; + case SQUID: + Misc.dropItem(location, new ItemStack(Material.INK_SACK, 1, (short) 0, (byte) 0x0)); + break; - case ZOMBIE: - if (DROP_NUMBER > 99) { - Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 2)); - } - else { - Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH)); - } - break; + case WITCH: + final int DROP_NUMBER_2 = random.nextInt(randomChance) + 1; + if (DROP_NUMBER > 97) { + if (DROP_NUMBER_2 > 66) { + Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8197)); + } else if (DROP_NUMBER_2 > 33) { + Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8195)); + } else { + Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8194)); + } + } else { + if (DROP_NUMBER_2 > 88) { + Misc.dropItem(location, new ItemStack(Material.GLASS_BOTTLE)); + } else if (DROP_NUMBER_2 > 75) { + Misc.dropItem(location, new ItemStack(Material.GLOWSTONE_DUST)); + } else if (DROP_NUMBER_2 > 63) { + Misc.dropItem(location, new ItemStack(Material.SULPHUR)); + } else if (DROP_NUMBER_2 > 50) { + Misc.dropItem(location, new ItemStack(Material.REDSTONE)); + } else if (DROP_NUMBER_2 > 38) { + Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE)); + } else if (DROP_NUMBER_2 > 25) { + Misc.dropItem(location, new ItemStack(Material.STICK)); + } else if (DROP_NUMBER_2 > 13) { + Misc.dropItem(location, new ItemStack(Material.SUGAR)); + } else { + Misc.dropItem(location, new ItemStack(Material.POTION)); + } + } + break; - default: - break; + case ZOMBIE: + if (DROP_NUMBER > 99) { + Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 2)); + } else { + Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH)); + } + break; + + default: + break; + } } Combat.dealDamage(le, 1); From f5f07f7016b375bbae8d3a69d55a7a45fe0f3e73 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Wed, 7 Nov 2012 13:32:30 +0100 Subject: [PATCH 2/6] This wasn't right. --- src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java b/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java index eb9494d0f..8aeaa891a 100755 --- a/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java @@ -157,7 +157,7 @@ public class Fishing { int randomChance = 100; if (player.hasPermission("mcmmo.perks.lucky.fishing")) { - randomChance = (int) (randomChance * 1.25); + randomChance = (int) (randomChance * 0.75); } if (random.nextInt(randomChance) <= ENCHANTMENT_CHANCE && Permissions.getInstance().fishingMagic(player)) { @@ -204,7 +204,7 @@ public class Fishing { int randomChance = 100; if (event.getPlayer().hasPermission("mcmmo.perks.lucky.fishing")) { - randomChance = (int) (randomChance * 0.75); + randomChance = (int) (randomChance * 1.25); } final Player player = event.getPlayer(); From 00364afd8f3073b902de22e2450970b745479981 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Wed, 7 Nov 2012 14:02:30 +0100 Subject: [PATCH 3/6] Made the shake rank chance configurable --- src/main/java/com/gmail/nossr50/config/Config.java | 7 +++++++ .../com/gmail/nossr50/skills/gathering/Fishing.java | 10 +++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/Config.java b/src/main/java/com/gmail/nossr50/config/Config.java index 8554d5f78..e33b52c66 100644 --- a/src/main/java/com/gmail/nossr50/config/Config.java +++ b/src/main/java/com/gmail/nossr50/config/Config.java @@ -152,6 +152,13 @@ public class Config extends ConfigLoader { public int getFishingTierLevelsTier3() { return config.getInt("Fishing.Tier_Levels.Tier3", 400); } public int getFishingTierLevelsTier4() { return config.getInt("Fishing.Tier_Levels.Tier4", 600); } public int getFishingTierLevelsTier5() { return config.getInt("Fishing.Tier_Levels.Tier5", 800); } + + /* Shake */ + public int getShakeChanceRank1() { return config.getInt("Shake.Chance.Rank_1", 25); } + public int getShakeChanceRank2() { return config.getInt("Shake.Chance.Rank_2", 40); } + public int getShakeChanceRank3() { return config.getInt("Shake.Chance.Rank_3", 55); } + public int getShakeChanceRank4() { return config.getInt("Shake.Chance.Rank_4", 60); } + public int getShakeChanceRank5() { return config.getInt("Shake.Chance.Rank_5", 75); } /* Herbalism */ public int getHerbalismXPSugarCane() { return config.getInt("Experience.Herbalism.Sugar_Cane", 30); } diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java b/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java index 8aeaa891a..028262a8f 100755 --- a/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java @@ -214,23 +214,23 @@ public class Fishing { switch (getFishingLootTier(profile)) { case 1: - dropChance = 10; + dropChance = Config.getInstance().getShakeChanceRank1(); break; case 2: - dropChance = 30; + dropChance = Config.getInstance().getShakeChanceRank2(); break; case 3: - dropChance = 50; + dropChance = Config.getInstance().getShakeChanceRank3(); break; case 4: - dropChance = 60; + dropChance = Config.getInstance().getShakeChanceRank4(); break; case 5: - dropChance = 75; + dropChance = Config.getInstance().getShakeChanceRank5(); break; default: From f4bb8ccb7dea8ff9f7c9c5838312a2f3fe3296db Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Wed, 7 Nov 2012 14:14:49 +0100 Subject: [PATCH 4/6] Add Shake chances in the default config.yml --- src/main/resources/config.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index d731a4e61..3749d60fe 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -92,6 +92,14 @@ Fishing: Tier3: 400 Tier4: 600 Tier5: 800 + +Shake: + Chance: + Rank_1: 25 + Rank_2: 40 + Rank_3: 55 + Rank_4: 60 + Rank_5: 75 # # Settings for Abilities From 464d6bdd352eb498d87f3ce0e3f3288f7f6a0917 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Thu, 8 Nov 2012 20:15:02 +0100 Subject: [PATCH 5/6] Added the shake percentage There are associated stats now. Also added a '%' to Arcane chances in locale file --- .../com/gmail/nossr50/commands/skills/FishingCommand.java | 6 ++++-- src/main/resources/locale/locale_en_US.properties | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java index b4bcdbc10..dcc33ef24 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java @@ -1,6 +1,7 @@ package com.gmail.nossr50.commands.skills; import com.gmail.nossr50.commands.SkillCommand; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.skills.gathering.Fishing; @@ -8,6 +9,7 @@ import com.gmail.nossr50.skills.gathering.Fishing; public class FishingCommand extends SkillCommand { private int lootTier; private String magicChance; + private String shakeChance; private boolean canTreasureHunt; private boolean canMagicHunt; @@ -21,6 +23,7 @@ public class FishingCommand extends SkillCommand { protected void dataCalculations() { lootTier = Fishing.getFishingLootTier(profile); magicChance = percent.format((float) lootTier / 15); + shakeChance = String.valueOf(Fishing.getShakeChance(lootTier)); } @Override @@ -66,12 +69,11 @@ public class FishingCommand extends SkillCommand { } if (canShake) { - //TODO: Do we really need to display this twice? Not like there are any associated stats. if (skillValue < 150) { player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Fishing.Ability.Locked.0") })); } else { - player.sendMessage(LocaleLoader.getString("Fishing.Ability.Shake")); + player.sendMessage(LocaleLoader.getString("Fishing.Ability.Shake", new Object[] { shakeChance })); } } } diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index d80948351..0bd4b8bf1 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -102,7 +102,7 @@ Excavation.Skillup=[[YELLOW]]Excavation skill increased by {0}. Total ({1}) Fishing.Ability.Info=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunter Rank** Fishing.Ability.Locked.0=LOCKED UNTIL 150+ SKILL (SHAKE) Fishing.Ability.Rank=[[RED]]Treasure Hunter Rank: [[YELLOW]]{0}/5 -Fishing.Ability.Shake=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_; +Fishing.Ability.Shake=[[RED]]Shake Chance: [[YELLOW]]{0}% Fishing.Effect.0=Treasure Hunter (Passive) Fishing.Effect.1=Fish up misc. objects Fishing.Effect.2=Magic Hunter @@ -221,8 +221,8 @@ Repair.Skills.Super.Chance=[[RED]]Super Repair Chance: [[YELLOW]]{0} Repair.Skillup=[[YELLOW]]Repair skill increased by {0}. Total ({1}) ##Arcane Forging -Repair.Arcane.Chance.Downgrade=[[GRAY]]AF Downgrade Chance: [[YELLOW]]{0} -Repair.Arcane.Chance.Success=[[GRAY]]AF Success Rate: [[YELLOW]]{0} +Repair.Arcane.Chance.Downgrade=[[GRAY]]AF Downgrade Chance: [[YELLOW]]{0}% +Repair.Arcane.Chance.Success=[[GRAY]]AF Success Rate: [[YELLOW]]{0}% Repair.Arcane.Downgrade=[[RED]]Arcane power has decreased for this item. Repair.Arcane.Fail=[[RED]]Arcane power has permanently left the item. Repair.Arcane.Lost=[[RED]]You were not skilled enough to keep any enchantments. From a1a61e9d4ab16838b40022612c974a04aca87d8b Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Thu, 8 Nov 2012 20:15:40 +0100 Subject: [PATCH 6/6] Added new method for calculating the ShakeChance --- .../nossr50/skills/gathering/Fishing.java | 56 ++++++++++--------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java b/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java index 028262a8f..2fd1f1301 100755 --- a/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java @@ -209,33 +209,10 @@ public class Fishing { final Player player = event.getPlayer(); final PlayerProfile profile = Users.getProfile(player); + int lootTier = getFishingLootTier(profile); - int dropChance = 10; - - switch (getFishingLootTier(profile)) { - case 1: - dropChance = Config.getInstance().getShakeChanceRank1(); - break; - - case 2: - dropChance = Config.getInstance().getShakeChanceRank2(); - break; - - case 3: - dropChance = Config.getInstance().getShakeChanceRank3(); - break; - - case 4: - dropChance = Config.getInstance().getShakeChanceRank4(); - break; - - case 5: - dropChance = Config.getInstance().getShakeChanceRank5(); - break; - - default: - break; - } + int dropChance = getShakeChance(lootTier); + if (event.getPlayer().hasPermission("mcmmo.perks.lucky.fishing")) { dropChance = (int) (dropChance * 1.25); //With lucky perk on max level tier, its 100% } @@ -447,4 +424,31 @@ public class Fishing { Combat.dealDamage(le, 1); } + /** + * Gets chance of shake success. + * + * @param rank Treasure hunter rank + * @return The chance of a successful shake + */ + public static int getShakeChance(int lootTier) { + switch (lootTier) { + case 1: + return Config.getInstance().getShakeChanceRank1(); + + case 2: + return Config.getInstance().getShakeChanceRank2(); + + case 3: + return Config.getInstance().getShakeChanceRank3(); + + case 4: + return Config.getInstance().getShakeChanceRank4(); + + case 5: + return Config.getInstance().getShakeChanceRank5(); + + default: + return 10; + } + } }