;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[@LottoSystem_LottoItemClick]
{
#ACT
SetItemEvent 61 2 @LottoSystemItemClick

[@LottoSystemItemClick]
#IF
!Equal A9 "ÐÒÔË²ÊÆ±"
#ACT
break

#IF
#ACT
Mov D0 %P9
ReadValueSql "TBL_LottoServer" "FLD_Name='Current'" "FLD_Sequence" @LottoSystemItemClick_Main

[@LottoSystemItemClick_Main()]
#ACT
Mov D1 %ARG(1)
FormatStr "FLD_MakeIdx=%s" %D0
ReadValueSql "TBL_LottoUser" %A9 "FLD_MakeIdx,FLD_Sequence,FLD_Num1,FLD_Num2,FLD_Num3,FLD_UserName" [@ScroolQuest_ItemIdxCheck]

[@ScroolQuest_ItemIdxCheck()]
#ACT
Mov D2 %ARG(1)
Mov D3 %ARG(2)
Mov D4 %ARG(3)
Mov D5 %ARG(4)
Mov D6 %ARG(5)
Mov A0 %ARG(6)
#IF
Dec D1 1
Equal D2 %D0
Equal D3 %D1
#ACT
FormatStr "FLD_Name='Lotto' and FLD_Sequence=%s" %D1
ReadValueSql "TBL_LottoServer" %A9 "FLD_Num1,FLD_Num2,FLD_Num3,FLD_UserPrice" [@ScroolQuest_RewordCheck]
break

#IF
Inc D1 1
Equal D2 %D0
Equal D3 %D1
Equal D4 100
Equal D5 100
Equal D6 100
#ACT
Mov D2 0
break

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\LottoSystem\LottoItemClick.txt] @Convert_LottoItemClick_0

#IF
Equal D2 %D0
Equal D3 %D1
!Equal D4 100
!Equal D5 100
!Equal D6 100
#ACT
break

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\LottoSystem\LottoItemClick.txt] @Convert_LottoItemClick_1

#IF

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\LottoSystem\LottoItemClick.txt] @Convert_LottoItemClick_2

[@ScroolQuest_RewordCheck()]
#ACT
Mov D7 %ARG(1)
Mov D8 %ARG(2)
Mov D9 %ARG(3)
Mov D2 %ARG(4)

#IF
!Equal D1 0
Equal A0 ""
Equal D7 %D4
Equal D8 %D5
Equal D9 %D6
#ACT
LoadValue A7 [Convert_Def\QuestDiary\System\LottoSystem\LottoItemClick.txt] [Convert] [Msg0]
LineMsg [Grobal] %A7
FormatStr "FLD_UserName='%s',FLD_Price=%s" %USERNAME %D2
Mov A8 %A9
FormatStr "FLD_MakeIdx=%s and FLD_Sequence=%s" %D0 %D1
UpdateValueSql "TBL_LottoUser" %A9 %A8
Mov A0 %USERNAME

#IF
Equal A0 %USERNAME
Equal D7 %D4
Equal D8 %D5
Equal D9 %D6
#ACT
FormatStr "FLD_MakeIdx=%s and FLD_Sequence=%s and FLD_UserName='%s'" %D0 %D1 %A0
ReadValueSql "TBL_LottoUser" %A9 "FLD_Price" [@ScroolQuest_RewordCheck_Next]

#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\System\LottoSystem\LottoItemClick.txt] @Convert_LottoItemClick_3

[@ScroolQuest_RewordCheck_Next()]
#ACT
Mov D8 %ARG(1)

#IF
Large D8 0

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\LottoSystem\LottoItemClick.txt] @Convert_LottoItemClick_4


#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\System\LottoSystem\LottoItemClick.txt] @Convert_LottoItemClick_5

[@@ScroolQuest_RewordCheck_Next]
#ACT
Mov D9 %INPUTNUM

#IF
ELarge D8 %D9

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\LottoSystem\LottoItemClick.txt] @Convert_LottoItemClick_6

#ACT
Give ½ð±Ò %D9
Dec D8 %D9
FormatStr "FLD_Price=%s" %D8
Mov A8 %A9
FormatStr "FLD_MakeIdx=%s and FLD_Sequence=%s and FLD_UserName='%s'" %D0 %D1 %USERNAME
UpdateValueSql "TBL_LottoUser" %A9 %A8

#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\System\LottoSystem\LottoItemClick.txt] @Convert_LottoItemClick_7

[@InputLottoNumber]
#ACT
Inc D2 1

#IF
Small D2 4

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\LottoSystem\LottoItemClick.txt] @Convert_LottoItemClick_8


#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\System\LottoSystem\LottoItemClick.txt] @Convert_LottoItemClick_9

[@RandominputLottoNumberSet]
#ACT
Mov D2 3
Movr D4 15
Movr D5 15
Movr D6 15
goto @InputLottoNumber

[@InputLottoNumberSet()]
#ACT
Mov D3 %ARG(1)

#IF
Equal D2 1
#ACT
Mov D4 %D3
goto @InputLottoNumber
break

#IF
Equal D2 2
#ACT
Mov D5 %D3
goto @InputLottoNumber
break

#IF
Equal D2 3
#ACT
Mov D6 %D3
goto @InputLottoNumber
break

[@InputLottoNumberResult_PreSet]
#IF
checkgold 10000

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\LottoSystem\LottoItemClick.txt] @Convert_LottoItemClick_10

#ACT
ReadValueSql "TBL_LottoServer" "FLD_Name='Current'" "FLD_Sequence" @InputLottoNumberResult_PreSet_Next

#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\System\LottoSystem\LottoItemClick.txt] @Convert_LottoItemClick_11

[@InputLottoNumberResult_PreSet_Next()]
#ACT
Mov D1 %ARG(1)
FormatStr "FLD_Name='Lotto' and FLD_Sequence=%s" %D1
ReadValueSql "TBL_LottoServer" %A9 "FLD_TotalPrice" @InputLottoNumberResult_PreSet_Next1

[@InputLottoNumberResult_PreSet_Next1()]
#IF
checkgold 10000
#ACT
Mov D2 %ARG(1)
Take ½ð±Ò 10000
Inc D2 10000

FormatStr "FLD_TotalPrice=%s" %D2
Mov A8 %A9
FormatStr "FLD_Name='Lotto' and FLD_Sequence=%s" %D1
UpdateValueSql "TBL_LottoServer" %A9 %A8
LoadValue A7 [Convert_Def\QuestDiary\System\LottoSystem\LottoItemClick.txt] [Convert] [Msg1]
SysMsg %A7

FormatStr "FLD_Num1=%s,FLD_Num2=%s,FLD_Num3=%s" %D4 %D5 %D6
Mov A8 %A9
FormatStr "FLD_MakeIdx=%s and FLD_Sequence=%s" %D0 %D1
UpdateValueSql "TBL_LottoUser" %A9 %A8

FormatStr "FLD_Name='Lotto' and FLD_Sequence=%s" %D1
ReadValueSql "TBL_LottoServer" %A9 "FLD_Num1,FLD_Num2,FLD_Num3" @InputLottoNumberResult

[@InputLottoNumberResult()]
#ACT
Mov D7 %ARG(1)
Mov D8 %ARG(2)
Mov D9 %ARG(3)
goto @InputLottoNumberResult_Num1

[@InputLottoNumberResult_Num1]
#IF
Equal D4 %D7
Equal D5 %D8
Equal D6 %D9
#ACT
FormatStr "FLD_Name='Lotto' and FLD_Sequence=%s" %D1
ReadValueSql "TBL_LottoServer" %A9 "FLD_HumanCount" @InputLottoNumberResult_DB

[@InputLottoNumberResult_DB()]
#ACT
Mov D2 %ARG(1)
Inc D2 1

FormatStr "FLD_HumanCount=%s" %D2
Mov A8 %A9
FormatStr "FLD_Name='Lotto' and FLD_Sequence=%s" %D1
UpdateValueSql "TBL_LottoServer" %A9 %A8
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;