More stuff. Small changes

This commit is contained in:
EntenKoeniq
2021-09-28 16:51:16 +02:00
parent 073d09d018
commit 1320f35f30
6 changed files with 35 additions and 7 deletions

View File

@ -1,4 +1,5 @@
using System.ComponentModel;
using System;
using System.ComponentModel;
using Lidgren.Network;
@ -55,6 +56,26 @@ namespace CoopClient
return Main.MainNetworking.IsOnServer();
}
public static bool IsMenuVisible()
{
return Main.MainMenu.MenuPool.AreAnyVisible;
}
public static bool IsChatFocused()
{
return Main.MainChat.Focused;
}
public static bool IsPlayerListVisible()
{
return Environment.TickCount - PlayerList.Pressed < 5000;
}
public static string GetCurrentVersion()
{
return Main.CurrentVersion;
}
public static void Configure(string playerName, bool shareNpcsWithPlayers, int streamedNpcs, bool debug = false)
{
Main.MainSettings.Username = playerName;

View File

@ -18,7 +18,7 @@ namespace CoopClient
private bool GameLoaded = false;
public static readonly string CurrentModVersion = "V0_7_0";
public static readonly string CurrentVersion = "V0_8_0";
public static bool ShareNpcsWithPlayers = false;
public static bool DisableTraffic = false;

View File

@ -25,7 +25,7 @@ namespace CoopClient.Menus
private readonly NativeItem AboutItem = new NativeItem("About", "~y~SOURCE~s~~n~" +
"https://github.com/GTACOOP-R~n~" +
"~y~VERSION~s~~n~" +
Main.CurrentModVersion.Replace("_", ".")) { LeftBadge = new LemonUI.Elements.ScaledTexture("commonmenu", "shop_new_star") };
Main.CurrentVersion.Replace("_", ".")) { LeftBadge = new LemonUI.Elements.ScaledTexture("commonmenu", "shop_new_star") };
#endregion
public MenusMain()

View File

@ -53,7 +53,7 @@ namespace CoopClient
ID = 0,
SocialClubName = Game.Player.Name,
Username = Main.MainSettings.Username,
ModVersion = Main.CurrentModVersion,
ModVersion = Main.CurrentVersion,
NpcsAllowed = false
}.PacketToNetOutGoingMessage(outgoingMessage);

View File

@ -3,6 +3,8 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion>
</PropertyGroup>
<ItemGroup>

View File

@ -11,7 +11,7 @@ namespace CoopServer
{
class Server
{
public static readonly string CurrentModVersion = "V0_7_0";
private static readonly string CompatibleVersion = "V0_8";
public static readonly Settings MainSettings = Util.Read<Settings>("CoopSettings.xml");
private readonly Blocklist MainBlocklist = Util.Read<Blocklist>("Blocklist.xml");
@ -26,6 +26,11 @@ namespace CoopServer
public Server()
{
Logging.Info("================");
Logging.Info($"Server version: {Assembly.GetCallingAssembly().GetName().Version}");
Logging.Info($"Compatible GTACoOp:R versions: {CompatibleVersion.Replace('_', '.')}.x");
Logging.Info("================");
// 6d4ec318f1c43bd62fe13d5a7ab28650 = GTACOOP:R
NetPeerConfiguration config = new("6d4ec318f1c43bd62fe13d5a7ab28650")
{
@ -333,9 +338,9 @@ namespace CoopServer
}
}
if (packet.ModVersion != CurrentModVersion)
if (!packet.ModVersion.StartsWith(CompatibleVersion))
{
local.Deny("Please update GTACoop:R to " + CurrentModVersion.Replace("_", "."));
local.Deny($"GTACoOp:R version {CompatibleVersion.Replace('_', '.')}.x required!");
return;
}