Skip to content

Commit

Permalink
Merge pull request #2988 from ZeroK-RTS/master
Browse files Browse the repository at this point in the history
update octokit mainly
  • Loading branch information
Licho1 authored Jul 24, 2024
2 parents 2714e86 + 6d19c32 commit a1f442e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 24 deletions.
2 changes: 1 addition & 1 deletion ChobbyLauncher/ChobbyLauncher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
<PackageReference Include="NeoLua" Version="1.3.14" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.2" />
<PackageReference Include="NLog" Version="4.7.15" />
<PackageReference Include="Octokit" Version="10.0.0" />
<PackageReference Include="Octokit" Version="13.0.0" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="BeforeBuild">
Expand Down
34 changes: 11 additions & 23 deletions ChobbyLauncher/CrashReportHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,32 +209,20 @@ private static async Task<Issue> ReportCrash(string infolog, CrashType type, str

private static int[] ReadGameReloads(string logStr)
{
//Game reload detected by [f=-000001] that follows either the start of the file, or [f={non-negative value}]

var list = new List<int>();

var negativeFrameRegex = new Regex(@"f=-(?<=(?<s>^)\[t=\d+:\d+:\d+\.\d+\]\[f=-)\d+\]", RegexOptions.CultureInvariant | RegexOptions.Compiled | RegexOptions.ExplicitCapture | RegexOptions.Multiline, TimeSpan.FromSeconds(30));
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));

var idx = 0;
//[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
//This happens whenever a new game is started, or when a game is exited and returns to lobby.

try
{
while (true)
{
{
var m = negativeFrameRegex.Match(logStr, idx);
if (!m.Success) break;
idx = m.Index;
list.Add(m.Groups["s"].Index);
}
{
var m = nonNegativeFrameRegex.Match(logStr, idx);
if (!m.Success) break;
idx = m.Index;
}
}
return list.ToArray();
return
Regex
.Matches(
logStr,
@"\[ReloadOrRestart\](?<=(?<s>^)\[t=\d+:\d+:\d+\.\d+\]\[f=-?\d+\] \[ReloadOrRestart\])",
RegexOptions.CultureInvariant | RegexOptions.Compiled | RegexOptions.ExplicitCapture | RegexOptions.Multiline,
TimeSpan.FromSeconds(30))
.Cast<Match>().Select(m => m.Groups["s"].Index)
.ToArray();
}
catch (RegexMatchTimeoutException)
{
Expand Down
7 changes: 7 additions & 0 deletions ZkLobbyServer/SpringieInterface/StartSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,13 @@ public static LobbyHostingContext GetDedicatedServerStartSetup(LobbyHostingConte
* See https://github.com/ZeroK-RTS/Zero-K-Infrastructure/blob/master/Shared/LobbyClient/DedicatedServer.cs#L317 */
ret.ModOptions["sendSpringieData"] = "1";

/* Current date. Synced Lua code cannot access `os.date`
* which is needed for gameside events (Easter etc) */
var date = DateTime.UtcNow;
ret.ModOptions["date_day"] = date.Day.ToString();
ret.ModOptions["date_month"] = date.Month.ToString();
ret.ModOptions["date_year"] = date.Year.ToString();

// set PW structures
if (mode == AutohostMode.Planetwars)
{
Expand Down
3 changes: 3 additions & 0 deletions ZkLobbyServer/ZkLobbyServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ public bool CanUserSee(ConnectedUser uWatcher, ConnectedUser uWatched)
// admins always visible
if (uWatched.User?.IsAdmin == true) return true;

// admins see everybody
if (uWatcher.User?.IsAdmin == true) return true;

// friends see each other
if (uWatcher.FriendNames.Contains(uWatched.Name)) return true;

Expand Down

0 comments on commit a1f442e

Please sign in to comment.