mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-01 16:19:53 +01:00
Merge pull request #46 from gmcferrin/patch-1
Minor bugfixing, add repair for bows & leather armor
This commit is contained in:
commit
ce3fe8fd21
@ -32,7 +32,7 @@ public class LoadProperties
|
||||
|
||||
public static String xplock, MySQLtablePrefix, MySQLuserName, MySQLserverName, MySQLdbName, MySQLdbPass, mctop, addxp,
|
||||
xprate, mcability, mcmmo, mcc, mcrefresh, mcgod, stats, mmoedit, ptp, party, myspawn, whois, invite, accept, clearmyspawn, nWood,
|
||||
nStone, nIron, nGold, nDiamond, locale;
|
||||
nStone, nIron, nGold, nDiamond, locale, nString, nLeather;
|
||||
|
||||
public static int mfishing, mwatch, xpbar_x, xpbar_y, xpicon_x, xpicon_y, mstring, mbucket, mweb,
|
||||
chimaeraId, msandstone, mcocoa, water_thunder, cure_self, cure_other, mslimeballs, mbones, msulphur, mslowsand,
|
||||
@ -40,7 +40,7 @@ public class LoadProperties
|
||||
msugar, mpumpkin, mwheat, mgold, mdiamond, miron, mredstone, mlapis, mobsidian, mnetherrack, mglowstone, mcoal, mstone, MySQLport,
|
||||
xpGainMultiplier, superBreakerCooldown, greenTerraCooldown, gigaDrillBreakerCooldown, treeFellerCooldown,
|
||||
berserkCooldown, serratedStrikeCooldown, skullSplitterCooldown, abilityDurabilityLoss,
|
||||
feathersConsumedByChimaeraWing, bonesConsumedByCOTW, repairdiamondlevel, rWood, rStone, rIron, rGold, rDiamond;
|
||||
feathersConsumedByChimaeraWing, bonesConsumedByCOTW, repairdiamondlevel, rWood, rStone, rIron, rGold, rDiamond, rString, rLeather;
|
||||
|
||||
public static double xpbackground_r, xpbackground_g, xpbackground_b, xpborder_r, xpborder_g, xpborder_b, fishing_r, fishing_g, fishing_b, acrobatics_r, acrobatics_g, acrobatics_b, archery_r, archery_g, archery_b, axes_r, axes_g, axes_b,
|
||||
excavation_r, excavation_g, excavation_b, herbalism_r, herbalism_g, herbalism_b, mining_r, mining_g, mining_b,
|
||||
@ -342,6 +342,10 @@ public class LoadProperties
|
||||
write("Skills.Repair.Diamond.Level_Required", 50);
|
||||
write("Skills.Repair.Iron.ID", 265);
|
||||
write("Skills.Repair.Iron.Name", "Iron Bars");
|
||||
write("Skills.Repair.String.ID", 287);
|
||||
write("Skills.Repair.String.Name", "String");
|
||||
write("Skills.Repair.Leather.ID", 334);
|
||||
write("Skills.Repair.String.Name", "Leather")
|
||||
write("Skills.Herbalism.Green_Thumb.Cobble_To_Mossy", true);
|
||||
write("Skills.Excavation.Requires_Shovel", true);
|
||||
write("Skills.Mining.Requires_Pickaxe", true);
|
||||
@ -540,7 +544,11 @@ public class LoadProperties
|
||||
rDiamond = readInteger("Skills.Repair.Diamond.ID", 264);
|
||||
nDiamond = readString("Skills.Repair.Diamond.Name", "Diamond");
|
||||
rIron = readInteger("Skills.Repair.Iron.ID", 265);
|
||||
nIron = readString("Skills.Repair.Iron.Name", "Iron Bars");
|
||||
nIron = readString("Skills.Repair.Iron.Name", "Iron Bars");
|
||||
rString = readInteger("Skills.Repair.String.ID", 287);
|
||||
nString = readString("Skills.Repair.String.Name", "String");
|
||||
rLeather = readInteger("Skills.Repair.Leather.ID", 334);
|
||||
nLeather = readString("Skills.Repair.String.Name", "Leather");
|
||||
|
||||
cocoabeans = readBoolean("Excavation.Drops.Cocoa_Beans", true);
|
||||
mushrooms = readBoolean("Excavation.Drops.Mushrooms", true);
|
||||
|
@ -178,10 +178,10 @@ public class m
|
||||
{
|
||||
int id = item.getTypeId();
|
||||
if(tier == 1){
|
||||
if((id == 276 || id == 277 || id == 278 || id == 279 || id == 293)){
|
||||
return 33;
|
||||
if((id == 283 || id == 284 || id == 285 || id == 286 || id == 294)){
|
||||
return 33; //GOLD
|
||||
} else {
|
||||
return 60;
|
||||
return 60; //WOOD
|
||||
}
|
||||
} else if (tier == 2){
|
||||
return 132;
|
||||
@ -268,7 +268,8 @@ public class m
|
||||
|
||||
public static boolean isSwords(ItemStack is)
|
||||
{
|
||||
return is.getTypeId() == 268 || is.getTypeId() == 267 || is.getTypeId() == 272 || is.getTypeId() == 283 || is.getTypeId() == 276;
|
||||
int id = is.getTypeId();
|
||||
return id == 268 || id == 267 || id == 272 || id == 283 || id == 276;
|
||||
}
|
||||
|
||||
public static boolean isHoe(ItemStack is)
|
||||
@ -277,35 +278,28 @@ public class m
|
||||
return id == 290 || id == 291 || id == 292 || id == 293 || id == 294;
|
||||
}
|
||||
|
||||
public static boolean isShovel(ItemStack is){
|
||||
return is.getTypeId() == 269 || is.getTypeId() == 273 || is.getTypeId() == 277 || is.getTypeId() == 284 || is.getTypeId() == 256;
|
||||
public static boolean isShovel(ItemStack is)
|
||||
{
|
||||
int id = is.getTypeId();
|
||||
return id == 269 || id == 273 || id == 277 || id == 284 || id == 256;
|
||||
}
|
||||
|
||||
public static boolean isAxes(ItemStack is){
|
||||
if(is.getTypeId() == 271 || is.getTypeId() == 258 || is.getTypeId() == 286 || is.getTypeId() == 279 || is.getTypeId() == 275){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
public static boolean isAxes(ItemStack is)
|
||||
{
|
||||
int id = is.getTypeId();
|
||||
return id == 271 || id == 258 || id == 286 || id == 279 || id == 275;
|
||||
}
|
||||
|
||||
public static boolean isMiningPick(ItemStack is)
|
||||
{
|
||||
if(is.getTypeId() == 270 || is.getTypeId() == 274 || is.getTypeId() == 285 || is.getTypeId() == 257 || is.getTypeId() == 278)
|
||||
{
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public boolean isGold(ItemStack is)
|
||||
{
|
||||
int i = is.getTypeId();
|
||||
if(i == 283 || i == 284 || i == 285 || i == 286 || i == 294 || i == 314 || i == 315 || i == 316 || i == 317){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
int id = is.getTypeId();
|
||||
return id == 270 || id == 274 || id == 285 || id == 257 || id == 278;
|
||||
}
|
||||
// public boolean isGold(ItemStack is)
|
||||
// {
|
||||
// int id = is.getTypeId();
|
||||
// return id == 283 || id == 284 || id == 285 || id == 286 || id == 294 || id == 314 || id == 315 || id == 316 || id == 317;
|
||||
// }
|
||||
public static void convertToMySQL()
|
||||
{
|
||||
if(!LoadProperties.useMySQL)
|
||||
|
@ -47,7 +47,10 @@ public class Repair {
|
||||
private static String nDiamond = LoadProperties.nDiamond;
|
||||
private static int rIron = LoadProperties.rIron;
|
||||
private static String nIron = LoadProperties.nIron;
|
||||
|
||||
private static int rString = LoadProperties.rString;
|
||||
private static String nString = LoadProperties.nString;
|
||||
private static int rLeather = LoadProperties.rLeather;
|
||||
private static String nLeather = LoadProperties.nLeather;
|
||||
|
||||
public static void repairCheck(Player player, ItemStack is, Block block){
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
@ -120,6 +123,21 @@ public class Repair {
|
||||
SpoutStuff.playRepairNoise(player);
|
||||
}
|
||||
|
||||
//LEATHER ARMOR
|
||||
else if (isLeatherArmor(is) && hasItem(player, rLeather)){
|
||||
removeItem(player, rLeather);
|
||||
repairItem(player, enchants, enchantsLevel);
|
||||
|
||||
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
|
||||
else {
|
||||
needMoreVespeneGas(is, player);
|
||||
@ -231,7 +249,26 @@ public class Repair {
|
||||
//CLANG CLANG
|
||||
if(LoadProperties.spoutEnabled)
|
||||
SpoutStuff.playRepairNoise(player);
|
||||
}
|
||||
}
|
||||
|
||||
//BOW
|
||||
else if(isBow(is) && hasItem(player, rString)){
|
||||
removeItem(player, rString);
|
||||
repairItem(player, enchants, enchantsLevel);
|
||||
|
||||
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
|
||||
else {
|
||||
@ -362,7 +399,11 @@ public class Repair {
|
||||
public static boolean isArmor(ItemStack is){
|
||||
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() == 314 || is.getTypeId() == 315 || is.getTypeId() == 316 || is.getTypeId() == 317; //GOLD
|
||||
is.getTypeId() == 314 || is.getTypeId() == 315 || is.getTypeId() == 316 || is.getTypeId() == 317 || //GOLD
|
||||
is.getTypeId() == 298 || is.getTypeId() == 299 || is.getTypeId() == 300 || is.getTypeId() == 301; //LEATHER
|
||||
}
|
||||
public static boolean isLeatherArmor(ItemStack is){
|
||||
return is.getTypeId() == 298 || is.getTypeId() == 299 || is.getTypeId() == 300 || is.getTypeId() == 301;
|
||||
}
|
||||
public static boolean isGoldArmor(ItemStack is){
|
||||
return is.getTypeId() == 314 || is.getTypeId() == 315 || is.getTypeId() == 316 || is.getTypeId() == 317;
|
||||
@ -379,7 +420,8 @@ public class Repair {
|
||||
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 || is.getTypeId() == 294 || //GOLD
|
||||
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
|
||||
is.getTypeId() == 261; //BOW
|
||||
}
|
||||
public static boolean isStoneTools(ItemStack is){
|
||||
return is.getTypeId() == 272 || is.getTypeId() == 273 || is.getTypeId() == 274 || is.getTypeId() == 275 || is.getTypeId() == 291;
|
||||
@ -396,6 +438,9 @@ public class Repair {
|
||||
public static boolean isDiamondTools(ItemStack is){
|
||||
return is.getTypeId() == 276 || is.getTypeId() == 277 || is.getTypeId() == 278 || is.getTypeId() == 279 || is.getTypeId() == 293;
|
||||
}
|
||||
public static boolean isBow(ItemStack is){
|
||||
return is.getTypeId() == 261;
|
||||
}
|
||||
public static void removeItem(Player player, int typeid)
|
||||
{
|
||||
ItemStack[] inventory = player.getInventory().getContents();
|
||||
@ -450,6 +495,11 @@ public class Repair {
|
||||
ramt = Material.SHEARS.getMaxDurability() / 2;
|
||||
break;
|
||||
|
||||
//BOW
|
||||
case 261:
|
||||
ramt = Material.BOW.getMaxDurability() / 3;
|
||||
break;
|
||||
|
||||
/* WOOD TOOLS */
|
||||
|
||||
//WOOD SWORD
|
||||
@ -624,6 +674,25 @@ public class Repair {
|
||||
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);
|
||||
@ -652,6 +721,10 @@ public class Repair {
|
||||
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"));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user