protected override void Initialize(DoorRecord record, ReferenceData referenceData) { base.Initialize(record, referenceData); doorData = referenceData.DoorExitData; loadCell = referenceData.LoadCell; lockData = new LockData(referenceData.LockLevel, referenceData.Trap, referenceData.Key); }
public ReferenceData(System.IO.BinaryReader reader) { var index = reader.ReadInt32(); while (true) { var type = (SubRecordType)reader.ReadInt32(); var size = reader.ReadInt32(); switch (type) { case SubRecordType.Id: target = Record.GetRecord<CreatableRecord>(reader.ReadString(size)); break; case SubRecordType.Scale: scale = reader.ReadSingle(); break; case SubRecordType.DoorData: doorData = DoorExitData.Create(reader); break; case SubRecordType.DoorName: loadCell = reader.ReadString(size); break; case SubRecordType.FloatValue: lockLevel = reader.ReadInt32(); break; case SubRecordType.KeyName: key = Record.GetRecord<MiscItemRecord>(reader.ReadString(size)); break; case SubRecordType.Trapname: trap = Record.GetRecord<SpellRecord>(reader.ReadString(size)); break; case SubRecordType.ReferenceBlocked: referenceBlocked = reader.ReadByte() != 0; break; case SubRecordType.OwnerName: owner = Record.GetRecord<NpcRecord>(reader.ReadString(size)); break; case SubRecordType.BodyName: global = Record.GetRecord<Global>(reader.ReadString(size)); break; case SubRecordType.IntValue: health = reader.ReadInt32(); // Health remaining? Also charge for lights break; case SubRecordType.Name9: quantity = reader.ReadInt32(); //0, 1, 5, 10, 25, 100. Definitely value override or object count break; case SubRecordType.SoulName: soul = Record.GetRecord<CreatureRecord>(reader.ReadString(size)); break; case SubRecordType.Data: transformData = new TransformData(reader); break; case SubRecordType.CreatureName: faction = Record.GetRecord<Faction>(reader.ReadString(size)); break; case SubRecordType.Index: rank = reader.ReadInt32(); break; case SubRecordType.SoulCharge: charge = reader.ReadSingle(); break; default: reader.BaseStream.Position -= 8; return; } } }
public override void Initialize(System.IO.BinaryReader reader, RecordHeader header) { while (reader.BaseStream.Position < header.DataEndPos) { var type = (SubRecordType)reader.ReadInt32(); var size = reader.ReadInt32(); switch (type) { case SubRecordType.Id: name = reader.ReadString(size); break; case SubRecordType.Model: model = reader.ReadString(size); break; case SubRecordType.Name: fullName = reader.ReadString(size); break; case SubRecordType.RaceName: race = Record.GetRecord <Race>(reader.ReadString(size)); break; // Npc's have this even if they are part of no faction, so it needs to be checked if empty first case SubRecordType.Anam: string fac = reader.ReadString(size); faction = string.IsNullOrEmpty(fac) ? null : faction = Record.GetRecord <Faction>(fac); break; case SubRecordType.BodyName: head = BodyPartRecord.Get(reader.ReadString(size)); break; case SubRecordType.CreatureName: classId = Record.GetRecord <ClassRecord>(reader.ReadString(size)); break; case SubRecordType.KeyName: hair = BodyPartRecord.Get(reader.ReadString(size)); break; case SubRecordType.NpcData: npcData = new NpcRecordData(reader, size); break; case SubRecordType.Flag: npcFlags = (NpcFlags)reader.ReadInt32(); break; case SubRecordType.InventoryItem: items.Add(new InventoryItem(reader)); break; case SubRecordType.NpcSpell: spells.Add(Record.GetRecord <SpellRecord>(reader.ReadString(size))); break; case SubRecordType.AiData: aiData = new AiData(reader); break; case SubRecordType.AiWanderData: wanderData = new WanderData(reader); break; case SubRecordType.AiTravelData: travelData = new TravelData(reader); break; case SubRecordType.AiFollowData: followData = new FollowData(reader); break; case SubRecordType.AiEscortData: escortData = new EscortData(reader); break; case SubRecordType.ContainerData: cellEscortFollow = reader.ReadString(size); break; case SubRecordType.AiActivateData: activateData = new ActivateData(reader); break; case SubRecordType.DoorData: destinationData.Add(DoorExitData.Create(reader)); break; case SubRecordType.DoorName: destinations.Add(reader.ReadString(size)); break; case SubRecordType.Scale: scale = reader.ReadSingle(); break; case SubRecordType.Script: script = Script.Get(reader.ReadString(size)); break; } } }
public TravelDestination(DoorExitData doorExitData, string cell = null) { this.doorExitData = doorExitData; this.cell = cell; }