Mercurial > wow > askmrrobot
changeset 181:5c586ff5fee5 v85
gear ui should now show essence differences
author | yellowfive |
---|---|
date | Fri, 14 Feb 2020 14:53:46 -0800 |
parents | 82598dc4fe2e |
children | a5c00637bf07 |
files | AskMrRobot-Serializer/AskMrRobot-Serializer.lua AskMrRobot.toc Gear.lua Import.lua ui/Ui.lua |
diffstat | 5 files changed, 48 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/AskMrRobot-Serializer/AskMrRobot-Serializer.lua Thu Feb 13 13:22:13 2020 -0800 +++ b/AskMrRobot-Serializer/AskMrRobot-Serializer.lua Fri Feb 14 14:53:46 2020 -0800 @@ -1,6 +1,6 @@ -- AskMrRobot-Serializer will serialize and communicate character data between users. -local MAJOR, MINOR = "AskMrRobot-Serializer", 84 +local MAJOR, MINOR = "AskMrRobot-Serializer", 85 local Amr, oldminor = LibStub:NewLibrary(MAJOR, MINOR) if not Amr then return end -- already loaded by something else
--- a/AskMrRobot.toc Thu Feb 13 13:22:13 2020 -0800 +++ b/AskMrRobot.toc Fri Feb 14 14:53:46 2020 -0800 @@ -1,7 +1,7 @@ ## Interface: 80300 ## Title: Ask Mr. Robot ## Author: Team Robot, Inc. -## Version: 84 +## Version: 85 ## Notes: Gear import/export, combat logging, and more. ## URL: www.askmrrobot.com ## SavedVariables: AskMrRobotDb4
--- a/Gear.lua Thu Feb 13 13:22:13 2020 -0800 +++ b/Gear.lua Fri Feb 14 14:53:46 2020 -0800 @@ -223,7 +223,7 @@ local gear local spec local setupIndex - local essences + local essences for i, setup in ipairs(Amr.db.char.GearSetups) do if setup.Id == setupId then setupIndex = i @@ -235,7 +235,8 @@ end local equipped = player.Equipped[player.ActiveSpec] - + local equippedEssences = player.Essences[player.ActiveSpec] + if not gear then -- no gear has been imported for this spec so show a message renderEmptyGear(container) @@ -394,7 +395,31 @@ end end elseif isEssence then - -- TODO: render essence differences + for i = 1, 4 do + if essences and #essences >= i then + local essence = essences[i] + local equippedEssence = equippedEssences and #equippedEssences >= i and equippedEssences[i] or nil + if essence then + local essenceInfo = C_AzeriteEssence.GetEssenceInfo(essence[2]) + if essenceInfo then + local isEssenceActive = equippedEssence and equippedEssence[2] == essence[2] + + local socketBorder, socketIcon = createSocketWidget(panelMods, prevSocket or lblItem, prevSocket, isEssenceActive) + + -- set icon and tooltip + socketIcon:SetIcon(essenceInfo.icon) + Amr:SetEssenceTooltip(socketIcon, string.format("azessence:%d:%d", essence[2], essence[3]) , "ANCHOR_TOPRIGHT") + + --[[ + if essence[1] and essence[1] > 4 then + Amr:SetSpellTooltip(socketIcon, essence[1], "ANCHOR_TOPRIGHT") + end]] + + prevSocket = socketBorder + end + end + end + end else for i = 1, #optimalItem.gemIds do -- we rely on the fact that the gear sets coming back from the site will almost always have all sockets filled, @@ -1272,16 +1297,16 @@ -- TODO: implement end ---[[ + local function testfunc(message) print(strsub(message, 13)) end -]] + function Amr:InitializeGear() Amr:AddEventHandler("ACTIVE_TALENT_GROUP_CHANGED", onActiveTalentGroupChanged) - --Amr:AddEventHandler("CHAT_MSG_CHANNEL", testfunc) + Amr:AddEventHandler("CHAT_MSG_CHANNEL", testfunc) Amr:AddEventHandler("UNIT_INVENTORY_CHANGED", function(unitID) if unitID and unitID ~= "player" then return end
--- a/Import.lua Thu Feb 13 13:22:13 2020 -0800 +++ b/Import.lua Fri Feb 14 14:53:46 2020 -0800 @@ -252,7 +252,7 @@ local parts = { strsplit("_", essenceString) } for i = 1, #parts do local essence = { strsplit(".", parts[i]) } - table.insert(ret, { tonumber(essence[0]), tonumber(essence[1]), tonumber(essence[2]) }) + table.insert(ret, { tonumber(essence[1]), tonumber(essence[2]), tonumber(essence[3]) }) end return ret
--- a/ui/Ui.lua Thu Feb 13 13:22:13 2020 -0800 +++ b/ui/Ui.lua Fri Feb 14 14:53:46 2020 -0800 @@ -418,6 +418,20 @@ end) end +function Amr:SetEssenceTooltip(obj, essenceLink, anchor, x, y) + obj:SetUserData("ttEssenceLink", essenceLink) + obj:SetCallback("OnEnter", function(widget) + local tooltipLink = widget:GetUserData("ttEssenceLink") + if tooltipLink then + GameTooltip:SetOwner(widget.frame, anchor and anchor or "ANCHOR_CURSOR", x, y) + GameTooltip:SetHyperlink(tooltipLink) + end + end) + obj:SetCallback("OnLeave", function(widget) + GameTooltip:Hide() + end) +end + function Amr:RenderCoverChrome(container, width, height) local border = AceGUI:Create("AmrUiPanel")