- Timestamp:
- Nov 9, 2021, 6:28:33 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/AllocsCommands/Commands/ListLandProtection.cs
r359 r369 12 12 return "Usage:\n" + 13 13 " 1. listlandprotection summary\n" + 14 " 2. listlandprotection < steamid / player name / entity id> [parseable]\n" +14 " 2. listlandprotection <user id / player name / entity id> [parseable]\n" + 15 15 " 3. listlandprotection nearby [length]\n" + 16 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" +17 "2. Lists only the claims of the player given by his UserID / entity id / playername, including the individual claim positions.\n" + 18 18 " If \"parseable\" is specified the output of the individual claims will be in a format better suited for programmatical readout.\n" + 19 19 "3. Lists claims in a square with edge length of 64 (or the optionally specified size) around the executing player\n"; … … 25 25 26 26 public override void Execute (List<string> _params, CommandSenderInfo _senderInfo) { 27 if (_senderInfo.RemoteClientInfo != null) { 28 if (_params.Count >= 1 && _params [0].EqualsCaseInsensitive ("nearby")) { 29 _params.Add (_senderInfo.RemoteClientInfo.playerId); 27 if (_params.Count >= 1 && _params [0].EqualsCaseInsensitive ("nearby")) { 28 if (_senderInfo.RemoteClientInfo != null) { 29 _params.Add (_senderInfo.RemoteClientInfo.entityId.ToString ()); 30 } else if (_senderInfo.IsLocalGame && !GameManager.IsDedicatedServer) { 31 _params.Add (GameManager.Instance.World.GetPrimaryPlayerId ().ToString ()); 30 32 } 31 33 } … … 35 37 36 38 bool summaryOnly = false; 37 string steamIdFilter = string.Empty;39 PlatformUserIdentifierAbs userIdFilter = null; 38 40 Vector3i closeTo = default (Vector3i); 39 41 bool onlyCloseToPlayer = false; … … 47 49 48 50 if (_params.Count == 1) { 49 long tempLong;50 51 51 if (_params [0].EqualsCaseInsensitive ("summary")) { 52 52 summaryOnly = true; 53 } else if (_params [0].Length == 17 && long.TryParse (_params [0], out tempLong)) { 54 steamIdFilter = _params [0]; 53 } else if (PlatformUserIdentifierAbs.TryFromCombinedString (_params[0], out userIdFilter)) { 55 54 } else { 56 55 ClientInfo ci = ConsoleHelper.ParseParamIdOrName (_params [0]); 57 56 if (ci != null) { 58 steamIdFilter = ci.playerId;57 userIdFilter = ci.PlatformId; 59 58 } else { 60 59 SdtdConsole.Instance.Output ("Player name or entity id \"" + _params [0] + "\" not found."); … … 74 73 } 75 74 76 ClientInfo ci = ConsoleHelper.ParseParamSteamIdOnline (_params [_params.Count - 1]);77 EntityPlayer ep = w.Players.dict [ ci.entityId];75 int entityId = int.Parse (_params [_params.Count - 1]); 76 EntityPlayer ep = w.Players.dict [entityId]; 78 77 closeTo = new Vector3i (ep.GetPosition ()); 79 78 onlyCloseToPlayer = true; … … 91 90 92 91 LandClaimList.OwnerFilter[] ownerFilters = null; 93 if ( !string.IsNullOrEmpty (steamIdFilter)) {94 ownerFilters = new[] {LandClaimList. SteamIdFilter (steamIdFilter)};92 if (userIdFilter != null) { 93 ownerFilters = new[] {LandClaimList.UserIdFilter (userIdFilter)}; 95 94 } 96 95 … … 106 105 "Player \"{0} ({1})\" owns {4} keystones (protected: {2}, current hardness multiplier: {3})", 107 106 kvp.Key.Name, 108 kvp.Key. SteamID,107 kvp.Key.PlatformId, 109 108 kvp.Key.LandProtectionActive, 110 109 kvp.Key.LandProtectionMultiplier, … … 113 112 foreach (Vector3i v in kvp.Value) { 114 113 if (parseableOutput) { 115 SdtdConsole.Instance.Output ("LandProtectionOf: id=" + kvp.Key. SteamID+114 SdtdConsole.Instance.Output ("LandProtectionOf: id=" + kvp.Key.PlatformId + 116 115 ", playerName=" + kvp.Key.Name + ", location=" + v); 117 116 } else { … … 122 121 } 123 122 124 if ( string.IsNullOrEmpty (steamIdFilter)) {123 if (userIdFilter == null) { 125 124 SdtdConsole.Instance.Output ("Total of " + ppl.m_lpBlockMap.Count + " keystones in the game"); 126 125 }
Note:
See TracChangeset
for help on using the changeset viewer.