转载要求:
除本站特殊申明之作品不得转载外,其余作品均可转载,转载作品请保留作者及来源信息。
################################################################################
############Lottery by Golgorth##V2.0###########################################
################################################################################
##1.- 你需要在主目录下创建一个目录,名叫"lottery"
##2.- 你应该检查每个配置的内容以适合你的需要
## 你可以自定义NPC所说的话,奖励物品使用的时间
## 获奖中奖号码的彩票
##3.- 你需要添加这些: [lotsystem::winnumber $player] :this check ##
## 将其放到 startup.tcl 的 OnPlayerDeath 中 ##
## 以检查是否到了运行 winnernumber proc 的时候 ##
## 请小心地放入到正确的命名域(namespace)中 ,命名域是指你将代码放入到的目标脚本位置,而不是文件名
################################################################################
################################################################################
#这是 creatures.scp 中的彩票员,复制并修改id, 阵营以及模型,使其针对大部分的玩家
################################################################################
[creature 900101]
attack=2000 2000
name=彩券发行员
model=7311
faction=12
guild=国有彩券发行
type=7
family=7
questscript=lotterynpc
npcflags=07
faction=12
elite=3
level=60
maxhealth=10370
damage=1037 1659
maxmana=0
sell=30033 # 必须和 items.scp中添加的彩券ID一致
###################################################################
#这是在 items.scp 中的物品 #
###################################################################
[item 30033]
name=彩券
buyprice=10000
startquest=123002 # 必须和添加到 quest.scp 中的quest ID一致,其实就是一个获得以后激活的任务
questscript=lottery
stackable=1
class=12
classes=07FFF
flags=0800
material=-1
maxcount=1
model=31744
quality=1
races=01FF
sellprice=0
subclass=0
#########################################################
#添加到 quest.scp 中的内容(不要问为什么需要这个) #
#########################################################
[quest 123002]
name=彩券
objectives=获取你的彩券号码。
desc=准备好测试你的幸运指数了吗?
deliver=30033 1
src_item=30033
###########################################################
# 在tcl目录中创建文件 lotsystem.tcl,并将以下内容复制到该文件中 #
###########################################################
namespace eval lotsystem {
proc lotterynum { player } {
set pname [GetName $player]
set n1_list "1 2 3 4 5 6 7 8 9 0"
set n2_list "1 2 3 4 5 6 7 8 9 0"
set n3_list "1 2 3 4 5 6 7 8 9 0"
set num1 [lindex $n1_list [expr {int(rand()*[llength $n1_list])}]]
set num2 [lindex $n2_list [expr {int(rand()*[llength $n2_list])}]]
set num3 [lindex $n3_list [expr {int(rand()*[llength $n3_list])}]]
set number "$num1$num2$num3"
set file "lottery/$number"
if { [file exists "lottery/$number"] != 1} {
set id [open $file a+]
puts $id "$pname"
close $id
return "你的彩券号码是 $number"
}
set id [open $file a+]
puts $id "$pname"
close $id
return "你的彩券号码是 $number"
}
# You should change the hours and day to check if is time to run lotto and to delete the folder
proc winnumber { player } {
set hourtime [clock format [clock seconds] -format {%H}]
set daytime [clock format [clock seconds] -format {%u}]
set checkfile "lottery/checkfile"
if { [file exists "lottery/checkfile"] != 1 } {
if { ($hourtime == 16) && ($daytime == 1) } {
set n1_list "1 2 3 4 5 6 7 8 9 0"
set n2_list "1 2 3 4 5 6 7 8 9 0"
set n3_list "1 2 3 4 5 6 7 8 9 0"
set num1 [lindex $n1_list [expr {int(rand()*[llength $n1_list])}]]
set num2 [lindex $n2_list [expr {int(rand()*[llength $n2_list])}]]
set num3 [lindex $n3_list [expr {int(rand()*[llength $n3_list])}]]
set number "$num1$num2$num3"
set file "lottery/winnernumber"
if { [file exists "lottery/winne[1] [2] [3] 下一页