Thread: dropItem method help?

Results 1 to 3 of 3
  1. #1 dropItem method help? 
    :doge:

    Join Date
    Jan 2009
    Posts
    3,758
    Thanks given
    221
    Thanks received
    817
    Rep Power
    2116
    my source didn't have item dropping, when u dropped the item, it just deleted it. i made it so when you drop items show on the ground. i can't pick them up though? my method is the following:

    Code:
    public void dropItem(int droppedItem, int slot) {
    		// misc.printlnTag("droppeditem ["+playerItems[slot]+"] which is
    		// ["+(droppedItem+1)+"]");
    		boolean a = true;
    
    if(playerName == null)
    return;
    if(droppedItem == 4045 && !isInJail()){
    deleteItem(4045, 1);
    dealDamage(15);
    hitDiff = 15;
    plrText = "Ouch!";
    plrTextUpdateRequired = true;
    updateRequired = true;
    hitUpdateRequired = true;
    setAnimation(827);
    return;
    }
    		if ((playerItemsN[slot] != 0) && (droppedItem != -1)
    				&& (playerItems[slot] == droppedItem + 1)) {
    			for (int element : noTrade) {
    }
            if(destroyItem(droppedItem)) {
                outStream.createFrameVarSizeWord(34);
                outStream.writeWord(14171);
                outStream.writeByte( 0);
                outStream.writeWord(droppedItem + 1);
                outStream.writeByte(255);
                outStream.writeDWord(1);
                outStream.endFrameVarSizeWord();
                sendFrame126("Are you sure you want to destroy this object?", 14174);
                sendFrame126("Yes.", 14175);
                sendFrame126("No.", 141756);
                sendFrame126(""+GetItemName(droppedItem), 14184);
                sendFrame126(getMessageA(droppedItem),14182);
                sendFrame126(getMessageB(droppedItem),14183);
                sendFrame164(14170);
                publicDroppendItem = droppedItem;
    	    return;
    	    }
    			createGroundItem(droppedItem, absX, absY, playerItemsN[slot]);
    			deleteItem(droppedItem, slot, playerItemsN[slot]);
    			updateRequired = true;
    			savegame(false);
    		}
    Reply With Quote  
     

  2. #2  
    Registered Member

    Join Date
    Sep 2008
    Posts
    2,219
    Thanks given
    148
    Thanks received
    204
    Rep Power
    1570
    You have to go into your packets (236) and replace it with this:
    Code:
    case 236: //pickup item
    	int itemY = inStream.readSignedWordBigEndian();
    	int itemID = inStream.readUnsignedWord();
    	int itemX = inStream.readSignedWordBigEndian();
    	if (System.currentTimeMillis() - lastButton > 800) {
    		lastButton = System.currentTimeMillis();
    	} else {
    		break;
    	}
    	apickupid = itemID;
    	apickupx = itemX;
    	apickupy = itemY;
    	break;
    And replace your dropItem method with this:
    Code:
    public void dropItem(int droppedItem, int slot) {
    	boolean a = true;
    	if (playerName == null) {
    		return;
    	}
    	if (droppedItem == 4045 && !isInJail()) {
    		deleteItem(4045, 1);
    		dealDamage(15);
    		hitDiff = 15;
    		plrText = "Ouch!";
    		plrTextUpdateRequired = true;
    		updateRequired = true;
    		hitUpdateRequired = true;
    		setAnimation(827);
    		return;
    	}
    	if (playerItemsN[slot] != 0 && droppedItem != -1 && playerItems[slot] == droppedItem + 1) {
            	if (destroyItem(droppedItem)) {
              	  	outStream.createFrameVarSizeWord(34);
                		outStream.writeWord(14171);
                		outStream.writeByte( 0);
                		outStream.writeWord(droppedItem + 1);
                		outStream.writeByte(255);
                		outStream.writeDWord(1);
                		outStream.endFrameVarSizeWord();
                		sendFrame126("Are you sure you want to destroy this object?", 14174);
                		sendFrame126("Yes", 14175);
                		sendFrame126("No", 141756);
                		sendFrame126(""+GetItemName(droppedItem), 14184);
                		sendFrame126(getMessageA(droppedItem),14182);
                		sendFrame126(getMessageB(droppedItem),14183);
                		sendFrame164(14170);
                		publicDroppendItem = droppedItem;
    	    		return;
    	    	}
    		createGroundItem(droppedItem, absX, absY, playerItemsN[slot]);
    		deleteItem(droppedItem, slot, playerItemsN[slot]);
    		updateRequired = true;
    		savegame(false);
    	}
    }



    Reply With Quote  
     

  3. #3  
    :doge:

    Join Date
    Jan 2009
    Posts
    3,758
    Thanks given
    221
    Thanks received
    817
    Rep Power
    2116
    didnt work ;s
    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

Tags for this Thread

View Tag Cloud

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •