浏览代码

Fixed bug with some skills failing to work once player passes max level
boost for the skill.

gmcferrin 13 年之前
父节点
当前提交
151c9ba1d4

+ 2 - 2
src/main/java/com/gmail/nossr50/skills/Archery.java

@@ -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);
 					}
 					}

+ 1 - 1
src/main/java/com/gmail/nossr50/skills/Excavation.java

@@ -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));

+ 12 - 16
src/main/java/com/gmail/nossr50/skills/Herbalism.java

@@ -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,9 +358,8 @@ 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);
 	    	}
 	    	}
@@ -371,9 +369,8 @@ 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);
 	    	}
 	    	}
@@ -382,9 +379,8 @@ 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);
 	    	}
 	    	}

+ 1 - 1
src/main/java/com/gmail/nossr50/skills/Mining.java

@@ -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;

+ 1 - 1
src/main/java/com/gmail/nossr50/skills/Repair.java

@@ -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;

+ 1 - 1
src/main/java/com/gmail/nossr50/skills/WoodCutting.java

@@ -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);