You've already forked KF-MMO-Server
refactor
This commit is contained in:
18
Account/_register.ts
Normal file
18
Account/_register.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { userData } from "../Classes/userData";
|
||||
import { players } from "../Player/players";
|
||||
import { emitLogin } from "./_emitLogin";
|
||||
import { users } from "./users";
|
||||
|
||||
export function register(socket, data){
|
||||
let buff = Buffer.from(data, 'base64');
|
||||
let json : userData = JSON.parse(buff.toString('utf-8'));
|
||||
if (!json.login || !json.password) return
|
||||
|
||||
let result = users.createUser(json.login, json.password);
|
||||
let player = null
|
||||
if(result != null){
|
||||
player = players.createPlayer(result.id)
|
||||
}
|
||||
|
||||
emitLogin(socket, result, player);
|
||||
}
|
||||
Reference in New Issue
Block a user