feat: cleanup some problems in inventories at daily reset
This commit is contained in:
parent
218df461e1
commit
a7e5425b55
@ -14,7 +14,12 @@ import {
|
||||
ExportVirtuals
|
||||
} from "warframe-public-export-plus";
|
||||
import { applyCheatsToInfestedFoundry, handleSubsumeCompletion } from "@/src/services/infestedFoundryService";
|
||||
import { addMiscItems, allDailyAffiliationKeys, createLibraryDailyTask } from "@/src/services/inventoryService";
|
||||
import {
|
||||
addMiscItems,
|
||||
allDailyAffiliationKeys,
|
||||
cleanupInventory,
|
||||
createLibraryDailyTask
|
||||
} from "@/src/services/inventoryService";
|
||||
import { logger } from "@/src/utils/logger";
|
||||
import { catBreadHash } from "@/src/helpers/stringHelpers";
|
||||
|
||||
@ -79,6 +84,8 @@ export const inventoryController: RequestHandler = async (request, response) =>
|
||||
}
|
||||
}
|
||||
|
||||
cleanupInventory(inventory);
|
||||
|
||||
inventory.NextRefill = new Date((Math.trunc(Date.now() / 86400000) + 1) * 86400000);
|
||||
await inventory.save();
|
||||
}
|
||||
|
@ -1671,3 +1671,23 @@ export const setupKahlSyndicate = (inventory: TInventoryDatabaseDocument): void
|
||||
Tag: "KahlSyndicate"
|
||||
});
|
||||
};
|
||||
|
||||
export const cleanupInventory = (inventory: TInventoryDatabaseDocument): void => {
|
||||
let index = inventory.MiscItems.findIndex(x => x.ItemType == "");
|
||||
if (index != -1) {
|
||||
inventory.MiscItems.splice(index, 1);
|
||||
}
|
||||
|
||||
index = inventory.Affiliations.findIndex(x => x.Tag == "KahlSyndicate");
|
||||
if (index != -1 && !inventory.Affiliations[index].WeeklyMissions) {
|
||||
logger.debug(`KahlSyndicate seems broken, removing it and setting up again`);
|
||||
inventory.Affiliations.splice(index, 1);
|
||||
setupKahlSyndicate(inventory);
|
||||
}
|
||||
|
||||
const LibrarySyndicate = inventory.Affiliations.find(x => x.Tag == "LibrarySyndicate");
|
||||
if (LibrarySyndicate && LibrarySyndicate.FreeFavorsEarned) {
|
||||
logger.debug(`removing FreeFavorsEarned from LibrarySyndicate`);
|
||||
LibrarySyndicate.FreeFavorsEarned = undefined;
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user