Tyrulan
Ultra Cool Member
- Reaction score
- 37
I read a few of the resources and tutorials and eventually came up with this:
The problem with this is that it only merges items as they are created via gathering abilities. In order to merge a manipulated item being picked up do I need to create an array of items that are mergeable? And if so, how would I set the maximum number of stacks?
I've hummed and hawwed about this and have a few ideas but I'd like to see what is out there first.
JASS:
method CollectResource takes integer itemId returns item
local item anItem = CreateItem(itemId, 0, 0)
local integer index
local item indexItem
local boolean hasItem = false
set index = 0
loop
set indexItem = UnitItemInSlot(.Caster, index)
if (indexItem != null) and (GetItemTypeId(indexItem) == itemId) then
set hasItem = true
endif
set index = index + 1
exitwhen index >= bj_MAX_INVENTORY or hasItem
endloop
if (hasItem) then
call SetItemCharges(indexItem, GetItemCharges(indexItem) + 1)
else
call UnitAddItem(.Caster, anItem)
endif
return anItem
endmethod
The problem with this is that it only merges items as they are created via gathering abilities. In order to merge a manipulated item being picked up do I need to create an array of items that are mergeable? And if so, how would I set the maximum number of stacks?
I've hummed and hawwed about this and have a few ideas but I'd like to see what is out there first.