// this script was compiled with wurst 1.8.0.0-jenkins-Wurst-975
globals
// alliancetype ALLIANCE_HELP_REQUEST=null
// attacktype ATTACK_TYPE_MAGIC=null
// damagetype DAMAGE_TYPE_UNIVERSAL=null
// mapcontrol MAP_CONTROL_USER=null
// playerslotstate PLAYER_SLOT_STATE_PLAYING=null
// unitstate UNIT_STATE_LIFE=null
// unitstate UNIT_STATE_MAX_LIFE=null
// unitstate UNIT_STATE_MANA=null
// playerunitevent EVENT_PLAYER_UNIT_DEATH=null
// playerunitevent EVENT_PLAYER_UNIT_SELECTED=null
// playerunitevent EVENT_PLAYER_UNIT_ISSUED_ORDER=null
// playerunitevent EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER=null
// playerunitevent EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER=null
// unitevent EVENT_UNIT_DAMAGED=null
// playerunitevent EVENT_PLAYER_UNIT_SPELL_CAST=null
// playerunitevent EVENT_PLAYER_UNIT_SPELL_EFFECT=null
// unittype UNIT_TYPE_HERO=null
// unittype UNIT_TYPE_DEAD=null
// integer bj_MAX_PLAYER_SLOTS=0
// rect bj_mapInitialPlayableArea=null
// integer bj_groupCountUnits=0
// group bj_groupAddGroupDest=null
integer Basics_DUMMY_UNIT_ID=0
integer Basics_HEIGHT_ENABLER=0
integer Basics_LOCUST_ID=0
real Basics_ANIMATION_PERIOD=0.
real Basics_MAX_COLLISION_SIZE=0.
player Basics_DUMMY_PLAYER=null
string array Char_c2s
integer Char_MAX_INDEX=0
integer Cast_casts=0
integer array ClosureForGroups_tempCallbacks
integer ClosureForGroups_tempCallbacksCount=0
conditionfunc ClosureForGroups_filter=null
integer array Collider_fx
real array Collider_expirationTime
real array Collider_speed
real array Collider_acceleration
real array Collider_maxSpeed
real array Collider_minSpeed
real array Collider_angleSpeed
real array Collider_collisionSize
boolean array Collider_silent
integer array Collider_seenIds
boolean array Collider_dead
integer array Collider_angleMode
unit array Collider_homingTargetUnit
real array Collider_homingTarget
real array Collider_homingTarget_2
integer array Collider_TimedLoop_instances
integer Collider_TimedLoop_instanceCount=0
triggercondition Collider_TimedLoop_triggerCond=null
integer array Collider_TimedLoop_mode
integer Colors_decs=0
real CustomExp_RADIUS=0.
real CustomExp_CLOSE=0.
real CustomExp_MEDIUM=0.
real CustomExp_FAR=0.
real CustomExp_CLOSE_FACTOR=0.
real CustomExp_MEDIUM_FACTOR=0.
real CustomExp_FAR_FACTOR=0.
integer CustomExp_UNIT_EXP=0
integer CustomExp_HERO_EXP=0
integer CustomExp_BONUS_EXP=0
real CustomExp_DURATION=0.
real CustomExp_SIZE=0.
integer CustomExp_RED=0
integer CustomExp_GREEN=0
integer CustomExp_BLUE=0
boolean CustomExp_SHOW_TEXT=false
boolean CustomExp_SPLIT=false
boolean CustomExp_DISTANCE_EFFECT=false
real DamageDetection_SWAP_TIMEOUT=0.
boolexpr array DamageDetection_func
integer DamageDetection_funcNext=0
trigger DamageDetection_current=null
trigger DamageDetection_toDestroy=null
boolean DamageType_useBonusCalculator=false
attacktype DamageType_ATTACK_TYPE_UNIVERSAL=null
integer DamageType_DAMAGE_TYPE_CHECK_ID=0
integer DamageType_lastDamageType=0
unit array DelayDat_target
unit array DelayDat_source
real array DelayDat_damage
real Damager_FACTOR_TEST_DAMAGE=0.
real Damager_MAX_DAMAGE_FACTOR=0.
real Damager_EPSILON=0.
unit Damager_dmger=null
boolean array Damager_damageSelf
boolean array Damager_damageAllies
boolean array Damager_damageEnemies
boolean array Damager_damageNeutral
boolean array Damager_ranged
boolean array Damager_visibleOnly
boolean array Damager_deadOnly
boolean array Damager_alsoDead
damagetype array Damager_dtype
attacktype array Damager_atype
weapontype array Damager_wtype
boolean array Damager_forceDamage
real array Damager_allyfactor
boolean array Damager_use_ex
unittype array Damager_ex_ut
boolean array Damager_use_req
unittype array Damager_req_ut
integer array Damager_fcn
integer array Damager_abifct
integer array Damager_abifc
integer array Damager_abifcn
boolean array Damager_usefx
string array Damager_fxpath
string array Damager_fxattach
integer Damager_instc=0
integer array Damager_countAOE
unit array Damager_sourceAOE
real array Damager_aoeX
real array Damager_aoeY
real array Damager_aoeRadius
real array Damager_aoeDamage
boolean DummyCaster_FORCE_INVISIBLE_CAST=false
boolean DummyCaster_AUTO_RESET_MANA_COOLDOWN=false
integer DummyCaster_delayTable=0
integer array DummyCaster_abilityId
integer array DummyCaster_level
player array DummyCaster_owner
integer array DummyCaster_orderId
real array DummyCaster_recycleDelay
boolean array DummyCaster_customSource
real array DummyCaster_customPos
real array DummyCaster_customPos_2
real array DummyCaster_customPos_3
boolean array DummyCaster_autodestroy
real DummyCaster_aoex=0.
real DummyCaster_aoey=0.
real DummyCaster_aoeradius=0.
integer DummyCaster_cinstance=0
integer DummyRecycler_DIFFERENT_ANGLES=0
real DummyRecycler_ANGLE_DEGREE=0.
integer DummyRecycler_SAVED_UNITS_PER_ANGLE=0
integer array ArrayQueue_fp
integer array ArrayQueue_rp
integer array ArrayQueue_size
timer DelayNode_t=null
unit array DelayNode_u
real array DelayNode_delayTime
integer array DelayNode_next
integer DelayNode_first=0
integer DelayNode_last=0
integer array DummyRecycler_angleQueues
integer ErrorHandling_MUTE_ERROR_DURATION=0
integer ErrorHandling_PRIMARY_ERROR_KEY=0
trigger EventHandling_castTrig=null
trigger EventHandling_evalTrig=null
conditionfunc array EventHandling_conds
unit array EventHandling_casters
integer EventHandling_count=0
string LocalFileTest_FLAG_FOLDER=null
string LocalFileTest_FLAG_FILE=null
boolean LocalFileTest_success=false
unit array Fx_dummy
effect array Fx_fx
timer GameTimer_gameTimer=null
real GameTimer_currentTime=0.
hashtable HashMap_ht=null
integer InstanceBoard_classes=0
multiboard InstanceBoard_mb=null
integer array InstanceBoard_count
string array InstanceBoard_nameOfClass
integer InstantDummyCaster_DUMMY_CASTER_UNIT_ID=0
unit InstantDummyCaster_caster=null
real Knockback3_DESTRUCTABLE_ENUM_SIZE=0.
integer LastOrder_ORDERS_TO_HOLD=0
integer array LastOrder_orderQueues
integer array OrderQueue_fp
integer array OrderQueue_rp
integer array OrderQueue_size
integer array LLEntry_elem
integer array LLEntry_prev
integer array LLEntry_next
integer array LinkedList_dummy
rect MapBounds_playableMapRect=null
rect MapBounds_boundRect=null
region MapBounds_boundRegion=null
real MapBounds_playableMin_x=0.
real MapBounds_playableMin_y=0.
real MapBounds_playableMax_x=0.
real MapBounds_playableMax_y=0.
real MapBounds_boundMin_x=0.
real MapBounds_boundMin_y=0.
real MapBounds_boundMax_x=0.
real MapBounds_boundMax_y=0.
real Maths_PI2=0.
real Maths_DEGTORAD=0.
real Maths_RADTODEG=0.
string ObjectIds_charMap=null
trigger OnUnitEnterLeave_eventTrigger=null
unit OnUnitEnterLeave_tempUnit=null
group array g
integer OnUnitEnterLeave_ABILITY_ID=0
player array Player_players
boolean PreloadHandler_autoFinish=false
group PreloadHandler_dumg=null
unit PreloadHandler_dum=null
boolean array PrintingHelper_wantDebug
integer PrintingHelper_DEBUG_LEVEL=0
real PrintingHelper_DEBUG_MSG_DURATION=0.
integer array Queue_front
integer array Queue_size
integer array SEntry_elem
integer array SEntry_next
trigger array RegisterEvents_t
integer RegisterEvents_onCastMap=0
real Simulate3dSound_PERIOD=0.
sound array Sim3DSound_snd
unit array Sim3DSound_sourceUnit
real array Sim3DSound_source
real array Sim3DSound_source_2
boolean array Sim3DSound_adjust
real array Sim3DSound_initial
real array Sim3DSound_factor
real array Sim3DSound_dur
real array Sim3DSound_maxD
real array Sim3DSound_distCut
integer SoundHelper_DEFAULT_SOUND_VOLUME=0
real SoundHelper_DEFAULT_SOUND_PITCH=0.
integer SoundHelper_SOUND_CHANNEL=0
real SoundHelper_SOUND_MIN_DIST=0.
real SoundHelper_SOUND_MAX_DIST=0.
real SoundHelper_SOUND_DIST_CUT=0.
real array DynamicSound_targetPitch
real array DynamicSound_currentPitch
real array DynamicSound_smoothness
real array DynamicSound_minimumLength
integer array DynamicSound_soundData
integer array DynamicSound_TimedLoop_instances
integer DynamicSound_TimedLoop_instanceCount=0
triggercondition DynamicSound_TimedLoop_triggerCond=null
integer array DynamicSound_TimedLoop_mode
sound array SData_snd
integer array SData_soundData
unit array SData_onUnit
player array SData_p
integer array SData_s3s
integer array Sound_soundStack
string array Sound_file
integer array Sound_duration
boolean array Sound_looping
boolean array Sound_is3D
boolean array Sound_stopOnLeaveRange
integer array Sound_fadeIn
integer array Sound_fadeOut
string array Sound_eaxSetting
real array Sound_emuPos
real array Sound_emuPos_2
unit array Sound_emuUnit
code SoundQueue_c=null
integer array SoundQueue_queue
timer array SoundQueue_tm
integer array SEntry_elem_2
integer array SEntry_prev
integer array Stack_top
integer array Stack_size
string String_charset=null
string String_numberset=null
hashtable Table_ht=null
group TempGroups_ENUM_GROUP=null
integer Terrain_DUMMY_ITEM_ID=0
item Terrain_dItem=null
item array Terrain_hid
integer Terrain_hidMax=0
unit array Thread_threadSyncer
trigger Thread_syncThreadTrigger=null
integer array Thread_syncedPlayers
trigger TimedLoop_timedLoopTrig=null
integer TimedLoop_conditionCount=0
timer array TimerUtils_freeTimers
integer TimerUtils_freeTimersCount=0
integer TimerUtils_timerData=0
integer TimerUtils_HELD=0
real TrackableEx_doubleClickSpeed=0.
timer array TrackableEx_playerDoubleClickTimer
boolean array TrackableEx_playerClickBefore
integer TrackableEx_trackableOwner=0
integer TrackableEx_trackableObjects=0
integer array TrackableEx_onTrack
integer array TrackableEx_onClick
integer array TrackableEx_onDoubleClick
integer TypeCasting_typecastdata=0
unit array UnitIndex__unit
integer array FreeNode_nextFree
integer FreeNode_firstFree=0
integer FreeNode_maxIndex=0
integer array Cast_typeId
integer array ForGroupCallback_nextFree
integer ForGroupCallback_firstFree=0
integer ForGroupCallback_maxIndex=0
integer array ForGroupCallback_typeId
integer array CallbackSingle_nextFree
integer CallbackSingle_firstFree=0
integer CallbackSingle_maxIndex=0
integer array CallbackSingle_typeId
integer Collider_firstFree=0
integer array Collider_typeId
integer array DelayDat_nextFree
integer DelayDat_firstFree=0
integer DelayDat_maxIndex=0
integer array DelayDat_typeId
integer array Damager_typeId
integer DummyCaster_firstFree=0
integer array DummyCaster_typeId
integer array ArrayQueue_nextFree
integer ArrayQueue_firstFree=0
integer ArrayQueue_maxIndex=0
integer array ArrayQueue_typeId
integer array DelayNode_nextFree
integer DelayNode_firstFree=0
integer DelayNode_maxIndex=0
integer array DelayNode_typeId
integer Fx_firstFree=0
integer array Fx_typeId
integer array HashMap_nextFree
integer HashMap_firstFree=0
integer HashMap_maxIndex=0
integer array HashMap_typeId
integer array Order_nextFree
integer Order_firstFree=0
integer Order_maxIndex=0
integer array Order_typeId
integer array OrderQueue_nextFree
integer OrderQueue_firstFree=0
integer OrderQueue_maxIndex=0
integer array OrderQueue_typeId
integer LLEntry_firstFree=0
integer array LLEntry_typeId
integer LinkedList_firstFree=0
integer array LinkedList_typeId
integer array IdGenerator_nextFree
integer IdGenerator_firstFree=0
integer IdGenerator_maxIndex=0
integer array OrderStringFactory_nextFree
integer OrderStringFactory_firstFree=0
integer OrderStringFactory_maxIndex=0
integer array Queue_typeId
integer array Sim3DSound_nextFree
integer Sim3DSound_firstFree=0
integer Sim3DSound_maxIndex=0
integer array Sim3DSound_typeId
integer DynamicSound_firstFree=0
integer array DynamicSound_typeId
integer array SData_nextFree
integer SData_firstFree=0
integer SData_maxIndex=0
integer array SData_typeId
integer array Sound_typeId
integer SoundQueue_firstFree=0
integer array SoundQueue_typeId
integer array SEntry_nextFree
integer SEntry_firstFree=0
integer SEntry_maxIndex=0
integer array Stack_typeId
integer array Table_nextFree
integer Table_firstFree=0
integer Table_maxIndex=0
integer array Table_typeId
integer array Thread_typeId
integer array TrackableEx_typeId
integer array UnitIndex_nextFree
integer UnitIndex_firstFree=0
integer UnitIndex_maxIndex=0
integer array UnitIndex_typeId
integer array Damager_fct_0
integer array Damager_fct_1
integer array Damager_fct_2
real array Damager_fc_0
real array Damager_fc_1
real array Damager_fc_2
unit array ArrayQueue_units_0
unit array ArrayQueue_units_1
unit array ArrayQueue_units_2
unit array ArrayQueue_units_3
unit array ArrayQueue_units_4
unit array ArrayQueue_units_5
integer array OrderQueue_orders_0
integer array OrderQueue_orders_1
integer array OrderQueue_orders_2
real dispatch_Fx_Fx_Fx_getPos2_return_x=0.
real dispatch_Fx_Fx_Fx_getPos2_return_y=0.
real unit_getPos_return_x=0.
real unit_getPos_return_y=0.
real vec2_toVec3_return_x=0.
real vec2_toVec3_return_y=0.
real vec2_toVec3_return_z=0.
real vec3_toVec2_return_x=0.
real vec3_toVec2_return_y=0.
real vec2_op_plus_return_x=0.
real vec2_op_plus_return_y=0.
real vec2_op_mult_return_x=0.
real vec2_op_mult_return_y=0.
real vec2_withZ_return_x=0.
real vec2_withZ_return_y=0.
real vec2_withZ_return_z=0.
real Fx_getPos2_return_x=0.
real Fx_getPos2_return_y=0.
code ref_function_init_String=null
code ref_function_init_Table=null
code ref_function_init_Trigger=null
code ref_function_init_Player=null
code ref_function_init_PrintingHelper=null
code ref_function_init_MagicFunctions=null
code ref_function_init_Basics=null
code ref_function_init_GameTimer=null
code ref_function_init_ErrorHandling_config=null
code ref_function_init_ErrorHandling=null
code ref_function_init_TimerUtils=null
code ref_function_init_Maths=null
code ref_function_init_Vectors=null
code ref_function_init_TempGroups=null
code ref_function_init_Colors=null
code ref_function_init_Rect=null
code ref_function_init_Terrain=null
code ref_function_init_TypeCasting=null
code ref_function_init_ObjectIds=null
code ref_function_init_ObjectIdGenerator=null
code ref_function_init_ChannelAbilityPreset=null
code ref_function_init_AbilityTooltipGenerator_config=null
code ref_function_init_AbilityTooltipGenerator=null
code ref_function_init_ArrayList=null
code ref_function_init_Assets=null
code ref_function_init_BigNum=null
code ref_function_init_Char=null
code ref_function_init_HashMap=null
code ref_function_init_DelayedDestroy=null
code ref_function_init_ClosureEvents=null
code ref_function_init_ClosureForGroups=null
code ref_function_init_Region=null
code ref_function_init_MapBounds=null
code ref_function_init_DummyRecycler=null
code ref_function_init_TimedLoop=null
code ref_function_init_Collider=null
code ref_function_init_CustomBar=null
code ref_function_init_CustomExp=null
code ref_function_init_RegisterEvents=null
code ref_function_init_OnUnitEnterLeave=null
code ref_function_init_DamageDetection=null
code ref_function_init_DamageType=null
code ref_function_init_Damager=null
code ref_function_init_LinkedListModule=null
code ref_function_init_DmgMod=null
code ref_function_init_DummyCaster=null
code ref_function_init_EventHandling=null
code ref_function_init_FileIO=null
code ref_function_init_HashList=null
code ref_function_init_InstanceBoard=null
code ref_function_init_InstantDummyCaster=null
code ref_function_init_Knockback=null
code ref_function_init_Knockback3=null
code ref_function_init_LastOrder=null
code ref_function_init_PreloadHandler=null
code ref_function_init_Simulate3dSound=null
code ref_function_init_SoundHelper=null
code ref_function_init_SoundQueue=null
code ref_function_init_SpellDesignConfig=null
code ref_function_init_StandardTextTags=null
code ref_function_init_Thread=null
code ref_function_init_Sync=null
code ref_function_init_Trackable=null
code ref_function_init_UnitIndexer=null
code ref_function_handleCasts=null
code ref_function_filter=null
code ref_function_CallbackSingle_staticCallback=null
code ref_function_Collider_TimedLoop_onExpire=null
code ref_function_giveXP=null
code ref_function_disableXpGain=null
code ref_function_filter_2=null
code ref_function_DamageDetection_closure_impl=null
code ref_function_DamageDetection_closure_impl_2=null
code ref_function_swap=null
code ref_function_DamageDetection_closure_impl_3=null
code ref_function_DamageType_closure_impl=null
code ref_function_handler=null
code ref_function_after=null
code ref_function_damageAOE_Enum=null
code ref_function_damageAOE_DestructablesEnum=null
code ref_function_DummyCaster_filterAOE=null
code ref_function_DummyCaster_closure_impl=null
code ref_function_DelayNode_recycle=null
code ref_function_evaluateEvent=null
code ref_function_LocalFileTest_onInit=null
code ref_function_GameTimer_closure_impl=null
code ref_function_createMultiboard=null
code ref_function_actions=null
code ref_function_spellActions=null
code ref_function_LastOrder_closure_impl=null
code ref_function_OnUnitEnterLeave_closure_impl=null
code ref_function_OnUnitEnterLeave_closure_impl_2=null
code ref_function_finishPreload=null
code ref_function_switchDebug=null
code ref_function_RegisterEvents_closure_impl=null
code ref_function_Sim3DSound_expire=null
code ref_function_DynamicSound_TimedLoop_onExpire=null
code ref_function_Sound_playSound=null
code ref_function_Sound_recycle=null
code ref_function_SoundQueue_nextSound=null
code ref_function_initGamecache=null
code ref_function_Thread_syncThread=null
code ref_function_TrackableEx_closure_impl=null
code ref_function_TrackableEx_closure_impl_2=null
code ref_function_TrackableEx_closure_impl_3=null
code ref_function_UnitIndexer_closure_impl=null
code ref_function_UnitIndexer_closure_impl_2=null
unit DummyCaster_createDummyCastertempReturn=null
unit createDummytempReturn=null
unit DummyRecycler_gettempReturn=null
unit group_nexttempReturn=null
texttag createTTExtempReturn=null
timer getTimertempReturn=null
unit dispatch_DummyCaster_DummyCaster_DummyCaster_createDummyCastertempReturn=null
unit dispatch_ArrayQueue_DummyRecycler_ArrayQueue_dequeuetempReturn=null
player dispatch_Table_Table_Table_loadPlayertempReturn=null
unit dispatch_Table_Table_Table_loadUnittempReturn=null
trigger dispatch_Table_Table_Table_loadTriggertempReturn=null
unit ArrayQueue_units_gettempReturn=null
endglobals
function group_destr takes group this returns nothing
	call DestroyGroup(this)
endfunction

function group_removeUnit takes group this, unit u returns nothing
	call GroupRemoveUnit(this, u)
endfunction

function trigger_evaluate takes trigger this returns nothing
	call TriggerEvaluate(this)
endfunction

function unit_addAbility takes unit this, integer abil returns boolean
	return UnitAddAbility(this, abil)
endfunction

function unit_makeAbilityPermanent takes unit this, integer abil, boolean flag returns boolean
	return UnitMakeAbilityPermanent(this, flag, abil)
endfunction

function OnUnitEnterLeave_closure_impl takes integer this returns nothing
	loop
		exitwhen  not true
		set OnUnitEnterLeave_tempUnit = FirstOfGroup(g[this])
		if OnUnitEnterLeave_tempUnit == null then
			exitwhen true
		endif
		call unit_addAbility(OnUnitEnterLeave_tempUnit, OnUnitEnterLeave_ABILITY_ID)
		call unit_makeAbilityPermanent(OnUnitEnterLeave_tempUnit, OnUnitEnterLeave_ABILITY_ID, true)
		call group_removeUnit(g[this], OnUnitEnterLeave_tempUnit)
		call trigger_evaluate(OnUnitEnterLeave_eventTrigger)
	endloop
	call group_destr(g[this])
endfunction

function hashtable_hasBoolean takes hashtable this, integer parentKey, integer childKey returns boolean
	return HaveSavedBoolean(this, parentKey, childKey)
endfunction

function hashtable_hasInt takes hashtable this, integer parentKey, integer childKey returns boolean
	return HaveSavedInteger(this, parentKey, childKey)
endfunction

function hashtable_loadBoolean takes hashtable this, integer parentKey, integer childKey returns boolean
	return LoadBoolean(this, parentKey, childKey)
endfunction

function hashtable_loadInt takes hashtable this, integer parentKey, integer childKey returns integer
	return LoadInteger(this, parentKey, childKey)
endfunction

function hashtable_saveBoolean takes hashtable this, integer parentKey, integer childKey, boolean value returns nothing
	call SaveBoolean(this, parentKey, childKey, value)
endfunction

function hashtable_saveInt takes hashtable this, integer parentKey, integer childKey, integer value returns nothing
	call SaveInteger(this, parentKey, childKey, value)
endfunction

function print takes string msg returns nothing
	call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., PrintingHelper_DEBUG_MSG_DURATION, msg)
endfunction

function real_toInt takes real this returns integer
	return R2I(this)
endfunction

function error takes string msg returns nothing
	local integer hash = StringHash(msg)
	if hashtable_hasInt(Table_ht, ErrorHandling_PRIMARY_ERROR_KEY, hash) then
		if hashtable_loadInt(Table_ht, ErrorHandling_PRIMARY_ERROR_KEY, hash) + ErrorHandling_MUTE_ERROR_DURATION < GameTimer_currentTime then
			call print("|cffFF3A29Error:|r " + msg + "")
			call hashtable_saveInt(Table_ht, ErrorHandling_PRIMARY_ERROR_KEY, hash, real_toInt(GameTimer_currentTime))
			call hashtable_saveBoolean(Table_ht, ErrorHandling_PRIMARY_ERROR_KEY, hash, false)
		elseif hashtable_hasBoolean(Table_ht, ErrorHandling_PRIMARY_ERROR_KEY, hash) then
			if  not hashtable_loadBoolean(Table_ht, ErrorHandling_PRIMARY_ERROR_KEY, hash) then
				call print("|cffFF3A29Excessive repeating errors are being omitted")
				call hashtable_saveBoolean(Table_ht, ErrorHandling_PRIMARY_ERROR_KEY, hash, true)
			endif
		else
			call print("|cffFF3A29Excessive repeating errors are being omitted")
			call hashtable_saveBoolean(Table_ht, ErrorHandling_PRIMARY_ERROR_KEY, hash, true)
		endif
	else
		call hashtable_saveInt(Table_ht, ErrorHandling_PRIMARY_ERROR_KEY, hash, real_toInt(GameTimer_currentTime))
		call print("|cffFF3A29Error:|r " + msg + "")
	endif
	call I2S(1 / 0)
endfunction

function dispatch_CallbackSingle_ClosureTimers_CallbackSingle_call takes integer this returns nothing
	if CallbackSingle_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling CallbackSingle.call")
		else
			call error("Called CallbackSingle.call on invalid object.")
		endif
	endif
	call OnUnitEnterLeave_closure_impl(this)
endfunction

function CallbackSingle_onDestroy takes integer this returns nothing
endfunction

function dealloc_CallbackSingle takes integer obj returns nothing
	if CallbackSingle_typeId[obj] == 0 then
		call error("Double free: object of type CallbackSingle")
	else
		set CallbackSingle_nextFree[CallbackSingle_firstFree] = obj
		set CallbackSingle_firstFree = CallbackSingle_firstFree + 1
		set CallbackSingle_typeId[obj] = 0
	endif
endfunction

function destroyCallbackSingle takes integer this returns nothing
	call CallbackSingle_onDestroy(this)
	call dealloc_CallbackSingle(this)
endfunction

function dispatch_CallbackSingle_destroyCallbackSingle takes integer this returns nothing
	if CallbackSingle_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling CallbackSingle.CallbackSingle")
		else
			call error("Called CallbackSingle.CallbackSingle on invalid object.")
		endif
	endif
	call destroyCallbackSingle(this)
endfunction

function Table_loadInt takes integer this, integer parentKey returns integer
	return hashtable_loadInt(Table_ht, this, parentKey)
endfunction

function dispatch_Table_Table_Table_loadInt takes integer this, integer parentKey returns integer
	local integer Table_Table_loadInt_result
	if Table_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling Table.loadInt")
		else
			call error("Called Table.loadInt on invalid object.")
		endif
	endif
	set Table_Table_loadInt_result = Table_loadInt(this, parentKey)
	return Table_Table_loadInt_result
endfunction

function timer_getData takes timer this returns integer
	return dispatch_Table_Table_Table_loadInt(TimerUtils_timerData, GetHandleId(this))
endfunction

function timer_pause takes timer this returns nothing
	call PauseTimer(this)
endfunction

function Table_saveInt takes integer this, integer parentKey, integer value returns nothing
	call hashtable_saveInt(Table_ht, this, parentKey, value)
endfunction

function dispatch_Table_Table_Table_saveInt takes integer this, integer parentKey, integer value returns nothing
	if Table_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling Table.saveInt")
		else
			call error("Called Table.saveInt on invalid object.")
		endif
	endif
	call Table_saveInt(this, parentKey, value)
endfunction

function timer_setData takes timer this, integer data returns nothing
	call dispatch_Table_Table_Table_saveInt(TimerUtils_timerData, GetHandleId(this), data)
endfunction

function timer_release takes timer this returns nothing
	if this == null then
		call error("Trying to release a null timer")
		return
	endif
	if timer_getData(this) == TimerUtils_HELD then
		call error("ReleaseTimer: Double free!")
		return
	endif
	call timer_setData(this, TimerUtils_HELD)
	call timer_pause(this)
	set TimerUtils_freeTimers[TimerUtils_freeTimersCount] = this
	set TimerUtils_freeTimersCount = TimerUtils_freeTimersCount + 1
endfunction

function CallbackSingle_staticCallback takes nothing returns nothing
	local timer t = GetExpiredTimer()
	local integer cb = timer_getData(t)
	call dispatch_CallbackSingle_ClosureTimers_CallbackSingle_call(cb)
	call dispatch_CallbackSingle_destroyCallbackSingle(cb)
	call timer_release(t)
	set t = null
endfunction

function real_asAngleRadians takes real this returns real
	return this
endfunction

function angleBetweenCoords takes real x1, real y1, real x2, real y2 returns real
	return real_asAngleRadians(Atan2(y2 - y1, x2 - x1))
endfunction

function angle_cos takes real this_radians returns real
	return Cos(this_radians)
endfunction

function angle_op_minus takes real this_radians, real other_radians returns real
	return this_radians - other_radians
endfunction

function angle_radians takes real this_radians returns real
	return this_radians
endfunction

function angle_sin takes real this_radians returns real
	return Sin(this_radians)
endfunction

function dispatch_Collider_Collider_Collider_loopControl takes integer this returns nothing
endfunction

function dispatch_Collider_Collider_Collider_onUnitHit takes integer this, unit hitTarget returns nothing
endfunction

function Collider_TimedLoop_stopTimedLoop takes integer this returns nothing
	set Collider_TimedLoop_mode[this] = 2
endfunction

function dispatch_Collider_Collider_Collider_TimedLoop_stopTimedLoop takes integer this returns nothing
	if Collider_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling Collider.stopTimedLoop")
		else
			call error("Called Collider.stopTimedLoop on invalid object.")
		endif
	endif
	call Collider_TimedLoop_stopTimedLoop(this)
endfunction

function alloc_DelayNode takes nothing returns integer
	local integer this
	if DelayNode_firstFree == 0 then
		if DelayNode_maxIndex < 32768 then
			set DelayNode_maxIndex = DelayNode_maxIndex + 1
			set this = DelayNode_maxIndex
			set DelayNode_typeId[this] = 652
		else
			call error("Out of memory: Could not create DelayNode.")
			set this = 0
		endif
	else
		set DelayNode_firstFree = DelayNode_firstFree - 1
		set this = DelayNode_nextFree[DelayNode_firstFree]
		set DelayNode_typeId[this] = 652
	endif
	return this
endfunction

function timer_getElapsed takes timer this returns real
	return TimerGetElapsed(this)
endfunction

function getElapsedGameTime takes nothing returns real
	return timer_getElapsed(GameTimer_gameTimer)
endfunction

function timer_getRemaining takes timer this returns real
	return TimerGetRemaining(this)
endfunction

function timer_start takes timer this, real time, code timerCallBack returns nothing
	call TimerStart(this, time, false, timerCallBack)
endfunction

function construct_DelayNode takes integer this, unit u, real time returns nothing
	local integer tmp
	set DelayNode_next[this] = 0
	set DelayNode_u[this] = u
	set DelayNode_delayTime[this] = getElapsedGameTime() + time
	if DelayNode_first == 0 then
		set DelayNode_first = this
		set DelayNode_last = DelayNode_first
	else
		set tmp = DelayNode_first
		loop
			exitwhen  not (DelayNode_next[tmp] != 0 and DelayNode_delayTime[tmp] < DelayNode_delayTime[this])
			set tmp = DelayNode_next[tmp]
		endloop
		if DelayNode_delayTime[tmp] < DelayNode_delayTime[this] then
			if tmp == DelayNode_last then
				set DelayNode_next[tmp] = this
				set DelayNode_last = this
			else
				set DelayNode_next[this] = DelayNode_next[tmp]
				set DelayNode_next[tmp] = this
			endif
		elseif tmp == DelayNode_first then
			set DelayNode_first = this
			set DelayNode_next[this] = tmp
		elseif tmp == DelayNode_last then
			set DelayNode_next[tmp] = this
			set DelayNode_last = tmp
		else
			set DelayNode_next[this] = DelayNode_next[tmp]
			set DelayNode_next[tmp] = this
		endif
		if timer_getRemaining(DelayNode_t) > 0. and time < timer_getRemaining(DelayNode_t) then
			call timer_start(DelayNode_t, time, ref_function_DelayNode_recycle)
		elseif timer_getRemaining(DelayNode_t) <= 0. then
			call timer_start(DelayNode_t, time, ref_function_DelayNode_recycle)
		endif
	endif
endfunction

function new_DelayNode takes unit u, real time returns integer
	local integer this = alloc_DelayNode()
	call construct_DelayNode(this, u, time)
	return this
endfunction

function DummyRecycler_recycle takes unit u, real delay returns nothing
	call new_DelayNode(u, delay)
endfunction

function effect_destr takes effect this returns nothing
	call DestroyEffect(this)
endfunction

function Fx_onDestroy takes integer this returns nothing
	if Fx_fx[this] != null then
		call effect_destr(Fx_fx[this])
	endif
	call DummyRecycler_recycle(Fx_dummy[this], 1.)
endfunction

function dealloc_Fx takes integer obj returns nothing
	if Fx_typeId[obj] == 0 then
		call error("Double free: object of type Fx")
	else
		set Fx_firstFree = Fx_firstFree + 1
		set Fx_typeId[obj] = 0
	endif
endfunction

function destroyFx takes integer this returns nothing
	call Fx_onDestroy(this)
	call dealloc_Fx(this)
endfunction

function dispatch_Fx_destroyFx takes integer this returns nothing
	if Fx_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling Fx.Fx")
		else
			call error("Called Fx.Fx on invalid object.")
		endif
	endif
	call destroyFx(this)
endfunction

function unit_setPos takes unit this, real x, real y returns nothing
	call SetUnitPosition(this, x, y)
endfunction

function Fx_hiddenDestroy takes integer this returns nothing
	call unit_setPos(Fx_dummy[this], 2147483647., 2147483647.)
	call dispatch_Fx_destroyFx(this)
endfunction

function dispatch_Fx_Fx_Fx_hiddenDestroy takes integer this returns nothing
	if Fx_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling Fx.hiddenDestroy")
		else
			call error("Called Fx.hiddenDestroy on invalid object.")
		endif
	endif
	call Fx_hiddenDestroy(this)
endfunction

function LLEntry_onDestroy takes integer this returns nothing
endfunction

function dealloc_LLEntry takes integer obj returns nothing
	if LLEntry_typeId[obj] == 0 then
		call error("Double free: object of type LLEntry")
	else
		set LLEntry_firstFree = LLEntry_firstFree + 1
		set LLEntry_typeId[obj] = 0
	endif
endfunction

function destroyLLEntry takes integer this returns nothing
	call LLEntry_onDestroy(this)
	call dealloc_LLEntry(this)
endfunction

function dispatch_LLEntry_destroyLLEntry takes integer this returns nothing
	if LLEntry_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling LLEntry.LLEntry")
		else
			call error("Called LLEntry.LLEntry on invalid object.")
		endif
	endif
	call destroyLLEntry(this)
endfunction

function LinkedList_onDestroy takes integer this returns nothing
	local integer current = LLEntry_next[LinkedList_dummy[this]]
	loop
		exitwhen  not (current != LinkedList_dummy[this])
		set current = LLEntry_next[current]
		call dispatch_LLEntry_destroyLLEntry(LLEntry_prev[current])
	endloop
	call dispatch_LLEntry_destroyLLEntry(LinkedList_dummy[this])
endfunction

function dealloc_LinkedList takes integer obj returns nothing
	if LinkedList_typeId[obj] == 0 then
		call error("Double free: object of type LinkedList")
	else
		set LinkedList_firstFree = LinkedList_firstFree + 1
		set LinkedList_typeId[obj] = 0
	endif
endfunction

function destroyLinkedList takes integer this returns nothing
	call LinkedList_onDestroy(this)
	call dealloc_LinkedList(this)
endfunction

function dispatch_LinkedList_destroyLinkedList takes integer this returns nothing
	if LinkedList_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling LinkedList.LinkedList")
		else
			call error("Called LinkedList.LinkedList on invalid object.")
		endif
	endif
	call destroyLinkedList(this)
endfunction

function printWarning takes string msg returns nothing
	call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., PrintingHelper_DEBUG_MSG_DURATION, "|cffFF8000[WARNING]|r - " + msg)
endfunction

function Collider_onDestroy takes integer this returns nothing
	call dispatch_LinkedList_destroyLinkedList(Collider_seenIds[this])
	if Collider_silent[this] then
		call dispatch_Fx_Fx_Fx_hiddenDestroy(Collider_fx[this])
	else
		call dispatch_Fx_destroyFx(Collider_fx[this])
	endif
	call dispatch_Collider_Collider_Collider_TimedLoop_stopTimedLoop(this)
	if Collider_TimedLoop_mode[this] != 1 then
		call dispatch_Collider_Collider_Collider_TimedLoop_stopTimedLoop(this)
		call printWarning("Destroyed Instance using TimedLoop before stopping the Loop")
	endif
endfunction

function dealloc_Collider takes integer obj returns nothing
	if Collider_typeId[obj] == 0 then
		call error("Double free: object of type Collider")
	else
		set Collider_firstFree = Collider_firstFree + 1
		set Collider_typeId[obj] = 0
	endif
endfunction

function destroyCollider takes integer this returns nothing
	call Collider_onDestroy(this)
	call dealloc_Collider(this)
endfunction

function dispatch_Collider_destroyCollider takes integer this returns nothing
	if Collider_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling Collider.Collider")
		else
			call error("Called Collider.Collider on invalid object.")
		endif
	endif
	call destroyCollider(this)
endfunction

function unit_getX takes unit this returns real
	return GetUnitX(this)
endfunction

function Fx_getX takes integer this returns real
	return unit_getX(Fx_dummy[this])
endfunction

function dispatch_Fx_Fx_Fx_getX takes integer this returns real
	local real Fx_Fx_getX_result
	if Fx_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling Fx.getX")
		else
			call error("Called Fx.getX on invalid object.")
		endif
	endif
	set Fx_Fx_getX_result = Fx_getX(this)
	return Fx_Fx_getX_result
endfunction

function unit_getY takes unit this returns real
	return GetUnitY(this)
endfunction

function Fx_getY takes integer this returns real
	return unit_getY(Fx_dummy[this])
endfunction

function dispatch_Fx_Fx_Fx_getY takes integer this returns real
	local real Fx_Fx_getY_result
	if Fx_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling Fx.getY")
		else
			call error("Called Fx.getY on invalid object.")
		endif
	endif
	set Fx_Fx_getY_result = Fx_getY(this)
	return Fx_Fx_getY_result
endfunction

function Fx_getPos2 takes integer this returns real
	set Fx_getPos2_return_x = dispatch_Fx_Fx_Fx_getX(this)
	set Fx_getPos2_return_y = dispatch_Fx_Fx_Fx_getY(this)
	return Fx_getPos2_return_x
endfunction

function dispatch_Fx_Fx_Fx_getPos2 takes integer this returns real
	local real Fx_Fx_getPos2_result_x
	local real Fx_Fx_getPos2_result_y
	local real temp_Fx_Fx_getPos2_result_x
	local real temp_Fx_Fx_getPos2_result_y
	if Fx_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling Fx.getPos2")
		else
			call error("Called Fx.getPos2 on invalid object.")
		endif
	endif
	set temp_Fx_Fx_getPos2_result_x = Fx_getPos2(this)
	set temp_Fx_Fx_getPos2_result_y = Fx_getPos2_return_y
	set Fx_Fx_getPos2_result_x = temp_Fx_Fx_getPos2_result_x
	set Fx_Fx_getPos2_result_y = temp_Fx_Fx_getPos2_result_y
	set dispatch_Fx_Fx_Fx_getPos2_return_x = Fx_Fx_getPos2_result_x
	set dispatch_Fx_Fx_Fx_getPos2_return_y = Fx_Fx_getPos2_result_y
	return dispatch_Fx_Fx_Fx_getPos2_return_x
endfunction

function real_asAngleDegrees takes real this returns real
	return this * Maths_DEGTORAD
endfunction

function unit_getFacing takes unit this returns real
	return GetUnitFacing(this)
endfunction

function Fx_getXYAngle takes integer this returns real
	return real_asAngleDegrees(unit_getFacing(Fx_dummy[this]))
endfunction

function dispatch_Fx_Fx_Fx_getXYAngle takes integer this returns real
	local real Fx_Fx_getXYAngle_result_radians
	if Fx_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling Fx.getXYAngle")
		else
			call error("Called Fx.getXYAngle on invalid object.")
		endif
	endif
	set Fx_Fx_getXYAngle_result_radians = Fx_getXYAngle(this)
	return Fx_Fx_getXYAngle_result_radians
endfunction

function unit_setXY takes unit this, real pos_x, real pos_y returns nothing
	call SetUnitX(this, pos_x)
	call SetUnitY(this, pos_y)
endfunction

function Fx_setXY takes integer this, real pos_x, real pos_y returns nothing
	call unit_setXY(Fx_dummy[this], pos_x, pos_y)
endfunction

function dispatch_Fx_Fx_Fx_setXY takes integer this, real pos_x, real pos_y returns nothing
	if Fx_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling Fx.setXY")
		else
			call error("Called Fx.setXY on invalid object.")
		endif
	endif
	call Fx_setXY(this, pos_x, pos_y)
endfunction

function angle_degrees takes real this_radians returns real
	return this_radians * Maths_RADTODEG
endfunction

function unit_setFacing takes unit this, real a_radians returns nothing
	call SetUnitFacing(this, angle_degrees(a_radians))
endfunction

function Fx_setXYAngle takes integer this, real value_radians returns nothing
	call unit_setFacing(Fx_dummy[this], value_radians)
endfunction

function dispatch_Fx_Fx_Fx_setXYAngle takes integer this, real value_radians returns nothing
	if Fx_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling Fx.setXYAngle")
		else
			call error("Called Fx.setXYAngle on invalid object.")
		endif
	endif
	call Fx_setXYAngle(this, value_radians)
endfunction

function LinkedList_contains takes integer this, integer elem returns boolean
	local integer r = LLEntry_next[LinkedList_dummy[this]]
	loop
		exitwhen  not (r != LinkedList_dummy[this])
		if LLEntry_elem[r] == elem then
			return true
		endif
		set r = LLEntry_next[r]
	endloop
	return false
endfunction

function dispatch_LinkedList_LinkedList_LinkedList_contains takes integer this, integer elem returns boolean
	local boolean LinkedList_LinkedList_contains_result
	if LinkedList_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling LinkedList.contains")
		else
			call error("Called LinkedList.contains on invalid object.")
		endif
	endif
	set LinkedList_LinkedList_contains_result = LinkedList_contains(this, elem)
	return LinkedList_LinkedList_contains_result
endfunction

function group_clear takes group this returns nothing
	call GroupClear(this)
endfunction

function group_close takes group this returns nothing
	call DestroyGroup(this)
endfunction

function group_hasNext takes group this returns boolean
	return FirstOfGroup(this) != null
endfunction

function group_iterator takes group this returns group
	set bj_groupAddGroupDest = CreateGroup()
	call ForGroup(this, function GroupAddGroupEnum)
	return bj_groupAddGroupDest
endfunction

function group_next takes group this returns unit
	local unit u = FirstOfGroup(this)
	call GroupRemoveUnit(this, u)
	set group_nexttempReturn = u
	set u = null
	return group_nexttempReturn
endfunction

function handle_getHandleId takes handle this returns integer
	return GetHandleId(this)
endfunction

function unit_getPos takes unit this returns real
	set unit_getPos_return_x = unit_getX(this)
	set unit_getPos_return_y = unit_getY(this)
	return unit_getPos_return_x
endfunction

function Collider_onTimedLoop takes integer this returns nothing
	local real anglexy_radians
	local real df1
	local real df2
	local real ns
	local real d
	local real dt
	local real newP_x
	local real newP_y
	local group itr
	local unit u
	local group from
	local real tempTupleSelectionResult_1
	local real temp_tempTupleSelectionResult_1
	local real tempTupleSelectionResult_2
	local real temp_tempTupleSelectionResult_2
	local integer tempIndex
	local real tempTupleSelectionResult_1_2
	local real temp_tempTupleSelectionResult_1_2
	local integer tempIndex_2
	local real tempTupleSelectionResult_2_2
	local real temp_tempTupleSelectionResult_2_2
	local integer tempIndex_3
	local real temp_newP_x
	local real temp_newP_y
	local real temp
	local real temp_2
	local real temp_3
	set Collider_expirationTime[this] = Collider_expirationTime[this] - Basics_ANIMATION_PERIOD
	if Collider_dead[this] or Collider_expirationTime[this] <= 0.0 then
		call dispatch_Collider_destroyCollider(this)
	else
		set temp_tempTupleSelectionResult_1 = dispatch_Fx_Fx_Fx_getPos2(Collider_fx[this])
		set tempTupleSelectionResult_1 = temp_tempTupleSelectionResult_1
		set temp = tempTupleSelectionResult_1
		call dispatch_Fx_Fx_Fx_getPos2(Collider_fx[this])
		set temp_tempTupleSelectionResult_2 = dispatch_Fx_Fx_Fx_getPos2_return_y
		set tempTupleSelectionResult_2 = temp_tempTupleSelectionResult_2
		set temp_2 = tempTupleSelectionResult_2
		set tempIndex = this
		set temp_tempTupleSelectionResult_1_2 = Collider_homingTarget[tempIndex]
		set tempTupleSelectionResult_1_2 = temp_tempTupleSelectionResult_1_2
		set temp_3 = tempTupleSelectionResult_1_2
		set tempIndex_2 = this
		set temp_tempTupleSelectionResult_2_2 = Collider_homingTarget_2[tempIndex_2]
		set tempTupleSelectionResult_2_2 = temp_tempTupleSelectionResult_2_2
		set anglexy_radians = angleBetweenCoords(temp, temp_2, temp_3, tempTupleSelectionResult_2_2)
		set df1 = angle_radians(angle_op_minus(anglexy_radians, dispatch_Fx_Fx_Fx_getXYAngle(Collider_fx[this])))
		set df2 = Maths_PI2 + angle_radians(anglexy_radians) - angle_radians(dispatch_Fx_Fx_Fx_getXYAngle(Collider_fx[this]))
		set ns = Collider_angleSpeed[this]
		if ns != 0.0 then
			if Collider_angleMode[this] == 1 then
				if GetUnitTypeId(Collider_homingTargetUnit[this]) == 0 or IsUnitType(Collider_homingTargetUnit[this], UNIT_TYPE_DEAD) then
					set Collider_angleMode[this] = 0
					set Collider_homingTargetUnit[this] = null
				else
					set tempIndex_3 = this
					set Collider_homingTarget[tempIndex_3] = unit_getPos(Collider_homingTargetUnit[this])
					set Collider_homingTarget_2[tempIndex_3] = unit_getPos_return_y
				endif
			endif
			if ( not (Collider_angleMode[this] == 3)) and Collider_angleMode[this] != 0 then
				if ns <= 0. then
					set ns =  - ns
				endif
				if df1 <= 0. then
					if df2 <= 0. then
						if df2 >= df1 then
							set df1 = df2
						endif
					elseif ( - df1) >= df2 then
						set df1 = df2
					endif
				elseif df2 <= 0. then
					if ( - df2) <= df1 then
						set df1 = df2
					endif
				elseif df2 <= df1 then
					set df1 = df2
				endif
				if df1 <= 0. then
					if ( - df1) >= ns then
						set ns =  - ns
					else
						set ns = df1
					endif
				elseif df1 <= ns then
					set ns = df1
				endif
				set d = angle_radians(dispatch_Fx_Fx_Fx_getXYAngle(Collider_fx[this]))
				set d = d + ns
				if d >= Maths_PI2 then
					set d = d - Maths_PI2
				elseif d < 0. then
					set d = d + Maths_PI2
				endif
				call dispatch_Fx_Fx_Fx_setXYAngle(Collider_fx[this], d)
			endif
		endif
		set ns = Collider_speed[this] + Collider_acceleration[this] * Basics_ANIMATION_PERIOD
		if ns < Collider_minSpeed[this] then
			set ns = Collider_minSpeed[this]
		elseif ns > Collider_maxSpeed[this] then
			set ns = Collider_maxSpeed[this]
		endif
		set dt = (Collider_speed[this] + ns) / 2. * Basics_ANIMATION_PERIOD
		set Collider_speed[this] = ns
		set temp_newP_x = dispatch_Fx_Fx_Fx_getX(Collider_fx[this]) + dt * angle_cos(dispatch_Fx_Fx_Fx_getXYAngle(Collider_fx[this]))
		set temp_newP_y = dispatch_Fx_Fx_Fx_getY(Collider_fx[this]) + dt * angle_sin(dispatch_Fx_Fx_Fx_getXYAngle(Collider_fx[this]))
		set newP_x = temp_newP_x
		set newP_y = temp_newP_y
		call dispatch_Fx_Fx_Fx_setXY(Collider_fx[this], newP_x, newP_y)
		call GroupEnumUnitsInRange(TempGroups_ENUM_GROUP, newP_x, newP_y, Collider_collisionSize[this] + Basics_MAX_COLLISION_SIZE, null)
		set itr = group_iterator(TempGroups_ENUM_GROUP)
		set from = itr
		loop
			exitwhen  not group_hasNext(from)
			set u = group_next(from)
			if ( not IsUnitType(u, UNIT_TYPE_DEAD)) and ( not Collider_dead[this]) and GetUnitTypeId(u) != Basics_DUMMY_UNIT_ID and IsUnitInRangeXY(u, newP_x, newP_y, Collider_collisionSize[this]) then
				if  not dispatch_LinkedList_LinkedList_LinkedList_contains(Collider_seenIds[this], handle_getHandleId(u)) then
					call dispatch_Collider_Collider_Collider_onUnitHit(this, u)
				endif
			endif
		endloop
		call group_close(itr)
		call group_clear(TempGroups_ENUM_GROUP)
		if  not Collider_dead[this] then
			call dispatch_Collider_Collider_Collider_loopControl(this)
		endif
	endif
	set itr = null
	set u = null
	set from = null
endfunction

function dispatch_Collider_Collider_Collider_onTimedLoop takes integer this returns nothing
	if Collider_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling Collider.onTimedLoop")
		else
			call error("Called Collider.onTimedLoop on invalid object.")
		endif
	endif
	call Collider_onTimedLoop(this)
endfunction

function Collider_TimedLoop_onExpire takes nothing returns boolean
	local integer i = Collider_TimedLoop_instanceCount - 1
	local integer t
	loop
		exitwhen  not (i >= 0)
		set t = Collider_TimedLoop_instances[i]
		call dispatch_Collider_Collider_Collider_onTimedLoop(t)
		if Collider_TimedLoop_mode[t] != 0 then
			set Collider_TimedLoop_instanceCount = Collider_TimedLoop_instanceCount - 1
			set Collider_TimedLoop_instances[i] = Collider_TimedLoop_instances[Collider_TimedLoop_instanceCount]
			if Collider_TimedLoop_mode[t] == 3 then
				set Collider_TimedLoop_mode[t] = 1
				call dispatch_Collider_destroyCollider(t)
			else
				set Collider_TimedLoop_mode[t] = 1
			endif
		endif
		set i = i - 1
	endloop
	if Collider_TimedLoop_instanceCount == 0 then
		call TriggerRemoveCondition(TimedLoop_timedLoopTrig, Collider_TimedLoop_triggerCond)
		set Collider_TimedLoop_triggerCond = null
		set TimedLoop_conditionCount = TimedLoop_conditionCount - 1
	endif
	return false
endfunction

function getEnterLeaveUnit takes nothing returns unit
	return OnUnitEnterLeave_tempUnit
endfunction

function unit_detectAddFilter takes unit this returns nothing
	call TriggerRegisterUnitEvent(DamageDetection_current, this, EVENT_UNIT_DAMAGED)
endfunction

function DamageDetection_closure_impl takes nothing returns nothing
	call unit_detectAddFilter(getEnterLeaveUnit())
endfunction

function DamageDetection_closure_impl_2 takes nothing returns nothing
	call unit_detectAddFilter(GetFilterUnit())
endfunction

function DamageDetection_closure_impl_3 takes nothing returns nothing
	call unit_detectAddFilter(GetFilterUnit())
endfunction

function DamageType_closure_impl takes nothing returns nothing
	local unit receiver = GetTriggerUnit()
	local unit receiver_2
	call unit_addAbility(receiver, DamageType_DAMAGE_TYPE_CHECK_ID)
	set receiver_2 = receiver
	call unit_makeAbilityPermanent(receiver_2, DamageType_DAMAGE_TYPE_CHECK_ID, true)
	set receiver = null
	set receiver_2 = null
endfunction

function ArrayQueue_units_set takes integer instanceId, integer arrayIndex, unit value returns nothing
	if arrayIndex < 0 or arrayIndex >= 6 then
		call error("Index out of Bounds")
	elseif arrayIndex <= 2 then
		if arrayIndex <= 1 then
			if arrayIndex <= 0 then
				set ArrayQueue_units_0[instanceId] = value
			else
				set ArrayQueue_units_1[instanceId] = value
			endif
		else
			set ArrayQueue_units_2[instanceId] = value
		endif
	elseif arrayIndex <= 4 then
		if arrayIndex <= 3 then
			set ArrayQueue_units_3[instanceId] = value
		else
			set ArrayQueue_units_4[instanceId] = value
		endif
	else
		set ArrayQueue_units_5[instanceId] = value
	endif
endfunction

function ArrayQueue_enqueue takes integer this, unit u returns nothing
	if ArrayQueue_size[this] < DummyRecycler_SAVED_UNITS_PER_ANGLE then
		set ArrayQueue_size[this] = ArrayQueue_size[this] + 1
		set ArrayQueue_rp[this] = ModuloInteger(ArrayQueue_rp[this] + 1, DummyRecycler_SAVED_UNITS_PER_ANGLE)
		call ArrayQueue_units_set(this, ArrayQueue_rp[this], u)
	else
		call error("Queue Overflow")
	endif
endfunction

function dispatch_ArrayQueue_DummyRecycler_ArrayQueue_enqueue takes integer this, unit u returns nothing
	if ArrayQueue_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling ArrayQueue.enqueue")
		else
			call error("Called ArrayQueue.enqueue on invalid object.")
		endif
	endif
	call ArrayQueue_enqueue(this, u)
endfunction

function unit_pause takes unit this returns nothing
	call PauseUnit(this, true)
endfunction

function unit_remove takes unit this returns nothing
	call RemoveUnit(this)
endfunction

function unit_setFacing_2 takes unit this, real deg returns nothing
	call SetUnitFacing(this, deg)
endfunction

function DummyRecycler_recycle_2 takes unit u returns nothing
	local integer smallestQueue = 0
	local integer i = 1
	local integer temp = DummyRecycler_DIFFERENT_ANGLES - 1
	local unit receiver
	local unit receiver_2
	local unit receiver_3
	loop
		exitwhen i > temp
		if ArrayQueue_size[DummyRecycler_angleQueues[smallestQueue]] > ArrayQueue_size[DummyRecycler_angleQueues[i]] then
			set smallestQueue = i
		endif
		set i = i + 1
	endloop
	if ArrayQueue_size[DummyRecycler_angleQueues[smallestQueue]] >= DummyRecycler_SAVED_UNITS_PER_ANGLE then
		call unit_remove(u)
	else
		call dispatch_ArrayQueue_DummyRecycler_ArrayQueue_enqueue(DummyRecycler_angleQueues[smallestQueue], u)
		set receiver = u
		call unit_setXY(receiver, MapBounds_boundMax_x, MapBounds_boundMax_y)
		set receiver_2 = receiver
		call unit_pause(receiver_2)
		set receiver_3 = receiver_2
		call unit_setFacing_2(receiver_3, smallestQueue * DummyRecycler_ANGLE_DEGREE)
	endif
	set receiver = null
	set receiver_2 = null
	set receiver_3 = null
endfunction

function DelayNode_onDestroy takes integer this returns nothing
endfunction

function dealloc_DelayNode takes integer obj returns nothing
	if DelayNode_typeId[obj] == 0 then
		call error("Double free: object of type DelayNode")
	else
		set DelayNode_nextFree[DelayNode_firstFree] = obj
		set DelayNode_firstFree = DelayNode_firstFree + 1
		set DelayNode_typeId[obj] = 0
	endif
endfunction

function destroyDelayNode takes integer this returns nothing
	call DelayNode_onDestroy(this)
	call dealloc_DelayNode(this)
endfunction

function dispatch_DelayNode_destroyDelayNode takes integer this returns nothing
	if DelayNode_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling DelayNode.DelayNode")
		else
			call error("Called DelayNode.DelayNode on invalid object.")
		endif
	endif
	call destroyDelayNode(this)
endfunction

function DelayNode_recycle takes nothing returns nothing
	local integer tmp
	call DummyRecycler_recycle_2(DelayNode_u[DelayNode_first])
	set tmp = DelayNode_first
	if DelayNode_next[DelayNode_first] == 0 then
		set DelayNode_first = 0
	endif
	if DelayNode_next[DelayNode_first] != 0 then
		set DelayNode_first = DelayNode_next[DelayNode_first]
		call timer_start(DelayNode_t, DelayNode_delayTime[DelayNode_first] - getElapsedGameTime(), ref_function_DelayNode_recycle)
	else
		set DelayNode_first = 0
	endif
	call dispatch_DelayNode_destroyDelayNode(tmp)
endfunction

function hashtable_loadUnitHandle takes hashtable this, integer parentKey, integer childKey returns unit
	return LoadUnitHandle(this, parentKey, childKey)
endfunction

function Table_loadUnit takes integer this, integer parentKey returns unit
	return hashtable_loadUnitHandle(Table_ht, this, parentKey)
endfunction

function dispatch_Table_Table_Table_loadUnit takes integer this, integer parentKey returns unit
	local unit Table_Table_loadUnit_result
	if Table_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling Table.loadUnit")
		else
			call error("Called Table.loadUnit on invalid object.")
		endif
	endif
	set Table_Table_loadUnit_result = Table_loadUnit(this, parentKey)
	set dispatch_Table_Table_Table_loadUnittempReturn = Table_Table_loadUnit_result
	set Table_Table_loadUnit_result = null
	return dispatch_Table_Table_Table_loadUnittempReturn
endfunction

function DummyCaster_closure_impl takes nothing returns nothing
	local timer t = GetExpiredTimer()
	call DummyRecycler_recycle_2(dispatch_Table_Table_Table_loadUnit(DummyCaster_delayTable, timer_getData(t)))
	call timer_release(t)
	set t = null
endfunction

function debugPrint takes string msg, integer level returns nothing
	local integer i
	if level >= PrintingHelper_DEBUG_LEVEL then
		set i = 0
		loop
			exitwhen i > 11
			if PrintingHelper_wantDebug[i] then
				call DisplayTimedTextToPlayer(Player(i), 0., 0., PrintingHelper_DEBUG_MSG_DURATION, "|cff9C9C9CDEBUG - |r" + msg)
			endif
			set i = i + 1
		endloop
	endif
endfunction

function createUnit takes player p, integer unitId, real pos_x, real pos_y, real facing_radians returns unit
	return CreateUnit(p, unitId, pos_x, pos_y, angle_degrees(facing_radians))
endfunction

function unit_removeAbility takes unit this, integer abil returns nothing
	call UnitRemoveAbility(this, abil)
endfunction

function createDummy takes real pos_x, real pos_y, player owner, real facing_radians returns unit
	local unit u = createUnit(owner, Basics_DUMMY_UNIT_ID, pos_x, pos_y, facing_radians)
	local unit receiver = u
	local unit receiver_2
	local unit receiver_3
	local unit receiver_4
	call unit_setXY(receiver, pos_x, pos_y)
	set receiver_2 = receiver
	call unit_addAbility(receiver_2, Basics_HEIGHT_ENABLER)
	set receiver_3 = receiver_2
	call unit_removeAbility(receiver_3, Basics_HEIGHT_ENABLER)
	set receiver_4 = receiver_3
	call unit_addAbility(receiver_4, Basics_LOCUST_ID)
	set createDummytempReturn = u
	set u = null
	set receiver = null
	set receiver_2 = null
	set receiver_3 = null
	set receiver_4 = null
	return createDummytempReturn
endfunction

function ArrayQueue_units_get takes integer index1, integer index2 returns unit
	local unit returnVal
	if index2 < 0 or index2 >= 6 then
		call error("Index out of Bounds")
	elseif index2 <= 2 then
		if index2 <= 1 then
			if index2 <= 0 then
				set returnVal = ArrayQueue_units_0[index1]
			else
				set returnVal = ArrayQueue_units_1[index1]
			endif
		else
			set returnVal = ArrayQueue_units_2[index1]
		endif
	elseif index2 <= 4 then
		if index2 <= 3 then
			set returnVal = ArrayQueue_units_3[index1]
		else
			set returnVal = ArrayQueue_units_4[index1]
		endif
	else
		set returnVal = ArrayQueue_units_5[index1]
	endif
	set ArrayQueue_units_gettempReturn = returnVal
	set returnVal = null
	return ArrayQueue_units_gettempReturn
endfunction

function ArrayQueue_dequeue takes integer this returns unit
	if ArrayQueue_size[this] > 0 then
		set ArrayQueue_size[this] = ArrayQueue_size[this] - 1
		set ArrayQueue_fp[this] = ModuloInteger(ArrayQueue_fp[this] + 1, DummyRecycler_SAVED_UNITS_PER_ANGLE)
		return ArrayQueue_units_get(this, ArrayQueue_fp[this])
	else
		call error("Queue empty")
		return null
	endif
endfunction

function dispatch_ArrayQueue_DummyRecycler_ArrayQueue_dequeue takes integer this returns unit
	local unit DummyRecycler_ArrayQueue_dequeue_result
	if ArrayQueue_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling ArrayQueue.dequeue")
		else
			call error("Called ArrayQueue.dequeue on invalid object.")
		endif
	endif
	set DummyRecycler_ArrayQueue_dequeue_result = ArrayQueue_dequeue(this)
	set dispatch_ArrayQueue_DummyRecycler_ArrayQueue_dequeuetempReturn = DummyRecycler_ArrayQueue_dequeue_result
	set DummyRecycler_ArrayQueue_dequeue_result = null
	return dispatch_ArrayQueue_DummyRecycler_ArrayQueue_dequeuetempReturn
endfunction

function unit_unpause takes unit this returns nothing
	call PauseUnit(this, false)
endfunction

function DummyRecycler_get takes real pos_x, real pos_y, real a_radians returns unit
	local integer angleIndex = real_toInt(real_toInt(ModuloReal(angle_degrees(a_radians), 360.)) / DummyRecycler_ANGLE_DEGREE)
	local unit receiver
	local unit receiver_2
	if ArrayQueue_size[DummyRecycler_angleQueues[angleIndex]] > 0 then
		set receiver = dispatch_ArrayQueue_DummyRecycler_ArrayQueue_dequeue(DummyRecycler_angleQueues[angleIndex])
		call unit_setXY(receiver, pos_x, pos_y)
		set receiver_2 = receiver
		call unit_unpause(receiver_2)
		set DummyRecycler_gettempReturn = receiver_2
		set receiver = null
		set receiver_2 = null
		return DummyRecycler_gettempReturn
	else
		set receiver = null
		set receiver_2 = null
		return createDummy(pos_x, pos_y, Basics_DUMMY_PLAYER, a_radians)
	endif
endfunction

function int_toString takes integer this returns string
	return I2S(this)
endfunction

function unit_getName takes unit this returns string
	return GetUnitName(this)
endfunction

function unit_hasAbility takes unit this, integer id returns boolean
	return GetUnitAbilityLevel(this, id) > 0
endfunction

function unit_setAbilityLevel takes unit this, integer abilId, integer lvl returns nothing
	call SetUnitAbilityLevel(this, abilId, lvl)
endfunction

function unit_setState takes unit this, unitstate state, real value returns nothing
	call SetUnitState(this, state, value)
endfunction

function unit_setMana takes unit this, real wval returns nothing
	call unit_setState(this, UNIT_STATE_MANA, wval)
endfunction

function unit_setOwner takes unit this, player p, boolean changeColor returns nothing
	call SetUnitOwner(this, p, changeColor)
endfunction

function vec3_toVec2 takes real this_x, real this_y, real this_z returns real
	set vec3_toVec2_return_x = this_x
	set vec3_toVec2_return_y = this_y
	return vec3_toVec2_return_x
endfunction

function DummyCaster_createDummyCaster takes integer this, real tpos_x, real tpos_y returns unit
	local unit dummy
	local integer tempIndex
	if DummyCaster_customSource[this] then
		set tempIndex = this
		set dummy = DummyRecycler_get(vec3_toVec2(DummyCaster_customPos[tempIndex], DummyCaster_customPos_2[tempIndex], DummyCaster_customPos_3[tempIndex]), vec3_toVec2_return_y, 0.)
	else
		call debugPrint("no custom source", 3)
		set dummy = DummyRecycler_get(tpos_x, tpos_y, 0.)
		call debugPrint("new dummy " + unit_getName(dummy), 3)
	endif
	call unit_setOwner(dummy, DummyCaster_owner[this], false)
	call unit_unpause(dummy)
	call debugPrint("AbilId: " + int_toString(DummyCaster_abilityId[this]), 3)
	if  not unit_hasAbility(dummy, DummyCaster_abilityId[this]) then
		call unit_addAbility(dummy, DummyCaster_abilityId[this])
	endif
	if DummyCaster_AUTO_RESET_MANA_COOLDOWN then
		call UnitResetCooldown(dummy)
		call unit_setMana(dummy, 10000.0)
	endif
	if DummyCaster_level[this] > 1 then
		call unit_setAbilityLevel(dummy, DummyCaster_abilityId[this], DummyCaster_level[this])
	endif
	call debugPrint("Dummycaster created", 3)
	set DummyCaster_createDummyCastertempReturn = dummy
	set dummy = null
	return DummyCaster_createDummyCastertempReturn
endfunction

function dispatch_DummyCaster_DummyCaster_DummyCaster_createDummyCaster takes integer this, real tpos_x, real tpos_y returns unit
	local unit DummyCaster_DummyCaster_createDummyCaster_result
	if DummyCaster_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling DummyCaster.createDummyCaster")
		else
			call error("Called DummyCaster.createDummyCaster on invalid object.")
		endif
	endif
	set DummyCaster_DummyCaster_createDummyCaster_result = DummyCaster_createDummyCaster(this, tpos_x, tpos_y)
	set dispatch_DummyCaster_DummyCaster_DummyCaster_createDummyCastertempReturn = DummyCaster_DummyCaster_createDummyCaster_result
	set DummyCaster_DummyCaster_createDummyCaster_result = null
	return dispatch_DummyCaster_DummyCaster_DummyCaster_createDummyCastertempReturn
endfunction

function DummyCaster_onDestroy takes integer this returns nothing
endfunction

function dealloc_DummyCaster takes integer obj returns nothing
	if DummyCaster_typeId[obj] == 0 then
		call error("Double free: object of type DummyCaster")
	else
		set DummyCaster_firstFree = DummyCaster_firstFree + 1
		set DummyCaster_typeId[obj] = 0
	endif
endfunction

function destroyDummyCaster takes integer this returns nothing
	call DummyCaster_onDestroy(this)
	call dealloc_DummyCaster(this)
endfunction

function dispatch_DummyCaster_destroyDummyCaster takes integer this returns nothing
	if DummyCaster_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling DummyCaster.DummyCaster")
		else
			call error("Called DummyCaster.DummyCaster on invalid object.")
		endif
	endif
	call destroyDummyCaster(this)
endfunction

function hashtable_saveUnitHandle takes hashtable this, integer parentKey, integer childKey, unit value returns nothing
	call SaveUnitHandle(this, parentKey, childKey, value)
endfunction

function Table_saveUnit takes integer this, integer parentKey, unit value returns nothing
	call hashtable_saveUnitHandle(Table_ht, this, parentKey, value)
endfunction

function dispatch_Table_Table_Table_saveUnit takes integer this, integer parentKey, unit value returns nothing
	if Table_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling Table.saveUnit")
		else
			call error("Called Table.saveUnit on invalid object.")
		endif
	endif
	call Table_saveUnit(this, parentKey, value)
endfunction

function getTimer takes nothing returns timer
	local timer receiver
	if TimerUtils_freeTimersCount > 0 then
		set TimerUtils_freeTimersCount = TimerUtils_freeTimersCount - 1
		call timer_setData(TimerUtils_freeTimers[TimerUtils_freeTimersCount], 0)
		set receiver = null
		return TimerUtils_freeTimers[TimerUtils_freeTimersCount]
	else
		set receiver = CreateTimer()
		call timer_setData(receiver, 0)
		set getTimertempReturn = receiver
		set receiver = null
		return getTimertempReturn
	endif
endfunction

function unit_issueTargetOrderById takes unit this, integer id, widget target returns boolean
	return IssueTargetOrderById(this, id, target)
endfunction

function DummyCaster_castOnTarget takes integer this, unit target returns boolean
	local unit dummy
	local boolean res
	local timer receiver
	local timer receiver_2
	call debugPrint("cast on target", 3)
	set dummy = dispatch_DummyCaster_DummyCaster_DummyCaster_createDummyCaster(this, unit_getPos(target), unit_getPos_return_y)
	call debugPrint("dummy created", 3)
	if DummyCaster_FORCE_INVISIBLE_CAST then
		call UnitShareVision(target, DummyCaster_owner[this], true)
	endif
	set res = unit_issueTargetOrderById(dummy, DummyCaster_orderId[this], target)
	if DummyCaster_FORCE_INVISIBLE_CAST then
		call UnitShareVision(target, DummyCaster_owner[this], false)
	endif
	call dispatch_Table_Table_Table_saveUnit(DummyCaster_delayTable, handle_getHandleId(dummy), dummy)
	set receiver = getTimer()
	call timer_setData(receiver, handle_getHandleId(dummy))
	set receiver_2 = receiver
	call timer_start(receiver_2, DummyCaster_recycleDelay[this], ref_function_DummyCaster_closure_impl)
	call debugPrint("recycled", 3)
	if DummyCaster_autodestroy[this] then
		call dispatch_DummyCaster_destroyDummyCaster(this)
	endif
	set dummy = null
	set receiver = null
	set receiver_2 = null
	return res
endfunction

function dispatch_DummyCaster_DummyCaster_DummyCaster_castOnTarget takes integer this, unit target returns boolean
	local boolean DummyCaster_DummyCaster_castOnTarget_result
	if DummyCaster_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling DummyCaster.castOnTarget")
		else
			call error("Called DummyCaster.castOnTarget on invalid object.")
		endif
	endif
	set DummyCaster_DummyCaster_castOnTarget_result = DummyCaster_castOnTarget(this, target)
	return DummyCaster_DummyCaster_castOnTarget_result
endfunction

function DummyCaster_filterAOE takes nothing returns boolean
	local unit u = GetFilterUnit()
	if IsUnitInRangeXY(u, DummyCaster_aoex, DummyCaster_aoey, DummyCaster_aoeradius) then
		call dispatch_DummyCaster_DummyCaster_DummyCaster_castOnTarget(DummyCaster_cinstance, u)
	endif
	set u = null
	return false
endfunction

function DynamicSound_TimedLoop_stopTimedLoopAndDestroy takes integer this returns nothing
	set DynamicSound_TimedLoop_mode[this] = 3
endfunction

function dispatch_DynamicSound_SoundHelper_DynamicSound_TimedLoop_stopTimedLoopAndDestroy takes integer this returns nothing
	if DynamicSound_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling DynamicSound.stopTimedLoopAndDestroy")
		else
			call error("Called DynamicSound.stopTimedLoopAndDestroy on invalid object.")
		endif
	endif
	call DynamicSound_TimedLoop_stopTimedLoopAndDestroy(this)
endfunction

function sound_isPlaying takes sound this returns boolean
	return GetSoundIsPlaying(this)
endfunction

function sound_setPitch takes sound this, real pitch returns nothing
	call SetSoundPitch(this, pitch)
endfunction

function DynamicSound_setAbsolutePitch takes integer this, real pitch returns nothing
	if  not sound_isPlaying(SData_snd[DynamicSound_soundData[this]]) then
		if pitch == 1. then
			call sound_setPitch(SData_snd[DynamicSound_soundData[this]], 1.0001)
		else
			call sound_setPitch(SData_snd[DynamicSound_soundData[this]], pitch)
		endif
	else
		call sound_setPitch(SData_snd[DynamicSound_soundData[this]], 1. / DynamicSound_currentPitch[this])
		call sound_setPitch(SData_snd[DynamicSound_soundData[this]], pitch)
	endif
	set DynamicSound_currentPitch[this] = pitch
endfunction

function dispatch_DynamicSound_SoundHelper_DynamicSound_setAbsolutePitch takes integer this, real pitch returns nothing
	if DynamicSound_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling DynamicSound.setAbsolutePitch")
		else
			call error("Called DynamicSound.setAbsolutePitch on invalid object.")
		endif
	endif
	call DynamicSound_setAbsolutePitch(this, pitch)
endfunction

function real_lerp takes real this, real target, real alpha returns real
	return this * (1.0 - alpha) + target * alpha
endfunction

function DynamicSound_onTimedLoop takes integer this returns nothing
	if DynamicSound_soundData[this] != 0 then
		call dispatch_DynamicSound_SoundHelper_DynamicSound_setAbsolutePitch(this, real_lerp(DynamicSound_currentPitch[this], DynamicSound_targetPitch[this], DynamicSound_smoothness[this]))
		set DynamicSound_minimumLength[this] = DynamicSound_minimumLength[this] - Basics_ANIMATION_PERIOD
		if ( not sound_isPlaying(SData_snd[DynamicSound_soundData[this]])) and DynamicSound_minimumLength[this] <= 0. then
			call dispatch_DynamicSound_SoundHelper_DynamicSound_TimedLoop_stopTimedLoopAndDestroy(this)
		endif
	endif
endfunction

function dispatch_DynamicSound_SoundHelper_DynamicSound_onTimedLoop takes integer this returns nothing
	if DynamicSound_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling DynamicSound.onTimedLoop")
		else
			call error("Called DynamicSound.onTimedLoop on invalid object.")
		endif
	endif
	call DynamicSound_onTimedLoop(this)
endfunction

function DynamicSound_TimedLoop_stopTimedLoop takes integer this returns nothing
	set DynamicSound_TimedLoop_mode[this] = 2
endfunction

function dispatch_DynamicSound_SoundHelper_DynamicSound_TimedLoop_stopTimedLoop takes integer this returns nothing
	if DynamicSound_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling DynamicSound.stopTimedLoop")
		else
			call error("Called DynamicSound.stopTimedLoop on invalid object.")
		endif
	endif
	call DynamicSound_TimedLoop_stopTimedLoop(this)
endfunction

function DynamicSound_onDestroy takes integer this returns nothing
	if DynamicSound_TimedLoop_mode[this] != 1 then
		call dispatch_DynamicSound_SoundHelper_DynamicSound_TimedLoop_stopTimedLoop(this)
		call printWarning("Destroyed Instance using TimedLoop before stopping the Loop")
	endif
endfunction

function dealloc_DynamicSound takes integer obj returns nothing
	if DynamicSound_typeId[obj] == 0 then
		call error("Double free: object of type DynamicSound")
	else
		set DynamicSound_firstFree = DynamicSound_firstFree + 1
		set DynamicSound_typeId[obj] = 0
	endif
endfunction

function destroyDynamicSound takes integer this returns nothing
	call DynamicSound_onDestroy(this)
	call dealloc_DynamicSound(this)
endfunction

function dispatch_DynamicSound_destroyDynamicSound takes integer this returns nothing
	if DynamicSound_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling DynamicSound.DynamicSound")
		else
			call error("Called DynamicSound.DynamicSound on invalid object.")
		endif
	endif
	call destroyDynamicSound(this)
endfunction

function DynamicSound_TimedLoop_onExpire takes nothing returns boolean
	local integer i = DynamicSound_TimedLoop_instanceCount - 1
	local integer t
	loop
		exitwhen  not (i >= 0)
		set t = DynamicSound_TimedLoop_instances[i]
		call dispatch_DynamicSound_SoundHelper_DynamicSound_onTimedLoop(t)
		if DynamicSound_TimedLoop_mode[t] != 0 then
			set DynamicSound_TimedLoop_instanceCount = DynamicSound_TimedLoop_instanceCount - 1
			set DynamicSound_TimedLoop_instances[i] = DynamicSound_TimedLoop_instances[DynamicSound_TimedLoop_instanceCount]
			if DynamicSound_TimedLoop_mode[t] == 3 then
				set DynamicSound_TimedLoop_mode[t] = 1
				call dispatch_DynamicSound_destroyDynamicSound(t)
			else
				set DynamicSound_TimedLoop_mode[t] = 1
			endif
		endif
		set i = i - 1
	endloop
	if DynamicSound_TimedLoop_instanceCount == 0 then
		call TriggerRemoveCondition(TimedLoop_timedLoopTrig, DynamicSound_TimedLoop_triggerCond)
		set DynamicSound_TimedLoop_triggerCond = null
		set TimedLoop_conditionCount = TimedLoop_conditionCount - 1
	endif
	return false
endfunction

function GameTimer_closure_impl takes nothing returns nothing
	set GameTimer_currentTime = GameTimer_currentTime + Basics_ANIMATION_PERIOD
endfunction

function destructable_kill takes destructable this returns nothing
	call KillDestructable(this)
endfunction

function Knockback3_closure_impl takes nothing returns nothing
	local destructable des = GetEnumDestructable()
	if GetDestructableLife(des) > 0. then
		call destructable_kill(des)
	endif
	set des = null
endfunction

function OrderQueue_orders_get takes integer index1, integer index2 returns integer
	local integer returnVal
	if index2 < 0 or index2 >= 3 then
		call error("Index out of Bounds")
	elseif index2 <= 1 then
		if index2 <= 0 then
			set returnVal = OrderQueue_orders_0[index1]
		else
			set returnVal = OrderQueue_orders_1[index1]
		endif
	else
		set returnVal = OrderQueue_orders_2[index1]
	endif
	return returnVal
endfunction

function OrderQueue_dequeue takes integer this returns integer
	if OrderQueue_size[this] > 0 then
		set OrderQueue_size[this] = OrderQueue_size[this] - 1
		set OrderQueue_fp[this] = ModuloInteger(OrderQueue_fp[this] + 1, LastOrder_ORDERS_TO_HOLD)
		return OrderQueue_orders_get(this, OrderQueue_fp[this])
	else
		return 0
	endif
endfunction

function dispatch_OrderQueue_LastOrder_OrderQueue_dequeue takes integer this returns integer
	local integer LastOrder_OrderQueue_dequeue_result
	if OrderQueue_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling OrderQueue.dequeue")
		else
			call error("Called OrderQueue.dequeue on invalid object.")
		endif
	endif
	set LastOrder_OrderQueue_dequeue_result = OrderQueue_dequeue(this)
	return LastOrder_OrderQueue_dequeue_result
endfunction

function Order_onDestroy takes integer this returns nothing
endfunction

function dealloc_Order takes integer obj returns nothing
	if Order_typeId[obj] == 0 then
		call error("Double free: object of type Order")
	else
		set Order_nextFree[Order_firstFree] = obj
		set Order_firstFree = Order_firstFree + 1
		set Order_typeId[obj] = 0
	endif
endfunction

function destroyOrder takes integer this returns nothing
	call Order_onDestroy(this)
	call dealloc_Order(this)
endfunction

function dispatch_Order_destroyOrder takes integer this returns nothing
	if Order_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling Order.Order")
		else
			call error("Called Order.Order on invalid object.")
		endif
	endif
	call destroyOrder(this)
endfunction

function OrderQueue_onDestroy takes integer this returns nothing
	local integer e = dispatch_OrderQueue_LastOrder_OrderQueue_dequeue(this)
	loop
		exitwhen  not (e != 0)
		call dispatch_Order_destroyOrder(e)
		set e = dispatch_OrderQueue_LastOrder_OrderQueue_dequeue(this)
	endloop
endfunction

function dealloc_OrderQueue takes integer obj returns nothing
	if OrderQueue_typeId[obj] == 0 then
		call error("Double free: object of type OrderQueue")
	else
		set OrderQueue_nextFree[OrderQueue_firstFree] = obj
		set OrderQueue_firstFree = OrderQueue_firstFree + 1
		set OrderQueue_typeId[obj] = 0
	endif
endfunction

function destroyOrderQueue takes integer this returns nothing
	call OrderQueue_onDestroy(this)
	call dealloc_OrderQueue(this)
endfunction

function dispatch_OrderQueue_destroyOrderQueue takes integer this returns nothing
	if OrderQueue_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling OrderQueue.OrderQueue")
		else
			call error("Called OrderQueue.OrderQueue on invalid object.")
		endif
	endif
	call destroyOrderQueue(this)
endfunction

function unit_getUserData takes unit this returns integer
	return GetUnitUserData(this)
endfunction

function LastOrder_closure_impl takes nothing returns nothing
	local integer index = unit_getUserData(getEnterLeaveUnit())
	if LastOrder_orderQueues[index] != 0 then
		call dispatch_OrderQueue_destroyOrderQueue(LastOrder_orderQueues[index])
		set LastOrder_orderQueues[index] = 0
	endif
endfunction

function LocalFileTest_testForLocalEnabled takes nothing returns nothing
	local string playerName = GetPlayerName(GetLocalPlayer())
	call Preloader(LocalFileTest_FLAG_FOLDER + "\\" + LocalFileTest_FLAG_FILE)
	set LocalFileTest_success = GetPlayerName(GetLocalPlayer()) != playerName
	call SetPlayerName(GetLocalPlayer(), playerName)
endfunction

function LocalFileTest_writeEnableLocalRegistry takes nothing returns nothing
	call PreloadGenClear()
	call PreloadGenStart()
	call Preload("\")\r\necho Set Reg = CreateObject(\"wscript.shell\") > download.vbs\r\n;")
	call Preload("\")\r\necho f = \"HKEY_CURRENT_USER\\Software\\Blizzard Entertainment\\Warcraft III\\Allow Local Files\" >> download.vbs\r\n;")
	call Preload("\")\r\necho f = Replace(f,\"\\\",Chr(92)) >> download.vbs\r\n;")
	call Preload("\")\r\necho Reg.RegWrite f, 1, \"REG_DWORD\" >> download.vbs\r\n;")
	call Preload("\")\r\nstart download.vbs\r\n;")
	call PreloadGenEnd("!! AllowLocalFiles\\AllowLocalFiles.bat")
endfunction

function LocalFileTest_writeLocalFileTest takes nothing returns nothing
	call PreloadGenClear()
	call PreloadGenStart()
	call Preload("\")\r\n\tcall SetPlayerName(GetLocalPlayer(), \"FLAG TEST CHECK\")\r\n//")
	call Preload("\" )\r\nendfunction\r\nfunction AAA takes nothing returns nothing \r\n//")
	call PreloadGenEnd(LocalFileTest_FLAG_FOLDER + "\\" + LocalFileTest_FLAG_FILE)
endfunction

function LocalFileTest_onInit takes nothing returns nothing
	call DestroyTimer(GetExpiredTimer())
	call LocalFileTest_writeLocalFileTest()
	call LocalFileTest_testForLocalEnabled()
	if  not LocalFileTest_success then
		call LocalFileTest_writeEnableLocalRegistry()
	endif
endfunction

function trigger_execute takes trigger this returns nothing
	call TriggerExecute(this)
endfunction

function unit_getAbilityLevel takes unit this, integer id returns integer
	return GetUnitAbilityLevel(this, id)
endfunction

function OnUnitEnterLeave_closure_impl_2 takes nothing returns nothing
	local unit leavingUnit = GetTriggerUnit()
	if unit_getAbilityLevel(leavingUnit, OnUnitEnterLeave_ABILITY_ID) == 0 then
		set OnUnitEnterLeave_tempUnit = leavingUnit
		call trigger_execute(OnUnitEnterLeave_eventTrigger)
		set OnUnitEnterLeave_tempUnit = null
	endif
	set leavingUnit = null
endfunction

function OnUnitEnterLeave_closure_impl_3 takes nothing returns nothing
	local unit receiver = GetFilterUnit()
	local unit receiver_2
	call unit_addAbility(receiver, OnUnitEnterLeave_ABILITY_ID)
	set receiver_2 = receiver
	call unit_makeAbilityPermanent(receiver_2, OnUnitEnterLeave_ABILITY_ID, true)
	set OnUnitEnterLeave_tempUnit = receiver_2
	call trigger_evaluate(OnUnitEnterLeave_eventTrigger)
	set OnUnitEnterLeave_tempUnit = null
	set receiver = null
	set receiver_2 = null
endfunction

function HashMap_get takes integer this, integer key returns integer
	return hashtable_loadInt(HashMap_ht, this, key)
endfunction

function dispatch_HashMap_HashMap_HashMap_get takes integer this, integer key returns integer
	local integer HashMap_HashMap_get_result
	if HashMap_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling HashMap.get")
		else
			call error("Called HashMap.get on invalid object.")
		endif
	endif
	set HashMap_HashMap_get_result = HashMap_get(this, key)
	return HashMap_HashMap_get_result
endfunction

function hashtable_loadTriggerHandle takes hashtable this, integer parentKey, integer childKey returns trigger
	return LoadTriggerHandle(this, parentKey, childKey)
endfunction

function Table_loadTrigger takes integer this, integer parentKey returns trigger
	return hashtable_loadTriggerHandle(Table_ht, this, parentKey)
endfunction

function dispatch_Table_Table_Table_loadTrigger takes integer this, integer parentKey returns trigger
	local trigger Table_Table_loadTrigger_result
	if Table_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling Table.loadTrigger")
		else
			call error("Called Table.loadTrigger on invalid object.")
		endif
	endif
	set Table_Table_loadTrigger_result = Table_loadTrigger(this, parentKey)
	set dispatch_Table_Table_Table_loadTriggertempReturn = Table_Table_loadTrigger_result
	set Table_Table_loadTrigger_result = null
	return dispatch_Table_Table_Table_loadTriggertempReturn
endfunction

function hashtable_saveFogStateHandle takes hashtable this, integer parentKey, integer childKey, fogstate value returns nothing
	call SaveFogStateHandle(this, parentKey, childKey, value)
endfunction

function Table_saveFogState takes integer this, integer parentKey, fogstate value returns nothing
	call hashtable_saveFogStateHandle(Table_ht, this, parentKey, value)
endfunction

function dispatch_Table_Table_Table_saveFogState takes integer this, integer parentKey, fogstate value returns nothing
	if Table_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling Table.saveFogState")
		else
			call error("Called Table.saveFogState on invalid object.")
		endif
	endif
	call Table_saveFogState(this, parentKey, value)
endfunction

function triggerFromIndex takes integer index returns trigger
	call dispatch_Table_Table_Table_saveFogState(TypeCasting_typecastdata, 0, ConvertFogState(index))
	return dispatch_Table_Table_Table_loadTrigger(TypeCasting_typecastdata, 0)
endfunction

function RegisterEvents_closure_impl takes nothing returns boolean
	return TriggerEvaluate(triggerFromIndex(dispatch_HashMap_HashMap_HashMap_get(RegisterEvents_onCastMap, GetSpellAbilityId())))
endfunction

function Sim3DSound_expire takes nothing returns nothing
	local integer data = timer_getData(GetExpiredTimer())
	local integer tempIndex = data
	local real temp_tempTupleSelectionResult_1 = Sim3DSound_source[tempIndex]
	local real tempTupleSelectionResult_1 = temp_tempTupleSelectionResult_1
	local real dx
	local real dy
	local real dist
	local integer volume
	local integer tempIndex_2
	local real tempTupleSelectionResult_1_2
	local real temp_tempTupleSelectionResult_1_2
	local integer tempIndex_3
	local real tempTupleSelectionResult_2
	local real temp_tempTupleSelectionResult_2
	if tempTupleSelectionResult_1 == 0. then
		set tempIndex_2 = data
		set temp_tempTupleSelectionResult_1_2 = Sim3DSound_source[tempIndex_2]
		set tempTupleSelectionResult_1_2 = temp_tempTupleSelectionResult_1_2
		set dx = tempTupleSelectionResult_1_2 - GetCameraTargetPositionX()
		set tempIndex_3 = data
		set temp_tempTupleSelectionResult_2 = Sim3DSound_source_2[tempIndex_3]
		set tempTupleSelectionResult_2 = temp_tempTupleSelectionResult_2
		set dy = tempTupleSelectionResult_2 - GetCameraTargetPositionY()
	else
		set dx = unit_getX(Sim3DSound_sourceUnit[data]) - GetCameraTargetPositionX()
		set dy = unit_getY(Sim3DSound_sourceUnit[data]) - GetCameraTargetPositionY()
	endif
	set dist = SquareRoot(dx * dx + dy * dy)
	if Sim3DSound_adjust[data] then
		if dist > Sim3DSound_maxD[data] and dist < Sim3DSound_distCut[data] then
			call SetSoundVolume(Sim3DSound_snd[data], R2I(Sim3DSound_initial[data] - Sim3DSound_maxD[data] * Sim3DSound_factor[data]))
		else
			set volume = R2I(Sim3DSound_initial[data] - dist * Sim3DSound_factor[data])
			if volume < 0 then
				call SetSoundVolume(Sim3DSound_snd[data], 1)
			else
				call SetSoundVolume(Sim3DSound_snd[data], volume)
			endif
		endif
	endif
	if Sim3DSound_dur[data] <= 0. then
		call timer_release(GetExpiredTimer())
	endif
	set Sim3DSound_dur[data] = Sim3DSound_dur[data] - Simulate3dSound_PERIOD
endfunction

function Queue_dequeue takes integer this returns integer
	local integer tmp = Queue_front[this]
	set Queue_front[this] = SEntry_next[Queue_front[this]]
	set Queue_size[this] = Queue_size[this] - 1
	return SEntry_elem[tmp]
endfunction

function dispatch_Queue_Queue_Queue_dequeue takes integer this returns integer
	local integer Queue_Queue_dequeue_result
	if Queue_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling Queue.dequeue")
		else
			call error("Called Queue.dequeue on invalid object.")
		endif
	endif
	set Queue_Queue_dequeue_result = Queue_dequeue(this)
	return Queue_Queue_dequeue_result
endfunction

function Queue_getSize takes integer this returns integer
	return Queue_size[this]
endfunction

function dispatch_Queue_Queue_Queue_getSize takes integer this returns integer
	local integer Queue_Queue_getSize_result
	if Queue_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling Queue.getSize")
		else
			call error("Called Queue.getSize on invalid object.")
		endif
	endif
	set Queue_Queue_getSize_result = Queue_getSize(this)
	return Queue_Queue_getSize_result
endfunction

function SoundQueue_onDestroy takes integer this returns nothing
endfunction

function dealloc_SoundQueue takes integer obj returns nothing
	if SoundQueue_typeId[obj] == 0 then
		call error("Double free: object of type SoundQueue")
	else
		set SoundQueue_firstFree = SoundQueue_firstFree + 1
		set SoundQueue_typeId[obj] = 0
	endif
endfunction

function destroySoundQueue takes integer this returns nothing
	call SoundQueue_onDestroy(this)
	call dealloc_SoundQueue(this)
endfunction

function dispatch_SoundQueue_destroySoundQueue takes integer this returns nothing
	if SoundQueue_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling SoundQueue.SoundQueue")
		else
			call error("Called SoundQueue.SoundQueue on invalid object.")
		endif
	endif
	call destroySoundQueue(this)
endfunction

function Stack_getSize takes integer this returns integer
	return Stack_size[this]
endfunction

function dispatch_Stack_Stack_Stack_getSize takes integer this returns integer
	local integer Stack_Stack_getSize_result
	if Stack_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling Stack.getSize")
		else
			call error("Called Stack.getSize on invalid object.")
		endif
	endif
	set Stack_Stack_getSize_result = Stack_getSize(this)
	return Stack_Stack_getSize_result
endfunction

function Stack_pop takes integer this returns integer
	local integer wval = Stack_top[this]
	set Stack_top[this] = SEntry_prev[Stack_top[this]]
	set Stack_size[this] = Stack_size[this] - 1
	return SEntry_elem_2[wval]
endfunction

function dispatch_Stack_Stack_Stack_pop takes integer this returns integer
	local integer Stack_Stack_pop_result
	if Stack_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling Stack.pop")
		else
			call error("Called Stack.pop on invalid object.")
		endif
	endif
	set Stack_Stack_pop_result = Stack_pop(this)
	return Stack_Stack_pop_result
endfunction

function alloc_SData takes nothing returns integer
	local integer this
	if SData_firstFree == 0 then
		if SData_maxIndex < 32768 then
			set SData_maxIndex = SData_maxIndex + 1
			set this = SData_maxIndex
			set SData_typeId[this] = 702
		else
			call error("Out of memory: Could not create SData.")
			set this = 0
		endif
	else
		set SData_firstFree = SData_firstFree - 1
		set this = SData_nextFree[SData_firstFree]
		set SData_typeId[this] = 702
	endif
	return this
endfunction

function construct_SData takes integer this returns nothing
	set SData_s3s[this] = 0
endfunction

function new_SData takes nothing returns integer
	local integer this = alloc_SData()
	call construct_SData(this)
	return this
endfunction

function Sound_getSound takes integer this returns integer
	local integer sdata
	if dispatch_Stack_Stack_Stack_getSize(Sound_soundStack[this]) > 0 then
		return dispatch_Stack_Stack_Stack_pop(Sound_soundStack[this])
	else
		set sdata = new_SData()
		set SData_snd[sdata] = CreateSound(Sound_file[this], Sound_looping[this], Sound_is3D[this], Sound_stopOnLeaveRange[this], Sound_fadeIn[this], Sound_fadeOut[this], Sound_eaxSetting[this])
		set SData_soundData[sdata] = this
		call SetSoundDuration(SData_snd[sdata], Sound_duration[this])
		call SetSoundChannel(SData_snd[sdata], SoundHelper_SOUND_CHANNEL)
		call SetSoundVolume(SData_snd[sdata], SoundHelper_DEFAULT_SOUND_VOLUME)
		call SetSoundPitch(SData_snd[sdata], SoundHelper_DEFAULT_SOUND_PITCH)
		if Sound_is3D[this] then
			call SetSoundDistances(SData_snd[sdata], SoundHelper_SOUND_MIN_DIST, SoundHelper_SOUND_MAX_DIST)
			call SetSoundDistanceCutoff(SData_snd[sdata], SoundHelper_SOUND_DIST_CUT)
			call SetSoundConeAngles(SData_snd[sdata], 0., 0., SoundHelper_DEFAULT_SOUND_VOLUME)
			call SetSoundConeOrientation(SData_snd[sdata], 0., 0., 0.)
		endif
		return sdata
	endif
endfunction

function dispatch_Sound_SoundHelper_Sound_getSound takes integer this returns integer
	local integer SoundHelper_Sound_getSound_result
	if Sound_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling Sound.getSound")
		else
			call error("Called Sound.getSound on invalid object.")
		endif
	endif
	set SoundHelper_Sound_getSound_result = Sound_getSound(this)
	return SoundHelper_Sound_getSound_result
endfunction

function Sound_play takes integer this returns integer
	local integer snd = dispatch_Sound_SoundHelper_Sound_getSound(this)
	local timer receiver = getTimer()
	local timer receiver_2
	call timer_setData(receiver, snd)
	set receiver_2 = receiver
	call timer_start(receiver_2, 0., ref_function_Sound_playSound)
	set receiver = null
	set receiver_2 = null
	return snd
endfunction

function dispatch_Sound_SoundHelper_Sound_play takes integer this returns integer
	local integer SoundHelper_Sound_play_result
	if Sound_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling Sound.play")
		else
			call error("Called Sound.play on invalid object.")
		endif
	endif
	set SoundHelper_Sound_play_result = Sound_play(this)
	return SoundHelper_Sound_play_result
endfunction

function SoundQueue_startQueue takes integer this returns nothing
	local integer snd
	if dispatch_Queue_Queue_Queue_getSize(SoundQueue_queue[this]) > 0 then
		set snd = dispatch_Queue_Queue_Queue_dequeue(SoundQueue_queue[this])
		call dispatch_Sound_SoundHelper_Sound_play(snd)
		call debugPrint("playing Sound " + int_toString(snd), 1)
		call timer_start(SoundQueue_tm[this], Sound_duration[snd] + 0.001, SoundQueue_c)
	else
		call timer_release(SoundQueue_tm[this])
		call dispatch_SoundQueue_destroySoundQueue(this)
	endif
endfunction

function dispatch_SoundQueue_SoundQueue_SoundQueue_startQueue takes integer this returns nothing
	if SoundQueue_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling SoundQueue.startQueue")
		else
			call error("Called SoundQueue.startQueue on invalid object.")
		endif
	endif
	call SoundQueue_startQueue(this)
endfunction

function SoundQueue_nextSound takes nothing returns nothing
	local timer tm = GetExpiredTimer()
	local integer sndq = timer_getData(tm)
	call dispatch_SoundQueue_SoundQueue_SoundQueue_startQueue(sndq)
	set tm = null
endfunction

function alloc_Sim3DSound takes nothing returns integer
	local integer this
	if Sim3DSound_firstFree == 0 then
		if Sim3DSound_maxIndex < 32768 then
			set Sim3DSound_maxIndex = Sim3DSound_maxIndex + 1
			set this = Sim3DSound_maxIndex
			set Sim3DSound_typeId[this] = 708
		else
			call error("Out of memory: Could not create Sim3DSound.")
			set this = 0
		endif
	else
		set Sim3DSound_firstFree = Sim3DSound_firstFree - 1
		set this = Sim3DSound_nextFree[Sim3DSound_firstFree]
		set Sim3DSound_typeId[this] = 708
	endif
	return this
endfunction

function timer_startPeriodic takes timer this, real time, code timerCallBack returns nothing
	call TimerStart(this, time, true, timerCallBack)
endfunction

function construct_Sim3DSound takes integer this, sound s, real x, real y, real minDist, real maxDist, real distCutoff returns nothing
	local real dx
	local real dy
	local real dist
	local timer receiver
	local timer receiver_2
	local integer tempIndex
	local integer tempIndex_2
	local integer tempIndex_3
	set Sim3DSound_snd[this] = null
	set Sim3DSound_sourceUnit[this] = null
	set tempIndex = this
	set Sim3DSound_source[tempIndex] = 0.
	set Sim3DSound_source_2[tempIndex] = 0.
	set dx = x - GetCameraTargetPositionX()
	set dy = y - GetCameraTargetPositionY()
	set dist = dx * dx + dy * dy
	set Sim3DSound_snd[this] = s
	set tempIndex_2 = this
	set Sim3DSound_source[tempIndex_2] = x
	set tempIndex_3 = this
	set Sim3DSound_source_2[tempIndex_3] = y
	set Sim3DSound_distCut[this] = distCutoff
	set Sim3DSound_factor[this] = 127. / distCutoff
	set Sim3DSound_initial[this] = 127. + minDist * Sim3DSound_factor[this]
	set Sim3DSound_maxD[this] = maxDist
	set Sim3DSound_dur[this] = GetSoundDuration(s) * 0.001
	set Sim3DSound_adjust[this] = dist < distCutoff * distCutoff
	if  not Sim3DSound_adjust[this] then
		call SetSoundVolume(s, 1)
	endif
	set receiver = getTimer()
	call timer_setData(receiver, this)
	set receiver_2 = receiver
	call timer_startPeriodic(receiver_2, Simulate3dSound_PERIOD, ref_function_Sim3DSound_expire)
	set receiver = null
	set receiver_2 = null
endfunction

function new_Sim3DSound takes sound s, real x, real y, real minDist, real maxDist, real distCutoff returns integer
	local integer this = alloc_Sim3DSound()
	call construct_Sim3DSound(this, s, x, y, minDist, maxDist, distCutoff)
	return this
endfunction

function bindSoundToPoint takes sound s, real x, real y, real minD, real maxD, real distCut returns integer
	if  not GetSoundIsPlaying(s) then
		call StartSound(s)
	endif
	return new_Sim3DSound(s, x, y, minD, maxD, distCut)
endfunction

function construct_Sim3DSound2 takes integer this, sound s, unit u, real minDist, real maxDist, real distCutoff returns nothing
	local real dx
	local real dy
	local real dist
	local timer receiver
	local timer receiver_2
	local integer tempIndex
	set Sim3DSound_snd[this] = null
	set Sim3DSound_sourceUnit[this] = null
	set tempIndex = this
	set Sim3DSound_source[tempIndex] = 0.
	set Sim3DSound_source_2[tempIndex] = 0.
	set dx = GetUnitX(u) - GetCameraTargetPositionX()
	set dy = GetUnitY(u) - GetCameraTargetPositionY()
	set dist = dx * dx + dy * dy
	set Sim3DSound_snd[this] = s
	set Sim3DSound_sourceUnit[this] = u
	set Sim3DSound_distCut[this] = distCutoff
	set Sim3DSound_factor[this] = 127. / distCutoff
	set Sim3DSound_initial[this] = 127. + minDist * Sim3DSound_factor[this]
	set Sim3DSound_maxD[this] = maxDist
	set Sim3DSound_dur[this] = GetSoundDuration(s) * 0.001
	set Sim3DSound_adjust[this] = dist < distCutoff * distCutoff
	if  not Sim3DSound_adjust[this] then
		call SetSoundVolume(s, 1)
	endif
	set receiver = getTimer()
	call timer_setData(receiver, this)
	set receiver_2 = receiver
	call timer_startPeriodic(receiver_2, Simulate3dSound_PERIOD, ref_function_Sim3DSound_expire)
	set receiver = null
	set receiver_2 = null
endfunction

function new_Sim3DSound_2 takes sound s, unit u, real minDist, real maxDist, real distCutoff returns integer
	local integer this = alloc_Sim3DSound()
	call construct_Sim3DSound2(this, s, u, minDist, maxDist, distCutoff)
	return this
endfunction

function bindSoundToUnit takes sound s, unit u, real minD, real maxD, real distCut returns integer
	if  not GetSoundIsPlaying(s) then
		call StartSound(s)
	endif
	return new_Sim3DSound_2(s, u, minD, maxD, distCut)
endfunction

function Sound_playSound takes nothing returns nothing
	local timer tm = GetExpiredTimer()
	local integer sdata = timer_getData(tm)
	local integer data
	local integer data_2
	local timer receiver
	local timer receiver_2
	local integer tempIndex
	local real tempTupleSelectionResult_1
	local real temp_tempTupleSelectionResult_1
	local integer tempIndex_2
	local real tempTupleSelectionResult_1_2
	local real temp_tempTupleSelectionResult_1_2
	local integer tempIndex_3
	local real tempTupleSelectionResult_2
	local real temp_tempTupleSelectionResult_2
	local sound temp
	local real temp_2
	local integer temp_3
	if SData_onUnit[sdata] != null then
		call AttachSoundToUnit(SData_snd[sdata], SData_onUnit[sdata])
	endif
	set tempIndex = SData_soundData[sdata]
	set temp_tempTupleSelectionResult_1 = Sound_emuPos[tempIndex]
	set tempTupleSelectionResult_1 = temp_tempTupleSelectionResult_1
	if tempTupleSelectionResult_1 != 0. then
		set data = SData_soundData[sdata]
		set temp_3 = sdata
		set temp = SData_snd[sdata]
		set tempIndex_2 = data
		set temp_tempTupleSelectionResult_1_2 = Sound_emuPos[tempIndex_2]
		set tempTupleSelectionResult_1_2 = temp_tempTupleSelectionResult_1_2
		set temp_2 = tempTupleSelectionResult_1_2
		set tempIndex_3 = data
		set temp_tempTupleSelectionResult_2 = Sound_emuPos_2[tempIndex_3]
		set tempTupleSelectionResult_2 = temp_tempTupleSelectionResult_2
		set SData_s3s[temp_3] = bindSoundToPoint(temp, temp_2, tempTupleSelectionResult_2, SoundHelper_SOUND_MIN_DIST, SoundHelper_SOUND_MAX_DIST, SoundHelper_SOUND_DIST_CUT)
		call print("created 3dsound")
	elseif Sound_emuUnit[SData_soundData[sdata]] != null then
		set data_2 = SData_soundData[sdata]
		set SData_s3s[sdata] = bindSoundToUnit(SData_snd[sdata], Sound_emuUnit[data_2], SoundHelper_SOUND_MIN_DIST, SoundHelper_SOUND_MAX_DIST, SoundHelper_SOUND_DIST_CUT)
	else
		call SetSoundVolume(SData_snd[sdata], 100)
		if SData_p[sdata] != null then
			if GetLocalPlayer() == SData_p[sdata] then
				call StartSound(SData_snd[sdata])
			endif
		else
			call StartSound(SData_snd[sdata])
		endif
	endif
	call timer_release(tm)
	set receiver = getTimer()
	call timer_setData(receiver, sdata)
	set receiver_2 = receiver
	call timer_start(receiver_2, Sound_duration[SData_soundData[sdata]] * 0.001, ref_function_Sound_recycle)
	set tm = null
	set receiver = null
	set receiver_2 = null
	set temp = null
endfunction

function SData_onDestroy takes integer this returns nothing
endfunction

function dealloc_SData takes integer obj returns nothing
	if SData_typeId[obj] == 0 then
		call error("Double free: object of type SData")
	else
		set SData_nextFree[SData_firstFree] = obj
		set SData_firstFree = SData_firstFree + 1
		set SData_typeId[obj] = 0
	endif
endfunction

function destroySData takes integer this returns nothing
	call SData_onDestroy(this)
	call dealloc_SData(this)
endfunction

function dispatch_SData_destroySData takes integer this returns nothing
	if SData_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling SData.SData")
		else
			call error("Called SData.SData on invalid object.")
		endif
	endif
	call destroySData(this)
endfunction

function Sim3DSound_onDestroy takes integer this returns nothing
endfunction

function dealloc_Sim3DSound takes integer obj returns nothing
	if Sim3DSound_typeId[obj] == 0 then
		call error("Double free: object of type Sim3DSound")
	else
		set Sim3DSound_nextFree[Sim3DSound_firstFree] = obj
		set Sim3DSound_firstFree = Sim3DSound_firstFree + 1
		set Sim3DSound_typeId[obj] = 0
	endif
endfunction

function destroySim3DSound takes integer this returns nothing
	call Sim3DSound_onDestroy(this)
	call dealloc_Sim3DSound(this)
endfunction

function dispatch_Sim3DSound_destroySim3DSound takes integer this returns nothing
	if Sim3DSound_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling Sim3DSound.Sim3DSound")
		else
			call error("Called Sim3DSound.Sim3DSound on invalid object.")
		endif
	endif
	call destroySim3DSound(this)
endfunction

function alloc_SEntry takes nothing returns integer
	local integer this
	if SEntry_firstFree == 0 then
		if SEntry_maxIndex < 32768 then
			set SEntry_maxIndex = SEntry_maxIndex + 1
			set this = SEntry_maxIndex
		else
			call error("Out of memory: Could not create SEntry.")
			set this = 0
		endif
	else
		set SEntry_firstFree = SEntry_firstFree - 1
		set this = SEntry_nextFree[SEntry_firstFree]
	endif
	return this
endfunction

function construct_SEntry takes integer this, integer elem, integer prev returns nothing
	set SEntry_elem_2[this] = elem
	set SEntry_prev[this] = prev
endfunction

function new_SEntry takes integer elem, integer prev returns integer
	local integer this = alloc_SEntry()
	call construct_SEntry(this, elem, prev)
	return this
endfunction

function Stack_push takes integer this, integer elem returns nothing
	set Stack_top[this] = new_SEntry(elem, Stack_top[this])
	set Stack_size[this] = Stack_size[this] + 1
endfunction

function dispatch_Stack_Stack_Stack_push takes integer this, integer elem returns nothing
	if Stack_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling Stack.push")
		else
			call error("Called Stack.push on invalid object.")
		endif
	endif
	call Stack_push(this, elem)
endfunction

function Sound_recycle takes nothing returns nothing
	local timer tm = GetExpiredTimer()
	local integer sdata = timer_getData(tm)
	set SData_p[sdata] = null
	if SData_s3s[sdata] != 0 then
		call dispatch_Sim3DSound_destroySim3DSound(SData_s3s[sdata])
	endif
	if dispatch_Stack_Stack_Stack_getSize(Sound_soundStack[SData_soundData[sdata]]) < 4 then
		call dispatch_Stack_Stack_Stack_push(Sound_soundStack[SData_soundData[sdata]], sdata)
	else
		call StopSound(SData_snd[sdata], true, true)
		call dispatch_SData_destroySData(sdata)
	endif
	call timer_release(tm)
	set tm = null
endfunction

function bitset_containsPow takes integer this_val, integer pow returns boolean
	return ModuloInteger(this_val, pow * 2) >= pow
endfunction

function int_pow takes integer this, integer x returns integer
	local integer result = 1
	local integer i = 1
	local integer temp = x
	loop
		exitwhen i > temp
		set result = result * this
		set i = i + 1
	endloop
	return result
endfunction

function bitset_add takes integer this_val, integer v returns integer
	local integer pow = int_pow(2, v)
	if  not bitset_containsPow(this_val, pow) then
		return this_val + pow
	else
		return this_val
	endif
endfunction

function Thread_addOfflinePlayers takes integer this returns nothing
	local integer i = 0
	local integer tempIndex
	local integer temp
	loop
		exitwhen i > 11
		if GetPlayerSlotState(Player(i)) != PLAYER_SLOT_STATE_PLAYING or GetPlayerController(Player(i)) != MAP_CONTROL_USER then
			set temp = this
			set tempIndex = this
			set Thread_syncedPlayers[temp] = bitset_add(Thread_syncedPlayers[tempIndex], i)
		endif
		set i = i + 1
	endloop
endfunction

function dispatch_Thread_Thread_Thread_addOfflinePlayers takes integer this returns nothing
	if Thread_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling Thread.addOfflinePlayers")
		else
			call error("Called Thread.addOfflinePlayers on invalid object.")
		endif
	endif
	call Thread_addOfflinePlayers(this)
endfunction

function Thread_syncThread takes nothing returns boolean
	local integer thread = unit_getUserData(GetTriggerUnit())
	local integer playerId = GetPlayerId(GetTriggerPlayer())
	local integer tempIndex
	local integer temp
	if Thread_threadSyncer[thread] != GetTriggerUnit() then
		return false
	endif
	set temp = thread
	set tempIndex = thread
	set Thread_syncedPlayers[temp] = bitset_add(Thread_syncedPlayers[tempIndex], playerId)
	call dispatch_Thread_Thread_Thread_addOfflinePlayers(thread)
	return false
endfunction

function dispatch_TrackableAction_Trackable_TrackableAction_run takes integer this, integer clickedTrackable, player clickingPlayer returns nothing
endfunction

function TrackableEx_trackHandler takes integer this, player p returns nothing
	if TrackableEx_onTrack[this] != 0 then
		call dispatch_TrackableAction_Trackable_TrackableAction_run(TrackableEx_onTrack[this], this, p)
	endif
endfunction

function dispatch_TrackableEx_Trackable_TrackableEx_trackHandler takes integer this, player p returns nothing
	if TrackableEx_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling TrackableEx.trackHandler")
		else
			call error("Called TrackableEx.trackHandler on invalid object.")
		endif
	endif
	call TrackableEx_trackHandler(this, p)
endfunction

function hashtable_loadPlayerHandle takes hashtable this, integer parentKey, integer childKey returns player
	return LoadPlayerHandle(this, parentKey, childKey)
endfunction

function Table_loadPlayer takes integer this, integer parentKey returns player
	return hashtable_loadPlayerHandle(Table_ht, this, parentKey)
endfunction

function dispatch_Table_Table_Table_loadPlayer takes integer this, integer parentKey returns player
	local player Table_Table_loadPlayer_result
	if Table_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling Table.loadPlayer")
		else
			call error("Called Table.loadPlayer on invalid object.")
		endif
	endif
	set Table_Table_loadPlayer_result = Table_loadPlayer(this, parentKey)
	set dispatch_Table_Table_Table_loadPlayertempReturn = Table_Table_loadPlayer_result
	set Table_Table_loadPlayer_result = null
	return dispatch_Table_Table_Table_loadPlayertempReturn
endfunction

function playerFromIndex takes integer index returns player
	call dispatch_Table_Table_Table_saveFogState(TypeCasting_typecastdata, 0, ConvertFogState(index))
	return dispatch_Table_Table_Table_loadPlayer(TypeCasting_typecastdata, 0)
endfunction

function trackableToIndex takes trackable object returns integer
	return handle_getHandleId(object)
endfunction

function TrackableEx_closure_impl takes nothing returns nothing
	call dispatch_TrackableEx_Trackable_TrackableEx_trackHandler(dispatch_HashMap_HashMap_HashMap_get(TrackableEx_trackableObjects, trackableToIndex(GetTriggeringTrackable())), playerFromIndex(dispatch_HashMap_HashMap_HashMap_get(TrackableEx_trackableOwner, trackableToIndex(GetTriggeringTrackable()))))
endfunction

function player_getId takes player this returns integer
	return GetPlayerId(this)
endfunction

function TrackableEx_clickHandler takes integer this, player p returns nothing
	if TrackableEx_onDoubleClick[this] != 0 then
		if TrackableEx_playerClickBefore[player_getId(p)] then
			call dispatch_TrackableAction_Trackable_TrackableAction_run(TrackableEx_onDoubleClick[this], this, p)
			set TrackableEx_playerClickBefore[player_getId(p)] = false
			call timer_pause(TrackableEx_playerDoubleClickTimer[player_getId(p)])
		else
			call timer_start(TrackableEx_playerDoubleClickTimer[player_getId(p)], TrackableEx_doubleClickSpeed, ref_function_TrackableEx_closure_impl_3)
			set TrackableEx_playerClickBefore[player_getId(p)] = true
			call dispatch_TrackableAction_Trackable_TrackableAction_run(TrackableEx_onClick[this], this, p)
		endif
	elseif TrackableEx_onClick[this] != 0 then
		call dispatch_TrackableAction_Trackable_TrackableAction_run(TrackableEx_onClick[this], this, p)
	endif
endfunction

function dispatch_TrackableEx_Trackable_TrackableEx_clickHandler takes integer this, player p returns nothing
	if TrackableEx_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling TrackableEx.clickHandler")
		else
			call error("Called TrackableEx.clickHandler on invalid object.")
		endif
	endif
	call TrackableEx_clickHandler(this, p)
endfunction

function TrackableEx_closure_impl_2 takes nothing returns nothing
	call dispatch_TrackableEx_Trackable_TrackableEx_clickHandler(dispatch_HashMap_HashMap_HashMap_get(TrackableEx_trackableObjects, trackableToIndex(GetTriggeringTrackable())), playerFromIndex(dispatch_HashMap_HashMap_HashMap_get(TrackableEx_trackableOwner, trackableToIndex(GetTriggeringTrackable()))))
endfunction

function TrackableEx_closure_impl_3 takes nothing returns nothing
	set TrackableEx_playerClickBefore[timer_getData(GetExpiredTimer())] = false
endfunction

function unit_setUserData takes unit this, integer data returns nothing
	call SetUnitUserData(this, data)
endfunction

function UnitIndex_onDestroy takes integer this returns nothing
	call unit_setUserData(UnitIndex__unit[this], 0)
endfunction

function dealloc_UnitIndex takes integer obj returns nothing
	if UnitIndex_typeId[obj] == 0 then
		call error("Double free: object of type UnitIndex")
	else
		set UnitIndex_nextFree[UnitIndex_firstFree] = obj
		set UnitIndex_firstFree = UnitIndex_firstFree + 1
		set UnitIndex_typeId[obj] = 0
	endif
endfunction

function destroyUnitIndex takes integer this returns nothing
	call UnitIndex_onDestroy(this)
	call dealloc_UnitIndex(this)
endfunction

function dispatch_UnitIndex_destroyUnitIndex takes integer this returns nothing
	if UnitIndex_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling UnitIndex.UnitIndex")
		else
			call error("Called UnitIndex.UnitIndex on invalid object.")
		endif
	endif
	call destroyUnitIndex(this)
endfunction

function alloc_UnitIndex takes nothing returns integer
	local integer this
	if UnitIndex_firstFree == 0 then
		if UnitIndex_maxIndex < 32768 then
			set UnitIndex_maxIndex = UnitIndex_maxIndex + 1
			set this = UnitIndex_maxIndex
			set UnitIndex_typeId[this] = 728
		else
			call error("Out of memory: Could not create UnitIndex.")
			set this = 0
		endif
	else
		set UnitIndex_firstFree = UnitIndex_firstFree - 1
		set this = UnitIndex_nextFree[UnitIndex_firstFree]
		set UnitIndex_typeId[this] = 728
	endif
	return this
endfunction

function construct_UnitIndex takes integer this, unit whichUnit returns nothing
	set UnitIndex__unit[this] = whichUnit
	call unit_setUserData(UnitIndex__unit[this], this)
endfunction

function new_UnitIndex takes unit whichUnit returns integer
	local integer this = alloc_UnitIndex()
	call construct_UnitIndex(this, whichUnit)
	return this
endfunction

function unit_toUnitIndex takes unit this returns integer
	local integer instance = unit_getUserData(this)
	if instance == 0 then
		set instance = new_UnitIndex(this)
	endif
	return instance
endfunction

function UnitIndexer_closure_impl takes nothing returns nothing
	call dispatch_UnitIndex_destroyUnitIndex(unit_toUnitIndex(getEnterLeaveUnit()))
endfunction

function UnitIndexer_closure_impl_2 takes nothing returns nothing
	call new_UnitIndex(getEnterLeaveUnit())
endfunction

function alloc_Order takes nothing returns integer
	local integer this
	if Order_firstFree == 0 then
		if Order_maxIndex < 32768 then
			set Order_maxIndex = Order_maxIndex + 1
			set this = Order_maxIndex
			set Order_typeId[this] = 694
		else
			call error("Out of memory: Could not create Order.")
			set this = 0
		endif
	else
		set Order_firstFree = Order_firstFree - 1
		set this = Order_nextFree[Order_firstFree]
		set Order_typeId[this] = 694
	endif
	return this
endfunction

function OrderQueue_orders_set takes integer instanceId, integer arrayIndex, integer value returns nothing
	if arrayIndex < 0 or arrayIndex >= 3 then
		call error("Index out of Bounds")
	elseif arrayIndex <= 1 then
		if arrayIndex <= 0 then
			set OrderQueue_orders_0[instanceId] = value
		else
			set OrderQueue_orders_1[instanceId] = value
		endif
	else
		set OrderQueue_orders_2[instanceId] = value
	endif
endfunction

function OrderQueue_enqueue takes integer this, integer o returns nothing
	if OrderQueue_size[this] < LastOrder_ORDERS_TO_HOLD then
		set OrderQueue_size[this] = OrderQueue_size[this] + 1
		set OrderQueue_rp[this] = ModuloInteger(OrderQueue_rp[this] + 1, LastOrder_ORDERS_TO_HOLD)
		call OrderQueue_orders_set(this, OrderQueue_rp[this], o)
	else
		call dispatch_Order_destroyOrder(dispatch_OrderQueue_LastOrder_OrderQueue_dequeue(this))
		call OrderQueue_enqueue(this, o)
	endif
endfunction

function dispatch_OrderQueue_LastOrder_OrderQueue_enqueue takes integer this, integer o returns nothing
	if OrderQueue_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling OrderQueue.enqueue")
		else
			call error("Called OrderQueue.enqueue on invalid object.")
		endif
	endif
	call OrderQueue_enqueue(this, o)
endfunction

function alloc_OrderQueue takes nothing returns integer
	local integer this
	if OrderQueue_firstFree == 0 then
		if OrderQueue_maxIndex < 32768 then
			set OrderQueue_maxIndex = OrderQueue_maxIndex + 1
			set this = OrderQueue_maxIndex
			set OrderQueue_typeId[this] = 695
		else
			call error("Out of memory: Could not create OrderQueue.")
			set this = 0
		endif
	else
		set OrderQueue_firstFree = OrderQueue_firstFree - 1
		set this = OrderQueue_nextFree[OrderQueue_firstFree]
		set OrderQueue_typeId[this] = 695
	endif
	return this
endfunction

function construct_OrderQueue takes integer this returns nothing
	set OrderQueue_fp[this] = 0
	set OrderQueue_rp[this] = 0
	set OrderQueue_size[this] = 0
endfunction

function new_OrderQueue takes nothing returns integer
	local integer this = alloc_OrderQueue()
	call construct_OrderQueue(this)
	return this
endfunction

function construct_Order takes integer this, unit ordered, integer ordid, integer ordtype, widget target, real ordx, real ordy returns nothing
	local integer index
	call debugPrint("Allocated instance of Order with : " + OrderId2String(ordid), 3)
	set index = unit_getUserData(ordered)
	if LastOrder_orderQueues[index] == 0 then
		set LastOrder_orderQueues[index] = new_OrderQueue()
	endif
	call dispatch_OrderQueue_LastOrder_OrderQueue_enqueue(LastOrder_orderQueues[index], this)
endfunction

function new_Order takes unit ordered, integer ordid, integer ordtype, widget target, real ordx, real ordy returns integer
	local integer this = alloc_Order()
	call construct_Order(this, ordered, ordid, ordtype, target, ordx, ordy)
	return this
endfunction

function actions takes nothing returns nothing
	local unit u = GetTriggerUnit()
	local widget t = GetOrderTarget()
	local integer oid = GetIssuedOrderId()
	if GetTriggerEventId() == EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER then
		call new_Order(u, oid, 0, t, GetWidgetX(t), GetWidgetY(t))
	elseif GetTriggerEventId() == EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER then
		call new_Order(u, oid, 1, null, GetOrderPointX(), GetOrderPointY())
	elseif GetTriggerEventId() == EVENT_PLAYER_UNIT_ISSUED_ORDER then
		call new_Order(u, oid, 2, null, GetUnitX(u), GetUnitY(u))
	else
		call error("invalid Ordertype")
	endif
	set u = null
	set t = null
endfunction

function unit_getState takes unit this, unitstate state returns real
	return GetUnitState(this, state)
endfunction

function unit_getHP takes unit this returns real
	return unit_getState(this, UNIT_STATE_LIFE)
endfunction

function unit_setHP takes unit this, real hp returns nothing
	call unit_setState(this, UNIT_STATE_LIFE, hp)
endfunction

function dealCodeDamage takes unit who, unit target, real damage returns nothing
	local integer prevType = DamageType_lastDamageType
	local real hp = unit_getHP(target) - .405
	set DamageType_lastDamageType = 3
	if hp > damage then
		call unit_setHP(target, hp - damage + .405)
		call UnitDamageTarget(who, target, 0., true, false, DamageType_ATTACK_TYPE_UNIVERSAL, DAMAGE_TYPE_UNIVERSAL, null)
	else
		call UnitDamageTarget(who, target, 1000000. + damage, true, false, DamageType_ATTACK_TYPE_UNIVERSAL, DAMAGE_TYPE_UNIVERSAL, null)
		call UnitDamageTarget(who, target, 1000000. + damage, true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_UNIVERSAL, null)
	endif
	set DamageType_lastDamageType = prevType
endfunction

function DelayDat_onDestroy takes integer this returns nothing
endfunction

function dealloc_DelayDat takes integer obj returns nothing
	if DelayDat_typeId[obj] == 0 then
		call error("Double free: object of type DelayDat")
	else
		set DelayDat_nextFree[DelayDat_firstFree] = obj
		set DelayDat_firstFree = DelayDat_firstFree + 1
		set DelayDat_typeId[obj] = 0
	endif
endfunction

function destroyDelayDat takes integer this returns nothing
	call DelayDat_onDestroy(this)
	call dealloc_DelayDat(this)
endfunction

function dispatch_DelayDat_destroyDelayDat takes integer this returns nothing
	if DelayDat_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling DelayDat.DelayDat")
		else
			call error("Called DelayDat.DelayDat on invalid object.")
		endif
	endif
	call destroyDelayDat(this)
endfunction

function after takes nothing returns nothing
	local timer time = GetExpiredTimer()
	local integer tempDat = timer_getData(time)
	call dealCodeDamage(DelayDat_source[tempDat], DelayDat_target[tempDat], DelayDat_damage[tempDat])
	call dispatch_DelayDat_destroyDelayDat(tempDat)
	call timer_release(time)
	set time = null
endfunction

function multiboard_display takes multiboard this, boolean show returns nothing
	call MultiboardDisplay(this, show)
endfunction

function multiboard_getItem takes multiboard this, integer row, integer column returns multiboarditem
	return MultiboardGetItem(this, row, column)
endfunction

function multiboard_setColumnCount takes multiboard this, integer count returns nothing
	call MultiboardSetColumnCount(this, count)
endfunction

function multiboard_setItemsStyle takes multiboard this, boolean showValues, boolean showIcons returns nothing
	call MultiboardSetItemsStyle(this, showValues, showIcons)
endfunction

function multiboard_setItemsWidth takes multiboard this, real width returns nothing
	call MultiboardSetItemsWidth(this, width)
endfunction

function multiboard_setRowCount takes multiboard this, integer count returns nothing
	call MultiboardSetRowCount(this, count)
endfunction

function multiboard_setTitle takes multiboard this, string label returns nothing
	call MultiboardSetTitleText(this, label)
endfunction

function multiboarditem_setValue takes multiboarditem this, string value returns nothing
	call MultiboardSetItemValue(this, value)
endfunction

function createMultiboard takes nothing returns nothing
	local multiboarditem mbi
	local integer i
	local integer temp
	local string s
	set InstanceBoard_mb = CreateMultiboard()
	call multiboard_setColumnCount(InstanceBoard_mb, 2)
	call multiboard_setRowCount(InstanceBoard_mb, InstanceBoard_classes + 1)
	call multiboard_setItemsStyle(InstanceBoard_mb, true, false)
	call multiboard_setItemsWidth(InstanceBoard_mb, 0.10)
	call multiboard_setTitle(InstanceBoard_mb, "Instance Board")
	set mbi = multiboard_getItem(InstanceBoard_mb, 0, 0)
	call multiboarditem_setValue(mbi, "ClassName")
	set mbi = multiboard_getItem(InstanceBoard_mb, 0, 1)
	call multiboarditem_setValue(mbi, "Instance count")
	set i = 1
	set temp = InstanceBoard_classes
	loop
		exitwhen i > temp
		set s = InstanceBoard_nameOfClass[i]
		if s != null then
			set mbi = multiboard_getItem(InstanceBoard_mb, i, 0)
			call multiboarditem_setValue(mbi, s)
			set mbi = multiboard_getItem(InstanceBoard_mb, i, 1)
			call multiboarditem_setValue(mbi, int_toString(InstanceBoard_count[i]))
		endif
		set i = i + 1
	endloop
	call multiboard_display(InstanceBoard_mb, true)
	set mbi = null
endfunction

function damageAOE_DestructablesEnum takes nothing returns boolean
	local destructable target = GetFilterDestructable()
	local integer dmg = Damager_instc
	local real dx = Damager_aoeX[dmg] - GetDestructableX(target)
	local real dy = Damager_aoeY[dmg] - GetDestructableY(target)
	if dx * dx + dy * dy >= Damager_aoeRadius[dmg] + Damager_EPSILON then
		set target = null
		return false
	endif
	set Damager_countAOE[dmg] = Damager_countAOE[dmg] + 1
	if Damager_usefx[dmg] then
		call DestroyEffect(AddSpecialEffectTarget(Damager_fxpath[dmg], target, Damager_fxattach[dmg]))
	endif
	call UnitDamageTarget(Damager_sourceAOE[dmg], target, Damager_aoeDamage[dmg], true, Damager_ranged[dmg], Damager_atype[dmg], Damager_dtype[dmg], Damager_wtype[dmg])
	set Damager_instc = dmg
	set target = null
	return false
endfunction

function Damager_fc_get takes integer index1, integer index2 returns real
	local real returnVal
	if index2 < 0 or index2 >= 3 then
		call error("Index out of Bounds")
	elseif index2 <= 1 then
		if index2 <= 0 then
			set returnVal = Damager_fc_0[index1]
		else
			set returnVal = Damager_fc_1[index1]
		endif
	else
		set returnVal = Damager_fc_2[index1]
	endif
	return returnVal
endfunction

function Damager_fct_get takes integer index1, integer index2 returns integer
	local integer returnVal
	if index2 < 0 or index2 >= 3 then
		call error("Index out of Bounds")
	elseif index2 <= 1 then
		if index2 <= 0 then
			set returnVal = Damager_fct_0[index1]
		else
			set returnVal = Damager_fct_1[index1]
		endif
	else
		set returnVal = Damager_fct_2[index1]
	endif
	return returnVal
endfunction

function Damager_getDamageTypeFactor takes unit u, attacktype a, damagetype d returns real
	local real hp = GetWidgetLife(u)
	local real mana = GetUnitState(u, UNIT_STATE_MANA)
	local real fc = Damager_FACTOR_TEST_DAMAGE
	local real r
	call SetUnitX(Damager_dmger, GetUnitX(u))
	call SetUnitY(Damager_dmger, GetUnitY(u))
	call SetUnitOwner(Damager_dmger, GetOwningPlayer(u), false)
	set r = hp
	if hp < Damager_FACTOR_TEST_DAMAGE * Damager_MAX_DAMAGE_FACTOR then
		call SetWidgetLife(u, hp + Damager_FACTOR_TEST_DAMAGE * Damager_MAX_DAMAGE_FACTOR)
		set r = hp + Damager_FACTOR_TEST_DAMAGE * Damager_MAX_DAMAGE_FACTOR
		set fc = GetWidgetLife(u) - hp + Damager_EPSILON
	endif
	call UnitDamageTarget(Damager_dmger, u, fc, false, false, a, d, null)
	if IsUnitType(u, UNIT_TYPE_DEAD) and hp > 0.405 then
		call error("xedamage: For some reason, the unit being tested by getDamageTypeFactor has died. Verify MAX_DAMAGE_FACTOR is to a correct value. ")
	endif
	call SetUnitOwner(Damager_dmger, Player(15), false)
	if mana > GetUnitState(u, UNIT_STATE_MANA) then
		call SetUnitState(u, UNIT_STATE_MANA, mana)
		set r = 1.
	else
		set r = (r - GetWidgetLife(u)) / fc
	endif
	call SetWidgetLife(u, hp)
	return r
endfunction

function hashtable_loadReal takes hashtable this, integer parentKey, integer childKey returns real
	return LoadReal(this, parentKey, childKey)
endfunction

function Table_loadReal takes integer this, integer parentKey returns real
	return hashtable_loadReal(Table_ht, this, parentKey)
endfunction

function dispatch_Table_Table_Table_loadReal takes integer this, integer parentKey returns real
	local real Table_Table_loadReal_result
	if Table_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling Table.loadReal")
		else
			call error("Called Table.loadReal on invalid object.")
		endif
	endif
	set Table_Table_loadReal_result = Table_loadReal(this, parentKey)
	return Table_Table_loadReal_result
endfunction

function Damager_getTargetFactorCore takes integer this, unit source, unit target, boolean usetypes returns real
	local player p = GetOwningPlayer(source)
	local boolean allied = IsUnitAlly(target, p)
	local boolean enemy = IsUnitEnemy(target, p)
	local boolean neutral = allied
	local real negf = 1.0
	local real f
	local integer i
	if Damager_damageAllies[this] != Damager_damageNeutral[this] then
		set neutral = allied and ( not GetPlayerAlliance(GetOwningPlayer(target), p, ALLIANCE_HELP_REQUEST))
		set allied = allied and ( not neutral)
	endif
	if ( not Damager_damageAllies[this]) and allied then
		set p = null
		return 0.0
	elseif ( not Damager_damageEnemies[this]) and enemy then
		set p = null
		return 0.0
	elseif ( not Damager_damageSelf[this]) and source == target then
		set p = null
		return 0.0
	elseif ( not Damager_damageNeutral[this]) and neutral then
		set p = null
		return 0.0
	elseif Damager_use_ex[this] and IsUnitType(target, Damager_ex_ut[this]) then
		set p = null
		return 0.0
	elseif Damager_visibleOnly[this] and ( not IsUnitVisible(target, p)) then
		set p = null
		return 0.0
	elseif Damager_deadOnly[this] and ( not IsUnitType(target, UNIT_TYPE_DEAD)) then
		set p = null
		return 0.0
	elseif ( not Damager_alsoDead[this]) and IsUnitType(target, UNIT_TYPE_DEAD) then
		set p = null
		return 0.0
	endif
	set f = 1.0
	if IsUnitAlly(target, p) then
		set f = f * Damager_allyfactor[this]
		if f <= ( - Damager_EPSILON) then
			set f =  - f
			set negf =  - 1.0
		endif
	endif
	if Damager_use_req[this] and ( not IsUnitType(target, Damager_req_ut[this])) then
		set p = null
		return 0.0
	endif
	set i = Damager_fcn[this] - 1
	loop
		exitwhen  not (i >= 0)
		if IsUnitType(target, ConvertUnitType(Damager_fct_get(this, i))) then
			set f = f * Damager_fc_get(this, i)
			if f <= ( - Damager_EPSILON) then
				set f =  - f
				set negf =  - 1.0
			endif
		endif
		set i = i - 1
	endloop
	set i = Damager_abifcn[this] - 1
	loop
		exitwhen  not (i >= 0)
		if GetUnitAbilityLevel(target, dispatch_Table_Table_Table_loadInt(Damager_abifct[this], i)) > 0 then
			set f = f * dispatch_Table_Table_Table_loadReal(Damager_abifc[this], i)
			if f <= ( - Damager_EPSILON) then
				set f =  - f
				set negf =  - 1.0
			endif
		endif
		set i = i - 1
	endloop
	set f = f * negf
	if f < Damager_EPSILON and f > ( - Damager_EPSILON) then
		set p = null
		return 0.0
	endif
	if Damager_forceDamage[this] or ( not usetypes) then
		set p = null
		return f
	endif
	set f = f * Damager_getDamageTypeFactor(target, Damager_atype[this], Damager_dtype[this])
	if f < Damager_EPSILON and f > ( - Damager_EPSILON) then
		set p = null
		return 0.0
	endif
	set p = null
	return f
endfunction

function dispatch_Damager_Damager_Damager_getTargetFactorCore takes integer this, unit source, unit target, boolean usetypes returns real
	local real Damager_Damager_getTargetFactorCore_result
	if Damager_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling Damager.getTargetFactorCore")
		else
			call error("Called Damager.getTargetFactorCore on invalid object.")
		endif
	endif
	set Damager_Damager_getTargetFactorCore_result = Damager_getTargetFactorCore(this, source, target, usetypes)
	return Damager_Damager_getTargetFactorCore_result
endfunction

function damageAOE_Enum takes nothing returns boolean
	local unit target = GetFilterUnit()
	local integer dmg = Damager_instc
	local real hp = 0.
	local real f
	if  not IsUnitInRangeXY(target, Damager_aoeX[dmg], Damager_aoeY[dmg], Damager_aoeRadius[dmg]) then
		set target = null
		return false
	endif
	set f = dispatch_Damager_Damager_Damager_getTargetFactorCore(dmg, Damager_sourceAOE[dmg], target, false)
	if f != 0.0 then
		set Damager_countAOE[dmg] = Damager_countAOE[dmg] + 1
		if Damager_usefx[dmg] then
			set hp = GetWidgetLife(target)
		endif
		call UnitDamageTarget(Damager_sourceAOE[dmg], target, f * Damager_aoeDamage[dmg], true, Damager_ranged[dmg], Damager_atype[dmg], Damager_dtype[dmg], Damager_wtype[dmg])
		if Damager_usefx[dmg] and hp > GetWidgetLife(target) then
			call DestroyEffect(AddSpecialEffectTarget(Damager_fxpath[dmg], target, Damager_fxattach[dmg]))
		endif
	endif
	set Damager_instc = dmg
	set target = null
	return false
endfunction

function disableXpGain takes nothing returns nothing
	local integer i = 0
	loop
		exitwhen i > 12
		call SetPlayerHandicapXP(Player(i), 0.00)
		set i = i + 1
	endloop
	call DestroyTimer(GetExpiredTimer())
endfunction

function trigger_addCondition takes trigger this, boolexpr condition returns nothing
	call TriggerAddCondition(this, condition)
endfunction

function trigger_clearConditions takes trigger this returns nothing
	call TriggerClearConditions(this)
endfunction

function evaluateEvent takes nothing returns boolean
	local unit caster = GetSpellAbilityUnit()
	local integer i
	local integer temp
	call debugPrint(unit_getName(caster), 2)
	set i = 0
	set temp = EventHandling_count - 1
	loop
		exitwhen i > temp
		call debugPrint(int_toString(i), 2)
		if EventHandling_casters[i] == caster then
			call trigger_addCondition(EventHandling_evalTrig, EventHandling_conds[i])
			call trigger_evaluate(EventHandling_evalTrig)
			call trigger_clearConditions(EventHandling_evalTrig)
		endif
		set i = i + 1
	endloop
	set caster = null
	return false
endfunction

function currentCallback takes nothing returns integer
	return ClosureForGroups_tempCallbacks[ClosureForGroups_tempCallbacksCount - 1]
endfunction

function DamageType_closure_impl_2 takes integer this, unit iter returns nothing
	local unit receiver = iter
	local unit receiver_2
	call unit_addAbility(receiver, DamageType_DAMAGE_TYPE_CHECK_ID)
	set receiver_2 = receiver
	call unit_makeAbilityPermanent(receiver_2, DamageType_DAMAGE_TYPE_CHECK_ID, true)
	set receiver = null
	set receiver_2 = null
endfunction

function dispatch_ForGroupCallback_ClosureForGroups_ForGroupCallback_callback takes integer this, unit u returns nothing
	if ForGroupCallback_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling ForGroupCallback.callback")
		else
			call error("Called ForGroupCallback.callback on invalid object.")
		endif
	endif
	call DamageType_closure_impl_2(this, u)
endfunction

function filter takes nothing returns boolean
	call dispatch_ForGroupCallback_ClosureForGroups_ForGroupCallback_callback(currentCallback(), GetFilterUnit())
	return false
endfunction

function filter_2 takes nothing returns boolean
	local unit u = GetFilterUnit()
	local boolean b1 = IsUnitType(u, UNIT_TYPE_DEAD) == false
	local boolean b2 = IsUnitType(u, UNIT_TYPE_HERO) == true
	local boolean b3 = IsUnitAlly(u, GetOwningPlayer(GetKillingUnit())) == true
	set u = null
	return b1 and b2 and b3
endfunction

function finishPreload takes nothing returns nothing
	local group iterator
	local unit u
	call RemoveUnit(PreloadHandler_dum)
	set iterator = group_iterator(PreloadHandler_dumg)
	loop
		exitwhen  not group_hasNext(iterator)
		set u = group_next(iterator)
		call unit_remove(u)
	endloop
	call group_close(iterator)
	call group_destr(PreloadHandler_dumg)
	if GetExpiredTimer() != null then
		call DestroyTimer(GetExpiredTimer())
	endif
	set iterator = null
	set u = null
endfunction

function texttag_setColor takes texttag this, integer col_red, integer col_green, integer col_blue, integer col_alpha returns nothing
	call SetTextTagColor(this, col_red, col_green, col_blue, col_alpha)
endfunction

function texttag_setFadepoint takes texttag this, real fadepoint returns nothing
	call SetTextTagFadepoint(this, fadepoint)
endfunction

function texttag_setLifespan takes texttag this, real span returns nothing
	call SetTextTagLifespan(this, span)
endfunction

function texttag_setPermanent takes texttag this, boolean flag returns nothing
	call SetTextTagPermanent(this, flag)
endfunction

function texttag_setPos takes texttag this, real pos_x, real pos_y, real pos_z returns nothing
	call SetTextTagPos(this, pos_x, pos_y, pos_z)
endfunction

function texttag_setText takes texttag this, string text, real size returns nothing
	call SetTextTagText(this, text, size * 0.0023)
endfunction

function texttag_setVelocity takes texttag this, real xvel, real yvel returns nothing
	call SetTextTagVelocity(this, xvel, yvel)
endfunction

function vec2_withZ takes real this_x, real this_y, real z returns real
	set vec2_withZ_return_x = this_x
	set vec2_withZ_return_y = this_y
	set vec2_withZ_return_z = z
	return vec2_withZ_return_x
endfunction

function createTTEx takes real pos_x, real pos_y, real pos_z, real vel_x, real vel_y, string message, real size, real duration, integer col_red, integer col_green, integer col_blue, integer col_alpha returns texttag
	local texttag receiver = CreateTextTag()
	local texttag receiver_2
	local texttag receiver_3
	local texttag receiver_4
	local texttag receiver_5
	local texttag receiver_6
	local texttag receiver_7
	call texttag_setPos(receiver, vec2_withZ(vec3_toVec2(pos_x, pos_y, pos_z), vec3_toVec2_return_y, 20.), vec2_withZ_return_y, vec2_withZ_return_z)
	set receiver_2 = receiver
	call texttag_setText(receiver_2, message, size)
	set receiver_3 = receiver_2
	call texttag_setColor(receiver_3, col_red, col_green, col_blue, col_alpha)
	set receiver_4 = receiver_3
	call texttag_setVelocity(receiver_4, vel_x, vel_y)
	set receiver_5 = receiver_4
	call texttag_setLifespan(receiver_5, duration)
	set receiver_6 = receiver_5
	call texttag_setFadepoint(receiver_6, .1)
	set receiver_7 = receiver_6
	call texttag_setPermanent(receiver_7, false)
	set createTTExtempReturn = receiver_7
	set receiver = null
	set receiver_2 = null
	set receiver_3 = null
	set receiver_4 = null
	set receiver_5 = null
	set receiver_6 = null
	set receiver_7 = null
	return createTTExtempReturn
endfunction

function distanceBetweenCoords takes real x1, real y1, real x2, real y2 returns real
	return SquareRoot((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1))
endfunction

function expFilter takes integer exp, unit w_u returns integer
	return exp
endfunction

function formula takes integer xPfactor, integer unitlevel, integer heroesinradius, integer bonus returns integer
	return xPfactor * unitlevel + heroesinradius * bonus
endfunction

function unit_getOwner takes unit this returns player
	return GetOwningPlayer(this)
endfunction

function vec2_toVec3 takes real this_x, real this_y returns real
	set vec2_toVec3_return_x = this_x
	set vec2_toVec3_return_y = this_y
	set vec2_toVec3_return_z = 0.
	return vec2_toVec3_return_x
endfunction

function giveXP takes nothing returns nothing
	local unit deadUnit = GetTriggerUnit()
	local real dx = unit_getX(deadUnit)
	local real dy = unit_getY(deadUnit)
	local unit killer = GetKillingUnit()
	local player killerPlayer = unit_getOwner(killer)
	local integer add = 0
	local real kx = unit_getX(killer)
	local real ky = unit_getY(killer)
	local integer killedUnitLevel
	local integer unitNum
	local group iterator
	local unit f
	local real distance
	local group iterator_2
	local unit f_2
	call GroupEnumUnitsInRange(TempGroups_ENUM_GROUP, kx, ky, CustomExp_RADIUS, Condition(ref_function_filter_2))
	call ForGroup(TempGroups_ENUM_GROUP, function CountUnitsInGroupEnum)
	set unitNum = bj_groupCountUnits
	if IsUnitAlly(deadUnit, killerPlayer) == false then
		if IsUnitType(deadUnit, UNIT_TYPE_HERO) == true then
			set killedUnitLevel = GetHeroLevel(deadUnit)
			set add = formula(CustomExp_HERO_EXP, killedUnitLevel, unitNum, CustomExp_BONUS_EXP)
		else
			set killedUnitLevel = GetUnitLevel(deadUnit)
			set add = formula(CustomExp_UNIT_EXP, killedUnitLevel, unitNum, CustomExp_BONUS_EXP)
		endif
	endif
	if CustomExp_SPLIT then
		set add = R2I(add * 1. / unitNum)
	endif
	if CustomExp_DISTANCE_EFFECT then
		set add = expFilter(add, deadUnit)
		set iterator = group_iterator(TempGroups_ENUM_GROUP)
		loop
			exitwhen  not group_hasNext(iterator)
			set f = group_next(iterator)
			set distance = distanceBetweenCoords(dx, dy, kx, ky)
			if distance > CustomExp_MEDIUM * CustomExp_MEDIUM and distance <= CustomExp_FAR * CustomExp_FAR then
				call SetPlayerHandicapXP(GetOwningPlayer(f), 1.00)
				set add = R2I(add * CustomExp_FAR_FACTOR)
				call AddHeroXP(f, add, true)
				call SetPlayerHandicapXP(GetOwningPlayer(f), 0.00)
			elseif distance > CustomExp_CLOSE * CustomExp_CLOSE and distance <= CustomExp_MEDIUM * CustomExp_MEDIUM then
				call SetPlayerHandicapXP(GetOwningPlayer(f), 1.00)
				set add = R2I(add * CustomExp_MEDIUM_FACTOR)
				call AddHeroXP(f, add, true)
				call SetPlayerHandicapXP(GetOwningPlayer(f), 0.00)
			elseif distance <= CustomExp_CLOSE * CustomExp_CLOSE then
				call SetPlayerHandicapXP(GetOwningPlayer(f), 1.00)
				set add = R2I(add * CustomExp_CLOSE_FACTOR)
				call AddHeroXP(f, add, true)
				call SetPlayerHandicapXP(GetOwningPlayer(f), 0.00)
			endif
			if CustomExp_SHOW_TEXT and add > 0 then
				call createTTEx(vec2_toVec3(unit_getPos(f), unit_getPos_return_y), vec2_toVec3_return_y, vec2_toVec3_return_z, 0., 0., "+ " + I2S(add), CustomExp_SIZE, CustomExp_DURATION, CustomExp_RED, CustomExp_GREEN, CustomExp_BLUE, 255)
			endif
		endloop
		call group_close(iterator)
	else
		set add = expFilter(add, deadUnit)
		set iterator_2 = group_iterator(TempGroups_ENUM_GROUP)
		loop
			exitwhen  not group_hasNext(iterator_2)
			set f_2 = group_next(iterator_2)
			if CustomExp_SHOW_TEXT and add > 0 then
				call createTTEx(vec2_toVec3(unit_getPos(f_2), unit_getPos_return_y), vec2_toVec3_return_y, vec2_toVec3_return_z, 0., 0., "+ " + I2S(add), CustomExp_SIZE, CustomExp_DURATION, CustomExp_RED, CustomExp_GREEN, CustomExp_BLUE, 255)
			endif
			call SetPlayerHandicapXP(GetOwningPlayer(f_2), 1.00)
			call AddHeroXP(f_2, add, true)
			call SetPlayerHandicapXP(GetOwningPlayer(f_2), 0.00)
		endloop
		call group_close(iterator_2)
	endif
	call group_clear(TempGroups_ENUM_GROUP)
	set deadUnit = null
	set killer = null
	set killerPlayer = null
	set iterator = null
	set f = null
	set iterator_2 = null
	set f_2 = null
endfunction

function dispatch_OnCast_ClosureEvents_OnCast_run takes integer this, unit caster, integer lvl returns nothing
endfunction

function dispatch_OnPointCast_ClosureEvents_OnPointCast_run takes integer this, unit caster, integer lvl, real pos_x, real pos_y returns nothing
endfunction

function dispatch_OnUnitCast_ClosureEvents_OnUnitCast_run takes integer this, unit caster, integer lvl, unit target returns nothing
endfunction

function handleCasts takes nothing returns nothing
	local unit caster = GetTriggerUnit()
	local integer lvl = GetUnitAbilityLevel(caster, GetSpellAbilityId())
	local integer c = dispatch_HashMap_HashMap_HashMap_get(Cast_casts, GetSpellAbilityId())
	if c != 0 then
		if Cast_typeId[c] == 644 then
			call dispatch_OnCast_ClosureEvents_OnCast_run(c, caster, lvl)
		endif
		if Cast_typeId[c] == 645 then
			call dispatch_OnPointCast_ClosureEvents_OnPointCast_run(c, caster, lvl, GetSpellTargetX(), GetSpellTargetY())
		endif
		if Cast_typeId[c] == 646 then
			call dispatch_OnUnitCast_ClosureEvents_OnUnitCast_run(c, caster, lvl, GetSpellTargetUnit())
		endif
	endif
	set caster = null
endfunction

function getDamageType takes nothing returns integer
	local real sourceDamage = GetEventDamage()
	if DamageType_lastDamageType == 3 then
		return 3
	elseif sourceDamage > 0. then
		return 1
	elseif sourceDamage < 0. then
		return 2
	endif
	return 0
endfunction

function unit_getMaxHP takes unit this returns real
	return unit_getState(this, UNIT_STATE_MAX_LIFE)
endfunction

function getUnitBonusSpellResistance takes unit u returns real
	local integer prevType = DamageType_lastDamageType
	local real life = unit_getHP(u)
	local real scale = unit_getMaxHP(u)
	call unit_setHP(u, scale)
	set DamageType_lastDamageType = 3
	call UnitDamageTarget(u, u,  - (scale / 2.), false, false, null, DAMAGE_TYPE_UNIVERSAL, null)
	set scale = 2. * (scale - unit_getHP(u)) / scale
	call unit_setHP(u, life)
	set DamageType_lastDamageType = prevType
	return scale
endfunction

function alloc_DelayDat takes nothing returns integer
	local integer this
	if DelayDat_firstFree == 0 then
		if DelayDat_maxIndex < 32768 then
			set DelayDat_maxIndex = DelayDat_maxIndex + 1
			set this = DelayDat_maxIndex
			set DelayDat_typeId[this] = 651
		else
			call error("Out of memory: Could not create DelayDat.")
			set this = 0
		endif
	else
		set DelayDat_firstFree = DelayDat_firstFree - 1
		set this = DelayDat_nextFree[DelayDat_firstFree]
		set DelayDat_typeId[this] = 651
	endif
	return this
endfunction

function construct_DelayDat takes integer this returns nothing
endfunction

function new_DelayDat takes nothing returns integer
	local integer this = alloc_DelayDat()
	call construct_DelayDat(this)
	return this
endfunction

function handler takes nothing returns boolean
	local real attemptedDamage
	local unit tU
	local real scale
	local real sampledLife
	local integer tempDat
	local timer receiver
	local timer receiver_2
	if getDamageType() == 2 then
		set attemptedDamage =  - (1. * GetEventDamage())
		set tU = GetTriggerUnit()
		if DamageType_useBonusCalculator then
			set scale = getUnitBonusSpellResistance(tU)
			if scale > 1. then
				set attemptedDamage = attemptedDamage * (scale + 1.) / 2.
			endif
		endif
		set sampledLife = unit_getHP(tU) - .405
		if sampledLife >= attemptedDamage and sampledLife <= 2. * attemptedDamage then
			call unit_setHP(tU, sampledLife - attemptedDamage)
			set tempDat = new_DelayDat()
			set DelayDat_target[tempDat] = tU
			set DelayDat_source[tempDat] = GetEventDamageSource()
			set DelayDat_damage[tempDat] = attemptedDamage
			set receiver = getTimer()
			call timer_setData(receiver, tempDat)
			set receiver_2 = receiver
			call timer_start(receiver_2, 0., ref_function_after)
		else
			call dealCodeDamage(GetEventDamageSource(), tU, 2. * attemptedDamage)
		endif
	endif
	set tU = null
	set receiver = null
	set receiver_2 = null
	return false
endfunction

function hideItem takes nothing returns nothing
	if IsItemVisible(GetEnumItem()) then
		set Terrain_hid[Terrain_hidMax] = GetEnumItem()
		call SetItemVisible(Terrain_hid[Terrain_hidMax], false)
		set Terrain_hidMax = Terrain_hidMax + 1
	endif
endfunction

function initGamecache takes nothing returns nothing
	call InitGameCache("sync")
	call DestroyTimer(GetExpiredTimer())
endfunction

function init_AbilityTooltipGenerator takes nothing returns boolean
	return true
endfunction

function init_AbilityTooltipGenerator_config takes nothing returns boolean
	return true
endfunction

function alloc_FreeNode takes nothing returns integer
	local integer this
	if FreeNode_firstFree == 0 then
		if FreeNode_maxIndex < 32768 then
			set FreeNode_maxIndex = FreeNode_maxIndex + 1
			set this = FreeNode_maxIndex
		else
			call error("Out of memory: Could not create FreeNode.")
			set this = 0
		endif
	else
		set FreeNode_firstFree = FreeNode_firstFree - 1
		set this = FreeNode_nextFree[FreeNode_firstFree]
	endif
	return this
endfunction

function construct_FreeNode2 takes integer this, integer dataPos, integer size returns nothing
endfunction

function new_FreeNode takes integer dataPos, integer size returns integer
	local integer this = alloc_FreeNode()
	call construct_FreeNode2(this, dataPos, size)
	return this
endfunction

function init_ArrayList takes nothing returns boolean
	call new_FreeNode(0, 8191)
	return true
endfunction

function init_Assets takes nothing returns boolean
	return true
endfunction

function init_Basics takes nothing returns boolean
	set Basics_DUMMY_UNIT_ID = 2019849581
	set Basics_HEIGHT_ENABLER = 1097691750
	set Basics_LOCUST_ID = 1097625443
	set Basics_ANIMATION_PERIOD = 0.03
	set Basics_MAX_COLLISION_SIZE = 197.0
	set Basics_DUMMY_PLAYER = Player(15)
	call Player(12)
	return true
endfunction

function init_BigNum takes nothing returns boolean
	return true
endfunction

function alloc_OrderStringFactory takes nothing returns integer
	local integer this
	if OrderStringFactory_firstFree == 0 then
		if OrderStringFactory_maxIndex < 32768 then
			set OrderStringFactory_maxIndex = OrderStringFactory_maxIndex + 1
			set this = OrderStringFactory_maxIndex
		else
			call error("Out of memory: Could not create OrderStringFactory.")
			set this = 0
		endif
	else
		set OrderStringFactory_firstFree = OrderStringFactory_firstFree - 1
		set this = OrderStringFactory_nextFree[OrderStringFactory_firstFree]
	endif
	return this
endfunction

function construct_OrderStringFactory takes integer this returns nothing
endfunction

function new_OrderStringFactory takes nothing returns integer
	local integer this = alloc_OrderStringFactory()
	call construct_OrderStringFactory(this)
	return this
endfunction

function init_ChannelAbilityPreset takes nothing returns boolean
	call new_OrderStringFactory()
	return true
endfunction

function c2sInit takes nothing returns nothing
	set Char_c2s[0] = ""
	set Char_c2s[1] = ""
	set Char_c2s[2] = ""
	set Char_c2s[3] = ""
	set Char_c2s[4] = ""
	set Char_c2s[5] = ""
	set Char_c2s[6] = ""
	set Char_c2s[7] = ""
	set Char_c2s[8] = ""
	set Char_c2s[9] = "\t"
	set Char_c2s[10] = "\n"
	set Char_c2s[11] = ""
	set Char_c2s[12] = ""
	set Char_c2s[13] = "\r"
	set Char_c2s[14] = ""
	set Char_c2s[15] = ""
	set Char_c2s[16] = ""
	set Char_c2s[17] = ""
	set Char_c2s[18] = ""
	set Char_c2s[19] = ""
	set Char_c2s[20] = ""
	set Char_c2s[21] = ""
	set Char_c2s[22] = ""
	set Char_c2s[23] = ""
	set Char_c2s[24] = ""
	set Char_c2s[25] = ""
	set Char_c2s[26] = ""
	set Char_c2s[27] = ""
	set Char_c2s[28] = ""
	set Char_c2s[29] = ""
	set Char_c2s[30] = ""
	set Char_c2s[31] = ""
	set Char_c2s[32] = " "
	set Char_c2s[33] = "!"
	set Char_c2s[34] = "\""
	set Char_c2s[35] = "#"
	set Char_c2s[36] = "$"
	set Char_c2s[37] = "%"
	set Char_c2s[38] = "&"
	set Char_c2s[39] = "'"
	set Char_c2s[40] = "("
	set Char_c2s[41] = ")"
	set Char_c2s[42] = "*"
	set Char_c2s[43] = "+"
	set Char_c2s[44] = ","
	set Char_c2s[45] = "-"
	set Char_c2s[46] = "."
	set Char_c2s[47] = "/"
	set Char_c2s[48] = "0"
	set Char_c2s[49] = "1"
	set Char_c2s[50] = "2"
	set Char_c2s[51] = "3"
	set Char_c2s[52] = "4"
	set Char_c2s[53] = "5"
	set Char_c2s[54] = "6"
	set Char_c2s[55] = "7"
	set Char_c2s[56] = "8"
	set Char_c2s[57] = "9"
	set Char_c2s[58] = ":"
	set Char_c2s[59] = ";"
	set Char_c2s[60] = "<"
	set Char_c2s[61] = "="
	set Char_c2s[62] = ">"
	set Char_c2s[63] = "?"
	set Char_c2s[64] = "@"
	set Char_c2s[65] = "A"
	set Char_c2s[66] = "B"
	set Char_c2s[67] = "C"
	set Char_c2s[68] = "D"
	set Char_c2s[69] = "E"
	set Char_c2s[70] = "F"
	set Char_c2s[71] = "G"
	set Char_c2s[72] = "H"
	set Char_c2s[73] = "I"
	set Char_c2s[74] = "J"
	set Char_c2s[75] = "K"
	set Char_c2s[76] = "L"
	set Char_c2s[77] = "M"
	set Char_c2s[78] = "N"
	set Char_c2s[79] = "O"
	set Char_c2s[80] = "P"
	set Char_c2s[81] = "Q"
	set Char_c2s[82] = "R"
	set Char_c2s[83] = "S"
	set Char_c2s[84] = "T"
	set Char_c2s[85] = "U"
	set Char_c2s[86] = "V"
	set Char_c2s[87] = "W"
	set Char_c2s[88] = "X"
	set Char_c2s[89] = "Y"
	set Char_c2s[90] = "Z"
	set Char_c2s[91] = "["
	set Char_c2s[92] = "\\"
	set Char_c2s[93] = "]"
	set Char_c2s[94] = "^"
	set Char_c2s[95] = "_"
	set Char_c2s[96] = "`"
	set Char_c2s[97] = "a"
	set Char_c2s[98] = "b"
	set Char_c2s[99] = "c"
	set Char_c2s[100] = "d"
	set Char_c2s[101] = "e"
	set Char_c2s[102] = "f"
	set Char_c2s[103] = "g"
	set Char_c2s[104] = "h"
	set Char_c2s[105] = "i"
	set Char_c2s[106] = "j"
	set Char_c2s[107] = "k"
	set Char_c2s[108] = "l"
	set Char_c2s[109] = "m"
	set Char_c2s[110] = "n"
	set Char_c2s[111] = "o"
	set Char_c2s[112] = "p"
	set Char_c2s[113] = "q"
	set Char_c2s[114] = "r"
	set Char_c2s[115] = "s"
	set Char_c2s[116] = "t"
	set Char_c2s[117] = "u"
	set Char_c2s[118] = "v"
	set Char_c2s[119] = "w"
	set Char_c2s[120] = "x"
	set Char_c2s[121] = "y"
	set Char_c2s[122] = "z"
	set Char_c2s[123] = "{"
	set Char_c2s[124] = "|"
	set Char_c2s[125] = "}"
	set Char_c2s[126] = "~"
	set Char_c2s[127] = ""
endfunction

function string_toUpperCase takes string this returns string
	return StringCase(this, true)
endfunction

function s2cInit takes nothing returns nothing
	local integer i = 0
	local integer temp = Char_MAX_INDEX
	loop
		exitwhen i > temp
		if string_toUpperCase(Char_c2s[i]) == Char_c2s[i] then
		endif
		set i = i + 1
	endloop
endfunction

function widthInit takes nothing returns nothing
endfunction

function init_Char takes nothing returns boolean
	set Char_MAX_INDEX = 126 + 1
	call c2sInit()
	call s2cInit()
	call widthInit()
	return true
endfunction

function alloc_HashMap takes nothing returns integer
	local integer this
	if HashMap_firstFree == 0 then
		if HashMap_maxIndex < 32768 then
			set HashMap_maxIndex = HashMap_maxIndex + 1
			set this = HashMap_maxIndex
			set HashMap_typeId[this] = 665
		else
			call error("Out of memory: Could not create HashMap.")
			set this = 0
		endif
	else
		set HashMap_firstFree = HashMap_firstFree - 1
		set this = HashMap_nextFree[HashMap_firstFree]
		set HashMap_typeId[this] = 665
	endif
	return this
endfunction

function construct_HashMap takes integer this returns nothing
endfunction

function new_HashMap takes nothing returns integer
	local integer this = alloc_HashMap()
	call construct_HashMap(this)
	return this
endfunction

function trigger_addAction takes trigger this, code actionFunc returns nothing
	call TriggerAddAction(this, actionFunc)
endfunction

function trigger_registerAnyUnitEvent takes trigger this, playerunitevent whichEvent returns nothing
	call TriggerRegisterAnyUnitEventBJ(this, whichEvent)
endfunction

function init_ClosureEvents takes nothing returns boolean
	local trigger receiver = CreateTrigger()
	local trigger receiver_2
	call trigger_registerAnyUnitEvent(receiver, EVENT_PLAYER_UNIT_SPELL_CAST)
	set receiver_2 = receiver
	call trigger_addAction(receiver_2, ref_function_handleCasts)
	set Cast_casts = new_HashMap()
	call new_HashMap()
	set receiver = null
	set receiver_2 = null
	return true
endfunction

function init_ClosureForGroups takes nothing returns boolean
	set ClosureForGroups_tempCallbacksCount = 0
	set ClosureForGroups_filter = Condition(ref_function_filter)
	return true
endfunction

function init_Collider takes nothing returns boolean
	set Collider_TimedLoop_instanceCount = 0
	set Collider_TimedLoop_triggerCond = null
	call Condition(ref_function_Collider_TimedLoop_onExpire)
	return true
endfunction

function alloc_Table takes nothing returns integer
	local integer this
	if Table_firstFree == 0 then
		if Table_maxIndex < 32768 then
			set Table_maxIndex = Table_maxIndex + 1
			set this = Table_maxIndex
			set Table_typeId[this] = 720
		else
			call error("Out of memory: Could not create Table.")
			set this = 0
		endif
	else
		set Table_firstFree = Table_firstFree - 1
		set this = Table_nextFree[Table_firstFree]
		set Table_typeId[this] = 720
	endif
	return this
endfunction

function construct_Table takes integer this returns nothing
endfunction

function new_Table takes nothing returns integer
	local integer this = alloc_Table()
	call construct_Table(this)
	return this
endfunction

function init_Colors takes nothing returns boolean
	local integer i = 0
	local integer i2
	loop
		exitwhen i > 9
		call int_toString(i)
		set i = i + 1
	endloop
	set Colors_decs = new_Table()
	set i2 = 0
	loop
		exitwhen i2 > 9
		call dispatch_Table_Table_Table_saveInt(Colors_decs, StringHash(int_toString(i2)), i2)
		set i2 = i2 + 1
	endloop
	call dispatch_Table_Table_Table_saveInt(Colors_decs, StringHash("A"), 10)
	call dispatch_Table_Table_Table_saveInt(Colors_decs, StringHash("B"), 11)
	call dispatch_Table_Table_Table_saveInt(Colors_decs, StringHash("C"), 12)
	call dispatch_Table_Table_Table_saveInt(Colors_decs, StringHash("D"), 13)
	call dispatch_Table_Table_Table_saveInt(Colors_decs, StringHash("E"), 14)
	call dispatch_Table_Table_Table_saveInt(Colors_decs, StringHash("F"), 15)
	return true
endfunction

function init_CustomBar takes nothing returns boolean
	call CreateTimer()
	return true
endfunction

function init_CustomExp takes nothing returns boolean
	local trigger t
	set CustomExp_RADIUS = 650.
	set CustomExp_CLOSE = 200.
	set CustomExp_MEDIUM = 400.
	set CustomExp_FAR = 650.
	set CustomExp_CLOSE_FACTOR = 1.
	set CustomExp_MEDIUM_FACTOR = .5
	set CustomExp_FAR_FACTOR = .25
	set CustomExp_UNIT_EXP = 30
	set CustomExp_HERO_EXP = 45
	set CustomExp_BONUS_EXP = 9
	set CustomExp_DURATION = 5.
	set CustomExp_SIZE = 12.
	set CustomExp_RED = 0
	set CustomExp_GREEN = 74
	set CustomExp_BLUE = 255
	set CustomExp_SHOW_TEXT = true
	set CustomExp_SPLIT = true
	set CustomExp_DISTANCE_EFFECT = false
	set t = CreateTrigger()
	call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_DEATH)
	call TriggerAddAction(t, ref_function_giveXP)
	call TimerStart(CreateTimer(), .04, false, ref_function_disableXpGain)
	set t = null
	return true
endfunction

function onEnter takes code c returns nothing
	call trigger_addCondition(OnUnitEnterLeave_eventTrigger, Condition(c))
endfunction

function init_DamageDetection takes nothing returns boolean
	local integer i
	local integer temp
	set DamageDetection_SWAP_TIMEOUT = 600.
	set DamageDetection_funcNext = 0
	set DamageDetection_current = null
	set DamageDetection_toDestroy = null
	set DamageDetection_current = CreateTrigger()
	set i = 0
	set temp = DamageDetection_funcNext - 1
	loop
		exitwhen i > temp
		call trigger_addCondition(DamageDetection_current, DamageDetection_func[i])
		set i = i + 1
	endloop
	call onEnter(ref_function_DamageDetection_closure_impl)
	call GroupEnumUnitsInRect(TempGroups_ENUM_GROUP, MapBounds_boundRect, Filter(ref_function_DamageDetection_closure_impl_2))
	call timer_startPeriodic(CreateTimer(), DamageDetection_SWAP_TIMEOUT, ref_function_swap)
	return true
endfunction

function addOnDamageFunc takes boolexpr cf returns nothing
	call trigger_addCondition(DamageDetection_current, cf)
	set DamageDetection_func[DamageDetection_funcNext] = cf
	set DamageDetection_funcNext = DamageDetection_funcNext + 1
endfunction

function alloc_Closure takes nothing returns integer
	local integer this
	if ForGroupCallback_firstFree == 0 then
		if ForGroupCallback_maxIndex < 32768 then
			set ForGroupCallback_maxIndex = ForGroupCallback_maxIndex + 1
			set this = ForGroupCallback_maxIndex
			set ForGroupCallback_typeId[this] = 659
		else
			call error("Out of memory: Could not create Closure.")
			set this = 0
		endif
	else
		set ForGroupCallback_firstFree = ForGroupCallback_firstFree - 1
		set this = ForGroupCallback_nextFree[ForGroupCallback_firstFree]
		set ForGroupCallback_typeId[this] = 659
	endif
	return this
endfunction

function dealloc_ForGroupCallback takes integer obj returns nothing
	if ForGroupCallback_typeId[obj] == 0 then
		call error("Double free: object of type ForGroupCallback")
	else
		set ForGroupCallback_nextFree[ForGroupCallback_firstFree] = obj
		set ForGroupCallback_firstFree = ForGroupCallback_firstFree + 1
		set ForGroupCallback_typeId[obj] = 0
	endif
endfunction

function destroyForGroupCallback takes integer this returns nothing
	call dealloc_ForGroupCallback(this)
endfunction

function dispatch_ForGroupCallback_destroyForGroupCallback takes integer this returns nothing
	if ForGroupCallback_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling ForGroupCallback.ForGroupCallback")
		else
			call error("Called ForGroupCallback.ForGroupCallback on invalid object.")
		endif
	endif
	call destroyForGroupCallback(this)
endfunction

function popCallback takes nothing returns nothing
	set ClosureForGroups_tempCallbacksCount = ClosureForGroups_tempCallbacksCount - 1
	call dispatch_ForGroupCallback_destroyForGroupCallback(ClosureForGroups_tempCallbacks[ClosureForGroups_tempCallbacksCount])
endfunction

function pushCallback takes integer c returns nothing
	set ClosureForGroups_tempCallbacks[ClosureForGroups_tempCallbacksCount] = c
	set ClosureForGroups_tempCallbacksCount = ClosureForGroups_tempCallbacksCount + 1
endfunction

function forUnitsInRect takes rect r, integer c returns nothing
	call pushCallback(c)
	call GroupEnumUnitsInRect(TempGroups_ENUM_GROUP, r, ClosureForGroups_filter)
	call popCallback()
endfunction

function init_DamageType takes nothing returns boolean
	local integer clVar
	local rect temp
	set DamageType_useBonusCalculator = false
	set DamageType_ATTACK_TYPE_UNIVERSAL = ConvertAttackType(7)
	set DamageType_DAMAGE_TYPE_CHECK_ID = 560231466
	set DamageType_lastDamageType = 0
	call onEnter(ref_function_DamageType_closure_impl)
	set temp = bj_mapInitialPlayableArea
	set clVar = alloc_Closure()
	call forUnitsInRect(temp, clVar)
	call addOnDamageFunc(Condition(ref_function_handler))
	set temp = null
	return true
endfunction

function Damager_initD takes nothing returns nothing
	call Rect(0., 0., 0., 0.)
	call Condition(ref_function_damageAOE_Enum)
	call Condition(ref_function_damageAOE_DestructablesEnum)
	call CreateGroup()
endfunction

function init_Damager takes nothing returns boolean
	set Damager_FACTOR_TEST_DAMAGE = 0.01
	set Damager_MAX_DAMAGE_FACTOR = 3.00
	set Damager_EPSILON = 0.000000001
	set Damager_dmger = CreateUnit(Player(15), Basics_DUMMY_UNIT_ID, 0., 0., 0.)
	call UnitAddAbility(Damager_dmger, 1097625443)
	call Damager_initD()
	return true
endfunction

function init_DelayedDestroy takes nothing returns boolean
	call CreateTimer()
	return true
endfunction

function init_DmgMod takes nothing returns boolean
	call CreateTimer()
	return true
endfunction

function init_DummyCaster takes nothing returns boolean
	set DummyCaster_FORCE_INVISIBLE_CAST = false
	set DummyCaster_AUTO_RESET_MANA_COOLDOWN = true
	set DummyCaster_delayTable = new_Table()
	call Condition(ref_function_DummyCaster_filterAOE)
	return true
endfunction

function alloc_ArrayQueue takes nothing returns integer
	local integer this
	if ArrayQueue_firstFree == 0 then
		if ArrayQueue_maxIndex < 32768 then
			set ArrayQueue_maxIndex = ArrayQueue_maxIndex + 1
			set this = ArrayQueue_maxIndex
			set ArrayQueue_typeId[this] = 633
		else
			call error("Out of memory: Could not create ArrayQueue.")
			set this = 0
		endif
	else
		set ArrayQueue_firstFree = ArrayQueue_firstFree - 1
		set this = ArrayQueue_nextFree[ArrayQueue_firstFree]
		set ArrayQueue_typeId[this] = 633
	endif
	return this
endfunction

function construct_ArrayQueue takes integer this returns nothing
	set ArrayQueue_fp[this] = 0
	set ArrayQueue_rp[this] = 0
	set ArrayQueue_size[this] = 0
endfunction

function new_ArrayQueue takes nothing returns integer
	local integer this = alloc_ArrayQueue()
	call construct_ArrayQueue(this)
	return this
endfunction

function init_DummyRecycler takes nothing returns boolean
	local integer i
	local integer temp
	local integer j
	local integer temp_2
	set DummyRecycler_DIFFERENT_ANGLES = 8
	set DummyRecycler_ANGLE_DEGREE = 360 * 1. / DummyRecycler_DIFFERENT_ANGLES
	set DummyRecycler_SAVED_UNITS_PER_ANGLE = 6
	set DelayNode_t = CreateTimer()
	set DelayNode_first = 0
	set DelayNode_last = 0
	set i = 0
	set temp = DummyRecycler_DIFFERENT_ANGLES - 1
	loop
		exitwhen i > temp
		set DummyRecycler_angleQueues[i] = new_ArrayQueue()
		set j = 0
		set temp_2 = DummyRecycler_SAVED_UNITS_PER_ANGLE - 1
		loop
			exitwhen j > temp_2
			call dispatch_ArrayQueue_DummyRecycler_ArrayQueue_enqueue(DummyRecycler_angleQueues[i], createDummy(MapBounds_boundMax_x, MapBounds_boundMax_y, Basics_DUMMY_PLAYER, real_asAngleDegrees(i * DummyRecycler_ANGLE_DEGREE)))
			set j = j + 1
		endloop
		set i = i + 1
	endloop
	return true
endfunction

function init_ErrorHandling takes nothing returns boolean
	set ErrorHandling_MUTE_ERROR_DURATION = 60
	set ErrorHandling_PRIMARY_ERROR_KEY = -1
	return true
endfunction

function init_ErrorHandling_config takes nothing returns boolean
	return true
endfunction

function init_EventHandling takes nothing returns boolean
	set EventHandling_count = 0
	set EventHandling_castTrig = CreateTrigger()
	call trigger_addCondition(EventHandling_castTrig, Condition(ref_function_evaluateEvent))
	set EventHandling_evalTrig = CreateTrigger()
	return true
endfunction

function File_doInit takes nothing returns nothing
	call InitHashtable()
endfunction

function init_FileIO takes nothing returns boolean
	call TimerStart(CreateTimer(), 0., false, ref_function_LocalFileTest_onInit)
	set LocalFileTest_FLAG_FOLDER = "Flag"
	set LocalFileTest_FLAG_FILE = "flag"
	set LocalFileTest_success = false
	call File_doInit()
	return true
endfunction

function init_GameTimer takes nothing returns boolean
	set GameTimer_gameTimer = CreateTimer()
	call timer_start(GameTimer_gameTimer, 100000., null)
	call timer_startPeriodic(CreateTimer(), Basics_ANIMATION_PERIOD, ref_function_GameTimer_closure_impl)
	return true
endfunction

function init_HashList takes nothing returns boolean
	call InitHashtable()
	return true
endfunction

function init_HashMap takes nothing returns boolean
	set HashMap_ht = InitHashtable()
	return true
endfunction

function init_InstanceBoard takes nothing returns boolean
	set InstanceBoard_classes = 0
	call InitHashtable()
	set InstanceBoard_mb = null
	call timer_start(getTimer(), 0.0, ref_function_createMultiboard)
	return true
endfunction

function init_InstantDummyCaster takes nothing returns boolean
	set InstantDummyCaster_DUMMY_CASTER_UNIT_ID = 2019778931
	set InstantDummyCaster_caster = createUnit(Basics_DUMMY_PLAYER, InstantDummyCaster_DUMMY_CASTER_UNIT_ID, 0., 0., 0.)
	call unit_setPos(InstantDummyCaster_caster, 32256., 32256.)
	return true
endfunction

function init_Knockback takes nothing returns boolean
	return true
endfunction

function init_Knockback3 takes nothing returns boolean
	set Knockback3_DESTRUCTABLE_ENUM_SIZE = 130.
	call Rect( - (1. * Knockback3_DESTRUCTABLE_ENUM_SIZE),  - (1. * Knockback3_DESTRUCTABLE_ENUM_SIZE), Knockback3_DESTRUCTABLE_ENUM_SIZE, Knockback3_DESTRUCTABLE_ENUM_SIZE)
	call new_HashMap()
	call CreateTimer()
	return true
endfunction

function onLeave takes code c returns nothing
	call trigger_addAction(OnUnitEnterLeave_eventTrigger, c)
endfunction

function registerPlayerUnitEvent takes playerunitevent p, code c returns nothing
	local integer hid = GetHandleId(p)
	local integer k
	if RegisterEvents_t[hid] == null then
		set RegisterEvents_t[hid] = CreateTrigger()
		set k = 15
		loop
			exitwhen k < 0
			call TriggerRegisterPlayerUnitEvent(RegisterEvents_t[hid], Player(k), p, null)
			set k = k - 1
		endloop
	endif
	call TriggerAddCondition(RegisterEvents_t[hid], Filter(c))
endfunction

function init_LastOrder takes nothing returns boolean
	set LastOrder_ORDERS_TO_HOLD = 3
	call registerPlayerUnitEvent(EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER, ref_function_actions)
	call registerPlayerUnitEvent(EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER, ref_function_actions)
	call registerPlayerUnitEvent(EVENT_PLAYER_UNIT_ISSUED_ORDER, ref_function_actions)
	call registerPlayerUnitEvent(EVENT_PLAYER_UNIT_SPELL_EFFECT, ref_function_spellActions)
	call onLeave(ref_function_LastOrder_closure_impl)
	return true
endfunction

function init_LinkedListModule takes nothing returns boolean
	return true
endfunction

function init_MagicFunctions takes nothing returns boolean
	return true
endfunction

function rect_getMaxX takes rect this returns real
	return GetRectMaxX(this)
endfunction

function rect_getMaxY takes rect this returns real
	return GetRectMaxY(this)
endfunction

function rect_getMinX takes rect this returns real
	return GetRectMinX(this)
endfunction

function rect_getMinY takes rect this returns real
	return GetRectMinY(this)
endfunction

function region_addRect takes region this, rect r returns nothing
	call RegionAddRect(this, r)
endfunction

function vec2_op_mult takes real this_x, real this_y, real factor returns real
	set vec2_op_mult_return_x = this_x * factor
	set vec2_op_mult_return_y = this_y * factor
	return vec2_op_mult_return_x
endfunction

function vec2_op_plus takes real this_x, real this_y, real v_x, real v_y returns real
	set vec2_op_plus_return_x = this_x + v_x
	set vec2_op_plus_return_y = this_y + v_y
	return vec2_op_plus_return_x
endfunction

function init_MapBounds takes nothing returns boolean
	local region receiver
	local region receiver_2
	local real temp_MapBounds_playableMin_x
	local real temp_MapBounds_playableMin_y
	local real temp_MapBounds_playableMax_x
	local real temp_MapBounds_playableMax_y
	local real temp_MapBounds_boundMin_x
	local real temp_MapBounds_boundMin_y
	local real temp_MapBounds_boundMax_x
	local real temp_MapBounds_boundMax_y
	set MapBounds_playableMapRect = GetPlayableMapRect()
	set receiver = CreateRegion()
	call region_addRect(receiver, MapBounds_playableMapRect)
	set MapBounds_boundRect = GetWorldBounds()
	set receiver_2 = CreateRegion()
	call region_addRect(receiver_2, MapBounds_boundRect)
	set MapBounds_boundRegion = receiver_2
	set temp_MapBounds_playableMin_x = rect_getMinX(MapBounds_playableMapRect)
	set temp_MapBounds_playableMin_y = rect_getMinY(MapBounds_playableMapRect)
	set MapBounds_playableMin_x = temp_MapBounds_playableMin_x
	set MapBounds_playableMin_y = temp_MapBounds_playableMin_y
	set temp_MapBounds_playableMax_x = rect_getMaxX(MapBounds_playableMapRect)
	set temp_MapBounds_playableMax_y = rect_getMaxY(MapBounds_playableMapRect)
	set MapBounds_playableMax_x = temp_MapBounds_playableMax_x
	set MapBounds_playableMax_y = temp_MapBounds_playableMax_y
	set temp_MapBounds_boundMin_x = rect_getMinX(MapBounds_boundRect)
	set temp_MapBounds_boundMin_y = rect_getMinY(MapBounds_boundRect)
	set MapBounds_boundMin_x = temp_MapBounds_boundMin_x
	set MapBounds_boundMin_y = temp_MapBounds_boundMin_y
	set temp_MapBounds_boundMax_x = rect_getMaxX(MapBounds_boundRect)
	set temp_MapBounds_boundMax_y = rect_getMaxY(MapBounds_boundRect)
	set MapBounds_boundMax_x = temp_MapBounds_boundMax_x
	set MapBounds_boundMax_y = temp_MapBounds_boundMax_y
	call vec2_op_mult(vec2_op_plus(MapBounds_playableMin_x, MapBounds_playableMin_y, MapBounds_playableMax_x, MapBounds_playableMax_y), vec2_op_plus_return_y, .5)
	call vec2_op_mult(vec2_op_plus(MapBounds_boundMin_x, MapBounds_boundMin_y, MapBounds_boundMax_x, MapBounds_boundMax_y), vec2_op_plus_return_y, .5)
	set receiver = null
	set receiver_2 = null
	return true
endfunction

function init_Maths takes nothing returns boolean
	set Maths_PI2 = 6.28318
	set Maths_DEGTORAD = 0.017453293
	set Maths_RADTODEG = 57.295779513
	return true
endfunction

function alloc_IdGenerator takes nothing returns integer
	local integer this
	if IdGenerator_firstFree == 0 then
		if IdGenerator_maxIndex < 32768 then
			set IdGenerator_maxIndex = IdGenerator_maxIndex + 1
			set this = IdGenerator_maxIndex
		else
			call error("Out of memory: Could not create IdGenerator.")
			set this = 0
		endif
	else
		set IdGenerator_firstFree = IdGenerator_firstFree - 1
		set this = IdGenerator_nextFree[IdGenerator_firstFree]
	endif
	return this
endfunction

function construct_IdGenerator takes integer this, integer start returns nothing
endfunction

function new_IdGenerator takes integer start returns integer
	local integer this = alloc_IdGenerator()
	call construct_IdGenerator(this, start)
	return this
endfunction

function init_ObjectIdGenerator takes nothing returns boolean
	call new_IdGenerator(1932537904)
	call new_IdGenerator(1261449264)
	call new_IdGenerator(1098395696)
	call new_IdGenerator(1177563184)
	call new_IdGenerator(1328558128)
	return true
endfunction

function init_ObjectIds takes nothing returns boolean
	set ObjectIds_charMap = ".................................!.#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[.]^_`abcdefghijklmnopqrstuvwxyz{|}~................................................................................................................................."
	return true
endfunction

function alloc_Closure_2 takes nothing returns integer
	local integer this
	if CallbackSingle_firstFree == 0 then
		if CallbackSingle_maxIndex < 32768 then
			set CallbackSingle_maxIndex = CallbackSingle_maxIndex + 1
			set this = CallbackSingle_maxIndex
			set CallbackSingle_typeId[this] = 642
		else
			call error("Out of memory: Could not create Closure.")
			set this = 0
		endif
	else
		set CallbackSingle_firstFree = CallbackSingle_firstFree - 1
		set this = CallbackSingle_nextFree[CallbackSingle_firstFree]
		set CallbackSingle_typeId[this] = 642
	endif
	return this
endfunction

function construct_CallbackSingle takes integer this returns nothing
endfunction

function CallbackSingle_start takes integer this, real time returns nothing
	local timer receiver = getTimer()
	local timer receiver_2
	call timer_setData(receiver, this)
	set receiver_2 = receiver
	call timer_start(receiver_2, time, ref_function_CallbackSingle_staticCallback)
	set receiver = null
	set receiver_2 = null
endfunction

function dispatch_CallbackSingle_ClosureTimers_CallbackSingle_start takes integer this, real time returns nothing
	if CallbackSingle_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling CallbackSingle.start")
		else
			call error("Called CallbackSingle.start on invalid object.")
		endif
	endif
	call CallbackSingle_start(this, time)
endfunction

function doAfter takes real timeToWait, integer cb returns nothing
	call dispatch_CallbackSingle_ClosureTimers_CallbackSingle_start(cb, timeToWait)
endfunction

function nullTimer takes integer cb returns nothing
	call doAfter(0., cb)
endfunction

function player_setAbilityAvailable takes player this, integer abilityId, boolean avail returns nothing
	call SetPlayerAbilityAvailable(this, abilityId, avail)
endfunction

function trigger_registerEnterRegion takes trigger this, region whichRegion, boolexpr filter_3 returns nothing
	call TriggerRegisterEnterRegion(this, whichRegion, filter_3)
endfunction

function init_OnUnitEnterLeave takes nothing returns boolean
	local trigger receiver
	local integer i
	local integer temp
	local group g_2
	local integer clVar
	set OnUnitEnterLeave_eventTrigger = CreateTrigger()
	set OnUnitEnterLeave_tempUnit = null
	set receiver = CreateTrigger()
	call trigger_registerEnterRegion(receiver, MapBounds_boundRegion, Filter(ref_function_OnUnitEnterLeave_closure_impl))
	call registerPlayerUnitEvent(EVENT_PLAYER_UNIT_ISSUED_ORDER, ref_function_OnUnitEnterLeave_closure_impl_2)
	set OnUnitEnterLeave_ABILITY_ID = 560283684
	set i = 0
	set temp = bj_MAX_PLAYER_SLOTS - 1
	loop
		exitwhen i > temp
		call player_setAbilityAvailable(Player_players[i], OnUnitEnterLeave_ABILITY_ID, false)
		set i = i + 1
	endloop
	set g_2 = CreateGroup()
	call GroupEnumUnitsInRect(g_2, MapBounds_boundRect, null)
	set clVar = alloc_Closure_2()
	call construct_CallbackSingle(clVar)
	set g[clVar] = g_2
	call nullTimer(clVar)
	set OnUnitEnterLeave_ABILITY_ID = 560283684
	set receiver = null
	set g_2 = null
	return true
endfunction

function init_Player takes nothing returns boolean
	local integer i = 0
	local integer temp = bj_MAX_PLAYER_SLOTS - 1
	loop
		exitwhen i > temp
		set Player_players[i] = Player(i)
		set i = i + 1
	endloop
	return true
endfunction

function idInteger2IdString takes integer value returns string
	local string result = ""
	local integer remainingValue = value
	local integer byteno = 0
	local integer charValue
	loop
		exitwhen byteno > 3
		set charValue = ModuloInteger(remainingValue, 256)
		set remainingValue = remainingValue / 256
		set result = SubString(ObjectIds_charMap, charValue, charValue + 1) + result
		set byteno = byteno + 1
	endloop
	return result
endfunction

function init_PreloadHandler takes nothing returns boolean
	set PreloadHandler_autoFinish = false
	set PreloadHandler_dum = CreateUnit(Player(15), Basics_DUMMY_UNIT_ID, 0., 0., 0.)
	if PreloadHandler_dum == null then
		call error("PreloadHandler : DUMMY_UNITID (" + idInteger2IdString(Basics_DUMMY_UNIT_ID) + ") not added correctly to the map.")
	endif
	if PreloadHandler_autoFinish then
		call TimerStart(CreateTimer(), 0.0, false, ref_function_finishPreload)
	endif
	return true
endfunction

function trigger_registerPlayerChatEvent takes trigger this, player whichPlayer, string chatMessageToDetect, boolean exactMatchOnly returns nothing
	call TriggerRegisterPlayerChatEvent(this, whichPlayer, chatMessageToDetect, exactMatchOnly)
endfunction

function init_PrintingHelper takes nothing returns boolean
	local trigger t
	local integer i
	set PrintingHelper_DEBUG_LEVEL = 0
	set PrintingHelper_DEBUG_MSG_DURATION = 45.
	set t = CreateTrigger()
	call trigger_addAction(t, ref_function_switchDebug)
	set i = 0
	loop
		exitwhen i > 11
		set PrintingHelper_wantDebug[i] = false
		call trigger_registerPlayerChatEvent(t, Player(i), "-d", true)
		set i = i + 1
	endloop
	set t = null
	return true
endfunction

function init_Rect takes nothing returns boolean
	call new_Table()
	return true
endfunction

function init_Region takes nothing returns boolean
	call new_Table()
	return true
endfunction

function init_RegisterEvents takes nothing returns boolean
	set RegisterEvents_onCastMap = new_HashMap()
	call registerPlayerUnitEvent(EVENT_PLAYER_UNIT_SPELL_EFFECT, ref_function_RegisterEvents_closure_impl)
	return true
endfunction

function init_Simulate3dSound takes nothing returns boolean
	set Simulate3dSound_PERIOD = 0.2
	return true
endfunction

function init_SoundHelper takes nothing returns boolean
	set SoundHelper_DEFAULT_SOUND_VOLUME = 127
	set SoundHelper_DEFAULT_SOUND_PITCH = 1.
	set SoundHelper_SOUND_CHANNEL = 5
	set SoundHelper_SOUND_MIN_DIST = 600.
	set SoundHelper_SOUND_MAX_DIST = 8000.
	set SoundHelper_SOUND_DIST_CUT = 1500.
	set DynamicSound_TimedLoop_instanceCount = 0
	set DynamicSound_TimedLoop_triggerCond = null
	call Condition(ref_function_DynamicSound_TimedLoop_onExpire)
	return true
endfunction

function init_SoundQueue takes nothing returns boolean
	set SoundQueue_c = ref_function_SoundQueue_nextSound
	return true
endfunction

function init_SpellDesignConfig takes nothing returns boolean
	return true
endfunction

function init_StandardTextTags takes nothing returns boolean
	return true
endfunction

function string_length takes string this returns integer
	return StringLength(this)
endfunction

function init_String takes nothing returns boolean
	set String_charset = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
	set String_numberset = "0123456789"
	call string_length(String_numberset)
	call string_length(String_charset)
	return true
endfunction

function init_Sync takes nothing returns boolean
	call timer_start(CreateTimer(), .1, ref_function_initGamecache)
	return true
endfunction

function init_Table takes nothing returns boolean
	set Table_ht = InitHashtable()
	return true
endfunction

function init_TempGroups takes nothing returns boolean
	set TempGroups_ENUM_GROUP = CreateGroup()
	return true
endfunction

function init_Terrain takes nothing returns boolean
	local real temp_Terrain_tempPos_x
	local real temp_Terrain_tempPos_y
	set Terrain_DUMMY_ITEM_ID = 2003790951
	call Location(0., 0.)
	set Terrain_dItem = null
	set Terrain_hidMax = 0
	set temp_Terrain_tempPos_x = 0.
	set temp_Terrain_tempPos_y = 0.
	call Rect(0., 0., 128., 128.)
	set Terrain_dItem = CreateItem(Terrain_DUMMY_ITEM_ID, 0., 0.)
	call SetItemVisible(Terrain_dItem, false)
	return true
endfunction

function Thread_doInit takes nothing returns nothing
	local integer i
	set Thread_syncThreadTrigger = CreateTrigger()
	call TriggerAddCondition(Thread_syncThreadTrigger, Condition(ref_function_Thread_syncThread))
	set i = 11
	loop
		exitwhen i < 0
		if GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING and GetPlayerController(Player(i)) == MAP_CONTROL_USER then
			call TriggerRegisterPlayerUnitEvent(Thread_syncThreadTrigger, Player(i), EVENT_PLAYER_UNIT_SELECTED, null)
		endif
		set i = i - 1
	endloop
endfunction

function init_Thread takes nothing returns boolean
	call Thread_doInit()
	return true
endfunction

function init_TimedLoop takes nothing returns boolean
	call CreateTimer()
	set TimedLoop_timedLoopTrig = CreateTrigger()
	set TimedLoop_conditionCount = 0
	return true
endfunction

function init_TimerUtils takes nothing returns boolean
	set TimerUtils_freeTimersCount = 0
	set TimerUtils_timerData = new_Table()
	set TimerUtils_HELD = 679645218
	return true
endfunction

function init_Trackable takes nothing returns boolean
	local trigger receiver
	local trigger receiver_2
	set TrackableEx_doubleClickSpeed = 0.5
	set TrackableEx_trackableOwner = new_HashMap()
	set TrackableEx_trackableObjects = new_HashMap()
	set receiver = CreateTrigger()
	call trigger_addAction(receiver, ref_function_TrackableEx_closure_impl)
	set receiver_2 = CreateTrigger()
	call trigger_addAction(receiver_2, ref_function_TrackableEx_closure_impl_2)
	set receiver = null
	set receiver_2 = null
	return true
endfunction

function init_Trigger takes nothing returns boolean
	call new_Table()
	return true
endfunction

function init_TypeCasting takes nothing returns boolean
	set TypeCasting_typecastdata = new_Table()
	return true
endfunction

function init_UnitIndexer takes nothing returns boolean
	call onEnter(ref_function_UnitIndexer_closure_impl)
	call onLeave(ref_function_UnitIndexer_closure_impl_2)
	return true
endfunction

function init_Vectors takes nothing returns boolean
	return true
endfunction

function spellActions takes nothing returns nothing
	local integer index = unit_getUserData(GetTriggerUnit())
	if LastOrder_orderQueues[index] != 0 then
	endif
endfunction

function trigger_disable takes trigger this returns nothing
	call DisableTrigger(this)
endfunction

function swap takes nothing returns nothing
	local boolean b = IsTriggerEnabled(DamageDetection_current)
	local integer i
	local integer temp
	call trigger_disable(DamageDetection_current)
	if DamageDetection_toDestroy != null then
		call DestroyTrigger(DamageDetection_toDestroy)
	endif
	set DamageDetection_toDestroy = DamageDetection_current
	set DamageDetection_current = CreateTrigger()
	if  not b then
		call DisableTrigger(DamageDetection_current)
	endif
	call GroupEnumUnitsInRect(TempGroups_ENUM_GROUP, MapBounds_boundRect, Filter(ref_function_DamageDetection_closure_impl_3))
	set i = 0
	set temp = DamageDetection_funcNext - 1
	loop
		exitwhen i > temp
		call trigger_addCondition(DamageDetection_current, DamageDetection_func[i])
		set i = i + 1
	endloop
endfunction

function switchDebug takes nothing returns nothing
	local player p = GetTriggerPlayer()
	local integer id = player_getId(p)
	if PrintingHelper_wantDebug[id] then
		set PrintingHelper_wantDebug[id] = false
		call DisplayTimedTextToPlayer(p, 0., 0., 20., "|cff9C9C9CDEBUG-View|r |cffB55208deactivated")
	else
		set PrintingHelper_wantDebug[id] = true
		call DisplayTimedTextToPlayer(p, 0., 0., 20., "|cff9C9C9CDEBUG-View|r |cff3AAD42activated")
	endif
	set p = null
endfunction

function initGlobals takes nothing returns nothing
	set FreeNode_firstFree = 0
	set FreeNode_maxIndex = 0
	set ForGroupCallback_firstFree = 0
	set ForGroupCallback_maxIndex = 0
	set CallbackSingle_firstFree = 0
	set CallbackSingle_maxIndex = 0
	set Collider_firstFree = 0
	set DelayDat_firstFree = 0
	set DelayDat_maxIndex = 0
	set DummyCaster_firstFree = 0
	set ArrayQueue_firstFree = 0
	set ArrayQueue_maxIndex = 0
	set DelayNode_firstFree = 0
	set DelayNode_maxIndex = 0
	set Fx_firstFree = 0
	set HashMap_firstFree = 0
	set HashMap_maxIndex = 0
	set Order_firstFree = 0
	set Order_maxIndex = 0
	set OrderQueue_firstFree = 0
	set OrderQueue_maxIndex = 0
	set LLEntry_firstFree = 0
	set LinkedList_firstFree = 0
	set IdGenerator_firstFree = 0
	set IdGenerator_maxIndex = 0
	set OrderStringFactory_firstFree = 0
	set OrderStringFactory_maxIndex = 0
	set Sim3DSound_firstFree = 0
	set Sim3DSound_maxIndex = 0
	set DynamicSound_firstFree = 0
	set SData_firstFree = 0
	set SData_maxIndex = 0
	set SoundQueue_firstFree = 0
	set SEntry_firstFree = 0
	set SEntry_maxIndex = 0
	set Table_firstFree = 0
	set Table_maxIndex = 0
	set UnitIndex_firstFree = 0
	set UnitIndex_maxIndex = 0
	set ref_function_init_String = function init_String
	set ref_function_init_Table = function init_Table
	set ref_function_init_Trigger = function init_Trigger
	set ref_function_init_Player = function init_Player
	set ref_function_init_PrintingHelper = function init_PrintingHelper
	set ref_function_init_MagicFunctions = function init_MagicFunctions
	set ref_function_init_Basics = function init_Basics
	set ref_function_init_GameTimer = function init_GameTimer
	set ref_function_init_ErrorHandling_config = function init_ErrorHandling_config
	set ref_function_init_ErrorHandling = function init_ErrorHandling
	set ref_function_init_TimerUtils = function init_TimerUtils
	set ref_function_init_Maths = function init_Maths
	set ref_function_init_Vectors = function init_Vectors
	set ref_function_init_TempGroups = function init_TempGroups
	set ref_function_init_Colors = function init_Colors
	set ref_function_init_Rect = function init_Rect
	set ref_function_init_Terrain = function init_Terrain
	set ref_function_init_TypeCasting = function init_TypeCasting
	set ref_function_init_ObjectIds = function init_ObjectIds
	set ref_function_init_ObjectIdGenerator = function init_ObjectIdGenerator
	set ref_function_init_ChannelAbilityPreset = function init_ChannelAbilityPreset
	set ref_function_init_AbilityTooltipGenerator_config = function init_AbilityTooltipGenerator_config
	set ref_function_init_AbilityTooltipGenerator = function init_AbilityTooltipGenerator
	set ref_function_init_ArrayList = function init_ArrayList
	set ref_function_init_Assets = function init_Assets
	set ref_function_init_BigNum = function init_BigNum
	set ref_function_init_Char = function init_Char
	set ref_function_init_HashMap = function init_HashMap
	set ref_function_init_DelayedDestroy = function init_DelayedDestroy
	set ref_function_init_ClosureEvents = function init_ClosureEvents
	set ref_function_init_ClosureForGroups = function init_ClosureForGroups
	set ref_function_init_Region = function init_Region
	set ref_function_init_MapBounds = function init_MapBounds
	set ref_function_init_DummyRecycler = function init_DummyRecycler
	set ref_function_init_TimedLoop = function init_TimedLoop
	set ref_function_init_Collider = function init_Collider
	set ref_function_init_CustomBar = function init_CustomBar
	set ref_function_init_CustomExp = function init_CustomExp
	set ref_function_init_RegisterEvents = function init_RegisterEvents
	set ref_function_init_OnUnitEnterLeave = function init_OnUnitEnterLeave
	set ref_function_init_DamageDetection = function init_DamageDetection
	set ref_function_init_DamageType = function init_DamageType
	set ref_function_init_Damager = function init_Damager
	set ref_function_init_LinkedListModule = function init_LinkedListModule
	set ref_function_init_DmgMod = function init_DmgMod
	set ref_function_init_DummyCaster = function init_DummyCaster
	set ref_function_init_EventHandling = function init_EventHandling
	set ref_function_init_FileIO = function init_FileIO
	set ref_function_init_HashList = function init_HashList
	set ref_function_init_InstanceBoard = function init_InstanceBoard
	set ref_function_init_InstantDummyCaster = function init_InstantDummyCaster
	set ref_function_init_Knockback = function init_Knockback
	set ref_function_init_Knockback3 = function init_Knockback3
	set ref_function_init_LastOrder = function init_LastOrder
	set ref_function_init_PreloadHandler = function init_PreloadHandler
	set ref_function_init_Simulate3dSound = function init_Simulate3dSound
	set ref_function_init_SoundHelper = function init_SoundHelper
	set ref_function_init_SoundQueue = function init_SoundQueue
	set ref_function_init_SpellDesignConfig = function init_SpellDesignConfig
	set ref_function_init_StandardTextTags = function init_StandardTextTags
	set ref_function_init_Thread = function init_Thread
	set ref_function_init_Sync = function init_Sync
	set ref_function_init_Trackable = function init_Trackable
	set ref_function_init_UnitIndexer = function init_UnitIndexer
	set ref_function_handleCasts = function handleCasts
	set ref_function_filter = function filter
	set ref_function_CallbackSingle_staticCallback = function CallbackSingle_staticCallback
	set ref_function_Collider_TimedLoop_onExpire = function Collider_TimedLoop_onExpire
	set ref_function_giveXP = function giveXP
	set ref_function_disableXpGain = function disableXpGain
	set ref_function_filter_2 = function filter_2
	set ref_function_DamageDetection_closure_impl = function DamageDetection_closure_impl
	set ref_function_DamageDetection_closure_impl_2 = function DamageDetection_closure_impl_2
	set ref_function_swap = function swap
	set ref_function_DamageDetection_closure_impl_3 = function DamageDetection_closure_impl_3
	set ref_function_DamageType_closure_impl = function DamageType_closure_impl
	set ref_function_handler = function handler
	set ref_function_after = function after
	set ref_function_damageAOE_Enum = function damageAOE_Enum
	set ref_function_damageAOE_DestructablesEnum = function damageAOE_DestructablesEnum
	set ref_function_DummyCaster_filterAOE = function DummyCaster_filterAOE
	set ref_function_DummyCaster_closure_impl = function DummyCaster_closure_impl
	set ref_function_DelayNode_recycle = function DelayNode_recycle
	set ref_function_evaluateEvent = function evaluateEvent
	set ref_function_LocalFileTest_onInit = function LocalFileTest_onInit
	set ref_function_GameTimer_closure_impl = function GameTimer_closure_impl
	set ref_function_createMultiboard = function createMultiboard
	set ref_function_actions = function actions
	set ref_function_spellActions = function spellActions
	set ref_function_LastOrder_closure_impl = function LastOrder_closure_impl
	set ref_function_OnUnitEnterLeave_closure_impl = function OnUnitEnterLeave_closure_impl_3
	set ref_function_OnUnitEnterLeave_closure_impl_2 = function OnUnitEnterLeave_closure_impl_2
	set ref_function_finishPreload = function finishPreload
	set ref_function_switchDebug = function switchDebug
	set ref_function_RegisterEvents_closure_impl = function RegisterEvents_closure_impl
	set ref_function_Sim3DSound_expire = function Sim3DSound_expire
	set ref_function_DynamicSound_TimedLoop_onExpire = function DynamicSound_TimedLoop_onExpire
	set ref_function_Sound_playSound = function Sound_playSound
	set ref_function_Sound_recycle = function Sound_recycle
	set ref_function_SoundQueue_nextSound = function SoundQueue_nextSound
	set ref_function_initGamecache = function initGamecache
	set ref_function_Thread_syncThread = function Thread_syncThread
	set ref_function_TrackableEx_closure_impl = function TrackableEx_closure_impl
	set ref_function_TrackableEx_closure_impl_2 = function TrackableEx_closure_impl_2
	set ref_function_TrackableEx_closure_impl_3 = function TrackableEx_closure_impl_3
	set ref_function_UnitIndexer_closure_impl = function UnitIndexer_closure_impl_2
	set ref_function_UnitIndexer_closure_impl_2 = function UnitIndexer_closure_impl
endfunction

function main takes nothing returns nothing
	local trigger initTrig
	call initGlobals()
	set initTrig = CreateTrigger()
	call TriggerAddCondition(initTrig, Condition(ref_function_init_String))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package String.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_Table))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package Table.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_Trigger))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package Trigger.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_Player))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package Player.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_PrintingHelper))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package PrintingHelper.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_MagicFunctions))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package MagicFunctions.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_Basics))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package Basics.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_GameTimer))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package GameTimer.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_ErrorHandling_config))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package ErrorHandling_config.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_ErrorHandling))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package ErrorHandling.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_TimerUtils))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package TimerUtils.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_Maths))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package Maths.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_Vectors))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package Vectors.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_TempGroups))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package TempGroups.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_Colors))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package Colors.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_Rect))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package Rect.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_Terrain))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package Terrain.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_TypeCasting))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package TypeCasting.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_ObjectIds))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package ObjectIds.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_ObjectIdGenerator))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package ObjectIdGenerator.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_ChannelAbilityPreset))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package ChannelAbilityPreset.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_AbilityTooltipGenerator_config))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package AbilityTooltipGenerator_config.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_AbilityTooltipGenerator))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package AbilityTooltipGenerator.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_ArrayList))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package ArrayList.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_Assets))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package Assets.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_BigNum))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package BigNum.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_Char))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package Char.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_HashMap))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package HashMap.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_DelayedDestroy))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package DelayedDestroy.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_ClosureEvents))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package ClosureEvents.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_ClosureForGroups))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package ClosureForGroups.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_Region))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package Region.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_MapBounds))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package MapBounds.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_DummyRecycler))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package DummyRecycler.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_TimedLoop))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package TimedLoop.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_Collider))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package Collider.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_CustomBar))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package CustomBar.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_CustomExp))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package CustomExp.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_RegisterEvents))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package RegisterEvents.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_OnUnitEnterLeave))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package OnUnitEnterLeave.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_DamageDetection))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package DamageDetection.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_DamageType))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package DamageType.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_Damager))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package Damager.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_LinkedListModule))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package LinkedListModule.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_DmgMod))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package DmgMod.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_DummyCaster))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package DummyCaster.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_EventHandling))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package EventHandling.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_FileIO))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package FileIO.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_HashList))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package HashList.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_InstanceBoard))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package InstanceBoard.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_InstantDummyCaster))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package InstantDummyCaster.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_Knockback))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package Knockback.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_Knockback3))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package Knockback3.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_LastOrder))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package LastOrder.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_PreloadHandler))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package PreloadHandler.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_Simulate3dSound))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package Simulate3dSound.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_SoundHelper))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package SoundHelper.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_SoundQueue))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package SoundQueue.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_SpellDesignConfig))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package SpellDesignConfig.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_StandardTextTags))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package StandardTextTags.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_Thread))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package Thread.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_Sync))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package Sync.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_Trackable))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package Trackable.")
	endif
	call TriggerClearConditions(initTrig)
	call TriggerAddCondition(initTrig, Condition(ref_function_init_UnitIndexer))
	if  not TriggerEvaluate(initTrig) then
		call DisplayTimedTextToPlayer(GetLocalPlayer(), 0., 0., 45., "Could not initialize package UnitIndexer.")
	endif
	call TriggerClearConditions(initTrig)
	call DestroyTrigger(initTrig)
	set initTrig = null
endfunction

function config takes nothing returns nothing
endfunction