Thread: [PI] Woodcutting help [PI]

Results 1 to 6 of 6
  1. #1 [PI] Woodcutting help [PI] 
    Donator


    Join Date
    Feb 2013
    Posts
    373
    Thanks given
    44
    Thanks received
    21
    Rep Power
    118
    Hello everyone I was testing my skills and it seems that woodcutting is broken...
    It lets you swing your axe at the tree but it doesn't chop down nor does it give you logs or EXP
    If anyone could please post a fix that would be much appreciated
    Reply With Quote  
     

  2. #2  
    Castle Revolution Developer

    Join Date
    Apr 2012
    Posts
    155
    Thanks given
    4
    Thanks received
    10
    Rep Power
    11
    Can't help you unless you post the code.
    If you want it this is the woodcutting class of my base (I'm going to improve it eventually)

    Code:
    package server.content.skills;
    
    import core.util.Misc;
    import server.content.*;
    import server.Config;
    import server.game.minigames.randomevents.SpiritTree;
    import server.game.objects.Object;
    import server.event.CycleEvent;
    import server.event.CycleEventContainer;
    import server.event.CycleEventHandler;
    import server.game.players.Client;
    import server.game.players.PlayerHandler;
    
    public class Woodcutting {
    	
    	private Client c;
    	
    	public final int[][] Axe_Settings = {
    		{1351, 1, 1, 879}, //Bronze
    		{1349, 1, 2, 877}, //Iron
    		{1353, 6, 3, 875}, //Steel
    		{1361, 6, 4, 873}, //Black
    		{1355, 21, 5, 871}, //Mithril
    		{1357, 31, 6, 869}, //Addy
    		{1359, 41, 7, 867}, //Rune
    		{6739, 61, 8, 2846}, //Dragon
    		{13661, 41, 8, 10251} //Adze
    	};
    
    	public final int[][] Tree_Settings = {
    		{1276, 1342, 1, 25, 1511, 45, 100}, //Tree
    		{1278, 1342, 1, 25, 1511, 45, 100}, //Tree
    		{1286, 1342, 1, 25, 1511, 45, 100}, //Dead Tree
    		{1281, 1356, 15, 38, 1521, 11, 20}, //Oak
    		{1308, 7399, 30, 68, 1519, 11, 8}, //Willow
    		{5552, 7399, 30, 68, 1519, 11, 8}, //Willow
    		{1307, 1343, 45, 100, 1517, 48, 8}, //Maple
    		{1309, 7402, 60, 175, 1515, 79, 5}, //Yew
    		{1306, 7401, 75, 250, 1513, 150, 3}, //Magic
    		{5551, 7399, 30, 68, 1519, 11, 8}, //Willow
    		{5553, 7399, 30, 68, 1519, 11, 8} //Willow
    	};
    
    	int a = -1;
    
    	public Woodcutting(Client c) {
    		this.c = c;
    	}
    	
    	public void startWoodcutting(final int j, final int x, final int y, final int type) {
    		if (c.isWc)
    			return;
    		if (c.wcing)
    			return;
    		int wcLevel = c.playerLevel[8];
    		a = -1;
    		c.turnPlayerTo(x, y);
    		if (Tree_Settings[j][2] > wcLevel) {
    			c.sendMessage("You need a Woodcutting level of " + Tree_Settings[j][2] + " to cut this tree.");
    			return;
    		}
    		for (int i = 0; i < Axe_Settings.length; i++) {
    			if (c.getItems().playerHasItem(Axe_Settings[i][0]) || c.playerEquipment[c.playerWeapon] == Axe_Settings[i][0]) {
    				if (Axe_Settings[i][1] <= wcLevel) {
    					a = i;
    				}
    			}
    		}
    		if (a == -1) {
    			c.sendMessage("You need an axe to cut this tree.");
    			return;
    		}
    		if (c.getItems().freeSlots() < 1) {
    			c.sendMessage("You do not have enough inventory slots to do that.");
    			return;
    		}
    		c.startAnimation(Axe_Settings[a][3]);
    		c.isWc = true;
    		c.treeX = x;
    		c.treeY = y;
    		c.wcing = true;
    		CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
    			@Override
    			public void execute(CycleEventContainer container) {
    				if (!c.isWc) {
    					container.stop();
    					return;
    				}
    				if (c.isWc)
    					c.startAnimation(Axe_Settings[a][3]);
    				if (c.getItems().freeSlots() < 1) {
    					c.sendMessage("You have ran out of inventory slots.");
    					container.stop();
    				}
    				int xp = Tree_Settings[j][3] * Config.WOODCUTTING_EXPERIENCE;
    				if (c.getItems().playerHasEquipped(10933)) {
    					xp = (int)(xp * 1.002);
    				}
    				if (c.getItems().playerHasEquipped(10939)) {
    					xp = (int)(xp * 1.008);
    				}
    				if (c.getItems().playerHasEquipped(10940)) {
    					xp = (int)(xp * 1.006);
    				}
    				if (c.getItems().playerHasEquipped(10941)) {
    					xp = (int)(xp * 1.004);
    				}
    				if (c.isWc) {
    					c.getItems().addItem(Tree_Settings[j][4], 1);
    					c.getPA().addSkillXP(xp, 8);
    				}
    				if(Misc.random(80) == 0) {
    					SpiritTree.spawnSpiritTree(c);
    					container.stop();
    				}
    				if (c.getItems().freeSlots() < 1) {
    					c.sendMessage("You have ran out of inventory slots.");
    					container.stop();
    				}
    				if (c.isWc)
    					BirdsNests.dropNest(c);
    				if (c.getItems().freeSlots() < 1) {
    					c.sendMessage("You have ran out of inventory slots.");
    					container.stop();
    				}
    				if (Misc.random(100) <= Tree_Settings[j][6]) {
    					cutDownTree(Tree_Settings[j][5], x, y, type, Tree_Settings[j][1], Tree_Settings[j][0]);
    					container.stop();
    				}
    			}
    			@Override
    			public void stop() {
    				c.startAnimation(65535);
    				c.isWc = false;
    				c.treeX = 0;
    				c.treeY = 0;
    				c.wcing = false;
    				return;
    			}
    		}, getTimer(j, a, wcLevel));
    		CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
    			@Override
    			public void execute(CycleEventContainer container) {
    				if (!c.isWc) {
    					container.stop();
    					return;
    				}
    				if (c.isWc) {
    					c.startAnimation(Axe_Settings[a][3]);
    				}
    			}
    			@Override
    			public void stop() {
    
    			}
    		}, 4);
    	}
    
    	public int getTimer(int b, int c, int level) {
    		double timer = (int)((Tree_Settings[b][2]  * 2) + 20 + Misc.random(20))-((Axe_Settings[c][2] * (Axe_Settings[c][2] * 0.75)) + level);
    		if (timer < 3.0) {
    			return 3;
    		} else {
    			return (int)timer;
    		}
    	}
    	
    	public void birdNests() {
    		if (Misc.random(100) < 5) {
    			c.getItems().addItem(5070, 1);
    		}
    	}
    	
    	public void cutDownTree(int respawnTime, int x, int y, int type, int i, int j) {
    		//new Object(i, x, y, 0, type, 10, j, respawnTime);
    		new Object(j, x, y, 0, 0, 10, i, respawnTime);
    		for (int t = 0; t < PlayerHandler.players.length; t++) {
    			if (PlayerHandler.players[t] != null) {
    				if (PlayerHandler.players[t].treeX == x && PlayerHandler.players[t].treeY == y) {
    					PlayerHandler.players[t].isWc = false;
    					PlayerHandler.players[t].startAnimation(65535);
    					PlayerHandler.players[t].treeX = 0;
    					PlayerHandler.players[t].treeY = 0;
    				}
    			}
    		}
    	}
    }
    (And this in ActionHandler.java)

    Code:
    case 1276:
    			c.getWoodcutting().startWoodcutting(0, c.objectX, c.objectY, c.clickObjectType);
    			break;
    		case 1278:
    			c.getWoodcutting().startWoodcutting(1, c.objectX, c.objectY, c.clickObjectType);
    			break;
    		case 1286:
    			c.getWoodcutting().startWoodcutting(2, c.objectX, c.objectY, c.clickObjectType);
    			break;
    		case 1281:
    			c.getWoodcutting().startWoodcutting(3, c.objectX, c.objectY, c.clickObjectType);
    			break;
    		case 1308:
    			c.getWoodcutting().startWoodcutting(4, c.objectX, c.objectY, c.clickObjectType);
    			break;
    		case 5552:
    			c.getWoodcutting().startWoodcutting(5, c.objectX, c.objectY, c.clickObjectType);
    			break;
    		case 1307:
    			c.getWoodcutting().startWoodcutting(6, c.objectX, c.objectY, c.clickObjectType);
    			break;
    		case 1309:
    			c.getWoodcutting().startWoodcutting(7, c.objectX, c.objectY, c.clickObjectType);
    			break;
    		case 1306:
    			c.getWoodcutting().startWoodcutting(8, c.objectX, c.objectY, c.clickObjectType);
    			break;
    		case 5551:
    			c.getWoodcutting().startWoodcutting(9, c.objectX, c.objectY, c.clickObjectType);
    			break;
    		case 5553:
    			c.getWoodcutting().startWoodcutting(10, c.objectX, c.objectY, c.clickObjectType);
    			break;

    Join the Revolution
    Reply With Quote  
     

  3. #3  
    Banned
    Join Date
    Jun 2012
    Posts
    510
    Thanks given
    33
    Thanks received
    50
    Rep Power
    0
    Quote Originally Posted by Mr Synful View Post
    Hello everyone I was testing my skills and it seems that woodcutting is broken...
    It lets you swing your axe at the tree but it doesn't chop down nor does it give you logs or EXP
    If anyone could please post a fix that would be much appreciated
    you were testing your skills? your your leeched servers skills.
    lol..
    Reply With Quote  
     

  4. #4  
    Donator


    Join Date
    Feb 2013
    Posts
    373
    Thanks given
    44
    Thanks received
    21
    Rep Power
    118
    Woodcutting.java
    Code:
    package server.model.players.skills;
     
    import server.model.players.*;
    import server.Config;
    import server.util.Misc;
    import server.event.*;
    import server.model.objects.Object;
    import server.Server;
     
    /**
    * @Author Null++
    */
     
    public class Woodcutting {
         
        private Client c;
         
        public final int[][] Axe_Settings = {
            {1351, 1, 1, 879}, //Bronze
            {1349, 1, 2, 877}, //Iron
            {1353, 6, 3, 875}, //Steel
            {1361, 6, 4, 873}, //Black
            {1355, 21, 5, 871}, //Mithril
            {1357, 31, 6, 869}, //Addy
            {1359, 41, 7, 867}, //Rune
            {6739, 61, 8, 2846}, //Dragon
            {13661, 41, 8, 10251} //Adze
        };
     
        public final int[][] Tree_Settings = {
            {1276, 1342, 1, 25, 1511, 45, 100}, //Tree
            {1278, 1342, 1, 25, 1511, 45, 100}, //Tree
            {1286, 1342, 1, 25, 1511, 45, 100}, //Dead Tree
            {1281, 1356, 15, 38, 1521, 11, 20}, //Oak
            {1308, 7399, 30, 68, 1519, 11, 8}, //Willow
            {5552, 7399, 30, 68, 1519, 11, 8}, //Willow
            {1307, 1343, 45, 100, 1517, 48, 8}, //Maple
            {1309, 7402, 60, 175, 1515, 79, 5}, //Yew
            {1306, 7401, 75, 250, 1513, 150, 3}, //Magic
            {5551, 7399, 30, 68, 1519, 11, 8}, //Willow
            {5553, 7399, 30, 68, 1519, 11, 8} //Willow
        };
     
        int a = -1;
     
        public Woodcutting(Client c) {
            this.c = c;
        }
         
        public void startWoodcutting(final int j, final int x, final int y, final int type) {
            if (c.isWc)
                return;
            if (c.wcing)
                return;
            int wcLevel = c.playerLevel[8];
            a = -1;
            c.turnPlayerTo(x, y);
            if (Tree_Settings[j][2] > wcLevel) {
                c.sendMessage("You need a Woodcutting level of " + Tree_Settings[j][2] + " to cut this tree.");
                return;
            }
            for (int i = 0; i < Axe_Settings.length; i++) {
                if (c.getItems().playerHasItem(Axe_Settings[i][0]) || c.playerEquipment[c.playerWeapon] == Axe_Settings[i][0]) {
                    if (Axe_Settings[i][1] <= wcLevel) {
                        a = i;
                    }
                }
            }
            if (a == -1) {
                c.sendMessage("You need an axe to cut this tree.");
                return;
            }
            if (c.getItems().freeSlots() < 1) {
                c.sendMessage("You do not have enough inventory slots to do that.");
                return;
            }
            c.startAnimation(Axe_Settings[a][3]);
            c.isWc = true;
            c.treeX = x;
            c.treeY = y;
            c.wcing = true;
            CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
                @Override
                public void execute(CycleEventContainer container) {
                    if (!c.isWc) {
                        container.stop();
                        return;
                    }
                    if (c.isWc)
                        c.startAnimation(Axe_Settings[a][3]);
                    if (c.getItems().freeSlots() < 1) {
                        c.sendMessage("You have ran out of inventory slots.");
                        container.stop();
                    }
                    int xp = Tree_Settings[j][3];
                    if (c.getItems().playerHasEquipped(10933)) {
                        xp = (int)(xp * 1.002);
                    }
                    if (c.getItems().playerHasEquipped(10939)) {
                        xp = (int)(xp * 1.008);
                    }
                    if (c.getItems().playerHasEquipped(10940)) {
                        xp = (int)(xp * 1.006);
                    }
                    if (c.getItems().playerHasEquipped(10941)) {
                        xp = (int)(xp * 1.004);
                    }
                    if (c.isWc) {
                        c.getItems().addItem(Tree_Settings[j][4], 1);
                        c.getPA().addSkillXP(xp, 8);
                    }
                    if (c.getItems().freeSlots() < 1) {
                        c.sendMessage("You have ran out of inventory slots.");
                        container.stop();
                    }
                    if (c.isWc)
                    if (c.getItems().freeSlots() < 1) {
                        c.sendMessage("You have ran out of inventory slots.");
                        container.stop();
                    }
                    if (Misc.random(100) <= Tree_Settings[j][6]) {
                        cutDownTree(Tree_Settings[j][5], x, y, type, Tree_Settings[j][1], Tree_Settings[j][0]);
                        container.stop();
                    }
                }
                @Override
                public void stop() {
                    c.startAnimation(65535);
                    c.isWc = false;
                    c.treeX = 0;
                    c.treeY = 0;
                    c.wcing = false;
                    return;
                }
            }, getTimer(j, a, wcLevel));
        }
     
        public int getTimer(int b, int c, int level) {
            double timer = (int)((Tree_Settings[b][2]  * 2) + 20 + Misc.random(20))-((Axe_Settings[c][2] * (Axe_Settings[c][2] * 0.75)) + level);
            if (timer < 3.0) {
                return 3;
            } else {
                return (int)timer;
            }
        }
         
        public void cutDownTree(int respawnTime, int x, int y, int type, int i, int j) {
            new Object(i, x, y, 0, type, 10, j, respawnTime);
            for (int t = 0; t < Server.playerHandler.players.length; t++) {
                if (Server.playerHandler.players[t] != null) {
                    if (Server.playerHandler.players[t].treeX == x && Server.playerHandler.players[t].treeY == y) {
                        Server.playerHandler.players[t].isWc = false;
                        Server.playerHandler.players[t].startAnimation(65535);
                        Server.playerHandler.players[t].treeX = 0;
                        Server.playerHandler.players[t].treeY = 0;
                    }
                }
            }
        }
    }
    Actionhandler.java
    Code:
                    case 1276:
    					c.getWoodcutting().startWoodcutting(0, c.objectX, c.objectY, c.clickObjectType);
    					break;
    				case 1278:
    					c.getWoodcutting().startWoodcutting(1, c.objectX, c.objectY, c.clickObjectType);
    					break;
    				case 1286:
    					c.getWoodcutting().startWoodcutting(2, c.objectX, c.objectY, c.clickObjectType);
    					break;
    				case 1281:
    					c.getWoodcutting().startWoodcutting(3, c.objectX, c.objectY, c.clickObjectType);
    					break;
    				case 1308:
    					c.getWoodcutting().startWoodcutting(4, c.objectX, c.objectY, c.clickObjectType);
    					break;
    				case 5552:
    					c.getWoodcutting().startWoodcutting(5, c.objectX, c.objectY, c.clickObjectType);
    					break;
    				case 1307:
    					c.getWoodcutting().startWoodcutting(6, c.objectX, c.objectY, c.clickObjectType);
    					break;
    				case 1309:
    					c.getWoodcutting().startWoodcutting(7, c.objectX, c.objectY, c.clickObjectType);
    					break;
    				case 1306:
    					c.getWoodcutting().startWoodcutting(8, c.objectX, c.objectY, c.clickObjectType);
    					break;
    				case 5551:
    					c.getWoodcutting().startWoodcutting(9, c.objectX, c.objectY, c.clickObjectType);
    					break;
    				case 5553:
    					c.getWoodcutting().startWoodcutting(10, c.objectX, c.objectY, c.clickObjectType);
    					break;
    Reply With Quote  
     

  5. #5  
    Donator


    Join Date
    Feb 2013
    Posts
    373
    Thanks given
    44
    Thanks received
    21
    Rep Power
    118
    Quote Originally Posted by woof View Post
    you were testing your skills? your your leeched servers skills.
    lol..
    For one. don't go jumping to conclusion
    For two. yes they are leeched but i'm going to improve them just can't seem to find where it's ****ed up at
    For three. don't go around rune-server looking for posts to hate on
    Don't act like you never used anything leeched on any server you coded lol
    Reply With Quote  
     

  6. #6  
    Castle Revolution Developer

    Join Date
    Apr 2012
    Posts
    155
    Thanks given
    4
    Thanks received
    10
    Rep Power
    11
    Quote Originally Posted by woof View Post
    you were testing your skills? your your leeched servers skills.
    lol..
    Everybody starts with a 'leeched' server you dumbass...
    He was testing his skills because, if they worked, why not keep them??
    Idiot...

    Join the Revolution
    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

Similar Threads

  1. [PI] Woodcutting Help Again
    By Ired in forum Help
    Replies: 8
    Last Post: 06-08-2013, 08:16 PM
  2. [PI] Woodcutting Help
    By Ired in forum Help
    Replies: 7
    Last Post: 06-06-2013, 08:27 PM
  3. [PI] Woodcutting help
    By mc wobbla in forum Help
    Replies: 2
    Last Post: 12-06-2012, 02:47 AM
  4. [PI] Woodcutting help
    By mc wobbla in forum Help
    Replies: 0
    Last Post: 12-06-2012, 01:34 AM
  5. PI woodcutting help
    By corndogs in forum Help
    Replies: 1
    Last Post: 07-01-2012, 01:24 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •