Last change
on this file since 503 was 503, checked in by alloc, 3 days ago |
Compatibility fixes for 2.0
|
File size:
1.0 KB
|
Rev | Line | |
---|
[391] | 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;
|
---|
[503] | 8 |
|
---|
| 9 | _receiver.SendPackage (NetPackageManager.GetPackage<NetPackageChat> ().Setup (EChatType.Whisper, _sender.entityId,
|
---|
| 10 | _message, null, EMessageSender.SenderIdAsPlayer, GeneratedTextManager.BbCodeSupportMode.SupportedAndAddEscapes));
|
---|
[391] | 11 | } else {
|
---|
| 12 | senderName = "Server";
|
---|
[503] | 13 |
|
---|
| 14 | _receiver.SendPackage (NetPackageManager.GetPackage<NetPackageChat> ().Setup (EChatType.Whisper, -1,
|
---|
| 15 | _message, null, EMessageSender.Server, GeneratedTextManager.BbCodeSupportMode.Supported));
|
---|
[391] | 16 | }
|
---|
| 17 |
|
---|
| 18 | string receiverName = _receiver.playerName;
|
---|
[402] | 19 | receiverName = receiverName != null ? $"\"{receiverName}\"" : "unknownName";
|
---|
| 20 | SdtdConsole.Instance.Output ($"Message to player {receiverName} sent with sender \"{senderName}\"");
|
---|
[391] | 21 | }
|
---|
| 22 | }
|
---|
| 23 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.