Thread Tools Display Modes
05-08-09, 02:54 AM   #1
Soeters
A Warpwood Thunder Caller
 
Soeters's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 97
Achievement broadcast hook

I'm trying to make my addon Ontario modify the blizzard achievement broadcast instead of printing a new line.
I've searched in AchievementUI.lua from WowCompares but I couldn't find the broadcast function which prints the ACHIEVEMENT_BROADCAST or ACHIEVEMENT_BROADCAST_SELF function.

Does anyone know either the broadcast function, or another way to modify the global string to add the points the achievement provides.
__________________
  Reply With Quote
05-08-09, 03:56 AM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,935
Wowwiki.com has a list here : http://www.wowwiki.com/Events/Achievements.

A little playing around with the code should help you track down the exact one you want but whether any of them also hold the amount for either that achievement or a total figure I don't know.
  Reply With Quote
05-08-09, 06:34 AM   #3
Soeters
A Warpwood Thunder Caller
 
Soeters's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 97
Thanks I didn't think to events.

Now I only have to do some work around those events with patterns to retrieve the achivement name so that I can get his points.
I think I can do something with that function ChatFrame_MessageEventHandler(self, event, ...) but I don't know if it's protected or not.
__________________
  Reply With Quote
05-08-09, 10:44 AM   #4
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,935
Here's some minimal code that may help you get the gist of it. Bear in mind I write my addons without xml files so they're pure lua.

Feel free to download my CatchAndPlay addon which is the smallest one I have that checks the events and outputs the result. You should be able to see what I did with that and thus how you can implement your own addon for this purpose.


Code:
local function MyAddon_ExtractAchievementDetails(self,...)
     local firstArgument = select(1,...);
     local secondArgument = select(2,...);

     or

     local firstArgument, secondArgument = select(1,...);

     print(firstArgument);
     print(secondArgument);



end

-- Load any variables and display welcome message
local function MyAddon_LoadVariables(self)
             -- Do Stuff Here to Prepare the Addon
       	self:UnregisterEvent("VARIABLES_LOADED");
end

-- Track Events as required
local function MyAddon_OnEvent(self,event,...)
        if ( event == "VARIABLES_LOADED" ) then 
                MyAddon_LoadVariables(self);
        elseif ( event == "CHAT_MSG_ACHIEVEMENT" ) then
                MyAddon_ExtractAchievementDetails(self,...);
        end
end

-- Register Events and make EventFrame
frame = CreateFrame("Frame","DescriptiveFrameName",UIParent);
frame:RegisterEvent("VARIABLES_LOADED");
frame:RegisterEvent("CHAT_MSG_ACHIEVEMENT);
frame:SetScript("OnEvent",MyAddon_OnEvent);
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Achievement broadcast hook


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