mirror of
https://github.com/CPunch/gopenfusion.git
synced 2024-11-27 17:40:04 +00:00
fixed sent server time
This commit is contained in:
parent
8f00a0c492
commit
c09a6cfd25
@ -6,6 +6,7 @@ import (
|
||||
"io"
|
||||
"log"
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"github.com/CPunch/gopenfusion/core/protocol/pool"
|
||||
)
|
||||
@ -28,6 +29,10 @@ type CNPeer struct {
|
||||
alive bool
|
||||
}
|
||||
|
||||
func GetTime() uint64 {
|
||||
return uint64(time.Now().UnixMilli())
|
||||
}
|
||||
|
||||
func NewCNPeer(eRecv chan *Event, conn net.Conn) *CNPeer {
|
||||
return &CNPeer{
|
||||
conn: conn,
|
||||
|
@ -5,7 +5,6 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"math/rand"
|
||||
"time"
|
||||
|
||||
"github.com/CPunch/gopenfusion/config"
|
||||
"github.com/CPunch/gopenfusion/core/db"
|
||||
@ -34,7 +33,7 @@ func (server *LoginServer) AcceptLogin(peer *protocol.CNPeer, SzID string, IClie
|
||||
ISlotNum: ISlotNum,
|
||||
IPaymentFlag: 1,
|
||||
IOpenBetaFlag: 0,
|
||||
UiSvrTime: uint64(time.Now().Unix()),
|
||||
UiSvrTime: protocol.GetTime(),
|
||||
}
|
||||
|
||||
if err := peer.Send(protocol.P_LS2CL_REP_LOGIN_SUCC, resp); err != nil {
|
||||
|
@ -3,7 +3,6 @@ package shard
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/CPunch/gopenfusion/core/entity"
|
||||
"github.com/CPunch/gopenfusion/core/protocol"
|
||||
@ -47,7 +46,7 @@ func (server *ShardServer) RequestEnter(peer *protocol.CNPeer, pkt protocol.Pack
|
||||
resp := &protocol.SP_FE2CL_REP_PC_ENTER_SUCC{
|
||||
IID: int32(plr.PlayerID),
|
||||
PCLoadData2CL: plr.ToPCLoadData2CL(),
|
||||
UiSvrTime: uint64(time.Now().Unix()),
|
||||
UiSvrTime: protocol.GetTime(),
|
||||
}
|
||||
|
||||
// setup peer
|
||||
|
@ -1,8 +1,6 @@
|
||||
package shard
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/CPunch/gopenfusion/core/entity"
|
||||
"github.com/CPunch/gopenfusion/core/protocol"
|
||||
)
|
||||
@ -32,7 +30,7 @@ func (server *ShardServer) playerMove(peer *protocol.CNPeer, pkt protocol.Packet
|
||||
}
|
||||
|
||||
return server.sendOthersPacket(plr, protocol.P_FE2CL_PC_MOVE, protocol.SP_FE2CL_PC_MOVE{
|
||||
ICliTime: uint64(time.Now().Unix()),
|
||||
ICliTime: move.ICliTime,
|
||||
IX: move.IX,
|
||||
IY: move.IY,
|
||||
IZ: move.IZ,
|
||||
@ -43,7 +41,7 @@ func (server *ShardServer) playerMove(peer *protocol.CNPeer, pkt protocol.Packet
|
||||
CKeyValue: move.CKeyValue,
|
||||
ISpeed: move.ISpeed,
|
||||
IID: int32(plr.PlayerID),
|
||||
ISvrTime: uint64(time.Now().Unix()),
|
||||
ISvrTime: protocol.GetTime(),
|
||||
})
|
||||
}
|
||||
|
||||
@ -63,12 +61,12 @@ func (server *ShardServer) playerStop(peer *protocol.CNPeer, pkt protocol.Packet
|
||||
}
|
||||
|
||||
return server.sendOthersPacket(plr, protocol.P_FE2CL_PC_STOP, protocol.SP_FE2CL_PC_STOP{
|
||||
ICliTime: uint64(time.Now().Unix()),
|
||||
ICliTime: stop.ICliTime,
|
||||
IX: stop.IX,
|
||||
IY: stop.IY,
|
||||
IZ: stop.IZ,
|
||||
IID: int32(plr.PlayerID),
|
||||
ISvrTime: uint64(time.Now().Unix()),
|
||||
ISvrTime: protocol.GetTime(),
|
||||
})
|
||||
}
|
||||
|
||||
@ -88,7 +86,7 @@ func (server *ShardServer) playerJump(peer *protocol.CNPeer, pkt protocol.Packet
|
||||
}
|
||||
|
||||
return server.sendOthersPacket(plr, protocol.P_FE2CL_PC_JUMP, protocol.SP_FE2CL_PC_JUMP{
|
||||
ICliTime: uint64(time.Now().Unix()),
|
||||
ICliTime: jump.ICliTime,
|
||||
IX: jump.IX,
|
||||
IY: jump.IY,
|
||||
IZ: jump.IZ,
|
||||
@ -99,6 +97,6 @@ func (server *ShardServer) playerJump(peer *protocol.CNPeer, pkt protocol.Packet
|
||||
CKeyValue: jump.CKeyValue,
|
||||
ISpeed: jump.ISpeed,
|
||||
IID: int32(plr.PlayerID),
|
||||
ISvrTime: uint64(time.Now().Unix()),
|
||||
ISvrTime: protocol.GetTime(),
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user