public override void OnResponse(NetState sender, RelayInfo info) { if (info.ButtonID <= 0) { return; // Canceled } int buttonID = info.ButtonID - 1; int type = buttonID % 7; int index = buttonID / 7; BuildSystem system = m_BuildSystem; BuildGroupCol groups = system.BuildGroups; BuildContext context = system.GetContext(m_From); switch (type) { case 0: // Show group { if (context == null) { break; } if (index >= 0 && index < groups.Count) { context.LastGroupIndex = index; m_From.SendGump(new BuildGump(m_From, system, m_Tool, null)); } break; } case 1: // Create item { if (context == null) { break; } int groupIndex = context.LastGroupIndex; if (groupIndex >= 0 && groupIndex < groups.Count) { BuildGroup group = groups.GetAt(groupIndex); if (index >= 0 && index < group.BuildItems.Count) { BuildItem(group.BuildItems.GetAt(index)); } } break; } case 2: // Item details { if (context == null) { break; } int groupIndex = context.LastGroupIndex; if (groupIndex >= 0 && groupIndex < groups.Count) { BuildGroup group = groups.GetAt(groupIndex); if (index >= 0 && index < group.BuildItems.Count) { m_From.SendGump(new BuildGumpItem(m_From, system, group.BuildItems.GetAt(index), m_Tool)); } } break; } case 3: // Create item (last 10) { if (context == null) { break; } ArrayList lastTen = context.Items; if (index >= 0 && index < lastTen.Count) { BuildItem((BuildItem)lastTen[index]); } break; } case 4: // Item details (last 10) { if (context == null) { break; } ArrayList lastTen = context.Items; if (index >= 0 && index < lastTen.Count) { m_From.SendGump(new BuildGumpItem(m_From, system, (BuildItem)lastTen[index], m_Tool)); } break; } case 5: // Resource selected { if (m_Page == BuildPage.PickResource && index >= 0 && index < system.BuildSubRes.Count) { int groupIndex = (context == null ? -1 : context.LastGroupIndex); BuildSubRes res = system.BuildSubRes.GetAt(index); if (LokaiSkillUtilities.XMLGetSkills(m_From)[system.MainLokaiSkill].Base < res.RequiredLokaiSkill) { m_From.SendGump(new BuildGump(m_From, system, m_Tool, res.Message)); } else { if (context != null) { context.LastResourceIndex = index; } m_From.SendGump(new BuildGump(m_From, system, m_Tool, null)); } } else if (m_Page == BuildPage.PickResource2 && index >= 0 && index < system.BuildSubRes2.Count) { int groupIndex = (context == null ? -1 : context.LastGroupIndex); BuildSubRes res = system.BuildSubRes2.GetAt(index); if (LokaiSkillUtilities.XMLGetSkills(m_From)[system.MainLokaiSkill].Base < res.RequiredLokaiSkill) { m_From.SendGump(new BuildGump(m_From, system, m_Tool, res.Message)); } else { if (context != null) { context.LastResourceIndex2 = index; } m_From.SendGump(new BuildGump(m_From, system, m_Tool, null)); } } break; } case 6: // Misc. buttons { switch (index) { case 0: // Resource selection { if (system.BuildSubRes.Init) { m_From.SendGump(new BuildGump(m_From, system, m_Tool, null, BuildPage.PickResource)); } break; } case 1: // Smelt item { if (system.Resmelt) { Resmelt.Do(m_From, system, m_Tool); } break; } case 2: // Make last { if (context == null) { break; } BuildItem item = context.LastMade; if (item != null) { BuildItem(item); } else { m_From.SendGump(new BuildGump(m_From, m_BuildSystem, m_Tool, 1044165, m_Page)); // You haven't made anything yet. } break; } case 3: // Last 10 { if (context == null) { break; } context.LastGroupIndex = 501; m_From.SendGump(new BuildGump(m_From, system, m_Tool, null)); break; } case 4: // Toggle use resource hue { if (context == null) { break; } context.DoNotColor = !context.DoNotColor; m_From.SendGump(new BuildGump(m_From, m_BuildSystem, m_Tool, null, m_Page)); break; } case 5: // Repair item { if (system.Repair) { Repair.Do(m_From, system, m_Tool); } break; } case 6: // Toggle mark option { if (context == null || !system.MarkOption) { break; } switch (context.MarkOption) { case BuildMarkOption.MarkItem: context.MarkOption = BuildMarkOption.DoNotMark; break; case BuildMarkOption.DoNotMark: context.MarkOption = BuildMarkOption.PromptForMark; break; case BuildMarkOption.PromptForMark: context.MarkOption = BuildMarkOption.MarkItem; break; } m_From.SendGump(new BuildGump(m_From, m_BuildSystem, m_Tool, null, m_Page)); break; } case 7: // Resource selection 2 { if (system.BuildSubRes2.Init) { m_From.SendGump(new BuildGump(m_From, system, m_Tool, null, BuildPage.PickResource2)); } break; } case 8: // Enhance item { if (system.CanEnhance) { Enhance.BeginTarget(m_From, system, m_Tool); } break; } } break; } } }