Quantcast

-Removed a bunch of slash commands.

Xruptor [11-20-11 - 23:22]
-Removed a bunch of slash commands.
-Added a new BagSync configuration window
-Added slash command to open new config window.  /bgs config
-Removed option to enable/disble tooltip throttling. Now on by default.
-Modified the Localization file quite a bit.
-Fixed kitchen sink....
Filename
BagSync.lua
BagSync.toc
BagSync_Config.lua
localization/localization.lua
diff --git a/BagSync.lua b/BagSync.lua
index 2ef678b..7f77a45 100644
--- a/BagSync.lua
+++ b/BagSync.lua
@@ -169,16 +169,6 @@ function BagSync:PLAYER_LOGIN()
 	self:RegisterEvent('MAIL_SHOW')
 	self:RegisterEvent('MAIL_INBOX_UPDATE')

-	local slashChk = {
-		[L["total"]] = "showTotal",
-		[L["guildname"]] = "showGuildNames",
-		[L["throttle"]] = "enableThrottle",
-		[L["guild"]] = "enableGuild",
-		[L["mailbox"]] = "enableMailbox",
-		[L["unitclass"]] = "enableUnitClass",
-		[L["faction"]] = "enableFaction",
-	}
-
 	SLASH_BAGSYNC1 = "/bagsync"
 	SLASH_BAGSYNC2 = "/bgs"
 	SlashCmdList["BAGSYNC"] = function(msg)
@@ -213,23 +203,8 @@ function BagSync:PLAYER_LOGIN()
 			elseif c and c:lower() == L["fixdb"] then
 				self:FixDB_Data()
 				return true
-			elseif c and c:lower() == L["minimap"] then
-				BagSyncOpt.enableMinimap = not BagSyncOpt.enableMinimap
-				if BagSyncOpt.enableMinimap and not BagSync_MinimapButton:IsVisible() then
-					BagSync_MinimapButton:Show()
-				elseif not BagSyncOpt.enableMinimap and BagSync_MinimapButton:IsVisible() then
-					BagSync_MinimapButton:Hide()
-				end
-				return true
-			elseif c and slashChk[c:lower()] and BagSyncOpt[slashChk[c:lower()]] ~= nil then
-				lastDisplayed = {}
-				lastItem = nil
-				BagSyncOpt[slashChk[c:lower()]] = not BagSyncOpt[slashChk[c:lower()]]
-				if BagSyncOpt[slashChk[c:lower()]] then
-					print("|cFFFF0000BagSync: |cFFFFFFFF"..(c:lower()).."|r |cFFFF0000"..L["ON"].."|r")
-				else
-					print("|cFFFF0000BagSync:|r |cFFFFFFFF"..(c:lower()).."|r |cFFFF0000"..L["OFF"].."|r")
-				end
+			elseif c and c:lower() == L["config"] then
+				InterfaceOptionsFrame_OpenToCategory("BagSync")
 				return true
 			elseif c and c:lower() ~= "" then
 				--do an item search
@@ -249,13 +224,8 @@ function BagSync:PLAYER_LOGIN()
 		DEFAULT_CHAT_FRAME:AddMessage(L["/bgs tokens - Opens the tokens/currency window."])
 		DEFAULT_CHAT_FRAME:AddMessage(L["/bgs profiles - Opens the profiles window."])
 		DEFAULT_CHAT_FRAME:AddMessage(L["/bgs fixdb - Runs the database fix (FixDB) on BagSync."])
-		DEFAULT_CHAT_FRAME:AddMessage(L["/bgs total - Toggles the [Total] display in tooltips and gold display."])
-		DEFAULT_CHAT_FRAME:AddMessage(L["/bgs guildname - Toggles the [Guild Name] display in tooltips."])
-		DEFAULT_CHAT_FRAME:AddMessage(L["/bgs throttle - Toggles the throttle when displaying tooltips. (ON = Prevents Lag)."])
-		DEFAULT_CHAT_FRAME:AddMessage(L["/bgs guild - Toggles the displaying of guild information."])
-		DEFAULT_CHAT_FRAME:AddMessage(L["/bgs minimap - Toggles the displaying of BagSync minimap button."])
-		DEFAULT_CHAT_FRAME:AddMessage(L["/bgs faction - Toggles the displaying of items for both factions (Alliance/Horde)."])
-
+		DEFAULT_CHAT_FRAME:AddMessage(L["/bgs config - Opens the BagSync Config Window"] )
+
 	end

 	DEFAULT_CHAT_FRAME:AddMessage("|cFF99CC33BagSync|r [v|cFFDF2B2B"..ver.."|r]   /bgs, /bagsync")
@@ -370,7 +340,6 @@ function BagSync:StartupDB()
 	BagSyncOpt = BagSyncOpt or {}
 	if BagSyncOpt.showTotal == nil then BagSyncOpt.showTotal = true end
 	if BagSyncOpt.showGuildNames == nil then BagSyncOpt.showGuildNames = false end
-	if BagSyncOpt.enableThrottle == nil then BagSyncOpt.enableThrottle = true end
 	if BagSyncOpt.enableGuild == nil then BagSyncOpt.enableGuild = true end
 	if BagSyncOpt.enableMailbox == nil then BagSyncOpt.enableMailbox = true end
 	if BagSyncOpt.enableUnitClass == nil then BagSyncOpt.enableUnitClass = false end
@@ -892,6 +861,11 @@ hooksecurefunc("BackpackTokenFrame_Update", BagSync.ScanTokens)
 -- (Special thanks to tuller)
 ------------------------

+function BagSync:resetTooltip()
+	lastDisplayed = {}
+	lastItem = nil
+end
+
 local function CountsToInfoString(invCount, bankCount, equipCount, guildCount, mailboxCount)
 	local info
 	local total = invCount + bankCount + equipCount + mailboxCount
@@ -1115,21 +1089,17 @@ local function Tip_OnSetItem(self, ...)
 	local _, itemLink = self:GetItem()
 	if itemLink and GetItemInfo(itemLink) then
 		local itemName = GetItemInfo(itemLink)
-		if BagSyncOpt.enableThrottle then
-			if not self.BagSyncThrottle then self.BagSyncThrottle = GetTime() end
-			if not self.BagSyncPrevious then self.BagSyncPrevious = itemName end
-			if not self.BagSyncShowOnce and self:GetName() == "GameTooltip" then self.BagSyncShowOnce = true end
-
-			if itemName ~= self.BagSyncPrevious then
-				self.BagSyncPrevious = itemName
-				self.BagSyncThrottle = GetTime()
-			end
+		if not self.BagSyncThrottle then self.BagSyncThrottle = GetTime() end
+		if not self.BagSyncPrevious then self.BagSyncPrevious = itemName end
+		if not self.BagSyncShowOnce and self:GetName() == "GameTooltip" then self.BagSyncShowOnce = true end

-			if self:GetName() ~= "GameTooltip" or (GetTime() - self.BagSyncThrottle) >= 0.05 then
-				self.BagSyncShowOnce = nil
-				return AddOwners(self, itemLink)
-			end
-		else
+		if itemName ~= self.BagSyncPrevious then
+			self.BagSyncPrevious = itemName
+			self.BagSyncThrottle = GetTime()
+		end
+
+		if self:GetName() ~= "GameTooltip" or (GetTime() - self.BagSyncThrottle) >= 0.05 then
+			self.BagSyncShowOnce = nil
 			return AddOwners(self, itemLink)
 		end
 	end
diff --git a/BagSync.toc b/BagSync.toc
index f2f8a38..83a524d 100644
--- a/BagSync.toc
+++ b/BagSync.toc
@@ -17,4 +17,5 @@ BagSync_Minimap.lua
 BagSync_Search.lua
 BagSync_Tokens.lua
 BagSync_Profiles.lua
+BagSync_Config.lua
 BagSync.lua
diff --git a/BagSync_Config.lua b/BagSync_Config.lua
new file mode 100644
index 0000000..12fb10f
--- /dev/null
+++ b/BagSync_Config.lua
@@ -0,0 +1,165 @@
+local L = BAGSYNC_L
+local currentPlayer = UnitName('player')
+local currentRealm = GetRealmName()
+local ver = GetAddOnMetadata("BagSync","Version") or 0
+
+local bgsOpt = CreateFrame("Frame", "BagSyncConfig", InterfaceOptionsFramePanelContainer)
+bgsOpt:Hide()
+bgsOpt.name = "BagSync"
+
+bgsOpt:SetScript("OnShow", function()
+	if BagSyncOpt then
+		BagSyncConfig_Total:SetChecked(BagSyncOpt["showTotal"])
+		BagSyncConfig_GuildNames:SetChecked(BagSyncOpt["showGuildNames"])
+		BagSyncConfig_BothFactions:SetChecked(BagSyncOpt["enableFaction"])
+		BagSyncConfig_ClassColors:SetChecked(BagSyncOpt["enableUnitClass"])
+		BagSyncConfig_Minimap:SetChecked(BagSyncOpt["enableMinimap"])
+		BagSyncConfig_GuildInfo:SetChecked(BagSyncOpt["enableGuild"])
+		BagSyncConfig_MailboxInfo:SetChecked(BagSyncOpt["enableMailbox"])
+	end
+end)
+
+local title = bgsOpt:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
+title:SetPoint("TOPLEFT", 16, -16)
+title:SetText("|cFF99CC33BagSync|r [|cFFDF2B2B"..ver.."|r]")
+InterfaceOptions_AddCategory(bgsOpt)
+
+--[[ Total ]]--
+local bgs_Total_Opt = CreateFrame("CheckButton", "BagSyncConfig_Total", bgsOpt, "OptionsBaseCheckButtonTemplate")
+bgs_Total_Opt:SetPoint("TOPLEFT", 16, -45)
+bgs_Total_Opt:SetScript("OnClick", function(frame)
+	if BagSyncOpt then
+		if frame:GetChecked() then
+			PlaySound("igMainMenuOptionCheckBoxOn")
+			BagSyncOpt["showTotal"] = true
+			if BagSync then BagSync:resetTooltip() end
+		else
+			PlaySound("igMainMenuOptionCheckBoxOff")
+			BagSyncOpt["showTotal"] = false
+			if BagSync then BagSync:resetTooltip() end
+		end
+	end
+end)
+local bgs_Total_OptText = bgs_Total_Opt:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
+bgs_Total_OptText:SetPoint("LEFT", bgs_Total_Opt, "RIGHT", 0, 1)
+bgs_Total_OptText:SetText(L["Display [Total] in tooltips and gold display."])
+
+--[[ Guild Names ]]--
+local bgs_GuildNames_Opt = CreateFrame("CheckButton", "BagSyncConfig_GuildNames", bgsOpt, "OptionsBaseCheckButtonTemplate")
+bgs_GuildNames_Opt:SetPoint("TOPLEFT", 16, -73)
+bgs_GuildNames_Opt:SetScript("OnClick", function(frame)
+	if BagSyncOpt then
+		if frame:GetChecked() then
+			PlaySound("igMainMenuOptionCheckBoxOn")
+			BagSyncOpt["showGuildNames"] = true
+			if BagSync then BagSync:resetTooltip() end
+		else
+			PlaySound("igMainMenuOptionCheckBoxOff")
+			BagSyncOpt["showGuildNames"] = false
+			if BagSync then BagSync:resetTooltip() end
+		end
+	end
+end)
+local bgs_GuildNames_OptText = bgs_GuildNames_Opt:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
+bgs_GuildNames_OptText:SetPoint("LEFT", bgs_GuildNames_Opt, "RIGHT", 0, 1)
+bgs_GuildNames_OptText:SetText(L["Display [Guild Name] display in tooltips."])
+
+--[[ Display Both Factions ]]--
+local bgs_BothFactions_Opt = CreateFrame("CheckButton", "BagSyncConfig_BothFactions", bgsOpt, "OptionsBaseCheckButtonTemplate")
+bgs_BothFactions_Opt:SetPoint("TOPLEFT", 16, -101)
+bgs_BothFactions_Opt:SetScript("OnClick", function(frame)
+	if BagSyncOpt then
+		if frame:GetChecked() then
+			PlaySound("igMainMenuOptionCheckBoxOn")
+			BagSyncOpt["enableFaction"] = true
+			if BagSync then BagSync:resetTooltip() end
+		else
+			PlaySound("igMainMenuOptionCheckBoxOff")
+			BagSyncOpt["enableFaction"] = false
+			if BagSync then BagSync:resetTooltip() end
+		end
+	end
+end)
+local bgs_BothFactions_OptText = bgs_BothFactions_Opt:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
+bgs_BothFactions_OptText:SetPoint("LEFT", bgs_BothFactions_Opt, "RIGHT", 0, 1)
+bgs_BothFactions_OptText:SetText(L["Display items for both factions (Alliance/Horde)."])
+
+--[[ Class Colors ]]--
+local bgs_ClassColors_Opt = CreateFrame("CheckButton", "BagSyncConfig_ClassColors", bgsOpt, "OptionsBaseCheckButtonTemplate")
+bgs_ClassColors_Opt:SetPoint("TOPLEFT", 16, -129)
+bgs_ClassColors_Opt:SetScript("OnClick", function(frame)
+	if BagSyncOpt then
+		if frame:GetChecked() then
+			PlaySound("igMainMenuOptionCheckBoxOn")
+			BagSyncOpt["enableUnitClass"] = true
+			if BagSync then BagSync:resetTooltip() end
+		else
+			PlaySound("igMainMenuOptionCheckBoxOff")
+			BagSyncOpt["enableUnitClass"] = false
+			if BagSync then BagSync:resetTooltip() end
+		end
+	end
+end)
+local bgs_ClassColors_OptText = bgs_ClassColors_Opt:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
+bgs_ClassColors_OptText:SetPoint("LEFT", bgs_ClassColors_Opt, "RIGHT", 0, 1)
+bgs_ClassColors_OptText:SetText(L["Display class colors for characters."])
+
+--[[ Minimap ]]--
+local bgs_Minimap_Opt = CreateFrame("CheckButton", "BagSyncConfig_Minimap", bgsOpt, "OptionsBaseCheckButtonTemplate")
+bgs_Minimap_Opt:SetPoint("TOPLEFT", 16, -157)
+bgs_Minimap_Opt:SetScript("OnClick", function(frame)
+	if BagSyncOpt then
+		if frame:GetChecked() then
+			PlaySound("igMainMenuOptionCheckBoxOn")
+			BagSyncOpt["enableMinimap"] = true
+			if BagSync_MinimapButton and not BagSync_MinimapButton:IsVisible() then BagSync_MinimapButton:Show() end
+		else
+			PlaySound("igMainMenuOptionCheckBoxOff")
+			BagSyncOpt["enableMinimap"] = false
+			if BagSync_MinimapButton and BagSync_MinimapButton:IsVisible() then BagSync_MinimapButton:Hide() end
+		end
+	end
+end)
+local bgs_Minimap_OptText = bgs_Minimap_Opt:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
+bgs_Minimap_OptText:SetPoint("LEFT", bgs_Minimap_Opt, "RIGHT", 0, 1)
+bgs_Minimap_OptText:SetText(L["Display BagSync minimap button."])
+
+--[[ Enable Guild Info ]]--
+local bgs_GuildInfo_Opt = CreateFrame("CheckButton", "BagSyncConfig_GuildInfo", bgsOpt, "OptionsBaseCheckButtonTemplate")
+bgs_GuildInfo_Opt:SetPoint("TOPLEFT", 16, -185)
+bgs_GuildInfo_Opt:SetScript("OnClick", function(frame)
+	if BagSyncOpt then
+		if frame:GetChecked() then
+			PlaySound("igMainMenuOptionCheckBoxOn")
+			BagSyncOpt["enableGuild"] = true
+			if BagSync then BagSync:resetTooltip() end
+		else
+			PlaySound("igMainMenuOptionCheckBoxOff")
+			BagSyncOpt["enableGuild"] = false
+			if BagSync then BagSync:resetTooltip() end
+		end
+	end
+end)
+local bgs_GuildInfo_OptText = bgs_GuildInfo_Opt:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
+bgs_GuildInfo_OptText:SetPoint("LEFT", bgs_GuildInfo_Opt, "RIGHT", 0, 1)
+bgs_GuildInfo_OptText:SetText(L["Enable guild bank items."])
+
+--[[ Enable Mailbox Info ]]--
+local bgs_MailboxInfo_Opt = CreateFrame("CheckButton", "BagSyncConfig_MailboxInfo", bgsOpt, "OptionsBaseCheckButtonTemplate")
+bgs_MailboxInfo_Opt:SetPoint("TOPLEFT", 16, -213)
+bgs_MailboxInfo_Opt:SetScript("OnClick", function(frame)
+	if BagSyncOpt then
+		if frame:GetChecked() then
+			PlaySound("igMainMenuOptionCheckBoxOn")
+			BagSyncOpt["enableMailbox"] = true
+			if BagSync then BagSync:resetTooltip() end
+		else
+			PlaySound("igMainMenuOptionCheckBoxOff")
+			BagSyncOpt["enableMailbox"] = false
+			if BagSync then BagSync:resetTooltip() end
+		end
+	end
+end)
+local bgs_MailboxInfo_OptText = bgs_MailboxInfo_Opt:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
+bgs_MailboxInfo_OptText:SetPoint("LEFT", bgs_MailboxInfo_Opt, "RIGHT", 0, 1)
+bgs_MailboxInfo_OptText:SetText(L["Enable mailbox items."])
diff --git a/localization/localization.lua b/localization/localization.lua
index c6e2126..c0a5a64 100644
--- a/localization/localization.lua
+++ b/localization/localization.lua
@@ -39,11 +39,16 @@
 -- ["/bgs tokens - Opens the tokens/currency window."] = "",
 -- ["/bgs profiles - Opens the profiles window."] = "",
 -- ["/bgs fixdb - Runs the database fix (FixDB) on BagSync."] = "",
--- ["/bgs total - Toggles the [Total] display in tooltips and gold display."] = "",
--- ["/bgs guildname - Toggles the [Guild Name] display in tooltips."] = "",
--- ["/bgs throttle - Toggles the throttle when displaying tooltips. (ON = Prevents Lag)."] = "",
--- ["/bgs guild - Toggles the displaying of guild information."] = "",
+-- ["/bgs config - Opens the BagSync Config Window"] = "",
+-- ["Display [Total] in tooltips and gold display."] = "",
+-- ["Display [Guild Name] display in tooltips."] = "",
+-- ["Enable guild bank items."] = "",
+-- ["Enable mailbox items."] = "",
+-- ["Display BagSync minimap button."] = "",
+-- ["Display items for both factions (Alliance/Horde)."] = "",
+-- ["Display class colors for characters."] = "",

+
 BAGSYNC_L = GetLocale() == "zhCN" and {
 	["Bags: %d"] = "θƒŒεŒ…: %d",
 	["Bank: %d"] = "ι“Άθ‘Œ: %d",
@@ -103,13 +108,13 @@ BAGSYNC_L = GetLocale() == "zhCN" and {
 	["A FixDB has been performed on BagSync!  The database is now optimized!"] 		= "Die Funktion FixDB wurde ausgeführt! Die Datenbank wurde optimiert!",
 	["ON"] = "An",
 	["OFF"] = "Aus",
+	["Display [Total] in tooltips and gold display."] 								= "[Gesamt] Anzeige in Tooltips für Items und in der Goldanzeige.",
 	["/bgs [itemname] - Does a quick search for an item"] 							= "/bgs [itemname] - Nach einem Item suchen",
 	["/bgs search - Opens the search window"] 										= "/bgs search - Öffnet das Suchfenster",
 	["/bgs gold - Displays a tooltip with the amount of gold on each character."] 	= "/bgs gold - Zeigt einen Tooltip mit dem Gold eines jeden Charakters.",
 	["/bgs tokens - Opens the tokens/currency window."] 							= "/bgs tokens - Öffnet das Abzeichenfenster.",
 	["/bgs profiles - Opens the profiles window."] 									= "/bgs profiles - Öffnet das Profilfenster.",
 	["/bgs fixdb - Runs the database fix (FixDB) on BagSync."] 						= "/bgs fixdb - Führt eine Reparatur der Datenbank (FixDB) aus.",
-	["/bgs total - Toggles the [Total] display in tooltips and gold display."] 		= "/bgs total - Zeigt/Verbirgt die [Gesamt] Anzeige in Tooltips für Items und in der Goldanzeige.",

 } or { }