LingshaSR/gameserver/bin/handlers/player.ml
2024-08-03 15:05:09 +03:00

22 lines
942 B
OCaml

open Cmdid
open Packet
open Protocol
let on_get_basic_info _pk = empty cmd_get_basic_info_sc_rsp
let on_player_heartbeat pk =
let dec = Pbrt.Decoder.of_string pk.body in
let req = decode_pb_player_heart_beat_cs_req dec in
let dec = Pbrt.Decoder.of_string (Base64.decode_exn "CDMQuQoa1gFDUy5Vbml0eUVuZ2luZS5HYW1lT2JqZWN0LkZpbmQoIlVJUm9vdC9BYm92ZURpYWxvZy9CZXRhSGludERpYWxvZyhDbG9uZSkiKTpHZXRDb21wb25lbnRJbkNoaWxkcmVuKHR5cGVvZihDUy5SUEcuQ2xpZW50LkxvY2FsaXplZFRleHQpKS50ZXh0ID0gIkxpbmdzaGFTUiBpcyBhIGZyZWUgYW5kIG9wZW4gc291cmNlIHNvZnR3YXJlLiBkaXNjb3JkLmdnL3JldmVyc2Vkcm9vbXMi") in
let download_data = decode_pb_client_download_data dec in
let timestamp = Int64.of_float (Unix.gettimeofday() *. 1000.0) in
let rsp = {
retcode = 0l;
client_time_ms = req.client_time_ms;
server_time_ms = timestamp;
download_data = Some download_data
} in
pack cmd_player_heart_beat_sc_rsp encode_pb_player_heart_beat_sc_rsp rsp