private void _handleItemAdd(Packet pkt) { if (OnDropItem == null) return; MapItem item = new MapItem { id = pkt.GetShort(), uid = pkt.GetShort(), amount = pkt.GetThree(), x = pkt.GetChar(), y = pkt.GetChar(), time = DateTime.Now, npcDrop = false, playerID = -1 //another player dropped. drop protection says "Item protected" w/o player name }; OnDropItem(-1, 0, 0, item); }
private void _handleItemDrop(Packet pkt) { if (OnDropItem == null) return; short _id = pkt.GetShort(); int _amount = pkt.GetThree(); int characterAmount = pkt.GetInt(); //amount remaining for the character MapItem item = new MapItem { id = _id, amount = _amount, uid = pkt.GetShort(), x = pkt.GetChar(), y = pkt.GetChar(), //turn off drop protection since main player dropped it time = DateTime.Now.AddSeconds(-5), npcDrop = false, playerID = 0 //id of 0 means the currently logged in player owns it }; byte characterWeight = pkt.GetChar(), characterMaxWeight = pkt.GetChar(); //character adjusted weights OnDropItem(characterAmount, characterWeight, characterMaxWeight, item); }