API to create fancy cards for FFXIV characters based on their Lodestone data, hosted at https://ffxiv-character-cards.herokuapp.com.
Find a file
2021-05-28 11:30:41 -07:00
.github/workflows Add identity to documentation Action 2021-05-28 11:30:41 -07:00
cj Scale scholar down a bit 2021-05-27 15:45:13 +02:00
.gitignore Add documentation website with generator 2021-05-27 19:23:29 -07:00
.npmignore Add .github to .npmignore 2021-05-28 02:30:55 -07:00
chara.png Clean up bg a little more 2021-05-27 03:37:51 +02:00
chara_n.png Add express server, cleanup 2021-05-25 23:54:48 +02:00
create-card.js Add example to createCard() doc 2021-05-28 02:06:50 -07:00
gh-pages.js Add documentation website with generator 2021-05-27 19:23:29 -07:00
ilvl_n.png Add Item level 2021-05-27 02:36:02 +02:00
index.js Handle errors in ensureInit() 2021-05-26 23:34:40 +02:00
jobbg.psd Scale scholar down a bit 2021-05-27 15:45:13 +02:00
LICENSE Create LICENSE 2021-05-27 12:41:32 -04:00
minion.png Add mounts & minions 2021-05-26 01:03:30 +02:00
mount.png Add mounts & minions 2021-05-26 01:03:30 +02:00
package-lock.json Install nodemon as a dev dependency 2021-05-28 08:23:46 -07:00
package.json Install nodemon as a dev dependency 2021-05-28 08:23:46 -07:00
readme.md Add badges to README 2021-05-27 19:28:10 -07:00
shadow.png Add Item level 2021-05-27 02:36:02 +02:00
SourceSansPro-Regular.ttf Add express server, cleanup 2021-05-25 23:54:48 +02:00
SourceSansPro-SemiBold.ttf Add express server, cleanup 2021-05-25 23:54:48 +02:00

XIV Character Cards

npm Version Documentation

API to create fancy cards for FFXIV characters based on their Lodestone data, hosted at https://ffxiv-character-cards.herokuapp.com.

Demo image

Endpoints

Getting images

https://ffxiv-character-cards.herokuapp.com/characters/id/<LODESTONE ID>.png
Get the PNG for a character by its Lodestone ID.


https://ffxiv-character-cards.herokuapp.com/characters/name/<WORLD>/<CHARACTER NAME>.png
Get the PNG for a character by its world and name.

Requesting images to be cached

If you are using this API together with an application that requires the API to respond very quickly, like Discord, you need to ask it to "prepare" the image for a character beforehand.

https://ffxiv-character-cards.herokuapp.com/prepare/id/<LODESTONE ID>
Request a character image to be cached by its Lodestone ID.


https://ffxiv-character-cards.herokuapp.com/prepare/name/<WORLD>/<CHARACTER NAME>
Request a character image to be cached by its world and name.

The API will reply with its status, and in case of success, the URL to the final image. {"status":"ok","url":"/characters/id/123456789.png"}

Using in your application

yarn add xiv-character-cards
# or
npm i xiv-character-cards

You will receive a PNG-buffer for you to use in your bot or application.
Check index.js for other usage examples.

Example

const { CardCreator } = require("xiv-character-cards");
const fs = require("fs");

const card = new CardCreator();
const lodestoneid = "13821878";

function example(cb) {
  card.ensureInit()
    .then(
      () => card.createCard(lodestoneid),
      (reason) => cb("Init failed: " + reason, null)
    )
    .then((image) =>
      cb(null, {
        binary: {
          image: image,
        },
      })
    )
    .catch((reason) => cb("createCard failed: " + reason, null));
}

example((err, response) => {
  const buffer = response.binary.image;
  fs.writeFileSync(`./${lodestoneid}.png`, response.binary.image, (err) => {
    if (err) {
      console.log(err);
    }
  });
});