Thread: [PI] Piece of Firemaking

Page 1 of 2 12 LastLast
Results 1 to 10 of 15
  1. #1 [PI] Piece of Firemaking 
    Banned
    Join Date
    Sep 2012
    Posts
    1
    Thanks given
    192
    Thanks received
    317
    Rep Power
    0
    This is just a piece of it. Don't flame me.
    You must have [Only registered and activated users can see links. ]

    Code:
    package server.model.players.skills.Firemaking;
    
    import java.util.HashMap;
    
    import server.Server;
    import server.event.*;
    
    import server.model.players.Client;
    import server.model.players.Player;
    
    public class FiremakingManager {
    	/**
    	 *@author Gooroo
    	 */
    	private static long lastLight;
    	static int expMultiply = 25;
    	public boolean lightingLog;
    
    	private Client c;
    	private Player player;
    
    	public FiremakingManager(Client client) {
    		super();
    		this.c = client;
    	}
    
    	//Done
    
    	public enum Firemake {
    		//logID xp levelReq obj
    		NORMAL(1511, 40, 1, 2732),
    		OAK(1521, 60, 15, 2732),
    		WILLOW(1519, 90, 30, 2732),
    		MAPLE(1517, 135, 45, 2732),
    		YEW(1515, 203, 60, 2732),
    		MAGIC(1513, 304, 75, 2732),
    		RED(7404, 50, 1, 11406),
    		GREEN(7405, 50, 1, 11405),
    		BLUE(7406, 50, 1, 11404);
    
    		private int log, requiredLevel, object;
    
    		private double experience;
    
    		private static HashMap<Integer, Firemake> logs = new HashMap<Integer, Firemake>();
    		
    
    		private Firemake(int log, double experience, int requiredLevel, int object) {
    			this.log = log;
    			this.requiredLevel = requiredLevel;
    			this.object = object;
    			this.experience = experience;
    		}
    
    		static {
    			for (Firemake firemake : Firemake.values()) {
    				logs.put(firemake.log, firemake);
    			}
    		}
    		
    
    		public int getLog() {
    			return log;
    		}
    
    		public int getRequiredLevel() {
    			return requiredLevel;
    		}
    
    		public int getObject() {
    			return object;
    		}
    
    		public double getExperience() {
    			return experience;
    		}
    
    		public static Firemake forId(int log) {
    			return logs.get(log);
    		}
    	}
    
    	public static boolean isLog(int id) {
    		return Firemake.forId(id) != null;
    	}
    	
    		
    
    	Firemake firemake;
    
    	public void lightFire(int id) {
    		firemake = Firemake.forId(id);
    		try {
    			if (firemake != null) {
    				if(System.currentTimeMillis() - lastLight > 2500){//time (in seconds)
    					if(c.playerLevel[c.playerFiremaking] >= firemake.getRequiredLevel()){
    						lastLight = System.currentTimeMillis();
    						c.startAnimation(733);
    						c.getPA().walkTo(lightingLog == true ? -1 : 1, 0);
    						c.sendMessage("You attempt to light a fire.");
    						c.getPA().object(firemake.getObject(), c.getX(), c.getY(), 0, 10);
    						CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
    							int timer = 1;
    							public void execute(CycleEventContainer container) {
    								if (timer == 0) {
    									container.stop();
    
    								}
    								timer--;
    
    							}
    							public void stop() {
    								//Server.itemHandler.createGroundItem(c, 592, x, y, 0,1, c.playerId);
    								c.getPA().object(-1, c.getX(), c.getY(), 0, 10);
    								this.stop();
    							}
    
    						}, 300);
    					} else {
    						c.getDH().sendStatement("You need a Firemaking level of "+firemake.getRequiredLevel()+" to light this.");
    					}
    				}
    			} else {
    				System.out.println("Firemaking has nulled out - please do something about it.");
    			}
    		} catch (Exception e) {
    			e.printStackTrace();
    		}
    	}
    }
    Import the following into UseItem.java:
    Code:
    import server.model.players.skills.Firemaking.FiremakingManager;
    import server.model.players.skills.Firemaking.FiremakingManager.Firemake;
    Add this somewhere in UseItem.java:
    Code:
    private static Firemake firemake;
    Still in UseItem
    Find this:
    Code:
    public static void ItemonItem(Client c, int itemUsed, int useWith) {
    And when you see an else if statement like:
    Code:
    } else if (Arrows.darts(itemUsed, useWith)) {
    			Arrows.makeDarts(c, itemUsed, useWith);
    Under it add:
    Code:
    } else if (useWith == 590 || itemUsed == 590) {
    			int logId = (useWith == 590 ? itemUsed : useWith);
    			c.getfiremaking().lightFire(logId);
    Reply With Quote  
     

  2. Thankful user:


  3. #2  
    PokeFrontier Java Developer

    Pokemon's Avatar
    Join Date
    May 2011
    Posts
    2,733
    Thanks given
    494
    Thanks received
    801
    Discord
    View profile
    Rep Power
    1242
    Nice use of enums Gooroo although i have a question regarding the timer integer why is it set to 1? itll be like creating a fire every millisecond

    [Only registered and activated users can see links. ]



    Pokemon loves his
    Reply With Quote  
     

  4. #3  
    Banned
    Join Date
    Sep 2012
    Posts
    1
    Thanks given
    192
    Thanks received
    317
    Rep Power
    0
    Woops. I won't fix, lets see if they can fix it.
    Reply With Quote  
     

  5. #4  
    Banned

    Join Date
    Jun 2012
    Posts
    1,119
    Thanks given
    119
    Thanks received
    199
    Rep Power
    0
    Can be improved, but goodjob gooroo
    Reply With Quote  
     

  6. #5  
    Banned
    Join Date
    Sep 2012
    Posts
    1
    Thanks given
    192
    Thanks received
    317
    Rep Power
    0
    Thanks brandon.
    Reply With Quote  
     

  7. #6  
    Banned
    Join Date
    Aug 2012
    Posts
    72
    Thanks given
    44
    Thanks received
    3
    Rep Power
    0
    Nice job jake. Will use.
    Reply With Quote  
     

  8. #7  
    Banned
    Join Date
    Sep 2012
    Posts
    1
    Thanks given
    192
    Thanks received
    317
    Rep Power
    0
    Thank you.
    Reply With Quote  
     

  9. #8  
    ~! Legit ~!

    Join Date
    Nov 2010
    Posts
    1,973
    Thanks given
    183
    Thanks received
    211
    Rep Power
    237
    Not bad just a base kinda needs clipping but goodjob on enums.
    [Only registered and activated users can see links. ]
    Spoiler for My Vouches:
    Quote Originally Posted by mattsforeal View Post
    I paid $5 went first, he fixed my problem and it worked. 100% legit would do it again.
    Quote Originally Posted by Mythic View Post
    Vouch for him, very smooth and fast trade, purchased his last 4m. Have fun with your new membership
    Quote Originally Posted by Harlan View Post
    Vouch, trustworthy guy.
    Quote Originally Posted by iPhisher™ View Post
    Vouch for Super-Man, he is a very legit and trustable guy.
    Reply With Quote  
     

  10. #9  
    Registered Member
    Mimi's Avatar
    Join Date
    Feb 2011
    Age
    25
    Posts
    860
    Thanks given
    253
    Thanks received
    91
    Rep Power
    195
    Not your codes those are mine !!!!
    "Simplicity is elegance"
    "Peace & Love"
    Reply With Quote  
     

  11. Thankful user:


  12. #10  
    Super Donator


    Join Date
    Feb 2011
    Age
    24
    Posts
    1,136
    Thanks given
    180
    Thanks received
    178
    Rep Power
    243
    well .. looks like a code from a released source..
    Reply With Quote  
     

Page 1 of 2 12 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: 5
    Last Post: 05-07-2012, 12:50 AM
  2. Replies: 395
    Last Post: 02-18-2012, 08:23 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
  •