cleanup
This commit is contained in:
@@ -69,6 +69,6 @@ public class MultiSelectDebug : MonoBehaviour
|
||||
LocationInGrid location = address is GridItemAddress gridAddress ? gridAddress.LocationInGrid : null;
|
||||
string locationString = location != null ? $"({location.x}, {location.y})" : "(slot)";
|
||||
|
||||
return $"x{itemContext.Item.StackObjectsCount} {address.Container.ID} {locationString} {itemContext.Item.Name.Localized()}";
|
||||
return $"x{itemContext.Item.StackObjectsCount} {(address != null ? address.Container.ID : "")} {locationString} {itemContext.Item.Name.Localized()}";
|
||||
}
|
||||
}
|
||||
|
@@ -192,15 +192,22 @@ public static class ContextMenuPatches
|
||||
{
|
||||
protected override MethodBase GetTargetMethod()
|
||||
{
|
||||
return AccessTools.Method(R.TradingInteractions.Type, "get_SubInteractions");
|
||||
return AccessTools.PropertyGetter(
|
||||
typeof(ItemInfoInteractionsAbstractClass<EItemInfoButton>),
|
||||
nameof(ItemInfoInteractionsAbstractClass<EItemInfoButton>.SubInteractions));
|
||||
}
|
||||
|
||||
[PatchPostfix]
|
||||
public static void Postfix(ref IEnumerable<EItemInfoButton> __result)
|
||||
public static void Postfix(
|
||||
ItemInfoInteractionsAbstractClass<EItemInfoButton> __instance,
|
||||
ref IEnumerable<EItemInfoButton> __result)
|
||||
{
|
||||
if (R.TradingInteractions.Type.IsInstanceOfType(__instance))
|
||||
{
|
||||
__result = __result.Append(EItemInfoButton.Repair).Append(EItemInfoButton.Insure);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class CreateSubInteractionsTradingPatch : ModulePatch
|
||||
{
|
||||
@@ -208,12 +215,23 @@ public static class ContextMenuPatches
|
||||
|
||||
protected override MethodBase GetTargetMethod()
|
||||
{
|
||||
return AccessTools.Method(R.TradingInteractions.Type, "CreateSubInteractions");
|
||||
return AccessTools.Method(
|
||||
typeof(ItemInfoInteractionsAbstractClass<EItemInfoButton>),
|
||||
nameof(ItemInfoInteractionsAbstractClass<EItemInfoButton>.CreateSubInteractions));
|
||||
}
|
||||
|
||||
[PatchPrefix]
|
||||
public static bool Prefix(object __instance, EItemInfoButton parentInteraction, ISubInteractions subInteractionsWrapper, ItemUiContext ___itemUiContext_0)
|
||||
public static bool Prefix(
|
||||
ItemInfoInteractionsAbstractClass<EItemInfoButton> __instance,
|
||||
EItemInfoButton parentInteraction,
|
||||
ISubInteractions subInteractionsWrapper,
|
||||
ItemUiContext ___itemUiContext_0)
|
||||
{
|
||||
if (!R.TradingInteractions.Type.IsInstanceOfType(__instance))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Clear this, since something else should be active (even a different mouseover of the insurance button)
|
||||
LoadingInsuranceActions = false;
|
||||
|
||||
|
@@ -19,7 +19,6 @@ public static class ContextMenuShortcutPatches
|
||||
new ItemUiContextPatch().Enable();
|
||||
|
||||
new HideoutItemViewRegisterContextPatch().Enable();
|
||||
new HideoutItemViewUnegisterContextPatch().Enable();
|
||||
|
||||
new TradingPanelRegisterContextPatch().Enable();
|
||||
new TradingPanelUnregisterContextPatch().Enable();
|
||||
@@ -127,20 +126,6 @@ public static class ContextMenuShortcutPatches
|
||||
}
|
||||
}
|
||||
|
||||
public class HideoutItemViewUnegisterContextPatch : ModulePatch
|
||||
{
|
||||
protected override MethodBase GetTargetMethod()
|
||||
{
|
||||
return AccessTools.Method(typeof(HideoutItemView), nameof(HideoutItemView.OnPointerExit));
|
||||
}
|
||||
|
||||
[PatchPostfix]
|
||||
public static void Postfix(HideoutItemView __instance, ItemUiContext ___ItemUiContext)
|
||||
{
|
||||
___ItemUiContext.UnregisterCurrentItemContext(__instance.ItemContext);
|
||||
}
|
||||
}
|
||||
|
||||
public class TradingPanelRegisterContextPatch : ModulePatch
|
||||
{
|
||||
protected override MethodBase GetTargetMethod()
|
||||
|
@@ -45,19 +45,12 @@ public static class StackFirItemsPatches
|
||||
[PatchPrefix]
|
||||
public static bool Prefix(Item __instance, Item other, ref bool __result)
|
||||
{
|
||||
bool ignoreSpawnedInSession;
|
||||
if (__instance.Template is MoneyClass)
|
||||
bool ignoreSpawnedInSession = __instance.Template switch
|
||||
{
|
||||
ignoreSpawnedInSession = Settings.MergeFIRMoney.Value;
|
||||
}
|
||||
else if (__instance.Template is AmmoTemplate)
|
||||
{
|
||||
ignoreSpawnedInSession = Settings.MergeFIRAmmo.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
ignoreSpawnedInSession = Settings.MergeFIROther.Value;
|
||||
}
|
||||
MoneyClass _ => Settings.MergeFIRMoney.Value,
|
||||
AmmoTemplate _ => Settings.MergeFIRMoney.Value,
|
||||
_ => Settings.MergeFIROther.Value,
|
||||
};
|
||||
|
||||
__result = __instance.TemplateId == other.TemplateId && __instance.Id != other.Id && (ignoreSpawnedInSession || __instance.SpawnedInSession == other.SpawnedInSession);
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user