Thread: [PI] Firemaking Help

Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1 [PI] Firemaking Help 
    Expect the Unexpected

    Acquittal's Avatar
    Join Date
    Jan 2011
    Age
    30
    Posts
    1,182
    Thanks given
    627
    Thanks received
    233
    Rep Power
    238
    Right now when I do fletching, it lights the fire with the log. This is because my firemaking does not check the item that the log is used with. How would I make it only light the fire if the log is used with item 590 (tinderbox)?

    ItemOnItem.java
    Code:
    UseItem.ItemonItem(c, itemUsed, useWith);
    		if((useWith == 1511 || itemUsed == 1511) && (useWith == 946 || itemUsed == 946)) {
    			Fletching.normal(c, itemUsed, useWith);
    		} else if(useWith == 946 || itemUsed == 946) {
    			Fletching.others(c, itemUsed, useWith);
    		} else if(Fletching.arrows(c, itemUsed, useWith)) {
    			Fletching.makeArrows(c, itemUsed, useWith);
    		}
    						if (c.getFiremaking().isLog(itemUsed)) {
    			c.getFiremaking().lightFire(c, itemUsed, itemUsedSlot);
    		}
    		if (c.getFiremaking().isLog(useWith)) {
    			c.getFiremaking().lightFire(c, useWith, usedWithSlot);
    		}
    Firemaking
    Code:
    package server.model.players.skills;
    
    import server.model.players.Client;
    import server.clip.region.Region;
    import server.model.players.skills.Firemaking;
    import server.event.CycleEvent;
    import server.event.CycleEventContainer;
    import server.event.CycleEventHandler;
    import server.Server;
    import server.Config;
    import server.util.Misc;
    import server.world.ItemHandler;
    import server.model.objects.Objects;
    import server.util.Misc;
    
    /**
     * Firemaking.java
     *
     * @author Spike/Flow/Faris
     *
     **/ 
    public class Firemaking {
    
    	private final Client c;
    	
    	public Firemaking(final Client c) {
    		this.c = c;
    	}
    
    	public enum Firemake {
    		NORMAL(1511, 40, 1, 4266, 30),
    		OAK(1521, 60, 15, 4266, 45),
    		WILLOW(1519, 90, 30, 4266, 60),
    		MAPLE(1517, 135, 45, 4266, 85),
    		YEW(1515, 200, 60, 4266, 110),
    		MAGIC(1513, 300, 75, 4266, 135),
    		RED(7404, 50, 1, 11404, 30),
    		GREEN(7405, 50, 1, 11405, 30),
    		BLUE(7406, 50, 1, 11406, 30),
    		PURPLE(10329, 50, 1, 20001, 30),
    		WHITE(10328, 50, 1, 20000, 30);
    
    		int logID, xp, levelReq, obj, last;
    
    		private Firemake(int logID, int xp, int levelReq, int obj, int last) {
    			this.logID = logID;
    			this.xp = xp;
    			this.levelReq = levelReq;
    			this.obj = obj;
    			this.last = last;
    		}
    	}
    
    	public Firemake forLog(int id) {
    		for (Firemake f : Firemake.values()) {
    			if (f.logID == id) {
    				return f;
    			}
    		}
    		return null;
    	}
    	
    	public boolean isLog(int id) {
    		return forLog(id) != null;
    	}
    
    	public void lightFire(final Client c, int logID, int fromSlot) {
    	
    	Firemake f = forLog(logID);
    	
    	final int x = c.getX();
    	final int y = c.getY();
    	final int last = f.last + Misc.random(5);
    	final int logid = f.logID;
    
    		if (f != null) {
    			if (System.currentTimeMillis() - c.lastLight > 1800) {
    				if (c.playerLevel[c.playerFiremaking] >= f.levelReq) {
    					if (c.getItems().playerHasItem(590) && c.getItems().playerHasItem(f.logID)) {	
    						c.lastLight = System.currentTimeMillis();
    						c.getItems().deleteItem(f.logID, fromSlot, 1);
    						c.getPA().addSkillXP(f.xp *Config.FIREMAKING_EXPERIENCE, c.playerFiremaking);
    						//c.startAnimation(733);
    						c.getPA().object(f.obj, c.getX(), c.getY(), 0, 10);
    						
    						CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
    							int timer = last;
    							
    						@Override
    						public void execute(CycleEventContainer container) {
    						//c.startAnimation(-1);
    						if (timer == 0 && timer != -1) {
    						c.startAnimation(65535);  
    							container.stop();
    							}
    							
    						if (timer > 0 && c != null) {					
    						timer--;
    						//c.sendMessage("log timer = "+timer +"/"+last +" logId = " +logid);
    							}
    						}
    
    						@Override
    						public void stop() {
    								c.getPA().object(-1, x, y, 1, 10);
    								c.getItems().createGroundItem(592, x, y, 1);
    								//c.sendMessage("turned = "+logid +"into ashes");		
    							}
    						}, 1);	
    												//c.startAnimation(-1);
    
    						c.turnPlayerTo(c.getX() + 1, c.getY());
    						if (Region.getClipping(c.getX() - 1, c.getY(), c.heightLevel, -1, 0)) {
    							c.getPA().walkTo(-1, 0);
    						} else if (Region.getClipping(c.getX() + 1, c.getY(), c.heightLevel, 1, 0)) {
    							c.getPA().walkTo(1, 0);
    						} else if (Region.getClipping(c.getX(), c.getY() - 1, c.heightLevel, 0, -1)) {
    							c.getPA().walkTo(0, -1);
    						} else if (Region.getClipping(c.getX(), c.getY() + 1, c.heightLevel, 0, 1)) {
    							c.getPA().walkTo(0, 1);
    						}
    					}
    				} else {
    					c.sendMessage("You need a firemaking level of at least "+f.levelReq+" to burn this log.");
    				}
    			}
    		}
    	}
    }
    Would appreciate any help + will rep and thanks!
    Reply With Quote  
     

  2. #2  
    #Winning

    Join Date
    Apr 2011
    Age
    28
    Posts
    2,245
    Thanks given
    367
    Thanks received
    388
    Rep Power
    1187
    Code:
    if (c.getFiremaking().isLog(itemUsed)) {
    			c.getFiremaking().lightFire(c, itemUsed, itemUsedSlot);
    		}
    		if (c.getFiremaking().isLog(useWith)) {
    			c.getFiremaking().lightFire(c, useWith, usedWithSlot);
    		}
    Change itemUsed/useWith to the tinderbox id?


    Vouches
    Spoiler for Vouches:

    Quote Originally Posted by Exile rsps View Post
    Vouch thanks for that pic
    Quote Originally Posted by bwuk _im_pb View Post
    i vouch for charlie hes legit
    Quote Originally Posted by Pastaway
    Vouch for 'Charlie. Added a tut to my server I couldn't add and payed him after =]
    Quote Originally Posted by mongolias
    Vouch for 'Charlie. Sold me a banner, the trade went quick and efficiently.
    Quote Originally Posted by Lane
    Vouch for charlie, he is #1
    Quote Originally Posted by Raw Envy View Post
    Vouch for Charlie.
    Quote Originally Posted by -Null Code-
    Vouch Legit bought rs membership
    Quote Originally Posted by tucybro
    Traded with Charlie, went smoothly I went first and he paid promptly without and issues, great trader!



    Reply With Quote  
     

  3. #3  
    Registered Member

    Join Date
    Aug 2011
    Posts
    2,760
    Thanks given
    297
    Thanks received
    534
    Rep Power
    1596
    ItemOnItem.java > replace if with else if
    Quote Originally Posted by Aj View Post
    This is not even a tutorial. It's fail for rep. It's fail for life.
    Reply With Quote  
     

  4. #4  
    Registered Member

    Join Date
    Aug 2011
    Posts
    2,760
    Thanks given
    297
    Thanks received
    534
    Rep Power
    1596
    Replace 'if' with 'else if'
    Quote Originally Posted by Aj View Post
    This is not even a tutorial. It's fail for rep. It's fail for life.
    Reply With Quote  
     

  5. #5  
    Expect the Unexpected

    Acquittal's Avatar
    Join Date
    Jan 2011
    Age
    30
    Posts
    1,182
    Thanks given
    627
    Thanks received
    233
    Rep Power
    238
    Quote Originally Posted by 'Spike View Post
    Replace 'if' with 'else if'
    So like this?

    Code:
    if((useWith == 1511 || itemUsed == 1511) && (useWith == 946 || itemUsed == 946)) {
    			Fletching.normal(c, itemUsed, useWith);
    		} else if(useWith == 946 || itemUsed == 946) {
    			Fletching.others(c, itemUsed, useWith);
    		} else if(Fletching.arrows(c, itemUsed, useWith)) {
    			Fletching.makeArrows(c, itemUsed, useWith);
    		} else if (c.getFiremaking().isLog(itemUsed)) {
    			c.getFiremaking().lightFire(c, itemUsed, itemUsedSlot);
    		} else if (c.getFiremaking().isLog(useWith)) {
    			c.getFiremaking().lightFire(c, useWith, usedWithSlot);
    		}
    ?
    Reply With Quote  
     

  6. #6  
    Registered Member

    Join Date
    Aug 2011
    Posts
    2,760
    Thanks given
    297
    Thanks received
    534
    Rep Power
    1596
    Quote Originally Posted by Pobear View Post
    So like this?

    Code:
    if((useWith == 1511 || itemUsed == 1511) && (useWith == 946 || itemUsed == 946)) {
    			Fletching.normal(c, itemUsed, useWith);
    		} else if(useWith == 946 || itemUsed == 946) {
    			Fletching.others(c, itemUsed, useWith);
    		} else if(Fletching.arrows(c, itemUsed, useWith)) {
    			Fletching.makeArrows(c, itemUsed, useWith);
    		} else if (c.getFiremaking().isLog(itemUsed)) {
    			c.getFiremaking().lightFire(c, itemUsed, itemUsedSlot);
    		} else if (c.getFiremaking().isLog(useWith)) {
    			c.getFiremaking().lightFire(c, useWith, usedWithSlot);
    		}
    ?
    I suggest you try it out..
    Quote Originally Posted by Aj View Post
    This is not even a tutorial. It's fail for rep. It's fail for life.
    Reply With Quote  
     

  7. #7  
    Expect the Unexpected

    Acquittal's Avatar
    Join Date
    Jan 2011
    Age
    30
    Posts
    1,182
    Thanks given
    627
    Thanks received
    233
    Rep Power
    238
    I did, does not work or fix the problem.
    Reply With Quote  
     

  8. #8  
    Expect the Unexpected

    Acquittal's Avatar
    Join Date
    Jan 2011
    Age
    30
    Posts
    1,182
    Thanks given
    627
    Thanks received
    233
    Rep Power
    238
    Quote Originally Posted by 'Charlie View Post
    Code:
    if (c.getFiremaking().isLog(itemUsed)) {
    			c.getFiremaking().lightFire(c, itemUsed, itemUsedSlot);
    		}
    		if (c.getFiremaking().isLog(useWith)) {
    			c.getFiremaking().lightFire(c, useWith, usedWithSlot);
    		}
    Change itemUsed/useWith to the tinderbox id?
    Tried this:

    Code:
    	if (c.getFiremaking().isLog(590)) {
    			c.getFiremaking().lightFire(c, itemUsed, itemUsedSlot);
    		}
    		if (c.getFiremaking().isLog(590)) {
    			c.getFiremaking().lightFire(c, useWith, usedWithSlot);
    		}
    Did not work either.
    Reply With Quote  
     

  9. #9  
    Registered Member

    Join Date
    Aug 2011
    Posts
    2,760
    Thanks given
    297
    Thanks received
    534
    Rep Power
    1596
    Quote Originally Posted by Pobear View Post
    I did, does not work or fix the problem.
    In that case the method is most likely the same as the fletching one, so check if the item is a log or a knife.
    Quote Originally Posted by Aj View Post
    This is not even a tutorial. It's fail for rep. It's fail for life.
    Reply With Quote  
     

  10. #10  
    Expect the Unexpected

    Acquittal's Avatar
    Join Date
    Jan 2011
    Age
    30
    Posts
    1,182
    Thanks given
    627
    Thanks received
    233
    Rep Power
    238
    I have this

    Code:
    if((useWith == 1511 || itemUsed == 1511) && (useWith == 946 || itemUsed == 946)) {
    			Fletching.normal(c, itemUsed, useWith);
    		} else if(useWith == 946 || itemUsed == 946) {
    			Fletching.others(c, itemUsed, useWith);
    		} else if(Fletching.arrows(c, itemUsed, useWith)) {
    			Fletching.makeArrows(c, itemUsed, useWith);
    		} else if (c.getFiremaking().isLog(590)) {
    			c.getFiremaking().lightFire(c, itemUsed, itemUsedSlot);
    		} else if (c.getFiremaking().isLog(useWith)) {
    			c.getFiremaking().lightFire(c, useWith, usedWithSlot);
    		}
    I can use any item, such as shrimps, on logs, and it lights a fire, but if it is a knife, it does not light a fire, and goes to fletching. So how would I make it so that it needs a tinderbox to light.
    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. [PI] Firemaking.
    By Alpi in forum Snippets
    Replies: 14
    Last Post: 10-21-2011, 04:01 AM
  2. [PI] Firemaking
    By LiveAscape in forum Help
    Replies: 1
    Last Post: 05-31-2011, 03:09 PM
  3. firemaking Pi
    By Scenemo in forum Help
    Replies: 0
    Last Post: 05-09-2011, 08:45 AM
  4. Firemaking!
    By Origin in forum Media
    Replies: 3
    Last Post: 06-22-2009, 08:47 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
  •