- Timestamp:
- Apr 18, 2015, 4:27:57 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/AllocsCommands/Commands/ListLandProtection.cs
r224 r230 4 4 namespace AllocsFixes.CustomCommands 5 5 { 6 public class ListLandProtection : ConsoleC ommand6 public class ListLandProtection : ConsoleCmdAbstract 7 7 { 8 public ListLandProtection (ConsoleSdtd cons) : base(cons) 9 { 10 } 11 12 public override string Description () 8 public override string GetDescription () 13 9 { 14 10 return "lists all land protection blocks and owners"; 15 11 } 16 12 17 public override string[] Names ()13 public override string[] GetCommands () 18 14 { 19 15 return new string[] { "listlandprotection", "llp" }; 20 16 } 21 17 22 public override void Execute Remote (string _sender, string[] _params)18 public override void Execute (List<string> _params, CommandSenderInfo _senderInfo) 23 19 { 24 20 try { 25 if (_params.Length >= 1 && _params [0].ToLower ().Equals ("nearby")) { 26 string[] params2 = new string[_params.Length + 1]; 27 for (int i = 0; i < _params.Length; i++) 28 params2 [i] = _params [i]; 29 params2 [_params.Length] = _sender; 30 _params = params2; 21 if (_senderInfo.RemoteClientInfo != null) { 22 if (_params.Count >= 1 && _params [0].ToLower ().Equals ("nearby")) { 23 _params.Add (_senderInfo.RemoteClientInfo.playerId); 24 } 31 25 } 32 Run (_params);33 } catch (Exception e) {34 Log.Out ("Error in ListLandProtection.ExecuteRemote: " + e);35 }36 }37 26 38 public override void Run (string[] _params) 39 { 40 try { 41 World w = CommonMappingFunctions.GetGameManager ().World; 42 PersistentPlayerList ppl = CommonMappingFunctions.GetGameManager ().GetPersistentPlayerList (); 27 World w = GameManager.Instance.World; 28 PersistentPlayerList ppl = GameManager.Instance.GetPersistentPlayerList (); 43 29 44 30 bool summaryOnly = false; … … 48 34 int closeToDistance = 32; 49 35 50 if (_params. Length== 1) {36 if (_params.Count == 1) { 51 37 long tempLong; 52 38 … … 56 42 steamIdFilter = _params [0]; 57 43 } else { 58 ClientInfo ci = Co mmonMappingFunctions.GetClientInfoFromNameOrID (_params [0], true);44 ClientInfo ci = ConsoleHelper.ParseParamIdOrName (_params [0]); 59 45 if (ci != null) { 60 steamIdFilter = CommonMappingFunctions.GetSteamID (ci);46 steamIdFilter = ci.playerId; 61 47 } else { 62 m_Console.SendResult ("Player name or entity id \"" + _params [0] + "\" not found.");48 SdtdConsole.Instance.Output ("Player name or entity id \"" + _params [0] + "\" not found."); 63 49 return; 64 50 } 65 51 } 66 } else if (_params. Length>= 2) {52 } else if (_params.Count >= 2) { 67 53 if (_params [0].ToLower ().Equals ("nearby")) { 68 54 try { 69 if (_params. Length== 3) {55 if (_params.Count == 3) { 70 56 if (!int.TryParse (_params[1], out closeToDistance)) { 71 m_Console.SendResult ("Given radius is not an integer!");57 SdtdConsole.Instance.Output ("Given radius is not an integer!"); 72 58 } 73 59 } 74 ClientInfo ci = Co mmonMappingFunctions.GetClientInfoFromSteamID (_params [_params.Length- 1]);75 EntityPlayer ep = CommonMappingFunctions.GetEntityPlayer (ci);60 ClientInfo ci = ConsoleHelper.ParseParamSteamIdOnline (_params [_params.Count - 1]); 61 EntityPlayer ep = w.Players.dict [ci.entityId]; 76 62 closeTo = new Vector3i (ep.GetPosition ()); 77 63 onlyCloseToPlayer = true; 78 64 } catch (Exception e) { 79 m_Console.SendResult ("Error getting current player's position");65 SdtdConsole.Instance.Output ("Error getting current player's position"); 80 66 Log.Out ("Error in ListLandProtection.Run: " + e); 81 67 } 82 68 } else { 83 m_Console.SendResult ("Illegal parameter list");69 SdtdConsole.Instance.Output ("Illegal parameter list"); 84 70 return; 85 71 } … … 103 89 name += " (" + kvp.Key.PlayerId + ")"; 104 90 105 m_Console.SendResult (String.Format ("Player \"{0}\" owns {3} keystones (protected: {1}, current hardness multiplier: {2})", name, w.LandClaimIsActive (kvp.Key), w.LandClaimPower (kvp.Key), kvp.Value.Count));91 SdtdConsole.Instance.Output (String.Format ("Player \"{0}\" owns {3} keystones (protected: {1}, current hardness multiplier: {2})", name, w.LandClaimIsActive (kvp.Key), w.LandClaimPower (kvp.Key), kvp.Value.Count)); 106 92 if (!summaryOnly) { 107 93 foreach (Vector3i v in kvp.Value) { 108 m_Console.SendResult (" (" + v.ToString () + ")");94 SdtdConsole.Instance.Output (" (" + v.ToString () + ")"); 109 95 } 110 96 } … … 114 100 115 101 if (steamIdFilter.Length == 0) 116 m_Console.SendResult ("Total of " + d.Count + " keystones in the game");102 SdtdConsole.Instance.Output ("Total of " + d.Count + " keystones in the game"); 117 103 } catch (Exception e) { 118 104 Log.Out ("Error in ListLandProtection.Run: " + e);
Note:
See TracChangeset
for help on using the changeset viewer.