上传竞技场代码

This commit is contained in:
liwei1dao 2022-11-18 13:59:53 +08:00
parent 080f674ad5
commit 1016daf1be
5 changed files with 7 additions and 17 deletions

View File

@ -3,7 +3,6 @@ package arena
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"go_dreamfactory/sys/configure"
"google.golang.org/protobuf/proto"
)
@ -51,11 +50,8 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.ArenaChallenge
return
}
this.module.modelArena.recoverTicket(red)
if red.Ticket > 0 {
red.Ticket--
if red.Lastrtickettime == 0 {
red.Lastrtickettime = configure.Now().Unix()
}
if red.Ticket > this.module.configure.GetGlobalConf().ArenaTicketCos {
red.Ticket -= this.module.configure.GetGlobalConf().ArenaTicketCos
} else {
code = pb.ErrorCode_ArenaTicketNotEnough
return

View File

@ -58,11 +58,8 @@ func (this *apiComp) Plot(session comm.IUserSession, req *pb.ArenaPlotReq) (code
return
}
this.module.modelArena.recoverTicket(info)
if info.Ticket > 0 {
info.Ticket--
if info.Lastrtickettime == 0 {
info.Lastrtickettime = configure.Now().Unix()
}
if info.Ticket > this.module.configure.GetGlobalConf().ArenaTicketCos {
info.Ticket -= this.module.configure.GetGlobalConf().ArenaTicketCos
} else {
code = pb.ErrorCode_ArenaTicketNotEnough
return

View File

@ -378,10 +378,8 @@ func (this *modelArena) recoverTicket(info *pb.DBArenaUser) {
info.Ticket += ticketNum
if info.Ticket > global.ArenaTicketMax {
info.Ticket = global.ArenaTicketMax
info.Lastrtickettime = 0
} else {
info.Lastrtickettime = time.Unix(info.Lastrtickettime, 0).Add(time.Duration(ticketNum) * time.Minute).Unix()
}
info.Lastrtickettime = time.Unix(info.Lastrtickettime, 0).Add(time.Duration(ticketNum) * time.Minute).Unix()
}
}
}

View File

@ -119,6 +119,7 @@ func (this *modelDreamComp) trigger(session comm.IUserSession) {
}
// umfantasy.Mfantasys = append(umfantasy.Mfantasys, mdata.Id)
umfantasy.TriggerNum++
umfantasy.LastTrigger = configure.Now().Unix()
this.module.modelUserMF.updateUserInfo(umfantasy)
chat = &pb.DBChat{
Ctype: pb.ChatType_Moonfantasy,

View File

@ -89,10 +89,8 @@ func (this *modelUserMF) recoverTicket(info *pb.DBUserMFantasy) {
info.Ticket += ticketNum
if info.Ticket > global.ArenaTicketMax {
info.Ticket = global.ArenaTicketMax
info.Lastrtickettime = 0
} else {
info.Lastrtickettime = time.Unix(info.Lastrtickettime, 0).Add(time.Duration(ticketNum) * time.Minute).Unix()
}
info.Lastrtickettime = time.Unix(info.Lastrtickettime, 0).Add(time.Duration(ticketNum) * time.Minute).Unix()
}
}
}