using SPTarkov.DI.Annotations;
using SPTarkov.Server.Core.Generators;
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Eft.Weather;
using SPTarkov.Server.Core.Models.Enums;
using SPTarkov.Server.Core.Models.Spt.Weather;
using SPTarkov.Server.Core.Services;
namespace SPTarkov.Server.Core.Controllers;
[Injectable]
public class WeatherController(
WeatherGenerator weatherGenerator,
SeasonalEventService seasonalEventService,
RaidWeatherService raidWeatherService
)
{
///
/// Handle client/weather
///
/// WeatherData
public WeatherData Generate()
{
var result = new WeatherData
{
Acceleration = 0,
Time = string.Empty,
Date = string.Empty,
Weather = null,
Season = Season.AUTUMN,
};
weatherGenerator.CalculateGameTime(result);
result.Weather = weatherGenerator.GenerateWeather(result.Season.Value);
return result;
}
///
/// Handle client/localGame/weather
///
/// Session/Player id
/// GetLocalWeatherResponseData
public GetLocalWeatherResponseData GenerateLocal(MongoId sessionId)
{
var result = new GetLocalWeatherResponseData { Season = seasonalEventService.GetActiveWeatherSeason(), Weather = [] };
result.Weather.AddRange(raidWeatherService.GetUpcomingWeather());
return result;
}
}