mirror of
https://github.com/IvarK/AntimatterDimensionsSourceCode.git
synced 2024-11-22 04:05:42 +00:00
Fix glyph filter migration bug
This commit is contained in:
parent
12d66ba3fd
commit
3ce0b2b833
@ -358,7 +358,7 @@ window.player = {
|
|||||||
previousRuns: {}
|
previousRuns: {}
|
||||||
},
|
},
|
||||||
IPMultPurchases: 0,
|
IPMultPurchases: 0,
|
||||||
version: 19,
|
version: 20,
|
||||||
infinityPower: DC.D1,
|
infinityPower: DC.D1,
|
||||||
postC4Tier: 0,
|
postC4Tier: 0,
|
||||||
eternityPoints: DC.D0,
|
eternityPoints: DC.D0,
|
||||||
|
@ -277,37 +277,43 @@ GameStorage.migrations = {
|
|||||||
},
|
},
|
||||||
20: player => {
|
20: player => {
|
||||||
// GLYPH FILTER INTERNAL FORMAT REFACTOR
|
// GLYPH FILTER INTERNAL FORMAT REFACTOR
|
||||||
// Move all the filter props out of celestial/effarig scope and into reality/glyph scope, renaming a few of them
|
// For the case of importing a save created before the reality update, many of these props are undefined due to
|
||||||
player.reality.glyphs.filter = player.celestials.effarig.glyphScoreSettings;
|
// having never been in the player object in the first place. In this case we fill with defaults, which are mostly
|
||||||
player.reality.glyphs.filter.trash = player.celestials.effarig.glyphTrashMode;
|
// zeroes. Otherwise we do our best to transfer over all the data we can
|
||||||
player.reality.glyphs.filter.select = player.reality.glyphs.filter.mode;
|
|
||||||
delete player.reality.glyphs.filter.mode;
|
|
||||||
player.reality.glyphs.filter.simple = player.reality.glyphs.filter.simpleEffectCount;
|
|
||||||
delete player.reality.glyphs.filter.simpleEffectCount;
|
|
||||||
|
|
||||||
// There are a few big things going on in this loop which are annotated within, but it largely transfers all the
|
// Move all the filter props out of celestial/effarig scope and into reality/glyph scope, renaming a few of them.
|
||||||
|
const effarig = player.celestials.effarig;
|
||||||
|
player.reality.glyphs.filter = {
|
||||||
|
select: effarig?.mode ?? 0,
|
||||||
|
trash: effarig?.glyphTrashMode ?? 0,
|
||||||
|
simple: effarig?.simpleEffectCount ?? 0
|
||||||
|
};
|
||||||
|
|
||||||
|
// There are a few big things going on in this loop which are annotated within, but this largely transfers all the
|
||||||
// old filter data into the new prop
|
// old filter data into the new prop
|
||||||
const reducedFilter = {};
|
const reducedFilter = {};
|
||||||
const effectDB = Object.values(GameDatabase.reality.glyphEffects);
|
const effectDB = Object.values(GameDatabase.reality.glyphEffects);
|
||||||
// The in-dev filter had entries for companion/reality/cursed glyphs, which have been removed and any other errors
|
// The previous filter format had entries for companion/reality/cursed glyphs, which are removed by only copying
|
||||||
// which show up elsewhere have been resolved
|
// the types in ALCHEMY_BASIC_GLYPH_TYPES. Any errors which show up elsewhere for have also been resolved
|
||||||
for (const type of ALCHEMY_BASIC_GLYPH_TYPES) {
|
for (const type of ALCHEMY_BASIC_GLYPH_TYPES) {
|
||||||
const oldData = player.celestials.effarig.glyphScoreSettings.types[type];
|
const oldData = effarig.glyphScoreSettings?.types[type];
|
||||||
const typeEffects = effectDB
|
const typeEffects = effectDB
|
||||||
.filter(t => t.glyphTypes.includes(type))
|
.filter(t => t.glyphTypes.includes(type))
|
||||||
.sort((a, b) => a.bitmaskIndex - b.bitmaskIndex);
|
.sort((a, b) => a.bitmaskIndex - b.bitmaskIndex);
|
||||||
|
|
||||||
// Two of these effects were renamed to be shorter
|
// Two of these effects were renamed to be shorter
|
||||||
reducedFilter[type] = {
|
reducedFilter[type] = {
|
||||||
rarity: oldData.rarityThreshold,
|
rarity: oldData?.rarityThreshold ?? 0,
|
||||||
score: oldData.scoreThreshold,
|
score: oldData?.scoreThreshold ?? 0,
|
||||||
effectCount: oldData.effectCount,
|
effectCount: oldData?.effectCount ?? 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
// These all used to stored as { effectKey: value } where effectKey is the ID string "powerpow" or similar,
|
// These all used to stored as { effectKey: value } where effectKey is the ID string "powerpow" or similar,
|
||||||
// but have now been refactored to be stored as a bitmask and Number array instead
|
// but have now been refactored to be stored as a bitmask and Number array instead. This significantly shortens
|
||||||
|
// filter data for serialization into glyph filter export strings
|
||||||
reducedFilter[type].specifiedMask = 0;
|
reducedFilter[type].specifiedMask = 0;
|
||||||
reducedFilter[type].effectScores = [];
|
reducedFilter[type].effectScores = [];
|
||||||
|
if (!oldData) continue;
|
||||||
for (const effect of typeEffects) {
|
for (const effect of typeEffects) {
|
||||||
// The way we filter to generate typeEffects also gives an undefined entry which needs to be ignored
|
// The way we filter to generate typeEffects also gives an undefined entry which needs to be ignored
|
||||||
if (!effect) continue;
|
if (!effect) continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user