[CodeFactor] Apply fixes (#8)
Co-authored-by: codefactor-io <support@codefactor.io>
This commit is contained in:
parent
4f60afa9d9
commit
56aa830e6a
@ -19,7 +19,7 @@ const retWarn = (msg: string) => c.warn(msg);
|
||||
export default async function handle(session: Session, packet: Packet) {
|
||||
const body = packet.body as PlayerGetTokenCsReq;
|
||||
|
||||
let dataObj = {
|
||||
const dataObj = {
|
||||
retcode: 0,
|
||||
secretKeySeed: 0
|
||||
} as PlayerGetTokenScRsp;
|
||||
|
@ -13,10 +13,10 @@ class MessageType<T> {
|
||||
// "toJSON": (message: T)=> unknown
|
||||
//you can add more fields here from the generated types
|
||||
//fromjson etc...
|
||||
};
|
||||
}
|
||||
|
||||
var messageTypeMap = new Map<PacketName, MessageType<any>>();
|
||||
var messageTypeMapReversed = new Map<MessageType<any>, PacketName>();
|
||||
const messageTypeMap = new Map<PacketName, MessageType<any>>();
|
||||
const messageTypeMapReversed = new Map<MessageType<any>, PacketName>();
|
||||
|
||||
function send<Class extends MessageType<T>, T>(type: Class, data: T) {
|
||||
console.log(type.encode(data).finish())
|
||||
@ -44,7 +44,7 @@ export default class ProtoFactory {
|
||||
static init() {
|
||||
//iterate over everything in types and check if they are a MessageType
|
||||
for (const key of Object.keys(types)) {
|
||||
let value = types[key as keyof typeof types];
|
||||
const value = types[key as keyof typeof types];
|
||||
if (isMessageType(value)) {
|
||||
if (Object.values(CmdID).includes(key)) {
|
||||
messageTypeMap.set(key as PacketName, value);
|
||||
|
Loading…
Reference in New Issue
Block a user