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