# HG changeset patch # User yellowfive # Date 1503973994 25200 # Node ID 57c6cac5143c113b892f647b45f000609b03d683 # Parent 2f78f6c9618349179cae5357ab1de9b4b3de5cb7 7.3 update, preparation for reading crucible. diff -r 2f78f6c96183 -r 57c6cac5143c AskMrRobot-Serializer/AskMrRobot-Serializer.lua --- a/AskMrRobot-Serializer/AskMrRobot-Serializer.lua Wed Jun 14 21:01:12 2017 -0700 +++ b/AskMrRobot-Serializer/AskMrRobot-Serializer.lua Mon Aug 28 19:33:14 2017 -0700 @@ -1,7 +1,7 @@ -- AskMrRobot-Serializer will serialize and communicate character data between users. -- This is used primarily to associate character information to logs uploaded to askmrrobot.com. -local MAJOR, MINOR = "AskMrRobot-Serializer", 51 +local MAJOR, MINOR = "AskMrRobot-Serializer", 52 local Amr, oldminor = LibStub:NewLibrary(MAJOR, MINOR) if not Amr then return end -- already loaded by something else @@ -883,12 +883,6 @@ end end --- TODO: hopefully we can read artifact here when there is an API to get info when the artifact UI is not open --- get artifact info -local function readArtifact() - -end - -- get currently equipped items, store with currently active spec local function readEquippedItems(ret) local equippedItems = {}; @@ -947,8 +941,7 @@ ret.Talents = {} readSpecs(ret) - ret.Artifacts = {} - readArtifact() + ret.Artifacts = {} ret.Equipped = {} readEquippedItems(ret) @@ -1049,6 +1042,35 @@ end end +local function serializeCrucibleInfo(fields, info, pos, prevPowerId) + + if not info.Powers or not info.Active then + return prevPowerId + end + + local parts = {} + + if pos < 4 then + table.insert(parts, pos) + else + local relic = Amr.ParseItemLink(info.ItemLink) + table.insert(parts, Amr.GetItemUniqueId(relic) or "0") + end + + for i,powerId in ipairs(info.Powers) do + table.insert(parts, (powerId - prevPowerId) .. "") + prevPowerId = powerId + end + + for i,active in ipairs(info.Active) do + table.insert(parts, active and "1" or "0") + end + + table.insert(fields, table.concat(parts, ",")) + + return prevPowerId +end + -- Serialize just the identity portion of a player (region/realm/name) in the same format used by the full serialization function Amr:SerializePlayerIdentity(data) local fields = {} @@ -1123,7 +1145,8 @@ local powerids = {} local powerranks = {} - local reliclinks = {} + local reliclinks = {} + local crucibleinfos = {} local artifactInfo = data.Artifacts and data.Artifacts[spec] if artifactInfo and artifactInfo.Powers then @@ -1138,10 +1161,25 @@ table.insert(reliclinks, Amr.GetItemUniqueId(relic) or "") end end + if artifactInfo and artifactInfo.Crucible then + local prevPowerId = 0 + for i = 1,3 do + local relicInfo = #artifactInfo.Crucible.Equipped >= i and artifactInfo.Crucible.Equipped[i] + if relicInfo then + prevPowerId = serializeCrucibleInfo(crucibleinfos, relicInfo, i, prevPowerId) + end + end + for k,relicInfo in pairs(artifactInfo.Crucible.Inventory) do + if relicInfo then + prevPowerId = serializeCrucibleInfo(crucibleinfos, relicInfo, 4, prevPowerId) + end + end + end table.insert(fields, toCompressedNumberList(powerids)) table.insert(fields, table.concat(powerranks, ",")) table.insert(fields, table.concat(reliclinks, ",")) + table.insert(fields, table.concat(crucibleinfos, "/")) --table.insert(fields, toCompressedNumberList(data.Glyphs[spec])) end diff -r 2f78f6c96183 -r 57c6cac5143c AskMrRobot.toc --- a/AskMrRobot.toc Wed Jun 14 21:01:12 2017 -0700 +++ b/AskMrRobot.toc Mon Aug 28 19:33:14 2017 -0700 @@ -1,7 +1,7 @@ -## Interface: 70200 +## Interface: 70300 ## Title: Ask Mr. Robot ## Author: Team Robot, Inc. -## Version: 51 +## Version: 52 ## Notes: Gear import/export, combat logging, and more. ## URL: www.askmrrobot.com ## SavedVariables: AskMrRobotDb3 diff -r 2f78f6c96183 -r 57c6cac5143c Export.lua --- a/Export.lua Wed Jun 14 21:01:12 2017 -0700 +++ b/Export.lua Mon Aug 28 19:33:14 2017 -0700 @@ -269,6 +269,117 @@ Amr.db.char.Talents[specPos] = str end +local function scanCrucible() + if not Amr.db or not Amr.db.char or not Amr.db.char.Artifacts or not C_ArtifactRelicForgeUI or not C_ArtifactRelicForgeUI.GetSocketedRelicTalents then return end + + local equipped = {} + local preview = nil + + for i = 1,4 do + local talents = nil + if i == 4 then + talents = C_ArtifactRelicForgeUI.GetPreviewRelicTalents() + --talents = nil + else + talents = C_ArtifactRelicForgeUI.GetSocketedRelicTalents(i) + + --[[ + if i == 1 then + talents = {} + table.insert(talents, { + powerID = 1739, + isChosen = true + }) + table.insert(talents, { + powerID = 1781, + isChosen = true + }) + table.insert(talents, { + powerID = 1770, + isChosen = false + }) + table.insert(talents, { + powerID = 791, + isChosen = false + }) + table.insert(talents, { + powerID = 786, + isChosen = false + }) + table.insert(talents, { + powerID = 1537, + isChosen = false + }) + end + ]] + end + + if talents then + local obj = { + Powers = {}, + Active = {} + } + + if i == 4 then + obj.ItemLink = C_ArtifactRelicForgeUI.GetPreviewRelicItemLink() + if not obj.ItemLink then + talents = nil + else + preview = obj + end + else + table.insert(equipped, obj) + end + + if talents then + for k,v in ipairs(talents) do + table.insert(obj.Powers, v.powerID) + table.insert(obj.Active, v.isChosen) + end + end + + elseif i ~= 4 then + table.insert(equipped, {}) + end + end + + + local itemID = C_ArtifactUI.GetArtifactInfo() + local spec = Amr.ArtifactIdToSpecNumber[itemID] + + if spec then + + -- sometimes this event can fire when no crucible data is available, don't overwrite non-blank crucible data with blank crucible data + if Amr.db.char.Artifacts[spec] then + local oldCrucible = Amr.db.char.Artifacts[spec].Crucible + if oldCrucible then + if #oldCrucible.Equipped > 0 and oldCrucible.Equipped[1] and not equipped[1] then + return + end + end + end + + local dataz = Amr.db.char.Artifacts[spec] + if not dataz then + dataz = {} + Amr.db.char.Artifacts[spec] = dataz + end + + if not dataz.Crucible then + dataz.Crucible = { + Equipped = {}, + Inventory = {} + } + end + + local crucible = dataz.Crucible + crucible.Equipped = equipped + if preview then + crucible.Inventory[preview.ItemLink] = preview + end + end +end + local function scanArtifact() if not Amr.db or not Amr.db.char or not Amr.db.char.Artifacts then return end @@ -299,11 +410,38 @@ --local spec = GetSpecialization() if spec then - Amr.db.char.Artifacts[spec] = { - Powers = powerRanks, - Relics = relicInfo - } + + -- sometimes this event can fire when no relic data is available, don't overwrite non-blank relic data with blank relic data + if Amr.db.char.Artifacts[spec] then + local oldRelics = Amr.db.char.Artifacts[spec].Relics + if oldRelics then + for i = 1,3 do + if oldRelics[i] and oldRelics[i] ~= "" and (not relicInfo[i] or relicInfo[i] == "") then + relicInfo[i] = oldRelics[i] + end + end + end + end + + local dataz = Amr.db.char.Artifacts[spec] + if not dataz then + dataz = {} + Amr.db.char.Artifacts[spec] = dataz + end + + if not dataz.Crucible then + dataz.Crucible = { + Equipped = {}, + Inventory = {} + } + end + + dataz.Powers = powerRanks + dataz.Relics = relicInfo + end + + --scanCrucible() end -- Returns a data object containing all information about the current player needed for an export: @@ -344,3 +482,5 @@ Amr:AddEventHandler("PLAYER_TALENT_UPDATE", scanTalents) Amr:AddEventHandler("ARTIFACT_UPDATE", scanArtifact) +Amr:AddEventHandler("ARTIFACT_RELIC_FORGE_UPDATE", scanCrucible) +Amr:AddEventHandler("ARTIFACT_RELIC_FORGE_PREVIEW_RELIC_CHANGED", scanCrucible) diff -r 2f78f6c96183 -r 57c6cac5143c ui/AmrUiButton.lua --- a/ui/AmrUiButton.lua Wed Jun 14 21:01:12 2017 -0700 +++ b/ui/AmrUiButton.lua Mon Aug 28 19:33:14 2017 -0700 @@ -21,7 +21,7 @@ -------------------------------------------------------------------------------]] local function buttonOnClick(frame, ...) AceGUI:ClearFocus() - PlaySound("igMainMenuOption") + --PlaySound("igMainMenuOption") frame.obj:Fire("OnClick", ...) end diff -r 2f78f6c96183 -r 57c6cac5143c ui/AmrUiCheckBox.lua --- a/ui/AmrUiCheckBox.lua Wed Jun 14 21:01:12 2017 -0700 +++ b/ui/AmrUiCheckBox.lua Mon Aug 28 19:33:14 2017 -0700 @@ -20,7 +20,7 @@ -------------------------------------------------------------------------------]] local function buttonOnClick(frame, ...) AceGUI:ClearFocus() - PlaySound("igMainMenuOption") + --PlaySound("igMainMenuOption") frame.obj:Fire("OnClick", ...) end diff -r 2f78f6c96183 -r 57c6cac5143c ui/AmrUiFrame.lua --- a/ui/AmrUiFrame.lua Wed Jun 14 21:01:12 2017 -0700 +++ b/ui/AmrUiFrame.lua Mon Aug 28 19:33:14 2017 -0700 @@ -28,7 +28,7 @@ Scripts -------------------------------------------------------------------------------]] local function buttonOnClick(frame) - PlaySound("gsTitleOptionExit") + --PlaySound("gsTitleOptionExit") frame.obj:Hide() end diff -r 2f78f6c96183 -r 57c6cac5143c ui/AmrUiTabGroup.lua --- a/ui/AmrUiTabGroup.lua Wed Jun 14 21:01:12 2017 -0700 +++ b/ui/AmrUiTabGroup.lua Mon Aug 28 19:33:14 2017 -0700 @@ -42,7 +42,7 @@ -------------------------------------------------------------------------------]] local function tabOnClick(frame) if not (frame.selected or frame.disabled) then - PlaySound("igCharacterInfoTab") + --PlaySound("igCharacterInfoTab") frame.obj:SelectTab(frame.value) end end diff -r 2f78f6c96183 -r 57c6cac5143c ui/AmrUiTextButton.lua --- a/ui/AmrUiTextButton.lua Wed Jun 14 21:01:12 2017 -0700 +++ b/ui/AmrUiTextButton.lua Mon Aug 28 19:33:14 2017 -0700 @@ -21,7 +21,7 @@ -------------------------------------------------------------------------------]] local function buttonOnClick(frame, ...) AceGUI:ClearFocus() - PlaySound("igMainMenuOption") + --PlaySound("igMainMenuOption") frame.obj:Fire("OnClick", ...) end