消耗的资源数正数处理
This commit is contained in:
parent
2c12e6ae26
commit
cfc5d4f396
@ -284,14 +284,14 @@ func (this *ModuleBase) ConsumeRes(session comm.IUserSession, res []*cfg.Gameatn
|
|||||||
for k, v := range attrs {
|
for k, v := range attrs {
|
||||||
if this.ModuleUser.QueryAttributeValue(session.GetUserId(), k) < -int64(v) { // -v 负负得正
|
if this.ModuleUser.QueryAttributeValue(session.GetUserId(), k) < -int64(v) { // -v 负负得正
|
||||||
code = pb.ErrorCode_ResNoEnough
|
code = pb.ErrorCode_ResNoEnough
|
||||||
this.Errorf("资源不足: A: attr, T: %s, N: %d", k, v)
|
this.Error("资源不足", log.Fields{"uid": session.GetUserId(), "T": k, "N": v})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for k, v := range items {
|
for k, v := range items {
|
||||||
if int32(this.ModuleItems.QueryItemAmount(session.GetUserId(), k)) < -v {
|
if int32(this.ModuleItems.QueryItemAmount(session.GetUserId(), k)) < -v {
|
||||||
code = pb.ErrorCode_ResNoEnough
|
code = pb.ErrorCode_ResNoEnough
|
||||||
this.Errorf("道具不足: A: item, T:%s, N:%d", k, v)
|
this.Errorf("道具不足", log.Fields{"uid": session.GetUserId(), "T": k, "N": v})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -301,9 +301,9 @@ func (this *ModuleBase) ConsumeRes(session comm.IUserSession, res []*cfg.Gameatn
|
|||||||
if code != pb.ErrorCode_Success {
|
if code != pb.ErrorCode_Success {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.Debugf("消耗玩家资源: %v", attrs)
|
this.Debug("消耗玩家资源", log.Fields{"uid": session.GetUserId(), "attrs": attrs})
|
||||||
if count, ok := attrs[comm.ResDiamond]; ok {
|
if count, ok := attrs[comm.ResDiamond]; ok {
|
||||||
this.ModuleRtask.SendToRtask(session, comm.Rtype104, count)
|
this.ModuleRtask.SendToRtask(session, comm.Rtype104, -count)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(items) > 0 {
|
if len(items) > 0 {
|
||||||
@ -311,7 +311,7 @@ func (this *ModuleBase) ConsumeRes(session comm.IUserSession, res []*cfg.Gameatn
|
|||||||
if code != pb.ErrorCode_Success {
|
if code != pb.ErrorCode_Success {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.Debugf("消耗道具资源: %v", items)
|
this.Debug("消耗道具资源", log.Fields{"uid": session.GetUserId(), "items": items})
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user