三消段位奖励追加consumeexp
This commit is contained in:
parent
2de5010d8f
commit
2998555e67
@ -472,6 +472,7 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr
|
|||||||
func (this *Room) GameOver(winner *pb.PlayerData) (errdata *pb.ErrorData) {
|
func (this *Room) GameOver(winner *pb.PlayerData) (errdata *pb.ErrorData) {
|
||||||
var (
|
var (
|
||||||
atno []*pb.UserAtno
|
atno []*pb.UserAtno
|
||||||
|
consumeexp int32
|
||||||
winindex int32
|
winindex int32
|
||||||
res []*cfg.Gameatn
|
res []*cfg.Gameatn
|
||||||
lostPlayer *pb.PlayerData // 输的玩家
|
lostPlayer *pb.PlayerData // 输的玩家
|
||||||
@ -510,6 +511,7 @@ func (this *Room) GameOver(winner *pb.PlayerData) (errdata *pb.ErrorData) {
|
|||||||
if v.A == "attr" && v.T == "consumeexp" {
|
if v.A == "attr" && v.T == "consumeexp" {
|
||||||
list.Consumeexp += int32(v.N*pro) / 1000
|
list.Consumeexp += int32(v.N*pro) / 1000
|
||||||
winScore = int32(v.N*pro) / 1000
|
winScore = int32(v.N*pro) / 1000
|
||||||
|
consumeexp += winScore
|
||||||
update["consumeexp"] = list.Consumeexp
|
update["consumeexp"] = list.Consumeexp
|
||||||
winner.Consumeexp = list.Consumeexp
|
winner.Consumeexp = list.Consumeexp
|
||||||
if list.Consumeexp > list.Maxconsumeexp { // 写最高积分
|
if list.Consumeexp > list.Maxconsumeexp { // 写最高积分
|
||||||
@ -520,6 +522,7 @@ func (this *Room) GameOver(winner *pb.PlayerData) (errdata *pb.ErrorData) {
|
|||||||
list.Maxsocre = winner.Score
|
list.Maxsocre = winner.Score
|
||||||
update["maxsocre"] = list.Maxsocre
|
update["maxsocre"] = list.Maxsocre
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
res = append(res, v)
|
res = append(res, v)
|
||||||
}
|
}
|
||||||
@ -527,6 +530,13 @@ func (this *Room) GameOver(winner *pb.PlayerData) (errdata *pb.ErrorData) {
|
|||||||
if errdata, atno = this.module.DispenseAtno(this.szSession[winindex], res, true); errdata != nil {
|
if errdata, atno = this.module.DispenseAtno(this.szSession[winindex], res, true); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if consumeexp > 0 {
|
||||||
|
atno = append(atno, &pb.UserAtno{
|
||||||
|
A: "attr",
|
||||||
|
T: "consumeexp",
|
||||||
|
N: consumeexp,
|
||||||
|
})
|
||||||
|
}
|
||||||
this.szSession[winindex].Push()
|
this.szSession[winindex].Push()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user