public SkinToneDeedGump(SkinToneDeed dye) : base(0, 0) { m_SkinToneDeed = dye; AddPage(0); AddBackground(150, 60, 350, 358, 2600); AddBackground(170, 104, 110, 270, 5100); AddHtml(230, 75, 200, 20, @"Select a skin tone", false, false); AddHtml(235, 380, 300, 20, @"Change my skin tone", false, false); AddButton(200, 380, 0xFA5, 0xFA7, 1, GumpButtonType.Reply, 0); for (int i = 0; i < m_Entries.Length; ++i) { AddLabel(180, 109 + (i * 22), m_Entries[i].HueStart - 1, m_Entries[i].Name); AddButton(257, 110 + (i * 22), 5224, 5224, 0, GumpButtonType.Page, i + 1); } for (int i = 0; i < m_Entries.Length; ++i) { SkinToneDeedEntry e = m_Entries[i]; AddPage(i + 1); for (int j = 0; j < e.HueCount; ++j) { AddLabel(328 + ((j / 16) * 80), 102 + ((j % 16) * 17), e.HueStart + j - 1, "*****"); AddRadio(310 + ((j / 16) * 80), 102 + ((j % 16) * 17), 210, 211, false, (i * 100) + j); } } }
public override void OnResponse(NetState from, RelayInfo info) { if (m_SkinToneDeed.Deleted) { return; } Mobile m = from.Mobile; int[] switches = info.Switches; if (!m_SkinToneDeed.IsChildOf(m.Backpack)) { m.SendLocalizedMessage(1042010); //You must have the objectin your backpack to use it. return; } if (info.ButtonID != 0 && switches.Length > 0) { // To prevent this from being exploited, the hue is abstracted into an internal list int entryIndex = switches[0] / 100; int hueOffset = switches[0] % 100; if (entryIndex >= 0 && entryIndex < m_Entries.Length) { SkinToneDeedEntry e = m_Entries[entryIndex]; if (hueOffset >= 0 && hueOffset < e.HueCount) { int hue = e.HueStart + hueOffset; if (m != null) { m.Hue = hue | 0x8000; } m.SendMessage("You skin tone has changed."); m_SkinToneDeed.Delete(); m.PlaySound(0x4E); } } } }