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
This commit is contained in:
Dev 2024-08-23 23:41:50 +01:00
parent 9418095f03
commit 557dc55a33
2 changed files with 52 additions and 25 deletions

View File

@ -40757,8 +40757,7 @@
], ],
"Improvement": {}, "Improvement": {},
"Production": {}, "Production": {},
"HideoutCounters": null, "HideoutCounters": null
"MannequinPoses": ["standing", "boxing", "fingerguns", "fingerguns2", "spreadinghands"]
}, },
"Info": { "Info": {
"AccountType": 0, "AccountType": 0,
@ -43868,7 +43867,7 @@
"completeTime": 0, "completeTime": 0,
"constructing": false, "constructing": false,
"lastRecipe": "", "lastRecipe": "",
"level": 1, "level": 0,
"passiveBonusesEnabled": true, "passiveBonusesEnabled": true,
"slots": [], "slots": [],
"type": 26 "type": 26
@ -43927,7 +43926,6 @@
"16": "5d494a295b56502f18c98a08", "16": "5d494a295b56502f18c98a08",
"24": "63db64cbf9963741dc0d741f", "24": "63db64cbf9963741dc0d741f",
"25": "640b2d867f4185aa520d08ba", "25": "640b2d867f4185aa520d08ba",
"26": "640b2d867f4185aa520d08bb",
"27": "66c5bfd48a24042f1006eadc" "27": "66c5bfd48a24042f1006eadc"
}, },
"items": [{ "items": [{
@ -43948,14 +43946,6 @@
"_id": "640b2d867f4185aa520d08ba", "_id": "640b2d867f4185aa520d08ba",
"_tpl": "64381b6e44b37a080d0245b9" "_tpl": "64381b6e44b37a080d0245b9"
}, { }, {
"_id": "640b2d867f4185aa520d08bb",
"_tpl": "65e5957613227bb7690ce9f6"
}, {
"_id": "66c8f2c0584b8fef8201d0e8",
"_tpl": "55d7217a4bdc2d86028b456d",
"parentId": "640b2d867f4185aa520d08bb",
"slotId": "Stand1"
}, {
"_id": "63db64cbf9963741dc0d741f", "_id": "63db64cbf9963741dc0d741f",
"_tpl": "64381b6e44b37a080d0245b9" "_tpl": "64381b6e44b37a080d0245b9"
}, { }, {
@ -46979,8 +46969,7 @@
], ],
"Improvement": {}, "Improvement": {},
"Production": {}, "Production": {},
"HideoutCounters": null, "HideoutCounters": null
"MannequinPoses": ["standing", "boxing", "fingerguns", "fingerguns2", "spreadinghands"]
}, },
"Info": { "Info": {
"AccountType": 0, "AccountType": 0,

View File

@ -282,16 +282,10 @@ export class HideoutController {
} }
// Add/upgrade stash item in player inventory // 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 // 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 ( if (![HideoutAreas.PLACE_OF_FAME].includes(dbHideoutArea.type)) {
![
HideoutAreas.PLACE_OF_FAME,
HideoutAreas.CIRCLE_OF_CULTISTS,
HideoutAreas.EQUIPMENT_PRESETS_STAND,
].includes(dbHideoutArea.type)
) {
// Inform client of changes // Inform client of changes
this.addContainerUpgradeToClientOutput(output, sessionID, dbHideoutArea.type, dbHideoutArea, hideoutStage); this.addContainerUpgradeToClientOutput(output, sessionID, dbHideoutArea.type, dbHideoutArea, hideoutStage);
} }
@ -312,7 +306,7 @@ export class HideoutController {
// Add/upgrade stash item in player inventory // Add/upgrade stash item in player inventory
const childDbAreaStage = childDbArea.stages[profileParentHideoutArea.level]; const childDbAreaStage = childDbArea.stages[profileParentHideoutArea.level];
this.addUpdateInventoryItemToProfile(pmcData, childDbArea, childDbAreaStage); this.addUpdateInventoryItemToProfile(sessionID, pmcData, childDbArea, childDbAreaStage, output);
// Inform client of the changes // Inform client of the changes
this.addContainerUpgradeToClientOutput(output, sessionID, childDbArea.type, childDbArea, childDbAreaStage); this.addContainerUpgradeToClientOutput(output, sessionID, childDbArea.type, childDbArea, childDbAreaStage);
@ -326,20 +320,64 @@ export class HideoutController {
* @param hideoutStage Stage area upgraded to * @param hideoutStage Stage area upgraded to
*/ */
protected addUpdateInventoryItemToProfile( protected addUpdateInventoryItemToProfile(
sessionId: string,
pmcData: IPmcData, pmcData: IPmcData,
dbHideoutData: IHideoutArea, dbHideoutData: IHideoutArea,
hideoutStage: Stage, hideoutStage: Stage,
output: IItemEventRouterResponse,
): void { ): void {
const existingInventoryItem = pmcData.Inventory.items.find((item) => item._id === dbHideoutData._id); const existingInventoryItem = pmcData.Inventory.items.find((item) => item._id === dbHideoutData._id);
if (existingInventoryItem) { if (existingInventoryItem) {
// Update existing items container tpl to point to new id (tpl) // Update existing items container tpl to point to new id (tpl)
existingInventoryItem._tpl = hideoutStage.container; 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; return;
} }
// Add new item as none exists // Add new item as none exists (don't inform client of newContainerItem, will be done in `profileChanges.changedHideoutStashes`)
pmcData.Inventory.items.push({ _id: dbHideoutData._id, _tpl: hideoutStage.container }); 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);
}
}
} }
/** /**