示例#1
0
 public NonPlayerCharacter(Model model, uint size = 100)
 {
     _model = model;
     _size  = Math.Min(Math.Max(size, 6), 250);
     _flags = NpcFlags.Unknown3;
 }
示例#2
0
    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;
            }
        }
    }