/
local ldb = LibStub:GetLibrary("LibDataBroker-1.1") |
local dataobj = ldb:NewDataObject("Ranch", {type = "data source", text = "Ranch"}) |
CreateFrame( "GameTooltip", "RanchGameTip" ); |
RanchGameTip:SetOwner( WorldFrame, "ANCHOR_NONE" ); |
RanchGameTip:AddFontStrings( |
RanchGameTip:CreateFontString( "$parentTextLeft1", nil, "GameTooltipText" ), |
RanchGameTip:CreateFontString( "$parentTextRight1", nil, "GameTooltipText" ) |
); |
function dataobj:OnTooltipShow() |
local i, j |
ranch_items = {} |
local ranch_items = {} |
local ranch_boe = {} |
local ranch_cash = 0 |
local ranch_uncost = false |
local ranch_junk = false |
if GetSellValue == nil then |
ranch_uncost = true |
end |
for i = 0, 4 do |
for j = 1, GetContainerNumSlots(i) do |
local ContainerItemLink = GetContainerItemLink(i,j) |
if ranch_items[itemSubType][itemId] == nil then |
ranch_items[itemSubType][itemId] = GetItemCount(itemLink) |
end |
elseif itemRarity == 0 then |
ranch_junk = true |
if GetSellValue ~= nil then |
if GetSellValue(itemLink) == nil then |
ranch_uncost = true |
else |
ranch_cash = ranch_cash + GetSellValue(itemLink) |
end |
end |
elseif itemRarity >=2 then |
RanchGameTip:ClearLines(); |
RanchGameTip:SetBagItem(i,j); |
if ((RanchGameTipTextLeft2:GetText() ~= "Soulbound") and (RanchGameTipTextLeft2:GetText() ~= "Quest Item") and RanchGameTipTextLeft2:GetText() ~= "Account Bound") then |
ranch_boe[itemLink] = GetSellValue(itemLink) |
end |
end |
end |
end |
local itemGroup, Collection, itemId, itemCount |
self:AddLine("Ranch") |
self:AddLine(" ") |
self:AddLine("Items") |
for itemLink, itemCount in pairs(ranch_boe) do |
local _, _, _, textcash = Ranch_FormatCash(itemCount) |
self:AddDoubleLine(itemLink, textcash) |
end |
for itemGroup, Collection in pairs(ranch_items) do |
self:AddLine(" ") |
self:AddLine(itemGroup) |
self:AddDoubleLine(itemLink,itemCount) |
end |
end |
end |