Improved glyph preset load (#3421)

This commit is contained in:
kajfik 2024-04-22 17:20:50 +02:00 committed by GitHub
parent 0e5d26c79b
commit dce5659c50
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 6 deletions

View File

@ -71,7 +71,7 @@ export default {
// preset match, and leniently when matching greedily may lead to an incomplete set being loaded // preset match, and leniently when matching greedily may lead to an incomplete set being loaded
loadGlyphSet(set, id) { loadGlyphSet(set, id) {
if (!this.setLengthValid(set)) return; if (!this.setLengthValid(set)) return;
let glyphsToLoad = [...set]; let glyphsToLoad = [...set].sort((a, b) => -a.level * a.strength + b.level * b.strength);
const activeGlyphs = [...Glyphs.active.filter(g => g)]; const activeGlyphs = [...Glyphs.active.filter(g => g)];
// Create an array where each entry contains a single active glyph and all its matches in the preset which it // Create an array where each entry contains a single active glyph and all its matches in the preset which it
@ -144,11 +144,10 @@ export default {
for (let index = 0; index < optionList.length; index++) { for (let index = 0; index < optionList.length; index++) {
if (slotsLeft === 0) break; if (slotsLeft === 0) break;
const entry = optionList[index]; const entry = optionList[index];
const greedyPick = index === optionList.length - 1 || optionList[index + 1].options.length > 1;
const filteredOptions = entry.options.filter(g => !toLoad.includes(g)); const filteredOptions = entry.options.filter(g => !toLoad.includes(g));
if (filteredOptions.length === 0) continue; if (filteredOptions.length === 0) continue;
const selectedGlyph = filteredOptions[greedyPick ? 0 : (filteredOptions.length - 1)]; const selectedGlyph = filteredOptions[filteredOptions.length - 1];
toLoad.push(selectedGlyph); toLoad.push(selectedGlyph);
slotsLeft--; slotsLeft--;
} }

View File

@ -815,9 +815,9 @@ window.player = {
highContrastRarity: false, highContrastRarity: false,
swapGlyphColors: false, swapGlyphColors: false,
hideAlterationEffects: false, hideAlterationEffects: false,
ignoreGlyphEffects: false, ignoreGlyphEffects: true,
ignoreGlyphLevel: false, ignoreGlyphLevel: true,
ignoreGlyphRarity: false, ignoreGlyphRarity: true,
glyphBG: GLYPH_BG_SETTING.AUTO, glyphBG: GLYPH_BG_SETTING.AUTO,
glyphBorders: true, glyphBorders: true,
showHintText: { showHintText: {