public static void DisplayGumpResponse(NetState state, PacketReader pvSrc) { int serial = pvSrc.ReadInt32(); int typeID = pvSrc.ReadInt32(); int buttonID = pvSrc.ReadInt32(); List <Gump> gumps = (List <Gump>)state.Gumps; for (int i = 0; i < gumps.Count; ++i) { Gump gump = gumps[i]; if (gump.Serial == serial && gump.TypeID == typeID) { int switchCount = pvSrc.ReadInt32(); if (switchCount < 0) { Console.WriteLine("Client: {0}: Invalid gump response, disconnecting...", state); state.Dispose(); return; } int[] switches = new int[switchCount]; for (int j = 0; j < switches.Length; ++j) { switches[j] = pvSrc.ReadInt32(); } int textCount = pvSrc.ReadInt32(); if (textCount < 0) { Console.WriteLine("Client: {0}: Invalid gump response, disconnecting...", state); state.Dispose(); return; } TextRelay[] textEntries = new TextRelay[textCount]; for (int j = 0; j < textEntries.Length; ++j) { int entryID = pvSrc.ReadUInt16(); int textLength = pvSrc.ReadUInt16(); if (textLength > 239) { return; } string text = pvSrc.ReadUnicodeStringSafe(textLength); textEntries[j] = new TextRelay(entryID, text); } state.RemoveGump(i); if (!CheckResponse(gump, state.Mobile, buttonID)) { return; } gump.OnResponse(state, new RelayInfo(buttonID, switches, textEntries)); return; } } if (typeID == 461) // Virtue gump { int switchCount = pvSrc.ReadInt32(); if (buttonID == 1 && switchCount > 0) { Mobile beheld = World.FindMobile(pvSrc.ReadInt32()); if (beheld != null) { EventSink.InvokeVirtueGumpRequest(new VirtueGumpRequestEventArgs(state.Mobile, beheld)); } } else { Mobile beheld = World.FindMobile(serial); if (beheld != null) { EventSink.InvokeVirtueItemRequest(new VirtueItemRequestEventArgs(state.Mobile, beheld, buttonID)); } } } }