Changeset 279
- Timestamp:
- Jun 19, 2016, 1:52:31 PM (8 years ago)
- Location:
- binary-improvements
- Files:
-
- 134 added
- 1 deleted
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/7dtd-server-fixes.csproj
r273 r279 93 93 <Compile Include="src\LandClaimList.cs" /> 94 94 <Compile Include="src\PersistentData\Attributes.cs" /> 95 <Compile Include="src\JSON\JSONValue.cs" /> 95 96 </ItemGroup> 96 97 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> -
binary-improvements/7dtd-server-fixes/src/JSON/JSONBoolean.cs
r187 r279 3 3 namespace AllocsFixes.JSON 4 4 { 5 public class JSONBoolean : JSON Node5 public class JSONBoolean : JSONValue 6 6 { 7 7 private bool value; -
binary-improvements/7dtd-server-fixes/src/JSON/JSONNull.cs
r188 r279 3 3 namespace AllocsFixes.JSON 4 4 { 5 public class JSONNull : JSON Node5 public class JSONNull : JSONValue 6 6 { 7 7 public JSONNull () -
binary-improvements/7dtd-server-fixes/src/JSON/JSONNumber.cs
r187 r279 4 4 namespace AllocsFixes.JSON 5 5 { 6 public class JSONNumber : JSON Node6 public class JSONNumber : JSONValue 7 7 { 8 8 private double value; -
binary-improvements/7dtd-server-fixes/src/JSON/JSONString.cs
r187 r279 4 4 namespace AllocsFixes.JSON 5 5 { 6 public class JSONString : JSON Node6 public class JSONString : JSONValue 7 7 { 8 8 private string value; -
binary-improvements/7dtd-server-fixes/src/PersistentData/Player.cs
r276 r279 20 20 private int 21 21 lastPositionX, lastPositionY, lastPositionZ; 22 [OptionalField] 22 [OptionalField][Obsolete("experience no longer available, use level and expToNextLevel instead")] 23 23 private uint experience; 24 24 [OptionalField] … … 118 118 119 119 120 // Deprecated120 [Obsolete("Experience no longer available, use Level instead")] 121 121 public uint Experience { 122 122 get { -
binary-improvements/CoppisAdditions/CoppisAdditions.csproj
r273 r279 50 50 <Compile Include="src\Commands\Physics.cs" /> 51 51 <Compile Include="src\Commands\SpawnMultipleEntity.cs" /> 52 <Compile Include="src\Commands\SpawnScouts.cs" />53 52 <Compile Include="src\Commands\UnlockAll.cs" /> 54 <Compile Include="src\Commands\SpawnHorde.cs" />55 53 <Compile Include="src\API.cs" /> 56 54 <Compile Include="src\ChatFilter.cs" /> … … 58 56 <Compile Include="src\Commands\PlayerChatMaxLength.cs" /> 59 57 <Compile Include="src\Commands\TeleportPlayerHome.cs" /> 60 <Compile Include="src\Commands\ToogleChatCommandHide.cs" />61 58 <Compile Include="src\Commands\SayToPlayer2.cs" /> 59 <Compile Include="src\Commands\ToggleChatCommandHide.cs" /> 60 <Compile Include="src\Commands\SpawnHorde.cs" /> 61 <Compile Include="src\Commands\SpawnScouts.cs" /> 62 62 </ItemGroup> 63 63 <ItemGroup> -
binary-improvements/CoppisAdditions/src/Commands/GiveXP.cs
r273 r279 9 9 public override string GetDescription () 10 10 { 11 return "give an amount XP to a player (entity id or name)";11 return "give XP to the skill of a player"; 12 12 } 13 13 14 14 public override string GetHelp () 15 15 { 16 return "Give XP to a player\n" +16 return "Give XP to the skill of a player\n" + 17 17 "Usage:\n" + 18 18 " givexp <name / entity id> <amount xp> <skill name>\n" + … … 54 54 return; 55 55 } 56 EntityPlayer ep = GameManager.Instance.World.Players.dict [ci.entityId]; 57 GameManager.Instance.AddExpServer (ci.entityId, skill.Id, xp); 56 57 ci.SendPackage (new NetPackageConsoleCmdClient ("giveselfskillxp " + skillName + " " + xp, true)); 58 58 59 SdtdConsole.Instance.Output (xp + " xp was given on skill " + skillName + " to player " + ci.playerName); 59 60 } catch (Exception e) { -
binary-improvements/CoppisAdditions/src/Commands/SpawnScouts.cs
r273 r279 24 24 public override string[] GetCommands () 25 25 { 26 return new string[] { "s pawnscouts", "ss" };26 return new string[] { "ss" }; 27 27 } 28 28 -
binary-improvements/MapRendering/Commands/webstat.cs
r230 r279 19 19 { 20 20 try { 21 SdtdConsole.Instance.Output ("Current handlers: " + AllocsFixes.NetConnections.Servers.Web.Web.currentHandlers + " - total: " + AllocsFixes.NetConnections.Servers.Web.Web.handlingCount); 21 int curHandlers = AllocsFixes.NetConnections.Servers.Web.Web.currentHandlers; 22 int totalHandlers = AllocsFixes.NetConnections.Servers.Web.Web.handlingCount; 23 long totalTime = AllocsFixes.NetConnections.Servers.Web.Web.totalHandlingTime; 24 SdtdConsole.Instance.Output ("Current Web handlers: " + curHandlers + " - total: " + totalHandlers); 25 SdtdConsole.Instance.Output (" - Total time: " + totalTime + " µs - average time: " + (totalTime / totalHandlers) + " µs"); 26 27 curHandlers = AllocsFixes.NetConnections.Servers.Web.WebCommandResult.currentHandlers; 28 totalHandlers = AllocsFixes.NetConnections.Servers.Web.WebCommandResult.handlingCount; 29 totalTime = AllocsFixes.NetConnections.Servers.Web.WebCommandResult.totalHandlingTime; 30 SdtdConsole.Instance.Output ("Current Web command handlers: " + curHandlers + " - total: " + totalHandlers); 31 SdtdConsole.Instance.Output (" - Total time: " + totalTime + " µs" + (totalHandlers > 0 ? " - average time: " + (totalTime / totalHandlers) + " µs" : "")); 22 32 } catch (Exception e) { 23 33 Log.Out ("Error in webstat.Run: " + e); -
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 } -
binary-improvements/MapRendering/Web/API/GetStats.cs
r251 r279 26 26 WriteJSON (resp, result); 27 27 } 28 29 public override int DefaultPermissionLevel () { 30 return 2000; 31 } 28 32 } 29 33 } -
binary-improvements/MapRendering/Web/API/GetWebUIUpdates.cs
r251 r279 31 31 WriteJSON (resp, result); 32 32 } 33 34 public override int DefaultPermissionLevel () { 35 return 2000; 36 } 33 37 } 34 38 } -
binary-improvements/MapRendering/Web/API/WebAPI.cs
r244 r279 17 17 18 18 public abstract void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnection user, int permissionLevel); 19 20 public virtual int DefaultPermissionLevel () { 21 return 0; 22 } 19 23 } 20 24 } -
binary-improvements/MapRendering/Web/Handlers/ApiHandler.cs
r251 r279 40 40 private void addApi (string _apiName, WebAPI _api) { 41 41 apis.Add (_apiName, _api); 42 WebPermissions.Instance.AddKnownModule ("webapi." + _apiName );42 WebPermissions.Instance.AddKnownModule ("webapi." + _apiName, _api.DefaultPermissionLevel ()); 43 43 } 44 44 -
binary-improvements/MapRendering/Web/Handlers/PathHandler.cs
r244 r279 11 11 } 12 12 13 protected PathHandler (string _moduleName ) {13 protected PathHandler (string _moduleName, int _defaultPermissionLevel = 0) { 14 14 this.moduleName = _moduleName; 15 WebPermissions.Instance.AddKnownModule (_moduleName );15 WebPermissions.Instance.AddKnownModule (_moduleName, _defaultPermissionLevel); 16 16 } 17 17 -
binary-improvements/MapRendering/Web/Web.cs
r250 r279 20 20 public static int handlingCount = 0; 21 21 public static int currentHandlers = 0; 22 public static long totalHandlingTime = 0; 22 23 private string dataFolder; 23 24 private bool useStaticCache = false; … … 131 132 Interlocked.Increment (ref handlingCount); 132 133 Interlocked.Increment (ref currentHandlers); 134 MicroStopwatch msw = new MicroStopwatch (); 133 135 HttpListenerContext ctx = _listener.EndGetContext (result); 134 136 _listener.BeginGetContext (new AsyncCallback (HandleRequest), _listener); … … 136 138 HttpListenerRequest request = ctx.Request; 137 139 HttpListenerResponse response = ctx.Response; 140 response.SendChunked = false; 138 141 139 142 response.ProtocolVersion = new Version ("1.1"); … … 187 190 Log.Out ("Error in Web.HandleRequest(): " + e); 188 191 } finally { 189 if (ctx != null ) {192 if (ctx != null && !ctx.Response.SendChunked) { 190 193 ctx.Response.Close (); 191 194 } 195 msw.Stop (); 196 totalHandlingTime += msw.ElapsedMicroseconds; 197 Log.Out ("Web.HandleRequest(): Took {0} µs", msw.ElapsedMicroseconds); 192 198 Interlocked.Decrement (ref currentHandlers); 193 199 } -
binary-improvements/MapRendering/Web/WebPermissions.cs
r253 r279 96 96 } 97 97 98 public void AddKnownModule (string _module ) {98 public void AddKnownModule (string _module, int _defaultPermission) { 99 99 if (!string.IsNullOrEmpty (_module)) { 100 100 lock (this) { 101 101 if (!IsKnownModule( _module)) { 102 knownModules.Add (_module, new WebModulePermission (_module, 0));102 knownModules.Add (_module, new WebModulePermission (_module, _defaultPermission)); 103 103 } 104 if (_defaultPermission > 0 && !modules.ContainsKey (_module.ToLower ())) { 105 AddModulePermission (_module, _defaultPermission); 106 } 104 107 } 105 108 } -
binary-improvements/MapRendering/WebAndMapRendering.csproj
r277 r279 86 86 <Compile Include="Web\API\GetWebUIUpdates.cs" /> 87 87 <Compile Include="Web\API\GetServerInfo.cs" /> 88 <Compile Include="Web\API\GetPlayerList.cs" /> 89 <Compile Include="Web\WebCommandResult.cs" /> 90 <Compile Include="Web\API\GetAllowedCommands.cs" /> 88 91 </ItemGroup> 89 92 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> -
binary-improvements/webserver/css/style.css
r274 r279 6 6 margin: 0; 7 7 padding: 0; 8 background-image: url(' /static/img/background.jpg');8 background-image: url('../img/background.jpg'); 9 9 background-repeat: no-repeat; 10 10 background-attachment: fixed; … … 415 415 416 416 417 418 419 /*======================================== 420 - Player list 421 */ 422 423 #tab_players { 424 padding: 10px; 425 padding-left: 20px; 426 } 427 428 .adminplayers .players_tablesorter thead .tablesorter-header { 429 background-image: url('../js/tablesorter/css/images/ice-unsorted.gif'); 430 background-position: center right; 431 background-repeat: no-repeat; 432 font-weight: bold; 433 } 434 435 .adminplayers .players_tablesorter thead .tablesorter-headerDesc { 436 background-image: url('../js/tablesorter/css/images/ice-desc.gif'); 437 } 438 439 .adminplayers .players_tablesorter thead .tablesorter-headerAsc { 440 background-image: url('../js/tablesorter/css/images/ice-asc.gif'); 441 } 442 443 .tablesorter-pager .disabled { 444 opacity: .4; 445 filter: alpha(opacity=40); 446 cursor: default; 447 } 448 449 .tablesorter-pager img { 450 cursor: pointer; 451 } 452 -
binary-improvements/webserver/index.html
r274 r279 11 11 <link rel="stylesheet" href="jquery-ui/jquery-ui.min.css" type="text/css" /> 12 12 <script type="text/javascript" src="jquery-ui/jquery-ui.min.js"></script> 13 14 <!-- Tablesorter --> 15 <!-- <link rel="stylesheet" href="js/tablesorter/css/theme.default.min.css" type="text/css" /> --> 16 <script type="text/javascript" src="js/tablesorter/js/jquery.tablesorter.combined.min.js"></script> 17 <!-- <link rel="stylesheet" href="js/tablesorter/css/jquery.tablesorter.pager.min.css" type="text/css" /> --> 18 <script type="text/javascript" src="js/tablesorter/js/extras/jquery.tablesorter.pager.min.js"></script> 19 <script type="text/javascript" src="js/tablesorter/js/widgets/widget-formatter.min.js"></script> 13 20 14 21 <!-- Leaflet --> … … 47 54 <script type="text/javascript" src="js/map.js"></script> 48 55 <script type="text/javascript" src="js/log.js"></script> 56 <script type="text/javascript" src="js/players.js"></script> 49 57 50 58 <!-- Own stylesheet --> … … 73 81 <ul> 74 82 <li><a href="#tab_map" data-permission="web.map">Map</a></li> 83 <li><a href="#tab_players" data-permission="webapi.getplayerlist">Players</a></li> <!-- data-permission="web.players" --> 75 84 <li><a href="#tab_log" data-permission="webapi.getlog">Log <span id="newlogcount"></span></a></li> 76 85 </ul> … … 93 102 </div> 94 103 </div> 104 95 105 <div id="admincontent"> 96 106 <h1 id="nopermissionwarning" style="display:none">An error occured or you have not logged in. Try logging in with the Steam login in the lower left!</h1> 107 97 108 <div id="tab_map" class="adminmap"></div> 109 110 <div id="tab_players" class="adminplayers"> 111 <!-- Current AJAX url: <span id="players_url"></span> --> 112 <table class="players_tablesorter"> 113 <thead> 114 <tr class="players_columns"> 115 </tr> 116 </thead> 117 <tfoot> 118 <tr> 119 <td class="players_pager" colspan="5"> 120 <img src="js/tablesorter/css/images/first.png" class="players_first"/> 121 <img src="js/tablesorter/css/images/prev.png" class="players_prev"/> 122 <span class="players_pagedisplay"></span> <!-- this can be any element, including an input --> 123 <img src="js/tablesorter/css/images/next.png" class="players_next"/> 124 <img src="js/tablesorter/css/images/last.png" class="players_last"/> 125 <select class="players_pagesize"> 126 <option value="10">10</option> 127 <option value="25">25</option> 128 <option value="50">50</option> 129 <option value="100">100</option> 130 <option value="200">200</option> 131 </select> 132 </td> 133 </tr> 134 </tfoot> 135 <tbody> 136 </tbody> 137 </table> 138 </div> 139 140 98 141 <div id="tab_log" class="adminlog"> 99 142 <table> … … 107 150 <a id="markasread">Mark as read</a> 108 151 </div> 152 109 153 </div> 154 110 155 </div> 111 156 -
binary-improvements/webserver/js/permissions.js
r250 r279 27 27 StartLogModule (); 28 28 } 29 // permission? 30 StartPlayersModule (); 29 31 30 32 if (HasPermission ("webapi.getwebuiupdates")) {
Note:
See TracChangeset
for help on using the changeset viewer.