Quantcast

- Bags : Default 'open bags' to true for Classic versions; occurs on first use of 8.* or no saved vars for each toon

urnati [01-02-24 - 14:51]
- Bags : Default 'open bags' to true for Classic versions; occurs on first use of 8.* or no saved vars for each toon
Filename
TitanBag/TitanBag.lua
diff --git a/TitanBag/TitanBag.lua b/TitanBag/TitanBag.lua
index abfc64f..90ba680 100644
--- a/TitanBag/TitanBag.lua
+++ b/TitanBag/TitanBag.lua
@@ -264,8 +264,16 @@ function TitanPanelBagButton_OnLoad(self)
 			ShowColoredText = 1,
 			DisplayOnRightSide = false,
 			OpenBags = false,
+			OpenBagsClassic = "new_install",
 		}
 	};
+	if TITAN_ID == "Titan" then -- 10.* / Retail
+		-- for taint issue
+		self.registry.savedVariables.OpenBags = false
+	else
+		-- does not taint so default to open bags on click
+		self.registry.savedVariables.OpenBags = true
+	end

 	self:RegisterEvent("PLAYER_ENTERING_WORLD");

@@ -284,7 +292,7 @@ function TitanPanelBagButton_OnEvent(self, event, a1, a2, ...)
 		self:RegisterEvent("BAG_UPDATE")
 		TitanPanelButton_UpdateButton(TITAN_BAG_ID);

-		if a1 == true then
+		if a1 == true and TITAN_ID == "Titan" then -- 10.* / Retail
 			-- initial login

 			TitanPrint(""
@@ -294,7 +302,15 @@ function TitanPanelBagButton_OnEvent(self, event, a1, a2, ...)
 			.." "..tostring(ADDON_DISABLED or "Disabled")..""
 			.." "..tostring("Until taint is fixed or work around found.")..""
 			, "warning")
-		else
+		else -- either Classic version
+			local open = TitanGetVar(TITAN_BAG_ID, "OpenBagsClassic")
+			if open == "new_install" then --
+				-- set to default behavior of opening bag on left click
+				TitanSetVar(TITAN_BAG_ID, "OpenBags", true)
+				TitanSetVar(TITAN_BAG_ID, "OpenBagsClassic", "processed") -- don't do again
+			else
+				-- already processed...
+			end
 		end
 	end