mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-23 05:36:46 +01:00
Repair optimizations. LOTS of repair optimizations.
This commit is contained in:
parent
5d8b049a45
commit
a2e41f31ed
@ -42,9 +42,9 @@ public class RepairCommand implements CommandExecutor {
|
|||||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") }));
|
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") }));
|
||||||
player.sendMessage(mcLocale.getString("m.RepairRepairMastery", new Object[] { repairmastery }));
|
player.sendMessage(mcLocale.getString("m.RepairRepairMastery", new Object[] { repairmastery }));
|
||||||
player.sendMessage(mcLocale.getString("m.RepairSuperRepairChance", new Object[] { percentage }));
|
player.sendMessage(mcLocale.getString("m.RepairSuperRepairChance", new Object[] { percentage }));
|
||||||
player.sendMessage(mcLocale.getString("m.ArcaneForgingRank", new Object[] { Repair.getArcaneForgingRank(PP) }));
|
player.sendMessage(mcLocale.getString("m.ArcaneForgingRank", new Object[] { Repair.getArcaneForgingRank(PP.getSkillLevel(SkillType.REPAIR)) }));
|
||||||
player.sendMessage(mcLocale.getString("m.ArcaneEnchantKeepChance", new Object[] { Repair.getEnchantChance(Repair.getArcaneForgingRank(PP)) }));
|
player.sendMessage(mcLocale.getString("m.ArcaneEnchantKeepChance", new Object[] { Repair.getEnchantChance(Repair.getArcaneForgingRank(PP.getSkillLevel(SkillType.REPAIR))) }));
|
||||||
player.sendMessage(mcLocale.getString("m.ArcaneEnchantDowngradeChance", new Object[] { Repair.getDowngradeChance(Repair.getArcaneForgingRank(PP)) }));
|
player.sendMessage(mcLocale.getString("m.ArcaneEnchantDowngradeChance", new Object[] { Repair.getDowngradeChance(Repair.getArcaneForgingRank(PP.getSkillLevel(SkillType.REPAIR))) }));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -241,7 +241,7 @@ public class mcPlayerListener implements Listener
|
|||||||
{
|
{
|
||||||
Repair.repairCheck(player, is, event.getClickedBlock());
|
Repair.repairCheck(player, is, event.getClickedBlock());
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
player.updateInventory();
|
// player.updateInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(LoadProperties.enableAbilities && m.abilityBlockCheck(block))
|
if(LoadProperties.enableAbilities && m.abilityBlockCheck(block))
|
||||||
@ -312,7 +312,7 @@ public class mcPlayerListener implements Listener
|
|||||||
|
|
||||||
if(player.isSneaking() && mcPermissions.getInstance().taming(player) && (action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK))
|
if(player.isSneaking() && mcPermissions.getInstance().taming(player) && (action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK))
|
||||||
{
|
{
|
||||||
if(player.getItemInHand().getType() == Material.BONE && player.getItemInHand().getAmount() > 9)
|
if(player.getItemInHand().getType() == Material.BONE && player.getItemInHand().getAmount() > LoadProperties.bonesConsumedByCOTW)
|
||||||
{
|
{
|
||||||
for(Entity x : player.getNearbyEntities(40, 40, 40))
|
for(Entity x : player.getNearbyEntities(40, 40, 40))
|
||||||
{
|
{
|
||||||
@ -325,24 +325,27 @@ public class mcPlayerListener implements Listener
|
|||||||
World world = player.getWorld();
|
World world = player.getWorld();
|
||||||
world.spawnCreature(player.getLocation(), EntityType.WOLF);
|
world.spawnCreature(player.getLocation(), EntityType.WOLF);
|
||||||
|
|
||||||
ItemStack[] inventory = player.getInventory().getContents();
|
int bones = player.getItemInHand().getAmount();
|
||||||
for(ItemStack x : inventory){
|
bones = bones - LoadProperties.bonesConsumedByCOTW;
|
||||||
if(x != null && x.getAmount() > LoadProperties.bonesConsumedByCOTW-1 && x.getType() == Material.BONE){
|
player.setItemInHand(new ItemStack(Material.BONE, bones));
|
||||||
if(x.getAmount() >= LoadProperties.bonesConsumedByCOTW)
|
// ItemStack[] inventory = player.getInventory().getContents();
|
||||||
{
|
// for(ItemStack x : inventory){
|
||||||
x.setAmount(x.getAmount() - LoadProperties.bonesConsumedByCOTW);
|
// if(x != null && x.getAmount() > LoadProperties.bonesConsumedByCOTW-1 && x.getType() == Material.BONE){
|
||||||
player.getInventory().setContents(inventory);
|
// if(x.getAmount() >= LoadProperties.bonesConsumedByCOTW)
|
||||||
player.updateInventory();
|
// {
|
||||||
break;
|
// x.setAmount(x.getAmount() - LoadProperties.bonesConsumedByCOTW);
|
||||||
} else {
|
// player.getInventory().setContents(inventory);
|
||||||
x.setAmount(0);
|
// player.updateInventory();
|
||||||
x.setTypeId(0);
|
// break;
|
||||||
player.getInventory().setContents(inventory);
|
// } else {
|
||||||
player.updateInventory();
|
// x.setAmount(0);
|
||||||
break;
|
// x.setTypeId(0);
|
||||||
}
|
// player.getInventory().setContents(inventory);
|
||||||
}
|
// player.updateInventory();
|
||||||
}
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
player.sendMessage(mcLocale.getString("m.TamingSummon"));
|
player.sendMessage(mcLocale.getString("m.TamingSummon"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -228,6 +228,30 @@ public class m
|
|||||||
return id == 270 || id == 274 || id == 285 || id == 257 || id == 278;
|
return id == 270 || id == 274 || id == 285 || id == 257 || id == 278;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isHelmet(ItemStack is)
|
||||||
|
{
|
||||||
|
int id = is.getTypeId();
|
||||||
|
return id == 298 || id == 306 || id == 310 || id == 314;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isChestplate(ItemStack is)
|
||||||
|
{
|
||||||
|
int id = is.getTypeId();
|
||||||
|
return id == 299 || id == 307 || id == 311 || id == 315;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isPants(ItemStack is)
|
||||||
|
{
|
||||||
|
int id = is.getTypeId();
|
||||||
|
return id == 300 || id == 308 || id == 312 || id == 316;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isBoots(ItemStack is)
|
||||||
|
{
|
||||||
|
int id = is.getTypeId();
|
||||||
|
return id == 301 || id == 305 || id == 313 || id == 317;
|
||||||
|
}
|
||||||
|
|
||||||
public static void convertToMySQL()
|
public static void convertToMySQL()
|
||||||
{
|
{
|
||||||
if(!LoadProperties.useMySQL)
|
if(!LoadProperties.useMySQL)
|
||||||
|
@ -16,12 +16,13 @@
|
|||||||
*/
|
*/
|
||||||
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;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
|
|
||||||
import com.gmail.nossr50.Users;
|
import com.gmail.nossr50.Users;
|
||||||
import com.gmail.nossr50.m;
|
import com.gmail.nossr50.m;
|
||||||
import com.gmail.nossr50.mcPermissions;
|
import com.gmail.nossr50.mcPermissions;
|
||||||
@ -34,9 +35,6 @@ import com.gmail.nossr50.locale.mcLocale;
|
|||||||
|
|
||||||
public class Repair {
|
public class Repair {
|
||||||
|
|
||||||
/*
|
|
||||||
* 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;
|
||||||
@ -52,11 +50,17 @@ public class Repair {
|
|||||||
private static int rLeather = LoadProperties.rLeather;
|
private static int rLeather = LoadProperties.rLeather;
|
||||||
private static String nLeather = LoadProperties.nLeather;
|
private static String nLeather = LoadProperties.nLeather;
|
||||||
|
|
||||||
|
private static int dLevel = LoadProperties.repairdiamondlevel;
|
||||||
|
private static int iLevel = LoadProperties.repairIronLevel;
|
||||||
|
private static int gLevel = LoadProperties.repairGoldLevel;
|
||||||
|
private static int sLevel = LoadProperties.repairStoneLevel;
|
||||||
|
private static boolean spout = LoadProperties.spoutEnabled;
|
||||||
|
|
||||||
public static void repairCheck(Player player, ItemStack is, Block block){
|
public static void repairCheck(Player player, ItemStack is, Block block){
|
||||||
PlayerProfile PP = Users.getProfile(player);
|
PlayerProfile PP = Users.getProfile(player);
|
||||||
short durabilityBefore = player.getItemInHand().getDurability();
|
short durabilityBefore = is.getDurability();
|
||||||
short durabilityAfter = 0;
|
PlayerInventory inventory = player.getInventory();
|
||||||
short dif = 0;
|
int skillLevel = PP.getSkillLevel(SkillType.REPAIR);
|
||||||
|
|
||||||
//Stuff for keeping enchants
|
//Stuff for keeping enchants
|
||||||
Enchantment[] enchants = new Enchantment[is.getEnchantments().size()];
|
Enchantment[] enchants = new Enchantment[is.getEnchantments().size()];
|
||||||
@ -71,7 +75,7 @@ public class Repair {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(block != null && mcPermissions.getInstance().repair(player)){
|
if(block != null && mcPermissions.getInstance().repair(player)){
|
||||||
if(player.getItemInHand().getDurability() > 0 && player.getItemInHand().getAmount() < 2){
|
if(durabilityBefore > 0 && is.getAmount() < 2){
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* REPAIR ARMOR
|
* REPAIR ARMOR
|
||||||
@ -79,63 +83,31 @@ public class Repair {
|
|||||||
if(isArmor(is) && LoadProperties.repairArmor){
|
if(isArmor(is) && LoadProperties.repairArmor){
|
||||||
|
|
||||||
//DIAMOND ARMOR
|
//DIAMOND ARMOR
|
||||||
if(isDiamondArmor(is) && hasItem(player, rDiamond) && PP.getSkillLevel(SkillType.REPAIR) >= LoadProperties.repairdiamondlevel){
|
if(isDiamondArmor(is) && inventory.contains(rDiamond) && skillLevel >= dLevel){
|
||||||
removeItem(player, rDiamond);
|
inventory.removeItem(new ItemStack(rDiamond, 1));
|
||||||
repairItem(player, enchants, enchantsLevel);
|
repairItem(player, enchants, enchantsLevel);
|
||||||
|
xpHandler(player, PP, is, durabilityBefore, 6, true);
|
||||||
durabilityAfter = player.getItemInHand().getDurability();
|
|
||||||
dif = (short) (durabilityBefore - durabilityAfter);
|
|
||||||
dif = (short) (dif * 6); //Boost XP
|
|
||||||
PP.addXP(SkillType.REPAIR, dif*10, player);
|
|
||||||
|
|
||||||
//CLANG CLANG
|
|
||||||
if(LoadProperties.spoutEnabled)
|
|
||||||
SpoutStuff.playRepairNoise(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//IRON ARMOR
|
//IRON ARMOR
|
||||||
else if (isIronArmor(is) && hasItem(player, rIron) && PP.getSkillLevel(SkillType.REPAIR) >= LoadProperties.repairIronLevel){
|
else if (isIronArmor(is) && inventory.contains(rIron) && skillLevel >= iLevel){
|
||||||
removeItem(player, rIron);
|
inventory.removeItem(new ItemStack(rIron, 1));
|
||||||
repairItem(player, enchants, enchantsLevel);
|
repairItem(player, enchants, enchantsLevel);
|
||||||
|
xpHandler(player, PP, is, durabilityBefore, 2, true);
|
||||||
durabilityAfter = player.getItemInHand().getDurability();
|
|
||||||
dif = (short) (durabilityBefore - durabilityAfter);
|
|
||||||
dif = (short) (dif * 2); //Boost XP
|
|
||||||
PP.addXP(SkillType.REPAIR, dif*10, player);
|
|
||||||
|
|
||||||
//CLANG CLANG
|
|
||||||
if(LoadProperties.spoutEnabled)
|
|
||||||
SpoutStuff.playRepairNoise(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//GOLD ARMOR
|
//GOLD ARMOR
|
||||||
else if (isGoldArmor(is) && hasItem(player, rGold) && PP.getSkillLevel(SkillType.REPAIR) >= LoadProperties.repairGoldLevel){
|
else if (isGoldArmor(is) && inventory.contains(rGold) && skillLevel >= gLevel){
|
||||||
removeItem(player, rGold);
|
inventory.removeItem(new ItemStack(rGold, 1));
|
||||||
repairItem(player, enchants, enchantsLevel);
|
repairItem(player, enchants, enchantsLevel);
|
||||||
|
xpHandler(player, PP, is, durabilityBefore, 4, true);
|
||||||
durabilityAfter = player.getItemInHand().getDurability();
|
|
||||||
dif = (short) (durabilityBefore - durabilityAfter);
|
|
||||||
dif = (short) (dif * 4); //Boost XP
|
|
||||||
PP.addXP(SkillType.REPAIR, dif*10, player);
|
|
||||||
|
|
||||||
//CLANG CLANG
|
|
||||||
if(LoadProperties.spoutEnabled)
|
|
||||||
SpoutStuff.playRepairNoise(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//LEATHER ARMOR
|
//LEATHER ARMOR
|
||||||
else if (isLeatherArmor(is) && hasItem(player, rLeather)){
|
else if (isLeatherArmor(is) && inventory.contains(rLeather)){
|
||||||
removeItem(player, rLeather);
|
inventory.removeItem(new ItemStack(rLeather, 1));
|
||||||
repairItem(player, enchants, enchantsLevel);
|
repairItem(player, enchants, enchantsLevel);
|
||||||
|
xpHandler(player, PP, is, durabilityBefore, 1, true);
|
||||||
durabilityAfter = player.getItemInHand().getDurability();
|
|
||||||
dif = (short) (durabilityBefore - durabilityAfter);
|
|
||||||
dif = (short) (dif * 1); //Boost XP
|
|
||||||
PP.addXP(SkillType.REPAIR, dif*10, player);
|
|
||||||
|
|
||||||
//CLANG CLANG
|
|
||||||
if(LoadProperties.spoutEnabled)
|
|
||||||
SpoutStuff.playRepairNoise(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//UNABLE TO REPAIR
|
//UNABLE TO REPAIR
|
||||||
@ -150,124 +122,45 @@ public class Repair {
|
|||||||
if(isTools(is) && LoadProperties.repairTools){
|
if(isTools(is) && LoadProperties.repairTools){
|
||||||
|
|
||||||
//STONE TOOLS
|
//STONE TOOLS
|
||||||
if(isStoneTools(is) && hasItem(player, rStone) && PP.getSkillLevel(SkillType.REPAIR) >= LoadProperties.repairStoneLevel){
|
if(isStoneTools(is) && inventory.contains(rStone) && skillLevel >= sLevel){
|
||||||
removeItem(player, rStone);
|
inventory.removeItem(new ItemStack(rStone, 1));
|
||||||
repairItem(player, enchants, enchantsLevel);
|
repairItem(player, enchants, enchantsLevel);
|
||||||
|
xpHandler(player, PP, is, durabilityBefore, 2, false);
|
||||||
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);
|
|
||||||
//STONE NERF
|
|
||||||
dif = (short) (dif / 2);
|
|
||||||
|
|
||||||
PP.addXP(SkillType.REPAIR, dif*10, player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//WOOD TOOLS
|
//WOOD TOOLS
|
||||||
else if(isWoodTools(is) && hasItem(player,rWood)){
|
else if(isWoodTools(is) && inventory.contains(rWood)){
|
||||||
removeItem(player,rWood);
|
inventory.removeItem(new ItemStack(rWood, 1));
|
||||||
repairItem(player, enchants, enchantsLevel);
|
repairItem(player, enchants, enchantsLevel);
|
||||||
|
xpHandler(player, PP, is, durabilityBefore, 2, false);
|
||||||
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);
|
|
||||||
//WOOD NERF
|
|
||||||
dif = (short) (dif / 2);
|
|
||||||
|
|
||||||
PP.addXP(SkillType.REPAIR, dif*10, player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//IRON TOOLS
|
//IRON TOOLS
|
||||||
else if(isIronTools(is) && hasItem(player, rIron) && PP.getSkillLevel(SkillType.REPAIR) >= LoadProperties.repairIronLevel){
|
else if(isIronTools(is) && inventory.contains(rIron) && skillLevel >= iLevel){
|
||||||
removeItem(player, rIron);
|
inventory.removeItem(new ItemStack(rIron, 1));
|
||||||
repairItem(player, enchants, enchantsLevel);
|
repairItem(player, enchants, enchantsLevel);
|
||||||
|
xpHandler(player, PP, is, durabilityBefore, 1, true);
|
||||||
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);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//DIAMOND TOOLS
|
//DIAMOND TOOLS
|
||||||
else if (isDiamondTools(is) && hasItem(player, rDiamond) && PP.getSkillLevel(SkillType.REPAIR) >= LoadProperties.repairdiamondlevel){
|
else if (isDiamondTools(is) && inventory.contains(rDiamond) && skillLevel >= dLevel){
|
||||||
removeItem(player, rDiamond);
|
inventory.removeItem(new ItemStack(rDiamond, 1));
|
||||||
repairItem(player, enchants, enchantsLevel);
|
repairItem(player, enchants, enchantsLevel);
|
||||||
|
xpHandler(player, PP, is, durabilityBefore, 1, true);
|
||||||
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
|
//GOLD TOOLS
|
||||||
else if(isGoldTools(is) && hasItem(player, rGold) && PP.getSkillLevel(SkillType.REPAIR) >= LoadProperties.repairGoldLevel){
|
else if(isGoldTools(is) && inventory.contains(rGold) && skillLevel >= gLevel){
|
||||||
removeItem(player, rGold);
|
inventory.removeItem(new ItemStack(rGold, 1));
|
||||||
repairItem(player, enchants, enchantsLevel);
|
repairItem(player, enchants, enchantsLevel);
|
||||||
|
xpHandler(player, PP, is, durabilityBefore, 8, true);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//BOW
|
//BOW
|
||||||
else if(isBow(is) && hasItem(player, rString)){
|
else if(isBow(is) && inventory.contains(rString)){
|
||||||
removeItem(player, rString);
|
inventory.removeItem(new ItemStack(rString, 1));
|
||||||
repairItem(player, enchants, enchantsLevel);
|
repairItem(player, enchants, enchantsLevel);
|
||||||
|
xpHandler(player, PP, is, durabilityBefore, 2, false);
|
||||||
durabilityAfter = player.getItemInHand().getDurability();
|
|
||||||
dif = (short) (durabilityBefore - durabilityAfter);
|
|
||||||
|
|
||||||
//STRING NERF
|
|
||||||
dif = (short) (dif / 2);
|
|
||||||
|
|
||||||
PP.addXP(SkillType.REPAIR, dif*10, player);
|
|
||||||
|
|
||||||
|
|
||||||
//CLANG CLANG
|
|
||||||
if(LoadProperties.spoutEnabled)
|
|
||||||
SpoutStuff.playRepairNoise(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//UNABLE TO REPAIR
|
//UNABLE TO REPAIR
|
||||||
@ -288,22 +181,46 @@ public class Repair {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getArcaneForgingRank(PlayerProfile PP){
|
public static void xpHandler(Player player, PlayerProfile PP, ItemStack is, short durabilityBefore, int modify, boolean boost)
|
||||||
int rank = 0;
|
{
|
||||||
|
short durabilityAfter = is.getDurability();
|
||||||
|
short dif = (short) (durabilityBefore - durabilityAfter);
|
||||||
|
if(boost)
|
||||||
|
dif = (short) (dif * modify);
|
||||||
|
if(!boost)
|
||||||
|
dif = (short) (dif / modify);
|
||||||
|
if(m.isShovel(is))
|
||||||
|
dif = (short) (dif / 3);
|
||||||
|
if(m.isSwords(is))
|
||||||
|
dif = (short) (dif / 2);
|
||||||
|
if(m.isHoe(is))
|
||||||
|
dif = (short) (dif / 2);
|
||||||
|
|
||||||
if(PP.getSkillLevel(SkillType.REPAIR) >= LoadProperties.arcaneRank4)
|
PP.addXP(SkillType.REPAIR, dif*10, player);
|
||||||
rank = 4;
|
|
||||||
|
|
||||||
else if (PP.getSkillLevel(SkillType.REPAIR) >= LoadProperties.arcaneRank3)
|
//CLANG CLANG
|
||||||
rank = 3;
|
if(spout)
|
||||||
|
SpoutStuff.playRepairNoise(player);
|
||||||
|
}
|
||||||
|
|
||||||
else if(PP.getSkillLevel(SkillType.REPAIR) >= LoadProperties.arcaneRank2)
|
/**
|
||||||
rank = 2;
|
* Get current Arcane Forging rank.
|
||||||
|
*
|
||||||
|
* @param skillLevel The skill level of the player whose rank is being checked
|
||||||
|
* @return The player's current Arcane Forging rank
|
||||||
|
*/
|
||||||
|
public static int getArcaneForgingRank(int skillLevel)
|
||||||
|
{
|
||||||
|
if(skillLevel >= LoadProperties.arcaneRank4)
|
||||||
|
return 4;
|
||||||
|
if (skillLevel >= LoadProperties.arcaneRank3)
|
||||||
|
return 3;
|
||||||
|
if(skillLevel >= LoadProperties.arcaneRank2)
|
||||||
|
return 2;
|
||||||
|
if (skillLevel >= LoadProperties.arcaneRank1)
|
||||||
|
return 1;
|
||||||
|
|
||||||
else if (PP.getSkillLevel(SkillType.REPAIR) >= LoadProperties.arcaneRank1)
|
return 0;
|
||||||
rank = 1;
|
|
||||||
|
|
||||||
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){
|
||||||
@ -311,7 +228,7 @@ public class Repair {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
int rank = getArcaneForgingRank(PP);
|
int rank = getArcaneForgingRank(PP.getSkillLevel(SkillType.REPAIR));
|
||||||
|
|
||||||
if(rank == 0)
|
if(rank == 0)
|
||||||
{
|
{
|
||||||
@ -374,7 +291,15 @@ public class Repair {
|
|||||||
player.sendMessage(mcLocale.getString("Repair.Downgraded"));
|
player.sendMessage(mcLocale.getString("Repair.Downgraded"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static int getEnchantChance(int rank){
|
|
||||||
|
/**
|
||||||
|
* Gets chance of keeping enchantment during repair.
|
||||||
|
*
|
||||||
|
* @param rank Arcane Forging rank
|
||||||
|
* @return The chance of keeping the enchantment
|
||||||
|
*/
|
||||||
|
public static int getEnchantChance(int rank)
|
||||||
|
{
|
||||||
switch(rank)
|
switch(rank)
|
||||||
{
|
{
|
||||||
case 4:
|
case 4:
|
||||||
@ -389,6 +314,13 @@ public class Repair {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets chance of enchantment being downgraded during repair.
|
||||||
|
*
|
||||||
|
* @param rank Arcane Forging rank
|
||||||
|
* @return The chance of the enchantment being downgraded
|
||||||
|
*/
|
||||||
public static int getDowngradeChance(int rank)
|
public static int getDowngradeChance(int rank)
|
||||||
{
|
{
|
||||||
switch(rank)
|
switch(rank)
|
||||||
@ -405,6 +337,7 @@ public class Repair {
|
|||||||
return 100;
|
return 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 || //IRON
|
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 || //DIAMOND
|
is.getTypeId() == 310 ||is.getTypeId() == 311 ||is.getTypeId() == 312 ||is.getTypeId() == 313 || //DIAMOND
|
||||||
@ -450,312 +383,139 @@ public class Repair {
|
|||||||
public static boolean isBow(ItemStack is){
|
public static boolean isBow(ItemStack is){
|
||||||
return is.getTypeId() == 261;
|
return is.getTypeId() == 261;
|
||||||
}
|
}
|
||||||
public static void removeItem(Player player, int typeid)
|
|
||||||
{
|
/**
|
||||||
ItemStack[] inventory = player.getInventory().getContents();
|
* Computes repair bonuses.
|
||||||
for(ItemStack x : inventory){
|
*
|
||||||
if(x != null && x.getTypeId() == typeid){
|
* @param player The player repairing an item
|
||||||
if(x.getAmount() == 1){
|
* @param durability The durability of the item being repaired
|
||||||
x.setTypeId(0);
|
* @param ramt The base amount of durability repaired to the item
|
||||||
x.setAmount(0);
|
* @return The final amount of durability repaired to the item
|
||||||
player.getInventory().setContents(inventory);
|
*/
|
||||||
} else{
|
|
||||||
x.setAmount(x.getAmount() - 1);
|
|
||||||
player.getInventory().setContents(inventory);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static boolean hasItem(Player player, int typeid){
|
|
||||||
ItemStack[] inventory = player.getInventory().getContents();
|
|
||||||
for(ItemStack x : inventory){
|
|
||||||
if(x != null && x.getTypeId() == typeid){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
public static short repairCalculate(Player player, short durability, int ramt){
|
public static short repairCalculate(Player player, short durability, int ramt){
|
||||||
PlayerProfile PP = Users.getProfile(player);
|
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.REPAIR);
|
||||||
float bonus = (float)(PP.getSkillLevel(SkillType.REPAIR)) / 500;
|
float bonus = (float)(skillLevel/500);
|
||||||
bonus = (ramt * bonus);
|
bonus = (ramt * bonus);
|
||||||
ramt+=bonus;
|
ramt+=bonus;
|
||||||
if(checkPlayerProcRepair(player)){
|
if(checkPlayerProcRepair(player))
|
||||||
ramt = (short) (ramt * 2);
|
ramt = (short) (ramt * 2);
|
||||||
}
|
|
||||||
durability-=ramt;
|
durability-=ramt;
|
||||||
if(durability < 0){
|
if(durability < 0)
|
||||||
durability = 0;
|
durability = 0;
|
||||||
}
|
|
||||||
return durability;
|
return durability;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the base durability amount to repair an item.
|
||||||
|
*
|
||||||
|
* @param is The item being repaired
|
||||||
|
* @param player The player repairing the item
|
||||||
|
* @return The final amount of durability repaired to the item
|
||||||
|
*/
|
||||||
public static short getRepairAmount(ItemStack is, Player player){
|
public static short getRepairAmount(ItemStack is, Player player){
|
||||||
short durability = is.getDurability();
|
short durability = is.getDurability();
|
||||||
|
short maxDurability = is.getType().getMaxDurability();
|
||||||
int ramt = 0;
|
int ramt = 0;
|
||||||
switch(is.getTypeId())
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* TOOLS
|
|
||||||
*/
|
|
||||||
|
|
||||||
//SHEARS
|
if(m.isShovel(is))
|
||||||
case 359:
|
ramt = maxDurability;
|
||||||
ramt = Material.SHEARS.getMaxDurability() / 2;
|
else if(m.isHoe(is) || m.isSwords(is) || is.getTypeId() == 359)
|
||||||
break;
|
ramt = maxDurability / 2;
|
||||||
|
else if(m.isAxes(is) || m.isMiningPick(is) || isBow(is))
|
||||||
//BOW
|
ramt = maxDurability / 3;
|
||||||
case 261:
|
else if(m.isBoots(is))
|
||||||
ramt = Material.BOW.getMaxDurability() / 3;
|
ramt = maxDurability / 4;
|
||||||
break;
|
else if(m.isHelmet(is))
|
||||||
|
ramt = maxDurability / 5;
|
||||||
/* WOOD TOOLS */
|
else if(m.isPants(is))
|
||||||
|
ramt = maxDurability / 7;
|
||||||
//WOOD SWORD
|
else if(m.isChestplate(is))
|
||||||
case 268:
|
ramt = maxDurability / 8;
|
||||||
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:
|
|
||||||
ramt = Material.STONE_SWORD.getMaxDurability() / 2;
|
|
||||||
break;
|
|
||||||
//STONE SHOVEL
|
|
||||||
case 273:
|
|
||||||
ramt = Material.STONE_SPADE.getMaxDurability();
|
|
||||||
break;
|
|
||||||
//STONE PICKAXE
|
|
||||||
case 274:
|
|
||||||
ramt = Material.STONE_PICKAXE.getMaxDurability() / 3;
|
|
||||||
break;
|
|
||||||
//STONE AXE
|
|
||||||
case 275:
|
|
||||||
ramt = Material.STONE_AXE.getMaxDurability() / 3;
|
|
||||||
break;
|
|
||||||
//STONE HOE
|
|
||||||
case 291:
|
|
||||||
ramt = Material.STONE_HOE.getMaxDurability() / 2;
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* IRON TOOLS */
|
|
||||||
|
|
||||||
//IRON SWORD
|
|
||||||
case 267:
|
|
||||||
ramt = Material.IRON_SWORD.getMaxDurability() / 2;
|
|
||||||
break;
|
|
||||||
//IRON SHOVEL
|
|
||||||
case 256:
|
|
||||||
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:
|
|
||||||
ramt = Material.IRON_CHESTPLATE.getMaxDurability() / 8;
|
|
||||||
break;
|
|
||||||
//IRON LEGGINGS
|
|
||||||
case 308:
|
|
||||||
ramt = Material.IRON_LEGGINGS.getMaxDurability() / 7;
|
|
||||||
break;
|
|
||||||
//IRON BOOTS
|
|
||||||
case 309:
|
|
||||||
ramt = Material.IRON_BOOTS.getMaxDurability() / 4;
|
|
||||||
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:
|
|
||||||
ramt = Material.DIAMOND_BOOTS.getMaxDurability() / 4;
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* GOLD ARMOR */
|
|
||||||
|
|
||||||
//GOLD HELMET
|
|
||||||
case 314:
|
|
||||||
ramt = Material.GOLD_HELMET.getMaxDurability() / 5;
|
|
||||||
break;
|
|
||||||
//GOLD CHESTPLATE
|
|
||||||
case 315:
|
|
||||||
ramt = Material.GOLD_CHESTPLATE.getMaxDurability() / 8;
|
|
||||||
break;
|
|
||||||
//GOLD LEGGINGS
|
|
||||||
case 316:
|
|
||||||
ramt = Material.GOLD_LEGGINGS.getMaxDurability() / 7;
|
|
||||||
break;
|
|
||||||
//GOLD BOOTS
|
|
||||||
case 317:
|
|
||||||
ramt = Material.GOLD_BOOTS.getMaxDurability() / 4;
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* LEATHER ARMOR */
|
|
||||||
|
|
||||||
//LEATHER HELMET
|
|
||||||
case 298:
|
|
||||||
ramt = Material.LEATHER_HELMET.getMaxDurability() / 5;
|
|
||||||
break;
|
|
||||||
//LEATHER CHESTPLATE
|
|
||||||
case 299:
|
|
||||||
ramt = Material.LEATHER_CHESTPLATE.getMaxDurability() / 8;
|
|
||||||
break;
|
|
||||||
//LEATHER LEGGINGS
|
|
||||||
case 300:
|
|
||||||
ramt = Material.LEATHER_LEGGINGS.getMaxDurability() / 7;
|
|
||||||
break;
|
|
||||||
//LEATHER BOOTS
|
|
||||||
case 301:
|
|
||||||
ramt = Material.LEATHER_BOOTS.getMaxDurability() / 4;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return repairCalculate(player, durability, ramt);
|
return repairCalculate(player, durability, ramt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informs a player that the repair has failed.
|
||||||
|
*
|
||||||
|
* @param is The item being repaired
|
||||||
|
* @param player The player repairing the item
|
||||||
|
*/
|
||||||
public static void needMoreVespeneGas(ItemStack is, Player player)
|
public static void needMoreVespeneGas(ItemStack is, Player player)
|
||||||
{
|
{
|
||||||
PlayerProfile PP = Users.getProfile(player);
|
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.REPAIR);
|
||||||
if ((isDiamondTools(is) || isDiamondArmor(is)) && PP.getSkillLevel(SkillType.REPAIR) < LoadProperties.repairdiamondlevel)
|
|
||||||
{
|
if(is.getAmount() > 1)
|
||||||
player.sendMessage(mcLocale.getString("Skills.AdeptDiamond"));
|
|
||||||
} else if (isDiamondTools(is) && !hasItem(player, rDiamond) || isIronTools(is) && !hasItem(player, rIron) || isGoldTools(is) && !hasItem(player, rGold)){
|
|
||||||
if(isDiamondTools(is) && !hasItem(player, rDiamond))
|
|
||||||
player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.BLUE+ nDiamond);
|
|
||||||
if(isIronTools(is) && !hasItem(player, rIron))
|
|
||||||
player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.GRAY+ nIron);
|
|
||||||
if(isGoldTools(is) && !hasItem(player, rGold))
|
|
||||||
player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.GOLD+nGold);
|
|
||||||
if(isWoodTools(is) && !hasItem(player,rWood))
|
|
||||||
player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.DARK_GREEN+ nWood);
|
|
||||||
if(isStoneTools(is) && !hasItem(player, rStone))
|
|
||||||
player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.GRAY+nStone);
|
|
||||||
} else if (isDiamondArmor(is) && !hasItem(player, rDiamond)){
|
|
||||||
player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.BLUE+ nDiamond);
|
|
||||||
} else if (isIronArmor(is) && !hasItem(player, rIron)){
|
|
||||||
player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.GRAY+ nIron);
|
|
||||||
} else if (isGoldArmor(is) && !hasItem(player, rGold)){
|
|
||||||
player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.GOLD+ nGold);
|
|
||||||
} else if (isLeatherArmor(is) && !hasItem(player, rLeather)){
|
|
||||||
player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.YELLOW+ nLeather);
|
|
||||||
} else if (isBow(is) && !hasItem(player, rString)){
|
|
||||||
player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.YELLOW+ nString);
|
|
||||||
} else if (is.getAmount() > 1)
|
|
||||||
player.sendMessage(mcLocale.getString("Skills.StackedItems"));
|
player.sendMessage(mcLocale.getString("Skills.StackedItems"));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(isDiamondTools(is) || isDiamondArmor(is))
|
||||||
|
{
|
||||||
|
if(skillLevel < LoadProperties.repairdiamondlevel)
|
||||||
|
player.sendMessage(mcLocale.getString("Skills.AdeptDiamond"));
|
||||||
|
else
|
||||||
|
player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.BLUE+ nDiamond);
|
||||||
}
|
}
|
||||||
|
else if(isIronTools(is) || isIronArmor(is))
|
||||||
|
{
|
||||||
|
if(skillLevel < LoadProperties.repairIronLevel)
|
||||||
|
player.sendMessage(mcLocale.getString("Skills.AdeptIron"));
|
||||||
|
else
|
||||||
|
player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.GRAY+ nIron);
|
||||||
|
}
|
||||||
|
else if(isGoldTools(is) || isGoldArmor(is))
|
||||||
|
{
|
||||||
|
if(skillLevel < LoadProperties.repairGoldLevel)
|
||||||
|
player.sendMessage(mcLocale.getString("Skills.AdeptGold"));
|
||||||
|
else
|
||||||
|
player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.GOLD+nGold);
|
||||||
|
}
|
||||||
|
else if(isStoneTools(is))
|
||||||
|
{
|
||||||
|
if(skillLevel < LoadProperties.repairStoneLevel)
|
||||||
|
player.sendMessage(mcLocale.getString("Skills.AdeptStone"));
|
||||||
|
else
|
||||||
|
player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.GRAY+nStone);
|
||||||
|
}
|
||||||
|
else if(isWoodTools(is))
|
||||||
|
player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.DARK_GREEN+ nWood);
|
||||||
|
else if (isLeatherArmor(is))
|
||||||
|
player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.YELLOW+ nLeather);
|
||||||
|
else if (isBow(is))
|
||||||
|
player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.YELLOW+ nString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks for Super Repair bonus.
|
||||||
|
*
|
||||||
|
* @param player The player repairing an item.
|
||||||
|
* @return true if bonus granted, false otherwise
|
||||||
|
*/
|
||||||
public static boolean checkPlayerProcRepair(Player player)
|
public static boolean checkPlayerProcRepair(Player player)
|
||||||
{
|
{
|
||||||
PlayerProfile PP = Users.getProfile(player);
|
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.REPAIR);
|
||||||
if(player != null)
|
if(skillLevel > 1000 || (Math.random() * 1000 <= skillLevel))
|
||||||
{
|
|
||||||
if(PP.getSkillLevel(SkillType.REPAIR) > 1000 || (Math.random() * 1000 <= PP.getSkillLevel(SkillType.REPAIR)))
|
|
||||||
{
|
{
|
||||||
player.sendMessage(mcLocale.getString("Skills.FeltEasy"));
|
player.sendMessage(mcLocale.getString("Skills.FeltEasy"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repairs an item.
|
||||||
|
*
|
||||||
|
* @param player The player repairing an item
|
||||||
|
* @param enchants The enchantments on the item
|
||||||
|
* @param enchantsLevel The level of the enchantments on the item
|
||||||
|
*/
|
||||||
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(is, enchants, enchantsLevel, PP, player);
|
||||||
player.getItemInHand().setDurability(getRepairAmount(is, player));
|
is.setDurability(getRepairAmount(is, player));
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -397,3 +397,6 @@ m.BlastMining5 = +25% ore yield, no debris, double drops
|
|||||||
m.BlastMining6 = +30% ore yield, no debris, double drops
|
m.BlastMining6 = +30% ore yield, no debris, double drops
|
||||||
m.BlastMining7 = +35% ore yield, no debris, triple drops
|
m.BlastMining7 = +35% ore yield, no debris, triple drops
|
||||||
m.BlastMining8 = +40% ore yield, no debris, triple drops
|
m.BlastMining8 = +40% ore yield, no debris, triple drops
|
||||||
|
Skills.AdeptStone=[[DARK_RED]]You're not skilled enough to repair Stone.
|
||||||
|
Skills.AdeptIron=[[DARK_RED]]You're not skilled enough to repair Iron.
|
||||||
|
Skills.AdeptGold=[[DARK_RED]]You're not skilled enough to repair Gold.
|
@ -299,7 +299,7 @@ Skills.ExcavationUp=[[YELLOW]]Excavation skill increased by {0}. Total ({1})
|
|||||||
Skills.FeltEasy=[[GRAY]]That felt easy.
|
Skills.FeltEasy=[[GRAY]]That felt easy.
|
||||||
Skills.StackedItems=[[DARK_RED]]You can't repair stacked items
|
Skills.StackedItems=[[DARK_RED]]You can't repair stacked items
|
||||||
Skills.NeedMore=[[DARK_RED]]You need more
|
Skills.NeedMore=[[DARK_RED]]You need more
|
||||||
Skills.AdeptDiamond=[[DARK_RED]]You're not skilled enough to repair Diamond
|
Skills.AdeptDiamond=[[DARK_RED]]You're not skilled enough to repair Diamond.
|
||||||
Skills.FullDurability=[[GRAY]]That is at full durability.
|
Skills.FullDurability=[[GRAY]]That is at full durability.
|
||||||
Skills.Disarmed=[[DARK_RED]]You have been disarmed!
|
Skills.Disarmed=[[DARK_RED]]You have been disarmed!
|
||||||
m.LVL=[[DARK_GRAY]]LVL: [[GREEN]]{0} [[DARK_AQUA]]XP[[YELLOW]]([[GOLD]]{1}[[YELLOW]]/[[GOLD]]{2}[[YELLOW]])
|
m.LVL=[[DARK_GRAY]]LVL: [[GREEN]]{0} [[DARK_AQUA]]XP[[YELLOW]]([[GOLD]]{1}[[YELLOW]]/[[GOLD]]{2}[[YELLOW]])
|
||||||
@ -392,3 +392,6 @@ m.BlastMining5 = +25% ore yield, no debris, double drops
|
|||||||
m.BlastMining6 = +30% ore yield, no debris, double drops
|
m.BlastMining6 = +30% ore yield, no debris, double drops
|
||||||
m.BlastMining7 = +35% ore yield, no debris, triple drops
|
m.BlastMining7 = +35% ore yield, no debris, triple drops
|
||||||
m.BlastMining8 = +40% ore yield, no debris, triple drops
|
m.BlastMining8 = +40% ore yield, no debris, triple drops
|
||||||
|
Skills.AdeptStone=[[DARK_RED]]You're not skilled enough to repair Stone.
|
||||||
|
Skills.AdeptIron=[[DARK_RED]]You're not skilled enough to repair Iron.
|
||||||
|
Skills.AdeptGold=[[DARK_RED]]You're not skilled enough to repair Gold.
|
@ -390,3 +390,6 @@ m.BlastMining5 = +25% ore yield, no debris, double drops
|
|||||||
m.BlastMining6 = +30% ore yield, no debris, double drops
|
m.BlastMining6 = +30% ore yield, no debris, double drops
|
||||||
m.BlastMining7 = +35% ore yield, no debris, triple drops
|
m.BlastMining7 = +35% ore yield, no debris, triple drops
|
||||||
m.BlastMining8 = +40% ore yield, no debris, triple drops
|
m.BlastMining8 = +40% ore yield, no debris, triple drops
|
||||||
|
Skills.AdeptStone=[[DARK_RED]]You're not skilled enough to repair Stone.
|
||||||
|
Skills.AdeptIron=[[DARK_RED]]You're not skilled enough to repair Iron.
|
||||||
|
Skills.AdeptGold=[[DARK_RED]]You're not skilled enough to repair Gold.
|
@ -379,3 +379,6 @@ m.BlastMining5 = +25% ore yield, no debris, double drops
|
|||||||
m.BlastMining6 = +30% ore yield, no debris, double drops
|
m.BlastMining6 = +30% ore yield, no debris, double drops
|
||||||
m.BlastMining7 = +35% ore yield, no debris, triple drops
|
m.BlastMining7 = +35% ore yield, no debris, triple drops
|
||||||
m.BlastMining8 = +40% ore yield, no debris, triple drops
|
m.BlastMining8 = +40% ore yield, no debris, triple drops
|
||||||
|
Skills.AdeptStone=[[DARK_RED]]You're not skilled enough to repair Stone.
|
||||||
|
Skills.AdeptIron=[[DARK_RED]]You're not skilled enough to repair Iron.
|
||||||
|
Skills.AdeptGold=[[DARK_RED]]You're not skilled enough to repair Gold.
|
@ -390,3 +390,6 @@ m.BlastMining5 = +25% ore yield, no debris, double drops
|
|||||||
m.BlastMining6 = +30% ore yield, no debris, double drops
|
m.BlastMining6 = +30% ore yield, no debris, double drops
|
||||||
m.BlastMining7 = +35% ore yield, no debris, triple drops
|
m.BlastMining7 = +35% ore yield, no debris, triple drops
|
||||||
m.BlastMining8 = +40% ore yield, no debris, triple drops
|
m.BlastMining8 = +40% ore yield, no debris, triple drops
|
||||||
|
Skills.AdeptStone=[[DARK_RED]]You're not skilled enough to repair Stone.
|
||||||
|
Skills.AdeptIron=[[DARK_RED]]You're not skilled enough to repair Iron.
|
||||||
|
Skills.AdeptGold=[[DARK_RED]]You're not skilled enough to repair Gold.
|
@ -396,3 +396,6 @@ m.BlastMining5 = +25% ore yield, no debris, double drops
|
|||||||
m.BlastMining6 = +30% ore yield, no debris, double drops
|
m.BlastMining6 = +30% ore yield, no debris, double drops
|
||||||
m.BlastMining7 = +35% ore yield, no debris, triple drops
|
m.BlastMining7 = +35% ore yield, no debris, triple drops
|
||||||
m.BlastMining8 = +40% ore yield, no debris, triple drops
|
m.BlastMining8 = +40% ore yield, no debris, triple drops
|
||||||
|
Skills.AdeptStone=[[DARK_RED]]You're not skilled enough to repair Stone.
|
||||||
|
Skills.AdeptIron=[[DARK_RED]]You're not skilled enough to repair Iron.
|
||||||
|
Skills.AdeptGold=[[DARK_RED]]You're not skilled enough to repair Gold.
|
@ -390,3 +390,6 @@ m.BlastMining5 = +25% ore yield, no debris, double drops
|
|||||||
m.BlastMining6 = +30% ore yield, no debris, double drops
|
m.BlastMining6 = +30% ore yield, no debris, double drops
|
||||||
m.BlastMining7 = +35% ore yield, no debris, triple drops
|
m.BlastMining7 = +35% ore yield, no debris, triple drops
|
||||||
m.BlastMining8 = +40% ore yield, no debris, triple drops
|
m.BlastMining8 = +40% ore yield, no debris, triple drops
|
||||||
|
Skills.AdeptStone=[[DARK_RED]]You're not skilled enough to repair Stone.
|
||||||
|
Skills.AdeptIron=[[DARK_RED]]You're not skilled enough to repair Iron.
|
||||||
|
Skills.AdeptGold=[[DARK_RED]]You're not skilled enough to repair Gold.
|
@ -398,3 +398,6 @@ m.BlastMining5 = +25% ore yield, no debris, double drops
|
|||||||
m.BlastMining6 = +30% ore yield, no debris, double drops
|
m.BlastMining6 = +30% ore yield, no debris, double drops
|
||||||
m.BlastMining7 = +35% ore yield, no debris, triple drops
|
m.BlastMining7 = +35% ore yield, no debris, triple drops
|
||||||
m.BlastMining8 = +40% ore yield, no debris, triple drops
|
m.BlastMining8 = +40% ore yield, no debris, triple drops
|
||||||
|
Skills.AdeptStone=[[DARK_RED]]You're not skilled enough to repair Stone.
|
||||||
|
Skills.AdeptIron=[[DARK_RED]]You're not skilled enough to repair Iron.
|
||||||
|
Skills.AdeptGold=[[DARK_RED]]You're not skilled enough to repair Gold.
|
@ -382,3 +382,6 @@ m.BlastMining5 = +25% ore yield, no debris, double drops
|
|||||||
m.BlastMining6 = +30% ore yield, no debris, double drops
|
m.BlastMining6 = +30% ore yield, no debris, double drops
|
||||||
m.BlastMining7 = +35% ore yield, no debris, triple drops
|
m.BlastMining7 = +35% ore yield, no debris, triple drops
|
||||||
m.BlastMining8 = +40% ore yield, no debris, triple drops
|
m.BlastMining8 = +40% ore yield, no debris, triple drops
|
||||||
|
Skills.AdeptStone=[[DARK_RED]]You're not skilled enough to repair Stone.
|
||||||
|
Skills.AdeptIron=[[DARK_RED]]You're not skilled enough to repair Iron.
|
||||||
|
Skills.AdeptGold=[[DARK_RED]]You're not skilled enough to repair Gold.
|
Loading…
Reference in New Issue
Block a user