mirror of
https://codeberg.org/Duvelcorp/MetaHunt.git
synced 2026-09-27 01:56:04 +00:00
v1.2.0
This commit is contained in:
+3
-3
@@ -98,7 +98,7 @@ local function AntiDaze_CancelRelevantAspect(isSelfDazed)
|
||||
|
||||
AntiDazeTooltip:SetOwner(UIParent, "ANCHOR_NONE")
|
||||
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
|
||||
CancelPlayerBuff(i)
|
||||
return 1
|
||||
@@ -112,8 +112,8 @@ local function AntiDaze_HandleSlash()
|
||||
AntiDaze_SetEnabled(not AntiDaze_IsEnabled())
|
||||
end
|
||||
|
||||
AntiDazeTooltip = CreateFrame("GameTooltip", "AntiDazeTooltip", nil, "GameTooltipTemplate")
|
||||
AntiDazeFrame = CreateFrame("Frame", "AntiDazeFrame")
|
||||
AntiDazeTooltip = CreateFrame("GameTooltip", "MTH_AntiDazeProbe", nil, "GameTooltipTemplate")
|
||||
AntiDazeFrame = CreateFrame("Frame", "MTH_AntiDazeEvent")
|
||||
if AntiDazeFrame then
|
||||
AntiDazeFrame:RegisterEvent("VARIABLES_LOADED")
|
||||
AntiDazeFrame:SetScript("OnEvent", function()
|
||||
|
||||
+2
-2
@@ -112,7 +112,7 @@ end
|
||||
|
||||
local function AutoStrip_QueueDeferredRestore(reason)
|
||||
if not AutoStrip_RestoreFrame then
|
||||
AutoStrip_RestoreFrame = CreateFrame("Frame", "AutoStripRestoreFrame")
|
||||
AutoStrip_RestoreFrame = CreateFrame("Frame", "MTH_AutoStripRestore")
|
||||
if not AutoStrip_RestoreFrame then
|
||||
return
|
||||
end
|
||||
@@ -316,7 +316,7 @@ local function AutoStrip_HandleSlash(msg)
|
||||
end
|
||||
end
|
||||
|
||||
AutoStrip_Frame = CreateFrame("Frame", "AutoStripFrame")
|
||||
AutoStrip_Frame = CreateFrame("Frame", "MTH_AutoStripEvent")
|
||||
if AutoStrip_Frame then
|
||||
AutoStrip_Frame:RegisterEvent("VARIABLES_LOADED")
|
||||
AutoStrip_Frame:RegisterEvent("PLAYER_REGEN_DISABLED")
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
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 = {
|
||||
BOWS = "Bows",
|
||||
|
||||
@@ -460,6 +460,7 @@ local function MTH_FEED_CoreTrackerOnEvent()
|
||||
end
|
||||
elseif evt == "BAG_UPDATE" then
|
||||
MTH_FEED_IndexBagFoods()
|
||||
MTH_FEED_InvalidateDietMapCache()
|
||||
elseif evt == "CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS" then
|
||||
if MTH_FEED_ActiveCoreAttemptId and MTH_FEED_HasPetFeedBuff() then
|
||||
MTH_FEED_Trace("Core tracker buff event confirms acceptance")
|
||||
@@ -468,7 +469,32 @@ local function MTH_FEED_CoreTrackerOnEvent()
|
||||
end
|
||||
end
|
||||
|
||||
local MTH_FEED_CoreTrackerUpdateElapsed = 0
|
||||
local MTH_FEED_LastStaleCleanupAt = 0
|
||||
|
||||
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
|
||||
if attemptId == nil then
|
||||
return
|
||||
@@ -499,7 +525,7 @@ local function MTH_FEED_EnsureTrackerFrame()
|
||||
if MTH_FEED_TrackerFrame then
|
||||
return MTH_FEED_TrackerFrame
|
||||
end
|
||||
local frame = CreateFrame("Frame", "MTH_FeedTrackingFrame")
|
||||
local frame = CreateFrame("Frame", "MTH_FeedTracking")
|
||||
if not frame then
|
||||
return nil
|
||||
end
|
||||
@@ -617,19 +643,17 @@ local function MTH_FEED_EnsureBootstrapFrame()
|
||||
if MTH_FEED_BootstrapFrame ~= nil then
|
||||
return MTH_FEED_BootstrapFrame
|
||||
end
|
||||
local frame = CreateFrame("Frame", "MTH_FeedTrackingBootstrapFrame")
|
||||
local frame = CreateFrame("Frame", "MTH_FeedTrackingBoot")
|
||||
if not frame then
|
||||
return nil
|
||||
end
|
||||
frame:RegisterEvent("VARIABLES_LOADED")
|
||||
frame:RegisterEvent("PLAYER_LOGIN")
|
||||
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
frame:SetScript("OnEvent", function(self)
|
||||
frame:SetScript("OnEvent", function()
|
||||
MTH_FEED_ReinstallCoreTracking()
|
||||
if self and self.UnregisterAllEvents then
|
||||
self:UnregisterAllEvents()
|
||||
self:SetScript("OnEvent", nil)
|
||||
end
|
||||
this:UnregisterAllEvents()
|
||||
this:SetScript("OnEvent", nil)
|
||||
end)
|
||||
MTH_FEED_BootstrapFrame = frame
|
||||
return frame
|
||||
@@ -826,7 +850,16 @@ local function MTH_FEED_NormalizeReason(reason, rawMessage)
|
||||
return "unknown"
|
||||
end
|
||||
|
||||
local MTH_FEED_DietMapCache = nil
|
||||
|
||||
local function MTH_FEED_InvalidateDietMapCache()
|
||||
MTH_FEED_DietMapCache = nil
|
||||
end
|
||||
|
||||
local function MTH_FEED_GetDietByItemIdMap()
|
||||
if MTH_FEED_DietMapCache then
|
||||
return MTH_FEED_DietMapCache
|
||||
end
|
||||
local map = {}
|
||||
if type(FOM_Foods) ~= "table" then
|
||||
return map
|
||||
@@ -841,6 +874,7 @@ local function MTH_FEED_GetDietByItemIdMap()
|
||||
end
|
||||
end
|
||||
end
|
||||
MTH_FEED_DietMapCache = map
|
||||
return map
|
||||
end
|
||||
|
||||
|
||||
+70
-37
@@ -1,5 +1,5 @@
|
||||
MTH = MTH or {
|
||||
version = "1.1.0",
|
||||
version = "1.2.0",
|
||||
name = "MetaHunt",
|
||||
modules = {},
|
||||
config = {},
|
||||
@@ -44,7 +44,7 @@ local function MTH_ClassGateEnsureAnnounceFrame(self)
|
||||
if not self or self._classGateAnnounceFrame then
|
||||
return
|
||||
end
|
||||
local frame = CreateFrame("Frame", "MTH_ClassGateAnnounceFrame")
|
||||
local frame = CreateFrame("Frame", "MTH_ClassGateAnnounce")
|
||||
if not frame then
|
||||
return
|
||||
end
|
||||
@@ -55,12 +55,12 @@ local function MTH_ClassGateEnsureAnnounceFrame(self)
|
||||
end
|
||||
end)
|
||||
frame._mthElapsed = 0
|
||||
frame:SetScript("OnUpdate", function(self, elapsed)
|
||||
self._mthElapsed = (self._mthElapsed or 0) + (elapsed or arg1 or 0)
|
||||
if self._mthElapsed < 0.5 then
|
||||
frame:SetScript("OnUpdate", function()
|
||||
this._mthElapsed = (this._mthElapsed or 0) + (arg1 or 0)
|
||||
if this._mthElapsed < 0.5 then
|
||||
return
|
||||
end
|
||||
self._mthElapsed = 0
|
||||
this._mthElapsed = 0
|
||||
if MTH and MTH._classGateAnnouncedChat then
|
||||
MTH_ClassGateClearAnnounceFrame(MTH)
|
||||
return
|
||||
@@ -192,21 +192,19 @@ end
|
||||
MTH:ApplyClassGate("startup")
|
||||
|
||||
if not MTH._classGateLifecycleFrame then
|
||||
local classGateFrame = CreateFrame("Frame", "MTH_ClassGateLifecycleFrame")
|
||||
local classGateFrame = CreateFrame("Frame", "MTH_ClassGateLifecycle")
|
||||
if classGateFrame then
|
||||
classGateFrame:RegisterEvent("PLAYER_LOGIN")
|
||||
classGateFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
classGateFrame:SetScript("OnEvent", function(self, eventName)
|
||||
self = self or this
|
||||
eventName = eventName or event
|
||||
if MTH and eventName == "PLAYER_LOGIN" then
|
||||
classGateFrame:SetScript("OnEvent", function()
|
||||
if MTH and event == "PLAYER_LOGIN" then
|
||||
MTH._classGateAnnouncedChat = nil
|
||||
MTH._classGateAnnounced = nil
|
||||
MTH._classGateAnnouncePending = nil
|
||||
end
|
||||
if MTH and MTH.ApplyClassGate and MTH:ApplyClassGate(eventName) and MTH._classGateAnnouncedChat then
|
||||
self:UnregisterAllEvents()
|
||||
self:SetScript("OnEvent", nil)
|
||||
if MTH and MTH.ApplyClassGate and MTH:ApplyClassGate(event) and MTH._classGateAnnouncedChat then
|
||||
this:UnregisterAllEvents()
|
||||
this:SetScript("OnEvent", nil)
|
||||
end
|
||||
end)
|
||||
MTH._classGateLifecycleFrame = classGateFrame
|
||||
@@ -565,10 +563,10 @@ function MTH:InitEventRouter()
|
||||
return self._eventRouter.frame
|
||||
end
|
||||
|
||||
local frame = CreateFrame("Frame", "MTH_EventRouterFrame")
|
||||
frame:SetScript("OnEvent", function(self, evt, a1, a2, a3, a4, a5, a6, a7, a8, a9)
|
||||
local frame = CreateFrame("Frame", "MTH_EventRouter")
|
||||
frame:SetScript("OnEvent", function()
|
||||
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)
|
||||
|
||||
@@ -628,7 +626,7 @@ function MTH:_SetModuleEventSubscriptions(name, enabled)
|
||||
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
|
||||
if module.enabled and module.onEvent then
|
||||
local allow = true
|
||||
@@ -637,11 +635,10 @@ function MTH:DispatchEvent(evt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8,
|
||||
end
|
||||
if allow then
|
||||
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)
|
||||
if not ok then
|
||||
self:Print("Module '" .. name .. "' event error on '" .. tostring(evt) .. "': " .. tostring(err))
|
||||
MTH:Print("[MTH] Module event error (" .. name .. ", " .. tostring(evt) .. "): " .. tostring(err), "error")
|
||||
MTH:Print("Module '" .. name .. "' event error on '" .. tostring(evt) .. "': " .. tostring(err), "error")
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1295,24 +1292,22 @@ function MTH:EnsureModuleStateBootstrap()
|
||||
return self._moduleStateBootstrapFrame
|
||||
end
|
||||
|
||||
local frame = CreateFrame("Frame", "MTH_ModuleStateBootstrapFrame")
|
||||
local frame = CreateFrame("Frame", "MTH_ModuleBootstrap")
|
||||
if not frame then
|
||||
return nil
|
||||
end
|
||||
|
||||
frame:RegisterEvent("VARIABLES_LOADED")
|
||||
frame:SetScript("OnEvent", function(self, eventName)
|
||||
self = self or this
|
||||
eventName = eventName or event
|
||||
if eventName ~= "VARIABLES_LOADED" then
|
||||
frame:SetScript("OnEvent", function()
|
||||
if event ~= "VARIABLES_LOADED" then
|
||||
return
|
||||
end
|
||||
if MTH and MTH.ApplyPersistedModuleStates then
|
||||
MTH:ApplyPersistedModuleStates("VARIABLES_LOADED")
|
||||
end
|
||||
if not self then return end
|
||||
self:UnregisterAllEvents()
|
||||
self:SetScript("OnEvent", nil)
|
||||
if not this then return end
|
||||
this:UnregisterAllEvents()
|
||||
this:SetScript("OnEvent", nil)
|
||||
end)
|
||||
|
||||
self._moduleStateBootstrapFrame = frame
|
||||
@@ -1490,6 +1485,46 @@ function MTH:AnnounceLoadComplete()
|
||||
"Addon synced. Your threat meter just sent a stress signal.",
|
||||
"Loaded cleanly. Reputation with healers currently in freefall.",
|
||||
"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
|
||||
@@ -1520,24 +1555,22 @@ function MTH:EnsureLoadCompleteAnnouncement()
|
||||
return self._loadCompleteFrame
|
||||
end
|
||||
|
||||
local frame = CreateFrame("Frame", "MTH_LoadCompleteAnnounceFrame")
|
||||
local frame = CreateFrame("Frame", "MTH_LoadAnnounce")
|
||||
if not frame then
|
||||
return nil
|
||||
end
|
||||
|
||||
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
frame:SetScript("OnEvent", function(self, eventName)
|
||||
self = self or this
|
||||
eventName = eventName or event
|
||||
if eventName ~= "PLAYER_ENTERING_WORLD" then
|
||||
frame:SetScript("OnEvent", function()
|
||||
if event ~= "PLAYER_ENTERING_WORLD" then
|
||||
return
|
||||
end
|
||||
if MTH and MTH.AnnounceLoadComplete then
|
||||
MTH:AnnounceLoadComplete()
|
||||
end
|
||||
if not self then return end
|
||||
self:UnregisterAllEvents()
|
||||
self:SetScript("OnEvent", nil)
|
||||
if not this then return end
|
||||
this:UnregisterAllEvents()
|
||||
this:SetScript("OnEvent", nil)
|
||||
end)
|
||||
|
||||
self._loadCompleteFrame = frame
|
||||
|
||||
@@ -802,7 +802,7 @@ function MTH_PT_InitService()
|
||||
if MTH_PetTrainingFrame then
|
||||
return
|
||||
end
|
||||
MTH_PetTrainingFrame = CreateFrame("Frame", "MTHPetTrainingScanFrame")
|
||||
MTH_PetTrainingFrame = CreateFrame("Frame", "MTH_PetTrainingScan")
|
||||
MTH_PetTrainingFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
MTH_PetTrainingFrame:RegisterEvent("LEARNED_SPELL_IN_TAB")
|
||||
MTH_PetTrainingFrame:RegisterEvent("PET_TRAINING_SHOW")
|
||||
@@ -813,9 +813,8 @@ function MTH_PT_InitService()
|
||||
MTH_PetTrainingFrame:RegisterEvent("CRAFT_SHOW")
|
||||
MTH_PetTrainingFrame:RegisterEvent("CRAFT_UPDATE")
|
||||
MTH_PetTrainingFrame:SetScript("OnEvent", MTH_PT_OnEvent)
|
||||
MTH_PetTrainingFrame:SetScript("OnUpdate", function(_, elapsed)
|
||||
elapsed = elapsed or arg1
|
||||
MTH_PT_PetBookPollElapsed = (MTH_PT_PetBookPollElapsed or 0) + (elapsed or 0)
|
||||
MTH_PetTrainingFrame:SetScript("OnUpdate", function()
|
||||
MTH_PT_PetBookPollElapsed = (MTH_PT_PetBookPollElapsed or 0) + (arg1 or 0)
|
||||
if MTH_PT_PetBookPollElapsed < 0.20 then
|
||||
return
|
||||
end
|
||||
@@ -861,19 +860,16 @@ function MTH_PT_InitBootstrap()
|
||||
end
|
||||
frame:RegisterEvent("PET_TRAINING_SHOW")
|
||||
frame:RegisterEvent("CRAFT_SHOW")
|
||||
frame:SetScript("OnEvent", function(self, evt)
|
||||
evt = evt or event
|
||||
if evt ~= "PET_TRAINING_SHOW" and evt ~= "CRAFT_SHOW" then
|
||||
frame:SetScript("OnEvent", function()
|
||||
if event ~= "PET_TRAINING_SHOW" and event ~= "CRAFT_SHOW" then
|
||||
return
|
||||
end
|
||||
MTH_PT_InitService()
|
||||
if type(MTH_PT_OnEvent) == "function" then
|
||||
MTH_PT_OnEvent(MTH_PetTrainingFrame, evt)
|
||||
end
|
||||
if self and self.UnregisterAllEvents then
|
||||
self:UnregisterAllEvents()
|
||||
self:SetScript("OnEvent", nil)
|
||||
MTH_PT_OnEvent(MTH_PetTrainingFrame, event)
|
||||
end
|
||||
this:UnregisterAllEvents()
|
||||
this:SetScript("OnEvent", nil)
|
||||
MTH_PT_BootstrapFrame = nil
|
||||
end)
|
||||
MTH_PT_BootstrapFrame = frame
|
||||
|
||||
@@ -331,7 +331,7 @@ function MTH_PS_InitService()
|
||||
return
|
||||
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("UNIT_PET")
|
||||
MTH_PS_Frame:RegisterEvent("PET_BAR_UPDATE")
|
||||
|
||||
@@ -179,7 +179,7 @@ local function MTH_ST_EnsureDiagCopyFrame()
|
||||
if MTH_ST_DiagCopyFrame then
|
||||
return MTH_ST_DiagCopyFrame
|
||||
end
|
||||
local frame = CreateFrame("Frame", "MTHStableDiagCopyFrame", UIParent)
|
||||
local frame = CreateFrame("Frame", "MTH_StableDiagCopy", UIParent)
|
||||
if not frame then
|
||||
return nil
|
||||
end
|
||||
@@ -219,11 +219,11 @@ local function MTH_ST_EnsureDiagCopyFrame()
|
||||
copyButton:SetHeight(24)
|
||||
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("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -36, 44)
|
||||
|
||||
local editBox = CreateFrame("EditBox", "MTHStableDiagCopyText", scrollFrame)
|
||||
local editBox = CreateFrame("EditBox", "MTH_StableDiagText", scrollFrame)
|
||||
editBox:SetMultiLine(true)
|
||||
editBox:SetMaxLetters(999999)
|
||||
editBox:SetFont("Fonts\\FRIZQT__.TTF", 11, "")
|
||||
@@ -255,13 +255,13 @@ local function MTH_ST_EnsureDiagCopyFrame()
|
||||
if UISpecialFrames then
|
||||
local exists = false
|
||||
for i = 1, table.getn(UISpecialFrames) do
|
||||
if UISpecialFrames[i] == "MTHStableDiagCopyFrame" then
|
||||
if UISpecialFrames[i] == "MTH_StableDiagCopy" then
|
||||
exists = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not exists then
|
||||
table.insert(UISpecialFrames, "MTHStableDiagCopyFrame")
|
||||
table.insert(UISpecialFrames, "MTH_StableDiagCopy")
|
||||
end
|
||||
end
|
||||
return frame
|
||||
@@ -2494,15 +2494,6 @@ function MTH_PETS_GetRootStore()
|
||||
end
|
||||
|
||||
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
|
||||
pets.petTraining = {}
|
||||
end
|
||||
@@ -2519,14 +2510,53 @@ function MTH_PETS_GetRootStore()
|
||||
MTH_PETS_EnsureSchema(pets)
|
||||
MTH_PETS_EnsurePetTrainingCompatibility(pets)
|
||||
|
||||
MTH_CharSavedVariables.petTraining = pets.petTraining
|
||||
MTH_CharSavedVariables.trainScan = pets.trainScan
|
||||
MTH_CharSavedVariables.stableScan = pets.stableScan
|
||||
MTH_CharSavedVariables.petStore = pets.petStore
|
||||
-- Migration: remove root-level duplicates that bloated SavedVariables
|
||||
if pets._migrationCleanup ~= 2 then
|
||||
MTH_PETS_RunSavedVarCleanup(pets)
|
||||
pets._migrationCleanup = 2
|
||||
end
|
||||
|
||||
return pets
|
||||
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()
|
||||
local pets = type(MTH_PETS_GetRootStore) == "function" and MTH_PETS_GetRootStore() or nil
|
||||
if type(pets) ~= "table" then
|
||||
@@ -2624,15 +2654,17 @@ function MTH_PETS_RefreshCurrentPet()
|
||||
row.events = {}
|
||||
end
|
||||
|
||||
local eventType = "pet-updated"
|
||||
if created and (not hadPetBeforeRefresh) then
|
||||
eventType = "pet-acquired"
|
||||
local eventType = "pet-acquired"
|
||||
if not (created and (not hadPetBeforeRefresh)) then
|
||||
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
|
||||
|
||||
local shouldRecordLifecycleEvent = (eventType == "pet-acquired")
|
||||
or (cp.id ~= nil and previousCurrentId ~= nil and cp.id ~= previousCurrentId)
|
||||
local eventContext = nil
|
||||
if shouldRecordLifecycleEvent then
|
||||
if eventType then
|
||||
eventContext = MTH_PETS_CaptureContext()
|
||||
table.insert(row.events, {
|
||||
type = eventType,
|
||||
@@ -3167,7 +3199,7 @@ end
|
||||
|
||||
local function MTH_ST_QueueDeferredStableScan(reason, delaySeconds)
|
||||
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
|
||||
MTH_ST_TraceRecord("MTH_ST_QueueDeferredStableScan", "scan", "frame-create-failed")
|
||||
return false
|
||||
@@ -3270,9 +3302,8 @@ local function MTH_PETS_HandleUnitPetTransition(source)
|
||||
row.events = {}
|
||||
end
|
||||
local eventType = (not hadPet) and "pet-acquired" or "pet-updated"
|
||||
if eventType == "pet-updated" and source == "UNIT_PET" and MTH_ST_IsStableFrameOpen() then
|
||||
MTH_ST_PrintStableDiag("swap history-skip reason=stable-open")
|
||||
else
|
||||
-- Only record lifecycle events (acquire, rename, abandon), not routine updates
|
||||
if eventType ~= "pet-updated" then
|
||||
table.insert(row.events, {
|
||||
type = eventType,
|
||||
source = source or transitionSource,
|
||||
@@ -4120,7 +4151,7 @@ function MTH_ST_InitService()
|
||||
return
|
||||
end
|
||||
|
||||
MTH_PetLifecycleEventFrame = CreateFrame("Frame", "MTHPetLifecycleEventFrame")
|
||||
MTH_PetLifecycleEventFrame = CreateFrame("Frame", "MTH_PetLifecycleEvent")
|
||||
MTH_PetLifecycleEventFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
MTH_PetLifecycleEventFrame:RegisterEvent("UNIT_PET")
|
||||
MTH_PetLifecycleEventFrame:RegisterEvent("PET_BAR_UPDATE")
|
||||
@@ -4153,29 +4184,26 @@ function MTH_ST_InitBootstrap()
|
||||
return
|
||||
end
|
||||
|
||||
local frame = CreateFrame("Frame", "MTHPetLifecycleBootstrapFrame")
|
||||
local frame = CreateFrame("Frame", "MTH_PetLifecycleBoot")
|
||||
if not frame then
|
||||
return
|
||||
end
|
||||
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
frame:RegisterEvent("PET_STABLE_SHOW")
|
||||
frame:RegisterEvent("PET_STABLE_UPDATE")
|
||||
frame:SetScript("OnEvent", function(self, evt)
|
||||
evt = evt or event
|
||||
if evt ~= "PLAYER_ENTERING_WORLD" and evt ~= "PET_STABLE_SHOW" and evt ~= "PET_STABLE_UPDATE" then
|
||||
frame:SetScript("OnEvent", function()
|
||||
if event ~= "PLAYER_ENTERING_WORLD" and event ~= "PET_STABLE_SHOW" and event ~= "PET_STABLE_UPDATE" then
|
||||
return
|
||||
end
|
||||
if evt == "PET_STABLE_SHOW" or evt == "PET_STABLE_UPDATE" then
|
||||
MTH_ST_PrintStableDiag("bootstrap evt=" .. tostring(evt) .. " phase=begin")
|
||||
if event == "PET_STABLE_SHOW" or event == "PET_STABLE_UPDATE" then
|
||||
MTH_ST_PrintStableDiag("bootstrap evt=" .. tostring(event) .. " phase=begin")
|
||||
end
|
||||
MTH_ST_InitService()
|
||||
if evt == "PET_STABLE_SHOW" or evt == "PET_STABLE_UPDATE" then
|
||||
MTH_ST_PrintStableDiag("bootstrap evt=" .. tostring(evt) .. " phase=end action=no-scan")
|
||||
end
|
||||
if self and self.UnregisterAllEvents then
|
||||
self:UnregisterAllEvents()
|
||||
self:SetScript("OnEvent", nil)
|
||||
if event == "PET_STABLE_SHOW" or event == "PET_STABLE_UPDATE" then
|
||||
MTH_ST_PrintStableDiag("bootstrap evt=" .. tostring(event) .. " phase=end action=no-scan")
|
||||
end
|
||||
this:UnregisterAllEvents()
|
||||
this:SetScript("OnEvent", nil)
|
||||
MTH_PetLifecycleBootstrapFrame = nil
|
||||
end)
|
||||
MTH_PetLifecycleBootstrapFrame = frame
|
||||
|
||||
+57
-9
@@ -12,7 +12,7 @@ local function MTH_PT_GetGlobal(name)
|
||||
return nil
|
||||
end
|
||||
|
||||
local MTH_ItemLinkCacheTooltip = nil
|
||||
local MTH_ItemLinkCache = nil
|
||||
|
||||
local function MTH_GetQualityHexColor(quality)
|
||||
local q = tonumber(quality)
|
||||
@@ -34,14 +34,14 @@ function MTH_PrimeItemCache(itemId)
|
||||
if not id or id <= 0 then return false end
|
||||
if type(GetItemInfo) == "function" and GetItemInfo(id) then return true end
|
||||
|
||||
if not MTH_ItemLinkCacheTooltip then
|
||||
MTH_ItemLinkCacheTooltip = CreateFrame("GameTooltip", "MTH_ItemLinkCacheTooltip", UIParent, "GameTooltipTemplate")
|
||||
if not MTH_ItemLinkCacheTooltip then return false end
|
||||
MTH_ItemLinkCacheTooltip:SetOwner(UIParent, "ANCHOR_NONE")
|
||||
if not MTH_ItemLinkCache then
|
||||
MTH_ItemLinkCache = CreateFrame("GameTooltip", "MTH_ItemLinkCache", UIParent, "GameTooltipTemplate")
|
||||
if not MTH_ItemLinkCache then return false end
|
||||
MTH_ItemLinkCache:SetOwner(UIParent, "ANCHOR_NONE")
|
||||
end
|
||||
|
||||
MTH_ItemLinkCacheTooltip:ClearLines()
|
||||
MTH_ItemLinkCacheTooltip:SetHyperlink("item:" .. tostring(id) .. ":0:0:0")
|
||||
MTH_ItemLinkCache:ClearLines()
|
||||
MTH_ItemLinkCache:SetHyperlink("item:" .. tostring(id) .. ":0:0:0")
|
||||
return type(GetItemInfo) == "function" and (GetItemInfo(id) ~= nil) or false
|
||||
end
|
||||
|
||||
@@ -301,6 +301,46 @@ if type(MTH_CommandPetSpellScan) ~= "function" then
|
||||
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)
|
||||
if MTH and MTH.ApplyClassGate and MTH:ApplyClassGate("slash") then
|
||||
return
|
||||
@@ -312,16 +352,24 @@ function SlashCmdList.MTH(msg, editbox)
|
||||
local lowerMsg = string.lower(msg)
|
||||
local _, _, lowerCmd, lowerArg = string.find(lowerMsg, "^(%S+)%s*(.-)%s*$")
|
||||
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
|
||||
MTH_CommandOptions()
|
||||
elseif lowerMsg == "book" or lowerMsg == "hunterbook" then
|
||||
MTH_CommandBook()
|
||||
elseif lowerMsg == "peers" or lowerMsg == "who" then
|
||||
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
|
||||
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
|
||||
|
||||
|
||||
+6
-6
@@ -29,7 +29,7 @@ function MTH_DebugFrame:Initialize()
|
||||
self.initialized = true
|
||||
|
||||
-- Create main frame
|
||||
self.frame = CreateFrame("Frame", "MTH_DebugFrameWindow", UIParent)
|
||||
self.frame = CreateFrame("Frame", "MTH_DebugWindow", UIParent)
|
||||
self.frame:SetWidth(800)
|
||||
self.frame:SetHeight(400)
|
||||
self.frame:SetPoint("CENTER", UIParent, "CENTER")
|
||||
@@ -51,13 +51,13 @@ function MTH_DebugFrame:Initialize()
|
||||
if UISpecialFrames then
|
||||
local already = false
|
||||
for i = 1, table.getn(UISpecialFrames) do
|
||||
if UISpecialFrames[i] == "MTH_DebugFrameWindow" then
|
||||
if UISpecialFrames[i] == "MTH_DebugWindow" then
|
||||
already = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not already then
|
||||
table.insert(UISpecialFrames, "MTH_DebugFrameWindow")
|
||||
table.insert(UISpecialFrames, "MTH_DebugWindow")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -91,7 +91,7 @@ function MTH_DebugFrame:Initialize()
|
||||
copyButton:SetScript("OnClick", function() MTH_DebugFrame:SelectAllText() end)
|
||||
|
||||
-- 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("BOTTOMRIGHT", self.frame, "BOTTOMRIGHT", -35, 45)
|
||||
|
||||
@@ -366,8 +366,8 @@ MTH_DebugFrame.UninstallHooks = MTH_DF_UninstallHooks
|
||||
-- Event listener for addon load
|
||||
local eventFrame = CreateFrame("Frame")
|
||||
eventFrame:RegisterEvent("ADDON_LOADED")
|
||||
eventFrame:SetScript("OnEvent", function(self, event, addonName)
|
||||
if event == "ADDON_LOADED" and addonName == "MetaHunt" then
|
||||
eventFrame:SetScript("OnEvent", function()
|
||||
if event == "ADDON_LOADED" and arg1 == "MetaHunt" then
|
||||
if MTH and MTH.GetConfig then
|
||||
MTH_DF_SetGlobalCaptureEnabled(MTH:GetConfig("debug", "globalErrorCapture", false))
|
||||
end
|
||||
|
||||
@@ -140,7 +140,7 @@ function MTH_BOOK_GetResistanceShortName(nameText)
|
||||
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, "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
|
||||
return tostring(nameText or "-")
|
||||
end
|
||||
|
||||
+18
-18
@@ -5066,19 +5066,19 @@ local function MTH_BOOK_WireUI(frame)
|
||||
listSlider:SetScript("OnMouseDown", function()
|
||||
MTH_BOOK_STATE.sliderDragging = true
|
||||
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)
|
||||
listSlider:SetScript("OnMouseUp", function()
|
||||
MTH_BOOK_SetSliderFromCursor(this)
|
||||
MTH_BOOK_STATE.sliderDragging = false
|
||||
end)
|
||||
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
|
||||
this:SetScript("OnUpdate", nil)
|
||||
end)
|
||||
listSlider:SetScript("OnValueChanged", function()
|
||||
local value = this:GetValue()
|
||||
@@ -5181,19 +5181,19 @@ local function MTH_BOOK_WireUI(frame)
|
||||
sliderBackdrop:SetScript("OnMouseDown", function()
|
||||
MTH_BOOK_STATE.sliderDragging = true
|
||||
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)
|
||||
sliderBackdrop:SetScript("OnMouseUp", function()
|
||||
MTH_BOOK_SetSliderFromCursor(listSlider)
|
||||
MTH_BOOK_STATE.sliderDragging = false
|
||||
end)
|
||||
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
|
||||
listSlider:SetScript("OnUpdate", nil)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,7 +9,6 @@ local MTH_LOCALE_ALIASES = {
|
||||
enGB = "enUS",
|
||||
esMX = "esES",
|
||||
zhTW = "zhCN",
|
||||
frFR = "enUS",
|
||||
}
|
||||
|
||||
local MTH_SUPPORTED_LOCALES = {
|
||||
|
||||
+1
-1
@@ -1244,7 +1244,7 @@ function MTH_Map:Init()
|
||||
self.nodesByZone = self.nodesByZone or {}
|
||||
|
||||
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("ZONE_CHANGED")
|
||||
self.controller:RegisterEvent("ZONE_CHANGED_NEW_AREA")
|
||||
|
||||
+29
-26
@@ -1,5 +1,13 @@
|
||||
------------------------------------------------------
|
||||
-- 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
|
||||
@@ -84,7 +92,9 @@ function MTH_MinimapButton:Initialize()
|
||||
return
|
||||
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
|
||||
return
|
||||
end
|
||||
@@ -114,10 +124,9 @@ function MTH_MinimapButton:Initialize()
|
||||
highlight:SetHeight(31)
|
||||
highlight:SetPoint("CENTER", button, "CENTER", 0, 0)
|
||||
|
||||
button:SetScript("OnEnter", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
GameTooltip:SetOwner(self, "ANCHOR_LEFT")
|
||||
button:SetScript("OnEnter", function()
|
||||
if not this then return end
|
||||
GameTooltip:SetOwner(this, "ANCHOR_LEFT")
|
||||
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_RIGHT_CLICK", "Right-Click: Open MetaHunt Options"), 1, 1, 1)
|
||||
@@ -129,25 +138,23 @@ function MTH_MinimapButton:Initialize()
|
||||
GameTooltip:Hide()
|
||||
end)
|
||||
|
||||
button:SetScript("OnDragStart", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
self.dragging = 1
|
||||
self:SetScript("OnUpdate", function()
|
||||
button:SetScript("OnDragStart", function()
|
||||
if not this then return end
|
||||
this.dragging = 1
|
||||
this:SetScript("OnUpdate", function()
|
||||
MTH_MB_UpdateDragPosition()
|
||||
end)
|
||||
end)
|
||||
|
||||
button:SetScript("OnDragStop", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
self.dragging = nil
|
||||
self:SetScript("OnUpdate", nil)
|
||||
button:SetScript("OnDragStop", function()
|
||||
if not this then return end
|
||||
this.dragging = nil
|
||||
this:SetScript("OnUpdate", nil)
|
||||
MTH_MB_UpdateDragPosition()
|
||||
end)
|
||||
|
||||
button:SetScript("OnClick", function(_, mouseButton)
|
||||
mouseButton = mouseButton or arg1
|
||||
button:SetScript("OnClick", function()
|
||||
local mouseButton = arg1
|
||||
if mouseButton == "RightButton" then
|
||||
if type(MTH_OpenOptions) == "function" then
|
||||
MTH_OpenOptions("General")
|
||||
@@ -167,16 +174,12 @@ function MTH_MinimapButton:Initialize()
|
||||
MTH_MB_UpdatePosition()
|
||||
end
|
||||
|
||||
local loader = CreateFrame("Frame", "MTH_MinimapButtonLoader")
|
||||
local loader = CreateFrame("Frame", "MTH_MinimapLoader")
|
||||
loader:RegisterEvent("ADDON_LOADED")
|
||||
loader:SetScript("OnEvent", function(self, eventName, addonName)
|
||||
eventName = eventName or event
|
||||
addonName = addonName or arg1
|
||||
if eventName == "ADDON_LOADED" and addonName == "MetaHunt" then
|
||||
loader:SetScript("OnEvent", function()
|
||||
if event == "ADDON_LOADED" and arg1 == "MetaHunt" then
|
||||
MTH_MinimapButton:Initialize()
|
||||
if self and self.UnregisterAllEvents then
|
||||
self:UnregisterAllEvents()
|
||||
self:SetScript("OnEvent", nil)
|
||||
end
|
||||
this:UnregisterAllEvents()
|
||||
this:SetScript("OnEvent", nil)
|
||||
end
|
||||
end)
|
||||
|
||||
+30
-40
@@ -657,28 +657,25 @@ local function MTH_AB_CreateRow(container, subtype, index, xBase, yOffset)
|
||||
row.suffix:SetText("Stacks")
|
||||
|
||||
if row.check then
|
||||
row.check:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self or MTH_AB_STATE.syncing then return end
|
||||
row.check:SetScript("OnClick", function()
|
||||
if not this or MTH_AB_STATE.syncing then return end
|
||||
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()
|
||||
end)
|
||||
end
|
||||
|
||||
row.qty:SetScript("OnEnterPressed", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
row.qty:SetScript("OnEnterPressed", function()
|
||||
if not this then return end
|
||||
local store = MTH_AB_EnsureConfig()
|
||||
MTH_AB_SetRuleStacks(store, subtype, index, self:GetText())
|
||||
MTH_AB_SetRuleStacks(store, subtype, index, this:GetText())
|
||||
MTH_AB_RefreshOptionsUI()
|
||||
self:ClearFocus()
|
||||
this:ClearFocus()
|
||||
end)
|
||||
row.qty:SetScript("OnEditFocusLost", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
row.qty:SetScript("OnEditFocusLost", function()
|
||||
if not this then return end
|
||||
local store = MTH_AB_EnsureConfig()
|
||||
MTH_AB_SetRuleStacks(store, subtype, index, self:GetText())
|
||||
MTH_AB_SetRuleStacks(store, subtype, index, this:GetText())
|
||||
MTH_AB_RefreshOptionsUI()
|
||||
end)
|
||||
|
||||
@@ -715,11 +712,10 @@ local function MTH_AB_BuildUI(container)
|
||||
|
||||
controls.moduleEnabled = MTH_CreateCheckbox(container, "MetaHuntOptionsAutoBuyModuleEnabled", "Enable Auto Buy module", -30)
|
||||
if controls.moduleEnabled then
|
||||
controls.moduleEnabled:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self or MTH_AB_STATE.syncing then return end
|
||||
controls.moduleEnabled:SetScript("OnClick", function()
|
||||
if not this or MTH_AB_STATE.syncing then return end
|
||||
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
|
||||
MTH:Print("Failed to change Auto Buy state: " .. tostring(err), "error")
|
||||
end
|
||||
@@ -730,11 +726,10 @@ local function MTH_AB_BuildUI(container)
|
||||
|
||||
controls.projectilesEnabled = MTH_CreateCheckbox(container, "MetaHuntOptionsAutoBuyProjectilesEnabled", "Enable for Projectiles", -74)
|
||||
if controls.projectilesEnabled then
|
||||
controls.projectilesEnabled:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self or MTH_AB_STATE.syncing then return end
|
||||
controls.projectilesEnabled:SetScript("OnClick", function()
|
||||
if not this or MTH_AB_STATE.syncing then return end
|
||||
local store = MTH_AB_EnsureConfig()
|
||||
store.projectiles.enabled = MTH_AB_IsChecked(self)
|
||||
store.projectiles.enabled = MTH_AB_IsChecked(this)
|
||||
MTH_AB_RefreshOptionsUI()
|
||||
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)
|
||||
if controls.petFoodEnabled then
|
||||
controls.petFoodEnabled:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self or MTH_AB_STATE.syncing then return end
|
||||
controls.petFoodEnabled:SetScript("OnClick", function()
|
||||
if not this or MTH_AB_STATE.syncing then return end
|
||||
local store = MTH_AB_EnsureConfig()
|
||||
store.petFood.enabled = MTH_AB_IsChecked(self)
|
||||
store.petFood.enabled = MTH_AB_IsChecked(this)
|
||||
MTH_AB_RefreshOptionsUI()
|
||||
end)
|
||||
end
|
||||
@@ -791,19 +785,17 @@ local function MTH_AB_BuildUI(container)
|
||||
controls.petFoodQty:SetHeight(20)
|
||||
controls.petFoodQty:SetNumeric(true)
|
||||
controls.petFoodQty:SetAutoFocus(false)
|
||||
controls.petFoodQty:SetScript("OnEnterPressed", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
controls.petFoodQty:SetScript("OnEnterPressed", function()
|
||||
if not this then return end
|
||||
local store = MTH_AB_EnsureConfig()
|
||||
MTH_AB_SetPetFoodStacks(store, self:GetText())
|
||||
MTH_AB_SetPetFoodStacks(store, this:GetText())
|
||||
MTH_AB_RefreshOptionsUI()
|
||||
self:ClearFocus()
|
||||
this:ClearFocus()
|
||||
end)
|
||||
controls.petFoodQty:SetScript("OnEditFocusLost", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
controls.petFoodQty:SetScript("OnEditFocusLost", function()
|
||||
if not this then return end
|
||||
local store = MTH_AB_EnsureConfig()
|
||||
MTH_AB_SetPetFoodStacks(store, self:GetText())
|
||||
MTH_AB_SetPetFoodStacks(store, this:GetText())
|
||||
MTH_AB_RefreshOptionsUI()
|
||||
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)
|
||||
if controls.petFoodScopeCurrent then
|
||||
controls.petFoodScopeCurrent:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self or MTH_AB_STATE.syncing then return end
|
||||
controls.petFoodScopeCurrent:SetScript("OnClick", function()
|
||||
if not this or MTH_AB_STATE.syncing then return end
|
||||
local store = MTH_AB_EnsureConfig()
|
||||
store.petFood.scope = "current"
|
||||
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)
|
||||
if controls.petFoodScopeAll then
|
||||
controls.petFoodScopeAll:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self or MTH_AB_STATE.syncing then return end
|
||||
controls.petFoodScopeAll:SetScript("OnClick", function()
|
||||
if not this or MTH_AB_STATE.syncing then return end
|
||||
local store = MTH_AB_EnsureConfig()
|
||||
store.petFood.scope = "all"
|
||||
MTH_AB_RefreshOptionsUI()
|
||||
|
||||
+10
-14
@@ -72,10 +72,9 @@ function MTH_SetupAutoQuestOptions()
|
||||
local moduleToggle = MTH_CreateCheckbox(container, "MetaHuntOptionsAutoQuestModuleToggle", "Enable Auto Quest module", -70, 20)
|
||||
if moduleToggle then
|
||||
moduleToggle:SetChecked(moduleEnabled and true or false)
|
||||
moduleToggle:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
local enabled = MTH_AQ_IsChecked(self)
|
||||
moduleToggle:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
local enabled = MTH_AQ_IsChecked(this)
|
||||
if MTH and MTH.SetModuleEnabled then
|
||||
local ok, err = MTH:SetModuleEnabled("autoquest", enabled)
|
||||
if not ok and MTH and MTH.Print then
|
||||
@@ -84,7 +83,7 @@ function MTH_SetupAutoQuestOptions()
|
||||
end
|
||||
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
|
||||
self:SetChecked(actual and true or false)
|
||||
this:SetChecked(actual and true or false)
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -151,9 +150,8 @@ function MTH_SetupAutoQuestOptions()
|
||||
store.scorpokDrazial and true or false
|
||||
)
|
||||
if scorpokToggle then
|
||||
scorpokToggle:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
local enabled = MTH_AQ_IsChecked(self)
|
||||
scorpokToggle:SetScript("OnClick", function()
|
||||
local enabled = MTH_AQ_IsChecked(this)
|
||||
store.scorpokDrazial = enabled and true or false
|
||||
if MTH and MTH.GetModuleCharSavedVariables then
|
||||
local moduleStore = MTH:GetModuleCharSavedVariables("autoquest")
|
||||
@@ -176,9 +174,8 @@ function MTH_SetupAutoQuestOptions()
|
||||
store.scorpokTooltip and true or false
|
||||
)
|
||||
if tooltipToggle then
|
||||
tooltipToggle:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
local enabled = MTH_AQ_IsChecked(self)
|
||||
tooltipToggle:SetScript("OnClick", function()
|
||||
local enabled = MTH_AQ_IsChecked(this)
|
||||
store.scorpokTooltip = enabled and true or false
|
||||
if MTH and MTH.GetModuleCharSavedVariables then
|
||||
local moduleStore = MTH:GetModuleCharSavedVariables("autoquest")
|
||||
@@ -212,9 +209,8 @@ function MTH_SetupAutoQuestOptions()
|
||||
store.arrowsForSissies and true or false
|
||||
)
|
||||
if sissiesToggle then
|
||||
sissiesToggle:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
local enabled = MTH_AQ_IsChecked(self)
|
||||
sissiesToggle:SetScript("OnClick", function()
|
||||
local enabled = MTH_AQ_IsChecked(this)
|
||||
store.arrowsForSissies = enabled and true or false
|
||||
if MTH and MTH.GetModuleCharSavedVariables then
|
||||
local moduleStore = MTH:GetModuleCharSavedVariables("autoquest")
|
||||
|
||||
+29
-38
@@ -326,13 +326,12 @@ local function MTH_CHRON_MakeInput(parent, name, x, y, width, height, value, onA
|
||||
edit:SetHeight(height or 20)
|
||||
edit:SetAutoFocus(false)
|
||||
edit:SetText(tostring(value or ""))
|
||||
edit:SetScript("OnEnterPressed", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
edit:SetScript("OnEnterPressed", function()
|
||||
if not this then return end
|
||||
if type(onAccept) == "function" then
|
||||
onAccept(self:GetText() or "")
|
||||
onAccept(this:GetText() or "")
|
||||
end
|
||||
self:ClearFocus()
|
||||
this:ClearFocus()
|
||||
end)
|
||||
return edit
|
||||
end
|
||||
@@ -385,16 +384,15 @@ local function MTH_CHRON_RenderTimerSection(container, profile, title, items, bu
|
||||
local check = MTH_CreateCheckbox(container, controlName, label, timerY, timerX)
|
||||
if check then
|
||||
check:SetChecked(profile.disabledSpells[bucket][timerName] == nil and true or false)
|
||||
check:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
check:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
local currentlyDisabled = profile.disabledSpells[bucket][timerName] ~= nil
|
||||
if currentlyDisabled then
|
||||
profile.disabledSpells[bucket][timerName] = nil
|
||||
self:SetChecked(true)
|
||||
this:SetChecked(true)
|
||||
else
|
||||
profile.disabledSpells[bucket][timerName] = {}
|
||||
self:SetChecked(nil)
|
||||
this:SetChecked(nil)
|
||||
end
|
||||
|
||||
MTH_CHRON_ApplyLiveProfile(profile)
|
||||
@@ -470,10 +468,9 @@ function MTH_SetupChronometerOptions(tabKey)
|
||||
if moduleCheck then
|
||||
local module = MTH and MTH:GetModule("chronometer")
|
||||
moduleCheck:SetChecked(module and module.enabled and true or false)
|
||||
moduleCheck:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
local enabled = MTH_CHRON_IsChecked(self)
|
||||
moduleCheck:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
local enabled = MTH_CHRON_IsChecked(this)
|
||||
if MTH and MTH.SetModuleEnabled then
|
||||
MTH:SetModuleEnabled("chronometer", enabled)
|
||||
end
|
||||
@@ -495,40 +492,36 @@ function MTH_SetupChronometerOptions(tabKey)
|
||||
local killCheck = MTH_CreateCheckbox(container, "MetaHuntOptionsChronometerFadeOnKill", "Fade on kill", -154)
|
||||
if killCheck then
|
||||
killCheck:SetChecked(profile.fadeonkill and true or false)
|
||||
killCheck:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
profile.fadeonkill = MTH_CHRON_IsChecked(self)
|
||||
killCheck:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
profile.fadeonkill = MTH_CHRON_IsChecked(this)
|
||||
end)
|
||||
end
|
||||
|
||||
local fadeCheck = MTH_CreateCheckbox(container, "MetaHuntOptionsChronometerFadeOnFade", "Fade on aura fade", -179)
|
||||
if fadeCheck then
|
||||
fadeCheck:SetChecked(profile.fadeonfade and true or false)
|
||||
fadeCheck:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
profile.fadeonfade = MTH_CHRON_IsChecked(self)
|
||||
fadeCheck:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
profile.fadeonfade = MTH_CHRON_IsChecked(this)
|
||||
end)
|
||||
end
|
||||
|
||||
local selfCheck = MTH_CreateCheckbox(container, "MetaHuntOptionsChronometerSelfBars", "Show self bars", -204)
|
||||
if selfCheck then
|
||||
selfCheck:SetChecked(profile.selfbars and true or false)
|
||||
selfCheck:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
profile.selfbars = MTH_CHRON_IsChecked(self)
|
||||
selfCheck:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
profile.selfbars = MTH_CHRON_IsChecked(this)
|
||||
end)
|
||||
end
|
||||
|
||||
local onlySelfCheck = MTH_CreateCheckbox(container, "MetaHuntOptionsChronometerOnlySelf", "Only self target", -229)
|
||||
if onlySelfCheck then
|
||||
onlySelfCheck:SetChecked(profile.onlyself and true or false)
|
||||
onlySelfCheck:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
profile.onlyself = MTH_CHRON_IsChecked(self)
|
||||
onlySelfCheck:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
profile.onlyself = MTH_CHRON_IsChecked(this)
|
||||
end)
|
||||
end
|
||||
elseif section == "bar" then
|
||||
@@ -610,10 +603,9 @@ function MTH_SetupChronometerOptions(tabKey)
|
||||
local growCheck = MTH_CreateCheckbox(container, "MetaHuntOptionsChronometerGrowUp", "Grow bars upward", -438)
|
||||
if growCheck then
|
||||
growCheck:SetChecked(profile.growup and true or false)
|
||||
growCheck:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
profile.growup = MTH_CHRON_IsChecked(self)
|
||||
growCheck:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
profile.growup = MTH_CHRON_IsChecked(this)
|
||||
MTH_CHRON_ApplyLiveProfile(profile)
|
||||
end)
|
||||
end
|
||||
@@ -621,10 +613,9 @@ function MTH_SetupChronometerOptions(tabKey)
|
||||
local reverseCheck = MTH_CreateCheckbox(container, "MetaHuntOptionsChronometerReverse", "Reverse bars", -463)
|
||||
if reverseCheck then
|
||||
reverseCheck:SetChecked(profile.reverse and true or false)
|
||||
reverseCheck:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
profile.reverse = MTH_CHRON_IsChecked(self)
|
||||
reverseCheck:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
profile.reverse = MTH_CHRON_IsChecked(this)
|
||||
MTH_CHRON_ApplyLiveProfile(profile)
|
||||
end)
|
||||
end
|
||||
|
||||
+18
-20
@@ -226,10 +226,9 @@ function MTH_SetupFeedOMaticOptions()
|
||||
|
||||
local moduleCheck = MTH_CreateCheckbox(container, "MetaHuntOptionsFeedOMaticEnabled", MTH_FOM_L("FOM_ENABLE_MODULE", "Enable FeedOMatic module"), -32 + yAdjust)
|
||||
if moduleCheck then
|
||||
moduleCheck:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
local enabled = self:GetChecked() == 1
|
||||
moduleCheck:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
local enabled = this:GetChecked() == 1
|
||||
if MTH and MTH.SetModuleEnabled then
|
||||
local ok, err = MTH:SetModuleEnabled("feedomatic", enabled)
|
||||
if not ok and MTH and MTH.Print then
|
||||
@@ -263,11 +262,11 @@ function MTH_SetupFeedOMaticOptions()
|
||||
MTH_FOM_StartBindingCapture()
|
||||
end
|
||||
end)
|
||||
bindButton:SetScript("OnKeyDown", function(_, key)
|
||||
bindButton:SetScript("OnKeyDown", function()
|
||||
if not MTH_FOM_STATE.bindingCapture then
|
||||
return
|
||||
end
|
||||
key = key or arg1
|
||||
local key = arg1
|
||||
if not key or key == "" then
|
||||
return
|
||||
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.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.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.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.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.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() 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() 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() if not this then return end FOM_Config.Fallback = this:GetChecked() == 1 end) end
|
||||
|
||||
local keepOpenLabel = container:CreateFontString("MetaHuntOptionsFOMKeepOpenLabel", "ARTWORK", "GameFontNormalSmall")
|
||||
keepOpenLabel:SetPoint("TOPLEFT", container, "TOPLEFT", 20, -302 + yAdjust)
|
||||
@@ -320,14 +319,13 @@ function MTH_SetupFeedOMaticOptions()
|
||||
keepOpen:SetHeight(20)
|
||||
keepOpen:SetNumeric(true)
|
||||
keepOpen:SetAutoFocus(false)
|
||||
keepOpen:SetScript("OnTextChanged", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
local value = tonumber(self:GetText()) or 0
|
||||
keepOpen:SetScript("OnTextChanged", function()
|
||||
if not this then return end
|
||||
local value = tonumber(this:GetText()) or 0
|
||||
FOM_Config.KeepOpenSlots = value
|
||||
end)
|
||||
keepOpen:SetScript("OnEnterPressed", function(self) self = self or this if self then self:ClearFocus() end end)
|
||||
keepOpen:SetScript("OnEscapePressed", 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() if this then this:ClearFocus() end end)
|
||||
MTH_FOM_STATE.keepOpenEdit = keepOpen
|
||||
|
||||
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.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)
|
||||
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.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.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.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.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() 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() 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() if not this then return end FOM_Config.IconWarning = this:GetChecked() == 1 end) end
|
||||
|
||||
local cookHeader = container:CreateFontString("MetaHuntOptionsFOMCookingHeader", "ARTWORK", "GameFontHighlight")
|
||||
cookHeader:SetPoint("TOPLEFT", container, "TOPLEFT", rightColumnX, -62 + yAdjust)
|
||||
|
||||
+24
-32
@@ -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)
|
||||
if moduleEnabled then
|
||||
moduleEnabled:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
moduleEnabled:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
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
|
||||
MTH:Print("Failed to change ICU module state: " .. tostring(err), "error")
|
||||
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)
|
||||
if mouseOver then
|
||||
mouseOver:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
mouseOver:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
local store = MTH_ICU_GetStore()
|
||||
store.mouseOver = self:GetChecked() == 1 and true or false
|
||||
store.mouseOver = this:GetChecked() == 1 and true or false
|
||||
end)
|
||||
MTH_ICU_OPT_STATE.controls.mouseOver = mouseOver
|
||||
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)
|
||||
if expandUp then
|
||||
expandUp:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
expandUp:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
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
|
||||
ICU_SetPoints()
|
||||
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)
|
||||
if showGuild then
|
||||
showGuild:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
showGuild:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
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)
|
||||
MTH_ICU_OPT_STATE.controls.showGuildName = showGuild
|
||||
end
|
||||
|
||||
local showClass = MTH_CreateCheckbox(container, "MetaHuntOptionsICUShowClass", "Show player class", -368, MTH_ICU_LAYOUT.LEFT_X)
|
||||
if showClass then
|
||||
showClass:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
showClass:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
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)
|
||||
MTH_ICU_OPT_STATE.controls.showPlayerClass = showClass
|
||||
end
|
||||
|
||||
local showRace = MTH_CreateCheckbox(container, "MetaHuntOptionsICUShowRace", "Show player race", -392, MTH_ICU_LAYOUT.LEFT_X)
|
||||
if showRace then
|
||||
showRace:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
showRace:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
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)
|
||||
MTH_ICU_OPT_STATE.controls.showPlayerRace = showRace
|
||||
end
|
||||
|
||||
local showTitles = MTH_CreateCheckbox(container, "MetaHuntOptionsICUShowTitles", "Show custom titles in alerts", -416, MTH_ICU_LAYOUT.LEFT_X)
|
||||
if showTitles then
|
||||
showTitles:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
showTitles:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
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)
|
||||
MTH_ICU_OPT_STATE.controls.showCustomTitles = showTitles
|
||||
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)
|
||||
if reactionOnlyPvp then
|
||||
reactionOnlyPvp:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
reactionOnlyPvp:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
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)
|
||||
MTH_ICU_OPT_STATE.controls.reactionOnlyPvp = reactionOnlyPvp
|
||||
end
|
||||
|
||||
+148
-110
@@ -195,15 +195,15 @@ local function MTH_EnsureAmmoOptionsWatcher()
|
||||
if MTH_AmmoOptionsWatcher then
|
||||
return
|
||||
end
|
||||
MTH_AmmoOptionsWatcher = CreateFrame("Frame", "MTHAmmoOptionsWatcherFrame")
|
||||
MTH_AmmoOptionsWatcher = CreateFrame("Frame", "MTH_AmmoOptionsWatcher")
|
||||
if not MTH_AmmoOptionsWatcher then
|
||||
return
|
||||
end
|
||||
MTH_AmmoOptionsWatcher:RegisterEvent("UNIT_INVENTORY_CHANGED")
|
||||
MTH_AmmoOptionsWatcher:RegisterEvent("BAG_UPDATE")
|
||||
MTH_AmmoOptionsWatcher:SetScript("OnEvent", function(_, eventName, unit)
|
||||
eventName = eventName or event
|
||||
unit = unit or arg1
|
||||
MTH_AmmoOptionsWatcher:SetScript("OnEvent", function()
|
||||
local eventName = event
|
||||
local unit = arg1
|
||||
if eventName == "UNIT_INVENTORY_CHANGED" and unit and unit ~= "player" then
|
||||
return
|
||||
end
|
||||
@@ -247,6 +247,16 @@ local function MTH_ZB_EnsureButtonOptionDefaults(buttonName)
|
||||
end
|
||||
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
|
||||
saved["parent"] = {}
|
||||
end
|
||||
@@ -333,16 +343,15 @@ local function MTH_SetupButtonOptions(containerName, buttonName, displayName, ma
|
||||
enableButton:SetChecked(enabledValue and true or false)
|
||||
enableButton.buttonName = buttonName
|
||||
enableButton.buttonObj = buttonObj
|
||||
enableButton:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
local checked = MTH_ZB_IsChecked(self)
|
||||
MTH_SetButtonEnabledState(self.buttonName, self.buttonObj, checked)
|
||||
enableButton:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
local checked = MTH_ZB_IsChecked(this)
|
||||
MTH_SetButtonEnabledState(this.buttonName, this.buttonObj, checked)
|
||||
end)
|
||||
end
|
||||
|
||||
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 childrenYOffset = -18
|
||||
@@ -392,16 +401,15 @@ local function MTH_SetupButtonOptions(containerName, buttonName, displayName, ma
|
||||
expandLeft:SetChecked(saved["firstbutton"] == "LEFT")
|
||||
expandLeft.buttonName = buttonName
|
||||
expandLeft.buttonObj = buttonObj
|
||||
expandLeft:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
local checked = MTH_ZB_IsChecked(self)
|
||||
local btnName = self.buttonName
|
||||
expandLeft: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
|
||||
ZHunterMod_Saved[btnName]["firstbutton"] = checked and "LEFT" or "RIGHT"
|
||||
ZHunterMod_Saved[btnName]["horizontal"] = 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
|
||||
childrenYOffset = childrenYOffset - 30
|
||||
@@ -414,17 +422,64 @@ local function MTH_SetupButtonOptions(containerName, buttonName, displayName, ma
|
||||
if hideClick.buttonObj then
|
||||
hideClick.buttonObj.hideonclick = saved["children"]["hideonclick"] and true or false
|
||||
end
|
||||
hideClick:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
local checked = MTH_ZB_IsChecked(self)
|
||||
ZHunterMod_Saved[self.buttonName]["children"]["hideonclick"] = checked
|
||||
local btnObj = self.buttonObj or getglobal(self.buttonName)
|
||||
hideClick:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
local checked = MTH_ZB_IsChecked(this)
|
||||
ZHunterMod_Saved[this.buttonName]["children"]["hideonclick"] = checked
|
||||
local btnObj = this.buttonObj or getglobal(this.buttonName)
|
||||
if btnObj then btnObj.hideonclick = checked end
|
||||
end)
|
||||
end
|
||||
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)
|
||||
if showTooltip then
|
||||
showTooltip:SetChecked(saved["tooltip"])
|
||||
@@ -433,12 +488,11 @@ local function MTH_SetupButtonOptions(containerName, buttonName, displayName, ma
|
||||
if showTooltip.buttonObj then
|
||||
showTooltip.buttonObj.tooltip = saved["tooltip"] and true or false
|
||||
end
|
||||
showTooltip:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
local checked = MTH_ZB_IsChecked(self)
|
||||
ZHunterMod_Saved[self.buttonName]["tooltip"] = checked
|
||||
local btnObj = self.buttonObj or getglobal(self.buttonName)
|
||||
showTooltip:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
local checked = MTH_ZB_IsChecked(this)
|
||||
ZHunterMod_Saved[this.buttonName]["tooltip"] = checked
|
||||
local btnObj = this.buttonObj or getglobal(this.buttonName)
|
||||
if btnObj then btnObj.tooltip = checked end
|
||||
end)
|
||||
end
|
||||
@@ -451,13 +505,12 @@ local function MTH_SetupButtonOptions(containerName, buttonName, displayName, ma
|
||||
showAmmoName.buttonName = buttonName
|
||||
showAmmoName.buttonObj = buttonObj
|
||||
showAmmoName.maxButtons = maxButtons
|
||||
showAmmoName:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
local checked = MTH_ZB_IsChecked(self)
|
||||
local btnName = self.buttonName
|
||||
showAmmoName:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
local checked = MTH_ZB_IsChecked(this)
|
||||
local btnName = this.buttonName
|
||||
ZHunterMod_Saved[btnName]["showammoname"] = checked
|
||||
local btnObj = self.buttonObj or getglobal(btnName)
|
||||
local btnObj = this.buttonObj or getglobal(btnName)
|
||||
if btnObj then
|
||||
for i = 1, (btnObj.count or 0) do
|
||||
local child = getglobal(btnName..i)
|
||||
@@ -506,13 +559,12 @@ local function MTH_SetupButtonOptions(containerName, buttonName, displayName, ma
|
||||
hideButton:SetChecked(saved["parent"]["hide"])
|
||||
hideButton.buttonName = buttonName
|
||||
hideButton.buttonObj = buttonObj
|
||||
hideButton:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
local checked = self:GetChecked() == 1
|
||||
ZHunterMod_Saved[self.buttonName]["parent"]["hide"] = checked
|
||||
if self.buttonObj then
|
||||
if checked then self.buttonObj:Hide() else self.buttonObj:Show() end
|
||||
hideButton:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
local checked = this:GetChecked() == 1
|
||||
ZHunterMod_Saved[this.buttonName]["parent"]["hide"] = checked
|
||||
if this.buttonObj then
|
||||
if checked then this.buttonObj:Hide() else this.buttonObj:Show() end
|
||||
end
|
||||
end)
|
||||
end
|
||||
@@ -523,13 +575,12 @@ local function MTH_SetupButtonOptions(containerName, buttonName, displayName, ma
|
||||
useCircle:SetChecked(saved["parent"]["circle"])
|
||||
useCircle.buttonName = buttonName
|
||||
useCircle.buttonObj = buttonObj
|
||||
useCircle:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
local checked = self:GetChecked() == 1
|
||||
ZHunterMod_Saved[self.buttonName]["parent"]["circle"] = checked
|
||||
if self.buttonObj and self.buttonObj.circle then
|
||||
if checked then self.buttonObj.circle:Show() else self.buttonObj.circle:Hide() end
|
||||
useCircle:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
local checked = this:GetChecked() == 1
|
||||
ZHunterMod_Saved[this.buttonName]["parent"]["circle"] = checked
|
||||
if this.buttonObj and this.buttonObj.circle then
|
||||
if checked then this.buttonObj.circle:Show() else this.buttonObj.circle:Hide() end
|
||||
end
|
||||
end)
|
||||
end
|
||||
@@ -587,17 +638,16 @@ local function MTH_SetupButtonOptions(containerName, buttonName, displayName, ma
|
||||
showText:SetText("")
|
||||
end
|
||||
showToggle:SetChecked(ZHunterMod_Saved[buttonName]["visible"][showToggle.spellIndex] ~= false)
|
||||
showToggle:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
local checked = self:GetChecked() == 1
|
||||
local btnName = self.buttonName
|
||||
local visibleIndex = self.spellIndex
|
||||
showToggle:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
local checked = this:GetChecked() == 1
|
||||
local btnName = this.buttonName
|
||||
local visibleIndex = this.spellIndex
|
||||
if not ZHunterMod_Saved[btnName]["visible"] then
|
||||
ZHunterMod_Saved[btnName]["visible"] = {}
|
||||
end
|
||||
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
|
||||
|
||||
@@ -612,18 +662,17 @@ local function MTH_SetupButtonOptions(containerName, buttonName, displayName, ma
|
||||
downBtn.buttonObj = buttonObj
|
||||
downBtn.itemList = itemList
|
||||
downBtn.maxButtons = maxButtons
|
||||
downBtn:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
local idx = self.spellIndex
|
||||
local btnName = self.buttonName
|
||||
local contName = self.containerName
|
||||
local maxBtns = self.maxButtons
|
||||
downBtn:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
local idx = this.spellIndex
|
||||
local btnName = this.buttonName
|
||||
local contName = this.containerName
|
||||
local maxBtns = this.maxButtons
|
||||
if idx < maxBtns then
|
||||
local temp = ZHunterMod_Saved[btnName]["spells"][idx+1]
|
||||
ZHunterMod_Saved[btnName]["spells"][idx+1] = ZHunterMod_Saved[btnName]["spells"][idx]
|
||||
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", "")
|
||||
MTH_ZB_RefreshTab(tabName)
|
||||
end
|
||||
@@ -640,17 +689,16 @@ local function MTH_SetupButtonOptions(containerName, buttonName, displayName, ma
|
||||
upBtn.buttonObj = buttonObj
|
||||
upBtn.itemList = itemList
|
||||
upBtn.maxButtons = maxButtons
|
||||
upBtn:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
local idx = self.spellIndex
|
||||
local btnName = self.buttonName
|
||||
local contName = self.containerName
|
||||
upBtn:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
local idx = this.spellIndex
|
||||
local btnName = this.buttonName
|
||||
local contName = this.containerName
|
||||
if idx > 1 then
|
||||
local temp = ZHunterMod_Saved[btnName]["spells"][idx-1]
|
||||
ZHunterMod_Saved[btnName]["spells"][idx-1] = ZHunterMod_Saved[btnName]["spells"][idx]
|
||||
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", "")
|
||||
MTH_ZB_RefreshTab(tabName)
|
||||
end
|
||||
@@ -749,11 +797,10 @@ function MTH_SetupSmartAmmoOptions()
|
||||
end
|
||||
if moduleToggle then
|
||||
moduleToggle:SetChecked(moduleEnabled)
|
||||
moduleToggle:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
moduleToggle:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
if MTH and MTH.SetModuleEnabled then
|
||||
MTH:SetModuleEnabled("smartammo", MTH_ZB_IsChecked(self))
|
||||
MTH:SetModuleEnabled("smartammo", MTH_ZB_IsChecked(this))
|
||||
end
|
||||
MTH_SetupSmartAmmoOptions()
|
||||
end)
|
||||
@@ -766,11 +813,10 @@ function MTH_SetupSmartAmmoOptions()
|
||||
if not moduleEnabled then
|
||||
smartToggle:Disable()
|
||||
end
|
||||
smartToggle:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
smartToggle:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
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
|
||||
@@ -785,11 +831,10 @@ function MTH_SetupSmartAmmoOptions()
|
||||
if not moduleEnabled then
|
||||
reloadToggle:Disable()
|
||||
end
|
||||
reloadToggle:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
reloadToggle:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
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
|
||||
@@ -825,11 +870,10 @@ function MTH_SetupMessagesOptions()
|
||||
local initModulesToggle = MTH_CreateCheckbox(section, "MetaHuntMessagesInitModules", "Init : modules loaded", -36)
|
||||
if initModulesToggle then
|
||||
initModulesToggle:SetChecked(msgSettings.initModulesLoaded and true or false)
|
||||
initModulesToggle:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
initModulesToggle:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
if MTH and MTH.SetMessageEnabled then
|
||||
MTH:SetMessageEnabled("initModulesLoaded", MTH_ZB_IsChecked(self))
|
||||
MTH:SetMessageEnabled("initModulesLoaded", MTH_ZB_IsChecked(this))
|
||||
end
|
||||
end)
|
||||
end
|
||||
@@ -837,11 +881,10 @@ function MTH_SetupMessagesOptions()
|
||||
local initWelcomeToggle = MTH_CreateCheckbox(section, "MetaHuntMessagesInitWelcome", "Init : Sarcastic welcome message", -64)
|
||||
if initWelcomeToggle then
|
||||
initWelcomeToggle:SetChecked(msgSettings.initSarcasticWelcome ~= false)
|
||||
initWelcomeToggle:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
initWelcomeToggle:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
if MTH and MTH.SetMessageEnabled then
|
||||
MTH:SetMessageEnabled("initSarcasticWelcome", MTH_ZB_IsChecked(self))
|
||||
MTH:SetMessageEnabled("initSarcasticWelcome", MTH_ZB_IsChecked(this))
|
||||
end
|
||||
end)
|
||||
end
|
||||
@@ -849,11 +892,10 @@ function MTH_SetupMessagesOptions()
|
||||
local petHungryToggle = MTH_CreateCheckbox(section, "MetaHuntMessagesPetHungry", "Pet is hungry (spam)", -92)
|
||||
if petHungryToggle then
|
||||
petHungryToggle:SetChecked(msgSettings.petHungry and true or false)
|
||||
petHungryToggle:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
petHungryToggle:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
if MTH and MTH.SetMessageEnabled then
|
||||
MTH:SetMessageEnabled("petHungry", MTH_ZB_IsChecked(self))
|
||||
MTH:SetMessageEnabled("petHungry", MTH_ZB_IsChecked(this))
|
||||
end
|
||||
end)
|
||||
end
|
||||
@@ -861,11 +903,10 @@ function MTH_SetupMessagesOptions()
|
||||
local beastTrainingScanToggle = MTH_CreateCheckbox(section, "MetaHuntMessagesBeastTrainingScan", "Beasttraining scan", -120)
|
||||
if beastTrainingScanToggle then
|
||||
beastTrainingScanToggle:SetChecked(msgSettings.beastTrainingScan ~= false)
|
||||
beastTrainingScanToggle:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
beastTrainingScanToggle:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
if MTH and MTH.SetMessageEnabled then
|
||||
MTH:SetMessageEnabled("beastTrainingScan", MTH_ZB_IsChecked(self))
|
||||
MTH:SetMessageEnabled("beastTrainingScan", MTH_ZB_IsChecked(this))
|
||||
end
|
||||
end)
|
||||
end
|
||||
@@ -873,11 +914,10 @@ function MTH_SetupMessagesOptions()
|
||||
local spellbookScanToggle = MTH_CreateCheckbox(section, "MetaHuntMessagesSpellbookScan", "Spellbook scan", -148)
|
||||
if spellbookScanToggle then
|
||||
spellbookScanToggle:SetChecked(msgSettings.spellbookScan and true or false)
|
||||
spellbookScanToggle:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
spellbookScanToggle:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
if MTH and MTH.SetMessageEnabled then
|
||||
MTH:SetMessageEnabled("spellbookScan", MTH_ZB_IsChecked(self))
|
||||
MTH:SetMessageEnabled("spellbookScan", MTH_ZB_IsChecked(this))
|
||||
end
|
||||
end)
|
||||
end
|
||||
@@ -885,11 +925,10 @@ function MTH_SetupMessagesOptions()
|
||||
local petRanAwayToggle = MTH_CreateCheckbox(section, "MetaHuntMessagesPetRanAway", "Pet ran away", -176)
|
||||
if petRanAwayToggle then
|
||||
petRanAwayToggle:SetChecked(msgSettings.petRanAway ~= false)
|
||||
petRanAwayToggle:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
petRanAwayToggle:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
if MTH and MTH.SetMessageEnabled then
|
||||
MTH:SetMessageEnabled("petRanAway", MTH_ZB_IsChecked(self))
|
||||
MTH:SetMessageEnabled("petRanAway", MTH_ZB_IsChecked(this))
|
||||
end
|
||||
end)
|
||||
end
|
||||
@@ -897,11 +936,10 @@ function MTH_SetupMessagesOptions()
|
||||
local mapMarkersToggle = MTH_CreateCheckbox(section, "MetaHuntMessagesMapMarkers", "Map markers", -204)
|
||||
if mapMarkersToggle then
|
||||
mapMarkersToggle:SetChecked(msgSettings.mapMarkers ~= false)
|
||||
mapMarkersToggle:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
mapMarkersToggle:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
if MTH and MTH.SetMessageEnabled then
|
||||
MTH:SetMessageEnabled("mapMarkers", MTH_ZB_IsChecked(self))
|
||||
MTH:SetMessageEnabled("mapMarkers", MTH_ZB_IsChecked(this))
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
+3
-3
@@ -68,9 +68,9 @@ function MTH_CreateSlider(parent, name, label, minVal, maxVal, step, yOffset)
|
||||
if lowLabel then lowLabel:Hide() end
|
||||
if highLabel then highLabel:Hide() end
|
||||
|
||||
slider:SetScript("OnValueChanged", function(self, newValue)
|
||||
local activeSlider = self or this or slider
|
||||
local current = tonumber(newValue)
|
||||
slider:SetScript("OnValueChanged", function()
|
||||
local activeSlider = this or this or slider
|
||||
local current = tonumber(arg1)
|
||||
if not current and activeSlider and activeSlider.GetValue then
|
||||
current = tonumber(activeSlider:GetValue())
|
||||
end
|
||||
|
||||
+7
-8
@@ -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:SetChecked(MTH_UI.ResolveValue(option.get, context) and 1 or nil)
|
||||
MTH_UIR_SetCheckboxLabel(checkButton, optionName or "")
|
||||
checkButton:SetScript("OnClick", function(self)
|
||||
self = self or this
|
||||
if not self then return end
|
||||
checkButton:SetScript("OnClick", function()
|
||||
if not this then return end
|
||||
if option.set then
|
||||
option.set(context, self:GetChecked() == 1)
|
||||
option.set(context, this:GetChecked() == 1)
|
||||
end
|
||||
end)
|
||||
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: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("OnLeave", function(self) self = self or this if self then self:SetBackdropBorderColor(0.4, 0.4, 0.4) end end)
|
||||
button:SetScript("OnEnter", function() if this then this:SetBackdropBorderColor(0.6, 0.6, 0.6) end end)
|
||||
button:SetScript("OnLeave", function() if this then this:SetBackdropBorderColor(0.4, 0.4, 0.4) end end)
|
||||
button:SetScript("OnClick", function()
|
||||
if option.func then
|
||||
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: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("OnLeave", function(self) self = self or this if self then self:SetBackdropBorderColor(0.4, 0.4, 0.4) end end)
|
||||
button:SetScript("OnEnter", function() if this then this:SetBackdropBorderColor(0.6, 0.6, 0.6) end end)
|
||||
button:SetScript("OnLeave", function() if this then this:SetBackdropBorderColor(0.4, 0.4, 0.4) end end)
|
||||
button:SetScript("OnClick", function()
|
||||
if option.onClick then
|
||||
option.onClick(context, option)
|
||||
|
||||
@@ -6,6 +6,7 @@ VC.abbrev = "MTH"
|
||||
VC.channelName = "LFT"
|
||||
VC.updateUrl = "https://github.com/DuvelCorp/MetaHunt"
|
||||
VC.nextPublishAt = nil
|
||||
VC.lastPublishedAt = nil
|
||||
VC.joinAt = nil
|
||||
VC.notified = false
|
||||
VC._invalidVersionWarned = false
|
||||
@@ -219,7 +220,11 @@ function VC:GetTrackedPeers()
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
function VC:ShouldPublish()
|
||||
@@ -247,6 +252,7 @@ function VC:TryPublish()
|
||||
end
|
||||
local payload = self.abbrev .. ":" .. tostring(localVersionNumber) .. ":v"
|
||||
SendChatMessage(payload, "CHANNEL", nil, tostring(channelId))
|
||||
self.lastPublishedAt = VC_GetTimeNow()
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -305,7 +311,7 @@ function VC:HandleRemoteMessage(message, author, channelLabel)
|
||||
end
|
||||
|
||||
if not VC.frame then
|
||||
local frame = CreateFrame("Frame", "MTHVersionCheckFrame", UIParent)
|
||||
local frame = CreateFrame("Frame", "MTH_VersionCheck", UIParent)
|
||||
if frame then
|
||||
VC.frame = frame
|
||||
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
|
||||
Reference in New Issue
Block a user