* First Accent Prototype * -RegisterSystem -Fixed addaccent cmd -Spanish accent * -list is now ? -Checks if the accent is already added -Made components public * owo whats this * special word filter * Eeeeeeeeee * Better? * -Use a delegate func -Made some funcs not static -Moved SentenceRegex * InjectDependencies * Name change? Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Interfaces.Random;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Random;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Content.Server.GameObjects.Components.Mobs.Speech
|
|
{
|
|
[RegisterComponent]
|
|
public class OwOAccentComponent : Component, IAccentComponent
|
|
{
|
|
public override string Name => "OwOAccent";
|
|
|
|
private static readonly IReadOnlyList<string> Faces = new List<string>{
|
|
" (・`ω´・)", " ;;w;;", " owo", " UwU", " >w<", " ^w^"
|
|
}.AsReadOnly();
|
|
private string RandomFace => IoCManager.Resolve<IRobustRandom>().Pick(Faces);
|
|
|
|
private static readonly Dictionary<string, string> SpecialWords = new Dictionary<string, string>
|
|
{
|
|
{ "you", "wu" },
|
|
};
|
|
|
|
public string Accentuate(string message)
|
|
{
|
|
foreach ((var word,var repl) in SpecialWords)
|
|
{
|
|
message = message.Replace(word, repl);
|
|
}
|
|
|
|
return message.Replace("!", RandomFace)
|
|
.Replace("r", "w").Replace("R", "W")
|
|
.Replace("l", "w").Replace("L", "W");
|
|
}
|
|
}
|
|
}
|