public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            m_CustomizationEntries = new List <PlayerCustomizationEntry>();
            m_SpellHueEntries      = new List <SpellHueEntry>();

            if (version >= 0)
            {
                m_AccountUsername = reader.ReadString();

                int customizationEntries = reader.ReadInt();
                for (int a = 0; a < customizationEntries; a++)
                {
                    CustomizationType customizationType = (CustomizationType)reader.ReadInt();

                    bool unlocked = reader.ReadBool();
                    bool active   = reader.ReadBool();

                    m_CustomizationEntries.Add(new PlayerCustomizationEntry(customizationType, unlocked, active, true));
                }

                int spellHueEntries = reader.ReadInt();
                for (int a = 0; a < spellHueEntries; a++)
                {
                    HueableSpell spellHueType = (HueableSpell)reader.ReadInt();
                    SpellHueType activeType   = (SpellHueType)reader.ReadInt();

                    SpellHueEntry spellHueEntry = new SpellHueEntry(spellHueType, activeType);

                    int unlockedHueCount = reader.ReadInt();
                    for (int b = 0; b < unlockedHueCount; b++)
                    {
                        SpellHueType unlockedHue = (SpellHueType)reader.ReadInt();
                        spellHueEntry.m_UnlockedHues.Add(unlockedHue);
                    }

                    m_SpellHueEntries.Add(spellHueEntry);
                }
            }
        }
예제 #2
0
        public static SpellHueEntry GetSpellHueEntry(PlayerMobile player, SpellType spellType)
        {
            SpellHueEntry entry = null;

            if (player == null)
            {
                return(entry);
            }

            EnhancementsPersistance.CheckAndCreateEnhancementsAccountEntry(player);

            foreach (SpellHueEntry playerEntry in player.m_EnhancementsAccountEntry.m_SpellHues)
            {
                if (playerEntry.m_SpellType == spellType)
                {
                    return(playerEntry);
                }
            }

            return(entry);
        }
예제 #3
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            PlayerMobile player = sender.Mobile as PlayerMobile;

            if (player == null)
            {
                return;
            }
            if (player.Deleted)
            {
                return;
            }

            //Previous
            if (info.ButtonID == 1)
            {
                if (m_PageNumber > 1)
                {
                    m_PageNumber--;

                    player.SendSound(0x055);

                    player.CloseGump(typeof(PlayerSpellHuesGump));
                    player.SendGump(new PlayerSpellHuesGump(player, m_PageNumber));

                    return;
                }
            }

            //Next
            if (info.ButtonID == 2)
            {
                if (m_PageNumber < m_TotalPages)
                {
                    m_PageNumber++;

                    player.SendSound(0x055);

                    player.CloseGump(typeof(PlayerSpellHuesGump));
                    player.SendGump(new PlayerSpellHuesGump(player, m_PageNumber));

                    return;
                }
            }

            //Entries
            if (info.ButtonID > 2)
            {
                if (m_SpellsOnPage.Count == 0)
                {
                    return;
                }

                int totalHues = Enum.GetNames(typeof(SpellHueType)).Length;

                int baseIndex    = info.ButtonID - 3;
                int spellIndex   = (int)(Math.Floor((double)baseIndex / (double)totalHues));
                int hueTypeIndex = baseIndex - (spellIndex * totalHues);

                if (spellIndex > m_SpellsOnPage.Count || spellIndex < 0)
                {
                    player.SendMessage("Invalid selection.");
                    return;
                }

                if (spellIndex >= m_SpellsOnPage.Count)
                {
                    return;
                }

                HueableSpell hueableSpell = m_SpellsOnPage[spellIndex];

                if (hueTypeIndex >= totalHues || hueableSpell == null)
                {
                    return;
                }

                SpellHueType       spellHueType = (SpellHueType)hueTypeIndex;
                HueableSpellDetail spellDetail  = SpellHue.GetHueableSpellDetail(hueableSpell);
                SpellHueEntry      spellEntry   = PlayerEnhancementPersistance.GetSpellHueEntry(player, hueableSpell);

                if (spellDetail == null || spellEntry == null)
                {
                    return;
                }

                bool unlocked = false;
                bool active   = false;

                if (spellEntry.m_UnlockedHues.Contains(spellHueType))
                {
                    unlocked = true;
                }

                if (spellEntry.m_ActiveHue == spellHueType)
                {
                    active = true;
                }

                if (unlocked)
                {
                    if (active)
                    {
                        if (spellHueType == SpellHueType.Basic)
                        {
                            player.SendMessage("The standard hue for a spell cannot be deactivated.");
                        }

                        else
                        {
                            player.SendMessage("You disable the custom spell hue and activate the basic hue.");
                            spellEntry.m_ActiveHue = SpellHueType.Basic;

                            player.SendSound(0x1EC);
                        }
                    }

                    else
                    {
                        player.SendMessage("You activate the custom spell hue.");
                        spellEntry.m_ActiveHue = spellHueType;

                        player.SendSound(0x1EC);
                    }

                    player.CloseGump(typeof(PlayerSpellHuesGump));
                    player.SendGump(new PlayerSpellHuesGump(player, m_PageNumber));

                    return;
                }

                else
                {
                    player.SendMessage("You have not unlocked that hue for that spell. Spell Hue Deeds may be obtained from the Donation Shop or may be discovered out in the world.");

                    player.CloseGump(typeof(PlayerSpellHuesGump));
                    player.SendGump(new PlayerSpellHuesGump(player, m_PageNumber));

                    return;
                }
            }

            player.CloseGump(typeof(PlayerSpellHuesGump));
            player.SendGump(new PlayerEnhancementGump(player));

            return;
        }
예제 #4
0
        public PlayerSpellHuesGump(Mobile from, int pageNumber) : base(10, 10)
        {
            PlayerMobile player = from as PlayerMobile;

            if (player == null)
            {
                return;
            }

            m_Player     = player;
            m_PageNumber = pageNumber;

            Closable   = true;
            Disposable = true;
            Dragable   = true;
            Resizable  = false;

            AddImage(0, 44, 202);
            AddImage(44, 0, 201);
            AddImage(0, 0, 206);
            AddImage(0, 468, 204);
            AddImage(590, 1, 207);
            AddImage(590, 468, 205);
            AddImage(44, 468, 233);
            AddImage(590, 45, 203);
            AddImageTiled(44, 44, 546, 424, 200);
            AddImage(0, 152, 202);
            AddImage(163, 0, 201);
            AddImage(166, 468, 233);
            AddImage(590, 152, 203);

            //-------------
            int textHue = 2036;
            int boldHue = 149;

            int totalSpells = Enum.GetNames(typeof(HueableSpell)).Length;
            int totalHues   = Enum.GetNames(typeof(SpellHueType)).Length;

            int spellsPerPage = 3;

            m_TotalPages = (int)(Math.Ceiling((double)totalSpells / (double)spellsPerPage));

            int indexStart = (m_PageNumber - 1) * spellsPerPage;
            int indexEnd;

            if (indexStart + spellsPerPage <= totalSpells)
            {
                indexEnd = indexStart + spellsPerPage;
            }
            else
            {
                indexEnd = totalSpells;
            }

            var iStartY   = 50;
            var iSpacingY = 135;

            AddLabel(292, 20, 2606, "Spell Hues");

            int iRow = 0;

            //Entry
            for (int a = indexStart; a < indexEnd; a++)
            {
                HueableSpell       hueableSpell = (HueableSpell)a;
                HueableSpellDetail spellDetail  = SpellHue.GetHueableSpellDetail(hueableSpell);
                SpellHueEntry      spellEntry   = PlayerEnhancementPersistance.GetSpellHueEntry(player, hueableSpell);

                if (hueableSpell == null || spellDetail == null || spellEntry == null)
                {
                    return;
                }

                m_SpellsOnPage.Add(hueableSpell);

                AddLabel(320 - (spellDetail.m_SpellName.Length * 3), iStartY, boldHue, spellDetail.m_SpellName);

                for (int b = 0; b < totalHues; b++)
                {
                    SpellHueType       spellHueType       = (SpellHueType)b;
                    SpellHueTypeDetail spellHueTypeDetail = SpellHue.GetSpellHueTypeDetail(spellHueType);

                    AddItem((100 + (75 * b)), iStartY + 25, spellDetail.m_IconItemId, spellHueTypeDetail.m_DisplayHue);
                    AddLabel((120 + (75 * b)) - (spellHueTypeDetail.m_Name.Length * 3), iStartY + 75, textHue, spellHueTypeDetail.m_Name);

                    bool unlocked = false;
                    bool active   = false;

                    if (spellEntry.m_UnlockedHues.Contains(spellHueType))
                    {
                        unlocked = true;
                    }

                    if (spellEntry.m_ActiveHue == spellHueType)
                    {
                        active = true;
                    }

                    int buttonIndex = 3 + (iRow * totalHues) + b;

                    if (unlocked)
                    {
                        if (active)
                        {
                            AddButton(105 + (75 * b), iStartY + 100, 2154, 2151, buttonIndex, GumpButtonType.Reply, 0);
                        }
                        else
                        {
                            AddButton(105 + (75 * b), iStartY + 100, 2151, 2154, buttonIndex, GumpButtonType.Reply, 0);
                        }
                    }

                    else
                    {
                        AddButton(105 + (75 * b), iStartY + 100, 9727, 9727, buttonIndex, GumpButtonType.Reply, 0);
                    }
                }

                iStartY += iSpacingY;
                iRow++;
            }

            //Navigation
            if (m_PageNumber > 1)
            {
                AddButton(50, 465, 4014, 4016, 1, GumpButtonType.Reply, 0);
                AddLabel(85, 465, textHue, @"Previous Page");
            }

            if (m_PageNumber < m_TotalPages)
            {
                AddButton(485, 465, 4005, 4007, 2, GumpButtonType.Reply, 0);
                AddLabel(520, 465, textHue, @"Next Page");
            }
        }