feat: cleanup some problems in inventories at daily reset (#1767)
Reviewed-on: #1767 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
parent
03590c7360
commit
ad2f143f15
@ -14,7 +14,12 @@ import {
|
|||||||
ExportVirtuals
|
ExportVirtuals
|
||||||
} from "warframe-public-export-plus";
|
} from "warframe-public-export-plus";
|
||||||
import { applyCheatsToInfestedFoundry, handleSubsumeCompletion } from "@/src/services/infestedFoundryService";
|
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 { logger } from "@/src/utils/logger";
|
||||||
import { catBreadHash } from "@/src/helpers/stringHelpers";
|
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);
|
inventory.NextRefill = new Date((Math.trunc(Date.now() / 86400000) + 1) * 86400000);
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
}
|
}
|
||||||
|
@ -1769,3 +1769,23 @@ export const setupKahlSyndicate = (inventory: TInventoryDatabaseDocument): void
|
|||||||
Tag: "KahlSyndicate"
|
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