Advertisement
Guest User

Untitled

a guest
Nov 20th, 2020
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.09 KB | None | 0 0
  1. DrgrFncts = {}
  2. local panel = CreateFrame("FRAME")
  3. panel.name = "Draugor's Mount Up"
  4. panel:RegisterEvent("ADDON_LOADED")
  5. InterfaceOptions_AddCategory(panel)
  6. local testVar = false
  7. local initialized = false;
  8. panel:SetScript("OnEvent", function(self, event, arg1) 
  9.     if testVar then    
  10.         if not initialized then    
  11.             initialized = true;
  12.             print("MountJournal_OnLoad:"..tostring(MountJournal_OnLoad~=nil) .. "  - addon: " .. arg1) 
  13.  
  14.             local oldMountOptionsMenu_Init = MountJournal.MountOptionsMenu_Init;
  15.  
  16.             MountJournal.MountOptionsMenu_Init = function (...) -- <-- doesn't seem to do anything (or hook to late?)
  17.                 print("Init hook called! old-variation")
  18.                 oldMountJournalMenu_Init(...)
  19.                 local self, level = ...
  20.                 if not MountJournal.menuMountIndex then
  21.                     return;
  22.                 end
  23.                 local needsFanfare = C_MountJournal.NeedsFanfare(MountJournal.menuMountID);
  24.                 if needsFanfare then
  25.                     return;
  26.                 end
  27.                 --- local isFavorite, canFavorite = C_MountJournal.GetIsFavorite(MountJournal.menuMountIndex);
  28.                 local info = UIDropDownMenu_CreateInfo();
  29.                 info.text = "Extra Option"
  30.                 info.func = function()
  31.                     print("klicked")
  32.                 end
  33.                 UIDropDownMenu_AddButton(info, level)
  34.                
  35.             end    
  36.  
  37.             -- MountJournal.MountJournal_OnLoad(MountJournal) <-- Error nil
  38.            
  39.         end
  40.     end
  41.  
  42.  
  43.     if event == "ADDON_LOADED" and arg1 == "Blizzard_Collections" then
  44.         testVar = true;
  45.         if MountJournal then
  46.             --  MountJournal:HookScript("MountOptionsMenu_Init",  <-- Error no function "MountOptionsMenu_Init"
  47.             --  function (...)
  48.             --      local self, level = ...
  49.             --  
  50.             --      print("Init hook called! - hook script variation")
  51.             --      if not MountJournal.menuMountIndex then
  52.             --          return;
  53.             --      end
  54.             --      local needsFanfare = C_MountJournal.NeedsFanfare(MountJournal.menuMountID);
  55.             --      if needsFanfare then
  56.             --          return;
  57.             --      end
  58.             --      --- local isFavorite, canFavorite = C_MountJournal.GetIsFavorite(MountJournal.menuMountIndex);
  59.             --     
  60.             --      local info = UIDropDownMenu_CreateInfo();
  61.             --      info.text = "Extra Option"
  62.             --      info.func = function()
  63.             --          print("klicked")
  64.             --      end
  65.             --      UIDropDownMenu_AddButton(info, level)
  66.             --     
  67.             --  end);
  68.             --- MountOptionsMenu_Init
  69.             print("hook init")
  70.         else
  71.             print("MountJournal was Nil")
  72.         end
  73.     end
  74.    
  75. end)
  76.  
  77.  
  78. --- hooks ---
  79.  
  80. --  local oldMountOptionsMenu_Init = MountOptionsMenu_Init;
  81. --  
  82. --  function MountOptionsMenu_Init (...) -- <-- doesn't seem to do anything (or hook to late?)
  83. --      print("Init hook called! old-variation")
  84. --      oldMountJournalMenu_Init(...)
  85. --      local self, level = ...
  86. --      if not MountJournal.menuMountIndex then
  87. --          return;
  88. --      end
  89. --      local needsFanfare = C_MountJournal.NeedsFanfare(MountJournal.menuMountID);
  90. --      if needsFanfare then
  91. --          return;
  92. --      end
  93. --      --- local isFavorite, canFavorite = C_MountJournal.GetIsFavorite(MountJournal.menuMountIndex);
  94. --      local info = UIDropDownMenu_CreateInfo();
  95. --      info.text = "Extra Option"
  96. --      info.func = function()
  97. --          print("klicked")
  98. --      end
  99. --      UIDropDownMenu_AddButton(info, level)
  100. --     
  101. --  end
  102.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement