Thread: food doesn't heal hp

Page 1 of 3 123 LastLast
Results 1 to 10 of 25
  1. #1 food doesn't heal hp 
    Registered Member
    Join Date
    Jun 2014
    Posts
    21
    Thanks given
    1
    Thanks received
    5
    Rep Power
    19
    i eat food on my server but hp doesn't get healed. The food eats however it doesn't heal the hp. Also for a note the hp orb shows the real hp however the hp level in the skills tab stays at 99/99 dunno if its meant to do that but i just thought i'd say it. Thanks
    Reply With Quote  
     

  2. Thankful users:


  3. #2  
    Registered Member
    Join Date
    Feb 2014
    Posts
    58
    Thanks given
    11
    Thanks received
    11
    Rep Power
    16
    Paste food.java
    Reply With Quote  
     

  4. #3  
    Registered Member
    Join Date
    Jun 2014
    Posts
    21
    Thanks given
    1
    Thanks received
    5
    Rep Power
    19
    thanks for your answer bro. I just pasted in 4 different food.java codes from 4 different servers and it still didn't work. Can anybody else help me.
    Reply With Quote  
     

  5. Thankful users:


  6. #4  
    food doesn't heal hp



    Scu11's Avatar
    Join Date
    Aug 2007
    Age
    30
    Posts
    16,307
    Thanks given
    7,215
    Thanks received
    12,308
    Rep Power
    5000
    he meant paste it here so we can see it....

    Attached image
    Reply With Quote  
     

  7. Thankful user:

    Respected MemberKoy

  8. #5  
    Registered Member
    Join Date
    Jun 2014
    Posts
    21
    Thanks given
    1
    Thanks received
    5
    Rep Power
    19
    Code:
    package server.model.players;
     
    import java.util.HashMap;
     
    /**
     * @author Sanity
     */
     
    public class Food {
    	
    	
    	private Client c;
    	
    	public Food (Client c) {
    		this.c = c;	
    	}
    	public static enum FoodToEat {	
    		ROCKTAIL(15272,23,"Rocktail"),
    		MANTA(391,22,"Manta Ray"),
    		SHARK(385,20,"Shark"),
    		LOBSTER(379,12,"Lobster"),
    		TROUT(333,7,"Trout"),
    		SALMON(329,9,"Salmon"),
    		SWORDFISH(373,14,"Swordfish"),
    		TUNA(361,10,"Tuna"),
    		MONKFISH(7946,16,"Monkfish"),
    		SEA_TURTLE(397,21,"Sea Turtle"),
    		CAKE(1891,4,"Cake"),
    		BASS(365,13,"Bass"),
    		COD(339,7,"Cod"),
    		POTATO(1942,1,"Potato"),
    		BAKED_POTATO(6701,4,"Baked Potato"),
    		POTATO_WITH_CHEESE(6705,16,"Potato with Cheese"),
    		EGG_POTATO(7056,16,"Egg Potato"),
    		CHILLI_POTATO(7054,14,"Chilli Potato"),
    		MUSHROOM_POTATO(7058,20,"Mushroom Potato"),
    		TUNA_POTATO(7060,22,"Tuna Potato"),
    		SHRIMPS(315,3,"Shrimps"),
    		HERRING(347,5,"Herring"),
    		SARDINE(325,4,"Sardine"),
    		CHOCOLATE_CAKE(1897,5,"Chocolate Cake"),
    		ANCHOVIES(319,1,"Anchovies"),
    		PLAIN_PIZZA(2289,7,"Plain Pizza"),
    		MEAT_PIZZA(2293,8,"Meat Pizza"),
    		ANCHOVY_PIZZA(2297,9,"Anchovy Pizza"),
    		PINEAPPLE_PIZZA(2301,11,"Pineapple Pizza"),
    		BREAD(2309,5,"Bread"),
    		APPLE_PIE(2323,7,"Apple Pie"),
    		REDBERRY_PIE(2325,5,"Redberry Pie"),
    		MEAT_PIE(2327,6,"Meat Pie"),
    		PIKE(351,8,"Pike"),
    		POTATO_WITH_BUTTER(6703,14,"Potato with Butter"),
    		BANANA(1963,2,"Banana"),
    		PEACH(6883,8,"Peach"),
    		ORANGE(2108,2,"Orange"),
    		PINEAPPLE_RINGS(2118,2,"Pineapple Rings"),
    		PINEAPPLE_CHUNKS(2116,2,"Pineapple Chunks"),
    		PURPLE_SWEETS(10476,3,"Purple Sweets");
    		
    		
    		private int id; private int heal; private String name;
    		
    		private FoodToEat(int id, int heal, String name) {
    			this.id = id;
    			this.heal = heal;
    			this.name = name;		
    		}
    		
    		public int getId() {
    			return id;
    		}
    
    		public int getHeal() {
    			return heal;
    		}
    		
    		public String getName() {
    			return name;
    		}
    		public static HashMap <Integer,FoodToEat> food = new HashMap<Integer,FoodToEat>();
    		
    		public static FoodToEat forId(int id) {
    			return food.get(id);
    		}
    		
    		static {
    		for (FoodToEat f : FoodToEat.values())
    			food.put(f.getId(), f);
    		}
    	}
    	
    	public void eat(int id, int slot) {
    		if (c.duelRule[6]) {
    			c.sendMessage("You may not eat in this duel.");
    			return;
    		}
    		if (System.currentTimeMillis() - c.foodDelay >= 1500 && c.playerLevel[3] > 0) {
    			c.getCombat().resetPlayerAttack();
    			c.attackTimer += 2;
    			c.startAnimation(829);
    			c.getItems().deleteItem(id,slot,1);
    			FoodToEat f = FoodToEat.food.get(id);
    			if (c.playerLevel[3] < c.getLevelForXP(c.playerXP[3])) {
    				c.playerLevel[3] += f.getHeal();
    				if (c.playerLevel[3] > c.getLevelForXP(c.playerXP[3]))
    					c.playerLevel[3] = c.getLevelForXP(c.playerXP[3]);
    			}
    			c.foodDelay = System.currentTimeMillis();
    			c.getPA().refreshSkill(3);
    			c.sendMessage("You eat the " + f.getName() + ".");
    		}		
    	}
    
    	
    	public boolean isFood(int id) {
    		return FoodToEat.food.containsKey(id);
    	}	
    	
    
    }
    Last edited by Major; 09-08-2014 at 08:34 PM.
    Reply With Quote  
     

  9. #6  
    Registered Member
    Join Date
    Jun 2014
    Posts
    21
    Thanks given
    1
    Thanks received
    5
    Rep Power
    19
    if u need any more files just tell me and i will post them straight away
    Reply With Quote  
     

  10. #7  
    Registered Member
    Join Date
    Oct 2013
    Posts
    775
    Thanks given
    48
    Thanks received
    104
    Rep Power
    14
    Quote Originally Posted by jafoofla View Post
    if u need any more files just tell me and i will post them straight away
    paste your clickitem packet
    Reply With Quote  
     

  11. #8  
    Registered Member Tatsuya's Avatar
    Join Date
    Dec 2011
    Posts
    335
    Thanks given
    74
    Thanks received
    52
    Rep Power
    61
    You sure your food.java is even implemented? It'd need to be declared in client.java.
    Reply With Quote  
     

  12. #9  
    Registered Member
    Join Date
    Oct 2013
    Posts
    775
    Thanks given
    48
    Thanks received
    104
    Rep Power
    14
    Quote Originally Posted by Drenkai View Post
    You sure your food.java is even implemented? It'd need to be declared in client.java.
    uhm. no, not really.
    Reply With Quote  
     

  13. #10  
    Registered Member
    Join Date
    Feb 2014
    Posts
    58
    Thanks given
    11
    Thanks received
    11
    Rep Power
    16
    try replacing eat with:

    Code:
    	public void eat(int id, int slot) {
    		if (c.duelRule[6]) {
    			c.sendMessage("You may not eat in this duel.");
    			return;
    		}
    		if (System.currentTimeMillis() - c.foodDelay >= 1500 && c.playerLevel[3] > 0) {
    			c.getCombat().resetPlayerAttack();
    			c.attackTimer += 2;
    			c.startAnimation(829);
    			c.getItems().deleteItem(id,slot,1);
    			//FoodToEat f = FoodToEat.food.get(id);
    			for (FoodToEat f : FoodToEat.values())
    				if(f.getId() == id){
    					if (c.playerLevel[3] < c.getLevelForXP(c.playerXP[3])) {
    						c.playerLevel[3] += f.getHeal();
    						if (c.playerLevel[3] > c.getLevelForXP(c.playerXP[3]))
    							c.playerLevel[3] = c.getLevelForXP(c.playerXP[3]);
    					}
    				}
    			}
    			c.foodDelay = System.currentTimeMillis();
    			c.getPA().refreshSkill(3);
    			c.sendMessage("You eat the " + f.getName() + ".");
    		}		
    	}
    Not sure why it is using a hashmap, the hashmap is unnecessary.
    Reply With Quote  
     

Page 1 of 3 123 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Food doesn't heal
    By Josh Ftw in forum Help
    Replies: 3
    Last Post: 07-26-2014, 07:30 PM
  2. food is not healing
    By distryct in forum Help
    Replies: 0
    Last Post: 07-13-2014, 01:34 AM
  3. [PI] Food Does Not Heal
    By Joseph69 in forum Help
    Replies: 13
    Last Post: 09-24-2013, 08:19 AM
  4. Every Food Id, Name & Heal Amount through xml
    By Infexis in forum Snippets
    Replies: 14
    Last Post: 06-04-2012, 07:34 AM
  5. Changing how much food heals (EASY)
    By Icepkz in forum Tutorials
    Replies: 7
    Last Post: 05-21-2007, 01:48 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •