Mercurial > wow > wowdb-profiler
comparison Main.lua @ 187:e4d0f924af08 1.0.24
Added recording of item upgrade IDs.
author | James D. Callahan III <jcallahan@curse.com> |
---|---|
date | Wed, 14 Nov 2012 14:45:41 -0600 |
parents | 5117c75a47cb |
children | 35c95e0bce3f |
comparison
equal
deleted
inserted
replaced
186:88d74e7b51ce | 187:e4d0f924af08 |
---|---|
129 ----------------------------------------------------------------------- | 129 ----------------------------------------------------------------------- |
130 local anvil_spell_ids = {} | 130 local anvil_spell_ids = {} |
131 local currently_drunk | 131 local currently_drunk |
132 local char_db | 132 local char_db |
133 local global_db | 133 local global_db |
134 local durability_timer_handle | 134 local item_process_timer_handle |
135 local faction_standings = {} | 135 local faction_standings = {} |
136 local forge_spell_ids = {} | 136 local forge_spell_ids = {} |
137 local languages_known = {} | 137 local languages_known = {} |
138 local name_to_id_map = {} | 138 local name_to_id_map = {} |
139 local killed_npc_id | 139 local killed_npc_id |
310 return | 310 return |
311 end | 311 end |
312 local unit = global_db[data_type][unit_id] | 312 local unit = global_db[data_type][unit_id] |
313 | 313 |
314 if not unit then | 314 if not unit then |
315 global_db[data_type][unit_id] = {} | 315 unit = {} |
316 unit = global_db[data_type][unit_id] | 316 global_db[data_type][unit_id] = unit |
317 end | 317 end |
318 return unit | 318 return unit |
319 end | 319 end |
320 | 320 |
321 | 321 |
777 end | 777 end |
778 | 778 |
779 for index = 1, _G.GetNumLanguages() do | 779 for index = 1, _G.GetNumLanguages() do |
780 languages_known[_G.GetLanguageByIndex(index)] = true | 780 languages_known[_G.GetLanguageByIndex(index)] = true |
781 end | 781 end |
782 durability_timer_handle = self:ScheduleRepeatingTimer("ProcessDurability", 30) | 782 item_process_timer_handle = self:ScheduleRepeatingTimer("ProcessItems", 30) |
783 target_location_timer_handle = self:ScheduleRepeatingTimer("UpdateTargetLocation", 0.5) | 783 target_location_timer_handle = self:ScheduleRepeatingTimer("UpdateTargetLocation", 0.5) |
784 | 784 |
785 _G.hooksecurefunc("UseContainerItem", function(bag_index, slot_index, target_unit) | 785 _G.hooksecurefunc("UseContainerItem", function(bag_index, slot_index, target_unit) |
786 if target_unit then | 786 if target_unit then |
787 return | 787 return |
803 | 803 |
804 UpdateBlacklistMaps() | 804 UpdateBlacklistMaps() |
805 end | 805 end |
806 | 806 |
807 | 807 |
808 local function RecordDurability(item_id, durability) | 808 local function RecordItemData(item_id, item_link, durability) |
809 if not durability or durability <= 0 then | 809 if not durability or durability <= 0 then |
810 return | 810 return |
811 end | 811 end |
812 | 812 local item = DBEntry("items", item_id) |
813 if not global_db.items[item_id] then | 813 local _, _, _, _, _, _, _, _, _, _, _, upgrade_id = (":"):split(select(3, item_link:find("^|%x+|H(.+)|h%[.+%]"))) |
814 global_db.items[item_id] = {} | 814 |
815 end | 815 if upgrade_id then |
816 global_db.items[item_id].durability = durability | 816 DBEntry("items", item_id).upgrade_id = upgrade_id |
817 end | 817 end |
818 | 818 item.durability = durability |
819 | 819 end |
820 function WDP:ProcessDurability() | 820 |
821 for slot_index = 0, _G.INVSLOT_LAST_EQUIPPED do | 821 |
822 function WDP:ProcessItems() | |
823 for slot_index = _G.INVSLOT_FIRST_EQUIPPED, _G.INVSLOT_LAST_EQUIPPED do | |
822 local item_id = _G.GetInventoryItemID("player", slot_index) | 824 local item_id = _G.GetInventoryItemID("player", slot_index) |
823 | 825 |
824 if item_id and item_id > 0 then | 826 if item_id and item_id > 0 then |
825 local _, max_durability = _G.GetInventoryItemDurability(slot_index) | 827 local _, max_durability = _G.GetInventoryItemDurability(slot_index) |
826 RecordDurability(item_id, max_durability) | 828 RecordItemData(item_id, _G.GetInventoryItemLink("player", slot_index), max_durability) |
827 end | 829 end |
828 end | 830 end |
829 | 831 |
830 for bag_index = 0, _G.NUM_BAG_SLOTS do | 832 for bag_index = 0, _G.NUM_BAG_SLOTS do |
831 for slot_index = 1, _G.GetContainerNumSlots(bag_index) do | 833 for slot_index = 1, _G.GetContainerNumSlots(bag_index) do |
832 local item_id = _G.GetContainerItemID(bag_index, slot_index) | 834 local item_id = _G.GetContainerItemID(bag_index, slot_index) |
833 | 835 |
834 if item_id and item_id > 0 then | 836 if item_id and item_id > 0 then |
835 local _, max_durability = _G.GetContainerItemDurability(bag_index, slot_index) | 837 local _, max_durability = _G.GetContainerItemDurability(bag_index, slot_index) |
836 RecordDurability(item_id, max_durability) | 838 RecordItemData(item_id, _G.GetContainerItemLink(bag_index, slot_index), max_durability) |
837 end | 839 end |
838 end | 840 end |
839 end | 841 end |
840 end | 842 end |
841 | 843 |