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

[@Defence_SubFlag_TAOSUNG]
{

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\TaosungCastle\TaosungMainFlag.txt] @Convert_TaosungMainFlag_0

}


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

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

#IF

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\TaosungCastle\TaosungMainFlag.txt] @Convert_TaosungMainFlag_1

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

#IF
Equal A8 "Ready"
IsOnCastleWar [TAOSUNG]
IsAttackGuild [TAOSUNG]
IsGuildMaster
!IsCastleGuild [TAOSUNG]
!IsCastleGuild [SABUK]
CheckPos 5 248 106 1
#ACT
goto @RecusiveTimeRootin_TAOSUNG
break

#IF
Equal A8 "Ready"
IsOnCastleWar [TAOSUNG]
IsAttackGuild [TAOSUNG]
IsGuildMaster
!IsCastleGuild [TAOSUNG]
!IsCastleGuild [SABUK]
CheckPos 5 248 106 1
#ACT
goto @RecusiveTimeRootin_TAOSUNG
break

#IF
Equal A8 "Ready"
IsOnCastleWar [TAOSUNG]
IsDefenseGuild [TAOSUNG]
IsGuildMaster
!IsCastleGuild [TAOSUNG]
!IsCastleGuild [SABUK]
CheckPos 5 248 106 1
#ACT
goto @RecusiveTimeRootin_TAOSUNG
break

#IF
Equal A8 "Ready"
IsOnCastleWar [TAOSUNG]
IsDefenseGuild [TAOSUNG]
IsGuildMaster
!IsCastleGuild [TAOSUNG]
!IsCastleGuild [SABUK]
CheckPos 5 248 106 1
#ACT
goto @RecusiveTimeRootin_TAOSUNG
break

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

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\TaosungCastle\TaosungMainFlag.txt] @Convert_TaosungMainFlag_2

#ACT
break

#IF

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\TaosungCastle\TaosungMainFlag.txt] @Convert_TaosungMainFlag_3

[@RecusiveTimeRootin_TAOSUNG]
#IF

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\TaosungCastle\TaosungMainFlag.txt] @Convert_TaosungMainFlag_4

#ACT
CAPTURECASTLEFLAG [TAOSUNG]
UpdateValueSql "TBL_CastleFlagDef" "FLD_CASTLENAME='TAOSUNG'" "FLD_FLAGSTATUS='Confuse'"
mov D0 0
SENDCMD "5, 0, 0, 1000" (MudWallFlag) "@_Startup"
LoadValue A7 [Convert_Def\QuestDiary\System\TaosungCastle\TaosungMainFlag.txt] [Convert] [Msg0]
linemsg "5" %A7
LoadValue A7 [Convert_Def\QuestDiary\System\TaosungCastle\TaosungMainFlag.txt] [Convert] [Msg1]
linemsg "5" %A7
ApplyMonEX "5,267,145,5" Numa9 [Humanside]
ApplyMonEX "5,201,159,5" NumaMonk7 [Humanside]
ApplyMonEX "5,211,96,5" NumaCaptain7 [Humanside]
goto @Tosung_Human_BarriCade
goto @RecusiveTimeRootin_next_TAOSUNG

[@RecusiveTimeRootin_next_TAOSUNG]
#IF
IsOnCastleWar [TAOSUNG]
#ACT
LoadValue A7 [Convert_Def\QuestDiary\System\TaosungCastle\TaosungMainFlag.txt] [Convert] [Msg2]
Speak %A7
Delaygoto [Grobal] 18 @RecusiveTimeRootin_next_TAOSUNG1

[@RecusiveTimeRootin_next_TAOSUNG1]
#IF
IsOnCastleWar [TAOSUNG]
#ACT
LoadValue A7 [Convert_Def\QuestDiary\System\TaosungCastle\TaosungMainFlag.txt] [Convert] [Msg3]
Speak %A7
Delaygoto [Grobal] 18 @RecusiveTimeRootin_next_TAOSUNG2

[@RecusiveTimeRootin_next_TAOSUNG2]
#IF
IsOnCastleWar [TAOSUNG]
#ACT
LoadValue A7 [Convert_Def\QuestDiary\System\TaosungCastle\TaosungMainFlag.txt] [Convert] [Msg4]
Speak %A7
Delaygoto [Grobal] 18 @RecusiveTimeRootin_next_TAOSUNG3

[@RecusiveTimeRootin_next_TAOSUNG3]
#IF
IsOnCastleWar [TAOSUNG]
#ACT
LoadValue A7 [Convert_Def\QuestDiary\System\TaosungCastle\TaosungMainFlag.txt] [Convert] [Msg5]
Speak %A7
Delaygoto [Grobal] 18 @RecusiveTimeRootin_next_TAOSUNG4

[@RecusiveTimeRootin_next_TAOSUNG4]
#IF
IsOnCastleWar [TAOSUNG]
#ACT
LoadValue A7 [Convert_Def\QuestDiary\System\TaosungCastle\TaosungMainFlag.txt] [Convert] [Msg6]
Speak %A7
Delaygoto [Grobal] 18 @RecusiveTimeRootin_next_TAOSUNG5

[@RecusiveTimeRootin_next_TAOSUNG5]
#IF
IsOnCastleWar [TAOSUNG]
#ACT
LoadValue A7 [Convert_Def\QuestDiary\System\TaosungCastle\TaosungMainFlag.txt] [Convert] [Msg7]
speak %A7
Delaygoto [Grobal] 18 @RecusiveTimeRootin_next_TAOSUNG6

[@RecusiveTimeRootin_next_TAOSUNG6]
#IF
IsOnCastleWar [TAOSUNG]
#ACT
LoadValue A7 [Convert_Def\QuestDiary\System\TaosungCastle\TaosungMainFlag.txt] [Convert] [Msg8]
Speak %A7
Delaygoto [Grobal] 18 @RecusiveTimeRootin_next_TAOSUNG7

[@RecusiveTimeRootin_next_TAOSUNG7]
#IF
IsOnCastleWar [TAOSUNG]
#ACT
LoadValue A7 [Convert_Def\QuestDiary\System\TaosungCastle\TaosungMainFlag.txt] [Convert] [Msg9]
Speak %A7
Delaygoto [Grobal] 18 @RecusiveTimeRootin_next_TAOSUNG8

[@RecusiveTimeRootin_next_TAOSUNG8]
#IF
IsOnCastleWar [TAOSUNG]
#ACT
LoadValue A7 [Convert_Def\QuestDiary\System\TaosungCastle\TaosungMainFlag.txt] [Convert] [Msg10]
Speak %A7
Delaygoto [Grobal] 18 @RecusiveTimeRootin_next_TAOSUNG9

[@RecusiveTimeRootin_next_TAOSUNG9]
#IF
IsOnCastleWar [TAOSUNG]
#ACT
LoadValue A7 [Convert_Def\QuestDiary\System\TaosungCastle\TaosungMainFlag.txt] [Convert] [Msg11]
Speak %A7
Delaygoto [Grobal] 18 @RecusiveTimeRootin_next_TAOSUNG10

[@RecusiveTimeRootin_next_TAOSUNG10]
#IF
IsOnCastleWar [TAOSUNG]
#ACT
LoadValue A7 [Convert_Def\QuestDiary\System\TaosungCastle\TaosungMainFlag.txt] [Convert] [Msg12]
Speak %A7
UpdateValueSql "TBL_CastleFlagDef" "FLD_CASTLENAME='TAOSUNG'" "FLD_FLAGSTATUS='Ready'"
LoadValue A7 [Convert_Def\QuestDiary\System\TaosungCastle\TaosungMainFlag.txt] [Convert] [Msg13]
LineMsg "5" %A7
break

[@Tosung_Human_BarriCade]
#IF
IsOnCastleWar [TAOSUNG]
#ACT
ReadValueSql "TBL_TaoSungCastleWar" "FLD_TAOSUNG='TAOSUNG'" "FLD_TAOSUNGOWNER,FLD_BarriCade1,FLD_BarriCade2,FLD_BarriCade3,FLD_BarriCade4" [@Tosung_owner_BarriCade_0]

[@Tosung_owner_BarriCade_0()]
#ACT
mov A1 %ARG(1)

#IF
Equal A1 "Numa"
#ACT
MonClear "5" Numa
MonClear "5" NumaMonk
MonClear "5" NumaCaptain
MonClear "5" GreatNumaMonk
MonClear "5" NumaSlinger
MonClear "5" ArmouredNuma
MonClear "5" Numa9
MonClear "5" NumaMonk7
MonClear "5" NumaCaptain7
MonGenP "5,247,105,0" 	 1
MonGenP "5,248,105,0" 	 1
MonGenP "5,249,105,0" 	 1
MonGenP "5,247,106,0" 	 1
MonGenP "5,249,106,0" 	 1
MonGenP "5,247,107,0" 	 1
MonGenP "5,248,107,0" 	 1
MonGenP "5,249,107,0" 	 1
ApplyMonEX "5,248,106,5" Numa7 [Humanside]
ApplyMonEX "5,248,106,5" NumaMonk7 [Humanside]
ApplyMonEX "5,248,106,5" NumaCaptain7 [Humanside]
UpdateValueSql "TBL_TaoSungCastleWar" "FLD_TAOSUNG='TAOSUNG'" "FLD_TAOSUNGOWNER='HUMAN'"
#ELSEACT
break

}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;