public virtual bool CheckAtDestination() { EDI dest = GetDestination(); if (dest == null) { return(false); } if (dest.Contains(Location)) { Say("Ah! Thank the heavens! I am safe and sound! Here is thy pay as promised!"); Timer.DelayCall(TimeSpan.FromSeconds(5), delegate { if (this != null) { Delete(); } }); return(true); } return(false); }
public override void Serialize(GenericWriter writer) { base.Serialize(writer); writer.Write((int)0); // version EDI dest = this.GetDestination(); writer.Write(dest != null); if (dest != null) { writer.Write(dest.Name); } writer.Write(this.m_DeleteTimer != null); if (this.m_DeleteTimer != null) { writer.WriteDeltaTime(this.m_DeleteTime); } #region BBS Quests writer.Write(m_Message); #endregion }
public override void AddCustomContextEntries(Mobile from, List <ContextMenuEntry> list) { EDI dest = this.GetDestination(); if (dest != null && from.Alive) { Mobile escorter = this.GetEscorter(); if (escorter == null || escorter == from) { list.Add(new AskDestinationEntry(this, from)); } if (escorter == null) { list.Add(new AcceptEscortEntry(this, from)); } else if (escorter == from) { list.Add(new AbandonEscortEntry(this, from)); } } base.AddCustomContextEntries(from, list); }
public static void LoadTable() { ArrayList list = new ArrayList(Map.Felucca.Regions.Values); if (list.Count == 0) { return; } m_Table = new Hashtable(); for (int i = 0; i < list.Count; ++i) { Region r = (Region)list[i]; if (r is Regions.DungeonRegion || r is Regions.TownRegion) { m_Table[r.Name] = new EscortDestinationInfo(r.Name, r); } else if (r.Name == "Dungeons Level 1") { m_Table["a dungeon"] = new EscortDestinationInfo("a dungeon", r); } } }
public virtual bool AcceptEscorter(Mobile m) { EDI dest = this.GetDestination(); if (dest == null) { return(false); } Mobile escorter = this.GetEscorter(); if (escorter != null || !m.Alive) { return(false); } BaseEscortable escortable = (BaseEscortable)m_EscortTable[m]; if (escortable != null && !escortable.Deleted && escortable.GetEscorter() == m) { this.Say("I see you already have an escort."); return(false); } else if (m is PlayerMobile && (((PlayerMobile)m).LastEscortTime + m_EscortDelay) >= DateTime.UtcNow) { int minutes = (int)Math.Ceiling(((((PlayerMobile)m).LastEscortTime + m_EscortDelay) - DateTime.UtcNow).TotalMinutes); this.Say("You must rest {0} minute{1} before we set out on this journey.", minutes, minutes == 1 ? "" : "s"); return(false); } else if (this.SetControlMaster(m)) { this.m_LastSeenEscorter = DateTime.UtcNow; if (m is PlayerMobile) { ((PlayerMobile)m).LastEscortTime = DateTime.UtcNow; } this.Say("Lead on! Payment will be made when we arrive in {0}.", (dest.Name == "Ocllo" && m.Map == Map.Trammel) ? "Haven" : dest.Name); m_EscortTable[m] = this; this.StartFollow(); #region BBs Quests // We have an escort, Remove bulletin board post if (m_Message != null) { m_Message.Delete(); } #endregion return(true); } return(false); }
public virtual bool AcceptEscorter(Mobile mobile) { EDI dest = GetDestination(); if (dest == null || mobile == null) { return(false); } if (!mobile.Alive) { return(false); } BaseBoat m_Boat = BaseBoat.FindBoatAt(mobile.Location, mobile.Map); if (m_Boat != null) { if (m_Boat.Deleted || m_Boat.m_SinkTimer != null) { mobile.SendMessage("Your boat is in no condition right now to be taking on passengers!"); return(false); } if (!(m_Boat.IsOwner(mobile) || m_Boat.IsCoOwner(mobile))) { mobile.SendMessage("Only owners and co-owners of this ship have permission to take on passengers."); return(false); } Say("Thank you! Let us return to " + dest.Name); if (Body.IsHuman && !Mounted) { Animate(32, 3, 1, true, false, 0); } if (m_DeleteTimer != null) { m_DeleteTimer.Stop(); } m_DeleteTime = DateTime.UtcNow + TimeSpan.FromMinutes(120); m_DeleteTimer = new DeleteTimer(this, m_DeleteTime - DateTime.UtcNow); m_DeleteTimer.Start(); Location = m_Boat.GetRandomEmbarkLocation(true); m_Boat.AddEmbarkedMobile(this); } return(true); }
public virtual bool AcceptEscorter(Mobile m) { EscortDestinationInfo dest = GetDestination(); if (dest == null) { return(false); } Mobile escorter = GetEscorter(); if (escorter != null || !m.Alive) { return(false); } TalkingBaseEscortable escortable = (TalkingBaseEscortable)m_EscortTable[m]; if (escortable != null && !escortable.Deleted && escortable.GetEscorter() == m) { Say("I see you already have an escort."); return(false); } else if (m is PlayerMobile && (((PlayerMobile)m).LastEscortTime + m_EscortDelay) >= DateTime.Now) { int minutes = (int)Math.Ceiling(((((PlayerMobile)m).LastEscortTime + m_EscortDelay) - DateTime.Now).TotalMinutes); Say("You must rest {0} minute{1} before we set out on this journey.", minutes, minutes == 1 ? "" : "s"); return(false); } else if (SetControlMaster(m)) { m_LastSeenEscorter = DateTime.Now; if (m is PlayerMobile) { ((PlayerMobile)m).LastEscortTime = DateTime.Now; } Say("Lead on! Payment will be made when we arrive in {0}.", (dest.Name == "Ocllo" && m.Map == Map.Trammel) ? "Haven" : dest.Name); m_EscortTable[m] = this; StartFollow(); return(true); } return(false); }
public virtual bool SayDestinationTo(Mobile mobile) { EDI dest = GetDestination(); if (dest == null || mobile == null) { return(false); } if (!mobile.Alive) { return(false); } Say("If thou could rescue me and bring me to " + dest.Name + " I would be grateful and would reward thee for helping me!"); return(true); }
public override void OnSpeech(SpeechEventArgs e) { base.OnSpeech(e); EDI dest = this.GetDestination(); if (dest != null && !e.Handled && e.Mobile.InRange(this.Location, 3)) { if (e.HasKeyword(0x1D)) // *destination* { e.Handled = this.SayDestinationTo(e.Mobile); } else if (e.HasKeyword(0x1E)) // *i will take thee* { e.Handled = this.AcceptEscorter(e.Mobile); } } }
public EDI GetDestination() { if (this.m_DestinationString == null && this.m_DeleteTimer == null) { this.m_DestinationString = this.PickRandomDestination(); } if (this.m_Destination != null && this.m_Destination.Name == this.m_DestinationString) { return(this.m_Destination); } if (Map.Felucca.Regions.Count > 0) { return(this.m_Destination = EDI.Find(this.m_DestinationString)); } return(this.m_Destination = null); }
public EscortDestinationInfo GetDestination() { if (m_DestinationString == null && m_DeleteTimer == null) { m_DestinationString = PickRandomDestination(); } if (m_Destination != null && m_Destination.Name == m_DestinationString) { return(m_Destination); } if (Map.Felucca.Regions.Count > 0) { return(m_Destination = EscortDestinationInfo.Find(m_DestinationString)); } return(m_Destination = null); }
protected override void OnLocationChange(Point3D oldLocation) { base.OnLocationChange(oldLocation); if (oldLocation == Point3D.Zero) { EDI dest = GetDestination(); if (dest != null && m_Message == null) { if (m_Camp != null) { m_Message = new PrisonerMessage(m_Camp, this); } else { m_Message = new EscortMessage(this); } } } }
public override void Serialize(GenericWriter writer) { base.Serialize(writer); writer.Write((int)0); //version EDI dest = GetDestination(); writer.Write(dest != null); if (dest != null) { writer.Write(dest.Name); } writer.Write(m_DeleteTimer != null); if (m_DeleteTimer != null) { writer.WriteDeltaTime(m_DeleteTime); } }
public virtual string PickRandomDestination() { if (Map.Felucca.Regions.Count == 0 || this.Map == null || this.Map == Map.Internal || this.Location == Point3D.Zero) { return(null); // Not yet fully initialized } string[] possible = this.GetPossibleDestinations(); string picked = null; while (picked == null) { picked = possible[Utility.Random(possible.Length)]; EDI test = EDI.Find(picked); if (test != null && test.Contains(this.Location)) { picked = null; } } return(picked); }
public virtual string PickRandomDestination() { if (Map.Felucca.Regions.Count == 0 || Map == null || Map == Map.Internal || Location == Point3D.Zero) { return(null); } string[] possible = destinations; string picked = null; while (picked == null) { picked = possible[Utility.Random(possible.Length)]; EDI test = EDI.Find(picked); if (test != null && test.Contains(Location)) { picked = null; } } return(picked); }
public virtual bool SayDestinationTo(Mobile m) { EDI dest = this.GetDestination(); if (dest == null || !m.Alive) { return(false); } Mobile escorter = this.GetEscorter(); if (escorter == null) { this.Say("I am looking to go to {0}, will you take me?", (dest.Name == "Ocllo" && m.Map == Map.Trammel) ? "Haven" : dest.Name); return(true); } else if (escorter == m) { this.Say("Lead on! Payment will be made when we arrive in {0}.", (dest.Name == "Ocllo" && m.Map == Map.Trammel) ? "Haven" : dest.Name); return(true); } return(false); }
public static void LoadTable() { ArrayList list = new ArrayList(Map.Felucca.Regions.Values); if ( list.Count == 0 ) return; m_Table = new Hashtable(); for ( int i = 0; i < list.Count; ++i ) { Region r = (Region)list[i]; if (r is Regions.DungeonRegion || r is Regions.TownRegion) m_Table[r.Name] = new EscortDestinationInfo(r.Name, r); else if (r.Name == "Dungeons Level 1") m_Table["a dungeon"] = new EscortDestinationInfo("a dungeon", r); } }
public virtual bool CheckAtDestination() { EscortDestinationInfo dest = GetDestination(); if ( dest == null ) return false; Mobile escorter = GetEscorter(); if ( escorter == null ) return false; if ( dest.Contains( Location ) ) { Say( 1042809, escorter.Name ); // We have arrived! I thank thee, ~1_PLAYER_NAME~! I have no further need of thy services. Here is thy pay. // not going anywhere m_Destination = null; m_DestinationString = null; Container cont = escorter.Backpack; if ( cont == null ) cont = escorter.BankBox; Gold gold = new Gold( 500, 1000 ); if ( cont == null || !cont.TryDropItem( escorter, gold, false ) ) gold.MoveToWorld( escorter.Location, escorter.Map ); Misc.Titles.AwardFame( escorter, 10, true ); bool gainedPath = false; PlayerMobile pm = escorter as PlayerMobile; if ( pm != null ) { if ( pm.CompassionGains > 0 && DateTime.Now > pm.NextCompassionDay ) { pm.NextCompassionDay = DateTime.MinValue; pm.CompassionGains = 0; } if ( pm.CompassionGains >= 5 ) // have already gained 5 points in one day, can gain no more { pm.SendLocalizedMessage( 1053004 ); // You must wait about a day before you can gain in compassion again. } else if ( VirtueHelper.Award( pm, VirtueName.Compassion, 1, ref gainedPath ) ) { if ( gainedPath ) pm.SendLocalizedMessage( 1053005 ); // You have achieved a path in compassion! else pm.SendLocalizedMessage( 1053002 ); // You have gained in compassion. pm.NextCompassionDay = DateTime.Now + TimeSpan.FromDays( 1.0 ); // in one day CompassionGains gets reset to 0 ++pm.CompassionGains; } else { pm.SendLocalizedMessage( 1053003 ); // You have achieved the highest path of compassion and can no longer gain any further. } } XmlQuest.RegisterEscort(this, escorter); StopFollow(); SetControlMaster(null); m_EscortTable.Remove(escorter); BeginDelete(); return true; } return false; }
public virtual bool CheckAtDestination() { EDI dest = this.GetDestination(); if (dest == null) { return(false); } Mobile escorter = this.GetEscorter(); if (escorter == null) { return(false); } if (dest.Contains(this.Location)) { this.Say(1042809, escorter.Name); // We have arrived! I thank thee, ~1_PLAYER_NAME~! I have no further need of thy services. Here is thy pay. // not going anywhere this.m_Destination = null; this.m_DestinationString = null; Container cont = escorter.Backpack; if (cont == null) { cont = escorter.BankBox; } //Gold gold = new Gold(500, 1000); #region BBS Quests Gold gold; if (this.IsPrisoner) { gold = new Gold(1000, 1500); } else { gold = new Gold(500, 750); } #endregion if (!cont.TryDropItem(escorter, gold, false)) { gold.MoveToWorld(escorter.Location, escorter.Map); } this.StopFollow(); this.SetControlMaster(null); m_EscortTable.Remove(escorter); this.BeginDelete(); Misc.Titles.AwardFame(escorter, 10, true); bool gainedPath = false; PlayerMobile pm = escorter as PlayerMobile; if (pm != null) { if (pm.CompassionGains > 0 && DateTime.UtcNow > pm.NextCompassionDay) { pm.NextCompassionDay = DateTime.MinValue; pm.CompassionGains = 0; } if (pm.CompassionGains >= 5) // have already gained 5 times in one day, can gain no more { pm.SendLocalizedMessage(1053004); // You must wait about a day before you can gain in compassion again. } //else if (VirtueHelper.Award(pm, VirtueName.Compassion, this.IsPrisoner ? 400 : 200, ref gainedPath)) //{ // if (gainedPath) // pm.SendLocalizedMessage(1053005); // You have achieved a path in compassion! // else // pm.SendLocalizedMessage(1053002); // You have gained in compassion. // pm.NextCompassionDay = DateTime.UtcNow + TimeSpan.FromDays(1.0); // in one day CompassionGains gets reset to 0 // ++pm.CompassionGains; //} UOSI else { pm.SendLocalizedMessage(1053003); // You have achieved the highest path of compassion and can no longer gain any further. } } return(true); } return(false); }
public EscortDestinationInfo GetDestination() { if ( m_DestinationString == null && m_DeleteTimer == null ) m_DestinationString = PickRandomDestination(); if ( m_Destination != null && m_Destination.Name == m_DestinationString ) return m_Destination; if ( Map.Felucca.Regions.Count > 0 ) return ( m_Destination = EscortDestinationInfo.Find( m_DestinationString ) ); return ( m_Destination = null ); }
public virtual bool CheckAtDestination() { EscortDestinationInfo dest = GetDestination(); if (dest == null) { return(false); } Mobile escorter = GetEscorter(); if (escorter == null) { return(false); } if (dest.Contains(Location)) { Say(1042809, escorter.Name); // We have arrived! I thank thee, ~1_PLAYER_NAME~! I have no further need of thy services. Here is thy pay. // not going anywhere m_Destination = null; m_DestinationString = null; Container cont = escorter.Backpack; if (cont == null) { cont = escorter.BankBox; } Gold gold = new Gold(500, 1000); if (cont == null || !cont.TryDropItem(escorter, gold, false)) { gold.MoveToWorld(escorter.Location, escorter.Map); } Misc.Titles.AwardFame(escorter, 10, true); bool gainedPath = false; PlayerMobile pm = escorter as PlayerMobile; if (pm != null) { if (pm.CompassionGains > 0 && DateTime.Now > pm.NextCompassionDay) { pm.NextCompassionDay = DateTime.MinValue; pm.CompassionGains = 0; } if (pm.CompassionGains >= 5) // have already gained 5 points in one day, can gain no more { pm.SendLocalizedMessage(1053004); // You must wait about a day before you can gain in compassion again. } else if (VirtueHelper.Award(pm, VirtueName.Compassion, 1, ref gainedPath)) { if (gainedPath) { pm.SendLocalizedMessage(1053005); // You have achieved a path in compassion! } else { pm.SendLocalizedMessage(1053002); // You have gained in compassion. } pm.NextCompassionDay = DateTime.Now + TimeSpan.FromDays(1.0); // in one day CompassionGains gets reset to 0 ++pm.CompassionGains; } else { pm.SendLocalizedMessage(1053003); // You have achieved the highest path of compassion and can no longer gain any further. } } XmlQuest.RegisterEscort(this, escorter); StopFollow(); SetControlMaster(null); m_EscortTable.Remove(escorter); BeginDelete(); return(true); } return(false); }