private static void IncomingPackets_ContainerContentsEvent(int client, ItemCollection container) { Item i; if (ClientInfoCollection.GetItem(client, container.Serial, out i)) { i.Container = container; } else { Item newItem = new Item(container.Serial); newItem.Container = container; ClientInfoCollection.AddItem(client, newItem); } }
private static void OutgoingPackets_UseItemRequestedEvent(int client, int serial) { ClientInfo ci; if (!ClientInfoCollection.GetClient(client, out ci)) { return; } if ((serial & ~0x7FFFFFFF) != 0) { serial ^= ~0x7FFFFFFF; if (ci.Player.Serial == serial) { TreeViewUpdater.UpdateLastObject(ci.ProcessID, (WorldItem)ci.Player); return; } } if (UOMath.IsMobile(serial)) { Mobile m; if (ClientInfoCollection.GetMobile(client, serial, out m)) { TreeViewUpdater.UpdateLastObject(ci.ProcessID, (WorldItem)m); } else { Mobile newMobile = new Mobile(serial, client); newMobile.myName = "This mobile not found!"; TreeViewUpdater.UpdateLastObject(ci.ProcessID, (WorldItem)newMobile); } } else { Item i; if (ClientInfoCollection.GetItem(client, serial, out i)) { TreeViewUpdater.UpdateLastObject(ci.ProcessID, (WorldItem)i); } else { Item newItem = new Item(serial); newItem.Name = "This item not found!"; TreeViewUpdater.UpdateLastObject(ci.ProcessID, (WorldItem)newItem); } } }
/// <summary> /// Get item from specified client. /// </summary> /// <param name="client">Target client.</param> /// <param name="serial">Serial of item to retrieve.</param> /// <param name="item">Item (out).</param> /// <returns>True on success.</returns> public static bool GetItem(int client, int serial, out Item item) { return(ClientInfoCollection.GetItem(client, serial, out item)); }