public static bool Prefix(PackageUIBase __instance) { if (!enabled) { return(true); } int id = ((ItemObject)typeof(PackageUIBase).GetProperty("curSelectItem", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(__instance, new object[0])).ItemDataId; if (MissionRequire.IsMissionRequired(id)) { UIUtils.ShowTipsMode2(TextMgr.GetStr(103554, -1), Color.white, 1.5f, null, false); } else { __instance.DeleteItem(); } return(false); }
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); } } }