mirror of
https://github.com/sp-tarkov/server.git
synced 2025-02-13 09:10:43 -05:00
Clean up sptFriend generation code - reduce duplication
This commit is contained in:
parent
c5332986eb
commit
f4047489eb
@ -50,18 +50,9 @@ export class DialogueController
|
|||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
public getFriendList(sessionID: string): IGetFriendListDataResponse
|
public getFriendList(sessionID: string): IGetFriendListDataResponse
|
||||||
{
|
{
|
||||||
|
// Force a fake friend called SPT into friend list
|
||||||
return {
|
return {
|
||||||
"Friends": [
|
"Friends": [this.getSptFriendData()],
|
||||||
{
|
|
||||||
_id: "sptFriend",
|
|
||||||
Info: {
|
|
||||||
Level: 1,
|
|
||||||
MemberCategory: MemberCategory.DEVELOPER,
|
|
||||||
Nickname: "SPT",
|
|
||||||
Side: "Usec"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"Ignore": [],
|
"Ignore": [],
|
||||||
"InIgnoreList": []
|
"InIgnoreList": []
|
||||||
};
|
};
|
||||||
@ -188,15 +179,7 @@ export class DialogueController
|
|||||||
if (request.type === MessageType.USER_MESSAGE)
|
if (request.type === MessageType.USER_MESSAGE)
|
||||||
{
|
{
|
||||||
profile.dialogues[request.dialogId].Users = [];
|
profile.dialogues[request.dialogId].Users = [];
|
||||||
profile.dialogues[request.dialogId].Users.push({
|
profile.dialogues[request.dialogId].Users.push(this.getSptFriendData(request.dialogId));
|
||||||
_id: request.dialogId,
|
|
||||||
info: {
|
|
||||||
Level:1,
|
|
||||||
Nickname: "SPT",
|
|
||||||
Side: "Usec",
|
|
||||||
MemberCategory: MemberCategory.DEFAULT
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,15 +304,8 @@ export class DialogueController
|
|||||||
|
|
||||||
protected handleChatWithSPTFriend(sessionId: string, request: ISendMessageRequest): void
|
protected handleChatWithSPTFriend(sessionId: string, request: ISendMessageRequest): void
|
||||||
{
|
{
|
||||||
const sptFriendUser: IUserDialogInfo = {
|
const sptFriendUser = this.getSptFriendData();
|
||||||
_id: "sptFriend",
|
|
||||||
info: {
|
|
||||||
Level: 1,
|
|
||||||
MemberCategory: MemberCategory.DEVELOPER,
|
|
||||||
Nickname: "SPT",
|
|
||||||
Side: "Usec"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const giftSent = this.giftService.sendGiftToPlayer(sessionId, request.text);
|
const giftSent = this.giftService.sendGiftToPlayer(sessionId, request.text);
|
||||||
|
|
||||||
if (giftSent === GiftSentResult.SUCCESS)
|
if (giftSent === GiftSentResult.SUCCESS)
|
||||||
@ -353,6 +329,19 @@ export class DialogueController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected getSptFriendData(friendId = "sptFriend"): IUserDialogInfo
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
_id: friendId,
|
||||||
|
info: {
|
||||||
|
Level: 1,
|
||||||
|
MemberCategory: MemberCategory.DEVELOPER,
|
||||||
|
Nickname: "SPT",
|
||||||
|
Side: "Usec"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get messages from a specific dialog that have items not expired
|
* Get messages from a specific dialog that have items not expired
|
||||||
* @param sessionId Session id
|
* @param sessionId Session id
|
||||||
|
@ -1,22 +1,8 @@
|
|||||||
import { MemberCategory } from "../../enums/MemberCategory";
|
import { IUserDialogInfo } from "../profile/IAkiProfile";
|
||||||
|
|
||||||
export interface IGetFriendListDataResponse
|
export interface IGetFriendListDataResponse
|
||||||
{
|
{
|
||||||
Friends: Friend[]
|
Friends: IUserDialogInfo[]
|
||||||
Ignore: string[]
|
Ignore: string[]
|
||||||
InIgnoreList: string[]
|
InIgnoreList: string[]
|
||||||
}
|
|
||||||
|
|
||||||
export interface Friend
|
|
||||||
{
|
|
||||||
_id: string
|
|
||||||
Info: Info
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Info
|
|
||||||
{
|
|
||||||
Nickname: string
|
|
||||||
Side: string
|
|
||||||
Level: number
|
|
||||||
MemberCategory: MemberCategory
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user