Thread: Cannot drop items

Results 1 to 9 of 9
  1. #1 Cannot drop items 
    Donator

    Anthony's Avatar
    Join Date
    Dec 2007
    Age
    29
    Posts
    1,344
    Thanks given
    198
    Thanks received
    129
    Rep Power
    355
    Hey guys,

    Something probably easy as hell but I can't seem allow players to drop items.

    I guess I should fix that, they can drop items but they won't appear for other players.

    Here is my dropItem

    EDIT: I've replaced my dropitem about 5 times with 5 different ones, and still no difference.

    Code:
    package server.model.players.packets;
    
    import server.Config;
    import server.Server;
    import server.model.players.Client;
    import server.model.players.PacketType;
    import server.model.players.PlayerSave;
    import server.model.players.Binding;
    
    /**
     * Drop Item
     **/
    public class DropItem implements PacketType {
    
    	@Override
    	public void processPacket(Client c, int packetType, int packetSize) {
    		int itemId = c.getInStream().readUnsignedWordA();
    		c.getInStream().readUnsignedByte();
    		c.getInStream().readUnsignedByte();
    		int slot = c.getInStream().readUnsignedWordA();
    		if(c.inTrade) {
    			c.sendMessage("You can't drop items while trading!");
    			return;
    		}
    		if(c.isDead) {
    			c.sendMessage("You can't drop items when you are dead.");
    			return;
    		} 
    		/*if(c.newPlayer()) {
    			c.getTimeLeftForNP();
    			return;
    		} */
    		boolean droppable = true;
    		for (int i : Config.UNDROPPABLE_ITEMS) {
    			if (i == itemId) {
    				droppable = false;
    				break;
    			}
    		}
    		boolean destroyable = false;
    		for (int i : Config.DESTROYABLES) {
    			if (i == itemId) {
    				destroyable = true;
    				break;
    			}
    		}
    		if(c.playerItemsN[slot] != 0 && itemId != -1 && c.playerItems[slot] == itemId + 1) {
    			if (destroyable) {
    				c.getPA().destroyInterface(itemId);
    				return;
    			}
    			if(droppable) {
                    for(int i = 0; i < Binding.bindedItem.length; i++) {
    		if (itemId == Binding.bindedItem[i]) {
    			c.droppedItem = itemId;
    			c.getPA().destroyBindInterface(itemId);
    			c.destroy = 1;
    			return;
    		}
    			}
    		if (c.underAttackBy > 0) {
    			if (c.getShops().getItemShopValue(itemId) > 1000) {
    				c.sendMessage("You may not drop items worth more than 1000 while in combat.");
    				return;
    				}
    					}
    			Server.itemHandler.createGroundItem(c, itemId, c.getX(), c.getY(), c.playerItemsN[slot], c.getId());
    			c.getItems().deleteItem(itemId, slot, c.playerItemsN[slot]);
    			
    		if(Config.SOUND){
    			c.sendSound(c.getSound().DROPITEM);
    				}
    			PlayerSave.saveGame(c);
    				} else
    			c.sendMessage("This item cannot be dropped.");
    				}
    			c.getPA().closeAllWindows();
    				}
    			}
    Reply With Quote  
     

  2. #2  
    Donator

    Anthony's Avatar
    Join Date
    Dec 2007
    Age
    29
    Posts
    1,344
    Thanks given
    198
    Thanks received
    129
    Rep Power
    355
    Anyone
    Reply With Quote  
     

  3. #3  
    Member
    Join Date
    Sep 2012
    Age
    27
    Posts
    172
    Thanks given
    22
    Thanks received
    7
    Rep Power
    0
    The reason it doesn't appear for other could be in your createGroundtem maybe?

    EDIT: probably something in this is wrong
    Code:
    if (!Item.isStackable(itemId) && itemAmount > 0) {
    				for (int j = 0; j < itemAmount; j++) {
    					c.getItems().createGroundItem(itemId, itemX, itemY, 1);
    					GroundItem item = new GroundItem(itemId, itemX, itemY, 1, c.playerId, HIDE_TICKS, PlayerHandler.players[playerId].playerName);
    					addItem(item);
    				}	
    			} else {
    				c.getItems().createGroundItem(itemId, itemX, itemY, itemAmount);
    				GroundItem item = new GroundItem(itemId, itemX, itemY, itemAmount, c.playerId, HIDE_TICKS, PlayerHandler.players[playerId].playerName);
    				addItem(item);
    			}
    Reply With Quote  
     

  4. #4  
    Owner of Ateria™
    Join Date
    Jul 2013
    Posts
    392
    Thanks given
    36
    Thanks received
    12
    Rep Power
    10
    Check your createGroundItem and send it me.
    Reply With Quote  
     

  5. #5  
    Donator

    Anthony's Avatar
    Join Date
    Dec 2007
    Age
    29
    Posts
    1,344
    Thanks given
    198
    Thanks received
    129
    Rep Power
    355
    Double Post - Sorry
    Reply With Quote  
     

  6. #6  
    Donator

    Anthony's Avatar
    Join Date
    Dec 2007
    Age
    29
    Posts
    1,344
    Thanks given
    198
    Thanks received
    129
    Rep Power
    355
    Quote Originally Posted by Yggexe View Post
    The reason it doesn't appear for other could be in your createGroundtem maybe?

    EDIT: probably something in this is wrong
    Code:
    if (!Item.isStackable(itemId) && itemAmount > 0) {
    				for (int j = 0; j < itemAmount; j++) {
    					c.getItems().createGroundItem(itemId, itemX, itemY, 1);
    					GroundItem item = new GroundItem(itemId, itemX, itemY, 1, c.playerId, HIDE_TICKS, PlayerHandler.players[playerId].playerName);
    					addItem(item);
    				}	
    			} else {
    				c.getItems().createGroundItem(itemId, itemX, itemY, itemAmount);
    				GroundItem item = new GroundItem(itemId, itemX, itemY, itemAmount, c.playerId, HIDE_TICKS, PlayerHandler.players[playerId].playerName);
    				addItem(item);
    			}
    Quote Originally Posted by NexusRS View Post
    Check your createGroundItem and send it me.
    Code:
    public void createGroundItem(Client c, int itemId, int itemX, int itemY, int itemAmount, int playerId) {
    if(itemId > 0) {
    if (itemId >= 2412 && itemId <= 2414) {
    c.sendMessage("The cape vanishes as it touches the ground.");
    return;
    }
    if (itemId > 4705 && itemId < 4760) {
    for (int j = 0; j < brokenBarrows.length; j++) {
    if (brokenBarrows[j][0] == itemId) {
    itemId = brokenBarrows[j][1];
    break;
    }
    }
    }
    if (!server.model.items.Item.itemStackable[itemId] && itemAmount > 0) {
    for (int j = 0; j < itemAmount; j++) {
    c.getItems().createGroundItem(itemId, itemX, itemY, 1);
    GroundItem item = new GroundItem(itemId, itemX, itemY, 1, c.playerId, HIDE_TICKS, Server.playerHandler.players[playerId].playerName);
    addItem(item);
    }	
    } else {
    c.getItems().createGroundItem(itemId, itemX, itemY, itemAmount);
    GroundItem item = new GroundItem(itemId, itemX, itemY, itemAmount, c.playerId, HIDE_TICKS, Server.playerHandler.players[playerId].playerName);
    addItem(item);
    }
    }
    }
    Reply With Quote  
     

  7. #7  
    Owner of Ateria™
    Join Date
    Jul 2013
    Posts
    392
    Thanks given
    36
    Thanks received
    12
    Rep Power
    10
    Nothing really looks wrong there. Have you made sure that when the item is dropped that it actually creates the ground item?
    Reply With Quote  
     

  8. #8  
    Donator

    Anthony's Avatar
    Join Date
    Dec 2007
    Age
    29
    Posts
    1,344
    Thanks given
    198
    Thanks received
    129
    Rep Power
    355
    Quote Originally Posted by NexusRS View Post
    Nothing really looks wrong there. Have you made sure that when the item is dropped that it actually creates the ground item?
    That's what I mean, I've never had the issue of it not being found here, so I have absolutely no idea where to look. I've read all of my dropitem and dropped items on ground codes and still can't figure this out.
    Reply With Quote  
     

  9. #9  
    Owner of Ateria™
    Join Date
    Jul 2013
    Posts
    392
    Thanks given
    36
    Thanks received
    12
    Rep Power
    10
    Hmm wierd, i've just always had myne as where the items disappear and it hasn't really affected me or the players but i suppose it's quite an important feature to add. Maybe it's just not added in Matrix as you can dupe etc via globalitems. If you figure anything out, i'd appreciate if you could send me a quick message so i could get this fixed too.

    Thanks.
    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. [508] Espeon drop items on death
    By Xeris in forum Help
    Replies: 3
    Last Post: 06-26-2011, 02:25 AM
  2. Cannot bank items in fullscreen
    By Hackur in forum Help
    Replies: 12
    Last Post: 01-19-2009, 04:28 AM
  3. Problem with dropped items
    By Kihomura in forum Help
    Replies: 1
    Last Post: 10-09-2008, 11:15 PM
  4. Fixing Death Dropping Items In Dodian Sources
    By Dynamik in forum Tutorials
    Replies: 6
    Last Post: 07-26-2008, 11:20 PM
  5. How to make npcs drop items
    By wowfreakjoking in forum Tutorials
    Replies: 5
    Last Post: 03-26-2008, 06:46 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
  •