annotate Classes/ContainerItem.class.lua @ 184:679d3664849d

The stock alert should now properly scan immediately after a login. Setting the stock scan speed at fast or higher now properly speeds things up when your FPS is below 100. Renamed ?instant? speed to ?(Near) instant? and changed it to 100 steps per scan rather than everything at once.
author Zerotorescue
date Sun, 30 Jan 2011 20:53:13 +0100
parents dc6f405c1a5d
children
rev   line source
Zerotorescue@81 1 local addon = select(2, ...);
Zerotorescue@81 2
Zerotorescue@81 3 -- Define the class
Zerotorescue@81 4
Zerotorescue@81 5 addon.ContainerItem = {};
Zerotorescue@81 6 addon.ContainerItem.__index = addon.ContainerItem;
Zerotorescue@81 7
Zerotorescue@81 8 -- Construct
Zerotorescue@117 9 function addon.ContainerItem:New()
Zerotorescue@81 10 local self = {};
Zerotorescue@81 11
Zerotorescue@81 12 setmetatable(self, addon.ContainerItem);
Zerotorescue@81 13
Zerotorescue@81 14 -- Standard info everything needs
Zerotorescue@81 15 self.totalCount = 0;
Zerotorescue@81 16 self.locations = {};
Zerotorescue@119 17 self.price = nil; -- usually unused
Zerotorescue@81 18
Zerotorescue@81 19 return self;
Zerotorescue@81 20 end
Zerotorescue@81 21
Zerotorescue@111 22 function addon.ContainerItem:AddLocation(container, slot, count)
Zerotorescue@81 23 table.insert(self.locations, {
Zerotorescue@110 24 ["container"] = container,
Zerotorescue@110 25 ["slot"] = slot,
Zerotorescue@110 26 ["count"] = count,
Zerotorescue@81 27 });
Zerotorescue@81 28
Zerotorescue@110 29 -- -1 indicates unlimited supply
Zerotorescue@110 30 if self.totalCount ~= -1 then
Zerotorescue@110 31 if count == -1 then
Zerotorescue@110 32 self.totalCount = -1;
Zerotorescue@110 33 else
Zerotorescue@110 34 self.totalCount = (self.totalCount + count);
Zerotorescue@110 35 end
Zerotorescue@110 36 end
Zerotorescue@81 37
Zerotorescue@81 38 return true;
Zerotorescue@81 39 end