changeset 197:23b740b4c93a v96

Added Great Vault export.
author Yellowfive
date Thu, 17 Dec 2020 11:57:06 -0600
parents b4f74de03b43
children d666f2740075
files AskMrRobot-Serializer/AskMrRobot-Serializer.lua AskMrRobot.toc Core.lua Export.lua
diffstat 4 files changed, 47 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/AskMrRobot-Serializer/AskMrRobot-Serializer.lua	Tue Nov 24 16:20:29 2020 -0600
+++ b/AskMrRobot-Serializer/AskMrRobot-Serializer.lua	Thu Dec 17 11:57:06 2020 -0600
@@ -1,6 +1,6 @@
 -- AskMrRobot-Serializer will serialize and communicate character data between users.
 
-local MAJOR, MINOR = "AskMrRobot-Serializer", 95
+local MAJOR, MINOR = "AskMrRobot-Serializer", 96
 local Amr, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
 
 if not Amr then return end -- already loaded by something else
@@ -820,7 +820,18 @@
 		end
 		
         table.insert(fields, ".inv")
-        appendItemsToExport(fields, itemObjects)
+		appendItemsToExport(fields, itemObjects)
+		
+		if data.GreatVaultItems then
+			itemObjects = {}
+			for i, itemData in ipairs(data.GreatVaultItems) do
+				if itemData then
+					table.insert(itemObjects, itemData)
+				end
+			end
+			table.insert(fields, ".gv")
+			appendItemsToExport(fields, itemObjects)
+		end
     end
 
     return "$" .. table.concat(fields, ";") .. "$"
--- a/AskMrRobot.toc	Tue Nov 24 16:20:29 2020 -0600
+++ b/AskMrRobot.toc	Thu Dec 17 11:57:06 2020 -0600
@@ -1,7 +1,7 @@
 ## Interface: 90002
 ## Title: Ask Mr. Robot
 ## Author: Team Robot, Inc.
-## Version: 95
+## Version: 96
 ## Notes: Gear import/export, combat logging, and more.
 ## URL: www.askmrrobot.com
 ## SavedVariables: AskMrRobotDb4
--- a/Core.lua	Tue Nov 24 16:20:29 2020 -0600
+++ b/Core.lua	Thu Dec 17 11:57:06 2020 -0600
@@ -53,7 +53,8 @@
 			BagItems = {},             -- list of item info for bags
 			BankItems = {},            -- list of item info for bank
 			BagItemsAndCounts = {},    -- used mainly for the shopping list
-			BankItemsAndCounts = {},   -- used mainly for the shopping list			
+			BankItemsAndCounts = {},   -- used mainly for the shopping list		
+			GreatVaultItems = {},      -- available weekly rewards from the great vault	
 			GearSetups = {},           -- imported gear sets
 			JunkData = {},             -- imported data about items that can be vendored/scrapped/disenchanted
 			ExtraEnchantData = {},     -- enchant id to enchant display information and material information
@@ -715,4 +716,5 @@
 	--local info = C_LegendaryCrafting.GetRuneforgePowerInfo(30)
 
 	--print(Amr:dump(info))
+
 end
--- a/Export.lua	Tue Nov 24 16:20:29 2020 -0600
+++ b/Export.lua	Thu Dec 17 11:57:06 2020 -0600
@@ -267,6 +267,32 @@
 end
 ]]
 
+local function scanGreatVault()
+
+	Amr.db.char.GreatVaultItems = {}
+
+	if not C_WeeklyRewards then return end
+
+	local vaultItems = {}
+	local activities = C_WeeklyRewards.GetActivities()
+	for i, activityInfo in ipairs(activities) do
+		if activityInfo and activityInfo.rewards then
+			for i, rewardInfo in ipairs(activityInfo.rewards) do
+				if rewardInfo.type == Enum.CachedRewardType.Item and not C_Item.IsItemKeystoneByID(rewardInfo.id) then
+					local itemLink = C_WeeklyRewards.GetItemHyperlink(rewardInfo.itemDBID)
+					if itemLink then
+						local itemData = Amr.Serializer.ParseItemLink(itemLink)
+						if itemData ~= nil then
+							table.insert(vaultItems, itemData)
+						end
+					end
+				end
+			end
+		end
+	end
+	Amr.db.char.GreatVaultItems = vaultItems
+end
+
 local function scanSoulbinds()
 	if not C_Soulbinds then return end
 
@@ -416,6 +442,9 @@
 	-- scan current spec's essences just before exporting
 	--scanEssences()
 	
+	-- scan the great vault for potential rewards this week
+	scanGreatVault()
+
 	data.Talents = Amr.db.char.Talents	
 	data.UnlockedConduits = Amr.db.char.UnlockedConduits
 	data.ActiveSoulbinds = Amr.db.char.ActiveSoulbinds
@@ -424,6 +453,7 @@
 	--data.Essences = Amr.db.char.Essences
 	data.Equipped = Amr.db.char.Equipped	
 	data.BagItems = Amr.db.char.BagItems
+	data.GreatVaultItems = Amr.db.char.GreatVaultItems
 
 	-- flatten bank data (which is stored by bag for more efficient updating)
 	data.BankItems = {}