vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 function DUF_Set_BackgroundPadding(frame, padding)
2 getglobal(frame.."_Background"):ClearAllPoints();
3 getglobal(frame.."_Background"):SetPoint("TOPLEFT", frame, "TOPLEFT", -padding, padding);
4 getglobal(frame.."_Background"):SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", padding, -padding);
5 end
6  
7 function DUF_Set_ClassIcon(unit)
8 local class = UnitClass(unit);
9 local texture = getglobal(DUF_FRAME_DATA[unit].frame.."_ClassIcon_Texture");
10 local left, right, top, bottom;
11 if (class == DUF_TEXT.Warrior) then
12 left, right, top, bottom = .25, 0, 0, .25;
13 elseif (class == DUF_TEXT.Mage) then
14 left, right, top, bottom = .5, .25, 0, .25;
15 elseif (class == DUF_TEXT.Rogue) then
16 left, right, top, bottom = .75, .5, 0, .25;
17 elseif (class == DUF_TEXT.Druid) then
18 left, right, top, bottom = 1, .75, 0, .25;
19 elseif (class == DUF_TEXT.Hunter) then
20 left, right, top, bottom = .25, 0, .25, .5;
21 elseif (class == DUF_TEXT.Shaman) then
22 left, right, top, bottom = .5, .25, .25, .5;
23 elseif (class == DUF_TEXT.Priest) then
24 left, right, top, bottom = .75, .5, .25, .5;
25 elseif (class == DUF_TEXT.Warlock) then
26 left, right, top, bottom = 1, .75, .25, .5;
27 elseif (class == DUF_TEXT.Paladin) then
28 left, right, top, bottom = .25, 0, .5, .75;
29 end
30 if (class) then
31 texture:SetTexCoord(right, left, top, bottom);
32 else
33 texture:SetTexCoord(0, .25, 0, .25);
34 end
35 if (DUF_Settings[DUF_INDEX][DUF_FRAME_DATA[unit].index].ClassIcon.userace) then
36 if (UnitIsPlayer(unit)) then
37 texture:SetTexture("Interface\\Glues\\CharacterCreate\\UI-CharacterCreate-Classes");
38 else
39 DUF_Set_RaceIcon(unit, 1);
40 end
41 end
42 end
43  
44 function DUF_Set_ElementPosition(frame, unitFrame, settings)
45 local attachframe = unitFrame..settings.attach;
46 if (settings.attach == "Unit Frame") then
47 attachframe = unitFrame;
48 elseif (settings.attach == "UIParent") then
49 attachframe = "UIParent";
50 end
51 frame:ClearAllPoints();
52 frame:SetPoint(settings.attachpoint, attachframe, settings.attachto, settings.xoffset, settings.yoffset);
53 end
54  
55 function DUF_Set_EliteTexture()
56 local texture;
57 if (DUF_Settings[DUF_INDEX].target.EliteTexture.elitetexture and DUF_Settings[DUF_INDEX].target.EliteTexture.elitetexture ~= "") then
58 texture = "Interface\\AddOns\\DiscordUnitFrames\\CustomTextures\\"..DUF_Settings[DUF_INDEX].target.EliteTexture.elitetexture;
59 elseif (DUF_Settings[DUF_INDEX].target.EliteTexture.faceleft) then
60 texture = "Interface\\AddOns\\DiscordUnitFrames\\Icons\\EliteLeft";
61 else
62 texture = "Interface\\AddOns\\DiscordUnitFrames\\Icons\\Elite";
63 end
64 if (DUF_OPTIONS_VISIBLE and (not DUF_Settings[DUF_INDEX].target.EliteTexture.hide)) then
65 DUF_TargetFrame_EliteTexture_Texture:SetTexture(texture);
66 DUF_TargetFrame_EliteTexture:Show();
67 return;
68 end
69 local classification = UnitClassification("target");
70 if (classification == "elite" or classification == "worldboss") then
71 if (not DUF_Settings[DUF_INDEX].target.EliteTexture.hide) then
72 DUF_TargetFrame_EliteTexture_Texture:SetTexture(texture);
73 DUF_TargetFrame_EliteTexture:Show();
74 end
75 elseif (classification == "rare" or classification == "rareelite") then
76 if (not DUF_Settings[DUF_INDEX].target.EliteTexture.hide) then
77 if (DUF_Settings[DUF_INDEX].target.EliteTexture.raretexture and DUF_Settings[DUF_INDEX].target.EliteTexture.raretexture ~= "") then
78 texture = "Interface\\AddOns\\DiscordUnitFrames\\CustomTextures\\"..DUF_Settings[DUF_INDEX].target.EliteTexture.raretexture;
79 elseif (DUF_Settings[DUF_INDEX].target.EliteTexture.faceleft) then
80 texture = "Interface\\AddOns\\DiscordUnitFrames\\Icons\\RareLeft";
81 else
82 texture = "Interface\\AddOns\\DiscordUnitFrames\\Icons\\Rare";
83 end
84 DUF_TargetFrame_EliteTexture_Texture:SetTexture(texture);
85 DUF_TargetFrame_EliteTexture:Show();
86 end
87 else
88 DUF_TargetFrame_EliteTexture:Hide();
89 end
90 end
91  
92 function DUF_Set_Portrait(unit)
93 local texture = getglobal(DUF_FRAME_DATA[unit].frame.."_Portrait_Texture");
94 texture:SetTexCoord(0, 1, 0, 1);
95 if (UnitName(unit)) then
96 SetPortraitTexture(texture, unit);
97 else
98 SetPortraitTexture(texture, "player");
99 return;
100 end
101  
102 if (DUF_Settings[DUF_INDEX][DUF_FRAME_DATA[unit].index].Portrait.useclass and UnitIsPlayer(unit)) then
103 local class = UnitClass(unit);
104 local left, right, top, bottom;
105 if (class == DUF_TEXT.Warrior) then
106 left, right, top, bottom = .25, 0, 0, .25;
107 elseif (class == DUF_TEXT.Mage) then
108 left, right, top, bottom = .5, .25, 0, .25;
109 elseif (class == DUF_TEXT.Rogue) then
110 left, right, top, bottom = .75, .5, 0, .25;
111 elseif (class == DUF_TEXT.Druid) then
112 left, right, top, bottom = 1, .75, 0, .25;
113 elseif (class == DUF_TEXT.Hunter) then
114 left, right, top, bottom = .25, 0, .25, .5;
115 elseif (class == DUF_TEXT.Shaman) then
116 left, right, top, bottom = .5, .25, .25, .5;
117 elseif (class == DUF_TEXT.Priest) then
118 left, right, top, bottom = .75, .5, .25, .5;
119 elseif (class == DUF_TEXT.Warlock) then
120 left, right, top, bottom = 1, .75, .25, .5;
121 elseif (class == DUF_TEXT.Paladin) then
122 left, right, top, bottom = .25, 0, .5, .75;
123 end
124 if (class) then
125 texture:SetTexture("Interface\\Glues\\CharacterCreate\\UI-CharacterCreate-Classes");
126 texture:SetTexCoord(right, left, top, bottom);
127 end
128 end
129 end
130  
131 function DUF_Set_RaceIcon(unit, toggle)
132 local race = UnitRace(unit);
133 local sex = UnitSex(unit);
134 local ctype = UnitCreatureType(unit);
135 local faction = UnitFactionGroup(unit);
136 local texture = getglobal(DUF_FRAME_DATA[unit].frame.."_RaceIcon_Texture");
137 if (texture.targetIcon) then
138 local targetIndex
139 if (unit == "target" or unit == "targettarget") then
140 targetIndex = GetRaidTargetIndex(unit)
141 else
142 targetIndex = GetRaidTargetIndex(unit.."target")
143 end
144 if (targetIndex) then
145 SetRaidTargetIconTexture(texture, targetIndex)
146 end
147 return
148 end
149 if (toggle) then
150 texture = getglobal(DUF_FRAME_DATA[unit].frame.."_ClassIcon_Texture");
151 end
152 if (not UnitName(unit)) then
153 race=DUF_TEXT.Human;
154 sex=1;
155 end
156 texture:Show();
157 if (UnitIsCivilian(unit)) then
158 texture:SetTexCoord(0, 1, 0, 1);
159 texture:SetTexture("Interface\\AddOns\\DiscordUnitFrames\\Icons\\Civilian")
160 elseif (race and sex) then
161 texture:SetTexture("Interface\\Glues\\CharacterCreate\\UI-CharacterCreate-Races");
162 if (sex == 2) then
163 if (race == DUF_TEXT.Human) then texture:SetTexCoord(0, 0.25, 0, 0.25); end
164 if (race == DUF_TEXT.Dwarf) then texture:SetTexCoord(0.25, 0.5, 0, 0.25); end
165 if (race == DUF_TEXT.Gnome) then texture:SetTexCoord(0.5, 0.75, 0, 0.25); end
166 if (race == DUF_TEXT.NightElf) then texture:SetTexCoord(0.75, 1.0, 0, 0.25); end
167 if (race == DUF_TEXT.Tauren) then texture:SetTexCoord(0, 0.25, 0.25, 0.5); end
168 if (race == DUF_TEXT.Undead) then texture:SetTexCoord(0.25, 0.5, 0.25, 0.5); end
169 if (race == DUF_TEXT.Troll) then texture:SetTexCoord(0.5, 0.75, 0.25, 0.5); end
170 if (race == DUF_TEXT.Orc) then texture:SetTexCoord(0.75, 1.0, 0.25, 0.5); end
171 else
172 if (race == DUF_TEXT.Human) then texture:SetTexCoord(0, 0.25, 0.5, 0.75); end
173 if (race == DUF_TEXT.Dwarf) then texture:SetTexCoord(0.25, 0.5, 0.5, 0.75); end
174 if (race == DUF_TEXT.Gnome) then texture:SetTexCoord(0.5, 0.75, 0.5, 0.75); end
175 if (race == DUF_TEXT.NightElf) then texture:SetTexCoord(0.75, 1.0, 0.5, 0.75); end
176 if (race == DUF_TEXT.Tauren) then texture:SetTexCoord(0, 0.25, 0.75, 1.0); end
177 if (race == DUF_TEXT.Undead) then texture:SetTexCoord(0.25, 0.5, 0.75, 1.0); end
178 if (race == DUF_TEXT.Troll) then texture:SetTexCoord(0.5, 0.75, 0.75, 1.0); end
179 if (race == DUF_TEXT.Orc) then texture:SetTexCoord(0.75, 1.0, 0.75, 1.0); end
180 end
181 elseif (UnitPlayerControlled(unit)) then
182 texture:SetTexCoord(0, 1, 0, 1);
183 texture:SetTexture("Interface\\AddOns\\DiscordUnitFrames\\Icons\\Sheep")
184 elseif (ctype) then
185 texture:SetTexCoord(0, 1, 0, 1);
186 if (ctype == DUF_TEXT.Beast) then texture:SetTexture("Interface\\AddOns\\DiscordUnitFrames\\Icons\\Beast")
187 elseif (ctype == DUF_TEXT.Dragonkin) then texture:SetTexture("Interface\\AddOns\\DiscordUnitFrames\\Icons\\Dragonkin")
188 elseif (ctype == DUF_TEXT.Critter) then texture:SetTexture("Interface\\AddOns\\DiscordUnitFrames\\Icons\\Critter")
189 elseif (ctype == DUF_TEXT.Demon) then texture:SetTexture("Interface\\AddOns\\DiscordUnitFrames\\Icons\\Demon")
190 elseif (ctype == DUF_TEXT.Elemental) then texture:SetTexture("Interface\\AddOns\\DiscordUnitFrames\\Icons\\Elemental")
191 elseif (ctype == DUF_TEXT.Giant) then texture:SetTexture("Interface\\AddOns\\DiscordUnitFrames\\Icons\\Giant")
192 elseif (ctype == DUF_TEXT.Humanoid) then
193 if (faction == DUF_TEXT.Horde) then
194 texture:SetTexture("Interface\\AddOns\\DiscordUnitFrames\\Icons\\Horde")
195 elseif (faction == DUF_TEXT.Alliance) then
196 texture:SetTexture("Interface\\AddOns\\DiscordUnitFrames\\Icons\\Alliance")
197 else
198 texture:SetTexture("Interface\\AddOns\\DiscordUnitFrames\\Icons\\Humanoid")
199 end
200 elseif (ctype == DUF_TEXT.NotSpecified) then texture:SetTexture("Interface\\AddOns\\DiscordUnitFrames\\Icons\\NotSpecified")
201 elseif (ctype == DUF_TEXT.Summoned) then texture:SetTexture("Interface\\AddOns\\DiscordUnitFrames\\Icons\\Summoned")
202 elseif (ctype == DUF_TEXT.Undead) then texture:SetTexture("Interface\\AddOns\\DiscordUnitFrames\\Icons\\Undead")
203 else texture:SetTexture("Interface\\AddOns\\DiscordUnitFrames\\Icons\\Gryphon")
204 end
205 else
206 texture:SetTexCoord(0, 1, 0, 1);
207 texture:SetTexture("Interface\\AddOns\\DiscordUnitFrames\\Icons\\Unknown")
208 end
209 end
210  
211 function DUF_Set_RankIcon(unit)
212 local _, rankNumber = GetPVPRankInfo(UnitPVPRank(unit));
213 local texture = getglobal(DUF_FRAME_DATA[unit].frame.."_RankIcon_Texture");
214 if (texture.targetIcon) then
215 local targetIndex
216 if (unit == "target" or unit == "targettarget") then
217 targetIndex = GetRaidTargetIndex(unit)
218 else
219 targetIndex = GetRaidTargetIndex(unit.."target")
220 end
221 if (targetIndex) then
222 SetRaidTargetIconTexture(texture, targetIndex)
223 end
224 return
225 end
226 if (not UnitName(unit)) then
227 rankNumber=9;
228 elseif (not UnitIsPlayer(unit)) then
229 texture:Hide();
230 return;
231 end
232 if (rankNumber > 0) then
233 texture:Show();
234 texture:SetTexture(format("%s%02d","Interface\\PvPRankBadges\\PvPRank",rankNumber));
235 else
236 texture:Hide();
237 end
238 end