- Joined
- Aug 15, 2007
- Messages
- 37
Here is trigger that was created GUI and just converted to JASS. What all would need to be done to clean all leaks, and what functions should I avoid using entirely?
JASS:
function Trig_ChannelManaBeginCast_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A00D' ) ) then
return false
endif
return true
endfunction
function Trig_ChannelManaBeginCast_Func001C takes nothing returns boolean
if ( not ( GetPlayerState(GetOwningPlayer(GetSpellAbilityUnit()), PLAYER_STATE_RESOURCE_GOLD) > 0 ) ) then
return false
endif
return true
endfunction
function Trig_ChannelManaBeginCast_Actions takes nothing returns nothing
if ( Trig_ChannelManaBeginCast_Func001C() ) then
call LeaderboardSetPlayerItemValueBJ( Player(11), GetLastCreatedLeaderboard(), 0 )
call SetPlayerStateBJ( GetOwningPlayer(GetSpellAbilityUnit()), PLAYER_STATE_RESOURCE_GOLD, ( GetPlayerState(GetOwningPlayer(GetSpellAbilityUnit()), PLAYER_STATE_RESOURCE_GOLD) - 1 ) )
else
call IssueImmediateOrderBJ( GetSpellAbilityUnit(), "stop" )
call LeaderboardSetPlayerItemValueBJ( Player(11), GetLastCreatedLeaderboard(), 1 )
endif
endfunction
//===========================================================================
function InitTrig_ChannelManaBeginCast takes nothing returns nothing
set gg_trg_ChannelManaBeginCast = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_ChannelManaBeginCast, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( gg_trg_ChannelManaBeginCast, Condition( function Trig_ChannelManaBeginCast_Conditions ) )
call TriggerAddAction( gg_trg_ChannelManaBeginCast, function Trig_ChannelManaBeginCast_Actions )
endfunction