comparison Scanner.lua @ 82:f885805da5d6

Added options to toggle the automatic refilling. This defaults to true. Normalized property amount names; a move has a ?num? that must be moved and a location has a ?count? indicating the amount of items at that slot. Target/source item verification should now be working properly for guilds. When ?bank? is included in the local item count, we will skip trying to auto refill from this.
author Zerotorescue
date Thu, 06 Jan 2011 10:48:56 +0100
parents 58617c7827fa
children
comparison
equal deleted inserted replaced
81:58617c7827fa 82:f885805da5d6
76 -- A not equal-comparison should be quicker than a larger than-comparison 76 -- A not equal-comparison should be quicker than a larger than-comparison
77 77
78 -- If there is actually an item in this slot 78 -- If there is actually an item in this slot
79 79
80 local itemLink = GetGuildBankItemLink(tabId, slotId); 80 local itemLink = GetGuildBankItemLink(tabId, slotId);
81 local itemId = itemLink and GetItemId(itemLink); 81 local itemId = itemLink and GetItemID(itemLink);
82 local itemCount = itemLink and select(2, GetGuildBankItemInfo(tabId, slotId)); 82 local itemCount = itemLink and select(2, GetGuildBankItemInfo(tabId, slotId));
83 83
84 if itemLink and itemId and itemCount and itemCount > 0 then 84 if itemLink and itemId and itemCount and itemCount > 0 then
85 local itemMove; 85 local itemMove;
86 if not itemCache[itemId] then 86 if not itemCache[itemId] then
97 97
98 -- Continue scanning a different slot 98 -- Continue scanning a different slot
99 slotId = (slotId - 1); 99 slotId = (slotId - 1);
100 end 100 end
101 else 101 else
102 error("Invalid location provided for the local _GetItemCount. Must be Bank or Guild."); 102 error("Invalid location provided for CacheLocation. Must be Bank or Guild.");
103 end 103 end
104 104
105 if not remember then 105 if not remember then
106 -- Copy the table as clearing the cache wipes it empty (and tables are passed by reference) 106 -- Copy the table as clearing the cache wipes it empty (and tables are passed by reference)
107 local cacheCopy = CopyTable(itemCache); 107 local cacheCopy = CopyTable(itemCache);
123 self:CacheLocation(location, true); 123 self:CacheLocation(location, true);
124 124
125 -- Go through all groups 125 -- Go through all groups
126 for groupName, values in pairs(addon.db.profile.groups) do 126 for groupName, values in pairs(addon.db.profile.groups) do
127 local trackAt = addon:GetOptionByKey(groupName, "trackAtCharacters"); 127 local trackAt = addon:GetOptionByKey(groupName, "trackAtCharacters");
128 128 local localItemData = self:GetOptionByKey(groupName, "localItemData");
129 if values.items and trackAt[playerName] then 129
130 if values.items and trackAt[playerName] and addon:GetOptionByKey(groupName, "autoRefill") and (location ~= addon.Locations.Bank or not localItemData or not localItemData["Bank"]) then
130 -- Is this character interested in this data? 131 -- Is this character interested in this data?
131 132
132 local minLocalStock = addon:GetOptionByKey(groupName, "minLocalStock"); 133 local minLocalStock = addon:GetOptionByKey(groupName, "minLocalStock");
133 134
134 -- Go through all items 135 -- Go through all items
165 Mover:BeginMove(location, self.Unpause); 166 Mover:BeginMove(location, self.Unpause);
166 end, 167 end,
167 timeout = 0, 168 timeout = 0,
168 whileDead = 1, 169 whileDead = 1,
169 hideOnEscape = 1, 170 hideOnEscape = 1,
171 exclusive = 1,
172 enterClicksFirstButton = 1,
170 }; 173 };
171 StaticPopup_Show("InventoriumRefill"); 174 StaticPopup_Show("InventoriumRefill");
172 end 175 end
173 end 176 end
174 177