public RoomData() { Exits = new ExitData[MaxExits]; ExtraDescr = new Dictionary <string, string>(); Resets = new List <ResetData>(); // Default values HealRate = 100; ManaRate = 100; }
private void ParseRooms() { Log.Default.WriteLine(LogLevels.Trace, "Rooms section"); while (true) { char letter = ReadLetter(); if (letter != '#') { RaiseParseException("ParseRooms: # not found"); } int vnum = (int)ReadNumber(); if (vnum == 0) { break; // parsed } if (_rooms.Any(x => x.VNum == vnum)) { RaiseParseException("ParseRooms: vnum {0} duplicated", vnum); } RoomData roomData = new RoomData { AreaVnum = _lastAreaVnum, VNum = vnum, Name = ReadString(), Description = ReadString() }; ReadNumber(); // area number not used roomData.Flags = ReadFlags(); // convert_room_flags (see db.C:601) roomData.Sector = (int)ReadNumber(); while (true) { letter = ReadLetter(); if (letter == 'S') { break; } else if (letter == 'H') { roomData.HealRate = (int)ReadNumber(); } else if (letter == 'M') { roomData.ManaRate = (int)ReadNumber(); } else if (letter == 'C') { roomData.Clan = ReadString(); } else if (letter == 'D') { int door = (int)ReadNumber(); if (door < 0 || door >= RoomData.MaxExits) { RaiseParseException("ParseRooms: vnum {0} has bad door number", vnum); } ExitData exitData = new ExitData { Description = ReadString(), Keyword = ReadString(), ExitInfo = ReadFlags(), Key = (int)ReadNumber(), DestinationVNum = (int)ReadNumber() }; roomData.Exits[door] = exitData; } else if (letter == 'E') { string keyword = ReadString(); string description = ReadString(); if (roomData.ExtraDescr.ContainsKey(keyword)) { Warn("ParseRooms: duplicate description in vnum {0}", vnum); } else { roomData.ExtraDescr.Add(keyword, description); } } else if (letter == 'O') { if (!string.IsNullOrWhiteSpace(roomData.Owner)) { RaiseParseException("ParseRooms: vnum {0} has duplicate owner", vnum); } roomData.Owner = ReadString(); } else if (letter == 'G') { roomData.Guilds = ReadFlags(); } else if (letter == 'Z') { roomData.Program = ReadWord(); } else if (letter == 'R') { roomData.TimeBetweenRepop = (int)ReadNumber(); roomData.TimeBetweenRepopPeople = (int)ReadNumber(); } else if (letter == 'Y') { // TODO: affects (see db.C:3502) string where = ReadWord(); string location = ReadWord(); long value1 = ReadNumber(); long value2 = ReadNumber(); } else { RaiseParseException("ParseRooms: vnum {0} has unknown flag", vnum); } } Log.Default.WriteLine(LogLevels.Trace, "Room [{0}] parsed", vnum); Debug.WriteLine("Room [{0}] parsed", vnum); // Save room data _rooms.Add(roomData); } }