- Timestamp:
- Sep 4, 2018, 1:00:48 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/AllocsCommands/Commands/ListLandProtection.cs
r273 r325 1 1 using System; 2 2 using System.Collections.Generic; 3 using AllocsFixes.PersistentData; 3 4 4 namespace AllocsFixes.CustomCommands 5 { 6 public class ListLandProtection : ConsoleCmdAbstract 7 { 8 public override string GetDescription () 9 { 5 namespace AllocsFixes.CustomCommands { 6 public class ListLandProtection : ConsoleCmdAbstract { 7 public override string GetDescription () { 10 8 return "lists all land protection blocks and owners"; 11 9 } … … 13 11 public override string GetHelp () { 14 12 return "Usage:\n" + 15 " 1. listlandprotection summary\n" +16 " 2. listlandprotection <steam id / player name / entity id> [parseable]\n" +17 " 3. listlandprotection nearby [length]\n" +18 "1. Lists only players that own claimstones, the number they own and the protection status\n" +19 "2. Lists only the claims of the player given by his SteamID / entity id / playername, including the individual claim positions.\n" +20 " If \"parseable\" is specified the output of the individual claims will be in a format better suited for programmatical readout.\n" +21 "3. Lists claims in a square with edge length of 64 (or the optionally specified size) around the executing player\n";13 " 1. listlandprotection summary\n" + 14 " 2. listlandprotection <steam id / player name / entity id> [parseable]\n" + 15 " 3. listlandprotection nearby [length]\n" + 16 "1. Lists only players that own claimstones, the number they own and the protection status\n" + 17 "2. Lists only the claims of the player given by his SteamID / entity id / playername, including the individual claim positions.\n" + 18 " If \"parseable\" is specified the output of the individual claims will be in a format better suited for programmatical readout.\n" + 19 "3. Lists claims in a square with edge length of 64 (or the optionally specified size) around the executing player\n"; 22 20 } 23 21 24 public override string[] GetCommands () 25 { 26 return new string[] { "listlandprotection", "llp" }; 22 public override string[] GetCommands () { 23 return new[] {"listlandprotection", "llp"}; 27 24 } 28 25 29 public override void Execute (List<string> _params, CommandSenderInfo _senderInfo) 30 { 26 public override void Execute (List<string> _params, CommandSenderInfo _senderInfo) { 31 27 try { 32 28 if (_senderInfo.RemoteClientInfo != null) { … … 41 37 bool summaryOnly = false; 42 38 string steamIdFilter = string.Empty; 43 Vector3i closeTo = default (Vector3i);39 Vector3i closeTo = default (Vector3i); 44 40 bool onlyCloseToPlayer = false; 45 41 int closeToDistance = 32; … … 71 67 try { 72 68 if (_params.Count == 3) { 73 if (!int.TryParse (_params [1], out closeToDistance)) {69 if (!int.TryParse (_params [1], out closeToDistance)) { 74 70 SdtdConsole.Instance.Output ("Given length is not an integer!"); 75 71 return; 76 72 } 73 77 74 closeToDistance /= 2; 78 75 } 76 79 77 ClientInfo ci = ConsoleHelper.ParseParamSteamIdOnline (_params [_params.Count - 1]); 80 78 EntityPlayer ep = w.Players.dict [ci.entityId]; … … 95 93 LandClaimList.OwnerFilter[] ownerFilters = null; 96 94 if (!string.IsNullOrEmpty (steamIdFilter)) { 97 ownerFilters = new LandClaimList.OwnerFilter[] { LandClaimList.SteamIdFilter (steamIdFilter)};95 ownerFilters = new[] {LandClaimList.SteamIdFilter (steamIdFilter)}; 98 96 } 97 99 98 LandClaimList.PositionFilter[] posFilters = null; 100 99 if (onlyCloseToPlayer) { 101 posFilters = new LandClaimList.PositionFilter[] { LandClaimList.CloseToFilter2dRect (closeTo, closeToDistance)};100 posFilters = new[] {LandClaimList.CloseToFilter2dRect (closeTo, closeToDistance)}; 102 101 } 103 102 104 Dictionary<P ersistentData.Player, List<Vector3i>> claims = LandClaimList.GetLandClaims (ownerFilters, posFilters);103 Dictionary<Player, List<Vector3i>> claims = LandClaimList.GetLandClaims (ownerFilters, posFilters); 105 104 106 foreach (KeyValuePair<P ersistentData.Player, List<Vector3i>> kvp in claims) {107 SdtdConsole.Instance.Output ( String.Format (105 foreach (KeyValuePair<Player, List<Vector3i>> kvp in claims) { 106 SdtdConsole.Instance.Output (string.Format ( 108 107 "Player \"{0} ({1})\" owns {4} keystones (protected: {2}, current hardness multiplier: {3})", 109 108 kvp.Key.Name, … … 115 114 foreach (Vector3i v in kvp.Value) { 116 115 if (parseableOutput) { 117 SdtdConsole.Instance.Output ("LandProtectionOf: id=" + kvp.Key.SteamID + ", playerName=" + kvp.Key.Name + ", location=" + v.ToString ()); 116 SdtdConsole.Instance.Output ("LandProtectionOf: id=" + kvp.Key.SteamID + 117 ", playerName=" + kvp.Key.Name + ", location=" + v); 118 118 } else { 119 SdtdConsole.Instance.Output (" (" + v .ToString ()+ ")");119 SdtdConsole.Instance.Output (" (" + v + ")"); 120 120 } 121 121 } … … 123 123 } 124 124 125 if (steamIdFilter.Length == 0) 125 if (steamIdFilter.Length == 0) { 126 126 SdtdConsole.Instance.Output ("Total of " + ppl.m_lpBlockMap.Count + " keystones in the game"); 127 } 127 128 } catch (Exception e) { 128 129 Log.Out ("Error in ListLandProtection.Run: " + e);
Note:
See TracChangeset
for help on using the changeset viewer.