Thread: Thieving Stall

Results 1 to 8 of 8
  1. #1 Thieving Stall 
    Donator

    Join Date
    Feb 2013
    Posts
    446
    Thanks given
    91
    Thanks received
    87
    Rep Power
    45
    Hey,

    Added today thieving to my server and it's almost working.. Only problem is that I can't get Stalls work but other objects work.

    Base: PI

    When I click Baker's Stall I get this on CMD.

    Code:
    objectId: 2561  ObjectX: 3084  objectY: 3489 Xoff: 2 Yoff: 1

    ActionHandler.java
    Code:
    case 2561:
    				c.getThieving().stealFromStall(2561); //Baker's Stall
    				break;

    Thieving.java

    Code:
    private enum StallData {
    		BAKER(2561, new int[]{1897}, 16, 5),
    Reply With Quote  
     

  2. #2  
    Donator

    Join Date
    Feb 2013
    Posts
    446
    Thanks given
    91
    Thanks received
    87
    Rep Power
    45
    Any know?
    Reply With Quote  
     

  3. #3  
    Donator

    Join Date
    Feb 2013
    Posts
    446
    Thanks given
    91
    Thanks received
    87
    Rep Power
    45
    Bump.
    Reply With Quote  
     

  4. #4  
    Banned

    Join Date
    May 2011
    Posts
    1,773
    Thanks given
    854
    Thanks received
    853
    Rep Power
    0
    put in clickobject instead
    Reply With Quote  
     

  5. #5  
    Donator

    Join Date
    Feb 2013
    Posts
    446
    Thanks given
    91
    Thanks received
    87
    Rep Power
    45
    Quote Originally Posted by Poesy700 View Post
    put in clickobject instead
    It gives same thing when I click the stall.



    EDIT: MY thieving.java


    Code:
    package server.model.players.skills;
    
    import server.model.players.Client;
    import server.util.Misc;
    
    /**
     * Thieving.java
     *
     * @author Flow
     *
     **/
    
    public class Thieving {
    
    	private Client c;
    
    	public Thieving(Client c) {
    		this.c = c;
    	}
    
    	private enum NPC {
    		MAN(new int[]{1}, 1, 8, 200, 1),
    		ALKHARID_WARRIOR(new int[]{18}, 25, 26, 500, 1),
    		GUARD(new int[]{9}, 40, 47, 1000, 2),
    		ARDOUGNE_KNIGHT(new int[]{26}, 55, 85, 1500, 3),
    		PALADIN(new int[]{20}, 70, 152, 2000, 4),
    		HERO(new int[]{21}, 80, 273, 3000, 5);
    
    		private int[] NPC;
    		private int levelReq, XP, reward, damage;
    
    		private NPC(int NPC[], int levelReq, int XP, int reward, int damage) {
    			this.NPC = NPC;
    			this.levelReq = levelReq;
    			this.XP = XP;
    			this.reward = reward;
    			this.damage = damage;
    		}
    
    		public int[] getNPC() {
    			return NPC;
    		}
    
    		public int getReq() {
    			return levelReq;
    		}
    
    		public int getXP() {
    			return XP;
    		}
    
    		public int getReward() {
    			return reward;
    		}
    
    		public int getDamage() {
    			return damage;
    		}
    	}
    
    	private NPC forNpc(int id) {
    		for (NPC n : NPC.values()) {
    			for (int npc : n.getNPC()) {
    				if (npc == id) {
    					return n;
    				}
    			}
    		}
    		return null;
    	}
    
    	public void stealFromNPC(int id) {
    		if (System.currentTimeMillis() - c.lastThieve < 2000)
    			return;
    		NPC v = forNpc(id);
    		if (v != null) {
    			if (c.playerLevel[c.playerThieving] >= v.getReq()) {
    				if (!randomFail(v.getReq())) {
    					c.getItems().addItem(995, v.getReward());
    					c.getPA().addSkillXP(v.getXP(), c.playerThieving);
    					c.startAnimation(881);
    					c.lastThieve = System.currentTimeMillis();
    					c.sendMessage("You pickpocket the NPC.");
    				} else {
    					c.setHitDiff(v.getDamage());
    					c.setHitUpdateRequired(true);
    					c.playerLevel[c.playerHitpoints] -= v.getDamage();
    					c.gfx100(254);
    					c.lastThieve = System.currentTimeMillis() + 2000;
    					c.sendMessage("You fail to pickpocket the NPC.");
    				}
    			} else {
    				c.sendMessage("You don't have a high enough thieving level to pickpocket this NPC.");
    			}
    		}
    	}
    	
    	public boolean randomFail(int levelReq) {
    		return c.playerLevel[c.playerThieving] - levelReq + getEquipmentBonus() < Misc.random(levelReq);
    	}
    
    	private int getEquipmentBonus() {
    		return c.playerEquipment[c.playerHands] == 10075 ? 5 : 0;
    	}
    
    	public static StallData forStall(int id) {
    		for (StallData sd : StallData.values()) {
    			if (sd.getObjId() == id) {
    				return sd;
    			}
    		}
    		return null;
    	}
    
    	public static int getRandom(int stall) {
    		StallData sd = forStall(stall);
    		return sd.getReward()[(int)(sd.getReward().length * Math.random())];
    	}
    	private enum StallData {
    		BAKER(2561, new int[]{1897}, 16, 5),
    		SILK(2560, new int[]{950}, 24, 20),
    		FUR(2563, new int[]{7680}, 36, 35),
    		SPICE(2564, new int[]{1613}, 81, 65),
    		GEM(2562, new int[]{1623, 1621, 1619, 1617, 1631}, 160, 75);
    
    		private int objId, xp, level;
    		private int[] reward;
    
    		private StallData(int objId, int[] id, int xp, int level) {
    			this.objId = objId;
    			this.reward = id;
    			this.xp = xp;
    			this.level = level;
    		}
    
    		public int getObjId() {
    			return objId;
    		}
    
    		public int[] getReward() {
    			return reward;
    		}
    
    		public int getXP() {
    			return xp;
    		}
    
    		public int getLevel() {
    			return level;
    		}
    	}
    
    	public void stealFromStall(int stall) {
    		if (System.currentTimeMillis() - c.lastThieve > 2000) {
    			StallData sd = forStall(stall);
    			if (sd != null) {
    				if (c.playerLevel[c.playerThieving] >= sd.getLevel()) {
    					c.getItems().addItem(getRandom(stall), 1);
    					c.startAnimation(832);
    					c.getPA().addSkillXP(sd.getXP(), c.playerThieving);
    					c.lastThieve = System.currentTimeMillis();
    					c.sendMessage("You steal from the stall.");
    				} else {
    					c.sendMessage("You need a thieving level of at least "+sd.getLevel()+" to steal from this stall.");
    				}
    			}
    		}
    	}
    }
    Reply With Quote  
     

  6. #6  
    Registered Member

    Join Date
    Dec 2010
    Posts
    1,982
    Thanks given
    174
    Thanks received
    256
    Rep Power
    223
    debug.
    Make system prints
    @
    Code:
    case 2561:
    				c.getThieving().stealFromStall(2561); //Baker's Stall
    				break;
    Code:
    System.out.println("clicked stall");
    See if the systemprint displays anything.
    Reply With Quote  
     

  7. #7  
    Donator

    Join Date
    Feb 2013
    Posts
    446
    Thanks given
    91
    Thanks received
    87
    Rep Power
    45
    Quote Originally Posted by Someone View Post
    debug.
    Make system prints
    @
    Code:
    case 2561:
    				c.getThieving().stealFromStall(2561); //Baker's Stall
    				break;
    Code:
    System.out.println("clicked stall");
    See if the systemprint displays anything.

    Still same. :/

    [1.5.2013 15:40]: objectId: 2561 ObjectX: 3084 objectY: 3489 Xoff: 2 Yoff: 1
    [1.5.2013 15:40]: objectId: 2561 ObjectX: 3084 objectY: 3489 Xoff: 2 Yoff: 0
    [1.5.2013 15:40]: objectId: 2561 ObjectX: 3084 objectY: 3489 Xoff: 2 Yoff: 1
    Reply With Quote  
     

  8. #8  
    Banned

    Join Date
    May 2011
    Posts
    1,773
    Thanks given
    854
    Thanks received
    853
    Rep Power
    0
    Quote Originally Posted by Grand View Post
    Still same. :/

    [1.5.2013 15:40]: objectId: 2561 ObjectX: 3084 objectY: 3489 Xoff: 2 Yoff: 1
    [1.5.2013 15:40]: objectId: 2561 ObjectX: 3084 objectY: 3489 Xoff: 2 Yoff: 0
    [1.5.2013 15:40]: objectId: 2561 ObjectX: 3084 objectY: 3489 Xoff: 2 Yoff: 1
    Means that it doesnt reach the code at all so;

    You have to check where it gets cut off paste your case directly under

    switch (objectId) {
    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. Working thieving stalls
    By catthoor in forum Tutorials
    Replies: 7
    Last Post: 09-01-2009, 02:26 PM
  2. Emulous Thieving Stalls?
    By F1NN in forum Help
    Replies: 1
    Last Post: 06-13-2009, 01:30 PM
  3. [508] Thieving Stalls Base
    By 00o0o0oo0 in forum Tutorials
    Replies: 23
    Last Post: 06-11-2009, 01:09 PM
  4. Replies: 3
    Last Post: 11-08-2008, 05:16 PM
  5. Adding a new thieving stall/Chest
    By Guitars595 in forum Tutorials
    Replies: 7
    Last Post: 09-28-2008, 03:53 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
  •