gm 跳转功夫大师塔

This commit is contained in:
meixiongfeng 2023-06-09 12:01:19 +08:00
parent 1267ff1129
commit 752ef2d4b1
5 changed files with 61 additions and 21 deletions

View File

@ -310,7 +310,7 @@ type (
} }
// 修改爬塔 // 修改爬塔
IPagoda interface { IPagoda interface {
ModifyPagodaFloor(session IUserSession, level int32) (errdata *pb.ErrorData) ModifyPagodaFloor(session IUserSession, d1 int32, d2 int32) (errdata *pb.ErrorData)
CheckUserBasePagodaInfo(uid string) (data *pb.DBPagodaRecord) // 查询玩家最佳通关记录 CheckUserBasePagodaInfo(uid string) (data *pb.DBPagodaRecord) // 查询玩家最佳通关记录
// Check Rtype84 Rtype85 Rtype86 // Check Rtype84 Rtype85 Rtype86

View File

@ -11,7 +11,7 @@ import (
//bingo:equi,xxx,1 // xxx 装备id //bingo:equi,xxx,1 // xxx 装备id
3修改心魔塔进度bingo:pataid,1010代表层数 3修改心魔塔进度bingo:pataid,1,10页签+层数
4修改玩家经验值bingo:attr,exp,10001000代表新增的经验值 // 4修改玩家经验值bingo:attr,exp,10001000代表新增的经验值 //

View File

@ -94,12 +94,12 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er
log.Field{Key: "T", Value: datas[1]}, log.Field{Key: "T", Value: datas[1]},
log.Field{Key: "N", Value: int32(num)}, log.Field{Key: "N", Value: int32(num)},
) )
} else if len(datas) == 2 && (datas[0] == "pataid") { } else if len(datas) == 3 && (datas[0] == "pataid") {
module1, err := this.service.GetModule(comm.ModulePagoda) module1, err := this.service.GetModule(comm.ModulePagoda)
if err != nil { if err != nil {
return return
} }
num, err := strconv.Atoi(datas[1]) d1, 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,
@ -107,11 +107,20 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er
} }
return return
} }
errdata = module1.(comm.IPagoda).ModifyPagodaFloor(session, int32(num)) d2, err := strconv.Atoi(datas[2])
if err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ReqParameterError,
Title: pb.ErrorCode_ReqParameterError.ToString(),
}
return
}
errdata = module1.(comm.IPagoda).ModifyPagodaFloor(session, int32(d1), int32(d2))
this.Debug("使用bingo命令:uid = %s ", this.Debug("使用bingo命令:uid = %s ",
log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "uid", Value: session.GetUserId()},
log.Field{Key: "0", Value: datas[0]}, log.Field{Key: "p0", Value: datas[0]},
log.Field{Key: "N", Value: int32(num)}, log.Field{Key: "p1", Value: datas[1]},
log.Field{Key: "p3", Value: datas[2]},
) )
} else if len(datas) == 1 && (datas[0] == "Iamyoudad" || datas[0] == "iamyoudad") { } else if len(datas) == 1 && (datas[0] == "Iamyoudad" || datas[0] == "iamyoudad") {
var ( var (

View File

@ -1,6 +1,7 @@
package pagoda package pagoda
import ( import (
"fmt"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log" "go_dreamfactory/lego/sys/log"
@ -25,6 +26,7 @@ type configureComp struct {
hlock sync.RWMutex hlock sync.RWMutex
_checkType map[int32][]*cfg.GamePassCheckData // key type _checkType map[int32][]*cfg.GamePassCheckData // key type
_mapPagoda map[int32]*cfg.GamePagodaData
} }
//组件初始化接口 //组件初始化接口
@ -38,7 +40,7 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
this._checkType = make(map[int32][]*cfg.GamePassCheckData, 0) this._checkType = make(map[int32][]*cfg.GamePassCheckData, 0)
configure.RegisterConfigure(game_passcheck, cfg.NewGamePassCheck, this.LoadPassCheck) configure.RegisterConfigure(game_passcheck, cfg.NewGamePassCheck, this.LoadPassCheck)
configure.RegisterConfigure(game_pagoda, cfg.NewGamePagoda, this.LoadPagoda)
return return
} }
@ -161,3 +163,29 @@ func (this *configureComp) GetPagodaConfigData(id int32) (data *cfg.GamePagodaDa
err = comm.NewNotFoundConfErr(moduleName, game_pagoda, id) err = comm.NewNotFoundConfErr(moduleName, game_pagoda, id)
return return
} }
func (this *configureComp) LoadPagoda() {
var err error
if v, err := this.GetConfigure(game_pagoda); err == nil {
if configure, ok := v.(*cfg.GamePagoda); ok {
this._mapPagoda = make(map[int32]*cfg.GamePagodaData)
this.hlock.Lock()
defer this.hlock.Unlock()
for _, value := range configure.GetDataList() {
key := value.Tab<<16 + value.LayerNum
this._mapPagoda[key] = value
}
return
}
}
log.Errorf("get game_pagoda conf err:%v", err)
return
}
func (this *configureComp) GetPagodaConfBytab(tab int32, ly int32) (data *cfg.GamePagoda, err error) {
if _, ok := this._mapPagoda[tab<<16+ly]; ok {
return
}
err = comm.NewNotFoundConfErr("pagoda", game_pagoda, fmt.Errorf("tab %d ,ly %d not found", tab, ly))
return
}

View File

@ -85,22 +85,25 @@ func (this *Pagoda) Start() (err error) {
} }
// 给gm 调用修改爬塔层数 // 给gm 调用修改爬塔层数
func (this *Pagoda) ModifyPagodaFloor(session comm.IUserSession, level int32) (errdata *pb.ErrorData) { func (this *Pagoda) ModifyPagodaFloor(session comm.IUserSession, d1 int32, d2 int32) (errdata *pb.ErrorData) {
list, _ := this.modelPagoda.getPagodaList(session.GetUserId()) list, _ := this.modelPagoda.getPagodaList(session.GetUserId())
if list != nil { //参数校验
_, err := this.configure.GetPagodaConfBytab(d1, d2)
list.PagodaId = level if err != nil {
mapData := make(map[string]interface{}, 0) errdata = &pb.ErrorData{
mapData["pagodaId"] = level Code: pb.ErrorCode_ConfigNoFound,
// 通关校验 Title: pb.ErrorCode_ConfigNoFound.ToString(),
_, err := this.configure.GetPagodaConfigData(level + 1) Message: err.Error(),
if err == nil {
list.Complete = true
mapData["complete"] = true
} }
return
}
list.Data[d1] = d2
list.PagodaId = d2
mapData := make(map[string]interface{}, 0)
mapData["data"] = list.Data
mapData["pagodaId"] = list.PagodaId
errdata = this.ModifyPagodaData(session.GetUserId(), mapData) errdata = this.ModifyPagodaData(session.GetUserId(), mapData)
session.SendMsg(string(this.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: list}) session.SendMsg(string(this.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: list})
}
return return
} }