Thread: Adding thieving received amount

Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1 Adding thieving received amount 
    Registered Member

    Join Date
    Jul 2007
    Age
    32
    Posts
    466
    Thanks given
    90
    Thanks received
    52
    Rep Power
    87
    actionhandler.java
    Code:
    			case 2561:
    				c.getThieving().stealFromStall(995, 10, 1, objectType, obX, obY);
    thieving.java
    Code:
    package server.model.players.skills;
    
    import server.Config;
    import server.util.Misc;
    import server.model.players.Client;
    import server.Server;
    import server.event.EventManager;
    import server.event.Event;
    import server.event.EventContainer;
    /**
     * Thieving.java
     *
     * @author Balla_
     *
     **/
     
    public class Thieving {
    	
    	private Client c;
    		
    	public Thieving(Client c) {
    		this.c = c;
    	}
    	
    	public void stealFromNPC(int id) {
    		if (System.currentTimeMillis() - c.lastThieve < 2000)
    			return;
    		for (int j = 0; j < npcThieving.length; j++) {
    			if (npcThieving[j][0] == id) {
    				if (c.playerLevel[c.playerThieving] >= npcThieving[j][1]) {
    					if (Misc.random(c.playerLevel[c.playerThieving] + 2 - npcThieving[j][1]) != 1) {
    						c.getPA().addSkillXP(npcThieving[j][2] * Config.THIEVING_EXPERIENCE, c.playerThieving);
    						c.getItems().addItem(995, npcThieving[j][3]);
    						c.startAnimation(881);
    						c.lastThieve = System.currentTimeMillis();
    						c.sendMessage("You thieve some money...");
    						break;
    					} else {
    						c.setHitDiff(npcThieving[j][4]);
    						c.setHitUpdateRequired(true);
    						c.playerLevel[3] -= npcThieving[j][4];
    						c.getPA().refreshSkill(3);
    						c.lastThieve = System.currentTimeMillis() + 2000;
    						c.sendMessage("You fail to thieve the NPC.");
    						break;
    					}
    				} else {
    					c.sendMessage("You need a thieving level of " + npcThieving[j][1] + " to thieve from this NPC.");
    				}
    			}		
    		}
    	}
    	
    	public void stealFromStall(int id, int xp, int level, final int i, final int x, final int y) {
    		if (System.currentTimeMillis() - c.lastThieve < 2500)
    			return;
    		if (c.playerLevel[c.playerThieving] >= level) {
    			if (c.getItems().addItem(id,1)) {
    				c.startAnimation(832);
    				c.getPA().addSkillXP(xp * Config.THIEVING_EXPERIENCE, c.playerThieving);
    				c.lastThieve = System.currentTimeMillis();
    				c.sendMessage("You steal a " + server.model.items.Item.getItemName(id) + ".");
    				c.getPA().checkObjectSpawn(5430 + Misc.random(0), x, y, -2, 10);
    				EventManager.getSingleton().addEvent(new Event() {
    					public void execute(EventContainer p) {
    						c.getPA().checkObjectSpawn(i, x, y, -2, 10);
    						p.stop();
    					}
    				}, 3500);
    			}
    		} else {
    			c.sendMessage("You must have a thieving level of " + level + " to thieve from this stall.");
    		}
    	}
    
    	public static void appendHit(int damage, Client c) {
    		Server.playerHandler.players[c.playerId].setHitDiff(damage);
    		Server.playerHandler.players[c.playerId].playerLevel[3] -= damage;
    		c.getPA().refreshSkill(3);
    		Server.playerHandler.players[c.playerId].setHitUpdateRequired(true);	
    		Server.playerHandler.players[c.playerId].updateRequired = true;		
    	}	
    	//npc, level, exp, coin amount
    	public int[][] npcThieving = {{1,1,8,200,1},{18,25,26,500,1},{9,40,47,1000,2},{26,55,85,1500,3},{20,70,152,2000,4},{21,80,273,3000,5}};
    
    }
    I need to add certain amount of items received by thieving from the stall.
    Anybody, please?
    Reply With Quote  
     

  2. #2  
    Registered Member range inc's Avatar
    Join Date
    Aug 2009
    Age
    28
    Posts
    194
    Thanks given
    0
    Thanks received
    5
    Rep Power
    2
    You mean like this:

    You steal 5 coins from the stall
    It says:

    You stole 5 coins.
    ??

    Webclient SERVICE! I ALLWAYS GO FIRST!
    Webclient's --> so fking easy
    Reply With Quote  
     

  3. #3  
    Banned

    Join Date
    Jul 2011
    Age
    30
    Posts
    745
    Thanks given
    2,207
    Thanks received
    451
    Rep Power
    0
    Don't understand what you mean but here

    Code:
    case 2561:
    	c.getThieving().stealFromStall(itemID, amount, levelNeededToThieve , objectType, obX, obY);
    it says it all in that method's arguements

    Code:
    	public void stealFromStall(int id, int xp, int level, final int i, final int x, final int y) {
    		if (System.currentTimeMillis() - c.lastThieve < 2500)
    			return;
    		if (c.playerLevel[c.playerThieving] >= level) {
    			if (c.getItems().addItem(id,1)) {
    				c.startAnimation(832);
    				c.getPA().addSkillXP(xp * Config.THIEVING_EXPERIENCE, c.playerThieving);
    				c.lastThieve = System.currentTimeMillis();
    				c.sendMessage("You steal a " + server.model.items.Item.getItemName(id) + ".");
    				c.getPA().checkObjectSpawn(5430 + Misc.random(0), x, y, -2, 10);
    				EventManager.getSingleton().addEvent(new Event() {
    					public void execute(EventContainer p) {
    						c.getPA().checkObjectSpawn(i, x, y, -2, 10);
    						p.stop();
    					}
    				}, 3500);
    			}
    		} else {
    			c.sendMessage("You must have a thieving level of " + level + " to thieve from this stall.");
    		}
    	}
    Reply With Quote  
     

  4. Thankful user:


  5. #4  
    Registered Member

    Join Date
    Jul 2007
    Age
    32
    Posts
    466
    Thanks given
    90
    Thanks received
    52
    Rep Power
    87
    Nope, I need to add a amount of coins/item you get by thieving from the stall, so if you thieve you will receive ex. 100K, not 1gp, but I need to make it custom for every stall, you understand ?
    Reply With Quote  
     

  6. #5  
    Banned

    Join Date
    Feb 2012
    Age
    27
    Posts
    474
    Thanks given
    20
    Thanks received
    65
    Rep Power
    0
    c.getItems().addItem(995, 100000);
    Reply With Quote  
     

  7. Thankful users:


  8. #6  
    Banned

    Join Date
    Jul 2011
    Age
    30
    Posts
    745
    Thanks given
    2,207
    Thanks received
    451
    Rep Power
    0
    Quote Originally Posted by Sanitarium View Post
    c.getItems().addItem(995, 100000);
    Wouldn't work right, I would post you a new method of doing this but igt2, might later if I remeber
    Reply With Quote  
     

  9. #7  
    Registered Member

    Join Date
    Jul 2007
    Age
    32
    Posts
    466
    Thanks given
    90
    Thanks received
    52
    Rep Power
    87
    Quote Originally Posted by Sanitarium View Post
    c.getItems().addItem(995, 100000);
    Not working good, you receive coins even if you dont steal from the stall and dont have level for it, so it gives you everytime you click it.
    Reply With Quote  
     

  10. #8  
    Banned

    Join Date
    Jul 2011
    Age
    30
    Posts
    745
    Thanks given
    2,207
    Thanks received
    451
    Rep Power
    0
    if (c.getItems().addItem(id,1)) {
    thats where you change the amount of the item you steal. didn't c that b4
    Reply With Quote  
     

  11. Thankful user:


  12. #9  
    Expect the Unexpected

    Acquittal's Avatar
    Join Date
    Jan 2011
    Age
    30
    Posts
    1,182
    Thanks given
    627
    Thanks received
    233
    Rep Power
    238
    If you actually read through the thievestall method, you would understand how to write the code where you are clicking the object...
    Reply With Quote  
     

  13. #10  
    Donator
    bigerman123's Avatar
    Join Date
    Feb 2011
    Age
    28
    Posts
    105
    Thanks given
    1
    Thanks received
    3
    Rep Power
    0
    if(c.playerLevel[14] = X){
    c.getItems().addItem(995, 100000);
    }else{
    c.sendMessage("You do not have the correct level for this stall!");
    }

    try that.
    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. [PI]Thieving Help
    By Glenn in forum Help
    Replies: 1
    Last Post: 06-07-2011, 05:07 AM
  2. [PI] Thieving
    By Anonymous in forum Requests
    Replies: 9
    Last Post: 06-04-2011, 10:21 PM
  3. Thieving
    By Devo-X in forum Help
    Replies: 2
    Last Post: 08-07-2010, 03:33 PM
  4. thieving
    By cornflakes_ in forum Chat
    Replies: 1
    Last Post: 02-17-2010, 01:03 AM
  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
  •