Mercurial > wow > askmrrobot
comparison ui/SummaryTab.lua @ 11:ece9167c0d1c v1.2.14.0
Localization support, combat log features (wipe command, aura/pet tracking, and realm detection).
author | yellowfive |
---|---|
date | Thu, 10 Jul 2014 12:24:59 -0700 |
parents | ec731d2fe6ba |
children | e77e01abce98 |
comparison
equal
deleted
inserted
replaced
10:ef8b45e96b08 | 11:ece9167c0d1c |
---|---|
1 local _, AskMrRobot = ... | 1 local _, AskMrRobot = ... |
2 local L = AskMrRobot.L; | |
2 | 3 |
3 AskMrRobot.SummaryTab = AskMrRobot.inheritsFrom(AskMrRobot.Frame) | 4 AskMrRobot.SummaryTab = AskMrRobot.inheritsFrom(AskMrRobot.Frame) |
4 | 5 |
5 function AskMrRobot.SummaryTab:new(parent) | 6 function AskMrRobot.SummaryTab:new(parent) |
6 | 7 |
13 | 14 |
14 tab.importDate = "" | 15 tab.importDate = "" |
15 | 16 |
16 local text = tab:CreateFontString("AmrSummaryText1", "ARTWORK", "GameFontNormalLarge") | 17 local text = tab:CreateFontString("AmrSummaryText1", "ARTWORK", "GameFontNormalLarge") |
17 text:SetPoint("TOPLEFT", 0, -5) | 18 text:SetPoint("TOPLEFT", 0, -5) |
18 text:SetFormattedText("Summary") | 19 text:SetFormattedText(L.AMR_SUMMARYTAB_TITLE) |
19 | 20 |
20 -- error text | 21 -- error text |
21 tab.errorText1 = tab:CreateFontString("AmrSummaryErrorText1", "ARTWORK", "GameFontRedLarge") | 22 tab.errorText1 = tab:CreateFontString("AmrSummaryErrorText1", "ARTWORK", "GameFontRedLarge") |
22 tab.errorText1:SetPoint("TOPLEFT", "AmrSummaryText1", "BOTTOMLEFT", 0, -20) | 23 tab.errorText1:SetPoint("TOPLEFT", "AmrSummaryText1", "BOTTOMLEFT", 0, -20) |
23 tab.errorText1:SetText("You have no optimizations imported.") | 24 tab.errorText1:SetText(L.AMR_SUMMARYTAB_NO_IMPORT) |
24 tab.errorText1:SetPoint("RIGHT", -20, 0) | 25 tab.errorText1:SetPoint("RIGHT", -20, 0) |
25 tab.errorText1:SetWidth(tab.errorText1:GetWidth()) | 26 tab.errorText1:SetWidth(tab.errorText1:GetWidth()) |
26 tab.errorText1:SetWordWrap(true) | 27 tab.errorText1:SetWordWrap(true) |
27 tab.errorText1:SetJustifyH("LEFT") | 28 tab.errorText1:SetJustifyH("LEFT") |
28 | 29 |
29 tab.errorText2 = tab:CreateFontString("AmrSummaryErrorText2", "ARTWORK", "GameFontWhite") | 30 tab.errorText2 = tab:CreateFontString("AmrSummaryErrorText2", "ARTWORK", "GameFontWhite") |
30 tab.errorText2:SetPoint("TOPLEFT", "AmrSummaryErrorText1", "BOTTOMLEFT", 0, -15) | 31 tab.errorText2:SetPoint("TOPLEFT", "AmrSummaryErrorText1", "BOTTOMLEFT", 0, -15) |
31 tab.errorText2:SetPoint("RIGHT", -20, 0) | 32 tab.errorText2:SetPoint("RIGHT", -20, 0) |
32 tab.errorText2:SetWidth(tab.errorText2:GetWidth()) | 33 tab.errorText2:SetWidth(tab.errorText2:GetWidth()) |
33 tab.errorText2:SetJustifyH("LEFT") | 34 tab.errorText2:SetJustifyH("LEFT") |
34 tab.errorText2:SetText('Click the "Import" tab to get started.') | 35 tab.errorText2:SetText(L.AMR_SUMMARYTAB_GET_STARTED) |
35 | 36 |
36 -- bad items | 37 -- bad items |
37 tab.badItemSlots = {} | 38 tab.badItemSlots = {} |
38 tab.badItemNames = {} | 39 tab.badItemNames = {} |
39 | 40 |
55 | 56 |
56 itemText = tab:CreateFontString(nil, "ARTWORK", "GameFontWhite") | 57 itemText = tab:CreateFontString(nil, "ARTWORK", "GameFontWhite") |
57 itemText:SetPoint("LEFT", 0, 0) | 58 itemText:SetPoint("LEFT", 0, 0) |
58 itemText:SetPoint("RIGHT", -30, 0) | 59 itemText:SetPoint("RIGHT", -30, 0) |
59 itemText:SetPoint("TOP", "AmrBadItemSlot0", "TOP", 0, 0 ) | 60 itemText:SetPoint("TOP", "AmrBadItemSlot0", "TOP", 0, 0 ) |
60 itemText:SetText("Please upgrade the following items:") | 61 itemText:SetText(L.AMR_SUMMARYTAB_GO_UPGRADE) |
61 itemText:SetJustifyH("LEFT") | 62 itemText:SetJustifyH("LEFT") |
62 itemText:Hide() | 63 itemText:Hide() |
63 tab.upgradeInstructions = itemText | 64 tab.upgradeInstructions = itemText |
64 | 65 |
65 itemText = tab:CreateFontString(nil, "ARTWORK", "GameFontNormal") | 66 itemText = tab:CreateFontString(nil, "ARTWORK", "GameFontNormal") |
66 itemText:SetPoint("LEFT", "AmrBadItemSlot0", "LEFT", 0, -20) | 67 itemText:SetPoint("LEFT", "AmrBadItemSlot0", "LEFT", 0, -20) |
67 itemText:SetPoint("RIGHT", "AmrBadItemSlot0", "RIGHT", 0, -20) | 68 itemText:SetPoint("RIGHT", "AmrBadItemSlot0", "RIGHT", 0, -20) |
68 itemText:SetPoint("TOP", tab.upgradeInstructions, "BOTTOM", 0, -10 ) | 69 itemText:SetPoint("TOP", tab.upgradeInstructions, "BOTTOM", 0, -10 ) |
69 itemText:SetHeight(20) | 70 itemText:SetHeight(20) |
70 itemText:SetText("Slot") | 71 itemText:SetText(L.AMR_SUMMARYTAB_SLOT) |
71 itemText:SetJustifyH("LEFT") | 72 itemText:SetJustifyH("LEFT") |
72 itemText:Hide() | 73 itemText:Hide() |
73 tab.upgradeSlotHeader = itemText | 74 tab.upgradeSlotHeader = itemText |
74 | 75 |
75 itemText = tab:CreateFontString(nil, "ARTWORK", "GameFontNormal") | 76 itemText = tab:CreateFontString(nil, "ARTWORK", "GameFontNormal") |
76 itemText:SetPoint("LEFT", "AmrBadItemName0", "LEFT", 0, 0) | 77 itemText:SetPoint("LEFT", "AmrBadItemName0", "LEFT", 0, 0) |
77 itemText:SetPoint("RIGHT", "AmrBadItemName0", "RIGHT", 0, 0) | 78 itemText:SetPoint("RIGHT", "AmrBadItemName0", "RIGHT", 0, 0) |
78 itemText:SetPoint("TOP", tab.upgradeSlotHeader, "TOP", 0, 0) | 79 itemText:SetPoint("TOP", tab.upgradeSlotHeader, "TOP", 0, 0) |
79 itemText:SetPoint("BOTTOM", tab.upgradeSlotHeader, "BOTTOM", 0, 0) | 80 itemText:SetPoint("BOTTOM", tab.upgradeSlotHeader, "BOTTOM", 0, 0) |
80 itemText:SetText("Item Name") | 81 itemText:SetText(L.AMR_SUMMARYTAB_ITEM_NAME) |
81 itemText:SetJustifyH("LEFT") | 82 itemText:SetJustifyH("LEFT") |
82 itemText:Hide() | 83 itemText:Hide() |
83 tab.upgradeItemHeader = itemText | 84 tab.upgradeItemHeader = itemText |
84 | 85 |
85 for i = 1, #AskMrRobot.slotNames do | 86 for i = 1, #AskMrRobot.slotNames do |
123 itemText:Hide() | 124 itemText:Hide() |
124 tinsert(tab.upgradeItemNames, itemText) | 125 tinsert(tab.upgradeItemNames, itemText) |
125 end | 126 end |
126 | 127 |
127 tab.importInfo = tab:CreateFontString(nil, "ARTWORK", "GameFontNormal") | 128 tab.importInfo = tab:CreateFontString(nil, "ARTWORK", "GameFontNormal") |
128 tab.importInfo:SetText("Last import: ?\rThese optimizations are for ?") | 129 tab.importInfo:SetText(L.AMR_SUMMARYTAB_LAST_IMPORT) |
129 tab.importInfo:SetPoint("TOPLEFT", text, "BOTTOMLEFT", 0, -20) | 130 tab.importInfo:SetPoint("TOPLEFT", text, "BOTTOMLEFT", 0, -20) |
130 tab.importInfo:SetJustifyH("LEFT") | 131 tab.importInfo:SetJustifyH("LEFT") |
131 tab.importInfo:Hide() | 132 tab.importInfo:Hide() |
132 | 133 |
133 tab.specIcon = tab:CreateTexture(nil, "BACKGROUND") | 134 tab.specIcon = tab:CreateTexture(nil, "BACKGROUND") |
137 tab.specIcon:SetPoint("TOPLEFT", tab.importInfo, "BOTTOMLEFT", 0, -10) | 138 tab.specIcon:SetPoint("TOPLEFT", tab.importInfo, "BOTTOMLEFT", 0, -10) |
138 tab.specIcon:Hide() | 139 tab.specIcon:Hide() |
139 | 140 |
140 tab.stamp = AskMrRobot.RobotStamp:new(nil, tab) | 141 tab.stamp = AskMrRobot.RobotStamp:new(nil, tab) |
141 tab.stamp:Hide() | 142 tab.stamp:Hide() |
142 tab.stamp.smallText:SetText("Congratulations! You are 100% optimal") | 143 tab.stamp.smallText:SetText(L.AMR_SUMMARYTAB_OPTIMAL) |
143 tab.stamp:SetPoint("TOPLEFT", tab.specIcon, "BOTTOMLEFT", 2, -25) | 144 tab.stamp:SetPoint("TOPLEFT", tab.specIcon, "BOTTOMLEFT", 2, -25) |
144 tab.stamp:SetPoint("RIGHT", tab, "RIGHT", -20, 0) | 145 tab.stamp:SetPoint("RIGHT", tab, "RIGHT", -20, 0) |
145 tab.stamp:Hide() | 146 tab.stamp:Hide() |
146 | 147 |
147 tab.specText = tab:CreateFontString(nil, "ARTWORK", "GameFontHighlightLarge") | 148 tab.specText = tab:CreateFontString(nil, "ARTWORK", "GameFontHighlightLarge") |
151 tab.specText:SetText("?") | 152 tab.specText:SetText("?") |
152 tab.specText:Hide() | 153 tab.specText:Hide() |
153 | 154 |
154 tab.optimizationSummary = tab:CreateFontString(nil, "ARTWORK", "GameFontNormal") | 155 tab.optimizationSummary = tab:CreateFontString(nil, "ARTWORK", "GameFontNormal") |
155 tab.optimizationSummary:SetPoint("TOPLEFT", tab.specIcon, "BOTTOMLEFT", 0, -15) | 156 tab.optimizationSummary:SetPoint("TOPLEFT", tab.specIcon, "BOTTOMLEFT", 0, -15) |
156 tab.optimizationSummary:SetText("You have ? optimizations to make:") | 157 tab.optimizationSummary:SetText(L.AMR_SUMMARYTAB_OPTIMIZATIONS_TO_GO) |
157 tab.optimizationSummary:Hide() | 158 tab.optimizationSummary:Hide() |
158 | 159 |
159 tab.gemCount = tab:CreateFontString(nil, "ARTWORK", "GameFontWhite") | 160 tab.gemCount = tab:CreateFontString(nil, "ARTWORK", "GameFontWhite") |
160 tab.gemCount:SetPoint("TOPLEFT", tab.optimizationSummary, "BOTTOMLEFT", 0, -15) | 161 tab.gemCount:SetPoint("TOPLEFT", tab.optimizationSummary, "BOTTOMLEFT", 0, -15) |
161 tab.gemCount:SetText("? gems") | 162 tab.gemCount:SetText(L.AMR_SUMMARYTAB_GEMS_TO_GO) |
162 tab.gemCount:Hide() | 163 tab.gemCount:Hide() |
163 | 164 |
164 tab.enchantCount = tab:CreateFontString(nil, "ARTWORK", "GameFontWhite") | 165 tab.enchantCount = tab:CreateFontString(nil, "ARTWORK", "GameFontWhite") |
165 tab.enchantCount:SetPoint("TOPLEFT", tab.gemCount, "BOTTOMLEFT", 0, -5) | 166 tab.enchantCount:SetPoint("TOPLEFT", tab.gemCount, "BOTTOMLEFT", 0, -5) |
166 tab.enchantCount:SetText("? enchants") | 167 tab.enchantCount:SetText(L.AMR_SUMMARYTAB_ENCHANTS_TO_GO) |
167 tab.enchantCount:Hide() | 168 tab.enchantCount:Hide() |
168 | 169 |
169 tab.reforgeCount = tab:CreateFontString(nil, "ARTWORK", "GameFontWhite") | 170 tab.reforgeCount = tab:CreateFontString(nil, "ARTWORK", "GameFontWhite") |
170 tab.reforgeCount:SetPoint("TOPLEFT", tab.enchantCount, "BOTTOMLEFT", 0, -5) | 171 tab.reforgeCount:SetPoint("TOPLEFT", tab.enchantCount, "BOTTOMLEFT", 0, -5) |
171 tab.reforgeCount:SetText("? reforges") | 172 tab.reforgeCount:SetText(L.AMR_SUMMARYTAB_REFORGES_TO_GO) |
172 tab.reforgeCount:Hide() | 173 tab.reforgeCount:Hide() |
173 | 174 |
174 tab.instructions = tab:CreateFontString(nil, "ARTWORK", "GameFontWhite") | 175 tab.instructions = tab:CreateFontString(nil, "ARTWORK", "GameFontWhite") |
175 tab.instructions:SetPoint("TOPLEFT", tab.reforgeCount, "BOTTOMLEFT", 0, -15) | 176 tab.instructions:SetPoint("TOPLEFT", tab.reforgeCount, "BOTTOMLEFT", 0, -15) |
176 tab.instructions:SetText("View the Gem, Enchant and Reforge tabs for suggested optimizations.") | 177 tab.instructions:SetText(L.AMR_SUMMARYTAB_VIEW_TABS) |
177 tab.instructions:Hide() | 178 tab.instructions:Hide() |
178 | 179 |
179 return tab | 180 return tab |
180 end | 181 end |
181 | 182 |
244 for k, v in pairs(badGems.badGems) do | 245 for k, v in pairs(badGems.badGems) do |
245 gemCount = gemCount + 1 | 246 gemCount = gemCount + 1 |
246 end | 247 end |
247 end | 248 end |
248 | 249 |
249 self.gemCount:SetFormattedText("%d \1244gem:gems;", gemCount) | 250 self.gemCount:SetFormattedText(L.AMR_SUMMARYTAB_GEMCOUNT, gemCount) |
250 | 251 |
251 local enchantCount = 0 | 252 local enchantCount = 0 |
252 for slotNum, badEnchant in pairs(AskMrRobot.itemDiffs.enchants) do | 253 for slotNum, badEnchant in pairs(AskMrRobot.itemDiffs.enchants) do |
253 enchantCount = enchantCount + 1 | 254 enchantCount = enchantCount + 1 |
254 end | 255 end |
255 | 256 |
256 self.enchantCount:SetFormattedText("%d \1244enchant:enchants;", enchantCount) | 257 self.enchantCount:SetFormattedText(L.AMR_SUMMARYTAB_ENCHANTCOUNT, enchantCount) |
257 | 258 |
258 local reforgeCount = 0 | 259 local reforgeCount = 0 |
259 for slotNum, badReforge in pairs(AskMrRobot.itemDiffs.reforges) do | 260 for slotNum, badReforge in pairs(AskMrRobot.itemDiffs.reforges) do |
260 reforgeCount = reforgeCount + 1 | 261 reforgeCount = reforgeCount + 1 |
261 end | 262 end |
262 | 263 |
263 self.reforgeCount:SetFormattedText("%d \1244reforge:reforges;", reforgeCount) | 264 self.reforgeCount:SetFormattedText(L.AMR_SUMMARYTAB_REFORGECOUNT, reforgeCount) |
264 self.optimizationSummary:SetFormattedText("You have %d \1244optimization:optimizations; to make:", gemCount + enchantCount + reforgeCount) | 265 self.optimizationSummary:SetFormattedText(L.AMR_SUMMARYTAB_OPTIMIZATIONCOUNT, gemCount + enchantCount + reforgeCount) |
265 | 266 |
266 if gemCount + enchantCount + reforgeCount == 0 then | 267 if gemCount + enchantCount + reforgeCount == 0 then |
267 self.stamp:Show() | 268 self.stamp:Show() |
268 self.optimizationSummary:Hide() | 269 self.optimizationSummary:Hide() |
269 self.enchantCount:Hide() | 270 self.enchantCount:Hide() |
280 end | 281 end |
281 | 282 |
282 local activeSpecGroup = GetActiveSpecGroup() | 283 local activeSpecGroup = GetActiveSpecGroup() |
283 | 284 |
284 if activeSpecGroup == nil then | 285 if activeSpecGroup == nil then |
285 self.importInfo:SetFormattedText("Last import: %s\rThese optimizations are for %s", self.importDate, UnitName("player")) | 286 self.importInfo:SetFormattedText(L.AMR_SUMMARYTAB_LAST_IMPORT_1, self.importDate, UnitName("player")) |
286 else | 287 else |
287 self.importInfo:SetFormattedText("Last import: %s\rThese optimizations are for %s's...", self.importDate, UnitName("player")) | 288 self.importInfo:SetFormattedText(L.AMR_SUMMARYTAB_LAST_IMPORT_2, self.importDate, UnitName("player")) |
288 local spec = GetSpecialization(false, false, group); | 289 local spec = GetSpecialization(false, false, group); |
289 if spec then | 290 if spec then |
290 local _, name, _, icon = GetSpecializationInfo(spec); | 291 local _, name, _, icon = GetSpecializationInfo(spec); |
291 if activeSpecGroup == 1 then | 292 if activeSpecGroup == 1 then |
292 self.specText:SetFormattedText("Primary Spec - %s", name) | 293 self.specText:SetFormattedText(L.AMR_SUMMARYTAB_LAST_IMPORT_PSPEC, name) |
293 else | 294 else |
294 self.specText:SetFormattedText("Secondary Spec - %s", name) | 295 self.specText:SetFormattedText(L.AMR_SUMMARYTAB_LAST_IMPORT_SSPEC, name) |
295 end | 296 end |
296 self.specIcon:SetTexture(icon) | 297 self.specIcon:SetTexture(icon) |
297 end | 298 end |
298 end | 299 end |
299 | 300 |
317 else | 318 else |
318 self.badItemSlots[1]:Show() | 319 self.badItemSlots[1]:Show() |
319 self.badItemNames[1]:Show() | 320 self.badItemNames[1]:Show() |
320 local warnings = {} | 321 local warnings = {} |
321 if self.badRealm then | 322 if self.badRealm then |
322 tinsert(warnings, "a different realm: " .. self.badRealm) | 323 tinsert(warnings, L.AMR_SUMMARYTAB_DIFF_REALM:format(self.badRealm)) |
323 end | 324 end |
324 if self.badTalents then | 325 if self.badTalents then |
325 tinsert(warnings, "different talents") | 326 tinsert(warnings, L.AMR_SUMMARYTAB_DIFF_TALENT) |
326 end | 327 end |
327 if self.badGlyphs then | 328 if self.badGlyphs then |
328 tinsert(warnings, "different glyphs") | 329 tinsert(warnings, L.AMR_SUMMARYTAB_DIFF_GLYPHS) |
329 end | 330 end |
330 local message = "Mr. Robot optimized a different set of gear" | 331 local message = L.AMR_SUMMARYTAB_DIFF_GEAR |
331 if #warnings > 0 then | 332 if #warnings > 0 then |
332 message = message .. " (and " | 333 message = message .. " (".. L.AMR_SUMMARYTAB_DIFF_AND.." " |
333 for k = 1, #warnings do | 334 for k = 1, #warnings do |
334 if k > 1 then | 335 if k > 1 then |
335 message = message .. ', ' | 336 message = message .. ', ' |
336 end | 337 end |
337 message = message .. warnings[k] | 338 message = message .. warnings[k] |
338 end | 339 end |
339 message = message .. ")" | 340 message = message .. ")" |
340 end | 341 end |
341 message = message .. ". Please equip the following items before proceeding with the optimizations." | 342 message = message .. L.AMR_SUMMARYTAB_DIFF_PLEASE_EQ |
342 self:showImportWarning("WARNING: Please check your character before proceeding:", message) | 343 self:showImportWarning(L.AMR_SUMMARYTAB_DIFF_CHECK_CHAR, message) |
343 end | 344 end |
344 | 345 |
345 if j == 1 then | 346 if j == 1 then |
346 self.upgradeItemHeader:Hide() | 347 self.upgradeItemHeader:Hide() |
347 self.upgradeSlotHeader:Hide() | 348 self.upgradeSlotHeader:Hide() |
348 self.upgradeInstructions:Hide() | 349 self.upgradeInstructions:Hide() |
349 else | 350 else |
350 if i == 2 then | 351 if i == 2 then |
351 local warnings = {} | 352 local warnings = {} |
352 if self.badRealm then | 353 if self.badRealm then |
353 tinsert(warnings, "a different realm: " .. self.badRealm) | 354 tinsert(warnings, L.AMR_SUMMARYTAB_DIFF_REALM:format(self.badRealm)) |
354 end | 355 end |
355 if self.badTalents then | 356 if self.badTalents then |
356 tinsert(warnings, "different talents") | 357 tinsert(warnings, L.AMR_SUMMARYTAB_DIFF_TALENT) |
357 end | 358 end |
358 if self.badGlyphs then | 359 if self.badGlyphs then |
359 tinsert(warnings, "different glyphs") | 360 tinsert(warnings, L.AMR_SUMMARYTAB_DIFF_GLYPHS) |
360 end | 361 end |
361 local message = nil | 362 local message = nil |
362 if #warnings > 0 then | 363 if #warnings > 0 then |
363 message = "Mr. Robot optimized for " | 364 message = L.AMR_SUMMARYTAB_DIFF_OPTIMIZED_FOR |
364 for k = 1, #warnings do | 365 for k = 1, #warnings do |
365 if k > 1 then | 366 if k > 1 then |
366 message = message .. ', ' | 367 message = message .. ', ' |
367 end | 368 end |
368 message = message .. warnings[k] | 369 message = message .. warnings[k] |
369 end | 370 end |
370 message = message .. "." | 371 message = message .. "." |
371 end | 372 end |
372 self:showImportWarning("WARNING: Please check your character before proceeding:", message) | 373 self:showImportWarning(L.AMR_SUMMARYTAB_DIFF_CHECK_CHAR, message) |
373 end | 374 end |
374 self.upgradeItemHeader:Show() | 375 self.upgradeItemHeader:Show() |
375 self.upgradeSlotHeader:Show() | 376 self.upgradeSlotHeader:Show() |
376 self.upgradeInstructions:Show() | 377 self.upgradeInstructions:Show() |
377 if i == 2 then | 378 if i == 2 then |
405 self.reforgeCount:Hide() | 406 self.reforgeCount:Hide() |
406 self.enchantCount:Hide() | 407 self.enchantCount:Hide() |
407 self.optimizationSummary:Hide() | 408 self.optimizationSummary:Hide() |
408 if text then | 409 if text then |
409 self.errorText1:Show() | 410 self.errorText1:Show() |
410 self.errorText1:SetText('Error! Your import did not work:|n|n' .. text) | 411 self.errorText1:SetText(L.AMR_SUMMARYTAB_IMPORT_NOT_WORK:format(text)) |
411 self.errorText1:Show() | 412 self.errorText1:Show() |
412 self.errorText2:SetText(text2) | 413 self.errorText2:SetText(text2) |
413 self.errorText2:Show() | 414 self.errorText2:Show() |
414 self.importInfo:Hide() | 415 self.importInfo:Hide() |
415 self.upgradeSlotHeader:Hide() | 416 self.upgradeSlotHeader:Hide() |