mirror of
https://codeberg.org/Duvelcorp/MetaHunt.git
synced 2026-10-17 13:50:48 +00:00
v1.4.0 Twow 1.18.1
This commit is contained in:
@@ -37,13 +37,6 @@ local function ZHunterMod_RunButtonInit(frame, onEventFunc)
|
||||
event = oldEvent
|
||||
end
|
||||
|
||||
local function ZHunterMod_LogDeferred(msg)
|
||||
local deferredDebug = _G and _G["MTH_ZH_DEFERRED_DEBUG"]
|
||||
if not (MTH and MTH.debug and deferredDebug) then
|
||||
return
|
||||
end
|
||||
MTH_ZH_Print("[ZHUNTER] " .. tostring(msg), "error")
|
||||
end
|
||||
|
||||
local function ZHunterMod_EnsureButtonFrame(buttonName)
|
||||
local frame = getglobal(buttonName)
|
||||
@@ -77,7 +70,6 @@ local function ZHunterMod_EnsureButtonFrame(buttonName)
|
||||
else
|
||||
created:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
|
||||
end
|
||||
ZHunterMod_LogDeferred("DeferredInit: created missing frame " .. tostring(buttonName))
|
||||
end
|
||||
return created
|
||||
end
|
||||
@@ -94,15 +86,6 @@ function ZHunterMod_DeferredInit()
|
||||
local companions = ZHunterMod_EnsureButtonFrame("zButtonCompanions")
|
||||
local toys = ZHunterMod_EnsureButtonFrame("zButtonToys")
|
||||
|
||||
ZHunterMod_LogDeferred("DeferredInit: Pet=" .. tostring(pet ~= nil))
|
||||
ZHunterMod_LogDeferred("DeferredInit: Aspect=" .. tostring(aspect ~= nil))
|
||||
ZHunterMod_LogDeferred("DeferredInit: Track=" .. tostring(track ~= nil))
|
||||
ZHunterMod_LogDeferred("DeferredInit: Trap=" .. tostring(trap ~= nil))
|
||||
ZHunterMod_LogDeferred("DeferredInit: Ranged=" .. tostring(ranged ~= nil))
|
||||
ZHunterMod_LogDeferred("DeferredInit: Ammo=" .. tostring(ammo ~= nil))
|
||||
ZHunterMod_LogDeferred("DeferredInit: Mounts=" .. tostring(mounts ~= nil))
|
||||
ZHunterMod_LogDeferred("DeferredInit: Companions=" .. tostring(companions ~= nil))
|
||||
ZHunterMod_LogDeferred("DeferredInit: Toys=" .. tostring(toys ~= nil))
|
||||
|
||||
-- Continue with all frames that exist; do not hard-abort when one optional frame is missing.
|
||||
local missing = {}
|
||||
@@ -202,7 +185,7 @@ function ZHunterMod_DeferredInit()
|
||||
|
||||
if type(MTH_ZH_OnDeferredInitComplete) == "function" then
|
||||
local ok, err = pcall(MTH_ZH_OnDeferredInitComplete)
|
||||
if not ok and MTH_DebugFrame and MTH_DebugFrame.AddError then
|
||||
if not ok then
|
||||
MTH_ZH_Print("[ZHUNTER] DeferredInit callback error: " .. tostring(err), "error")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -14,7 +14,6 @@ BINDING_HEADER_ZToysHeader = "ZToys Buttons"
|
||||
ZHunterModTooltip = CreateFrame("GameTooltip", "MTH_ZH_AbilityProbe", nil, "GameTooltipTemplate")
|
||||
ZHunterModTooltipTextLeft1 = getglobal("MTH_ZH_AbilityProbeTextLeft1")
|
||||
|
||||
MTH_ZH_TRACE_ENABLED = false
|
||||
|
||||
local function MTH_ZH_DescribePoint(frame)
|
||||
if not (frame and frame.GetPoint) then
|
||||
@@ -33,51 +32,8 @@ local function MTH_ZH_DescribePoint(frame)
|
||||
.. " @(" .. tostring(x) .. "," .. tostring(y) .. ")"
|
||||
end
|
||||
|
||||
function MTH_ZH_Trace(msg)
|
||||
if not MTH_ZH_TRACE_ENABLED then
|
||||
return
|
||||
end
|
||||
if MTH and MTH.Print then
|
||||
MTH:Print("[ZHTRACE] " .. tostring(msg), "debug")
|
||||
elseif DEFAULT_CHAT_FRAME and DEFAULT_CHAT_FRAME.AddMessage then
|
||||
DEFAULT_CHAT_FRAME:AddMessage("[ZHTRACE] " .. tostring(msg))
|
||||
end
|
||||
end
|
||||
|
||||
function MTH_ZH_TraceButtonPoint(frame, reason)
|
||||
if not MTH_ZH_TRACE_ENABLED then
|
||||
return
|
||||
end
|
||||
if not frame then
|
||||
MTH_ZH_Trace("point " .. tostring(reason or "") .. " frame=nil")
|
||||
return
|
||||
end
|
||||
local name = frame.GetName and frame:GetName() or "<unnamed>"
|
||||
MTH_ZH_Trace("point " .. tostring(reason or "") .. " " .. tostring(name) .. " " .. MTH_ZH_DescribePoint(frame))
|
||||
end
|
||||
|
||||
function MTH_ZH_TraceAllButtonPoints(reason)
|
||||
if not MTH_ZH_TRACE_ENABLED then
|
||||
return
|
||||
end
|
||||
local names = {
|
||||
"zButtonAspect",
|
||||
"zButtonAmmo",
|
||||
"zButtonTrack",
|
||||
"zButtonTrap",
|
||||
"zButtonRanged",
|
||||
"zButtonPet",
|
||||
"zButtonMounts",
|
||||
"zButtonCompanions",
|
||||
"zButtonToys",
|
||||
}
|
||||
MTH_ZH_Trace("snapshot begin reason=" .. tostring(reason or ""))
|
||||
for i = 1, table.getn(names) do
|
||||
local frame = getglobal(names[i])
|
||||
MTH_ZH_TraceButtonPoint(frame, tostring(reason or "") .. ":" .. tostring(names[i]))
|
||||
end
|
||||
MTH_ZH_Trace("snapshot end reason=" .. tostring(reason or ""))
|
||||
end
|
||||
|
||||
function MTH_ZH_IsModuleEnabled()
|
||||
if not (MTH and MTH.IsModuleEnabled) then
|
||||
@@ -170,7 +126,6 @@ function MTH_ZH_HandleDisabledSlash(message, tableKey, fieldKey)
|
||||
end
|
||||
|
||||
function ZHunterMod_AlignButtons()
|
||||
MTH_ZH_TraceAllButtonPoints("AlignButtons:before")
|
||||
zButtonAmmo:ClearAllPoints()
|
||||
zButtonAmmo:SetPoint("TOP", zButtonAspect, "BOTTOM", 0, -15)
|
||||
zButtonTrack:ClearAllPoints()
|
||||
@@ -189,7 +144,6 @@ function ZHunterMod_AlignButtons()
|
||||
AutoStripDisplay:ClearAllPoints()
|
||||
AutoStripDisplay:SetPoint("TOP", zButtonToys, "BOTTOM", 0, -10)
|
||||
end
|
||||
MTH_ZH_TraceAllButtonPoints("AlignButtons:after")
|
||||
end
|
||||
|
||||
function ZMarkTarget()
|
||||
|
||||
@@ -536,13 +536,6 @@ local function ZSpellButton_SaveParentPosition(parent)
|
||||
saved["parent"]["relativePoint"] = tostring(relPoint)
|
||||
saved["parent"]["x"] = math.floor(x + 0.5)
|
||||
saved["parent"]["y"] = math.floor(y + 0.5)
|
||||
if type(MTH_ZH_Trace) == "function" then
|
||||
MTH_ZH_Trace("persist-parent-position key=" .. tostring(key)
|
||||
.. " point=" .. tostring(saved["parent"]["point"])
|
||||
.. " rel=" .. tostring(saved["parent"]["relativePoint"])
|
||||
.. " x=" .. tostring(saved["parent"]["x"])
|
||||
.. " y=" .. tostring(saved["parent"]["y"]))
|
||||
end
|
||||
end
|
||||
|
||||
local function ZSpellButton_RestoreParentPosition(parent)
|
||||
@@ -580,13 +573,6 @@ local function ZSpellButton_RestoreParentPosition(parent)
|
||||
|
||||
parent:ClearAllPoints()
|
||||
parent:SetPoint(point, UIParent, relPoint, px, py)
|
||||
if type(MTH_ZH_Trace) == "function" then
|
||||
MTH_ZH_Trace("restore-parent-position key=" .. tostring(key)
|
||||
.. " point=" .. tostring(point)
|
||||
.. " rel=" .. tostring(relPoint)
|
||||
.. " x=" .. tostring(px)
|
||||
.. " y=" .. tostring(py))
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -697,9 +683,6 @@ function ZSpellButtonParent_OnLoad()
|
||||
if this.SetScript then
|
||||
this:SetScript("OnDragStart", function()
|
||||
if IsAltKeyDown() then
|
||||
if type(MTH_ZH_TraceButtonPoint) == "function" then
|
||||
MTH_ZH_TraceButtonPoint(this, "drag-start")
|
||||
end
|
||||
this:StartMoving()
|
||||
this.isMoving = true
|
||||
end
|
||||
@@ -713,9 +696,6 @@ function ZSpellButtonParent_OnLoad()
|
||||
end
|
||||
ZSpellButton_SaveParentPosition(this)
|
||||
this.isMoving = false
|
||||
if type(MTH_ZH_TraceButtonPoint) == "function" then
|
||||
MTH_ZH_TraceButtonPoint(this, "drag-stop")
|
||||
end
|
||||
end)
|
||||
this:SetScript("OnMouseUp", function()
|
||||
if this and this.isMoving then
|
||||
@@ -724,9 +704,6 @@ function ZSpellButtonParent_OnLoad()
|
||||
end
|
||||
ZSpellButton_SaveParentPosition(this)
|
||||
this.isMoving = false
|
||||
if type(MTH_ZH_TraceButtonPoint) == "function" then
|
||||
MTH_ZH_TraceButtonPoint(this, "mouse-up-stop")
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@ MTH_ZH_MANAGED_HOOKS = true
|
||||
local MTH_ZHunter = {
|
||||
name = "zhunter",
|
||||
enabled = true,
|
||||
version = "1.3.0",
|
||||
version = "1.4.0",
|
||||
events = {
|
||||
"VARIABLES_LOADED",
|
||||
-- PLAYER_ENTERING_WORLD handled by bootstrap frame + adjustment frames
|
||||
@@ -24,19 +24,6 @@ local MTH_ZHunter = {
|
||||
}
|
||||
}
|
||||
|
||||
local function MTH_ZH_Log(msg)
|
||||
if not (MTH and MTH.debug) then
|
||||
return
|
||||
end
|
||||
MTH:Print("[ZH MODULE] " .. tostring(msg), "debug")
|
||||
end
|
||||
|
||||
local function MTH_ZH_TraceLocal(msg)
|
||||
if type(MTH_ZH_Trace) == "function" then
|
||||
MTH_ZH_Trace(msg)
|
||||
end
|
||||
end
|
||||
|
||||
local MTH_ZH_PostLoginRestore = nil
|
||||
local MTH_ZH_BootstrapFrame = nil
|
||||
local MTH_ZH_SyncSavedVariables
|
||||
@@ -80,7 +67,6 @@ local function MTH_ZH_ApplyDefaultWidgetSpawnLayoutOnce()
|
||||
local orderedCount = table.getn(orderedButtons)
|
||||
for i = 1, orderedCount do
|
||||
if not getglobal(orderedButtons[i]) then
|
||||
MTH_ZH_Log("skipped one-time default widget spawn layout (missing frame: " .. tostring(orderedButtons[i]) .. ")")
|
||||
return false
|
||||
end
|
||||
end
|
||||
@@ -95,7 +81,6 @@ local function MTH_ZH_ApplyDefaultWidgetSpawnLayoutOnce()
|
||||
end
|
||||
|
||||
savedRoot["_mth_widget_spawn_layout_v1"] = 1
|
||||
MTH_ZH_Log("applied one-time default widget spawn layout")
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -107,7 +92,6 @@ function MTH_ZH_OnDeferredInitComplete()
|
||||
if MTH_ZH_SetAuxFramesVisible then
|
||||
MTH_ZH_SetAuxFramesVisible(false)
|
||||
end
|
||||
MTH_ZH_Log("deferred init applied disabled-state hide")
|
||||
return
|
||||
end
|
||||
MTH_ZH_SyncSavedVariables()
|
||||
@@ -137,10 +121,6 @@ MTH_ZH_QueuePostLoginRestore = function(tag)
|
||||
|
||||
MTH_ZH_SyncSavedVariables()
|
||||
MTH_ZH_RestoreRuntimeFeatureFlags()
|
||||
if type(MTH_ZH_TraceAllButtonPoints) == "function" then
|
||||
MTH_ZH_TraceAllButtonPoints("post-login-restore:" .. tostring(tag))
|
||||
end
|
||||
MTH_ZH_Log("post-login restore applied: " .. tostring(tag))
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -178,17 +158,10 @@ local function MTH_ZH_EnsureBootstrapRestoreFrame()
|
||||
end
|
||||
|
||||
MTH_ZH_ApplyEnabledRuntimeState = function(source)
|
||||
MTH_ZH_TraceLocal("apply-enabled-runtime-state source=" .. tostring(source or ""))
|
||||
if type(MTH_ZH_TraceAllButtonPoints) == "function" then
|
||||
MTH_ZH_TraceAllButtonPoints("apply-enabled:before:" .. tostring(source or ""))
|
||||
end
|
||||
MTH_ZH_SyncSavedVariables()
|
||||
MTH_ZH_SetButtonsVisible(true)
|
||||
MTH_ZH_SetAuxFramesVisible(true)
|
||||
MTH_ZH_RestoreRuntimeFeatureFlags()
|
||||
if type(MTH_ZH_TraceAllButtonPoints) == "function" then
|
||||
MTH_ZH_TraceAllButtonPoints("apply-enabled:after:" .. tostring(source or ""))
|
||||
end
|
||||
end
|
||||
|
||||
MTH_ZH_SyncSavedVariables = function()
|
||||
@@ -197,22 +170,17 @@ MTH_ZH_SyncSavedVariables = function()
|
||||
end
|
||||
|
||||
local moduleStore = MTH:GetModuleCharSavedVariables("zhunter")
|
||||
MTH_ZH_TraceLocal("sync-saved begin zhuntermod_saved=" .. tostring(type(ZHunterMod_Saved)))
|
||||
|
||||
if type(ZHunterMod_Saved) == "table" then
|
||||
if MTH_CharSavedVariables and MTH_CharSavedVariables.modules then
|
||||
MTH_CharSavedVariables.modules.zhunter = ZHunterMod_Saved
|
||||
MTH_ZH_TraceLocal("sync-saved wrote ZHunterMod_Saved -> MTH_CharSavedVariables.modules.zhunter")
|
||||
end
|
||||
elseif type(moduleStore) == "table" then
|
||||
ZHunterMod_Saved = moduleStore
|
||||
MTH_ZH_TraceLocal("sync-saved loaded moduleStore -> ZHunterMod_Saved")
|
||||
end
|
||||
MTH_ZH_TraceLocal("sync-saved end")
|
||||
end
|
||||
|
||||
MTH_ZH_SetButtonsVisible = function(visible)
|
||||
MTH_ZH_TraceLocal("set-buttons-visible visible=" .. tostring(visible and true or false))
|
||||
local buttonNames = {
|
||||
"zButtonAspect",
|
||||
"zButtonTrack",
|
||||
@@ -294,9 +262,6 @@ MTH_ZH_SetButtonsVisible = function(visible)
|
||||
for _, buttonName in ipairs(buttonNames) do
|
||||
local button = getglobal(buttonName)
|
||||
if button then
|
||||
if type(MTH_ZH_TraceButtonPoint) == "function" then
|
||||
MTH_ZH_TraceButtonPoint(button, "set-buttons-visible:before:" .. tostring(buttonName))
|
||||
end
|
||||
if visible then
|
||||
-- Respect per-button enabled state
|
||||
local getterName = buttonName .. "_GetSaved"
|
||||
@@ -319,9 +284,6 @@ MTH_ZH_SetButtonsVisible = function(visible)
|
||||
MTH_ZH_SetChildButtonsVisible(button, buttonName, false)
|
||||
button:Hide()
|
||||
end
|
||||
if type(MTH_ZH_TraceButtonPoint) == "function" then
|
||||
MTH_ZH_TraceButtonPoint(button, "set-buttons-visible:after:" .. tostring(buttonName))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -400,7 +362,6 @@ function MTH_ZHunter:init()
|
||||
end
|
||||
|
||||
function MTH_ZHunter:setEnabled(enabled)
|
||||
MTH_ZH_TraceLocal("module setEnabled enabled=" .. tostring(enabled and true or false))
|
||||
MTH_ZH_SyncSavedVariables()
|
||||
if enabled then
|
||||
MTH_ZH_EnsureBootstrapRestoreFrame()
|
||||
@@ -409,14 +370,8 @@ function MTH_ZHunter:setEnabled(enabled)
|
||||
else
|
||||
MTH_ZH_ClearRuntimeFeatureFlags()
|
||||
MTH_ZH_SetAdjustmentHandlersActive(false)
|
||||
if type(MTH_ZH_TraceAllButtonPoints) == "function" then
|
||||
MTH_ZH_TraceAllButtonPoints("setEnabled:false:before-hide")
|
||||
end
|
||||
MTH_ZH_SetButtonsVisible(false)
|
||||
MTH_ZH_SetAuxFramesVisible(false)
|
||||
if type(MTH_ZH_TraceAllButtonPoints) == "function" then
|
||||
MTH_ZH_TraceAllButtonPoints("setEnabled:false:after-hide")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -121,9 +121,13 @@ local zButtonAmmo_ShortArrowLabels = {
|
||||
[ARROWS_ROUGH] = "Rough",
|
||||
[ARROWS_SHARP] = "Sharp",
|
||||
[ARROWS_RAZOR] = "Razor",
|
||||
[ARROWS_BRIGHT] = "Bright",
|
||||
[ARROWS_JAGGED] = "Jagged",
|
||||
[ARROWS_SHADE] = "Shade",
|
||||
[ARROWS_ICETHREADED] = "Ice",
|
||||
[ARROWS_SMOOTH] = "Smooth",
|
||||
[ARROWS_THORIUM] = "Thorium",
|
||||
[ARROWS_STAR] = "Star",
|
||||
[ARROWS_DOOMSHOT] = "Doom",
|
||||
}
|
||||
|
||||
@@ -143,6 +147,7 @@ local zButtonAmmo_ShortBulletLabels = {
|
||||
[BULLETS_ACCURATE] = "Accur",
|
||||
[BULLETS_GYROSHOT] = "Gyro",
|
||||
[BULLETS_THORIUM] = "Thorium",
|
||||
[BULLETS_CRAFTEDTHORIUM] = "Ench",
|
||||
[BULLETS_ICETHREADED] = "Ice",
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ end
|
||||
local root = zButtonAspect_GetRoot()
|
||||
if not root["zButtonAspect"] then
|
||||
root["zButtonAspect"] = {}
|
||||
root["zButtonAspect"]["spells"] = {1, 2, 3, 4, 5, 6, 7}
|
||||
root["zButtonAspect"]["spells"] = {1, 2, 3, 4, 5, 6, 7, 8}
|
||||
root["zButtonAspect"]["rows"] = 1
|
||||
root["zButtonAspect"]["horizontal"] = nil
|
||||
root["zButtonAspect"]["vertical"] = nil
|
||||
@@ -28,7 +28,8 @@ ZHunterMod_Aspect_Spells = {
|
||||
ZHUNTER_ASPECT_CHEETAH,
|
||||
ZHUNTER_ASPECT_PACK,
|
||||
ZHUNTER_ASPECT_WILD,
|
||||
ZHUNTER_ASPECT_BEAST
|
||||
ZHUNTER_ASPECT_BEAST,
|
||||
ZHUNTER_ASPECT_VIPER
|
||||
}
|
||||
|
||||
local ZHUNTER_ASPECT_MAX = table.getn(ZHunterMod_Aspect_Spells)
|
||||
|
||||
@@ -97,10 +97,6 @@ local function zButtonRanged_IsRangedItem(subtype, equipLoc)
|
||||
if subtypeText == tostring(MTH_WEAPON_BOWS or "Bows") then return true end
|
||||
if subtypeText == tostring(MTH_WEAPON_GUNS or "Guns") then return true end
|
||||
if subtypeText == tostring(MTH_WEAPON_CROSSBOWS or "Crossbows") then return true end
|
||||
if subtypeText == "Thrown" then return true end
|
||||
if equipLoc == "INVTYPE_RANGED" or equipLoc == "INVTYPE_RANGEDRIGHT" or equipLoc == "INVTYPE_THROWN" then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user