Initial commit
@@ -0,0 +1,22 @@
|
||||
Copyright (c) 2016 Christian Engel
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1,143 @@
|
||||
node-sunwell
|
||||
============
|
||||
|
||||
[](https://travis-ci.org/matkl/node-sunwell)
|
||||
[](https://coveralls.io/github/matkl/node-sunwell?branch=master)
|
||||
[](https://npmjs.org/package/node-sunwell "View this project on npm")
|
||||
|
||||
|
||||
An HTML5 canvas based renderer for hearthstone cards for node.js. Forked from [HearthSim/sunwell](https://github.com/HearthSim/sunwell).
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
See [HearthSim/sunwell](https://github.com/HearthSim/sunwell) for detailed information. Card artworks and fonts are not included. Set `textureFolder` to the folder where you put the card artworks when creating the sunwell object.
|
||||
|
||||
Installation
|
||||
------------
|
||||
```
|
||||
$ npm install --save node-sunwell
|
||||
```
|
||||
|
||||
Usage
|
||||
-----
|
||||
Set up sunwell with your own settings:
|
||||
|
||||
```javascript
|
||||
var Sunwell = require('node-sunwell');
|
||||
var sunwell = new Sunwell({
|
||||
titleFont: 'Belwe',
|
||||
bodyFont: 'ITC Franklin Condensed',
|
||||
bodyFontSize: 24,
|
||||
bodyLineHeight: 55,
|
||||
bodyFontOffset: {x: 0, y: 0},
|
||||
textureFolder: __dirname + '/artworks/',
|
||||
smallTextureFolder: __dirname + '/smallArtworks/',
|
||||
debug: false
|
||||
});
|
||||
```
|
||||
|
||||
###Rendering a card
|
||||
To render a specific card, you can call the method `createCard()` of the `sunwell` object.
|
||||
|
||||
```javascript
|
||||
var cardObj = sunwell.createCard(cardData, width, function(err, buffer) {
|
||||
// buffer contains PNG data
|
||||
});
|
||||
```
|
||||
|
||||
The `cardData` parameter is an object containing information about the card to be rendered. `width`
|
||||
defines the width of the card to be rendered. Sunwell provides a "native" resolution up to 764x1100
|
||||
pixels. While you can set a higher value than 764 for the desired render, it will only result in blurry
|
||||
results. The max supported resolution of sunwell is already by far greater than in the game itself.
|
||||
|
||||
The callback will be invoked with the rendered card buffer.
|
||||
|
||||
The object you pass as `cardData` can be obtained for example through [HearthstoneJSON](https://hearthstonejson.com/).
|
||||
|
||||
```javascript
|
||||
{
|
||||
"id":"CS2_087",
|
||||
"artist":"Zoltan Boros",
|
||||
"set":"CORE",
|
||||
"type":"SPELL",
|
||||
"rarity":"FREE",
|
||||
"cost":1,
|
||||
"name":"Blessing of Might",
|
||||
"flavor":"\"As in, you MIGHT want to get out of my way.\" - Toad Mackle, recently buffed.",
|
||||
"playRequirements":{"REQ_TARGET_TO_PLAY":0,"REQ_MINION_TARGET":0},
|
||||
"collectible":true,
|
||||
"playerClass":"PALADIN",
|
||||
"howToEarnGolden":"Unlocked at Level 45.",
|
||||
"howToEarn":"Unlocked at Level 1.",
|
||||
"text":"Give a minion +3 Attack.",
|
||||
"texture":"W16_a053_D"
|
||||
}
|
||||
```
|
||||
|
||||
Some properties are purely optional, since they are not used by sunwell, but these ones are required:
|
||||
|
||||
```javascript
|
||||
{
|
||||
"id":"CS2_087",
|
||||
"set":"CORE",
|
||||
"type":"SPELL",
|
||||
"rarity":"FREE",
|
||||
"cost":1,
|
||||
"name":"Blessing of Might",
|
||||
"playerClass":"PALADIN",
|
||||
"text":"Give a minion +3 Attack.",
|
||||
"texture":"W16_a053_D"
|
||||
}
|
||||
```
|
||||
|
||||
In case of a minion or weapon card, you also need to pass `health` (or `durability`, but health is fine for weapons, too) and/or `attack`.
|
||||
|
||||
The method will return an object that provides an interface to manipulate the card after its creation.
|
||||
|
||||
If you want to update certain properties on the original `cardData`, simply call `cardObj.update()` and
|
||||
pass an object with the properties you want to overwrite.
|
||||
|
||||
###Changing the number colors
|
||||
|
||||
If you want to make the numbers appear green/red, you can also pass in the following properties on your card object to both
|
||||
`createCard()` and/or `cardObj.update()`:
|
||||
|
||||
```javascript
|
||||
{
|
||||
"costStyle": "0",
|
||||
"attackStyle": "+",
|
||||
"healthStyle": "-",
|
||||
"durabilityStyle": "-"
|
||||
}
|
||||
```
|
||||
|
||||
All the style default to "0". Setting the style to "+" makes the number appear green, setting it to "-" makes it appear red.
|
||||
|
||||
|
||||
###Silence a minion
|
||||
To silence a minion, set `silenced: true` either when creating the card, or with the update function.
|
||||
|
||||
###Let a card cost health instead of mana
|
||||
Introduced by [Cho'gall](http://hearthstonelabs.com/cards#lang=enUS;detail=OG_121), cards may cost health instead of mana.
|
||||
You can switch any cards cost icon by setting `costHealth: true` either when creating the card, or through the update function.
|
||||
|
||||
## Examples
|
||||
|
||||
See [examples/](examples/).
|
||||
|
||||
## Author
|
||||
|
||||
Original work by Christian Engel <hello@wearekiss.com>
|
||||
|
||||
Node.js port by Matthias Klein <matthias@klein.pw>
|
||||
|
||||
## License
|
||||
|
||||
Sunwell is licensed
|
||||
[MIT](http://choosealicense.com/licenses/mit/). The full license text is
|
||||
available in the `LICENSE` file in the respective implementations' folder.
|
||||
|
||||
# This is not a standalone project!
|
||||
|
||||
[hm_sunwell](https://github.com/farb3yonddriv3n/hm_sunwell) is part of [hearthmod software stack](https://github.com/hearthmod/hearthmod)
|
||||
|
After Width: | Height: | Size: 252 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 417 KiB |
|
After Width: | Height: | Size: 50 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 310 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 308 KiB |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 48 KiB |
|
After Width: | Height: | Size: 76 KiB |
|
After Width: | Height: | Size: 82 KiB |
|
After Width: | Height: | Size: 287 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 296 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 66 KiB |
|
After Width: | Height: | Size: 59 KiB |
|
After Width: | Height: | Size: 98 KiB |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 63 KiB |
|
After Width: | Height: | Size: 59 KiB |
|
After Width: | Height: | Size: 68 KiB |
|
After Width: | Height: | Size: 107 KiB |
|
After Width: | Height: | Size: 37 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 53 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 9.8 KiB |
|
After Width: | Height: | Size: 63 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 6.9 KiB |
|
After Width: | Height: | Size: 79 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 128 KiB |
@@ -0,0 +1 @@
|
||||
Place the card artworks here in JPG format.
|
||||
|
After Width: | Height: | Size: 79 KiB |
|
After Width: | Height: | Size: 267 KiB |
|
After Width: | Height: | Size: 48 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 188 KiB |
|
After Width: | Height: | Size: 190 KiB |
|
After Width: | Height: | Size: 190 KiB |
|
After Width: | Height: | Size: 191 KiB |
|
After Width: | Height: | Size: 193 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 193 KiB |
|
After Width: | Height: | Size: 190 KiB |
|
After Width: | Height: | Size: 194 KiB |
|
After Width: | Height: | Size: 185 KiB |
|
After Width: | Height: | Size: 190 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 9.2 KiB |
|
After Width: | Height: | Size: 9.1 KiB |
|
After Width: | Height: | Size: 9.0 KiB |
|
After Width: | Height: | Size: 8.9 KiB |
|
After Width: | Height: | Size: 145 KiB |
|
After Width: | Height: | Size: 147 KiB |
|
After Width: | Height: | Size: 155 KiB |
|
After Width: | Height: | Size: 151 KiB |
|
After Width: | Height: | Size: 157 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 158 KiB |
|
After Width: | Height: | Size: 150 KiB |
|
After Width: | Height: | Size: 148 KiB |
|
After Width: | Height: | Size: 146 KiB |
|
After Width: | Height: | Size: 149 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 134 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 50 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 43 KiB |