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)
|
hero = this.module.ModuleHero.GetVirtualHero(hero, vlv)
|
||||||
role.Lv = hero.Lv
|
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 {
|
for k, v := range hero.Property {
|
||||||
|
|
||||||
role.Property[k] += v
|
role.Property[k] += v
|
||||||
if k == cfg.GamePropertyType_Base_MaxHp_Base {
|
if k == cfg.GamePropertyType_Base_MaxHp_Base {
|
||||||
|
|
||||||
role.Currhp += v
|
role.Currhp += v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for k, v := range hero.AddProperty {
|
for k, v := range hero.AddProperty {
|
||||||
switch k {
|
switch k {
|
||||||
case cfg.GamePropertyType_Base_MaxHp_Per:
|
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])))
|
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:
|
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])))
|
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:
|
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])))
|
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:
|
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])))
|
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 {
|
for k, v := range hero.AddProperty {
|
||||||
//arrt := AttributesTransExt(k)
|
|
||||||
|
|
||||||
role.Property[k] += v
|
role.Property[k] += v
|
||||||
if k == cfg.GamePropertyType_Base_MaxHp_Base {
|
if k == cfg.GamePropertyType_Base_MaxHp_Base {
|
||||||
role.Currhp += v
|
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 {
|
for k, v := range hero.JuexProperty {
|
||||||
|
|
||||||
role.Property[k] += v
|
role.Property[k] += v
|
||||||
@ -849,6 +882,23 @@ func (this *modelBattleComp) createBattleRole(hero *pb.DBHero, vlv int32, tid, p
|
|||||||
role.Currhp += v
|
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 {
|
for k, v := range hero.HoroscopeProperty {
|
||||||
|
|
||||||
role.Property[k] += v
|
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["energyrecover"] = c.Energyrecover
|
||||||
dragon.Property["caddtime"] = c.Caddtime
|
dragon.Property["caddtime"] = c.Caddtime
|
||||||
dragon.Property["csubtime"] = c.Csubtime
|
dragon.Property["csubtime"] = c.Csubtime
|
||||||
|
dragon.Property["offsetspeed"] = c.Offsetspeed
|
||||||
update["property"] = dragon.Property // 更新属性
|
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["energyrecover"] = c.Energyrecover
|
||||||
dragon.Property["caddtime"] = c.Caddtime
|
dragon.Property["caddtime"] = c.Caddtime
|
||||||
dragon.Property["csubtime"] = c.Csubtime
|
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["itemsprint"] = c.Itemsprint
|
||||||
dragon.Property["caddtime"] = c.Caddtime
|
dragon.Property["caddtime"] = c.Caddtime
|
||||||
dragon.Property["csubtime"] = c.Csubtime
|
dragon.Property["csubtime"] = c.Csubtime
|
||||||
|
dragon.Property["offsetspeed"] = c.Offsetspeed
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -179,6 +180,7 @@ func (this *Dragon) GMModifyDragonLv(uid string, cid string, lv int32) (dragon *
|
|||||||
dragon.Property["energyrecover"] = c.Energyrecover
|
dragon.Property["energyrecover"] = c.Energyrecover
|
||||||
dragon.Property["caddtime"] = c.Caddtime
|
dragon.Property["caddtime"] = c.Caddtime
|
||||||
dragon.Property["csubtime"] = c.Csubtime
|
dragon.Property["csubtime"] = c.Csubtime
|
||||||
|
dragon.Property["offsetspeed"] = c.Offsetspeed
|
||||||
update["property"] = dragon.Property
|
update["property"] = dragon.Property
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -731,6 +731,15 @@ func (this *MapData) SkillUp(pos int32, color int32, skillid int32, value int32,
|
|||||||
}
|
}
|
||||||
case 3: // 将随机6个宝石染成当前盘面上颜色最多的宝石
|
case 3: // 将随机6个宝石染成当前盘面上颜色最多的宝石
|
||||||
this.SkillChangeColor(value)
|
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:
|
case 4:
|
||||||
x := int(pos / Width)
|
x := int(pos / Width)
|
||||||
y := int(pos % Height)
|
y := int(pos % Height)
|
||||||
@ -1290,7 +1299,7 @@ func (this *MapData) HitElem(color int32, curid int32) (szMap []*pb.MapData) {
|
|||||||
szMap = append(szMap, &pb.MapData{
|
szMap = append(szMap, &pb.MapData{
|
||||||
Data: this.GetPalatData(),
|
Data: this.GetPalatData(),
|
||||||
CurSocre: curScore,
|
CurSocre: curScore,
|
||||||
CurEnergy: 0,
|
CurEnergy: energy,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
sz, _ := this.CheckMap(color, false)
|
sz, _ := this.CheckMap(color, false)
|
||||||
@ -1488,9 +1497,15 @@ func (this *MapData) SkillChangeColor(count int32) {
|
|||||||
elemCount[v.Color] += 1
|
elemCount[v.Color] += 1
|
||||||
}
|
}
|
||||||
|
|
||||||
for k := range elemCount {
|
for _, v := range elemCount {
|
||||||
if color < k {
|
if color < v {
|
||||||
|
color = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for k, v := range elemCount {
|
||||||
|
if color == v {
|
||||||
color = k
|
color = k
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for i := 0; i < int(count); i++ {
|
for i := 0; i < int(count); i++ {
|
||||||
@ -1498,7 +1513,12 @@ func (this *MapData) SkillChangeColor(count int32) {
|
|||||||
if this.Plat[targetId].Color == color {
|
if this.Plat[targetId].Color == color {
|
||||||
i--
|
i--
|
||||||
} else {
|
} else {
|
||||||
|
if this.Plat[targetId].Special == 0 {
|
||||||
this.Plat[targetId].Color = color // 变更颜色
|
this.Plat[targetId].Color = color // 变更颜色
|
||||||
|
this.Plat[targetId].Cid = color // 变更颜色
|
||||||
|
this.oid++
|
||||||
|
this.Plat[targetId].Oid = this.oid // 变唯一id
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
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: "uid", Value: session.GetUserId()},
|
||||||
log.Field{Key: "0", Value: datas[0]},
|
log.Field{Key: "0", Value: datas[0]},
|
||||||
)
|
)
|
||||||
} else if len(datas) == 3 && (datas[0] == "race") { // 一键超神
|
} else if len(datas) == 2 && (datas[0] == "race") { // 一键超神
|
||||||
var (
|
var (
|
||||||
num2 int
|
num2 int
|
||||||
err error
|
err error
|
||||||
@ -567,7 +567,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
num2, err = strconv.Atoi(datas[2])
|
num2, err = strconv.Atoi(datas[1])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_ReqParameterError,
|
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]},
|
log.Field{Key: "0", Value: datas[1]},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -168,6 +168,36 @@ func Test_Main(t *testing.T) {
|
|||||||
szByte []byte
|
szByte []byte
|
||||||
)
|
)
|
||||||
szByte = make([]byte, 0)
|
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)
|
//szByte = append(szByte, 8)
|
||||||
fmt.Printf("%v,%s", szByte, string(szByte))
|
fmt.Printf("%v,%s", szByte, string(szByte))
|
||||||
@ -254,23 +284,6 @@ func Test_Main(t *testing.T) {
|
|||||||
}
|
}
|
||||||
defer trace.Stop()
|
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 list []int32
|
||||||
var list2 []int32
|
var list2 []int32
|
||||||
list = []int32{1, 2, 3, 4, 5, 6, 7, 8, 9}
|
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
|
return
|
||||||
}
|
}
|
||||||
// if list.Complete { // 这个版本不给赛季塔信息
|
|
||||||
// list, _ = this.module.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId())
|
|
||||||
// }
|
|
||||||
|
|
||||||
session.SendMsg(string(this.module.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: list})
|
session.SendMsg(string(this.module.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: list})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ func (this *apiComp) GetRace(session comm.IUserSession, req *pb.PagodaGetRaceReq
|
|||||||
err error
|
err error
|
||||||
update map[string]interface{}
|
update map[string]interface{}
|
||||||
)
|
)
|
||||||
update = make(map[string]interface{}, 0)
|
|
||||||
list, err = this.module.modelRacePagoda.getPagodaRaceList(session.GetUserId())
|
list, err = this.module.modelRacePagoda.getPagodaRaceList(session.GetUserId())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
@ -33,12 +33,11 @@ func (this *apiComp) GetRace(session comm.IUserSession, req *pb.PagodaGetRaceReq
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !utils.IsToday(list.Rtime) {
|
if !utils.IsToday(list.Rtime) {
|
||||||
|
update = make(map[string]interface{}, 0)
|
||||||
list.Rtime = configure.Now().Unix()
|
list.Rtime = configure.Now().Unix()
|
||||||
list.Battlecount = 0
|
list.Battlecount = 0
|
||||||
update["battlecount"] = list.Battlecount
|
update["battlecount"] = list.Battlecount
|
||||||
update["rtime"] = list.Rtime
|
update["rtime"] = list.Rtime
|
||||||
}
|
|
||||||
|
|
||||||
if err = this.module.modelRacePagoda.ModifyPagodaRaceData(session.GetUserId(), update); err != nil {
|
if err = this.module.modelRacePagoda.ModifyPagodaRaceData(session.GetUserId(), update); err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_DBError,
|
Code: pb.ErrorCode_DBError,
|
||||||
@ -46,7 +45,10 @@ func (this *apiComp) GetRace(session comm.IUserSession, req *pb.PagodaGetRaceReq
|
|||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
session.SendMsg(string(this.module.GetType()), PagodaGetRaceResp, &pb.PagodaGetRaceResp{})
|
session.SendMsg(string(this.module.GetType()), PagodaGetRaceResp, &pb.PagodaGetRaceResp{
|
||||||
|
Data: list,
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ func (this *apiComp) ChallengeRace(session comm.IUserSession, req *pb.PagodaChal
|
|||||||
}
|
}
|
||||||
|
|
||||||
if _, ok := pagoda.Data[conf.Floors]; !ok {
|
if _, ok := pagoda.Data[conf.Floors]; !ok {
|
||||||
if pagoda.Maxfloor != conf.Floors+1 {
|
if pagoda.Maxfloor+1 != conf.Floors {
|
||||||
errdata = &pb.ErrorData{ // 挑战关卡数据不匹配
|
errdata = &pb.ErrorData{ // 挑战关卡数据不匹配
|
||||||
Code: pb.ErrorCode_PagodaLevlErr,
|
Code: pb.ErrorCode_PagodaLevlErr,
|
||||||
Title: pb.ErrorCode_PagodaLevlErr.ToString(),
|
Title: pb.ErrorCode_PagodaLevlErr.ToString(),
|
||||||
|
@ -29,7 +29,6 @@ func (this *apiComp) ChallengeRaceOver(session comm.IUserSession, req *pb.Pagoda
|
|||||||
award []*cfg.Gameatn
|
award []*cfg.Gameatn
|
||||||
changExp map[string]int32
|
changExp map[string]int32
|
||||||
costTime int32 // 耗时
|
costTime int32 // 耗时
|
||||||
star int32 // 当前星级
|
|
||||||
new bool // 是否首次挑战
|
new bool // 是否首次挑战
|
||||||
)
|
)
|
||||||
changExp = make(map[string]int32, 0)
|
changExp = make(map[string]int32, 0)
|
||||||
@ -69,18 +68,23 @@ func (this *apiComp) ChallengeRaceOver(session comm.IUserSession, req *pb.Pagoda
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
costTime = req.Report.Costtime
|
costTime = req.Report.Costtime
|
||||||
if _, ok := list.Data[conf.Floors]; !ok {
|
if _, ok := list.Data[conf.Floors]; !ok {
|
||||||
if list.Maxfloor+1 == conf.Floors {
|
if list.Maxfloor+1 == conf.Floors {
|
||||||
list.Data[conf.Floors] = &pb.RaceData{
|
list.Data[conf.Floors] = &pb.RaceData{
|
||||||
Consttime: costTime,
|
Consttime: costTime,
|
||||||
Star: star,
|
Star: req.Star,
|
||||||
}
|
}
|
||||||
|
if req.Star > 0 {
|
||||||
list.Maxfloor = conf.Floors
|
list.Maxfloor = conf.Floors
|
||||||
mapData["maxfloor"] = list.Maxfloor
|
mapData["maxfloor"] = list.Maxfloor
|
||||||
|
}
|
||||||
new = true
|
new = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list.Data[conf.Floors].Star |= req.Star
|
||||||
list.Battlecount += 1
|
list.Battlecount += 1
|
||||||
mapData["data"] = list.Data
|
mapData["data"] = list.Data
|
||||||
mapData["battlecount"] = list.Battlecount
|
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 { // 小于之前的时间 入榜
|
if list.Data[conf.Floors].Consttime > costTime { // 小于之前的时间 入榜
|
||||||
this.module.modelRacePagoda.SetRacePagodaRankList(score, session.GetUserId())
|
this.module.modelRacePagoda.SetRacePagodaRankList(score, session.GetUserId())
|
||||||
}
|
}
|
||||||
|
award = append(award, conf.KeyReward...) // 首通奖励
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = this.module.modelRacePagoda.ModifyPagodaRaceData(session.GetUserId(), mapData); err != nil {
|
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
|
||||||
|
}
|
@ -18,6 +18,7 @@ const (
|
|||||||
game_pagodataskreward = "game_pagodataskreward.json"
|
game_pagodataskreward = "game_pagodataskreward.json"
|
||||||
game_circulate = "game_circulate.json"
|
game_circulate = "game_circulate.json"
|
||||||
game_sixdirections = "game_sixdirections.json"
|
game_sixdirections = "game_sixdirections.json"
|
||||||
|
game_sixdirectionsreward = "game_sixdirectionsreward.json"
|
||||||
)
|
)
|
||||||
|
|
||||||
///配置管理基础组件
|
///配置管理基础组件
|
||||||
@ -29,6 +30,8 @@ type configureComp struct {
|
|||||||
_mapFloor map[int32]int32 // key 页签 value 层数
|
_mapFloor map[int32]int32 // key 页签 value 层数
|
||||||
_mapRace map[int32]*cfg.GameCirculateData // 阵营塔
|
_mapRace map[int32]*cfg.GameCirculateData // 阵营塔
|
||||||
circulate []int32
|
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_pagoda: cfg.NewGamePagoda,
|
||||||
game_circulate: cfg.NewGameCirculate,
|
game_circulate: cfg.NewGameCirculate,
|
||||||
game_sixdirections: cfg.NewGameSixDirections,
|
game_sixdirections: cfg.NewGameSixDirections,
|
||||||
|
//game_sixdirectionsreward: cfg.NewGameSixDirectionsReward,
|
||||||
})
|
})
|
||||||
|
|
||||||
configure.RegisterConfigure(game_pagoda, cfg.NewGamePagoda, this.LoadPagoda)
|
configure.RegisterConfigure(game_pagoda, cfg.NewGamePagoda, this.LoadPagoda)
|
||||||
configure.RegisterConfigure(game_circulate, cfg.NewGameCirculate, this.LoadCirculate)
|
configure.RegisterConfigure(game_circulate, cfg.NewGameCirculate, this.LoadCirculate)
|
||||||
|
configure.RegisterConfigure(game_sixdirectionsreward, cfg.NewGameSixDirectionsReward, this.LoadSixDirections)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -229,3 +234,45 @@ func (this *configureComp) GetSixPagodaConf(id int32) (data *cfg.GameSixDirectio
|
|||||||
err = comm.NewNotFoundConfErr(moduleName, game_sixdirections, id)
|
err = comm.NewNotFoundConfErr(moduleName, game_sixdirections, id)
|
||||||
return
|
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["rtime"] = data.Rtime
|
||||||
update["battlecount"] = data.Battlecount
|
update["battlecount"] = data.Battlecount
|
||||||
update["maxfloor"] = data.Maxfloor
|
update["maxfloor"] = data.Maxfloor
|
||||||
this.modelPagoda.modifyPagodaDataByObjId(uid, update)
|
this.modelRacePagoda.ModifyPagodaRaceData(uid, update)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1272,6 +1272,7 @@ type PagodaRaceRewardResp struct {
|
|||||||
unknownFields protoimpl.UnknownFields
|
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() {
|
func (x *PagodaRaceRewardResp) Reset() {
|
||||||
@ -1313,6 +1314,13 @@ func (x *PagodaRaceRewardResp) GetData() *DBPagodaRace {
|
|||||||
return nil
|
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 protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_pagoda_pagoda_msg_proto_rawDesc = []byte{
|
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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
0x74, 0x61, 0x12, 0x21, 0x0a, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x03,
|
||||||
0x6f, 0x33,
|
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 (
|
var (
|
||||||
@ -1516,11 +1526,12 @@ var file_pagoda_pagoda_msg_proto_depIdxs = []int32{
|
|||||||
35, // 20: PagodaGetRaceResp.data:type_name -> DBPagodaRace
|
35, // 20: PagodaGetRaceResp.data:type_name -> DBPagodaRace
|
||||||
36, // 21: PagodaCrossRaceRankListResp.ranks:type_name -> DBRaceRank
|
36, // 21: PagodaCrossRaceRankListResp.ranks:type_name -> DBRaceRank
|
||||||
35, // 22: PagodaRaceRewardResp.data:type_name -> DBPagodaRace
|
35, // 22: PagodaRaceRewardResp.data:type_name -> DBPagodaRace
|
||||||
23, // [23:23] is the sub-list for method output_type
|
29, // 23: PagodaRaceRewardResp.reward:type_name -> UserAtno
|
||||||
23, // [23:23] is the sub-list for method input_type
|
24, // [24:24] is the sub-list for method output_type
|
||||||
23, // [23:23] is the sub-list for extension type_name
|
24, // [24:24] is the sub-list for method input_type
|
||||||
23, // [23:23] is the sub-list for extension extendee
|
24, // [24:24] is the sub-list for extension type_name
|
||||||
0, // [0:23] is the sub-list for field 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() }
|
func init() { file_pagoda_pagoda_msg_proto_init() }
|
||||||
|
Loading…
Reference in New Issue
Block a user