https://github.com/2003scape/rsc-sprites
🖼️ (de)serialize runescape classic entity, ui and texture images
https://github.com/2003scape/rsc-sprites
bzip2 item javascript-game npc png rsc runescape sprites
Last synced: 7 months ago
JSON representation
🖼️ (de)serialize runescape classic entity, ui and texture images
- Host: GitHub
- URL: https://github.com/2003scape/rsc-sprites
- Owner: 2003scape
- License: agpl-3.0
- Created: 2020-05-11T16:27:17.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-11-14T23:34:28.000Z (almost 3 years ago)
- Last Synced: 2023-03-03T11:24:40.725Z (over 2 years ago)
- Topics: bzip2, item, javascript-game, npc, png, rsc, runescape, sprites
- Language: JavaScript
- Homepage:
- Size: 567 KB
- Stars: 5
- Watchers: 3
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
# rsc-sprites
(de)serialize runescape classic entity, ui and texture images.IMAGE COLLAGE
## install
$ npm install @2003scape/rsc-sprites
## example
```javascript
```## api
### entitySprites = new EntitySprites({ animations })
create a new entity sprite (de)serializer (for entity jag and mem files). these
are collections of frames for monster, character and equipment graphics.### entitySprites.loadJag(buffer)
### entitySprites.loadMem(buffer)
prepare `.jag` and `.mem` buffers to be parsed. any sprites loaded with
`entitySprites.loadMem` will have `sprite.members = true`.### entitySprites.parseArchives()
populate `entitySprites.sprites` with frames of
[canvas](https://github.com/Automattic/node-canvas) objects.### entitySprites.getAnimationSprite(id, overlay?, skinColour?)
### entitySprites.toJag()
### entitySprites.toMem()
return an entities jag/mem archive.### mediaSprites = new MediaSprites({ items, projectileSprite }, ui?)
create a new media sprite (de)serializer. these are images of interface items
(buttons, arrows) and inventory items. `ui` specifies the filenames, sprite
offsets and amounts for interface sprites
[hard-coded into the client](
https://github.com/2003scape/rsc-client/blob/master/src/mudclient.js#L4350):```javascript
// refers to "splat.dat"
splat: {
offset: 11,
sprites: 3
},
// etc.
```this defaults to the interface sprites found in `media58.jag` for
mudclient204 (`./res/media-offsets.json`).### mediaSprites.loadArchive(buffer)
load and prepare a media jag archive buffer.### mediaSprites.getSpriteById(id)
get a media sprite canvas by the id used in the client.### mediaSprites.getSpriteByItemId(itemId)
get a colourized item sprite canvas based on its id (index in `config.items`).## license
Copyright 2020 2003Scape TeamThis 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/.