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

[@IslandMainMenu]
{
#IF
IsAdmin

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\EventSystem\IslandGame\IslandGame.txt] @Convert_IslandGame_0

#IF

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\EventSystem\IslandGame\IslandGame.txt] @Convert_IslandGame_1

[@InitalIslandEvent]
#CALL [EventSystem\IslandGame\IslandGame.txt] @FinishIsland

[@BeginIslandEvent]
#CALL [EventSystem\IslandGame\IslandGame.txt] @StartIsland

[@JoinIslandEvent]
#CALL [EventSystem\IslandGame\IslandGame.txt] @JoinIsland
}




[@StartIsland]
{
#ACT
ReadValueSql "TBL_EventSystemTotal" "FLD_NAME='TotalControl'" "FLD_STEP" @PreSettingIslandGame

[@PreSettingIslandGame()]
#ACT
mov A9 %ARG(1)

#IF
Equal A9 "Ready"
#ACT
ReadValueSql "TBL_EventSystemTotal" "FLD_NAME='GoldIsland'" "FLD_STEP" @StartIslandGame

#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\EventSystem\IslandGame\IslandGame.txt] @Convert_IslandGame_2

[@StartIslandGame()]
#ACT
mov A9 %ARG(1)

#IF
!Checkitem 通用卷 1

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\EventSystem\IslandGame\IslandGame.txt] @Convert_IslandGame_3

#ACT
break

#IF
Equal A9 "Ready"
Checkitem 通用卷 1

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\EventSystem\IslandGame\IslandGame.txt] @Convert_IslandGame_4

#ACT
Take 通用卷 1
FormatStr "FLD_USER='%s',FLD_STEP='StartClose'" %USERNAME
UpdateValueSql "TBL_EventSystemTotal" "FLD_NAME='GoldIsland'" %A9
UpdateValueSql "TBL_EventSystemTotal" "FLD_NAME='TotalControl'" "FLD_STEP='Act'"
LoadValue A7 [Convert_Def\QuestDiary\EventSystem\IslandGame\IslandGame.txt] [Convert] [Msg0]
LineMsg [Grobal] %A7
Delaygoto [Grobal] 300 @OpenGateGoldenIsland 10010
break

#IF

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\EventSystem\IslandGame\IslandGame.txt] @Convert_IslandGame_5

#ACT
break

[@OpenGateGoldenIsland]
#ACT
LoadValue A7 [Convert_Def\QuestDiary\EventSystem\IslandGame\IslandGame.txt] [Convert] [Msg1]
LineMsg [Grobal] %A7
UpdateValueSql "TBL_EventSystemTotal" "FLD_NAME='GoldIsland'" "FLD_STEP='StartOpen'"
ResetMapAttr "E003"
SetEventDamage E003 4
SetEventMap "E003"
ChangeMapAttr "E003" "NOCHAT"
mov N1 0
mov N2 0
goto @GenMonkeys
goto @CheckFinishCondition




[@GenMonkeys]
#ACT
ReadValueSql "TBL_EventSystemTotal" "FLD_NAME='GoldIsland'" "FLD_STEP" @GenMonkeys_Next

[@GenMonkeys_Next()]
#IF
#ACT
mov A9 %ARG(1)

#IF
Equal A9 "Ready"
or Equal A9 "End"
#ACT
break

#IF
!CheckMonMap "E003,40,40,40" 90 看场怪
#ACT
MonGenP "E003,40,40,30" 猿猴战将 45 "noitem"
MonGenP "E003,40,40,30" 猿猴战士 45 "noitem"
MonGenP "E003,40,40,30" 魔神怪1 20 "noitem"
ChangeMonLevel "E003" "猿猴战将" 99
ChangeMonLevel "E003" "猿猴战士" 99
ChangeMonLevel "E003" "魔神怪1" 99
ApplyMonEx "E003,40,40,40" 猿猴战将 [MonsterSide] "看场怪"
ApplyMonEx "E003,40,40,40" 猿猴战士 [MonsterSide] "看场怪"
ApplyMonEx "E003,40,40,40" 魔神怪1 [MonsterSide] "看场怪"

#IF
Equal N2 2
#ACT
ApplyMonMission "E003, 40, 40, 40,9999" "看场怪" "E003,40,40"

#IF
Equal N2 4
#ACT
ApplyMonMission "E003, 40, 40, 30, 10" "看场怪" "E003, 16, 18"
ApplyMonMission "E003, 40, 40, 30, 10" "看场怪" "E003, 16, 55"
ApplyMonMission "E003, 40, 40, 30, 10" "看场怪" "E003, 66, 16"
ApplyMonMission "E003, 40, 40, 30, 10" "看场怪" "E003, 66, 55"

#IF
Equal N2 8
#ACT
mov N2 0
MonClear "E003" "看场怪"
goto @GenMonkeys
break

#IF
#ACT
Inc N2 1
DelayGoto [Grobal] 20 @GenMonkeys 10011




[@CheckFinishCondition]
#ACT
ReadValueSql "TBL_EventSystemTotal" "FLD_NAME='GoldIsland'" "FLD_STEP" @CheckFinishCondition_Next

[@CheckFinishCondition_Next()]
#IF
#ACT
mov A9 %ARG(1)

#IF
Equal A9 "Ready"
or Equal A9 "End"
#ACT
break

#IF
Equal N1 20
#ACT
UpdateValueSql "TBL_EventSystemTotal" "FLD_NAME='GoldIsland'" "FLD_Step='Start'"
LoadValue A7 [Convert_Def\QuestDiary\EventSystem\IslandGame\IslandGame.txt] [Convert] [Msg2]
LineMsg [Grobal] %A7

#IF
ELarge N1 20
!CheckHum "E003" 1
#ACT
goto @IslandEvent_Fail
break

#IF
ELarge N1 20
!CheckHum "E003" 4
#ACT
goto @IslandReward
break

#IF
Equal N1 23
#ACT
MapTing E003 E003 40 40

#IF
Equal N1 25
#ACT
MapTing E003 E003 40 40

#IF
Equal N1 28
#ACT
MapTing E003 E003 40 40

#IF
Equal N1 29
#ACT
MapTing E003 E003 40 40

#IF
ELarge N1 30
#ACT
goto @IslandEvent_Fail
break

#IF
CheckHum "E003" 0
#ACT
LoadValue A7 [Convert_Def\QuestDiary\EventSystem\IslandGame\IslandGame.txt] [Convert] [Msg3]
LineMsg "E003" %A7
LoadValue A7 [Convert_Def\QuestDiary\EventSystem\IslandGame\IslandGame.txt] [Convert] [Msg4]
LineMsg "E003" %A7
Inc N1 1
DelayGoto [Grobal] 60 @CheckFinishCondition 10012
break

[@IslandEvent_Fail]
#ACT
MapTing E003 5 240 129
MonClear "E003"
UpdateValueSql "TBL_EventSystemTotal" "FLD_NAME='GoldIsland'" "FLD_STEP='End'"
LoadValue A7 [Convert_Def\QuestDiary\EventSystem\IslandGame\IslandGame.txt] [Convert] [Msg5]
LineMsg [Grobal] %A7
Delaygoto [Grobal] 300 @GoldIslandReadyCorrect 10014
break

[@IslandReward]
#ACT
ChangeMapAttr "E003" "SAFE"
MonClear "E003"
LoadValue A7 [Convert_Def\QuestDiary\EventSystem\IslandGame\IslandGame.txt] [Convert] [Msg6]
LineMsg [Grobal] %A7
UpdateValueSql "TBL_EventSystemTotal" "FLD_NAME='GoldIsland'" "FLD_STEP='End'"
MapTing E003 E003 40 40
Delaygoto [Grobal] 300 @TingCorrect 10013
ReadValueSql "TBL_EventSystemTotal" "FLD_NAME='GoldIsland'" "FLD_REWORD1,FLD_REWORD1COUNT,FLD_MAPEXP" @MultIslandReward

[@TingCorrect]
#ACT
MapTing E003 5 240 129
Delaygoto [Grobal] 300 @GoldIslandReadyCorrect 10014

[@MultIslandReward()]
#ACT
Mov A9 %ARG(1)
Mov D9 %ARG(2)
Mov D8 %ARG(3)
Mov A8 ""
GiveExpMap E003 %D8
DropItemMap "E003,40,40,15" %A9 1 %D9

[@GoldIslandReadyCorrect]
#ACT
LoadValue A7 [Convert_Def\QuestDiary\EventSystem\IslandGame\IslandGame.txt] [Convert] [Msg7]
LineMsg [Grobal] %A7
UpdateValueSql "TBL_EventSystemTotal" "FLD_NAME='GoldIsland'" "FLD_STEP='Ready'"
UpdateValueSql "TBL_EventSystemTotal" "FLD_NAME='TotalControl'" "FLD_STEP='Ready'"
}




[@FinishIsland]
{

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\EventSystem\IslandGame\IslandGame.txt] @Convert_IslandGame_6

[@FinishIsland_Confirm]
#ACT
LoadValue A7 [Convert_Def\QuestDiary\EventSystem\IslandGame\IslandGame.txt] [Convert] [Msg8]
LineMsg [Grobal] %A7
UpdateValueSql "TBL_EventSystemTotal" "FLD_NAME='GoldIsland'" "FLD_STEP='Ready'"
UpdateValueSql "TBL_EventSystemTotal" "FLD_NAME='TotalControl'" "FLD_STEP='Ready'"
MonClear "E003"
MapTing E003 5 240 129
ClearDelaygoto 10010
ClearDelaygoto 10011
ClearDelaygoto 10012
ClearDelaygoto 10013
ClearDelaygoto 10014
Close
}



[@JoinIsland]
{
#ACT
ReadValueSql "TBL_EventSystemTotal" "FLD_NAME='GoldIsland'" "FLD_USER,FLD_FARE,FLD_STEP" @ChallengeGoldenIsland

[@ChallengeGoldenIsland()]
#ACT
Mov A9 %ARG(1)
Mov D9 %ARG(2)
Mov A8 %ARG(3)

#IF
Equal A8 "StartOpen"

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\EventSystem\IslandGame\IslandGame.txt] @Convert_IslandGame_7


#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\EventSystem\IslandGame\IslandGame.txt] @Convert_IslandGame_8

[@JoinGoldenIsland]
#ACT
ReadValueSql "TBL_EventSystemTotal" "FLD_NAME='GoldIsland'" "FLD_STEP" @JoinGoldenIsland_Next

[@JoinGoldenIsland_Next()]
#IF
#ACT
Mov A8 %ARG(1)

#IF
Equal A8 "StartOpen"
Equal A9 %USERNAME
#ACT
Map E003
break

#IF
Equal A8 "StartOpen"
CheckGold %D9
#ACT
Take 金币 %D9
Map E003
break

#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\EventSystem\IslandGame\IslandGame.txt] @Convert_IslandGame_9

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