;;;QQ:67762207，这个脚本是在00default.txt里面激活的
[@LottoSystem_LottoItemClick]
{
#ACT
SetItemEvent 61 2 @LottoSystemItemClick

[@LottoSystemItemClick]
#IF
!Equal A9 "幸运彩票"
#ACT
break

#IF
#ACT
return false
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)		;FLD_MakeIdx
Mov D3 %ARG(2)		;FLD_Sequence
Mov D4 %ARG(3)		;FLD_Num1
Mov D5 %ARG(4)		;FLD_Num2
Mov D6 %ARG(5)		;FLD_Num3
Mov A0 %ARG(6)		;FLD_UserName
#IF
Dec D1 1
Equal D2 %D0		;如果FLD_MakeIdx
Equal D3 %D1		;如果FLD_Sequence是上期的表示已经开奖
#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
彩票上还没输入号码。 \\
<在彩票上输入号码。/@InputLottoNumber> \

#IF
Equal D2 %D0
Equal D3 %D1
!Equal D4 100
!Equal D5 100
!Equal D6 100
#ACT
break
#SAY
<$USERNAME>购买的第<$OUTPUT(D3)>期彩票号码为<$OUTPUT(D4)>，<$OUTPUT(D5)>，<$OUTPUT(D6)>。\\
<关 闭/@exit>

#IF
#SAY
此彩票已过期，作废了。 \\
<关 闭/@exit>

[@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
LineMsg [Grobal] "'<$USERNAME>'中了第'<$OUTPUT(D1)>'期彩票大奖。"
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
<$USERNAME>没能中奖。 \\
<关 闭/@exit>

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

#IF
Large D8 0
#SAY
<$USERNAME>中了第<$OUTPUT(D1)>期彩票大奖。 \
奖金是<$OUTPUT(D8)>个积分卷，想提取多少积分卷？ \\
<提取积分卷。/@@ScroolQuest_RewordCheck_Next>
#ELSESAY
<$USERNAME>提取了所有积分卷。\\
<关 闭/@exit>

[@@ScroolQuest_RewordCheck_Next]
#ACT
Mov D9 %INPUTNUM

#IF
ELarge D8 %D9
#SAY
提取了<$OUTPUT(D9)>积分卷。 \\
<关 闭/@exit>
#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
输入的积分卷数量超额。 \
剩下的积分卷为<$OUTPUT(D8)>个，想提取多少积分卷？ \\
<重新提取奖金。/@@ScroolQuest_RewordCheck_Next>

[@InputLottoNumber]
#ACT
Inc D2 1

#IF
Small D2 4
#SAY
请选择本期彩票第<$OUTPUT(D2)>个号码。 \\
< 0号 /@InputLottoNumberSet(0)>  , < 1号 /@InputLottoNumberSet(1)>  , < 2号 /@InputLottoNumberSet(2)> \
< 3号 /@InputLottoNumberSet(3)>  , < 4号 /@InputLottoNumberSet(4)>  , < 5号 /@InputLottoNumberSet(5)> \
< 6号 /@InputLottoNumberSet(6)>  , < 7号 /@InputLottoNumberSet(7)>  , < 8号 /@InputLottoNumberSet(8)> \
< 9号 /@InputLottoNumberSet(9)>  , <10号 /@InputLottoNumberSet(10)> , <11号 /@InputLottoNumberSet(11)> \
<12号 /@InputLottoNumberSet(12)> , <13号 /@InputLottoNumberSet(13)> , <14号 /@InputLottoNumberSet(14)> \\
<随机选择号码。/@RandominputLottoNumberSet> \
#ELSESAY
<$USERNAME>输入了<$OUTPUT(D4)>，<$OUTPUT(D5)>，<$OUTPUT(D6)>。\\
<选好了，我想把号码储存到系统里。/@InputLottoNumberResult_PreSet> \
<重新选号。/@exit> \

[@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
checkcmd CHECKUSERJF 10
#SAY
号码储存完毕。\\
<关 闭/@exit>
#ACT
ReadValueSql "TBL_LottoServer" "FLD_Name='Current'" "FLD_Sequence" @InputLottoNumberResult_PreSet_Next
#ELSESAY
您的积分不够，无法将所选号码储存到系统里。 \\
<关 闭/@exit>

[@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
checkcmd CHECKUSERJF 10
#ACT
Mov D2 %ARG(1)		;奖池的金额

#IF
checkcmd CHECKUSERJF 10
Small D2 500
#ACT
MOV D2 500

#IF
checkcmd CHECKUSERJF 10
#ACT
actcmd SETUSERJF - 10 购买彩票
Inc D2 1
FormatStr "FLD_TotalPrice=%s" %D2
Mov A8 %A9
FormatStr "FLD_Name='Lotto' and FLD_Sequence=%s" %D1
UpdateValueSql "TBL_LottoServer" %A9 %A8 ;update tbl_lottoserver set fld_totalprice=%d2 where fld_name='lotto' and fld_sequence=%d1
SysMsg "已将第<$OUTPUT(D1)>期彩票中奖号码'<$OUTPUT(D4)>'，'<$OUTPUT(D5)>'，'<$OUTPUT(D6)>'储存到系统里。"
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		;select fld_humancount from tbl_lottoserver where fld_name='lotto' and fld_sequence=%d1

[@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		;update tbl_lottoserver set fld_humancount=%d2 where fld_name=lotto and fld_sequence=%s
}
;;;QQ:67762207