Merge branch 'master' of https://dev.sp-tarkov.com/SPT-AKI/Server into 3.8.0

# Conflicts:
#	project/src/callbacks/DialogueCallbacks.ts
#	project/src/callbacks/MatchCallbacks.ts
#	project/src/callbacks/NotifierCallbacks.ts
#	project/src/controllers/InventoryController.ts
#	project/src/controllers/MatchController.ts
#	project/src/routers/static/RagfairStaticRouter.ts
This commit is contained in:
Dev 2023-12-21 09:07:23 +00:00
commit b993226296
18 changed files with 188 additions and 53 deletions

View File

@ -130,9 +130,9 @@
},
"5d650c3e815116009f6201d2": {
"_name": "FUEL",
"conditionChance": 0.06,
"min": 0.01,
"max": 0.15
"conditionChance": 0.12,
"min": 0.7,
"max": 0.99
}
},
"stackablePercent": {

View File

@ -7,11 +7,11 @@
},
"windSpeed": {
"values": [0, 1, 2, 3],
"weights": [20, 15, 10, 5]
"weights": [4, 3, 2, 1]
},
"windDirection": {
"values": [1, 2, 3, 4, 5, 6, 7, 8],
"weights": [10, 10, 10, 10, 10, 10, 10, 10]
"weights": [1, 1, 1, 1, 1, 1, 1, 1]
},
"windGustiness": {
"min": 0,
@ -19,15 +19,15 @@
},
"rain": {
"values": [1, 2, 3],
"weights": [100, 10, 5]
"weights": [25, 1, 1]
},
"rainIntensity": {
"min": 0,
"max": 1
},
"fog": {
"values": [0.002, 0.006, 0.008, 0.012, 0.087],
"weights": [100, 40, 25, 25, 5]
"values": [0.002, 0.004, 0.008, 0.012, 0.087],
"weights": [20, 8, 5, 5, 1]
},
"temp": {
"min": 0,

View File

@ -41,7 +41,8 @@ export class DialogueCallbacks implements OnUpdate
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
@inject("DialogueController") protected dialogueController: DialogueController,
)
{}
{
}
/**
* Handle client/friend/list
@ -60,6 +61,7 @@ export class DialogueCallbacks implements OnUpdate
* Handle client/chatServer/list
* @returns IChatServer[]
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public getChatServerList(
url: string,
info: IGetChatServerListRequestData,
@ -72,7 +74,7 @@ export class DialogueCallbacks implements OnUpdate
DateTime: this.timeUtil.getTimestamp(),
IsDeveloper: true,
Regions: ["EUR"],
VersionId: "bgkidft87ddd", // TODO: Is this... correct?
VersionId: "bgkidft87ddd",
Ip: "",
Port: 0,
Chats: [{ _id: "0", Members: 0 }],
@ -159,6 +161,7 @@ export class DialogueCallbacks implements OnUpdate
}
/** Handle client/friend/request/list/outbox */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public listOutbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<any[]>
{
return this.httpResponse.getBody([]);
@ -167,6 +170,7 @@ export class DialogueCallbacks implements OnUpdate
/**
* Handle client/friend/request/list/inbox
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<any[]>
{
return this.httpResponse.getBody([]);
@ -175,6 +179,7 @@ export class DialogueCallbacks implements OnUpdate
/**
* Handle client/friend/request/send
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public sendFriendRequest(
url: string,
request: IFriendRequestData,
@ -187,6 +192,7 @@ export class DialogueCallbacks implements OnUpdate
/**
* Handle client/friend/request/accept
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public acceptFriendRequest(
url: string,
request: IAcceptFriendRequestData,
@ -199,6 +205,7 @@ export class DialogueCallbacks implements OnUpdate
/**
* Handle client/friend/request/cancel
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public cancelFriendRequest(
url: string,
request: ICancelFriendRequestData,
@ -209,33 +216,39 @@ export class DialogueCallbacks implements OnUpdate
}
/** Handle client/friend/delete */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public deleteFriend(url: string, request: IDeleteFriendRequest, sessionID: string): INullResponseData
{
return this.httpResponse.nullResponse();
}
/** Handle client/friend/ignore/set */
public ignoreFriend(url: string, request: { uid: string; }, sessionID: string): any
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public ignoreFriend(url: string, request: { uid: string; }, sessionID: string): INullResponseData
{
return this.httpResponse.nullResponse();
}
/** Handle client/friend/ignore/remove */
public unIgnoreFriend(url: string, request: { uid: string; }, sessionID: string): any
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public unIgnoreFriend(url: string, request: { uid: string; }, sessionID: string): INullResponseData
{
return this.httpResponse.nullResponse();
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public clearMail(url: string, request: IClearMailMessageRequest, sessionID: string): IGetBodyResponseData<any[]>
{
return this.httpResponse.emptyArrayResponse();
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public removeMail(url: string, request: IRemoveMailMessageRequest, sessionID: string): IGetBodyResponseData<any[]>
{
return this.httpResponse.emptyArrayResponse();
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public async onUpdate(timeSinceLastRun: number): Promise<boolean>
{
this.dialogueController.update();

View File

@ -11,6 +11,7 @@ import { IGameKeepAliveResponse } from "@spt-aki/models/eft/game/IGameKeepAliveR
import { IGameLogoutResponseData } from "@spt-aki/models/eft/game/IGameLogoutResponseData";
import { IGameStartResponse } from "@spt-aki/models/eft/game/IGameStartResponse";
import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeRequest";
import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse";
import { IReportNicknameRequestData } from "@spt-aki/models/eft/game/IReportNicknameRequestData";
import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails";
import { IVersionValidateRequestData } from "@spt-aki/models/eft/game/IVersionValidateRequestData";
@ -154,7 +155,7 @@ export class GameCallbacks implements OnLoad
* @returns string
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public getRaidTime(url: string, request: IGetRaidTimeRequest, sessionID: string): any
public getRaidTime(url: string, request: IGetRaidTimeRequest, sessionID: string): IGetRaidTimeResponse
{
return this.httpResponse.noBody(this.gameController.getRaidTime(sessionID, request));
}

View File

@ -11,6 +11,7 @@ import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGrou
import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData";
import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData";
import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData";
import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse";
import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData";
import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData";
import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData";
@ -36,40 +37,47 @@ export class MatchCallbacks
{}
/** Handle client/match/updatePing */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public updatePing(url: string, info: IUpdatePingRequestData, sessionID: string): INullResponseData
{
return this.httpResponse.nullResponse();
}
// Handle client/match/exit
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public exitMatch(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData
{
return this.httpResponse.nullResponse();
}
/** Handle client/match/group/exit_from_menu */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public exitToMenu(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData
{
return this.httpResponse.nullResponse();
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public startGroupSearch(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData
{
return this.httpResponse.nullResponse();
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public stopGroupSearch(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData
{
return this.httpResponse.nullResponse();
}
/** Handle client/match/group/invite/send */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData<string>
{
return this.httpResponse.getBody("2427943f23698ay9f2863735");
}
/** Handle client/match/group/invite/accept */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public acceptGroupInvite(
url: string,
info: IAcceptGroupInviteRequest,
@ -83,6 +91,7 @@ export class MatchCallbacks
}
/** Handle client/match/group/invite/cancel */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public cancelGroupInvite(
url: string,
info: ICancelGroupInviteRequest,
@ -91,32 +100,36 @@ export class MatchCallbacks
{
return this.httpResponse.getBody(true);
}
/** Handle client/match/group/transfer */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData<boolean>
{
return this.httpResponse.getBody(true);
}
/** Handle client/match/group/invite/cancel-all */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData
{
return this.httpResponse.nullResponse();
}
/** @deprecated - not called on raid start/end or game start/exit */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData
{
return this.httpResponse.nullResponse();
}
/** Handle raid/profile/list */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public getProfile(url: string, info: IGetProfileRequestData, sessionID: string): IGetBodyResponseData<IPmcData[]>
{
return this.httpResponse.getBody(this.matchController.getProfile(info));
}
// Handle client/match/available
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<boolean>
{
const output = this.matchController.getEnabled();
@ -135,6 +148,7 @@ export class MatchCallbacks
}
/** Handle client/getMetricsConfig */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData<string>
{
return this.httpResponse.getBody(this.jsonUtil.serialize(this.databaseServer.getTables().match.metrics));
@ -145,18 +159,21 @@ export class MatchCallbacks
* Handle client/match/group/status
* @returns
*/
public getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData<any>
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData<IGetGroupStatusResponse>
{
return this.httpResponse.getBody(this.matchController.getGroupStatus(info));
}
/** Handle client/match/group/create */
// TODO: may have been removed from client
public createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData<any>
{
return this.httpResponse.getBody(this.matchController.createGroup(sessionID, info));
}
/** Handle client/match/group/delete */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public deleteGroup(url: string, info: any, sessionID: string): INullResponseData
{
this.matchController.deleteGroup(info);
@ -164,12 +181,14 @@ export class MatchCallbacks
}
// Handle client/match/group/leave
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public leaveGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<boolean>
{
return this.httpResponse.getBody(true);
}
/** Handle client/match/group/player/remove */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public removePlayerFromGroup(url: string, info: IRemovePlayerFromGroupRequest, sessionID: string): INullResponseData
{
return this.httpResponse.nullResponse();

View File

@ -27,6 +27,7 @@ export class NotifierCallbacks
* until we actually have something to send because otherwise we'd spam the client
* and the client would abort the connection due to spam.
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public sendNotification(sessionID: string, req: any, resp: any, data: any): void
{
const splittedUrl = req.url.split("/");
@ -43,6 +44,8 @@ export class NotifierCallbacks
/** Handle push/notifier/get */
/** Handle push/notifier/getwebsocket */
// TODO: removed from client?
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public getNotifier(url: string, info: any, sessionID: string): IGetBodyResponseData<any[]>
{
return this.httpResponse.emptyArrayResponse();
@ -62,6 +65,7 @@ export class NotifierCallbacks
* Handle client/game/profile/select
* @returns ISelectProfileResponse
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public selectProfile(
url: string,
info: ISelectProfileRequestData,
@ -71,6 +75,7 @@ export class NotifierCallbacks
return this.httpResponse.getBody({ status: "ok" });
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public notify(url: string, info: any, sessionID: string): string
{
return "NOTIFY";

View File

@ -7,6 +7,7 @@ import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyR
import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData";
import { IGetMiniProfileRequestData } from "@spt-aki/models/eft/launcher/IGetMiniProfileRequestData";
import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData";
import { ICreateProfileResponse } from "@spt-aki/models/eft/profile/ICreateProfileResponse";
import { IGetProfileSettingsRequest } from "@spt-aki/models/eft/profile/IGetProfileSettingsRequest";
import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData";
import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData";
@ -31,10 +32,11 @@ export class ProfileCallbacks
/**
* Handle client/game/profile/create
*/
public createProfile(url: string, info: IProfileCreateRequestData, sessionID: string): IGetBodyResponseData<any>
public createProfile(url: string, info: IProfileCreateRequestData, sessionID: string): IGetBodyResponseData<ICreateProfileResponse>
{
this.profileController.createProfile(info, sessionID);
return this.httpResponse.getBody({ uid: `pmc${sessionID}` });
const id = this.profileController.createProfile(info, sessionID);
return this.httpResponse.getBody({ uid: id });
}
/**

View File

@ -13,6 +13,8 @@ import { IExtendOfferRequestData } from "@spt-aki/models/eft/ragfair/IExtendOffe
import { IGetItemPriceResult } from "@spt-aki/models/eft/ragfair/IGetItemPriceResult";
import { IGetMarketPriceRequestData } from "@spt-aki/models/eft/ragfair/IGetMarketPriceRequestData";
import { IGetOffersResult } from "@spt-aki/models/eft/ragfair/IGetOffersResult";
import { IGetRagfairOfferByIdRequest } from "@spt-aki/models/eft/ragfair/IGetRagfairOfferByIdRequest";
import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer";
import { IRemoveOfferRequestData } from "@spt-aki/models/eft/ragfair/IRemoveOfferRequestData";
import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData";
import { ISendRagfairReportRequestData } from "@spt-aki/models/eft/ragfair/ISendRagfairReportRequestData";
@ -138,4 +140,10 @@ export class RagfairCallbacks implements OnLoad, OnUpdate
this.ragfairTaxService.storeClientOfferTaxValue(sessionId, request);
return this.httpResponse.nullResponse();
}
/** Handle client/ragfair/offer/findbyid */
public getFleaOfferById(url: string, request: IGetRagfairOfferByIdRequest, sessionID: string): IGetBodyResponseData<IRagfairOffer>
{
return this.httpResponse.getBody(this.ragfairController.getOfferById(sessionID, request));
}
}

View File

@ -96,7 +96,7 @@ export class InventoryController
const ownerInventoryItems = this.inventoryHelper.getOwnerInventoryItems(moveRequest, sessionID);
if (ownerInventoryItems.sameInventory)
{
// Don't move items from trader to profile, this can happen when editing a traders preset weapons
// Dont move items from trader to profile, this can happen when editing a traders preset weapons
if (moveRequest.fromOwner?.type === "Trader" && !ownerInventoryItems.isMail)
{
return this.getTraderExploitErrorResponse(output);
@ -185,7 +185,7 @@ export class InventoryController
/**
* Split Item
* splitting 1 stack into 2
* spliting 1 stack into 2
* @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile)
* @param request Split request
* @param sessionID Session/player id
@ -209,8 +209,7 @@ export class InventoryController
request.container.location = matchingItems.length; // Wrong location for first cartridge
}
// The item being merged has three possible sources: pmc, scav or mail, getOwnerInventoryItems() handles getting
// correct one.
// The item being merged has three possible sources: pmc, scav or mail, getOwnerInventoryItems() handles getting correct one
const itemToSplit = inventoryItems.from.find((x) => x._id === request.splitItem);
if (!itemToSplit)
{
@ -284,7 +283,7 @@ export class InventoryController
if (!(destinationItem.upd?.StackObjectsCount))
{
// No stack count on destination, add one
// No stackcount on destination, add one
destinationItem.upd = { StackObjectsCount: 1 };
}
@ -294,11 +293,17 @@ export class InventoryController
}
else if (!sourceItem.upd.StackObjectsCount)
{
// Items pulled out of raid can have no stack count if the stack should be 1
// Items pulled out of raid can have no stackcount if the stack should be 1
sourceItem.upd.StackObjectsCount = 1;
}
destinationItem.upd.StackObjectsCount += sourceItem.upd.StackObjectsCount; // Add source stack count to destination
// Remove FiR status from destination stack when source stack has no FiR but destination does
if (!sourceItem.upd.SpawnedInSession && destinationItem.upd.SpawnedInSession)
{
delete destinationItem.upd.SpawnedInSession;
}
destinationItem.upd.StackObjectsCount += sourceItem.upd.StackObjectsCount; // Add source stackcount to destination
output.profileChanges[sessionID].items.del.push({ _id: sourceItem._id }); // Inform client source item being deleted
const indexOfItemToRemove = inventoryItems.from.findIndex((x) => x._id === sourceItem._id);
@ -315,8 +320,8 @@ export class InventoryController
}
/**
* // TODO: Adds no data to output to send to client, is this by design?
* // TODO: should make use of getOwnerInventoryItems(), stack being transferred may not always be on pmc
* TODO: Adds no data to output to send to client, is this by design?
* TODO: should make use of getOwnerInventoryItems(), stack being transferred may not always be on pmc
* Transfer items from one stack into another while keeping original stack
* Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload"
* @param pmcData Player profile
@ -422,10 +427,10 @@ export class InventoryController
this.logger.error(`Unable to find item: ${request.item2} to swap positions with: ${request.item}`);
}
// to.id is the parentId
// to.id is the parentid
itemOne.parentId = request.to.id;
// to.container is the slotId
// to.container is the slotid
itemOne.slotId = request.to.container;
// Request object has location data, add it in, otherwise remove existing location from object
@ -477,7 +482,7 @@ export class InventoryController
}
/**
* Toggles "toggleable" items like night vision goggles and face shields.
* Toggles "Toggleable" items like night vision goggles and face shields.
* @param pmcData player profile
* @param body Toggle request
* @param sessionID Session id
@ -549,7 +554,7 @@ export class InventoryController
* Bind an inventory item to the quick access menu at bottom of player screen
* Handle bind event
* @param pmcData Player profile
* @param bindRequest Request object
* @param bindRequest Reqeust object
* @param sessionID Session id
* @returns IItemEventRouterResponse
*/
@ -680,9 +685,9 @@ export class InventoryController
}
/**
* Get the tplId of an item from the examine request object
* Get the tplid of an item from the examine request object
* @param body response request
* @returns string
* @returns tplid
*/
protected getExaminedItemTpl(body: IInventoryExamineRequestData): string
{
@ -692,41 +697,40 @@ export class InventoryController
}
else if (body.fromOwner.id === Traders.FENCE)
{
// Get tpl from fence assorts
// get tpl from fence assorts
return this.fenceService.getRawFenceAssorts().items.find((x) => x._id === body.item)._tpl;
}
else if (body.fromOwner.type === "Trader")
{ // not fence
// Not fence
// Get tpl from trader assort
// get tpl from trader assort
return this.databaseServer.getTables().traders[body.fromOwner.id].assort.items.find((item) =>
item._id === body.item
)._tpl;
}
else if (body.fromOwner.type === "RagFair")
{
// try to get tplId from items.json first
// try to get tplid from items.json first
const item = this.databaseServer.getTables().templates.items[body.item];
if (item)
{
return item._id;
}
// Try alternate way of getting offer if first approach fails
// try alternate way of getting offer if first approach fails
let offer = this.ragfairOfferService.getOfferByOfferId(body.item);
if (!offer)
{
offer = this.ragfairOfferService.getOfferByOfferId(body.fromOwner.id);
}
// Try find examine item inside offer items array
// try find examine item inside offer items array
const matchingItem = offer.items.find((x) => x._id === body.item);
if (matchingItem)
{
return matchingItem._tpl;
}
// Unable to find item in database or ragfair
// unable to find item in database or ragfair
throw new Error(this.localisationService.getText("inventory-unable_to_find_item", body.item));
}
}
@ -741,6 +745,7 @@ export class InventoryController
{
pmcData.Encyclopedia[id] = true;
}
return this.eventOutputHolder.getOutput(sessionID);
}

View File

@ -10,6 +10,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem";
import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData";
import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData";
import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData";
import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse";
import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData";
import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData";
import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData";
@ -99,6 +100,7 @@ export class MatchController
}
/** Handle match/group/start_game */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public joinMatch(info: IJoinMatchRequestData, sessionId: string): IJoinMatchResult
{
const output: IJoinMatchResult = { maxPveCountExceeded: false, profiles: [] };
@ -116,6 +118,7 @@ export class MatchController
raidMode: "Online",
mode: "deathmatch",
shortid: null,
// eslint-disable-next-line @typescript-eslint/naming-convention
additional_info: null,
});
@ -123,7 +126,8 @@ export class MatchController
}
/** Handle client/match/group/status */
public getGroupStatus(info: IGetGroupStatusRequestData): any
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public getGroupStatus(info: IGetGroupStatusRequestData): IGetGroupStatusResponse
{
return { players: [], maxPveCountExceeded: false };
}
@ -140,7 +144,7 @@ export class MatchController
// TODO: add code to strip PMC of equipment now they've started the raid
// Set PMCs to difficulty set in pre-raid screen if override in bot config isn't enabled
// Set pmcs to difficulty set in pre-raid screen if override in bot config isnt enabled
if (!this.pmcConfig.useDifficultyOverride)
{
this.pmcConfig.difficulty = this.convertDifficultyDropdownIntoBotDifficulty(

View File

@ -118,8 +118,11 @@ export class ProfileController
/**
* Handle client/game/profile/create
* @param info Client reqeust object
* @param sessionID Player id
* @returns Profiles _id value
*/
public createProfile(info: IProfileCreateRequestData, sessionID: string): void
public createProfile(info: IProfileCreateRequestData, sessionID: string): string
{
const account = this.saveServer.getProfile(sessionID).info;
const profile: TemplateSide =
@ -213,6 +216,8 @@ export class ProfileController
// Completed account creation
this.saveServer.getProfile(sessionID).info.wipe = false;
this.saveServer.saveProfile(sessionID);
return pmcData._id;
}
/**

View File

@ -21,6 +21,7 @@ import { IExtendOfferRequestData } from "@spt-aki/models/eft/ragfair/IExtendOffe
import { IGetItemPriceResult } from "@spt-aki/models/eft/ragfair/IGetItemPriceResult";
import { IGetMarketPriceRequestData } from "@spt-aki/models/eft/ragfair/IGetMarketPriceRequestData";
import { IGetOffersResult } from "@spt-aki/models/eft/ragfair/IGetOffersResult";
import { IGetRagfairOfferByIdRequest } from "@spt-aki/models/eft/ragfair/IGetRagfairOfferByIdRequest";
import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer";
import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData";
import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData";
@ -147,6 +148,20 @@ export class RagfairController
return result;
}
/**
* Handle client/ragfair/offer/findbyid
* @param sessionId Player id
* @param request Request data
* @returns IRagfairOffer
*/
public getOfferById(sessionId: string, request: IGetRagfairOfferByIdRequest): IRagfairOffer
{
const offers = this.ragfairOfferService.getOffers();
const offerToReturn = offers.find(x => x.intId === request.id);
return offerToReturn;
}
/**
* Get offers for the client based on type of search being performed
* @param searchRequest Client search request data

View File

@ -34,6 +34,9 @@ export class RagfairOfferGenerator
protected ragfairConfig: IRagfairConfig;
protected allowedFleaPriceItemsForBarter: { tpl: string; price: number; }[];
/** Internal counter to ensure each offer created has a unique value for its intId property */
protected offerCounter = 0;
constructor(
@inject("WinstonLogger") protected logger: ILogger,
@inject("JsonUtil") protected jsonUtil: JsonUtil,
@ -121,7 +124,7 @@ export class RagfairOfferGenerator
const offer: IRagfairOffer = {
_id: this.hashUtil.generate(),
intId: 0,
intId: this.offerCounter,
user: {
id: this.getTraderId(userID),
memberType: (userID === "ragfair")
@ -149,6 +152,8 @@ export class RagfairOfferGenerator
CurrentItemCount: itemCount,
};
this.offerCounter++;
return offer;
}

View File

@ -2,7 +2,7 @@ import { MemberCategory } from "@spt-aki/models/enums/MemberCategory";
export interface ICurrentGroupResponse
{
squad: any[];
squad: ICurrentGroupSquadMember[];
}
export interface ICurrentGroupSquadMember

View File

@ -0,0 +1,25 @@
import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"
export interface IGetGroupStatusResponse
{
players: IPlayer[]
maxPveCountExceeded: boolean
}
export interface IPlayer
{
aid: string
_id: string
lookingGroup: boolean
IsLeader: boolean
IsReady: boolean
Info: ICurrentGroupMemberInfo
}
export interface ICurrentGroupMemberInfo
{
Nickname: string;
Side: string;
Level: string;
MemberCategory: MemberCategory;
}

View File

@ -0,0 +1,4 @@
export interface ICreateProfileResponse
{
uid: string
}

View File

@ -0,0 +1,4 @@
export interface IGetRagfairOfferByIdRequest
{
id: number
}

View File

@ -11,17 +11,23 @@ export class RagfairStaticRouter extends StaticRouter
super([
new RouteAction(
"/client/ragfair/search",
// eslint-disable-next-line @typescript-eslint/no-unused-vars
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.ragfairCallbacks.search(url, info, sessionID);
},
),
new RouteAction("/client/ragfair/find", (url: string, info: any, sessionID: string, output: string): any =>
new RouteAction(
"/client/ragfair/find",
// eslint-disable-next-line @typescript-eslint/no-unused-vars
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.ragfairCallbacks.search(url, info, sessionID);
}),
},
),
new RouteAction(
"/client/ragfair/itemMarketPrice",
// eslint-disable-next-line @typescript-eslint/no-unused-vars
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.ragfairCallbacks.getMarketPrice(url, info, sessionID);
@ -29,6 +35,7 @@ export class RagfairStaticRouter extends StaticRouter
),
new RouteAction(
"/client/ragfair/offerfees",
// eslint-disable-next-line @typescript-eslint/no-unused-vars
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.ragfairCallbacks.storePlayerOfferTaxAmount(url, info, sessionID);
@ -36,15 +43,28 @@ export class RagfairStaticRouter extends StaticRouter
),
new RouteAction(
"/client/reports/ragfair/send",
// eslint-disable-next-line @typescript-eslint/no-unused-vars
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.ragfairCallbacks.sendReport(url, info, sessionID);
},
),
new RouteAction("/client/items/prices", (url: string, info: any, sessionID: string, output: string): any =>
new RouteAction(
"/client/items/prices",
// eslint-disable-next-line @typescript-eslint/no-unused-vars
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.ragfairCallbacks.getFleaPrices(url, info, sessionID);
}),
},
),
new RouteAction(
"/client/ragfair/offer/findbyid",
// eslint-disable-next-line @typescript-eslint/no-unused-vars
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.ragfairCallbacks.getFleaOfferById(url, info, sessionID);
},
),
]);
}
}