Wednesday, April 18, 2012

Raid Marks Drop Down Menu

So far my addon is pretty independant of blizzards ui, but I'm at the point now where I need to converge the two.

I'd like to add an extra option to the drop down menu when you pick a raid icon (skull, cross, star...) that brings up my addon's interface. I'm not sure what the frame that pops up under your target is called, or where it's hidden in the code.

I've got a hunch what I want to do has something to do with function hooking, but i'm not sure where to look. Has anyone run into this before, or could give me some guidance?

Thanks|||I think it would be easiesr to create your own frame rather than trying to call the Blizzard one since that's part of a menu.|||Sure, i can create my own frame - but i am not sure of the event that triggers showing it. "Right Clicking if your mouse is over the target and you're in a party" doesn't seem like one of the blizz UI events :-)

So i will build my own frame. But I dont know when to call it, and i also don't want blizz's frame and my frame appearing at the same time, which is why my hunch was leaning toward function hooking.|||I found that this will bring up the raid icon menu:

/script ToggleDropDownMenu(1,nil,TargetFrameDropDown,"TargetFrame",106,27)

So I know now that the frame's name that is displayed is "TargetFrameDropDown." Since this is not a function I don't think I can hook/replace it with my own. But I think there is a function that dynamically creates the drop down menu, which is likely, considering that the name of your target is at the top.

So if this script is embedded within the blizz code somewhere --

if UnitIsEnemy("player","target") then

if GetMouseFocus():GetName()=="TargetFrame" then

if GetMouseButtonClicked()=="right" then

ToggleDropDownMenuFunction()

end

end

end

function ToggleDropDownMenuFunction()

--code to create drop down menu

end

Now I dont know what function is called or how to find it. Anyone got any ideas?|||Looks like I found what I was looking for in Blizz's FrameXML files.

TargetFrame.xml >> TargetFrame.lua >> UIDropDown.lua >> UnitPopup.lua

UnitPopup.lua has values at the top.

UnitPopupButtons["RAID_TARGET_ICON"] = { text = RAID_TARGET_ICON, dist = 0, nested = 1 };

UnitPopupButtons["RAID_TARGET_1"] = { text = RAID_TARGET_1, dist = 0, checkable = 1, color = {r = 1.0, g = 0.92, b = 0}, icon = "Interface\\TargetingFrame\\UI-RaidTargetingIcons", tCoordLeft = 0, tCoordRight = 0.25, tCoordTop = 0, tCoordBottom = 0.25 };

and

UnitPopupMenus["RAID_TARGET_ICON"] = { "RAID_TARGET_1", "RAID_TARGET_2", "RAID_TARGET_3", "RAID_TARGET_4", "RAID_TARGET_5", "RAID_TARGET_6", "RAID_TARGET_7", "RAID_TARGET_8", "RAID_TARGET_NONE" };

I just added my value to UnitPopupMenus["RAID_TARGET_ICON"] list and then defined it in my addon.|||Quote:




"Right Clicking if your mouse is over the target and you're in a party" doesn't seem like one of the blizz UI events :-)




You could replicate this with a secure template.


Quote:




Since this is not a function I don't think I can hook/replace it with my own.




It should be a function, otherwise it wouldn't work in a /script command. All this command does is runs the proceeding statment as Lua.

But it looks like you solved it another way anyway.

No comments:

Post a Comment