view Classes/ContainerItem.class.lua @ 143:8eb0f5b5a885

Fixed ?fully stocked? tooltip to say it uses the restock target setting rather than the global stock setting. Making sure the inventorium queuer frame is available before hiding it. Fixed an error with queueing items. Skip reasons are now sorted by importance (also by default). Now closing the queue window when you close your profession window.
author Zerotorescue
date Tue, 18 Jan 2011 23:48:16 +0100
parents dc6f405c1a5d
children
line wrap: on
line source
local addon = select(2, ...);

-- Define the class

addon.ContainerItem = {};
addon.ContainerItem.__index = addon.ContainerItem;

-- Construct
function addon.ContainerItem:New()
	local self = {};
	
	setmetatable(self, addon.ContainerItem);
	
	-- Standard info everything needs
	self.totalCount = 0;
	self.locations = {};
	self.price = nil; -- usually unused
	
	return self;
end

function addon.ContainerItem:AddLocation(container, slot, count)
	table.insert(self.locations, {
		["container"] = container,
		["slot"] = slot,
		["count"] = 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