Thread: IronMan Picking up Items

Results 1 to 2 of 2
  1. #1 IronMan Picking up Items 
    Registered Member Slatum.'s Avatar
    Join Date
    Apr 2017
    Posts
    109
    Thanks given
    16
    Thanks received
    12
    Rep Power
    11
    I can't figure out how to allow the ironman rank pick up items, but not allow them to pick up other people's loot. Help would be appreciated.

    using c.PlayerRights == 14 for ironman,

    Spoiler for PickupItem:
    Code:
    public class PickupItem implements PacketType {
    
        private boolean canPickUp(final Client c, final String itemName, final GroundItem item) {
    	for (Object[] o : c.getDroppedItems()) {
    	    if (((String) o[0]).equalsIgnoreCase(itemName)) {
    		if (((int) o[1]) == item.getItemAmount()) {
    		    if (((int) o[2]) == c.pItemX) {
    			if (((int) o[3]) == c.pItemY) {
    			    return true;
    			}
    		    }
    		}
    	    }
    	}
    	return false;
        }
        
        private boolean hasItem(final Client c, final String itemName) {
    	for (Object[] o : c.getDroppedItems()) {
    	    if (((String) o[0]).equalsIgnoreCase(itemName)) {
    		return true;
    	    }
    	}
    	return false;
        }
    
        @Override
        public void processPacket(final Client c, int packetType, int packetSize) {
    	c.pItemY = c.getInStream().readSignedWordBigEndian();
    	c.pItemId = c.getInStream().readUnsignedWord();
    	c.pItemX = c.getInStream().readSignedWordBigEndian();
    	if (Math.abs(c.getX() - c.pItemX) > 25 || Math.abs(c.getY() - c.pItemY) > 25) {
    	    c.resetWalkingQueue();
    	    return;
    	}
    	String itemName = c.getItems().getItemName(c.pItemId).toLowerCase();
    	GameLogger.writeLog(c.playerName, "pickupitem", c.playerName + " picked up " + itemName + " itemX: " + c.pItemX + ", itemY: " + c.pItemY + "");
    	if(c.playerIsFiremaking) {
    	    return;
    	}
    	c.getCombat().resetPlayerAttack();
    	if(c.getX() == c.pItemX && c.getY() == c.pItemY) {
    	    Server.itemHandler.removeGroundItem(c, c.pItemId, c.pItemX, c.pItemY, true);
    	    c.getPA().requestUpdates();
    
    	} else {
    	    c.walkingToItem = true;
    	    Server.getTaskScheduler().addEvent(new Task(1, false) {
    		public void execute() {
    		    if(!c.walkingToItem)
    			this.stop();
    		    if(c.getX() == c.pItemX && c.getY() == c.pItemY) {
    			Server.itemHandler.removeGroundItem(c, c.pItemId, c.pItemX, c.pItemY, true);
    			c.walkingToItem = false;
    			this.stop();
    		    }
    		}
    
    	    });
    	}
    
        }
    
    }



    Spoiler for GroundItem:
    Code:
    public class GroundItem {
    	
    	public int itemId;
    	public int itemX;
    	public int itemY;
    	public int itemAmount;
    	public int itemController;
    	public int hideTicks;
    	public int removeTicks;
    	public String ownerName;
    	public int gfx0;
    	
    
    	public void GroundRareItem(int id, int x, int y, int amount, int controller, int hideTicks, int gfx0, String name) {
    		this.itemId = id;
    		this.itemX = x;
    		this.itemY = y;
    		this.itemAmount = amount;
    		this.itemController = controller;
    		this.hideTicks = hideTicks;
    		this.gfx0 = gfx0;
    		this.ownerName = name;
    	}
    	
    	public GroundItem(int id, int x, int y, int amount, int controller, int hideTicks, String name) {
    		this.itemId = id;
    		this.itemX = x;
    		this.itemY = y;
    		this.itemAmount = amount;
    		this.itemController = controller;
    		this.hideTicks = hideTicks;
    		this.ownerName = name;
    	}
    	
    	public int getItemId() {
    		return this.itemId;
    	}
    	
    	public int getItemX(){
    		return this.itemX;
    	}
    	
    	public int getItemY(){
    		return this.itemY;
    	}
    	
    	public int getItemAmount(){
    		return this.itemAmount;
    	}
    	
    	public int getItemController(){
    		return this.itemController;
    	}
    	
    	public int getGfx0(){
    		return this.gfx0;
    	}
    	
    	public String getName() {
    		return this.ownerName;
    	}
    	
    	
    
    	
    
    	
    }
    Reply With Quote  
     

  2. #2  
    Registered Member

    Join Date
    Dec 2014
    Posts
    351
    Thanks given
    43
    Thanks received
    93
    Rep Power
    107
    if(player.isIronman() && !item.getOwnerName().equals(player.getName())){
    return false;
    }
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [pi 317] Ironman users picking up items
    By ASPROJECT in forum Help
    Replies: 6
    Last Post: 01-18-2015, 10:46 AM
  2. [RuneSource] Picking up items.
    By Kastro in forum Snippets
    Replies: 9
    Last Post: 01-11-2011, 08:54 AM
  3. [PI] Can't pick up items?
    By Thani in forum Help
    Replies: 0
    Last Post: 11-14-2010, 04:43 AM
  4. Picking up items
    By 420weed420 in forum Help
    Replies: 1
    Last Post: 11-27-2009, 12:00 AM
  5. Picking up items.
    By Stanyer in forum RS 503+ Client & Server
    Replies: 6
    Last Post: 08-15-2008, 09:13 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
  •