using SptCommon.Annotations; using Core.Context; using Core.Helpers; using Core.Models.Eft.InRaid; using Core.Models.Spt.Config; using Core.Models.Utils; using Core.Servers; namespace Core.Controllers; [Injectable] public class InRaidController( ISptLogger _logger, ProfileHelper _profileHelper, ApplicationContext _applicationContext, ConfigServer _configServer ) { protected InRaidConfig _inRaidConfig = _configServer.GetConfig(); protected BotConfig _botConfig = _configServer.GetConfig(); /// /// Save locationId to active profiles in-raid object AND app context /// /// Session id /// Register player request public void AddPlayer(string sessionId, RegisterPlayerRequestData info) { _applicationContext.AddValue(ContextVariableType.REGISTER_PLAYER_REQUEST, info); } /// /// Handle raid/profile/scavsave /// Save profile state to disk /// Handles pmc/pscav /// /// /// public void SavePostRaidProfileForScav(ScavSaveRequestData offRaidProfileData, string sessionId) { var serverScavProfile = _profileHelper.GetScavProfile(sessionId); // If equipment match overwrite existing data from update to date raid data for scavenger screen to work correctly. // otherwise Scav inventory will be overwritten and break scav regeneration, breaking profile. if (serverScavProfile.Inventory.Equipment == offRaidProfileData.Inventory.Equipment) serverScavProfile.Inventory.Items = offRaidProfileData.Inventory.Items; } /// /// Get the inraid config from configs/inraid.json /// public InRaidConfig GetInRaidConfig() { return _inRaidConfig; } /// /// /// /// /// /// public double GetTraitorScavHostileChance(string url, string sessionId) { return _inRaidConfig.PlayerScavHostileChancePercent; } /// /// /// /// /// /// public List GetBossConvertSettings(string url, string sessionId) { return _botConfig.AssaultToBossConversion.BossesToConvertToWeights.Keys.ToList(); } }