2024-05-21 17:59:04 +00:00
|
|
|
import { WeatherController } from "@spt/controllers/WeatherController";
|
|
|
|
import { IEmptyRequestData } from "@spt/models/eft/common/IEmptyRequestData";
|
|
|
|
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
|
|
|
|
import { IWeatherData } from "@spt/models/eft/weather/IWeatherData";
|
2024-07-05 14:21:30 +01:00
|
|
|
import { IGetLocalWeatherResponseData } from "@spt/models/spt/weather/IGetLocalWeatherResponseData";
|
2024-07-23 11:12:53 -04:00
|
|
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
|
|
|
import { inject, injectable } from "tsyringe";
|
2023-03-03 15:23:46 +00:00
|
|
|
|
|
|
|
@injectable()
|
2024-07-23 11:12:53 -04:00
|
|
|
export class WeatherCallbacks {
|
2023-03-03 15:23:46 +00:00
|
|
|
constructor(
|
|
|
|
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
2023-11-15 20:35:05 -05:00
|
|
|
@inject("WeatherController") protected weatherController: WeatherController,
|
2024-07-23 11:12:53 -04:00
|
|
|
) {}
|
2023-03-03 15:23:46 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle client/weather
|
|
|
|
* @returns IWeatherData
|
|
|
|
*/
|
2024-07-23 11:12:53 -04:00
|
|
|
public getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IWeatherData> {
|
2023-03-03 15:23:46 +00:00
|
|
|
return this.httpResponse.getBody(this.weatherController.generate());
|
|
|
|
}
|
2024-07-05 14:21:30 +01:00
|
|
|
|
2024-10-17 00:57:33 +01:00
|
|
|
/** Handle client/localGame/weather */
|
2024-07-23 11:12:53 -04:00
|
|
|
public getLocalWeather(
|
|
|
|
url: string,
|
|
|
|
info: IEmptyRequestData,
|
|
|
|
sessionID: string,
|
|
|
|
): IGetBodyResponseData<IGetLocalWeatherResponseData> {
|
2024-07-05 14:21:30 +01:00
|
|
|
return this.httpResponse.getBody(this.weatherController.generateLocal(sessionID));
|
|
|
|
}
|
2023-11-15 20:35:05 -05:00
|
|
|
}
|