How to use the restructure.Reserved function in restructure

To help you get started, we’ve selected a few restructure examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wowserhq / blizzardry / lib / wdt / index.js View on Github external
'use strict';

var r = require('restructure');
var Chunk = require('../chunked/chunk');
var Chunked = require('../chunked');
var SkipChunk = require('../chunked/skip-chunk');

var MPHD = Chunk({
  flags: r.uint32le,
  skip: new r.Reserved(r.uint32le, 7)
});

var Tile = new r.Struct({
  flags: r.uint32le,
  skip: new r.Reserved(r.uint32le)
});

var MAIN = Chunk({
  tiles: new r.Array(Tile, 4096)
});

module.exports = Chunked({
  MPHD: MPHD,
  MAIN: MAIN,
  MWMO: require('../chunked/mwmo'),
  // TODO: Optional MODF chunk
github wowserhq / blizzardry / src / lib / wdt / index.js View on Github external
import r from 'restructure';

import Chunk from '../chunked/chunk';
import Chunked from '../chunked';
import MWMO from '../chunked/mwmo';

const MPHD = Chunk({
  flags: r.uint32le,
  skip: new r.Reserved(r.uint32le, 7),
});

const Tile = new r.Struct({
  flags: r.uint32le,
  skip: new r.Reserved(r.uint32le),
});

const MAIN = Chunk({
  tiles: new r.Array(Tile, 4096),
});

export default Chunked({
  MPHD: MPHD,
  MAIN: MAIN,
  MWMO: MWMO,
  // TODO: Optional MODF chunk

  flags: function () {
    return this.MPHD.flags;
  },
github wowserhq / blizzardry / src / lib / wmo / group.js View on Github external
import Chunked from '../chunked';
import SkipChunk from '../chunked/skip-chunk';
import { Vec3Float, float32array2, float32array3 } from '../types';

const MOGP = Chunk({
  nameOffset: r.uint32le,
  descriptionOffset: r.uint32le,
  flags: r.uint32le,
  minBoundingBox: Vec3Float,
  maxBoundingBox: Vec3Float,
  portalOffset: r.uint16le,
  aBatchCount: r.uint16le,
  interiorBatchCount: r.uint16le,
  exteriorBatchCount: r.uint16le,
  fogOffsets: new r.Array(r.uint8, 4),
  unknown: new r.Reserved(r.uint32le),
  groupID: r.uint32le,
  unknowns: new r.Reserved(r.uint32le, 3),
});

const MOPY = Chunk({
  triangles: new r.Array(new r.Struct({
    flags: r.uint8,
    materialID: r.int8,
  }), 'size', 'bytes'),
});

const MOVI = Chunk({
  triangles: new r.Array(r.uint16le, 'size', 'bytes'),
});

const MOVT = Chunk({
github wowserhq / blizzardry / lib / dbc / entities / terrain-type.js View on Github external
'use strict';

var r = require('restructure');
var Entity = require('../entity');
var StringRef = require('../string-ref');

module.exports = Entity({
  id: r.uint32le,
  name: StringRef,
  unknowns: new r.Reserved(r.uint32le, 2),
  soundID: r.uint32le,
  flags: r.uint32le
});
github wowserhq / blizzardry / lib / dbc / entities / talent.js View on Github external
'use strict';

var r = require('restructure');
var Entity = require('../entity');

module.exports = Entity({
  id: r.uint32le,
  tabID: r.uint32le,
  tierID: r.uint32le,
  columnIndex: r.uint32le,
  spellRankIDs: new r.Array(r.uint32le, 9),
  preqreqTalentIDs: new r.Array(r.uint32le, 3),
  preqreqRanks: new r.Array(r.uint32le, 3),
  flags: r.uint32le,
  requiredSpellID: r.uint32le,
  unknowns: new r.Reserved(r.uint32le, 2)
});
github wowserhq / blizzardry / src / lib / dbc / entities / creature-display-info.js View on Github external
import Entity from '../entity';
import StringRef from '../string-ref';

export default Entity({
  id: r.uint32le,
  modelID: r.uint32le,
  soundID: r.uint32le,
  extraInfoID: r.uint32le,
  scale: r.floatle,
  opacity: r.uint32le,
  skin1: StringRef,
  skin2: StringRef,
  skin3: StringRef,
  portraitTexture: StringRef,

  skips: new r.Reserved(r.uint32le, 6),
});
github wowserhq / blizzardry / lib / dbc / entities / faction-template.js View on Github external
'use strict';

var r = require('restructure');
var Entity = require('../entity');

module.exports = Entity({
  id: r.uint32le,
  factionID: r.uint32le,
  unknown: new r.Reserved(r.uint32le),
  groupMask: r.uint32le,
  friendlyMask: r.uint32le,
  hostileMask: r.uint32le,
  relatedFactionIDs: new r.Array(r.uint32le, 8)
});
github wowserhq / blizzardry / src / lib / dbc / entities / item-extended-cost.js View on Github external
import r from 'restructure';

import Entity from '../entity';

export default Entity({
  id: r.uint32le,
  costHonor: r.uint32le,
  costArena: r.uint32le,
  itemIDs: new r.Array(r.uint32le, 5),
  itemCounts: new r.Array(r.uint32le, 5),
  personalRating: r.uint32le,
  purchaseGroupID: r.uint32le,
  unknown: new r.Reserved(r.uint32le),
});
github wowserhq / blizzardry / lib / dbc / entities / screen-effect.js View on Github external
'use strict';

var r = require('restructure');
var Entity = require('../entity');
var StringRef = require('../string-ref');

module.exports = Entity({
  id: r.uint32le,
  name: StringRef,
  type: r.uint32le,
  rgba: new r.Array(r.uint8, 4),
  edge: r.uint32le,
  bw: r.uint32le,
  unknown: new r.Reserved(r.uint32le),
  lightParamsID: r.int32le,
  soundAmbienceID: r.uint32le,
  zoneMusicID: r.uint32le
});
github wowserhq / blizzardry / src / lib / dbc / entities / chr-classes.js View on Github external
import r from 'restructure';

import Entity from '../entity';
import LocalizedStringRef from '../localized-string-ref';
import StringRef from '../string-ref';

export default Entity({
  id: r.uint32le,

  skip: new r.Reserved(r.uint32le),

  powerType: r.uint32le,
  petType: r.uint32le,

  name: LocalizedStringRef,
  nameFemale: LocalizedStringRef,
  nameMale: LocalizedStringRef,
  filename: StringRef,

  spellClassSet: r.uint32le,
  flags: r.uint32le,
  cameraID: r.uint32le,
  expansionID: r.uint32le,
});