Things and støff
This commit is contained in:
@@ -2,10 +2,10 @@ import { PasswordPrompt } from "./passwordPrompt.js";
|
||||
import { Player } from "../../models/player.js";
|
||||
import { Scene } from "../scene.js";
|
||||
import { UsernamePrompt } from "./usernamePrompt.js";
|
||||
import { CreateUsernamePrompt } from "../playerCreation/createUsernamePrompt.js";
|
||||
|
||||
/** @property {Session} session */
|
||||
export class AuthenticationScene extends Scene {
|
||||
|
||||
introText = [
|
||||
"= Welcome", //
|
||||
];
|
||||
@@ -15,13 +15,13 @@ export class AuthenticationScene extends Scene {
|
||||
|
||||
onReady() {
|
||||
// current prompt
|
||||
this.doPrompt(new UsernamePrompt(this));
|
||||
this.show(UsernamePrompt);
|
||||
}
|
||||
|
||||
/** @param {Player} player */
|
||||
usernameAccepted(player) {
|
||||
this.player = player;
|
||||
this.doPrompt(new PasswordPrompt(this));
|
||||
this.show(PasswordPrompt);
|
||||
}
|
||||
|
||||
passwordAccepted() {
|
||||
@@ -34,4 +34,8 @@ export class AuthenticationScene extends Scene {
|
||||
this.session.setScene("new JustLoggedInScene");
|
||||
}
|
||||
}
|
||||
|
||||
createPlayer() {
|
||||
scene.session.setScene(new PlayerCreationScene(this.scene));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { Prompt } from "../prompt.js";
|
||||
import * as security from "../../utils/security.js";
|
||||
import { Config } from "../../config.js";
|
||||
import { context } from "../../utils/messages.js";
|
||||
|
||||
export class PasswordPrompt extends Prompt {
|
||||
//
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
import { Player } from "../../models/player.js";
|
||||
import { Prompt } from "../prompt.js";
|
||||
import * as security from "../../utils/security.js";
|
||||
import { context } from "../../utils/messages.js";
|
||||
import { gGame } from "../../models/globals.js";
|
||||
import { PlayerCreationScene } from "../playerCreation/playerCreationSene.js";
|
||||
import { Config } from "../../config.js";
|
||||
import { AuthenticationScene } from "./authenticationScene.js";
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* @property {AuthenticationScene} scene
|
||||
*/
|
||||
export class UsernamePrompt extends Prompt {
|
||||
//
|
||||
promptText = [
|
||||
@@ -24,17 +29,14 @@ export class UsernamePrompt extends Prompt {
|
||||
// Let the client know that we're asking for a username
|
||||
promptOptions = { username: true };
|
||||
|
||||
//
|
||||
// User entered ":create"
|
||||
onColon_create() {
|
||||
// User creation scene.
|
||||
this.scene.session.setScene(new PlayerCreationScene(this.scene));
|
||||
/** @returns {AuthenticationScene} */
|
||||
get scene() {
|
||||
return this._scene;
|
||||
}
|
||||
|
||||
//
|
||||
// User replied to our prompt
|
||||
onReply(text) {
|
||||
|
||||
//
|
||||
// do basic syntax checks on usernames
|
||||
if (!security.isUsernameSane(text)) {
|
||||
|
||||
Reference in New Issue
Block a user