Пример #1
0
        public void OnTalk(PlayerMobile pm, DesireInfo info)
        {
            if (pm.Backpack == null)
            {
                return;                 // sanity
            }
            Item desired = pm.Backpack.FindItemByType(info.Desire.Type);

            if (desired != null)
            {
                Item toGive = Activator.CreateInstance(info.Gift.Type) as Item;

                if (toGive != null)
                {
                    desired.Delete();
                    pm.Backpack.DropItem(toGive);

                    info.GiftGiven = true;

                    SayThanks(info.Desire.Name, info.Gift.Name);
                }
            }
            else
            {
                pm.SendGump(new GenericQuestGump(GumpMessage, GenericQuestGumpButton.Close, OnGumpAccepted));
            }
        }
Пример #2
0
        /* Constructor de deserialización */
        public DesireCollection(GenericReader reader)
        {
            int count = reader.ReadInt();

            for (int i = 0; i < count; i++)
            {
                Type       errandType = ReadType(BaseErrand.ErrandTypes, reader);
                DesireInfo info       = new DesireInfo(reader);

                if (errandType != null)
                {
                    m_Desires.Add(errandType, info);
                }
            }
        }
Пример #3
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!CheckCloak(from))
            {
                return;
            }

            PlayerMobile pm = from as PlayerMobile;

            if (pm != null && this.InRange(from, 3))
            {
                DesireInfo info = DesireInfo.GetDesireFor(pm, this);

                if (info != null && !info.GiftGiven)
                {
                    OnTalk(pm, info);
                }
            }
        }
Пример #4
0
        private void OnGumpAccepted(Mobile m)
        {
            if (this.InRange(m, 3) && m is PlayerMobile)
            {
                PlayerMobile pm     = m as PlayerMobile;
                DesireInfo   desire = DesireInfo.GetDesireFor(pm, this);

                if (desire != null)
                {
                    if (desire.GivesDesireInfo)
                    {
                        Say(DesireMessage, String.Format("#{0}", desire.Desire.Name));
                    }
                    else
                    {
                        Say(GiftMessage, String.Format("#{0}", desire.Gift.Name));
                    }
                }
            }
        }
Пример #5
0
        public override void OnMovement(Mobile m, Point3D oldLocation)
        {
            if (!CheckCloak(m))
            {
                return;
            }

            if (m.Alive && !m.Hidden && m is PlayerMobile)
            {
                PlayerMobile pm = (PlayerMobile)m;

                if (this.InRange(m, 3) && !this.InRange(oldLocation, 3))
                {
                    DesireInfo info = DesireInfo.GetDesireFor(pm, this);

                    if (info != null && !info.GiftGiven)
                    {
                        Say(BarkMessage);
                    }
                }
            }
        }
Пример #6
0
        /* Constructor de deserialización */
        public DesireCollection( GenericReader reader )
        {
            int count = reader.ReadInt();

            for ( int i = 0; i < count; i++ )
            {
                Type errandType = ReadType( BaseErrand.ErrandTypes, reader );
                DesireInfo info = new DesireInfo( reader );

                if ( errandType != null )
                    m_Desires.Add( errandType, info );
            }
        }
Пример #7
0
        public void OnTalk( PlayerMobile pm, DesireInfo info )
        {
            if ( pm.Backpack == null )
                return; // sanity

            Item desired = pm.Backpack.FindItemByType( info.Desire.Type );

            if ( desired != null )
            {
                Item toGive = Activator.CreateInstance( info.Gift.Type ) as Item;

                if ( toGive != null )
                {
                    desired.Delete();
                    pm.Backpack.DropItem( toGive );

                    info.GiftGiven = true;

                    SayThanks( info.Desire.Name, info.Gift.Name );
                }
            }
            else
            {
                pm.SendGump( new GenericQuestGump( GumpMessage, GenericQuestGumpButton.Close, OnGumpAccepted ) );
            }
        }