private void ZS_DataReceived(EventDrivenTCPClient sender, object data) { try { byte[] buffer = (byte[])Convert.ChangeType(data, typeof(byte[])); List <byte[]> packetList; Packet.SplitPackets(buffer, buffer.Length, out packetList); foreach (byte[] sPacket in packetList) { byte[] packet = sPacket; Config.mConvert.Crypter.Decrypt(ref packet, ClientVer.v562); MSG_HEAD_WITH_PROTOCOL pHeader = new MSG_HEAD_WITH_PROTOCOL(); pHeader.Deserialize(ref packet); if (ZoneAgent._Players.ContainsKey(pHeader.dwPCID)) { Client client = ZoneAgent._Players[pHeader.dwPCID]; if (pHeader.byCtrl == 0x01 && pHeader.byCmd == 0xE1) { //Zone Change Packet _Main.UpdateLogMsg(string.Format("{0} {1} user zone changed {2}->{3}", client.Account, client.Uid, client.ZoneStatus, packet[0x0A])); client.ZoneStatus = packet[0x0A]; continue; } else if (pHeader.wProtocol == 0x1800) { MSG_S2C_SAY pSay = new MSG_S2C_SAY(); pSay.Deserialize(ref packet); if (pSayType.Notice == (pSayType)pSay.bySayType && "NOTICE" == pSay.szSayPC && uint.MaxValue == pSay.dwSayPCID) { ZoneAgent.szNotice = pSay.szWords; } } else if (pHeader.wProtocol == 0x1107) { //world login: save character name and town MSG_S2C_WORLD_LOGIN wLogin = new MSG_S2C_WORLD_LOGIN(); wLogin.Deserialize(ref packet); client.Character = wLogin.szPCName; client.Town = wLogin.byTown; } //encrypt후 클라이언트로 send //Config.mConvert.Convert_S2C(ref packet, client.Ver); #if DEBUG PacketLogger.LogPacket(packet, "server_to_client", client.Character); #endif ZoneAgent.Write(ref client, packet); } } } catch (Exception ex) { Logger.Write(string.Format("ZS_DataReceived: {0}", ex)); } }
public static void S2C_WORLD_LOGIN(GameConnection conn) { var msg = new MSG_S2C_WORLD_LOGIN(); conn.Character.GetMsgCharacterInfo(out msg.CharacterInfo); conn.Character.GetMsgCharacterStat(out msg.CharacterStat); conn.Character.GetMsgItemWear(out msg.WearList); conn.Character.GetMsgItemInventory(out msg.InventoryList); conn.Character.GetMsgActivePet(out msg.PetActive); conn.Character.GetMsgPetInventory(out msg.PetInventory); conn.Send(msg.Serialize()); conn.Send(new MSG_S2C_UNKNOWN_37().Serialize()); conn.Send(new MSG_S2C_UNKNOWN_25().Serialize()); conn.Send(new MSG_S2C_CHAT_INITIALIZE().Serialize()); }