Originally Posted by SDPhantom
Here's an example I came up with. It's based off how ReputationFrame updates and keeps track of rep by ID to avoid name collisions.
Lua Code:
local TrackedFactions={}; local EventFrame=CreateFrame("Frame"); EventFrame:RegisterEvent("PLAYER_LOGIN");-- Player login EventFrame:RegisterEvent("UPDATE_FACTION");-- Kill rep EventFrame:RegisterEvent("QUEST_LOG_UPDATE");-- Quest rep EventFrame:SetScript("OnEvent",function() for i=1,GetNumFactions() do local _,_,newstanding,_,_,_,_,_,_,_,hasrep,_,_,faction=GetFactionInfo(i); if hasrep and faction and (newstanding or 0)>0 then-- Make sure we have the info we need and standing isn't UNKNOWN (0) local oldstanding=TrackedFactions[faction]; if oldstanding and oldstanding<newstanding then-- Check if standing went up (allow same code to initialize tracking) PlaySoundFile("Interface\\AddOns\\YourAddOn\\YourSoundFile.ogg"); end TrackedFactions[faction]=newstanding;-- Update standing end end end);
|
Just tested this and no dice. I'll test it again in a bit just to be doubly sure, maybe I did something wrong.