项目作者: 2003scape

项目描述 :
🖼️ (de)serialize runescape classic entity, ui and texture images
高级语言: JavaScript
项目地址: git://github.com/2003scape/rsc-sprites.git
创建时间: 2020-05-11T16:27:17Z
项目社区:https://github.com/2003scape/rsc-sprites

开源协议:GNU Affero General Public License v3.0

下载


rsc-sprites

(de)serialize runescape classic entity, ui and texture images.

IMAGE COLLAGE

install

  1. $ npm install @2003scape/rsc-sprites

example

  1. ```
  2. ## api
  3. ### entitySprites = new EntitySprites({ animations })
  4. create a new entity sprite (de)serializer (for entity jag and mem files). these
  5. are collections of frames for monster, character and equipment graphics.
  6. ### entitySprites.loadJag(buffer)
  7. ### entitySprites.loadMem(buffer)
  8. prepare `.jag` and `.mem` buffers to be parsed. any sprites loaded with
  9. `entitySprites.loadMem` will have `sprite.members = true`.
  10. ### entitySprites.parseArchives()
  11. populate `entitySprites.sprites` with frames of
  12. [canvas](https://github.com/Automattic/node-canvas) objects.
  13. ### entitySprites.getAnimationSprite(id, overlay?, skinColour?)
  14. ### entitySprites.toJag()
  15. ### entitySprites.toMem()
  16. return an entities jag/mem archive.
  17. ### mediaSprites = new MediaSprites({ items, projectileSprite }, ui?)
  18. create a new media sprite (de)serializer. these are images of interface items
  19. (buttons, arrows) and inventory items. `ui` specifies the filenames, sprite
  20. offsets and amounts for interface sprites
  21. [hard-coded into the client](
  22. https://github.com/2003scape/rsc-client/blob/master/src/mudclient.js#L4350):
  23. ```javascript
  24. // refers to "splat.dat"
  25. splat: {
  26. offset: 11,
  27. sprites: 3
  28. },
  29. // 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 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/.