GM 解锁所有难度

This commit is contained in:
meixiongfeng 2023-06-09 11:08:02 +08:00
parent ad279e82b6
commit 4f0192d25f
4 changed files with 63 additions and 26 deletions

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

@ -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})