public static Item CopyItem(Item copy) { try { Type t = copy.GetType(); ConstructorInfo c = t.GetConstructor(Type.EmptyTypes); if (c != null) { object o = c.Invoke(null); if (o != null && o is Item) { Item newItem = (Item)o; CopyProps(newItem, copy); if (copy is Container && newItem is Container) { Container newContainer = copy as Container; List <Item> items = copy.Items; newItem.Items.Clear(); /*newItem.SetTotalGold(0); * newItem.SetTotalItems(0); * newItem.SetTotalWeight(0);*/ for (int j = 0; j < items.Count; ++j) { Item item = items[j] as Item; Item it = CopyItem(item); if (it != null) { newItem.AddItem(it); } } } newItem.Parent = null; return(newItem); } } } catch (Exception e) { Misc.ExceptionLogging.WriteLine(e); } return(null); }