Thread Tools Display Modes
Prev Previous Post   Next Post Next
11-20-20, 05:48 PM   #1
Draugor
A Murloc Raider
Join Date: Nov 2020
Posts: 5
Hook into a MountJournal function ?

Hello everyone,

I'm currently trying add an extra option to the right click context menu in the mount collection.
After some digging in wowpedia and the Blizzard_MountCollection.lua i think i need to hook into MountOptionsMenu_Init and add my button via UIDropDownMenu_AddButton, but thats where i'm stumped.

Hooking into the C_MountJournal functions works just fine like so:
Lua Code:
  1. local orgMountUP = C_MountJournal.SummonByID;
  2. C_MountJournal.SummonByID = function(...)
  3.         print("hooked on a feeling ...")
  4.     orgMountUP(...);
  5. end

but hooking into MountOptionsMenu_Init not ...

Lua Code:
  1. local orgMountOptionsMenu_Init  = MountJournal.MountOptionsMenu_Init ; -- <-- Error global "MountJournal" is nil
  2. MountJournal.MountOptionsMenu_Init  = function(...)
  3.     print("hooked on a feeling ...")
  4.     orgMountOptionsMenu_Init(...);
  5. end
  6.  
  7. local orgCMountOptionsMenu_Init  = C_MountJournal.MountOptionsMenu_Init ;
  8. C_MountJournal.MountOptionsMenu_Init  = function(...)  --- <-- doesn't seem to be called
  9.     print("hooked on a feeling ...")
  10.     orgCMountOptionsMenu_Init(...);
  11. end

I also tried to hook into the ADDON_LOADED event and from there hook into MountJournal because at this point it shouldn't be nil, but to no avail. for code see here: https://pastebin.com/pXth1U6a

any tips ? is there an other way i haven't tried ? is this even possible ?
thx for your help

greetings
Draugor
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Hook into a MountJournal function ?

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