예제 #1
0
        public TatooDyeGump(TatooDye dye)
            : base(50, 50)
        {
            m_TatooDye = dye;

            AddPage(0);

            AddBackground(100, 10, 350, 355, 2600);
            AddBackground(120, 54, 110, 270, 5100);

            AddHtml(70, 25, 400, 35, "<center>Menu de la sélection de la couleur du tatoo</center>", false, false);

            AddButton(149, 328, 4005, 4007, 1, GumpButtonType.Reply, 0);
            AddHtml(185, 329, 250, 35, "Teindre mon tatoo !", false, false);

            for (int i = 0; i < m_Entries.Length; ++i)
            {
                AddLabel(130, 59 + (i * 22), m_Entries[i].HueStart - 1, m_Entries[i].Name);
                AddButton(207, 60 + (i * 22), 5224, 5224, 0, GumpButtonType.Page, i + 1);
            }

            for (int i = 0; i < m_Entries.Length; ++i)
            {
                TatooDyeEntry e = m_Entries[i];

                AddPage(i + 1);

                for (int j = 0; j < e.HueCount; ++j)
                {
                    AddLabel(278 + ((j / 16) * 80), 52 + ((j % 16) * 17), e.HueStart + j - 1, "*****");
                    AddRadio(260 + ((j / 16) * 80), 52 + ((j % 16) * 17), 210, 211, false, (i * 100) + j);
                }
            }
        }
예제 #2
0
        public override void OnResponse(NetState from, RelayInfo info)
        {
            if (m_TatooDye.Deleted)
            {
                return;
            }

            Mobile m = from.Mobile;

            int[] switches = info.Switches;

            if (!m_TatooDye.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)
                {
                    TatooDyeEntry e = m_Entries[entryIndex];

                    if (hueOffset >= 0 && hueOffset < e.HueCount)
                    {
                        int hue = e.HueStart + hueOffset;

                        if (m.FindItemOnLayer(Layer.Tatoo) is GenericTatoo)
                        {
                            m.FindItemOnLayer(Layer.Tatoo).Hue = hue;
                            m.SendMessage("Vous teignez votre tatouage.");
                            m_TatooDye.Delete();
                            m.PlaySound(0x4E);
                        }
                        else
                        {
                            m.SendMessage("Vous n'avez pas de tatouage à teindre.");
                        }
                    }
                }
            }
            else
            {
                m.SendMessage("Vous décidez de ne pas teindre votre tatouage.");
            }
        }