improve color code removing in normal chat

This commit is contained in:
hydrant
2019-06-26 16:49:56 +02:00
parent c8155074d3
commit 8125ba673e
4 changed files with 27 additions and 25 deletions

View File

@@ -29,7 +29,7 @@ namespace ReallifeGamemode.Server.Commands
return;
}
message = Regex.Replace(message, "(~[a-zA-Z]~{1})|(!{(.*)})", "");
message = Regex.Replace(message, "(~[a-zA-Z]~)|(!{(.*)})", "");
string broadcastMessage = "!{02FCFF}** " + player.GetUser().GetFactionRank().RankName + " " + player.Name + ": " + message + " )) **";
ChatService.BroadcastFaction(broadcastMessage, f);
@@ -45,7 +45,7 @@ namespace ReallifeGamemode.Server.Commands
return;
}
message = Regex.Replace(message, "(~[a-zA-Z]~{1})|(!{(.*)})", "");
message = Regex.Replace(message, "(~[a-zA-Z]~)|(!{(.*)})", "");
string broadcastMessage = "!{33AA33}** " + player.GetUser().GetFactionRank().RankName + " " + player.Name + ": " + message + ", over **";
ChatService.BroadcastFaction(broadcastMessage, f);
@@ -61,7 +61,7 @@ namespace ReallifeGamemode.Server.Commands
return;
}
message = Regex.Replace(message, "(~[a-zA-Z]~{1})|(!{(.*)})", "");
message = Regex.Replace(message, "(~[a-zA-Z]~)|(!{(.*)})", "");
string broadcastMessage = "!{CC3333}** " + player.GetUser().GetFactionRank().RankName + " " + player.Name + ": " + message + ", over **";
using (var context = new DatabaseContext())
@@ -111,12 +111,6 @@ namespace ReallifeGamemode.Server.Commands
}
}
[Command("uninvite", "~m~Benutzung: ~s~/uninvite [Name]")]
public void CmdFactionUninvite(Client player, string name)
{
}
[Command("lc", "~m~Benutzung: ~s~/lc [Nachricht]", GreedyArg = true)]
public void CmdFactionLc(Client player, string message)
{
@@ -126,7 +120,7 @@ namespace ReallifeGamemode.Server.Commands
return;
}
message = Regex.Replace(message, "(~[a-zA-Z]~{1})|(!{(.*)})", "");
message = Regex.Replace(message, "(~[a-zA-Z]~)|(!{(.*)})", "");
string broadcastMsg = "~y~[" + player.GetUser().Faction.Name + "] " + player.Name + ": " + message;
@@ -190,21 +184,29 @@ namespace ReallifeGamemode.Server.Commands
player.SendNotification("Du hast~g~" + target.Name + " ~s~geheilt.", false);
}
#endregion
#region Global Fraktions Commands
[Command("duty", "~m~Benutzung: ~s~/duty")]
public void CmdFactionDuty(Client player)
#region Staatsfraktionen (LSPD / FBI) Commands
[Command("wanted", "~m~Benutzung: ~s~/wa(nted) [Name / ID] [Anzahl] [Grund]", Alias = "wa", GreedyArg = true)]
public void CmdFactionWanted(Client player, string nameOrId, int amount, string reason)
{
if (player.GetData("duty") == false)
User user = player.GetUser();
if (user == null || (user.FactionId != 1 && user.FactionId != 2))
{
player.SetData("duty", true);
player.SendNotification("~g~Du bist jetzt im Dienst!", false);
ChatService.NotAuthorized(player);
return;
}
else
Client target = ClientService.GetClientByNameOrId(nameOrId);
if (target == null || !target.IsLoggedIn())
{
player.SetData("duty", false);
player.SendNotification("~r~Schönen Feierabend!", false);
ChatService.PlayerNotFound(player);
return;
}
User targetUser = target.GetUser();
targetUser.GiveWanteds(player, amount, reason);
}
#endregion
#region Global Fraktions Commands
#endregion
}
}