|
||||||
| AddOn HELP! Requests for assistance and misc bug reports go here. | ||||||
![]() |
|
|
Thread Tools |
|
|
#1 |
|
Newbie
Join Date: Aug 2008
Posts: 1
|
Hello everyone first time poster long time userof Acemods.
I have recently found an awesome mod that counts up ranged attack points on hunters mark and displays them. My only gripe is that it does not announe when the full 30 marks have been reached. Here is the code if anyone can help me. Code:
local _G = getfenv(0)
local GetFramesRegisteredForEvent = GetFramesRegisteredForEvent
local select = select
local UnitGUID = UnitGUID
local spellName = GetSpellInfo(1130)
local auraTable = {
[1130] = true, --Hunter's Mark (Rank 1)
[14323] = true, -- Hunter's Mark (Rank 2)
[14324] = true, -- Hunter's Mark (Rank 3)
[14325] = true, -- Hunter's Mark (Rank 4)
}
local rankTable = {
[select(2, GetSpellInfo(1130))] = { 20, 2 }, --Hunter's Mark (Rank 1)
[select(2, GetSpellInfo(14323))] = { 45, 4.5 }, -- Hunter's Mark (Rank 2)
[select(2, GetSpellInfo(14324))] = { 75, 7.5 }, -- Hunter's Mark (Rank 3)
[select(2, GetSpellInfo(14325))] = { 110, 11 }, -- Hunter's Mark (Rank 4)
}
local spellTable = {
[75] = true, -- Auto Shot
[3018] = true, -- Shoot
[3044] = true, -- Arcane Shot (Rank 1)
[14281] = true, -- Arcane Shot (Rank 2)
[14282] = true, -- Arcane Shot (Rank 3)
[14283] = true, -- Arcane Shot (Rank 4)
[14284] = true, -- Arcane Shot (Rank 5)
[14285] = true, -- Arcane Shot (Rank 6)
[14286] = true, -- Arcane Shot (Rank 7)
[14287] = true, -- Arcane Shot (Rank 8)
[27019] = true, -- Arcane Shot (Rank 9)
[2643] = true, -- Multi-Shot (Rank 1)
[14288] = true, -- Multi-Shot (Rank 2)
[14289] = true, -- Multi-Shot (Rank 3)
[14290] = true, -- Multi-Shot (Rank 4)
[25294] = true, -- Multi-Shot (Rank 5)
[27021] = true, -- Multi-Shot (Rank 6)
[19434] = true, -- Aimed Shot (Rank 1)
[20900] = true, -- Aimed Shot (Rank 2)
[20901] = true, -- Aimed Shot (Rank 3)
[20902] = true, -- Aimed Shot (Rank 4)
[20903] = true, -- Aimed Shot (Rank 5)
[20904] = true, -- Aimed Shot (Rank 6)
[27065] = true, -- Aimed Shot (Rank 7)
[34490] = true, -- Silencing Shot
[34120] = true, -- Steady Shot (Rank 1)
[19503] = true, -- Scatter Shot
}
local spellTooltip
local markedTable = {}
HuntersMark = CreateFrame("Frame")
local addon = HuntersMark
addon.hooks = {}
addon.hooks.UnitDebuff = _G.UnitDebuff
addon.hooks.GameTooltip = _G.GameTooltip.SetUnitDebuff
function UnitDebuff(unit, ...)
local name, rank, texture, count, debuffType, duration, timeLeft = addon.hooks.UnitDebuff(unit, ...)
if name == spellName then
local GUID = UnitGUID(unit)
if not markedTable[GUID] then markedTable[GUID] = 0 end
count = markedTable[GUID]
end
return name, rank, texture, count, debuffType, duration, timeLeft
end
function GameTooltip:SetUnitDebuff(unit, ...)
local tooltipName = self:GetName()
addon.hooks[tooltipName](self, unit, ...)
local name, rank, _, count = UnitDebuff(unit, ...)
if name ~= spellName then return end
local GUID = UnitGUID(unit)
if count == 0 then return end
local rankInfo = rankTable[rank]
local tooltipText = _G[tooltipName.."TextLeft2"]
if not spellTooltip then
spellTooltip = tooltipText:GetText():gsub("("..rankTable[rank][1]..")", "%%d")
end
tooltipText:SetText(spellTooltip:format(rankInfo[1] + rankInfo[2] * count))
end
local events = { RANGE_DAMAGE = true, SPELL_DAMAGE = true, SPELL_AURA_APPLIED = true, SPELL_AURA_APPLIED = true, SPELL_AURA_REMOVED = true, PARTY_KILL = true }
function addon:COMBAT_LOG_EVENT_UNFILTERED(timestamp, event, sourceGUID, sourceName, sourceFlags, destGUID, destName, destFlags, spellId)
if not events[event] then
return
elseif (event == "RANGE_DAMAGE" or event == "SPELL_DAMAGE") and spellTable[spellId] and markedTable[destGUID] and markedTable[destGUID] < 30 then
markedTable[destGUID] = markedTable[destGUID] + 1
self:UpdateAuras(destGUID)
elseif event == "SPELL_AURA_APPLIED" and auraTable[spellId] then
self:ResetMarked(destGUID)
elseif event == "PARTY_KILL" or event == "UNIT_DIED" or (event == "SPELL_AURA_REMOVED" and auraTable[spellId]) then
self:ResetMarked(destGUID)
end
end
function addon:PLAYER_ENTERING_WORLD()
for GUID in pairs(markedTable) do
self:ResetMarked(GUID)
end
end
function addon:ResetMarked(GUID)
if not GUID then return end
markedTable[GUID] = 0
end
local units = { player = true, pet = true, target = true, focus = true, }
for i=1,4 do units["party"..i] = true; units["partypet"..i] = true end
for i=1,40 do units["raid"..i] = true; units["raidpet"..i] = true end
function addon:UpdateAuras(GUID)
if not GUID then return end
_G.event = "UNIT_AURA"
local frameN = select("#", GetFramesRegisteredForEvent("UNIT_AURA"))
for unit in pairs(units) do
if UnitGUID(unit) == GUID then
_G.arg1 = unit
for i=1, frameN do
local frame = select(i, GetFramesRegisteredForEvent("UNIT_AURA"))
frame:GetScript("OnEvent")(frame, "UNIT_AURA", unit)
end
end
end
_G.event, _G.arg1 = nil, nil
end
addon:SetScript("OnEvent", function(self, event, ...) self[event](self, ...) end)
addon:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
addon:RegisterEvent("PLAYER_ENTERING_WORLD")
Code:
/run for i=1,40 do local n,_,_,c,_,_,_=UnitDebuff("target",i); if (n=="Hunter's Mark") then SendChatMessage(c.." stacks of Hunter's Mark" "SAY");end end
|
|
|
|
|
|
#3 |
|
Legendary Member
Join Date: Dec 2006
Posts: 2,321
|
Do not necroanimate thread. ^^
Anyway, Hunter's Mark is not buffed by ranged attack since 3.0 so such addon is now useless.
__________________
Author of Inline Aura, AdiBags, Squire2 and several other addons. Each time you hit your "copy" command with a block of code, think about a way to refactor it so it did what you want without using the "paste" command. |
|
|
|
![]() |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|
All times are GMT. The time now is 08:42 PM.
WowAce Forums





