public CellarDeed(CellarStyle style) { Style = style; Name = "Cellar Deed"; LootType = LootType.Blessed; }
public CellarAddon(CellarStyle style) { _Style = style; _FloorTiles = new List <CellarFloor>(); _WallTiles = new List <CellarWall>(); _Placeholder = AddComponent(new CellarPlaceholder(0xF39), Point3D.Zero); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.GetVersion(); switch (version) { case 1: { _Placeholder = reader.ReadItem <CellarPlaceholder>(); _FloorTiles = reader.ReadStrongItemList <CellarFloor>(); _WallTiles = reader.ReadStrongItemList <CellarWall>(); _Style = reader.ReadFlag <CellarStyle>(); House = reader.ReadItem <BaseHouse>(); StairsDown = reader.ReadItem <CellarStairs>(); StairsUp = reader.ReadItem <CellarStairs>(); } goto case 0; case 0: { if (version < 1) { _FloorTiles = new List <CellarFloor>(); _WallTiles = new List <CellarWall>(); } } break; } }
public void EndTarget(Mobile m, CellarStyle style, IPoint3D p) { BaseHouse house; var loc = p.Clone3D(); if (!CellarAddon.CanPlace(m, loc, out house)) { return; } Style = style; var addon = Addon; addon.MoveToWorld(loc, m.Map); /*if (house is TownHouse) * { * var th = (TownHouse)house; * * if (th.ForSaleSign != null) * { * var z = addon.Components.Min(c => c.Z - 1); * * if (th.ForSaleSign.MinZ > z) * { * th.ForSaleSign.MinZ = z; * } * } * }*/ Delete(); }
public CellarStyleInfo(CellarStyle style, string name) { Style = style; Name = name; FloorTiles = new int[0]; WallTiles = new int[0]; }
public void BeginTarget(Mobile m, CellarStyle style) { if (m == null || m.Deleted || !this.CheckDoubleClick(m, false, false, 2, true)) //soft dclick check { return; } m.SendMessage("Pick a place for your cellar stairs."); GenericSelectTarget <IPoint3D> .Begin(m, (tm, to) => EndTarget(tm, style, to), OnTargetFail, -1, true); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); var version = reader.GetVersion(); switch (version) { case 0: Style = reader.ReadFlag <CellarStyle>(); break; } }
private void InvalidateComponents() { if (Deleted || Map == null || Map == Map.Internal) { return; } if (StairsDown == null || StairsUp == null) { var stairs = Components.OfType <CellarStairs>().OrderByDescending(s => s.Z).ToArray(); if (stairs.Length > 1) { StairsDown = stairs.First(); StairsUp = stairs.Last(); StairsDown.Link = StairsUp; StairsUp.Link = StairsDown; } } else if (StairsDown.Link == null || StairsUp.Link == null) { StairsDown.Link = StairsUp; StairsUp.Link = StairsDown; } if (_Style == CellarStyle.None) { var tiles = new Queue <AddonComponent>(Components); while (_Style == CellarStyle.None && tiles.Count > 0) { var floor = tiles.Dequeue(); if (floor != null) { _Style = CellarStyles.ResolveOldID(floor.ItemID); } } tiles.Clear(); } if (_Style == CellarStyle.None) { _Style = CellarStyle.Dirt; } UpdateComponents(); }
public void EndTarget(Mobile m, CellarStyle style, IPoint3D p) { BaseHouse house; Point3D loc = p.Clone3D(); if (!CellarAddon.CanPlace(m, loc, out house)) { return; } Style = style; var addon = Addon; addon.MoveToWorld(loc, m.Map); Delete(); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.GetVersion(); switch (version) { case 3: LootType = LootType.Blessed; goto case 2; case 2: Style = reader.ReadFlag <CellarStyle>(); break; case 1: Style = (CellarStyle)reader.ReadInt(); break; case 0: break; } }
public void GenerateComponents() { if (Deleted || Map == null || Map == Map.Internal || Location == Point3D.Zero) { return; } if (House == null || House.Deleted) { House = BaseHouse.FindHouseAt(this); } if (House == null || House.Deleted || House.Area == null || House.Area.Length == 0 || _Placeholder == null || _Placeholder.Deleted) { House = null; return; } if (_Style == CellarStyle.None) { _Style = CellarStyle.Dirt; } Point3D p = _Placeholder.Location; Point3D o = _Placeholder.Offset; Point3D t = House.Location; Components.Remove(_Placeholder); _Placeholder.Addon = null; _Placeholder.Delete(); _Placeholder = null; var s = Style.GetInfo(); AddComponent(StairsDown = new CellarStairs(s.StairsDown), o); var floorPoints = new List <Point2D>(); var wallPoints = new List <Point2D>(); foreach (var r2d in House.Region.Area.Select(r3d => new Rectangle2D(r3d.Start, r3d.End))) { floorPoints.AddRange(r2d.EnumeratePoints().Not(floorPoints.Contains)); } floorPoints.ForEach( f => { var points = new[] { f.Clone2D(-1, -1), //nw f.Clone2D(0, -1), //n f.Clone2D(1, -1), //ne f.Clone2D(1), //e f.Clone2D(1, 1), //se f.Clone2D(0, 1), //s f.Clone2D(-1, 1), //sw f.Clone2D(-1) //w }; wallPoints.AddRange(points.Not(floorPoints.Contains).Not(wallPoints.Contains)); }); foreach (var p3d in floorPoints.Select(p2d => p2d.ToPoint3D(t.Z - 40).Clone3D(-p.X, -p.Y, -p.Z))) { _FloorTiles.Add(AddComponent(new CellarFloor(s.FloorTiles.GetRandom()), p3d)); } foreach (var p3d in wallPoints.Select(p2d => p2d.ToPoint3D(t.Z - 40).Clone3D(-p.X, -p.Y, -p.Z))) { _WallTiles.Add(AddComponent(new CellarWall(s.WallTiles.GetRandom()), p3d)); } AddComponent(StairsUp = new CellarStairs(s.StairsUp), p.ToPoint3D(t.Z - 40).Clone3D(-p.X, -p.Y, -p.Z)); StairsDown.LinkWith(StairsUp); if (!House.Addons.Contains(this)) { House.Addons.Add(this); } }
public static CellarStyleInfo GetInfo(this CellarStyle style) { return(Styles.FirstOrDefault(s => s.Style == style)); }