Thread: Improving Devo Woodcutting

Results 1 to 5 of 5
  1. #1 Improving Devo Woodcutting 
    Registered Member
    Join Date
    Nov 2009
    Posts
    50
    Thanks given
    0
    Thanks received
    0
    Rep Power
    1
    This tutorial will teach you how to improve/fix the current devolution woodcutting

    Note: Ignore weird spacing in the code. Transferring from notepad++ to here spaces it weird for some reason.


    You must have done this first: [Only registered and activated users can see links. ]

    That just adds on to the event manager to prevent massing. No credits to me for that tutorial. All credits for that tutorial go to Zaga.

    Open woodcutting.java

    Declare these:

    Code:
    public int aX, aY;
    public int time, Time = 0;
    public int toadd1, xp1;
    private int busy = 0;
    Now replace 'public void readInput' with this:

    Code:
    public void readInput(int level, String type, client c, int objectx, int objecty, int objectid)
    	{
    		if (c.getStatus().isBusy()) {
    			return;
    		}
    		synchronized(this)
    		{
    		if (type.equals("NM") && level >= 1)
    		{
    			time = 2;
    			xp = 25;
    			item = 1511;
    			this.c.cancut = true;
    		}
    		
    		else if (type.equals("OAK") && level >= 15)
    		{
    			time = 10;
    			xp = 37;
    			item = 1521;
    			this.c.cancut = true;
    		}
    		
    		else if (type.equals("WILL") && level >= 30)
    		{
    			time = 12;
    			xp = 67;
    			item = 1519;
    			this.c.cancut = true;
    		}
    		
    		else if (type.equals("MAP") && level >= 45)
    		{
    			time = 15;
    			xp = 100;
    			item = 1517;
    			this.c.cancut = true;
    		}
    		
    		else if (type.equals("YEW") && level >= 60)
    		{
    			time = 20;
    			xp = 175;
    			item = 1515;
    			this.c.cancut = true;
    		}
    		
    		else if (type.equals("MAGE") && level >= 75)
    		{
    			time = 25;
    			xp = 250;
    			item = 1513;
    			this.c.cancut = true;
    		}
    		
    		else
    		{
    			c.getStatus().setNotBusy();
    			this.c.CAM().sendMessage("You need a higher woodcutting level to cut this tree!");
    			xp = 0;
    			item = -1;
    			this.c.cancut = false;
    		}
    		}
    			for (int id : VALIDAXE) {
    			if(id == c.playerEquipment[c.playerWeapon] && c.cancut && canwithaxe(c.playerEquipment[c.playerWeapon], c) || c.playerHasItem(id, 1) && c.cancut && canwithaxe(id, c)) {
    				//System.out.println("Called");
    				switch (id) {
    		case 1351:
    					c.wcanim = 879;
    					c.intervaldeduction = 0;
    					time--;
    					break;
    		case 1349:
    					c.wcanim = 877;
    					c.intervaldeduction = 1;
    					time--;
    					break;
    		case 1353:
    					c.wcanim = 875;
    					c.intervaldeduction = 2;
    					break;
    		case 1361:
    					c.wcanim = 873;
    					c.intervaldeduction = 3;
    					time -= 2;
    					break;
    		case 1355:
    					c.wcanim = 871;
    					c.intervaldeduction = 4;
    					time -= 3;
    					break;
    		case 1357:
    					c.wcanim = 869;
    					c.intervaldeduction = 5;
    					time -= 4;
    					break;
    		case 1359:
    					c.wcanim = 867;
    					c.intervaldeduction = 6;
    					time -= 5;
    					break;
    		case 6739:
    					c.wcanim = 2846;
    					c.intervaldeduction = 7;
    					time -= 6;
    					break;
    				} try {
    				c.getStatus().setBusy();
    				this.c.CAM().sendMessage("You swing your axe at the tree");
    				c.TurnPlayerTo(objectx, objecty);
    				this.c.wctime = misc.random(20 - c.intervaldeduction);
    if (type.equals("NM") && !type.equals("OAK") && !type.equals("WILL") && !type.equals("MAP") && !type.equals("YEW") && !type.equals("MAGE")) {
    				server.worldObject.registerObject(1, objectx, objecty, objectid, replace, 5, 10, 0, objectid);
    }
    if (type.equals("OAK") && !type.equals("NM") && !type.equals("WILL") && !type.equals("MAP") && !type.equals("YEW") && !type.equals("MAGE")) {
    				server.worldObject.registerObject(1 + misc.random(10), objectx, objecty, objectid, replace, 10, 10, 0, objectid);
    busy = 1;
    }
    if (type.equals("WILL") && !type.equals("OAK") && !type.equals("NM") && !type.equals("MAP") && !type.equals("YEW") && !type.equals("MAGE")) {
    				busy = 1;
    				server.worldObject.registerObject(1 + misc.random(10), objectx, objecty, objectid, replace, 20, 10, 0, objectid);
    }
    if (type.equals("MAP") && !type.equals("OAK") && !type.equals("NM") && !type.equals("WILL") && !type.equals("YEW") && !type.equals("MAGE")) {
    				busy = 1;
    				server.worldObject.registerObject(1 + misc.random(10), objectx, objecty, objectid, replace, 30, 10, 0, objectid);
    }
    if (type.equals("YEW") && !type.equals("OAK") && !type.equals("NM") && !type.equals("WILL") && !type.equals("MAP") && !type.equals("MAGE")) {
    				busy = 1;
    				server.worldObject.registerObject(1 + misc.random(10), objectx, objecty, objectid, replace, 70, 10, 0, objectid);
    }
    if (type.equals("MAGE") && !type.equals("OAK") && !type.equals("NM") && !type.equals("WILL") && !type.equals("MAP") && !type.equals("YEW")) {
    				busy = 1;
    				server.worldObject.registerObject(1 + misc.random(10), objectx, objecty, objectid, replace, 120, 10, 0, objectid);
    }
    				this.c.wc.doaction(c, item, -1, -1, objectx, objecty, objectid, xp);
    				}
    				catch(Exception e)
    				{
    					e.printStackTrace();
    				}
    				break;
    				}
    			else if (id == c.playerEquipment[c.playerWeapon] && c.cancut && !canwithaxe(c.playerEquipment[c.playerWeapon], c) || c.playerHasItem(id, 1) && c.cancut && !canwithaxe(id, c))
    			{
    				c.getStatus().setNotBusy();
    				c.CAM().sendMessage("You need a higher woodcutting level to use this woodcutting axe!");
    				c.cancut = false;
    				c.iscutting = false;
    			}
    			}
    			}
    This new code sets the time it will take to chop down trees. The time is based on the woodcutting axe you are using, and the tree you are cutting.

    Next replace 'public boolean doaction' with this:

    Code:
    public boolean doaction(final client c, final int toadd, final int toremove, final int toremove2, final int x, final int y, final int objectid, final int xp) {
    	aX = x;
    	aY = y;
    	c.pEmote = c.wcanim;
    	busy = 0;
    	server.registerEvent(new Event((2000 + Time), c.clickauth) {
    		public void execute() {
    			if (c.clickauth == this.authcode && true && busy == 0 & c.cancut != false){
    				if (c.freeSlots() > 0) {
    					server.worldObject.reduceHealth(x, y);
    					if (c.pEmote != c.wcanim) {
    							c.pEmote = c.wcanim;
    					}
    					if (time < 0) {
    						time = 0;
    					}
    					Time = ((1000 + (1 + misc.random(time) * 100)) * 2);
    					toadd1 = toadd;
    					c.iscutting = true;
    					xp1 = xp;
    					c.CAM().sendMessage("You get some logs");
    					c.addItem(toadd1, 1);
    					c.addSkillXP(xp1 * server.SERVER_EXPERIENCE, 8);
    				} else {
    					c.pEmote = c.CAM().GetStandAnim(c.playerEquipment[c.playerWeapon]);
    					server.deregisterEvent(this);
    					c.getStatus().setNotBusy();
    					c.CAM().sendMessage("You've do not have enough room in your inventory.");
    					c.cancut = false;
    					c.iscutting = false;
    					c.pEmote = c.CAM().GetStandAnim(c.playerEquipment[c.playerWeapon]);
    					c.updateRequired = true;
    					c.appearanceUpdateRequired = true;
    				}
    			} else {
    				server.deregisterEvent(this);
    			}
    		}
    	});
    	return false;
    }
    Woodcutting is now ran by an event instead of the process. Each time the event is executed the player gets a log and gains experience. The time of the event is based on the value of the integer 'time'.

    Now there is one more thing to do. That is to stop the player from woodcutting immediately after the tree falls. If this method is not used, then the player will not stop until the event is executed again, which depending by the tree they are cutting, could be a while.

    Open WorldOBject.java. This is where we finally use the aX and aY integers. We have already given them a value, but haven't but them to use.

    Search for:

    Code:
    c.ReplaceServerObject(objectX, objectY, NewObjectID, Face, ObjectType);
    Directly under that add this:

    Code:
    if (c.pEmote == c.wcanim && objectX == c.wc.aX && objectY == c.wc.aY) {
    				c.pEmote = c.CAM().GetStandAnim(c.playerEquipment[c.playerWeapon]);
    				c.updateRequired = true;
    				c.appearanceUpdateRequired = true;
    			}
    Now, if the player is woodcutting and the tree's coordinates of the tree they are cutting and the coordinates of the one that just fell are the same, then the player's emote will switch back to their stand anim.

    Final step:

    Open client.java, go to 'boolean playerprocess()', and comment out/delete everything that has to do with woodcutting since it is no longer needed.

    Video of new wooductting - [Only registered and activated users can see links. ]

    If you were to open Mining.java you would notice that mining and woodcutting are done in a very similar way. With what you just learned, you should be able to fix mining as well
    Reply With Quote  
     

  2. #2  
    Banned

    Join Date
    Jun 2009
    Posts
    1,965
    Thanks given
    1
    Thanks received
    136
    Rep Power
    0
    This is actually nice, but I wouldn't recommend that you try and persuade people to use Delta..?
    Reply With Quote  
     

  3. #3  
    Community Veteran

    Purehit's Avatar
    Join Date
    Oct 2006
    Posts
    960
    Thanks given
    445
    Thanks received
    645
    Rep Power
    5000
    Quote Originally Posted by .:Tanner:. View Post
    This is actually nice, but I wouldn't recommend that you try and persuade people to use Delta..?
    I hope that was sarcasm.
    Reply With Quote  
     

  4. #4  
    Community Veteran


    Join Date
    Jun 2007
    Posts
    1,684
    Thanks given
    300
    Thanks received
    309
    Rep Power
    481
    EDIT: Nice guide, make sure that they import server.util.*; into woodcutting class or else the new event wont compile
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  5. #5  
    Banned

    Join Date
    Jun 2009
    Posts
    1,965
    Thanks given
    1
    Thanks received
    136
    Rep Power
    0
    Quote Originally Posted by Purehit View Post
    I hope that was sarcasm.
    It is nice, compared to the regular Deltascape woodcutting. It is shit compared to something made by someone who knows what they are doing.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

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


User Tag List

Tags for this Thread

View Tag Cloud

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •