Use CHAT_MSG_TRADESKILLS and ITEM_PUSH to track and stack gems.

This commit is contained in:
Andrew Tomaka 2011-07-25 16:33:29 -04:00
parent 9012a4fb86
commit 72c319d50d

View file

@ -12,16 +12,13 @@ function core:OnEnable()
end end
function core:TrackGems(_,message) function core:TrackGems(_,message)
--LOOT_ITEM_CREATED_SELF = "You create: %s."; /dump TRADESKILL_LOG_FIRSTPERSON:gsub("%%s", "(.-)")
lastGem = message:match(TRADESKILL_LOG_FIRSTPERSON:gsub("%%s", "(.+)")) lastGem = message:match(TRADESKILL_LOG_FIRSTPERSON:gsub("%%s", "(.+)"))
if lastGem == nil or lastGem == "" then return end if lastGem == nil or lastGem == "" then return end
print('TrackGems found',lastGem)
self:RegisterEvent('ITEM_PUSH','StackGems') self:RegisterEvent('ITEM_PUSH','StackGems')
end end
function core:StackGems() function core:StackGems()
print('StackGems stacking',lastGem)
local sourceContainer,sourceSlot,destContainer,destSlot = -1,-1,-1,-1; local sourceContainer,sourceSlot,destContainer,destSlot = -1,-1,-1,-1;
for bag = 0,NUM_BAG_SLOTS do for bag = 0,NUM_BAG_SLOTS do
for slot = 1,GetContainerNumSlots(bag) do for slot = 1,GetContainerNumSlots(bag) do
@ -42,7 +39,6 @@ function core:StackGems()
end end
end end
print(sourceContainer,sourceSlot,destContainer,destSlot)
if sourceContainer ~= -1 and destContainer ~= -1 then if sourceContainer ~= -1 and destContainer ~= -1 then
PickupContainerItem(sourceContainer,sourceSlot) PickupContainerItem(sourceContainer,sourceSlot)
PickupContainerItem(destContainer,destSlot) PickupContainerItem(destContainer,destSlot)