[CATA] Stat widgets in expanded Character Info window reset each time the window is closed

Cataclysm Classic

  1. Open Character Info window.
  2. Click the arrow to expand the window.
  3. Change the order of the widgets and/or expand or minimize some.
  4. Close Character Info window.
  5. Open Character Info window.
  6. Click the arrow to expand the window.
  7. See that the stat widgets in the expanded Character Info window reset back to the original order they were in and also expand if they were minimized.

Yakedo-Faerlina

3 Likes

BLUF: Yep, it’s broke. :stuck_out_tongue:

I looked through the code this morning (freshly extracted after reset, so the latest the client is using). It seems the associated cvars are not actually saving and/or returning a valid value.

	local activeSpec = GetActiveTalentGroup();
	if (activeSpec == 1) then
		PaperDoll_InitStatCategories(PAPERDOLL_STATCATEGORY_DEFAULTORDER, "statCategoryOrder", "statCategoriesCollapsed", "player");
	else
		PaperDoll_InitStatCategories(PAPERDOLL_STATCATEGORY_DEFAULTORDER, "statCategoryOrder_2", "statCategoriesCollapsed_2", "player");
	end	
	PaperDollFrame_UpdateStats();
	if (GetCVar("characterFrameCollapsed") ~= "0") then
		CharacterFrame:Collapse();
	else
		CharacterFrame:Expand();
	end

This is a segment of code that runs when you open the character frame (PaperDollFrame_OnShow). This code calls another function (PaperDoll_InitStatCategories) that will order and collapse/expand each category according to what is stored in the statCategoryOrder and statCategoriesCollapsed (or statCategoryOrder_2 and statCategoriesCollapsed_2 if in secondary spec).

	if (orderCVarName) then
		local orderString = GetCVar(orderCVarName);
		local savedOrder = {};
		if (orderString and orderString ~= "") then
			--[[ Removed code parsing and validating order ]]
		end
	end

	for index=1, #order do
		local frame = _G["CharacterStatsPaneCategory"..index];
		frame.Category = order[index];

		--[[ Removed some irrelevant code ]]

		local categoryInfo = PAPERDOLL_STATCATEGORIES[frame.Category];
		if (categoryInfo and collapsedCVarName and GetCVarBitfield(collapsedCVarName, categoryInfo.id)) then
			PaperDollFrame_CollapseStatCategory(frame);
		else
			PaperDollFrame_ExpandStatCategory(frame);
		end
	end

All of this code requires GetCVar and GetCVarBitfield to return relevant values for the given cvars. From my testing right now, I can only get GetCVar("statCategoryOrder") and GetCVarBitfield("statCategoriesCollapsed", 1) to return empty results (nil values).

Going back up to the first block of code again, the bottom part of it expands or collapses the frame based on the characterFrameCollapsed cvar, but like the others I have tested, GetCVar("characterFrameCollapsed") also only returns an empty result.

Attempts to manually set the values via calls to SetCVar did not help. Getting the value afterward still returned an empty result.

Essentially, the saved state isn’t working at all, so it constantly reverts to the default order and collapsed state.

Edit: I attempted to hook GetCVar and SetCVar. On calls to SetCVar, I stored the value passed in if the cvar was statCategoryOrder or characterFrameCollapsed. On calls to GetCVar, I returned my stored values for those two cvars. This corrected the behavior of the frame. However, as this taints the execution path of GetCVar, it isn’t something I can release in addon form as it would cause numerous other problems.

2 Likes

PLEASE fix this…

Why and HOW is this still a thing? Did EVERYONE who knows how to code leave Blizzard?!? :laughing:

Just unbelievable.

Thanks.