fix: Fixes doors as decorations & optimizes them (#1392)

This commit is contained in:
Kamron Batman 2023-04-18 19:28:54 -07:00 • committed by GitHub
parent 6c09e5a006
commit 79c6f0375c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 1369 additions and 1578 deletions

View file

@ -2766,4 +2766,4 @@ Static 0x1BD7
# bulletin board # bulletin board
BulletinBoard 0x1E5E BulletinBoard 0x1E5E
1452 3768 0 1452 3768 0

View file

@ -1736,4 +1736,8 @@ public static class Utility
TypeCode.UInt64 => 64, TypeCode.UInt64 => 64,
_ => 64 _ => 64
}; };
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsNullOrWhiteSpace(this ReadOnlySpan<char> span) =>
span == default || span.IsEmpty || span.IsWhiteSpace();
} }

View file

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using Microsoft.Toolkit.HighPerformance;
using Server.Engines.Quests.Haven; using Server.Engines.Quests.Haven;
using Server.Engines.Quests.Necro; using Server.Engines.Quests.Necro;
using Server.Engines.Spawners; using Server.Engines.Spawners;
@ -414,7 +415,7 @@ namespace Server.Commands
item = m_Type.CreateInstance<Item>(); item = m_Type.CreateInstance<Item>();
} }
} }
else if (m_Type.IsSubclassOf(typeofBaseDoor)) else if (m_Type.IsSubclassOf(typeofBaseDoor) && m_Params.Length > 0)
{ {
var facing = DoorFacing.WestCW; var facing = DoorFacing.WestCW;
@ -1059,7 +1060,7 @@ namespace Server.Commands
if (bd.Open) if (bd.Open)
{ {
p = new Point3D(bd.X - bd.Offset.X, bd.Y - bd.Offset.Y, bd.Z - bd.Offset.Z); p = new Point3D(bd.X - bd.Offset.X, bd.Y - bd.Offset.Y, bd.Z - bd.Offset.Z);
bdItemID = bd.ClosedID; bdItemID = bd.ClosedId;
} }
else else
{ {
@ -1272,51 +1273,59 @@ namespace Server.Commands
var indexOf = line.IndexOfOrdinal(' '); var indexOf = line.IndexOfOrdinal(' ');
list.m_Type = AssemblyHandler.FindTypeByName(line[..indexOf++]); list.m_Type = AssemblyHandler.FindTypeByName(indexOf > -1 ? line[..indexOf] : line);
indexOf++;
if (list.m_Type == null) if (list.m_Type == null)
{ {
throw new ArgumentException($"Type not found for header: '{line}'"); throw new ArgumentException($"Type not found for header: '{line}'");
} }
line = line[indexOf..]; var span = line.AsSpan(indexOf, line.Length - indexOf);
indexOf = line.IndexOfOrdinal('(');
if (indexOf >= 0) var argsStart = span.IndexOfOrdinal('(');
if (argsStart > -1)
{ {
list.m_ItemID = Utility.ToInt32(line.AsSpan()[..(indexOf - 1)]); var parms = span[(argsStart + 1)..^(line.EndsWithOrdinal(")") ? 1 : 0)];
if (parms.Length == 0)
var parms = line[++indexOf..^(line.EndsWithOrdinal(")") ? 1 : 0)];
list.m_Params = parms.Split(';');
for (var i = 0; i < list.m_Params.Length; ++i)
{ {
list.m_Params[i] = list.m_Params[i].Trim(); list.m_Params = Array.Empty<string>();
}
else
{
list.m_Params = new string[parms.Count(';') + 1];
indexOf = 0;
foreach (var part in parms.Tokenize(';'))
{
list.m_Params[indexOf++] = part.Trim().ToString();
}
} }
} }
else else
{ {
list.m_ItemID = Utility.ToInt32(line);
list.m_Params = m_EmptyParams; list.m_Params = m_EmptyParams;
} }
list.m_ItemID = Utility.ToInt32(argsStart > -1 ? span[..argsStart] : span);
list.m_Entries = new List<DecorationEntry>(); list.m_Entries = new List<DecorationEntry>();
while ((line = ip.ReadLine()) != null) while ((line = ip.ReadLine()) != null)
{ {
line = line.Trim(); span = line.AsSpan().Trim();
if (line.Length == 0) if (span.Length == 0)
{ {
break; break;
} }
if (line.StartsWithOrdinal("#")) if (span.StartsWithOrdinal("#"))
{ {
continue; continue;
} }
list.m_Entries.Add(new DecorationEntry(line)); list.m_Entries.Add(new DecorationEntry(span));
} }
return list; return list;
@ -1325,21 +1334,21 @@ namespace Server.Commands
public class DecorationEntry public class DecorationEntry
{ {
public DecorationEntry(string line) public DecorationEntry(ReadOnlySpan<char> line)
{ {
Pop(out var x, ref line); Pop(out var x, ref line);
Pop(out var y, ref line); Pop(out var y, ref line);
Pop(out var z, ref line); Pop(out var z, ref line);
Location = new Point3D(Utility.ToInt32(x), Utility.ToInt32(y), Utility.ToInt32(z)); Location = new Point3D(Utility.ToInt32(x), Utility.ToInt32(y), Utility.ToInt32(z));
Extra = line; Extra = line.ToString();
} }
public Point3D Location { get; } public Point3D Location { get; }
public string Extra { get; } public string Extra { get; }
public static void Pop(out string v, ref string line) public static void Pop(out ReadOnlySpan<char> v, ref ReadOnlySpan<char> line)
{ {
var space = line.IndexOfOrdinal(' '); var space = line.IndexOfOrdinal(' ');
@ -1351,7 +1360,7 @@ namespace Server.Commands
else else
{ {
v = line; v = line;
line = ""; line = default;
} }
} }
} }

View file

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using Microsoft.Toolkit.HighPerformance;
using Server.Engines.Quests.Haven; using Server.Engines.Quests.Haven;
using Server.Engines.Quests.Necro; using Server.Engines.Quests.Necro;
using Server.Engines.Spawners; using Server.Engines.Spawners;
@ -410,7 +411,7 @@ namespace Server.Commands
item = m_Type.CreateInstance<Item>(); item = m_Type.CreateInstance<Item>();
} }
} }
else if (m_Type.IsSubclassOf(typeofBaseDoor)) else if (m_Type.IsSubclassOf(typeofBaseDoor) && m_Params.Length > 0)
{ {
var facing = DoorFacing.WestCW; var facing = DoorFacing.WestCW;
@ -1055,7 +1056,7 @@ namespace Server.Commands
if (bd.Open) if (bd.Open)
{ {
p = new Point3D(bd.X - bd.Offset.X, bd.Y - bd.Offset.Y, bd.Z - bd.Offset.Z); p = new Point3D(bd.X - bd.Offset.X, bd.Y - bd.Offset.Y, bd.Z - bd.Offset.Z);
bdItemID = bd.ClosedID; bdItemID = bd.ClosedId;
} }
else else
{ {
@ -1258,51 +1259,60 @@ namespace Server.Commands
var indexOf = line.IndexOfOrdinal(' '); var indexOf = line.IndexOfOrdinal(' ');
list.m_Type = AssemblyHandler.FindTypeByName(line[..indexOf++]); list.m_Type = AssemblyHandler.FindTypeByName(indexOf > -1 ? line[..indexOf] : line);
indexOf++;
if (list.m_Type == null) if (list.m_Type == null)
{ {
throw new ArgumentException($"Type not found for header: '{line}'"); throw new ArgumentException($"Type not found for header: '{line}'");
} }
line = line[indexOf..]; var span = line.AsSpan(indexOf, line.Length - indexOf);
indexOf = line.IndexOfOrdinal('(');
if (indexOf >= 0) var argsStart = span.IndexOfOrdinal('(');
if (argsStart > -1)
{ {
list.m_ItemID = Utility.ToInt32(line.AsSpan()[..(indexOf - 1)]); var parms = span[(argsStart + 1)..^(line.EndsWithOrdinal(")") ? 1 : 0)];
if (parms.Length == 0)
var parms = line[++indexOf..^(line.EndsWithOrdinal(")") ? 1 : 0)];
list.m_Params = parms.Split(';');
for (var i = 0; i < list.m_Params.Length; ++i)
{ {
list.m_Params[i] = list.m_Params[i].Trim(); list.m_Params = Array.Empty<string>();
}
else
{
list.m_Params = new string[parms.Count(';') + 1];
indexOf = 0;
foreach (var part in parms.Tokenize(';'))
{
list.m_Params[indexOf++] = part.Trim().ToString();
}
} }
} }
else else
{ {
list.m_ItemID = Utility.ToInt32(line);
list.m_Params = m_EmptyParams; list.m_Params = m_EmptyParams;
} }
list.m_ItemID = Utility.ToInt32(argsStart > -1 ? span[..argsStart] : span);
list.m_Entries = new List<DecorationEntryMag>(); list.m_Entries = new List<DecorationEntryMag>();
while ((line = ip.ReadLine()) != null) while ((line = ip.ReadLine()) != null)
{ {
line = line.Trim(); span = line.AsSpan().Trim();
if (line.Length == 0) if (span.Length == 0)
{ {
break; break;
} }
if (line.StartsWithOrdinal("#")) if (span.StartsWithOrdinal("#"))
{ {
continue; continue;
} }
list.m_Entries.Add(new DecorationEntryMag(line)); list.m_Entries.Add(new DecorationEntryMag(span));
} }
return list; return list;
@ -1311,21 +1321,21 @@ namespace Server.Commands
public class DecorationEntryMag public class DecorationEntryMag
{ {
public DecorationEntryMag(string line) public DecorationEntryMag(ReadOnlySpan<char> line)
{ {
Pop(out var x, ref line); Pop(out var x, ref line);
Pop(out var y, ref line); Pop(out var y, ref line);
Pop(out var z, ref line); Pop(out var z, ref line);
Location = new Point3D(Utility.ToInt32(x), Utility.ToInt32(y), Utility.ToInt32(z)); Location = new Point3D(Utility.ToInt32(x), Utility.ToInt32(y), Utility.ToInt32(z));
Extra = line; Extra = line.ToString();
} }
public Point3D Location { get; } public Point3D Location { get; }
public string Extra { get; } public string Extra { get; }
public void Pop(out string v, ref string line) public void Pop(out ReadOnlySpan<char> v, ref ReadOnlySpan<char> line)
{ {
var space = line.IndexOfOrdinal(' '); var space = line.IndexOfOrdinal(' ');

View file

@ -121,7 +121,7 @@ namespace Server.Engines.Doom
Door.Open = false; Door.Open = false;
} }
if (Door.Link != null) if (Door.Link?.Deleted == false)
{ {
Door.Link.Hue = hue; Door.Link.Hue = hue;
Door.Link.Locked = lockDoors; Door.Link.Locked = lockDoors;

View file

@ -58,7 +58,7 @@ namespace Server.Engines.Doom
healerDoor.Locked = true; healerDoor.Locked = true;
healerDoor.KeyValue = Key.RandomValue(); healerDoor.KeyValue = Key.RandomValue();
if (healerDoor.Link != null) if (healerDoor.Link?.Deleted == false)
{ {
healerDoor.Link.Locked = true; healerDoor.Link.Locked = true;
healerDoor.Link.KeyValue = Key.RandomValue(); healerDoor.Link.KeyValue = Key.RandomValue();

File diff suppressed because it is too large Load diff

View file

@ -1,436 +1,216 @@
namespace Server.Items using ModernUO.Serialization;
namespace Server.Items;
public enum DoorFacing
{ {
public enum DoorFacing WestCW,
EastCCW,
WestCCW,
EastCW,
SouthCW,
NorthCCW,
SouthCCW,
NorthCW,
// Sliding Doors
SouthSW,
SouthSE,
WestSS,
WestSN
}
[SerializationGenerator(0, false)]
public partial class IronGateShort : BaseDoor
{
[Constructible]
public IronGateShort(DoorFacing facing) : base(
0x84c + 2 * (int)facing,
0x84d + 2 * (int)facing,
0xEC,
0xF3,
GetOffset(facing)
)
{
}
}
[SerializationGenerator(0, false)]
public partial class IronGate : BaseDoor
{
[Constructible]
public IronGate(DoorFacing facing) : base(
0x824 + 2 * (int)facing,
0x825 + 2 * (int)facing,
0xEC,
0xF3,
GetOffset(facing)
)
{
}
}
[SerializationGenerator(0, false)]
public partial class LightWoodGate : BaseDoor
{
[Constructible]
public LightWoodGate(DoorFacing facing) : base(
0x839 + 2 * (int)facing,
0x83A + 2 * (int)facing,
0xEB,
0xF2,
GetOffset(facing)
)
{
}
}
[SerializationGenerator(0, false)]
public partial class DarkWoodGate : BaseDoor
{
[Constructible]
public DarkWoodGate(DoorFacing facing) : base(
0x866 + 2 * (int)facing,
0x867 + 2 * (int)facing,
0xEB,
0xF2,
GetOffset(facing)
)
{
}
}
[SerializationGenerator(0, false)]
public partial class MetalDoor : BaseDoor
{
[Constructible]
public MetalDoor(DoorFacing facing) : base(
0x675 + 2 * (int)facing,
0x676 + 2 * (int)facing,
0xEC,
0xF3,
GetOffset(facing)
)
{
}
}
[SerializationGenerator(0, false)]
public partial class BarredMetalDoor : BaseDoor
{
[Constructible]
public BarredMetalDoor(DoorFacing facing) : base(
0x685 + 2 * (int)facing,
0x686 + 2 * (int)facing,
0xEC,
0xF3,
GetOffset(facing)
)
{
}
}
[SerializationGenerator(0, false)]
public partial class BarredMetalDoor2 : BaseDoor
{
[Constructible]
public BarredMetalDoor2(DoorFacing facing) : base(
0x1FED + 2 * (int)facing,
0x1FEE + 2 * (int)facing,
0xEC,
0xF3,
GetOffset(facing)
)
{
}
}
[SerializationGenerator(0, false)]
public partial class RattanDoor : BaseDoor
{
[Constructible]
public RattanDoor(DoorFacing facing) : base(
0x695 + 2 * (int)facing,
0x696 + 2 * (int)facing,
0xEB,
0xF2,
GetOffset(facing)
)
{
}
}
[SerializationGenerator(0, false)]
public partial class DarkWoodDoor : BaseDoor
{
[Constructible]
public DarkWoodDoor(DoorFacing facing) : base(
0x6A5 + 2 * (int)facing,
0x6A6 + 2 * (int)facing,
0xEA,
0xF1,
GetOffset(facing)
)
{
}
}
[SerializationGenerator(0, false)]
public partial class MediumWoodDoor : BaseDoor
{
[Constructible]
public MediumWoodDoor(DoorFacing facing) : base(
0x6B5 + 2 * (int)facing,
0x6B6 + 2 * (int)facing,
0xEA,
0xF1,
GetOffset(facing)
)
{
}
}
[SerializationGenerator(0, false)]
public partial class MetalDoor2 : BaseDoor
{
[Constructible]
public MetalDoor2(DoorFacing facing) : base(
0x6C5 + 2 * (int)facing,
0x6C6 + 2 * (int)facing,
0xEC,
0xF3,
GetOffset(facing)
)
{
}
}
[SerializationGenerator(0, false)]
public partial class LightWoodDoor : BaseDoor
{
[Constructible]
public LightWoodDoor(DoorFacing facing) : base(
0x6D5 + 2 * (int)facing,
0x6D6 + 2 * (int)facing,
0xEA,
0xF1,
GetOffset(facing)
)
{
}
}
[SerializationGenerator(0, false)]
public partial class StrongWoodDoor : BaseDoor
{
[Constructible]
public StrongWoodDoor(DoorFacing facing) : base(
0x6E5 + 2 * (int)facing,
0x6E6 + 2 * (int)facing,
0xEA,
0xF1,
GetOffset(facing)
)
{ {
WestCW,
EastCCW,
WestCCW,
EastCW,
SouthCW,
NorthCCW,
SouthCCW,
NorthCW,
// Sliding Doors
SouthSW,
SouthSE,
WestSS,
WestSN
}
public class IronGateShort : BaseDoor
{
[Constructible]
public IronGateShort(DoorFacing facing) : base(
0x84c + 2 * (int)facing,
0x84d + 2 * (int)facing,
0xEC,
0xF3,
GetOffset(facing)
)
{
}
public IronGateShort(Serial serial) : base(serial)
{
}
public override void Serialize(IGenericWriter writer) // Default Serialize method
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader) // Default Deserialize method
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
public class IronGate : BaseDoor
{
[Constructible]
public IronGate(DoorFacing facing) : base(
0x824 + 2 * (int)facing,
0x825 + 2 * (int)facing,
0xEC,
0xF3,
GetOffset(facing)
)
{
}
public IronGate(Serial serial) : base(serial)
{
}
public override void Serialize(IGenericWriter writer) // Default Serialize method
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader) // Default Deserialize method
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
public class LightWoodGate : BaseDoor
{
[Constructible]
public LightWoodGate(DoorFacing facing) : base(
0x839 + 2 * (int)facing,
0x83A + 2 * (int)facing,
0xEB,
0xF2,
GetOffset(facing)
)
{
}
public LightWoodGate(Serial serial) : base(serial)
{
}
public override void Serialize(IGenericWriter writer) // Default Serialize method
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader) // Default Deserialize method
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
public class DarkWoodGate : BaseDoor
{
[Constructible]
public DarkWoodGate(DoorFacing facing) : base(
0x866 + 2 * (int)facing,
0x867 + 2 * (int)facing,
0xEB,
0xF2,
GetOffset(facing)
)
{
}
public DarkWoodGate(Serial serial) : base(serial)
{
}
public override void Serialize(IGenericWriter writer) // Default Serialize method
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader) // Default Deserialize method
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
public class MetalDoor : BaseDoor
{
[Constructible]
public MetalDoor(DoorFacing facing) : base(
0x675 + 2 * (int)facing,
0x676 + 2 * (int)facing,
0xEC,
0xF3,
GetOffset(facing)
)
{
}
public MetalDoor(Serial serial) : base(serial)
{
}
public override void Serialize(IGenericWriter writer) // Default Serialize method
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader) // Default Deserialize method
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
public class BarredMetalDoor : BaseDoor
{
[Constructible]
public BarredMetalDoor(DoorFacing facing) : base(
0x685 + 2 * (int)facing,
0x686 + 2 * (int)facing,
0xEC,
0xF3,
GetOffset(facing)
)
{
}
public BarredMetalDoor(Serial serial) : base(serial)
{
}
public override void Serialize(IGenericWriter writer) // Default Serialize method
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader) // Default Deserialize method
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
public class BarredMetalDoor2 : BaseDoor
{
[Constructible]
public BarredMetalDoor2(DoorFacing facing) : base(
0x1FED + 2 * (int)facing,
0x1FEE + 2 * (int)facing,
0xEC,
0xF3,
GetOffset(facing)
)
{
}
public BarredMetalDoor2(Serial serial) : base(serial)
{
}
public override void Serialize(IGenericWriter writer) // Default Serialize method
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader) // Default Deserialize method
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
public class RattanDoor : BaseDoor
{
[Constructible]
public RattanDoor(DoorFacing facing) : base(
0x695 + 2 * (int)facing,
0x696 + 2 * (int)facing,
0xEB,
0xF2,
GetOffset(facing)
)
{
}
public RattanDoor(Serial serial) : base(serial)
{
}
public override void Serialize(IGenericWriter writer) // Default Serialize method
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader) // Default Deserialize method
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
public class DarkWoodDoor : BaseDoor
{
[Constructible]
public DarkWoodDoor(DoorFacing facing) : base(
0x6A5 + 2 * (int)facing,
0x6A6 + 2 * (int)facing,
0xEA,
0xF1,
GetOffset(facing)
)
{
}
public DarkWoodDoor(Serial serial) : base(serial)
{
}
public override void Serialize(IGenericWriter writer) // Default Serialize method
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader) // Default Deserialize method
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
public class MediumWoodDoor : BaseDoor
{
[Constructible]
public MediumWoodDoor(DoorFacing facing) : base(
0x6B5 + 2 * (int)facing,
0x6B6 + 2 * (int)facing,
0xEA,
0xF1,
GetOffset(facing)
)
{
}
public MediumWoodDoor(Serial serial) : base(serial)
{
}
public override void Serialize(IGenericWriter writer) // Default Serialize method
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader) // Default Deserialize method
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
public class MetalDoor2 : BaseDoor
{
[Constructible]
public MetalDoor2(DoorFacing facing) : base(
0x6C5 + 2 * (int)facing,
0x6C6 + 2 * (int)facing,
0xEC,
0xF3,
GetOffset(facing)
)
{
}
public MetalDoor2(Serial serial) : base(serial)
{
}
public override void Serialize(IGenericWriter writer) // Default Serialize method
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader) // Default Deserialize method
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
public class LightWoodDoor : BaseDoor
{
[Constructible]
public LightWoodDoor(DoorFacing facing) : base(
0x6D5 + 2 * (int)facing,
0x6D6 + 2 * (int)facing,
0xEA,
0xF1,
GetOffset(facing)
)
{
}
public LightWoodDoor(Serial serial) : base(serial)
{
}
public override void Serialize(IGenericWriter writer) // Default Serialize method
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader) // Default Deserialize method
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
public class StrongWoodDoor : BaseDoor
{
[Constructible]
public StrongWoodDoor(DoorFacing facing) : base(
0x6E5 + 2 * (int)facing,
0x6E6 + 2 * (int)facing,
0xEA,
0xF1,
GetOffset(facing)
)
{
}
public StrongWoodDoor(Serial serial) : base(serial)
{
}
public override void Serialize(IGenericWriter writer) // Default Serialize method
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader) // Default Deserialize method
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
} }
} }

View file

@ -1,291 +1,219 @@
using System.Collections.Generic; using System.Collections.Generic;
using ModernUO.Serialization;
using Server.ContextMenus; using Server.ContextMenus;
using Server.Gumps; using Server.Gumps;
using Server.Multis; using Server.Multis;
namespace Server.Items namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class MetalHouseDoor : BaseHouseDoor
{ {
public class MetalHouseDoor : BaseHouseDoor [Constructible]
public MetalHouseDoor(DoorFacing facing) : base(
facing,
0x675 + 2 * (int)facing,
0x676 + 2 * (int)facing,
0xEC,
0xF3,
GetOffset(facing)
)
{ {
[Constructible] }
public MetalHouseDoor(DoorFacing facing) : base( }
[SerializationGenerator(0, false)]
public partial class DarkWoodHouseDoor : BaseHouseDoor
{
[Constructible]
public DarkWoodHouseDoor(DoorFacing facing) : base(
facing,
0x6A5 + 2 * (int)facing,
0x6A6 + 2 * (int)facing,
0xEA,
0xF1,
GetOffset(facing)
)
{
}
}
[SerializationGenerator(0, false)]
public partial class GenericHouseDoor : BaseHouseDoor
{
[Constructible]
public GenericHouseDoor(DoorFacing facing, int baseItemID, int openedSound, int closedSound, bool autoAdjust = true)
: base(
facing, facing,
0x675 + 2 * (int)facing, baseItemID + (autoAdjust ? 2 * (int)facing : 0),
0x676 + 2 * (int)facing, baseItemID + 1 + (autoAdjust ? 2 * (int)facing : 0),
0xEC, openedSound,
0xF3, closedSound,
GetOffset(facing) GetOffset(facing)
) )
{
}
}
[SerializationGenerator(2, false)]
public abstract partial class BaseHouseDoor : BaseDoor, ISecurable
{
[SerializableField(0)]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private SecureLevel _level;
[SerializableField(1)]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private DoorFacing _facing;
public BaseHouseDoor(DoorFacing facing, int closedID, int openedID, int openedSound, int closedSound, Point3D offset)
: base(closedID, openedID, openedSound, closedSound, offset)
{
_facing = facing;
_level = SecureLevel.Anyone;
}
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
{
base.GetContextMenuEntries(from, list);
SetSecureLevelEntry.AddTo(from, this, list);
}
public BaseHouse FindHouse()
{
Point3D loc;
if (Open)
{ {
loc = new Point3D(X - Offset.X, Y - Offset.Y, Z - Offset.Z);
}
else
{
loc = Location;
} }
public MetalHouseDoor(Serial serial) : base(serial) return BaseHouse.FindHouseAt(loc, Map, 20);
}
public bool CheckAccess(Mobile m)
{
var house = FindHouse();
if (house == null)
{ {
return false;
} }
public override void Serialize(IGenericWriter writer) // Default Serialize method if (!house.IsAosRules)
{ {
base.Serialize(writer); return true;
writer.Write(0); // version
} }
public override void Deserialize(IGenericReader reader) // Default Deserialize method if (house.Public ? house.IsBanned(m) : !house.HasAccess(m))
{ {
base.Deserialize(reader); return false;
}
var version = reader.ReadInt(); return house.HasSecureAccess(m, Level);
}
public override void OnOpened(Mobile from)
{
var house = FindHouse();
if (house?.IsFriend(from) == true && from.AccessLevel == AccessLevel.Player && house.RefreshDecay())
{
from.SendLocalizedMessage(1043293); // Your house's age and contents have been refreshed.
}
if (house?.Public == true && !house.IsFriend(from))
{
house.Visits++;
} }
} }
public class DarkWoodHouseDoor : BaseHouseDoor public override bool UseLocks() => FindHouse()?.IsAosRules != true;
public override void Use(Mobile from)
{ {
[Constructible] if (!CheckAccess(from))
public DarkWoodHouseDoor(DoorFacing facing) : base(
facing,
0x6A5 + 2 * (int)facing,
0x6A6 + 2 * (int)facing,
0xEA,
0xF1,
GetOffset(facing)
)
{ {
from.SendLocalizedMessage(1061637); // You are not allowed to access this.
} }
else
public DarkWoodHouseDoor(Serial serial) : base(serial)
{ {
} base.Use(from);
public override void Serialize(IGenericWriter writer) // Default Serialize method
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader) // Default Deserialize method
{
base.Deserialize(reader);
var version = reader.ReadInt();
} }
} }
public class GenericHouseDoor : BaseHouseDoor private void Deserialize(IGenericReader reader, int version)
{ {
[Constructible] _level = (SecureLevel)reader.ReadInt();
public GenericHouseDoor(DoorFacing facing, int baseItemID, int openedSound, int closedSound, bool autoAdjust = true) _facing = (DoorFacing)reader.ReadInt();
: base(
facing,
baseItemID + (autoAdjust ? 2 * (int)facing : 0),
baseItemID + 1 + (autoAdjust ? 2 * (int)facing : 0),
openedSound,
closedSound,
GetOffset(facing)
)
{
}
public GenericHouseDoor(Serial serial) : base(serial)
{
}
public override void Serialize(IGenericWriter writer) // Default Serialize method
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader) // Default Deserialize method
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
} }
public abstract class BaseHouseDoor : BaseDoor, ISecurable public override bool IsInside(Mobile from)
{ {
public BaseHouseDoor(DoorFacing facing, int closedID, int openedID, int openedSound, int closedSound, Point3D offset) int x, y, w, h;
: base(closedID, openedID, openedSound, closedSound, offset)
const int r = 2;
const int bs = r * 2 + 1;
const int ss = r + 1;
switch (Facing)
{ {
Facing = facing; case DoorFacing.WestCW:
Level = SecureLevel.Anyone; case DoorFacing.EastCCW:
} {
public BaseHouseDoor(Serial serial) : base(serial)
{
}
[CommandProperty(AccessLevel.GameMaster)]
public DoorFacing Facing { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public SecureLevel Level { get; set; }
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
{
base.GetContextMenuEntries(from, list);
SetSecureLevelEntry.AddTo(from, this, list);
}
public BaseHouse FindHouse()
{
Point3D loc;
if (Open)
{
loc = new Point3D(X - Offset.X, Y - Offset.Y, Z - Offset.Z);
}
else
{
loc = Location;
}
return BaseHouse.FindHouseAt(loc, Map, 20);
}
public bool CheckAccess(Mobile m)
{
var house = FindHouse();
if (house == null)
{
return false;
}
if (!house.IsAosRules)
{
return true;
}
if (house.Public ? house.IsBanned(m) : !house.HasAccess(m))
{
return false;
}
return house.HasSecureAccess(m, Level);
}
public override void OnOpened(Mobile from)
{
var house = FindHouse();
if (house?.IsFriend(from) == true && from.AccessLevel == AccessLevel.Player && house.RefreshDecay())
{
from.SendLocalizedMessage(1043293); // Your house's age and contents have been refreshed.
}
if (house?.Public == true && !house.IsFriend(from))
{
house.Visits++;
}
}
public override bool UseLocks() => FindHouse()?.IsAosRules != true;
public override void Use(Mobile from)
{
if (!CheckAccess(from))
{
from.SendLocalizedMessage(1061637); // You are not allowed to access this.
}
else
{
base.Use(from);
}
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(1); // version
writer.Write((int)Level);
writer.Write((int)Facing);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
switch (version)
{
case 1:
{
Level = (SecureLevel)reader.ReadInt();
goto case 0;
}
case 0:
{
if (version < 1)
{
Level = SecureLevel.Anyone;
}
Facing = (DoorFacing)reader.ReadInt();
break;
}
}
}
public override bool IsInside(Mobile from)
{
int x, y, w, h;
const int r = 2;
const int bs = r * 2 + 1;
const int ss = r + 1;
switch (Facing)
{
case DoorFacing.WestCW:
case DoorFacing.EastCCW:
x = -r; x = -r;
y = -r; y = -r;
w = bs; w = bs;
h = ss; h = ss;
break; break;
}
case DoorFacing.EastCW: case DoorFacing.EastCW:
case DoorFacing.WestCCW: case DoorFacing.WestCCW:
{
x = -r; x = -r;
y = 0; y = 0;
w = bs; w = bs;
h = ss; h = ss;
break; break;
}
case DoorFacing.SouthCW: case DoorFacing.SouthCW:
case DoorFacing.NorthCCW: case DoorFacing.NorthCCW:
{
x = -r; x = -r;
y = -r; y = -r;
w = ss; w = ss;
h = bs; h = bs;
break; break;
}
case DoorFacing.NorthCW: case DoorFacing.NorthCW:
case DoorFacing.SouthCCW: case DoorFacing.SouthCCW:
{
x = 0; x = 0;
y = -r; y = -r;
w = ss; w = ss;
h = bs; h = bs;
break; break;
}
// No way to test the 'insideness' of SE Sliding doors on OSI, so leaving them default to false until further information gained // No way to test the 'insideness' of SE Sliding doors on OSI, so leaving them default to false until further information gained
default: return false; default:
} {
return false;
var rx = from.X - X; }
var ry = from.Y - Y;
var az = (from.Z - Z).Abs();
return rx >= x && rx < x + w && ry >= y && ry < y + h && az <= 4;
} }
var rx = from.X - X;
var ry = from.Y - Y;
var az = (from.Z - Z).Abs();
return rx >= x && rx < x + w && ry >= y && ry < y + h && az <= 4;
} }
} }

View file

@ -1,58 +1,21 @@
namespace Server.Items using ModernUO.Serialization;
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class PortcullisNS : BaseDoor
{ {
public class PortcullisNS : BaseDoor [Constructible]
public PortcullisNS() : base(0x6F5, 0x6F5, 0xF0, 0xEF, new Point3D(0, 0, 20))
{
}
}
[SerializationGenerator(0, false)]
public partial class PortcullisEW : BaseDoor
{
[Constructible]
public PortcullisEW() : base(0x6F6, 0x6F6, 0xF0, 0xEF, new Point3D(0, 0, 20))
{ {
[Constructible]
public PortcullisNS() : base(0x6F5, 0x6F5, 0xF0, 0xEF, new Point3D(0, 0, 20))
{
}
public PortcullisNS(Serial serial) : base(serial)
{
}
public override bool UseChainedFunctionality => true;
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
public class PortcullisEW : BaseDoor
{
[Constructible]
public PortcullisEW() : base(0x6F6, 0x6F6, 0xF0, 0xEF, new Point3D(0, 0, 20))
{
}
public PortcullisEW(Serial serial) : base(serial)
{
}
public override bool UseChainedFunctionality => true;
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
} }
} }

View file

@ -1,194 +1,93 @@
namespace Server.Items using ModernUO.Serialization;
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class SecretStoneDoor1 : BaseDoor
{ {
public class SecretStoneDoor1 : BaseDoor [Constructible]
public SecretStoneDoor1(DoorFacing facing) : base(
0xE8 + 2 * (int)facing,
0xE9 + 2 * (int)facing,
0xED,
0xF4,
GetOffset(facing)
)
{
}
}
[SerializationGenerator(0, false)]
public partial class SecretDungeonDoor : BaseDoor
{
[Constructible]
public SecretDungeonDoor(DoorFacing facing) : base(
0x314 + 2 * (int)facing,
0x315 + 2 * (int)facing,
0xED,
0xF4,
GetOffset(facing)
)
{
}
}
[SerializationGenerator(0, false)]
public partial class SecretStoneDoor2 : BaseDoor
{
[Constructible]
public SecretStoneDoor2(DoorFacing facing) : base(
0x324 + 2 * (int)facing,
0x325 + 2 * (int)facing,
0xED,
0xF4,
GetOffset(facing)
)
{
}
}
[SerializationGenerator(0, false)]
public partial class SecretWoodenDoor : BaseDoor
{
[Constructible]
public SecretWoodenDoor(DoorFacing facing) : base(
0x334 + 2 * (int)facing,
0x335 + 2 * (int)facing,
0xED,
0xF4,
GetOffset(facing)
)
{
}
}
[SerializationGenerator(0, false)]
public partial class SecretLightWoodDoor : BaseDoor
{
[Constructible]
public SecretLightWoodDoor(DoorFacing facing) : base(
0x344 + 2 * (int)facing,
0x345 + 2 * (int)facing,
0xED,
0xF4,
GetOffset(facing)
)
{
}
}
[SerializationGenerator(0, false)]
public partial class SecretStoneDoor3 : BaseDoor
{
[Constructible]
public SecretStoneDoor3(DoorFacing facing) : base(
0x354 + 2 * (int)facing,
0x355 + 2 * (int)facing,
0xED,
0xF4,
GetOffset(facing)
)
{ {
[Constructible]
public SecretStoneDoor1(DoorFacing facing) : base(
0xE8 + 2 * (int)facing,
0xE9 + 2 * (int)facing,
0xED,
0xF4,
GetOffset(facing)
)
{
}
public SecretStoneDoor1(Serial serial) : base(serial)
{
}
public override void Serialize(IGenericWriter writer) // Default Serialize method
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader) // Default Deserialize method
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
public class SecretDungeonDoor : BaseDoor
{
[Constructible]
public SecretDungeonDoor(DoorFacing facing) : base(
0x314 + 2 * (int)facing,
0x315 + 2 * (int)facing,
0xED,
0xF4,
GetOffset(facing)
)
{
}
public SecretDungeonDoor(Serial serial) : base(serial)
{
}
public override void Serialize(IGenericWriter writer) // Default Serialize method
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader) // Default Deserialize method
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
public class SecretStoneDoor2 : BaseDoor
{
[Constructible]
public SecretStoneDoor2(DoorFacing facing) : base(
0x324 + 2 * (int)facing,
0x325 + 2 * (int)facing,
0xED,
0xF4,
GetOffset(facing)
)
{
}
public SecretStoneDoor2(Serial serial) : base(serial)
{
}
public override void Serialize(IGenericWriter writer) // Default Serialize method
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader) // Default Deserialize method
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
public class SecretWoodenDoor : BaseDoor
{
[Constructible]
public SecretWoodenDoor(DoorFacing facing) : base(
0x334 + 2 * (int)facing,
0x335 + 2 * (int)facing,
0xED,
0xF4,
GetOffset(facing)
)
{
}
public SecretWoodenDoor(Serial serial) : base(serial)
{
}
public override void Serialize(IGenericWriter writer) // Default Serialize method
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader) // Default Deserialize method
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
public class SecretLightWoodDoor : BaseDoor
{
[Constructible]
public SecretLightWoodDoor(DoorFacing facing) : base(
0x344 + 2 * (int)facing,
0x345 + 2 * (int)facing,
0xED,
0xF4,
GetOffset(facing)
)
{
}
public SecretLightWoodDoor(Serial serial) : base(serial)
{
}
public override void Serialize(IGenericWriter writer) // Default Serialize method
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader) // Default Deserialize method
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
public class SecretStoneDoor3 : BaseDoor
{
[Constructible]
public SecretStoneDoor3(DoorFacing facing) : base(
0x354 + 2 * (int)facing,
0x355 + 2 * (int)facing,
0xED,
0xF4,
GetOffset(facing)
)
{
}
public SecretStoneDoor3(Serial serial) : base(serial)
{
}
public override void Serialize(IGenericWriter writer) // Default Serialize method
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader) // Default Deserialize method
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
} }
} }

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.BarredMetalDoor"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.BarredMetalDoor2"
}

View file

@ -0,0 +1,75 @@
{
"version": 0,
"type": "Server.Items.BaseDoor",
"properties": [
{
"name": "KeyValue",
"type": "uint",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
},
{
"name": "Open",
"type": "bool",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
},
{
"name": "Locked",
"type": "bool",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
},
{
"name": "OpenedId",
"type": "int",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
},
{
"name": "ClosedId",
"type": "int",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
},
{
"name": "OpenedSound",
"type": "int",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
},
{
"name": "ClosedSound",
"type": "int",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
},
{
"name": "Offset",
"type": "Server.Point3D",
"rule": "PrimitiveUOTypeMigrationRule",
"ruleArguments": [
"Point3D"
]
},
{
"name": "Link",
"type": "Server.Items.BaseDoor",
"rule": "SerializableInterfaceMigrationRule"
}
]
}

View file

@ -0,0 +1,16 @@
{
"version": 2,
"type": "Server.Items.BaseHouseDoor",
"properties": [
{
"name": "Level",
"type": "Server.Multis.SecureLevel",
"rule": "EnumMigrationRule"
},
{
"name": "Facing",
"type": "Server.Items.DoorFacing",
"rule": "EnumMigrationRule"
}
]
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.DarkWoodDoor"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.DarkWoodGate"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.DarkWoodHouseDoor"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.GenericHouseDoor"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.IronGate"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.IronGateShort"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.LightWoodDoor"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.LightWoodGate"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.MediumWoodDoor"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.MetalDoor"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.MetalDoor2"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.MetalHouseDoor"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.PortcullisEW"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.PortcullisNS"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.RattanDoor"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.SecretDungeonDoor"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.SecretLightWoodDoor"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.SecretStoneDoor1"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.SecretStoneDoor2"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.SecretStoneDoor3"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.SecretWoodenDoor"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.StrongWoodDoor"
}

View file

@ -561,7 +561,7 @@ namespace Server.Multis
} }
else if (fixture is BaseHouseDoor door) else if (fixture is BaseHouseDoor door)
{ {
if (door.Link != null) if (door.Link?.Deleted == false)
{ {
continue; continue;
} }
@ -572,70 +572,94 @@ namespace Server.Multis
switch (door.Facing) switch (door.Facing)
{ {
default: default:
linkFacing = DoorFacing.EastCCW; {
xOffset = 1; linkFacing = DoorFacing.EastCCW;
yOffset = 0; xOffset = 1;
break; yOffset = 0;
break;
}
case DoorFacing.EastCCW: case DoorFacing.EastCCW:
linkFacing = DoorFacing.WestCW; {
xOffset = -1; linkFacing = DoorFacing.WestCW;
yOffset = 0; xOffset = -1;
break; yOffset = 0;
break;
}
case DoorFacing.WestCCW: case DoorFacing.WestCCW:
linkFacing = DoorFacing.EastCW; {
xOffset = 1; linkFacing = DoorFacing.EastCW;
yOffset = 0; xOffset = 1;
break; yOffset = 0;
break;
}
case DoorFacing.EastCW: case DoorFacing.EastCW:
linkFacing = DoorFacing.WestCCW; {
xOffset = -1; linkFacing = DoorFacing.WestCCW;
yOffset = 0; xOffset = -1;
break; yOffset = 0;
break;
}
case DoorFacing.SouthCW: case DoorFacing.SouthCW:
linkFacing = DoorFacing.NorthCCW; {
xOffset = 0; linkFacing = DoorFacing.NorthCCW;
yOffset = -1; xOffset = 0;
break; yOffset = -1;
break;
}
case DoorFacing.NorthCCW: case DoorFacing.NorthCCW:
linkFacing = DoorFacing.SouthCW; {
xOffset = 0; linkFacing = DoorFacing.SouthCW;
yOffset = 1; xOffset = 0;
break; yOffset = 1;
break;
}
case DoorFacing.SouthCCW: case DoorFacing.SouthCCW:
linkFacing = DoorFacing.NorthCW; {
xOffset = 0; linkFacing = DoorFacing.NorthCW;
yOffset = -1; xOffset = 0;
break; yOffset = -1;
break;
}
case DoorFacing.NorthCW: case DoorFacing.NorthCW:
linkFacing = DoorFacing.SouthCCW; {
xOffset = 0; linkFacing = DoorFacing.SouthCCW;
yOffset = 1; xOffset = 0;
break; yOffset = 1;
break;
}
case DoorFacing.SouthSW: case DoorFacing.SouthSW:
linkFacing = DoorFacing.SouthSE; {
xOffset = 1; linkFacing = DoorFacing.SouthSE;
yOffset = 0; xOffset = 1;
break; yOffset = 0;
break;
}
case DoorFacing.SouthSE: case DoorFacing.SouthSE:
linkFacing = DoorFacing.SouthSW; {
xOffset = -1; linkFacing = DoorFacing.SouthSW;
yOffset = 0; xOffset = -1;
break; yOffset = 0;
break;
}
case DoorFacing.WestSN: case DoorFacing.WestSN:
linkFacing = DoorFacing.WestSS; {
xOffset = 0; linkFacing = DoorFacing.WestSS;
yOffset = 1; xOffset = 0;
break; yOffset = 1;
break;
}
case DoorFacing.WestSS: case DoorFacing.WestSS:
linkFacing = DoorFacing.WestSN; {
xOffset = 0; linkFacing = DoorFacing.WestSN;
yOffset = -1; xOffset = 0;
break; yOffset = -1;
break;
}
} }
for (var j = i + 1; j < Fixtures.Count; ++j) for (var j = i + 1; j < Fixtures.Count; ++j)
{ {
if (Fixtures[j] is BaseHouseDoor check && check.Link == null && check.Facing == linkFacing && if (Fixtures[j] is BaseHouseDoor check && check.Link?.Deleted == false && check.Facing == linkFacing &&
check.X - door.X == xOffset && check.Y - door.Y == yOffset && check.Z == door.Z) check.X - door.X == xOffset && check.Y - door.Y == yOffset && check.Z == door.Z)
{ {
check.Link = door; check.Link = door;
@ -663,61 +687,79 @@ namespace Server.Multis
switch (type) switch (type)
{ {
default: default:
corner = 0x0014; {
east = 0x0015; corner = 0x0014;
south = 0x0016; east = 0x0015;
post = 0x0017; south = 0x0016;
break; post = 0x0017;
break;
}
case FoundationType.LightWood: case FoundationType.LightWood:
corner = 0x00BD; {
east = 0x00BE; corner = 0x00BD;
south = 0x00BF; east = 0x00BE;
post = 0x00C0; south = 0x00BF;
break; post = 0x00C0;
break;
}
case FoundationType.Dungeon: case FoundationType.Dungeon:
corner = 0x02FD; {
east = 0x02FF; corner = 0x02FD;
south = 0x02FE; east = 0x02FF;
post = 0x0300; south = 0x02FE;
break; post = 0x0300;
break;
}
case FoundationType.Brick: case FoundationType.Brick:
corner = 0x0041; {
east = 0x0043; corner = 0x0041;
south = 0x0042; east = 0x0043;
post = 0x0044; south = 0x0042;
break; post = 0x0044;
break;
}
case FoundationType.Stone: case FoundationType.Stone:
corner = 0x0065; {
east = 0x0064; corner = 0x0065;
south = 0x0063; east = 0x0064;
post = 0x0066; south = 0x0063;
break; post = 0x0066;
break;
}
case FoundationType.ElvenGrey: case FoundationType.ElvenGrey:
corner = 0x2DF7; {
east = 0x2DF9; corner = 0x2DF7;
south = 0x2DFA; east = 0x2DF9;
post = 0x2DF8; south = 0x2DFA;
break; post = 0x2DF8;
break;
}
case FoundationType.ElvenNatural: case FoundationType.ElvenNatural:
corner = 0x2DFB; {
east = 0x2DFD; corner = 0x2DFB;
south = 0x2DFE; east = 0x2DFD;
post = 0x2DFC; south = 0x2DFE;
break; post = 0x2DFC;
break;
}
case FoundationType.Crystal: case FoundationType.Crystal:
corner = 0x3672; {
east = 0x3671; corner = 0x3672;
south = 0x3670; east = 0x3671;
post = 0x3673; south = 0x3670;
break; post = 0x3673;
break;
}
case FoundationType.Shadow: case FoundationType.Shadow:
corner = 0x3676; {
east = 0x3675; corner = 0x3676;
south = 0x3674; east = 0x3675;
post = 0x3677; south = 0x3674;
break; post = 0x3677;
break;
}
} }
} }