秘境掉落优化

This commit is contained in:
meixiongfeng 2023-08-14 14:56:56 +08:00
parent 5bfa66a65d
commit f58b616c29
7 changed files with 802 additions and 562 deletions

View File

@ -10435,6 +10435,228 @@
],
"expitemnum": 7
},
{
"hid": "54018",
"name": {
"key": "hero_main_name_54018",
"text": "村民兔"
},
"star": 3,
"color": 2,
"race": 4,
"job": 1,
"type": 2,
"ip": 1,
"sd": 1,
"handbook": -1,
"prefab": "54017",
"rotation": "0|0|0",
"revolve": 0,
"icon": "54017",
"vocal": "54017",
"tujing": [
107
],
"detailwindow": "effect_chezhan_daiji",
"intr": {
"key": "",
"text": ""
},
"events": "hero_54005",
"cite": "",
"effectstay": [],
"hpspace": {
"x": 0,
"y": -0.69,
"z": 0
},
"capskillrule": 101,
"skill": 0,
"skill1": 0,
"skill2": 0,
"skill3": 0,
"txt": {
"key": "atlas_54018",
"text": ""
},
"enteranivalue": 0,
"camerainterval": 0,
"equiprcom": [
1,
2,
10
],
"angle": 0,
"deviation": 0,
"show": 2,
"herofrag": [
{
"a": "item",
"t": "12025001",
"n": 1
}
],
"herofragnum": 6,
"heroskillup": [
"10000004"
],
"expitem": [
{
"a": "item",
"t": "10000011",
"n": 1
}
],
"expitemnum": 7
},
{
"hid": "54019",
"name": {
"key": "hero_main_name_54019",
"text": "独眼怪人"
},
"star": 3,
"color": 2,
"race": 4,
"job": 1,
"type": 2,
"ip": 1,
"sd": 1,
"handbook": -1,
"prefab": "54017",
"rotation": "0|0|0",
"revolve": 0,
"icon": "54017",
"vocal": "54017",
"tujing": [
107
],
"detailwindow": "effect_chezhan_daiji",
"intr": {
"key": "",
"text": ""
},
"events": "hero_54005",
"cite": "",
"effectstay": [],
"hpspace": {
"x": 0,
"y": -0.69,
"z": 0
},
"capskillrule": 101,
"skill": 0,
"skill1": 0,
"skill2": 0,
"skill3": 0,
"txt": {
"key": "atlas_54019",
"text": ""
},
"enteranivalue": 0,
"camerainterval": 0,
"equiprcom": [
1,
2,
10
],
"angle": 0,
"deviation": 0,
"show": 2,
"herofrag": [
{
"a": "item",
"t": "12025001",
"n": 1
}
],
"herofragnum": 6,
"heroskillup": [
"10000004"
],
"expitem": [
{
"a": "item",
"t": "10000011",
"n": 1
}
],
"expitemnum": 7
},
{
"hid": "54020",
"name": {
"key": "hero_main_name_54020",
"text": "村民猪"
},
"star": 3,
"color": 2,
"race": 4,
"job": 1,
"type": 2,
"ip": 1,
"sd": 1,
"handbook": -1,
"prefab": "54017",
"rotation": "0|0|0",
"revolve": 0,
"icon": "54017",
"vocal": "54017",
"tujing": [
107
],
"detailwindow": "effect_chezhan_daiji",
"intr": {
"key": "",
"text": ""
},
"events": "hero_54005",
"cite": "",
"effectstay": [],
"hpspace": {
"x": 0,
"y": -0.69,
"z": 0
},
"capskillrule": 101,
"skill": 0,
"skill1": 0,
"skill2": 0,
"skill3": 0,
"txt": {
"key": "atlas_54020",
"text": ""
},
"enteranivalue": 0,
"camerainterval": 0,
"equiprcom": [
1,
2,
10
],
"angle": 0,
"deviation": 0,
"show": 2,
"herofrag": [
{
"a": "item",
"t": "12025001",
"n": 1
}
],
"herofragnum": 6,
"heroskillup": [
"10000004"
],
"expitem": [
{
"a": "item",
"t": "10000011",
"n": 1
}
],
"expitemnum": 7
},
{
"hid": "51050",
"name": {

View File

@ -18647,7 +18647,7 @@
},
"usetype": 1,
"color": 2,
"bagtype": 1,
"bagtype": 0,
"index": 1,
"special_type": 0,
"time": 0,
@ -18692,7 +18692,7 @@
},
"usetype": 1,
"color": 2,
"bagtype": 1,
"bagtype": 0,
"index": 1,
"special_type": 0,
"time": 0,
@ -18737,7 +18737,7 @@
},
"usetype": 1,
"color": 2,
"bagtype": 1,
"bagtype": 0,
"index": 1,
"special_type": 0,
"time": 0,

View File

@ -6001,7 +6001,7 @@
"RevisiParams": []
},
{
"Id": 224004011,
"Id": 213002011,
"EmitPR": 1000,
"From": 1,
"Where": [],
@ -6025,7 +6025,7 @@
"RevisiParams": []
},
{
"Id": 224004111,
"Id": 213002111,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -6040,7 +6040,7 @@
],
"FollowSK": [],
"SucFollowSK": [
224004112
213002112
],
"FailFollowSK": [],
"MustHit": false,
@ -6050,7 +6050,7 @@
"RevisiParams": []
},
{
"Id": 224004112,
"Id": 213002112,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -6074,7 +6074,7 @@
"RevisiParams": []
},
{
"Id": 224004121,
"Id": 213002121,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -6089,7 +6089,7 @@
],
"FollowSK": [],
"SucFollowSK": [
224004122
213002122
],
"FailFollowSK": [],
"MustHit": false,
@ -6099,7 +6099,7 @@
"RevisiParams": []
},
{
"Id": 224004122,
"Id": 213002122,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -6123,7 +6123,7 @@
"RevisiParams": []
},
{
"Id": 224004131,
"Id": 213002131,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -6138,7 +6138,7 @@
],
"FollowSK": [],
"SucFollowSK": [
224004132
213002132
],
"FailFollowSK": [],
"MustHit": false,
@ -6148,7 +6148,7 @@
"RevisiParams": []
},
{
"Id": 224004132,
"Id": 213002132,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -6172,7 +6172,7 @@
"RevisiParams": []
},
{
"Id": 224004141,
"Id": 213002141,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -6187,7 +6187,7 @@
],
"FollowSK": [],
"SucFollowSK": [
224004142
213002142
],
"FailFollowSK": [],
"MustHit": false,
@ -6197,7 +6197,7 @@
"RevisiParams": []
},
{
"Id": 224004142,
"Id": 213002142,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -6221,7 +6221,7 @@
"RevisiParams": []
},
{
"Id": 224004151,
"Id": 213002151,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -6236,7 +6236,7 @@
],
"FollowSK": [],
"SucFollowSK": [
224004152
213002152
],
"FailFollowSK": [],
"MustHit": false,
@ -6246,7 +6246,7 @@
"RevisiParams": []
},
{
"Id": 224004152,
"Id": 213002152,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -6270,7 +6270,7 @@
"RevisiParams": []
},
{
"Id": 224004211,
"Id": 213002211,
"EmitPR": 1000,
"From": 3,
"Where": [],
@ -6293,7 +6293,7 @@
"RevisiParams": []
},
{
"Id": 224004212,
"Id": 213002212,
"EmitPR": 1000,
"From": 9,
"Where": [],
@ -6317,7 +6317,7 @@
"RevisiParams": []
},
{
"Id": 224004311,
"Id": 213002311,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -6340,7 +6340,7 @@
"RevisiParams": []
},
{
"Id": 224004312,
"Id": 213002312,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -6364,7 +6364,7 @@
"RevisiParams": []
},
{
"Id": 224004313,
"Id": 213002313,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -6388,7 +6388,7 @@
"RevisiParams": []
},
{
"Id": 224004321,
"Id": 213002321,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -6411,7 +6411,7 @@
"RevisiParams": []
},
{
"Id": 224004331,
"Id": 213002331,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -6434,7 +6434,7 @@
"RevisiParams": []
},
{
"Id": 224004341,
"Id": 213002341,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -6457,7 +6457,7 @@
"RevisiParams": []
},
{
"Id": 224004351,
"Id": 213002351,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -6480,7 +6480,7 @@
"RevisiParams": []
},
{
"Id": 224004361,
"Id": 213002361,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -16466,7 +16466,7 @@
"RevisiParams": []
},
{
"Id": 213002111,
"Id": 224004111,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -16489,7 +16489,7 @@
"RevisiParams": []
},
{
"Id": 213002112,
"Id": 224004112,
"EmitPR": 1000,
"From": 3,
"Where": [],
@ -16498,7 +16498,7 @@
"ExecuteCnt": 1,
"Type": 2,
"Argu": [
413002111,
424004111,
-1,
-1
],
@ -16512,7 +16512,7 @@
"RevisiParams": []
},
{
"Id": 213002113,
"Id": 224004113,
"EmitPR": 1000,
"From": 3,
"Where": [],
@ -16526,7 +16526,7 @@
],
"FollowSK": [],
"SucFollowSK": [
213002113
224004113
],
"FailFollowSK": [],
"MustHit": false,
@ -16536,7 +16536,7 @@
"RevisiParams": []
},
{
"Id": 213002121,
"Id": 224004121,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -16559,7 +16559,7 @@
"RevisiParams": []
},
{
"Id": 213002131,
"Id": 224004131,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -16582,7 +16582,7 @@
"RevisiParams": []
},
{
"Id": 213002141,
"Id": 224004141,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -16605,7 +16605,7 @@
"RevisiParams": []
},
{
"Id": 213002151,
"Id": 224004151,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -16628,7 +16628,7 @@
"RevisiParams": []
},
{
"Id": 213002211,
"Id": 224004211,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -16643,7 +16643,7 @@
],
"FollowSK": [],
"SucFollowSK": [
213002212
224004212
],
"FailFollowSK": [],
"MustHit": false,
@ -16653,7 +16653,7 @@
"RevisiParams": []
},
{
"Id": 213002212,
"Id": 224004212,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -16677,7 +16677,7 @@
"RevisiParams": []
},
{
"Id": 213002221,
"Id": 224004221,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -16692,7 +16692,7 @@
],
"FollowSK": [],
"SucFollowSK": [
213002212
224004212
],
"FailFollowSK": [],
"MustHit": false,
@ -16702,7 +16702,7 @@
"RevisiParams": []
},
{
"Id": 213002231,
"Id": 224004231,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -16717,7 +16717,7 @@
],
"FollowSK": [],
"SucFollowSK": [
213002212
224004212
],
"FailFollowSK": [],
"MustHit": false,
@ -16727,7 +16727,7 @@
"RevisiParams": []
},
{
"Id": 213002241,
"Id": 224004241,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -16742,7 +16742,7 @@
],
"FollowSK": [],
"SucFollowSK": [
213002212
224004212
],
"FailFollowSK": [],
"MustHit": false,
@ -16752,7 +16752,7 @@
"RevisiParams": []
},
{
"Id": 213002251,
"Id": 224004251,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -16767,7 +16767,7 @@
],
"FollowSK": [],
"SucFollowSK": [
213002212
224004212
],
"FailFollowSK": [],
"MustHit": false,
@ -16777,7 +16777,7 @@
"RevisiParams": []
},
{
"Id": 213002311,
"Id": 224004311,
"EmitPR": 1000,
"From": 3,
"Where": [],
@ -16786,7 +16786,7 @@
"ExecuteCnt": 1,
"Type": 2,
"Argu": [
413002311,
424004311,
-1,
-1
],
@ -16800,7 +16800,7 @@
"RevisiParams": []
},
{
"Id": 213002312,
"Id": 224004312,
"EmitPR": 1000,
"From": 3,
"Where": [],
@ -16809,7 +16809,7 @@
"ExecuteCnt": 1,
"Type": 2,
"Argu": [
413002312,
424004312,
-1,
-1
],
@ -16823,7 +16823,7 @@
"RevisiParams": []
},
{
"Id": 213002313,
"Id": 224004313,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -16846,7 +16846,7 @@
"RevisiParams": []
},
{
"Id": 213002323,
"Id": 224004323,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -16869,7 +16869,7 @@
"RevisiParams": []
},
{
"Id": 213002333,
"Id": 224004333,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -16892,7 +16892,7 @@
"RevisiParams": []
},
{
"Id": 213002343,
"Id": 224004343,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -16915,7 +16915,7 @@
"RevisiParams": []
},
{
"Id": 213002353,
"Id": 224004353,
"EmitPR": 1000,
"From": 4,
"Where": [],
@ -16938,7 +16938,7 @@
"RevisiParams": []
},
{
"Id": 213002314,
"Id": 224004314,
"EmitPR": 1000,
"From": 2,
"Where": [],
@ -16961,7 +16961,7 @@
"RevisiParams": []
},
{
"Id": 213002324,
"Id": 224004324,
"EmitPR": 1000,
"From": 2,
"Where": [],
@ -16984,7 +16984,7 @@
"RevisiParams": []
},
{
"Id": 213002334,
"Id": 224004334,
"EmitPR": 1000,
"From": 2,
"Where": [],
@ -17007,7 +17007,7 @@
"RevisiParams": []
},
{
"Id": 213002344,
"Id": 224004344,
"EmitPR": 1000,
"From": 2,
"Where": [],
@ -17030,7 +17030,7 @@
"RevisiParams": []
},
{
"Id": 213002354,
"Id": 224004354,
"EmitPR": 1000,
"From": 2,
"Where": [],

File diff suppressed because it is too large Load Diff

View File

@ -417,7 +417,7 @@
"MaxEmitTimes": 0,
"MaxEmitTimesInRound": 1,
"Callback": [
224004212
213002212
]
},
{
@ -436,7 +436,7 @@
"MaxEmitTimes": 0,
"MaxEmitTimesInRound": 1,
"Callback": [
924004212
913002212
]
},
{
@ -980,7 +980,7 @@
]
},
{
"Id": 413002111,
"Id": 424004111,
"When": 10,
"FromCheck": "Target=3",
"TargetCheck": "",
@ -995,15 +995,15 @@
"MaxEmitTimes": 0,
"MaxEmitTimesInRound": 1,
"Callback": [
213002113
224004113
]
},
{
"Id": 413002311,
"Id": 424004311,
"When": 15,
"FromCheck": "Target=3",
"TargetCheck": "",
"MainSkillCheck": "MainSkillID=113002311",
"MainSkillCheck": "MainSkillID=124004311",
"AfterSkillCheck": "",
"BuffCheck": "",
"AddCon": [],
@ -1014,15 +1014,15 @@
"MaxEmitTimes": 0,
"MaxEmitTimesInRound": 1,
"Callback": [
113002312
124004312
]
},
{
"Id": 413002312,
"Id": 424004312,
"When": 15,
"FromCheck": "Target=3",
"TargetCheck": "",
"MainSkillCheck": "MainSkillID=113002312",
"MainSkillCheck": "MainSkillID=124004312",
"AfterSkillCheck": "",
"BuffCheck": "",
"AddCon": [],
@ -1033,7 +1033,7 @@
"MaxEmitTimes": 0,
"MaxEmitTimesInRound": 2,
"Callback": [
113002312
124004312
]
},
{

View File

@ -48,7 +48,7 @@ type configureComp struct {
_groupType1R map[int64][]int32 //value cid
// 小组类型为2
_groupType2R map[int64][]int32 //value cid
BtypeR map[int32]int32
//Btype map[int32]int32
StypeR map[int64]int32 // subtype
SNumR map[int64]int32 // 小组产出数量
@ -62,7 +62,6 @@ type configureComp struct {
_groupType1E map[int64][]int32 //value cid
// 小组类型为2
_groupType2E map[int64][]int32 //value cid
BtypeE map[int32]int32
StypeE map[int64]int32 // subtype
SNumE map[int64]int32 // 小组产出数量
@ -99,6 +98,8 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
configure.RegisterConfigure(game_buffconf, cfg.NewGameStoneBuff, this.LoadGameStoneBuff)
configure.RegisterConfigure(game_storyconf, cfg.NewGameStoneStory, this.LoadGameStoneStory)
this.GetEventGroupDataByLottery(0)
this.GetRoomGroupDataByLottery(16010101)
return
}
@ -112,15 +113,33 @@ func (this *configureComp) LoadEventGroupData() {
this._lotteryType2E = make(map[int32][]int32, 0)
this._groupType1E = make(map[int64][]int32, 0)
this._groupType2E = make(map[int64][]int32, 0)
this.BtypeE = make(map[int32]int32, 0)
//this.Btype = make(map[int32]int32, 0)
this.StypeE = make(map[int64]int32, 0)
this.SNumE = make(map[int64]int32, 0)
for _, value := range configure.GetDataList() {
key := int64(value.GroupId)<<31 + int64(value.SubGroupId)
this._groupE[key] = append(this._groupE[key], value.Id)
var tmp1 int64
var tmp2 int64
var itype int32
var wt int32
var subid int32
if _, ok := this.BtypeE[value.GroupId]; !ok {
this.BtypeE[value.GroupId] = value.GroupType
for _, value := range configure.GetDataList() {
if value.SubGroupId == 0 {
value.SubGroupId = subid
} else {
subid = value.SubGroupId
}
key := int64(value.GroupId)<<31 + int64(value.SubGroupId)
// key2 := int64(value.Lotteryid)<<31 + int64(value.Type)
this._groupE[key] = append(this._groupE[key], value.Id)
if value.GroupType == 0 {
value.GroupType = itype
} else {
itype = value.GroupType
}
if value.SubGroupWt == 0 {
value.SubGroupWt = wt
} else {
wt = value.SubGroupWt
}
if _, ok := this.StypeE[key]; !ok {
@ -129,10 +148,19 @@ func (this *configureComp) LoadEventGroupData() {
if _, ok := this.SNumE[key]; !ok {
this.SNumE[key] = value.SubGroupNum
}
if this.BtypeE[value.GroupId] == 1 {
if value.GroupType == 1 {
if tmp1 != key {
this._lotteryType1E[value.GroupId] = append(this._lotteryType1E[value.GroupId], value.Id)
} else if this.BtypeE[value.GroupId] == 2 {
tmp1 = key
}
}
if value.GroupType == 2 {
if tmp2 != key {
this._lotteryType2E[value.GroupId] = append(this._lotteryType2E[value.GroupId], value.Id)
tmp2 = key
}
}
if this.StypeE[key] == 1 { // 小组ID为1
@ -141,6 +169,7 @@ func (this *configureComp) LoadEventGroupData() {
this._groupType2E[key] = append(this._groupType2E[key], value.Id)
}
}
return
}
} else {
@ -167,56 +196,48 @@ func (this *configureComp) GetEventGroupDataByLottery(lotterys ...int32) (event
}
}
// 优先校验大组ID 的类型
if this.BtypeE[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._lotteryType1E[lotteryId] {
if _data := this.GetEventLotterConfById(v); _data != nil {
if _, ok := gourp[_data.SubGroupId]; !ok {
gourp[_data.SubGroupId] = _data.SubGroupWt // 小组ID 权重赋值
if _data.SubGroupId == 0 {
continue
}
szW = append(szW, _data.SubGroupWt)
szID = append(szID, _data.SubGroupId)
}
}
}
if len(szW) > 0 {
groupID = szID[comm.GetRandW(szW)] // 获得小组ID
//fmt.Printf("大组类型为1的,获得小组ID :%ddropID%d", groupID, lotteryId)
key := int64(lotteryId)<<31 + int64(groupID)
// 小组ID 类型判断
if this.StypeE[key] == 1 { // 该小组的道具为权重掉落必定从N个道具中随机出1个道具
for i := 0; i < int(this.SNumE[key]); i++ {
szW = make([]int32, 0)
szID = make([]int32, 0)
gourp = make(map[int32]int32, 0)
sztW := make([]int32, 0)
sztID := make([]int32, 0)
for _, v := range this._groupType1E[key] {
if _data := this.GetEventLotterConfById(v); _data != nil { // 权重赋值
if _, ok := gourp[_data.SubGroupId]; !ok {
szW = append(szW, _data.EventWt)
szID = append(szID, _data.Id)
sztW = append(sztW, _data.EventWt)
sztID = append(sztID, _data.Id)
}
}
}
index := comm.GetRandW(szW)
_data := this.GetEventLotterConfById(szID[index])
index := comm.GetRandW(sztW)
_data := this.GetEventLotterConfById(sztID[index])
event = append(event, _data.EventID)
}
} else if this.StypeE[key] == 2 { // 该小组中的道具为概率掉落,每个道具都会随机一次是否会掉落(单位为千分比)
var wt int32
for _, v := range this._groupType2E[key] {
if _data := this.GetEventLotterConfById(v); _data != nil { // 权重赋值
if _data.EventWt != 0 {
wt = _data.EventWt
}
//fmt.Printf("大组类型1小组类型2获得道具 :%v, 该道具Cid:%d", _data.Itemid, v)
if wt >= comm.GetRandNum(0, 1000) { // 命中
if _data.EventID >= comm.GetRandNum(0, 1000) { // 命中
event = append(event, _data.EventID)
}
}
@ -224,51 +245,46 @@ func (this *configureComp) GetEventGroupDataByLottery(lotterys ...int32) (event
}
}
if this.BtypeE[lotteryId] == 2 { // 该大组中的小组为概率掉落,每个小组都会随机一次是否会掉落(单位为千分比)
// 每个小组id 都随机取一次
var szGroupID []int32 // 获得的权重数组
gourp := make([]*cfg.GameEventlotteryData, 0) // key 小组ID value 权重
szW = make([]int32, 0)
szID = make([]int32, 0)
for _, v := range this._lotteryType2E[lotteryId] {
if _data := this.GetEventLotterConfById(v); _data != nil {
gourp = append(gourp, _data)
if _data.SubGroupId == 0 {
continue
}
szW = append(szW, _data.SubGroupWt)
szID = append(szID, _data.SubGroupId)
}
}
var wt int32
// 类型为2 可能会同时获得多个组id
for _, v := range gourp {
if v.SubGroupWt != 0 {
wt = v.SubGroupWt
}
k := v.SubGroupId
for pos, v := range szW {
key := int64(lotteryId)<<31 + int64(szID[pos])
//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 v >= comm.GetRandNum(0, 1000) { // 命中
if this.StypeE[key] == 1 { // 随机一组数据
for i := 0; i < int(this.SNumE[key]); i++ {
szW := make([]int32, 0)
szID := make([]int32, 0)
gourp := make(map[int32]int32, 0)
sztW := make([]int32, 0)
sztID := make([]int32, 0)
for _, v := range this._groupType1E[key] {
if _data := this.GetEventLotterConfById(v); _data != nil { // 权重赋值
if _, ok := gourp[_data.SubGroupId]; !ok {
szW = append(szW, _data.EventWt)
szID = append(szID, _data.Id)
sztW = append(sztW, _data.EventWt)
sztID = append(sztID, _data.Id)
}
}
}
index := comm.GetRandW(szW)
_data := this.GetEventLotterConfById(szID[index])
index := comm.GetRandW(sztW)
_data := this.GetEventLotterConfById(sztID[index])
//fmt.Printf("获得最终的道具 :%d", _data.Id)
// 随机获得的数量
event = append(event, _data.EventID)
}
} else if this.StypeE[key] == 2 {
for _, v := range this._groupType2E[key] {
var wt int32
if _data := this.GetEventLotterConfById(v); _data != nil { // 权重赋值
if _data.EventWt != 0 {
wt = _data.EventWt
}
if wt >= comm.GetRandNum(0, 1000) { // 命中
if _data.EventWt >= comm.GetRandNum(1, 1000) { // 命中
event = append(event, _data.EventID)
}
}
@ -277,11 +293,9 @@ func (this *configureComp) GetEventGroupDataByLottery(lotterys ...int32) (event
}
}
}
}
return
}
func (this *configureComp) LoadRoomGroupData() {
if v, err := this.GetConfigure(game_roomlottery); err == nil {
if configure, ok := v.(*cfg.GameRoomlottery); ok {
@ -292,15 +306,32 @@ func (this *configureComp) LoadRoomGroupData() {
this._lotteryType2R = make(map[int32][]int32, 0)
this._groupType1R = make(map[int64][]int32, 0)
this._groupType2R = make(map[int64][]int32, 0)
this.BtypeR = make(map[int32]int32, 0)
//this.Btype = make(map[int32]int32, 0)
this.StypeR = make(map[int64]int32, 0)
this.SNumR = make(map[int64]int32, 0)
var tmp1 int64
var tmp2 int64
var itype int32
var wt int32
var subid int32
for _, value := range configure.GetDataList() {
if value.SubGroupId == 0 {
value.SubGroupId = subid
} else {
subid = value.SubGroupId
}
key := int64(value.GroupId)<<31 + int64(value.SubGroupId)
// key2 := int64(value.Lotteryid)<<31 + int64(value.Type)
this._groupR[key] = append(this._groupR[key], value.Id)
if _, ok := this.BtypeR[value.GroupId]; !ok {
this.BtypeR[value.GroupId] = value.GroupType
if value.GroupType == 0 {
value.GroupType = itype
} else {
itype = value.GroupType
}
if value.SubGroupWt == 0 {
value.SubGroupWt = wt
} else {
wt = value.SubGroupWt
}
if _, ok := this.StypeR[key]; !ok {
@ -309,10 +340,18 @@ func (this *configureComp) LoadRoomGroupData() {
if _, ok := this.SNumR[key]; !ok {
this.SNumR[key] = value.SubGroupNum
}
if this.BtypeR[value.GroupId] == 1 {
this._lotteryType1R[value.GroupId] = append(this._lotteryType1R[value.GroupId], value.Id)
} else if this.BtypeR[value.GroupId] == 2 {
if value.GroupType == 1 {
if tmp1 != key {
this._lotteryType1R[value.GroupId] = append(this._lotteryType2R[value.GroupId], value.Id)
tmp1 = key
}
}
if value.GroupType == 2 {
if tmp2 != key {
this._lotteryType2R[value.GroupId] = append(this._lotteryType2R[value.GroupId], value.Id)
tmp2 = key
}
}
if this.StypeR[key] == 1 { // 小组ID为1
@ -349,109 +388,94 @@ func (this *configureComp) GetRoomGroupDataByLottery(lotteryId int32) (rooms []i
}
}
// 优先校验大组ID 的类型
if this.BtypeR[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._lotteryType1R[lotteryId] {
if _data := this.GetRoomLotterConfById(v); _data != nil {
if _, ok := gourp[_data.SubGroupId]; !ok {
gourp[_data.SubGroupId] = _data.SubGroupWt // 小组ID 权重赋值
if _data.SubGroupId == 0 {
continue
}
szW = append(szW, _data.SubGroupWt)
szID = append(szID, _data.SubGroupId)
}
}
}
if len(szW) > 0 {
groupID = szID[comm.GetRandW(szW)] // 获得小组ID
//fmt.Printf("大组类型为1的,获得小组ID :%ddropID%d", groupID, lotteryId)
key := int64(lotteryId)<<31 + int64(groupID)
// 小组ID 类型判断
if this.StypeR[key] == 1 { // 该小组的道具为权重掉落必定从N个道具中随机出1个道具
for i := 0; i < int(this.SNumR[key]); i++ {
szW = make([]int32, 0)
szID = make([]int32, 0)
gourp = make(map[int32]int32, 0)
sztW := make([]int32, 0)
sztID := make([]int32, 0)
for _, v := range this._groupType1R[key] {
if _data := this.GetRoomLotterConfById(v); _data != nil { // 权重赋值
if _, ok := gourp[_data.SubGroupId]; !ok {
szW = append(szW, _data.RoomWt)
szID = append(szID, _data.Id)
sztW = append(sztW, _data.RoomWt)
sztID = append(sztID, _data.Id)
}
}
}
index := comm.GetRandW(szW)
_data := this.GetRoomLotterConfById(szID[index])
index := comm.GetRandW(sztW)
_data := this.GetRoomLotterConfById(sztID[index])
rooms = append(rooms, _data.RoomID)
}
return
} else if this.StypeR[key] == 2 { // 该小组中的道具为概率掉落,每个道具都会随机一次是否会掉落(单位为千分比)
var wt int32
for _, v := range this._groupType2R[key] {
if _data := this.GetRoomLotterConfById(v); _data != nil { // 权重赋值
if _data.RoomWt != 0 {
wt = _data.RoomWt
}
//fmt.Printf("大组类型1小组类型2获得道具 :%v, 该道具Cid:%d", _data.Itemid, v)
if wt >= comm.GetRandNum(0, 1000) { // 命中
if _data.RoomWt >= comm.GetRandNum(0, 1000) { // 命中
rooms = append(rooms, _data.RoomID)
}
}
}
return
}
}
if this.BtypeR[lotteryId] == 2 { // 该大组中的小组为概率掉落,每个小组都会随机一次是否会掉落(单位为千分比)
// 每个小组id 都随机取一次
var szGroupID []int32 // 获得的权重数组
gourp := make([]*cfg.GameRoomlotteryData, 0) // key 小组ID value 权重
szW = make([]int32, 0)
szID = make([]int32, 0)
for _, v := range this._lotteryType2R[lotteryId] {
if _data := this.GetRoomLotterConfById(v); _data != nil {
gourp = append(gourp, _data)
if _data.SubGroupId == 0 {
continue
}
szW = append(szW, _data.SubGroupWt)
szID = append(szID, _data.SubGroupId)
}
}
var wt int32
// 类型为2 可能会同时获得多个组id
for _, v := range gourp {
if v.SubGroupWt != 0 {
wt = v.SubGroupWt
}
k := v.SubGroupId
for pos, v := range szW {
key := int64(lotteryId)<<31 + int64(szID[pos])
//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 v >= comm.GetRandNum(0, 1000) { // 命中
if this.StypeR[key] == 1 { // 随机一组数据
for i := 0; i < int(this.SNumR[key]); i++ {
szW := make([]int32, 0)
szID := make([]int32, 0)
gourp := make(map[int32]int32, 0)
sztW := make([]int32, 0)
sztID := make([]int32, 0)
for _, v := range this._groupType1R[key] {
if _data := this.GetRoomLotterConfById(v); _data != nil { // 权重赋值
if _, ok := gourp[_data.SubGroupId]; !ok {
szW = append(szW, _data.RoomWt)
szID = append(szID, _data.Id)
sztW = append(sztW, _data.RoomWt)
sztID = append(sztID, _data.Id)
}
}
}
index := comm.GetRandW(szW)
_data := this.GetRoomLotterConfById(szID[index])
index := comm.GetRandW(sztW)
_data := this.GetRoomLotterConfById(sztID[index])
//fmt.Printf("获得最终的道具 :%d", _data.Id)
// 随机获得的数量
rooms = append(rooms, _data.RoomID)
}
} else if this.StypeR[key] == 2 {
for _, v := range this._groupType2R[key] {
var wt int32
if _data := this.GetRoomLotterConfById(v); _data != nil { // 权重赋值
if _data.RoomWt != 0 {
wt = _data.RoomWt
}
if wt >= comm.GetRandNum(0, 1000) { // 命中
if _data.RoomWt >= comm.GetRandNum(1, 1000) { // 命中
rooms = append(rooms, _data.RoomID)
}
}
@ -459,7 +483,6 @@ func (this *configureComp) GetRoomGroupDataByLottery(lotteryId int32) (rooms []i
}
}
}
}
return
}

View File

@ -108,15 +108,33 @@ func (this *MCompConfigure) LoadGroupData() {
var tmp1 int64
var tmp2 int64
var itype int32
var subtype int32
var groupwt int32
var groupid int32
for _, value := range configure.GetDataList() {
if value.Groupid == 0 {
value.Groupid = groupid
} else {
groupid = value.Groupid
}
key := int64(value.Lotteryid)<<31 + int64(value.Groupid)
// key2 := int64(value.Lotteryid)<<31 + int64(value.Type)
this._group[key] = append(this._group[key], value.Id)
if value.Type == 0 {
value.Type = itype
} else {
itype = value.Type
}
if value.Groupwt == 0 {
value.Groupwt = groupwt
} else {
groupwt = value.Groupwt
}
if value.Subtype == 0 {
value.Subtype = subtype
} else {
subtype = value.Subtype
}
// 数据安全校验
if value.Min > value.Max {
log.Errorf("value.Min:%d > value.Max :%d ", value.Min, value.Max)
@ -138,14 +156,14 @@ func (this *MCompConfigure) LoadGroupData() {
this.SNum[key] = value.Groupnum
}
if value.Type == 1 || value.Type == 0 {
if value.Type == 1 {
if tmp1 != key {
this._lotteryType1[value.Lotteryid] = append(this._lotteryType1[value.Lotteryid], value.Id)
tmp1 = key
}
}
if value.Type == 2 || value.Type == 0 {
if value.Type == 2 {
if tmp2 != key {
this._lotteryType2[value.Lotteryid] = append(this._lotteryType2[value.Lotteryid], value.Id)
tmp2 = key
@ -171,7 +189,7 @@ func (this *MCompConfigure) GetGroupDataByLottery(lotteryId int32, vipLv int32,
if _, ok := this._lotteryType1[lotteryId]; !ok {
if _, ok := this._lotteryType2[lotteryId]; !ok {
fmt.Printf("not found config lotterId:%d", lotteryId)
this.module.Errorf("not found config lotterId:%d", lotteryId)
return
}
}
@ -186,12 +204,15 @@ func (this *MCompConfigure) GetGroupDataByLottery(lotteryId int32, vipLv int32,
for _, v := range this._lotteryType1[lotteryId] {
if _data := this.GetLotterConfById(v); _data != nil {
if (_data.Playerlvmax == 0 || (_data.Playerlvmin <= lv && lv <= _data.Playerlvmax)) && (_data.VIPmax == 0 || (_data.VIPmin <= vipLv && vipLv <= _data.VIPmax)) { // 过滤等级等条件
if _data.Groupid != 0 {
szW = append(szW, _data.Groupwt)
szID = append(szID, _data.Groupid)
}
}
}
}
}
}
if len(szW) > 0 {
groupID = szID[comm.GetRandW(szW)] // 获得小组ID
//fmt.Printf("大组类型为1的,获得小组ID :%ddropID%d", groupID, lotteryId)
key := int64(lotteryId)<<31 + int64(groupID)
@ -233,17 +254,21 @@ func (this *MCompConfigure) GetGroupDataByLottery(lotteryId int32, vipLv int32,
}
}
}
// 每个小组id 都随机取一次
szW = make([]int32, 0)
szID = make([]int32, 0)
for _, v := range this._lotteryType2[lotteryId] {
if _data := this.GetLotterConfById(v); _data != nil {
if (_data.Playerlvmax == 0 || (_data.Playerlvmin <= lv && lv <= _data.Playerlvmax)) && (_data.VIPmax == 0 || (_data.VIPmin <= vipLv && vipLv <= _data.VIPmax)) { // 过滤等级等条件
if _data.Groupid != 0 {
szW = append(szW, _data.Groupwt)
szID = append(szID, _data.Groupid)
}
}
}
}
// 类型为2 可能会同时获得多个组id
for pos, v := range szW {
@ -288,6 +313,7 @@ func (this *MCompConfigure) GetGroupDataByLottery(lotteryId int32, vipLv int32,
}
}
}
return
}