mirror of
https://codeberg.org/Duvelcorp/MetaHunt.git
synced 2026-09-28 10:36:04 +00:00
V1.3.0
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
local MTH_AutoBuy = {
|
||||
name = "autobuy",
|
||||
enabled = false,
|
||||
version = "1.2.0",
|
||||
version = "1.3.0",
|
||||
events = {
|
||||
"VARIABLES_LOADED",
|
||||
"MERCHANT_SHOW",
|
||||
@@ -140,12 +140,9 @@ function MTH_AutoBuy:onEvent(event)
|
||||
return
|
||||
end
|
||||
|
||||
AB_Log("onEvent event=" .. tostring(event) .. " module.enabled=" .. tostring(self.enabled), "debug")
|
||||
|
||||
if event == "VARIABLES_LOADED" then
|
||||
engine:Init()
|
||||
AB_SetBridgeActive(self.enabled and true or false)
|
||||
AB_Log("onEvent VARIABLES_LOADED -> engine init", "debug")
|
||||
local store = engine:EnsureDefaults()
|
||||
AB_Trace("VARIABLES_LOADED module.enabled=" .. tostring(self.enabled)
|
||||
.. " store.enabled=" .. tostring(store and store.enabled)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
local MTH_AutoQuest = {
|
||||
name = "autoquest",
|
||||
enabled = false,
|
||||
version = "1.2.0",
|
||||
version = "1.3.0",
|
||||
events = {
|
||||
"GOSSIP_SHOW",
|
||||
"QUEST_GREETING",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local MTH_ChronometerModule = {
|
||||
name = "chronometer",
|
||||
enabled = true,
|
||||
version = "1.2.0",
|
||||
version = "1.3.0",
|
||||
events = {},
|
||||
initialized = false,
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ FOM_RealmPlayer = nil;
|
||||
FOM_LastPetName = nil;
|
||||
FOM_LastFeedAttempt = nil;
|
||||
FOM_TRACE_ENABLED = false;
|
||||
local FOM_CORE_ATTEMPT_TRACKING_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;
|
||||
@@ -126,7 +126,10 @@ FOM_FamilyToLegacyMap = {
|
||||
};
|
||||
|
||||
local function FOM_Trace(message)
|
||||
return;
|
||||
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()
|
||||
@@ -1301,6 +1304,7 @@ function FOM_OnUpdate(elapsed)
|
||||
.. " pet='" .. tostring(FOM_LastFeedAttempt.petName or "")
|
||||
.. "' elapsed=" .. string.format("%.2f", elapsedSinceFeed));
|
||||
FOM_LastFeedAttempt = nil;
|
||||
FOM_LastFood = nil;
|
||||
elseif (elapsedSinceFeed >= 2.50) then
|
||||
local failedAttempt = FOM_LastFeedAttempt;
|
||||
if (FOM_LastFeedAttempt.coreAttemptId and type(MTH_FEED_RecordBuffOutcome) == "function") then
|
||||
@@ -1952,6 +1956,7 @@ function FOM_ChatCommandHandler(msg)
|
||||
if ( cmd == "add" ) then
|
||||
for _, food in inputFoods do
|
||||
local foodID = FOM_IDFromLink(food);
|
||||
FOM_ClearItemBans(foodID);
|
||||
if ( FOM_AddFood(diet, tonumber(foodID)) ) then
|
||||
GFWUtils.Print("Added "..food.." to "..GFWUtils.Hilite(capDiet).." list.");
|
||||
else
|
||||
@@ -2011,6 +2016,12 @@ function FOM_AddFood(diet, food)
|
||||
return false;
|
||||
end
|
||||
else
|
||||
-- Item is in the base list; clear it from RemovedFoods if present so it isn't banned
|
||||
if (FOM_RemovedFoods and FOM_RemovedFoods[diet] and GFWTable.IndexOf(FOM_RemovedFoods[diet], food) ~= 0) then
|
||||
table.remove( FOM_RemovedFoods[diet], GFWTable.IndexOf(FOM_RemovedFoods[diet], food) );
|
||||
table.sort( FOM_RemovedFoods[diet] );
|
||||
return true;
|
||||
end
|
||||
return false;
|
||||
end
|
||||
|
||||
@@ -2018,7 +2029,7 @@ end
|
||||
|
||||
-- Remove a food from a list
|
||||
function FOM_RemoveFood(diet, food)
|
||||
|
||||
|
||||
if (FOM_Foods[diet] == nil) then
|
||||
GFWUtils.DebugLog("FOM_Foods[diet] == nil");
|
||||
end
|
||||
@@ -2057,6 +2068,42 @@ function FOM_RemoveFood(diet, food)
|
||||
|
||||
end
|
||||
|
||||
-- Clear quarantine, core exception blocks, and RemovedFoods ban for a specific item (called when user explicitly re-adds via /fom add)
|
||||
local function FOM_ClearItemBans(itemID)
|
||||
local numericItem = tonumber(itemID);
|
||||
if (numericItem == nil) then return; end
|
||||
-- Clear from RemovedFoods across all diet lists
|
||||
if (type(FOM_RemovedFoods) == "table") then
|
||||
for diet, list in FOM_RemovedFoods do
|
||||
if (type(list) == "table") then
|
||||
local idx = GFWTable.IndexOf(list, numericItem);
|
||||
if (idx ~= 0) then
|
||||
table.remove(list, idx);
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- Clear FOM quarantine (all families)
|
||||
local store = FOM_EnsureQuarantineStore();
|
||||
if (type(store) == "table" and type(store.byFamily) == "table") then
|
||||
for _, byItem in store.byFamily do
|
||||
if (type(byItem) == "table") then
|
||||
byItem[numericItem] = nil;
|
||||
end
|
||||
end
|
||||
end
|
||||
-- Clear core exception/block
|
||||
if (type(MTH_FEED_GetStore) == "function") then
|
||||
local coreStore = MTH_FEED_GetStore();
|
||||
if (coreStore and coreStore.exceptions and type(coreStore.exceptions.byItemId) == "table") then
|
||||
coreStore.exceptions.byItemId[numericItem] = nil;
|
||||
coreStore.exceptions.byItemId[tostring(numericItem)] = nil;
|
||||
end
|
||||
end
|
||||
-- Invalidate precompute cache so next feed re-scans
|
||||
FOM_FEED_SCAN_CACHE = nil;
|
||||
end
|
||||
|
||||
function FOM_IsBGActive()
|
||||
local bgNum = 1;
|
||||
local status;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
local MTH_FeedOMatic = {
|
||||
name = "feedomatic",
|
||||
enabled = false,
|
||||
version = "1.2.0",
|
||||
version = "1.3.0",
|
||||
events = {
|
||||
"VARIABLES_LOADED",
|
||||
"MERCHANT_SHOW",
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
local MTH_ICU = {
|
||||
name = "icu",
|
||||
enabled = false,
|
||||
version = "1.2.0",
|
||||
version = "1.3.0",
|
||||
events = {
|
||||
"VARIABLES_LOADED",
|
||||
},
|
||||
|
||||
@@ -137,17 +137,23 @@ end
|
||||
|
||||
local function MTHSmartAmmo_ForceHookGlobals()
|
||||
if type(MTHSmartAmmo_CastSpell_Hook) == "function" and CastSpell ~= MTHSmartAmmo_CastSpell_Hook then
|
||||
MTH_SA_CastSpell = CastSpell
|
||||
CastSpell = MTHSmartAmmo_CastSpell_Hook
|
||||
end
|
||||
if type(MTHSmartAmmo_UseAction_Hook) == "function" and UseAction ~= MTHSmartAmmo_UseAction_Hook then
|
||||
MTH_SA_UseAction = UseAction
|
||||
UseAction = MTHSmartAmmo_UseAction_Hook
|
||||
end
|
||||
if type(MTHSmartAmmo_CastSpellByName_Hook) == "function" and CastSpellByName ~= MTHSmartAmmo_CastSpellByName_Hook then
|
||||
MTH_SA_CastSpellByName = CastSpellByName
|
||||
CastSpellByName = MTHSmartAmmo_CastSpellByName_Hook
|
||||
end
|
||||
if CastSpell == MTHSmartAmmo_OriginalCastSpell or MTH_SA_CastSpell == nil then
|
||||
MTH_SA_CastSpell = CastSpell
|
||||
CastSpell = MTHSmartAmmo_CastSpell_Hook
|
||||
end
|
||||
end
|
||||
if type(MTHSmartAmmo_UseAction_Hook) == "function" and UseAction ~= MTHSmartAmmo_UseAction_Hook then
|
||||
if UseAction == MTHSmartAmmo_OriginalUseAction or MTH_SA_UseAction == nil then
|
||||
MTH_SA_UseAction = UseAction
|
||||
UseAction = MTHSmartAmmo_UseAction_Hook
|
||||
end
|
||||
end
|
||||
if type(MTHSmartAmmo_CastSpellByName_Hook) == "function" and CastSpellByName ~= MTHSmartAmmo_CastSpellByName_Hook then
|
||||
if CastSpellByName == MTHSmartAmmo_OriginalCastSpellByName or MTH_SA_CastSpellByName == nil then
|
||||
MTH_SA_CastSpellByName = CastSpellByName
|
||||
CastSpellByName = MTHSmartAmmo_CastSpellByName_Hook
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
MTH_SA = {}
|
||||
@@ -423,13 +429,6 @@ local MTH_SA_OnUpdateElapsed = 0
|
||||
frame:SetScript("OnUpdate", function()
|
||||
local dt = arg1 or 0
|
||||
MTHSmartAmmo_HookEnsureElapsed = MTHSmartAmmo_HookEnsureElapsed + dt
|
||||
if MTHSmartAmmo_HookEnsureElapsed >= 0.5 then
|
||||
MTHSmartAmmo_HookEnsureElapsed = 0
|
||||
if MTH_SA_IsModuleEnabled() then
|
||||
MTHSmartAmmo_InitializeHooks()
|
||||
end
|
||||
end
|
||||
|
||||
MTH_SA_OnUpdateElapsed = MTH_SA_OnUpdateElapsed + dt
|
||||
if MTH_SA_OnUpdateElapsed < 0.10 then
|
||||
return
|
||||
@@ -463,11 +462,10 @@ function MTH_SA_CountEquippedAmmo()
|
||||
local ammo = GetInventoryItemCount("player", 0)
|
||||
local equippedName = MTH_SA_GetEquippedAmmoName()
|
||||
if equippedName and equippedName ~= "" then
|
||||
MTH_SA_LastKnownEquippedName = equippedName
|
||||
end
|
||||
if not ammo then
|
||||
MTH_SA_Quantity=0
|
||||
return
|
||||
if equippedName ~= MTH_SA_LastKnownEquippedName then
|
||||
MTH_SA_LastKnownEquippedName = equippedName
|
||||
MTHSmartAmmo_RefreshAmmoButtonDisplay()
|
||||
end
|
||||
elseif ammo ~= MTH_SA_Quantity then
|
||||
MTH_SA_Quantity = ammo
|
||||
end
|
||||
@@ -663,12 +661,15 @@ MTHSmartAmmo_UseAction_Hook = function(slot, checkCursor, onSelf)
|
||||
end
|
||||
MTHSmartAmmo_InUseActionHook = true
|
||||
|
||||
if not GetActionText(slot) and MTHSmartAmmo_IsSmartEnabled() then
|
||||
local _actionText = GetActionText(slot)
|
||||
local _smart = MTHSmartAmmo_IsSmartEnabled()
|
||||
if not _actionText and _smart then
|
||||
MTH_SA_Tooltip:SetOwner(UIParent, "ANCHOR_NONE")
|
||||
MTH_SA_Tooltip:SetAction(slot)
|
||||
local name = MTH_SA_TooltipTextLeft1:GetText()
|
||||
MTH_SA_LastSpell = name
|
||||
if name and MTH_AMMO_JUNKSHOT_SET and MTH_AMMO_JUNKSHOT_SET[name] then
|
||||
local _inSet = name and MTH_AMMO_JUNKSHOT_SET and MTH_AMMO_JUNKSHOT_SET[name]
|
||||
if _inSet then
|
||||
if MTH_SA_Check() or MTH_SA_FindAmmo() then
|
||||
MTH_SA_EquipAmmo(1)
|
||||
end
|
||||
@@ -724,19 +725,29 @@ MTHSmartAmmo_InitializeHooks = function()
|
||||
return
|
||||
end
|
||||
|
||||
if CastSpell ~= MTHSmartAmmo_CastSpell_Hook then
|
||||
MTH_SA_CastSpell = CastSpell
|
||||
CastSpell = MTHSmartAmmo_CastSpell_Hook
|
||||
end
|
||||
-- Only install a hook if vanilla is on top (first-time install) or MetaHunt
|
||||
-- is already on top. If another addon (e.g. Quiver) is on top, it has already
|
||||
-- captured MetaHunt's hook as its super — reinstalling would create a double
|
||||
-- invocation and break addons that rely on IsCurrentAction after their super call.
|
||||
if CastSpell ~= MTHSmartAmmo_CastSpell_Hook then
|
||||
if CastSpell == MTHSmartAmmo_OriginalCastSpell or MTH_SA_CastSpell == nil then
|
||||
MTH_SA_CastSpell = CastSpell
|
||||
CastSpell = MTHSmartAmmo_CastSpell_Hook
|
||||
end
|
||||
end
|
||||
|
||||
if UseAction ~= MTHSmartAmmo_UseAction_Hook then
|
||||
MTH_SA_UseAction = UseAction
|
||||
UseAction = MTHSmartAmmo_UseAction_Hook
|
||||
end
|
||||
if UseAction ~= MTHSmartAmmo_UseAction_Hook then
|
||||
if UseAction == MTHSmartAmmo_OriginalUseAction or MTH_SA_UseAction == nil then
|
||||
MTH_SA_UseAction = UseAction
|
||||
UseAction = MTHSmartAmmo_UseAction_Hook
|
||||
end
|
||||
end
|
||||
|
||||
if CastSpellByName ~= MTHSmartAmmo_CastSpellByName_Hook then
|
||||
MTH_SA_CastSpellByName = CastSpellByName
|
||||
CastSpellByName = MTHSmartAmmo_CastSpellByName_Hook
|
||||
if CastSpellByName ~= MTHSmartAmmo_CastSpellByName_Hook then
|
||||
if CastSpellByName == MTHSmartAmmo_OriginalCastSpellByName or MTH_SA_CastSpellByName == nil then
|
||||
MTH_SA_CastSpellByName = CastSpellByName
|
||||
CastSpellByName = MTHSmartAmmo_CastSpellByName_Hook
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ MTH_SA_MANAGED_HOOKS = true
|
||||
local MTH_SmartAmmo = {
|
||||
name = "smartammo",
|
||||
enabled = true,
|
||||
version = "1.2.0",
|
||||
version = "1.3.0",
|
||||
events = {
|
||||
"VARIABLES_LOADED",
|
||||
-- PLAYER_ENTERING_WORLD handled by engine's own frame
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
local MTH_Tooltips = {
|
||||
name = "tooltips",
|
||||
enabled = true,
|
||||
version = "1.2.0",
|
||||
version = "1.3.0",
|
||||
events = {
|
||||
"UPDATE_MOUSEOVER_UNIT",
|
||||
"UNIT_NAME_UPDATE",
|
||||
|
||||
@@ -8,7 +8,7 @@ MTH_ZH_MANAGED_HOOKS = true
|
||||
local MTH_ZHunter = {
|
||||
name = "zhunter",
|
||||
enabled = true,
|
||||
version = "1.2.0",
|
||||
version = "1.3.0",
|
||||
events = {
|
||||
"VARIABLES_LOADED",
|
||||
-- PLAYER_ENTERING_WORLD handled by bootstrap frame + adjustment frames
|
||||
|
||||
Reference in New Issue
Block a user