Thread Tools Display Modes
02/24/18, 07:20 PM   #1
scratchnsniff
Join Date: Apr 2014
Posts: 3
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,
  Reply With Quote
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,912
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
02/24/18, 08:54 PM   #3
scratchnsniff
Join Date: Apr 2014
Posts: 3
Thanks for the help.

I'll load it and see what happens. I appreciate your time.
  Reply With Quote
02/24/18, 09:16 PM   #4
scratchnsniff
Join Date: Apr 2014
Posts: 3
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
  Reply With Quote
02/24/18, 11:15 PM   #5
joshmiller83
AddOn Super User
 
joshmiller83's Avatar
Premium Member
Join Date: Mar 2014
Posts: 70
Question

Originally Posted by scratchnsniff View Post
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
Originally Posted by scratchnsniff View Post
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
  Reply With Quote

ESOUI » AddOns » AddOn Help/Support » Addon update help

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off