WoWInterface SVN Ranch

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 14 to Rev 15
    Reverse comparison

Rev 14 → Rev 15

ranch.lua
43,12 → 43,44
ranch_options["types"] = {}
end
 
-- Create display items option, if it doesn't exist.
if ranch_options["displayitems"] == nil then
ranch_options["displayitems"] = true
end
 
-- Create display items option, if it doesn't exist.
if ranch_options["mergeitems"] == nil then
ranch_options["mergeitems"] = false
end
 
-- Create an empty table to hold any temporary items.
ranch_temp = {}
 
-- Create the Options Panel.
-- Create the About Panel.
RanchAbout = LibStub("tekKonfig-AboutPanel").new(nil, "Ranch")
 
-- Create the Items Options
local RanchItemOptions = CreateFrame("Frame", "RanchItemOpts", InterfaceOptionsFramePanelContainer)
RanchItemOptions.name = "Item Options"
RanchItemOptions.parent = "Ranch"
local title, subtitle = LibStub("tekKonfig-Heading").new(RanchItemOptions, "Ranch Item Options", "This panel controls how Ranch deals with BoE items.")
 
-- Add Display Items option.
local displayitems = LibStub("tekKonfig-Checkbox").new(RanchItemOptions, nil, "Display BoE items?", "TOPLEFT", subtitle, "BOTTOMLEFT", -2, -8)
local checksound = displayitems:GetScript("OnClick")
displayitems:SetScript("OnClick", function(self) checksound(self); ranch_options["displayitems"] = not ranch_options["displayitems"]; end)
displayitems:SetChecked(ranch_options["displayitems"])
 
-- Add Merge Items option.
local mergeitems = LibStub("tekKonfig-Checkbox").new(RanchItemOptions, nil, "Merge BoE items?", "TOPLEFT", displayitems, "BOTTOMLEFT", -2, -8)
local checksound = mergeitems:GetScript("OnClick")
mergeitems:SetScript("OnClick", function(self) checksound(self); ranch_options["mergeitems"] = not ranch_options["mergeitems"]; end)
mergeitems:SetChecked(ranch_options["mergeitems"])
 
RanchItemOptions:SetScript("OnShow", function(self) displayitems:SetChecked(ranch_options["displayitems"]); mergeitems:SetChecked(ranch_options["mergeitems"]) end)
-- Add Items Options to the Interface Menu.
InterfaceOptions_AddCategory(RanchItemOptions)
 
-- Register the BAG_UPDATE event.
RanchFrame:RegisterEvent("BAG_UPDATE");
 
152,7 → 184,11
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)
if ranch_options["mergeitems"] then
ranch_boe[itemId] = GetSellValue(itemLink)
else
ranch_boe[itemLink] = GetSellValue(itemLink)
end
end
end
 
166,11 → 202,20
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)
if ranch_options["displayitems"] then
self:AddLine(" ")
self:AddLine("Items")
for itemDesc, itemCost in pairs(ranch_boe) do
if ranch_options["mergeitems"] then
local itemCount = GetItemCount(itemDesc)
local _, _, _, textcash = Ranch_FormatCash(itemCost * itemCount)
local _, itemLink = GetItemInfo(itemDesc)
self:AddDoubleLine(itemLink.." (x"..itemCount..")", textcash)
else
local _, _, _, textcash = Ranch_FormatCash(itemCost)
self:AddDoubleLine(itemDesc, textcash)
end
end
end
 
for itemGroup, Collection in pairs(ranch_items) do