Quantcast

For some asshole reason that was using x2 materials cost

Darthpred [03-09-15 - 01:21]
For some asshole reason that was using x2 materials cost
Filename
ElvUI_SLE/modules/garrison.lua
diff --git a/ElvUI_SLE/modules/garrison.lua b/ElvUI_SLE/modules/garrison.lua
index e0c57a6..aebba06 100644
--- a/ElvUI_SLE/modules/garrison.lua
+++ b/ElvUI_SLE/modules/garrison.lua
@@ -12,24 +12,28 @@ local buildID = {
 }

 function G:SHIPMENT_CRAFTER_INFO(event, success, _, maxShipments, plotID)
-	if not GarrisonCapacitiveDisplayFrame then return end
+	if not GarrisonCapacitiveDisplayFrame then return end --Just in case
 	local n = GarrisonCapacitiveDisplayFrame.available or 0
-
-	local enabled = GarrisonCapacitiveDisplayFrame.StartWorkOrderButton:IsEnabled()
-
-	if not E.db.sle.garrison.autoOrder then return end
-	if not enabled then return end
+	if G.clicked or n == 0 or not E.db.sle.garrison.autoOrder then return end
+	G.clicked = true
 	local ID = C_Garrison.GetOwnedBuildingInfo(plotID)
 	local nope = buildID[ID]
 	if nope then
 		if E.db.sle.garrison['auto'..nope] then
-			C_Garrison.RequestShipmentCreation(n)
+			GarrisonCapacitiveDisplayFrame.CreateAllWorkOrdersButton:Click()
 		end
 	else
-		C_Garrison.RequestShipmentCreation(n)
+		GarrisonCapacitiveDisplayFrame.CreateAllWorkOrdersButton:Click()
 	end
 end

+function G:SHIPMENT_CRAFTER_CLOSED()
+	G.clicked = false
+end
+
 function G:Initialize()
+	G.clicked = false
+
 	self:RegisterEvent("SHIPMENT_CRAFTER_INFO");
+	self:RegisterEvent("SHIPMENT_CRAFTER_CLOSED");
 end
\ No newline at end of file