Server/project/src/services/MatchLocationService.ts
TheSparta 418d9f2a8f Import path alias on the whole project (!157)
- Ability to use @spt-aki path alias on the whole project.
- Swapped all imports from relative paths, for imports using the path alias.

Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/157
Co-authored-by: TheSparta <thesparta@noreply.dev.sp-tarkov.com>
Co-committed-by: TheSparta <thesparta@noreply.dev.sp-tarkov.com>
2023-10-19 17:21:17 +00:00

59 lines
1.6 KiB
TypeScript

import { inject, injectable } from "tsyringe";
import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData";
import { TimeUtil } from "@spt-aki/utils/TimeUtil";
@injectable()
export class MatchLocationService
{
protected locations = {};
constructor(
@inject("TimeUtil") protected timeUtil: TimeUtil
)
{ }
public createGroup(sessionID: string, info: ICreateGroupRequestData): any
{
const groupID = "test";
this.locations[info.location].groups[groupID] = {
"_id": groupID,
"owner": `pmc${sessionID}`,
"location": info.location,
"gameVersion": "live",
"region": "EUR",
"status": "wait",
"isSavage": false,
"timeShift": "CURR",
"dt": this.timeUtil.getTimestamp(),
"players": [
{
"_id": `pmc${sessionID}`,
"region": "EUR",
"ip": "127.0.0.1",
"savageId": `scav${sessionID}`,
"accessKeyId": ""
}
],
"customDataCenter": []
};
return this.locations[info.location].groups[groupID];
}
public deleteGroup(info: any): void
{
for (const locationID in this.locations)
{
for (const groupID in this.locations[locationID].groups)
{
if (groupID === info.groupId)
{
delete this.locations[locationID].groups[groupID];
return;
}
}
}
}
}