public static void Destroy(Gump g) { if (g != null) { m_Invalidated = true; g.Children.Clear(); if (g == m_Drag) { m_Drag = null; } if (g == m_Capture) { m_Capture = null; } if (g == m_Focus) { m_Focus = null; } if (g == m_Modal) { m_Modal = null; } if (g == m_LastDragOver) { m_LastDragOver = null; } if (g == m_StartDrag) { m_StartDrag = null; } if (g == m_LastOver) { m_LastOver = null; } if (g == m_TextFocus) { m_TextFocus = null; } if ((g.m_Restore && (g.GUID != null)) && (g.GUID.Length > 0)) { m_ToRestore[g.GUID] = new Point(g.X, g.Y); } if (g.HasTag("Dispose")) { switch (((string) g.GetTag("Dispose"))) { case "Spellbook": { Item tag = (Item) g.GetTag("Container"); if (tag != null) { tag.OpenSB = false; } break; } case "Modal": m_Modal = null; break; } } g.m_Disposed = true; g.OnDispose(); if (g.Parent != null) { g.Parent.Children.Remove(g); } } }