comparison Gear.lua @ 181:5c586ff5fee5 v85

gear ui should now show essence differences
author yellowfive
date Fri, 14 Feb 2020 14:53:46 -0800
parents d90a740a1d0b
children c6369f8f277c
comparison
equal deleted inserted replaced
180:82598dc4fe2e 181:5c586ff5fee5
221 local player = Amr:ExportCharacter() 221 local player = Amr:ExportCharacter()
222 222
223 local gear 223 local gear
224 local spec 224 local spec
225 local setupIndex 225 local setupIndex
226 local essences 226 local essences
227 for i, setup in ipairs(Amr.db.char.GearSetups) do 227 for i, setup in ipairs(Amr.db.char.GearSetups) do
228 if setup.Id == setupId then 228 if setup.Id == setupId then
229 setupIndex = i 229 setupIndex = i
230 gear = setup.Gear 230 gear = setup.Gear
231 spec = setup.SpecSlot 231 spec = setup.SpecSlot
233 break 233 break
234 end 234 end
235 end 235 end
236 236
237 local equipped = player.Equipped[player.ActiveSpec] 237 local equipped = player.Equipped[player.ActiveSpec]
238 238 local equippedEssences = player.Essences[player.ActiveSpec]
239
239 if not gear then 240 if not gear then
240 -- no gear has been imported for this spec so show a message 241 -- no gear has been imported for this spec so show a message
241 renderEmptyGear(container) 242 renderEmptyGear(container)
242 else 243 else
243 local panelGear = AceGUI:Create("AmrUiPanel") 244 local panelGear = AceGUI:Create("AmrUiPanel")
392 393
393 prevSocket = socketBorder 394 prevSocket = socketBorder
394 end 395 end
395 end 396 end
396 elseif isEssence then 397 elseif isEssence then
397 -- TODO: render essence differences 398 for i = 1, 4 do
399 if essences and #essences >= i then
400 local essence = essences[i]
401 local equippedEssence = equippedEssences and #equippedEssences >= i and equippedEssences[i] or nil
402 if essence then
403 local essenceInfo = C_AzeriteEssence.GetEssenceInfo(essence[2])
404 if essenceInfo then
405 local isEssenceActive = equippedEssence and equippedEssence[2] == essence[2]
406
407 local socketBorder, socketIcon = createSocketWidget(panelMods, prevSocket or lblItem, prevSocket, isEssenceActive)
408
409 -- set icon and tooltip
410 socketIcon:SetIcon(essenceInfo.icon)
411 Amr:SetEssenceTooltip(socketIcon, string.format("azessence:%d:%d", essence[2], essence[3]) , "ANCHOR_TOPRIGHT")
412
413 --[[
414 if essence[1] and essence[1] > 4 then
415 Amr:SetSpellTooltip(socketIcon, essence[1], "ANCHOR_TOPRIGHT")
416 end]]
417
418 prevSocket = socketBorder
419 end
420 end
421 end
422 end
398 else 423 else
399 for i = 1, #optimalItem.gemIds do 424 for i = 1, #optimalItem.gemIds do
400 -- we rely on the fact that the gear sets coming back from the site will almost always have all sockets filled, 425 -- we rely on the fact that the gear sets coming back from the site will almost always have all sockets filled,
401 -- because it's a pain to get the actual number of sockets on an item from within the game 426 -- because it's a pain to get the actual number of sockets on an item from within the game
402 local g = optimalItem.gemIds[i] 427 local g = optimalItem.gemIds[i]
1270 -- moves any gear in bags to the bank if not part of a gear set 1295 -- moves any gear in bags to the bank if not part of a gear set
1271 function Amr:CleanBags() 1296 function Amr:CleanBags()
1272 -- TODO: implement 1297 -- TODO: implement
1273 end 1298 end
1274 1299
1275 --[[ 1300
1276 local function testfunc(message) 1301 local function testfunc(message)
1277 print(strsub(message, 13)) 1302 print(strsub(message, 13))
1278 end 1303 end
1279 ]] 1304
1280 1305
1281 function Amr:InitializeGear() 1306 function Amr:InitializeGear()
1282 Amr:AddEventHandler("ACTIVE_TALENT_GROUP_CHANGED", onActiveTalentGroupChanged) 1307 Amr:AddEventHandler("ACTIVE_TALENT_GROUP_CHANGED", onActiveTalentGroupChanged)
1283 1308
1284 --Amr:AddEventHandler("CHAT_MSG_CHANNEL", testfunc) 1309 Amr:AddEventHandler("CHAT_MSG_CHANNEL", testfunc)
1285 1310
1286 Amr:AddEventHandler("UNIT_INVENTORY_CHANGED", function(unitID) 1311 Amr:AddEventHandler("UNIT_INVENTORY_CHANGED", function(unitID)
1287 if unitID and unitID ~= "player" then return end 1312 if unitID and unitID ~= "player" then return end
1288 1313
1289 -- don't update during a gear operation, wait until it is totally finished 1314 -- don't update during a gear operation, wait until it is totally finished