diff Classes/ContainerItem.class.lua @ 110:67bd5057ecb7

Implemented vendor restocking with the mover. Comitting so I can always review this working version, but I?ll be disabling all part of it as it is not going to work properly without seriously compromising the code structure. Debug messages are now appended with ?Inventorium? (my MailOpener addon was making stuff difficult). Now properly removing the refill window from the displayed static popup windows list so new popups won?t be aligned at odd locations. Changed ?CreateMoverFrame? to not contain any scenario-specific info. All settings can be set with SetFrameSettings. Items that belong to speciality bags are now put there. Other items now ignore spaciality bags. Implemented test code for mailbox refill support. It has been disabled due to some issues but may be introduced later. The guild withdrawal limit is now taken into consideration. Queue is now reset before scanning again.
author Zerotorescue
date Fri, 14 Jan 2011 23:25:05 +0100
parents 3bec0ea44607
children 41f0689dfda1
line wrap: on
line diff
--- a/Classes/ContainerItem.class.lua	Wed Jan 12 22:48:25 2011 +0100
+++ b/Classes/ContainerItem.class.lua	Fri Jan 14 23:25:05 2011 +0100
@@ -19,14 +19,30 @@
 	return self;
 end
 
-function addon.ContainerItem:AddLocation(container, slot, count)
+function addon.ContainerItem:AddLocation(container, slot, count, price)
 	table.insert(self.locations, {
-		container = container,
-		slot = slot,
-		count = count,
+		["container"] = container,
+		["slot"] = slot,
+		["count"] = count,
+		["price"] = price,
 	});
 	
-	self.totalCount = (self.totalCount + count);
+	-- -1 indicates unlimited supply
+	if self.totalCount ~= -1 then
+		if count == -1 then
+			self.totalCount = -1;
+		else
+			self.totalCount = (self.totalCount + count);
+		end
+	end
 	
 	return true;
 end
+
+function addon.ContainerItem:GetVendorPrice()
+	for _, loc in pairs(self.locations) do
+		if loc.price then
+			return loc.price;
+		end
+	end
+end