diff --git a/api.lua b/api.lua index 3a2db42..d114546 100644 --- a/api.lua +++ b/api.lua @@ -103,6 +103,16 @@ API.merchantiteminfo = type(_G.C_MerchantFrame) == "table" API.buybackitemid = type(_G.C_MerchantFrame) == "table" and type(_G.C_MerchantFrame.GetBuybackItemID) == "function" +API.loothistory = API.classicapi_version >= 11202 + and type(_G.C_LootHistory) == "table" + and type(_G.C_LootHistory.GetNumItems) == "function" + and type(_G.C_LootHistory.GetItem) == "function" + and type(_G.C_LootHistory.GetPlayerInfo) == "function" +API.loothistoryevents = API.loothistory and API.eventutils + and _G.C_EventUtils.IsEventValid("LOOT_HISTORY_ROLL_CHANGED") + and _G.C_EventUtils.IsEventValid("LOOT_HISTORY_ROLL_COMPLETE") + and _G.C_EventUtils.IsEventValid("LOOT_HISTORY_FULL_UPDATE") + API.overridebindings = type(_G.SetOverrideBindingClick) == "function" and type(_G.ClearOverrideBindings) == "function" @@ -517,6 +527,25 @@ API.GetBuybackItemID = function(index) end end +API.GetLootHistoryNumItems = function() + if API.loothistory then + return _G.C_LootHistory.GetNumItems() + end + return 0 +end + +API.GetLootHistoryItem = function(index) + if API.loothistory and index then + return _G.C_LootHistory.GetItem(index) + end +end + +API.GetLootHistoryPlayerInfo = function(itemIndex, playerIndex) + if API.loothistory and itemIndex and playerIndex then + return _G.C_LootHistory.GetPlayerInfo(itemIndex, playerIndex) + end +end + API.GetMerchantItemID = function(index) if type(_G.GetMerchantItemID) == "function" then return _G.GetMerchantItemID(index)