WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Need help locating some Blizzard code (https://www.wowinterface.com/forums/showthread.php?t=56864)

LightVirus 11-27-18 08:14 AM

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)"

Fizzlemizz 11-27-18 11:53 AM

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

elcius 11-29-18 01:02 AM

this addon exists, not well known but it does what you're trying to achieve i think.


All times are GMT -6. The time now is 04:14 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI