This commit is contained in:
liwei1dao 2023-06-09 13:50:39 +08:00
commit 4c633216c6
11 changed files with 145 additions and 54 deletions

View File

@ -163,7 +163,7 @@ type (
CheckTujianHero(session IUserSession, heros []string) []bool
// bingo设置玩家等级
BingoSetUserLv(session IUserSession, lv int32) error
BingoSetUserVipLv(session IUserSession, lv int32) error
BingoSetUserVipLv(session IUserSession, lv int32) (errdata *pb.ErrorData)
//添加皮肤资源接口
AddPer(session IUserSession, pers map[string]int32, bPush bool) (errdata *pb.ErrorData)
}
@ -310,7 +310,7 @@ type (
}
// 修改爬塔
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) // 查询玩家最佳通关记录
// Check Rtype84 Rtype85 Rtype86

View File

@ -11,7 +11,7 @@ import (
//bingo:equi,xxx,1 // xxx 装备id
3修改心魔塔进度bingo:pataid,1010代表层数
3修改心魔塔进度bingo:pataid,1,10页签+层数
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: "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)
if err != nil {
return
}
num, err := strconv.Atoi(datas[1])
d1, err := strconv.Atoi(datas[1])
if err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ReqParameterError,
@ -107,11 +107,20 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er
}
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 ",
log.Field{Key: "uid", Value: session.GetUserId()},
log.Field{Key: "0", Value: datas[0]},
log.Field{Key: "N", Value: int32(num)},
log.Field{Key: "p0", Value: datas[0]},
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") {
var (
@ -469,7 +478,8 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er
}
return
}
if err = module1.(comm.IUser).BingoSetUserVipLv(session, int32(num)); err == nil {
if errdata = module1.(comm.IUser).BingoSetUserVipLv(session, int32(num)); errdata != nil {
return
}
this.Debug("使用bingo命令:uid = %s ",
log.Field{Key: "uid", Value: session.GetUserId()},

View File

@ -94,3 +94,24 @@ func (this *configureComp) GetHuntingBossTypeConfigData() (mapType map[int32]str
}
return
}
// 警告: 此接口只允许GM调用
func (this *configureComp) GetHuntingBossAllData() (data map[int32]int32) {
data = make(map[int32]int32)
if v, err := this.GetConfigure(game_huntingboss); err == nil {
if configure, ok := v.(*cfg.GameHuntingBoss); ok {
for _, value := range configure.GetDataList() {
if v1, ok := data[value.Type]; !ok {
data[value.Type] = value.Difficulty
} else {
if v1 < value.Difficulty {
data[value.Type] = value.Difficulty
}
}
}
}
}
return
}

View File

@ -182,26 +182,19 @@ func (this *Hunting) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (
// 解锁远征所有难度
func (this *Hunting) CompleteAllLevel(session comm.IUserSession) (errdata *pb.ErrorData) {
list, err := this.modelHunting.getHuntingList(session.GetUserId())
if err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return
list, _ := this.modelHunting.getHuntingList(session.GetUserId())
list.Boss = make(map[int32]int32)
list.BossTime = make(map[string]int32)
conf := this.configure.GetHuntingBossAllData()
for k, v := range conf {
list.Boss[k] = v
}
mapData := make(map[string]interface{}, 0)
// 查配置获取每个Boss的最大难度
for k := range list.Boss {
for i := 1; ; i++ {
conf, _ := this.configure.GetHuntingBossConfigData(k, int32(i))
if conf == nil {
list.Boss[k] = int32(i - 1)
}
}
}
mapData["boss"] = list.Boss
mapData["bossTime"] = list.BossTime
errdata = this.ModifyHuntingData(session.GetUserId(), mapData)
session.SendMsg(string(this.GetType()), HuntingGetListResp, &pb.HuntingGetListResp{Data: list})

View File

@ -1,6 +1,7 @@
package pagoda
import (
"fmt"
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log"
@ -25,6 +26,7 @@ type configureComp struct {
hlock sync.RWMutex
_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)
configure.RegisterConfigure(game_passcheck, cfg.NewGamePassCheck, this.LoadPassCheck)
configure.RegisterConfigure(game_pagoda, cfg.NewGamePagoda, this.LoadPagoda)
return
}
@ -161,3 +163,29 @@ func (this *configureComp) GetPagodaConfigData(id int32) (data *cfg.GamePagodaDa
err = comm.NewNotFoundConfErr(moduleName, game_pagoda, id)
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 调用修改爬塔层数
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())
if list != nil {
list.PagodaId = level
mapData := make(map[string]interface{}, 0)
mapData["pagodaId"] = level
// 通关校验
_, err := this.configure.GetPagodaConfigData(level + 1)
if err == nil {
list.Complete = true
mapData["complete"] = true
//参数校验
_, err := this.configure.GetPagodaConfBytab(d1, d2)
if err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound,
Title: pb.ErrorCode_ConfigNoFound.ToString(),
Message: err.Error(),
}
errdata = this.ModifyPagodaData(session.GetUserId(), mapData)
session.SendMsg(string(this.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: list})
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)
session.SendMsg(string(this.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: list})
return
}

View File

@ -999,16 +999,28 @@ func (this *User) recoverUserPs(uid string) {
}
}
func (this *User) BingoSetUserVipLv(session comm.IUserSession, lv int32) error {
func (this *User) BingoSetUserVipLv(session comm.IUserSession, lv int32) (errdata *pb.ErrorData) {
if lv <= 0 {
return comm.NewCustomError(pb.ErrorCode_ReqParameterError)
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound,
Title: pb.ErrorCode_ConfigNoFound.ToString(),
}
return
}
update := map[string]interface{}{
"vip": lv,
"vipexp": 0,
}
// vip 等级校验
if conf := this.configure.GetVipConfigureData(lv); conf == nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound,
Title: pb.ErrorCode_ConfigNoFound.ToString(),
}
return
}
if err := this.modelUser.Change(session.GetUserId(), update); err == nil {
if err := session.SendMsg(string(this.GetType()), UserSubTypeLvChangedPush,
if err := session.SendMsg(string(this.GetType()), UserSubTypeVipChangedPush,
&pb.UserVipChangedPush{Uid: session.GetUserId(), VipExp: 0, VipLv: lv}); err != nil {
this.Error("Bingo玩家等级变化 UserVipChangedPush推送失败",
log.Field{Key: "uid", Value: session.GetUserId()},
@ -1032,8 +1044,8 @@ func (this *User) AddPer(session comm.IUserSession, pers map[string]int32, bPush
)
if user = this.GetUser(session.GetUserId()); user == nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_UserSessionNobeing,
Title: pb.ErrorCode_UserSessionNobeing.ToString(),
Code: pb.ErrorCode_UserSessionNobeing,
Title: pb.ErrorCode_UserSessionNobeing.ToString(),
}
return
}

View File

@ -44,6 +44,8 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
log.Errorf("get game_viking conf err:%v", err)
return
})
this.GetVikingBossAllData()
return
}
@ -90,3 +92,24 @@ func (this *configureComp) GetVikingBossTypeConfigData() map[int32]struct{} {
}
return mapType
}
// 警告: 此接口只允许GM调用
func (this *configureComp) GetVikingBossAllData() (data map[int32]int32) {
data = make(map[int32]int32)
if v, err := this.GetConfigure(game_vikingboss); err == nil {
if configure, ok := v.(*cfg.GameVikingBoss); ok {
for _, value := range configure.GetDataList() {
if v1, ok := data[value.Bossid]; !ok {
data[value.Bossid] = value.Difficulty
} else {
if v1 < value.Difficulty {
data[value.Bossid] = value.Difficulty
}
}
}
}
}
return
}

View File

@ -200,17 +200,17 @@ func (this *Viking) CompleteAllLevel(session comm.IUserSession) (errdata *pb.Err
}
return
}
mapData := make(map[string]interface{}, 0)
// 查配置获取每个Boss的最大难度
for k := range list.Boss {
for i := 1; ; i++ {
conf, _ := this.configure.GetVikingBossConfigData(k, int32(i))
if conf == nil {
list.Boss[k] = int32(i - 1)
}
}
list.Boss = make(map[int32]int32)
list.BossTime = make(map[string]int32)
conf := this.configure.GetVikingBossAllData()
for k, v := range conf {
list.Boss[k] = v
}
mapData := make(map[string]interface{}, 0)
mapData["boss"] = list.Boss
mapData["bossTime"] = list.BossTime
errdata = this.ModifyVikingData(session.GetUserId(), mapData)
session.SendMsg(string(this.GetType()), VikingGetListResp, &pb.VikingGetListResp{Data: list})

View File

@ -222,6 +222,7 @@ func (this *ModelWorldtask) taskFinishPush(session comm.IUserSession, userTask *
// 章节完成
if _, ok := userTask.Chapters[curTaskConf.Group]; !ok {
delete(userTask.CurrentTasks, curTaskConf.Group)
delete(nextTask, curTaskConf.Group)
if userTask.Chapters == nil {
userTask.Chapters = make(map[int32]int32)
}