public ServerPacket(SMSG msgID) : base(WORLDMSG.SERVER_MESSAGE) { Write((short)msgID); Write((short)0); // GamePacket Data Len ( != WorldPacket len ) m_serverMsgId = msgID; }
public static void ToFile(BinReader data, SMSG msgID) { string msg = msgID.ToString() + " : \n"; msg += ToString(data.ReadBytes((int)data.Length()), (int)data.Length()); WriteToFile(msg); }
public static void ToFile(BinWriter data, SMSG msgID) { string msg = msgID.ToString() + " : \n"; msg += ToString(data.GetBuffer(), (int)data.BaseStream.Length); WriteToFile(msg); }
public static BinWriter NewPacket(SMSG msgID) { BinWriter w = new BinWriter(); w.Write((short)0); w.Write((uint)msgID); return(w); }
public static BinWriter NewPacket(SMSG msgID) { DebugLogger.Logger.Log("LoginClient crafting packet " + msgID.ToString()); BinWriter w = new BinWriter(); w.Write((short)0); w.Write((ushort)msgID); return(w); }
public void Send(SMSG msgID, BinWriter data) { ServerPacket pkg = new ServerPacket(msgID); pkg.Write(data.GetBuffer(), 0, (int)data.BaseStream.Length); pkg.Finish(); pkg.AddDestination(m_character.ObjectId); WorldServer.Send(pkg); }
public void Send(SMSG msgID, byte[] data, int index, int count) { ServerPacket pkg = new ServerPacket(msgID); pkg.Write(data, index, count); pkg.Finish(); pkg.AddDestination(m_character.ObjectId); WorldServer.Send(pkg); }
public void Send(SMSG msgID, byte[] data, int index, int count) { try { ServerPacket pkg = new ServerPacket(msgID); pkg.Write(data, index, count); pkg.Finish(); pkg.AddDestination(m_character.ObjectId); WorldServer.Send(pkg); } catch (Exception exp) { DebugLogger.Logger.Log("", exp); } }
public void Send(SMSG msgID, BinWriter data) { try { ServerPacket pkg = new ServerPacket(msgID); pkg.Write(data.GetBuffer(), 0, (int)data.BaseStream.Length); pkg.Finish(); pkg.AddDestination(m_character.ObjectId); WorldServer.Send(pkg); } catch (Exception exp) { DebugLogger.Logger.Log("", exp); } }
/* * internal bool processWorldServerData() * { * if(m_client.PendingSendData) * m_client.SendWork(); * if(m_client.Connected == false) * return false; * byte[] data; * while((data = m_client.GetNextPacketData()) != null) * OnWorldServerData(data); * return m_client.Connected; * }*/ private void OnWorldServerData(ClientBase c, byte[] data) { BinReader read = new BinReader(data); read.BaseStream.Position += 4; // skip len WORLDMSG msgID = (WORLDMSG)read.ReadInt32(); if (msgID == WORLDMSG.SERVER_MESSAGE) { SMSG smsg = (SMSG)read.ReadInt32(); Console.WriteLine("WorldServer sent: " + smsg); int len = read.ReadInt32(); BinWriter pkg = LoginClient.NewPacket(smsg); if (len > 0) { pkg.Write(read.ReadBytes(len)); } while (read.BaseStream.Position < read.BaseStream.Length) { uint plrID = read.ReadUInt32(); LoginClient client = LoginServer.GetLoginClientByCharacterID(plrID); if (client == null) { Console.WriteLine("client missing for plrID " + plrID + " while sending " + smsg.ToString()); } else { client.Send(pkg); } } } else if (msgID == WORLDMSG.SCRIPT_MESSAGE) { LoginServer.Scripts.OnScriptMessage(read.ReadInt32(), read); } else { LoginPacketManager.HandlePacket(this, msgID, read); } }
public MsgData() { stGSPkg = new SMSG(); }
public ServerPacket(SMSG msgID) : base(WORLDMSG.SERVER_MESSAGE) { Write((int)msgID); Write(0); // GamePacket Data Len ( != WorldPacket len ) }
public static void ToFile(byte[] buffer, SMSG msgID) { WriteToFile(ToString(buffer, buffer.Length)); }