static bool Prefix(ItemDrop.ItemData item, InventoryGrid.Modifier mod)
            {
                var result = !modEnabled.Value || !CanBeContainer(item) || mod != InventoryGrid.Modifier.Split;

                //Dbgl("result " + result + " " + !modEnabled.Value + " " + !CanBeContainer(item) + " "+(mod != InventoryGrid.Modifier.Split));
                return(result);
            }
Exemple #2
0
 // Token: 0x0600052B RID: 1323 RVA: 0x0002B598 File Offset: 0x00029798
 private void UpdateGamepad()
 {
     if (!this.m_uiGroup.IsActive())
     {
         return;
     }
     if (ZInput.GetButtonDown("JoyDPadLeft") || ZInput.GetButtonDown("JoyLStickLeft"))
     {
         this.m_selected.x = Mathf.Max(0, this.m_selected.x - 1);
     }
     if (ZInput.GetButtonDown("JoyDPadRight") || ZInput.GetButtonDown("JoyLStickRight"))
     {
         this.m_selected.x = Mathf.Min(this.m_width - 1, this.m_selected.x + 1);
     }
     if (ZInput.GetButtonDown("JoyDPadUp") || ZInput.GetButtonDown("JoyLStickUp"))
     {
         this.m_selected.y = Mathf.Max(0, this.m_selected.y - 1);
     }
     if (ZInput.GetButtonDown("JoyDPadDown") || ZInput.GetButtonDown("JoyLStickDown"))
     {
         this.m_selected.y = Mathf.Min(this.m_width - 1, this.m_selected.y + 1);
     }
     if (ZInput.GetButtonDown("JoyButtonA"))
     {
         InventoryGrid.Modifier arg = InventoryGrid.Modifier.Select;
         if (ZInput.GetButton("JoyLTrigger"))
         {
             arg = InventoryGrid.Modifier.Split;
         }
         if (ZInput.GetButton("JoyRTrigger"))
         {
             arg = InventoryGrid.Modifier.Move;
         }
         ItemDrop.ItemData gamepadSelectedItem = this.GetGamepadSelectedItem();
         this.m_onSelected(this, gamepadSelectedItem, this.m_selected, arg);
     }
     if (ZInput.GetButtonDown("JoyButtonX"))
     {
         ItemDrop.ItemData gamepadSelectedItem2 = this.GetGamepadSelectedItem();
         this.m_onRightClick(this, gamepadSelectedItem2, this.m_selected);
     }
 }
Exemple #3
0
    // Token: 0x06000530 RID: 1328 RVA: 0x0002BEE0 File Offset: 0x0002A0E0
    private void OnLeftClick(UIInputHandler clickHandler)
    {
        GameObject gameObject = clickHandler.gameObject;
        Vector2i   buttonPos  = this.GetButtonPos(gameObject);

        ItemDrop.ItemData      itemAt = this.m_inventory.GetItemAt(buttonPos.x, buttonPos.y);
        InventoryGrid.Modifier arg    = InventoryGrid.Modifier.Select;
        if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
        {
            arg = InventoryGrid.Modifier.Split;
        }
        if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl))
        {
            arg = InventoryGrid.Modifier.Move;
        }
        if (this.m_onSelected != null)
        {
            this.m_onSelected(this, itemAt, buttonPos, arg);
        }
    }
Exemple #4
0
        public static bool Prefix(InventoryGui __instance, InventoryGrid grid, ItemDrop.ItemData item, Vector2i pos, InventoryGrid.Modifier mod, GameObject ___m_dragGo, ItemDrop.ItemData ___m_dragItem)
        {
            if (grid.m_inventory.m_name.Equals("Inventory") && EquipmentAndQuickSlots.EquipmentSlotsEnabled.Value && EquipmentAndQuickSlots.IsEquipmentSlot(pos))
            {
                if (___m_dragItem != null && EquipmentAndQuickSlots.IsSlotEquippable(___m_dragItem) && EquipmentAndQuickSlots.GetEquipmentTypeForSlot(pos) == ___m_dragItem.m_shared.m_itemType)
                {
                    var player = Player.m_localPlayer;
                    player.UseItem(player.GetInventory(), ___m_dragItem, true);
                    __instance.SetupDragItem(null, null, 1);
                }
                return(false);
            }

            return(true);
        }
        private static void OnSelectedItem(InventoryGrid grid, ItemDrop.ItemData item, Vector2i pos, InventoryGrid.Modifier mod)
        {
            if (!modEnabled.Value || !CanBeContainer(item) || mod != InventoryGrid.Modifier.Split)
            {
                return;
            }
            bool same = false;

            if (InventoryGui.instance.IsContainerOpen() && itemStorage != null)
            {
                same = item.m_crafterName.EndsWith("_" + itemStorage.guid);

                CloseContainer();
            }
            if (!same && item != null && item.m_shared.m_maxStackSize <= 1 && (!requireEquipped.Value || item.m_equiped))
            {
                OpenItemStorage(item);
            }
        }
 public static bool Prefix(InventoryGui __instance, InventoryGrid grid, ItemDrop.ItemData item, Vector2i pos, InventoryGrid.Modifier mod)
 {
     // if we're not moving from the spellbars, do nothing (normal flow)
     if (__instance.m_dragInventory?.m_name != "spellsBarInventory")
     {
         return(true);
     }
     // if we moving TO the spellsbars, do nothing (normal flow)
     if (grid.m_inventory?.m_name == "spellsBarInventory")
     {
         return(true);
     }
     // so if we're moving from the spellsbar to another inventory
     ItemDrop.ItemData itemAt = grid.GetInventory().GetItemAt(pos.x, pos.y);
     if (itemAt != null)
     {
         // and there is an item at the destination
         var runeData = itemAt.GetRuneData();
         // and its not a rune
         if (runeData == null)
         {
             // we cant swap that!
             Player.m_localPlayer.Message(MessageHud.MessageType.Center, "You can't swap a rune for a non-rune item.");
             return(false);
         }
     }
     return(true);
 }