есть он у меня, все равно не оч удобный для меня

- - - Updated - - -

Цитата Сообщение от DreamlØlz Посмотреть сообщение
Вот мое самописное , встраивается прямо в oUF (база кд сюда не влезет).



PHP код:
local function ToNumber(v)
    
local r tonumber(v)
    if 
not r then return 0 end
    
return r
end

local 
function IsTable(o)
    return 
type(o) == "table"
end

local 
function RegisterCD(selfsrcGUIDsrcNamesrcFlagsspellID)

    
local cd1cd2 spellBase[spellID][2], spellBase[spellID][3]
    
local cd = (cd2 and cd2 or cd1)
    
local spellNamespellRankspellIcon GetSpellInfo(spellID)
    if 
not self.cds[srcGUIDthen self.cds[srcGUID] = {} end
    local currentTime 
GetTime()
    
self.cds[srcGUID][spellID] = {
        
cdID srcGUID .. "|" .. spellID,
        
flags srcFlags,
        
srcName srcName,
        
srcGUID srcGUID,
        
spellID spellID,
        
spellName spellName,
        
spellRank spellRank,
        
spellIcon spellIcon,
        
startTime currentTime,
        
endTime currentTime cd,
        
duration cd,
        
elapsed 0,
        
remaining cd
    
}
end

local 
function RemoveCDsByUnitSpell(selfunitGUIDspellID)
    if(
not unitGUIDthen return; end
    local unitCDs 
self.cds[unitGUID];
    if(
not unitCDsthen return; end
    
    
if(spellIDthen
        unitCDs
[spellID] = nil;
    elseif(
spellID == -1then
        self
.cds[unitGUID] = nil;
    
end
end

local 
function Time(time)
    return (
time <= and string.format("%.1f"time))
        or (
time <= 60 and string.format("%d"time))
        or (
string.format("%d"time))
end

local 
function ClearTracker(selftrackerID)
    
local timers self.trackers[trackerID].timers;
    for 
kv in ipairs(timers) do
        if(
IsTable(v) and v.timer and v.timer.trackerIDthen
            v
.timer:Hide();
            
timers[k].timer nil;
        
end
    end
end

local 
function CreateTimer(self)
    
local t CreateFrame("frame"nilself);
    
t:Hide();
    
t:SetFrameStrata("MEDIUM");
    
t:SetClampedToScreen(true);
    
t:SetScript("OnUpdate", function()
        
uf.OnTimerUpdate(self)
    
end)
    -- 
icon
    local ti 
t:CreateTexture(nil"BORDER");
    
ti:SetAllPoints();
    
ti:SetTexCoord(0.070.930.070.93);
    
t.icon ti;
    -- 
cooldown
    local cooldown 
CreateFrame("Cooldown"nilt"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"t01);
    
tt:SetJustifyH("RIGHT");
    
t.timeText tt;
    
    return 
t;
end

local 
function GetTrinketIcon(unit)
    if(
UnitFactionGroup(unit) == "Horde"then
        
return "Interface\\Icons\\INV_Jewelry_TrinketPVP_02";
    else
        return 
"Interface\\Icons\\INV_Jewelry_TrinketPVP_01";
    
end
end

local 
function RemainingComparer(ab)
    return 
b.remaining a.remaining
end

local 
function ReversalRemainingComparer(ba)
    return 
b.remaining a.remaining
end

local 
function UpdateTracker(selftrackerID)

    if(
not trackerIDthen
        
return;
    
end
    ClearTracker
(selftrackerID);
    
    
local timers self.trackers[trackerID].timers;
    
local tabID self.np[trackerID].tabID;
    
local activeGUID = (ToNumber(tabID) < and self.trackers[trackerID].unitGUID or tabID);
    
    
local unitCDs self.cds[activeGUID];
    if(
not unitCDsthen
        
return;
    
end
    
    local unitClass 
self.np[trackerID].units[activeGUID].unitClass;
    
local tmp = {}
    
local m 1
    local lastCD 
= {spellID = -1time = -1}

    for 
spellIDcd in pairs(unitCDs) do
        if 
IsTable(cdthen
            local currentTime 
GetTime()
            
cd.elapsed currentTime cd.startTime
            cd
.remaining cd.duration cd.elapsed
            
if (cd.remaining and cd.remaining and cd.remaining <= self.timeLimitthen
                
if (cd.startTime lastCD.timethen
                    lastCD
.spellID spellID
                    lastCD
.time cd.startTime
                end
                tmp
[m] = {spellID spellIDremaining ToNumber(cd.remaining)}
                
1
            end
        end
        
if self.numButtons then break end
    end
    
    table
.sort(tmp, function(ab) if self.growRight then return RemainingComparer(ab) else return ReversalRemainingComparer(abend end)
    if 
not IsTable(timers) or #timers < self.numButtons then
        
self.trackers[trackerID].timers = {}
    
end
    
    local numRows 
1;
    for 
iv in ipairs(tmp) do
        
local timers self.trackers[trackerID].timers;
        if(
not timers[i]) then
            timers
[i] = {}
        
end
        
        local cd 
unitCDs[v.spellID]
        if(
cd and cd.cdIDthen
            
if(not timers[i].timerthen
                timers
[i].timer CreateTimer(self)
            
end
            
            local t 
timers[i].timer;
            
CooldownFrame_SetTimer(timers[i].timer.cooldowncd.startTimecd.duration1)
            
t.trackerID trackerID;
            
t.cdID cd.cdID;
            
t.unitGUID cd.srcGUID;
            
t.spellID cd.spellID;
            
t:SetParent(self)
            
t:ClearAllPoints();
            
t:SetSize(self.iconSizeself.iconSize);
            
t:SetAlpha(self.alpha);
            if(
== 1then
                t
:SetPoint(self.pointself.relativeFrameself.relativePointself.ofsxself.ofsy)
            else
                
local row ceil(self.rows);
                if(
numRows ~= rowthen
                    
if self.growY=="UP" then
                        t
:SetPoint("BOTTOM"timers[i-self.rows].timer"TOP"0self.space)
                    elseif 
self.growY=="DOWN" then
                        t
:SetPoint("TOP"timers[i-self.rows].timer"BOTTOM"0, -self.space)
                    
end
                    numRows 
row;
                else
                    if 
self.growX=="LEFT" then
                        t
:SetPoint("RIGHT"timers[i-1].timer"LEFT", -self.space0)
                    elseif 
self.growX=="RIGHT" then
                        t
:SetPoint("LEFT"timers[i-1].timer"RIGHT"self.space0)
                    
end
                end
            end
            
            local spellID 
cd.spellID;
            if(
spellID == 59752 or spellID == 42292 or spellID == 7744then
                t
.icon:SetTexture(GetTrinketIcon(trackerID));
            else
                
t.icon:SetTexture(cd.spellIcon);
            
end
                t
.icon:SetTexCoord(0.070.930.070.93);
            
t:Show();
        
end
    end
end

function uf.OnTimerUpdate(frame)
    
local u frame.cds[this.unitGUID];
    if 
not u or not u[this.spellIDthen
        UpdateTracker
(framethis.trackerID)
        return
    
end
    
    local cd 
u[this.spellID]
    
local currentTime GetTime()
    if 
currentTime cd.endTime then
        UpdateTracker
(framethis.trackerID)
        return
    
end
    cd
.elapsed currentTime cd.startTime
    cd
.remaining cd.duration cd.elapsed
    this
.timeText:SetText(Time(cd.remaining))
end

local 
function Update(selfevent)
        
    if 
event=="COMBAT_LOG_EVENT_UNFILTERED" then
        
if UnitExists(self.unit) and arg3~=UnitGUID(self.unitthen return end
        local isPlayer 
= (arg3 == UnitGUID("player")) and false;
        if(
not arg3 or isPlayerthen return; end
        
-- print(self.unit)
        if(
arg2 == "SPELL_CAST_SUCCESS"then
            
if not arg9 then return end
            local cdID 
arg3 .. "." .. arg9
            local spell 
spellBase[arg9]
            if 
not IsTable(spellthen return end
            
if IsTable(spell[4]) then
                
for _sid in pairs(spell[4]) do
                    if 
== -1 then
                        RemoveCDsByUnitSpell
(selfarg3, -1)
                        do break 
end
                    
elseif sid 0 then
                        RemoveCDsByUnitSpell
(selfarg3sid)
                    
end
                end
            end
            RegisterCD
(selfarg3arg4arg5arg9)
            for 
kv in pairs(self.trackers) do
                
local tabID self.np[k].tabID
                local activeGUID 
= (ToNumber(tabID) < 0) and v.unitGUID or tabID
                
-- print(arg3activeGUID)
                if 
arg3 == activeGUID then
                    UpdateTracker
(selfk)
                
end
            end
        end
        
        
elseif event=="UNIT_SPELLCAST_SUCCEEDED" then
        
if arg1~=self.unit then return end
        local unitGUID 
UnitGUID(arg1)
        
local playerGUID UnitGUID("player")
        if 
not unitGUID or unitGUID == playerGUID or UnitIsDead(arg1) or not UnitPlayerControlled(arg1then
            
return
        
end
        
for k_ in pairs(self.np) do
            
local currentTime GetTime()
            
local _unitClass UnitClass(arg1)
            
local unitName UnitName(arg1)
                
self.np[k].units[unitGUID] = {unitGUID unitGUIDunitName unitNameunitClass unitClasstime currentTime}
        
end
        
-- print(arg1unitGUID)
        
self.trackers[arg1].unitGUID unitGUID
        UpdateTracker
(selfarg1)
    
end
end

local  
function Enable(self)
if 
not self.trackers then return end
    self
:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED"Update)
    
self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED"Update)
end

local 
function Disable(self)
if 
not self.trackers then return end
    self
:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED"Update)
    
self:UnregisterEvent("UNIT_SPELLCAST_SUCCEEDED"Update)
end

uf
:AddElement('Cooldowns'UpdateEnableDisable
ничеси оО, и куда это нада вписать? yao-ming-fuck-that