Skip to content

Commit a1f442e

Browse files
authored
Merge pull request #2988 from ZeroK-RTS/master
update octokit mainly
2 parents 2714e86 + 6d19c32 commit a1f442e

4 files changed

Lines changed: 22 additions & 24 deletions

File tree

ChobbyLauncher/ChobbyLauncher.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@
163163
<PackageReference Include="NeoLua" Version="1.3.14" />
164164
<PackageReference Include="Newtonsoft.Json" Version="10.0.2" />
165165
<PackageReference Include="NLog" Version="4.7.15" />
166-
<PackageReference Include="Octokit" Version="10.0.0" />
166+
<PackageReference Include="Octokit" Version="13.0.0" />
167167
</ItemGroup>
168168
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
169169
<Target Name="BeforeBuild">

ChobbyLauncher/CrashReportHelper.cs

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -209,32 +209,20 @@ private static async Task<Issue> ReportCrash(string infolog, CrashType type, str
209209

210210
private static int[] ReadGameReloads(string logStr)
211211
{
212-
//Game reload detected by [f=-000001] that follows either the start of the file, or [f={non-negative value}]
213-
214-
var list = new List<int>();
215-
216-
var negativeFrameRegex = new Regex(@"f=-(?<=(?<s>^)\[t=\d+:\d+:\d+\.\d+\]\[f=-)\d+\]", RegexOptions.CultureInvariant | RegexOptions.Compiled | RegexOptions.ExplicitCapture | RegexOptions.Multiline, TimeSpan.FromSeconds(30));
217-
var nonNegativeFrameRegex = new Regex(@"f=\d(?<=^\[t=\d+:\d+:\d+\.\d+\]\[f=\d)\d*\]", RegexOptions.CultureInvariant | RegexOptions.Compiled | RegexOptions.ExplicitCapture | RegexOptions.Multiline, TimeSpan.FromSeconds(30));
218-
219-
var idx = 0;
212+
//[t=00:00:30.569367][f=-000001] [ReloadOrRestart] Spring "E:\Games\SteamLibrary\steamapps\common\Zero-K\engine\win64\105.1.1-2457-g8095d30\spring.exe" should be reloading
213+
//This happens whenever a new game is started, or when a game is exited and returns to lobby.
220214

221215
try
222216
{
223-
while (true)
224-
{
225-
{
226-
var m = negativeFrameRegex.Match(logStr, idx);
227-
if (!m.Success) break;
228-
idx = m.Index;
229-
list.Add(m.Groups["s"].Index);
230-
}
231-
{
232-
var m = nonNegativeFrameRegex.Match(logStr, idx);
233-
if (!m.Success) break;
234-
idx = m.Index;
235-
}
236-
}
237-
return list.ToArray();
217+
return
218+
Regex
219+
.Matches(
220+
logStr,
221+
@"\[ReloadOrRestart\](?<=(?<s>^)\[t=\d+:\d+:\d+\.\d+\]\[f=-?\d+\] \[ReloadOrRestart\])",
222+
RegexOptions.CultureInvariant | RegexOptions.Compiled | RegexOptions.ExplicitCapture | RegexOptions.Multiline,
223+
TimeSpan.FromSeconds(30))
224+
.Cast<Match>().Select(m => m.Groups["s"].Index)
225+
.ToArray();
238226
}
239227
catch (RegexMatchTimeoutException)
240228
{

ZkLobbyServer/SpringieInterface/StartSetup.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,13 @@ public static LobbyHostingContext GetDedicatedServerStartSetup(LobbyHostingConte
292292
* See https://github.com/ZeroK-RTS/Zero-K-Infrastructure/blob/master/Shared/LobbyClient/DedicatedServer.cs#L317 */
293293
ret.ModOptions["sendSpringieData"] = "1";
294294

295+
/* Current date. Synced Lua code cannot access `os.date`
296+
* which is needed for gameside events (Easter etc) */
297+
var date = DateTime.UtcNow;
298+
ret.ModOptions["date_day"] = date.Day.ToString();
299+
ret.ModOptions["date_month"] = date.Month.ToString();
300+
ret.ModOptions["date_year"] = date.Year.ToString();
301+
295302
// set PW structures
296303
if (mode == AutohostMode.Planetwars)
297304
{

ZkLobbyServer/ZkLobbyServer.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,9 @@ public bool CanUserSee(ConnectedUser uWatcher, ConnectedUser uWatched)
212212
// admins always visible
213213
if (uWatched.User?.IsAdmin == true) return true;
214214

215+
// admins see everybody
216+
if (uWatcher.User?.IsAdmin == true) return true;
217+
215218
// friends see each other
216219
if (uWatcher.FriendNames.Contains(uWatched.Name)) return true;
217220

0 commit comments

Comments
 (0)