comparison AskMrRobotUi.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 local showImportDetailsError = nil 4 local showImportDetailsError = nil
4 local showImportErrorTab = nil 5 local showImportErrorTab = nil
5 6
6 AskMrRobot.AmrUI = AskMrRobot.inheritsFrom(AskMrRobot.Frame) 7 AskMrRobot.AmrUI = AskMrRobot.inheritsFrom(AskMrRobot.Frame)
100 self.mostlySuccess = false 101 self.mostlySuccess = false
101 102
102 local parsed = AskMrRobot.parseAmr(input) 103 local parsed = AskMrRobot.parseAmr(input)
103 104
104 if not parsed.realm then 105 if not parsed.realm then
105 self:showImportError("Oops, you didn't have proper import text", "Please go back to AskMrRobot.com and grab optimizations for this character") 106 self:showImportError(L.AMR_UI_IMPORT_ERROR_IMPROPER,L.AMR_UI_IMPORT_ERROR_IMPROPER_GOTO)
106 elseif not AskMrRobot.validateCharacterName(parsed.name) then 107 elseif not AskMrRobot.validateCharacterName(parsed.name) then
107 self:showImportError("Oops, you've imported optimizations for " .. parsed.name, "Please go back to AskMrRobot.com and grab optimizations for this character, who is much better looking anyway!") 108 self:showImportError(L.AMR_UI_IMPORT_ERROR_CHARACTER:format(parsed.name), L.AMR_UI_IMPORT_ERROR_CHARACTER_GOTO)
108 elseif not AskMrRobot.validateRace(parsed.race) then 109 elseif not AskMrRobot.validateRace(parsed.race) then
109 self:showImportError("It looks like your race may have changed, which affects the optimizations.", "Right now, Mr. Robot thinks you are a " .. parsed.race) 110 self:showImportError(L.AMR_UI_IMPORT_ERROR_RACE, L.AMR_UI_IMPORT_ERROR_RACE_CURRENT:format(parsed.race))
110 elseif not AskMrRobot.validateFaction(parsed.faction) then 111 elseif not AskMrRobot.validateFaction(parsed.faction) then
111 self:showImportError("It looks like your faction may have changed.", "Right now, Mr. Robot thinks you belong to the " .. parsed.faction) 112 self:showImportError(L.AMR_UI_IMPORT_ERROR_FACTION, L.AMR_UI_IMPORT_ERROR_FACTION_CURRENT:format(parsed.faction))
112 elseif not AskMrRobot.validateProfessions(parsed.professions) then 113 elseif not AskMrRobot.validateProfessions(parsed.professions) then
113 self:showImportError("Your professions have changed, which affects the optimizations.", "You will need to make sure your in-game professions match the professions on AskMrRobot.com when importing.") 114 self:showImportError(L.AMR_UI_IMPORT_ERROR_PROFESSIONS, L.AMR_UI_IMPORT_ERROR_PROFESSIONS_GOTO)
114 elseif not AskMrRobot.validateSpec(parsed.spec) then 115 elseif not AskMrRobot.validateSpec(parsed.spec) then
115 if parsed.spec and parsed.spec ~= 'nil' then 116 if parsed.spec and parsed.spec ~= 'nil' then
116 local _, specName = GetSpecializationInfoByID(parsed.spec) 117 local _, specName = GetSpecializationInfoByID(parsed.spec)
117 self:showImportError("WARNING! Please check your character before proceeding:", "Change your spec to " .. specName .. ".") 118 self:showImportError(L.AMR_UI_IMPORT_ERROR_SPEC, L.AMR_UI_IMPORT_ERROR_SPEC_CHANGE:format(specName))
118 else 119 else
119 self:showImportError("WARNING! Please check your character before proceeding:", "AskMrRobot.com did not expect to see a specialization.") 120 self:showImportError(L.AMR_UI_IMPORT_ERROR_SPEC, L.AMR_UI_IMPORT_ERROR_SPEC_UNEXPECTED)
120 end 121 end
121 self.mostlySuccess = true 122 self.mostlySuccess = true
122 self.summaryTab.badRealm = nil 123 self.summaryTab.badRealm = nil
123 self.summaryTab.badTalents = nil 124 self.summaryTab.badTalents = nil
124 self.summaryTab.badGlyphs = nil 125 self.summaryTab.badGlyphs = nil
146 text:SetPoint("TOPLEFT", 0, -5) 147 text:SetPoint("TOPLEFT", 0, -5)
147 text:SetText("Help") 148 text:SetText("Help")
148 149
149 local errorText1 = tab:CreateFontString("AmrImportDetailsText2", "ARTWORK", "GameFontRed") 150 local errorText1 = tab:CreateFontString("AmrImportDetailsText2", "ARTWORK", "GameFontRed")
150 errorText1:SetPoint("TOPLEFT", "AmrImportDetailsText1", "BOTTOMLEFT", 0, -20) 151 errorText1:SetPoint("TOPLEFT", "AmrImportDetailsText1", "BOTTOMLEFT", 0, -20)
151 errorText1:SetText('You have no optimizations imported. Click the "Import" tab to get started.') 152 errorText1:SetText(L.AMR_UI_IMPORT_ERROR_NO_IMPORT)
152 errorText1:SetPoint("RIGHT", -10, 0) 153 errorText1:SetPoint("RIGHT", -10, 0)
153 errorText1:SetWidth(errorText1:GetWidth()) 154 errorText1:SetWidth(errorText1:GetWidth())
154 errorText1:SetJustifyH("LEFT") 155 errorText1:SetJustifyH("LEFT")
155 156
156 showImportDetailsError = function() 157 showImportDetailsError = function()
157 errorText1:SetText("I can't optimize yet. Please go to the summary tab for more information.") 158 errorText1:SetText(L.AMR_UI_IMPORT_ERROR_CANT_OPTIMIZE)
158 end 159 end
159 160
160 showImportErrorTab = function(tabName) 161 showImportErrorTab = function(tabName)
161 if not tabName then 162 if not tabName then
162 tab:Hide() 163 tab:Hide()
214 tabButton:SetHeight(20) 215 tabButton:SetHeight(20)
215 tinsert(buttons, tabButton) 216 tinsert(buttons, tabButton)
216 tabButton:SetScript("OnClick", onTabButtonClick) 217 tabButton:SetScript("OnClick", onTabButtonClick)
217 end 218 end
218 219
219 createButton("Import", -35, false) 220 createButton(L.AMR_UI_BUTTON_IMPORT, -35, false)
220 createButton("Summary", -20, false) 221 createButton(L.AMR_UI_BUTTON_SUMMARY, -20, false)
221 createButton("Gems", 0, true) 222 createButton(L.AMR_UI_BUTTON_GEMS, 0, true)
222 createButton("Enchants", 0, true) 223 createButton(L.AMR_UI_BUTTON_ENCHANTS, 0, true)
223 createButton("Reforges", 0, true) 224 createButton(L.AMR_UI_BUTTON_REFORGES, 0, true)
224 createButton("Shopping List", 0, true) 225 createButton(L.AMR_UI_BUTTON_SHOPPING_LIST, 0, true)
225 createButton("Best in Bags", -20, false) 226 createButton(L.AMR_UI_BUTTON_BEST_IN_BAGS, -20, false)
226 createButton("Combat Log", 0, false) 227 createButton(L.AMR_UI_BUTTON_COMBAT_LOG, 0, false)
227 createButton("Help", -20, false) 228 createButton(L.AMR_UI_BUTTON_HELP, -20, false)
228 229
229 return buttons 230 return buttons
230 end 231 end
231 232
232 function AskMrRobot.AmrUI:new() 233 function AskMrRobot.AmrUI:new()