Compare commits

...

53 commits

Author SHA1 Message Date
aly
af65a8da13 Add captain-definition 2024-06-11 18:02:28 +10:00
ArcaneDisgea
f16496b285 update deps 2022-10-17 18:30:54 -04:00
ArcaneDisgea
654265c95f
Merge branch 'xivapi:master' into master 2022-10-17 18:19:17 -04:00
ArcaneDisgea
8a5afe38cd index to server because deployment needs it I guess 2022-10-17 18:18:32 -04:00
ArcaneDisgea
a59c513cc6
Merge pull request #36 from ArcaneDisgea/master
bump version 1.5.0
2022-10-17 18:07:26 -04:00
ArcaneDisgea
53f7fa28ff 1.5.0 2022-10-17 18:05:49 -04:00
ArcaneDisgea
d0a88cf4d3
Merge pull request #35 from ArcaneDisgea/master
bump canvas for arm and update job array length
2022-10-17 18:04:44 -04:00
ArcaneDisgea
19e8e37173 bump canvas for arm and update job array length 2022-10-17 18:01:12 -04:00
ArcaneDisgea
c1821fa834
bump version 2022-10-09 14:04:45 -04:00
ArcaneDisgea
a93d4bacf8
Merge pull request #34 from SocMinarch/fix-for-mimo-and-no-gc
Fixes mounts/minions percentages always showing as `N/A%`, and for crashing when a character has no Grand Company
2022-10-09 14:02:04 -04:00
Adam Chance
248bb7365e Fix generating cards for characters with no Grand Company 2022-10-09 17:27:03 +01:00
Adam Chance
56e8d7e030 Fix mounts/minions percentages always showing as N/A% 2022-10-09 17:26:35 +01:00
ArcaneDisgea
25905928e9
Job Backgrounds
This will not resolve the issue with them loading as blu. That is an issue with the xivapi lodestone-parser that will need to be fixed.
2021-12-14 10:48:00 -05:00
arcanedisgea
626d8138ae 1.4.1 2021-12-07 15:42:15 -05:00
arcanedisgea
6d6cfe6df6 fix scholar levels 2021-12-07 15:39:50 -05:00
ArcaneDisgea
69eac7df0c
Merge pull request #28 from xivapi/beginrunner
less pixelated icons
2021-12-03 13:27:19 -05:00
arcanedisgea
0a7d22b441 less pixelated this time 2021-12-03 13:26:19 -05:00
arcanedisgea
d101cfdb0b 1.4.0 2021-12-03 13:14:16 -05:00
ArcaneDisgea
c82fe1e89a
Merge pull request #27 from xivapi/beginrunner
Add Endwalker support
2021-12-03 13:10:54 -05:00
arcanedisgea
805c98ef57 reaper/sage update 2021-12-03 13:09:44 -05:00
arcanedisgea
a39ad7c20b xivapi index update 2021-12-03 10:37:47 -05:00
arcanedisgea
68891ed450 placeholder icons 2021-12-02 09:30:02 -05:00
arcanedisgea
ae7524a85e adjust jobs rect for new jobs 2021-12-02 09:29:26 -05:00
arcanedisgea
f9f98633f3 work around null mimo from xivapi
just until nodestone is used for the cards
2021-12-02 08:38:17 -05:00
arcanedisgea
0429f1d562 add new jobs to classJobs array 2021-12-02 08:00:55 -05:00
ArcaneDisgea
aff43cef4c
Merge pull request #26 from carlomorgenstern/master
rework/enhancement
2021-10-28 19:45:10 -04:00
Carlo Morgenstern
453e5234bb Bumped version to 1.3 2021-10-25 16:48:38 +02:00
Carlo Morgenstern
23b9d6a007 Updated README 2021-10-25 16:48:33 +02:00
Carlo Morgenstern
c049af4c21 Reordered crafters and gatherers to be consistent with game 2021-10-25 16:48:25 +02:00
Carlo Morgenstern
bbc38b6a9c Completely reworked card creation to optimize for data fetching and improve documentation 2021-10-25 16:48:19 +02:00
Carlo Morgenstern
52a8960f71 Reworked getItemLevel to filter all equip slots 2021-10-25 16:48:14 +02:00
Carlo Morgenstern
a677d723cb Reworked createCrest to load all layers at once 2021-10-25 16:48:09 +02:00
Carlo Morgenstern
aa036b169e CardCreator reworked init to load everything in parallel 2021-10-25 16:48:01 +02:00
Carlo Morgenstern
efde0b5ecd Moved copyright year to card creation, so it's always current 2021-10-25 16:47:53 +02:00
Carlo Morgenstern
37def4245e CardCreator: Updated ensureInit to proper singleton 2021-10-25 16:47:48 +02:00
Carlo Morgenstern
3a9e4d7502 Added init complete log to server 2021-10-25 16:47:40 +02:00
Carlo Morgenstern
a13758dcb1 Consistent styling: no var for CardCreator 2021-10-25 16:47:34 +02:00
Carlo Morgenstern
da3dc236fe Consistent styling: all single quotes for CardCreator 2021-10-25 16:47:26 +02:00
Carlo Morgenstern
ad98ec4d74 Added basic language support to CardCreator 2021-10-25 16:47:00 +02:00
Carlo Morgenstern
0a39d21f29 Updated gh-pages to similar styling 2021-10-25 16:42:28 +02:00
Carlo Morgenstern
e304b70e08 Updated createIlvlFilter to include xivApiKey 2021-10-25 16:42:13 +02:00
Carlo Morgenstern
2023697686 Added optional xivApiKey to CardCreator 2021-10-25 16:41:34 +02:00
Carlo Morgenstern
e6d9d10182 Added CardCreator init on server startup 2021-10-25 16:41:10 +02:00
Carlo Morgenstern
3fc98f5d0a Deleted unused resource files 2021-10-25 16:41:03 +02:00
Carlo Morgenstern
867c7895ce Moved resource files into one directory 2021-10-25 16:40:53 +02:00
Carlo Morgenstern
1bbcae6119 Added rate limiter to all XIV API requests 2021-10-25 16:40:39 +02:00
Carlo Morgenstern
3ebbb867b2 Reworked webserver to eliminate redundant code 2021-10-25 16:40:26 +02:00
Carlo Morgenstern
73b396c05e Cleaned up index imports 2021-10-25 16:37:02 +02:00
Carlo Morgenstern
3e17cbd90d Updated dependencies 2021-10-25 16:34:44 +02:00
ArcaneDisgea
77b5cb5e76
Merge pull request #24 from ImVaskel/features/json-errors
make 404 return json instead of text
2021-10-01 14:24:29 -04:00
ImVaskel
3e2f736cb1
make 404 return json instead of text 2021-10-01 14:14:14 -04:00
ArcaneDisgea
b5313a8f2b
Merge pull request #23 from ArcaneDisgea/better-ilvl-calc
iLvl filter
2021-10-01 13:31:23 -04:00
ArcaneDisgea
cf18fb572e
Merge pull request #22 from ArcaneDisgea/master
change const to let to avoid TypeError
2021-08-21 16:45:00 -04:00
102 changed files with 1883 additions and 2481 deletions

View file

@ -1,4 +1,4 @@
index.js server.js
docs/ docs/
gh-pages.js gh-pages.js
.github/ .github/

10
captain-definition Normal file
View file

@ -0,0 +1,10 @@
{
"schemaVersion": 2,
"dockerfileLines": [
"FROM node as build",
"COPY . /app",
"WORKDIR /app",
"RUN npm i",
"CMD npm run start"
]
}

BIN
chara.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 821 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 606 KiB

View file

@ -1,33 +1,27 @@
const fetch = require("node-fetch"); const fetch = require('node-fetch');
const path = require("path"); const path = require('path');
const { createCanvas, loadImage, registerFont } = require("canvas"); const { createCanvas, loadImage, registerFont } = require('canvas');
const createilvlfilter = require('./createilvlfilter')
let ilvlarray; const createIlvlFilter = require('./create-ilvl-filter');
console.log('Generating ilvl filter')
createilvlfilter().then((ilvlfilter) => {
ilvlarray = ilvlfilter;
console.log("ilvl filter generated!")
})
function absolute(relativePath) { function absolute(relativePath) {
return path.join(__dirname, relativePath); return path.join(__dirname, relativePath);
} }
registerFont(absolute('SourceSansPro-Regular.ttf'), { family: 'Source Sans Pro', style: 'Regular' }); registerFont(absolute('./resources/SourceSansPro-Regular.ttf'), { family: 'Source Sans Pro', style: 'Regular' });
registerFont(absolute('SourceSansPro-SemiBold.ttf'), { family: 'Source Sans Pro', style: 'SemiBold' }); registerFont(absolute('./resources/SourceSansPro-SemiBold.ttf'), { family: 'Source Sans Pro', style: 'SemiBold' });
const primary = "rgba(178, 214, 249, 1)"; const primary = 'rgba(178, 214, 249, 1)';
const white = "rgba(255, 255, 255,1)"; const white = 'rgba(255, 255, 255,1)';
const grey = "#868686"; const grey = '#868686';
const black = "rgba(0,0,0,0.5)"; const black = 'rgba(0,0,0,0.5)';
const copyright = '"11px "Source Sans Pro"'; const copyright = '11px "Source Sans Pro"';
const small = '"18px "Source Sans Pro"'; const small = '18px "Source Sans Pro"';
const med = '30px "Source Sans Pro"'; const med = '30px "Source Sans Pro"';
const smed = '25px "Source Sans Pro"'; const smed = '25px "Source Sans Pro"';
const large = '45px "Source Sans Pro SemiBold"'; const large = '45px "Source Sans Pro SemiBold"';
const jobsRowTextStartX = 495; const jobsRowTextStartX = 485;
const jobsRowTextSize = 30; const jobsRowTextSize = 30;
const jobsRowTextSpacer = jobsRowTextSize * 2; const jobsRowTextSpacer = jobsRowTextSize * 2;
@ -87,13 +81,43 @@ const infoTextSmallStartY = rectStartRow3Y + infoTextStartSpacing;
const infoTextBigStartY = infoTextSmallStartY + 25; const infoTextBigStartY = infoTextSmallStartY + 25;
const infoTextSpacing = 50; const infoTextSpacing = 50;
const xivApiSupportedLanguages = ['en', 'ja', 'de', 'fr'];
const languageStrings = {
en: {
raceAndClan: 'Race & Clan',
guardian: 'Guardian',
grandCompany: 'Grand Company',
freeCompany: 'Free Company',
elementalLevel: 'Elemental Level',
eurekaLevel: 'Level',
resistanceRank: 'Resistance Rank',
bozjaRank: 'Rank',
mounts: 'Mounts',
minions: 'Minions',
},
de: {
raceAndClan: 'Volk & Stamm',
guardian: 'Schutzgott',
grandCompany: 'Staatliche Gesellschaft',
freeCompany: 'Freie Gesellschaft',
elementalLevel: 'Das Verbotene Land Eureka',
eurekaLevel: 'Elementarstufe',
resistanceRank: 'Bozja-Südfront',
bozjaRank: 'Widerstandsstufe',
mounts: 'Reittiere',
minions: 'Begleiter',
},
};
class CardCreator { class CardCreator {
/** /**
* Creates a new card creator. * Creates a new card creator.
* @constructor * @constructor
* @param {string} [xivApiKey] The API key for the XIV API to be used in all requests.
*/ */
constructor() { constructor(xivApiKey = undefined) {
this.isInit = false; this.xivApiKey = typeof xivApiKey === 'string' && xivApiKey !== '' ? xivApiKey : undefined;
this.initPromise = null;
} }
/** /**
@ -120,541 +144,471 @@ class CardCreator {
* @returns {Promise} A promise representing the initialization state of this generator. * @returns {Promise} A promise representing the initialization state of this generator.
*/ */
async ensureInit() { async ensureInit() {
if (this.isInit) { if (this.initPromise == null) this.initPromise = this.init();
return;
}
await this.init(); await this.initPromise;
this.isInit = true;
} }
async init() { async init() {
var d = new Date(); const commonImagesPromise = Promise.all([
this.copyrightYear = d.getFullYear(); loadImage(absolute('./resources/background.png')),
loadImage(absolute('./resources/minion.png')),
loadImage(absolute('./resources/mount.png')),
loadImage(absolute('./resources/ilvl-icon.png')),
loadImage(absolute('./resources/shadow.png')),
]).then(([background, minion, mount, ilvl, shadow]) => {
this.images = {
background, minion, mount, ilvl, shadow,
};
});
this.bgImage = await loadImage(absolute("./chara_top.png")); const classJobs = [
'alchemist', 'armorer', 'blacksmith', 'carpenter', 'culinarian', 'goldsmith', 'leatherworker', 'weaver',
'botanist', 'fisher', 'miner',
'gladiator', 'paladin', 'marauder', 'warrior', 'darkknight', 'gunbreaker',
'conjurer', 'whitemage', 'scholar', 'astrologian', 'sage',
'archer', 'bard', 'machinist', 'dancer',
'lancer', 'dragoon', 'pugilist', 'monk', 'rogue', 'ninja', 'samurai', 'reaper',
'thaumaturge', 'blackmage', 'arcanist', 'summoner', 'redmage',
'bluemage',
];
this.imgMinion = await loadImage(absolute("./minion.png")); const classJobIconsPromise = Promise.all(
this.imgMount = await loadImage(absolute("./mount.png")); classJobs.map(name => loadImage(absolute(`./resources/class-jobs-icons/${name}.png`)))
this.imgIlvl = await loadImage(absolute("./ilvl_n.png")); ).then(images => {
this.imgShadow = await loadImage(absolute("./shadow.png")); this.cjIcons = {};
images.forEach((image, index) => this.cjIcons[classJobs[index]] = image);
});
this.imgAlchemist = await loadImage(absolute("./cj/1/alchemist.png")); const jobBackgroundsPromise = Promise.all(
this.imgArmorer = await loadImage(absolute("./cj/1/armorer.png")); Array.from({ length: 40 }, (_, index) => loadImage(absolute(`./resources/class-jobs-backgrounds/${index + 1}.png`)))
this.imgBlacksmith = await loadImage(absolute("./cj/1/blacksmith.png")); ).then(images => this.jobBackgrounds = images);
this.imgCarpenter = await loadImage(absolute("./cj/1/carpenter.png"));
this.imgCulinarian = await loadImage(absolute("./cj/1/culinarian.png"));
this.imgGoldsmith = await loadImage(absolute("./cj/1/goldsmith.png"));
this.imgLeatherworker = await loadImage(absolute("./cj/1/leatherworker.png"));
this.imgWeaver = await loadImage(absolute("./cj/1/weaver.png"));
this.imgBotanist = await loadImage(absolute("./cj/1/botanist.png")); const ilevelFilterPromise = createIlvlFilter(this.xivApiKey).then(filterIds => this.ilvlFilterIds = filterIds);
this.imgFisher = await loadImage(absolute("./cj/1/fisher.png"));
this.imgMiner = await loadImage(absolute("./cj/1/miner.png"));
this.imgGladiator = await loadImage(absolute("./cj/1/gladiator.png")); const minionCountPromise = fetch(`https://ffxivcollect.com/api/minions/`)
this.imgPaladin = await loadImage(absolute("./cj/1/paladin.png")); .then(response => response.json())
this.imgMarauder = await loadImage(absolute("./cj/1/marauder.png")); .then(data => this.minionCount = data.count);
this.imgWarrior = await loadImage(absolute("./cj/1/warrior.png"));
this.imgDarkKnight = await loadImage(absolute("./cj/1/darkknight.png"));
this.imgGunbreaker = await loadImage(absolute("./cj/1/gunbreaker.png"));
this.imgConjurer = await loadImage(absolute("./cj/1/conjurer.png")); const mountCountPromise = fetch(`https://ffxivcollect.com/api/mounts/`)
this.imgWhitemage = await loadImage(absolute("./cj/1/whitemage.png")); .then(response => response.json())
this.imgScholar = await loadImage(absolute("./cj/1/scholar.png")); .then(data => this.mountCount = data.count);
this.imgAstrologian = await loadImage(absolute("./cj/1/astrologian.png"));
this.imgArcher = await loadImage(absolute("./cj/1/archer.png")); await Promise.all([
this.imgBard = await loadImage(absolute("./cj/1/bard.png")); commonImagesPromise,
this.imgMachinist = await loadImage(absolute("./cj/1/machinist.png")); classJobIconsPromise,
this.imgDancer = await loadImage(absolute("./cj/1/dancer.png")); jobBackgroundsPromise,
ilevelFilterPromise,
this.imgLancer = await loadImage(absolute("./cj/1/lancer.png")); minionCountPromise,
this.imgDragoon = await loadImage(absolute("./cj/1/dragoon.png")); mountCountPromise,
this.imgPugilist = await loadImage(absolute("./cj/1/pugilist.png")); ]);
this.imgMonk = await loadImage(absolute("./cj/1/monk.png"));
this.imgRogue = await loadImage(absolute("./cj/1/rogue.png"));
this.imgNinja = await loadImage(absolute("./cj/1/ninja.png"));
this.imgSamurai = await loadImage(absolute("./cj/1/samurai.png"));
this.imgThaumaturge = await loadImage(absolute("./cj/1/thaumaturge.png"));
this.imgBlackmage = await loadImage(absolute("./cj/1/blackmage.png"));
this.imgArcanist = await loadImage(absolute("./cj/1/arcanist.png"));
this.imgSummoner = await loadImage(absolute("./cj/1/summoner.png"));
this.imgRedmage = await loadImage(absolute("./cj/1/redmage.png"));
this.imgBluemage = await loadImage(absolute('./cj/1/bluemage.png'));
this.imgJobBg = {};
for (var i = 1; i <= 38; i++) {
this.imgJobBg[i] = await loadImage(absolute(`./cj/bg/${i}.png`));
} }
await this.countMountsMinions(); async createCrest(crests) {
} if (!Array.isArray(crests) || crests.length == 0) return null;
async countMountsMinions() {
var response = await fetch(`https://ffxivcollect.com/api/minions/`);
var data = await response.json();
this.countMinion = data.count;
var response = await fetch(`https://ffxivcollect.com/api/mounts/`);
var data = await response.json();
this.countMount = data.count;
console.log(`Refreshed counts: ${this.countMinion} - ${this.countMount}`);
}
async createCrest(crestAry) {
const canvas = createCanvas(128, 128); const canvas = createCanvas(128, 128);
const ctx = canvas.getContext("2d"); const ctx = canvas.getContext('2d');
if (crestAry.length == 0) const crestLayers = await Promise.all(crests.map(crest => loadImage(crest)));
return null;
for (var i = 0; i < crestAry.length; i++) { for (const layer of crestLayers) {
var crestLayer = await loadImage(crestAry[i]); ctx.drawImage(layer, 0, 0, 128, 128);
ctx.drawImage(crestLayer, 0, 0, 128, 128);
} }
var imgd = ctx.getImageData(0, 0, 128, 128), const imageData = ctx.getImageData(0, 0, 128, 128);
pix = imgd.data, const pixelData = imageData.data;
newColor = { r: 0, g: 0, b: 0, a: 0 };
for (var i = 0, n = pix.length; i < n; i += 4) { // Iterate over all pixels, where one consists of 4 numbers: r, g, b and a
var r = pix[i], for (let index = 0; index < pixelData.length; index += 4) {
g = pix[i + 1], const [r, g, b] = pixelData.slice(index, index + 3);
b = pix[i + 2];
// If its white then change it // If the pixel is a special grey, change it to be transparent (a = 0)
if (r == 64 && g == 64 && b == 64) { if (r == 64 && g == 64 && b == 64) {
// Change the white to whatever. pixelData[index] = 0;
pix[i] = newColor.r; pixelData[index + 1] = 0;
pix[i + 1] = newColor.g; pixelData[index + 2] = 0;
pix[i + 2] = newColor.b; pixelData[index + 3] = 0;
pix[i + 3] = newColor.a;
} }
} }
ctx.putImageData(imgd, 0, 0); ctx.putImageData(imageData, 0, 0);
return canvas; return canvas;
} }
getItemLevel(gearset) { getItemLevel(gearset) {
var ilvl = 0; let itemLevelSum = 0;
var cnt = 0;
var mainHandLvl = 0;
var hasOffHand = false;
console.log(ilvlarray) for (const [key, piece] of Object.entries(gearset)) {
for (var key in gearset) {
var piece = gearset[key];
if (key == 'SoulCrystal') // Exclude SoulCrystal from item level sum
continue; if (key !== 'SoulCrystal') {
if (key == 'MainHand') // If this item is a special one, increase the total item level by only 1
mainHandLvl = piece.Item.LevelItem; if (this.ilvlFilterIds.includes(piece.Item.ID) == true) {
itemLevelSum += 1;
if (key == 'OffHand')
hasOffHand = true;
if(ilvlarray.includes(piece.Item.ID) == true) {
ilvl += 1;
} else { } else {
ilvl += piece.Item.LevelItem; itemLevelSum += piece.Item.LevelItem;
}
}
} }
cnt++; // If there is no OffHand, the MainHand item level counts twice
if (gearset.Offhand != null && typeof gearset.MainHand != 'number') {
const piece = gearset.MainHand;
// If this item is a special one, increase the total item level by only 1
if (this.ilvlFilterIds.includes(piece.Item.ID) == true) {
itemLevelSum += 1;
} else {
itemLevelSum += piece.Item.LevelItem;
}
} }
if (!hasOffHand) { // Average item level computation is always for 13 items
ilvl += mainHandLvl; // Job stones are ignored
cnt++; return this.pad(Math.floor(itemLevelSum / 13), 4);
} }
if (cnt == 0) pad(number, size) {
return 0; const string = String(number);
const paddingCount = Math.max(size - string.length, 0);
// ilvl division is always out of 13 items return '0'.repeat(paddingCount) + string;
// mainhand counts twice if there's no offhand
// job stones are ignored
return this.pad(Math.floor(ilvl / 13), 4);
} }
pad(num, size) { classOrJobIcon(classJob, unlockId, className, jobName) {
num = num.toString(); if (classJob?.UnlockedState?.ID === unlockId) return this.cjIcons[jobName];
while (num.length < size) num = "0" + num; else return this.cjIcons[className];
return num;
} }
/** /**
* Creates a character card for a character. * Creates a character card for a character.
* @param {number | string} charaId The Lodestone ID of the character to generate a card for. * @param {number | string} characterId The Lodestone ID of the character to generate a card for.
* @param {string | Buffer | null | undefined} customImage Optional parameter providing a custom * @param {string | Buffer | null | undefined} customImage Optional parameter providing a custom
* image to be drawn between the background of the character card and the black information boxes. * image to be drawn between the background of the character card and the black information boxes.
* The image should be the same resolution as the default image. The default image size can be * The image should be the same resolution as the default image. The default image size can be
* retrieved with {@link CardCreator#canvasSize}. May be a URL, `data: `URI, a local file path, * retrieved with {@link CardCreator#canvasSize}. May be a URL, `data: `URI, a local file path,
* or a Buffer instance. * or a Buffer instance.
* @param {string} [language] The language that the cards should be in use for the request
* @example * @example
* const fs = require("fs"); * const fs = require('fs');
* *
* const card = new CardCreator(); * const card = new CardCreator();
* const lodestoneId = "13821878"; * const lodestoneId = '13821878';
* *
* await card.ensureInit(); * await card.ensureInit();
* const png = await card.createCard(lodestoneId); * const png = await card.createCard(lodestoneId);
* *
* fs.writeFile("./test.png", png, err => { * fs.writeFile('./test.png', png, err => {
* if (err) console.error(err); * if (err) console.error(err);
* }); * });
* @returns {Promise<Buffer>} A promise representating the construction of the card's image data. * @returns {Promise<Buffer>} A promise representating the construction of the card's image data.
*/ */
async createCard(charaId, customImage) { async createCard(characterId, customImage, language = 'en') {
const characterInfoUrl = `https://xivapi.com/character/${charaId}?extended=1&data=FC,mimo`; const supportedLanguage = xivApiSupportedLanguages.includes(language) ? language : 'en';
let response = await fetch(characterInfoUrl); const strings = Object.keys(languageStrings).includes(supportedLanguage) ? languageStrings[supportedLanguage] : languageStrings.en;
if (!response.ok) {
// Request all API data as early as possible
const neededFields = [
'Character.ActiveClassJob.UnlockedState.ID', 'Character.ClassJobs.*.Level', 'Character.ClassJobs.*.UnlockedState.ID', 'Character.ClassJobsBozjan.Level', 'Character.ClassJobsElemental.Level',
'Character.DC', 'Character.FreeCompanyName', 'Character.GearSet.Gear', 'Character.GrandCompany.Company.Name', 'Character.GrandCompany.Rank.Icon', 'Character.GuardianDeity.Name',
'Character.GuardianDeity.Icon', 'Character.Name', 'Character.Portrait', 'Character.Race.Name', 'Character.Tribe.Name', 'Character.Server', 'Character.Title.Name',
'FreeCompany.Crest', 'FreeCompany.Tag', 'Minions', 'Mounts',
];
const characterInfoUrl = new URL(`https://xivapi.com/character/${encodeURIComponent(characterId)}`)
characterInfoUrl.searchParams.set('language', supportedLanguage);
characterInfoUrl.searchParams.set('extended', '1');
characterInfoUrl.searchParams.set('data', 'FC,MIMO');
characterInfoUrl.searchParams.set('columns', neededFields.join(','));
if (typeof this.xivApiKey === 'string' && this.xivApiKey !== '') url.searchParams.set('private_key', this.xivApiKey);
const dataPromise = fetch(characterInfoUrl)
// Retry once if the request fails // Retry once if the request fails
response = await fetch(characterInfoUrl); .then(response => response.ok ? response : fetch(characterInfoUrl))
} .then(response => response.json());
const data = await response.json(); const customImagePromise = customImage != null ? loadImage(customImage) : Promise.resolve();
const portraitPromise = dataPromise.then(data => loadImage(data.Character.Portrait));
const deityPromise = dataPromise.then(data => loadImage(`https://xivapi.com/${data.Character.GuardianDeity.Icon}`));
const gcRankPromise = dataPromise.then(data => data.Character.GrandCompany.Company != null && data.Character.GrandCompany.Company.Name != null ? loadImage(`https://xivapi.com/${data.Character.GrandCompany.Rank.Icon}`) : null);
const fcCrestPromise = dataPromise.then(data => data.Character.FreeCompanyName != null ? this.createCrest(data.FreeCompany.Crest) : null);
// Build canvas and only await data, when actually needed
const canvasSize = this.canvasSize; const canvasSize = this.canvasSize;
const canvas = createCanvas(canvasSize.width, canvasSize.height); const canvas = createCanvas(canvasSize.width, canvasSize.height);
const ctx = canvas.getContext("2d"); const ctx = canvas.getContext('2d');
ctx.save();
const portrait = await loadImage(data.Character.Portrait); // Draw background
ctx.drawImage(this.images.background, 0, 0, canvasSize.width, canvasSize.height + 2);
ctx.drawImage(this.bgImage, 0, 0, canvasSize.width, canvasSize.height + 2); // Draw custom background image
const customLoadedImage = await customImagePromise;
ctx.drawImage(portrait, 0, 120, 441, 600); if (customLoadedImage != null) {
ctx.drawImage(customLoadedImage, 0, 0, canvasSize.width, canvasSize.height);
if (customImage != null) {
const bg = await loadImage(customImage);
ctx.drawImage(bg, 0, 0, canvasSize.width, canvasSize.height);
} }
ctx.strokeStyle = white; // Draw dark background boxes
ctx.fillStyle = black; ctx.fillStyle = black;
ctx.beginPath(); ctx.fillRect(25, 10, 840, 100); // Name, Title, Server
// Name, Title, Server Rect ctx.fillRect(rectStartX, rectStartRow2Y, rectHalfWidth, rectHeightRow2); // Mounts
ctx.fillRect(25, 10, 840, 100); ctx.fillRect(rectStartXHalf, rectStartRow2Y, rectHalfWidth, rectHeightRow2); // Minions
ctx.fillRect(rectStartX, rectStartRow3Y, rectFullWidth, rectHeightRow3); // Character information
ctx.fillRect(rectStartX, rectStartRow4Y, rectFullWidth, rectHeightRow4); // Eureka & Bozja
ctx.fillRect(rectStartX, rectStartRow5Y, rectFullWidth, rectHeightRow5); // Classes & Jobs
ctx.restore(); ctx.save();
// BLU returns a null UnlockedState.ID so we can't use it to pick the job image. // Draw non data dependent text
if (data.Character.ActiveClassJob.UnlockedState.ID != null) { ctx.textAlign = 'left';
ctx.drawImage(this.imgJobBg[data.Character.ActiveClassJob.UnlockedState.ID], 450, 4, rectFullWidth, 110); ctx.font = small;
} else { ctx.fillStyle = primary;
ctx.drawImage(this.imgJobBg[36], 450, 4, rectFullWidth, 110); ctx.fillText(strings.raceAndClan, 480, infoTextSmallStartY); // Race & Clan
ctx.fillText(strings.guardian, 480, infoTextSmallStartY + infoTextSpacing); // Guardian
ctx.fillText(strings.elementalLevel, 480, 425); // Elemental level
ctx.fillText(strings.resistanceRank, 480, 475); // Resistance rank
ctx.font = copyright;
ctx.fillStyle = black;
ctx.fillText(`© 2010 - ${new Date().getFullYear()} SQUARE ENIX CO., LTD. All Rights Reserved`, rectStartX, 720 - 5); // Copyright
ctx.restore(); ctx.save();
// Draw non data dependent images
ctx.drawImage(this.images.shadow, 441 - 143, 110, 170, 90); // Item level shadow
ctx.drawImage(this.images.ilvl, 441 - 92, 132, 24, 27); // Item level icon
ctx.drawImage(this.images.mount, 620, iconMountMinionY, 32, 32); // Mount icon
ctx.drawImage(this.images.minion, 834, iconMountMinionY, 19, 32); // Minion icon
// Draw non data dependent job icons
{
ctx.drawImage(this.cjIcons.darkknight, 530, jobsRowIcon1Y, 30, 30); // Darkknight
ctx.drawImage(this.cjIcons.gunbreaker, 560, jobsRowIcon1Y, 30, 30); // Gunbreaker
ctx.drawImage(this.cjIcons.scholar, 650, jobsRowIcon1Y, 30, 30); // Scholar
ctx.drawImage(this.cjIcons.astrologian, 680, jobsRowIcon1Y, 30, 30); // Astrologian
ctx.drawImage(this.cjIcons.sage, 710, jobsRowIcon1Y, 30, 30); // Sage
ctx.drawImage(this.cjIcons.machinist, 800, jobsRowIcon1Y, 30, 30); // Machinist
ctx.drawImage(this.cjIcons.dancer, 830, jobsRowIcon1Y, 30, 30); // Dancer
ctx.drawImage(this.cjIcons.samurai, 560, jobsRowIcon2Y, 30, 30); // Samurai
ctx.drawImage(this.cjIcons.reaper, 590, jobsRowIcon2Y, 30, 30); // Reaper
ctx.drawImage(this.cjIcons.redmage, 710, jobsRowIcon2Y, 30, 30); // Redmage
ctx.drawImage(this.cjIcons.bluemage, 800, jobsRowIcon2Y, 33, 33); // Bluemage
ctx.drawImage(this.cjIcons.carpenter, 470, jobsRowIcon3Y, 30, 30); // Carpenter
ctx.drawImage(this.cjIcons.blacksmith, 500, jobsRowIcon3Y, 30, 30); // Blacksmith
ctx.drawImage(this.cjIcons.armorer, 530, jobsRowIcon3Y, 30, 30); // Armorer
ctx.drawImage(this.cjIcons.goldsmith, 560, jobsRowIcon3Y, 30, 30); // Goldsmith
ctx.drawImage(this.cjIcons.leatherworker, 590, jobsRowIcon3Y, 30, 30); // Leatherworker
ctx.drawImage(this.cjIcons.weaver, 620, jobsRowIcon3Y, 30, 30); // Weaver
ctx.drawImage(this.cjIcons.alchemist, 650, jobsRowIcon3Y, 30, 30); // Alchemist
ctx.drawImage(this.cjIcons.culinarian, 680, jobsRowIcon3Y, 30, 30); // Culinarian
ctx.drawImage(this.cjIcons.miner, 770, jobsRowIcon3Y, 30, 30); // Miner
ctx.drawImage(this.cjIcons.botanist, 800, jobsRowIcon3Y, 30, 30); // Botanist
ctx.drawImage(this.cjIcons.fisher, 830, jobsRowIcon3Y, 30, 30); // Fisher
} }
ctx.fillRect(rectStartX, rectStartRow2Y, rectHalfWidth, rectHeightRow2); // Draw info from character data
ctx.fillRect(rectStartXHalf, rectStartRow2Y, rectHalfWidth, rectHeightRow2); const { Character, FreeCompany, Mounts, Minions } = await dataPromise;
ctx.fillRect(rectStartX, rectStartRow3Y, rectFullWidth, rectHeightRow3); //info // Header
ctx.fillRect(rectStartX, rectStartRow4Y, rectFullWidth, rectHeightRow4); // bozja {
ctx.fillRect(rectStartX, rectStartRow5Y, rectFullWidth, rectHeightRow5); const activeClassJob = Character.ActiveClassJob.UnlockedState.ID ?? 36; // BLU returns a null UnlockedState.ID so we can't use it to pick the job image
ctx.stroke(); ctx.drawImage(this.jobBackgrounds[activeClassJob - 1], 450, 4, rectFullWidth, 110); // Current class/job background
ctx.textAlign = "center"; ctx.textAlign = 'center';
ctx.font = med; ctx.font = med;
ctx.fillStyle = primary; ctx.fillStyle = primary;
if (Character.Title.Name != null) ctx.fillText(Character.Title.Name, 450, 40); // Character title
if (data.Character.Title.Name !== undefined)
ctx.fillText(data.Character.Title.Name, 450, 40);
ctx.font = small; ctx.font = small;
ctx.fillText(`${data.Character.Server} (${data.Character.DC})`, 450, 100); ctx.fillText(`${Character.Server} (${Character.DC})`, 450, 100); // Character service & DC
// Race, Clan, Guardian, GC, FC Titles
ctx.font = small;
ctx.textAlign = "left";
ctx.fillText("Race & Clan", 480, infoTextSmallStartY);
ctx.fillText("Guardian", 480, infoTextSmallStartY + infoTextSpacing);
if (data.Character.GrandCompany.Company != null) {
ctx.fillText("Grand Company", 480, infoTextSmallStartY + infoTextSpacing * 2);
}
if (data.Character.FreeCompanyName != null) {
ctx.fillText("Free Company", 480, infoTextSmallStartY + infoTextSpacing * 3);
}
ctx.fillText("Elemental Level", 480, 425);
ctx.fillText("Resistance Rank", 480, 475);
ctx.fillStyle = grey;
ctx.font = smed;
var ilvl = this.getItemLevel(data.Character.GearSet.Gear);
ctx.drawImage(this.imgShadow, 441 - 143, 110, 170, 90);
ctx.drawImage(this.imgIlvl, 441 - 92, 132, 24, 27);
ctx.fillText(ilvl, 441 - 65, 155);
ctx.fillStyle = white;
ctx.font = large; ctx.font = large;
ctx.fillStyle = white;
ctx.textAlign = "center"; ctx.fillText(Character.Name, 450, 80); // Character name
// Chara Name ctx.restore(); ctx.save();
if (data.Character.Title === undefined || data.Character.Title.Name == null || data.Character.Title.Name == "") {
ctx.fillText(data.Character.Name, 450, 80);
} else {
ctx.fillText(data.Character.Name, 450, 80);
} }
// Race, Clan, Guardian, GC, FC Info
// Item level
{
ctx.font = smed; ctx.font = smed;
ctx.textAlign = "left"; ctx.fillStyle = grey;
ctx.fillText(`${data.Character.Race.Name}, ${data.Character.Tribe.Name}`, 480, infoTextBigStartY); ctx.fillText(this.getItemLevel(Character.GearSet.Gear), 441 - 65, 155); // Item level
ctx.restore(); ctx.save();
ctx.fillText(data.Character.GuardianDeity.Name, 480, infoTextBigStartY + infoTextSpacing);
var deityIcon = await loadImage('https://xivapi.com/' + data.Character.GuardianDeity.Icon);
ctx.drawImage(deityIcon, deityIconX, deityIconY, 28, 28);
if (data.Character.GrandCompany.Company != null) {
ctx.fillText(data.Character.GrandCompany.Company.Name, 480, infoTextBigStartY + infoTextSpacing * 2);
var gcRankIcon = await loadImage('https://xivapi.com/' + data.Character.GrandCompany.Rank.Icon);
ctx.drawImage(gcRankIcon, gcRankIconX, gcRankIconY, 40, 40);
} }
if (data.Character.FreeCompanyName != null) { // Mounts & Minions
var crestImage = await this.createCrest(data.FreeCompany.Crest); {
let minionsPercentage = "N/A"
if (crestImage !== null) let mountsPercentage = "N/A"
ctx.drawImage(crestImage, fcCrestX, fcCrestY, fcCrestScale, fcCrestScale); if (Minions != null) {
minionsPercentage = Math.ceil(((Minions.length ?? 0) / this.minionCount) * 100);
}
const fcMeasure = ctx.measureText(data.Character.FreeCompanyName); if (Mounts != null) {
ctx.fillText(data.Character.FreeCompanyName, 480, infoTextBigStartY + infoTextSpacing * 3); mountsPercentage = Math.ceil(((Mounts.length ?? 0) / this.mountCount) * 100);
ctx.fillStyle = grey;
ctx.font = small;
ctx.fillText(`«${data.FreeCompany.Tag}»`, 480 + fcMeasure.width + 10, infoTextBigStartY + infoTextSpacing * 3);
} }
ctx.font = smed; ctx.font = smed;
ctx.fillStyle = white; ctx.fillStyle = white;
const mountsMeasure = ctx.measureText(`${mountsPercentage}%`);
const minionsMeasure = ctx.measureText(`${minionsPercentage}%`);
ctx.fillText(`${mountsPercentage}%`, 480, textMountMinionY); // Mounts percentage
ctx.fillText(`${minionsPercentage}%`, 685, textMountMinionY); // Minions percentage
if (data.Character.ClassJobsElemental.Level != null) {
ctx.fillText(`Level ${data.Character.ClassJobsElemental.Level}`, 480, 450);
} else {
ctx.fillText(`Level 0`, 480, 450);
}
if (data.Character.ClassJobsBozjan.Level != null) {
ctx.fillText(`Rank ${data.Character.ClassJobsBozjan.Level}`, 480, 500);
} else {
ctx.fillText(`Rank 0`, 480, 500);
}
// Minion & Mount percentages
var mountsPct = '0';
if (data.Mounts !== null) {
mountsPct = Math.ceil((data.Mounts.length / this.countMount) * 100);
}
var minionsPct = '0';
if (data.Minions !== null) {
minionsPct = Math.ceil((data.Minions.length / this.countMinion) * 100);
}
const mountsMeasure = ctx.measureText(`${mountsPct}%`);
const minionsMeasure = ctx.measureText(`${minionsPct}%`);
ctx.fillText(`${mountsPct}%`, 480, textMountMinionY);
ctx.fillText(`${minionsPct}%`, 685, textMountMinionY);
ctx.fillStyle = grey;
ctx.font = small; ctx.font = small;
ctx.fillStyle = grey;
ctx.fillText(strings.mounts, 480 + mountsMeasure.width + 5, textMountMinionY); // Mounts
ctx.fillText(strings.minions, 685 + minionsMeasure.width + 5, textMountMinionY); // Minions
ctx.restore(); ctx.save();
}
ctx.fillText("Mounts", 480 + mountsMeasure.width + 5, textMountMinionY); // Character information
ctx.fillText("Minions", 685 + minionsMeasure.width + 5, textMountMinionY); {
ctx.font = smed;
ctx.fillStyle = white;
ctx.fillText(`${Character.Race.Name}, ${Character.Tribe.Name}`, 480, infoTextBigStartY); // Race & Clan
ctx.fillText(Character.GuardianDeity.Name, 480, infoTextBigStartY + infoTextSpacing); // Guardian
ctx.drawImage(this.imgMount, 620, iconMountMinionY, 32, 32); if (Character.GrandCompany.Company != null && Character.GrandCompany.Company.Name != null) {
ctx.drawImage(this.imgMinion, 834, iconMountMinionY, 19, 32); ctx.font = small;
ctx.fillStyle = primary;
ctx.fillText(strings.grandCompany, 480, infoTextSmallStartY + infoTextSpacing * 2); // Grand Company
ctx.font = smed;
ctx.fillStyle = white;
ctx.fillText(Character.GrandCompany.Company.Name.replace('[p]', ''), 480, infoTextBigStartY + infoTextSpacing * 2); // Grand Company name
}
if (Character.FreeCompanyName != null) {
ctx.font = small;
ctx.fillStyle = primary;
ctx.fillText(strings.freeCompany, 480, infoTextSmallStartY + infoTextSpacing * 3); // Free Company
ctx.font = smed;
ctx.fillStyle = white;
ctx.fillText(Character.FreeCompanyName, 480, infoTextBigStartY + infoTextSpacing * 3); // Free Company name
const nameMeasure = ctx.measureText(Character.FreeCompanyName);
ctx.font = small;
ctx.fillStyle = grey;
ctx.fillText(`«${FreeCompany.Tag}»`, 480 + nameMeasure.width + 10, infoTextBigStartY + infoTextSpacing * 3); // Free Company tag
}
ctx.restore(); ctx.save();
}
// Eureka & Bozja
{
ctx.font = smed;
ctx.fillStyle = white;
ctx.fillText(`${strings.eurekaLevel} ${Character.ClassJobsElemental.Level ?? 0}`, 480, 450); // Elemental level
ctx.fillText(`${strings.bozjaRank} ${Character.ClassJobsBozjan.Level ?? 0}`, 480, 500); // Resistance rank
ctx.restore(); ctx.save();
}
// Classes & Jobs - data dependant job or class icons
{
const { ClassJobs } = Character;
ctx.drawImage(this.classOrJobIcon(ClassJobs[0], 19, 'gladiator', 'paladin'), 470, jobsRowIcon1Y, 30, 30); // Gladiator/Paladin
ctx.drawImage(this.classOrJobIcon(ClassJobs[1], 21, 'marauder', 'warrior'), 500, jobsRowIcon1Y, 30, 30); // Marauder/Warrior
ctx.drawImage(this.classOrJobIcon(ClassJobs[4], 24, 'conjurer', 'whitemage'), 620, jobsRowIcon1Y, 30, 30); // Conjurer/Whitemage
ctx.drawImage(this.classOrJobIcon(ClassJobs[13], 23, 'archer', 'bard'), 770, jobsRowIcon1Y, 30, 30); // Archer/Bard
ctx.drawImage(this.classOrJobIcon(ClassJobs[9], 22, 'lancer', 'dragoon'), 470, jobsRowIcon2Y, 30, 30); // Lancer/Dragoon
ctx.drawImage(this.classOrJobIcon(ClassJobs[8], 20, 'pugilist', 'monk'), 500, jobsRowIcon2Y, 30, 30); // Monk/Pugilist
ctx.drawImage(this.classOrJobIcon(ClassJobs[10], 30, 'rogue', 'ninja'), 530, jobsRowIcon2Y, 30, 30); // Ninja/Rogue
ctx.drawImage(this.classOrJobIcon(ClassJobs[16], 25, 'thaumaturge', 'blackmage'), 650, jobsRowIcon2Y, 30, 30); // Thaumaturge/Blackmage
ctx.drawImage(this.classOrJobIcon(ClassJobs[17], 27, 'arcanist', 'summoner'), 680, jobsRowIcon2Y, 30, 30); // Summoner/Arcanist
}
// Classes & Jobs - levels
{
ctx.textAlign = 'center';
ctx.font = small;
ctx.fillStyle = white; ctx.fillStyle = white;
const { ClassJobs } = Character;
// Why are there so many fucking jobs in this game? // First row
// Crafting let rowTextX = jobsRowTextStartX;
ctx.textAlign = "center"; ctx.fillText(ClassJobs[0].Level, rowTextX, jobsRowText1Y); // Gladiator/Paladin
rowTextX += jobsRowTextSize;
ctx.fillText(ClassJobs[1].Level, rowTextX, jobsRowText1Y); // Marauder/Warrior
rowTextX += jobsRowTextSize;
ctx.fillText(ClassJobs[2].Level, rowTextX, jobsRowText1Y); // Darkknight
rowTextX += jobsRowTextSize;
ctx.fillText(ClassJobs[3].Level, rowTextX, jobsRowText1Y); // Gunbreaker
rowTextX += jobsRowTextSpacer;
ctx.fillText(ClassJobs[4].Level, rowTextX, jobsRowText1Y); // Conjurer/Whitemage
rowTextX += jobsRowTextSize;
ctx.fillText(ClassJobs[5].Level >= 30 ? ClassJobs[5].Level : '0', rowTextX, jobsRowText1Y); // Scholar
rowTextX += jobsRowTextSize;
ctx.fillText(ClassJobs[6].Level, rowTextX, jobsRowText1Y); // Astrologian
rowTextX += jobsRowTextSize;
ctx.fillText(ClassJobs[7].Level, rowTextX, jobsRowText1Y); // Sage
rowTextX += jobsRowTextSpacer;
ctx.fillText(ClassJobs[13].Level, rowTextX, jobsRowText1Y); // Archer/Bard
rowTextX += jobsRowTextSize;
ctx.fillText(ClassJobs[14].Level, rowTextX, jobsRowText1Y); // Machinist
rowTextX += jobsRowTextSize;
ctx.fillText(ClassJobs[15].Level, rowTextX, jobsRowText1Y); // Dancer
var cJobsRowTextX = jobsRowTextStartX; // Second row
ctx.drawImage(this.imgAlchemist, 480, jobsRowIcon3Y, 30, 30); rowTextX = jobsRowTextStartX;
ctx.fillText(data.Character.ClassJobs[24].Level, cJobsRowTextX, jobsRowText3Y); ctx.fillText(ClassJobs[9].Level, rowTextX, jobsRowText2Y); // Lancer/Dragoon
cJobsRowTextX += jobsRowTextSize; rowTextX += jobsRowTextSize;
ctx.fillText(ClassJobs[8].Level, rowTextX, jobsRowText2Y); // Monk/Pugilist
rowTextX += jobsRowTextSize;
ctx.fillText(ClassJobs[10].Level, rowTextX, jobsRowText2Y); // Ninja/Rogue
rowTextX += jobsRowTextSize;
ctx.fillText(ClassJobs[11].Level, rowTextX, jobsRowText2Y); // Samurai
rowTextX += jobsRowTextSize;
ctx.fillText(ClassJobs[12].Level, rowTextX, jobsRowText2Y); // Reaper
rowTextX += jobsRowTextSpacer;
ctx.fillText(ClassJobs[16].Level, rowTextX, jobsRowText2Y); // Thaumaturge/Blackmage
rowTextX += jobsRowTextSize;
ctx.fillText(ClassJobs[17].Level, rowTextX, jobsRowText2Y); // Summoner/Arcanist
rowTextX += jobsRowTextSize;
ctx.fillText(ClassJobs[18].Level, rowTextX, jobsRowText2Y); // Redmage
rowTextX += jobsRowTextSize;
ctx.fillText(ClassJobs[19].Level, 815, jobsRowText2Y); // Bluemage
ctx.drawImage(this.imgArmorer, 510, jobsRowIcon3Y, 30, 30); // Third row
ctx.fillText(data.Character.ClassJobs[20].Level, cJobsRowTextX, jobsRowText3Y); rowTextX = jobsRowTextStartX;
cJobsRowTextX += jobsRowTextSize; ctx.fillText(ClassJobs[20].Level, rowTextX, jobsRowText3Y); // Carpenter
rowTextX += jobsRowTextSize;
ctx.drawImage(this.imgBlacksmith, 540, jobsRowIcon3Y, 30, 30); ctx.fillText(ClassJobs[21].Level, rowTextX, jobsRowText3Y); // Blacksmith
ctx.fillText(data.Character.ClassJobs[19].Level, cJobsRowTextX, jobsRowText3Y); rowTextX += jobsRowTextSize;
cJobsRowTextX += jobsRowTextSize; ctx.fillText(ClassJobs[22].Level, rowTextX, jobsRowText3Y); // Armorer
rowTextX += jobsRowTextSize;
ctx.drawImage(this.imgCarpenter, 570, jobsRowIcon3Y, 30, 30); ctx.fillText(ClassJobs[23].Level, rowTextX, jobsRowText3Y); // Goldsmith
ctx.fillText(data.Character.ClassJobs[18].Level, cJobsRowTextX, jobsRowText3Y); rowTextX += jobsRowTextSize;
cJobsRowTextX += jobsRowTextSize; ctx.fillText(ClassJobs[24].Level, rowTextX, jobsRowText3Y); // Leatherworker
rowTextX += jobsRowTextSize;
ctx.drawImage(this.imgCulinarian, 600, jobsRowIcon3Y, 30, 30); ctx.fillText(ClassJobs[25].Level, rowTextX, jobsRowText3Y); // Weaver
ctx.fillText(data.Character.ClassJobs[25].Level, cJobsRowTextX, jobsRowText3Y); rowTextX += jobsRowTextSize;
cJobsRowTextX += jobsRowTextSize; ctx.fillText(ClassJobs[26].Level, rowTextX, jobsRowText3Y); // Alchemist
rowTextX += jobsRowTextSize;
ctx.drawImage(this.imgGoldsmith, 630, jobsRowIcon3Y, 30, 30); ctx.fillText(ClassJobs[27].Level, rowTextX, jobsRowText3Y); // Culinarian
ctx.fillText(data.Character.ClassJobs[21].Level, cJobsRowTextX, jobsRowText3Y); rowTextX += jobsRowTextSpacer * 1.5;
cJobsRowTextX += jobsRowTextSize; ctx.fillText(ClassJobs[28].Level, rowTextX, jobsRowText3Y); // Miner
rowTextX += jobsRowTextSize;
ctx.drawImage(this.imgLeatherworker, 660, jobsRowIcon3Y, 30, 30); ctx.fillText(ClassJobs[29].Level, rowTextX, jobsRowText3Y); // Botanist
ctx.fillText(data.Character.ClassJobs[22].Level, cJobsRowTextX, jobsRowText3Y); rowTextX += jobsRowTextSize;
cJobsRowTextX += jobsRowTextSize; ctx.fillText(ClassJobs[30].Level, rowTextX, jobsRowText3Y); // Fisher
ctx.drawImage(this.imgWeaver, 690, jobsRowIcon3Y, 30, 30);
ctx.fillText(data.Character.ClassJobs[23].Level, cJobsRowTextX, jobsRowText3Y);
cJobsRowTextX += jobsRowTextSpacer;
// Gathering
ctx.drawImage(this.imgBotanist, 750, jobsRowIcon3Y, 30, 30);
ctx.fillText(data.Character.ClassJobs[27].Level, cJobsRowTextX, jobsRowText3Y);
cJobsRowTextX += jobsRowTextSize;
ctx.drawImage(this.imgFisher, 780, jobsRowIcon3Y, 30, 30);
ctx.fillText(data.Character.ClassJobs[28].Level, cJobsRowTextX, jobsRowText3Y);
cJobsRowTextX += jobsRowTextSize;
ctx.drawImage(this.imgMiner, 810, jobsRowIcon3Y, 30, 30);
ctx.fillText(data.Character.ClassJobs[26].Level, cJobsRowTextX, jobsRowText3Y);
cJobsRowTextX += jobsRowTextSize;
// Tanks
cJobsRowTextX = jobsRowTextStartX;
if (data.Character.ClassJobs[0].UnlockedState.ID == 19) {
ctx.drawImage(this.imgPaladin, 480, jobsRowIcon1Y, 30, 30);
} else {
ctx.drawImage(this.imgGladiator, 480, jobsRowIcon1Y, 30, 30);
} }
ctx.fillText(data.Character.ClassJobs[0].Level, cJobsRowTextX, jobsRowText1Y);
cJobsRowTextX += jobsRowTextSize;
if (data.Character.ClassJobs[1].UnlockedState.ID == 21) { // Remaining asynchronous drawing
ctx.drawImage(this.imgWarrior, 510, jobsRowIcon1Y, 30, 30); {
} else { await Promise.all([
ctx.drawImage(this.imgMarauder, 510, jobsRowIcon1Y, 30, 30); portraitPromise.then(portrait => ctx.drawImage(portrait, 0, 120, 441, 600)),
deityPromise.then(deityIcon => ctx.drawImage(deityIcon, deityIconX, deityIconY, 28, 28)),
gcRankPromise.then(gcRankIcon => {
if (gcRankIcon != null) ctx.drawImage(gcRankIcon, gcRankIconX, gcRankIconY, 40, 40);
}),
fcCrestPromise.then(fcCrestIcon => {
if (fcCrestIcon != null) ctx.drawImage(fcCrestIcon, fcCrestX, fcCrestY, fcCrestScale, fcCrestScale);
}),
]);
} }
ctx.fillText(data.Character.ClassJobs[1].Level, cJobsRowTextX, jobsRowText1Y);
cJobsRowTextX += jobsRowTextSize;
ctx.drawImage(this.imgDarkKnight, 540, jobsRowIcon1Y, 30, 30);
ctx.fillText(data.Character.ClassJobs[2].Level, cJobsRowTextX, jobsRowText1Y);
cJobsRowTextX += jobsRowTextSize;
ctx.drawImage(this.imgGunbreaker, 570, jobsRowIcon1Y, 30, 30);
ctx.fillText(data.Character.ClassJobs[3].Level, cJobsRowTextX, jobsRowText1Y);
cJobsRowTextX += jobsRowTextSpacer;
// Healers
if (data.Character.ClassJobs[8].UnlockedState.ID == 24) {
ctx.drawImage(this.imgWhitemage, 630, jobsRowIcon1Y, 30, 30);
} else {
ctx.drawImage(this.imgConjurer, 630, jobsRowIcon1Y, 30, 30);
}
ctx.fillText(data.Character.ClassJobs[8].Level, cJobsRowTextX, jobsRowText1Y);
cJobsRowTextX += jobsRowTextSize;
ctx.drawImage(this.imgScholar, 660, jobsRowIcon1Y, 30, 30);
if (data.Character.ClassJobs[9].Level >= 30) {
ctx.fillText(data.Character.ClassJobs[9].Level, cJobsRowTextX, jobsRowText1Y);
} else {
ctx.fillText("0", cJobsRowTextX, jobsRowText1Y);
}
cJobsRowTextX += jobsRowTextSize;
ctx.drawImage(this.imgAstrologian, 690, jobsRowIcon1Y, 30, 30);
ctx.fillText(data.Character.ClassJobs[10].Level, cJobsRowTextX, jobsRowText1Y);
cJobsRowTextX += jobsRowTextSpacer;
// DPS
// Ranged
if (data.Character.ClassJobs[11].UnlockedState.ID == 23) {
ctx.drawImage(this.imgBard, 750, jobsRowIcon1Y, 30, 30);
} else {
ctx.drawImage(this.imgArcher, 750, jobsRowIcon1Y, 30, 30);
}
ctx.fillText(data.Character.ClassJobs[11].Level, cJobsRowTextX, jobsRowText1Y);
cJobsRowTextX += jobsRowTextSize;
ctx.drawImage(this.imgMachinist, 780, jobsRowIcon1Y, 30, 30);
ctx.fillText(data.Character.ClassJobs[12].Level, cJobsRowTextX, jobsRowText1Y);
cJobsRowTextX += jobsRowTextSize;
ctx.drawImage(this.imgDancer, 810, jobsRowIcon1Y, 30, 30);
ctx.fillText(data.Character.ClassJobs[13].Level, cJobsRowTextX, jobsRowText1Y);
cJobsRowTextX += jobsRowTextSize;
// Melee
cJobsRowTextX = jobsRowTextStartX;
if (data.Character.ClassJobs[5].UnlockedState.ID == 22) {
ctx.drawImage(this.imgDragoon, 480, jobsRowIcon2Y, 30, 30);
} else {
ctx.drawImage(this.imgLancer, 480, jobsRowIcon2Y, 30, 30);
}
ctx.fillText(data.Character.ClassJobs[5].Level, cJobsRowTextX, jobsRowText2Y);
cJobsRowTextX += jobsRowTextSize;
if (data.Character.ClassJobs[4].UnlockedState.ID == 20) {
ctx.drawImage(this.imgMonk, 510, jobsRowIcon2Y, 30, 30);
} else {
ctx.drawImage(this.imgPugilist, 510, jobsRowIcon2Y, 30, 30);
}
ctx.fillText(data.Character.ClassJobs[4].Level, cJobsRowTextX, jobsRowText2Y);
cJobsRowTextX += jobsRowTextSize;
if (data.Character.ClassJobs[6].UnlockedState.ID == 30) {
ctx.drawImage(this.imgNinja, 540, jobsRowIcon2Y, 30, 30);
} else {
ctx.drawImage(this.imgRogue, 540, jobsRowIcon2Y, 30, 30);
}
ctx.fillText(data.Character.ClassJobs[6].Level, cJobsRowTextX, jobsRowText2Y);
cJobsRowTextX += jobsRowTextSize;
ctx.drawImage(this.imgSamurai, 570, jobsRowIcon2Y, 30, 30);
ctx.fillText(data.Character.ClassJobs[7].Level, cJobsRowTextX, jobsRowText2Y);
cJobsRowTextX += jobsRowTextSpacer;
// Caster
if (data.Character.ClassJobs[14].UnlockedState.ID == 25) {
ctx.drawImage(this.imgBlackmage, 630, jobsRowIcon2Y, 30, 30);
} else {
ctx.drawImage(this.imgThaumaturge, 630, jobsRowIcon2Y, 30, 30);
}
ctx.fillText(data.Character.ClassJobs[14].Level, cJobsRowTextX, jobsRowText2Y);
cJobsRowTextX += jobsRowTextSize;
if (data.Character.ClassJobs[15].UnlockedState.ID == 27) {
ctx.drawImage(this.imgSummoner, 660, jobsRowIcon2Y, 30, 30);
} else {
ctx.drawImage(this.imgArcanist, 660, jobsRowIcon2Y, 30, 30);
}
ctx.fillText(data.Character.ClassJobs[15].Level, cJobsRowTextX, jobsRowText2Y);
cJobsRowTextX += jobsRowTextSize;
ctx.drawImage(this.imgRedmage, 690, jobsRowIcon2Y, 30, 30);
ctx.fillText(data.Character.ClassJobs[16].Level, cJobsRowTextX, jobsRowText2Y);
cJobsRowTextX += jobsRowTextSize;
// Limited
ctx.drawImage(this.imgBluemage, 780, jobsRowIcon2Y, 33, 33);
ctx.fillText(data.Character.ClassJobs[17].Level, 796, jobsRowText2Y);
ctx.textAlign = "left";
ctx.fillStyle = black;
ctx.font = copyright;
ctx.fillText(`© 2010 - ${this.copyrightYear} SQUARE ENIX CO., LTD. All Rights Reserved`, rectStartX, 720 - 5);
return canvas.toBuffer(); return canvas.toBuffer();
} }

33
create-ilvl-filter.js Normal file
View file

@ -0,0 +1,33 @@
const fetch = require('node-fetch');
const itemUICategory = [
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 84, 87, 88, 89, 96, 97, 98, 99, 105, 106, 107,
];
// Returns a list of item IDs that, when equipped, increase the iLvl by 1
async function createIlvlFilter(xivApiKey = undefined) {
const itemIds = [];
// Fetch for each category one after another to prevent rate limiting
// This should only by needed on startup, so a longer caching time is ok
for (const category of itemUICategory) {
const url = new URL('https://xivapi.com/search');
url.searchParams.set('indexes', 'item');
url.searchParams.set('filters', `IsIndisposable=1,ItemUICategoryTargetID=${category}`);
if (typeof xivApiKey === 'string' && xivApiKey !== '') url.searchParams.set('private_key', xivApiKey);
const response = await fetch(url.toString());
const data = await response.json();
if (data != null && Array.isArray(data.Results)) {
for (const item of data.Results) {
itemIds.push(item.ID);
}
}
}
return itemIds;
}
module.exports = createIlvlFilter

View file

@ -1,27 +0,0 @@
const fetch = require("node-fetch");
const itemUICategory = [
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 84, 87, 88, 89, 96, 97, 98, 99,
105, 106, 107,
];
async function createilvlfilter() {
let results = [];
for (const category of itemUICategory) {
let url = `https://xivapi.com/search?indexes=item&filters=IsIndisposable=1,ItemUICategoryTargetID=${category}`;
const response = await fetch(url);
const data = response.json();
data.then((payload) => {
if (payload.Pagination.Results === 0) {
return;
}
for (const item of payload.Results) {
let part = item.ID
results.push(part);
}
});
}
return results;
}
module.exports = createilvlfilter

View file

@ -1,6 +1,3 @@
const ghpages = require("gh-pages"); const ghpages = require('gh-pages');
ghpages.publish("docs/", (err) => {
if (err) { ghpages.publish('docs/', error => { if (error) console.error(error) });
console.error(err);
}
});

152
index.js
View file

@ -1,152 +0,0 @@
const fetch = require("node-fetch");
const express = require('express');
const app = express();
const port = process.env.PORT || 5000;
const { CardCreator } = require('./create-card');
const creator = new CardCreator();
// node cachemanager
var cacheManager = require('cache-manager');
// storage for the cachemanager
var fsStore = require('cache-manager-fs-binary');
// initialize caching on disk
var diskCache = cacheManager.caching({
store: fsStore,
options: {
reviveBuffers: true,
binaryAsStream: false,
ttl: 60 * 60 * 4 /* seconds */,
maxsize: 1000 * 1000 * 1000 /* max size in bytes on disk */,
path: 'diskcache',
preventfill: true
}
});
async function getCharIdByName(world, name, retries = 1) {
if (retries === -1) return undefined;
const response = await fetch(`https://xivapi.com/character/search?name=${name}&server=${world}`);
const data = await response.json();
if (data.Results[0] === undefined)
return getCharIdByName(world, name, --retries);
return data.Results[0].ID;
}
app.get('/prepare/id/:charaId', async (req, res) => {
var cacheKey = `img:${req.params.charaId}`;
var ttl = 60 * 60 * 4; // 4 hours
diskCache.wrap(cacheKey,
// called if the cache misses in order to generate the value to cache
function (cb) {
creator.ensureInit().then(() => creator.createCard(req.params.charaId), (reason) => cb('Init failed: ' + reason, null)).then(image => cb(null, {
binary: {
image: image,
}
})).catch((reason) => cb('createCard failed: ' + reason, null));
},
// Options, see node-cache-manager for more examples
{ ttl: ttl },
function (err, result) {
if (err !== null) {
console.error(err);
res.status(500).send({status: "error", reason: err});
return;
}
res.status(200).send({status: "ok", url: `/characters/id/${req.params.charaId}.png`});
}
);
})
app.get('/prepare/name/:world/:charName', async (req, res) => {
var id = await getCharIdByName(req.params.world, req.params.charName);
if (id === undefined) {
res.status(404).send("Character not found.");
return;
}
res.redirect(`/prepare/id/${id}`);
})
app.get('/characters/id/:charaId.png', async (req, res) => {
var cacheKey = `img:${req.params.charaId}`;
var ttl = 60 * 60 * 4; // 4 hours
diskCache.wrap(cacheKey,
// called if the cache misses in order to generate the value to cache
function (cb) {
creator.ensureInit().then(() => creator.createCard(req.params.charaId), (reason) => cb('Init failed: ' + reason, null)).then(image => cb(null, {
binary: {
image: image,
}
})).catch((reason) => cb('createCard failed: ' + reason, null));
},
// Options, see node-cache-manager for more examples
{ ttl: ttl },
function (err, result) {
if (err !== null) {
console.error(err);
res.status(500).send({status: "error", reason: err});
return;
}
var image = result.binary.image;
res.writeHead(200, {
'Content-Type': 'image/png',
'Content-Length': image.length,
'Cache-Control': 'public, max-age=14400'
});
res.end(image, 'binary');
var usedStreams = ['image'];
// you have to do the work to close the unused files
// to prevent file descriptors leak
for (var key in result.binary) {
if (!result.binary.hasOwnProperty(key)) continue;
if (usedStreams.indexOf(key) < 0
&& result.binary[key] instanceof Stream.Readable) {
if (typeof result.binary[key].close === 'function') {
result.binary[key].close(); // close the stream (fs has it)
} else {
result.binary[key].resume(); // resume to the end and close
}
}
}
}
);
})
app.get('/characters/id/:charaId', async (req, res) => {
res.redirect(`/characters/id/${req.params.charaId}.png`);
})
app.get('/characters/name/:world/:charName.png', async (req, res) => {
var id = await getCharIdByName(req.params.world, req.params.charName);
if (id === undefined) {
res.status(404).send("Character not found.");
return;
}
res.redirect(`/characters/id/${id}.png`);
})
app.get('/characters/name/:world/:charName', async (req, res) => {
res.redirect(`/characters/name/${req.params.world}/${req.params.charName}.png`);
})
app.get('/', async (req, res) => {
res.redirect('https://github.com/ArcaneDisgea/XIV-Character-Cards');
})
app.listen(port, () => {
console.log(`Listening at http://localhost:${port}`)
})

View file

@ -1,7 +1,7 @@
{ {
"name": "xiv-character-cards", "name": "xiv-character-cards",
"description": "API to create fancy cards for FFXIV characters based on their Lodestone data, hosted at https://ffxiv-character-cards.herokuapp.com.", "description": "API to create fancy cards for FFXIV characters based on their Lodestone data, hosted at https://ffxiv-character-cards.herokuapp.com.",
"version": "1.2.1", "version": "1.5.0",
"main": "create-card.js", "main": "create-card.js",
"repository": "https://github.com/xivapi/XIV-Character-Cards.git", "repository": "https://github.com/xivapi/XIV-Character-Cards.git",
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
@ -10,21 +10,22 @@
"xivapi" "xivapi"
], ],
"scripts": { "scripts": {
"start": "node index.js", "start": "node server.js",
"dev": "nodemon index.js", "dev": "nodemon server.js",
"docs:generate": "jsdoc create-card.js -d docs -R readme.md", "docs:generate": "jsdoc create-card.js -d docs -R readme.md",
"docs:deploy": "npm run docs:generate && node gh-pages.js" "docs:deploy": "npm run docs:generate && node gh-pages.js"
}, },
"dependencies": { "dependencies": {
"cache-manager-fs": "^1.0.8", "cache-manager": "^3.4.4",
"cache-manager-fs-binary": "^1.0.4", "cache-manager-fs-binary": "^1.0.4",
"canvas": "^2.6.1", "canvas": "2.9.0",
"express": "^4.17.1", "express": "^4.17.1",
"node-fetch": "^2.6.1" "express-rate-limit": "^5.5.0",
"node-fetch": "^2.6.5"
}, },
"devDependencies": { "devDependencies": {
"gh-pages": "^3.2.0", "gh-pages": "^3.2.3",
"jsdoc": "^3.6.7", "jsdoc": "^3.6.7",
"nodemon": "^2.0.7" "nodemon": "^2.0.14"
} }
} }

View file

@ -1,78 +1,76 @@
# XIV Character Cards # XIV Character Cards
![npm Version](https://img.shields.io/npm/v/xiv-character-cards) ![npm Version](https://img.shields.io/npm/v/xiv-character-cards)
[![Documentation](https://img.shields.io/badge/docs-JSDoc-orange)](https://xivapi.github.io/XIV-Character-Cards/) [![Documentation](https://img.shields.io/badge/docs-JSDoc-orange)](https://xivapi.github.io/XIV-Character-Cards/)
API to create fancy cards for FFXIV characters based on their Lodestone data, hosted at https://ffxiv-character-cards.herokuapp.com. Library and API to create fancy cards for FFXIV characters based on their Lodestone data, powered by [xivapi.com](https://xivapi.com/) and hosted at [https://ffxiv-character-cards.herokuapp.com](https://ffxiv-character-cards.herokuapp.com).
![Demo image](https://ffxiv-character-cards.herokuapp.com/characters/id/9575452.png) ![Demo image](https://ffxiv-character-cards.herokuapp.com/characters/id/9575452.png)
## Endpoints ## API
### Getting images All API calls support the `lang` query parameter to create a character card with information in the specified language. The supported languages are the same as [xivapi.com](https://xivapi.com/docs/Common-Features#language), which are English (en), Japanese (ja), German (de) and French (fr).
``https://ffxiv-character-cards.herokuapp.com/characters/id/<LODESTONE ID>.png`` E.g. a request for a german character card would look like this: ``https://ffxiv-character-cards.herokuapp.com/characters/id/<LODESTONE ID>.png?lang=de``
<br>Get the PNG for a character by its Lodestone ID.
### Getting a card for a character by its Lodestone ID
``GET https://ffxiv-character-cards.herokuapp.com/characters/id/<LODESTONE ID>.png``
### Getting card for a character by its world and name
``GET https://ffxiv-character-cards.herokuapp.com/characters/name/<WORLD>/<CHARACTER NAME>.png``
<br>**Note:** This is considerably slower than the creation by ID, since the character has to be looked up in the Lodestone first.
<br> <br>
``https://ffxiv-character-cards.herokuapp.com/characters/name/<WORLD>/<CHARACTER NAME>.png`` If you are using this API together with an application that requires the API to respond very quickly, like Discord, you may need to ask it to "prepare" the card image for a character beforehand. The API will reply with its status, and in case of success, the URL to the final image.
<br>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>``
<br>Request a character image to be cached by its Lodestone ID.
<br>
``https://ffxiv-character-cards.herokuapp.com/prepare/name/<WORLD>/<CHARACTER NAME>``
<br>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"}`` ``{"status":"ok","url":"/characters/id/123456789.png"}``
## Using in your application ### Requesting a card to be cached for a character by its Lodestone ID
``` ``GET https://ffxiv-character-cards.herokuapp.com/prepare/id/<LODESTONE ID>``
### Requesting a card to be cached for a character by its world and name
``GET https://ffxiv-character-cards.herokuapp.com/prepare/name/<WORLD>/<CHARACTER NAME>``
## Library
To use the card creator as a library in your Node.JS application, first install it as a dependency with:
```sh
yarn add xiv-character-cards yarn add xiv-character-cards
# or # or
npm i xiv-character-cards npm i xiv-character-cards
``` ```
You will receive a PNG-buffer for you to use in your bot or application.<br>Check ``index.js`` for other usage examples. You can then instantiate the class `CardCreator` from the library, call the asynchronous `insureInit()` function to make sure all resources are loaded and then use the asynchronous `createCard()` function with your characters Lodestone ID. You will receive a promise that resolves to a `Buffer` of the PNG image of your card, that you can use in your bot or application.
### Example Check the [library documentation](https://xivapi.github.io/XIV-Character-Cards/) for more details.
> **Note:** The API server is not published as an NPM package, so if you want to host it yourself, clone the [Github repository](https://github.com/xivapi/XIV-Character-Cards) and put the Express.JS webserver defined in the `server.js` file behind a reverse proxy.
### Library example
```js ```js
const { CardCreator } = require("xiv-character-cards"); const { CardCreator } = require("xiv-character-cards");
const fs = require("fs"); const { writeFileSync } = require("fs");
const card = new CardCreator(); const creator = new CardCreator();
const lodestoneid = "13821878"; const lodestoneId = "13821878";
function example(cb) { async function example() {
card.ensureInit() await creator.ensureInit();
.then( return creator.createCard(lodestoneId);
() => card.createCard(lodestoneid), }
(reason) => cb("Init failed: " + reason, null)
) example()
.then((image) => .then(card => {
cb(null, { writeFileSync(`./${lodestoneId}.png`, card);
binary: {
image: image,
},
}) })
) .catch(error => {
.catch((reason) => cb("createCard failed: " + reason, null)); console.error('Creator initialization or card creation failed!');
} console.error(error);
example((err, response) => {
const buffer = response.binary.image;
fs.writeFileSync(`./${lodestoneid}.png`, response.binary.image, (err) => {
if (err) {
console.log(err);
}
});
}); });
``` ```

View file

Before

Width:  |  Height:  |  Size: 596 KiB

After

Width:  |  Height:  |  Size: 596 KiB

View file

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View file

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View file

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

View file

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View file

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View file

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View file

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View file

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2 KiB

View file

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View file

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View file

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View file

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View file

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 4 KiB

View file

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 3 KiB

View file

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View file

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View file

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View file

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View file

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 3 KiB

View file

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View file

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View file

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View file

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View file

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View file

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View file

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View file

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View file

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View file

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View file

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View file

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View file

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View file

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View file

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View file

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View file

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View file

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View file

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View file

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View file

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View file

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View file

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View file

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View file

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View file

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View file

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View file

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View file

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View file

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View file

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View file

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View file

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View file

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View file

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View file

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View file

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View file

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View file

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

View file

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View file

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View file

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View file

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

View file

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View file

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 57 KiB

Some files were not shown because too many files have changed in this diff Show more