mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Numerous tweaks to salvage + fixing repair bugs
This commit is contained in:
parent
8e67e2d158
commit
46dee3c9b6
@ -1,3 +1,28 @@
|
|||||||
|
Version 2.1.76
|
||||||
|
Fixed a bug where Repair was repairing too much
|
||||||
|
Fixed a bug where Arcane Salvage was used to determine how many materials a player could salvage from an item
|
||||||
|
Removed the minimum quantity field from the repair config
|
||||||
|
Removed the item data (metadata) field from repair config as its not used anymore
|
||||||
|
Salvage will no longer return the max amount of materials possible, instead you are guaranteed one item and then some luck is involved on how many items are returned.
|
||||||
|
Advanced Salvage has been renamed to Scrap Collector
|
||||||
|
Updated Chinese locale (thanks to the user named 89009332 from github)
|
||||||
|
|
||||||
|
New locale strings
|
||||||
|
Salvage.Skills.Lottery.Normal
|
||||||
|
Salvage.Skills.Lottery.Perfect
|
||||||
|
Salvage.Skills.Lottery.Untrained
|
||||||
|
Salvage.SubSkill.ScrapCollector.Name
|
||||||
|
Salvage.SubSkill.ScrapCollector.Description
|
||||||
|
Salvage.SubSkill.ScrapCollector.Stat
|
||||||
|
|
||||||
|
(API) SALVAGE_ARCANE_SALVAGE in SubSkillTypes has been renamed to SALVAGE_SCRAP_COLLECTOR
|
||||||
|
|
||||||
|
NOTES:
|
||||||
|
You do not need to update your configs for this update.
|
||||||
|
How Salvage works
|
||||||
|
If you have enough skill to gain up to 5 items from salvaging something, and that item has enough durability to yield up to 5 materials, salvage will play out like this
|
||||||
|
First off, you will be guaranteed 1 material, after this you have 80% chance to get the next material, if successful, another dice roll is conducted but lowers your odds by 20%, you chance to succeed will never fall below 33%
|
||||||
|
|
||||||
Version 2.1.75
|
Version 2.1.75
|
||||||
Fixed a bug that prevented Fortune from working correctly if a Double Drop was triggered
|
Fixed a bug that prevented Fortune from working correctly if a Double Drop was triggered
|
||||||
|
|
||||||
|
2
pom.xml
2
pom.xml
@ -2,7 +2,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||||
<artifactId>mcMMO</artifactId>
|
<artifactId>mcMMO</artifactId>
|
||||||
<version>2.1.75</version>
|
<version>2.1.76-SNAPSHOT</version>
|
||||||
<name>mcMMO</name>
|
<name>mcMMO</name>
|
||||||
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
||||||
<scm>
|
<scm>
|
||||||
|
@ -15,7 +15,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class SalvageCommand extends SkillCommand {
|
public class SalvageCommand extends SkillCommand {
|
||||||
private boolean canAdvancedSalvage;
|
private boolean canScrapCollector;
|
||||||
private boolean canArcaneSalvage;
|
private boolean canArcaneSalvage;
|
||||||
|
|
||||||
public SalvageCommand() {
|
public SalvageCommand() {
|
||||||
@ -30,7 +30,7 @@ public class SalvageCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void permissionsCheck(Player player) {
|
protected void permissionsCheck(Player player) {
|
||||||
canAdvancedSalvage = canUseSubskill(player, SubSkillType.SALVAGE_ADVANCED_SALVAGE);
|
canScrapCollector = canUseSubskill(player, SubSkillType.SALVAGE_SCRAP_COLLECTOR);
|
||||||
canArcaneSalvage = canUseSubskill(player, SubSkillType.SALVAGE_ARCANE_SALVAGE);
|
canArcaneSalvage = canUseSubskill(player, SubSkillType.SALVAGE_ARCANE_SALVAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,9 +39,11 @@ public class SalvageCommand extends SkillCommand {
|
|||||||
List<String> messages = new ArrayList<String>();
|
List<String> messages = new ArrayList<String>();
|
||||||
SalvageManager salvageManager = UserManager.getPlayer(player).getSalvageManager();
|
SalvageManager salvageManager = UserManager.getPlayer(player).getSalvageManager();
|
||||||
|
|
||||||
if (canAdvancedSalvage) {
|
if (canScrapCollector) {
|
||||||
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Salvage.Ability.Bonus.0"),
|
messages.add(getStatMessage(false, true,
|
||||||
LocaleLoader.getString("Salvage.Ability.Bonus.1", salvageManager.getSalvageableAmount())));
|
SubSkillType.SALVAGE_SCRAP_COLLECTOR,
|
||||||
|
String.valueOf(RankUtils.getRank(player, SubSkillType.REPAIR_ARCANE_FORGING)),
|
||||||
|
RankUtils.getHighestRankStr(SubSkillType.REPAIR_ARCANE_FORGING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canArcaneSalvage) {
|
if (canArcaneSalvage) {
|
||||||
|
@ -5,10 +5,8 @@ import com.gmail.nossr50.datatypes.skills.ItemType;
|
|||||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -77,13 +75,6 @@ public class CustomArmorConfig extends ConfigLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (repairable) {
|
if (repairable) {
|
||||||
byte repairData = (byte) config.getInt(armorType + "." + armorName + ".Repair_Material_Data_Value", -1);
|
|
||||||
int repairQuantity = SkillUtils.getRepairAndSalvageQuantities(new ItemStack(armorMaterial), repairMaterial, repairData);
|
|
||||||
|
|
||||||
if (repairQuantity == 0) {
|
|
||||||
repairQuantity = config.getInt(armorType + "." + armorName + ".Repair_Material_Quantity", 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
String repairItemName = config.getString(armorType + "." + armorName + ".Repair_Material_Pretty_Name");
|
String repairItemName = config.getString(armorType + "." + armorName + ".Repair_Material_Pretty_Name");
|
||||||
int repairMinimumLevel = config.getInt(armorType + "." + armorName + ".Repair_MinimumLevel", 0);
|
int repairMinimumLevel = config.getInt(armorType + "." + armorName + ".Repair_MinimumLevel", 0);
|
||||||
double repairXpMultiplier = config.getDouble(armorType + "." + armorName + ".Repair_XpMultiplier", 1);
|
double repairXpMultiplier = config.getDouble(armorType + "." + armorName + ".Repair_XpMultiplier", 1);
|
||||||
@ -94,7 +85,7 @@ public class CustomArmorConfig extends ConfigLoader {
|
|||||||
durability = (short) config.getInt(armorType + "." + armorName + ".Durability", 70);
|
durability = (short) config.getInt(armorType + "." + armorName + ".Durability", 70);
|
||||||
}
|
}
|
||||||
|
|
||||||
repairables.add(RepairableFactory.getRepairable(armorMaterial, repairMaterial, repairData, repairItemName, repairMinimumLevel, repairQuantity, durability, ItemType.ARMOR, MaterialType.OTHER, repairXpMultiplier));
|
repairables.add(RepairableFactory.getRepairable(armorMaterial, repairMaterial, repairItemName, repairMinimumLevel, durability, ItemType.ARMOR, MaterialType.OTHER, repairXpMultiplier));
|
||||||
}
|
}
|
||||||
|
|
||||||
materialList.add(armorMaterial);
|
materialList.add(armorMaterial);
|
||||||
|
@ -6,10 +6,8 @@ import com.gmail.nossr50.datatypes.skills.ItemType;
|
|||||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -85,13 +83,6 @@ public class CustomToolConfig extends ConfigLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (repairable) {
|
if (repairable) {
|
||||||
byte repairData = (byte) config.getInt(toolType + "." + toolName + ".Repair_Material_Data_Value", -1);
|
|
||||||
int repairQuantity = SkillUtils.getRepairAndSalvageQuantities(new ItemStack(toolMaterial), repairMaterial, repairData);
|
|
||||||
|
|
||||||
if (repairQuantity == 0) {
|
|
||||||
repairQuantity = config.getInt(toolType + "." + toolName + ".Repair_Material_Quantity", 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
String repairItemName = config.getString(toolType + "." + toolName + ".Repair_Material_Pretty_Name");
|
String repairItemName = config.getString(toolType + "." + toolName + ".Repair_Material_Pretty_Name");
|
||||||
int repairMinimumLevel = config.getInt(toolType + "." + toolName + ".Repair_MinimumLevel", 0);
|
int repairMinimumLevel = config.getInt(toolType + "." + toolName + ".Repair_MinimumLevel", 0);
|
||||||
double repairXpMultiplier = config.getDouble(toolType + "." + toolName + ".Repair_XpMultiplier", 1);
|
double repairXpMultiplier = config.getDouble(toolType + "." + toolName + ".Repair_XpMultiplier", 1);
|
||||||
@ -102,7 +93,7 @@ public class CustomToolConfig extends ConfigLoader {
|
|||||||
durability = (short) config.getInt(toolType + "." + toolName + ".Durability", 60);
|
durability = (short) config.getInt(toolType + "." + toolName + ".Durability", 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
repairables.add(RepairableFactory.getRepairable(toolMaterial, repairMaterial, repairData, repairItemName, repairMinimumLevel, repairQuantity, durability, ItemType.TOOL, MaterialType.OTHER, repairXpMultiplier));
|
repairables.add(RepairableFactory.getRepairable(toolMaterial, repairMaterial, repairItemName, repairMinimumLevel, durability, ItemType.TOOL, MaterialType.OTHER, repairXpMultiplier));
|
||||||
}
|
}
|
||||||
|
|
||||||
double multiplier = config.getDouble(toolType + "." + toolName + ".XP_Modifier", 1.0);
|
double multiplier = config.getDouble(toolType + "." + toolName + ".XP_Modifier", 1.0);
|
||||||
|
@ -6,7 +6,6 @@ import com.gmail.nossr50.datatypes.skills.MaterialType;
|
|||||||
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
||||||
import com.gmail.nossr50.util.ItemUtils;
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -126,7 +125,6 @@ public class RepairConfig extends ConfigLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
byte repairMetadata = (byte) config.getInt("Repairables." + key + ".RepairMaterialMetadata", -1);
|
|
||||||
int minimumLevel = config.getInt("Repairables." + key + ".MinimumLevel");
|
int minimumLevel = config.getInt("Repairables." + key + ".MinimumLevel");
|
||||||
double xpMultiplier = config.getDouble("Repairables." + key + ".XpMultiplier", 1);
|
double xpMultiplier = config.getDouble("Repairables." + key + ".XpMultiplier", 1);
|
||||||
|
|
||||||
@ -134,19 +132,8 @@ public class RepairConfig extends ConfigLoader {
|
|||||||
reason.add(key + " has an invalid MinimumLevel of " + minimumLevel);
|
reason.add(key + " has an invalid MinimumLevel of " + minimumLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Minimum Quantity
|
|
||||||
int minimumQuantity = (itemMaterial != null ? SkillUtils.getRepairAndSalvageQuantities(new ItemStack(itemMaterial), repairMaterial, repairMetadata) : config.getInt("Repairables." + key + ".MinimumQuantity", 2));
|
|
||||||
|
|
||||||
if (minimumQuantity <= 0 && itemMaterial != null) {
|
|
||||||
minimumQuantity = config.getInt("Repairables." + key + ".MinimumQuantity", 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (minimumQuantity <= 0) {
|
|
||||||
reason.add("Minimum quantity of " + key + " must be greater than 0!");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (noErrorsInRepairable(reason)) {
|
if (noErrorsInRepairable(reason)) {
|
||||||
Repairable repairable = RepairableFactory.getRepairable(itemMaterial, repairMaterial, repairMetadata, minimumLevel, minimumQuantity, maximumDurability, repairItemType, repairMaterialType, xpMultiplier);
|
Repairable repairable = RepairableFactory.getRepairable(itemMaterial, repairMaterial, minimumLevel, maximumDurability, repairItemType, repairMaterialType, xpMultiplier);
|
||||||
repairables.add(repairable);
|
repairables.add(repairable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,6 @@ public class SalvageConfig extends ConfigLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
byte salvageMetadata = (byte) config.getInt("Salvageables." + key + ".SalvageMaterialMetadata", -1);
|
|
||||||
int minimumLevel = config.getInt("Salvageables." + key + ".MinimumLevel");
|
int minimumLevel = config.getInt("Salvageables." + key + ".MinimumLevel");
|
||||||
double xpMultiplier = config.getDouble("Salvageables." + key + ".XpMultiplier", 1);
|
double xpMultiplier = config.getDouble("Salvageables." + key + ".XpMultiplier", 1);
|
||||||
|
|
||||||
@ -122,7 +121,7 @@ public class SalvageConfig extends ConfigLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Maximum Quantity
|
// Maximum Quantity
|
||||||
int maximumQuantity = (itemMaterial != null ? SkillUtils.getRepairAndSalvageQuantities(new ItemStack(itemMaterial), salvageMaterial, salvageMetadata) : config.getInt("Salvageables." + key + ".MaximumQuantity", 2));
|
int maximumQuantity = (itemMaterial != null ? SkillUtils.getRepairAndSalvageQuantities(itemMaterial, salvageMaterial) : config.getInt("Salvageables." + key + ".MaximumQuantity", 2));
|
||||||
|
|
||||||
if (maximumQuantity <= 0 && itemMaterial != null) {
|
if (maximumQuantity <= 0 && itemMaterial != null) {
|
||||||
maximumQuantity = config.getInt("Salvageables." + key + ".MaximumQuantity", 1);
|
maximumQuantity = config.getInt("Salvageables." + key + ".MaximumQuantity", 1);
|
||||||
@ -139,7 +138,7 @@ public class SalvageConfig extends ConfigLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (noErrorsInSalvageable(reason)) {
|
if (noErrorsInSalvageable(reason)) {
|
||||||
Salvageable salvageable = SalvageableFactory.getSalvageable(itemMaterial, salvageMaterial, salvageMetadata, minimumLevel, maximumQuantity, maximumDurability, salvageItemType, salvageMaterialType, xpMultiplier);
|
Salvageable salvageable = SalvageableFactory.getSalvageable(itemMaterial, salvageMaterial, minimumLevel, maximumQuantity, maximumDurability, salvageItemType, salvageMaterialType, xpMultiplier);
|
||||||
salvageables.add(salvageable);
|
salvageables.add(salvageable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ public enum NotificationType {
|
|||||||
SUPER_ABILITY("SuperAbilityInteraction"),
|
SUPER_ABILITY("SuperAbilityInteraction"),
|
||||||
SUPER_ABILITY_ALERT_OTHERS("SuperAbilityAlertOthers"),
|
SUPER_ABILITY_ALERT_OTHERS("SuperAbilityAlertOthers"),
|
||||||
ITEM_MESSAGE("ItemMessage"),
|
ITEM_MESSAGE("ItemMessage"),
|
||||||
|
CHAT_ONLY("ChatOnly"),
|
||||||
PARTY_MESSAGE("PartyMessage");
|
PARTY_MESSAGE("PartyMessage");
|
||||||
|
|
||||||
final String niceName;
|
final String niceName;
|
||||||
|
@ -53,7 +53,7 @@ public enum PrimarySkillType {
|
|||||||
REPAIR(RepairManager.class, Color.SILVER,
|
REPAIR(RepairManager.class, Color.SILVER,
|
||||||
ImmutableList.of(SubSkillType.REPAIR_ARCANE_FORGING, SubSkillType.REPAIR_REPAIR_MASTERY, SubSkillType.REPAIR_SUPER_REPAIR)),
|
ImmutableList.of(SubSkillType.REPAIR_ARCANE_FORGING, SubSkillType.REPAIR_REPAIR_MASTERY, SubSkillType.REPAIR_SUPER_REPAIR)),
|
||||||
SALVAGE(SalvageManager.class, Color.ORANGE,
|
SALVAGE(SalvageManager.class, Color.ORANGE,
|
||||||
ImmutableList.of(SubSkillType.SALVAGE_ADVANCED_SALVAGE, SubSkillType.SALVAGE_ARCANE_SALVAGE)),
|
ImmutableList.of(SubSkillType.SALVAGE_SCRAP_COLLECTOR, SubSkillType.SALVAGE_ARCANE_SALVAGE)),
|
||||||
SMELTING(SmeltingManager.class, Color.YELLOW,
|
SMELTING(SmeltingManager.class, Color.YELLOW,
|
||||||
ImmutableList.of(SubSkillType.SMELTING_UNDERSTANDING_THE_ART, /*SubSkillType.SMELTING_FLUX_MINING,*/ SubSkillType.SMELTING_FUEL_EFFICIENCY, SubSkillType.SMELTING_SECOND_SMELT)),
|
ImmutableList.of(SubSkillType.SMELTING_UNDERSTANDING_THE_ART, /*SubSkillType.SMELTING_FLUX_MINING,*/ SubSkillType.SMELTING_FUEL_EFFICIENCY, SubSkillType.SMELTING_SECOND_SMELT)),
|
||||||
SWORDS(SwordsManager.class, Color.fromRGB(178, 34, 34), SuperAbilityType.SERRATED_STRIKES, ToolType.SWORD,
|
SWORDS(SwordsManager.class, Color.fromRGB(178, 34, 34), SuperAbilityType.SERRATED_STRIKES, ToolType.SWORD,
|
||||||
|
@ -61,7 +61,7 @@ public enum SubSkillType {
|
|||||||
REPAIR_SUPER_REPAIR(1),
|
REPAIR_SUPER_REPAIR(1),
|
||||||
|
|
||||||
/* Salvage */
|
/* Salvage */
|
||||||
SALVAGE_ADVANCED_SALVAGE(1),
|
SALVAGE_SCRAP_COLLECTOR(8),
|
||||||
SALVAGE_ARCANE_SALVAGE(8),
|
SALVAGE_ARCANE_SALVAGE(8),
|
||||||
|
|
||||||
/* Smelting */
|
/* Smelting */
|
||||||
|
@ -94,7 +94,6 @@ public class RepairManager extends SkillManager {
|
|||||||
PlayerInventory inventory = player.getInventory();
|
PlayerInventory inventory = player.getInventory();
|
||||||
|
|
||||||
Material repairMaterial = repairable.getRepairMaterial();
|
Material repairMaterial = repairable.getRepairMaterial();
|
||||||
byte repairMaterialMetadata = repairable.getRepairMaterialMetadata();
|
|
||||||
ItemStack toRemove = new ItemStack(repairMaterial);
|
ItemStack toRemove = new ItemStack(repairMaterial);
|
||||||
|
|
||||||
short startDurability = item.getDurability();
|
short startDurability = item.getDurability();
|
||||||
@ -111,10 +110,6 @@ public class RepairManager extends SkillManager {
|
|||||||
|
|
||||||
String materialsNeeded = "";
|
String materialsNeeded = "";
|
||||||
|
|
||||||
if (repairMaterialMetadata != (byte) -1 && !inventory.containsAtLeast(toRemove, 1)) {
|
|
||||||
materialsNeeded += ":" + repairMaterialMetadata;
|
|
||||||
}
|
|
||||||
|
|
||||||
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Skills.NeedMore.Extra", prettyName, materialsNeeded);
|
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Skills.NeedMore.Extra", prettyName, materialsNeeded);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -130,7 +125,7 @@ public class RepairManager extends SkillManager {
|
|||||||
|
|
||||||
// Lets get down to business,
|
// Lets get down to business,
|
||||||
// To defeat, the huns.
|
// To defeat, the huns.
|
||||||
int baseRepairAmount = repairable.getBaseRepairDurability(); // Did they send me daughters?
|
int baseRepairAmount = repairable.getBaseRepairDurability(item); // Did they send me daughters?
|
||||||
short newDurability = repairCalculate(startDurability, baseRepairAmount); // When I asked for sons?
|
short newDurability = repairCalculate(startDurability, baseRepairAmount); // When I asked for sons?
|
||||||
|
|
||||||
// Call event
|
// Call event
|
||||||
@ -144,15 +139,16 @@ public class RepairManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove the item
|
// Remove the item
|
||||||
if (repairMaterialMetadata == -1) {
|
toRemove = inventory.getItem(inventory.first(repairMaterial)).clone();
|
||||||
toRemove = inventory.getItem(inventory.first(repairMaterial)).clone();
|
toRemove.setAmount(1);
|
||||||
toRemove.setAmount(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
inventory.removeItem(toRemove);
|
inventory.removeItem(toRemove);
|
||||||
|
|
||||||
// Give out XP like candy
|
// Give out XP like candy
|
||||||
applyXpGain((float) ((getPercentageRepaired(startDurability, newDurability, repairable.getMaximumDurability()) * repairable.getXpMultiplier()) * ExperienceConfig.getInstance().getRepairXPBase() * ExperienceConfig.getInstance().getRepairXP(repairable.getRepairMaterialType())), XPGainReason.PVE);
|
applyXpGain((float) ((getPercentageRepaired(startDurability, newDurability, repairable.getMaximumDurability())
|
||||||
|
* repairable.getXpMultiplier())
|
||||||
|
* ExperienceConfig.getInstance().getRepairXPBase()
|
||||||
|
* ExperienceConfig.getInstance().getRepairXP(repairable.getRepairMaterialType())), XPGainReason.PVE);
|
||||||
|
|
||||||
// BWONG BWONG BWONG
|
// BWONG BWONG BWONG
|
||||||
if (Config.getInstance().getRepairAnvilUseSoundsEnabled()) {
|
if (Config.getInstance().getRepairAnvilUseSoundsEnabled()) {
|
||||||
|
@ -3,6 +3,7 @@ package com.gmail.nossr50.skills.repair.repairables;
|
|||||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
|
||||||
public interface Repairable {
|
public interface Repairable {
|
||||||
@ -20,13 +21,6 @@ public interface Repairable {
|
|||||||
*/
|
*/
|
||||||
public Material getRepairMaterial();
|
public Material getRepairMaterial();
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the metadata byte value of the material used to repair this item
|
|
||||||
*
|
|
||||||
* @return the byte metadata of the repair material
|
|
||||||
*/
|
|
||||||
public byte getRepairMaterialMetadata();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the pretty name of the material used to repair this item
|
* Gets the pretty name of the material used to repair this item
|
||||||
*
|
*
|
||||||
@ -71,7 +65,7 @@ public interface Repairable {
|
|||||||
*
|
*
|
||||||
* @return the base repair durability
|
* @return the base repair durability
|
||||||
*/
|
*/
|
||||||
public short getBaseRepairDurability();
|
public short getBaseRepairDurability(ItemStack itemStack);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the minimum repair level needed to repair this item
|
* Gets the minimum repair level needed to repair this item
|
||||||
|
@ -6,16 +6,16 @@ import org.bukkit.Material;
|
|||||||
|
|
||||||
|
|
||||||
public class RepairableFactory {
|
public class RepairableFactory {
|
||||||
public static Repairable getRepairable(Material itemMaterial, Material repairMaterial, byte repairMetadata, int minimumQuantity, short maximumDurability) {
|
public static Repairable getRepairable(Material itemMaterial, Material repairMaterial, short maximumDurability) {
|
||||||
return getRepairable(itemMaterial, repairMaterial, repairMetadata, null, 0, minimumQuantity, maximumDurability, ItemType.OTHER, MaterialType.OTHER, 1);
|
return getRepairable(itemMaterial, repairMaterial, null, 0, maximumDurability, ItemType.OTHER, MaterialType.OTHER, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Repairable getRepairable(Material itemMaterial, Material repairMaterial, byte repairMetadata, int minimumLevel, int minimumQuantity, short maximumDurability, ItemType repairItemType, MaterialType repairMaterialType, double xpMultiplier) {
|
public static Repairable getRepairable(Material itemMaterial, Material repairMaterial, int minimumLevel, short maximumDurability, ItemType repairItemType, MaterialType repairMaterialType, double xpMultiplier) {
|
||||||
return getRepairable(itemMaterial, repairMaterial, repairMetadata, null, minimumLevel, minimumQuantity, maximumDurability, repairItemType, repairMaterialType, xpMultiplier);
|
return getRepairable(itemMaterial, repairMaterial, null, minimumLevel, maximumDurability, repairItemType, repairMaterialType, xpMultiplier);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Repairable getRepairable(Material itemMaterial, Material repairMaterial, byte repairMetadata, String repairMaterialPrettyName, int minimumLevel, int minimumQuantity, short maximumDurability, ItemType repairItemType, MaterialType repairMaterialType, double xpMultiplier) {
|
public static Repairable getRepairable(Material itemMaterial, Material repairMaterial, String repairMaterialPrettyName, int minimumLevel, short maximumDurability, ItemType repairItemType, MaterialType repairMaterialType, double xpMultiplier) {
|
||||||
// TODO: Add in loading from config what type of repairable we want.
|
// TODO: Add in loading from config what type of repairable we want.
|
||||||
return new SimpleRepairable(itemMaterial, repairMaterial, repairMetadata, repairMaterialPrettyName, minimumLevel, minimumQuantity, maximumDurability, repairItemType, repairMaterialType, xpMultiplier);
|
return new SimpleRepairable(itemMaterial, repairMaterial, repairMaterialPrettyName, minimumLevel, maximumDurability, repairItemType, repairMaterialType, xpMultiplier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,30 +2,28 @@ package com.gmail.nossr50.skills.repair.repairables;
|
|||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||||
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
|
||||||
public class SimpleRepairable implements Repairable {
|
public class SimpleRepairable implements Repairable {
|
||||||
private final Material itemMaterial, repairMaterial;
|
private final Material itemMaterial, repairMaterial;
|
||||||
private final int minimumQuantity, minimumLevel;
|
private final int minimumLevel;
|
||||||
private final short maximumDurability, baseRepairDurability;
|
private final short maximumDurability;
|
||||||
private final byte repairMetadata;
|
|
||||||
private String repairMaterialPrettyName;
|
private String repairMaterialPrettyName;
|
||||||
private final ItemType repairItemType;
|
private final ItemType repairItemType;
|
||||||
private final MaterialType repairMaterialType;
|
private final MaterialType repairMaterialType;
|
||||||
private final double xpMultiplier;
|
private final double xpMultiplier;
|
||||||
|
|
||||||
protected SimpleRepairable(Material type, Material repairMaterial, byte repairMetadata, String repairMaterialPrettyName, int minimumLevel, int minimumQuantity, short maximumDurability, ItemType repairItemType, MaterialType repairMaterialType, double xpMultiplier) {
|
protected SimpleRepairable(Material type, Material repairMaterial, String repairMaterialPrettyName, int minimumLevel, short maximumDurability, ItemType repairItemType, MaterialType repairMaterialType, double xpMultiplier) {
|
||||||
this.itemMaterial = type;
|
this.itemMaterial = type;
|
||||||
this.repairMaterial = repairMaterial;
|
this.repairMaterial = repairMaterial;
|
||||||
this.repairMetadata = repairMetadata;
|
|
||||||
this.repairMaterialPrettyName = repairMaterialPrettyName;
|
this.repairMaterialPrettyName = repairMaterialPrettyName;
|
||||||
this.repairItemType = repairItemType;
|
this.repairItemType = repairItemType;
|
||||||
this.repairMaterialType = repairMaterialType;
|
this.repairMaterialType = repairMaterialType;
|
||||||
this.minimumLevel = minimumLevel;
|
this.minimumLevel = minimumLevel;
|
||||||
this.minimumQuantity = minimumQuantity;
|
|
||||||
this.maximumDurability = maximumDurability;
|
this.maximumDurability = maximumDurability;
|
||||||
this.baseRepairDurability = (short) (maximumDurability / minimumQuantity);
|
|
||||||
this.xpMultiplier = xpMultiplier;
|
this.xpMultiplier = xpMultiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,11 +37,6 @@ public class SimpleRepairable implements Repairable {
|
|||||||
return repairMaterial;
|
return repairMaterial;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public byte getRepairMaterialMetadata() {
|
|
||||||
return repairMetadata;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRepairMaterialPrettyName() {
|
public String getRepairMaterialPrettyName() {
|
||||||
return repairMaterialPrettyName;
|
return repairMaterialPrettyName;
|
||||||
@ -61,7 +54,7 @@ public class SimpleRepairable implements Repairable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMinimumQuantity() {
|
public int getMinimumQuantity() {
|
||||||
return minimumQuantity;
|
return Math.max(SkillUtils.getRepairAndSalvageQuantities(itemMaterial, repairMaterial), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -70,8 +63,8 @@ public class SimpleRepairable implements Repairable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short getBaseRepairDurability() {
|
public short getBaseRepairDurability(ItemStack itemStack) {
|
||||||
return baseRepairDurability;
|
return (short) (maximumDurability / getMinimumQuantity());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -10,7 +10,7 @@ public class Salvage {
|
|||||||
/*public static int salvageMaxPercentageLevel = AdvancedConfig.getInstance().getSalvageMaxPercentageLevel();
|
/*public static int salvageMaxPercentageLevel = AdvancedConfig.getInstance().getSalvageMaxPercentageLevel();
|
||||||
public static double salvageMaxPercentage = AdvancedConfig.getInstance().getSalvageMaxPercentage();
|
public static double salvageMaxPercentage = AdvancedConfig.getInstance().getSalvageMaxPercentage();
|
||||||
|
|
||||||
public static int advancedSalvageUnlockLevel = RankUtils.getRankUnlockLevel(SubSkillType.SALVAGE_ADVANCED_SALVAGE, 1);*/
|
public static int advancedSalvageUnlockLevel = RankUtils.getRankUnlockLevel(SubSkillType.SALVAGE_SCRAP_COLLECTOR, 1);*/
|
||||||
|
|
||||||
public static boolean arcaneSalvageDowngrades = AdvancedConfig.getInstance().getArcaneSalvageEnchantDowngradeEnabled();
|
public static boolean arcaneSalvageDowngrades = AdvancedConfig.getInstance().getArcaneSalvageEnchantDowngradeEnabled();
|
||||||
public static boolean arcaneSalvageEnchantLoss = AdvancedConfig.getInstance().getArcaneSalvageEnchantLossEnabled();
|
public static boolean arcaneSalvageEnchantLoss = AdvancedConfig.getInstance().getArcaneSalvageEnchantLossEnabled();
|
||||||
|
@ -10,10 +10,7 @@ import com.gmail.nossr50.locale.LocaleLoader;
|
|||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
|
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
|
||||||
import com.gmail.nossr50.util.EventUtils;
|
import com.gmail.nossr50.util.*;
|
||||||
import com.gmail.nossr50.util.Misc;
|
|
||||||
import com.gmail.nossr50.util.Permissions;
|
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
|
||||||
import com.gmail.nossr50.util.player.NotificationManager;
|
import com.gmail.nossr50.util.player.NotificationManager;
|
||||||
import com.gmail.nossr50.util.random.RandomChanceSkillStatic;
|
import com.gmail.nossr50.util.random.RandomChanceSkillStatic;
|
||||||
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
||||||
@ -90,12 +87,14 @@ public class SalvageManager extends SkillManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.getDurability() != 0 && (!RankUtils.hasUnlockedSubskill(player, SubSkillType.SALVAGE_ADVANCED_SALVAGE) || !Permissions.advancedSalvage(player))) {
|
if (item.getDurability() != 0 && (!RankUtils.hasUnlockedSubskill(player, SubSkillType.SALVAGE_SCRAP_COLLECTOR) || !Permissions.advancedSalvage(player))) {
|
||||||
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Salvage.Skills.Adept.Damaged");
|
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Salvage.Skills.Adept.Damaged");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int salvageableAmount = Salvage.calculateSalvageableAmount(item.getDurability(), salvageable.getMaximumDurability(), salvageable.getMaximumQuantity());
|
int maxAmountSalvageable = Salvage.calculateSalvageableAmount(item.getDurability(), salvageable.getMaximumDurability(), salvageable.getMaximumQuantity());
|
||||||
|
|
||||||
|
int salvageableAmount = maxAmountSalvageable;
|
||||||
|
|
||||||
if (salvageableAmount == 0) {
|
if (salvageableAmount == 0) {
|
||||||
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Salvage.Skills.TooDamaged");
|
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Salvage.Skills.TooDamaged");
|
||||||
@ -105,7 +104,6 @@ public class SalvageManager extends SkillManager {
|
|||||||
|
|
||||||
salvageableAmount = Math.min(salvageableAmount, getSalvageableAmount()); // Always get at least something back, if you're capable of salvaging it.
|
salvageableAmount = Math.min(salvageableAmount, getSalvageableAmount()); // Always get at least something back, if you're capable of salvaging it.
|
||||||
|
|
||||||
|
|
||||||
player.getInventory().setItemInMainHand(new ItemStack(Material.AIR));
|
player.getInventory().setItemInMainHand(new ItemStack(Material.AIR));
|
||||||
location.add(0.5, 1, 0.5);
|
location.add(0.5, 1, 0.5);
|
||||||
|
|
||||||
@ -116,7 +114,30 @@ public class SalvageManager extends SkillManager {
|
|||||||
enchantBook = arcaneSalvageCheck(enchants);
|
enchantBook = arcaneSalvageCheck(enchants);
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack salvageResults = new ItemStack(salvageable.getSalvageMaterial(), salvageableAmount);
|
//Lottery on Salvageable Amount
|
||||||
|
|
||||||
|
int lotteryResults = 1;
|
||||||
|
int chanceOfSuccess = 80;
|
||||||
|
|
||||||
|
for(int x = 1; x < salvageableAmount-1; x++) {
|
||||||
|
|
||||||
|
if(RandomChanceUtil.rollDice(chanceOfSuccess, 100)) {
|
||||||
|
chanceOfSuccess-=20;
|
||||||
|
Math.max(chanceOfSuccess, 33);
|
||||||
|
|
||||||
|
lotteryResults+=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(lotteryResults == salvageableAmount) {
|
||||||
|
NotificationManager.sendPlayerInformationChatOnly(player, "Salvage.Skills.Lottery.Perfect", String.valueOf(lotteryResults), StringUtils.getPrettyItemString(item.getType()));
|
||||||
|
} else if(RankUtils.isPlayerMaxRankInSubSkill(player, SubSkillType.SALVAGE_ARCANE_SALVAGE)) {
|
||||||
|
NotificationManager.sendPlayerInformationChatOnly(player, "Salvage.Skills.Lottery.Normal", String.valueOf(lotteryResults), StringUtils.getPrettyItemString(item.getType()));
|
||||||
|
} else {
|
||||||
|
NotificationManager.sendPlayerInformationChatOnly(player, "Salvage.Skills.Lottery.Untrained", String.valueOf(lotteryResults), StringUtils.getPrettyItemString(item.getType()));
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemStack salvageResults = new ItemStack(salvageable.getSalvageMaterial(), lotteryResults);
|
||||||
|
|
||||||
//Call event
|
//Call event
|
||||||
if (EventUtils.callSalvageCheckEvent(player, item, salvageResults, enchantBook).isCancelled()) {
|
if (EventUtils.callSalvageCheckEvent(player, item, salvageResults, enchantBook).isCancelled()) {
|
||||||
|
@ -19,13 +19,6 @@ public interface Salvageable {
|
|||||||
*/
|
*/
|
||||||
public Material getSalvageMaterial();
|
public Material getSalvageMaterial();
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the metadata byte value of the items dropped when salvaging this item
|
|
||||||
*
|
|
||||||
* @return the byte metadata of the salvage drop
|
|
||||||
*/
|
|
||||||
public byte getSalvageMaterialMetadata();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the ItemType value for this salvageable item
|
* Gets the ItemType value for this salvageable item
|
||||||
*
|
*
|
||||||
|
@ -5,12 +5,12 @@ import com.gmail.nossr50.datatypes.skills.MaterialType;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
public class SalvageableFactory {
|
public class SalvageableFactory {
|
||||||
public static Salvageable getSalvageable(Material itemMaterial, Material repairMaterial, byte repairMetadata, int maximumQuantity, short maximumDurability) {
|
public static Salvageable getSalvageable(Material itemMaterial, Material recipeMaterial, int maximumQuantity, short maximumDurability) {
|
||||||
return getSalvageable(itemMaterial, repairMaterial, repairMetadata, 0, maximumQuantity, maximumDurability, ItemType.OTHER, MaterialType.OTHER, 1);
|
return getSalvageable(itemMaterial, recipeMaterial, 0, maximumQuantity, maximumDurability, ItemType.OTHER, MaterialType.OTHER, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Salvageable getSalvageable(Material itemMaterial, Material repairMaterial, byte repairMetadata, int minimumLevel, int maximumQuantity, short maximumDurability, ItemType repairItemType, MaterialType repairMaterialType, double xpMultiplier) {
|
public static Salvageable getSalvageable(Material itemMaterial, Material recipeMaterial, int minimumLevel, int maximumQuantity, short maximumDurability, ItemType repairItemType, MaterialType repairMaterialType, double xpMultiplier) {
|
||||||
// TODO: Add in loading from config what type of repairable we want.
|
// TODO: Add in loading from config what type of repairable we want.
|
||||||
return new SimpleSalvageable(itemMaterial, repairMaterial, repairMetadata, minimumLevel, maximumQuantity, maximumDurability, repairItemType, repairMaterialType, xpMultiplier);
|
return new SimpleSalvageable(itemMaterial, recipeMaterial, minimumLevel, maximumQuantity, maximumDurability, repairItemType, repairMaterialType, xpMultiplier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,15 +9,13 @@ public class SimpleSalvageable implements Salvageable {
|
|||||||
private final Material itemMaterial, salvageMaterial;
|
private final Material itemMaterial, salvageMaterial;
|
||||||
private final int maximumQuantity, minimumLevel;
|
private final int maximumQuantity, minimumLevel;
|
||||||
private final short maximumDurability, baseSalvageDurability;
|
private final short maximumDurability, baseSalvageDurability;
|
||||||
private final byte salvageMetadata;
|
|
||||||
private final ItemType salvageItemType;
|
private final ItemType salvageItemType;
|
||||||
private final MaterialType salvageMaterialType;
|
private final MaterialType salvageMaterialType;
|
||||||
private final double xpMultiplier;
|
private final double xpMultiplier;
|
||||||
|
|
||||||
protected SimpleSalvageable(Material type, Material salvageMaterial, byte salvageMetadata, int minimumLevel, int maximumQuantity, short maximumDurability, ItemType salvageItemType, MaterialType salvageMaterialType, double xpMultiplier) {
|
protected SimpleSalvageable(Material type, Material salvageMaterial, int minimumLevel, int maximumQuantity, short maximumDurability, ItemType salvageItemType, MaterialType salvageMaterialType, double xpMultiplier) {
|
||||||
this.itemMaterial = type;
|
this.itemMaterial = type;
|
||||||
this.salvageMaterial = salvageMaterial;
|
this.salvageMaterial = salvageMaterial;
|
||||||
this.salvageMetadata = salvageMetadata;
|
|
||||||
this.salvageItemType = salvageItemType;
|
this.salvageItemType = salvageItemType;
|
||||||
this.salvageMaterialType = salvageMaterialType;
|
this.salvageMaterialType = salvageMaterialType;
|
||||||
this.minimumLevel = minimumLevel;
|
this.minimumLevel = minimumLevel;
|
||||||
@ -37,11 +35,6 @@ public class SimpleSalvageable implements Salvageable {
|
|||||||
return salvageMaterial;
|
return salvageMaterial;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public byte getSalvageMaterialMetadata() {
|
|
||||||
return salvageMetadata;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemType getSalvageItemType() {
|
public ItemType getSalvageItemType() {
|
||||||
return salvageItemType;
|
return salvageItemType;
|
||||||
|
@ -27,18 +27,17 @@ public class TextComponentFactory {
|
|||||||
/**
|
/**
|
||||||
* Makes a text component using strings from a locale and supports passing an undefined number of variables to the LocaleLoader
|
* Makes a text component using strings from a locale and supports passing an undefined number of variables to the LocaleLoader
|
||||||
* @param localeKey target locale string address
|
* @param localeKey target locale string address
|
||||||
* @param notificationType type of notification
|
|
||||||
* @param values vars to be passed to the locale loader
|
* @param values vars to be passed to the locale loader
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static TextComponent getNotificationMultipleValues(String localeKey, NotificationType notificationType, String... values)
|
public static TextComponent getNotificationMultipleValues(String localeKey, String... values)
|
||||||
{
|
{
|
||||||
String preColoredString = LocaleLoader.getString(localeKey, (Object[]) values);
|
String preColoredString = LocaleLoader.getString(localeKey, (Object[]) values);
|
||||||
TextComponent msg = new TextComponent(preColoredString);
|
TextComponent msg = new TextComponent(preColoredString);
|
||||||
return new TextComponent(msg);
|
return new TextComponent(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TextComponent getNotificationTextComponentFromLocale(String localeKey, NotificationType notificationType)
|
public static TextComponent getNotificationTextComponentFromLocale(String localeKey)
|
||||||
{
|
{
|
||||||
return getNotificationTextComponent(LocaleLoader.getString(localeKey));
|
return getNotificationTextComponent(LocaleLoader.getString(localeKey));
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ public class NotificationManager {
|
|||||||
|
|
||||||
ChatMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(notificationType) ? ChatMessageType.ACTION_BAR : ChatMessageType.SYSTEM;
|
ChatMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(notificationType) ? ChatMessageType.ACTION_BAR : ChatMessageType.SYSTEM;
|
||||||
|
|
||||||
TextComponent message = TextComponentFactory.getNotificationTextComponentFromLocale(key, notificationType);
|
TextComponent message = TextComponentFactory.getNotificationTextComponentFromLocale(key);
|
||||||
McMMOPlayerNotificationEvent customEvent = checkNotificationEvent(player, notificationType, destination, message);
|
McMMOPlayerNotificationEvent customEvent = checkNotificationEvent(player, notificationType, destination, message);
|
||||||
|
|
||||||
sendNotification(player, customEvent);
|
sendNotification(player, customEvent);
|
||||||
@ -67,6 +67,15 @@ public class NotificationManager {
|
|||||||
sendPlayerInformation(targetPlayer, notificationType, key, values);
|
sendPlayerInformation(targetPlayer, notificationType, key, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void sendPlayerInformationChatOnly(Player player, String key, String... values)
|
||||||
|
{
|
||||||
|
if(UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
||||||
|
return;
|
||||||
|
|
||||||
|
String preColoredString = LocaleLoader.getString(key, (Object[]) values);
|
||||||
|
player.sendMessage(preColoredString);
|
||||||
|
}
|
||||||
|
|
||||||
public static void sendPlayerInformation(Player player, NotificationType notificationType, String key, String... values)
|
public static void sendPlayerInformation(Player player, NotificationType notificationType, String key, String... values)
|
||||||
{
|
{
|
||||||
if(UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
if(UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
||||||
@ -74,7 +83,7 @@ public class NotificationManager {
|
|||||||
|
|
||||||
ChatMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(notificationType) ? ChatMessageType.ACTION_BAR : ChatMessageType.SYSTEM;
|
ChatMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(notificationType) ? ChatMessageType.ACTION_BAR : ChatMessageType.SYSTEM;
|
||||||
|
|
||||||
TextComponent message = TextComponentFactory.getNotificationMultipleValues(key, notificationType, values);
|
TextComponent message = TextComponentFactory.getNotificationMultipleValues(key, values);
|
||||||
McMMOPlayerNotificationEvent customEvent = checkNotificationEvent(player, notificationType, destination, message);
|
McMMOPlayerNotificationEvent customEvent = checkNotificationEvent(player, notificationType, destination, message);
|
||||||
|
|
||||||
sendNotification(player, customEvent);
|
sendNotification(player, customEvent);
|
||||||
|
@ -358,4 +358,11 @@ public class RankUtils {
|
|||||||
{
|
{
|
||||||
return getRankUnlockLevel(superAbilityType.getSubSkillTypeDefinition(), 1);
|
return getRankUnlockLevel(superAbilityType.getSubSkillTypeDefinition(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isPlayerMaxRankInSubSkill(Player player, SubSkillType subSkillType) {
|
||||||
|
int playerRank = getRank(player, subSkillType);
|
||||||
|
int highestRank = getHighestRank(subSkillType);
|
||||||
|
|
||||||
|
return playerRank == highestRank;
|
||||||
|
}
|
||||||
}
|
}
|
@ -17,6 +17,7 @@ import com.gmail.nossr50.util.Misc;
|
|||||||
import com.gmail.nossr50.util.StringUtils;
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
import com.gmail.nossr50.util.player.NotificationManager;
|
import com.gmail.nossr50.util.player.NotificationManager;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
@ -30,6 +31,7 @@ import org.bukkit.potion.PotionEffect;
|
|||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class SkillUtils {
|
public class SkillUtils {
|
||||||
@ -290,34 +292,33 @@ public class SkillUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int getRepairAndSalvageQuantities(ItemStack item) {
|
public static int getRepairAndSalvageQuantities(ItemStack item) {
|
||||||
return getRepairAndSalvageQuantities(item, getRepairAndSalvageItem(item), (byte) -1);
|
return getRepairAndSalvageQuantities(item.getType(), getRepairAndSalvageItem(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getRepairAndSalvageQuantities(ItemStack item, Material repairMaterial, byte repairMetadata) {
|
public static int getRepairAndSalvageQuantities(Material itemMaterial, Material recipeMaterial) {
|
||||||
// Workaround for Bukkit bug where damaged items would not return any recipes
|
|
||||||
item = item.clone();
|
|
||||||
item.setDurability((short) 0);
|
|
||||||
|
|
||||||
int quantity = 0;
|
int quantity = 0;
|
||||||
List<Recipe> recipes = mcMMO.p.getServer().getRecipesFor(item);
|
|
||||||
|
|
||||||
if (recipes.isEmpty()) {
|
for(Iterator<? extends Recipe> recipeIterator = Bukkit.getServer().recipeIterator(); recipeIterator.hasNext();) {
|
||||||
return quantity;
|
Recipe bukkitRecipe = recipeIterator.next();
|
||||||
}
|
|
||||||
|
|
||||||
Recipe recipe = recipes.get(0);
|
if(bukkitRecipe.getResult().getType() != itemMaterial)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (recipe instanceof ShapelessRecipe) {
|
if(bukkitRecipe instanceof ShapelessRecipe) {
|
||||||
for (ItemStack ingredient : ((ShapelessRecipe) recipe).getIngredientList()) {
|
for (ItemStack ingredient : ((ShapelessRecipe) bukkitRecipe).getIngredientList()) {
|
||||||
if (ingredient != null && (repairMaterial == null || ingredient.getType() == repairMaterial) && (repairMetadata == -1 || ingredient.getType().equals(repairMaterial))) {
|
if (ingredient != null
|
||||||
quantity += ingredient.getAmount();
|
&& (recipeMaterial == null || ingredient.getType() == recipeMaterial)
|
||||||
|
&& (ingredient.getType() == recipeMaterial)) {
|
||||||
|
quantity += ingredient.getAmount();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if(bukkitRecipe instanceof ShapedRecipe) {
|
||||||
}
|
for (ItemStack ingredient : ((ShapedRecipe) bukkitRecipe).getIngredientMap().values()) {
|
||||||
else if (recipe instanceof ShapedRecipe) {
|
if (ingredient != null
|
||||||
for (ItemStack ingredient : ((ShapedRecipe) recipe).getIngredientMap().values()) {
|
&& (recipeMaterial == null || ingredient.getType() == recipeMaterial)
|
||||||
if (ingredient != null && (repairMaterial == null || ingredient.getType() == repairMaterial) && (repairMetadata == -1 || ingredient.getType().equals(repairMaterial))) {
|
&& (ingredient.getType() == recipeMaterial)) {
|
||||||
quantity += ingredient.getAmount();
|
quantity += ingredient.getAmount();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -373,14 +373,14 @@ Repair.Arcane.Perfect=[[GREEN]]You have sustained the arcane energies in this it
|
|||||||
Salvage.Pretty.Name=Salvage
|
Salvage.Pretty.Name=Salvage
|
||||||
Salvage.SubSkill.UnderstandingTheArt.Name=Understanding The Art
|
Salvage.SubSkill.UnderstandingTheArt.Name=Understanding The Art
|
||||||
Salvage.SubSkill.UnderstandingTheArt.Description=You're not just digging through your neighbors trash, you're taking care of the environment.\nPowers up various properties of Salvaging.
|
Salvage.SubSkill.UnderstandingTheArt.Description=You're not just digging through your neighbors trash, you're taking care of the environment.\nPowers up various properties of Salvaging.
|
||||||
Salvage.SubSkill.AdvancedSalvage.Name=Advanced Salvage
|
Salvage.SubSkill.ScrapCollector.Name=Scrap Collector
|
||||||
Salvage.SubSkill.AdvancedSalvage.Description=Salvage damaged items
|
Salvage.SubSkill.ScrapCollector.Description=Salvage materials from an item, a perfect salvage depends on skill and luck.
|
||||||
|
Salvage.SubSkill.ScrapCollector.Stat=Scrap Collector: [[GREEN]]Salvage up to [[YELLOW]]{0}[[GREEN]] items. Some luck is involved.
|
||||||
Salvage.SubSkill.ArcaneSalvage.Name=Arcane Salvaging
|
Salvage.SubSkill.ArcaneSalvage.Name=Arcane Salvaging
|
||||||
Salvage.SubSkill.ArcaneSalvage.Description=Extract enchantments from items
|
Salvage.SubSkill.ArcaneSalvage.Description=Extract enchantments from items
|
||||||
Salvage.SubSkill.ArcaneSalvage.Stat=Arcane Salvaging: [[YELLOW]]Rank {0}/{1}
|
Salvage.SubSkill.ArcaneSalvage.Stat=Arcane Salvaging: [[YELLOW]]Rank {0}/{1}
|
||||||
Salvage.Ability.Locked.0=LOCKED UNTIL {0}+ SKILL (ADVANCED SALVAGE)
|
Salvage.Ability.Bonus.0=Scrap Collector
|
||||||
Salvage.Ability.Bonus.0=Advanced Salvage
|
Salvage.Ability.Bonus.1=Salvage up to [[YELLOW]]{0}[[GREEN]] items. Some luck is involved.
|
||||||
Salvage.Ability.Bonus.1={0} Max Materials Recovered from Salvaging
|
|
||||||
Salvage.Arcane.ExtractFull=[[GRAY]]AS Full-Enchant Chance
|
Salvage.Arcane.ExtractFull=[[GRAY]]AS Full-Enchant Chance
|
||||||
Salvage.Arcane.ExtractPartial=[[GRAY]]AS Partial-Enchant Chance
|
Salvage.Arcane.ExtractPartial=[[GRAY]]AS Partial-Enchant Chance
|
||||||
Salvage.Skills.Success=[[GREEN]]Item salvaged!
|
Salvage.Skills.Success=[[GREEN]]Item salvaged!
|
||||||
@ -393,6 +393,9 @@ Salvage.Skills.ArcaneSuccess=[[GREEN]]You able to extract all of the knowledge c
|
|||||||
Salvage.Listener.Anvil=[[DARK_RED]]You have placed a Salvage anvil, use this to Salvage tools and armor.
|
Salvage.Listener.Anvil=[[DARK_RED]]You have placed a Salvage anvil, use this to Salvage tools and armor.
|
||||||
Salvage.Listener=Salvage:
|
Salvage.Listener=Salvage:
|
||||||
Salvage.SkillName=SALVAGE
|
Salvage.SkillName=SALVAGE
|
||||||
|
Salvage.Skills.Lottery.Normal=[[GOLD]]You were able to salvage [[GREEN]]{0}[[GOLD]] materials from [[DARK_AQUA]]{1}[[GOLD]].
|
||||||
|
Salvage.Skills.Lottery.Perfect=[[GREEN]][[BOLD]]Perfect![[RESET]][[GOLD]] You salvaged [[GREEN]]{1}[[GOLD]] effortlessly, retrieving [[DARK_AQUA]]{0}[[GOLD]] materials.
|
||||||
|
Salvage.Skills.Lottery.Untrained=[[GRAY]]You aren't properly trained in salvaging. You were only able to recover [[RED]]{0}[[GRAY]] materials from [[GREEN]]{1}[[GRAY]].
|
||||||
#Anvil (Shared between SALVAGE and REPAIR)
|
#Anvil (Shared between SALVAGE and REPAIR)
|
||||||
Anvil.Unbreakable=This item is unbreakable!
|
Anvil.Unbreakable=This item is unbreakable!
|
||||||
#SWORDS
|
#SWORDS
|
||||||
|
@ -29,10 +29,6 @@
|
|||||||
## Valid values are => 0
|
## Valid values are => 0
|
||||||
## This defaults to 0
|
## This defaults to 0
|
||||||
#
|
#
|
||||||
# MinimumQuantity: This is the minimum number of items needed to repair this item ignoring all other repair bonuses.
|
|
||||||
## This is typically the number of the repair material needed to create a new item, for example for a sword it is 2, for an axe it is 3
|
|
||||||
## This defaults to 2
|
|
||||||
#
|
|
||||||
# XpMultiplier: This is the amount to multiply the xp bonus by.
|
# XpMultiplier: This is the amount to multiply the xp bonus by.
|
||||||
## This defaults to 1
|
## This defaults to 1
|
||||||
#
|
#
|
||||||
|
@ -282,11 +282,25 @@ Smelting:
|
|||||||
Rank_7: 850
|
Rank_7: 850
|
||||||
Rank_8: 1000
|
Rank_8: 1000
|
||||||
Salvage:
|
Salvage:
|
||||||
AdvancedSalvage:
|
ScrapCollector:
|
||||||
Standard:
|
Standard:
|
||||||
Rank_1: 35
|
Rank_1: 2
|
||||||
|
Rank_2: 10
|
||||||
|
Rank_3: 15
|
||||||
|
Rank_4: 20
|
||||||
|
Rank_5: 25
|
||||||
|
Rank_6: 30
|
||||||
|
Rank_7: 35
|
||||||
|
Rank_8: 40
|
||||||
RetroMode:
|
RetroMode:
|
||||||
Rank_1: 350
|
Rank_1: 20
|
||||||
|
Rank_2: 100
|
||||||
|
Rank_3: 150
|
||||||
|
Rank_4: 200
|
||||||
|
Rank_5: 250
|
||||||
|
Rank_6: 300
|
||||||
|
Rank_7: 350
|
||||||
|
Rank_8: 400
|
||||||
ArcaneSalvage:
|
ArcaneSalvage:
|
||||||
Standard:
|
Standard:
|
||||||
Rank_1: 10
|
Rank_1: 10
|
||||||
|
Loading…
Reference in New Issue
Block a user