[jass=]//***************************************************************************
//*
//* Alliance Utility Functions
//*
//***************************************************************************
//===========================================================================
function SetPlayerAllianceBJ takes player sourcePlayer, alliancetype whichAllianceSetting, boolean value, player otherPlayer returns nothing
// Prevent players from attempting to ally with themselves.
if (sourcePlayer == otherPlayer) then
return
endif
call SetPlayerAlliance(sourcePlayer, otherPlayer, whichAllianceSetting, value)
endfunction
//===========================================================================
// Set all flags used by the in-game "Ally" checkbox.
//
function SetPlayerAllianceStateAllyBJ takes player sourcePlayer, player otherPlayer, boolean flag returns nothing
call SetPlayerAlliance(sourcePlayer, otherPlayer, ALLIANCE_PASSIVE, flag)
call SetPlayerAlliance(sourcePlayer, otherPlayer, ALLIANCE_HELP_REQUEST, flag)
call SetPlayerAlliance(sourcePlayer, otherPlayer, ALLIANCE_HELP_RESPONSE, flag)
call SetPlayerAlliance(sourcePlayer, otherPlayer, ALLIANCE_SHARED_XP, flag)
call SetPlayerAlliance(sourcePlayer, otherPlayer, ALLIANCE_SHARED_SPELLS, flag)
endfunction
//===========================================================================
// Set all flags used by the in-game "Shared Vision" checkbox.
//
function SetPlayerAllianceStateVisionBJ takes player sourcePlayer, player otherPlayer, boolean flag returns nothing
call SetPlayerAlliance(sourcePlayer, otherPlayer, ALLIANCE_SHARED_VISION, flag)
endfunction
//===========================================================================
// Set all flags used by the in-game "Shared Units" checkbox.
//
function SetPlayerAllianceStateControlBJ takes player sourcePlayer, player otherPlayer, boolean flag returns nothing
call SetPlayerAlliance(sourcePlayer, otherPlayer, ALLIANCE_SHARED_CONTROL, flag)
endfunction
//===========================================================================
// Set all flags used by the in-game "Shared Units" checkbox with the Full
// Shared Unit Control feature enabled.
//
function SetPlayerAllianceStateFullControlBJ takes player sourcePlayer, player otherPlayer, boolean flag returns nothing
call SetPlayerAlliance(sourcePlayer, otherPlayer, ALLIANCE_SHARED_ADVANCED_CONTROL, flag)
endfunction
//===========================================================================
function SetPlayerAllianceStateBJ takes player sourcePlayer, player otherPlayer, integer allianceState returns nothing
// Prevent players from attempting to ally with themselves.
if (sourcePlayer == otherPlayer) then
return
endif
if allianceState == bj_ALLIANCE_UNALLIED then
call SetPlayerAllianceStateAllyBJ( sourcePlayer, otherPlayer, false )
call SetPlayerAllianceStateVisionBJ( sourcePlayer, otherPlayer, false )
call SetPlayerAllianceStateControlBJ( sourcePlayer, otherPlayer, false )
call SetPlayerAllianceStateFullControlBJ( sourcePlayer, otherPlayer, false )
elseif allianceState == bj_ALLIANCE_UNALLIED_VISION then
call SetPlayerAllianceStateAllyBJ( sourcePlayer, otherPlayer, false )
call SetPlayerAllianceStateVisionBJ( sourcePlayer, otherPlayer, true )
call SetPlayerAllianceStateControlBJ( sourcePlayer, otherPlayer, false )
call SetPlayerAllianceStateFullControlBJ( sourcePlayer, otherPlayer, false )
elseif allianceState == bj_ALLIANCE_ALLIED then
call SetPlayerAllianceStateAllyBJ( sourcePlayer, otherPlayer, true )
call SetPlayerAllianceStateVisionBJ( sourcePlayer, otherPlayer, false )
call SetPlayerAllianceStateControlBJ( sourcePlayer, otherPlayer, false )
call SetPlayerAllianceStateFullControlBJ( sourcePlayer, otherPlayer, false )
elseif allianceState == bj_ALLIANCE_ALLIED_VISION then
call SetPlayerAllianceStateAllyBJ( sourcePlayer, otherPlayer, true )
call SetPlayerAllianceStateVisionBJ( sourcePlayer, otherPlayer, true )
call SetPlayerAllianceStateControlBJ( sourcePlayer, otherPlayer, false )
call SetPlayerAllianceStateFullControlBJ( sourcePlayer, otherPlayer, false )
elseif allianceState == bj_ALLIANCE_ALLIED_UNITS then
call SetPlayerAllianceStateAllyBJ( sourcePlayer, otherPlayer, true )
call SetPlayerAllianceStateVisionBJ( sourcePlayer, otherPlayer, true )
call SetPlayerAllianceStateControlBJ( sourcePlayer, otherPlayer, true )
call SetPlayerAllianceStateFullControlBJ( sourcePlayer, otherPlayer, false )
elseif allianceState == bj_ALLIANCE_ALLIED_ADVUNITS then
call SetPlayerAllianceStateAllyBJ( sourcePlayer, otherPlayer, true )
call SetPlayerAllianceStateVisionBJ( sourcePlayer, otherPlayer, true )
call SetPlayerAllianceStateControlBJ( sourcePlayer, otherPlayer, true )
call SetPlayerAllianceStateFullControlBJ( sourcePlayer, otherPlayer, true )
elseif allianceState == bj_ALLIANCE_NEUTRAL then
call SetPlayerAllianceStateAllyBJ( sourcePlayer, otherPlayer, false )
call SetPlayerAllianceStateVisionBJ( sourcePlayer, otherPlayer, false )
call SetPlayerAllianceStateControlBJ( sourcePlayer, otherPlayer, false )
call SetPlayerAllianceStateFullControlBJ( sourcePlayer, otherPlayer, false )
call SetPlayerAlliance( sourcePlayer, otherPlayer, ALLIANCE_PASSIVE, true )
elseif allianceState == bj_ALLIANCE_NEUTRAL_VISION then
call SetPlayerAllianceStateAllyBJ( sourcePlayer, otherPlayer, false )
call SetPlayerAllianceStateVisionBJ( sourcePlayer, otherPlayer, true )
call SetPlayerAllianceStateControlBJ( sourcePlayer, otherPlayer, false )
call SetPlayerAllianceStateFullControlBJ( sourcePlayer, otherPlayer, false )
call SetPlayerAlliance( sourcePlayer, otherPlayer, ALLIANCE_PASSIVE, true )
else
// Unrecognized alliance state - ignore the request.
endif
endfunction
[/code]