消耗体力加经验
This commit is contained in:
parent
f10ca5b24c
commit
ee97d178ca
@ -171,7 +171,7 @@ type (
|
|||||||
|
|
||||||
SetUserCaravanLvChange(session IUserSession, caravanlv int32) error
|
SetUserCaravanLvChange(session IUserSession, caravanlv int32) error
|
||||||
//消耗体力加经验
|
//消耗体力加经验
|
||||||
ConsumePsAddExp(session IUserSession, ps int) (errdata *pb.ErrorData)
|
ConsumePsAddExp(session IUserSession, ps int) (addExp int32, errdata *pb.ErrorData)
|
||||||
}
|
}
|
||||||
//武器模块
|
//武器模块
|
||||||
IEquipment interface {
|
IEquipment interface {
|
||||||
|
@ -1124,7 +1124,15 @@ func (this *User) SetUserCaravanLvChange(session comm.IUserSession, caravanlv in
|
|||||||
return this.modelUser.Change(session.GetUserId(), update)
|
return this.modelUser.Change(session.GetUserId(), update)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *User) ConsumePsAddExp(session comm.IUserSession, ps int) (errdata *pb.ErrorData) {
|
func (this *User) ConsumePsAddExp(session comm.IUserSession, ps int) (addExp int32, errdata *pb.ErrorData) {
|
||||||
|
if ps <= 0 {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_ReqParameterError,
|
||||||
|
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
user *pb.DBUser
|
user *pb.DBUser
|
||||||
)
|
)
|
||||||
@ -1140,10 +1148,10 @@ func (this *User) ConsumePsAddExp(session comm.IUserSession, ps int) (errdata *p
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
//体力消耗,增加玩家经验
|
//体力消耗,增加玩家经验
|
||||||
exp := int32(math.Abs(float64(ps))) * ggd.FightPs
|
addExp = int32(math.Abs(float64(ps))) * ggd.FightPs
|
||||||
user.Exp += int64(exp)
|
user.Exp += int64(addExp)
|
||||||
|
|
||||||
attrs := make(map[string]int32, 0)
|
attrs := make(map[string]int32, 0)
|
||||||
attrs["exp"] = int32(user.Exp)
|
attrs["exp"] = int32(user.Exp)
|
||||||
return this.AddAttributeValues(session, attrs, true)
|
return addExp, this.AddAttributeValues(session, attrs, true)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user