Quantcast

Do E.private.sle.farm = nil before testing this in game!!!

Darthpred [02-20-13 - 12:48]
Do E.private.sle.farm = nil before testing this in game!!!
Added an option to allow drop seeds from farm bars.
Filename
ElvUI_SLE/config/sle_private.lua
ElvUI_SLE/modules/farm/farm.lua
ElvUI_SLE/modules/farm/options.lua
diff --git a/ElvUI_SLE/config/sle_private.lua b/ElvUI_SLE/config/sle_private.lua
index 14e075c..f966b76 100644
--- a/ElvUI_SLE/config/sle_private.lua
+++ b/ElvUI_SLE/config/sle_private.lua
@@ -1,40 +1,44 @@
-local E, L, V, P, G, _ =  unpack(ElvUI); --Inport: Engine, Locales, ProfileDB, GlobalDB
-
-V['sle'] = {
-	['dbm'] = {
-		['size'] = 10,
-	},
-
-	--Backgrounds
-	['backgrounds'] = {
-		['bottom'] = {
-			['template'] = "Default",
-		},
-		['left'] = {
-			['template'] = "Default",
-		},
-		['right'] = {
-			['template'] = "Default",
-		},
-		['action'] = {
-			['template'] = "Default",
-		},
-	},
-
-	--Character Frame Options
-	['characterframeoptions'] = {
-		["enable"] = false,
-	},
-
-	["datatext"] = {
-		["dp1hide"] = false,
-		["dp2hide"] = false,
-		["tophide"] = false,
-		["dp3hide"] = false,
-		["dp4hide"] = false,
-		["dp5hide"] = false,
-		["bottomhide"] = false,
-		["dp6hide"] = false,
-	},
-	['farm'] = false,
-}
+local E, L, V, P, G, _ =  unpack(ElvUI); --Inport: Engine, Locales, ProfileDB, GlobalDB
+
+V['sle'] = {
+	['dbm'] = {
+		['size'] = 10,
+	},
+
+	--Backgrounds
+	['backgrounds'] = {
+		['bottom'] = {
+			['template'] = "Default",
+		},
+		['left'] = {
+			['template'] = "Default",
+		},
+		['right'] = {
+			['template'] = "Default",
+		},
+		['action'] = {
+			['template'] = "Default",
+		},
+	},
+
+	--Character Frame Options
+	['characterframeoptions'] = {
+		["enable"] = false,
+	},
+
+	["datatext"] = {
+		["dp1hide"] = false,
+		["dp2hide"] = false,
+		["tophide"] = false,
+		["dp3hide"] = false,
+		["dp4hide"] = false,
+		["dp5hide"] = false,
+		["bottomhide"] = false,
+		["dp6hide"] = false,
+	},
+
+	['farm'] = {
+		['enable'] = false,
+		['seedtrash'] = false,
+	},
+}
diff --git a/ElvUI_SLE/modules/farm/farm.lua b/ElvUI_SLE/modules/farm/farm.lua
index 6cdb8cd..29338ed 100644
--- a/ElvUI_SLE/modules/farm/farm.lua
+++ b/ElvUI_SLE/modules/farm/farm.lua
@@ -196,7 +196,7 @@ function F:UpdateBar(bar, layoutfunc, zonecheck, anchor, buttons, category)
 	bar:Show()

 	local count = layoutfunc(self, bar, anchor, buttons, category)
-	if (E.private.sle.farm and count > 0 and zonecheck(self) and not InCombatLockdown()) then
+	if (E.private.sle.farm.enable and count > 0 and zonecheck(self) and not InCombatLockdown()) then
 		bar:Show()
 	else
 		bar:Hide()
@@ -331,7 +331,7 @@ function F:CreateFrames()

 		for id, v in pairs(seeds) do
 			if v[1] == i then
-				tinsert(seedButtons[i], F:CreateFarmButton(id, seedBar, "item", v[2], v[11], false, i))
+				tinsert(seedButtons[i], F:CreateFarmButton(id, seedBar, "item", v[2], v[11], E.private.sle.farm.seedtrash, i))
 			end
 			tsort(seedButtons[i], function(a, b) return a.sortname < b.sortname end)
 		end
@@ -389,7 +389,7 @@ function F:StartFarmBarLoader()
 end

 function F:Initialize()
-	if not E.private.sle.farm then return end
+	if not E.private.sle.farm.enable then return end

 	self:RegisterEvent("PLAYER_ENTERING_WORLD", "StartFarmBarLoader")
 end
diff --git a/ElvUI_SLE/modules/farm/options.lua b/ElvUI_SLE/modules/farm/options.lua
index b4932ce..953bb69 100644
--- a/ElvUI_SLE/modules/farm/options.lua
+++ b/ElvUI_SLE/modules/farm/options.lua
@@ -15,15 +15,15 @@ E.Options.args.sle.args.farm = {
 			type = "toggle",
 			order = 2,
 			name = L['Enable'],
-			get = function(info) return E.private.sle.farm end,
-			set = function(info, value) E.private.sle.farm = value; E:StaticPopup_Show("PRIVATE_RL") end
+			get = function(info) return E.private.sle.farm.enable end,
+			set = function(info, value) E.private.sle.farm.enable = value; E:StaticPopup_Show("PRIVATE_RL") end
 		},
 		active = {
 			order = 3,
 			type = 'toggle',
 			name = L['Only active buttons'],
 			desc = L['Only show the buttons for the seeds, portals, tools you have in your bags.'],
-			disabled = function() return not E.private.sle.farm end,
+			disabled = function() return not E.private.sle.farm.enable end,
 			get = function(info) return E.db.sle.farm.active end,
 			set = function(info, value) E.db.sle.farm.active = value F:UpdateLayout() end,
 		},
@@ -31,7 +31,7 @@ E.Options.args.sle.args.farm = {
 			order = 4,
 			type = "range",
 			name = L["Button Size"],
-			disabled = function() return not E.private.sle.farm end,
+			disabled = function() return not E.private.sle.farm.enable end,
 			min = 15, max = 60, step = 1,
 			get = function(info) return E.db.sle.farm.size end,
 			set = function(info, value) E.db.sle.farm.size = value; F:UpdateLayout() end,
@@ -40,6 +40,7 @@ E.Options.args.sle.args.farm = {
 			type = "group",
 			order = 5,
 			name = L["Seed Bars"],
+			disabled = function() return not E.private.sle.farm.enable end,
 			guiInline = true,
 			args = {
 				autotarget = {
@@ -50,6 +51,14 @@ E.Options.args.sle.args.farm = {
 					get = function(info) return E.db.sle.farm.autotarget end,
 					set = function(info, value) E.db.sle.farm.autotarget = value; end
 				},
+				trash = {
+					type = "toggle",
+					order = 1,
+					name = L["Drop Seeds"],
+					desc = L["Allow seeds to be destroyed from seed bars."],
+					get = function(info) return E.private.sle.farm.seedtrash end,
+					set = function(info, value) E.private.sle.farm.seedtrash = value; E:StaticPopup_Show("PRIVATE_RL") end
+				},
 				growth = {
 					order = 8,
 					type = "select",