rsc-config
(de)serialize runescape classic config files. parse config
archive files into
arrays of objects and re-encode + re-compress them back to the original format.
install
$ npm install @2003scape/rsc-config # -g for CLI program
cli usage
rsc-config <command>
Commands:
rsc-config dump-json <archive> dump JSON files of each config
section
rsc-config pack-json <archive> <files..> encode and compress JSON files into
config archive
Options:
--help Show help [boolean]
--version Show version number [boolean]
example
const fs = require('fs');
const { Config } = require('./src');
const config = new Config();
config.loadArchive(fs.readFileSync('./config85.jag'));
config.items = config.items.map(item => {
item.name = item.name.split('').reverse().join('');
return item;
});
config.npcs = config.npcs.map(npc => {
npc.width = Math.floor(npc.width * 4/3);
npc.height = Math.floor(npc.height * 4/3);
return npc;
});
config.animations = config.animations.map(animation => {
if (animation.colour) {
animation.colour = '#ff00ff';
}
return animation;
});
fs.writeFileSync('./config86.jag', config.toArchive());
api
config.items
array of deserialized inventory items (swords, coins, food, etc.). these are
called "objects" in jagex documentation.
[
{
name: 'item name',
description: 'text displayed when examined',
command: 'Bury',
sprite: 123,
price: 12345,
stackable: false,
special: false,
equip: [
'2-handed',
'cape',
'chest',
'feet',
'hands',
'legs',
'body',
'head',
'right-hand',
'left-hand',
'replace-legs',
'replace-body',
'replace-head'
] || null,
colour: 'rgb(255, 0, 255)' || '#ff00ff' || null,
untradeable: false,
members: false
}
]
config.npcs
array of deserialized NPCs (non-player-characters; monsters).
[
{
name: 'npc name',
description: 'text displayed when examined',
command: '',
attack: 12,
strength: 23,
hits: 34,
defense: 56,
hostility: null || 'retreats' || 'combative' || 'aggressive',
animations: [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
hairColour: 'rgb(255, 0, 255)' || '#ff00ff' || null,
topColour: 'rgb(255, 0, 255)' || '#ff00ff' || null,
bottomColour: 'rgb(255, 0, 255)' || '#ff00ff' || null,
skinColour: 'rgb(255, 0, 255)' || '#ff00ff' || null,
width: 123,
height: 456,
walkModel: 6,
combatModel: 6,
combatAnimation: 5
}
]
config.textures
array of deserialized textures. these are used for walls, overlay tiles, roofs
and objects.
[
{
name: 'wall',
subName: 'door'
}
]
config.animations
array of deserialized animations. these are used for NPCs, players and wieldable
items.
[
{
name: 'entity jag sprite collection',
colour: 'rgb(255, 0, 255)' || '#ff00ff' || null,
genderModel: 0,
hasA: true,
hasF: false
}
]
config.objects
array of deserialized game objects (tree, altar, furnace, etc.). these are
called "locations" in jagex documentation.
[
{
name: 'object name',
description: 'text displayed when examined',
commands: [
'WalkTo',
'Examine'
],
model: {
name: 'model jag model name',
id: 12
},
width: 1,
height: 1,
type: 'unblocked' || 'blocked' || 'closed-door' || 'open-door',
itemHeight: 123
},
]
config.wallObjects
array of deserialized wall objects (doors, walls) and are called "boundaries"
in jagex documentation. unlike game objects, they don't take up entire tiles if
they're blocking so they're useful for collision detection. their locations are
in the landscape archives.
[
{
name: 'wall name',
description: 'text displayed when examined',
commands: [
'WalkTo',
'Examine'
],
height: 192,
colourFront: 'rgb(255, 0, 255)' || '#ff00ff' || null,
textureFront: 2,
colourBack: 'rgb(255, 0, 255)' || '#ff00ff' || null,
textureBack: 2,
blocked: true,
invisible: false
}
]
config.roofs
array of deserialized roofs. their locations are in the landscape archives.
[
{
height: 64,
texture: 6
}
]
config.tiles
array of deserialized tile overlays. their locations are in the landscape
archives.
[
{
colour: 'rgb(255, 0, 255)' || null,
texture: 12 || null,
type: 'ground' || 'floor' || 'liquid' || 'bridge' || 'hole',
blocked: false
}
]
config.projectileSprite
decoded projectile sprite index.
config.spells
array of deserialized magic spells.
[
{
name: 'spell name',
description: 'spell description',
level: 1,
type: 'self' || 'offensive' || 'inventory' || 'object',
runes: [
{
id: 33,
amount: 1
}
]
}
]
config.prayers
array of deserialized prayers.
[
{
name: 'prayer name',
description: 'prayer description',
level: 12,
drain: 34
}
]
config = new Config()
create new config (de)serializer instance.
config.loadArchive(buffer)
load a config jag archive buffer.
config.toArchive()
return a config jag archive.
SECTIONS
an array of config sections.
[
'items', 'npcs', 'textures', 'animations', 'objects', 'wallObjects',
'roofs', 'tiles', 'spells', 'prayers', 'models'
]
license
Copyright 2019 2003Scape Team
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU Affero General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along
with this program. If not, see http://www.gnu.org/licenses/.