Пример #1
0
        public DBC(Stream src)
        {
            using (src)
            {
                using (var reader = new BinaryReader(src))
                {
                    var magic = reader.ReadBytes(4);
                    RecordCount = reader.ReadInt32();
                    Records = new List<Record>(RecordCount);
                    Fields = reader.ReadInt32();
                    RecordSize = reader.ReadInt32();
                    var stringBlockSize = reader.ReadInt32();

                    for (int i = 0; i < RecordCount; i++)
                    {
                        var rec = new Record(this);
                        Records.Add(rec);
                        int size = 0;
                        for (int f = 0; f < Fields; f++)
                        {
                            if (size + 4 > RecordSize)
                            {
                                IsFaulty = true;
                                break;
                            }
                            rec.Values.Add(reader.ReadInt32());
                            size += 4;
                        }
                    }

                    StringBlock = reader.ReadBytes(stringBlockSize);
                }
            }
        }
Пример #2
0
        public TaxiNode(Record src)
        {
            Id = src[0];
            Name = src.GetString(5);
            MapId = src[1];
            Location = new Vector3(src.GetFloat(2), src.GetFloat(3), src.GetFloat(4));

            IsHorde = KnownHordeMounts.Contains(src[6]) || KnownHordeMounts.Contains(src[7]);
            IsAlliance = KnownAllianceMounts.Contains(src[6]) || KnownAllianceMounts.Contains(src[7]);
        }
Пример #3
0
 public WorldMapArea(Record src)
 {
     Id = src[0];
     Map = src[1];
     Area = src[2];
     Name = src.GetString(3);
     BMin = new float[2];
     BMin[0] = src.GetFloat(7);
     BMin[1] = src.GetFloat(5);
     BMax = new float[2];
     BMax[0] = src.GetFloat(6);
     BMax[1] = src.GetFloat(4);
 }