Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 23 additions & 16 deletions ModKit/ModKit/LocalizationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,30 @@ public static class LocalizationManager {
public static string FilePath { get; private set; }

public static void Enable() {
isEnabled = true;
IsDefault = true;
_local = null;
_localDefault = null;
var separator = Path.DirectorySeparatorChar;
_localFolderPath = Mod.modEntry.Path + "Localization" + separator;
FilePath = _localFolderPath + "en";
_localDefault = Import();
if (_localDefault == null) {
_localDefault = new();
_localDefault.Strings = new();
try {
isEnabled = true;
IsDefault = true;
_local = null;
_localDefault = null;
var separator = Path.DirectorySeparatorChar;
_localFolderPath = Mod.modEntry.Path + "Localization" + separator;
FilePath = _localFolderPath + "en";
_localDefault = Import();
if (_localDefault == null) {
_localDefault = new();
_localDefault.Strings = new();
}
var chosenLangauge = Mod.ModKitSettings.uiCultureCode;
FilePath = _localFolderPath + chosenLangauge;
if (chosenLangauge != "en") {
_local = Import();
IsDefault = _local == null;
}

}
var chosenLangauge = Mod.ModKitSettings.uiCultureCode;
FilePath = _localFolderPath + chosenLangauge;
if (chosenLangauge != "en") {
_local = Import();
IsDefault = _local == null;
catch (Exception ex) {
Mod.Error("Could not load localization files!");
Mod.Warn(ex.ToString());
}
}
public static void Update() {
Expand Down
3 changes: 2 additions & 1 deletion ModKit/ModKit/SettingsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static void SaveSettings<T>(this ModEntry modEntry, string fileName, T se
try {
var userSettings = JsonConvert.DeserializeObject<T>(reader.ReadToEnd());
if (userSettings is IUpdatableSettings updatableSettings) updatableSettings?.AddMissingKeys((IUpdatableSettings)settings);
settings = userSettings ?? new();
settings = userSettings;
}
catch {
Mod.Error("Failed to load user settings. Settings will be rebuilt.");
Expand All @@ -55,6 +55,7 @@ public static void SaveSettings<T>(this ModEntry modEntry, string fileName, T se
}
}
}
settings ??= new();
File.WriteAllText(userPath, JsonConvert.SerializeObject(settings, Formatting.Indented));
}
}
Expand Down
4 changes: 2 additions & 2 deletions ModKit/UI/UI+Browser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ public void ResetSearch() {
ReloadData();
}
public bool needsReloadData = true;
private bool _needsRedoCollation = true;
private bool _collationFinished = false;
internal bool _needsRedoCollation = true;
internal bool _collationFinished = false;
public void RedoCollation() {
_needsRedoCollation = true;
_collationFinished = false;
Expand Down
4 changes: 2 additions & 2 deletions ToyBox/Info.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"Id": "0ToyBox0",
"DisplayName": "{ToyBox} is preparing to conquer the Imperium",
"Author": "Narria",
"Version": "1.5.7a",
"Version": "1.5.9",
"ManagerVersion": "0.23.0",
"Requirements": [],
"AssemblyName": "ToyBox.dll",
"EntryMethod": "ToyBox.Main.Load",
"HomePage": "https://www.nexusmods.com/pathfinderwrathoftherighteous/mods/8?tab=posts&BH=0",
"Repository": "https://raw.githubusercontent.com/cabarius/ToyBox/master/ToyBox/Repository.json"
"Repository": "https://raw.githubusercontent.com/xADDBx/ToyBox/main/ToyBox/Repository.json"
}
2 changes: 1 addition & 1 deletion ToyBox/Localization/Wrath/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@
"Enable Loading with Blueprint Errors": "Enable Loading with Blueprint Errors",
"Enable Mouse3 Dragging To Aim The Camera": "Enable Mouse3 Dragging To Aim The Camera",
"Enable Rotate on all maps and cutscenes": "Enable Rotate on all maps and cutscenes",
"Enable Search as you type for Browsers (needs restart)": "Enable Search as you type for Browsers (needs restart)"
"Enable Search as you type for Browsers (needs restart)": "Enable Search as you type for Browsers (needs restart)",
"Enable Teleport Keys": "Enable Teleport Keys",
"Enable Zoom on all maps and cutscenes": "Enable Zoom on all maps and cutscenes",
"Enabled Search Filters": "Enabled Search Filters",
Expand Down
19 changes: 13 additions & 6 deletions ToyBox/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,21 @@
* **Quest Resolution**: this allows you to view your active quests and advance them as needed to work around bugs or
skip quests you don't want to do. Be warned this may break your game progression if used carelessly.

### ToyBox Rogue - Ver 1.5.8 (Coming Soon)
**ToyBox Rogue - Ver 1.5.8 -** ***Sh0dan*** **Preview Version 1.5.7a** built for 0.2.1ah
* (***ADDB***) Fixed weird behaviour when changing stats using the Textfield.
### ToyBox Wrath - Ver 1.5.8 (Coming Soon)
**ToyBox Wrath - Ver 1.5.8 - Preview Version 1.5.7a** built for 2.1.5r
### ToyBox Wrath - Ver 1.5.9 (built for 2.2.3c)
**ToyBox Wrath - Ver 1.5.9 - Preview Version 1.5.8b** built for 2.2.0av
* (***evandixon***) Fix unusable map screen on console view (e.g. PC Controller User & Steam Deck)
* (***ADDB***) Fixed Search 'n Pick - missing key update if collation happens too fast.
* (***ADDB***) Recompiled against new binaries.
* (***ADDB***) Temporarily change repository link to my Fork until Narria's one is active again.

### ToyBox Wrath - Ver 1.5.8 (built for 2.2.0as)
* (***ADDB***) Ride everything now really allows riding everything. Looks ridiculous but still.
* (***ADDB***) Fixed weird behaviour when changing stats using the Textfield.
* * (***ifarmpandas***) Added ActivatableAbilities to "Abilities" button in party editor.
* (***ADDB***) Prevent mod from being unable to load when localization files are missing.
* (***ADDB***) Improved detection and added auto-deletion of concurrently installed outdated ToyBox version.
* (***ifarmpandas***) Added ActivatableAbilities to "Abilities" button in party editor.
* (***ADDB***) Recompile for new version.
* (***ADDB***) Fixed some whoopsies (missing Localization files in Release; Wrong Repository Branch in Info file etc.).
### ToyBox Rogue - Ver 1.5.7 (built for 0.2.1ah)
* (***ADDB***) Added all localization keys to allow full localization.
### ToyBox Wrath - Ver 1.5.7 (built for 2.1.5r)
Expand Down
4 changes: 2 additions & 2 deletions ToyBox/Repository.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"Releases": [
{
"Id": "ToyBox",
"Version": "1.5.7a"
"Id": "0ToyBox0",
"Version": "1.5.9"
}
]
}
3 changes: 2 additions & 1 deletion ToyBox/ToyBox.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,8 @@
</ItemGroup>
<ItemGroup>
<None Include="ReadMe.md" />
<Content Include="Localization\*">
<Content Include="Localization\Wrath\*.*">
<Link>Localization\%(Filename)%(Extension)</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="zmisc\api.txt" />
Expand Down
16 changes: 15 additions & 1 deletion ToyBox/ToyBoxRT.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
</Target>
<ItemGroup>
<PubliciseInputAssemblies Include="$(RoguePath)\WH40KRT_Data\Managed\Code.dll" />
<PubliciseInputAssemblies Include="$(RoguePath)\WH40KRT_Data\Managed\RogueTrader.GameCore.dll" />
<PubliciseInputAssemblies Include="$(RoguePath)\WH40KRT_Data\Managed\Owlcat.Runtime.UI.dll" />
<PubliciseInputAssemblies Include="$(userprofile)\AppData\LocalLow\Owlcat Games\Warhammer 40000 Rogue Trader\UnityModManager\UnityModManager.dll" />
</ItemGroup>
Expand Down Expand Up @@ -432,6 +433,18 @@
<HintPath>$(RoguePath)\WH40KRT_Data\Managed\Utility.UnityExtensions.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RogueTrader.GameCore">
<HintPath>..\lib\RT\RogueTrader.GameCore_public.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RogueTrader.SharedTypes">
<HintPath>$(RoguePath)\WH40KRT_Data\Managed\RogueTrader.SharedTypes.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RogueTrader.NetPlayer">
<HintPath>$(RoguePath)\WH40KRT_Data\Managed\RogueTrader.NetPlayer.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="classes\Infrastructure\AssetLoader.cs" />
Expand Down Expand Up @@ -537,7 +550,8 @@
</ItemGroup>
<ItemGroup>
<None Include="ReadMe.md" />
<Content Include="Localization\*">
<Content Include="Localization\RogueTrader\*.*">
<Link>Localization\%(Filename)%(Extension)</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="zmisc\api.txt" />
Expand Down
6 changes: 4 additions & 2 deletions ToyBox/classes/MainUI/Browser/SearchAndPick.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ public static void RedoLayout() {
}

public static void OnGUI() {
if (Event.current.type == EventType.Layout && (SearchAndPickBrowser.isCollating || needsRedoKeys)) {
needsRedoKeys = SearchAndPickBrowser.isCollating;
if (Event.current.type == EventType.Layout && needsRedoKeys) {
needsRedoKeys = SearchAndPickBrowser.isCollating || SearchAndPickBrowser._needsRedoCollation;
var count = SearchAndPickBrowser.collatedDefinitions.Keys.Count;
var tmp = new string[(int)(1.1 * count) + 10];
SearchAndPickBrowser.collatedDefinitions.Keys.CopyTo(tmp, 0);
Expand Down Expand Up @@ -529,11 +529,13 @@ where selectedTypeFilter.filter(bp)
RedoLayout();
bpCount = bps.Count();
SearchAndPickBrowser.RedoCollation();
needsRedoKeys = true;
}

public static void ResetGUI() {
RedoLayout();
SearchAndPickBrowser.RedoCollation();
needsRedoKeys = true;
}
}
}
2 changes: 2 additions & 0 deletions ToyBox/classes/MainUI/EnhancedUI/ItemRarity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ public static RarityType Rarity(this int rating) {
return rarity;
}
public static int Rating(this BlueprintItemEnchantment bp) {
// This is impossible, but appearently a user might've encountered this in issue #1061
if (bp == null) return 0;
#if Wrath
int rating;

Expand Down
74 changes: 56 additions & 18 deletions ToyBox/classes/MainUI/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
using static ModKit.UI;
using LocalizationManager = ModKit.LocalizationManager;
using Kingmaker.UI.Common;
using Newtonsoft.Json;
#if RT
using Kingmaker.UI.Models.Log.CombatLog_ThreadSystem.LogThreads.LifeEvents;
#endif
Expand Down Expand Up @@ -156,20 +157,15 @@ private static bool OnUnload(UnityModManager.ModEntry modEntry) {
private static void LoadSettings(UnityModManager.ModEntry modEntry) {
var thisToyBoxPath = modEntry.Path;
var thisSettingsPath = Path.Combine(thisToyBoxPath, "Settings.xml");
if (!File.Exists(thisSettingsPath)) {
try {
Mod.Log("Settings file not found attempting to migrate from older ToyBox".yellow());
#if Wrath
var otherToyBoxPath = Path.Combine(UnityModManager.modsPath, "ToyBox");
#elif RT
var otherToyBoxPath = Path.Combine(UnityModManager.ModsPath, "ToyBox");
#endif
Mod.Log($"Checking {otherToyBoxPath}");
if (Directory.Exists(otherToyBoxPath)) {
Mod.Log($" Found older ToyBox at {otherToyBoxPath} migrating all settings");
File.Copy(Path.Combine(otherToyBoxPath, "Settings.xml"), thisSettingsPath);
var oldToyBoxPath = CheckForOldToyBox(modEntry);
try {
if (!oldToyBoxPath.IsNullOrEmpty()) {
if (!File.Exists(thisSettingsPath)) {
Mod.Log("Settings file not found attempting to migrate from older ToyBox".yellow());
Mod.Log($"Checking {oldToyBoxPath}");
File.Copy(Path.Combine(oldToyBoxPath, "Settings.xml"), thisSettingsPath);
var thisUserSettingsPath = Path.Combine(thisToyBoxPath, "UserSettings");
var otherUserSettingsPath = Path.Combine(otherToyBoxPath, "UserSettings");
var otherUserSettingsPath = Path.Combine(oldToyBoxPath, "UserSettings");
Directory.CreateDirectory(thisUserSettingsPath);
var allFiles = Directory.GetFiles(otherUserSettingsPath, "*.*", SearchOption.AllDirectories);
foreach (string otherPath in allFiles) {
Expand All @@ -179,17 +175,59 @@ private static void LoadSettings(UnityModManager.ModEntry modEntry) {
}
Mod.Log("ToyBox settings migration => SUCCESS".green());
}
else {
Mod.Log("Other ToyBox not found... creating default settings".yellow());
}
Mod.Warn("Removing old detected ToyBox version!");
File.Delete(oldToyBoxPath + UnityModManager.Config.ModInfo);
File.Delete(oldToyBoxPath + "Repository.json");
File.Delete(oldToyBoxPath + "ToyBox.dll");
File.Delete(oldToyBoxPath + "ToyBox.pdb");
// Directory.Delete(oldToyBoxPath, true);
}
catch (Exception e) {
Mod.Error(e);
else {
if (!File.Exists(thisSettingsPath)) {
Mod.Log("No old ToyBox version found... creating default settings".yellow());
}
}
}
catch (Exception e) {
Mod.Error(e);
}
Settings = UnityModManager.ModSettings.Load<Settings>(modEntry);

}
private static string CheckForOldToyBox(UnityModManager.ModEntry modEntry) {
try {
var x = Directory.GetCurrentDirectory();
var mods = Directory.GetDirectories(x + "/Mods");
foreach (var mod in mods) {
foreach (var file in Directory.GetFiles(mod)) {
if (new FileInfo(file).Name == "ToyBox.dll" && (new DirectoryInfo(mod).FullName + @"\") != new DirectoryInfo(modEntry.Path).FullName) {
var modDir = mod + @"\";
try {
using (StreamReader modInfoFile = File.OpenText(modDir + UnityModManager.Config.ModInfo)) {
var modInfo = JsonConvert.DeserializeObject<UnityModManager.ModInfo>(modInfoFile.ReadToEnd());
if (UnityModManager.ParseVersion(modInfo.Version) > modEntry.Version) {
// The current Assembly is the old version?
return null;
} // The current Assembly is the new version!
else {
return modDir;
}

}
} // Couldn't find/read info.json
catch (Exception e) {
Mod.Error(e);
}
return modDir;
}
}
}
}
catch (Exception e) {
Mod.Error(e);
}
return null;
}
private static bool OnToggle(UnityModManager.ModEntry modEntry, bool value) {
Enabled = value;
return true;
Expand Down
Loading