This commit is contained in:
Alex
2025-01-11 18:07:07 +00:00
44 changed files with 1573 additions and 482 deletions
+21 -7
View File
@@ -1,13 +1,27 @@
using Core.Models.Eft.Common;
using Core.Controllers;
using Core.Models.Eft.Common;
using Core.Models.Eft.HttpResponse;
using Core.Models.Eft.Profile;
using Core.Utils;
namespace Core.Callbacks;
public class AchievementCallbacks
{
public AchievementCallbacks()
protected AchievementController _achievementController;
protected ProfileController _profileController;
protected HttpResponseUtil _httpResponseUtil;
public AchievementCallbacks
(
AchievementController achievementController,
ProfileController profileController,
HttpResponseUtil httpResponseUtil
)
{
_achievementController = achievementController;
_profileController = profileController;
_httpResponseUtil = httpResponseUtil;
}
/// <summary>
@@ -17,9 +31,9 @@ public class AchievementCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<GetAchievementsResponse> GetAchievements(string url, EmptyRequestData info, string sessionID)
public string GetAchievements(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_achievementController.GetAchievements(sessionID));
}
/// <summary>
@@ -29,8 +43,8 @@ public class AchievementCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<CompletedAchievementsResponse> Statistic(string url, EmptyRequestData info, string sessionID)
public string Statistic(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_achievementController.GetAchievementStatics(sessionID));
}
}
}
+42 -12
View File
@@ -1,14 +1,32 @@
using Core.Models.Eft.Bot;
using Core.Annotations;
using Core.Context;
using Core.Controllers;
using Core.Models.Eft.Bot;
using Core.Models.Eft.Common;
using Core.Models.Eft.Common.Tables;
using Core.Models.Eft.HttpResponse;
using Core.Models.Eft.Match;
using Core.Utils;
namespace Core.Callbacks;
[Injectable]
public class BotCallbacks
{
public BotCallbacks()
protected BotController _botController;
protected HttpResponseUtil _httpResponseUtil;
protected ApplicationContext _applicationContext;
public BotCallbacks
(
BotController botController,
HttpResponseUtil httpResponseUtil,
ApplicationContext applicationContext
)
{
_botController = botController;
_httpResponseUtil = httpResponseUtil;
_applicationContext = applicationContext;
}
/// <summary>
@@ -22,7 +40,9 @@ public class BotCallbacks
/// <exception cref="NotImplementedException"></exception>
public string GetBotLimit(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
var splitUrl = url.Split('/');
var type = splitUrl[splitUrl.Length - 1];
return _httpResponseUtil.NoBody(_botController.GetBotPresetGenerationLimit(type));
}
/// <summary>
@@ -34,7 +54,15 @@ public class BotCallbacks
/// <returns></returns>
public string GetBotDifficulty(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
var splitUrl = url.Split('/');
var type = splitUrl[splitUrl.Length - 2].ToLower();
var difficulty = splitUrl[splitUrl.Length - 1];
if (difficulty == "core")
return _httpResponseUtil.NoBody(_botController.GetBotCoreDifficulty());
var raidConfig = (GetRaidConfigurationRequestData)_applicationContext.GetLatestValue(ContextVariableType.RAID_CONFIGURATION)?.Value;
return _httpResponseUtil.NoBody(_botController.GetBotDifficulty(type, difficulty, raidConfig));
}
/// <summary>
@@ -44,9 +72,9 @@ public class BotCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public Dictionary<string, Difficulties> GetAllBotDifficulties(string url, EmptyRequestData info, string sessionID)
public string GetAllBotDifficulties(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.NoBody(_botController.GetAllBotDifficulties());
}
/// <summary>
@@ -56,18 +84,20 @@ public class BotCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<List<BotBase>> GenerateBots(string url, GenerateBotsRequestData info, string sessionID)
public string GenerateBots(string url, GenerateBotsRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_botController.Generate(sessionID, info));
}
/// <summary>
/// Handle singleplayer/settings/bot/maxCap
/// </summary>
/// <returns></returns>
public string GetBotCap()
public string GetBotCap(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
var splitUrl = url.Split('/');
var location = splitUrl[splitUrl.Length - 1];
return _httpResponseUtil.NoBody(_botController.GetBotCap(location));
}
/// <summary>
@@ -76,6 +106,6 @@ public class BotCallbacks
/// <returns></returns>
public string GetBotBehaviours()
{
throw new NotImplementedException();
return _httpResponseUtil.NoBody(_botController.GetAiBotBrainTypes());
}
}
}
+30 -13
View File
@@ -1,15 +1,28 @@
using Core.Models.Eft.Builds;
using Core.Annotations;
using Core.Controllers;
using Core.Models.Eft.Builds;
using Core.Models.Eft.Common;
using Core.Models.Eft.HttpResponse;
using Core.Models.Eft.PresetBuild;
using Core.Models.Eft.Profile;
using Core.Utils;
namespace Core.Callbacks;
[Injectable]
public class BuildsCallbacks
{
public BuildsCallbacks()
protected HttpResponseUtil _httpResponseUtil;
protected BuildController _buildController;
public BuildsCallbacks
(
HttpResponseUtil httpResponseUtil,
BuildController buildController
)
{
_httpResponseUtil = httpResponseUtil;
_buildController = buildController;
}
/// <summary>
@@ -19,9 +32,9 @@ public class BuildsCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<UserBuilds> GetBuilds(string url, EmptyRequestData info, string sessionID)
public string GetBuilds(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_buildController.GetUserBuilds(sessionID));
}
/// <summary>
@@ -31,9 +44,10 @@ public class BuildsCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public NullResponseData CreateMagazineTemplate(string url, SetMagazineRequest info, string sessionID)
public string CreateMagazineTemplate(string url, SetMagazineRequest info, string sessionID)
{
throw new NotImplementedException();
_buildController.CreateMagazineTemplate(sessionID, info);
return _httpResponseUtil.NullResponse();
}
/// <summary>
@@ -43,9 +57,10 @@ public class BuildsCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public NullResponseData SetWeapon(string url, PresetBuildActionRequestData info, string sessionID)
public string SetWeapon(string url, PresetBuildActionRequestData info, string sessionID)
{
throw new NotImplementedException();
_buildController.SaveWeaponBuild(sessionID, info);
return _httpResponseUtil.NullResponse();
}
/// <summary>
@@ -55,9 +70,10 @@ public class BuildsCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public NullResponseData SetEquipment(string url, PresetBuildActionRequestData info, string sessionID)
public string SetEquipment(string url, PresetBuildActionRequestData info, string sessionID)
{
throw new NotImplementedException();
_buildController.SaveEquipmentBuild(sessionID, info);
return _httpResponseUtil.NullResponse();
}
/// <summary>
@@ -67,8 +83,9 @@ public class BuildsCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public NullResponseData DeleteBuild(string url, RemoveBuildRequestData info, string sessionID)
public string DeleteBuild(string url, RemoveBuildRequestData info, string sessionID)
{
throw new NotImplementedException();
_buildController.RemoveBuild(sessionID, info);
return _httpResponseUtil.NullResponse();
}
}
}
+22 -4
View File
@@ -1,13 +1,30 @@
using Core.Models.Spt.Config;
using Core.Annotations;
using Core.Models.Enums;
using Core.Models.Spt.Config;
using Core.Servers;
using Core.Utils;
namespace Core.Callbacks;
[Injectable]
public class BundleCallbacks
{
private HttpConfig _httpConfig;
protected HttpResponseUtil _httpResponseUtil;
// protected BundleLoader _bundleLoader; TODO: this needs implementing
protected ConfigServer _configServer;
protected HttpConfig _httpConfig;
public BundleCallbacks()
public BundleCallbacks
(
HttpResponseUtil httpResponseUtil,
// BundleLoader bundleLoader,
ConfigServer configServer
)
{
_httpResponseUtil = httpResponseUtil;
// _bundleLoader = bundleLoader;
_configServer = configServer;
_httpConfig = configServer.GetConfig<HttpConfig>(ConfigTypes.HTTP);
}
/// <summary>
@@ -19,6 +36,7 @@ public class BundleCallbacks
/// <returns></returns>
public string GetBundles(string url, object info, string sessionID)
{
// return _httpResponseUtil.NoBody(_bundleLoader.GetBundles());
throw new NotImplementedException();
}
@@ -26,4 +44,4 @@ public class BundleCallbacks
{
return "BUNDLE";
}
}
}
+56 -7
View File
@@ -1,12 +1,38 @@
using Core.Models.Eft.HttpResponse;
using Core.Annotations;
using Core.Controllers;
using Core.Models.Eft.HttpResponse;
using Core.Models.Enums;
using Core.Models.Spt.Config;
using Core.Models.Spt.Logging;
using Core.Servers;
using Core.Services;
using Core.Utils;
namespace Core.Callbacks;
[Injectable]
public class ClientLogCallbacks
{
public ClientLogCallbacks()
protected HttpResponseUtil _httpResponseUtil;
protected ClientLogController _clientLogController;
protected ConfigServer _configServer;
protected LocalisationService _localisationService;
// protected ModLoadOrder _modLoadOrder; // TODO: needs implementing
public ClientLogCallbacks
(
HttpResponseUtil httpResponseUtil,
ClientLogController clientLogController,
ConfigServer configServer,
LocalisationService localisationService
// ModLoadOrder modLoadOrder
)
{
_httpResponseUtil = httpResponseUtil;
_clientLogController = clientLogController;
_configServer = configServer;
_localisationService = localisationService;
// _modLoadOrder = modLoadOrder;
}
/// <summary>
@@ -16,9 +42,10 @@ public class ClientLogCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public NullResponseData ClientLog(string url, ClientLogRequest info, string sessionID)
public string ClientLog(string url, ClientLogRequest info, string sessionID)
{
throw new NotImplementedException();
_clientLogController.ClientLog(info);
return _httpResponseUtil.NullResponse();
}
/// <summary>
@@ -27,7 +54,28 @@ public class ClientLogCallbacks
/// <returns></returns>
public string ReleaseNotes()
{
throw new NotImplementedException();
var data = _configServer.GetConfig<CoreConfig>(ConfigTypes.CORE).Release;
// data.betaDisclaimerText = ProgramStatics.MODS
// ? this.localisationService.getText("release-beta-disclaimer-mods-enabled")
// : this.localisationService.getText("release-beta-disclaimer");
//
// data.betaDisclaimerAcceptText = this.localisationService.getText("release-beta-disclaimer-accept");
// data.serverModsLoadedText = this.localisationService.getText("release-server-mods-loaded");
// data.serverModsLoadedDebugText = this.localisationService.getText("release-server-mods-debug-message");
// data.clientModsLoadedText = this.localisationService.getText("release-plugins-loaded");
// data.clientModsLoadedDebugText = this.localisationService.getText("release-plugins-loaded-debug-message");
// data.illegalPluginsLoadedText = this.localisationService.getText("release-illegal-plugins-loaded");
// data.illegalPluginsExceptionText = this.localisationService.getText("release-illegal-plugins-exception");
// data.releaseSummaryText = this.localisationService.getText("release-summary");
//
// data.isBeta =
// ProgramStatics.ENTRY_TYPE === EntryType.BLEEDING_EDGE ||
// ProgramStatics.ENTRY_TYPE === EntryType.BLEEDING_EDGE_MODS;
// data.isModdable = ProgramStatics.MODS;
// data.isModded = this.modLoadOrder.getLoadOrder().length > 0;
return _httpResponseUtil.NoBody(data);
}
/// <summary>
@@ -36,6 +84,7 @@ public class ClientLogCallbacks
/// <returns></returns>
public string BsgLogging()
{
throw new NotImplementedException();
var data = _configServer.GetConfig<CoreConfig>(ConfigTypes.CORE).BsgLogging;
return _httpResponseUtil.NoBody(data);
}
}
}
+40 -14
View File
@@ -1,16 +1,33 @@
using Core.Models.Eft.Common;
using Core.Annotations;
using Core.Controllers;
using Core.Models.Eft.Common;
using Core.Models.Eft.Common.Tables;
using Core.Models.Eft.Customization;
using Core.Models.Eft.Hideout;
using Core.Models.Eft.HttpResponse;
using Core.Models.Eft.ItemEvent;
using Core.Servers;
using Core.Utils;
namespace Core.Callbacks;
[Injectable]
public class CustomizationCallbacks
{
public CustomizationCallbacks()
protected CustomizationController _customizationController;
protected SaveServer _saveServer;
protected HttpResponseUtil _httpResponseUtil;
public CustomizationCallbacks
(
CustomizationController customizationController,
SaveServer saveServer,
HttpResponseUtil httpResponseUtil
)
{
_customizationController = customizationController;
_saveServer = saveServer;
_httpResponseUtil = httpResponseUtil;
}
/// <summary>
@@ -20,9 +37,15 @@ public class CustomizationCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<GetSuitsResponse> GetSuits(string url, EmptyRequestData info, string sessionID)
public string GetSuits(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
var result = new GetSuitsResponse
{
Id = sessionID,
Suites = _saveServer.GetProfile(sessionID).Suits
};
return _httpResponseUtil.GetBody(result);
}
/// <summary>
@@ -32,9 +55,12 @@ public class CustomizationCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<List<Suit>> GetTraderSuits(string url, object info, string sessionID)
public string GetTraderSuits(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
var splitUrl = url.Split('/');
var traderId = splitUrl[splitUrl.Length - 3];
return _httpResponseUtil.GetBody(_customizationController.GetTraderSuits(traderId, sessionID));
}
/// <summary>
@@ -44,9 +70,9 @@ public class CustomizationCallbacks
/// <param name="body"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public ItemEventRouterResponse BuyClothing(PmcData pmcData, BuyClothingRequestData body, string sessionID)
public ItemEventRouterResponse BuyClothing(PmcData pmcData, BuyClothingRequestData info, string sessionID)
{
throw new NotImplementedException();
return _customizationController.BuyClothing(pmcData, info, sessionID);
}
/// <summary>
@@ -56,9 +82,9 @@ public class CustomizationCallbacks
/// <param name="body"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<HideoutCustomisation> GetHideoutCustomisation(PmcData pmcData, EmptyRequestData body, string sessionID)
public string GetHideoutCustomisation(PmcData pmcData, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_customizationController.GetHideoutCustomisation(sessionID, info));
}
/// <summary>
@@ -68,9 +94,9 @@ public class CustomizationCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<List<CustomisationStorage>> GetStorage(string url, EmptyRequestData info, string sessionID)
public string GetStorage(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_customizationController.GetCustomisationStorage(sessionID, info));
}
/// <summary>
@@ -82,6 +108,6 @@ public class CustomizationCallbacks
/// <returns></returns>
public ItemEventRouterResponse SetClothing(PmcData pmcData, CustomizationSetRequest info, string sessionID)
{
throw new NotImplementedException();
return _customizationController.SetClothing(sessionID, info, pmcData);
}
}
}
+77 -27
View File
@@ -1,16 +1,43 @@
using Core.Models.Eft.Common;
using Core.Annotations;
using Core.Controllers;
using Core.Helpers;
using Core.Models.Eft.Common;
using Core.Models.Eft.Common.Tables;
using Core.Models.Eft.Game;
using Core.Models.Eft.Hideout;
using Core.Models.Eft.HttpResponse;
using Core.Models.Spt.Server;
using Core.Services;
using Core.Utils;
namespace Core.Callbacks;
[Injectable]
public class DataCallbacks
{
public DataCallbacks()
protected HttpResponseUtil _httpResponseUtil;
protected TimeUtil _timeUtil;
protected TraderHelper _traderHelper;
protected DatabaseService _databaseService;
protected TraderController _traderController;
protected HideoutController _hideoutController;
public DataCallbacks
(
HttpResponseUtil httpResponseUtil,
TimeUtil timeUtil,
TraderHelper traderHelper,
DatabaseService databaseService,
TraderController traderController,
HideoutController hideoutController
)
{
_httpResponseUtil = httpResponseUtil;
_timeUtil = timeUtil;
_traderHelper = traderHelper;
_databaseService = databaseService;
_traderController = traderController;
_hideoutController = hideoutController;
}
/// <summary>
@@ -20,9 +47,9 @@ public class DataCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<SettingsBase> GetSettings(string url, EmptyRequestData info, string sessionID)
public string GetSettings(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_databaseService.GetSettings());
}
/// <summary>
@@ -32,9 +59,12 @@ public class DataCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<Globals> GetGlobals(string url, EmptyRequestData info, string sessionID)
public string GetGlobals(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
var globals = _databaseService.GetGlobals();
globals.Time = _timeUtil.GetTimeStamp();
return _httpResponseUtil.GetBody(globals);
}
/// <summary>
@@ -46,7 +76,7 @@ public class DataCallbacks
/// <returns></returns>
public string GetTemplateItems(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetUnclearedBody(_databaseService.GetItems());
}
/// <summary>
@@ -56,9 +86,9 @@ public class DataCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<HandbookBase> GetTemplateHandbook(string url, EmptyRequestData info, string sessionID)
public string GetTemplateHandbook(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_databaseService.GetHandbook());
}
/// <summary>
@@ -68,9 +98,9 @@ public class DataCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<Dictionary<string, CustomizationItem>> GetTemplateSuits(string url, EmptyRequestData info, string sessionID)
public string GetTemplateSuits(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_databaseService.GetTemplates().Customization);
}
/// <summary>
@@ -80,9 +110,9 @@ public class DataCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<List<string>> GetTemplateCharacter(string url, EmptyRequestData info, string sessionID)
public string GetTemplateCharacter(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_databaseService.GetTemplates().Character);
}
/// <summary>
@@ -92,19 +122,19 @@ public class DataCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<HideoutSettingsBase> GetHideoutSettings(string url, EmptyRequestData info, string sessionID)
public string GetHideoutSettings(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_databaseService.GetHideout().Settings);
}
public GetBodyResponseData<List<HideoutArea>> GetHideoutAreas(string url, EmptyRequestData info, string sessionID)
public string GetHideoutAreas(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_databaseService.GetHideout().Areas);
}
public GetBodyResponseData<HideoutProductionData> GetHideoutProduction(string url, EmptyRequestData info, string sessionID)
public string GetHideoutProduction(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_databaseService.GetHideout().Production);
}
/// <summary>
@@ -114,9 +144,9 @@ public class DataCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<Dictionary<string, string>> GetLocalesLanguages(string url, EmptyRequestData info, string sessionID)
public string GetLocalesLanguages(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_databaseService.GetLocales().Languages);
}
/// <summary>
@@ -126,9 +156,19 @@ public class DataCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<string> GetLocalesMenu(string url, EmptyRequestData info, string sessionID)
public string GetLocalesMenu(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
var localeId = url.Replace("/client/menu/locale/", "");
var locales = _databaseService.GetLocales();
var result = locales.Menu[localeId];
if (result == null)
result = locales.Menu.FirstOrDefault(m => m.Key == "en").Value;
if (result == null)
throw new Exception($"Unable to determine locale for request with {localeId}");
return _httpResponseUtil.GetBody(result);
}
/// <summary>
@@ -140,7 +180,14 @@ public class DataCallbacks
/// <returns></returns>
public string GetLocalesGlobal(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
var localeId = url.Replace("/client/locale/", "");
var locales = _databaseService.GetLocales();
var result = locales.Global[localeId];
if (result == null)
result = locales.Global.FirstOrDefault(m => m.Key == "en").Value;
return _httpResponseUtil.GetUnclearedBody(result);
}
/// <summary>
@@ -152,6 +199,7 @@ public class DataCallbacks
/// <returns></returns>
public string GetQteList(string url, EmptyRequestData info, string sessionID)
{
// return _httpResponseUtil.GetUnclearedBody(_hideoutController.GetQteList(sessionID)); TODO: HideoutController is not implemented rn
throw new NotImplementedException();
}
@@ -162,8 +210,10 @@ public class DataCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<GetItemPricesResponse> GetItemPrices(string url, EmptyRequestData info, string sessionID)
public string GetItemPrices(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
var traderId = url.Replace("/client/items/prices/", "");
return _httpResponseUtil.GetBody(_traderController.GetItemPrices(sessionID, traderId));
}
}
}
+97 -59
View File
@@ -1,18 +1,33 @@
using Core.Annotations;
using Core.Controllers;
using Core.DI;
using Core.Models.Eft.Common;
using Core.Models.Eft.Common.Request;
using Core.Models.Eft.Dialog;
using Core.Models.Eft.HttpResponse;
using Core.Models.Eft.Profile;
using Core.Utils;
namespace Core.Callbacks;
[Injectable(TypePriority = OnUpdateOrder.DialogCallbacks)]
public class DialogCallbacks : OnUpdate
{
public DialogCallbacks()
protected HashUtil _hashUtil;
protected TimeUtil _timeUtil;
protected HttpResponseUtil _httpResponseUtil;
protected DialogueController _dialogueController;
public DialogCallbacks
(
HashUtil hashUtil,
TimeUtil timeUtil,
HttpResponseUtil httpResponseUtil,
DialogueController dialogueController
)
{
_hashUtil = hashUtil;
_timeUtil = timeUtil;
_httpResponseUtil = httpResponseUtil;
_dialogueController = dialogueController;
}
/// <summary>
@@ -22,9 +37,9 @@ public class DialogCallbacks : OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<GetFriendListDataResponse> GetFriendList(string url, EmptyRequestData info, string sessionID)
public string GetFriendList(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_dialogueController.GetFriendList(sessionID));
}
/// <summary>
@@ -34,9 +49,26 @@ public class DialogCallbacks : OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<List<ChatServer>> GetChatServerList(string url, GetChatServerListRequestData info, string sessionID)
public string GetChatServerList(string url, GetChatServerListRequestData info, string sessionID)
{
throw new NotImplementedException();
var chatServer = new List<ChatServer>()
{
new ChatServer()
{
Id = _hashUtil.Generate(),
RegistrationId = 20,
DateTime = _timeUtil.GetTimeStamp(),
IsDeveloper = true,
Regions = new() { "EUR" },
VersionId = "bgkidft87ddd",
Ip = "",
Port = 0,
Chats = [new() { Id = "0", Members = 0 }],
}
};
return _httpResponseUtil.GetBody(chatServer);
}
/// <summary>
@@ -46,9 +78,9 @@ public class DialogCallbacks : OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<List<DialogueInfo>> GetMailDialogList(string url, GetMailDialogListRequestData info, string sessionID)
public string GetMailDialogList(string url, GetMailDialogListRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_dialogueController.GenerateDialogueList(sessionID), 0, null, false);
}
/// <summary>
@@ -58,9 +90,9 @@ public class DialogCallbacks : OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<GetMailDialogViewResponseData> GetMailDialogView(string url, GetMailDialogViewRequestData info, string sessionID)
public string GetMailDialogView(string url, GetMailDialogViewRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_dialogueController.GenerateDialogueView(info, sessionID), 0, null, false);
}
/// <summary>
@@ -70,9 +102,9 @@ public class DialogCallbacks : OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<DialogueInfo> GetMailDialogInfo(string url, GetMailDialogInfoRequestData info, string sessionID)
public string GetMailDialogInfo(string url, GetMailDialogInfoRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_dialogueController.GetDialogueInfo(info.DialogId, sessionID));
}
/// <summary>
@@ -82,9 +114,10 @@ public class DialogCallbacks : OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<List<object>> RemoveDialog(string url, RemoveDialogRequestData info, string sessionID)
public string RemoveDialog(string url, RemoveDialogRequestData info, string sessionID)
{
throw new NotImplementedException();
_dialogueController.RemoveDialogue(info.DialogId, sessionID);
return _httpResponseUtil.EmptyArrayResponse();
}
/// <summary>
@@ -94,9 +127,10 @@ public class DialogCallbacks : OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<List<object>> PinDialog(string url, PinDialogRequestData info, string sessionID)
public string PinDialog(string url, PinDialogRequestData info, string sessionID)
{
throw new NotImplementedException();
_dialogueController.SetDialoguePin(info.DialogId, true, sessionID);
return _httpResponseUtil.EmptyArrayResponse();
}
/// <summary>
@@ -106,9 +140,10 @@ public class DialogCallbacks : OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<List<object>> UnpinDialog(string url, PinDialogRequestData info, string sessionID)
public string UnpinDialog(string url, PinDialogRequestData info, string sessionID)
{
throw new NotImplementedException();
_dialogueController.SetDialoguePin(info.DialogId, false, sessionID);
return _httpResponseUtil.EmptyArrayResponse();
}
/// <summary>
@@ -118,9 +153,10 @@ public class DialogCallbacks : OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<List<object>> SetRead(string url, SetDialogReadRequestData info, string sessionID)
public string SetRead(string url, SetDialogReadRequestData info, string sessionID)
{
throw new NotImplementedException();
_dialogueController.SetRead(info.Dialogs, sessionID);
return _httpResponseUtil.EmptyArrayResponse();
}
/// <summary>
@@ -130,9 +166,9 @@ public class DialogCallbacks : OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<object> GetAllAttachments(string url, EmptyRequestData info, string sessionID) // TODO: Fix type - GetBodyResponseData<GetAllAttachmentsResponse | Undefined>
public string GetAllAttachments(string url, GetAllAttachmentsRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_dialogueController.GetAllAttachments(info.DialogId, sessionID));
}
/// <summary>
@@ -142,9 +178,9 @@ public class DialogCallbacks : OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<string> SendMessage(string url, SendMessageRequest info, string sessionID)
public string SendMessage(string url, SendMessageRequest info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_dialogueController.SendMessage(sessionID, info));
}
/// <summary>
@@ -154,9 +190,9 @@ public class DialogCallbacks : OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<List<object>> ListOutbox(string url, EmptyRequestData info, string sessionID)
public string ListOutbox(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.EmptyArrayResponse();
}
/// <summary>
@@ -166,9 +202,9 @@ public class DialogCallbacks : OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<List<object>> ListInbox(string url, EmptyRequestData info, string sessionID)
public string ListInbox(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.EmptyArrayResponse();
}
/// <summary>
@@ -178,9 +214,9 @@ public class DialogCallbacks : OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<FriendRequestSendResponse> SendFriendRequest(string url, FriendRequestData info, string sessionID)
public string SendFriendRequest(string url, FriendRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_dialogueController.SendFriendRequest(sessionID, info));
}
/// <summary>
@@ -190,9 +226,9 @@ public class DialogCallbacks : OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public NullResponseData AcceptAllFriendRequests(string url, EmptyRequestData info, string sessionID)
public string AcceptAllFriendRequests(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.NullResponse();
}
/// <summary>
@@ -202,9 +238,9 @@ public class DialogCallbacks : OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<bool> AcceptFriendRequest(string url, AcceptFriendRequestData info, string sessionID)
public string AcceptFriendRequest(string url, AcceptFriendRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(true);
}
/// <summary>
@@ -214,9 +250,9 @@ public class DialogCallbacks : OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<bool> DeclineFriendRequest(string url, DeclineFriendRequestData info, string sessionID)
public string DeclineFriendRequest(string url, DeclineFriendRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(true);
}
/// <summary>
@@ -226,9 +262,9 @@ public class DialogCallbacks : OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<bool> CancelFriendRequest(string url, CancelFriendRequestData info, string sessionID)
public string CancelFriendRequest(string url, CancelFriendRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(true);
}
/// <summary>
@@ -238,9 +274,10 @@ public class DialogCallbacks : OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public NullResponseData DeleteFriend(string url, DeleteFriendRequest info, string sessionID)
public string DeleteFriend(string url, DeleteFriendRequest info, string sessionID)
{
throw new NotImplementedException();
_dialogueController.DeleteFriend(sessionID, info);
return _httpResponseUtil.NullResponse();
}
/// <summary>
@@ -250,9 +287,9 @@ public class DialogCallbacks : OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public NullResponseData IgnoreFriend(string url, UIDRequestData info, string sessionID)
public string IgnoreFriend(string url, UIDRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.NullResponse();
}
/// <summary>
@@ -262,48 +299,49 @@ public class DialogCallbacks : OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public NullResponseData UnIgnoreFriend(string url, UIDRequestData info, string sessionID)
public string UnIgnoreFriend(string url, UIDRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.NullResponse();
}
public GetBodyResponseData<List<object>> ClearMail(string url, ClearMailMessageRequest info, string sessionID)
public string ClearMail(string url, ClearMailMessageRequest info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.EmptyArrayResponse();
}
public GetBodyResponseData<List<object>> RemoveMail(string url, RemoveMailMessageRequest info, string sessionID)
public string RemoveMail(string url, RemoveMailMessageRequest info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.EmptyArrayResponse();
}
public GetBodyResponseData<List<object>> CreateGroupMail(string url, CreateGroupMailRequest info, string sessionID)
public string CreateGroupMail(string url, CreateGroupMailRequest info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.EmptyArrayResponse();
}
public GetBodyResponseData<List<object>> ChangeMailGroupOwner(string url, ChangeGroupMailOwnerRequest info, string sessionID)
public string ChangeMailGroupOwner(string url, ChangeGroupMailOwnerRequest info, string sessionID)
{
throw new NotImplementedException();
throw new NotImplementedException(); // Not implemented in Node
}
public GetBodyResponseData<List<object>> AddUserToMail(string url, AddUserGroupMailRequest info, string sessionID)
public string AddUserToMail(string url, AddUserGroupMailRequest info, string sessionID)
{
throw new NotImplementedException();
throw new NotImplementedException(); // Not implemented in Node
}
public GetBodyResponseData<List<object>> RemoveUserFromMail(string url, RemoveUserGroupMailRequest info, string sessionID)
public string RemoveUserFromMail(string url, RemoveUserGroupMailRequest info, string sessionID)
{
throw new NotImplementedException();
throw new NotImplementedException(); // Not implemented in Node
}
public async Task<bool> OnUpdate(long timeSinceLastRun)
{
throw new NotImplementedException();
_dialogueController.Update();
return true;
}
public string GetRoute()
{
throw new NotImplementedException();
return "spt-dialogue";
}
}
+58 -32
View File
@@ -1,27 +1,48 @@
using Core.Annotations;
using Core.Controllers;
using Core.DI;
using Core.Models.Eft.Common;
using Core.Models.Eft.Common.Request;
using Core.Models.Eft.Game;
using Core.Models.Eft.HttpResponse;
using Core.Servers;
using Core.Utils;
namespace Core.Callbacks;
[Injectable(TypePriority = OnLoadOrder.GameCallbacks)]
public class GameCallbacks : OnLoad
{
public GameCallbacks()
protected HttpResponseUtil _httpResponseUtil;
protected Watermark _watermark;
protected SaveServer _saveServer;
protected GameController _gameController;
protected TimeUtil _timeUtil;
public GameCallbacks
(
HttpResponseUtil httpResponseUtil,
Watermark watermark,
SaveServer saveServer,
GameController gameController,
TimeUtil timeUtil
)
{
_httpResponseUtil = httpResponseUtil;
_watermark = watermark;
_saveServer = saveServer;
_gameController = gameController;
_timeUtil = timeUtil;
}
public async Task OnLoad()
{
throw new NotImplementedException();
_gameController.Load();
}
public string GetRoute()
{
throw new NotImplementedException();
return "spt-game";
}
/// <summary>
@@ -31,9 +52,9 @@ public class GameCallbacks : OnLoad
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public NullResponseData VersionValidate(string url, VersionValidateRequestData info, string sessionID)
public string VersionValidate(string url, VersionValidateRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.NullResponse();
}
/// <summary>
@@ -43,9 +64,12 @@ public class GameCallbacks : OnLoad
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<GameStartResponse> GameStart(string url, EmptyRequestData info, string sessionID)
public string GameStart(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
var today = _timeUtil.GetDate();
var startTimestampMS = _timeUtil.GetTimeStamp();
_gameController.GameStart(url, info, sessionID, startTimestampMS);
return _httpResponseUtil.GetBody(new GameStartResponse() { UtcTime = startTimestampMS / 1000 });
}
/// <summary>
@@ -56,9 +80,10 @@ public class GameCallbacks : OnLoad
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<GameLogoutResponseData> GameLogout(string url, EmptyRequestData info, string sessionID)
public string GameLogout(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
_saveServer.Save();
return _httpResponseUtil.GetBody(new GameLogoutResponseData() { Status = "ok" });
}
/// <summary>
@@ -68,9 +93,9 @@ public class GameCallbacks : OnLoad
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<GameConfigResponse> GetGameConfig(string url, GameEmptyCrcRequestData info, string sessionID)
public string GetGameConfig(string url, GameEmptyCrcRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_gameController.GetGameConfig(sessionID));
}
/// <summary>
@@ -80,9 +105,9 @@ public class GameCallbacks : OnLoad
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<GameModeResponse> GetGameMode(string url, GameModeRequestData info, string sessionID)
public string GetGameMode(string url, GameModeRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_gameController.GetGameMode(sessionID, info));
}
/// <summary>
@@ -92,9 +117,9 @@ public class GameCallbacks : OnLoad
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<List<ServerDetails>> GetServer(string url, EmptyRequestData info, string sessionID)
public string GetServer(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_gameController.GetServer(sessionID));
}
/// <summary>
@@ -104,9 +129,9 @@ public class GameCallbacks : OnLoad
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<CurrentGroupResponse> GetCurrentGroup(string url, EmptyRequestData info, string sessionID)
public string GetCurrentGroup(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_gameController.GetCurrentGroup(sessionID));
}
/// <summary>
@@ -116,9 +141,9 @@ public class GameCallbacks : OnLoad
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<CheckVersionResponse> ValidateGameVersion(string url, EmptyRequestData info, string sessionID)
public string ValidateGameVersion(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_gameController.GetValidGameVersion(sessionID));
}
/// <summary>
@@ -128,9 +153,9 @@ public class GameCallbacks : OnLoad
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<GameKeepAliveResponse> GameKeepalive(string url, EmptyRequestData info, string sessionID)
public string GameKeepalive(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_gameController.GetKeepAlive(sessionID));
}
/// <summary>
@@ -142,7 +167,8 @@ public class GameCallbacks : OnLoad
/// <returns></returns>
public string GetVersion(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
// change to be a proper type
return _httpResponseUtil.NoBody(new { Version = _watermark.GetInGameVersionLabel() });
}
/// <summary>
@@ -152,9 +178,9 @@ public class GameCallbacks : OnLoad
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public NullResponseData ReportNickname(string url, UIDRequestData info, string sessionID)
public string ReportNickname(string url, UIDRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.NullResponse();
}
/// <summary>
@@ -164,9 +190,9 @@ public class GameCallbacks : OnLoad
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetRaidTimeResponse GetRaidTime(string url, GetRaidTimeRequest info, string sessionID)
public string GetRaidTime(string url, GetRaidTimeRequest info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.NoBody(_gameController.GetRaidTime(sessionID, info));
}
/// <summary>
@@ -176,9 +202,9 @@ public class GameCallbacks : OnLoad
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public object GetSurvey(string url, EmptyRequestData info, string sessionID) // TODO: Types given was NullResponseData | GetBodyResponseData<SurveyResponseData>
public string GetSurvey(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_gameController.GetSurvey(sessionID));
}
/// <summary>
@@ -188,9 +214,9 @@ public class GameCallbacks : OnLoad
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public NullResponseData GetSurveyView(string url, object info, string sessionID)
public string GetSurveyView(string url, object info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.NullResponse();
}
/// <summary>
@@ -200,8 +226,8 @@ public class GameCallbacks : OnLoad
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public NullResponseData SendSurveyOpinion(string url, SendSurveyOpinionRequest info, string sessionID)
public string SendSurveyOpinion(string url, SendSurveyOpinionRequest info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.NullResponse();
}
}
+11 -4
View File
@@ -1,4 +1,5 @@
using Core.Annotations;
using Core.Controllers;
using Core.DI;
namespace Core.Callbacks;
@@ -6,17 +7,23 @@ namespace Core.Callbacks;
[Injectable(TypePriority = OnLoadOrder.HandbookCallbacks)]
public class HandbookCallbacks : OnLoad
{
public HandbookCallbacks()
protected HandBookController _handBookController;
public HandbookCallbacks
(
HandBookController handBookController
)
{
_handBookController = handBookController;
}
public Task OnLoad()
public async Task OnLoad()
{
throw new NotImplementedException();
_handBookController.Load();
}
public string GetRoute()
{
throw new NotImplementedException();
return "spt-handbook";
}
}
+26 -8
View File
@@ -1,14 +1,31 @@
using Core.Models.Eft.Common;
using Core.Annotations;
using Core.Controllers;
using Core.Helpers;
using Core.Models.Eft.Common;
using Core.Models.Eft.Health;
using Core.Models.Eft.HttpResponse;
using Core.Models.Eft.ItemEvent;
using Core.Utils;
namespace Core.Callbacks;
[Injectable]
public class HealthCallbacks
{
public HealthCallbacks()
protected HttpResponseUtil _httpResponseUtil;
protected ProfileHelper _profileHelper;
protected HealthController _healthController;
public HealthCallbacks
(
HttpResponseUtil httpResponseUtil,
ProfileHelper profileHelper,
HealthController healthController
)
{
_httpResponseUtil = httpResponseUtil;
_profileHelper = profileHelper;
_healthController = healthController;
}
/// <summary>
@@ -18,9 +35,10 @@ public class HealthCallbacks
/// <param name="info">HealthListener.Instance.CurrentHealth class</param>
/// <param name="sessionID">session id</param>
/// <returns>empty response, no data sent back to client</returns>
public GetBodyResponseData<string> handleWorkoutEffects(string url, WorkoutData info, string sessionID)
public string handleWorkoutEffects(string url, WorkoutData info, string sessionID)
{
throw new NotImplementedException();
_healthController.ApplyWorkoutChanges(_profileHelper.GetPmcProfile(sessionID), info, sessionID);
return _httpResponseUtil.EmptyResponse();
}
/// <summary>
@@ -33,7 +51,7 @@ public class HealthCallbacks
/// <exception cref="NotImplementedException"></exception>
public ItemEventRouterResponse OffraidEat(PmcData pmcData, OffraidEatRequestData info, string sessionID)
{
throw new NotImplementedException();
return _healthController.OffRaidEat(pmcData, info, sessionID);
}
/// <summary>
@@ -46,7 +64,7 @@ public class HealthCallbacks
/// <exception cref="NotImplementedException"></exception>
public ItemEventRouterResponse OffraidHeal(PmcData pmcData, OffraidHealRequestData info, string sessionID)
{
throw new NotImplementedException();
return _healthController.OffRaidHeal(pmcData, info, sessionID);
}
/// <summary>
@@ -59,6 +77,6 @@ public class HealthCallbacks
/// <exception cref="NotImplementedException"></exception>
public ItemEventRouterResponse HealthTreatment(PmcData pmcData, HealthTreatmentRequestData info, string sessionID)
{
throw new NotImplementedException();
return _healthController.HealthTreatment(pmcData, info, sessionID);
}
}
}
+66 -13
View File
@@ -1,17 +1,32 @@
using Core.DI;
using Core.Annotations;
using Core.Controllers;
using Core.DI;
using Core.Models.Eft.Common;
using Core.Models.Eft.Hideout;
using Core.Models.Eft.ItemEvent;
using Core.Models.Enums;
using Core.Models.Spt.Config;
using Core.Servers;
namespace Core.Callbacks;
[Injectable]
public class HideoutCallbacks : OnUpdate
{
private HideoutConfig _hideoutConfig;
protected HideoutController _hideoutController;
protected ConfigServer _configServer;
public HideoutCallbacks()
protected HideoutConfig _hideoutConfig;
public HideoutCallbacks
(
HideoutController hideoutController,
ConfigServer configServer
)
{
_hideoutController = hideoutController;
_configServer = configServer;
_hideoutConfig = configServer.GetConfig<HideoutConfig>(ConfigTypes.HIDEOUT);
}
/// <summary>
@@ -21,9 +36,11 @@ public class HideoutCallbacks : OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public ItemEventRouterResponse Upgrade(PmcData pmcData, HideoutUpgradeRequestData info, string sessionID)
public ItemEventRouterResponse Upgrade(PmcData pmcData, HideoutUpgradeRequestData info, string sessionID, ItemEventRouterResponse output)
{
throw new NotImplementedException();
// _hideoutController.StartUpgrade(pmcData, info, sessionID, output);
// TODO: HideoutController is not implemented rn
return output;
}
/// <summary>
@@ -33,9 +50,11 @@ public class HideoutCallbacks : OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public ItemEventRouterResponse UpgradeComplete(PmcData pmcData, HideoutUpgradeCompleteRequestData info, string sessionID)
public ItemEventRouterResponse UpgradeComplete(PmcData pmcData, HideoutUpgradeCompleteRequestData info, string sessionID, ItemEventRouterResponse output)
{
throw new NotImplementedException();
// _hideoutController.UpgradeComplete(pmcData, info, sessionID, output);
// TODO: HideoutController is not implemented rn
return output;
}
/// <summary>
@@ -47,6 +66,8 @@ public class HideoutCallbacks : OnUpdate
/// <returns></returns>
public ItemEventRouterResponse PutItemsInAreaSlots(PmcData pmcData, HideoutPutItemInRequestData info, string sessionID)
{
// return _hideoutController.PutItemsInAreaSlots(pmcData, info, sessionID);
// TODO: HideoutController is not implemented rn
throw new NotImplementedException();
}
@@ -59,6 +80,8 @@ public class HideoutCallbacks : OnUpdate
/// <returns></returns>
public ItemEventRouterResponse TakeItemsFromAreaSlots(PmcData pmcData, HideoutTakeItemOutRequestData info, string sessionID)
{
// return _hideoutController.TakeItemsFromAreaSlots(pmcData, info, sessionID);
// TODO: HideoutController is not implemented rn
throw new NotImplementedException();
}
@@ -71,6 +94,8 @@ public class HideoutCallbacks : OnUpdate
/// <returns></returns>
public ItemEventRouterResponse ToggleArea(PmcData pmcData, HideoutToggleAreaRequestData info, string sessionID)
{
// return _hideoutController.ToggleArea(pmcData, info, sessionID);
// TODO: HideoutController is not implemented rn
throw new NotImplementedException();
}
@@ -83,6 +108,8 @@ public class HideoutCallbacks : OnUpdate
/// <returns></returns>
public ItemEventRouterResponse SingleProductionStart(PmcData pmcData, HideoutSingleProductionStartRequestData info, string sessionID)
{
// return _hideoutController.SingleProductionStart(pmcData, info, sessionID);
// TODO: HideoutController is not implemented rn
throw new NotImplementedException();
}
@@ -95,6 +122,8 @@ public class HideoutCallbacks : OnUpdate
/// <returns></returns>
public ItemEventRouterResponse ScavCaseProductionStart(PmcData pmcData, HideoutScavCaseStartRequestData info, string sessionID)
{
// return _hideoutController.ScavCaseProductionStart(pmcData, info, sessionID);
// TODO: HideoutController is not implemented rn
throw new NotImplementedException();
}
@@ -107,6 +136,8 @@ public class HideoutCallbacks : OnUpdate
/// <returns></returns>
public ItemEventRouterResponse ContinuousProductionStart(PmcData pmcData, HideoutContinuousProductionStartRequestData info, string sessionID)
{
// return _hideoutController.ContinuousProductionStart(pmcData, info, sessionID);
// TODO: HideoutController is not implemented rn
throw new NotImplementedException();
}
@@ -119,6 +150,8 @@ public class HideoutCallbacks : OnUpdate
/// <returns></returns>
public ItemEventRouterResponse TakeProduction(PmcData pmcData, HideoutTakeProductionRequestData info, string sessionID)
{
// return _hideoutController.TakeProduction(pmcData, info, sessionID);
// TODO: HideoutController is not implemented rn
throw new NotImplementedException();
}
@@ -132,7 +165,9 @@ public class HideoutCallbacks : OnUpdate
/// <returns></returns>
public ItemEventRouterResponse HandleQTEEvent(PmcData pmcData, HandleQTEEventRequestData info, string sessionID, ItemEventRouterResponse output)
{
throw new NotImplementedException();
// _hideoutController.HandleQTEEventOutcome(sessionID, pmcData, info, output);
// TODO: HideoutController is not implemented rn
return output;
}
/// <summary>
@@ -145,7 +180,9 @@ public class HideoutCallbacks : OnUpdate
/// <returns></returns>
public ItemEventRouterResponse RecordShootingRangePoints(PmcData pmcData, RecordShootingRangePoints info, string sessionID, ItemEventRouterResponse output)
{
throw new NotImplementedException();
// _hideoutController.RecordShootingRangePoints(sessionID, pmcData, info);
// TODO: HideoutController is not implemented rn
return output;
}
/// <summary>
@@ -157,6 +194,8 @@ public class HideoutCallbacks : OnUpdate
/// <returns></returns>
public ItemEventRouterResponse ImproveArea(PmcData pmcData, HideoutImproveAreaRequestData info, string sessionID)
{
// return _hideoutController.ImproveArea(sessionID, pmcData, info);
// TODO: HideoutController is not implemented rn
throw new NotImplementedException();
}
@@ -169,6 +208,8 @@ public class HideoutCallbacks : OnUpdate
/// <returns></returns>
public ItemEventRouterResponse CancelProduction(PmcData pmcData, HideoutImproveAreaRequestData info, string sessionID)
{
// return _hideoutController.CancelProduction(sessionID, pmcData, info);
// TODO: HideoutController is not implemented rn
throw new NotImplementedException();
}
@@ -181,6 +222,8 @@ public class HideoutCallbacks : OnUpdate
/// <returns></returns>
public ItemEventRouterResponse CicleOfCultistProductionStart(PmcData pmcData, HideoutCircleOfCultistProductionStartRequestData info, string sessionID)
{
// return _hideoutController.CicleOfCultistProductionStart(sessionID, pmcData, info);
// TODO: HideoutController is not implemented rn
throw new NotImplementedException();
}
@@ -191,8 +234,10 @@ public class HideoutCallbacks : OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public ItemEventRouterResponse HideoutDeleteProductionRequestData(PmcData pmcData, HideoutDeleteProductionRequestData info, string sessionID)
public ItemEventRouterResponse HideoutDeleteProductionCommand(PmcData pmcData, HideoutDeleteProductionRequestData info, string sessionID)
{
// return _hideoutController.HideoutDeleteProductionCommand(sessionID, pmcData, info);
// TODO: HideoutController is not implemented rn
throw new NotImplementedException();
}
@@ -205,16 +250,24 @@ public class HideoutCallbacks : OnUpdate
/// <returns></returns>
public ItemEventRouterResponse HideoutCustomizationApplyCommand(PmcData pmcData, HideoutCustomizationApplyRequestData info, string sessionID)
{
// return _hideoutController.HideoutCustomizationApply(sessionID, pmcData, info);
// TODO: HideoutController is not implemented rn
throw new NotImplementedException();
}
public async Task<bool> OnUpdate(long timeSinceLastRun)
{
throw new NotImplementedException();
if (timeSinceLastRun > _hideoutConfig.RunIntervalSeconds)
{
// _hideoutController.Update();
return true;
}
return false;
}
public string GetRoute()
{
throw new NotImplementedException();
return "spt-hideout";
}
}
}
+25 -10
View File
@@ -1,13 +1,26 @@
using Core.Models.Eft.Common;
using Core.Annotations;
using Core.Controllers;
using Core.Models.Eft.Common;
using Core.Models.Eft.HttpResponse;
using Core.Models.Eft.InRaid;
using Core.Utils;
namespace Core.Callbacks;
[Injectable]
public class InraidCallbacks
{
public InraidCallbacks()
protected InRaidController _inRaidController;
protected HttpResponseUtil _httpResponseUtil;
public InraidCallbacks
(
InRaidController inRaidController,
HttpResponseUtil httpResponseUtil
)
{
_inRaidController = inRaidController;
_httpResponseUtil = httpResponseUtil;
}
/// <summary>
@@ -18,9 +31,10 @@ public class InraidCallbacks
/// <param name="info">register player request</param>
/// <param name="sessionID">Session id</param>
/// <returns>Null http response</returns>
public NullResponseData RegisterPlayer(string url, RegisterPlayerRequestData info, string sessionID)
public string RegisterPlayer(string url, RegisterPlayerRequestData info, string sessionID)
{
throw new NotImplementedException();
_inRaidController.AddPlayer(sessionID, info);
return _httpResponseUtil.NullResponse();
}
/// <summary>
@@ -30,9 +44,10 @@ public class InraidCallbacks
/// <param name="info">Save progress request</param>
/// <param name="sessionID">Session id</param>
/// <returns>Null http response</returns>
public NullResponseData SaveProgress(string url, ScavSaveRequestData info, string sessionID)
public string SaveProgress(string url, ScavSaveRequestData info, string sessionID)
{
throw new NotImplementedException();
_inRaidController.SavePostRaidProfileForScav(info, sessionID);
return _httpResponseUtil.NullResponse();
}
/// <summary>
@@ -41,16 +56,16 @@ public class InraidCallbacks
/// <returns>JSON as string</returns>
public string GetRaidMenuSettings()
{
throw new NotImplementedException();
return _httpResponseUtil.NoBody(_inRaidController.GetInRaidConfig().RaidMenuSettings);
}
public string GetTraitorScavHostileChance(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.NoBody(_inRaidController.GetTraitorScavHostileChance(url, sessionID));
}
public string GetBossConvertSettings(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.NoBody(_inRaidController.GetBossConvertSettings(url, sessionID));
}
}
}
+41 -7
View File
@@ -1,18 +1,41 @@
using Core.DI;
using Core.Annotations;
using Core.Controllers;
using Core.DI;
using Core.Models.Eft.Common;
using Core.Models.Eft.HttpResponse;
using Core.Models.Eft.Insurance;
using Core.Models.Eft.ItemEvent;
using Core.Models.Enums;
using Core.Models.Spt.Config;
using Core.Servers;
using Core.Services;
using Core.Utils;
namespace Core.Callbacks;
[Injectable]
public class InsuranceCallbacks : OnUpdate
{
protected InsuranceController _insuranceController;
protected InsuranceService _insuranceService;
protected HttpResponseUtil _httpResponseUtil;
protected ConfigServer _configServer;
private InsuranceConfig _insuranceConfig;
public InsuranceCallbacks()
public InsuranceCallbacks
(
InsuranceController insuranceController,
InsuranceService insuranceService,
HttpResponseUtil httpResponseUtil,
ConfigServer configServer
)
{
_insuranceController = insuranceController;
_insuranceService = insuranceService;
_httpResponseUtil = httpResponseUtil;
_configServer = configServer;
_insuranceConfig = configServer.GetConfig<InsuranceConfig>(ConfigTypes.INSURANCE);
}
/// <summary>
@@ -22,8 +45,10 @@ public class InsuranceCallbacks : OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<GetInsuranceCostResponseData> GetInsuranceCost(string url, GetInsuranceCostRequestData info, string sessionID)
public string GetInsuranceCost(string url, GetInsuranceCostRequestData info, string sessionID)
{
// return _httpResponseUtil.GetBody(_insuranceController.Cost(info, sessionID));
// TODO: InsuranceController is not implemented rn
throw new NotImplementedException();
}
@@ -36,16 +61,25 @@ public class InsuranceCallbacks : OnUpdate
/// <returns></returns>
public ItemEventRouterResponse Insure(PmcData pmcData, InsureRequestData info, string sessionID)
{
// return _insuranceController.Insure(pmcData, info, sessionID);
// TODO: InsuranceController is not implemented rn
throw new NotImplementedException();
}
public Task<bool> OnUpdate(long timeSinceLastRun)
public async Task<bool> OnUpdate(long timeSinceLastRun)
{
throw new NotImplementedException();
if (timeSinceLastRun > Math.Max(_insuranceConfig.RunIntervalSeconds, 1))
{
// _insuranceController.ProcessReturn();
// TODO: InsuranceController is not implemented rn
return true;
}
return false;
}
public string GetRoute()
{
throw new NotImplementedException();
return "spt-insurance";
}
}
}
+183 -12
View File
@@ -1,14 +1,26 @@
using Core.Models.Eft.Common;
using Core.Annotations;
using Core.Controllers;
using Core.Models.Eft.Common;
using Core.Models.Eft.Inventory;
using Core.Models.Eft.ItemEvent;
using Core.Models.Eft.Quests;
namespace Core.Callbacks;
[Injectable]
public class InventoryCallbacks
{
public InventoryCallbacks()
protected InventoryController _inventoryController;
protected QuestController _questController;
public InventoryCallbacks
(
InventoryController inventoryController,
QuestController questController
)
{
_inventoryController = inventoryController;
_questController = questController;
}
/// <summary>
@@ -18,9 +30,11 @@ public class InventoryCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public ItemEventRouterResponse MoveItem(PmcData pmcData, InventoryMoveRequestData info, string sessionID)
public ItemEventRouterResponse MoveItem(PmcData pmcData, InventoryMoveRequestData info, string sessionID, ItemEventRouterResponse output)
{
// _inventoryController.MoveItem(pmcData, info, sessionID, output);
// TODO: InventoryController is not implemented rn
// return output;
throw new NotImplementedException();
}
@@ -31,9 +45,11 @@ public class InventoryCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public ItemEventRouterResponse RemoveItem(PmcData pmcData, InventoryRemoveRequestData info, string sessionID)
{
// _inventoryController.RemoveItem(pmcData, info, sessionID, output);
// TODO: InventoryController is not implemented rn
// return output;
throw new NotImplementedException();
}
@@ -44,19 +60,41 @@ public class InventoryCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public ItemEventRouterResponse SplitItem(PmcData pmcData, InventorySplitRequestData info, string sessionID)
{
// _inventoryController.SplitItem(pmcData, info, sessionID, output);
// TODO: InventoryController is not implemented rn
// return output;
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
/// <param name="pmcData"></param>
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public ItemEventRouterResponse MergeItem(PmcData pmcData, InventoryMergeRequestData info, string sessionID)
{
// _inventoryController.MergeItem(pmcData, info, sessionID, output);
// TODO: InventoryController is not implemented rn
// return output;
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
/// <param name="pmcData"></param>
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public ItemEventRouterResponse TransferItem(PmcData pmcData, InventoryTransferRequestData info, string sessionID)
{
// _inventoryController.TransferItem(pmcData, info, sessionID, output);
// TODO: InventoryController is not implemented rn
// return output;
throw new NotImplementedException();
}
@@ -67,39 +105,101 @@ public class InventoryCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public ItemEventRouterResponse SwapItem(PmcData pmcData, InventorySwapRequestData info, string sessionID)
{
// _inventoryController.SwapItem(pmcData, info, sessionID, output);
// TODO: InventoryController is not implemented rn
// return output;
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
/// <param name="pmcData"></param>
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public ItemEventRouterResponse FoldItem(PmcData pmcData, InventoryFoldRequestData info, string sessionID)
{
// _inventoryController.FoldItem(pmcData, info, sessionID, output);
// TODO: InventoryController is not implemented rn
// return output;
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
/// <param name="pmcData"></param>
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public ItemEventRouterResponse ToggleItem(PmcData pmcData, InventoryToggleRequestData info, string sessionID)
{
// _inventoryController.ToggleItem(pmcData, info, sessionID, output);
// TODO: InventoryController is not implemented rn
// return output;
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
/// <param name="pmcData"></param>
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public ItemEventRouterResponse TagItem(PmcData pmcData, InventoryTagRequestData info, string sessionID)
{
// _inventoryController.TagItem(pmcData, info, sessionID, output);
// TODO: InventoryController is not implemented rn
// return output;
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
/// <param name="pmcData"></param>
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public ItemEventRouterResponse BindItem(PmcData pmcData, InventoryBindRequestData info, string sessionID)
{
// _inventoryController.BindItem(pmcData, info, sessionID, output);
// TODO: InventoryController is not implemented rn
// return output;
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
/// <param name="pmcData"></param>
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public ItemEventRouterResponse UnBindItem(PmcData pmcData, InventoryBindRequestData info, string sessionID)
{
// _inventoryController.UnBindItem(pmcData, info, sessionID, output);
// TODO: InventoryController is not implemented rn
// return output;
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
/// <param name="pmcData"></param>
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public ItemEventRouterResponse ExamineItem(PmcData pmcData, InventoryExamineRequestData info, string sessionID)
{
// _inventoryController.ExamineItem(pmcData, info, sessionID, output);
// TODO: InventoryController is not implemented rn
// return output;
throw new NotImplementedException();
}
@@ -110,9 +210,11 @@ public class InventoryCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public ItemEventRouterResponse ReadEncyclopedia(PmcData pmcData, InventoryReadEncyclopediaRequestData info, string sessionID)
{
// _inventoryController.ReadEncyclopedia(pmcData, info, sessionID, output);
// TODO: InventoryController is not implemented rn
// return output;
throw new NotImplementedException();
}
@@ -123,24 +225,56 @@ public class InventoryCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public ItemEventRouterResponse SortInventory(PmcData pmcData, InventorySortRequestData info, string sessionID)
{
// _inventoryController.SortInventory(pmcData, info, sessionID, output);
// TODO: InventoryController is not implemented rn
// return output;
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
/// <param name="pmcData"></param>
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public ItemEventRouterResponse CreateMapMarker(PmcData pmcData, InventoryCreateMarkerRequestData info, string sessionID)
{
// _inventoryController.CreateMapMarker(pmcData, info, sessionID, output);
// TODO: InventoryController is not implemented rn
// return output;
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
/// <param name="pmcData"></param>
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public ItemEventRouterResponse DeleteMapMarker(PmcData pmcData, InventoryDeleteMarkerRequestData info, string sessionID)
{
// _inventoryController.DeleteMapMarker(pmcData, info, sessionID, output);
// TODO: InventoryController is not implemented rn
// return output;
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
/// <param name="pmcData"></param>
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public ItemEventRouterResponse EditMapMarker(PmcData pmcData, InventoryEditMarkerRequestData info, string sessionID)
{
// _inventoryController.EditMapMarker(pmcData, info, sessionID, output);
// TODO: InventoryController is not implemented rn
// return output;
throw new NotImplementedException();
}
@@ -152,20 +286,44 @@ public class InventoryCallbacks
/// <param name="sessionID"></param>
/// <param name="output"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public ItemEventRouterResponse OpenRandomLootContainer(PmcData pmcData, OpenRandomLootContainerRequestData info, string sessionID,
ItemEventRouterResponse output)
{
// _inventoryController.OpenRandomLootContainer(pmcData, info, sessionID, output);
// TODO: InventoryController is not implemented rn
// return output;
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
/// <param name="pmcData"></param>
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <param name="output"></param>
/// <returns></returns>
public ItemEventRouterResponse RedeemProfileReward(PmcData pmcData, RedeemProfileRequestData info, string sessionID, ItemEventRouterResponse output)
{
// _inventoryController.RedeemProfileReward(pmcData, info, sessionID);
// TODO: InventoryController is not implemented rn
// return output;
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
/// <param name="pmcData"></param>
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <param name="output"></param>
/// <returns></returns>
public ItemEventRouterResponse SetFavoriteItem(PmcData pmcData, SetFavoriteItems info, string sessionID, ItemEventRouterResponse output)
{
// _inventoryController.SetFavoriteItem(pmcData, info, sessionID);
// TODO: InventoryController is not implemented rn
// return output;
throw new NotImplementedException();
}
@@ -178,14 +336,27 @@ public class InventoryCallbacks
/// <param name="sessionID"></param>
/// <param name="output"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public ItemEventRouterResponse FailQuest(PmcData pmcData, FailQuestRequestData info, string sessionID, ItemEventRouterResponse output)
{
// _inventoryController.FailQuest(pmcData, info, sessionID, output);
// TODO: InventoryController is not implemented rn
// return output;
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
/// <param name="pmcData"></param>
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <param name="output"></param>
/// <returns></returns>
public ItemEventRouterResponse PinOrLock(PmcData pmcData, PinOrLockItemRequest info, string sessionID, ItemEventRouterResponse output)
{
// _inventoryController.PinOrLock(pmcData, info, sessionID, output);
// TODO: InventoryController is not implemented rn
// return output;
throw new NotImplementedException();
}
}
}
+42 -7
View File
@@ -1,16 +1,35 @@
using Core.Models.Eft.HttpResponse;
using Core.Annotations;
using Core.Models.Eft.HttpResponse;
using Core.Models.Eft.ItemEvent;
using Core.Models.Enums;
using Core.Utils;
namespace Core.Callbacks;
[Injectable]
public class ItemEventCallbacks
{
public ItemEventCallbacks()
protected HttpResponseUtil _httpResponseUtil;
// protected ItemEventRouter _itemEventRouter;
public ItemEventCallbacks
(
HttpResponseUtil httpResponseUtil
// TODO: Implement ItemEventRouter
// ItemEventRouter itemEventRouter
)
{
_httpResponseUtil = httpResponseUtil;
// _itemEventRouter = itemEventRouter;
}
public async Task<GetBodyResponseData<ItemEventRouterResponse>> HandleEvents(string url, ItemEventRouterRequest info, string sessionID)
{
// var eventResponse = await _itemEventRouter.HandleEvents(info, sessionID);
// var result = IsCriticalError(ItemEventRouterResponse.Warnings)
// ? _httpResponseUtil.GetBody(eventResponse, GetErrorCode(eventResponse.Warnings), eventResponse.Warnings[0].Errmsg)
// : _httpResponseUtil.GetBody(eventResponse);
// TODO: Implement ItemEventRouter
throw new NotImplementedException();
}
@@ -19,14 +38,30 @@ public class ItemEventCallbacks
/// </summary>
/// <param name="warnings">The list of warnings to check for critical errors</param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public bool IsCriticalError(List<Warning> warnings)
{
throw new NotImplementedException();
// List of non-critical error codes, we return true if any error NOT included is passed in
var nonCriticalErrorCodes = new List<BackendErrorCodes>() { BackendErrorCodes.NOTENOUGHSPACE };
foreach (var warning in warnings)
{
BackendErrorCodes code;
if (!BackendErrorCodes.TryParse(warning.Code, out code))
throw new Exception($"Unable to parse [{warning.Code}] to BackendErrorCode.");
if (!nonCriticalErrorCodes.Contains(code))
return true;
}
return false;
}
public int GetErrorCode(List<Warning> warnings)
public int? GetErrorCode(List<Warning> warnings)
{
throw new NotImplementedException();
if (warnings[0].Code != null)
return int.Parse(warnings[0]?.Code);
return int.Parse(BackendErrorCodes.UNKNOWN_ERROR.ToString());
}
}
}
+20 -9
View File
@@ -1,14 +1,27 @@
using Core.Models.Eft.Common;
using Core.Annotations;
using Core.Controllers;
using Core.Models.Eft.Common;
using Core.Models.Eft.Common.Tables;
using Core.Models.Eft.HttpResponse;
using Core.Models.Eft.Location;
using Core.Utils;
namespace Core.Callbacks;
[Injectable]
public class LocationCallbacks
{
public LocationCallbacks()
protected HttpResponseUtil _httpResponseUtil;
protected LocationController _locationController;
public LocationCallbacks
(
HttpResponseUtil httpResponseUtil,
LocationController locationController
)
{
_httpResponseUtil = httpResponseUtil;
_locationController = locationController;
}
/// <summary>
@@ -18,10 +31,9 @@ public class LocationCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public GetBodyResponseData<LocationsGenerateAllResponse> GetLocationData(string url, EmptyRequestData info, string sessionID)
public string GetLocationData(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_locationController.GenerateAll(sessionID));
}
/// <summary>
@@ -31,9 +43,8 @@ public class LocationCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public GetBodyResponseData<GetAirdropLootResponse> GetAirdropLoot(string url, GetAirdropLootRequest info, string sessionID)
public string GetAirdropLoot(string url, GetAirdropLootRequest info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_locationController.GetAirDropLoot(info));
}
}
}
+79 -57
View File
@@ -1,14 +1,34 @@
using Core.Models.Eft.Common;
using Core.Annotations;
using Core.Controllers;
using Core.Models.Eft.Common;
using Core.Models.Eft.Common.Tables;
using Core.Models.Eft.HttpResponse;
using Core.Models.Eft.Match;
using Core.Services;
using Core.Utils;
namespace Core.Callbacks;
[Injectable]
public class MatchCallbacks
{
public MatchCallbacks()
protected HttpResponseUtil _httpResponseUtil;
protected JsonUtil _jsonUtil;
protected MatchController _matchController;
protected DatabaseService _databaseService;
public MatchCallbacks
(
HttpResponseUtil httpResponseUtil,
JsonUtil jsonUtil,
MatchController matchController,
DatabaseService databaseService
)
{
_httpResponseUtil = httpResponseUtil;
_jsonUtil = jsonUtil;
_matchController = matchController;
_databaseService = databaseService;
}
/// <summary>
@@ -18,9 +38,9 @@ public class MatchCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public NullResponseData UpdatePing(string url, EmptyRequestData info, string sessionID)
public string UpdatePing(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.NullResponse();
}
/// <summary>
@@ -30,9 +50,9 @@ public class MatchCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public NullResponseData ExitMatch(string url, EmptyRequestData info, string sessionID)
public string ExitMatch(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.NullResponse();
}
/// <summary>
@@ -42,9 +62,9 @@ public class MatchCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public NullResponseData ExitFromMenu(string url, EmptyRequestData info, string sessionID)
public string ExitFromMenu(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.NullResponse();
}
/// <summary>
@@ -54,9 +74,9 @@ public class MatchCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<MatchGroupCurrentResponse> GroupCurrent(string url, EmptyRequestData info, string sessionID)
public string GroupCurrent(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(new MatchGroupCurrentResponse() { Squad = new() });
}
/// <summary>
@@ -66,9 +86,9 @@ public class MatchCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public NullResponseData StartGroupSearch(string url, EmptyRequestData info, string sessionID)
public string StartGroupSearch(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.NullResponse();
}
/// <summary>
@@ -78,9 +98,9 @@ public class MatchCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public NullResponseData StopGroupSearch(string url, EmptyRequestData info, string sessionID)
public string StopGroupSearch(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.NullResponse();
}
/// <summary>
@@ -90,9 +110,9 @@ public class MatchCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<string> SendGroupInvite(string url, MatchGroupInviteSendRequest info, string sessionID)
public string SendGroupInvite(string url, MatchGroupInviteSendRequest info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody("2427943f23698ay9f2863735");
}
/// <summary>
@@ -102,9 +122,9 @@ public class MatchCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<List<GroupCharacter>> AcceptGroupInvite(string url, RequestIdRequest info, string sessionID)
public string AcceptGroupInvite(string url, RequestIdRequest info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(new List<GroupCharacter>() { new GroupCharacter() });
}
/// <summary>
@@ -114,9 +134,9 @@ public class MatchCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<bool> DeclineGroupInvite(string url, RequestIdRequest info, string sessionID)
public string DeclineGroupInvite(string url, RequestIdRequest info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(true);
}
/// <summary>
@@ -126,9 +146,9 @@ public class MatchCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<bool> CancelGroupInvite(string url, RequestIdRequest info, string sessionID)
public string CancelGroupInvite(string url, RequestIdRequest info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(true);
}
/// <summary>
@@ -138,9 +158,9 @@ public class MatchCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<bool> TransferGroup(string url, MatchGroupTransferRequest info, string sessionID)
public string TransferGroup(string url, MatchGroupTransferRequest info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(true);
}
/// <summary>
@@ -150,9 +170,9 @@ public class MatchCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<bool> CancelAllGroupInvite(string url, EmptyRequestData info, string sessionID)
public string CancelAllGroupInvite(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(true);
}
/// <summary>
@@ -162,9 +182,9 @@ public class MatchCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public NullResponseData PutMetrics(string url, PutMetricsRequestData info, string sessionID)
public string PutMetrics(string url, PutMetricsRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.NullResponse();
}
/// <summary>
@@ -174,9 +194,9 @@ public class MatchCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public NullResponseData EventDisconnect(string url, PutMetricsRequestData info, string sessionID)
public string EventDisconnect(string url, PutMetricsRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.NullResponse();
}
/// <summary>
@@ -186,9 +206,9 @@ public class MatchCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<bool> ServerAvailable(string url, EmptyRequestData info, string sessionID)
public string ServerAvailable(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_matchController.GetEnabled());
}
/// <summary>
@@ -198,9 +218,9 @@ public class MatchCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<ProfileStatusResponse> JoinMatch(string url, MatchGroupStartGameRequest info, string sessionID)
public string JoinMatch(string url, MatchGroupStartGameRequest info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_matchController.JoinMatch(info, sessionID));
}
/// <summary>
@@ -210,9 +230,9 @@ public class MatchCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<Metrics> GetMetrics(string url, object info, string sessionID) // TODO: No type given
public string GetMetrics(string url, object info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_databaseService.GetMatch().Metrics);
}
/// <summary>
@@ -223,9 +243,9 @@ public class MatchCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<MatchGroupStatusResponse> GetGroupStatus(string url, MatchGroupStatusRequest info, string sessionID)
public string GetGroupStatus(string url, MatchGroupStatusRequest info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_matchController.GetGroupStatus(info));
}
/// <summary>
@@ -235,9 +255,10 @@ public class MatchCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<bool> DeleteGroup(string url, EmptyRequestData info, string sessionID)
public string DeleteGroup(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
_matchController.DeleteGroup(info);
return _httpResponseUtil.GetBody(true);
}
/// <summary>
@@ -247,9 +268,9 @@ public class MatchCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<bool> LeaveGroup(string url, EmptyRequestData info, string sessionID)
public string LeaveGroup(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(true);
}
/// <summary>
@@ -259,9 +280,9 @@ public class MatchCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<bool> RemovePlayerFromGroup(string url, MatchGroupPlayerRemoveRequest info, string sessionID)
public string RemovePlayerFromGroup(string url, MatchGroupPlayerRemoveRequest info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(true);
}
/// <summary>
@@ -271,9 +292,9 @@ public class MatchCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<StartLocalRaidResponseData> StartLocalRaid(string url, StartLocalRaidRequestData info, string sessionID)
public string StartLocalRaid(string url, StartLocalRaidRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_matchController.StartLocalRaid(sessionID, info));
}
/// <summary>
@@ -283,9 +304,10 @@ public class MatchCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public NullResponseData EndLocalRaid(string url, EndLocalRaidRequestData info, string sessionID)
public string EndLocalRaid(string url, EndLocalRaidRequestData info, string sessionID)
{
throw new NotImplementedException();
_matchController.EndLocalRaid(sessionID, info);
return _httpResponseUtil.NullResponse();
}
/// <summary>
@@ -295,9 +317,9 @@ public class MatchCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public NullResponseData GetRaidConfiguration(string url, GetRaidConfigurationRequestData info, string sessionID)
public string GetRaidConfiguration(string url, GetRaidConfigurationRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.NullResponse();
}
/// <summary>
@@ -307,9 +329,9 @@ public class MatchCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public NullResponseData GetConfigurationByProfile(string url, GetRaidConfigurationRequestData info, string sessionID)
public string GetConfigurationByProfile(string url, GetRaidConfigurationRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.NullResponse();
}
/// <summary>
@@ -319,9 +341,9 @@ public class MatchCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<bool> RaidReady(string url, EmptyRequestData info, string sessionID)
public string RaidReady(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(true);
}
/// <summary>
@@ -331,8 +353,8 @@ public class MatchCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public GetBodyResponseData<bool> NotRaidReady(string url, EmptyRequestData info, string sessionID)
public string NotRaidReady(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(true);
}
}
}
+33 -2
View File
@@ -1,22 +1,53 @@
using Core.Annotations;
using Core.DI;
using Core.Models.Enums;
using Core.Models.Spt.Config;
using Core.Servers;
using Core.Services;
using Core.Utils;
using ILogger = Core.Models.Utils.ILogger;
namespace Core.Callbacks;
[Injectable(TypePriority = OnLoadOrder.ModCallbacks)]
public class ModCallbacks : OnLoad
{
public ModCallbacks()
protected ILogger _logger;
protected HttpResponseUtil _httpResponseUtil;
protected HttpFileUtil _httpFileUtil;
// protected PostSptModLoader _postSptModLoader; TODO: needs to be implemented
protected LocalisationService _localisationService;
protected ConfigServer _configServer;
protected HttpConfig _httpConfig;
public ModCallbacks
(
ILogger logger,
HttpResponseUtil httpResponseUtil,
HttpFileUtil httpFileUtil,
LocalisationService localisationService,
ConfigServer configServer
)
{
_logger = logger;
_httpResponseUtil = httpResponseUtil;
_httpFileUtil = httpFileUtil;
_localisationService = localisationService;
_configServer = configServer;
_httpConfig = configServer.GetConfig<HttpConfig>(ConfigTypes.HTTP);
}
public async Task OnLoad()
{
// if (ProgramStatics.MODS) {
// await this.postSptModLoader.load();
// } TODO: needs to be implemented
throw new NotImplementedException();
}
public string GetRoute()
{
throw new NotImplementedException();
return "spt-mods";
}
}
+15 -6
View File
@@ -1,13 +1,22 @@
using Core.Models.Eft.Common;
using Core.Annotations;
using Core.Controllers;
using Core.Models.Eft.Common;
using Core.Models.Eft.ItemEvent;
using Core.Models.Eft.Notes;
namespace Core.Callbacks;
[Injectable]
public class NoteCallbacks
{
public NoteCallbacks()
protected NoteController _noteController;
public NoteCallbacks
(
NoteController noteController
)
{
_noteController = noteController;
}
/// <summary>
@@ -20,7 +29,7 @@ public class NoteCallbacks
/// <exception cref="NotImplementedException"></exception>
public ItemEventRouterResponse AddNote(PmcData pmcData, NoteActionData info, string sessionID)
{
throw new NotImplementedException();
return _noteController.AddNote(pmcData, info, sessionID);
}
/// <summary>
@@ -33,7 +42,7 @@ public class NoteCallbacks
/// <exception cref="NotImplementedException"></exception>
public ItemEventRouterResponse EditNote(PmcData pmcData, NoteActionData info, string sessionID)
{
throw new NotImplementedException();
return _noteController.EditNote(pmcData, info, sessionID);
}
/// <summary>
@@ -46,6 +55,6 @@ public class NoteCallbacks
/// <exception cref="NotImplementedException"></exception>
public ItemEventRouterResponse DeleteNote(PmcData pmcData, NoteActionData info, string sessionID)
{
throw new NotImplementedException();
return _noteController.DeleteNote(pmcData, info, sessionID);
}
}
}
+46 -11
View File
@@ -1,14 +1,34 @@
using Core.Models.Eft.Common;
using Core.Annotations;
using Core.Controllers;
using Core.Helpers;
using Core.Models.Eft.Common;
using Core.Models.Eft.Common.Request;
using Core.Models.Eft.HttpResponse;
using Core.Models.Eft.Notifier;
using Core.Utils;
namespace Core.Callbacks;
[Injectable]
public class NotifierCallbacks
{
public NotifierCallbacks()
protected HttpResponseUtil _httpResponseUtil;
protected HttpServerHelper _httpServerHelper;
protected JsonUtil _jsonUtil;
protected NotifierController _notifierController;
public NotifierCallbacks
(
HttpResponseUtil httpResponseUtil,
HttpServerHelper httpServerHelper,
JsonUtil jsonUtil,
NotifierController notifierController
)
{
_httpResponseUtil = httpResponseUtil;
_httpServerHelper = httpServerHelper;
_jsonUtil = jsonUtil;
_notifierController = notifierController;
}
/**
@@ -19,6 +39,14 @@ public class NotifierCallbacks
*/
public void SendNotification(string sessionID, object req, object resp, object data) // TODO: no types were given
{
// var splitUrl = req.Url.Split("/");
// var tmpSessionID = splitUrl[splitUrl.Length - 1].Split("?last_id")[0];
/**
* Take our array of JSON message objects and cast them to JSON strings, so that they can then
* be sent to client as NEWLINE separated strings... yup.
*/
// _notifierController.NotifyAsync(tmpSessionID)
throw new NotImplementedException();
}
@@ -32,9 +60,9 @@ public class NotifierCallbacks
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public GetBodyResponseData<List<object>> GetNotifier(string url, object info, string sessionID) // TODO: no types were given
public string GetNotifier(string url, object info, string sessionID) // TODO: no types were given
{
throw new NotImplementedException();
return _httpResponseUtil.EmptyArrayResponse();
}
/// <summary>
@@ -45,9 +73,9 @@ public class NotifierCallbacks
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public GetBodyResponseData<NotifierChannel> CreateNotifierChannel(string url, EmptyRequestData info, string sessionID)
public string CreateNotifierChannel(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_notifierController.GetChannel(sessionID));
}
/// <summary>
@@ -58,13 +86,20 @@ public class NotifierCallbacks
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public GetBodyResponseData<SelectProfileResponse> SelectProfile(string url, UIDRequestData info, string sessionID)
public string SelectProfile(string url, UIDRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(new SelectProfileResponse() { Status = "ok" });
}
public string Notify(string url, object info, string sessionID) // TODO: no types were given
/// <summary>
///
/// </summary>
/// <param name="url"></param>
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
public string Notify(string url, object info, string sessionID)
{
throw new NotImplementedException();
return "NOTIFY";
}
}
}
+10 -3
View File
@@ -1,4 +1,5 @@
using Core.Annotations;
using Core.Controllers;
using Core.DI;
namespace Core.Callbacks;
@@ -6,17 +7,23 @@ namespace Core.Callbacks;
[Injectable(TypePriority = OnLoadOrder.PresetCallbacks)]
public class PresetCallbacks : OnLoad
{
public PresetCallbacks()
protected PresetController _presetController;
public PresetCallbacks
(
PresetController presetController
)
{
_presetController = presetController;
}
public async Task OnLoad()
{
throw new NotImplementedException();
_presetController.Initialize();
}
public string GetRoute()
{
throw new NotImplementedException();
return "spt-presets";
}
}
+24 -7
View File
@@ -1,13 +1,30 @@
using Core.Models.Eft.Common;
using Core.Annotations;
using Core.Controllers;
using Core.Helpers;
using Core.Models.Eft.Common;
using Core.Models.Eft.Common.Tables;
using Core.Models.Eft.HttpResponse;
using Core.Utils;
namespace Core.Callbacks;
[Injectable]
public class PrestigeCallbacks
{
public PrestigeCallbacks()
protected HttpServerHelper _httpServerHelper;
protected HttpResponseUtil _httpResponseUtil;
protected PrestigeController _prestigeController;
public PrestigeCallbacks
(
HttpServerHelper httpServerHelper,
HttpResponseUtil httpResponseUtil,
PrestigeController prestigeController
)
{
_httpServerHelper = httpServerHelper;
_httpResponseUtil = httpResponseUtil;
_prestigeController = prestigeController;
}
/// <summary>
@@ -18,9 +35,9 @@ public class PrestigeCallbacks
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public GetBodyResponseData<Prestige> GetPrestige(string url, EmptyRequestData info, string sessionID)
public string GetPrestige(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_prestigeController.GetPrestige(sessionID, info));
}
/// <summary>
@@ -31,8 +48,8 @@ public class PrestigeCallbacks
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public GetBodyResponseData<object> ObtainPrestige(string url, EmptyRequestData info, string sessionID)
public string ObtainPrestige(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_prestigeController.ObtainPrestige(sessionID, info));
}
}
}
+26 -21
View File
@@ -12,22 +12,22 @@ namespace Core.Callbacks;
public class ProfileCallbacks
{
protected HttpResponseUtil _httpResponse;
protected TimeUtil _timeUtil;
protected ProfileController _profileController;
protected ProfileHelper _profileHelper;
protected TimeUtil _timeUtil;
protected ProfileController _profileController;
protected ProfileHelper _profileHelper;
public ProfileCallbacks(
HttpResponseUtil httpResponse,
TimeUtil timeUtil,
ProfileController profileController,
ProfileHelper profileHelper
)
{
_httpResponse = httpResponse;
_timeUtil = timeUtil;
_profileController = profileController;
_profileHelper = profileHelper;
}
public ProfileCallbacks(
HttpResponseUtil httpResponse,
TimeUtil timeUtil,
ProfileController profileController,
ProfileHelper profileHelper
)
{
_httpResponse = httpResponse;
_timeUtil = timeUtil;
_profileController = profileController;
_profileHelper = profileHelper;
}
/**
* Handle client/game/profile/create
@@ -35,7 +35,7 @@ public class ProfileCallbacks
public string CreateProfile(string url, ProfileCreateRequestData info, string sessionID)
{
var id = _profileController.CreateProfile(info, sessionID);
return _httpResponse.GetBody(new CreateProfileResponse(){ UserId = id });
return _httpResponse.GetBody(new CreateProfileResponse() { UserId = id });
}
/**
@@ -56,7 +56,8 @@ public class ProfileCallbacks
* @param sessionID Session id
* @returns Profile object
*/
public string RegenerateScav(string url, EmptyRequestData info, string sessionID) {
public string RegenerateScav(string url, EmptyRequestData info, string sessionID)
{
return _httpResponse.GetBody(new List<PmcData>() { _profileController.GeneratePlayerScav(sessionID) });
}
@@ -77,11 +78,13 @@ public class ProfileCallbacks
{
var output = _profileController.ChangeNickname(info, sessionID);
if (output == "taken") {
if (output == "taken")
{
return _httpResponse.GetBody<object?>(null, 255, "The nickname is already in use");
}
if (output == "tooshort") {
if (output == "tooshort")
{
return _httpResponse.GetBody<object?>(null, 1, "The nickname is too short");
}
@@ -95,11 +98,13 @@ public class ProfileCallbacks
{
var output = _profileController.ValidateNickname(info, sessionID);
if (output == "taken") {
if (output == "taken")
{
return _httpResponse.GetBody<object?>(null, 255, "225 - ");
}
if (output == "tooshort") {
if (output == "tooshort")
{
return _httpResponse.GetBody<object?>(null, 256, "256 - ");
}
+30 -11
View File
@@ -1,15 +1,31 @@
using Core.Models.Eft.Common;
using Core.Annotations;
using Core.Controllers;
using Core.Models.Eft.Common;
using Core.Models.Eft.Common.Tables;
using Core.Models.Eft.HttpResponse;
using Core.Models.Eft.ItemEvent;
using Core.Models.Eft.Quests;
using Core.Utils;
namespace Core.Callbacks;
[Injectable]
public class QuestCallbacks
{
public QuestCallbacks()
protected HttpResponseUtil _httpResponseUtil;
protected QuestController _questController;
protected RepeatableQuestController _repeatableQuestController;
public QuestCallbacks
(
HttpResponseUtil httpResponseUtil,
QuestController questController,
RepeatableQuestController repeatableQuestController
)
{
_httpResponseUtil = httpResponseUtil;
_questController = questController;
_repeatableQuestController = repeatableQuestController;
}
/// <summary>
@@ -22,7 +38,7 @@ public class QuestCallbacks
/// <exception cref="NotImplementedException"></exception>
public ItemEventRouterResponse ChangeRepeatableQuest(PmcData pmcData, RepeatableQuestChangeRequest info, string sessionID)
{
throw new NotImplementedException();
return _repeatableQuestController.ChangeRepeatableQuest(pmcData, info, sessionID);
}
/// <summary>
@@ -35,7 +51,10 @@ public class QuestCallbacks
/// <exception cref="NotImplementedException"></exception>
public ItemEventRouterResponse AcceptQuest(PmcData pmcData, AcceptQuestRequestData info, string sessionID)
{
throw new NotImplementedException();
if (info.Type == "repeatable")
return _questController.AcceptRepeatableQuest(pmcData, info, sessionID);
return _questController.AcceptQuest(pmcData, info, sessionID);
}
/// <summary>
@@ -48,7 +67,7 @@ public class QuestCallbacks
/// <exception cref="NotImplementedException"></exception>
public ItemEventRouterResponse CompleteQuest(PmcData pmcData, CompleteQuestRequestData info, string sessionID)
{
throw new NotImplementedException();
return _questController.CompleteQuest(pmcData, info, sessionID);
}
/// <summary>
@@ -61,7 +80,7 @@ public class QuestCallbacks
/// <exception cref="NotImplementedException"></exception>
public ItemEventRouterResponse HandoverQuest(PmcData pmcData, HandoverQuestRequestData info, string sessionID)
{
throw new NotImplementedException();
return _questController.HandoverQuest(pmcData, info, sessionID);
}
/// <summary>
@@ -72,9 +91,9 @@ public class QuestCallbacks
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public GetBodyResponseData<List<Quest>> ListQuests(string url, ListQuestsRequestData info, string sessionID)
public string ListQuests(string url, ListQuestsRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_questController.GetClientQuest(sessionID));
}
/// <summary>
@@ -85,8 +104,8 @@ public class QuestCallbacks
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public GetBodyResponseData<List<PmcDataRepeatableQuest>> ActivityPeriods(string url, EmptyRequestData info, string sessionID)
public string ActivityPeriods(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_repeatableQuestController.GetClientRepeatableQuests(sessionID));
}
}
}
+63 -32
View File
@@ -1,34 +1,72 @@
using Core.Annotations;
using Core.Controllers;
using Core.DI;
using Core.Models.Eft.Common;
using Core.Models.Eft.HttpResponse;
using Core.Models.Eft.ItemEvent;
using Core.Models.Eft.Ragfair;
using Core.Models.Enums;
using Core.Models.Spt.Config;
using Core.Servers;
using Core.Services;
using Core.Utils;
namespace Core.Callbacks;
[Injectable(TypePriority = OnLoadOrder.RagfairCallbacks)]
public class RagfairCallbacks : OnLoad, OnUpdate
{
protected HttpResponseUtil _httpResponseUtil;
// protected RagfairServer _ragfairServer;
protected RagfairController _ragfairController;
protected RagfairTaxService _ragfairTaxService;
protected ConfigServer _configServer;
private RagfairConfig _ragfairConfig;
public RagfairCallbacks()
public RagfairCallbacks
(
HttpResponseUtil httpResponseUtil,
// RagfairServer ragfairServer,
RagfairController ragfairController,
RagfairTaxService ragfairTaxService,
ConfigServer configServer
)
{
_httpResponseUtil = httpResponseUtil;
// _ragfairServer = ragfairServer;
_ragfairController = ragfairController;
_ragfairTaxService = ragfairTaxService;
_configServer = configServer;
_ragfairConfig = _configServer.GetConfig<RagfairConfig>(ConfigTypes.RAGFAIR);
}
public async Task OnLoad()
{
throw new NotImplementedException();
// await _ragfairServer.Load();
// TODO: implement RagfairServer
}
public string GetRoute()
{
throw new NotImplementedException();
return "spt-ragfair";
}
public async Task<bool> OnUpdate(long timeSinceLastRun)
{
// if (timeSinceLastRun > this.ragfairConfig.runIntervalSeconds) {
// // There is a flag inside this class that only makes it run once.
// this.ragfairServer.addPlayerOffers();
//
// // Check player offers and mail payment to player if sold
// this.ragfairController.update();
//
// // Process all offers / expire offers
// await this.ragfairServer.update();
//
// return true;
// }
// return false;
throw new NotImplementedException();
}
@@ -40,10 +78,9 @@ public class RagfairCallbacks : OnLoad, OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public GetBodyResponseData<GetOffersResult> Search(string url, SearchRequestData info, string sessionID)
public string Search(string url, SearchRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_ragfairController.GetOffers(sessionID, info));
}
/// <summary>
@@ -53,49 +90,45 @@ public class RagfairCallbacks : OnLoad, OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public GetBodyResponseData<GetItemPriceResult> GetMarketPrice(string url, GetMarketPriceRequestData info, string sessionID)
public string GetMarketPrice(string url, GetMarketPriceRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_ragfairController.GetItemMinAvgMaxFleaPriceValues(info));
}
/// <summary>
/// Handle RagFairAddOffer event
/// </summary>
/// <param name="url"></param>
/// <param name="pmcData"></param>
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public ItemEventRouterResponse AddOffer(string url, AddOfferRequestData info, string sessionID)
public ItemEventRouterResponse AddOffer(PmcData pmcData, AddOfferRequestData info, string sessionID)
{
throw new NotImplementedException();
return _ragfairController.AddPlayerOffer(pmcData, info, sessionID);
}
/// <summary>
/// Handle RagFairRemoveOffer event
/// </summary>
/// <param name="url"></param>
/// <param name="pmcData"></param>
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public ItemEventRouterResponse RemoveOffer(string url, RemoveOfferRequestData info, string sessionID)
public ItemEventRouterResponse RemoveOffer(PmcData pmcData, RemoveOfferRequestData info, string sessionID)
{
throw new NotImplementedException();
return _ragfairController.RemoveOffer(pmcData, info, sessionID);
}
/// <summary>
/// Handle RagFairRenewOffer event
/// </summary>
/// <param name="url"></param>
/// <param name="pmcData"></param>
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public ItemEventRouterResponse ExtendOffer(string url, ExtendOfferRequestData info, string sessionID)
public ItemEventRouterResponse ExtendOffer(PmcData pmcData, ExtendOfferRequestData info, string sessionID)
{
throw new NotImplementedException();
return _ragfairController.ExtendOffer(pmcData, info, sessionID);
}
/// <summary>
@@ -106,10 +139,9 @@ public class RagfairCallbacks : OnLoad, OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public GetBodyResponseData<Dictionary<string, int>> GetFleaPrices(string url, EmptyRequestData info, string sessionID)
public string GetFleaPrices(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_ragfairController.GetAllFleaPrices());
}
/// <summary>
@@ -119,15 +151,15 @@ public class RagfairCallbacks : OnLoad, OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public NullResponseData SendReport(string url, SendRagfairReportRequestData info, string sessionID)
public string SendReport(string url, SendRagfairReportRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.NullResponse();
}
public NullResponseData StorePlayerOfferTaxAmount(string url, StorePlayerOfferTaxAmountRequestData info, string sessionID)
public string StorePlayerOfferTaxAmount(string url, StorePlayerOfferTaxAmountRequestData info, string sessionID)
{
throw new NotImplementedException();
_ragfairTaxService.StoreClientOfferTaxValue(sessionID, info);
return _httpResponseUtil.NullResponse();
}
/// <summary>
@@ -137,9 +169,8 @@ public class RagfairCallbacks : OnLoad, OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public GetBodyResponseData<RagfairOffer> GetFleaOfferById(string url, GetRagfairOfferByIdRequest info, string sessionID)
public string GetFleaOfferById(string url, GetRagfairOfferByIdRequest info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_ragfairController.GetOfferById(sessionID, info));
}
}
+14 -7
View File
@@ -1,13 +1,22 @@
using Core.Models.Eft.Common;
using Core.Annotations;
using Core.Controllers;
using Core.Models.Eft.Common;
using Core.Models.Eft.ItemEvent;
using Core.Models.Eft.Repair;
namespace Core.Callbacks;
[Injectable]
public class RepairCallbacks
{
public RepairCallbacks()
protected RepairController _repairController;
public RepairCallbacks
(
RepairController repairController
)
{
_repairController = repairController;
}
/// <summary>
@@ -18,10 +27,9 @@ public class RepairCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public ItemEventRouterResponse TraderRepair(PmcData pmcData, TraderRepairActionDataRequest info, string sessionID)
{
throw new NotImplementedException();
return _repairController.TraderRepair(sessionID, info, pmcData);
}
/// <summary>
@@ -32,9 +40,8 @@ public class RepairCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public ItemEventRouterResponse Repair(PmcData pmcData, RepairActionDataRequest info, string sessionID)
{
throw new NotImplementedException();
return _repairController.RepairWithKit(sessionID, info, pmcData);
}
}
}
+15 -9
View File
@@ -1,13 +1,22 @@
using Core.Models.Eft.Common;
using Core.Annotations;
using Core.Controllers;
using Core.Models.Eft.Common;
using Core.Models.Eft.ItemEvent;
using Core.Models.Eft.Trade;
namespace Core.Callbacks;
[Injectable]
public class TradeCallbacks
{
public TradeCallbacks()
protected TradeController _tradeController;
public TradeCallbacks
(
TradeController tradeController
)
{
_tradeController = tradeController;
}
/// <summary>
@@ -17,10 +26,9 @@ public class TradeCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public ItemEventRouterResponse ProcessTrade(PmcData pmcData, ProcessBaseTradeRequestData info, string sessionID)
{
throw new NotImplementedException();
return _tradeController.ConfirmTrading(pmcData, info, sessionID);
}
/// <summary>
@@ -30,10 +38,9 @@ public class TradeCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public ItemEventRouterResponse ProcessRagfairTrade(PmcData pmcData, ProcessRagfairTradeRequestData info, string sessionID)
{
throw new NotImplementedException();
return _tradeController.ConfirmRagfairTrading(pmcData, info, sessionID);
}
/// <summary>
@@ -43,9 +50,8 @@ public class TradeCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public ItemEventRouterResponse SellAllFromSavage(PmcData pmcData, SellScavItemsToFenceRequestData info, string sessionID)
{
throw new NotImplementedException();
return _tradeController.SellScavItemsToFence(pmcData, info, sessionID);
}
}
}
+31 -16
View File
@@ -1,32 +1,48 @@
using Core.Annotations;
using Core.Controllers;
using Core.DI;
using Core.Models.Eft.Common;
using Core.Models.Eft.Common.Tables;
using Core.Models.Eft.HttpResponse;
using Core.Models.Enums;
using Core.Models.Spt.Config;
using Core.Servers;
using Core.Utils;
namespace Core.Callbacks;
[Injectable(TypePriority = OnLoadOrder.TraderCallbacks)]
public class TraderCallbacks : OnLoad, OnUpdate
{
public TraderCallbacks()
protected HttpResponseUtil _httpResponseUtil;
protected TraderController _traderController;
protected ConfigServer _configServer;
public TraderCallbacks
(
HttpResponseUtil httpResponseUtil,
TraderController traderController,
ConfigServer configServer
)
{
_httpResponseUtil = httpResponseUtil;
_traderController = traderController;
_configServer = configServer;
}
public async Task OnLoad()
{
throw new NotImplementedException();
_traderController.Load();
}
public async Task<bool> OnUpdate(long _)
{
throw new NotImplementedException();
return _traderController.Update();
}
public string GetRoute()
{
throw new NotImplementedException();
return "spt-traders";
}
/// <summary>
@@ -36,10 +52,9 @@ public class TraderCallbacks : OnLoad, OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public GetBodyResponseData<List<TraderBase>> GetTraderSettings(string url, EmptyRequestData info, string sessionID)
public string GetTraderSettings(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_traderController.GetAllTraders(sessionID));
}
/// <summary>
@@ -49,10 +64,10 @@ public class TraderCallbacks : OnLoad, OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public GetBodyResponseData<TraderBase> GetTrader(string url, EmptyRequestData info, string sessionID)
public string GetTrader(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
var traderID = url.Replace("/client/trading/api/getTrader/", "");
return _httpResponseUtil.GetBody(_traderController.GetTrader(sessionID, traderID));
}
/// <summary>
@@ -62,10 +77,10 @@ public class TraderCallbacks : OnLoad, OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public GetBodyResponseData<TraderAssort> GetAssort(string url, EmptyRequestData info, string sessionID)
public string GetAssort(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
var traderID = url.Replace("/client/trading/api/getTraderAssort/", "");
return _httpResponseUtil.GetBody(_traderController.GetAssort(sessionID, traderID));
}
/// <summary>
@@ -75,9 +90,9 @@ public class TraderCallbacks : OnLoad, OnUpdate
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public GetBodyResponseData<ModdedTraders> GetModdedTraderData(string url, EmptyRequestData info, string sessionID)
public string GetModdedTraderData(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
var traderConfig = _configServer.GetConfig<TraderConfig>(ConfigTypes.TRADER);
return _httpResponseUtil.NoBody(traderConfig.ModdedTraders);
}
}
+20 -9
View File
@@ -1,14 +1,27 @@
using Core.Models.Eft.Common;
using Core.Annotations;
using Core.Controllers;
using Core.Models.Eft.Common;
using Core.Models.Eft.HttpResponse;
using Core.Models.Eft.Weather;
using Core.Models.Spt.Weather;
using Core.Utils;
namespace Core.Callbacks;
[Injectable]
public class WeatherCallbacks
{
public WeatherCallbacks()
protected HttpResponseUtil _httpResponseUtil;
protected WeatherController _weatherController;
public WeatherCallbacks
(
HttpResponseUtil httpResponseUtil,
WeatherController weatherController
)
{
_httpResponseUtil = httpResponseUtil;
_weatherController = weatherController;
}
/// <summary>
@@ -18,10 +31,9 @@ public class WeatherCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public GetBodyResponseData<WeatherData> GetWeather(string url, EmptyRequestData info, string sessionID)
public string GetWeather(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_weatherController.Generate());
}
/// <summary>
@@ -31,9 +43,8 @@ public class WeatherCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public GetBodyResponseData<GetLocalWeatherResponseData> GetLocalWeather(string url, EmptyRequestData info, string sessionID)
public string GetLocalWeather(string url, EmptyRequestData info, string sessionID)
{
throw new NotImplementedException();
return _httpResponseUtil.GetBody(_weatherController.GenerateLocal(sessionID));
}
}
}
+15 -9
View File
@@ -1,13 +1,22 @@
using Core.Models.Eft.Common;
using Core.Annotations;
using Core.Controllers;
using Core.Models.Eft.Common;
using Core.Models.Eft.ItemEvent;
using Core.Models.Eft.Wishlist;
namespace Core.Callbacks;
[Injectable]
public class WishlistCallbacks
{
public WishlistCallbacks()
protected WishlistController _wishlistController;
public WishlistCallbacks
(
WishlistController wishlistController
)
{
_wishlistController = wishlistController;
}
/// <summary>
@@ -17,10 +26,9 @@ public class WishlistCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public ItemEventRouterResponse AddToWishlist(PmcData pmcData, AddToWishlistRequest info, string sessionID)
{
throw new NotImplementedException();
return _wishlistController.AddToWishList(pmcData, info, sessionID);
}
/// <summary>
@@ -30,10 +38,9 @@ public class WishlistCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public ItemEventRouterResponse RemoveFromWishlist(PmcData pmcData, RemoveFromWishlistRequest info, string sessionID)
{
throw new NotImplementedException();
return _wishlistController.RemoveFromWishList(pmcData, info, sessionID);
}
/// <summary>
@@ -43,9 +50,8 @@ public class WishlistCallbacks
/// <param name="info"></param>
/// <param name="sessionID"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public ItemEventRouterResponse ChangeWishlistItemCategory(PmcData pmcData, ChangeWishlistItemCategoryRequest info, string sessionID)
{
throw new NotImplementedException();
return _wishlistController.ChangeWishListItemCategory(pmcData, info, sessionID);
}
}
}
+31 -5
View File
@@ -1,20 +1,46 @@
using Core.Models.Eft.Profile;
using Core.Annotations;
using Core.Models.Eft.Profile;
using Core.Services;
namespace Core.Controllers;
[Injectable]
public class AchievementController
{
public AchievementController()
protected Core.Models.Utils.ILogger _logger;
protected DatabaseService _databaseService;
public AchievementController
(
Core.Models.Utils.ILogger logger,
DatabaseService databaseService
)
{
_logger = logger;
_databaseService = databaseService;
}
public GetAchievementsResponse GetAchievements(string sessionID)
{
throw new NotImplementedException();
return new()
{
Achievements = _databaseService.GetAchievements()
};
}
public CompletedAchievementsResponse GetAchievementStatics(string sessionID)
{
throw new NotImplementedException();
var achievements = _databaseService.GetAchievements();
var stats = new Dictionary<string, int>();
foreach (var achievement in achievements)
{
stats.Add(achievement.Id, 0);
}
return new()
{
Elements = stats
};
}
}
}
+99 -12
View File
@@ -1,44 +1,131 @@
using Core.Models.Common;
using Core.Context;
using Core.Generators;
using Core.Helpers;
using Core.Models.Common;
using Core.Models.Eft.Bot;
using Core.Models.Eft.Common;
using Core.Models.Eft.Common.Tables;
using Core.Models.Eft.Match;
using Core.Models.Enums;
using Core.Models.Spt.Bots;
using Core.Models.Spt.Config;
using Core.Servers;
using Core.Services;
using Core.Utils;
using Core.Utils.Cloners;
using Condition = Core.Models.Spt.Config.Condition;
using ILogger = Core.Models.Utils.ILogger;
namespace Core.Controllers;
public class BotController
{
private BotConfig _botConfig;
private PmcConfig _pmcConfig;
protected ILogger _logger;
public BotController()
protected DatabaseService _databaseService;
protected BotGenerator _botGenerator;
protected BotHelper _botHelper;
protected BotDifficultyHelper _botDifficultyHelper;
protected WeightedRandomHelper _weightedRandomHelper;
protected BotGenerationCacheService _botGenerationCacheService;
protected MatchBotDeatilsCacheService _matchBotDeatilsCacheService;
protected LocalisationService _localisationService;
protected SeasonalEventService _seasonalEventService;
protected ProfileHelper _profileHelper;
protected ConfigServer _configServer;
protected ApplicationContext _applicationContext;
protected RandomUtil _randomUtil;
protected ICloner _cloner;
protected BotConfig _botConfig;
protected PmcConfig _pmcConfig;
public BotController
(
ILogger logger,
DatabaseService databaseService,
BotGenerator botGenerator,
BotHelper botHelper,
BotDifficultyHelper botDifficultyHelper,
WeightedRandomHelper weightedRandomHelper,
BotGenerationCacheService botGenerationCacheService,
MatchBotDeatilsCacheService matchBotDeatilsCacheService,
LocalisationService localisationService,
SeasonalEventService seasonalEventService,
ProfileHelper profileHelper,
ConfigServer configServer,
ApplicationContext applicationContext,
RandomUtil randomUtil,
ICloner cloner
)
{
_logger = logger;
_databaseService = databaseService;
_botGenerator = botGenerator;
_botHelper = botHelper;
_botDifficultyHelper = botDifficultyHelper;
_weightedRandomHelper = weightedRandomHelper;
_botGenerationCacheService = botGenerationCacheService;
_matchBotDeatilsCacheService = matchBotDeatilsCacheService;
_localisationService = localisationService;
_seasonalEventService = seasonalEventService;
_profileHelper = profileHelper;
_configServer = configServer;
_applicationContext = applicationContext;
_randomUtil = randomUtil;
_cloner = cloner;
_botConfig = _configServer.GetConfig<BotConfig>(ConfigTypes.BOT);
_pmcConfig = _configServer.GetConfig<PmcConfig>(ConfigTypes.PMC);
}
public int GetBotPresetGenerationLimit(string type)
{
throw new NotImplementedException();
var typeInLower = type.ToLower();
var value = (int)typeof(PresetBatch).GetProperties().First(p => p.Name.ToLower() == (typeInLower == "assaultgroup" ? "assault" : typeInLower))
.GetValue(_botConfig.PresetBatch);
if (value == null)
{
_logger.Warning(_localisationService.GetText("bot-bot_preset_count_value_missing", type));
return 30;
}
return value;
}
public Dictionary<string, object> GetBotCoreDifficulty()
{
throw new NotImplementedException();
return _databaseService.GetBots().Core;
}
public object GetBotDifficulty(string type, string difficulty) // TODO: return type was: IBotCore | IDifficultyCategories
public DifficultyCategories GetBotDifficulty(string type, string diffLevel, GetRaidConfigurationRequestData raidConfig, bool ignoreRaidSettings = false)
{
throw new NotImplementedException();
var difficulty = diffLevel.ToLower();
if (!(raidConfig != null || ignoreRaidSettings)) // TODD: this might be wrong logic
_logger.Error(_localisationService.GetText("bot-missing_application_context", "RAID_CONFIGURATION"));
// Check value chosen in pre-raid difficulty dropdown
// If value is not 'asonline', change requested difficulty to be what was chosen in dropdown
var botDifficultyDropDownValue = raidConfig?.WavesSettings?.BotDifficulty?.ToString().ToLower() ?? "asonline";
if (botDifficultyDropDownValue != "asonline")
difficulty = _botDifficultyHelper.ConvertBotDifficultyDropdownToBotDifficulty(botDifficultyDropDownValue);
var botDb = _databaseService.GetBots();
return _botDifficultyHelper.GetBotDifficultySettings(type, difficulty, botDb);
}
public Dictionary<string, object> GetAllBotDifficulties()
{
throw new NotImplementedException();
var result = new Dictionary<string, object>();
var botTypesDb = _databaseService.GetBots().Types;
// TODO: Come back to this, brainfuck
return result;
}
public async Task<List<BotBase>> Generate(GenerateBotsRequestData info, bool playerscav)
public List<BotBase> Generate(string sessionId, GenerateBotsRequestData info)
{
throw new NotImplementedException();
}
@@ -90,7 +177,7 @@ public class BotController
throw new NotImplementedException();
}
public int GetBotCap()
public int GetBotCap(string location)
{
throw new NotImplementedException();
}
@@ -99,4 +186,4 @@ public class BotController
{
throw new NotImplementedException();
}
}
}
+14 -3
View File
@@ -1,4 +1,5 @@
using Core.Models.Eft.Dialog;
using Core.Models.Eft.HttpResponse;
using Core.Models.Eft.Profile;
using Core.Models.Enums;
@@ -85,7 +86,7 @@ public class DialogueController
/// <param name="sessionId">Session id</param>
/// <returns>GetMailDialogViewResponseData object</returns>
public GetMailDialogViewResponseData GenerateDialogueView(
GetMailDialogViewResponseData request,
GetMailDialogViewRequestData request,
string sessionId)
{
throw new NotImplementedException();
@@ -174,7 +175,7 @@ public class DialogueController
/// <param name="dialogueIds">Dialog ids to set as read</param>
/// <param name="sessionId">Player profile id</param>
public void SetRead(
HashSet<string> dialogueIds,
List<string> dialogueIds,
string sessionId)
{
throw new NotImplementedException();
@@ -250,4 +251,14 @@ public class DialogueController
{
throw new NotImplementedException();
}
}
public FriendRequestSendResponse SendFriendRequest(string sessionId, FriendRequestData request)
{
throw new NotImplementedException();
}
public void DeleteFriend(string sessionID, DeleteFriendRequest request)
{
throw new NotImplementedException();
}
}
+9 -4
View File
@@ -48,7 +48,7 @@ public class GameController
/// <param name="sessionId"></param>
/// <param name="requestData"></param>
/// <returns></returns>
public object GetGameMode( // TODO: Returns `any` in node server
public GameModeResponse GetGameMode(
string sessionId,
GameModeRequestData requestData)
{
@@ -70,12 +70,12 @@ public class GameController
/// </summary>
/// <param name="sessionId"></param>
/// <returns></returns>
/*
public CurrentGroupResponse GetCurrentGroup(string sessionId)
{
throw new NotImplementedException();
}
*/
/// <summary>
/// Handle client/checkVersion
@@ -182,4 +182,9 @@ public class GameController
{
throw new NotImplementedException();
}
}
public void Load()
{
throw new NotImplementedException();
}
}
+40 -3
View File
@@ -1,9 +1,46 @@
using Core.Context;
using Core.Helpers;
using Core.Models.Eft.InRaid;
using Core.Models.Enums;
using Core.Models.Spt.Config;
using Core.Servers;
using Core.Services;
using ILogger = Core.Models.Utils.ILogger;
namespace Core.Controllers;
public class InRaidController
{
protected ILogger _logger;
protected SaveServer _saveServer;
protected ProfileHelper _profileHelper;
protected LocalisationService _localisationService;
protected ApplicationContext _applicationContext;
protected ConfigServer _configServer;
protected InRaidConfig _inRaidConfig;
protected BotConfig _botConfig;
public InRaidController
(
ILogger logger,
SaveServer saveServer,
ProfileHelper profileHelper,
LocalisationService localisationService,
ApplicationContext applicationContext,
ConfigServer configServer
)
{
_logger = logger;
_saveServer = saveServer;
_profileHelper = profileHelper;
_localisationService = localisationService;
_applicationContext = applicationContext;
_configServer = configServer;
_inRaidConfig = configServer.GetConfig<InRaidConfig>(ConfigTypes.IN_RAID);
_botConfig = configServer.GetConfig<BotConfig>(ConfigTypes.BOT);
}
/// <summary>
/// Save locationId to active profiles in-raid object AND app context
/// </summary>
@@ -33,9 +70,9 @@ public class InRaidController
/// <summary>
/// Get the inraid config from configs/inraid.json
/// </summary>
public void GetInRaidConfig()
public InRaidConfig GetInRaidConfig()
{
throw new NotImplementedException();
return _inRaidConfig;
}
/// <summary>
@@ -63,4 +100,4 @@ public class InRaidController
{
throw new NotImplementedException();
}
}
}
+1 -1
View File
@@ -93,4 +93,4 @@ public class MatchController
{
throw new NotImplementedException();
}
}
}
+30 -1
View File
@@ -1,6 +1,35 @@
using Core.Models.Eft.Common;
using Core.Models.Eft.Common.Tables;
using Core.Models.Eft.ItemEvent;
using Core.Models.Eft.Quests;
namespace Core.Controllers;
public class QuestController
{
// TODO
}
public ItemEventRouterResponse CompleteQuest(PmcData pmcData, CompleteQuestRequestData info, string sessionId)
{
throw new NotImplementedException();
}
public ItemEventRouterResponse AcceptRepeatableQuest(PmcData pmcData, AcceptQuestRequestData info, string sessionId)
{
throw new NotImplementedException();
}
public ItemEventRouterResponse AcceptQuest(PmcData pmcData, AcceptQuestRequestData info, string sessionId)
{
throw new NotImplementedException();
}
public ItemEventRouterResponse HandoverQuest(PmcData pmcData, HandoverQuestRequestData info, string sessionId)
{
throw new NotImplementedException();
}
public List<Quest> GetClientQuest(string sessionId)
{
throw new NotImplementedException();
}
}
+39 -1
View File
@@ -1,6 +1,44 @@
using Core.Models.Eft.Common;
using Core.Models.Eft.ItemEvent;
using Core.Models.Eft.Ragfair;
namespace Core.Controllers;
public class RagfairController
{
// TODO
}
public GetOffersResult GetOffers(string sessionId, SearchRequestData info)
{
throw new NotImplementedException();
}
public GetItemPriceResult GetItemMinAvgMaxFleaPriceValues(GetMarketPriceRequestData info)
{
throw new NotImplementedException();
}
public ItemEventRouterResponse AddPlayerOffer(PmcData pmcData, AddOfferRequestData info, string sessionId)
{
throw new NotImplementedException();
}
public ItemEventRouterResponse RemoveOffer(PmcData pmcData, RemoveOfferRequestData info, string sessionId)
{
throw new NotImplementedException();
}
public ItemEventRouterResponse ExtendOffer(PmcData pmcData, ExtendOfferRequestData info, string sessionId)
{
throw new NotImplementedException();
}
public Dictionary<string, double> GetAllFleaPrices()
{
throw new NotImplementedException();
}
public RagfairOffer GetOfferById(string sessionId, GetRagfairOfferByIdRequest info)
{
throw new NotImplementedException();
}
}
+15 -1
View File
@@ -1,6 +1,20 @@
using Core.Models.Eft.Common;
using Core.Models.Eft.Common.Tables;
using Core.Models.Eft.ItemEvent;
using Core.Models.Eft.Quests;
namespace Core.Controllers;
public class RepeatableQuestController
{
// TODO
}
public ItemEventRouterResponse ChangeRepeatableQuest(PmcData pmcData, RepeatableQuestChangeRequest info, string sessionId)
{
throw new NotImplementedException();
}
public List<PmcDataRepeatableQuest> GetClientRepeatableQuests(string sessionId)
{
throw new NotImplementedException();
}
}
+2 -2
View File
@@ -79,8 +79,8 @@ public class TraderController
/// Handle client/items/prices/TRADERID
/// </summary>
/// <returns></returns>
public GetItemPricesResponse GetItemPrices()
public GetItemPricesResponse GetItemPrices(string sessionId, string traderId)
{
throw new NotImplementedException();
}
}
}
@@ -0,0 +1,9 @@
using System.Text.Json.Serialization;
namespace Core.Models.Eft.Dialog;
public class GetAllAttachmentsRequestData
{
[JsonPropertyName("dialogId")]
public string DialogId { get; set; }
}
@@ -5,5 +5,5 @@ namespace Core.Models.Eft.Dialog;
public class SetDialogReadRequestData
{
[JsonPropertyName("dialogId")]
public List<string>? DialogId { get; set; }
}
public List<string>? Dialogs { get; set; }
}
+4 -2
View File
@@ -1,8 +1,10 @@
namespace Core.Services;
using Core.Models.Eft.Ragfair;
namespace Core.Services;
public class RagfairTaxService
{
public void StoreClientOfferTaxValue(string sessionId, Dictionary<string, object> offer)
public void StoreClientOfferTaxValue(string sessionId, StorePlayerOfferTaxAmountRequestData offer)
{
throw new NotImplementedException();
}