vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 function GetStrTime(time)
2 local min, sec;
3 if ( time >= 60 ) then
4 min = floor(time/60);
5 sec = time - min*60;
6 else
7 sec = time;
8 min = 0;
9 end
10 if ( sec <= 9 ) then sec = "0" .. sec; end
11 if ( min <= 9 ) then min = "0" .. min; end
12 return min .. ":" .. sec;
13 end
14  
15 function CT_MiniBuffs_Update(elapsed)
16 if ( elapsed ) then
17 this.update = this.update + elapsed;
18 if ( this.update < 1 ) then return; end
19 end
20 if ( elapsed ) then
21 this.update = this.update - 1;
22 end
23 local i;
24 for i = 0, 23, 1 do
25 local filter, offset;
26 if ( i <= 15 ) then
27 filter = "HELPFUL";
28 offset = 0;
29 else
30 filter = "HARMFUL";
31 offset = 16;
32 end
33 local bIndex, untilCancelled = GetPlayerBuff( i-offset, filter );
34 local buffname;
35 if ( not CT_BuffNames[i] ) then
36 buffname = CT_GetBuffName( "player", i-offset, filter );
37 CT_BuffNames[i] = buffname;
38 else
39 buffname = CT_BuffNames[i];
40 end
41 if ( bIndex >= 0 ) then
42 local timeLeft = GetPlayerBuffTimeLeft(bIndex);
43 if ( floor(timeLeft) >= MinBuffDurationExpireMessage and not CT_ExpireBuffs[buffname] ) then
44 CT_ExpireBuffs[buffname] = 1;
45 end
46  
47 if ( timeLeft <= ExpireMessageTime and CT_ExpireBuffs[buffname] and CT_BuffIsDebuff(bIndex) == 0 ) then
48 if ( CT_ShowExpire == 1 ) then
49 if ( CT_PlaySound == 1 ) then
50 PlaySound("TellMessage");
51 end
52 CT_BuffMod_AddToQueue(buffname);
53 local message;
54 if ( CT_PlayerSpells[buffname] and GetBindingKey("CT_RECASTBUFF") ) then
55 message = format(ExpireMessageRecastString, buffname, GetBindingText(GetBindingKey("CT_RECASTBUFF"), "KEY_"));
56 else
57 message = format(ExpireMessageString, buffname);
58 end
59 ExpireMessageFrame:AddMessage(message, ExpireMessageColors["r"], ExpireMessageColors["g"], ExpireMessageColors["b"]);
60 end
61 CT_ExpireBuffs[buffname] = nil;
62 CT_BuffNames[this:GetID()] = nil;
63 end
64 end
65 end
66 end
67  
68 CT_oldBuffButton_OnUpdate = BuffButton_OnUpdate;
69 function CT_newBuffButton_OnUpdate()
70 CT_oldBuffButton_OnUpdate();
71 local buffIndex = this.buffIndex;
72 if ( buffIndex >= 0 ) then
73 local timeLeft = GetPlayerBuffTimeLeft(buffIndex);
74 getglobal(this:GetName() .. "Duration"):SetText(GetStrTime(floor(timeLeft)));
75 end
76 end
77 BuffButton_OnUpdate = CT_newBuffButton_OnUpdate;