• Visit Rebornbuddy
  • CurrentTabInventory

    Discussion in 'Archives' started by Nepthys, Dec 3, 2014.

    1. Nepthys

      Nepthys Community Developer

      Joined:
      Oct 13, 2014
      Messages:
      89
      Likes Received:
      1
      Trophy Points:
      0
      Hey all :)

      Has anyone figured out how to use the new 'CurrentTabInventory'?

      Trying to convert the following code. This makes a list of all the items in the stash


      var CombinedStashItems = LokiPoe.InGameState.StashPanel.CurrentTabItems;

      while (Loki.Game.LokiPoe.InGameState.StashPanel.NextTab() )
      {
      await Coroutine.Sleep(50);
      CombinedStashItems = CombinedStashItems.Union(LokiPoe.InGameState.StashPanel.CurrentTabItems).ToList();
      }


      Thanks!
       
    2. ExVault

      ExVault Moderator Moderator Buddy Core Dev

      Joined:
      Oct 23, 2013
      Messages:
      748
      Likes Received:
      57
      Trophy Points:
      28
      Its
      Code:
      LokiPoe.InGameState.StashPanel.CurrentTabInventory.Items
      p.s. You can't really gather all stash items because references will be lost after tab switch. You can save names and locations instead.
       
    3. pushedx

      pushedx Moderator Moderator Buddy Core Dev

      Joined:
      Sep 24, 2013
      Messages:
      4,252
      Likes Received:
      290
      Trophy Points:
      83
      The old API provided functions to read the "cached" client data for inventory contents, but that design was dropped in favor of the current system. The old API also allowed performing actions on the stash that were not human like (e.g., being able to withdraw/stash items to tabs that weren't visible) so all of that was changed with the 1.2 rewrite.

      Now, you need to go tab by tab and process the items on the current page as needed. You should make your own lightweight item wrapper and store the data you need from each Item. The client only requests the stash tab contents once upon the first access, so there's no issue with going though the stash multiple times, aside from the time it takes if you have a bunch of tabs.

      Code wise, what ExVault mentioned is right, the CurrentTabItems property was made internal to avoid an issue where location data was not present in those items because of how the client works. Instead, you need to get items from the current tab's inventory.
       

    Share This Page