From 3123f69aec8cf19baea90f9292fe3ac3ed9baefc Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sun, 12 May 2019 03:46:23 -0700 Subject: [PATCH] Setup combat XP map - Use float in more places --- .../gmail/nossr50/config/ConfigManager.java | 2 +- .../hocon/experience/ConfigExperience.java | 28 ++-- .../ConfigExperienceAcrobatics.java | 6 +- .../experience/ConfigExperienceArchery.java | 6 +- .../experience/ConfigExperienceCombat.java | 144 +++++++++--------- .../experience/ConfigExperienceRepair.java | 28 ++-- .../experience/ConfigExperienceSkills.java | 22 +-- .../util/experience/ExperienceMapManager.java | 42 ++++- 8 files changed, 164 insertions(+), 114 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/ConfigManager.java b/src/main/java/com/gmail/nossr50/config/ConfigManager.java index 291ddc929..efc878dbf 100644 --- a/src/main/java/com/gmail/nossr50/config/ConfigManager.java +++ b/src/main/java/com/gmail/nossr50/config/ConfigManager.java @@ -142,7 +142,6 @@ public final class ConfigManager { //YAML CONFIGS - private MainConfig mainConfig; private FishingTreasureConfig fishingTreasureConfig; private ExcavationTreasureConfig excavationTreasureConfig; @@ -332,6 +331,7 @@ public final class ConfigManager { //Set the global XP val experienceMapManager.setGlobalXpMult(getConfigExperience().getGlobalXPMultiplier()); experienceMapManager.buildBlockXPMaps(); //Block XP value maps + experienceMapManager.fillCombatXPMultiplierMap(getConfigExperience().getCombatExperienceMap()); // potionManager = new PotionManager(); } diff --git a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperience.java b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperience.java index cb738c770..ef016b552 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperience.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperience.java @@ -10,12 +10,12 @@ import java.util.HashMap; @ConfigSerializable public class ConfigExperience { - private static final double GLOBAL_XP_MULT_DEFAULT = 1.0D; + private static final float GLOBAL_XP_MULT_DEFAULT = 1.0F; @Setting(value = "Global-XP-Multiplier", comment = "This multiplier is applied at the very end of every XP gain, you can use it as a shortcut to increase or decrease xp gains across the entire plugin" + "\nThis value is temporarily overridden by xprate events." + "\nDefault value: " + GLOBAL_XP_MULT_DEFAULT) - private double globalXPMultiplier = GLOBAL_XP_MULT_DEFAULT; + private float globalXPMultiplier = GLOBAL_XP_MULT_DEFAULT; @Setting(value = "Global-Skill-XP-Multipliers", comment = "This multiplier is applied at the very end of an XP calculation specific to its corresponding skill, this value is applied before the global multiplier is applied.") private ConfigExperienceSkillMultiplier configExperienceSkillMultiplier = new ConfigExperienceSkillMultiplier(); @@ -102,11 +102,11 @@ public class ConfigExperience { return getConfigExperienceSkills().getSmeltingExperienceMap(); } - public HashMap getItemMaterialXPMultiplier() { + public HashMap getItemMaterialXPMultiplier() { return getConfigExperienceSkills().getItemMaterialXPMultiplier(); } - public double getRepairXPBase() { + public Float getRepairXPBase() { return getConfigExperienceSkills().getRepairXPBase(); } @@ -114,7 +114,7 @@ public class ConfigExperience { return getConfigExperienceSkills().getAcrobaticsXPMap(); } - public Double getFeatherFallMultiplier() { + public Float getFeatherFallMultiplier() { return getConfigExperienceSkills().getFeatherFallMultiplier(); } @@ -158,11 +158,15 @@ public class ConfigExperience { return getConfigExperienceSkills().isPvpXPEnabled(); } - public HashMap getCombatExperienceMap() { + public HashMap getCombatExperienceMap() { return getConfigExperienceSkills().getCombatExperienceMap(); } - public double getDistanceMultiplier() { + public HashMap getSpecialCombatExperienceMap() { + return configExperienceSkills.getSpecialCombatExperienceMap(); + } + + public Float getDistanceMultiplier() { return getConfigExperienceSkills().getDistanceMultiplier(); } @@ -186,19 +190,19 @@ public class ConfigExperience { return getConfigExperienceSkills().getShakeXP(); } - public double getSpawnedMobXPMult() { + public Float getSpawnedMobXPMult() { return getConfigExperienceSkills().getSpawnedMobXPMult(); } - public double getPlayerBredMobsXPMult() { + public Float getPlayerBredMobsXPMult() { return getExperienceCombat().getPlayerBredMobsXPMult(); } - public double getPVPXPMult() { + public Float getPVPXPMult() { return getConfigExperienceSkills().getPVPXPMult(); } - public double getAnimalsXPMult() { + public Float getAnimalsXPMult() { return getConfigExperienceSkills().getAnimalsXPMult(); } @@ -206,7 +210,7 @@ public class ConfigExperience { return configExperienceSkills; } - public double getGlobalXPMultiplier() { + public Float getGlobalXPMultiplier() { return globalXPMultiplier; } } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceAcrobatics.java b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceAcrobatics.java index 862f20841..e907e710d 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceAcrobatics.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceAcrobatics.java @@ -9,7 +9,7 @@ import java.util.HashMap; public class ConfigExperienceAcrobatics { private final static HashMap ACROBATICS_DEFAULT_XP_MAP; - private static final double FEATHER_FALL_MULTIPLIER_DEFAULT = 2.0D; + private static final float FEATHER_FALL_MULTIPLIER_DEFAULT = 2.0F; static { ACROBATICS_DEFAULT_XP_MAP = new HashMap<>(); @@ -24,13 +24,13 @@ public class ConfigExperienceAcrobatics { @Setting(value = "Feather-Fall-XP-Multiplier", comment = "Feather Fall grants bonus XP to fall related XP gains." + "\nThis value is multiplied against your XP to give the bonus." + "\nDefault value: " + FEATHER_FALL_MULTIPLIER_DEFAULT) - private Double featherFallMultiplier = FEATHER_FALL_MULTIPLIER_DEFAULT; + private Float featherFallMultiplier = FEATHER_FALL_MULTIPLIER_DEFAULT; public HashMap getAcrobaticsXPMap() { return acrobaticsXPMap; } - public Double getFeatherFallMultiplier() { + public Float getFeatherFallMultiplier() { return featherFallMultiplier; } diff --git a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceArchery.java b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceArchery.java index ad5c2a10d..74ec35767 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceArchery.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceArchery.java @@ -6,7 +6,7 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; @ConfigSerializable public class ConfigExperienceArchery { - public static final double DISTANCE_MULTIPLIER_DEFAULT = 0.025D; + public static final float DISTANCE_MULTIPLIER_DEFAULT = 0.025F; @Setting(value = "Distance-Multiplier", comment = "The distance multiplier is multiplied against the distance an " + "arrow travels before hitting its target to determine final XP values awarded." + @@ -14,9 +14,9 @@ public class ConfigExperienceArchery { "\nDistance is in blocks traveled." + "\nThis value is added on to normal XP gains from damage for Archery." + "\nDefault value: " + DISTANCE_MULTIPLIER_DEFAULT) - private double distanceMultiplier = DISTANCE_MULTIPLIER_DEFAULT; + private float distanceMultiplier = DISTANCE_MULTIPLIER_DEFAULT; - public double getDistanceMultiplier() { + public float getDistanceMultiplier() { return distanceMultiplier; } } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceCombat.java b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceCombat.java index 3692d3c92..63f4c7cbf 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceCombat.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceCombat.java @@ -8,84 +8,84 @@ import java.util.HashMap; @ConfigSerializable public class ConfigExperienceCombat { - private static final HashMap COMBAT_EXPERIENCE_DEFAULT; - private static final HashMap SPECIAL_COMBAT_EXPERIENCE_DEFAULT; + private static final HashMap COMBAT_EXPERIENCE_DEFAULT; + private static final HashMap SPECIAL_COMBAT_EXPERIENCE_DEFAULT; private static final boolean PVP_XP_ENABLED_DEFAULT = false; static { COMBAT_EXPERIENCE_DEFAULT = new HashMap<>(); - COMBAT_EXPERIENCE_DEFAULT.put("creeper", 4.0D); - COMBAT_EXPERIENCE_DEFAULT.put("cat", 1.0D); - COMBAT_EXPERIENCE_DEFAULT.put("fox", 1.0D); - COMBAT_EXPERIENCE_DEFAULT.put("panda", 1.0D); - COMBAT_EXPERIENCE_DEFAULT.put("pillager", 2.0D); - COMBAT_EXPERIENCE_DEFAULT.put("ravager", 4.0D); - COMBAT_EXPERIENCE_DEFAULT.put("trader_llama", 1.0D); - COMBAT_EXPERIENCE_DEFAULT.put("skeleton", 3.0D); - COMBAT_EXPERIENCE_DEFAULT.put("spider", 2.0D); - COMBAT_EXPERIENCE_DEFAULT.put("giant", 4.0D); - COMBAT_EXPERIENCE_DEFAULT.put("zombie", 2.0D); - COMBAT_EXPERIENCE_DEFAULT.put("slime", 2.0D); - COMBAT_EXPERIENCE_DEFAULT.put("ghast", 3.0D); - COMBAT_EXPERIENCE_DEFAULT.put("pig_zombie", 3.0D); - COMBAT_EXPERIENCE_DEFAULT.put("enderman", 1.0D); - COMBAT_EXPERIENCE_DEFAULT.put("cave_spider", 3.0D); - COMBAT_EXPERIENCE_DEFAULT.put("silverfish", 3.0D); - COMBAT_EXPERIENCE_DEFAULT.put("blaze", 3.0D); - COMBAT_EXPERIENCE_DEFAULT.put("magma_cube", 2.0D); - COMBAT_EXPERIENCE_DEFAULT.put("ender_dragon", 1.0D); - COMBAT_EXPERIENCE_DEFAULT.put("wither", 1.0D); - COMBAT_EXPERIENCE_DEFAULT.put("witch", 0.1D); - COMBAT_EXPERIENCE_DEFAULT.put("iron_golem", 2.0D); - COMBAT_EXPERIENCE_DEFAULT.put("wither_skeleton", 4.0D); - COMBAT_EXPERIENCE_DEFAULT.put("endermite", 2.0D); - COMBAT_EXPERIENCE_DEFAULT.put("guardian", 3.0D); - COMBAT_EXPERIENCE_DEFAULT.put("elder_guardian", 4.0D); - COMBAT_EXPERIENCE_DEFAULT.put("shulker", 2.0D); - COMBAT_EXPERIENCE_DEFAULT.put("donkey", 1.0D); - COMBAT_EXPERIENCE_DEFAULT.put("mule", 1.0D); - COMBAT_EXPERIENCE_DEFAULT.put("horse", 1.0D); - COMBAT_EXPERIENCE_DEFAULT.put("zombie_villager", 2.0D); - COMBAT_EXPERIENCE_DEFAULT.put("skeleton_horse", 1.0D); - COMBAT_EXPERIENCE_DEFAULT.put("zombie_horse", 1.2D); - COMBAT_EXPERIENCE_DEFAULT.put("husk", 3.0D); - COMBAT_EXPERIENCE_DEFAULT.put("evoker", 3.0D); - COMBAT_EXPERIENCE_DEFAULT.put("polar_bear", 2.0D); - COMBAT_EXPERIENCE_DEFAULT.put("llama", 1.0D); - COMBAT_EXPERIENCE_DEFAULT.put("vindicator", 3.0D); - COMBAT_EXPERIENCE_DEFAULT.put("stray", 2.0D); - COMBAT_EXPERIENCE_DEFAULT.put("rabbit", 1.0D); - COMBAT_EXPERIENCE_DEFAULT.put("chicken", 1.0D); - COMBAT_EXPERIENCE_DEFAULT.put("bat", 1.0D); - COMBAT_EXPERIENCE_DEFAULT.put("mushroom_cow", 1.2D); - COMBAT_EXPERIENCE_DEFAULT.put("cow", 1.0D); - COMBAT_EXPERIENCE_DEFAULT.put("turtle", 1.0D); - COMBAT_EXPERIENCE_DEFAULT.put("sheep", 1.0D); - COMBAT_EXPERIENCE_DEFAULT.put("pig", 1.0D); - COMBAT_EXPERIENCE_DEFAULT.put("squid", 1.0D); - COMBAT_EXPERIENCE_DEFAULT.put("ocelot", 1.0D); - COMBAT_EXPERIENCE_DEFAULT.put("villager", 1.0D); - COMBAT_EXPERIENCE_DEFAULT.put("snowman", 0.0D); - COMBAT_EXPERIENCE_DEFAULT.put("parrot", 1.0D); - COMBAT_EXPERIENCE_DEFAULT.put("illusioner", 1.0D); - COMBAT_EXPERIENCE_DEFAULT.put("drowned", 1.0D); - COMBAT_EXPERIENCE_DEFAULT.put("dolphin", 1.0D); - COMBAT_EXPERIENCE_DEFAULT.put("phantom", 4.0D); + COMBAT_EXPERIENCE_DEFAULT.put("creeper", 4.0F); + COMBAT_EXPERIENCE_DEFAULT.put("cat", 1.0F); + COMBAT_EXPERIENCE_DEFAULT.put("fox", 1.0F); + COMBAT_EXPERIENCE_DEFAULT.put("panda", 1.0F); + COMBAT_EXPERIENCE_DEFAULT.put("pillager", 2.0F); + COMBAT_EXPERIENCE_DEFAULT.put("ravager", 4.0F); + COMBAT_EXPERIENCE_DEFAULT.put("trader_llama", 1.0F); + COMBAT_EXPERIENCE_DEFAULT.put("skeleton", 3.0F); + COMBAT_EXPERIENCE_DEFAULT.put("spider", 2.0F); + COMBAT_EXPERIENCE_DEFAULT.put("giant", 4.0F); + COMBAT_EXPERIENCE_DEFAULT.put("zombie", 2.0F); + COMBAT_EXPERIENCE_DEFAULT.put("slime", 2.0F); + COMBAT_EXPERIENCE_DEFAULT.put("ghast", 3.0F); + COMBAT_EXPERIENCE_DEFAULT.put("pig_zombie", 3.0F); + COMBAT_EXPERIENCE_DEFAULT.put("enderman", 1.0F); + COMBAT_EXPERIENCE_DEFAULT.put("cave_spider", 3.0F); + COMBAT_EXPERIENCE_DEFAULT.put("silverfish", 3.0F); + COMBAT_EXPERIENCE_DEFAULT.put("blaze", 3.0F); + COMBAT_EXPERIENCE_DEFAULT.put("magma_cube", 2.0F); + COMBAT_EXPERIENCE_DEFAULT.put("ender_dragon", 1.0F); + COMBAT_EXPERIENCE_DEFAULT.put("wither", 1.0F); + COMBAT_EXPERIENCE_DEFAULT.put("witch", 0.1F); + COMBAT_EXPERIENCE_DEFAULT.put("iron_golem", 2.0F); + COMBAT_EXPERIENCE_DEFAULT.put("wither_skeleton", 4.0F); + COMBAT_EXPERIENCE_DEFAULT.put("endermite", 2.0F); + COMBAT_EXPERIENCE_DEFAULT.put("guardian", 3.0F); + COMBAT_EXPERIENCE_DEFAULT.put("elder_guardian", 4.0F); + COMBAT_EXPERIENCE_DEFAULT.put("shulker", 2.0F); + COMBAT_EXPERIENCE_DEFAULT.put("donkey", 1.0F); + COMBAT_EXPERIENCE_DEFAULT.put("mule", 1.0F); + COMBAT_EXPERIENCE_DEFAULT.put("horse", 1.0F); + COMBAT_EXPERIENCE_DEFAULT.put("zombie_villager", 2.0F); + COMBAT_EXPERIENCE_DEFAULT.put("skeleton_horse", 1.0F); + COMBAT_EXPERIENCE_DEFAULT.put("zombie_horse", 1.2F); + COMBAT_EXPERIENCE_DEFAULT.put("husk", 3.0F); + COMBAT_EXPERIENCE_DEFAULT.put("evoker", 3.0F); + COMBAT_EXPERIENCE_DEFAULT.put("polar_bear", 2.0F); + COMBAT_EXPERIENCE_DEFAULT.put("llama", 1.0F); + COMBAT_EXPERIENCE_DEFAULT.put("vindicator", 3.0F); + COMBAT_EXPERIENCE_DEFAULT.put("stray", 2.0F); + COMBAT_EXPERIENCE_DEFAULT.put("rabbit", 1.0F); + COMBAT_EXPERIENCE_DEFAULT.put("chicken", 1.0F); + COMBAT_EXPERIENCE_DEFAULT.put("bat", 1.0F); + COMBAT_EXPERIENCE_DEFAULT.put("mushroom_cow", 1.2F); + COMBAT_EXPERIENCE_DEFAULT.put("cow", 1.0F); + COMBAT_EXPERIENCE_DEFAULT.put("turtle", 1.0F); + COMBAT_EXPERIENCE_DEFAULT.put("sheep", 1.0F); + COMBAT_EXPERIENCE_DEFAULT.put("pig", 1.0F); + COMBAT_EXPERIENCE_DEFAULT.put("squid", 1.0F); + COMBAT_EXPERIENCE_DEFAULT.put("ocelot", 1.0F); + COMBAT_EXPERIENCE_DEFAULT.put("villager", 1.0F); + COMBAT_EXPERIENCE_DEFAULT.put("snowman", 0.0F); + COMBAT_EXPERIENCE_DEFAULT.put("parrot", 1.0F); + COMBAT_EXPERIENCE_DEFAULT.put("illusioner", 1.0F); + COMBAT_EXPERIENCE_DEFAULT.put("drowned", 1.0F); + COMBAT_EXPERIENCE_DEFAULT.put("dolphin", 1.0F); + COMBAT_EXPERIENCE_DEFAULT.put("phantom", 4.0F); //SPECIAL SPECIAL_COMBAT_EXPERIENCE_DEFAULT = new HashMap<>(); - SPECIAL_COMBAT_EXPERIENCE_DEFAULT.put("animals", 1.0D); //TODO: this seems like a dumb config option - SPECIAL_COMBAT_EXPERIENCE_DEFAULT.put("spawned", 0.0D); - SPECIAL_COMBAT_EXPERIENCE_DEFAULT.put("pvp", 1.0D); - SPECIAL_COMBAT_EXPERIENCE_DEFAULT.put("player-bred-mobs", 1.0D); + SPECIAL_COMBAT_EXPERIENCE_DEFAULT.put("animals", 1.0F); //TODO: this seems like a dumb config option + SPECIAL_COMBAT_EXPERIENCE_DEFAULT.put("spawned", 0.0F); + SPECIAL_COMBAT_EXPERIENCE_DEFAULT.put("pvp", 1.0F); + SPECIAL_COMBAT_EXPERIENCE_DEFAULT.put("player-bred-mobs", 1.0F); } @Setting(value = "Combat-XP-Multipliers") - private HashMap combatExperienceMap = COMBAT_EXPERIENCE_DEFAULT; + private HashMap combatExperienceMap = COMBAT_EXPERIENCE_DEFAULT; @Setting(value = "Special-Combat-XP-Multipliers") - private HashMap specialCombatExperienceMap = SPECIAL_COMBAT_EXPERIENCE_DEFAULT; + private HashMap specialCombatExperienceMap = SPECIAL_COMBAT_EXPERIENCE_DEFAULT; @Setting(value = "PVP-XP", comment = "If true, players will gain XP from PVP interactions." + "\nBe careful turning this on as this can potentially allow for unwanted behaviour from players." + @@ -96,23 +96,27 @@ public class ConfigExperienceCombat { return pvpXPEnabled; } - public HashMap getCombatExperienceMap() { + public HashMap getCombatExperienceMap() { return combatExperienceMap; } - public double getSpawnedMobXPMult() { + public float getSpawnedMobXPMult() { return specialCombatExperienceMap.get("mobspawners"); } - public double getPVPXPMult() { + public float getPVPXPMult() { return specialCombatExperienceMap.get("pvp"); } - public double getAnimalsXPMult() { + public float getAnimalsXPMult() { return specialCombatExperienceMap.get("animals"); } - public double getPlayerBredMobsXPMult() { + public float getPlayerBredMobsXPMult() { return specialCombatExperienceMap.get("player-bred-mobs"); } + + public HashMap getSpecialCombatExperienceMap() { + return specialCombatExperienceMap; + } } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceRepair.java b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceRepair.java index 30315d5cc..eb92e7f8d 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceRepair.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceRepair.java @@ -9,26 +9,26 @@ import java.util.HashMap; @ConfigSerializable public class ConfigExperienceRepair { - private static final double REPAIR_XP_BASE_DEFAULT = 1000.0D; + private static final float REPAIR_XP_BASE_DEFAULT = 1000.0F; - private static final HashMap ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT; + private static final HashMap ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT; static { ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT = new HashMap<>(); - ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.WOOD.toString(), 0.6D); - ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.STONE.toString(), 1.3D); - ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.IRON.toString(), 2.5D); - ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.GOLD.toString(), 0.3D); - ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.DIAMOND.toString(), 5.0D); - ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.LEATHER.toString(), 1.6D); - ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.STRING.toString(), 1.8D); - ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.OTHER.toString(), 1.5D); + ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.WOOD.toString(), 0.6F); + ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.STONE.toString(), 1.3F); + ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.IRON.toString(), 2.5F); + ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.GOLD.toString(), 0.3F); + ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.DIAMOND.toString(), 5.0F); + ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.LEATHER.toString(), 1.6F); + ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.STRING.toString(), 1.8F); + ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.OTHER.toString(), 1.5F); } @Setting(value = "Item-Material-Category-XP-Multiplier", comment = "The material of your item is determined by mcMMO and used to influence XP, " + "if your Item doesn't fit into a known category it will use OTHER." + "\nFor the most part, items belong to categories of materials that they are made out of.") - private HashMap itemMaterialXPMultiplier = ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT; + private HashMap itemMaterialXPMultiplier = ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT; @Setting(value = "Repair-XP-Base", comment = "The base amount of XP for repairing an item." + "\nThe repair XP formula is a simple multiplication of these 4 values in this order" + @@ -37,13 +37,13 @@ public class ConfigExperienceRepair { "\nThe Base Repair XP defined here (default 1000.0)" + "\nAnd finally, the XP multiplier of the item material category defined in this config." + "\nDefault value: " + REPAIR_XP_BASE_DEFAULT) - private double repairXPBase = REPAIR_XP_BASE_DEFAULT; + private Float repairXPBase = REPAIR_XP_BASE_DEFAULT; - public HashMap getItemMaterialXPMultiplier() { + public HashMap getItemMaterialXPMultiplier() { return itemMaterialXPMultiplier; } - public double getRepairXPBase() { + public Float getRepairXPBase() { return repairXPBase; } } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceSkills.java b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceSkills.java index d096973c8..8993cd0bc 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceSkills.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceSkills.java @@ -47,7 +47,7 @@ public class ConfigExperienceSkills { * BOILER PLATE GETTERS */ - public double getPlayerBredMobsXPMult() { + public Float getPlayerBredMobsXPMult() { return experienceCombat.getPlayerBredMobsXPMult(); } @@ -111,11 +111,11 @@ public class ConfigExperienceSkills { return experienceSmelting.getSmeltingExperienceMap(); } - public HashMap getItemMaterialXPMultiplier() { + public HashMap getItemMaterialXPMultiplier() { return experienceRepair.getItemMaterialXPMultiplier(); } - public double getRepairXPBase() { + public Float getRepairXPBase() { return experienceRepair.getRepairXPBase(); } @@ -123,7 +123,7 @@ public class ConfigExperienceSkills { return experienceAcrobatics.getAcrobaticsXPMap(); } - public Double getFeatherFallMultiplier() { + public Float getFeatherFallMultiplier() { return experienceAcrobatics.getFeatherFallMultiplier(); } @@ -167,11 +167,15 @@ public class ConfigExperienceSkills { return experienceCombat.isPvpXPEnabled(); } - public HashMap getCombatExperienceMap() { + public HashMap getCombatExperienceMap() { return experienceCombat.getCombatExperienceMap(); } - public double getDistanceMultiplier() { + public HashMap getSpecialCombatExperienceMap() { + return experienceCombat.getSpecialCombatExperienceMap(); + } + + public Float getDistanceMultiplier() { return experienceArchery.getDistanceMultiplier(); } @@ -195,15 +199,15 @@ public class ConfigExperienceSkills { return experienceFishing.getShakeXP(); } - public double getSpawnedMobXPMult() { + public Float getSpawnedMobXPMult() { return experienceCombat.getSpawnedMobXPMult(); } - public double getPVPXPMult() { + public Float getPVPXPMult() { return experienceCombat.getPVPXPMult(); } - public double getAnimalsXPMult() { + public Float getAnimalsXPMult() { return experienceCombat.getAnimalsXPMult(); } } diff --git a/src/main/java/com/gmail/nossr50/util/experience/ExperienceMapManager.java b/src/main/java/com/gmail/nossr50/util/experience/ExperienceMapManager.java index 193bc6937..08331c164 100644 --- a/src/main/java/com/gmail/nossr50/util/experience/ExperienceMapManager.java +++ b/src/main/java/com/gmail/nossr50/util/experience/ExperienceMapManager.java @@ -19,18 +19,56 @@ public class ExperienceMapManager implements Unload { private HashMap woodcuttingFullyQualifiedBlockXpMap; private HashMap excavationFullyQualifiedBlockXpMap; private HashMap tamingExperienceMap; + private HashMap combatXPMultiplierMap; + private HashMap specialCombatXPMultiplierMap; //Applies to "groups" of things for convenience private double globalXpMult; public ExperienceMapManager() { + initExperienceMaps(); + + //Register with unloader + mcMMO.getConfigManager().registerUnloadable(this); + } + + private void initExperienceMaps() { miningFullyQualifiedBlockXpMap = new HashMap<>(); herbalismFullyQualifiedBlockXpMap = new HashMap<>(); woodcuttingFullyQualifiedBlockXpMap = new HashMap<>(); excavationFullyQualifiedBlockXpMap = new HashMap<>(); + combatXPMultiplierMap = new HashMap<>(); + specialCombatXPMultiplierMap = new HashMap<>(); tamingExperienceMap = new HashMap<>(); + } - //Register with unloader - mcMMO.getConfigManager().registerUnloadable(this); + /** + * Fills the combat XP multiplier map with values from a platform generic map + * Platform safe map, is just a map which uses strings to define target entities/etc + * Platform safe maps are converted to ENUMs for the platform for convenience + * @param platformSafeMap the platform safe map + */ + public void fillCombatXPMultiplierMap(HashMap platformSafeMap) { + for(String entityString : platformSafeMap.keySet()) + { + //Iterate over all EntityType(s) + for(EntityType type : EntityType.values()) + { + //Match ignoring case + if(entityString.equalsIgnoreCase(entityString)) + { + //Check for duplicates and warn the admin + if(combatXPMultiplierMap.containsKey(entityString)) + { + mcMMO.p.getLogger().severe("Entity named "+entityString+" has multiple values in the combat experience config!"); + } + //Match found + combatXPMultiplierMap.put(type, platformSafeMap.get(entityString)); + } else { + //Log an error so the admin can deal with figuring it out + mcMMO.p.getLogger().severe("No entity could be matched for the combat experience config value named - "+entityString); + } + } + } } /**