xxl发奖校验 如果是AI胜利 不发将
This commit is contained in:
parent
e5f95645e4
commit
58898f4d3f
@ -6,6 +6,7 @@ import (
|
|||||||
"go_dreamfactory/lego/sys/timewheel"
|
"go_dreamfactory/lego/sys/timewheel"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
@ -473,22 +474,42 @@ func (this *Room) GameOver() (errdata *pb.ErrorData) {
|
|||||||
var (
|
var (
|
||||||
atno []*pb.UserAtno
|
atno []*pb.UserAtno
|
||||||
winindex int32
|
winindex int32
|
||||||
|
bReward bool
|
||||||
|
res []*cfg.Gameatn
|
||||||
)
|
)
|
||||||
if this.operatetimer != nil {
|
if this.operatetimer != nil {
|
||||||
timewheel.Remove(this.operatetimer)
|
timewheel.Remove(this.operatetimer)
|
||||||
}
|
}
|
||||||
var winner string
|
var winner string
|
||||||
winner = this.player1.Uid
|
winner = this.player1.Uid
|
||||||
|
bReward = true
|
||||||
if this.player1.Score < this.player2.Score {
|
if this.player1.Score < this.player2.Score {
|
||||||
winner = this.player2.Uid
|
winner = this.player2.Uid
|
||||||
winindex = 1
|
winindex = 1
|
||||||
}
|
if len(this.szSession) == 1 { // 赢家是AI 的话不发奖
|
||||||
if conf, err := this.module.configure.GetGameConsumeintegral(this.player1.Score); err != nil {
|
bReward = false
|
||||||
if errdata, atno = this.module.DispenseAtno(this.szSession[winindex], conf.Rewards, true); errdata != nil {
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if conf, err := this.module.configure.GetGameConsumeintegral(this.player1.Score); err == nil {
|
||||||
|
res = append(res, conf.Onereward...)
|
||||||
|
res = append(res, conf.Rewards...)
|
||||||
|
if bReward { // 发奖
|
||||||
|
if errdata, atno = this.module.DispenseAtno(this.szSession[winindex], res, true); errdata != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else { // AI 不发将 构建一个atno对象
|
||||||
|
for _, v := range res {
|
||||||
|
atno = append(atno, &pb.UserAtno{
|
||||||
|
A: v.A,
|
||||||
|
T: v.T,
|
||||||
|
N: v.N,
|
||||||
|
O: "",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.module.SendMsgSyncToSession(string(this.module.GetType()), "gameover", &pb.EntertainGameOverPush{
|
this.module.SendMsgSyncToSession(string(this.module.GetType()), "gameover", &pb.EntertainGameOverPush{
|
||||||
User1: this.player1,
|
User1: this.player1,
|
||||||
User2: this.player2,
|
User2: this.player2,
|
||||||
|
Loading…
Reference in New Issue
Block a user