Mod init
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
var _a;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.FikaClientController = void 0;
|
||||
const tsyringe_1 = require("/snapshot/project/node_modules/tsyringe");
|
||||
const FikaConfig_1 = require("../utils/FikaConfig");
|
||||
let FikaClientController = class FikaClientController {
|
||||
fikaConfig;
|
||||
constructor(fikaConfig) {
|
||||
this.fikaConfig = fikaConfig;
|
||||
// empty
|
||||
}
|
||||
/**
|
||||
* Handle /fika/client/config
|
||||
*/
|
||||
handleClientConfig() {
|
||||
return this.fikaConfig.getConfig().client;
|
||||
}
|
||||
};
|
||||
exports.FikaClientController = FikaClientController;
|
||||
exports.FikaClientController = FikaClientController = __decorate([
|
||||
(0, tsyringe_1.injectable)(),
|
||||
__param(0, (0, tsyringe_1.inject)("FikaConfig")),
|
||||
__metadata("design:paramtypes", [typeof (_a = typeof FikaConfig_1.FikaConfig !== "undefined" && FikaConfig_1.FikaConfig) === "function" ? _a : Object])
|
||||
], FikaClientController);
|
||||
//# sourceMappingURL=FikaClientController.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"FikaClientController.js","sourceRoot":"","sources":["FikaClientController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sEAA6E;AAI7E,oDAAiD;AAG1C,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IACe;IAA5C,YAA4C,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;QAC9D,QAAQ;IACZ,CAAC;IAED;;OAEG;IACI,kBAAkB;QACrB,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC;IAC9C,CAAC;CACJ,CAAA;AAXY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,qBAAU,GAAE;IAEI,WAAA,IAAA,iBAAM,EAAC,YAAY,CAAC,CAAA;yDAAuB,uBAAU,oBAAV,uBAAU;GADzD,oBAAoB,CAWhC"}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { IFikaConfigClient } from "../models/fika/config/IFikaConfigClient";
|
||||
|
||||
import { FikaConfig } from "../utils/FikaConfig";
|
||||
|
||||
@injectable()
|
||||
export class FikaClientController {
|
||||
constructor(@inject("FikaConfig") protected fikaConfig: FikaConfig) {
|
||||
// empty
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle /fika/client/config
|
||||
*/
|
||||
public handleClientConfig(): IFikaConfigClient {
|
||||
return this.fikaConfig.getConfig().client;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
var _a, _b, _c;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.FikaDialogueController = void 0;
|
||||
const tsyringe_1 = require("/snapshot/project/node_modules/tsyringe");
|
||||
const ProfileHelper_1 = require("/snapshot/project/obj/helpers/ProfileHelper");
|
||||
const BackendErrorCodes_1 = require("/snapshot/project/obj/models/enums/BackendErrorCodes");
|
||||
const FikaFriendRequestsHelper_1 = require("../helpers/FikaFriendRequestsHelper");
|
||||
const FikaPlayerRelationsHelper_1 = require("../helpers/FikaPlayerRelationsHelper");
|
||||
let FikaDialogueController = class FikaDialogueController {
|
||||
dialogueChatBots;
|
||||
profileHelper;
|
||||
fikaFriendRequestsHelper;
|
||||
fikaPlayerRelationsHelper;
|
||||
constructor(dialogueChatBots, profileHelper, fikaFriendRequestsHelper, fikaPlayerRelationsHelper) {
|
||||
this.dialogueChatBots = dialogueChatBots;
|
||||
this.profileHelper = profileHelper;
|
||||
this.fikaFriendRequestsHelper = fikaFriendRequestsHelper;
|
||||
this.fikaPlayerRelationsHelper = fikaPlayerRelationsHelper;
|
||||
// empty
|
||||
}
|
||||
getFriendList(sessionID) {
|
||||
const botsAndFriends = this.dialogueChatBots.map((v) => v.getChatBot());
|
||||
const friendsIds = this.fikaPlayerRelationsHelper.getFriendsList(sessionID);
|
||||
for (const friendId of friendsIds) {
|
||||
const profile = this.profileHelper.getPmcProfile(friendId);
|
||||
botsAndFriends.push({
|
||||
_id: profile._id,
|
||||
aid: profile.aid,
|
||||
Info: {
|
||||
Nickname: profile.Info.Nickname,
|
||||
Level: profile.Info.Level,
|
||||
Side: profile.Info.Side,
|
||||
MemberCategory: profile.Info.MemberCategory,
|
||||
},
|
||||
});
|
||||
}
|
||||
return {
|
||||
Friends: botsAndFriends,
|
||||
Ignore: this.fikaPlayerRelationsHelper.getIgnoreList(sessionID),
|
||||
InIgnoreList: this.fikaPlayerRelationsHelper.getInIgnoreList(sessionID),
|
||||
};
|
||||
}
|
||||
listOutbox(sessionID) {
|
||||
const sentFriendRequests = this.fikaFriendRequestsHelper.getSentFriendRequests(sessionID);
|
||||
for (const sentFriendRequest of sentFriendRequests) {
|
||||
const profile = this.profileHelper.getPmcProfile(sentFriendRequest.to);
|
||||
sentFriendRequest.profile = {
|
||||
_id: profile._id,
|
||||
aid: profile.aid,
|
||||
Info: {
|
||||
Nickname: profile.Info.Nickname,
|
||||
Side: profile.Info.Side,
|
||||
Level: profile.Info.Level,
|
||||
MemberCategory: profile.Info.MemberCategory,
|
||||
},
|
||||
};
|
||||
}
|
||||
return sentFriendRequests;
|
||||
}
|
||||
listInbox(sessionID) {
|
||||
const receivedFriendRequests = this.fikaFriendRequestsHelper.getReceivedFriendRequests(sessionID);
|
||||
for (const receivedFriendRequest of receivedFriendRequests) {
|
||||
const profile = this.profileHelper.getPmcProfile(receivedFriendRequest.from);
|
||||
receivedFriendRequest.profile = {
|
||||
_id: profile._id,
|
||||
aid: profile.aid,
|
||||
Info: {
|
||||
Nickname: profile.Info.Nickname,
|
||||
Side: profile.Info.Side,
|
||||
Level: profile.Info.Level,
|
||||
MemberCategory: profile.Info.MemberCategory,
|
||||
},
|
||||
};
|
||||
}
|
||||
return receivedFriendRequests;
|
||||
}
|
||||
sendFriendRequest(from, to) {
|
||||
this.fikaFriendRequestsHelper.addFriendRequest(from, to);
|
||||
return {
|
||||
status: BackendErrorCodes_1.BackendErrorCodes.NONE,
|
||||
requestId: from,
|
||||
retryAfter: 0,
|
||||
};
|
||||
}
|
||||
acceptAllFriendRequests(sessionID) {
|
||||
const receivedFriendRequests = this.fikaFriendRequestsHelper.getReceivedFriendRequests(sessionID);
|
||||
for (const friendRequest of receivedFriendRequests) {
|
||||
this.acceptFriendRequest(friendRequest.from, friendRequest.to);
|
||||
}
|
||||
}
|
||||
acceptFriendRequest(from, to) {
|
||||
this.fikaFriendRequestsHelper.removeFriendRequest(from, to);
|
||||
this.fikaPlayerRelationsHelper.addFriend(from, to);
|
||||
}
|
||||
cancelFriendRequest(from, to) {
|
||||
this.fikaFriendRequestsHelper.removeFriendRequest(from, to);
|
||||
}
|
||||
declineFriendRequest(from, to) {
|
||||
this.cancelFriendRequest(from, to);
|
||||
}
|
||||
deleteFriend(fromId, friendId) {
|
||||
this.fikaPlayerRelationsHelper.removeFriend(fromId, friendId);
|
||||
}
|
||||
ignoreFriend(fromId, friendId) {
|
||||
this.fikaPlayerRelationsHelper.addToIgnoreList(fromId, friendId);
|
||||
}
|
||||
unIgnoreFriend(fromId, friendId) {
|
||||
this.fikaPlayerRelationsHelper.removeFromIgnoreList(fromId, friendId);
|
||||
}
|
||||
};
|
||||
exports.FikaDialogueController = FikaDialogueController;
|
||||
exports.FikaDialogueController = FikaDialogueController = __decorate([
|
||||
(0, tsyringe_1.injectable)(),
|
||||
__param(0, (0, tsyringe_1.injectAll)("DialogueChatBot")),
|
||||
__param(1, (0, tsyringe_1.inject)("ProfileHelper")),
|
||||
__param(2, (0, tsyringe_1.inject)("FikaFriendRequestsHelper")),
|
||||
__param(3, (0, tsyringe_1.inject)("FikaPlayerRelationsHelper")),
|
||||
__metadata("design:paramtypes", [Array, typeof (_a = typeof ProfileHelper_1.ProfileHelper !== "undefined" && ProfileHelper_1.ProfileHelper) === "function" ? _a : Object, typeof (_b = typeof FikaFriendRequestsHelper_1.FikaFriendRequestsHelper !== "undefined" && FikaFriendRequestsHelper_1.FikaFriendRequestsHelper) === "function" ? _b : Object, typeof (_c = typeof FikaPlayerRelationsHelper_1.FikaPlayerRelationsHelper !== "undefined" && FikaPlayerRelationsHelper_1.FikaPlayerRelationsHelper) === "function" ? _c : Object])
|
||||
], FikaDialogueController);
|
||||
//# sourceMappingURL=FikaDialogueController.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"FikaDialogueController.js","sourceRoot":"","sources":["FikaDialogueController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sEAAwF;AAGxF,+EAA4E;AAG5E,4FAAyF;AAEzF,kFAA+E;AAC/E,oFAAiF;AAI1E,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAEa;IACL;IACW;IACC;IAJnD,YAC4C,gBAAoC,EACzC,aAA4B,EACjB,wBAAkD,EACjD,yBAAoD;QAH3D,qBAAgB,GAAhB,gBAAgB,CAAoB;QACzC,kBAAa,GAAb,aAAa,CAAe;QACjB,6BAAwB,GAAxB,wBAAwB,CAA0B;QACjD,8BAAyB,GAAzB,yBAAyB,CAA2B;QAEnG,QAAQ;IACZ,CAAC;IAEM,aAAa,CAAC,SAAiB;QAClC,MAAM,cAAc,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC;QAExE,MAAM,UAAU,GAAG,IAAI,CAAC,yBAAyB,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QAE5E,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE,CAAC;YAChC,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;YAE3D,cAAc,CAAC,IAAI,CAAC;gBAChB,GAAG,EAAE,OAAO,CAAC,GAAG;gBAChB,GAAG,EAAE,OAAO,CAAC,GAAG;gBAChB,IAAI,EAAE;oBACF,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,QAAQ;oBAC/B,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK;oBACzB,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI;oBACvB,cAAc,EAAE,OAAO,CAAC,IAAI,CAAC,cAAc;iBAC9C;aACJ,CAAC,CAAC;QACP,C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C,CAAC;IAEM,YAAY,CAAC,MAAc,EAAE,QAAgB;QAChD,IAAI,CAAC,yBAAyB,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAClE,CAAC;IAEM,YAAY,CAAC,MAAc,EAAE,QAAgB;QAChD,IAAI,CAAC,yBAAyB,CAAC,eAAe,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACrE,CAAC;IAEM,cAAc,CAAC,MAAc,EAAE,QAAgB;QAClD,IAAI,CAAC,yBAAyB,CAAC,oBAAoB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC1E,CAAC;CACJ,CAAA;AA1HY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,qBAAU,GAAE;IAGJ,WAAA,IAAA,oBAAS,EAAC,iBAAiB,CAAC,CAAA;IAC5B,WAAA,IAAA,iBAAM,EAAC,eAAe,CAAC,CAAA;IACvB,WAAA,IAAA,iBAAM,EAAC,0BAA0B,CAAC,CAAA;IAClC,WAAA,IAAA,iBAAM,EAAC,2BAA2B,CAAC,CAAA;gEAFc,6BAAa,oBAAb,6BAAa,oDACS,mDAAwB,oBAAxB,mDAAwB,oDACtB,qDAAyB,oBAAzB,qDAAyB;GAL9F,sBAAsB,CA0HlC"}
|
||||
@@ -0,0 +1,136 @@
|
||||
import { inject, injectAll, injectable } from "tsyringe";
|
||||
|
||||
import { IDialogueChatBot } from "@spt-aki/helpers/Dialogue/IDialogueChatBot";
|
||||
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
|
||||
import { IFriendRequestSendResponse } from "@spt-aki/models/eft/dialog/IFriendRequestSendResponse";
|
||||
import { IGetFriendListDataResponse } from "@spt-aki/models/eft/dialog/IGetFriendListDataResponse";
|
||||
import { BackendErrorCodes } from "@spt-aki/models/enums/BackendErrorCodes";
|
||||
|
||||
import { FikaFriendRequestsHelper } from "../helpers/FikaFriendRequestsHelper";
|
||||
import { FikaPlayerRelationsHelper } from "../helpers/FikaPlayerRelationsHelper";
|
||||
import { IFriendRequestListResponse } from "../models/eft/dialog/IFriendRequestListResponse";
|
||||
|
||||
@injectable()
|
||||
export class FikaDialogueController {
|
||||
constructor(
|
||||
@injectAll("DialogueChatBot") protected dialogueChatBots: IDialogueChatBot[],
|
||||
@inject("ProfileHelper") protected profileHelper: ProfileHelper,
|
||||
@inject("FikaFriendRequestsHelper") protected fikaFriendRequestsHelper: FikaFriendRequestsHelper,
|
||||
@inject("FikaPlayerRelationsHelper") protected fikaPlayerRelationsHelper: FikaPlayerRelationsHelper,
|
||||
) {
|
||||
// empty
|
||||
}
|
||||
|
||||
public getFriendList(sessionID: string): IGetFriendListDataResponse {
|
||||
const botsAndFriends = this.dialogueChatBots.map((v) => v.getChatBot());
|
||||
|
||||
const friendsIds = this.fikaPlayerRelationsHelper.getFriendsList(sessionID);
|
||||
|
||||
for (const friendId of friendsIds) {
|
||||
const profile = this.profileHelper.getPmcProfile(friendId);
|
||||
|
||||
botsAndFriends.push({
|
||||
_id: profile._id,
|
||||
aid: profile.aid,
|
||||
Info: {
|
||||
Nickname: profile.Info.Nickname,
|
||||
Level: profile.Info.Level,
|
||||
Side: profile.Info.Side,
|
||||
MemberCategory: profile.Info.MemberCategory,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
Friends: botsAndFriends,
|
||||
Ignore: this.fikaPlayerRelationsHelper.getIgnoreList(sessionID),
|
||||
InIgnoreList: this.fikaPlayerRelationsHelper.getInIgnoreList(sessionID),
|
||||
};
|
||||
}
|
||||
|
||||
public listOutbox(sessionID: string): IFriendRequestListResponse[] {
|
||||
const sentFriendRequests = this.fikaFriendRequestsHelper.getSentFriendRequests(sessionID) as IFriendRequestListResponse[];
|
||||
|
||||
for (const sentFriendRequest of sentFriendRequests) {
|
||||
const profile = this.profileHelper.getPmcProfile(sentFriendRequest.to);
|
||||
|
||||
sentFriendRequest.profile = {
|
||||
_id: profile._id,
|
||||
aid: profile.aid,
|
||||
Info: {
|
||||
Nickname: profile.Info.Nickname,
|
||||
Side: profile.Info.Side,
|
||||
Level: profile.Info.Level,
|
||||
MemberCategory: profile.Info.MemberCategory,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return sentFriendRequests;
|
||||
}
|
||||
|
||||
public listInbox(sessionID: string): IFriendRequestListResponse[] {
|
||||
const receivedFriendRequests = this.fikaFriendRequestsHelper.getReceivedFriendRequests(sessionID) as IFriendRequestListResponse[];
|
||||
|
||||
for (const receivedFriendRequest of receivedFriendRequests) {
|
||||
const profile = this.profileHelper.getPmcProfile(receivedFriendRequest.from);
|
||||
|
||||
receivedFriendRequest.profile = {
|
||||
_id: profile._id,
|
||||
aid: profile.aid,
|
||||
Info: {
|
||||
Nickname: profile.Info.Nickname,
|
||||
Side: profile.Info.Side,
|
||||
Level: profile.Info.Level,
|
||||
MemberCategory: profile.Info.MemberCategory,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return receivedFriendRequests;
|
||||
}
|
||||
|
||||
public sendFriendRequest(from: string, to: string): IFriendRequestSendResponse {
|
||||
this.fikaFriendRequestsHelper.addFriendRequest(from, to);
|
||||
|
||||
return {
|
||||
status: BackendErrorCodes.NONE,
|
||||
requestId: from,
|
||||
retryAfter: 0,
|
||||
};
|
||||
}
|
||||
|
||||
public acceptAllFriendRequests(sessionID: string): void {
|
||||
const receivedFriendRequests = this.fikaFriendRequestsHelper.getReceivedFriendRequests(sessionID);
|
||||
|
||||
for (const friendRequest of receivedFriendRequests) {
|
||||
this.acceptFriendRequest(friendRequest.from, friendRequest.to);
|
||||
}
|
||||
}
|
||||
|
||||
public acceptFriendRequest(from: string, to: string): void {
|
||||
this.fikaFriendRequestsHelper.removeFriendRequest(from, to);
|
||||
|
||||
this.fikaPlayerRelationsHelper.addFriend(from, to);
|
||||
}
|
||||
|
||||
public cancelFriendRequest(from: string, to: string): void {
|
||||
this.fikaFriendRequestsHelper.removeFriendRequest(from, to);
|
||||
}
|
||||
|
||||
public declineFriendRequest(from: string, to: string): void {
|
||||
this.cancelFriendRequest(from, to);
|
||||
}
|
||||
|
||||
public deleteFriend(fromId: string, friendId: string): void {
|
||||
this.fikaPlayerRelationsHelper.removeFriend(fromId, friendId);
|
||||
}
|
||||
|
||||
public ignoreFriend(fromId: string, friendId: string): void {
|
||||
this.fikaPlayerRelationsHelper.addToIgnoreList(fromId, friendId);
|
||||
}
|
||||
|
||||
public unIgnoreFriend(fromId: string, friendId: string): void {
|
||||
this.fikaPlayerRelationsHelper.removeFromIgnoreList(fromId, friendId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
var _a;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.FikaLocationController = void 0;
|
||||
const tsyringe_1 = require("/snapshot/project/node_modules/tsyringe");
|
||||
const FikaMatchService_1 = require("../services/FikaMatchService");
|
||||
let FikaLocationController = class FikaLocationController {
|
||||
fikaMatchService;
|
||||
constructor(fikaMatchService) {
|
||||
this.fikaMatchService = fikaMatchService;
|
||||
// empty
|
||||
}
|
||||
/**
|
||||
* Handle /fika/location/raids
|
||||
* @param request
|
||||
* @returns
|
||||
*/
|
||||
handleGetRaids(_request) {
|
||||
const matches = [];
|
||||
for (const [matchId, match] of this.fikaMatchService.getAllMatches()) {
|
||||
matches.push({
|
||||
serverId: matchId,
|
||||
hostUsername: match.hostUsername,
|
||||
playerCount: match.players.size,
|
||||
status: match.status,
|
||||
location: match.raidConfig.location,
|
||||
side: match.side,
|
||||
time: match.time,
|
||||
});
|
||||
}
|
||||
return matches;
|
||||
}
|
||||
};
|
||||
exports.FikaLocationController = FikaLocationController;
|
||||
exports.FikaLocationController = FikaLocationController = __decorate([
|
||||
(0, tsyringe_1.injectable)(),
|
||||
__param(0, (0, tsyringe_1.inject)("FikaMatchService")),
|
||||
__metadata("design:paramtypes", [typeof (_a = typeof FikaMatchService_1.FikaMatchService !== "undefined" && FikaMatchService_1.FikaMatchService) === "function" ? _a : Object])
|
||||
], FikaLocationController);
|
||||
//# sourceMappingURL=FikaLocationController.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"FikaLocationController.js","sourceRoot":"","sources":["FikaLocationController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sEAA6E;AAK7E,mEAAgE;AAGzD,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IACmB;IAAlD,YAAkD,gBAAkC;QAAlC,qBAAgB,GAAhB,gBAAgB,CAAkB;QAChF,QAAQ;IACZ,CAAC;IAED;;;;OAIG;IACI,cAAc,CAAC,QAA0C;QAC5D,MAAM,OAAO,GAAuB,EAAE,CAAC;QAEvC,KAAK,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,gBAAgB,CAAC,aAAa,EAAE,EAAE,CAAC;YACnE,OAAO,CAAC,IAAI,CAAC;gBACT,QAAQ,EAAE,OAAO;gBACjB,YAAY,EAAE,KAAK,CAAC,YAAY;gBAChC,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI;gBAC/B,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC,QAAQ;gBACnC,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,IAAI,EAAE,KAAK,CAAC,IAAI;aACnB,CAAC,CAAC;QACP,CAAC;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ,CAAA;AA3BY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,qBAAU,GAAE;IAEI,WAAA,IAAA,iBAAM,EAAC,kBAAkB,CAAC,CAAA;yDAA6B,mCAAgB,oBAAhB,mCAAgB;GAD3E,sBAAsB,CA2BlC"}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData";
|
||||
|
||||
import { IFikaRaidsResponse } from "../models/fika/routes/location/IFikaRaidsResponse";
|
||||
import { FikaMatchService } from "../services/FikaMatchService";
|
||||
|
||||
@injectable()
|
||||
export class FikaLocationController {
|
||||
constructor(@inject("FikaMatchService") protected fikaMatchService: FikaMatchService) {
|
||||
// empty
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle /fika/location/raids
|
||||
* @param request
|
||||
* @returns
|
||||
*/
|
||||
public handleGetRaids(_request: IGetRaidConfigurationRequestData): IFikaRaidsResponse {
|
||||
const matches: IFikaRaidsResponse = [];
|
||||
|
||||
for (const [matchId, match] of this.fikaMatchService.getAllMatches()) {
|
||||
matches.push({
|
||||
serverId: matchId,
|
||||
hostUsername: match.hostUsername,
|
||||
playerCount: match.players.size,
|
||||
status: match.status,
|
||||
location: match.raidConfig.location,
|
||||
side: match.side,
|
||||
time: match.time,
|
||||
});
|
||||
}
|
||||
|
||||
return matches;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
var _a;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.FikaRaidController = void 0;
|
||||
const tsyringe_1 = require("/snapshot/project/node_modules/tsyringe");
|
||||
const FikaMatchEndSessionMessages_1 = require("../models/enums/FikaMatchEndSessionMessages");
|
||||
const FikaMatchService_1 = require("../services/FikaMatchService");
|
||||
let FikaRaidController = class FikaRaidController {
|
||||
fikaMatchService;
|
||||
constructor(fikaMatchService) {
|
||||
this.fikaMatchService = fikaMatchService;
|
||||
// empty
|
||||
}
|
||||
/**
|
||||
* Handle /fika/raid/create
|
||||
* @param request
|
||||
*/
|
||||
handleRaidCreate(request) {
|
||||
return {
|
||||
success: this.fikaMatchService.createMatch(request),
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Handle /fika/raid/join
|
||||
* @param request
|
||||
*/
|
||||
handleRaidJoin(request) {
|
||||
this.fikaMatchService.addPlayerToMatch(request.serverId, request.profileId, { groupId: null, isDead: false });
|
||||
const match = this.fikaMatchService.getMatch(request.serverId);
|
||||
return {
|
||||
serverId: request.serverId,
|
||||
timestamp: match.timestamp,
|
||||
expectedNumberOfPlayers: match.expectedNumberOfPlayers,
|
||||
gameVersion: match.gameVersion,
|
||||
fikaVersion: match.fikaVersion,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Handle /fika/raid/leave
|
||||
* @param request
|
||||
*/
|
||||
handleRaidLeave(request) {
|
||||
if (request.serverId === request.profileId) {
|
||||
this.fikaMatchService.endMatch(request.serverId, FikaMatchEndSessionMessages_1.FikaMatchEndSessionMessage.HOST_SHUTDOWN_MESSAGE);
|
||||
return;
|
||||
}
|
||||
this.fikaMatchService.removePlayerFromMatch(request.serverId, request.profileId);
|
||||
}
|
||||
/**
|
||||
* Handle /fika/raid/gethost
|
||||
* @param request
|
||||
*/
|
||||
handleRaidGethost(request) {
|
||||
const match = this.fikaMatchService.getMatch(request.serverId);
|
||||
if (!match) {
|
||||
return;
|
||||
}
|
||||
return {
|
||||
ip: match.ip,
|
||||
port: match.port,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Handle /fika/raid/spawnpoint
|
||||
* @param request
|
||||
*/
|
||||
handleRaidSpawnpoint(request) {
|
||||
const match = this.fikaMatchService.getMatch(request.serverId);
|
||||
if (!match) {
|
||||
return;
|
||||
}
|
||||
return {
|
||||
spawnpoint: match.spawnPoint,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Handle /fika/raid/getsettings
|
||||
* @param request
|
||||
*/
|
||||
handleRaidGetSettings(request) {
|
||||
const match = this.fikaMatchService.getMatch(request.serverId);
|
||||
if (!match) {
|
||||
return;
|
||||
}
|
||||
return {
|
||||
metabolismDisabled: match.raidConfig.metabolismDisabled,
|
||||
playersSpawnPlace: match.raidConfig.playersSpawnPlace
|
||||
};
|
||||
}
|
||||
};
|
||||
exports.FikaRaidController = FikaRaidController;
|
||||
exports.FikaRaidController = FikaRaidController = __decorate([
|
||||
(0, tsyringe_1.injectable)(),
|
||||
__param(0, (0, tsyringe_1.inject)("FikaMatchService")),
|
||||
__metadata("design:paramtypes", [typeof (_a = typeof FikaMatchService_1.FikaMatchService !== "undefined" && FikaMatchService_1.FikaMatchService) === "function" ? _a : Object])
|
||||
], FikaRaidController);
|
||||
//# sourceMappingURL=FikaRaidController.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"FikaRaidController.js","sourceRo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AC;IACrF,CAAC;IAED;;;OAGG;IACI,iBAAiB,CAAC,OAAqC;QAC1D,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC/D,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,OAAO;QACX,CAAC;QAED,OAAO;YACH,EAAE,EAAE,KAAK,CAAC,EAAE;YACZ,IAAI,EAAE,KAAK,CAAC,IAAI;SACnB,CAAC;IACN,CAAC;IAED;;;OAGG;IACI,oBAAoB,CAAC,OAAqC;QAC7D,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC/D,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,OAAO;QACX,CAAC;QAED,OAAO;YACH,UAAU,EAAE,KAAK,CAAC,UAAU;SAC/B,CAAC;IACN,CAAC;IAED;;;OAGG;IACI,qBAAqB,CAAC,OAAqC;QAC9D,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC/D,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,OAAO;QACX,CAAC;QAED,OAAO;YACH,kBAAkB,EAAE,KAAK,CAAC,UAAU,CAAC,kBAAkB;YACvD,iBAAiB,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB;SACxD,CAAC;IACN,CAAC;CACJ,CAAA;AA5FY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,qBAAU,GAAE;IAEI,WAAA,IAAA,iBAAM,EAAC,kBAAkB,CAAC,CAAA;yDAA6B,mCAAgB,oBAAhB,mCAAgB;GAD3E,kBAAkB,CA4F9B"}
|
||||
@@ -0,0 +1,108 @@
|
||||
import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { FikaMatchEndSessionMessage } from "../models/enums/FikaMatchEndSessionMessages";
|
||||
import { IFikaRaidServerIdRequestData } from "../models/fika/routes/raid/IFikaRaidServerIdRequestData";
|
||||
import { IFikaRaidCreateRequestData } from "../models/fika/routes/raid/create/IFikaRaidCreateRequestData";
|
||||
import { IFikaRaidCreateResponse } from "../models/fika/routes/raid/create/IFikaRaidCreateResponse";
|
||||
import { IFikaRaidGethostResponse } from "../models/fika/routes/raid/gethost/IFikaRaidGethostResponse";
|
||||
import { IFikaRaidJoinRequestData } from "../models/fika/routes/raid/join/IFikaRaidJoinRequestData";
|
||||
import { IFikaRaidJoinResponse } from "../models/fika/routes/raid/join/IFikaRaidJoinResponse";
|
||||
import { IFikaRaidLeaveRequestData } from "../models/fika/routes/raid/leave/IFikaRaidLeaveRequestData";
|
||||
import { IFikaRaidSpawnpointResponse } from "../models/fika/routes/raid/spawnpoint/IFikaRaidSpawnpointResponse";
|
||||
import { IFikaRaidSettingsResponse } from "../models/fika/routes/raid/getsettings/IFikaRaidSettingsResponse";
|
||||
import { FikaMatchService } from "../services/FikaMatchService";
|
||||
|
||||
@injectable()
|
||||
export class FikaRaidController {
|
||||
constructor(@inject("FikaMatchService") protected fikaMatchService: FikaMatchService) {
|
||||
// empty
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle /fika/raid/create
|
||||
* @param request
|
||||
*/
|
||||
public handleRaidCreate(request: IFikaRaidCreateRequestData): IFikaRaidCreateResponse {
|
||||
return {
|
||||
success: this.fikaMatchService.createMatch(request),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle /fika/raid/join
|
||||
* @param request
|
||||
*/
|
||||
public handleRaidJoin(request: IFikaRaidJoinRequestData): IFikaRaidJoinResponse {
|
||||
this.fikaMatchService.addPlayerToMatch(request.serverId, request.profileId, { groupId: null, isDead: false });
|
||||
|
||||
const match = this.fikaMatchService.getMatch(request.serverId);
|
||||
|
||||
return {
|
||||
serverId: request.serverId,
|
||||
timestamp: match.timestamp,
|
||||
expectedNumberOfPlayers: match.expectedNumberOfPlayers,
|
||||
gameVersion: match.gameVersion,
|
||||
fikaVersion: match.fikaVersion,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle /fika/raid/leave
|
||||
* @param request
|
||||
*/
|
||||
public handleRaidLeave(request: IFikaRaidLeaveRequestData): void {
|
||||
if (request.serverId === request.profileId) {
|
||||
this.fikaMatchService.endMatch(request.serverId, FikaMatchEndSessionMessage.HOST_SHUTDOWN_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
||||
this.fikaMatchService.removePlayerFromMatch(request.serverId, request.profileId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle /fika/raid/gethost
|
||||
* @param request
|
||||
*/
|
||||
public handleRaidGethost(request: IFikaRaidServerIdRequestData): IFikaRaidGethostResponse {
|
||||
const match = this.fikaMatchService.getMatch(request.serverId);
|
||||
if (!match) {
|
||||
return;
|
||||
}
|
||||
|
||||
return {
|
||||
ip: match.ip,
|
||||
port: match.port,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle /fika/raid/spawnpoint
|
||||
* @param request
|
||||
*/
|
||||
public handleRaidSpawnpoint(request: IFikaRaidServerIdRequestData): IFikaRaidSpawnpointResponse {
|
||||
const match = this.fikaMatchService.getMatch(request.serverId);
|
||||
if (!match) {
|
||||
return;
|
||||
}
|
||||
|
||||
return {
|
||||
spawnpoint: match.spawnPoint,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle /fika/raid/getsettings
|
||||
* @param request
|
||||
*/
|
||||
public handleRaidGetSettings(request: IFikaRaidServerIdRequestData): IFikaRaidSettingsResponse {
|
||||
const match = this.fikaMatchService.getMatch(request.serverId);
|
||||
if (!match) {
|
||||
return;
|
||||
}
|
||||
|
||||
return {
|
||||
metabolismDisabled: match.raidConfig.metabolismDisabled,
|
||||
playersSpawnPlace: match.raidConfig.playersSpawnPlace
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.FikaSendItemController = void 0;
|
||||
const tsyringe_1 = require("/snapshot/project/node_modules/tsyringe");
|
||||
const InventoryHelper_1 = require("/snapshot/project/obj/helpers/InventoryHelper");
|
||||
const ItemHelper_1 = require("/snapshot/project/obj/helpers/ItemHelper");
|
||||
const ILogger_1 = require("/snapshot/project/obj/models/spt/utils/ILogger");
|
||||
const EventOutputHolder_1 = require("/snapshot/project/obj/routers/EventOutputHolder");
|
||||
const SaveServer_1 = require("/snapshot/project/obj/servers/SaveServer");
|
||||
const MailSendService_1 = require("/snapshot/project/obj/services/MailSendService");
|
||||
const HttpResponseUtil_1 = require("/snapshot/project/obj/utils/HttpResponseUtil");
|
||||
const FikaConfig_1 = require("../utils/FikaConfig");
|
||||
let FikaSendItemController = class FikaSendItemController {
|
||||
logger;
|
||||
eventOutputHolder;
|
||||
mailSendService;
|
||||
inventoryHelper;
|
||||
saveServer;
|
||||
itemHelper;
|
||||
httpResponse;
|
||||
fikaConfig;
|
||||
constructor(logger, eventOutputHolder, mailSendService, inventoryHelper, saveServer, itemHelper, httpResponse, fikaConfig) {
|
||||
this.logger = logger;
|
||||
this.eventOutputHolder = eventOutputHolder;
|
||||
this.mailSendService = mailSendService;
|
||||
this.inventoryHelper = inventoryHelper;
|
||||
this.saveServer = saveServer;
|
||||
this.itemHelper = itemHelper;
|
||||
this.httpResponse = httpResponse;
|
||||
this.fikaConfig = fikaConfig;
|
||||
// empty
|
||||
}
|
||||
sendItem(_pmcData, body, sessionID) {
|
||||
const fikaConfig = this.fikaConfig.getConfig();
|
||||
const output = this.eventOutputHolder.getOutput(sessionID);
|
||||
if (!body || !body.id || !body.target) {
|
||||
return this.httpResponse.appendErrorToOutput(output, "Missing data in body");
|
||||
}
|
||||
const senderProfile = this.saveServer.getProfile(sessionID);
|
||||
if (!senderProfile) {
|
||||
return this.httpResponse.appendErrorToOutput(output, "Sender profile not found");
|
||||
}
|
||||
// Disabled until functionality is required due to being buggy
|
||||
// if (senderProfile.inraid.location != "none") {
|
||||
// return this.httpResponse.appendErrorToOutput(
|
||||
// output,
|
||||
// `You cannot send items while in raid, current state is: ${senderProfile.inraid.location}`
|
||||
// );
|
||||
// }
|
||||
const targetProfile = this.saveServer.getProfile(body.target);
|
||||
if (!targetProfile) {
|
||||
return this.httpResponse.appendErrorToOutput(output, "Target profile not found");
|
||||
}
|
||||
this.logger.info(`${body.id} is going to sessionID: ${body.target}`);
|
||||
const senderItems = senderProfile.characters.pmc.Inventory.items;
|
||||
const itemsToSend = this.itemHelper.findAndReturnChildrenAsItems(senderItems, body.id);
|
||||
if (!itemsToSend || itemsToSend.length === 0) {
|
||||
return this.httpResponse.appendErrorToOutput(output, "Item not found in inventory");
|
||||
}
|
||||
if (fikaConfig.server.giftedItemsLoseFIR) {
|
||||
for (const item of itemsToSend) {
|
||||
item.upd ??= {};
|
||||
item.upd.SpawnedInSession = false;
|
||||
}
|
||||
}
|
||||
this.mailSendService.sendUserMessageToPlayer(body.target, {
|
||||
_id: senderProfile.info.id,
|
||||
aid: senderProfile.info.aid,
|
||||
Info: {
|
||||
Nickname: senderProfile.info.username,
|
||||
Side: senderProfile.characters.pmc.Info.Side,
|
||||
Level: senderProfile.characters.pmc.Info.Level,
|
||||
MemberCategory: senderProfile.characters.pmc.Info.MemberCategory,
|
||||
},
|
||||
}, `You have received a gift from ${senderProfile.info.username}`, itemsToSend);
|
||||
this.inventoryHelper.removeItem(senderProfile.characters.pmc, body.id, sessionID, output);
|
||||
return output;
|
||||
}
|
||||
/**
|
||||
* Get available receivers for sending an item
|
||||
* @param sessionID
|
||||
* @returns
|
||||
*/
|
||||
handleAvailableReceivers(sessionID) {
|
||||
const sender = this.saveServer.getProfile(sessionID);
|
||||
if (!sender) {
|
||||
return;
|
||||
}
|
||||
const result = {};
|
||||
const profiles = this.saveServer.getProfiles();
|
||||
for (const profile of Object.values(profiles)) {
|
||||
const username = profile.info.username;
|
||||
if (!(username in result) && username !== sender.info.username) {
|
||||
result[username] = profile.info.id;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
exports.FikaSendItemController = FikaSendItemController;
|
||||
exports.FikaSendItemController = FikaSendItemController = __decorate([
|
||||
(0, tsyringe_1.injectable)(),
|
||||
__param(0, (0, tsyringe_1.inject)("WinstonLogger")),
|
||||
__param(1, (0, tsyringe_1.inject)("EventOutputHolder")),
|
||||
__param(2, (0, tsyringe_1.inject)("MailSendService")),
|
||||
__param(3, (0, tsyringe_1.inject)("InventoryHelper")),
|
||||
__param(4, (0, tsyringe_1.inject)("SaveServer")),
|
||||
__param(5, (0, tsyringe_1.inject)("ItemHelper")),
|
||||
__param(6, (0, tsyringe_1.inject)("HttpResponseUtil")),
|
||||
__param(7, (0, tsyringe_1.inject)("FikaConfig")),
|
||||
__metadata("design:paramtypes", [typeof (_a = typeof ILogger_1.ILogger !== "undefined" && ILogger_1.ILogger) === "function" ? _a : Object, typeof (_b = typeof EventOutputHolder_1.EventOutputHolder !== "undefined" && EventOutputHolder_1.EventOutputHolder) === "function" ? _b : Object, typeof (_c = typeof MailSendService_1.MailSendService !== "undefined" && MailSendService_1.MailSendService) === "function" ? _c : Object, typeof (_d = typeof InventoryHelper_1.InventoryHelper !== "undefined" && InventoryHelper_1.InventoryHelper) === "function" ? _d : Object, typeof (_e = typeof SaveServer_1.SaveServer !== "undefined" && SaveServer_1.SaveServer) === "function" ? _e : Object, typeof (_f = typeof ItemHelper_1.ItemHelper !== "undefined" && ItemHelper_1.ItemHelper) === "function" ? _f : Object, typeof (_g = typeof HttpResponseUtil_1.HttpResponseUtil !== "undefined" && HttpResponseUtil_1.HttpResponseUtil) === "function" ? _g : Object, typeof (_h = typeof FikaConfig_1.FikaConfig !== "undefined" && FikaConfig_1.FikaConfig) === "function" ? _h : Object])
|
||||
], FikaSendItemController);
|
||||
//# sourceMappingURL=FikaSendItemController.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"FikaSendItemController.js","sourceRoot":"","sources":["FikaSendItemController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sEAA6E;AAE7E,mFAAgF;AAChF,yEAAsE;AAKtE,4EAAyE;AACzE,uFAAoF;AACpF,yEAAsE;AACtE,oFAAiF;AACjF,mFAAgF;AAIhF,oDAAiD;AAG1C,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAEQ;IACI;IACF;IACA;IACL;IACA;IACM;IACN;IARpC,YACuC,MAAe,EACX,iBAAoC,EACtC,eAAgC,EAChC,eAAgC,EACrC,UAAsB,EACtB,UAAsB,EAChB,YAA8B,EACpC,UAAsB;QAPnB,WAAM,GAAN,MAAM,CAAS;QACX,sBAAiB,GAAjB,iBAAiB,CAAmB;QACtC,oBAAe,GAAf,eAAe,CAAiB;QAChC,oBAAe,GAAf,eAAe,CAAiB;QACrC,eAAU,GAAV,UAAU,CAAY;QACtB,eAAU,GAAV,UAAU,CAAY;QAChB,iBAAY,GAAZ,YAAY,CAAkB;QACpC,eAAU,GAAV,UAAU,CAAY;QAEtD,QAAQ;IACZ,CAAC;IAEM,QAAQ,CAAC,QAAkB,EAAE,IAA8B,EAAE,S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|
||||
@@ -0,0 +1,121 @@
|
||||
import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper";
|
||||
import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
|
||||
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
|
||||
import { Item } from "@spt-aki/models/eft/common/tables/IItem";
|
||||
import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse";
|
||||
import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile";
|
||||
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
||||
import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder";
|
||||
import { SaveServer } from "@spt-aki/servers/SaveServer";
|
||||
import { MailSendService } from "@spt-aki/services/MailSendService";
|
||||
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
|
||||
|
||||
import { IFikaSendItemRequestData } from "../models/fika/routes/senditem/IFikaSendItemRequestData";
|
||||
import { IFikaSenditemAvailablereceiversResponse } from "../models/fika/routes/senditem/availablereceivers/IFikaSenditemAvailablereceiversResponse";
|
||||
import { FikaConfig } from "../utils/FikaConfig";
|
||||
|
||||
@injectable()
|
||||
export class FikaSendItemController {
|
||||
constructor(
|
||||
@inject("WinstonLogger") protected logger: ILogger,
|
||||
@inject("EventOutputHolder") protected eventOutputHolder: EventOutputHolder,
|
||||
@inject("MailSendService") protected mailSendService: MailSendService,
|
||||
@inject("InventoryHelper") protected inventoryHelper: InventoryHelper,
|
||||
@inject("SaveServer") protected saveServer: SaveServer,
|
||||
@inject("ItemHelper") protected itemHelper: ItemHelper,
|
||||
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
||||
@inject("FikaConfig") protected fikaConfig: FikaConfig,
|
||||
) {
|
||||
// empty
|
||||
}
|
||||
|
||||
public sendItem(_pmcData: IPmcData, body: IFikaSendItemRequestData, sessionID: string): IItemEventRouterResponse {
|
||||
const fikaConfig = this.fikaConfig.getConfig();
|
||||
const output = this.eventOutputHolder.getOutput(sessionID);
|
||||
|
||||
if (!body || !body.id || !body.target) {
|
||||
return this.httpResponse.appendErrorToOutput(output, "Missing data in body");
|
||||
}
|
||||
|
||||
const senderProfile: IAkiProfile = this.saveServer.getProfile(sessionID);
|
||||
if (!senderProfile) {
|
||||
return this.httpResponse.appendErrorToOutput(output, "Sender profile not found");
|
||||
}
|
||||
|
||||
// Disabled until functionality is required due to being buggy
|
||||
|
||||
// if (senderProfile.inraid.location != "none") {
|
||||
// return this.httpResponse.appendErrorToOutput(
|
||||
// output,
|
||||
// `You cannot send items while in raid, current state is: ${senderProfile.inraid.location}`
|
||||
// );
|
||||
// }
|
||||
|
||||
const targetProfile: IAkiProfile = this.saveServer.getProfile(body.target);
|
||||
if (!targetProfile) {
|
||||
return this.httpResponse.appendErrorToOutput(output, "Target profile not found");
|
||||
}
|
||||
|
||||
this.logger.info(`${body.id} is going to sessionID: ${body.target}`);
|
||||
|
||||
const senderItems: Item[] = senderProfile.characters.pmc.Inventory.items;
|
||||
const itemsToSend: Item[] = this.itemHelper.findAndReturnChildrenAsItems(senderItems, body.id);
|
||||
if (!itemsToSend || itemsToSend.length === 0) {
|
||||
return this.httpResponse.appendErrorToOutput(output, "Item not found in inventory");
|
||||
}
|
||||
|
||||
if (fikaConfig.server.giftedItemsLoseFIR) {
|
||||
for (const item of itemsToSend) {
|
||||
item.upd ??= {};
|
||||
|
||||
item.upd.SpawnedInSession = false;
|
||||
}
|
||||
}
|
||||
|
||||
this.mailSendService.sendUserMessageToPlayer(
|
||||
body.target,
|
||||
{
|
||||
_id: senderProfile.info.id,
|
||||
aid: senderProfile.info.aid,
|
||||
Info: {
|
||||
Nickname: senderProfile.info.username,
|
||||
Side: senderProfile.characters.pmc.Info.Side,
|
||||
Level: senderProfile.characters.pmc.Info.Level,
|
||||
MemberCategory: senderProfile.characters.pmc.Info.MemberCategory,
|
||||
},
|
||||
},
|
||||
`You have received a gift from ${senderProfile.info.username}`,
|
||||
itemsToSend,
|
||||
);
|
||||
|
||||
this.inventoryHelper.removeItem(senderProfile.characters.pmc, body.id, sessionID, output);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get available receivers for sending an item
|
||||
* @param sessionID
|
||||
* @returns
|
||||
*/
|
||||
public handleAvailableReceivers(sessionID: string): IFikaSenditemAvailablereceiversResponse {
|
||||
const sender: IAkiProfile = this.saveServer.getProfile(sessionID);
|
||||
if (!sender) {
|
||||
return;
|
||||
}
|
||||
|
||||
const result: Record<string, string> = {};
|
||||
const profiles = this.saveServer.getProfiles();
|
||||
|
||||
for (const profile of Object.values(profiles)) {
|
||||
const username = profile.info.username;
|
||||
if (!(username in result) && username !== sender.info.username) {
|
||||
result[username] = profile.info.id;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
var _a;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.FikaUpdateController = void 0;
|
||||
const tsyringe_1 = require("/snapshot/project/node_modules/tsyringe");
|
||||
const FikaMatchService_1 = require("../services/FikaMatchService");
|
||||
let FikaUpdateController = class FikaUpdateController {
|
||||
fikaMatchService;
|
||||
constructor(fikaMatchService) {
|
||||
this.fikaMatchService = fikaMatchService;
|
||||
// empty
|
||||
}
|
||||
/**
|
||||
* Handle /fika/update/ping
|
||||
* @param request
|
||||
*/
|
||||
handlePing(request) {
|
||||
this.fikaMatchService.resetTimeout(request.serverId);
|
||||
}
|
||||
/**
|
||||
* Handle /fika/update/spawnpoint
|
||||
* @param request
|
||||
*/
|
||||
handleSpawnpoint(request) {
|
||||
this.fikaMatchService.setMatchSpawnPoint(request.serverId, request.name);
|
||||
}
|
||||
/**
|
||||
* Handle /fika/update/playerspawn
|
||||
* @param request
|
||||
*/
|
||||
handlePlayerspawn(request) {
|
||||
this.fikaMatchService.setPlayerGroup(request.serverId, request.profileId, request.groupId);
|
||||
}
|
||||
/**
|
||||
* Handle /fika/update/sethost
|
||||
* @param request
|
||||
*/
|
||||
handleSethost(request) {
|
||||
this.fikaMatchService.setMatchHost(request.serverId, request.ip, request.port);
|
||||
}
|
||||
/**
|
||||
* Handle /fika/update/setstatus
|
||||
* @param request
|
||||
*/
|
||||
handleSetStatus(request) {
|
||||
this.fikaMatchService.setMatchStatus(request.serverId, request.status);
|
||||
}
|
||||
};
|
||||
exports.FikaUpdateController = FikaUpdateController;
|
||||
exports.FikaUpdateController = FikaUpdateController = __decorate([
|
||||
(0, tsyringe_1.injectable)(),
|
||||
__param(0, (0, tsyringe_1.inject)("FikaMatchService")),
|
||||
__metadata("design:paramtypes", [typeof (_a = typeof FikaMatchService_1.FikaMatchService !== "undefined" && FikaMatchService_1.FikaMatchService) === "function" ? _a : Object])
|
||||
], FikaUpdateController);
|
||||
//# sourceMappingURL=FikaUpdateController.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"FikaUpdateController.js","sourceRoot":"","sources":["FikaUpdateController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sEAA6E;AAO7E,mEAAgE;AAGzD,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IACqB;IAAlD,YAAkD,gBAAkC;QAAlC,qBAAgB,GAAhB,gBAAgB,CAAkB;QAChF,QAAQ;IACZ,CAAC;IAED;;;OAGG;IACI,UAAU,CAAC,OAAmC;QACjD,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACzD,CAAC;IAED;;;OAGG;IACI,gBAAgB,CAAC,OAAyC;QAC7D,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7E,CAAC;IAED;;;OAGG;IACI,iBAAiB,CAAC,OAA0C;QAC/D,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/F,CAAC;IAED;;;OAGG;IACI,aAAa,CAAC,OAAsC;QACvD,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACnF,CAAC;IAED;;;OAGG;IACI,eAAe,CAAC,OAAwC;QAC3D,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3E,CAAC;CACJ,CAAA;AA5CY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,qBAAU,GAAE;IAEI,WAAA,IAAA,iBAAM,EAAC,kBAAkB,CAAC,CAAA;yDAA6B,mCAAgB,oBAAhB,mCAAgB;GAD3E,oBAAoB,CA4ChC"}
|
||||
@@ -0,0 +1,55 @@
|
||||
import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { IFikaUpdatePingRequestData } from "../models/fika/routes/update/IFikaUpdatePingRequestData";
|
||||
import { IFikaUpdatePlayerspawnRequestData } from "../models/fika/routes/update/IFikaUpdatePlayerspawnRequestData";
|
||||
import { IFikaUpdateSetStatusRequestData } from "../models/fika/routes/update/IFikaUpdateSetStatusRequestData";
|
||||
import { IFikaUpdateSethostRequestData } from "../models/fika/routes/update/IFikaUpdateSethostRequestData";
|
||||
import { IFikaUpdateSpawnpointRequestData } from "../models/fika/routes/update/IFikaUpdateSpawnpointRequestData";
|
||||
import { FikaMatchService } from "../services/FikaMatchService";
|
||||
|
||||
@injectable()
|
||||
export class FikaUpdateController {
|
||||
constructor(@inject("FikaMatchService") protected fikaMatchService: FikaMatchService) {
|
||||
// empty
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle /fika/update/ping
|
||||
* @param request
|
||||
*/
|
||||
public handlePing(request: IFikaUpdatePingRequestData): void {
|
||||
this.fikaMatchService.resetTimeout(request.serverId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle /fika/update/spawnpoint
|
||||
* @param request
|
||||
*/
|
||||
public handleSpawnpoint(request: IFikaUpdateSpawnpointRequestData): void {
|
||||
this.fikaMatchService.setMatchSpawnPoint(request.serverId, request.name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle /fika/update/playerspawn
|
||||
* @param request
|
||||
*/
|
||||
public handlePlayerspawn(request: IFikaUpdatePlayerspawnRequestData): void {
|
||||
this.fikaMatchService.setPlayerGroup(request.serverId, request.profileId, request.groupId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle /fika/update/sethost
|
||||
* @param request
|
||||
*/
|
||||
public handleSethost(request: IFikaUpdateSethostRequestData): void {
|
||||
this.fikaMatchService.setMatchHost(request.serverId, request.ip, request.port);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle /fika/update/setstatus
|
||||
* @param request
|
||||
*/
|
||||
public handleSetStatus(request: IFikaUpdateSetStatusRequestData): void {
|
||||
this.fikaMatchService.setMatchStatus(request.serverId, request.status);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user