public static bool HasAllPriority(AAR_SalvageChosen __instance, ref bool __result)
 {
     try
     {
         int negotiated = __instance.contract.FinalPrioritySalvageCount;
         int totalSalvageMadeAvailable = __instance.parent.TotalSalvageMadeAvailable;
         int count = __instance.PriorityInventory.Count;
         int num   = negotiated;
         if (num > totalSalvageMadeAvailable)
         {
             num = totalSalvageMadeAvailable;
         }
         if (num > 7)
         {
             num = 7;
         }
         LogDebug(string.Format("HasAllPriority :negotiated {0} :available {1} :selected {2} :clamped {3}", negotiated, totalSalvageMadeAvailable, count, num));
         __result = count >= num;
         return(false);
     } catch (Exception e)
     {
         LogException(e);
         return(true);
     }
 }
        public static void Postfix(AAR_SalvageChosen __instance, LocalizableText ___howManyReceivedText, AAR_SalvageScreen ___parent, SimGameState ___simState, Contract ___contract)
        {
            // Skip if the UI element isn't visible
            if (!__instance.Visible)
            {
                Mod.Log.Info?.Write("SalvageChosen not visible, but ConvertToFinalState called - this should not happen, skipping.");
                return;
            }

            // Set each of the items clickable
            foreach (InventoryItemElement_NotListView iie in __instance.LeftoverInventory)
            {
                if (iie.controller != null && iie.controller.salvageDef != null && iie.controller.salvageDef.Type != SalvageDef.SalvageType.MECH_PART)
                {
                    Mod.Log.Debug?.Write($"Enabling non-mechpart for clicking: {iie.controller.salvageDef.Description.Id}");
                    iie.SetClickable(true);
                }
            }

            // Update text with Quick Sell instructions
            string localText = new Text(Mod.Config.LocalizedText[ModConfig.LT_QUICK_SELL], new object[] { }).ToString();

            ___howManyReceivedText.SetText(string.Concat(___howManyReceivedText.text, localText));

            // Set the Mod state we'll rely upon
            ModState.AAR_SalvageScreen = ___parent;
            ModState.Contract          = ___contract;
            ModState.SimGameState      = ___simState;

            // Painful, full-context searches here
            ModState.HBSPopupRoot =
                GameObject.Find(ModConsts.HBSPopupRootGOName);
            ModState.FloatieFont =
                Resources.FindObjectsOfTypeAll <TMP_FontAsset>().First(x => x.name == "UnitedSansReg-Black SDF");
            ModState.SGCurrencyDisplay = (SGCurrencyDisplay)Object.FindObjectOfType(typeof(SGCurrencyDisplay));
        }