comparison ui/JewelPanel.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 ec731d2fe6ba
children 4317e56e0a91
comparison
equal deleted inserted replaced
16:9793e8b683d2 17:e77e01abce98
111 local currentGemLink = select(2, GetItemGem(itemLink, i)) 111 local currentGemLink = select(2, GetItemGem(itemLink, i))
112 112
113 -- if there is a gem to add (or remove) 113 -- if there is a gem to add (or remove)
114 --if i <= #optimizedGems or currentGemLink then 114 --if i <= #optimizedGems or currentGemLink then
115 if i <= #optimizedGems or currentGemLink then 115 if i <= #optimizedGems or currentGemLink then
116 local optimizedGemId = 0
117 if optimizedGems[i] > 0 then
118 optimizedGemId = AskMrRobot.ExtraGemData[optimizedGems[i]].id
119 end
120 --local currentGemId = AskMrRobot.ExtraGemData[showGems[i]].id
121
116 -- set the current gem icon / tooltip 122 -- set the current gem icon / tooltip
117 currentIcon:SetItemLink(currentGemLink) 123 currentIcon:SetItemLink(currentGemLink)
118 124
119 local currentGemId = AskMrRobot.getItemIdFromLink(currentGemLink) 125 local currentGemId = AskMrRobot.getItemIdFromLink(currentGemLink)
120 126
121 local optimizedGemLink = nil 127 local optimizedGemLink = nil
122 if i <= #optimizedGems then 128 if i <= #optimizedGems then
123 -- make a link for the optimized gem 129 -- make a link for the optimized gem
124 optimizedGemLink = select(2, GetItemInfo(optimizedGems[i].id)) 130 optimizedGemLink = select(2, GetItemInfo(optimizedGemId))
125 131
126 if not optimizedGemLink and optimizedGems[i].id and itemId then 132 if not optimizedGemLink and optimizedGemId and itemId then
127 AskMrRobot.RegisterItemInfoCallback(optimizedGems[i].id, function(name, link) 133 AskMrRobot.RegisterItemInfoCallback(optimizedGemId, function(name, link)
128 optimizedIcon:SetItemLink(link) 134 optimizedIcon:SetItemLink(link)
129 end) 135 end)
130 end 136 end
131 end 137 end
132 138
133 if showGems[i] and optimizedGems[i] and optimizedGems[i].color then 139
140 local mismatched = not AskMrRobot.AreGemsCompatible(optimizedGems[i], showGems[i])
141
142 --if showGems[i] and optimizedGems[i] and optimizedGems[i].color then
143 --if test and optimizedGems[i] and optimizedGems[i].color then
144 if mismatched and optimizedGems[i] > 0 then
134 gemCount = gemCount + 1 145 gemCount = gemCount + 1
135 -- set the optimized gem text 146 -- set the optimized gem text
136 text:SetTextColor(1,1,1) 147 text:SetTextColor(1,1,1)
137 text:SetText(AskMrRobot.alternateGemName[optimizedGems[i].id] or (optimizedGems[i].enchantId ~= 0 and AskMrRobot.getEnchantName(optimizedGems[i].enchantId)) or GetItemInfo(optimizedGems[i].id)) 148 --text:SetText(AskMrRobot.alternateGemName[optimizedGemId] or (optimizedGems[i] ~= 0 and AskMrRobot.getEnchantName(optimizedGems[i])) or GetItemInfo(optimizedGemId))
149
150 text:SetText(AskMrRobot.ExtraGemData[optimizedGems[i]].text)
151
138 currentIcon:Show() 152 currentIcon:Show()
139 153
140 -- load the item image / tooltip 154 -- load the item image / tooltip
141 optimizedIcon:SetItemLink(optimizedGemLink) 155 optimizedIcon:SetItemLink(optimizedGemLink)
142 optimizedIcon:Show() 156 optimizedIcon:Show()
143 optimizedIcon:SetBackdropBorderColor(1,1,1) 157 optimizedIcon:SetBackdropBorderColor(1,1,1)
144 currentIcon:SetBackdropBorderColor(1,1,1) 158 currentIcon:SetBackdropBorderColor(1,1,1)
145 else 159 else
146 if optimizedGems[i] and optimizedGems[i].color then 160 --if optimizedGems[i] and optimizedGems[i].color then
161 if optimizedGems[i] then
147 text:SetText("no change") 162 text:SetText("no change")
148 text:SetTextColor(0.5,0.5,0.5) 163 text:SetTextColor(0.5,0.5,0.5)
149 currentIcon:Show() 164 currentIcon:Show()
150 gemCount = gemCount + 1 165 gemCount = gemCount + 1
151 else 166 else
154 end 169 end
155 optimizedIcon:SetItemLink(nil) 170 optimizedIcon:SetItemLink(nil)
156 optimizedIcon:Hide() 171 optimizedIcon:Hide()
157 end 172 end
158 173
159 currentIcon:SetGemColor(optimizedGems[i] and optimizedGems[i].color) 174 -- TODO highlight the socket color
160 optimizedIcon:SetGemColor(optimizedGems[i] and optimizedGems[i].color) 175 local socketColorId = AskMrRobot.ExtraItemData[itemId].socketColors[i]
176 local socketName = AskMrRobot.socketColorIds[socketColorId];
177 currentIcon:SetGemColor(optimizedGems[i] and socketName)
178 optimizedIcon:SetGemColor(optimizedGems[i] and socketName)
161 179
162 -- show the gem row 180 -- show the gem row
163 text:Show() 181 text:Show()
164 else 182 else
165 -- hide the gem row 183 -- hide the gem row