source: binary-improvements/AllocsCommands/Commands/Reply.cs@ 231

Last change on this file since 231 was 230, checked in by alloc, 10 years ago

Binary improvements

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