dev: more 1.4.4 fixes, fix CRLF -> LF

This commit is contained in:
Jack Bond-Preston 2023-08-17 17:44:55 +01:00
parent 278a0d9278
commit 0c6328b39d
Signed by: jack
GPG Key ID: 010071F1482BA852
5 changed files with 172 additions and 162 deletions

View File

@ -33,7 +33,7 @@ namespace MagicStorageVoidBag.Hooks {
heart.TryDeposit(returnItem);
heart.ResetCompactStage();
StorageGUI.needRefresh = true;
StorageGUI.SetRefresh();
if (returnItem.stack != newItem.stack) {
if (newItem.IsACoin) {

View File

@ -13,6 +13,7 @@ namespace MagicStorageVoidBag.ILPatches {
internal class PlayerUpdatePatch : ILPatch {
private static readonly log4net.ILog Logger = MagicStorageVoidBag.Instance.Logger;
public void Patch(ILContext il) {
try {
if (il == null) {
Logger.Error("ILContext null!");
return;
@ -23,17 +24,24 @@ namespace MagicStorageVoidBag.ILPatches {
var c = new ILCursor(il);
var setterMethod = typeof(Player).GetProperty(nameof(Player.IsVoidVaultEnabled)).GetSetMethod();
if (!c.TryGotoNext(i => i.MatchCallOrCallvirt(setterMethod))) {
Logger.Warn("Failed to go to next call or callvirt! :(");
Logger.Error("Failed to go to next call or callvirt! :(");
return;
}
c.Emit(OpCodes.Ldarg_0);
c.Emit(OpCodes.Ldc_I4, ModContent.ItemType<MSVoidBag>());
var hasItemMethod = typeof(Player).GetMethod(nameof(Player.HasItem));
var hasItemMethod = typeof(Player).GetMethod(nameof(Player.HasItem), new[] { typeof(int) });
if (hasItemMethod == null) {
Logger.Error("Failed to reflect Player.HasItem(int)! :(");
return;
}
c.Emit(OpCodes.Call, hasItemMethod);
c.Emit(OpCodes.Or);
Logger.Debug("...Complete!");
} catch (Exception e) {
throw new ILPatchFailureException(MagicStorageVoidBag.Instance, il, e);
}
}
}
}

View File

@ -1,15 +1,17 @@
Mods: {
Mods: {
MagicStorageVoidBag: {
ItemName: {
MSVoidBag: Magic Void Bag
}
ItemTooltip: {
MSVoidBag:
ItemName.MSVoidBag: Magic Void Bag
ItemTooltip.MSVoidBag:
'''
<right> Storage Heart to store location
Currently not set to any location
'''
}
}
Items: {
MSVoidBag: {
DisplayName: M S Void Bag
Tooltip: ""
}
}
}
}