Fixed bug with some skills failing to work once player passes max level

boost for the skill.
This commit is contained in:
gmcferrin 2012-02-02 17:04:49 -05:00
parent 81ab8692ad
commit 151c9ba1d4
6 changed files with 18 additions and 22 deletions

View File

@ -37,7 +37,7 @@ public class Archery
pluginx.misc.arrowTracker.put(x, 0); pluginx.misc.arrowTracker.put(x, 0);
if(attacker != null) if(attacker != null)
{ {
if(Math.random() * 1000 <= PPa.getSkillLevel(SkillType.ARCHERY)) if( (Math.random() * 1000 <= PPa.getSkillLevel(SkillType.ARCHERY)) || PPa.getSkillLevel(SkillType.ARCHERY) > 1000)
{ {
pluginx.misc.arrowTracker.put(x, 1); pluginx.misc.arrowTracker.put(x, 1);
} }
@ -48,7 +48,7 @@ public class Archery
{ {
if(attacker != null) if(attacker != null)
{ {
if(Math.random() * 1000 <= PPa.getSkillLevel(SkillType.ARCHERY)) if( (Math.random() * 1000 <= PPa.getSkillLevel(SkillType.ARCHERY)) || PPa.getSkillLevel(SkillType.ARCHERY) > 1000)
{ {
pluginx.misc.arrowTracker.put(x, 1); pluginx.misc.arrowTracker.put(x, 1);
} }

View File

@ -235,7 +235,7 @@ public class Excavation
} }
//CHANCE TO GET GLOWSTONE //CHANCE TO GET GLOWSTONE
if(LoadProperties.glowstone == true && skillLevel >= 25 && Math.random() * 100 > 95) if(LoadProperties.glowstone && skillLevel >= 25 && Math.random() * 100 > 95)
{ {
xp+= LoadProperties.mglowstone2; xp+= LoadProperties.mglowstone2;
is.add(new ItemStack(Material.GLOWSTONE_DUST, 1, (byte)0, (byte)0)); is.add(new ItemStack(Material.GLOWSTONE_DUST, 1, (byte)0, (byte)0));

View File

@ -144,6 +144,7 @@ public class Herbalism
public static void herbalismProcCheck(Block block, Player player, BlockBreakEvent event, mcMMO plugin) public static void herbalismProcCheck(Block block, Player player, BlockBreakEvent event, mcMMO plugin)
{ {
PlayerProfile PP = Users.getProfile(player); PlayerProfile PP = Users.getProfile(player);
int herbLevel = PP.getSkillLevel(SkillType.HERBALISM);
int type = block.getTypeId(); int type = block.getTypeId();
Location loc = block.getLocation(); Location loc = block.getLocation();
ItemStack is = null; ItemStack is = null;
@ -162,13 +163,11 @@ public class Herbalism
PP.addXP(SkillType.HERBALISM, LoadProperties.mwheat, player); PP.addXP(SkillType.HERBALISM, LoadProperties.mwheat, player);
if(player != null) if(player != null)
{ {
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM)) if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
{
m.mcDropItem(loc, is); m.mcDropItem(loc, is);
} }
}
//GREEN THUMB //GREEN THUMB
if(Math.random() * 1500 <= PP.getSkillLevel(SkillType.HERBALISM)) if((Math.random() * 1500 <= herbLevel) || herbLevel > 1500)
{ {
event.setCancelled(true); event.setCancelled(true);
m.mcDropItem(loc, is); m.mcDropItem(loc, is);
@ -206,7 +205,7 @@ public class Herbalism
PP.addXP(SkillType.HERBALISM, LoadProperties.mnetherwart, player); PP.addXP(SkillType.HERBALISM, LoadProperties.mnetherwart, player);
if(player != null) if(player != null)
{ {
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM)) if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
{ {
m.mcDropItem(loc, is); m.mcDropItem(loc, is);
m.mcDropItem(loc, is); m.mcDropItem(loc, is);
@ -252,7 +251,7 @@ public class Herbalism
is = new ItemStack(Material.CACTUS, 1, (byte)0, (byte)0); is = new ItemStack(Material.CACTUS, 1, (byte)0, (byte)0);
if(byteArray[x] != (byte) 5) if(byteArray[x] != (byte) 5)
{ {
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM)) if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
{ {
m.mcDropItem(target.getLocation(), is); m.mcDropItem(target.getLocation(), is);
} }
@ -291,7 +290,7 @@ public class Herbalism
//Check for being placed by the player //Check for being placed by the player
if(byteArray[x] != (byte) 5) if(byteArray[x] != (byte) 5)
{ {
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM)) if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
{ {
m.mcDropItem(target.getLocation(), is); m.mcDropItem(target.getLocation(), is);
} }
@ -309,7 +308,7 @@ public class Herbalism
is = new ItemStack(mat, 1, (byte)0, (byte)0); is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null) if(player != null)
{ {
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM)) if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
{ {
m.mcDropItem(loc, is); m.mcDropItem(loc, is);
} }
@ -323,7 +322,7 @@ public class Herbalism
is = new ItemStack(mat, 1, (byte)0, (byte)0); is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null) if(player != null)
{ {
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM)) if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
{ {
m.mcDropItem(loc, is); m.mcDropItem(loc, is);
m.mcDropItem(loc, is); m.mcDropItem(loc, is);
@ -347,7 +346,7 @@ public class Herbalism
is = new ItemStack(mat, 1, (byte)0, (byte)0); is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null) if(player != null)
{ {
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM)) if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
{ {
m.mcDropItem(loc, is); m.mcDropItem(loc, is);
} }
@ -359,10 +358,9 @@ public class Herbalism
mat = Material.getMaterial(block.getTypeId()); mat = Material.getMaterial(block.getTypeId());
is = new ItemStack(mat, 1, (byte)0, (byte)0); is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null){ if(player != null){
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM)){ if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
m.mcDropItem(loc, is); m.mcDropItem(loc, is);
} }
}
PP.addXP(SkillType.HERBALISM, LoadProperties.mflower, player); PP.addXP(SkillType.HERBALISM, LoadProperties.mflower, player);
} }
//Lily Pads //Lily Pads
@ -371,10 +369,9 @@ public class Herbalism
mat = Material.getMaterial(block.getTypeId()); mat = Material.getMaterial(block.getTypeId());
is = new ItemStack(mat, 1, (byte)0, (byte)0); is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null){ if(player != null){
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM)){ if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
m.mcDropItem(loc, is); m.mcDropItem(loc, is);
} }
}
PP.addXP(SkillType.HERBALISM, LoadProperties.mlilypad, player); PP.addXP(SkillType.HERBALISM, LoadProperties.mlilypad, player);
} }
//Vines //Vines
@ -382,10 +379,9 @@ public class Herbalism
mat = Material.getMaterial(block.getTypeId()); mat = Material.getMaterial(block.getTypeId());
is = new ItemStack(mat, 1, (byte)0, (byte)0); is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null){ if(player != null){
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM)){ if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
m.mcDropItem(loc, is); m.mcDropItem(loc, is);
} }
}
PP.addXP(SkillType.HERBALISM, LoadProperties.mvines, player); PP.addXP(SkillType.HERBALISM, LoadProperties.mvines, player);
} }
} }

View File

@ -170,7 +170,7 @@ public class Mining
{ {
PlayerProfile PP = Users.getProfile(player); PlayerProfile PP = Users.getProfile(player);
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.MINING)) if((Math.random() * 1000 <= PP.getSkillLevel(SkillType.MINING)) || PP.getSkillLevel(SkillType.MINING) > 1000)
{ {
blockProcSimulate(block, player); blockProcSimulate(block, player);
return; return;

View File

@ -742,7 +742,7 @@ public class Repair {
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)) || PP.getSkillLevel(SkillType.REPAIR) > 1000)
{ {
player.sendMessage(mcLocale.getString("Skills.FeltEasy")); player.sendMessage(mcLocale.getString("Skills.FeltEasy"));
return true; return true;

View File

@ -45,7 +45,7 @@ public class WoodCutting
Material mat = Material.getMaterial(block.getTypeId()); Material mat = Material.getMaterial(block.getTypeId());
if(player != null) if(player != null)
{ {
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.WOODCUTTING)) if((Math.random() * 1000 <= PP.getSkillLevel(SkillType.WOODCUTTING)) || PP.getSkillLevel(SkillType.WOODCUTTING) > 1000)
{ {
ItemStack item = new ItemStack(mat, 1, (short) 0, type); ItemStack item = new ItemStack(mat, 1, (short) 0, type);
m.mcDropItem(block.getLocation(), item); m.mcDropItem(block.getLocation(), item);