Basic LUA implementation
This commit is contained in:
parent
3fba9bfb88
commit
91bfed75ed
1 changed files with 23 additions and 13 deletions
|
@ -6,23 +6,33 @@ function core:OnInitialize()
|
|||
end
|
||||
|
||||
function core:OnEnable()
|
||||
self:RegisterEvent('COMBAT_LOG_EVENT_UNFILTERED','CheckGemCut');
|
||||
self:RegisterEvent('UNIT_SPELLCAST_SUCCEEDED','StackGem');
|
||||
end
|
||||
|
||||
function core:CheckGemCut(_,event,_,sourceGUID,sourceName,_,_,_,_,_,_,spellSchool)
|
||||
if(not gemCasts[spellSchool]) then return end;
|
||||
function core:StackGem(unitID,spell,rank,lineID,spellID)
|
||||
--should receive something like "player","Reckless Ember Topaz","",2,73369
|
||||
if(unitID ~= 'player') then return end;
|
||||
if(not gems[spellID]) then return end;
|
||||
|
||||
self:RegisterEvent('BAG_UPDATE','StackGem');
|
||||
end
|
||||
--go through all bag slots and find all stacks of this gem type.
|
||||
--local sourceStack = {};
|
||||
--local destStack = {};
|
||||
--for all of the bags
|
||||
-- for all of the slots
|
||||
-- if(gems[spellID] == GetContainerItemID(1,11)) then
|
||||
-- _,count = GetContainerItemInfo(container, slot)
|
||||
-- if(count == 1) then
|
||||
-- sourceStack = {container,slot);
|
||||
-- elseif(count < 20) then
|
||||
-- destStack = {container,slot);
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
--end
|
||||
|
||||
function core:StackGem(container)
|
||||
--find the item (tricky?)
|
||||
|
||||
--check all bags to see if there is an existing stack
|
||||
|
||||
--if there is an existing stack and it is not max, stack the new gem on the old stack
|
||||
|
||||
self:UnregisterEvent('BAG_UDATE');
|
||||
--if there is a stack of 1 and a stack of < 20, combine them
|
||||
PickupContainerItem(sourceStack[0],sourceStack[1])
|
||||
PickupContainerItem(destStack[0],destStack[1])
|
||||
end
|
||||
|
||||
--BAG_UPDATE - container
|
||||
|
|
Loading…
Reference in a new issue