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

Last change on this file since 434 was 402, checked in by alloc, 22 months ago
  • Major refactoring
  • Using Utf8Json for (de)serialization
  • Moving APIs to REST
  • Removing dependencies from WebServer and MapRenderer to ServerFixes
File size: 752 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
[402]12 _receiver.SendPackage (NetPackageManager.GetPackage<NetPackageChat> ().Setup (EChatType.Whisper, -1, _message,
13 $"{senderName} (PM)", false, null));
[391]14 string receiverName = _receiver.playerName;
[402]15 receiverName = receiverName != null ? $"\"{receiverName}\"" : "unknownName";
16 SdtdConsole.Instance.Output ($"Message to player {receiverName} sent with sender \"{senderName}\"");
[391]17 }
18 }
19}
Note: See TracBrowser for help on using the repository browser.