comparison Main.lua @ 175:ac9f0ccb27a8

reputation_npc_id --> last_killed_npc_id and ClearReputationNPC --> ClearLastKilledNPC
author James D. Callahan III <jcallahan@curse.com>
date Thu, 01 Nov 2012 14:41:36 -0500
parents 7354ae12d0f1
children 48b43068e2e0
comparison
equal deleted inserted replaced
174:85243603b34c 175:ac9f0ccb27a8
133 local durability_timer_handle 133 local durability_timer_handle
134 local faction_standings = {} 134 local faction_standings = {}
135 local forge_spell_ids = {} 135 local forge_spell_ids = {}
136 local languages_known = {} 136 local languages_known = {}
137 local name_to_id_map = {} 137 local name_to_id_map = {}
138 local reputation_npc_id 138 local last_killed_npc_id
139 local target_location_timer_handle 139 local target_location_timer_handle
140 local current_target_id 140 local current_target_id
141 local current_area_id 141 local current_area_id
142 local current_loot 142 local current_loot
143 143
274 end 274 end
275 end -- do-block 275 end -- do-block
276 276
277 277
278 -- Called on a timer 278 -- Called on a timer
279 local function ClearReputationNPC() 279 local function ClearLastKilledNPC()
280 Debug("Clearing reputation_npc_id") 280 Debug("Clearing last_killed_npc_id")
281 reputation_npc_id = nil 281 last_killed_npc_id = nil
282 end 282 end
283 283
284 284
285 local function InstanceDifficultyToken() 285 local function InstanceDifficultyToken()
286 local _, instance_type, instance_difficulty, difficulty_name, _, _, is_dynamic = _G.GetInstanceInfo() 286 local _, instance_type, instance_difficulty, difficulty_name, _, _, is_dynamic = _G.GetInstanceInfo()
1130 return 1130 return
1131 end 1131 end
1132 local unit_type, unit_idnum = ParseGUID(dest_guid) 1132 local unit_type, unit_idnum = ParseGUID(dest_guid)
1133 1133
1134 if not unit_idnum or not UnitTypeIsNPC(unit_type) then 1134 if not unit_idnum or not UnitTypeIsNPC(unit_type) then
1135 reputation_npc_id = nil 1135 last_killed_npc_id = nil
1136 private.harvesting = nil 1136 private.harvesting = nil
1137 return 1137 return
1138 end 1138 end
1139 reputation_npc_id = unit_idnum 1139 last_killed_npc_id = unit_idnum
1140 WDP:ScheduleTimer(ClearReputationNPC, 0.1) 1140 WDP:ScheduleTimer(ClearLastKilledNPC, 0.1)
1141 end, 1141 end,
1142 } 1142 }
1143 1143
1144 1144
1145 function WDP:COMBAT_LOG_EVENT_UNFILTERED(event_name, time_stamp, sub_event, hide_caster, source_guid, source_name, source_flags, source_raid_flags, dest_guid, dest_name, dest_flags, dest_raid_flags, ...) 1145 function WDP:COMBAT_LOG_EVENT_UNFILTERED(event_name, time_stamp, sub_event, hide_caster, source_guid, source_name, source_flags, source_raid_flags, dest_guid, dest_name, dest_flags, dest_raid_flags, ...)
1216 } 1216 }
1217 } 1217 }
1218 1218
1219 1219
1220 function WDP:COMBAT_TEXT_UPDATE(event_name, message_type, faction_name, amount) 1220 function WDP:COMBAT_TEXT_UPDATE(event_name, message_type, faction_name, amount)
1221 if message_type ~= "FACTION" or not reputation_npc_id then 1221 if message_type ~= "FACTION" or not last_killed_npc_id then
1222 return 1222 return
1223 end 1223 end
1224 UpdateFactionData() 1224 UpdateFactionData()
1225 1225
1226 if not faction_name or not faction_standings[faction_name] then 1226 if not faction_name or not faction_standings[faction_name] then
1227 return 1227 return
1228 end 1228 end
1229 local npc = NPCEntry(reputation_npc_id) 1229 local npc = NPCEntry(last_killed_npc_id)
1230 reputation_npc_id = nil 1230 last_killed_npc_id = nil
1231 1231
1232 if not npc then 1232 if not npc then
1233 private.harvesting = nil 1233 private.harvesting = nil
1234 return 1234 return
1235 end 1235 end
1767 1767
1768 if ALLOWED_LOCALES[CLIENT_LOCALE] then 1768 if ALLOWED_LOCALES[CLIENT_LOCALE] then
1769 quest.reward_text = ReplaceKeywords(_G.GetRewardText()) 1769 quest.reward_text = ReplaceKeywords(_G.GetRewardText())
1770 end 1770 end
1771 -- Make sure the quest NPC isn't erroneously recorded as giving reputation for quests which award it. 1771 -- Make sure the quest NPC isn't erroneously recorded as giving reputation for quests which award it.
1772 reputation_npc_id = nil 1772 last_killed_npc_id = nil
1773 end 1773 end
1774 1774
1775 1775
1776 function WDP:QUEST_DETAIL(event_name) 1776 function WDP:QUEST_DETAIL(event_name)
1777 local quest = UpdateQuestJuncture("begin") 1777 local quest = UpdateQuestJuncture("begin")
1998 end 1998 end
1999 private.tracked_line = nil 1999 private.tracked_line = nil
2000 private.previous_spell_id = spell_id 2000 private.previous_spell_id = spell_id
2001 2001
2002 if spell_name:match("^Harvest.+") then 2002 if spell_name:match("^Harvest.+") then
2003 reputation_npc_id = current_target_id 2003 last_killed_npc_id = current_target_id
2004 private.harvesting = true 2004 private.harvesting = true
2005 end 2005 end
2006 2006
2007 if anvil_spell_ids[spell_id] then 2007 if anvil_spell_ids[spell_id] then
2008 UpdateDBEntryLocation("objects", OBJECT_ID_ANVIL) 2008 UpdateDBEntryLocation("objects", OBJECT_ID_ANVIL)