public void EnterAgit(ClientSession cs) { using (OutPacket oPacket = new OutPacket(GameOpcodes.EVENT_ENTER_AGIT_ACK)) { oPacket.WriteInt(0); oPacket.WriteInt(cs.LoginUID); oPacket.WriteInt(cs.LoginUID); oPacket.WriteHexString("00 00 00 00 00 00 00 00 00 00 06 00 00 00 15 00 00 00 15 00 00 00 15 1D 00 00 00 00 00 00 00 09 00 09 3C 60 00 00 00 01 30 A5 3E C4 FF FF FF FF FF FF FF FF 00 09 3C 60 00 00 00 01 30 A5 3E C5 FF FF FF FF FF FF FF FF 00 09 3D 82 00 00 00 01 30 A5 3E CB FF FF FF FF FF FF FF FF 00 09 3C 56 00 00 00 01 30 A5 3E CC FF FF FF FF FF FF FF FF 00 09 3C 7E 00 00 00 01 30 A5 3E CD FF FF FF FF FF FF FF FF 00 09 3D BE 00 00 00 01 30 A5 3E CE FF FF FF FF FF FF FF FF 00 09 3D D2 00 00 00 01 30 A5 3E CF FF FF FF FF FF FF FF FF 00 0A 05 DC 00 00 00 01 30 A5 3E D0 FF FF FF FF FF FF FF FF 00 0A 05 E6 00 00 00 01 30 A5 3E D1 FF FF FF FF FF FF FF FF 00 00 00 00 57 A6 DC 70 00 00 00 00"); oPacket.WriteIPFromString(Server.UDPRelayIP, true); oPacket.WriteShort(Server.TCPRelayPort);//2D 50 0C C6 25 E4 oPacket.WriteIPFromString(Server.UDPRelayIP, true); oPacket.WriteShort(Server.UDPRelayPort); oPacket.WriteHexString("00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 58 29 FB DC 59 21 3A F0 00 59 21 9F DB 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 1C BD"); oPacket.CompressAndAssemble(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 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 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 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; }