# HG changeset patch # User James D. Callahan III # Date 1343926604 18000 # Node ID 8cbb3d7b85223768ed191b25a7ccc887dafc1828 # Parent e84a1e960bed2efa693da5eca9ef7bdc89a8c136 Renamed dead_npc_id to reputation_npc_id for clarity, and set it to nil when QUEST_COMPLETE fires so quest NPCs aren't attributed. diff -r e84a1e960bed -r 8cbb3d7b8522 Main.lua --- a/Main.lua Mon Jul 30 09:50:44 2012 -0500 +++ b/Main.lua Thu Aug 02 11:56:44 2012 -0500 @@ -28,7 +28,7 @@ ----------------------------------------------------------------------- -- Local constants. ----------------------------------------------------------------------- -local DB_VERSION = 1 +local DB_VERSION = 3 local DATABASE_DEFAULTS = { global = { @@ -82,6 +82,7 @@ local action_data = {} local currently_drunk local faction_standings = {} +local reputation_npc_id ----------------------------------------------------------------------- @@ -581,9 +582,6 @@ local FLAGS_NPC = bit.bor(_G.COMBATLOG_OBJECT_TYPE_GUARDIAN, _G.COMBATLOG_OBJECT_CONTROL_NPC) local FLAGS_NPC_CONTROL = bit.bor(_G.COMBATLOG_OBJECT_AFFILIATION_OUTSIDER, _G.COMBATLOG_OBJECT_CONTROL_NPC) - -- This is used to record faction gains - local dead_npc_id - local function RecordNPCSpell(sub_event, source_guid, source_name, source_flags, dest_guid, dest_name, dest_flags, spell_id, spell_name) if not spell_id then return @@ -609,10 +607,10 @@ local unit_type, unit_idnum = ParseGUID(dest_guid) if unit_type ~= private.UNIT_TYPES.NPC or not unit_idnum then - dead_npc_id = nil + reputation_npc_id = nil return end - dead_npc_id = unit_idnum + reputation_npc_id = unit_idnum end, } @@ -693,7 +691,7 @@ function WDP:COMBAT_TEXT_UPDATE(event, message_type, faction_name, amount) - if message_type ~= "FACTION" or not dead_npc_id then + if message_type ~= "FACTION" or not reputation_npc_id then return end UpdateFactionData() @@ -701,7 +699,7 @@ if not faction_name or not faction_standings[faction_name] then return end - local npc = NPCEntry(dead_npc_id) + local npc = NPCEntry(reputation_npc_id) if not npc then return @@ -729,6 +727,7 @@ end npc.reputations = npc.reputations or {} npc.reputations[("%s:%s"):format(faction_name, faction_standings[faction_name])] = math.floor(amount / modifier) + reputation_npc_id = nil end end -- do-block @@ -1084,6 +1083,8 @@ function WDP:QUEST_COMPLETE() + -- Make sure the quest NPC isn't erroneously recorded as giving reputation for quests which award it. + reputation_npc_id = nil UpdateQuestJuncture("end") end