What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

Updating Loki.Game.LokiPoe.InGameState.InventoryPanel.Main

cyberbot

Member
Joined
Mar 15, 2014
Messages
220
Reaction score
2
In one of my town Tasks, it defines the following list to access the items in my main inventory.

List<Item> itemlist = Loki.Game.LokiPoe.InGameState.InventoryPanel.Main;

One of the first things that I check is the number of members in itemlist by accessing itemlist.Count()

Somewhere in the task, it goes to an NPC and sells some of the items from the inventory, so the total number of members in itemlist should change.
However, in the next pass of this task, itemlist.Count() sometimes would have the old number of items in my inventory. Do I have to do something in order to update the content in Loki.Game.LokiPoe.InGameState.InventoryPanel.Main?

Thanks.
 
In one of my town Tasks, it defines the following list to access the items in my main inventory.

List<Item> itemlist = Loki.Game.LokiPoe.InGameState.InventoryPanel.Main;

One of the first things that I check is the number of members in itemlist by accessing itemlist.Count()

Somewhere in the task, it goes to an NPC and sells some of the items from the inventory, so the total number of members in itemlist should change.
However, in the next pass of this task, itemlist.Count() sometimes would have the old number of items in my inventory. Do I have to do something in order to update the content in Loki.Game.LokiPoe.InGameState.InventoryPanel.Main?

Thanks.

? that's normal if you don't update the "itemlist" var... reassign it or remove the items when they get sold, so the count() will be correct.
 
In one of my town Tasks, it defines the following list to access the items in my main inventory.

List<Item> itemlist = Loki.Game.LokiPoe.InGameState.InventoryPanel.Main;

One of the first things that I check is the number of members in itemlist by accessing itemlist.Count()

Somewhere in the task, it goes to an NPC and sells some of the items from the inventory, so the total number of members in itemlist should change.
However, in the next pass of this task, itemlist.Count() sometimes would have the old number of items in my inventory. Do I have to do something in order to update the content in Loki.Game.LokiPoe.InGameState.InventoryPanel.Main?

Thanks.
TBH What you are doing.. don't waste memory by holding a dynamic item list. Grab the item list when you need it, and clear it's memory when you don't.
If you are using the Lokie.Game namespace, you do not need the Loki.Game.LokiPoe.InGameState.InventoryPanel.Main portion because it's a redundant call.
The API LokiPoe.InGameState.InventoryPanel is always up to date, you do not need to make a copy of it in the form of a list.
If you are searching for a specific item by it's name, var it and check it's results.
Let say we want to find an item called "Spike Bloom" rare dagger in our inventory;
Code:
 var spikeDagger = LokiPoe.InGameState.InventoryPanel.MainInventory.FindItemByFullName("Spike Bloom");
spikeDagger will return a bool value of true if we have the item in inventory, or false if we do not.
You can extend from this to do your logic as needed.
Keep in mind Main is not the Inventory you are looking for, you want MainInventory.
Work with the api a bit more and you will get the jist of it.
Wish you luck.
 
Back
Top