Warlock shard dropper
This code will delete extra Soul Shards from all of your bags and keeps 4 when you start channelling Drain Soul.
Snippet
if select(2,UnitClass("player")) == "WARLOCK" then
local SHARDSTOKEEP = 4
local spell = GetSpellInfo(1120)
local f = CreateFrame("Frame")
f:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START")
f:SetScript("OnEvent",function(self,event,arg1,arg2)
if arg1 == "player" and arg2 == spell then
local drop = GetItemCount(6265);
drop = drop - SHARDSTOKEEP;
for x = 0,4 do
for y = 1, GetContainerNumSlots(x) do
if (drop > 0) then
local link = GetContainerItemLink(x,y);
if (link and (GetItemInfo(link) == GetItemInfo(6265))) then
PickupContainerItem(x,y);
DeleteCursorItem();
drop = drop - 1;
end
end
end
end
end
end)
end
Posted by Mikma at Mon, 27 Apr 2009 10:49:43 +0000