Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
ddcda41c3c
@ -811,37 +811,70 @@ func (this *modelBattleComp) createBattleRole(hero *pb.DBHero, vlv int32, tid, p
|
||||
hero = this.module.ModuleHero.GetVirtualHero(hero, vlv)
|
||||
role.Lv = hero.Lv
|
||||
}
|
||||
|
||||
for k, v := range hero.Property {
|
||||
switch k {
|
||||
case cfg.GamePropertyType_Base_MaxHp_Per:
|
||||
hero.Property[cfg.GamePropertyType_Base_MaxHp_Per] = 0
|
||||
hero.Property[cfg.GamePropertyType_Base_MaxHp_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_MaxHp_Base])))
|
||||
case cfg.GamePropertyType_Base_Atk_Per:
|
||||
hero.Property[cfg.GamePropertyType_Base_Atk_Per] = 0
|
||||
hero.Property[cfg.GamePropertyType_Base_Atk_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_Atk_Base])))
|
||||
case cfg.GamePropertyType_Base_Def_Per:
|
||||
hero.Property[cfg.GamePropertyType_Base_Def_Per] = 0
|
||||
hero.Property[cfg.GamePropertyType_Base_Def_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_Def_Base])))
|
||||
case cfg.GamePropertyType_Base_Speed_Per:
|
||||
hero.Property[cfg.GamePropertyType_Base_Speed_Per] = 0
|
||||
hero.Property[cfg.GamePropertyType_Base_Speed_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_Speed_Base])))
|
||||
}
|
||||
}
|
||||
for k, v := range hero.Property {
|
||||
|
||||
role.Property[k] += v
|
||||
if k == cfg.GamePropertyType_Base_MaxHp_Base {
|
||||
|
||||
role.Currhp += v
|
||||
}
|
||||
}
|
||||
for k, v := range hero.AddProperty {
|
||||
switch k {
|
||||
case cfg.GamePropertyType_Base_MaxHp_Per:
|
||||
hero.AddProperty[cfg.GamePropertyType_Base_MaxHp_Per] = 0
|
||||
hero.AddProperty[cfg.GamePropertyType_Base_MaxHp_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_MaxHp_Base])))
|
||||
case cfg.GamePropertyType_Base_Atk_Per:
|
||||
hero.AddProperty[cfg.GamePropertyType_Base_Atk_Per] = 0
|
||||
hero.AddProperty[cfg.GamePropertyType_Base_Atk_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_Atk_Base])))
|
||||
case cfg.GamePropertyType_Base_Def_Per:
|
||||
hero.AddProperty[cfg.GamePropertyType_Base_Def_Per] = 0
|
||||
hero.AddProperty[cfg.GamePropertyType_Base_Def_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_Def_Base])))
|
||||
case cfg.GamePropertyType_Base_Speed_Per:
|
||||
hero.AddProperty[cfg.GamePropertyType_Base_Speed_Per] = 0
|
||||
hero.AddProperty[cfg.GamePropertyType_Base_Speed_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_Speed_Base])))
|
||||
}
|
||||
}
|
||||
|
||||
for k, v := range hero.AddProperty {
|
||||
//arrt := AttributesTransExt(k)
|
||||
|
||||
role.Property[k] += v
|
||||
if k == cfg.GamePropertyType_Base_MaxHp_Base {
|
||||
role.Currhp += v
|
||||
}
|
||||
}
|
||||
|
||||
for k, v := range hero.JuexProperty {
|
||||
switch k {
|
||||
case cfg.GamePropertyType_Base_MaxHp_Per:
|
||||
hero.JuexProperty[cfg.GamePropertyType_Base_MaxHp_Per] = 0
|
||||
hero.JuexProperty[cfg.GamePropertyType_Base_MaxHp_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_MaxHp_Base])))
|
||||
case cfg.GamePropertyType_Base_Atk_Per:
|
||||
hero.JuexProperty[cfg.GamePropertyType_Base_Atk_Per] = 0
|
||||
hero.JuexProperty[cfg.GamePropertyType_Base_Atk_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_Atk_Base])))
|
||||
case cfg.GamePropertyType_Base_Def_Per:
|
||||
hero.JuexProperty[cfg.GamePropertyType_Base_Def_Per] = 0
|
||||
hero.JuexProperty[cfg.GamePropertyType_Base_Def_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_Def_Base])))
|
||||
case cfg.GamePropertyType_Base_Speed_Per:
|
||||
hero.JuexProperty[cfg.GamePropertyType_Base_Speed_Per] = 0
|
||||
hero.JuexProperty[cfg.GamePropertyType_Base_Speed_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_Speed_Base])))
|
||||
}
|
||||
}
|
||||
|
||||
for k, v := range hero.JuexProperty {
|
||||
|
||||
role.Property[k] += v
|
||||
@ -849,6 +882,23 @@ func (this *modelBattleComp) createBattleRole(hero *pb.DBHero, vlv int32, tid, p
|
||||
role.Currhp += v
|
||||
}
|
||||
}
|
||||
|
||||
for k, v := range hero.HoroscopeProperty {
|
||||
switch k {
|
||||
case cfg.GamePropertyType_Base_MaxHp_Per:
|
||||
hero.HoroscopeProperty[cfg.GamePropertyType_Base_MaxHp_Per] = 0
|
||||
hero.HoroscopeProperty[cfg.GamePropertyType_Base_MaxHp_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_MaxHp_Base])))
|
||||
case cfg.GamePropertyType_Base_Atk_Per:
|
||||
hero.HoroscopeProperty[cfg.GamePropertyType_Base_Atk_Per] = 0
|
||||
hero.HoroscopeProperty[cfg.GamePropertyType_Base_Atk_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_Atk_Base])))
|
||||
case cfg.GamePropertyType_Base_Def_Per:
|
||||
hero.HoroscopeProperty[cfg.GamePropertyType_Base_Def_Per] = 0
|
||||
hero.HoroscopeProperty[cfg.GamePropertyType_Base_Def_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_Def_Base])))
|
||||
case cfg.GamePropertyType_Base_Speed_Per:
|
||||
hero.HoroscopeProperty[cfg.GamePropertyType_Base_Speed_Per] = 0
|
||||
hero.HoroscopeProperty[cfg.GamePropertyType_Base_Speed_Base] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[cfg.GamePropertyType_Base_Speed_Base])))
|
||||
}
|
||||
}
|
||||
for k, v := range hero.HoroscopeProperty {
|
||||
|
||||
role.Property[k] += v
|
||||
|
@ -148,6 +148,7 @@ func (this *apiComp) Train(session comm.IUserSession, req *pb.DragonTrainReq) (e
|
||||
dragon.Property["energyrecover"] = c.Energyrecover
|
||||
dragon.Property["caddtime"] = c.Caddtime
|
||||
dragon.Property["csubtime"] = c.Csubtime
|
||||
dragon.Property["offsetspeed"] = c.Offsetspeed
|
||||
update["property"] = dragon.Property // 更新属性
|
||||
}
|
||||
// 升阶后重置养成属性次数
|
||||
|
@ -118,6 +118,8 @@ func (this *ModelDragon) CreateDragon(session comm.IUserSession, dragons map[str
|
||||
dragon.Property["energyrecover"] = c.Energyrecover
|
||||
dragon.Property["caddtime"] = c.Caddtime
|
||||
dragon.Property["csubtime"] = c.Csubtime
|
||||
dragon.Property["offsetspeed"] = c.Offsetspeed
|
||||
dragon.Property["offsetspeed"] = c.Offsetspeed
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,6 +98,7 @@ func (this *Dragon) CreateRobotDragon(dragonid string, lv int32) (dragon *pb.DBD
|
||||
// dragon.Property["itemsprint"] = c.Itemsprint
|
||||
dragon.Property["caddtime"] = c.Caddtime
|
||||
dragon.Property["csubtime"] = c.Csubtime
|
||||
dragon.Property["offsetspeed"] = c.Offsetspeed
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -179,6 +180,7 @@ func (this *Dragon) GMModifyDragonLv(uid string, cid string, lv int32) (dragon *
|
||||
dragon.Property["energyrecover"] = c.Energyrecover
|
||||
dragon.Property["caddtime"] = c.Caddtime
|
||||
dragon.Property["csubtime"] = c.Csubtime
|
||||
dragon.Property["offsetspeed"] = c.Offsetspeed
|
||||
update["property"] = dragon.Property
|
||||
}
|
||||
}
|
||||
|
@ -731,6 +731,15 @@ func (this *MapData) SkillUp(pos int32, color int32, skillid int32, value int32,
|
||||
}
|
||||
case 3: // 将随机6个宝石染成当前盘面上颜色最多的宝石
|
||||
this.SkillChangeColor(value)
|
||||
bDrop = false
|
||||
szMap = append(szMap, &pb.MapData{
|
||||
Data: this.GetPalatData(),
|
||||
CurSocre: skillScore,
|
||||
CurEnergy: skillEnergy,
|
||||
})
|
||||
if list, _ := this.CheckMap(color, false); len(list) > 0 {
|
||||
szMap = append(szMap, list...)
|
||||
}
|
||||
case 4:
|
||||
x := int(pos / Width)
|
||||
y := int(pos % Height)
|
||||
@ -1290,7 +1299,7 @@ func (this *MapData) HitElem(color int32, curid int32) (szMap []*pb.MapData) {
|
||||
szMap = append(szMap, &pb.MapData{
|
||||
Data: this.GetPalatData(),
|
||||
CurSocre: curScore,
|
||||
CurEnergy: 0,
|
||||
CurEnergy: energy,
|
||||
})
|
||||
}
|
||||
sz, _ := this.CheckMap(color, false)
|
||||
@ -1488,9 +1497,15 @@ func (this *MapData) SkillChangeColor(count int32) {
|
||||
elemCount[v.Color] += 1
|
||||
}
|
||||
|
||||
for k := range elemCount {
|
||||
if color < k {
|
||||
for _, v := range elemCount {
|
||||
if color < v {
|
||||
color = v
|
||||
}
|
||||
}
|
||||
for k, v := range elemCount {
|
||||
if color == v {
|
||||
color = k
|
||||
break
|
||||
}
|
||||
}
|
||||
for i := 0; i < int(count); i++ {
|
||||
@ -1498,7 +1513,12 @@ func (this *MapData) SkillChangeColor(count int32) {
|
||||
if this.Plat[targetId].Color == color {
|
||||
i--
|
||||
} else {
|
||||
this.Plat[targetId].Color = color // 变更颜色
|
||||
if this.Plat[targetId].Special == 0 {
|
||||
this.Plat[targetId].Color = color // 变更颜色
|
||||
this.Plat[targetId].Cid = color // 变更颜色
|
||||
this.oid++
|
||||
this.Plat[targetId].Oid = this.oid // 变唯一id
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
|
@ -557,7 +557,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er
|
||||
log.Field{Key: "uid", Value: session.GetUserId()},
|
||||
log.Field{Key: "0", Value: datas[0]},
|
||||
)
|
||||
} else if len(datas) == 3 && (datas[0] == "race") { // 一键超神
|
||||
} else if len(datas) == 2 && (datas[0] == "race") { // 一键超神
|
||||
var (
|
||||
num2 int
|
||||
err error
|
||||
@ -567,7 +567,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er
|
||||
return
|
||||
}
|
||||
|
||||
num2, err = strconv.Atoi(datas[2])
|
||||
num2, err = strconv.Atoi(datas[1])
|
||||
if err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ReqParameterError,
|
||||
@ -828,7 +828,6 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er
|
||||
log.Field{Key: "0", Value: datas[1]},
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -168,6 +168,36 @@ func Test_Main(t *testing.T) {
|
||||
szByte []byte
|
||||
)
|
||||
szByte = make([]byte, 0)
|
||||
//010 2
|
||||
// 1<<2
|
||||
var star1, star2, star3 int32
|
||||
var rst int32
|
||||
rst = 6 // 101
|
||||
rst |= 2 //010
|
||||
//fmt.Printf("%d,%d,%d,%d", star1, star2, star3, rst)
|
||||
for i := 0; i < 3; i++ {
|
||||
star1 = 1 << i
|
||||
if rst&star1 == star1 {
|
||||
star3++
|
||||
}
|
||||
}
|
||||
//star1 = 1 << 0
|
||||
star2 = 1 << 1
|
||||
star3 = 1 << 2 // 101
|
||||
//rst |= star1
|
||||
rst |= star2
|
||||
rst |= star3
|
||||
//rst = star1 ^ star2 ^ star3 // 三星
|
||||
//rst = star1 ^ star2 // 2星
|
||||
rst ^= star1
|
||||
rst ^= star2
|
||||
rst ^= star2
|
||||
// 校验星
|
||||
b1 := (rst&star1 == star1)
|
||||
b2 := (rst&star2 == star2)
|
||||
b3 := (rst&star3 == star3)
|
||||
fmt.Printf("%d,%d,%d,%d", star1, star2, star3, rst)
|
||||
fmt.Printf("%v,%v,%v,%d", b1, b2, b3, rst)
|
||||
|
||||
//szByte = append(szByte, 8)
|
||||
fmt.Printf("%v,%s", szByte, string(szByte))
|
||||
@ -254,23 +284,6 @@ func Test_Main(t *testing.T) {
|
||||
}
|
||||
defer trace.Stop()
|
||||
|
||||
var star1, star2, star3 int32
|
||||
var rst int32
|
||||
star1 = 1 << 0
|
||||
star2 = 1 << 1
|
||||
star3 = 1 << 2
|
||||
|
||||
//rst = star1 ^ star2 ^ star3 // 三星
|
||||
//rst = star1 ^ star2 // 2星
|
||||
rst ^= star1
|
||||
rst ^= star2
|
||||
rst ^= star2
|
||||
// 校验星
|
||||
b1 := (rst&star1 == star1)
|
||||
b2 := (rst&star2 == star2)
|
||||
b3 := (rst&star3 == star3)
|
||||
fmt.Printf("%d,%d,%d,%d", star1, star2, star3, rst)
|
||||
fmt.Printf("%v,%v,%v,%d", b1, b2, b3, rst)
|
||||
var list []int32
|
||||
var list2 []int32
|
||||
list = []int32{1, 2, 3, 4, 5, 6, 7, 8, 9}
|
||||
|
@ -23,10 +23,6 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.PagodaGetListReq
|
||||
}
|
||||
return
|
||||
}
|
||||
// if list.Complete { // 这个版本不给赛季塔信息
|
||||
// list, _ = this.module.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId())
|
||||
// }
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: list})
|
||||
return
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ func (this *apiComp) GetRace(session comm.IUserSession, req *pb.PagodaGetRaceReq
|
||||
err error
|
||||
update map[string]interface{}
|
||||
)
|
||||
update = make(map[string]interface{}, 0)
|
||||
|
||||
list, err = this.module.modelRacePagoda.getPagodaRaceList(session.GetUserId())
|
||||
if err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
@ -33,20 +33,22 @@ func (this *apiComp) GetRace(session comm.IUserSession, req *pb.PagodaGetRaceReq
|
||||
}
|
||||
|
||||
if !utils.IsToday(list.Rtime) {
|
||||
update = make(map[string]interface{}, 0)
|
||||
list.Rtime = configure.Now().Unix()
|
||||
list.Battlecount = 0
|
||||
update["battlecount"] = list.Battlecount
|
||||
update["rtime"] = list.Rtime
|
||||
}
|
||||
|
||||
if err = this.module.modelRacePagoda.ModifyPagodaRaceData(session.GetUserId(), update); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
Title: pb.ErrorCode_DBError.ToString(),
|
||||
Message: err.Error(),
|
||||
if err = this.module.modelRacePagoda.ModifyPagodaRaceData(session.GetUserId(), update); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
Title: pb.ErrorCode_DBError.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), PagodaGetRaceResp, &pb.PagodaGetRaceResp{})
|
||||
session.SendMsg(string(this.module.GetType()), PagodaGetRaceResp, &pb.PagodaGetRaceResp{
|
||||
Data: list,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ func (this *apiComp) ChallengeRace(session comm.IUserSession, req *pb.PagodaChal
|
||||
}
|
||||
|
||||
if _, ok := pagoda.Data[conf.Floors]; !ok {
|
||||
if pagoda.Maxfloor != conf.Floors+1 {
|
||||
if pagoda.Maxfloor+1 != conf.Floors {
|
||||
errdata = &pb.ErrorData{ // 挑战关卡数据不匹配
|
||||
Code: pb.ErrorCode_PagodaLevlErr,
|
||||
Title: pb.ErrorCode_PagodaLevlErr.ToString(),
|
||||
|
@ -29,7 +29,6 @@ func (this *apiComp) ChallengeRaceOver(session comm.IUserSession, req *pb.Pagoda
|
||||
award []*cfg.Gameatn
|
||||
changExp map[string]int32
|
||||
costTime int32 // 耗时
|
||||
star int32 // 当前星级
|
||||
new bool // 是否首次挑战
|
||||
)
|
||||
changExp = make(map[string]int32, 0)
|
||||
@ -69,18 +68,23 @@ func (this *apiComp) ChallengeRaceOver(session comm.IUserSession, req *pb.Pagoda
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
costTime = req.Report.Costtime
|
||||
if _, ok := list.Data[conf.Floors]; !ok {
|
||||
if list.Maxfloor+1 == conf.Floors {
|
||||
list.Data[conf.Floors] = &pb.RaceData{
|
||||
Consttime: costTime,
|
||||
Star: star,
|
||||
Star: req.Star,
|
||||
}
|
||||
if req.Star > 0 {
|
||||
list.Maxfloor = conf.Floors
|
||||
mapData["maxfloor"] = list.Maxfloor
|
||||
}
|
||||
list.Maxfloor = conf.Floors
|
||||
mapData["maxfloor"] = list.Maxfloor
|
||||
new = true
|
||||
}
|
||||
}
|
||||
|
||||
list.Data[conf.Floors].Star |= req.Star
|
||||
list.Battlecount += 1
|
||||
mapData["data"] = list.Data
|
||||
mapData["battlecount"] = list.Battlecount
|
||||
@ -97,6 +101,7 @@ func (this *apiComp) ChallengeRaceOver(session comm.IUserSession, req *pb.Pagoda
|
||||
if list.Data[conf.Floors].Consttime > costTime { // 小于之前的时间 入榜
|
||||
this.module.modelRacePagoda.SetRacePagodaRankList(score, session.GetUserId())
|
||||
}
|
||||
award = append(award, conf.KeyReward...) // 首通奖励
|
||||
}
|
||||
|
||||
if err = this.module.modelRacePagoda.ModifyPagodaRaceData(session.GetUserId(), mapData); err != nil {
|
||||
|
106
modules/pagoda/api_racereward.go
Normal file
106
modules/pagoda/api_racereward.go
Normal file
@ -0,0 +1,106 @@
|
||||
package pagoda
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
)
|
||||
|
||||
//参数校验
|
||||
func (this *apiComp) RaceRewardCheck(session comm.IUserSession, req *pb.PagodaRaceRewardReq) (errdata *pb.ErrorData) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// 六合塔奖励
|
||||
func (this *apiComp) RaceReward(session comm.IUserSession, req *pb.PagodaRaceRewardReq) (errdata *pb.ErrorData) {
|
||||
|
||||
var (
|
||||
atno []*pb.UserAtno
|
||||
list *pb.DBPagodaRace
|
||||
err error
|
||||
szConf []*cfg.GameSixDirectionsRewardData
|
||||
res []*cfg.Gameatn
|
||||
totalStar int32
|
||||
floors []int32
|
||||
curStr int32
|
||||
)
|
||||
if errdata = this.RaceRewardCheck(session, req); errdata != nil {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
|
||||
if list, err = this.module.modelRacePagoda.getPagodaRaceList(session.GetUserId()); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
Title: pb.ErrorCode_DBError.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
floors = this.module.configure.GetSixDirectionsGroudConf(req.Groud)
|
||||
if len(floors) == 0 {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: fmt.Sprintf("conf not fount:%d", req.Groud),
|
||||
}
|
||||
return
|
||||
} // 1 2 3
|
||||
if c, err := this.module.configure.GetSixPagodaConf(floors[0]); err == nil {
|
||||
szConf = this.module.configure.GetSixDirectionsConf(c.Groudreward)
|
||||
}
|
||||
|
||||
if len(szConf) == 0 {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: fmt.Sprintf("conf not fount:%d", req.Groud),
|
||||
}
|
||||
return
|
||||
}
|
||||
for _, v := range floors {
|
||||
if d, ok := list.Data[v]; ok {
|
||||
curStr = 0
|
||||
star1 := 0
|
||||
for i := 0; i < 3; i++ {
|
||||
star1 = 1 << i
|
||||
if int(d.Star)&star1 == star1 {
|
||||
curStr++
|
||||
}
|
||||
}
|
||||
totalStar += curStr
|
||||
}
|
||||
}
|
||||
for _, v := range szConf {
|
||||
if list.Reward[req.Groud] < v.Starnum {
|
||||
list.Reward[req.Groud] = v.Starnum
|
||||
res = append(res, v.Reward...)
|
||||
}
|
||||
}
|
||||
if len(res) == 0 {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_UserNoReward,
|
||||
Title: pb.ErrorCode_UserNoReward.ToString(),
|
||||
Message: fmt.Sprintf("UserNoReward:%d", req.Groud),
|
||||
}
|
||||
return
|
||||
}
|
||||
if errdata, atno = this.module.DispenseAtno(session, res, true); errdata != nil {
|
||||
return
|
||||
}
|
||||
mapData := make(map[string]interface{}, 0)
|
||||
mapData["reward"] = list.Reward
|
||||
this.module.modelRacePagoda.ModifyPagodaRaceData(session.GetUserId(), mapData)
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), "racereward", &pb.PagodaRaceRewardResp{
|
||||
Data: list,
|
||||
Reward: atno,
|
||||
})
|
||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||
this.module.WriteUserLog(session.GetUserId(), req, comm.GMResAddType, "PagodaRaceRewardReq", atno)
|
||||
})
|
||||
|
||||
return
|
||||
}
|
@ -13,11 +13,12 @@ import (
|
||||
|
||||
const moduleName = "pagoda"
|
||||
const (
|
||||
game_pagoda = "game_pagoda.json"
|
||||
game_pagodaseasonreward = "game_pagodaseasonreward.json"
|
||||
game_pagodataskreward = "game_pagodataskreward.json"
|
||||
game_circulate = "game_circulate.json"
|
||||
game_sixdirections = "game_sixdirections.json"
|
||||
game_pagoda = "game_pagoda.json"
|
||||
game_pagodaseasonreward = "game_pagodaseasonreward.json"
|
||||
game_pagodataskreward = "game_pagodataskreward.json"
|
||||
game_circulate = "game_circulate.json"
|
||||
game_sixdirections = "game_sixdirections.json"
|
||||
game_sixdirectionsreward = "game_sixdirectionsreward.json"
|
||||
)
|
||||
|
||||
///配置管理基础组件
|
||||
@ -29,6 +30,8 @@ type configureComp struct {
|
||||
_mapFloor map[int32]int32 // key 页签 value 层数
|
||||
_mapRace map[int32]*cfg.GameCirculateData // 阵营塔
|
||||
circulate []int32
|
||||
|
||||
_mapSixReward map[int32][]*cfg.GameSixDirectionsRewardData // 六合塔奖励
|
||||
}
|
||||
|
||||
//组件初始化接口
|
||||
@ -40,10 +43,12 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
|
||||
game_pagoda: cfg.NewGamePagoda,
|
||||
game_circulate: cfg.NewGameCirculate,
|
||||
game_sixdirections: cfg.NewGameSixDirections,
|
||||
//game_sixdirectionsreward: cfg.NewGameSixDirectionsReward,
|
||||
})
|
||||
|
||||
configure.RegisterConfigure(game_pagoda, cfg.NewGamePagoda, this.LoadPagoda)
|
||||
configure.RegisterConfigure(game_circulate, cfg.NewGameCirculate, this.LoadCirculate)
|
||||
configure.RegisterConfigure(game_sixdirectionsreward, cfg.NewGameSixDirectionsReward, this.LoadSixDirections)
|
||||
|
||||
return
|
||||
}
|
||||
@ -229,3 +234,45 @@ func (this *configureComp) GetSixPagodaConf(id int32) (data *cfg.GameSixDirectio
|
||||
err = comm.NewNotFoundConfErr(moduleName, game_sixdirections, id)
|
||||
return
|
||||
}
|
||||
|
||||
func (this *configureComp) LoadSixDirections() {
|
||||
_m := make(map[int32][]*cfg.GameSixDirectionsRewardData, 0)
|
||||
if v, err := this.GetConfigure(game_sixdirectionsreward); err == nil {
|
||||
if configure, ok := v.(*cfg.GameSixDirectionsReward); ok {
|
||||
for _, v1 := range configure.GetDataList() {
|
||||
_m[v1.Boxid] = append(_m[v1.Boxid], v1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.hlock.Lock()
|
||||
this._mapSixReward = make(map[int32][]*cfg.GameSixDirectionsRewardData)
|
||||
this._mapSixReward = _m
|
||||
this.hlock.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
// 奖励组
|
||||
func (this *configureComp) GetSixDirectionsGroudConf(groud int32) (sz []int32) {
|
||||
var (
|
||||
v interface{}
|
||||
err error
|
||||
)
|
||||
if v, err = this.GetConfigure(game_sixdirections); err == nil {
|
||||
if configure, ok := v.(*cfg.GameSixDirections); ok {
|
||||
for _, v := range configure.GetDataList() {
|
||||
if v.Groud == groud {
|
||||
sz = append(sz, v.Floors)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (this *configureComp) GetSixDirectionsConf(boxid int32) (conf []*cfg.GameSixDirectionsRewardData) {
|
||||
this.hlock.RLock()
|
||||
conf, _ = this._mapSixReward[boxid]
|
||||
this.hlock.RUnlock()
|
||||
return
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ func (this *Pagoda) GMModifyRacePagoda(uid string, floor int32) {
|
||||
update["rtime"] = data.Rtime
|
||||
update["battlecount"] = data.Battlecount
|
||||
update["maxfloor"] = data.Maxfloor
|
||||
this.modelPagoda.modifyPagodaDataByObjId(uid, update)
|
||||
this.modelRacePagoda.ModifyPagodaRaceData(uid, update)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -1271,7 +1271,8 @@ type PagodaRaceRewardResp struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Data *DBPagodaRace `protobuf:"bytes,1,opt,name=data,proto3" json:"data"`
|
||||
Data *DBPagodaRace `protobuf:"bytes,1,opt,name=data,proto3" json:"data"`
|
||||
Reward []*UserAtno `protobuf:"bytes,2,rep,name=reward,proto3" json:"reward"`
|
||||
}
|
||||
|
||||
func (x *PagodaRaceRewardResp) Reset() {
|
||||
@ -1313,6 +1314,13 @@ func (x *PagodaRaceRewardResp) GetData() *DBPagodaRace {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *PagodaRaceRewardResp) GetReward() []*UserAtno {
|
||||
if x != nil {
|
||||
return x.Reward
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_pagoda_pagoda_msg_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_pagoda_pagoda_msg_proto_rawDesc = []byte{
|
||||
@ -1432,12 +1440,14 @@ var file_pagoda_pagoda_msg_proto_rawDesc = []byte{
|
||||
0x61, 0x6e, 0x6b, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x6b, 0x73, 0x22, 0x2b, 0x0a, 0x13, 0x50, 0x61,
|
||||
0x67, 0x6f, 0x64, 0x61, 0x52, 0x61, 0x63, 0x65, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65,
|
||||
0x71, 0x12, 0x14, 0x0a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
|
||||
0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x64, 0x22, 0x39, 0x0a, 0x14, 0x50, 0x61, 0x67, 0x6f, 0x64,
|
||||
0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x64, 0x22, 0x5c, 0x0a, 0x14, 0x50, 0x61, 0x67, 0x6f, 0x64,
|
||||
0x61, 0x52, 0x61, 0x63, 0x65, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12,
|
||||
0x21, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e,
|
||||
0x44, 0x42, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x52, 0x61, 0x63, 0x65, 0x52, 0x04, 0x64, 0x61,
|
||||
0x74, 0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x33,
|
||||
0x74, 0x61, 0x12, 0x21, 0x0a, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x03,
|
||||
0x28, 0x0b, 0x32, 0x09, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x74, 0x6e, 0x6f, 0x52, 0x06, 0x72,
|
||||
0x65, 0x77, 0x61, 0x72, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -1516,11 +1526,12 @@ var file_pagoda_pagoda_msg_proto_depIdxs = []int32{
|
||||
35, // 20: PagodaGetRaceResp.data:type_name -> DBPagodaRace
|
||||
36, // 21: PagodaCrossRaceRankListResp.ranks:type_name -> DBRaceRank
|
||||
35, // 22: PagodaRaceRewardResp.data:type_name -> DBPagodaRace
|
||||
23, // [23:23] is the sub-list for method output_type
|
||||
23, // [23:23] is the sub-list for method input_type
|
||||
23, // [23:23] is the sub-list for extension type_name
|
||||
23, // [23:23] is the sub-list for extension extendee
|
||||
0, // [0:23] is the sub-list for field type_name
|
||||
29, // 23: PagodaRaceRewardResp.reward:type_name -> UserAtno
|
||||
24, // [24:24] is the sub-list for method output_type
|
||||
24, // [24:24] is the sub-list for method input_type
|
||||
24, // [24:24] is the sub-list for extension type_name
|
||||
24, // [24:24] is the sub-list for extension extendee
|
||||
0, // [0:24] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_pagoda_pagoda_msg_proto_init() }
|
||||
|
Loading…
Reference in New Issue
Block a user