Quantcast

-Added total command switch to display totals for tooltips. (Item and Gold displays)

Xruptor [05-17-10 - 15:07]
-Added total command switch to display totals for tooltips.  (Item and Gold displays)
-Fixed a few issues
Filename
BagSync.lua
BagSync.toc
localization/localization.lua
diff --git a/BagSync.lua b/BagSync.lua
index 63b36f1..aeec683 100644
--- a/BagSync.lua
+++ b/BagSync.lua
@@ -135,6 +135,15 @@ function BagSync:PLAYER_LOGIN()
 			elseif c and c:lower() == BAGSYNC_SLASH_CMD6 then
 				self:FixDB_Data()
 				return true
+			elseif c and c:lower() == BAGSYNC_SLASH_CMD7 then
+				if BagSyncOpt.showTotal then
+					BagSyncOpt.showTotal = false
+					print("|cFFFF0000BagSync: "..BAGSYNC_SEARCH_TOTAL.." "..BAGSYNC_SWITCH_OFF)
+				else
+					BagSyncOpt.showTotal = true
+					print("|cFFFF0000BagSync: "..BAGSYNC_SEARCH_TOTAL.." "..BAGSYNC_SWITCH_ON)
+				end
+				return true
 			elseif c and c:lower() ~= "" then
 				--do an item search
 				if BagSync_SearchFrame then
@@ -153,6 +162,7 @@ function BagSync:PLAYER_LOGIN()
 		DEFAULT_CHAT_FRAME:AddMessage(BAGSYNC_SLASH4)
 		DEFAULT_CHAT_FRAME:AddMessage(BAGSYNC_SLASH5)
 		DEFAULT_CHAT_FRAME:AddMessage(BAGSYNC_SLASH6)
+		DEFAULT_CHAT_FRAME:AddMessage(BAGSYNC_SLASH7)
 	end

 	DEFAULT_CHAT_FRAME:AddMessage("|cFF99CC33BagSync|r [v|cFFDF2B2B"..ver.."|r] loaded: /bgs, /bagsync")
@@ -249,6 +259,7 @@ function BagSync:StartupDB()
 	BS_DB = BagSyncDB[currentRealm][currentPlayer]

 	BagSyncOpt = BagSyncOpt or {}
+	if BagSyncOpt.showTotal == nil then BagSyncOpt.showTotal = true end

 	BagSyncGUILD_DB = BagSyncGUILD_DB or {}
 	BagSyncGUILD_DB[currentRealm] = BagSyncGUILD_DB[currentRealm] or {}
@@ -679,8 +690,15 @@ function BagSync:ShowMoneyTooltip()

 	table.sort(usrData, function(a,b) return (a.name < b.name) end)

+	local gldTotal = 0
+
 	for i=1, table.getn(usrData) do
 		tooltip:AddDoubleLine(usrData[i].name, self:buildMoneyString(usrData[i].gold, false), 1, 1, 1, 1, 1, 1)
+		gldTotal = gldTotal + usrData[i].gold
+	end
+	if BagSyncOpt.showTotal then
+		tooltip:AddLine(" ")
+		tooltip:AddDoubleLine("|cfff4a460"..BAGSYNC_SEARCH_TOTAL.."|r", self:buildMoneyString(gldTotal, false), 1, 1, 1, 1, 1, 1)
 	end

 	tooltip:AddLine(" ")
diff --git a/BagSync.toc b/BagSync.toc
index 9772f4e..b1c2d92 100644
--- a/BagSync.toc
+++ b/BagSync.toc
@@ -2,7 +2,7 @@
 ## Title: BagSync
 ## Notes: BagSync tracks your characters items and displays it within tooltips.
 ## Author: Xruptor
-## Version: 3.5
+## Version: 3.6
 ## SavedVariables: BagSyncDB, BagSyncOpt, BagSyncGUILD_DB, BagSyncTOKEN_DB

 localization\localization.lua
diff --git a/localization/localization.lua b/localization/localization.lua
index 1f0a9d8..b8f75cd 100644
--- a/localization/localization.lua
+++ b/localization/localization.lua
@@ -19,19 +19,23 @@ if ( GetLocale() == "zhCN" ) then
 	BAGSYNC_BINDING_SEARCH = 'Toggle Search'
 	BAGSYNC_BINDING_TOKEN = 'Toggle Tokens'
 	BAGSYNC_BINDING_PROFILES = 'Toggle Profiles'
-	BAGSYNC_DATABASE_FIX_ALERT = "A FixDB has been performed on BagSync!  The database is now optimized!"
+	BAGSYNC_DATABASE_FIX_ALERT = 'A FixDB has been performed on BagSync!  The database is now optimized!'
+	BAGSYNC_SWITCH_ON = 'ON'
+	BAGSYNC_SWITCH_OFF = 'OFF'
 	BAGSYNC_SLASH_CMD1 = '[itemname]'
 	BAGSYNC_SLASH_CMD2 = 'search'
 	BAGSYNC_SLASH_CMD3 = 'gold'
 	BAGSYNC_SLASH_CMD4 = 'tokens'
 	BAGSYNC_SLASH_CMD5 = 'profiles'
 	BAGSYNC_SLASH_CMD6 = 'fixdb'
+	BAGSYNC_SLASH_CMD7 = 'total'
 	BAGSYNC_SLASH1 = '/bgs '..BAGSYNC_SLASH_CMD1..' - Does a quick search for an item'
 	BAGSYNC_SLASH2 = '/bgs '..BAGSYNC_SLASH_CMD2..' - Opens the search window'
 	BAGSYNC_SLASH3 = '/bgs '..BAGSYNC_SLASH_CMD3..' - Displays a tooltip with the amount of gold on each character.'
 	BAGSYNC_SLASH4 = '/bgs '..BAGSYNC_SLASH_CMD4..' - Opens the tokens/currency window.'
 	BAGSYNC_SLASH5 = '/bgs '..BAGSYNC_SLASH_CMD5..' - Opens the profiles window.'
 	BAGSYNC_SLASH6 = '/bgs '..BAGSYNC_SLASH_CMD6..' - Runs the database fix (FixDB) on BagSync.'
+	BAGSYNC_SLASH7 = '/bgs '..BAGSYNC_SLASH_CMD7..' - Toggles the [Total] display in tooltips and gold display.'

 elseif ( GetLocale() == "ruRU" )  then
 	--thanks to senryo from WOWInterface
@@ -51,19 +55,23 @@ elseif ( GetLocale() == "ruRU" )  then
 	BAGSYNC_BINDING_SEARCH = 'Toggle Search'
 	BAGSYNC_BINDING_TOKEN = 'Toggle Tokens'
 	BAGSYNC_BINDING_PROFILES = 'Toggle Profiles'
-	BAGSYNC_DATABASE_FIX_ALERT = "A FixDB has been performed on BagSync!  The database is now optimized!"
+	BAGSYNC_DATABASE_FIX_ALERT = 'A FixDB has been performed on BagSync!  The database is now optimized!'
+	BAGSYNC_SWITCH_ON = 'ON'
+	BAGSYNC_SWITCH_OFF = 'OFF'
 	BAGSYNC_SLASH_CMD1 = '[itemname]'
 	BAGSYNC_SLASH_CMD2 = 'search'
 	BAGSYNC_SLASH_CMD3 = 'gold'
 	BAGSYNC_SLASH_CMD4 = 'tokens'
 	BAGSYNC_SLASH_CMD5 = 'profiles'
 	BAGSYNC_SLASH_CMD6 = 'fixdb'
+	BAGSYNC_SLASH_CMD7 = 'total'
 	BAGSYNC_SLASH1 = '/bgs '..BAGSYNC_SLASH_CMD1..' - Does a quick search for an item'
 	BAGSYNC_SLASH2 = '/bgs '..BAGSYNC_SLASH_CMD2..' - Opens the search window'
 	BAGSYNC_SLASH3 = '/bgs '..BAGSYNC_SLASH_CMD3..' - Displays a tooltip with the amount of gold on each character.'
 	BAGSYNC_SLASH4 = '/bgs '..BAGSYNC_SLASH_CMD4..' - Opens the tokens/currency window.'
 	BAGSYNC_SLASH5 = '/bgs '..BAGSYNC_SLASH_CMD5..' - Opens the profiles window.'
 	BAGSYNC_SLASH6 = '/bgs '..BAGSYNC_SLASH_CMD6..' - Runs the database fix (FixDB) on BagSync.'
+	BAGSYNC_SLASH7 = '/bgs '..BAGSYNC_SLASH_CMD7..' - Toggles the [Total] display in tooltips and gold display.'

 elseif ( GetLocale() == "zhTW" ) then

@@ -82,19 +90,23 @@ elseif ( GetLocale() == "zhTW" ) then
 	BAGSYNC_BINDING_SEARCH = 'Toggle Search'
 	BAGSYNC_BINDING_TOKEN = 'Toggle Tokens'
 	BAGSYNC_BINDING_PROFILES = 'Toggle Profiles'
-	BAGSYNC_DATABASE_FIX_ALERT = "A FixDB has been performed on BagSync!  The database is now optimized!"
+	BAGSYNC_DATABASE_FIX_ALERT = 'A FixDB has been performed on BagSync!  The database is now optimized!'
+	BAGSYNC_SWITCH_ON = 'ON'
+	BAGSYNC_SWITCH_OFF = 'OFF'
 	BAGSYNC_SLASH_CMD1 = '[itemname]'
 	BAGSYNC_SLASH_CMD2 = 'search'
 	BAGSYNC_SLASH_CMD3 = 'gold'
 	BAGSYNC_SLASH_CMD4 = 'tokens'
 	BAGSYNC_SLASH_CMD5 = 'profiles'
 	BAGSYNC_SLASH_CMD6 = 'fixdb'
+	BAGSYNC_SLASH_CMD7 = 'total'
 	BAGSYNC_SLASH1 = '/bgs '..BAGSYNC_SLASH_CMD1..' - Does a quick search for an item'
 	BAGSYNC_SLASH2 = '/bgs '..BAGSYNC_SLASH_CMD2..' - Opens the search window'
 	BAGSYNC_SLASH3 = '/bgs '..BAGSYNC_SLASH_CMD3..' - Displays a tooltip with the amount of gold on each character.'
 	BAGSYNC_SLASH4 = '/bgs '..BAGSYNC_SLASH_CMD4..' - Opens the tokens/currency window.'
 	BAGSYNC_SLASH5 = '/bgs '..BAGSYNC_SLASH_CMD5..' - Opens the profiles window.'
 	BAGSYNC_SLASH6 = '/bgs '..BAGSYNC_SLASH_CMD6..' - Runs the database fix (FixDB) on BagSync.'
+	BAGSYNC_SLASH7 = '/bgs '..BAGSYNC_SLASH_CMD7..' - Toggles the [Total] display in tooltips and gold display.'

 elseif ( GetLocale() == "frFR" ) then
 	--thanks to cacahuete from WOWInterface
@@ -114,19 +126,23 @@ elseif ( GetLocale() == "frFR" ) then
 	BAGSYNC_BINDING_SEARCH = 'Toggle Search'
 	BAGSYNC_BINDING_TOKEN = 'Toggle Tokens'
 	BAGSYNC_BINDING_PROFILES = 'Toggle Profiles'
-	BAGSYNC_DATABASE_FIX_ALERT = "A FixDB has been performed on BagSync!  The database is now optimized!"
+	BAGSYNC_DATABASE_FIX_ALERT = 'A FixDB has been performed on BagSync!  The database is now optimized!'
+	BAGSYNC_SWITCH_ON = 'ON'
+	BAGSYNC_SWITCH_OFF = 'OFF'
 	BAGSYNC_SLASH_CMD1 = '[itemname]'
 	BAGSYNC_SLASH_CMD2 = 'search'
 	BAGSYNC_SLASH_CMD3 = 'gold'
 	BAGSYNC_SLASH_CMD4 = 'tokens'
 	BAGSYNC_SLASH_CMD5 = 'profiles'
 	BAGSYNC_SLASH_CMD6 = 'fixdb'
+	BAGSYNC_SLASH_CMD7 = 'total'
 	BAGSYNC_SLASH1 = '/bgs '..BAGSYNC_SLASH_CMD1..' - Does a quick search for an item'
 	BAGSYNC_SLASH2 = '/bgs '..BAGSYNC_SLASH_CMD2..' - Opens the search window'
 	BAGSYNC_SLASH3 = '/bgs '..BAGSYNC_SLASH_CMD3..' - Displays a tooltip with the amount of gold on each character.'
 	BAGSYNC_SLASH4 = '/bgs '..BAGSYNC_SLASH_CMD4..' - Opens the tokens/currency window.'
 	BAGSYNC_SLASH5 = '/bgs '..BAGSYNC_SLASH_CMD5..' - Opens the profiles window.'
 	BAGSYNC_SLASH6 = '/bgs '..BAGSYNC_SLASH_CMD6..' - Runs the database fix (FixDB) on BagSync.'
+	BAGSYNC_SLASH7 = '/bgs '..BAGSYNC_SLASH_CMD7..' - Toggles the [Total] display in tooltips and gold display.'

 elseif ( GetLocale() == "koKR" ) then
 	--thanks to zinzzalimp from WOWInterface
@@ -146,19 +162,23 @@ elseif ( GetLocale() == "koKR" ) then
 	BAGSYNC_BINDING_SEARCH = 'Toggle Search'
 	BAGSYNC_BINDING_TOKEN = 'Toggle Tokens'
 	BAGSYNC_BINDING_PROFILES = 'Toggle Profiles'
-	BAGSYNC_DATABASE_FIX_ALERT = "A FixDB has been performed on BagSync!  The database is now optimized!"
+	BAGSYNC_DATABASE_FIX_ALERT = 'A FixDB has been performed on BagSync!  The database is now optimized!'
+	BAGSYNC_SWITCH_ON = 'ON'
+	BAGSYNC_SWITCH_OFF = 'OFF'
 	BAGSYNC_SLASH_CMD1 = '[itemname]'
 	BAGSYNC_SLASH_CMD2 = 'search'
 	BAGSYNC_SLASH_CMD3 = 'gold'
 	BAGSYNC_SLASH_CMD4 = 'tokens'
 	BAGSYNC_SLASH_CMD5 = 'profiles'
 	BAGSYNC_SLASH_CMD6 = 'fixdb'
+	BAGSYNC_SLASH_CMD7 = 'total'
 	BAGSYNC_SLASH1 = '/bgs '..BAGSYNC_SLASH_CMD1..' - 빠른 아이템 찾기'
 	BAGSYNC_SLASH2 = '/bgs '..BAGSYNC_SLASH_CMD2..' - 검색창 열기'
 	BAGSYNC_SLASH3 = '/bgs '..BAGSYNC_SLASH_CMD3..' - 툴팁에 각 케릭터의 골드량을 표시합니다.'
 	BAGSYNC_SLASH4 = '/bgs '..BAGSYNC_SLASH_CMD4..' - 문장/화폐창을 엽니다'
 	BAGSYNC_SLASH5 = '/bgs '..BAGSYNC_SLASH_CMD5..' - 프로필 창을 엽니다.'
 	BAGSYNC_SLASH6 = '/bgs '..BAGSYNC_SLASH_CMD6..' - Runs the database fix (FixDB) on BagSync.'
+	BAGSYNC_SLASH7 = '/bgs '..BAGSYNC_SLASH_CMD7..' - Toggles the [Total] display in tooltips and gold display.'

 else

@@ -177,18 +197,22 @@ else
 	BAGSYNC_BINDING_SEARCH = 'Toggle Search'
 	BAGSYNC_BINDING_TOKEN = 'Toggle Tokens'
 	BAGSYNC_BINDING_PROFILES = 'Toggle Profiles'
-	BAGSYNC_DATABASE_FIX_ALERT = "A FixDB has been performed on BagSync!  The database is now optimized!"
+	BAGSYNC_DATABASE_FIX_ALERT = 'A FixDB has been performed on BagSync!  The database is now optimized!'
+	BAGSYNC_SWITCH_ON = 'ON'
+	BAGSYNC_SWITCH_OFF = 'OFF'
 	BAGSYNC_SLASH_CMD1 = '[itemname]'
 	BAGSYNC_SLASH_CMD2 = 'search'
 	BAGSYNC_SLASH_CMD3 = 'gold'
 	BAGSYNC_SLASH_CMD4 = 'tokens'
 	BAGSYNC_SLASH_CMD5 = 'profiles'
 	BAGSYNC_SLASH_CMD6 = 'fixdb'
+	BAGSYNC_SLASH_CMD7 = 'total'
 	BAGSYNC_SLASH1 = '/bgs '..BAGSYNC_SLASH_CMD1..' - Does a quick search for an item'
 	BAGSYNC_SLASH2 = '/bgs '..BAGSYNC_SLASH_CMD2..' - Opens the search window'
 	BAGSYNC_SLASH3 = '/bgs '..BAGSYNC_SLASH_CMD3..' - Displays a tooltip with the amount of gold on each character.'
 	BAGSYNC_SLASH4 = '/bgs '..BAGSYNC_SLASH_CMD4..' - Opens the tokens/currency window.'
 	BAGSYNC_SLASH5 = '/bgs '..BAGSYNC_SLASH_CMD5..' - Opens the profiles window.'
 	BAGSYNC_SLASH6 = '/bgs '..BAGSYNC_SLASH_CMD6..' - Runs the database fix (FixDB) on BagSync.'
+	BAGSYNC_SLASH7 = '/bgs '..BAGSYNC_SLASH_CMD7..' - Toggles the [Total] display in tooltips and gold display.'

 end
\ No newline at end of file