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
|
||||
public getFriendList(sessionID: string): IGetFriendListDataResponse
|
||||
{
|
||||
// Force a fake friend called SPT into friend list
|
||||
return {
|
||||
"Friends": [
|
||||
{
|
||||
_id: "sptFriend",
|
||||
Info: {
|
||||
Level: 1,
|
||||
MemberCategory: MemberCategory.DEVELOPER,
|
||||
Nickname: "SPT",
|
||||
Side: "Usec"
|
||||
}
|
||||
}
|
||||
],
|
||||
"Friends": [this.getSptFriendData()],
|
||||
"Ignore": [],
|
||||
"InIgnoreList": []
|
||||
};
|
||||
@ -188,15 +179,7 @@ export class DialogueController
|
||||
if (request.type === MessageType.USER_MESSAGE)
|
||||
{
|
||||
profile.dialogues[request.dialogId].Users = [];
|
||||
profile.dialogues[request.dialogId].Users.push({
|
||||
_id: request.dialogId,
|
||||
info: {
|
||||
Level:1,
|
||||
Nickname: "SPT",
|
||||
Side: "Usec",
|
||||
MemberCategory: MemberCategory.DEFAULT
|
||||
}
|
||||
});
|
||||
profile.dialogues[request.dialogId].Users.push(this.getSptFriendData(request.dialogId));
|
||||
}
|
||||
}
|
||||
|
||||
@ -321,15 +304,8 @@ export class DialogueController
|
||||
|
||||
protected handleChatWithSPTFriend(sessionId: string, request: ISendMessageRequest): void
|
||||
{
|
||||
const sptFriendUser: IUserDialogInfo = {
|
||||
_id: "sptFriend",
|
||||
info: {
|
||||
Level: 1,
|
||||
MemberCategory: MemberCategory.DEVELOPER,
|
||||
Nickname: "SPT",
|
||||
Side: "Usec"
|
||||
}
|
||||
};
|
||||
const sptFriendUser = this.getSptFriendData();
|
||||
|
||||
const giftSent = this.giftService.sendGiftToPlayer(sessionId, request.text);
|
||||
|
||||
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
|
||||
* @param sessionId Session id
|
||||
|
@ -1,22 +1,8 @@
|
||||
import { MemberCategory } from "../../enums/MemberCategory";
|
||||
import { IUserDialogInfo } from "../profile/IAkiProfile";
|
||||
|
||||
export interface IGetFriendListDataResponse
|
||||
{
|
||||
Friends: Friend[]
|
||||
Friends: IUserDialogInfo[]
|
||||
Ignore: 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