public void Read(ByteArray by) { mail_idx = by.ReadLong(); mail_type = (eMailType)by.ReadByte(); spid = by.ReadUShort(); receiver_idx = by.ReadLong(); sender_idx = by.ReadLong(); sender_name = by.ReadString(); send_time = by.ReadLong(); expire_time = by.ReadInt(); delivery_time = by.ReadInt(); flags = by.ReadUInt(); subject = by.ReadString(); bin_mail_content.Read(by); }
public void Read(ByteArray by) { char_idx = by.ReadLong(); char_name = by.ReadString(); char_type = by.ReadByte(); spid = by.ReadUShort(); ws_id = by.ReadUShort(); scene_type_idx = by.ReadUInt(); flags = by.ReadUInt(); model_idx = by.ReadUInt(); job = by.ReadByte(); level = by.ReadUShort(); exp = by.ReadUInt(); gold = by.ReadUInt(); coin = by.ReadUInt(); vip_grade = by.ReadUInt(); }
public void Read(ByteArray by) { ip = by.ReadUInt(); port = by.ReadUShort(); }
public void Read(ByteArray by) { type = (ePropType)by.ReadByte(); obj_type = by.ReadUInt(); obj_value = by.ReadLong(); }
/// <summary> /// 网络事件处理 /// </summary> public void OnNetworkClient(long conn_idx, ushort header, ByteArray data) { ClientSession session = ClientSessionManager.Instance.GetSession(conn_idx); if (session != null) { ///1.判断cd if (!session.CheckCooldown(header)) { //Log.Debug("协议cd不够:" + header); return; } ///2.消息解密 if (GlobalID.ENABLE_PACKET_ENCRYPT) { //id有效性校验 uint packet_idx = data.ReadUInt(); packet_idx = PacketEncrypt.DecrpytPacketIndex(packet_idx, PacketEncrypt.Encrypt_Key); if (packet_idx < session.last_packet_idx) { Log.Warning("协议索引校验失败conn_idx:" + conn_idx + " header:" + header); ClientSessionManager.Instance.KickoutSession(conn_idx); return; } session.last_packet_idx = packet_idx; //验证数据的有效性:防止被修改 ushort send_verify_data = data.ReadUShort(); ushort verify_data = PacketEncrypt.CalcPacketDataVerify(data.Buffer, 6, data.Available, packet_idx, PacketEncrypt.Encrypt_Key); if (send_verify_data != verify_data) { Log.Warning("数据有效性校验失败conn_idx:" + conn_idx + " header:" + header); ClientSessionManager.Instance.KickoutSession(conn_idx); return; } } ///3.是否转发消息 if (header >= ProtocolID.MSG_BASE_C2SS && header < ProtocolID.MSG_BASE_C2SS + ProtocolID.MSG_APPLAYER_PER_INTERVAL) { HandleProxyMsgToSS(session, header, data); } else if (header >= ProtocolID.MSG_BASE_C2WS && header < ProtocolID.MSG_BASE_C2WS + ProtocolID.MSG_APPLAYER_PER_INTERVAL) { HandleProxyMsgToWS(session, header, data); } else if (header >= ProtocolID.MSG_BASE_C2FS && header < ProtocolID.MSG_BASE_C2FS + ProtocolID.MSG_APPLAYER_PER_INTERVAL) { HandleProxyMsgToFS(session, header, data); } else { PacketBase packet = PacketPools.Get(header); packet.Read(data); MsgProcFunction fun; if (m_msg_proc.TryGetValue(packet.header, out fun)) { try { fun(session, packet); } catch (Exception e) { Log.Exception(e); } } else { Log.Warning("未注册消息处理函数id:" + header); } PacketPools.Recover(packet); } } else { PacketBase packet = PacketPools.Get(header); packet.Read(data); switch (packet.header) { case c2gs.msg.ENCRYPT: OnClientEncrypt(conn_idx, packet); break; default: //没有session,又不是握手协议,说明发错协议了,直接踢掉 ClientSessionManager.Instance.KickoutSession(conn_idx); break; } PacketPools.Recover(packet); } }
public uint vip_flags; // vip flags public void Read(ByteArray by) { char_name = by.ReadString(); char_type = by.ReadByte(); pos_x = by.ReadInt(); pos_y = by.ReadInt(); flags = by.ReadUInt(); model_idx = by.ReadUInt(); job = by.ReadByte(); level = by.ReadUShort(); exp = by.ReadUInt(); energy = by.ReadUInt(); gold = by.ReadUInt(); coin = by.ReadUInt(); hp = by.ReadUInt(); hp_max = by.ReadUInt(); hurt = by.ReadUInt(); range = by.ReadUInt(); run_speed = by.ReadUInt(); vip_grade = by.ReadUInt(); vip_flags = by.ReadUInt(); }
public void Read(ByteArray by) { type = (eUnitType)by.ReadUShort(); obj_type = by.ReadUInt(); obj_idx = by.ReadLong(); }
public void Read(ByteArray by) { char_idx = by.ReadLong(); account_index = by.ReadLong(); spid = by.ReadUShort(); char_name = by.ReadString(); char_type = by.ReadByte(); ws_id = by.ReadUShort(); ss_id = by.ReadUShort(); fs_id = by.ReadUShort(); pos_x = by.ReadInt(); pos_y = by.ReadInt(); scene_type_idx = by.ReadUInt(); scene_obj_idx = by.ReadLong(); flags = by.ReadUInt(); model_idx = by.ReadUInt(); job = by.ReadByte(); level = by.ReadUShort(); exp = by.ReadUInt(); energy = by.ReadUInt(); gold = by.ReadUInt(); coin = by.ReadUInt(); hp = by.ReadUInt(); hp_max = by.ReadUInt(); hurt = by.ReadUInt(); range = by.ReadUInt(); run_speed = by.ReadUInt(); vip_grade = by.ReadUInt(); vip_flags = by.ReadUInt(); time_last_login = by.ReadLong(); time_last_logout = by.ReadLong(); }