public void OnChat(ClientSession cs, InPacket ip) { ip.ReadByte(); // 01 ip.ReadInt(); // 00 00 00 00 int WhereLen = ip.ReadInt(); string Where = ip.ReadUnicodeString(WhereLen); ip.ReadInt(); // 00 00 00 00 ip.ReadInt(); // 00 00 00 00 ip.ReadInt(); // FF FF FF FF int ChatLen = ip.ReadInt(); string Chat = ip.ReadUnicodeString(ChatLen); if (Where == "Server") { if (cs.AuthLevel == 1) { if (Chat.Substring(0, 1) == "!") { cmd.GMCommands(cs, Chat, ip); } else { } if (Chat.Substring(0, 1) == "/") { cmd.GMCommands(cs, Chat, ip); } } using (OutPacket op = new OutPacket(GameOpcodes.EVENT_CHAT_NOT)) { op.WriteByte(1); op.WriteInt(cs.LoginUID); op.WriteInt(cs.Nick.Length * 2); op.WriteUnicodeString(cs.Nick); op.WriteInt(0); op.WriteInt(0); op.WriteInt(-1); op.WriteInt(ChatLen); op.WriteUnicodeString(Chat); op.WriteInt(0); op.WriteInt(0); foreach (ClientSession u in UsersList) { if (u.CurrentRoom == cs.CurrentRoom) { op.Assemble(u.CRYPT_KEY, u.CRYPT_HMAC, u.CRYPT_PREFIX, u.CRYPT_COUNT); u.Send(op); op.CancelAssemble(); } } } } }
public void NotifySHAFile(ClientSession cs, InPacket ip) { using (OutPacket oPacket = new OutPacket(CenterOpcodes.ENU_SHAFILENAME_LIST_ACK)) { oPacket.WriteInt(0); oPacket.WriteInt(SHAFileList.Length); for (int i = 0; i <= checklist.Length - 1; i++) { oPacket.WriteInt(checklist[i].nFile.Length * 2); oPacket.WriteUnicodeString(checklist[i].nFile); oPacket.WriteInt(checklist[i].CRC.Length * 2); oPacket.WriteUnicodeString(checklist[i].CRC); } oPacket.Assemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, ++cs.CRYPT_COUNT); cs.Send(oPacket); LogFactory.GetLog("DATA").LogHex("PACKET: ", ip.ToArray()); } }
public void DigitOnChat(ClientSession cs, string msg) { using (OutPacket op = new OutPacket(GameOpcodes.EVENT_CHAT_NOT)) { op.WriteByte(1); op.WriteInt(cs.LoginUID); op.WriteInt(cs.Nick.Length * 2); op.WriteUnicodeString(cs.Nick); op.WriteInt(0); op.WriteInt(0); op.WriteInt(-1); op.WriteInt(msg.Length); op.WriteUnicodeString(msg); op.WriteInt(0); op.WriteInt(0); op.CompressAndAssemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, ++cs.CRYPT_COUNT); cs.Send(op); } }
public void SendClientContentOpen(ClientSession cs) { using (OutPacket oPacket = new OutPacket(CenterOpcodes.ENU_NEW_CLIENT_CONTENTS_OPEN_NOT)) { LoadContents(); LoadCharacters(); //oPacket.WriteHexString("00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 09 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 09 00 00 00 01 00 00 00 01 00 00 00 0A 00 00 00 01 00 00 00 01 00 00 00 0E 00 00 00 01 00 00 00 01 00 00 00 12 00 00 00 01 00 00 00 01 00 00 00 14 00 00 00 01 00 00 00 01 00 00 00 02 00 00 00 01 00 00 00 03 00 00 00 03 00 00 00 01 00 00 00 00 00 00 00 15 00 00 00 01 00 00 00 0D 00 00 00 08 00 00 00 00 00 00 00 02 00 00 00 01 00 00 00 02 00 00 00 01 00 00 00 01 00 00 00 05 00 00 00 03 00 00 00 01 00 00 00 06 00 00 00 04 00 00 00 01 00 00 00 00 00 00 00 05 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 02 00 00 00 42 00 00 00 07 00 00 00 08 00 00 00 09 00 00 00 0A 00 00 00 0B 00 00 00 0C 00 00 00 0D 00 00 00 0E 00 00 00 0F 00 00 00 10 00 00 00 11 00 00 00 12 00 00 00 13 00 00 00 14 00 00 00 15 00 00 00 16 00 00 00 17 00 00 00 18 00 00 00 19 00 00 00 1A 00 00 00 1B 00 00 00 1E 00 00 00 24 00 00 00 27 00 00 00 28 00 00 00 29 00 00 00 2A 00 00 00 2B 00 00 00 2C 00 00 00 2D 00 00 00 2E 00 00 00 2F 00 00 00 30 00 00 00 31 00 00 00 32 00 00 00 37 00 00 00 38 00 00 00 39 00 00 00 3A 00 00 00 3B 00 00 00 3C 00 00 00 3D 00 00 00 3E 00 00 00 3F 00 00 00 40 00 00 00 46 00 00 00 49 00 00 00 4A 00 00 00 4C 00 00 00 4E 00 00 00 4F 00 00 00 50 00 00 00 51 00 00 00 53 00 00 00 54 00 00 00 55 00 00 00 56 00 00 00 57 00 00 00 58 00 00 00 59 00 00 00 5A 00 00 00 5B 00 00 00 5C 00 00 00 5D 00 00 00 5E 00 00 00 5F 00 00 00 0B 00 00 00 01 00 00 00 26 00 00 00 0D 00 00 00 01 00 00 00 42 00 00 00 06 00 00 00 04 00 00 00 00 01 00 00 00 63 00 00 00 00 01 00 00 00 10 00 00 00 63 00 00 00 64 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00 09 00 00 00 0A 00 00 00 0B 00 00 00 2B 00 00 00 2F 00 00 00 01 01 00 00 00 0E 00 00 00 0A 00 00 00 63 00 00 00 64 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 09 00 00 00 04 00 00 00 06 00 00 00 05 00 00 00 08 00 00 00 07 00 00 00 0B 00 00 00 05 01 00 00 00 10 00 00 00 63 00 00 00 64 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00 09 00 00 00 0A 00 00 00 0B 00 00 00 2B 00 00 00 2F 00 00 00 03 01 00 00 00 09 00 00 00 63 00 00 00 64 00 00 00 00 00 00 00 01 00 00 00 09 00 00 00 0B 00 00 00 02 00 00 00 0A 00 00 00 04 00 00 00 0B 00 00 00 00 10 00 00 00 63 00 00 00 64 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00 09 00 00 00 0A 00 00 00 0B 00 00 00 2B 00 00 00 2F 00 00 00 06 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 05 00 00 00 55 00 00 00 14 00 00 00 00 00 00 00 04 00 01 02 03 00 00 00 01 00 00 00 04 00 01 02 03 00 00 00 02 00 00 00 04 00 01 02 03 00 00 00 03 00 00 00 04 00 01 02 03 00 00 00 04 00 00 00 04 00 01 02 03 00 00 00 05 00 00 00 04 00 01 02 03 00 00 00 06 00 00 00 04 00 01 02 03 00 00 00 07 00 00 00 04 00 01 02 03 00 00 00 08 00 00 00 04 00 01 02 03 00 00 00 09 00 00 00 04 00 01 02 03 00 00 00 0A 00 00 00 04 00 01 02 03 00 00 00 0B 00 00 00 04 00 01 02 03 00 00 00 0C 00 00 00 04 00 01 02 03 00 00 00 0D 00 00 00 04 00 01 02 03 00 00 00 0E 00 00 00 04 00 01 02 03 00 00 00 0F 00 00 00 02 00 01 00 00 00 10 00 00 00 02 00 01 00 00 00 11 00 00 00 02 00 01 00 00 00 12 00 00 00 02 00 01 00 00 00 13 00 00 00 01 00 00 00 00 13 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00 09 00 00 00 0A 00 00 00 0B 00 00 00 0C 00 00 00 0D 00 00 00 0E 00 00 00 0F 00 00 00 10 00 00 00 11 00 00 00 12 00 00 00 13 00 00 00 00 00 00 00 02 00 00 00 01 00 00 00 02 00 00 00 02 00 00 00 02 00 00 00 03 00 00 00 01 00 00 00 04 00 00 00 01 00 00 00 05 00 00 00 01 00 00 00 06 00 00 00 01 00 00 00 07 00 00 00 01 00 00 00 08 00 00 00 01 00 00 00 09 00 00 00 01 00 00 00 0A 00 00 00 01 00 00 00 0B 00 00 00 01 00 00 00 0C 00 00 00 01 00 00 00 0D 00 00 00 01 00 00 00 0E 00 00 00 00 00 00 00 0F 00 00 00 01 00 00 00 10 00 00 00 01 00 00 00 11 00 00 00 00 00 00 00 12 00 00 00 00 00 00 00 12 00 00 00 00 00 01 83 3F 00 00 00 01 00 01 83 40 00 00 00 02 00 01 83 41 00 00 00 03 00 01 83 42 00 00 00 04 00 01 83 43 00 00 00 05 00 01 83 44 00 00 00 06 00 01 83 45 00 00 00 07 00 01 83 46 00 00 00 08 00 01 83 47 00 00 00 09 00 01 83 48 00 00 00 0A 00 01 83 49 00 00 00 0B 00 01 83 4A 00 00 00 0C 00 01 83 4B 00 00 00 0D 00 01 83 4C 00 00 00 0E 00 01 83 4D 00 00 00 0F 00 01 83 4E 00 00 00 10 00 01 83 4F 00 00 00 11 00 01 E3 32 00 00 00 43 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00 09 00 00 00 0A 00 00 00 0B 00 00 00 0C 00 00 00 0D 00 00 00 0E 00 00 00 0F 00 00 00 10 00 00 00 11 00 00 00 12 00 00 00 13 00 00 00 14 00 00 00 15 00 00 00 16 00 00 00 17 00 00 00 18 00 00 00 19 00 00 00 1A 00 00 00 1B 00 00 00 1C 00 00 00 1D 00 00 00 1E 00 00 00 1F 00 00 00 20 00 00 00 21 00 00 00 22 00 00 00 23 00 00 00 24 00 00 00 26 00 00 00 27 00 00 00 28 00 00 00 29 00 00 00 2A 00 00 00 2B 00 00 00 2C 00 00 00 2D 00 00 00 2E 00 00 00 2F 00 00 00 30 00 00 00 31 00 00 00 32 00 00 00 33 00 00 00 34 00 00 00 39 00 00 00 3A 00 00 00 3B 00 00 00 3C 00 00 00 3D 00 00 00 3E 00 00 00 3F 00 00 00 40 00 00 00 41 00 00 00 42 00 00 00 43 00 00 00 44 00 00 00 45 00 00 00 46 00 00 00 47 00 00 00 02 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 13 00 00 00 18 00 00 00 03 00 00 22 56 00 00 00 8E 00 00 00 3C 74 00 65 00 78 00 5F 00 67 00 63 00 5F 00 6D 00 62 00 6F 00 78 00 5F 00 67 00 61 00 77 00 69 00 62 00 61 00 77 00 69 00 62 00 6F 00 5F 00 64 00 6C 00 67 00 2E 00 64 00 64 00 73 00 00 00 00 01 00 06 4E F6 00 00 25 40 00 00 00 B3 00 00 00 36 74 00 65 00 78 00 5F 00 67 00 63 00 5F 00 6D 00 62 00 6F 00 78 00 5F 00 66 00 72 00 69 00 65 00 6E 00 64 00 5F 00 67 00 69 00 66 00 74 00 2E 00 64 00 64 00 73 00 00 00 00 01 00 0C C5 D8 00 00 27 D2 00 00 00 BF 00 00 00 38 74 00 65 00 78 00 5F 00 67 00 63 00 5F 00 6D 00 62 00 6F 00 78 00 5F 00 73 00 6F 00 6E 00 67 00 6B 00 72 00 61 00 6E 00 5F 00 64 00 6C 00 67 00 2E 00 64 00 64 00 73 00 00 00 00 01 00 0D 5E 44"); oPacket.WriteInt(0); //00 00 00 00 oPacket.WriteInt(3); //00 00 00 03 00 00 00 00 00 00 00 01 00 00 00 02 for (int c = 0; c < 3; c++) { oPacket.WriteInt(c); } oPacket.WriteHexString("00 00 00 09 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 09 00 00 00 01 00 00 00 01 00 00 00 0A 00 00 00 01 00 00 00 01 00 00 00 0E 00 00 00 01 00 00 00 01 00 00 00 12 00 00 00 01 00 00 00 01 00 00 00 14 00 00 00 01 00 00 00 01 00 00 00 02 00 00 00 01 00 00 00 03 00 00 00 03 00 00 00 01 00 00 00 00 00 00 00 15 00 00 00 01 00 00 00 0D 00 00 00 08 00 00 00 00 00 00 00 02 00 00 00 01 00 00 00 02 00 00 00 01 00 00 00 01 00 00 00 05 00 00 00 03 00 00 00 01 00 00 00 06 00 00 00 04 00 00 00 01 00 00 00 00 00 00 00 05 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 02 00 00 00 42 00 00 00 07 00 00 00 08 00 00 00 09 00 00 00 0A 00 00 00 0B 00 00 00 0C 00 00 00 0D 00 00 00 0E 00 00 00 0F 00 00 00 10 00 00 00 11 00 00 00 12 00 00 00 13 00 00 00 14 00 00 00 15 00 00 00 16 00 00 00 17 00 00 00 18 00 00 00 19 00 00 00 1A 00 00 00 1B 00 00 00 1E 00 00 00 24 00 00 00 27 00 00 00 28 00 00 00 29 00 00 00 2A 00 00 00 2B 00 00 00 2C 00 00 00 2D 00 00 00 2E 00 00 00 2F 00 00 00 30 00 00 00 31 00 00 00 32 00 00 00 37 00 00 00 38 00 00 00 39 00 00 00 3A 00 00 00 3B 00 00 00 3C 00 00 00 3D 00 00 00 3E 00 00 00 3F 00 00 00 40 00 00 00 46 00 00 00 49 00 00 00 4A 00 00 00 4C 00 00 00 4E 00 00 00 4F 00 00 00 50 00 00 00 51 00 00 00 53 00 00 00 54 00 00 00 55 00 00 00 56 00 00 00 57 00 00 00 58 00 00 00 59 00 00 00 5A 00 00 00 5B 00 00 00 5C 00 00 00 5D 00 00 00 5E 00 00 00 5F 00 00 00 0B 00 00 00 01 00 00 00 26 00 00 00 0D 00 00 00 01 00 00 00 42 00 00 00 06 00 00 00 04 00 00 00 00 01 00 00 00 63 00 00 00 00 01 00 00 00 10 00 00 00 63 00 00 00 64 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00 09 00 00 00 0A 00 00 00 0B 00 00 00 2B 00 00 00 2F 00 00 00 01 01 00 00 00 0E 00 00 00 0A 00 00 00 63 00 00 00 64 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 09 00 00 00 04 00 00 00 06 00 00 00 05 00 00 00 08 00 00 00 07 00 00 00 0B 00 00 00 05 01 00 00 00 10 00 00 00 63 00 00 00 64 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00 09 00 00 00 0A 00 00 00 0B 00 00 00 2B 00 00 00 2F 00 00 00 03 01 00 00 00 09 00 00 00 63 00 00 00 64 00 00 00 00 00 00 00 01 00 00 00 09 00 00 00 0B 00 00 00 02 00 00 00 0A 00 00 00 04 00 00 00 0B 00 00 00 00 10 00 00 00 63 00 00 00 64 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00 09 00 00 00 0A 00 00 00 0B 00 00 00 2B 00 00 00 2F"); oPacket.WriteInt(6);//00 00 00 06 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 05 for (int c = 0; c < 6; c++) { oPacket.WriteInt(c); } oPacket.WriteInt(SetMaxLevel()); //00 00 00 55 oPacket.WriteInt(CCPCharacter.Length); //13 for (int a = 0; a < CCPCharacter.Length; a++) { oPacket.WriteInt(CCPCharacter[a].CharID); oPacket.WriteInt(CCPCharacter[a].CCPPromotion.Length); for (int b = 0; b < CCPCharacter[a].CCPPromotion.Length; b++) { oPacket.WriteByte((byte)CCPCharacter[a].CCPPromotion[b].Promotion); } } oPacket.WriteHexString("00 00 00 13 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00 09 00 00 00 0A 00 00 00 0B 00 00 00 0C 00 00 00 0D 00 00 00 0E 00 00 00 0F 00 00 00 10 00 00 00 11 00 00 00 12 00 00 00 13"); oPacket.WriteHexString("00 00 00 00 00 00 00 02 00 00 00 01 00 00 00 02 00 00 00 02 00 00 00 02 00 00 00 03 00 00 00 01 00 00 00 04 00 00 00 01 00 00 00 05 00 00 00 01 00 00 00 06 00 00 00 01 00 00 00 07 00 00 00 01 00 00 00 08 00 00 00 01 00 00 00 09 00 00 00 01 00 00 00 0A 00 00 00 01 00 00 00 0B 00 00 00 01 00 00 00 0C 00 00 00 01 00 00 00 0D 00 00 00 01 00 00 00 0E 00 00 00 00 00 00 00 0F 00 00 00 01 00 00 00 10 00 00 00 01 00 00 00 11 00 00 00 00 00 00 00 12 00 00 00 00"); oPacket.WriteHexString("00 00 00 12 00 00 00 00 00 01 83 3F 00 00 00 01 00 01 83 40 00 00 00 02 00 01 83 41 00 00 00 03 00 01 83 42 00 00 00 04 00 01 83 43 00 00 00 05 00 01 83 44 00 00 00 06 00 01 83 45 00 00 00 07 00 01 83 46 00 00 00 08 00 01 83 47 00 00 00 09 00 01 83 48 00 00 00 0A 00 01 83 49 00 00 00 0B 00 01 83 4A 00 00 00 0C 00 01 83 4B 00 00 00 0D 00 01 83 4C 00 00 00 0E 00 01 83 4D 00 00 00 0F 00 01 83 4E 00 00 00 10 00 01 83 4F 00 00 00 11 00 01 E3 32"); oPacket.WriteHexString("00 00 00 43 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00 09 00 00 00 0A 00 00 00 0B 00 00 00 0C 00 00 00 0D 00 00 00 0E 00 00 00 0F 00 00 00 10 00 00 00 11 00 00 00 12 00 00 00 13 00 00 00 14 00 00 00 15 00 00 00 16 00 00 00 17 00 00 00 18 00 00 00 19 00 00 00 1A 00 00 00 1B 00 00 00 1C 00 00 00 1D 00 00 00 1E 00 00 00 1F 00 00 00 20 00 00 00 21 00 00 00 22 00 00 00 23 00 00 00 24 00 00 00 26 00 00 00 27 00 00 00 28 00 00 00 29 00 00 00 2A 00 00 00 2B 00 00 00 2C 00 00 00 2D 00 00 00 2E 00 00 00 2F 00 00 00 30 00 00 00 31 00 00 00 32 00 00 00 33 00 00 00 34 00 00 00 39 00 00 00 3A 00 00 00 3B 00 00 00 3C 00 00 00 3D 00 00 00 3E 00 00 00 3F 00 00 00 40 00 00 00 41 00 00 00 42 00 00 00 43 00 00 00 44 00 00 00 45 00 00 00 46 00 00 00 47"); oPacket.WriteHexString("00 00 00 02 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 00 00 00 13"); oPacket.WriteInt(Enum.GetNames(typeof(MenuItems.list)).Length);//00 00 00 18 oPacket.WriteInt(eventsinfo.Length); LogFactory.GetLog("MAIN").LogInfo("Events Infos: " + eventsinfo.Length); for (int a = 0; a < eventsinfo.Length; a++) { oPacket.WriteInt(eventsinfo[a].EventID); oPacket.WriteInt(eventsinfo[a].EventMBoxID); oPacket.WriteInt(eventsinfo[a].EventTextureFileName.Length * 2); oPacket.WriteUnicodeString(eventsinfo[a].EventTextureFileName); oPacket.WriteInt(eventsinfo[a].EventItem1); oPacket.WriteInt(eventsinfo[a].EventItem2); } oPacket.CompressAndAssemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, ++cs.CRYPT_COUNT); cs.Send(oPacket); } }
public void OnChat(ClientSession cs, InPacket ip) { ip.ReadByte(); // 01 ip.ReadInt(); // 00 00 00 00 int WhereLen = ip.ReadInt(); string Where = ip.ReadUnicodeString(WhereLen); ip.ReadInt(); // 00 00 00 00 ip.ReadInt(); // 00 00 00 00 ip.ReadInt(); // FF FF FF FF int ChatLen = ip.ReadInt(); string Chat = ip.ReadUnicodeString(ChatLen); //LogFactory.GetLog("Main").LogInfo("Chat: {0}", Chat); using (OutPacket op = new OutPacket(GameOpcodes.EVENT_CHAT_NOT)) { op.WriteByte(1); op.WriteInt(cs.LoginUID); op.WriteInt(cs.Nick.Length * 2); op.WriteUnicodeString(cs.Nick); op.WriteInt(0); op.WriteInt(0); op.WriteInt(-1); op.WriteInt(ChatLen); op.WriteUnicodeString(Chat); op.WriteInt(0); op.WriteInt(0); // 채널에 있는 모든 유저중 같은 방 (null이면 로비실이니까.) foreach (ClientSession u in UsersList) { if (u.CurrentRoom == cs.CurrentRoom) { op.Assemble(u.CRYPT_KEY, u.CRYPT_HMAC, u.CRYPT_PREFIX, u.CRYPT_COUNT); u.Send(op); op.CancelAssemble(); // 버퍼 되돌리기 } } } }
public void SendServerList(ClientSession cs) { /*string ServerName = Settings.GetString("GameServer/ServerName"); * string ServerDesc = Settings.GetString("GameServer/ServerDesc"); * string ServerIP = Settings.GetString("GameServer/ExternalIP"); * short ServerPort = Settings.GetShort("GameServer/Port"); * * string TestServerName = Settings.GetString("GameServerTest/ServerName"); * string TestServerDesc = Settings.GetString("GameServerTest/ServerDesc"); * string TestServerIP = Settings.GetString("GameServerTest/ExternalIP"); * short TestServerPort = Settings.GetShort("GameServerTest/Port");*/ using (OutPacket oPacket = new OutPacket(CenterOpcodes.ENU_SERVER_LIST_NOT)) { LoadServerList(); oPacket.WriteInt(serverlist.Length); // 서버 개수 int i = 0; for (int j = 0; j < serverlist.Length; j++) { oPacket.WriteInt(i + 1); // 서버 번호 oPacket.WriteInt(i + 1); // 서버 번호 2 oPacket.WriteInt(serverlist[j].ServerName.Length * 2); oPacket.WriteUnicodeString(serverlist[j].ServerName); oPacket.WriteInt(serverlist[j].ServerIP.Length); oPacket.WriteString(serverlist[j].ServerIP); oPacket.WriteShort((short)serverlist[j].ServerPort); oPacket.WriteInt(serverlist[j].Users); // 현재 접속중인 인원 oPacket.WriteInt(serverlist[j].MaxUsers); // 최대 접속가능 인원 oPacket.WriteInt(serverlist[j].Flag); //00 00 01 43 //323 oPacket.WriteHexString("FF FF FF FF FF FF FF FF"); oPacket.WriteInt(serverlist[j].ServerIP.Length); // 아이피를 또 보낸다. oPacket.WriteString(serverlist[j].ServerIP); // ㅄ oPacket.WriteInt(serverlist[j].ServerDesc.Length * 2); oPacket.WriteUnicodeString(serverlist[j].ServerDesc); oPacket.WriteInt(serverlist[j].ServerType); } oPacket.Assemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, ++cs.CRYPT_COUNT); cs.Send(oPacket); } }
public void SquareList(ClientSession cs) { using (OutPacket oPacket = new OutPacket(GameOpcodes.EVENT_SQUARE_LIST_ACK)) { LogFactory.GetLog("MAIN").LogInfo("PLAYERS IN SQUARE: " + CurrentPlayers); ServerIP = Settings.GetString("Squares/ServerIP"); oPacket.WriteInt(1); //total de servers oPacket.WriteInt(1); oPacket.WriteInt(ServerName.Length * 2); oPacket.WriteUnicodeString(ServerName); oPacket.WriteInt(MaxPlayers); //00 00 00 32 oPacket.WriteInt(CurrentPlayers); //00 00 00 02 oPacket.WriteInt(0); //00 00 00 00 oPacket.WriteIPFromString(Server.UDPRelayIP, true); oPacket.WriteShort(Server.TCPRelayPort); //2D 50 0C C6 25 E4 oPacket.WriteHexString("00 00 00 00 00 00 00 00 00 00 00 01"); oPacket.WriteInt(ServerIP.Length * 2); oPacket.WriteUnicodeString(ServerIP); oPacket.Assemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, ++cs.CRYPT_COUNT); cs.Send(oPacket); } }
public void NotifySHAFile(ClientSession cs) { using (OutPacket oPacket = new OutPacket(CenterOpcodes.ENU_SHAFILENAME_LIST_ACK)) { oPacket.WriteInt(0); oPacket.WriteInt(SHAFileList.Length); for (int i = 0; i <= SHAFileList.Length - 1; i++) { oPacket.WriteInt(SHAFileList[i].Length * 2); oPacket.WriteUnicodeString(SHAFileList[i]); } oPacket.Assemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, ++cs.CRYPT_COUNT); cs.Send(oPacket); } }
public void GMCommands(ClientSession cs, String Chat, InPacket ip) { if (cs.AuthLevel == 1) { //Commands! if (Chat == "/loginout") { using (OutPacket op = new OutPacket(GameOpcodes.EVENT_STAT_LOGINOUT_COUNT)) { op.WriteInt(0); op.CompressAndAssemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, ++cs.CRYPT_COUNT); cs.Send(op); } } if (Chat == "/Char" + Chat.Substring(5)) { cs.CurrentChar = Convert.ToInt32(Chat.Substring(5)); } if (Chat == "/addgp" + (string)Chat.Substring(6)) { DataSet ds = new DataSet(); Database.Query(ref ds, "UPDATE `gc`.`account` SET `Gamepoint` = '{1}' WHERE `LoginUID` = '{0}'", cs.LoginUID, cs.GamePoint + Convert.ToInt32(Chat.Substring(6))); } if (Chat == "!!!!!" + Chat.Substring(5)) { using (OutPacket op = new OutPacket(GameOpcodes.EVENT_SIGN_BOARD_NOT)) { //LogFactory.GetLog("SIGNBOARD").LogInfo("TEXT: " + Chat.Substring(5)); op.WriteHexString("00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"); op.WriteInt((cs.Nick + " : " + Chat.Substring(5)).Length * 2); op.WriteUnicodeString((cs.Nick + " : " + Chat.Substring(5))); foreach (ClientSession u in cs.CurrentChannel.UsersList) { if (u.CurrentRoom == cs.CurrentRoom) { op.Assemble(u.CRYPT_KEY, u.CRYPT_HMAC, u.CRYPT_PREFIX, u.CRYPT_COUNT); u.Send(op); op.CancelAssemble(); } } } } } }
public void AgitLoadComplete(ClientSession cs) { using (OutPacket oPacket = new OutPacket(GameOpcodes.EVENT_AGIT_VISITER_COUNT_BROAD)) { oPacket.WriteInt(cs.LoginUID); oPacket.WriteInt(22); oPacket.WriteInt(22); oPacket.CompressAndAssemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, ++cs.CRYPT_COUNT); cs.Send(oPacket); } using (OutPacket oPacket = new OutPacket(GameOpcodes.EVENT_AGIT_LOADING_COMPLETE_ACK)) { oPacket.WriteInt(0); oPacket.WriteInt(cs.LoginUID); oPacket.WriteInt(cs.LoginUID); oPacket.WriteInt(1);//Users in Agit //Length Visiter Count oPacket.WriteInt(cs.LoginUID); oPacket.WriteInt(4); oPacket.WriteInt(cs.LoginUID); oPacket.WriteInt(cs.Nick.Length * 2); oPacket.WriteUnicodeString(cs.Nick); oPacket.WriteByte((byte)cs.CurrentChar); int MyCharPos = -1; for (int t = 0; t < cs.MyCharacter.MyChar.Length; t++) { if (cs.MyCharacter.MyChar[t].CharType == cs.CurrentChar) { MyCharPos = t; } } oPacket.WriteByte((byte)cs.MyCharacter.MyChar[MyCharPos].Promotion); oPacket.WriteInt(cs.MyCharacter.MyChar[MyCharPos].Level); oPacket.WriteInt(0); oPacket.WriteHexString("00 00 00 01 00 0A 9A 2E 00 00 00 01 33 F5 2A 7B 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 E4 82 00 00 00 1A 53 00 71 00 75 00 69 00 72 00 65 00 20 00 47 00 61 00 69 00 6B 00 6F 00 7A 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 FF DB 30 31 C8 67 2D 00 00 00 01 00 00 00 00 06 00 00 00 00 00 00 00 01 00 00 03 4F 00 00 00 00 00 00 00 02 00 00 03 51 00 00 00 00 00 00 00 05 00 00 03 4A 00 00 00 00 00 00 00 06 00 00 03 50 00 00 00 00 00 00 00 07 00 00 03 4D 00 00 00 00 00 00 00 0B 00 00 03 4E 00 00 00 00 00 00 00 00"); oPacket.CompressAndAssemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, ++cs.CRYPT_COUNT); cs.Send(oPacket); } }
public void FriendList(ClientSession msg, InPacket ip) { using (OutPacket oPacket = new OutPacket(GameOpcodes.EVENT_INVITE_NOT)) { msg.LoginUID = ip.ReadInt(); int LenLogin = ip.ReadInt(); msg.Login = ip.ReadUnicodeString(LenLogin); LogFactory.GetLog("MSG INFOS").LogInfo("LoginUID: " + msg.LoginUID); LogFactory.GetLog("MSG INFOS").LogInfo("Length Lgn: " + LenLogin); LogFactory.GetLog("MSG INFOS").LogInfo("Login: "******"00 00 00 00 00 00 00 01 00 00 00 0A 00 00 00 0A 00 00 00 0C 46 00 72 00 69 00 65 00 6E 00 64 00"); oPacket.WriteInt(listfriends.Length); LogFactory.GetLog("FriendsList").LogInfo("List Length: " + listfriends.Length); for (int z = 0; z < listfriends.Length; z++) { LogFactory.GetLog("FriendsList").LogInfo("FriendName: " + listfriends[z].FriendName); oPacket.WriteInt(listfriends[z].FriendID); oPacket.WriteInt(listfriends[z].FriendID); oPacket.WriteInt(listfriends[z].FriendName.Length * 2); oPacket.WriteUnicodeString(listfriends[z].FriendName); oPacket.WriteHexString("00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 FF FF FF FF");//00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 FF FF FF FF } oPacket.WriteHexString("00 00 00 01 00 00 00 18 42 00 6C 00 6F 00 63 00 6B 00 20 00 46 00 72 00 69 00 65 00 6E 00 64 00 00 00 00 00 FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 01"); oPacket.Assemble(msg.CRYPT_KEY, msg.CRYPT_HMAC, msg.CRYPT_PREFIX, ++msg.CRYPT_COUNT); msg.Send(oPacket); } using (OutPacket oPacket = new OutPacket(GameOpcodes.EVENT_CHANGE_ROOMUSER_INFO_REQ)) { oPacket.WriteHexString("00 00 00 01 00 00 00 0A 00 00 00 00"); oPacket.CompressAndAssemble(msg.CRYPT_KEY, msg.CRYPT_HMAC, msg.CRYPT_PREFIX, ++msg.CRYPT_COUNT); msg.Send(oPacket); } }
public void OnEquipItem(ClientSession cs, InPacket ip) { int LoginIDLen = ip.ReadInt(); string LoginID = ip.ReadUnicodeString(LoginIDLen); ip.ReadInt(); // 00 00 00 00 byte CharNum = ip.ReadByte(); for (byte i = 0; i < CharNum; i++) { byte TargetChar = ip.ReadByte(); int EquipCount = ip.ReadInt(); int MyCharPos = -1; for (int t = 0; t < cs.MyCharacter.MyChar.Length; t++) { if (cs.MyCharacter.MyChar[t].CharType == TargetChar) { MyCharPos = t; } } // 내가 가진 캐릭터 목록에 없다 if (MyCharPos == -1) { continue; } Array.Resize(ref cs.MyCharacter.MyChar[MyCharPos].Equip, EquipCount); for (int j = 0; j < EquipCount; j++) { int ItemID = ip.ReadInt(); ip.ReadInt(); // 00 00 00 01 int ItemUID = ip.ReadInt(); ip.ReadInt(); // 00 00 00 00 ip.ReadInt(); // 00 00 00 00 ip.ReadInt(); // 00 00 00 00 ip.ReadInt(); // 00 00 00 00 ip.ReadByte(); // 00 00 00 ip.ReadByte(); // ip.ReadByte(); // cs.MyCharacter.MyChar[MyCharPos].Equip[j].ItemID = ItemID; cs.MyCharacter.MyChar[MyCharPos].Equip[j].ItemUID = ItemUID; } // 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ip.Skip(99); } // 패킷 구조 똑같이 보내면 된다. using (OutPacket oPacket = new OutPacket(GameOpcodes.EVENT_EQUIP_ITEM_BROAD)) { oPacket.WriteInt(cs.Login.Length * 2); oPacket.WriteUnicodeString(cs.Login); oPacket.WriteInt(0); oPacket.WriteByte((byte)cs.MyCharacter.MyChar.Length); for (int i = 0; i < cs.MyCharacter.MyChar.Length; i++) { oPacket.WriteByte((byte)cs.MyCharacter.MyChar[i].CharType); oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip.Length); for (int j = 0; j < cs.MyCharacter.MyChar[i].Equip.Length; j++) { oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip[j].ItemID); oPacket.WriteInt(1); oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip[j].ItemUID); oPacket.WriteInt(); // 00 00 00 00 oPacket.WriteInt(); // 00 00 00 00 oPacket.WriteInt(); // 00 00 00 00 oPacket.WriteInt(); // 00 00 00 00 oPacket.WriteByte(); // 00 00 00 oPacket.WriteByte(); // oPacket.WriteByte(); // } // 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 oPacket.Skip(99); } oPacket.WriteInt(0); // 그냥 oPacket.CompressAndAssemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, ++cs.CRYPT_COUNT); cs.Send(oPacket); } // 내가 지금 방에 입장하고 있으면 방 인원한테 장비가 바뀌었다고 알려준다. if (cs.CurrentRoom == null) { return; } using (OutPacket oPacket = new OutPacket(GameOpcodes.EVENT_EQUIP_ITEM_BROAD)) { oPacket.WriteInt(cs.Login.Length); oPacket.WriteUnicodeString(cs.Login); oPacket.WriteByte(2); // ??? oPacket.WriteInt(cs.MyCharacter.MyChar.Length); for (int i = 0; i < cs.MyCharacter.MyChar.Length; i++) { oPacket.WriteByte((byte)cs.MyCharacter.MyChar[i].CharType); oPacket.WriteInt(0); // 00 00 00 00 oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip.Length); for (int j = 0; j < cs.MyCharacter.MyChar[i].Equip.Length; j++) { oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip[j].ItemID); oPacket.WriteInt(1); oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip[j].ItemUID); oPacket.WriteInt(); // 00 00 00 00 oPacket.WriteInt(); // 00 00 00 00 oPacket.WriteInt(); // 00 00 00 00 oPacket.WriteInt(); // 00 00 00 00 oPacket.WriteByte(); // 00 00 00 oPacket.WriteByte(); // oPacket.WriteByte(); // } oPacket.Skip(61); oPacket.WriteHexString("FF FF"); oPacket.Skip(32); oPacket.WriteInt(cs.LoginUID); } // 방에 있는 모든 유저에게 전송해야함. for (int i = 0; i < 6; i++) { if (cs.CurrentRoom.Slot[i].Active == true) { oPacket.CompressAndAssemble(cs.CurrentRoom.Slot[i].cs.CRYPT_KEY, cs.CurrentRoom.Slot[i].cs.CRYPT_HMAC, cs.CurrentRoom.Slot[i].cs.CRYPT_PREFIX, cs.CurrentRoom.Slot[i].cs.CRYPT_COUNT); cs.CurrentRoom.Slot[i].cs.Send(oPacket); // 패킷 보내고 oPacket.CancelAssemble(); // 다시 패킷 복구 } } } }
public void OnLogin(ClientSession cs, InPacket ip) { int IDLength = ip.ReadInt(); string ID = ip.ReadString(IDLength); int PWLength = ip.ReadInt(); string PW = ip.ReadString(PWLength); ip.Skip(21); int crc32len = ip.ReadInt(); string crc32 = ip.ReadString(crc32len); LogFactory.GetLog("CRC").LogInfo("LENGTH: " + crc32len + " CRC: " + crc32); DataSet ds = new DataSet(); Database.Query(ref ds, "SELECT * FROM account WHERE Login = '******' AND Passwd = '{1}'", ID, PW); if (ds.Tables[0].Rows.Count == 0) { // 로그인 실패 LogFactory.GetLog("MAIN").LogInfo("{0}의 로그인이 실패하였습니다.", ID); using (OutPacket oPacket = new OutPacket(CenterOpcodes.ENU_VERIFY_ACCOUNT_ACK)) { oPacket.WriteHexString("00 00 00 14"); oPacket.WriteInt(IDLength * 2); oPacket.WriteUnicodeString(ID); oPacket.WriteHexString("00 00 00 00 00"); oPacket.CompressAndAssemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, ++cs.CRYPT_COUNT); cs.Send(oPacket); } } else { SendServerList(cs); SendChannelNews(cs); //SendShop(cs); SendClientContentOpen(cs); SendSocketTableInfo(cs); SendCashbackRatio(cs); using (OutPacket oPacket = new OutPacket(CenterOpcodes.ENU_VERIFY_ACCOUNT_ACK)) { oPacket.WriteHexString("00 00 00 00"); oPacket.WriteInt(IDLength * 2); oPacket.WriteUnicodeString(ID); oPacket.WriteInt(PWLength); oPacket.WriteString(PW); oPacket.WriteHexString("00 00 00 00 14 00 8E A7 C5 01 00 00 00 00 00 00 02 4B 52 00 05 A3 BD 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00"); oPacket.WriteInt(cs.MyLoading.GuildMarkURL.Length * 2); oPacket.WriteUnicodeString(cs.MyLoading.GuildMarkURL); oPacket.WriteHexString("00 00 00 00 00 00 00 00"); //checklist int SHAi = cs.MyLoading.checklist.Length; oPacket.WriteInt(SHAi); for (int i = 0; i <= cs.MyLoading.checklist.Length - 1; i++) { oPacket.WriteInt(cs.MyLoading.checklist[i].nFile.Length * 2); oPacket.WriteUnicodeString(cs.MyLoading.checklist[i].nFile); oPacket.WriteBool(true); } oPacket.WriteHexString("00 00 00 01 00 00 00 03 00 00 00 00 00 00 00 00 64 01 00 00 00 00 00 00 00 64 02 00 00 00 00 00 00 00 64 01 BF 80 00 00 FC 04 97 FF 00 00 00 00 00 00 00 00 00 00 00 00"); oPacket.CompressAndAssemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, ++cs.CRYPT_COUNT); cs.Send(oPacket); } } }
public void OnRoomList(ClientSession cs, InPacket ip) { byte RoomType = ip.ReadByte(); //LogFactory.GetLog("Main").LogInfo("RoomTYPE: " + RoomType); // 그 뒤로 // FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 // 어딘가에 페이지가 있겠다. using (OutPacket oPacket = new OutPacket(GameOpcodes.EVENT_ROOM_LIST_ACK)) { int roomcount = 0;//default is 0 //LogFactory.GetLog("Main").LogInfo("HUEHUE ROOMS Count: " + roomcount); foreach (Room room in RoomsList) { // 대기방만 보여주는 것이라면... if (RoomType == 1) { // 게임시작이거나, 남는자리가 없다면 생략 if (room.Playing == true || room.GetFreeSlot() == 0) { continue; } } roomcount++; } oPacket.WriteInt(roomcount); for (int j = 0; j < roomcount; j++) { /*ushort roomid = 38;//00 26 * string nameRoom = "test"; * string passRoom = "";//01 * ushort fresslots = 4; * ushort players = 1; * bool playing = false; * string nick = "[ADM]Hiro";*/ //Room room = new Room(); /* * oPacket.WriteUShort(1);//00 26 * oPacket.WriteInt("Vamos jogar!".Length * 2);//00 00 00 0C * oPacket.WriteUnicodeString("Vamos jogar!");//68 BE AC B9 68 BE AC B9 21 00 21 00 * oPacket.WriteByte(1); * oPacket.WriteByte(0);//00 * oPacket.WriteInt("".Length * 2);//00 00 00 00 * oPacket.WriteUnicodeString(""); * oPacket.WriteUShort(4);//00 04 * oPacket.WriteUShort(1);//00 01 * oPacket.WriteBool(false);//00 * oPacket.WriteHexString("28 5C DA F2 02 02 00 00 00 08 32 25 A5 77 00 00 00 03 00 00 00 00 00 00 00 01"); * oPacket.WriteInt("[ADM]SkelletonX".Length * 2); * oPacket.WriteUnicodeString("[ADM]SkelletonX"); * oPacket.WriteHexString("02 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 04 5A 00 5A 00 01"); */ foreach (Room room in RoomsList) { ushort roomid = room.ID; //00 26 string nameRoom = room.RoomName; string passRoom = room.RoomPass; //01 ushort fresslots = 4; ushort players = (ushort)room.GetPlayerCount(); bool playing = room.Playing; string nick = room.GetRoomLeaderCS().Nick; //LogFactory.GetLog("Main").LogInfo("roomID: " + roomid); //LogFactory.GetLog("Main").LogInfo("Name Room: " + nameRoom); //LogFactory.GetLog("Main").LogInfo("Pass Room: " + passRoom); //LogFactory.GetLog("Main").LogInfo("Slots: " + fresslots); //LogFactory.GetLog("Main").LogInfo("players: " + players); //LogFactory.GetLog("Main").LogInfo("Playing: " + playing); if (RoomType == 1) { if (room.Playing == true || room.GetFreeSlot() == 0) { continue; } } oPacket.WriteUShort(roomid); //00 26 oPacket.WriteInt(nameRoom.Length * 2); //00 00 00 0C oPacket.WriteUnicodeString(nameRoom); //68 BE AC B9 68 BE AC B9 21 00 21 00 if (passRoom.Length > 0) //01 { oPacket.WriteByte(0); } else { oPacket.WriteByte(1); } oPacket.WriteByte(0); //00 oPacket.WriteInt(passRoom.Length * 2); //00 00 00 00 oPacket.WriteUnicodeString(passRoom); oPacket.WriteUShort(fresslots); //00 04 oPacket.WriteUShort(players); //00 01 oPacket.WriteBool(playing); //00 oPacket.WriteHexString("28 5C DA F2 02 02 00 00 00 08 32 25 A5 77 00 00 00 03 00 00 00 00 00 00 00 01"); oPacket.WriteInt(nick.Length * 2); oPacket.WriteUnicodeString(nick); oPacket.WriteHexString("02 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 04 5A 00 5A 00 01"); } } //} /* 방 정보 조합 * foreach (Room room in RoomsList) * { * // 대기방만 보여주는 것이라면... * if( RoomType == 1 ) * { * // 게임시작이거나, 남는자리가 없다면 생략 * if (room.Playing == true || room.GetFreeSlot() == 0) * continue; * } * * oPacket.WriteUShort(1); * oPacket.WriteInt("kkk".Length * 2); * oPacket.WriteUnicodeString("kkk"); * * if (room.RoomPass.Length > 0) * oPacket.WriteByte(0); // 비밀방 * else * oPacket.WriteByte(1); // 공개방 * oPacket.WriteByte(0); * oPacket.WriteInt("hue".Length * 2); * oPacket.WriteUnicodeString("hue"); * //LogFactory.GetLog("Main").LogInfo("PasswdRoom: " + room.RoomPass); * * // 빈자리 + 유저수 = 총 자리 개수 * oPacket.WriteShort(3 + 1); * //LogFactory.GetLog("Main").LogInfo(3); * oPacket.WriteShort(1); * //LogFactory.GetLog("Main").LogInfo(1); * oPacket.WriteBool(false); * //LogFactory.GetLog("Main").LogInfo("Playing: " + room.Playing); * * oPacket.WriteHexString("2E 02 1B 25 01 00 00 00 00 01 6B F9 38 77 00 00 00 0C 00 00 00 00 00 00 00 01"); * * oPacket.WriteInt("[ADM]SkelletonX".Length * 2); * //LogFactory.GetLog("Main").LogInfo("LEADER NICK: " + room.GetRoomLeaderCS().Nick); * oPacket.WriteUnicodeString("[ADM]SkelletonX"); * * oPacket.WriteHexString("0B 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 01"); * }*/ // 여태껏 조합된 방 정보를 압축한다. int RoomInfoSize = oPacket.ToArray().Length; // 압축하기 전 사이즈 oPacket.CompressBuffer(); byte[] RoomInfo = oPacket.getBuffer(); oPacket.InitBuffer(); // 초기화 // 실제 패킷 작성 oPacket.WriteHexString("00 00 00 00 00 00 00 00 00 00 00 01"); oPacket.WriteInt(4 + RoomInfo.Length); // 압축된 정보크기 + 4(실제 크기버퍼) oPacket.WriteByte(1); // 압축된 데이터다. oPacket.WriteBytes(BitConverter.GetBytes(RoomInfoSize)); // 압축전 사이즈를 일반적으로 넣는다. oPacket.WriteBytes(RoomInfo); // 압축된 방 정보 oPacket.Assemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, cs.CRYPT_COUNT); cs.Send(oPacket); //LogFactory.GetLog("Main").LogHex("ROOMLIST: ", oPacket.getBuffer()); } }
public void OnJoinRoom(ClientSession cs, InPacket ip) { ip.ReadByte(); // 0 ip.ReadByte(); // 0 ip.ReadByte(); // 0 ushort RoomID = ip.ReadUShort(); int PassLen = ip.ReadInt(); string Pass = ""; if (PassLen > 0) { Pass = ip.ReadUnicodeString(PassLen); } Room room = GetRoom(RoomID); if (room == null) { goto cantjoin; } if (room.GetFreeSlot() == 0 || room.Playing == true || cs.CurrentRoom != null) { goto cantjoin; } if (room.RoomPass != Pass) { goto cantjoin; } byte Team1 = 0, Team2 = 0; int EmptyPos1 = -1, EmptyPos2 = -1; for (int i = 0; i < 3; i++) { if (room.Slot[i].Active == true) { Team1++; } if (EmptyPos1 == -1 && room.Slot[i].Open == true) { EmptyPos1 = i; } } for (int i = 3; i < 6; i++) { if (room.Slot[i].Active == true) { Team2++; } if (EmptyPos2 == -1 && room.Slot[i].Open == true) { EmptyPos2 = i; } } int pos = EmptyPos1; if (Team1 >= Team2) { pos = EmptyPos2; } room.Slot[pos].Active = true; room.Slot[pos].cs = cs; room.Slot[pos].Open = false; room.Slot[pos].Spree = 0; room.Slot[pos].Leader = false; room.Slot[pos].AFK = false; cs.CurrentRoom = room; using (OutPacket oPacket = new OutPacket(GameOpcodes.EVENT_JOIN_ROOM_BROAD)) { oPacket.WriteInt(cs.Login.Length * 2); oPacket.WriteUnicodeString(cs.Login); oPacket.WriteInt(cs.LoginUID); oPacket.WriteInt(cs.Nick.Length * 2); oPacket.WriteUnicodeString(cs.Nick); oPacket.WriteInt(pos); oPacket.WriteByte((byte)cs.CurrentChar); oPacket.WriteHexString("00 FF 00 FF 00 FF 00 00 00 00"); oPacket.WriteByte((byte)(pos / 3)); oPacket.WriteHexString("01 00 00 00 0D 00 00 00 00 10 F4 00 00 00 00 00 4E 00 00 00 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 09 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 11 00 00 00 00 00 00 00 00 00 00 00 00 00 00 12 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13 00 00 00 00 00 00 00 00 00 00 00 00 00 00 14 00 00 00 00 00 00 00 00 00 00 00 00 00 00 15 00 00 00 00 00 00 00 00 00 00 00 00 00 00 16 00 00 00 00 00 00 00 00 00 00 00 00 00 00 17 00 00 00 00 00 00 00 00 00 00 00 00 00 00 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 19 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 27 00 00 00 00 00 00 00 00 00 00 00 00 00 00 28 00 00 00 00 00 00 00 00 00 00 00 00 00 00 29 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 31 00 00 00 00 00 00 00 00 00 00 00 00 00 00 32 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 34 00 00 00 00 00 00 00 00 00 00 00 00 00 00 35 00 00 00 00 00 00 00 00 00 00 00 00 00 00 36 00 00 00 00 00 00 00 00 00 00 00 00 00 00 37 00 00 00 00 00 00 00 00 00 00 00 00 00 00 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 39 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 43 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 51 00 00 00 00 00 00 00 00 00 00 00 00 00 00 52 00 00 00 00 00 00 00 00 00 00 00 00 00 00 53 00 00 00 00 00 00 00 00 00 00 00 00 00 00 54 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00 56 00 00 00 00 00 00 00 00 00 00 00 00 00 00 57 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 59 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5F 00 00 00 00 00 00 00 00 00 00 00"); if (room.GetRoomLeaderCS() == cs) { oPacket.WriteByte(1); } else { oPacket.WriteByte(0); } oPacket.WriteHexString("01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"); oPacket.WriteByte((byte)cs.MyCharacter.MyChar.Length); for (int i = 0; i < cs.MyCharacter.MyChar.Length; i++) { oPacket.WriteByte((byte)cs.MyCharacter.MyChar[i].CharType); oPacket.WriteInt(0); oPacket.WriteByte((byte)cs.MyCharacter.MyChar[i].Promotion); oPacket.WriteInt(0); oPacket.WriteByte(0); oPacket.WriteInt(cs.MyCharacter.MyChar[i].Exp); oPacket.WriteByte(0); oPacket.WriteByte(0); oPacket.WriteByte(0); oPacket.WriteByte((byte)cs.MyCharacter.MyChar[i].Level); oPacket.WriteInt(0); oPacket.WriteInt(0); oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip.Length); for (int j = 0; j < cs.MyCharacter.MyChar[i].Equip.Length; j++) { oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip[j].ItemID); oPacket.WriteInt(1); oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip[j].ItemUID); oPacket.WriteInt(0); oPacket.WriteInt(0); oPacket.WriteInt(0); oPacket.WriteInt(0); oPacket.WriteByte(0); oPacket.WriteByte(0); oPacket.WriteByte(0); } //oPacket.WriteHexString("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF 00 00 00 01 00 00 00 00 00 00 00 00 02 00 00 00 A0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 01 FF 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 2C 00 00 01 2C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 07"); oPacket.WriteHexString("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF 00 00 00 01 00"); /* * oPacket.WriteInt(cs.MyCharacter.MyChar[i].EquipSkill.Length); * for (int j = 0; j < cs.MyCharacter.MyChar[i].EquipSkill.Length; j++) * { * oPacket.WriteInt(0); * oPacket.WriteInt(cs.MyCharacter.MyChar[i].EquipSkill[j].SkillGroup); * oPacket.WriteInt(cs.MyCharacter.MyChar[i].EquipSkill[j].SkillID); * }*/ oPacket.WriteInt(0); oPacket.WriteHexString("00 00 00 FF 00 00 00 A0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 FF 00 00 00 00 00 00"); /*oPacket.WriteInt(cs.MyCharacter.MyChar[i].MySkill.Length); * for (int j = 0; j < cs.MyCharacter.MyChar[i].MySkill.Length; j++) * { * oPacket.WriteInt(cs.MyCharacter.MyChar[i].MySkill[j].SkillID); * }*/ oPacket.WriteInt(0); oPacket.WriteHexString("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 2C 00 00 01 2C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 07"); } oPacket.WriteHexString("00 00 00 04 13 00 A8 C0 01 EC A8 C0 9B BA FE A9"); oPacket.WriteIPFromString(cs.GetIP(), false); oPacket.WriteHexString("00 00 00 01 7E F6 00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 E5 6A 00 00 00 01 2C BD 52 5A 00 00 00 00 01 00 00 E5 88 00 00 00 01 2C BD 52 5B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 56 86 32 00 56 87 6E D4 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"); for (int i = 0; i < 6; i++) { if (room.Slot[i].Active == true && room.Slot[i].cs != cs) { oPacket.Assemble(room.Slot[i].cs.CRYPT_KEY, room.Slot[i].cs.CRYPT_HMAC, room.Slot[i].cs.CRYPT_PREFIX, room.Slot[i].cs.CRYPT_COUNT); room.Slot[i].cs.Send(oPacket); oPacket.CancelAssemble(); } } } using (OutPacket op = new OutPacket(GameOpcodes.EVENT_JOIN_ROOM_INFO_ACK)) { op.WriteUShort(RoomID); op.WriteInt(room.RoomName.Length * 2); op.WriteUnicodeString(room.RoomName); op.WriteByte(0); if (room.RoomPass.Length > 0) { op.WriteByte(1); } else { op.WriteByte(0); } op.WriteInt(room.RoomPass.Length * 2); op.WriteUnicodeString(room.RoomPass); op.WriteShort((short)room.GetPlayerCount()); op.WriteShort((short)room.GetFreeSlot()); op.WriteHexString("00 0B"); op.WriteByte((byte)room.GameCategory); op.WriteInt(room.GameMode); op.WriteInt(room.ItemMode); op.WriteBool(room.RandomMap); op.WriteInt(room.GameMap); op.WriteHexString("00 00 00 0C"); for (int i = 0; i < 6; i++) { op.WriteBool(room.Slot[i].Open); } op.WriteHexString("FF FF FF FF 00 00 00 00 00 00 00 00 01"); op.WriteIPFromString(Server.UDPRelayIP, true); op.WriteShort(Server.UDPRelayPort); op.WriteIPFromString(Server.TCPRelayIP, true); op.WriteShort(Server.TCPRelayPort); op.WriteHexString("01 00 01 00 00 01 2C 00 00 00 14 00 02 4B 52 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 06 01 00 00 00 00"); op.Assemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, cs.CRYPT_COUNT); cs.Send(op); } room.SendJoinRoomInfoDivide(cs); return; cantjoin: using (OutPacket op = new OutPacket(GameOpcodes.EVENT_JOIN_ROOM_INFO_DIVIDE_ACK)) { op.WriteInt(6); op.WriteHexString("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 01 30 00 00 00 F9 00 00 09 0D 00 00 00 00 00 00 00 00 F2 04 00 00 00 00 00 00 13 49 F4 FC 09 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 09 13 F2 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"); op.CompressAndAssemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, cs.CRYPT_COUNT); cs.Send(op); } return; }
public void OnJoinRoom(ClientSession cs, InPacket ip) { ip.ReadByte(); // 0 ip.ReadByte(); // 0 ip.ReadByte(); // 0 ip.ReadByte(); // 0 ushort RoomID = ip.ReadUShort(); int PassLen = ip.ReadInt(); string Pass = ""; if (PassLen > 0) { Pass = ip.ReadUnicodeString(PassLen); } //LogFactory.GetLog("ROOM INFO:").LogInfo("ROOM ID: "+RoomID); //LogFactory.GetLog("ROOM INFO:").LogInfo("ROOM Length Password: "******"ROOM INFO:").LogInfo("ROOM Password: "******"Main").LogInfo(" Sergio Dean {0} metade Kana {1} {2} uma determinada ranhura ({3}, {4})", Team1, Team2, pos, EmptyPos1, EmptyPos2); // 방 슬롯에 정보 입력 room.Slot[pos].Active = true; room.Slot[pos].cs = cs; room.Slot[pos].Open = false; room.Slot[pos].Spree = 0; room.Slot[pos].Leader = false; room.Slot[pos].AFK = false; // 유저한테 방 입력 cs.CurrentRoom = room; // 방에 있는 사람들한테 입장했다고 알려준다. (입장하는놈은 제외) using (OutPacket oPacket = new OutPacket(GameOpcodes.EVENT_JOIN_ROOM_BROAD)) { oPacket.WriteInt(cs.Login.Length * 2); oPacket.WriteUnicodeString(cs.Login); oPacket.WriteInt(cs.LoginUID); oPacket.WriteInt(cs.Nick.Length * 2); oPacket.WriteUnicodeString(cs.Nick); oPacket.WriteInt(pos); oPacket.WriteByte((byte)cs.CurrentChar); oPacket.WriteHexString("00 FF 00 FF 00 FF 00 00 00 00"); oPacket.WriteByte((byte)(pos / 3)); // 팀을 구하면 됨. 빠르게 처리하기 위해서 oPacket.WriteHexString("01 00 00 00 0D 00 00 00 00 10 F4 00 00 00 00 00 4E 00 00 00 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 09 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 11 00 00 00 00 00 00 00 00 00 00 00 00 00 00 12 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13 00 00 00 00 00 00 00 00 00 00 00 00 00 00 14 00 00 00 00 00 00 00 00 00 00 00 00 00 00 15 00 00 00 00 00 00 00 00 00 00 00 00 00 00 16 00 00 00 00 00 00 00 00 00 00 00 00 00 00 17 00 00 00 00 00 00 00 00 00 00 00 00 00 00 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 19 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 27 00 00 00 00 00 00 00 00 00 00 00 00 00 00 28 00 00 00 00 00 00 00 00 00 00 00 00 00 00 29 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 31 00 00 00 00 00 00 00 00 00 00 00 00 00 00 32 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 34 00 00 00 00 00 00 00 00 00 00 00 00 00 00 35 00 00 00 00 00 00 00 00 00 00 00 00 00 00 36 00 00 00 00 00 00 00 00 00 00 00 00 00 00 37 00 00 00 00 00 00 00 00 00 00 00 00 00 00 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 39 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 43 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 51 00 00 00 00 00 00 00 00 00 00 00 00 00 00 52 00 00 00 00 00 00 00 00 00 00 00 00 00 00 53 00 00 00 00 00 00 00 00 00 00 00 00 00 00 54 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00 56 00 00 00 00 00 00 00 00 00 00 00 00 00 00 57 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 59 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5F 00 00 00 00 00 00 00 00 00 00 00"); if (room.GetRoomLeaderCS() == cs) { oPacket.WriteByte(1); } else { oPacket.WriteByte(0); } oPacket.WriteHexString("01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"); oPacket.WriteByte((byte)cs.MyCharacter.MyChar.Length); for (int i = 0; i < cs.MyCharacter.MyChar.Length; i++) { oPacket.WriteByte((byte)cs.MyCharacter.MyChar[i].CharType); //LogFactory.GetLog("ROOM INFO:").LogInfo("ROOM Chartype: " + cs.MyCharacter.MyChar[i].CharType); oPacket.WriteInt(0); oPacket.WriteByte((byte)cs.MyCharacter.MyChar[i].Promotion); //LogFactory.GetLog("ROOM INFO:").LogInfo("ROOM Chartype: " + cs.MyCharacter.MyChar[i].Promotion); oPacket.WriteInt(0); oPacket.WriteByte(0); oPacket.WriteInt(cs.MyCharacter.MyChar[i].Exp); //LogFactory.GetLog("ROOM INFO:").LogInfo("ROOM Chartype: " + cs.MyCharacter.MyChar[i].Exp); oPacket.WriteByte(0); oPacket.WriteByte(0); oPacket.WriteByte(0); oPacket.WriteByte((byte)cs.MyCharacter.MyChar[i].Level); //LogFactory.GetLog("ROOM INFO:").LogInfo("ROOM Chartype: " + cs.MyCharacter.MyChar[i].Level); oPacket.WriteInt(0); oPacket.WriteInt(0); oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip.Length); for (int j = 0; j < cs.MyCharacter.MyChar[i].Equip.Length; j++) { oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip[j].ItemID); oPacket.WriteInt(1); oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip[j].ItemUID); oPacket.WriteInt(0); oPacket.WriteInt(0); oPacket.WriteInt(0); oPacket.WriteInt(0); oPacket.WriteByte(0); oPacket.WriteByte(0); oPacket.WriteByte(0); } //oPacket.WriteHexString("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF 00 00 00 01 00 00 00 00 00 00 00 00 02 00 00 00 A0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 01 FF 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 2C 00 00 01 2C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 07"); // 이 패킷이 아래 끝까지 분리됐음. ▼▼ oPacket.WriteHexString("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF 00 00 00 01 00"); // 장착한 스킬 /* * oPacket.WriteInt(cs.MyCharacter.MyChar[i].EquipSkill.Length); * for (int j = 0; j < cs.MyCharacter.MyChar[i].EquipSkill.Length; j++) * { * oPacket.WriteInt(0); * oPacket.WriteInt(cs.MyCharacter.MyChar[i].EquipSkill[j].SkillGroup); * oPacket.WriteInt(cs.MyCharacter.MyChar[i].EquipSkill[j].SkillID); * }*/ oPacket.WriteInt(0); // FF가 스킬포인트일지도 oPacket.WriteHexString("00 00 00 FF 00 00 00 A0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 FF 00 00 00 00 00 00"); // 배운 스킬 /*oPacket.WriteInt(cs.MyCharacter.MyChar[i].MySkill.Length); * for (int j = 0; j < cs.MyCharacter.MyChar[i].MySkill.Length; j++) * { * oPacket.WriteInt(cs.MyCharacter.MyChar[i].MySkill[j].SkillID); * }*/ oPacket.WriteInt(0); oPacket.WriteHexString("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 2C 00 00 01 2C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 07"); // ▲▲ } oPacket.WriteHexString("00 00 00 04 13 00 A8 C0 01 EC A8 C0 9B BA FE A9"); oPacket.WriteIPFromString(cs.GetIP(), false); oPacket.WriteHexString("00 00 00 01 7E F6 00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 E5 6A 00 00 00 01 2C BD 52 5A 00 00 00 00 01 00 00 E5 88 00 00 00 01 2C BD 52 5B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 56 86 32 00 56 87 6E D4 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"); // 방에 있는 모든 유저에게 전송해야함. for (int i = 0; i < 6; i++) { // 나 자신은 제외한 나머지한테 전송 if (room.Slot[i].Active == true && room.Slot[i].cs != cs) { oPacket.Assemble(room.Slot[i].cs.CRYPT_KEY, room.Slot[i].cs.CRYPT_HMAC, room.Slot[i].cs.CRYPT_PREFIX, room.Slot[i].cs.CRYPT_COUNT); room.Slot[i].cs.Send(oPacket); // 패킷 보내고 oPacket.CancelAssemble(); // 다시 패킷 복구 } } } // 방에 접속했다고 알려준다. using (OutPacket op = new OutPacket(GameOpcodes.EVENT_JOIN_ROOM_INFO_ACK)) { op.WriteUShort(RoomID); op.WriteInt(room.RoomName.Length * 2); op.WriteUnicodeString(room.RoomName); op.WriteByte(0); if (room.RoomPass.Length > 0) { op.WriteByte(1); // 비밀방 } else { op.WriteByte(0); // 공개방 } op.WriteInt(room.RoomPass.Length * 2); op.WriteUnicodeString(room.RoomPass); op.WriteShort((short)room.GetPlayerCount()); op.WriteShort((short)room.GetFreeSlot()); op.WriteHexString("00 0B"); op.WriteByte((byte)room.GameCategory); op.WriteInt(room.GameMode); op.WriteInt(room.ItemMode); op.WriteBool(room.RandomMap); op.WriteInt(room.GameMap); op.WriteHexString("00 00 00 0C"); for (int i = 0; i < 6; i++) { op.WriteBool(room.Slot[i].Open); } op.WriteHexString("FF FF FF FF 00 00 00 00 00 00 00 00 01"); op.WriteIPFromString(Server.UDPRelayIP, true); op.WriteShort(Server.UDPRelayPort); op.WriteIPFromString(Server.TCPRelayIP, true); op.WriteShort(Server.TCPRelayPort); op.WriteHexString("01 00 01 00 00 01 2C 00 00 00 14 00 02 4B 52 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 06 01 00 00 00 00"); op.Assemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, cs.CRYPT_COUNT); cs.Send(op); } room.SendJoinRoomInfoDivide(cs); //return; // 방에 입장할 수 없다. cantjoin: using (OutPacket op = new OutPacket(GameOpcodes.EVENT_JOIN_ROOM_INFO_DIVIDE_ACK)) { op.WriteInt(6); op.WriteHexString("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 01 30 00 00 00 F9 00 00 09 0D 00 00 00 00 00 00 00 00 F2 04 00 00 00 00 00 00 13 49 F4 FC 09 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 09 13 F2 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"); op.CompressAndAssemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, cs.CRYPT_COUNT); cs.Send(op); } //return; }
public void OnRoomList2(ClientSession cs, InPacket ip) { byte RoomType = ip.ReadByte(); // 1 = 대기방보기, 0 = 모든방보기 //LogFactory.GetLog("Main").LogInfo("RoomTYPE: " + RoomType); // 그 뒤로 // FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 // 어딘가에 페이지가 있겠다. using (OutPacket oPacket = new OutPacket(GameOpcodes.EVENT_ROOM_LIST_ACK)) { // 방 정보를 조합한 다음에 압축하고, 실제 패킷을 작성한다. // 방 개수 구하기 int roomcount = 0; //LogFactory.GetLog("Main").LogInfo("ROOMS Count: " + roomcount); foreach (Room room in RoomsList) { //LogFactory.GetLog("Main").LogInfo("PasswdRoom: " + room.RoomPass); //LogFactory.GetLog("Main").LogInfo("Slots: " + room.GetFreeSlot()); //LogFactory.GetLog("Main").LogInfo("Players: " + room.GetPlayerCount()); //LogFactory.GetLog("Main").LogInfo("Playing: " + room.Playing); // 대기방만 보여주는 것이라면... if (RoomType == 1) { // 게임시작이거나, 남는자리가 없다면 생략 if (room.Playing == true || room.GetFreeSlot() == 0) { continue; } } roomcount++; //LogFactory.GetLog("Main").LogInfo("Rooms: " + roomcount); } oPacket.WriteInt(roomcount); // 방 정보 조합 foreach (Room room in RoomsList) { // 대기방만 보여주는 것이라면... /*if (RoomType == 1) * { * // 게임시작이거나, 남는자리가 없다면 생략 * if (room.Playing == true || room.GetFreeSlot() == 0) * continue; * } */ oPacket.WriteUShort(room.ID); oPacket.WriteInt(room.RoomName.Length * 2); oPacket.WriteUnicodeString(room.RoomName); if (room.RoomPass.Length > 0) { oPacket.WriteByte(0); // 비밀방 } else { oPacket.WriteByte(1); // 공개방 } oPacket.WriteByte(0); oPacket.WriteInt(room.RoomPass.Length * 2); oPacket.WriteUnicodeString(room.RoomPass); //LogFactory.GetLog("Main").LogInfo("PasswdRoom: " + room.RoomPass); // 빈자리 + 유저수 = 총 자리 개수 oPacket.WriteShort((short)(room.GetFreeSlot() + room.GetPlayerCount())); //LogFactory.GetLog("Main").LogInfo("Slots: " + room.GetFreeSlot()); oPacket.WriteShort((short)room.GetPlayerCount()); //LogFactory.GetLog("Main").LogInfo("Players: " + room.GetPlayerCount()); oPacket.WriteBool(room.Playing); //LogFactory.GetLog("Main").LogInfo("Playing: " + room.Playing); oPacket.WriteHexString("2E 02 1B 25 01 00 00 00 00 01 6B F9 38 77 00 00 00 0C 00 00 00 00 00 00 00 01"); oPacket.WriteInt(room.GetRoomLeaderCS().Nick.Length * 2); //LogFactory.GetLog("Main").LogInfo("LEADER NICK: " + room.GetRoomLeaderCS().Nick); oPacket.WriteUnicodeString(room.GetRoomLeaderCS().Nick); oPacket.WriteHexString("0B 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 01"); } // 여태껏 조합된 방 정보를 압축한다. int RoomInfoSize = oPacket.ToArray().Length; // 압축하기 전 사이즈 oPacket.CompressBuffer(); byte[] RoomInfo = oPacket.getBuffer(); oPacket.InitBuffer(); // 초기화 // 실제 패킷 작성 oPacket.WriteHexString("00 00 00 00 00 00 00 00 00 00 00 01"); oPacket.WriteInt(4 + RoomInfo.Length); // 압축된 정보크기 + 4(실제 크기버퍼) oPacket.WriteByte(1); // 압축된 데이터다. oPacket.WriteBytes(BitConverter.GetBytes(RoomInfoSize)); // 압축전 사이즈를 일반적으로 넣는다. oPacket.WriteBytes(RoomInfo); // 압축된 방 정보 oPacket.Assemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, cs.CRYPT_COUNT); cs.Send(oPacket); //LogFactory.GetLog("Main").LogHex("ROOMLIST: ", oPacket.getBuffer()); } }
public void enterSquare(ClientSession cs) { using (OutPacket oPacket = new OutPacket(GameOpcodes.EVENT_ENTER_SQUARE_ACK)) { PlayersList.Add(cs); oPacket.WriteInt(0); //00 00 00 00 oPacket.WriteInt(CurrentPlayers); //00 00 00 04 /*for (int i = 0; i < CurrentPlayers; i++) * { * oPacket.WriteInt(1);//00 00 00 01 * oPacket.WriteInt(4);//00 00 00 04 * oPacket.WriteInt(1273);//00 00 04 F9 * oPacket.WriteInt("1273_1.png".Length * 2);//00 00 00 14 * oPacket.WriteUnicodeString("1273_1.png");//31 00 32 00 37 00 33 00 5F 00 31 00 2E 00 70 00 6E 00 67 00 * oPacket.WriteInt("BrokenLimit".Length * 2);//00 00 00 16 * oPacket.WriteUnicodeString("BrokenLimit");//42 00 72 00 6F 00 6B 00 65 00 6E 00 4C 00 69 00 6D 00 69 00 74 00 * oPacket.WriteInt(cs.LoginUID);//00 01 59 58 * oPacket.WriteInt(cs.Nick.Length * 2);//00 00 00 08 * oPacket.WriteUnicodeString(cs.Nick);//41 00 6C 00 79 00 73 00 * oPacket.WriteByte(4);//04 //CharID * oPacket.WriteInt(1);//00 00 00 01 * oPacket.WriteInt(7);//Length Equips * for (int j = 0; j < 7; j++) * { * oPacket.WriteInt(380070);//itemID * } * oPacket.WriteHexString("00 00 00 0D 00 00 00 00 00 00 00 01 40 F1 99 9A 3E 8A 3D 71 0B 00 00 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 00 12 C8 F2 00 00 E5 74 00 01 BD E6 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"); * }*/ foreach (ClientSession u in PlayersList) { oPacket.WriteInt(1); //00 00 00 01 oPacket.WriteInt(4); //00 00 00 04 oPacket.WriteInt(u.MyGuilds.GuildID); //00 00 04 F9 oPacket.WriteInt(u.MyGuilds.MarkName.Length * 2); //00 00 00 14 oPacket.WriteUnicodeString(u.MyGuilds.MarkName); //31 00 32 00 37 00 33 00 5F 00 31 00 2E 00 70 00 6E 00 67 00 oPacket.WriteInt(u.MyGuilds.GuildName.Length * 2); //00 00 00 16 oPacket.WriteUnicodeString(u.MyGuilds.GuildName); //42 00 72 00 6F 00 6B 00 65 00 6E 00 4C 00 69 00 6D 00 69 00 74 00 oPacket.WriteInt(u.LoginUID); //00 01 59 58 oPacket.WriteInt(u.Nick.Length * 2); //00 00 00 08 oPacket.WriteUnicodeString(u.Nick); //41 00 6C 00 79 00 73 00 int MyCharPos = -1; for (int t = 0; t < u.MyCharacter.MyChar.Length; t++) { if (u.MyCharacter.MyChar[t].CharType == u.CurrentChar) { MyCharPos = t; } } oPacket.WriteByte((byte)u.MyCharacter.MyChar[MyCharPos].CharType); //0F//CharID /*oPacket.WriteByte((byte)u.CurrentChar);//0F//CharID * //oPacket.WriteInt(0);//Equips * int MyCharPos = -1; * for (int t = 0; t < cs.MyCharacter.MyChar.Length; t++) * if (cs.MyCharacter.MyChar[t].CharType == u.CurrentChar) * MyCharPos = t;*/ oPacket.WriteInt(u.MyCharacter.MyChar[MyCharPos].Level);//00 00 00 01//Level oPacket.WriteInt(u.MyCharacter.MyChar[MyCharPos].Equip.Length); for (int y = 0; y < u.MyCharacter.MyChar[MyCharPos].Equip.Length; y++) { oPacket.WriteInt(u.MyCharacter.MyChar[MyCharPos].Equip[y].ItemID); } //oPacket.WriteHexString("00 00 00 03 00 0D 1D D0 00 0D 1D DA 00 0D 1D E4"); oPacket.WriteHexString("00 00 00 04 00 00 00 00 00 00 00 01 40 F1 99 9A 3E 8A 3D 71 0B 00 00 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 00 12 C8 F2 00 00 E5 74 00 01 BD E6 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"); //("00 00 00 04 00 00 00 00 00 00 00 01 41 14 00 00 3E 8A 3D 71 02 00 00 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 00 E5 6A 00 00 E5 88 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 06 00 00 13 FB 00 00 00 1E 64 00 65 00 66 00 61 00 75 00 6C 00 74 00 6D 00 61 00 72 00 6B 00 2E 00 70 00 6E 00 67 00 00 00 00 14 45 00 6C 00 69 00 74 00 65 00 4D 00 61 00 66 00 69 00 61 00 00 05 F1 A4 00 00 00 16 42 00 72 00 61 00 69 00 6E 00 4D 00 61 00 73 00 74 00 65 00 72 00 0E 00 00 00 4F 00 00 00 20 00 07 DF 6E 00 0C 43 EC 00 0A E2 4A 00 0A DD C2 00 0A DC F0 00 0A DC FA 00 0A D0 52 00 0A D0 3E 00 0A D0 66 00 0A D0 5C 00 0A D0 48 00 0A D0 70 00 0A DD 72 00 12 4C 24 00 0A DD 36 00 0A DB 06 00 12 4C 2E 00 12 4C 38 00 12 4C 10 00 12 4C 1A 00 12 4C 42 00 12 56 B0 00 0A DD 7C 00 12 56 CE 00 12 4E D6 00 0A DE 1C 00 12 56 A6 00 10 5D BA 00 10 57 16 00 0A DE 12 00 12 56 C4 00 05 0F 6E 00 00 00 04 00 00 00 00 00 00 00 01 40 F1 99 9A 3E 8A 3D 71 0B 00 00 00 00 00 00 13 AF EC 00 00 00 10 50 00 72 00 69 00 6E 00 73 00 69 00 6F 00 6E 00 00 21 00 00 00 00 00 00 00 00 00 00 00 00 FF 00 00 00 04 00 12 C8 F2 00 00 E5 74 00 01 BD F0 00 01 BE 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0B 00 13 E6 CE 00 00 00 01 31 FD D9 2D 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13 E6 D8 00 00 00 01 31 FD D9 2E 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13 E6 E2 00 00 00 01 31 FD D9 2F 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13 E6 EC 00 00 00 01 31 FD D9 30 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13 E8 22 00 00 00 01 31 FD D9 31 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13 E3 4A 00 00 00 01 31 FD D9 C0 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13 E3 54 00 00 00 01 31 FD D9 C1 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13 E3 5E 00 00 00 01 31 FD D9 C2 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13 E3 68 00 00 00 01 31 FD D9 C3 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13 E3 72 00 00 00 01 31 FD D9 C4 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13 E3 7C 00 00 00 01 31 FD D9 C5 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03"); } oPacket.WriteIPFromString(Server.TCPRelayIP, true); oPacket.WriteShort(Server.TCPRelayPort);//2D 50 0C C6 25 E4 oPacket.WriteHexString("00 00 00 00 00 00 00 01 41 14 00 00 3E 8A 3D 71"); oPacket.Assemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, ++cs.CRYPT_COUNT); cs.Send(oPacket); } }
public void OnRoomList(ClientSession cs, InPacket ip) { byte RoomType = ip.ReadByte(); using (OutPacket oPacket = new OutPacket(GameOpcodes.EVENT_ROOM_LIST_ACK)) { int roomcount = 0; foreach (Room room in RoomsList) { if (RoomType == 1) { if (room.Playing == true || room.GetFreeSlot() == 0) { continue; } } roomcount++; } oPacket.WriteInt(roomcount); foreach (Room room in RoomsList) { if (RoomType == 1) { if (room.Playing == true || room.GetFreeSlot() == 0) { continue; } } oPacket.WriteUShort(room.ID); oPacket.WriteInt(room.RoomName.Length * 2); oPacket.WriteUnicodeString(room.RoomName); if (room.RoomPass.Length > 0) { oPacket.WriteByte(0); } else { oPacket.WriteByte(1); } oPacket.WriteByte(0); oPacket.WriteInt(room.RoomPass.Length * 2); oPacket.WriteUnicodeString(room.RoomPass); oPacket.WriteShort((short)(room.GetFreeSlot() + room.GetPlayerCount())); oPacket.WriteShort((short)room.GetPlayerCount()); oPacket.WriteBool(room.Playing); oPacket.WriteHexString("2E 02 1B 25 01 00 00 00 00 01 6B F9 38 77 00 00 00 0C 00 00 00 00 00 00 00 01"); oPacket.WriteInt(room.GetRoomLeaderCS().Nick.Length * 2); oPacket.WriteUnicodeString(room.GetRoomLeaderCS().Nick); oPacket.WriteHexString("0B 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 01"); } int RoomInfoSize = oPacket.ToArray().Length; oPacket.CompressBuffer(); byte[] RoomInfo = oPacket.getBuffer(); oPacket.InitBuffer(); oPacket.WriteHexString("00 00 00 00 00 00 00 00 00 00 00 01"); oPacket.WriteInt(4 + RoomInfo.Length); oPacket.WriteByte(1); oPacket.WriteBytes(BitConverter.GetBytes(RoomInfoSize)); oPacket.WriteBytes(RoomInfo); oPacket.Assemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, cs.CRYPT_COUNT); cs.Send(oPacket); } }
public void OnEquipItem(ClientSession cs, InPacket ip) { int LoginIDLen = ip.ReadInt(); string LoginID = ip.ReadUnicodeString(LoginIDLen); ip.ReadInt(); // 00 00 00 00 byte CharNum = ip.ReadByte(); for (byte i = 0; i < CharNum; i++) { byte TargetChar = ip.ReadByte(); int EquipCount = ip.ReadInt(); int MyCharPos = -1; for (int t = 0; t < cs.MyCharacter.MyChar.Length; t++) { if (cs.MyCharacter.MyChar[t].CharType == TargetChar) { MyCharPos = t; } } // 내가 가진 캐릭터 목록에 없다 if (MyCharPos == -1) { continue; } //Array.Resize(ref cs.MyCharacter.MyChar[MyCharPos].Equip, EquipCount); int len = cs.MyCharacter.MyChar[MyCharPos].Equip.Length; for (int j = 0; j < EquipCount; j++) { int kind = 0; int ItemID = ip.ReadInt(); ip.ReadInt(); // 00 00 00 01 int ItemUID = ip.ReadInt(); ip.ReadInt(); // 00 00 00 00 ip.ReadInt(); // 00 00 00 00 ip.ReadInt(); // 00 00 00 00 ip.ReadInt(); // 00 00 00 00 ip.ReadByte(); // 00 00 00 ip.ReadByte(); // ip.ReadByte(); // /* * helm 0 * upper 1 * lower 2 * Weapon 3 * gloves 8 * shoes 9 * Circlet 10 * Wings 12 * Mask 11 * cloak 13 * Stompers 14 * Shields 15 */ DataSet ds3 = new DataSet(); Database.Query(ref ds3, "SELECT `Kind` FROM `gc`.`goodsinfolist` WHERE `GoodsID` = '{0}'", ItemID); if (ds3.Tables[0].Rows.Count == 0) { LogFactory.GetLog("EQUIPS").LogWarning("ITEM NAO EXISTE!"); kind = 0; } else { kind = Convert.ToInt32(ds3.Tables[0].Rows[0]["Kind"].ToString()); } int type = 0; if (kind == 0) { type = 0; } if (kind == 1) { type = 1; } if (kind == 2) { type = 2; } if (kind == 3) { type = 3; } if (kind == 8) { type = 4; } if (kind == 9) { type = 5; } if (kind == 13) { type = 6; } //cs.MyCharacter.MyChar[MyCharPos].Equip[j].ItemID = ItemID; DataSet ds2 = new DataSet(); Database.Query(ref ds2, "SELECT itemID FROM gc.equipment WHERE LoginUID = '{0}' AND CharType = '{1}' AND ItemUID = '{2}'", cs.LoginUID, MyChar[MyCharPos].CharType, ItemUID); if (ds2.Tables[0].Rows.Count == 0) { DataSet ds = new DataSet(); Database.Query(ref ds, "INSERT INTO gc.equipment ( LoginUID, CharType, ItemType, ItemID,ItemUID) VALUES ( '{0}', '{1}', '{2}', '{3}' ,'{4}')", cs.LoginUID, MyChar[MyCharPos].CharType, type, ItemID, ItemUID); } else { DataSet ds = new DataSet(); Database.Query(ref ds, "UPDATE `gc`.`equipment` SET `ItemID` = '{0}' WHERE `LoginUID` = '{1}' AND `CharType` = '{2}' AND `ItemType` = '{3}'", ItemID, cs.LoginUID, MyChar[MyCharPos].CharType, type); } if (EquipCount > len) { for (int k = 0; k < EquipCount; k++) { len++; } } LogFactory.GetLog("EQUIPAMENTOS").LogInfo("ATUAL TYPE: " + type); if (type > len) { for (int h = 0; h < type; h++) { type--; LogFactory.GetLog("EQUIPAMENTOS").LogInfo("ATUAL TYPE: " + type); } } Array.Resize(ref cs.MyCharacter.MyChar[MyCharPos].Equip, len); cs.MyCharacter.MyChar[MyCharPos].TotalEquips++; LogFactory.GetLog("EQUIPS").LogInfo("TOTAL: " + cs.MyCharacter.MyChar[MyCharPos].TotalEquips); cs.MyCharacter.MyChar[MyCharPos].Equip[type].ItemID = ItemID; cs.MyCharacter.MyChar[MyCharPos].Equip[type].ItemUID = ItemUID; //Array.Resize(ref cs.MyCharacter.MyChar[MyCharPos].Equip, EquipCount++); /*cs.MyCharacter.MyChar[MyCharPos].Equip[type].ItemID = ItemID; * cs.MyCharacter.MyChar[MyCharPos].Equip[type].ItemUID = ItemUID;*/ } // 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ip.Skip(99); } // 패킷 구조 똑같이 보내면 된다. using (OutPacket oPacket = new OutPacket(GameOpcodes.EVENT_EQUIP_ITEM_BROAD)) { oPacket.WriteInt(cs.Login.Length * 2); oPacket.WriteUnicodeString(cs.Login); oPacket.WriteInt(0); oPacket.WriteByte((byte)cs.MyCharacter.MyChar.Length); for (int i = 0; i < cs.MyCharacter.MyChar.Length; i++) { oPacket.WriteByte((byte)cs.MyCharacter.MyChar[i].CharType); oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip.Length); for (int j = 0; j < cs.MyCharacter.MyChar[i].Equip.Length; j++) { oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip[j].ItemID); oPacket.WriteInt(1); oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip[j].ItemUID); oPacket.WriteInt(); // 00 00 00 00 oPacket.WriteInt(); // 00 00 00 00 oPacket.WriteInt(); // 00 00 00 00 oPacket.WriteInt(); // 00 00 00 00 oPacket.WriteByte(); // 00 00 00 oPacket.WriteByte(); // oPacket.WriteByte(); // } // 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 oPacket.Skip(99); } oPacket.WriteInt(0); // 그냥 oPacket.CompressAndAssemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, ++cs.CRYPT_COUNT); cs.Send(oPacket); } if (cs.CurrentRoom == null) { return; } using (OutPacket oPacket = new OutPacket(GameOpcodes.EVENT_EQUIP_ITEM_BROAD)) { oPacket.WriteInt(cs.Login.Length); oPacket.WriteUnicodeString(cs.Login); oPacket.WriteByte(2); // ??? oPacket.WriteInt(cs.MyCharacter.MyChar.Length); for (int i = 0; i < cs.MyCharacter.MyChar.Length; i++) { oPacket.WriteByte((byte)cs.MyCharacter.MyChar[i].CharType); oPacket.WriteInt(0); // 00 00 00 00 oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip.Length); for (int j = 0; j < cs.MyCharacter.MyChar[i].Equip.Length; j++) { oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip[j].ItemID); oPacket.WriteInt(1); oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip[j].ItemUID); oPacket.WriteInt(); // 00 00 00 00 oPacket.WriteInt(); // 00 00 00 00 oPacket.WriteInt(); // 00 00 00 00 oPacket.WriteInt(); // 00 00 00 00 oPacket.WriteByte(); // 00 00 00 oPacket.WriteByte(); // oPacket.WriteByte(); // } oPacket.Skip(61); oPacket.WriteHexString("FF FF"); oPacket.Skip(32); oPacket.WriteInt(cs.LoginUID); } for (int i = 0; i < 6; i++) { if (cs.CurrentRoom.Slot[i].Active == true) { oPacket.CompressAndAssemble(cs.CurrentRoom.Slot[i].cs.CRYPT_KEY, cs.CurrentRoom.Slot[i].cs.CRYPT_HMAC, cs.CurrentRoom.Slot[i].cs.CRYPT_PREFIX, cs.CurrentRoom.Slot[i].cs.CRYPT_COUNT); cs.CurrentRoom.Slot[i].cs.Send(oPacket); oPacket.CancelAssemble(); } } } }
public void NotifyContentInfo(ClientSession cs, InPacket ip) { using (OutPacket oPacket = new OutPacket(CenterOpcodes.ENU_CLIENT_CONTENTS_FIRST_INIT_INFO_ACK)) { oPacket.WriteHexString("00 00 00 00 00 00 00 05 00 00 00 00 00 00 00 01 00 00 00"); oPacket.WriteHexString("02 00 00 00 03 00 00 00 04 00 00 00 01 00 00 00 00"); oPacket.WriteInt(InitLoading.Length); oPacket.WriteInt(InitLoading[0].Length * 2); oPacket.WriteUnicodeString(InitLoading[0]); oPacket.WriteInt(InitLoading[1].Length * 2); oPacket.WriteUnicodeString(InitLoading[1]); oPacket.WriteInt(InitLoading[2].Length * 2); oPacket.WriteUnicodeString(InitLoading[2]); oPacket.WriteInt(InitLoading[3].Length * 2); oPacket.WriteUnicodeString(InitLoading[3]); oPacket.WriteHexString("00 00 00 02 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 00"); oPacket.WriteInt(MatchLoading.Length); oPacket.WriteInt(MatchLoading[0].Length * 2); oPacket.WriteUnicodeString(MatchLoading[0]); oPacket.WriteInt(MatchLoading[1].Length * 2); oPacket.WriteUnicodeString(MatchLoading[1]); oPacket.WriteInt(MatchLoading[2].Length * 2); oPacket.WriteUnicodeString(MatchLoading[2]); oPacket.WriteInt(0); oPacket.WriteInt(SquareLoading.Length); oPacket.WriteInt(0); oPacket.WriteInt(SquareLoading[0].Length * 2); oPacket.WriteUnicodeString(SquareLoading[0]); oPacket.WriteInt(1); oPacket.WriteInt(SquareLoading[1].Length * 2); oPacket.WriteUnicodeString(SquareLoading[1]); oPacket.WriteInt(2); oPacket.WriteInt(SquareLoading[2].Length * 2); oPacket.WriteUnicodeString(SquareLoading[2]); oPacket.WriteHexString("00 00 00 03 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 00"); oPacket.WriteInt(HackList.Length); for (int i = 0; i <= HackList.Length - 1; i++) { oPacket.WriteInt(HackList[i].Length * 2); oPacket.WriteUnicodeString(HackList[i]); } oPacket.CompressAndAssemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, ++cs.CRYPT_COUNT); cs.Send(oPacket); LogFactory.GetLog("GET").LogHex("DATA: ", oPacket.getBuffer()); } }