Refactor wearClothing()

This commit is contained in:
Dev 2023-04-23 11:38:57 +01:00
parent 31eb470a08
commit d284ca47d4

View File

@ -50,23 +50,23 @@ export class CustomizationController
return result; return result;
} }
public wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse public wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse
{ {
for (let i = 0; i < body.suites.length; i++) for (const suitId of wearClothingRequest.suites)
{ {
const suite = this.databaseServer.getTables().templates.customization[body.suites[i]]; const dbSuit = this.databaseServer.getTables().templates.customization[suitId];
// this parent refers to Lower Node // Lower Node
if (suite._parent === "5cd944d01388ce000a659df9") if (dbSuit._parent === "5cd944d01388ce000a659df9")
{ {
pmcData.Customization.Feet = suite._props.Feet; pmcData.Customization.Feet = dbSuit._props.Feet;
} }
// this parent reffers to Upper Node // Upper Node
if (suite._parent === "5cd944ca1388ce03a44dc2a4") if (dbSuit._parent === "5cd944ca1388ce03a44dc2a4")
{ {
pmcData.Customization.Body = suite._props.Body; pmcData.Customization.Body = dbSuit._props.Body;
pmcData.Customization.Hands = suite._props.Hands; pmcData.Customization.Hands = dbSuit._props.Hands;
} }
} }