Wire up Repair XP values

This commit is contained in:
nossr50 2019-05-13 05:31:34 -07:00
parent 591c9e67a3
commit ab4b4edb1a
4 changed files with 20 additions and 18 deletions

View File

@ -2,6 +2,7 @@ package com.gmail.nossr50.config.hocon.experience;
import com.gmail.nossr50.datatypes.experience.CustomXPPerk; import com.gmail.nossr50.datatypes.experience.CustomXPPerk;
import com.gmail.nossr50.datatypes.experience.SpecialXPKey; import com.gmail.nossr50.datatypes.experience.SpecialXPKey;
import com.gmail.nossr50.datatypes.skills.ItemMaterialCategory;
import ninja.leaping.configurate.objectmapping.Setting; import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -103,8 +104,8 @@ public class ConfigExperience {
return getConfigExperienceSkills().getSmeltingExperienceMap(); return getConfigExperienceSkills().getSmeltingExperienceMap();
} }
public HashMap<String, Float> getItemMaterialXPMultiplier() { public float getItemMaterialXPMultiplier(ItemMaterialCategory itemMaterialCategory) {
return getConfigExperienceSkills().getItemMaterialXPMultiplier(); return getConfigExperienceSkills().getItemMaterialXPMultiplier(itemMaterialCategory);
} }
public Float getRepairXPBase() { public Float getRepairXPBase() {

View File

@ -11,24 +11,24 @@ public class ConfigExperienceRepair {
private static final float REPAIR_XP_BASE_DEFAULT = 1000.0F; private static final float REPAIR_XP_BASE_DEFAULT = 1000.0F;
private static final HashMap<String, Float> ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT; private static final HashMap<ItemMaterialCategory, Float> ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT;
static { static {
ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT = new HashMap<>(); ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT = new HashMap<>();
ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.WOOD.toString(), 0.6F); ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.WOOD, 0.6F);
ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.STONE.toString(), 1.3F); ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.STONE, 1.3F);
ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.IRON.toString(), 2.5F); ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.IRON, 2.5F);
ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.GOLD.toString(), 0.3F); ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.GOLD, 0.3F);
ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.DIAMOND.toString(), 5.0F); ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.DIAMOND, 5.0F);
ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.LEATHER.toString(), 1.6F); ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.LEATHER, 1.6F);
ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.STRING.toString(), 1.8F); ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.STRING, 1.8F);
ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.OTHER.toString(), 1.5F); ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.OTHER, 1.5F);
} }
@Setting(value = "Item-Material-Category-XP-Multiplier", comment = "The material of your item is determined by mcMMO and used to influence XP, " + @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." + "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.") "\nFor the most part, items belong to categories of materials that they are made out of.")
private HashMap<String, Float> itemMaterialXPMultiplier = ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT; private HashMap<ItemMaterialCategory, Float> itemMaterialXPMultiplier = ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT;
@Setting(value = "Repair-XP-Base", comment = "The base amount of XP for repairing an item." + @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" + "\nThe repair XP formula is a simple multiplication of these 4 values in this order" +
@ -39,8 +39,8 @@ public class ConfigExperienceRepair {
"\nDefault value: " + REPAIR_XP_BASE_DEFAULT) "\nDefault value: " + REPAIR_XP_BASE_DEFAULT)
private Float repairXPBase = REPAIR_XP_BASE_DEFAULT; private Float repairXPBase = REPAIR_XP_BASE_DEFAULT;
public HashMap<String, Float> getItemMaterialXPMultiplier() { public float getItemMaterialXPMultiplier(ItemMaterialCategory itemMaterialCategory) {
return itemMaterialXPMultiplier; return itemMaterialXPMultiplier.get(itemMaterialCategory);
} }
public Float getRepairXPBase() { public Float getRepairXPBase() {

View File

@ -1,6 +1,7 @@
package com.gmail.nossr50.config.hocon.experience; package com.gmail.nossr50.config.hocon.experience;
import com.gmail.nossr50.datatypes.experience.SpecialXPKey; import com.gmail.nossr50.datatypes.experience.SpecialXPKey;
import com.gmail.nossr50.datatypes.skills.ItemMaterialCategory;
import ninja.leaping.configurate.objectmapping.Setting; import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -108,8 +109,8 @@ public class ConfigExperienceSkills {
return experienceSmelting.getSmeltingExperienceMap(); return experienceSmelting.getSmeltingExperienceMap();
} }
public HashMap<String, Float> getItemMaterialXPMultiplier() { public float getItemMaterialXPMultiplier(ItemMaterialCategory itemMaterialCategory) {
return experienceRepair.getItemMaterialXPMultiplier(); return experienceRepair.getItemMaterialXPMultiplier(itemMaterialCategory);
} }
public float getRepairXPBase() { public float getRepairXPBase() {

View File

@ -176,8 +176,8 @@ public class RepairManager extends SkillManager {
// Give out XP like candy // Give out XP like candy
applyXpGain((float) ((getPercentageRepaired(startDurability, newDurability, repairable.getMaximumDurability()) applyXpGain((float) ((getPercentageRepaired(startDurability, newDurability, repairable.getMaximumDurability())
* repairable.getXpMultiplier()) * repairable.getXpMultiplier())
* ExperienceConfig.getInstance().getRepairXPBase() * mcMMO.getConfigManager().getConfigExperience().getRepairXPBase())
* ExperienceConfig.getInstance().getRepairXP(repairable.getRepairItemMaterialCategory())), XPGainReason.PVE); * mcMMO.getConfigManager().getConfigExperience().getExperienceRepair().getItemMaterialXPMultiplier(repairable.getRepairItemMaterialCategory()), XPGainReason.PVE);
// BWONG BWONG BWONG // BWONG BWONG BWONG
if (mcMMO.getConfigManager().getConfigRepair().getRepairGeneral().isAnvilUseSounds()) { if (mcMMO.getConfigManager().getConfigRepair().getRepairGeneral().isAnvilUseSounds()) {