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)); } }
/* 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); } } }
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); } } }
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)); } } } }
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); } } } }
/* 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 ); } }
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 ) ); } }