;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[@Castle_Manager_TAOSUNG]
{
#IF
IsCastleGuild [TAOSUNG]
IsGuildMaster

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\TaosungCastle\TaosungManager.txt] @Convert_TaosungManager_0


#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\System\TaosungCastle\TaosungManager.txt] @Convert_TaosungManager_1

[@@DrawTax]
#IF
!IsOnCastleWar [TAOSUNG]
#ACT
mov D1 %TAOSUNGGOLD
mov D2 %INPUTNUM
goto @DrawTax
#ELSEACT
break

#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\System\TaosungCastle\TaosungManager.txt] @Convert_TaosungManager_2

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

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\TaosungCastle\TaosungManager.txt] @Convert_TaosungManager_3


#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\System\TaosungCastle\TaosungManager.txt] @Convert_TaosungManager_4

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

[@Propse_CastleWar]
#ACT
ReadValueSql "TBL_TaoSungCastleWar" "FLD_TAOSUNG='TAOSUNG'" "FLD_PAGUNSUNGGUILD" [@Propse_CastleWar_0]

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

#IF
!IsOnCastleWar [TAOSUNG]
IsGuildMaster
!IsCastleGuild [TAOSUNG]
!IsCastleGuild [SABUK]
CanProposeCastleWar [TAOSUNG]
Equal A1 %guildname
#ACT
goto @Propse_CastleWar_Pagunsung
break

#IF
IsOnCastleWar [TAOSUNG]

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\TaosungCastle\TaosungManager.txt] @Convert_TaosungManager_5

#ACT
break

#IF
!IsGuildMaster

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\TaosungCastle\TaosungManager.txt] @Convert_TaosungManager_6

#ACT
break

#IF
IsCastleGuild [TAOSUNG]

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\TaosungCastle\TaosungManager.txt] @Convert_TaosungManager_7

#ACT
break

#IF
IsCastleGuild [SABUK]

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\TaosungCastle\TaosungManager.txt] @Convert_TaosungManager_8

#ACT
break

#IF
!checkitem NumaRelic 1

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\TaosungCastle\TaosungManager.txt] @Convert_TaosungManager_9

#ACT
break

#IF
CanProposeCastleWar [TAOSUNG]
#ACT
ProposeCastleWar [TAOSUNG]
take NumaRelic 1

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\TaosungCastle\TaosungManager.txt] @Convert_TaosungManager_10


#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\System\TaosungCastle\TaosungManager.txt] @Convert_TaosungManager_11

[@Propse_CastleWar_Pagunsung]
#ACT
ProposeCastleWar [TAOSUNG]
UpdateValueSql "TBL_TaoSungCastleWar" "FLD_TAOSUNG='TAOSUNG'" "FLD_PAGUNSUNGGUILD='NULL'"

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\TaosungCastle\TaosungManager.txt] @Convert_TaosungManager_12

[@requestcastlewar]

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\TaosungCastle\TaosungManager.txt] @Convert_TaosungManager_13

[@view_warschedule]

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\TaosungCastle\TaosungManager.txt] @Convert_TaosungManager_14

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