buff掉落配置调整
This commit is contained in:
parent
ddd0dd5b5d
commit
11837949b4
@ -2,96 +2,64 @@
|
||||
{
|
||||
"Id": 1,
|
||||
"GroupId": 100001,
|
||||
"GroupType": 1,
|
||||
"SubGroupWt": 1000,
|
||||
"SubGroupId": 1001,
|
||||
"SubGroupType": 1,
|
||||
"buffID": 251023111,
|
||||
"SubGroupNum": 3,
|
||||
"GroupNum": 3,
|
||||
"BuffWt": 50,
|
||||
"TypeWt": 60
|
||||
},
|
||||
{
|
||||
"Id": 2,
|
||||
"GroupId": 100001,
|
||||
"GroupType": 1,
|
||||
"SubGroupWt": 0,
|
||||
"SubGroupId": 1001,
|
||||
"SubGroupType": 0,
|
||||
"buffID": 251023112,
|
||||
"SubGroupNum": 0,
|
||||
"GroupNum": 0,
|
||||
"BuffWt": 50,
|
||||
"TypeWt": 60
|
||||
},
|
||||
{
|
||||
"Id": 3,
|
||||
"GroupId": 100001,
|
||||
"GroupType": 1,
|
||||
"SubGroupWt": 0,
|
||||
"SubGroupId": 1001,
|
||||
"SubGroupType": 0,
|
||||
"buffID": 200000001,
|
||||
"SubGroupNum": 0,
|
||||
"GroupNum": 0,
|
||||
"BuffWt": 50,
|
||||
"TypeWt": 60
|
||||
},
|
||||
{
|
||||
"Id": 4,
|
||||
"GroupId": 100001,
|
||||
"GroupType": 1,
|
||||
"SubGroupWt": 0,
|
||||
"SubGroupId": 1001,
|
||||
"SubGroupType": 0,
|
||||
"buffID": 200000002,
|
||||
"SubGroupNum": 0,
|
||||
"GroupNum": 0,
|
||||
"BuffWt": 50,
|
||||
"TypeWt": 60
|
||||
},
|
||||
{
|
||||
"Id": 5,
|
||||
"GroupId": 100002,
|
||||
"GroupType": 2,
|
||||
"SubGroupWt": 1000,
|
||||
"SubGroupId": 1001,
|
||||
"SubGroupType": 1,
|
||||
"GroupId": 100001,
|
||||
"buffID": 253005111,
|
||||
"SubGroupNum": 2,
|
||||
"GroupNum": 0,
|
||||
"BuffWt": 50,
|
||||
"TypeWt": 60
|
||||
},
|
||||
{
|
||||
"Id": 6,
|
||||
"GroupId": 100002,
|
||||
"GroupType": 0,
|
||||
"SubGroupWt": 0,
|
||||
"SubGroupId": 1001,
|
||||
"SubGroupType": 0,
|
||||
"GroupId": 100001,
|
||||
"buffID": 253005112,
|
||||
"SubGroupNum": 0,
|
||||
"GroupNum": 0,
|
||||
"BuffWt": 50,
|
||||
"TypeWt": 60
|
||||
},
|
||||
{
|
||||
"Id": 7,
|
||||
"GroupId": 100002,
|
||||
"GroupType": 0,
|
||||
"SubGroupWt": 1000,
|
||||
"SubGroupId": 1002,
|
||||
"SubGroupType": 2,
|
||||
"GroupId": 100001,
|
||||
"buffID": 225002011,
|
||||
"SubGroupNum": 1,
|
||||
"GroupNum": 0,
|
||||
"BuffWt": 500,
|
||||
"TypeWt": 600
|
||||
},
|
||||
{
|
||||
"Id": 8,
|
||||
"GroupId": 100002,
|
||||
"GroupType": 0,
|
||||
"SubGroupWt": 0,
|
||||
"SubGroupId": 1002,
|
||||
"SubGroupType": 0,
|
||||
"GroupId": 100001,
|
||||
"buffID": 225002012,
|
||||
"SubGroupNum": 0,
|
||||
"GroupNum": 0,
|
||||
"BuffWt": 500,
|
||||
"TypeWt": 600
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
[
|
||||
{
|
||||
"BuffId": 143006310,
|
||||
"BuffId": 125004311,
|
||||
"BuffGroupId": 1001,
|
||||
"Type": 1,
|
||||
"SkillId": 143006311,
|
||||
"SkillId": 125004311,
|
||||
"BuffLevel": 1,
|
||||
"Quality": 1,
|
||||
"BuffIcon": "",
|
||||
@ -23,7 +23,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"BuffId": 125004310,
|
||||
"BuffId": 125004312,
|
||||
"BuffGroupId": 1001,
|
||||
"Type": 1,
|
||||
"SkillId": 125004311,
|
||||
@ -46,9 +46,9 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"BuffId": 135006210,
|
||||
"BuffId": 135006211,
|
||||
"BuffGroupId": 1002,
|
||||
"Type": 2,
|
||||
"Type": 1,
|
||||
"SkillId": 135006211,
|
||||
"BuffLevel": 1,
|
||||
"Quality": 2,
|
||||
@ -69,10 +69,10 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"BuffId": 135006310,
|
||||
"BuffId": 135006212,
|
||||
"BuffGroupId": 1002,
|
||||
"Type": 2,
|
||||
"SkillId": 135006311,
|
||||
"Type": 1,
|
||||
"SkillId": 135006211,
|
||||
"BuffLevel": 2,
|
||||
"Quality": 2,
|
||||
"BuffIcon": "",
|
||||
@ -92,10 +92,10 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"BuffId": 144004310,
|
||||
"BuffId": 135006311,
|
||||
"BuffGroupId": 1003,
|
||||
"Type": 3,
|
||||
"SkillId": 144004311,
|
||||
"Type": 2,
|
||||
"SkillId": 135006311,
|
||||
"BuffLevel": 1,
|
||||
"Quality": 1,
|
||||
"BuffIcon": "",
|
||||
@ -115,10 +115,10 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"BuffId": 124006310,
|
||||
"BuffId": 135006312,
|
||||
"BuffGroupId": 1003,
|
||||
"Type": 3,
|
||||
"SkillId": 124006311,
|
||||
"Type": 2,
|
||||
"SkillId": 135006311,
|
||||
"BuffLevel": 2,
|
||||
"Quality": 1,
|
||||
"BuffIcon": "",
|
||||
@ -138,10 +138,10 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"BuffId": 144002310,
|
||||
"BuffId": 144004311,
|
||||
"BuffGroupId": 1004,
|
||||
"Type": 4,
|
||||
"SkillId": 144002311,
|
||||
"Type": 2,
|
||||
"SkillId": 144004311,
|
||||
"BuffLevel": 1,
|
||||
"Quality": 2,
|
||||
"BuffIcon": "",
|
||||
@ -161,10 +161,10 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"BuffId": 151513210,
|
||||
"BuffId": 144004312,
|
||||
"BuffGroupId": 1004,
|
||||
"Type": 4,
|
||||
"SkillId": 151513211,
|
||||
"Type": 2,
|
||||
"SkillId": 144004311,
|
||||
"BuffLevel": 2,
|
||||
"Quality": 2,
|
||||
"BuffIcon": "",
|
||||
@ -184,10 +184,10 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"BuffId": 143002310,
|
||||
"BuffId": 124006311,
|
||||
"BuffGroupId": 1005,
|
||||
"Type": 4,
|
||||
"SkillId": 143002311,
|
||||
"Type": 3,
|
||||
"SkillId": 124006311,
|
||||
"BuffLevel": 1,
|
||||
"Quality": 3,
|
||||
"BuffIcon": "",
|
||||
@ -207,10 +207,10 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"BuffId": 115005310,
|
||||
"BuffId": 124006312,
|
||||
"BuffGroupId": 1005,
|
||||
"Type": 4,
|
||||
"SkillId": 115005311,
|
||||
"Type": 3,
|
||||
"SkillId": 124006311,
|
||||
"BuffLevel": 2,
|
||||
"Quality": 3,
|
||||
"BuffIcon": "",
|
||||
@ -229,48 +229,234 @@
|
||||
"n": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"BuffId": 144002311,
|
||||
"BuffGroupId": 1006,
|
||||
"Type": 3,
|
||||
"SkillId": 144002311,
|
||||
"BuffLevel": 1,
|
||||
"Quality": 1,
|
||||
"BuffIcon": "",
|
||||
"BuffStory": {
|
||||
"key": "stonehenge_buffconfig_BuffStory_11",
|
||||
"text": "描述描述描述11"
|
||||
},
|
||||
"BuffUpgradeCost": {
|
||||
"a": "atn",
|
||||
"t": "10000002",
|
||||
"n": 20
|
||||
},
|
||||
"BuffSell": {
|
||||
"a": "atn",
|
||||
"t": "10000002",
|
||||
"n": 20
|
||||
}
|
||||
},
|
||||
{
|
||||
"BuffId": 144002312,
|
||||
"BuffGroupId": 1006,
|
||||
"Type": 3,
|
||||
"SkillId": 144002311,
|
||||
"BuffLevel": 2,
|
||||
"Quality": 1,
|
||||
"BuffIcon": "",
|
||||
"BuffStory": {
|
||||
"key": "stonehenge_buffconfig_BuffStory_12",
|
||||
"text": "描述描述描述12"
|
||||
},
|
||||
"BuffUpgradeCost": {
|
||||
"a": "atn",
|
||||
"t": "10000002",
|
||||
"n": 21
|
||||
},
|
||||
"BuffSell": {
|
||||
"a": "atn",
|
||||
"t": "10000002",
|
||||
"n": 21
|
||||
}
|
||||
},
|
||||
{
|
||||
"BuffId": 151513211,
|
||||
"BuffGroupId": 1007,
|
||||
"Type": 4,
|
||||
"SkillId": 151513211,
|
||||
"BuffLevel": 1,
|
||||
"Quality": 2,
|
||||
"BuffIcon": "",
|
||||
"BuffStory": {
|
||||
"key": "stonehenge_buffconfig_BuffStory_13",
|
||||
"text": "描述描述描述13"
|
||||
},
|
||||
"BuffUpgradeCost": {
|
||||
"a": "atn",
|
||||
"t": "10000002",
|
||||
"n": 22
|
||||
},
|
||||
"BuffSell": {
|
||||
"a": "atn",
|
||||
"t": "10000002",
|
||||
"n": 22
|
||||
}
|
||||
},
|
||||
{
|
||||
"BuffId": 151513212,
|
||||
"BuffGroupId": 1007,
|
||||
"Type": 4,
|
||||
"SkillId": 151513211,
|
||||
"BuffLevel": 2,
|
||||
"Quality": 2,
|
||||
"BuffIcon": "",
|
||||
"BuffStory": {
|
||||
"key": "stonehenge_buffconfig_BuffStory_14",
|
||||
"text": "描述描述描述14"
|
||||
},
|
||||
"BuffUpgradeCost": {
|
||||
"a": "atn",
|
||||
"t": "10000002",
|
||||
"n": 23
|
||||
},
|
||||
"BuffSell": {
|
||||
"a": "atn",
|
||||
"t": "10000002",
|
||||
"n": 23
|
||||
}
|
||||
},
|
||||
{
|
||||
"BuffId": 143002311,
|
||||
"BuffGroupId": 1005,
|
||||
"Type": 1,
|
||||
"BuffGroupId": 1008,
|
||||
"Type": 4,
|
||||
"SkillId": 143002311,
|
||||
"BuffLevel": 1,
|
||||
"Quality": 3,
|
||||
"Quality": 1,
|
||||
"BuffIcon": "",
|
||||
"BuffStory": {
|
||||
"key": "stonehenge_buffconfig_BuffStory_9",
|
||||
"text": "描述描述描述9"
|
||||
"key": "stonehenge_buffconfig_BuffStory_15",
|
||||
"text": "描述描述描述15"
|
||||
},
|
||||
"BuffUpgradeCost": {
|
||||
"a": "attr",
|
||||
"t": "gold",
|
||||
"n": 8
|
||||
"a": "atn",
|
||||
"t": "10000002",
|
||||
"n": 24
|
||||
},
|
||||
"BuffSell": {
|
||||
"a": "attr",
|
||||
"t": "gold",
|
||||
"n": 9
|
||||
"a": "atn",
|
||||
"t": "10000002",
|
||||
"n": 24
|
||||
}
|
||||
},
|
||||
{
|
||||
"BuffId": 143002312,
|
||||
"BuffGroupId": 1008,
|
||||
"Type": 4,
|
||||
"SkillId": 143002311,
|
||||
"BuffLevel": 2,
|
||||
"Quality": 1,
|
||||
"BuffIcon": "",
|
||||
"BuffStory": {
|
||||
"key": "stonehenge_buffconfig_BuffStory_16",
|
||||
"text": "描述描述描述16"
|
||||
},
|
||||
"BuffUpgradeCost": {
|
||||
"a": "atn",
|
||||
"t": "10000002",
|
||||
"n": 25
|
||||
},
|
||||
"BuffSell": {
|
||||
"a": "atn",
|
||||
"t": "10000002",
|
||||
"n": 25
|
||||
}
|
||||
},
|
||||
{
|
||||
"BuffId": 115005311,
|
||||
"BuffGroupId": 1005,
|
||||
"Type": 1,
|
||||
"BuffGroupId": 1009,
|
||||
"Type": 4,
|
||||
"SkillId": 115005311,
|
||||
"BuffLevel": 1,
|
||||
"Quality": 2,
|
||||
"BuffIcon": "",
|
||||
"BuffStory": {
|
||||
"key": "stonehenge_buffconfig_BuffStory_17",
|
||||
"text": "描述描述描述17"
|
||||
},
|
||||
"BuffUpgradeCost": {
|
||||
"a": "atn",
|
||||
"t": "10000002",
|
||||
"n": 26
|
||||
},
|
||||
"BuffSell": {
|
||||
"a": "atn",
|
||||
"t": "10000002",
|
||||
"n": 26
|
||||
}
|
||||
},
|
||||
{
|
||||
"BuffId": 115005312,
|
||||
"BuffGroupId": 1009,
|
||||
"Type": 4,
|
||||
"SkillId": 115005311,
|
||||
"BuffLevel": 2,
|
||||
"Quality": 2,
|
||||
"BuffIcon": "",
|
||||
"BuffStory": {
|
||||
"key": "stonehenge_buffconfig_BuffStory_18",
|
||||
"text": "描述描述描述18"
|
||||
},
|
||||
"BuffUpgradeCost": {
|
||||
"a": "atn",
|
||||
"t": "10000002",
|
||||
"n": 27
|
||||
},
|
||||
"BuffSell": {
|
||||
"a": "atn",
|
||||
"t": "10000002",
|
||||
"n": 27
|
||||
}
|
||||
},
|
||||
{
|
||||
"BuffId": 143006311,
|
||||
"BuffGroupId": 1010,
|
||||
"Type": 4,
|
||||
"SkillId": 143006311,
|
||||
"BuffLevel": 1,
|
||||
"Quality": 3,
|
||||
"BuffIcon": "",
|
||||
"BuffStory": {
|
||||
"key": "stonehenge_buffconfig_BuffStory_19",
|
||||
"text": "描述描述描述19"
|
||||
},
|
||||
"BuffUpgradeCost": {
|
||||
"a": "atn",
|
||||
"t": "10000002",
|
||||
"n": 28
|
||||
},
|
||||
"BuffSell": {
|
||||
"a": "atn",
|
||||
"t": "10000002",
|
||||
"n": 28
|
||||
}
|
||||
},
|
||||
{
|
||||
"BuffId": 143006312,
|
||||
"BuffGroupId": 1010,
|
||||
"Type": 4,
|
||||
"SkillId": 143006311,
|
||||
"BuffLevel": 2,
|
||||
"Quality": 3,
|
||||
"BuffIcon": "",
|
||||
"BuffStory": {
|
||||
"key": "stonehenge_buffconfig_BuffStory_10",
|
||||
"text": "描述描述描述10"
|
||||
"key": "stonehenge_buffconfig_BuffStory_20",
|
||||
"text": "描述描述描述20"
|
||||
},
|
||||
"BuffUpgradeCost": {
|
||||
"a": "attr",
|
||||
"t": "gold",
|
||||
"n": 9
|
||||
"a": "atn",
|
||||
"t": "10000002",
|
||||
"n": 29
|
||||
},
|
||||
"BuffSell": {
|
||||
"a": "attr",
|
||||
"t": "gold",
|
||||
"n": 10
|
||||
"a": "atn",
|
||||
"t": "10000002",
|
||||
"n": 29
|
||||
}
|
||||
}
|
||||
]
|
@ -60,18 +60,7 @@ type configureComp struct {
|
||||
SNumE map[int64]int32 // 小组产出数量
|
||||
|
||||
// buff 随机
|
||||
_group map[int64][]int32 // key 小组ID value cid
|
||||
// 类型为1 的数据 该大组中的小组为权重掉落,必定从N个小组中随机出1个小组
|
||||
_lotteryType1 map[int32][]int32 // key 大组ID value cid
|
||||
// 类型为2 的数据 有多个小组ID
|
||||
_lotteryType2 map[int32][]int32 // key 大组ID value 小组ID
|
||||
// 小组类型为1
|
||||
_groupType1 map[int64][]int32 //value cid
|
||||
// 小组类型为2
|
||||
_groupType2 map[int64][]int32 //value cid
|
||||
Btype map[int32]int32
|
||||
Stype map[int64]int32 // subtype
|
||||
SNum map[int64]int32 // 小组产出数量
|
||||
buffLottery map[int32]map[int32]*cfg.GameBufflotteryData
|
||||
}
|
||||
|
||||
//组件初始化接口
|
||||
@ -458,52 +447,23 @@ func (this *configureComp) GetRoomGroupDataByLottery(lotteryId int32) (buff []in
|
||||
|
||||
func (this *configureComp) LoadBUffGroupData() {
|
||||
if v, err := this.GetConfigure(game_bufflottery); err == nil {
|
||||
this.hlock.Lock()
|
||||
defer this.hlock.Unlock()
|
||||
this.buffLottery = make(map[int32]map[int32]*cfg.GameBufflotteryData, 0)
|
||||
if configure, ok := v.(*cfg.GameBufflottery); ok {
|
||||
this.hlock.Lock()
|
||||
defer this.hlock.Unlock()
|
||||
this._group = make(map[int64][]int32, 0)
|
||||
this._lotteryType1 = make(map[int32][]int32, 0)
|
||||
this._lotteryType2 = make(map[int32][]int32, 0)
|
||||
this._groupType1 = make(map[int64][]int32, 0)
|
||||
this._groupType2 = make(map[int64][]int32, 0)
|
||||
this.Btype = make(map[int32]int32, 0)
|
||||
this.Stype = make(map[int64]int32, 0)
|
||||
this.SNum = make(map[int64]int32, 0)
|
||||
|
||||
for _, value := range configure.GetDataList() {
|
||||
|
||||
key := int64(value.GroupId)<<31 + int64(value.SubGroupId)
|
||||
this._group[key] = append(this._group[key], value.Id)
|
||||
|
||||
if _, ok := this.Btype[value.GroupId]; !ok {
|
||||
this.Btype[value.GroupId] = value.GroupType
|
||||
}
|
||||
|
||||
if _, ok := this.Stype[key]; !ok {
|
||||
this.Stype[key] = value.SubGroupType
|
||||
}
|
||||
if _, ok := this.SNum[key]; !ok {
|
||||
this.SNum[key] = value.SubGroupNum
|
||||
}
|
||||
if this.Btype[value.GroupId] == 1 {
|
||||
this._lotteryType1[value.GroupId] = append(this._lotteryType1[value.GroupId], value.Id)
|
||||
} else if this.Btype[value.GroupId] == 2 {
|
||||
this._lotteryType2[value.GroupId] = append(this._lotteryType2[value.GroupId], value.Id)
|
||||
}
|
||||
|
||||
if this.Stype[key] == 1 { // 小组ID为1
|
||||
this._groupType1[key] = append(this._groupType1[key], value.Id)
|
||||
} else if this.Stype[key] == 2 {
|
||||
this._groupType2[key] = append(this._groupType2[key], value.Id)
|
||||
for _, v := range configure.GetDataList() {
|
||||
if _, ok := this.buffLottery[v.GroupId]; !ok {
|
||||
this.buffLottery[v.GroupId] = make(map[int32]*cfg.GameBufflotteryData)
|
||||
}
|
||||
this.buffLottery[v.GroupId][v.BuffID] = v
|
||||
}
|
||||
return
|
||||
}
|
||||
} else {
|
||||
log.Errorf("get NewGameBufflottery conf err:%v", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (this *configureComp) GetLotterConfById(id int32) (data *cfg.GameBufflotteryData) {
|
||||
if v, err := this.GetConfigure(game_bufflottery); err == nil {
|
||||
if configure, ok := v.(*cfg.GameBufflottery); ok {
|
||||
@ -515,141 +475,6 @@ func (this *configureComp) GetLotterConfById(id int32) (data *cfg.GameBufflotter
|
||||
|
||||
// 实际掉落逻辑 (传入 掉落组ID vip等级 玩家等级 返回获得的道具)
|
||||
func (this *configureComp) GetBuffGroupDataByLottery(lotteryId int32, addType int32) (buff []int32) {
|
||||
|
||||
if _, ok := this._lotteryType1[lotteryId]; !ok {
|
||||
if _, ok := this._lotteryType2[lotteryId]; !ok {
|
||||
fmt.Printf("not found config lotterId:%d", lotteryId)
|
||||
return
|
||||
}
|
||||
}
|
||||
// 优先校验大组ID 的类型
|
||||
if this.Btype[lotteryId] == 1 { // 该大组中的小组为权重掉落,必定从N个小组中随机出1个小组
|
||||
var (
|
||||
szW []int32 // 权重数组
|
||||
szID []int32 // 小组ID 数组
|
||||
groupID int32
|
||||
gourp map[int32]int32 // key 小组ID value 权重
|
||||
)
|
||||
|
||||
gourp = make(map[int32]int32, 0)
|
||||
// 随机小组id
|
||||
for _, v := range this._lotteryType1[lotteryId] {
|
||||
if _data := this.GetLotterConfById(v); _data != nil {
|
||||
if _, ok := gourp[_data.SubGroupId]; !ok {
|
||||
gourp[_data.SubGroupId] = _data.SubGroupWt // 小组ID 权重赋值
|
||||
szW = append(szW, _data.SubGroupWt)
|
||||
szID = append(szID, _data.SubGroupId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
groupID = szID[comm.GetRandW(szW)] // 获得小组ID
|
||||
//fmt.Printf("大组类型为1的,获得小组ID :%d,dropID:%d", groupID, lotteryId)
|
||||
key := int64(lotteryId)<<31 + int64(groupID)
|
||||
// 小组ID 类型判断
|
||||
if this.Stype[key] == 1 { // 该小组的道具为权重掉落,必定从N个道具中随机出1个道具
|
||||
for i := 0; i < int(this.SNum[key]); i++ {
|
||||
szW = make([]int32, 0)
|
||||
szID = make([]int32, 0)
|
||||
gourp = make(map[int32]int32, 0)
|
||||
for _, v := range this._groupType1[key] {
|
||||
if _data := this.GetLotterConfById(v); _data != nil { // 权重赋值
|
||||
curWt := _data.BuffWt
|
||||
if _, ok := gourp[_data.SubGroupId]; !ok {
|
||||
if buf, ok := this.buff[addType]; ok {
|
||||
if _, ok := buf[_data.BuffID]; ok {
|
||||
curWt += _data.TypeWt
|
||||
}
|
||||
}
|
||||
szW = append(szW, curWt)
|
||||
szID = append(szID, _data.Id)
|
||||
}
|
||||
}
|
||||
}
|
||||
index := comm.GetRandW(szW)
|
||||
_data := this.GetLotterConfById(szID[index])
|
||||
buff = append(buff, _data.BuffID)
|
||||
}
|
||||
return
|
||||
} else if this.Stype[key] == 2 { // 该小组中的道具为概率掉落,每个道具都会随机一次是否会掉落(单位为千分比)
|
||||
var wt int32
|
||||
for _, v := range this._groupType2[key] {
|
||||
if _data := this.GetLotterConfById(v); _data != nil { // 权重赋值
|
||||
if _data.SubGroupWt != 0 {
|
||||
wt = _data.SubGroupWt
|
||||
}
|
||||
//fmt.Printf("大组类型1小组类型2获得道具 :%v, 该道具Cid:%d", _data.Itemid, v)
|
||||
if wt >= comm.GetRandNum(0, 1000) { // 命中
|
||||
buff = append(buff, _data.BuffID)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
} else if this.Btype[lotteryId] == 2 { // 该大组中的小组为概率掉落,每个小组都会随机一次是否会掉落(单位为千分比)
|
||||
// 每个小组id 都随机取一次
|
||||
var szGroupID []int32 // 获得的权重数组
|
||||
gourp := make([]*cfg.GameBufflotteryData, 0) // key 小组ID value 权重
|
||||
for _, v := range this._lotteryType2[lotteryId] {
|
||||
if _data := this.GetLotterConfById(v); _data != nil {
|
||||
gourp = append(gourp, _data)
|
||||
}
|
||||
}
|
||||
var wt int32
|
||||
// 类型为2 可能会同时获得多个组id
|
||||
for _, v := range gourp {
|
||||
if v.SubGroupWt != 0 {
|
||||
wt = v.SubGroupWt
|
||||
}
|
||||
k := v.SubGroupId
|
||||
//fmt.Printf("大组类型为2的,获得小组ID :%d,dropID:%d", k, v.Id)
|
||||
if wt >= comm.GetRandNum(0, 1000) { // 命中
|
||||
szGroupID = append(szGroupID, k)
|
||||
key := int64(lotteryId)<<31 + int64(k)
|
||||
if this.Stype[key] == 1 { // 随机一组数据
|
||||
for i := 0; i < int(this.SNum[key]); i++ {
|
||||
szW := make([]int32, 0)
|
||||
szID := make([]int32, 0)
|
||||
gourp := make(map[int32]int32, 0)
|
||||
for _, v := range this._groupType1[key] {
|
||||
if _data := this.GetLotterConfById(v); _data != nil { // 权重赋值
|
||||
curWt := _data.BuffWt
|
||||
if _, ok := gourp[_data.SubGroupId]; !ok {
|
||||
if buf, ok := this.buff[addType]; ok {
|
||||
if _, ok := buf[_data.BuffID]; ok {
|
||||
curWt += _data.TypeWt
|
||||
}
|
||||
}
|
||||
szW = append(szW, curWt)
|
||||
szID = append(szID, _data.Id)
|
||||
}
|
||||
}
|
||||
}
|
||||
index := comm.GetRandW(szW)
|
||||
_data := this.GetLotterConfById(szID[index])
|
||||
buff = append(buff, _data.BuffID)
|
||||
}
|
||||
} else if this.Stype[key] == 2 {
|
||||
for _, v := range this._groupType2[key] {
|
||||
var wt int32
|
||||
if _data := this.GetLotterConfById(v); _data != nil { // 权重赋值
|
||||
if _data.BuffWt != 0 {
|
||||
if buf, ok := this.buff[addType]; ok {
|
||||
if _, ok := buf[_data.BuffID]; ok {
|
||||
wt += _data.TypeWt
|
||||
}
|
||||
}
|
||||
wt += _data.BuffWt
|
||||
}
|
||||
if wt >= comm.GetRandNum(0, 1000) { // 命中
|
||||
buff = append(buff, _data.BuffID)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -13,12 +13,8 @@ import "errors"
|
||||
type GameBufflotteryData struct {
|
||||
Id int32
|
||||
GroupId int32
|
||||
GroupType int32
|
||||
SubGroupWt int32
|
||||
SubGroupId int32
|
||||
SubGroupType int32
|
||||
BuffID int32
|
||||
SubGroupNum int32
|
||||
GroupNum int32
|
||||
BuffWt int32
|
||||
TypeWt int32
|
||||
}
|
||||
@ -32,12 +28,8 @@ func (*GameBufflotteryData) GetTypeId() int32 {
|
||||
func (_v *GameBufflotteryData)Deserialize(_buf map[string]interface{}) (err error) {
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["Id"].(float64); !_ok_ { err = errors.New("Id error"); return }; _v.Id = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["GroupId"].(float64); !_ok_ { err = errors.New("GroupId error"); return }; _v.GroupId = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["GroupType"].(float64); !_ok_ { err = errors.New("GroupType error"); return }; _v.GroupType = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["SubGroupWt"].(float64); !_ok_ { err = errors.New("SubGroupWt error"); return }; _v.SubGroupWt = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["SubGroupId"].(float64); !_ok_ { err = errors.New("SubGroupId error"); return }; _v.SubGroupId = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["SubGroupType"].(float64); !_ok_ { err = errors.New("SubGroupType error"); return }; _v.SubGroupType = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["buffID"].(float64); !_ok_ { err = errors.New("buffID error"); return }; _v.BuffID = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["SubGroupNum"].(float64); !_ok_ { err = errors.New("SubGroupNum error"); return }; _v.SubGroupNum = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["GroupNum"].(float64); !_ok_ { err = errors.New("GroupNum error"); return }; _v.GroupNum = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["BuffWt"].(float64); !_ok_ { err = errors.New("BuffWt error"); return }; _v.BuffWt = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["TypeWt"].(float64); !_ok_ { err = errors.New("TypeWt error"); return }; _v.TypeWt = int32(_tempNum_) }
|
||||
return
|
||||
|
@ -14,6 +14,7 @@ type GameStroneBuffData struct {
|
||||
BuffId int32
|
||||
BuffGroupId int32
|
||||
Type int32
|
||||
SkillId int32
|
||||
BuffLevel int32
|
||||
Quality int32
|
||||
BuffIcon string
|
||||
@ -32,6 +33,7 @@ func (_v *GameStroneBuffData)Deserialize(_buf map[string]interface{}) (err error
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["BuffId"].(float64); !_ok_ { err = errors.New("BuffId error"); return }; _v.BuffId = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["BuffGroupId"].(float64); !_ok_ { err = errors.New("BuffGroupId error"); return }; _v.BuffGroupId = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["Type"].(float64); !_ok_ { err = errors.New("Type error"); return }; _v.Type = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["SkillId"].(float64); !_ok_ { err = errors.New("SkillId error"); return }; _v.SkillId = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["BuffLevel"].(float64); !_ok_ { err = errors.New("BuffLevel error"); return }; _v.BuffLevel = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["Quality"].(float64); !_ok_ { err = errors.New("Quality error"); return }; _v.Quality = int32(_tempNum_) }
|
||||
{ var _ok_ bool; if _v.BuffIcon, _ok_ = _buf["BuffIcon"].(string); !_ok_ { err = errors.New("BuffIcon error"); return } }
|
||||
|
@ -12,8 +12,8 @@ import "errors"
|
||||
|
||||
type GameTrendChoseData struct {
|
||||
Key int32
|
||||
Lv int32
|
||||
TaskstarID int32
|
||||
Lv int32
|
||||
TaskendID int32
|
||||
Npc []string
|
||||
Chosetxt string
|
||||
@ -22,6 +22,7 @@ type GameTrendChoseData struct {
|
||||
Get []*Gameatn
|
||||
Lose []*Gameatn
|
||||
Jump int32
|
||||
Num int32
|
||||
}
|
||||
|
||||
const TypeId_GameTrendChoseData = -2145177947
|
||||
@ -32,8 +33,8 @@ func (*GameTrendChoseData) GetTypeId() int32 {
|
||||
|
||||
func (_v *GameTrendChoseData)Deserialize(_buf map[string]interface{}) (err error) {
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["key"].(float64); !_ok_ { err = errors.New("key error"); return }; _v.Key = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["lv"].(float64); !_ok_ { err = errors.New("lv error"); return }; _v.Lv = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["taskstarID"].(float64); !_ok_ { err = errors.New("taskstarID error"); return }; _v.TaskstarID = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["lv"].(float64); !_ok_ { err = errors.New("lv error"); return }; _v.Lv = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["taskendID"].(float64); !_ok_ { err = errors.New("taskendID error"); return }; _v.TaskendID = int32(_tempNum_) }
|
||||
{
|
||||
var _arr_ []interface{}
|
||||
@ -81,6 +82,7 @@ func (_v *GameTrendChoseData)Deserialize(_buf map[string]interface{}) (err error
|
||||
}
|
||||
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["jump"].(float64); !_ok_ { err = errors.New("jump error"); return }; _v.Jump = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["num"].(float64); !_ok_ { err = errors.New("num error"); return }; _v.Num = int32(_tempNum_) }
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user