Implemented pin/lock/free on inventory items
This commit is contained in:
parent
9dea4a86e9
commit
922adcfb5c
@ -18,7 +18,7 @@ import { IInventoryTagRequestData } from "@spt/models/eft/inventory/IInventoryTa
|
|||||||
import { IInventoryToggleRequestData } from "@spt/models/eft/inventory/IInventoryToggleRequestData";
|
import { IInventoryToggleRequestData } from "@spt/models/eft/inventory/IInventoryToggleRequestData";
|
||||||
import { IInventoryTransferRequestData } from "@spt/models/eft/inventory/IInventoryTransferRequestData";
|
import { IInventoryTransferRequestData } from "@spt/models/eft/inventory/IInventoryTransferRequestData";
|
||||||
import { IOpenRandomLootContainerRequestData } from "@spt/models/eft/inventory/IOpenRandomLootContainerRequestData";
|
import { IOpenRandomLootContainerRequestData } from "@spt/models/eft/inventory/IOpenRandomLootContainerRequestData";
|
||||||
import { IPinItemRequest } from "@spt/models/eft/inventory/IPinItemRequest";
|
import { IPinOrLockItemRequest } from "@spt/models/eft/inventory/IPinOrLockItemRequest";
|
||||||
import { IRedeemProfileRequestData } from "@spt/models/eft/inventory/IRedeemProfileRequestData";
|
import { IRedeemProfileRequestData } from "@spt/models/eft/inventory/IRedeemProfileRequestData";
|
||||||
import { ISetFavoriteItems } from "@spt/models/eft/inventory/ISetFavoriteItems";
|
import { ISetFavoriteItems } from "@spt/models/eft/inventory/ISetFavoriteItems";
|
||||||
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||||
@ -238,12 +238,12 @@ export class InventoryCallbacks {
|
|||||||
return this.questController.failQuest(pmcData, request, sessionID, output);
|
return this.questController.failQuest(pmcData, request, sessionID, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
public pin(
|
public pinOrLock(
|
||||||
pmcData: IPmcData,
|
pmcData: IPmcData,
|
||||||
request: IPinItemRequest,
|
request: IPinOrLockItemRequest,
|
||||||
sessionID: string,
|
sessionID: string,
|
||||||
output: IItemEventRouterResponse,
|
output: IItemEventRouterResponse,
|
||||||
): IItemEventRouterResponse {
|
): IItemEventRouterResponse {
|
||||||
return this.questController.pin(pmcData, request, sessionID, output);
|
return this.inventoryController.pinOrLock(pmcData, request, sessionID, output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ import { IInventoryTagRequestData } from "@spt/models/eft/inventory/IInventoryTa
|
|||||||
import { IInventoryToggleRequestData } from "@spt/models/eft/inventory/IInventoryToggleRequestData";
|
import { IInventoryToggleRequestData } from "@spt/models/eft/inventory/IInventoryToggleRequestData";
|
||||||
import { IInventoryTransferRequestData } from "@spt/models/eft/inventory/IInventoryTransferRequestData";
|
import { IInventoryTransferRequestData } from "@spt/models/eft/inventory/IInventoryTransferRequestData";
|
||||||
import { IOpenRandomLootContainerRequestData } from "@spt/models/eft/inventory/IOpenRandomLootContainerRequestData";
|
import { IOpenRandomLootContainerRequestData } from "@spt/models/eft/inventory/IOpenRandomLootContainerRequestData";
|
||||||
|
import { IPinOrLockItemRequest } from "@spt/models/eft/inventory/IPinOrLockItemRequest";
|
||||||
import { IRedeemProfileRequestData } from "@spt/models/eft/inventory/IRedeemProfileRequestData";
|
import { IRedeemProfileRequestData } from "@spt/models/eft/inventory/IRedeemProfileRequestData";
|
||||||
import { ISetFavoriteItems } from "@spt/models/eft/inventory/ISetFavoriteItems";
|
import { ISetFavoriteItems } from "@spt/models/eft/inventory/ISetFavoriteItems";
|
||||||
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||||
@ -947,4 +948,30 @@ export class InventoryController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle /client/game/profile/items/moving - PinLock
|
||||||
|
* Requires no response to client, only server change
|
||||||
|
* @param pmcData Players profile
|
||||||
|
* @param request Pin/Lock request data
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @param output data to send back to client
|
||||||
|
*/
|
||||||
|
public pinOrLock(
|
||||||
|
pmcData: IPmcData,
|
||||||
|
request: IPinOrLockItemRequest,
|
||||||
|
sessionID: string,
|
||||||
|
output: IItemEventRouterResponse,
|
||||||
|
): IItemEventRouterResponse {
|
||||||
|
const itemToAdjust = pmcData.Inventory.items.find((item) => item._id === request.Item);
|
||||||
|
if (!itemToAdjust) {
|
||||||
|
this.logger.error(`Unable find item: ${request.Item} to: ${request.State} on player ${sessionID} to: `);
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
itemToAdjust.upd ||= {};
|
||||||
|
itemToAdjust.upd.PinLockState = request.State;
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,6 @@ import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
|||||||
import { IItem } from "@spt/models/eft/common/tables/IItem";
|
import { IItem } from "@spt/models/eft/common/tables/IItem";
|
||||||
import { IQuest, IQuestCondition } from "@spt/models/eft/common/tables/IQuest";
|
import { IQuest, IQuestCondition } from "@spt/models/eft/common/tables/IQuest";
|
||||||
import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt/models/eft/common/tables/IRepeatableQuests";
|
import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt/models/eft/common/tables/IRepeatableQuests";
|
||||||
import { IPinItemRequest } from "@spt/models/eft/inventory/IPinItemRequest";
|
|
||||||
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||||
import { IAcceptQuestRequestData } from "@spt/models/eft/quests/IAcceptQuestRequestData";
|
import { IAcceptQuestRequestData } from "@spt/models/eft/quests/IAcceptQuestRequestData";
|
||||||
import { ICompleteQuestRequestData } from "@spt/models/eft/quests/ICompleteQuestRequestData";
|
import { ICompleteQuestRequestData } from "@spt/models/eft/quests/ICompleteQuestRequestData";
|
||||||
@ -523,20 +522,4 @@ export class QuestController {
|
|||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle /client/game/profile/items/moving - PinLock
|
|
||||||
* @param pmcData
|
|
||||||
* @param request
|
|
||||||
* @param sessionID
|
|
||||||
* @param output
|
|
||||||
*/
|
|
||||||
public pin(
|
|
||||||
pmcData: IPmcData,
|
|
||||||
request: IPinItemRequest,
|
|
||||||
sessionID: string,
|
|
||||||
output: IItemEventRouterResponse,
|
|
||||||
): IItemEventRouterResponse {
|
|
||||||
throw new Error("Method not implemented.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,13 @@ export interface IUpd {
|
|||||||
SideEffect?: IUpdSideEffect;
|
SideEffect?: IUpdSideEffect;
|
||||||
RepairKit?: IUpdRepairKit;
|
RepairKit?: IUpdRepairKit;
|
||||||
CultistAmulet?: IUpdCultistAmulet;
|
CultistAmulet?: IUpdCultistAmulet;
|
||||||
|
PinLockState?: PinLockState;
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum PinLockState {
|
||||||
|
FREE = "Free",
|
||||||
|
LOCKED = "Locked",
|
||||||
|
PINNED = "Pinned",
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IUpdBuff {
|
export interface IUpdBuff {
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
export interface IPinItemRequest {
|
|
||||||
Action: "PinLock";
|
|
||||||
/** Id of item being pinned */
|
|
||||||
Item: string;
|
|
||||||
/** "Pinned"/"" */
|
|
||||||
State: string;
|
|
||||||
}
|
|
@ -0,0 +1,9 @@
|
|||||||
|
import { PinLockState } from "../common/tables/IItem";
|
||||||
|
|
||||||
|
export interface IPinOrLockItemRequest {
|
||||||
|
Action: "PinLock";
|
||||||
|
/** Id of item being pinned */
|
||||||
|
Item: string;
|
||||||
|
/** "Pinned"/"Locked"/"Free" */
|
||||||
|
State: PinLockState;
|
||||||
|
}
|
@ -26,5 +26,5 @@ export enum ItemEventActions {
|
|||||||
REDEEM_PROFILE_REWARD = "RedeemProfileReward",
|
REDEEM_PROFILE_REWARD = "RedeemProfileReward",
|
||||||
SET_FAVORITE_ITEMS = "SetFavoriteItems",
|
SET_FAVORITE_ITEMS = "SetFavoriteItems",
|
||||||
QUEST_FAIL = "QuestFail",
|
QUEST_FAIL = "QuestFail",
|
||||||
PIN = "PinLock",
|
PIN_LOCK = "PinLock",
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ export class InventoryItemEventRouter extends ItemEventRouterDefinition {
|
|||||||
new HandledRoute(ItemEventActions.REDEEM_PROFILE_REWARD, false),
|
new HandledRoute(ItemEventActions.REDEEM_PROFILE_REWARD, false),
|
||||||
new HandledRoute(ItemEventActions.SET_FAVORITE_ITEMS, false),
|
new HandledRoute(ItemEventActions.SET_FAVORITE_ITEMS, false),
|
||||||
new HandledRoute(ItemEventActions.QUEST_FAIL, false),
|
new HandledRoute(ItemEventActions.QUEST_FAIL, false),
|
||||||
|
new HandledRoute(ItemEventActions.PIN_LOCK, false),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,8 +95,8 @@ export class InventoryItemEventRouter extends ItemEventRouterDefinition {
|
|||||||
return this.inventoryCallbacks.setFavoriteItem(pmcData, body, sessionID, output);
|
return this.inventoryCallbacks.setFavoriteItem(pmcData, body, sessionID, output);
|
||||||
case ItemEventActions.QUEST_FAIL:
|
case ItemEventActions.QUEST_FAIL:
|
||||||
return this.inventoryCallbacks.failQuest(pmcData, body, sessionID, output);
|
return this.inventoryCallbacks.failQuest(pmcData, body, sessionID, output);
|
||||||
case ItemEventActions.PIN:
|
case ItemEventActions.PIN_LOCK:
|
||||||
return this.inventoryCallbacks.pin(pmcData, body, sessionID, output);
|
return this.inventoryCallbacks.pinOrLock(pmcData, body, sessionID, output);
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unhandled event ${url} request: ${JSON.stringify(body)}`);
|
throw new Error(`Unhandled event ${url} request: ${JSON.stringify(body)}`);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user