Beispiel #1
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            int index = info.ButtonID - 1;

            if (index >= 0 && index < m_Entries.Length)
            {
                RangerFamiliarEntry entry = m_Entries[index];

                double lore   = m_From.Skills[SkillName.AnimalLore].Base;
                double taming = m_From.Skills[SkillName.AnimalTaming].Base;

                BaseCreature check = (BaseCreature)RangerFamiliarSpell.Table[m_From];

                if (check != null && !check.Deleted)
                {
                    m_From.SendLocalizedMessage(1061605);                       // You already have a familiar.
                }
                else if (lore < entry.ReqAnimalLore || taming < entry.ReqAnimalTaming)
                {
                    // That familiar requires ~1_NECROMANCY~ Necromancy and ~2_SPIRIT~ Spirit Speak.
                    m_From.SendMessage(String.Format("That familiar requires {0:F1} Animal Lore and {1:F1} Animal Taming.", entry.ReqAnimalLore, entry.ReqAnimalTaming));

                    m_From.CloseGump(typeof(RangerFamiliarGump));
                    m_From.SendGump(new RangerFamiliarGump(m_From, RangerFamiliarSpell.Entries));
                }
                else if (entry.Type == null)
                {
                    m_From.SendMessage("That familiar has not yet been defined.");

                    m_From.CloseGump(typeof(RangerFamiliarGump));
                    m_From.SendGump(new RangerFamiliarGump(m_From, RangerFamiliarSpell.Entries));
                }
                else
                {
                    try
                    {
                        BaseCreature bc = (BaseCreature)Activator.CreateInstance(entry.Type);

                        bc.Skills.MagicResist = m_From.Skills.MagicResist;

                        if (BaseCreature.Summon(bc, m_From, m_From.Location, -1, TimeSpan.FromDays(1.0)))
                        {
                            m_From.FixedParticles(0x3728, 1, 10, 9910, EffectLayer.Head);
                            bc.PlaySound(bc.GetIdleSound());
                            RangerFamiliarSpell.Table[m_From] = bc;
                        }
                    }
                    catch
                    {
                    }
                }
            }
            else
            {
                m_From.SendLocalizedMessage(1061825);                   // You decide not to summon a familiar.
            }
        }
Beispiel #2
0
        public RangerFamiliarGump( Mobile from, RangerFamiliarEntry[] entries )
            : base(200, 100)
        {
            m_From = from;
            m_Entries = entries;

            AddPage( 0 );

            AddBackground( 10, 10, 250, 178, 9270 );
            AddAlphaRegion( 20, 20, 230, 158 );

            AddImage( 220, 20, 10464 );
            AddImage( 220, 72, 10464 );
            AddImage( 220, 124, 10464 );

            AddItem( 188, 16, 6883 );
            AddItem( 198, 168, 6881 );
            AddItem( 8, 15, 6882 );
            AddItem( 2, 168, 6880 );

            AddHtmlLocalized( 30, 26, 200, 20, 1060147, EnabledColor16, false, false ); // Chose thy familiar...

            double lore = from.Skills[SkillName.AnimalLore].Base;
            double taming = from.Skills[SkillName.AnimalTaming].Base;

            for ( int i = 0; i < entries.Length; ++i )
            {
                object name = entries[i].Name;

                bool enabled = ( lore >= entries[i].ReqAnimalLore && taming >= entries[i].ReqAnimalTaming );

                AddButton( 27, 53 + (i * 21), 9702, 9703, i + 1, GumpButtonType.Reply, 0 );

                if ( name is int )
                    AddHtmlLocalized( 50, 51 + (i * 21), 150, 20, (int)name, enabled ? EnabledColor16 : DisabledColor16, false, false );
                else if ( name is string )
                    AddHtml( 50, 51 + (i * 21), 150, 20, String.Format( "<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", enabled ? EnabledColor32 : DisabledColor32, name ), false, false );
            }
        }