mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-08 09:10:11 +08:00
update
This commit is contained in:
parent
45416ee4ae
commit
cb56add828
@ -1,7 +1,6 @@
|
||||
package net.mamoe.mirai;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import net.mamoe.mirai.event.MiraiEventManager;
|
||||
import net.mamoe.mirai.event.events.server.ServerDisableEvent;
|
||||
import net.mamoe.mirai.event.events.server.ServerEnableEvent;
|
||||
@ -12,7 +11,6 @@ import net.mamoe.mirai.utils.LoggerTextFormat;
|
||||
import net.mamoe.mirai.utils.MiraiLogger;
|
||||
import net.mamoe.mirai.utils.config.MiraiConfig;
|
||||
import net.mamoe.mirai.utils.config.MiraiMapSection;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -97,7 +95,7 @@ public class MiraiServer {
|
||||
});
|
||||
*/
|
||||
|
||||
Robot robot = new Robot(1994701021L);
|
||||
Robot robot = new Robot(1994701021);
|
||||
try {
|
||||
robot.connect(Protocol.Companion.getSERVER_IP().get(2), 8000);
|
||||
} catch (InterruptedException e) {
|
||||
|
@ -5,7 +5,7 @@ package net.mamoe.mirai.contact
|
||||
*
|
||||
* @author Him188moe @ Mirai Project
|
||||
*/
|
||||
abstract class Contact(val number: Long) {
|
||||
abstract class Contact(val number: Int) {
|
||||
|
||||
/**
|
||||
* Async
|
||||
|
@ -1,6 +1,6 @@
|
||||
package net.mamoe.mirai.contact
|
||||
|
||||
class Group(number: Long) : Contact(number) {
|
||||
class Group(number: Int) : Contact(number) {
|
||||
init {
|
||||
Instances.groups.add(this)
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
package net.mamoe.mirai.contact
|
||||
|
||||
|
||||
fun Long.asQQ(): QQ = Instances.qqs.stream().filter { t: QQ? -> t?.number?.equals(this)!! }.findAny().orElse(QQ(this))!!
|
||||
fun Int.asQQ(): QQ = Instances.qqs.stream().filter { t: QQ? -> t?.number?.equals(this)!! }.findAny().orElse(QQ(this))!!
|
||||
|
||||
fun Long.asGroup(): Group = Instances.groups.stream().filter { t: Group? -> t?.number?.equals(this)!! }.findAny().orElse(Group(this))!!
|
||||
fun Int.asGroup(): Group = Instances.groups.stream().filter { t: Group? -> t?.number?.equals(this)!! }.findAny().orElse(Group(this))!!
|
||||
|
||||
fun String.withImage(id: String, type: String) = "{$id}.$type"
|
||||
|
||||
|
@ -3,7 +3,7 @@ package net.mamoe.mirai.contact
|
||||
/**
|
||||
* @author Him188moe @ Mirai Project
|
||||
*/
|
||||
class QQ(number: Long) : Contact(number) {
|
||||
class QQ(number: Int) : Contact(number) {
|
||||
init {
|
||||
Instances.qqs.add(this)
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import io.netty.channel.socket.SocketChannel
|
||||
import io.netty.channel.socket.nio.NioSocketChannel
|
||||
import io.netty.handler.codec.bytes.ByteArrayDecoder
|
||||
import io.netty.handler.codec.bytes.ByteArrayEncoder
|
||||
import net.mamoe.mirai.MiraiServer
|
||||
import net.mamoe.mirai.network.packet.Packet
|
||||
import net.mamoe.mirai.network.packet.client.Client0825ResponsePacket
|
||||
import net.mamoe.mirai.network.packet.server.Server0825Packet
|
||||
@ -22,7 +21,7 @@ import java.net.InetSocketAddress
|
||||
*
|
||||
* @author Him188moe @ Mirai Project
|
||||
*/
|
||||
class Robot(val number: Long) {
|
||||
class Robot(val number: Int) {
|
||||
private lateinit var ctx: ChannelHandlerContext
|
||||
|
||||
internal fun onPacketReceived(packet: Packet) {
|
||||
|
@ -10,7 +10,7 @@ import java.io.IOException
|
||||
* @author Him188moe @ Mirai Project
|
||||
*/
|
||||
@PacketId(0x08_25_31_02)
|
||||
class Client0825ResponsePacket(private val serverIP: String, private val qq: Long) : ClientPacket() {
|
||||
class Client0825ResponsePacket(private val serverIP: String, private val qq: Int) : ClientPacket() {
|
||||
override fun encode() {
|
||||
this.writeQQ(qq)
|
||||
this.writeHex(Protocol.fixVer)
|
||||
|
@ -8,9 +8,9 @@ import java.io.IOException
|
||||
/**
|
||||
* @author Him188moe @ Mirai Project
|
||||
*/
|
||||
@PacketId(value = 0x00_58)
|
||||
@PacketId(0x00_58)
|
||||
class ClientHeartbeatPacket : ClientPacket() {
|
||||
var qq: Long = 0
|
||||
var qq: Int = 0
|
||||
var sessionKey: ByteArray? = null//登录后获得
|
||||
|
||||
@Throws(IOException::class)
|
||||
|
@ -12,10 +12,13 @@ import java.io.IOException
|
||||
*/
|
||||
@PacketId(0x08_25_31_01)
|
||||
class ClientLoginPacket : ClientPacket() {
|
||||
var qq: Long = 0
|
||||
var qq: Int = 0
|
||||
|
||||
@Throws(IOException::class)
|
||||
override fun encode() {
|
||||
//println(this.toUByteArray().toHexString(" "))
|
||||
//exitProcess(1)
|
||||
|
||||
this.writeQQ(qq)
|
||||
this.writeHex(Protocol.fixVer)
|
||||
this.writeHex(Protocol._0825key)
|
||||
@ -51,5 +54,5 @@ fun main() {
|
||||
}
|
||||
|
||||
|
||||
//mirai: 02 37 13 08 25 31 01 00 00 00 00 76 E4 B8 DD 03 00 00 00 01 2E 01 00 00 68 52 00 00 00 00 A4 F1 91 88 C9 82 14 99 0C 9E 56 55 91 23 C8 3D 94 06 D9 3B 40 B5 E2 39 58 F5 E1 71 46 63 FF 6C CE 1E F1 BF CB F5 04 67 96 81 01 7C EF 47 10 15 45 8A 59 F7 B4 39 48 A3 E1 9C 74 3C DC 8E 7E 2F CF B6 C1 0C 2C C6 D6 7F DC 98 12 9C 88 35 29 33 C6 98 A9 81 C7 7B 2D 76 00 67 A1 DD 82 1E 12 04 DF DF 48 18 E0 C3 C8 54 B5 C2 16 A8 C4 CD BD 7D FD 5E 2A A9 74 68 82 44 F7 0D 7D 0E 6C 4F C8 05 03
|
||||
//epl : 02 37 13 08 25 31 02 B8 DD 03 00 00 00 01 2E 01 00 00 68 52 00 00 00 00 A8 F2 14 5F 58 12 60 AF 07 63 97 D6 76 B2 1A 3B D9 9E E9 58 5A E5 46 0D 40 D0 A5 A2 DF 48 8D 23 FB 25 C1 1A 4B D1 27 BA AB B2 69 AB DE 91 C0 63 65 2B 3A 0F 06 0C 3F EC 5C 48 A7 AE 25 06 3F 3C 7A A2 46 91 22 8E B2 A0 41 3F 5D C8 A5 C6 64 64 62 11 A1 9E 14 51 28 39 41 01 07 B5 8B 98 33 AB 50 AD 2F 05 8E F1 17 D7 1D 67 61 1B CD E9 B8 C6 A5 A7 F9 48 F7 BE 05 BC 03
|
||||
//mirai: 02 37 13 08 25 31 01 76 E4 B8 DD 03 00 00 00 01 2E 01 00 00 68 52 00 00 00 00 A4 F1 91 88 C9 82 14 99 0C 9E 56 55 91 23 C8 3D 64 CB 62 9D 7D FE 2A 20 B6 14 B8 25 68 8A 85 D6 34 12 A6 5F C5 7D 94 EE 6F 47 CB E2 45 BF 46 7B 90 A2 F7 C0 E7 9A 73 FF 03 51 B5 2C C2 1A 66 A6 A1 DE 2D FE E2 6F 68 58 F0 C1 92 AF 00 51 60 9D 32 17 73 3E 94 EE 6C F8 CB FF 46 66 E6 9D 8D 51 8D B3 44 EE 52 5F 67 6C 23 EE 0F 04 9C 13 E5 A4 82 DE E7 80 7B 16 4B 9C 03
|
||||
//epl : 02 37 13 08 25 31 01 B8 DD 03 00 00 00 01 2E 01 00 00 68 52 00 00 00 00 A4 F1 91 88 C9 82 14 99 0C 9E 56 55 91 23 C8 3D 37 B1 B1 62 C2 09 06 C5 FA 7B 4A 1A 77 DA BE 69 FE 03 61 3B 20 3E 99 72 33 65 D1 FA 16 03 33 DC E0 91 43 10 6D DE B7 E1 6C F8 21 A6 FA F4 A7 16 7A 7C 78 2F C1 7C 1A 1F 2A 38 68 AF 61 CE F4 0A A5 E8 BC AA 8E 4E AC FA 31 8C 70 33 DD DC FD FC 72 69 B8 FB 80 29 05 F4 61 97 E9 AD DB 89 51 D2 B1 44 A3 B2 E2 B8 89 63 03
|
@ -22,7 +22,7 @@ abstract class ClientPacket : ByteArrayDataOutputStream(), Packet {
|
||||
try {
|
||||
this.writeHex(Protocol.head)
|
||||
this.writeHex(Protocol.ver)
|
||||
writePacketId()
|
||||
this.writePacketId()
|
||||
} catch (e: IOException) {
|
||||
throw RuntimeException(e)
|
||||
}
|
||||
@ -78,6 +78,6 @@ fun DataOutputStream.writeRandom(length: Int) {
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
fun DataOutputStream.writeQQ(qq: Long) {
|
||||
this.writeLong(qq)
|
||||
fun DataOutputStream.writeQQ(qq: Int) {
|
||||
this.writeInt(qq)
|
||||
}
|
Loading…
Reference in New Issue
Block a user