Last change
on this file since 424 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
|
Line | |
---|
1 | namespace 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,
|
---|
13 | $"{senderName} (PM)", false, null));
|
---|
14 | string receiverName = _receiver.playerName;
|
---|
15 | receiverName = receiverName != null ? $"\"{receiverName}\"" : "unknownName";
|
---|
16 | SdtdConsole.Instance.Output ($"Message to player {receiverName} sent with sender \"{senderName}\"");
|
---|
17 | }
|
---|
18 | }
|
---|
19 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.