View Single Post
06-23-09, 01:02 PM   #26
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
I removed a debugging thing and comment that I forgot to delete before, and added the "start of quest timer" stuff to what you posted.

Code:
local me = CreateFrame("Frame")

me:RegisterEvent("CHAT_MSG_MONSTER_EMOTE")
me:RegisterEvent("CHAT_MSG_MONSTER_SAY")
me:RegisterEvent("CHAT_MSG_MONSTER_WHISPER")
me:RegisterEvent("QUEST_LOG_UPDATE")

me.listOfNames = {
     {"Ringo", "Yo! The goblin has fainted, throw some water on him, quick!!"},
     {"Kerlonian Evershade", "Darn it!  That lazy druid has fallen asleep again, time to use the horn!!!"},
     {"Shay", "That dippy night elf girl is chasing butterflies again, better ring the bell and call her back."},
     {"A-Me 01", "The suicidal ape robot is charging off into the fray again, go defend her!"},
     --etc
}

function me.EventHandler(self, event, _, name)
      if event == "QUEST_LOG_UPDATE" then
           me.Time = time()
           return
      end
      for i = 1, #self.listOfNames do
           if name:find(self.listOfNames[i][1]) then
               -- only one warning per 10 seconds
               if (not me.Time) or (time() - me.Time > 10) then
                    me.Time = time()
                    PlaySound("RaidWarning")
                    local msg = self.listOfNames[i][2] or "Heads Up!  Your quest NPC needs help!!!"
                    RaidNotice_AddMessage(RaidWarningFrame, msg, ChatTypeInfo["RAID_WARNING"])
                    return
               end
           end
      end
end

me:SetScript("OnEvent", me.EventHandler)

Last edited by Akryn : 06-23-09 at 01:08 PM.
  Reply With Quote