public bool UpdateInventoryItem(int inventoryId, int itemId)
        {
            FieldInfo myPropInfo = typeof(GameOffsets).GetField($"INVENTORY_ITEM_ID_{inventoryId}");
            Offset    offset     = (Offset)myPropInfo.GetValue(GameItems.Instance);
            Item?     item       = GameItems.GetItemById(itemId);

            return(item.HasValue && WriteOffset(offset, item.Value.Id));
        }
Beispiel #2
0
 private void SetupInventoryClicked()
 {
     foreach (var children in GridInventory.Children)
     {
         Border element = (Border)children;
         element.MouseLeftButtonUp += (sender, e) =>
         {
             int             inventoryId     = int.Parse(new Regex(@"\d+").Match(element.Name).Value);
             Item?           currentItem     = GameItems.GetItemById(_windWaker.GetInventoryItem(inventoryId));
             InventoryDialog inventoryDialog = new InventoryDialog(currentItem.HasValue ? currentItem.Value.Name : "")
             {
                 Owner = this
             };
             if (inventoryDialog.ShowDialog() == true)
             {
                 _windWaker.UpdateInventoryItem(inventoryId, inventoryDialog.GetResult().ItemId);
             }
         };
     }
 }