Thread: [PI] Cooking || Fish || Meat || (Incomplete) Pies || Fire || Range

Page 1 of 3 123 LastLast
Results 1 to 10 of 29
  1. #1 [PI] Cooking || Fish || Meat || (Incomplete) Pies || Fire || Range 
    Registered Member

    Join Date
    Apr 2012
    Posts
    762
    Thanks given
    0
    Thanks received
    276
    Rep Power
    213
    Cooking.java

    Code:
    package game.skill.cooking;
    
    import engine.event.CycleEvent;
    import engine.event.CycleEventContainer;
    import engine.event.CycleEventHandler;
    import game.Client;
    import game.Server;
    import game.clip.ObjectDef;
    import game.skill.SkillHandler;
    
    public class Cooking extends SkillHandler {
    
    	private static enum cookingData {
    
    		BEEF_MEAT(2132, 2142, 2146, 1, 30, 7, true),
    		RAT_MEAT(2134, 2142, 2146, 1, 30, 7, true),
    		BEAR_MEAT(2136, 2142, 2146, 1, 30, 7, true),
    		CHICKEN(2138, 2140, 2144, 1, 30, 7, true),
    		RABBIT(3226, 3228, 7222, 1, 30, 7, true),
    		UTHANKI(1859, 1861, 323, 1, 40, 7, true),
    		RED_BERRY_PIE(2321, 2325, 2329, 10, 78, 15, false),
    		MEAT_PIE(2317, 2327, 2329, 20, 110, 25, false),
    		MUD_PIE(2319, 7170, 2329, 29, 128, 35, false),
    		APPLE_PIE(7168, 2323, 2329, 30, 180, 35, false),
    		GARDEN_PIE(7186, 7188, 2329, 47, 164, 52, false),
    		FISH_PIE(7186, 7188, 2329, 47, 164, 52, false),
    		ADMIRIAL_PIE(7196, 1798, 2329, 70, 210, 77, false),
    		WILD_PIE(7206, 7208, 2329, 85, 140, 90, false),
    		SUMMER_PIE(7216, 7218, 2329, 95, 260, 100, false),
    		PIZZA_(2287, 2289, 2305, 35, 143, 38, true),
    		CAKE(1889, 1891, 1903, 40, 180, 38, false),
    		BREAD(2307, 2309, 2311, 1, 40, 5, false),
    		PIITA_BREAD(1863, 1865, 1867, 58, 40, 65, true),
    		SHRIMP(317, 315, 323, 1, 30, 34, true),
    		SARDINE(327, 325, 369, 1, 40, 38, true),
    		ANCHOVIES(321, 319, 323, 1, 30, 34, true),
    		HERRING(345, 347, 357, 5, 50, 37, true),
    		MACKEREL(353, 355, 357, 10, 60, 35, true),
    		TROUT(335, 333, 343, 15, 70, 50, true),
    		COD(341, 339, 343, 17, 75, 39, true),
    		PIKE(349, 351, 343, 20, 80, 52, true),
    		SALMON(331, 329, 343, 25, 90, 58, true),
    		TUNA(359, 361, 367, 30, 100, 65, true),
    		LOBSTER(377, 379, 381, 40, 120, 74, true),
    		BASS(363, 365, 367, 43, 130, 80, true),
    		SWORDFISH(371, 373, 375, 45, 140, 86, true),
    		SHARK(383, 385, 387, 80, 210, 104, true),
    		MANTA_RAY(389, 391, 393, 91, 216, 112, true),
    		ROCKTAIL(15270, 15272, 15274, 93, 225, 120, true);
    
    		private int rawId, cookedId, burntId, level, xp, burnStop;
    		private boolean fire;
    
    		private cookingData(final int rawId, final int cookedId, final int burntId, final int level, final int xp, final int burnStop, final boolean fire) {
    			this.rawId = rawId;
    			this.cookedId = cookedId;
    			this.burntId = burntId;
    			this.level = level;
    			this.xp = xp;
    			this.burnStop = burnStop;
    			this.fire = fire;
    		}
    
    		public int getRaw() {
    			return rawId;
    		}
    
    		public int getCooked() {
    			return cookedId;
    		}
    
    		public int getBurnt() {
    			return burntId;
    		}
    
    		public int getLevel() {
    			return level;
    		}
    
    		public int getXP() {
    			return xp;
    		}
    
    		public int getBurnStop() {
    			return burnStop;
    		}
    
    		public boolean getFire() {
    			return fire;
    		}
    	}
    
    	private static int[][] cookingGauntlets = {
    		{359, 63},
    		{377, 68},
    		{371, 81},
    		{383, 94},
    		{15270, 94},
    	};
    	
    	private static int burnChance(final Client c, final int level, final int levelNeeded, final int burnStop) {
    		int burnChance = 55;
    		int burnFactor = (burnStop - levelNeeded);
    		int levelFactor = (level - levelNeeded);
    		burnChance -= (levelFactor * (burnChance / burnFactor));
    		return burnChance;
    	}
    	
    	private static int burnStop;
    
    	public static void cook(final Client c, final int itemId, final int objectId, final int objectX, final int objectY) {
    		if (isSkilling[7] == true) {
    			return;
    		}
    		final String name = ObjectDef.getObjectDef(objectId).name;
    		for (final cookingData co : cookingData.values()) {
    			if (itemId == co.getRaw()) {
    				if (c.playerLevel[7] < co.getLevel()) {
    					c.sendMessage("You need a cooking level of "+ co.getLevel() +" to cook this meat.");
    					return;
    				}
    				if (!name.equalsIgnoreCase("fire") && !name.equalsIgnoreCase("stove") && !name.equalsIgnoreCase("cooking range") && !name.equalsIgnoreCase("cooking pot")) {
    					c.sendMessage("You cannot cook on a "+ name.toLowerCase() +".");
    					return;
    				}
    				if (name.equalsIgnoreCase("fire") && co.getFire() == false) {
    					c.sendMessage("You cannot cook a "+ name.toLowerCase() +" on a fire.");
    					return;
    				}
    				isSkilling[7] = true;
    				boolean fire;
    				if (name.equalsIgnoreCase("fire")) {
    					fire = true;
    				} else {
    					fire = false;
    				}
    				final int animation;
    				if (fire == true) {
    					animation = 897;
    				} else {
    					animation = 896;
    				}
    				burnStop = co.getBurnStop();
    				if (c.playerEquipment[c.playerHands] == 775) {
    					for (int i = 0; i < cookingGauntlets.length; i++) {
    						if (itemId == cookingGauntlets[i][0]) {
    							burnStop = cookingGauntlets[i][1];
    						}
    					}
    				}
    				final boolean noBurn = c.playerLevel[7] >= burnStop;
    				c.startAnimation(animation);
    				CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
    					@Override
    					public void execute(CycleEventContainer container) {
    						if (isSkilling[7] == true) {
    							if (Server.objectManager.objectExists(objectX, objectY)) {
    								if (c.getItems().playerHasItem(itemId)) {
    									c.startAnimation(animation);
    									c.getItems().deleteItem(itemId, 1);
    									if (((Math.random() * 175) < burnChance(c, c.playerLevel[7], co.getLevel(), burnStop)) && noBurn == false) {
    										c.getItems().addItem(co.getBurnt(), 1);
    										c.sendMessage("You accidentally burn the "+ co.toString().toLowerCase().replaceAll("_", " ") +".");
    									} else {
    										c.getItems().addItem(co.getCooked(), 1);
    										c.getPA().addSkillXP(co.getXP(), 7);
    										c.sendMessage("You successfully cook the "+ co.toString().toLowerCase().replaceAll("_", " ") +".");
    									}
    								}
    							} else {
    								container.stop();
    							}
    						} else {
    							container.stop();
    						}
    					}
    					@Override
    					public void stop() {
    						isSkilling[7] = false;
    					}
    				}, 3);
    			}
    		}
    	}
    }
    UseItem.java - ItemonObject

    Code:
    Cooking.cook(c, itemId, objectID, objectX, objectY);
    Reply With Quote  
     

  2. Thankful users:


  3. #2  
    Registered Member
    Join Date
    Oct 2010
    Posts
    560
    Thanks given
    85
    Thanks received
    21
    Rep Power
    16
    Good work like all the other releases

    Spoiler for Rs3 Account:
    Reply With Quote  
     

  4. #3  
    Registered Member
    Archspire's Avatar
    Join Date
    May 2011
    Age
    30
    Posts
    1,764
    Thanks given
    385
    Thanks received
    514
    Rep Power
    222
    Decent, keep up the good releases. I'd love you if you released a better Smithing system
    Reply With Quote  
     

  5. #4  
    Registered Member

    Join Date
    Apr 2012
    Posts
    762
    Thanks given
    0
    Thanks received
    276
    Rep Power
    213
    Quote Originally Posted by Archspire View Post
    Decent, keep up the good releases. I'd love you if you released a better Smithing system
    I'm doing crafting and fletching next might do smithing after those 2 :3
    Reply With Quote  
     

  6. #5  
    Owner of Dawntained

    Mgt Madness's Avatar
    Join Date
    Oct 2011
    Age
    28
    Posts
    3,380
    Thanks given
    1,429
    Thanks received
    958
    Rep Power
    2168
    Damn, your snippets are sick
    Attached image
    Reply With Quote  
     

  7. #6  
    Server Developer
    braybray125's Avatar
    Join Date
    Jun 2012
    Age
    33
    Posts
    71
    Thanks given
    77
    Thanks received
    2
    Rep Power
    11
    Nice snippet
    Reply With Quote  
     

  8. #7  
    Why are you looking here?


    Join Date
    Jul 2012
    Age
    30
    Posts
    3,214
    Thanks given
    830
    Thanks received
    357
    Rep Power
    559
    Nice one dude
    Reply With Quote  
     

  9. #8  
    Registered Member
    Join Date
    Aug 2009
    Posts
    630
    Thanks given
    79
    Thanks received
    24
    Rep Power
    52
    got no iskilling[7]
    Reply With Quote  
     

  10. #9  
    Registered Member

    Join Date
    Apr 2012
    Posts
    762
    Thanks given
    0
    Thanks received
    276
    Rep Power
    213
    public boolean[] isSkilling = new boolean[25];
    Reply With Quote  
     

  11. #10  
    Registered Member
    Join Date
    Aug 2009
    Posts
    630
    Thanks given
    79
    Thanks received
    24
    Rep Power
    52
    1 more question what we need to add in clicking buttons
    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. Replies: 20
    Last Post: 01-28-2013, 12:50 AM
  2. [PI] Cooking more than fish
    By Asphyxiation in forum Help
    Replies: 0
    Last Post: 01-27-2012, 08:08 PM
  3. [Shard] 100% Perfect Cooking [Range, Fire]
    By R0cky 0wnz in forum Tutorials
    Replies: 17
    Last Post: 04-24-2011, 01:32 PM
  4. Simple Fish Cooking
    By IDX in forum Tutorials
    Replies: 5
    Last Post: 12-28-2008, 05:16 AM
  5. Cooking - On Range and Fire!
    By Santa Noobie in forum Tutorials
    Replies: 5
    Last Post: 05-04-2007, 04:43 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
  •