;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

[@Defence_SubFlag]
{

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukMainFlag.txt] @Convert_SabukMainFlag_0

}


[@Defence_MainFlag]
{
#IF
IsOnCastleWar [SABUK]
IsAttackGuild [SABUK]
IsGuildMaster
!IsCastleGuild [SABUK]
!IsCastleGuild [TAOSUNG]
#ACT
ReadValueSql "TBL_CastleFlagDef" "FLD_CASTLENAME='SABUK'" "FLD_FLAGSTATUS" @Defence_MainFlag_Check
break

#IF
IsOnCastleWar [SABUK]
IsDefenseGuild [SABUK]
IsGuildMaster
!IsCastleGuild [SABUK]
!IsCastleGuild [TAOSUNG]
#ACT
ReadValueSql "TBL_CastleFlagDef" "FLD_CASTLENAME='SABUK'" "FLD_FLAGSTATUS" @Defence_MainFlag_Check
break

#IF

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukMainFlag.txt] @Convert_SabukMainFlag_1

[@Defence_MainFlag_Check()]
#IF
#ACT
mov A8 %ARG(1)

#IF
Equal A8 "Ready"
IsOnCastleWar [SABUK]
IsAttackGuild [SABUK]
IsGuildMaster
!IsCastleGuild [SABUK]
!IsCastleGuild [TAOSUNG]
CheckPos 3 205 118 0
#ACT
goto @RecusiveTimeRootin
break

#IF
Equal A8 "Ready"
IsOnCastleWar [SABUK]
IsAttackGuild [SABUK]
IsGuildMaster
!IsCastleGuild [SABUK]
!IsCastleGuild [TAOSUNG]
CheckPos 3 206 118 0
#ACT
goto @RecusiveTimeRootin
break

#IF
Equal A8 "Ready"
IsOnCastleWar [SABUK]
IsDefenseGuild [SABUK]
IsGuildMaster
!IsCastleGuild [SABUK]
!IsCastleGuild [TAOSUNG]
CheckPos 3 205 118 0
#ACT
goto @RecusiveTimeRootin
break

#IF
Equal A8 "Ready"
IsOnCastleWar [SABUK]
IsDefenseGuild [SABUK]
IsGuildMaster
!IsCastleGuild [SABUK]
!IsCastleGuild [TAOSUNG]
CheckPos 3 206 118 0
#ACT
goto @RecusiveTimeRootin
break

#IF
Equal A8 "Confuse"
IsOnCastleWar [SABUK]
IsGuildMaster
!IsCastleGuild [SABUK]

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukMainFlag.txt] @Convert_SabukMainFlag_2

#ACT
break

#IF

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukMainFlag.txt] @Convert_SabukMainFlag_3

[@RecusiveTimeRootin]
#IF

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukMainFlag.txt] @Convert_SabukMainFlag_4

#ACT
CAPTURECASTLEFLAG [SABUK]
UpdateValueSql "TBL_CastleFlagDef" "FLD_CASTLENAME='SABUK'" "FLD_FLAGSTATUS='Confuse'"
mov D0 0
SENDCMD "3, 0, 0, 1000" (SabukWallFlag) "@_Startup"
LoadValue A7 [Convert_Def\QuestDiary\System\SabukCastle\SabukMainFlag.txt] [Convert] [Msg0]
linemsg "3" %A7
LoadValue A7 [Convert_Def\QuestDiary\System\SabukCastle\SabukMainFlag.txt] [Convert] [Msg1]
linemsg "3" %A7
goto @RecusiveTimeRootin_next

[@RecusiveTimeRootin_next]
#IF
IsOnCastleWar [SABUK]
#ACT
LoadValue A7 [Convert_Def\QuestDiary\System\SabukCastle\SabukMainFlag.txt] [Convert] [Msg2]
Speak %A7
Delaygoto [Grobal] 18 @RecusiveTimeRootin_next_1

[@RecusiveTimeRootin_next_1]
#IF
IsOnCastleWar [SABUK]
#ACT
LoadValue A7 [Convert_Def\QuestDiary\System\SabukCastle\SabukMainFlag.txt] [Convert] [Msg3]
Speak %A7
Delaygoto [Grobal] 18 @RecusiveTimeRootin_next_2

[@RecusiveTimeRootin_next_2]
#IF
IsOnCastleWar [SABUK]
#ACT
LoadValue A7 [Convert_Def\QuestDiary\System\SabukCastle\SabukMainFlag.txt] [Convert] [Msg4]
Speak %A7
Delaygoto [Grobal] 18 @RecusiveTimeRootin_next_3

[@RecusiveTimeRootin_next_3]
#IF
IsOnCastleWar [SABUK]
#ACT
LoadValue A7 [Convert_Def\QuestDiary\System\SabukCastle\SabukMainFlag.txt] [Convert] [Msg5]
Speak %A7
Delaygoto [Grobal] 18 @RecusiveTimeRootin_next_4

[@RecusiveTimeRootin_next_4]
#IF
IsOnCastleWar [SABUK]
#ACT
LoadValue A7 [Convert_Def\QuestDiary\System\SabukCastle\SabukMainFlag.txt] [Convert] [Msg6]
Speak %A7
Delaygoto [Grobal] 18 @RecusiveTimeRootin_next_5

[@RecusiveTimeRootin_next_5]
#IF
IsOnCastleWar [SABUK]
#ACT
LoadValue A7 [Convert_Def\QuestDiary\System\SabukCastle\SabukMainFlag.txt] [Convert] [Msg7]
speak %A7
Delaygoto [Grobal] 18 @RecusiveTimeRootin_next_6

[@RecusiveTimeRootin_next_6]
#IF
IsOnCastleWar [SABUK]
#ACT
LoadValue A7 [Convert_Def\QuestDiary\System\SabukCastle\SabukMainFlag.txt] [Convert] [Msg8]
Speak %A7
Delaygoto [Grobal] 18 @RecusiveTimeRootin_next_7

[@RecusiveTimeRootin_next_7]
#IF
IsOnCastleWar [SABUK]
#ACT
LoadValue A7 [Convert_Def\QuestDiary\System\SabukCastle\SabukMainFlag.txt] [Convert] [Msg9]
Speak %A7
Delaygoto [Grobal] 18 @RecusiveTimeRootin_next_8

[@RecusiveTimeRootin_next_8]
#IF
IsOnCastleWar [SABUK]
#ACT
LoadValue A7 [Convert_Def\QuestDiary\System\SabukCastle\SabukMainFlag.txt] [Convert] [Msg10]
Speak %A7
Delaygoto [Grobal] 18 @RecusiveTimeRootin_next_9

[@RecusiveTimeRootin_next_9]
#IF
IsOnCastleWar [SABUK]
#ACT
LoadValue A7 [Convert_Def\QuestDiary\System\SabukCastle\SabukMainFlag.txt] [Convert] [Msg11]
Speak %A7
Delaygoto [Grobal] 18 @RecusiveTimeRootin_next_10

[@RecusiveTimeRootin_next_10]
#IF
IsOnCastleWar [SABUK]
#ACT
LoadValue A7 [Convert_Def\QuestDiary\System\SabukCastle\SabukMainFlag.txt] [Convert] [Msg12]
Speak %A7
UpdateValueSql "TBL_CastleFlagDef" "FLD_CASTLENAME='SABUK'" "FLD_FLAGSTATUS='Ready'"
LoadValue A7 [Convert_Def\QuestDiary\System\SabukCastle\SabukMainFlag.txt] [Convert] [Msg13]
LineMsg "3" %A7
break
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;