Changeset 359 for binary-improvements
- Timestamp:
- Oct 29, 2019, 11:20:45 AM (5 years ago)
- Location:
- binary-improvements
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/AllocsCommands/Commands/Give.cs
r342 r359 25 25 26 26 public override void Execute (List<string> _params, CommandSenderInfo _senderInfo) { 27 try { 28 if (_params.Count != 3 && _params.Count != 4) { 29 SdtdConsole.Instance.Output ("Wrong number of arguments, expected 3 or 4, found " + _params.Count + 30 "."); 27 if (_params.Count != 3 && _params.Count != 4) { 28 SdtdConsole.Instance.Output ("Wrong number of arguments, expected 3 or 4, found " + _params.Count + 29 "."); 30 return; 31 } 32 33 ClientInfo ci = ConsoleHelper.ParseParamIdOrName (_params [0]); 34 35 if (ci == null) { 36 SdtdConsole.Instance.Output ("Playername or entity id not found."); 37 return; 38 } 39 40 ItemValue iv = ItemClass.GetItem (_params [1], true); 41 if (iv.type == ItemValue.None.type) { 42 SdtdConsole.Instance.Output ("Item not found."); 43 return; 44 } 45 46 iv = new ItemValue (iv.type, true); 47 48 int n; 49 if (!int.TryParse (_params [2], out n) || n <= 0) { 50 SdtdConsole.Instance.Output ("Amount is not an integer or not greater than zero."); 51 return; 52 } 53 54 int quality = Constants.cItemMaxQuality; 55 56 if (_params.Count == 4) { 57 if (!int.TryParse (_params [3], out quality) || quality <= 0) { 58 SdtdConsole.Instance.Output ("Quality is not an integer or not greater than zero."); 31 59 return; 32 60 } 61 } 33 62 34 ClientInfo ci = ConsoleHelper.ParseParamIdOrName (_params [0]); 63 if (ItemClass.list [iv.type].HasSubItems) { 64 for (int i = 0; i < iv.Modifications.Length; i++) { 65 ItemValue tmp = iv.Modifications [i]; 66 tmp.Quality = quality; 67 iv.Modifications [i] = tmp; 68 } 69 } else if (ItemClass.list [iv.type].HasQuality) { 70 iv.Quality = quality; 71 } 35 72 36 if (ci == null) { 37 SdtdConsole.Instance.Output ("Playername or entity id not found."); 38 return; 39 } 73 EntityPlayer p = GameManager.Instance.World.Players.dict [ci.entityId]; 40 74 41 ItemValue iv = ItemClass.GetItem (_params [1], true); 42 if (iv.type == ItemValue.None.type) { 43 SdtdConsole.Instance.Output ("Item not found."); 44 return; 45 } 75 ItemStack invField = new ItemStack (iv, n); 46 76 47 iv = new ItemValue (iv.type, true);77 GameManager.Instance.ItemDropServer (invField, p.GetPosition (), Vector3.zero); 48 78 49 int n; 50 if (!int.TryParse (_params [2], out n) || n <= 0) { 51 SdtdConsole.Instance.Output ("Amount is not an integer or not greater than zero."); 52 return; 53 } 54 55 int quality = Constants.cItemMaxQuality; 56 57 if (_params.Count == 4) { 58 if (!int.TryParse (_params [3], out quality) || quality <= 0) { 59 SdtdConsole.Instance.Output ("Quality is not an integer or not greater than zero."); 60 return; 61 } 62 } 63 64 if (ItemClass.list [iv.type].HasSubItems) { 65 for (int i = 0; i < iv.Modifications.Length; i++) { 66 ItemValue tmp = iv.Modifications [i]; 67 tmp.Quality = quality; 68 iv.Modifications [i] = tmp; 69 } 70 } else if (ItemClass.list [iv.type].HasQuality) { 71 iv.Quality = quality; 72 } 73 74 EntityPlayer p = GameManager.Instance.World.Players.dict [ci.entityId]; 75 76 ItemStack invField = new ItemStack (iv, n); 77 78 GameManager.Instance.ItemDropServer (invField, p.GetPosition (), Vector3.zero); 79 80 SdtdConsole.Instance.Output ("Dropped item"); 81 } catch (Exception e) { 82 Log.Out ("Error in Give.Run: " + e); 83 } 79 SdtdConsole.Instance.Output ("Dropped item"); 84 80 } 85 81 } -
binary-improvements/AllocsCommands/Commands/ListItems.cs
r325 r359 22 22 23 23 public override void Execute (List<string> _params, CommandSenderInfo _senderInfo) { 24 try { 25 if (_params.Count != 1 || _params [0].Length == 0) { 26 SdtdConsole.Instance.Output ("Usage: listitems <searchString>"); 27 return; 24 if (_params.Count != 1 || _params [0].Length == 0) { 25 SdtdConsole.Instance.Output ("Usage: listitems <searchString>"); 26 return; 27 } 28 29 int count = ItemClass.ItemNames.Count; 30 bool showAll = _params [0].Trim ().Equals ("*"); 31 32 int listed = 0; 33 for (int i = 0; i < count; i++) { 34 string s = ItemClass.ItemNames [i]; 35 if (showAll || s.IndexOf (_params [0], StringComparison.OrdinalIgnoreCase) >= 0) { 36 SdtdConsole.Instance.Output (" " + s); 37 listed++; 28 38 } 39 } 29 40 30 int count = ItemClass.ItemNames.Count; 31 bool showAll = _params [0].Trim ().Equals ("*"); 32 33 int listed = 0; 34 for (int i = 0; i < count; i++) { 35 string s = ItemClass.ItemNames [i]; 36 if (showAll || s.IndexOf (_params [0], StringComparison.OrdinalIgnoreCase) >= 0) { 37 SdtdConsole.Instance.Output (" " + s); 38 listed++; 39 } 40 } 41 42 SdtdConsole.Instance.Output ("Listed " + listed + " matching items."); 43 } catch (Exception e) { 44 Log.Out ("Error in ListItems.Run: " + e); 45 } 41 SdtdConsole.Instance.Output ("Listed " + listed + " matching items."); 46 42 } 47 43 } -
binary-improvements/AllocsCommands/Commands/ListKnownPlayers.cs
r332 r359 26 26 27 27 public override void Execute (List<string> _params, CommandSenderInfo _senderInfo) { 28 try { 29 AdminTools admTools = GameManager.Instance.adminTools; 28 AdminTools admTools = GameManager.Instance.adminTools; 30 29 31 32 33 34 30 bool onlineOnly = false; 31 bool notBannedOnly = false; 32 string nameFilter = string.Empty; 33 bool isSteamId = false; 35 34 36 if (_params.Count == 1) { 37 long steamid; 38 if (_params [0].EqualsCaseInsensitive ("-online")) { 39 onlineOnly = true; 40 } else if (_params [0].EqualsCaseInsensitive ("-notbanned")) { 41 notBannedOnly = true; 42 } else if (_params [0].Length == 17 && long.TryParse (_params [0], out steamid)) { 43 isSteamId = true; 44 } else { 45 nameFilter = _params [0]; 35 if (_params.Count == 1) { 36 long steamid; 37 if (_params [0].EqualsCaseInsensitive ("-online")) { 38 onlineOnly = true; 39 } else if (_params [0].EqualsCaseInsensitive ("-notbanned")) { 40 notBannedOnly = true; 41 } else if (_params [0].Length == 17 && long.TryParse (_params [0], out steamid)) { 42 isSteamId = true; 43 } else { 44 nameFilter = _params [0]; 45 } 46 } 47 48 if (isSteamId) { 49 Player p = PersistentContainer.Instance.Players [_params [0], false]; 50 51 if (p != null) { 52 SdtdConsole.Instance.Output (string.Format ( 53 "{0}. {1}, id={2}, steamid={3}, online={4}, ip={5}, playtime={6} m, seen={7}", 54 0, p.Name, p.EntityID, _params [0], p.IsOnline, p.IP, 55 p.TotalPlayTime / 60, 56 p.LastOnline.ToString ("yyyy-MM-dd HH:mm")) 57 ); 58 } else { 59 SdtdConsole.Instance.Output (string.Format ("SteamID {0} unknown!", _params [0])); 60 } 61 } else { 62 int num = 0; 63 foreach (KeyValuePair<string, Player> kvp in PersistentContainer.Instance.Players.Dict) { 64 Player p = kvp.Value; 65 66 if ( 67 (!onlineOnly || p.IsOnline) 68 && (!notBannedOnly || !admTools.IsBanned (kvp.Key)) 69 && (nameFilter.Length == 0 || p.Name.ContainsCaseInsensitive (nameFilter)) 70 ) { 71 SdtdConsole.Instance.Output (string.Format ( 72 "{0}. {1}, id={2}, steamid={3}, online={4}, ip={5}, playtime={6} m, seen={7}", 73 ++num, p.Name, p.EntityID, kvp.Key, p.IsOnline, p.IP, 74 p.TotalPlayTime / 60, 75 p.LastOnline.ToString ("yyyy-MM-dd HH:mm")) 76 ); 46 77 } 47 78 } 48 79 49 if (isSteamId) { 50 Player p = PersistentContainer.Instance.Players [_params [0], false]; 51 52 if (p != null) { 53 SdtdConsole.Instance.Output (string.Format ( 54 "{0}. {1}, id={2}, steamid={3}, online={4}, ip={5}, playtime={6} m, seen={7}", 55 0, p.Name, p.EntityID, _params [0], p.IsOnline, p.IP, 56 p.TotalPlayTime / 60, 57 p.LastOnline.ToString ("yyyy-MM-dd HH:mm")) 58 ); 59 } else { 60 SdtdConsole.Instance.Output (string.Format ("SteamID {0} unknown!", _params [0])); 61 } 62 } else { 63 int num = 0; 64 foreach (KeyValuePair<string, Player> kvp in PersistentContainer.Instance.Players.Dict) { 65 Player p = kvp.Value; 66 67 if ( 68 (!onlineOnly || p.IsOnline) 69 && (!notBannedOnly || !admTools.IsBanned (kvp.Key)) 70 && (nameFilter.Length == 0 || p.Name.ContainsCaseInsensitive (nameFilter)) 71 ) { 72 SdtdConsole.Instance.Output (string.Format ( 73 "{0}. {1}, id={2}, steamid={3}, online={4}, ip={5}, playtime={6} m, seen={7}", 74 ++num, p.Name, p.EntityID, kvp.Key, p.IsOnline, p.IP, 75 p.TotalPlayTime / 60, 76 p.LastOnline.ToString ("yyyy-MM-dd HH:mm")) 77 ); 78 } 79 } 80 81 SdtdConsole.Instance.Output ("Total of " + PersistentContainer.Instance.Players.Count + " known"); 82 } 83 } catch (Exception e) { 84 Log.Out ("Error in ListKnownPlayers.Run: " + e); 80 SdtdConsole.Instance.Output ("Total of " + PersistentContainer.Instance.Players.Count + " known"); 85 81 } 86 82 } -
binary-improvements/AllocsCommands/Commands/ListLandProtection.cs
r326 r359 25 25 26 26 public override void Execute (List<string> _params, CommandSenderInfo _senderInfo) { 27 try { 28 if (_senderInfo.RemoteClientInfo != null) { 29 if (_params.Count >= 1 && _params [0].EqualsCaseInsensitive ("nearby")) { 30 _params.Add (_senderInfo.RemoteClientInfo.playerId); 31 } 27 if (_senderInfo.RemoteClientInfo != null) { 28 if (_params.Count >= 1 && _params [0].EqualsCaseInsensitive ("nearby")) { 29 _params.Add (_senderInfo.RemoteClientInfo.playerId); 32 30 } 31 } 33 32 34 35 33 World w = GameManager.Instance.World; 34 PersistentPlayerList ppl = GameManager.Instance.GetPersistentPlayerList (); 36 35 37 38 39 40 41 42 36 bool summaryOnly = false; 37 string steamIdFilter = string.Empty; 38 Vector3i closeTo = default (Vector3i); 39 bool onlyCloseToPlayer = false; 40 int closeToDistance = 32; 41 bool parseableOutput = false; 43 42 44 45 46 47 43 if (_params.Contains ("parseable")) { 44 parseableOutput = true; 45 _params.Remove ("parseable"); 46 } 48 47 49 50 48 if (_params.Count == 1) { 49 long tempLong; 51 50 52 if (_params [0].EqualsCaseInsensitive ("summary")) { 53 summaryOnly = true; 54 } else if (_params [0].Length == 17 && long.TryParse (_params [0], out tempLong)) { 55 steamIdFilter = _params [0]; 51 if (_params [0].EqualsCaseInsensitive ("summary")) { 52 summaryOnly = true; 53 } else if (_params [0].Length == 17 && long.TryParse (_params [0], out tempLong)) { 54 steamIdFilter = _params [0]; 55 } else { 56 ClientInfo ci = ConsoleHelper.ParseParamIdOrName (_params [0]); 57 if (ci != null) { 58 steamIdFilter = ci.playerId; 56 59 } else { 57 ClientInfo ci = ConsoleHelper.ParseParamIdOrName (_params [0]); 58 if (ci != null) { 59 steamIdFilter = ci.playerId; 60 } else { 61 SdtdConsole.Instance.Output ("Player name or entity id \"" + _params [0] + "\" not found."); 62 return; 63 } 64 } 65 } else if (_params.Count >= 2) { 66 if (_params [0].EqualsCaseInsensitive ("nearby")) { 67 try { 68 if (_params.Count == 3) { 69 if (!int.TryParse (_params [1], out closeToDistance)) { 70 SdtdConsole.Instance.Output ("Given length is not an integer!"); 71 return; 72 } 73 74 closeToDistance /= 2; 75 } 76 77 ClientInfo ci = ConsoleHelper.ParseParamSteamIdOnline (_params [_params.Count - 1]); 78 EntityPlayer ep = w.Players.dict [ci.entityId]; 79 closeTo = new Vector3i (ep.GetPosition ()); 80 onlyCloseToPlayer = true; 81 } catch (Exception e) { 82 SdtdConsole.Instance.Output ("Error getting current player's position"); 83 Log.Out ("Error in ListLandProtection.Run: " + e); 84 return; 85 } 86 } else { 87 SdtdConsole.Instance.Output ("Illegal parameter list"); 60 SdtdConsole.Instance.Output ("Player name or entity id \"" + _params [0] + "\" not found."); 88 61 return; 89 62 } 90 63 } 64 } else if (_params.Count >= 2) { 65 if (_params [0].EqualsCaseInsensitive ("nearby")) { 66 try { 67 if (_params.Count == 3) { 68 if (!int.TryParse (_params [1], out closeToDistance)) { 69 SdtdConsole.Instance.Output ("Given length is not an integer!"); 70 return; 71 } 72 73 closeToDistance /= 2; 74 } 75 76 ClientInfo ci = ConsoleHelper.ParseParamSteamIdOnline (_params [_params.Count - 1]); 77 EntityPlayer ep = w.Players.dict [ci.entityId]; 78 closeTo = new Vector3i (ep.GetPosition ()); 79 onlyCloseToPlayer = true; 80 } catch (Exception e) { 81 SdtdConsole.Instance.Output ("Error getting current player's position"); 82 Log.Out ("Error in ListLandProtection.Run: " + e); 83 return; 84 } 85 } else { 86 SdtdConsole.Instance.Output ("Illegal parameter list"); 87 return; 88 } 89 } 91 90 92 91 93 94 95 96 92 LandClaimList.OwnerFilter[] ownerFilters = null; 93 if (!string.IsNullOrEmpty (steamIdFilter)) { 94 ownerFilters = new[] {LandClaimList.SteamIdFilter (steamIdFilter)}; 95 } 97 96 98 99 100 101 97 LandClaimList.PositionFilter[] posFilters = null; 98 if (onlyCloseToPlayer) { 99 posFilters = new[] {LandClaimList.CloseToFilter2dRect (closeTo, closeToDistance)}; 100 } 102 101 103 102 Dictionary<Player, List<Vector3i>> claims = LandClaimList.GetLandClaims (ownerFilters, posFilters); 104 103 105 foreach (KeyValuePair<Player, List<Vector3i>> kvp in claims) { 106 SdtdConsole.Instance.Output (string.Format ( 107 "Player \"{0} ({1})\" owns {4} keystones (protected: {2}, current hardness multiplier: {3})", 108 kvp.Key.Name, 109 kvp.Key.SteamID, 110 kvp.Key.LandProtectionActive, 111 kvp.Key.LandProtectionMultiplier, 112 kvp.Value.Count)); 113 if (!summaryOnly) { 114 foreach (Vector3i v in kvp.Value) { 115 if (parseableOutput) { 116 SdtdConsole.Instance.Output ("LandProtectionOf: id=" + kvp.Key.SteamID + 117 ", playerName=" + kvp.Key.Name + ", location=" + v); 118 } else { 119 SdtdConsole.Instance.Output (" (" + v + ")"); 120 } 104 foreach (KeyValuePair<Player, List<Vector3i>> kvp in claims) { 105 SdtdConsole.Instance.Output (string.Format ( 106 "Player \"{0} ({1})\" owns {4} keystones (protected: {2}, current hardness multiplier: {3})", 107 kvp.Key.Name, 108 kvp.Key.SteamID, 109 kvp.Key.LandProtectionActive, 110 kvp.Key.LandProtectionMultiplier, 111 kvp.Value.Count)); 112 if (!summaryOnly) { 113 foreach (Vector3i v in kvp.Value) { 114 if (parseableOutput) { 115 SdtdConsole.Instance.Output ("LandProtectionOf: id=" + kvp.Key.SteamID + 116 ", playerName=" + kvp.Key.Name + ", location=" + v); 117 } else { 118 SdtdConsole.Instance.Output (" (" + v + ")"); 121 119 } 122 120 } 123 121 } 122 } 124 123 125 if (string.IsNullOrEmpty (steamIdFilter)) { 126 SdtdConsole.Instance.Output ("Total of " + ppl.m_lpBlockMap.Count + " keystones in the game"); 127 } 128 } catch (Exception e) { 129 Log.Out ("Error in ListLandProtection.Run: " + e); 124 if (string.IsNullOrEmpty (steamIdFilter)) { 125 SdtdConsole.Instance.Output ("Total of " + ppl.m_lpBlockMap.Count + " keystones in the game"); 130 126 } 131 127 } -
binary-improvements/AllocsCommands/Commands/RemoveLandProtection.cs
r326 r359 58 58 59 59 private void removeByPosition (List<string> _coords) { 60 try { 61 int x, y, z; 62 int.TryParse (_coords [0], out x); 63 int.TryParse (_coords [1], out y); 64 int.TryParse (_coords [2], out z); 60 int x, y, z; 61 int.TryParse (_coords [0], out x); 62 int.TryParse (_coords [1], out y); 63 int.TryParse (_coords [2], out z); 65 64 66 67 68 69 65 if (x == int.MinValue || y == int.MinValue || z == int.MinValue) { 66 SdtdConsole.Instance.Output ("At least one of the given coordinates is not a valid integer"); 67 return; 68 } 70 69 71 70 Vector3i v = new Vector3i (x, y, z); 72 71 73 72 PersistentPlayerList ppl = GameManager.Instance.GetPersistentPlayerList (); 74 73 75 76 77 78 79 80 74 Dictionary<Vector3i, PersistentPlayerData> d = ppl.m_lpBlockMap; 75 if (d == null || !d.ContainsKey (v)) { 76 SdtdConsole.Instance.Output ( 77 "No land protection block at the given position or not a valid position. Use \"listlandprotection\" to get a list of keystones."); 78 return; 79 } 81 80 82 81 BlockChangeInfo bci = new BlockChangeInfo (v, new BlockValue (0), true, false); 83 82 84 85 83 List<BlockChangeInfo> changes = new List<BlockChangeInfo> (); 84 changes.Add (bci); 86 85 87 86 GameManager.Instance.SetBlocksRPC (changes); 88 87 89 SdtdConsole.Instance.Output ("Land protection block at (" + v + ") removed"); 90 } catch (Exception e) { 91 Log.Out ("Error in RemoveLandProtection.removeByPosition: " + e); 92 } 88 SdtdConsole.Instance.Output ("Land protection block at (" + v + ") removed"); 93 89 } 94 90 -
binary-improvements/AllocsCommands/Commands/SayToPlayer.cs
r325 r359 35 35 36 36 public override void Execute (List<string> _params, CommandSenderInfo _senderInfo) { 37 try { 38 if (_senderInfo.RemoteClientInfo != null) { 39 RunInternal (_senderInfo.RemoteClientInfo, _params); 40 } else { 41 RunInternal (null, _params); 42 } 43 } catch (Exception e) { 44 Log.Out ("Error in SayToPlayer.Run: " + e); 37 if (_senderInfo.RemoteClientInfo != null) { 38 RunInternal (_senderInfo.RemoteClientInfo, _params); 39 } else { 40 RunInternal (null, _params); 45 41 } 46 42 } -
binary-improvements/AllocsCommands/Commands/ShowInventory.cs
r325 r359 25 25 26 26 public override void Execute (List<string> _params, CommandSenderInfo _senderInfo) { 27 try { 28 if (_params.Count < 1) { 29 SdtdConsole.Instance.Output ("Usage: showinventory <steamid|playername|entityid> [tag]"); 30 return; 31 } 27 if (_params.Count < 1) { 28 SdtdConsole.Instance.Output ("Usage: showinventory <steamid|playername|entityid> [tag]"); 29 return; 30 } 32 31 33 34 35 36 37 38 32 string steamid = PersistentContainer.Instance.Players.GetSteamID (_params [0], true); 33 if (steamid == null) { 34 SdtdConsole.Instance.Output ( 35 "Playername or entity/steamid id not found or no inventory saved (first saved after a player has been online for 30s)."); 36 return; 37 } 39 38 40 41 42 43 39 string tag = null; 40 if (_params.Count > 1 && _params [1].Length > 0) { 41 tag = _params [1]; 42 } 44 43 45 46 44 Player p = PersistentContainer.Instance.Players [steamid, false]; 45 PersistentData.Inventory inv = p.Inventory; 47 46 48 49 50 47 if (tag == null) { 48 SdtdConsole.Instance.Output ("Belt of player " + p.Name + ":"); 49 } 51 50 52 53 54 55 51 PrintInv (inv.belt, p.EntityID, "belt", tag); 52 if (tag == null) { 53 SdtdConsole.Instance.Output (string.Empty); 54 } 56 55 57 58 59 56 if (tag == null) { 57 SdtdConsole.Instance.Output ("Bagpack of player " + p.Name + ":"); 58 } 60 59 61 62 63 64 60 PrintInv (inv.bag, p.EntityID, "backpack", tag); 61 if (tag == null) { 62 SdtdConsole.Instance.Output (string.Empty); 63 } 65 64 66 67 68 65 if (tag == null) { 66 SdtdConsole.Instance.Output ("Equipment of player " + p.Name + ":"); 67 } 69 68 70 69 PrintEquipment (inv.equipment, p.EntityID, "equipment", tag); 71 70 72 if (tag != null) { 73 SdtdConsole.Instance.Output ("tracker_item id=" + p.EntityID + ", tag=" + tag + 74 ", SHOWINVENTORY DONE"); 75 } 76 } catch (Exception e) { 77 Log.Out ("Error in ShowInventory.Run: " + e); 71 if (tag != null) { 72 SdtdConsole.Instance.Output ("tracker_item id=" + p.EntityID + ", tag=" + tag + 73 ", SHOWINVENTORY DONE"); 78 74 } 79 75 } -
binary-improvements/MapRendering/Commands/EnableOpenIDDebug.cs
r325 r359 14 14 15 15 public override void Execute (List<string> _params, CommandSenderInfo _senderInfo) { 16 try { 17 if (_params.Count != 1) { 18 SdtdConsole.Instance.Output ("Current state: " + OpenID.debugOpenId); 19 return; 20 } 16 if (_params.Count != 1) { 17 SdtdConsole.Instance.Output ("Current state: " + OpenID.debugOpenId); 18 return; 19 } 21 20 22 OpenID.debugOpenId = _params [0].Equals ("1"); 23 SdtdConsole.Instance.Output ("Set OpenID debugging to " + _params [0].Equals ("1")); 24 } catch (Exception e) { 25 Log.Out ("Error in EnableOpenIDDebug.Run: " + e); 26 } 21 OpenID.debugOpenId = _params [0].Equals ("1"); 22 SdtdConsole.Instance.Output ("Set OpenID debugging to " + _params [0].Equals ("1")); 27 23 } 28 24 } -
binary-improvements/MapRendering/Commands/EnableRendering.cs
r325 r359 13 13 14 14 public override void Execute (List<string> _params, CommandSenderInfo _senderInfo) { 15 try { 16 if (_params.Count != 1) { 17 SdtdConsole.Instance.Output ("Current state: " + MapRendering.MapRendering.renderingEnabled); 18 return; 19 } 15 if (_params.Count != 1) { 16 SdtdConsole.Instance.Output ("Current state: " + MapRendering.MapRendering.renderingEnabled); 17 return; 18 } 20 19 21 MapRendering.MapRendering.renderingEnabled = _params [0].Equals ("1"); 22 SdtdConsole.Instance.Output ("Set live map rendering to " + _params [0].Equals ("1")); 23 } catch (Exception e) { 24 Log.Out ("Error in EnableRendering.Run: " + e); 25 } 20 MapRendering.MapRendering.renderingEnabled = _params [0].Equals ("1"); 21 SdtdConsole.Instance.Output ("Set live map rendering to " + _params [0].Equals ("1")); 26 22 } 27 23 } -
binary-improvements/MapRendering/Commands/ReloadWebPermissions.cs
r325 r359 14 14 15 15 public override void Execute (List<string> _params, CommandSenderInfo _senderInfo) { 16 try { 17 WebPermissions.Instance.Load (); 18 SdtdConsole.Instance.Output ("Web permissions file reloaded"); 19 } catch (Exception e) { 20 Log.Out ("Error in ReloadWebPermissions.Run: " + e); 21 } 16 WebPermissions.Instance.Load (); 17 SdtdConsole.Instance.Output ("Web permissions file reloaded"); 22 18 } 23 19 } -
binary-improvements/MapRendering/Commands/RenderMap.cs
r325 r359 13 13 14 14 public override void Execute (List<string> _params, CommandSenderInfo _senderInfo) { 15 try { 16 MapRendering.MapRendering.Instance.RenderFullMap (); 15 MapRendering.MapRendering.Instance.RenderFullMap (); 17 16 18 SdtdConsole.Instance.Output ("Render map done"); 19 } catch (Exception e) { 20 Log.Out ("Error in RenderMap.Run: " + e); 21 } 17 SdtdConsole.Instance.Output ("Render map done"); 22 18 } 23 19 } -
binary-improvements/MapRendering/Commands/webstat.cs
r325 r359 14 14 15 15 public override void Execute (List<string> _params, CommandSenderInfo _senderInfo) { 16 try { 17 int curHandlers = Web.currentHandlers; 18 int totalHandlers = Web.handlingCount; 19 long totalTime = Web.totalHandlingTime; 20 SdtdConsole.Instance.Output ("Current Web handlers: " + curHandlers + " - total: " + totalHandlers); 21 SdtdConsole.Instance.Output (" - Total time: " + totalTime + " µs - average time: " + 22 totalTime / totalHandlers + " µs"); 16 int curHandlers = Web.currentHandlers; 17 int totalHandlers = Web.handlingCount; 18 long totalTime = Web.totalHandlingTime; 19 SdtdConsole.Instance.Output ("Current Web handlers: " + curHandlers + " - total: " + totalHandlers); 20 SdtdConsole.Instance.Output (" - Total time: " + totalTime + " µs - average time: " + 21 totalTime / totalHandlers + " µs"); 23 22 24 curHandlers = WebCommandResult.currentHandlers; 25 totalHandlers = WebCommandResult.handlingCount; 26 totalTime = WebCommandResult.totalHandlingTime; 27 SdtdConsole.Instance.Output ("Current Web command handlers: " + curHandlers + " - total: " + 28 totalHandlers); 29 SdtdConsole.Instance.Output (" - Total time: " + totalTime + " µs" + 30 (totalHandlers > 0 31 ? " - average time: " + totalTime / totalHandlers + " µs" 32 : "")); 33 } catch (Exception e) { 34 Log.Out ("Error in webstat.Run: " + e); 35 } 23 curHandlers = WebCommandResult.currentHandlers; 24 totalHandlers = WebCommandResult.handlingCount; 25 totalTime = WebCommandResult.totalHandlingTime; 26 SdtdConsole.Instance.Output ("Current Web command handlers: " + curHandlers + " - total: " + 27 totalHandlers); 28 SdtdConsole.Instance.Output (" - Total time: " + totalTime + " µs" + 29 (totalHandlers > 0 30 ? " - average time: " + totalTime / totalHandlers + " µs" 31 : "")); 36 32 } 37 33 }
Note:
See TracChangeset
for help on using the changeset viewer.