上传竞技场代码

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

View File

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

View File

@ -378,10 +378,8 @@ func (this *modelArena) recoverTicket(info *pb.DBArenaUser) {
info.Ticket += ticketNum info.Ticket += ticketNum
if info.Ticket > global.ArenaTicketMax { if info.Ticket > global.ArenaTicketMax {
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.Mfantasys = append(umfantasy.Mfantasys, mdata.Id)
umfantasy.TriggerNum++ umfantasy.TriggerNum++
umfantasy.LastTrigger = configure.Now().Unix()
this.module.modelUserMF.updateUserInfo(umfantasy) this.module.modelUserMF.updateUserInfo(umfantasy)
chat = &pb.DBChat{ chat = &pb.DBChat{
Ctype: pb.ChatType_Moonfantasy, Ctype: pb.ChatType_Moonfantasy,

View File

@ -89,10 +89,8 @@ func (this *modelUserMF) recoverTicket(info *pb.DBUserMFantasy) {
info.Ticket += ticketNum info.Ticket += ticketNum
if info.Ticket > global.ArenaTicketMax { if info.Ticket > global.ArenaTicketMax {
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()
} }
} }
} }