Mercurial > wow > askmrrobot
changeset 114:4cd98aa90d78 v53
Small update to crucible export.
author | yellowfive |
---|---|
date | Wed, 04 Oct 2017 01:08:56 -0700 |
parents | 406f56dd065b |
children | 8bef8f88361c |
files | AskMrRobot-Serializer/AskMrRobot-Serializer.lua AskMrRobot.toc Export.lua |
diffstat | 3 files changed, 82 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/AskMrRobot-Serializer/AskMrRobot-Serializer.lua Mon Aug 28 19:33:28 2017 -0700 +++ b/AskMrRobot-Serializer/AskMrRobot-Serializer.lua Wed Oct 04 01:08:56 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", 52 +local MAJOR, MINOR = "AskMrRobot-Serializer", 53 local Amr, oldminor = LibStub:NewLibrary(MAJOR, MINOR) if not Amr then return end -- already loaded by something else @@ -1169,9 +1169,11 @@ 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) + if artifactInfo.Crucible.Previewed then + for k,relicInfo in pairs(artifactInfo.Crucible.Previewed) do + if relicInfo then + prevPowerId = serializeCrucibleInfo(crucibleinfos, relicInfo, 4, prevPowerId) + end end end end
--- a/AskMrRobot.toc Mon Aug 28 19:33:28 2017 -0700 +++ b/AskMrRobot.toc Wed Oct 04 01:08:56 2017 -0700 @@ -1,7 +1,7 @@ ## Interface: 70300 ## Title: Ask Mr. Robot ## Author: Team Robot, Inc. -## Version: 52 +## Version: 53 ## Notes: Gear import/export, combat logging, and more. ## URL: www.askmrrobot.com ## SavedVariables: AskMrRobotDb3
--- a/Export.lua Mon Aug 28 19:33:28 2017 -0700 +++ b/Export.lua Wed Oct 04 01:08:56 2017 -0700 @@ -284,6 +284,7 @@ talents = C_ArtifactRelicForgeUI.GetSocketedRelicTalents(i) --[[ + -- test data if i == 1 then talents = {} table.insert(talents, { @@ -368,18 +369,87 @@ if not dataz.Crucible then dataz.Crucible = { Equipped = {}, - Inventory = {} + Previewed = {} } end local crucible = dataz.Crucible crucible.Equipped = equipped if preview then - crucible.Inventory[preview.ItemLink] = preview + local previewKey = {} + table.insert(previewKey, preview.ItemLink) + for i,v in ipairs(preview.Powers) do + table.insert(previewKey, v .. "=" .. tostring(preview.Active[i])) + end + previewKey = table.concat(previewKey, "_") + + crucible.Previewed[previewKey] = preview end end end +local function pruneCrucible() + if not Amr.db or not Amr.db.char or not Amr.db.char.Artifacts then return end + + local spec = GetSpecialization() + local dataz = Amr.db.char.Artifacts[spec] + if not dataz or not dataz.Crucible then return end + + local crucible = dataz.Crucible + + -- this was old format, transform to new format + if crucible.Inventory then + if not crucible.Previewed then + crucible.Previewed = {} + end + + for link,preview in pairs(crucible.Inventory) do + local previewKey = {} + table.insert(previewKey, preview.ItemLink) + for i,v in ipairs(preview.Powers) do + table.insert(previewKey, v .. "=" .. tostring(preview.Active[i])) + end + previewKey = table.concat(previewKey, "_") + + crucible.Previewed[previewKey] = preview + end + + crucible.Inventory = nil + end + + -- get a hash of every owned, but not-equipped item + local ownedItems = {} + if Amr.db.char.BagItems then + for i,link in ipairs(Amr.db.char.BagItems) do + ownedItems[link] = true + end + end + if Amr.db.char.BankItems then + for i,link in ipairs(Amr.db.char.BankItems) do + ownedItems[link] = true + end + end + if Amr.db.char.VoidItems then + for i,link in ipairs(Amr.db.char.VoidItems) do + ownedItems[link] = true + end + end + + -- prune out any previewed relics that the player no longer owns + if crucible.Previewed then + local toRemove = {} + for k,v in pairs(crucible.Previewed) do + if not ownedItems[v.ItemLink] then + table.insert(toRemove, k) + end + end + for i,v in ipairs(toRemove) do + crucible.Previewed[v] = nil + end + end + +end + local function scanArtifact() if not Amr.db or not Amr.db.char or not Amr.db.char.Artifacts then return end @@ -454,6 +524,9 @@ -- scan current spec's talents just before exporting scanTalents() + -- prune crucible info just before each time we export + pruneCrucible() + data.Talents = Amr.db.char.Talents data.Artifacts = Amr.db.char.Artifacts data.Equipped = Amr.db.char.Equipped