public PCMoongateToll2Gump( Item gate, CityManagementStone outgoingCity, Point3D locdes, Map mapdes ) : base( 50, 50 )
		{
			m_Gate = gate;
			m_Outgoing = outgoingCity;
			m_LocDes = locdes;
			m_MapDes = mapdes;

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

			AddPage(0);

			int incomingTax = 0;
			int outgoingTax = 0;

			if ( outgoingCity != null && outgoingCity.TravelTax >= 1 )
				outgoingTax = outgoingCity.TravelTax;

			int totalTax = incomingTax + outgoingTax;

			AddBackground(23, 27, 276, 269, 5120);
			AddImageTiled(28, 57, 269, 7, 5121);
			AddHtml( 32, 33, 259, 19, @"<BASEFONT COLOR= WHITE><CENTER>Travel Tax Report</CENTER></BASEFONT>", (bool)false, (bool)false);
			AddHtml( 32, 64, 258, 100, @"<CENTER><B>Taxes Info</B></CENTER><BR><BR>You are being taxed for this trip, This total below includes your incoming and outgoing fees, Incoming fees are taxes for the city you are entering, Outgoing fees are taxes for the city you are leaving, You have to pay these taxes each time you enter or leave a player city if that city has a travel tax in place.", (bool)true, (bool)true);
			AddLabel(35, 170, 1149, @"Incoming Tax: " + incomingTax.ToString() );
			AddLabel(35, 190, 1149, @"Outgoing Tax: " + outgoingTax.ToString() );
			AddLabel(35, 210, 1149, @"Total Amount: " + totalTax.ToString() );
			AddImageTiled(28, 235, 269, 7, 5121);
			AddLabel(86, 235, 1149, @"Do you wish to continue?");
			AddButton(89, 260, 247, 248, 1, GumpButtonType.Reply, 0);
			AddButton(165, 260, 241, 242, 2, GumpButtonType.Reply, 0);

		}
		private static void StaExBox_Callback(Mobile mob, Map map, Point3D start, Point3D end, object state)
		{
			object[] states = (object[])state;
			string file = (string)states[0];

			Export(mob, file, new Rectangle2D(new Point2D(start.X, start.Y), new Point2D(end.X+1, end.Y+1)));
		}
		private static int DeleteMoonGate(Map map, Point3D p)
		{
			Queue<Item> m_Queue = new Queue<Item>();

			IPooledEnumerable eable = map.GetItemsInRange(p, 0);

			foreach (Item item in eable)
			{
				if (item is PublicMoongate)
				{
					int delta = item.Z - p.Z;

					if (delta >= -12 && delta <= 12)
						m_Queue.Enqueue(item);
				}
			}

			eable.Free();

			int m_Count = m_Queue.Count;

			while (m_Queue.Count > 0)
				(m_Queue.Dequeue()).Delete();

			return m_Count;
		}
		public Sector( int x, int y, Map owner )
		{
			m_X = x;
			m_Y = y;
			m_Owner = owner;
			m_Active = false;
		}
		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, 0x207 );

			Geometry.Circle2D( loc, map, Radius, new DoEffect_Callback( BlastEffect ), 270, 90 );

			Timer.DelayCall( TimeSpan.FromSeconds( 0.3 ), new TimerStateCallback( CircleEffect2 ), new object[] { loc, map } );

			foreach ( Mobile mobile in map.GetMobilesInRange( loc, Radius ) )
			{
                if (mobile is BaseCreature)
                {
					BaseCreature mon = (BaseCreature) mobile;

					mon.Pacify( from, DateTime.Now + TimeSpan.FromSeconds( 5.0 ) ); // TODO check
				}
			}
		}
Exemple #6
0
        public override bool GetDestination( PlayerMobile player, ref Point3D loc, ref Map map )
        {
            QuestSystem qs = player.Quest;

            if ( qs is EminosUndertakingQuest )
            {
                QuestObjective obj = qs.FindObjective( typeof( TakeBlueTeleporterObjective ) );

                if ( obj != null )
                {
                    if ( X == 423 && Y == 805 && Z == -1 )
                    {
                        loc = new Point3D( 411, 1116, 0 );
                    }

                    if ( X == 411 && Y == 1117 && Z == 0 )
                    {
                        loc = new Point3D( 424, 807, 0 );
                    }

                    map = Map.Malas;
                    return true;
                }
            }

            return false;
        }
Exemple #7
0
        private static void CheckItem( Item item, Map oldMap )
        {
            if ( item.Map == null || item.Map == Map.Internal )
                return;

            if ( !m_Timers.ContainsKey( item ) )
            {
                MoonbindTimer timer = new MoonbindTimer( item );
                timer.Start();

                m_Timers.Add( item, timer );
            }

            Mobile parent = item.Parent as Mobile;

            if ( parent != null )
            {
                bool sendMessage = oldMap != null && oldMap != Map.Internal && ( oldMap == Map.Felucca || item.Map == Map.Felucca );

                if ( sendMessage )
                {
                    if ( item.IsEphemeral() )
                        parent.SendLocalizedMessage( 1153088 ); // The power of the moon Felucca no longer strengthens your Faction gear.
                    else
                        parent.SendLocalizedMessage( 1153087 ); // The power of the moon Felucca strengthens your Faction gear.
                }
            }

            item.InvalidateProperties();
        }
		public QuestCompleteObjectiveRegion( XmlElement xml, Map map, Region parent ) : base( xml, map, parent )
		{
			XmlElement questEl = xml["quest"];

			ReadType( questEl, "type", ref m_Quest );
			ReadType( questEl, "complete", ref m_Objective );
		}
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 2:
				{
					m_Level = reader.ReadInt();
					goto case 1;
				}
				case 1:
				{
					m_TargetMap = reader.ReadMap();
					break;
				}
				case 0:
				{
					m_TargetMap = Map.Trammel;
					break;
				}
			}

			if ( version < 2 )
				m_Level = GetRandomLevel();
		}
 public CraftShopRegion( XmlElement xml, Map map, Region parent )
     : base(xml, map, parent)
 {
     int skill = 0;
     ReadInt32( xml, "skill", ref skill, true );
     m_Skills = (CraftSkillType)skill;
 }
 public SGEFieldSouth(Point3D from, Map map)
     : base(from, map)
 {
     Map = map;
     InternalTimer t = new InternalTimer(this);
     t.Start();
 }
Exemple #12
0
        public FlameOfOrder( Point3D location, Map map )
            : base(0x19AB)
        {
            Movable = false;
            Light = LightType.Circle225;

            MoveToWorld( location, map );

            m_Barriers = new List<EnergyBarrier>( m_BarrierLocations.Length );
            m_Blockers = new List<Blocker>( m_BarrierLocations.Length );
            m_MsgTriggers = new List<SBMessageTrigger>( m_MsgTriggerLocations.Length );

            foreach ( Point3D loc in m_BarrierLocations )
            {
                m_Barriers.Add( new EnergyBarrier( loc, map ) );

                Blocker blocker = new Blocker();
                blocker.MoveToWorld( loc, map );
                m_Blockers.Add( blocker );
            }

            foreach ( Point3D loc in m_MsgTriggerLocations )
            {
                SBMessageTrigger trigger = new SBMessageTrigger( this );
                trigger.MoveToWorld( loc, map );
                m_MsgTriggers.Add( trigger );
            }
        }
Exemple #13
0
		public static bool FindEntity( Type type, Point3D p, Map map, bool mob )
		{
			IPooledEnumerable loc;
			Rectangle2D rect = new Rectangle2D( p.X, p.Y, 1, 1 );
			if( mob )
				loc = map.GetMobilesInBounds( rect );
			else
				loc = map.GetItemsInBounds( rect );

			bool found = false;

			try
			{
				foreach( object o in loc )
					if( o != null && o.GetType() == type || o.GetType().IsSubclassOf( type ) )
					{
						found = true;
						break;
					}
			}
			catch
			{
			}

			loc.Free();

			return found;
		}
		public static void RegisterMap( int mapIndex, int mapID, int fileIndex, int width, int height, int season, string name, MapRules rules )
		{
			Map newMap = new Map( mapID, mapIndex, fileIndex, width, height, season, name, rules );

			Map.Maps[mapIndex] = newMap;
			Map.AllMaps.Add( newMap );
		}
        private const int Range = 5;// No house may be placed within 5 tiles of the treasure
        public TreasureRegion(int x, int y, Map map)
            : base(null, map, Region.DefaultPriority, new Rectangle2D(x - Range, y - Range, 1 + (Range * 2), 1 + (Range * 2)))
        {
            this.GoLocation = new Point3D(x, y, map.GetAverageZ(x, y));

            this.Register();
        }
Exemple #16
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();
                }
            }
        }
		private static bool GetFloorZ( Map map, int x, int y, out int z )
		{
            LandTile lt = map.Tiles.GetLandTile(x, y);

			if ( IsFloor( lt.ID ) && map.CanFit( x, y, lt.Z, 16, false, false ) )
			{
				z = lt.Z;
				return true;
			}

            StaticTile[] tiles = map.Tiles.GetStaticTiles(x, y);

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

				if ( IsStaticFloor( t.ID ) && map.CanFit( x, y, t.Z + (id.Surface ? id.CalcHeight : 0), 16, false, false ) )
				{
					z = t.Z + (id.Surface ? id.CalcHeight : 0);
					return true;
				}
			}

			z = 0;
			return false;
		}
		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 );
				}
			}
		}
        public TheHuntRegion(TheHuntStone pTheHuntStone, string name, Map map, Rectangle2D[] area)
            : base(name, map, 50, area)
        {
            this.TheHuntStone = pTheHuntStone;

            this.playerMobileBackupList = new List<Mobile>();
        }
        public void OnTarget( Mobile from, Map map, Point3D start, Point3D end, object state )
        {
            try
            {
                object[] states = (object[]) state;
                BaseCommand command = (BaseCommand) states[0];
                string[] args = (string[]) states[1];

                ObjectConditional cond = ObjectConditional.Parse( from, ref args );

                Rectangle2D rect = new Rectangle2D( start.X, start.Y, end.X - start.X + 1, end.Y - start.Y + 1 );

                bool items, mobiles;

                if ( !CheckObjectTypes( command, cond, out items, out mobiles ) )
                {
                    return;
                }

                IEnumerable<object> eable;

                if ( items && mobiles )
                {
                    eable = map.GetObjectsInBounds( rect );
                }
                else if ( items )
                {
                    eable = map.GetItemsInBounds( rect );
                }
                else if ( mobiles )
                {
                    eable = map.GetMobilesInBounds( rect );
                }
                else
                {
                    return;
                }

                ArrayList objs = new ArrayList();

                foreach ( object obj in eable )
                {
                    if ( mobiles && obj is Mobile && !BaseCommand.IsAccessible( from, obj ) )
                    {
                        continue;
                    }

                    if ( cond.CheckCondition( obj ) )
                    {
                        objs.Add( obj );
                    }
                }

                RunCommand( from, objs, command, args );
            }
            catch ( Exception ex )
            {
                from.SendMessage( ex.Message );
            }
        }
        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 );
            }
        }
        public CustomRegion( RegionControl m, Map map )
            : base("", "Custom Region", map, typeof( WarriorGuard ))
        {
            LoadFromXml = false;

            m_Controller = m;
        }
		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;
		}
		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 );
			}
			
			// Add delay
			AddDelay( from );
			
			// Effects		
			Effects.PlaySound( loc, map, 0x207 );
			
			EffectCircle( loc, map, Radius );
			
			foreach ( Mobile mobile in map.GetMobilesInRange( loc, Radius ) )
			{
				if ( mobile is BaseCreature )
				{
					BaseCreature mon = (BaseCreature) mobile;
					
					mon.Pacify( from, DateTime.Now + TimeSpan.FromSeconds( 5.0 ) ); // TODO check
				}
			}
		}
 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;
 }
Exemple #26
0
        public static void Add_Static( int itemID, Point3D location, Map map, string name )
        {
            var eable = map.GetItemsInRange( location, 0 );

            foreach ( Item item in eable )
            {
                if ( item is Sign && item.Z == location.Z && item.ItemID == itemID )
                    m_ToDelete.Enqueue( item );
            }

            while ( m_ToDelete.Count > 0 )
                ( (Item) m_ToDelete.Dequeue() ).Delete();

            Item sign;

            if ( name.StartsWith( "#" ) )
            {
                sign = new LocalizedSign( itemID, Utility.ToInt32( name.Substring( 1 ) ) );
            }
            else
            {
                sign = new Sign( itemID );
                sign.Name = name;
            }

            if ( map == Map.Malas )
            {
                if ( location.X >= 965 && location.Y >= 502 && location.X <= 1012 && location.Y <= 537 )
                    sign.Hue = 0x47E;
                else if ( location.X >= 1960 && location.Y >= 1278 && location.X < 2106 && location.Y < 1413 )
                    sign.Hue = 0x44E;
            }

            sign.MoveToWorld( location, map );
        }
Exemple #27
0
		public EffectInfo(
			IPoint3D source,
			Map map,
			int effectID,
			int hue = 0,
			int speed = 10,
			int duration = 10,
			EffectRender render = EffectRender.Normal,
			TimeSpan? delay = null,
			Action callback = null)
		{
			Map = map;
			EffectID = effectID;
			Hue = hue;
			Speed = speed;
			Duration = duration;
			Render = render;
			Delay = delay ?? TimeSpan.Zero;

			if (callback != null)
			{
				Callback += callback;
			}

			SetSource(source);
		}
        public static void PlaySound( IPoint3D p, Map map, int soundID )
        {
            if ( soundID <= -1 )
                return;

            if ( map != null )
            {
                Packet playSound = null;

                IPooledEnumerable eable = map.GetClientsInRange( new Point3D( p ) );

                foreach ( NetState state in eable )
                {
                    state.Mobile.ProcessDelta();

                    if ( playSound == null )
                        playSound = Packet.Acquire( new PlaySound( soundID, p ) );

                    state.Send( playSound );
                }

                Packet.Release( playSound );

                eable.Free();
            }
        }
		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 );
		}
Exemple #30
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);
            }
        }
        public TeleporterPairAddon(IPoint3D first, IPoint3D second, Server.Map map)
        {
            //Set up all the addon components... FirstLocation will be the 0,0,0 reference point
            TeleporterAC tele1 = new TeleporterAC(second, map);

            tele1.Active = true;
            TeleporterAC tele2 = new TeleporterAC(first, map);

            tele2.Active = true;
            //AddonComponent spark1 = new AddonComponent(14201);
            //AddonComponent spark2 = new AddonComponent(14201);


            //First Teleporter
            AddComponent(tele1, 0, 0, 0);
            //AddComponent( spark1, 0, 0, 0 );
            //Second Teleporter
            AddComponent(tele2, second.X - first.X, second.Y - first.Y, second.Z - first.Z);
            //AddComponent( spark2, second.X-first.X, second.Y-first.Y, second.Z-first.Z );
        }
        public TileMatrix(Map owner, int fileIndex, int mapID, int width, int height)
        {
            m_FileShare = new ArrayList();

            for (int i = 0; i < m_Instances.Count; ++i)
            {
                TileMatrix tm = (TileMatrix)m_Instances[i];

                if (tm.m_FileIndex == fileIndex)
                {
                    tm.m_FileShare.Add(this);
                    m_FileShare.Add(tm);
                }
            }

            m_Instances.Add(this);
            m_FileIndex   = fileIndex;
            m_Width       = width;
            m_Height      = height;
            m_BlockWidth  = width >> 3;
            m_BlockHeight = height >> 3;

            m_Owner = owner;

            if (fileIndex != 0x7F)
            {
                string mapPath = Core.FindDataFile("map{0}.mul", fileIndex);

                if (File.Exists(mapPath))
                {
                    m_Map = new FileStream(mapPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
                }

                string indexPath = Core.FindDataFile("staidx{0}.mul", fileIndex);

                if (File.Exists(indexPath))
                {
                    m_Index       = new FileStream(indexPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
                    m_IndexReader = new BinaryReader(m_Index);
                }

                string staticsPath = Core.FindDataFile("statics{0}.mul", fileIndex);

                if (File.Exists(staticsPath))
                {
                    m_Statics = new FileStream(staticsPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
                }
            }

            m_EmptyStaticBlock = new Tile[8][][];

            for (int i = 0; i < 8; ++i)
            {
                m_EmptyStaticBlock[i] = new Tile[8][];

                for (int j = 0; j < 8; ++j)
                {
                    m_EmptyStaticBlock[i][j] = new Tile[0];
                }
            }

            m_InvalidLandBlock = new Tile[196];

            m_LandTiles     = new Tile[m_BlockWidth][][];
            m_StaticTiles   = new Tile[m_BlockWidth][][][][];
            m_StaticPatches = new int[m_BlockWidth][];
            m_LandPatches   = new int[m_BlockWidth][];

            m_Patch = new TileMatrixPatch(this, mapID);
        }
Exemple #33
0
 public abstract void Write(Map value);