View Single Post
02/24/18, 07:58 PM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
You'd need to check the file HarvestCount.lua, especially the function "HC:COuntItems()".
There are multiple lines where only the normal inventory "INVENTORY_BACKPACK" is used to count the items.
There should maybe be a check if the user is using eso+ and got craftbag access (if HasCraftBagAccess() then ... ) and then if the items are transfered into the craftbag "INVENTORY_CRAFT_BAG" automatically (not sure how to check this or if this is always like this, if you got craftbag access? Was there a setting to choose if the items get into inv first and then the craftbag?) and then check the craftbag for new entries like the items check in the inventory is done here.

You could try this (not tested):

Lua Code:
  1. function HC.CountItems()
  2.     local b = 0
  3.     local r = 0
  4.     local w = 0
  5.     local c = 0
  6.     local counted = {}
  7.     local itemName = ''
  8.     local invType = INVENTORY_BACKPACK
  9.     if HasCraftBagAccess() then invType = INVENTORY_CRAFT_BAG end
  10.     local slots = PLAYER_INVENTORY.inventories[invType].slots
  11.     for i,slot in pairs(slots) do
  12.         if(type(i) == "number") then
  13.             itemName = GetItemLinkName(invType, i)
  14.             if(not SetContains(counted, itemName)) then
  15.                 counted[i] = itemName
  16.                 local itemType = GetItemType(invType, i)
  17.                 if(itemType == ITEMTYPE_WOODWORKING_RAW_MATERIAL) then
  18.                     w = w + GetItemTotalCount(invType, i)
  19.                 elseif(itemType == ITEMTYPE_BLACKSMITHING_RAW_MATERIAL) then
  20.                     b = b + GetItemTotalCount(invType, i)
  21.                 elseif(itemType == ITEMTYPE_CLOTHIER_RAW_MATERIAL) then
  22.                     c = c + GetItemTotalCount(invType, i)
  23.                 elseif(itemType == ITEMTYPE_REAGENT) then
  24.                     r = r + GetItemTotalCount(invType, i)
  25.                 end
  26.             end
  27.         end
  28.     end
  29.     HarvestCounterOre:SetText(string.format("Ore: %d", b))
  30.     HarvestCounterWood:SetText(string.format("Wood: %d", w))
  31.     HarvestCounterCloth:SetText(string.format("Cloth: %d", c))
  32.     HarvestCounterFlowers:SetText(string.format("Flowers: %d", r))
  33.     --   d("Flowers: "..r.." Ore: "..b.." Cloth: "..c.." Wood: "..w) # debug
  34. end

MAybe this will not work as the items will be put into the inventory first and then, afterwards with a slight delay, into the craftbag. The function is executed after loot so not sure if this works, you need to try it.
  Reply With Quote