Mercurial > wow > wowdb-profiler
comparison Main.lua @ 463:1136b1bc88a1
Patch 7.0.3 build 21414 fixes. Blizzard changed the returns of GetLootSlotInfo, but they also finally repaired GetLootSlotLink to work for currency.
author | Caleb Atherton <catherton@curse.com> |
---|---|
date | Fri, 22 Apr 2016 02:34:12 -0400 |
parents | 94e59c64a328 |
children | 6e78d7849ea3 |
comparison
equal
deleted
inserted
replaced
462:94e59c64a328 | 463:1136b1bc88a1 |
---|---|
2225 | 2225 |
2226 InitializeCurrentLoot() | 2226 InitializeCurrentLoot() |
2227 loot_guid_registry[current_loot.label] = loot_guid_registry[current_loot.label] or {} | 2227 loot_guid_registry[current_loot.label] = loot_guid_registry[current_loot.label] or {} |
2228 | 2228 |
2229 for loot_slot = 1, _G.GetNumLootItems() do | 2229 for loot_slot = 1, _G.GetNumLootItems() do |
2230 local icon_texture, item_text, slot_quantity, quality, locked = _G.GetLootSlotInfo(loot_slot) | 2230 local texturefiledataID, item_text, slot_quantity, quality, locked = _G.GetLootSlotInfo(loot_slot) |
2231 local slot_type = _G.GetLootSlotType(loot_slot) | 2231 local slot_type = _G.GetLootSlotType(loot_slot) |
2232 local loot_info = { | 2232 local loot_info = { _G.GetLootSourceInfo(loot_slot) } |
2233 _G.GetLootSourceInfo(loot_slot) | 2233 local loot_link = _G.GetLootSlotLink(loot_slot) |
2234 } | |
2235 | 2234 |
2236 -- Odd index is GUID, even is count. | 2235 -- Odd index is GUID, even is count. |
2237 for loot_index = 1, #loot_info, 2 do | 2236 for loot_index = 1, #loot_info, 2 do |
2238 local source_guid = loot_info[loot_index] | 2237 local source_guid = loot_info[loot_index] |
2239 | 2238 |
2247 end | 2246 end |
2248 local source_type, source_id = ParseGUID(source_guid) | 2247 local source_type, source_id = ParseGUID(source_guid) |
2249 local source_key = ("%s:%d"):format(source_type, source_id) | 2248 local source_key = ("%s:%d"):format(source_type, source_id) |
2250 | 2249 |
2251 if slot_type == LOOT_SLOT_ITEM then | 2250 if slot_type == LOOT_SLOT_ITEM then |
2252 local item_id = ItemLinkToID(_G.GetLootSlotLink(loot_slot)) | 2251 if loot_link then |
2253 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) | 2252 local item_id = ItemLinkToID(loot_link) |
2254 current_loot.sources[source_guid] = current_loot.sources[source_guid] or {} | 2253 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) |
2255 current_loot.sources[source_guid][item_id] = (current_loot.sources[source_guid][item_id] or 0) + loot_quantity | 2254 current_loot.sources[source_guid] = current_loot.sources[source_guid] or {} |
2256 guids_used[source_guid] = true | 2255 current_loot.sources[source_guid][item_id] = (current_loot.sources[source_guid][item_id] or 0) + loot_quantity |
2256 guids_used[source_guid] = true | |
2257 else | |
2258 Debug("%s: Loot link is nil for loot slot %d of the entity with GUID %s and Type:ID: %s.", event_name, loot_slot, loot_info[loot_index], source_key) | |
2259 end | |
2257 elseif slot_type == LOOT_SLOT_MONEY then | 2260 elseif slot_type == LOOT_SLOT_MONEY then |
2258 Debug("GUID: %s - Type:ID: %s - Money - Amount: %d (%d)", loot_info[loot_index], source_key, loot_info[loot_index + 1], slot_quantity) | 2261 Debug("GUID: %s - Type:ID: %s - Money - Amount: %d (%d)", loot_info[loot_index], source_key, loot_info[loot_index + 1], slot_quantity) |
2259 if current_loot.target_type == AF.ZONE then | 2262 if current_loot.target_type == AF.ZONE then |
2260 table.insert(current_loot.list, ("money:%d"):format(loot_quantity)) | 2263 table.insert(current_loot.list, ("money:%d"):format(loot_quantity)) |
2261 else | 2264 else |
2263 current_loot.sources[source_guid]["money"] = (current_loot.sources[source_guid]["money"] or 0) + loot_quantity | 2266 current_loot.sources[source_guid]["money"] = (current_loot.sources[source_guid]["money"] or 0) + loot_quantity |
2264 guids_used[source_guid] = true | 2267 guids_used[source_guid] = true |
2265 end | 2268 end |
2266 elseif slot_type == LOOT_SLOT_CURRENCY then | 2269 elseif slot_type == LOOT_SLOT_CURRENCY then |
2267 -- Same bug with GetLootSlotInfo() will screw up currency when it happens, so we won't process this slot's loot. | 2270 -- Same bug with GetLootSlotInfo() will screw up currency when it happens, so we won't process this slot's loot. |
2268 if icon_texture then | 2271 if loot_link then |
2272 local icon_texture = CurrencyLinkToTexture(loot_link) | |
2269 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) | 2273 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) |
2270 if current_loot.target_type == AF.ZONE then | 2274 if current_loot.target_type == AF.ZONE then |
2271 table.insert(current_loot.list, ("currency:%d:%s"):format(loot_quantity, icon_texture:match("[^\\]+$"):lower())) | 2275 table.insert(current_loot.list, ("currency:%d:%s"):format(loot_quantity, icon_texture)) |
2272 else | 2276 else |
2273 local currency_token = ("currency:%s"):format(icon_texture:match("[^\\]+$"):lower()) | 2277 local currency_token = ("currency:%s"):format(icon_texture) |
2274 | 2278 |
2275 current_loot.sources[source_guid] = current_loot.sources[source_guid] or {} | 2279 current_loot.sources[source_guid] = current_loot.sources[source_guid] or {} |
2276 current_loot.sources[source_guid][currency_token] = (current_loot.sources[source_guid][currency_token] or 0) + loot_quantity | 2280 current_loot.sources[source_guid][currency_token] = (current_loot.sources[source_guid][currency_token] or 0) + loot_quantity |
2277 guids_used[source_guid] = true | 2281 guids_used[source_guid] = true |
2278 end | 2282 end |
2279 else | 2283 else |
2280 Debug("%s: Slot quantity is nil for loot slot %d of the entity with GUID %s and Type:ID: %s.", event_name, loot_slot, loot_info[loot_index], source_key) | 2284 Debug("%s: Loot link is nil for loot slot %d of the entity with GUID %s and Type:ID: %s.", event_name, loot_slot, loot_info[loot_index], source_key) |
2281 end | 2285 end |
2282 end | 2286 end |
2283 else | 2287 else |
2284 -- If this is nil, then the item's quantity could be wrong if loot_quantity is wrong, so we won't process this slot's loot. | 2288 -- If this is nil, then the item's quantity could be wrong if loot_quantity is wrong, so we won't process this slot's loot. |
2285 Debug("%s: Slot quantity is nil for loot slot %d.", event_name, loot_slot) | 2289 Debug("%s: Slot quantity is nil for loot slot %d of the entity with GUID %s and Type:ID: %s.", event_name, loot_slot, loot_info[loot_index], source_key) |
2286 end | 2290 end |
2287 end | 2291 end |
2288 end | 2292 end |
2289 end | 2293 end |
2290 | 2294 |