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

[@SurviveGameMainMenu]
{
#IF
IsAdmin

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\EventSystem\SurviveGame\SurviveGame.txt] @Convert_SurviveGame_0

#IF

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\EventSystem\SurviveGame\SurviveGame.txt] @Convert_SurviveGame_1

[@InitalSurviveGameMainMenu]
#CALL [EventSystem\SurviveGame\SurviveGame.txt] @TestSurviveGame_Finish

[@BeginSurviveGameMainMenu]
#CALL [EventSystem\SurviveGame\SurviveGame.txt] @TestSurviveGame_Start

[@JoinSurviveGameMainMenu]
#CALL [EventSystem\SurviveGame\SurviveGame.txt] @TestSurviveGame_Join
}




[@TestSurviveGame_Start]
{
#ACT
ReadValueSql "TBL_EventSystemTotal" "FLD_NAME='TotalControl'" "FLD_STEP" @PreTestSurviveGame_Start

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

#IF
Equal A9 "Ready"
#ACT
ReadValueSql "TBL_EventSystemTotal" "FLD_NAME='Survival'" "FLD_STEP" @TestSurviveGame_Start_Next

#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\EventSystem\SurviveGame\SurviveGame.txt] @Convert_SurviveGame_2

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

#IF
!Checkitem 通用卷 1

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\EventSystem\SurviveGame\SurviveGame.txt] @Convert_SurviveGame_3

#ACT
break

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

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\EventSystem\SurviveGame\SurviveGame.txt] @Convert_SurviveGame_4

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

#IF

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\EventSystem\SurviveGame\SurviveGame.txt] @Convert_SurviveGame_5

#ACT
break

[@TestSurviveGame_Start_Next1]
#IF
#ACT
UpdateValueSql "TBL_EventSystemTotal" "FLD_NAME='Survival'" "FLD_STEP='StartOpen'"
ResetMapAttr "E002"
MonClear E002
LoadValue A7 [Convert_Def\QuestDiary\EventSystem\SurviveGame\SurviveGame.txt] [Convert] [Msg1]
LineMsg [Grobal] %A7
mov N5 2
mov N6 4
mov N7 40
mov N8 4
movr P9 4

#IF
Equal P9 0
#ACT
mov B0 "诺玛法老"
mov N0 20
mov B1 "诺玛将士"
mov N1 20
mov B2 "诺玛"
mov N2 30
mov B3 "诺玛"
mov N3 30
mov B4 "大法老"
mov N4 5

#IF
Equal P9 1
#ACT
mov B0 "石像狮子"
mov N0 5
mov B1 "火焰狮子"
mov N1 5
mov B2 "地牢女神1"
mov N2 10
mov B3 "地牢女神2"
mov N3 10
mov B4 "震天首将"
mov N4 2

#IF
Equal P9 2
#ACT
mov B0 "潘夜战士"
mov N0 10
mov B1 "潘夜火魔"
mov N1 10
mov B2 "潘夜左护卫"
mov N2 15
mov B3 "潘夜右护卫"
mov N3 15
mov B4 "潘夜鬼将"
mov N4 3

#IF
Equal P9 3
#ACT
mov B0 "触角神魔"
mov N0 4
mov B1 "恶形鬼"
mov N1 8
mov B2 "犬猴魔"
mov N2 8
mov B3 "爆毒神魔"
mov N3 4
mov B4 "霸王守卫"
mov N4 1

#IF
#ACT
mov A5 ""
Addstr A5 B1
Addstr A5 ","
Addstr A5 B2
Addstr A5 ","
Addstr A5 B3
Addstr A5 ","
Addstr A5 B4
Delaygoto [Grobal] 300 @TestSurviveGame_Start_Next3 10030

[@TestSurviveGame_Start_Next3]
#ACT
mov N11 1
UpdateValueSql "TBL_EventSystemTotal" "FLD_NAME='Survival'" "FLD_STEP='Start'"
LoadValue A7 [Convert_Def\QuestDiary\EventSystem\SurviveGame\SurviveGame.txt] [Convert] [Msg2]
LineMsg [Grobal] %A7
goto @TestSurviveGame_Start_Next4

[@TestSurviveGame_Start_Next4]
#IF
Elarge N11 11
#ACT
goto @TestSurviveGame_Start_Result
break
#ELSEACT
LoadValue A7 [Convert_Def\QuestDiary\EventSystem\SurviveGame\SurviveGame.txt] [Convert] [Msg3]
EventMsg "E002" %A7
MonGenP "E002,40,40,30" %B0 %N0
MonGenP "E002,40,40,30" %B1 %N1
MonGenP "E002,40,40,30" %B2 %N2
MonGenP "E002,40,40,30" %B3 %N3
MonGenP "E002,40,40,30" %B4 %N4
MonPwr "E002" %A5 [AC] %N5
MonPwr "E002" %A5 [MAC] %N6
MonPwr "E002" %A5 [HP] %N7
MonPwr "E002" %A5 [DC] %N8
Inc N11 1
ChangeMonLevel "E002" %A5 99
Delaygoto [Grobal] 180 @TestSurviveGame_Start_Next4 10031

[@TestSurviveGame_Start_Result]
#IF
CheckMonMap E002 15
or CheckHum E002 25
#ACT
MapTing E002 5 240 129
MonClear E002
UpdateValueSql "TBL_EventSystemTotal" "FLD_NAME='Survival'" "FLD_STEP='End'"
LoadValue A7 [Convert_Def\QuestDiary\EventSystem\SurviveGame\SurviveGame.txt] [Convert] [Msg4]
LineMsg [Grobal] %A7
Delaygoto [Grobal] 300 @TestSurviveGame_Start_Result_Ready 10033
#ELSEACT
ChangeMapAttr "E003" "SAFE"
MonClear E002
MapTing E002 E002 40 40
LoadValue A7 [Convert_Def\QuestDiary\EventSystem\SurviveGame\SurviveGame.txt] [Convert] [Msg5]
LineMsg [Grobal] %A7
UpdateValueSql "TBL_EventSystemTotal" "FLD_NAME='Survival'" "FLD_STEP='End'"
Delaygoto [Grobal] 300 @TestSurviveGame_Start_Result_PreReady 10033
ReadValueSql "TBL_EventSystemTotal" "FLD_NAME='Survival'" "FLD_REWORD1,FLD_REWORN1COUNT,FLD_MAPEXP" @TestSurviveGame_Start_Result_Next

[@TestSurviveGame_Start_Result_Next()]
#ACT
mov A9 %ARG(1)
mov D9 %ARG(2)
Mov D8 %ARG(3)
GiveExpMap E002 %D8
DropItemMap "E002,40,40,20" %A9 1 %D9

[@TestSurviveGame_Start_Result_PreReady]
#ACT
MapTing E002 5 240 129
Delaygoto [Grobal] 300 @TestSurviveGame_Start_Result_Ready 10033

[@TestSurviveGame_Start_Result_Ready]
#ACT
LoadValue A7 [Convert_Def\QuestDiary\EventSystem\SurviveGame\SurviveGame.txt] [Convert] [Msg6]
LineMsg [Grobal] %A7
UpdateValueSql "TBL_EventSystemTotal" "FLD_NAME='Survival'" "FLD_STEP='Ready'"
UpdateValueSql "TBL_EventSystemTotal" "FLD_NAME='TotalControl'" "FLD_STEP='Ready'"
}




[@TestSurviveGame_Finish]
{

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\EventSystem\SurviveGame\SurviveGame.txt] @Convert_SurviveGame_6

[@TestSurviveGame_Finish_ConFirm]
#ACT
LoadValue A7 [Convert_Def\QuestDiary\EventSystem\SurviveGame\SurviveGame.txt] [Convert] [Msg7]
LineMsg [Grobal] %A7
UpdateValueSql "TBL_EventSystemTotal" "FLD_NAME='Survival'" "FLD_STEP='Ready'"
UpdateValueSql "TBL_EventSystemTotal" "FLD_NAME='TotalControl'" "FLD_STEP='Ready'"
MonClear "E002"
MapTing E002 5 240 129
ClearDelaygoto 10030
ClearDelaygoto 10031
ClearDelaygoto 10032
ClearDelaygoto 10033
Close
}




[@TestSurviveGame_Join]
{
#ACT
ReadValueSql "TBL_EventSystemTotal" "FLD_NAME='Survival'" "FLD_USER,FLD_FARE,FLD_STEP" @ChallengeTestSurviveGame

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

#IF
Equal A8 "StartOpen"

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\EventSystem\SurviveGame\SurviveGame.txt] @Convert_SurviveGame_7


#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\EventSystem\SurviveGame\SurviveGame.txt] @Convert_SurviveGame_8

[@JoinChallengeTestSurviveGame]
#ACT
ReadValueSql "TBL_EventSystemTotal" "FLD_NAME='Survival'" "FLD_STEP" @JoinChallengeTestSurviveGame_Next

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

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

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

#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\EventSystem\SurviveGame\SurviveGame.txt] @Convert_SurviveGame_9

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