3 Commits

Author SHA1 Message Date
DuvelCorp c0c2c275eb v1.2.0 2026-03-11 00:40:35 +01:00
Duvel ab34946775 Fix typos and enhance clarity in README
Corrected typos and improved wording in the README.
2026-03-09 15:18:11 +01:00
Duvel d41703949d Merge pull request #4 from DuvelCorp/1.1.0
v1.1.0
2026-03-09 13:42:21 +01:00
54 changed files with 6680 additions and 7531 deletions
+15
View File
@@ -2,6 +2,21 @@
All notable changes to MetaHunt will be documented in this file. All notable changes to MetaHunt will be documented in this file.
## [1.2.0] - 2026-03-10
### Added
- Added keybinding text overlay on zButtons: parent and child buttons now display their bound key for the 5 bindable sets (Aspect, Track, Trap, Ammo, Pet).
- Added "Expand on Hover" option for zButton children: when enabled, hovering over the parent button automatically expands children (instead of requiring right-click).
- Added "Auto-Hide Timer" option for zButton children: a configurable 0–10 second timer that automatically collapses expanded children after the mouse leaves the button group. Timer resets while hovering any button in the group.
### Fixed
- Fixed SavedVariables data loss on login caused by initialization race condition overwriting persisted data.
- Fixed SavedVariables bloat by adding a migration that strips redundant default-valued keys on first load.
- Fixed six performance issues including throttling high-frequency event handlers, caching repeated `getglobal` lookups, and reducing unnecessary table allocations in hot paths.
- Cleaned up ICU module global variable leaks by properly scoping locals.
- Standardized all remaining `SetScript` handler patterns to use the WoW 1.12 `this`-based convention consistently.
## [1.1.0] - 2026-03-09 ## [1.1.0] - 2026-03-09
### Added ### Added
+1 -1
View File
@@ -1,5 +1,5 @@
## Interface: 11200 ## Interface: 11200
## Version: 1.1.0 ## Version: 1.2.0
## Title: MetaHunt - |cff00ff00Hunter ## Title: MetaHunt - |cff00ff00Hunter
## Author: Metasploit and his Copilot ;) ## Author: Metasploit and his Copilot ;)
## Notes: Unified addon suite for huntards making old addons compatible with TurtleWoW, and adding an arsenal of never seen Hunter's utilities. ## Notes: Unified addon suite for huntards making old addons compatible with TurtleWoW, and adding an arsenal of never seen Hunter's utilities.
+12 -7
View File
@@ -2,11 +2,11 @@
MetaHunt is a Turtle WoW Hunter toolkit. MetaHunt is a Turtle WoW Hunter toolkit.
It is a modern modular addon that combines never-seen features, and improves/fixes a few old hunter add-ons. It is a modern modular addon that combines never-seen features, and improves/fixes a few old hunter add-ons.
It provides a bunch usefull tools for all huntards, wheter they are still leveling, lone-wolf, or HL raider. It provides a bunch useful tools for all huntards, wheter they are still levelling, lone-wolf, or HL raider.
## Twow Data ## Twow Data
Metahunt ships with larges up-to-date datastores for all Turtle WOW data a hunter needs : MetaHunt ships with large up-to-date datastores for all Turtle WOW data a hunter needs :
- All beasts, their location, and the abilities they can learn you - All beasts, their location, and the abilities they can learn you
- All Pet families, their abilities and their diet - All Pet families, their abilities and their diet
@@ -37,7 +37,7 @@ Old zHunterMod addon on steroids. Fully compatible with Twow, and enhanced with
- zPet : Intelligent collapsible pet Bar regrouping all pet spells and providing an intelligent button that always show you the right spell to use depending on the situation - zPet : Intelligent collapsible pet Bar regrouping all pet spells and providing an intelligent button that always show you the right spell to use depending on the situation
- zTrack: All your trackings in one collapsible bar - zTrack: All your trackings in one collapsible bar
- zAspect: All your trackings in one collapsible bar - zAspect: All your trackings in one collapsible bar
- zRanged : All the rnaged weampons currently in your bags to swap them fast - zRanged : All the ranged weampons currently in your bags to swap them fast
- But also zMounts, zToys and zCompanions. - But also zMounts, zToys and zCompanions.
## Feed-O-Matic ## Feed-O-Matic
@@ -59,15 +59,20 @@ Define your own simple rules for auto buy ammo and pet food when you open a vend
## Auto-Quest ## Auto-Quest
Just spam SHIFT-click on the NPC to validate quests Scorpok and Thorium arrows. Addionally you can have an enhanced tooltip that display your actual Scorpok-related items when you mouseover the mobs involved. Just spam SHIFT-click on the NPC to validate quests Scorpok and Thorium arrows. Additionally you can have an enhanced tooltip that display your actual Scorpok-related items when you mouseover the mobs involved.
## The book of Hunters ## The Great Book of Huntards
The book of Hunters is the main GUI of Metahunt, it allows to display the data constantly collected about you and your pet, and browse the addon's data to find anything a Hunter needs. The Book is the main GUI of MetaHunt, it allows to display the data constantly collected about you and your pet, and browse the addon's data to find anything a Hunter needs.
- Browse the Metahunt datastores of NPCs (Beast, vendors, masters) and open the map to locate them like in pfQuest - Browse the MetaHunt datastores of NPCs (Beast, vendors, masters) and open the map to locate them like in pfQuest
- Track all info about the pet abilities that you know and don't know yet - Track all info about the pet abilities that you know and don't know yet
- Track all info about your stabled pets - Track all info about your stabled pets
- Keep an history of all your pets after you abandon them or if they run away. - Keep an history of all your pets after you abandon them or if they run away.
## What it will never do.
The goal of MetaHunt is to offer hunter's features that are not covered by existing Twow addons, and in others https://github.com/SabineWren/Quiver .
There's no point to reinvent the wheel, except is the wheel is broken. Nothing will work better than Quiver for auto-shot, castbar and tranqshot mgt. MetaHunt is build to work alongside of Quiver and is complementary to it, and it will remain like this unless Quiver turns to be not upgraded anymore.
+3 -3
View File
@@ -98,7 +98,7 @@ local function AntiDaze_CancelRelevantAspect(isSelfDazed)
AntiDazeTooltip:SetOwner(UIParent, "ANCHOR_NONE") AntiDazeTooltip:SetOwner(UIParent, "ANCHOR_NONE")
AntiDazeTooltip:SetPlayerBuff(i, "HELPFUL") AntiDazeTooltip:SetPlayerBuff(i, "HELPFUL")
local text = AntiDazeTooltipTextLeft1 and AntiDazeTooltipTextLeft1:GetText() local text = MTH_AntiDazeProbeTextLeft1 and MTH_AntiDazeProbeTextLeft1:GetText()
if text == packName or (isSelfDazed and text == cheetahName) then if text == packName or (isSelfDazed and text == cheetahName) then
CancelPlayerBuff(i) CancelPlayerBuff(i)
return 1 return 1
@@ -112,8 +112,8 @@ local function AntiDaze_HandleSlash()
AntiDaze_SetEnabled(not AntiDaze_IsEnabled()) AntiDaze_SetEnabled(not AntiDaze_IsEnabled())
end end
AntiDazeTooltip = CreateFrame("GameTooltip", "AntiDazeTooltip", nil, "GameTooltipTemplate") AntiDazeTooltip = CreateFrame("GameTooltip", "MTH_AntiDazeProbe", nil, "GameTooltipTemplate")
AntiDazeFrame = CreateFrame("Frame", "AntiDazeFrame") AntiDazeFrame = CreateFrame("Frame", "MTH_AntiDazeEvent")
if AntiDazeFrame then if AntiDazeFrame then
AntiDazeFrame:RegisterEvent("VARIABLES_LOADED") AntiDazeFrame:RegisterEvent("VARIABLES_LOADED")
AntiDazeFrame:SetScript("OnEvent", function() AntiDazeFrame:SetScript("OnEvent", function()
+2 -2
View File
@@ -112,7 +112,7 @@ end
local function AutoStrip_QueueDeferredRestore(reason) local function AutoStrip_QueueDeferredRestore(reason)
if not AutoStrip_RestoreFrame then if not AutoStrip_RestoreFrame then
AutoStrip_RestoreFrame = CreateFrame("Frame", "AutoStripRestoreFrame") AutoStrip_RestoreFrame = CreateFrame("Frame", "MTH_AutoStripRestore")
if not AutoStrip_RestoreFrame then if not AutoStrip_RestoreFrame then
return return
end end
@@ -316,7 +316,7 @@ local function AutoStrip_HandleSlash(msg)
end end
end end
AutoStrip_Frame = CreateFrame("Frame", "AutoStripFrame") AutoStrip_Frame = CreateFrame("Frame", "MTH_AutoStripEvent")
if AutoStrip_Frame then if AutoStrip_Frame then
AutoStrip_Frame:RegisterEvent("VARIABLES_LOADED") AutoStrip_Frame:RegisterEvent("VARIABLES_LOADED")
AutoStrip_Frame:RegisterEvent("PLAYER_REGEN_DISABLED") AutoStrip_Frame:RegisterEvent("PLAYER_REGEN_DISABLED")
+1 -1
View File
@@ -1,5 +1,5 @@
MTH_CONST = MTH_CONST or {} MTH_CONST = MTH_CONST or {}
MTH_CONST.version = MTH_CONST.version or "1.1.0" MTH_CONST.version = MTH_CONST.version or "1.2.0"
MTH_CONST.WEAPON_TYPES = { MTH_CONST.WEAPON_TYPES = {
BOWS = "Bows", BOWS = "Bows",
+41 -7
View File
@@ -460,6 +460,7 @@ local function MTH_FEED_CoreTrackerOnEvent()
end end
elseif evt == "BAG_UPDATE" then elseif evt == "BAG_UPDATE" then
MTH_FEED_IndexBagFoods() MTH_FEED_IndexBagFoods()
MTH_FEED_InvalidateDietMapCache()
elseif evt == "CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS" then elseif evt == "CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS" then
if MTH_FEED_ActiveCoreAttemptId and MTH_FEED_HasPetFeedBuff() then if MTH_FEED_ActiveCoreAttemptId and MTH_FEED_HasPetFeedBuff() then
MTH_FEED_Trace("Core tracker buff event confirms acceptance") MTH_FEED_Trace("Core tracker buff event confirms acceptance")
@@ -468,7 +469,32 @@ local function MTH_FEED_CoreTrackerOnEvent()
end end
end end
local MTH_FEED_CoreTrackerUpdateElapsed = 0
local MTH_FEED_LastStaleCleanupAt = 0
local function MTH_FEED_CoreTrackerOnUpdate() local function MTH_FEED_CoreTrackerOnUpdate()
MTH_FEED_CoreTrackerUpdateElapsed = MTH_FEED_CoreTrackerUpdateElapsed + (arg1 or 0)
if MTH_FEED_CoreTrackerUpdateElapsed < 0.10 then
return
end
MTH_FEED_CoreTrackerUpdateElapsed = 0
-- Periodic stale attempt cleanup (every ~30 seconds)
local now = GetTime() or 0
if (now - MTH_FEED_LastStaleCleanupAt) >= 30 then
MTH_FEED_LastStaleCleanupAt = now
if MTH_FEED_Runtime and type(MTH_FEED_Runtime.attempts) == "table" then
for id, row in pairs(MTH_FEED_Runtime.attempts) do
if type(row) == "table" then
local age = now - (tonumber(row.startedAt) or now)
if age > 10 then
MTH_FEED_Runtime.attempts[id] = nil
end
end
end
end
end
local attemptId = MTH_FEED_ActiveCoreAttemptId local attemptId = MTH_FEED_ActiveCoreAttemptId
if attemptId == nil then if attemptId == nil then
return return
@@ -499,7 +525,7 @@ local function MTH_FEED_EnsureTrackerFrame()
if MTH_FEED_TrackerFrame then if MTH_FEED_TrackerFrame then
return MTH_FEED_TrackerFrame return MTH_FEED_TrackerFrame
end end
local frame = CreateFrame("Frame", "MTH_FeedTrackingFrame") local frame = CreateFrame("Frame", "MTH_FeedTracking")
if not frame then if not frame then
return nil return nil
end end
@@ -617,19 +643,17 @@ local function MTH_FEED_EnsureBootstrapFrame()
if MTH_FEED_BootstrapFrame ~= nil then if MTH_FEED_BootstrapFrame ~= nil then
return MTH_FEED_BootstrapFrame return MTH_FEED_BootstrapFrame
end end
local frame = CreateFrame("Frame", "MTH_FeedTrackingBootstrapFrame") local frame = CreateFrame("Frame", "MTH_FeedTrackingBoot")
if not frame then if not frame then
return nil return nil
end end
frame:RegisterEvent("VARIABLES_LOADED") frame:RegisterEvent("VARIABLES_LOADED")
frame:RegisterEvent("PLAYER_LOGIN") frame:RegisterEvent("PLAYER_LOGIN")
frame:RegisterEvent("PLAYER_ENTERING_WORLD") frame:RegisterEvent("PLAYER_ENTERING_WORLD")
frame:SetScript("OnEvent", function(self) frame:SetScript("OnEvent", function()
MTH_FEED_ReinstallCoreTracking() MTH_FEED_ReinstallCoreTracking()
if self and self.UnregisterAllEvents then this:UnregisterAllEvents()
self:UnregisterAllEvents() this:SetScript("OnEvent", nil)
self:SetScript("OnEvent", nil)
end
end) end)
MTH_FEED_BootstrapFrame = frame MTH_FEED_BootstrapFrame = frame
return frame return frame
@@ -826,7 +850,16 @@ local function MTH_FEED_NormalizeReason(reason, rawMessage)
return "unknown" return "unknown"
end end
local MTH_FEED_DietMapCache = nil
local function MTH_FEED_InvalidateDietMapCache()
MTH_FEED_DietMapCache = nil
end
local function MTH_FEED_GetDietByItemIdMap() local function MTH_FEED_GetDietByItemIdMap()
if MTH_FEED_DietMapCache then
return MTH_FEED_DietMapCache
end
local map = {} local map = {}
if type(FOM_Foods) ~= "table" then if type(FOM_Foods) ~= "table" then
return map return map
@@ -841,6 +874,7 @@ local function MTH_FEED_GetDietByItemIdMap()
end end
end end
end end
MTH_FEED_DietMapCache = map
return map return map
end end
+70 -37
View File
@@ -1,5 +1,5 @@
MTH = MTH or { MTH = MTH or {
version = "1.1.0", version = "1.2.0",
name = "MetaHunt", name = "MetaHunt",
modules = {}, modules = {},
config = {}, config = {},
@@ -44,7 +44,7 @@ local function MTH_ClassGateEnsureAnnounceFrame(self)
if not self or self._classGateAnnounceFrame then if not self or self._classGateAnnounceFrame then
return return
end end
local frame = CreateFrame("Frame", "MTH_ClassGateAnnounceFrame") local frame = CreateFrame("Frame", "MTH_ClassGateAnnounce")
if not frame then if not frame then
return return
end end
@@ -55,12 +55,12 @@ local function MTH_ClassGateEnsureAnnounceFrame(self)
end end
end) end)
frame._mthElapsed = 0 frame._mthElapsed = 0
frame:SetScript("OnUpdate", function(self, elapsed) frame:SetScript("OnUpdate", function()
self._mthElapsed = (self._mthElapsed or 0) + (elapsed or arg1 or 0) this._mthElapsed = (this._mthElapsed or 0) + (arg1 or 0)
if self._mthElapsed < 0.5 then if this._mthElapsed < 0.5 then
return return
end end
self._mthElapsed = 0 this._mthElapsed = 0
if MTH and MTH._classGateAnnouncedChat then if MTH and MTH._classGateAnnouncedChat then
MTH_ClassGateClearAnnounceFrame(MTH) MTH_ClassGateClearAnnounceFrame(MTH)
return return
@@ -192,21 +192,19 @@ end
MTH:ApplyClassGate("startup") MTH:ApplyClassGate("startup")
if not MTH._classGateLifecycleFrame then if not MTH._classGateLifecycleFrame then
local classGateFrame = CreateFrame("Frame", "MTH_ClassGateLifecycleFrame") local classGateFrame = CreateFrame("Frame", "MTH_ClassGateLifecycle")
if classGateFrame then if classGateFrame then
classGateFrame:RegisterEvent("PLAYER_LOGIN") classGateFrame:RegisterEvent("PLAYER_LOGIN")
classGateFrame:RegisterEvent("PLAYER_ENTERING_WORLD") classGateFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
classGateFrame:SetScript("OnEvent", function(self, eventName) classGateFrame:SetScript("OnEvent", function()
self = self or this if MTH and event == "PLAYER_LOGIN" then
eventName = eventName or event
if MTH and eventName == "PLAYER_LOGIN" then
MTH._classGateAnnouncedChat = nil MTH._classGateAnnouncedChat = nil
MTH._classGateAnnounced = nil MTH._classGateAnnounced = nil
MTH._classGateAnnouncePending = nil MTH._classGateAnnouncePending = nil
end end
if MTH and MTH.ApplyClassGate and MTH:ApplyClassGate(eventName) and MTH._classGateAnnouncedChat then if MTH and MTH.ApplyClassGate and MTH:ApplyClassGate(event) and MTH._classGateAnnouncedChat then
self:UnregisterAllEvents() this:UnregisterAllEvents()
self:SetScript("OnEvent", nil) this:SetScript("OnEvent", nil)
end end
end) end)
MTH._classGateLifecycleFrame = classGateFrame MTH._classGateLifecycleFrame = classGateFrame
@@ -565,10 +563,10 @@ function MTH:InitEventRouter()
return self._eventRouter.frame return self._eventRouter.frame
end end
local frame = CreateFrame("Frame", "MTH_EventRouterFrame") local frame = CreateFrame("Frame", "MTH_EventRouter")
frame:SetScript("OnEvent", function(self, evt, a1, a2, a3, a4, a5, a6, a7, a8, a9) frame:SetScript("OnEvent", function()
if MTH and MTH.DispatchEvent then if MTH and MTH.DispatchEvent then
MTH:DispatchEvent(evt, a1, a2, a3, a4, a5, a6, a7, a8, a9) MTH:DispatchEvent(event, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
end end
end) end)
@@ -628,7 +626,7 @@ function MTH:_SetModuleEventSubscriptions(name, enabled)
end end
end end
function MTH:DispatchEvent(evt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) function MTH:DispatchEvent(evt, ea1, ea2, ea3, ea4, ea5, ea6, ea7, ea8, ea9)
for name, module in pairs(self.modules) do for name, module in pairs(self.modules) do
if module.enabled and module.onEvent then if module.enabled and module.onEvent then
local allow = true local allow = true
@@ -637,11 +635,10 @@ function MTH:DispatchEvent(evt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8,
end end
if allow then if allow then
local ok, err = pcall(function() local ok, err = pcall(function()
module:onEvent(evt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) module:onEvent(evt, ea1, ea2, ea3, ea4, ea5, ea6, ea7, ea8, ea9)
end) end)
if not ok then if not ok then
self:Print("Module '" .. name .. "' event error on '" .. tostring(evt) .. "': " .. tostring(err)) MTH:Print("Module '" .. name .. "' event error on '" .. tostring(evt) .. "': " .. tostring(err), "error")
MTH:Print("[MTH] Module event error (" .. name .. ", " .. tostring(evt) .. "): " .. tostring(err), "error")
end end
end end
end end
@@ -1295,24 +1292,22 @@ function MTH:EnsureModuleStateBootstrap()
return self._moduleStateBootstrapFrame return self._moduleStateBootstrapFrame
end end
local frame = CreateFrame("Frame", "MTH_ModuleStateBootstrapFrame") local frame = CreateFrame("Frame", "MTH_ModuleBootstrap")
if not frame then if not frame then
return nil return nil
end end
frame:RegisterEvent("VARIABLES_LOADED") frame:RegisterEvent("VARIABLES_LOADED")
frame:SetScript("OnEvent", function(self, eventName) frame:SetScript("OnEvent", function()
self = self or this if event ~= "VARIABLES_LOADED" then
eventName = eventName or event
if eventName ~= "VARIABLES_LOADED" then
return return
end end
if MTH and MTH.ApplyPersistedModuleStates then if MTH and MTH.ApplyPersistedModuleStates then
MTH:ApplyPersistedModuleStates("VARIABLES_LOADED") MTH:ApplyPersistedModuleStates("VARIABLES_LOADED")
end end
if not self then return end if not this then return end
self:UnregisterAllEvents() this:UnregisterAllEvents()
self:SetScript("OnEvent", nil) this:SetScript("OnEvent", nil)
end) end)
self._moduleStateBootstrapFrame = frame self._moduleStateBootstrapFrame = frame
@@ -1490,6 +1485,46 @@ function MTH:AnnounceLoadComplete()
"Addon synced. Your threat meter just sent a stress signal.", "Addon synced. Your threat meter just sent a stress signal.",
"Loaded cleanly. Reputation with healers currently in freefall.", "Loaded cleanly. Reputation with healers currently in freefall.",
"Mission start: hit things from far away and deny everything in chat.", "Mission start: hit things from far away and deny everything in chat.",
"Welcome back. Your pet missed you. Just kidding, it ran away.",
"MetaHunt loaded. You're still a Huntard, but now you're an organized one.",
"Aspects, traps, tracking... Don't worry, I'll handle the hard parts.",
"Oh good, another hunter who needs an addon to remember their own spells.",
"MetaHunt ready. Feign Death is not a personality trait.",
"Loaded successfully. No, I can't fix your DPS.",
"Welcome. Your pet's loyalty is higher than your raid attendance.",
"MetaHunt online. Please don't Multishot the sheep.",
"Greetings, hunter. I see you've chosen the 'easy' class and still need help.",
"All systems go. Try not to pull the entire dungeon this time.",
"MetaHunt activated. Reminder: Melee range is not your home.",
"Welcome back. Your ammo count is almost as low as your situational awareness.",
"Loaded. I'll manage your buttons since you clearly have too many.",
"MetaHunt ready. Aspect of the Cheetah in dungeons is a choice, not a strategy.",
"Oh look, a hunter that uses addons. There might be hope for you yet.",
"Welcome. No, you cannot tame that. Or that. Stop asking.",
"MetaHunt standing by. Unlike you during your last Feign Death.",
"Initialized. Fun fact: your pet has more utility than you do.",
"All buttons configured. Now if only I could configure your aim.",
"MetaHunt loaded. Growl is off, right? ...RIGHT?",
"MetaHunt loaded. Your Freezing Trap will still break early. That's on you.",
"Welcome. Aspect of the Pack is ready. Your group is not.",
"Initializing... unlike your pet, I actually come when called.",
"MetaHunt online. Remember: Hunter loot is everything. Everything.",
"Loaded. Concussive Shot the flag carrier, not the rogue vanishing.",
"Welcome back. Eyes of the Beast is not a valid boss strategy.",
"Ready. Your Aimed Shot takes longer to cast than this addon took to load.",
"MetaHunt armed. Scatter Shot into Freezing Trap — you'll get it right someday.",
"Online. Don't worry, I track your cooldowns since you clearly don't.",
"Welcome. Wing Clip and run. It's what you do best.",
"Loaded. Distracting Shot is for the boss, not for your ego.",
"MetaHunt ready. Your quiver is full but your skill bar is empty.",
"Initialized. Serpent Sting on every target doesn't make you a DoT class.",
"Welcome, hunter. Viper Sting the healer. No, the OTHER healer.",
"Ready to hunt. Mend Pet is not optional, it's a lifestyle.",
"MetaHunt loaded. Tranquilizing Shot the enrage, not the warrior.",
"Online. Rapid Fire is a cooldown, not your approach to pulling.",
"Welcome. You have 28 arrows left. Should've checked before the raid.",
"Loaded. Bestial Wrath does not make YOU immune. Learned that yet?",
"MetaHunt standing by. Dead zone? What dead zone? Oh... that dead zone.",
} }
local welcomeIndex = 1 local welcomeIndex = 1
@@ -1520,24 +1555,22 @@ function MTH:EnsureLoadCompleteAnnouncement()
return self._loadCompleteFrame return self._loadCompleteFrame
end end
local frame = CreateFrame("Frame", "MTH_LoadCompleteAnnounceFrame") local frame = CreateFrame("Frame", "MTH_LoadAnnounce")
if not frame then if not frame then
return nil return nil
end end
frame:RegisterEvent("PLAYER_ENTERING_WORLD") frame:RegisterEvent("PLAYER_ENTERING_WORLD")
frame:SetScript("OnEvent", function(self, eventName) frame:SetScript("OnEvent", function()
self = self or this if event ~= "PLAYER_ENTERING_WORLD" then
eventName = eventName or event
if eventName ~= "PLAYER_ENTERING_WORLD" then
return return
end end
if MTH and MTH.AnnounceLoadComplete then if MTH and MTH.AnnounceLoadComplete then
MTH:AnnounceLoadComplete() MTH:AnnounceLoadComplete()
end end
if not self then return end if not this then return end
self:UnregisterAllEvents() this:UnregisterAllEvents()
self:SetScript("OnEvent", nil) this:SetScript("OnEvent", nil)
end) end)
self._loadCompleteFrame = frame self._loadCompleteFrame = frame
+8 -12
View File
@@ -802,7 +802,7 @@ function MTH_PT_InitService()
if MTH_PetTrainingFrame then if MTH_PetTrainingFrame then
return return
end end
MTH_PetTrainingFrame = CreateFrame("Frame", "MTHPetTrainingScanFrame") MTH_PetTrainingFrame = CreateFrame("Frame", "MTH_PetTrainingScan")
MTH_PetTrainingFrame:RegisterEvent("PLAYER_ENTERING_WORLD") MTH_PetTrainingFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
MTH_PetTrainingFrame:RegisterEvent("LEARNED_SPELL_IN_TAB") MTH_PetTrainingFrame:RegisterEvent("LEARNED_SPELL_IN_TAB")
MTH_PetTrainingFrame:RegisterEvent("PET_TRAINING_SHOW") MTH_PetTrainingFrame:RegisterEvent("PET_TRAINING_SHOW")
@@ -813,9 +813,8 @@ function MTH_PT_InitService()
MTH_PetTrainingFrame:RegisterEvent("CRAFT_SHOW") MTH_PetTrainingFrame:RegisterEvent("CRAFT_SHOW")
MTH_PetTrainingFrame:RegisterEvent("CRAFT_UPDATE") MTH_PetTrainingFrame:RegisterEvent("CRAFT_UPDATE")
MTH_PetTrainingFrame:SetScript("OnEvent", MTH_PT_OnEvent) MTH_PetTrainingFrame:SetScript("OnEvent", MTH_PT_OnEvent)
MTH_PetTrainingFrame:SetScript("OnUpdate", function(_, elapsed) MTH_PetTrainingFrame:SetScript("OnUpdate", function()
elapsed = elapsed or arg1 MTH_PT_PetBookPollElapsed = (MTH_PT_PetBookPollElapsed or 0) + (arg1 or 0)
MTH_PT_PetBookPollElapsed = (MTH_PT_PetBookPollElapsed or 0) + (elapsed or 0)
if MTH_PT_PetBookPollElapsed < 0.20 then if MTH_PT_PetBookPollElapsed < 0.20 then
return return
end end
@@ -861,19 +860,16 @@ function MTH_PT_InitBootstrap()
end end
frame:RegisterEvent("PET_TRAINING_SHOW") frame:RegisterEvent("PET_TRAINING_SHOW")
frame:RegisterEvent("CRAFT_SHOW") frame:RegisterEvent("CRAFT_SHOW")
frame:SetScript("OnEvent", function(self, evt) frame:SetScript("OnEvent", function()
evt = evt or event if event ~= "PET_TRAINING_SHOW" and event ~= "CRAFT_SHOW" then
if evt ~= "PET_TRAINING_SHOW" and evt ~= "CRAFT_SHOW" then
return return
end end
MTH_PT_InitService() MTH_PT_InitService()
if type(MTH_PT_OnEvent) == "function" then if type(MTH_PT_OnEvent) == "function" then
MTH_PT_OnEvent(MTH_PetTrainingFrame, evt) MTH_PT_OnEvent(MTH_PetTrainingFrame, event)
end
if self and self.UnregisterAllEvents then
self:UnregisterAllEvents()
self:SetScript("OnEvent", nil)
end end
this:UnregisterAllEvents()
this:SetScript("OnEvent", nil)
MTH_PT_BootstrapFrame = nil MTH_PT_BootstrapFrame = nil
end) end)
MTH_PT_BootstrapFrame = frame MTH_PT_BootstrapFrame = frame
+1 -1
View File
@@ -331,7 +331,7 @@ function MTH_PS_InitService()
return return
end end
MTH_PS_Frame = CreateFrame("Frame", "MTHPetSpellbookEventFrame") MTH_PS_Frame = CreateFrame("Frame", "MTH_PetSpellbookEvent")
MTH_PS_Frame:RegisterEvent("PLAYER_ENTERING_WORLD") MTH_PS_Frame:RegisterEvent("PLAYER_ENTERING_WORLD")
MTH_PS_Frame:RegisterEvent("UNIT_PET") MTH_PS_Frame:RegisterEvent("UNIT_PET")
MTH_PS_Frame:RegisterEvent("PET_BAR_UPDATE") MTH_PS_Frame:RegisterEvent("PET_BAR_UPDATE")
+69 -41
View File
@@ -179,7 +179,7 @@ local function MTH_ST_EnsureDiagCopyFrame()
if MTH_ST_DiagCopyFrame then if MTH_ST_DiagCopyFrame then
return MTH_ST_DiagCopyFrame return MTH_ST_DiagCopyFrame
end end
local frame = CreateFrame("Frame", "MTHStableDiagCopyFrame", UIParent) local frame = CreateFrame("Frame", "MTH_StableDiagCopy", UIParent)
if not frame then if not frame then
return nil return nil
end end
@@ -219,11 +219,11 @@ local function MTH_ST_EnsureDiagCopyFrame()
copyButton:SetHeight(24) copyButton:SetHeight(24)
copyButton:SetText("Select All") copyButton:SetText("Select All")
local scrollFrame = CreateFrame("ScrollFrame", "MTHStableDiagCopyScroll", frame, "UIPanelScrollFrameTemplate") local scrollFrame = CreateFrame("ScrollFrame", "MTH_StableDiagScroll", frame, "UIPanelScrollFrameTemplate")
scrollFrame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -48) scrollFrame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -48)
scrollFrame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -36, 44) scrollFrame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -36, 44)
local editBox = CreateFrame("EditBox", "MTHStableDiagCopyText", scrollFrame) local editBox = CreateFrame("EditBox", "MTH_StableDiagText", scrollFrame)
editBox:SetMultiLine(true) editBox:SetMultiLine(true)
editBox:SetMaxLetters(999999) editBox:SetMaxLetters(999999)
editBox:SetFont("Fonts\\FRIZQT__.TTF", 11, "") editBox:SetFont("Fonts\\FRIZQT__.TTF", 11, "")
@@ -255,13 +255,13 @@ local function MTH_ST_EnsureDiagCopyFrame()
if UISpecialFrames then if UISpecialFrames then
local exists = false local exists = false
for i = 1, table.getn(UISpecialFrames) do for i = 1, table.getn(UISpecialFrames) do
if UISpecialFrames[i] == "MTHStableDiagCopyFrame" then if UISpecialFrames[i] == "MTH_StableDiagCopy" then
exists = true exists = true
break break
end end
end end
if not exists then if not exists then
table.insert(UISpecialFrames, "MTHStableDiagCopyFrame") table.insert(UISpecialFrames, "MTH_StableDiagCopy")
end end
end end
return frame return frame
@@ -2494,15 +2494,6 @@ function MTH_PETS_GetRootStore()
end end
local pets = MTH_CharSavedVariables.MTH_Pets local pets = MTH_CharSavedVariables.MTH_Pets
if pets._betaFreshStoreApplied ~= 1 then
pets.petTraining = {}
pets.trainScan = {}
pets.stableScan = {}
pets.currentPet = {}
pets.petStore = {}
pets._betaFreshStoreApplied = 1
pets.updatedAt = time()
end
if type(pets.petTraining) ~= "table" then if type(pets.petTraining) ~= "table" then
pets.petTraining = {} pets.petTraining = {}
end end
@@ -2519,14 +2510,53 @@ function MTH_PETS_GetRootStore()
MTH_PETS_EnsureSchema(pets) MTH_PETS_EnsureSchema(pets)
MTH_PETS_EnsurePetTrainingCompatibility(pets) MTH_PETS_EnsurePetTrainingCompatibility(pets)
MTH_CharSavedVariables.petTraining = pets.petTraining -- Migration: remove root-level duplicates that bloated SavedVariables
MTH_CharSavedVariables.trainScan = pets.trainScan if pets._migrationCleanup ~= 2 then
MTH_CharSavedVariables.stableScan = pets.stableScan MTH_PETS_RunSavedVarCleanup(pets)
MTH_CharSavedVariables.petStore = pets.petStore pets._migrationCleanup = 2
end
return pets return pets
end end
function MTH_PETS_RunSavedVarCleanup(pets)
-- 1. Remove root-level duplicates (data lives inside MTH_Pets only)
if MTH_CharSavedVariables then
MTH_CharSavedVariables.petTraining = nil
MTH_CharSavedVariables.trainScan = nil
MTH_CharSavedVariables.stableScan = nil
MTH_CharSavedVariables.petStore = nil
end
-- 2. Purge pet-updated events (unbounded bloat)
local purged = 0
local stores = { pets.petStore and pets.petStore.activeById, pets.petStore and pets.petStore.historyById }
for _, index in ipairs(stores) do
if type(index) == "table" then
for petId, row in pairs(index) do
if type(row) == "table" and type(row.events) == "table" then
local kept = {}
for _, evt in ipairs(row.events) do
if type(evt) == "table" and evt.type ~= "pet-updated" then
table.insert(kept, evt)
else
purged = purged + 1
end
end
row.events = kept
end
end
end
end
-- 3. Remove stale _betaFreshStoreApplied flag
pets._betaFreshStoreApplied = nil
if purged > 0 and MTH and MTH.Print then
MTH:Print("Cleaned up " .. tostring(purged) .. " stale pet-update records from SavedVariables.", "debug")
end
end
function MTH_PETS_RefreshCurrentPet() function MTH_PETS_RefreshCurrentPet()
local pets = type(MTH_PETS_GetRootStore) == "function" and MTH_PETS_GetRootStore() or nil local pets = type(MTH_PETS_GetRootStore) == "function" and MTH_PETS_GetRootStore() or nil
if type(pets) ~= "table" then if type(pets) ~= "table" then
@@ -2624,15 +2654,17 @@ function MTH_PETS_RefreshCurrentPet()
row.events = {} row.events = {}
end end
local eventType = "pet-updated" local eventType = "pet-acquired"
if created and (not hadPetBeforeRefresh) then if not (created and (not hadPetBeforeRefresh)) then
eventType = "pet-acquired" if cp.id ~= nil and previousCurrentId ~= nil and cp.id ~= previousCurrentId then
eventType = "pet-swapped"
else
eventType = nil -- routine update, don't record
end
end end
local shouldRecordLifecycleEvent = (eventType == "pet-acquired")
or (cp.id ~= nil and previousCurrentId ~= nil and cp.id ~= previousCurrentId)
local eventContext = nil local eventContext = nil
if shouldRecordLifecycleEvent then if eventType then
eventContext = MTH_PETS_CaptureContext() eventContext = MTH_PETS_CaptureContext()
table.insert(row.events, { table.insert(row.events, {
type = eventType, type = eventType,
@@ -3167,7 +3199,7 @@ end
local function MTH_ST_QueueDeferredStableScan(reason, delaySeconds) local function MTH_ST_QueueDeferredStableScan(reason, delaySeconds)
if not MTH_ST_DeferredStableScanFrame then if not MTH_ST_DeferredStableScanFrame then
MTH_ST_DeferredStableScanFrame = CreateFrame("Frame", "MTHDeferredStableScanFrame") MTH_ST_DeferredStableScanFrame = CreateFrame("Frame", "MTH_DeferredStableScan")
if not MTH_ST_DeferredStableScanFrame then if not MTH_ST_DeferredStableScanFrame then
MTH_ST_TraceRecord("MTH_ST_QueueDeferredStableScan", "scan", "frame-create-failed") MTH_ST_TraceRecord("MTH_ST_QueueDeferredStableScan", "scan", "frame-create-failed")
return false return false
@@ -3270,9 +3302,8 @@ local function MTH_PETS_HandleUnitPetTransition(source)
row.events = {} row.events = {}
end end
local eventType = (not hadPet) and "pet-acquired" or "pet-updated" local eventType = (not hadPet) and "pet-acquired" or "pet-updated"
if eventType == "pet-updated" and source == "UNIT_PET" and MTH_ST_IsStableFrameOpen() then -- Only record lifecycle events (acquire, rename, abandon), not routine updates
MTH_ST_PrintStableDiag("swap history-skip reason=stable-open") if eventType ~= "pet-updated" then
else
table.insert(row.events, { table.insert(row.events, {
type = eventType, type = eventType,
source = source or transitionSource, source = source or transitionSource,
@@ -4120,7 +4151,7 @@ function MTH_ST_InitService()
return return
end end
MTH_PetLifecycleEventFrame = CreateFrame("Frame", "MTHPetLifecycleEventFrame") MTH_PetLifecycleEventFrame = CreateFrame("Frame", "MTH_PetLifecycleEvent")
MTH_PetLifecycleEventFrame:RegisterEvent("PLAYER_ENTERING_WORLD") MTH_PetLifecycleEventFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
MTH_PetLifecycleEventFrame:RegisterEvent("UNIT_PET") MTH_PetLifecycleEventFrame:RegisterEvent("UNIT_PET")
MTH_PetLifecycleEventFrame:RegisterEvent("PET_BAR_UPDATE") MTH_PetLifecycleEventFrame:RegisterEvent("PET_BAR_UPDATE")
@@ -4153,29 +4184,26 @@ function MTH_ST_InitBootstrap()
return return
end end
local frame = CreateFrame("Frame", "MTHPetLifecycleBootstrapFrame") local frame = CreateFrame("Frame", "MTH_PetLifecycleBoot")
if not frame then if not frame then
return return
end end
frame:RegisterEvent("PLAYER_ENTERING_WORLD") frame:RegisterEvent("PLAYER_ENTERING_WORLD")
frame:RegisterEvent("PET_STABLE_SHOW") frame:RegisterEvent("PET_STABLE_SHOW")
frame:RegisterEvent("PET_STABLE_UPDATE") frame:RegisterEvent("PET_STABLE_UPDATE")
frame:SetScript("OnEvent", function(self, evt) frame:SetScript("OnEvent", function()
evt = evt or event if event ~= "PLAYER_ENTERING_WORLD" and event ~= "PET_STABLE_SHOW" and event ~= "PET_STABLE_UPDATE" then
if evt ~= "PLAYER_ENTERING_WORLD" and evt ~= "PET_STABLE_SHOW" and evt ~= "PET_STABLE_UPDATE" then
return return
end end
if evt == "PET_STABLE_SHOW" or evt == "PET_STABLE_UPDATE" then if event == "PET_STABLE_SHOW" or event == "PET_STABLE_UPDATE" then
MTH_ST_PrintStableDiag("bootstrap evt=" .. tostring(evt) .. " phase=begin") MTH_ST_PrintStableDiag("bootstrap evt=" .. tostring(event) .. " phase=begin")
end end
MTH_ST_InitService() MTH_ST_InitService()
if evt == "PET_STABLE_SHOW" or evt == "PET_STABLE_UPDATE" then if event == "PET_STABLE_SHOW" or event == "PET_STABLE_UPDATE" then
MTH_ST_PrintStableDiag("bootstrap evt=" .. tostring(evt) .. " phase=end action=no-scan") MTH_ST_PrintStableDiag("bootstrap evt=" .. tostring(event) .. " phase=end action=no-scan")
end
if self and self.UnregisterAllEvents then
self:UnregisterAllEvents()
self:SetScript("OnEvent", nil)
end end
this:UnregisterAllEvents()
this:SetScript("OnEvent", nil)
MTH_PetLifecycleBootstrapFrame = nil MTH_PetLifecycleBootstrapFrame = nil
end) end)
MTH_PetLifecycleBootstrapFrame = frame MTH_PetLifecycleBootstrapFrame = frame
+57 -9
View File
@@ -12,7 +12,7 @@ local function MTH_PT_GetGlobal(name)
return nil return nil
end end
local MTH_ItemLinkCacheTooltip = nil local MTH_ItemLinkCache = nil
local function MTH_GetQualityHexColor(quality) local function MTH_GetQualityHexColor(quality)
local q = tonumber(quality) local q = tonumber(quality)
@@ -34,14 +34,14 @@ function MTH_PrimeItemCache(itemId)
if not id or id <= 0 then return false end if not id or id <= 0 then return false end
if type(GetItemInfo) == "function" and GetItemInfo(id) then return true end if type(GetItemInfo) == "function" and GetItemInfo(id) then return true end
if not MTH_ItemLinkCacheTooltip then if not MTH_ItemLinkCache then
MTH_ItemLinkCacheTooltip = CreateFrame("GameTooltip", "MTH_ItemLinkCacheTooltip", UIParent, "GameTooltipTemplate") MTH_ItemLinkCache = CreateFrame("GameTooltip", "MTH_ItemLinkCache", UIParent, "GameTooltipTemplate")
if not MTH_ItemLinkCacheTooltip then return false end if not MTH_ItemLinkCache then return false end
MTH_ItemLinkCacheTooltip:SetOwner(UIParent, "ANCHOR_NONE") MTH_ItemLinkCache:SetOwner(UIParent, "ANCHOR_NONE")
end end
MTH_ItemLinkCacheTooltip:ClearLines() MTH_ItemLinkCache:ClearLines()
MTH_ItemLinkCacheTooltip:SetHyperlink("item:" .. tostring(id) .. ":0:0:0") MTH_ItemLinkCache:SetHyperlink("item:" .. tostring(id) .. ":0:0:0")
return type(GetItemInfo) == "function" and (GetItemInfo(id) ~= nil) or false return type(GetItemInfo) == "function" and (GetItemInfo(id) ~= nil) or false
end end
@@ -301,6 +301,46 @@ if type(MTH_CommandPetSpellScan) ~= "function" then
end end
end end
------------------------------------------------------
-- /mth diag — Runtime Diagnostics
------------------------------------------------------
function MTH_CommandDiag()
MTH:Print("======= MetaHunt Diagnostics =======", "debug")
-- 1. Lua version
local luaVer = _VERSION or "unknown"
MTH:Print("[DIAG] _VERSION = " .. tostring(luaVer), "debug")
MTH:Print("[DIAG] string.match = " .. tostring(type(string.match) == "function"), "debug")
MTH:Print("[DIAG] string.gfind = " .. tostring(type(string.gfind) == "function"), "debug")
-- 2. Active modules
local moduleCount = 0
local enabledModules = {}
if MTH.modules then
for name, mod in pairs(MTH.modules) do
moduleCount = moduleCount + 1
if mod.enabled then
table.insert(enabledModules, name)
end
end
end
MTH:Print("[DIAG] Registered modules: " .. tostring(moduleCount), "debug")
MTH:Print("[DIAG] Enabled: " .. table.concat(enabledModules, ", "), "debug")
-- 3. Event router state
local routerFrame = (MTH._eventRouter and MTH._eventRouter.frame) or nil
local routerEvents = (MTH._eventRouter and MTH._eventRouter.eventRefs) or {}
local eventCount = 0
for _ in pairs(routerEvents) do eventCount = eventCount + 1 end
MTH:Print("[DIAG] EventRouter frame: " .. tostring(routerFrame ~= nil) .. ", events: " .. tostring(eventCount), "debug")
-- 4. Debug frame initialized?
local dfInit = (MTH_DebugFrame and MTH_DebugFrame.initialized) and true or false
MTH:Print("[DIAG] DebugFrame initialized: " .. tostring(dfInit), "debug")
MTH:Print("======= End Diagnostics =======", "debug")
end
function SlashCmdList.MTH(msg, editbox) function SlashCmdList.MTH(msg, editbox)
if MTH and MTH.ApplyClassGate and MTH:ApplyClassGate("slash") then if MTH and MTH.ApplyClassGate and MTH:ApplyClassGate("slash") then
return return
@@ -312,16 +352,24 @@ function SlashCmdList.MTH(msg, editbox)
local lowerMsg = string.lower(msg) local lowerMsg = string.lower(msg)
local _, _, lowerCmd, lowerArg = string.find(lowerMsg, "^(%S+)%s*(.-)%s*$") local _, _, lowerCmd, lowerArg = string.find(lowerMsg, "^(%S+)%s*(.-)%s*$")
if msg == "" then if msg == "" then
MTH:Print("Available: /mth options, /mth book") MTH:Print("Available: /mth options, /mth book, /mth diag, /mth err")
elseif lowerMsg == "options" then elseif lowerMsg == "options" then
MTH_CommandOptions() MTH_CommandOptions()
elseif lowerMsg == "book" or lowerMsg == "hunterbook" then elseif lowerMsg == "book" or lowerMsg == "hunterbook" then
MTH_CommandBook() MTH_CommandBook()
elseif lowerMsg == "peers" or lowerMsg == "who" then elseif lowerMsg == "peers" or lowerMsg == "who" then
MTH_CommandPeers() MTH_CommandPeers()
elseif lowerMsg == "diag" then
MTH_CommandDiag()
elseif lowerMsg == "err" or lowerMsg == "errors" or lowerMsg == "debug" then
if MTH_DebugFrame and MTH_DebugFrame.Toggle then
MTH_DebugFrame:Toggle()
else
MTH:Print("Debug frame is not available.")
end
else else
MTH:Print("Unknown command: " .. tostring(msg)) MTH:Print("Unknown command: " .. tostring(msg))
MTH:Print("Available: /mth options, /mth book") MTH:Print("Available: /mth options, /mth book, /mth diag, /mth err")
end end
end end
+6 -6
View File
@@ -29,7 +29,7 @@ function MTH_DebugFrame:Initialize()
self.initialized = true self.initialized = true
-- Create main frame -- Create main frame
self.frame = CreateFrame("Frame", "MTH_DebugFrameWindow", UIParent) self.frame = CreateFrame("Frame", "MTH_DebugWindow", UIParent)
self.frame:SetWidth(800) self.frame:SetWidth(800)
self.frame:SetHeight(400) self.frame:SetHeight(400)
self.frame:SetPoint("CENTER", UIParent, "CENTER") self.frame:SetPoint("CENTER", UIParent, "CENTER")
@@ -51,13 +51,13 @@ function MTH_DebugFrame:Initialize()
if UISpecialFrames then if UISpecialFrames then
local already = false local already = false
for i = 1, table.getn(UISpecialFrames) do for i = 1, table.getn(UISpecialFrames) do
if UISpecialFrames[i] == "MTH_DebugFrameWindow" then if UISpecialFrames[i] == "MTH_DebugWindow" then
already = true already = true
break break
end end
end end
if not already then if not already then
table.insert(UISpecialFrames, "MTH_DebugFrameWindow") table.insert(UISpecialFrames, "MTH_DebugWindow")
end end
end end
@@ -91,7 +91,7 @@ function MTH_DebugFrame:Initialize()
copyButton:SetScript("OnClick", function() MTH_DebugFrame:SelectAllText() end) copyButton:SetScript("OnClick", function() MTH_DebugFrame:SelectAllText() end)
-- Scroll frame + text content with proper vertical scrollbar -- Scroll frame + text content with proper vertical scrollbar
self.scrollFrame = CreateFrame("ScrollFrame", "MTH_DebugScrollFrame", self.frame, "UIPanelScrollFrameTemplate") self.scrollFrame = CreateFrame("ScrollFrame", "MTH_DebugScroll", self.frame, "UIPanelScrollFrameTemplate")
self.scrollFrame:SetPoint("TOPLEFT", self.frame, "TOPLEFT", 15, -50) self.scrollFrame:SetPoint("TOPLEFT", self.frame, "TOPLEFT", 15, -50)
self.scrollFrame:SetPoint("BOTTOMRIGHT", self.frame, "BOTTOMRIGHT", -35, 45) self.scrollFrame:SetPoint("BOTTOMRIGHT", self.frame, "BOTTOMRIGHT", -35, 45)
@@ -366,8 +366,8 @@ MTH_DebugFrame.UninstallHooks = MTH_DF_UninstallHooks
-- Event listener for addon load -- Event listener for addon load
local eventFrame = CreateFrame("Frame") local eventFrame = CreateFrame("Frame")
eventFrame:RegisterEvent("ADDON_LOADED") eventFrame:RegisterEvent("ADDON_LOADED")
eventFrame:SetScript("OnEvent", function(self, event, addonName) eventFrame:SetScript("OnEvent", function()
if event == "ADDON_LOADED" and addonName == "MetaHunt" then if event == "ADDON_LOADED" and arg1 == "MetaHunt" then
if MTH and MTH.GetConfig then if MTH and MTH.GetConfig then
MTH_DF_SetGlobalCaptureEnabled(MTH:GetConfig("debug", "globalErrorCapture", false)) MTH_DF_SetGlobalCaptureEnabled(MTH:GetConfig("debug", "globalErrorCapture", false))
end end
+1 -1
View File
@@ -140,7 +140,7 @@ function MTH_BOOK_GetResistanceShortName(nameText)
if string.find(lowerName, "arcane", 1, true) then return "AR" end if string.find(lowerName, "arcane", 1, true) then return "AR" end
if string.find(lowerName, "nature", 1, true) then return "NR" end if string.find(lowerName, "nature", 1, true) then return "NR" end
if string.find(lowerName, "fire", 1, true) then return "FR" end if string.find(lowerName, "fire", 1, true) then return "FR" end
if string.find(lowerName, "frost", 1, true) then return "FR" end if string.find(lowerName, "frost", 1, true) then return "FrR" end
if string.find(lowerName, "shadow", 1, true) then return "SR" end if string.find(lowerName, "shadow", 1, true) then return "SR" end
return tostring(nameText or "-") return tostring(nameText or "-")
end end
+18 -18
View File
@@ -5066,19 +5066,19 @@ local function MTH_BOOK_WireUI(frame)
listSlider:SetScript("OnMouseDown", function() listSlider:SetScript("OnMouseDown", function()
MTH_BOOK_STATE.sliderDragging = true MTH_BOOK_STATE.sliderDragging = true
MTH_BOOK_SetSliderFromCursor(this) MTH_BOOK_SetSliderFromCursor(this)
this:SetScript("OnUpdate", function()
if IsMouseButtonDown and not IsMouseButtonDown("LeftButton") then
MTH_BOOK_STATE.sliderDragging = false
this:SetScript("OnUpdate", nil)
else
MTH_BOOK_SetSliderFromCursor(this)
end
end)
end) end)
listSlider:SetScript("OnMouseUp", function() listSlider:SetScript("OnMouseUp", function()
MTH_BOOK_SetSliderFromCursor(this) MTH_BOOK_SetSliderFromCursor(this)
MTH_BOOK_STATE.sliderDragging = false MTH_BOOK_STATE.sliderDragging = false
end) this:SetScript("OnUpdate", nil)
listSlider:SetScript("OnUpdate", function()
if MTH_BOOK_STATE.sliderDragging then
if IsMouseButtonDown and not IsMouseButtonDown("LeftButton") then
MTH_BOOK_STATE.sliderDragging = false
else
MTH_BOOK_SetSliderFromCursor(this)
end
end
end) end)
listSlider:SetScript("OnValueChanged", function() listSlider:SetScript("OnValueChanged", function()
local value = this:GetValue() local value = this:GetValue()
@@ -5181,19 +5181,19 @@ local function MTH_BOOK_WireUI(frame)
sliderBackdrop:SetScript("OnMouseDown", function() sliderBackdrop:SetScript("OnMouseDown", function()
MTH_BOOK_STATE.sliderDragging = true MTH_BOOK_STATE.sliderDragging = true
MTH_BOOK_SetSliderFromCursor(listSlider) MTH_BOOK_SetSliderFromCursor(listSlider)
listSlider:SetScript("OnUpdate", function()
if IsMouseButtonDown and not IsMouseButtonDown("LeftButton") then
MTH_BOOK_STATE.sliderDragging = false
this:SetScript("OnUpdate", nil)
else
MTH_BOOK_SetSliderFromCursor(listSlider)
end
end)
end) end)
sliderBackdrop:SetScript("OnMouseUp", function() sliderBackdrop:SetScript("OnMouseUp", function()
MTH_BOOK_SetSliderFromCursor(listSlider) MTH_BOOK_SetSliderFromCursor(listSlider)
MTH_BOOK_STATE.sliderDragging = false MTH_BOOK_STATE.sliderDragging = false
end) listSlider:SetScript("OnUpdate", nil)
sliderBackdrop:SetScript("OnUpdate", function()
if MTH_BOOK_STATE.sliderDragging then
if IsMouseButtonDown and not IsMouseButtonDown("LeftButton") then
MTH_BOOK_STATE.sliderDragging = false
else
MTH_BOOK_SetSliderFromCursor(listSlider)
end
end
end) end)
end end
end end
-1
View File
@@ -9,7 +9,6 @@ local MTH_LOCALE_ALIASES = {
enGB = "enUS", enGB = "enUS",
esMX = "esES", esMX = "esES",
zhTW = "zhCN", zhTW = "zhCN",
frFR = "enUS",
} }
local MTH_SUPPORTED_LOCALES = { local MTH_SUPPORTED_LOCALES = {
+1 -1
View File
@@ -1244,7 +1244,7 @@ function MTH_Map:Init()
self.nodesByZone = self.nodesByZone or {} self.nodesByZone = self.nodesByZone or {}
if not self.controller then if not self.controller then
self.controller = CreateFrame("Frame", "MTHMapController", UIParent) self.controller = CreateFrame("Frame", "MTH_MapController", UIParent)
self.controller:RegisterEvent("PLAYER_ENTERING_WORLD") self.controller:RegisterEvent("PLAYER_ENTERING_WORLD")
self.controller:RegisterEvent("ZONE_CHANGED") self.controller:RegisterEvent("ZONE_CHANGED")
self.controller:RegisterEvent("ZONE_CHANGED_NEW_AREA") self.controller:RegisterEvent("ZONE_CHANGED_NEW_AREA")
+29 -26
View File
@@ -1,5 +1,13 @@
------------------------------------------------------ ------------------------------------------------------
-- MetaHunt Minimap Button -- MetaHunt Minimap Button
--
-- NOTE: The namespace table is MTH_MinimapButton (a plain Lua table).
-- The actual UI frame is named "MTH_MinimapBtn" to avoid a global
-- collision — CreateFrame("...", "MTH_MinimapButton", ...) would
-- OVERWRITE the namespace table with the frame object, orphaning
-- all methods and .frame/.icon references. pfUI iterates Minimap
-- children by name and calls _G[name]:GetHeight(); if the global is
-- a plain {} table instead of a frame, that call crashes.
------------------------------------------------------ ------------------------------------------------------
if not MTH_MinimapButton then if not MTH_MinimapButton then
@@ -84,7 +92,9 @@ function MTH_MinimapButton:Initialize()
return return
end end
local button = CreateFrame("Button", "MTH_MinimapButtonFrame", Minimap) -- Frame name is MTH_MinimapBtn (NOT "MTH_MinimapButton") to avoid
-- overwriting the namespace table in _G.
local button = CreateFrame("Button", "MTH_MinimapBtn", Minimap)
if not button then if not button then
return return
end end
@@ -114,10 +124,9 @@ function MTH_MinimapButton:Initialize()
highlight:SetHeight(31) highlight:SetHeight(31)
highlight:SetPoint("CENTER", button, "CENTER", 0, 0) highlight:SetPoint("CENTER", button, "CENTER", 0, 0)
button:SetScript("OnEnter", function(self) button:SetScript("OnEnter", function()
self = self or this if not this then return end
if not self then return end GameTooltip:SetOwner(this, "ANCHOR_LEFT")
GameTooltip:SetOwner(self, "ANCHOR_LEFT")
GameTooltip:SetText(MTH_MB_L("MINIMAP_TITLE", "MetaHunt"), 1, 0.82, 0) GameTooltip:SetText(MTH_MB_L("MINIMAP_TITLE", "MetaHunt"), 1, 0.82, 0)
GameTooltip:AddLine(MTH_MB_L("MINIMAP_HINT_LEFT_CLICK", "Left-Click: Open Hunter Book"), 1, 1, 1) GameTooltip:AddLine(MTH_MB_L("MINIMAP_HINT_LEFT_CLICK", "Left-Click: Open Hunter Book"), 1, 1, 1)
GameTooltip:AddLine(MTH_MB_L("MINIMAP_HINT_RIGHT_CLICK", "Right-Click: Open MetaHunt Options"), 1, 1, 1) GameTooltip:AddLine(MTH_MB_L("MINIMAP_HINT_RIGHT_CLICK", "Right-Click: Open MetaHunt Options"), 1, 1, 1)
@@ -129,25 +138,23 @@ function MTH_MinimapButton:Initialize()
GameTooltip:Hide() GameTooltip:Hide()
end) end)
button:SetScript("OnDragStart", function(self) button:SetScript("OnDragStart", function()
self = self or this if not this then return end
if not self then return end this.dragging = 1
self.dragging = 1 this:SetScript("OnUpdate", function()
self:SetScript("OnUpdate", function()
MTH_MB_UpdateDragPosition() MTH_MB_UpdateDragPosition()
end) end)
end) end)
button:SetScript("OnDragStop", function(self) button:SetScript("OnDragStop", function()
self = self or this if not this then return end
if not self then return end this.dragging = nil
self.dragging = nil this:SetScript("OnUpdate", nil)
self:SetScript("OnUpdate", nil)
MTH_MB_UpdateDragPosition() MTH_MB_UpdateDragPosition()
end) end)
button:SetScript("OnClick", function(_, mouseButton) button:SetScript("OnClick", function()
mouseButton = mouseButton or arg1 local mouseButton = arg1
if mouseButton == "RightButton" then if mouseButton == "RightButton" then
if type(MTH_OpenOptions) == "function" then if type(MTH_OpenOptions) == "function" then
MTH_OpenOptions("General") MTH_OpenOptions("General")
@@ -167,16 +174,12 @@ function MTH_MinimapButton:Initialize()
MTH_MB_UpdatePosition() MTH_MB_UpdatePosition()
end end
local loader = CreateFrame("Frame", "MTH_MinimapButtonLoader") local loader = CreateFrame("Frame", "MTH_MinimapLoader")
loader:RegisterEvent("ADDON_LOADED") loader:RegisterEvent("ADDON_LOADED")
loader:SetScript("OnEvent", function(self, eventName, addonName) loader:SetScript("OnEvent", function()
eventName = eventName or event if event == "ADDON_LOADED" and arg1 == "MetaHunt" then
addonName = addonName or arg1
if eventName == "ADDON_LOADED" and addonName == "MetaHunt" then
MTH_MinimapButton:Initialize() MTH_MinimapButton:Initialize()
if self and self.UnregisterAllEvents then this:UnregisterAllEvents()
self:UnregisterAllEvents() this:SetScript("OnEvent", nil)
self:SetScript("OnEvent", nil)
end
end end
end) end)
+30 -40
View File
@@ -657,28 +657,25 @@ local function MTH_AB_CreateRow(container, subtype, index, xBase, yOffset)
row.suffix:SetText("Stacks") row.suffix:SetText("Stacks")
if row.check then if row.check then
row.check:SetScript("OnClick", function(self) row.check:SetScript("OnClick", function()
self = self or this if not this or MTH_AB_STATE.syncing then return end
if not self or MTH_AB_STATE.syncing then return end
local store = MTH_AB_EnsureConfig() local store = MTH_AB_EnsureConfig()
MTH_AB_SetRuleEnabled(store, subtype, index, MTH_AB_IsChecked(self)) MTH_AB_SetRuleEnabled(store, subtype, index, MTH_AB_IsChecked(this))
MTH_AB_RefreshOptionsUI() MTH_AB_RefreshOptionsUI()
end) end)
end end
row.qty:SetScript("OnEnterPressed", function(self) row.qty:SetScript("OnEnterPressed", function()
self = self or this if not this then return end
if not self then return end
local store = MTH_AB_EnsureConfig() local store = MTH_AB_EnsureConfig()
MTH_AB_SetRuleStacks(store, subtype, index, self:GetText()) MTH_AB_SetRuleStacks(store, subtype, index, this:GetText())
MTH_AB_RefreshOptionsUI() MTH_AB_RefreshOptionsUI()
self:ClearFocus() this:ClearFocus()
end) end)
row.qty:SetScript("OnEditFocusLost", function(self) row.qty:SetScript("OnEditFocusLost", function()
self = self or this if not this then return end
if not self then return end
local store = MTH_AB_EnsureConfig() local store = MTH_AB_EnsureConfig()
MTH_AB_SetRuleStacks(store, subtype, index, self:GetText()) MTH_AB_SetRuleStacks(store, subtype, index, this:GetText())
MTH_AB_RefreshOptionsUI() MTH_AB_RefreshOptionsUI()
end) end)
@@ -715,11 +712,10 @@ local function MTH_AB_BuildUI(container)
controls.moduleEnabled = MTH_CreateCheckbox(container, "MetaHuntOptionsAutoBuyModuleEnabled", "Enable Auto Buy module", -30) controls.moduleEnabled = MTH_CreateCheckbox(container, "MetaHuntOptionsAutoBuyModuleEnabled", "Enable Auto Buy module", -30)
if controls.moduleEnabled then if controls.moduleEnabled then
controls.moduleEnabled:SetScript("OnClick", function(self) controls.moduleEnabled:SetScript("OnClick", function()
self = self or this if not this or MTH_AB_STATE.syncing then return end
if not self or MTH_AB_STATE.syncing then return end
if MTH and MTH.SetModuleEnabled then if MTH and MTH.SetModuleEnabled then
local ok, err = MTH:SetModuleEnabled("autobuy", MTH_AB_IsChecked(self)) local ok, err = MTH:SetModuleEnabled("autobuy", MTH_AB_IsChecked(this))
if not ok and MTH and MTH.Print then if not ok and MTH and MTH.Print then
MTH:Print("Failed to change Auto Buy state: " .. tostring(err), "error") MTH:Print("Failed to change Auto Buy state: " .. tostring(err), "error")
end end
@@ -730,11 +726,10 @@ local function MTH_AB_BuildUI(container)
controls.projectilesEnabled = MTH_CreateCheckbox(container, "MetaHuntOptionsAutoBuyProjectilesEnabled", "Enable for Projectiles", -74) controls.projectilesEnabled = MTH_CreateCheckbox(container, "MetaHuntOptionsAutoBuyProjectilesEnabled", "Enable for Projectiles", -74)
if controls.projectilesEnabled then if controls.projectilesEnabled then
controls.projectilesEnabled:SetScript("OnClick", function(self) controls.projectilesEnabled:SetScript("OnClick", function()
self = self or this if not this or MTH_AB_STATE.syncing then return end
if not self or MTH_AB_STATE.syncing then return end
local store = MTH_AB_EnsureConfig() local store = MTH_AB_EnsureConfig()
store.projectiles.enabled = MTH_AB_IsChecked(self) store.projectiles.enabled = MTH_AB_IsChecked(this)
MTH_AB_RefreshOptionsUI() MTH_AB_RefreshOptionsUI()
end) end)
end end
@@ -769,11 +764,10 @@ local function MTH_AB_BuildUI(container)
controls.petFoodEnabled = MTH_CreateCheckbox(container, "MetaHuntOptionsAutoBuyPetFoodEnabled", "Enable for Pet Food", -322, MTH_AB_LAYOUT.LEFT_SECTION_X) controls.petFoodEnabled = MTH_CreateCheckbox(container, "MetaHuntOptionsAutoBuyPetFoodEnabled", "Enable for Pet Food", -322, MTH_AB_LAYOUT.LEFT_SECTION_X)
if controls.petFoodEnabled then if controls.petFoodEnabled then
controls.petFoodEnabled:SetScript("OnClick", function(self) controls.petFoodEnabled:SetScript("OnClick", function()
self = self or this if not this or MTH_AB_STATE.syncing then return end
if not self or MTH_AB_STATE.syncing then return end
local store = MTH_AB_EnsureConfig() local store = MTH_AB_EnsureConfig()
store.petFood.enabled = MTH_AB_IsChecked(self) store.petFood.enabled = MTH_AB_IsChecked(this)
MTH_AB_RefreshOptionsUI() MTH_AB_RefreshOptionsUI()
end) end)
end end
@@ -791,19 +785,17 @@ local function MTH_AB_BuildUI(container)
controls.petFoodQty:SetHeight(20) controls.petFoodQty:SetHeight(20)
controls.petFoodQty:SetNumeric(true) controls.petFoodQty:SetNumeric(true)
controls.petFoodQty:SetAutoFocus(false) controls.petFoodQty:SetAutoFocus(false)
controls.petFoodQty:SetScript("OnEnterPressed", function(self) controls.petFoodQty:SetScript("OnEnterPressed", function()
self = self or this if not this then return end
if not self then return end
local store = MTH_AB_EnsureConfig() local store = MTH_AB_EnsureConfig()
MTH_AB_SetPetFoodStacks(store, self:GetText()) MTH_AB_SetPetFoodStacks(store, this:GetText())
MTH_AB_RefreshOptionsUI() MTH_AB_RefreshOptionsUI()
self:ClearFocus() this:ClearFocus()
end) end)
controls.petFoodQty:SetScript("OnEditFocusLost", function(self) controls.petFoodQty:SetScript("OnEditFocusLost", function()
self = self or this if not this then return end
if not self then return end
local store = MTH_AB_EnsureConfig() local store = MTH_AB_EnsureConfig()
MTH_AB_SetPetFoodStacks(store, self:GetText()) MTH_AB_SetPetFoodStacks(store, this:GetText())
MTH_AB_RefreshOptionsUI() MTH_AB_RefreshOptionsUI()
end) end)
end end
@@ -816,9 +808,8 @@ local function MTH_AB_BuildUI(container)
controls.petFoodScopeCurrent = MTH_CreateCheckbox(container, "MetaHuntOptionsAutoBuyPetFoodScopeCurrent", "Buy only for my current pet", -376, MTH_AB_LAYOUT.LEFT_SECTION_X + 28) controls.petFoodScopeCurrent = MTH_CreateCheckbox(container, "MetaHuntOptionsAutoBuyPetFoodScopeCurrent", "Buy only for my current pet", -376, MTH_AB_LAYOUT.LEFT_SECTION_X + 28)
if controls.petFoodScopeCurrent then if controls.petFoodScopeCurrent then
controls.petFoodScopeCurrent:SetScript("OnClick", function(self) controls.petFoodScopeCurrent:SetScript("OnClick", function()
self = self or this if not this or MTH_AB_STATE.syncing then return end
if not self or MTH_AB_STATE.syncing then return end
local store = MTH_AB_EnsureConfig() local store = MTH_AB_EnsureConfig()
store.petFood.scope = "current" store.petFood.scope = "current"
MTH_AB_RefreshOptionsUI() MTH_AB_RefreshOptionsUI()
@@ -827,9 +818,8 @@ local function MTH_AB_BuildUI(container)
controls.petFoodScopeAll = MTH_CreateCheckbox(container, "MetaHuntOptionsAutoBuyPetFoodScopeAll", "Buy for all my pets", -402, MTH_AB_LAYOUT.LEFT_SECTION_X + 28) controls.petFoodScopeAll = MTH_CreateCheckbox(container, "MetaHuntOptionsAutoBuyPetFoodScopeAll", "Buy for all my pets", -402, MTH_AB_LAYOUT.LEFT_SECTION_X + 28)
if controls.petFoodScopeAll then if controls.petFoodScopeAll then
controls.petFoodScopeAll:SetScript("OnClick", function(self) controls.petFoodScopeAll:SetScript("OnClick", function()
self = self or this if not this or MTH_AB_STATE.syncing then return end
if not self or MTH_AB_STATE.syncing then return end
local store = MTH_AB_EnsureConfig() local store = MTH_AB_EnsureConfig()
store.petFood.scope = "all" store.petFood.scope = "all"
MTH_AB_RefreshOptionsUI() MTH_AB_RefreshOptionsUI()
+10 -14
View File
@@ -72,10 +72,9 @@ function MTH_SetupAutoQuestOptions()
local moduleToggle = MTH_CreateCheckbox(container, "MetaHuntOptionsAutoQuestModuleToggle", "Enable Auto Quest module", -70, 20) local moduleToggle = MTH_CreateCheckbox(container, "MetaHuntOptionsAutoQuestModuleToggle", "Enable Auto Quest module", -70, 20)
if moduleToggle then if moduleToggle then
moduleToggle:SetChecked(moduleEnabled and true or false) moduleToggle:SetChecked(moduleEnabled and true or false)
moduleToggle:SetScript("OnClick", function(self) moduleToggle:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end local enabled = MTH_AQ_IsChecked(this)
local enabled = MTH_AQ_IsChecked(self)
if MTH and MTH.SetModuleEnabled then if MTH and MTH.SetModuleEnabled then
local ok, err = MTH:SetModuleEnabled("autoquest", enabled) local ok, err = MTH:SetModuleEnabled("autoquest", enabled)
if not ok and MTH and MTH.Print then if not ok and MTH and MTH.Print then
@@ -84,7 +83,7 @@ function MTH_SetupAutoQuestOptions()
end end
local module = MTH and MTH.GetModule and MTH:GetModule("autoquest") or nil local module = MTH and MTH.GetModule and MTH:GetModule("autoquest") or nil
local actual = (type(module) == "table" and module.enabled ~= nil) and (module.enabled and true or false) or enabled local actual = (type(module) == "table" and module.enabled ~= nil) and (module.enabled and true or false) or enabled
self:SetChecked(actual and true or false) this:SetChecked(actual and true or false)
end) end)
end end
@@ -151,9 +150,8 @@ function MTH_SetupAutoQuestOptions()
store.scorpokDrazial and true or false store.scorpokDrazial and true or false
) )
if scorpokToggle then if scorpokToggle then
scorpokToggle:SetScript("OnClick", function(self) scorpokToggle:SetScript("OnClick", function()
self = self or this local enabled = MTH_AQ_IsChecked(this)
local enabled = MTH_AQ_IsChecked(self)
store.scorpokDrazial = enabled and true or false store.scorpokDrazial = enabled and true or false
if MTH and MTH.GetModuleCharSavedVariables then if MTH and MTH.GetModuleCharSavedVariables then
local moduleStore = MTH:GetModuleCharSavedVariables("autoquest") local moduleStore = MTH:GetModuleCharSavedVariables("autoquest")
@@ -176,9 +174,8 @@ function MTH_SetupAutoQuestOptions()
store.scorpokTooltip and true or false store.scorpokTooltip and true or false
) )
if tooltipToggle then if tooltipToggle then
tooltipToggle:SetScript("OnClick", function(self) tooltipToggle:SetScript("OnClick", function()
self = self or this local enabled = MTH_AQ_IsChecked(this)
local enabled = MTH_AQ_IsChecked(self)
store.scorpokTooltip = enabled and true or false store.scorpokTooltip = enabled and true or false
if MTH and MTH.GetModuleCharSavedVariables then if MTH and MTH.GetModuleCharSavedVariables then
local moduleStore = MTH:GetModuleCharSavedVariables("autoquest") local moduleStore = MTH:GetModuleCharSavedVariables("autoquest")
@@ -212,9 +209,8 @@ function MTH_SetupAutoQuestOptions()
store.arrowsForSissies and true or false store.arrowsForSissies and true or false
) )
if sissiesToggle then if sissiesToggle then
sissiesToggle:SetScript("OnClick", function(self) sissiesToggle:SetScript("OnClick", function()
self = self or this local enabled = MTH_AQ_IsChecked(this)
local enabled = MTH_AQ_IsChecked(self)
store.arrowsForSissies = enabled and true or false store.arrowsForSissies = enabled and true or false
if MTH and MTH.GetModuleCharSavedVariables then if MTH and MTH.GetModuleCharSavedVariables then
local moduleStore = MTH:GetModuleCharSavedVariables("autoquest") local moduleStore = MTH:GetModuleCharSavedVariables("autoquest")
+29 -38
View File
@@ -326,13 +326,12 @@ local function MTH_CHRON_MakeInput(parent, name, x, y, width, height, value, onA
edit:SetHeight(height or 20) edit:SetHeight(height or 20)
edit:SetAutoFocus(false) edit:SetAutoFocus(false)
edit:SetText(tostring(value or "")) edit:SetText(tostring(value or ""))
edit:SetScript("OnEnterPressed", function(self) edit:SetScript("OnEnterPressed", function()
self = self or this if not this then return end
if not self then return end
if type(onAccept) == "function" then if type(onAccept) == "function" then
onAccept(self:GetText() or "") onAccept(this:GetText() or "")
end end
self:ClearFocus() this:ClearFocus()
end) end)
return edit return edit
end end
@@ -385,16 +384,15 @@ local function MTH_CHRON_RenderTimerSection(container, profile, title, items, bu
local check = MTH_CreateCheckbox(container, controlName, label, timerY, timerX) local check = MTH_CreateCheckbox(container, controlName, label, timerY, timerX)
if check then if check then
check:SetChecked(profile.disabledSpells[bucket][timerName] == nil and true or false) check:SetChecked(profile.disabledSpells[bucket][timerName] == nil and true or false)
check:SetScript("OnClick", function(self) check:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end
local currentlyDisabled = profile.disabledSpells[bucket][timerName] ~= nil local currentlyDisabled = profile.disabledSpells[bucket][timerName] ~= nil
if currentlyDisabled then if currentlyDisabled then
profile.disabledSpells[bucket][timerName] = nil profile.disabledSpells[bucket][timerName] = nil
self:SetChecked(true) this:SetChecked(true)
else else
profile.disabledSpells[bucket][timerName] = {} profile.disabledSpells[bucket][timerName] = {}
self:SetChecked(nil) this:SetChecked(nil)
end end
MTH_CHRON_ApplyLiveProfile(profile) MTH_CHRON_ApplyLiveProfile(profile)
@@ -470,10 +468,9 @@ function MTH_SetupChronometerOptions(tabKey)
if moduleCheck then if moduleCheck then
local module = MTH and MTH:GetModule("chronometer") local module = MTH and MTH:GetModule("chronometer")
moduleCheck:SetChecked(module and module.enabled and true or false) moduleCheck:SetChecked(module and module.enabled and true or false)
moduleCheck:SetScript("OnClick", function(self) moduleCheck:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end local enabled = MTH_CHRON_IsChecked(this)
local enabled = MTH_CHRON_IsChecked(self)
if MTH and MTH.SetModuleEnabled then if MTH and MTH.SetModuleEnabled then
MTH:SetModuleEnabled("chronometer", enabled) MTH:SetModuleEnabled("chronometer", enabled)
end end
@@ -495,40 +492,36 @@ function MTH_SetupChronometerOptions(tabKey)
local killCheck = MTH_CreateCheckbox(container, "MetaHuntOptionsChronometerFadeOnKill", "Fade on kill", -154) local killCheck = MTH_CreateCheckbox(container, "MetaHuntOptionsChronometerFadeOnKill", "Fade on kill", -154)
if killCheck then if killCheck then
killCheck:SetChecked(profile.fadeonkill and true or false) killCheck:SetChecked(profile.fadeonkill and true or false)
killCheck:SetScript("OnClick", function(self) killCheck:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end profile.fadeonkill = MTH_CHRON_IsChecked(this)
profile.fadeonkill = MTH_CHRON_IsChecked(self)
end) end)
end end
local fadeCheck = MTH_CreateCheckbox(container, "MetaHuntOptionsChronometerFadeOnFade", "Fade on aura fade", -179) local fadeCheck = MTH_CreateCheckbox(container, "MetaHuntOptionsChronometerFadeOnFade", "Fade on aura fade", -179)
if fadeCheck then if fadeCheck then
fadeCheck:SetChecked(profile.fadeonfade and true or false) fadeCheck:SetChecked(profile.fadeonfade and true or false)
fadeCheck:SetScript("OnClick", function(self) fadeCheck:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end profile.fadeonfade = MTH_CHRON_IsChecked(this)
profile.fadeonfade = MTH_CHRON_IsChecked(self)
end) end)
end end
local selfCheck = MTH_CreateCheckbox(container, "MetaHuntOptionsChronometerSelfBars", "Show self bars", -204) local selfCheck = MTH_CreateCheckbox(container, "MetaHuntOptionsChronometerSelfBars", "Show self bars", -204)
if selfCheck then if selfCheck then
selfCheck:SetChecked(profile.selfbars and true or false) selfCheck:SetChecked(profile.selfbars and true or false)
selfCheck:SetScript("OnClick", function(self) selfCheck:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end profile.selfbars = MTH_CHRON_IsChecked(this)
profile.selfbars = MTH_CHRON_IsChecked(self)
end) end)
end end
local onlySelfCheck = MTH_CreateCheckbox(container, "MetaHuntOptionsChronometerOnlySelf", "Only self target", -229) local onlySelfCheck = MTH_CreateCheckbox(container, "MetaHuntOptionsChronometerOnlySelf", "Only self target", -229)
if onlySelfCheck then if onlySelfCheck then
onlySelfCheck:SetChecked(profile.onlyself and true or false) onlySelfCheck:SetChecked(profile.onlyself and true or false)
onlySelfCheck:SetScript("OnClick", function(self) onlySelfCheck:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end profile.onlyself = MTH_CHRON_IsChecked(this)
profile.onlyself = MTH_CHRON_IsChecked(self)
end) end)
end end
elseif section == "bar" then elseif section == "bar" then
@@ -610,10 +603,9 @@ function MTH_SetupChronometerOptions(tabKey)
local growCheck = MTH_CreateCheckbox(container, "MetaHuntOptionsChronometerGrowUp", "Grow bars upward", -438) local growCheck = MTH_CreateCheckbox(container, "MetaHuntOptionsChronometerGrowUp", "Grow bars upward", -438)
if growCheck then if growCheck then
growCheck:SetChecked(profile.growup and true or false) growCheck:SetChecked(profile.growup and true or false)
growCheck:SetScript("OnClick", function(self) growCheck:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end profile.growup = MTH_CHRON_IsChecked(this)
profile.growup = MTH_CHRON_IsChecked(self)
MTH_CHRON_ApplyLiveProfile(profile) MTH_CHRON_ApplyLiveProfile(profile)
end) end)
end end
@@ -621,10 +613,9 @@ function MTH_SetupChronometerOptions(tabKey)
local reverseCheck = MTH_CreateCheckbox(container, "MetaHuntOptionsChronometerReverse", "Reverse bars", -463) local reverseCheck = MTH_CreateCheckbox(container, "MetaHuntOptionsChronometerReverse", "Reverse bars", -463)
if reverseCheck then if reverseCheck then
reverseCheck:SetChecked(profile.reverse and true or false) reverseCheck:SetChecked(profile.reverse and true or false)
reverseCheck:SetScript("OnClick", function(self) reverseCheck:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end profile.reverse = MTH_CHRON_IsChecked(this)
profile.reverse = MTH_CHRON_IsChecked(self)
MTH_CHRON_ApplyLiveProfile(profile) MTH_CHRON_ApplyLiveProfile(profile)
end) end)
end end
+18 -20
View File
@@ -226,10 +226,9 @@ function MTH_SetupFeedOMaticOptions()
local moduleCheck = MTH_CreateCheckbox(container, "MetaHuntOptionsFeedOMaticEnabled", MTH_FOM_L("FOM_ENABLE_MODULE", "Enable FeedOMatic module"), -32 + yAdjust) local moduleCheck = MTH_CreateCheckbox(container, "MetaHuntOptionsFeedOMaticEnabled", MTH_FOM_L("FOM_ENABLE_MODULE", "Enable FeedOMatic module"), -32 + yAdjust)
if moduleCheck then if moduleCheck then
moduleCheck:SetScript("OnClick", function(self) moduleCheck:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end local enabled = this:GetChecked() == 1
local enabled = self:GetChecked() == 1
if MTH and MTH.SetModuleEnabled then if MTH and MTH.SetModuleEnabled then
local ok, err = MTH:SetModuleEnabled("feedomatic", enabled) local ok, err = MTH:SetModuleEnabled("feedomatic", enabled)
if not ok and MTH and MTH.Print then if not ok and MTH and MTH.Print then
@@ -263,11 +262,11 @@ function MTH_SetupFeedOMaticOptions()
MTH_FOM_StartBindingCapture() MTH_FOM_StartBindingCapture()
end end
end) end)
bindButton:SetScript("OnKeyDown", function(_, key) bindButton:SetScript("OnKeyDown", function()
if not MTH_FOM_STATE.bindingCapture then if not MTH_FOM_STATE.bindingCapture then
return return
end end
key = key or arg1 local key = arg1
if not key or key == "" then if not key or key == "" then
return return
end end
@@ -305,10 +304,10 @@ function MTH_SetupFeedOMaticOptions()
MTH_FOM_STATE.ctrl.PreferHigherQuality = MTH_CreateCheckbox(container, "MetaHuntOptionsFOMPreferQuality", FOM_OptionsButtonText and FOM_OptionsButtonText["PreferHigherQuality"] or MTH_FOM_L("FOM_LABEL_PREFER_HIGHER_QUALITY_FOOD", "Prefer higher quality food"), -220 + yAdjust) MTH_FOM_STATE.ctrl.PreferHigherQuality = MTH_CreateCheckbox(container, "MetaHuntOptionsFOMPreferQuality", FOM_OptionsButtonText and FOM_OptionsButtonText["PreferHigherQuality"] or MTH_FOM_L("FOM_LABEL_PREFER_HIGHER_QUALITY_FOOD", "Prefer higher quality food"), -220 + yAdjust)
MTH_FOM_STATE.ctrl.Fallback = MTH_CreateCheckbox(container, "MetaHuntOptionsFOMFallback", FOM_OptionsButtonText and FOM_OptionsButtonText["Fallback"] or MTH_FOM_L("FOM_LABEL_FALLBACK_TO_AVOIDED_FOODS", "Fallback to avoided foods"), -245 + yAdjust) MTH_FOM_STATE.ctrl.Fallback = MTH_CreateCheckbox(container, "MetaHuntOptionsFOMFallback", FOM_OptionsButtonText and FOM_OptionsButtonText["Fallback"] or MTH_FOM_L("FOM_LABEL_FALLBACK_TO_AVOIDED_FOODS", "Fallback to avoided foods"), -245 + yAdjust)
if MTH_FOM_STATE.ctrl.AvoidQuestFood then MTH_FOM_STATE.ctrl.AvoidQuestFood:SetScript("OnClick", function(self) self = self or this if not self then return end FOM_Config.AvoidQuestFood = self:GetChecked() == 1 end) end if MTH_FOM_STATE.ctrl.AvoidQuestFood then MTH_FOM_STATE.ctrl.AvoidQuestFood:SetScript("OnClick", function() if not this then return end FOM_Config.AvoidQuestFood = this:GetChecked() == 1 end) end
if MTH_FOM_STATE.ctrl.AvoidBonusFood then MTH_FOM_STATE.ctrl.AvoidBonusFood:SetScript("OnClick", function(self) self = self or this if not self then return end FOM_Config.AvoidBonusFood = self:GetChecked() == 1 end) end if MTH_FOM_STATE.ctrl.AvoidBonusFood then MTH_FOM_STATE.ctrl.AvoidBonusFood:SetScript("OnClick", function() if not this then return end FOM_Config.AvoidBonusFood = this:GetChecked() == 1 end) end
if MTH_FOM_STATE.ctrl.PreferHigherQuality then MTH_FOM_STATE.ctrl.PreferHigherQuality:SetScript("OnClick", function(self) self = self or this if not self then return end FOM_Config.PreferHigherQuality = self:GetChecked() == 1 end) end if MTH_FOM_STATE.ctrl.PreferHigherQuality then MTH_FOM_STATE.ctrl.PreferHigherQuality:SetScript("OnClick", function() if not this then return end FOM_Config.PreferHigherQuality = this:GetChecked() == 1 end) end
if MTH_FOM_STATE.ctrl.Fallback then MTH_FOM_STATE.ctrl.Fallback:SetScript("OnClick", function(self) self = self or this if not self then return end FOM_Config.Fallback = self:GetChecked() == 1 end) end if MTH_FOM_STATE.ctrl.Fallback then MTH_FOM_STATE.ctrl.Fallback:SetScript("OnClick", function() if not this then return end FOM_Config.Fallback = this:GetChecked() == 1 end) end
local keepOpenLabel = container:CreateFontString("MetaHuntOptionsFOMKeepOpenLabel", "ARTWORK", "GameFontNormalSmall") local keepOpenLabel = container:CreateFontString("MetaHuntOptionsFOMKeepOpenLabel", "ARTWORK", "GameFontNormalSmall")
keepOpenLabel:SetPoint("TOPLEFT", container, "TOPLEFT", 20, -302 + yAdjust) keepOpenLabel:SetPoint("TOPLEFT", container, "TOPLEFT", 20, -302 + yAdjust)
@@ -320,14 +319,13 @@ function MTH_SetupFeedOMaticOptions()
keepOpen:SetHeight(20) keepOpen:SetHeight(20)
keepOpen:SetNumeric(true) keepOpen:SetNumeric(true)
keepOpen:SetAutoFocus(false) keepOpen:SetAutoFocus(false)
keepOpen:SetScript("OnTextChanged", function(self) keepOpen:SetScript("OnTextChanged", function()
self = self or this if not this then return end
if not self then return end local value = tonumber(this:GetText()) or 0
local value = tonumber(self:GetText()) or 0
FOM_Config.KeepOpenSlots = value FOM_Config.KeepOpenSlots = value
end) end)
keepOpen:SetScript("OnEnterPressed", function(self) self = self or this if self then self:ClearFocus() end end) keepOpen:SetScript("OnEnterPressed", function() if this then this:ClearFocus() end end)
keepOpen:SetScript("OnEscapePressed", function(self) self = self or this if self then self:ClearFocus() end end) keepOpen:SetScript("OnEscapePressed", function() if this then this:ClearFocus() end end)
MTH_FOM_STATE.keepOpenEdit = keepOpen MTH_FOM_STATE.keepOpenEdit = keepOpen
local notifyHeader = container:CreateFontString("MetaHuntOptionsFOMNotifyHeader", "ARTWORK", "GameFontHighlight") local notifyHeader = container:CreateFontString("MetaHuntOptionsFOMNotifyHeader", "ARTWORK", "GameFontHighlight")
@@ -356,10 +354,10 @@ function MTH_SetupFeedOMaticOptions()
MTH_FOM_STATE.ctrl.AudioWarningBell = MTH_CreateCheckbox(container, "MetaHuntOptionsFOMAudioWarningBell", FOM_OptionsButtonText and FOM_OptionsButtonText["AudioWarningBell"] or MTH_FOM_L("FOM_LABEL_USE_BELL_SOUND", "Use bell sound"), -403 + yAdjust, rightColumnX) MTH_FOM_STATE.ctrl.AudioWarningBell = MTH_CreateCheckbox(container, "MetaHuntOptionsFOMAudioWarningBell", FOM_OptionsButtonText and FOM_OptionsButtonText["AudioWarningBell"] or MTH_FOM_L("FOM_LABEL_USE_BELL_SOUND", "Use bell sound"), -403 + yAdjust, rightColumnX)
MTH_FOM_STATE.ctrl.TextWarning = MTH_CreateCheckbox(container, "MetaHuntOptionsFOMTextWarning", FOM_OptionsButtonText and FOM_OptionsButtonText["TextWarning"] or MTH_FOM_L("FOM_LABEL_SHOW_TEXT", "Show text"), -428 + yAdjust, rightColumnX) MTH_FOM_STATE.ctrl.TextWarning = MTH_CreateCheckbox(container, "MetaHuntOptionsFOMTextWarning", FOM_OptionsButtonText and FOM_OptionsButtonText["TextWarning"] or MTH_FOM_L("FOM_LABEL_SHOW_TEXT", "Show text"), -428 + yAdjust, rightColumnX)
MTH_FOM_STATE.ctrl.IconWarning = MTH_CreateCheckbox(container, "MetaHuntOptionsFOMIconWarning", FOM_OptionsButtonText and FOM_OptionsButtonText["IconWarning"] or MTH_FOM_L("FOM_LABEL_FLASH_ICON", "Flash icon"), -453 + yAdjust, rightColumnX) MTH_FOM_STATE.ctrl.IconWarning = MTH_CreateCheckbox(container, "MetaHuntOptionsFOMIconWarning", FOM_OptionsButtonText and FOM_OptionsButtonText["IconWarning"] or MTH_FOM_L("FOM_LABEL_FLASH_ICON", "Flash icon"), -453 + yAdjust, rightColumnX)
if MTH_FOM_STATE.ctrl.AudioWarning then MTH_FOM_STATE.ctrl.AudioWarning:SetScript("OnClick", function(self) self = self or this if not self then return end if self:GetChecked() == 1 then if FOM_Config.AudioWarning ~= "bell" then FOM_Config.AudioWarning = true end else FOM_Config.AudioWarning = nil end MTH_RefreshFeedOMaticOptions() end) end if MTH_FOM_STATE.ctrl.AudioWarning then MTH_FOM_STATE.ctrl.AudioWarning:SetScript("OnClick", function() if not this then return end if this:GetChecked() == 1 then if FOM_Config.AudioWarning ~= "bell" then FOM_Config.AudioWarning = true end else FOM_Config.AudioWarning = nil end MTH_RefreshFeedOMaticOptions() end) end
if MTH_FOM_STATE.ctrl.AudioWarningBell then MTH_FOM_STATE.ctrl.AudioWarningBell:SetScript("OnClick", function(self) self = self or this if not self then return end if self:GetChecked() == 1 then FOM_Config.AudioWarning = "bell" else FOM_Config.AudioWarning = true end MTH_RefreshFeedOMaticOptions() end) end if MTH_FOM_STATE.ctrl.AudioWarningBell then MTH_FOM_STATE.ctrl.AudioWarningBell:SetScript("OnClick", function() if not this then return end if this:GetChecked() == 1 then FOM_Config.AudioWarning = "bell" else FOM_Config.AudioWarning = true end MTH_RefreshFeedOMaticOptions() end) end
if MTH_FOM_STATE.ctrl.TextWarning then MTH_FOM_STATE.ctrl.TextWarning:SetScript("OnClick", function(self) self = self or this if not self then return end FOM_Config.TextWarning = self:GetChecked() == 1 end) end if MTH_FOM_STATE.ctrl.TextWarning then MTH_FOM_STATE.ctrl.TextWarning:SetScript("OnClick", function() if not this then return end FOM_Config.TextWarning = this:GetChecked() == 1 end) end
if MTH_FOM_STATE.ctrl.IconWarning then MTH_FOM_STATE.ctrl.IconWarning:SetScript("OnClick", function(self) self = self or this if not self then return end FOM_Config.IconWarning = self:GetChecked() == 1 end) end if MTH_FOM_STATE.ctrl.IconWarning then MTH_FOM_STATE.ctrl.IconWarning:SetScript("OnClick", function() if not this then return end FOM_Config.IconWarning = this:GetChecked() == 1 end) end
local cookHeader = container:CreateFontString("MetaHuntOptionsFOMCookingHeader", "ARTWORK", "GameFontHighlight") local cookHeader = container:CreateFontString("MetaHuntOptionsFOMCookingHeader", "ARTWORK", "GameFontHighlight")
cookHeader:SetPoint("TOPLEFT", container, "TOPLEFT", rightColumnX, -62 + yAdjust) cookHeader:SetPoint("TOPLEFT", container, "TOPLEFT", rightColumnX, -62 + yAdjust)
+24 -32
View File
@@ -297,11 +297,10 @@ local function MTH_ICU_BuildUI(container)
local moduleEnabled = MTH_CreateCheckbox(container, "MetaHuntOptionsICUModuleEnabled", "Enable ICU module", -72, MTH_ICU_LAYOUT.LEFT_X) local moduleEnabled = MTH_CreateCheckbox(container, "MetaHuntOptionsICUModuleEnabled", "Enable ICU module", -72, MTH_ICU_LAYOUT.LEFT_X)
if moduleEnabled then if moduleEnabled then
moduleEnabled:SetScript("OnClick", function(self) moduleEnabled:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end
if MTH and MTH.SetModuleEnabled then if MTH and MTH.SetModuleEnabled then
local ok, err = MTH:SetModuleEnabled("icu", self:GetChecked() == 1) local ok, err = MTH:SetModuleEnabled("icu", this:GetChecked() == 1)
if not ok and MTH and MTH.Print then if not ok and MTH and MTH.Print then
MTH:Print("Failed to change ICU module state: " .. tostring(err), "error") MTH:Print("Failed to change ICU module state: " .. tostring(err), "error")
end end
@@ -313,11 +312,10 @@ local function MTH_ICU_BuildUI(container)
local mouseOver = MTH_CreateCheckbox(container, "MetaHuntOptionsICUMouseOver", "Enable CTRL mouseover scan", -98, MTH_ICU_LAYOUT.LEFT_X) local mouseOver = MTH_CreateCheckbox(container, "MetaHuntOptionsICUMouseOver", "Enable CTRL mouseover scan", -98, MTH_ICU_LAYOUT.LEFT_X)
if mouseOver then if mouseOver then
mouseOver:SetScript("OnClick", function(self) mouseOver:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end
local store = MTH_ICU_GetStore() local store = MTH_ICU_GetStore()
store.mouseOver = self:GetChecked() == 1 and true or false store.mouseOver = this:GetChecked() == 1 and true or false
end) end)
MTH_ICU_OPT_STATE.controls.mouseOver = mouseOver MTH_ICU_OPT_STATE.controls.mouseOver = mouseOver
end end
@@ -346,11 +344,10 @@ local function MTH_ICU_BuildUI(container)
local expandUp = MTH_CreateCheckbox(container, "MetaHuntOptionsICUExpandUp", "Expand Up", -301, MTH_ICU_LAYOUT.LEFT_X + 132) local expandUp = MTH_CreateCheckbox(container, "MetaHuntOptionsICUExpandUp", "Expand Up", -301, MTH_ICU_LAYOUT.LEFT_X + 132)
if expandUp then if expandUp then
expandUp:SetScript("OnClick", function(self) expandUp:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end
local store = MTH_ICU_GetStore() local store = MTH_ICU_GetStore()
store.EXPAND_UP = self:GetChecked() == 1 and true or false store.EXPAND_UP = this:GetChecked() == 1 and true or false
if type(ICU_SetPoints) == "function" then if type(ICU_SetPoints) == "function" then
ICU_SetPoints() ICU_SetPoints()
end end
@@ -360,44 +357,40 @@ local function MTH_ICU_BuildUI(container)
local showGuild = MTH_CreateCheckbox(container, "MetaHuntOptionsICUShowGuild", "Show player guild names", -344, MTH_ICU_LAYOUT.LEFT_X) local showGuild = MTH_CreateCheckbox(container, "MetaHuntOptionsICUShowGuild", "Show player guild names", -344, MTH_ICU_LAYOUT.LEFT_X)
if showGuild then if showGuild then
showGuild:SetScript("OnClick", function(self) showGuild:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end
local store = MTH_ICU_GetStore() local store = MTH_ICU_GetStore()
store.SHOW_GUILD_NAME = self:GetChecked() == 1 and true or false store.SHOW_GUILD_NAME = this:GetChecked() == 1 and true or false
end) end)
MTH_ICU_OPT_STATE.controls.showGuildName = showGuild MTH_ICU_OPT_STATE.controls.showGuildName = showGuild
end end
local showClass = MTH_CreateCheckbox(container, "MetaHuntOptionsICUShowClass", "Show player class", -368, MTH_ICU_LAYOUT.LEFT_X) local showClass = MTH_CreateCheckbox(container, "MetaHuntOptionsICUShowClass", "Show player class", -368, MTH_ICU_LAYOUT.LEFT_X)
if showClass then if showClass then
showClass:SetScript("OnClick", function(self) showClass:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end
local store = MTH_ICU_GetStore() local store = MTH_ICU_GetStore()
store.SHOW_PLAYER_CLASS = self:GetChecked() == 1 and true or false store.SHOW_PLAYER_CLASS = this:GetChecked() == 1 and true or false
end) end)
MTH_ICU_OPT_STATE.controls.showPlayerClass = showClass MTH_ICU_OPT_STATE.controls.showPlayerClass = showClass
end end
local showRace = MTH_CreateCheckbox(container, "MetaHuntOptionsICUShowRace", "Show player race", -392, MTH_ICU_LAYOUT.LEFT_X) local showRace = MTH_CreateCheckbox(container, "MetaHuntOptionsICUShowRace", "Show player race", -392, MTH_ICU_LAYOUT.LEFT_X)
if showRace then if showRace then
showRace:SetScript("OnClick", function(self) showRace:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end
local store = MTH_ICU_GetStore() local store = MTH_ICU_GetStore()
store.SHOW_PLAYER_RACE = self:GetChecked() == 1 and true or false store.SHOW_PLAYER_RACE = this:GetChecked() == 1 and true or false
end) end)
MTH_ICU_OPT_STATE.controls.showPlayerRace = showRace MTH_ICU_OPT_STATE.controls.showPlayerRace = showRace
end end
local showTitles = MTH_CreateCheckbox(container, "MetaHuntOptionsICUShowTitles", "Show custom titles in alerts", -416, MTH_ICU_LAYOUT.LEFT_X) local showTitles = MTH_CreateCheckbox(container, "MetaHuntOptionsICUShowTitles", "Show custom titles in alerts", -416, MTH_ICU_LAYOUT.LEFT_X)
if showTitles then if showTitles then
showTitles:SetScript("OnClick", function(self) showTitles:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end
local store = MTH_ICU_GetStore() local store = MTH_ICU_GetStore()
store.SHOW_CUSTOM_TITLES = self:GetChecked() == 1 and true or false store.SHOW_CUSTOM_TITLES = this:GetChecked() == 1 and true or false
end) end)
MTH_ICU_OPT_STATE.controls.showCustomTitles = showTitles MTH_ICU_OPT_STATE.controls.showCustomTitles = showTitles
end end
@@ -410,11 +403,10 @@ local function MTH_ICU_BuildUI(container)
local reactionOnlyPvp = MTH_CreateCheckbox(container, "MetaHuntOptionsICUReactionOnlyPvp", "Reaction only when PvP-flagged", -200, MTH_ICU_LAYOUT.RIGHT_X) local reactionOnlyPvp = MTH_CreateCheckbox(container, "MetaHuntOptionsICUReactionOnlyPvp", "Reaction only when PvP-flagged", -200, MTH_ICU_LAYOUT.RIGHT_X)
if reactionOnlyPvp then if reactionOnlyPvp then
reactionOnlyPvp:SetScript("OnClick", function(self) reactionOnlyPvp:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end
local store = MTH_ICU_GetStore() local store = MTH_ICU_GetStore()
store.REACTION_ONLY_PVP_PLAYERS = self:GetChecked() == 1 and true or false store.REACTION_ONLY_PVP_PLAYERS = this:GetChecked() == 1 and true or false
end) end)
MTH_ICU_OPT_STATE.controls.reactionOnlyPvp = reactionOnlyPvp MTH_ICU_OPT_STATE.controls.reactionOnlyPvp = reactionOnlyPvp
end end
+148 -110
View File
@@ -195,15 +195,15 @@ local function MTH_EnsureAmmoOptionsWatcher()
if MTH_AmmoOptionsWatcher then if MTH_AmmoOptionsWatcher then
return return
end end
MTH_AmmoOptionsWatcher = CreateFrame("Frame", "MTHAmmoOptionsWatcherFrame") MTH_AmmoOptionsWatcher = CreateFrame("Frame", "MTH_AmmoOptionsWatcher")
if not MTH_AmmoOptionsWatcher then if not MTH_AmmoOptionsWatcher then
return return
end end
MTH_AmmoOptionsWatcher:RegisterEvent("UNIT_INVENTORY_CHANGED") MTH_AmmoOptionsWatcher:RegisterEvent("UNIT_INVENTORY_CHANGED")
MTH_AmmoOptionsWatcher:RegisterEvent("BAG_UPDATE") MTH_AmmoOptionsWatcher:RegisterEvent("BAG_UPDATE")
MTH_AmmoOptionsWatcher:SetScript("OnEvent", function(_, eventName, unit) MTH_AmmoOptionsWatcher:SetScript("OnEvent", function()
eventName = eventName or event local eventName = event
unit = unit or arg1 local unit = arg1
if eventName == "UNIT_INVENTORY_CHANGED" and unit and unit ~= "player" then if eventName == "UNIT_INVENTORY_CHANGED" and unit and unit ~= "player" then
return return
end end
@@ -247,6 +247,16 @@ local function MTH_ZB_EnsureButtonOptionDefaults(buttonName)
end end
saved["children"]["hideonclick"] = saved["children"]["hideonclick"] and true or false saved["children"]["hideonclick"] = saved["children"]["hideonclick"] and true or false
if saved["children"]["expandonhover"] == nil then
saved["children"]["expandonhover"] = false
end
saved["children"]["expandonhover"] = saved["children"]["expandonhover"] and true or false
if saved["children"]["fadetimer"] == nil then
saved["children"]["fadetimer"] = 0
end
saved["children"]["fadetimer"] = tonumber(saved["children"]["fadetimer"]) or 0
if type(saved["parent"]) ~= "table" then if type(saved["parent"]) ~= "table" then
saved["parent"] = {} saved["parent"] = {}
end end
@@ -333,16 +343,15 @@ local function MTH_SetupButtonOptions(containerName, buttonName, displayName, ma
enableButton:SetChecked(enabledValue and true or false) enableButton:SetChecked(enabledValue and true or false)
enableButton.buttonName = buttonName enableButton.buttonName = buttonName
enableButton.buttonObj = buttonObj enableButton.buttonObj = buttonObj
enableButton:SetScript("OnClick", function(self) enableButton:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end local checked = MTH_ZB_IsChecked(this)
local checked = MTH_ZB_IsChecked(self) MTH_SetButtonEnabledState(this.buttonName, this.buttonObj, checked)
MTH_SetButtonEnabledState(self.buttonName, self.buttonObj, checked)
end) end)
end end
local parentSection = MTH_ZB_EnsureSection(containerName.."ParentSection", MTH_ZB_L("ZB_SECTION_PARENT_BUTTON", "Parent Button"), -52, 116) local parentSection = MTH_ZB_EnsureSection(containerName.."ParentSection", MTH_ZB_L("ZB_SECTION_PARENT_BUTTON", "Parent Button"), -52, 116)
local childrenSection = MTH_ZB_EnsureSection(containerName.."ChildrenSection", MTH_ZB_L("ZB_SECTION_CHILDREN_BUTTONS", "Children Buttons"), -184, 235) local childrenSection = MTH_ZB_EnsureSection(containerName.."ChildrenSection", MTH_ZB_L("ZB_SECTION_CHILDREN_BUTTONS", "Children Buttons"), -184, 310)
local parentYOffset = -18 local parentYOffset = -18
local childrenYOffset = -18 local childrenYOffset = -18
@@ -392,16 +401,15 @@ local function MTH_SetupButtonOptions(containerName, buttonName, displayName, ma
expandLeft:SetChecked(saved["firstbutton"] == "LEFT") expandLeft:SetChecked(saved["firstbutton"] == "LEFT")
expandLeft.buttonName = buttonName expandLeft.buttonName = buttonName
expandLeft.buttonObj = buttonObj expandLeft.buttonObj = buttonObj
expandLeft:SetScript("OnClick", function(self) expandLeft:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end local checked = MTH_ZB_IsChecked(this)
local checked = MTH_ZB_IsChecked(self) local btnName = this.buttonName
local btnName = self.buttonName
if not btnName or not (ZHunterMod_Saved and ZHunterMod_Saved[btnName]) then return end if not btnName or not (ZHunterMod_Saved and ZHunterMod_Saved[btnName]) then return end
ZHunterMod_Saved[btnName]["firstbutton"] = checked and "LEFT" or "RIGHT" ZHunterMod_Saved[btnName]["firstbutton"] = checked and "LEFT" or "RIGHT"
ZHunterMod_Saved[btnName]["horizontal"] = checked and 1 or nil ZHunterMod_Saved[btnName]["horizontal"] = checked and 1 or nil
ZHunterMod_Saved[btnName]["vertical"] = checked and 1 or nil ZHunterMod_Saved[btnName]["vertical"] = checked and 1 or nil
MTH_RefreshButtonGeometry(btnName, self.buttonObj) MTH_RefreshButtonGeometry(btnName, this.buttonObj)
end) end)
end end
childrenYOffset = childrenYOffset - 30 childrenYOffset = childrenYOffset - 30
@@ -414,17 +422,64 @@ local function MTH_SetupButtonOptions(containerName, buttonName, displayName, ma
if hideClick.buttonObj then if hideClick.buttonObj then
hideClick.buttonObj.hideonclick = saved["children"]["hideonclick"] and true or false hideClick.buttonObj.hideonclick = saved["children"]["hideonclick"] and true or false
end end
hideClick:SetScript("OnClick", function(self) hideClick:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end local checked = MTH_ZB_IsChecked(this)
local checked = MTH_ZB_IsChecked(self) ZHunterMod_Saved[this.buttonName]["children"]["hideonclick"] = checked
ZHunterMod_Saved[self.buttonName]["children"]["hideonclick"] = checked local btnObj = this.buttonObj or getglobal(this.buttonName)
local btnObj = self.buttonObj or getglobal(self.buttonName)
if btnObj then btnObj.hideonclick = checked end if btnObj then btnObj.hideonclick = checked end
end) end)
end end
childrenYOffset = childrenYOffset - 25 childrenYOffset = childrenYOffset - 25
local expandOnHover = MTH_CreateCheckbox(childrenSection or container, containerName.."ExpandOnHover", MTH_ZB_L("ZB_LABEL_EXPAND_ON_HOVER", "Expand on Hover"), childrenYOffset)
if expandOnHover then
expandOnHover:SetChecked(saved["children"]["expandonhover"])
expandOnHover.buttonName = buttonName
expandOnHover.buttonObj = buttonObj
expandOnHover:SetScript("OnClick", function()
if not this then return end
local checked = MTH_ZB_IsChecked(this)
local btnName = this.buttonName
if not btnName or not (ZHunterMod_Saved and ZHunterMod_Saved[btnName]) then return end
if not ZHunterMod_Saved[btnName]["children"] then
ZHunterMod_Saved[btnName]["children"] = {}
end
ZHunterMod_Saved[btnName]["children"]["expandonhover"] = checked
local btnObj = this.buttonObj or getglobal(btnName)
if btnObj then btnObj.expandonhover = checked end
end)
end
childrenYOffset = childrenYOffset - 40
local fadeTimer = MTH_CreateSlider(childrenSection or container, containerName.."FadeTimer", MTH_ZB_L("ZB_LABEL_AUTO_HIDE_TIMER", "Auto-Hide Timer (seconds)"), 0, 10, 1, childrenYOffset)
if fadeTimer then
fadeTimer:SetWidth(leftWidth - 40)
fadeTimer:SetValue(saved["children"]["fadetimer"] or 0)
fadeTimer.buttonName = buttonName
fadeTimer.buttonObj = buttonObj
fadeTimer.onChange = function(val, slider)
local frame = slider or fadeTimer
local btnName = frame and frame.buttonName
if not btnName or not (ZHunterMod_Saved and ZHunterMod_Saved[btnName]) then return end
if not ZHunterMod_Saved[btnName]["children"] then
ZHunterMod_Saved[btnName]["children"] = {}
end
local secs = math.floor((val or 0) + 0.5)
ZHunterMod_Saved[btnName]["children"]["fadetimer"] = secs
local btnObj = frame.buttonObj or getglobal(btnName)
if btnObj then
btnObj.fadetimer = secs
if secs <= 0 then
ZSpellButton_StopFadeTimer(btnObj)
elseif btnObj.children and btnObj.children:IsVisible() then
ZSpellButton_StartFadeTimer(btnObj)
end
end
end
end
childrenYOffset = childrenYOffset - 50
local showTooltip = MTH_CreateCheckbox(childrenSection or container, containerName.."ShowTooltip", MTH_ZB_L("ZB_LABEL_SHOW_TOOLTIP", "Show Tooltip"), childrenYOffset) local showTooltip = MTH_CreateCheckbox(childrenSection or container, containerName.."ShowTooltip", MTH_ZB_L("ZB_LABEL_SHOW_TOOLTIP", "Show Tooltip"), childrenYOffset)
if showTooltip then if showTooltip then
showTooltip:SetChecked(saved["tooltip"]) showTooltip:SetChecked(saved["tooltip"])
@@ -433,12 +488,11 @@ local function MTH_SetupButtonOptions(containerName, buttonName, displayName, ma
if showTooltip.buttonObj then if showTooltip.buttonObj then
showTooltip.buttonObj.tooltip = saved["tooltip"] and true or false showTooltip.buttonObj.tooltip = saved["tooltip"] and true or false
end end
showTooltip:SetScript("OnClick", function(self) showTooltip:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end local checked = MTH_ZB_IsChecked(this)
local checked = MTH_ZB_IsChecked(self) ZHunterMod_Saved[this.buttonName]["tooltip"] = checked
ZHunterMod_Saved[self.buttonName]["tooltip"] = checked local btnObj = this.buttonObj or getglobal(this.buttonName)
local btnObj = self.buttonObj or getglobal(self.buttonName)
if btnObj then btnObj.tooltip = checked end if btnObj then btnObj.tooltip = checked end
end) end)
end end
@@ -451,13 +505,12 @@ local function MTH_SetupButtonOptions(containerName, buttonName, displayName, ma
showAmmoName.buttonName = buttonName showAmmoName.buttonName = buttonName
showAmmoName.buttonObj = buttonObj showAmmoName.buttonObj = buttonObj
showAmmoName.maxButtons = maxButtons showAmmoName.maxButtons = maxButtons
showAmmoName:SetScript("OnClick", function(self) showAmmoName:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end local checked = MTH_ZB_IsChecked(this)
local checked = MTH_ZB_IsChecked(self) local btnName = this.buttonName
local btnName = self.buttonName
ZHunterMod_Saved[btnName]["showammoname"] = checked ZHunterMod_Saved[btnName]["showammoname"] = checked
local btnObj = self.buttonObj or getglobal(btnName) local btnObj = this.buttonObj or getglobal(btnName)
if btnObj then if btnObj then
for i = 1, (btnObj.count or 0) do for i = 1, (btnObj.count or 0) do
local child = getglobal(btnName..i) local child = getglobal(btnName..i)
@@ -506,13 +559,12 @@ local function MTH_SetupButtonOptions(containerName, buttonName, displayName, ma
hideButton:SetChecked(saved["parent"]["hide"]) hideButton:SetChecked(saved["parent"]["hide"])
hideButton.buttonName = buttonName hideButton.buttonName = buttonName
hideButton.buttonObj = buttonObj hideButton.buttonObj = buttonObj
hideButton:SetScript("OnClick", function(self) hideButton:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end local checked = this:GetChecked() == 1
local checked = self:GetChecked() == 1 ZHunterMod_Saved[this.buttonName]["parent"]["hide"] = checked
ZHunterMod_Saved[self.buttonName]["parent"]["hide"] = checked if this.buttonObj then
if self.buttonObj then if checked then this.buttonObj:Hide() else this.buttonObj:Show() end
if checked then self.buttonObj:Hide() else self.buttonObj:Show() end
end end
end) end)
end end
@@ -523,13 +575,12 @@ local function MTH_SetupButtonOptions(containerName, buttonName, displayName, ma
useCircle:SetChecked(saved["parent"]["circle"]) useCircle:SetChecked(saved["parent"]["circle"])
useCircle.buttonName = buttonName useCircle.buttonName = buttonName
useCircle.buttonObj = buttonObj useCircle.buttonObj = buttonObj
useCircle:SetScript("OnClick", function(self) useCircle:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end local checked = this:GetChecked() == 1
local checked = self:GetChecked() == 1 ZHunterMod_Saved[this.buttonName]["parent"]["circle"] = checked
ZHunterMod_Saved[self.buttonName]["parent"]["circle"] = checked if this.buttonObj and this.buttonObj.circle then
if self.buttonObj and self.buttonObj.circle then if checked then this.buttonObj.circle:Show() else this.buttonObj.circle:Hide() end
if checked then self.buttonObj.circle:Show() else self.buttonObj.circle:Hide() end
end end
end) end)
end end
@@ -587,17 +638,16 @@ local function MTH_SetupButtonOptions(containerName, buttonName, displayName, ma
showText:SetText("") showText:SetText("")
end end
showToggle:SetChecked(ZHunterMod_Saved[buttonName]["visible"][showToggle.spellIndex] ~= false) showToggle:SetChecked(ZHunterMod_Saved[buttonName]["visible"][showToggle.spellIndex] ~= false)
showToggle:SetScript("OnClick", function(self) showToggle:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end local checked = this:GetChecked() == 1
local checked = self:GetChecked() == 1 local btnName = this.buttonName
local btnName = self.buttonName local visibleIndex = this.spellIndex
local visibleIndex = self.spellIndex
if not ZHunterMod_Saved[btnName]["visible"] then if not ZHunterMod_Saved[btnName]["visible"] then
ZHunterMod_Saved[btnName]["visible"] = {} ZHunterMod_Saved[btnName]["visible"] = {}
end end
ZHunterMod_Saved[btnName]["visible"][visibleIndex] = checked ZHunterMod_Saved[btnName]["visible"][visibleIndex] = checked
MTH_RefreshButtonLayout(btnName, self.buttonObj, self.itemList, self.maxButtons) MTH_RefreshButtonLayout(btnName, this.buttonObj, this.itemList, this.maxButtons)
end) end)
end end
@@ -612,18 +662,17 @@ local function MTH_SetupButtonOptions(containerName, buttonName, displayName, ma
downBtn.buttonObj = buttonObj downBtn.buttonObj = buttonObj
downBtn.itemList = itemList downBtn.itemList = itemList
downBtn.maxButtons = maxButtons downBtn.maxButtons = maxButtons
downBtn:SetScript("OnClick", function(self) downBtn:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end local idx = this.spellIndex
local idx = self.spellIndex local btnName = this.buttonName
local btnName = self.buttonName local contName = this.containerName
local contName = self.containerName local maxBtns = this.maxButtons
local maxBtns = self.maxButtons
if idx < maxBtns then if idx < maxBtns then
local temp = ZHunterMod_Saved[btnName]["spells"][idx+1] local temp = ZHunterMod_Saved[btnName]["spells"][idx+1]
ZHunterMod_Saved[btnName]["spells"][idx+1] = ZHunterMod_Saved[btnName]["spells"][idx] ZHunterMod_Saved[btnName]["spells"][idx+1] = ZHunterMod_Saved[btnName]["spells"][idx]
ZHunterMod_Saved[btnName]["spells"][idx] = temp ZHunterMod_Saved[btnName]["spells"][idx] = temp
MTH_RebuildSpellOrder(btnName, self.buttonObj, self.itemList, self.maxButtons) MTH_RebuildSpellOrder(btnName, this.buttonObj, this.itemList, this.maxButtons)
local tabName = gsub(contName, "MetaHuntOptions", "") local tabName = gsub(contName, "MetaHuntOptions", "")
MTH_ZB_RefreshTab(tabName) MTH_ZB_RefreshTab(tabName)
end end
@@ -640,17 +689,16 @@ local function MTH_SetupButtonOptions(containerName, buttonName, displayName, ma
upBtn.buttonObj = buttonObj upBtn.buttonObj = buttonObj
upBtn.itemList = itemList upBtn.itemList = itemList
upBtn.maxButtons = maxButtons upBtn.maxButtons = maxButtons
upBtn:SetScript("OnClick", function(self) upBtn:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end local idx = this.spellIndex
local idx = self.spellIndex local btnName = this.buttonName
local btnName = self.buttonName local contName = this.containerName
local contName = self.containerName
if idx > 1 then if idx > 1 then
local temp = ZHunterMod_Saved[btnName]["spells"][idx-1] local temp = ZHunterMod_Saved[btnName]["spells"][idx-1]
ZHunterMod_Saved[btnName]["spells"][idx-1] = ZHunterMod_Saved[btnName]["spells"][idx] ZHunterMod_Saved[btnName]["spells"][idx-1] = ZHunterMod_Saved[btnName]["spells"][idx]
ZHunterMod_Saved[btnName]["spells"][idx] = temp ZHunterMod_Saved[btnName]["spells"][idx] = temp
MTH_RebuildSpellOrder(btnName, self.buttonObj, self.itemList, self.maxButtons) MTH_RebuildSpellOrder(btnName, this.buttonObj, this.itemList, this.maxButtons)
local tabName = gsub(contName, "MetaHuntOptions", "") local tabName = gsub(contName, "MetaHuntOptions", "")
MTH_ZB_RefreshTab(tabName) MTH_ZB_RefreshTab(tabName)
end end
@@ -749,11 +797,10 @@ function MTH_SetupSmartAmmoOptions()
end end
if moduleToggle then if moduleToggle then
moduleToggle:SetChecked(moduleEnabled) moduleToggle:SetChecked(moduleEnabled)
moduleToggle:SetScript("OnClick", function(self) moduleToggle:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end
if MTH and MTH.SetModuleEnabled then if MTH and MTH.SetModuleEnabled then
MTH:SetModuleEnabled("smartammo", MTH_ZB_IsChecked(self)) MTH:SetModuleEnabled("smartammo", MTH_ZB_IsChecked(this))
end end
MTH_SetupSmartAmmoOptions() MTH_SetupSmartAmmoOptions()
end) end)
@@ -766,11 +813,10 @@ function MTH_SetupSmartAmmoOptions()
if not moduleEnabled then if not moduleEnabled then
smartToggle:Disable() smartToggle:Disable()
end end
smartToggle:SetScript("OnClick", function(self) smartToggle:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end
if type(MTHSmartAmmo_SetSmartEnabled) == "function" then if type(MTHSmartAmmo_SetSmartEnabled) == "function" then
MTHSmartAmmo_SetSmartEnabled(MTH_ZB_IsChecked(self) and 1 or nil) MTHSmartAmmo_SetSmartEnabled(MTH_ZB_IsChecked(this) and 1 or nil)
end end
end) end)
end end
@@ -785,11 +831,10 @@ function MTH_SetupSmartAmmoOptions()
if not moduleEnabled then if not moduleEnabled then
reloadToggle:Disable() reloadToggle:Disable()
end end
reloadToggle:SetScript("OnClick", function(self) reloadToggle:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end
if type(MTHSmartAmmo_SetReloadEnabled) == "function" then if type(MTHSmartAmmo_SetReloadEnabled) == "function" then
MTHSmartAmmo_SetReloadEnabled(MTH_ZB_IsChecked(self) and 1 or nil) MTHSmartAmmo_SetReloadEnabled(MTH_ZB_IsChecked(this) and 1 or nil)
end end
end) end)
end end
@@ -825,11 +870,10 @@ function MTH_SetupMessagesOptions()
local initModulesToggle = MTH_CreateCheckbox(section, "MetaHuntMessagesInitModules", "Init : modules loaded", -36) local initModulesToggle = MTH_CreateCheckbox(section, "MetaHuntMessagesInitModules", "Init : modules loaded", -36)
if initModulesToggle then if initModulesToggle then
initModulesToggle:SetChecked(msgSettings.initModulesLoaded and true or false) initModulesToggle:SetChecked(msgSettings.initModulesLoaded and true or false)
initModulesToggle:SetScript("OnClick", function(self) initModulesToggle:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end
if MTH and MTH.SetMessageEnabled then if MTH and MTH.SetMessageEnabled then
MTH:SetMessageEnabled("initModulesLoaded", MTH_ZB_IsChecked(self)) MTH:SetMessageEnabled("initModulesLoaded", MTH_ZB_IsChecked(this))
end end
end) end)
end end
@@ -837,11 +881,10 @@ function MTH_SetupMessagesOptions()
local initWelcomeToggle = MTH_CreateCheckbox(section, "MetaHuntMessagesInitWelcome", "Init : Sarcastic welcome message", -64) local initWelcomeToggle = MTH_CreateCheckbox(section, "MetaHuntMessagesInitWelcome", "Init : Sarcastic welcome message", -64)
if initWelcomeToggle then if initWelcomeToggle then
initWelcomeToggle:SetChecked(msgSettings.initSarcasticWelcome ~= false) initWelcomeToggle:SetChecked(msgSettings.initSarcasticWelcome ~= false)
initWelcomeToggle:SetScript("OnClick", function(self) initWelcomeToggle:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end
if MTH and MTH.SetMessageEnabled then if MTH and MTH.SetMessageEnabled then
MTH:SetMessageEnabled("initSarcasticWelcome", MTH_ZB_IsChecked(self)) MTH:SetMessageEnabled("initSarcasticWelcome", MTH_ZB_IsChecked(this))
end end
end) end)
end end
@@ -849,11 +892,10 @@ function MTH_SetupMessagesOptions()
local petHungryToggle = MTH_CreateCheckbox(section, "MetaHuntMessagesPetHungry", "Pet is hungry (spam)", -92) local petHungryToggle = MTH_CreateCheckbox(section, "MetaHuntMessagesPetHungry", "Pet is hungry (spam)", -92)
if petHungryToggle then if petHungryToggle then
petHungryToggle:SetChecked(msgSettings.petHungry and true or false) petHungryToggle:SetChecked(msgSettings.petHungry and true or false)
petHungryToggle:SetScript("OnClick", function(self) petHungryToggle:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end
if MTH and MTH.SetMessageEnabled then if MTH and MTH.SetMessageEnabled then
MTH:SetMessageEnabled("petHungry", MTH_ZB_IsChecked(self)) MTH:SetMessageEnabled("petHungry", MTH_ZB_IsChecked(this))
end end
end) end)
end end
@@ -861,11 +903,10 @@ function MTH_SetupMessagesOptions()
local beastTrainingScanToggle = MTH_CreateCheckbox(section, "MetaHuntMessagesBeastTrainingScan", "Beasttraining scan", -120) local beastTrainingScanToggle = MTH_CreateCheckbox(section, "MetaHuntMessagesBeastTrainingScan", "Beasttraining scan", -120)
if beastTrainingScanToggle then if beastTrainingScanToggle then
beastTrainingScanToggle:SetChecked(msgSettings.beastTrainingScan ~= false) beastTrainingScanToggle:SetChecked(msgSettings.beastTrainingScan ~= false)
beastTrainingScanToggle:SetScript("OnClick", function(self) beastTrainingScanToggle:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end
if MTH and MTH.SetMessageEnabled then if MTH and MTH.SetMessageEnabled then
MTH:SetMessageEnabled("beastTrainingScan", MTH_ZB_IsChecked(self)) MTH:SetMessageEnabled("beastTrainingScan", MTH_ZB_IsChecked(this))
end end
end) end)
end end
@@ -873,11 +914,10 @@ function MTH_SetupMessagesOptions()
local spellbookScanToggle = MTH_CreateCheckbox(section, "MetaHuntMessagesSpellbookScan", "Spellbook scan", -148) local spellbookScanToggle = MTH_CreateCheckbox(section, "MetaHuntMessagesSpellbookScan", "Spellbook scan", -148)
if spellbookScanToggle then if spellbookScanToggle then
spellbookScanToggle:SetChecked(msgSettings.spellbookScan and true or false) spellbookScanToggle:SetChecked(msgSettings.spellbookScan and true or false)
spellbookScanToggle:SetScript("OnClick", function(self) spellbookScanToggle:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end
if MTH and MTH.SetMessageEnabled then if MTH and MTH.SetMessageEnabled then
MTH:SetMessageEnabled("spellbookScan", MTH_ZB_IsChecked(self)) MTH:SetMessageEnabled("spellbookScan", MTH_ZB_IsChecked(this))
end end
end) end)
end end
@@ -885,11 +925,10 @@ function MTH_SetupMessagesOptions()
local petRanAwayToggle = MTH_CreateCheckbox(section, "MetaHuntMessagesPetRanAway", "Pet ran away", -176) local petRanAwayToggle = MTH_CreateCheckbox(section, "MetaHuntMessagesPetRanAway", "Pet ran away", -176)
if petRanAwayToggle then if petRanAwayToggle then
petRanAwayToggle:SetChecked(msgSettings.petRanAway ~= false) petRanAwayToggle:SetChecked(msgSettings.petRanAway ~= false)
petRanAwayToggle:SetScript("OnClick", function(self) petRanAwayToggle:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end
if MTH and MTH.SetMessageEnabled then if MTH and MTH.SetMessageEnabled then
MTH:SetMessageEnabled("petRanAway", MTH_ZB_IsChecked(self)) MTH:SetMessageEnabled("petRanAway", MTH_ZB_IsChecked(this))
end end
end) end)
end end
@@ -897,11 +936,10 @@ function MTH_SetupMessagesOptions()
local mapMarkersToggle = MTH_CreateCheckbox(section, "MetaHuntMessagesMapMarkers", "Map markers", -204) local mapMarkersToggle = MTH_CreateCheckbox(section, "MetaHuntMessagesMapMarkers", "Map markers", -204)
if mapMarkersToggle then if mapMarkersToggle then
mapMarkersToggle:SetChecked(msgSettings.mapMarkers ~= false) mapMarkersToggle:SetChecked(msgSettings.mapMarkers ~= false)
mapMarkersToggle:SetScript("OnClick", function(self) mapMarkersToggle:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end
if MTH and MTH.SetMessageEnabled then if MTH and MTH.SetMessageEnabled then
MTH:SetMessageEnabled("mapMarkers", MTH_ZB_IsChecked(self)) MTH:SetMessageEnabled("mapMarkers", MTH_ZB_IsChecked(this))
end end
end) end)
end end
+3 -3
View File
@@ -68,9 +68,9 @@ function MTH_CreateSlider(parent, name, label, minVal, maxVal, step, yOffset)
if lowLabel then lowLabel:Hide() end if lowLabel then lowLabel:Hide() end
if highLabel then highLabel:Hide() end if highLabel then highLabel:Hide() end
slider:SetScript("OnValueChanged", function(self, newValue) slider:SetScript("OnValueChanged", function()
local activeSlider = self or this or slider local activeSlider = this or this or slider
local current = tonumber(newValue) local current = tonumber(arg1)
if not current and activeSlider and activeSlider.GetValue then if not current and activeSlider and activeSlider.GetValue then
current = tonumber(activeSlider:GetValue()) current = tonumber(activeSlider:GetValue())
end end
+7 -8
View File
@@ -65,11 +65,10 @@ local function MTH_UIR_CreateControl(frame, key, option, context, x, y, width)
checkButton:SetPoint("TOPLEFT", frame, "TOPLEFT", x, y + 2) checkButton:SetPoint("TOPLEFT", frame, "TOPLEFT", x, y + 2)
checkButton:SetChecked(MTH_UI.ResolveValue(option.get, context) and 1 or nil) checkButton:SetChecked(MTH_UI.ResolveValue(option.get, context) and 1 or nil)
MTH_UIR_SetCheckboxLabel(checkButton, optionName or "") MTH_UIR_SetCheckboxLabel(checkButton, optionName or "")
checkButton:SetScript("OnClick", function(self) checkButton:SetScript("OnClick", function()
self = self or this if not this then return end
if not self then return end
if option.set then if option.set then
option.set(context, self:GetChecked() == 1) option.set(context, this:GetChecked() == 1)
end end
end) end)
if MTH_UI.ResolveValue(option.disabled, context) then if MTH_UI.ResolveValue(option.disabled, context) then
@@ -100,8 +99,8 @@ local function MTH_UIR_CreateControl(frame, key, option, context, x, y, width)
text:SetText(optionName or "Run") text:SetText(optionName or "Run")
text:SetTextColor(1.00, 0.82, 0.00) text:SetTextColor(1.00, 0.82, 0.00)
button:SetScript("OnEnter", function(self) self = self or this if self then self:SetBackdropBorderColor(0.6, 0.6, 0.6) end end) button:SetScript("OnEnter", function() if this then this:SetBackdropBorderColor(0.6, 0.6, 0.6) end end)
button:SetScript("OnLeave", function(self) self = self or this if self then self:SetBackdropBorderColor(0.4, 0.4, 0.4) end end) button:SetScript("OnLeave", function() if this then this:SetBackdropBorderColor(0.4, 0.4, 0.4) end end)
button:SetScript("OnClick", function() button:SetScript("OnClick", function()
if option.func then if option.func then
option.func(context) option.func(context)
@@ -139,8 +138,8 @@ local function MTH_UIR_CreateControl(frame, key, option, context, x, y, width)
text:SetText(tostring(currentValue or "Choose")) text:SetText(tostring(currentValue or "Choose"))
text:SetTextColor(0.90, 0.90, 0.90) text:SetTextColor(0.90, 0.90, 0.90)
button:SetScript("OnEnter", function(self) self = self or this if self then self:SetBackdropBorderColor(0.6, 0.6, 0.6) end end) button:SetScript("OnEnter", function() if this then this:SetBackdropBorderColor(0.6, 0.6, 0.6) end end)
button:SetScript("OnLeave", function(self) self = self or this if self then self:SetBackdropBorderColor(0.4, 0.4, 0.4) end end) button:SetScript("OnLeave", function() if this then this:SetBackdropBorderColor(0.4, 0.4, 0.4) end end)
button:SetScript("OnClick", function() button:SetScript("OnClick", function()
if option.onClick then if option.onClick then
option.onClick(context, option) option.onClick(context, option)
+8 -2
View File
@@ -6,6 +6,7 @@ VC.abbrev = "MTH"
VC.channelName = "LFT" VC.channelName = "LFT"
VC.updateUrl = "https://github.com/DuvelCorp/MetaHunt" VC.updateUrl = "https://github.com/DuvelCorp/MetaHunt"
VC.nextPublishAt = nil VC.nextPublishAt = nil
VC.lastPublishedAt = nil
VC.joinAt = nil VC.joinAt = nil
VC.notified = false VC.notified = false
VC._invalidVersionWarned = false VC._invalidVersionWarned = false
@@ -219,7 +220,11 @@ function VC:GetTrackedPeers()
end end
function VC:ResetPublishDelay() function VC:ResetPublishDelay()
self.nextPublishAt = VC_GetTimeNow() + math.random(10, 20) local now = VC_GetTimeNow()
if self.lastPublishedAt and (now - self.lastPublishedAt) < 600 then
return -- 10-minute cooldown between publishes
end
self.nextPublishAt = now + math.random(10, 20)
end end
function VC:ShouldPublish() function VC:ShouldPublish()
@@ -247,6 +252,7 @@ function VC:TryPublish()
end end
local payload = self.abbrev .. ":" .. tostring(localVersionNumber) .. ":v" local payload = self.abbrev .. ":" .. tostring(localVersionNumber) .. ":v"
SendChatMessage(payload, "CHANNEL", nil, tostring(channelId)) SendChatMessage(payload, "CHANNEL", nil, tostring(channelId))
self.lastPublishedAt = VC_GetTimeNow()
return true return true
end end
@@ -305,7 +311,7 @@ function VC:HandleRemoteMessage(message, author, channelLabel)
end end
if not VC.frame then if not VC.frame then
local frame = CreateFrame("Frame", "MTHVersionCheckFrame", UIParent) local frame = CreateFrame("Frame", "MTH_VersionCheck", UIParent)
if frame then if frame then
VC.frame = frame VC.frame = frame
frame:RegisterEvent("PLAYER_ENTERING_WORLD") frame:RegisterEvent("PLAYER_ENTERING_WORLD")
-1052
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -6,7 +6,7 @@
local MTH_AutoBuy = { local MTH_AutoBuy = {
name = "autobuy", name = "autobuy",
enabled = false, enabled = false,
version = "1.1.0", version = "1.2.0",
events = { events = {
"VARIABLES_LOADED", "VARIABLES_LOADED",
"MERCHANT_SHOW", "MERCHANT_SHOW",
@@ -33,7 +33,7 @@ local function AB_EnsureBridgeFrame(moduleRef)
return MTH_AutoBuy._bridgeFrame return MTH_AutoBuy._bridgeFrame
end end
local frame = CreateFrame("Frame", "MTH_AutoBuyBridgeFrame") local frame = CreateFrame("Frame", "MTH_AutoBuyBridge")
if not frame then if not frame then
AB_Log("failed to create bridge frame", "error") AB_Log("failed to create bridge frame", "error")
return nil return nil
@@ -42,8 +42,8 @@ local function AB_EnsureBridgeFrame(moduleRef)
frame:RegisterEvent("MERCHANT_SHOW") frame:RegisterEvent("MERCHANT_SHOW")
frame:RegisterEvent("MERCHANT_UPDATE") frame:RegisterEvent("MERCHANT_UPDATE")
frame:RegisterEvent("MERCHANT_CLOSED") frame:RegisterEvent("MERCHANT_CLOSED")
frame:SetScript("OnEvent", function(_, eventName) frame:SetScript("OnEvent", function()
eventName = eventName or event local eventName = event
local engine = AB_Engine() local engine = AB_Engine()
if not engine then if not engine then
AB_Trace("bridge event=" .. tostring(eventName) .. " engine missing") AB_Trace("bridge event=" .. tostring(eventName) .. " engine missing")
+27 -62
View File
@@ -6,7 +6,7 @@
local MTH_AutoQuest = { local MTH_AutoQuest = {
name = "autoquest", name = "autoquest",
enabled = false, enabled = false,
version = "1.1.0", version = "1.2.0",
events = { events = {
"GOSSIP_SHOW", "GOSSIP_SHOW",
"QUEST_GREETING", "QUEST_GREETING",
@@ -34,7 +34,6 @@ local QA_ITEM_BLASTED_BOAR_LUNG_NAME = "Blasted Boar Lung"
local QA_ITEM_VULTURE_GIZZARD_NAME = "Vulture Gizzard" local QA_ITEM_VULTURE_GIZZARD_NAME = "Vulture Gizzard"
local QA_ITEM_GROUND_SCORPOK_ASSAY_NAME = "Ground Scorpok Assay" local QA_ITEM_GROUND_SCORPOK_ASSAY_NAME = "Ground Scorpok Assay"
local QA_DirectEventFrame = nil
local QA_TooltipHooked = false local QA_TooltipHooked = false
local QA_TooltipPollFrame = nil local QA_TooltipPollFrame = nil
local QA_TooltipRefreshFrame = nil local QA_TooltipRefreshFrame = nil
@@ -292,7 +291,8 @@ local function QA_CountItemInBags(expectedId, expectedName)
for slot = 1, slots do for slot = 1, slots do
local link = getContainerItemLink(bag, slot) local link = getContainerItemLink(bag, slot)
if type(link) == "string" and link ~= "" then if type(link) == "string" and link ~= "" then
local itemId = tonumber(string.match(link, "item:(%d+)")) local _, _, itemIdStr = string.find(link, "item:(%d+)")
local itemId = tonumber(itemIdStr)
local itemName = nil local itemName = nil
if type(getItemInfo) == "function" then if type(getItemInfo) == "function" then
itemName = getItemInfo(link) itemName = getItemInfo(link)
@@ -456,8 +456,8 @@ local function QA_EnsureTooltipHook()
if hasHookScript and onTooltipSetUnitExists then if hasHookScript and onTooltipSetUnitExists then
pcall(function() pcall(function()
GameTooltip:HookScript("OnTooltipSetUnit", function(self) GameTooltip:HookScript("OnTooltipSetUnit", function()
QA_AppendDrazialTooltip(self, "hook:setunit") QA_AppendDrazialTooltip(this, "hook:setunit")
end) end)
end) end)
elseif hasSetScript and hasGetScript and onTooltipSetUnitExists then elseif hasSetScript and hasGetScript and onTooltipSetUnitExists then
@@ -466,11 +466,11 @@ local function QA_EnsureTooltipHook()
end) end)
if okGetPrev then if okGetPrev then
pcall(function() pcall(function()
GameTooltip:SetScript("OnTooltipSetUnit", function(self) GameTooltip:SetScript("OnTooltipSetUnit", function()
if type(previous) == "function" then if type(previous) == "function" then
previous(self) previous()
end end
QA_AppendDrazialTooltip(self, "script:setunit") QA_AppendDrazialTooltip(this, "script:setunit")
end) end)
end) end)
end end
@@ -478,8 +478,8 @@ local function QA_EnsureTooltipHook()
if hasHookScript and onShowExists then if hasHookScript and onShowExists then
pcall(function() pcall(function()
GameTooltip:HookScript("OnShow", function(self) GameTooltip:HookScript("OnShow", function()
QA_AppendDrazialTooltip(self, "hook:show") QA_AppendDrazialTooltip(this, "hook:show")
end) end)
end) end)
elseif hasSetScript and hasGetScript and onShowExists then elseif hasSetScript and hasGetScript and onShowExists then
@@ -488,11 +488,11 @@ local function QA_EnsureTooltipHook()
end) end)
if okGetPrevShow then if okGetPrevShow then
pcall(function() pcall(function()
GameTooltip:SetScript("OnShow", function(self) GameTooltip:SetScript("OnShow", function()
if type(previousShow) == "function" then if type(previousShow) == "function" then
previousShow(self) previousShow()
end end
QA_AppendDrazialTooltip(self, "script:show") QA_AppendDrazialTooltip(this, "script:show")
end) end)
end) end)
end end
@@ -505,17 +505,17 @@ local function QA_EnsureTooltipPoller()
if QA_TooltipPollFrame then if QA_TooltipPollFrame then
return return
end end
local frame = CreateFrame("Frame", "MTH_AutoQuestTooltipPollFrame") local frame = CreateFrame("Frame", "MTH_AQTooltipPoll")
if not frame then if not frame then
return return
end end
frame._mthElapsed = 0 frame._mthElapsed = 0
frame:SetScript("OnUpdate", function(self, elapsed) frame:SetScript("OnUpdate", function()
self._mthElapsed = (self._mthElapsed or 0) + (elapsed or arg1 or 0) this._mthElapsed = (this._mthElapsed or 0) + (arg1 or 0)
if self._mthElapsed < 0.20 then if this._mthElapsed < 0.20 then
return return
end end
self._mthElapsed = 0 this._mthElapsed = 0
if not (MTH_AutoQuest and MTH_AutoQuest.enabled) then if not (MTH_AutoQuest and MTH_AutoQuest.enabled) then
return return
end end
@@ -591,16 +591,16 @@ end
local function QA_RequestTooltipRefresh(delaySeconds) local function QA_RequestTooltipRefresh(delaySeconds)
delaySeconds = tonumber(delaySeconds) or 0.10 delaySeconds = tonumber(delaySeconds) or 0.10
if not QA_TooltipRefreshFrame then if not QA_TooltipRefreshFrame then
QA_TooltipRefreshFrame = CreateFrame("Frame", "MTH_AutoQuestTooltipRefreshFrame") QA_TooltipRefreshFrame = CreateFrame("Frame", "MTH_AQTooltipRefresh")
if not QA_TooltipRefreshFrame then if not QA_TooltipRefreshFrame then
return return
end end
QA_TooltipRefreshFrame:SetScript("OnUpdate", function(self, elapsed) QA_TooltipRefreshFrame:SetScript("OnUpdate", function()
local frameRef = self or this or QA_TooltipRefreshFrame local frameRef = this or QA_TooltipRefreshFrame
if not frameRef then if not frameRef then
return return
end end
frameRef._elapsed = (frameRef._elapsed or 0) + (elapsed or arg1 or 0) frameRef._elapsed = (frameRef._elapsed or 0) + (arg1 or 0)
if frameRef._elapsed < (frameRef._delay or 0.10) then if frameRef._elapsed < (frameRef._delay or 0.10) then
return return
end end
@@ -915,48 +915,14 @@ local function QA_RunProfileAutomation(eventName, profile)
end end
end end
local function QA_SetDirectEventFrameActive(active) -- NOTE: QA_DirectEventFrame removed (Phase 2 fix #22b)
if not QA_DirectEventFrame then -- The central event router already dispatches GOSSIP_SHOW, QUEST_GREETING,
return -- QUEST_DETAIL, QUEST_PROGRESS, QUEST_COMPLETE to MTH_AutoQuest:onEvent().
end -- Having a second frame register the same events caused double-dispatch.
if active then
QA_DirectEventFrame:RegisterEvent("GOSSIP_SHOW")
QA_DirectEventFrame:RegisterEvent("QUEST_GREETING")
QA_DirectEventFrame:RegisterEvent("QUEST_DETAIL")
QA_DirectEventFrame:RegisterEvent("QUEST_PROGRESS")
QA_DirectEventFrame:RegisterEvent("QUEST_COMPLETE")
else
QA_DirectEventFrame:UnregisterAllEvents()
end
end
local function QA_EnsureDirectEventFrame(moduleRef)
if QA_DirectEventFrame then
return QA_DirectEventFrame
end
local frame = CreateFrame("Frame", "MTH_AutoQuestEventFrame")
if not frame then
QA_Debug("direct frame create failed")
return nil
end
frame:SetScript("OnEvent", function(_, eventName)
eventName = eventName or event
if not (moduleRef and moduleRef.enabled) then
return
end
QA_Debug("directEvent=" .. tostring(eventName))
QA_RunProfileAutomation(eventName, QA_PROFILE_SCORPOK)
QA_RunProfileAutomation(eventName, QA_PROFILE_SISSIES)
end)
QA_DirectEventFrame = frame
return frame
end
function MTH_AutoQuest:init() function MTH_AutoQuest:init()
local store = QA_GetOptionsStore() local store = QA_GetOptionsStore()
self.initialized = true self.initialized = true
QA_EnsureDirectEventFrame(self)
QA_SetDirectEventFrameActive(self.enabled and true or false)
QA_Debug("init: module active=" .. tostring(self.enabled and true or false) QA_Debug("init: module active=" .. tostring(self.enabled and true or false)
.. ", option scorpokDrazial=" .. tostring(store and store.scorpokDrazial and true or false) .. ", option scorpokDrazial=" .. tostring(store and store.scorpokDrazial and true or false)
.. ", option arrowsForSissies=" .. tostring(store and store.arrowsForSissies and true or false) .. ", option arrowsForSissies=" .. tostring(store and store.arrowsForSissies and true or false)
@@ -965,7 +931,6 @@ end
function MTH_AutoQuest:setEnabled(enabled) function MTH_AutoQuest:setEnabled(enabled)
self.enabled = enabled and true or false self.enabled = enabled and true or false
QA_SetDirectEventFrameActive(self.enabled and true or false)
end end
function MTH_AutoQuest:onEvent(eventName) function MTH_AutoQuest:onEvent(eventName)
@@ -981,7 +946,7 @@ function MTH_AutoQuest:onEvent(eventName)
end end
function MTH_AutoQuest:cleanup() function MTH_AutoQuest:cleanup()
QA_SetDirectEventFrameActive(false) -- no-op: direct event frame removed in Phase 2
end end
MTH:RegisterModule("autoquest", MTH_AutoQuest) MTH:RegisterModule("autoquest", MTH_AutoQuest)
+29 -25
View File
@@ -485,16 +485,22 @@ local function getActionSpell(slot)
end end
if not Chronometer._scanTooltip then if not Chronometer._scanTooltip then
Chronometer._scanTooltip = CreateFrame("GameTooltip", "MTH_ChronometerScanTooltip", UIParent, "GameTooltipTemplate") local tip = CreateFrame("GameTooltip", "MTH_ChrBarProbe", UIParent)
Chronometer._scanTooltip:SetOwner(UIParent, "ANCHOR_NONE") tip:SetOwner(UIParent, "ANCHOR_NONE")
for i = 1, 4 do
local L = tip:CreateFontString("MTH_ChrBarProbeTextLeft"..i, "ARTWORK", "GameTooltipText")
local R = tip:CreateFontString("MTH_ChrBarProbeTextRight"..i, "ARTWORK", "GameTooltipText")
tip:AddFontStrings(L, R)
end
Chronometer._scanTooltip = tip
end end
local tooltip = Chronometer._scanTooltip local tooltip = Chronometer._scanTooltip
tooltip:ClearLines() tooltip:ClearLines()
tooltip:SetAction(slot) tooltip:SetAction(slot)
local left1 = getglobal("MTH_ChronometerScanTooltipTextLeft1") local left1 = getglobal("MTH_ChrBarProbeTextLeft1")
local left2 = getglobal("MTH_ChronometerScanTooltipTextLeft2") local left2 = getglobal("MTH_ChrBarProbeTextLeft2")
local spellName = left1 and left1:GetText() or nil local spellName = left1 and left1:GetText() or nil
if not spellName or spellName == "" then if not spellName or spellName == "" then
return nil, 0 return nil, 0
@@ -1191,7 +1197,7 @@ function Chronometer:ToggleAnchor()
end end
function Chronometer:CreateAnchor(text, r, g, b) function Chronometer:CreateAnchor(text, r, g, b)
local frame = CreateFrame("Button", "MTHChronometerAnchor", UIParent) local frame = CreateFrame("Button", "MTH_ChronometerAnchor", UIParent)
frame:SetWidth(220) frame:SetWidth(220)
frame:SetHeight(25) frame:SetHeight(25)
frame.owner = self frame.owner = self
@@ -1219,25 +1225,23 @@ function Chronometer:CreateAnchor(text, r, g, b)
MTH_CHRON_Trace("CreateAnchor default point=" .. MTH_CHRON_DescribePoint(frame)) MTH_CHRON_Trace("CreateAnchor default point=" .. MTH_CHRON_DescribePoint(frame))
end end
frame:SetScript("OnDragStart", function(self) frame:SetScript("OnDragStart", function()
self = self or this if not this or not this.StartMoving then
if not self or not self.StartMoving then
return return
end end
MTH_CHRON_Trace("anchor drag-start point=" .. MTH_CHRON_DescribePoint(self)) MTH_CHRON_Trace("anchor drag-start point=" .. MTH_CHRON_DescribePoint(this))
self:StartMoving() this:StartMoving()
end) end)
frame:SetScript("OnDragStop", function(self) frame:SetScript("OnDragStop", function()
self = self or this if not this then
if not self then
return return
end end
if self.StopMovingOrSizing then if this.StopMovingOrSizing then
self:StopMovingOrSizing() this:StopMovingOrSizing()
end end
local point, _, _, x, y = self:GetPoint() local point, _, _, x, y = this:GetPoint()
x = tonumber(x) x = tonumber(x)
y = tonumber(y) y = tonumber(y)
if not x or not y then if not x or not y then
@@ -1246,16 +1250,16 @@ function Chronometer:CreateAnchor(text, r, g, b)
x = math.floor(x + 0.5) x = math.floor(x + 0.5)
y = math.floor(y + 0.5) y = math.floor(y + 0.5)
self:ClearAllPoints() this:ClearAllPoints()
self:SetPoint(point or "TOPLEFT", UIParent, point or "TOPLEFT", x, y) this:SetPoint(point or "TOPLEFT", UIParent, point or "TOPLEFT", x, y)
if self.owner and self.owner.profile and type(self.owner.profile.barposition) == "table" then if this.owner and this.owner.profile and type(this.owner.profile.barposition) == "table" then
self.owner.profile.barposition.point = point or "TOPLEFT" this.owner.profile.barposition.point = point or "TOPLEFT"
self.owner.profile.barposition.relativePoint = point or "TOPLEFT" this.owner.profile.barposition.relativePoint = point or "TOPLEFT"
self.owner.profile.barposition.x = x this.owner.profile.barposition.x = x
self.owner.profile.barposition.y = y this.owner.profile.barposition.y = y
MTH_CHRON_Trace("anchor drag-stop saved profile=" .. MTH_CHRON_FormatBarPosition(self.owner.profile) MTH_CHRON_Trace("anchor drag-stop saved profile=" .. MTH_CHRON_FormatBarPosition(this.owner.profile)
.. " frame=" .. MTH_CHRON_DescribePoint(self)) .. " frame=" .. MTH_CHRON_DescribePoint(this))
end end
end) end)
@@ -8,7 +8,6 @@ Documentation: http://web.archive.org/web/20070314234510/http://wowace.com/wiki/
Description: A timer bars library. Description: A timer bars library.
Dependencies: AceLibrary, AceOO-2.0, PaintChips-2.0 Dependencies: AceLibrary, AceOO-2.0, PaintChips-2.0
]] ]]
local match = string.match
local getn,setn,tinsert = table.getn, table.setn,table.insert local getn,setn,tinsert = table.getn, table.setn,table.insert
local vmajor, vminor = "CandyBar-2.0", "$Revision: 16011 $" local vmajor, vminor = "CandyBar-2.0", "$Revision: 16011 $"
+1 -1
View File
@@ -1,7 +1,7 @@
local MTH_ChronometerModule = { local MTH_ChronometerModule = {
name = "chronometer", name = "chronometer",
enabled = true, enabled = true,
version = "1.1.0", version = "1.2.0",
events = {}, events = {},
initialized = false, initialized = false,
} }
+31 -20
View File
@@ -780,7 +780,7 @@ local function FOM_DebugLogMerchantFoods(sourceEvent)
end end
end end
function FOM_FeedButton_OnClick() function MTH_FOM_FeedButton_OnClick()
if (arg1 == "RightButton") then if (arg1 == "RightButton") then
if (MTH_OpenOptions) then if (MTH_OpenOptions) then
MTH_OpenOptions("FeedOMatic"); MTH_OpenOptions("FeedOMatic");
@@ -790,7 +790,7 @@ function FOM_FeedButton_OnClick()
end end
end end
function FOM_FeedButton_OnEnter() function MTH_FOM_FeedButton_OnEnter()
if ( PetFrameHappiness.tooltip ) then if ( PetFrameHappiness.tooltip ) then
GameTooltip:SetOwner(PetFrameHappiness, "ANCHOR_RIGHT"); GameTooltip:SetOwner(PetFrameHappiness, "ANCHOR_RIGHT");
GameTooltip:SetText(PetFrameHappiness.tooltip); GameTooltip:SetText(PetFrameHappiness.tooltip);
@@ -807,7 +807,7 @@ function FOM_FeedButton_OnEnter()
end end
end end
function FOM_FeedButton_OnLeave() function MTH_FOM_FeedButton_OnLeave()
GameTooltip:Hide(); GameTooltip:Hide();
end end
@@ -985,13 +985,13 @@ function FOM_OnEvent(event, arg1)
this:RegisterEvent("PLAYER_REGEN_ENABLED"); this:RegisterEvent("PLAYER_REGEN_ENABLED");
end end
if (FOM_FeedButton == nil) then if (MTH_FOM_FeedButton == nil) then
FOM_FeedButton = CreateFrame("Button", "FOM_FeedButton", PetFrameHappiness); MTH_FOM_FeedButton = CreateFrame("Button", "MTH_FOM_FeedButton", PetFrameHappiness);
FOM_FeedButton:SetAllPoints(PetFrameHappiness); MTH_FOM_FeedButton:SetAllPoints(PetFrameHappiness);
FOM_FeedButton:RegisterForClicks("LeftButtonUp", "RightButtonUp"); MTH_FOM_FeedButton:RegisterForClicks("LeftButtonUp", "RightButtonUp");
FOM_FeedButton:SetScript("OnClick", FOM_FeedButton_OnClick); MTH_FOM_FeedButton:SetScript("OnClick", MTH_FOM_FeedButton_OnClick);
FOM_FeedButton:SetScript("OnEnter", FOM_FeedButton_OnEnter); MTH_FOM_FeedButton:SetScript("OnEnter", MTH_FOM_FeedButton_OnEnter);
FOM_FeedButton:SetScript("OnLeave", FOM_FeedButton_OnLeave); MTH_FOM_FeedButton:SetScript("OnLeave", MTH_FOM_FeedButton_OnLeave);
end end
if (FOM_Config.Level == "happy") then if (FOM_Config.Level == "happy") then
@@ -1236,16 +1236,27 @@ function FOM_DifficultyToNum(level)
end end
end end
local FOM_CachedPlayerClass = nil
local FOM_OnUpdateElapsed = 0
function FOM_OnUpdate(elapsed) function FOM_OnUpdate(elapsed)
FOM_OnUpdateElapsed = FOM_OnUpdateElapsed + (elapsed or 0)
_, realClass = UnitClass("player"); if FOM_OnUpdateElapsed < 0.05 then
if (realClass ~= "HUNTER") then return; end return
end
local dt = FOM_OnUpdateElapsed
FOM_OnUpdateElapsed = 0
if not FOM_CachedPlayerClass then
_, FOM_CachedPlayerClass = UnitClass("player")
end
if (FOM_CachedPlayerClass ~= "HUNTER") then return; end
-- If it's been more than a second since our last tradeskill update, -- If it's been more than a second since our last tradeskill update,
-- we can allow the event to process again. -- we can allow the event to process again.
FOM_TradeSkillLock.EventTimer = FOM_TradeSkillLock.EventTimer + elapsed; FOM_TradeSkillLock.EventTimer = FOM_TradeSkillLock.EventTimer + dt;
if (FOM_TradeSkillLock.Locked) then if (FOM_TradeSkillLock.Locked) then
FOM_TradeSkillLock.EventCooldown = FOM_TradeSkillLock.EventCooldown + elapsed; FOM_TradeSkillLock.EventCooldown = FOM_TradeSkillLock.EventCooldown + dt;
if (FOM_TradeSkillLock.EventCooldown > FOM_TradeSkillLock.EventCooldownTime) then if (FOM_TradeSkillLock.EventCooldown > FOM_TradeSkillLock.EventCooldownTime) then
FOM_TradeSkillLock.EventCooldown = 0; FOM_TradeSkillLock.EventCooldown = 0;
@@ -1415,8 +1426,8 @@ function FOM_CanFeed()
if ( UnitLevel("player") >= 40 ) then if ( UnitLevel("player") >= 40 ) then
for _, buffTexture in mountTextureSubStrings do for _, buffTexture in mountTextureSubStrings do
if ( string.find(buff, buffTexture) ) then if ( string.find(buff, buffTexture) ) then
FOMTooltip:SetUnitBuff("player", buffIndex+1); MTH_FOM_Tooltip:SetUnitBuff("player", buffIndex+1);
local msg = FOMTooltipTextLeft1:GetText(); local msg = MTH_FOM_TooltipTextLeft1:GetText();
if (msg ~= nil) then if (msg ~= nil) then
msg = string.lower(msg); msg = string.lower(msg);
for _, mountName in FOM_MOUNT_NAME_SUBSTRINGS do for _, mountName in FOM_MOUNT_NAME_SUBSTRINGS do
@@ -2567,9 +2578,9 @@ function FOM_IsTemporaryFood(itemLink)
end end
return false; return false;
end end
FOMTooltip:ClearLines(); MTH_FOM_Tooltip:ClearLines();
FOMTooltip:SetHyperlink(link); MTH_FOM_Tooltip:SetHyperlink(link);
if (FOMTooltipTextLeft2:GetText() == ITEM_CONJURED) then if (MTH_FOM_TooltipTextLeft2:GetText() == ITEM_CONJURED) then
if (numericItemId ~= nil) then if (numericItemId ~= nil) then
FOM_TEMP_FOOD_CACHE[numericItemId] = true; FOM_TEMP_FOOD_CACHE[numericItemId] = true;
end end
+1 -127
View File
@@ -4,7 +4,7 @@
------------------------------------------------------ ------------------------------------------------------
-- Key bindings -- Key bindings
BINDING_HEADER_FEEDOMATIC = "Fizzwidget Feed-O-Matic"; -- NOTE: BINDING_HEADER_FEEDOMATIC is defined in api/localization.lua via the MTH_L() system.
BINDING_NAME_FEEDOMATIC = "Feed Pet"; BINDING_NAME_FEEDOMATIC = "Feed Pet";
-- Diet names. These should be the all-lowercase versions of the six diets returned from GetPetFoodTypes(). (Want to get them all nice and quick for your localization? Go tame a bear... they eat anything.) -- Diet names. These should be the all-lowercase versions of the six diets returned from GetPetFoodTypes(). (Want to get them all nice and quick for your localization? Go tame a bear... they eat anything.)
@@ -111,110 +111,6 @@ FOM_OptionsButtonText = {
}; };
------------------------------------------------------ ------------------------------------------------------
if (GetLocale() == "frFR") then
-- Diet names. These should be the all-lowercase versions of the six diets returned from GetPetFoodTypes(). (Want to get them all nice and quick for your localization? Go tame a bear... they eat anything.)
-- THESE STRINGS MUST BE LOCALIZED for Feed-O-Matic to work properly in other locales.
FOM_DIET_MEAT = "viande";
FOM_DIET_FISH = "poisson";
FOM_DIET_BREAD = "pain";
FOM_DIET_CHEESE = "fromage";
FOM_DIET_FRUIT = "fruit";
FOM_DIET_FUNGUS = "champignon";
-- If the player has a buff whose icon name contains "Ability_Mount" and whose name contains one of these substrings, we assume the player is mounted. We have to use this rather oblique way to check for mounted because some other buffs use the Ability_Mount_* icons. If these aren't localized, we may not recognize when the player is mounted and still try to feed the pet.
FOM_MOUNT_NAME_SUBSTRINGS = { "kodo", "loup", "raptor", "steed", "cheval", "bélier", "tigre", "mécanotrotteur", };
-- It's not clear whether the 5th and 6th returns from GetItemInfo() are supposed to be localized... so we have localized keys for them just in case. If these aren't localized, we'll just needlessly search your ammo bags for food.
FOM_AMMO_POUCH = "Giberne";
FOM_QUIVER = "Carquois";
-- From here on down, the localized strings are just for readability... they don't affect whether Feed-O-Matic works.
-- Two special diets; one is used for tracking food that provides a bonus (or at least, that you don't want to have fed to your pet when the 'savebonus' option is on), and another that's used in the chat-line interface for listing all diets.
FOM_DIET_BONUS = "bonus";
FOM_DIET_ALL = "tous";
-- Used in tooltips to indicate food quality.
FOM_QUALITY_UNKNOWN = "%s peut le manger, mais n'a jamais essayé.";
FOM_QUALITY_UNDER = "%s n'en mange plus désormais.";
FOM_QUALITY_MIGHT = "%s en mangera peut-être.";
FOM_QUALITY_WILL = "%s en mangera.";
FOM_QUALITY_LIKE = "%s aime en manger.";
FOM_QUALITY_LOVE = "%s adore en manger.";
-- User-visible errors
FOM_ERROR_NO_PET = "Vous n'avez pas de familier.";
FOM_ERROR_PET_DEAD = "Votre familier est mort.";
FOM_ERROR_NO_FEEDABLE_PET = "Vous n'avez pas de familier capable de manger.";
FOM_ERROR_FOOD_NOT_FOUND = "%s n'a pas trouvé de %s dans votre sac.";
FOM_ERROR_NO_FOOD = "%s n'a pas trouvé de nourriture dans votre sac.";
-- Feeding status messages
FOM_FEEDING_EAT_ANOTHER = "%s n'aime pas cette nourriture et va essayer autre chose..."
FOM_FEEDING_FEED_ANOTHER = "cherche autre chose à donner à %s...";
FOM_FEEDING_EAT = "%s mange un(e) %s.";
FOM_FEEDING_FEED = "donne à %s à manger un(e) %s. ";
-- Beast family names
BAT = "Chauve-souris";
BEAR = "Ours";
BOAR = "Sanglier";
CARRION_BIRD = "Charognard";
CAT = "Félin";
CRAB = "Crabe";
CROCOLISK = "Crocilisque";
GORILLA = "Gorille";
HYENA = "Hyène";
OWL = "Chouette";
RAPTOR = "Raptor";
SCORPID = "Scorpide";
SPIDER = "Araignée";
TALLSTRIDER = "Haut-trotteur";
TURTLE = "Tortue";
WIND_SERPENT = "Serpent des vents";
WOLF = "Loup";
FOM_PET_HUNGRY = "%s a faim!";
FOM_PET_VERY_HUNGRY = "%s a très faim!";
FOM_OPTIONS_HEADER = "Feed-O-Matic Options";
FOM_OPTIONS_GENERAL = "Options générales:";
FOM_OPTIONS_FOOD_CHOICE = "Eviter la nourriture utilisée en cuisine:";
FOM_OPTIONS_FEED_NOTIFY = "Prévenir lorsque votre familier est nourrit:";
FOM_OPTIONS_WARNING = "Avertir quand votre familier a besoin d'être nourrit:";
FOM_KEEPOPEN = "Essayer de garder au moins";
FOM_KEEPOPEN_SLOTS = "emplacements de sac libres";
FOM_KEEPOPEN_INFO = "(Le familier choisira la nourriture des piles les plus petites, sans tenir compte de ses préférences.)";
FOM_OptionsButtonText = {
["Tooltip"] = "Afficher l'avis de votre familier concernant la nourriture",
["AvoidQuestFood"] = "Eviter la nourriture utile dans les quêtes",
["AvoidBonusFood"] = "Eviter la nourriture donnant un bonus",
["PreferHigherQuality"] = "Privilégier la nourriture que votre familier préfère",
["Fallback"] = "Utiliser la nourriture évitée s'il n'y en a plus d'autres",
["SaveForCook_All"] = "Toutes nourritures utilisées pour la cuisine",
["SaveForCook_Green"] = "si elle est utilisée dans les recettes |cff3fbf3f\"faciles\"|r ou supérieures",
["SaveForCook_Yellow"] = "si elle est utilisée dans les recettes |cffffff00\"moyennes\"|r ou supérieures",
["SaveForCook_Orange"] = "si elle est utilisée dans les recettes |cffff7f3f\"difficiles\"|r",
["SaveForCook_None"] = "Ne pas éviter la nourriture utilisée en cuisine",
["IconWarning"] = "Clignoter l'icône",
["TextWarning"] = "Afficher un texte",
["AudioWarning"] = "Jouer un son",
["AudioWarningBell"] = "Un son de cloche au lieu du cri du familier",
["AlertEmote"] = "Via emote (visible par les autres)",
["AlertChat"] = "Dans la fenêtre de discussion (visible uniquement par vous)",
["AlertNone"] = "Ne pas prévenir",
["LevelContent"] = "quand \"content\"",
["LevelUnhappy"] = "quand \"mécontent\"",
["LevelOff"] = "Ne pas avertir",
};
end
------------------------------------------------------
if (GetLocale() == "deDE") then if (GetLocale() == "deDE") then
-- Diet names. These should be the all-lowercase versions of the six diets returned from GetPetFoodTypes(). (Want to get them all nice and quick for your localization? Go tame a bear... they eat anything.) -- Diet names. These should be the all-lowercase versions of the six diets returned from GetPetFoodTypes(). (Want to get them all nice and quick for your localization? Go tame a bear... they eat anything.)
@@ -279,26 +175,4 @@ if (GetLocale() == "deDE") then
WIND_SERPENT = "Windnatter"; WIND_SERPENT = "Windnatter";
-- WOLF = "Wolf"; -- same as enUS -- WOLF = "Wolf"; -- same as enUS
end
------------------------------------------------------
if (GetLocale() == "koKR") then
-- Diet names. These should be the all-lowercase versions of the six diets returned from GetPetFoodTypes(). (Want to get them all nice and quick for your localization? Go tame a bear... they eat anything.)
-- THESE STRINGS MUST BE LOCALIZED for Feed-O-Matic to work properly in other locales.
-- FOM_DIET_MEAT = "meat";
-- FOM_DIET_FISH = "fish";
-- FOM_DIET_BREAD = "bread";
-- FOM_DIET_CHEESE = "cheese";
-- FOM_DIET_FRUIT = "fruit";
-- FOM_DIET_FUNGUS = "fungus";
-- If the player has a buff whose icon name contains "Ability_Mount" and whose name contains one of these substrings, we assume the player is mounted. We have to use this rather oblique way to check for mounted because some other buffs use the Ability_Mount_* icons.
-- FOM_MOUNT_NAME_SUBSTRINGS = { "kodo", "wolf", "raptor", "steed", "horse", "ram", "saber", "mechanostrider" };
-- It's not clear whether the 5th and 6th returns from GetItemInfo() are supposed to be localized... so we have localized keys for them just in case.
-- FOM_AMMO_POUCH = "Ammo Pouch";
FOM_QUIVER = "화살통";
end end
+17 -17
View File
@@ -6,7 +6,7 @@
local MTH_FeedOMatic = { local MTH_FeedOMatic = {
name = "feedomatic", name = "feedomatic",
enabled = false, enabled = false,
version = "1.1.0", version = "1.2.0",
events = { events = {
"VARIABLES_LOADED", "VARIABLES_LOADED",
"MERCHANT_SHOW", "MERCHANT_SHOW",
@@ -32,7 +32,7 @@ local MTH_FeedOMatic = {
} }
local MTH_PETL_HOOK_BOUNDARY_KEY = "pet-lifecycle-hooks" local MTH_PETL_HOOK_BOUNDARY_KEY = "pet-lifecycle-hooks"
local MTH_FeedOMatic_MerchantProbeFrame = nil local MTH_FOM_MerchantProbe = nil
function MTH_FeedOMatic_OnUpdate(elapsed) function MTH_FeedOMatic_OnUpdate(elapsed)
if not elapsed then if not elapsed then
@@ -47,7 +47,7 @@ function MTH_FeedOMatic_OnUpdate(elapsed)
end end
local function MTH_FeedOMatic_GetRuntimeFrame() local function MTH_FeedOMatic_GetRuntimeFrame()
return getglobal("Frame_GFW_FeedOMatic") return getglobal("MTH_FOM_OnUpdateFrame")
end end
local function MTH_FeedOMatic_CaptureHookBoundary() local function MTH_FeedOMatic_CaptureHookBoundary()
@@ -216,16 +216,16 @@ end
local function MTH_FeedOMatic_SetMerchantProbeEnabled(enabled) local function MTH_FeedOMatic_SetMerchantProbeEnabled(enabled)
if not enabled then if not enabled then
if MTH_FeedOMatic_MerchantProbeFrame then if MTH_FOM_MerchantProbe then
MTH_FeedOMatic_MerchantProbeFrame:UnregisterEvent("MERCHANT_SHOW") MTH_FOM_MerchantProbe:UnregisterEvent("MERCHANT_SHOW")
MTH_FeedOMatic_MerchantProbeFrame:UnregisterEvent("MERCHANT_UPDATE") MTH_FOM_MerchantProbe:UnregisterEvent("MERCHANT_UPDATE")
end end
return return
end end
if not MTH_FeedOMatic_MerchantProbeFrame then if not MTH_FOM_MerchantProbe then
MTH_FeedOMatic_MerchantProbeFrame = CreateFrame("Frame", "MTH_FeedOMatic_MerchantProbeFrame") MTH_FOM_MerchantProbe = CreateFrame("Frame", "MTH_FOM_MerchantProbe")
MTH_FeedOMatic_MerchantProbeFrame:SetScript("OnEvent", function() MTH_FOM_MerchantProbe:SetScript("OnEvent", function()
local evt = event local evt = event
if evt == "MERCHANT_SHOW" or evt == "MERCHANT_UPDATE" then if evt == "MERCHANT_SHOW" or evt == "MERCHANT_UPDATE" then
MTH_FeedOMatic_Log("probe event received: " .. tostring(evt), "debug") MTH_FeedOMatic_Log("probe event received: " .. tostring(evt), "debug")
@@ -234,8 +234,8 @@ local function MTH_FeedOMatic_SetMerchantProbeEnabled(enabled)
end) end)
end end
MTH_FeedOMatic_MerchantProbeFrame:RegisterEvent("MERCHANT_SHOW") MTH_FOM_MerchantProbe:RegisterEvent("MERCHANT_SHOW")
MTH_FeedOMatic_MerchantProbeFrame:RegisterEvent("MERCHANT_UPDATE") MTH_FOM_MerchantProbe:RegisterEvent("MERCHANT_UPDATE")
MTH_FeedOMatic_Log("merchant probe enabled", "debug") MTH_FeedOMatic_Log("merchant probe enabled", "debug")
end end
@@ -277,8 +277,8 @@ function MTH_FeedOMatic:setEnabled(enabled)
MTH_FeedOMatic_SyncSavedVariables() MTH_FeedOMatic_SyncSavedVariables()
MTH_FeedOMatic_EnsureVariablesLoaded(self) MTH_FeedOMatic_EnsureVariablesLoaded(self)
MTH_FeedOMatic_SetMerchantProbeEnabled(false) MTH_FeedOMatic_SetMerchantProbeEnabled(false)
if FOM_FeedButton then if MTH_FOM_FeedButton then
FOM_FeedButton:Show() MTH_FOM_FeedButton:Show()
end end
else else
-- Disable FeedOMatic functionality -- Disable FeedOMatic functionality
@@ -287,8 +287,8 @@ function MTH_FeedOMatic:setEnabled(enabled)
FOM_State.ShouldFeed = false FOM_State.ShouldFeed = false
end end
MTH_FeedOMatic_SetMerchantProbeEnabled(false) MTH_FeedOMatic_SetMerchantProbeEnabled(false)
if FOM_FeedButton then if MTH_FOM_FeedButton then
FOM_FeedButton:Hide() MTH_FOM_FeedButton:Hide()
end end
end end
end end
@@ -316,8 +316,8 @@ function MTH_FeedOMatic:cleanup()
FOM_State.ShouldFeed = false FOM_State.ShouldFeed = false
end end
MTH_FeedOMatic_SetMerchantProbeEnabled(false) MTH_FeedOMatic_SetMerchantProbeEnabled(false)
if FOM_FeedButton then if MTH_FOM_FeedButton then
FOM_FeedButton:Hide(); MTH_FOM_FeedButton:Hide();
end end
end end
+2 -2
View File
@@ -3,7 +3,7 @@ FeedOMatic Runtime Frame Loader (MetaHunt)
Minimal runtime XML without legacy options window definitions. Minimal runtime XML without legacy options window definitions.
--> -->
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\..\..\FrameXML\UI.xsd"> <Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\..\..\FrameXML\UI.xsd">
<Frame name="Frame_GFW_FeedOMatic"> <Frame name="MTH_FOM_OnUpdateFrame">
<Scripts> <Scripts>
<OnUpdate> <OnUpdate>
if (MTH_FOM_OnUpdate) then if (MTH_FOM_OnUpdate) then
@@ -15,7 +15,7 @@ Minimal runtime XML without legacy options window definitions.
</Scripts> </Scripts>
</Frame> </Frame>
<GameTooltip name="FOMTooltip" frameStrata="TOOLTIP" hidden="true" parent="UIParent" inherits="GameTooltipTemplate"> <GameTooltip name="MTH_FOM_Tooltip" frameStrata="TOOLTIP" hidden="true" parent="UIParent" inherits="GameTooltipTemplate">
<Scripts> <Scripts>
<OnLoad> <OnLoad>
this:SetOwner(UIParent, "ANCHOR_NONE"); this:SetOwner(UIParent, "ANCHOR_NONE");
+1127 -1127
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -6,7 +6,7 @@
local MTH_ICU = { local MTH_ICU = {
name = "icu", name = "icu",
enabled = false, enabled = false,
version = "1.1.0", version = "1.2.0",
events = { events = {
"VARIABLES_LOADED", "VARIABLES_LOADED",
}, },
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -7,10 +7,10 @@ MTH_SA_MANAGED_HOOKS = true
local MTH_SmartAmmo = { local MTH_SmartAmmo = {
name = "smartammo", name = "smartammo",
enabled = true, enabled = true,
version = "1.1.0", version = "1.2.0",
events = { events = {
"VARIABLES_LOADED", "VARIABLES_LOADED",
"PLAYER_ENTERING_WORLD", -- PLAYER_ENTERING_WORLD handled by engine's own frame
}, },
} }
+13 -16
View File
@@ -6,7 +6,7 @@
local MTH_Tooltips = { local MTH_Tooltips = {
name = "tooltips", name = "tooltips",
enabled = true, enabled = true,
version = "1.1.0", version = "1.2.0",
events = { events = {
"UPDATE_MOUSEOVER_UNIT", "UPDATE_MOUSEOVER_UNIT",
"UNIT_NAME_UPDATE", "UNIT_NAME_UPDATE",
@@ -1545,19 +1545,18 @@ local function MTH_TT_EnsureInjectFrame()
if MTH_Tooltips.injectFrame then if MTH_Tooltips.injectFrame then
return MTH_Tooltips.injectFrame return MTH_Tooltips.injectFrame
end end
local frame = CreateFrame("Frame", "MTH_TooltipsInjectFrame") local frame = CreateFrame("Frame", "MTH_TooltipsInject")
frame.pending = false frame.pending = false
frame.onUpdate = function(self) frame.onUpdate = function()
self = self or this if not this then
if not self then
return return
end end
if not self.pending then if not this.pending then
self:SetScript("OnUpdate", nil) this:SetScript("OnUpdate", nil)
return return
end end
self.pending = false this.pending = false
self:SetScript("OnUpdate", nil) this:SetScript("OnUpdate", nil)
if MTH_Tooltips and MTH_Tooltips.enabled then if MTH_Tooltips and MTH_Tooltips.enabled then
MTH_TT_AddTooltip("mouseover") MTH_TT_AddTooltip("mouseover")
end end
@@ -1581,14 +1580,13 @@ local function MTH_TT_EnsurePollFrame()
return MTH_Tooltips.pollFrame return MTH_Tooltips.pollFrame
end end
local frame = CreateFrame("Frame", "MTH_TooltipsPollFrame") local frame = CreateFrame("Frame", "MTH_TooltipsPoll")
frame:SetScript("OnUpdate", function(_, elapsed) frame:SetScript("OnUpdate", function()
if not (MTH_Tooltips and MTH_Tooltips.enabled) then if not (MTH_Tooltips and MTH_Tooltips.enabled) then
return return
end end
elapsed = elapsed or arg1 MTH_Tooltips.hintElapsed = (MTH_Tooltips.hintElapsed or 0) + (arg1 or 0)
MTH_Tooltips.hintElapsed = (MTH_Tooltips.hintElapsed or 0) + (elapsed or 0)
if MTH_Tooltips.hintElapsed >= 0.25 then if MTH_Tooltips.hintElapsed >= 0.25 then
MTH_Tooltips.hintElapsed = 0 MTH_Tooltips.hintElapsed = 0
if GameTooltip and GameTooltip.IsShown and GameTooltip:IsShown() then if GameTooltip and GameTooltip.IsShown and GameTooltip:IsShown() then
@@ -1648,13 +1646,12 @@ local function MTH_TT_SetRuntimeActive(active)
local pollFrame = MTH_Tooltips.pollFrame local pollFrame = MTH_Tooltips.pollFrame
if pollFrame then if pollFrame then
if active then if active then
pollFrame:SetScript("OnUpdate", pollFrame:GetScript("OnUpdate") or function(_, elapsed) pollFrame:SetScript("OnUpdate", pollFrame:GetScript("OnUpdate") or function()
if not (MTH_Tooltips and MTH_Tooltips.enabled) then if not (MTH_Tooltips and MTH_Tooltips.enabled) then
return return
end end
elapsed = elapsed or arg1 MTH_Tooltips.hintElapsed = (MTH_Tooltips.hintElapsed or 0) + (arg1 or 0)
MTH_Tooltips.hintElapsed = (MTH_Tooltips.hintElapsed or 0) + (elapsed or 0)
if MTH_Tooltips.hintElapsed >= 0.25 then if MTH_Tooltips.hintElapsed >= 0.25 then
MTH_Tooltips.hintElapsed = 0 MTH_Tooltips.hintElapsed = 0
if GameTooltip and GameTooltip.IsShown and GameTooltip:IsShown() then if GameTooltip and GameTooltip.IsShown and GameTooltip:IsShown() then
+217 -217
View File
@@ -1,217 +1,217 @@
if not ZHunterMod_Saved then if not ZHunterMod_Saved then
ZHunterMod_Saved = {} ZHunterMod_Saved = {}
end end
BINDING_HEADER_ZAspectHeader = "ZAspect Buttons" BINDING_HEADER_ZAspectHeader = "ZAspect Buttons"
BINDING_HEADER_ZTrackHeader = "ZTrack Buttons" BINDING_HEADER_ZTrackHeader = "ZTrack Buttons"
BINDING_HEADER_ZTrapHeader = "ZTrap Buttons" BINDING_HEADER_ZTrapHeader = "ZTrap Buttons"
BINDING_HEADER_ZPetHeader = "ZPet Buttons" BINDING_HEADER_ZPetHeader = "ZPet Buttons"
BINDING_HEADER_ZAmmoHeader = "ZAmmo Buttons" BINDING_HEADER_ZAmmoHeader = "ZAmmo Buttons"
BINDING_HEADER_ZMountsHeader = "ZMounts Buttons" BINDING_HEADER_ZMountsHeader = "ZMounts Buttons"
BINDING_HEADER_ZCompanionsHeader = "ZCompanions Buttons" BINDING_HEADER_ZCompanionsHeader = "ZCompanions Buttons"
BINDING_HEADER_ZToysHeader = "ZToys Buttons" BINDING_HEADER_ZToysHeader = "ZToys Buttons"
ZHunterModTooltip = CreateFrame("GameTooltip", "ZHunterModScan", nil, "GameTooltipTemplate") ZHunterModTooltip = CreateFrame("GameTooltip", "MTH_ZH_AbilityProbe", nil, "GameTooltipTemplate")
ZHunterModTooltipTextLeft1 = getglobal("ZHunterModScanTextLeft1") ZHunterModTooltipTextLeft1 = getglobal("MTH_ZH_AbilityProbeTextLeft1")
MTH_ZH_TRACE_ENABLED = false MTH_ZH_TRACE_ENABLED = false
local function MTH_ZH_DescribePoint(frame) local function MTH_ZH_DescribePoint(frame)
if not (frame and frame.GetPoint) then if not (frame and frame.GetPoint) then
return "<no-frame>" return "<no-frame>"
end end
local point, relTo, relPoint, x, y = frame:GetPoint() local point, relTo, relPoint, x, y = frame:GetPoint()
local relName = "nil" local relName = "nil"
if type(relTo) == "table" and relTo.GetName then if type(relTo) == "table" and relTo.GetName then
relName = tostring(relTo:GetName() or "<anon>") relName = tostring(relTo:GetName() or "<anon>")
elseif relTo then elseif relTo then
relName = tostring(relTo) relName = tostring(relTo)
end end
return tostring(point or "nil") return tostring(point or "nil")
.. "->" .. relName .. "->" .. relName
.. ":" .. tostring(relPoint or "nil") .. ":" .. tostring(relPoint or "nil")
.. " @(" .. tostring(x) .. "," .. tostring(y) .. ")" .. " @(" .. tostring(x) .. "," .. tostring(y) .. ")"
end end
function MTH_ZH_Trace(msg) function MTH_ZH_Trace(msg)
if not MTH_ZH_TRACE_ENABLED then if not MTH_ZH_TRACE_ENABLED then
return return
end end
if MTH and MTH.Print then if MTH and MTH.Print then
MTH:Print("[ZHTRACE] " .. tostring(msg), "debug") MTH:Print("[ZHTRACE] " .. tostring(msg), "debug")
elseif DEFAULT_CHAT_FRAME and DEFAULT_CHAT_FRAME.AddMessage then elseif DEFAULT_CHAT_FRAME and DEFAULT_CHAT_FRAME.AddMessage then
DEFAULT_CHAT_FRAME:AddMessage("[ZHTRACE] " .. tostring(msg)) DEFAULT_CHAT_FRAME:AddMessage("[ZHTRACE] " .. tostring(msg))
end end
end end
function MTH_ZH_TraceButtonPoint(frame, reason) function MTH_ZH_TraceButtonPoint(frame, reason)
if not MTH_ZH_TRACE_ENABLED then if not MTH_ZH_TRACE_ENABLED then
return return
end end
if not frame then if not frame then
MTH_ZH_Trace("point " .. tostring(reason or "") .. " frame=nil") MTH_ZH_Trace("point " .. tostring(reason or "") .. " frame=nil")
return return
end end
local name = frame.GetName and frame:GetName() or "<unnamed>" local name = frame.GetName and frame:GetName() or "<unnamed>"
MTH_ZH_Trace("point " .. tostring(reason or "") .. " " .. tostring(name) .. " " .. MTH_ZH_DescribePoint(frame)) MTH_ZH_Trace("point " .. tostring(reason or "") .. " " .. tostring(name) .. " " .. MTH_ZH_DescribePoint(frame))
end end
function MTH_ZH_TraceAllButtonPoints(reason) function MTH_ZH_TraceAllButtonPoints(reason)
if not MTH_ZH_TRACE_ENABLED then if not MTH_ZH_TRACE_ENABLED then
return return
end end
local names = { local names = {
"zButtonAspect", "zButtonAspect",
"zButtonAmmo", "zButtonAmmo",
"zButtonTrack", "zButtonTrack",
"zButtonTrap", "zButtonTrap",
"zButtonRanged", "zButtonRanged",
"zButtonPet", "zButtonPet",
"zButtonMounts", "zButtonMounts",
"zButtonCompanions", "zButtonCompanions",
"zButtonToys", "zButtonToys",
} }
MTH_ZH_Trace("snapshot begin reason=" .. tostring(reason or "")) MTH_ZH_Trace("snapshot begin reason=" .. tostring(reason or ""))
for i = 1, table.getn(names) do for i = 1, table.getn(names) do
local frame = getglobal(names[i]) local frame = getglobal(names[i])
MTH_ZH_TraceButtonPoint(frame, tostring(reason or "") .. ":" .. tostring(names[i])) MTH_ZH_TraceButtonPoint(frame, tostring(reason or "") .. ":" .. tostring(names[i]))
end end
MTH_ZH_Trace("snapshot end reason=" .. tostring(reason or "")) MTH_ZH_Trace("snapshot end reason=" .. tostring(reason or ""))
end end
function MTH_ZH_IsModuleEnabled() function MTH_ZH_IsModuleEnabled()
if not (MTH and MTH.IsModuleEnabled) then if not (MTH and MTH.IsModuleEnabled) then
return true return true
end end
return MTH:IsModuleEnabled("zhunter", true) return MTH:IsModuleEnabled("zhunter", true)
end end
function MTH_ZH_GetSavedRoot() function MTH_ZH_GetSavedRoot()
if type(ZHunterMod_Saved) ~= "table" then if type(ZHunterMod_Saved) ~= "table" then
ZHunterMod_Saved = {} ZHunterMod_Saved = {}
end end
return ZHunterMod_Saved return ZHunterMod_Saved
end end
function MTH_ZH_GetSavedTable(key) function MTH_ZH_GetSavedTable(key)
local root = MTH_ZH_GetSavedRoot() local root = MTH_ZH_GetSavedRoot()
if type(key) ~= "string" or key == "" then if type(key) ~= "string" or key == "" then
return root return root
end end
if type(root[key]) ~= "table" then if type(root[key]) ~= "table" then
root[key] = {} root[key] = {}
end end
return root[key] return root[key]
end end
local function MTH_ZH_MigrateButtonSavedKeys_Replace() local function MTH_ZH_MigrateButtonSavedKeys_Replace()
local root = MTH_ZH_GetSavedRoot() local root = MTH_ZH_GetSavedRoot()
if type(root) ~= "table" then if type(root) ~= "table" then
return return
end end
local mapping = { local mapping = {
{"ZHunterButtonAspect", "zButtonAspect"}, {"ZHunterButtonAspect", "zButtonAspect"},
{"ZHunterButtonTrack", "zButtonTrack"}, {"ZHunterButtonTrack", "zButtonTrack"},
{"ZHunterButtonTrap", "zButtonTrap"}, {"ZHunterButtonTrap", "zButtonTrap"},
{"ZHunterButtonAmmo", "zButtonAmmo"}, {"ZHunterButtonAmmo", "zButtonAmmo"},
{"ZHunterButtonPet", "zButtonPet"}, {"ZHunterButtonPet", "zButtonPet"},
{"ZHunterButtonMounts", "zButtonMounts"}, {"ZHunterButtonMounts", "zButtonMounts"},
{"ZHunterButtonCompanions", "zButtonCompanions"}, {"ZHunterButtonCompanions", "zButtonCompanions"},
{"ZHunterButtonToys", "zButtonToys"}, {"ZHunterButtonToys", "zButtonToys"},
} }
for i = 1, table.getn(mapping) do for i = 1, table.getn(mapping) do
local oldKey = mapping[i][1] local oldKey = mapping[i][1]
local newKey = mapping[i][2] local newKey = mapping[i][2]
if root[oldKey] ~= nil then if root[oldKey] ~= nil then
root[newKey] = root[oldKey] root[newKey] = root[oldKey]
root[oldKey] = nil root[oldKey] = nil
end end
end end
end end
MTH_ZH_MigrateButtonSavedKeys_Replace() MTH_ZH_MigrateButtonSavedKeys_Replace()
function MTH_ZH_Print(message, severity) function MTH_ZH_Print(message, severity)
if type(MTH_Log) == "function" then if type(MTH_Log) == "function" then
MTH_Log(message, severity) MTH_Log(message, severity)
return return
end end
if MTH and MTH.Print then if MTH and MTH.Print then
MTH:Print(message, severity) MTH:Print(message, severity)
return return
end end
if DEFAULT_CHAT_FRAME and DEFAULT_CHAT_FRAME.AddMessage then if DEFAULT_CHAT_FRAME and DEFAULT_CHAT_FRAME.AddMessage then
DEFAULT_CHAT_FRAME:AddMessage("[MetaHunt] " .. tostring(message or ""), 1, 0.9, 0.3) DEFAULT_CHAT_FRAME:AddMessage("[MetaHunt] " .. tostring(message or ""), 1, 0.9, 0.3)
end end
end end
function MTH_ZH_HandleDisabledSlash(message, tableKey, fieldKey) function MTH_ZH_HandleDisabledSlash(message, tableKey, fieldKey)
if MTH_ZH_IsModuleEnabled() then if MTH_ZH_IsModuleEnabled() then
return false return false
end end
if type(tableKey) == "string" and tableKey ~= "" then if type(tableKey) == "string" and tableKey ~= "" then
if fieldKey then if fieldKey then
local tbl = MTH_ZH_GetSavedTable(tableKey) local tbl = MTH_ZH_GetSavedTable(tableKey)
tbl[fieldKey] = nil tbl[fieldKey] = nil
else else
local root = MTH_ZH_GetSavedRoot() local root = MTH_ZH_GetSavedRoot()
root[tableKey] = nil root[tableKey] = nil
end end
end end
if message then if message then
MTH_ZH_Print(message) MTH_ZH_Print(message)
end end
return true return true
end end
function ZHunterMod_AlignButtons() function ZHunterMod_AlignButtons()
MTH_ZH_TraceAllButtonPoints("AlignButtons:before") MTH_ZH_TraceAllButtonPoints("AlignButtons:before")
zButtonAmmo:ClearAllPoints() zButtonAmmo:ClearAllPoints()
zButtonAmmo:SetPoint("TOP", zButtonAspect, "BOTTOM", 0, -15) zButtonAmmo:SetPoint("TOP", zButtonAspect, "BOTTOM", 0, -15)
zButtonTrack:ClearAllPoints() zButtonTrack:ClearAllPoints()
zButtonTrack:SetPoint("TOP", zButtonAmmo, "BOTTOM", 0, -15) zButtonTrack:SetPoint("TOP", zButtonAmmo, "BOTTOM", 0, -15)
zButtonTrap:ClearAllPoints() zButtonTrap:ClearAllPoints()
zButtonTrap:SetPoint("TOP", zButtonTrack, "BOTTOM", 0, -15) zButtonTrap:SetPoint("TOP", zButtonTrack, "BOTTOM", 0, -15)
zButtonPet:ClearAllPoints() zButtonPet:ClearAllPoints()
zButtonPet:SetPoint("TOP", zButtonTrap, "BOTTOM", 0, -15) zButtonPet:SetPoint("TOP", zButtonTrap, "BOTTOM", 0, -15)
zButtonMounts:ClearAllPoints() zButtonMounts:ClearAllPoints()
zButtonMounts:SetPoint("TOP", zButtonPet, "BOTTOM", 0, -15) zButtonMounts:SetPoint("TOP", zButtonPet, "BOTTOM", 0, -15)
zButtonCompanions:ClearAllPoints() zButtonCompanions:ClearAllPoints()
zButtonCompanions:SetPoint("TOP", zButtonMounts, "BOTTOM", 0, -15) zButtonCompanions:SetPoint("TOP", zButtonMounts, "BOTTOM", 0, -15)
zButtonToys:ClearAllPoints() zButtonToys:ClearAllPoints()
zButtonToys:SetPoint("TOP", zButtonCompanions, "BOTTOM", 0, -15) zButtonToys:SetPoint("TOP", zButtonCompanions, "BOTTOM", 0, -15)
if AutoStripDisplay then if AutoStripDisplay then
AutoStripDisplay:ClearAllPoints() AutoStripDisplay:ClearAllPoints()
AutoStripDisplay:SetPoint("TOP", zButtonToys, "BOTTOM", 0, -10) AutoStripDisplay:SetPoint("TOP", zButtonToys, "BOTTOM", 0, -10)
end end
MTH_ZH_TraceAllButtonPoints("AlignButtons:after") MTH_ZH_TraceAllButtonPoints("AlignButtons:after")
end end
function ZMarkTarget() function ZMarkTarget()
if not MTH_ZH_IsModuleEnabled() then if not MTH_ZH_IsModuleEnabled() then
return return
end end
if not UnitExists("target") then return end if not UnitExists("target") then return end
for i=1, 40 do for i=1, 40 do
if not UnitDebuff("target", i) then break end if not UnitDebuff("target", i) then break end
ZHunterModTooltip:SetOwner(UIParent, "ANCHOR_NONE") ZHunterModTooltip:SetOwner(UIParent, "ANCHOR_NONE")
ZHunterModTooltip:SetUnitDebuff("target", i) ZHunterModTooltip:SetUnitDebuff("target", i)
local spell = ZHunterModTooltipTextLeft1:GetText() local spell = ZHunterModTooltipTextLeft1:GetText()
if spell == ZHUNTER_HUNTERSMARK then if spell == ZHUNTER_HUNTERSMARK then
return return
end end
end end
CastSpellByName(ZHUNTER_HUNTERSMARK) CastSpellByName(ZHUNTER_HUNTERSMARK)
return 1 return 1
end end
SLASH_ZHunterMod1 = "/zhunter" SLASH_ZHunterMod1 = "/zhunter"
SlashCmdList["ZHunterMod"] = function(msg) SlashCmdList["ZHunterMod"] = function(msg)
MTH_ZH_Print("Possible Slash Commands: \"/zammo\", \"/zaspect\", \"/ztrack\", \"/ztrap\", \"/zpet\", \"/zmounts\", \"/zcompanions\", \"/zminipets\", \"/ztoys\", \"/zstrip\", \"/zantidaze\"") MTH_ZH_Print("Possible Slash Commands: \"/zammo\", \"/zaspect\", \"/ztrack\", \"/ztrap\", \"/zpet\", \"/zmounts\", \"/zcompanions\", \"/zminipets\", \"/ztoys\", \"/zstrip\", \"/zantidaze\"")
end end
File diff suppressed because it is too large Load Diff
+36 -20
View File
@@ -8,10 +8,10 @@ MTH_ZH_MANAGED_HOOKS = true
local MTH_ZHunter = { local MTH_ZHunter = {
name = "zhunter", name = "zhunter",
enabled = true, enabled = true,
version = "1.1.0", version = "1.2.0",
events = { events = {
"VARIABLES_LOADED", "VARIABLES_LOADED",
"PLAYER_ENTERING_WORLD", -- PLAYER_ENTERING_WORLD handled by bootstrap frame + adjustment frames
"MTH_PET_LIVE_STATE_CHANGED", "MTH_PET_LIVE_STATE_CHANGED",
}, },
features = { features = {
@@ -37,7 +37,7 @@ local function MTH_ZH_TraceLocal(msg)
end end
end end
local MTH_ZH_PostLoginRestoreFrame = nil local MTH_ZH_PostLoginRestore = nil
local MTH_ZH_BootstrapFrame = nil local MTH_ZH_BootstrapFrame = nil
local MTH_ZH_SyncSavedVariables local MTH_ZH_SyncSavedVariables
local MTH_ZH_SetButtonsVisible local MTH_ZH_SetButtonsVisible
@@ -116,15 +116,15 @@ function MTH_ZH_OnDeferredInitComplete()
end end
MTH_ZH_QueuePostLoginRestore = function(tag) MTH_ZH_QueuePostLoginRestore = function(tag)
if not MTH_ZH_PostLoginRestoreFrame then if not MTH_ZH_PostLoginRestore then
MTH_ZH_PostLoginRestoreFrame = CreateFrame("Frame", "MTH_ZH_PostLoginRestoreFrame") MTH_ZH_PostLoginRestore = CreateFrame("Frame", "MTH_ZH_PostLoginRestore")
if not MTH_ZH_PostLoginRestoreFrame then if not MTH_ZH_PostLoginRestore then
return return
end end
end end
MTH_ZH_PostLoginRestoreFrame._mthElapsed = 0 MTH_ZH_PostLoginRestore._mthElapsed = 0
MTH_ZH_PostLoginRestoreFrame:SetScript("OnUpdate", function() MTH_ZH_PostLoginRestore:SetScript("OnUpdate", function()
this._mthElapsed = (this._mthElapsed or 0) + (arg1 or 0) this._mthElapsed = (this._mthElapsed or 0) + (arg1 or 0)
if this._mthElapsed < 0.2 then if this._mthElapsed < 0.2 then
return return
@@ -149,7 +149,7 @@ local function MTH_ZH_EnsureBootstrapRestoreFrame()
return MTH_ZH_BootstrapFrame return MTH_ZH_BootstrapFrame
end end
MTH_ZH_BootstrapFrame = CreateFrame("Frame", "MTH_ZH_BootstrapRestoreFrame") MTH_ZH_BootstrapFrame = CreateFrame("Frame", "MTH_ZH_BootstrapRestore")
if not MTH_ZH_BootstrapFrame then if not MTH_ZH_BootstrapFrame then
return nil return nil
end end
@@ -297,10 +297,26 @@ MTH_ZH_SetButtonsVisible = function(visible)
if type(MTH_ZH_TraceButtonPoint) == "function" then if type(MTH_ZH_TraceButtonPoint) == "function" then
MTH_ZH_TraceButtonPoint(button, "set-buttons-visible:before:" .. tostring(buttonName)) MTH_ZH_TraceButtonPoint(button, "set-buttons-visible:before:" .. tostring(buttonName))
end end
MTH_ZH_SetChildButtonsVisible(button, buttonName, visible)
if visible then if visible then
button:Show() -- Respect per-button enabled state
local getterName = buttonName .. "_GetSaved"
local getter = getglobal(getterName)
local shouldShow = true
if type(getter) == "function" then
local ok, saved = pcall(getter)
if ok and type(saved) == "table" and (saved["enabled"] == false or saved["enabled"] == 0) then
shouldShow = false
end
end
if shouldShow then
MTH_ZH_SetChildButtonsVisible(button, buttonName, true)
button:Show()
else
MTH_ZH_SetChildButtonsVisible(button, buttonName, false)
button:Hide()
end
else else
MTH_ZH_SetChildButtonsVisible(button, buttonName, false)
button:Hide() button:Hide()
end end
if type(MTH_ZH_TraceButtonPoint) == "function" then if type(MTH_ZH_TraceButtonPoint) == "function" then
@@ -316,15 +332,15 @@ end
local function MTH_ZH_SetAdjustmentHandlersActive(active) local function MTH_ZH_SetAdjustmentHandlersActive(active)
local frameSpecs = { local frameSpecs = {
{ frame = "zButtonAspectAdjustment", handler = "zButtonAspectAdjustment_OnEvent", getter = "zButtonAspect_GetSaved" }, { frame = "MTH_ZH_AspectAdjust", handler = "MTH_ZH_AspectAdjust_OnEvent", getter = "zButtonAspect_GetSaved" },
{ frame = "zButtonTrackAdjustment", handler = "zButtonTrackAdjustment_OnEvent", getter = "zButtonTrack_GetSaved" }, { frame = "MTH_ZH_TrackAdjust", handler = "MTH_ZH_TrackAdjust_OnEvent", getter = "zButtonTrack_GetSaved" },
{ frame = "zButtonTrapAdjustment", handler = "zButtonTrapAdjustment_OnEvent", getter = "zButtonTrap_GetSaved" }, { frame = "MTH_ZH_TrapAdjust", handler = "MTH_ZH_TrapAdjust_OnEvent", getter = "zButtonTrap_GetSaved" },
{ frame = "zButtonRangedAdjustment", handler = "zButtonRangedAdjustment_OnEvent", getter = "zButtonRanged_GetSaved" }, { frame = "MTH_ZH_RangedAdjust", handler = "MTH_ZH_RangedAdjust_OnEvent", getter = "zButtonRanged_GetSaved" },
{ frame = "zButtonAmmoAdjustment", handler = "zButtonAmmoAdjustment_OnEvent", getter = "zButtonAmmo_GetSaved" }, { frame = "MTH_ZH_AmmoAdjust", handler = "MTH_ZH_AmmoAdjust_OnEvent", getter = "zButtonAmmo_GetSaved" },
{ frame = "zButtonPetAdjustment", handler = "zButtonPetAdjustment_OnEvent", getter = "zButtonPet_GetSaved" }, { frame = "MTH_ZH_PetAdjust", handler = "MTH_ZH_PetAdjust_OnEvent", getter = "zButtonPet_GetSaved" },
{ frame = "zButtonMountsAdjustment", handler = "zButtonMountsAdjustment_OnEvent", getter = "zButtonMounts_GetSaved" }, { frame = "MTH_ZH_MountsAdjust", handler = "MTH_ZH_MountsAdjust_OnEvent", getter = "zButtonMounts_GetSaved" },
{ frame = "zButtonCompanionsAdjustment", handler = "zButtonCompanionsAdjustment_OnEvent", getter = "zButtonCompanions_GetSaved" }, { frame = "MTH_ZH_CompanionsAdjust", handler = "MTH_ZH_CompanionsAdjust_OnEvent", getter = "zButtonCompanions_GetSaved" },
{ frame = "zButtonToysAdjustment", handler = "zButtonToysAdjustment_OnEvent", getter = "zButtonToys_GetSaved" }, { frame = "MTH_ZH_ToysAdjust", handler = "MTH_ZH_ToysAdjust_OnEvent", getter = "zButtonToys_GetSaved" },
} }
local function isFeatureEnabled(getterName) local function isFeatureEnabled(getterName)
File diff suppressed because it is too large Load Diff
+392 -390
View File
@@ -1,391 +1,393 @@
local function zButtonAspect_GetRoot() local function zButtonAspect_GetRoot()
return MTH_ZH_GetSavedRoot() return MTH_ZH_GetSavedRoot()
end end
local root = zButtonAspect_GetRoot() local root = zButtonAspect_GetRoot()
if not root["zButtonAspect"] then if not root["zButtonAspect"] then
root["zButtonAspect"] = {} root["zButtonAspect"] = {}
root["zButtonAspect"]["spells"] = {1, 2, 3, 4, 5, 6, 7} root["zButtonAspect"]["spells"] = {1, 2, 3, 4, 5, 6, 7}
root["zButtonAspect"]["rows"] = 1 root["zButtonAspect"]["rows"] = 1
root["zButtonAspect"]["horizontal"] = nil root["zButtonAspect"]["horizontal"] = nil
root["zButtonAspect"]["vertical"] = nil root["zButtonAspect"]["vertical"] = nil
root["zButtonAspect"]["firstbutton"] = "RIGHT" root["zButtonAspect"]["firstbutton"] = "RIGHT"
root["zButtonAspect"]["enabled"] = 1 root["zButtonAspect"]["enabled"] = 1
root["zButtonAspect"]["tooltip"] = 1 root["zButtonAspect"]["tooltip"] = 1
root["zButtonAspect"]["parent"] = {} root["zButtonAspect"]["parent"] = {}
root["zButtonAspect"]["parent"]["size"] = 36 root["zButtonAspect"]["parent"]["size"] = 36
root["zButtonAspect"]["parent"]["hide"] = nil root["zButtonAspect"]["parent"]["hide"] = nil
root["zButtonAspect"]["parent"]["circle"] = 1 root["zButtonAspect"]["parent"]["circle"] = 1
root["zButtonAspect"]["children"] = {} root["zButtonAspect"]["children"] = {}
root["zButtonAspect"]["children"]["size"] = 36 root["zButtonAspect"]["children"]["size"] = 36
root["zButtonAspect"]["children"]["hideonclick"] = 1 root["zButtonAspect"]["children"]["hideonclick"] = 1
end end
ZHunterMod_Aspect_Spells = { ZHunterMod_Aspect_Spells = {
ZHUNTER_ASPECT_HAWK, ZHUNTER_ASPECT_HAWK,
ZHUNTER_ASPECT_MONKEY, ZHUNTER_ASPECT_MONKEY,
ZHUNTER_ASPECT_WOLF, ZHUNTER_ASPECT_WOLF,
ZHUNTER_ASPECT_CHEETAH, ZHUNTER_ASPECT_CHEETAH,
ZHUNTER_ASPECT_PACK, ZHUNTER_ASPECT_PACK,
ZHUNTER_ASPECT_WILD, ZHUNTER_ASPECT_WILD,
ZHUNTER_ASPECT_BEAST ZHUNTER_ASPECT_BEAST
} }
local ZHUNTER_ASPECT_MAX = table.getn(ZHunterMod_Aspect_Spells) local ZHUNTER_ASPECT_MAX = table.getn(ZHunterMod_Aspect_Spells)
local zButtonAspect_LastAuraUpdateAt = 0 local zButtonAspect_LastAuraUpdateAt = 0
local zButtonAspect_MinAuraInterval = 0.15 local zButtonAspect_MinAuraInterval = 0.15
local zButtonAspect_MinAuraIntervalCombat = 0.60 local zButtonAspect_MinAuraIntervalCombat = 0.60
local zButtonAspect_LastAuraTexture = nil local zButtonAspect_LastAuraTexture = nil
local zButtonAspect_LastParentId = nil local zButtonAspect_LastParentId = nil
local zButtonAspect_AuraProbeTextLeft1 = nil local zButtonAspect_AuraProbeTextLeft1 = nil
local function zButtonAspect_GetSaved() local function zButtonAspect_GetSaved()
local currentRoot = zButtonAspect_GetRoot() local currentRoot = zButtonAspect_GetRoot()
if not currentRoot["zButtonAspect"] then if not currentRoot["zButtonAspect"] then
currentRoot["zButtonAspect"] = {} currentRoot["zButtonAspect"] = {}
end end
return currentRoot["zButtonAspect"] return currentRoot["zButtonAspect"]
end end
local function zButtonAspect_EnsureConfig() local function zButtonAspect_EnsureConfig()
local saved = zButtonAspect_GetSaved() local saved = zButtonAspect_GetSaved()
saved["count"] = nil saved["count"] = nil
if saved["rows"] == nil then if saved["rows"] == nil then
saved["rows"] = 1 saved["rows"] = 1
end end
if saved["firstbutton"] == nil then if saved["firstbutton"] == nil then
saved["firstbutton"] = "RIGHT" saved["firstbutton"] = "RIGHT"
end end
if saved["enabled"] == nil then if saved["enabled"] == nil then
saved["enabled"] = 1 saved["enabled"] = 1
end end
if saved["tooltip"] == nil then if saved["tooltip"] == nil then
saved["tooltip"] = 1 saved["tooltip"] = 1
end end
if not saved["parent"] then if not saved["parent"] then
saved["parent"] = {} saved["parent"] = {}
end end
if saved["parent"]["size"] == nil then if saved["parent"]["size"] == nil then
saved["parent"]["size"] = 36 saved["parent"]["size"] = 36
end end
if saved["parent"]["circle"] == nil then if saved["parent"]["circle"] == nil then
saved["parent"]["circle"] = 1 saved["parent"]["circle"] = 1
end end
if not saved["children"] then if not saved["children"] then
saved["children"] = {} saved["children"] = {}
end end
if saved["children"]["size"] == nil then if saved["children"]["size"] == nil then
saved["children"]["size"] = 36 saved["children"]["size"] = 36
end end
if saved["children"]["hideonclick"] == nil then if saved["children"]["hideonclick"] == nil then
saved["children"]["hideonclick"] = 1 saved["children"]["hideonclick"] = 1
end end
if not saved["spells"] then if not saved["spells"] then
saved["spells"] = {} saved["spells"] = {}
end end
if not saved["visible"] then if not saved["visible"] then
saved["visible"] = {} saved["visible"] = {}
end end
for i = 1, ZHUNTER_ASPECT_MAX do for i = 1, ZHUNTER_ASPECT_MAX do
if not tonumber(saved["spells"][i]) then if not tonumber(saved["spells"][i]) then
saved["spells"][i] = i saved["spells"][i] = i
end end
if saved["visible"][i] == nil then if saved["visible"][i] == nil then
saved["visible"][i] = 1 saved["visible"][i] = 1
end end
end end
end end
local function zButtonAspect_ApplyRuntimeSettings() local function zButtonAspect_ApplyRuntimeSettings()
if not zButtonAspect then if not zButtonAspect then
return return
end end
local saved = zButtonAspect_GetSaved() local saved = zButtonAspect_GetSaved()
zButtonAspect.tooltip = saved["tooltip"] and true or false zButtonAspect.tooltip = saved["tooltip"] and true or false
zButtonAspect.hideonclick = saved["children"] and saved["children"]["hideonclick"] and true or false zButtonAspect.hideonclick = saved["children"] and saved["children"]["hideonclick"] and true or false
end zButtonAspect.expandonhover = saved["children"] and saved["children"]["expandonhover"] and true or false
zButtonAspect.fadetimer = saved["children"] and tonumber(saved["children"]["fadetimer"]) or 0
local function zButtonAspect_IsKnownAspectSpellId(spellId) end
if not spellId then
return false local function zButtonAspect_IsKnownAspectSpellId(spellId)
end if not spellId then
local spellName = GetSpellName(spellId, "spell") return false
if not spellName or spellName == "" then end
return false local spellName = GetSpellName(spellId, "spell")
end if not spellName or spellName == "" then
for i = 1, table.getn(ZHunterMod_Aspect_Spells) do return false
if ZHunterMod_Aspect_Spells[i] == spellName then end
return true for i = 1, table.getn(ZHunterMod_Aspect_Spells) do
end if ZHunterMod_Aspect_Spells[i] == spellName then
end return true
return false end
end end
return false
local function zButtonAspect_EnsureValidParentId() end
if not (zButtonAspect and zButtonAspect.count) then
return local function zButtonAspect_EnsureValidParentId()
end if not (zButtonAspect and zButtonAspect.count) then
return
if zButtonAspect_IsKnownAspectSpellId(zButtonAspect.id) then end
return
end if zButtonAspect_IsKnownAspectSpellId(zButtonAspect.id) then
return
for i = 1, zButtonAspect.count do end
local child = getglobal(zButtonAspect.name .. i)
if child and child.id and zButtonAspect_IsKnownAspectSpellId(child.id) then for i = 1, zButtonAspect.count do
zButtonAspect.id = child.id local child = getglobal(zButtonAspect.name .. i)
zButtonAspect.isspell = 1 if child and child.id and zButtonAspect_IsKnownAspectSpellId(child.id) then
ZSpellButton_UpdateButton(zButtonAspect) zButtonAspect.id = child.id
ZSpellButton_UpdateCooldown(zButtonAspect) zButtonAspect.isspell = 1
return ZSpellButton_UpdateButton(zButtonAspect)
end ZSpellButton_UpdateCooldown(zButtonAspect)
end return
end end
end
function zButtonAspect_OnLoad() end
this:RegisterEvent("VARIABLES_LOADED")
end function zButtonAspect_OnLoad()
this:RegisterEvent("VARIABLES_LOADED")
function zButtonAspect_OnEvent() end
if event == "VARIABLES_LOADED" then
if not zButtonAspect then function zButtonAspect_OnEvent()
return if event == "VARIABLES_LOADED" then
end if not zButtonAspect then
if UnitClass("player") ~= ZHUNTER_HUNTER then return
zButtonAspect:UnregisterAllEvents() end
zButtonAspect:Hide() if UnitClass("player") ~= ZHUNTER_HUNTER then
return zButtonAspect:UnregisterAllEvents()
end zButtonAspect:Hide()
zButtonAspect_CreateButtons() return
zButtonAspectAdjustment = CreateFrame("Frame", "zButtonAspectAdjustment") end
zButtonAspectAdjustment:RegisterEvent("PLAYER_AURAS_CHANGED") zButtonAspect_CreateButtons()
zButtonAspectAdjustment:RegisterEvent("PLAYER_ENTERING_WORLD") MTH_ZH_AspectAdjust = CreateFrame("Frame", "MTH_ZH_AspectAdjust")
zButtonAspectAdjustment:RegisterEvent("SPELLS_CHANGED") MTH_ZH_AspectAdjust:RegisterEvent("PLAYER_AURAS_CHANGED")
zButtonAspectAdjustment:RegisterEvent("CHARACTER_POINTS_CHANGED") MTH_ZH_AspectAdjust:RegisterEvent("PLAYER_ENTERING_WORLD")
zButtonAspectAdjustment:RegisterEvent("LEARNED_SPELL_IN_TAB") MTH_ZH_AspectAdjust:RegisterEvent("SPELLS_CHANGED")
zButtonAspectAdjustment:SetScript("OnEvent", zButtonAspectAdjustment_OnEvent) MTH_ZH_AspectAdjust:RegisterEvent("CHARACTER_POINTS_CHANGED")
zButtonAspect_Tooltip = CreateFrame("GameTooltip", "zButtonAspect_AuraProbeScan", nil, "GameTooltipTemplate") MTH_ZH_AspectAdjust:RegisterEvent("LEARNED_SPELL_IN_TAB")
if zButtonAspect_Tooltip and zButtonAspect_Tooltip.GetName then MTH_ZH_AspectAdjust:SetScript("OnEvent", MTH_ZH_AspectAdjust_OnEvent)
local tooltipName = zButtonAspect_Tooltip:GetName() zButtonAspect_Tooltip = CreateFrame("GameTooltip", "MTH_ZH_AspectProbe", nil, "GameTooltipTemplate")
if tooltipName then if zButtonAspect_Tooltip and zButtonAspect_Tooltip.GetName then
zButtonAspect_AuraProbeTextLeft1 = getglobal(tooltipName .. "TextLeft1") local tooltipName = zButtonAspect_Tooltip:GetName()
end if tooltipName then
end zButtonAspect_AuraProbeTextLeft1 = getglobal(tooltipName .. "TextLeft1")
zButtonAspect_SetupSizeAndPosition() end
end end
end zButtonAspect_SetupSizeAndPosition()
end
function zButtonAspect_CreateButtons() end
zButtonAspect_EnsureConfig()
local saved = zButtonAspect_GetSaved() function zButtonAspect_CreateButtons()
zButtonAspect_EnsureConfig()
ZSpellButton_CreateChildren(zButtonAspect, "zButtonAspect", ZHUNTER_ASPECT_MAX) local saved = zButtonAspect_GetSaved()
local info = {}
local infoIndex = 1 ZSpellButton_CreateChildren(zButtonAspect, "zButtonAspect", ZHUNTER_ASPECT_MAX)
for i=1, table.getn(ZHunterMod_Aspect_Spells) do local info = {}
if not tonumber(saved["spells"][i]) then local infoIndex = 1
info = ZHunterMod_Aspect_Spells for i=1, table.getn(ZHunterMod_Aspect_Spells) do
saved["spells"] = {1, 2, 3, 4, 5, 6, 7} if not tonumber(saved["spells"][i]) then
break info = ZHunterMod_Aspect_Spells
end saved["spells"] = {1, 2, 3, 4, 5, 6, 7}
local spellIndex = saved["spells"][i] break
if saved["visible"][spellIndex] ~= false then end
info[infoIndex] = ZHunterMod_Aspect_Spells[spellIndex] local spellIndex = saved["spells"][i]
infoIndex = infoIndex + 1 if saved["visible"][spellIndex] ~= false then
end info[infoIndex] = ZHunterMod_Aspect_Spells[spellIndex]
end infoIndex = infoIndex + 1
zButtonAspect.found = ZSpellButton_SetButtons(zButtonAspect, info) end
zButtonAspect_ApplyRuntimeSettings() end
zButtonAspect_EnsureValidParentId() zButtonAspect.found = ZSpellButton_SetButtons(zButtonAspect, info)
end zButtonAspect_ApplyRuntimeSettings()
zButtonAspect_EnsureValidParentId()
function zButtonAspect_SetupSizeAndPosition() end
zButtonAspect_EnsureConfig()
local saved = zButtonAspect_GetSaved() function zButtonAspect_SetupSizeAndPosition()
if saved["enabled"] == false or saved["enabled"] == 0 then zButtonAspect_EnsureConfig()
if zButtonAspectAdjustment and zButtonAspectAdjustment.SetScript then local saved = zButtonAspect_GetSaved()
zButtonAspectAdjustment:SetScript("OnEvent", nil) if saved["enabled"] == false or saved["enabled"] == 0 then
end if MTH_ZH_AspectAdjust and MTH_ZH_AspectAdjust.SetScript then
if zButtonAspect and zButtonAspect.Hide then MTH_ZH_AspectAdjust:SetScript("OnEvent", nil)
zButtonAspect:Hide() end
end if zButtonAspect and zButtonAspect.Hide then
return zButtonAspect:Hide()
end end
if zButtonAspectAdjustment and zButtonAspectAdjustment.SetScript then return
zButtonAspectAdjustment:SetScript("OnEvent", zButtonAspectAdjustment_OnEvent) end
end if MTH_ZH_AspectAdjust and MTH_ZH_AspectAdjust.SetScript then
local displayCount = zButtonAspect.found or ZHUNTER_ASPECT_MAX MTH_ZH_AspectAdjust:SetScript("OnEvent", MTH_ZH_AspectAdjust_OnEvent)
if displayCount < 0 then end
displayCount = 0 local displayCount = zButtonAspect.found or ZHUNTER_ASPECT_MAX
end if displayCount < 0 then
ZSpellButton_SetSize(zButtonAspect, saved["parent"]["size"]) displayCount = 0
ZSpellButton_SetSize(zButtonAspect, saved["children"]["size"], 1) end
ZSpellButton_SetExpandDirection(zButtonAspect, saved["firstbutton"]) ZSpellButton_SetSize(zButtonAspect, saved["parent"]["size"])
ZSpellButton_ArrangeChildren(zButtonAspect, saved["rows"], ZSpellButton_SetSize(zButtonAspect, saved["children"]["size"], 1)
displayCount, saved["horizontal"], ZSpellButton_SetExpandDirection(zButtonAspect, saved["firstbutton"])
saved["vertical"]) ZSpellButton_ArrangeChildren(zButtonAspect, saved["rows"],
end displayCount, saved["horizontal"],
saved["vertical"])
function zButtonAspect_Reset() end
local currentRoot = zButtonAspect_GetRoot()
currentRoot["zButtonAspect"] = {} function zButtonAspect_Reset()
local saved = zButtonAspect_GetSaved() local currentRoot = zButtonAspect_GetRoot()
saved["spells"] = {1, 2, 3, 4, 5, 6, 7} currentRoot["zButtonAspect"] = {}
saved["rows"] = 1 local saved = zButtonAspect_GetSaved()
saved["horizontal"] = nil saved["spells"] = {1, 2, 3, 4, 5, 6, 7}
saved["vertical"] = nil saved["rows"] = 1
saved["firstbutton"] = "RIGHT" saved["horizontal"] = nil
saved["enabled"] = 1 saved["vertical"] = nil
saved["tooltip"] = 1 saved["firstbutton"] = "RIGHT"
saved["parent"] = {} saved["enabled"] = 1
saved["parent"]["size"] = 36 saved["tooltip"] = 1
saved["parent"]["hide"] = nil saved["parent"] = {}
saved["parent"]["circle"] = 1 saved["parent"]["size"] = 36
saved["children"] = {} saved["parent"]["hide"] = nil
saved["children"]["size"] = 36 saved["parent"]["circle"] = 1
saved["children"]["hideonclick"] = 1 saved["children"] = {}
saved["visible"] = {1, 1, 1, 1, 1, 1, 1} saved["children"]["size"] = 36
zButtonAspect_EnsureConfig() saved["children"]["hideonclick"] = 1
end saved["visible"] = {1, 1, 1, 1, 1, 1, 1}
zButtonAspect_EnsureConfig()
function zButtonAspectAdjustment_OnEvent() end
if not zButtonAspect or not zButtonAspect.count then
return function MTH_ZH_AspectAdjust_OnEvent()
end if not zButtonAspect or not zButtonAspect.count then
if event == "PLAYER_AURAS_CHANGED" then return
local now = GetTime and GetTime() or 0 end
local minInterval = zButtonAspect_MinAuraInterval if event == "PLAYER_AURAS_CHANGED" then
if UnitAffectingCombat and UnitAffectingCombat("player") then local now = GetTime and GetTime() or 0
minInterval = zButtonAspect_MinAuraIntervalCombat local minInterval = zButtonAspect_MinAuraInterval
end if UnitAffectingCombat and UnitAffectingCombat("player") then
if now > 0 and zButtonAspect_LastAuraUpdateAt > 0 and (now - zButtonAspect_LastAuraUpdateAt) < minInterval then minInterval = zButtonAspect_MinAuraIntervalCombat
return end
end if now > 0 and zButtonAspect_LastAuraUpdateAt > 0 and (now - zButtonAspect_LastAuraUpdateAt) < minInterval then
zButtonAspect_LastAuraUpdateAt = now return
end end
if event == "SPELLS_CHANGED" or event == "CHARACTER_POINTS_CHANGED" or event == "LEARNED_SPELL_IN_TAB" then zButtonAspect_LastAuraUpdateAt = now
zButtonAspect_CreateButtons() end
zButtonAspect_SetupSizeAndPosition() if event == "SPELLS_CHANGED" or event == "CHARACTER_POINTS_CHANGED" or event == "LEARNED_SPELL_IN_TAB" then
zButtonAspect_EnsureValidParentId() zButtonAspect_CreateButtons()
end zButtonAspect_SetupSizeAndPosition()
if event == "PLAYER_AURAS_CHANGED" or event == "PLAYER_ENTERING_WORLD" zButtonAspect_EnsureValidParentId()
or event == "SPELLS_CHANGED" or event == "CHARACTER_POINTS_CHANGED" or event == "LEARNED_SPELL_IN_TAB" then end
zButtonAspect_EnsureValidParentId() if event == "PLAYER_AURAS_CHANGED" or event == "PLAYER_ENTERING_WORLD"
if not zButtonAspect1.id then or event == "SPELLS_CHANGED" or event == "CHARACTER_POINTS_CHANGED" or event == "LEARNED_SPELL_IN_TAB" then
return zButtonAspect_EnsureValidParentId()
end if not zButtonAspect1.id then
local button return
local isParentTooltipOwned = GameTooltip and GameTooltip.IsOwned and GameTooltip:IsOwned(zButtonAspect) end
local childrenShown = zButtonAspect.children and zButtonAspect.children.IsShown and zButtonAspect.children:IsShown() local button
local needChildIconScan = (event ~= "PLAYER_AURAS_CHANGED") or childrenShown or isParentTooltipOwned local isParentTooltipOwned = GameTooltip and GameTooltip.IsOwned and GameTooltip:IsOwned(zButtonAspect)
local buttontextures = nil local childrenShown = zButtonAspect.children and zButtonAspect.children.IsShown and zButtonAspect.children:IsShown()
local hasDuplicateChildTexture = nil local needChildIconScan = (event ~= "PLAYER_AURAS_CHANGED") or childrenShown or isParentTooltipOwned
if needChildIconScan then local buttontextures = nil
buttontextures = {} local hasDuplicateChildTexture = nil
local textureSeen = {} if needChildIconScan then
for i=1, zButtonAspect.count do buttontextures = {}
button = getglobal(zButtonAspect.name..i) local textureSeen = {}
button.icon = nil for i=1, zButtonAspect.count do
if button.id then button = getglobal(zButtonAspect.name..i)
local btnTexture = GetSpellTexture(button.id, "spell") button.icon = nil
if btnTexture then if button.id then
if textureSeen[btnTexture] then local btnTexture = GetSpellTexture(button.id, "spell")
hasDuplicateChildTexture = true if btnTexture then
elseif hasDuplicateChildTexture == nil then if textureSeen[btnTexture] then
hasDuplicateChildTexture = false hasDuplicateChildTexture = true
end elseif hasDuplicateChildTexture == nil then
textureSeen[btnTexture] = 1 hasDuplicateChildTexture = false
buttontextures[btnTexture] = button end
end textureSeen[btnTexture] = 1
end buttontextures[btnTexture] = button
end end
end end
local i = 1 end
local texture = GetSpellTexture(zButtonAspect1.id, "spell") end
local buff = UnitBuff("player", i) local i = 1
local spellname, buffname local texture = GetSpellTexture(zButtonAspect1.id, "spell")
local newParentId = zButtonAspect1.id local buff = UnitBuff("player", i)
while buff do local spellname, buffname
if texture == buff and zButtonAspect2.id then local newParentId = zButtonAspect1.id
newParentId = zButtonAspect2.id while buff do
end if texture == buff and zButtonAspect2.id then
if needChildIconScan and buttontextures[buff] then newParentId = zButtonAspect2.id
if hasDuplicateChildTexture then end
zButtonAspect_Tooltip:SetOwner(this, "ANCHOR_NONE") if needChildIconScan and buttontextures[buff] then
zButtonAspect_Tooltip:SetUnitBuff("player", i) if hasDuplicateChildTexture then
if zButtonAspect_AuraProbeTextLeft1 and zButtonAspect_AuraProbeTextLeft1.GetText then zButtonAspect_Tooltip:SetOwner(this, "ANCHOR_NONE")
buffname = zButtonAspect_AuraProbeTextLeft1:GetText() zButtonAspect_Tooltip:SetUnitBuff("player", i)
else if zButtonAspect_AuraProbeTextLeft1 and zButtonAspect_AuraProbeTextLeft1.GetText then
buffname = nil buffname = zButtonAspect_AuraProbeTextLeft1:GetText()
end else
spellname = GetSpellName(buttontextures[buff].id, "spell") buffname = nil
if buffname == spellname then end
buttontextures[buff].icon = "Interface\\Icons\\Spell_Nature_WispSplode" spellname = GetSpellName(buttontextures[buff].id, "spell")
end if buffname == spellname then
else buttontextures[buff].icon = "Interface\\Icons\\Spell_Nature_WispSplode"
buttontextures[buff].icon = "Interface\\Icons\\Spell_Nature_WispSplode" end
end else
end buttontextures[buff].icon = "Interface\\Icons\\Spell_Nature_WispSplode"
i = i + 1 end
buff = UnitBuff("player", i) end
end i = i + 1
if event == "PLAYER_AURAS_CHANGED" and zButtonAspect_LastAuraTexture == texture and zButtonAspect.id == newParentId and zButtonAspect_LastParentId == newParentId and not isParentTooltipOwned then buff = UnitBuff("player", i)
return end
end if event == "PLAYER_AURAS_CHANGED" and zButtonAspect_LastAuraTexture == texture and zButtonAspect.id == newParentId and zButtonAspect_LastParentId == newParentId and not isParentTooltipOwned then
zButtonAspect_LastAuraTexture = texture return
zButtonAspect_LastParentId = newParentId end
zButtonAspect.id = newParentId zButtonAspect_LastAuraTexture = texture
ZSpellButton_UpdateButton(zButtonAspect) zButtonAspect_LastParentId = newParentId
ZSpellButton_UpdateCooldown(zButtonAspect) zButtonAspect.id = newParentId
if needChildIconScan then ZSpellButton_UpdateButton(zButtonAspect)
for i=1, zButtonAspect.count do ZSpellButton_UpdateCooldown(zButtonAspect)
button = getglobal(zButtonAspect.name..i) if needChildIconScan then
if button.id then for i=1, zButtonAspect.count do
ZSpellButton_UpdateButton(button) button = getglobal(zButtonAspect.name..i)
end if button.id then
end ZSpellButton_UpdateButton(button)
end end
if isParentTooltipOwned then end
ZSpellButtonParent_OnEnter(zButtonAspect) end
end if isParentTooltipOwned then
end ZSpellButtonParent_OnEnter(zButtonAspect)
end end
end
function zButtonAspect_KeyBinding(index) end
if MTH_ZH_IsModuleEnabled and not MTH_ZH_IsModuleEnabled() then
return function zButtonAspect_KeyBinding(index)
end if MTH_ZH_IsModuleEnabled and not MTH_ZH_IsModuleEnabled() then
return
local button end
if index then
button = getglobal("zButtonAspect"..index) local button
else if index then
button = zButtonAspect button = getglobal("zButtonAspect"..index)
end else
if button.id then button = zButtonAspect
CastSpell(button.id, "spell") end
if zButtonAspect.hideonclick then if button.id then
if type(ZSpellButton_SetChildrenExpanded) == "function" then CastSpell(button.id, "spell")
ZSpellButton_SetChildrenExpanded(zButtonAspect, false) if zButtonAspect.hideonclick then
elseif zButtonAspect.children then if type(ZSpellButton_SetChildrenExpanded) == "function" then
zButtonAspect.children:Hide() ZSpellButton_SetChildrenExpanded(zButtonAspect, false)
end elseif zButtonAspect.children then
end zButtonAspect.children:Hide()
end end
end end
end
SLASH_zButtonAspect1 = "/ZAspect" end
SlashCmdList["zButtonAspect"] = function(msg)
if MTH_ZH_HandleDisabledSlash and MTH_ZH_HandleDisabledSlash("Aspect button is disabled while module 'zhunter' is disabled.") then SLASH_zButtonAspect1 = "/ZAspect"
return SlashCmdList["zButtonAspect"] = function(msg)
end if MTH_ZH_HandleDisabledSlash and MTH_ZH_HandleDisabledSlash("Aspect button is disabled while module 'zhunter' is disabled.") then
if msg == "reset" then return
zButtonAspect_Reset() end
zButtonAspect:ClearAllPoints() if msg == "reset" then
zButtonAspect:SetPoint("CENTER", UIParent, "CENTER", -60, 0) zButtonAspect_Reset()
elseif msg == "options" then zButtonAspect:ClearAllPoints()
MTH_OpenOptions("Aspect") zButtonAspect:SetPoint("CENTER", UIParent, "CENTER", -60, 0)
else elseif msg == "options" then
MTH_ZH_Print("Possible Commands: \"options\", \"reset\"") MTH_OpenOptions("Aspect")
end else
MTH_ZH_Print("Possible Commands: \"options\", \"reset\"")
end
end end
+11 -9
View File
@@ -93,6 +93,8 @@ local function zButtonCompanions_ApplyRuntimeSettings()
local saved = zButtonCompanions_GetSaved() local saved = zButtonCompanions_GetSaved()
zButtonCompanions.tooltip = saved["tooltip"] and true or false zButtonCompanions.tooltip = saved["tooltip"] and true or false
zButtonCompanions.hideonclick = saved["children"] and saved["children"]["hideonclick"] and true or false zButtonCompanions.hideonclick = saved["children"] and saved["children"]["hideonclick"] and true or false
zButtonCompanions.expandonhover = saved["children"] and saved["children"]["expandonhover"] and true or false
zButtonCompanions.fadetimer = saved["children"] and tonumber(saved["children"]["fadetimer"]) or 0
end end
local function zButtonCompanions_NormalizeTabName(value) local function zButtonCompanions_NormalizeTabName(value)
@@ -225,10 +227,10 @@ function zButtonCompanions_OnEvent()
return return
end end
zButtonCompanions_CreateButtons() zButtonCompanions_CreateButtons()
zButtonCompanionsAdjustment = CreateFrame("Frame", "zButtonCompanionsAdjustment") MTH_ZH_CompanionsAdjust = CreateFrame("Frame", "MTH_ZH_CompanionsAdjust")
zButtonCompanionsAdjustment:RegisterEvent("SPELLS_CHANGED") MTH_ZH_CompanionsAdjust:RegisterEvent("SPELLS_CHANGED")
zButtonCompanionsAdjustment:RegisterEvent("PLAYER_ENTERING_WORLD") MTH_ZH_CompanionsAdjust:RegisterEvent("PLAYER_ENTERING_WORLD")
zButtonCompanionsAdjustment:SetScript("OnEvent", zButtonCompanionsAdjustment_OnEvent) MTH_ZH_CompanionsAdjust:SetScript("OnEvent", MTH_ZH_CompanionsAdjust_OnEvent)
zButtonCompanions_SetupSizeAndPosition() zButtonCompanions_SetupSizeAndPosition()
end end
end end
@@ -247,16 +249,16 @@ end
function zButtonCompanions_SetupSizeAndPosition() function zButtonCompanions_SetupSizeAndPosition()
local saved = zButtonCompanions_GetSaved() local saved = zButtonCompanions_GetSaved()
if saved["enabled"] == false or saved["enabled"] == 0 then if saved["enabled"] == false or saved["enabled"] == 0 then
if zButtonCompanionsAdjustment and zButtonCompanionsAdjustment.SetScript then if MTH_ZH_CompanionsAdjust and MTH_ZH_CompanionsAdjust.SetScript then
zButtonCompanionsAdjustment:SetScript("OnEvent", nil) MTH_ZH_CompanionsAdjust:SetScript("OnEvent", nil)
end end
if zButtonCompanions and zButtonCompanions.Hide then if zButtonCompanions and zButtonCompanions.Hide then
zButtonCompanions:Hide() zButtonCompanions:Hide()
end end
return return
end end
if zButtonCompanionsAdjustment and zButtonCompanionsAdjustment.SetScript then if MTH_ZH_CompanionsAdjust and MTH_ZH_CompanionsAdjust.SetScript then
zButtonCompanionsAdjustment:SetScript("OnEvent", zButtonCompanionsAdjustment_OnEvent) MTH_ZH_CompanionsAdjust:SetScript("OnEvent", MTH_ZH_CompanionsAdjust_OnEvent)
end end
local displayCount = zButtonCompanions.found or 0 local displayCount = zButtonCompanions.found or 0
if displayCount < 0 then if displayCount < 0 then
@@ -291,7 +293,7 @@ function zButtonCompanions_Reset()
zButtonCompanions_EnsureConfig() zButtonCompanions_EnsureConfig()
end end
function zButtonCompanionsAdjustment_OnEvent() function MTH_ZH_CompanionsAdjust_OnEvent()
if not zButtonCompanions then if not zButtonCompanions then
return return
end end
+11 -9
View File
@@ -93,6 +93,8 @@ local function zButtonMounts_ApplyRuntimeSettings()
local saved = zButtonMounts_GetSaved() local saved = zButtonMounts_GetSaved()
zButtonMounts.tooltip = saved["tooltip"] and true or false zButtonMounts.tooltip = saved["tooltip"] and true or false
zButtonMounts.hideonclick = saved["children"] and saved["children"]["hideonclick"] and true or false zButtonMounts.hideonclick = saved["children"] and saved["children"]["hideonclick"] and true or false
zButtonMounts.expandonhover = saved["children"] and saved["children"]["expandonhover"] and true or false
zButtonMounts.fadetimer = saved["children"] and tonumber(saved["children"]["fadetimer"]) or 0
end end
local function zButtonMounts_NormalizeTabName(value) local function zButtonMounts_NormalizeTabName(value)
@@ -225,10 +227,10 @@ function zButtonMounts_OnEvent()
return return
end end
zButtonMounts_CreateButtons() zButtonMounts_CreateButtons()
zButtonMountsAdjustment = CreateFrame("Frame", "zButtonMountsAdjustment") MTH_ZH_MountsAdjust = CreateFrame("Frame", "MTH_ZH_MountsAdjust")
zButtonMountsAdjustment:RegisterEvent("SPELLS_CHANGED") MTH_ZH_MountsAdjust:RegisterEvent("SPELLS_CHANGED")
zButtonMountsAdjustment:RegisterEvent("PLAYER_ENTERING_WORLD") MTH_ZH_MountsAdjust:RegisterEvent("PLAYER_ENTERING_WORLD")
zButtonMountsAdjustment:SetScript("OnEvent", zButtonMountsAdjustment_OnEvent) MTH_ZH_MountsAdjust:SetScript("OnEvent", MTH_ZH_MountsAdjust_OnEvent)
zButtonMounts_SetupSizeAndPosition() zButtonMounts_SetupSizeAndPosition()
end end
end end
@@ -247,16 +249,16 @@ end
function zButtonMounts_SetupSizeAndPosition() function zButtonMounts_SetupSizeAndPosition()
local saved = zButtonMounts_GetSaved() local saved = zButtonMounts_GetSaved()
if saved["enabled"] == false or saved["enabled"] == 0 then if saved["enabled"] == false or saved["enabled"] == 0 then
if zButtonMountsAdjustment and zButtonMountsAdjustment.SetScript then if MTH_ZH_MountsAdjust and MTH_ZH_MountsAdjust.SetScript then
zButtonMountsAdjustment:SetScript("OnEvent", nil) MTH_ZH_MountsAdjust:SetScript("OnEvent", nil)
end end
if zButtonMounts and zButtonMounts.Hide then if zButtonMounts and zButtonMounts.Hide then
zButtonMounts:Hide() zButtonMounts:Hide()
end end
return return
end end
if zButtonMountsAdjustment and zButtonMountsAdjustment.SetScript then if MTH_ZH_MountsAdjust and MTH_ZH_MountsAdjust.SetScript then
zButtonMountsAdjustment:SetScript("OnEvent", zButtonMountsAdjustment_OnEvent) MTH_ZH_MountsAdjust:SetScript("OnEvent", MTH_ZH_MountsAdjust_OnEvent)
end end
local displayCount = zButtonMounts.found or 0 local displayCount = zButtonMounts.found or 0
if displayCount < 0 then if displayCount < 0 then
@@ -291,7 +293,7 @@ function zButtonMounts_Reset()
zButtonMounts_EnsureConfig() zButtonMounts_EnsureConfig()
end end
function zButtonMountsAdjustment_OnEvent() function MTH_ZH_MountsAdjust_OnEvent()
if not zButtonMounts then if not zButtonMounts then
return return
end end
File diff suppressed because it is too large Load Diff
+12 -10
View File
@@ -232,6 +232,8 @@ local function zButtonRanged_ApplyRuntimeSettings()
local saved = zButtonRanged_GetSaved() local saved = zButtonRanged_GetSaved()
zButtonRanged.tooltip = saved["tooltip"] and true or false zButtonRanged.tooltip = saved["tooltip"] and true or false
zButtonRanged.hideonclick = saved["children"] and saved["children"]["hideonclick"] and true or false zButtonRanged.hideonclick = saved["children"] and saved["children"]["hideonclick"] and true or false
zButtonRanged.expandonhover = saved["children"] and saved["children"]["expandonhover"] and true or false
zButtonRanged.fadetimer = saved["children"] and tonumber(saved["children"]["fadetimer"]) or 0
end end
local function zButtonRanged_UpdateDurabilityText(button) local function zButtonRanged_UpdateDurabilityText(button)
@@ -602,11 +604,11 @@ function zButtonRanged_OnEvent()
zButtonRanged.customUpdateButton = zButtonRanged_UpdateButton zButtonRanged.customUpdateButton = zButtonRanged_UpdateButton
zButtonRanged.beforeclick = zButtonRanged_BeforeClick zButtonRanged.beforeclick = zButtonRanged_BeforeClick
zButtonRanged_CreateButtons() zButtonRanged_CreateButtons()
zButtonRangedAdjustment = CreateFrame("Frame", "zButtonRangedAdjustment") MTH_ZH_RangedAdjust = CreateFrame("Frame", "MTH_ZH_RangedAdjust")
zButtonRangedAdjustment:RegisterEvent("UNIT_INVENTORY_CHANGED") MTH_ZH_RangedAdjust:RegisterEvent("UNIT_INVENTORY_CHANGED")
zButtonRangedAdjustment:RegisterEvent("BAG_UPDATE") MTH_ZH_RangedAdjust:RegisterEvent("BAG_UPDATE")
zButtonRangedAdjustment:RegisterEvent("PLAYER_ENTERING_WORLD") MTH_ZH_RangedAdjust:RegisterEvent("PLAYER_ENTERING_WORLD")
zButtonRangedAdjustment:SetScript("OnEvent", zButtonRangedAdjustment_OnEvent) MTH_ZH_RangedAdjust:SetScript("OnEvent", MTH_ZH_RangedAdjust_OnEvent)
zButtonRanged_SetupSizeAndPosition() zButtonRanged_SetupSizeAndPosition()
end end
end end
@@ -635,16 +637,16 @@ end
function zButtonRanged_SetupSizeAndPosition() function zButtonRanged_SetupSizeAndPosition()
local saved = zButtonRanged_GetSaved() local saved = zButtonRanged_GetSaved()
if saved["enabled"] == false or saved["enabled"] == 0 then if saved["enabled"] == false or saved["enabled"] == 0 then
if zButtonRangedAdjustment and zButtonRangedAdjustment.SetScript then if MTH_ZH_RangedAdjust and MTH_ZH_RangedAdjust.SetScript then
zButtonRangedAdjustment:SetScript("OnEvent", nil) MTH_ZH_RangedAdjust:SetScript("OnEvent", nil)
end end
if zButtonRanged and zButtonRanged.Hide then if zButtonRanged and zButtonRanged.Hide then
zButtonRanged:Hide() zButtonRanged:Hide()
end end
return return
end end
if zButtonRangedAdjustment and zButtonRangedAdjustment.SetScript then if MTH_ZH_RangedAdjust and MTH_ZH_RangedAdjust.SetScript then
zButtonRangedAdjustment:SetScript("OnEvent", zButtonRangedAdjustment_OnEvent) MTH_ZH_RangedAdjust:SetScript("OnEvent", MTH_ZH_RangedAdjust_OnEvent)
end end
local displayCount = zButtonRanged.found or 0 local displayCount = zButtonRanged.found or 0
if displayCount < 0 then if displayCount < 0 then
@@ -679,7 +681,7 @@ function zButtonRanged_Reset()
zButtonRanged_EnsureConfig() zButtonRanged_EnsureConfig()
end end
function zButtonRangedAdjustment_OnEvent() function MTH_ZH_RangedAdjust_OnEvent()
if not zButtonRanged then if not zButtonRanged then
return return
end end
+11 -9
View File
@@ -93,6 +93,8 @@ local function zButtonToys_ApplyRuntimeSettings()
local saved = zButtonToys_GetSaved() local saved = zButtonToys_GetSaved()
zButtonToys.tooltip = saved["tooltip"] and true or false zButtonToys.tooltip = saved["tooltip"] and true or false
zButtonToys.hideonclick = saved["children"] and saved["children"]["hideonclick"] and true or false zButtonToys.hideonclick = saved["children"] and saved["children"]["hideonclick"] and true or false
zButtonToys.expandonhover = saved["children"] and saved["children"]["expandonhover"] and true or false
zButtonToys.fadetimer = saved["children"] and tonumber(saved["children"]["fadetimer"]) or 0
end end
local function zButtonToys_NormalizeTabName(value) local function zButtonToys_NormalizeTabName(value)
@@ -225,10 +227,10 @@ function zButtonToys_OnEvent()
return return
end end
zButtonToys_CreateButtons() zButtonToys_CreateButtons()
zButtonToysAdjustment = CreateFrame("Frame", "zButtonToysAdjustment") MTH_ZH_ToysAdjust = CreateFrame("Frame", "MTH_ZH_ToysAdjust")
zButtonToysAdjustment:RegisterEvent("SPELLS_CHANGED") MTH_ZH_ToysAdjust:RegisterEvent("SPELLS_CHANGED")
zButtonToysAdjustment:RegisterEvent("PLAYER_ENTERING_WORLD") MTH_ZH_ToysAdjust:RegisterEvent("PLAYER_ENTERING_WORLD")
zButtonToysAdjustment:SetScript("OnEvent", zButtonToysAdjustment_OnEvent) MTH_ZH_ToysAdjust:SetScript("OnEvent", MTH_ZH_ToysAdjust_OnEvent)
zButtonToys_SetupSizeAndPosition() zButtonToys_SetupSizeAndPosition()
end end
end end
@@ -247,16 +249,16 @@ end
function zButtonToys_SetupSizeAndPosition() function zButtonToys_SetupSizeAndPosition()
local saved = zButtonToys_GetSaved() local saved = zButtonToys_GetSaved()
if saved["enabled"] == false or saved["enabled"] == 0 then if saved["enabled"] == false or saved["enabled"] == 0 then
if zButtonToysAdjustment and zButtonToysAdjustment.SetScript then if MTH_ZH_ToysAdjust and MTH_ZH_ToysAdjust.SetScript then
zButtonToysAdjustment:SetScript("OnEvent", nil) MTH_ZH_ToysAdjust:SetScript("OnEvent", nil)
end end
if zButtonToys and zButtonToys.Hide then if zButtonToys and zButtonToys.Hide then
zButtonToys:Hide() zButtonToys:Hide()
end end
return return
end end
if zButtonToysAdjustment and zButtonToysAdjustment.SetScript then if MTH_ZH_ToysAdjust and MTH_ZH_ToysAdjust.SetScript then
zButtonToysAdjustment:SetScript("OnEvent", zButtonToysAdjustment_OnEvent) MTH_ZH_ToysAdjust:SetScript("OnEvent", MTH_ZH_ToysAdjust_OnEvent)
end end
local displayCount = zButtonToys.found or 0 local displayCount = zButtonToys.found or 0
if displayCount < 0 then if displayCount < 0 then
@@ -291,7 +293,7 @@ function zButtonToys_Reset()
zButtonToys_EnsureConfig() zButtonToys_EnsureConfig()
end end
function zButtonToysAdjustment_OnEvent() function MTH_ZH_ToysAdjust_OnEvent()
if not zButtonToys then if not zButtonToys then
return return
end end
+411 -409
View File
@@ -1,410 +1,412 @@
local function zButtonTrack_GetRoot() local function zButtonTrack_GetRoot()
return MTH_ZH_GetSavedRoot() return MTH_ZH_GetSavedRoot()
end end
local root = zButtonTrack_GetRoot() local root = zButtonTrack_GetRoot()
if not root["zButtonTrack"] then if not root["zButtonTrack"] then
root["zButtonTrack"] = {} root["zButtonTrack"] = {}
root["zButtonTrack"]["spells"] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11} root["zButtonTrack"]["spells"] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
root["zButtonTrack"]["rows"] = 1 root["zButtonTrack"]["rows"] = 1
root["zButtonTrack"]["horizontal"] = nil root["zButtonTrack"]["horizontal"] = nil
root["zButtonTrack"]["vertical"] = nil root["zButtonTrack"]["vertical"] = nil
root["zButtonTrack"]["firstbutton"] = "RIGHT" root["zButtonTrack"]["firstbutton"] = "RIGHT"
root["zButtonTrack"]["enabled"] = 1 root["zButtonTrack"]["enabled"] = 1
root["zButtonTrack"]["tooltip"] = 1 root["zButtonTrack"]["tooltip"] = 1
root["zButtonTrack"]["parent"] = {} root["zButtonTrack"]["parent"] = {}
root["zButtonTrack"]["parent"]["size"] = 36 root["zButtonTrack"]["parent"]["size"] = 36
root["zButtonTrack"]["parent"]["hide"] = nil root["zButtonTrack"]["parent"]["hide"] = nil
root["zButtonTrack"]["parent"]["circle"] = 1 root["zButtonTrack"]["parent"]["circle"] = 1
root["zButtonTrack"]["children"] = {} root["zButtonTrack"]["children"] = {}
root["zButtonTrack"]["children"]["size"] = 36 root["zButtonTrack"]["children"]["size"] = 36
root["zButtonTrack"]["children"]["hideonclick"] = 1 root["zButtonTrack"]["children"]["hideonclick"] = 1
end end
ZHunterMod_Track_Spells = { ZHunterMod_Track_Spells = {
ZHUNTER_TRACK_HIDDEN, ZHUNTER_TRACK_HIDDEN,
ZHUNTER_TRACK_HUMANOIDS, ZHUNTER_TRACK_HUMANOIDS,
ZHUNTER_TRACK_UNDEAD, ZHUNTER_TRACK_UNDEAD,
ZHUNTER_TRACK_BEASTS, ZHUNTER_TRACK_BEASTS,
ZHUNTER_TRACK_DEMONS, ZHUNTER_TRACK_DEMONS,
ZHUNTER_TRACK_ELEMENTALS, ZHUNTER_TRACK_ELEMENTALS,
ZHUNTER_TRACK_DRAGONKIN, ZHUNTER_TRACK_DRAGONKIN,
ZHUNTER_TRACK_GIANTS, ZHUNTER_TRACK_GIANTS,
ZHUNTER_TRACK_MINERALS, ZHUNTER_TRACK_MINERALS,
ZHUNTER_TRACK_HERBS, ZHUNTER_TRACK_HERBS,
ZHUNTER_TRACK_TREASURE ZHUNTER_TRACK_TREASURE
} }
local ZHUNTER_TRACK_MAX = table.getn(ZHunterMod_Track_Spells) local ZHUNTER_TRACK_MAX = table.getn(ZHunterMod_Track_Spells)
local zButtonTrack_LastTrackingTexture = nil local zButtonTrack_LastTrackingTexture = nil
local zButtonTrack_SyncActiveChild local zButtonTrack_SyncActiveChild
local zButtonTrack_GetSaved local zButtonTrack_GetSaved
local function zButtonTrack_NormalizeTexture(texture) local function zButtonTrack_NormalizeTexture(texture)
if not texture then if not texture then
return "" return ""
end end
local value = string.lower(tostring(texture)) local value = string.lower(tostring(texture))
value = string.gsub(value, "\\", "/") value = string.gsub(value, "\\", "/")
local _, _, basename = string.find(value, "([^/]+)$") local _, _, basename = string.find(value, "([^/]+)$")
return basename or value return basename or value
end end
local function zButtonTrack_FindSpellIdByTrackingTexture(trackingTexture) local function zButtonTrack_FindSpellIdByTrackingTexture(trackingTexture)
if not trackingTexture or not zButtonTrack or not zButtonTrack.count then if not trackingTexture or not zButtonTrack or not zButtonTrack.count then
return nil return nil
end end
local wanted = zButtonTrack_NormalizeTexture(trackingTexture) local wanted = zButtonTrack_NormalizeTexture(trackingTexture)
for i = 1, zButtonTrack.count do for i = 1, zButtonTrack.count do
local child = getglobal("zButtonTrack" .. i) local child = getglobal("zButtonTrack" .. i)
if child and child.id then if child and child.id then
local spellTexture = GetSpellTexture and GetSpellTexture(child.id, "spell") or nil local spellTexture = GetSpellTexture and GetSpellTexture(child.id, "spell") or nil
if zButtonTrack_NormalizeTexture(spellTexture) == wanted then if zButtonTrack_NormalizeTexture(spellTexture) == wanted then
return child.id return child.id
end end
if child.icon and zButtonTrack_NormalizeTexture(child.icon) == wanted then if child.icon and zButtonTrack_NormalizeTexture(child.icon) == wanted then
return child.id return child.id
end end
if child.icontexture and child.icontexture.GetTexture then if child.icontexture and child.icontexture.GetTexture then
local childTexture = child.icontexture:GetTexture() local childTexture = child.icontexture:GetTexture()
if zButtonTrack_NormalizeTexture(childTexture) == wanted then if zButtonTrack_NormalizeTexture(childTexture) == wanted then
return child.id return child.id
end end
end end
end end
end end
return nil return nil
end end
local function zButtonTrack_FindSpellIdByTrackingName(trackingName) local function zButtonTrack_FindSpellIdByTrackingName(trackingName)
if not trackingName or trackingName == "" or not zButtonTrack or not zButtonTrack.count then if not trackingName or trackingName == "" or not zButtonTrack or not zButtonTrack.count then
return nil return nil
end end
for i = 1, zButtonTrack.count do for i = 1, zButtonTrack.count do
local child = getglobal("zButtonTrack" .. i) local child = getglobal("zButtonTrack" .. i)
if child and child.id then if child and child.id then
local spellName = GetSpellName and GetSpellName(child.id, "spell") or nil local spellName = GetSpellName and GetSpellName(child.id, "spell") or nil
if spellName == trackingName then if spellName == trackingName then
return child.id return child.id
end end
end end
end end
return nil return nil
end end
local function zButtonTrack_GetActiveTrackingSpellId() local function zButtonTrack_GetActiveTrackingSpellId()
local activeName = nil local activeName = nil
local activeTexture = nil local activeTexture = nil
if GetNumTrackingTypes and GetTrackingInfo then if GetNumTrackingTypes and GetTrackingInfo then
local numTracking = GetNumTrackingTypes() or 0 local numTracking = GetNumTrackingTypes() or 0
for i = 1, numTracking do for i = 1, numTracking do
local name, texture, active = GetTrackingInfo(i) local name, texture, active = GetTrackingInfo(i)
if active then if active then
activeName = name activeName = name
activeTexture = texture activeTexture = texture
break break
end end
end end
end end
local byName = zButtonTrack_FindSpellIdByTrackingName(activeName) local byName = zButtonTrack_FindSpellIdByTrackingName(activeName)
if byName then if byName then
return byName, activeTexture return byName, activeTexture
end end
if activeTexture then if activeTexture then
return zButtonTrack_FindSpellIdByTrackingTexture(activeTexture), activeTexture return zButtonTrack_FindSpellIdByTrackingTexture(activeTexture), activeTexture
end end
local buff = GetTrackingTexture and GetTrackingTexture() or nil local buff = GetTrackingTexture and GetTrackingTexture() or nil
return zButtonTrack_FindSpellIdByTrackingTexture(buff), buff return zButtonTrack_FindSpellIdByTrackingTexture(buff), buff
end end
local function zButtonTrack_AfterClick(button) local function zButtonTrack_AfterClick(button)
if not zButtonTrack then if not zButtonTrack then
return return
end end
if button and button.id then if button and button.id then
zButtonTrack.id = button.id zButtonTrack.id = button.id
ZSpellButton_UpdateButton(zButtonTrack) ZSpellButton_UpdateButton(zButtonTrack)
ZSpellButton_UpdateCooldown(zButtonTrack) ZSpellButton_UpdateCooldown(zButtonTrack)
zButtonTrack_SyncActiveChild(button.id) zButtonTrack_SyncActiveChild(button.id)
if GetSpellTexture then if GetSpellTexture then
zButtonTrack_LastTrackingTexture = GetSpellTexture(button.id, "spell") or zButtonTrack_LastTrackingTexture zButtonTrack_LastTrackingTexture = GetSpellTexture(button.id, "spell") or zButtonTrack_LastTrackingTexture
end end
local isOwned = GameTooltip and GameTooltip.IsOwned and GameTooltip:IsOwned(zButtonTrack) local isOwned = GameTooltip and GameTooltip.IsOwned and GameTooltip:IsOwned(zButtonTrack)
if isOwned then if isOwned then
ZSpellButtonParent_OnEnter(zButtonTrack) ZSpellButtonParent_OnEnter(zButtonTrack)
end end
end end
end end
zButtonTrack_SyncActiveChild = function(activeId) zButtonTrack_SyncActiveChild = function(activeId)
if not zButtonTrack or not zButtonTrack.count then if not zButtonTrack or not zButtonTrack.count then
return return
end end
for i = 1, zButtonTrack.count do for i = 1, zButtonTrack.count do
local child = getglobal("zButtonTrack" .. i) local child = getglobal("zButtonTrack" .. i)
if child and child.SetChecked then if child and child.SetChecked then
child:SetChecked((activeId and child.id == activeId) and 1 or 0) child:SetChecked((activeId and child.id == activeId) and 1 or 0)
end end
end end
if zButtonTrack.SetChecked then if zButtonTrack.SetChecked then
zButtonTrack:SetChecked(0) zButtonTrack:SetChecked(0)
end end
end end
local function zButtonTrack_RefreshTrackingState() local function zButtonTrack_RefreshTrackingState()
if not zButtonTrack or not zButtonTrack.count then if not zButtonTrack or not zButtonTrack.count then
return return
end end
local newId, trackingTexture = zButtonTrack_GetActiveTrackingSpellId() local newId, trackingTexture = zButtonTrack_GetActiveTrackingSpellId()
local buff = trackingTexture or (GetTrackingTexture and GetTrackingTexture() or nil) local buff = trackingTexture or (GetTrackingTexture and GetTrackingTexture() or nil)
if not newId and not buff then if not newId and not buff then
if zButtonTrack.id then if zButtonTrack.id then
zButtonTrack_SyncActiveChild(zButtonTrack.id) zButtonTrack_SyncActiveChild(zButtonTrack.id)
else else
zButtonTrack_LastTrackingTexture = nil zButtonTrack_LastTrackingTexture = nil
zButtonTrack_SyncActiveChild(nil) zButtonTrack_SyncActiveChild(nil)
end end
return return
end end
if not newId then if not newId then
newId = zButtonTrack.id or nil newId = zButtonTrack.id or nil
end end
if not newId then if not newId then
return return
end end
if zButtonTrack_NormalizeTexture(zButtonTrack_LastTrackingTexture) == zButtonTrack_NormalizeTexture(buff) and zButtonTrack.id == newId then if zButtonTrack_NormalizeTexture(zButtonTrack_LastTrackingTexture) == zButtonTrack_NormalizeTexture(buff) and zButtonTrack.id == newId then
zButtonTrack_SyncActiveChild(newId) zButtonTrack_SyncActiveChild(newId)
return return
end end
local isOwned = GameTooltip and GameTooltip.IsOwned and GameTooltip:IsOwned(zButtonTrack) local isOwned = GameTooltip and GameTooltip.IsOwned and GameTooltip:IsOwned(zButtonTrack)
zButtonTrack_LastTrackingTexture = buff zButtonTrack_LastTrackingTexture = buff
zButtonTrack.id = newId zButtonTrack.id = newId
ZSpellButton_UpdateButton(zButtonTrack) ZSpellButton_UpdateButton(zButtonTrack)
ZSpellButton_UpdateCooldown(zButtonTrack) ZSpellButton_UpdateCooldown(zButtonTrack)
zButtonTrack_SyncActiveChild(newId) zButtonTrack_SyncActiveChild(newId)
if isOwned then if isOwned then
ZSpellButtonParent_OnEnter(zButtonTrack) ZSpellButtonParent_OnEnter(zButtonTrack)
end end
end end
zButtonTrack_GetSaved = function() zButtonTrack_GetSaved = function()
local currentRoot = zButtonTrack_GetRoot() local currentRoot = zButtonTrack_GetRoot()
if not currentRoot["zButtonTrack"] then if not currentRoot["zButtonTrack"] then
currentRoot["zButtonTrack"] = {} currentRoot["zButtonTrack"] = {}
end end
return currentRoot["zButtonTrack"] return currentRoot["zButtonTrack"]
end end
local function zButtonTrack_EnsureConfig() local function zButtonTrack_EnsureConfig()
local saved = zButtonTrack_GetSaved() local saved = zButtonTrack_GetSaved()
saved["count"] = nil saved["count"] = nil
if saved["rows"] == nil then if saved["rows"] == nil then
saved["rows"] = 1 saved["rows"] = 1
end end
if saved["firstbutton"] == nil then if saved["firstbutton"] == nil then
saved["firstbutton"] = "RIGHT" saved["firstbutton"] = "RIGHT"
end end
if saved["enabled"] == nil then if saved["enabled"] == nil then
saved["enabled"] = 1 saved["enabled"] = 1
end end
if saved["tooltip"] == nil then if saved["tooltip"] == nil then
saved["tooltip"] = 1 saved["tooltip"] = 1
end end
if not saved["parent"] then if not saved["parent"] then
saved["parent"] = {} saved["parent"] = {}
end end
if saved["parent"]["size"] == nil then if saved["parent"]["size"] == nil then
saved["parent"]["size"] = 36 saved["parent"]["size"] = 36
end end
if saved["parent"]["circle"] == nil then if saved["parent"]["circle"] == nil then
saved["parent"]["circle"] = 1 saved["parent"]["circle"] = 1
end end
if not saved["children"] then if not saved["children"] then
saved["children"] = {} saved["children"] = {}
end end
if saved["children"]["size"] == nil then if saved["children"]["size"] == nil then
saved["children"]["size"] = 36 saved["children"]["size"] = 36
end end
if saved["children"]["hideonclick"] == nil then if saved["children"]["hideonclick"] == nil then
saved["children"]["hideonclick"] = 1 saved["children"]["hideonclick"] = 1
end end
if not saved["spells"] then if not saved["spells"] then
saved["spells"] = {} saved["spells"] = {}
end end
if not saved["visible"] then if not saved["visible"] then
saved["visible"] = {} saved["visible"] = {}
end end
for i = 1, ZHUNTER_TRACK_MAX do for i = 1, ZHUNTER_TRACK_MAX do
if not tonumber(saved["spells"][i]) then if not tonumber(saved["spells"][i]) then
saved["spells"][i] = i saved["spells"][i] = i
end end
if saved["visible"][i] == nil then if saved["visible"][i] == nil then
saved["visible"][i] = 1 saved["visible"][i] = 1
end end
end end
end end
local function zButtonTrack_ApplyRuntimeSettings() local function zButtonTrack_ApplyRuntimeSettings()
if not zButtonTrack then if not zButtonTrack then
return return
end end
local saved = zButtonTrack_GetSaved() local saved = zButtonTrack_GetSaved()
zButtonTrack.tooltip = saved["tooltip"] and true or false zButtonTrack.tooltip = saved["tooltip"] and true or false
zButtonTrack.hideonclick = saved["children"] and saved["children"]["hideonclick"] and true or false zButtonTrack.hideonclick = saved["children"] and saved["children"]["hideonclick"] and true or false
end zButtonTrack.expandonhover = saved["children"] and saved["children"]["expandonhover"] and true or false
zButtonTrack.fadetimer = saved["children"] and tonumber(saved["children"]["fadetimer"]) or 0
end
function zButtonTrack_OnLoad()
this:RegisterEvent("VARIABLES_LOADED")
end function zButtonTrack_OnLoad()
this:RegisterEvent("VARIABLES_LOADED")
function zButtonTrack_OnEvent() end
if event == "VARIABLES_LOADED" then
if not zButtonTrack then function zButtonTrack_OnEvent()
return if event == "VARIABLES_LOADED" then
end if not zButtonTrack then
if UnitClass("player") ~= ZHUNTER_HUNTER then return
zButtonTrack:UnregisterAllEvents() end
zButtonTrack:Hide() if UnitClass("player") ~= ZHUNTER_HUNTER then
return zButtonTrack:UnregisterAllEvents()
end zButtonTrack:Hide()
zButtonTrack_CreateButtons() return
zButtonTrack.afterclick = zButtonTrack_AfterClick end
zButtonTrackAdjustment = CreateFrame("Frame", "zButtonTrackAdjustment") zButtonTrack_CreateButtons()
zButtonTrackAdjustment:RegisterEvent("MINIMAP_UPDATE_TRACKING") zButtonTrack.afterclick = zButtonTrack_AfterClick
zButtonTrackAdjustment:RegisterEvent("PLAYER_ENTERING_WORLD") MTH_ZH_TrackAdjust = CreateFrame("Frame", "MTH_ZH_TrackAdjust")
zButtonTrackAdjustment:RegisterEvent("SPELLS_CHANGED") MTH_ZH_TrackAdjust:RegisterEvent("MINIMAP_UPDATE_TRACKING")
zButtonTrackAdjustment:RegisterEvent("CHARACTER_POINTS_CHANGED") MTH_ZH_TrackAdjust:RegisterEvent("PLAYER_ENTERING_WORLD")
zButtonTrackAdjustment:RegisterEvent("LEARNED_SPELL_IN_TAB") MTH_ZH_TrackAdjust:RegisterEvent("SPELLS_CHANGED")
zButtonTrackAdjustment:SetScript("OnEvent", zButtonTrackAdjustment_OnEvent) MTH_ZH_TrackAdjust:RegisterEvent("CHARACTER_POINTS_CHANGED")
zButtonTrack_SetupSizeAndPosition() MTH_ZH_TrackAdjust:RegisterEvent("LEARNED_SPELL_IN_TAB")
end MTH_ZH_TrackAdjust:SetScript("OnEvent", MTH_ZH_TrackAdjust_OnEvent)
end zButtonTrack_SetupSizeAndPosition()
end
function zButtonTrack_CreateButtons() end
zButtonTrack_EnsureConfig()
local saved = zButtonTrack_GetSaved() function zButtonTrack_CreateButtons()
zButtonTrack_EnsureConfig()
ZSpellButton_CreateChildren(zButtonTrack, "zButtonTrack", ZHUNTER_TRACK_MAX) local saved = zButtonTrack_GetSaved()
local info = {}
local infoIndex = 1 ZSpellButton_CreateChildren(zButtonTrack, "zButtonTrack", ZHUNTER_TRACK_MAX)
for i=1, table.getn(ZHunterMod_Track_Spells) do local info = {}
if not tonumber(saved["spells"][i]) then local infoIndex = 1
info = ZHunterMod_Track_Spells for i=1, table.getn(ZHunterMod_Track_Spells) do
saved["spells"] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11} if not tonumber(saved["spells"][i]) then
break info = ZHunterMod_Track_Spells
end saved["spells"] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
local spellIndex = saved["spells"][i] break
if saved["visible"][spellIndex] ~= false then end
info[infoIndex] = ZHunterMod_Track_Spells[spellIndex] local spellIndex = saved["spells"][i]
infoIndex = infoIndex + 1 if saved["visible"][spellIndex] ~= false then
end info[infoIndex] = ZHunterMod_Track_Spells[spellIndex]
end infoIndex = infoIndex + 1
zButtonTrack.found = ZSpellButton_SetButtons(zButtonTrack, info) end
zButtonTrack_ApplyRuntimeSettings() end
end zButtonTrack.found = ZSpellButton_SetButtons(zButtonTrack, info)
zButtonTrack_ApplyRuntimeSettings()
function zButtonTrack_SetupSizeAndPosition() end
zButtonTrack_EnsureConfig()
local saved = zButtonTrack_GetSaved() function zButtonTrack_SetupSizeAndPosition()
if saved["enabled"] == false or saved["enabled"] == 0 then zButtonTrack_EnsureConfig()
if zButtonTrackAdjustment and zButtonTrackAdjustment.SetScript then local saved = zButtonTrack_GetSaved()
zButtonTrackAdjustment:SetScript("OnEvent", nil) if saved["enabled"] == false or saved["enabled"] == 0 then
end if MTH_ZH_TrackAdjust and MTH_ZH_TrackAdjust.SetScript then
if zButtonTrack and zButtonTrack.Hide then MTH_ZH_TrackAdjust:SetScript("OnEvent", nil)
zButtonTrack:Hide() end
end if zButtonTrack and zButtonTrack.Hide then
return zButtonTrack:Hide()
end end
if zButtonTrackAdjustment and zButtonTrackAdjustment.SetScript then return
zButtonTrackAdjustment:SetScript("OnEvent", zButtonTrackAdjustment_OnEvent) end
end if MTH_ZH_TrackAdjust and MTH_ZH_TrackAdjust.SetScript then
local displayCount = zButtonTrack.found or ZHUNTER_TRACK_MAX MTH_ZH_TrackAdjust:SetScript("OnEvent", MTH_ZH_TrackAdjust_OnEvent)
if displayCount < 0 then end
displayCount = 0 local displayCount = zButtonTrack.found or ZHUNTER_TRACK_MAX
end if displayCount < 0 then
ZSpellButton_SetSize(zButtonTrack, saved["parent"]["size"]) displayCount = 0
ZSpellButton_SetSize(zButtonTrack, saved["children"]["size"], 1) end
ZSpellButton_SetExpandDirection(zButtonTrack, saved["firstbutton"]) ZSpellButton_SetSize(zButtonTrack, saved["parent"]["size"])
ZSpellButton_ArrangeChildren(zButtonTrack, saved["rows"], ZSpellButton_SetSize(zButtonTrack, saved["children"]["size"], 1)
displayCount, saved["horizontal"], ZSpellButton_SetExpandDirection(zButtonTrack, saved["firstbutton"])
saved["vertical"]) ZSpellButton_ArrangeChildren(zButtonTrack, saved["rows"],
zButtonTrack_RefreshTrackingState() displayCount, saved["horizontal"],
end saved["vertical"])
zButtonTrack_RefreshTrackingState()
function zButtonTrack_Reset() end
local currentRoot = zButtonTrack_GetRoot()
currentRoot["zButtonTrack"] = {} function zButtonTrack_Reset()
local saved = zButtonTrack_GetSaved() local currentRoot = zButtonTrack_GetRoot()
saved["spells"] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11} currentRoot["zButtonTrack"] = {}
saved["rows"] = 1 local saved = zButtonTrack_GetSaved()
saved["horizontal"] = nil saved["spells"] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
saved["vertical"] = nil saved["rows"] = 1
saved["firstbutton"] = "RIGHT" saved["horizontal"] = nil
saved["enabled"] = 1 saved["vertical"] = nil
saved["tooltip"] = 1 saved["firstbutton"] = "RIGHT"
saved["parent"] = {} saved["enabled"] = 1
saved["parent"]["size"] = 36 saved["tooltip"] = 1
saved["parent"]["hide"] = nil saved["parent"] = {}
saved["parent"]["circle"] = 1 saved["parent"]["size"] = 36
saved["children"] = {} saved["parent"]["hide"] = nil
saved["children"]["size"] = 36 saved["parent"]["circle"] = 1
saved["children"]["hideonclick"] = 1 saved["children"] = {}
saved["visible"] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} saved["children"]["size"] = 36
zButtonTrack_EnsureConfig() saved["children"]["hideonclick"] = 1
end saved["visible"] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
zButtonTrack_EnsureConfig()
function zButtonTrackAdjustment_OnEvent() end
if not zButtonTrack or not zButtonTrack.count then
return function MTH_ZH_TrackAdjust_OnEvent()
end if not zButtonTrack or not zButtonTrack.count then
if event == "SPELLS_CHANGED" or event == "CHARACTER_POINTS_CHANGED" or event == "LEARNED_SPELL_IN_TAB" then return
zButtonTrack_CreateButtons() end
zButtonTrack_SetupSizeAndPosition() if event == "SPELLS_CHANGED" or event == "CHARACTER_POINTS_CHANGED" or event == "LEARNED_SPELL_IN_TAB" then
end zButtonTrack_CreateButtons()
if event == "MINIMAP_UPDATE_TRACKING" or event == "PLAYER_ENTERING_WORLD" zButtonTrack_SetupSizeAndPosition()
or event == "SPELLS_CHANGED" or event == "CHARACTER_POINTS_CHANGED" or event == "LEARNED_SPELL_IN_TAB" then end
zButtonTrack_RefreshTrackingState() if event == "MINIMAP_UPDATE_TRACKING" or event == "PLAYER_ENTERING_WORLD"
end or event == "SPELLS_CHANGED" or event == "CHARACTER_POINTS_CHANGED" or event == "LEARNED_SPELL_IN_TAB" then
end zButtonTrack_RefreshTrackingState()
end
function zButtonTrack_KeyBinding(index) end
if MTH_ZH_IsModuleEnabled and not MTH_ZH_IsModuleEnabled() then
return function zButtonTrack_KeyBinding(index)
end if MTH_ZH_IsModuleEnabled and not MTH_ZH_IsModuleEnabled() then
return
local button end
if index then
button = getglobal("zButtonTrack"..index) local button
else if index then
button = zButtonTrack button = getglobal("zButtonTrack"..index)
end else
if button.id then button = zButtonTrack
CastSpell(button.id, "spell") end
if zButtonTrack.hideonclick then if button.id then
if type(ZSpellButton_SetChildrenExpanded) == "function" then CastSpell(button.id, "spell")
ZSpellButton_SetChildrenExpanded(zButtonTrack, false) if zButtonTrack.hideonclick then
elseif zButtonTrack.children then if type(ZSpellButton_SetChildrenExpanded) == "function" then
zButtonTrack.children:Hide() ZSpellButton_SetChildrenExpanded(zButtonTrack, false)
end elseif zButtonTrack.children then
end zButtonTrack.children:Hide()
end end
end end
end
SLASH_zButtonTrack1 = "/ZTrack" end
SlashCmdList["zButtonTrack"] = function(msg)
if MTH_ZH_HandleDisabledSlash and MTH_ZH_HandleDisabledSlash("Track button is disabled while module 'zhunter' is disabled.") then SLASH_zButtonTrack1 = "/ZTrack"
return SlashCmdList["zButtonTrack"] = function(msg)
end if MTH_ZH_HandleDisabledSlash and MTH_ZH_HandleDisabledSlash("Track button is disabled while module 'zhunter' is disabled.") then
msg = tostring(msg or "") return
if msg == "reset" then end
zButtonTrack_Reset() msg = tostring(msg or "")
zButtonTrack:ClearAllPoints() if msg == "reset" then
zButtonTrack:SetPoint("CENTER", UIParent, "CENTER", 0, 0) zButtonTrack_Reset()
elseif msg == "options" then zButtonTrack:ClearAllPoints()
MTH_OpenOptions("Track") zButtonTrack:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
else elseif msg == "options" then
MTH_ZH_Print("Possible Commands: \"options\", \"reset\"") MTH_OpenOptions("Track")
end else
MTH_ZH_Print("Possible Commands: \"options\", \"reset\"")
end
end end
+280 -278
View File
@@ -1,279 +1,281 @@
local function zButtonTrap_GetRoot() local function zButtonTrap_GetRoot()
return MTH_ZH_GetSavedRoot() return MTH_ZH_GetSavedRoot()
end end
local root = zButtonTrap_GetRoot() local root = zButtonTrap_GetRoot()
if not root["zButtonTrap"] then if not root["zButtonTrap"] then
root["zButtonTrap"] = {} root["zButtonTrap"] = {}
root["zButtonTrap"]["spells"] = {1, 2, 3, 4} root["zButtonTrap"]["spells"] = {1, 2, 3, 4}
root["zButtonTrap"]["rows"] = 1 root["zButtonTrap"]["rows"] = 1
root["zButtonTrap"]["horizontal"] = nil root["zButtonTrap"]["horizontal"] = nil
root["zButtonTrap"]["vertical"] = nil root["zButtonTrap"]["vertical"] = nil
root["zButtonTrap"]["firstbutton"] = "RIGHT" root["zButtonTrap"]["firstbutton"] = "RIGHT"
root["zButtonTrap"]["enabled"] = 1 root["zButtonTrap"]["enabled"] = 1
root["zButtonTrap"]["tooltip"] = 1 root["zButtonTrap"]["tooltip"] = 1
root["zButtonTrap"]["parent"] = {} root["zButtonTrap"]["parent"] = {}
root["zButtonTrap"]["parent"]["size"] = 36 root["zButtonTrap"]["parent"]["size"] = 36
root["zButtonTrap"]["parent"]["hide"] = nil root["zButtonTrap"]["parent"]["hide"] = nil
root["zButtonTrap"]["parent"]["circle"] = 1 root["zButtonTrap"]["parent"]["circle"] = 1
root["zButtonTrap"]["children"] = {} root["zButtonTrap"]["children"] = {}
root["zButtonTrap"]["children"]["size"] = 36 root["zButtonTrap"]["children"]["size"] = 36
root["zButtonTrap"]["children"]["hideonclick"] = 1 root["zButtonTrap"]["children"]["hideonclick"] = 1
end end
ZHunterMod_Trap_Spells = { ZHunterMod_Trap_Spells = {
ZHUNTER_TRAP_FREEZING, ZHUNTER_TRAP_FREEZING,
ZHUNTER_TRAP_FROST, ZHUNTER_TRAP_FROST,
ZHUNTER_TRAP_IMMOLATION, ZHUNTER_TRAP_IMMOLATION,
ZHUNTER_TRAP_EXPLOSIVE ZHUNTER_TRAP_EXPLOSIVE
} }
local ZHUNTER_TRAP_MAX = table.getn(ZHunterMod_Trap_Spells) local ZHUNTER_TRAP_MAX = table.getn(ZHunterMod_Trap_Spells)
local zButtonTrap_LastParentId = nil local zButtonTrap_LastParentId = nil
local zButtonTrap_LastCombatState = nil local zButtonTrap_LastCombatState = nil
local function zButtonTrap_GetSaved() local function zButtonTrap_GetSaved()
local currentRoot = zButtonTrap_GetRoot() local currentRoot = zButtonTrap_GetRoot()
if not currentRoot["zButtonTrap"] then if not currentRoot["zButtonTrap"] then
currentRoot["zButtonTrap"] = {} currentRoot["zButtonTrap"] = {}
end end
return currentRoot["zButtonTrap"] return currentRoot["zButtonTrap"]
end end
local function zButtonTrap_EnsureConfig() local function zButtonTrap_EnsureConfig()
local saved = zButtonTrap_GetSaved() local saved = zButtonTrap_GetSaved()
saved["count"] = nil saved["count"] = nil
if saved["rows"] == nil then if saved["rows"] == nil then
saved["rows"] = 1 saved["rows"] = 1
end end
if saved["firstbutton"] == nil then if saved["firstbutton"] == nil then
saved["firstbutton"] = "RIGHT" saved["firstbutton"] = "RIGHT"
end end
if saved["enabled"] == nil then if saved["enabled"] == nil then
saved["enabled"] = 1 saved["enabled"] = 1
end end
if saved["tooltip"] == nil then if saved["tooltip"] == nil then
saved["tooltip"] = 1 saved["tooltip"] = 1
end end
if not saved["parent"] then if not saved["parent"] then
saved["parent"] = {} saved["parent"] = {}
end end
if saved["parent"]["size"] == nil then if saved["parent"]["size"] == nil then
saved["parent"]["size"] = 36 saved["parent"]["size"] = 36
end end
if saved["parent"]["circle"] == nil then if saved["parent"]["circle"] == nil then
saved["parent"]["circle"] = 1 saved["parent"]["circle"] = 1
end end
if not saved["children"] then if not saved["children"] then
saved["children"] = {} saved["children"] = {}
end end
if saved["children"]["size"] == nil then if saved["children"]["size"] == nil then
saved["children"]["size"] = 36 saved["children"]["size"] = 36
end end
if saved["children"]["hideonclick"] == nil then if saved["children"]["hideonclick"] == nil then
saved["children"]["hideonclick"] = 1 saved["children"]["hideonclick"] = 1
end end
if not saved["spells"] then if not saved["spells"] then
saved["spells"] = {} saved["spells"] = {}
end end
if not saved["visible"] then if not saved["visible"] then
saved["visible"] = {} saved["visible"] = {}
end end
for i = 1, ZHUNTER_TRAP_MAX do for i = 1, ZHUNTER_TRAP_MAX do
if not tonumber(saved["spells"][i]) then if not tonumber(saved["spells"][i]) then
saved["spells"][i] = i saved["spells"][i] = i
end end
if saved["visible"][i] == nil then if saved["visible"][i] == nil then
saved["visible"][i] = 1 saved["visible"][i] = 1
end end
end end
end end
local function zButtonTrap_ApplyRuntimeSettings() local function zButtonTrap_ApplyRuntimeSettings()
if not zButtonTrap then if not zButtonTrap then
return return
end end
local saved = zButtonTrap_GetSaved() local saved = zButtonTrap_GetSaved()
zButtonTrap.tooltip = saved["tooltip"] and true or false zButtonTrap.tooltip = saved["tooltip"] and true or false
zButtonTrap.hideonclick = saved["children"] and saved["children"]["hideonclick"] and true or false zButtonTrap.hideonclick = saved["children"] and saved["children"]["hideonclick"] and true or false
end zButtonTrap.expandonhover = saved["children"] and saved["children"]["expandonhover"] and true or false
zButtonTrap.fadetimer = saved["children"] and tonumber(saved["children"]["fadetimer"]) or 0
end
function zButtonTrap_OnLoad()
this:RegisterEvent("VARIABLES_LOADED")
end function zButtonTrap_OnLoad()
this:RegisterEvent("VARIABLES_LOADED")
function zButtonTrap_OnEvent() end
if event == "VARIABLES_LOADED" then
if not zButtonTrap then function zButtonTrap_OnEvent()
return if event == "VARIABLES_LOADED" then
end if not zButtonTrap then
if UnitClass("player") ~= ZHUNTER_HUNTER then return
zButtonTrap:UnregisterAllEvents() end
zButtonTrap:Hide() if UnitClass("player") ~= ZHUNTER_HUNTER then
return zButtonTrap:UnregisterAllEvents()
end zButtonTrap:Hide()
zButtonTrap_CreateButtons() return
zButtonTrapAdjustment = CreateFrame("Frame", "zButtonTrapAdjustment") end
zButtonTrapAdjustment:RegisterEvent("PLAYER_REGEN_ENABLED") zButtonTrap_CreateButtons()
zButtonTrapAdjustment:RegisterEvent("PLAYER_REGEN_DISABLED") MTH_ZH_TrapAdjust = CreateFrame("Frame", "MTH_ZH_TrapAdjust")
zButtonTrapAdjustment:RegisterEvent("PLAYER_ENTERING_WORLD") MTH_ZH_TrapAdjust:RegisterEvent("PLAYER_REGEN_ENABLED")
zButtonTrapAdjustment:RegisterEvent("SPELLS_CHANGED") MTH_ZH_TrapAdjust:RegisterEvent("PLAYER_REGEN_DISABLED")
zButtonTrapAdjustment:RegisterEvent("CHARACTER_POINTS_CHANGED") MTH_ZH_TrapAdjust:RegisterEvent("PLAYER_ENTERING_WORLD")
zButtonTrapAdjustment:SetScript("OnEvent", zButtonTrapAdjustment_OnEvent) MTH_ZH_TrapAdjust:RegisterEvent("SPELLS_CHANGED")
zButtonTrap_SetupSizeAndPosition() MTH_ZH_TrapAdjust:RegisterEvent("CHARACTER_POINTS_CHANGED")
end MTH_ZH_TrapAdjust:SetScript("OnEvent", MTH_ZH_TrapAdjust_OnEvent)
end zButtonTrap_SetupSizeAndPosition()
end
function zButtonTrap_CreateButtons() end
zButtonTrap_EnsureConfig()
local saved = zButtonTrap_GetSaved() function zButtonTrap_CreateButtons()
zButtonTrap_EnsureConfig()
ZSpellButton_CreateChildren(zButtonTrap, "zButtonTrap", ZHUNTER_TRAP_MAX) local saved = zButtonTrap_GetSaved()
local info = {}
local infoIndex = 1 ZSpellButton_CreateChildren(zButtonTrap, "zButtonTrap", ZHUNTER_TRAP_MAX)
for i=1, table.getn(ZHunterMod_Trap_Spells) do local info = {}
if not tonumber(saved["spells"][i]) then local infoIndex = 1
info = ZHunterMod_Trap_Spells for i=1, table.getn(ZHunterMod_Trap_Spells) do
saved["spells"] = {1, 2, 3, 4} if not tonumber(saved["spells"][i]) then
break info = ZHunterMod_Trap_Spells
end saved["spells"] = {1, 2, 3, 4}
local spellIndex = saved["spells"][i] break
if saved["visible"][spellIndex] ~= false then end
info[infoIndex] = ZHunterMod_Trap_Spells[spellIndex] local spellIndex = saved["spells"][i]
infoIndex = infoIndex + 1 if saved["visible"][spellIndex] ~= false then
end info[infoIndex] = ZHunterMod_Trap_Spells[spellIndex]
end infoIndex = infoIndex + 1
zButtonTrap.found = ZSpellButton_SetButtons(zButtonTrap, info) end
zButtonTrap_ApplyRuntimeSettings() end
end zButtonTrap.found = ZSpellButton_SetButtons(zButtonTrap, info)
zButtonTrap_ApplyRuntimeSettings()
function zButtonTrap_SetupSizeAndPosition() end
zButtonTrap_EnsureConfig()
local saved = zButtonTrap_GetSaved() function zButtonTrap_SetupSizeAndPosition()
if saved["enabled"] == false or saved["enabled"] == 0 then zButtonTrap_EnsureConfig()
if zButtonTrapAdjustment and zButtonTrapAdjustment.SetScript then local saved = zButtonTrap_GetSaved()
zButtonTrapAdjustment:SetScript("OnEvent", nil) if saved["enabled"] == false or saved["enabled"] == 0 then
end if MTH_ZH_TrapAdjust and MTH_ZH_TrapAdjust.SetScript then
if zButtonTrap and zButtonTrap.Hide then MTH_ZH_TrapAdjust:SetScript("OnEvent", nil)
zButtonTrap:Hide() end
end if zButtonTrap and zButtonTrap.Hide then
return zButtonTrap:Hide()
end end
if zButtonTrapAdjustment and zButtonTrapAdjustment.SetScript then return
zButtonTrapAdjustment:SetScript("OnEvent", zButtonTrapAdjustment_OnEvent) end
end if MTH_ZH_TrapAdjust and MTH_ZH_TrapAdjust.SetScript then
local displayCount = zButtonTrap.found or ZHUNTER_TRAP_MAX MTH_ZH_TrapAdjust:SetScript("OnEvent", MTH_ZH_TrapAdjust_OnEvent)
if displayCount < 0 then end
displayCount = 0 local displayCount = zButtonTrap.found or ZHUNTER_TRAP_MAX
end if displayCount < 0 then
ZSpellButton_SetSize(zButtonTrap, saved["parent"]["size"]) displayCount = 0
ZSpellButton_SetSize(zButtonTrap, saved["children"]["size"], 1) end
ZSpellButton_SetExpandDirection(zButtonTrap, saved["firstbutton"]) ZSpellButton_SetSize(zButtonTrap, saved["parent"]["size"])
ZSpellButton_ArrangeChildren(zButtonTrap, saved["rows"], ZSpellButton_SetSize(zButtonTrap, saved["children"]["size"], 1)
displayCount, saved["horizontal"], ZSpellButton_SetExpandDirection(zButtonTrap, saved["firstbutton"])
saved["vertical"]) ZSpellButton_ArrangeChildren(zButtonTrap, saved["rows"],
end displayCount, saved["horizontal"],
saved["vertical"])
function zButtonTrap_Reset() end
local currentRoot = zButtonTrap_GetRoot()
currentRoot["zButtonTrap"] = {} function zButtonTrap_Reset()
local saved = zButtonTrap_GetSaved() local currentRoot = zButtonTrap_GetRoot()
saved["spells"] = {1, 2, 3, 4} currentRoot["zButtonTrap"] = {}
saved["rows"] = 1 local saved = zButtonTrap_GetSaved()
saved["horizontal"] = nil saved["spells"] = {1, 2, 3, 4}
saved["vertical"] = nil saved["rows"] = 1
saved["firstbutton"] = "RIGHT" saved["horizontal"] = nil
saved["enabled"] = 1 saved["vertical"] = nil
saved["tooltip"] = 1 saved["firstbutton"] = "RIGHT"
saved["parent"] = {} saved["enabled"] = 1
saved["parent"]["size"] = 36 saved["tooltip"] = 1
saved["parent"]["hide"] = nil saved["parent"] = {}
saved["parent"]["circle"] = 1 saved["parent"]["size"] = 36
saved["children"] = {} saved["parent"]["hide"] = nil
saved["children"]["size"] = 36 saved["parent"]["circle"] = 1
saved["children"]["hideonclick"] = 1 saved["children"] = {}
saved["visible"] = {1, 1, 1, 1} saved["children"]["size"] = 36
zButtonTrap_EnsureConfig() saved["children"]["hideonclick"] = 1
end saved["visible"] = {1, 1, 1, 1}
zButtonTrap_EnsureConfig()
function zButtonTrapAdjustment_OnEvent() end
if not zButtonTrap or not zButtonTrap.count then
return function MTH_ZH_TrapAdjust_OnEvent()
end if not zButtonTrap or not zButtonTrap.count then
local rebuild = false return
if event == "SPELLS_CHANGED" or event == "CHARACTER_POINTS_CHANGED" then end
zButtonTrap_CreateButtons() local rebuild = false
zButtonTrap_SetupSizeAndPosition() if event == "SPELLS_CHANGED" or event == "CHARACTER_POINTS_CHANGED" then
rebuild = true zButtonTrap_CreateButtons()
end zButtonTrap_SetupSizeAndPosition()
local nextbutton rebuild = true
local button end
local combat = event == "PLAYER_REGEN_DISABLED" local nextbutton
for i=1, zButtonTrap.count do local button
button = getglobal(zButtonTrap.name..i) local combat = event == "PLAYER_REGEN_DISABLED"
button.customcolor = nil for i=1, zButtonTrap.count do
if button.id then button = getglobal(zButtonTrap.name..i)
if not nextbutton then button.customcolor = nil
nextbutton = button if button.id then
end if not nextbutton then
if combat then nextbutton = button
button.icontexture:SetVertexColor(0.4, 0.4, 0.4) end
button.customcolor = 1 if combat then
else button.icontexture:SetVertexColor(0.4, 0.4, 0.4)
button.icontexture:SetVertexColor(1.0, 1.0, 1.0) button.customcolor = 1
end else
end button.icontexture:SetVertexColor(1.0, 1.0, 1.0)
end end
local newParentId = nextbutton and nextbutton.id or zButtonTrap1.id end
if (not rebuild) and zButtonTrap_LastParentId == newParentId and zButtonTrap_LastCombatState == combat and not GameTooltip:IsOwned(zButtonTrap) then end
return local newParentId = nextbutton and nextbutton.id or zButtonTrap1.id
end if (not rebuild) and zButtonTrap_LastParentId == newParentId and zButtonTrap_LastCombatState == combat and not GameTooltip:IsOwned(zButtonTrap) then
zButtonTrap_LastParentId = newParentId return
zButtonTrap_LastCombatState = combat end
zButtonTrap.id = newParentId zButtonTrap_LastParentId = newParentId
ZSpellButton_UpdateButton(zButtonTrap) zButtonTrap_LastCombatState = combat
ZSpellButton_UpdateCooldown(zButtonTrap) zButtonTrap.id = newParentId
if GameTooltip:IsOwned(zButtonTrap) then ZSpellButton_UpdateButton(zButtonTrap)
ZSpellButtonParent_OnEnter(zButtonTrap) ZSpellButton_UpdateCooldown(zButtonTrap)
end if GameTooltip:IsOwned(zButtonTrap) then
end ZSpellButtonParent_OnEnter(zButtonTrap)
end
function zButtonTrap_KeyBinding(index) end
if MTH_ZH_IsModuleEnabled and not MTH_ZH_IsModuleEnabled() then
return function zButtonTrap_KeyBinding(index)
end if MTH_ZH_IsModuleEnabled and not MTH_ZH_IsModuleEnabled() then
return
local button end
if index then
button = getglobal("zButtonTrap"..index) local button
else if index then
button = zButtonTrap button = getglobal("zButtonTrap"..index)
end else
if button.id then button = zButtonTrap
CastSpell(button.id, "spell") end
if zButtonTrap.hideonclick then if button.id then
if type(ZSpellButton_SetChildrenExpanded) == "function" then CastSpell(button.id, "spell")
ZSpellButton_SetChildrenExpanded(zButtonTrap, false) if zButtonTrap.hideonclick then
elseif zButtonTrap.children then if type(ZSpellButton_SetChildrenExpanded) == "function" then
zButtonTrap.children:Hide() ZSpellButton_SetChildrenExpanded(zButtonTrap, false)
end elseif zButtonTrap.children then
end zButtonTrap.children:Hide()
end end
end end
end
SLASH_zButtonTrap1 = "/ZTrap" end
SlashCmdList["zButtonTrap"] = function(msg)
if MTH_ZH_HandleDisabledSlash and MTH_ZH_HandleDisabledSlash("Trap button is disabled while module 'zhunter' is disabled.") then SLASH_zButtonTrap1 = "/ZTrap"
return SlashCmdList["zButtonTrap"] = function(msg)
end if MTH_ZH_HandleDisabledSlash and MTH_ZH_HandleDisabledSlash("Trap button is disabled while module 'zhunter' is disabled.") then
if msg == "reset" then return
zButtonTrap_Reset() end
zButtonTrap:ClearAllPoints() if msg == "reset" then
zButtonTrap:SetPoint("CENTER", UIParent, "CENTER", 60, 0) zButtonTrap_Reset()
elseif msg == "options" then zButtonTrap:ClearAllPoints()
MTH_OpenOptions("Trap") zButtonTrap:SetPoint("CENTER", UIParent, "CENTER", 60, 0)
else elseif msg == "options" then
MTH_ZH_Print("Possible Commands: \"options\", \"reset\"") MTH_OpenOptions("Trap")
end else
MTH_ZH_Print("Possible Commands: \"options\", \"reset\"")
end
end end