表结构
id | type | weight | attachments | gm |
1 | chest_normal | 5 | [{"name": "shard_1", "number": 1}] | 0 |
2 | chest_normal | 5 | [{"name": "shard_2", "number": 1}] | 0 |
3 | chest_adv | 5 | [{"name": "shard_1", "number": 1}] | 0 |
4 | chest_adv | 5 | [{"name": "shard_2", "number": 1}] | 0 |
5 | chest_adv | 1 | [{"name": "hero_1", "number": 1}] | 1 |
6 | chest_adv | 1 | [{"name": "hero_2", "number": 1}] | 1 |
type:抽奖类型
weight:权重
attachments:奖品
gm:是否是保底
weight:权重
attachments:奖品
gm:是否是保底
普通宝箱抽奖就如同type =chest_normal普通宝箱这一种,只能得到碎片,没有保底,利用权重来抽。
如果是需要十连抽并且保底的,就如同type =chest_adv高级宝箱这种,10连抽必定得到一个英雄。
实现方式
先从表中找到type =chest_adv 的配置,也就是id:3-6行
按照权重,抽10次,之后检查保底是否达到。
如果没有达到,则从type =chest_adv且gm=1中进行抽取,然后替换掉一个非保底项目。反复抽取直到达到保底。
如果是需要十连抽并且保底的,就如同type =chest_adv高级宝箱这种,10连抽必定得到一个英雄。
实现方式
先从表中找到type =chest_adv 的配置,也就是id:3-6行按照权重,抽10次,之后检查保底是否达到。
如果没有达到,则从type =chest_adv且gm=1中进行抽取,然后替换掉一个非保底项目。反复抽取直到达到保底。