Exemple #1
0
            public override void OnResponse(NetState sender, RelayInfo info)
            {
                Mobile from = sender.Mobile;

                if (from.Backpack != null && info.ButtonID >= 100 && info.ButtonID <= 110 && m_Spell.CheckSequence())
                {
                    Item[] stones = from.Backpack.FindItemsByType(typeof(SpellStone));

                    for (int i = 0; i < stones.Length; i++)
                    {
                        stones[i].Delete();
                    }

                    SpellTriggerDef entry = m_Definitions[info.ButtonID - 100];

                    if (m_Skill >= (entry.Rank * 40))
                    {
                        from.PlaySound(0x659);
                        from.PlaceInBackpack(new SpellStone(entry));

                        from.SendLocalizedMessage(1080165); // A Spell Stone appears in your backpack
                    }
                }

                m_Spell.FinishSequence();
            }
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 1:
                    {
                        int spellId = reader.ReadInt();

                        for ( int i = 0; i < SpellTriggerSpell.Definitions.Length; i++ )
                        {
                            SpellTriggerDef def = SpellTriggerSpell.Definitions[i];

                            if ( def.SpellId == spellId )
                            {
                                m_SpellDef = def;
                                break;
                            }
                        }

                        if ( m_SpellDef == null )
                            Delete();

                        break;
                    }
                case 0:
                    {
                        Delete();
                        break;
                    }
            }
        }
        public SpellStone( SpellTriggerDef spellDef )
            : base(spellDef.SpellId, 0x4079, 1)
        {
            m_SpellDef = spellDef;

            LootType = LootType.Blessed;
        }
Exemple #4
0
        public SpellStone(SpellTriggerDef spellDef)
            : base(spellDef.SpellId, 0x4079, 1)
        {
            m_SpellDef = spellDef;

            LootType = LootType.Blessed;
        }
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                int spellId = reader.ReadInt();

                for (int i = 0; i < SpellTriggerSpell.Definitions.Length; i++)
                {
                    SpellTriggerDef def = SpellTriggerSpell.Definitions[i];

                    if (def.SpellId == spellId)
                    {
                        m_SpellDef = def;
                        break;
                    }
                }

                if (m_SpellDef == null)
                {
                    Delete();
                }

                break;
            }

            case 0:
            {
                Delete();
                break;
            }
            }
        }
            public SpellTriggerGump(Spell spell, Mobile m)
                : base(60, 36)
            {
                m_Spell = spell;

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

                AddPage(0);

                AddBackground(0, 0, 520, 404, 0x13BE);

                AddImageTiled(10, 10, 500, 20, 0xA40);
                AddImageTiled(10, 40, 500, 324, 0xA40);
                AddImageTiled(10, 374, 500, 20, 0xA40);
                AddAlphaRegion(10, 10, 500, 384);

                AddButton(10, 374, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0);
                AddHtmlLocalized(45, 376, 450, 20, 1060051, 0x7FFF, false, false); // CANCEL

                AddHtmlLocalized(14, 12, 500, 20, 1080151, 0x7FFF, false, false);  // <center>Spell Trigger Selection Menu</center>

                AddPage(1);

                m_Skill = (int)(GetBaseSkill(m) + GetBoostSkill(m));
                int idx = 0;

                for (int i = 0; i < m_Definitions.Length; i++)
                {
                    SpellTriggerDef entry = m_Definitions[i];

                    if (m_Skill >= (entry.Rank * 40))
                    {
                        idx++;

                        if (idx == 11)
                        {
                            AddButton(400, 374, 0xFA5, 0xFA7, 0, GumpButtonType.Page, 2);
                            AddHtmlLocalized(440, 376, 60, 20, 1043353, 0x7FFF, false, false); // Next

                            AddPage(2);

                            AddButton(300, 374, 0xFAE, 0xFB0, 0, GumpButtonType.Page, 1);
                            AddHtmlLocalized(340, 376, 60, 20, 1011393, 0x7FFF, false, false); // Back

                            idx = 1;
                        }

                        if ((idx % 2) != 0)
                        {
                            AddImageTiledButton(14, 44 + (64 * (idx - 1) / 2), 0x918, 0x919, 100 + i, GumpButtonType.Reply, 0, entry.ItemId, 0, 15, 20);
                            AddTooltip(entry.Tooltip);
                            AddHtmlLocalized(98, 44 + (64 * (idx - 1) / 2), 170, 60, entry.Cliloc, 0x7FFF, false, false);
                        }
                        else
                        {
                            AddImageTiledButton(264, 44 + (64 * (idx - 2) / 2), 0x918, 0x919, 100 + i, GumpButtonType.Reply, 0, entry.ItemId, 0, 15, 20);
                            AddTooltip(entry.Tooltip);
                            AddHtmlLocalized(348, 44 + (64 * (idx - 2) / 2), 170, 60, entry.Cliloc, 0x7FFF, false, false);
                        }
                    }
                    else
                    {
                        break;
                    }
                }
            }