Thread Tools Display Modes
02-16-23, 10:42 PM   #1
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 233
Find a list secure functions

Hi all

I am trying to find a secure function for mounting that I can hook.

I have already found some secure functions such as JumpOrAscendStart and CollectionsJournal_UpdateSelectedTab.

Is there a way for me to find a list of all of the secure functions, or if one does not already exist, how I can build my own list?
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote
02-17-23, 03:47 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
I'd suggest looking at the source code for the default UI. There are a few online repositories that have this available or you could extract it yourself. It would be a good idea to list all the different ways the game can process mounting to get an idea of what you need to look for. Things like ActionButton, Spell/Item use, CollectionFrame, etc.

This list may get overwhelmingly long, so you may want to consider if your code can support a more focused approach. For example, all these methods send a spellcast request to the server. The way to detect these is to listen for the server to respond with a spellcast start event with the SpellID matching the mount that's being summoned.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
02-18-23, 04:13 PM   #3
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 233
Red face

Hi SDPhantom

I have tried tracking the spell via UNIT_SPELLCAST_SENT and it is great to pick out each mount spell and then cancel; however, there are hundreds of mounts that I wish to stop.

I want to stop a player from summoning any mount or at worse dismount after they have mounted.

Sorry, I always forget to fully explain what my final goal is.
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote
02-20-23, 11:57 PM   #4
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 233
I have now accepted that I will have to dismount after the player has mounted.

To do this I have the following chunk:
Lua Code:
  1. local f = CreateFrame("Frame")
  2. f:SetScript(
  3.     "OnEvent",
  4.     function(self, event, ...)
  5.         if event == "UNIT_SPELLCAST_SUCCEEDED" then
  6.             unit, spellGUID, spellID = ...
  7.             print("UNIT_SPELLCAST_SUCCEEDED", unit, spellGUID, spellID)
  8.             for k, v in pairs(C_MountJournal.GetMountIDs()) do
  9.                 if v == spellID then
  10.                     print("found")
  11.                 end
  12.             end
  13.         end
  14.     end
  15. )
  16. f:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")

I cannot work out why I never print found, but maybe I am too close to see the error.
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote
02-21-23, 08:00 AM   #5
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Because the spell to mount a thing (spellID) is not the thing itself (mountID).
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
02-21-23, 05:50 PM   #6
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 233
Hi Fizzlemizz

You are right.
Lua Code:
  1. local f = CreateFrame("Frame")
  2. f:SetScript(
  3.     "OnEvent",
  4.     function(self, event, ...)
  5.         if event == "UNIT_SPELLCAST_SUCCEEDED" then
  6.             _, _, spellID = ...
  7.             mountID = C_MountJournal.GetMountFromSpell(spellID)
  8.             for k, v in pairs(C_MountJournal.GetMountIDs()) do
  9.                 if v == mountID then
  10.                     Dismount()
  11.                 end
  12.             end
  13.         end
  14.     end
  15. )
  16.  
  17. f:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")

Thanks 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
02-21-23, 07:15 PM   #7
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Lua Code:
  1. if v == mountID then
  2.         Dismount()
  3.         break -- no need to keep looking
  4. end
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Find a list secure functions

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