This commit is contained in:
liwei1dao 2023-08-18 15:38:36 +08:00
commit 1f4ac80e88
8 changed files with 56 additions and 81 deletions

View File

@ -105,8 +105,7 @@ type (
CleanData(uid string) CleanData(uid string)
// 获取指定星级等级的英雄 // 获取指定星级等级的英雄
GetSpecifiedHero(session IUserSession, heroConfId string, star, lv int32) (errdata *pb.ErrorData) GetSpecifiedHero(session IUserSession, heroConfId string, star, lv int32) (errdata *pb.ErrorData)
// 英雄加经验
//AddHeroExp(session IUserSession, heroObjID string, exp int32) (curAddExp int32, errdata *pb.ErrorData)
// 英雄加经验 // 英雄加经验
AddHerosExp(session IUserSession, heroObjs []string, exp int32) (curAddExp []int32, errdata *pb.ErrorData) AddHerosExp(session IUserSession, heroObjs []string, exp int32) (curAddExp []int32, errdata *pb.ErrorData)
// 英雄练功 // 英雄练功

View File

@ -312,44 +312,6 @@ func (this *Hero) CreateRepeatHeros(session comm.IUserSession, heros map[string]
return return
} }
// func (this *Hero) AddHeroExp(session comm.IUserSession, heroObjID string, exp int32) (curAddExp int32, errdata *pb.ErrorData) {
// var (
// _hero *pb.DBHero
// _changeHero []*pb.DBHero // 变化的英雄
// )
// if heroObjID == "" {
// return
// }
// if this.IsCross() {
// _hero = &pb.DBHero{}
// if model, err := this.GetDBModelByUid(session.GetUserId(), this.modelHero.TableName); err == nil {
// if err := model.GetListObj(session.GetUserId(), heroObjID, _hero); err != nil {
// this.Errorf("err:%v", err)
// return
// }
// curAddExp, errdata = this.modelHero.AddCardExp(session, _hero, exp, model)
// if errdata != nil {
// return
// }
// }
// } else {
// _hero, errdata = this.GetHeroByObjID(session.GetUserId(), heroObjID)
// if errdata != nil {
// return
// }
// curAddExp, errdata = this.modelHero.AddCardExp(session, _hero, exp, nil)
// if errdata != nil {
// return
// }
// }
// _changeHero = append(_changeHero, _hero) // 升级后的英雄 hero id 不变
// session.SendMsg(string(this.GetType()), "change", &pb.HeroChangePush{List: _changeHero})
// return
// }
// 英雄练功 // 英雄练功
func (this *Hero) KungFuHero(session comm.IUserSession, heroObjID string, bKongfu bool, kongfuUid string) (errdata *pb.ErrorData) { func (this *Hero) KungFuHero(session comm.IUserSession, heroObjID string, bKongfu bool, kongfuUid string) (errdata *pb.ErrorData) {
var ( var (

View File

@ -148,16 +148,19 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
return return
} }
// 加经验 // 加经验
var heroObjs []string if cfgHunting.Heroexp > 0 {
if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 { var heroObjs []string
for _, v := range req.Report.Info.Redflist[0].Team { if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 {
if cfgHunting.Heroexp > 0 && !v.Ishelp { // 助战英雄不加经验 for _, v := range req.Report.Info.Redflist[0].Team {
heroObjs = append(heroObjs, v.Oid) if !v.Ishelp { // 助战英雄不加经验
changExp[v.Oid] = cfgHunting.Heroexp heroObjs = append(heroObjs, v.Oid)
changExp[v.Oid] = cfgHunting.Heroexp
}
} }
} }
this.module.ModuleHero.AddHerosExp(session, heroObjs, cfgHunting.Heroexp)
} }
this.module.ModuleHero.AddHerosExp(session, heroObjs, cfgHunting.Heroexp)
errdata = this.module.ModifyHuntingData(session.GetUserId(), mapData) errdata = this.module.ModifyHuntingData(session.GetUserId(), mapData)
userExp, _ = this.module.ModuleUser.ConsumePsAddExp(session, consumPs) userExp, _ = this.module.ModuleUser.ConsumePsAddExp(session, consumPs)
session.SendMsg(string(this.module.GetType()), HuntingChallengeOverResp, &pb.HuntingChallengeOverResp{ session.SendMsg(string(this.module.GetType()), HuntingChallengeOverResp, &pb.HuntingChallengeOverResp{

View File

@ -148,15 +148,17 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MainlineCh
} }
// 加英雄经验 // 加英雄经验
var heroObjs []string if conf.HeroExp > 0 {
if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 { var heroObjs []string
for _, v := range req.Report.Info.Redflist[0].Team { if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 {
if conf.HeroExp > 0 && !v.Ishelp { // 助战英雄不加经验 for _, v := range req.Report.Info.Redflist[0].Team {
heroObjs = append(heroObjs, v.Oid) if !v.Ishelp { // 助战英雄不加经验
heroObjs = append(heroObjs, v.Oid)
}
} }
} }
this.module.ModuleHero.AddHerosExp(session, heroObjs, conf.HeroExp)
} }
this.module.ModuleHero.AddHerosExp(session, heroObjs, conf.HeroExp)
consumPs = info.Ps[req.Level] consumPs = info.Ps[req.Level]
if userExp, errdata = this.module.ModuleUser.ConsumePsAddExp(session, consumPs); errdata != nil { if userExp, errdata = this.module.ModuleUser.ConsumePsAddExp(session, consumPs); errdata != nil {

View File

@ -198,15 +198,17 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall
} }
} }
// 加英雄经验 // 加英雄经验
var heroObjs []string if stageConf.HeroExp > 0 {
if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 { var heroObjs []string
for _, v := range req.Report.Info.Redflist[0].Team { if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 {
if stageConf.HeroExp > 0 && !v.Ishelp { // 助战英雄不加经验 for _, v := range req.Report.Info.Redflist[0].Team {
heroObjs = append(heroObjs, v.Oid) if !v.Ishelp { // 助战英雄不加经验
heroObjs = append(heroObjs, v.Oid)
}
} }
} }
this.module.ModuleHero.AddHerosExp(session, heroObjs, stageConf.HeroExp)
} }
this.module.ModuleHero.AddHerosExp(session, heroObjs, stageConf.HeroExp)
rsp.HeroExp = stageConf.HeroExp rsp.HeroExp = stageConf.HeroExp
rsp.UserExp, _ = this.module.ModuleUser.ConsumePsAddExp(session, consumPs) rsp.UserExp, _ = this.module.ModuleUser.ConsumePsAddExp(session, consumPs)

View File

@ -95,15 +95,17 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
return return
} }
// 加经验 // 加经验
var heroObjs []string if conf.Exp > 0 {
if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 { var heroObjs []string
for _, v := range req.Report.Info.Redflist[0].Team { if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 {
if conf.Exp > 0 && !v.Ishelp { // 助战英雄不加经验 for _, v := range req.Report.Info.Redflist[0].Team {
heroObjs = append(heroObjs, v.Oid) if !v.Ishelp { // 助战英雄不加经验
heroObjs = append(heroObjs, v.Oid)
}
} }
} }
this.module.ModuleHero.AddHerosExp(session, heroObjs, conf.Exp)
} }
this.module.ModuleHero.AddHerosExp(session, heroObjs, conf.Exp)
pagoda.Data[conf.Tab] += 1 pagoda.Data[conf.Tab] += 1
pagoda.PagodaId = conf.Key pagoda.PagodaId = conf.Key

View File

@ -94,15 +94,17 @@ func (this *apiComp) ChallengeRaceOver(session comm.IUserSession, req *pb.Pagoda
} }
return return
} }
var heroObjs []string if conf.Exp > 0 {
if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 { var heroObjs []string
for _, v := range req.Report.Info.Redflist[0].Team { if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 {
if conf.Exp > 0 && !v.Ishelp { // 助战英雄不加经验 for _, v := range req.Report.Info.Redflist[0].Team {
heroObjs = append(heroObjs, v.Oid) if !v.Ishelp { // 助战英雄不加经验
heroObjs = append(heroObjs, v.Oid)
}
} }
} }
this.module.ModuleHero.AddHerosExp(session, heroObjs, conf.Exp)
} }
this.module.ModuleHero.AddHerosExp(session, heroObjs, conf.Exp)
race.Race[conf.Restriction].Curfloor += 1 race.Race[conf.Restriction].Curfloor += 1
race.Race[conf.Restriction].Defeat += 1 race.Race[conf.Restriction].Defeat += 1

View File

@ -177,21 +177,24 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
return return
} }
errdata = this.module.ModifyVikingData(session.GetUserId(), mapData) if errdata = this.module.ModifyVikingData(session.GetUserId(), mapData); errdata != nil {
return
}
// 加经验 // 加经验
var heroObjs []string if vikingCfg.Heroexp > 0 {
if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 { var heroObjs []string
for _, v := range req.Report.Info.Redflist[0].Team { if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 {
if vikingCfg.Heroexp > 0 && !v.Ishelp { // 助战英雄不加经验 for _, v := range req.Report.Info.Redflist[0].Team {
heroObjs = append(heroObjs, v.Oid) if !v.Ishelp { // 助战英雄不加经验
} heroObjs = append(heroObjs, v.Oid)
if v.Ishelp { } else {
bHelp = true bHelp = true
}
} }
} }
this.module.ModuleHero.AddHerosExp(session, heroObjs, vikingCfg.Heroexp)
} }
this.module.ModuleHero.AddHerosExp(session, heroObjs, vikingCfg.Heroexp)
userExp, _ = this.module.ModuleUser.ConsumePsAddExp(session, consumPs) userExp, _ = this.module.ModuleUser.ConsumePsAddExp(session, consumPs)
session.SendMsg(string(this.module.GetType()), VikingChallengeOverResp, &pb.VikingChallengeOverResp{ session.SendMsg(string(this.module.GetType()), VikingChallengeOverResp, &pb.VikingChallengeOverResp{