source: binary-improvements2/CommandExtensions/src/ChatHelpers.cs@ 398

Last change on this file since 398 was 391, checked in by alloc, 2 years ago

Major refactoring/cleanup

File size: 728 bytes
RevLine 
[391]1namespace CommandExtensions {
2 public static class ChatHelpers {
3 public static void SendMessage (ClientInfo _receiver, ClientInfo _sender, string _message) {
4 string senderName;
5 if (_sender != null) {
6 PrivateMessageConnections.SetLastPMSender (_sender, _receiver);
7 senderName = _sender.playerName;
8 } else {
9 senderName = "Server";
10 }
11
12 _receiver.SendPackage (NetPackageManager.GetPackage<NetPackageChat> ().Setup (EChatType.Whisper, -1, _message, senderName + " (PM)", false, null));
13 string receiverName = _receiver.playerName;
14 SdtdConsole.Instance.Output (
15 $"Message to player {(receiverName != null ? "\"" + receiverName + "\"" : "unknownName")} sent with sender \"{senderName}\"");
16 }
17 }
18}
Note: See TracBrowser for help on using the repository browser.