Thread: [718+]Dwarf Cannon help.

Page 1 of 2 12 LastLast
Results 1 to 10 of 16
  1. #1 [718+]Dwarf Cannon help. 
    Registered Member
    Join Date
    Feb 2013
    Posts
    184
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    Hello there guys, i will get the dwarf cannon working.I found this folder but the cannon still not get placed/ dont get any message.



    Code:
    package com.rs.game.player.content;
    
    import com.rs.game.Animation;
    import com.rs.game.Hit;
    import com.rs.game.World;
    import com.rs.game.WorldObject;
    import com.rs.game.WorldTile;
    import com.rs.game.Hit.HitLook;
    import com.rs.game.item.Item;
    import com.rs.game.npc.NPC;
    import com.rs.game.player.Player;
    import com.rs.game.tasks.WorldTask;
    import com.rs.game.tasks.WorldTasksManager;
    import com.rs.utils.Utils;
    
    public class DwarfCannon {
    
    	public Player owner;
    	public WorldObject lastObject;
    	private int[] CANNON_PIECES = {6, 8, 10, 12};
    	private int[] CANNON_OBJECTS = {7, 8, 9, 6};
    	public boolean stopRotation;
    	public int cannonBalls = 0;
    	public int cannonDirection;
    
    	public DwarfCannon(Player owner) {
    		this.owner = owner;	
    	}
    	
    	public void setUpCannon() {
    		WorldTasksManager.schedule(new WorldTask() { 
    			int step = 0;
    
    			@Override 
    			public void run() { 
    				if (step == 0) {
    					if (owner.getInventory().containsItem(CANNON_PIECES[step], 1)) {
    						owner.lock();
    						lastObject = new WorldObject(CANNON_OBJECTS[step], 10, 0, owner);
    						owner.getInventory().deleteItem(CANNON_PIECES[step], 1);
    						World.spawnObject(lastObject, false);
    						owner.faceObject(lastObject);
    						owner.sendMessage("You place the cannon base on the ground.");
    					}
    				} else if(step == 2) {
    					if (owner.getInventory().containsItem(CANNON_PIECES[step-1], 1)) {
    						owner.getInventory().deleteItem(CANNON_PIECES[step-1], 1);
    						World.removeObject(lastObject, false);
    						World.getRegion(lastObject.getRegionId()).removeObject(lastObject);
    						lastObject = new WorldObject(CANNON_OBJECTS[step-1], 10, 0, owner);
    						World.spawnObject(lastObject, false);
    						owner.sendMessage("You add the stand.");
    					}
    				} else if(step == 4) {
    					if (owner.getInventory().containsItem(CANNON_PIECES[step-2], 1)) {
    						owner.getInventory().deleteItem(CANNON_PIECES[step-2], 1);
    						World.removeObject(lastObject, false);
    						World.getRegion(lastObject.getRegionId()).removeObject(lastObject);
    						lastObject = new WorldObject(CANNON_OBJECTS[step-2], 10, 0, owner);
    						World.spawnObject(lastObject, false);
    						owner.sendMessage("You add the barrel.");
    					}
    				} else if(step == 6) {
    					if (owner.getInventory().containsItem(CANNON_PIECES[step-3], 1)) {
    						owner.getInventory().deleteItem(CANNON_PIECES[step-3], 1);
    						World.removeObject(lastObject, false);
    						World.getRegion(lastObject.getRegionId()).removeObject(lastObject);
    						lastObject = new WorldObject(CANNON_OBJECTS[step-3], 10, 0, owner);
    						World.spawnObject(lastObject, false);
    						owner.sendMessage("You add the furnace.");
    						owner.unlock();
    						this.stop();
    					}
    				}
    				owner.getInventory().refresh();
    				owner.setNextAnimation(new Animation(827));
    				step++;
    			} 
    		}, 0, 1);
    	}
    
    	public void pickupCannon(WorldObject object) {
    		if (owner.getInventory().getFreeSlots() < (hasCannonBalls() ? 5 : 4)) {
    			owner.sendMessage("You need atleast "+(hasCannonBalls() ? "5" : "4")+" inventory spots to pickup your cannon.");
    			return;
    		}
    		stopRotation = true;
    		World.removeObject(object, false);
    		World.getRegion(object.getRegionId()).removeObject(object);
    		for (int item : CANNON_PIECES) {
    			owner.getInventory().addItem(item, 1);
    		}
    		if (hasCannonBalls()) 
    			owner.getInventory().addItem(2, cannonBalls);
    	}
    
    	public boolean fireCannon(WorldObject object) {
    		boolean hit = false;
    		for (NPC n : World.getNPCs()) {
    			hit = true;
    			WorldTile tile = n;
    			if (n == null || n.isDead() || !n.withinDistance(object, 8)) {
    				continue;
    			}
    			if (hit) {
    				World.sendProjectile(owner, object, n, 53, 38, 38, 30, 40, 50, 0);
    				n.applyHit(new Hit(owner, Utils.random(300), HitLook.RANGE_DAMAGE));
    				return true;
    			}
    		}
    		return false;
    	}
    
    	public void loadCannon() {
    		int ballsToAdd = 0;
    		if ((owner.getInventory().getNumerOf(2) + cannonBalls) <= 30) {
    			ballsToAdd = owner.getInventory().getNumerOf(2);
    		} else if ((owner.getInventory().getNumerOf(2) + cannonBalls) >= 30) {
    			ballsToAdd = Math.min(owner.getInventory().getNumerOf(2), 30 - owner.getInventory().getNumerOf(2) + cannonBalls);
    		}
    		cannonBalls+=ballsToAdd;
    	}
    
    	public void startRotating(final WorldObject object) {
    		if (cannonBalls == 0 && !owner.getInventory().containsItems(new Item[]{new Item(2)})) {
    			owner.sendMessage("You need to load your cannon with cannon balls before firing it!");
    			return;
    		} else if (owner.getInventory().containsItems(new Item[]{new Item(2)}) && cannonBalls < 30) {
    			loadCannon();
    			owner.sendMessage("You load the cannon with "+(owner.getInventory().getNumerOf(2) < 30 ? owner.getInventory().getNumerOf(2) : "30")+" cannon balls.");
    		}
    		WorldTasksManager.schedule(new WorldTask() { 
    			int step = 0;
    
    			@Override 
    			public void run() { 
    				if (stopRotation) {
    					this.stop();
    				} else if (step == 0 && cannonDirection != 0) {
    					World.sendObjectAnimation(owner, object, new Animation(303));
    				} else if (step == 1) {
    					World.sendObjectAnimation(owner, object, new Animation(305));
    				} else if (step == 2) {
    					World.sendObjectAnimation(owner, object, new Animation(307));
    				} else if (step == 3) {
    					World.sendObjectAnimation(owner, object, new Animation(289));
    				} else if (step == 4) {
    					World.sendObjectAnimation(owner, object, new Animation(184));
    				} else if (step == 5) {
    					World.sendObjectAnimation(owner, object, new Animation(182));
    				} else if (step == 6) {
    					World.sendObjectAnimation(owner, object, new Animation(178));
    				} else if (step == 7) {
    					World.sendObjectAnimation(owner, object, new Animation(291));
    					step = -1;
    					cannonDirection = 0;
    				}
    				if (fireCannon(object)) {
    					cannonBalls--;
    					if (!hasCannonBalls()) {
    						owner.sendMessage("Your cannon has ran out of ammo!");
    						this.stop();
    					}
    				}
    				cannonDirection++;
    				step++;
    			} 
    		}, 0, 1);
    	}
    
    	public boolean hasCannonBalls() {
    		return cannonBalls > 0;
    	}
    }
    so i hope anyone got a answer for this.
    Reply With Quote  
     

  2. #2  
    Registered Member
    Fredo Santana's Avatar
    Join Date
    Apr 2013
    Age
    31
    Posts
    723
    Thanks given
    28
    Thanks received
    86
    Rep Power
    87
    Please explain more of what is happening. Do you have the emotes to set it up? What part of this works? What parts of this doesn't work?
    FU Tooka Gang
    FU FBG
    FU JojoWorld
    FU D-Block
    #GDK #600 #065th #OTF #ScrewLilJay #BDN
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Feb 2013
    Posts
    184
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    nothing work on this
    Reply With Quote  
     

  4. #4  
    Donator
    Sake's Avatar
    Join Date
    Jan 2013
    Posts
    398
    Thanks given
    71
    Thanks received
    23
    Rep Power
    2
    Quote Originally Posted by Cya Forever View Post
    nothing work on this
    ::cannon
    Reply With Quote  
     

  5. #5  
    Registered Member Storm Powner's Avatar
    Join Date
    Apr 2012
    Age
    29
    Posts
    501
    Thanks given
    29
    Thanks received
    34
    Rep Power
    19
    find:

    Code:
    		if (itemId == 952) {// spade
    			dig(player);
    			return;
    		}
    under that addd
    Code:
    		if (itemId == 6) {
    		player.getDwarfCannon().cannonSetup();
    		return;
    		}
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Feb 2013
    Posts
    184
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    Getting this error then,

    Code:
    starting...
    src\com\rs\net\decoders\handlers\InventoryOptionsHandler.java:160: error: cannot
     find symbol
                    player.getDwarfCannon().cannonSetup();
                                           ^
      symbol:   method cannonSetup()
      location: class DwarfCannon
    1 error
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Feb 2013
    Posts
    184
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by Cya Forever View Post
    Getting this error then,

    Code:
    starting...
    src\com\rs\net\decoders\handlers\InventoryOptionsHandler.java:160: error: cannot
     find symbol
                    player.getDwarfCannon().cannonSetup();
                                           ^
      symbol:   method cannonSetup()
      location: class DwarfCannon
    1 error
    still not working.
    Reply With Quote  
     

  8. #8  
    Donator

    Yuuji's Avatar
    Join Date
    Feb 2012
    Posts
    678
    Thanks given
    232
    Thanks received
    153
    Rep Power
    197
    Quote Originally Posted by Cya Forever View Post
    still not working.
    Import your dwarfcannon.java or whatever the file is named.
    Reply With Quote  
     

  9. #9  
    Registered Member
    Join Date
    Feb 2013
    Posts
    184
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    i did this.... still nothing works


    add me skype: fatality20122 and help me short.
    Reply With Quote  
     

  10. #10  
    Registered Member Storm Powner's Avatar
    Join Date
    Apr 2012
    Age
    29
    Posts
    501
    Thanks given
    29
    Thanks received
    34
    Rep Power
    19
    get eclipse, and don't say my code doesn't work because i added the dwarf months ago from that topic and i can pick it up and use it and set it up
    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. Selling perfect matrix 718 dwarf cannon
    By Old Oak in forum Selling
    Replies: 4
    Last Post: 03-25-2013, 04:48 AM
  2. dwarf cannon
    By death333 in forum Help
    Replies: 7
    Last Post: 10-09-2011, 12:41 PM
  3. New Dwarf Cannon
    By Zro. in forum Media
    Replies: 9
    Last Post: 03-13-2011, 03:22 PM
  4. Hand Cannon help
    By Analyze in forum Help
    Replies: 1
    Last Post: 02-21-2011, 06:54 AM
  5. [HELP]Hand Cannon[HELP]
    By coledp5 in forum Help
    Replies: 3
    Last Post: 12-24-2010, 09:21 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
  •