主线任务默认第一章节
This commit is contained in:
parent
b4281c9c84
commit
690f23f480
@ -416,44 +416,6 @@ func (this *ModelHero) PushHeroProperty(session comm.IUserSession, heroId string
|
|||||||
return //session.SendMsg("hero", "property", &pb.HeroPropertyPush{Property: m})
|
return //session.SendMsg("hero", "property", &pb.HeroPropertyPush{Property: m})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 英雄升星
|
|
||||||
func (this *ModelHero) HeroStarUp(session comm.IUserSession, hero *pb.DBHero) (code pb.ErrorCode) {
|
|
||||||
|
|
||||||
_heroMap := map[string]interface{}{
|
|
||||||
"star": hero.Star + 1,
|
|
||||||
"isOverlying": false,
|
|
||||||
}
|
|
||||||
// 触发星级任务
|
|
||||||
this.moduleHero.ModuleTask.SendToTask(session, comm.TaskTypeUpHeroStar, &pb.TaskParam{First: hero.Star + 1})
|
|
||||||
// 保存数据
|
|
||||||
err1 := this.modifyHeroData(session.GetUserId(), hero.Id, _heroMap)
|
|
||||||
if err1 != nil {
|
|
||||||
code = pb.ErrorCode_DBError
|
|
||||||
this.moduleHero.Errorf("update hero skill failed:%v", err1)
|
|
||||||
}
|
|
||||||
// 计算属性
|
|
||||||
data := make(map[string]int32, 0)
|
|
||||||
newConfig := this.moduleHero.configure.GetHeroStar(hero.Star - 1)
|
|
||||||
if newConfig == nil {
|
|
||||||
|
|
||||||
code = pb.ErrorCode_ConfigurationException
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
data[comm.Hp] = int32(math.Floor((1.0 + float64(newConfig.StarupHp)) * float64(hero.Property[comm.Hp]) / 100))
|
|
||||||
data[comm.Atk] = int32(math.Floor((1.0 + float64(newConfig.StarupAtk)) * float64(hero.Property[comm.Atk]) / 100))
|
|
||||||
data[comm.Def] = int32(math.Floor((1.0 + float64(newConfig.StarupDef)) * float64(hero.Property[comm.Def]) / 100))
|
|
||||||
data[comm.Speed] = int32(math.Floor((1.0 + float64(newConfig.StarupSpeed)) * float64(hero.Property[comm.Speed]) / 100))
|
|
||||||
this.mergeMainProperty(session.GetUserId(), hero.Id, data)
|
|
||||||
|
|
||||||
err1 = this.PushHeroProperty(session, hero.Id) // 推送属性变化
|
|
||||||
if err1 != nil {
|
|
||||||
code = pb.ErrorCode_Unknown
|
|
||||||
this.moduleHero.Errorf("PushHeroProperty err!")
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *ModelHero) cleanData(uid string) {
|
func (this *ModelHero) cleanData(uid string) {
|
||||||
userList := this.moduleHero.GetHeroList(uid)
|
userList := this.moduleHero.GetHeroList(uid)
|
||||||
for _, v := range userList {
|
for _, v := range userList {
|
||||||
|
@ -31,7 +31,7 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.MainlineGetListR
|
|||||||
if len(list) == 0 { // 如果数量为0 则默认创建一条数据
|
if len(list) == 0 { // 如果数量为0 则默认创建一条数据
|
||||||
_data := &pb.DBMainline{}
|
_data := &pb.DBMainline{}
|
||||||
_data.Id = primitive.NewObjectID().Hex()
|
_data.Id = primitive.NewObjectID().Hex()
|
||||||
_data.ChapterId = 0
|
_data.ChapterId = 1 // 默认第一章节
|
||||||
_mData := make(map[string]interface{}, 0)
|
_mData := make(map[string]interface{}, 0)
|
||||||
_data.Uid = session.GetUserId()
|
_data.Uid = session.GetUserId()
|
||||||
_mData[_data.Id] = _data
|
_mData[_data.Id] = _data
|
||||||
|
Loading…
Reference in New Issue
Block a user