Mercurial > wow > askmrrobot
comparison ui/SummaryTab.lua @ 17:e77e01abce98
Warlords of Draenor pre-patch
author | Adam tegen <adam.tegen@gmail.com> |
---|---|
date | Mon, 13 Oct 2014 21:28:32 -0500 |
parents | ece9167c0d1c |
children | 44c285acfff0 |
comparison
equal
deleted
inserted
replaced
16:9793e8b683d2 | 17:e77e01abce98 |
---|---|
81 itemText:SetText(L.AMR_SUMMARYTAB_ITEM_NAME) | 81 itemText:SetText(L.AMR_SUMMARYTAB_ITEM_NAME) |
82 itemText:SetJustifyH("LEFT") | 82 itemText:SetJustifyH("LEFT") |
83 itemText:Hide() | 83 itemText:Hide() |
84 tab.upgradeItemHeader = itemText | 84 tab.upgradeItemHeader = itemText |
85 | 85 |
86 for i = 1, #AskMrRobot.slotNames do | 86 for i = 1, #AskMrRobot.slotIds do |
87 local itemText = tab:CreateFontString("AmrBadItemSlot" .. i, "ARTWORK", "GameFontWhite") | 87 local itemText = tab:CreateFontString("AmrBadItemSlot" .. i, "ARTWORK", "GameFontWhite") |
88 itemText:SetPoint("TOPLEFT", "AmrBadItemSlot" .. (i-1), "BOTTOMLEFT", 0, -5) | 88 itemText:SetPoint("TOPLEFT", "AmrBadItemSlot" .. (i-1), "BOTTOMLEFT", 0, -5) |
89 itemText:SetPoint("TOPRIGHT", "AmrBadItemSlot" .. (i-1), "BOTTOMRIGHT", 0, -5) | 89 itemText:SetPoint("TOPRIGHT", "AmrBadItemSlot" .. (i-1), "BOTTOMRIGHT", 0, -5) |
90 itemText:SetJustifyH("LEFT") | 90 itemText:SetJustifyH("LEFT") |
91 itemText:Hide() | 91 itemText:Hide() |
100 tinsert(tab.badItemNames, itemText) | 100 tinsert(tab.badItemNames, itemText) |
101 end | 101 end |
102 | 102 |
103 tab.upgradeItemSlots = {} | 103 tab.upgradeItemSlots = {} |
104 tab.upgradeItemNames = {} | 104 tab.upgradeItemNames = {} |
105 for i = 1, #AskMrRobot.slotNames do | 105 for i = 1, #AskMrRobot.slotIds do |
106 local itemText = tab:CreateFontString(nil, "ARTWORK", "GameFontWhite") | 106 local itemText = tab:CreateFontString(nil, "ARTWORK", "GameFontWhite") |
107 if i == 1 then | 107 if i == 1 then |
108 itemText:SetPoint("TOPLEFT", tab.upgradeSlotHeader, "BOTTOMLEFT", 0, -5) | 108 itemText:SetPoint("TOPLEFT", tab.upgradeSlotHeader, "BOTTOMLEFT", 0, -5) |
109 itemText:SetPoint("TOPRIGHT", tab.upgradeSlotHeader, "BOTTOMRIGHT", 0, -5) | 109 itemText:SetPoint("TOPRIGHT", tab.upgradeSlotHeader, "BOTTOMRIGHT", 0, -5) |
110 else | 110 else |
165 tab.enchantCount = tab:CreateFontString(nil, "ARTWORK", "GameFontWhite") | 165 tab.enchantCount = tab:CreateFontString(nil, "ARTWORK", "GameFontWhite") |
166 tab.enchantCount:SetPoint("TOPLEFT", tab.gemCount, "BOTTOMLEFT", 0, -5) | 166 tab.enchantCount:SetPoint("TOPLEFT", tab.gemCount, "BOTTOMLEFT", 0, -5) |
167 tab.enchantCount:SetText(L.AMR_SUMMARYTAB_ENCHANTS_TO_GO) | 167 tab.enchantCount:SetText(L.AMR_SUMMARYTAB_ENCHANTS_TO_GO) |
168 tab.enchantCount:Hide() | 168 tab.enchantCount:Hide() |
169 | 169 |
170 tab.reforgeCount = tab:CreateFontString(nil, "ARTWORK", "GameFontWhite") | |
171 tab.reforgeCount:SetPoint("TOPLEFT", tab.enchantCount, "BOTTOMLEFT", 0, -5) | |
172 tab.reforgeCount:SetText(L.AMR_SUMMARYTAB_REFORGES_TO_GO) | |
173 tab.reforgeCount:Hide() | |
174 | |
175 tab.instructions = tab:CreateFontString(nil, "ARTWORK", "GameFontWhite") | 170 tab.instructions = tab:CreateFontString(nil, "ARTWORK", "GameFontWhite") |
176 tab.instructions:SetPoint("TOPLEFT", tab.reforgeCount, "BOTTOMLEFT", 0, -15) | 171 tab.instructions:SetPoint("TOPLEFT", tab.enchantCount, "BOTTOMLEFT", 0, -15) |
177 tab.instructions:SetText(L.AMR_SUMMARYTAB_VIEW_TABS) | 172 tab.instructions:SetText(L.AMR_SUMMARYTAB_VIEW_TABS) |
178 tab.instructions:Hide() | 173 tab.instructions:Hide() |
179 | 174 |
180 return tab | 175 return tab |
181 end | 176 end |
189 end | 184 end |
190 return nil | 185 return nil |
191 end | 186 end |
192 | 187 |
193 function AskMrRobot.SummaryTab:showBadItems() | 188 function AskMrRobot.SummaryTab:showBadItems() |
194 local badItems = AskMrRobot.itemDiffs.items | |
195 | |
196 local i = 2 | 189 local i = 2 |
197 | 190 |
198 -- for all the bad items | 191 -- for all slots |
199 for slotNum, badItem in AskMrRobot.sortSlots(badItems) do | 192 for iSlot = 1, #AskMrRobot.slotIds do |
200 if not badItem.needsUpgrade then | 193 local slotId = AskMrRobot.slotIds[iSlot] |
201 self.badItemSlots[i]:SetText(_G[strupper(AskMrRobot.slotNames[slotNum])]) | 194 local badItem = AskMrRobot.ComparisonResult.items[slotId] |
195 if badItem ~= nil and not badItem.needsUpgrade then | |
196 self.badItemSlots[i]:SetText(AskMrRobot.slotDisplayText[slotId]) | |
202 self.badItemSlots[i]:Show() | 197 self.badItemSlots[i]:Show() |
203 if badItem.optimized then | 198 if badItem.optimized then |
204 self.badItemNames[i]:SetItemId(badItem.optimized.itemId, badItem.optimized.upgradeId, badItem.optimized.suffixId) | 199 self.badItemNames[i]:SetItemId(badItem.optimized.id, badItem.optimized.upgradeId, badItem.optimized.suffixId) |
205 else | 200 else |
206 self.badItemNames[i]:SetItemId(nil, 0, 0) | 201 self.badItemNames[i]:SetItemId(nil, 0, 0) |
207 end | 202 end |
208 self.badItemNames[i]:Show() | 203 self.badItemNames[i]:Show() |
209 i = i + 1 | 204 i = i + 1 |
210 end | 205 end |
211 end | 206 end |
212 | 207 |
213 -- for all the upgrade items | 208 -- for all the upgrade items |
214 local j = 1 | 209 local j = 1 |
215 for slotNum, badItem in AskMrRobot.sortSlots(badItems) do | 210 for iSlot = 1, #AskMrRobot.slotIds do |
216 if badItem.needsUpgrade then | 211 local slotId = AskMrRobot.slotIds[iSlot] |
217 self.upgradeItemSlots[j]:SetText(_G[strupper(AskMrRobot.slotNames[slotNum])]) | 212 local badItem = AskMrRobot.ComparisonResult.items[slotId] |
213 if badItem ~= nil and badItem.needsUpgrade then | |
214 self.upgradeItemSlots[j]:SetText(AskMrRobot.slotDisplayText[slotId]) | |
218 self.upgradeItemSlots[j]:Show() | 215 self.upgradeItemSlots[j]:Show() |
219 if badItem.optimized then | 216 if badItem.optimized then |
220 self.upgradeItemNames[j]:SetItemId(badItem.optimized.itemId, badItem.optimized.upgradeId, badItem.optimized.suffixId) | 217 self.upgradeItemNames[j]:SetItemId(badItem.optimized.id, badItem.optimized.upgradeId, badItem.optimized.suffixId) |
221 else | 218 else |
222 self.upgradeItemNames[j]:SetItemId(nil, 0, 0) | 219 self.upgradeItemNames[j]:SetItemId(nil, 0, 0) |
223 end | 220 end |
224 self.upgradeItemNames[j]:Show() | 221 self.upgradeItemNames[j]:Show() |
225 j = j + 1 | 222 j = j + 1 |
234 self.importInfo:Show() | 231 self.importInfo:Show() |
235 self.specIcon:Show() | 232 self.specIcon:Show() |
236 self.optimizationSummary:Show() | 233 self.optimizationSummary:Show() |
237 self.gemCount:Show() | 234 self.gemCount:Show() |
238 self.enchantCount:Show() | 235 self.enchantCount:Show() |
239 self.reforgeCount:Show() | |
240 self.instructions:Show() | 236 self.instructions:Show() |
241 self.specText:Show() | 237 self.specText:Show() |
242 | 238 |
243 local gemCount = 0 | 239 local gemCount = 0 |
244 for slotNum, badGems in pairs(AskMrRobot.itemDiffs.gems) do | 240 for slotNum, badGems in pairs(AskMrRobot.ComparisonResult.gems) do |
245 for k, v in pairs(badGems.badGems) do | 241 --for k, v in pairs(badGems.badGems) do |
246 gemCount = gemCount + 1 | 242 --gemCount = gemCount + 1 |
243 --end | |
244 for g = 1, 3 do | |
245 if not AskMrRobot.AreGemsCompatible(badGems.current[g], badGems.optimized[g]) then | |
246 gemCount = gemCount + 1 | |
247 end | |
247 end | 248 end |
248 end | 249 end |
249 | 250 |
250 self.gemCount:SetFormattedText(L.AMR_SUMMARYTAB_GEMCOUNT, gemCount) | 251 self.gemCount:SetFormattedText(L.AMR_SUMMARYTAB_GEMCOUNT, gemCount) |
251 | 252 |
252 local enchantCount = 0 | 253 local enchantCount = 0 |
253 for slotNum, badEnchant in pairs(AskMrRobot.itemDiffs.enchants) do | 254 for slotNum, badEnchant in pairs(AskMrRobot.ComparisonResult.enchants) do |
254 enchantCount = enchantCount + 1 | 255 enchantCount = enchantCount + 1 |
255 end | 256 end |
256 | 257 |
257 self.enchantCount:SetFormattedText(L.AMR_SUMMARYTAB_ENCHANTCOUNT, enchantCount) | 258 self.enchantCount:SetFormattedText(L.AMR_SUMMARYTAB_ENCHANTCOUNT, enchantCount) |
258 | 259 |
259 local reforgeCount = 0 | 260 self.optimizationSummary:SetFormattedText(L.AMR_SUMMARYTAB_OPTIMIZATIONCOUNT, gemCount + enchantCount) |
260 for slotNum, badReforge in pairs(AskMrRobot.itemDiffs.reforges) do | 261 |
261 reforgeCount = reforgeCount + 1 | 262 if gemCount + enchantCount == 0 then |
262 end | |
263 | |
264 self.reforgeCount:SetFormattedText(L.AMR_SUMMARYTAB_REFORGECOUNT, reforgeCount) | |
265 self.optimizationSummary:SetFormattedText(L.AMR_SUMMARYTAB_OPTIMIZATIONCOUNT, gemCount + enchantCount + reforgeCount) | |
266 | |
267 if gemCount + enchantCount + reforgeCount == 0 then | |
268 self.stamp:Show() | 263 self.stamp:Show() |
269 self.optimizationSummary:Hide() | 264 self.optimizationSummary:Hide() |
270 self.enchantCount:Hide() | 265 self.enchantCount:Hide() |
271 self.reforgeCount:Hide() | |
272 self.instructions:Hide() | 266 self.instructions:Hide() |
273 self.gemCount:Hide() | 267 self.gemCount:Hide() |
274 else | 268 else |
275 self.stamp:Hide() | 269 self.stamp:Hide() |
276 self.optimizationSummary:Show() | 270 self.optimizationSummary:Show() |
277 self.enchantCount:Show() | 271 self.enchantCount:Show() |
278 self.reforgeCount:Show() | |
279 self.instructions:Show() | 272 self.instructions:Show() |
280 self.gemCount:Show() | 273 self.gemCount:Show() |
281 end | 274 end |
282 | 275 |
283 local activeSpecGroup = GetActiveSpecGroup() | 276 local activeSpecGroup = GetActiveSpecGroup() |
284 | 277 |
285 if activeSpecGroup == nil then | 278 if activeSpecGroup == nil then |
286 self.importInfo:SetFormattedText(L.AMR_SUMMARYTAB_LAST_IMPORT_1, self.importDate, UnitName("player")) | 279 self.importInfo:SetFormattedText(L.AMR_SUMMARYTAB_LAST_IMPORT_1, AmrDb.LastCharacterImportDate, UnitName("player")) |
287 else | 280 else |
288 self.importInfo:SetFormattedText(L.AMR_SUMMARYTAB_LAST_IMPORT_2, self.importDate, UnitName("player")) | 281 self.importInfo:SetFormattedText(L.AMR_SUMMARYTAB_LAST_IMPORT_2, AmrDb.LastCharacterImportDate, UnitName("player")) |
289 local spec = GetSpecialization(false, false, group); | 282 local spec = GetSpecialization(false, false, group); |
290 if spec then | 283 if spec then |
291 local _, name, _, icon = GetSpecializationInfo(spec); | 284 local _, name, _, icon = GetSpecializationInfo(spec); |
292 if activeSpecGroup == 1 then | 285 if activeSpecGroup == 1 then |
293 self.specText:SetFormattedText(L.AMR_SUMMARYTAB_LAST_IMPORT_PSPEC, name) | 286 self.specText:SetFormattedText(L.AMR_SUMMARYTAB_LAST_IMPORT_PSPEC, name) |
305 self.importInfo:Hide() | 298 self.importInfo:Hide() |
306 self.specIcon:Hide() | 299 self.specIcon:Hide() |
307 self.optimizationSummary:Hide() | 300 self.optimizationSummary:Hide() |
308 self.gemCount:Hide() | 301 self.gemCount:Hide() |
309 self.enchantCount:Hide() | 302 self.enchantCount:Hide() |
310 self.reforgeCount:Hide() | |
311 self.instructions:Hide() | 303 self.instructions:Hide() |
312 self.specText:Hide() | 304 self.specText:Hide() |
313 end | 305 end |
314 | 306 |
315 if i == 2 then | 307 if i == 2 then |
401 | 393 |
402 function AskMrRobot.SummaryTab:showImportError(text, text2) | 394 function AskMrRobot.SummaryTab:showImportError(text, text2) |
403 self.stamp:Hide() | 395 self.stamp:Hide() |
404 self.gemCount:Hide() | 396 self.gemCount:Hide() |
405 self.instructions:Hide() | 397 self.instructions:Hide() |
406 self.reforgeCount:Hide() | |
407 self.enchantCount:Hide() | 398 self.enchantCount:Hide() |
408 self.optimizationSummary:Hide() | 399 self.optimizationSummary:Hide() |
409 if text then | 400 if text then |
410 self.errorText1:Show() | 401 self.errorText1:Show() |
411 self.errorText1:SetText(L.AMR_SUMMARYTAB_IMPORT_NOT_WORK:format(text)) | 402 self.errorText1:SetText(L.AMR_SUMMARYTAB_IMPORT_NOT_WORK:format(text)) |
421 else | 412 else |
422 self.errorText1:Hide() | 413 self.errorText1:Hide() |
423 self.errorText2:Hide() | 414 self.errorText2:Hide() |
424 self.importInfo:Show() | 415 self.importInfo:Show() |
425 end | 416 end |
426 for i = 1, #AskMrRobot.slotNames + 1 do | 417 for i = 1, #self.badItemSlots do |
427 self.badItemSlots[i]:Hide() | 418 self.badItemSlots[i]:Hide() |
428 self.badItemNames[i]:Hide() | 419 self.badItemNames[i]:Hide() |
429 end | 420 end |
430 for i = 1, #AskMrRobot.slotNames do | 421 for i = 1, #self.upgradeItemSlots do |
431 self.upgradeItemSlots[i]:Hide() | 422 self.upgradeItemSlots[i]:Hide() |
432 self.upgradeItemNames[i]:Hide() | 423 self.upgradeItemNames[i]:Hide() |
433 end | 424 end |
434 end | 425 end |
435 | 426 |
436 function AskMrRobot.SummaryTab:showImportWarning (text, text2) | 427 function AskMrRobot.SummaryTab:showImportWarning (text, text2) |
437 self.stamp:Hide() | 428 self.stamp:Hide() |
438 self.hasImportError = false | 429 self.hasImportError = false |
439 self.gemCount:Hide() | 430 self.gemCount:Hide() |
440 self.instructions:Hide() | 431 self.instructions:Hide() |
441 self.reforgeCount:Hide() | |
442 self.enchantCount:Hide() | 432 self.enchantCount:Hide() |
443 self.specIcon:Hide() | 433 self.specIcon:Hide() |
444 self.specText:Hide() | 434 self.specText:Hide() |
445 self.optimizationSummary:Hide() | 435 self.optimizationSummary:Hide() |
446 if text then | 436 if text then |