Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
c892485391
@ -172,6 +172,8 @@ type (
|
||||
SetUserCaravanLvChange(session IUserSession, caravanlv int32) error
|
||||
//消耗体力加经验
|
||||
ConsumePsAddExp(session IUserSession, ps int32) (addExp int32, errdata *pb.ErrorData)
|
||||
// 体力差
|
||||
RemainingPS(uid string) int32
|
||||
}
|
||||
//武器模块
|
||||
IEquipment interface {
|
||||
|
@ -16,6 +16,7 @@ func (this *apiComp) PuzzleAward(session comm.IUserSession, req *pb.UserPuzzleAw
|
||||
var (
|
||||
sign *pb.DBSign
|
||||
err error
|
||||
completeCount int32
|
||||
)
|
||||
|
||||
if sign, err = this.module.modelSign.GetUserSign(session.GetUserId()); err != nil {
|
||||
@ -41,6 +42,14 @@ func (this *apiComp) PuzzleAward(session comm.IUserSession, req *pb.UserPuzzleAw
|
||||
}
|
||||
|
||||
sign.Puzzle[req.Index] = 1
|
||||
for _, v := range sign.Puzzle {
|
||||
if v == 1 {
|
||||
completeCount++
|
||||
}
|
||||
}
|
||||
if conf := this.module.configure.GetSignExtarConf(completeCount, sign.Group); conf != nil {
|
||||
this.module.DispenseRes(session, conf.Extra, true) // 签到额外奖励
|
||||
}
|
||||
if err = this.module.modelSign.Change(session.GetUserId(), map[string]interface{}{
|
||||
"puzzle": sign.Puzzle,
|
||||
}); err != nil {
|
||||
|
@ -541,7 +541,7 @@ func (this *User) change(session comm.IUserSession, attr string, add int32) (cha
|
||||
// user.Exp += int64(exp)
|
||||
}
|
||||
|
||||
if change.Ps+add > ggd.PsUl {
|
||||
if change.Ps >= ggd.PsUl {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_UserVitLimit,
|
||||
Title: pb.ErrorCode_UserVitLimit.ToString(),
|
||||
@ -550,6 +550,9 @@ func (this *User) change(session comm.IUserSession, attr string, add int32) (cha
|
||||
return
|
||||
}
|
||||
change.Ps += add
|
||||
if change.Ps > ggd.PsUl {
|
||||
change.Ps = ggd.PsUl
|
||||
}
|
||||
case comm.Talent1:
|
||||
if add < 0 {
|
||||
if user.Talent1+add < 0 {
|
||||
@ -1163,3 +1166,19 @@ func (this *User) ConsumePsAddExp(session comm.IUserSession, ps int32) (addExp i
|
||||
attrs["exp"] = int32(user.Exp)
|
||||
return addExp, this.AddAttributeValues(session, attrs, true)
|
||||
}
|
||||
|
||||
// 剩余体力
|
||||
func (this *User) RemainingPS(uid string) (ps int32) {
|
||||
var (
|
||||
user *pb.DBUser
|
||||
)
|
||||
|
||||
if user = this.GetUser(uid); user == nil {
|
||||
return
|
||||
}
|
||||
ggd := this.ModuleTools.GetGlobalConf()
|
||||
if ggd == nil {
|
||||
return
|
||||
}
|
||||
return ggd.PsUl - user.Ps
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user