thrustin 1.0.1

xperience epic adventures by THRUSTING some THRUSTERS into THRUSTEES https://THRUSTIN.rs. E
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
use crate::lobby::Lobby;
use crate::player::Player;

use std::cell::RefCell;
use std::collections::HashMap;
use std::rc::Rc;

///////////
//helpers//
///////////
// Retrieves command from split input
// Lowers input so case is insensitive
fn get_command(input: &Vec<&str>) -> String {
    let com = input[0].to_string().to_lowercase();
    return com;
}

// Helper for making help tables
fn generate_table(commands: Vec<(&str, &str, &str)>) -> String {
    let mut table_html = String::from("<table class=\"table table-sm table-responsive w-auto\">");
    table_html.push_str("<tr>");
    table_html.push_str("<td>Command</td>");
    table_html.push_str("<td>aLiAs</td>");
    table_html.push_str("<td>Help Massage</td>");
    table_html.push_str("</tr>");
    for (command, alias, help) in commands {
        table_html.push_str("<tr>");

        table_html.push_str("<td>");
        table_html.push_str(&command.to_string());
        table_html.push_str("</td>");

        table_html.push_str("<td>");
        table_html.push_str(&alias.to_string());
        table_html.push_str("</td>");

        table_html.push_str("<td>");
        table_html.push_str(&help.to_string());
        table_html.push_str("</td>");

        table_html.push_str("</tr>");
    }
    table_html.push_str("</table>");
    return table_html;
}

///////////////
//choose name//
///////////////
pub fn choose_name_commands(
    split: Vec<&str>,
    pl: Rc<RefCell<Player>>,
    lobbies: &mut HashMap<i32, Lobby>,
    players: &mut HashMap<u32, Rc<RefCell<Player>>>,
) {
    let com = get_command(&split);
    match &*com {
        ".help" | ".h" => list_choose_name_commands(split, &pl.borrow()),
        ".name" | ".n" => Player::name(split, pl, lobbies, players),
        ".login" | ".l" => pl.borrow_mut().login(split, lobbies),
        ".register" | ".r" => pl.borrow_mut().register(split, lobbies),
        _ => {
            pl.borrow()
                .send_message("u gotta pick a name bro, try '.name URNAMeHERE'");
        }
    }
}

fn list_choose_name_commands(split: Vec<&str>, pl: &Player) {
    if split.len() != 1 {
        pl.send_message("Failed. If you want to use the .help command please type .help by itself. That's .help or .h with no arguments. Do not do something like `.help 1 2 3`. That's wrong. Just do `.help`. Got it!");
        return;
    }

    pl.send_messages(&vec![
        String::from("Hey guys, Max here. I'm rewriting this section since it changed a bit with the addition of saved accounts. So basically, this first phase is the Choose Name phase to identify yourself. If you're lookin' for something basic, just enter something like `.name AWESOMEbruh` and continue forwards. If you register an account with `.register` and later login with `.login` though, you get some new features like saved THRUSTS and stats that go to our database. Cool, huh?"),
        generate_table(vec![
            (".help", ".h", "this is it chief"),
            (".name Y0LoSWAG4206669", ".n Y0LoSWAG4206669", "great this will change your name to Y0LoSWAG4206669"),
            (".login AwesomeUser Pa$4WorD??", ".l AwesomeUser Pa$4WorD??", "Login to the AwesomeUser account with Pa$4WorD?? as password."),
            (".register AwesomeUser Pa$4WorD?? Pa$4WorD??", ".r AwesomeUser Pa$4WorD?? Pa$4WorD??", "Register an account and confirm the password."),
        ])
    ]);
}

////////////////
//out of lobby//
////////////////
pub fn out_of_lobby_commands(
    input: &str,
    split: Vec<&str>,
    pl: Rc<RefCell<Player>>,
    players: &mut HashMap<u32, Rc<RefCell<Player>>>,
    lobby_id: &mut i32,
    lobbies: &mut HashMap<i32, Lobby>,
) {
    let com = get_command(&split);
    match &*com {
        ".help" | ".h" => list_out_commands(split, &pl.borrow()),
        ".join" | ".j" => Lobby::join(split, pl, lobbies),
        ".list" | ".l" => Lobby::list(pl, lobbies),
        ".make" | ".m" => Lobby::make(split, pl, lobby_id, lobbies),
        ".name" | ".n" => Player::name(split, pl, lobbies, players),
        ".play" | ".p" => Lobby::join(vec![".join", "0"], pl, lobbies),
        ".who" | ".w" => Player::who(pl, players),
        ".account" | ".a" => pl.borrow().account(),
        ".color" | ".c" => pl.borrow_mut().color(split),
        ".thrust" | ".t" => pl.borrow_mut().thrust(&input, &split),
        ".unthrust" | ".u" => pl.borrow_mut().unthrust(),
        ".username" | ".un" => pl.borrow_mut().username(split),
        ".password" | ".pw" => pl.borrow_mut().password(split),
        ".ban" | ".b" => pl.borrow().ban(split),
        ".unban" | ".ub" => pl.borrow().unban(split),
        ".chieftain" | ".ct" => pl.borrow().chieftain(split),
        ".unchieftain" | ".uc" => pl.borrow().unchieftain(split),
        _ => {
            if com.starts_with(".") {
                pl.borrow()
                    .send_message("Bruh that's an invalid command...!.    try .help");
            } else {
                Player::send_message_out_of_lobby(
                    &pl.borrow(),
                    input,
                    players,
                );
            }
        }
    }
}

fn list_out_commands(split: Vec<&str>, pl: &Player) {
    if split.len() != 1 {
        pl.send_message("Failed. If you want to use the .help command please type .help by itself. That's .help or .h with no arguments. Do not do something like `.help 1 2 3`. That's wrong. Just do `.help`. Got it!");
        return;
    }

    let mut commands = vec![
        (".help", ".h", "this is it chief"),
        (".join 1", ".j 1", "Join the lobby with ID 1."),
        (".list", ".l", "Lists info for lobbies that are available"),
        (".make", ".m", "Make a new lobby"),
        (".make passW0RD", ".m passW0RD", "Make a new lobby and give it a password set to passW0RD."),
        (".name xx69SWAGGER911xx", ".n xx69SWAGGER911xx", "If you must, do this to change your name to xx69SWAGGER911xx"),
        (".play", ".p", "Join an endless public lobby with some other big doggos."),
        (".who", ".w", "See who else is swaggin' up in this whack with you")
    ];

    if pl.is_authenticated {
        commands.append(&mut vec![
            (".account", ".a", "Retrieve some statistical information regarding the state of your account."),
            (".color ffd1dc ff5b82", ".c ffd1dc ff5b82", "You assign background and foreground chat colors for yourself in hexidecimal. They must be different. They cannot be THRUSTY's colors."),
            (".THRUST", ".t", "This will list out your added THRUSTEES and THRUSTERS. (THRUSTERS are THRUSTED into the THRUSTEES's underscores.) Lobbies will combine and use everyone's awesome THRUSTS."),
            (".THRUST \"Some _____ THRUSTEE\" \"Some THRUSTER\"", ".t \"Some _____ THRUSTEE\" \"Some THRUSTER\"", "Add THRUSTS to your wonderful collection. THRUSTS with an underscore will be put into your THRUSTEES otherwise yeah you guessed it they're put into THRUSTERS. Also, remember to encapsulate each THRUST with a quotation."),
            (".UNTHRUST", ".u", "Destroy all your THRUSTS... [*** !!!CAUTION THIS IS IRREVERSIBLE!!! ***]"),
            (".username NewMeNewUser NewMeNewUser", ".un NewMeNewUser NewMeNewUser", "Change your account username and confirmation applied thereafter."),
            (".password D1Ff3rentP@$$420 D1Ff3rentP@$$420", ".pw D1Ff3rentP@$$420 D1Ff3rentP@$$420", "Change your account password, maybe to D1Ff3rentP@$$420? lmao, also you gotta confirm it."),
        ]);
    }

    if pl.is_chieftain() {
        commands.append(&mut vec![
            (".ban", ".b", "(chieftain-only) View ban list."),
            (".ban 69.69.69.69", ".b 69.69.69.69", "(chieftain-only) Ban 69.69.69.69 to the shadow realms."),
            (".unban 69.69.69.69", ".ub 69.69.69.69", "(chieftain-only) Unban 69.69.69.69 from the shadow realm."),
            (".chieftain", ".ct", "(chieftain-only) View the list of chieftains."),
            (".chieftain An0THerSoul", ".ct An0THerSoul", "(chieftain-only) Grant An0THerSoul the privilege to be an administrative chieftain."),
            (".unchieftain ThisGuy", ".uc ThisGuy", "(chieftain-only) Remove Chieftain privileges from this dude."),
        ]);
    }

    let messages = &vec![
        String::from("Alright so now you're in like a waiting zone outside of all the lobbies. Here you can browse lobbies, organize your THRUSTS, and (eventually by milestone 5.3) chat with other people in like general chat. Have fun playing THRUSTIN, brought to you by WAXCHUG&daGWADS."),
        generate_table(commands)
    ];

    pl.send_messages(messages);
}

////////////
//in lobby//
////////////
pub fn in_lobby_commands(
    input: &str,
    split: Vec<&str>,
    pl: Rc<RefCell<Player>>,
    lobbies: &mut HashMap<i32, Lobby>,
) {
    let com = get_command(&split);
    let lobby = { lobbies.get_mut(&pl.borrow().lobby).unwrap() };

    match &*com {
        ".help" | ".h" => list_in_commands(split, &pl.borrow(), lobby.is_host(pl.borrow().token)),
        ".info" | ".i" => lobby.info(pl),
        ".leave" | ".l" => Lobby::leave_and_delete(pl, lobbies),
        ".who" | ".w" => lobby.who(pl),
        ".chief" | ".c" => lobby.host(split, pl),
        ".house" | ".ho" => lobby.house(split, pl),
        ".kick" | ".k" => lobby.kick(split, pl),
        ".password" | ".pw" => lobby.password(split, pl),
        ".players" | ".pl" => lobby.players(split, pl),
        ".points" | ".po" => lobby.points(split, pl),
        ".start" | ".s" => lobby.start(pl),
        ".thrustees" | ".e" => lobby.thrustees(split, pl),
        ".thrusters" | ".r" => lobby.thrusters(split, pl),
        ".account" | ".a" => pl.borrow().account(),
        ".thrust" | ".t" => pl.borrow_mut().thrust(&input, &split),
        ".unthrust" | ".u" => pl.borrow_mut().unthrust(),
        ".ban" | ".b" => pl.borrow().ban(split),
        ".unban" | ".ub" => pl.borrow().unban(split),
        ".chieftain" | ".ct" => pl.borrow().chieftain(split),
        ".unchieftain" | ".uc" => pl.borrow().unchieftain(split),
        _ => {
            if com.starts_with(".") {
                pl.borrow()
                    .send_message("Broski that shall be an invalid command. enter .help")
            } else {
                lobby.send_message_from(&pl.borrow(), input);
            }
        }
    }
}

fn list_in_commands(split: Vec<&str>, pl: &Player, host: bool) {
    if split.len() != 1 {
        pl.send_message("Failed. If you want to use the .help command please type .help by itself. That's .help or .h with no arguments. Do not do something like `.help 1 2 3`. That's wrong. Just do `.help`. Got it!");
        return;
    }

    let mut commands = vec![
        (".help", ".h", "this is it chief"),
        (".info", ".i", "I'm pretty sure this will give you some info about the lobby you're in."),
        (".leave", ".l", "We're sorry to see you go..."),
        (".THRUST", ".t", "This will list out your added THRUSTEES and THRUSTERS. (THRUSTERS are THRUSTED into the THRUSTEES's underscores.) Lobbies will combine and use everyone's awesome THRUSTS."),
        (".THRUST \"Some _____ THRUSTEE\" \"Some THRUSTER\"", ".t \"Some _____ THRUSTEE\" \"Some THRUSTER\"", "Add THRUSTS to your wonderful collection. THRUSTS with an underscore will be put into your THRUSTEES otherwise yeah you guessed it they're put into THRUSTERS. Also, remember to encapsulate each THRUST with a quotation."),
        (".UNTHRUST", ".u", "Destroy all your THRUSTS... [*** !!!CAUTION THIS IS IRREVERSIBLE!!! ***]"),
        (".who", ".w", "See who's whacking up this swag lobby with you"),
    ];

    if host {
        commands.append(&mut vec![
            (".chief xxXAzn1994", ".c  xxXAzn1994", "(chief-only) Make xxXAzn1994 the chief of the lobby"),
            (".house", ".ho 69", "(chief-only) Hey, change the number of house cards you're using to 69, split in half for THRUSTEES and THRUSTERS. Do 0 for zero house THRUSTS. Default value, it's 420."),
            (".kick YOLOSWAGGER69", ".k YOLOSWAGGER69", "(chief-only) Someone causing you trouble? Toxicity got you down? Well if you are a chief you can kick YOLOSWAGGER69 out of your lobby using this command."),
            (".password passwordspelledbackwards123420", ".pw passwordspelledbackwards123420", "(chief-only) Sometimes you want to protect your lobby's privacy by setting your lobby's password to passwordspelledbackwards123420"),
            (".players 420", ".pl 420", "(chief-only) Okay, how many players do you want to allow in your lobby? 420?"),
            (".points 1", ".po 1", "(chief-only) Okay, how many points do you want to go to? 1? Don't do 1... cause then the game will end really fast."),
            (".start", ".s", "(chief-only) Yup, naturally as the chief you can start up the game."),
            (".THRUSTEES", ".e", "(chief-only) Hey there, this command will allow you to configure how many choices a THRUSTEE may choose from."),
            (".THRUSTERS", ".r", "(chief-only) This little command here will allow you to configure how many THRUSTERS one may hold onto at one time."),
        ]);
    }

    if pl.is_authenticated {
        commands.append(&mut vec![(
            ".account",
            ".a",
            "Observe the settings related to your account and see what's up with that whack.",
        )]);
    }

    if pl.is_chieftain() {
        commands.append(&mut vec![
            (".ban", ".b", "(chieftain-only) View ban list."),
            (".ban 69.69.69.69", ".b 69.69.69.69", "(chieftain-only) Ban 69.69.69.69 to the shadow realms."),
            (".unban 69.69.69.69", ".ub 69.69.69.69", "(chieftain-only) Unban 69.69.69.69 from the shadow realm."),
            (".chieftain", ".ct", "(chieftain-only) View the list of chieftains. I'm sorry we added the `t`..."),
            (".chieftain An0THerSoul", ".ct An0THerSoul", "(chieftain-only) Grant An0THerSoul the privilege to be an administrative chieftain. I'm really sorry we added the `t`..."),
            (".unchieftain ThisGuy", ".uc ThisGuy", "(chieftain-only) Remove Chieftain privileges from this dude."),
        ]);
    }

    let messages = &vec![
        String::from("Hey cool so now you're in the lobby and now you've got some more commands. If you're the chief, you've got access to some special options to configure the lobby's game experience. Otherwise, normal non-chiefs, yall can chill out and wait for the game to start."),
        generate_table(commands)
    ];

    pl.send_messages(messages);
}

////////////////////
//playing commands//
////////////////////
pub fn playing_commands(
    input: &str,
    split: Vec<&str>,
    pl: Rc<RefCell<Player>>,
    lobbies: &mut HashMap<i32, Lobby>,
) {
    let com = get_command(&split);
    let lobby = { lobbies.get_mut(&pl.borrow().lobby).unwrap() };
    match &*com {
        ".help" | ".h" => list_playing_commands(split, &pl.borrow(), lobby.is_host(pl.borrow().token)),
        ".info" | ".i" => lobby.info(pl),
        ".leave" | ".l" => Lobby::leave_and_delete(pl, lobbies),
        ".thrust" | ".t" => lobby.thrust(split, pl),
        ".kick" | ".k" => lobby.kick(split, pl),
        ".end" | ".e" => lobby.end(pl),
        ".who" | ".w" => lobby.who_in_game(pl),
        ".account" | ".a" => pl.borrow().account(),
        ".ban" | ".b" => pl.borrow().ban(split),
        ".unban" | ".ub" => pl.borrow().unban(split),
        ".chieftain" | ".ct" => pl.borrow().chieftain(split),
        ".unchieftain" | ".uc" => pl.borrow().unchieftain(split),
        _ => {
            if com.starts_with(".") {
                pl.borrow().send_message("Bruh that's an invalid command.");
            } else {
                lobby.send_message_from(&pl.borrow(), input);
            }
        }
    }
}

fn list_playing_commands(split: Vec<&str>, pl: &Player, host: bool) {
    if split.len() != 1 {
        pl.send_message("Failed. If you want to use the .help command please type .help by itself. That's .help or .h with no arguments. Do not do something like `.help 1 2 3`. That's wrong. Just do `.help`. Got it!");
        return;
    }

    let mut commands = vec![
        (".help", ".h", "this is it chief"),
        (
            ".info",
            ".i",
            "Look at your lobby's settings for some info(rmation).",
        ),
        (".leave", ".l", "Goodbye..."),
        (".THRUST 1", ".t 1", "THRUST your first THRUSTER in baby."),
        (
            ".who",
            ".w",
            "See who's got the points in the lobby and find out who you are.",
        ),
    ];

    if host {
        commands.append(&mut vec![
            (
                ".end",
                ".e",
                "(chief-only) End the game and return to the lobby setup.",
            ),
            (
                ".kick BOY_MAN_01",
                ".k BOY_MAN_01",
                "(chief-only) Destroy BOY_MAN_01 from your lobby...",
            ),
        ]);
    }

    if pl.is_authenticated {
        commands.append(&mut vec![(
            ".account",
            ".a",
            "This shows your account configurations and stats.",
        )]);
    }

    if pl.is_chieftain() {
        commands.append(&mut vec![
            (".ban", ".b", "(chieftain-only) View ban list."),
            (".ban 69.69.69.69", ".b 69.69.69.69", "(chieftain-only) Ban 69.69.69.69 to the shadow realms."),
            (".unban 69.69.69.69", ".ub 69.69.69.69", "(chieftain-only) Unban 69.69.69.69 from the shadow realm."),
            (".chieftain", ".ct", "(chieftain-only) View the list of chieftains there are."),
            (".chieftain Another_Soul", ".ct Another_Soul", "(chieftain-only) Grant Another_Soul the privilege to be an administrator (Chieftain) of THRUSTIN."),
            (".unchieftain ThisGuy", ".uc ThisGuy", "(chieftain-only) Remove Chieftain privileges from this dude."),
        ]);
    }

    let messages = &vec![
        String::from("Great. Now you're in the phase where you are a THRUSTER. In this state, you can THRUST one of your THRUSTER options into the THRUSTEE. Make sure it's a good one!"),
        generate_table(commands)
    ];

    pl.send_messages(messages);
}

////////////
//choosing//
////////////
pub fn choosing_commands(
    input: &str,
    split: Vec<&str>,
    pl: Rc<RefCell<Player>>,
    lobbies: &mut HashMap<i32, Lobby>,
) {
    let com = get_command(&split);
    let lobby = { lobbies.get_mut(&pl.borrow().lobby).unwrap() };
    match &*com {
        ".help" | ".h" => list_choosing_commands(split, &pl.borrow(), lobby.is_host(pl.borrow().token)),
        ".info" | ".i" => lobby.info(pl),
        ".leave" | ".l" => Lobby::leave_and_delete(pl, lobbies),
        ".thrust" | ".t" => lobby.choose(split, pl),
        ".end" | ".e" => lobby.end(pl),
        ".kick" | ".k" => lobby.kick(split, pl),
        ".who" | ".w" => lobby.who_in_game(pl),
        ".account" | ".a" => pl.borrow().account(),
        ".ban" | ".b" => pl.borrow().ban(split),
        ".unban" | ".ub" => pl.borrow().unban(split),
        ".chieftain" | ".ct" => pl.borrow().chieftain(split),
        ".unchieftain" | ".uc" => pl.borrow().unchieftain(split),
        _ => {
            if com.starts_with(".") {
                pl.borrow()
                    .send_message("Brother that is an invalid command.");
            } else {
                lobby.send_message_from(&pl.borrow(), input);
            }
        }
    }
}

fn list_choosing_commands(split: Vec<&str>, pl: &Player, host: bool) {
    if split.len() != 1 {
        pl.send_message("Failed. If you want to use the .help command please type .help by itself. That's .help or .h with no arguments. Do not do something like `.help 1 2 3`. That's wrong. Just do `.help`. Got it!");
        return;
    }

    let mut commands = vec![
        (".help", ".h", "this is it chief"),
        (
            ".info",
            ".i",
            "Observe the information data relevant to your lobby's configurations",
        ),
        (".leave", ".l", "This shall be farewell, for now..."),
        (".THRUST 2", ".t 2", "Choose THRUSTEE at index 2 to use."),
        (".who", ".w", "See who's got the points in the lobby."),
    ];

    if host {
        commands.append(&mut vec![
        (".end", ".e", "(chief-only) Committing to the usage of this command shall terminate the in-game state of the match and return thy fellow players to the waiting lobby."),
        (
            ".kick BOY_MAN_01",
            ".k BOY_MAN_01",
            "(chief-only) Destroy BOY_MAN_01 from your lobby...",
        )]);
    }

    if pl.is_authenticated {
        commands.append(&mut vec![(
            ".account",
            ".a",
            "Account related information for your display view.",
        )]);
    }

    if pl.is_chieftain() {
        commands.append(&mut vec![
            (".ban", ".b", "(chieftain-only) View ban list."),
            (".ban 69.69.69.69", ".b 69.69.69.69", "(chieftain-only) Ban 69.69.69.69 to the shadow realms."),
            (".unban 69.69.69.69", ".ub 69.69.69.69", "(chieftain-only) Unban 69.69.69.69 from the shadow realm."),
            (".chieftain", ".ch", "(chieftain-only) View the list of chieftains there are."),
            (".chieftain Another_Soul", ".ct Another_Soul", "(chieftain-only) Grant Another_Soul the privilege to be an administrator (Chieftain) of THRUSTIN."),
            (".unchieftain ThisGuy", ".uc ThisGuy", "(chieftain-only) Remove Chieftain privileges from this dude."),
        ]);
    }

    let messages = &vec![
        String::from("Okay you're a THRUSTEE now. First thing you've gotta do is choose a great THRUSTEE that other THRUSTERS can THRUST into. Make sure it's a juicy one!"),
        generate_table(commands)
    ];

    pl.send_messages(messages);
}

////////////
//deciding//
////////////
pub fn deciding_commands(
    input: &str,
    split: Vec<&str>,
    pl: Rc<RefCell<Player>>,
    lobbies: &mut HashMap<i32, Lobby>,
) {
    let com = get_command(&split);
    let lobby = { lobbies.get_mut(&pl.borrow().lobby).unwrap() };
    match &*com {
        ".help" | ".h" => list_deciding_commands(split, &pl.borrow(), lobby.is_host(pl.borrow().token)),
        ".info" | ".i" => lobby.info(pl),
        ".leave" | ".l" => Lobby::leave_and_delete(pl, lobbies),
        ".thrust" | ".t" => lobby.decide(split, pl),
        ".end" | ".e" => lobby.end(pl),
        ".kick" | ".k" => lobby.kick(split, pl),
        ".who" | ".w" => lobby.who_in_game(pl),
        ".account" | ".a" => pl.borrow().account(),
        ".ban" | ".b" => pl.borrow().ban(split),
        ".unban" | ".ub" => pl.borrow().unban(split),
        ".chieftain" | ".ct" => pl.borrow().chieftain(split),
        ".unchieftain" | ".uc" => pl.borrow().unchieftain(split),
        _ => {
            if com.starts_with(".") {
                pl.borrow().send_message("Bro! That's an invalid command.");
            } else {
                lobby.send_message_from(&pl.borrow(), input);
            }
        }
    }
}

fn list_deciding_commands(split: Vec<&str>, pl: &Player, host: bool) {
    if split.len() != 1 {
        pl.send_message("Failed. If you want to use the .help command please type .help by itself. That's .help or .h with no arguments. Do not do something like `.help 1 2 3`. That's wrong. Just do `.help`. Got it!");
        return;
    }

    let mut commands = vec![
        (".help", ".h", "this is it chief"),
        (".info", ".i", "Browse the inherent settings that have been configured in the presence of this lobby's settings existence."),
        (".leave", ".l", "Farewell friend..."),
        (".THRUST 1", ".t 1", "You've made your decision. THRUSTER at index 1 is the best one."),
        (".who", ".w", "See how the points are shapin' up and who is in the lobby?"),
    ];

    if host {
        commands.append(&mut vec![
        (".end", ".e", "(chief-only) This ends the in-game game. Players are returned to the waiting lobby (where lobby settings can be set)."),
        (
            ".kick BOY_MAN_01",
            ".k BOY_MAN_01",
            "(chief-only) Destroy BOY_MAN_01 from your lobby...",
        )]);
    }

    if pl.is_authenticated {
        commands.append(&mut vec![(
            ".account",
            ".a",
            "Visibility to how your account data is becoming awoke.",
        )]);
    }

    if pl.is_chieftain() {
        commands.append(&mut vec![
            (".ban", ".b", "(chieftain-only) View ban list."),
            (".ban 69.69.69.69", ".b 69.69.69.69", "(chieftain-only) Ban 69.69.69.69 to the shadow realms."),
            (".unban 69.69.69.69", ".ub 69.69.69.69", "(chieftain-only) Unban 69.69.69.69 from the shadow realm."),
            (".chieftain", ".ct", "(chieftain-only) View the list of chieftains there are."),
            (".chieftain Another_Soul", ".ct Another_Soul", "(chieftain-only) Grant Another_Soul the privilege to be an administrator (Chieftain) of THRUSTIN."),
            (".unchieftain ThisGuy", ".uc ThisGuy", "(chieftain-only) Remove Chieftain privileges from this dude."),
        ]);
    }

    let messages = &vec![
        String::from("Yeah guy it's time for you to decide on the best THRUSTER. Pick the one that you like the best. Trust your head and your gut. You can do it. I believe in you."),
        generate_table(commands)
    ];

    pl.send_messages(messages);
}

///////////
//waiting//
///////////
pub fn waiting_commands(
    input: &str,
    split: Vec<&str>,
    pl: Rc<RefCell<Player>>,
    lobbies: &mut HashMap<i32, Lobby>,
) {
    let com = get_command(&split);
    let lobby = { lobbies.get_mut(&pl.borrow().lobby).unwrap() };
    match &*com {
        ".help" | ".h" => list_waiting_commands(split, &pl.borrow(), lobby.is_host(pl.borrow().token)),
        ".info" | ".i" => lobby.info(pl),
        ".leave" | ".l" => Lobby::leave_and_delete(pl, lobbies),
        ".thrust" | ".t" => pl
            .borrow()
            .send_message("Chill out homeboy... you needa w8 for THRUSTEE to choose..."),
        ".end" | ".e" => lobby.end(pl),
        ".kick" | ".k" => lobby.kick(split, pl),
        ".who" | ".w" => lobby.who_in_game(pl),
        ".account" | ".a" => pl.borrow().account(),
        ".ban" | ".b" => pl.borrow().ban(split),
        ".unban" | ".ub" => pl.borrow().unban(split),
        ".chieftain" | ".ct" => pl.borrow().chieftain(split),
        ".unchieftain" | ".uc" => pl.borrow().unchieftain(split),
        _ => {
            if com.starts_with(".") {
                pl.borrow()
                    .send_message("Bruh... that's an invalid command.");
            } else {
                lobby.send_message_from(&pl.borrow(), input);
            }
        }
    }
}

fn list_waiting_commands(split: Vec<&str>, pl: &Player, host: bool) {
    if split.len() != 1 {
        pl.send_message("Failed. If you want to use the .help command please type .help by itself. That's .help or .h with no arguments. Do not do something like `.help 1 2 3`. That's wrong. Just do `.help`. Got it!");
        return;
    }

    let mut commands = vec![
        (".help", ".h", "this is it chief"),
        (".info", ".i", "Wondering... what is the relevancy of the configurations to do with this lobby's present status of being set."),
        (".leave", ".l", "The distance between us shall increase... metaphorically..."),
        (".THRUST", ".t", "This doesn't actually do anything. We're just here to let you know you can't THRUST."),
        (".who", ".w", "Who it be what's going down. How many points you got?"),
    ];

    if host {
        commands.append(&mut vec![
            (
                ".end",
                ".e",
                "(chief-only) The game reaches an end and returns to lobby setup.",
            ),
            (
                ".kick SAMPLE_USER_000666",
                ".k SAMPLE_USER_000666",
                "(chief-only) Eliminate SAMPLE_USER_000666 from your lobby...",
            ),
        ]);
    }

    if pl.is_authenticated {
        commands.append(&mut vec![
            (".account", ".a", "Let's say you want to see what your Username, Name, Games Played, Games Won, Points Gained are..."),
        ]);
    }

    if pl.is_chieftain() {
        commands.append(&mut vec![
            (".ban", ".b", "(chieftain-only) View ban list."),
            (".ban 69.69.69.69", ".b 69.69.69.69", "(chieftain-only) Ban 69.69.69.69 to the shadow realms."),
            (".unban 69.69.69.69", ".ub 69.69.69.69", "(chieftain-only) Unban 69.69.69.69 from the shadow realm."),
            (".chieftain", ".ct", "(chieftain-only) View the list of chieftains there are."),
            (".chieftain Another_Soul", ".ct Another_Soul", "(chieftain-only) Grant Another_Soul the privilege to be an administrator (Chieftain) of THRUSTIN."),
            (".unchieftain ThisGuy", ".uc ThisGuy", "(chieftain-only) Remove Chieftain privileges from this dude."),
        ]);
    }

    let messages = &vec![
        String::from("Aite my dude you needa chill and wait for the THRUSTEE to choose a good THRUSTEE to be THRUSTED with."),
        generate_table(commands)
    ];

    pl.send_messages(messages);
}