Merge pull request #31 from gmcferrin/master

Repair & Fishing Fixes
This commit is contained in:
The Yeti 2012-01-25 14:15:04 -08:00
commit 17d584f911
3 changed files with 689 additions and 600 deletions

View File

@ -4,15 +4,7 @@ import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.craftbukkit.entity.CraftItem; import org.bukkit.craftbukkit.entity.CraftItem;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Chicken; import org.bukkit.entity.*
import org.bukkit.entity.Cow;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Pig;
import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Spider;
import org.bukkit.event.player.PlayerFishEvent; import org.bukkit.event.player.PlayerFishEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.material.Wool; import org.bukkit.material.Wool;
@ -48,105 +40,6 @@ public class Fishing {
} }
} }
public static short getItemMaxDurability(Material mat)
{
switch(mat)
{
case LEATHER_BOOTS:
return (short) 40;
case LEATHER_LEGGINGS:
return (short) 46;
case LEATHER_HELMET:
return (short) 34;
case LEATHER_CHESTPLATE:
return (short) 49;
case CHAINMAIL_BOOTS:
return (short) 79;
case CHAINMAIL_LEGGINGS:
return (short) 92;
case CHAINMAIL_HELMET:
return (short) 67;
case CHAINMAIL_CHESTPLATE:
return (short) 96;
case GOLD_BOOTS:
return (short) 80;
case GOLD_LEGGINGS:
return (short) 92;
case GOLD_HELMET:
return (short) 68;
case GOLD_CHESTPLATE:
return (short) 96;
case IRON_BOOTS:
return (short) 160;
case IRON_LEGGINGS:
return (short) 184;
case IRON_HELMET:
return (short) 136;
case IRON_CHESTPLATE:
return (short) 192;
case DIAMOND_BOOTS:
return (short) 320;
case DIAMOND_LEGGINGS:
return (short) 368;
case DIAMOND_HELMET:
return (short) 272;
case DIAMOND_CHESTPLATE:
return (short) 384;
case GOLD_AXE:
return (short) 33;
case GOLD_SWORD:
return (short) 33;
case GOLD_HOE:
return (short) 33;
case GOLD_SPADE:
return (short) 33;
case GOLD_PICKAXE:
return (short) 33;
case WOOD_AXE:
return (short) 60;
case WOOD_SWORD:
return (short) 60;
case WOOD_HOE:
return (short) 60;
case WOOD_SPADE:
return (short) 60;
case WOOD_PICKAXE:
return (short) 60;
case STONE_AXE:
return (short) 132;
case STONE_SWORD:
return (short) 132;
case STONE_HOE:
return (short) 132;
case STONE_SPADE:
return (short) 132;
case STONE_PICKAXE:
return (short) 132;
case IRON_AXE:
return (short) 251;
case IRON_SWORD:
return (short) 251;
case IRON_HOE:
return (short) 251;
case IRON_SPADE:
return (short) 251;
case IRON_PICKAXE:
return (short) 251;
case DIAMOND_AXE:
return (short) 1562;
case DIAMOND_SWORD:
return (short) 1562;
case DIAMOND_HOE:
return (short) 1562;
case DIAMOND_SPADE:
return (short) 1562;
case DIAMOND_PICKAXE:
return (short) 1562;
default:
return (short) 0;
}
}
public static void getFishingResults(Player player, PlayerFishEvent event) public static void getFishingResults(Player player, PlayerFishEvent event)
{ {
switch(getFishingLootTier(Users.getProfile(player))) switch(getFishingLootTier(Users.getProfile(player)))
@ -174,7 +67,7 @@ public class Fishing {
private static void getFishingResultsTier1(Player player, PlayerFishEvent event) private static void getFishingResultsTier1(Player player, PlayerFishEvent event)
{ {
int randomNum = (int)(Math.random() * 14); int randomNum = (int)(Math.random() * 15);
CraftItem theCatch = (CraftItem)event.getCaught(); CraftItem theCatch = (CraftItem)event.getCaught();
if(Math.random() * 100 < 20) if(Math.random() * 100 < 20)
@ -229,13 +122,13 @@ public class Fishing {
theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); theCatch.setItemStack(new ItemStack(Material.RAW_FISH));
} }
//Change durability to random value //Change durability to random value
theCatch.getItemStack().setDurability((short) (Math.random() * Fishing.getItemMaxDurability(theCatch.getItemStack().getType()))); //Change the damage value theCatch.getItemStack().setDurability((short) (Math.random() * theCatch.getItemStack().getType().getMaxDurability())); //Change the damage value
} }
private static void getFishingResultsTier2(Player player, PlayerFishEvent event) private static void getFishingResultsTier2(Player player, PlayerFishEvent event)
{ {
int randomNum = (int)(Math.random() * 19); int randomNum = (int)(Math.random() * 20);
CraftItem theCatch = (CraftItem)event.getCaught(); CraftItem theCatch = (CraftItem)event.getCaught();
if(Math.random() * 100 < 25) if(Math.random() * 100 < 25)
@ -306,12 +199,12 @@ public class Fishing {
} }
//Change durability to random value //Change durability to random value
theCatch.getItemStack().setDurability((short) (Math.random() * Fishing.getItemMaxDurability(theCatch.getItemStack().getType()))); theCatch.getItemStack().setDurability((short) (Math.random() * theCatch.getItemStack().getType().getMaxDurability())); //Change the damage value
} }
private static void getFishingResultsTier3(Player player, PlayerFishEvent event) private static void getFishingResultsTier3(Player player, PlayerFishEvent event)
{ {
int randomNum = (int)(Math.random() * 23); int randomNum = (int)(Math.random() * 24);
CraftItem theCatch = (CraftItem)event.getCaught(); CraftItem theCatch = (CraftItem)event.getCaught();
if(Math.random() * 100 < 30) if(Math.random() * 100 < 30)
@ -394,12 +287,12 @@ public class Fishing {
theCatch.setItemStack(new ItemStack(Material.RAW_FISH, 1)); theCatch.setItemStack(new ItemStack(Material.RAW_FISH, 1));
} }
//Change durability to random value //Change durability to random value
theCatch.getItemStack().setDurability((short) (Math.random() * Fishing.getItemMaxDurability(theCatch.getItemStack().getType()))); theCatch.getItemStack().setDurability((short) (Math.random() * theCatch.getItemStack().getType().getMaxDurability())); //Change the damage value
} }
private static void getFishingResultsTier4(Player player, PlayerFishEvent event) private static void getFishingResultsTier4(Player player, PlayerFishEvent event)
{ {
int randomNum = (int)(Math.random() * 40); int randomNum = (int)(Math.random() * 41);
CraftItem theCatch = (CraftItem)event.getCaught(); CraftItem theCatch = (CraftItem)event.getCaught();
if(Math.random() * 100 < 35) if(Math.random() * 100 < 35)
@ -521,7 +414,7 @@ public class Fishing {
theCatch.setItemStack(new ItemStack(Material.RECORD_11, 1)); theCatch.setItemStack(new ItemStack(Material.RECORD_11, 1));
break; break;
case 39: case 39:
theCatch.setItemStack(new ItemStack(Material.REDSTONE_WIRE, 64)); theCatch.setItemStack(new ItemStack(Material.GLOWSTONE_DUST, 16));
break; break;
case 40: case 40:
theCatch.setItemStack(new ItemStack(Material.DIAMOND, (int)(Math.random() * 10))); theCatch.setItemStack(new ItemStack(Material.DIAMOND, (int)(Math.random() * 10)));
@ -532,12 +425,12 @@ public class Fishing {
theCatch.setItemStack(new ItemStack(Material.RAW_FISH, 1)); theCatch.setItemStack(new ItemStack(Material.RAW_FISH, 1));
} }
//Change durability to random value //Change durability to random value
theCatch.getItemStack().setDurability((short) (Math.random() * Fishing.getItemMaxDurability(theCatch.getItemStack().getType()))); theCatch.getItemStack().setDurability((short) (Math.random() * theCatch.getItemStack().getType().getMaxDurability())); //Change the damage value
} }
private static void getFishingResultsTier5(Player player, PlayerFishEvent event) private static void getFishingResultsTier5(Player player, PlayerFishEvent event)
{ {
int randomNum = (int)(Math.random() * 49); int randomNum = (int)(Math.random() * 50);
CraftItem theCatch = (CraftItem)event.getCaught(); CraftItem theCatch = (CraftItem)event.getCaught();
if(Math.random() * 100 < 40) if(Math.random() * 100 < 40)
@ -659,7 +552,7 @@ public class Fishing {
theCatch.setItemStack(new ItemStack(Material.RECORD_11, 1)); theCatch.setItemStack(new ItemStack(Material.RECORD_11, 1));
break; break;
case 39: case 39:
theCatch.setItemStack(new ItemStack(Material.REDSTONE_WIRE, 64)); theCatch.setItemStack(new ItemStack(Material.GLOWSTONE_DUST, 16));
break; break;
case 40: case 40:
theCatch.setItemStack(new ItemStack(Material.DIAMOND, (int)(Math.random() * 20))); theCatch.setItemStack(new ItemStack(Material.DIAMOND, (int)(Math.random() * 20)));
@ -696,7 +589,7 @@ public class Fishing {
theCatch.setItemStack(new ItemStack(Material.RAW_FISH, 1)); theCatch.setItemStack(new ItemStack(Material.RAW_FISH, 1));
} }
//Change durability to random value //Change durability to random value
theCatch.getItemStack().setDurability((short) (Math.random() * Fishing.getItemMaxDurability(theCatch.getItemStack().getType()))); theCatch.getItemStack().setDurability((short) (Math.random() * theCatch.getItemStack().getType().getMaxDurability())); //Change the damage value
} }
public static void processResults(PlayerFishEvent event) public static void processResults(PlayerFishEvent event)
{ {
@ -724,23 +617,45 @@ public class Fishing {
{ {
if(x.canEnchantItem(fishingResults)) if(x.canEnchantItem(fishingResults))
{ {
//Actual chance to have an enchantment is related to your fishing skill //Prevent impossible enchantment combinations
if(Math.random() * 15 < Fishing.getFishingLootTier(PP)) if((fishingResults.containsEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL) || fishingResults.containsEnchantment(Enchantment.PROTECTION_EXPLOSIONS) ||
{ fishingResults.containsEnchantment(Enchantment.PROTECTION_FIRE) || fishingResults.containsEnchantment(Enchantment.PROTECTION_PROJECTILE)) &&
enchanted = true; (x.equals(Enchantment.PROTECTION_EXPLOSIONS) || x.equals(Enchantment.PROTECTION_PROJECTILE) || x.equals(Enchantment.PROTECTION_FIRE) || x.equals(Enchantment.PROTECTION_ENVIRONMENTAL))){
int randomEnchantLevel = (int) Math.random() * x.getMaxLevel(); return;
}
if(randomEnchantLevel == 0) //More impossible enchantment combinations
randomEnchantLevel = 1; else if((fishingResults.containsEnchantment(Enchantment.DAMAGE_ALL) || fishingResults.containsEnchantment(Enchantment.DAMAGE_ARTHROPODS) || fishingResults.containsEnchantment(Enchantment.DAMAGE_UNDEAD)) &&
if(randomEnchantLevel > x.getMaxLevel()) (x.equals(Enchantment.DAMAGE_ALL) || x.equals(Enchantment.DAMAGE_ARTHROPODS) || x.equals(Enchantment.DAMAGE_UNDEAD))){
randomEnchantLevel = x.getMaxLevel(); return;
}
fishingResults.addEnchantment(x, randomEnchantLevel); //Even more impossible enchantment combinations
else if((fishingResults.containsEnchantment(Enchantment.SILK_TOUCH) || fishingResults.containsEnchantment(Enchantment.LOOT_BONUS_BLOCKS)) &&
(x.equals(Enchantment.SILK_TOUCH) || x.equals(Enchantment.LOOT_BONUS_BLOCKS))){
return;
}
else{
//Actual chance to have an enchantment is related to your fishing skill
if(Math.random() * 15 < Fishing.getFishingLootTier(PP))
{
enchanted = true;
int randomEnchantLevel = (int)(Math.random() * x.getMaxLevel());
if(randomEnchantLevel == 0)
randomEnchantLevel = 1;
if(randomEnchantLevel > x.getMaxLevel())
randomEnchantLevel = x.getMaxLevel();
fishingResults.addEnchantment(x, randomEnchantLevel);
}
} }
} }
} }
} }
} }
//Inform the player of magical properties //Inform the player of magical properties
if(enchanted) if(enchanted)
{ {
@ -751,11 +666,15 @@ public class Fishing {
public static void shakeMob(PlayerFishEvent event) public static void shakeMob(PlayerFishEvent event)
{ {
LivingEntity le = (LivingEntity)event.getCaught(); LivingEntity le = (LivingEntity)event.getCaught();
//Do nothing to players
if(le instanceof Player) if(le instanceof Player)
return; return;
le.damage(1); le.damage(1);
World world = le.getWorld(); World world = le.getWorld();
/* Neutral Mobs */
if(le instanceof Sheep) if(le instanceof Sheep)
{ {
Sheep sheep = (Sheep)le; Sheep sheep = (Sheep)le;
@ -768,33 +687,148 @@ public class Fishing {
world.dropItemNaturally(le.getLocation(), theWool); world.dropItemNaturally(le.getLocation(), theWool);
sheep.setSheared(true); sheep.setSheared(true);
} }
} else if(le instanceof Pig) }
else if(le instanceof Pig)
{ {
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.PORK, 1)); world.dropItemNaturally(le.getLocation(), new ItemStack(Material.PORK, 1));
} else if(le instanceof Skeleton) }
else if(le instanceof Cow)
{
if(Math.random() * 100 < 99){
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.MILK_BUCKET, 1)); //rare chance to drop milk
}
else if(Math.random() * 10 < 5){
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.LEATHER, 1));
}
else{
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.RAW_BEEF, 1));)
}
}
else if(le instanceof Chicken)
{
if(Math.random() * 10 <= 7){
if(Math.random() * 10 < 5){
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.FEATHER, 1));
}
else{
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.RAW_CHICKEN, 1));
}
}
else{
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.EGG, 1));
}
}
else if(le instanceof MushroomCow)
{
if(Math.random() * 100 < 99){
if(Math.random() * 10 < 5){
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.MILK_BUCKET, 1)); //rare chance to drop milk
}
else{
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.MUSHROOM_SOUP, 1)); //rare chance to drop soup
}
}
else if(Math.random() * 10 <= 7){
if(Math.random() * 10 < 5){
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.LEATHER, 1));
}
else{
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.RAW_BEEF, 1));)
}
}
else{
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.RED_MUSHROOM, 3));
//need some way to remove MushroomCow & replace with regular cow when sheared
}
}
else if(le instanceof Squid)
{
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.getMaterial(351), 1, (byte)0, (byte)0)));
}
else if(le instanceof Snowman){
if(Math.random() * 100 < 99){
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.PUMPKIN, 1)); //rare chance to drop pumpkin
}
else{
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.SNOW_BALL, 5));
}
}
/* Hostile Mobs */
else if(le instanceof Skeleton)
{ {
if(Math.random() * 10 < 5) if(Math.random() * 10 < 5)
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.BONE, 1)); world.dropItemNaturally(le.getLocation(), new ItemStack(Material.BONE, 1));
else else
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.ARROW, 3)); world.dropItemNaturally(le.getLocation(), new ItemStack(Material.ARROW, 3));
} else if(le instanceof Cow) }
{
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.LEATHER, 1)); else if(le instanceof Spider)
} else if(le instanceof Spider)
{ {
if(Math.random() * 10 < 5) if(Math.random() * 10 < 5)
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.SPIDER_EYE, 1)); world.dropItemNaturally(le.getLocation(), new ItemStack(Material.SPIDER_EYE, 1));
else else
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.STRING, 1)); world.dropItemNaturally(le.getLocation(), new ItemStack(Material.STRING, 1));
} else if(le instanceof Chicken) }
{
if(Math.random() * 10 < 5) else if(le instanceof Creeper)
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.FEATHER, 1));
else
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.EGG, 1));
} else if(le instanceof Creeper)
{ {
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.SULPHUR, 1)); world.dropItemNaturally(le.getLocation(), new ItemStack(Material.SULPHUR, 1));
} }
else if(le instanceof Enderman)
{
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.ENDER_PEARL, 1));
}
else if(le instanceof PigZombie)
{
if(Math.random() * 10 < 5)
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.ROTTEN_FLESH, 1));
else
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.GOLD_NUGGET, 1));
}
else if(le instanceof Blaze)
{
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.BLAZE_ROD, 1));
}
else if(le instanceof CaveSpider)
{
if(Math.random() * 10 < 5)
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.SPIDER_EYE, 1));
else
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.STRING, 1));
}
else if(le instanceof Ghast)
{
if(Math.random() * 10 < 5)
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.SULPHUR, 1));
else
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.GHAST_TEAR, 1));
}
else if(le instanceof MagmaCube)
{
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.MAGMA_CREAM, 1));
}
else if(le instanceof Slime)
{
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.SLIME_BALL, 1));
}
else if(le instanceof Zombie)
{
world.dropItemNaturally(le.getLocation(), new ItemStack(Material.ROTTEN_FLESH, 1));
}
} }
} }

View File

@ -394,7 +394,7 @@ public class Mining
block.setType(Material.AIR); block.setType(Material.AIR);
} }
//REDSTONE //REDSTONE
if((block.getTypeId() == 73 || block.getTypeId() == 74) && m.getTier(player) >= 4) if((block.getTypeId() == 73 || block.getTypeId() == 74) && m.getTier(player) >= 3)
{ {
if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5) if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5)
{ {

View File

@ -13,9 +13,10 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with mcMMO. If not, see <http://www.gnu.org/licenses/>. along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.gmail.nossr50.skills; package com.gmail.nossr50.skills;
import org.bukkit.Material;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
@ -33,19 +34,19 @@ import com.gmail.nossr50.locale.mcLocale;
public class Repair { public class Repair {
/* /*
* Repair requirements for each material * Repair requirements for each material
*/ */
private static int rGold = LoadProperties.rGold; private static int rGold = LoadProperties.rGold;
private static String nGold = LoadProperties.nGold; private static String nGold = LoadProperties.nGold;
private static int rStone = LoadProperties.rStone; private static int rStone = LoadProperties.rStone;
private static String nStone = LoadProperties.nStone; private static String nStone = LoadProperties.nStone;
private static int rWood = LoadProperties.rWood; private static int rWood = LoadProperties.rWood;
private static String nWood = LoadProperties.nWood; private static String nWood = LoadProperties.nWood;
private static int rDiamond = LoadProperties.rDiamond; private static int rDiamond = LoadProperties.rDiamond;
private static String nDiamond = LoadProperties.nDiamond; private static String nDiamond = LoadProperties.nDiamond;
private static int rIron = LoadProperties.rIron; private static int rIron = LoadProperties.rIron;
private static String nIron = LoadProperties.nIron; private static String nIron = LoadProperties.nIron;
public static void repairCheck(Player player, ItemStack is, Block block){ public static void repairCheck(Player player, ItemStack is, Block block){
@ -66,185 +67,209 @@ 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
*/
if(isArmor(is)){
/*
* DIAMOND ARMOR
*/
if(isDiamondArmor(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); * REPAIR ARMOR
dif = (short) (dif * 6); //Boost XP */
PP.addXP(SkillType.REPAIR, dif*10, player); if(isArmor(is)){
//CLANG CLANG //DIAMOND ARMOR
if(LoadProperties.spoutEnabled) if(isDiamondArmor(is) && hasItem(player, rDiamond) && PP.getSkillLevel(SkillType.REPAIR) >= LoadProperties.repairdiamondlevel){
SpoutStuff.playRepairNoise(player); removeItem(player, rDiamond);
} repairItem(player, enchants, enchantsLevel);
else if (isIronArmor(is) && hasItem(player, rIron)){
/*
* IRON ARMOR
*/
removeItem(player, rIron);
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 * 6); //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)){
removeItem(player, rGold);
repairItem(player, enchants, enchantsLevel);
durabilityAfter = player.getItemInHand().getDurability(); //IRON ARMOR
dif = (short) (durabilityBefore - durabilityAfter); else if (isIronArmor(is) && hasItem(player, rIron)){
dif = (short) (dif * 4); //Boost XP of Gold to around Iron removeItem(player, rIron);
PP.addXP(SkillType.REPAIR, dif*10, player); repairItem(player, enchants, enchantsLevel);
//CLANG CLANG durabilityAfter = player.getItemInHand().getDurability();
if(LoadProperties.spoutEnabled) dif = (short) (durabilityBefore - durabilityAfter);
SpoutStuff.playRepairNoise(player); dif = (short) (dif * 2); //Boost XP
} else { PP.addXP(SkillType.REPAIR, dif*10, player);
needMoreVespeneGas(is, player);
}
}
/*
* TOOLS
*/
if(isTools(is)){
if(isStoneTools(is) && hasItem(player, rStone)){
removeItem(player, rStone);
repairItem(player, enchants, enchantsLevel);
durabilityAfter = player.getItemInHand().getDurability(); //CLANG CLANG
dif = (short) (durabilityBefore - durabilityAfter); if(LoadProperties.spoutEnabled)
if(m.isShovel(is)) SpoutStuff.playRepairNoise(player);
dif = (short) (dif / 3); }
if(m.isSwords(is))
dif = (short) (dif / 2);
if(m.isHoe(is))
dif = (short) (dif / 2);
//STONE NERF
dif = (short) (dif / 2);
PP.addXP(SkillType.REPAIR, dif*10, player); //GOLD ARMOR
} else if(isWoodTools(is) && hasItem(player,rWood)){ else if (isGoldArmor(is) && hasItem(player, rGold)){
removeItem(player,rWood); 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);
if(m.isShovel(is)) dif = (short) (dif * 4); //Boost XP
dif = (short) (dif / 3); PP.addXP(SkillType.REPAIR, dif*10, player);
if(m.isSwords(is))
dif = (short) (dif / 2);
if(m.isHoe(is))
dif = (short) (dif / 2);
//WOOD NERF
dif = (short) (dif / 2);
PP.addXP(SkillType.REPAIR, dif*10, player); //CLANG CLANG
} else if(isIronTools(is) && hasItem(player, rIron)){ if(LoadProperties.spoutEnabled)
removeItem(player, rIron); SpoutStuff.playRepairNoise(player);
repairItem(player, enchants, enchantsLevel); }
durabilityAfter = (short) (player.getItemInHand().getDurability()-getRepairAmount(is, player)); //UNABLE TO REPAIR
dif = (short) (durabilityBefore - durabilityAfter); else {
if(m.isShovel(is)) needMoreVespeneGas(is, player);
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) * REPAIR TOOLS
SpoutStuff.playRepairNoise(player); */
} else if (isDiamondTools(is) && hasItem(player, rDiamond) && PP.getSkillLevel(SkillType.REPAIR) >= LoadProperties.repairdiamondlevel){ if(isTools(is)){
removeItem(player, rDiamond);
repairItem(player, enchants, enchantsLevel);
durabilityAfter = player.getItemInHand().getDurability(); //STONE TOOLS
dif = (short) (durabilityBefore - durabilityAfter); if(isStoneTools(is) && hasItem(player, rStone)){
if(m.isShovel(is)) removeItem(player, rStone);
dif = (short) (dif / 3); repairItem(player, enchants, enchantsLevel);
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 durabilityAfter = player.getItemInHand().getDurability();
if(LoadProperties.spoutEnabled) dif = (short) (durabilityBefore - durabilityAfter);
SpoutStuff.playRepairNoise(player); if(m.isShovel(is))
} else if(isGoldTools(is) && hasItem(player, rGold)){ dif = (short) (dif / 3);
removeItem(player, rGold); if(m.isSwords(is))
repairItem(player, enchants, enchantsLevel); dif = (short) (dif / 2);
if(m.isHoe(is))
dif = (short) (dif / 2);
//STONE NERF
dif = (short) (dif / 2);
durabilityAfter = player.getItemInHand().getDurability(); PP.addXP(SkillType.REPAIR, dif*10, player);
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 //WOOD TOOLS
if(LoadProperties.spoutEnabled) else if(isWoodTools(is) && hasItem(player,rWood)){
SpoutStuff.playRepairNoise(player); removeItem(player,rWood);
} else { repairItem(player, enchants, enchantsLevel);
needMoreVespeneGas(is, player);
}
}
} else { durabilityAfter = player.getItemInHand().getDurability();
player.sendMessage(mcLocale.getString("Skills.FullDurability")); dif = (short) (durabilityBefore - durabilityAfter);
} if(m.isShovel(is))
//player.updateInventory(); dif = (short) (dif / 3);
/* if(m.isSwords(is))
* GIVE SKILL IF THERE IS ENOUGH XP dif = (short) (dif / 2);
*/ if(m.isHoe(is))
Skills.XpCheckSkill(SkillType.REPAIR, player); dif = (short) (dif / 2);
} //WOOD NERF
} dif = (short) (dif / 2);
public static int getArcaneForgingRank(PlayerProfile PP)
{ PP.addXP(SkillType.REPAIR, dif*10, player);
}
//IRON TOOLS
else if(isIronTools(is) && hasItem(player, rIron)){
removeItem(player, rIron);
repairItem(player, enchants, enchantsLevel);
durabilityAfter = (short) (player.getItemInHand().getDurability()-getRepairAmount(is, player));
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);
}
//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 {
player.sendMessage(mcLocale.getString("Skills.FullDurability"));
}
/*
* GIVE SKILL IF THERE IS ENOUGH XP
*/
Skills.XpCheckSkill(SkillType.REPAIR, player);
}
}
public static int getArcaneForgingRank(PlayerProfile PP){
int rank = 0; int rank = 0;
if(PP.getSkillLevel(SkillType.REPAIR) >= 750) if(PP.getSkillLevel(SkillType.REPAIR) >= 750)
{
rank = 4; rank = 4;
} else if (PP.getSkillLevel(SkillType.REPAIR) >= 500)
{ else if (PP.getSkillLevel(SkillType.REPAIR) >= 500)
rank = 3; rank = 3;
} else if(PP.getSkillLevel(SkillType.REPAIR) >= 250)
{ else if(PP.getSkillLevel(SkillType.REPAIR) >= 250)
rank = 2; rank = 2;
} else if (PP.getSkillLevel(SkillType.REPAIR) >= 100)
{ else if (PP.getSkillLevel(SkillType.REPAIR) >= 100)
rank = 1; rank = 1;
}
return rank; return rank;
} }
public static void addEnchants(ItemStack is, Enchantment[] enchants, int[] enchantsLvl, PlayerProfile PP, Player player)
{ public static void addEnchants(ItemStack is, Enchantment[] enchants, int[] enchantsLvl, PlayerProfile PP, Player player){
if(is.getEnchantments().keySet().size() == 0) if(is.getEnchantments().keySet().size() == 0)
return; return;
@ -303,8 +328,7 @@ public class Repair {
player.sendMessage(mcLocale.getString("Repair.Downgraded")); player.sendMessage(mcLocale.getString("Repair.Downgraded"));
} }
} }
public static int getEnchantChance(int rank) public static int getEnchantChance(int rank){
{
switch(rank) switch(rank)
{ {
case 4: case 4:
@ -336,249 +360,280 @@ public class Repair {
} }
} }
public static boolean isArmor(ItemStack is){ public static boolean isArmor(ItemStack is){
return is.getTypeId() == 306 || is.getTypeId() == 307 ||is.getTypeId() == 308 ||is.getTypeId() == 309 || return is.getTypeId() == 306 || is.getTypeId() == 307 ||is.getTypeId() == 308 ||is.getTypeId() == 309 || //IRON
is.getTypeId() == 310 ||is.getTypeId() == 311 ||is.getTypeId() == 312 ||is.getTypeId() == 313 || is.getTypeId() == 310 ||is.getTypeId() == 311 ||is.getTypeId() == 312 ||is.getTypeId() == 313 || //DIAMOND
is.getTypeId() == 314 || is.getTypeId() == 315 || is.getTypeId() == 316 || is.getTypeId() == 317; is.getTypeId() == 314 || is.getTypeId() == 315 || is.getTypeId() == 316 || is.getTypeId() == 317; //GOLD
} }
public static boolean isGoldArmor(ItemStack is){ public static boolean isGoldArmor(ItemStack is){
return is.getTypeId() == 314 || is.getTypeId() == 315 || is.getTypeId() == 316 || is.getTypeId() == 317; return is.getTypeId() == 314 || is.getTypeId() == 315 || is.getTypeId() == 316 || is.getTypeId() == 317;
} }
public static boolean isIronArmor(ItemStack is){ public static boolean isIronArmor(ItemStack is){
return is.getTypeId() == 306 || is.getTypeId() == 307 || is.getTypeId() == 308 || is.getTypeId() == 309; return is.getTypeId() == 306 || is.getTypeId() == 307 || is.getTypeId() == 308 || is.getTypeId() == 309;
} }
public static boolean isDiamondArmor(ItemStack is){ public static boolean isDiamondArmor(ItemStack is){
return is.getTypeId() == 310 || is.getTypeId() == 311 || is.getTypeId() == 312 || is.getTypeId() == 313; return is.getTypeId() == 310 || is.getTypeId() == 311 || is.getTypeId() == 312 || is.getTypeId() == 313;
} }
public static boolean isTools(ItemStack is) public static boolean isTools(ItemStack is)
{ {
return is.getTypeId() == 359 || is.getTypeId() == 256 || is.getTypeId() == 257 || is.getTypeId() == 258 || is.getTypeId() == 267 || is.getTypeId() == 292 || //IRON return is.getTypeId() == 359 || is.getTypeId() == 256 || is.getTypeId() == 257 || is.getTypeId() == 258 || is.getTypeId() == 267 || is.getTypeId() == 292 || //IRON
is.getTypeId() == 276 || is.getTypeId() == 277 || is.getTypeId() == 278 || is.getTypeId() == 279 || is.getTypeId() == 293 || //DIAMOND is.getTypeId() == 276 || is.getTypeId() == 277 || is.getTypeId() == 278 || is.getTypeId() == 279 || is.getTypeId() == 293 || //DIAMOND
is.getTypeId() == 283 || is.getTypeId() == 285 || is.getTypeId() == 286 || is.getTypeId() == 284 || //GOLD is.getTypeId() == 283 || is.getTypeId() == 285 || is.getTypeId() == 286 || is.getTypeId() == 284 || is.getTypeId() == 294 || //GOLD
is.getTypeId() == 268 || is.getTypeId() == 269 || is.getTypeId() == 270 || is.getTypeId() == 271 || is.getTypeId() == 290 ||//WOOD is.getTypeId() == 268 || is.getTypeId() == 269 || is.getTypeId() == 270 || is.getTypeId() == 271 || is.getTypeId() == 290 ||//WOOD
is.getTypeId() == 272 || is.getTypeId() == 273 || is.getTypeId() == 274 || is.getTypeId() == 275|| is.getTypeId() == 291; //STONE is.getTypeId() == 272 || is.getTypeId() == 273 || is.getTypeId() == 274 || is.getTypeId() == 275|| is.getTypeId() == 291; //STONE
} }
public static boolean isStoneTools(ItemStack is){ public static boolean isStoneTools(ItemStack is){
return is.getTypeId() == 272 || is.getTypeId() == 273 || is.getTypeId() == 274 || is.getTypeId() == 275 || is.getTypeId() == 291; return is.getTypeId() == 272 || is.getTypeId() == 273 || is.getTypeId() == 274 || is.getTypeId() == 275 || is.getTypeId() == 291;
} }
public static boolean isWoodTools(ItemStack is){ public static boolean isWoodTools(ItemStack is){
return is.getTypeId() == 268 || is.getTypeId() == 269 || is.getTypeId() == 270 || is.getTypeId() == 271 || is.getTypeId() == 290; return is.getTypeId() == 268 || is.getTypeId() == 269 || is.getTypeId() == 270 || is.getTypeId() == 271 || is.getTypeId() == 290;
} }
public static boolean isGoldTools(ItemStack is){ public static boolean isGoldTools(ItemStack is){
return is.getTypeId() == 283 || is.getTypeId() == 285 || is.getTypeId() == 286 || is.getTypeId() == 284 || is.getTypeId() == 294; return is.getTypeId() == 283 || is.getTypeId() == 285 || is.getTypeId() == 286 || is.getTypeId() == 284 || is.getTypeId() == 294;
} }
public static boolean isIronTools(ItemStack is){ public static boolean isIronTools(ItemStack is){
return is.getTypeId() == 359 || is.getTypeId() == 256 || is.getTypeId() == 257 || is.getTypeId() == 258 || is.getTypeId() == 267 || is.getTypeId() == 292; return is.getTypeId() == 359 || is.getTypeId() == 256 || is.getTypeId() == 257 || is.getTypeId() == 258 || is.getTypeId() == 267 || is.getTypeId() == 292;
} }
public static boolean isDiamondTools(ItemStack is){
public static boolean isDiamondTools(ItemStack is){ return is.getTypeId() == 276 || is.getTypeId() == 277 || is.getTypeId() == 278 || is.getTypeId() == 279 || is.getTypeId() == 293;
if(is.getTypeId() == 276 || is.getTypeId() == 277 || is.getTypeId() == 278 || is.getTypeId() == 279 || is.getTypeId() == 293) }
{ public static void removeItem(Player player, int typeid)
return true; {
} else { ItemStack[] inventory = player.getInventory().getContents();
return false; for(ItemStack x : inventory){
} if(x != null && x.getTypeId() == typeid){
} if(x.getAmount() == 1){
public static void removeItem(Player player, int typeid) x.setTypeId(0);
{ x.setAmount(0);
ItemStack[] inventory = player.getInventory().getContents(); player.getInventory().setContents(inventory);
for(ItemStack x : inventory){ } else{
if(x != null && x.getTypeId() == typeid){ x.setAmount(x.getAmount() - 1);
if(x.getAmount() == 1){ player.getInventory().setContents(inventory);
x.setTypeId(0); }
x.setAmount(0); return;
player.getInventory().setContents(inventory); }
} else{ }
x.setAmount(x.getAmount() - 1); }
player.getInventory().setContents(inventory); public static boolean hasItem(Player player, int typeid){
} ItemStack[] inventory = player.getInventory().getContents();
return; for(ItemStack x : inventory){
} if(x != null && x.getTypeId() == typeid){
} return true;
} }
public static boolean hasItem(Player player, int typeid){ }
ItemStack[] inventory = player.getInventory().getContents(); return false;
for(ItemStack x : inventory){ }
if(x != null && x.getTypeId() == typeid){ public static short repairCalculate(Player player, short durability, short ramt){
return true; PlayerProfile PP = Users.getProfile(player);
} float bonus = (PP.getSkillLevel(SkillType.REPAIR) / 500);
} bonus = (ramt * bonus);
return false; ramt = ramt+=bonus;
} if(checkPlayerProcRepair(player)){
public static short repairCalculate(Player player, short durability, short ramt){ ramt = (short) (ramt * 2);
PlayerProfile PP = Users.getProfile(player); }
float bonus = (PP.getSkillLevel(SkillType.REPAIR) / 500); durability-=ramt;
bonus = (ramt * bonus); if(durability < 0){
ramt = ramt+=bonus; durability = 0;
if(checkPlayerProcRepair(player)){ }
ramt = (short) (ramt * 2); return durability;
} }
//player.sendMessage(ChatColor.DARK_RED + "test " +ChatColor.BLUE+ ); public static short getRepairAmount(ItemStack is, Player player){
durability-=ramt; short durability = is.getDurability();
// player.sendMessage(ChatColor.DARK_RED + "durability " +ChatColor.BLUE+ durability); short ramt = 0;
if(durability < 0){ switch(is.getTypeId())
durability = 0;
}
return durability;
}
public static short getRepairAmount(ItemStack is, Player player){
short durability = is.getDurability();
short ramt = 0;
switch(is.getTypeId())
{ {
/* /*
* TOOLS * TOOLS
*/ */
//SHEARS
case 359: //SHEARS
ramt = 119; case 359:
break; ramt = Material.SHEARS.getMaxDurability() / 2;
//WOOD SWORD
case 268:
ramt = 30;
break;
//WOOD SHOVEL
case 269:
ramt = 60;
break;
//WOOD PICKAXE
case 270:
ramt = 20;
break;
//WOOD AXE
case 271:
ramt = 20;
break;
//WOOD HOE
case 290:
ramt = 30;
break; break;
//STONE SWORD
/* WOOD TOOLS */
//WOOD SWORD
case 268:
ramt = Material.WOOD_SWORD.getMaxDurability() / 2;
break;
//WOOD SHOVEL
case 269:
ramt = Material.WOOD_SPADE.getMaxDurability();
break;
//WOOD PICKAXE
case 270:
ramt = Material.WOOD_PICKAXE.getMaxDurability() / 3;
break;
//WOOD AXE
case 271:
ramt = Material.WOOD_AXE.getMaxDurability() / 3;
break;
//WOOD HOE
case 290:
ramt = Material.WOOD_HOE.getMaxDurability() / 2;
break;
/* STONE TOOLS */
//STONE SWORD
case 272: case 272:
ramt = 66; ramt = Material.STONE_SWORD.getMaxDurability() / 2;
break; break;
//STONE SHOVEL //STONE SHOVEL
case 273: case 273:
ramt = 132; ramt = Material.STONE_SPADE.getMaxDurability();
break; break;
//STONE PICKAXE //STONE PICKAXE
case 274: case 274:
ramt = 44; ramt = Material.STONE_PICKAXE.getMaxDurability() / 3;
break; break;
//STONE AXE //STONE AXE
case 275: case 275:
ramt = 44; ramt = Material.STONE_AXE.getMaxDurability() / 3;
break; break;
//STONE HOE //STONE HOE
case 291: case 291:
ramt = 66; ramt = Material.STONE_HOE.getMaxDurability() / 2;
break; break;
//GOLD SHOVEL
case 284: /* IRON TOOLS */
ramt = 33;
break; //IRON SWORD
//IRON SHOVEL case 267:
case 256: ramt = Material.IRON_SWORD.getMaxDurability() / 2;
ramt = 251;
break;
//DIAMOND SHOVEL
case 277:
ramt = 1562;
break;
//IRON PICK
case 257:
ramt = 84;
break;
//IRON AXE
case 258:
ramt = 84;
break;
//IRON SWORD
case 267:
ramt = 126;
break;
//IRON HOE
case 292:
ramt = 126;
break;
//DIAMOND SWORD
case 276:
ramt = 781;
break;
//DIAMOND PICK
case 278:
ramt = 521;
break;
//DIAMOND AXE
case 279:
ramt = 521;
break;
//DIAMOND HOE
case 293:
ramt = 781;
break;
//GOLD SWORD
case 283:
ramt = 17;
break;
//GOLD PICK
case 285:
ramt = 11;
break;
//GOLD AXE
case 286:
ramt = 11;
break;
//GOLD HOE
case 294:
ramt = 17;
break;
/*
* ARMOR
*/
case 306:
ramt = 27;
break; break;
case 310: //IRON SHOVEL
ramt = 55; case 256:
break; ramt = Material.IRON_SPADE.getMaxDurability();
break;
//IRON PICK
case 257:
ramt = Material.IRON_PICKAXE.getMaxDurability() / 3;
break;
//IRON AXE
case 258:
ramt = Material.IRON_AXE.getMaxDurability() / 3;
break;
//IRON HOE
case 292:
ramt = Material.IRON_HOE.getMaxDurability() / 2;
break;
/* DIAMOND TOOLS */
//DIAMOND SWORD
case 276:
ramt = Material.DIAMOND_SWORD.getMaxDurability() / 2;
break;
//DIAMOND SHOVEL
case 277:
ramt = Material.DIAMOND_SPADE.getMaxDurability();
break;
//DIAMOND PICK
case 278:
ramt = Material.DIAMOND_PICKAXE.getMaxDurability() / 3;
break;
//DIAMOND AXE
case 279:
ramt = Material.DIAMOND_AXE.getMaxDurability() / 3;
break;
//DIAMOND HOE
case 293:
ramt = Material.DIAMOND_HOE.getMaxDurability() / 2;
break;
/* GOLD TOOLS */
//GOLD SWORD
case 283:
ramt = Material.GOLD_SWORD.getMaxDurability() / 2;
break;
//GOLD SHOVEL
case 284:
ramt = Material.GOLD_SPADE.getMaxDurability();
break;
//GOLD PICK
case 285:
ramt = Material.GOLD_PICKAXE.getMaxDurability() / 3;
break;
//GOLD AXE
case 286:
ramt = Material.GOLD_AXE.getMaxDurability() / 3;
break;
//GOLD HOE
case 294:
ramt = Material.GOLD_HOE.getMaxDurability() / 2;
break;
/*
* ARMOR
*/
/* IRON ARMOR */
//IRON HELMET
case 306:
ramt = Material.IRON_HELMET.getMaxDurability() / 5;
break;
//IRON CHESTPLATE
case 307: case 307:
ramt = 24; ramt = Material.IRON_CHESTPLATE.getMaxDurability() / 8;
break; break;
case 311: //IRON LEGGINGS
ramt = 48;
break;
case 308: case 308:
ramt = 27; ramt = Material.IRON_LEGGINGS.getMaxDurability() / 7;
break; break;
case 312: //IRON BOOTS
ramt = 53;
break;
case 309: case 309:
ramt = 40; ramt = Material.IRON_BOOTS.getMaxDurability() / 4;
break; break;
/* DIAMOND ARMOR */
//DIAMOND HELMET
case 310:
ramt = Material.DIAMOND_HELMET.getMaxDurability() / 5;
break;
//DIAMOND CHESTPLATE
case 311:
ramt = Material.DIAMOND_CHESTPLATE.getMaxDurability() / 8;
break;
//DIAMOND LEGGINGS
case 312:
ramt = Material.DIAMOND_LEGGINGS.getMaxDurability() / 7;
break;
//DIAMOND BOOTS
case 313: case 313:
ramt = 80; ramt = Material.DIAMOND_BOOTS.getMaxDurability() / 4;
break; break;
/* GOLD ARMOR */
//GOLD HELMET
case 314: case 314:
ramt = 13; ramt = Material.GOLD_HELMET.getMaxDurability() / 5;
break; break;
//GOLD CHESTPLATE
case 315: case 315:
ramt = 12; ramt = Material.GOLD_CHESTPLATE.getMaxDurability() / 8;
break; break;
//GOLD LEGGINGS
case 316: case 316:
ramt = 14; ramt = Material.GOLD_LEGGINGS.getMaxDurability() / 7;
break; break;
//GOLD BOOTS
case 317: case 317:
ramt = 20; ramt = Material.GOLD_BOOTS.getMaxDurability() / 4;
break; break;
} }
return repairCalculate(player, durability, ramt); return repairCalculate(player, durability, ramt);
} }
public static void needMoreVespeneGas(ItemStack is, Player player)
{ public static void needMoreVespeneGas(ItemStack is, Player player)
PlayerProfile PP = Users.getProfile(player); {
if ((isDiamondTools(is) || isDiamondArmor(is)) && PP.getSkillLevel(SkillType.REPAIR) < LoadProperties.repairdiamondlevel) PlayerProfile PP = Users.getProfile(player);
{ if ((isDiamondTools(is) || isDiamondArmor(is)) && PP.getSkillLevel(SkillType.REPAIR) < LoadProperties.repairdiamondlevel)
{
player.sendMessage(mcLocale.getString("Skills.AdeptDiamond")); player.sendMessage(mcLocale.getString("Skills.AdeptDiamond"));
} else if (isDiamondTools(is) && !hasItem(player, rDiamond) || isIronTools(is) && !hasItem(player, rIron) || isGoldTools(is) && !hasItem(player, rGold)){ } else if (isDiamondTools(is) && !hasItem(player, rDiamond) || isIronTools(is) && !hasItem(player, rIron) || isGoldTools(is) && !hasItem(player, rGold)){
if(isDiamondTools(is) && !hasItem(player, rDiamond)) if(isDiamondTools(is) && !hasItem(player, rDiamond))
@ -599,10 +654,10 @@ public class Repair {
player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.GOLD+ nGold); player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.GOLD+ nGold);
} else if (is.getAmount() > 1) } else if (is.getAmount() > 1)
player.sendMessage(mcLocale.getString("Skills.StackedItems")); player.sendMessage(mcLocale.getString("Skills.StackedItems"));
} }
public static boolean checkPlayerProcRepair(Player player) public static boolean checkPlayerProcRepair(Player player)
{ {
PlayerProfile PP = Users.getProfile(player); PlayerProfile PP = Users.getProfile(player);
if(player != null) if(player != null)
{ {
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.REPAIR)) if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.REPAIR))
@ -612,13 +667,13 @@ public class Repair {
} }
} }
return false; return false;
} }
public static void repairItem(Player player, Enchantment[] enchants, int[] enchantsLevel) public static void repairItem(Player player, Enchantment[] enchants, int[] enchantsLevel)
{ {
PlayerProfile PP = Users.getProfile(player); PlayerProfile PP = Users.getProfile(player);
ItemStack is = player.getItemInHand(); ItemStack is = player.getItemInHand();
//Handle the enchantments //Handle the enchantments
addEnchants(player.getItemInHand(), enchants, enchantsLevel, PP, player); addEnchants(player.getItemInHand(), enchants, enchantsLevel, PP, player);
player.getItemInHand().setDurability(getRepairAmount(is, player)); player.getItemInHand().setDurability(getRepairAmount(is, player));
} }
} }