wynham-games 1.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +270 -0
- package/dist/games/Connect4.d.ts +37 -0
- package/dist/games/Connect4.d.ts.map +1 -0
- package/dist/games/Connect4.js +279 -0
- package/dist/games/Connect4.js.map +1 -0
- package/dist/games/Hangman.d.ts +30 -0
- package/dist/games/Hangman.d.ts.map +1 -0
- package/dist/games/Hangman.js +259 -0
- package/dist/games/Hangman.js.map +1 -0
- package/dist/games/RPS.d.ts +25 -0
- package/dist/games/RPS.d.ts.map +1 -0
- package/dist/games/RPS.js +187 -0
- package/dist/games/RPS.js.map +1 -0
- package/dist/games/Snake.d.ts +33 -0
- package/dist/games/Snake.d.ts.map +1 -0
- package/dist/games/Snake.js +222 -0
- package/dist/games/Snake.js.map +1 -0
- package/dist/games/TicTacToe.d.ts +32 -0
- package/dist/games/TicTacToe.d.ts.map +1 -0
- package/dist/games/TicTacToe.js +293 -0
- package/dist/games/TicTacToe.js.map +1 -0
- package/dist/games/index.d.ts +6 -0
- package/dist/games/index.d.ts.map +1 -0
- package/dist/games/index.js +17 -0
- package/dist/games/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/locales/en-US.d.ts +103 -0
- package/dist/locales/en-US.d.ts.map +1 -0
- package/dist/locales/en-US.js +169 -0
- package/dist/locales/en-US.js.map +1 -0
- package/dist/locales/es.d.ts +103 -0
- package/dist/locales/es.d.ts.map +1 -0
- package/dist/locales/es.js +169 -0
- package/dist/locales/es.js.map +1 -0
- package/dist/locales/fr.d.ts +103 -0
- package/dist/locales/fr.d.ts.map +1 -0
- package/dist/locales/fr.js +169 -0
- package/dist/locales/fr.js.map +1 -0
- package/dist/locales/index.d.ts +522 -0
- package/dist/locales/index.d.ts.map +1 -0
- package/dist/locales/index.js +29 -0
- package/dist/locales/index.js.map +1 -0
- package/dist/locales/it.d.ts +103 -0
- package/dist/locales/it.d.ts.map +1 -0
- package/dist/locales/it.js +169 -0
- package/dist/locales/it.js.map +1 -0
- package/dist/structures/GameManager.d.ts +32 -0
- package/dist/structures/GameManager.d.ts.map +1 -0
- package/dist/structures/GameManager.js +183 -0
- package/dist/structures/GameManager.js.map +1 -0
- package/dist/structures/Types.d.ts +241 -0
- package/dist/structures/Types.d.ts.map +1 -0
- package/dist/structures/Types.js +51 -0
- package/dist/structures/Types.js.map +1 -0
- package/dist/structures/Utils.d.ts +49 -0
- package/dist/structures/Utils.d.ts.map +1 -0
- package/dist/structures/Utils.js +197 -0
- package/dist/structures/Utils.js.map +1 -0
- package/dist/variables/Game.d.ts +5 -0
- package/dist/variables/Game.d.ts.map +1 -0
- package/dist/variables/Game.js +84 -0
- package/dist/variables/Game.js.map +1 -0
- package/dist/variables/index.d.ts +2 -0
- package/dist/variables/index.d.ts.map +1 -0
- package/dist/variables/index.js +18 -0
- package/dist/variables/index.js.map +1 -0
- package/package.json +36 -0
package/README.md
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
# game
|
|
2
|
+
|
|
3
|
+
An open-source Node.js library built on top of [Discord.js](https://discord.js.org/) that lets you create and manage interactive mini-games inside your Discord bot with a single function call.
|
|
4
|
+
|
|
5
|
+
It ships with player invitations, anti-spam cooldowns, bot opponents (with difficulty levels), full theming, and built-in translations.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- 🎮 **5 ready-to-play games** — Connect Four, Tic-Tac-Toe, Rock Paper Scissors, Hangman and Snake.
|
|
10
|
+
- 🤖 **Play against the bot** — set player 2 to your client user and pick a difficulty (`Easy` → `Impossible`).
|
|
11
|
+
- 👥 **Player-vs-player invites** — the challenged user gets an Accept / Decline prompt before the game starts.
|
|
12
|
+
- 🛡️ **Anti-spam & cooldowns** — built-in protection so the same users can't flood your bot with games.
|
|
13
|
+
- 🌍 **i18n out of the box** — English, French, Spanish and Italian, selectable per manager or per game.
|
|
14
|
+
- 🎨 **Theming** — customise embed colors, emojis, titles and input mode (buttons or select menu).
|
|
15
|
+
|
|
16
|
+
## Requirements
|
|
17
|
+
|
|
18
|
+
- Node.js
|
|
19
|
+
- [`discord.js`](https://www.npmjs.com/package/discord.js) `^14.26.4` (peer dependency — install it in your bot project).
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install wynham-games@beta discord.js
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Quick start
|
|
28
|
+
|
|
29
|
+
The whole library revolves around a single class: **`GameManager`**. You instantiate it once with your Discord client, then call `createGame(...)` from a slash command interaction.
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { Client, GatewayIntentBits } from "discord.js";
|
|
33
|
+
import { GameManager, GameNameType } from "wynham-games";
|
|
34
|
+
|
|
35
|
+
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
|
|
36
|
+
|
|
37
|
+
// Create the manager once, ideally next to your client setup.
|
|
38
|
+
const games = new GameManager(client);
|
|
39
|
+
|
|
40
|
+
client.on("interactionCreate", async interaction => {
|
|
41
|
+
if (!interaction.isChatInputCommand()) return;
|
|
42
|
+
|
|
43
|
+
if (interaction.commandName === "connect4") {
|
|
44
|
+
const opponent = interaction.options.getUser("opponent", true);
|
|
45
|
+
|
|
46
|
+
await games.createGame(GameNameType.Connect4, interaction, {
|
|
47
|
+
players: [interaction.user, opponent],
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
client.login(process.env.TOKEN);
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
That's it — `createGame` automatically defers the reply, shows the invite, waits for the opponent, and runs the game to completion.
|
|
56
|
+
|
|
57
|
+
## Core concept: `GameManager`
|
|
58
|
+
|
|
59
|
+
### Constructor
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
new GameManager(client: Client, options?: GameManagerOptions)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
| Option | Type | Default | Description |
|
|
66
|
+
| ----------------- | --------- | ------------------ | ------------------------------------------------------------------------------------ |
|
|
67
|
+
| `antiSpam.enable` | `boolean` | `true` | Prevents the same pair of players from starting back-to-back games. |
|
|
68
|
+
| `antiSpam.time` | `number` | `5000` | Cooldown duration in milliseconds. |
|
|
69
|
+
| `locale` | `Locale` | `Locale.EnglishUS` | Default language for every game created by this manager. Can be overridden per game. |
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
import { Locale } from "discord.js";
|
|
73
|
+
|
|
74
|
+
const games = new GameManager(client, {
|
|
75
|
+
antiSpam: { enable: true, time: 10_000 },
|
|
76
|
+
locale: Locale.French,
|
|
77
|
+
});
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### `createGame(gameName, interaction, options)`
|
|
81
|
+
|
|
82
|
+
Validates the players, displays the invitation/difficulty menu when needed, and launches the game.
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
createGame(gameName: GameNameType, interaction: Interaction, options): Promise<void>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
- **`gameName`** — one of the `GameNameType` enum values.
|
|
89
|
+
- **`interaction`** — a repliable slash-command interaction. It is deferred automatically if it hasn't been already.
|
|
90
|
+
- **`options`** — the per-game options object (always contains the `players` tuple, see below).
|
|
91
|
+
|
|
92
|
+
The method is overloaded, so TypeScript infers the correct options type from the `gameName` you pass.
|
|
93
|
+
|
|
94
|
+
#### Bot opponents
|
|
95
|
+
|
|
96
|
+
Only **RPS** and **Tic-Tac-Toe** support a bot opponent (`players[1].bot === true`):
|
|
97
|
+
|
|
98
|
+
- **RPS** runs immediately against the bot (the bot plays a random choice).
|
|
99
|
+
- **Tic-Tac-Toe** first shows a difficulty-selection menu, then runs against the bot.
|
|
100
|
+
|
|
101
|
+
**Connect Four** and **Hangman** are player-vs-player only — passing a bot as the second player is rejected.
|
|
102
|
+
|
|
103
|
+
For human-vs-human, the second player is sent an **Accept / Decline** invite and the game only starts once they accept.
|
|
104
|
+
|
|
105
|
+
**Snake** is single-player: it takes a single `player` instead of a `players` tuple, and starts immediately with no invite.
|
|
106
|
+
|
|
107
|
+
## Games & options
|
|
108
|
+
|
|
109
|
+
Every option object shares the `players` field and most share `turnTimeout`, `locale`, `theme` and `lang`. The table below lists what is specific to each game.
|
|
110
|
+
|
|
111
|
+
### Shared options
|
|
112
|
+
|
|
113
|
+
| Option | Type | Default | Description |
|
|
114
|
+
| ------------------ | -------------- | ---------------- | -------------------------------------------------------------- |
|
|
115
|
+
| `players` | `[User, User]` | — | **Required.** The two participants. Player 2 may be the bot. |
|
|
116
|
+
| `turnTimeout` | `number` | `30` | Max seconds a player has to act before the game ends (15–360). |
|
|
117
|
+
| `locale` | `Locale` | manager's locale | Overrides the manager language for this game only. |
|
|
118
|
+
| `theme.colors` | `object` | see below | Embed colors for play / win / draw states. |
|
|
119
|
+
| `lang.title` | `string` | game name | Title shown on the game board. |
|
|
120
|
+
| `lang.inviteTitle` | `string` | `"… Challenge"` | Title shown in the invite message. |
|
|
121
|
+
|
|
122
|
+
### `GameNameType.Connect4` — `Connect4Options`
|
|
123
|
+
|
|
124
|
+
| Option | Type | Default | Description |
|
|
125
|
+
| ---------------------- | ----------- | --------- | --------------------------------------------- |
|
|
126
|
+
| `theme.emojis.player1` | `string` | `🔴` | Player 1 pieces. |
|
|
127
|
+
| `theme.emojis.player2` | `string` | `🟡` | Player 2 pieces. |
|
|
128
|
+
| `theme.emojis.empty` | `string` | `⬛` | Empty cells. |
|
|
129
|
+
| `theme.emojis.win` | `string` | `⚪` | Winning pieces. |
|
|
130
|
+
| `theme.inputType` | `InputType` | `Buttons` | Column input mode: `Buttons` or `SelectMenu`. |
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
import { GameNameType, InputType } from "wynham-games";
|
|
134
|
+
|
|
135
|
+
await games.createGame(GameNameType.Connect4, interaction, {
|
|
136
|
+
players: [interaction.user, opponent],
|
|
137
|
+
turnTimeout: 45,
|
|
138
|
+
theme: {
|
|
139
|
+
emojis: { player1: "🔵", player2: "🔴" },
|
|
140
|
+
inputType: InputType.SelectMenu,
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### `GameNameType.TicTacToe` — `TicTacToeOptions`
|
|
146
|
+
|
|
147
|
+
| Option | Type | Default | Description |
|
|
148
|
+
| ---------------------- | --------------- | ------- | ------------------------------------------------------ |
|
|
149
|
+
| `difficulty` | `BotDifficulty` | `Hard` | Bot strength when player 2 is a bot — see table below. |
|
|
150
|
+
| `theme.emojis.player1` | `string` | `❌` | Player 1 marks. |
|
|
151
|
+
| `theme.emojis.player2` | `string` | `⭕` | Player 2 marks. |
|
|
152
|
+
| `theme.emojis.empty` | `string` | `⬜` | Empty cells. |
|
|
153
|
+
|
|
154
|
+
The bot opponent behaves differently per difficulty:
|
|
155
|
+
|
|
156
|
+
| Difficulty | Behaviour |
|
|
157
|
+
| ------------ | ---------------------------------------------------------- |
|
|
158
|
+
| `Easy` | Always plays a random move. |
|
|
159
|
+
| `Normal` | Plays the optimal move ~50% of the time, random otherwise. |
|
|
160
|
+
| `Hard` | Plays the optimal move ~80% of the time. |
|
|
161
|
+
| `Impossible` | Always optimal (minimax, unbeatable). |
|
|
162
|
+
|
|
163
|
+
### `GameNameType.RPS` — `RPSOptions`
|
|
164
|
+
|
|
165
|
+
| Option | Type | Default | Description |
|
|
166
|
+
| ----------------------- | -------- | ------- | --------------- |
|
|
167
|
+
| `theme.emojis.rock` | `string` | `✊` | Rock emoji. |
|
|
168
|
+
| `theme.emojis.paper` | `string` | `🤚` | Paper emoji. |
|
|
169
|
+
| `theme.emojis.scissors` | `string` | `✌️` | Scissors emoji. |
|
|
170
|
+
|
|
171
|
+
### `GameNameType.Hangman` — `HangmanOptions`
|
|
172
|
+
|
|
173
|
+
| Option | Type | Default | Description |
|
|
174
|
+
| ----------- | ------- | ------- | -------------------------------- |
|
|
175
|
+
| `lifeCount` | `1`–`9` | `6` | Number of wrong guesses allowed. |
|
|
176
|
+
|
|
177
|
+
> The Hangman word list is taken from the active locale, so changing `locale` also changes the language of the words to guess.
|
|
178
|
+
|
|
179
|
+
### `GameNameType.Snake` — `SnakeOptions`
|
|
180
|
+
|
|
181
|
+
> **Single-player.** Snake does **not** use the shared `players` / `lang.inviteTitle` fields. It takes a single `player` and starts immediately — no invite is sent.
|
|
182
|
+
|
|
183
|
+
| Option | Type | Default | Description |
|
|
184
|
+
| -------------------- | -------- | ------- | ------------------------------------------------------------------- |
|
|
185
|
+
| `player` | `User` | — | **Required.** The player (must not be a bot). |
|
|
186
|
+
| `turnTimeout` | `number` | `30` | Max seconds the player can stay idle between two moves (15–360). |
|
|
187
|
+
| `boardWidth` | `number` | `10` | Board width in cells (clamped 5–12). |
|
|
188
|
+
| `boardHeight` | `number` | `10` | Board height in cells (clamped 5–12). |
|
|
189
|
+
| `theme.colors.lose` | `number` | `0x808080` | Color on game over / timeout (replaces the shared `draw` color). |
|
|
190
|
+
| `theme.emojis.head` | `string` | `🟢` | Snake head. |
|
|
191
|
+
| `theme.emojis.body` | `string` | `🟩` | Snake body. |
|
|
192
|
+
| `theme.emojis.food` | `string` | `🍎` | Food. |
|
|
193
|
+
| `theme.emojis.empty` | `string` | `⬛` | Empty cells. |
|
|
194
|
+
| `lang.title` | `string` | `"Snake"` | Title shown on the game board. |
|
|
195
|
+
|
|
196
|
+
The player moves the snake one cell per button press (⬅️ ⬆️ ⬇️ ➡️) and can quit with ⏹️. Eating the 🍎 grows the snake and increases the score; hitting a wall or the snake's own body ends the game.
|
|
197
|
+
|
|
198
|
+
```ts
|
|
199
|
+
import { GameNameType } from "wynham-games";
|
|
200
|
+
|
|
201
|
+
await games.createGame(GameNameType.Snake, interaction, {
|
|
202
|
+
player: interaction.user,
|
|
203
|
+
boardWidth: 10,
|
|
204
|
+
boardHeight: 10,
|
|
205
|
+
});
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Internationalisation
|
|
209
|
+
|
|
210
|
+
Built-in locales are keyed by the Discord.js `Locale` enum:
|
|
211
|
+
|
|
212
|
+
| Locale | Enum value |
|
|
213
|
+
| ------------ | ------------------ |
|
|
214
|
+
| English (US) | `Locale.EnglishUS` |
|
|
215
|
+
| French | `Locale.French` |
|
|
216
|
+
| Spanish (ES) | `Locale.SpanishES` |
|
|
217
|
+
| Italian | `Locale.Italian` |
|
|
218
|
+
|
|
219
|
+
You can resolve a player's own language and fall back to English:
|
|
220
|
+
|
|
221
|
+
```ts
|
|
222
|
+
import { locales, Locale } from "wynham-games";
|
|
223
|
+
|
|
224
|
+
const locale = locales[interaction.locale] ?? locales[Locale.EnglishUS];
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Or simply pass `interaction.locale` (or `interaction.guildLocale`) as the `locale` option when creating a game.
|
|
228
|
+
|
|
229
|
+
## Enums reference
|
|
230
|
+
|
|
231
|
+
```ts
|
|
232
|
+
enum GameNameType {
|
|
233
|
+
Connect4,
|
|
234
|
+
RPS,
|
|
235
|
+
TicTacToe,
|
|
236
|
+
Hangman,
|
|
237
|
+
Snake,
|
|
238
|
+
}
|
|
239
|
+
enum BotDifficulty {
|
|
240
|
+
Easy,
|
|
241
|
+
Normal,
|
|
242
|
+
Hard,
|
|
243
|
+
Impossible,
|
|
244
|
+
}
|
|
245
|
+
enum InputType {
|
|
246
|
+
SelectMenu,
|
|
247
|
+
Buttons,
|
|
248
|
+
}
|
|
249
|
+
enum Choice {
|
|
250
|
+
Rock,
|
|
251
|
+
Paper,
|
|
252
|
+
Scissors,
|
|
253
|
+
}
|
|
254
|
+
enum InviteResult {
|
|
255
|
+
Accepted,
|
|
256
|
+
Declined,
|
|
257
|
+
Timeout,
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## Building from source
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
npm run build # tsc && tsc-alias
|
|
265
|
+
npm run format # prettier --write .
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
## License
|
|
269
|
+
|
|
270
|
+
MIT — Yanis Hamburger & Stefanoz.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { GameNameType, type Connect4Options, type IGame, type GameManagerType, type GameLocale } from "../structures/Types";
|
|
2
|
+
import { RepliableInteraction } from "discord.js";
|
|
3
|
+
export default class Connect4 implements IGame {
|
|
4
|
+
readonly gameName = GameNameType.Connect4;
|
|
5
|
+
private readonly manager;
|
|
6
|
+
private interaction;
|
|
7
|
+
private readonly players;
|
|
8
|
+
private readonly colors;
|
|
9
|
+
private readonly emojis;
|
|
10
|
+
private readonly title;
|
|
11
|
+
private readonly loc;
|
|
12
|
+
private readonly inputType;
|
|
13
|
+
private readonly board;
|
|
14
|
+
private readonly heights;
|
|
15
|
+
private readonly winMask;
|
|
16
|
+
private readonly turnTimeout;
|
|
17
|
+
private currentPlayer;
|
|
18
|
+
private turnTimer;
|
|
19
|
+
private consecutiveMisses;
|
|
20
|
+
private collector;
|
|
21
|
+
private readonly cooldownKey;
|
|
22
|
+
constructor(manager: GameManagerType, interaction: RepliableInteraction, options: Connect4Options, gameLocale: GameLocale);
|
|
23
|
+
private cellEmoji;
|
|
24
|
+
private renderBoard;
|
|
25
|
+
private drop;
|
|
26
|
+
private isDraw;
|
|
27
|
+
private checkWin;
|
|
28
|
+
private createButtons;
|
|
29
|
+
private createSelectMenu;
|
|
30
|
+
private buildContainer;
|
|
31
|
+
private startTurnTimer;
|
|
32
|
+
private handleTurnTimeout;
|
|
33
|
+
launch(): Promise<void>;
|
|
34
|
+
private playMove;
|
|
35
|
+
private cleanup;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=Connect4.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Connect4.d.ts","sourceRoot":"","sources":["../../src/games/Connect4.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAa,K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atB,OAAO,CAAC,cAAc;YAKR,iBAAiB;IAwBzB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;YA2Cf,QAAQ;IAoDtB,OAAO,CAAC,OAAO;CAYlB"}
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const Types_1 = require("../structures/Types");
|
|
4
|
+
const discord_js_1 = require("discord.js");
|
|
5
|
+
const DIRECTIONS = [
|
|
6
|
+
[0, 1],
|
|
7
|
+
[1, 0],
|
|
8
|
+
[1, 1],
|
|
9
|
+
[1, -1],
|
|
10
|
+
];
|
|
11
|
+
const ROWS = 6;
|
|
12
|
+
const COLS = 7;
|
|
13
|
+
class Connect4 {
|
|
14
|
+
gameName = Types_1.GameNameType.Connect4;
|
|
15
|
+
manager;
|
|
16
|
+
interaction;
|
|
17
|
+
players;
|
|
18
|
+
colors;
|
|
19
|
+
emojis;
|
|
20
|
+
title;
|
|
21
|
+
loc;
|
|
22
|
+
inputType;
|
|
23
|
+
// 0 — empty, 1 — Player 1, 2 — Player 2.
|
|
24
|
+
board = new Int8Array(ROWS * COLS);
|
|
25
|
+
// Lowest empty row index per column (-1 once the column is full).
|
|
26
|
+
heights = new Int8Array(COLS).fill(ROWS - 1);
|
|
27
|
+
winMask = new Uint8Array(ROWS * COLS);
|
|
28
|
+
turnTimeout;
|
|
29
|
+
currentPlayer;
|
|
30
|
+
turnTimer = null;
|
|
31
|
+
consecutiveMisses = 0;
|
|
32
|
+
collector = null;
|
|
33
|
+
cooldownKey;
|
|
34
|
+
constructor(manager, interaction, options, gameLocale) {
|
|
35
|
+
this.manager = manager;
|
|
36
|
+
this.interaction = interaction;
|
|
37
|
+
this.players = options.players;
|
|
38
|
+
this.cooldownKey = `${this.players[0].id}-${this.players[1].id}-${this.gameName}`;
|
|
39
|
+
this.currentPlayer = Math.random() < 0.5 ? 0 : 1;
|
|
40
|
+
this.turnTimeout = (options.turnTimeout ?? 30) * 1000;
|
|
41
|
+
this.loc = gameLocale.connect4;
|
|
42
|
+
const lang = options.lang ?? {};
|
|
43
|
+
const theme = options.theme ?? {};
|
|
44
|
+
this.inputType = theme.inputType ?? Types_1.InputType.Buttons;
|
|
45
|
+
this.colors = {
|
|
46
|
+
play: theme.colors?.play ?? 0x5865f2,
|
|
47
|
+
win: theme.colors?.win ?? 0xffd700,
|
|
48
|
+
draw: theme.colors?.draw ?? 0x808080,
|
|
49
|
+
};
|
|
50
|
+
this.emojis = {
|
|
51
|
+
p1: theme.emojis?.player1 ?? "🔴",
|
|
52
|
+
p2: theme.emojis?.player2 ?? "🟡",
|
|
53
|
+
empty: theme.emojis?.empty ?? "⬛",
|
|
54
|
+
win: theme.emojis?.win ?? "⚪",
|
|
55
|
+
};
|
|
56
|
+
this.title = lang.title ?? this.loc.title;
|
|
57
|
+
}
|
|
58
|
+
cellEmoji(cell) {
|
|
59
|
+
if (cell === 1)
|
|
60
|
+
return this.emojis.p1;
|
|
61
|
+
if (cell === 2)
|
|
62
|
+
return this.emojis.p2;
|
|
63
|
+
return this.emojis.empty;
|
|
64
|
+
}
|
|
65
|
+
renderBoard() {
|
|
66
|
+
let grid = "";
|
|
67
|
+
for (let r = 0; r < ROWS; r++) {
|
|
68
|
+
if (r > 0)
|
|
69
|
+
grid += "\n";
|
|
70
|
+
for (let c = 0; c < COLS; c++) {
|
|
71
|
+
if (c > 0)
|
|
72
|
+
grid += " ";
|
|
73
|
+
const idx = r * COLS + c;
|
|
74
|
+
grid += this.winMask[idx] ? this.emojis.win : this.cellEmoji(this.board[idx]);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return `1️⃣ 2️⃣ 3️⃣ 4️⃣ 5️⃣ 6️⃣ 7️⃣\n${grid}`;
|
|
78
|
+
}
|
|
79
|
+
drop(col) {
|
|
80
|
+
const row = this.heights[col];
|
|
81
|
+
if (row < 0)
|
|
82
|
+
return -1;
|
|
83
|
+
const piece = (this.currentPlayer + 1);
|
|
84
|
+
this.board[row * COLS + col] = piece;
|
|
85
|
+
this.heights[col] = row - 1;
|
|
86
|
+
return row;
|
|
87
|
+
}
|
|
88
|
+
isDraw() {
|
|
89
|
+
for (let c = 0; c < COLS; c++)
|
|
90
|
+
if (this.heights[c] >= 0)
|
|
91
|
+
return false;
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
checkWin(row, col) {
|
|
95
|
+
const piece = this.board[row * COLS + col];
|
|
96
|
+
if (!piece)
|
|
97
|
+
return false;
|
|
98
|
+
for (const [rd, cd] of DIRECTIONS) {
|
|
99
|
+
const cells = [row * COLS + col];
|
|
100
|
+
for (let d = 1; d < 4; d++) {
|
|
101
|
+
const r = row + rd * d, c = col + cd * d;
|
|
102
|
+
if (r < 0 || r >= ROWS || c < 0 || c >= COLS || this.board[r * COLS + c] !== piece)
|
|
103
|
+
break;
|
|
104
|
+
cells.push(r * COLS + c);
|
|
105
|
+
}
|
|
106
|
+
for (let d = 1; d < 4; d++) {
|
|
107
|
+
const r = row - rd * d, c = col - cd * d;
|
|
108
|
+
if (r < 0 || r >= ROWS || c < 0 || c >= COLS || this.board[r * COLS + c] !== piece)
|
|
109
|
+
break;
|
|
110
|
+
cells.push(r * COLS + c);
|
|
111
|
+
}
|
|
112
|
+
if (cells.length >= 4) {
|
|
113
|
+
for (const idx of cells)
|
|
114
|
+
this.winMask[idx] = 1;
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
createButtons(disabled = false) {
|
|
121
|
+
const rows = [];
|
|
122
|
+
for (let i = 0; i < COLS; i += 5) {
|
|
123
|
+
const row = new discord_js_1.ActionRowBuilder();
|
|
124
|
+
for (let j = i; j < Math.min(i + 5, COLS); j++) {
|
|
125
|
+
row.addComponents(new discord_js_1.ButtonBuilder()
|
|
126
|
+
.setCustomId(`c4_${j}`)
|
|
127
|
+
.setLabel(`${j + 1}`)
|
|
128
|
+
.setStyle(discord_js_1.ButtonStyle.Secondary)
|
|
129
|
+
.setDisabled(disabled));
|
|
130
|
+
}
|
|
131
|
+
rows.push(row);
|
|
132
|
+
}
|
|
133
|
+
return rows;
|
|
134
|
+
}
|
|
135
|
+
createSelectMenu(disabled = false) {
|
|
136
|
+
const options = [];
|
|
137
|
+
if (disabled) {
|
|
138
|
+
for (let c = 0; c < COLS; c++)
|
|
139
|
+
options.push(new discord_js_1.StringSelectMenuOptionBuilder().setLabel(this.loc.column(c + 1)).setValue(`${c}`));
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
for (let c = 0; c < COLS; c++)
|
|
143
|
+
if (this.heights[c] >= 0)
|
|
144
|
+
options.push(new discord_js_1.StringSelectMenuOptionBuilder().setLabel(this.loc.column(c + 1)).setValue(`${c}`));
|
|
145
|
+
}
|
|
146
|
+
const menu = new discord_js_1.StringSelectMenuBuilder().setCustomId("c4_select").setPlaceholder(this.loc.choosePlaceholder).addOptions(options).setDisabled(disabled);
|
|
147
|
+
return [new discord_js_1.ActionRowBuilder().addComponents(menu)];
|
|
148
|
+
}
|
|
149
|
+
buildContainer(status, color, disabled = false) {
|
|
150
|
+
const [p1, p2] = this.players;
|
|
151
|
+
const base = new discord_js_1.ContainerBuilder()
|
|
152
|
+
.setAccentColor(color)
|
|
153
|
+
.addTextDisplayComponents(text => text.setContent(`## ${this.title}`))
|
|
154
|
+
.addTextDisplayComponents(text => text.setContent(`${this.emojis.p1} **${p1.username}** vs ${this.emojis.p2} **${p2.username}**`))
|
|
155
|
+
.addSeparatorComponents(sep => sep.setDivider(true).setSpacing(discord_js_1.SeparatorSpacingSize.Small))
|
|
156
|
+
.addTextDisplayComponents(text => text.setContent(this.renderBoard()))
|
|
157
|
+
.addSeparatorComponents(sep => sep.setDivider(true).setSpacing(discord_js_1.SeparatorSpacingSize.Small))
|
|
158
|
+
.addTextDisplayComponents(text => text.setContent(status));
|
|
159
|
+
return this.inputType === "select" ? base.addActionRowComponents(...this.createSelectMenu(disabled)) : base.addActionRowComponents(...this.createButtons(disabled));
|
|
160
|
+
}
|
|
161
|
+
startTurnTimer() {
|
|
162
|
+
if (this.turnTimer)
|
|
163
|
+
clearTimeout(this.turnTimer);
|
|
164
|
+
this.turnTimer = setTimeout(() => this.handleTurnTimeout(), this.turnTimeout);
|
|
165
|
+
}
|
|
166
|
+
async handleTurnTimeout() {
|
|
167
|
+
this.consecutiveMisses++;
|
|
168
|
+
if (this.consecutiveMisses >= 2) {
|
|
169
|
+
this.cleanup();
|
|
170
|
+
await this.interaction.editReply({
|
|
171
|
+
components: [this.buildContainer(this.loc.cancelledBothMissed, this.colors.draw, true)],
|
|
172
|
+
flags: discord_js_1.MessageFlags.IsComponentsV2,
|
|
173
|
+
});
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
this.currentPlayer = this.currentPlayer === 0 ? 1 : 0;
|
|
177
|
+
const next = this.players[this.currentPlayer];
|
|
178
|
+
const timestamp = String(Math.floor((Date.now() + this.turnTimeout) / 1000));
|
|
179
|
+
await this.interaction.editReply({
|
|
180
|
+
components: [this.buildContainer(this.loc.turnTimeout(this.cellEmoji(this.currentPlayer + 1), next.username, timestamp), this.colors.play)],
|
|
181
|
+
flags: discord_js_1.MessageFlags.IsComponentsV2,
|
|
182
|
+
});
|
|
183
|
+
this.startTurnTimer();
|
|
184
|
+
}
|
|
185
|
+
async launch() {
|
|
186
|
+
this.manager.cooldowns.replace(this.cooldownKey, 300_000);
|
|
187
|
+
const firstPlayer = this.players[this.currentPlayer];
|
|
188
|
+
const firstTimestamp = String(Math.floor((Date.now() + this.turnTimeout) / 1000));
|
|
189
|
+
const firstStatus = this.loc.firstTurn(this.cellEmoji(this.currentPlayer + 1), firstPlayer.username, firstTimestamp);
|
|
190
|
+
const message = await this.interaction.editReply({
|
|
191
|
+
components: [this.buildContainer(firstStatus, this.colors.play)],
|
|
192
|
+
flags: discord_js_1.MessageFlags.IsComponentsV2,
|
|
193
|
+
});
|
|
194
|
+
this.collector = message.createMessageComponentCollector({
|
|
195
|
+
componentType: this.inputType === "select" ? discord_js_1.ComponentType.StringSelect : discord_js_1.ComponentType.Button,
|
|
196
|
+
time: 300_000,
|
|
197
|
+
filter: i => {
|
|
198
|
+
if (this.players.some(p => p.id === i.user.id))
|
|
199
|
+
return true;
|
|
200
|
+
i.reply({
|
|
201
|
+
embeds: [{ description: this.loc.notYourGame, color: discord_js_1.Colors.Red }],
|
|
202
|
+
flags: discord_js_1.MessageFlags.Ephemeral,
|
|
203
|
+
});
|
|
204
|
+
return false;
|
|
205
|
+
},
|
|
206
|
+
});
|
|
207
|
+
this.collector.on("collect", async (interactionButton) => {
|
|
208
|
+
const col = this.inputType === "select" ? Number(interactionButton.values[0]) : Number(interactionButton.customId.split("_")[1]);
|
|
209
|
+
await this.playMove(col, interactionButton);
|
|
210
|
+
});
|
|
211
|
+
this.collector.on("end", async (_, reason) => {
|
|
212
|
+
this.cleanup();
|
|
213
|
+
if (reason === "time") {
|
|
214
|
+
await this.interaction.editReply({
|
|
215
|
+
components: [this.buildContainer(this.loc.timeout, this.colors.draw, true)],
|
|
216
|
+
flags: discord_js_1.MessageFlags.IsComponentsV2,
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
this.startTurnTimer();
|
|
221
|
+
}
|
|
222
|
+
async playMove(col, component) {
|
|
223
|
+
await component.deferUpdate();
|
|
224
|
+
this.interaction = component;
|
|
225
|
+
const player = this.players[this.currentPlayer];
|
|
226
|
+
if (component.user.id !== player.id) {
|
|
227
|
+
return void (await component.followUp({
|
|
228
|
+
embeds: [{ description: this.loc.notYourTurn, color: discord_js_1.Colors.Red }],
|
|
229
|
+
flags: discord_js_1.MessageFlags.Ephemeral,
|
|
230
|
+
}));
|
|
231
|
+
}
|
|
232
|
+
const row = this.drop(col);
|
|
233
|
+
if (row === -1) {
|
|
234
|
+
return void (await component.followUp({
|
|
235
|
+
embeds: [{ description: this.loc.columnFull, color: discord_js_1.Colors.Red }],
|
|
236
|
+
flags: discord_js_1.MessageFlags.Ephemeral,
|
|
237
|
+
}));
|
|
238
|
+
}
|
|
239
|
+
if (this.consecutiveMisses)
|
|
240
|
+
this.consecutiveMisses = 0;
|
|
241
|
+
if (this.checkWin(row, col)) {
|
|
242
|
+
this.cleanup();
|
|
243
|
+
return void (await this.interaction.editReply({
|
|
244
|
+
components: [this.buildContainer(this.loc.win(this.cellEmoji(this.currentPlayer + 1), player.username), this.colors.win, true)],
|
|
245
|
+
flags: discord_js_1.MessageFlags.IsComponentsV2,
|
|
246
|
+
}));
|
|
247
|
+
}
|
|
248
|
+
if (this.isDraw()) {
|
|
249
|
+
this.cleanup();
|
|
250
|
+
return void (await this.interaction.editReply({
|
|
251
|
+
components: [this.buildContainer(this.loc.draw, this.colors.draw, true)],
|
|
252
|
+
flags: discord_js_1.MessageFlags.IsComponentsV2,
|
|
253
|
+
}));
|
|
254
|
+
}
|
|
255
|
+
this.currentPlayer = this.currentPlayer === 0 ? 1 : 0;
|
|
256
|
+
const next = this.players[this.currentPlayer];
|
|
257
|
+
const timestamp = String(Math.floor((Date.now() + this.turnTimeout) / 1000));
|
|
258
|
+
this.manager.cooldowns.reset(this.cooldownKey, 300_000);
|
|
259
|
+
this.collector?.resetTimer();
|
|
260
|
+
await this.interaction.editReply({
|
|
261
|
+
components: [this.buildContainer(this.loc.turn(this.cellEmoji(this.currentPlayer + 1), next.username, timestamp), this.colors.play)],
|
|
262
|
+
flags: discord_js_1.MessageFlags.IsComponentsV2,
|
|
263
|
+
});
|
|
264
|
+
this.startTurnTimer();
|
|
265
|
+
}
|
|
266
|
+
cleanup() {
|
|
267
|
+
if (this.turnTimer) {
|
|
268
|
+
clearTimeout(this.turnTimer);
|
|
269
|
+
this.turnTimer = null;
|
|
270
|
+
}
|
|
271
|
+
if (this.collector) {
|
|
272
|
+
this.collector.stop("cleanup");
|
|
273
|
+
this.collector = null;
|
|
274
|
+
}
|
|
275
|
+
this.manager.cooldowns.delete(this.cooldownKey);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
exports.default = Connect4;
|
|
279
|
+
//# sourceMappingURL=Connect4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Connect4.js","sourceRoot":"","sources":["../../src/games/Connect4.ts"],"names":[],"mappings":";;AAAA,8CAA2J;AAE3J,2CAgBoB;AAEpB,MAAM,UAAU,GAAG;IACf,CAAC,CAAC,EAAE,CAAC,CAAC;IACN,CAAC,CAAC,EAAE,CAAC,CAAC;IACN,CAAC,CAAC,EAAE,CAAC,CAAC;IACN,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CACD,CAAC;AAEX,MAAM,IAAI,GAAG,CAAC,CAAC;AACf,MAAM,IAAI,GAAG,CAAC,CAAC;AAEf,MAAqB,QAAQ;IACT,QAAQ,GAAG,oBAAY,CAAC,QAAQ,CAAC;IAChC,OAAO,CAAkB;IAClC,WAAW,CAAuB;IACzB,OAAO,CAAe;IACtB,MAAM,CAA8C;IACpD,MAAM,CAAyD;IAC/D,KAAK,CAAS;IACd,GAAG,CAAiB;IACpB,SAAS,CAAY;IACtC,yCAAyC;IACxB,KAAK,GAAG,IAAI,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IACpD,kEAAkE;IACjD,OAAO,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;IAC7C,OAAO,GAAG,IAAI,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IACtC,WAAW,CAAS;IAC7B,aAAa,CAAQ;IACrB,SAAS,GAAyC,IAAI,CAAC;IACvD,iBAAiB,GAAG,CAAC,CAAC;IACtB,SAAS,GAAqC,IAAI,CAAC;IAC1C,WAAW,CAAS;IAErC,YAAY,OAAwB,EAAE,WAAiC,EAAE,OAAwB,EAAE,UAAsB;QACrH,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,WAAW,GA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AC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YACpI,KAAK,EAAE,yBAAY,CAAC,cAAc;SACrC,CAAC,CAAC;QAEH,IAAI,CAAC,cAAc,EAAE,CAAC;IAC1B,CAAC;IAEO,OAAO;QACX,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACjB,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC7B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QAC1B,CAAC;QACD,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACjB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC/B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QAC1B,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACpD,CAAC;CACJ;AA7RD,2BA6RC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { GameNameType, type HangmanOptions, type IGame, type GameLocale, type GameManagerType } from "../structures/Types";
|
|
2
|
+
import { RepliableInteraction } from "discord.js";
|
|
3
|
+
export default class Hangman implements IGame {
|
|
4
|
+
readonly gameName = GameNameType.Hangman;
|
|
5
|
+
private readonly manager;
|
|
6
|
+
private interaction;
|
|
7
|
+
private readonly players;
|
|
8
|
+
private readonly colors;
|
|
9
|
+
private readonly title;
|
|
10
|
+
private readonly lifeCount;
|
|
11
|
+
private readonly loc;
|
|
12
|
+
private currentPlayer;
|
|
13
|
+
private readonly word;
|
|
14
|
+
private readonly wordLetters;
|
|
15
|
+
private readonly guessed;
|
|
16
|
+
private wrongCount;
|
|
17
|
+
private isModal;
|
|
18
|
+
private collector;
|
|
19
|
+
private readonly turnTimeout;
|
|
20
|
+
private readonly cooldownKey;
|
|
21
|
+
constructor(manager: GameManagerType, interaction: RepliableInteraction, options: HangmanOptions, gameLocale: GameLocale);
|
|
22
|
+
private getStage;
|
|
23
|
+
private handleComponents;
|
|
24
|
+
private buildContainer;
|
|
25
|
+
private buildLetterMenu;
|
|
26
|
+
private buildModalWord;
|
|
27
|
+
launch(): Promise<void>;
|
|
28
|
+
private cleanup;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=Hangman.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Hangman.d.ts","sourceRoot":"","sources":["../../src/games/Hangman.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,cAAc,EAAE,KAAK,KAAK,EAAE,KAAK,UAAU,EAAsB,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE9I,OAAO,EASH,oBAAoB,EAWvB,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,OAAO,OAAO,OAAQ,YAAW,KAAK;IACzC,SAAgB,QAAQ,wBAAwB;IAChD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkB;IAC1C,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;IACvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA8C;IACrE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAgB;IACpC,OAAO,CAAC,aAAa,CAAY;IACjC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAoB;IAEhD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAC7C,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,SAAS,CA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