;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[@LottoSystem_NPC]
{

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\LottoSystem\LottoNPC.txt] @Convert_LottoNPC_0

[@SellLotto]
#IF
checkitem 幸运彩票 1
#ACT
Give 金币 500
Take 幸运彩票 1

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\LottoSystem\LottoNPC.txt] @Convert_LottoNPC_1


#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\System\LottoSystem\LottoNPC.txt] @Convert_LottoNPC_2

[@ComFirmLottoNumber]
#ACT
ReadValueSql "TBL_LottoServer" "FLD_Name='Current'" "FLD_Sequence" @ComFirmLottoNumber_Sequence

[@ComFirmLottoNumber_Sequence()]
#ACT
Mov D0 %ARG(1)
Dec D0 1

#IF
Large D0 0
#ACT
FormatStr "FLD_Name='Lotto' and FLD_Sequence=%s" %D0
ReadValueSql "TBL_LottoServer" %A9 "FLD_Num1,FLD_Num2,FLD_Num3,FLD_HumanCount,FLD_TotalPrice,FLD_UserPrice" @ComFirmLottoNumber_Information

#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\System\LottoSystem\LottoNPC.txt] @Convert_LottoNPC_3

[@ComFirmLottoNumber_Information()]
#ACT
Mov D1 %ARG(1)
Mov D2 %ARG(2)
Mov D3 %ARG(3)
Mov D4 %ARG(4)
Mov D5 %ARG(5)
Mov D6 %ARG(6)
Mov A0 %ARG(7)

#IF
Equal D4 0
Equal A0 "NotPrize"

#SAY
#INCLUDE [..\Convert_Def\QuestDiary\System\LottoSystem\LottoNPC.txt] @Convert_LottoNPC_4


#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\System\LottoSystem\LottoNPC.txt] @Convert_LottoNPC_5

[@BuyLotto]
#IF
CHECKBAGGAGE

#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\System\LottoSystem\LottoNPC.txt] @Convert_LottoNPC_6

#ELSEACT
break

#IF
checkgold 1500
#ACT
ReadValueSql "TBL_LottoServer" "FLD_Name='Current'" "FLD_Sequence" @BuyLotto_Sequence

#ELSESAY
#INCLUDE [..\Convert_Def\QuestDiary\System\LottoSystem\LottoNPC.txt] @Convert_LottoNPC_7

[@BuyLotto_Sequence()]
#ACT
Mov D0 %ARG(1)

#IF
checkgold 1500
#ACT
LoadValue A7 [Convert_Def\QuestDiary\System\LottoSystem\LottoNPC.txt] [Convert] [Msg0]
sysmsg %A7
Take 金币 1500
Give 幸运彩票 1
FormatStr "%s,%s,%s," %P9 %D0 100
Mov A8 %A9
FOrmatStr "%s,%s" 100 100
Addstr A8 %A9
FormatStr "FLD_MakeIdx=%s and FLD_Sequence=%s" %P9 %D0
WriteValueSql "TBL_LottoUser" %A9 "FLD_MakeIdx,FLD_Sequence,FLD_Num1,FLD_Num2,FLD_Num3" %A8
Close
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;