/trunk
RanchFrame:SetScript("OnEvent", function(self, event, ...) getglobal("Ranch_"..event)(event, ...) end); |
RanchFrame:RegisterEvent("VARIABLES_LOADED") |
-- create local variables for the tracking facility |
local ranchtrack = nil |
local ranchgoal = nil |
-- Event handler for the VARIABLES_LOADED event. |
function Ranch_VARIABLES_LOADED(event, ...) |
questitems:SetScript("OnClick", function(self) checksound(self); ranch_options["questitems"] = not ranch_options["questitems"]; end) |
questitems:SetChecked(ranch_options["questitems"]) |
--[[ Add Display LDB text option |
-- Add Display LDB text option |
local ldbtext = LibStub("tekKonfig-Checkbox").new(RanchItemOptions, nil, "Display LDB text when not tracking anything?", "TOPLEFT", questitems, "BOTTOMLEFT", -2, -8) |
local checksound = ldbtext:GetScript("OnClick") |
ldbtext:SetScript("OnClick", function(self) checksound(self); ranch_options["ldbtext"] = not ranch_options["ldbtext"]; Ranch_BAG_UPDATE(nil); end) |
ldbtext:SetChecked(ranch_options["ldbtext"]) --]] |
ldbtext:SetChecked(ranch_options["ldbtext"]) |
-- Add an "OnShow" script to ensure the options are displayed correctly. |
--RanchItemOptions:SetScript("OnShow", function(self) displayitems:SetChecked(ranch_options["displayitems"]); mergeitems:SetChecked(ranch_options["mergeitems"]); questitems:SetChecked(ranch_options["questitems"]) end) |
-- Register the BAG_UPDATE event. |
RanchFrame:RegisterEvent("BAG_UPDATE"); |
end |
elseif firstWord == "goal" then |
if restOfString == nil then |
ranchgoal = nil |
elseif ranchtrack == nil then |
print("You need to set an item to be tracked first!") |
elseif type(tonumber(restOfString)) ~= "number" then |
print("You must supply the number of items you wish to gather!") |
elseif tonumber(restOfString) < 1 then |
print("You must set a goal of at least one item to gather!") |
else |
ranchgoal = {tonumber(restOfString), false} |
end |
elseif firstWord == "temp" then |
ranch_temp[Ranch_ItemID(restOfString)] = true |
elseif firstWord == "add" then |
else |
dataobj.icon = ranchIcon |
end |
dataobj.text = "|r|"..ranchtrack.." - "..GetItemCount(ranchtrack); |
local itemCount = GetItemCount(ranchtrack) |
dataobj.text = "|r|"..ranchtrack.." - "..itemCount; |
if ranchgoal ~= nil then |
if itemCount < ranchgoal[1] and ranchgoal[2] then |
ranchgoal[2] = false |
elseif itemCount >= ranchgoal[1] and not ranchgoal[2] then |
RaidNotice_AddMessage(RaidBossEmoteFrame, "You now have "..itemCount.." of "..ranchtrack.."!", ChatTypeInfo["GUILD"]) |
ranchgoal[2] = true |
end |
end |
end |
end |