static void Prefix(PlayerItemBarCtr __instance) { if (Input.GetKeyDown(KeyCode.Tab)) { for (int index = 0; index < 8; index++) { ItemObject itemObject = Module <Player> .Self.bag.itemBar.itemBarItems[index]; ItemObject itemObj = Module <Player> .Self.bag.GetItems(0).GetItemObj(index); if (itemObject != null && itemObj != null && itemObject.ItemBase.ID == itemObj.ItemBase.ID && itemObj.RemainCapacity() != 0) { int num2 = itemObj.RemainCapacity(); if (itemObject.Number <= num2) { itemObj.ChangeNumber(itemObject.Number); Module <Player> .Self.bag.itemBar.SetItemObject(null, index); } else { itemObj.ChangeNumber(num2); itemObject.ChangeNumber(-num2); } } else { Module <Player> .Self.bag.BagExchangeItemBar(index, index, 0); } } MethodInfo dynMethod = __instance.GetType().GetMethod("Unequip", BindingFlags.NonPublic | BindingFlags.Instance); dynMethod.Invoke(__instance, new object[] { }); } else if (Input.GetKeyDown(KeyCode.O)) { StorageViewer sv = new StorageViewer(); FieldRef <StorageViewer, StorageUnit> suRef = FieldRefAccess <StorageViewer, StorageUnit>("storageUnit"); suRef(sv) = StorageUnit.GetStorageByGlobalIndex(0); MethodInfo dynMethod = sv.GetType().GetMethod("InteractStorage", BindingFlags.NonPublic | BindingFlags.Instance); dynMethod.Invoke(sv, new object[] { }); } }
static void PostfixUpdate(ref Pathea.UISystemNs.PackageUIBase __instance) { if ( null != currentSelection && Input.GetKeyDown(Main.modSettings.MaxItemStackKey.keyCode) && currentSelection.Number < 999 ) { currentSelection.ChangeNumber(999 - currentSelection.Number); __instance.FreshCurpageItem(); } }
void Update() { if (Input.GetKeyUp(KeyCode.KeypadMinus) && !_inDupMode) { _storage.DeleteItem(); } if (Input.GetKey(KeyCode.KeypadMultiply) && !_inDupMode) { if (_storage is null) { Main.Logger.Log("Storage is null, can't duplicate!"); return; } ItemObject curSelected = _storage.ReadProperty <ItemObject>("curSelectItem"); if (curSelected != null) { _inDupMode = true; Action <int> confirm = delegate(int num) { if (num > curSelected.Number) { curSelected.ChangeNumber(num - curSelected.Number); } else { curSelected.ChangeNumber(-(curSelected.Number - num)); } _storage.FreshCurpageItem(); _storage.playerItemBar.FreshItem(); }; ShowDupWindow(curSelected, confirm); } } }