Merge branch 'meixiongfeng' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev

This commit is contained in:
meixiongfeng 2023-02-08 18:24:18 +08:00
commit 6470e3434f
6 changed files with 82 additions and 43 deletions

View File

@ -138,9 +138,9 @@
"e": 999999999, "e": 999999999,
"p": "base_pool7" "p": "base_pool7"
}, },
"base_pool_star3": 970, "base_pool_star3": 100,
"base_pool_star4": 27, "base_pool_star4": 700,
"base_pool_star5": 3, "base_pool_star5": 200,
"camp_pool_star3": 9500, "camp_pool_star3": 9500,
"camp_pool_star4": 900, "camp_pool_star4": 900,
"camp_pool_star5": 100, "camp_pool_star5": 100,

View File

@ -363,7 +363,7 @@ func (this *MCompConfigure) GetAllItemConfigure() (item []*cfg.GameItemData) {
return return
} }
func (this *MCompConfigure) GetAllEquipmentConfigure(equipmentId string) (configure []*cfg.GameEquipData) { func (this *MCompConfigure) GetAllEquipmentConfigure() (configure []*cfg.GameEquipData) {
if v, err := this.GetConfigure(game_equip); err == nil { if v, err := this.GetConfigure(game_equip); err == nil {
for _, v1 := range v.(*cfg.GameEquip).GetDataMap() { for _, v1 := range v.(*cfg.GameEquip).GetDataMap() {

View File

@ -112,13 +112,13 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
res []*cfg.Gameatn res []*cfg.Gameatn
) )
equip := this.configure.GetAllItemConfigure() equip := this.configure.GetAllEquipmentConfigure()
for _, v1 := range equip { for _, v1 := range equip {
res = append(res, &cfg.Gameatn{ res = append(res, &cfg.Gameatn{
A: "equi", A: "equi",
T: v1.Id, T: v1.Id,
N: 1, N: 5,
}) })
} }
data := this.configure.GetHeroConfigData() data := this.configure.GetHeroConfigData()

View File

@ -76,17 +76,10 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
continue continue
} }
// 3,4,5 星权重 // 3,4,5 星权重
starWeight := make([]int32, 0) starWeight := []int32{cfgDraw.BasePoolStar3, cfgDraw.BasePoolStar4, cfgDraw.BasePoolStar5}
if cfgDraw.BasePoolStar3 != 0 {
starWeight = append(starWeight, cfgDraw.BasePoolStar3)
}
if cfgDraw.BasePoolStar4 != 0 {
starWeight = append(starWeight, cfgDraw.BasePoolStar4)
}
if cfgDraw.BasePoolStar5 != 0 {
starWeight = append(starWeight, cfgDraw.BasePoolStar5)
}
starIndex := this.module.modelHero.GetRandW(starWeight) // 3 4 5 星索引 starIndex := this.module.modelHero.GetRandW(starWeight) // 3 4 5 星索引
// 特殊规则 DrawCard_5StarsInRange 第2-30次抽奖必出一个5星英雄普通卡池 // 特殊规则 DrawCard_5StarsInRange 第2-30次抽奖必出一个5星英雄普通卡池
inRangeConf := this.module.configure.GetGlobalConf().DrawCard5StarsInRange inRangeConf := this.module.configure.GetGlobalConf().DrawCard5StarsInRange
if len(inRangeConf) == 3 { if len(inRangeConf) == 3 {
@ -180,28 +173,28 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
} }
heroRecord.Star4++ // 4星保底数量+1 heroRecord.Star4++ // 4星保底数量+1
heroRecord.Star5++ // 5星保底数量+1 heroRecord.Star5++ // 5星保底数量+1
if starIndex == 1 { if starIndex == 4 {
heroRecord.Star4 = 0 heroRecord.Star4 = 0
star4Max++ star4Max++
} else if starIndex == 2 { } else if starIndex == 5 {
star5Max++ star5Max++
heroRecord.Star5 = 0 heroRecord.Star5 = 0
} }
if star4Max >= cfgDraw.Draw10Star4Max || star5Max >= cfgDraw.Draw10Star5Max { // 达到10连抽最大(4,5星)数量 直接给三星 if star4Max >= cfgDraw.Draw10Star4Max || star5Max >= cfgDraw.Draw10Star5Max { // 达到10连抽最大(4,5星)数量 直接给三星
starIndex = 0 starIndex = 3
} else { } else {
// 普通卡池保底 // 普通卡池保底
if cfgDraw.DrawFloorStar4 <= heroRecord.Star4 { if cfgDraw.DrawFloorStar4 <= heroRecord.Star4 {
heroRecord.Star4 = 0 heroRecord.Star4 = 0
starIndex = 1 starIndex = 4
} }
if cfgDraw.DrawFloorStar5 <= heroRecord.Star5 { if cfgDraw.DrawFloorStar5 <= heroRecord.Star5 {
heroRecord.Star5 = 0 heroRecord.Star5 = 0
starIndex = 2 starIndex = 5
} }
} }
szStar = append(szStar, starIndex+3) szStar = append(szStar, starIndex)
if len(szStar) >= int(req.DrawCount) { if len(szStar) >= int(req.DrawCount) {
break break
} }
@ -256,27 +249,18 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
return return
} }
for { for {
sz := make([]int32, 0) starWeight := []int32{cfgDraw.CampPoolStar3, cfgDraw.CampPoolStar4, cfgDraw.CampPoolStar5}
if cfgDraw.CampPoolStar3 != 0 {
sz = append(sz, cfgDraw.CampPoolStar3) // 3 4 5 星权重
}
if cfgDraw.CampPoolStar4 != 0 {
sz = append(sz, cfgDraw.CampPoolStar4)
}
if cfgDraw.CampPoolStar5 != 0 {
sz = append(sz, cfgDraw.CampPoolStar5)
} starIndex := this.module.modelHero.GetRandW(starWeight)
starIndex := this.module.modelHero.GetRandW(sz) if starIndex == 4 {
if starIndex == 1 {
star4Max++ star4Max++
} else if starIndex == 2 { } else if starIndex == 5 {
star5Max++ star5Max++
} }
if star4Max >= cfgDraw.Draw10Star4Max || star5Max >= cfgDraw.Draw10Star5Max { if star4Max >= cfgDraw.Draw10Star4Max || star5Max >= cfgDraw.Draw10Star5Max {
starIndex = 0 starIndex = 3
} }
szStar = append(szStar, starIndex+3) szStar = append(szStar, starIndex)
if len(szStar) >= int(req.DrawCount) { if len(szStar) >= int(req.DrawCount) {
break break
} }
@ -337,11 +321,11 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
} }
if code, atno := this.module.DispenseAtno(session, []*cfg.Gameatn{res}, true); code == pb.ErrorCode_Success { if code, atno := this.module.DispenseAtno(session, []*cfg.Gameatn{res}, true); code == pb.ErrorCode_Success {
list := &pb.AtnoData{} rsp.Data = append(rsp.Data, &pb.AtnoData{
list.Atno = append(list.Atno, atno...) Atno: atno,
rsp.Data = append(rsp.Data, list) })
for _, v := range atno { for _, v := range atno {
if v.A == "hero" { if v.A == "hero" && v.N == 1 {
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil { // 广播 首次获得英雄 if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil { // 广播 首次获得英雄
this.chat.SendSysChatToWorld(comm.ChatSystem13, nil, 0, 0, user.Name, v.T) this.chat.SendSysChatToWorld(comm.ChatSystem13, nil, 0, 0, user.Name, v.T)
} }
@ -349,6 +333,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
} }
} }
} }
session.SendMsg(string(this.module.GetType()), DrawCard, rsp) session.SendMsg(string(this.module.GetType()), DrawCard, rsp)
// 任务统计 // 任务统计

View File

@ -624,7 +624,7 @@ func (this *ModelHero) GetRandW(sz []int32) int32 {
for i, v := range sz { for i, v := range sz {
_tmpW += int64(v) _tmpW += int64(v)
if n.Int64() < _tmpW { if n.Int64() < _tmpW {
return int32(i) return int32(i) + 3
} }
} }
} }
@ -830,6 +830,12 @@ func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, c
if obj.HeroID == heroCfgId { if obj.HeroID == heroCfgId {
hero = obj hero = obj
bFirst = false bFirst = false
atno = append(atno, &pb.UserAtno{ // 有英雄的时候 数量给0
A: "hero",
T: hero.HeroID,
N: 0,
O: hero.Id,
})
break break
} }
} }

View File

@ -721,7 +721,7 @@ func (this *Hero) SendTaskMsg(session comm.IUserSession, szStar []int32, drawCou
this.ModuleRtask.SendToRtask(session, comm.Rtype89, drawCount) this.ModuleRtask.SendToRtask(session, comm.Rtype89, drawCount)
} }
func (this Hero) newCondition(heroRecord *pb.DBHeroRecord) (get bool, starIndex int32) { func (this *Hero) newCondition(heroRecord *pb.DBHeroRecord) (get bool, starIndex int32) {
inRangeConf := this.configure.GetGlobalConf().DrawCard5StarsInRange inRangeConf := this.configure.GetGlobalConf().DrawCard5StarsInRange
if len(inRangeConf) == 3 { if len(inRangeConf) == 3 {
iStart := inRangeConf[0] // 抽卡开始 iStart := inRangeConf[0] // 抽卡开始
@ -751,3 +751,51 @@ func (this Hero) newCondition(heroRecord *pb.DBHeroRecord) (get bool, starIndex
get = false get = false
return return
} }
func (this *Hero) InRange(heroRecord *pb.DBHeroRecord, strPool []string, update map[string]interface{}) (starIndex int32, pool string) {
starIndex = 3 // 默认3星
inRangeConf1 := this.configure.GetGlobalConf().DrawCard5StarsInRange1
pool = this.configure.GetGlobalConf().DrawCard5StarsInRange1Pool
if len(inRangeConf1) == 3 {
iStart := inRangeConf1[0] // 抽卡开始
iEnd := inRangeConf1[1] // 抽卡结束
star := inRangeConf1[2]
if star >= 3 { // 保底必须三星+
if heroRecord.Inevitable == 0 && heroRecord.Drawcount > iStart && heroRecord.Drawcount < iEnd && iEnd >= iStart {
n, _ := rand.Int(rand.Reader, big.NewInt(int64(iEnd-iStart)))
if n.Int64() < 1 { // 抽中
starIndex = star
heroRecord.Inevitable = heroRecord.Drawcount
update["inevitable1"] = heroRecord.Drawcount
if star == 4 {
heroRecord.Star4 = 0
} else if star == 5 {
heroRecord.Star5 = 0
}
// 修改卡池
// if newPoll != "" {
// strPool[len(strPool)-1] = newPoll
// }
return
}
}
// 保底情况
if heroRecord.Drawcount == iEnd && heroRecord.Inevitable == 0 {
starIndex = star
heroRecord.Inevitable1 = heroRecord.Drawcount
update["inevitable1"] = heroRecord.Drawcount
if star == 4 {
heroRecord.Star4 = 0
} else if star == 5 {
heroRecord.Star5 = 0
}
return
}
}
}
return
}