Update master server, fix installer

This commit is contained in:
oldnapalm
2023-07-25 16:43:37 -03:00
parent 826e80c5d8
commit 1fcf47cebd
5 changed files with 21 additions and 20 deletions

View File

@ -55,7 +55,7 @@ namespace RageCoop.Client.Installer
var shvPath = Path.Combine(root, "ScriptHookV.dll");
var shvdnPath = Path.Combine(root, "ScriptHookVDotNetCore.dll");
var scriptsPath = Path.Combine(root, "Scripts");
var installPath = Path.Combine(root, "RageCoop");
var installPath = Path.Combine(root, "CoreScripts");
var legacyPath = Path.Combine(scriptsPath, "RageCoop");
if (Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName.StartsWith(installPath))
throw new InvalidOperationException(
@ -70,37 +70,35 @@ namespace RageCoop.Client.Installer
if (!File.Exists(shvdnPath))
{
MessageBox.Show("Please install ScriptHookVDotNet first!");
MessageBox.Show("Please install ScriptHookVDotNetCore first!");
Environment.Exit(1);
}
var shvdnVer = GetVer(shvdnPath);
if (shvdnVer < new Version(3, 5, 1))
if (shvdnVer < new Version(1, 2, 1))
{
MessageBox.Show("Please update ScriptHookVDotNet to latest version!" +
$"\nCurrent version is {shvdnVer}, 3.5.1 or higher is required");
MessageBox.Show("Please update ScriptHookVDotNetCore to latest version!" +
$"\nCurrent version is {shvdnVer}, 1.2.1 or higher is required");
Environment.Exit(1);
}
UpdateStatus("Removing old versions");
foreach (var f in Directory.GetFiles(scriptsPath, "RageCoop.*", SearchOption.AllDirectories))
File.Delete(f);
if (Directory.Exists(scriptsPath))
foreach (var f in Directory.GetFiles(scriptsPath, "RageCoop.*", SearchOption.AllDirectories))
File.Delete(f);
// <= 1.5 installation check
if (Directory.Exists(legacyPath)) Directory.Delete(legacyPath, true);
foreach (var f in Directory.GetFiles(installPath, "*.dll", SearchOption.AllDirectories)) File.Delete(f);
if (File.Exists("Scripts/RageCoop.Core.dll") && File.Exists("Scripts/RageCoop.Client.dll") &&
File.Exists("Loader/RageCoop.Client.Loader.dll"))
if (File.Exists("Scripts/RageCoop.Core.dll") && File.Exists("Scripts/RageCoop.Client.dll"))
{
UpdateStatus("Installing...");
CoreUtils.CopyFilesRecursively(new DirectoryInfo(Directory.GetCurrentDirectory()),
new DirectoryInfo(installPath));
File.Copy("Loader/RageCoop.Client.Loader.dll", Path.Combine(scriptsPath, "RageCoop.Client.Loader.dll"),
true);
Finish();
}
else
@ -114,7 +112,7 @@ namespace RageCoop.Client.Installer
checkKeys:
UpdateStatus("Checking conflicts");
var menyooConfig = Path.Combine(root, @"menyooStuff\menyooConfig.ini");
var settingsPath = Path.Combine(root, SettingsPath);
var settingsPath = Path.Combine(installPath, "Data", "Setting.json");
ClientSettings settings = null;
try
{

View File

@ -31,7 +31,7 @@ namespace RageCoop.Client
/// <summary>
/// Don't use it!
/// </summary>
public string MasterServer { get; set; } = "https://masterserver.ragecoop.online/";
public string MasterServer { get; set; } = "https://test.ragecoop.com/";
/// <summary>
/// Don't use it!
@ -56,7 +56,7 @@ namespace RageCoop.Client
/// <summary>
/// Disable world NPC traffic, mission entities won't be affected
/// </summary>
public bool DisableTraffic { get; set; } = true;
public bool DisableTraffic { get; set; } = false;
/// <summary>
/// Bring up pause menu but don't freeze time when FrontEndPauseAlternate(Esc) is pressed.

View File

@ -354,7 +354,7 @@ namespace RageCoop.Client
{
result = true;
}
else
else if (veh.GetPedOnSeat(seat) != null)
{
var isDead = veh.GetPedOnSeat(seat).IsDead;
if (isDead)

View File

@ -31,7 +31,10 @@ namespace RageCoop.Core
{
internal static class CoreUtils
{
private static readonly Random random = new();
internal static Random SafeRandom => _randInstance.Value;
private static int _randSeed = Environment.TickCount;
private static readonly ThreadLocal<Random> _randInstance
= new(() => new Random(Interlocked.Increment(ref _randSeed)));
private static readonly HashSet<string> ToIgnore = new()
{
@ -72,7 +75,7 @@ namespace RageCoop.Core
public static int RandInt(int start, int end)
{
return random.Next(start, end);
return SafeRandom.Next(start, end);
}
public static string GetTempDirectory(string dir = null)
@ -91,7 +94,7 @@ namespace RageCoop.Core
{
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
return new string(Enumerable.Repeat(chars, length)
.Select(s => s[random.Next(s.Length)]).ToArray());
.Select(s => s[SafeRandom.Next(s.Length)]).ToArray());
}
public static Version GetLatestVersion(string branch = "dev-nightly")

View File

@ -28,7 +28,7 @@ public class Settings
/// <summary>
/// The website address to be shown on master server
/// </summary>
public string Website { get; set; } = "https://ragecoop.online/";
public string Website { get; set; } = "https://ragecoop.com/";
/// <summary>
/// The description to be shown on master server
@ -58,7 +58,7 @@ public class Settings
/// <summary>
/// Master server address, mostly doesn't need to be changed.
/// </summary>
public string MasterServer { get; set; } = "https://masterserver.ragecoop.online/";
public string MasterServer { get; set; } = "https://test.ragecoop.com/";
/// <summary>
/// See <see cref="Core.Logger.LogLevel" />.