Mercurial > wow > inventory
comparison Modules/Mover.lua @ 101:6ae44d372360
The confirmation window when refilling from the (guild) bank is enabled can now be skipped at the general config. It defaults to false.
Added a window displaying a list of movable items when at least one is available at the (guild) bank.
Resetting the queue when closing the storage.
author | Zerotorescue |
---|---|
date | Tue, 11 Jan 2011 19:48:35 +0100 |
parents | 252292b703ce |
children | 3bbad0429d87 |
comparison
equal
deleted
inserted
replaced
100:dbb239fcc91b | 101:6ae44d372360 |
---|---|
4 local Scanner; | 4 local Scanner; |
5 local queuedMoves = {}; -- table storing all queued moves before BeginMove is called | 5 local queuedMoves = {}; -- table storing all queued moves before BeginMove is called |
6 local combinedMoves = {}; -- table storing all combined moves (with source and target) that is to be processed by the actual mover in the order of the index (1 to #) | 6 local combinedMoves = {}; -- table storing all combined moves (with source and target) that is to be processed by the actual mover in the order of the index (1 to #) |
7 local movesSource; | 7 local movesSource; |
8 | 8 |
9 function mod:AddMove(itemId, amount) | 9 function mod:AddMove(itemId, amount, numMissing, numAvailable) |
10 table.insert(queuedMoves, { | 10 table.insert(queuedMoves, { |
11 id = itemId, | 11 id = itemId, |
12 num = amount, | 12 num = amount, |
13 missing = numMissing, | |
14 available = numAvailable, | |
13 }); | 15 }); |
14 end | 16 end |
15 | 17 |
16 function mod:HasMoves() | 18 function mod:HasMoves() |
17 return (#queuedMoves ~= 0); | 19 return (#queuedMoves ~= 0); |
20 end | |
21 | |
22 function mod:GetMoves() | |
23 return queuedMoves; | |
24 end | |
25 | |
26 function mod:ResetQueue() | |
27 table.wipe(queuedMoves); | |
18 end | 28 end |
19 | 29 |
20 if not table.reverse then | 30 if not table.reverse then |
21 table.reverse = function(orig) | 31 table.reverse = function(orig) |
22 local temp = {}; | 32 local temp = {}; |
47 addon:Debug("%d moves were queued.", #queuedMoves); | 57 addon:Debug("%d moves were queued.", #queuedMoves); |
48 | 58 |
49 for _, singleMove in pairs(queuedMoves) do | 59 for _, singleMove in pairs(queuedMoves) do |
50 local sourceItem = sourceContents[singleMove.id]; | 60 local sourceItem = sourceContents[singleMove.id]; |
51 if not sourceItem then | 61 if not sourceItem then |
52 addon:Print("Can't move " .. IdToItemLink(singleMove.id) .. ", this doesn't exist in the source.", addon.Colors.Red); | 62 addon:Print(("Can't move %s, this doesn't exist in the source."):format(IdToItemLink(singleMove.id)), addon.Colors.Red); |
53 else | 63 else |
54 -- We want to move the smallest stacks first to keep stuff pretty (and minimize space usage, splitting a stack takes 2 slots, moving something only 1) | 64 -- We want to move the smallest stacks first to keep stuff pretty (and minimize space usage, splitting a stack takes 2 slots, moving something only 1) |
55 table.sort(sourceItem.locations, function(a, b) | 65 table.sort(sourceItem.locations, function(a, b) |
56 return a.count < b.count; | 66 return a.count < b.count; |
57 end); | 67 end); |