2023-03-03 15:23:46 +00:00
|
|
|
import { inject, injectable } from "tsyringe";
|
|
|
|
|
2023-10-19 17:21:17 +00:00
|
|
|
import { CustomizationCallbacks } from "@spt-aki/callbacks/CustomizationCallbacks";
|
|
|
|
import { HandledRoute, ItemEventRouterDefinition } from "@spt-aki/di/Router";
|
|
|
|
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
|
|
|
|
import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse";
|
2023-03-03 15:23:46 +00:00
|
|
|
|
|
|
|
@injectable()
|
2023-11-15 20:35:05 -05:00
|
|
|
export class CustomizationItemEventRouter extends ItemEventRouterDefinition
|
2023-03-03 15:23:46 +00:00
|
|
|
{
|
|
|
|
constructor(
|
2023-11-15 20:35:05 -05:00
|
|
|
@inject("CustomizationCallbacks") protected customizationCallbacks: CustomizationCallbacks, // TODO: delay required
|
|
|
|
)
|
2023-03-03 15:23:46 +00:00
|
|
|
{
|
|
|
|
super();
|
|
|
|
}
|
|
|
|
|
2023-11-15 20:35:05 -05:00
|
|
|
public override getHandledRoutes(): HandledRoute[]
|
2023-03-03 15:23:46 +00:00
|
|
|
{
|
2023-11-15 20:35:05 -05:00
|
|
|
return [new HandledRoute("CustomizationWear", false), new HandledRoute("CustomizationBuy", false)];
|
2023-03-03 15:23:46 +00:00
|
|
|
}
|
|
|
|
|
2023-11-15 20:35:05 -05:00
|
|
|
public override handleItemEvent(
|
|
|
|
url: string,
|
|
|
|
pmcData: IPmcData,
|
|
|
|
body: any,
|
|
|
|
sessionID: string,
|
|
|
|
): IItemEventRouterResponse
|
2023-03-03 15:23:46 +00:00
|
|
|
{
|
|
|
|
switch (url)
|
|
|
|
{
|
|
|
|
case "CustomizationWear":
|
|
|
|
return this.customizationCallbacks.wearClothing(pmcData, body, sessionID);
|
|
|
|
case "CustomizationBuy":
|
|
|
|
return this.customizationCallbacks.buyClothing(pmcData, body, sessionID);
|
|
|
|
}
|
|
|
|
}
|
2023-11-15 20:35:05 -05:00
|
|
|
}
|