- Timestamp:
- Jun 19, 2016, 1:52:31 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/MapRendering/Web/API/ExecuteConsoleCommand.cs
r245 r279 16 16 } 17 17 18 string commandName = req.QueryString ["command"]; 18 string commandline = req.QueryString ["command"]; 19 string commandPart = commandline.Split (' ') [0]; 20 string argumentsPart = commandline.Substring (Math.Min (commandline.Length, commandPart.Length + 1)); 19 21 20 IConsoleCommand command = SdtdConsole.Instance.GetCommand (command Name);22 IConsoleCommand command = SdtdConsole.Instance.GetCommand (commandline); 21 23 22 24 if (command == null) { … … 36 38 // TODO: Execute command (store resp as IConsoleConnection instance to deliver response to the single client?) 37 39 38 // JSONObject result = new JSONObject (); 39 // result.Add ("claimsize", new JSONNumber (GamePrefs.GetInt (EnumGamePrefs.LandClaimSize))); 40 // 41 // JSONArray claimOwners = new JSONArray (); 42 // result.Add ("claimowners", claimOwners); 43 // 44 // Dictionary<Vector3i, PersistentPlayerData> d = GameManager.Instance.GetPersistentPlayerList ().m_lpBlockMap; 45 // if (d != null) { 46 // World w = GameManager.Instance.World; 47 // Dictionary<PersistentPlayerData, List<Vector3i>> owners = new Dictionary<PersistentPlayerData, List<Vector3i>> (); 48 // foreach (KeyValuePair<Vector3i, PersistentPlayerData> kvp in d) { 49 // if (steamid.Length == 0 || kvp.Value.PlayerId.Equals (steamid)) { 50 // if (!owners.ContainsKey (kvp.Value)) { 51 // owners.Add (kvp.Value, new List<Vector3i> ()); 52 // } 53 // owners [kvp.Value].Add (kvp.Key); 54 // } 55 // } 56 // 57 // foreach (KeyValuePair<PersistentPlayerData, List<Vector3i>> kvp in owners) { 58 // if (steamid.Length == 0 || kvp.Key.PlayerId.Equals (steamid)) { 59 // string curID = kvp.Key.PlayerId; 60 // bool isActive = w.IsLandProtectionValidForPlayer (kvp.Key); 61 // 62 // JSONObject owner = new JSONObject (); 63 // claimOwners.Add (owner); 64 // 65 // owner.Add ("steamid", new JSONString (curID)); 66 // owner.Add ("claimactive", new JSONBoolean (isActive)); 67 // 68 // JSONArray claims = new JSONArray (); 69 // owner.Add ("claims", claims); 70 // 71 // foreach (Vector3i v in kvp.Value) { 72 // JSONObject claim = new JSONObject (); 73 // claim.Add ("x", new JSONNumber (v.x)); 74 // claim.Add ("y", new JSONNumber (v.y)); 75 // claim.Add ("z", new JSONNumber (v.z)); 76 // 77 // claims.Add (claim); 78 // } 79 // } 80 // } 81 // } 82 // 83 // WriteJSON (resp, result); 40 resp.SendChunked = true; 41 WebCommandResult wcr = new WebCommandResult (commandPart, argumentsPart, resp); 42 SdtdConsole.Instance.ExecuteAsync (commandline, wcr); 43 } 44 45 public override int DefaultPermissionLevel () { 46 return 2000; 84 47 } 85 48 }
Note:
See TracChangeset
for help on using the changeset viewer.