struct LastOrder extends array
readonly item targetItem
readonly unit targetUnit
readonly destructable targetDest
readonly real targetX
readonly real targetY
readonly integer orderId
static boolean monitor=true
static method operator [] takes unit u returns thistype
return thistype(GetUnitUserData(u))
endmethod
private static method onOrder takes nothing returns boolean
local thistype this=GetUnitUserData(GetOrderedUnit())
if thistype.monitor then
set this.targetItem=GetOrderTargetItem()
set this.targetUnit=GetOrderTargetUnit()
set this.targetDest=GetOrderTargetDestructable()
set this.targetX=GetOrderPointX()
set this.targetY=GetOrderPointX()
set this.orderId=GetIssuedOrderId()
endif
return false
endmethod
private static trigger orderTrig=CreateTrigger()
private static method onInit takes nothing returns nothing
call TriggerRegisterAnyUnitEventBJ(thistype.orderTrig,EVENT_PLAYER_UNIT_ISSUED_ORDER)
call TriggerRegisterAnyUnitEventBJ(thistype.orderTrig,EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER)
call TriggerRegisterAnyUnitEventBJ(thistype.orderTrig,EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER)
call TriggerAddCondition(thistype.orderTrig,Filter(function thistype.onOrder))
endmethod