Example #1
0
        public override bool CheckTravel(Mobile from, Point3D p, TravelCheckType type)
        {
            if (from.AccessLevel > AccessLevel.Player)
            {
                return(true);
            }

            switch (type)
            {
            case TravelCheckType.RecallFrom: return(true);

            case TravelCheckType.RecallTo: return(false);

            case TravelCheckType.GateFrom: return(false);

            case TravelCheckType.GateTo: return(false);

            case TravelCheckType.Mark: return(false);

            case TravelCheckType.TeleportFrom: return(true);

            case TravelCheckType.TeleportTo: return(true);
            }

            return(false);
        }
Example #2
0
        public static bool CheckTravel(Mobile caster, Map map, Point3D loc, TravelCheckType type)
        {
            if (IsInvalid(map, loc))                // null, internal, out of bounds
            {
                if (caster != null)
                {
                    SendInvalidMessage(caster, type);
                }

                return(false);
            }

            m_TravelCaster = caster;
            m_TravelType   = type;

            int  v       = (int)type;
            bool isValid = true;

            for (int i = 0; isValid && i < m_Validators.Length; ++i)
            {
                isValid = (m_Rules[v, i] || !m_Validators[i](map, loc));
            }

            if (!isValid && caster != null)
            {
                SendInvalidMessage(caster, type);
            }

            return(isValid);
        }
        public static bool CheckTravel(Mobile caster, Map map, Point3D loc, TravelCheckType type)
        {
            if (IsInvalid(map, loc))                // null, internal, out of bounds
            {
                if (caster != null)
                {
                    SendInvalidMessage(caster, type);
                }
                return(false);
            }

            if (caster != null && caster.AccessLevel == AccessLevel.Player && caster.Region.IsPartOf(typeof(Regions.Jail)))
            {
                caster.SendLocalizedMessage(1042632);                   // You'll need a better jailbreak plan then that!
                return(false);
            }

            m_TravelCaster = caster;
            m_TravelType   = type;

            int  v       = (int)type;
            bool isValid = true;

            for (int i = 0; isValid && i < m_Validators.Length; ++i)
            {
                isValid = (m_Rules[v, i] || !m_Validators[i](map, loc));
            }

            if (!isValid && caster != null)
            {
                SendInvalidMessage(caster, type);
            }

            return(isValid);
        }
Example #4
0
        /// <summary>
        ///     Called in SpellHelper.cs CheckTravel method
        /// </summary>
        /// <param name="m"></param>
        /// <param name="p"></param>
        /// <param name="map"></param>
        /// <param name="type"></param>
        /// <returns>False fails travel check. True must pass other travel checks in SpellHelper.cs</returns>
        public static bool CheckTravel(Mobile m, Point3D p, Map map, TravelCheckType type)
        {
            if (m.AccessLevel > AccessLevel.Player)
            {
                return(true);
            }

            switch (type)
            {
            case TravelCheckType.RecallFrom:
            case TravelCheckType.RecallTo:
            {
                return(false);
            }

            case TravelCheckType.GateFrom:
            case TravelCheckType.GateTo:
            case TravelCheckType.Mark:
            {
                return(CanTravelTo(m, p, map));
            }

            case TravelCheckType.TeleportFrom:
            case TravelCheckType.TeleportTo:
            {
                return(true);
            }
            }

            return(true);
        }
Example #5
0
        public override bool CheckTravel(Mobile traveller, Point3D p, TravelCheckType type)
        {
            if (traveller.AccessLevel > AccessLevel.Player)
            {
                return(true);
            }

            return(type > TravelCheckType.Mark);
        }
Example #6
0
        public override bool CheckTravel(Mobile m, Point3D newlocation, TravelCheckType travelType)
        {
            if (Instance.InUse)
            {
                return(travelType >= (TravelCheckType)5);
            }

            return(true);
        }
Example #7
0
        public override bool CheckTravel(Mobile traveller, Point3D p, TravelCheckType type)
        {
            if (traveller.AccessLevel > AccessLevel.Player)
            {
                return(true);
            }

            return(type == TravelCheckType.TeleportTo || type == TravelCheckType.TeleportFrom);
        }
Example #8
0
        public override bool CheckTravel(Mobile m, Point3D newLocation, TravelCheckType travelType)
        {
            if (m?.AccessLevel == AccessLevel.Player)
            {
                m.SendLocalizedMessage(1114345); // You'll need a better jailbreak plan than that!
                return(false);
            }

            return(base.CheckTravel(m, newLocation, travelType));
        }
Example #9
0
        public static bool CheckTravel(Mobile caster, TravelCheckType type)
        {
            if (CheckTravel(caster, caster.Map, caster.Location, type))
            {
                return(true);
            }

            SendInvalidMessage(caster, type);
            return(false);
        }
Example #10
0
        public static bool CheckTravel(Mobile caster, TravelCheckType type)
        {
            /*if ( CheckTravel( caster, caster.Map, caster.Location, type ) )
             *  return true;
             *
             * SendInvalidMessage( caster, type );
             * return false;*/

            return(CheckTravel(caster, caster.Map, caster.Location, type));
        }
Example #11
0
        public override bool CheckTravel(Mobile traveller, Point3D p, TravelCheckType type)
        {
            switch (type)
            {
                case TravelCheckType.RecallTo:
                case TravelCheckType.GateTo:
                case TravelCheckType.Mark: return false;
            }

            return base.CheckTravel(traveller, p, type);
        }
Example #12
0
        public override bool CheckTravel(Mobile traveller, Point3D p, TravelCheckType type)
        {
            switch (type)
            {
                case TravelCheckType.RecallTo:
                case TravelCheckType.GateTo:
                case TravelCheckType.Mark: return false;
            }

            return base.CheckTravel(traveller, p, type);
        }
Example #13
0
        public override bool CheckTravel(Mobile m, Point3D newLocation, TravelCheckType travelType)
        {
            if (m.AccessLevel > AccessLevel.Player)
                return true;

            switch (travelType)
            {
                default: return true;
                case TravelCheckType.RecallTo:
                case TravelCheckType.GateTo:
                case TravelCheckType.Mark: return false;
            }
        }
Example #14
0
        public override bool CheckTravel(Mobile traveller, Point3D p, TravelCheckType type)
        {
            if (type == TravelCheckType.TeleportTo)
            {
                if (Region.Find(traveller.Location, traveller.Map) != this || traveller.Z != p.Z)
                {
                    traveller.SendLocalizedMessage(501035); // You cannot teleport from here to the destination.
                    return(false);
                }
            }

            return(type > TravelCheckType.Mark);
        }
Example #15
0
 public static void SendInvalidMessage(Mobile caster, TravelCheckType type)
 {
     if (type == TravelCheckType.RecallTo || type == TravelCheckType.GateTo)
     {
         caster.SendAsciiMessage("You are not allowed to travel there.");
     }
     else if (type == TravelCheckType.TeleportTo)
     {
         caster.SendAsciiMessage("You cannot teleport from here to the destination.");
     }
     else
     {
         caster.SendAsciiMessage("Thy spell doth not appear to work...");
     }
 }
Example #16
0
 public static void SendInvalidMessage(Mobile caster, TravelCheckType type)
 {
     if (type == TravelCheckType.RecallTo || type == TravelCheckType.GateTo)
     {
         caster.SendLocalizedMessage(1019004);                   // You are not allowed to travel there.
     }
     else if (type == TravelCheckType.TeleportTo)
     {
         caster.SendLocalizedMessage(501035);                   // You cannot teleport from here to the destination.
     }
     else
     {
         caster.SendLocalizedMessage(501802);                   // Thy spell doth not appear to work...
     }
 }
Example #17
0
        public static bool CheckTravel(Mobile caster, Map map, Point3D loc, TravelCheckType type)
        {
            if (IsInvalid(map, loc))                // null, internal, out of bounds
            {
                if (caster != null)
                {
                    SendInvalidMessage(caster, type);
                }

                return(false);
            }

            if (caster != null && caster.AccessLevel == AccessLevel.Player && caster.Region.IsPartOf(typeof(Regions.Jail)))
            {
                caster.SendLocalizedMessage(1114345);                   // You'll need a better jailbreak plan than that!
                return(false);
            }

            // Always allow monsters to teleport
            if (caster is BaseCreature && (type == TravelCheckType.TeleportTo || type == TravelCheckType.TeleportFrom))
            {
                BaseCreature bc = (BaseCreature)caster;

                if (!bc.Controlled && !bc.Summoned)
                {
                    return(true);
                }
            }

            m_TravelCaster = caster;
            m_TravelType   = type;

            int  v       = (int)type;
            bool isValid = true;

            for (int i = 0; isValid && i < m_Validators.Length; ++i)
            {
                isValid = (m_Rules[v, i] || !m_Validators[i](map, loc));
            }

            if (!isValid && caster != null)
            {
                SendInvalidMessage(caster, type);
            }

            return(isValid);
        }
Example #18
0
        public override bool CheckTravel(Mobile traveller, Point3D p, TravelCheckType type)
        {
            switch (type)
            {
            case TravelCheckType.RecallTo:
            case TravelCheckType.GateTo:
            {
                return(BaseBoat.FindBoatAt(p, Map) != null);
            }

            case TravelCheckType.Mark:
            {
                return(false);
            }
            }

            return(base.CheckTravel(traveller, p, type));
        }
Example #19
0
		public TravelRestrictionValidator(TravelValidator validator, TravelCheckType checktypes)
		{
			m_Validator = validator;
			m_CheckTypes = checktypes;
		}
Example #20
0
		public static bool CheckTravel(Mobile caster, Map map, Point3D loc, TravelCheckType type)
		{
			if (IsInvalid(map, loc)) // null, internal, out of bounds
			{
				if (caster != null)
				{
					SendInvalidMessage(caster, type);
				}

				return false;
			}

            if (caster is BaseCreature && (type == TravelCheckType.TeleportTo || type == TravelCheckType.TeleportFrom))
            {
                var bc = (BaseCreature)caster;

                if (!bc.Controlled && !bc.Summoned)
                {
                    return true;
                }
            }

			if (caster != null && caster.AccessLevel == AccessLevel.Player)
			{
				if (caster.Map != map && caster.Region != null && !(caster.Region is CustomRegion))
				{
					caster.SendLocalizedMessage(1019004); // You are not allowed to travel there.
					return false;
				}

				// Alan MOD only recall, gate, mark in felucca allowed
				if (map != Map.Felucca && caster.Region != null && !(caster.Region is CustomRegion))
				{
					return false;
				}
				// end Alan MOD

				if (caster.Region.IsPartOf(typeof(Jail)))
				{
					caster.SendLocalizedMessage(1114345); // You'll need a better jailbreak plan than that!
					return false;
				}
				CustomRegion customRegion;
				Region ga = Region.Find(loc, map);
				if (ga != null)
				{
					if (ga.IsPartOf(typeof(GreenAcres)))
					{
						caster.SendLocalizedMessage(1019004); // You are not allowed to travel there.
						return false;
					}
					customRegion = ga as CustomRegion;
					if (type == TravelCheckType.RecallTo &&
						(customRegion != null && customRegion.Controller != null &&
						 (!customRegion.Controller.AllowRecallIn || !customRegion.Controller.CanEnter)) ||
						type == TravelCheckType.GateTo &&
						(customRegion != null && customRegion.Controller != null &&
						 (!customRegion.Controller.AllowGateIn || !customRegion.Controller.CanEnter)))
					{
						caster.SendLocalizedMessage(1019004); // You are not allowed to travel there.
						return false;
					}
				}
			}

			// Always allow monsters to teleport
			bool isValid = true;

			for (int i = 0; isValid && i < m_Validators.Length; ++i)
			{
				isValid = m_Validators[i].CanTravel(type) || !m_Validators[i].Validator(caster, map, loc, type);
			}

			if (!isValid && caster != null)
			{
				SendInvalidMessage(caster, type);
			}

			return isValid;
		}
Example #21
0
		public static bool IsTrammelWind(Mobile caster, Map map, Point3D loc, TravelCheckType type)
		{
			return (map == Map.Trammel && IsWindLoc(loc) && caster.Skills[SkillName.Magery].Base >= 70.0);
		}
Example #22
0
		public static bool IsDoomGauntlet(Mobile caster, Map map, Point3D loc, TravelCheckType type)
		{
			return IsDoomGauntlet(map, loc);
		}
Example #23
0
		public static bool CheckTravel( Mobile caster, TravelCheckType type )
		{
			if( CheckTravel( caster, caster.Map, caster.Location, type ) )
				return true;

			SendInvalidMessage( caster, type );
			return false;
		}
Example #24
0
 public override bool CheckTravel(Mobile traveller, Point3D p, TravelCheckType type)
 {
     return(false);
 }
Example #25
0
		public static bool IsIlshenar(Mobile caster, Map map, Point3D loc, TravelCheckType type)
		{
			return (map == Map.Ilshenar);
		}
Example #26
0
		public static bool IsGuardianRoom(Mobile caster, Map map, Point3D loc, TravelCheckType type)
		{
			if (map != Map.Malas)
			{
				return false;
			}

			int x = loc.X, y = loc.Y;

			return (x >= 356 && y >= 5 && x < 375 && y < 25);
		}
Example #27
0
		public static bool IsFeluccaT2A(Mobile caster, Map map, Point3D loc, TravelCheckType type)
		{
			return IsFeluccaT2A(map, loc);
		}
Example #28
0
 public static void SendInvalidMessage( Mobile caster, TravelCheckType type )
 {
     if ( type == TravelCheckType.RecallTo || type == TravelCheckType.GateTo )
         caster.SendAsciiMessage( "You are not allowed to travel there." );
     else if ( type == TravelCheckType.TeleportTo )
         caster.SendAsciiMessage( "You cannot teleport from here to the destination." );
     else
         caster.SendAsciiMessage( "Thy spell doth not appear to work..." );
 }
Example #29
0
		public static bool CheckTravel( Mobile caster, Map map, Point3D loc, TravelCheckType type )
		{
			if( IsInvalid( map, loc ) ) // null, internal, out of bounds
			{
				if( caster != null )
					SendInvalidMessage( caster, type );

				return false;
			}

            // Scriptiz : ajout des cages (holding cell)
			if( caster != null && caster.AccessLevel == AccessLevel.Player && (caster.Region.IsPartOf( typeof( Regions.Jail) ) || caster.Region.IsPartOf( typeof( Regions.HoldingCell) ) ))
			{
                caster.SendLocalizedMessage(1114345); // You'll need a better jailbreak plan then that!
				return false;
			}

            // Always allow monsters to teleport
            if (caster is BaseCreature && (type == TravelCheckType.TeleportTo || type == TravelCheckType.TeleportFrom))
            {
                BaseCreature bc = (BaseCreature)caster;

                if (!bc.Controlled && !bc.Summoned)
                    return true;
            }

			m_TravelCaster = caster;
			m_TravelType = type;

			int v = (int)type;
			bool isValid = true;

			for( int i = 0; isValid && i < m_Validators.Length; ++i )
				isValid = (m_Rules[v, i] || !m_Validators[i]( map, loc ));

			if( !isValid && caster != null )
				SendInvalidMessage( caster, type );

			return isValid;
		}
Example #30
0
		public static bool IsFactionStronghold(Mobile caster, Map map, Point3D loc, TravelCheckType type)
		{
			// Teleporting is allowed, but only for faction members
			if (caster != null && !caster.EraAOS && (type == TravelCheckType.TeleportTo || type == TravelCheckType.TeleportFrom))
			{
				if (Faction.Find(caster, true, true) != null)
				{
					return false;
				}
			}

			return (Region.Find(loc, map).IsPartOf(typeof(StrongholdRegion)));
		}
Example #31
0
		public static bool IsSafeZone(Mobile caster, Map map, Point3D loc, TravelCheckType type)
		{
			#region Duels
			if (Region.Find(loc, map).IsPartOf(typeof(SafeZone)))
			{
				if (type == TravelCheckType.TeleportTo || type == TravelCheckType.TeleportFrom)
				{
					var pm = caster as PlayerMobile;

					if (pm != null && pm.DuelPlayer != null && !pm.DuelPlayer.Eliminated)
					{
						return true;
					}
				}

				return true;
			}
			#endregion

			return false;
		}
Example #32
0
 public static bool CheckTravel(Map map, Point3D loc, TravelCheckType type)
 {
     return(CheckTravel(null, map, loc, type));
 }
Example #33
0
		public static bool IsCrystalCave(Mobile caster, Map map, Point3D loc, TravelCheckType type)
		{
			if (map != Map.Malas || loc.Z >= -80)
			{
				return false;
			}

			int x = loc.X, y = loc.Y;

			return (x >= 1182 && y >= 437 && x < 1211 && y < 470) || (x >= 1156 && y >= 470 && x < 1211 && y < 503) ||
				   (x >= 1176 && y >= 503 && x < 1208 && y < 509) || (x >= 1188 && y >= 509 && x < 1201 && y < 513);
		}
Example #34
0
 public static void SendInvalidMessage(Mobile caster, TravelCheckType type)
 {
     if (type == TravelCheckType.RecallTo || type == TravelCheckType.GateTo)
         caster.SendLocalizedMessage(1019004); // You are not allowed to travel there.
     else if (type == TravelCheckType.TeleportTo)
         caster.SendLocalizedMessage(501035); // You cannot teleport from here to the destination.
     else
         caster.SendLocalizedMessage(501802); // Thy spell doth not appear to work...
 }
Example #35
0
        public static bool CheckTravel( Mobile caster, Map map, Point3D loc, TravelCheckType type )
        {
            if( IsInvalid( map, loc ) ) // null, internal, out of bounds
            {
                if( caster != null )
                    SendInvalidMessage( caster, type );

                return false;
            }

            if( caster != null && caster.AccessLevel == AccessLevel.Player && caster.Region.IsPartOf( typeof( Regions.Jail ) ) )
            {
                caster.SendLocalizedMessage( 1042632 ); // You'll need a better jailbreak plan then that!
                return false;
            }

            m_TravelCaster = caster;
            m_TravelType = type;

            int v = (int)type;
            bool isValid = true;

            for( int i = 0; isValid && i < m_Validators.Length; ++i )
                isValid = (m_Rules[v, i] || !m_Validators[i]( map, loc ));

            if( !isValid && caster != null )
                SendInvalidMessage( caster, type );

            return isValid;
        }
Example #36
0
 public static bool CheckTravel(Map map, Point3D loc, TravelCheckType type)
 {
     return CheckTravel(null, map, loc, type);
 }
Example #37
0
		public static bool IsLampRoom(Mobile caster, Map map, Point3D loc, TravelCheckType type)
		{
			if (map != Map.Malas)
			{
				return false;
			}

			int x = loc.X, y = loc.Y;

			return (x >= 465 && y >= 92 && x < 474 && y < 102);
		}
Example #38
0
 public override bool CheckTravel(Mobile traveller, Point3D p, TravelCheckType type)
 {
     return(type > TravelCheckType.Mark);
 }
Example #39
0
		public static bool CheckTravel( Mobile caster, Map map, Point3D loc, TravelCheckType type )
		{
			if( IsInvalid( map, loc ) ) // null, internal, out of bounds
			{
				if( caster != null )
					SendInvalidMessage( caster, type );

				return false;
			}

			m_TravelCaster = caster;
			m_TravelType = type;

			int v = (int)type;
			bool isValid = true;

			for( int i = 0; isValid && i < m_Validators.Length; ++i )
				isValid = (m_Rules[v, i] || !m_Validators[i]( map, loc ));

			if( !isValid && caster != null )
				SendInvalidMessage( caster, type );

			return isValid;
		}
Example #40
0
		public static bool IsFeluccaSolenHive(Mobile caster, Map map, Point3D loc, TravelCheckType type)
		{
			return (map == Map.Felucca && IsSolenHiveLoc(loc));
		}
Example #41
0
		public static bool IsMLDungeon(Mobile caster, Map map, Point3D loc, TravelCheckType type)
		{
			return MondainsLegacy.IsMLRegion(Region.Find(loc, map));
		}
Example #42
0
 public override bool CheckTravel(Mobile m, Point3D newLocation, TravelCheckType travelType)
 {
     return(travelType >= (TravelCheckType)4); // teleport only
 }
Example #43
0
 public override bool CheckTravel(Mobile m, Point3D newLocation, TravelCheckType travelType) =>
 m.AccessLevel == AccessLevel.Player;
Example #44
0
		public static bool CheckTravel( Mobile caster, Map map, Point3D loc, TravelCheckType type )
		{
			if ( CheckTravel( map, loc, type,caster ) )
				return true;

			SendInvalidMessage( caster, type );
			return false;
		}
Example #45
0
		public bool CanTravel(TravelCheckType type)
		{
			return (m_CheckTypes & type) != 0;
		}
Example #46
0
 public static bool CheckTravel(Map map, Point3D loc, TravelCheckType type, Mobile caster)
 {
     bool jail = false;
     return CheckTravel(map, loc, type, caster, out jail);
 }
Example #47
0
 public static bool CheckTravel(Mobile caster, TravelCheckType type)
 {
     return(CheckTravel(caster, caster.Map, caster.Location, type));
 }
Example #48
0
        public static bool CheckTravel(Map map, Point3D loc, TravelCheckType type, Mobile caster, out bool jail)
		{
            jail = false;

			if ( IsInvalid( map, loc ) ) // null, internal, out of bounds
				return false;

			// custom regions
			CustomRegion reg = Region.Find( loc, map ) as CustomRegion;
			CustomRegion reg2 = CustomRegion.FindDRDTRegion(caster);
			if( reg != null ) 
			{
				try
				{
					RegionControl regstone = null;

					//if a custom region does exsist find its controller
					regstone = reg.GetRegionControler(); 

					if (regstone != null && caster.AccessLevel == AccessLevel.Player)
					{
						if(regstone.AllowTravelSpellsInRegion && reg == reg2)
							return true;
						
						if(regstone.NoRecallInto && type == TravelCheckType.RecallTo)
							return false;

						if(regstone.NoGateInto && type == TravelCheckType.GateTo)
							return false;

						Spell spell = new GateTravelSpell(caster, null);

						if(regstone.IsRestrictedSpell(spell, caster) && type == TravelCheckType.GateFrom)
							return false;


						if(regstone.CannotEnter && type == TravelCheckType.TeleportTo)
							return false;
					}

				}
	
				catch(NullReferenceException e)
				{
					LogHelper.LogException(e);
					Console.WriteLine("{0} Caught exception.", e); 
				}
				catch(Exception ex)
				{
                    LogHelper.LogException(ex);
				}
			}

			if( reg2 != null ) 
			{
				try
				{
					RegionControl regstone = null;

					//if a custom region does exsist find its controller
					regstone = reg2.GetRegionControler(); 

					if (regstone != null && caster.AccessLevel == AccessLevel.Player)
					{
						if(regstone.AllowTravelSpellsInRegion && reg == reg2)
							return true;
						

						if(regstone.NoRecallInto && type == TravelCheckType.RecallTo)
							return false;

						if(regstone.NoGateInto && type == TravelCheckType.GateTo)
							return false;

						Spell spell = new GateTravelSpell(caster, null);

						if(regstone.IsRestrictedSpell(spell, caster) && type == TravelCheckType.GateFrom)
							return false;


						if(regstone.CannotEnter && type == TravelCheckType.TeleportTo)
							return false;
					}

				}
	
				catch(NullReferenceException e)
				{
					LogHelper.LogException(e);
					Console.WriteLine("{0} Caught exception.", e); 
				}
				catch(Exception ex)
				{
                    LogHelper.LogException(ex);
				}
			}

			//Deal with house SecurePremises flag
            if ((type == TravelCheckType.GateTo || type == TravelCheckType.RecallTo ||
                type == TravelCheckType.TeleportTo) && caster.AccessLevel == AccessLevel.Player)
			{
				BaseHouse dst_house = null;
				Sector sector = map.GetSector( loc );
				foreach (BaseMulti mx in sector.Multis.Values)
				{
					BaseHouse _house = mx as BaseHouse;
                    if (_house == null)
                        continue;

					if ( _house != null && _house.Region.Contains(loc) )
					{
						dst_house = _house;
					}
				}

				if( dst_house != null )
				{
					if( dst_house.SecurePremises )
					{
						if( !dst_house.IsFriend( caster ) )
						{
							return false;
						}
					}
				}

			}

            // Gate inside a PreviewHouse exploit. Go directally to jail, don't collect $200.0
            if ((type == TravelCheckType.GateTo ||type == TravelCheckType.RecallTo ||
                type == TravelCheckType.TeleportTo) && caster.AccessLevel == AccessLevel.Player)
            {
                if (PreviewHouseAt(caster.Map, loc))
                {
                    LogHelper.Cheater(caster, "Travel inside a PreviewHouse exploit.", true);
                    jail = true;
                    return false;
                }
            }

            // Teleport onto a stack of stuff =\
            if (type == TravelCheckType.TeleportTo  && caster.AccessLevel == AccessLevel.Player)
            {
                // if we are teleporting onto a stack of movable items, and at least 3 reside on different Z planes
                //  then it looks too much like an exploit to allow it.
                if (iStack(caster, loc, 2) == false)
                {
                    LogHelper.Cheater(caster, "Tele onto a stack of movable items.", true);
                    return false;
                }
            }

            // mark on a stack of stuff =\
            // same as teleport above, but different limit and different message
            if (type == TravelCheckType.Mark && caster.AccessLevel == AccessLevel.Player)
            {
                // if we are marking on a stack of movable items, and at least 2 reside on different Z planes
                //  then it looks too much like an exploit to allow it.
                if (iStack(caster, loc, 2) == false)
                {
                    LogHelper.Cheater(caster, "Mark on a stack of movable items.", true);
                    return false;
                }
            }

            // disallow teleporting from outside the house into the inside if the doors are closed (no LOS)
            if ((type == TravelCheckType.TeleportTo) && caster.AccessLevel == AccessLevel.Player)
            {
                BaseHouse dst_house = null;
                Sector sector = map.GetSector(loc);
				foreach (BaseMulti mx in sector.Multis.Values)
                {
					BaseHouse _house = mx as BaseHouse;
                    if (_house == null)
                        continue;

                    if (_house != null && _house.Region.Contains(loc))
                    {
                        dst_house = _house;
                    }
                }

                // is the user trying to shoot through a door without LOS?
                if (dst_house != null)
                {
                    if (!caster.InLOS(loc))
                    {
                        LogHelper.Cheater(caster, "Try to teleport through front door (LOS)", true);
                        return false;
                    }
                }

                // is the user not standing on the ground?
                if (dst_house != null && dst_house.Region != null)
                {   
                    if (!caster.Map.CanSpawnMobile(caster.Location.X, caster.Location.Y, caster.Location.Z, CanFitFlags.requireSurface))
                    {
                        LogHelper.Cheater(caster, "Try to teleport over front door (Z Axis)", true);
                        return false;
                    }
                }

            }

            // special housing region/multi exploit - teleport from multi to castle courtyard
            // stop players from teleporting from one multi to another (includes PreviewHouses)
            if(type == TravelCheckType.TeleportTo && caster.AccessLevel == AccessLevel.Player)
            {
                // if there is a house at the destination, then..
                //  if all the multis and regions do not match between src and dst, fail
                if (HouseAt(caster.Map, loc) && CheckParity(caster.Map, caster.Location, loc) == false)
                {
                    LogHelper.Cheater(caster, "Multi to multi teleport exploit.", true);
                    return false;
                }
            }

            // Replaced by above CheckParity() implementation (delete after 5/1/07)
            // special housing region exploit - teleport from tower roof to castle courtyard
            /*if(type == TravelCheckType.TeleportTo && caster.AccessLevel == AccessLevel.Player)
            {
                BaseHouse src_house = BaseHouse.FindHouseAt( caster );
                BaseHouse dst_house = null;
				
                // add this redundant check here to eliminate the house enumeration
                //	for the cases when it's not needed.
                if (src_house != null)
                {
                    // build super sector that includes both src and dest
                    ArrayList SuperSector = new ArrayList();
                    SuperSector.Add(src_house);
                    Sector sector = map.GetSector( loc );
                    for ( int i = 0; i < sector.Multis.Count; ++i )
                    {
                        BaseHouse _house = sector.Multis[i] as BaseHouse;
                        if ( _house != null  )
                            if (SuperSector.Contains(_house) == false) // disallow duplicates
                                SuperSector.Add(_house);
                    }
					
                    // now add these if the houses are in different sectors
                    if (sector != map.GetSector( caster ))
                    {
                        sector = map.GetSector( caster );
                        for ( int i = 0; i < sector.Multis.Count; ++i )
                        {
                            BaseHouse _house = sector.Multis[i] as BaseHouse;
                            if ( _house != null  )
                                if (SuperSector.Contains(_house) == false) // disallow duplicates
                                    SuperSector.Add(_house);
                        }
                    }

                    // get the destination house
                    for ( int i = 0; i < SuperSector.Count; ++i )
                    {
                        BaseHouse _house = SuperSector[i] as BaseHouse;

                        if ( _house.Region.Contains(loc) )
                        {
                            //Console.WriteLine("dst_house.region{0}, loc{1}", _house.Region.Coords.ToString(), loc.ToString()); 
                            dst_house = _house;
                        }
                    }

                    // okay, if source house and dest house are different, fail
                    bool house = (src_house != null && dst_house != null);
                    if (house == true && src_house != dst_house)
                    {
                        //Console.WriteLine("Caught invalid teleport."); 
                        LogHelper.Cheater(caster, "Tower roof teleport exploit: case(1)", true);
                        return false;
                    }

                    // house region overlap test: possible with the Tower overhang, overhanging
                    //	another house / courtyard
                    int houses = 0;
                    for ( int i = 0; i < SuperSector.Count; ++i )
                    {
                        BaseHouse _house = SuperSector[i] as BaseHouse;
                        if ( _house.Region.Contains(caster.Location) )
                            houses++;
                    }
                    if (houses > 1)
                    {
                        LogHelper.Cheater(caster, "Tower roof teleport exploit: case(2)", true);
                        return false;
                    }
                }
            }*/

            // okay, now check our locale rules table
			int v = (int)type;
			bool isValid = true;

			for ( int i = 0; isValid && i < m_Validators.Length; ++i )
				isValid = ( m_Rules[v, i] || !m_Validators[i]( map, loc ) );

			return isValid;
		}
Example #49
0
		public static bool IsHeartwood(Mobile caster, Map map, Point3D loc, TravelCheckType type)
		{
			int x = loc.X, y = loc.Y;

			return (map == Map.Trammel || map == Map.Felucca) && (x >= 6911 && y >= 254 && x < 7167 && y < 511);
		}
Example #50
0
		public static bool IsFeluccaDungeon(Mobile caster, Map map, Point3D loc, TravelCheckType type)
		{
			Region region = Region.Find(loc, map);
			return (region.IsPartOf(typeof(DungeonRegion)) && region.Map == Map.Felucca);
		}
Example #51
0
 public static bool CheckTravel(Mobile caster, TravelCheckType type)
 {
     return CheckTravel(caster, caster.Map, caster.Location, type);
 }
Example #52
0
        public bool CheckTravel(Mobile from, TravelCheckType type)
        {
            if (from.AccessLevel > AccessLevel.Player)
                return true;

            switch (type)
            {
                case TravelCheckType.RecallFrom: return true;
                case TravelCheckType.RecallTo: return false;
                case TravelCheckType.GateFrom: return false;
                case TravelCheckType.GateTo: return false;
                case TravelCheckType.Mark: return false;
                case TravelCheckType.TeleportFrom: return true;
                case TravelCheckType.TeleportTo: return true;
            }

            return false;
        }
Example #53
0
        public static bool CheckTravel(Mobile caster, Map map, Point3D loc, TravelCheckType type)
        {
            if (IsInvalid(map, loc)) // null, internal, out of bounds
            {
                if (caster != null)
                    SendInvalidMessage(caster, type);

                return false;
            }

            if (caster != null && caster.IsPlayer() && caster.Region.IsPartOf(typeof(Regions.Jail)))
            {
                caster.SendLocalizedMessage(1114345); // You'll need a better jailbreak plan than that!
                return false;
            }

            // Always allow monsters to teleport
            if (caster is BaseCreature && (type == TravelCheckType.TeleportTo || type == TravelCheckType.TeleportFrom))
            {
                BaseCreature bc = (BaseCreature)caster;

                if (!bc.Controlled && !bc.Summoned)
                    return true;
            }

            m_TravelCaster = caster;
            m_TravelType = type;

            int v = (int)type;
            bool isValid = true;

            #region Mondain's Legacy
            if (m_TravelCaster != null && m_TravelCaster.Region != null)
            {
                if (m_TravelCaster.Region.IsPartOf("Blighted Grove") && loc.Z < -10)
                    isValid = false;
            }
            #endregion

            for (int i = 0; isValid && i < m_Validators.Length; ++i)
                isValid = (m_Rules[v, i] || !m_Validators[i](map, loc));

            if (!isValid && caster != null)
                SendInvalidMessage(caster, type);

            return isValid;
        }
Example #54
0
 public virtual bool CheckTravel(Mobile m, Point3D newLocation, TravelCheckType travelType) => true;