Language:
Lua     Change language:
Pastebin: 110480
Author: Shestak
Subject: sFilter2
Created: 2009-03-19 10:58:58
Download and save
Toggle line numbers
1local configmode = 0; -- 1=an, 0=off (Im Configmodus kann man die Zauber InGame mit Shift+Alt+Linke Maustaste verschieben) 
2 
3local class = select(2, UnitClass("player")); -- Need, nicht weg machen. :D 
4local classcolor = RAID_CLASS_COLORS[class]; -- Leiste in Klassenfarbe 
5--local classcolor = { r=1, g=1, b=1 }; -- Eigene Leistenfarbe 
6 
7local sFilter_Spells = { 
8    ["MAGE"] = { 
9        -- Ул~C~G~Hенн~Kй ожог 
10        --{ spellId = 11095, barWidth = 201.5, barIcon = 2, barSpellname = 1, size = 15, scale = 1, unitId = "target", isMine = "all", filter = "HARMFUL", alpha = { 1, 0 }, setPoint = { "TOPLEFT", oUF_Target, "BOTTOMLEFT", 212, -30 } }, 
11        -- ~_~C~B~L огн~O 
12        --{ spellId = 44445, barWidth = 201.5, barIcon = 2, barSpellname = 1, size = 15, scale = 1, unitId = "player", isMine = 1, filter = "HELPFUL", alpha = { 1, 0 }, setPoint = { "TOPLEFT", oUF_Target, "BOTTOMLEFT", -11, -70 } }, 
13        -- ~Vива~O бомба 
14        --{ spellId = 44457, barWidth = 201.5, barIcon = 2, barSpellname = 1, size = 15, scale = 1, unitId = "target", isMine = 1, filter = "HARMFUL", alpha = { 1, 0 }, setPoint = { "TOPLEFT", oUF_Target, "BOTTOMLEFT", 212, -13 } }, 
15 
16        -- ~_~@ев~@а~Iение 
17        { spellId = 118, barWidth = 187, barIcon = 2, barSpellname = 1, size = 13, scale = 1, unitId = "focus", isMine = 1, filter = "HARMFUL", alpha = { 1, 0 }, setPoint = { "TOPLEFT", oUF_Focus, "BOTTOMLEFT", -105, -30 } }
18 
19 
20        -- ~Wимн~O~O ~A~B~Cжа 
21        { spellId = 12579, barWidth = 195, barIcon = 2, barSpellname = 1, size = 15, scale = 1, unitId = "target", isMine = 1, filter = "HARMFUL", alpha = { 1, 0 }, setPoint = { "TOPLEFT", oUF_Target, "BOTTOMLEFT", 212, -30 } }
22        -- ~[ед~Oна~O ~A~B~@ела 
23        { spellId = 116, barWidth = 195, barIcon = 2, barSpellname = 1, size = 15, scale = 1, unitId = "target", isMine = 1, filter = "HARMFUL", alpha = { 1, 0 }, setPoint = { "TOPLEFT", oUF_Target, "BOTTOMLEFT", 212, -13 } }
24        -- ~[ед~Oной ~Cк~C~A 
25        { spellId = 11071, barWidth = 195, barIcon = 2, barSpellname = 1, size = 15, scale = 1, unitId = "target", isMine = 1, filter = "HARMFUL", alpha = { 1, 0 }, setPoint = { "TOPLEFT", oUF_Target, "BOTTOMLEFT", 212, 4 } }
26        -- ~Zол~L~Fо л~Lда 
27        { spellId = 122, barWidth = 195, barIcon = 2, barSpellname = 1, size = 15, scale = 1, unitId = "target", isMine = 1, filter = "HARMFUL", alpha = { 1, 0 }, setPoint = { "TOPLEFT", oUF_Target, "BOTTOMLEFT", 212, 24 } }
28    }
29    ["WARLOCK"] = { 
30        -- ~Xзгнание 
31        { spellId = 710, barWidth = 187, barIcon = 2, barSpellname = 1, size = 13, scale = 1, unitId = "focus", isMine = 1, filter = "HARMFUL", alpha = { 1, 0 }, setPoint = { "TOPLEFT", oUF_Focus, "BOTTOMLEFT", -105, -30 } }
32        -- С~B~@а~E 
33        { spellId = 5782, barWidth = 187, barIcon = 2, barSpellname = 1, size = 13, scale = 1, unitId = "focus", isMine = 1, filter = "HARMFUL", alpha = { 1, 0 }, setPoint = { "TOPLEFT", oUF_Focus, "BOTTOMLEFT", -105, -45 } }
34 
35 
36        -- ~_о~@~Gа 
37        { spellId = 172, barWidth = 195, barIcon = 2, barSpellname = 1, size = 15, scale = 1, unitId = "target", isMine = 1, filter = "HARMFUL", alpha = { 1, 0 }, setPoint = { "TOPLEFT", oUF_Target, "BOTTOMLEFT", 212, -30 } }
38        -- ~Vе~@~Bвенн~Kй огон~L 
39        { spellId = 348, barWidth = 195, barIcon = 2, barSpellname = 1, size = 15, scale = 1, unitId = "target", isMine = 1, filter = "HARMFUL", alpha = { 1, 0 }, setPoint = { "TOPLEFT", oUF_Target, "BOTTOMLEFT", 212, -13 } }
40        -- ~_~@окл~O~Bие агонии 
41        { spellId = 980, barWidth = 195, barIcon = 2, barSpellname = 1, size = 15, scale = 1, unitId = "target", isMine = 1, filter = "HARMFUL", alpha = { 1, 0 }, setPoint = { "TOPLEFT", oUF_Target, "BOTTOMLEFT", 212, 4 } }
42        -- Сем~O по~@~Gи 
43        { spellId = 27243, barWidth = 195, barIcon = 2, barSpellname = 1, size = 15, scale = 1, unitId = "target", isMine = 1, filter = "HARMFUL", alpha = { 1, 0 }, setPoint = { "TOPLEFT", oUF_Target, "BOTTOMLEFT", 212, 21 } }
44        -- ~_~@окл~O~Bие ~A~Bи~Eий 
45        { spellId = 1490, barWidth = 195, barIcon = 2, barSpellname = 1, size = 15, scale = 1, unitId = "target", isMine = 1, filter = "HARMFUL", alpha = { 1, 0 }, setPoint = { "TOPLEFT", oUF_Target, "BOTTOMLEFT", 212, 4 } }
46        -- ~_~@окл~O~Bие ~@ока 
47        { spellId = 603, barWidth = 195, barIcon = 2, barSpellname = 1, size = 15, scale = 1, unitId = "target", isMine = 1, filter = "HARMFUL", alpha = { 1, 0 }, setPoint = { "TOPLEFT", oUF_Target, "BOTTOMLEFT", 212, 4 } }
48        -- ~_~@окл~O~Bие ~@ока 
49        --{ spellId = 603, barWidth = 195, barIcon = 2, barSpellname = 1, size = 15, scale = 1, unitId = "target", isMine = 1, filter = "HARMFUL", alpha = { 1, 0 }, setPoint = { "TOPLEFT", oUF_Target, "BOTTOMLEFT", 212, 72 } }, 
50    }
51    ["DRUID"] = { 
52        -- ~Vизне~Fве~B 
53        { spellId = 33763, barWidth = 195, barIcon = 2, barSpellname = 1, size = 15, scale = 1, unitId = "target", isMine = 1, filter = "HELPFUL", alpha = { 1, 0 }, setPoint = { "TOPLEFT", oUF_Target, "BOTTOMLEFT", 212, -30 } }
54        -- ~^моложение 
55        { spellId = 774, barWidth = 195, barIcon = 2, barSpellname = 1, size = 15, scale = 1, unitId = "target", isMine = 1, filter = "HELPFUL", alpha = { 1, 0 }, setPoint = { "TOPLEFT", oUF_Target, "BOTTOMLEFT", 212, -13 } }
56        -- ~Rо~A~A~Bановление 
57        { spellId = 8936, barWidth = 195, barIcon = 2, barSpellname = 1, size = 15, scale = 1, unitId = "target", isMine = 1, filter = "HELPFUL", alpha = { 1, 0 }, setPoint = { "TOPLEFT", oUF_Target, "BOTTOMLEFT", 212, 4 } }
58        -- ~Q~Cйн~Kй ~@о~A~B 
59        { spellId = 48438, barWidth = 195, barIcon = 2, barSpellname = 1, size = 15, scale = 1, unitId = "target", isMine = 1, filter = "HELPFUL", alpha = { 1, 0 }, setPoint = { "TOPLEFT", oUF_Target, "BOTTOMLEFT", 212, 21 } }
60        -- Сем~O жизни 
61        { spellId = 48500, barWidth = 195, barIcon = 2, barSpellname = 1, size = 15, scale = 1, unitId = "target", isMine = 1, filter = "HELPFUL", alpha = { 1, 0 }, setPoint = { "TOPLEFT", oUF_Target, "BOTTOMLEFT", 212, 38 } }
62    }
63}
64 
65local function sFilter_CreateFrame(data) 
66    local spellName, _, spellIcon = GetSpellInfo(data.spellId); 
67    local frame = CreateFrame("Frame", "sFilter_Bar_" .. data.unitId .. "_" .. data.spellId, UIParent); 
68    frame:SetWidth(data.size); 
69    frame:SetHeight(data.size); 
70    frame:SetScale(data.scale); 
71    frame:SetPoint(unpack(data.setPoint)); 
72    frame:RegisterEvent("UNIT_AURA"); 
73    frame:RegisterEvent("PLAYER_TARGET_CHANGED"); 
74    frame:RegisterEvent("PLAYER_ENTERING_WORLD"); 
75    if ( data.combatFader ) then 
76        frame:RegisterEvent("PLAYER_REGEN_DISABLED"); 
77    end 
78    frame:SetScript("OnEvent", function(self, event, ...) 
79        local unit = ...; 
80        if ( data.unitId == unit or event == "PLAYER_TARGET_CHANGED" or event == "PLAYER_ENTERING_WORLD" ) then 
81            self.found = false
82            self.fail = false
83            self:SetAlpha(1); 
84            for i=1, 40, 1 do 
85                local name, rank, icon, count, debuffType, duration, expirationTime, isMine, isStealable = UnitAura(data.unitId, i, data.filter); 
86                if ( data.stanceId and GetShapeshiftForm() ~= data.stanceId ) then 
87                    self.fail = true
88                    break
89                elseif ( ( data.isMine == "all" or isMine == data.isMine ) and ( name == GetSpellInfo(data.spellId) or ( data.spellId2 and name == GetSpellInfo(data.spellId2) ) or ( data.spellId3 and name == GetSpellInfo(data.spellId3) ) or ( data.spellId4 and name == GetSpellInfo(data.spellId4) ) or ( data.spellId5 and name == GetSpellInfo(data.spellId5) ) ) ) then 
90                    self.found = true
91                    if ( data.alpha and #data.alpha == 2 ) then 
92                        self:SetAlpha(data.alpha[1]); 
93                    end 
94                    self.icon:SetTexture(icon); 
95                    SetDesaturation(self.icon, nil); 
96                    self.count:SetText(count > 1 and count or ""); 
97                    self.spellname:SetText(( type(data.barSpellname) == "string" and data.barSpellname or name )); 
98                    if ( duration > 0 ) then 
99                        self.statusbar:SetMinMaxValues(0, duration); 
100                        self:SetScript("OnUpdate", function(self, elapsed) 
101                            self.statusbar:SetValue(expirationTime-GetTime()); 
102                            --self.time:SetFormattedText((expirationTime-GetTime() >= 60 and "%dm" or (expirationTime-GetTime() >= 10 and "%ds" or "%.1fs")), expirationTime-GetTime()); 
103                            self.time:SetFormattedText(SecondsToTimeAbbrev(expirationTime-GetTime())); 
104                            if ( self.statusbar:GetValue() == duration ) then 
105                                self.statusbar:SetValue(0); 
106                                self.count:SetText(""); 
107                                self.time:SetText(""); 
108                                self:SetScript("OnUpdate", nil); 
109                            end 
110                        end); 
111                    else 
112                        self.statusbar:SetMinMaxValues(0, 1); 
113                        self.statusbar:SetValue(1); 
114                        self.time:SetText(""); 
115                        self:SetScript("OnUpdate", nil); 
116                    end 
117                    break
118                end 
119            end 
120 
121            if ( not self.found ) then 
122                if ( data.alpha and #data.alpha == 2 ) then 
123                    self:SetAlpha(data.alpha[2]); 
124                end 
125                self.icon:SetTexture(spellIcon); 
126                SetDesaturation(self.icon, 1); 
127                self.statusbar:SetValue(0); 
128                self.count:SetText(""); 
129                self.time:SetText(""); 
130                self.spellname:SetText(( type(data.barSpellname) == "string" and data.barSpellname or spellName )); 
131                self:SetScript("OnUpdate", nil); 
132            end 
133            if ( self.fail or ( not InCombatLockdown() and not self.found and data.combatFader ) ) then 
134                if ( data.alpha and #data.alpha == 2 and data.alpha[1] == 0 ) then 
135                    self:SetAlpha(data.alpha[2]); 
136                else 
137                    self:SetAlpha(0); 
138                end 
139            end 
140        end 
141 
142        if ( event == "PLAYER_REGEN_DISABLED" ) then 
143            if ( not self.found and not self.fail ) then 
144                if ( data.alpha and #data.alpha == 2 ) then 
145                    self:SetAlpha(data.alpha[2]); 
146                else 
147                    self:SetAlpha(1); 
148                end 
149            end 
150            self:RegisterEvent("PLAYER_REGEN_ENABLED"); 
151        elseif ( event == "PLAYER_REGEN_ENABLED" ) then 
152            if ( not self.found and not self.fail ) then 
153                if ( data.alpha and #data.alpha == 2 and data.alpha[1] == 0 ) then 
154                    self:SetAlpha(data.alpha[2]); 
155                else 
156                    self:SetAlpha(0); 
157                end 
158            end 
159            self:UnregisterEvent(event); 
160        end 
161 
162        if ( configmode == 1 ) then 
163            self:SetAlpha(1); 
164        end 
165    end); 
166    if ( data.alpha and #data.alpha == 2 ) then 
167        frame:SetAlpha(data.alpha[2]); 
168    end 
169    frame:SetMovable(1); 
170    if ( configmode == 1 ) then 
171        frame:SetAlpha(1); 
172        frame:EnableMouse(1); 
173        frame:RegisterForDrag("LeftButton"); 
174        frame:SetScript("OnDragStart", function(self) 
175            if ( IsShiftKeyDown() and IsAltKeyDown() ) then 
176                self:StartMoving(); 
177            end 
178        end); 
179        frame:SetScript("OnDragStop", function(self) 
180            self:StopMovingOrSizing(); 
181        end); 
182    end 
183 
184    frame.icon = frame:CreateTexture(nil, "BACKGROUND"); 
185    frame.icon:SetAllPoints(frame); 
186    frame.icon:SetTexture(spellIcon); 
187    frame.icon:SetTexCoord(0.07, 0.93, 0.07, 0.93); 
188    SetDesaturation(frame.icon, 1); 
189 
190    frame.statusbar = CreateFrame("StatusBar", nil, frame); 
191    frame.statusbar:SetWidth(data.barWidth); 
192    frame.statusbar:SetHeight(data.size); 
193    frame.statusbar:SetStatusBarTexture("Interface\\Textures\\statusbarTex"); 
194    frame.statusbar:SetStatusBarColor(classcolor.r, classcolor.g, classcolor.b, 1); 
195    if ( data.barIcon == 1 ) then 
196        frame.statusbar:SetPoint("RIGHT", frame, "LEFT"); 
197    else 
198        frame.statusbar:SetPoint("LEFT", frame, "RIGHT"); 
199    end 
200    frame.statusbar:SetMinMaxValues(0, 1); 
201    frame.statusbar:SetValue(0); 
202    frame.statusbar.background = frame.statusbar:CreateTexture(nil, "BACKGROUND"); 
203    frame.statusbar.background:SetAllPoints(); 
204    frame.statusbar.background:SetTexture("Interface\\Textures\\statusbarTex"); 
205    frame.statusbar.background:SetVertexColor(0.5, 0.5, 0.5, 0.7); 
206 
207    frame.count = frame:CreateFontString(nil, "ARTWORK"); 
208    frame.count:SetFont('Fonts\\skurri.ttf', 8, 'OUTLINE'
209    frame.count:SetPoint("BOTTOMRIGHT"); 
210    frame.count:SetJustifyH("RIGHT"); 
211 
212    frame.time = frame.statusbar:CreateFontString(nil, "ARTWORK"); 
213    frame.time:SetFont('Fonts\\skurri.ttf', 8, 'OUTLINE'
214    frame.time:SetPoint("RIGHT", frame.statusbar, -2, 0); 
215 
216    if ( data.barSpellname ) then 
217        frame.spellname = frame.statusbar:CreateFontString(nil, "ARTWORK"); 
218        frame.spellname:SetFont('Fonts\\skurri.ttf', 8, 'OUTLINE'
219        frame.spellname:SetPoint("LEFT", frame.statusbar, 2, 0); 
220        frame.spellname:SetPoint("RIGHT", frame.time, "LEFT"); 
221        frame.spellname:SetJustifyH("CENTER"); 
222        frame.spellname:SetText(( type(data.barSpellname) == "string" and data.barSpellname or spellName )); 
223    end 
224end 
225 
226if ( sFilter_Spells and sFilter_Spells[class] ) then 
227    for index in pairs(sFilter_Spells) do 
228        if ( index ~= class ) then 
229            sFilter_Spells[index] = nil
230        end 
231    end 
232    for i=1, #sFilter_Spells[class], 1 do 
233        sFilter_CreateFrame(sFilter_Spells[class][i]); 
234    end 
235end 
236 
Download and save
Toggle line numbers
Thread:
[110480] sFilter2 by Shestak at 2009-03-19 10:58:58
  [136306] гадания, привороты by gadals at 2010-05-10 05:11:08 (diff)
  [137461] Юридические услуги by nerkas at 2010-06-08 12:42:05 (diff)
  [137608] Возьму кредит или заем by vergtun at 2010-06-12 00:30:12 (diff)
  [137866] Делаю сайты в Харькове by propbirj at 2010-06-20 01:13:57 (diff)
Tip: Click the line numbers to toggle highliting on that line.

Paste followup:

Language:
Author:
Subject:


    Tabstop:     bigger biggest
Note: You can prefix a line with "@@@" to highlight it.