Mercurial > wow > wowdb-profiler
comparison Main.lua @ 86:9be5fc389c13
Don't ignore headers in the faction list - they can be legitimate faction names. Small farming tweaks.
| author | James D. Callahan III <jcallahan@curse.com> |
|---|---|
| date | Mon, 27 Aug 2012 11:20:05 -0500 |
| parents | e2b741356fc9 |
| children | 2ab6c802b485 |
comparison
equal
deleted
inserted
replaced
| 85:e2b741356fc9 | 86:9be5fc389c13 |
|---|---|
| 88 local target_location_timer_handle | 88 local target_location_timer_handle |
| 89 local action_data = {} | 89 local action_data = {} |
| 90 local currently_drunk | 90 local currently_drunk |
| 91 local faction_standings = {} | 91 local faction_standings = {} |
| 92 local reputation_npc_id | 92 local reputation_npc_id |
| 93 | 93 local current_target_id |
| 94 | 94 |
| 95 ----------------------------------------------------------------------- | 95 ----------------------------------------------------------------------- |
| 96 -- Helper Functions. | 96 -- Helper Functions. |
| 97 ----------------------------------------------------------------------- | 97 ----------------------------------------------------------------------- |
| 98 local ActualCopperCost | 98 local ActualCopperCost |
| 371 | 371 |
| 372 function UpdateFactionData() | 372 function UpdateFactionData() |
| 373 for faction_index = 1, MAX_FACTION_INDEX do | 373 for faction_index = 1, MAX_FACTION_INDEX do |
| 374 local faction_name, _, current_standing, _, _, _, _, _, is_header = _G.GetFactionInfo(faction_index) | 374 local faction_name, _, current_standing, _, _, _, _, _, is_header = _G.GetFactionInfo(faction_index) |
| 375 | 375 |
| 376 if faction_name and not is_header then | 376 if faction_name then |
| 377 faction_standings[faction_name] = STANDING_NAMES[current_standing] | 377 faction_standings[faction_name] = STANDING_NAMES[current_standing] |
| 378 elseif not faction_name then | 378 elseif not faction_name then |
| 379 break | 379 break |
| 380 end | 380 end |
| 381 end | 381 end |
| 1155 } | 1155 } |
| 1156 | 1156 |
| 1157 | 1157 |
| 1158 function WDP:PLAYER_TARGET_CHANGED() | 1158 function WDP:PLAYER_TARGET_CHANGED() |
| 1159 if not _G.UnitExists("target") or _G.UnitPlayerControlled("target") or currently_drunk then | 1159 if not _G.UnitExists("target") or _G.UnitPlayerControlled("target") or currently_drunk then |
| 1160 current_target_id = nil | |
| 1160 return | 1161 return |
| 1161 end | 1162 end |
| 1162 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("target")) | 1163 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("target")) |
| 1163 | 1164 |
| 1164 if unit_type ~= private.UNIT_TYPES.NPC or not unit_idnum then | 1165 if unit_type ~= private.UNIT_TYPES.NPC or not unit_idnum then |
| 1165 return | 1166 return |
| 1166 end | 1167 end |
| 1168 current_target_id = unit_idnum | |
| 1169 | |
| 1167 local npc = NPCEntry(unit_idnum) | 1170 local npc = NPCEntry(unit_idnum) |
| 1168 local _, class_token = _G.UnitClass("target") | 1171 local _, class_token = _G.UnitClass("target") |
| 1169 npc.class = class_token | 1172 npc.class = class_token |
| 1170 npc.faction = UnitFactionStanding("target") | 1173 npc.faction = UnitFactionStanding("target") |
| 1171 npc.genders = npc.genders or {} | 1174 npc.genders = npc.genders or {} |
| 1190 end | 1193 end |
| 1191 table.wipe(action_data) | 1194 table.wipe(action_data) |
| 1192 action_data.type = AF.NPC | 1195 action_data.type = AF.NPC |
| 1193 action_data.identifier = unit_idnum | 1196 action_data.identifier = unit_idnum |
| 1194 action_data.npc_level = npc_level | 1197 action_data.npc_level = npc_level |
| 1195 | |
| 1196 self:UpdateTargetLocation() | 1198 self:UpdateTargetLocation() |
| 1197 end | 1199 end |
| 1198 end -- do-block | 1200 end -- do-block |
| 1199 | 1201 |
| 1200 do | 1202 do |
| 1391 end | 1393 end |
| 1392 end | 1394 end |
| 1393 private.tracked_line = spell_line | 1395 private.tracked_line = spell_line |
| 1394 end | 1396 end |
| 1395 | 1397 |
| 1396 | |
| 1397 function WDP:UNIT_SPELLCAST_SUCCEEDED(event_name, unit_id, spell_name, spell_rank, spell_line, spell_id) | 1398 function WDP:UNIT_SPELLCAST_SUCCEEDED(event_name, unit_id, spell_name, spell_rank, spell_line, spell_id) |
| 1398 if unit_id ~= "player" then | 1399 if unit_id ~= "player" then |
| 1399 return | 1400 return |
| 1400 end | 1401 end |
| 1401 private.tracked_line = nil | 1402 private.tracked_line = nil |
| 1402 | 1403 |
| 1403 if spell_name:match("^Harvest") then | 1404 if spell_name:match("^Harvest.+") then |
| 1404 reputation_npc_id = action_data.identifier | 1405 reputation_npc_id = current_target_id |
| 1405 end | 1406 end |
| 1406 end | 1407 end |
| 1407 | 1408 |
| 1408 function WDP:HandleSpellFailure(event_name, unit_id, spell_name, spell_rank, spell_line, spell_id) | 1409 function WDP:HandleSpellFailure(event_name, unit_id, spell_name, spell_rank, spell_line, spell_id) |
| 1409 if unit_id ~= "player" then | 1410 if unit_id ~= "player" then |
