How to use the restructure.int32le 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 / dbc / entities / creature-model-data.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,
  flags: r.uint32le,
  file: StringRef,
  sizeClass: r.uint32le,
  scale: r.floatle,
  bloodID: r.int32le,

  skips: new r.Reserved(r.uint32le, 22)
});
github wowserhq / blizzardry / lib / m2 / bone.js View on Github external
'use strict';

var r = require('restructure');
var AnimationBlock = require('./animation-block');
var Nofs = require('./nofs');

var _require = require('../types');

var QuatShort = _require.QuatShort;
var Vec3Float = _require.Vec3Float;

module.exports = new r.Struct({
  keyBoneID: r.int32le,
  flags: r.uint32le,
  parentID: r.int16le,
  subMeshID: r.int16le,

  unknowns: new r.Reserved(r.uint16le, 2),

  translation: new AnimationBlock(Vec3Float),
  rotation: new AnimationBlock(QuatShort),
  scaling: new AnimationBlock(Vec3Float),

  pivotPoint: Vec3Float
});
github wowserhq / blizzardry / lib / dbc / entities / spell.js View on Github external
powerType: r.uint32le,
  manaCost: r.uint32le,
  manaCostPerlevel: r.uint32le,
  manaPerSecond: r.uint32le,
  manaPerSecondPerLevel: r.uint32le,
  rangeID: r.uint32le,
  speed: r.floatle,
  modalNextSpell: r.uint32le,
  stackAmount: r.uint32le,

  totemIDs: new r.Array(r.uint32le, 2),
  reagentIDs: new r.Array(r.uint32le, 8),
  reagentCounts: new r.Array(r.uint32le, 8),

  equippedItemClassID: r.int32le,
  equippedItemSubClassMask: r.int32le,
  equippedItemInventoryTypeMask: r.int32le,

  effectIDs: new r.Array(r.uint32le, 3),
  effectDieSides: new r.Array(r.int32le, 3),
  effectBaseDices: new r.Array(r.uint32le, 3),
  effectDicesPerLevel: new r.Array(r.uint32le, 3),
  effectRealPointsPerLevel: new r.Array(r.floatle, 3),
  effectBasePoints: new r.Array(r.int32le, 3),
  effectMechanicIDs: new r.Array(r.uint32le, 3),
  effectImplicitTargets: new r.Array(r.uint32le, 6),
  effectRadiusIDs: new r.Array(r.uint32le, 3),
  effectAurasIDs: new r.Array(r.uint32le, 3),
  effectAmplitudes: new r.Array(r.uint32le, 3),
  effectProcValues: new r.Array(r.floatle, 3),
  effectChainTargets: new r.Array(r.uint32le, 3),
  effectItemTypes: new r.Array(r.uint32le, 3),
github wowserhq / blizzardry / lib / dbc / entities / world-state-ui.js View on Github external
'use strict';

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

module.exports = Entity({
  id: r.uint32le,
  mapID: r.int32le,
  zoneID: r.uint32le,
  phase: r.uint32le,
  //icon: StringRef,
  text: LocalizedStringRef,
  description: LocalizedStringRef,
  state: r.int32le,
  worldState: r.uint32le,
  type: r.uint32le,
  icon: StringRef,
  tooltip: LocalizedStringRef,
  ui: StringRef,
  stateVariables: new r.Array(r.uint32le, 3)
});
github wowserhq / blizzardry / lib / dbc / entities / taxi-path.js View on Github external
'use strict';

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

module.exports = Entity({
  id: r.uint32le,
  originID: r.uint32le,
  destinationID: r.int32le,
  cost: r.uint32le
});
github wowserhq / blizzardry / lib / dbc / entities / creature-family.js View on Github external
var r = require('restructure');
var Entity = require('../entity');
var LocalizedStringRef = require('../localized-string-ref');
var StringRef = require('../string-ref');

module.exports = Entity({
  id: r.uint32le,
  minScale: r.floatle,
  minScaleLevel: r.uint32le,
  maxScale: r.floatle,
  maxScaleLevel: r.uint32le,
  skillIDs: new r.Array(r.uint32le, 2),
  petFoodMask: r.uint32le,
  petTalentType: r.int32le,
  categoryEnumID: r.int32le,
  name: LocalizedStringRef,
  iconFile: StringRef
});
github wowserhq / blizzardry / src / lib / wmo / index.js View on Github external
}), 3),

    unknowns: new r.Reserved(r.uint32le, 4),
  }), 'size', 'bytes'),
});

const MOGN = Chunk({
  names: new r.Array(new r.String(null), 'size', 'bytes'),
});

const MOGI = Chunk({
  groups: new r.Array(new r.Struct({
    flags: r.uint32le,
    minBoundingBox: Vec3Float,
    maxBoundingBox: Vec3Float,
    nameOffset: r.int32le,

    indoor: function () {
      return (this.flags & 0x2000) !== 0 && (this.flags & 0x8) === 0;
    },
  }), 'size', 'bytes'),
});

const MOSB = Chunk({
  skybox: new r.String('size'),
});

const MODS = Chunk({
  sets: new r.Array(new r.Struct({
    name: new r.String(20),
    startIndex: r.uint32le,
    doodadCount: r.uint32le,
github wowserhq / blizzardry / lib / dbc / entities / creature-family.js View on Github external
'use strict';

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

module.exports = Entity({
  id: r.uint32le,
  minScale: r.floatle,
  minScaleLevel: r.uint32le,
  maxScale: r.floatle,
  maxScaleLevel: r.uint32le,
  skillIDs: new r.Array(r.uint32le, 2),
  petFoodMask: r.uint32le,
  petTalentType: r.int32le,
  categoryEnumID: r.int32le,
  name: LocalizedStringRef,
  iconFile: StringRef
});
github wowserhq / blizzardry / src / lib / dbc / entities / achievement.js View on Github external
import r from 'restructure';

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

export default Entity({
  id: r.uint32le,
  faction: r.int32le,
  mapID: r.int32le,
  previousID: r.uint32le,
  name: LocalizedStringRef,
  description: LocalizedStringRef,
  categoryID: r.uint32le,
  points: r.uint32le,
  order: r.uint32le,
  flags: r.uint32le,
  spellIconID: r.uint32le,
  reward: LocalizedStringRef,
  minimumCriteria: r.uint32le,
  criteriaTreeID: r.uint32le,
});
github wowserhq / blizzardry / src / lib / dbc / entities / creature-model-data.js View on Github external
import r from 'restructure';

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

export default Entity({
  id: r.uint32le,
  flags: r.uint32le,
  file: StringRef,
  sizeClass: r.uint32le,
  scale: r.floatle,
  bloodID: r.int32le,

  skips: new r.Reserved(r.uint32le, 22),
});