Mercurial > wow > wowdb-profiler
comparison Main.lua @ 366:7e7d57948295
Removed disable statement since 6.0.2 is on all servers now and localized three frequently used global constants.
author | MMOSimca <MMOSimca@gmail.com> |
---|---|
date | Sun, 19 Oct 2014 07:33:07 -0400 |
parents | f8190e012c92 |
children | 1dc56d8e1260 |
comparison
equal
deleted
inserted
replaced
365:fa5fe41ca48e | 366:7e7d57948295 |
---|---|
11 local table = _G.table | 11 local table = _G.table |
12 | 12 |
13 local next = _G.next | 13 local next = _G.next |
14 local select = _G.select | 14 local select = _G.select |
15 local unpack = _G.unpack | 15 local unpack = _G.unpack |
16 | |
17 local LOOT_SLOT_CURRENCY, LOOT_SLOT_ITEM, LOOT_SLOT_MONEY = _G.LOOT_SLOT_CURRENCY, _G.LOOT_SLOT_ITEM, _G.LOOT_SLOT_MONEY | |
16 | 18 |
17 | 19 |
18 -- ADDON NAMESPACE ---------------------------------------------------- | 20 -- ADDON NAMESPACE ---------------------------------------------------- |
19 | 21 |
20 local ADDON_NAME, private = ... | 22 local ADDON_NAME, private = ... |
896 char_db = db.char | 898 char_db = db.char |
897 | 899 |
898 local raw_db = _G.WoWDBProfilerData | 900 local raw_db = _G.WoWDBProfilerData |
899 local build_num = tonumber(private.build_num) | 901 local build_num = tonumber(private.build_num) |
900 | 902 |
901 -- Disable if using a MoP build | |
902 if build_num < 19000 then | |
903 WDP:Disable() | |
904 return | |
905 end | |
906 | |
907 if (raw_db.version and raw_db.version < DB_VERSION) or (raw_db.build_num and raw_db.build_num < build_num) then | 903 if (raw_db.version and raw_db.version < DB_VERSION) or (raw_db.build_num and raw_db.build_num < build_num) then |
908 for entry in pairs(DATABASE_DEFAULTS.global) do | 904 for entry in pairs(DATABASE_DEFAULTS.global) do |
909 global_db[entry] = {} | 905 global_db[entry] = {} |
910 end | 906 end |
911 end | 907 end |
2058 loot_quantity = slot_quantity | 2054 loot_quantity = slot_quantity |
2059 end | 2055 end |
2060 local source_type, source_id = ParseGUID(source_guid) | 2056 local source_type, source_id = ParseGUID(source_guid) |
2061 local source_key = ("%s:%d"):format(source_type, source_id) | 2057 local source_key = ("%s:%d"):format(source_type, source_id) |
2062 | 2058 |
2063 if slot_type == _G.LOOT_SLOT_ITEM then | 2059 if slot_type == LOOT_SLOT_ITEM then |
2064 local item_id = ItemLinkToID(_G.GetLootSlotLink(loot_slot)) | 2060 local item_id = ItemLinkToID(_G.GetLootSlotLink(loot_slot)) |
2065 Debug("GUID: %s - Type:ID: %s - ItemID: %d - Amount: %d (%d)", loot_info[loot_index], source_key, item_id, loot_info[loot_index + 1], slot_quantity) | 2061 Debug("GUID: %s - Type:ID: %s - ItemID: %d - Amount: %d (%d)", loot_info[loot_index], source_key, item_id, loot_info[loot_index + 1], slot_quantity) |
2066 current_loot.sources[source_guid] = current_loot.sources[source_guid] or {} | 2062 current_loot.sources[source_guid] = current_loot.sources[source_guid] or {} |
2067 current_loot.sources[source_guid][item_id] = current_loot.sources[source_guid][item_id] or 0 + loot_quantity | 2063 current_loot.sources[source_guid][item_id] = current_loot.sources[source_guid][item_id] or 0 + loot_quantity |
2068 guids_used[source_guid] = true | 2064 guids_used[source_guid] = true |
2069 elseif slot_type == _G.LOOT_SLOT_MONEY then | 2065 elseif slot_type == LOOT_SLOT_MONEY then |
2070 Debug("GUID: %s - Type:ID: %s - Money - Amount: %d (%d)", loot_info[loot_index], source_key, loot_info[loot_index + 1], slot_quantity) | 2066 Debug("GUID: %s - Type:ID: %s - Money - Amount: %d (%d)", loot_info[loot_index], source_key, loot_info[loot_index + 1], slot_quantity) |
2071 if current_loot.target_type == AF.ZONE then | 2067 if current_loot.target_type == AF.ZONE then |
2072 table.insert(current_loot.list, ("money:%d"):format(loot_quantity)) | 2068 table.insert(current_loot.list, ("money:%d"):format(loot_quantity)) |
2073 else | 2069 else |
2074 current_loot.sources[source_guid] = current_loot.sources[source_guid] or {} | 2070 current_loot.sources[source_guid] = current_loot.sources[source_guid] or {} |
2075 current_loot.sources[source_guid]["money"] = current_loot.sources[source_guid]["money"] or 0 + loot_quantity | 2071 current_loot.sources[source_guid]["money"] = current_loot.sources[source_guid]["money"] or 0 + loot_quantity |
2076 guids_used[source_guid] = true | 2072 guids_used[source_guid] = true |
2077 end | 2073 end |
2078 elseif slot_type == _G.LOOT_SLOT_CURRENCY then | 2074 elseif slot_type == LOOT_SLOT_CURRENCY then |
2079 -- Same bug with GetLootSlotInfo() will screw up currency when it happens, so we won't process this slot's loot. | 2075 -- Same bug with GetLootSlotInfo() will screw up currency when it happens, so we won't process this slot's loot. |
2080 if icon_texture then | 2076 if icon_texture then |
2081 Debug("GUID: %s - Type:ID: %s - Currency: %s - Amount: %d (%d)", loot_info[loot_index], source_key, icon_texture, loot_info[loot_index + 1], slot_quantity) | 2077 Debug("GUID: %s - Type:ID: %s - Currency: %s - Amount: %d (%d)", loot_info[loot_index], source_key, icon_texture, loot_info[loot_index + 1], slot_quantity) |
2082 if current_loot.target_type == AF.ZONE then | 2078 if current_loot.target_type == AF.ZONE then |
2083 table.insert(current_loot.list, ("currency:%d:%s"):format(loot_quantity, icon_texture:match("[^\\]+$"):lower())) | 2079 table.insert(current_loot.list, ("currency:%d:%s"):format(loot_quantity, icon_texture:match("[^\\]+$"):lower())) |