Thread: [Elvarg / OSRSPK] Refined theiving (Based on Dihn's release)

Results 1 to 8 of 8
  1. #1 [Elvarg / OSRSPK] Refined theiving (Based on Dihn's release) 
    Registered Member Farage's Avatar
    Join Date
    Jan 2017
    Posts
    252
    Thanks given
    24
    Thanks received
    22
    Rep Power
    0
    This is an extension of Dihn's theiving snippet his didnt have stunning. You can take his if you want.

    First of all paste this. This is the Pickpocket class from Dihn's. I added forId method to identify which pickpocket it is instead of probably doing a switch and finding its pickpocket from that, you will just call this static method (used later). And the rest of the code was by me, you will have to add the methods in the packet listener classes but if you cannot do that just PM
    EDIT: If you want move the can perform method in Stun.java to Theiving.java or rename it to something like isStunned.
    EDIT2: If you want to have multiple npcs under one type of Pickpocket change the npcId int to an int[] and make a for loop inside of the for loop for the values in the forId method.
    EDIT3: Id suggest adding a optionNumber variable in Pickpocket so you can work off that because some NPC's have it on their first option or have it on their 2nd option or even 3rd.
    Code:
    package com.superscape.world.content.theiving;
    
    import com.superscape.world.model.Item;
    
    /**
     * This enum stores all our thieving pickpocket data.
     * @author Clive/Dinh
     * @author Oscar Morton
     *
     */
    public enum Pickpocket {
    	MAN(385,1, 8, new Item[] {new Item(995, 5) }),
    	FARMER(3257,60, 65, new Item[] {new Item(5291), new Item(5292), new Item(5293), new Item(5294), new Item(5291), new Item(5292), new Item(5293), new Item(5294), new Item(5295), new Item(5296), new Item(5297), new Item(5298), new Item(5299), new Item(5300), new Item(5301), new Item(5302), new Item(5303), new Item(5304)});
    
    	private final int npcId;
    	
    	private final int levelRequirement;
    	
    	private final int experience;
    
    	private final Item[] rewards;
    
    	private Pickpocket(final int npcId,final int level, final int experience, final Item[] loot) {
    		this.levelRequirement = level;
    		this.experience = experience;
    		this.rewards = loot;
    		this.npcId = npcId;
    	}
    	
    	public static Pickpocket forId(int id) {
    		for (Pickpocket pick : Pickpocket.values()) {
    			if (pick.getNpcId() == id) {
    				return pick;
    			}
    		}
    		return null;
    	}
    	
    	public int getRequirement() {
    		return levelRequirement;
    	}
    
    	public int getExperience() {
    		return experience;
    	}
    
    	public Item[] getLoot() {
    		return rewards;
    	}
    
    	public int getNpcId() {
    		return npcId;
    	}
    }
    Theiving.java
    Code:
    package com.superscape.world.content.theiving;
    
    import com.superscape.GameConstants;
    import com.superscape.util.Misc;
    import com.superscape.world.entity.impl.npc.NPC;
    import com.superscape.world.entity.impl.player.Player;
    import com.superscape.world.model.Animation;
    import com.superscape.world.model.Item;
    import com.superscape.world.model.Skill;
    
    /**
     * The theiving class.
     * @author Oscar Morton
     *
     */
    public class Theiving {
    	/**
    	 * Theiving animation, the picking from the pocket.
    	 */
    	private static final Animation THEIV_ANIM = new Animation(881);
    	
    	/**
    	 * Theiving.
    	 * @param player
    	 */
    	public static void theive(Player player, NPC npc,Pickpocket pick) {
    		player.setPositionToFace(npc.getPosition());
    		if (pick == null) {
    			pick = Pickpocket.forId(npc.getId());
    			if (pick == null) {
    				player.getPacketSender().sendMessage("something went wrong. send to administrator");
    				return;
    			}
    		}
    		player.getPacketSender().sendMessage(pick.name());
    		if (!canPerform(player,pick)) {
    			return;
    		}
    		player.performAnimation(THEIV_ANIM);
    		if (!Stun.success(player, pick)) {
    			Stun.stun(player, npc);
    			player.getPacketSender().sendMessage("yo");
    		} else {
    			Item lootReceived = Misc.randomElement(pick.getLoot());
    			player.getInventory().add(lootReceived.getId(), lootReceived.getAmount());
    			player.getSkillManager().addExperience(Skill.THIEVING, pick.getExperience()*(int)GameConstants.EXP_MULTIPLIER);
    		}
    	}
    	
    	/**
    	 * if the player can't perform it will return false
    	 * @param player
    	 * @param pickpocket
    	 * @return
    	 */
    	public static boolean canPerform(Player player,Pickpocket pickpocket) {
    		if (player.getSkillManager().getCurrentLevel(Skill.THIEVING) < pickpocket.getRequirement()) {
    			player.getPacketSender().sendMessage("You need a thieving level of " + pickpocket.getRequirement() + " to pickpocket this npc.");
    			return false;
    		}
    		if (player.getInventory().isFull()) {
    			player.getPacketSender().sendMessage("You need at least one free slot to steal from this npc.");
    			return false;
    		}
    		return true;
    	}
    }
    and now the class that Dinh's release didn't have. Stun.java. The class that handles the stunning
    Code:
    package com.superscape.world.content.theiving;
    
    import com.superscape.engine.task.Task;
    import com.superscape.engine.task.TaskManager;
    import com.superscape.util.RandomGen;
    import com.superscape.world.entity.impl.npc.NPC;
    import com.superscape.world.entity.impl.player.Player;
    import com.superscape.world.model.Animation;
    import com.superscape.world.model.Graphic;
    import com.superscape.world.model.GraphicHeight;
    import com.superscape.world.model.Priority;
    import com.superscape.world.model.Skill;
    import com.superscape.world.model.movement.MovementStatus;
    
    
    /**
     * Stunning for the theiving made by Dinh
     * @author Oscar Morton
     *
     */
    public class Stun {
    	
    	/**
    	 * The birds graphic
    	 */
    	private static final Graphic GFX = new Graphic(254, GraphicHeight.HIGH, Priority.HIGH);
    	
    	/**
    	 * The block animation
    	 */
    	private static final Animation BLOCK = new Animation(424,Priority.HIGH);
    	
    	/**
    	 * Stun method
    	 * @param player
    	 */
    	public static void stun(Player player,NPC target) {
    		//Birds over head GFX
    		player.performGraphic(GFX);
    		//player animates the block animation. I think it should be changed to whatever the players current one is.
    		player.performAnimation(BLOCK);
    		//player not allowed to move.
    		player.getMovementQueue().setMovementStatus(MovementStatus.DISABLED);
    		//Force chat message.
    		target.forceChat("What do you think you're doing?");
    		
    		/**
    		 * Task that makes the player unstunned and can move.
    		 */
    		Task unStunTask = new Task(4,player,false) {
    
    			@Override
    			protected void execute() {
    				//can move now
    				player.getMovementQueue().setMovementStatus(MovementStatus.NONE);
    				player.getCombat().addDamage(player, 1);
    				stop();
    				return;
    			}
    			
    		};
    		//starts the task
    		TaskManager.submit(unStunTask);
    	}
    	
    	public static boolean success(Player player,Pickpocket type) {
    		RandomGen random = new RandomGen();
    		double level = player.getSkillManager().getCurrentLevel(Skill.THIEVING);
    		double req = type.getRequirement();
    		double successChance = Math.ceil((level * 50 - req * 15) / req / 3 * 4);
    		int roll = random.inclusive(99);
    		if (random.inclusive(12) < 2) {
    		    return false;
    		}
    		if (successChance >= roll) {
    		    return true;
    		}
    		return false;
    	}
    }
    And if anyone wants the game sounds ids they are 2727 and 1842.

    Thanks for viewing, constructive critisism welcome but code that is simply more inefficient or flaming is not welcome.
    - Oscar
    Last edited by Farage; 08-06-2017 at 01:52 PM. Reason: Renaming thing for the Stun.java peform method.
    Have a nice day!
    Иди в пизду!
    Bonne journée!
    Einen schönen Tag noch!
    Hezký den!
    祝你今天愉快!
    Reply With Quote  
     

  2. #2  
    Inferno Founder

    Jin_'s Avatar
    Join Date
    May 2017
    Posts
    1,852
    Thanks given
    16
    Thanks received
    333
    Rep Power
    400
    Quote Originally Posted by S C A P E View Post
    This is an extension of Dihn's theiving snippet his didnt have stunning. You can take his if you want.

    First of all paste this. This is the Pickpocket class from Dihn's. I added forId method to identify which pickpocket it is instead of probably doing a switch and finding its pickpocket from that, you will just call this static method (used later). And the rest of the code was by me, you will have to add the methods in the packet listener classes but if you cannot do that just PM
    EDIT: If you want move the can perform method in Stun.java to Theiving.java or rename it to something like isStunned.
    EDIT2: If you want to have multiple npcs under one type of Pickpocket change the npcId int to an int[] and make a for loop inside of the for loop for the values in the forId method.
    EDIT3: Id suggest adding a optionNumber variable in Pickpocket so you can work off that because some NPC's have it on their first option or have it on their 2nd option or even 3rd.
    Code:
    package com.superscape.world.content.theiving;
    
    import com.superscape.world.model.Item;
    
    /**
     * This enum stores all our thieving pickpocket data.
     * @author Clive/Dinh
     * @author Oscar Morton
     *
     */
    public enum Pickpocket {
    	MAN(385,1, 8, new Item[] {new Item(995, 5) }),
    	FARMER(3257,60, 65, new Item[] {new Item(5291), new Item(5292), new Item(5293), new Item(5294), new Item(5291), new Item(5292), new Item(5293), new Item(5294), new Item(5295), new Item(5296), new Item(5297), new Item(5298), new Item(5299), new Item(5300), new Item(5301), new Item(5302), new Item(5303), new Item(5304)});
    
    	private final int npcId;
    	
    	private final int levelRequirement;
    	
    	private final int experience;
    
    	private final Item[] rewards;
    
    	private Pickpocket(final int npcId,final int level, final int experience, final Item[] loot) {
    		this.levelRequirement = level;
    		this.experience = experience;
    		this.rewards = loot;
    		this.npcId = npcId;
    	}
    	
    	public static Pickpocket forId(int id) {
    		for (Pickpocket pick : Pickpocket.values()) {
    			if (pick.getNpcId() == id) {
    				return pick;
    			}
    		}
    		return null;
    	}
    	
    	public int getRequirement() {
    		return levelRequirement;
    	}
    
    	public int getExperience() {
    		return experience;
    	}
    
    	public Item[] getLoot() {
    		return rewards;
    	}
    
    	public int getNpcId() {
    		return npcId;
    	}
    }
    Theiving.java
    Code:
    package com.superscape.world.content.theiving;
    
    import com.superscape.GameConstants;
    import com.superscape.util.Misc;
    import com.superscape.world.entity.impl.npc.NPC;
    import com.superscape.world.entity.impl.player.Player;
    import com.superscape.world.model.Animation;
    import com.superscape.world.model.Item;
    import com.superscape.world.model.Skill;
    
    /**
     * The theiving class.
     * @author Oscar Morton
     *
     */
    public class Theiving {
    	/**
    	 * Theiving animation, the picking from the pocket.
    	 */
    	private static final Animation THEIV_ANIM = new Animation(881);
    	
    	/**
    	 * Theiving.
    	 * @param player
    	 */
    	public static void theive(Player player, NPC npc,Pickpocket pick) {
    		player.setPositionToFace(npc.getPosition());
    		if (pick == null) {
    			pick = Pickpocket.forId(npc.getId());
    			if (pick == null) {
    				player.getPacketSender().sendMessage("something went wrong. send to administrator");
    				return;
    			}
    		}
    		player.getPacketSender().sendMessage(pick.name());
    		if (!canPerform(player,pick)) {
    			return;
    		}
    		player.performAnimation(THEIV_ANIM);
    		if (!Stun.success(player, pick)) {
    			Stun.stun(player, npc);
    			player.getPacketSender().sendMessage("yo");
    		} else {
    			Item lootReceived = Misc.randomElement(pick.getLoot());
    			player.getInventory().add(lootReceived.getId(), lootReceived.getAmount());
    			player.getSkillManager().addExperience(Skill.THIEVING, pick.getExperience()*(int)GameConstants.EXP_MULTIPLIER);
    		}
    	}
    	
    	/**
    	 * if the player can't perform it will return false
    	 * @param player
    	 * @param pickpocket
    	 * @return
    	 */
    	public static boolean canPerform(Player player,Pickpocket pickpocket) {
    		if (player.getSkillManager().getCurrentLevel(Skill.THIEVING) < pickpocket.getRequirement()) {
    			player.getPacketSender().sendMessage("You need a thieving level of " + pickpocket.getRequirement() + " to pickpocket this npc.");
    			return false;
    		}
    		if (player.getInventory().isFull()) {
    			player.getPacketSender().sendMessage("You need at least one free slot to steal from this npc.");
    			return false;
    		}
    		return true;
    	}
    }
    and now the class that Dinh's release didn't have. Stun.java. The class that handles the stunning
    Code:
    package com.superscape.world.content.theiving;
    
    import com.superscape.engine.task.Task;
    import com.superscape.engine.task.TaskManager;
    import com.superscape.util.RandomGen;
    import com.superscape.world.entity.impl.npc.NPC;
    import com.superscape.world.entity.impl.player.Player;
    import com.superscape.world.model.Animation;
    import com.superscape.world.model.Graphic;
    import com.superscape.world.model.GraphicHeight;
    import com.superscape.world.model.Priority;
    import com.superscape.world.model.Skill;
    import com.superscape.world.model.movement.MovementStatus;
    
    
    /**
     * Stunning for the theiving made by Dinh
     * @author Oscar Morton
     *
     */
    public class Stun {
    	
    	/**
    	 * The birds graphic
    	 */
    	private static final Graphic GFX = new Graphic(254, GraphicHeight.HIGH, Priority.HIGH);
    	
    	/**
    	 * The block animation
    	 */
    	private static final Animation BLOCK = new Animation(424,Priority.HIGH);
    	
    	/**
    	 * Stun method
    	 * @param player
    	 */
    	public static void stun(Player player,NPC target) {
    		//Birds over head GFX
    		player.performGraphic(GFX);
    		//player animates the block animation. I think it should be changed to whatever the players current one is.
    		player.performAnimation(BLOCK);
    		//player not allowed to move.
    		player.getMovementQueue().setMovementStatus(MovementStatus.DISABLED);
    		//Force chat message.
    		target.forceChat("What do you think you're doing?");
    		
    		/**
    		 * Task that makes the player unstunned and can move.
    		 */
    		Task unStunTask = new Task(4,player,false) {
    
    			@Override
    			protected void execute() {
    				//can move now
    				player.getMovementQueue().setMovementStatus(MovementStatus.NONE);
    				player.getCombat().addDamage(player, 1);
    				stop();
    				return;
    			}
    			
    		};
    		//starts the task
    		TaskManager.submit(unStunTask);
    	}
    	
    	public static boolean success(Player player,Pickpocket type) {
    		RandomGen random = new RandomGen();
    		double level = player.getSkillManager().getCurrentLevel(Skill.THIEVING);
    		double req = type.getRequirement();
    		double successChance = Math.ceil((level * 50 - req * 15) / req / 3 * 4);
    		int roll = random.inclusive(99);
    		if (random.inclusive(12) < 2) {
    		    return false;
    		}
    		if (successChance >= roll) {
    		    return true;
    		}
    		return false;
    	}
    }
    And if anyone wants the game sounds ids they are 2727 and 1842.

    Thanks for viewing, constructive critisism welcome but code that is simply more inefficient or flaming is not welcome.
    - Oscar
    thanks for sharing
    Reply With Quote  
     

  3. #3  
    Registered Member Farage's Avatar
    Join Date
    Jan 2017
    Posts
    252
    Thanks given
    24
    Thanks received
    22
    Rep Power
    0
    Quote Originally Posted by Time. View Post
    thanks for sharing
    Its cool, i haven't posted any snippets in a while, working on a working ironman mode, ulti and hardcore.
    Have a nice day!
    Иди в пизду!
    Bonne journée!
    Einen schönen Tag noch!
    Hezký den!
    祝你今天愉快!
    Reply With Quote  
     

  4. #4  
    Inferno Founder

    Jin_'s Avatar
    Join Date
    May 2017
    Posts
    1,852
    Thanks given
    16
    Thanks received
    333
    Rep Power
    400
    Quote Originally Posted by S C A P E View Post
    Its cool, i haven't posted any snippets in a while, working on a working ironman mode, ulti and hardcore.
    Haha, waiting for it
    Reply With Quote  
     

  5. #5  
    Respected Member


    Kris's Avatar
    Join Date
    Jun 2016
    Age
    26
    Posts
    3,638
    Thanks given
    820
    Thanks received
    2,642
    Rep Power
    5000
    Glad to see you improving at least.
    Some tips/suggestions though:
    private Pickpocket(final int npcId,final int level, final int experience, final Item[] loot) {
    Instead of the 'final Item[] loot', you could simply have done 'final Item... loot' and just listed the items without the need to surround them with that 'new Item[] {...}'. Keeps the code cleaner.
    I personally wouldn't have made a special class just for stunning, all it really is is a few lines. The rest actually belongs to the success calculation within thieving itself.
    You misspelt private static final Animation THEIV_ANIM = new Animation(881);//I noticed you write theiving instead of thieving everywhere, even the title.
    I also noticed you began using the final modifier much more than previously. Kudos for that, although you could definitely have used it a lot more than you have, albeit fairly unnecessary, still reassuring.

    That's pretty much all I could point out. Not going to pick on what I'd do differently as a lot of people may begin to do because this isn't my release.
    Oh and one question. Why do you never finish filling in the data? This'll be a major reason why people won't take advantage of your releases - they lazy.
    Attached image
    Reply With Quote  
     

  6. #6  
    Registered Member

    Join Date
    Feb 2015
    Posts
    830
    Thanks given
    12
    Thanks received
    200
    Rep Power
    118
    Nice mate, didn't get round to adding stunning, nice release.
    Reply With Quote  
     

  7. #7  
    Registered Member Farage's Avatar
    Join Date
    Jan 2017
    Posts
    252
    Thanks given
    24
    Thanks received
    22
    Rep Power
    0
    Quote Originally Posted by Kris View Post
    Glad to see you improving at least.
    Some tips/suggestions though:
    private Pickpocket(final int npcId,final int level, final int experience, final Item[] loot) {
    Instead of the 'final Item[] loot', you could simply have done 'final Item... loot' and just listed the items without the need to surround them with that 'new Item[] {...}'. Keeps the code cleaner.
    I personally wouldn't have made a special class just for stunning, all it really is is a few lines. The rest actually belongs to the success calculation within thieving itself.
    You misspelt private static final Animation THEIV_ANIM = new Animation(881);//I noticed you write theiving instead of thieving everywhere, even the title.
    I also noticed you began using the final modifier much more than previously. Kudos for that, although you could definitely have used it a lot more than you have, albeit fairly unnecessary, still reassuring.

    That's pretty much all I could point out. Not going to pick on what I'd do differently as a lot of people may begin to do because this isn't my release.
    Oh and one question. Why do you never finish filling in the data? This'll be a major reason why people won't take advantage of your releases - they lazy.
    Pickpocket.java is Dihn's. And it is only a snippet copy+paste wont help anyone, people will have to find the info for themselfs. Professor Oak released his one though which has all but 6 NPC's.
    Edit: Here it is
    Code:
    public enum Pickpocketable {
    			MAN_WOMAN(1, 8, 5, 1, new Item[]{new Item(COINS, 3)}, 3014, 3015, 3078, 3079, 3080, 3081, 3082, 3083, 3084, 3085, 3267, 3268, 3260, 3264, 3265, 3266, 3267, 3268),
    			FARMER(10, 15, 5, 1, new Item[]{new Item(COINS, 9), new Item(POTATO_SEED)}, 3086, 3087, 3088, 3089, 3090, 3091),
    			FEMALE_HAM_MEMBER(15, 19, 4, 3, new Item[]{new Item(BUTTONS), new Item(RUSTY_SWORD), new Item(DAMAGED_ARMOUR), new Item(FEATHER, 5), new Item(BRONZE_ARROW), new Item(BRONZE_AXE), new Item(BRONZE_DAGGER), new Item(BRONZE_PICKAXE), new Item(COWHIDE), new Item(IRON_AXE), new Item(IRON_PICKAXE), new Item(LEATHER_BOOTS), new Item(LEATHER_GLOVES), new Item(LEATHER_BODY), new Item(LOGS), new Item(THREAD), new Item(RAW_ANCHOVIES), new Item(LOGS), new Item(RAW_CHICKEN), new Item(IRON_ORE), new Item(COAL), new Item(STEEL_ARROW, 2), new Item(STEEL_AXE)
    					,new Item(STEEL_PICKAXE), new Item(KNIFE), new Item(NEEDLE), new Item(STEEL_DAGGER), new Item(TINDERBOX), new Item(UNCUT_JADE), new Item(UNCUT_OPAL), new Item(COINS, 25), new Item(HAM_GLOVES), new Item(HAM_CLOAK), new Item(HAM_BOOTS), new Item(HAM_SHIRT), new Item(HAM_ROBE), new Item(HAM_LOGO), new Item(HAM_HOOD), new Item(GRIMY_GUAM_LEAF), new Item(GRIMY_MARRENTILL), new Item(GRIMY_TARROMIN), new Item(GRIMY_HARRALANDER)}, 2540, 2541),
    			MALE_HAM_MEMBER(20, 23, 4, 3, new Item[]{new Item(BUTTONS), new Item(RUSTY_SWORD), new Item(DAMAGED_ARMOUR), new Item(FEATHER, 5), new Item(BRONZE_ARROW), new Item(BRONZE_AXE), new Item(BRONZE_DAGGER), new Item(BRONZE_PICKAXE), new Item(COWHIDE), new Item(IRON_AXE), new Item(IRON_PICKAXE), new Item(LEATHER_BOOTS), new Item(LEATHER_GLOVES), new Item(LEATHER_BODY), new Item(LOGS), new Item(THREAD), new Item(RAW_ANCHOVIES), new Item(LOGS), new Item(RAW_CHICKEN), new Item(IRON_ORE), new Item(COAL), new Item(STEEL_ARROW, 2), new Item(STEEL_AXE)
    					,new Item(STEEL_PICKAXE), new Item(KNIFE), new Item(NEEDLE), new Item(STEEL_DAGGER), new Item(TINDERBOX), new Item(UNCUT_JADE), new Item(UNCUT_OPAL), new Item(COINS, 25), new Item(HAM_GLOVES), new Item(HAM_CLOAK), new Item(HAM_BOOTS), new Item(HAM_SHIRT), new Item(HAM_ROBE), new Item(HAM_LOGO), new Item(HAM_HOOD), new Item(GRIMY_GUAM_LEAF), new Item(GRIMY_MARRENTILL), new Item(GRIMY_TARROMIN), new Item(GRIMY_HARRALANDER)}),
    			AL_KHARID_WARRIOR(25, 26, 5, 2, new Item[]{new Item(COINS, 18)}, 3100),
    			ROGUE(32, 36, 5, 2, new Item[]{new Item(COINS, 34), new Item(LOCKPICK), new Item(IRON_DAGGER_P_), new Item(JUG_OF_WINE), new Item(AIR_RUNE, 8)}, 2884),
    			CAVE_GOBLIN(36, 40, 5, 1, new Item[]{new Item(COINS, 10), new Item(IRON_ORE), new Item(TINDERBOX), new Item(SWAMP_TAR), new Item(OIL_LANTERN), new Item(TORCH), new Item(GREEN_GLOOP_SOUP), new Item(FROGSPAWN_GUMBO), new Item(FROGBURGER), new Item(COATED_FROGS_LEGS), new Item(BAT_SHISH), new Item(FINGERS), new Item(BULLSEYE_LANTERN), new Item(CAVE_GOBLIN_WIRE)}, 2268, 2269, 2270, 2271, 2272, 2273, 2274, 2275, 2276, 2277, 2278, 2279, 2280,
    					2281, 2282, 2283, 2284, 2285),
    			MASTER_FARMER(38, 43, 5, 3, new Item[]{
    					new Item(POTATO_SEED, 12), 
    					new Item(ONION_SEED, 8), 
    					new Item(CABBAGE_SEED, 5), 
    					new Item(TOMATO_SEED, 4), 
    					new Item(HAMMERSTONE_SEED, 4), 
    					new Item(BARLEY_SEED, 4), 
    					new Item(MARIGOLD_SEED, 4),
    					new Item(ASGARNIAN_SEED, 4),
    					new Item(JUTE_SEED, 4),
    					new Item(REDBERRY_SEED, 4),
    					new Item(NASTURTIUM_SEED, 4),
    					new Item(YANILLIAN_SEED, 4),
    					new Item(CADAVABERRY_SEED, 4),
    					new Item(SWEETCORN_SEED, 4),
    					new Item(ROSEMARY_SEED, 4), 
    					new Item(DWELLBERRY_SEED, 3), 
    					new Item(GUAM_SEED, 3), 
    					new Item(WOAD_SEED, 3),
    					new Item(KRANDORIAN_SEED, 3),
    					new Item(STRAWBERRY_SEED, 3),
    					new Item(LIMPWURT_SEED, 3),
    					new Item(MARRENTILL_SEED, 3),
    					new Item(JANGERBERRY_SEED, 3),
    					new Item(TARROMIN_SEED, 2),
    					new Item(WILDBLOOD_SEED, 2),
    					new Item(WATERMELON_SEED, 2),
    					new Item(HARRALANDER_SEED, 2),
    					new Item(RANARR_SEED, 1),
    					new Item(WHITEBERRY_SEED, 2),
    					new Item(TOADFLAX_SEED, 2),
    					new Item(MUSHROOM_SPORE, 2),
    					new Item(IRIT_SEED, 2),
    					new Item(BELLADONNA_SEED, 2),
    					new Item(POISON_IVY_SEED, 2),
    					new Item(AVANTOE_SEED, 1),
    					new Item(CACTUS_SEED, 1),
    					new Item(KWUARM_SEED, 1),
    					new Item(SNAPDRAGON_SEED, 1),
    					new Item(CADANTINE_SEED, 1),
    					new Item(LANTADYME_SEED, 1),
    					new Item(DWARF_WEED_SEED, 1),
    					new Item(TORSTOL_SEED, 1),
    			}, 3257, 3258, 5832),
    			GUARD(40, 47, 5, 2, new Item[]{new Item(COINS, 30)}, 1546, 1547, 1548, 1549, 1550, 3010, 3011, 3094, 3245, 3267, 3268, 3269, 3270, 3271, 3272, 3273, 3274, 3283),
    			FREMENNIK_CITIZEN(45, 65, 5, 2, new Item[]{new Item(COINS, 40)}, 2462),
    			BEARDED_POLLNIVNIAN_BANDIT(45, 65, 5, 5, new Item[]{new Item(COINS, 40)}, 1880),
    			//DESERT_BANDIT(53, 80, 5, 3, new Item[]{new Item(COINS, 30), new Item(ANTIPOISON_4_), new Item(LOCKPICK)}),
    			//	KNIGHT(55, 84, 5, 3, new Item[]{new Item(COINS, 50)}),
    			//	POLLNIVIAN_BANDIT(55, 84, 5, 5, new Item[]{new Item(COINS, 50)}),
    			YANILLE_WATCHMAN(65, 137, 5, 3, new Item[]{new Item(COINS, 60), new Item(BREAD)}, 3251),
    			MENAPHITE_THUG(65, 137, 5, 5, new Item[]{new Item(COINS, 60)}, 3549, 3550),
    			PALADIN(70, 152, 5, 3, new Item[]{new Item(COINS, 80), new Item(CHAOS_RUNE, 2)}, 3104, 3105),
    			GNOME(75, 199, 5, 1, new Item[]{new Item(COINS, 300), new Item(EARTH_RUNE), new Item(GOLD_ORE), new Item(FIRE_ORB), new Item(SWAMP_TOAD), new Item(KING_WORM)}, 6086, 6087, 6094, 6095, 6096),
    			//HERO(80, 275, 6, 4, new Item[]{new Item(COINS, 280), new Item(BLOOD_RUNE), new Item(DIAMOND), new Item(JUG_OF_WINE), new Item(DEATH_RUNE, 2), new Item(FIRE_ORB), new Item(GOLD_ORE)}),
    			//ELF(85, 353, 6, 5, new Item[]{new Item(COINS, 325), new Item(NATURE_RUNE, 3), new Item(DIAMOND), new Item(JUG_OF_WINE), new Item(DEATH_RUNE, 2), new Item(FIRE_ORB), new Item(GOLD_ORE)}),
    
    			;
    			private final int level;
    			private final int exp;
    			private final int stunTime;
    			private final int stunDamage;
    			private final Item[] rewards;
    			private final int[] npcs;
    
    			Pickpocketable(int level, int exp, int stunTime, int stunDamage, Item[] rewards, int... npcs) {
    				this.level = level;
    				this.exp = exp;
    				this.stunTime = stunTime;
    				this.stunDamage = stunDamage;
    				this.rewards = rewards;
    				this.npcs = npcs;
    			}
    
    			public int getLevel() {
    				return level;
    			}
    
    			public int getExp() {
    				return exp;
    			}
    
    			public int getStunTime() {
    				return stunTime;
    			}
    
    			public int getStunDamage() {
    				return stunDamage;
    			}
    
    			public Item[] getRewards() {
    				return rewards;
    			}
    
    			public int[] getNpcs() {
    				return npcs;
    			}
    
    			private static Map<Integer, Pickpocketable> pickpockets = new HashMap<Integer, Pickpocketable>();
    			static {
    				for(Pickpocketable p : Pickpocketable.values()) {
    					for(int i : p.getNpcs()) {
    						pickpockets.put(i, p);
    					}
    				}
    			}
    
    			public static Optional<Pickpocketable> get(int npcId) {
    				Pickpocketable p = pickpockets.get(npcId);
    				if(p != null) {
    					return Optional.of(p);
    				}
    				return Optional.empty();
    			}
    		}
    Quote Originally Posted by Dinh View Post
    Nice mate, didn't get round to adding stunning, nice release.
    It's cool haha, next time i wouldnt use a theiving class that belongs to the player instead use static methods because its less code when you get round to putting the stuff in NPCOptionPacketListener.java
    - Oscar
    Have a nice day!
    Иди в пизду!
    Bonne journée!
    Einen schönen Tag noch!
    Hezký den!
    祝你今天愉快!
    Reply With Quote  
     

  8. #8  
    Registered Member

    Join Date
    Feb 2015
    Posts
    830
    Thanks given
    12
    Thanks received
    200
    Rep Power
    118
    Quote Originally Posted by S C A P E View Post
    Pickpocket.java is Dihn's. And it is only a snippet copy+paste wont help anyone, people will have to find the info for themselfs. Professor Oak released his one though which has all but 6 NPC's.
    Edit: Here it is
    Code:
    public enum Pickpocketable {
    			MAN_WOMAN(1, 8, 5, 1, new Item[]{new Item(COINS, 3)}, 3014, 3015, 3078, 3079, 3080, 3081, 3082, 3083, 3084, 3085, 3267, 3268, 3260, 3264, 3265, 3266, 3267, 3268),
    			FARMER(10, 15, 5, 1, new Item[]{new Item(COINS, 9), new Item(POTATO_SEED)}, 3086, 3087, 3088, 3089, 3090, 3091),
    			FEMALE_HAM_MEMBER(15, 19, 4, 3, new Item[]{new Item(BUTTONS), new Item(RUSTY_SWORD), new Item(DAMAGED_ARMOUR), new Item(FEATHER, 5), new Item(BRONZE_ARROW), new Item(BRONZE_AXE), new Item(BRONZE_DAGGER), new Item(BRONZE_PICKAXE), new Item(COWHIDE), new Item(IRON_AXE), new Item(IRON_PICKAXE), new Item(LEATHER_BOOTS), new Item(LEATHER_GLOVES), new Item(LEATHER_BODY), new Item(LOGS), new Item(THREAD), new Item(RAW_ANCHOVIES), new Item(LOGS), new Item(RAW_CHICKEN), new Item(IRON_ORE), new Item(COAL), new Item(STEEL_ARROW, 2), new Item(STEEL_AXE)
    					,new Item(STEEL_PICKAXE), new Item(KNIFE), new Item(NEEDLE), new Item(STEEL_DAGGER), new Item(TINDERBOX), new Item(UNCUT_JADE), new Item(UNCUT_OPAL), new Item(COINS, 25), new Item(HAM_GLOVES), new Item(HAM_CLOAK), new Item(HAM_BOOTS), new Item(HAM_SHIRT), new Item(HAM_ROBE), new Item(HAM_LOGO), new Item(HAM_HOOD), new Item(GRIMY_GUAM_LEAF), new Item(GRIMY_MARRENTILL), new Item(GRIMY_TARROMIN), new Item(GRIMY_HARRALANDER)}, 2540, 2541),
    			MALE_HAM_MEMBER(20, 23, 4, 3, new Item[]{new Item(BUTTONS), new Item(RUSTY_SWORD), new Item(DAMAGED_ARMOUR), new Item(FEATHER, 5), new Item(BRONZE_ARROW), new Item(BRONZE_AXE), new Item(BRONZE_DAGGER), new Item(BRONZE_PICKAXE), new Item(COWHIDE), new Item(IRON_AXE), new Item(IRON_PICKAXE), new Item(LEATHER_BOOTS), new Item(LEATHER_GLOVES), new Item(LEATHER_BODY), new Item(LOGS), new Item(THREAD), new Item(RAW_ANCHOVIES), new Item(LOGS), new Item(RAW_CHICKEN), new Item(IRON_ORE), new Item(COAL), new Item(STEEL_ARROW, 2), new Item(STEEL_AXE)
    					,new Item(STEEL_PICKAXE), new Item(KNIFE), new Item(NEEDLE), new Item(STEEL_DAGGER), new Item(TINDERBOX), new Item(UNCUT_JADE), new Item(UNCUT_OPAL), new Item(COINS, 25), new Item(HAM_GLOVES), new Item(HAM_CLOAK), new Item(HAM_BOOTS), new Item(HAM_SHIRT), new Item(HAM_ROBE), new Item(HAM_LOGO), new Item(HAM_HOOD), new Item(GRIMY_GUAM_LEAF), new Item(GRIMY_MARRENTILL), new Item(GRIMY_TARROMIN), new Item(GRIMY_HARRALANDER)}),
    			AL_KHARID_WARRIOR(25, 26, 5, 2, new Item[]{new Item(COINS, 18)}, 3100),
    			ROGUE(32, 36, 5, 2, new Item[]{new Item(COINS, 34), new Item(LOCKPICK), new Item(IRON_DAGGER_P_), new Item(JUG_OF_WINE), new Item(AIR_RUNE, 8)}, 2884),
    			CAVE_GOBLIN(36, 40, 5, 1, new Item[]{new Item(COINS, 10), new Item(IRON_ORE), new Item(TINDERBOX), new Item(SWAMP_TAR), new Item(OIL_LANTERN), new Item(TORCH), new Item(GREEN_GLOOP_SOUP), new Item(FROGSPAWN_GUMBO), new Item(FROGBURGER), new Item(COATED_FROGS_LEGS), new Item(BAT_SHISH), new Item(FINGERS), new Item(BULLSEYE_LANTERN), new Item(CAVE_GOBLIN_WIRE)}, 2268, 2269, 2270, 2271, 2272, 2273, 2274, 2275, 2276, 2277, 2278, 2279, 2280,
    					2281, 2282, 2283, 2284, 2285),
    			MASTER_FARMER(38, 43, 5, 3, new Item[]{
    					new Item(POTATO_SEED, 12), 
    					new Item(ONION_SEED, 8), 
    					new Item(CABBAGE_SEED, 5), 
    					new Item(TOMATO_SEED, 4), 
    					new Item(HAMMERSTONE_SEED, 4), 
    					new Item(BARLEY_SEED, 4), 
    					new Item(MARIGOLD_SEED, 4),
    					new Item(ASGARNIAN_SEED, 4),
    					new Item(JUTE_SEED, 4),
    					new Item(REDBERRY_SEED, 4),
    					new Item(NASTURTIUM_SEED, 4),
    					new Item(YANILLIAN_SEED, 4),
    					new Item(CADAVABERRY_SEED, 4),
    					new Item(SWEETCORN_SEED, 4),
    					new Item(ROSEMARY_SEED, 4), 
    					new Item(DWELLBERRY_SEED, 3), 
    					new Item(GUAM_SEED, 3), 
    					new Item(WOAD_SEED, 3),
    					new Item(KRANDORIAN_SEED, 3),
    					new Item(STRAWBERRY_SEED, 3),
    					new Item(LIMPWURT_SEED, 3),
    					new Item(MARRENTILL_SEED, 3),
    					new Item(JANGERBERRY_SEED, 3),
    					new Item(TARROMIN_SEED, 2),
    					new Item(WILDBLOOD_SEED, 2),
    					new Item(WATERMELON_SEED, 2),
    					new Item(HARRALANDER_SEED, 2),
    					new Item(RANARR_SEED, 1),
    					new Item(WHITEBERRY_SEED, 2),
    					new Item(TOADFLAX_SEED, 2),
    					new Item(MUSHROOM_SPORE, 2),
    					new Item(IRIT_SEED, 2),
    					new Item(BELLADONNA_SEED, 2),
    					new Item(POISON_IVY_SEED, 2),
    					new Item(AVANTOE_SEED, 1),
    					new Item(CACTUS_SEED, 1),
    					new Item(KWUARM_SEED, 1),
    					new Item(SNAPDRAGON_SEED, 1),
    					new Item(CADANTINE_SEED, 1),
    					new Item(LANTADYME_SEED, 1),
    					new Item(DWARF_WEED_SEED, 1),
    					new Item(TORSTOL_SEED, 1),
    			}, 3257, 3258, 5832),
    			GUARD(40, 47, 5, 2, new Item[]{new Item(COINS, 30)}, 1546, 1547, 1548, 1549, 1550, 3010, 3011, 3094, 3245, 3267, 3268, 3269, 3270, 3271, 3272, 3273, 3274, 3283),
    			FREMENNIK_CITIZEN(45, 65, 5, 2, new Item[]{new Item(COINS, 40)}, 2462),
    			BEARDED_POLLNIVNIAN_BANDIT(45, 65, 5, 5, new Item[]{new Item(COINS, 40)}, 1880),
    			//DESERT_BANDIT(53, 80, 5, 3, new Item[]{new Item(COINS, 30), new Item(ANTIPOISON_4_), new Item(LOCKPICK)}),
    			//	KNIGHT(55, 84, 5, 3, new Item[]{new Item(COINS, 50)}),
    			//	POLLNIVIAN_BANDIT(55, 84, 5, 5, new Item[]{new Item(COINS, 50)}),
    			YANILLE_WATCHMAN(65, 137, 5, 3, new Item[]{new Item(COINS, 60), new Item(BREAD)}, 3251),
    			MENAPHITE_THUG(65, 137, 5, 5, new Item[]{new Item(COINS, 60)}, 3549, 3550),
    			PALADIN(70, 152, 5, 3, new Item[]{new Item(COINS, 80), new Item(CHAOS_RUNE, 2)}, 3104, 3105),
    			GNOME(75, 199, 5, 1, new Item[]{new Item(COINS, 300), new Item(EARTH_RUNE), new Item(GOLD_ORE), new Item(FIRE_ORB), new Item(SWAMP_TOAD), new Item(KING_WORM)}, 6086, 6087, 6094, 6095, 6096),
    			//HERO(80, 275, 6, 4, new Item[]{new Item(COINS, 280), new Item(BLOOD_RUNE), new Item(DIAMOND), new Item(JUG_OF_WINE), new Item(DEATH_RUNE, 2), new Item(FIRE_ORB), new Item(GOLD_ORE)}),
    			//ELF(85, 353, 6, 5, new Item[]{new Item(COINS, 325), new Item(NATURE_RUNE, 3), new Item(DIAMOND), new Item(JUG_OF_WINE), new Item(DEATH_RUNE, 2), new Item(FIRE_ORB), new Item(GOLD_ORE)}),
    
    			;
    			private final int level;
    			private final int exp;
    			private final int stunTime;
    			private final int stunDamage;
    			private final Item[] rewards;
    			private final int[] npcs;
    
    			Pickpocketable(int level, int exp, int stunTime, int stunDamage, Item[] rewards, int... npcs) {
    				this.level = level;
    				this.exp = exp;
    				this.stunTime = stunTime;
    				this.stunDamage = stunDamage;
    				this.rewards = rewards;
    				this.npcs = npcs;
    			}
    
    			public int getLevel() {
    				return level;
    			}
    
    			public int getExp() {
    				return exp;
    			}
    
    			public int getStunTime() {
    				return stunTime;
    			}
    
    			public int getStunDamage() {
    				return stunDamage;
    			}
    
    			public Item[] getRewards() {
    				return rewards;
    			}
    
    			public int[] getNpcs() {
    				return npcs;
    			}
    
    			private static Map<Integer, Pickpocketable> pickpockets = new HashMap<Integer, Pickpocketable>();
    			static {
    				for(Pickpocketable p : Pickpocketable.values()) {
    					for(int i : p.getNpcs()) {
    						pickpockets.put(i, p);
    					}
    				}
    			}
    
    			public static Optional<Pickpocketable> get(int npcId) {
    				Pickpocketable p = pickpockets.get(npcId);
    				if(p != null) {
    					return Optional.of(p);
    				}
    				return Optional.empty();
    			}
    		}


    It's cool haha, next time i wouldnt use a theiving class that belongs to the player instead use static methods because its less code when you get round to putting the stuff in NPCOptionPacketListener.java
    - Oscar
    True, thanks for the advice.
    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. [Elvarg / OSRSPK] Item on bank un-noting.
    By Farage in forum Snippets
    Replies: 8
    Last Post: 07-26-2017, 03:33 PM
  2. [c&p] theiving base the real way ;) [508]
    By iamthehat in forum Tutorials
    Replies: 5
    Last Post: 10-15-2008, 08:42 AM
  3. Making the lil base on magic into a Full class file
    By `Lubricant in forum Configuration
    Replies: 7
    Last Post: 09-14-2008, 09:33 PM
  4. Runecrafting 85%, 100% multipliers based on level
    By Felix49 in forum RS2 Server
    Replies: 7
    Last Post: 07-16-2008, 06:44 PM
  5. New sig based on a tut on the net
    By Clawz in forum Showcase
    Replies: 7
    Last Post: 01-15-2008, 08:45 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
  •