mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-29 08:36:45 +01:00
Update src/main/java/com/gmail/nossr50/skills/Repair.java
This commit is contained in:
parent
b3782eddc3
commit
523db7f0a2
@ -67,16 +67,15 @@ public class Repair {
|
|||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(block != null && mcPermissions.getInstance().repair(player))
|
if(block != null && mcPermissions.getInstance().repair(player)){
|
||||||
{
|
if(player.getItemInHand().getDurability() > 0 && player.getItemInHand().getAmount() < 2){
|
||||||
if(player.getItemInHand().getDurability() > 0 && player.getItemInHand().getAmount() < 2){
|
|
||||||
/*
|
/*
|
||||||
* ARMOR
|
* REPAIR ARMOR
|
||||||
*/
|
*/
|
||||||
if(isArmor(is)){
|
if(isArmor(is)){
|
||||||
/*
|
|
||||||
* DIAMOND ARMOR
|
//DIAMOND ARMOR
|
||||||
*/
|
|
||||||
if(isDiamondArmor(is) && hasItem(player, rDiamond) && PP.getSkillLevel(SkillType.REPAIR) >= LoadProperties.repairdiamondlevel){
|
if(isDiamondArmor(is) && hasItem(player, rDiamond) && PP.getSkillLevel(SkillType.REPAIR) >= LoadProperties.repairdiamondlevel){
|
||||||
removeItem(player, rDiamond);
|
removeItem(player, rDiamond);
|
||||||
repairItem(player, enchants, enchantsLevel);
|
repairItem(player, enchants, enchantsLevel);
|
||||||
@ -89,50 +88,57 @@ public class Repair {
|
|||||||
//CLANG CLANG
|
//CLANG CLANG
|
||||||
if(LoadProperties.spoutEnabled)
|
if(LoadProperties.spoutEnabled)
|
||||||
SpoutStuff.playRepairNoise(player);
|
SpoutStuff.playRepairNoise(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//IRON ARMOR
|
||||||
else if (isIronArmor(is) && hasItem(player, rIron)){
|
else if (isIronArmor(is) && hasItem(player, rIron)){
|
||||||
/*
|
|
||||||
* IRON ARMOR
|
|
||||||
*/
|
|
||||||
removeItem(player, rIron);
|
removeItem(player, rIron);
|
||||||
repairItem(player, enchants, enchantsLevel);
|
repairItem(player, enchants, enchantsLevel);
|
||||||
|
|
||||||
durabilityAfter = player.getItemInHand().getDurability();
|
durabilityAfter = player.getItemInHand().getDurability();
|
||||||
dif = (short) (durabilityBefore - durabilityAfter);
|
dif = (short) (durabilityBefore - durabilityAfter);
|
||||||
dif = (short) (dif * 2); //Boost XP
|
dif = (short) (dif * 2); //Boost XP
|
||||||
PP.addXP(SkillType.REPAIR, dif*10, player);
|
PP.addXP(SkillType.REPAIR, dif*10, player);
|
||||||
|
|
||||||
//CLANG CLANG
|
//CLANG CLANG
|
||||||
if(LoadProperties.spoutEnabled)
|
if(LoadProperties.spoutEnabled)
|
||||||
SpoutStuff.playRepairNoise(player);
|
SpoutStuff.playRepairNoise(player);
|
||||||
//GOLD ARMOR
|
}
|
||||||
} else if (isGoldArmor(is) && hasItem(player, rGold)){
|
|
||||||
|
//GOLD ARMOR
|
||||||
|
else if (isGoldArmor(is) && hasItem(player, rGold)){
|
||||||
removeItem(player, rGold);
|
removeItem(player, rGold);
|
||||||
repairItem(player, enchants, enchantsLevel);
|
repairItem(player, enchants, enchantsLevel);
|
||||||
|
|
||||||
durabilityAfter = player.getItemInHand().getDurability();
|
durabilityAfter = player.getItemInHand().getDurability();
|
||||||
dif = (short) (durabilityBefore - durabilityAfter);
|
dif = (short) (durabilityBefore - durabilityAfter);
|
||||||
dif = (short) (dif * 4); //Boost XP of Gold to around Iron
|
dif = (short) (dif * 4); //Boost XP
|
||||||
PP.addXP(SkillType.REPAIR, dif*10, player);
|
PP.addXP(SkillType.REPAIR, dif*10, player);
|
||||||
|
|
||||||
//CLANG CLANG
|
//CLANG CLANG
|
||||||
if(LoadProperties.spoutEnabled)
|
if(LoadProperties.spoutEnabled)
|
||||||
SpoutStuff.playRepairNoise(player);
|
SpoutStuff.playRepairNoise(player);
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
//UNABLE TO REPAIR
|
||||||
|
else {
|
||||||
needMoreVespeneGas(is, player);
|
needMoreVespeneGas(is, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TOOLS
|
* REPAIR TOOLS
|
||||||
*/
|
*/
|
||||||
if(isTools(is)){
|
if(isTools(is)){
|
||||||
|
|
||||||
|
//STONE TOOLS
|
||||||
if(isStoneTools(is) && hasItem(player, rStone)){
|
if(isStoneTools(is) && hasItem(player, rStone)){
|
||||||
removeItem(player, rStone);
|
removeItem(player, rStone);
|
||||||
repairItem(player, enchants, enchantsLevel);
|
repairItem(player, enchants, enchantsLevel);
|
||||||
|
|
||||||
durabilityAfter = player.getItemInHand().getDurability();
|
durabilityAfter = player.getItemInHand().getDurability();
|
||||||
dif = (short) (durabilityBefore - durabilityAfter);
|
dif = (short) (durabilityBefore - durabilityAfter);
|
||||||
if(m.isShovel(is))
|
if(m.isShovel(is))
|
||||||
dif = (short) (dif / 3);
|
dif = (short) (dif / 3);
|
||||||
if(m.isSwords(is))
|
if(m.isSwords(is))
|
||||||
dif = (short) (dif / 2);
|
dif = (short) (dif / 2);
|
||||||
@ -141,14 +147,17 @@ public class Repair {
|
|||||||
//STONE NERF
|
//STONE NERF
|
||||||
dif = (short) (dif / 2);
|
dif = (short) (dif / 2);
|
||||||
|
|
||||||
PP.addXP(SkillType.REPAIR, dif*10, player);
|
PP.addXP(SkillType.REPAIR, dif*10, player);
|
||||||
} else if(isWoodTools(is) && hasItem(player,rWood)){
|
}
|
||||||
|
|
||||||
|
//WOOD TOOLS
|
||||||
|
else if(isWoodTools(is) && hasItem(player,rWood)){
|
||||||
removeItem(player,rWood);
|
removeItem(player,rWood);
|
||||||
repairItem(player, enchants, enchantsLevel);
|
repairItem(player, enchants, enchantsLevel);
|
||||||
|
|
||||||
durabilityAfter = player.getItemInHand().getDurability();
|
durabilityAfter = player.getItemInHand().getDurability();
|
||||||
dif = (short) (durabilityBefore - durabilityAfter);
|
dif = (short) (durabilityBefore - durabilityAfter);
|
||||||
if(m.isShovel(is))
|
if(m.isShovel(is))
|
||||||
dif = (short) (dif / 3);
|
dif = (short) (dif / 3);
|
||||||
if(m.isSwords(is))
|
if(m.isSwords(is))
|
||||||
dif = (short) (dif / 2);
|
dif = (short) (dif / 2);
|
||||||
@ -157,65 +166,80 @@ public class Repair {
|
|||||||
//WOOD NERF
|
//WOOD NERF
|
||||||
dif = (short) (dif / 2);
|
dif = (short) (dif / 2);
|
||||||
|
|
||||||
PP.addXP(SkillType.REPAIR, dif*10, player);
|
PP.addXP(SkillType.REPAIR, dif*10, player);
|
||||||
} else if(isIronTools(is) && hasItem(player, rIron)){
|
}
|
||||||
removeItem(player, rIron);
|
|
||||||
repairItem(player, enchants, enchantsLevel);
|
//IRON TOOLS
|
||||||
|
else if(isIronTools(is) && hasItem(player, rIron)){
|
||||||
|
removeItem(player, rIron);
|
||||||
|
repairItem(player, enchants, enchantsLevel);
|
||||||
|
|
||||||
durabilityAfter = (short) (player.getItemInHand().getDurability()-getRepairAmount(is, player));
|
durabilityAfter = (short) (player.getItemInHand().getDurability()-getRepairAmount(is, player));
|
||||||
dif = (short) (durabilityBefore - durabilityAfter);
|
dif = (short) (durabilityBefore - durabilityAfter);
|
||||||
if(m.isShovel(is))
|
if(m.isShovel(is))
|
||||||
dif = (short) (dif / 3);
|
dif = (short) (dif / 3);
|
||||||
if(m.isSwords(is))
|
if(m.isSwords(is))
|
||||||
dif = (short) (dif / 2);
|
dif = (short) (dif / 2);
|
||||||
if(m.isHoe(is))
|
if(m.isHoe(is))
|
||||||
dif = (short) (dif / 2);
|
dif = (short) (dif / 2);
|
||||||
PP.addXP(SkillType.REPAIR, dif*10, player);
|
|
||||||
|
PP.addXP(SkillType.REPAIR, dif*10, player);
|
||||||
|
|
||||||
//CLANG CLANG
|
//CLANG CLANG
|
||||||
if(LoadProperties.spoutEnabled)
|
if(LoadProperties.spoutEnabled)
|
||||||
SpoutStuff.playRepairNoise(player);
|
SpoutStuff.playRepairNoise(player);
|
||||||
} else if (isDiamondTools(is) && hasItem(player, rDiamond) && PP.getSkillLevel(SkillType.REPAIR) >= LoadProperties.repairdiamondlevel){
|
|
||||||
removeItem(player, rDiamond);
|
|
||||||
repairItem(player, enchants, enchantsLevel);
|
|
||||||
|
|
||||||
durabilityAfter = player.getItemInHand().getDurability();
|
|
||||||
dif = (short) (durabilityBefore - durabilityAfter);
|
|
||||||
if(m.isShovel(is))
|
|
||||||
dif = (short) (dif / 3);
|
|
||||||
if(m.isSwords(is))
|
|
||||||
dif = (short) (dif / 2);
|
|
||||||
if(m.isHoe(is))
|
|
||||||
dif = (short) (dif / 2);
|
|
||||||
PP.addXP(SkillType.REPAIR, dif*10, player);
|
|
||||||
|
|
||||||
//CLANG CLANG
|
|
||||||
if(LoadProperties.spoutEnabled)
|
|
||||||
SpoutStuff.playRepairNoise(player);
|
|
||||||
} else if(isGoldTools(is) && hasItem(player, rGold)){
|
|
||||||
removeItem(player, rGold);
|
|
||||||
repairItem(player, enchants, enchantsLevel);
|
|
||||||
|
|
||||||
durabilityAfter = player.getItemInHand().getDurability();
|
|
||||||
dif = (short) (durabilityBefore - durabilityAfter);
|
|
||||||
dif = (short) (dif * 7.6); //Boost XP for Gold to that of around Iron
|
|
||||||
if(m.isShovel(is))
|
|
||||||
dif = (short) (dif / 3);
|
|
||||||
if(m.isSwords(is))
|
|
||||||
dif = (short) (dif / 2);
|
|
||||||
if(m.isHoe(is))
|
|
||||||
dif = (short) (dif / 2);
|
|
||||||
PP.addXP(SkillType.REPAIR, dif*10, player);
|
|
||||||
|
|
||||||
//CLANG CLANG
|
|
||||||
if(LoadProperties.spoutEnabled)
|
|
||||||
SpoutStuff.playRepairNoise(player);
|
|
||||||
} else {
|
|
||||||
needMoreVespeneGas(is, player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//DIAMOND TOOLS
|
||||||
|
else if (isDiamondTools(is) && hasItem(player, rDiamond) && PP.getSkillLevel(SkillType.REPAIR) >= LoadProperties.repairdiamondlevel){
|
||||||
|
removeItem(player, rDiamond);
|
||||||
|
repairItem(player, enchants, enchantsLevel);
|
||||||
|
|
||||||
|
durabilityAfter = player.getItemInHand().getDurability();
|
||||||
|
dif = (short) (durabilityBefore - durabilityAfter);
|
||||||
|
if(m.isShovel(is))
|
||||||
|
dif = (short) (dif / 3);
|
||||||
|
if(m.isSwords(is))
|
||||||
|
dif = (short) (dif / 2);
|
||||||
|
if(m.isHoe(is))
|
||||||
|
dif = (short) (dif / 2);
|
||||||
|
PP.addXP(SkillType.REPAIR, dif*10, player);
|
||||||
|
|
||||||
|
//CLANG CLANG
|
||||||
|
if(LoadProperties.spoutEnabled)
|
||||||
|
SpoutStuff.playRepairNoise(player);
|
||||||
|
|
||||||
|
}
|
||||||
|
//GOLD TOOLS
|
||||||
|
else if(isGoldTools(is) && hasItem(player, rGold)){
|
||||||
|
removeItem(player, rGold);
|
||||||
|
repairItem(player, enchants, enchantsLevel);
|
||||||
|
|
||||||
|
durabilityAfter = player.getItemInHand().getDurability();
|
||||||
|
dif = (short) (durabilityBefore - durabilityAfter);
|
||||||
|
dif = (short) (dif * 7.6); //Boost XP for Gold to that of around Iron
|
||||||
|
if(m.isShovel(is))
|
||||||
|
dif = (short) (dif / 3);
|
||||||
|
if(m.isSwords(is))
|
||||||
|
dif = (short) (dif / 2);
|
||||||
|
if(m.isHoe(is))
|
||||||
|
dif = (short) (dif / 2);
|
||||||
|
PP.addXP(SkillType.REPAIR, dif*10, player);
|
||||||
|
|
||||||
|
//CLANG CLANG
|
||||||
|
if(LoadProperties.spoutEnabled)
|
||||||
|
SpoutStuff.playRepairNoise(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
//UNABLE TO REPAIR
|
||||||
|
else {
|
||||||
|
needMoreVespeneGas(is, player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
|
||||||
|
else {
|
||||||
player.sendMessage(mcLocale.getString("Skills.FullDurability"));
|
player.sendMessage(mcLocale.getString("Skills.FullDurability"));
|
||||||
}
|
}
|
||||||
//player.updateInventory();
|
//player.updateInventory();
|
||||||
@ -223,8 +247,8 @@ public class Repair {
|
|||||||
* GIVE SKILL IF THERE IS ENOUGH XP
|
* GIVE SKILL IF THERE IS ENOUGH XP
|
||||||
*/
|
*/
|
||||||
Skills.XpCheckSkill(SkillType.REPAIR, player);
|
Skills.XpCheckSkill(SkillType.REPAIR, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static int getArcaneForgingRank(PlayerProfile PP)
|
public static int getArcaneForgingRank(PlayerProfile PP)
|
||||||
{
|
{
|
||||||
int rank = 0;
|
int rank = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user