private bool PickupItemDirectly(Item item, int x, int y, int amount, Point?offset) { if (World.Player.IsDead || ItemHold.Enabled || item == null || item.IsDestroyed) { return(false); } if (amount <= 0) { amount = item.Amount; } ItemHold.Clear(); ItemHold.Set(item, (ushort)amount); NetClient.Socket.Send(new PPickUpRequest(item, (ushort)amount)); UIManager.GameCursor.SetDraggedItem(offset); if (!item.OnGround) { //Entity entity = World.Get(item.Container); //item.Container = Serial.INVALID; //entity.Items.Remove(item); //if (entity != null && entity.HasEquipment) // entity.FindItemByLayer( item.Layer] = null; //entity.Items.ProcessDelta(); } else { item.RemoveFromTile(); } item.TextContainer?.Clear(); //item.AllowedToDraw = false; //World.Items.Remove(item); //World.Items.ProcessDelta(); //CloseItemGumps(item); //World.RemoveItem(item.Serial, true); World.ObjectToRemove = item.Serial; return(true); }
private bool PickupItemDirectly(Item item, int x, int y, int amount, Point?offset) { if (World.Player.IsDead || ItemHold.Enabled || item == null || item.IsDestroyed /*|| (!ItemHold.Enabled && ItemHold.Dropped && ItemHold.Serial.IsValid)*/) { return(false); } ItemHold.Clear(); ItemHold.Set(item, amount <= 0 ? item.Amount : (ushort)amount); UIManager.GameCursor.SetDraggedItem(offset); if (!item.OnGround) { Entity entity = World.Get(item.Container); //item.Container = Serial.INVALID; //entity.Items.Remove(item); if (entity.HasEquipment) { entity.Equipment[(int)item.Layer] = null; } //entity.Items.ProcessDelta(); } else { item.RemoveFromTile(); } item.TextContainer?.Clear(); item.AllowedToDraw = false; //World.Items.Remove(item); //World.Items.ProcessDelta(); //CloseItemGumps(item); NetClient.Socket.Send(new PPickUpRequest(item, (ushort)amount)); return(true); }