Changeset 299
- Timestamp:
- Dec 14, 2016, 7:47:05 PM (8 years ago)
- Location:
- binary-improvements
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/AllocsCommands/Commands/Give.cs
r290 r299 68 68 for (int i = 0; i < iv.Attachments.Length; i++) { 69 69 ItemValue att = iv.Attachments[i]; 70 if (att .HasQuality) {70 if (att != null && att.HasQuality) { 71 71 att.Quality = quality; 72 72 } … … 77 77 for (int i = 0; i < iv.Parts.Length; i++) { 78 78 ItemValue part = iv.Parts[i]; 79 if (part .HasQuality) {79 if (part != null && part.HasQuality) { 80 80 part.Quality = quality; 81 81 } -
binary-improvements/AllocsCommands/ModInfo.xml
r297 r299 5 5 <Description value="Additional commands for server operation" /> 6 6 <Author value="Christian 'Alloc' Illy" /> 7 <Version value="1 1" />7 <Version value="12" /> 8 8 <Website value="http://7dtd.illy.bz" /> 9 9 </ModInfo> -
binary-improvements/MapRendering/API.cs
r291 r299 16 16 } 17 17 18 public override void GameShutdown () { 19 AllocsFixes.MapRendering.MapRendering.Shutdown (); 20 } 21 18 22 public override void CalcChunkColorsDone (Chunk _chunk) { 19 23 AllocsFixes.MapRendering.MapRendering.RenderSingleChunk (_chunk); -
binary-improvements/MapRendering/MapRendering/MapRendering.cs
r269 r299 25 25 private MapRenderBlockBuffer[] zoomLevelBuffers; 26 26 private Dictionary<Vector2i, Color32[]> dirtyChunks = new Dictionary<Vector2i, Color32[]> (); 27 private System.Timers.Timer chunkSaveTimer = new System.Timers.Timer (500);28 27 private bool renderingFullMap = false; 29 28 public static bool renderingEnabled = true; 30 29 private MicroStopwatch msw = new MicroStopwatch (); 31 30 private AllocsFixes.FileCache.MapTileCache cache = new AllocsFixes.FileCache.MapTileCache (Constants.MAP_BLOCK_SIZE); 31 private float renderTimeout = float.MaxValue; 32 private Coroutine renderCoroutineRef; 32 33 33 34 public static AllocsFixes.FileCache.MapTileCache GetTileCache() { … … 51 52 } 52 53 53 chunkSaveTimer.AutoReset = false; 54 chunkSaveTimer.Elapsed += new System.Timers.ElapsedEventHandler (TimedRendering); 54 renderCoroutineRef = ThreadManager.StartCoroutine (renderCoroutine ()); 55 } 56 57 public static void Shutdown () 58 { 59 if (Instance.renderCoroutineRef != null) { 60 ThreadManager.StopCoroutine (Instance.renderCoroutineRef); 61 Instance.renderCoroutineRef = null; 62 } 55 63 } 56 64 … … 75 83 Instance.dirtyChunks [cPos2] = realColors; 76 84 //Log.Out ("Add Dirty: " + cPos2); 77 Instance.chunkSaveTimer.Stop ();78 Instance.chunkSaveTimer.Start ();79 85 } 80 86 } … … 177 183 } 178 184 179 private void TimedRendering (object source, System.Timers.ElapsedEventArgs e) 180 { 181 lock (lockObject) { 182 RenderDirtyChunks (); 183 if (dirtyChunks.Count > 0) 184 Instance.chunkSaveTimer.Start (); 185 private System.Collections.IEnumerator renderCoroutine () { 186 while (true) { 187 lock (lockObject) { 188 if (dirtyChunks.Count > 0 && renderTimeout == float.MaxValue) { 189 renderTimeout = Time.time + 0.5f; 190 } 191 if (Time.time > renderTimeout || dirtyChunks.Count > 200) { 192 RenderDirtyChunks (); 193 } 194 } 195 yield return new WaitForSeconds (0.2f); 185 196 } 186 197 } -
binary-improvements/MapRendering/ModInfo.xml
r297 r299 5 5 <Description value="Render the game map to image map tiles as it is uncovered" /> 6 6 <Author value="Christian 'Alloc' Illy" /> 7 <Version value="1 8" />7 <Version value="19" /> 8 8 <Website value="http://7dtd.illy.bz" /> 9 9 </ModInfo> -
binary-improvements/server-fixes.sln
r273 r299 8 8 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebAndMapRendering", "MapRendering\WebAndMapRendering.csproj", "{A1847B5F-7BFC-4BCD-94AA-A6C9FB7E7C54}" 9 9 EndProject 10 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CoppisAdditions", "CoppisAdditions\CoppisAdditions.csproj", "{771240CA-9B22-4AFE-A422-959E74B645B2}"11 EndProject12 10 Global 13 11 GlobalSection(SolutionConfigurationPlatforms) = preSolution … … 17 15 EndGlobalSection 18 16 GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 {771240CA-9B22-4AFE-A422-959E74B645B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU20 {771240CA-9B22-4AFE-A422-959E74B645B2}.Debug|Any CPU.Build.0 = Debug|Any CPU21 {771240CA-9B22-4AFE-A422-959E74B645B2}.Release_Version|Any CPU.ActiveCfg = Release|Any CPU22 {771240CA-9B22-4AFE-A422-959E74B645B2}.Release_Version|Any CPU.Build.0 = Release|Any CPU23 {771240CA-9B22-4AFE-A422-959E74B645B2}.Release|Any CPU.ActiveCfg = Release|Any CPU24 {771240CA-9B22-4AFE-A422-959E74B645B2}.Release|Any CPU.Build.0 = Release|Any CPU25 17 {81DA7F87-1A66-4920-AADA-6EAF1971F8D0}.Debug|Any CPU.ActiveCfg = Release|Any CPU 26 18 {81DA7F87-1A66-4920-AADA-6EAF1971F8D0}.Debug|Any CPU.Build.0 = Release|Any CPU -
binary-improvements/server-fixes.userprefs
r273 r299 1 1 <Properties> 2 2 <MonoDevelop.Ide.Workspace ActiveConfiguration="Release_Version" /> 3 <MonoDevelop.Ide.Workbench ActiveDocument=" CoppisAdditions/src/Commands/GiveXP.cs">3 <MonoDevelop.Ide.Workbench ActiveDocument="7dtd-server-fixes/src/ItemList.cs"> 4 4 <Files> 5 <File FileName="7dtd-server-fixes/ModInfo.xml" Line=" 20" Column="20" />6 <File FileName="AllocsCommands/ModInfo.xml" Line="2 0" Column="20" />7 <File FileName="MapRendering/ModInfo.xml" Line=" 21" Column="21" />5 <File FileName="7dtd-server-fixes/ModInfo.xml" Line="1" Column="1" /> 6 <File FileName="AllocsCommands/ModInfo.xml" Line="21" Column="21" /> 7 <File FileName="MapRendering/ModInfo.xml" Line="7" Column="7" /> 8 8 <File FileName="MapRendering/Web/Web.cs" Line="1" Column="1" /> 9 9 <File FileName="MapRendering/Web/API/ExecuteConsoleCommand.cs" Line="1" Column="1" /> 10 <File FileName="MapRendering/Web/API/GetWebUIUpdates.cs" Line="1" Column="1" />11 <File FileName="MapRendering/Web/Handlers/ApiHandler.cs" Line="1" Column="1" />12 10 <File FileName="MapRendering/Commands/WebTokens.cs" Line="1" Column="1" /> 13 11 <File FileName="MapRendering/API.cs" Line="1" Column="1" /> 14 <File FileName="AllocsCommands/Commands/RepairChunkDensity.cs" Line="78" Column="78" /> 15 <File FileName="7dtd-server-fixes/src/ChatHookExample.cs" Line="46" Column="46" /> 16 <File FileName="AllocsCommands/Commands/Give.cs" Line="26" Column="26" /> 12 <File FileName="MapRendering/Web/API/GetAllowedCommands.cs" Line="1" Column="1" /> 13 <File FileName="MapRendering/Web/API/GetPlayerList.cs" Line="1" Column="1" /> 14 <File FileName="AllocsCommands/Commands/ListKnownPlayers.cs" Line="1" Column="1" /> 15 <File FileName="MapRendering/Web/API/GetHostileLocation.cs" Line="1" Column="1" /> 16 <File FileName="7dtd-server-fixes/src/LiveData/Hostiles.cs" Line="1" Column="1" /> 17 <File FileName="7dtd-server-fixes/src/PersistentData/Player.cs" Line="1" Column="1" /> 18 <File FileName="MapRendering/Web/API/GetPlayersOnline.cs" Line="1" Column="1" /> 19 <File FileName="AllocsCommands/Commands/Give.cs" Line="1" Column="1" /> 20 <File FileName="MapRendering/Web/Handlers/ItemIconHandler.cs" Line="1" Column="1" /> 21 <File FileName="AllocsCommands/Commands/ShowInventory.cs" Line="107" Column="107" /> 17 22 <File FileName="7dtd-server-fixes/src/ItemList.cs" Line="17" Column="17" /> 18 <File FileName="7dtd-server-fixes/src/StateManager.cs" Line="23" Column="23" /> 19 <File FileName="CoppisAdditions/src/Commands/GiveXP.cs" Line="5" Column="5" /> 23 <File FileName="7dtd-server-fixes/src/API.cs" Line="17" Column="17" /> 20 24 </Files> 21 25 </MonoDevelop.Ide.Workbench> -
binary-improvements/webserver/css/style.css
r288 r299 135 135 .adminnavbar #serverstats #stats_time { 136 136 white-space: nowrap; 137 border-bottom: 1px dashed orange; 137 138 } 138 139 -
binary-improvements/webserver/js/stats.js
r251 r299 1 function DayName (days) { 2 var daynames = ["", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Bloodday"]; 3 return daynames[DayOfWeek(days)]; 4 } 5 6 function DayOfWeek (days) { 7 return days % 7 > 0 ? days % 7 : 7; 8 } 9 10 function GetDayStat (days) { 11 var daynames = ["", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Bloodday"]; 12 var dayOfWeek = days % 7 > 0 ? days % 7 : 7; 13 var result = ""; 14 // Show days til blood moon: 15 result += " (" + (7 - dayOfWeek) + " til blood moon)"; 16 // Show day of week (number): 17 result += " (DoW: " + dayOfWeek + ")"; 18 // Show day of week (name): 19 result += " (" + daynames[dayOfWeek] + ")"; 20 return result; 21 } 22 23 function FormatServerTime (gametime) { 24 var time = "Day " + gametime.days; 25 time += " (" + DayName (gametime.days) + "), "; 26 if (gametime.hours < 10) 27 time += "0"; 28 time += gametime.hours; 29 time += ":"; 30 if (gametime.minutes < 10) 31 time += "0"; 32 time += gametime.minutes; 33 return time; 34 } 35 36 function TimeTitle (gametime) { 37 var daynames = ["", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Bloodday"]; 38 var dayOfWeek = DayOfWeek (gametime.days); 39 var result = ""; 40 // Show days til blood moon: 41 result += (7 - dayOfWeek) + " days til blood moon\n"; 42 // Show day of week (number): 43 result += "Day of week: " + dayOfWeek + "\n"; 44 // Show day of week (name): 45 //result += daynames[dayOfWeek]; 46 return result; 47 } 48 1 49 function StartStatsModule () { 2 50 var updateGameTimeEvent = function() { 3 51 $.getJSON( "../api/getstats") 4 52 .done(function(data) { 5 var time = "Day " + data.gametime.days + ", "; 6 if (data.gametime.hours < 10) 7 time += "0"; 8 time += data.gametime.hours; 9 time += ":"; 10 if (data.gametime.minutes < 10) 11 time += "0"; 12 time += data.gametime.minutes; 53 var time = FormatServerTime (data.gametime); 13 54 14 55 $("#stats_time").html (time); 56 $("#stats_time").prop ("title", TimeTitle (data.gametime)); 15 57 $("#stats_players").html (data.players); 16 58 $("#stats_hostiles").html (data.hostiles); … … 31 73 $.getJSON( "../api/getwebuiupdates?latestLine=" + lastLogLine) 32 74 .done(function(data) { 33 var time = "Day " + data.gametime.days + ", "; 34 if (data.gametime.hours < 10) 35 time += "0"; 36 time += data.gametime.hours; 37 time += ":"; 38 if (data.gametime.minutes < 10) 39 time += "0"; 40 time += data.gametime.minutes; 75 var time = FormatServerTime (data.gametime); 41 76 42 77 $("#stats_time").html (time); 78 $("#stats_time").prop ("title", TimeTitle (data.gametime)); 43 79 $("#stats_players").html (data.players); 44 80 $("#stats_hostiles").html (data.hostiles);
Note:
See TracChangeset
for help on using the changeset viewer.