View Single Post
10-29-05, 02:39 PM   #3
vincentgdg
A Murloc Raider
Join Date: Sep 2005
Posts: 8
Thanks

Hello agan. :-)

Thanks to Gello's Waterboy and some help from Rowne I managed to put together a working version of my "Restack".

I had to program around some very strange things. One was that the event BAG_UPDATE is fired on login before the name of all bags are even known, so my counting of free slots was wrong the first few seconds. Now I wait for 5 secs before my addon reacts on an event. :-)
Another thing was that the function PickupContainerItem() sometimes does not drop the item the client is holding, so I check this and if it is the case I just do another drop onto the next free slot I find. Funny thing is that the item is then dropped onto the correct slot it was meant to be dropped, I don't know why. But as it works, I don't care. :-)

What the addon does until now is the following:

It takes a minimum of wanted free slots (default is 1, it is changeable via slash command).

Whenever a BAG_UPDATE is fired, it waits for 0.5 secs to see if there is another event coming.

If there isn't another event it checks if the free slots are less than the wanted amount.
If this is the case it starts a restacking with the first restackable item found twice while scanning the bags. Then it stops and waits for another OnUpdate event to continue until the amount of wanted free slots is reached.

This even works with MailLoot, the addon with the fastest pushing of items into the bags I know.

Of couse you can also start the restacking manually by entering "/restack go".

One thing I have in mind to add is not restacking, but splitting of certain items into stacks with a chooseable stack size like 1, when you want to split stacks to sell them at the AH.

I have yet to think about how to do this. I could do a "/restack <item> <stack size>" or store a wanted maximum stack size for each item and split them automatically when /restack is called.

What do you think would be the better way?

After a bit more testing I will put this addon on the various addon sites.

Regards
Thomas
  Reply With Quote