Mercurial > wow > wowdb-profiler
changeset 95:c4172766561f
Record NPC says, whispers, and yells.
author | James D. Callahan III <jcallahan@curse.com> |
---|---|
date | Wed, 29 Aug 2012 15:24:29 -0500 |
parents | 75751f08d9f5 |
children | e378295b2d6f |
files | Main.lua |
diffstat | 1 files changed, 33 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/Main.lua Wed Aug 29 11:17:15 2012 -0500 +++ b/Main.lua Wed Aug 29 15:24:29 2012 -0500 @@ -50,6 +50,9 @@ BATTLEFIELDS_SHOW = true, BLACK_MARKET_ITEM_UPDATE = true, CHAT_MSG_LOOT = true, + CHAT_MSG_MONSTER_SAY = "RecordQuote", + CHAT_MSG_MONSTER_WHISPER = "RecordQuote", + CHAT_MSG_MONSTER_YELL = "RecordQuote", CHAT_MSG_SYSTEM = true, COMBAT_LOG_EVENT_UNFILTERED = true, COMBAT_TEXT_UPDATE = true, @@ -89,8 +92,10 @@ local PLAYER_CLASS = _G.select(2, _G.UnitClass("player")) local PLAYER_GUID = _G.UnitGUID("player") +local PLAYER_NAME = _G.UnitName("player") local PLAYER_RACE = _G.select(2, _G.UnitRace("player")) + ----------------------------------------------------------------------- -- Local variables. ----------------------------------------------------------------------- @@ -101,6 +106,8 @@ local durability_timer_handle local faction_standings = {} local forge_spell_ids = {} +local languages_known = {} +local name_to_id_map = {} local reputation_npc_id local target_location_timer_handle local current_target_id @@ -504,6 +511,10 @@ for event_name, mapping in pairs(EVENT_MAPPING) do self:RegisterEvent(event_name, (_G.type(mapping) ~= "boolean") and mapping or nil) end + + for index = 1, _G.GetNumLanguages() do + languages_known[_G.GetLanguageByIndex(index)] = true + end durability_timer_handle = self:ScheduleRepeatingTimer("ProcessDurability", 30) target_location_timer_handle = self:ScheduleRepeatingTimer("UpdateTargetLocation", 0.5) @@ -621,6 +632,26 @@ do + local function ReplaceName(text) + if text == PLAYER_NAME then + return "<name>" + end + end + + + function WDP:RecordQuote(event_name, message, source_name, language_name) + if not source_name or not name_to_id_map[source_name] or (language_name ~= "" and not languages_known[language_name]) then + return + end + local npc = NPCEntry(name_to_id_map[source_name]) + npc.quotes = npc.quotes or {} + npc.quotes[event_name] = npc.quotes[event_name] or {} + npc.quotes[event_name][message:gsub("(%w+)", ReplaceName)] = true + end +end -- do-block + + +do local SOBER_MATCH = _G.DRUNK_MESSAGE_ITEM_SELF1:gsub("%%s", ".+") local DRUNK_COMPARES = { @@ -1233,6 +1264,8 @@ encounter_data[npc_level].power = ("%s:%d"):format(POWER_TYPE_NAMES[_G.tostring(power_type)] or power_type, max_power) end end + name_to_id_map[_G.UnitName("target")] = unit_idnum + table.wipe(action_data) action_data.type = AF.NPC action_data.identifier = unit_idnum