PHP код:
local __auras, __base = {},{
["WARRIOR"] = {
-- кровопускание
[47465] = false,
}
};
local GetDuration;
do
local m_scaner = CreateFrame("GameTooltip", "m_scaner", nil, "GameTooltipTemplate")
m_scaner:SetOwner(WorldFrame, "ANCHOR_NONE")
local m_text, tonumber, select = "", tonumber, select
GetDuration = function(spellID)
m_scaner:SetSpellByID(spellID)
for i = 1, m_scaner:GetNumRegions() do
local region = select(i, m_scaner:GetRegions())
if region and region:GetObjectType() == "FontString" then
m_text = region:GetText()
if m_text then
m_text = m_text:match("%d+ сек.")
if m_text then
return tonumber(m_text:match("%d+"))
end
end
end
end
end
end
local RegisterAura
do
local GetSpellInfo, GetTime = GetSpellInfo, GetTime
local _, class = UnitClass("player")
RegisterAura = function(destGUID, spellID)
local spellName, spellRank, spellIcon = GetSpellInfo(spellID)
if not __auras[destGUID] then __auras[destGUID] = {} end
local currentTime, duration = GetTime(), __base[class][spellID]
__auras[destGUID][spellID] = {
id = destGUID..spellID,
spellID = spellID,
spellIcon = spellIcon,
startTime = currentTime,
endTime = currentTime + duration,
duration = duration,
elapsed = 0,
remaining = duration
}
end
end
local CreateIcon = function(self)
local t = CreateFrame("frame", nil, self)
t:Hide()
t:SetFrameStrata("MEDIUM")
t:SetClampedToScreen(true)
local ti = t:CreateTexture(nil, "BORDER")
ti:SetAllPoints()
ti:SetTexCoord(0.07, 0.93, 0.07, 0.93)
t.icon = ti
local cooldown = CreateFrame("Cooldown", nil, t, "CooldownFrameTemplate")
cooldown:SetReverse(false)
cooldown:SetAllPoints()
t.cooldown = cooldown
local tt = cooldown:CreateFontString(nil, "OVERLAY")
tt:SetFont("Fonts\\FRIZQT__.TTF", 11, "OUTLINE")
tt:SetPoint("BOTTOM", t, 0, 1)
tt:SetJustifyH("RIGHT")
t.timeText = tt
return t
end
local f = CreateFrame("frame", nil, UIParent)
local OnEvent
do
local _, class = UnitClass("player")
OnEvent = function(self, event, ...)
if event=="COMBAT_LOG_EVENT" then
local timestamp, event, sourceGUID, sourceName, sourceFlags, destGUID, destName, destFlags, spellID = ...
if event=="SPELL_AURA_APPLIED" or event=="SPELL_AURA_REFRESH" then
if sourceName ~= destName then
if __base[class] and not __base[class][spellID] then
__base[class][spellID] = GetDuration(spellID)
end
if __base[class] and __base[class][spellID] then
RegisterAura(destGUID, spellID)
end
end
end
end
end
end
f:RegisterEvent("COMBAT_LOG_EVENT")
f:SetScript("OnEvent", OnEvent)