static bool Prefix(PackageUIBase __instance, int obj, bool ___IsSplitMode, int ___bagIndex) { if (obj == -1) { return(true); } ItemObject item = Module <Player> .Self.bag.GetItem(___bagIndex, obj); if (item != null && ___IsSplitMode && item.Number == 1) { Module <Player> .Self.bag.AddItem(item, true); __instance.FreshCurpageItem(); __instance.playerItemBar.FreshItem(); return(false); } return(true); }
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); } } }