Thread Tools Display Modes
08-28-22, 07:04 PM   #1
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 233
Disable the Heirloom Journal

Hi all

I want to disable the Heirlooms tab button on the Collections Journal.

I have tried a number of different methods all without success.

I have tried;
Lua Code:
  1. -- hook character equipment manager button
  2.     hooksecurefunc(
  3.         "HeirloomsJournalSpellButton_OnClick",
  4.         function()
  5.             ToggleCharacter("PaperDollFrame")
  6.         end
  7.     )
and get the following error;
Lua Code:
  1. 5x IronMan\IronMan-1.0.9.15.lua:601: hooksecurefunc(): HeirloomsJournalSpellButton_OnClick is not a function
  2.         [string "=[C]"]: in function `hooksecurefunc'
  3.        [string "@IronMan\IronMan-1.0.9.15.lua"]:601: in function <IronMan\IronMan.lua:579>
  4.        [string "@IronMan\IronMan-1.0.9.15.lua"]:654: in function <IronMan\IronMan.lua:643>
  5.        
  6.        Locals:

I have also tried;
Lua Code:
  1. local functionIWantToDisable, isFunctionStillRelevant = HeirloomsJournalSpellButton_OnClick, false
  2.     function PVEFrame_ToggleFrame()
  3.         if isFunctionStillRelevant then
  4.             return functionIWantToDisable()
  5.         end
  6.     end
This throws no errors.

I have also tried to hide the HeirloomsJournal frame on show, and track the HEIRLOOMS_UPDATED event as well.
The event does not trigger on show so I can only guess it fires when we update a heirloom.

Is there a way I can achieve my goal?
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote
08-28-22, 07:42 PM   #2
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
The first error is because the collections window is not loaded immediately. You need to load the Blizzard_Collections addon first before dealing with any part of the collections.
  Reply With Quote
08-29-22, 12:26 AM   #3
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 233
Hi Kanegasi

I thought that addons are installed in alphabetical order, so my addon would not be loaded before the blizzard addons.

How do I ensure that my addon is loaded after the blizzard collections addon?
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote
08-29-22, 01:59 AM   #4
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 233
Hi Kanegasi

After some reading it seems that all I have to do is add the following to my toc;
Lua Code:
  1. ## Dependencies: Blizzard_Collections

I will test this out to see if it does fix my issue.
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote
08-29-22, 03:44 AM   #5
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
You are correct. When the UI loads, the addon list is loaded alphabetically.

However, all immediate Blizzard "addons" are loaded first and then the user addons are loaded after. Blizzard_Collections is not loaded. It is not active when you see your character after logging in or reloading. So, no matter what you name your addon, Blizzard's "addons" will either be loaded already or not there.

You have two options. You found one, which is to put it as a dependency. The other is to simply use LoadAddOn().
  Reply With Quote
08-29-22, 11:25 PM   #6
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 233
Hi Kanegasi

I have tried both methods without success.

I have probably made a bonehead mistake somewhere, but I just can't see it.

Here is my toc and lua on Pastebin.

Would it be possible for you to have a look at the files and see if anything jumps out at you?

The secure hook is at line 594, and I have added the load addon call at line 574.
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote
08-30-22, 10:13 AM   #7
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,917
I might be wrong, but at first glance, I see you are loading the addon and then utilising the journal in the same function. I would personally monitor ADDON_LOADED and use the journal after the addon has been confirmed as loaded.
__________________
  Reply With Quote
08-30-22, 07:20 PM   #8
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 233
Hi Xrystal

Thanks for your suggestion.

I removed the load from the function that contained my securehooks, and moved outside.
I then registered the "ADDON_LOADED";
Lua Code:
  1. elseif event == "ADDON_LOADED" then
  2.             local addonName = ...
  3.             print(addonName) -- debug --
  4.         end
When I login it only prints my addonName, the Blizzard_TimeManager and the Blizzard_CombatLog addons.

So it seems that even though I added Blizzard_Collections to my toc and specifically added the
Lua Code:
  1. LoadAddOn("Blizzard_Collections")
the Blizzard_Collections addon is not loaded.
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote
08-30-22, 09:12 PM   #9
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
Blizzard_Collections is loaded before your addon. That's how the dependency thing works. There may be something else going on. I haven't reviewed anything too deep to figure it out though.
  Reply With Quote
09-01-22, 12:55 PM   #10
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,917
I just rigged up a quick and simple addon to see how it loads ..

Print Output is as follows:
ADDON_LOADED (XCollections)
ADDON_LOADED Blizzard_Collections
CollectionsSystem
ADDON_LOADED Blizzard_BattlefieldMap
ADDON_LOADED Blizzard_TimeManager
ADDON_LOADED Blizzard_CombatLog
PLAYER_ENTERING_WORLD false true

I then opened the collections window and selected the heirloom tab and ... nothing.. the secure hook print statements don't print. Maybe this particular set of frames are unhookable or is it not working because of the mixin part of the heirloomjournal. As you can see I even tried the main CollectionsJournal frame and that didn't work either.

However the Updating of SelectedTab did get triggered. So, maybe that is where you can make your changes.

Lua Code:
  1. local addon, addonData = ...
  2.  
  3. --[[ Handle Collection System Stuff ]]--
  4. local function CollectionsSystem()
  5.     print("CollectionsSystem")
  6.  
  7.     -- Select Heirloom Tab ? -- Didn't work
  8.     hooksecurefunc(
  9.         "HeirloomsJournal_OnShow",
  10.         function(self)
  11.             print("Showing HeirloomJournal")
  12.         end
  13.     )
  14.    
  15.     -- Open Collections Journal ? -- Didn't work
  16.     hooksecurefunc(
  17.         "CollectionsJournal_OnShow",
  18.         function(self)
  19.             print("Showing CollectionsJournal")
  20.         end
  21.     )
  22.    
  23.     -- Changing to Selected Tab ? -- Works
  24.     hooksecurefunc(
  25.         "CollectionsJournal_UpdateSelectedTab",
  26.         function(self)
  27.             print("Updating Selected Tab ")
  28.         end
  29.     )    
  30.    
  31. end
  32.  
  33.  
  34. --[[ Monitor for Events ]]--
  35. local function EventWatcher(self,event,...)
  36.     print(event,...)
  37.     if event == "PLAYER_ENTERING_WORLD" then
  38.     elseif event == "ADDON_LOADED" then  
  39.         local addonName = ...
  40.         if addonName == addon then
  41.             LoadAddOn("Blizzard_Collections")            
  42.         elseif addonName == "Blizzard_Collections" then
  43.             CollectionsSystem()
  44.         end
  45.     end
  46. end
  47.  
  48. local f = CreateFrame("Frame")
  49. f:RegisterEvent("PLAYER_ENTERING_WORLD")
  50. f:RegisterEvent("ADDON_LOADED")
  51. f:SetScript("OnEvent", EventWatcher)
__________________
  Reply With Quote
09-01-22, 05:30 PM   #11
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 233
Hi Xrystal

Thanks for testing different methods, the fact that your testing resulted in the same issues I had is good in a way as it shows my failed attempts were not just boneheaded mistakes that I had made.

Hooking the CollectionsJournal_UpdateSelectedTab is a great suggestion and I will play with that.

Cheers for your help.
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote
09-01-22, 10:31 PM   #12
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 233
Hi Xrystal

You cracked it.

Lua Code:
  1. -- hook heirloom tab button
  2.     hooksecurefunc(
  3.         "CollectionsJournal_UpdateSelectedTab",
  4.         function()
  5.             if HeirloomsJournal:IsVisible() then
  6.                 ToggleCollectionsJournal(1)
  7.             end
  8.         end
  9.     )

Thanks to all for your help.
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Disable the Heirloom Journal

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