GM 循环塔跳关
This commit is contained in:
parent
1046349550
commit
a1d5836ef1
@ -330,7 +330,7 @@ type (
|
||||
ModifyPagodaFloor(session IUserSession, d1 int32, d2 int32) (errdata *pb.ErrorData)
|
||||
CheckUserBasePagodaInfo(uid string) (data *pb.DBPagodaRecord) // 查询玩家最佳通关记录
|
||||
CheckCompletePagoda(uid string) (bComplete bool) // 校验是否通关普通塔
|
||||
|
||||
GMModifyRacePagoda(uid string, key int32, floor int32)
|
||||
///红点
|
||||
IGetReddot
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ import (
|
||||
24、bingo:cleannpc
|
||||
31、bingo:jx // 获得所有教习资源
|
||||
32、bingo:godlike // 一键超神
|
||||
33、bingo:race,1,10
|
||||
*/
|
||||
//参数校验
|
||||
func (this *apiComp) CmdCheck(session comm.IUserSession, req *pb.GMCmdReq) (errdata *pb.ErrorData) {
|
||||
|
@ -545,6 +545,39 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er
|
||||
if errdata = module1.(comm.IHoroscope).GMFulllevel(session); errdata != nil {
|
||||
return
|
||||
}
|
||||
this.Debug("使用bingo命令:uid = %s ",
|
||||
log.Field{Key: "uid", Value: session.GetUserId()},
|
||||
log.Field{Key: "0", Value: datas[0]},
|
||||
)
|
||||
} else if len(datas) == 3 && (datas[0] == "race") { // 一键超神
|
||||
var (
|
||||
num1 int
|
||||
num2 int
|
||||
err error
|
||||
)
|
||||
module1, err := this.service.GetModule(comm.ModulePagoda)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
num1, err = strconv.Atoi(datas[1])
|
||||
if err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ReqParameterError,
|
||||
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
num2, err = strconv.Atoi(datas[2])
|
||||
if err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ReqParameterError,
|
||||
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
module1.(comm.IPagoda).GMModifyRacePagoda(session.GetUserId(), int32(num1), int32(num2))
|
||||
|
||||
this.Debug("使用bingo命令:uid = %s ",
|
||||
log.Field{Key: "uid", Value: session.GetUserId()},
|
||||
log.Field{Key: "0", Value: datas[0]},
|
||||
|
@ -18,7 +18,6 @@ func (this *apiComp) GetRace(session comm.IUserSession, req *pb.PagodaGetRaceReq
|
||||
|
||||
var (
|
||||
bChange bool
|
||||
bSesaon bool // 循环塔id
|
||||
)
|
||||
list, err := this.module.modelRacePagoda.getPagodaRaceList(session.GetUserId())
|
||||
if err != nil {
|
||||
@ -37,13 +36,24 @@ func (this *apiComp) GetRace(session comm.IUserSession, req *pb.PagodaGetRaceReq
|
||||
list.Race[k].Defeat = 0
|
||||
bChange = true
|
||||
}
|
||||
if k >= 10 {
|
||||
bSesaon = true
|
||||
}
|
||||
// 校验循环塔是否过期
|
||||
if v.Endtime < configure.Now().Unix() {
|
||||
list.Race[k] = &pb.RaceData{
|
||||
Race: 10,
|
||||
var cir int32 // 循环
|
||||
c := this.module.configure.GetRaceCirculateConf()
|
||||
for pos, v := range c {
|
||||
if v == k {
|
||||
pos += 1
|
||||
if pos >= len(c) {
|
||||
cir = c[0]
|
||||
} else {
|
||||
cir = c[pos]
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
delete(list.Race, k)
|
||||
list.Race[cir] = &pb.RaceData{
|
||||
Race: cir,
|
||||
Task: []int32{},
|
||||
Rtime: configure.Now().Unix(),
|
||||
Defeat: 0,
|
||||
@ -53,17 +63,7 @@ func (this *apiComp) GetRace(session comm.IUserSession, req *pb.PagodaGetRaceReq
|
||||
bChange = true
|
||||
}
|
||||
}
|
||||
if !bSesaon {
|
||||
list.Race[10] = &pb.RaceData{ // 第一赛季阵营id默认就是10
|
||||
Race: 10,
|
||||
Task: []int32{},
|
||||
Rtime: configure.Now().Unix(),
|
||||
Defeat: 0,
|
||||
Endtime: this.module.GetSeasonData(),
|
||||
Curfloor: 0,
|
||||
}
|
||||
bChange = true
|
||||
}
|
||||
|
||||
if bChange {
|
||||
mapData := make(map[string]interface{}, 0)
|
||||
mapData["race"] = list.Race
|
||||
|
@ -30,6 +30,7 @@ type configureComp struct {
|
||||
_mapPagoda map[int32]*cfg.GamePagodaData
|
||||
_mapFloor map[int32]int32 // key 页签 value 层数
|
||||
_mapRace map[int32]*cfg.GameCirculateData // 阵营塔
|
||||
circulate []int32
|
||||
}
|
||||
|
||||
//组件初始化接口
|
||||
@ -45,7 +46,6 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
|
||||
configure.RegisterConfigure(game_passcheck, cfg.NewGamePassCheck, this.LoadPassCheck)
|
||||
configure.RegisterConfigure(game_pagoda, cfg.NewGamePagoda, this.LoadPagoda)
|
||||
configure.RegisterConfigure(game_circulate, cfg.NewGameCirculate, this.LoadCirculate)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@ -201,7 +201,7 @@ func (this *configureComp) GetPagodaConfBytab(tab int32, ly int32) (data *cfg.Ga
|
||||
}
|
||||
|
||||
func (this *configureComp) LoadCirculate() {
|
||||
|
||||
_m := make(map[int32]struct{}, 0)
|
||||
if v, err := this.GetConfigure(game_circulate); err == nil {
|
||||
if configure, ok := v.(*cfg.GameCirculate); ok {
|
||||
this.hlock.Lock()
|
||||
@ -209,6 +209,12 @@ func (this *configureComp) LoadCirculate() {
|
||||
this._mapRace = make(map[int32]*cfg.GameCirculateData)
|
||||
for _, value := range configure.GetDataList() {
|
||||
this._mapRace[value.Restriction<<16+value.Floors] = value
|
||||
if value.Name == 1 {
|
||||
if _, ok := _m[value.Restriction]; !ok {
|
||||
_m[value.Restriction] = struct{}{}
|
||||
this.circulate = append(this.circulate, value.Restriction)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -242,3 +248,7 @@ func (this *configureComp) GetPagodaRaceConfById(id int32) (data *cfg.GameCircul
|
||||
err = comm.NewNotFoundConfErr(moduleName, game_circulate, id)
|
||||
return
|
||||
}
|
||||
|
||||
func (this *configureComp) GetRaceCirculateConf() []int32 {
|
||||
return this.circulate
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"go_dreamfactory/lego/sys/mgo"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/sys/configure"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
@ -37,6 +38,16 @@ func (this *ModelRace) getPagodaRaceList(uid string) (result *pb.DBPagodaRace, e
|
||||
result.Id = primitive.NewObjectID().Hex()
|
||||
result.Uid = uid
|
||||
result.Race = make(map[int32]*pb.RaceData)
|
||||
if c := this.module.configure.GetRaceCirculateConf(); len(c) > 0 {
|
||||
result.Race[c[0]] = &pb.RaceData{ // 第一赛季阵营id默认就是10
|
||||
Race: c[0],
|
||||
Task: []int32{},
|
||||
Rtime: configure.Now().Unix(),
|
||||
Defeat: 0,
|
||||
Endtime: this.module.GetSeasonData(),
|
||||
Curfloor: 0,
|
||||
}
|
||||
}
|
||||
err = this.addPagodaRace(uid, result)
|
||||
|
||||
return
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
"go_dreamfactory/lego/sys/redis/pipe"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/sys/configure"
|
||||
"go_dreamfactory/sys/db"
|
||||
"go_dreamfactory/utils"
|
||||
|
||||
@ -226,3 +227,28 @@ func (this *Pagoda) SetRacePagodaRankList(tableName string, score int32, uid str
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (this *Pagoda) GMModifyRacePagoda(uid string, key int32, floor int32) {
|
||||
|
||||
if race, err := this.modelRacePagoda.getPagodaRaceList(uid); err == nil {
|
||||
if _, ok := race.Race[key]; ok {
|
||||
race.Race[key].Curfloor = floor
|
||||
} else {
|
||||
race.Race[key] = &pb.RaceData{
|
||||
Race: key,
|
||||
Task: []int32{},
|
||||
Rtime: configure.Now().Unix(),
|
||||
Defeat: 0,
|
||||
|
||||
Curfloor: 0,
|
||||
}
|
||||
if key >= 10 {
|
||||
race.Race[key].Endtime = this.GetSeasonData()
|
||||
}
|
||||
}
|
||||
mapData := make(map[string]interface{}, 0)
|
||||
mapData["race"] = race.Race
|
||||
this.modelRacePagoda.ModifyPagodaRaceDataByObjId(uid, mapData)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user