Update src/main/java/com/gmail/nossr50/skills/Repair.java

This commit is contained in:
gmcferrin 2012-01-19 12:10:24 -05:00
parent b3782eddc3
commit 523db7f0a2

View File

@ -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);
@ -90,10 +89,9 @@ public class Repair {
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);
@ -105,27 +103,35 @@ public class Repair {
//CLANG CLANG //CLANG CLANG
if(LoadProperties.spoutEnabled) if(LoadProperties.spoutEnabled)
SpoutStuff.playRepairNoise(player); SpoutStuff.playRepairNoise(player);
}
//GOLD ARMOR //GOLD ARMOR
} else if (isGoldArmor(is) && hasItem(player, rGold)){ 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);
@ -142,7 +148,10 @@ public class Repair {
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);
@ -158,7 +167,10 @@ public class Repair {
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)){ }
//IRON TOOLS
else if(isIronTools(is) && hasItem(player, rIron)){
removeItem(player, rIron); removeItem(player, rIron);
repairItem(player, enchants, enchantsLevel); repairItem(player, enchants, enchantsLevel);
@ -170,12 +182,17 @@ public class Repair {
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){
}
//DIAMOND TOOLS
else if (isDiamondTools(is) && hasItem(player, rDiamond) && PP.getSkillLevel(SkillType.REPAIR) >= LoadProperties.repairdiamondlevel){
removeItem(player, rDiamond); removeItem(player, rDiamond);
repairItem(player, enchants, enchantsLevel); repairItem(player, enchants, enchantsLevel);
@ -192,7 +209,10 @@ public class Repair {
//CLANG CLANG //CLANG CLANG
if(LoadProperties.spoutEnabled) if(LoadProperties.spoutEnabled)
SpoutStuff.playRepairNoise(player); SpoutStuff.playRepairNoise(player);
} else if(isGoldTools(is) && hasItem(player, rGold)){
}
//GOLD TOOLS
else if(isGoldTools(is) && hasItem(player, rGold)){
removeItem(player, rGold); removeItem(player, rGold);
repairItem(player, enchants, enchantsLevel); repairItem(player, enchants, enchantsLevel);
@ -210,12 +230,16 @@ public class Repair {
//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);
} }
} }
}
} else { else {
player.sendMessage(mcLocale.getString("Skills.FullDurability")); player.sendMessage(mcLocale.getString("Skills.FullDurability"));
} }
//player.updateInventory(); //player.updateInventory();
@ -224,7 +248,7 @@ public class Repair {
*/ */
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;