diff --git a/Changelog.txt b/Changelog.txt index e28da13b3..6cc4b1af7 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -20,6 +20,7 @@ Version 1.4.00-dev + Added XP bonus for Archery based on distance from shooter to target + Added ability to config Hylian Luck drops through treasures.yml + Added party XP sharing + + Added vanilla XP boost for Fishing - includes permissions, config options, etc = Fixed the guide usage string showing up every time /skillname was called = Fixed Spout not being able to precache our resources properly, and therefore making our XP bars fail = Fixed Spout config files loading / generating when they shouldn't have diff --git a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java index 7021b39f3..ef0213e60 100644 --- a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java +++ b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java @@ -89,6 +89,13 @@ public class AdvancedConfig extends ConfigLoader { public int getShakeChanceRank4() { return config.getInt("Skills.Fishing.Shake_Chance.Rank_4", 60); } public int getShakeChanceRank5() { return config.getInt("Skills.Fishing.Shake_Chance.Rank_5", 75); } + /* Vanilla XP Boost */ + public int getFishingVanillaXPModifierRank1() { return config.getInt("Skills.Fishing.VanillaXPBoost.Rank_1", 1); } + public int getFishingVanillaXPModifierRank2() { return config.getInt("Skills.Fishing.VanillaXPBoost.Rank_2", 2); } + public int getFishingVanillaXPModifierRank3() { return config.getInt("Skills.Fishing.VanillaXPBoost.Rank_3", 3); } + public int getFishingVanillaXPModifierRank4() { return config.getInt("Skills.Fishing.VanillaXPBoost.Rank_4", 4); } + public int getFishingVanillaXPModifierRank5() { return config.getInt("Skills.Fishing.VanillaXPBoost.Rank_5", 5); } + /* HERBALISM */ public int getFarmerDietRankChange() { return config.getInt("Skills.Herbalism.Farmer_Diet_RankChange", 200); } diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index 2be42975f..9ad9fc2b7 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -92,7 +92,9 @@ public class PlayerListener implements Listener { switch (event.getState()) { case CAUGHT_FISH: Fishing.beginFishing(player, skillLevel, event); - break; + Fishing.awardAdditionalVanillaXP(skillLevel, event); + break; + case CAUGHT_ENTITY: if (skillLevel >= AdvancedConfig.getInstance().getShakeUnlockLevel() && Permissions.shakeMob(player)) { //TODO: Unsafe cast? diff --git a/src/main/java/com/gmail/nossr50/skills/fishing/Fishing.java b/src/main/java/com/gmail/nossr50/skills/fishing/Fishing.java index b25b3cbe3..80269a9ae 100644 --- a/src/main/java/com/gmail/nossr50/skills/fishing/Fishing.java +++ b/src/main/java/com/gmail/nossr50/skills/fishing/Fishing.java @@ -29,11 +29,26 @@ public final class Fishing { // The order of the values is extremely important, Fishing.getLootTier() and ShakeMob.getShakeChance() depend on it to work properly protected enum Tier { - FIVE(5) {@Override public int getLevel() {return ADVANCED_CONFIG.getFishingTierLevelsTier5();} @Override public int getShakeChance() {return ADVANCED_CONFIG.getShakeChanceRank5();}}, - FOUR(4) {@Override public int getLevel() {return ADVANCED_CONFIG.getFishingTierLevelsTier4();} @Override public int getShakeChance() {return ADVANCED_CONFIG.getShakeChanceRank4();}}, - THREE(3) {@Override public int getLevel() {return ADVANCED_CONFIG.getFishingTierLevelsTier3();} @Override public int getShakeChance() {return ADVANCED_CONFIG.getShakeChanceRank3();}}, - TWO(2) {@Override public int getLevel() {return ADVANCED_CONFIG.getFishingTierLevelsTier2();} @Override public int getShakeChance() {return ADVANCED_CONFIG.getShakeChanceRank2();}}, - ONE(1) {@Override public int getLevel() {return ADVANCED_CONFIG.getFishingTierLevelsTier1();} @Override public int getShakeChance() {return ADVANCED_CONFIG.getShakeChanceRank1();}}; + FIVE(5) { + @Override public int getLevel() {return ADVANCED_CONFIG.getFishingTierLevelsTier5();} + @Override public int getShakeChance() {return ADVANCED_CONFIG.getShakeChanceRank5();} + @Override public int getVanillaXPBoostModifier() {return ADVANCED_CONFIG.getFishingVanillaXPModifierRank5();}}, + FOUR(4) { + @Override public int getLevel() {return ADVANCED_CONFIG.getFishingTierLevelsTier4();} + @Override public int getShakeChance() {return ADVANCED_CONFIG.getShakeChanceRank4();} + @Override public int getVanillaXPBoostModifier() {return ADVANCED_CONFIG.getFishingVanillaXPModifierRank4();}}, + THREE(3) { + @Override public int getLevel() {return ADVANCED_CONFIG.getFishingTierLevelsTier3();} + @Override public int getShakeChance() {return ADVANCED_CONFIG.getShakeChanceRank3();} + @Override public int getVanillaXPBoostModifier() {return ADVANCED_CONFIG.getFishingVanillaXPModifierRank3();}}, + TWO(2) { + @Override public int getLevel() {return ADVANCED_CONFIG.getFishingTierLevelsTier2();} + @Override public int getShakeChance() {return ADVANCED_CONFIG.getShakeChanceRank2();} + @Override public int getVanillaXPBoostModifier() {return ADVANCED_CONFIG.getFishingVanillaXPModifierRank2();}}, + ONE(1) { + @Override public int getLevel() {return ADVANCED_CONFIG.getFishingTierLevelsTier1();} + @Override public int getShakeChance() {return ADVANCED_CONFIG.getShakeChanceRank1();} + @Override public int getVanillaXPBoostModifier() {return ADVANCED_CONFIG.getFishingVanillaXPModifierRank1();}}; int numerical; @@ -47,6 +62,7 @@ public final class Fishing { abstract protected int getLevel(); abstract protected int getShakeChance(); + abstract protected int getVanillaXPBoostModifier(); } // TODO: Get rid of that @@ -115,6 +131,11 @@ public final class Fishing { SkillTools.xpProcessing(player, Users.getProfile(player), SkillType.FISHING, Config.getInstance().getFishingBaseXP() + xp); } + public static void awardAdditionalVanillaXP(int skillLevel, PlayerFishEvent event) { + int xp = event.getExpToDrop(); + event.setExpToDrop(xp * getVanillaXPMultiplier(skillLevel)); + } + /** * Checks for treasure * @@ -233,4 +254,20 @@ public final class Fishing { return 0; } + + /** + * Gets the Shake Mob probability for a given skill level + * + * @param skillLevel Fishing skill level + * @return Shake Mob probability + */ + public static int getVanillaXPMultiplier(int skillLevel) { + for (Tier tier : Tier.values()) { + if (skillLevel >= tier.getLevel()) { + return tier.getVanillaXPBoostModifier(); + } + } + + return 0; + } } diff --git a/src/main/java/com/gmail/nossr50/util/Permissions.java b/src/main/java/com/gmail/nossr50/util/Permissions.java index 27e340d25..4e5f3e79b 100644 --- a/src/main/java/com/gmail/nossr50/util/Permissions.java +++ b/src/main/java/com/gmail/nossr50/util/Permissions.java @@ -235,6 +235,10 @@ public final class Permissions { return hasPermission(player, "mcmmo.ability.fishing.fishermansdiet"); } + public static boolean fishingVanillaXPBoost(Player player) { + return hasPermission(player, "mcmmo.ability.fishing.vanillaxpboost"); + } + /* * MCMMO.ABILITY.MINING.* */ diff --git a/src/main/resources/advanced.yml b/src/main/resources/advanced.yml index 16a50a214..276622d1f 100644 --- a/src/main/resources/advanced.yml +++ b/src/main/resources/advanced.yml @@ -106,6 +106,14 @@ Skills: Rank_4: 60 Rank_5: 75 + #VanillaXPBoost: Vanilla XP gained from fishing is mutliplied by these values. + VanillaXPBoost: + Rank_1: 1 + Rank_2: 2 + Rank_3: 3 + Rank_4: 4 + Rank_5: 5 + # Tiers Tier_Levels: Tier1: 0 diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index d51b21f4f..64d7ea139 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -12,7 +12,7 @@ description: > experience. author: nossr50 -authors: [NuclearW, GJ, Glitchfinder, TfT_02, toothplck1] +authors: [GJ, NuclearW, bm01, Glitchfinder, TfT_02, toothplck1] website: http://dev.bukkit.org/server-mods/mcmmo/ main: com.gmail.nossr50.mcMMO @@ -412,6 +412,7 @@ permissions: mcmmo.ability.fishing.treasures: true mcmmo.ability.fishing.magic: true mcmmo.ability.fishing.fishermansdiet: true + mcmmo.ability.fishing.vanillaxpboost: true mcmmo.ability.fishing.shakemob: description: Allows access to the Shake Mob ability mcmmo.ability.fishing.treasures: @@ -420,6 +421,8 @@ permissions: description: Allows enchanted drops from Fishing mcmmo.ability.fishing.fishermansdiet: description: Allows access to the Fishermans's Diet ability + mcmmo.ability.fishing.vanillaxpboost: + description: Allows vanilla XP boost from Fishing mcmmo.ability.mining.*: description: Allows access to all Mining abilities children: