mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-07-01 13:14:44 +02:00
Yikes that was a lot of merge conflicts.
This commit is contained in:
@ -114,9 +114,8 @@ public class RepairManager extends SkillManager {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//byte repairMaterialMetadata = repairable.getRepairMaterialMetadata();
|
||||
ItemStack toRemove = new ItemStack(repairMaterial);
|
||||
toRemove.setAmount(1);
|
||||
|
||||
short startDurability = item.getDurability();
|
||||
|
||||
@ -126,26 +125,6 @@ public class RepairManager extends SkillManager {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if they have the proper material to repair with
|
||||
/*if (!inventory.contains(repairMaterial)) {
|
||||
String prettyName = repairable.getRepairMaterialPrettyName() == null ? StringUtils.getPrettyItemString(repairMaterial) : repairable.getRepairMaterialPrettyName();
|
||||
|
||||
String materialsNeeded = "";
|
||||
|
||||
if (repairMaterialMetadata != (byte) -1 && !inventory.containsAtLeast(toRemove, 1)) {
|
||||
materialsNeeded += ":" + repairMaterialMetadata;
|
||||
}
|
||||
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Skills.NeedMore.Extra", prettyName, materialsNeeded);
|
||||
return;
|
||||
}*/
|
||||
|
||||
// Do not repair stacked items
|
||||
if (item.getAmount() != 1) {
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Repair.Skills.StackedItems");
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear ability buffs before trying to repair.
|
||||
SkillUtils.removeAbilityBuff(item);
|
||||
|
||||
@ -165,11 +144,6 @@ public class RepairManager extends SkillManager {
|
||||
}
|
||||
|
||||
// Remove the item
|
||||
/*if (repairMaterialMetadata == -1) {
|
||||
toRemove = inventory.getItem(inventory.first(repairMaterial)).clone();
|
||||
toRemove.setAmount(1);
|
||||
}*/
|
||||
|
||||
inventory.removeItem(toRemove);
|
||||
|
||||
// Give out XP like candy
|
||||
|
@ -8,7 +8,6 @@ import org.bukkit.Material;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class Repairable {
|
||||
private final Material itemMaterial;
|
||||
private final List<Material> repairMaterials;
|
||||
|
@ -89,16 +89,12 @@ public class SalvageManager extends SkillManager {
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.getDurability() != 0 && (!RankUtils.hasUnlockedSubskill(player, SubSkillType.SALVAGE_ADVANCED_SALVAGE) || !Permissions.advancedSalvage(player))) {
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Salvage.Skills.Adept.Damaged");
|
||||
return;
|
||||
}
|
||||
int maxAmountSalvageable = Salvage.calculateSalvageableAmount(item.getDurability(), salvageable.getMaximumDurability(), salvageable.getMaximumQuantity());
|
||||
|
||||
int salvageableAmount = Salvage.calculateSalvageableAmount(item.getDurability(), salvageable.getMaximumDurability(), salvageable.getMaximumQuantity());
|
||||
int salvageableAmount = maxAmountSalvageable;
|
||||
|
||||
if (salvageableAmount == 0) {
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Salvage.Skills.TooDamaged");
|
||||
player.sendMessage(LocaleLoader.getString("Salvage.Skills.TooDamaged"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -114,7 +110,30 @@ public class SalvageManager extends SkillManager {
|
||||
enchantBook = arcaneSalvageCheck(enchants);
|
||||
}
|
||||
|
||||
ItemStack salvageResults = new ItemStack(salvageable.getSalvagedItemMaterial(), 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.getSalvagedItemMaterial(), lotteryResults);
|
||||
|
||||
//Call event
|
||||
if (EventUtils.callSalvageCheckEvent(player, item, salvageResults, enchantBook).isCancelled()) {
|
||||
|
Reference in New Issue
Block a user