diff --git a/src/util/ProtoFactory.ts b/src/util/ProtoFactory.ts index ae56ae7..ebc3b82 100644 --- a/src/util/ProtoFactory.ts +++ b/src/util/ProtoFactory.ts @@ -15,10 +15,12 @@ class MessageType { //fromjson etc... } +type UnWrapMessageType = T extends MessageType ? U : T; + const messageTypeMap = new Map>(); const messageTypeMapReversed = new Map, PacketName>(); -function send, T>(type: Class, data: T) { +function send, >(type: Class, data: UnWrapMessageType) { console.log(type.encode(data).finish()) } @@ -59,10 +61,10 @@ export default class ProtoFactory { if (Logger.VERBOSE_LEVEL > VerboseLevel.ALL) c.log(`Initialized with ${messageTypeMap.size} types`); //c.log(this.getName(types.PlayerLoginScRsp)) - return; + // return; //if you want a partial type - send(types.PlayerLoginScRsp, types.PlayerLoginScRsp.fromPartial({ + send(types.PlayerLoginScRsp, { basicInfo: { exp: 0, level: 1, @@ -77,7 +79,11 @@ export default class ProtoFactory { stamina: 100, curTimezone: 1, serverTimestampMs: Math.round(new Date().getTime() / 1000), - })) + bsBinVersion: "1.0.0", + retcode: 0, + isRelay: false, + loginRandom: 0, + }); } }