v1.4.0 Twow 1.18.1

This commit is contained in:
DuvelCorp
2026-03-23 22:25:10 +01:00
parent 23bb69d094
commit 8479607a13
78 changed files with 66731 additions and 68666 deletions
-25
View File
@@ -9,9 +9,6 @@ local Engine = MTH_AutoBuyEngine
local AB_AMMO_BY_NAME = nil
local AB_FOOD_DIET_BY_ITEM_ID = nil
local function AB_Trace(message)
return
end
local function AB_ParseItemIdFromLink(link)
if type(link) ~= "string" then
@@ -1180,7 +1177,6 @@ end
function Engine:ExecutePlan(plan)
if type(plan) ~= "table" or type(plan.actions) ~= "table" then
AB_Trace("ExecutePlan skipped: invalid plan table")
return 0, 0
end
local executedActions = 0
@@ -1189,10 +1185,6 @@ function Engine:ExecutePlan(plan)
if type(action) == "table" and action.index then
local stacksToBuy = math.floor(tonumber(action.quantityStacks) or 0)
if stacksToBuy > 0 then
AB_Trace("ExecutePlan action index=" .. tostring(action.index)
.. " itemId=" .. tostring(action.itemId)
.. " stacks=" .. tostring(stacksToBuy)
.. " reason=" .. tostring(plan.reason or ""))
for i = 1, stacksToBuy do
BuyMerchantItem(action.index)
end
@@ -1201,7 +1193,6 @@ function Engine:ExecutePlan(plan)
end
end
end
AB_Trace("ExecutePlan done actions=" .. tostring(executedActions) .. " stacks=" .. tostring(requestedStacks) .. " reason=" .. tostring(plan.reason or ""))
return executedActions, requestedStacks
end
@@ -1264,42 +1255,30 @@ local function AB_AnnouncePurchases(actions)
end
function Engine:OnMerchantEvent(eventName)
AB_Trace("OnMerchantEvent start event=" .. tostring(eventName)
.. " sessionExecuted=" .. tostring(self._merchantSessionExecuted and true or false)
.. " engineEnabled=" .. tostring(self:IsEnabled() and true or false))
if eventName == "MERCHANT_SHOW" then
self._merchantSessionExecuted = false
AB_Trace("MERCHANT_SHOW resets session execution flag")
elseif eventName == "MERCHANT_UPDATE" and self._merchantSessionExecuted then
AB_Trace("MERCHANT_UPDATE ignored: already executed this merchant session")
return
end
if not self:IsEnabled() then
AB_Trace("event ignored: autobuy module disabled")
return
end
local snapshot = self:ScanMerchant()
AB_Trace("snapshot rows=" .. tostring(snapshot and snapshot.count or 0))
local foodPlan = self:BuildFoodPlan(snapshot)
local ammoPlan = self:BuildAmmoPlan(snapshot)
AB_Trace("foodPlan reason=" .. tostring(foodPlan.reason) .. " actions=" .. tostring(table.getn(foodPlan.actions or {})))
for i = 1, table.getn(foodPlan.debugLines or {}) do
AB_Trace("food#" .. tostring(i) .. " " .. tostring(foodPlan.debugLines[i]))
end
AB_Trace("ammoPlan reason=" .. tostring(ammoPlan.reason) .. " actions=" .. tostring(table.getn(ammoPlan.actions or {})))
for i = 1, table.getn(ammoPlan.debugLines or {}) do
AB_Trace("ammo#" .. tostring(i) .. " " .. tostring(ammoPlan.debugLines[i]))
end
local totalRequestedStacks = 0
if table.getn(foodPlan.actions or {}) > 0 then
local _, requestedStacks = self:ExecutePlan(foodPlan)
totalRequestedStacks = totalRequestedStacks + requestedStacks
AB_Trace("food plan executed requestedStacks=" .. tostring(requestedStacks))
if requestedStacks > 0 then
AB_AnnouncePurchases(foodPlan.actions)
end
@@ -1308,19 +1287,15 @@ function Engine:OnMerchantEvent(eventName)
if table.getn(ammoPlan.actions or {}) > 0 then
local _, requestedStacks = self:ExecutePlan(ammoPlan)
totalRequestedStacks = totalRequestedStacks + requestedStacks
AB_Trace("ammo plan executed requestedStacks=" .. tostring(requestedStacks))
if requestedStacks > 0 then
local moved = AB_MoveAmmoStacksToSpecialBags(300)
AB_Trace("ammo restack moved=" .. tostring(moved))
AB_AnnouncePurchases(ammoPlan.actions)
end
end
if totalRequestedStacks > 0 then
self._merchantSessionExecuted = true
AB_Trace("session marked executed requestedStacks=" .. tostring(totalRequestedStacks))
else
AB_Trace("no purchases requested in this event")
end
end
+2 -27
View File
@@ -6,7 +6,7 @@
local MTH_AutoBuy = {
name = "autobuy",
enabled = false,
version = "1.3.0",
version = "1.4.0",
events = {
"VARIABLES_LOADED",
"MERCHANT_SHOW",
@@ -24,9 +24,6 @@ end
local AB_Engine
local function AB_Trace(message)
return
end
local function AB_EnsureBridgeFrame(moduleRef)
if MTH_AutoBuy._bridgeFrame then
@@ -46,15 +43,12 @@ local function AB_EnsureBridgeFrame(moduleRef)
local eventName = event
local engine = AB_Engine()
if not engine then
AB_Trace("bridge event=" .. tostring(eventName) .. " engine missing")
return
end
if eventName == "MERCHANT_SHOW" or eventName == "MERCHANT_UPDATE" then
AB_Trace("bridge " .. tostring(eventName) .. " -> engine")
engine:OnMerchantEvent(eventName)
elseif eventName == "MERCHANT_CLOSED" then
AB_Trace("bridge MERCHANT_CLOSED -> engine")
if engine.OnMerchantClosed then
engine:OnMerchantClosed()
end
@@ -77,10 +71,8 @@ local function AB_SetBridgeActive(active)
frame:RegisterEvent("MERCHANT_UPDATE")
frame:RegisterEvent("MERCHANT_CLOSED")
MTH_AutoBuy._bridgeActive = true
AB_Trace("bridge active=true")
else
MTH_AutoBuy._bridgeActive = false
AB_Trace("bridge active=false (frame missing)")
end
return
end
@@ -91,7 +83,6 @@ local function AB_SetBridgeActive(active)
frame:UnregisterEvent("MERCHANT_CLOSED")
end
MTH_AutoBuy._bridgeActive = false
AB_Trace("bridge active=false")
end
AB_Engine = function()
@@ -102,15 +93,12 @@ function MTH_AutoBuy:init()
local engine = AB_Engine()
if not engine then
AB_Log("init failed: engine missing", "error")
AB_Trace("init failed: engine missing")
return
end
engine:Init()
self.initialized = true
AB_SetBridgeActive(self.enabled and true or false)
AB_Trace("init done")
if self.enabled then
AB_Log("module initialized", "debug")
end
end
@@ -120,20 +108,16 @@ function MTH_AutoBuy:setEnabled(enabled)
end
local engine = AB_Engine()
if not engine then
AB_Trace("setEnabled ignored: engine missing")
return
end
local store = engine:EnsureDefaults()
store.enabled = enabled and true or false
AB_SetBridgeActive(store.enabled and true or false)
AB_Trace("setEnabled store.enabled=" .. tostring(store.enabled))
end
function MTH_AutoBuy:onEvent(event)
local engine = AB_Engine()
if not engine then
AB_Log("onEvent ignored: engine missing, event=" .. tostring(event), "debug")
AB_Trace("engine missing, event=" .. tostring(event))
return
end
if self._bridgeActive and (event == "MERCHANT_SHOW" or event == "MERCHANT_UPDATE" or event == "MERCHANT_CLOSED") then
@@ -143,27 +127,19 @@ function MTH_AutoBuy:onEvent(event)
if event == "VARIABLES_LOADED" then
engine:Init()
AB_SetBridgeActive(self.enabled and true or false)
local store = engine:EnsureDefaults()
AB_Trace("VARIABLES_LOADED module.enabled=" .. tostring(self.enabled)
.. " store.enabled=" .. tostring(store and store.enabled)
.. " projectiles.enabled=" .. tostring(store and store.projectiles and store.projectiles.enabled))
engine:EnsureDefaults()
return
end
if not self.enabled then
AB_Log("onEvent ignored: module disabled", "debug")
if event == "MERCHANT_SHOW" or event == "MERCHANT_UPDATE" then
AB_Trace(tostring(event) .. " ignored: module disabled")
end
return
end
if event == "MERCHANT_SHOW" or event == "MERCHANT_UPDATE" then
AB_Log("onEvent merchant event forwarded: " .. tostring(event), "debug")
AB_Trace("forwarding " .. tostring(event) .. " to engine")
engine:OnMerchantEvent(event)
elseif event == "MERCHANT_CLOSED" then
AB_Trace("forwarding MERCHANT_CLOSED to engine")
if engine.OnMerchantClosed then
engine:OnMerchantClosed()
end
@@ -171,7 +147,6 @@ function MTH_AutoBuy:onEvent(event)
end
function MTH_AutoBuy:cleanup()
AB_Log("module cleanup", "debug")
end
MTH:RegisterModule("autobuy", MTH_AutoBuy)
+1 -1
View File
@@ -6,7 +6,7 @@
local MTH_AutoQuest = {
name = "autoquest",
enabled = false,
version = "1.3.0",
version = "1.4.0",
events = {
"GOSSIP_SHOW",
"QUEST_GREETING",
+9
View File
@@ -28,6 +28,8 @@ function MTH_ChronometerHunterInstallData(engine)
engine:AddTimer(engine.SPELL, BS["Flare"], 30, 0, 0, 0, { cr = "YELLOW", rc = true })
engine:AddTimer(engine.SPELL, BS["Hunter's Mark"], 120, 1, 0, 0, { cr = "RED", rc = true })
engine:AddTimer(engine.SPELL, BS["Immolation Trap"], 60, 0, 0, 0, { gr = 1, cr = "ORANGE", ea = { [BS["Immolation Trap Effect"]] = 60 } })
engine:AddTimer(engine.SPELL, BS["Aimed Shot"], 20, 0, 0, 0, { cr = "RED", rc = true, d = { tn = BS["Swiftshot"], tb = -2, ts = -2 } }) -- base 20s; Swiftshot reduces by 2s/rank (max -6s at rank 3)
engine:AddTimer(engine.SPELL, BS["Kill Command"], 12, 0, 0, 0, { cr = "RED", rc = true })
engine:AddTimer(engine.SPELL, BS["Rapid Fire"], 15, 0, 1, 1, { cr = "RED" })
engine:AddTimer(engine.SPELL, BS["Scare Beast"], 10, 1, 0, 0, { cr = "BLUE", rc = true, d = { rs = 5 } })
engine:AddTimer(engine.SPELL, BS["Scatter Shot"], 4, 1, 0, 0, { cr = "MAROON" })
@@ -44,10 +46,17 @@ function MTH_ChronometerHunterInstallData(engine)
engine:AddTimer(engine.EVENT, BS["Immolation Trap Effect"], 15, 1, 0, 1, { gr = 1, cr = "ORANGE", a = 1, xn = BS["Immolation Trap"] })
engine:AddTimer(engine.EVENT, BS["Improved Concussive Shot"], 3, 1, 0, 0, { a = 1, cr = "BLUE", xn = BS["Concussive Shot"] })
engine:AddTimer(engine.EVENT, BS["Improved Wing Clip"], 5, 1, 0, 0, { a = 1, cr = "MAROON", xn = BS["Wing Clip"] })
engine:AddTimer(engine.EVENT, BS["Lock and Load"], 10, 0, 1, 1, { a = 1, cr = "MAROON", tx = "Interface\\Icons\\ability_hunter_lockandload" }) -- 10s (tooltip confirmed; expires on Aimed Shot cast)
engine:AddTimer(engine.EVENT, BS["Scent of Blood"], 8, 0, 1, 1, { a = 1, cr = "RED" })
engine:AddTimer(engine.EVENT, BS["Piercing Shot"], 8, 1, 0, 1, { a = 1, cr = "PURPLE", tx = "Interface\\Icons\\Ability_Hunter_DisarmingShot" })
engine:AddTimer(engine.EVENT, BS["Entrapment"], 5, 1, 0, 1, { a = 1, cr = "MAROON", tx = "Interface\\Icons\\Spell_Nature_StrangleVines" })
engine:AddTimer(engine.EVENT, BS["Quick Shots"], 12, 0, 1, 1, { a = 1, cr = "MAROON", tx = "Interface\\Icons\\Ability_Warrior_InnerRage" })
engine:AddTimer(engine.EVENT, BS["Wing Clip"], 10, 1, 0, 1, { a = 1, cr = "YELLOW" })
-- Experimental Ammunition: target-side debuffs (from consumed ammo state)
-- Poisonous Ammunition consumed: reduces target armor 15s (Nature)
engine:AddTimer(engine.EVENT, BS["Poisonous Ammunition"], 15, 1, 0, 1, { a = 1, cr = "GREEN", tx = "Interface\\Icons\\Ability_PoisonArrow" })
-- Enchanted Ammunition consumed: magic resist debuff 6s (Arcane)
engine:AddTimer(engine.EVENT, BS["Enchanted Ammunition"], 6, 1, 0, 1, { a = 1, cr = "PURPLE", tx = "Interface\\Icons\\Ability_TheBlackArrow" })
engine:AddTimer(engine.EVENT, BS["Scorpid Poison"], 10, 1, 0, 0, { gr = 3, cr = "PURPLE", a = 1, dn = 1 })
engine:AddTimer(engine.EVENT, BS["Devilsaur Fury"], 20, 0, 1, 1, { a = 1, cr = "PURPLE", xn = BS["Devilsaur Eye"], tx = "Interface\\Icons\\Ability_Hunter_Pet_Raptor" })
engine:AddTimer(engine.EVENT, BS["Restless Strength"], 20, 0, 1, 1, { a = 1, cr = "PURPLE", xn = BS["Zandalarian Hero Medallion"], tx = "Interface\\Icons\\INV_Jewelry_Necklace_13" })
+5 -43
View File
@@ -59,18 +59,7 @@ Chronometer.dataSetup = {}
local latins = { I = 1, II = 2, III = 3, IV = 4, V = 5, VI = 6, VII = 7, VIII = 8, IX = 9, X = 10, XI = 11, XII = 12, XIII = 13, XIV = 14 }
local BAR_GROUP = "MTHChronometer"
local PARSER_OWNER = "MTHChronometerHunter"
local MTH_CHRON_TRACE_ENABLED = false
local function MTH_CHRON_Trace(msg)
if not MTH_CHRON_TRACE_ENABLED then
return
end
if MTH and MTH.Print then
MTH:Print("[CHRONTRACE] " .. tostring(msg), "debug")
elseif DEFAULT_CHAT_FRAME and DEFAULT_CHAT_FRAME.AddMessage then
DEFAULT_CHAT_FRAME:AddMessage("[CHRONTRACE] " .. tostring(msg))
end
end
local function MTH_CHRON_FormatBarPosition(profile)
local bp = profile and profile.barposition
@@ -195,13 +184,11 @@ end
local function ensureProfile()
if not MTH or not MTH.GetModuleCharSavedVariables then
MTH_CHRON_Trace("ensureProfile fallback defaults (no MTH store)")
return shallowCopy(DEFAULTS)
end
local store = MTH:GetModuleCharSavedVariables("chronometer")
if type(store) ~= "table" then
MTH_CHRON_Trace("ensureProfile fallback defaults (invalid store)")
return shallowCopy(DEFAULTS)
end
if type(store.profile) ~= "table"
@@ -211,10 +198,8 @@ local function ensureProfile()
local legacyChar = MTH_CharSavedVariables.chronometer
if type(legacyChar.profile) == "table" then
store.profile = deepCopyValue(legacyChar.profile)
MTH_CHRON_Trace("ensureProfile migrated legacy MTH_CharSavedVariables.chronometer.profile")
elseif type(legacyChar.barposition) == "table" then
store.profile = { barposition = deepCopyValue(legacyChar.barposition) }
MTH_CHRON_Trace("ensureProfile migrated legacy MTH_CharSavedVariables.chronometer.barposition")
end
end
if type(store.profile) ~= "table"
@@ -224,17 +209,14 @@ local function ensureProfile()
local legacyAccount = MTH_SavedVariables.chronometer
if type(legacyAccount.profile) == "table" then
store.profile = deepCopyValue(legacyAccount.profile)
MTH_CHRON_Trace("ensureProfile migrated legacy MTH_SavedVariables.chronometer.profile")
elseif type(legacyAccount.barposition) == "table" then
store.profile = { barposition = deepCopyValue(legacyAccount.barposition) }
MTH_CHRON_Trace("ensureProfile migrated legacy MTH_SavedVariables.chronometer.barposition")
end
end
if type(store.profile) ~= "table" and MTH.GetModuleSavedVariables then
local accountStore = MTH:GetModuleSavedVariables("chronometer")
if type(accountStore) == "table" and type(accountStore.profile) == "table" then
store.profile = deepCopyValue(accountStore.profile)
MTH_CHRON_Trace("ensureProfile copied account profile into char store")
end
end
if type(store.profile) ~= "table" then
@@ -242,17 +224,14 @@ local function ensureProfile()
end
if type(store.profile.barposition) ~= "table" and type(store.barposition) == "table" then
store.profile.barposition = deepCopyValue(store.barposition)
MTH_CHRON_Trace("ensureProfile migrated legacy char barposition -> profile.barposition")
end
if type(store.profile.barposition) ~= "table" and MTH.GetModuleSavedVariables then
local accountStore = MTH:GetModuleSavedVariables("chronometer")
if type(accountStore) == "table" then
if type(accountStore.barposition) == "table" then
store.profile.barposition = deepCopyValue(accountStore.barposition)
MTH_CHRON_Trace("ensureProfile migrated legacy account barposition -> profile.barposition")
elseif type(accountStore.profile) == "table" and type(accountStore.profile.barposition) == "table" then
store.profile.barposition = deepCopyValue(accountStore.profile.barposition)
MTH_CHRON_Trace("ensureProfile copied account profile.barposition -> char profile.barposition")
end
end
end
@@ -282,7 +261,6 @@ local function ensureProfile()
profile.disabledSpells.HUNTER = {}
end
MTH_CHRON_Trace("ensureProfile result barposition=" .. MTH_CHRON_FormatBarPosition(profile))
return profile
end
@@ -309,8 +287,6 @@ local function MTH_CHRON_PersistAnchorPosition(self, reason)
self.profile.barposition.relativePoint = relPoint
self.profile.barposition.x = x
self.profile.barposition.y = y
MTH_CHRON_Trace("persist-anchor reason=" .. tostring(reason or "")
.. " profile=" .. MTH_CHRON_FormatBarPosition(self.profile))
return true
end
@@ -330,8 +306,6 @@ local function MTH_CHRON_RestoreAnchorFromProfile(self, reason)
local ppoint = tostring(bp.point or "")
local prelpoint = tostring(bp.relativePoint or "")
if not (px and py and ppoint ~= "") then
MTH_CHRON_Trace("restore-anchor skipped reason=" .. tostring(reason or "")
.. " profile=" .. MTH_CHRON_FormatBarPosition(self.profile))
return false
end
if prelpoint == "" then
@@ -339,8 +313,6 @@ local function MTH_CHRON_RestoreAnchorFromProfile(self, reason)
end
self.anchor:ClearAllPoints()
self.anchor:SetPoint(ppoint, UIParent, prelpoint, px, py)
MTH_CHRON_Trace("restore-anchor applied reason=" .. tostring(reason or "")
.. " frame=" .. MTH_CHRON_DescribePoint(self.anchor))
return true
end
@@ -527,7 +499,6 @@ function Chronometer:MTH_Initialize()
end
self.profile = ensureProfile()
MTH_CHRON_Trace("MTH_Initialize profile=" .. MTH_CHRON_FormatBarPosition(self.profile))
self.parser = ParserLib:GetInstance("1.1")
self.COLOR_MAP = {
@@ -538,7 +509,6 @@ function Chronometer:MTH_Initialize()
}
self.anchor = self:CreateAnchor("MetaHunt Chronometer", 0, 1, 0)
MTH_CHRON_Trace("MTH_Initialize anchor-created point=" .. MTH_CHRON_DescribePoint(self.anchor))
self:RegisterCandyBarGroup(BAR_GROUP)
self:SetCandyBarGroupPoint(BAR_GROUP, "TOP", self.anchor, "BOTTOM", 0, 0)
@@ -547,19 +517,16 @@ end
function Chronometer:MTH_Enable()
self._mth_explicitEnable = true
MTH_CHRON_Trace("MTH_Enable called")
self:MTH_Initialize()
self:OnEnable()
self._mth_explicitEnable = nil
end
function Chronometer:MTH_Disable()
MTH_CHRON_Trace("MTH_Disable called")
self:OnDisable()
end
function Chronometer:OnEnable()
MTH_CHRON_Trace("OnEnable begin enabled=" .. tostring(self._mth_enabled and true or false))
if self._mth_enabled then
return
end
@@ -589,11 +556,9 @@ function Chronometer:OnEnable()
self._mth_enabled = true
self.profile = ensureProfile()
MTH_CHRON_Trace("OnEnable profile-after-ensure=" .. MTH_CHRON_FormatBarPosition(self.profile))
self:SetCandyBarGroupGrowth(BAR_GROUP, self.profile.growup and true or false)
self:SetCandyBarGroupVerticalSpacing(BAR_GROUP, self.profile.spacing or 0)
if self.anchor then
MTH_CHRON_Trace("OnEnable anchor-current-point=" .. MTH_CHRON_DescribePoint(self.anchor))
end
MTH_CHRON_RestoreAnchorFromProfile(self, "OnEnable")
@@ -701,9 +666,7 @@ function Chronometer:OnDisable()
if not self._mth_enabled then
return
end
MTH_CHRON_Trace("OnDisable begin profile=" .. MTH_CHRON_FormatBarPosition(self.profile))
if self.anchor then
MTH_CHRON_Trace("OnDisable anchor-point=" .. MTH_CHRON_DescribePoint(self.anchor))
end
MTH_CHRON_PersistAnchorPosition(self, "OnDisable")
self._mth_enabled = false
@@ -1209,7 +1172,6 @@ function Chronometer:CreateAnchor(text, r, g, b)
local py = tonumber(self.profile and self.profile.barposition and self.profile.barposition.y)
local ppoint = tostring(self.profile and self.profile.barposition and self.profile.barposition.point or "")
local prelpoint = tostring(self.profile and self.profile.barposition and self.profile.barposition.relativePoint or "")
MTH_CHRON_Trace("CreateAnchor saved-in profile=" .. MTH_CHRON_FormatBarPosition(self.profile))
if px ~= nil and py ~= nil then
if ppoint == "" then
ppoint = "TOPLEFT"
@@ -1219,17 +1181,14 @@ function Chronometer:CreateAnchor(text, r, g, b)
end
frame:ClearAllPoints()
frame:SetPoint(ppoint, UIParent, prelpoint, px, py)
MTH_CHRON_Trace("CreateAnchor restored point=" .. MTH_CHRON_DescribePoint(frame))
else
frame:SetPoint("CENTER", UIParent, "CENTER", 0, 50)
MTH_CHRON_Trace("CreateAnchor default point=" .. MTH_CHRON_DescribePoint(frame))
end
frame:SetScript("OnDragStart", function()
if not this or not this.StartMoving then
return
end
MTH_CHRON_Trace("anchor drag-start point=" .. MTH_CHRON_DescribePoint(this))
this:StartMoving()
end)
frame:SetScript("OnDragStop", function()
@@ -1258,8 +1217,6 @@ function Chronometer:CreateAnchor(text, r, g, b)
this.owner.profile.barposition.relativePoint = point or "TOPLEFT"
this.owner.profile.barposition.x = x
this.owner.profile.barposition.y = y
MTH_CHRON_Trace("anchor drag-stop saved profile=" .. MTH_CHRON_FormatBarPosition(this.owner.profile)
.. " frame=" .. MTH_CHRON_DescribePoint(this))
end
end)
@@ -1305,9 +1262,11 @@ function Chronometer:SPELL_FADE(event, info)
if not self.profile.fadeonfade then return end
if info.skill == BS["Banish"] then return end
if info.type == "fade" then
-- Only act when the fade is on the player or on their target, not on other players
if info.victim == ParserLib_SELF then
return self:KillBar(info.skill)
end
if info.source and info.source ~= ParserLib_SELF then return end
return self:KillBar(info.skill, info.victim)
end
end
@@ -1315,6 +1274,9 @@ end
function Chronometer:SPELL_PERIODIC(event, info)
local aura, rank, unit, isgain
-- Ignore events not caused by the player (e.g. other players' DOTs/traps nearby)
if info.source and info.source ~= ParserLib_SELF then return end
if info.type == "buff" then
isgain = 1
elseif info.type == "debuff" then
+1 -19
View File
@@ -1,28 +1,15 @@
local MTH_ChronometerModule = {
name = "chronometer",
enabled = true,
version = "1.3.0",
version = "1.4.0",
events = {},
initialized = false,
}
local MTH_CHRON_MODULE_TRACE_ENABLED = false
local function MTH_CHRON_ModuleTrace(msg)
if not MTH_CHRON_MODULE_TRACE_ENABLED then
return
end
if MTH and MTH.Print then
MTH:Print("[CHRONTRACE] " .. tostring(msg), "debug")
elseif DEFAULT_CHAT_FRAME and DEFAULT_CHAT_FRAME.AddMessage then
DEFAULT_CHAT_FRAME:AddMessage("[CHRONTRACE] " .. tostring(msg))
end
end
local function MTH_CHRON_ApplyRuntimeEnabledState(enabled)
MTH_CHRON_ModuleTrace("module apply runtime enabled=" .. tostring(enabled and true or false))
if not MTH_ChronometerHunter then
MTH_CHRON_ModuleTrace("module apply runtime skipped (engine unavailable)")
return
end
if enabled then
@@ -37,18 +24,14 @@ local function MTH_CHRON_ApplyRuntimeEnabledState(enabled)
end
function MTH_ChronometerModule:init()
MTH_CHRON_ModuleTrace("module init begin enabled=" .. tostring(self.enabled and true or false))
if MTH_ChronometerHunter and MTH_ChronometerHunter.MTH_Initialize then
MTH_ChronometerHunter:MTH_Initialize()
end
MTH_CHRON_ApplyRuntimeEnabledState(self.enabled and true or false)
self.initialized = true
MTH_CHRON_ModuleTrace("module init end initialized=true")
end
function MTH_ChronometerModule:setEnabled(enabled)
MTH_CHRON_ModuleTrace("module setEnabled enabled=" .. tostring(enabled and true or false)
.. " initialized=" .. tostring(self.initialized and true or false))
if not self.initialized then
self:init()
end
@@ -56,7 +39,6 @@ function MTH_ChronometerModule:setEnabled(enabled)
end
function MTH_ChronometerModule:cleanup()
MTH_CHRON_ModuleTrace("module cleanup")
if MTH_ChronometerHunter and MTH_ChronometerHunter.MTH_Disable then
MTH_ChronometerHunter:MTH_Disable()
end
File diff suppressed because it is too large Load Diff
+6
View File
@@ -0,0 +1,6 @@
<!--
MetaHunt: Experimental Ammunition Module Loader
-->
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Include file="engine.lua"/>
</Ui>
+1 -229
View File
@@ -56,12 +56,7 @@ FOM_LastChoiceReason = nil;
FOM_RealmPlayer = nil;
FOM_LastPetName = nil;
FOM_LastFeedAttempt = nil;
FOM_TRACE_ENABLED = false;
local FOM_CORE_ATTEMPT_TRACKING_ENABLED = true;
local FOM_PERF_TRACE_ENABLED = false;
local FOM_PERF_TRACE_HISTORY_LIMIT = 80;
local FOM_PERF_TRACE_SPIKE_MS = 12;
local FOM_PERF_TRACE_HISTORY = {};
local FOM_LAST_SETUP_AT = 0;
local FOM_LAST_SETUP_PET = nil;
local FOM_LAST_QUEST_SCAN_AT = 0;
@@ -125,82 +120,10 @@ FOM_FamilyToLegacyMap = {
["Wolves"] = WOLF,
};
local function FOM_Trace(message)
if not FOM_TRACE_ENABLED then return; end
if type(DEFAULT_CHAT_FRAME) == "table" and DEFAULT_CHAT_FRAME.AddMessage then
DEFAULT_CHAT_FRAME:AddMessage("|cffffff00[FOM-Trace]|r " .. tostring(message));
end
end
local function FOM_PerfNowMs()
if (type(debugprofilestop) == "function") then
local raw = tonumber(debugprofilestop()) or 0;
return raw / 1000;
end
if (type(GetTime) == "function") then
return (tonumber(GetTime()) or 0) * 1000;
end
return 0;
end
local function FOM_PerfOut(message, forceShow)
local text = tostring(message or "");
if (text == "") then
return;
end
if (type(MTH_DebugFrame) == "table" and type(MTH_DebugFrame.AddInfo) == "function") then
if (forceShow and type(MTH_DebugFrame.Show) == "function") then
MTH_DebugFrame:Show();
end
MTH_DebugFrame:AddInfo(text);
return;
end
if (MTH and type(MTH.Print) == "function") then
MTH:Print(text, "debug");
return;
end
if (type(GFWUtils) == "table" and type(GFWUtils.Print) == "function") then
GFWUtils.Print(text);
end
end
local function FOM_PerfRecord(label, elapsedMs, detail, forcePrint)
if (not FOM_PERF_TRACE_ENABLED) then
return;
end
local numericElapsed = tonumber(elapsedMs) or 0;
if (numericElapsed > 10000) then
numericElapsed = numericElapsed / 1000;
end
local row = {
ts = time and time() or 0,
label = tostring(label or "unknown"),
ms = numericElapsed,
detail = tostring(detail or ""),
};
table.insert(FOM_PERF_TRACE_HISTORY, row);
if (table.getn(FOM_PERF_TRACE_HISTORY) > FOM_PERF_TRACE_HISTORY_LIMIT) then
table.remove(FOM_PERF_TRACE_HISTORY, 1);
end
return;
end
local function FOM_PerfDump()
if (table.getn(FOM_PERF_TRACE_HISTORY) <= 0) then
FOM_PerfOut("[FOM PERF] no samples.", true);
return;
end
FOM_PerfOut("[FOM PERF] recent samples: " .. tostring(table.getn(FOM_PERF_TRACE_HISTORY)), true);
for i = 1, table.getn(FOM_PERF_TRACE_HISTORY) do
local row = FOM_PERF_TRACE_HISTORY[i];
if (type(row) == "table") then
FOM_PerfOut("[FOM PERF] #" .. tostring(i)
.. " " .. tostring(row.label)
.. " " .. string.format("%.2f", tonumber(row.ms) or 0) .. "ms"
.. (tostring(row.detail or "") ~= "" and (" | " .. tostring(row.detail)) or ""), false);
end
end
end
local function FOM_GetServerProfile()
return FOM_ServerProfiles[FOM_SERVER_PROFILE] or {};
@@ -291,9 +214,6 @@ local function FOM_RegisterNoBuffQuarantine(itemID, petInfo)
end
row.lastObservedAt = time and time() or 0;
row.reason = "no-buff";
FOM_Trace("quarantine add family='" .. tostring(familyKey)
.. "' itemId=" .. tostring(numericItem)
.. " minRejectPetLevel=" .. tostring(row.minRejectPetLevel));
end
local function FOM_IsQuarantined(itemID, petLevel, familyKey)
@@ -349,29 +269,6 @@ local function FOM_IsItemPetLevelCompatible(itemID, petLevel)
return true;
end
function FOM_CommandTrace(mode)
local arg = string.lower(tostring(mode or ""));
if (arg == "perf on") then
FOM_PERF_TRACE_ENABLED = true;
FOM_PerfOut("[FOM PERF] enabled.", true);
return;
end
if (arg == "perf off") then
FOM_PERF_TRACE_ENABLED = false;
FOM_PerfOut("[FOM PERF] disabled.", true);
return;
end
if (arg == "perf clear") then
FOM_PERF_TRACE_HISTORY = {};
FOM_PerfOut("[FOM PERF] cleared.", true);
return;
end
if (arg == "perf dump") then
FOM_PerfDump();
return;
end
FOM_PerfOut("Usage: /fomtrace perf on|off|dump|clear", true);
end
local function FOM_CoreFeedReady()
if (not FOM_CORE_ATTEMPT_TRACKING_ENABLED) then
@@ -457,7 +354,7 @@ function FOM_BuildFamilyAliasMap()
FOM_AddFamilyAlias("Carrion Bird", "Carrion Birds");
FOM_AddFamilyAlias("Wind Serpent", "Wind Serpents");
FOM_AddFamilyAlias("Serpent", "Serpents (Cobra)");
FOM_AddFamilyAlias("Serpent", "Serpents");
end
function FOM_GetCanonicalPetFamily(rawFamily)
@@ -642,7 +539,6 @@ local function FOM_PruneUnknownFoodNoise(force)
if (type(time) == "function") then
store.updatedAt = time();
end
FOM_Trace("pruned unknown vendor-only non-food rows=" .. tostring(removed));
end
return removed;
@@ -688,7 +584,6 @@ local function FOM_PruneExceptionNoise()
if (removed > 0 and store ~= nil and type(time) == "function") then
store.updatedAt = time();
FOM_Trace("pruned inert exception rows=" .. tostring(removed));
end
return removed;
end
@@ -827,10 +722,6 @@ function FOM_OnLoad()
SLASH_FEEDOMATIC3 = "/feed";
SLASH_FEEDOMATIC4 = "/petfeed"; -- Rauen's PetFeed compatibility
SLASH_FEEDOMATIC5 = "/pf";
SLASH_FOMTRACE1 = "/fomtrace";
SlashCmdList["FOMTRACE"] = function(msg)
FOM_CommandTrace(msg);
end
SlashCmdList["FEEDOMATIC"] = function(msg)
if MTH_IsModuleEnabled and not MTH_IsModuleEnabled("feedomatic", false) then
if DEFAULT_CHAT_FRAME and DEFAULT_CHAT_FRAME.AddMessage then
@@ -1075,8 +966,6 @@ function FOM_OnEvent(event, arg1)
elseif ( event == "UI_ERROR_MESSAGE" ) then
local lowerError = string.lower(tostring(arg1 or ""));
if (FOM_LastFood) then
FOM_Trace("ui error while feeding message='" .. tostring(arg1 or "")
.. "' lower='" .. tostring(lowerError) .. "'")
end
local isLowLevelError = (arg1 and SPELL_FAILED_FOOD_LOWLEVEL and string.find(arg1, SPELL_FAILED_FOOD_LOWLEVEL))
or string.find(lowerError, "low level")
@@ -1086,13 +975,8 @@ function FOM_OnEvent(event, arg1)
or string.find(lowerError, "wrong pet food")
or string.find(lowerError, "doesn't like")
or string.find(lowerError, "does not like")
FOM_Trace("ui error classify lowLevel=" .. tostring(isLowLevelError and true or false)
.. " wrongFood=" .. tostring(isWrongFoodError and true or false)
.. " hasAttempt=" .. tostring(type(FOM_LastFeedAttempt) == "table" and true or false)
.. " lastFood='" .. tostring(FOM_LastFood or "") .. "'")
if (isLowLevelError) then
FOM_Trace("reject reason=low-level")
if (type(FOM_LastFeedAttempt) == "table") then
FOM_CoreRecordReject(FOM_LastFeedAttempt.coreAttemptId, "low-level", arg1);
FOM_CoreFinalizeAttempt(FOM_LastFeedAttempt.coreAttemptId, "rejected", "low-level");
@@ -1110,7 +994,6 @@ function FOM_OnEvent(event, arg1)
end
elseif (isWrongFoodError) then
FOM_Trace("reject reason=wrong-food")
if (type(FOM_LastFeedAttempt) == "table") then
FOM_CoreRecordReject(FOM_LastFeedAttempt.coreAttemptId, "wrong-food", arg1);
FOM_CoreFinalizeAttempt(FOM_LastFeedAttempt.coreAttemptId, "rejected", "wrong-food");
@@ -1119,9 +1002,6 @@ function FOM_OnEvent(event, arg1)
if (FOM_LastFood) then
local alertPetName = MTH_FOM_GetTrackedPetName() or "Your pet";
local itemID = FOM_IDFromLink(FOM_LastFood);
FOM_Trace("learn reject wrongfood pet='" .. tostring(FOM_LastPetName or alertPetName)
.. "' itemId=" .. tostring(itemID)
.. " link='" .. tostring(FOM_LastFood) .. "'")
if ( FOM_Config.Alert == "chat") then
GFWUtils.Print(string.format(FOM_FEEDING_EAT_ANOTHER, alertPetName));
@@ -1281,10 +1161,6 @@ function FOM_OnUpdate(elapsed)
local elapsedSinceFeed = now - startedAt;
if (elapsedSinceFeed >= 0.10 and not FOM_LastFeedAttempt.loggedFirstCheck) then
FOM_LastFeedAttempt.loggedFirstCheck = true;
FOM_Trace("feed outcome check itemId=" .. tostring(FOM_LastFeedAttempt.itemId)
.. " pet='" .. tostring(FOM_LastFeedAttempt.petName or "")
.. "' hasFeedBuff=" .. tostring(FOM_HasFeedEffect() and true or false)
.. " elapsed=" .. string.format("%.2f", elapsedSinceFeed));
end
if (FOM_HasFeedEffect()) then
@@ -1300,9 +1176,6 @@ function FOM_OnUpdate(elapsed)
SendChatMessage(string.format(FOM_FEEDING_FEED, confirmedPetName, confirmedFoodLink).. FOM_RandomEmote(), "EMOTE");
end
FOM_CoreFinalizeAttempt(FOM_LastFeedAttempt.coreAttemptId, "accepted", "accepted");
FOM_Trace("feed outcome accepted-with-buff itemId=" .. tostring(FOM_LastFeedAttempt.itemId)
.. " pet='" .. tostring(FOM_LastFeedAttempt.petName or "")
.. "' elapsed=" .. string.format("%.2f", elapsedSinceFeed));
FOM_LastFeedAttempt = nil;
FOM_LastFood = nil;
elseif (elapsedSinceFeed >= 2.50) then
@@ -1320,10 +1193,6 @@ function FOM_OnUpdate(elapsed)
tonumber(currentPetInfo and currentPetInfo.level) or nil,
"no-buff");
end
FOM_Trace("feed outcome no-eating-buff itemId=" .. tostring(FOM_LastFeedAttempt.itemId)
.. " pet='" .. tostring(FOM_LastFeedAttempt.petName or "")
.. "' elapsed=" .. string.format("%.2f", elapsedSinceFeed)
.. " (likely not accepted by pet)");
FOM_LastFood = nil;
FOM_LastFeedAttempt = nil;
@@ -1350,8 +1219,6 @@ function FOM_OnUpdate(elapsed)
excludedCount = excludedCount + 1;
end
end
FOM_Trace("feed retry scheduled after no-buff retry=" .. tostring(retryCount + 1)
.. " excludedCount=" .. tostring(excludedCount));
FOM_Feed(nil, {
retryCount = retryCount + 1,
excludedItemIds = excludedItemIds,
@@ -2333,7 +2200,6 @@ local function FOM_TryPickSinglePrecomputedFood(foodList, excludedItemIds, allow
end
function FOM_Feed(aFood, options)
local feedStartMs = FOM_PerfNowMs();
options = options or {};
local retryCount = tonumber(options.retryCount) or 0;
local excludedItemIds = FOM_CloneSet(options.excludedItemIds);
@@ -2342,7 +2208,6 @@ function FOM_Feed(aFood, options)
if MTH_IsModuleEnabled and not MTH_IsModuleEnabled("feedomatic", false) then
if DEFAULT_CHAT_FRAME and DEFAULT_CHAT_FRAME.AddMessage then
MTH:Print("[FOM WRAP] FOM_Feed blocked: module disabled", "debug")
end
return false;
end
@@ -2368,19 +2233,9 @@ function FOM_Feed(aFood, options)
-- Assign Variable
local pet = (MTH_FOM_IsValidPetName(petInfo.name) and petInfo.name) or "Your pet";
FOM_Trace("feed request pet='" .. tostring(pet)
.. "' level=" .. tostring(petInfo.level)
.. " happiness=" .. tostring(petInfo.happiness)
.. " manualFood='" .. tostring(aFood or "") .. "'"
.. " retry=" .. tostring(retryCount)
.. " excluded=" .. tostring(FOM_CountSetEntries(excludedItemIds)))
local checkSetupStartMs = FOM_PerfNowMs();
FOM_CheckSetup();
FOM_PerfRecord("FOM_CheckSetup", FOM_PerfNowMs() - checkSetupStartMs, "retry=" .. tostring(retryCount), false);
if (FOM_LastPetName == nil or FOM_LastPetName == "") then
GFWUtils.DebugLog("Can't get pet info.");
FOM_PerfRecord("FOM_Feed total", FOM_PerfNowMs() - feedStartMs, "result=no-pet-name", true);
return false;
end
@@ -2404,24 +2259,18 @@ function FOM_Feed(aFood, options)
if ( foodBag == nil) then
-- No Food Could be Found
GFWUtils.Print(string.format(FOM_ERROR_FOOD_NOT_FOUND, pet, aFood));
FOM_PerfRecord("FOM_Feed total", FOM_PerfNowMs() - feedStartMs, "result=manual-not-found", true);
return false;
end
FOM_LastChoiceReason = "manual selection";
else
local cachedChoiceStartMs = FOM_PerfNowMs();
local cachedBag, cachedSlot, cachedItemId = FOM_GetCachedAutoChoice(excludedItemIds);
if (cachedBag ~= nil and cachedSlot ~= nil) then
foodBag, foodItem = cachedBag, cachedSlot;
FOM_LastChoiceReason = "cached previous food";
FOM_PerfRecord("FOM_AutoChoice cache", FOM_PerfNowMs() - cachedChoiceStartMs,
"hit itemId=" .. tostring(cachedItemId), false);
else
FOM_PerfRecord("FOM_AutoChoice cache", FOM_PerfNowMs() - cachedChoiceStartMs, "miss", false);
end
if (foodBag == nil) then
local precomputeStartMs = FOM_PerfNowMs();
local cacheNow = (type(GetTime) == "function") and (GetTime() or 0) or 0;
if (retryCount <= 0
and type(FOM_FEED_SCAN_CACHE) == "table"
@@ -2429,8 +2278,6 @@ function FOM_Feed(aFood, options)
and type(FOM_FEED_SCAN_CACHE.foods) == "table") then
precomputedFoodList = FOM_CloneFoodList(FOM_FEED_SCAN_CACHE.foods);
openSlots = tonumber(FOM_FEED_SCAN_CACHE.openSlots) or 0;
FOM_PerfRecord("FOM_Feed precompute", FOM_PerfNowMs() - precomputeStartMs,
"cache-hit foods=" .. tostring(table.getn(precomputedFoodList)) .. " openSlots=" .. tostring(openSlots), false);
else
precomputedFoodList = FOM_FlatFoodList();
openSlots = FOM_NumOpenBagSlots();
@@ -2440,32 +2287,23 @@ function FOM_Feed(aFood, options)
foods = FOM_CloneFoodList(precomputedFoodList),
openSlots = openSlots,
};
FOM_PerfRecord("FOM_Feed precompute", FOM_PerfNowMs() - precomputeStartMs,
"cache-miss foods=" .. tostring(table.getn(precomputedFoodList)) .. " openSlots=" .. tostring(openSlots), false);
end
local fastPickStartMs = FOM_PerfNowMs();
foodBag, foodItem = FOM_TryPickSinglePrecomputedFood(precomputedFoodList, excludedItemIds, (FOM_Config.AvoidUsefulFood and false or true));
if (foodBag ~= nil) then
FOM_LastChoiceReason = "single candidate fast-path";
FOM_PerfRecord("FOM_SingleCandidate", FOM_PerfNowMs() - fastPickStartMs, "hit", false);
else
FOM_PerfRecord("FOM_SingleCandidate", FOM_PerfNowMs() - fastPickStartMs, "miss", false);
end
if (foodBag == nil) then
local findStartMs = FOM_PerfNowMs();
foodBag, foodItem = FOM_NewFindFood(nil, excludedItemIds, precomputedFoodList, openSlots);
FOM_PerfRecord("FOM_NewFindFood primary", FOM_PerfNowMs() - findStartMs, "found=" .. tostring(foodBag ~= nil), false);
end
end
end
local fallbackBag, fallbackItem = nil, nil;
if (not manualFood and foodBag == nil and FOM_Config.Fallback) then
local fallbackStartMs = FOM_PerfNowMs();
fallbackBag, fallbackItem = FOM_NewFindFood(1, excludedItemIds, precomputedFoodList, openSlots);
FOM_PerfRecord("FOM_NewFindFood fallback", FOM_PerfNowMs() - fallbackStartMs, "found=" .. tostring(fallbackBag ~= nil), false);
end
if ( foodBag == nil) then
@@ -2480,12 +2318,10 @@ function FOM_Feed(aFood, options)
-- No Food Could be Found
GFWUtils.Print(string.format(FOM_ERROR_NO_FOOD, pet));
FOM_LastChoiceReason = nil;
FOM_PerfRecord("FOM_Feed total", FOM_PerfNowMs() - feedStartMs, "result=no-food", true);
return false;
end
end
local prepareStartMs = FOM_PerfNowMs();
FOM_LastFood = GetContainerItemLink(foodBag, foodItem);
local selectedId = FOM_IDFromLink(FOM_LastFood)
FOM_SetCachedAutoChoice(foodBag, foodItem, selectedId)
@@ -2504,26 +2340,15 @@ function FOM_Feed(aFood, options)
petLevel = tonumber(petInfo and petInfo.level) or nil,
foodLevel = selectedFoodLevel,
})
FOM_PerfRecord("FOM_Feed prepare", FOM_PerfNowMs() - prepareStartMs, "itemId=" .. tostring(selectedId), false);
FOM_Trace("selected food link='" .. tostring(FOM_LastFood)
.. "' itemId=" .. tostring(selectedId)
.. " bag=" .. tostring(foodBag)
.. " slot=" .. tostring(foodItem)
.. " reason='" .. tostring(FOM_LastChoiceReason or "") .. "'")
GFWUtils.DebugLog("Picked "..FOM_LastFood.." (bag "..foodBag..", slot "..foodItem..") for feeding.");
if (FOM_Config.Debug) then
-- don't actually feed anything, just show what we would choose
FOM_PerfRecord("FOM_Feed total", FOM_PerfNowMs() - feedStartMs, "result=debug", true);
return false;
end
-- Actually feed the item to the pet
local dropStartMs = FOM_PerfNowMs();
PickupContainerItem(foodBag, foodItem);
FOM_Trace("feed execute pickup bag=" .. tostring(foodBag)
.. " slot=" .. tostring(foodItem)
.. " cursorHasItem=" .. tostring(CursorHasItem() and true or false))
if ( CursorHasItem() ) then
MTH_FEED_SuppressChatUntil = (GetTime() or 0) + 2.0;
MTH_FEED_SuppressChatFoodName = FOM_NameFromLink(FOM_LastFood);
@@ -2531,26 +2356,19 @@ function FOM_Feed(aFood, options)
local ok = pcall(DropItemOnUnit, "pet");
MTH_FEED_SuppressCoreDropHook = nil;
if (not ok) then
FOM_Trace("feed execute drop on pet failed during protected call");
end
FOM_Trace("feed execute drop on pet cursorHasItemAfterDrop=" .. tostring(CursorHasItem() and true or false))
end
FOM_PerfRecord("FOM_Feed drop", FOM_PerfNowMs() - dropStartMs, "cursor=" .. tostring(CursorHasItem() and true or false), false);
if (coreAttemptId and type(MTH_FEED_RecordClientDropResult) == "function") then
pcall(MTH_FEED_RecordClientDropResult, coreAttemptId, {
consumedFromCursor = (CursorHasItem() and false or true),
})
end
if ( CursorHasItem() ) then
FOM_Trace("feed execute immediate-fail item stayed on cursor; likely rejected before combat log/error parse")
PickupContainerItem(foodBag, foodItem);
FOM_CoreRecordReject(coreAttemptId, "client-drop-fail", nil);
FOM_CoreFinalizeAttempt(coreAttemptId, "rejected", "client-drop-fail");
FOM_Trace("feed execute returned item to bag")
FOM_PerfRecord("FOM_Feed total", FOM_PerfNowMs() - feedStartMs, "result=cursor-fail", true);
return false;
else
FOM_Trace("feed execute accepted by client (item consumed from cursor)")
if (selectedId ~= nil) then
excludedItemIds[selectedId] = true;
end
@@ -2568,10 +2386,6 @@ function FOM_Feed(aFood, options)
loggedFirstCheck = false,
}
FOM_State.ShouldFeed = nil;
FOM_Trace("feed alert deferred until confirmation itemId=" .. tostring(selectedId)
.. " pet='" .. tostring(pet or "")
.. "' mode='" .. tostring(FOM_Config.Alert or "") .. "'")
FOM_PerfRecord("FOM_Feed total", FOM_PerfNowMs() - feedStartMs, "result=ok itemId=" .. tostring(selectedId), true);
return true;
end
end
@@ -2656,7 +2470,6 @@ local function FOM_EnsureQuestScanFresh(maxAgeSeconds)
end
function FOM_FlatFoodList()
local flatStartMs = FOM_PerfNowMs();
local foodList = {};
local overflowFoodList = {};
local scanned = 0;
@@ -2746,27 +2559,10 @@ function FOM_FlatFoodList()
if (table.getn(foodList) == 0 and table.getn(overflowFoodList) > 0) then
foodList = overflowFoodList;
end
FOM_Trace("flat food scan scanned=" .. tostring(scanned)
.. " inDiet=" .. tostring(inDiet)
.. " compatible=" .. tostring(compatibleCount)
.. " overflowCompatible=" .. tostring(overflowCompatibleCount)
.. " exceptionRejects=" .. tostring(rejectedByException)
.. " levelOverrideRejects=" .. tostring(rejectedByLevelOverride)
.. " quarantineRejects=" .. tostring(rejectedByQuarantine)
.. " unknownLevel=" .. tostring(unknownLevelCandidates)
.. " candidates=" .. tostring(table.getn(foodList)))
if (FOM_PERF_TRACE_ENABLED) then
FOM_PerfRecord("FOM_FlatFoodList", FOM_PerfNowMs() - flatStartMs,
"scanned=" .. tostring(scanned)
.. " inDiet=" .. tostring(inDiet)
.. " candidates=" .. tostring(table.getn(foodList)),
false);
end
return foodList;
end
function FOM_NewFindFood(fallback, excludedItemIds, precomputedFoodList, openSlotsOverride)
local findStartMs = FOM_PerfNowMs();
local FlatFoodList = nil;
if (type(precomputedFoodList) == "table") then
FlatFoodList = FOM_CloneFoodList(precomputedFoodList);
@@ -2777,12 +2573,6 @@ function FOM_NewFindFood(fallback, excludedItemIds, precomputedFoodList, openSlo
local reasonParts = {};
if (initialCount <= 0) then
FOM_LastChoiceReason = nil;
if (FOM_PERF_TRACE_ENABLED) then
FOM_PerfRecord("FOM_NewFindFood", FOM_PerfNowMs() - findStartMs,
"fallback=" .. tostring(fallback and true or false)
.. " initial=0 final=0",
false);
end
return nil;
end
local petInfo = MTH_FOM_GetCorePetInfo();
@@ -2869,18 +2659,6 @@ function FOM_NewFindFood(fallback, excludedItemIds, precomputedFoodList, openSlo
table.insert(reasonParts, "fallback allows useful food");
end
end
FOM_Trace("find food fallback=" .. tostring(fallback and true or false)
.. " initial=" .. tostring(initialCount)
.. " postConjured=" .. tostring(postConjuredCount)
.. " postFilters=" .. tostring(table.getn(FlatFoodList))
.. " reasons='" .. tostring(table.concat(reasonParts, ", ")) .. "'")
if (FOM_PERF_TRACE_ENABLED) then
FOM_PerfRecord("FOM_NewFindFood", FOM_PerfNowMs() - findStartMs,
"fallback=" .. tostring(fallback and true or false)
.. " initial=" .. tostring(initialCount)
.. " final=" .. tostring(table.getn(FlatFoodList)),
false);
end
for _, foodInfo in FlatFoodList do
if (foodInfo.overflow) then
@@ -2894,15 +2672,9 @@ function FOM_NewFindFood(fallback, excludedItemIds, precomputedFoodList, openSlo
else
FOM_LastChoiceReason = nil;
end
FOM_Trace("find food result bag=" .. tostring(foodInfo.bag)
.. " slot=" .. tostring(foodInfo.slot)
.. " quality=" .. tostring(foodInfo.quality)
.. " useful=" .. tostring(foodInfo.useful and true or false)
.. " temp=" .. tostring(foodInfo.temp and true or false))
return foodInfo.bag, foodInfo.slot;
end
FOM_LastChoiceReason = nil;
FOM_Trace("find food result: none")
return nil;
end
+1 -1
View File
@@ -80,7 +80,7 @@ FOM_Emotes = {
["Foxes"] = {
"Clever fox, clever snack choice.",
},
["Serpents (Cobra)"] = {
["Serpents"] = {
"No hissing with your mouth full.",
},
};
-13
View File
@@ -53,16 +53,6 @@ function GFWUtils_temp_PrintOnce(message, interval, r, g, b)
GFWUtils.PrintOnceCache[message] = GetTime();
end
-- Prints a message to the chat frame only if Debug is set
function GFWUtils_temp_DebugLog(message)
if (GFWUtils.Debug) then
if MTH and MTH.Print then
MTH:Print(message, "debug")
else
DEFAULT_CHAT_FRAME:AddMessage(message, GFW_DEBUG_COLOR.r, GFW_DEBUG_COLOR.g, GFW_DEBUG_COLOR.b);
end
end
end
-- Prints a message in yellow to the floating messages frame
function GFWUtils_temp_Note(message)
@@ -177,8 +167,6 @@ if (G.Version == nil or (tonumber(G.Version) ~= nil and G.Version < GFWUTILS_THI
-- Constants
GFW_FONT_COLOR = {r=0.25, g=1.0, b=1.0};
GFW_DEBUG_COLOR = {r=1.0, g=0.75, b=0.25};
G.Debug = false;
-- Functions
G.Hilite = GFWUtils_temp_HiliteText;
@@ -187,7 +175,6 @@ if (G.Version == nil or (tonumber(G.Version) ~= nil and G.Version < GFWUTILS_THI
G.LtY = GFWUtils_temp_LightYellowText;
G.Print = GFWUtils_temp_Print;
G.PrintOnce = GFWUtils_temp_PrintOnce;
G.DebugLog = GFWUtils_temp_DebugLog;
G.Note = GFWUtils_temp_Note;
G.FormatToPattern = GFWUtils_temp_FormatToPattern;
G.Split = GFWUtils_temp_Split;
+2 -12
View File
@@ -6,7 +6,7 @@
local MTH_FeedOMatic = {
name = "feedomatic",
enabled = false,
version = "1.3.0",
version = "1.4.0",
events = {
"VARIABLES_LOADED",
"MERCHANT_SHOW",
@@ -112,10 +112,6 @@ local function MTH_FeedOMatic_CallLegacyOnEvent(evt, a1, a2, a3, a4, a5, a6, a7,
event = oldEvent
arg1, arg2, arg3, arg4, arg5 = oldArg1, oldArg2, oldArg3, oldArg4, oldArg5
arg6, arg7, arg8, arg9 = oldArg6, oldArg7, oldArg8, oldArg9
if not ok and MTH and MTH.DebugPrint then
MTH:DebugPrint("FeedOMatic legacy OnEvent call failed for event: " .. tostring(evt))
end
end
local function MTH_FeedOMatic_EnsureVariablesLoaded(module)
@@ -166,8 +162,7 @@ end
local function MTH_FeedOMatic_Log(message, severity)
if type(MTH_Log) == "function" then
local logSeverity = severity or "debug"
MTH_Log("[FeedOMatic] " .. tostring(message or ""), logSeverity)
MTH_Log("[FeedOMatic] " .. tostring(message or ""), severity)
end
end
@@ -198,10 +193,8 @@ local function MTH_FeedOMatic_DebugMerchantScan(sourceEvent)
if type(rows) == "table" then
dietCount = table.getn(rows)
end
MTH_FeedOMatic_Log("diet " .. tostring(dietName) .. ": " .. tostring(dietCount) .. " item(s)", "debug")
if type(rows) == "table" then
for _, row in rows do
MTH_FeedOMatic_Log(" - [" .. tostring(row.id) .. "] " .. tostring(row.name) .. " (slot=" .. tostring(row.index) .. ")", "debug")
end
end
end
@@ -209,7 +202,6 @@ local function MTH_FeedOMatic_DebugMerchantScan(sourceEvent)
if unknownCount > 0 and type(merchantFoods.unknown) == "table" then
for _, row in merchantFoods.unknown do
MTH_FeedOMatic_Log("unknown map: [" .. tostring(row.id) .. "] " .. tostring(row.name) .. " (slot=" .. tostring(row.index) .. ")", "debug")
end
end
end
@@ -228,7 +220,6 @@ local function MTH_FeedOMatic_SetMerchantProbeEnabled(enabled)
MTH_FOM_MerchantProbe:SetScript("OnEvent", function()
local evt = event
if evt == "MERCHANT_SHOW" or evt == "MERCHANT_UPDATE" then
MTH_FeedOMatic_Log("probe event received: " .. tostring(evt), "debug")
MTH_FeedOMatic_DebugMerchantScan(evt)
end
end)
@@ -236,7 +227,6 @@ local function MTH_FeedOMatic_SetMerchantProbeEnabled(enabled)
MTH_FOM_MerchantProbe:RegisterEvent("MERCHANT_SHOW")
MTH_FOM_MerchantProbe:RegisterEvent("MERCHANT_UPDATE")
MTH_FeedOMatic_Log("merchant probe enabled", "debug")
end
function MTH_FeedOMatic:init()
+1 -1
View File
@@ -6,7 +6,7 @@
local MTH_ICU = {
name = "icu",
enabled = false,
version = "1.3.0",
version = "1.4.0",
events = {
"VARIABLES_LOADED",
},
+1 -1
View File
@@ -7,7 +7,7 @@ MTH_SA_MANAGED_HOOKS = true
local MTH_SmartAmmo = {
name = "smartammo",
enabled = true,
version = "1.3.0",
version = "1.4.0",
events = {
"VARIABLES_LOADED",
-- PLAYER_ENTERING_WORLD handled by engine's own frame
+26 -9
View File
@@ -6,7 +6,7 @@
local MTH_Tooltips = {
name = "tooltips",
enabled = true,
version = "1.3.0",
version = "1.4.0",
events = {
"UPDATE_MOUSEOVER_UNIT",
"UNIT_NAME_UPDATE",
@@ -1389,7 +1389,6 @@ local function MTH_TT_AddPetActionNotLearnedHint()
return
end
local ownerName = MTH_TT_GetTooltipOwnerName()
local ownerMatch = MTH_TT_IsPetActionTooltipOwner()
local barMatch = MTH_TT_IsSpellOnPetActionBar(spellName)
if not ownerMatch and not barMatch then
@@ -1406,11 +1405,13 @@ local function MTH_TT_AddPetActionNotLearnedHint()
end
local canonicalLower = MTH_TT_Lower(canonical)
local known = MTH_TT_HunterKnowsAbility(canonicalLower, rankNumber)
if not known then
known = MTH_TT_CurrentPetKnowsAbility(canonicalLower, rankNumber)
end
if known then
local hunterKnown = MTH_TT_HunterKnowsAbility(canonicalLower, rankNumber)
-- Only fall back to petKnown for ranked abilities: rankless abilities have no rank
-- filter in CurrentPetKnowsAbility, so they always match on name alone -> false positive.
local petKnown = (not hunterKnown)
and MTH_TT_AbilityHasPositiveRanks(canonical)
and MTH_TT_CurrentPetKnowsAbility(canonicalLower, rankNumber)
if hunterKnown or petKnown then
return
end
@@ -1485,8 +1486,11 @@ local function MTH_TT_AddTooltip(unit)
local ammoVendorTooltipsEnabled = MTH_TT_IsAmmoVendorTooltipsEnabled()
local vendorInfo = ammoVendorTooltipsEnabled and MTH_TT_FindVendorInfo(name) or nil
local row = beastTooltipsEnabled and MTH_TT_FindBeastRow(name) or nil
local savedEntry = beastTooltipsEnabled
and (type(MTH_BLS_FindSavedBeastByName) == "function")
and MTH_BLS_FindSavedBeastByName(name) or nil
local scorpokAdded = MTH_TT_AddScorpokTargetsTooltip(unit, name)
if not row and not vendorInfo and not scorpokAdded then
if not row and not vendorInfo and not scorpokAdded and not savedEntry then
state.lookupMiss = (state.lookupMiss or 0) + 1
MTH_TT_StateSet("lookup-miss", name, normalized)
MTH_TT_Log("lookup miss: unit='" .. tostring(name) .. "' normalized='" .. tostring(normalized) .. "'")
@@ -1510,8 +1514,16 @@ local function MTH_TT_AddTooltip(unit)
MTH_TT_Log("vendor tooltip added: unit='" .. tostring(name) .. "'")
end
-- Determine which abilities source to display.
local abilitiesSource = nil
if row then
local abilities = MTH_TT_ParseAbilities(row.abilities)
abilitiesSource = row.abilities
elseif savedEntry and savedEntry.abilities and savedEntry.abilities ~= "" then
abilitiesSource = savedEntry.abilities
end
if abilitiesSource then
local abilities = MTH_TT_ParseAbilities(abilitiesSource)
if table.getn(abilities) == 0 then
MTH_TT_StateSet("skip-no-abilities", name, normalized)
MTH_TT_Log("skip: beast has no abilities ('" .. tostring(name) .. "')")
@@ -1534,6 +1546,11 @@ local function MTH_TT_AddTooltip(unit)
end
end
if savedEntry then
GameTooltip:AddLine("Beast recorded by you", 1.0, 0.85, 0.0)
addedAnything = 1
end
if addedAnything then
GameTooltip:Show()
state.added = (state.added or 0) + 1
+1 -18
View File
@@ -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
-46
View File
@@ -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()
-23
View File
@@ -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
+1 -46
View File
@@ -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
+5
View File
@@ -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",
}
+3 -2
View File
@@ -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)
-4
View File
@@ -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