public Cube(long uid, Item item, int plotNumber, CoordF coordF, float rotation, long homeLayoutUid, long homeId, CubePortalSettings portalSettings) { Uid = uid; Item = item; PlotNumber = plotNumber; CoordF = coordF; HomeId = homeId; LayoutUid = homeLayoutUid; Rotation = CoordF.From(0, 0, rotation); PortalSettings = portalSettings; }
public Cube(Item item, int plotNumber, CoordF coordF, CoordF rotation, long homeLayoutId = 0, long homeId = 0) { Item = item; PlotNumber = plotNumber; CoordF = coordF; Rotation = rotation; HomeId = homeId; LayoutUid = homeLayoutId; if (item.Id == 50400158) // Portal cube { PortalSettings = new(coordF.ToByte()); } Uid = DatabaseManager.Cubes.Insert(this); }
public static Packet SendCubePortalSettings(Cube cube, List <Cube> otherPortals) { CubePortalSettings portalSettings = cube.PortalSettings; PacketWriter pWriter = PacketWriter.Of(SendOp.RESPONSE_HOME_ACTION); pWriter.WriteEnum(HomeActionMode.PortalCube); pWriter.WriteByte(); pWriter.Write(cube.CoordF.ToByte()); pWriter.WriteByte(); pWriter.WriteUnicodeString(portalSettings.PortalName); pWriter.WriteEnum(portalSettings.Method); pWriter.WriteEnum(portalSettings.Destination); pWriter.WriteUnicodeString(portalSettings.DestinationTarget ?? ""); pWriter.WriteInt(otherPortals.Count); foreach (Cube otherPortal in otherPortals) { pWriter.WriteUnicodeString(otherPortal.PortalSettings.PortalName); } return(pWriter); }