public static void UpdateRegion(TownHouseSign sign) { if (sign.House == null) return; #if(RunUO_1_Final) sign.House.Region.Coords = new ArrayList(sign.Blocks); sign.House.Region.MinZ = sign.MinZ; sign.House.Region.MaxZ = sign.MaxZ; sign.House.Region.Unregister(); sign.House.Region.Register(); sign.House.Region.GoLocation = sign.BanLoc; #elif(RunUO_2_RC1) sign.House.UpdateRegion(); Rectangle3D rect = new Rectangle3D(Point3D.Zero, Point3D.Zero); for (int i = 0; i < sign.House.Region.Area.Length; ++i) { rect = sign.House.Region.Area[i]; rect = new Rectangle3D(new Point3D(rect.Start.X - sign.House.X, rect.Start.Y - sign.House.Y, sign.MinZ), new Point3D(rect.End.X - sign.House.X, rect.End.Y - sign.House.Y, sign.MaxZ)); sign.House.Region.Area[i] = rect; } sign.House.Region.Unregister(); sign.House.Region.Register(); sign.House.Region.GoLocation = sign.BanLoc; #endif }
public TRegionEditGump(TSystemStone stone, Rectangle3D rect) : base( stone, 195, "Region Properties" ) { m_Stone = stone; m_Rect = rect; this.AddButton(120, 184, 1209, 9904, (int)Buttons.btnShow, GumpButtonType.Reply, 0); this.AddButton(196, 184, 1209, 9904, (int)Buttons.btnDelete, GumpButtonType.Reply, 0); this.AddButton(279, 184, 1209, 9904, (int)Buttons.btnBack, GumpButtonType.Reply, 0); this.AddLabel(144, 182, 36, @"Show"); this.AddLabel(220, 182, 36, @"Delete"); this.AddLabel(303, 182, 36, @"Back to Management"); this.AddHtml( 105, 215, 447, 21, "<baseFONT color='white'><Center>" + String.Format("Start: {0} | End: {1}", rect.Start, rect.End), (bool)false, (bool)false); }
public CityLandLord( CityManagementStone stone, Rectangle3D[] area, CivicSign sign, Point3D p, Map map ) : base( "Marketkeeper") { Frozen = true; Point3D loc = new Point3D( p.X - 4, p.Y, p.Z ); Location = loc; Direction = Direction.South; Map = map; m_Stone = stone; m_Area = area; m_Sign = sign; m_vendorlist = new List<Mobile>(); UpdateMarketRegion(); CreateRandomVendors( loc, map ); }
private static Rectangle3D[] GetArea( BaseHouse house ) { int x = house.X; int y = house.Y; int z = house.Z; Rectangle2D[] houseArea = house.Area; Rectangle3D[] area = new Rectangle3D[houseArea.Length]; for ( int i = 0; i < area.Length; i++ ) { Rectangle2D rect = houseArea[i]; area[i] = Region.ConvertTo3D( new Rectangle2D( x + rect.Start.X, y + rect.Start.Y, rect.Width, rect.Height ) ); } return area; }
public static void ShowRectBounds(Rectangle3D r, Map m, Mobile from, bool control, bool active) { if (m == Map.Internal || m == null) return; int hue = 0; if(control && active) hue = 0x3F; else if(control && !active) hue = 0x26; else if(!control) hue = 1151; Point3D p1 = new Point3D(r.Start.X, r.Start.Y - 1, from.Z); //So we dont' need to create a new one each point Point3D p2 = new Point3D(r.Start.X, r.Start.Y + r.Height - 1, from.Z); //So we dont' need to create a new one each point Effects.SendLocationEffect(new Point3D(r.Start.X - 1, r.Start.Y - 1, from.Z), m, 251, 75, 1, hue, 3); //Top Corner //Testing color for (int x = r.Start.X; x <= (r.Start.X + r.Width - 1); x++) { p1.X = x; p2.X = x; p1.Z = from.Z; p2.Z = from.Z; Effects.SendLocationEffect(p1, m, 249, 75, 1, hue, 3); //North bound Effects.SendLocationEffect(p2, m, 249, 75, 1, hue, 3); //South bound } p1 = new Point3D(r.Start.X - 1, r.Start.Y - 1, from.Z); p2 = new Point3D(r.Start.X + r.Width - 1, r.Start.Y, from.Z); for (int y = r.Start.Y; y <= (r.Start.Y + r.Height - 1); y++) { p1.Y = y; p2.Y = y; p1.Z = from.Z; p2.Z = from.Z; Effects.SendLocationEffect(p1, m, 250, 75, 1, hue, 3); //West Bound Effects.SendLocationEffect(p2, m, 250, 75, 1, hue, 3); //East Bound } }
public static Rectangle3D[] RegionArea(Server.Region region) { #if(RunUO_1_Final) Rectangle3D[] rects = new Rectangle3D[region.Coords.Count]; Rectangle2D rect = new Rectangle2D(Point2D.Zero, Point2D.Zero); for (int i = 0; i < rects.Length && i < region.Coords.Count; ++i) { rect = (Rectangle2D)region.Coords[i]; rects[i] = new Rectangle3D(new Point3D(rect.Start.X, rect.Start.Y, region.MinZ), new Point3D(rect.End.X, rect.End.Y, region.MaxZ)); } return rects; #elif(RunUO_2_RC1) return region.Area; #endif }
public ChessRegion( Map map, ChessGame game, bool allowSpectators, bool safeZone, Rectangle3D bounds, int height ) : base( "Chessboard", map, 100, bounds ) { m_Game = game; m_AllowSpectators = allowSpectators; m_SafeZone = safeZone; m_BoardBounds = bounds; // Make the region larger so that people can't cast invisibility outside // m_Bounds = new Rectangle2D( bounds.X - 12, bounds.Y - 12, bounds.Width + 24, bounds.Height + 24 ); // m_BoardBounds = bounds; m_Height = height; if (!m_AllowSpectators) ForceExpel(); // Coords = new ArrayList(); // Coords.Add( m_Bounds ); }
private static Rectangle3D[] GetArea(BaseBoat boat) { int x = boat.X; int y = boat.Y; int z = boat.Z; Rectangle2D[] houseArea; if (boat.Facing == Direction.North || boat.Facing == Direction.South) houseArea = boat.AreaNorth; else houseArea = boat.AreaEast; Rectangle3D[] area = new Rectangle3D[houseArea.Length]; for (int i = 0; i < area.Length; i++) { Rectangle2D rect = houseArea[i]; area[i] = Region.ConvertTo3D(new Rectangle2D(x + rect.Start.X, y + rect.Start.Y, rect.Width, rect.Height)); } return area; }
public static void UpdateRegion(TownHouseSign sign) { if (sign.House == null) { return; } sign.House.UpdateRegion(); Rectangle3D rect = new Rectangle3D(Point3D.Zero, Point3D.Zero); for (int i = 0; i < sign.House.Region.Area.Length; ++i) { rect = sign.House.Region.Area[i]; rect = new Rectangle3D( new Point3D(rect.Start.X - sign.House.X, rect.Start.Y - sign.House.Y, sign.MinZ), new Point3D(rect.End.X - sign.House.X, rect.End.Y - sign.House.Y, sign.MaxZ)); sign.House.Region.Area[i] = rect; } sign.House.Region.Unregister(); sign.House.Region.Register(); sign.House.Region.GoLocation = sign.BanLoc; }
public RegionRect(Region region, Rectangle3D rect) { this.m_Region = region; this.m_Rect = rect; }
/// <summary> /// The guest accepted the game /// </summary> /// <param name="guest">The player accepting the game</param> public void AcceptGame( Mobile guest ) { if ( guest == null ) return; if ( Owner == null ) { guest.SendMessage( 0x40, "Your partner canceled the game" ); return; } if (m_Timer == null) return; m_GameStart = DateTime.Now; m_Timer.OnGameStart(); m_Status = GameStatus.WhiteToMove; Guest = guest; Owner.CloseGump( typeof( Arya.Chess.StartGameGump ) ); m_Board = new BChessboard( m_Black, m_White, m_Z, m_Bounds, this, m_Parent.ChessSet, m_Parent.WhiteHue, m_Parent.BlackHue, m_Parent.WhiteMinorHue, m_Parent.BlackMinorHue, m_Parent.OverrideMinorHue ); m_MoveTime = DateTime.Now; Rectangle3D m_NewBounds = Server.Region.ConvertTo3D(m_Bounds); Point3D start = m_NewBounds.Start; Point3D end = m_NewBounds.End; start.Z = m_Z - 5; end.Z = m_Z + 5; m_NewBounds = new Rectangle3D(start, end); // Create the region m_Region = new ChessRegion(m_Parent.Map, this, m_AllowSpectators, m_Parent.SafeZone, m_NewBounds, m_Z); m_Region.Register(); SendAllGumps( null, null ); }
public abstract void Write(Rectangle3D value);
public override void UpdatePosition() { GameZone = new Rectangle3D( new Point3D( X + BoardOffset.X, Y + BoardOffset.X, BoardOffset.Z - 100 ), new Point3D( X + BoardOffset.X + BoardWidth, Y + BoardOffset.Y + BoardHeight, BoardOffset.Z + 100 ) ); base.UpdatePosition(); }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); m_ChallengeArea = new Rectangle3D[0]; switch ( version ) { case 2: case 1: { m_Disable = reader.ReadBool(); goto case 0; } case 0: { m_Music = (MusicName)reader.ReadInt(); m_Priority = reader.ReadInt(); if (version < 2) { // old region area reader.ReadRect2D(); } m_ChallengeRegionName = reader.ReadString(); string mapname = reader.ReadString(); try{ m_ChallengeMap = Map.Parse(mapname); } catch {} m_CopiedRegion = reader.ReadString(); // do the coord list int count = reader.ReadInt(); if (count > 0) { // the old version used 2D rectangles for the region area. The new version uses 3D if (version < 2) { Rectangle2D[] area = new Rectangle2D[count]; for (int i = 0; i < count; i++) { area[i] = reader.ReadRect2D(); } m_ChallengeArea = Region.ConvertTo3D(area); } else { m_ChallengeArea = new Rectangle3D[count]; for (int i = 0; i < count; i++) { m_ChallengeArea[i] = new Rectangle3D(reader.ReadPoint3D(), reader.ReadPoint3D()); } } } break; } } // refresh the region Timer.DelayCall(TimeSpan.Zero, new TimerCallback(RefreshRegions)); }
public static Rectangle3D GetBounds(int multiID) { multiID &= 0x3FFF; Rectangle3D bounds; if (BoundsCache.TryGetValue(multiID, out bounds)) { return bounds; } var mcl = GetComponents(multiID); int minZ = mcl.List.Min(t => t.m_OffsetZ); var maxZ = mcl.List.Max( t => t.m_OffsetZ + Math.Max(1, TileData.ItemTable[t.m_ItemID & TileData.MaxItemValue].Height)); if (multiID >= 24 && multiID <= 71) { if (multiID >= 24 && multiID <= 35) { maxZ = Math.Max(80, maxZ); } else if (multiID >= 36 && multiID <= 47) { maxZ = Math.Max(100, maxZ); } else if (multiID >= 48 && multiID <= 59) { maxZ = Math.Max(90, maxZ); } else if (multiID >= 60 && multiID <= 63) { maxZ = Math.Max(20, maxZ); } else if (multiID >= 64 && multiID <= 71) { maxZ = Math.Max(110, maxZ); } } bounds = new Rectangle3D(mcl.Min.X, mcl.Min.Y, minZ, mcl.Width + 1, mcl.Height + 1, maxZ - minZ); BoundsCache.Add(multiID, bounds); return bounds; }
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; }
public static bool ReadRectangle3D(XmlElement xml, int defaultMinZ, int defaultMaxZ, ref Rectangle3D value) { return(ReadRectangle3D(xml, defaultMinZ, defaultMaxZ, ref value, true)); }
public static bool ReadRectangle3D(XmlElement xml, int defaultMinZ, int defaultMaxZ, ref Rectangle3D value, bool mandatory) { int x1 = 0, y1 = 0, x2 = 0, y2 = 0; if (xml.HasAttribute("x")) { if (ReadInt32(xml, "x", ref x1, mandatory) & ReadInt32(xml, "y", ref y1, mandatory) & ReadInt32(xml, "width", ref x2, mandatory) & ReadInt32(xml, "height", ref y2, mandatory)) { x2 += x1; y2 += y1; } else { return(false); } } else { if (!ReadInt32(xml, "x1", ref x1, mandatory) | !ReadInt32(xml, "y1", ref y1, mandatory) | !ReadInt32(xml, "x2", ref x2, mandatory) | !ReadInt32(xml, "y2", ref y2, mandatory)) { return(false); } } int z1 = defaultMinZ; int z2 = defaultMaxZ; ReadInt32(xml, "zmin", ref z1, false); ReadInt32(xml, "zmax", ref z2, false); value = new Rectangle3D(new Point3D(x1, y1, z1), new Point3D(x2, y2, z2)); return(true); }
public override void Write(Rectangle3D value) { Write(value.Start); Write(value.End); }
public static int GetAverageZ(this Map map, Rectangle3D b) { return(GetAverageZ(map, b.EnumeratePoints2D())); }
public PlayerCityRegion( CityManagementStone stone, Map map, Rectangle3D[] area ) : base( PickRegionName(), map, DefaultPriority, area ) { //LoadFromXml = false; m_Stone = stone; }
public static int GetTopZ(this Rectangle3D b, Map map) { return(GetTopZ(map, b.EnumeratePoints2D())); }
public void DoChooseArea( Mobile from, Map map, Point3D start, Point3D end, object control ) { if( this != null ) { List<Rectangle3D> areas = new List<Rectangle3D>(); if( this.m_RegionArea != null ) { foreach( Rectangle3D rect in this.m_RegionArea ) areas.Add( rect ); } Rectangle3D newrect = new Rectangle3D( new Point3D( start, _minZ ), new Point3D( end, _maxZ ) ); areas.Add( newrect ); this.m_RegionArea = areas.ToArray(); this.UpdateRegion(); } }
public static void OnExportBounds3D(Mobile m, string speech, string comment) { if (m == null || m.Deleted || !(m is PlayerMobile)) { return; } if (String.IsNullOrWhiteSpace(speech)) { speech = "Bounds"; } BoundingBoxPicker.Begin( m, (from, map, start, end, state) => { var r = new Rectangle3D(start, end.Clone3D(1, 1)); IOUtility.EnsureFile( VitaNexCore.DataDirectory + "/Exported Bounds/3D/" + IOUtility.GetSafeFileName(speech) + ".txt") .AppendText( false, String.Format( "new Rectangle3D({0}, {1}, {2}, {3}, {4}, {5}), //{6}", // r.Start.X, r.Start.Y, r.Start.Z, r.Width, r.Height, r.Depth, comment ?? String.Empty)); }, null); }
public SigilRegion( string name, Map map, int priority, Rectangle3D[] area ) : base (name, map, priority, area) { region_Name = name; region_Area = area; region_map = map; }
public void DoChooseArea(Mobile from, Map map, Point3D start, Point3D end, object control) { if (this != null) { List<Rectangle3D> areas = new List<Rectangle3D>(); if (this.m_RegionArea != null) { foreach (Rectangle3D rect in this.m_RegionArea) areas.Add(rect); } // Added Lord Dio's Z Value Fix if (start.Z == end.Z || start.Z < end.Z) { if (start.Z != Server.Region.MinZ) start.Z = Server.Region.MinZ; if (end.Z != Server.Region.MaxZ) end.Z = Server.Region.MaxZ; } else { if (start.Z != Server.Region.MaxZ) start.Z = Server.Region.MaxZ; if (end.Z != Server.Region.MinZ) end.Z = Server.Region.MinZ; } Rectangle3D newrect = new Rectangle3D(start, end); areas.Add(newrect); this.m_RegionArea = areas.ToArray(); this.UpdateRegion(); // Added by nerun, so the RemoveAreaGump will be refreshed after added a new area from.CloseGump( typeof( RegionControlGump ) ); from.SendGump( new RegionControlGump( this ) ); from.CloseGump( typeof( RemoveAreaGump ) ); from.SendGump( new RemoveAreaGump( this ) ); } }
public RegionRect(Region region, Rectangle3D rect) { m_Region = region; m_Rect = rect; }
public StickyGooRegion( Mobile m, Rectangle3D rect ) : base(null, m.Map, m.Region, rect) { }
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); } }
public RegionControl( Rectangle3D[] rects ) : base( 5609 ) { Visible = false; Movable = false; Name = "Region Controller"; if( m_AllControls == null ) m_AllControls = new List<RegionControl>(); m_AllControls.Add( this ); m_RegionName = FindNewName( "Custom Region" ); m_RegionPriority = CustomRegion.DefaultPriority; m_RestrictedSpells = new BitArray( SpellRegistry.Types.Length ); m_RestrictedSkills = new BitArray( SkillInfo.Table.Length ); foreach( Rectangle3D rect3d in rects ) { DoChooseArea( null, this.Map, rect3d.Start, rect3d.End, this ); } UpdateRegion(); }
public static bool ReadRectangle3D( XmlElement xml, int defaultMinZ, int defaultMaxZ, ref Rectangle3D value ) { return ReadRectangle3D( xml, defaultMinZ, defaultMaxZ, ref value, true ); }
public static void WriteRect3DArray( GenericWriter writer, Rectangle3D[] ary ) { if( ary == null ) { writer.Write( 0 ); return; } writer.Write( ary.Length ); for( int i = 0; i < ary.Length; i++ ) { Rectangle3D rect = ((Rectangle3D)ary[i]); writer.Write( (Point3D)rect.Start ); writer.Write( (Point3D)rect.End ); } return; }
public static bool ReadRectangle3D( XmlElement xml, int defaultMinZ, int defaultMaxZ, ref Rectangle3D value, bool mandatory ) { int x1 = 0, y1 = 0, x2 = 0, y2 = 0; if ( xml.HasAttribute( "x" ) ) { if ( ReadInt32( xml, "x", ref x1, mandatory ) & ReadInt32( xml, "y", ref y1, mandatory ) & ReadInt32( xml, "width", ref x2, mandatory ) & ReadInt32( xml, "height", ref y2, mandatory ) ) { x2 += x1; y2 += y1; } else { return false; } } else { if ( !ReadInt32( xml, "x1", ref x1, mandatory ) | !ReadInt32( xml, "y1", ref y1, mandatory ) | !ReadInt32( xml, "x2", ref x2, mandatory ) | !ReadInt32( xml, "y2", ref y2, mandatory ) ) { return false; } } int z1 = defaultMinZ; int z2 = defaultMaxZ; ReadInt32( xml, "zmin", ref z1, false ); ReadInt32( xml, "zmax", ref z2, false ); value = new Rectangle3D( new Point3D( x1, y1, z1 ), new Point3D( x2, y2, z2 ) ); return true; }
public void DefineArea(Mobile from, Map map, Point3D start, Point3D end, object control) { if (this != null) { List<Rectangle3D> areas = new List<Rectangle3D>(); if (RegionArea != null) { foreach (Rectangle3D rect in RegionArea) areas.Add(rect); } Rectangle3D newrect = new Rectangle3D(new Point3D(start, min_z), new Point3D(end, min_z)); areas.Add(newrect); RegionArea = areas.ToArray(); UpdateRegion(); } }
public static Rectangle3D[] ConvertTo3D( Rectangle2D[] rects ) { Rectangle3D[] ret = new Rectangle3D[rects.Length]; for ( int i = 0; i < ret.Length; i++ ) { ret[i] = ConvertTo3D( rects[i] ); } return ret; }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); if( version >= 2 ) { _BoardMap = reader.ReadMap(); } else { _BoardMap = Map; } if( version >= 1 ) { _AllowPlayerConfiguration = reader.ReadBool(); } else { _AllowPlayerConfiguration = true; } State = (BoardGameState)reader.ReadInt(); _CostToPlay = reader.ReadInt(); CurrentMaxPlayers = reader.ReadInt(); _BoardWidth = reader.ReadInt(); _BoardHeight = reader.ReadInt(); GameZone = new Rectangle3D( new Point3D( reader.ReadInt(), reader.ReadInt(), reader.ReadInt() ), new Point3D( reader.ReadInt(), reader.ReadInt(), reader.ReadInt() ) ); _BoardOffset = new Point3D( reader.ReadInt(), reader.ReadInt(), reader.ReadInt() ); int count = reader.ReadInt(); for( int i = 0; i < count; i++ ) { Players.Add( reader.ReadMobile() ); } count = reader.ReadInt(); for( int i = 0; i < count; i++ ) { BackgroundItems.Add( (GamePiece)reader.ReadItem() ); } if( _State == BoardGameState.Pending || _State == BoardGameState.Recruiting ) { _State = BoardGameState.Inactive; _Players = null; } _BoardGameRegion = new BoardGameRegion( this ); _BoardGameRegion.Register(); _SettingsReady = !_AllowPlayerConfiguration; }
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 ) ); } object oMusic = this.DefaultMusic; ReadEnum( xml["music"], "name", typeof( MusicName ), ref oMusic, false ); m_Music = (MusicName) oMusic; }
public SanctuaryRegion( Mobile m, Rectangle3D rect ) : base(null, m.Map, m.Region, rect) { }
public static void OnExportBounds3D(Mobile m, string speech) { if (m == null || m.Deleted || !(m is PlayerMobile)) { return; } if (String.IsNullOrWhiteSpace(speech)) { speech = TimeStamp.UtcNow.ToString(); } BoundingBoxPicker.Begin( m, (from, map, start, end, state) => { var r = new Rectangle3D(start, end.Clone3D(1, 1)); using ( StreamWriter w = IOUtility.EnsureFile( VitaNexCore.DataDirectory + "/Exported Bounds/3D/" + IOUtility.GetSafeFileName(speech) + ".txt").AppendText()) { w.WriteLine( "new Rectangle3D({0}, {1}, {2}, {3}, {4}, {5}),", r.Start.X, r.Start.Y, r.Start.Z, r.Width, r.Height, r.Depth); w.Close(); } }, null); }
public void DoChooseArea(Mobile from, Map map, Point3D start, Point3D end, object control) { if (this != null) { List<Rectangle3D> areas = new List<Rectangle3D>(); if (this.m_RegionArea != null) { foreach (Rectangle3D rect in this.m_RegionArea) areas.Add(rect); } if (start.Z == end.Z || start.Z < end.Z) { if (start.Z != Server.Region.MinZ) --start.Z; if (end.Z != Server.Region.MaxZ) ++end.Z; } else { if (start.Z != Server.Region.MaxZ) ++start.Z; if (end.Z != Server.Region.MinZ) --end.Z; } Rectangle3D newrect = new Rectangle3D(start, end); areas.Add(newrect); this.m_RegionArea = areas.ToArray(); this.UpdateRegion(); } }
public void Register() { if (m_Registered) { return; } OnRegister(); m_Registered = true; if (m_Parent != null) { m_Parent.m_Children.Add(this); m_Parent.OnChildAdded(this); } m_Regions.Add(this); m_Map.RegisterRegion(this); m_IndexedName = IndexedRegionName.NotIndexed; if (m_Name != null) { IndexedRegionName temp; if (m_NameToIndexLookup.TryGetValue(m_Name, out temp)) { m_IndexedName = temp; } } List <Sector> sectors = new List <Sector>(); for (int i = 0; i < m_Area.Length; i++) { Rectangle3D rect = m_Area[i]; Point2D start = m_Map.Bound(new Point2D(rect.Start)); Point2D end = m_Map.Bound(new Point2D(rect.End)); Sector startSector = m_Map.GetSector(start); Sector endSector = m_Map.GetSector(end); for (int x = startSector.X; x <= endSector.X; x++) { for (int y = startSector.Y; y <= endSector.Y; y++) { Sector sector = m_Map.GetRealSector(x, y); sector.OnEnter(this, rect); if (!sectors.Contains(sector)) { sectors.Add(sector); } } } } m_Sectors = sectors.ToArray(); }