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);
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);
}
@ -48,7 +48,7 @@ public class Archery
{
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);
}

View File

@ -235,7 +235,7 @@ public class Excavation
}
//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;
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)
{
PlayerProfile PP = Users.getProfile(player);
int herbLevel = PP.getSkillLevel(SkillType.HERBALISM);
int type = block.getTypeId();
Location loc = block.getLocation();
ItemStack is = null;
@ -162,13 +163,11 @@ public class Herbalism
PP.addXP(SkillType.HERBALISM, LoadProperties.mwheat, player);
if(player != null)
{
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM))
{
if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
m.mcDropItem(loc, is);
}
}
//GREEN THUMB
if(Math.random() * 1500 <= PP.getSkillLevel(SkillType.HERBALISM))
if((Math.random() * 1500 <= herbLevel) || herbLevel > 1500)
{
event.setCancelled(true);
m.mcDropItem(loc, is);
@ -206,7 +205,7 @@ public class Herbalism
PP.addXP(SkillType.HERBALISM, LoadProperties.mnetherwart, player);
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);
@ -252,7 +251,7 @@ public class Herbalism
is = new ItemStack(Material.CACTUS, 1, (byte)0, (byte)0);
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);
}
@ -291,7 +290,7 @@ public class Herbalism
//Check for being placed by the player
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);
}
@ -309,7 +308,7 @@ public class Herbalism
is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null)
{
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM))
if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
{
m.mcDropItem(loc, is);
}
@ -323,7 +322,7 @@ public class Herbalism
is = new ItemStack(mat, 1, (byte)0, (byte)0);
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);
@ -347,7 +346,7 @@ public class Herbalism
is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null)
{
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM))
if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
{
m.mcDropItem(loc, is);
}
@ -359,9 +358,8 @@ public class Herbalism
mat = Material.getMaterial(block.getTypeId());
is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null){
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM)){
if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
m.mcDropItem(loc, is);
}
}
PP.addXP(SkillType.HERBALISM, LoadProperties.mflower, player);
}
@ -371,9 +369,8 @@ public class Herbalism
mat = Material.getMaterial(block.getTypeId());
is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null){
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM)){
if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
m.mcDropItem(loc, is);
}
}
PP.addXP(SkillType.HERBALISM, LoadProperties.mlilypad, player);
}
@ -382,9 +379,8 @@ public class Herbalism
mat = Material.getMaterial(block.getTypeId());
is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null){
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM)){
if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
m.mcDropItem(loc, is);
}
}
PP.addXP(SkillType.HERBALISM, LoadProperties.mvines, player);
}

View File

@ -170,7 +170,7 @@ public class Mining
{
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);
return;

View File

@ -742,7 +742,7 @@ public class Repair {
PlayerProfile PP = Users.getProfile(player);
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"));
return true;

View File

@ -45,7 +45,7 @@ public class WoodCutting
Material mat = Material.getMaterial(block.getTypeId());
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);
m.mcDropItem(block.getLocation(), item);