Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 |
|
---|
4 | namespace AllocsFixes.CustomCommands
|
---|
5 | {
|
---|
6 | public class Reply : ConsoleCmdAbstract
|
---|
7 | {
|
---|
8 | public override string GetDescription ()
|
---|
9 | {
|
---|
10 | return "send a message to the player who last sent you a PM";
|
---|
11 | }
|
---|
12 |
|
---|
13 | public override string[] GetCommands ()
|
---|
14 | {
|
---|
15 | return new string[] { "reply", "re" };
|
---|
16 | }
|
---|
17 |
|
---|
18 | private void RunInternal (ClientInfo _sender, List<string> _params)
|
---|
19 | {
|
---|
20 | if (_params.Count < 1) {
|
---|
21 | SdtdConsole.Instance.Output ("Usage: reply <message>");
|
---|
22 | return;
|
---|
23 | }
|
---|
24 |
|
---|
25 | string message = _params [0];
|
---|
26 |
|
---|
27 | ClientInfo receiver = PrivateMassageConnections.GetLastPMSenderForPlayer (_sender);
|
---|
28 | if (receiver != null && receiver.clientId >= 0) {
|
---|
29 | Chat.SendMessage (receiver, _sender, message);
|
---|
30 | } else {
|
---|
31 | if (receiver != null) {
|
---|
32 | SdtdConsole.Instance.Output ("The sender of the PM you last received is currently not online.");
|
---|
33 | } else {
|
---|
34 | SdtdConsole.Instance.Output ("You have not received a PM so far.");
|
---|
35 | }
|
---|
36 | }
|
---|
37 | }
|
---|
38 |
|
---|
39 | public override void Execute (List<string> _params, CommandSenderInfo _senderInfo) {
|
---|
40 | if (_senderInfo.RemoteClientInfo == null) {
|
---|
41 | Log.Out ("Command \"reply\" can only be used on clients!");
|
---|
42 | } else {
|
---|
43 | RunInternal (_senderInfo.RemoteClientInfo, _params);
|
---|
44 | }
|
---|
45 | }
|
---|
46 | }
|
---|
47 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.