ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   AddOn Help/Support (https://www.esoui.com/forums/forumdisplay.php?f=164)
-   -   Addon update help (https://www.esoui.com/forums/showthread.php?t=7645)

scratchnsniff 02/24/18 07:20 PM

Addon update help
 
There is an addon in the discontinued folder called HarvestCounter.
http://www.esoui.com/downloads/info1...r-UPDATED.html

It seems like a very simple addon that counts the amount of raw materials you collect. I get no errors on loading, yet it doesn't count any materials when i gather.

My guess is that this addon is not looking at the new crafting bag.

Is it possible for someone to take a look at the code and let me know what to change to make it work?

Thanks,

Baertram 02/24/18 07:58 PM

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.

scratchnsniff 02/24/18 08:54 PM

Thanks for the help.

I'll load it and see what happens. I appreciate your time.

scratchnsniff 02/24/18 09:16 PM

Inserted code, No errors, but still doesn't count.

Oh well. I was hoping to keep track but it really isn't worth the hassle. Although, i could use it to learn, but i am lazy. :)

thanks again for trying/looking

joshmiller83 02/24/18 11:15 PM

Quote:

Originally Posted by scratchnsniff (Post 34013)
Inserted code, No errors, but still doesn't count.

Oh well. I was hoping to keep track but it really isn't worth the hassle. Although, i could use it to learn, but i am lazy. :)

thanks again for trying/looking

Quote:

Originally Posted by scratchnsniff (Post 34010)
There is an addon in the discontinued folder called HarvestCounter.
http://www.esoui.com/downloads/info1...r-UPDATED.html

It seems like a very simple addon that counts the amount of raw materials you collect. I get no errors on loading, yet it doesn't count any materials when i gather.

My guess is that this addon is not looking at the new crafting bag.

Is it possible for someone to take a look at the code and let me know what to change to make it work?

Thanks,

Check out this addon! I saw it the other day and it might do waht you want it to do! :)

http://www.esoui.com/downloads/info1...bagViewer.html


All times are GMT -6. The time now is 03:53 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI