Language:
Lua     Change language:
Pastebin: 112736
Author: Saone
Subject: Re: TellMeWhen 3.1 update
Created: 2009-04-20 21:32:22
Download and save
Toggle line numbers
1-- -------------------- 
2-- TellMeWhen 
3-- by Nephthys of Hyjal 
4-- Updated by Saone of Llane for 3.1 Unit Aura changes. 
5-- -------------------- 
6 
7 
8-- ------------- 
9-- ADDON GLOBALS 
10-- ------------- 
11 
12TellMeWhen = {}
13 
14TELLMEWHEN_VERSION = "1.1"
15TELLMEWHEN_MAXGROUPS = 4
16TELLMEWHEN_MAXROWS = 7
17TELLMEWHEN_ICONSPACING = 2
18TELLMEWHEN_UPDATE_INTERVAL = 0.2
19 
20TellMeWhen_Icon_Defaults = { 
21    BuffOrDebuff        = "HELPFUL"
22    BuffShowWhen        = "present"
23    CooldownShowWhen    = "usable"
24    CooldownType        = "spell"
25    Enabled             = true
26    Name                = ""
27    OnlyMine            = false
28    ShowTimer           = false
29    Type                = ""
30    Unit                = "player"
31    WpnEnchantType      = "mainhand"
32}
33 
34TellMeWhen_Group_Defaults = { 
35    Enabled         = false
36    Scale           = 2.0
37    Rows            = 1
38    Columns         = 4
39    Icons           = {}
40    OnlyInCombat    = false
41}
42for iconID = 1, TELLMEWHEN_MAXROWS*TELLMEWHEN_MAXROWS do 
43    TellMeWhen_Group_Defaults["Icons"][iconID] = TellMeWhen_Icon_Defaults; 
44end
45 
46TellMeWhen_Defaults = { 
47    Version         =   TELLMEWHEN_VERSION, 
48    Locked          =   false
49    Groups          =   {}
50}
51for groupID = 1, TELLMEWHEN_MAXGROUPS do 
52    TellMeWhen_Defaults["Groups"][groupID] = TellMeWhen_Group_Defaults; 
53end 
54 
55--  TellMeWhen_Settings_Metatable = {}; 
56--  TellMeWhen_Settings_Metatable.__index = TellMeWhen_Defaults; 
57 
58function TellMeWhen_Test(stuff) 
59    if ( stuff ) then 
60        DEFAULT_CHAT_FRAME:AddMessage("TellMeWhen test: "..stuff); 
61    else 
62        DEFAULT_CHAT_FRAME:AddMessage("TellMeWhen test: "..this:GetName()); 
63    end 
64end 
65 
66 
67 
68 
69-- --------------- 
70-- EXECUTIVE FRAME 
71-- --------------- 
72 
73function TellMeWhen_OnEvent(self, event) 
74    if ( event == 'VARIABLES_LOADED' ) then 
75        SlashCmdList["TELLMEWHEN"] = TellMeWhen_SlashCommand; 
76        SLASH_TELLMEWHEN1 = "/tellmewhen"
77        SLASH_TELLMEWHEN2 = "/tmw"
78        if ( not TellMeWhen_Settings ) then 
79            TellMeWhen_Settings = CopyTable(TellMeWhen_Defaults); 
80            TellMeWhen_Settings["Groups"][1]["Enabled"] = true
81        elseif ( TellMeWhen_Settings["Version"] < TELLMEWHEN_VERSION ) then 
82            TellMeWhen_SafeUpgrade(); 
83        end 
84    elseif ( event == "PLAYER_LOGIN" ) then 
85        -- initialization needs to be late enough that the icons can find their textures 
86        TellMeWhen_Update(); 
87    end 
88end 
89 
90function TellMeWhen_SafeUpgrade() 
91    TellMeWhen_Settings = TellMeWhen_AddNewSettings(TellMeWhen_Settings, TellMeWhen_Defaults); 
92    TellMeWhen_Settings["Version"] = TELLMEWHEN_VERSION; 
93end 
94 
95function TellMeWhen_AddNewSettings(settings, defaults) 
96    for k, v in pairs(defaults) do 
97        if ( not settings[k] ) then 
98            if ( type(v) == "table" ) then 
99                settings[k] = {}
100                settings[k] = TellMeWhen_AddNewSettings(settings[k], defaults[k]); 
101            else 
102                settings[k] = v; 
103            end 
104 
105        --[[ 
106        elseif ( type(v) == "table" ) and ( type(settings[k]) ~= "table" ) then 
107            local oldSetting = settings[k]; 
108            settings[k] = {}; 
109            settings[k][1] = oldSetting; 
110            --  settings[k] = {settings[k]}; 
111        --]] 
112 
113        elseif ( type(v) == "table" ) then 
114            settings[k] = TellMeWhen_AddNewSettings(settings[k], defaults[k]); 
115        end 
116    end 
117    return settings; 
118end 
119 
120function TellMeWhen_Update() 
121    for groupID = 1, TELLMEWHEN_MAXGROUPS do 
122        TellMeWhen_Group_Update(groupID); 
123    end 
124end 
125 
126do 
127    local executiveFrame = CreateFrame("Frame", "TellMeWhen_ExecutiveFrame"); 
128    executiveFrame:SetScript("OnEvent", TellMeWhen_OnEvent); 
129    executiveFrame:RegisterEvent("VARIABLES_LOADED"); 
130    executiveFrame:RegisterEvent("PLAYER_LOGIN"); 
131end 
132 
133 
134 
135-- ----------- 
136-- GROUP FRAME 
137-- ----------- 
138 
139function TellMeWhen_Group_OnEvent(self, event) 
140    -- called if OnlyInCombat true for this group 
141    if ( event == "PLAYER_REGEN_DISABLED" ) then 
142        self:Show(); 
143    elseif ( event == "PLAYER_REGEN_ENABLED" ) then 
144        self:Hide(); 
145    end 
146end 
147 
148function TellMeWhen_Group_Update(groupID) 
149    local groupName = "TellMeWhen_Group"..groupID; 
150    local group = getglobal(groupName); 
151    local resizeButton = getglobal(groupName.."_ResizeButton"); 
152 
153    local locked = TellMeWhen_Settings["Locked"]; 
154    local enabled = TellMeWhen_Settings["Groups"][groupID]["Enabled"]; 
155    local scale = TellMeWhen_Settings["Groups"][groupID]["Scale"]; 
156    local rows = TellMeWhen_Settings["Groups"][groupID]["Rows"]; 
157    local columns = TellMeWhen_Settings["Groups"][groupID]["Columns"]; 
158    local onlyInCombat = TellMeWhen_Settings["Groups"][groupID]["OnlyInCombat"]; 
159 
160    for row = 1, rows do 
161        for column = 1, columns do 
162            local iconID = (row-1)*columns + column; 
163            local iconName = groupName.."_Icon"..iconID; 
164            local icon = getglobal(iconName) or CreateFrame("Frame", iconName, group, "TellMeWhen_IconTemplate"); 
165            icon:SetID(iconID); 
166            icon:Show(); 
167            if ( column > 1 ) then 
168                icon:SetPoint("TOPLEFT", getglobal(groupName.."_Icon"..(iconID-1)), "TOPRIGHT", TELLMEWHEN_ICONSPACING, 0); 
169            elseif ( row > 1 ) and ( column == 1 ) then 
170                icon:SetPoint("TOPLEFT", getglobal(groupName.."_Icon"..(iconID-columns)), "BOTTOMLEFT", 0, -TELLMEWHEN_ICONSPACING); 
171            elseif ( iconID == 1 ) then 
172                icon:SetPoint("TOPLEFT", group, "TOPLEFT"); 
173            end 
174            TellMeWhen_Icon_Update(icon, groupID, iconID); 
175            if ( not enabled ) then 
176                TellMeWhen_Icon_ClearScripts(icon); 
177            end 
178        end 
179    end 
180    for iconID = rows*columns+1, TELLMEWHEN_MAXROWS*TELLMEWHEN_MAXROWS do 
181        local icon = getglobal(groupName.."_Icon"..iconID); 
182        if icon then 
183            icon:Hide(); 
184            TellMeWhen_Icon_ClearScripts(icon); 
185        end 
186    end 
187 
188    group:SetScale(scale); 
189    local lastIcon = groupName.."_Icon"..(rows*columns); 
190    resizeButton:SetPoint("BOTTOMRIGHT", lastIcon, "BOTTOMRIGHT", 3, -3); 
191    if ( locked ) then 
192        resizeButton:Hide(); 
193    else 
194        resizeButton:Show(); 
195    end 
196 
197    if ( onlyInCombat and enabled and locked ) then 
198        group:RegisterEvent("PLAYER_REGEN_ENABLED"); 
199        group:RegisterEvent("PLAYER_REGEN_DISABLED"); 
200        group:SetScript("OnEvent", TellMeWhen_Group_OnEvent); 
201        group:Hide(); 
202    else 
203        group:UnregisterEvent("PLAYER_REGEN_ENABLED"); 
204        group:UnregisterEvent("PLAYER_REGEN_DISABLED"); 
205        group:SetScript("OnEvent", nil); 
206        if ( enabled ) then 
207            group:Show(); 
208        else 
209            group:Hide(); 
210        end 
211    end 
212end 
213 
214 
215 
216-- ------------- 
217-- ICON FUNCTION 
218-- ------------- 
219 
220function TellMeWhen_Icon_Update(icon, groupID, iconID) 
221 
222    local iconSettings = TellMeWhen_Settings["Groups"][groupID]["Icons"][iconID]; 
223 
224    local enabled = iconSettings.Enabled; 
225    local type = iconSettings.Type; 
226    local cooldownType = iconSettings.CooldownType; 
227    local cooldownShowWhen = iconSettings.CooldownShowWhen; 
228    local buffShowWhen = iconSettings.BuffShowWhen; 
229 
230    icon.name = iconSettings.Name; 
231    icon.unit = iconSettings.Unit; 
232    icon.showTimer = iconSettings.ShowTimer; 
233    icon.onlyMine = iconSettings.OnlyMine; 
234    icon.buffOrDebuff = iconSettings.BuffOrDebuff; 
235    icon.wpnEnchantType = iconSettings.WpnEnchantType; 
236 
237    icon.updateTimer = TELLMEWHEN_UPDATE_INTERVAL; 
238 
239    icon.texture = getglobal(icon:GetName().."Texture"); 
240    icon.countText = getglobal(icon:GetName().."Count"); 
241    icon.cooldown = getglobal(icon:GetName().."Cooldown"); 
242 
243    icon:UnregisterEvent("ACTIONBAR_UPDATE_USABLE"); 
244    icon:UnregisterEvent("PLAYER_TARGET_CHANGED"); 
245    icon:UnregisterEvent("PLAYER_FOCUS_CHANGED"); 
246    icon:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED"); 
247    icon:UnregisterEvent("UNIT_INVENTORY_CHANGED"); 
248    icon:UnregisterEvent("ACTIONBAR_UPDATE_COOLDOWN"); 
249    icon:UnregisterEvent("BAG_UPDATE_COOLDOWN"); 
250 
251    -- used by both cooldown and reactive icons 
252    if ( cooldownShowWhen == "usable" ) then 
253        icon.usableAlpha = 1
254        icon.unusableAlpha = 0
255    else 
256        icon.usableAlpha = 0
257        icon.unusableAlpha = 1
258    end 
259 
260    -- used by both buff/debuff and wpnenchant icons 
261    if ( buffShowWhen == "present" ) then 
262        icon.presentAlpha = 1
263        icon.absentAlpha = 0
264    else 
265        icon.presentAlpha = 0
266        icon.absentAlpha = 1
267    end 
268 
269    if ( type == "cooldown" ) then 
270        if ( cooldownType == "spell" ) then 
271            if ( GetSpellCooldown(icon.name) ) then 
272                icon.texture:SetTexture(GetSpellTexture(icon.name)); 
273                icon:SetScript("OnUpdate", TellMeWhen_Icon_SpellCooldown_OnUpdate); 
274                if (icon.showTimer) then 
275                    icon:RegisterEvent("ACTIONBAR_UPDATE_COOLDOWN"); 
276                    icon:SetScript("OnEvent", TellMeWhen_Icon_SpellCooldown_OnEvent); 
277                else 
278                    icon:SetScript("OnEvent", nil); 
279                end 
280            else 
281                TellMeWhen_Icon_ClearScripts(icon); 
282                icon.texture:SetTexture("Interface\\Icons\\INV_Misc_QuestionMark"); 
283            end 
284        elseif ( cooldownType == "item" ) then 
285            local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture = GetItemInfo(icon.name); 
286            if ( itemName ) then 
287                icon.texture:SetTexture(itemTexture); 
288                icon:SetScript("OnUpdate", TellMeWhen_Icon_ItemCooldown_OnUpdate); 
289                if (icon.showTimer) then 
290                    icon:RegisterEvent("BAG_UPDATE_COOLDOWN"); 
291                    icon:SetScript("OnEvent", TellMeWhen_Icon_ItemCooldown_OnEvent); 
292                else 
293                    icon:SetScript("OnEvent", nil); 
294                end 
295            else 
296                TellMeWhen_Icon_ClearScripts(icon); 
297                icon.learnedTexture = false
298                icon.texture:SetTexture("Interface\\Icons\\INV_Misc_QuestionMark"); 
299            end 
300        end 
301        icon.cooldown:SetReverse(false); 
302 
303    elseif ( type == "buff" ) then 
304 
305        icon:RegisterEvent("PLAYER_TARGET_CHANGED"); 
306        icon:RegisterEvent("PLAYER_FOCUS_CHANGED"); 
307        icon:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED"); 
308        icon:SetScript("OnEvent", TellMeWhen_Icon_Buff_OnEvent); 
309        icon:SetScript("OnUpdate", nil); 
310 
311        if ( icon.name == "" ) then 
312            icon.texture:SetTexture("Interface\\Icons\\INV_Misc_QuestionMark"); 
313        elseif ( GetSpellTexture(icon.name) ) then 
314            icon.texture:SetTexture(GetSpellTexture(icon.name)); 
315        elseif ( not icon.learnedTexture ) then 
316            icon.texture:SetTexture("Interface\\Icons\\INV_Misc_PocketWatch_01"); 
317            icon.needsTexture = true
318        end 
319        icon.cooldown:SetReverse(true); 
320 
321    elseif ( type == "reactive" ) then 
322        if ( GetSpellTexture(icon.name) ) then 
323            icon.texture:SetTexture(GetSpellTexture(icon.name)); 
324            icon:RegisterEvent("ACTIONBAR_UPDATE_USABLE"); 
325            icon:SetScript("OnEvent", TellMeWhen_Icon_Reactive_OnEvent); 
326            icon:SetScript("OnUpdate", nil); 
327        else 
328            TellMeWhen_Icon_ClearScripts(icon); 
329            icon.learnedTexture = false
330            icon.texture:SetTexture("Interface\\Icons\\INV_Misc_QuestionMark"); 
331        end 
332 
333    elseif ( type == "wpnenchant" ) then 
334        icon:RegisterEvent("UNIT_INVENTORY_CHANGED"); 
335        local slotID, textureName; 
336        if ( icon.wpnEnchantType == "mainhand" ) then 
337            slotID, textureName = GetInventorySlotInfo("MainHandSlot"); 
338        elseif ( icon.wpnEnchantType == "offhand" ) then 
339            slotID, textureName = GetInventorySlotInfo("SecondaryHandSlot"); 
340        end 
341        local wpnTexture = GetInventoryItemTexture("player", slotID); 
342        if ( wpnTexture ) then 
343            icon.texture:SetTexture(wpnTexture); 
344            icon:SetScript("OnEvent", TellMeWhen_Icon_WpnEnchant_OnEvent); 
345            icon:SetScript("OnUpdate", TellMeWhen_Icon_WpnEnchant_OnUpdate); 
346        else 
347            TellMeWhen_Icon_ClearScripts(icon); 
348            icon.texture:SetTexture("Interface\\Icons\\INV_Misc_QuestionMark"); 
349        end 
350 
351    else 
352        TellMeWhen_Icon_ClearScripts(icon); 
353        if ( icon.name ~= "" ) then 
354            icon.texture:SetTexture("Interface\\Icons\\INV_Misc_QuestionMark"); 
355        else 
356            icon.texture:SetTexture(nil); 
357        end 
358    end 
359 
360    icon.countText:Hide(); 
361    icon.cooldown:Hide(); 
362 
363    if ( enabled ) then 
364        icon:SetAlpha(1.0); 
365    else 
366        icon:SetAlpha(0.4); 
367        TellMeWhen_Icon_ClearScripts(icon); 
368    end 
369 
370    icon:Show(); 
371    if ( TellMeWhen_Settings["Locked"] ) then 
372        icon:EnableMouse(0); 
373        if ( not enabled ) then 
374            icon:Hide(); 
375        elseif (icon.name == "") and ( type ~= "wpnenchant" ) then 
376            icon:Hide(); 
377        end 
378        TellMeWhen_Icon_StatusCheck(icon, type); 
379    else 
380        icon:EnableMouse(1); 
381        TellMeWhen_Icon_ClearScripts(icon); 
382    end 
383 
384end 
385 
386function TellMeWhen_Icon_ClearScripts(icon) 
387    icon:SetScript("OnEvent", nil); 
388    icon:SetScript("OnUpdate", nil); 
389end 
390 
391function TellMeWhen_Icon_StatusCheck(icon, type
392    -- this function is so OnEvent-based icons can do a check when the addon is locked 
393    if ( type == "reactive" ) then 
394        TellMeWhen_Icon_ReactiveCheck(icon); 
395    elseif ( type == "buff" ) then 
396        TellMeWhen_Icon_BuffCheck(icon); 
397    elseif ( type == "cooldown" ) then 
398        TellMeWhen_Icon_SpellCooldown_OnEvent(icon); 
399    end 
400end 
401 
402function TellMeWhen_Icon_SpellCooldown_OnEvent(self) 
403    local startTime, timeLeft, enabled = GetSpellCooldown(self.name); 
404    if ( timeLeft and timeLeft > 1.5 ) then 
405        CooldownFrame_SetTimer(self.cooldown, startTime, timeLeft, enabled); 
406    end 
407end 
408 
409function TellMeWhen_Icon_SpellCooldown_OnUpdate(self, elapsed) 
410    self.updateTimer = self.updateTimer - elapsed; 
411    if ( self.updateTimer <= 0 ) then 
412        self.updateTimer = TELLMEWHEN_UPDATE_INTERVAL; 
413        local startTime, timeLeft, enabled = GetSpellCooldown(self.name); 
414        if ( timeLeft > 1.5 ) then 
415            self:SetAlpha(self.unusableAlpha); 
416        elseif ( timeLeft == 0 ) then 
417            self:SetAlpha(self.usableAlpha); 
418        end 
419    end 
420end 
421 
422function TellMeWhen_Icon_ItemCooldown_OnEvent(self) 
423    local startTime, timeLeft, enabled = GetItemCooldown(self.name); 
424    if ( timeLeft > 1.5 ) then 
425        CooldownFrame_SetTimer(self.cooldown, startTime, timeLeft, enabled); 
426    end 
427end 
428 
429function TellMeWhen_Icon_ItemCooldown_OnUpdate(self, elapsed) 
430    self.updateTimer = self.updateTimer - elapsed; 
431    if ( self.updateTimer <= 0 ) then 
432        self.updateTimer = TELLMEWHEN_UPDATE_INTERVAL; 
433        local startTime, timeLeft, enabled = GetItemCooldown(self.name); 
434        if ( timeLeft > 1.5 ) then 
435            self:SetAlpha(self.unusableAlpha); 
436        elseif ( timeLeft == 0 ) then 
437            self:SetAlpha(self.usableAlpha); 
438        end 
439    end 
440end 
441 
442function TellMeWhen_Icon_Buff_OnEvent(self, event, ...) 
443    if ( event == "COMBAT_LOG_EVENT_UNFILTERED" ) then 
444--      local timestamp, combatEvent, srcGUID, srcName, srcFlags, dstGUID, dstName, dstFlags; 
445--      local spellID, spellName, spellSchool, auraType; 
446        local combatEvent = select(2, ...); 
447        if ( combatEvent == "SPELL_AURA_APPLIED"
448            or ( combatEvent == "SPELL_AURA_REMOVED"
449            or ( combatEvent == "SPELL_AURA_APPLIED_DOSE"
450            or ( combatEvent == "SPELL_AURA_REMOVED_DOSE"
451            or ( combatEvent == "SPELL_AURA_REFRESH"
452            or ( combatEvent == "SPELL_AURA_BROKEN"
453            or ( combatEvent == "SPELL_AURA_BROKEN_SPELL"
454        then 
455            local spellName = select(10, ...); 
456            if ( spellName == self.name ) then           -- could add check for unitGUID here, i guess.  meh.   
457                TellMeWhen_Icon_BuffCheck(self); 
458            end 
459        elseif ( combatEvent == "UNIT_DIED" ) then 
460            local dstGUID = select(6, ...); 
461            local watchedGUID = UnitGUID(self.unit); 
462            if ( dstGUID == watchedGUID ) then 
463                TellMeWhen_Icon_BuffCheck(self); 
464            end 
465        end 
466    elseif ( event == "PLAYER_TARGET_CHANGED" ) or ( event == "PLAYER_FOCUS_CHANGED" ) then 
467        TellMeWhen_Icon_BuffCheck(self); 
468    end 
469end 
470 
471function TellMeWhen_Icon_BuffCheck(icon) 
472    if ( UnitExists(icon.unit) ) then 
473--      local countText = getglobal(icon:GetName().."Count"); 
474 
475--      local buffName, rank, iconTexture, count, debuffType, duration, expirationTime, caster, isStealable; 
476        local buffName, _, iconTexture, count, _, duration, expirationTime, caster = UnitAura(icon.unit, icon.name, nil, icon.buffOrDebuff); 
477        if ( not buffName ) then 
478            icon:SetAlpha(icon.absentAlpha); 
479            icon.countText:Hide(); 
480            if ( icon.showTimer ) then 
481                CooldownFrame_SetTimer(icon.cooldown, 0, 0, 0); 
482            end 
483            return
484        elseif ( caster == 'player' or not icon.onlyMine ) then 
485            if ( icon.needsTexture ) then 
486                icon.texture:SetTexture(iconTexture); 
487                icon.learnedTexture = true
488                icon.needsTexture = nil
489            end 
490            icon:SetAlpha(icon.presentAlpha); 
491            if ( count > 1 ) then 
492                icon.countText:SetText(count); 
493                icon.countText:Show(); 
494            else 
495                icon.countText:Hide(); 
496            end 
497            if ( icon.showTimer ) then 
498                CooldownFrame_SetTimer(icon.cooldown, expirationTime - duration, duration, 1); 
499            end 
500            return
501        end 
502        icon:SetAlpha(icon.absentAlpha);    -- move along.  these aren't the buffs you're looking for.   
503    else 
504        icon:SetAlpha(0); 
505    end 
506end 
507 
508function TellMeWhen_Icon_Reactive_OnEvent(self, event) 
509    if ( event == "ACTIONBAR_UPDATE_USABLE" ) then 
510        TellMeWhen_Icon_ReactiveCheck(self); 
511    end 
512end 
513 
514function TellMeWhen_Icon_ReactiveCheck(icon) 
515    local usable, nomana = IsUsableSpell(icon.name); 
516    if ( usable ) then 
517        icon:SetAlpha(icon.usableAlpha); 
518    elseif ( not usable and not nomana ) then 
519        icon:SetAlpha(icon.unusableAlpha); 
520    end 
521end 
522 
523function TellMeWhen_Icon_WpnEnchant_OnEvent(self, event, ...) 
524    if ( event == "UNIT_INVENTORY_CHANGED" ) and ( select(1, ...) == "player" ) then 
525        local slotID, textureName; 
526        if ( self.wpnEnchantType == "mainhand" ) then 
527            slotID, textureName = GetInventorySlotInfo("MainHandSlot"); 
528        elseif ( self.wpnEnchantType == "offhand" ) then 
529            slotID, textureName = GetInventorySlotInfo("SecondaryHandSlot"); 
530        end 
531        local wpnTexture = GetInventoryItemTexture("player", slotID); 
532        if ( wpnTexture ) then 
533            self.texture:SetTexture(wpnTexture); 
534        else 
535            self.texture:SetTexture("Interface\\Icons\\INV_Misc_QuestionMark"); 
536        end 
537    end 
538end 
539 
540function TellMeWhen_Icon_WpnEnchant_OnUpdate(self, elapsed) 
541    self.updateTimer = self.updateTimer - elapsed; 
542    if ( self.updateTimer <= 0 ) then 
543        self.updateTimer = TELLMEWHEN_UPDATE_INTERVAL; 
544        local hasMainHandEnchant, mainHandExpiration, mainHandCharges, hasOffHandEnchant, offHandExpiration, offHandCharges = GetWeaponEnchantInfo(); 
545        if ( self.wpnEnchantType == "mainhand" ) and ( hasMainHandEnchant ) then 
546            self:SetAlpha(self.presentAlpha); 
547            if ( mainHandCharges > 1 ) then 
548                self.countText:SetText(mainHandCharges); 
549                self.countText:Show(); 
550            else 
551                self.countText:Hide(); 
552            end 
553        elseif ( self.wpnEnchantType == "offhand" ) and ( hasOffHandEnchant ) then 
554            self:SetAlpha(self.presentAlpha); 
555            if ( offHandCharges > 1 ) then 
556                self.countText:SetText(offHandCharges); 
557                self.countText:Show(); 
558            else 
559                self.countText:Hide(); 
560            end 
561        else 
562            self:SetAlpha(self.absentAlpha); 
563        end 
564    end 
565end 
566 
Download and save
Toggle line numbers
Thread:
[112735] TellMeWhen 3.1 update by Saone at 2009-04-20 21:31:41 (diff)
  [112736] Re: TellMeWhen 3.1 update by Saone at 2009-04-20 21:32:22
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.