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
|
SetUserCaravanLvChange(session IUserSession, caravanlv int32) error
|
||||||
//消耗体力加经验
|
//消耗体力加经验
|
||||||
ConsumePsAddExp(session IUserSession, ps int32) (addExp int32, errdata *pb.ErrorData)
|
ConsumePsAddExp(session IUserSession, ps int32) (addExp int32, errdata *pb.ErrorData)
|
||||||
|
// 体力差
|
||||||
|
RemainingPS(uid string) int32
|
||||||
}
|
}
|
||||||
//武器模块
|
//武器模块
|
||||||
IEquipment interface {
|
IEquipment interface {
|
||||||
|
@ -14,8 +14,9 @@ func (this *apiComp) PuzzleAwardCheck(session comm.IUserSession, req *pb.UserPuz
|
|||||||
//拼图领奖
|
//拼图领奖
|
||||||
func (this *apiComp) PuzzleAward(session comm.IUserSession, req *pb.UserPuzzleAwardReq) (errdata *pb.ErrorData) {
|
func (this *apiComp) PuzzleAward(session comm.IUserSession, req *pb.UserPuzzleAwardReq) (errdata *pb.ErrorData) {
|
||||||
var (
|
var (
|
||||||
sign *pb.DBSign
|
sign *pb.DBSign
|
||||||
err error
|
err error
|
||||||
|
completeCount int32
|
||||||
)
|
)
|
||||||
|
|
||||||
if sign, err = this.module.modelSign.GetUserSign(session.GetUserId()); err != nil {
|
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
|
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{}{
|
if err = this.module.modelSign.Change(session.GetUserId(), map[string]interface{}{
|
||||||
"puzzle": sign.Puzzle,
|
"puzzle": sign.Puzzle,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
|
@ -541,7 +541,7 @@ func (this *User) change(session comm.IUserSession, attr string, add int32) (cha
|
|||||||
// user.Exp += int64(exp)
|
// user.Exp += int64(exp)
|
||||||
}
|
}
|
||||||
|
|
||||||
if change.Ps+add > ggd.PsUl {
|
if change.Ps >= ggd.PsUl {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_UserVitLimit,
|
Code: pb.ErrorCode_UserVitLimit,
|
||||||
Title: pb.ErrorCode_UserVitLimit.ToString(),
|
Title: pb.ErrorCode_UserVitLimit.ToString(),
|
||||||
@ -550,6 +550,9 @@ func (this *User) change(session comm.IUserSession, attr string, add int32) (cha
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
change.Ps += add
|
change.Ps += add
|
||||||
|
if change.Ps > ggd.PsUl {
|
||||||
|
change.Ps = ggd.PsUl
|
||||||
|
}
|
||||||
case comm.Talent1:
|
case comm.Talent1:
|
||||||
if add < 0 {
|
if add < 0 {
|
||||||
if user.Talent1+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)
|
attrs["exp"] = int32(user.Exp)
|
||||||
return addExp, this.AddAttributeValues(session, attrs, true)
|
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