Ejemplo n.º 1
1
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 1:
				case 0:
				{
					m_MultiID = reader.ReadInt();
					m_Offset = reader.ReadPoint3D();
					m_ShipName = reader.ReadString();

					if ( version == 0 )
						reader.ReadUInt();

					break;
				}
			}

			if ( LootType == LootType.Newbied )
				LootType = LootType.Blessed;

			if ( Weight == 0.0 )
				Weight = 1.0;
		}
Ejemplo n.º 2
0
        public MedusaPlatform()
        {
            ExitLocation = new Point3D( 817, 756, 50 );

            // base
            AddComponent( new AddonComponent( 0x0709 ), -1, -1, 0 );
            AddComponent( new AddonComponent( 0x0709 ), 0, -1, 0 );
            AddComponent( new AddonComponent( 0x0709 ), 1, -1, 0 );
            AddComponent( new AddonComponent( 0x0709 ), 0, 0, 0 );
            AddComponent( new AddonComponent( 0x0709 ), 1, 0, 0 );
            AddComponent( new AddonComponent( 0x0709 ), -1, 1, 0 );
            AddComponent( new AddonComponent( 0x0709 ), 0, 1, 0 );
            AddComponent( new AddonComponent( 0x0709 ), 1, 1, 0 );

            // stairs
            AddComponent( new AddonComponent( 0x070D ), -1, 0, 0 );

            // blockers
            AddComponent( new AddonComponent( 0x21A4 ), 0, -1, 5 );
            AddComponent( new AddonComponent( 0x21A4 ), 1, 0, 5 );
            AddComponent( new AddonComponent( 0x21A4 ), 0, 1, 5 );

            // floor cracks
            AddComponent( new AddonComponent( 0x1B07 ), 0, 0, 5 );
            AddComponent( new AddonComponent( 0x1B05 ), 0, 0, 5 );

            // floor
            AddComponent( new AddonComponent( 0x4332 ), 1, 1, 5 );
            AddComponent( new AddonComponent( 0x4333 ), -1, -1, 5 );
            AddComponent( new AddonComponent( 0x4334 ), -1, 1, 5 );
            AddComponent( new AddonComponent( 0x4335 ), 1, -1, 5 );
            AddComponent( new AddonComponent( 0x433A ), 0, -1, 5 );
            AddComponent( new AddonComponent( 0x433A ), 1, 0, 5 );
            AddComponent( new AddonComponent( 0x433A ), 0, 1, 5 );
        }
Ejemplo n.º 3
0
        protected override void OnTick()
        {
            if( !LegalGrappling(attacker) || !LegalGrappling(defender) )
                return;

            Blood blood = new Blood();
            blood.ItemID = Utility.Random( 0x122A, 5 );
            Map map = defender.Map;
            bool validLocation = false;
            Point3D loc = defender.Location;

            for( int i = 0; !validLocation && i < 10; i++ )
            {
                int x = defender.X + Utility.RandomMinMax( 0, 2 ) - 1;
                int y = defender.Y + Utility.RandomMinMax( 0, 2 ) - 1;
                int z = map.GetAverageZ( x, y );

                if( validLocation = map.CanFit( x, y, defender.Z, 16, false, false ) )
                    loc = new Point3D( x, y, defender.Z );
                else if( validLocation = map.CanFit( x, y, z, 16, false, false ) )
                    loc = new Point3D( x, y, z );
            }

            blood.MoveToWorld( loc, map );
            defender.PlaySound( 0x133 );
            defender.Damage( (int)( Math.Max( 10, Math.Min( 50, ( attacker.Str / 10 ) ) ) ), attacker );

            if( attacker.MeleeAttackType != MeleeAttackType.PermanentGrapple )
                reps--;

            if( reps < 1 || !LegalGrappling( attacker ) || !LegalGrappling( defender ) )
                return;

            new GrappleTimer( attacker, defender, reps ).Start();
        }
Ejemplo n.º 4
0
			public override void OnMovement( Mobile m, Point3D oldLocation )/////To Fix/////
		{
			
			if ( m.Alive && m is PlayerMobile )
			{
				PlayerMobile pm = (PlayerMobile)m;

				
				if ( InRange( pm, 2 ) && !InRange( oldLocation, 2 ) )
				{
					
					WormSilk ws = pm.Backpack.FindItemByType( typeof ( WormSilk ) ) as WormSilk;
		        

					if ( ws == null )
					{
						if ( ! pm.HasGump( typeof( RalphGump ) ) )
					{
					        pm.SendGump( new RalphGump( pm ) );
						
						return;
					}
					}
					else if ( ws != null )
					{
						Say( "I see you have found some worm silk! If you have 10, may I have them please?");
						
						return;
					}
				}
			}
		}
		public BattleMonsterGump( Mobile from, string name, Point3D point, Map map ) : base( 100, 100 )
		{
			From = from;
			MoveToLocation = point;
			MoveToMap = map;

			Closable = true;
			Disposable = true;
			Dragable = true;
			Resizable = false;

			AddPage( 0 );

			AddImage( 0, 0, 2080 );
			AddImage( 17, 37, 2081 );
			AddImage( 17, 107, 2082 );
			AddImage( 17, 177, 2083 );

			AddLabel( 35, 35, 1371, from.Name );
			AddLabel( 35, 55, 1365, "Requests that you help him to defeat" );
			AddLabel( 35, 75, 1365, "the champion" );
			AddLabel( 120, 75, 1371, name );
			AddLabel( 35, 95, 1365, "It is said to hold powerful artifacts" );
			AddLabel( 35, 115, 1365, "that you, if you are lucky, can obtain." );

			AddLabel( 35, 155, 1365, "Accept?" );
			AddLabel( 170, 155, 1365, "Yes:" );
			AddButton( 200, 155, 1896, 1895, 1, GumpButtonType.Reply, 0 );

			AddLabel( 225, 155, 1365, "No:" );
			AddButton( 250, 155, 1896, 1895, 0, GumpButtonType.Reply, 0 );
		}
Ejemplo n.º 6
0
			protected override void OnTarget( Mobile from, object targeted )
			{
				IPoint3D p = targeted as IPoint3D;

				if ( p == null )
					return;
				else if ( p is Item )
					p = ((Item)p).GetWorldTop();

				if ( m_First )
				{
					from.SendMessage( "Target another location to complete the bounding box." );
					from.Target = new PickTarget( new Point3D( p ), false, from.Map, m_Callback, m_State );
				}
				else if ( from.Map != m_Map )
				{
					from.SendMessage( "Both locations must reside on the same map." );
				}
				else if ( m_Map != null && m_Map != Map.Internal && m_Callback != null )
				{
					Point3D start = m_Store;
					Point3D end = new Point3D( p );

					Utility.FixPoints( ref start, ref end );

					m_Callback( from, m_Map, start, end, m_State );
				}
			}
Ejemplo n.º 7
0
 public override bool AllowHousing( Mobile from, Point3D p )
 {
     if ( from.AccessLevel == AccessLevel.Player )
         return false;
     else
         return true;
 }
Ejemplo n.º 8
0
		public override void OnLocationChange( Point3D oldLocation )
		{
			if ( m_Item != null )
				m_Item.Location = new Point3D( X, Y + 1, Z );
			if ( m_Item2 != null )
				m_Item2.Location = new Point3D( X, Y + 2, Z );
		}
Ejemplo n.º 9
0
		public bool ValidatePlacement( Mobile from, Point3D loc )
		{
			if ( from.AccessLevel >= AccessLevel.GameMaster )
				return true;

			if ( !from.InRange( this.GetWorldLocation(), 1 ) )
			{
				from.SendLocalizedMessage( 500446 ); // That is too far away.
				return false;
			}

			Map map = from.Map;

			if ( map == null )
				return false;

			BaseHouse house = BaseHouse.FindHouseAt( loc, map, 20 );

			if ( house != null && !house.IsFriend( from ) )
			{
				from.SendLocalizedMessage(500269); // You cannot build that there.
				return false;
			}

			if ( !map.CanFit( loc, 20 ) )
			{
				from.SendLocalizedMessage( 500269 ); // You cannot build that there.
				return false;
			}

			return true;
		}
Ejemplo n.º 10
0
		public override void OnMovement( Mobile m, Point3D oldLocation )
		{
			if ( TurnedOn && IsLockedDown && (!m.Hidden || m.AccessLevel == AccessLevel.Player) && Utility.InRange( m.Location, this.Location, 2 ) && !Utility.InRange( oldLocation, this.Location, 2 ) )
				Effects.PlaySound( Location, Map, m_Sounds[ Utility.Random( m_Sounds.Length ) ] );
				
			base.OnMovement( m, oldLocation );
		}
Ejemplo n.º 11
0
        public static void FireWall( Mobile from, Mobile target )
        {
            Effects.SendPacket( from.Location, from.Map, new FlashEffect( FlashType.LightFlash ) );
            Effects.PlaySound( from.Location, from.Map, 0x44B );

            Direction d = from.GetDirectionTo( target );

            int dx, dy;
            bool diagonal;

            GetDirectionOffset( d, out dx, out dy, out diagonal );

            int length = 1 + (int) Math.Min( from.GetDistanceToSqrt( target ), 10 );

            for ( int i = 0; i < length; i++ )
            {
                int x = from.Location.X + ( dx * i );
                int y = from.Location.Y + ( dy * i );

                Point3D loc = new Point3D( x, y, from.Location.Z );

                TimeSpan duration = TimeSpan.FromSeconds( 100.0 - ( i * 9.0 ) );

                if ( d == Direction.West || d == Direction.East || diagonal )
                    new FireFieldItem( from, loc, from.Map, 0x398C, duration );

                if ( d == Direction.North || d == Direction.South || diagonal )
                    new FireFieldItem( from, loc, from.Map, 0x3996, duration );
            }
        }
Ejemplo n.º 12
0
		public override bool ClickTitle{ get{ return false; } } // Do not display title in OnSingleClick

		public override void OnMovement( Mobile m, Point3D oldLocation )
		{
			if ( InRange( m, 4 ) && !InRange( oldLocation, 4 ) )
			{
				CheckForNeeds ( m );
			}
		}
Ejemplo n.º 13
0
		public SlimyOintmentTrammel()
			: base( 0x318E )
		{
			Mapa = Map.Trammel;
			Hue = 1109;
			EnterPoint = new Point3D( 6519, 382, 0 );
		}
Ejemplo n.º 14
0
			public SignEntry( string text, Point3D pt, int itemID, int mapLoc )
			{
				m_Text = text;
				m_Location = pt;
				m_ItemID = itemID;
				m_Map = mapLoc;
			}
Ejemplo n.º 15
0
		public override bool OnMoveInto( Mobile m, Direction d, Point3D newLocation, Point3D oldLocation )
		{
			if ( m.AccessLevel > AccessLevel.Player || Contains( oldLocation ) )
				return true;

            // do they have enough faction to enter?
            XmlMobFactions a = (XmlMobFactions)XmlAttach.FindAttachment(m, typeof(XmlMobFactions));
            
            if(a == null) return false;
            
            int fac = a.GetFactionLevel(m_FactionType);
            
            if(fac < FactionLevel)
            {
                // throttle message display
                if(DateTime.Now - m_lastmsg > TimeSpan.FromSeconds(1))
                {
                    m.SendMessage("Your {0} faction is too low to enter here", FactionType);
                    m_lastmsg = DateTime.Now;
                }
                return false;
            }

			return true;
		}
Ejemplo n.º 16
0
		public CompassDirectionGump(Mobile from) : base(120, 50)
		{
			m_From = from;
            List<Point3D> pointList = Server.Regions.MazeOfDeathRegion.Path;
			
			Point3D cur = m_From.Location;
			Point3D northLoc = new Point3D(cur.X, cur.Y - 1, cur.Z);
			Point3D eastLoc = new Point3D(cur.X + 1, cur.Y, cur.Z);
			Point3D southLoc = new Point3D(cur.X, cur.Y + 1, cur.Z);
			Point3D westLoc = new Point3D(cur.X - 1, cur.Y, cur.Z);
			
			//this.Closable = false;
			
			//Empty radar
			AddImage(0, 0, 9007);
			
			//Arrows
			if(pointList.Contains(northLoc))
				AddImage(100, 50, 4501);
			
			if(pointList.Contains(eastLoc))
				AddImage(100, 100, 4503);

			if(pointList.Contains(southLoc))
				AddImage(50, 100, 4505);
				
			if(pointList.Contains(westLoc))
				AddImage(50, 50, 4507);
		}
Ejemplo n.º 17
0
 public CorgulIslandMap(Point3D pnt)
 {
     Name = "Island Map";
     m_DestinationPoint = pnt;
     AddWorldPin(pnt.X, pnt.Y);
     Protected = true;
 }
Ejemplo n.º 18
0
        public override void OnLocationChange(Point3D oldlocation)
        {
            base.OnLocationChange(oldlocation);

            if (Component != null)
                Component.Location = new Point3D(this.X - 1, this.Y, this.Z);
        }
Ejemplo n.º 19
0
        public override void OnExplode( Mobile source, Item itemSource, int intensity, Point3D loc, Map map )
        {
            Server.Effects.PlaySound( loc, map, 0x22F );

            int radius = 2; // for anything that's calling this, and is not a bomb
            if ( itemSource is BombPotion )
            {
                BombPotion bomb = itemSource as BombPotion;
                radius = bomb.ExplosionRange;
            }

            int delay = (int)(intensity * Divisor);
            if ( delay <= 0 )
                delay = 1;
            TimeSpan time = TimeSpan.FromSeconds( delay );

            List<Point3D> circlePoints = CircleHelper.CircleMidpoint( loc.X, loc.Y, loc.Z, radius, true );

            Point3D eye = new Point3D( loc );
            eye.Z += 14;
            foreach( Point3D point in circlePoints )
            {
                Point3D target = new Point3D(point);
                target.Z += 14;
                if ( map.LineOfSight( eye, target ) )
                {
                    FireTile tile = new FireTile( time+TimeSpan.FromSeconds( Utility.RandomDouble()*5 ), source, FireEffectType );
                    tile.MoveToWorld( point, map );
                    tile.AddCurrentOccupants();
                }
            }
        }
		public ShimmeringEffusionActivationFelucca()
			: base( 0xE27 )
		{
			Hue = 0;
			Mapa = Map.Felucca;
			EnterPoint = new Point3D( 6523, 139, -20 );
		}
Ejemplo n.º 21
0
		public void SpawnPixies( Mobile target )
		{
			Map map = this.Map;

			if ( map == null )
				return;

			int newPixies = Utility.RandomMinMax( 3, 6 );

			for ( int i = 0; i < newPixies; ++i )
			{
				Pixie pixie = new Pixie();

				pixie.Team = this.Team;
				pixie.FightMode = FightMode.Closest;

				bool validLocation = false;
				Point3D loc = this.Location;

				for ( int j = 0; !validLocation && j < 10; ++j )
				{
					int x = X + Utility.Random( 3 ) - 1;
					int y = Y + Utility.Random( 3 ) - 1;
					int z = map.GetAverageZ( x, y );

					if ( validLocation = map.CanFit( x, y, this.Z, 16, false, false ) )
						loc = new Point3D( x, y, Z );
					else if ( validLocation = map.CanFit( x, y, z, 16, false, false ) )
						loc = new Point3D( x, y, z );
				}

				pixie.MoveToWorld( loc, map );
				pixie.Combatant = target;
			}
		}
Ejemplo n.º 22
0
		public virtual void Explode( Mobile from, Point3D loc, Map map )
		{
			if ( Deleted || map == null )
				return;

			Consume();
			
			// Check if any other players are using this potion
			for ( int i = 0; i < m_Users.Count; i ++ )
			{
				ThrowTarget targ = m_Users[ i ].Target as ThrowTarget;

				if ( targ != null && targ.Potion == this )
					Target.Cancel( from );
			}

			// Effects
			Effects.PlaySound( loc, map, 0x20C );

			for ( int i = -2; i <= 2; i ++ )
			{
				for ( int j = -2; j <= 2; j ++ )
				{
					Point3D p = new Point3D( loc.X + i, loc.Y + j, loc.Z );

					if ( map.CanFit( p, 12, true, false ) && from.InLOS( p ) )
						new InternalItem( from, p, map, MinDamage, MaxDamage );
				}
			}
		}
Ejemplo n.º 23
0
        public override void OnMovement( Mobile mobile, Point3D oldLocation )
        {
            if ( Alive )
            {
                DestroyerGargoyle mHeal = null;

                foreach ( Mobile m in this.GetMobilesInRange( 10 ) )
                {
                    if ( m is DestroyerGargoyle )
                    {
                        mHeal = (DestroyerGargoyle) m;
                        break;
                    }
                }

                if ( mHeal != null && mHeal.Mana >= 11 && ( this.Hits < ( this.HitsMax - 50 ) ) && !( this.Poisoned || Server.Items.MortalStrike.IsWounded( this ) ) && ( mHeal.CanSee( this ) ) )
                {
                    int toHeal = (int) ( mHeal.Skills[SkillName.Magery].Value * 0.4 );
                    toHeal += Utility.Random( 1, 10 );
                    mHeal.Mana -= 11;

                    this.Heal( toHeal );

                    this.FixedParticles( 0x376A, 9, 32, 5030, EffectLayer.Waist );
                    this.PlaySound( 0x202 );
                }
            }

            base.OnMovement( mobile, oldLocation );
        }
Ejemplo n.º 24
0
		public static bool CheckMulti( Point3D p, Map map, bool houses, int housingrange )
		{
			if( map == null || map == Map.Internal )
				return false;

			Sector sector = map.GetSector( p.X, p.Y );

			for( int i = 0; i < sector.Multis.Count; ++i )
			{
				BaseMulti multi = sector.Multis[i];

				if( multi is BaseHouse )
				{
					BaseHouse bh = (BaseHouse)multi;

					if( ( houses && bh.IsInside( p, 16 ) ) || ( housingrange > 0 && bh.InRange( p, housingrange ) ) )
						return true;
				}
				else if( multi.Contains( p ))
				{
					return true;
				}
			}
			
			return false;
		}
Ejemplo n.º 25
0
        public MovementPath(Mobile m, Point3D goal)
        {
            Point3D start = m.Location;
            Map map = m.Map;

            this.m_Map = map;
            this.m_Start = start;
            this.m_Goal = goal;

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

            if (Utility.InRange(start, goal, 1))
                return;

            try
            {
                PathAlgorithm alg = m_OverrideAlgorithm;

                if (alg == null)
                {
                    alg = FastAStarAlgorithm.Instance;
                    //if ( !alg.CheckCondition( m, map, start, goal ) )	// SlowAstar is still broken
                    //	alg = SlowAStarAlgorithm.Instance;		// TODO: Fix SlowAstar
                }

                if (alg != null && alg.CheckCondition(m, map, start, goal))
                    this.m_Directions = alg.Find(m, map, start, goal);
            }
            catch (Exception e)
            {
                Console.WriteLine("Warning: {0}: Pathing error from {1} to {2}", e.GetType().Name, start, goal);
            }
        }
Ejemplo n.º 26
0
		public void RegisterToBoardGameControlItem( BoardGameControlItem boardgamecontrolitem, Point3D offset )
		{
			BoardGameControlItem = boardgamecontrolitem;
			Offset = offset;
			
			UpdatePosition();
		}
Ejemplo n.º 27
0
		public override void OnLocationChange( Point3D oldLocation )
		{
			base.OnLocationChange( oldLocation );
			
			if ( m_Parrot != null )
				m_Parrot.Location = new Point3D( X, Y, Z + 12 );
		}		
Ejemplo n.º 28
0
 public DecoreItemInfo( string typestring, string name, int itemid, int hue, Point3D loc, Map map )
 {
     c_TypeString = typestring;
     c_ItemID = itemid;
     c_Location = loc;
     c_Map = map;
 }
		public ShimmeringEffusionActivationTrammel()
			: base( 0xE27 )
		{
			Hue = 0;
			Mapa = Map.Trammel;
			EnterPoint = new Point3D( 6523, 139, -20 );
		}
Ejemplo n.º 30
0
        public PageEntry( Mobile sender, string message, PageType type )
        {
            m_Sender = sender;
            m_Sent = DateTime.Now;
            m_Message = Utility.FixHtml( message );
            m_Type = type;
            m_PageLocation = sender.Location;
            m_PageMap = sender.Map;

            PlayerMobile pm = sender as PlayerMobile;
            if ( pm != null && pm.SpeechLog != null && Array.IndexOf( SpeechLogAttachment, type ) >= 0 )
                m_SpeechLog = new List<SpeechLogEntry>( pm.SpeechLog );

            m_Timer = new InternalTimer( this );
            m_Timer.Start();

            StaffHistory history = Reports.Reports.StaffHistory;

            if ( history != null )
            {
                m_PageInfo = new PageInfo( this );

                history.AddPage( m_PageInfo );
            }
        }
Ejemplo n.º 31
0
 public virtual bool OnMoveInto(Mobile m, Direction d, Point3D newLocation, Point3D oldLocation)
 {
     return(m.WalkRegion == null || AcceptsSpawnsFrom(m.WalkRegion));
 }
Ejemplo n.º 32
0
 public void AddUsedObject(string name, Point3D point)
 {
     AddUsedObject(name, point.X, point.Y, point.Z);
 }
Ejemplo n.º 33
0
 public bool Check(Point3D loc, Point3D goal, int range) =>
 Utility.InRange(loc, goal, range) && (range > 1 || Math.Abs(loc.Z - goal.Z) < 16);
Ejemplo n.º 34
0
        public Region(XmlElement xml, Map map, Region parent)
        {
            Map     = map;
            Parent  = parent;
            Dynamic = false;

            if (Parent == null)
            {
                ChildLevel = 0;
                m_Priority = DefaultPriority;
            }
            else
            {
                ChildLevel = Parent.ChildLevel + 1;
                m_Priority = Parent.Priority;
            }

            ReadString(xml, "name", ref m_Name, false);

            if (parent == null)
            {
                ReadInt32(xml, "priority", ref m_Priority, false);
            }


            int minZ = MinZ;
            int maxZ = MaxZ;

            XmlElement zrange = xml["zrange"];

            ReadInt32(zrange, "min", ref minZ, false);
            ReadInt32(zrange, "max", ref maxZ, false);


            List <Rectangle3D> area = new List <Rectangle3D>();

            foreach (XmlElement xmlRect in xml.SelectNodes("rect"))
            {
                Rectangle3D rect = new Rectangle3D();
                if (ReadRectangle3D(xmlRect, minZ, maxZ, ref rect))
                {
                    area.Add(rect);
                }
            }

            Area = area.ToArray();

            if (Area.Length == 0)
            {
                log.Warning("Empty area for region '{0}'", this);
            }


            if (!ReadPoint3D(xml["go"], map, ref m_GoLocation, false) && Area.Length > 0)
            {
                Point3D start = Area[0].Start;
                Point3D end   = Area[0].End;

                int x = start.X + (end.X - start.X) / 2;
                int y = start.Y + (end.Y - start.Y) / 2;

                m_GoLocation = new Point3D(x, y, Map.GetAverageZ(x, y));
            }


            object oMusic = this.DefaultMusic;

            ReadEnum(xml["music"], "name", typeof(MusicName), ref oMusic, false);

            Music = (MusicName)oMusic;

            if (xml.Attributes["CannotDrop"] != null)
            {
                XmlAttribute attr = xml.Attributes["CannotDrop"];
                this.CannotDrop = Convert.ToBoolean(attr.Value);
            }
        }
Ejemplo n.º 35
0
 public MovementPath(Mobile m, Point3D goal)
     : this(m, goal, m.Map)
 {
 }
Ejemplo n.º 36
0
 public static void InvokeOnTeleportMovement(Mobile from, Point3D oldPosition, Point3D newPosition)
 {
     OnTeleportMovement?.Invoke(from, oldPosition, newPosition);
 }
Ejemplo n.º 37
0
 public override void Write(Point3D value)
 {
     Write(value.m_X);
     Write(value.m_Y);
     Write(value.m_Z);
 }
Ejemplo n.º 38
0
 public abstract void Write(Point3D value);
Ejemplo n.º 39
0
 public void Write(Point3D value)
 {
   Write(value.m_X);
   Write(value.m_Y);
   Write(value.m_Z);
 }
Ejemplo n.º 40
0
        public Region(XmlElement xml, Map map, Region parent)
        {
            m_Map     = map;
            m_Parent  = parent;
            m_Dynamic = false;

            if (m_Parent == null)
            {
                m_ChildLevel = 0;
                m_Priority   = DefaultPriority;
            }
            else
            {
                m_ChildLevel = m_Parent.ChildLevel + 1;
                m_Priority   = m_Parent.Priority;
            }

            ReadString(xml, "name", ref m_Name, false);

            if (parent == null)
            {
                ReadInt32(xml, "priority", ref m_Priority, false);
            }


            int minZ = MinZ;
            int maxZ = MaxZ;

            XmlElement zrange = xml["zrange"];

            ReadInt32(zrange, "min", ref minZ, false);
            ReadInt32(zrange, "max", ref maxZ, false);


            List <Rectangle3D> area = new List <Rectangle3D>();

            foreach (XmlElement xmlRect in xml.SelectNodes("rect"))
            {
                Rectangle3D rect = new Rectangle3D();
                if (ReadRectangle3D(xmlRect, minZ, maxZ, ref rect))
                {
                    area.Add(rect);
                }
            }

            m_Area = area.ToArray();

            if (m_Area.Length == 0)
            {
                Console.WriteLine("Empty area for region '{0}'", this);
            }


            if (!ReadPoint3D(xml["go"], map, ref m_GoLocation, false) && m_Area.Length > 0)
            {
                Point3D start = m_Area[0].Start;
                Point3D end   = m_Area[0].End;

                int x = start.X + (end.X - start.X) / 2;
                int y = start.Y + (end.Y - start.Y) / 2;

                m_GoLocation = new Point3D(x, y, m_Map.GetAverageZ(x, y));
            }


            MusicName music = this.DefaultMusic;

            ReadEnum(xml["music"], "name", ref music, false);

            m_Music = music;
        }
Ejemplo n.º 41
0
 public void MoveTo(string name, Point3D point)
 {
     MoveTo(name, point.X, point.Y, point.Z);
 }
Ejemplo n.º 42
0
		public Sector GetSector( Point3D p )
		{
			return InternalGetSector( p.m_X >> SectorShift, p.m_Y >> SectorShift );
		}
Ejemplo n.º 43
0
 public static bool ReadPoint3D(XmlElement xml, Map map, ref Point3D value)
 {
     return(ReadPoint3D(xml, map, ref value, true));
 }
Ejemplo n.º 44
0
		public bool CanSpawnMobile( Point3D p )
		{
			return CanSpawnMobile( p.m_X, p.m_Y, p.m_Z );
		}
Ejemplo n.º 45
0
		public Sector GetMultiMaxSector( Point3D loc, MultiComponentList mcl )
		{
			return GetSector( Bound( new Point2D( loc.m_X + mcl.Max.m_X, loc.m_Y + mcl.Max.m_Y ) ) );
		}
Ejemplo n.º 46
0
		public bool CanFit( Point3D p, int height, bool checkBlocksFit, bool checkMobiles )
		{
			return CanFit( p.m_X, p.m_Y, p.m_Z, height, checkBlocksFit, checkMobiles, true );
		}
Ejemplo n.º 47
0
		/* This could be probably be re-implemented if necessary (perhaps via an ITile interface?).
		public List<Tile> GetTilesAt( Point2D p, bool items, bool land, bool statics )
		{
			List<Tile> list = new List<Tile>();

			if ( this == Map.Internal )
				return list;

			if ( land )
				list.Add( Tiles.GetLandTile( p.m_X, p.m_Y ) );

			if ( statics )
				list.AddRange( Tiles.GetStaticTiles( p.m_X, p.m_Y, true ) );

			if ( items )
			{
				Sector sector = GetSector( p );

				foreach ( Item item in sector.Items )
					if ( item.AtWorldPoint( p.m_X, p.m_Y ) )
						list.Add( new StaticTile( (ushort)item.ItemID, (sbyte) item.Z ) );
			}

			return list;
		}
		*/

		/// <summary>
		/// Gets the highest surface that is lower than <paramref name="p"/>.
		/// </summary>
		/// <param name="p">The reference point.</param>
		/// <returns>A surface <typeparamref name="Tile"/> or <typeparamref name="Item"/>.</returns>
		public object GetTopSurface( Point3D p )
		{
			if ( this == Map.Internal )
				return null;

			object surface = null;
			int surfaceZ = int.MinValue;


			LandTile lt = Tiles.GetLandTile( p.X, p.Y );

			if ( !lt.Ignored )
			{
				int avgZ = GetAverageZ( p.X, p.Y );

				if ( avgZ <= p.Z )
				{
					surface = lt;
					surfaceZ = avgZ;

					if ( surfaceZ == p.Z )
						return surface;
				}
			}


			StaticTile[] staticTiles = Tiles.GetStaticTiles( p.X, p.Y, true );

			for ( int i = 0; i < staticTiles.Length; i++ )
			{
				StaticTile tile = staticTiles[i];
				ItemData id = TileData.ItemTable[tile.ID & TileData.MaxItemValue];

				if ( id.Surface || ( id.Flags & TileFlag.Wet ) != 0 )
				{
					int tileZ = tile.Z + id.CalcHeight;

					if ( tileZ > surfaceZ && tileZ <= p.Z )
					{
						surface = tile;
						surfaceZ = tileZ;

						if ( surfaceZ == p.Z )
							return surface;
					}
				}
			}


			Sector sector = GetSector( p.X, p.Y );

			for ( int i = 0; i < sector.Items.Count; i++ )
			{
				Item item = sector.Items[i];

				if ( !(item is BaseMulti) && item.ItemID <= TileData.MaxItemValue && item.AtWorldPoint( p.X, p.Y ) && !item.Movable )
				{
					ItemData id = item.ItemData;

					if ( id.Surface || ( id.Flags & TileFlag.Wet ) != 0 )
					{
						int itemZ = item.Z + id.CalcHeight;

						if ( itemZ > surfaceZ && itemZ <= p.Z )
						{
							surface = item;
							surfaceZ = itemZ;

							if ( surfaceZ == p.Z )
								return surface;
						}
					}
				}
			}


			return surface;
		}
Ejemplo n.º 48
0
		public static bool InUpdateRange(Point3D p1, Point3D p2)
		{
			int range = Core.GlobalUpdateRange;

			return p1.m_X >= p2.m_X - range && p1.m_X <= p2.m_X + range && p1.m_Y >= p2.m_Y - range && p1.m_Y <= p2.m_Y + range;
		}
Ejemplo n.º 49
0
		public bool CanFit( Point3D p, int height )
		{
			return CanFit( p.m_X, p.m_Y, p.m_Z, height, false, true, true );
		}
Ejemplo n.º 50
0
 public static bool CanTravelTo(Mobile m, Point3D p, Map map)
 {
     return !(Region.Find(p, map) is DungeonRegion) && !SpellHelper.IsAnyT2A(map, p) && !SpellHelper.IsIlshenar(map, p);
 }
Ejemplo n.º 51
0
		public bool LineOfSight( Point3D org, Point3D dest )
		{
			if( this == Map.Internal )
				return false;

			if( !Utility.InRange( org, dest, m_MaxLOSDistance ) )
				return false;

			Point3D start = org;
			Point3D end = dest;

			if( org.X > dest.X || (org.X == dest.X && org.Y > dest.Y) || (org.X == dest.X && org.Y == dest.Y && org.Z > dest.Z) )
			{
				Point3D swap = org;
				org = dest;
				dest = swap;
			}

			double rise, run, zslp;
			double sq3d;
			double x, y, z;
			int xd, yd, zd;
			int ix, iy, iz;
			int height;
			bool found;
			Point3D p;
			Point3DList path = m_PathList;
			TileFlag flags;

			if( org == dest )
				return true;

			if( path.Count > 0 )
				path.Clear();

			xd = dest.m_X - org.m_X;
			yd = dest.m_Y - org.m_Y;
			zd = dest.m_Z - org.m_Z;
			zslp = Math.Sqrt( xd * xd + yd * yd );
			if( zd != 0 )
				sq3d = Math.Sqrt( zslp * zslp + zd * zd );
			else
				sq3d = zslp;

			rise = ((float)yd) / sq3d;
			run = ((float)xd) / sq3d;
			zslp = ((float)zd) / sq3d;

			y = org.m_Y;
			z = org.m_Z;
			x = org.m_X;
			while( Utility.NumberBetween( x, dest.m_X, org.m_X, 0.5 ) && Utility.NumberBetween( y, dest.m_Y, org.m_Y, 0.5 ) && Utility.NumberBetween( z, dest.m_Z, org.m_Z, 0.5 ) )
			{
				ix = (int)Math.Round( x );
				iy = (int)Math.Round( y );
				iz = (int)Math.Round( z );
				if( path.Count > 0 )
				{
					p = path.Last;

					if( p.m_X != ix || p.m_Y != iy || p.m_Z != iz )
						path.Add( ix, iy, iz );
				}
				else
				{
					path.Add( ix, iy, iz );
				}
				x += run;
				y += rise;
				z += zslp;
			}

			if( path.Count == 0 )
				return true;//<--should never happen, but to be safe.

			p = path.Last;

			if( p != dest )
				path.Add( dest );

			Point3D pTop = org, pBottom = dest;
			Utility.FixPoints( ref pTop, ref pBottom );

			int pathCount = path.Count;

			for( int i = 0; i < pathCount; ++i )
			{
				Point3D point = path[i];

				LandTile landTile = Tiles.GetLandTile( point.X, point.Y );
				int landZ = 0, landAvg = 0, landTop = 0;
				GetAverageZ( point.m_X, point.m_Y, ref landZ, ref landAvg, ref landTop );

				if( landZ <= point.m_Z && landTop >= point.m_Z && (point.m_X != end.m_X || point.m_Y != end.m_Y || landZ > end.m_Z || landTop < end.m_Z) && !landTile.Ignored )
					return false;

				/* --Do land tiles need to be checked?  There is never land between two people, always statics.--
				LandTile landTile = Tiles.GetLandTile( point.X, point.Y );
				if ( landTile.Z-1 >= point.Z && landTile.Z+1 <= point.Z && (TileData.LandTable[landTile.ID & TileData.MaxLandValue].Flags & TileFlag.Impassable) != 0 )
					return false;
				*/

				StaticTile[] statics = Tiles.GetStaticTiles( point.m_X, point.m_Y, true );

				bool contains = false;
				int ltID = landTile.ID;

				for( int j = 0; !contains && j < m_InvalidLandTiles.Length; ++j )
					contains = (ltID == m_InvalidLandTiles[j]);

				if( contains && statics.Length == 0 )
				{
					IPooledEnumerable eable = GetItemsInRange( point, 0 );

					foreach( Item item in eable )
					{
						if( item.Visible )
							contains = false;

						if( !contains )
							break;
					}

					eable.Free();

					if( contains )
						return false;
				}

				for( int j = 0; j < statics.Length; ++j )
				{
					StaticTile t = statics[j];

					ItemData id = TileData.ItemTable[t.ID & TileData.MaxItemValue];

					flags = id.Flags;
					height = id.CalcHeight;

					if( t.Z <= point.Z && t.Z + height >= point.Z && (flags & (TileFlag.Window | TileFlag.NoShoot)) != 0 )
					{
						if( point.m_X == end.m_X && point.m_Y == end.m_Y && t.Z <= end.m_Z && t.Z + height >= end.m_Z )
							continue;

						return false;
					}

					/*if ( t.Z <= point.Z && t.Z+height >= point.Z && (flags&TileFlag.Window)==0 && (flags&TileFlag.NoShoot)!=0
						&& ( (flags&TileFlag.Wall)!=0 || (flags&TileFlag.Roof)!=0 || (((flags&TileFlag.Surface)!=0 && zd != 0)) ) )*/
					/*{
						//Console.WriteLine( "LoS: Blocked by Static \"{0}\" Z:{1} T:{3} P:{2} F:x{4:X}", TileData.ItemTable[t.ID&TileData.MaxItemValue].Name, t.Z, point, t.Z+height, flags );
						//Console.WriteLine( "if ( {0} && {1} && {2} && ( {3} || {4} || {5} || ({6} && {7} && {8}) ) )", t.Z <= point.Z, t.Z+height >= point.Z, (flags&TileFlag.Window)==0, (flags&TileFlag.Impassable)!=0, (flags&TileFlag.Wall)!=0, (flags&TileFlag.Roof)!=0, (flags&TileFlag.Surface)!=0, t.Z != dest.Z, zd != 0 ) ;
						return false;
					}*/
				}
			}

			Rectangle2D rect = new Rectangle2D( pTop.m_X, pTop.m_Y, (pBottom.m_X - pTop.m_X) + 1, (pBottom.m_Y - pTop.m_Y) + 1 );

			IPooledEnumerable area = GetItemsInBounds( rect );

			foreach( Item i in area )
			{
				if( !i.Visible )
					continue;

				if( i is BaseMulti || i.ItemID > TileData.MaxItemValue )
					continue;

				ItemData id = i.ItemData;
				flags = id.Flags;

				if( (flags & (TileFlag.Window | TileFlag.NoShoot)) == 0 )
					continue;

				height = id.CalcHeight;

				found = false;

				int count = path.Count;

				for( int j = 0; j < count; ++j )
				{
					Point3D point = path[j];
					Point3D loc = i.Location;

					//if ( t.Z <= point.Z && t.Z+height >= point.Z && ( height != 0 || ( t.Z == dest.Z && zd != 0 ) ) )
					if( loc.m_X == point.m_X && loc.m_Y == point.m_Y &&
						loc.m_Z <= point.m_Z && loc.m_Z + height >= point.m_Z )
					{
						if( loc.m_X == end.m_X && loc.m_Y == end.m_Y && loc.m_Z <= end.m_Z && loc.m_Z + height >= end.m_Z )
							continue;

						found = true;
						break;
					}
				}

				if( !found )
					continue;

				area.Free();
				return false;

				/*if ( (flags & (TileFlag.Impassable | TileFlag.Surface | TileFlag.Roof)) != 0 )

				//flags = TileData.ItemTable[i.ItemID&TileData.MaxItemValue].Flags;
				//if ( (flags&TileFlag.Window)==0 && (flags&TileFlag.NoShoot)!=0 && ( (flags&TileFlag.Wall)!=0 || (flags&TileFlag.Roof)!=0 || (((flags&TileFlag.Surface)!=0 && zd != 0)) ) )
				{
					//height = TileData.ItemTable[i.ItemID&TileData.MaxItemValue].Height;
					//Console.WriteLine( "LoS: Blocked by ITEM \"{0}\" P:{1} T:{2} F:x{3:X}", TileData.ItemTable[i.ItemID&TileData.MaxItemValue].Name, i.Location, i.Location.Z+height, flags );
					area.Free();
					return false;
				}*/
			}

			area.Free();

			return true;
		}
Ejemplo n.º 52
0
 public static bool InUpdateRange(Point3D p1, Point3D p2)
 {
     return((p1.m_X >= (p2.m_X - 18)) && (p1.m_X <= (p2.m_X + 18)) && (p1.m_Y >= (p2.m_Y - 18)) &&
            (p1.m_Y <= (p2.m_Y + 18)));
 }
Ejemplo n.º 53
0
 public Entity(Serial serial, Point3D loc, Map map)
 {
     m_Serial   = serial;
     m_Location = loc;
     m_Map      = map;
 }
Ejemplo n.º 54
0
        public static void Freeze(Mobile from, Map targetMap, Point3D start3d, Point3D end3d)
        {
            Hashtable mapTable = new Hashtable();

            if (start3d == NullP3D && end3d == NullP3D)
            {
                if (targetMap == null)
                {
                    CommandLogging.WriteLine(from, "{0} {1} invoking freeze for every item in every map", from.AccessLevel, CommandLogging.Format(from));
                }
                else
                {
                    CommandLogging.WriteLine(from, "{0} {1} invoking freeze for every item in {0}", from.AccessLevel, CommandLogging.Format(from), targetMap);
                }

                foreach (Item item in World.Items.Values)
                {
                    if (targetMap != null && item.Map != targetMap)
                    {
                        continue;
                    }

                    if (item.Parent != null)
                    {
                        continue;
                    }

                    if (item is Static)
                    {
                        Map itemMap = item.Map;

                        if (itemMap == null || itemMap == Map.Internal)
                        {
                            continue;
                        }

                        Hashtable table = (Hashtable)mapTable[itemMap];

                        if (table == null)
                        {
                            mapTable[itemMap] = table = new Hashtable();
                        }

                        Point2D p = new Point2D(item.X >> 3, item.Y >> 3);

                        DeltaState state = (DeltaState)table[p];

                        if (state == null)
                        {
                            table[p] = state = new DeltaState(p);
                        }

                        state.m_List.Add(item);
                    }
                }
            }
            else if (targetMap != null)
            {
                Point2D start = targetMap.Bound(new Point2D(start3d)), end = targetMap.Bound(new Point2D(end3d));

                CommandLogging.WriteLine(from, "{0} {1} invoking freeze from {2} to {3} in {4}", from.AccessLevel, CommandLogging.Format(from), start, end, targetMap);

                IPooledEnumerable eable = targetMap.GetItemsInBounds(new Rectangle2D(start.X, start.Y, end.X - start.X + 1, end.Y - start.Y + 1));

                foreach (Item item in eable)
                {
                    if (item is Static)
                    {
                        Map itemMap = item.Map;

                        if (itemMap == null || itemMap == Map.Internal)
                        {
                            continue;
                        }

                        Hashtable table = (Hashtable)mapTable[itemMap];

                        if (table == null)
                        {
                            mapTable[itemMap] = table = new Hashtable();
                        }

                        Point2D p = new Point2D(item.X >> 3, item.Y >> 3);

                        DeltaState state = (DeltaState)table[p];

                        if (state == null)
                        {
                            table[p] = state = new DeltaState(p);
                        }

                        state.m_List.Add(item);
                    }
                }

                eable.Free();
            }

            if (mapTable.Count == 0)
            {
                from.SendGump(new NoticeGump(1060637, 30720, "No freezable items were found.  Only the following item types are frozen:<br> - Static<br> - BaseFloor<br> - BaseWall", 0xFFC000, 320, 240, null, null));
                return;
            }

            bool badDataFile = false;

            int totalFrozen = 0;

            foreach (DictionaryEntry de in mapTable)
            {
                Map       map   = (Map)de.Key;
                Hashtable table = (Hashtable)de.Value;

                TileMatrix matrix = map.Tiles;

                using (FileStream idxStream = OpenWrite(matrix.IndexStream))
                {
                    using (FileStream mulStream = OpenWrite(matrix.DataStream))
                    {
                        if (idxStream == null || mulStream == null)
                        {
                            badDataFile = true;
                            continue;
                        }

                        BinaryReader idxReader = new BinaryReader(idxStream);

                        BinaryWriter idxWriter = new BinaryWriter(idxStream);
                        BinaryWriter mulWriter = new BinaryWriter(mulStream);

                        foreach (DeltaState state in table.Values)
                        {
                            int          oldTileCount;
                            StaticTile[] oldTiles = ReadStaticBlock(idxReader, mulStream, state.m_X, state.m_Y, matrix.BlockWidth, matrix.BlockHeight, out oldTileCount);

                            if (oldTileCount < 0)
                            {
                                continue;
                            }

                            int          newTileCount = 0;
                            StaticTile[] newTiles     = new StaticTile[state.m_List.Count];

                            for (int i = 0; i < state.m_List.Count; ++i)
                            {
                                Item item = state.m_List[i];

                                int xOffset = item.X - (state.m_X * 8);
                                int yOffset = item.Y - (state.m_Y * 8);

                                if (xOffset < 0 || xOffset >= 8 || yOffset < 0 || yOffset >= 8)
                                {
                                    continue;
                                }

                                StaticTile newTile = new StaticTile((ushort)item.ItemID, (byte)xOffset, (byte)yOffset, (sbyte)item.Z, (short)item.Hue);

                                newTiles[newTileCount++] = newTile;

                                item.Delete();

                                ++totalFrozen;
                            }

                            int mulPos = -1;
                            int length = -1;
                            int extra  = 0;

                            if ((oldTileCount + newTileCount) > 0)
                            {
                                mulWriter.Seek(0, SeekOrigin.End);

                                mulPos = (int)mulWriter.BaseStream.Position;
                                length = (oldTileCount + newTileCount) * 7;
                                extra  = 1;

                                for (int i = 0; i < oldTileCount; ++i)
                                {
                                    StaticTile toWrite = oldTiles[i];

                                    mulWriter.Write((ushort)toWrite.ID);
                                    mulWriter.Write((byte)toWrite.X);
                                    mulWriter.Write((byte)toWrite.Y);
                                    mulWriter.Write((sbyte)toWrite.Z);
                                    mulWriter.Write((short)toWrite.Hue);
                                }

                                for (int i = 0; i < newTileCount; ++i)
                                {
                                    StaticTile toWrite = newTiles[i];

                                    mulWriter.Write((ushort)toWrite.ID);
                                    mulWriter.Write((byte)toWrite.X);
                                    mulWriter.Write((byte)toWrite.Y);
                                    mulWriter.Write((sbyte)toWrite.Z);
                                    mulWriter.Write((short)toWrite.Hue);
                                }

                                mulWriter.Flush();
                            }

                            int idxPos = ((state.m_X * matrix.BlockHeight) + state.m_Y) * 12;

                            idxWriter.Seek(idxPos, SeekOrigin.Begin);
                            idxWriter.Write(mulPos);
                            idxWriter.Write(length);
                            idxWriter.Write(extra);

                            idxWriter.Flush();

                            matrix.SetStaticBlock(state.m_X, state.m_Y, null);
                        }
                    }
                }
            }

            if (totalFrozen == 0 && badDataFile)
            {
                from.SendGump(new NoticeGump(1060637, 30720, "Output data files could not be opened and the freeze operation has been aborted.<br><br>This probably means your server and client are using the same data files.  Instructions on how to resolve this can be found in the first warning window.", 0xFFC000, 320, 240, null, null));
            }
            else
            {
                from.SendGump(new NoticeGump(1060637, 30720, String.Format("Freeze operation completed successfully.<br><br>{0} item{1} frozen.<br><br>You must restart your client and update it's data files to see the changes.", totalFrozen, totalFrozen != 1 ? "s were" : " was"), 0xFFC000, 320, 240, null, null));
            }
        }
Ejemplo n.º 55
0
 public static bool InRange(Point3D p1, Point3D p2, int range)
 {
     return((p1.m_X >= (p2.m_X - range)) && (p1.m_X <= (p2.m_X + range)) && (p1.m_Y >= (p2.m_Y - range)) &&
            (p1.m_Y <= (p2.m_Y + range)));
 }
Ejemplo n.º 56
0
 public StateInfo(Map map, Point3D start, Point3D end)
 {
     m_Map   = map;
     m_Start = start;
     m_End   = end;
 }
Ejemplo n.º 57
0
 private static void FreezeBox_Callback(Mobile from, Map map, Point3D start, Point3D end, object state)
 {
     SendWarning(from, "You are about to freeze a section of items.", BaseFreezeWarning, map, start, end, new WarningGumpCallback(FreezeWarning_Callback));
 }
Ejemplo n.º 58
0
 public bool Contains(Point3D loc)
 {
     return(m_Rect.Contains(loc));
 }
Ejemplo n.º 59
0
 public static void SendWarning(Mobile m, string header, string baseWarning, Map map, Point3D start, Point3D end, WarningGumpCallback callback)
 {
     m.SendGump(new WarningGump(1060635, 30720, String.Format(baseWarning, String.Format(header, map)), 0xFFC000, 420, 400, callback, new StateInfo(map, start, end)));
 }