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
|
end
|
||||||
|
|
||||||
function core:OnEnable()
|
function core:OnEnable()
|
||||||
self:RegisterEvent('COMBAT_LOG_EVENT_UNFILTERED','CheckGemCut');
|
self:RegisterEvent('UNIT_SPELLCAST_SUCCEEDED','StackGem');
|
||||||
end
|
end
|
||||||
|
|
||||||
function core:CheckGemCut(_,event,_,sourceGUID,sourceName,_,_,_,_,_,_,spellSchool)
|
function core:StackGem(unitID,spell,rank,lineID,spellID)
|
||||||
if(not gemCasts[spellSchool]) then return end;
|
--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');
|
--go through all bag slots and find all stacks of this gem type.
|
||||||
end
|
--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)
|
--if there is a stack of 1 and a stack of < 20, combine them
|
||||||
--find the item (tricky?)
|
PickupContainerItem(sourceStack[0],sourceStack[1])
|
||||||
|
PickupContainerItem(destStack[0],destStack[1])
|
||||||
--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');
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--BAG_UPDATE - container
|
--BAG_UPDATE - container
|
||||||
|
|
Loading…
Reference in a new issue