changeset 21:a400b906acca v4

Version 4: fixed an issue with the bank. Added Void Storage. Added Reagent Bank. Also removed stackable items from the export string
author Adam tegen <adam.tegen@gmail.com>
date Wed, 15 Oct 2014 08:38:53 -0500
parents e6cd96d23c5a
children be6beae735f1
files AskMrRobot.lua AskMrRobot.toc localization/localization.en.lua ui/ShoppingListTab.lua
diffstat 4 files changed, 58 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/AskMrRobot.lua	Mon Oct 13 23:47:14 2014 -0500
+++ b/AskMrRobot.lua	Wed Oct 15 08:38:53 2014 -0500
@@ -27,6 +27,10 @@
 AskMrRobot.eventListener:RegisterEvent("CHAT_MSG_ADDON")
 AskMrRobot.eventListener:RegisterEvent("UPDATE_INSTANCE_INFO")
 AskMrRobot.eventListener:RegisterEvent("PLAYER_DIFFICULTY_CHANGED")
+AskMrRobot.eventListener:RegisterEvent("VOID_STORAGE_OPEN")
+AskMrRobot.eventListener:RegisterEvent("VOID_STORAGE_CONTENTS_UPDATE")
+AskMrRobot.eventListener:RegisterEvent("PLAYER_DIFFICULTY_CHANGED")
+AskMrRobot.eventListener:RegisterEvent("VOID_STORAGE_UPDATE")
 
 AskMrRobot.AddonName = ...
 AskMrRobot.ChatPrefix = "_AMR"
@@ -41,8 +45,6 @@
 	if event == "ADDON_LOADED" then
         local addon = select(1, ...)
         if (addon == "AskMrRobot") then
-            --print(L.AMR_ON_EVENT_LOADED:format(GetAddOnMetadata(AskMrRobot.AddonName, "Version")))
-            
             AskMrRobot.InitializeSettings()
             AskMrRobot.InitializeMinimap()
             
@@ -66,7 +68,8 @@
         
 	elseif event == "BANKFRAME_OPENED" or event == "PLAYERBANKSLOTS_CHANGED" then 
 		AskMrRobot.ScanBank();
-        
+    elseif event == "VOID_STORAGE_OPEN" or event == "VOID_STORAGE_CONTENTS_UPDATE" or event == "VOID_STORAGE_DEPOSIT_UPDATE" or event == "VOID_STORAGE_UPDATE" then
+    	AskMrRobot.ScanVoidStorage();
 	elseif event == "CHARACTER_POINTS_CHANGED" or event == "CONFIRM_TALENT_WIPE" or event == "PLAYER_TALENT_UPDATE" or event == "ACTIVE_TALENT_GROUP_CHANGED" then
 		--AskMrRobot.GetAmrSpecializations();
 		--if AskMrRobot_ReforgeFrame then
@@ -253,7 +256,6 @@
 
 function AskMrRobot.SaveAll()
     AskMrRobot.ScanCharacter()
-	AskMrRobot.ScanBank()
 	AskMrRobot.ScanBags()
 	AskMrRobot.ScanEquipped()
 	AskMrRobot.GetCurrencies()
@@ -373,11 +375,13 @@
 	end
 end
 		
-function AskMrRobot.ScanBank(bankItemsWithCount)
+function AskMrRobot.ScanBank()
+	--REAGENTBANK_CONTAINER (-3)
 	local bankItems = {}
 	local bankItemsAndCounts = {}
 
 	scanBag(BANK_CONTAINER, true, bankItems, bankItemsAndCounts)
+	scanBag(REAGENTBANK_CONTAINER, true, bankItems, bankItemsAndCounts)
 	for bagId = NUM_BAG_SLOTS + 1, NUM_BAG_SLOTS + NUM_BANKBAGSLOTS do
 		scanBag(bagId, true, bankItems, bankItemsAndCounts)
 	end
@@ -392,6 +396,27 @@
 	end
 end
 
+function AskMrRobot.ScanVoidStorage()
+	if IsVoidStorageReady() then
+		local voidItems = {}
+		local VOID_STORAGE_MAX = 80
+		local VOID_STORAGE_PAGES = 2
+		local i
+		for page = 1,VOID_STORAGE_PAGES do
+			for i = 1,VOID_STORAGE_MAX do
+				local itemId = GetVoidItemInfo(page, i)
+				if itemId then
+					local itemLink = GetVoidItemHyperlinkString(page, i);
+					if itemLink then
+						tinsert(voidItems, itemLink)
+					end
+				end
+			end
+		end
+		AmrDb.VoidItems = voidItems
+	end
+end
+
 function AskMrRobot.ScanBags(bagItemsWithCount)
 	local bagItems = {}
 	scanBag(BACKPACK_CONTAINER, false, bagItems, bagItemsWithCount) -- backpack
@@ -693,20 +718,37 @@
         local itemObjects = {}
     	if AmrDb.BagItems then
 	        for i, v in ipairs(AmrDb.BagItems) do
-	            local itemData = AskMrRobot.parseItemLink(v)
-	            if itemData ~= nil then
-	                table.insert(itemObjects, itemData)
-	            end
+	        	local _,_,_,_,_,_,_,stackCount = GetItemInfo(v)
+	        	if stackCount == 1 then
+		            local itemData = AskMrRobot.parseItemLink(v)
+		            if itemData ~= nil then
+		                table.insert(itemObjects, itemData)
+		            end
+		        end
 	        end
 	    end
 	    if AmrDb.BankItems then
 	        for i, v in ipairs(AmrDb.BankItems) do
-	            local itemData = AskMrRobot.parseItemLink(v)
-	            if itemData ~= nil then
-	                table.insert(itemObjects, itemData)
+	        	local _,_,_,_,_,_,_,stackCount = GetItemInfo(v)
+	        	if stackCount == 1 then
+	            	local itemData = AskMrRobot.parseItemLink(v)
+	            	if itemData ~= nil then
+		                table.insert(itemObjects, itemData)
+	            	end
 	            end
 	        end
 	    end
+	    if AmrDb.VoidItems then
+	        for i, v in ipairs(AmrDb.VoidItems) do
+	        	local _,_,_,_,_,_,_,stackCount = GetItemInfo(v)
+	        	if stackCount == 1 then
+		            local itemData = AskMrRobot.parseItemLink(v)
+		            if itemData ~= nil then
+		                table.insert(itemObjects, itemData)
+		            end
+		        end
+		    end
+	    end
         
         table.insert(fields, ".inv")
         appendItemsToExport(fields, itemObjects)
--- a/AskMrRobot.toc	Mon Oct 13 23:47:14 2014 -0500
+++ b/AskMrRobot.toc	Wed Oct 15 08:38:53 2014 -0500
@@ -1,7 +1,7 @@
 ## Interface: 60000
 ## Title: Ask Mr. Robot
 ## Author: Team Robot, Inc.
-## Version: 2
+## Version: 4
 ## Notes: Exports/Imports data to/from askmrrobot.com.
 ## URL: www.askmrrobot.com
 ## DefaultState: Enabled
--- a/localization/localization.en.lua	Mon Oct 13 23:47:14 2014 -0500
+++ b/localization/localization.en.lua	Wed Oct 15 08:38:53 2014 -0500
@@ -451,7 +451,7 @@
 L.AMR_EXPORTTAB_EXPORT_TITLE = "Export your character to AskMrRobot.com"
 L.AMR_EXPORTTAB_COPY_PASTE_EXPORT_1 = "1. Open your bank"
 L.AMR_EXPORTTAB_COPY_PASTE_EXPORT_2 = "2. Copy the text below by pressing Ctrl+C (or Cmd+C on a Mac)"
-L.AMR_EXPORTTAB_COPY_PASTE_EXPORT_3 = "3. Go to |c00ffd100AskMrRobot.com|r and click the green '|c0000ff00Import from Armory|r' button found just above your character name.  Paste the text into the window that pops up."
+L.AMR_EXPORTTAB_COPY_PASTE_EXPORT_3 = "3. Go to |c00ffd100AskMrRobot.com|r and click the green '|c0000ff00Import from Addon|r' button found just above your character name.  Paste the text into the window that pops up."
 L.AMR_EXPORTTAB_COPY_PASTE_EXPORT_NOTE = "NOTE: If you change something while this window is open, press the Update button below to generate a new export string."
 
 --ui/GemTab.lua
--- a/ui/ShoppingListTab.lua	Mon Oct 13 23:47:14 2014 -0500
+++ b/ui/ShoppingListTab.lua	Wed Oct 15 08:38:53 2014 -0500
@@ -617,6 +617,8 @@
 	-- add the items from the players bags
 	AskMrRobot.ScanBags(bagItemsWithCounts)
 
+	-- note: void storage can't hold stackable items, so don't worry about them
+
 	--substract any inventory we already have in bags/bank
 	for itemId, count in pairs(bagItemsWithCounts) do
 		for _, gem in pairs(gemList) do