Mercurial > wow > itemauditor
comparison Core.lua @ 81:64166ba5209a
Correct fix for bug 22. The bank needs to be considered and scanned if it is open, but not if the user is not using the bank
| author | Asa Ayers <Asa.Ayers@Gmail.com> |
|---|---|
| date | Thu, 05 Aug 2010 20:21:05 -0700 |
| parents | 19609b3af2d7 |
| children | e9f7bc9199ca |
comparison
equal
deleted
inserted
replaced
| 80:19609b3af2d7 | 81:64166ba5209a |
|---|---|
| 158 function ItemAuditor:Print(message, ...) | 158 function ItemAuditor:Print(message, ...) |
| 159 message = format(message, ...) | 159 message = format(message, ...) |
| 160 getOptions().GetSelectedChatWindow():AddMessage( printPrefix .. tostring(message)) | 160 getOptions().GetSelectedChatWindow():AddMessage( printPrefix .. tostring(message)) |
| 161 end | 161 end |
| 162 | 162 |
| 163 local bankOpen = false | |
| 164 | |
| 165 function ItemAuditor:BankFrameChanged(event) | |
| 166 bankOpen = (event == 'BANKFRAME_OPENED') | |
| 167 ItemAuditor:UpdateCurrentInventory() | |
| 168 end | |
| 169 | |
| 163 local function scanBag(bagID, i) | 170 local function scanBag(bagID, i) |
| 164 bagSize=GetContainerNumSlots(bagID) | 171 bagSize=GetContainerNumSlots(bagID) |
| 165 for slotID = 0, bagSize do | 172 for slotID = 0, bagSize do |
| 166 local link= GetContainerItemLink(bagID, slotID); | 173 local link= GetContainerItemLink(bagID, slotID); |
| 167 link = link and ItemAuditor:GetSafeLink(link) | 174 link = link and ItemAuditor:GetSafeLink(link) |
| 168 | 175 |
| 169 if link ~= nil and i[link] == nil then | 176 if link ~= nil and i[link] == nil then |
| 170 i[link] = GetItemCount(link, true); | 177 i[link] = GetItemCount(link, bankOpen); |
| 171 end | 178 end |
| 172 end | 179 end |
| 173 end | 180 end |
| 174 | 181 |
| 175 function ItemAuditor:GetCurrentInventory() | 182 function ItemAuditor:GetCurrentInventory() |
| 179 | 186 |
| 180 for bagID = 0, NUM_BAG_SLOTS do | 187 for bagID = 0, NUM_BAG_SLOTS do |
| 181 scanBag(bagID, i) | 188 scanBag(bagID, i) |
| 182 end | 189 end |
| 183 | 190 |
| 184 scanBag(BANK_CONTAINER, i) | 191 if bankOpen then |
| 185 for bagID = NUM_BAG_SLOTS+1, NUM_BANKBAGSLOTS do | 192 scanBag(BANK_CONTAINER, i) |
| 186 scanBag(bagID, i) | 193 for bagID = NUM_BAG_SLOTS+1, NUM_BANKBAGSLOTS do |
| 194 scanBag(bagID, i) | |
| 195 end | |
| 187 end | 196 end |
| 188 | 197 |
| 189 return {items = i, money = GetMoney()} | 198 return {items = i, money = GetMoney()} |
| 190 end | 199 end |
| 191 | 200 |
