Skip to content

Commit

Permalink
Merge pull request #80 from runeberry/jb-ashlands
Browse files Browse the repository at this point in the history
Ashlands updates
  • Loading branch information
dolphinspired authored Jun 4, 2024
2 parents 1f1213c + 5c492f2 commit 6e211fd
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 7 deletions.
26 changes: 20 additions & 6 deletions ValheimServerGUI/Forms/WorldPreferencesForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions ValheimServerGUI/Forms/WorldPreferencesForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ private void SetFormValuesFromPreset()
case WorldGenPresets.Immersive:
ModifierPortalsFormField.Value = DisplayNames.PortalsVeryHard;
KeyNoMapFormField.Value = true;
KeyFireFormField.Value = true;
break;
default:
break;
Expand Down Expand Up @@ -253,6 +254,7 @@ private void InitializeFormEvents()
KeyPlayerEventsFormField.ValueChanged += KeyFormField_ValueChanged;
KeyPassiveMobsFormField.ValueChanged += KeyFormField_ValueChanged;
KeyNoMapFormField.ValueChanged += KeyFormField_ValueChanged;
KeyFireFormField.ValueChanged += KeyFormField_ValueChanged;
}

private void SetFormDefaultValues()
Expand All @@ -269,6 +271,7 @@ private void SetFormDefaultValues()
KeyPlayerEventsFormField.Value = false;
KeyPassiveMobsFormField.Value = false;
KeyNoMapFormField.Value = false;
KeyFireFormField.Value = false;
}

#region Load methods
Expand Down Expand Up @@ -298,6 +301,7 @@ private void LoadFormFromPreferences()
LoadKeyFromPreferences(prefs, WorldGenKeys.PlayerEvents, KeyPlayerEventsFormField);
LoadKeyFromPreferences(prefs, WorldGenKeys.PassiveMobs, KeyPassiveMobsFormField);
LoadKeyFromPreferences(prefs, WorldGenKeys.NoMap, KeyNoMapFormField);
LoadKeyFromPreferences(prefs, WorldGenKeys.Fire, KeyFireFormField);
}
}

Expand Down Expand Up @@ -376,6 +380,7 @@ private void SaveFormToPreferences()
SaveKeyToPreferences(prefs, WorldGenKeys.PlayerEvents, KeyPlayerEventsFormField);
SaveKeyToPreferences(prefs, WorldGenKeys.PassiveMobs, KeyPassiveMobsFormField);
SaveKeyToPreferences(prefs, WorldGenKeys.NoMap, KeyNoMapFormField);
SaveKeyToPreferences(prefs, WorldGenKeys.Fire, KeyFireFormField);
}

WorldPrefsProvider.SavePreferences(prefs);
Expand Down
10 changes: 10 additions & 0 deletions ValheimServerGUI/Game/ValheimServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ private void InitializeLogBasedActions()
// Disconnected
LogBasedActions.Add(@"Closing socket (\d+?)\D*?$", OnPlayerDisconnected); // This is technically "disconnecting" but it's the best terminator I can find
LogBasedActions.Add(@"Destroying abandoned non persistent zdo ([\d-]+?):.*$", OnPlayerDisconnected); // Crossplay
LogBasedActions.Add(@"Disconnect: The client \((\w+?)_(\d+?)\)", OnPlayerDisconnectedCrossplay); // Valheim Plus version mismatch
}

private void InitializeStatusBasedActions()
Expand Down Expand Up @@ -317,6 +318,15 @@ private void OnPlayerDisconnected(params string[] captures)
PlayerDataRepository.SetPlayerOffline(query);
}

private void OnPlayerDisconnectedCrossplay(params string[] captures)
{
var hasValidPlatform = PlayerPlatforms.TryGetValidPlatform(captures[0], out var platform);
var playerId = captures[1];
if (!hasValidPlatform || string.IsNullOrWhiteSpace(playerId)) return;

PlayerDataRepository.SetPlayerOffline(new() { Platform = platform, PlayerId = playerId });
}

private void OnWorldSaved(params string[] captures)
{
if (!decimal.TryParse(captures[0], out var timeMs))
Expand Down
2 changes: 2 additions & 0 deletions ValheimServerGUI/Game/WorldGenKeys.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ public static class WorldGenKeys
public const string PlayerEvents = "playerevents";
public const string PassiveMobs = "passivemobs";
public const string NoMap = "nomap";
public const string Fire = "fire";

public static readonly IReadOnlyList<string> All = new List<string>
{
NoBuildCost,
PlayerEvents,
PassiveMobs,
NoMap,
Fire,
};
}
}
2 changes: 1 addition & 1 deletion ValheimServerGUI/ValheimServerGUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Description>A simple user interface for running Valheim Dedicated Server on Windows.</Description>
<Copyright>2022</Copyright>
<PackageLicenseExpression>GNU GPLv3</PackageLicenseExpression>
<Version>2.3.0</Version>
<Version>2.3.1</Version>
<!-- Build date adapted from: https://rmauro.dev/add-build-time-to-your-csharp-assembly/ -->
<SourceRevisionId>build$([System.DateTime]::UtcNow.ToString("yyyy-MM-ddTHH:mm:ssZ"))</SourceRevisionId>
</PropertyGroup>
Expand Down

0 comments on commit 6e211fd

Please sign in to comment.