private static bool Prefix(QuickSlots __instance, InventoryItem item, ref int __result) { //check if there is a empty slot int firstEmpty = __instance.GetFirstEmpty(); if (firstEmpty == -1) { __result = -1; } else { //Checklogic //1. Check if Mod is active //2. true if user use the custom list AND the item is found //check using before checking item because && will increase performance when mod is not in use //- 1 OR 2 musst be true if ((ICM.Config_ModEnable == false) | (ICM.Config_AllowCustomList && PlayerAllowBind(item))) { __instance.Bind(firstEmpty, item); __result = firstEmpty; } else { //As i cannot stop the execute on a patch methode give back a result seperatly to skip the Slot Select on the calling function __result = -1; } } return(false); }
private static bool Prefix(QuickSlots __instance, InventoryItem item, ref int __result) { //ICM.Load(); int num = -1; for (int i = 0; i < __instance.binding.Length; i++) { if (__instance.binding[i] == null) { num = i; break; } } if (num == -1) { __result = -1; } /* * //Check if intro is running * if(IntroVignette.isIntroActive == true) * { * Logger.Log(Logger.Level.Warn, "Intro true"); * } * else * { * Logger.Log(Logger.Level.Warn, "Intro false"); * } */ if ((ICM.Config_ModEnable == false) | (IntroVignette.isIntroActive == true) | (ICM.Config_AllowCustomList && PlayerAllowBind(item))) //If the mod is disabled or the intro is runing run the original Code. After all check if the User allow adding to improve performance check if Allow is enabled before checking the item. { __instance.Bind(num, item); } __result = num; return(false); }