Example #1
0
        public SpellHueEntry(HueableSpell hueableSpell, SpellHueType activeHue)
        {
            m_HueableSpell = hueableSpell;
            m_ActiveHue    = activeHue;

            m_UnlockedHues.Add(SpellHueType.Basic);
        }
        public void AuditSpellHueEntries()
        {
            List <HueableSpell> m_SpellHuesToAdd = new List <HueableSpell>();

            int spellHuesCount = Enum.GetNames(typeof(HueableSpell)).Length;

            for (int a = 0; a < spellHuesCount; a++)
            {
                HueableSpell hueableSpell = (HueableSpell)a;

                bool foundSpellHueEntry = false;

                foreach (SpellHueEntry entry in m_SpellHueEntries)
                {
                    if (entry.m_HueableSpell == hueableSpell)
                    {
                        foundSpellHueEntry = true;
                        break;
                    }
                }

                if (!foundSpellHueEntry)
                {
                    m_SpellHuesToAdd.Add(hueableSpell);
                }
            }

            foreach (HueableSpell hueableSpell in m_SpellHuesToAdd)
            {
                m_SpellHueEntries.Add(new SpellHueEntry(hueableSpell, SpellHueType.Basic));
            }
        }
        public static int GetSpellHueFor(Mobile mobile, HueableSpell hueableSpell)
        {
            int hue = 0;

            BaseCreature bc_Creature = mobile as BaseCreature;

            if (bc_Creature != null)
            {
                return(bc_Creature.SpellHue);
            }

            PlayerMobile player = mobile as PlayerMobile;

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

            SpellHueEntry entry = GetSpellHueEntry(player, hueableSpell);

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

            return(SpellHue.GetSpellHue(entry.m_ActiveHue));
        }
        public static SpellHueEntry GetSpellHueEntry(PlayerMobile player, HueableSpell hueableSpell)
        {
            SpellHueEntry spellHueEntry = null;

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

            if (player.m_PlayerEnhancementAccountEntry == null)
            {
                return(spellHueEntry);
            }

            foreach (SpellHueEntry entry in player.m_PlayerEnhancementAccountEntry.m_SpellHueEntries)
            {
                if (entry.m_HueableSpell == hueableSpell)
                {
                    spellHueEntry = entry;
                    break;
                }
            }

            return(spellHueEntry);
        }
Example #5
0
        public static HueableSpell GetRandomHueableSpell()
        {
            int spellCount = Enum.GetNames(typeof(HueableSpell)).Length;

            HueableSpell hueableSpell = (HueableSpell)Utility.RandomMinMax(0, spellCount - 1);

            return(hueableSpell);
        }
Example #6
0
        public SpellHueDeed(HueableSpell hueableSpell, SpellHueType spellHueType) : this()
        {
            Name   = "a spell hue deed:";
            Weight = 0.1;

            Hue = 2620;

            m_HueableSpell = hueableSpell;
            m_HueType      = spellHueType;
        }
Example #7
0
        public SpellHueDeed(SpellHueType spellHueType) : this()
        {
            Name   = "a spell hue deed";
            Weight = 0.1;

            Hue = 2620;

            m_HueableSpell = SpellHue.GetRandomHueableSpell();
            m_HueType      = spellHueType;
        }
Example #8
0
        public SpellHueDeed(HueableSpell hueableSpell) : this()
        {
            Name   = "a spell hue deed";
            Weight = 0.1;

            Hue = 2620;

            m_HueableSpell = hueableSpell;
            m_HueType      = SpellHue.GetRandomSpellHue();
        }
Example #9
0
        public SpellHueDeed() : base(0x14F0)
        {
            Name   = "a spell hue deed";
            Weight = 0.1;

            Hue = 2620;

            m_HueableSpell = SpellHue.GetRandomHueableSpell();
            m_HueType      = SpellHue.GetRandomSpellHue();
        }
Example #10
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            if (version >= 0)
            {
                m_HueableSpell = (HueableSpell)reader.ReadInt();
                m_HueType      = (SpellHueType)reader.ReadInt();
            }
        }
        public void AddSpellHueEntries()
        {
            int spellHueCount = Enum.GetNames(typeof(HueableSpell)).Length;

            for (int a = 0; a < spellHueCount; a++)
            {
                HueableSpell  hueableSpell = (HueableSpell)a;
                SpellHueEntry newEntry     = new SpellHueEntry(hueableSpell, SpellHueType.Basic);

                m_SpellHueEntries.Add(newEntry);
            }
        }
        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);
                }
            }
        }
Example #13
0
        public static HueableSpellDetail GetHueableSpellDetail(HueableSpell hueableSpell)
        {
            HueableSpellDetail hueableSpellDetail = new HueableSpellDetail();

            switch (hueableSpell)
            {
            case HueableSpell.MagicArrow:
                hueableSpellDetail.m_SpellName  = "Magic Arrow";
                hueableSpellDetail.m_IconItemId = 8324;
                break;

            /*
             * case HueableSpell.Heal:
             * hueableSpellDetail.m_SpellName = "Heal";
             * hueableSpellDetail.m_IconItemId = 8323;
             * break;
             */

            case HueableSpell.Clumsy:
                hueableSpellDetail.m_SpellName  = "Clumsy";
                hueableSpellDetail.m_IconItemId = 8320;
                break;

            case HueableSpell.Feeblemind:
                hueableSpellDetail.m_SpellName  = "Feeblemind";
                hueableSpellDetail.m_IconItemId = 8322;
                break;

            case HueableSpell.Weaken:
                hueableSpellDetail.m_SpellName  = "Weaken";
                hueableSpellDetail.m_IconItemId = 8327;
                break;

            case HueableSpell.ReactiveArmor:
                hueableSpellDetail.m_SpellName  = "Reactive Armor";
                hueableSpellDetail.m_IconItemId = 8326;
                break;

            case HueableSpell.Harm:
                hueableSpellDetail.m_SpellName  = "Harm";
                hueableSpellDetail.m_IconItemId = 8331;
                break;

            case HueableSpell.Cure:
                hueableSpellDetail.m_SpellName  = "Cure";
                hueableSpellDetail.m_IconItemId = 8330;
                break;

            /*
             * case HueableSpell.MagicTrap:
             * hueableSpellDetail.m_SpellName = "Magic Trap";
             * hueableSpellDetail.m_IconItemId = 8332;
             * break;
             */

            case HueableSpell.Protection:
                hueableSpellDetail.m_SpellName  = "Protection";
                hueableSpellDetail.m_IconItemId = 8334;
                break;

            case HueableSpell.Fireball:
                hueableSpellDetail.m_SpellName  = "Fireball";
                hueableSpellDetail.m_IconItemId = 8337;
                break;

            case HueableSpell.Bless:
                hueableSpellDetail.m_SpellName  = "Bless";
                hueableSpellDetail.m_IconItemId = 8336;
                break;

            case HueableSpell.WallOfStone:
                hueableSpellDetail.m_SpellName  = "Wall of Stone";
                hueableSpellDetail.m_IconItemId = 8343;
                break;

            case HueableSpell.Teleport:
                hueableSpellDetail.m_SpellName  = "Teleport";
                hueableSpellDetail.m_IconItemId = 8341;
                break;

            case HueableSpell.ArchCure:
                hueableSpellDetail.m_SpellName  = "Arch Cure";
                hueableSpellDetail.m_IconItemId = 8344;
                break;

            case HueableSpell.ArchProtection:
                hueableSpellDetail.m_SpellName  = "Arch Protection";
                hueableSpellDetail.m_IconItemId = 8345;
                break;

            case HueableSpell.Curse:
                hueableSpellDetail.m_SpellName  = "Curse";
                hueableSpellDetail.m_IconItemId = 8346;
                break;

            /*
             * case HueableSpell.GreaterHeal:
             * hueableSpellDetail.m_SpellName = "Greater Heal";
             * hueableSpellDetail.m_IconItemId = 8348;
             * break;
             */

            case HueableSpell.BladeSpirits:
                hueableSpellDetail.m_SpellName  = "Blade Spirits";
                hueableSpellDetail.m_IconItemId = 8352;
                break;

            case HueableSpell.MagicReflect:
                hueableSpellDetail.m_SpellName  = "Magic Reflect";
                hueableSpellDetail.m_IconItemId = 8355;
                break;

            case HueableSpell.MindBlast:
                hueableSpellDetail.m_SpellName  = "Mindblast";
                hueableSpellDetail.m_IconItemId = 8356;
                break;

            /*
             * case HueableSpell.Paralyze:
             * hueableSpellDetail.m_SpellName = "Paralyze";
             * hueableSpellDetail.m_IconItemId = 8357;
             * break;
             */

            case HueableSpell.SummonCreature:
                hueableSpellDetail.m_SpellName  = "Summon Creature";
                hueableSpellDetail.m_IconItemId = 8359;
                break;

            case HueableSpell.Dispel:
                hueableSpellDetail.m_SpellName  = "Dispel";
                hueableSpellDetail.m_IconItemId = 8360;
                break;

            case HueableSpell.EnergyBolt:
                hueableSpellDetail.m_SpellName  = "Energy Bolt";
                hueableSpellDetail.m_IconItemId = 8361;
                break;

            case HueableSpell.Explosion:
                hueableSpellDetail.m_SpellName  = "Explosion";
                hueableSpellDetail.m_IconItemId = 8362;
                break;

            /*
             * case HueableSpell.Invisibility:
             * hueableSpellDetail.m_SpellName = "Invisibility";
             * hueableSpellDetail.m_IconItemId = 8363;
             * break;
             */

            /*
             * case HueableSpell.Mark:
             * hueableSpellDetail.m_SpellName = "Mark";
             * hueableSpellDetail.m_IconItemId = 8364;
             * break;
             */

            case HueableSpell.MassCurse:
                hueableSpellDetail.m_SpellName  = "Mass Curse";
                hueableSpellDetail.m_IconItemId = 8365;
                break;

            case HueableSpell.ParalyzeField:
                hueableSpellDetail.m_SpellName  = "Paralyze Field";
                hueableSpellDetail.m_IconItemId = 8366;
                break;

            /*
             * case HueableSpell.Reveal:
             * hueableSpellDetail.m_SpellName = "Reveal";
             * hueableSpellDetail.m_IconItemId = 8367;
             * break;
             */

            case HueableSpell.EnergyField:
                hueableSpellDetail.m_SpellName  = "Energy Field";
                hueableSpellDetail.m_IconItemId = 8369;
                break;

            case HueableSpell.Flamestrike:
                hueableSpellDetail.m_SpellName  = "Flamestrike";
                hueableSpellDetail.m_IconItemId = 8370;
                break;

            case HueableSpell.MassDispel:
                hueableSpellDetail.m_SpellName  = "Mass Dispel";
                hueableSpellDetail.m_IconItemId = 8373;
                break;

            case HueableSpell.MeteorSwarm:
                hueableSpellDetail.m_SpellName  = "Meteor Swarm";
                hueableSpellDetail.m_IconItemId = 8374;
                break;

            case HueableSpell.AirElemental:
                hueableSpellDetail.m_SpellName  = "Air Elemental";
                hueableSpellDetail.m_IconItemId = 8379;
                break;

            case HueableSpell.EarthElemental:
                hueableSpellDetail.m_SpellName  = "Earth Elemental";
                hueableSpellDetail.m_IconItemId = 8381;
                break;

            case HueableSpell.FireElemental:
                hueableSpellDetail.m_SpellName  = "Fire Elemental";
                hueableSpellDetail.m_IconItemId = 8382;
                break;

            case HueableSpell.WaterElemental:
                hueableSpellDetail.m_SpellName  = "Water Elemental";
                hueableSpellDetail.m_IconItemId = 8383;
                break;

            case HueableSpell.SummonDaemon:
                hueableSpellDetail.m_SpellName  = "Summon Daemon";
                hueableSpellDetail.m_IconItemId = 8380;
                break;

            case HueableSpell.EnergyVortex:
                hueableSpellDetail.m_SpellName  = "Energy Vortex";
                hueableSpellDetail.m_IconItemId = 8377;
                break;

                /*
                 * case HueableSpell.Resurrection:
                 * hueableSpellDetail.m_SpellName = "Resurrection";
                 * hueableSpellDetail.m_IconItemId = 8378;
                 * break;
                 */
            }

            return(hueableSpellDetail);
        }
        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;
        }
        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");
            }
        }