diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c3a4bf..0902544 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ Resurrecting on Octowow. - **New spell datastore**: Metahunt now have a datastore of all twow 1.18.1 hunter and pet spells. And you can browse them with new pages in the Book. -- **Trainer cost planning**: Added shared Hunter and Pet Trainer spell cost planning for spells available now, at the next training level, and still remaining. It powers Hunter's Book and Hunter level-up messages, with standard and Honored prices. +- **Trainer cost planning**: Added shared Hunter and Pet Trainer spell cost planning for spells available now, at the next training level, and still remaining. - **Hunter and Pet spell scanning**: MetaHunt now reads your Hunter and Pet spellbooks to mark every spell rank you already know. When you visit a Hunter or Pet Trainer, it also records which ranks you can learn now and which ones are still unavailable. @@ -29,12 +29,16 @@ Resurrecting on Octowow. - **Complete revamp of SavedVariables**: All your settings now live in one tidy place instead of being scattered around. A migration happens the first time you log in, and you shouldn't lose any settings. -- **Polished options**: The option panel had become messy overtime and it finally received some of attention to look cleaner and coherent with same styling everywhere and better arrangement. +- **Polished options**: The option panel had become messy over time and it finally received some attention to look cleaner and coherent with same styling everywhere and better arrangement. - **Book navigation**: The book navigation is no longer done with horizontal tabs, but with a left vertical menu just like in the options. This allow more pages and fix the tab overfloading issues on some resolutions and UI scales. +- **Web database links**: All links in the data that were pointing on old Turtle WoW DB have been replaced to point on the OctoWoW DB. + ### Fixed +- **zCraft — profession ranks**: zCraft now refreshes after learning a profession rank, without requiring a UI reload. + - **Tooltips — your pet's info showing on other players**: In a party, mousing over or targeting another player could wrongly show YOUR pet's details (mood, loyalty, happiness, XP) on their tooltip. The own-pet detection no longer misfires on other units. - **zCraft — Smelting**: Smelting was previously not appearing in zCraft because incorrectly hardcoded as "Mining", this is fixed. diff --git a/README.MD b/README.MD index e9cc297..c269541 100644 --- a/README.MD +++ b/README.MD @@ -89,7 +89,7 @@ The add-on smartly scan your character and pet tabs, spellbook, beast training, ## Animations -Metahunt is the first add-on that uses the great PizzaSauce library of [Pizzahawaii](https://codeberg.org/Pizzahawaii/). This adds fun and makes the interface feel alive. +Metahunt is the first add-on that uses the great PizzaSauce library of [Pizzahawaii](https://codeberg.org/Pizzahawaii/). This adds fun and makes the interface feel alive. ## The Great Book of Huntards diff --git a/modules/zhunter/zButtonCraft.lua b/modules/zhunter/zButtonCraft.lua index 1eec705..a587013 100644 --- a/modules/zhunter/zButtonCraft.lua +++ b/modules/zhunter/zButtonCraft.lua @@ -26,6 +26,7 @@ local ZHUNTER_CRAFT_BUTTON_MAX = 14 local zButtonCraft_LastSpellSignature = nil local zButtonCraft_LastRefreshAt = 0 local zButtonCraft_MinRefreshInterval = 0.50 +local zButtonCraft_PendingRefresh = false -- Exact spell names as they appear in the General spellbook tab. -- spellName = the name returned by GetSpellName() to match against (case-insensitive) @@ -278,6 +279,7 @@ function zButtonCraft_OnEvent() zButtonCraft_CreateButtons() MTH_ZH_CraftAdjust = CreateFrame("Frame", "MTH_ZH_CraftAdjust") MTH_ZH_CraftAdjust:RegisterEvent("SPELLS_CHANGED") + MTH_ZH_CraftAdjust:RegisterEvent("LEARNED_SPELL_IN_TAB") MTH_ZH_CraftAdjust:RegisterEvent("PLAYER_ENTERING_WORLD") MTH_ZH_CraftAdjust:SetScript("OnEvent", MTH_ZH_CraftAdjust_OnEvent) zButtonCraft_SetupSizeAndPosition() @@ -307,6 +309,7 @@ function zButtonCraft_SetupSizeAndPosition() end if MTH_ZH_CraftAdjust then MTH_ZH_CraftAdjust:RegisterEvent("SPELLS_CHANGED") + MTH_ZH_CraftAdjust:RegisterEvent("LEARNED_SPELL_IN_TAB") MTH_ZH_CraftAdjust:RegisterEvent("PLAYER_ENTERING_WORLD") MTH_ZH_CraftAdjust:SetScript("OnEvent", MTH_ZH_CraftAdjust_OnEvent) end @@ -342,21 +345,19 @@ function zButtonCraft_Reset() zButtonCraft_EnsureConfig() end -function MTH_ZH_CraftAdjust_OnEvent() +local function zButtonCraft_RefreshAfterSpellbookChange() if not zButtonCraft then return end - if event == "SPELLS_CHANGED" then - local now = GetTime and GetTime() or 0 - if now > 0 and zButtonCraft_LastRefreshAt > 0 and (now - zButtonCraft_LastRefreshAt) < zButtonCraft_MinRefreshInterval then - return - end - local spellIds, _ = zButtonCraft_CollectProfessions() - local signature = zButtonCraft_GetSpellSignature(spellIds) - if signature == zButtonCraft_LastSpellSignature and not GameTooltip:IsOwned(zButtonCraft) then - return - end - zButtonCraft_LastSpellSignature = signature - zButtonCraft_LastRefreshAt = now + local now = GetTime and GetTime() or 0 + if now > 0 and zButtonCraft_LastRefreshAt > 0 and (now - zButtonCraft_LastRefreshAt) < zButtonCraft_MinRefreshInterval then + return end + local spellIds, _ = zButtonCraft_CollectProfessions() + local signature = zButtonCraft_GetSpellSignature(spellIds) + if signature == zButtonCraft_LastSpellSignature and not GameTooltip:IsOwned(zButtonCraft) then + return + end + zButtonCraft_LastSpellSignature = signature + zButtonCraft_LastRefreshAt = now zButtonCraft_RefreshProfessions() zButtonCraft_SetupSizeAndPosition() if GameTooltip:IsOwned(zButtonCraft) then @@ -364,6 +365,24 @@ function MTH_ZH_CraftAdjust_OnEvent() end end +function MTH_ZH_CraftAdjust_OnEvent() + if not zButtonCraft then return end + if event == "SPELLS_CHANGED" or event == "LEARNED_SPELL_IN_TAB" then + if zButtonCraft_PendingRefresh then return end + zButtonCraft_PendingRefresh = true + MTH_ZH_CraftAdjust.elapsed = 0 + MTH_ZH_CraftAdjust:SetScript("OnUpdate", function() + this.elapsed = (this.elapsed or 0) + (arg1 or 0) + if this.elapsed < 0.6 then return end + this:SetScript("OnUpdate", nil) + zButtonCraft_PendingRefresh = false + zButtonCraft_RefreshAfterSpellbookChange() + end) + return + end + zButtonCraft_RefreshAfterSpellbookChange() +end + function zButtonCraft_KeyBinding(index) if MTH_ZH_IsModuleEnabled and not MTH_ZH_IsModuleEnabled() then return end local button