This commit is contained in:
DuvelCorp
2026-03-05 12:30:24 +01:00
parent 1a28d95b87
commit 233899b2a0
19 changed files with 818 additions and 124 deletions
+1 -1
View File
@@ -6,7 +6,7 @@
local MTH_AutoBuy = {
name = "autobuy",
enabled = false,
version = "1.0.5",
version = "1.0.6",
events = {
"VARIABLES_LOADED",
"MERCHANT_SHOW",
+1 -1
View File
@@ -1,7 +1,7 @@
local MTH_ChronometerModule = {
name = "chronometer",
enabled = true,
version = "1.0.5",
version = "1.0.6",
events = {},
initialized = false,
}
+1 -1
View File
@@ -6,7 +6,7 @@
local MTH_FeedOMatic = {
name = "feedomatic",
enabled = false,
version = "1.0.5",
version = "1.0.6",
events = {
"VARIABLES_LOADED",
"MERCHANT_SHOW",
+1 -1
View File
@@ -7,7 +7,7 @@ MTH_SA_MANAGED_HOOKS = true
local MTH_SmartAmmo = {
name = "smartammo",
enabled = true,
version = "1.0.5",
version = "1.0.6",
events = {
"VARIABLES_LOADED",
"PLAYER_ENTERING_WORLD",
+138 -13
View File
@@ -6,7 +6,7 @@
local MTH_Tooltips = {
name = "tooltips",
enabled = true,
version = "1.0.5",
version = "1.0.6",
events = {
"UPDATE_MOUSEOVER_UNIT",
"UNIT_NAME_UPDATE",
@@ -864,7 +864,37 @@ local function MTH_TT_FindAbilityCanonicalName(abilityName)
return nil
end
local function MTH_TT_ParseRankFromText(value)
local function MTH_TT_AbilityHasPositiveRanks(canonicalAbilityName)
if canonicalAbilityName == nil or canonicalAbilityName == "" then
return false
end
if not (MTH_DS_PetSpells and type(MTH_DS_PetSpells.byAbility) == "table") then
return false
end
local bucket = MTH_DS_PetSpells.byAbility[canonicalAbilityName]
if not (bucket and type(bucket.spells) == "table") then
return false
end
for i = 1, table.getn(bucket.spells) do
local spell = bucket.spells[i]
if spell then
local rank = tonumber(spell.rankNumber)
if not rank and spell.rank then
local _, _, parsed = string.find(tostring(spell.rank), "(%d+)")
rank = tonumber(parsed)
end
if rank and rank > 0 then
return true
end
end
end
return false
end
local function MTH_TT_ParseRankFromText(value, allowTrailingNumber)
local text = MTH_TT_Trim(value)
if text == "" then
return nil
@@ -873,9 +903,11 @@ local function MTH_TT_ParseRankFromText(value)
if rankText then
return tonumber(rankText)
end
local _, _, trailing = string.find(text, "(%d+)$")
if trailing then
return tonumber(trailing)
if allowTrailingNumber == true then
local _, _, trailing = string.find(text, "(%d+)$")
if trailing then
return tonumber(trailing)
end
end
return nil
end
@@ -903,10 +935,10 @@ local function MTH_TT_GetTooltipSpellNameAndRank()
if ok then
if type(a) == "string" then
spellName = a
rankNumber = MTH_TT_ParseRankFromText(b)
rankNumber = MTH_TT_ParseRankFromText(b, true)
elseif type(b) == "string" then
spellName = b
rankNumber = MTH_TT_ParseRankFromText(a)
rankNumber = MTH_TT_ParseRankFromText(a, true)
end
end
end
@@ -918,24 +950,28 @@ local function MTH_TT_GetTooltipSpellNameAndRank()
end
end
if not rankNumber then
rankNumber = MTH_TT_ParseRankFromText(spellName, true)
end
if not rankNumber then
local right1 = getglobal("GameTooltipTextRight1")
if right1 and right1.GetText then
rankNumber = MTH_TT_ParseRankFromText(right1:GetText())
rankNumber = MTH_TT_ParseRankFromText(right1:GetText(), false)
end
end
if not rankNumber then
local left2 = getglobal("GameTooltipTextLeft2")
if left2 and left2.GetText then
rankNumber = MTH_TT_ParseRankFromText(left2:GetText())
rankNumber = MTH_TT_ParseRankFromText(left2:GetText(), false)
end
end
if not rankNumber then
local right2 = getglobal("GameTooltipTextRight2")
if right2 and right2.GetText then
rankNumber = MTH_TT_ParseRankFromText(right2:GetText())
rankNumber = MTH_TT_ParseRankFromText(right2:GetText(), false)
end
end
@@ -944,7 +980,7 @@ local function MTH_TT_GetTooltipSpellNameAndRank()
local left = getglobal("GameTooltipTextLeft" .. i)
if left and left.GetText then
local text = MTH_TT_Trim(left:GetText())
local parsed = MTH_TT_ParseRankFromText(text)
local parsed = MTH_TT_ParseRankFromText(text, false)
if parsed and parsed > 0 then
rankNumber = parsed
break
@@ -952,7 +988,7 @@ local function MTH_TT_GetTooltipSpellNameAndRank()
end
local right = getglobal("GameTooltipTextRight" .. i)
if right and right.GetText then
local parsedRight = MTH_TT_ParseRankFromText(right:GetText())
local parsedRight = MTH_TT_ParseRankFromText(right:GetText(), false)
if parsedRight and parsedRight > 0 then
rankNumber = parsedRight
break
@@ -964,6 +1000,87 @@ local function MTH_TT_GetTooltipSpellNameAndRank()
return MTH_TT_CleanSpellName(spellName), rankNumber
end
local function MTH_TT_GetCurrentPetRowForTooltip()
local pets = nil
if type(MTH_PETS_GetRootStore) == "function" then
pets = MTH_PETS_GetRootStore()
elseif type(MTH_CharSavedVariables) == "table" then
pets = MTH_CharSavedVariables.MTH_Pets
end
if type(pets) ~= "table" then
return nil
end
local currentId = pets.currentPetId
if (currentId == nil or tostring(currentId) == "") and type(pets.currentPet) == "table" and pets.currentPet.exists == true then
currentId = pets.currentPet.id
end
if currentId == nil or tostring(currentId) == "" then
return nil
end
local activeById = type(pets.petStore) == "table" and pets.petStore.activeById or nil
if type(activeById) ~= "table" then
return nil
end
return activeById[currentId] or activeById[tostring(currentId)]
end
local function MTH_TT_CurrentPetKnowsAbility(abilityLower, rankNumber)
if abilityLower == "" then
return false
end
local row = MTH_TT_GetCurrentPetRowForTooltip()
if type(row) ~= "table" then
return false
end
local wantedRank = tonumber(rankNumber)
local spellbook = row.petSpellbook
if type(spellbook) == "table" and type(spellbook.spells) == "table" then
for i = 1, table.getn(spellbook.spells) do
local spell = spellbook.spells[i]
if type(spell) == "table" then
local spellLower = MTH_TT_Lower(MTH_TT_CleanSpellName(spell.name))
if spellLower == abilityLower then
if wantedRank then
local spellRank = tonumber(spell.rank)
if not spellRank then
spellRank = MTH_TT_ParseRankFromText(spell.name, true)
end
if spellRank and tonumber(spellRank) == wantedRank then
return true
end
else
return true
end
end
end
end
end
if type(row.abilities) == "table" then
for _, ability in pairs(row.abilities) do
if type(ability) == "table" then
local abilityLowerName = MTH_TT_Lower(MTH_TT_CleanSpellName(ability.name))
if abilityLowerName == abilityLower then
if wantedRank then
local abilityRank = tonumber(ability.rank)
if abilityRank and abilityRank == wantedRank then
return true
end
else
return true
end
end
end
end
end
return false
end
local function MTH_TT_IsPetActionTooltipOwner()
if not GameTooltip or type(GameTooltip.GetOwner) ~= "function" then
return false
@@ -1050,7 +1167,15 @@ local function MTH_TT_AddPetActionNotLearnedHint()
return
end
local known = MTH_TT_HunterKnowsAbility(MTH_TT_Lower(canonical), rankNumber)
if rankNumber and rankNumber > 0 and not MTH_TT_AbilityHasPositiveRanks(canonical) then
rankNumber = nil
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
return
end
+58 -4
View File
@@ -384,9 +384,36 @@ function ZSpellButton_OnEnter()
if this.isspell then
GameTooltip:SetSpell(this.id, "spell")
else
GameTooltip:SetText(this.ammocount .. " x "..this.ammolink, 1, 1, 1)
--GameTooltip:AddLine("Q="..this.ammocount)
local showedItemTooltip = nil
if this.ammobag and this.ammoslot and type(GameTooltip.SetBagItem) == "function" then
GameTooltip:ClearLines()
GameTooltip:SetBagItem(this.ammobag, this.ammoslot)
if type(GameTooltip.NumLines) == "function" and GameTooltip:NumLines() > 0 then
local left1 = getglobal("GameTooltipTextLeft1")
if left1 and left1.GetText and tostring(left1:GetText() or "") ~= "" then
showedItemTooltip = true
end
end
end
if (not showedItemTooltip) and this.ammolink and type(GameTooltip.SetHyperlink) == "function" then
GameTooltip:ClearLines()
GameTooltip:SetHyperlink(this.ammolink)
if type(GameTooltip.NumLines) == "function" and GameTooltip:NumLines() > 0 then
local left1 = getglobal("GameTooltipTextLeft1")
if left1 and left1.GetText and tostring(left1:GetText() or "") ~= "" then
showedItemTooltip = true
end
end
end
if not showedItemTooltip then
local label = this.ammoname or this.ammolink or "Ammo"
if this.ammocount then
label = tostring(this.ammocount) .. " x " .. tostring(label)
end
GameTooltip:SetText(label, 1, 1, 1)
end
end
GameTooltip:Show()
end
end
@@ -488,11 +515,38 @@ function ZSpellButtonParent_OnEnter(frame)
if string.len(rank) > 0 then
msg = msg.." ("..rank..")"
end
GameTooltip:SetText(msg, 1, 1, 1)
else
msg = frame.ammoname
local showedItemTooltip = nil
if frame.ammobag and frame.ammoslot and type(GameTooltip.SetBagItem) == "function" then
GameTooltip:ClearLines()
GameTooltip:SetBagItem(frame.ammobag, frame.ammoslot)
if type(GameTooltip.NumLines) == "function" and GameTooltip:NumLines() > 0 then
local left1 = getglobal("GameTooltipTextLeft1")
if left1 and left1.GetText and tostring(left1:GetText() or "") ~= "" then
showedItemTooltip = true
end
end
end
if (not showedItemTooltip) and frame.ammolink and type(GameTooltip.SetHyperlink) == "function" then
GameTooltip:ClearLines()
GameTooltip:SetHyperlink(frame.ammolink)
if type(GameTooltip.NumLines) == "function" and GameTooltip:NumLines() > 0 then
local left1 = getglobal("GameTooltipTextLeft1")
if left1 and left1.GetText and tostring(left1:GetText() or "") ~= "" then
showedItemTooltip = true
end
end
end
if not showedItemTooltip then
msg = frame.ammoname or frame.ammolink or "Ammo"
if frame.ammocount then
msg = tostring(frame.ammocount) .. " x " .. tostring(msg)
end
GameTooltip:SetText(msg, 1, 1, 1)
end
end
GameTooltip:SetText(msg, 1, 1, 1)
GameTooltip:AddLine("Alt+Drag To Move This Button")
GameTooltip:Show()
end
+1 -1
View File
@@ -8,7 +8,7 @@ MTH_ZH_MANAGED_HOOKS = true
local MTH_ZHunter = {
name = "zhunter",
enabled = true,
version = "1.0.5",
version = "1.0.6",
events = {
"VARIABLES_LOADED",
"PLAYER_ENTERING_WORLD",
+11 -2
View File
@@ -38,6 +38,7 @@ ZHunterMod_Track_Spells = {
local ZHUNTER_TRACK_MAX = table.getn(ZHunterMod_Track_Spells)
local zButtonTrack_LastTrackingTexture = nil
local zButtonTrack_SyncActiveChild
local zButtonTrack_GetSaved
local function zButtonTrack_NormalizeTexture(texture)
if not texture then
@@ -187,7 +188,7 @@ local function zButtonTrack_RefreshTrackingState()
end
end
local function zButtonTrack_GetSaved()
zButtonTrack_GetSaved = function()
local currentRoot = zButtonTrack_GetRoot()
if not currentRoot["zButtonTrack"] then
currentRoot["zButtonTrack"] = {}
@@ -273,6 +274,9 @@ function zButtonTrack_OnEvent()
zButtonTrackAdjustment = CreateFrame("Frame", "zButtonTrackAdjustment")
zButtonTrackAdjustment:RegisterEvent("MINIMAP_UPDATE_TRACKING")
zButtonTrackAdjustment:RegisterEvent("PLAYER_ENTERING_WORLD")
zButtonTrackAdjustment:RegisterEvent("SPELLS_CHANGED")
zButtonTrackAdjustment:RegisterEvent("CHARACTER_POINTS_CHANGED")
zButtonTrackAdjustment:RegisterEvent("LEARNED_SPELL_IN_TAB")
zButtonTrackAdjustment:SetScript("OnEvent", zButtonTrackAdjustment_OnEvent)
zButtonTrack_SetupSizeAndPosition()
end
@@ -355,8 +359,12 @@ function zButtonTrackAdjustment_OnEvent()
if not zButtonTrack or not zButtonTrack.count then
return
end
if event == "SPELLS_CHANGED" or event == "CHARACTER_POINTS_CHANGED" or event == "LEARNED_SPELL_IN_TAB" then
zButtonTrack_CreateButtons()
zButtonTrack_SetupSizeAndPosition()
end
if event == "MINIMAP_UPDATE_TRACKING" or event == "PLAYER_ENTERING_WORLD"
then
or event == "SPELLS_CHANGED" or event == "CHARACTER_POINTS_CHANGED" or event == "LEARNED_SPELL_IN_TAB" then
zButtonTrack_RefreshTrackingState()
end
end
@@ -389,6 +397,7 @@ SlashCmdList["zButtonTrack"] = function(msg)
if MTH_ZH_HandleDisabledSlash and MTH_ZH_HandleDisabledSlash("Track button is disabled while module 'zhunter' is disabled.") then
return
end
msg = tostring(msg or "")
if msg == "reset" then
zButtonTrack_Reset()
zButtonTrack:ClearAllPoints()