Beispiel #1
0
 public override bool OnMoveOver(Mobile m)
 {
     if (m.Player && m.Criminal)
     {
         m.SendLocalizedMessage(1005561, "", 0x22);                       // Thou'rt a criminal and cannot escape so easily.
         return(true);
     }
     else if (m is BaseOverland && (m as BaseOverland).GateTravel == false)
     {                       // overland mobs are afraid of magic and will not enter!
         BaseOverland bo = m as BaseOverland;
         bo.OnMoongate();
         return(true);
     }
     else
     {                   // Adam: there is an exploit where you drop a preview house on top of a gate.
         //  the GateTo checker below will send the exploiters to jail if that's the case
         bool jail;
         if (SpellHelper.CheckTravel(m.Map, this.Target, TravelCheckType.GateTo, m, out jail))
         {
             return(base.OnMoveOver(m));
         }
         else
         {
             if (jail == true)
             {
                 Point3D jailCell = new Point3D(5295, 1174, 0);
                 m.MoveToWorld(jailCell, m.Map);
             }
             return(false);
         }
     }
 }
 public virtual void UseGate(Mobile m)
 {
     if (CheckSpecialRestrictions(m) == false)
     {
         m.SendMessage("You cannot use this moongate.");
     }
     //else if ( m.Murderer && m_TargetMap != Map.Felucca )
     //{
     //m.SendLocalizedMessage( 1019004 ); // You are not allowed to travel there.
     //}
     else if (m.Spell != null)
     {
         m.SendLocalizedMessage(1049616);                 // You are too busy to do that at the moment.
     }
     else if (m is BaseOverland && (m as BaseOverland).GateTravel == false)
     {                   // overland mobs are afraid of magic and will not enter!
         BaseOverland bo = m as BaseOverland;
         bo.OnMoongate();
     }
     else if (m_TargetMap != null && m_TargetMap != Map.Internal)
     {
         bool jail;
         // DestinationOverride lets us go places usually restricted by CheckTravel()
         if (DestinationOverride || SpellHelper.CheckTravel(m_TargetMap, m_Target, TravelCheckType.GateTo, m, out jail))
         {
             BaseCreature.TeleportPets(m, m_Target, m_TargetMap);
             // Adam: for now, this an allowed means of transportation of heavy objects
             // m.DropHolding();
             m.MoveToWorld(m_Target, m_TargetMap);
             m.PlaySound(0x1FE);
             OnGateUsed(m);
         }
         else
         {
             if (jail == true)
             {
                 Point3D jailCell = new Point3D(5295, 1174, 0);
                 m.MoveToWorld(jailCell, m.Map);
             }
             else
             {
                 m.SendMessage("This moongate does not seem to go anywhere.");
             }
         }
     }
     else
     {
         m.SendMessage("This moongate does not seem to go anywhere.");
     }
 }
        public static int Announce(out int PlayerQuestsAnnounced)
        {
            PlayerQuestsAnnounced = 0;
            //LogHelper Logger = new LogHelper("PlayerQuest.log", false);
            int count = 0;

            try
            {
                int       msgndx       = 0;
                ArrayList ToDelete     = new ArrayList();
                ArrayList ParentMobile = new ArrayList();

                // clear any messages currently on the TC
                PlayerQuestManager.ClearAllMessages();

                // find expired
                foreach (object o in PlayerQuestManager.Deeds)
                {
                    if (o is PlayerQuestDeed == false)
                    {
                        continue;
                    }
                    PlayerQuestDeed pqd = o as PlayerQuestDeed;

                    if (pqd.Deleted == true)
                    {
                        ToDelete.Add(pqd);
                    }
                    else
                    {
                        object root = pqd.RootParent;
                        //bool exclude = false;
                        count++;

                        // don't announce an expired quest
                        if (pqd.Expired == true)
                        {
                            continue;
                        }

                        // don't announce if in a locked down container in a house
                        if (root is BaseContainer && Server.Multis.BaseHouse.FindHouseAt(pqd) != null)
                        {
                            BaseContainer bc = root as BaseContainer;
                            if (bc.IsLockedDown == true || bc.IsSecure == true)
                            {
                                continue;
                            }
                        }

                        // don't announce if locked down or secure
                        if (pqd.IsLockedDown == true || pqd.IsSecure == true)
                        {
                            continue;
                        }

                        // don't announce if on the internal map
                        if (pqd.Map == Map.Internal || root is Mobile && (root as Mobile).Map == Map.Internal)
                        {
                            continue;
                        }

                        // don't announce if in bankbox
                        if (root is Mobile && pqd.IsChildOf((root as Mobile).BankBox))
                        {
                            continue;
                        }

                        // only announce 1 ticket per mobile or container
                        // (15 tickets on a mob, or in a chest should generate 1 announcement)
                        if (root != null)
                        {
                            if (ParentMobile.Contains(root))
                            {
                                continue;
                            }
                        }

                        // only public houses
                        Server.Multis.BaseHouse house = null;
                        if (root is Item)
                        {
                            house = Server.Multis.BaseHouse.FindHouseAt(root as Item);
                        }
                        if (root is Mobile)
                        {
                            house = Server.Multis.BaseHouse.FindHouseAt(root as Mobile);
                        }
                        if (house != null && house.Public == false)
                        {
                            continue;
                        }

                        ///////////////////////////////////////////////////////
                        // okay announce it !
                        // record the parent
                        if (root != null)
                        {
                            ParentMobile.Add(root);
                        }

                        // format the message
                        string[] lines = new string[2];
                        if (root is Mobile)
                        {
                            Mobile mob = root as Mobile;
                            lines[0] = String.Format(
                                "{0} was last seen near {1}. {2} is not to be trusted.",
                                mob.Name,
                                BaseOverland.DescribeLocation(mob),
                                mob.Female == true ? "She" : "He");

                            lines[1] = String.Format(
                                "Do what you will with {0}, but get that quest ticket {1} carries.",
                                mob.Female == true ? "her" : "him",
                                mob.Female == true ? "she" : "he");
                        }
                        else
                        {
                            lines[0] = String.Format(
                                "A quest ticket was last seen near {0}",
                                BaseOverland.DescribeLocation(root == null ? pqd : root as Item));

                            lines[1] = String.Format(
                                "It may be of significant value, but be careful!");
                        }

                        // queue it
                        PlayerQuestManager.SetMessage(lines, msgndx++);

                        // count it
                        PlayerQuestsAnnounced++;
                    }

                    // record the expiring quest chest
                    //Logger.Log(LogType.Item, bc, "Player Quest prize being deleted because the quest has expired.");
                }

                // cleanup
                for (int i = 0; i < ToDelete.Count; i++)
                {
                    PlayerQuestDeed pqd = ToDelete[i] as PlayerQuestDeed;
                    if (pqd != null)
                    {
                        PlayerQuestManager.Deeds.Remove(pqd);
                    }
                }
            }
            catch (Exception e)
            {
                LogHelper.LogException(e);
                Console.WriteLine("Exception while running PlayerQuestManager.Announce() job");
                Console.WriteLine(e);
            }
            finally
            {
                //Logger.Finish();
            }

            return(count);
        }
Beispiel #4
0
        public Mobile SpawnAt(Spawner spawner, Mobile mob)
        {
            Map map = spawner.Map;

            if (map == null || map == Map.Internal)
            {
                return(null);
            }

            if ((mob is BaseCreature) == false)
            {
                return(null);
            }

            try
            {
                BaseOverland bo = null;
                BaseCreature bc = mob as BaseCreature;
                // we will make it so this is passed in
                if (mob is BaseOverland)
                {
                    bo = mob as BaseOverland;
                }

                // use the spawners homerange except when it is a special 'guard post'
                //	spawner (HomeRange == 0)
                bc.RangeHome = spawner.HomeRange == 0? 10 : spawner.HomeRange;

                // could be useful ... but not today
                // c.CurrentWayPoint = spawner.WayPoint;
                // c.NavDestination = spawner.NavPoint;

                bc.Home    = spawner.Location;
                bc.Spawner = spawner;

                //if we have a navdestination as soon as we spawn start on it
                if (bc.NavDestination != NavDestinations.None)
                {
                    bc.AIObject.Think();
                }

                /////////////////////////////
                // move it to the world
                Point3D loc = spawner.GetSpawnPosition(bc);
                bc.MoveToWorld(loc, map);

                // Okay, indicate that this overland mob should be announced on the Town Crier
                // This must be after we are moved off the internal map because the accounce code
                //	supplies 'world location' information which would be wrong if we were still on the internal map
                if (bo != null)
                {
                    bo.Announce = true;
                }

                return(bc);
            }
            catch (Exception e)
            {
                LogHelper.LogException(e);
                Console.WriteLine("Server.Engines.OverlandSpawner : Exception {0}", e);
            }

            return(null);
        }