;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[@Castle_Manager]
{
#IF
IsCastleGuild [Sabuk]
IsGuildMaster
#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_0
#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_1

[@@DrawTax]
#ACT
mov D1 %SABUKGOLD
mov D2 %INPUTNUM
goto @DrawTax

[@DrawTax]
#IF
large D2 %D1
or small d2 1

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_2
#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_3

#ELSEACT
mov P9 1
makelog 62 9999 %D2 %NPCNAME
GetBackCastleGold [SABUK] %d2

[@Propse_CastleWar]
#IF
IsOnCastleWar [SaBuk]
#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_4
#ACT
break

#IF
!IsGuildMaster
#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_5
#ACT
break

#IF
IsCastleGuild [Sabuk]
#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_6
#ACT
break

#IF
IsCastleGuild [TAOSUNG]
#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_7
#ACT
break

#IF
!checkitem ZumaRelic 1
#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_8
#ACT
break

#IF
CanProposeCastleWar [Sabuk]
#ACT
ProposeCastleWar [Sabuk]
take ZumaRelic 1
#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_9
#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_10

[@requestcastlewar]
#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_11

[@view_warschedule]
#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_12

[@DoorState1]
#IF
#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_13
#IF
CheckCastleDoor [SABUK] 1
#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_14
#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_15
#ELSEACT
break

#IF
CheckCastleDoorOpen [SABUK] 1
#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_16
#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_17

[@DoorState2]
#IF
#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_18

#IF
CheckCastleDoor [SABUK] 3
#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_19
#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_20
#ELSEACT
break

#IF
CheckCastleDoorOpen [SABUK] 3
#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_21
#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_22

[@DoorState3]
#IF
#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_23

#IF
CheckCastleDoor [SABUK] 4
#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_24
#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_25
#ELSEACT
break

#IF
CheckCastleDoorOpen [SABUK] 4
#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_26
#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_27

[@Make_door()]
#IF
#ACT
Mov D0 %ARG(1)
Mov A0 %ARG(2)

#IF
!IsOnCastleWar Sabuk
#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_28
#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_29

[@Make_door_comfirm]
#IF
!checkgold 500000
#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_30
#ACT
break

#IF
!CheckCastleDoor [SABUK] %D0
#ACT
take Gold 500000
MakeCastleDoor [SABUK] %D0
#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_31
#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_32

[@Open_door()]
#IF
#ACT
Mov D0 %ARG(1)
Mov A0 %ARG(2)
#IF
Equal D0 1
#ACT
mov D1 234
mov D2 151

#IF
Equal D0 3
#ACT
mov D1 169
mov D2 151

#IF
Equal D0 4
#ACT
mov D1 233
mov D2 87

#IF
CheckCastleDoor [SABUK] %D0
!CheckCastleDoorOpen [SABUK] %D0
#ACT
Formatstr "CastleGate%s" %D0
mov A8 %A9
Formatstr "3,%s,%s,50" %D1 %D2
SENDCMD %A9 %A8 OPEN

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_33


#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_34

[@Close_door()]
#IF
#ACT
Mov D0 %ARG(1)
Mov A0 %ARG(2)

#IF
Equal D0 1
#ACT
mov D1 234
mov D2 151

#IF
Equal D0 3
#ACT
mov D1 169
mov D2 151

#IF
Equal D0 4
#ACT
mov D1 233
mov D2 87

#IF
CheckCastleDoor [SABUK] %D0
CheckCastleDoorOpen [SABUK] %D0
#ACT
Formatstr "CastleGate%s" %D0
mov A8 %A9
Formatstr "3,%s,%s,50" %D1 %D2
SENDCMD %A9 %A8 CLOSE

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_35


#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\System\SabukCastle\SabukManager.txt] @Convert_SabukManager_36

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