Presets per generator, fill in presets on load
This commit is contained in:
@@ -21,7 +21,11 @@ export default defineComponent({
|
|||||||
generator: null,
|
generator: null,
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
this.localPresets = await localforage.getItem("local_presets") ?? [];
|
this.localPresets = await localforage.getItem(`local_presets_${this.generator}`) ?? [];
|
||||||
|
for (const preset of this.localPresets) {
|
||||||
|
this.fillPreset(preset);
|
||||||
|
}
|
||||||
|
await this.updateLocalPresets();
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
settings() {
|
settings() {
|
||||||
@@ -46,11 +50,8 @@ export default defineComponent({
|
|||||||
presets() {
|
presets() {
|
||||||
const filledPresets = {};
|
const filledPresets = {};
|
||||||
for (const presetName of Object.keys(presets[this.generator])) {
|
for (const presetName of Object.keys(presets[this.generator])) {
|
||||||
const preset = {};
|
const preset = JSON.parse(JSON.stringify(presets[this.generator][presetName]));
|
||||||
preset.display = presets[this.generator][presetName].display;
|
this.fillPreset(preset);
|
||||||
for (const settingName of Object.keys(this.settings)) {
|
|
||||||
preset[settingName] = presets[this.generator][presetName][settingName] ?? this.settings[settingName].default;
|
|
||||||
}
|
|
||||||
filledPresets[presetName] = preset;
|
filledPresets[presetName] = preset;
|
||||||
}
|
}
|
||||||
return filledPresets;
|
return filledPresets;
|
||||||
@@ -111,7 +112,15 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
async updateLocalPresets() {
|
async updateLocalPresets() {
|
||||||
const copy = JSON.parse(JSON.stringify(this.localPresets));
|
const copy = JSON.parse(JSON.stringify(this.localPresets));
|
||||||
await localforage.setItem("local_presets", copy);
|
await localforage.setItem(`local_presets_${this.generator}`, copy);
|
||||||
|
},
|
||||||
|
fillPreset(preset) {
|
||||||
|
for (const settingName of Object.keys(this.settings)) {
|
||||||
|
if (preset[settingName] == undefined) {
|
||||||
|
preset[settingName] = this.settings[settingName].default;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return preset;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -18,3 +18,14 @@ base:
|
|||||||
weapons: assured
|
weapons: assured
|
||||||
goal: fast_ganon
|
goal: fast_ganon
|
||||||
crystals_ganon: 0
|
crystals_ganon: 0
|
||||||
|
mimic_hellrule:
|
||||||
|
display: Mimic Hellrule
|
||||||
|
mode: standard
|
||||||
|
door_shuffle: crossed
|
||||||
|
door_lobbies: shuffled
|
||||||
|
door_type_mode: all
|
||||||
|
trap_door_mode: optional
|
||||||
|
enemy_shuffle: mimics
|
||||||
|
drop_shuffle: keys
|
||||||
|
pottery: keys
|
||||||
|
dark_rooms: always_light_cone
|
||||||
|
|||||||
Reference in New Issue
Block a user