Skip to content

Commit

Permalink
webclient: fix outfix index formatting...
Browse files Browse the repository at this point in the history
  • Loading branch information
AntumDeluge committed Dec 18, 2021
1 parent 5b8619d commit c9e12b0
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions srcjs/stendhal/ui/outfitdialog.js
Expand Up @@ -85,7 +85,7 @@ stendhal.ui.OutfitDialog = function() {
}

_getPartSprite(part, index, color = null) {
const fname = "/data/sprites/outfit/" + part + "/" + part + "_0" + indexString(index) + ".png";
const fname = "/data/sprites/outfit/" + part + "/" + part + "_" + indexString(index) + ".png";
if (color != null) {
return stendhal.data.sprites.getFilteredWithPromise(fname, "trueColor", color);
}
Expand Down Expand Up @@ -478,13 +478,22 @@ stendhal.ui.OutfitDialog = function() {
"</div>"; //bg

function indexString(index) {
if (index < 10) {
return "0" + index;
if (index > -1 && index < 100) {
if (index < 10) {
return "00" + index;
} else {
return "0" + index;
}
}
return "" + index;
}

function makeSelector(part, index, partChanged) {
// FIXME: selector should be showing a default if index is less than 0
if (index < 0) {
index = 0;
}

const selector = new PartSelector(part, index, stendhal.ui.outfitCount[part] - 1, partChanged);

document.getElementById("setoutfitprev" + part).addEventListener("click", function(e) {
Expand Down

0 comments on commit c9e12b0

Please sign in to comment.