new fishing skill Inner Peace

This commit is contained in:
nossr50
2019-04-10 05:29:35 -07:00
parent c41a650415
commit 78aeb0679b
13 changed files with 106 additions and 51 deletions

View File

@ -102,7 +102,7 @@ public class FishingCommand extends SkillCommand {
location = player.getLocation();
}
if (Fishing.masterAnglerBiomes.contains(location.getBlock().getBiome())) {
if (Fishing.getInstance().getMasterAnglerBiomes().contains(location.getBlock().getBiome())) {
rawBiteChance = rawBiteChance * AdvancedConfig.getInstance().getMasterAnglerBiomeModifier();
}
@ -163,6 +163,11 @@ public class FishingCommand extends SkillCommand {
String.valueOf(recordTreasure)));
}
if(canInnerPeace)
{
m
}
return messages;
}

View File

@ -644,7 +644,6 @@ public class AdvancedConfig extends ConfigValidated {
/* FISHING */
public double getShakeChance(int rank) { return getDoubleValue(SKILLS, FISHING, SHAKE, CHANCE, RANK, String.valueOf(rank)); }
public int getFishingVanillaXPModifier(int rank) { return getIntValue(SKILLS, FISHING, VANILLA_XPMULTIPLIER, RANK, String.valueOf(rank)); }
public double getMasterAnglerBoatModifier() {return getDoubleValue(SKILLS, FISHING, MASTER_ANGLER, BOAT_MODIFIER); }
public double getMasterAnglerBiomeModifier() {return getDoubleValue(SKILLS, FISHING, MASTER_ANGLER, BIOME_MODIFIER); }

View File

@ -369,14 +369,6 @@ public class MainConfig extends ConfigValidated {
reason.add(ABILITIES + "." + LIMITS + "." + TREE_FELLER_THRESHOLD + " should be greater than 0!");
}*/
if (getFishingLureModifier() < 0) {
reason.add(ABILITIES + "." + FISHING + "." + LURE_MODIFIER + " should be at least 0!");
}
if (getDetonatorItem() == null) {
reason.add(SKILLS + "." + MINING + "." + DETONATOR + "Item is invalid!");
}
/*if (getRepairAnvilMaterial() == null) {
reason.add(SKILLS + "." + REPAIR + "." + ANVIL + "Type is invalid!!");
}
@ -597,24 +589,6 @@ public class MainConfig extends ConfigValidated {
return getBooleanValue(SKILLS, ALCHEMY, PREVENT_HOPPER_TRANSFER_BOTTLES);
}
/* Fishing */
public boolean getFishingDropsEnabled() {
return getBooleanValue(SKILLS, FISHING, DROPS + ENABLED);
}
public boolean getFishingOverrideTreasures() {
return getBooleanValue(SKILLS, FISHING, OVERRIDE_VANILLA_TREASURES);
}
public double getFishingLureModifier() {
return getDoubleValue(SKILLS, FISHING, LURE_MODIFIER);
}
/* Mining */
public Material getDetonatorItem() {
//Flint and steel
return Material.matchMaterial(getStringValue(SKILLS, MINING, DETONATOR + NAME));
}
/* Unarmed */
public boolean getUnarmedBlockCrackerSmoothbrickToCracked() {

View File

@ -33,4 +33,6 @@ public class ConfigExperienceFishing {
public int getShakeXP() {
return shakeXP;
}
}

View File

@ -3,12 +3,21 @@ package com.gmail.nossr50.config.hocon.skills.fishing;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
import java.util.HashMap;
@ConfigSerializable
public class ConfigFishing {
@Setting(value = "General")
private ConfigFishingGeneral fishingGeneral = new ConfigFishingGeneral();
@Setting(value = "Sub-Skills")
public ConfigFishingSubskills fishingSubskills = new ConfigFishingSubskills();
/*
* GETTERS BOILERPLATE
*/
public ConfigFishingGeneral getFishingGeneral() {
return fishingGeneral;
}
@ -24,4 +33,25 @@ public class ConfigFishing {
public boolean isOverrideVanillaTreasures() {
return fishingGeneral.isOverrideVanillaTreasures();
}
public boolean isAllowCustomDrops() {
return fishingGeneral.isAllowCustomDrops();
}
public ConfigFishingSubskills getFishingSubskills() {
return fishingSubskills;
}
public ConfigFishingInnerPeace getInnerPeace() {
return fishingSubskills.getInnerPeace();
}
public HashMap<Integer, Integer> getInnerPeaceVanillaXPMultiplier() {
return getInnerPeace().getInnerPeaceVanillaXPMultiplier();
}
public int getVanillaXPMultInnerPeace(int rank)
{
return getInnerPeaceVanillaXPMultiplier().get(rank);
}
}

View File

@ -9,6 +9,7 @@ public class ConfigFishingGeneral {
private static final boolean ALWAYS_CATCH_FISH_DEFAULT = true;
private static final boolean OVERRIDE_VANILLA_TREASURES = true;
public static final double LURE_MODIFIER_DEFAULT = 4.0D;
private static final boolean ALLOW_MCMMO_FISHING_REWARDS = true;
@Setting(value = "Always-Catch-Fish", comment = "Enables fish to be caught alongside treasure." +
"\nDefault value: "+ALWAYS_CATCH_FISH_DEFAULT)
@ -24,6 +25,14 @@ public class ConfigFishingGeneral {
"\nDefault value: "+LURE_MODIFIER_DEFAULT)
private double lureLuckModifier = LURE_MODIFIER_DEFAULT;
@Setting(value = "Allow-Custom-Fishing-Drops", comment = "If set to true, allows mcMMO fishing treasures to be found while fishing." +
"\nDefault value: "+ALLOW_MCMMO_FISHING_REWARDS)
private boolean allowCustomDrops = ALLOW_MCMMO_FISHING_REWARDS;
public boolean isAllowCustomDrops() {
return allowCustomDrops;
}
public double getLureLuckModifier() {
return lureLuckModifier;
}

View File

@ -0,0 +1,27 @@
package com.gmail.nossr50.config.hocon.skills.fishing;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
import java.util.HashMap;
@ConfigSerializable
public class ConfigFishingInnerPeace {
private static final HashMap<Integer, Integer> INNER_PEACE_DEFAULT;
static {
INNER_PEACE_DEFAULT = new HashMap<>();
INNER_PEACE_DEFAULT.put(1, 3);
INNER_PEACE_DEFAULT.put(2, 5);
INNER_PEACE_DEFAULT.put(3, 7);
}
@Setting(value = "Vanilla-Orb-XP-Multipliers", comment = "How much Inner Peace will grant in bonus XP orbs" +
"\nThis value is used to multiply the number of vanilla XP orbs you would normally receive.")
private HashMap<Integer, Integer> innerPeaceVanillaXPMultiplier = INNER_PEACE_DEFAULT;
public HashMap<Integer, Integer> getInnerPeaceVanillaXPMultiplier() {
return innerPeaceVanillaXPMultiplier;
}
}

View File

@ -0,0 +1,15 @@
package com.gmail.nossr50.config.hocon.skills.fishing;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigFishingSubskills {
@Setting(value = "Inner-Peace")
private ConfigFishingInnerPeace innerPeace = new ConfigFishingInnerPeace();
public ConfigFishingInnerPeace getInnerPeace() {
return innerPeace;
}
}

View File

@ -1,19 +0,0 @@
package com.gmail.nossr50.datatypes.skills;
public class SubSkillFlags {
/*
* Bitwise Flags
* These are so I can flag properties for subskills
* Flags are in the power of 2 because binary is a base-2 system
*/
public static final int ACTIVE = 1; //Active subskills are ones that aren't passive
public static final int SUPERABILITY = 2; // Super abilities are redundantly active
public static final int RNG = 4; //If the subskill makes use of RNG
public static final int PVP = 8; //If the subskill has properties that change in PVP conditions
public static final int TIMED = 16; //If the subskill has a duration or time component
public static final int TARGET_COLLECTION = 32; //If the subskill has multiple target types
public static final int REWARD_COLLECTION = 64; //If the subskill has multiple reward types
public static final int CHARGES = 128;
public static final int LIMITED = 256;
//public static final int RANDOM_ACTIVATION = 128; //If the subskill has random activation
}

View File

@ -38,6 +38,7 @@ public enum SubSkillType {
FISHING_MAGIC_HUNTER(1),
FISHING_MASTER_ANGLER(1),
FISHING_TREASURE_HUNTER(8),
FISHING_INNER_PEACE(3),
FISHING_SHAKE(1),
/* Herbalism */

View File

@ -211,7 +211,7 @@ public class FishingManager extends SkillManager {
}
protected int getVanillaXPBoostModifier() {
return AdvancedConfig.getInstance().getFishingVanillaXPModifier(getLootTier());
return mcMMO.getConfigManager().getConfigFishing().getVanillaXPMultInnerPeace(RankUtils.getRank(getPlayer(), SubSkillType.FISHING_INNER_PEACE));
}
/**
@ -283,12 +283,13 @@ public class FishingManager extends SkillManager {
* @param fishingCatch The {@link Item} initially caught
*/
public void handleFishing(Item fishingCatch) {
int fishXp = ExperienceConfig.getInstance().getXp(PrimarySkillType.FISHING, fishingCatch.getItemStack().getType());
int fishXp = Fishing.getInstance().getFishXPValue(fishingCatch.getItemStack().getType());
int treasureXp = 0;
Player player = getPlayer();
FishingTreasure treasure = null;
if (MainConfig.getInstance().getFishingDropsEnabled() && Permissions.isSubSkillEnabled(player, SubSkillType.FISHING_TREASURE_HUNTER)) {
if (mcMMO.getConfigManager().getConfigFishing().isAllowCustomDrops()
&& Permissions.isSubSkillEnabled(player, SubSkillType.FISHING_TREASURE_HUNTER)) {
treasure = getFishingTreasure();
}
@ -326,7 +327,8 @@ public class FishingManager extends SkillManager {
}
if (mcMMO.getConfigManager().getConfigFishing().isAlwaysCatchFish()) {
Misc.dropItem(player.getEyeLocation(), fishingCatch.getItemStack());
/*Misc.dropItem(player.getEyeLocation(), fishingCatch.getItemStack());*/
Misc.dropItem(fishingCatch.getLocation(), fishingCatch.getItemStack()).setVelocity(fishingCatch.getVelocity());
}
fishingCatch.setItemStack(treasureDrop);