From a305a0ffac99b1d849db3a622655a1d84375e71d Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 13 Mar 2021 18:53:53 -0500 Subject: [PATCH] Save filenames to yaml instead of sprite names, bump weighted settings version to 4.1.1 rev0 --- WebHostLib/static/assets/weightedSettings.js | 9 +++++---- WebHostLib/static/static/weightedSettings.yaml | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/WebHostLib/static/assets/weightedSettings.js b/WebHostLib/static/assets/weightedSettings.js index 2192a18c..0eb7765c 100644 --- a/WebHostLib/static/assets/weightedSettings.js +++ b/WebHostLib/static/assets/weightedSettings.js @@ -401,8 +401,6 @@ const addSpriteOption = (event) => { const presetNumber = document.getElementById('preset-number').value; const playerSettings = JSON.parse(localStorage.getItem(`weightedSettings${presetNumber}`)); const spriteName = event.target.getAttribute('data-sprite'); - console.log(event.target); - console.log(spriteName); if (Object.keys(playerSettings.rom.sprite).indexOf(spriteName) !== -1) { // Do not add the same sprite twice @@ -445,8 +443,11 @@ const buildSpritePicker = (spriteData) => { sprites.setAttribute('id', 'sprite-picker-sprites'); spriteData.sprites.forEach((sprite) => { const spriteImg = document.createElement('img'); - spriteImg.setAttribute('src', `static/static/sprites/${sprite.name}.gif`); - spriteImg.setAttribute('data-sprite', sprite.name); + let spriteGifFile = sprite.file.split('.'); + spriteGifFile.pop(); + spriteGifFile = spriteGifFile.join('.') + '.gif'; + spriteImg.setAttribute('src', `static/static/sprites/${spriteGifFile}`); + spriteImg.setAttribute('data-sprite', sprite.file.split('.')[0]); spriteImg.setAttribute('alt', sprite.name); // Wrap the image in a span to allow for tooltip presence diff --git a/WebHostLib/static/static/weightedSettings.yaml b/WebHostLib/static/static/weightedSettings.yaml index d309f205..df03cbf4 100644 --- a/WebHostLib/static/static/weightedSettings.yaml +++ b/WebHostLib/static/static/weightedSettings.yaml @@ -20,7 +20,7 @@ # For use with the weighted-settings page on the website. Changing this value will cause all users to be prompted # to update their settings. The version number should match the current released version number, and the revision # should be updated manually by whoever edits this file. -ws_version: 4.1.0 rev0 +ws_version: 4.1.1 rev0 description: Template Name # Used to describe your yaml. Useful if you have multiple files name: YourName # Your name in-game. Spaces will be replaced with underscores and there is a 16 character limit @@ -356,7 +356,7 @@ rom: # - random # You can specify random multiple times for however many potentially unique random sprites you want in your pool. sprite: # Enter the name of your preferred sprite and weight it appropriately random: 0 - Link: 50 # To add other sprites: open the gui/Creator, go to adjust, select a sprite and write down the name the gui calls it + link: 50 # To add other sprites: open the gui/Creator, go to adjust, select a sprite and write down the name the gui calls it disablemusic: # If "on", all in-game music will be disabled on: 0 off: 50