LingshaSR/gameserver/bin/handlers/battle.ml

49 lines
1.3 KiB
OCaml
Raw Normal View History

2024-08-03 12:05:09 +00:00
open Cmdid
open Protocol
open Packet
let on_start_cocoon_stage pk =
let dec = Pbrt.Decoder.of_string pk.body in
let req = decode_pb_start_cocoon_stage_cs_req dec in
let avatar = default_battle_avatar
~id:1222l
~hp:10000l
~level:80l
~rank:6l
~promotion:6l
~avatar_type:Avatar_formal_type
~sp:(Some {sp_cur = 10000l; sp_need = 10000l})
() in
let wave = default_scene_monster_wave
~monster_list: [default_scene_monster_info ~monster_id:3024020l ()] () in
let battle = default_scene_battle_info
~battle_id:1l
~stage_id:201012311l
~logic_random_seed: (Int32.of_float (Unix.gettimeofday ()))
~monster_wave_list:[wave]
~battle_avatar_list:[avatar]
() in
let rsp = default_start_cocoon_stage_sc_rsp
~battle_info:(Some battle)
~cocoon_id:req.cocoon_id
~prop_entity_id:req.prop_entity_id
~wave:1l
() in
pack cmd_start_cocoon_stage_sc_rsp encode_pb_start_cocoon_stage_sc_rsp rsp
let on_pve_battle_result pk =
let dec = Pbrt.Decoder.of_string pk.body in
let req = decode_pb_pve_battle_result_cs_req dec in
let rsp = default_pve_battle_result_sc_rsp
~end_status:req.end_status
~battle_id:req.battle_id
() in
pack cmd_p_v_e_battle_result_sc_rsp encode_pb_pve_battle_result_sc_rsp rsp