Fix all trainer/NPC sprites by using raw GitHub URLs instead of relative paths

The editor is served via GitHub Pages but sprite URLs used relative paths
(../graphics/...) which don't resolve to actual files on the Pages host.
Changed to fetch sprites from raw.githubusercontent.com, matching how all
other repo content is already loaded.

https://claude.ai/code/session_01PnpVQ3UkymCVghfdigCJV9
This commit is contained in:
Claude 2026-03-21 11:52:12 +00:00
parent 4a39d0acd8
commit da98c1d3e0
No known key found for this signature in database

View File

@ -2127,9 +2127,13 @@ function makeSelectHtml(id, value, options, extraAttrs = '') {
return `<select id="${id}" ${extraAttrs}>${options.map(o => `<option value="${escAttr(o)}" ${o === value ? 'selected' : ''}>${escHtml(o)}</option>`).join('')}</select>`;
}
function rawFileUrl(filePath) {
return `https://raw.githubusercontent.com/${REPO_OWNER}/${REPO_NAME}/${BRANCH}/${filePath}`;
}
function getSpriteUrl(graphicsId) {
const name = (graphicsId || '').replace('OBJ_EVENT_GFX_', '').toLowerCase();
return `../graphics/object_events/pics/people/${name}.png`;
return rawFileUrl(`graphics/object_events/pics/people/${name}.png`);
}
function getSpriteHtml(graphicsId, size = 32) {
@ -2148,7 +2152,7 @@ function getTrainerPicUrl(pic) {
};
const lower = (pic || '').toLowerCase();
const name = picNameOverrides[lower] || lower.replace(/\s+/g, '_');
return `../graphics/trainers/front_pics/${name}.png`;
return rawFileUrl(`graphics/trainers/front_pics/${name}.png`);
}
function getTrainerPicHtml(pic, size = 64) {