diff --git a/project/Aki.Launcher.Base/Controllers/RequestHandler.cs b/project/Aki.Launcher.Base/Controllers/RequestHandler.cs index 52e9447..3aef72d 100644 --- a/project/Aki.Launcher.Base/Controllers/RequestHandler.cs +++ b/project/Aki.Launcher.Base/Controllers/RequestHandler.cs @@ -94,5 +94,15 @@ namespace Aki.Launcher { return request.GetJson("/launcher/profile/compatibleTarkovVersion"); } + + public static string RequestLoadedServerMods() + { + return request.GetJson("/launcher/server/loadedServerMods"); + } + + public static string RequestProfileMods() + { + return request.GetJson("/launcher/server/serverModsUsedByProfile"); + } } } diff --git a/project/Aki.Launcher.Base/Controllers/ServerManager.cs b/project/Aki.Launcher.Base/Controllers/ServerManager.cs index d047cc3..ab76001 100644 --- a/project/Aki.Launcher.Base/Controllers/ServerManager.cs +++ b/project/Aki.Launcher.Base/Controllers/ServerManager.cs @@ -8,6 +8,8 @@ using Aki.Launcher.MiniCommon; +using Aki.Launcher.Models.Aki; +using System.Collections.Generic; using System.Threading.Tasks; namespace Aki.Launcher @@ -62,6 +64,34 @@ namespace Aki.Launcher } } + public static Dictionary GetLoadedServerMods() + { + try + { + string json = RequestHandler.RequestLoadedServerMods(); + + return Json.Deserialize>(json); + } + catch + { + return new Dictionary(); + } + } + + public static AkiProfileModInfo[] GetProfileMods() + { + try + { + string json = RequestHandler.RequestProfileMods(); + + return Json.Deserialize(json); + } + catch + { + return new AkiProfileModInfo[] { }; + } + } + public static void LoadServer(string backendUrl) { string json = ""; diff --git a/project/Aki.Launcher.Base/Helpers/LocalizationProvider.cs b/project/Aki.Launcher.Base/Helpers/LocalizationProvider.cs index c2a1ace..eac6378 100644 --- a/project/Aki.Launcher.Base/Helpers/LocalizationProvider.cs +++ b/project/Aki.Launcher.Base/Helpers/LocalizationProvider.cs @@ -171,6 +171,9 @@ namespace Aki.Launcher.Helpers englishLocale.i_understand = "I Understand"; englishLocale.game_version_mismatch_format_2 = "SPT is unable to run, this is because SPT expected to find EFT version '{1}',\nbut instead found version '{0}'\n\nEnsure you've downgraded your EFT as described in the install guide\non the page you downloaded SPT from"; englishLocale.description = "Description"; + englishLocale.server_mods = "Server Mods"; + englishLocale.profile_mods = "Profile Mods"; + englishLocale.author = "Author"; #endregion Directory.CreateDirectory(LocalizationProvider.DefaultLocaleFolderPath); @@ -1519,6 +1522,55 @@ namespace Aki.Launcher.Helpers } #endregion + #region server_mods + private string _server_mods; + public string server_mods + { + get => _server_mods; + set + { + if (_server_mods != value) + { + _server_mods = value; + RaisePropertyChanged(nameof(server_mods)); + } + } + } + #endregion + + #region profile_mods + private string _profile_mods; + public string profile_mods + { + get => _profile_mods; + set + { + if (_profile_mods != value) + { + _profile_mods = value; + RaisePropertyChanged(nameof(profile_mods)); + } + } + } + #endregion + + #region author + private string _author; + public string author + { + get => _author; + set + { + if (_author != value) + { + _author = value; + RaisePropertyChanged(nameof(author)); + } + } + } + + #endregion + #endregion public event PropertyChangedEventHandler PropertyChanged; diff --git a/project/Aki.Launcher.Base/Models/Aki/AkiMod.cs b/project/Aki.Launcher.Base/Models/Aki/AkiMod.cs new file mode 100644 index 0000000..7bd2dc8 --- /dev/null +++ b/project/Aki.Launcher.Base/Models/Aki/AkiMod.cs @@ -0,0 +1,11 @@ +namespace Aki.Launcher.Models.Aki +{ + public class AkiMod + { + public bool InServer { get; set; } + public bool InProfile { get; set; } + public string Author { get; set; } + public string Name { get; set; } + public string Version { get; set; } + } +} diff --git a/project/Aki.Launcher.Base/Models/Aki/AkiProfileModInfo.cs b/project/Aki.Launcher.Base/Models/Aki/AkiProfileModInfo.cs new file mode 100644 index 0000000..82e8d4c --- /dev/null +++ b/project/Aki.Launcher.Base/Models/Aki/AkiProfileModInfo.cs @@ -0,0 +1,17 @@ +using System; + +namespace Aki.Launcher.Models.Aki +{ + public class AkiProfileModInfo : AkiMod + { + public string DateAdded { get; set; } + } +} + + +/* + "author": "Boop", + "dateAdded": 1687150604114, + "name": "Boop's Quest Zone API", + "version": "1.0.0" +*/ \ No newline at end of file diff --git a/project/Aki.Launcher.Base/Models/Aki/AkiServerModInfo.cs b/project/Aki.Launcher.Base/Models/Aki/AkiServerModInfo.cs new file mode 100644 index 0000000..d53ac3a --- /dev/null +++ b/project/Aki.Launcher.Base/Models/Aki/AkiServerModInfo.cs @@ -0,0 +1,41 @@ +using System.Collections.Generic; + +namespace Aki.Launcher.Models.Aki +{ + public class AkiServerModInfo : AkiMod + { + public string Main { get; set; } + public string License { get; set; } + public string AkiVersion { get; set; } + public Dictionary Scripts { get; set; } + public DevDependencies DevDependencies { get; set; } + } +} + +/* +{ + "wafflelord-ZeroToHeroPlus-1.0.0": { + "name": "ZeroToHeroPlus", + "version": "1.0.0", + "main": "src/mod.ts", + "license": "MIT", + "author": "waffle.lord", + "akiVersion": "~3.6", + "scripts": { + "setup": "npm i", + "build": "node ./packageBuild.ts" + }, + "devDependencies": { + "@types/node": "16.18.10", + "@typescript-eslint/eslint-plugin": "5.46.1", + "@typescript-eslint/parser": "5.46.1", + "bestzip": "2.2.1", + "eslint": "8.30.0", + "fs-extra": "11.1.0", + "glob": "8.0.3", + "tsyringe": "4.7.0", + "typescript": "4.9.4" + } + } +} +*/ \ No newline at end of file diff --git a/project/Aki.Launcher.Base/Models/Aki/DevDependencies.cs b/project/Aki.Launcher.Base/Models/Aki/DevDependencies.cs new file mode 100644 index 0000000..72d1ef9 --- /dev/null +++ b/project/Aki.Launcher.Base/Models/Aki/DevDependencies.cs @@ -0,0 +1,37 @@ +using Newtonsoft.Json; + +namespace Aki.Launcher.Models.Aki +{ + public class DevDependencies + { + [JsonProperty("@types/node")] + public string TypesNode { get; set; } + + [JsonProperty("@typescript-eslint/eslint-plugin")] + public string EslintPlugin { get; set; } + + [JsonProperty("@typescript-eslint/parser")] + public string EslintParser { get; set; } + public string BestZip { get; set; } + public string Eslint { get; set; } + + [JsonProperty("fs-extra")] + public string FsExtra { get; set; } + public string Glob { get; set; } + public string Tsyringe { get; set; } + public string Typescript { get; set; } + + } +} + +/* + "@types/node": "16.18.10", + "@typescript-eslint/eslint-plugin": "5.46.1", + "@typescript-eslint/parser": "5.46.1", + "bestzip": "2.2.1", + "eslint": "8.30.0", + "fs-extra": "11.1.0", + "glob": "8.0.3", + "tsyringe": "4.7.0", + "typescript": "4.9.4" +*/ \ No newline at end of file diff --git a/project/Aki.Launcher.Base/Models/Launcher/ModInfoCollection.cs b/project/Aki.Launcher.Base/Models/Launcher/ModInfoCollection.cs new file mode 100644 index 0000000..7a80a7f --- /dev/null +++ b/project/Aki.Launcher.Base/Models/Launcher/ModInfoCollection.cs @@ -0,0 +1,106 @@ +using Aki.Launcher.Models.Aki; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; + +namespace Aki.Launcher.Models.Launcher +{ + public class ModInfoCollection : INotifyPropertyChanged + { + private int _serverModsCount; + public int ServerModsCount + { + get => _serverModsCount; + set + { + if (_serverModsCount != value) + { + _serverModsCount = value; + RaisePropertyChanged(nameof(ServerModsCount)); + } + } + } + + private int _profileModsCount; + public int ProfileModsCount + { + get => _profileModsCount; + set + { + if (_profileModsCount != value) + { + _profileModsCount = value; + RaisePropertyChanged(nameof(ProfileModsCount)); + } + } + } + + private bool _hasProfileOnlyMods; + public bool HasProfileOnlyMods + { + get => _hasProfileOnlyMods; + set + { + if (_hasProfileOnlyMods != value) + { + _hasProfileOnlyMods = value; + RaisePropertyChanged(nameof(HasProfileOnlyMods)); + } + } + } + + private bool _hasMods; + public bool HasMods + { + get => _hasMods; + set + { + if (_hasMods != value) + { + _hasMods = value; + RaisePropertyChanged(nameof(HasMods)); + } + } + } + + public ObservableCollection Mods { get; private set; } = new ObservableCollection(); + + public ModInfoCollection() + { + var serverMods = ServerManager.GetLoadedServerMods().Values.ToList(); + var profileMods = ServerManager.GetProfileMods().ToList(); + + ServerModsCount = serverMods?.Count() ?? 0; + ProfileModsCount = profileMods?.Count() ?? 0; + + foreach (var serverMod in serverMods) + { + serverMod.InServer = true; + Mods.Add(serverMod); + } + + foreach (var profileMod in profileMods) + { + var existingMod = Mods.Where(x => x.Name == profileMod.Name && x.Version == profileMod.Version && x.Author == profileMod.Author).FirstOrDefault(); + + if (existingMod != null) + { + existingMod.InProfile = true; + continue; + } + + profileMod.InProfile = true; + Mods.Add(profileMod); + } + + HasMods = Mods.Count() > 0; + HasProfileOnlyMods = Mods.Where(x => x.InProfile && !x.InServer).Count() > 0; + } + + public event PropertyChangedEventHandler PropertyChanged; + protected virtual void RaisePropertyChanged(string property) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property)); + } + } +} diff --git a/project/Aki.Launcher/Aki_Data/Launcher/Locales/Chinese (Simplified).json b/project/Aki.Launcher/Aki_Data/Launcher/Locales/Chinese (Simplified).json index 4d2d040..4cf5d68 100644 --- a/project/Aki.Launcher/Aki_Data/Launcher/Locales/Chinese (Simplified).json +++ b/project/Aki.Launcher/Aki_Data/Launcher/Locales/Chinese (Simplified).json @@ -80,5 +80,8 @@ "profile_remove_question_format_1": "永久移除档案 '{0}'吗?", "i_understand": "我了解", "game_version_mismatch_format_2": "SPT无法运行,这是由于SPT需要EFT版本 '{1}',\n但现有版本是 '{0}'\n\n确保你已经按照你下载SPT的页面上的\n安装指导的描述降级你的EFT", - "description": "描述" + "description": "描述", + "server_mods": "Server Mods", + "profile_mods": "Profile Mods", + "author": "Author" } diff --git a/project/Aki.Launcher/Aki_Data/Launcher/Locales/Chinese (Traditional).json b/project/Aki.Launcher/Aki_Data/Launcher/Locales/Chinese (Traditional).json index 747cc30..583f216 100644 --- a/project/Aki.Launcher/Aki_Data/Launcher/Locales/Chinese (Traditional).json +++ b/project/Aki.Launcher/Aki_Data/Launcher/Locales/Chinese (Traditional).json @@ -80,5 +80,8 @@ "profile_remove_question_format_1": "Permanently remove profile '{0}'?", "i_understand": "I Understand", "game_version_mismatch_format_2": "SPT is unable to run, this is because SPT expected to find EFT version '{1}',\nbut instead found version '{0}'\n\nEnsure you've downgraded your EFT as described in the install guide\non the page you downloaded SPT from", - "description": "Description" + "description": "Description", + "server_mods": "Server Mods", + "profile_mods": "Profile Mods", + "author": "Author" } \ No newline at end of file diff --git a/project/Aki.Launcher/Aki_Data/Launcher/Locales/English.json b/project/Aki.Launcher/Aki_Data/Launcher/Locales/English.json index 004da11..bd30c22 100644 --- a/project/Aki.Launcher/Aki_Data/Launcher/Locales/English.json +++ b/project/Aki.Launcher/Aki_Data/Launcher/Locales/English.json @@ -80,5 +80,8 @@ "profile_remove_question_format_1": "Permanently remove profile '{0}'?", "i_understand": "I Understand", "game_version_mismatch_format_2": "SPT is unable to run, this is because SPT expected to find EFT version '{1}',\nbut instead found version '{0}'\n\nEnsure you've downgraded your EFT as described in the install guide\non the page you downloaded SPT from", - "description": "Description" + "description": "Description", + "server_mods": "Server Mods", + "profile_mods": "Profile Mods", + "author": "Author" } \ No newline at end of file diff --git a/project/Aki.Launcher/Aki_Data/Launcher/Locales/French.json b/project/Aki.Launcher/Aki_Data/Launcher/Locales/French.json index 29b20c7..34a924b 100644 --- a/project/Aki.Launcher/Aki_Data/Launcher/Locales/French.json +++ b/project/Aki.Launcher/Aki_Data/Launcher/Locales/French.json @@ -80,5 +80,8 @@ "profile_remove_question_format_1": "Permanently remove profile '{0}'?", "i_understand": "I Understand", "game_version_mismatch_format_2": "SPT is unable to run, this is because SPT expected to find EFT version '{1}',\nbut instead found version '{0}'\n\nEnsure you've downgraded your EFT as described in the install guide\non the page you downloaded SPT from", - "description": "Description" + "description": "Description", + "server_mods": "Server Mods", + "profile_mods": "Profile Mods", + "author": "Author" } \ No newline at end of file diff --git a/project/Aki.Launcher/Aki_Data/Launcher/Locales/German.json b/project/Aki.Launcher/Aki_Data/Launcher/Locales/German.json index 6846440..1899e64 100644 --- a/project/Aki.Launcher/Aki_Data/Launcher/Locales/German.json +++ b/project/Aki.Launcher/Aki_Data/Launcher/Locales/German.json @@ -80,5 +80,8 @@ "profile_remove_question_format_1": "Permanently remove profile '{0}'?", "i_understand": "I Understand", "game_version_mismatch_format_2": "SPT is unable to run, this is because SPT expected to find EFT version '{1}',\nbut instead found version '{0}'\n\nEnsure you've downgraded your EFT as described in the install guide\non the page you downloaded SPT from", - "description": "Description" + "description": "Description", + "server_mods": "Server Mods", + "profile_mods": "Profile Mods", + "author": "Author" } \ No newline at end of file diff --git a/project/Aki.Launcher/Aki_Data/Launcher/Locales/Italian.json b/project/Aki.Launcher/Aki_Data/Launcher/Locales/Italian.json index 017cfbe..fb72c8d 100644 --- a/project/Aki.Launcher/Aki_Data/Launcher/Locales/Italian.json +++ b/project/Aki.Launcher/Aki_Data/Launcher/Locales/Italian.json @@ -80,5 +80,8 @@ "profile_remove_question_format_1": "Rimuovere permanentemente il profilo '{0}'?", "i_understand": "Accetto", "game_version_mismatch_format_2": "SPT non riesce ad avviarsi, questo è perché SPT si aspettava la versione di EFT '{1}',\nmentre invece tu hai la versione '{0}'\n\nAssicurati di aver downgradato correttamente EFT come descritto nella guida all'installazione\nche hai trovato sulla pagina web da cui hai scaricato SPT", - "description": "Descrizione" + "description": "Descrizione", + "server_mods": "Server Mods", + "profile_mods": "Profile Mods", + "author": "Author" } \ No newline at end of file diff --git a/project/Aki.Launcher/Aki_Data/Launcher/Locales/Japanese.json b/project/Aki.Launcher/Aki_Data/Launcher/Locales/Japanese.json index eeab602..30e4728 100644 --- a/project/Aki.Launcher/Aki_Data/Launcher/Locales/Japanese.json +++ b/project/Aki.Launcher/Aki_Data/Launcher/Locales/Japanese.json @@ -80,5 +80,8 @@ "profile_remove_question_format_1": "プロファイル '{0}' を完全に削除しますか?", "i_understand": "了解", "game_version_mismatch_format_2": "SPT を実行できません。これは、SPT が EFT バージョン '{1}' を検出することを期待していたためです\n代わりにバージョン '{0}' を検出しました\n\nインストール ガイドの説明に従って EFT をダウングレードしたことを確認してください\n SPT をダウンロードしたページ", - "description": "Description" + "description": "Description", + "server_mods": "Server Mods", + "profile_mods": "Profile Mods", + "author": "Author" } \ No newline at end of file diff --git a/project/Aki.Launcher/Aki_Data/Launcher/Locales/Korean.json b/project/Aki.Launcher/Aki_Data/Launcher/Locales/Korean.json index 1c074a7..7dc6d3e 100644 --- a/project/Aki.Launcher/Aki_Data/Launcher/Locales/Korean.json +++ b/project/Aki.Launcher/Aki_Data/Launcher/Locales/Korean.json @@ -80,5 +80,8 @@ "profile_remove_question_format_1": "프로필 '{0}'을 영구적으로 삭제하시겠습니까?", "i_understand": "이해하였습니다", "game_version_mismatch_format_2": "당신의 게임 버전은 '{0}'이며 호환되는 버전은 '{1}' 입니다.\n\n게임 실행에 문제가 발생하거나 되지 않을 수 있습니다.", - "description": "Description" + "description": "Description", + "server_mods": "Server Mods", + "profile_mods": "Profile Mods", + "author": "Author" } \ No newline at end of file diff --git a/project/Aki.Launcher/Aki_Data/Launcher/Locales/Russian.json b/project/Aki.Launcher/Aki_Data/Launcher/Locales/Russian.json index a9d5566..2444e12 100644 --- a/project/Aki.Launcher/Aki_Data/Launcher/Locales/Russian.json +++ b/project/Aki.Launcher/Aki_Data/Launcher/Locales/Russian.json @@ -80,5 +80,8 @@ "profile_remove_question_format_1": "Удалить профиль '{0}' безвозвратно?", "i_understand": "Я понимаю", "game_version_mismatch_format_2": "Ваша версия игры: '{0}' и совместимая версия: '{1}'.\n\nИгра может работать некорректно или не работать вообще.", - "description": "Description" + "description": "Description", + "server_mods": "Server Mods", + "profile_mods": "Profile Mods", + "author": "Author" } \ No newline at end of file diff --git a/project/Aki.Launcher/Aki_Data/Launcher/Locales/Spanish.json b/project/Aki.Launcher/Aki_Data/Launcher/Locales/Spanish.json index 2fbc479..3735d58 100644 --- a/project/Aki.Launcher/Aki_Data/Launcher/Locales/Spanish.json +++ b/project/Aki.Launcher/Aki_Data/Launcher/Locales/Spanish.json @@ -80,5 +80,8 @@ "profile_remove_question_format_1": "Confirma si quieres borrar el perfil: '{0}'", "i_understand": "Lo entiendo", "game_version_mismatch_format_2": "SPT no puede iniciar, esto es debido a que la versión de EFT esperada es '{1}',\npero la versión encontrada es '{0}'\n\nAsegurate de haber realizado el downgrade de tu versión de EFT, tal como se indica en la guía de instalación\nen la página en la que has descargado SPT", - "description": "Descripción" + "description": "Descripción", + "server_mods": "Server Mods", + "profile_mods": "Profile Mods", + "author": "Author" } \ No newline at end of file diff --git a/project/Aki.Launcher/App.axaml b/project/Aki.Launcher/App.axaml index e32e261..ec353f3 100644 --- a/project/Aki.Launcher/App.axaml +++ b/project/Aki.Launcher/App.axaml @@ -48,5 +48,17 @@ + + + + + + + + diff --git a/project/Aki.Launcher/Assets/Styles.axaml b/project/Aki.Launcher/Assets/Styles.axaml index 150ea41..7f47fc2 100644 --- a/project/Aki.Launcher/Assets/Styles.axaml +++ b/project/Aki.Launcher/Assets/Styles.axaml @@ -4,7 +4,7 @@ xmlns:rxui="using:Avalonia.ReactiveUI" > - + + + + + + + + + + + + + + -