WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Find a list secure functions (https://www.wowinterface.com/forums/showthread.php?t=59512)

Walkerbo 02-16-23 10:42 PM

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?

SDPhantom 02-17-23 03:47 PM

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.

Walkerbo 02-18-23 04:13 PM

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. :o

Walkerbo 02-20-23 11:57 PM

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.

Fizzlemizz 02-21-23 08:00 AM

Because the spell to mount a thing (spellID) is not the thing itself (mountID).

Walkerbo 02-21-23 05:50 PM

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.

Fizzlemizz 02-21-23 07:15 PM

Lua Code:
  1. if v == mountID then
  2.         Dismount()
  3.         break -- no need to keep looking
  4. end


All times are GMT -6. The time now is 04:28 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI