vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | -- Init |
2 | CT_NUM_PARTY_BUFFS = 14; |
||
3 | CT_NUM_PARTY_DEBUFFS = 6; |
||
4 | CT_NUM_PET_BUFFS = 9; |
||
5 | CT_NUM_SHOWN_PARTY_BUFFS = 4; |
||
6 | CT_NUM_SHOWN_PET_BUFFS = 4; |
||
7 | CT_ShowPartyBuffs = 1; |
||
8 | CT_ShowPetBuffs = 1; |
||
9 | |||
10 | function CT_PartyBuffs_OnLoad() |
||
11 | getglobal("PetDebuff1"):SetPoint("TOPLEFT", "PetFrame", "TOPLEFT", 48, -59); |
||
12 | local frame = getglobal("PartyMemberFrame" .. this:GetID()); |
||
13 | this.oldHide = frame:GetScript("OnHide"); |
||
14 | this.oldShow = frame:GetScript("OnShow"); |
||
15 | frame:SetScript("OnShow", function() local frame = getglobal("CT_PartyBuffFrame" .. this:GetID()); if ( frame.oldShow ) then frame.oldShow(); end frame:Show() end); |
||
16 | frame:SetScript("OnHide", function() local frame = getglobal("CT_PartyBuffFrame" .. this:GetID()); if ( frame.oldHide ) then frame.oldHide(); end frame:Hide() end); |
||
17 | end |
||
18 | |||
19 | |||
20 | function CT_PartyBuffs_RefreshBuffs(elapsed) |
||
21 | this.update = this.update + elapsed; |
||
22 | if ( this.update > 0.5 ) then |
||
23 | this.update = 0.5 - this.update; |
||
24 | local i; |
||
25 | if ( CT_ShowPartyBuffs == 0 ) then |
||
26 | for i = 1, CT_NUM_PARTY_BUFFS, 1 do |
||
27 | getglobal(this:GetName() .. "Buff" .. i):Hide(); |
||
28 | end |
||
29 | return; |
||
30 | end |
||
31 | for i = 1, CT_NUM_PARTY_BUFFS, 1 do |
||
32 | if ( i > CT_NUM_SHOWN_PARTY_BUFFS ) then |
||
33 | getglobal(this:GetName() .. "Buff" .. i):Hide(); |
||
34 | else |
||
35 | local bufftexture = UnitBuff("party" .. this:GetID(), i); |
||
36 | if ( bufftexture ) then |
||
37 | getglobal(this:GetName() .. "Buff" .. i .. "Icon"):SetTexture(bufftexture); |
||
38 | getglobal(this:GetName() .. "Buff" .. i):Show(); |
||
39 | else |
||
40 | getglobal(this:GetName() .. "Buff" .. i):Hide(); |
||
41 | end |
||
42 | if ( i <= CT_NUM_PARTY_DEBUFFS ) then |
||
43 | local debufftexture, debuffApplications = UnitDebuff("party" .. this:GetID(), i); |
||
44 | if ( debufftexture ) then |
||
45 | if ( debuffApplications > 1 ) then |
||
46 | getglobal(this:GetName() .. "Debuff" .. i .. "Count"):SetText(debuffApplications); |
||
47 | else |
||
48 | getglobal(this:GetName() .. "Debuff" .. i .. "Count"):SetText(""); |
||
49 | end |
||
50 | getglobal(this:GetName() .. "Debuff" .. i .. "Icon"):SetTexture(debufftexture); |
||
51 | getglobal(this:GetName() .. "Debuff" .. i):Show(); |
||
52 | if ( i <= 4 ) then |
||
53 | getglobal("PartyMemberFrame" .. this:GetID() .. "Debuff" .. i):Hide(); |
||
54 | end |
||
55 | else |
||
56 | getglobal(this:GetName() .. "Debuff" .. i):Hide(); |
||
57 | end |
||
58 | end |
||
59 | end |
||
60 | end |
||
61 | end |
||
62 | end |
||
63 | |||
64 | function CT_PartyBuffs_RefreshPetBuffs(elapsed) |
||
65 | this.update = this.update + elapsed; |
||
66 | if ( this.update > 0.5 ) then |
||
67 | this.update = 0.5 - this.update |
||
68 | local i; |
||
69 | if ( CT_ShowPetBuffs == 0 ) then |
||
70 | for i = 1, CT_NUM_PET_BUFFS, 1 do |
||
71 | getglobal(this:GetName() .. "Buff" .. i):Hide(); |
||
72 | end |
||
73 | return; |
||
74 | end |
||
75 | for i = 1, CT_NUM_PET_BUFFS, 1 do |
||
76 | if ( i > CT_NUM_SHOWN_PET_BUFFS ) then |
||
77 | getglobal(this:GetName() .. "Buff" .. i):Hide(); |
||
78 | else |
||
79 | local bufftexture = UnitBuff("pet", i); |
||
80 | if ( bufftexture ) then |
||
81 | getglobal(this:GetName() .. "Buff" .. i .. "Icon"):SetTexture(bufftexture); |
||
82 | getglobal(this:GetName() .. "Buff" .. i):Show(); |
||
83 | else |
||
84 | getglobal(this:GetName() .. "Buff" .. i):Hide(); |
||
85 | end |
||
86 | end |
||
87 | end |
||
88 | end |
||
89 | end |
||
90 | |||
91 | PartyBuffsFunction = function (modId, text) |
||
92 | local val = CT_Mods[modId]["modValue"]; |
||
93 | if ( val == "1" ) then |
||
94 | val = "2"; |
||
95 | CT_ShowPartyBuffs = 1; |
||
96 | CT_ShowPetBuffs = 0; |
||
97 | elseif ( val == "2" ) then |
||
98 | val = "3"; |
||
99 | CT_ShowPartyBuffs = 0; |
||
100 | CT_ShowPetBuffs = 1; |
||
101 | elseif ( val == "3" ) then |
||
102 | val = "4"; |
||
103 | CT_ShowPartyBuffs = 0; |
||
104 | CT_ShowPetBuffs = 0; |
||
105 | elseif ( val == "4" ) then |
||
106 | val = "1"; |
||
107 | CT_ShowPartyBuffs = 1; |
||
108 | CT_ShowPetBuffs = 1; |
||
109 | end |
||
110 | |||
111 | if ( text and val ) then text:SetText(val); end |
||
112 | CT_Mods[modId]["modValue"] = val; |
||
113 | CT_Print("<CTMod> " .. CT_PARTYBUFFS_TOGGLE[val], 1, 1, 0); |
||
114 | end |
||
115 | |||
116 | PartyBuffsInitFunction = function(modId) |
||
117 | val = CT_Mods[modId]["modValue"]; |
||
118 | if ( val == "1" ) then |
||
119 | CT_ShowPartyBuffs = 1; |
||
120 | CT_ShowPetBuffs = 1; |
||
121 | elseif ( val == "2" ) then |
||
122 | CT_ShowPartyBuffs = 1; |
||
123 | CT_ShowPetBuffs = 0; |
||
124 | elseif ( val == "3" ) then |
||
125 | CT_ShowPartyBuffs = 0; |
||
126 | CT_ShowPetBuffs = 1; |
||
127 | elseif ( val == "4" ) then |
||
128 | CT_ShowPartyBuffs = 0; |
||
129 | CT_ShowPetBuffs = 0; |
||
130 | end |
||
131 | end |
||
132 | |||
133 | CT_RegisterMod(CT_PARTYBUFFS_MODNAME1, CT_PARTYBUFFS_SUBNAME1, 3, "Interface\\Icons\\Spell_Holy_PrayerOfHealing02", CT_PARTYBUFFS_TOOLTIP1, "switch", "1", PartyBuffsFunction, PartyBuffsInitFunction); |
||
134 | |||
135 | BuffNumberFunction = function (modId, text) |
||
136 | local val = CT_Mods[modId]["modValue"]; |
||
137 | if ( val == "4" ) then |
||
138 | val = "6"; |
||
139 | elseif ( val == "6" ) then |
||
140 | val = "8"; |
||
141 | elseif ( val == "8" ) then |
||
142 | val = "10"; |
||
143 | elseif ( val == "10" ) then |
||
144 | val = "12"; |
||
145 | elseif ( val == "12" ) then |
||
146 | val = "14"; |
||
147 | elseif ( val == "14" ) then |
||
148 | val = "4"; |
||
149 | end |
||
150 | |||
151 | if ( text and val ) then text:SetText(val); end |
||
152 | CT_Mods[modId]["modValue"] = val; |
||
153 | CT_NUM_SHOWN_PARTY_BUFFS = tonumber(val); |
||
154 | if ( tonumber(val) <= 9 ) then |
||
155 | CT_NUM_SHOWN_PET_BUFFS = tonumber(val); |
||
156 | else |
||
157 | CT_NUM_SHOWN_PET_BUFFS = 9; |
||
158 | end |
||
159 | |||
160 | CT_Print("<CTMod> " .. format(CT_PARTYBUFFS_NUMSHOWN, val), 1.0, 1.0, 0.0); |
||
161 | end |
||
162 | |||
163 | BuffNumberInitFunction = function(modId) |
||
164 | val = CT_Mods[modId]["modValue"]; |
||
165 | CT_NUM_SHOWN_PARTY_BUFFS = tonumber(val); |
||
166 | if ( tonumber(val) <= 9 ) then |
||
167 | CT_NUM_SHOWN_PET_BUFFS = tonumber(val); |
||
168 | else |
||
169 | CT_NUM_SHOWN_PET_BUFFS = 9; |
||
170 | end |
||
171 | end |
||
172 | |||
173 | CT_RegisterMod(CT_PARTYBUFFS_MODNAME2, CT_PARTYBUFFS_SUBNAME2, 3, "Interface\\Icons\\Spell_Holy_PrayerOfHealing02", CT_PARTYBUFFS_TOOLTIP2, "switch", "4", BuffNumberFunction, BuffNumberInitFunction); |
||
174 | |||
175 | CT_oldPartyMemberBuffTooltip_Update = PartyMemberBuffTooltip_Update; |
||
176 | function CT_newPartyMemberBuffTooltip_Update(pet) |
||
177 | CT_oldPartyMemberBuffTooltip_Update(pet); |
||
178 | if ( ( pet and CT_ShowPetBuffs == 1 ) or ( not pet and CT_ShowPartyBuffs == 1 ) ) then |
||
179 | PartyMemberBuffTooltip:Hide(); |
||
180 | end |
||
181 | end |
||
182 | PartyMemberBuffTooltip_Update = CT_newPartyMemberBuffTooltip_Update; |