diff --git a/Libraries/SPTarkov.Server.Core/Controllers/InventoryController.cs b/Libraries/SPTarkov.Server.Core/Controllers/InventoryController.cs index c54e01ae..6b08d590 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/InventoryController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/InventoryController.cs @@ -7,7 +7,6 @@ using SPTarkov.Server.Core.Models.Eft.Inventory; using SPTarkov.Server.Core.Models.Eft.ItemEvent; using SPTarkov.Server.Core.Models.Eft.Profile; using SPTarkov.Server.Core.Models.Enums; -using SPTarkov.Server.Core.Models.Spt.Dialog; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Routers; using SPTarkov.Server.Core.Services; @@ -177,26 +176,26 @@ public class InventoryController( var mail = dialog.Messages.FirstOrDefault(message => message.Id == rewardEvent.MessageId); var mailEvent = mail.ProfileChangeEvents.FirstOrDefault(changeEvent => changeEvent.Id == rewardEvent.EventId); - + switch (mailEvent.Type) { - case ProfileChangeEventType.TraderSalesSum: + case "TraderSalesSum": pmcData.TradersInfo[mailEvent.Entity].SalesSum = mailEvent.Value; _traderHelper.LevelUp(mailEvent.Entity, pmcData); _logger.Success($"Set trader {mailEvent.Entity}: Sales Sum to: {mailEvent.Value}"); break; - case ProfileChangeEventType.TraderStanding: + case "TraderStanding": pmcData.TradersInfo[mailEvent.Entity].Standing = mailEvent.Value; _traderHelper.LevelUp(mailEvent.Entity, pmcData); _logger.Success($"Set trader {mailEvent.Entity}: Standing to: {mailEvent.Value}"); break; - case ProfileChangeEventType.ProfileLevel: + case "ProfileLevel": pmcData.Info.Experience = (int) mailEvent.Value.Value; // Will calculate level below _traderHelper.ValidateTraderStandingsAndPlayerLevelForProfile(sessionId); _logger.Success($"Set profile xp to: {mailEvent.Value}"); break; - case ProfileChangeEventType.SkillPoints: + case "SkillPoints": { var profileSkill = pmcData.Skills.Common.FirstOrDefault(x => x.Id == mailEvent.Entity); if (profileSkill is null) @@ -209,7 +208,7 @@ public class InventoryController( _logger.Success($"Set profile skill: {mailEvent.Entity} to: {mailEvent.Value}"); break; } - case ProfileChangeEventType.ExamineAllItems: + case "ExamineAllItems": { var itemsToInspect = _itemHelper.GetItems().Where(x => x.Type != "Node"); FlagItemsAsInspectedAndRewardXp(itemsToInspect.Select(x => x.Id), fullProfile); @@ -217,18 +216,18 @@ public class InventoryController( break; } - case ProfileChangeEventType.UnlockTrader: + case "UnlockTrader": pmcData.TradersInfo[mailEvent.Entity].Unlocked = true; _logger.Success($"Trader {mailEvent.Entity} Unlocked"); break; - case ProfileChangeEventType.AssortmentUnlockRule: + case "AssortmentUnlockRule": fullProfile.SptData.BlacklistedItemTemplates ??= []; fullProfile.SptData.BlacklistedItemTemplates.Add(mailEvent.Entity); _logger.Success($"Item {mailEvent.Entity} is now blacklisted"); break; - case ProfileChangeEventType.HideoutAreaLevel: + case "HideoutAreaLevel": { var areaName = mailEvent.Entity; var newValue = mailEvent.Value; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.cs index c6a91603..ed18a4d6 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.cs @@ -4,6 +4,7 @@ using SPTarkov.Server.Core.Helpers.Dialog.Commando.SptCommands; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.Dialog; using SPTarkov.Server.Core.Models.Eft.Profile; +using SPTarkov.Server.Core.Models.Eft.Ws; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Spt.Dialog; using SPTarkov.Server.Core.Models.Utils; @@ -152,7 +153,7 @@ public class ProfileSptCommand( var profileChangeEvent = new ProfileChangeEvent { Id = _hashUtil.Generate(), - Type = ProfileChangeEventType.SkillPoints, + Type = "SkillPoints", Value = level * 100, Entity = skill.ToString() }; @@ -165,7 +166,7 @@ public class ProfileSptCommand( var profileChangeEvent = new ProfileChangeEvent { Id = _hashUtil.Generate(), - Type = ProfileChangeEventType.ProfileLevel, + Type = "ProfileLevel", Value = exp, Entity = null }; @@ -177,7 +178,7 @@ public class ProfileSptCommand( var profileChangeEvent = new ProfileChangeEvent { Id = _hashUtil.Generate(), - Type = ProfileChangeEventType.ExamineAllItems, + Type = "ExamineAllItems", Value = null, Entity = null }; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.cs index 23d6d95b..15c57a14 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.cs @@ -4,6 +4,7 @@ using SPTarkov.Server.Core.Helpers.Dialog.Commando.SptCommands; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.Dialog; using SPTarkov.Server.Core.Models.Eft.Profile; +using SPTarkov.Server.Core.Models.Eft.Ws; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Spt.Dialog; using SPTarkov.Server.Core.Models.Utils; @@ -64,15 +65,15 @@ public class TraderSptCommand( return request.DialogId; } - ProfileChangeEventType profileChangeEventType; + NotificationEventType profileChangeEventType; switch (command) { case "rep": quantity /= 100; - profileChangeEventType = ProfileChangeEventType.TraderStanding; + profileChangeEventType = NotificationEventType.TraderStanding; break; case "spend": - profileChangeEventType = ProfileChangeEventType.TraderSalesSum; + profileChangeEventType = NotificationEventType.TraderSalesSum; break; default: { @@ -109,12 +110,12 @@ public class TraderSptCommand( return request.DialogId; } - protected ProfileChangeEvent CreateProfileChangeEvent(ProfileChangeEventType profileChangeEventType, int quantity, string dbTraderId) + protected ProfileChangeEvent CreateProfileChangeEvent(NotificationEventType profileChangeEventType, int quantity, string dbTraderId) { return new ProfileChangeEvent { Id = _hashUtil.Generate(), - Type = profileChangeEventType, + Type = profileChangeEventType.ToString(), Value = quantity, Entity = dbTraderId }; diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Dialog/SendMessageDetails.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Dialog/SendMessageDetails.cs index 887e1af6..685c2605 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Dialog/SendMessageDetails.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Dialog/SendMessageDetails.cs @@ -1,8 +1,8 @@ using System.Text.Json.Serialization; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.Profile; +using SPTarkov.Server.Core.Models.Eft.Ws; using SPTarkov.Server.Core.Models.Enums; -using SPTarkov.Server.Core.Utils.Json.Converters; namespace SPTarkov.Server.Core.Models.Spt.Dialog; @@ -155,7 +155,7 @@ public record ProfileChangeEvent } [JsonPropertyName("Type")] - public ProfileChangeEventType? Type + public string Type { get; set; @@ -182,16 +182,3 @@ public record ProfileChangeEvent set; } } - -[EftEnumConverter] -public enum ProfileChangeEventType -{ - TraderSalesSum, - TraderStanding, - ProfileLevel, - SkillPoints, - ExamineAllItems, - UnlockTrader, - AssortmentUnlockRule, - HideoutAreaLevel -}