上传一下代码

This commit is contained in:
liwei1dao 2023-12-29 17:09:29 +08:00
parent ce0b0423f4
commit 6b55cd679a
6 changed files with 41 additions and 114 deletions

View File

@ -283,8 +283,8 @@ func (this *apiComp) ChallengeReward(session comm.IUserSession, req *pb.ArenaCha
}
}
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype130, 1))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype128, red.Integral))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype129, red.Dan))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype128, info.Integral))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype129, info.Dan))
session.SendMsg(string(this.module.GetType()), "challengereward", &pb.ArenaChallengeRewardResp{Issucc: true, Integral: info.Integral, Dan: info.Dan})
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {

View File

@ -49,8 +49,7 @@ func (this *apiComp) ChangeMts(session comm.IUserSession, req *pb.CapturesheepCh
}
session.SendMsg(string(this.module.GetType()), "changemts", &pb.CapturesheepChangeMtsResp{Mid: req.Mid})
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.ModuleBuried.TriggerBuried(session, comm.GetBuriedParam(comm.Rtype234, 1))
})
// go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
// })
return
}

View File

@ -33,6 +33,7 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
equipNum int32
minstar, minlv int32 = int32(99999), int32(99999)
hero *pb.DBHero
lvnum map[int32]int32 = make(map[int32]int32)
tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0)
)
@ -101,6 +102,13 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
}
}
lvnum[equipments[i].Lv]++
for k, _ := range lvnum {
if k > equipments[i].Lv {
lvnum[k]++
}
}
if suit == nil {
suit = &pb.DB_EquipmentSuit{
Suitid: confs[i].Suittype,
@ -113,7 +121,6 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
suit.Effect = true
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype93, 1, suit.Suitid, suit.Lv))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype46, 1, suit.Str, suit.Suitid))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype98, 1, suit.Lv))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype169, 1, suit.Suitid))
}
suits = append(suits, suit)
@ -129,7 +136,6 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
suit.Effect = true
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype93, 1, suit.Suitid, suit.Lv))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype46, 1, suit.Str, suit.Suitid))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype98, 1, suit.Lv))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype169, 1, suit.Suitid))
}
}
@ -139,6 +145,10 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
}
}
for k, v := range lvnum {
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype98, v, k))
}
//读取英雄原装备
for i, v := range hero.EquipID {
if v != "" {

View File

@ -587,7 +587,8 @@ func (this *Parkour) overtimer(task *timewheel.Task, args ...interface{}) {
},
Award: award[v.GetUserId()],
})
go this.AsynHandleSession(v, func(session comm.IUserSession) {
go this.AsynHandleSession(v.Clone(), func(session comm.IUserSession) {
this.ModuleBuried.TriggerBuried(v, comm.GetBuriedParam(comm.Rtype234, 1))
this.WriteUserLog(session.GetUserId(), "", 0, "ParkourRaceOverPush", award[v.GetUserId()])
})
sessions = append(sessions, v)
@ -632,11 +633,6 @@ func (this *Parkour) overtimer(task *timewheel.Task, args ...interface{}) {
}
}
}
for _, v := range sessions {
this.ModuleBuried.TriggerBuried(v, comm.GetBuriedParam(comm.Rtype234, 1))
v.Push()
this.PutUserSession(v)
}
}
}

View File

@ -288,31 +288,32 @@ func (this *ModelUser) computeLevel(change *pb.UserResChangedPush) (lvchange boo
}
func (this *ModelUser) changelv(session comm.IUserSession, lv int32, exp int64, name string, rewards []*cfg.Gameatn) {
var (
atno []*pb.UserAtno
errdata *pb.ErrorData
)
defer this.module.PutUserSession(session)
if err := session.SendMsg(string(this.module.GetType()), UserSubTypeLvChangedPush,
&pb.UserLvChangedPush{Uid: session.GetUserId(), Exp: exp, Lv: lv}); err != nil {
this.module.Error("玩家等级变化 UserSubTypeLvChangedPush推送失败",
log.Field{Key: "uid", Value: session.GetUserId()},
log.Field{Key: "exp", Value: exp},
log.Field{Key: "lv", Value: lv},
)
}
if errdata, atno = this.module.DispenseAtno(session, rewards, true); errdata != nil {
this.module.Error("资源发放",
log.Field{Key: "uid", Value: session.GetUserId()},
log.Field{Key: "rewards", Value: rewards},
)
}
this.module.chat.SendSysChatToUser(session, comm.ChatSystem12, lv, 0, name)
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
var (
atno []*pb.UserAtno
errdata *pb.ErrorData
tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0)
)
if err := session.SendMsg(string(this.module.GetType()), UserSubTypeLvChangedPush,
&pb.UserLvChangedPush{Uid: session.GetUserId(), Exp: exp, Lv: lv}); err != nil {
this.module.Error("玩家等级变化 UserSubTypeLvChangedPush推送失败",
log.Field{Key: "uid", Value: session.GetUserId()},
log.Field{Key: "exp", Value: exp},
log.Field{Key: "lv", Value: lv},
)
}
if errdata, atno = this.module.DispenseAtno(session, rewards, true); errdata != nil {
this.module.Error("资源发放",
log.Field{Key: "uid", Value: session.GetUserId()},
log.Field{Key: "rewards", Value: rewards},
)
}
this.module.chat.SendSysChatToUser(session, comm.ChatSystem12, lv, 0, name)
this.module.ModuleSys.CheckOpenCond(session.Clone(), comm.OpencondTypePlatlv, lv)
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype20, lv))
this.module.ModuleBuried.TriggerBuried(session, tasks...)
this.module.WriteUserLog(session.GetUserId(), fmt.Sprintf(" lv :%d, exp %d, name %s", lv, exp, name), comm.GMResAddType, "changelv", atno)
})
session.Push()
}

View File

@ -572,7 +572,7 @@ func (this *User) change(session comm.IUserSession, attrs map[string]int32) (atn
}
change.Exp += int64(add)
if lvchange, loseexp, rewards = this.modelUser.computeLevel(change); lvchange {
go this.modelUser.changelv(session.Clone(), change.Lv, change.Exp, user.Name, rewards)
this.modelUser.changelv(session, change.Lv, change.Exp, user.Name, rewards)
}
temp.N = temp.N - loseexp
case comm.VipExp:
@ -879,25 +879,6 @@ func (this *User) change(session comm.IUserSession, attrs map[string]int32) (atn
return
}
// // 用户资源
// func (this *User) AddAttributeValue(session comm.IUserSession, attr string, add int32, bPush bool) (errdata *pb.ErrorData) {
// var _change *pb.UserResChangedPush
// _change, errdata = this.change(session, attr, add)
// if errdata != nil {
// return
// }
// if _change == nil {
// return
// }
// if bPush { //推送玩家账号信息变化消息
// session.SendMsg(string(this.GetType()), "reschanged", _change)
// }
// return
// }
// 用户资源
func (this *User) AddAttributeValues(session comm.IUserSession, attrs map[string]int32, bPush bool) (atno []*pb.UserAtno, errdata *pb.ErrorData) {
var (
@ -1104,66 +1085,6 @@ func (this *User) BingoSetUserLv(session comm.IUserSession, lv int32) error {
return nil
}
// // 玩家体力恢复
// func (this *User) RecoverUserPsStart(session comm.IUserSession) (recoverTime int64) {
// var (
// yu int32
// add int32
// changed int32
// )
// // 推送红点信息
// re := this.ModuleTools.GetGlobalConf().PsRecovery
// if re <= 0 {
// return
// }
// u, err := this.GetUser(session.GetUserId())
// if err != nil {
// return
// }
// if u.LastRecoverPsSec == 0 {
// u.LastRecoverPsSec = configure.Now().Unix()
// }
// diff := configure.Now().Unix() - u.LastRecoverPsSec
// yu = int32(diff / int64(re))
// if yu > 0 {
// pconf := this.configure.GetPlayerlvConf(u.Lv)
// if pconf == nil {
// return
// }
// if u.Ps < pconf.PsCeiling {
// total := u.Ps + yu
// if total > pconf.PsCeiling {
// add = pconf.PsCeiling - u.Ps
// changed = pconf.PsCeiling
// } else {
// add = yu
// changed = total
// u.LastRecoverPsSec += int64(yu * re)
// }
// } else {
// add = 0
// }
// //u.LastRecoverPsSec = time.Now().Unix()
// update := map[string]interface{}{}
// if add > 0 {
// u.Ps += add
// update["ps"] = u.Ps
// update["lastRecoverPsSec"] = u.LastRecoverPsSec
// }
// if err := this.modelUser.Change(u.Uid, update); err == nil {
// if changed > 0 {
// this.reddot.PushReddot(session, &pb.ReddotItem{
// Rid: int32(comm.Reddot30100),
// Nextchanagetime: u.LastRecoverPsSec + int64(re),
// })
// session.Push()
// }
// }
// }
// recoverTime = u.LastRecoverPsSec + int64(re)
// return recoverTime
// }
// 玩家体力恢复
func (this *User) recoverUserPs(user *pb.DBUser) (change bool, total int32, nexttime int64) {
var (