WoWInterface SVN Ranch

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 6 to Rev 7
    Reverse comparison

Rev 6 → Rev 7

trunk/ranch.lua
1,16 → 1,46
-- Ensure that the required libaries are present.
assert(LibStub, "Ranch requires LibStub")
assert(LibStub:GetLibrary("LibDataBroker-1.1", true), "Ranch requires LibDataBroker-1.1")
 
-- Create reference to the LDB Libarary
local ldb = LibStub:GetLibrary("LibDataBroker-1.1")
 
-- Register the data source.
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" )
);
ranch_temp = {}
 
-- Create a frame and register the "VARIABLES_LOADED" event on it.
CreateFrame("Frame", "RanchFrame");
RanchFrame:SetScript("OnEvent", function(self, event, ...) getglobal("Ranch_"..event)(event, ...) end);
RanchFrame:RegisterEvent("VARIABLES_LOADED")
 
 
-- Event handler for the VARIABLES_LOADED event.
function Ranch_VARIABLES_LOADED(event, ...)
 
-- Unregister the VARIABLES_LOADED event. Probably not necessary, but keeps things tidy.
RanchFrame:UnregisterEvent("VARIABLES_LOADED")
 
-- Create a GameTooltip for use later. This tooltip can be scanned to detect whether or not an item is BoE.
CreateFrame( "GameTooltip", "RanchGameTip" );
RanchGameTip:SetOwner( WorldFrame, "ANCHOR_NONE" );
RanchGameTip:AddFontStrings(
RanchGameTip:CreateFontString( "$parentTextLeft1", nil, "GameTooltipText" ),
RanchGameTip:CreateFontString( "$parentTextRight1", nil, "GameTooltipText" )
);
 
-- Create the ranch_perm table if it doesn't exist
if ranch_perm == nil then
ranch_perm = {}
end
 
-- Create an empty table to hold any temporary items.
ranch_temp = {}
 
-- Register the BAG_UPDATE event.
RanchFrame:RegisterEvent("BAG_UPDATE");
 
end
 
function Ranch_Command(slashargs)
local startPos, endPos, firstWord, restOfString = string.find(slashargs, "(%w+)[%s%p]*(.*)");
firstWord = strlower(firstWord)
196,8 → 226,4
end
return n;
end
 
 
local frame = CreateFrame("Frame", "RanchFrame");
frame:SetScript("OnEvent", function(self, event, ...) getglobal("Ranch_"..event)(event, ...) end);
frame:RegisterEvent("BAG_UPDATE");
\ No newline at end of file + \ No newline at end of file