版署功能同步 新增铁匠铺GM

This commit is contained in:
meixiongfeng 2023-08-21 18:58:55 +08:00
parent d473b3b005
commit 9c4659a4eb
4 changed files with 116 additions and 0 deletions

View File

@ -457,6 +457,8 @@ type (
ISmithy interface {
CheckActivateAtlasCollect(uid string, id string)
IGetReddot // 铁匠铺红点
GmProficiency(uid string)
GmSmithyAtlas(session IUserSession)
}
IPandaAtlas interface {

View File

@ -536,6 +536,36 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er
log.Field{Key: "param", Value: datas[0]},
log.Field{Key: "res", Value: res},
)
} else if len(datas) == 1 && (datas[0] == "smithyatlas") { // gm
var (
err error
)
module1, err := this.service.GetModule(comm.ModuleSmithy)
if err != nil {
return
}
module1.(comm.ISmithy).GmSmithyAtlas(session)
this.Debug("使用bingo命令:uid = %s ",
log.Field{Key: "uid", Value: session.GetUserId()},
log.Field{Key: "0", Value: datas[0]},
)
} else if len(datas) == 1 && (datas[0] == "smithypro") { // gm
var (
err error
)
module1, err := this.service.GetModule(comm.ModuleSmithy)
if err != nil {
return
}
module1.(comm.ISmithy).GmProficiency(session.GetUserId())
this.Debug("使用bingo命令:uid = %s ",
log.Field{Key: "uid", Value: session.GetUserId()},
log.Field{Key: "0", Value: datas[0]},
)
}
}
}

View File

@ -332,3 +332,30 @@ func (this *configureComp) GetSmithyMake(cid int32) (data *cfg.GameSmithyMakeDat
err = comm.NewNotFoundConfErr(moduleName, game_smithymake, cid)
return
}
// gm 查询 不管性能
func (this *configureComp) GmGetProficileData() (conf map[int32]int32) {
conf = make(map[int32]int32, 0)
if v, err := this.GetConfigure(game_smproficiency); err == nil {
if configure, ok := v.(*cfg.GameSmithyProficiency); ok {
for _, v := range configure.GetDataList() {
if _, ok := conf[v.ReelId]; !ok {
conf[v.ReelId] = v.ProficiencyLv
}
conf[v.ReelId] = v.ProficiencyLv
}
return
}
}
return
}
func (this *configureComp) GmGetAllAtlasConf() (data []*cfg.GameSmithyAtlasData) {
if v, err := this.GetConfigure(game_smithyatlas); err == nil {
if configure, ok := v.(*cfg.GameSmithyAtlas); ok {
data = configure.GetDataList()
}
}
return
}

View File

@ -12,6 +12,7 @@ import (
"go_dreamfactory/modules"
"go_dreamfactory/pb"
"go_dreamfactory/sys/configure"
cfg "go_dreamfactory/sys/configure/structs"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
@ -149,3 +150,59 @@ func (this *Smithy) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (r
}
return
}
// gm 不管性能
func (this *Smithy) GmProficiency(uid string) {
stove, err := this.modelStove.getSmithyStoveList(uid)
if err != nil {
return
}
conf := this.configure.GmGetProficileData()
for k, v := range conf {
if c := this.configure.GetSmithyProficileData(k, v); c != nil {
stove.Data[k] = &pb.Mastery{
Lv: v,
Value: c.Proficiency,
}
}
}
update := make(map[string]interface{})
update["data"] = stove.Data
this.modelStove.updateSmithyStove(uid, update)
}
// gm 新增图鉴信息
func (this *Smithy) GmSmithyAtlas(session comm.IUserSession) {
var (
res []*cfg.Gameatn
)
conf := this.configure.GmGetAllAtlasConf()
for _, v := range conf {
for _, v1 := range this.configure.GetAllEquipmentConfigure() {
if v1.AtlasId == v.Id {
res = append(res, &cfg.Gameatn{
A: "equi",
T: v1.Id,
N: 1,
})
break
}
}
}
if errdata, atno := this.DispenseAtno(session, res, true); errdata == nil {
ids := make([]string, 0)
for _, v := range atno {
ids = append(ids, v.O)
if equip, errdata := this.ModuleEquipment.QueryEquipment(session.GetUserId(), v.O); errdata == nil {
this.modelAtlas.CheckActivateEquipAtlas(session.GetUserId(), []*pb.DB_Equipment{equip}, 1)
}
}
}
}