function Trig_ITEMS_Acquisition_Actions takes nothing returns nothing
local boolean check = false
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 6
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
if ( (check == false) and ( GetItemCharges(GetManipulatedItem()) > 0 ) and ( GetItemCharges(UnitItemInSlotBJ(GetManipulatingUnit(), GetForLoopIndexA())) > 0 ) and ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), GetForLoopIndexA())) == GetItemTypeId(GetManipulatedItem()) ) and ( UnitItemInSlotBJ(GetManipulatingUnit(), GetForLoopIndexA()) != GetManipulatedItem() ) ) then
call SetItemCharges( UnitItemInSlotBJ(GetManipulatingUnit(), GetForLoopIndexA()), ( GetItemCharges(UnitItemInSlotBJ(GetManipulatingUnit(), GetForLoopIndexA())) + GetItemCharges(GetManipulatedItem()) ) )
call RemoveItem( GetManipulatedItem() )
set check = true
else
call DoNothing( )
endif
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
endfunction
//===========================================================================
function InitTrig_ITEMS_Acquisition takes nothing returns nothing
set gg_trg_ITEMS_Acquisition = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_ITEMS_Acquisition, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddAction( gg_trg_ITEMS_Acquisition, function Trig_ITEMS_Acquisition_Actions )
endfunction