Mercurial > wow > askmrrobot
comparison ui/ReforgesTab.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 |
comparison
equal
deleted
inserted
replaced
| 10:ef8b45e96b08 | 11:ece9167c0d1c |
|---|---|
| 1 local _, AskMrRobot = ... | 1 local _, AskMrRobot = ... |
| 2 local L = AskMrRobot.L; | |
| 2 | 3 |
| 3 -------------------------------------------------------------------- | 4 -------------------------------------------------------------------- |
| 4 -- Local Reforge Utility Code | 5 -- Local Reforge Utility Code |
| 5 -------------------------------------------------------------------- | 6 -------------------------------------------------------------------- |
| 6 | 7 |
| 7 StaticPopupDialogs["REFORGE_TAB_PLEASE_OPEN"] = { | 8 StaticPopupDialogs["REFORGE_TAB_PLEASE_OPEN"] = { |
| 8 text = "You need to open the reforge window for this to work", | 9 text = L.AMR_REFORGESTAB_OPEN_WINDOW, |
| 9 button1 = "Ok", | 10 button1 = L.AMR_REFORGESTAB_BUTTON_OK, |
| 10 timeout = 0, | 11 timeout = 0, |
| 11 whileDead = true, | 12 whileDead = true, |
| 12 hideOnEscape = true, | 13 hideOnEscape = true, |
| 13 preferredIndex = 3, -- avoid some UI taint, see http://www.wowace.com/announcements/how-to-avoid-some-ui-taint/ | 14 preferredIndex = 3, -- avoid some UI taint, see http://www.wowace.com/announcements/how-to-avoid-some-ui-taint/ |
| 14 } | 15 } |
| 88 tab:SetPoint("BOTTOMRIGHT") | 89 tab:SetPoint("BOTTOMRIGHT") |
| 89 tab:Hide() | 90 tab:Hide() |
| 90 | 91 |
| 91 local text = tab:CreateFontString("AmrReforgesHeader", "ARTWORK", "GameFontNormalLarge") | 92 local text = tab:CreateFontString("AmrReforgesHeader", "ARTWORK", "GameFontNormalLarge") |
| 92 text:SetPoint("TOPLEFT", 0, -5) | 93 text:SetPoint("TOPLEFT", 0, -5) |
| 93 text:SetText("Reforges") | 94 text:SetText(L.AMR_REFORGESTAB_TITLE) |
| 94 | 95 |
| 95 tab.stamp = AskMrRobot.RobotStamp:new(nil, tab) | 96 tab.stamp = AskMrRobot.RobotStamp:new(nil, tab) |
| 96 tab.stamp:Hide() | 97 tab.stamp:Hide() |
| 97 tab.stamp.smallText:SetText("Your reforges are 100% optimal!") | 98 tab.stamp.smallText:SetText(L.AMR_REFORGESTAB_OPTIMAL) |
| 98 tab.stamp:SetPoint("TOPLEFT", text, "BOTTOMLEFT", 2, -15) | 99 tab.stamp:SetPoint("TOPLEFT", text, "BOTTOMLEFT", 2, -15) |
| 99 tab.stamp:SetPoint("RIGHT", tab, "RIGHT", -20, 0) | 100 tab.stamp:SetPoint("RIGHT", tab, "RIGHT", -20, 0) |
| 100 | 101 |
| 101 tab.reforgeDetails = tab:CreateFontString("AmrReforgeDetails", "ARTWORK", "GameFontWhite") | 102 tab.reforgeDetails = tab:CreateFontString("AmrReforgeDetails", "ARTWORK", "GameFontWhite") |
| 102 tab.reforgeDetails:SetPoint("TOPLEFT", text, "BOTTOMLEFT", 0, -15) | 103 tab.reforgeDetails:SetPoint("TOPLEFT", text, "BOTTOMLEFT", 0, -15) |
| 103 tab.reforgeDetails:SetPoint("RIGHT", -30, 0) | 104 tab.reforgeDetails:SetPoint("RIGHT", -30, 0) |
| 104 tab.reforgeDetails:SetWordWrap(true) | 105 tab.reforgeDetails:SetWordWrap(true) |
| 105 tab.reforgeDetails:SetJustifyH("LEFT") | 106 tab.reforgeDetails:SetJustifyH("LEFT") |
| 106 tab.reforgeDetails:SetText('Open a reforge window, then click the "Reforge!" button to do it automatically.') | 107 tab.reforgeDetails:SetText(L.AMR_REFORGESTAB_INSTRUCTION) |
| 107 tab.reforgeDetails:SetHeight(50) | 108 tab.reforgeDetails:SetHeight(50) |
| 108 | 109 |
| 109 tab.reforgeButton = CreateFrame("Button", "AmrReforgeButton", tab, "UIPanelButtonTemplate") | 110 tab.reforgeButton = CreateFrame("Button", "AmrReforgeButton", tab, "UIPanelButtonTemplate") |
| 110 tab.reforgeButton:SetText("Reforge!") | 111 tab.reforgeButton:SetText(L.AMR_REFORGESTAB_BUTTON) |
| 111 tab.reforgeButton:SetPoint("TOPLEFT", 0, -80) | 112 tab.reforgeButton:SetPoint("TOPLEFT", 0, -80) |
| 112 tab.reforgeButton:SetWidth(140) | 113 tab.reforgeButton:SetWidth(140) |
| 113 tab.reforgeButton:SetHeight(20) | 114 tab.reforgeButton:SetHeight(20) |
| 114 tab.reforgeButton:SetScript("OnClick", function() | 115 tab.reforgeButton:SetScript("OnClick", function() |
| 115 tab:OnReforge() | 116 tab:OnReforge() |
| 120 tab.reforgeCost:SetPoint("BOTTOM", tab.reforgeButton, "BOTTOM", 0, 0) | 121 tab.reforgeCost:SetPoint("BOTTOM", tab.reforgeButton, "BOTTOM", 0, 0) |
| 121 tab.reforgeCost:SetPoint("RIGHT", tab, "RIGHT", -30, 0) | 122 tab.reforgeCost:SetPoint("RIGHT", tab, "RIGHT", -30, 0) |
| 122 tab.reforgeCost:SetText('') | 123 tab.reforgeCost:SetText('') |
| 123 | 124 |
| 124 tab.slotHeader = tab:CreateFontString(nil, "ARTWORK", "GameFontNormal") | 125 tab.slotHeader = tab:CreateFontString(nil, "ARTWORK", "GameFontNormal") |
| 125 tab.slotHeader:SetText("Slot") | 126 tab.slotHeader:SetText(L.AMR_REFORGESTAB_SLOT) |
| 126 tab.slotHeader:SetPoint("TOPLEFT", tab.reforgeButton, "BOTTOMLEFT", 0, -30) | 127 tab.slotHeader:SetPoint("TOPLEFT", tab.reforgeButton, "BOTTOMLEFT", 0, -30) |
| 127 | 128 |
| 128 tab.reforgeHeader = tab:CreateFontString(nil, "ARTWORK", "GameFontNormal") | 129 tab.reforgeHeader = tab:CreateFontString(nil, "ARTWORK", "GameFontNormal") |
| 129 tab.reforgeHeader:SetText("Optimal Reforge") | 130 tab.reforgeHeader:SetText(L.AMR_REFORGESTAB_OPTIMAL_REFORGE) |
| 130 tab.reforgeHeader:SetPoint("TOPLEFT", tab.slotHeader, "TOPLEFT", 100, 0) | 131 tab.reforgeHeader:SetPoint("TOPLEFT", tab.slotHeader, "TOPLEFT", 100, 0) |
| 131 | 132 |
| 132 -- pre-allocate a visual element for all possible slots; showBadReforges will set text and show the number that are needed, and hide the rest | 133 -- pre-allocate a visual element for all possible slots; showBadReforges will set text and show the number that are needed, and hide the rest |
| 133 tab.slots = {} | 134 tab.slots = {} |
| 134 tab.optimized = {} | 135 tab.optimized = {} |
| 175 local text = _G[StatToString[pair[1]]] .. ' -> ' .. _G[StatToString[pair[2]]] | 176 local text = _G[StatToString[pair[1]]] .. ' -> ' .. _G[StatToString[pair[2]]] |
| 176 --print('from ' .. fromId) | 177 --print('from ' .. fromId) |
| 177 if fromId == 0 then | 178 if fromId == 0 then |
| 178 return text | 179 return text |
| 179 end | 180 end |
| 180 return 'Restore, then ' .. text | 181 return L.AMR_REFORGESTAB_RESTORE_THEN .. text |
| 181 end | 182 end |
| 182 | 183 |
| 183 -- draw all of the reforges that still need to be performed | 184 -- draw all of the reforges that still need to be performed |
| 184 function AskMrRobot.ReforgesTab:Render() | 185 function AskMrRobot.ReforgesTab:Render() |
| 185 | 186 |
| 204 end | 205 end |
| 205 | 206 |
| 206 i = i + 1 | 207 i = i + 1 |
| 207 end | 208 end |
| 208 | 209 |
| 209 self.reforgeCost:SetText("Total reforge cost: ~" .. math.ceil(cost / 10000) .. " Gold") | 210 self.reforgeCost:SetText(L.AMR_REFORGESTAB_TOTAL_COST:format(math.ceil(cost / 10000))) |
| 210 | 211 |
| 211 -- hide / show the headers | 212 -- hide / show the headers |
| 212 if i == 1 then | 213 if i == 1 then |
| 213 self.reforgeHeader:Hide() | 214 self.reforgeHeader:Hide() |
| 214 self.slotHeader:Hide() | 215 self.slotHeader:Hide() |
