コード例 #1
0
        public virtual bool AcceptEscorter(Mobile m)
        {
            EDI dest = GetDestination();

            if (dest == null)
            {
                return(false);
            }

            Mobile escorter = GetEscorter();

            if (escorter != null || !m.Alive)
            {
                return(false);
            }

            BaseEscortable escortable = (BaseEscortable)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 + EscortDelay) >= DateTime.UtcNow)
            {
                int minutes = (int)Math.Ceiling(((((PlayerMobile)m).LastEscortTime + EscortDelay) - DateTime.UtcNow).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.UtcNow;

                if (m is PlayerMobile)
                {
                    ((PlayerMobile)m).LastEscortTime = DateTime.UtcNow;
                }

                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);
        }
コード例 #2
0
        public override void OnSpeech(SpeechEventArgs e)
        {
            base.OnSpeech(e);

            EDI dest = GetDestination();

            if (dest != null && !e.Handled && e.Mobile.InRange(this.Location, 3))
            {
                if (e.HasKeyword(0x1D)) // *destination*
                {
                    e.Handled = SayDestinationTo(e.Mobile);
                }
                else if (e.HasKeyword(0x1E)) // *i will take thee*
                {
                    e.Handled = AcceptEscorter(e.Mobile);
                }
            }
        }
コード例 #3
0
        public virtual string PickRandomDestination()
        {
            if (Map.Felucca.Regions.Count == 0 || Map == null || Map == Map.Internal || Location == Point3D.Zero)
            {
                return(null); // Not yet fully initialized
            }
            string[] possible = GetPossibleDestinations();
            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);
        }
コード例 #4
0
        public EDI GetDestination()
        {
            if (MLQuestSystem.Enabled)
            {
                return(null);
            }

            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 = EDI.Find(m_DestinationString));
            }

            return(m_Destination = null);
        }
コード例 #5
0
        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);

            writer.Write((int)1); // 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);
            }

            MLQuestSystem.WriteQuestRef(writer, StaticMLQuester ? null : m_MLQuest);
        }
コード例 #6
0
        public virtual bool SayDestinationTo(Mobile m)
        {
            EDI dest = GetDestination();

            if (dest == null || !m.Alive)
            {
                return(false);
            }

            Mobile escorter = GetEscorter();

            if (escorter == null)
            {
                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)
            {
                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);
        }
コード例 #7
0
        public virtual bool CheckAtDestination()
        {
            if (MLQuestSystem.Enabled)
            {
                return(false);
            }

            EDI 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.TryDropItem(escorter, gold, false))
                {
                    gold.MoveToWorld(escorter.Location, escorter.Map);
                }

                StopFollow();
                SetControlMaster(null);
                m_EscortTable.Remove(escorter);
                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;

                        if (pm.CompassionGains >= 5)
                        {
                            pm.SendLocalizedMessage(1053004); // You must wait about a day before you can gain in compassion again.
                        }
                    }
                    else
                    {
                        pm.SendLocalizedMessage(1053003); // You have achieved the highest path of compassion and can no longer gain any further.
                    }
                }

                return(true);
            }

            return(false);
        }