Skip to content

Commit

Permalink
Also Update Count when bank frame is opened
Browse files Browse the repository at this point in the history
  • Loading branch information
derfloh205 committed Jan 23, 2024
1 parent 5ae5526 commit c43454f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
10 changes: 7 additions & 3 deletions Cache/ItemCount.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ local print = CraftSim.UTIL:SetDebugPrint(CraftSim.CONST.DEBUG_IDS.CACHE_ITEM_CO
CraftSim.CACHE = CraftSim.CACHE

---@class CraftSim.CACHE.ITEM_COUNT : Frame
CraftSim.CACHE.ITEM_COUNT = GUTIL:CreateRegistreeForEvents({ "BAG_UPDATE_DELAYED" })
CraftSim.CACHE.ITEM_COUNT = GUTIL:CreateRegistreeForEvents({ "BAG_UPDATE_DELAYED", "BANKFRAME_OPENED" })

---@type table<string, table<number, number>> table<crafterUID, table<itemID, count>>
CraftSimItemCountCache = {}
Expand Down Expand Up @@ -61,11 +61,15 @@ function CraftSim.CACHE.ITEM_COUNT:ClearAll()
end

function CraftSim.CACHE.ITEM_COUNT:BAG_UPDATE_DELAYED()
CraftSim.CACHE.ITEM_COUNT:UpdateCountFromBags()
CraftSim.CACHE.ITEM_COUNT:UpdateItemCountForCharacter()
end

function CraftSim.CACHE.ITEM_COUNT:BANKFRAME_OPENED()
CraftSim.CACHE.ITEM_COUNT:UpdateItemCountForCharacter()
end

--- loops all of a players inventory+bank bags and updates all tradegoods item count
function CraftSim.CACHE.ITEM_COUNT:UpdateCountFromBags()
function CraftSim.CACHE.ITEM_COUNT:UpdateItemCountForCharacter()
local alreadyUpdated = {} -- small map to cache already updated IDs to not double update them
print("Start Bag Update..")
local function countBagItems(bagID)
Expand Down
2 changes: 1 addition & 1 deletion CraftSim.toc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## Title: CraftSim
## Notes: Calculates the average profit based on your profession stats and other tools for dragonflight gold making
## Author: genju
## Version: 14.2.1
## Version: 14.2.2
## X-Curse-Project-ID: 705015
## X-Wago-ID: 0mNwaPKo
## X-WoWI-ID: 26519
Expand Down
3 changes: 2 additions & 1 deletion Data/News.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function CraftSim.NEWS:GET_NEWS(itemMap)
local news = {
f.bb(" Hello and thank you for using CraftSim!\n"),
f.bb(" ( You are awesome! )"),
newP("14.2.1"),
newP("14.2.2"),
f.P .. f.g("CraftQueue"),
f.a .. "- " .. f.bb("Reagent Item Count") .. " you own and craftable count is",
f.a .. " now based on" .. f.g(" Cached Item Count") .. " data from the crafter character",
Expand All @@ -24,6 +24,7 @@ function CraftSim.NEWS:GET_NEWS(itemMap)
f.p .. f.g("CraftResults"),
f.a .. "- Fixed a bug where a recipe's statistics were not tracked when",
f.a .. " the recipe was not yet visited in the crafting ui this session",
f.p .. ".2 Hotfix: Update Items on Reagent Bank Open",
newP("14.1.0"),
f.P .. f.l("Hugemongous") .. " performance increase for " .. f.bb("Recipe Scan"),
f.a .. "and other recipe calculations",
Expand Down

0 comments on commit c43454f

Please sign in to comment.