;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[@LottoSystem_Result]
{
#ACT
ReadValueSql "TBL_LottoServer" "FLD_Name='Current'" "FLD_Sequence" @LottoSystem_WinnerNum

[@LottoSystem_WinnerNum()]
#ACT
Mov N90 %ARG(1)
Inc N90 1
FormatStr "FLD_Sequence=%s" %N90
UpdateValueSql "TBL_LottoServer" "FLD_NAME='Current'" %A9
Dec N90 1
FormatStr "FLD_Name ='Lotto' and FLD_Sequence=%s" %N90
ReadValueSql "TBL_LottoServer" %A9 "FLD_Num1,FLD_Num2,FLD_Num3,FLD_HumanCount,FLD_TotalPrice" @LottoSystem_ResultBroadCast

[@LottoSystem_ResultBroadCast()]
#ACT
Mov N91 %ARG(1)
Mov N92 %ARG(2)
Mov N93 %ARG(3)
Mov N94 %ARG(4)
Mov N95 %ARG(5)
LoadValue A7 [Convert_Def\QuestDiary\System\LottoSystem\LottoResult.txt] [Convert] [Msg0]
LineMsg [Grobal] %A7
Delaygoto [Grobal] 30 @LottoSystem_ResultNum1 1001

[@LottoSystem_ResultNum1]
#ACT
LoadValue A7 [Convert_Def\QuestDiary\System\LottoSystem\LottoResult.txt] [Convert] [Msg1]
LineMsg [Grobal] %A7
Delaygoto [Grobal] 10 @LottoSystem_ResultNum2 1001

[@LottoSystem_ResultNum2]
#ACT
LoadValue A7 [Convert_Def\QuestDiary\System\LottoSystem\LottoResult.txt] [Convert] [Msg2]
LineMsg [Grobal] %A7
Delaygoto [Grobal] 10 @LottoSystem_ResultNum3 1001

[@LottoSystem_ResultNum3]
#ACT
LoadValue A7 [Convert_Def\QuestDiary\System\LottoSystem\LottoResult.txt] [Convert] [Msg3]
LineMsg [Grobal] %A7
Delaygoto [Grobal] 10 @LottoSystem_ResultFinal 1001

[@LottoSystem_ResultFinal]
#ACT
LoadValue A7 [Convert_Def\QuestDiary\System\LottoSystem\LottoResult.txt] [Convert] [Msg4]
LineMsg [Grobal] %A7
goto @LottoSystem_WinnerReword

[@LottoSystem_WinnerReword]
#IF
Equal N94 0
#ACT
LoadValue A7 [Convert_Def\QuestDiary\System\LottoSystem\LottoResult.txt] [Convert] [Msg5]
LineMsg [Grobal] %A7
Inc N90 1
FormatStr "FLD_Name='Lotto' and FLD_Sequence=%s" %N90
Mov A8 %A9
FormatStr "FLD_TotalPrice=%s" %N95
UpdateValueSql "TBL_LottoServer" %A8 %A9
#ELSEACT
Div N95 N94
mov D0 %P9
LoadValue A7 [Convert_Def\QuestDiary\System\LottoSystem\LottoResult.txt] [Convert] [Msg6]
LineMsg [Grobal] %A7
LoadValue A7 [Convert_Def\QuestDiary\System\LottoSystem\LottoResult.txt] [Convert] [Msg7]
LineMsg [Grobal] %A7
FormatStr "FLD_UserPrice=%s" %D0
mov A8 %A9
FormatStr "FLD_Name='Lotto' and FLD_Sequence=%s" %N90
UpdateValueSql "TBL_LottoServer" %A9 %A8
Inc N90 1
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;