工程参考/配置文件/Server/boxdroplist系列
boxdroplist 系列是脚本开箱抽奖表,不是怪物击杀掉落包。35 个样本文件都是 7 列:行号、物品模板、权重、公告标志和三列保留。暗箱、聚宝盆、百宝书匣各用独立加载器;其余转丹列表走同一套 InitOneZhuanDanDropListTable,由 Lua 类型 0..29 选择。不要按文件名数字猜测类型号,也不要把本表接到 MonsterDropBoxs。
文件位置与生效
| 项目 | 说明 |
|---|---|
| 运行文件 | ./Config/boxdroplist*.txt,相对于 Server 工作目录。暗箱、聚宝盆、百宝书匣和各转丹列表路径写死在 GameTable.cpp,不经 FileDef 宏。
|
| 读取程序 | Server 在 TableInit::Init 加载;Lua 开箱脚本按累计权重区间抽取 |
| 生效方法 | 停服后备份并修改实际 Server/Config 副本,再重启 Server。当前检索范围未发现独立重载。客户端不加载本系列。改权重后须重启才重算累计区间。 |
| 样本格式 | ASCII,CRLF。保留原编码;源码读取器不会自动把中文转为 UTF-8。
|
和击杀掉落的区别
| 系统 | 怎样抽 |
|---|---|
| 本系列 | 脚本先取权重和,再 random(0, 权重和-1) 查半开区间 [Start, End)。 |
| MonsterDropBoxs / DropBoxContent | 按怪物 DataID 查包,再按价值比决定是否从包里抽一件。 |
| ZhuandanBase / ZhuandanOutput | 转蛋物品走 Base+Output,与本系列类型号不是同一套。 |
加载后每行生成 m_StartNum、m_EndNum:从 0 起按 Rate 累加。脚本传入的随机数落在 [Start, End) 即命中。空 Notice 经 atoi 为 0。Lua 只返回 ItemID 和 Notice,三列保留被读入但不参与抽取。
三类加载器
| 加载器 | 校验 |
|---|---|
| InitDarkBoxDropListTable | 列数 ≥7。不要求 Index 等于行号,不要求 ItemID/Rate 为正,Notice 可不只是 0/1。 |
| InitJuBaoContainerDropListTable / InitBaibaoshuxia | 列数必须为 7。Index 必须等于从 0 起的行号,ItemID>0,Rate>0,Notice 只能 0 或 1,累计不得溢出 INT。失败清空整表。 |
| InitOneZhuanDanDropListTable | 列数 >6。打开文件的返回值不检查;行数为 0 则该全局保持空表。不校验编号和权重。 |
Lua 调用
| 注册名 | 用途 |
|---|---|
| DarkBoxItemDropRandom | sceneId、selfId 保留不读,第 3 参是 0..权重和-1 的随机数。返回物品编号、公告标志。 |
| GetDarkBoxItemDropCount | 返回暗箱权重和 m_Base。前两参保留不读。 |
| JuBaoContainerItemDropRandom | 聚宝盆,参数与暗箱相同。 |
| GetJuBaoContainerItemDropCount | 返回聚宝盆权重和。 |
| BaibaoshuxiaItemDropItem | 百宝书匣。命中后 break,不继续扫后面的区间。 |
| GetBaibaoshuxiaItemDropBase | 返回百宝书匣权重和。 |
| ZhuanDanItemDropRandom | 第 4 参是类型 0..29。非法类型断言。 |
| GetZhuanDanItemDropCount | 第 3 参是类型 0..29,返回该表权重和;非法类型断言后返回 -1。 |
样本脚本用 random(0, GetXxx()-1)。暗箱、聚宝盆、转丹的随机函数扫完全表取最后一次命中;区间不重叠时与第一次命中相同。百宝书匣命中后立刻 break。
系列成员
| 文件 | Lua 入口与全局 | 样本要点 |
|---|---|---|
Server/boxdroplist.txt
|
暗箱g_DropList_DarkBoxDarkBoxItemDropRandom / GetDarkBoxItemDropCount |
行数 576,权重和 9595584。InitDarkBoxDropListTable;列数 ≥7,不校验编号、权重、公告 |
Server/boxdroplist_jubao.txt
|
聚宝盆g_DropList_JuBaoContainerJuBaoContainerItemDropRandom / GetJuBaoContainerItemDropCount |
行数 12,权重和 1000000。列数必须为 7;Index 等于行号,ItemID>0,Rate>0,Notice 只能 0 或 1 |
Server/boxdroplist_baibaoshuxia.txt
|
百宝书匣g_DropList_BaibaoshuxiaBaibaoshuxiaItemDropItem / GetBaibaoshuxiaItemDropBase |
行数 64,权重和 113308。校验规则与聚宝盆相同 |
Server/boxdroplist_zhuandan1.txt
|
Lua 类型 0g_DropList_ZhenShouBaoNangZhuanDanItemDropRandom(..., 0) |
行数 10,权重和 1000000。InitOneZhuanDanDropListTable;列数 >6,不校验编号/权重 |
Server/boxdroplist_zhuandan2.txt
|
Lua 类型 1g_DropList_DuanWuBaoHeZhuanDanItemDropRandom(..., 1) |
行数 24,权重和 1000000。转丹掉落列表 |
Server/boxdroplist_zhuandan3.txt
|
Lua 类型 2g_DropList_LianZhuangBaoHeZhuanDanItemDropRandom(..., 2) |
行数 24,权重和 1000000。转丹掉落列表 |
Server/boxdroplist_zhuandan4.txt
|
Lua 类型 3g_DropList_TianCiLiangYuanZhuanDanItemDropRandom(..., 3) |
行数 5,权重和 1000000。转丹掉落列表 |
Server/boxdroplist_zhuandan5.txt
|
Lua 类型 4g_DropList_BaiBaoHeZhuanDanItemDropRandom(..., 4) |
行数 12,权重和 1000000。转丹掉落列表 |
Server/boxdroplist_zhuandan6.txt
|
Lua 类型 5g_DropList_ZhuShiBaoHeZhuanDanItemDropRandom(..., 5) |
行数 33,权重和 1000000。转丹掉落列表 |
Server/boxdroplist_zhuandansl.txt
|
Lua 类型 6g_DropList_ShaoLinZhuanDanItemDropRandom(..., 6) |
行数 18,权重和 1000000。门派后缀 sl |
Server/boxdroplist_zhuandantl.txt
|
Lua 类型 7g_DropList_TianLongZhuanDanItemDropRandom(..., 7) |
行数 18,权重和 1000000。门派后缀 tl |
Server/boxdroplist_zhuandanem.txt
|
Lua 类型 8g_DropList_EMeiZhuanDanItemDropRandom(..., 8) |
行数 18,权重和 1000000。门派后缀 em |
Server/boxdroplist_zhuandanwd.txt
|
Lua 类型 9g_DropList_WuDangZhuanDanItemDropRandom(..., 9) |
行数 18,权重和 1000000。门派后缀 wd |
Server/boxdroplist_zhuandanxy.txt
|
Lua 类型 10g_DropList_XiaoYaoZhuanDanItemDropRandom(..., 10) |
行数 18,权重和 1000000。门派后缀 xy |
Server/boxdroplist_zhuandants.txt
|
Lua 类型 11g_DropList_TianShanZhuanDanItemDropRandom(..., 11) |
行数 18,权重和 1000000。门派后缀 ts |
Server/boxdroplist_zhuandanmj.txt
|
Lua 类型 12g_DropList_MingJiaoZhuanDanItemDropRandom(..., 12) |
行数 18,权重和 1000000。门派后缀 mj |
Server/boxdroplist_zhuandangb.txt
|
Lua 类型 13g_DropList_GaiBangZhuanDanItemDropRandom(..., 13) |
行数 18,权重和 1000000。门派后缀 gb |
Server/boxdroplist_zhuandanxx.txt
|
Lua 类型 14g_DropList_XingXiuZhuanDanItemDropRandom(..., 14) |
行数 18,权重和 1000000。门派后缀 xx |
Server/boxdroplist_zhuandan16.txt
|
Lua 类型 15g_DropList_LuckBoxZhuanDanItemDropRandom(..., 15) |
行数 24,权重和 1000000。转丹掉落列表 |
Server/boxdroplist_zhuandan17.txt
|
Lua 类型 16g_DripList_CrystalBoxZhuanDanItemDropRandom(..., 16) |
行数 14,权重和 1000000。源码全局名为 g_DripList_CrystalBox(Drip 不是 Drop) |
Server/boxdroplist_zhuandan18.txt
|
Lua 类型 17g_DripList_SOCKZhuanDanItemDropRandom(..., 17) |
行数 49,权重和 1000000。源码全局名为 g_DripList_SOCK |
Server/boxdroplist_zhuandan19.txt
|
Lua 类型 18g_DropList_GFBoxZhuanDanItemDropRandom(..., 18) |
行数 77,权重和 1000000。转丹掉落列表 |
Server/boxdroplist_zhuandan20.txt
|
Lua 类型 19g_DropList_GoldBoxZhuanDanItemDropRandom(..., 19) |
行数 15,权重和 1000000。转丹掉落列表 |
Server/boxdroplist_zhuandan21.txt
|
Lua 类型 20g_DropList_PlanitaBoxZhuanDanItemDropRandom(..., 20) |
行数 12,权重和 1000000。转丹掉落列表 |
Server/boxdroplist_zhuandan22.txt
|
Lua 类型 21g_DropList_ColorSockZhuanDanItemDropRandom(..., 21) |
行数 51,权重和 1000000。转丹掉落列表 |
Server/boxdroplist_zhuandan23.txt
|
Lua 类型 22g_DropList_NewYearSweetBagZhuanDanItemDropRandom(..., 22) |
行数 97,权重和 1000000。转丹掉落列表 |
Server/boxdroplist_zhuandan24.txt
|
Lua 类型 23g_DropList_ColorBoxZhuanDanItemDropRandom(..., 23) |
行数 48,权重和 1000000。转丹掉落列表 |
Server/boxdroplist_zhuandan26.txt
|
Lua 类型 24g_DropList_StoreBagZhuanDanItemDropRandom(..., 24) |
行数 30,权重和 1000000。没有 zhuandan25;类型 24 直接接到 26 号文件 |
Server/boxdroplist_zhuandan27.txt
|
Lua 类型 25g_DropList_LeTouBagZhuanDanItemDropRandom(..., 25) |
行数 36,权重和 1000000。转丹掉落列表 |
Server/boxdroplist_zhuandan28.txt
|
Lua 类型 26g_DropList_XingFuMoTianLunZhuanDanItemDropRandom(..., 26) |
行数 26,权重和 1000000。脚本 zhuandan_32_XingFuMoTianLun.lua 使用类型 26,不是 32 号文件 |
Server/boxdroplist_zhuandan29.txt
|
Lua 类型 27g_DropList_BraveryEggZhuanDanItemDropRandom(..., 27) |
行数 25,权重和 1000000。转丹掉落列表 |
Server/boxdroplist_zhuandan31.txt
|
Lua 类型 28g_DropList_XuanMuJinDanZhuanDanItemDropRandom(..., 28) |
行数 8,权重和 1000000。金丹文件是 31,银丹是 30 |
Server/boxdroplist_zhuandan30.txt
|
Lua 类型 29g_DropList_XuanMuYinDanZhuanDanItemDropRandom(..., 29) |
行数 8,权重和 1000000。银丹文件是 30 |
Server/boxdroplist_zhuandan32.txt
|
未加载无无 |
行数 25,权重和 1000000。样本存在,当前启动与 Lua 类型 0..29 均未引用 |
Server/boxdroplist_zhuandan33.txt
|
未加载无无 |
行数 45,权重和 1000000。样本存在,当前启动与 Lua 类型 0..29 均未引用 |
文件格式
首行是类型行:INT INT INT INT INT INT INT;第二行是列名行,程序跳过其内容;从第三行开始读取数据。各列用真实 Tab 分隔,保留首列、空列及行尾,不用空格代替。数据行行首 # 表示注释,分号不是此表的注释规则。首列为空的行被跳过;不足的尾列补为空值,多余列不参与本页字段读取。空整数和非数字经 atoi 可能成为 0,空字符串仍为空,不把解析成功当作业务合法。第一列须唯一,重复会触发读取器错误。
字段详解
列号从 1 开始,源码列下标从 0 开始。
| 字段与类型 | 含义与修改要点 | 缺项或特殊值 |
|---|---|---|
第 1 列INT:index |
行号。聚宝盆和百宝书匣必须等于从 0 起的记录下标,否则整表失败。暗箱和转丹列表保存本列但不按它查找,查找只看累计区间。 | 空首列跳行。聚宝盆/百宝书匣错号会使加载失败。 |
第 2 列INT:ItemID |
抽中后返回的物品模板编号。不是行号、GUID 或背包格。 | 聚宝盆/百宝书匣须 >0。暗箱和转丹列表 0 或负值仍会写入,脚本得到该值后能否发奖取决于调用方。 |
第 3 列INT:Rate |
本行相对权重。加载后生成 [Start, End),End=Start+Rate,再把 Start 推进 Rate。全表权重和写入 m_Base,供脚本 random 上界。暗箱样本和为 9595584,不是 100 万。 | 聚宝盆/百宝书匣须 >0。暗箱和转丹列表允许 0,结果是空区间,该行不会被命中。不是百分号。 |
第 4 列INT:Notice |
抽中后一并返回的公告标志。样本脚本里 1 才发系统公告。空单元格读成 0。 | 聚宝盆/百宝书匣只能是 0 或 1。暗箱和转丹列表原样保存,其他值也会返回给脚本。 |
第 5 列INT:Reserve1 |
加载写入保留字段。当前 Lua 抽取不读本列。 | 空为 0。改它不会改变抽中哪一件。 |
第 6 列INT:Reserve2 |
加载写入保留字段。当前 Lua 抽取不读本列。 | 空为 0。 |
第 7 列INT:Reserve3 |
加载写入保留字段。当前 Lua 抽取不读本列。列数:暗箱 ≥7,聚宝盆/百宝书匣必须 7,转丹列表 >6。 | 空为 0。不要删掉本列凑“看起来没用”。 |
常用修改实例
示例为局部教学片段,先备份原运行文件,再修改对应行并保留其余配置。教学值不是程序默认值。 以下代码块保留真实 Tab;本地示例文件保留原样本编码、中文表头与 CRLF。网页文字使用浏览器编码显示,不表示运行文件应改存 UTF-8。
把暗箱第一件物品的权重从 831 改为 1662
修改前:
INT INT INT INT INT INT INT index ItemID Rate Notice Reserve1 Reserve2 Reserve3 0 10500002 831 0
修改后:
INT INT INT INT INT INT INT index ItemID Rate Notice Reserve1 Reserve2 Reserve3 0 10500002 1662 0
按第一列定位行 0。样本 ItemID 为 10500002,Rate 831,Notice 0,三列保留为空。只把第 3 列改为 1662,保留 7 列和其余 575 行。本片段含表头与该行,不能覆盖整表。
加载后该行区间由 [0,831) 变为 [0,1662),暗箱权重和由 9595584 变为 9596415。脚本 random(0, 权重和-1) 命中该行的份额大约从 831/9595584 变为 1662/9596415,不是 831% 变成 1662%。隔离加载读回 Rate 1662、权重和 9596415。实际开箱次数需要实测。
验证与排查
启动无 boxdroplist 加载失败日志。暗箱 576 行、权重和按修改后的值;聚宝盆 12 行、百宝书匣 64 行。用对应脚本开箱,确认仍能抽到原物品且权重变化。转丹脚本第 4 参是类型 0..29,不是文件名里的数字。zhuandan32/33 改了也不会被当前启动加载。恢复备份后重启。
权重
Rate 是相对权重,累加成半开区间。不要把单行 Rate 当成百分率。暗箱样本总权重不是 100 万。
未加载文件
boxdroplist_zhuandan32.txt 与 boxdroplist_zhuandan33.txt 在样本目录中,当前 InitZhuanDanDropListTable 和 Lua 类型 0..29 都没有引用。只有改源码接到某个全局后才会加载。
类型号
没有 zhuandan25。类型 24 读 zhuandan26,类型 28 读 zhuandan31,类型 29 读 zhuandan30。类型 16/17 的全局名是 g_DripList_*。
打开接口见 DarkBoxItemDropRandom、JuBaoContainerItemDropRandom、BaibaoshuxiaItemDropItem、ZhuanDanItemDropRandom。
关联与依据
Server/ZhuandanBase.txt · Server/ZhuandanOutput.txt · Server/MonsterDropBoxs.txt · Server/DropBoxContent.txt · Public/CommonItem.txt
其他配置及整理状态 · 服务端外网设置 · Lua 接口索引
Server/Server/GameServer/Server/Main/GameTable.cpp:实际加载、解析、字段使用或示例关联依据Server/Server/GameServer/Server/Main/GameTable.h:实际加载、解析、字段使用或示例关联依据Server/Server/GameServer/Server/Script/LuaFnTbl_Misc.h:实际加载、解析、字段使用或示例关联依据Server/Server/GameServer/Server/Script/LuaFnRegister.cpp:实际加载、解析、字段使用或示例关联依据Common/DataBase/TLBB_DBC.cpp:实际加载、解析、字段使用或示例关联依据Common/DataBase/TLBB_DBC.h:实际加载、解析、字段使用或示例关联依据resources/Public/Data/Script/obj/item/JuBaoPen.lua:实际加载、解析、字段使用或示例关联依据resources/Public/Data/Script/obj/item/JuBaoPing.lua:实际加载、解析、字段使用或示例关联依据resources/Public/Data/Script/obj/item/baibaoshuxia.lua:实际加载、解析、字段使用或示例关联依据resources/Public/Data/Script/obj/item/zhuandan_XuanMuYinDan.lua:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_jubao.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_baibaoshuxia.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandan1.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandan2.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandan3.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandan4.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandan5.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandan6.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandansl.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandantl.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandanem.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandanwd.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandanxy.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandants.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandanmj.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandangb.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandanxx.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandan16.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandan17.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandan18.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandan19.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandan20.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandan21.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandan22.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandan23.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandan24.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandan26.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandan27.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandan28.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandan29.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandan31.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandan30.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandan32.txt:实际加载、解析、字段使用或示例关联依据resources/Server/Config/boxdroplist_zhuandan33.txt:实际加载、解析、字段使用或示例关联依据
原始 DBC 与三类加载器隔离测试,覆盖暗箱、聚宝盆、百宝书匣、转丹类型 0 与类型 16。Lua 随机开箱未在游戏中执行。