static bool Prefix(RecipeSlot __instance) { return(Patcher.Run(() => { // If neither shift is down give back control to the game immediately if (!Input.GetKey(KeyCode.LeftShift) && !Input.GetKey(KeyCode.RightShift)) { return true; } var slot = __instance; var situation = GameBoard.GetOpenSituation(); if (situation == null || slot.GetElementStackInSlot() != null || !SituSlotController.GetAllEmptySlots(situation).Contains(slot)) { return true; } foreach (var stack in Positions.GetStacksRelativeTo(situation)) { if (SituSlotController.StackMatchesSlot(stack, slot)) { SituSlotController.MoveStackIntoSlot(stack as ElementStackToken, slot); break; } } return false; })); }
static bool Prefix(ElementStackToken __instance) { return(Patcher.Run(() => { // If neither shift is down give back control to the game immediately if (!Input.GetKey(KeyCode.LeftShift) && !Input.GetKey(KeyCode.RightShift)) { return true; } // Do not move cards in Mansus. Supporting this could be a future addition if (TabletopManager.IsInMansus()) { return false; } var stack = __instance; var situation = GameBoard.GetOpenSituation(); List <RecipeSlot> slots = null; if (situation == null) { foreach (var closedSituation in Positions.GetSituationsRelativeTo(stack)) { if (closedSituation.CanAcceptStackWhenClosed(stack)) { closedSituation.OpenWindow(); situation = closedSituation; break; } } } if (situation == null) { // Let controller handle the fail state SituSlotController.MoveStackIntoSlot(stack, null); } else { var populatedSlot = false; slots = SituSlotController.GetAllEmptySlots(situation); for (int i = 0; i < slots.Count; i++) { if (SituSlotController.StackMatchesSlot(stack, slots[i])) { SituSlotController.MoveStackIntoSlot(stack, slots[i]); populatedSlot = true; break; } } // There is no slot available for us, allow the controller to handle the fail state if (!populatedSlot) { SituSlotController.MoveStackIntoSlot(stack, null); } } return false; })); }