using Core.Context; using Core.Helpers; using Core.Models.Eft.InRaid; using Core.Models.Spt.Config; using Core.Models.Utils; using Core.Servers; using SptCommon.Annotations; namespace Core.Controllers; [Injectable] public class InRaidController( ISptLogger _logger, ProfileHelper _profileHelper, ApplicationContext _applicationContext, ConfigServer _configServer ) { protected BotConfig _botConfig = _configServer.GetConfig(); protected InRaidConfig _inRaidConfig = _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 /// /// /// Session/Player id 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; } /// /// Handle singleplayer/scav/traitorscavhostile /// Get a % chance a scav will be hostile to the player when they're also a scav /// /// /// Session/Player id /// % chance scav is hostile to player public double GetTraitorScavHostileChance(string url, string sessionId) { return _inRaidConfig.PlayerScavHostileChancePercent; } /// /// Get all boss role types e.g. bossTagilla /// /// /// Session/Player id /// string array of boss types public List GetBossTypes(string url, string sessionId) { return _botConfig.Bosses; } }