Improve accuracy of view profile

This commit is contained in:
Dev 2024-01-06 13:40:00 +00:00
parent 62dec539db
commit 4e21239de3
9 changed files with 87 additions and 22 deletions

View File

@ -141,7 +141,7 @@ export class DialogueController
dialog.Users.push({
_id: profile.characters.pmc.sessionId,
info: {
Info: {
Level: profile.characters.pmc.Info.Level,
Nickname: profile.characters.pmc.Info.Nickname,
Side: profile.characters.pmc.Info.Side,
@ -235,7 +235,7 @@ export class DialogueController
const pmcProfile = fullProfile.characters.pmc;
result.push({
_id: fullProfile.info.id,
info: {
Info: {
Nickname: pmcProfile.Info.Nickname,
Side: pmcProfile.Info.Side,
Level: pmcProfile.Info.Level,

View File

@ -21,6 +21,7 @@ import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileC
import { ISearchFriendRequestData } from "@spt-aki/models/eft/profile/ISearchFriendRequestData";
import { ISearchFriendResponse } from "@spt-aki/models/eft/profile/ISearchFriendResponse";
import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData";
import { MemberCategory } from "@spt-aki/models/enums/MemberCategory";
import { MessageType } from "@spt-aki/models/enums/MessageType";
import { QuestStatus } from "@spt-aki/models/enums/QuestStatus";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
@ -399,14 +400,41 @@ export class ProfileController
return {
id: playerPmc._id,
aid: playerPmc.aid,
info: playerPmc.Info,
customization: playerPmc.Customization,
info: {
nickname: playerPmc.Info.Nickname,
side: playerPmc.Info.Side,
experience: playerPmc.Info.Experience,
memberCategory: playerPmc.Info.MemberCategory,
bannedState: playerPmc.Info.BannedState,
bannedUntil: playerPmc.Info.BannedUntil,
registrationDate: playerPmc.Info.RegistrationDate
},
customization: {
head: playerPmc.Customization.Head,
body: playerPmc.Customization.Body,
feet: playerPmc.Customization.Feet,
hands: playerPmc.Customization.Hands
},
skills: playerPmc.Skills,
equipment: playerPmc.Inventory,
equipment: {
// Default inventory tpl
Id: playerPmc.Inventory.items.find(x => x._tpl === "55d7217a4bdc2d86028b456d")._id,
Items: playerPmc.Inventory.items
},
achievements: playerPmc.Achievements,
favoriteItems: playerPmc.Inventory.favoriteItems,
pmcStats: playerPmc.Stats,
scavStats: player.characters.scav.Stats
pmcStats: {
eft: {
totalInGameTime: playerPmc.Stats.Eft.TotalInGameTime,
overAllCounters: playerPmc.Stats.Eft.OverallCounters
}
},
scavStats: {
eft: {
totalInGameTime: player.characters.scav.Stats.Eft.TotalInGameTime,
overAllCounters: player.characters.scav.Stats.Eft.OverallCounters
}
}
};
}
}

View File

@ -34,7 +34,7 @@ export class CommandoDialogueChatBot implements IDialogueChatBot
{
return {
_id: "sptCommando",
info: { Level: 1, MemberCategory: MemberCategory.DEVELOPER, Nickname: "Commando", Side: "Usec" },
Info: { Level: 1, MemberCategory: MemberCategory.DEVELOPER, Nickname: "Commando", Side: "Usec" },
};
}

View File

@ -32,7 +32,7 @@ export class SptDialogueChatBot implements IDialogueChatBot
{
return {
_id: "sptFriend",
info: {
Info: {
Level: 1,
MemberCategory: MemberCategory.DEVELOPER,
Nickname: this.coreConfig.sptFriendNickname,

View File

@ -85,9 +85,9 @@ export class NotificationSendHelper
protected getDialog(sessionId: string, messageType: MessageType, senderDetails: IUserDialogInfo): Dialogue
{
// Use trader id if sender is trader, otherwise use nickname
const key = (senderDetails.info.MemberCategory === MemberCategory.TRADER)
const key = (senderDetails.Info.MemberCategory === MemberCategory.TRADER)
? senderDetails._id
: senderDetails.info.Nickname;
: senderDetails.Info.Nickname;
const dialogueData = this.saveServer.getProfile(sessionId).dialogues;
const isNewDialogue = !(key in dialogueData);
let dialogue: Dialogue = dialogueData[key];
@ -102,7 +102,7 @@ export class NotificationSendHelper
pinned: false,
new: 0,
attachmentsNew: 0,
Users: (senderDetails.info.MemberCategory === MemberCategory.TRADER) ? undefined : [senderDetails],
Users: (senderDetails.Info.MemberCategory === MemberCategory.TRADER) ? undefined : [senderDetails],
};
dialogueData[key] = dialogue;

View File

@ -113,7 +113,7 @@ export interface Dialogue
export interface IUserDialogInfo
{
_id: string;
info: IUserDialogDetails;
Info: IUserDialogDetails;
}
export interface IUserDialogDetails

View File

@ -1,17 +1,54 @@
import { Customization, Inventory, Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"
import { Customization, Inventory, OverallCounters, Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"
import { Info } from "types/models/eft/common/tables/IBotBase"
import { Item } from "../common/tables/IItem"
export interface IGetOtherProfileResponse
{
id: string
aid: number
info: Info
customization: Customization
info: IOtherProfileInfo
customization: IOtherProfileCustomization
skills: Skills
equipment: Inventory
equipment: IOtherProfileEquipment
achievements: Record<string, number>
favoriteItems: string[]
pmcStats: Stats
scavStats: Stats
pmcStats: IOtherProfileStats
scavStats: IOtherProfileStats
}
export interface IOtherProfileInfo
{
nickname: string
side: string
experience: number
memberCategory: number
bannedState: boolean
bannedUntil: number
registrationDate: number
}
export interface IOtherProfileCustomization
{
head: string;
body: string;
feet: string;
hands: string;
}
export interface IOtherProfileEquipment
{
Id: string;
Items: Item[];
}
export interface IOtherProfileStats
{
eft: IOtherProfileSubStats;
}
export interface IOtherProfileSubStats
{
totalInGameTime: number
overAllCounters: OverallCounters
}

View File

@ -134,7 +134,7 @@ export class GiftService
const details: ISendMessageDetails = {
recipientId: playerId,
sender: this.getMessageType(giftData),
senderDetails: { _id: this.getSenderId(giftData), info: null },
senderDetails: { _id: this.getSenderId(giftData), Info: null },
messageText: giftData.messageText,
items: giftData.items,
itemsMaxStorageLifetimeSeconds: this.timeUtil.getHoursAsSeconds(giftData.collectionTimeHours),

View File

@ -95,7 +95,7 @@ export class PmcChatResponseService
const killerDetails: IUserDialogInfo = {
_id: killerDetailsInCache._id,
info: {
Info: {
Nickname: killerDetailsInCache.Info.Nickname,
Side: killerDetailsInCache.Info.Side,
Level: killerDetailsInCache.Info.Level,
@ -273,7 +273,7 @@ export class PmcChatResponseService
];
return {
_id: pmcVictim.Name,
info: {
Info: {
Nickname: pmcVictim.Name,
Level: pmcVictim.Level,
Side: pmcVictim.Side,