Skip to content

Commit

Permalink
chore: update token URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
TheGiddyLimit committed Aug 9, 2024
1 parent 0ec0821 commit 379abcc
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions js/5etools-monsters.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ function d20plusMonsters () {
try {
const type = Parser.monTypeToFullObj(data.type).asText;
const source = Parser.sourceJsonToAbv(data.source);
const tokenUrl = `${IMG_URL}${source}/${name.replace(/"/g, "")}.png`
const tokenUrl = `${IMG_URL}bestiary/tokens/${source}/${name.replace(/"/g, "")}.webp`
const avatar = data.tokenUrl || Parser.nameToTokenName(tokenUrl);
character.size = data.size;
character.name = data._displayName || data.name;
Expand All @@ -334,7 +334,7 @@ function d20plusMonsters () {
url: avatar,
type: "HEAD",
error: function () {
d20plus.importer.getSetAvatarImage(character, `${IMG_URL}blank.png`, firstFluffImage);
d20plus.importer.getSetAvatarImage(character, `${IMG_URL}blank.webp`, firstFluffImage);
},
success: function () {
d20plus.importer.getSetAvatarImage(character, `${avatar}${d20plus.ut.getAntiCacheSuffix()}`, firstFluffImage);
Expand Down
4 changes: 2 additions & 2 deletions js/5etools-objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function d20plusObjects () {
if (saveIdsTo) saveIdsTo[UrlUtil.URL_TO_HASH_BUILDER[UrlUtil.PG_OBJECTS](data)] = {name: data.name, source: data.source, type: "character", roll20Id: character.id};

try {
const tokenUrl = `${IMG_URL}objects/tokens/${source}/${name}.png`;
const tokenUrl = `${IMG_URL}objects/tokens/${source}/${name}.webp`;
const avatar = data.tokenUrl || Parser.nameToTokenName(tokenUrl);
character.size = data.size;
character.name = name;
Expand All @@ -50,7 +50,7 @@ function d20plusObjects () {
url: avatar,
type: "HEAD",
error: function () {
d20plus.importer.getSetAvatarImage(character, `${IMG_URL}blank.png`);
d20plus.importer.getSetAvatarImage(character, `${IMG_URL}blank.webp`);
},
success: function () {
d20plus.importer.getSetAvatarImage(character, avatar);
Expand Down
2 changes: 1 addition & 1 deletion js/5etools-tool.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ function tools5eTool () {
const item = table.tableitems.create();
item.set("name", m.name);
// encode size info into the URL, which will get baked into the token
const avatar = m.tokenUrl || `${IMG_URL}${Parser.sourceJsonToAbv(m.source)}/${m.name.replace(/"/g, "")}.png?roll20_token_size=${getSizeInTiles(m.size)}`;
const avatar = m.tokenUrl || `${IMG_URL}bestiary/tokens/${Parser.sourceJsonToAbv(m.source)}/${m.name.replace(/"/g, "")}.webp?roll20_token_size=${getSizeInTiles(m.size)}`;
item.set("avatar", avatar);
item.set("token_size", getSizeInTiles(m.size));
item.save();
Expand Down
4 changes: 2 additions & 2 deletions js/5etools-vehicles.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function d20plusVehicles () {

// Sets the image, mostly stolen from Giddy
d20plus.vehicles._setFluffImage = function (character, data, fluff) {
const tokenUrl = `${IMG_URL}vehicles/tokens/${data.source}/${data.name}.png`;
const tokenUrl = `${IMG_URL}vehicles/tokens/${data.source}/${data.name}.webp`;
const avatar = data.tokenUrl || Parser.nameToTokenName(tokenUrl);
const firstFluffImage = d20plus.cfg.getOrDefault("import", "importCharAvatar") === "Portrait (where available)" && fluff && fluff.images
? (() => {
Expand All @@ -36,7 +36,7 @@ function d20plusVehicles () {
url: avatar,
type: "HEAD",
error: function () {
d20plus.importer.getSetAvatarImage(character, `${IMG_URL}blank.png`, firstFluffImage);
d20plus.importer.getSetAvatarImage(character, `${IMG_URL}blank.webp`, firstFluffImage);
},
success: function () {
d20plus.importer.getSetAvatarImage(character, avatar, firstFluffImage);
Expand Down

0 comments on commit 379abcc

Please sign in to comment.