Mercurial > wow > wowdb-profiler
comparison Main.lua @ 304:1e55a8ebedbd
Fixed double-counting for loot in items.
author | James D. Callahan III <jcallahan@curse.com> |
---|---|
date | Mon, 08 Jul 2013 13:26:23 -0500 |
parents | e54e370e3a01 |
children | 4986ef8a338a |
comparison
equal
deleted
inserted
replaced
303:e54e370e3a01 | 304:1e55a8ebedbd |
---|---|
592 local loot_count = ("%s_count"):format(loot_type) | 592 local loot_count = ("%s_count"):format(loot_type) |
593 local source_list = {} | 593 local source_list = {} |
594 | 594 |
595 if current_loot.sources then | 595 if current_loot.sources then |
596 for source_guid, loot_data in pairs(current_loot.sources) do | 596 for source_guid, loot_data in pairs(current_loot.sources) do |
597 local entry, source_id | 597 local source_id |
598 | 598 |
599 if current_loot.target_type == AF.ITEM then | 599 if current_loot.target_type == AF.ITEM then |
600 -- Items return the player as the source, so we need to use the item's ID (disenchant, milling, etc) | 600 -- Items return the player as the source, so we need to use the item's ID (disenchant, milling, etc) |
601 source_id = current_loot.identifier | 601 source_id = current_loot.identifier |
602 entry = DBEntry(data_type, source_id) | |
603 elseif current_loot.target_type == AF.OBJECT then | 602 elseif current_loot.target_type == AF.OBJECT then |
604 source_id = ("%s:%s"):format(current_loot.spell_label, select(2, ParseGUID(source_guid))) | 603 source_id = ("%s:%s"):format(current_loot.spell_label, select(2, ParseGUID(source_guid))) |
605 entry = DBEntry(data_type, source_id) | |
606 else | 604 else |
607 source_id = select(2, ParseGUID(source_guid)) | 605 source_id = select(2, ParseGUID(source_guid)) |
608 entry = DBEntry(data_type, source_id) | |
609 end | 606 end |
607 local entry = DBEntry(data_type, source_id) | |
610 | 608 |
611 if entry then | 609 if entry then |
612 local loot_table = LootTable(entry, loot_type, top_field) | 610 local loot_table = LootTable(entry, loot_type, top_field) |
613 | 611 |
614 if not source_list[source_guid] then | 612 if not source_list[source_id] then |
615 if top_field then | 613 if top_field then |
616 entry[top_field][loot_count] = (entry[top_field][loot_count] or 0) + 1 | 614 entry[top_field][loot_count] = (entry[top_field][loot_count] or 0) + 1 |
617 else | 615 else |
618 entry[loot_count] = (entry[loot_count] or 0) + 1 | 616 entry[loot_count] = (entry[loot_count] or 0) + 1 |
619 end | 617 end |
620 source_list[source_guid] = true | 618 source_list[source_id] = true |
621 end | 619 end |
622 UpdateDBEntryLocation(data_type, source_id) | 620 UpdateDBEntryLocation(data_type, source_id) |
623 | 621 |
624 for item_id, quantity in pairs(loot_data) do | 622 for item_id, quantity in pairs(loot_data) do |
625 table.insert(loot_table, ("%d:%d"):format(item_id, quantity)) | 623 table.insert(loot_table, ("%d:%d"):format(item_id, quantity)) |
650 if top_field then | 648 if top_field then |
651 entry[top_field][loot_count] = (entry[top_field][loot_count] or 0) + 1 | 649 entry[top_field][loot_count] = (entry[top_field][loot_count] or 0) + 1 |
652 else | 650 else |
653 entry[loot_count] = (entry[loot_count] or 0) + 1 | 651 entry[loot_count] = (entry[loot_count] or 0) + 1 |
654 end | 652 end |
653 source_list[current_loot.identifier] = true | |
655 end | 654 end |
656 | 655 |
657 for index = 1, #current_loot.list do | 656 for index = 1, #current_loot.list do |
658 table.insert(loot_table, current_loot.list[index]) | 657 table.insert(loot_table, current_loot.list[index]) |
659 end | 658 end |