public Room(uint roomID, RoomBackground roomBackground, string roomName, BlockedExits blockedExits, bool castingAllowed = true) { this.RoomID = roomID; this.Background = roomBackground; this.IsCastingEnabled = castingAllowed; this.Decorations = new List <RoomDecoration>(); this.Npcs = new List <Mobile>(); this.Items = new List <BaseGameItem>(); this.Players = new List <Character>(); this.BlockedRoomExits = blockedExits; this.RoomName = roomName; this.RoomsIDsInUse = new List <uint>(); this.AllowCasting = castingAllowed; this.ApplyRoomLayout(); }
public InstancedRoom(uint roomId, RoomBackground backGround, string roomName, BlockedExits blocked, bool castingAllowed = true) : base(roomId, backGround, roomName, blocked, castingAllowed) { }
public Room FromBytes(byte[] buffer) { Room result = new Room(); MemoryStream m = new MemoryStream(buffer); BinaryReader r = new BinaryReader(m); r.ReadBytes(17); // past bs short namelen = r.ReadInt16(); result.RoomName = Encoding.ASCII.GetString(r.ReadBytes(namelen)); //mainForm.WriteLine("2"); r.ReadInt16(); // bs result.RoomID = r.ReadUInt32(); ushort bckgrnd = r.ReadUInt16(); RoomBackground b = RoomBackground.BeachLeft; foreach (RoomBackground rb in Enum.GetValues(typeof(RoomBackground))) { if (bckgrnd == (short)rb) { b = rb; break; } } result.Background = b; r.ReadByte(); //bs int block = r.ReadByte(); BlockedExits be = BlockedExits.None; foreach (BlockedExits rb in Enum.GetValues(typeof(BlockedExits))) { if (block == (short)rb) { be = rb; break; } } result.Blocked = be; r.ReadByte(); // bs int allow = r.ReadByte(); if (allow == 7) { result.CastingAllowed = false; } else { result.CastingAllowed = true; } // Ok now we have the decorations int totaldec = r.ReadByte(); int current = 0; while (current != totaldec) { RoomDecoration d = RoomDecoration.FromCode(r.ReadUInt16(), r.ReadUInt16(), r.ReadUInt16(), r.ReadUInt16(), result.RoomID); result.Decorations.Add(d); current++; } return(result); }