上传竞技场代码
This commit is contained in:
parent
080f674ad5
commit
1016daf1be
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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,
|
||||||
|
@ -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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user