From 9418095f0370ec89aaf4b5b3a6767b50cc69085e Mon Sep 17 00:00:00 2001 From: Dev Date: Fri, 23 Aug 2024 22:45:10 +0100 Subject: [PATCH 1/2] hard code stand1 on dev profiles --- project/assets/database/templates/profiles.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/project/assets/database/templates/profiles.json b/project/assets/database/templates/profiles.json index 31656df6..401a4db0 100644 --- a/project/assets/database/templates/profiles.json +++ b/project/assets/database/templates/profiles.json @@ -40818,6 +40818,11 @@ "_id": "640b2d867f4185aa520d08bb", "_tpl": "65e5957613227bb7690ce9f6" }, { + "_id": "66c8f2c0584b8fef8201d0e8", + "_tpl": "55d7217a4bdc2d86028b456d", + "parentId": "640b2d867f4185aa520d08bb", + "slotId": "Stand1" + }, { "_id": "63db64cbf9963741dc0d741f", "_tpl": "64381b6e44b37a080d0245b9" }, { @@ -43946,6 +43951,11 @@ "_id": "640b2d867f4185aa520d08bb", "_tpl": "65e5957613227bb7690ce9f6" }, { + "_id": "66c8f2c0584b8fef8201d0e8", + "_tpl": "55d7217a4bdc2d86028b456d", + "parentId": "640b2d867f4185aa520d08bb", + "slotId": "Stand1" + }, { "_id": "63db64cbf9963741dc0d741f", "_tpl": "64381b6e44b37a080d0245b9" }, { From 557dc55a33bcb99717c88c81c7075696d634d726 Mon Sep 17 00:00:00 2001 From: Dev Date: Fri, 23 Aug 2024 23:41:50 +0100 Subject: [PATCH 2/2] Implemented inclusion of `standx` items when updating/installing hideout equipment area Set area to level 0 for USEC Removed unnecessary mannequin pose array from dev profiles --- .../assets/database/templates/profiles.json | 17 +----- project/src/controllers/HideoutController.ts | 60 +++++++++++++++---- 2 files changed, 52 insertions(+), 25 deletions(-) diff --git a/project/assets/database/templates/profiles.json b/project/assets/database/templates/profiles.json index 401a4db0..863fde75 100644 --- a/project/assets/database/templates/profiles.json +++ b/project/assets/database/templates/profiles.json @@ -40757,8 +40757,7 @@ ], "Improvement": {}, "Production": {}, - "HideoutCounters": null, - "MannequinPoses": ["standing", "boxing", "fingerguns", "fingerguns2", "spreadinghands"] + "HideoutCounters": null }, "Info": { "AccountType": 0, @@ -43868,7 +43867,7 @@ "completeTime": 0, "constructing": false, "lastRecipe": "", - "level": 1, + "level": 0, "passiveBonusesEnabled": true, "slots": [], "type": 26 @@ -43927,7 +43926,6 @@ "16": "5d494a295b56502f18c98a08", "24": "63db64cbf9963741dc0d741f", "25": "640b2d867f4185aa520d08ba", - "26": "640b2d867f4185aa520d08bb", "27": "66c5bfd48a24042f1006eadc" }, "items": [{ @@ -43948,14 +43946,6 @@ "_id": "640b2d867f4185aa520d08ba", "_tpl": "64381b6e44b37a080d0245b9" }, { - "_id": "640b2d867f4185aa520d08bb", - "_tpl": "65e5957613227bb7690ce9f6" - }, { - "_id": "66c8f2c0584b8fef8201d0e8", - "_tpl": "55d7217a4bdc2d86028b456d", - "parentId": "640b2d867f4185aa520d08bb", - "slotId": "Stand1" - }, { "_id": "63db64cbf9963741dc0d741f", "_tpl": "64381b6e44b37a080d0245b9" }, { @@ -46979,8 +46969,7 @@ ], "Improvement": {}, "Production": {}, - "HideoutCounters": null, - "MannequinPoses": ["standing", "boxing", "fingerguns", "fingerguns2", "spreadinghands"] + "HideoutCounters": null }, "Info": { "AccountType": 0, diff --git a/project/src/controllers/HideoutController.ts b/project/src/controllers/HideoutController.ts index 13b8de10..582df4aa 100644 --- a/project/src/controllers/HideoutController.ts +++ b/project/src/controllers/HideoutController.ts @@ -282,16 +282,10 @@ export class HideoutController { } // Add/upgrade stash item in player inventory - this.addUpdateInventoryItemToProfile(pmcData, dbHideoutArea, hideoutStage); + this.addUpdateInventoryItemToProfile(sessionID, pmcData, dbHideoutArea, hideoutStage, output); // Dont inform client when upgraded area is hall of fame/cult circle, BSG doesn't inform client upgrade has occurred, will break client if data is sent - if ( - ![ - HideoutAreas.PLACE_OF_FAME, - HideoutAreas.CIRCLE_OF_CULTISTS, - HideoutAreas.EQUIPMENT_PRESETS_STAND, - ].includes(dbHideoutArea.type) - ) { + if (![HideoutAreas.PLACE_OF_FAME].includes(dbHideoutArea.type)) { // Inform client of changes this.addContainerUpgradeToClientOutput(output, sessionID, dbHideoutArea.type, dbHideoutArea, hideoutStage); } @@ -312,7 +306,7 @@ export class HideoutController { // Add/upgrade stash item in player inventory const childDbAreaStage = childDbArea.stages[profileParentHideoutArea.level]; - this.addUpdateInventoryItemToProfile(pmcData, childDbArea, childDbAreaStage); + this.addUpdateInventoryItemToProfile(sessionID, pmcData, childDbArea, childDbAreaStage, output); // Inform client of the changes this.addContainerUpgradeToClientOutput(output, sessionID, childDbArea.type, childDbArea, childDbAreaStage); @@ -326,20 +320,64 @@ export class HideoutController { * @param hideoutStage Stage area upgraded to */ protected addUpdateInventoryItemToProfile( + sessionId: string, pmcData: IPmcData, dbHideoutData: IHideoutArea, hideoutStage: Stage, + output: IItemEventRouterResponse, ): void { const existingInventoryItem = pmcData.Inventory.items.find((item) => item._id === dbHideoutData._id); if (existingInventoryItem) { // Update existing items container tpl to point to new id (tpl) existingInventoryItem._tpl = hideoutStage.container; + // Edge case, update `standx` children + if (dbHideoutData.type === HideoutAreas.EQUIPMENT_PRESETS_STAND) { + // Can have multiple 'standx' children depending on upgrade level + const slots = this.itemHelper.getItem(hideoutStage.container)[1]._props.Slots; + for (const slot of slots) { + // Dont add duplicate 'standx' child + const existingChild = pmcData.Inventory.items.find( + (item) => item.parentId === dbHideoutData._id && item.slotId === slot._name, + ); + + // No child, add it + if (!existingChild) { + const itemToAdd = { + _id: this.hashUtil.generate(), + _tpl: ItemTpl.INVENTORY_DEFAULT, + parentId: dbHideoutData._id, + slotId: slot._name, + }; + pmcData.Inventory.items.push(itemToAdd); + output.profileChanges[sessionId].items.new.push(itemToAdd); + } + } + } + + // Update complete return; } - // Add new item as none exists - pmcData.Inventory.items.push({ _id: dbHideoutData._id, _tpl: hideoutStage.container }); + // Add new item as none exists (don't inform client of newContainerItem, will be done in `profileChanges.changedHideoutStashes`) + const newContainerItem = { _id: dbHideoutData._id, _tpl: hideoutStage.container }; + pmcData.Inventory.items.push(newContainerItem); + + // Edge case, add `standx` children as none exist + if (dbHideoutData.type === HideoutAreas.EQUIPMENT_PRESETS_STAND) { + // Get all slots we need to add a child for + const slots = this.itemHelper.getItem(hideoutStage.container)[1]._props.Slots; + for (const slot of slots) { + const childItemToAdd = { + _id: this.hashUtil.generate(), + _tpl: ItemTpl.INVENTORY_DEFAULT, + parentId: dbHideoutData._id, + slotId: slot._name, + }; + pmcData.Inventory.items.push(childItemToAdd); + output.profileChanges[sessionId].items.new.push(childItemToAdd); + } + } } /**