Added vanilla XP boost for Fishing - includes permissions, config

options, etc
This commit is contained in:
GJ 2013-01-30 13:24:56 -05:00
parent 5e6b1fe362
commit 3f6bd7894d
7 changed files with 69 additions and 7 deletions

View File

@ -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

View File

@ -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); }

View File

@ -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?

View File

@ -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;
}
}

View File

@ -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.*
*/

View File

@ -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

View File

@ -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: