Thread Tools Display Modes
11-27-18, 08:14 AM   #1
LightVirus
A Kobold Labourer
Join Date: Nov 2018
Posts: 1
Need help locating some Blizzard code

Hi, I'm developing one addon to be able to see all class sets under Set tab on the collections frame.

The problem I found is that I need to re-create the WardrobeCollectionFrame.SetsCollectionFrame so I can make custom functions because blizzard code don't work when you ask for a Set of another class.

I found an addon that does that but only for the ScrollFrame on the left, here is what it does:

Code:
local SetCollection = nil;
local frame = CreateFrame("frame"); 
frame:RegisterEvent("ADDON_LOADED");
frame:SetScript("OnEvent", function(pSelf, pEvent, pUnit)
	if pEvent == "ADDON_LOADED" and pUnit == "Blizzard_Collections" then
		WardrobeCollectionFrameScrollFrame:Hide();
		WardrobeCollectionFrame.SetsCollectionFrame:Hide();
		_ButtonHeight = WardrobeCollectionFrameScrollFrame.buttons[1]:GetHeight();
		
		_SetsDataProvider = CreateFromMixins(WardrobeSetsDataProviderMixin);
		GetSets();
		
		_ScrollFrame = CreateFrame("ScrollFrame", "SetCollectionUngroupScrollFrame", WardrobeCollectionFrame.SetsCollectionFrame, "HybridScrollFrameTemplate");
		_ScrollFrame:SetAllPoints(WardrobeCollectionFrameScrollFrame);
		
		_ScrollFrame.scrollBar = CreateFrame("Slider", "SetCollectionUngroupScrollFrameScrollBar", _ScrollFrame, "HybridScrollBarTrimTemplate");
		_ScrollFrame.scrollBar:SetAllPoints(WardrobeCollectionFrameScrollFrame.scrollBar);
		_ScrollFrame.scrollBar:SetScript("OnValueChanged", function(pSelf, pValue) 
			pSelf.scrollValue = pValue;
			HybridScrollFrame_OnValueChanged(pSelf, pValue);
			ScrollFrame_Update();
		end);
		_ScrollFrame.scrollBar.trackBG:Show();
		_ScrollFrame.scrollBar.trackBG:SetVertexColor(0, 0, 0, 0.75);
		_ScrollFrame.scrollBar.scrollValue = 0;
		
		HybridScrollFrame_CreateButtons(_ScrollFrame, "WardrobeSetsScrollFrameButtonTemplate", 44, 0);
		for _, button in pairs(_ScrollFrame.buttons) do
			button.ProgressBar:SetTexture(1, 1, 1);
			button:RegisterForClicks("AnyUp", "AnyDown");
			button:SetScript("OnMouseUp", function(pSelf, pButton, pDown)
				if pButton == "LeftButton" then
					--PlaySound("igMainMenuOptionCheckBoxOn");
					CloseDropDownMenus();
					ScrollFrame_SelectSet(pSelf.setVariantID);
				elseif pButton == "RightButton" then
					_ScrollFrame.menuInitBaseSetID = pSelf.setID;
					ToggleDropDownMenu(1, nil, _FavoriteDropDown, pSelf, 0, 0);
					--PlaySound("igMainMenuOptionCheckBoxOn");
				end
			end)
		end
		
		_ScrollFrame.selectedSetID = _BaseSets[1].setID;
		local variantSets = GetVariantSets(_ScrollFrame.selectedSetID);
		if #variantSets > 0 then
			_ScrollFrame.selectedSetID = variantSets[1].setID;
		end
		WardrobeCollectionFrame.SetsCollectionFrame:SelectSet(_ScrollFrame.selectedSetID);
		
		_FavoriteDropDown = CreateFrame("Frame", "SetCollectionUngroupFavoriteDropDown", _ScrollFrame, "UIDropDownMenuTemplate");
		UIDropDownMenu_Initialize(_FavoriteDropDown, FavoriteDropDown_Init, "MENU");

		hooksecurefunc(WardrobeCollectionFrameScrollFrame, "update", function(pSelf)
			_ScrollFrame.selectedSetID = WardrobeCollectionFrame.SetsCollectionFrame:GetSelectedSetID();
			ScrollFrame_Update();
		end);
		hooksecurefunc(WardrobeCollectionFrameScrollFrame, "Update", function(pSelf)
			_ScrollFrame.selectedSetID = WardrobeCollectionFrame.SetsCollectionFrame:GetSelectedSetID();
			ScrollFrame_Update();
		end);
		
		_ScrollFrame:SetScript("OnShow", function(pSelf) 
			ScrollFrame_Update();
			frame:RegisterEvent("TRANSMOG_COLLECTION_UPDATED");
			frame:RegisterEvent("PLAYER_REGEN_ENABLED");
			frame:RegisterEvent("TRANSMOG_SETS_UPDATE_FAVORITE");
		end);
		_ScrollFrame:SetScript("OnHide", function(pSelf) 
			frame:UnregisterEvent("TRANSMOG_COLLECTION_UPDATED");
			frame:UnregisterEvent("PLAYER_REGEN_ENABLED");
			frame:UnregisterEvent("TRANSMOG_SETS_UPDATE_FAVORITE");
		end);
		_ScrollFrame:SetScript("OnKeyDown", function(pSelf, pKey)
			ScrollFrame_HandleKey(pKey);
		end);
	elseif _ScrollFrame then 
		if pEvent == "TRANSMOG_SETS_UPDATE_FAVORITE" then
			WardrobeCollectionFrameScrollFrame:OnEvent(pEvent);
		end
		ScrollFrame_Update();
	end
end)
The thing is, I need to do the same but with the whole frame, so there is anywhere I could see the Blizzard code that creates WardrobeCollectionFrame.SetsCollectionFrame and copy it? I mean, who made this addon, could have toked it from somewhere right? I already search in the whole Wardrobe.lua file and didn't find the point where WardrobeCollectionFrame.SetsCollectionFrame is initialized. Sorry for my english.

EDIT: Good place to start would be the place where this function is wrote I coulnd't find: "WardrobeCollectionFrame.SetsCollectionFrame:SelectSet(setID)"

Last edited by LightVirus : 11-27-18 at 09:44 AM.
  Reply With Quote
11-27-18, 11:53 AM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
The function is from WardrobeSetsCollectionMixin

Lua Code:
  1. function WardrobeSetsCollectionMixin:SelectSet(setID)
  2.     self.selectedSetID = setID;
  3.  
  4.     local baseSetID = C_TransmogSets.GetBaseSetID(setID);
  5.     local variantSets = SetsDataProvider:GetVariantSets(baseSetID);
  6.     if ( #variantSets > 0 ) then
  7.         self.selectedVariantSets[baseSetID] = setID;
  8.     end
  9.  
  10.     self:Refresh();
  11. end
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
11-29-18, 01:02 AM   #3
elcius
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Sep 2011
Posts: 75
this addon exists, not well known but it does what you're trying to achieve i think.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Need help locating some Blizzard code

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off