bugfixes and cleanup
This commit is contained in:
@@ -9,6 +9,9 @@ export default defineConfig([
|
|||||||
plugins: { js }, // crlf
|
plugins: { js }, // crlf
|
||||||
extends: ["js/recommended"], // crlf
|
extends: ["js/recommended"], // crlf
|
||||||
languageOptions: { globals: globals.browser },
|
languageOptions: { globals: globals.browser },
|
||||||
|
rules: {
|
||||||
|
"no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Config starts here
|
// Config starts here
|
||||||
@@ -16,5 +19,8 @@ export default defineConfig([
|
|||||||
plugins: { js }, // crlf
|
plugins: { js }, // crlf
|
||||||
extends: ["js/recommended"], // crlf
|
extends: ["js/recommended"], // crlf
|
||||||
languageOptions: { globals: globals.node },
|
languageOptions: { globals: globals.node },
|
||||||
|
rules: {
|
||||||
|
"no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import { PasswordPrompt } from "./passwordPrompt.js";
|
import { PasswordPrompt } from "./passwordPrompt.js";
|
||||||
import { Player } from "../../models/player.js";
|
|
||||||
import { Scene } from "../scene.js";
|
import { Scene } from "../scene.js";
|
||||||
import { UsernamePrompt } from "./usernamePrompt.js";
|
import { UsernamePrompt } from "./usernamePrompt.js";
|
||||||
import { PlayerCreationScene } from "../playerCreation/playerCreationSene.js";
|
import { PlayerCreationScene } from "../playerCreation/playerCreationSene.js";
|
||||||
|
import { GameScene } from "../gameLoop/gameScene.js";
|
||||||
|
|
||||||
|
/** @typedef {import("../../models/player.js").Player} Player */
|
||||||
|
|
||||||
/** @property {Session} session */
|
/** @property {Session} session */
|
||||||
export class AuthenticationScene extends Scene {
|
export class AuthenticationScene extends Scene {
|
||||||
@@ -31,7 +33,7 @@ export class AuthenticationScene extends Scene {
|
|||||||
|
|
||||||
this.session.sendText(["= Success!", "((but I don't know what to do now...))"]);
|
this.session.sendText(["= Success!", "((but I don't know what to do now...))"]);
|
||||||
|
|
||||||
this.session.setScene("new JustLoggedInScene");
|
this.session.setScene(new GameScene());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import { Prompt } from "../prompt.js";
|
import { Prompt } from "../prompt.js";
|
||||||
import * as security from "../../utils/security.js";
|
import * as security from "../../utils/security.js";
|
||||||
import { Config } from "../../config.js";
|
import { Config } from "../../config.js";
|
||||||
import { AuthenticationScene } from "./authenticationScene.js";
|
|
||||||
|
/** @typedef {import("./authentication.js").AuthenticationScene} AuthenticationScene */
|
||||||
|
|
||||||
export class PasswordPrompt extends Prompt {
|
export class PasswordPrompt extends Prompt {
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -1,15 +1,10 @@
|
|||||||
import { Player } from "../../models/player.js";
|
|
||||||
import { Prompt } from "../prompt.js";
|
import { Prompt } from "../prompt.js";
|
||||||
import * as security from "../../utils/security.js";
|
|
||||||
import { gGame } from "../../models/globals.js";
|
import { gGame } from "../../models/globals.js";
|
||||||
import { Config } from "../../config.js";
|
import * as security from "../../utils/security.js";
|
||||||
import { AuthenticationScene } from "./authenticationScene.js";
|
|
||||||
|
/** @typedef {import("./authenticationScene.js").AuthenticationScene} AuthenticationScene */
|
||||||
|
/** @typedef {import("../../models/player.js").Player} Player */
|
||||||
|
|
||||||
/**
|
|
||||||
* @class
|
|
||||||
*
|
|
||||||
* @property {AuthenticationScene} scene
|
|
||||||
*/
|
|
||||||
export class UsernamePrompt extends Prompt {
|
export class UsernamePrompt extends Prompt {
|
||||||
//
|
//
|
||||||
promptText = [
|
promptText = [
|
||||||
|
|||||||
@@ -14,6 +14,19 @@ export class GameScene extends Scene {
|
|||||||
// Find out where we are
|
// Find out where we are
|
||||||
// Re-route to the relevant scene if necessary.
|
// Re-route to the relevant scene if necessary.
|
||||||
//
|
//
|
||||||
|
// IF player has stored state THEN
|
||||||
|
// restore it and resume [main flow]
|
||||||
|
// END
|
||||||
|
//
|
||||||
|
// IF player has no characters THEN
|
||||||
|
// go to createCharacterScene
|
||||||
|
// END
|
||||||
|
//
|
||||||
|
// set player's current location = Hovedstad
|
||||||
|
// display the welcome to Hovedstad stuff, and
|
||||||
|
// await the player's commands.
|
||||||
|
//
|
||||||
|
//
|
||||||
// IDEA:
|
// IDEA:
|
||||||
// Does a player have a previous state?
|
// Does a player have a previous state?
|
||||||
// The state that was on the previous session?
|
// The state that was on the previous session?
|
||||||
@@ -21,6 +34,50 @@ export class GameScene extends Scene {
|
|||||||
// If player does not have a previous session
|
// If player does not have a previous session
|
||||||
// then we start in the Adventurers Guild in the Hovedstad
|
// then we start in the Adventurers Guild in the Hovedstad
|
||||||
//
|
//
|
||||||
this.doPrompt("new commandprompt or whatever");
|
this.doPrompt("new command prompt or whatever");
|
||||||
|
}
|
||||||
|
|
||||||
|
get castle() {
|
||||||
|
return `
|
||||||
|
▄
|
||||||
|
█▐▀▀▀▌▄
|
||||||
|
█ ▐▀▀▀▌▌▓▌
|
||||||
|
█ ▄▄ ▄▄▀
|
||||||
|
█ ▐▀▀▀▀
|
||||||
|
▄█▄
|
||||||
|
▓▀ ▀▌
|
||||||
|
▓▀ ▓▄
|
||||||
|
▄▓ ▐▓
|
||||||
|
▄▓ ▀▌
|
||||||
|
▓▀▀▀▀▀▓ ▓▀▀▀▀▓ ▐█▀▀▀▀▓
|
||||||
|
█ █ █ ▓░ ▓▌ ▓░
|
||||||
|
█ ▀▀▀▀▀ ▀▀▀▀▀ ▓░
|
||||||
|
▓▒ ▓░
|
||||||
|
▀▓▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█
|
||||||
|
▐▌ █
|
||||||
|
▓▀▀▀▀█ ▐█▀▀▀█ ▐█▀▀▀▓▒ ▐▌ █ ▐▓▀▀▀▓▒ ▓▀▀▀▓▒ █▀▀▀▀▓
|
||||||
|
█ █ ▐▌ █ ▐▌ ▓▒ ▐▌ ▐██░ █ ▐█ ▓▄ █ ▐▌ █ ▐█
|
||||||
|
▓░ ▐▀▀▀ ▐▀▀▀ █░ ▐▌ ▓██▌ █ ▐█ ▀▀▀▀ ▀▀▀ ▐▌
|
||||||
|
▓▒ █ ▐▌ ▀██▌ █ █ ▐▌
|
||||||
|
▀▀▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▓▀ ▐▌ █ ▀▌▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▓
|
||||||
|
▐▌ █ ▐▌ █ █ ▐▌
|
||||||
|
▐▌ █ ▐▌ █ █ ▐▌
|
||||||
|
▐▌ ▓▌ █▀▀▀▀▀█ ▐▌▐▌▀▀▀▀█ ▓▀▀▀▀▓▄ █ █▀▀▀▀▀█ ▓▌ ▐▌
|
||||||
|
▓▌ ██▌ █ █ ▓▌▓▒ █ █ ▐▌ █ █ █ ▓██ ▐▓
|
||||||
|
▓▒ ▐██▌ █ █ ▓██░ ▐█
|
||||||
|
▓ ▐▐ █ █ ▐▐ █
|
||||||
|
█ █ █ █
|
||||||
|
█ █ ▄▄▄ █ █
|
||||||
|
█ █ ▄▀▀ ▀▀▓▄ █ █
|
||||||
|
█ █ ▄▌ ▀▓ █ █
|
||||||
|
▐█ █ ▓▀ ▐█ █ ▓▒
|
||||||
|
▐▌ █ ▐▓ ▐▌ ▐█ ▓▒
|
||||||
|
▐▌ █ █ █ ▐█ ▐▌
|
||||||
|
▐▌ ▓░ █ █ ▐▌ ▐▌
|
||||||
|
▓▒ ▓░ █ ▓▒ ▐▌ ▐▓
|
||||||
|
▓░ ▓░ ▐▌ ▀▌ ▐▌ ▐█
|
||||||
|
▀▌▄▄ ▓▄▄ ▐█ ▓▌ ▄▄▄▐▌ ▄▄▄▀
|
||||||
|
▐▐▐▀▀▀▀▐▐▐ ▐▐▀▀▀▀▀▀▐▐
|
||||||
|
`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { WebsocketMessage } from "../utils/messages.js";
|
/** @typedef {import("../models/session.js").Session} Session */
|
||||||
import { Session } from "../models/session.js";
|
/** @typedef {import("../util/messages.js").WebsocketMessage} WebsocketMessage */
|
||||||
|
|
||||||
/** @interface */
|
/** @interface */
|
||||||
export class StateInterface {
|
export class StateInterface {
|
||||||
/** @param {Session} session */
|
/** @param {Session} session */
|
||||||
constructor(session) {}
|
constructor(_session) {}
|
||||||
|
|
||||||
onAttach() {}
|
onAttach() {}
|
||||||
|
|
||||||
/** @param {WebsocketMessage} message */
|
/** @param {WebsocketMessage} message */
|
||||||
onMessage(message) {}
|
onMessage(_message) {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,72 +0,0 @@
|
|||||||
/** @typedef {import("../models/session.js").Session} Session */
|
|
||||||
|
|
||||||
const castle = `
|
|
||||||
▄
|
|
||||||
█▐▀▀▀▌▄
|
|
||||||
█ ▐▀▀▀▌▌▓▌
|
|
||||||
█ ▄▄ ▄▄▀
|
|
||||||
█ ▐▀▀▀▀
|
|
||||||
▄█▄
|
|
||||||
▓▀ ▀▌
|
|
||||||
▓▀ ▓▄
|
|
||||||
▄▓ ▐▓
|
|
||||||
▄▓ ▀▌
|
|
||||||
▓▀▀▀▀▀▓ ▓▀▀▀▀▓ ▐█▀▀▀▀▓
|
|
||||||
█ █ █ ▓░ ▓▌ ▓░
|
|
||||||
█ ▀▀▀▀▀ ▀▀▀▀▀ ▓░
|
|
||||||
▓▒ ▓░
|
|
||||||
▀▓▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█
|
|
||||||
▐▌ █
|
|
||||||
▓▀▀▀▀█ ▐█▀▀▀█ ▐█▀▀▀▓▒ ▐▌ █ ▐▓▀▀▀▓▒ ▓▀▀▀▓▒ █▀▀▀▀▓
|
|
||||||
█ █ ▐▌ █ ▐▌ ▓▒ ▐▌ ▐██░ █ ▐█ ▓▄ █ ▐▌ █ ▐█
|
|
||||||
▓░ ▐▀▀▀ ▐▀▀▀ █░ ▐▌ ▓██▌ █ ▐█ ▀▀▀▀ ▀▀▀ ▐▌
|
|
||||||
▓▒ █ ▐▌ ▀██▌ █ █ ▐▌
|
|
||||||
▀▀▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▓▀ ▐▌ █ ▀▌▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▓
|
|
||||||
▐▌ █ ▐▌ █ █ ▐▌
|
|
||||||
▐▌ █ ▐▌ █ █ ▐▌
|
|
||||||
▐▌ ▓▌ █▀▀▀▀▀█ ▐▌▐▌▀▀▀▀█ ▓▀▀▀▀▓▄ █ █▀▀▀▀▀█ ▓▌ ▐▌
|
|
||||||
▓▌ ██▌ █ █ ▓▌▓▒ █ █ ▐▌ █ █ █ ▓██ ▐▓
|
|
||||||
▓▒ ▐██▌ █ █ ▓██░ ▐█
|
|
||||||
▓ ▐▐ █ █ ▐▐ █
|
|
||||||
█ █ █ █
|
|
||||||
█ █ ▄▄▄ █ █
|
|
||||||
█ █ ▄▀▀ ▀▀▓▄ █ █
|
|
||||||
█ █ ▄▌ ▀▓ █ █
|
|
||||||
▐█ █ ▓▀ ▐█ █ ▓▒
|
|
||||||
▐▌ █ ▐▓ ▐▌ ▐█ ▓▒
|
|
||||||
▐▌ █ █ █ ▐█ ▐▌
|
|
||||||
▐▌ ▓░ █ █ ▐▌ ▐▌
|
|
||||||
▓▒ ▓░ █ ▓▒ ▐▌ ▐▓
|
|
||||||
▓░ ▓░ ▐▌ ▀▌ ▐▌ ▐█
|
|
||||||
▀▌▄▄ ▓▄▄ ▐█ ▓▌ ▄▄▄▐▌ ▄▄▄▀
|
|
||||||
▐▐▐▀▀▀▀▐▐▐ ▐▐▀▀▀▀▀▀▐▐
|
|
||||||
`;
|
|
||||||
|
|
||||||
/** @interface */
|
|
||||||
export class JustLoggedInState {
|
|
||||||
/** @param {Session} session */
|
|
||||||
constructor(session) {
|
|
||||||
/** @type {Session} */
|
|
||||||
this.session = session;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show welcome screen
|
|
||||||
onAttach() {
|
|
||||||
this.session.sendText(castle);
|
|
||||||
this.session.sendText(["", "Welcome", "", "You can type “:quit” at any time to quit the game", ""]);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check if we need to create characters for the player
|
|
||||||
if (this.session.player.characters.size === 0) {
|
|
||||||
this.session.sendText("You haven't got any characters, so let's make some\n\n");
|
|
||||||
this.session.setState(new PartyCreationState(this.session));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const character of this.session.player.characters) {
|
|
||||||
this.session.sendText(`Character: ${character.name} (${character.foundation})`);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.session.setState(new AwaitCommandsState(this.session));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -71,9 +71,5 @@ export class CreatePasswordPrompt extends Prompt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.scene.passwordAccepted();
|
this.scene.passwordAccepted();
|
||||||
|
|
||||||
//
|
|
||||||
// Password was correct, go to main game
|
|
||||||
this.session.setState(new JustLoggedInState(this.session));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { Prompt } from "../prompt.js";
|
import { Prompt } from "../prompt.js";
|
||||||
import * as security from "../../utils/security.js";
|
import * as security from "../../utils/security.js";
|
||||||
import { gGame } from "../../models/globals.js";
|
import { gGame } from "../../models/globals.js";
|
||||||
import { PlayerCreationScene } from "./playerCreationSene.js";
|
|
||||||
import { Config } from "../../config.js";
|
/** @typedef {import("./playerCreationScene.js").PlayerCreationScene} PlayerCreationScene */
|
||||||
|
|
||||||
export class CreateUsernamePrompt extends Prompt {
|
export class CreateUsernamePrompt extends Prompt {
|
||||||
//
|
//
|
||||||
|
|||||||
53
scenes/playerCreation/playerCreationScene.js
Normal file
53
scenes/playerCreation/playerCreationScene.js
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
import { Config } from "../../config.js";
|
||||||
|
import { gGame } from "../../models/globals.js";
|
||||||
|
import { generateHash } from "../../utils/security.js";
|
||||||
|
import { Scene } from "../scene.js";
|
||||||
|
import { CreateUsernamePrompt } from "./createUsernamePrompt.js";
|
||||||
|
|
||||||
|
export class PlayerCreationScene extends Scene {
|
||||||
|
introText = "= Create Player";
|
||||||
|
|
||||||
|
/** @protected @type {Player} */
|
||||||
|
player;
|
||||||
|
|
||||||
|
/** @protected @type {string} */
|
||||||
|
password;
|
||||||
|
|
||||||
|
onReady() {
|
||||||
|
//
|
||||||
|
// If there are too many players, stop allowing new players in.
|
||||||
|
if (gGame._players.size >= Config.maxPlayers) {
|
||||||
|
this.session.calamity("Server is full, no more players can be created");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.showPrompt(new CreateUsernamePrompt(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the player has entered a valid and available username.
|
||||||
|
*
|
||||||
|
* @param {string} username
|
||||||
|
*/
|
||||||
|
usernameAccepted(username) {
|
||||||
|
const player = gGame.createPlayer(username);
|
||||||
|
this.player = player;
|
||||||
|
|
||||||
|
this.session.sendSystemMessage("salt", player.salt);
|
||||||
|
this.session.sendText(`Username _*${username}*_ is available, and I've reserved it for you :)`);
|
||||||
|
|
||||||
|
//
|
||||||
|
this.session.sendError("TODO: create a createPasswordPrompt and display it.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Called when the player has entered a password and confirmed it.
|
||||||
|
*
|
||||||
|
* @param {string} password
|
||||||
|
*/
|
||||||
|
passwordAccepted(password) {
|
||||||
|
this.password = password;
|
||||||
|
this.session.sendText("*_Success_* ✅ You will now be asked to log in again, sorry for that ;)");
|
||||||
|
this.player.setPasswordHash(generateHash(this.password));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
import { Scene } from "./scene.js";
|
import { Scene } from "./scene.js";
|
||||||
|
|
||||||
/** @typedef {import("../models/session.js").Session} Session */
|
/** @typedef {import("../models/session.js").Session} Session */
|
||||||
/** @typedef {import("../utils/message.js").WebsocketMessage} WebsocketMessage */
|
|
||||||
/** @typedef {import("../utils/message.js").MessageType} MessageType */
|
/** @typedef {import("../utils/message.js").MessageType} MessageType */
|
||||||
|
/** @typedef {import("../utils/message.js").WebsocketMessage} WebsocketMessage */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {object} PromptMethods
|
* @typedef {object} PromptMethods
|
||||||
* @property {function(...any): any} [onColon_*] - Any method starting with "onColon_"
|
* @property {function(...any): any} [onColon_*] - Any method starting with "onColon_"
|
||||||
@@ -16,7 +17,7 @@ import { Scene } from "./scene.js";
|
|||||||
* - onColon(...)
|
* - onColon(...)
|
||||||
*/
|
*/
|
||||||
export class Prompt {
|
export class Prompt {
|
||||||
/** @private @readonly @type {Scene} */
|
/** @type {Scene} */
|
||||||
_scene;
|
_scene;
|
||||||
|
|
||||||
/** @type {Scene} */
|
/** @type {Scene} */
|
||||||
@@ -29,9 +30,13 @@ export class Prompt {
|
|||||||
* Keys: string matching /^[a-z]+$/ (topic name)
|
* Keys: string matching /^[a-z]+$/ (topic name)
|
||||||
* Values: string containing the help text
|
* Values: string containing the help text
|
||||||
*
|
*
|
||||||
|
* If you want truly custom help texts, you must override the onHelpFallback function,
|
||||||
|
* but overriding the onHelp() function gives you more control and skips this helpText
|
||||||
|
* dictionary entirely.
|
||||||
|
*
|
||||||
* @constant
|
* @constant
|
||||||
* @readonly
|
* @readonly
|
||||||
* @type {Record<string, string>}
|
* @type {Record<string, string|string[]>}
|
||||||
*/
|
*/
|
||||||
helpText = {
|
helpText = {
|
||||||
"": "Sorry, no help available. Figure it out yourself, adventurer", // default help text
|
"": "Sorry, no help available. Figure it out yourself, adventurer", // default help text
|
||||||
@@ -43,7 +48,15 @@ export class Prompt {
|
|||||||
"((or type :quit to run away))", // strings in double parentheses is rendered shaded/faintly
|
"((or type :quit to run away))", // strings in double parentheses is rendered shaded/faintly
|
||||||
];
|
];
|
||||||
|
|
||||||
/** @type {object|string} If string: the prompt's context (username, password, etc) of object, it's all the message's options */
|
/** @type {object|string} If string: the prompt's context (username, password, etc). If object: it's all the message's options */
|
||||||
|
/* @example
|
||||||
|
*
|
||||||
|
* // if the prompt expects a username
|
||||||
|
* promptOptions = { username : true };
|
||||||
|
*
|
||||||
|
* // if the prompt expects a password
|
||||||
|
* promptOptions = { password : true };
|
||||||
|
*/
|
||||||
promptOptions = {};
|
promptOptions = {};
|
||||||
|
|
||||||
/** @type {Session} */
|
/** @type {Session} */
|
||||||
@@ -57,6 +70,13 @@ export class Prompt {
|
|||||||
throw new Error("Expected an instance of >>Scene<< but got " + typeof scene);
|
throw new Error("Expected an instance of >>Scene<< but got " + typeof scene);
|
||||||
}
|
}
|
||||||
this._scene = scene;
|
this._scene = scene;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Fix data formatting shorthand
|
||||||
|
// So lazy dev set property helpText = "fooo" instead of helpText = { "": "fooo" }.
|
||||||
|
if (typeof this.helpText === "string" || Array.isArray(this.helpText)) {
|
||||||
|
this.helpText = { "": this.helpText };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,18 +88,10 @@ export class Prompt {
|
|||||||
this.sendPrompt(this.promptText, this.promptOptions);
|
this.sendPrompt(this.promptText, this.promptOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Triggered when user types `:help` without any topic */
|
/** Triggered when user types `:help [some optional topic]` */
|
||||||
onHelp(topic) {
|
onHelp(topic) {
|
||||||
let h = this.helpText;
|
if (this.helpText[topic]) {
|
||||||
if (typeof h === "string" || Array.isArray(h)) {
|
this.sendText(this.helpText[topic]);
|
||||||
h = { "": h };
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Fix data formatting shorthand
|
|
||||||
// So lazy dev set help = "fooo" instead of help = { "": "fooo" }.
|
|
||||||
if (h[topic]) {
|
|
||||||
this.sendText(h[topic]);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,7 +141,7 @@ export class Prompt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Triggered when the player asks for help on a topic, and we dont have an onHelp_thatParticularTopic method.
|
* Triggered when the player asks for help on a topic, and we don't have an onHelp_thatParticularTopic method.
|
||||||
*
|
*
|
||||||
* @param {string} topic
|
* @param {string} topic
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -86,15 +86,16 @@ export class TileArgs {
|
|||||||
* @returns {TileOptions[]}
|
* @returns {TileOptions[]}
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* // returns
|
*
|
||||||
|
* parse(`O(1); P(orientation=north); E(Gnolls, texture=gnolls)`)
|
||||||
|
*
|
||||||
|
* // the string above will be parsed into:
|
||||||
* // [
|
* // [
|
||||||
* // {name="O", args=[{ key: 0, value: 1 }]},
|
* // {name="O", args=[{ key: 0, value: 1 }]},
|
||||||
* // {name="P", args=[{ key: "orientation", value: "north" }]},
|
* // {name="P", args=[{ key: "orientation", value: "north" }]},
|
||||||
* // {name="E", args=[{ key: 0, value: "Gnolls" }, { key: "texture", value: "gnolls" }]},
|
* // {name="E", args=[{ key: 0, value: "Gnolls" }, { key: "texture", value: "gnolls" }]},
|
||||||
* // ];
|
* // ];
|
||||||
*
|
*
|
||||||
* parse(`O(1); P(orientation=north); E(Gnolls, texture=gnolls)`)
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
export default function parse(input) {
|
export default function parse(input) {
|
||||||
const calls = [];
|
const calls = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user