Skip to content
This repository has been archived by the owner on Mar 14, 2021. It is now read-only.

Commit

Permalink
Fixed some spelling issues
Browse files Browse the repository at this point in the history
  • Loading branch information
XtraCube committed Dec 19, 2020
2 parents 6a37c48 + 0ee1927 commit 1c05fc5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 59 deletions.
86 changes: 28 additions & 58 deletions AllOfUs/GameEventListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Microsoft.Extensions.Logging;
using System.Threading.Tasks;
using XtraCube.Plugins.AllofUs;
using System.Collections.Generic;

namespace XtraCube.Plugins.AllOfUs.Handlers
{
Expand Down Expand Up @@ -45,7 +46,22 @@ public async void OnLobbyCreate(IPlayerSpawnedEvent e)
[EventListener]
public async void OnPlayerChat(IPlayerChatEvent e)
{
string[] args = e.Message.Trim().Split(" ");
string[] args = e.Message.Trim().ToLower().Split(" ");
string name = e.PlayerControl.PlayerInfo.PlayerName;
byte color = e.PlayerControl.PlayerInfo.ColorId;
Dictionary<string, int> Colors = new Dictionary<string, int>();
Colors.Add("red", 0);
Colors.Add("blue", 1);
Colors.Add("green", 2);
Colors.Add("pink", 3);
Colors.Add("orange", 4);
Colors.Add("yellow", 5);
Colors.Add("black", 6);
Colors.Add("white", 7);
Colors.Add("purple", 8);
Colors.Add("brown", 9);
Colors.Add("cyan", 10);
Colors.Add("lime", 11);
if (e.Game.GameState == GameStates.NotStarted)
{
switch (args[0])
Expand All @@ -65,65 +81,19 @@ public async void OnPlayerChat(IPlayerChatEvent e)
case "/color":
if (args.Length > 1)
{
switch (args[1])
if (Colors.ContainsKey(args[1]))
{
case "red":
await SendMessage(e.PlayerControl, "Color changed successfuly!");
await e.PlayerControl.SetColorAsync((byte)0);
break;

case "blue":
await SendMessage(e.PlayerControl, "Color changed successfuly!");
await e.PlayerControl.SetColorAsync((byte)1);
break;
case "green":
await SendMessage(e.PlayerControl, "Color changed successfuly!");
await e.PlayerControl.SetColorAsync((byte)2);
break;
case "pink":
await SendMessage(e.PlayerControl, "Color changed successfuly!");
await e.PlayerControl.SetColorAsync((byte)3);
break;
case "orange":
await SendMessage(e.PlayerControl, "Color changed successfuly!");
await e.PlayerControl.SetColorAsync((byte)4);
break;

case "yellow":
await SendMessage(e.PlayerControl, "Color changed successfuly!");
await e.PlayerControl.SetColorAsync((byte)5);
break;
case "black":
await SendMessage(e.PlayerControl, "Color changed successfuly!");
await e.PlayerControl.SetColorAsync((byte)6);
break;
case "white":
await SendMessage(e.PlayerControl, "Color changed successfuly!");
await e.PlayerControl.SetColorAsync((byte)7);
break;
case "purple":
await SendMessage(e.PlayerControl, "Color changed successfuly!");
await e.PlayerControl.SetColorAsync((byte)8);
break;
case "brown":
await SendMessage(e.PlayerControl, "Color changed successfuly!");
await e.PlayerControl.SetColorAsync((byte)9);
break;
case "cyan":
await SendMessage(e.PlayerControl, "Color changed successfuly!");
await e.PlayerControl.SetColorAsync((byte)10);
break;
case "lime":
await SendMessage(e.PlayerControl, "Color changed successfuly!");
await e.PlayerControl.SetColorAsync((byte)11);
break;
default:
await SendMessage(e.PlayerControl, "[FF0000FF]Invaid color!");
await SendMessage(e.PlayerControl, "Available colors: Red, Blue, Green, Pink, Orange, Yellow, Black, White, Purple, Brown, Cyan, Lime");
break;
await SendMessage(e.PlayerControl, "Color changed successfuly!");
await e.PlayerControl.SetColorAsync((byte)Colors[args[1]]);
break;
}
else
{
await SendMessage(e.PlayerControl, "[FF0000FF]Invalid color!");
await SendMessage(e.PlayerControl, "Available colors: Red, Blue, Green, Pink, Orange, Yellow, Black, White, Purple, Brown, Cyan, Lime");
break;
}
}

}
else if (args.Length == 1)
{
await SendMessage(e.PlayerControl, "/color {color}\n Change your color!");
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# AllOfUsBot
A simplified version of the All of Us Plugin for Impostor.
A simplified version of the All of Us Plugin for Impostor v1.2.2

# Commands
This version of the plugin has some useful commands, but it won't contain as much as the official All of Us server plugin
Expand Down

0 comments on commit 1c05fc5

Please sign in to comment.