예제 #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 ) );
            }
        }