vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | local VERSION_MAJOR = "1"; |
2 | local VERSION_MINOR = "18"; |
||
3 | local VERSION_BOSSES = "02"; |
||
4 | ATLASLOOT_VERSION = "|cff4169e1AtlasLoot Enhanced v"..VERSION_MAJOR.."."..VERSION_MINOR.."."..VERSION_BOSSES.."|r"; |
||
5 | ATLASLOOT_CURRENT_ATLAS = "1.8.1"; |
||
6 | |||
7 | -- Colours stored for code readability |
||
8 | local GREY = "|cff999999"; |
||
9 | local RED = "|cffff0000"; |
||
10 | local WHITE = "|cffFFFFFF"; |
||
11 | local GREEN = "|cff1eff00"; |
||
12 | local PURPLE = "|cff9F3FFF"; |
||
13 | local BLUE = "|cff0070dd"; |
||
14 | local ORANGE = "|cffFF8400"; |
||
15 | |||
16 | local ATLAS_LOOT_BOSS_LINES = 27; |
||
17 | |||
18 | AtlasLoot_AnchorFrame = AtlasFrame; |
||
19 | |||
20 | local Hooked_Atlas_Refresh; |
||
21 | |||
22 | -- Initialise saved variables |
||
23 | if(AtlasLootOptions == nil) then |
||
24 | AtlasLootOptions = {}; |
||
25 | end |
||
26 | |||
27 | if ( AtlasLootOptions["SafeLinks"] == nil ) then |
||
28 | AtlasLootOptions["SafeLinks"] = true; |
||
29 | end |
||
30 | if ( AtlasLootOptions["AllLinks"] == nil ) then |
||
31 | AtlasLootOptions["AllLinks"] = false; |
||
32 | end |
||
33 | if ( AtlasLootOptions["DefaultTT"] == nil ) then |
||
34 | AtlasLootOptions["DefaultTT"] = true; |
||
35 | end |
||
36 | if ( AtlasLootOptions["LootlinkTT"] == nil ) then |
||
37 | AtlasLootOptions["LootlinkTT"] = false; |
||
38 | end |
||
39 | if ( AtlasLootOptions["ItemSyncTT"] == nil ) then |
||
40 | AtlasLootOptions["ItemSyncTT"] = false; |
||
41 | end |
||
42 | if ( AtlasLootOptions["EquipCompare"] == nil ) then |
||
43 | AtlasLootOptions["EquipCompare"] = false; |
||
44 | end |
||
45 | |||
46 | -- Popup Box for first time users |
||
47 | StaticPopupDialogs["ATLASLOOT_SETUP"] = { |
||
48 | text = ATLASLOOT_FIRST_TIME_TEXT, |
||
49 | button1 = ATLASLOOT_FIRST_TIME_BUTTON, |
||
50 | OnAccept = function() |
||
51 | AtlasLootOptions_Toggle(); |
||
52 | end, |
||
53 | timeout = 0, |
||
54 | whileDead = 1, |
||
55 | hideOnEscape = 1 |
||
56 | }; |
||
57 | |||
58 | --Popup Box for an old version of Atlas |
||
59 | StaticPopupDialogs["ATLASLOOT_OLD_ATLAS"] = { |
||
60 | text = ATLASLOOT_OLD_ATLAS_TEXT_PT1..ATLASLOOT_CURRENT_ATLAS..ATLASLOOT_OLD_ATLAS_TEXT_PT2, |
||
61 | button1 = ATLASLOOT_OLD_ATLAS_BUTTON, |
||
62 | OnAccept = function() |
||
63 | AtlasLootOptions_Toggle(); |
||
64 | end, |
||
65 | timeout = 0, |
||
66 | whileDead = 1, |
||
67 | hideOnEscape = 1 |
||
68 | }; |
||
69 | |||
70 | -------------------------------------------------------------------------------- |
||
71 | -- OnEvent |
||
72 | -------------------------------------------------------------------------------- |
||
73 | function AtlasLoot_OnEvent(event) |
||
74 | if(event == "VARIABLES_LOADED") then |
||
75 | AtlasLoot_OnVariablesLoaded(); |
||
76 | end |
||
77 | end |
||
78 | |||
79 | |||
80 | -------------------------------------------------------------------------------- |
||
81 | -- OnEvent - VariablesLoaded |
||
82 | -- When the game has loaded all variables, initialise the mod |
||
83 | -------------------------------------------------------------------------------- |
||
84 | function AtlasLoot_OnVariablesLoaded() |
||
85 | Hooked_Atlas_Refresh = Atlas_Refresh; |
||
86 | Atlas_Refresh = AtlasLoot_Refresh; |
||
87 | AtlasLoot_Refresh(); |
||
88 | --Disable options that don't have the supporting mods |
||
89 | if( not LootLink_SetTooltip and (AtlasLootOptions.LootlinkTT == true)) then |
||
90 | AtlasLootOptions.LootlinkTT = false; |
||
91 | AtlasLootOptions.DefaultTT = true; |
||
92 | end |
||
93 | if( not ISYNC_VERSION and (AtlasLootOptions.ItemSyncTT == true)) then |
||
94 | AtlasLootOptions.ItemSyncTT = false; |
||
95 | AtlasLootOptions.DefaultTT = true; |
||
96 | end |
||
97 | if( not EquipCompare_RegisterTooltip and (AtlasLootOptions.EquipCompare == true)) then |
||
98 | AtlasLootOptions.EquipCompare = false; |
||
99 | end |
||
100 | if((EquipCompare_RegisterTooltip) and (AtlasLootOptions["EquipCompare"] == true)) then |
||
101 | EquipCompare_RegisterTooltip(AtlasLootTooltip); |
||
102 | end |
||
103 | if ( Hooked_Atlas_Refresh ) then |
||
104 | AtlasLoot_SetupForAtlas(); |
||
105 | --If a first time user, set up options |
||
106 | if( (AtlasLootVersion == nil) or (tonumber(AtlasLootVersion) < 11402)) then |
||
107 | AtlasLootOptions["SafeLinks"] = true; |
||
108 | AtlasLootOptions["AllLinks"] = false; |
||
109 | AtlasLootVersion = VERSION_MAJOR..VERSION_MINOR..VERSION_BOSSES; |
||
110 | StaticPopup_Show ("ATLASLOOT_SETUP"); |
||
111 | end |
||
112 | --If not the expected Atlas version |
||
113 | if( ATLAS_VERSION ~= ATLASLOOT_CURRENT_ATLAS ) then |
||
114 | StaticPopup_Show ("ATLASLOOT_OLD_ATLAS"); |
||
115 | end |
||
116 | else |
||
117 | AtlasLootItemsFrame:Hide(); |
||
118 | end |
||
119 | end |
||
120 | |||
121 | --If someone types /atlasloot, bring up the options box |
||
122 | function AtlasLoot_SlashCommand(msg) |
||
123 | if(msg == "**") then |
||
124 | AtlasLootOptions_Toggle(); |
||
125 | else |
||
126 | AtlasLootOptions_Toggle(); |
||
127 | end |
||
128 | end |
||
129 | |||
130 | --Toggle on/off the options window |
||
131 | function AtlasLootOptions_Toggle() |
||
132 | if(AtlasLootOptionsFrame:IsVisible()) then |
||
133 | AtlasLootOptionsFrame:Hide(); |
||
134 | else |
||
135 | AtlasLootOptionsFrame:Show(); |
||
136 | if(AtlasLootOptions["DefaultTT"] == true) then |
||
137 | AtlasLootOptions_DefaultTTToggle(); |
||
138 | elseif(AtlasLootOptions["LootlinkTT"] == true) then |
||
139 | AtlasLootOptions_LootlinkTTToggle(); |
||
140 | elseif(AtlasLootOptions["ItemSyncTT"] == true) then |
||
141 | AtlasLootOptions_ItemSyncTTToggle(); |
||
142 | end |
||
143 | end |
||
144 | end |
||
145 | |||
146 | -------------------------------------------------------------------------------- |
||
147 | -- OnLoad |
||
148 | -- When the mod loads, register to complete initialisation when |
||
149 | -- everything else is loaded. |
||
150 | -------------------------------------------------------------------------------- |
||
151 | function AtlasLoot_OnLoad() |
||
152 | this:RegisterEvent("VARIABLES_LOADED"); |
||
153 | SLASH_ATLASLOOT1 = "/atlasloot"; |
||
154 | SlashCmdList["ATLASLOOT"] = function(msg) |
||
155 | AtlasLoot_SlashCommand(msg); |
||
156 | end |
||
157 | end |
||
158 | |||
159 | -------------------------------------------------------------------------------- |
||
160 | -- Hooked AtlasRefresh |
||
161 | -- Called if any change to the Atlas Frame |
||
162 | -------------------------------------------------------------------------------- |
||
163 | function AtlasLoot_Refresh() |
||
164 | if(Hooked_Atlas_Refresh) then |
||
165 | Hooked_Atlas_Refresh(); |
||
166 | --If we are dealing with instances |
||
167 | if ( AtlasOptions.AtlasType == 1 ) then |
||
168 | local zoneID = ATLAS_DROPDOWN_LIST[AtlasOptions.AtlasZone]; |
||
169 | local text; |
||
170 | --If we have atlasloot data |
||
171 | if(AtlasLootBossButtons[zoneID] ~= nil) then |
||
172 | for i = 1, 27, 1 do |
||
173 | --If we have items in the atlasloot data |
||
174 | if(AtlasLootBossButtons[zoneID][i] ~= nil and AtlasLootBossButtons[zoneID][i] ~= "") then |
||
175 | getglobal("AtlasText_"..i):Hide(); |
||
176 | getglobal("AtlasBossLine_"..i):Show(); |
||
177 | --Ridiculous number of special cases, need to to something to clean this up |
||
178 | if(getglobal("AtlasText_"..i):GetText() == nil and getglobal("AtlasText_"..i-1):GetText() == nil and getglobal("AtlasText_"..i-2):GetText() ~= nil) then |
||
179 | if(zoneID == "TheRuinsofAhnQiraj") then |
||
180 | getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_CLASS_BOOKS); |
||
181 | elseif(zoneID == "DireMaulNorth") then |
||
182 | getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_TRIBUTE_RUN); |
||
183 | elseif(zoneID == "WailingCaverns") then |
||
184 | getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_VIPERSET); |
||
185 | elseif(zoneID == "TheDeadmines") then |
||
186 | getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_DEFIASSET); |
||
187 | elseif(zoneID == "ScarletMonastery") then |
||
188 | getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_SCARLETSET); |
||
189 | elseif((zoneID == "DireMaulEast") or (zoneID == "DireMaulWest")) then |
||
190 | getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_DM_BOOKS); |
||
191 | elseif((zoneID == "BlackrockSpireUpper") or (zoneID == "BlackrockSpireLower") or (zoneID == "Scholomance")) then |
||
192 | getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_T0_SET_PIECES); |
||
193 | else |
||
194 | getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_TRASH_MOBS); |
||
195 | end |
||
196 | elseif(zoneID == "MoltenCore" and getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREY..ATLASLOOT_TRASH_MOBS) then |
||
197 | getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_RANDOM_LOOT); |
||
198 | elseif(zoneID == "MoltenCore" and getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREY..ATLASLOOT_RANDOM_LOOT and AtlasLootBossButtons[zoneID][i] == "T1SET") then |
||
199 | getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_MC_SET_PIECES); |
||
200 | elseif(zoneID == "BlackwingLair" and getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREY..ATLASLOOT_TRASH_MOBS and AtlasLootBossButtons[zoneID][i] == "T2SET") then |
||
201 | getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_BWL_SET_PIECES); |
||
202 | elseif(zoneID == "TheTempleofAhnQiraj" and getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREY..ATLASLOOT_TRASH_MOBS) then |
||
203 | getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_AQ_ENCHANTS); |
||
204 | elseif(zoneID == "TheTempleofAhnQiraj" and getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREY..ATLASLOOT_AQ_ENCHANTS) then |
||
205 | getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_AQ40_CLASS_SET_PIECES_1); |
||
206 | elseif(zoneID == "TheRuinsofAhnQiraj" and getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREY..ATLASLOOT_CLASS_BOOKS) then |
||
207 | getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_AQ_ENCHANTS); |
||
208 | elseif(zoneID == "TheRuinsofAhnQiraj" and getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREY..ATLASLOOT_AQ_ENCHANTS) then |
||
209 | getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_AQ20_CLASS_SET_PIECES_1); |
||
210 | elseif((zoneID == "ZulGurub") and getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREY..ATLASLOOT_TRASH_MOBS) then |
||
211 | getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_RANDOM_LOOT); |
||
212 | elseif((zoneID == "ZulGurub") and getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREY..ATLASLOOT_RANDOM_LOOT) then |
||
213 | getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_ZG_CLASS_SET_PIECES_1); |
||
214 | elseif((zoneID == "ZulGurub") and getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREY..ATLASLOOT_ZG_CLASS_SET_PIECES_1) then |
||
215 | getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_ZG_ENCHANTS); |
||
216 | elseif(zoneID == "DireMaulNorth" and getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREY..ATLASLOOT_TRIBUTE_RUN) then |
||
217 | getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_DM_BOOKS); |
||
218 | elseif(zoneID == "Naxxramas" and getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREY..ATLASLOOT_TRASH_MOBS and AtlasLootBossButtons[zoneID][i] == "T3SET") then |
||
219 | getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_NAXX_SET_PIECES); |
||
220 | else |
||
221 | getglobal("AtlasBossLine_"..i.."_Text"):SetText(getglobal("AtlasText_"..i):GetText()); |
||
222 | end |
||
223 | getglobal("AtlasBossLine_"..i.."_Loot"):Show(); |
||
224 | getglobal("AtlasBossLine_"..i.."_Selected"):Hide(); |
||
225 | else |
||
226 | getglobal("AtlasText_"..i):Show(); |
||
227 | getglobal("AtlasBossLine_"..i):Hide(); |
||
228 | end |
||
229 | end |
||
230 | getglobal("AtlasLootInfo"):Show(); |
||
231 | else |
||
232 | for i = 1, 27, 1 do |
||
233 | getglobal("AtlasText_"..i):Show(); |
||
234 | getglobal("AtlasBossLine_"..i):Hide(); |
||
235 | end |
||
236 | getglobal("AtlasLootInfo"):Hide(); |
||
237 | end |
||
238 | --If we are dealing with battlegrounds |
||
239 | elseif ( AtlasOptions.AtlasType == 2 ) then |
||
240 | zoneID = ATLAS_DROPDOWN_LIST_BG[AtlasOptions.AtlasZone]; |
||
241 | local text; |
||
242 | if(AtlasLootBattlegrounds[zoneID] ~= nil) then |
||
243 | --If we have data, just show the rep rewards where we set them. |
||
244 | for i = 1, 27, 1 do |
||
245 | if(AtlasLootBattlegrounds[zoneID][i] ~= nil and AtlasLootBattlegrounds[zoneID][i] ~= "") then |
||
246 | if(getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREEN..ATLASLOOT_BG_FRIENDLY) then |
||
247 | getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREEN..ATLASLOOT_BG_HONORED); |
||
248 | elseif(getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREEN..ATLASLOOT_BG_HONORED) then |
||
249 | getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREEN..ATLASLOOT_BG_REVERED); |
||
250 | elseif(getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREEN..ATLASLOOT_BG_REVERED) then |
||
251 | getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREEN..ATLASLOOT_BG_EXALTED); |
||
252 | elseif(getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREEN..ATLASLOOT_BG_EXALTED) then |
||
253 | getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREEN..ATLASLOOT_PVP_SET_PIECES); |
||
254 | elseif(getglobal("AtlasText_"..i):GetText() == nil) then |
||
255 | getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREEN..ATLASLOOT_BG_FRIENDLY); |
||
256 | end |
||
257 | getglobal("AtlasBossLine_"..i.."_Loot"):Show(); |
||
258 | getglobal("AtlasBossLine_"..i.."_Selected"):Hide(); |
||
259 | getglobal("AtlasText_"..i):Hide(); |
||
260 | getglobal("AtlasBossLine_"..i):Show(); |
||
261 | else |
||
262 | getglobal("AtlasText_"..i):Show(); |
||
263 | getglobal("AtlasBossLine_"..i):Hide(); |
||
264 | end |
||
265 | end |
||
266 | getglobal("AtlasLootInfo"):Show(); |
||
267 | else |
||
268 | for i = 1, 27, 1 do |
||
269 | getglobal("AtlasText_"..i):Show(); |
||
270 | getglobal("AtlasBossLine_"..i):Hide(); |
||
271 | end |
||
272 | getglobal("AtlasLootInfo"):Hide(); |
||
273 | end |
||
274 | --World Bosses |
||
275 | elseif ( AtlasOptions.AtlasType == 5 ) then |
||
276 | zoneID = ATLAS_DROPDOWN_LIST_RE[AtlasOptions.AtlasZone]; |
||
277 | local text; |
||
278 | if(AtlasLootWBBossButtons[zoneID] ~= nil) then |
||
279 | --If we have data, just show the rep rewards where we set them. |
||
280 | for i = 1, 27, 1 do |
||
281 | if(AtlasLootWBBossButtons[zoneID][i] ~= nil and AtlasLootWBBossButtons[zoneID][i] ~= "") then |
||
282 | getglobal("AtlasBossLine_"..i.."_Text"):SetText(getglobal("AtlasText_"..i):GetText()); |
||
283 | getglobal("AtlasBossLine_"..i.."_Loot"):Show(); |
||
284 | getglobal("AtlasBossLine_"..i.."_Selected"):Hide(); |
||
285 | getglobal("AtlasText_"..i):Hide(); |
||
286 | getglobal("AtlasBossLine_"..i):Show(); |
||
287 | else |
||
288 | getglobal("AtlasText_"..i):Show(); |
||
289 | getglobal("AtlasBossLine_"..i):Hide(); |
||
290 | end |
||
291 | end |
||
292 | getglobal("AtlasLootInfo"):Show(); |
||
293 | else |
||
294 | for i = 1, 27, 1 do |
||
295 | getglobal("AtlasText_"..i):Show(); |
||
296 | getglobal("AtlasBossLine_"..i):Hide(); |
||
297 | end |
||
298 | getglobal("AtlasLootInfo"):Hide(); |
||
299 | end |
||
300 | else |
||
301 | for i = 1, 27, 1 do |
||
302 | getglobal("AtlasText_"..i):Show(); |
||
303 | getglobal("AtlasBossLine_"..i):Hide(); |
||
304 | end |
||
305 | getglobal("AtlasLootInfo"):Hide(); |
||
306 | end |
||
307 | AtlasLootItemsFrame:Hide(); |
||
308 | end |
||
309 | end |
||
310 | |||
311 | -------------------------------------------------------------------------------- |
||
312 | -- Click on boss line |
||
313 | -------------------------------------------------------------------------------- |
||
314 | function AtlasLootBoss_OnClick(id) |
||
315 | AtlasLootItemsFrame:Hide(); |
||
316 | AtlasLootItemsFrame.externalBoss = nil; |
||
317 | AtlasLoot_AnchorFrame = AtlasFrame; -- Added |
||
318 | |||
319 | if ( ( AtlasLootItemsFrame.activeBoss ) and ( AtlasLootItemsFrame.activeBoss == id ) ) then |
||
320 | AtlasLootItemsFrame.activeBoss = nil; |
||
321 | getglobal("AtlasBossLine_"..id.."_Loot"):Show(); |
||
322 | getglobal("AtlasBossLine_"..id.."_Selected"):Hide(); |
||
323 | else |
||
324 | AtlasLootItemsFrame.activeBoss = id; |
||
325 | |||
326 | for i = 1, 27, 1 do |
||
327 | getglobal("AtlasBossLine_"..i.."_Loot"):Show(); |
||
328 | getglobal("AtlasBossLine_"..i.."_Selected"):Hide(); |
||
329 | end |
||
330 | |||
331 | local _,_,boss = string.find(getglobal("AtlasBossLine_"..id.."_Text"):GetText(), "|c%x%x%x%x%x%x%x%x%s*[%dX]*[%) ]*(.*[^%,])[%,]?$"); |
||
332 | |||
333 | if ( AtlasOptions.AtlasType == 1 ) then |
||
334 | local zoneID = ATLAS_DROPDOWN_LIST[AtlasOptions.AtlasZone]; |
||
335 | local dataID = AtlasLootBossButtons[zoneID][id]; |
||
336 | AtlasLoot_ShowItemsFrame(dataID, AtlasLootItems, "|cffFFd200Boss: |cffFFFFFF"..boss); |
||
337 | |||
338 | elseif( AtlasOptions.AtlasType == 2 ) then |
||
339 | zoneID = ATLAS_DROPDOWN_LIST_BG[AtlasOptions.AtlasZone]; |
||
340 | local dataID = AtlasLootBattlegrounds[zoneID][id]; |
||
341 | AtlasLoot_ShowItemsFrame(dataID, AtlasLootBGItems, "|cffFFFFFF"..boss); |
||
342 | |||
343 | elseif( AtlasOptions.AtlasType == 5 ) then |
||
344 | zoneID = ATLAS_DROPDOWN_LIST_RE[AtlasOptions.AtlasZone]; |
||
345 | local dataID = AtlasLootWBBossButtons[zoneID][id]; |
||
346 | AtlasLoot_ShowItemsFrame(dataID, AtlasLootWBItems, "|cffFFd200Boss: |cffFFFFFF"..boss); |
||
347 | |||
348 | end |
||
349 | |||
350 | getglobal("AtlasBossLine_"..id.."_Loot"):Hide(); |
||
351 | getglobal("AtlasBossLine_"..id.."_Selected"):Show(); |
||
352 | |||
353 | AtlasLoot_SetItemInfoFrame(); |
||
354 | end |
||
355 | end |
||
356 | |||
357 | ------------------------------------------------------------------------------------------------------------------- |
||
358 | -- Code below placed in own function to allow calls from external sources as well as from AtlasLootBoss_OnClick(id) |
||
359 | -- The function now accepts : |
||
360 | -- 1.) the internal lootid that is basically the key for a 'Boss' |
||
361 | -- 2.) the AtlasLoot data array that should be examined for information on the 'Boss' |
||
362 | -- 3.) the name of the 'Boss' to be displayed at the top of the AtlasLootItemsFrame |
||
363 | -- 4.) a data structure detailing the frame to which the AtlasLootItemsFrame should be attached, and how it should |
||
364 | -- be anchored. This argument can be ommitted, and the default AtlasFrame will be used. |
||
365 | -- This approach is currently dependant on the data structures being identical for BattleGrounds and Instances, and whatever |
||
366 | -- new data stores are added in the future. If new or different data structures are added in any new categories |
||
367 | -- such as Exteranl Raid Bosses, then the code below should be changed to make sure it can handle that data also. |
||
368 | ------------------------------------------------------------------------------------------------------------------- |
||
369 | function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame) |
||
370 | |||
371 | local itemName, itemLink, itemQuality, itemLevel, itemType, itemSubType, itemCount, itemEquipLoc, itemTexture, itemColor; |
||
372 | local iconFrame, nameFrame, extraFrame; |
||
373 | local text, extra; |
||
374 | |||
375 | getglobal("AtlasLoot_Tier0Button"):Hide(); |
||
376 | getglobal("AtlasLoot_Tier1Button"):Hide(); |
||
377 | getglobal("AtlasLoot_Tier2Button"):Hide(); |
||
378 | getglobal("AtlasLoot_Tier3Button"):Hide(); |
||
379 | getglobal("AtlasLoot_ZGButton"):Hide(); |
||
380 | getglobal("AtlasLoot_AQ20Button"):Hide(); |
||
381 | getglobal("AtlasLoot_AQ40Button"):Hide(); |
||
382 | getglobal("AtlasLoot_PVPButton"):Hide(); |
||
383 | |||
384 | if(dataID=="AQ40SET") then |
||
385 | AtlasLoot_Set("AQ40SET"); |
||
386 | elseif(dataID=="AQ20SET") then |
||
387 | AtlasLoot_Set("AQ20SET"); |
||
388 | elseif(dataID=="ZGSET") then |
||
389 | AtlasLoot_Set("ZGSET"); |
||
390 | elseif(dataID=="T3SET") then |
||
391 | AtlasLoot_Set("T3SET"); |
||
392 | elseif(dataID=="T2SET") then |
||
393 | AtlasLoot_Set("T2SET"); |
||
394 | elseif(dataID=="T1SET") then |
||
395 | AtlasLoot_Set("T1SET"); |
||
396 | elseif(dataID=="T0SET") then |
||
397 | AtlasLoot_Set("T0SET"); |
||
398 | elseif(dataID=="PVPSET") then |
||
399 | AtlasLoot_Set("PVPSET"); |
||
400 | else |
||
401 | for i = 1, 30, 1 do |
||
402 | if(dataSource[dataID][i] ~= nil and dataSource[dataID][i][3] ~= "") then |
||
403 | itemName, itemLink, itemQuality, itemLevel, itemType, itemSubType, itemCount, itemEquipLoc, itemTexture = GetItemInfo(dataSource[dataID][i][1]); |
||
404 | if(GetItemInfo(dataSource[dataID][i][1])) then |
||
405 | _, _, _, itemColor = GetItemQualityColor(itemQuality); |
||
406 | text = itemColor..itemName; |
||
407 | else |
||
408 | text = dataSource[dataID][i][3]; |
||
409 | text = AtlasLoot_FixText(text); |
||
410 | end |
||
411 | |||
412 | extra = dataSource[dataID][i][4]; |
||
413 | extra = AtlasLoot_FixText(extra); |
||
414 | if((not GetItemInfo(dataSource[dataID][i][1])) and (dataSource[dataID][i][1] ~= 0)) then |
||
415 | extra = extra..ATLASLOOT_NO_ITEMINFO; |
||
416 | end |
||
417 | |||
418 | iconFrame = getglobal("AtlasLootItem_"..i.."_Icon"); |
||
419 | nameFrame = getglobal("AtlasLootItem_"..i.."_Name"); |
||
420 | extraFrame = getglobal("AtlasLootItem_"..i.."_Extra"); |
||
421 | |||
422 | iconFrame:SetTexture("Interface\\Icons\\"..dataSource[dataID][i][2]); |
||
423 | nameFrame:SetText(text); |
||
424 | extraFrame:SetText(extra); |
||
425 | |||
426 | getglobal("AtlasLootItem_"..i).itemID = dataSource[dataID][i][1]; |
||
427 | getglobal("AtlasLootItem_"..i).storeID = dataSource[dataID][i][1]; |
||
428 | getglobal("AtlasLootItem_"..i).droprate = dataSource[dataID][i][5]; |
||
429 | getglobal("AtlasLootItem_"..i).i = 1; |
||
430 | getglobal("AtlasLootItem_"..i):Show(); |
||
431 | else |
||
432 | getglobal("AtlasLootItem_"..i):Hide(); |
||
433 | end |
||
434 | end |
||
435 | getglobal("AtlasLootItemsFrame_Druid"):Hide(); |
||
436 | getglobal("AtlasLootItemsFrame_Hunter"):Hide(); |
||
437 | getglobal("AtlasLootItemsFrame_Mage"):Hide(); |
||
438 | getglobal("AtlasLootItemsFrame_Paladin"):Hide(); |
||
439 | getglobal("AtlasLootItemsFrame_Priest"):Hide(); |
||
440 | getglobal("AtlasLootItemsFrame_Rogue"):Hide(); |
||
441 | getglobal("AtlasLootItemsFrame_Shaman"):Hide(); |
||
442 | getglobal("AtlasLootItemsFrame_Warlock"):Hide(); |
||
443 | getglobal("AtlasLootItemsFrame_Warrior"):Hide(); |
||
444 | getglobal("AtlasLootItemsFrame_Weapons"):Hide(); |
||
445 | getglobal("AtlasLootItemsFrame_BACK"):Hide(); |
||
446 | getglobal("AtlasLootItemsFrame_NEXT"):Hide(); |
||
447 | getglobal("AtlasLootItemsFrame_PREV"):Hide(); |
||
448 | AtlasLoot_BossName:SetText(boss); |
||
449 | end |
||
450 | AtlasLoot_SetItemInfoFrame(pFrame); -- New function to Show the frame, dependant on which frame you want to attach it to |
||
451 | -- pFrame can be a 'nil' value, and the AtlasFrame will be used by default |
||
452 | end |
||
453 | |||
454 | -------------------------------------------------------------------------------- |
||
455 | -- Code to deal with External Requests to display the Loot Info frame |
||
456 | -------------------------------------------------------------------------------- |
||
457 | |||
458 | function AtlasLoot_ShowBossLoot(dataID, boss, pFrame) |
||
459 | |||
460 | AtlasLootItemsFrame:Hide(); |
||
461 | if ( AtlasLootItemsFrame.activeBoss ) then |
||
462 | getglobal("AtlasBossLine_"..AtlasLootItemsFrame.activeBoss.."_Loot"):Show(); |
||
463 | getglobal("AtlasBossLine_"..AtlasLootItemsFrame.activeBoss.."_Selected"):Hide(); |
||
464 | AtlasLootItemsFrame.activeBoss = nil; |
||
465 | end |
||
466 | |||
467 | if ( dataID == AtlasLootItemsFrame.externalBoss ) then |
||
468 | AtlasLootItemsFrame.externalBoss = nil; |
||
469 | |||
470 | else |
||
471 | |||
472 | -- The approach below is dependant on 'boss' IDs being Globally Unique |
||
473 | -- i.e. the same 'boss' ID can not be used in both the Instance data and the BG data |
||
474 | -- if it is, then this code will only ever fetch the BG data |
||
475 | |||
476 | local dataSource = AtlasLootItems; -- Instance data used as default |
||
477 | |||
478 | if ( AtlasLootBGItems[dataID] ) then -- but replace with BG data if 'boss' found there |
||
479 | dataSource = AtlasLootBGItems; |
||
480 | elseif ( AtlasLootWBItems[dataID] ) then -- NEW 'ELSEIF' |
||
481 | dataSource = AtlasLootWBItems; |
||
482 | elseif ( AtlasLootSetItems[dataID] ) then -- NEW 'ELSEIF' |
||
483 | dataSource = AtlasLootSetItems; |
||
484 | |||
485 | -- ------------ elseif ( item exists in any new arrays added in the future such as External Raid Bosses ) then ...... |
||
486 | |||
487 | end |
||
488 | |||
489 | AtlasLoot_AnchorFrame = pFrame; -- Added |
||
490 | AtlasLootItemsFrame.externalBoss = dataID; |
||
491 | AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame); |
||
492 | end |
||
493 | |||
494 | end |
||
495 | |||
496 | -------------------------------------------------------------------------------- |
||
497 | -- Setup Atlas Dependant XML Components |
||
498 | -------------------------------------------------------------------------------- |
||
499 | |||
500 | function AtlasLoot_SetupForAtlas() |
||
501 | |||
502 | AtlasLootBossLinesFrame:ClearAllPoints(); |
||
503 | AtlasLootBossLinesFrame:SetParent(AtlasFrame); |
||
504 | AtlasLootBossLinesFrame:SetPoint("TOPLEFT", "AtlasText_ZoneName", "TOPLEFT", 0, -80); |
||
505 | |||
506 | for i=1, ATLAS_LOOT_BOSS_LINES, 1 do |
||
507 | getglobal("AtlasBossLine_"..i):ClearAllPoints(); |
||
508 | local anchorTo = "AtlasText_"..i; |
||
509 | getglobal("AtlasBossLine_"..i):SetPoint("TOPLEFT", anchorTo, "TOPLEFT", 0, 0); |
||
510 | end |
||
511 | |||
512 | AtlasLootInfo:ClearAllPoints(); |
||
513 | AtlasLootInfo:SetParent(AtlasFrame); |
||
514 | AtlasLootInfo:SetPoint("TOPLEFT", "AtlasFrame", "TOPLEFT", 546, -50); |
||
515 | |||
516 | AtlasLootPanel:ClearAllPoints(); |
||
517 | AtlasLootPanel:SetParent(AtlasFrame); |
||
518 | AtlasLootPanel:SetPoint("TOP", "AtlasFrame", "BOTTOM", 0, 9); |
||
519 | |||
520 | AtlasLoot_SetItemInfoFrame(); |
||
521 | AtlasLootItemsFrame:Hide(); |
||
522 | |||
523 | end |
||
524 | |||
525 | function AtlasLoot_SetItemInfoFrame(pFrame) |
||
526 | if ( pFrame ) then |
||
527 | if(pFrame==AtlasFrame and AtlasFrame) then |
||
528 | AtlasLootItemsFrame:ClearAllPoints(); |
||
529 | AtlasLootItemsFrame:SetParent(AtlasFrame); |
||
530 | AtlasLootItemsFrame:SetPoint("TOPLEFT", "AtlasFrame", "TOPLEFT", 18, -84); |
||
531 | else |
||
532 | AtlasLootItemsFrame:ClearAllPoints(); |
||
533 | AtlasLootItemsFrame:SetParent(pFrame[2]); |
||
534 | AtlasLootItemsFrame:ClearAllPoints(); |
||
535 | AtlasLootItemsFrame:SetPoint(pFrame[1], pFrame[2], pFrame[3], pFrame[4], pFrame[5]); |
||
536 | end |
||
537 | elseif ( AtlasFrame ) then |
||
538 | AtlasLootItemsFrame:ClearAllPoints(); |
||
539 | AtlasLootItemsFrame:SetParent(AtlasFrame); |
||
540 | AtlasLootItemsFrame:SetPoint("TOPLEFT", "AtlasFrame", "TOPLEFT", 18, -84); |
||
541 | else |
||
542 | AtlasLootItemsFrame:ClearAllPoints(); |
||
543 | AtlasLootItemsFrame:SetParent(UIParent); |
||
544 | AtlasLootItemsFrame:SetPoint("CENTER", "UIParent", "CENTER", 0, 0); |
||
545 | end |
||
546 | AtlasLootItemsFrame:Show(); |
||
547 | end |