Пример #1
0
        public override void OnDoubleClick(Mobile from)
        {
            base.OnDoubleClick(from);

            PlayerMobile player = from as PlayerMobile;

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

            if (!IsChildOf(player.Backpack))
            {
                player.SendMessage("That must be in your pack in order to use it.");
                return;
            }

            EnhancementsPersistance.CheckAndCreateEnhancementsAccountEntry(player);

            Enhancements.SpellHueEntry entry = Enhancements.GetSpellHueEntry(player, m_SpellType);

            Enhancements.SpellTypeDetail    spellTypeDetail    = Enhancements.GetSpellTypeDetail(m_SpellType);
            Enhancements.SpellHueTypeDetail spellHueTypeDetail = Enhancements.GetSpellHueTypeDetail(m_SpellHueType);

            if (entry == null)
            {
                entry = new Enhancements.SpellHueEntry(m_SpellType);
                entry.m_UnlockedHues.Add(m_SpellHueType);

                player.m_EnhancementsAccountEntry.m_SpellHues.Add(entry);

                player.SendMessage("You unlock [" + spellTypeDetail.m_SpellName + ": " + spellHueTypeDetail.m_SpellHueTypeName + " - Hue " + spellHueTypeDetail.m_SpellHue.ToString() + "] on your account.");
                player.PlaySound(0x5C9);

                Delete();
            }

            else
            {
                bool foundHue = false;

                foreach (Enhancements.SpellHueType spellHueType in entry.m_UnlockedHues)
                {
                    if (spellHueType == null)
                    {
                        continue;
                    }

                    if (spellHueType == m_SpellHueType)
                    {
                        foundHue = true;
                    }
                }

                if (foundHue)
                {
                    player.SendMessage("You have already unlocked that hue for that particular spell.");
                }

                else
                {
                    entry.m_UnlockedHues.Add(m_SpellHueType);

                    player.SendMessage("You unlock [" + spellTypeDetail.m_SpellName + ": " + spellHueTypeDetail.m_SpellHueTypeName + " - Hue " + spellHueTypeDetail.m_SpellHue.ToString() + "] on your account.");
                    player.PlaySound(0x5C9);

                    Delete();
                }
            }
        }