public void DropItem(S.DropItem p) { MirItemCell cell = GetCell(Inventory.Cells, p.UniqueID) ?? GetCell(BeltCells, p.UniqueID); if (cell == null) { return; } cell.Locked = false; if (!p.Success) { return; } if (p.Count == cell.Item.Count) { cell.Item = null; } else { cell.Item.Count -= p.Count; } User.RefreshStats(); }
public static void DropItem(S.DropItem p) { GameManager.GameScene.DropItem(p); }
public void DropItem(ulong id, uint count) { S.DropItem p = new S.DropItem { UniqueID = id, Count = count, Success = false }; if (Dead) { Enqueue(p); return; } if (CurrentMap.Info.NoThrowItem) { ReceiveChat("You cannot drop items on this map", ChatType.System); Enqueue(p); return; } UserItem temp = null; int index = -1; for (int i = 0; i < Info.Inventory.Length; i++) { temp = Info.Inventory[i]; if (temp == null || temp.UniqueID != id) continue; index = i; break; } if (temp == null || index == -1 || count > temp.Count) { Enqueue(p); return; } if (temp.Info.Bind.HasFlag(BindMode.DontDrop)) { Enqueue(p); return; } if (temp.Count == count) { if (!temp.Info.Bind.HasFlag(BindMode.DestroyOnDrop)) if (!DropItem(temp)) { Enqueue(p); return; } Info.Inventory[index] = null; } else { UserItem temp2 = Envir.CreateFreshItem(temp.Info); temp2.Count = count; if (!temp.Info.Bind.HasFlag(BindMode.DestroyOnDrop)) if (!DropItem(temp2)) { Enqueue(p); return; } temp.Count -= count; } p.Success = true; Enqueue(p); RefreshBagWeight(); Report.ItemChanged("DropItem", temp, count, 1); }
public void DropItem(ulong id, uint count) { S.DropItem p = new S.DropItem { UniqueID = id, Count = count, Success = false }; if (Dead) { Enqueue(p); return; } UserItem temp = null; int index = -1; for (int i = 0; i < Info.Inventory.Length; i++) { temp = Info.Inventory[i]; if (temp == null || temp.UniqueID != id) continue; index = i; break; } if (temp == null || index == -1 || count > temp.Count) { Enqueue(p); return; } if (temp.Count == count) { if (!DropItem(temp)) { Enqueue(p); return; } Info.Inventory[index] = null; } else { UserItem temp2 = Envir.CreateFreshItem(temp.Info); temp2.Count = count; if (!DropItem(temp2)) { Enqueue(p); return; } temp.Count -= count; } p.Success = true; Enqueue(p); RefreshBagWeight(); }