Mercurial > wow > wowdb-profiler
comparison Main.lua @ 132:05b77c08b211
Simplification for loot labels. Set target type for loot to NPC if none is listed on the current action, since the only reason it would be otherwise is via a spell.
author | James D. Callahan III <jcallahan@curse.com> |
---|---|
date | Fri, 21 Sep 2012 12:00:26 -0500 |
parents | 35da36cc87f0 |
children | a6e36b3f51d6 |
comparison
equal
deleted
inserted
replaced
131:35da36cc87f0 | 132:05b77c08b211 |
---|---|
439 entry[loot_type] = entry[loot_type] or {} | 439 entry[loot_type] = entry[loot_type] or {} |
440 return entry[loot_type] | 440 return entry[loot_type] |
441 end | 441 end |
442 | 442 |
443 function GenericLootUpdate(data_type, top_field) | 443 function GenericLootUpdate(data_type, top_field) |
444 local loot_type = current_loot.label or "drops" | 444 local loot_type = current_loot.label |
445 local loot_count = ("%s_count"):format(loot_type) | 445 local loot_count = ("%s_count"):format(loot_type) |
446 local source_list = {} | 446 local source_list = {} |
447 | 447 |
448 if current_loot.sources then | 448 if current_loot.sources then |
449 for source_guid, loot_data in pairs(current_loot.sources) do | 449 for source_guid, loot_data in pairs(current_loot.sources) do |
793 current_loot = { | 793 current_loot = { |
794 list = { | 794 list = { |
795 ("%d:%d"):format(item_id, quantity) | 795 ("%d:%d"):format(item_id, quantity) |
796 }, | 796 }, |
797 identifier = current_action.identifier, | 797 identifier = current_action.identifier, |
798 label = current_action.loot_label, | 798 label = current_action.loot_label or "drops", |
799 map_level = current_action.map_level, | 799 map_level = current_action.map_level, |
800 object_name = current_action.object_name, | 800 object_name = current_action.object_name, |
801 spell_label = current_action.spell_label, | 801 spell_label = current_action.spell_label, |
802 target_type = current_action.target_type, | 802 target_type = current_action.target_type, |
803 x = current_action.x, | 803 x = current_action.x, |
1092 [AF.ITEM] = function() | 1092 [AF.ITEM] = function() |
1093 GenericLootUpdate("items") | 1093 GenericLootUpdate("items") |
1094 end, | 1094 end, |
1095 [AF.NPC] = function() | 1095 [AF.NPC] = function() |
1096 local difficulty_token = InstanceDifficultyToken() | 1096 local difficulty_token = InstanceDifficultyToken() |
1097 local loot_type = current_loot.label or "drops" | 1097 local loot_type = current_loot.label |
1098 local source_list = {} | 1098 local source_list = {} |
1099 | 1099 |
1100 for source_guid, loot_data in pairs(current_loot.sources) do | 1100 for source_guid, loot_data in pairs(current_loot.sources) do |
1101 local source_id = select(2, ParseGUID(source_guid)) | 1101 local source_id = select(2, ParseGUID(source_guid)) |
1102 local npc = NPCEntry(source_id) | 1102 local npc = NPCEntry(source_id) |
1148 if _G.type(current_loot.zone_data[location_token]) ~= "table" then | 1148 if _G.type(current_loot.zone_data[location_token]) ~= "table" then |
1149 current_loot.zone_data[location_token] = { | 1149 current_loot.zone_data[location_token] = { |
1150 drops = {} | 1150 drops = {} |
1151 } | 1151 } |
1152 end | 1152 end |
1153 local loot_count = ("%s_count"):format(current_loot.label or "drops") | 1153 local loot_count = ("%s_count"):format(current_loot.label) |
1154 current_loot.zone_data[location_token][loot_count] = (current_loot.zone_data[location_token][loot_count] or 0) + 1 | 1154 current_loot.zone_data[location_token][loot_count] = (current_loot.zone_data[location_token][loot_count] or 0) + 1 |
1155 | 1155 |
1156 if current_loot.sources then | 1156 if current_loot.sources then |
1157 for source_guid, loot_data in pairs(current_loot.sources) do | 1157 for source_guid, loot_data in pairs(current_loot.sources) do |
1158 for item_id, quantity in pairs(loot_data) do | 1158 for item_id, quantity in pairs(loot_data) do |
1180 table.wipe(current_action) | 1180 table.wipe(current_action) |
1181 end | 1181 end |
1182 | 1182 |
1183 | 1183 |
1184 function WDP:LOOT_OPENED(event_name) | 1184 function WDP:LOOT_OPENED(event_name) |
1185 if current_loot or not current_action.target_type then | 1185 if current_loot then |
1186 return | 1186 return |
1187 end | 1187 end |
1188 current_action.target_type = current_action.target_type or AF.NPC | |
1189 | |
1188 local verify_func = LOOT_VERIFY_FUNCS[current_action.target_type] | 1190 local verify_func = LOOT_VERIFY_FUNCS[current_action.target_type] |
1189 local update_func = LOOT_UPDATE_FUNCS[current_action.target_type] | 1191 local update_func = LOOT_UPDATE_FUNCS[current_action.target_type] |
1190 | 1192 |
1191 if not verify_func or not update_func then | 1193 if not verify_func or not update_func then |
1192 return | 1194 return |
1194 | 1196 |
1195 if _G.type(verify_func) == "function" and not verify_func() then | 1197 if _G.type(verify_func) == "function" and not verify_func() then |
1196 return | 1198 return |
1197 end | 1199 end |
1198 local guids_used = {} | 1200 local guids_used = {} |
1201 | |
1199 current_loot = { | 1202 current_loot = { |
1200 list = {}, | 1203 list = {}, |
1201 sources = {}, | 1204 sources = {}, |
1202 identifier = current_action.identifier, | 1205 identifier = current_action.identifier, |
1203 label = current_action.loot_label, | 1206 label = current_action.loot_label or "drops", |
1204 map_level = current_action.map_level, | 1207 map_level = current_action.map_level, |
1205 object_name = current_action.object_name, | 1208 object_name = current_action.object_name, |
1206 spell_label = current_action.spell_label, | 1209 spell_label = current_action.spell_label, |
1207 target_type = current_action.target_type, | 1210 target_type = current_action.target_type, |
1208 x = current_action.x, | 1211 x = current_action.x, |