Add Slash Commands #218


  • Enhancement
Open
  • jgordon615 created this issue Apr 11, 2019

    What exactly is wrong?

    Collectinator should allow the use of slash commands so we can use macros to open the windows.  

     

    What steps will reproduce the problem?
    1. Install Collectinator and Rematch

    2. Open the pets collection tab

    3. Note the "Scan" button is missing from the Pets tab

     

    What version of the product are you using? 8.1.0.1

     

     

    Any additional information?

    Yes, I don't know how to submit a PR for you, so I'll put it here...

     

    In Core.lua, remove the existing addon:Scan() method and replace it with these two methods:

    function addon:Scan()
    local currentPanelID = _G.PanelTemplates_GetSelectedTab(_G.CollectionsJournal);
    addon:ShowCollection(currentPanelID);
    end

    function addon:ShowCollection(collectionOrdinal)
    local collectionID = private.ORDERED_COLLECTIONS[collectionOrdinal]
    addon:InitializeCollection(collectionID)

    local collectables = private.collectable_list[collectionID]

    for id, collectable in pairs(collectables) do
    collectable:RemoveState("RELEVANT")
    collectable:RemoveState("VISIBLE")
    end

    local search_box = _G.PetJournalSearchBox
    search_box:ClearFocus()
    search_box:SetText("")
    _G.PetJournal_OnSearchTextChanged(search_box)

    private.Player:UpdateReputations()

    local func = COLLECTABLE_SCAN_FUNCS[currentPanelID]
    if func then
    func(collectionID, collectables)
    end

    if private.InitializeFrame then
    private.InitializeFrame()
    end

    self.Frame:Display(private.ORDERED_COLLECTIONS[collectionOrdinal])
    end

    Finally, add the following to the bottom of Core.lua:

    SLASH_COLLECTINATOR1, SLASH_COLLECTINATOR2 = "/collectinator", "/coll";
    function SlashCmdList.COLLECTINATOR(msg, editbox)
    addon:ShowCollection(tonumber(msg));
    end

    You can now both use the existing Scan buttons AND you can type "/coll <tab number>" to open the dialog to the relevant collections (Example:  "/coll 2" will open the critters window)

     

    This also gives a workaround to the "rematch" issue where the "Scan" button is missing from the rematch tab.

     

     

  • jgordon615 added a tag Enhancement Apr 11, 2019

To post a comment, please login or register a new account.