コード例 #1
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);
        }
コード例 #2
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);
        }