瀏覽代碼

/flex. 0.3 baby!

nossr50 14 年之前
父節點
當前提交
b3a2f5b036

+ 1 - 1
mcMMO/com/bukkit/nossr50/mcMMO/mcBlockListener.java

@@ -42,9 +42,9 @@ public class mcBlockListener extends BlockListener {
     		if(block.getTypeId() == 17){
     			mcm.getInstance().woodCuttingProcCheck(player, block, loc);
     		}
-    		mcm.getInstance().herbalismProcCheck(block, player);
     		mcm.getInstance().excavationProcCheck(block, player);
     	}
+    		mcm.getInstance().herbalismProcCheck(block, player); //You place the blocks so we wont check if they are being watched
     }
     
     

+ 8 - 4
mcMMO/com/bukkit/nossr50/mcMMO/mcEntityListener.java

@@ -47,8 +47,10 @@ public class mcEntityListener extends EntityListener {
 				}
     			//XP
 				if(attacker.getItemInHand().getTypeId() == 0 && Math.random() * 10 > 8){
+					if(defender.getHealth() != 0){
 					mcUsers.getProfile(attacker).skillUpUnarmed(1);
 					attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by 1. Total ("+mcUsers.getProfile(attacker).getUnarmed()+")");
+					}
 				}
     		}
     		if(x instanceof Animals){
@@ -76,7 +78,7 @@ public class mcEntityListener extends EntityListener {
     			Player defender = (Player)x;
     			if(attacker.getItemInHand().getTypeId() == 0){
     				//DMG MODIFIER
-    				if((mcUsers.getProfile(defender).inParty() && mcUsers.getProfile(attacker).inParty())&& !mcUsers.getProfile(defender).getParty().equals(mcUsers.getProfile(attacker).getParty())) {
+    				if((mcUsers.getProfile(defender).inParty() && mcUsers.getProfile(attacker).inParty())&& !mcUsers.getProfile(defender).getParty().equals(mcUsers.getProfile(attacker).getParty()) && !mcUsers.getProfile(defender).getParty().equals(mcUsers.getProfile(attacker).getParty())) {
     				if(mcUsers.getProfile(attacker).getUnarmedInt() >= 50 && mcUsers.getProfile(attacker).getUnarmedInt() < 100){
     					defender.setHealth(calculateDamage(defender, 1));
     				} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 100 && mcUsers.getProfile(attacker).getUnarmedInt() < 200){
@@ -96,11 +98,12 @@ public class mcEntityListener extends EntityListener {
     				}
     				if(mcUsers.getProfile(defender).isDead())
         				return;
-    				}
     				//XP
     				if(attacker.getItemInHand().getTypeId() == 0 && Math.random() * 10 > 9){
-    					mcUsers.getProfile(attacker).skillUpUnarmed(1);
-    					attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by 1. Total ("+mcUsers.getProfile(attacker).getUnarmed()+")");
+    					if(defender.getHealth() != 0){
+    						mcUsers.getProfile(attacker).skillUpUnarmed(1);
+    						attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by 1. Total ("+mcUsers.getProfile(attacker).getUnarmed()+")");
+    						}
     				}
     				//PROC
     				if(simulateUnarmedProc(attacker)){
@@ -116,6 +119,7 @@ public class mcEntityListener extends EntityListener {
         					mcUsers.getProfile(defender).setDead(true);
         				}
         			}
+    				}
     				return;
     			}
     			if(mcUsers.getProfile(defender).isDead())

+ 61 - 1
mcMMO/com/bukkit/nossr50/mcMMO/mcPlayerListener.java

@@ -108,7 +108,7 @@ public class mcPlayerListener extends PlayerListener {
     			player.setHealth(player.getHealth() + 6);
     		}
     	}
-    	if(block != null && block.getTypeId() == 42 && player.getItemInHand().getDurability() <= 0){
+    	if(block != null && block.getTypeId() == 42 && player.getItemInHand().getDurability() <= 0 && (mcm.getInstance().isTools(is)) || mcm.getInstance().isArmor(is)){
     		player.sendMessage(ChatColor.YELLOW+"That is at full durability.");
     		return;
     	}
@@ -163,6 +163,60 @@ public class mcPlayerListener extends PlayerListener {
     	Player player = event.getPlayer();
     	String[] split = event.getMessage().split(" ");
     	String playerName = player.getName();
+    	if(split[0].equalsIgnoreCase("/woodcutting")){
+			event.setCancelled(true);
+			player.sendMessage(ChatColor.GREEN+"~~WOODCUTTING INFO~~");
+			player.sendMessage(ChatColor.GREEN+"Gaining Skill: "+ChatColor.DARK_GRAY+"Chop down trees.");
+			player.sendMessage(ChatColor.GREEN+"~~EFFECTS~~");
+			player.sendMessage(ChatColor.GRAY+"Double Drops start to happen at 10 woodcutting skill");
+			player.sendMessage(ChatColor.GRAY+"it gets more frequent from there.");
+    	}
+    	if(split[0].equalsIgnoreCase("/mining")){
+			event.setCancelled(true);
+			player.sendMessage(ChatColor.GREEN+"~~MINING INFO~~");
+			player.sendMessage(ChatColor.GREEN+"Gaining Skill: "+ChatColor.DARK_GRAY+"Mining ore and stone,");
+			player.sendMessage(ChatColor.DARK_GRAY+"the xp rate depends entirely upon the rarity of what you're harvesting.");
+			player.sendMessage(ChatColor.GREEN+"~~EFFECTS~~");
+			player.sendMessage(ChatColor.GRAY+"Double Drops start to happen at 25 Mining skill,");
+			player.sendMessage(ChatColor.GRAY+"and the chance for it increases with skill.");
+    	}
+    	if(split[0].equalsIgnoreCase("/repair")){
+			event.setCancelled(true);
+			player.sendMessage(ChatColor.GREEN+"~~REPAIR INFO~~");
+			player.sendMessage(ChatColor.GREEN+"Gaining Skill: "+ChatColor.DARK_GRAY+"Repairing tools and armor.");
+			player.sendMessage(ChatColor.GREEN+"~~EFFECTS~~");
+			player.sendMessage(ChatColor.GRAY+"High skill levels make a proc to fully repair items happen more often.");
+			player.sendMessage(ChatColor.GREEN+"~~USE~~");
+			player.sendMessage(ChatColor.GRAY+"Approach an Anvil (Iron Block) with the item you wish ");
+			player.sendMessage(ChatColor.GRAY+"to repair in hand, right click to consume resources of the");
+			player.sendMessage(ChatColor.GRAY+"same type to repair it. This does not work for stone/wood/gold");
+    	}
+    	if(split[0].equalsIgnoreCase("/unarmed")){
+			event.setCancelled(true);
+			player.sendMessage(ChatColor.GREEN+"~~UNARMED INFO~~");
+			player.sendMessage(ChatColor.GREEN+"Gaining Skill: "+ChatColor.DARK_GRAY+"Punching monsters and players.");
+			player.sendMessage(ChatColor.GREEN+"~~EFFECTS~~");
+			player.sendMessage(ChatColor.GRAY+"Damage scales with unarmed skill. The first damage increase happens");
+			player.sendMessage(ChatColor.DARK_GRAY+" at 50 skill. At very high skill levels, you will gain a proc");
+			player.sendMessage(ChatColor.DARK_GRAY+"to disarm opponents on hit");
+    	}
+    	if(split[0].equalsIgnoreCase("/herbalism")){
+			event.setCancelled(true);
+			player.sendMessage(ChatColor.GREEN+"~~HERBALISM INFO~~");
+			player.sendMessage(ChatColor.GREEN+"Gaining Skill: "+ChatColor.DARK_GRAY+"Farming and picking herbs.");
+			player.sendMessage(ChatColor.GREEN+"~~EFFECTS~~");
+			player.sendMessage(ChatColor.GRAY+"Increases healing effects of bread and stew.");
+			player.sendMessage(ChatColor.GRAY+"Allows for chance to receive double drops based on skill");
+    	}
+    	if(split[0].equalsIgnoreCase("/excavation")){
+			event.setCancelled(true);
+			player.sendMessage(ChatColor.GREEN+"~~EXCAVATION INFO~~");
+			player.sendMessage(ChatColor.GREEN+"Gaining Skill: "+ChatColor.DARK_GRAY+"Digging.");
+			player.sendMessage(ChatColor.GREEN+"~~EFFECTS~~");
+			player.sendMessage(ChatColor.GRAY+"You will find treasures while digging based on your excavation,");
+			player.sendMessage(ChatColor.GRAY+"and at high levels the rewards are quite nice. The item you get");
+			player.sendMessage(ChatColor.GRAY+"depend on the block you're digging. They all give diffrent stuff.");
+    	}
 		if(split[0].equalsIgnoreCase("/mcmmo")){
 			event.setCancelled(true);
     		player.sendMessage(ChatColor.GRAY+"mcMMO is an RPG inspired plugin");
@@ -195,6 +249,12 @@ public class mcPlayerListener extends PlayerListener {
     		player.sendMessage(ChatColor.GRAY+"/setspawn - Server ops can designate a 'spawn'");
     		player.sendMessage(ChatColor.GRAY+"/spawn - Travel to the op designated spawn");
     		player.sendMessage(ChatColor.GRAY+"/whois - view detailed info about a player (req op)");
+    		player.sendMessage(ChatColor.GRAY+"/woodcutting - displays info about the skill");
+    		player.sendMessage(ChatColor.GRAY+"/mining - displays info about the skill");
+    		player.sendMessage(ChatColor.GRAY+"/repair - displays info about the skill");
+    		player.sendMessage(ChatColor.GRAY+"/unarmed - displays info about the skill");
+    		player.sendMessage(ChatColor.GRAY+"/herbalist - displays info about the skill");
+    		player.sendMessage(ChatColor.GRAY+"/excavation - displays info about the skill");
     	}
     	if(mcUsers.getProfile(player).inParty() && split[0].equalsIgnoreCase("/ptp")){
     		event.setCancelled(true);

+ 2 - 0
mcMMO/com/bukkit/nossr50/mcMMO/mcUsers.java

@@ -231,6 +231,8 @@ class PlayerList
         				herbalism = character[9];
         			if(character.length > 10)
         				repair = character[10];
+        			if(character.length > 11)
+        				excavation = character[11];
                 	in.close();
         			return true;
             	}

+ 37 - 6
mcMMO/com/bukkit/nossr50/mcMMO/mcm.java

@@ -93,7 +93,7 @@ public class mcm {
     		return 0; //full repair
     	}
     	//IRON TOOLS
-    	if(is.getTypeId() == 257 || is.getTypeId() == 258 || is.getTypeId() == 267){
+    	if(is.getTypeId() == 257 || is.getTypeId() == 258 || is.getTypeId() == 267 || is.getTypeId() == 292){
     		if(durability < 84){
     			return 0;
     		}else {
@@ -102,7 +102,7 @@ public class mcm {
     			return (short) (durability-84);
     		}
     	//DIAMOND TOOLS
-    	} else if(is.getTypeId() == 276 || is.getTypeId() == 278 || is.getTypeId() == 279){
+    	} else if(is.getTypeId() == 276 || is.getTypeId() == 278 || is.getTypeId() == 279 || is.getTypeId() == 293){
     		if(durability < 509){
     			return 0;
     		} else {
@@ -225,6 +225,9 @@ public class mcm {
     }
     public void herbalismProcCheck(Block block, Player player){
     	int type = block.getTypeId();
+    	Location loc = block.getLocation();
+    	ItemStack is = null;
+    	Material mat = null;
     	if(type == 39 || type == 40){
     			mcUsers.getProfile(player).skillUpHerbalism(3);
     			player.sendMessage(ChatColor.YELLOW+"Herbalism skill increased by 3. Total ("+mcUsers.getProfile(player).getHerbalismInt()+")");
@@ -238,6 +241,34 @@ public class mcm {
     	if(type == 59){
     		mcUsers.getProfile(player).skillUpHerbalism(1);
     		player.sendMessage(ChatColor.YELLOW+"Herbalism skill increased by 1. Total ("+mcUsers.getProfile(player).getHerbalismInt()+")");
+    		if(mcUsers.getProfile(player).getHerbalismInt() >= 50 && mcUsers.getProfile(player).getHerbalismInt() < 150){
+    		if(Math.random() * 10 > 8){
+    		mat = Material.getMaterial(59);
+			is = new ItemStack(mat, 1, (byte)0, (byte)0);
+			loc.getWorld().dropItemNaturally(loc, is);
+    		}
+    		}
+    		if(mcUsers.getProfile(player).getHerbalismInt() >= 150 && mcUsers.getProfile(player).getHerbalismInt() < 350 ){
+    			if(Math.random() * 10 > 6){
+    	    		mat = Material.getMaterial(59);
+    				is = new ItemStack(mat, 1, (byte)0, (byte)0);
+    				loc.getWorld().dropItemNaturally(loc, is);
+    	    		}
+    		}
+    		if(mcUsers.getProfile(player).getHerbalismInt() >= 150 && mcUsers.getProfile(player).getHerbalismInt() < 500 ){
+    			if(Math.random() * 10 > 4){
+    	    		mat = Material.getMaterial(59);
+    				is = new ItemStack(mat, 1, (byte)0, (byte)0);
+    				loc.getWorld().dropItemNaturally(loc, is);
+    	    		}
+    		}
+    		if(mcUsers.getProfile(player).getHerbalismInt() >= 150 && mcUsers.getProfile(player).getHerbalismInt() < 750 ){
+    			if(Math.random() * 10 > 2){
+    	    		mat = Material.getMaterial(59);
+    				is = new ItemStack(mat, 1, (byte)0, (byte)0);
+    				loc.getWorld().dropItemNaturally(loc, is);
+    	    		}
+    		}
     	}
     }
     public void excavationProcCheck(Block block, Player player){
@@ -404,8 +435,8 @@ public class mcm {
     	}
     }
     public boolean isTools(ItemStack is){
-    	if(is.getTypeId() == 256 || is.getTypeId() == 257 || is.getTypeId() == 258 || is.getTypeId() == 267 || //IRON
-    			is.getTypeId() == 276 || is.getTypeId() == 277 || is.getTypeId() == 278 || is.getTypeId() == 279) //DIAMOND 
+    	if(is.getTypeId() == 256 || is.getTypeId() == 257 || is.getTypeId() == 258 || is.getTypeId() == 267 || is.getTypeId() == 292 ||//IRON
+    			is.getTypeId() == 276 || is.getTypeId() == 277 || is.getTypeId() == 278 || is.getTypeId() == 279 || is.getTypeId() == 293) //DIAMOND 
     	{
     		return true;
     	} else {
@@ -414,7 +445,7 @@ public class mcm {
     }
     
     public boolean isIronTools(ItemStack is){
-    	if(is.getTypeId() == 256 || is.getTypeId() == 257 || is.getTypeId() == 258 || is.getTypeId() == 267)
+    	if(is.getTypeId() == 256 || is.getTypeId() == 257 || is.getTypeId() == 258 || is.getTypeId() == 267 || is.getTypeId() == 292)
     	{
     		return true;
     	} else {
@@ -423,7 +454,7 @@ public class mcm {
     }
     
     public boolean isDiamondTools(ItemStack is){
-    	if(is.getTypeId() == 276 || is.getTypeId() == 277 || is.getTypeId() == 278 || is.getTypeId() == 279)
+    	if(is.getTypeId() == 276 || is.getTypeId() == 277 || is.getTypeId() == 278 || is.getTypeId() == 279 || is.getTypeId() == 293)
     	{
     		return true;
     	} else {