Fixed hydrateLookup() storing data from handbookPriceOverride with incorrect parent keys

Increased prices of overrides
This commit is contained in:
Dev 2024-11-05 09:27:21 +00:00
parent 7b35a71884
commit 43bed3a8a8
3 changed files with 20 additions and 11 deletions

View File

@ -149,8 +149,8 @@
"5c1a1e3f2e221602b66cc4c2"
],
"handbookPriceOverride": {
"63a8970d7108f713591149f5": 1000,
"63a898a328e385334e0640a5": 5000,
"63a897c6b1ff6e29734fcc95": 10000
"63a8970d7108f713591149f5": {"price": 5000, "parentId": "5b5f6fa186f77409407a7eb7"},
"63a898a328e385334e0640a5": {"price": 10000, "parentId": "5b5f6fa186f77409407a7eb7"},
"63a897c6b1ff6e29734fcc95": {"price": 20000, "parentId": "5b5f6fa186f77409407a7eb7"}
}
}

View File

@ -48,18 +48,20 @@ export class HandbookHelper {
public hydrateLookup(): void {
const handbook = this.databaseService.getHandbook();
// Add handbook overrides found in items.json config into db
for (const itemTpl in this.itemConfig.handbookPriceOverride) {
let itemToUpdate = handbook.Items.find((item) => item.Id === itemTpl);
for (const itemTplKey of Object.keys(this.itemConfig.handbookPriceOverride)) {
const data = this.itemConfig.handbookPriceOverride[itemTplKey];
let itemToUpdate = handbook.Items.find((item) => item.Id === itemTplKey);
if (!itemToUpdate) {
handbook.Items.push({
Id: itemTpl,
ParentId: this.databaseService.getItems()[itemTpl]._parent,
Price: this.itemConfig.handbookPriceOverride[itemTpl],
Id: itemTplKey,
ParentId: data.parentId,
Price: data.price,
});
itemToUpdate = handbook.Items.find((item) => item.Id === itemTpl);
itemToUpdate = handbook.Items.find((item) => item.Id === itemTplKey);
}
itemToUpdate.Price = this.itemConfig.handbookPriceOverride[itemTpl];
itemToUpdate.Price = data.price;
}
const handbookDbClone = this.cloner.clone(handbook);

View File

@ -10,5 +10,12 @@ export interface IItemConfig extends IBaseConfig {
rewardItemBlacklist: string[];
/** Items that can only be found on bosses */
bossItems: string[];
handbookPriceOverride: Record<string, number>;
handbookPriceOverride: Record<string, IHandbookPriceOverride>;
}
export interface IHandbookPriceOverride {
/** Price in roubles */
price: number;
/** NOT parentId from items.json, but handbook.json */
parentId: string;
}