diff --git a/Aragas.Core b/Aragas.Core index 50bcae8..055839c 160000 --- a/Aragas.Core +++ b/Aragas.Core @@ -1 +1 @@ -Subproject commit 50bcae804363bdd976048c47308966fe7d850995 +Subproject commit 055839c469481e44185991987f6e8b2a292168c3 diff --git a/Pokemon.3D.Server.Client.Updater/bin/Release/Pokemon.3D.Server.Client.Updater.exe b/Pokemon.3D.Server.Client.Updater/bin/Release/Pokemon.3D.Server.Client.Updater.exe index b3f5f1a..0881a27 100644 Binary files a/Pokemon.3D.Server.Client.Updater/bin/Release/Pokemon.3D.Server.Client.Updater.exe and b/Pokemon.3D.Server.Client.Updater/bin/Release/Pokemon.3D.Server.Client.Updater.exe differ diff --git a/Pokemon.3D.Server.Client.sln b/Pokemon.3D.Server.Client.sln index 11df3a9..2479397 100644 --- a/Pokemon.3D.Server.Client.sln +++ b/Pokemon.3D.Server.Client.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.23107.0 +VisualStudioVersion = 14.0.24720.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pokemon.3D.Server.Client.Updater", "Pokemon.3D.Server.Client.Updater\Pokemon.3D.Server.Client.Updater.csproj", "{6B462F07-FB93-4ABF-A7A3-454E570AE2B8}" EndProject diff --git a/Pokemon.3D.Server.Core/Properties/AssemblyInfo.cs b/Pokemon.3D.Server.Core/Properties/AssemblyInfo.cs index 4448a23..bb3d2fe 100644 --- a/Pokemon.3D.Server.Core/Properties/AssemblyInfo.cs +++ b/Pokemon.3D.Server.Core/Properties/AssemblyInfo.cs @@ -33,7 +33,7 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.54.1.36")] -[assembly: AssemblyFileVersion("0.54.1.36")] +[assembly: AssemblyVersion("0.54.1.63")] +[assembly: AssemblyFileVersion("0.54.1.63")] [assembly: NeutralResourcesLanguage("en")] diff --git a/Pokemon.3D.Server.Core/Server_Client_Listener/Packages/Package.cs b/Pokemon.3D.Server.Core/Server_Client_Listener/Packages/Package.cs index 0edcabb..69e0a47 100644 --- a/Pokemon.3D.Server.Core/Server_Client_Listener/Packages/Package.cs +++ b/Pokemon.3D.Server.Core/Server_Client_Listener/Packages/Package.cs @@ -420,13 +420,13 @@ public void Handle() /// public bool IsFullPackageData() { - if (string.IsNullOrWhiteSpace(DataItems[4])) + if (DataItems.Count == 15 && !string.IsNullOrWhiteSpace(DataItems[4])) { - return false; + return true; } else { - return true; + return false; } } diff --git a/Pokemon.3D.Server.Core/Server_Client_Listener/Packages/PackageHandler.cs b/Pokemon.3D.Server.Core/Server_Client_Listener/Packages/PackageHandler.cs index dd0d364..c6c5f3d 100644 --- a/Pokemon.3D.Server.Core/Server_Client_Listener/Packages/PackageHandler.cs +++ b/Pokemon.3D.Server.Core/Server_Client_Listener/Packages/PackageHandler.cs @@ -497,6 +497,9 @@ private void HandleTradeOffer(Package p) Player TradePlayer = Core.Pokemon3DPlayer.GetPlayer(p.DataItems[0].ToInt()); Core.Pokemon3DPlayer.SentToPlayer(new Package(Package.PackageTypes.TradeOffer, Player.ID, p.DataItems[1], TradePlayer.Network.Client)); + Core.Logger.Log(Player.isGameJoltPlayer ? + Core.Setting.Token("SERVER_GAMEJOLT", Player.Name, Player.GameJoltID.ToString(), "have offered the following pokemon: " + p.DataItems[1]) : + Core.Setting.Token("SERVER_NOGAMEJOLT", Player.Name, "have offered the following pokemon: " + p.DataItems[1]), Logger.LogTypes.Trade, p.Client); } private void HandleTradeStart(Package p) diff --git a/Pokemon.3D.Server.Core/Server_Client_Listener/Servers/Listener.cs b/Pokemon.3D.Server.Core/Server_Client_Listener/Servers/Listener.cs index 1b51a47..caf529e 100644 --- a/Pokemon.3D.Server.Core/Server_Client_Listener/Servers/Listener.cs +++ b/Pokemon.3D.Server.Core/Server_Client_Listener/Servers/Listener.cs @@ -101,6 +101,7 @@ private void ThreadStartListening() if (Functions.CheckPortOpen(Core.Setting.Port)) { Core.Logger.Log($"Server started. Players can join using the following address: {Core.Setting.IPAddress}:{Core.Setting.Port.ToString()} (Global), {Functions.GetPrivateIP()}:{Core.Setting.Port.ToString()} (Local) and with the following GameMode: {GameMode}.", Logger.LogTypes.Info); + ThreadCollection.Add(new ThreadStart(ThreadPortCheck)); } else { @@ -123,7 +124,32 @@ private void ThreadStartListening() } } catch (ThreadAbortException) { return; } - catch (Exception) { Client.Close(); } + catch (Exception) { } + } while (IsActive); + } + + private void ThreadPortCheck() + { + Stopwatch sw = new Stopwatch(); + sw.Start(); + + Core.Logger.Log("Port check is now enabled.", Logger.LogTypes.Info); + + do + { + if (sw.Elapsed.TotalMinutes >= 15) + { + if (Functions.CheckPortOpen(Core.Setting.Port)) + { + Core.Logger.Log("Port Check cycle completed. Result: True.", Logger.LogTypes.Info); + sw.Restart(); + } + else + { + Core.Logger.Log("Port Check cycle completed. Result: False.", Logger.LogTypes.Info); + ClientEvent.Invoke(ClientEvent.Types.Restart); + } + } } while (IsActive); } diff --git a/Pokemon.3D.Server.Core/Server_Client_Listener/Settings/Setting.cs b/Pokemon.3D.Server.Core/Server_Client_Listener/Settings/Setting.cs index b989f20..a4bb43d 100644 --- a/Pokemon.3D.Server.Core/Server_Client_Listener/Settings/Setting.cs +++ b/Pokemon.3D.Server.Core/Server_Client_Listener/Settings/Setting.cs @@ -141,16 +141,49 @@ public int Port /// public List GameMode { get; set; } = new List { }; + /// + /// Get/Set GM_Pokemon3D + /// public bool GM_Pokemon3D { get; set; } = true; + /// + /// Get/Set GM_1YearLater3D + /// public bool GM_1YearLater3D { get; set; } = false; + + /// + /// Get/Set GM_DarkfireMode + /// public bool GM_DarkfireMode { get; set; } = false; + + /// + /// Get/Set GM_German + /// public bool GM_German { get; set; } = false; + + /// + /// Get/Set GM_PokemonGoldSilverRandomLocke + /// public bool GM_PokemonGoldSilverRandomLocke { get; set; } = false; + + /// + /// Get/Set GM_PokemonLostSilver + /// public bool GM_PokemonLostSilver { get; set; } = false; + + /// + /// Get/Set GM_PokemonSilversSoul + /// public bool GM_PokemonSilversSoul { get; set; } = false; + + /// + /// Get/Set GM_PokemonUniversal3D + /// public bool GM_PokemonUniversal3D { get; set; } = false; + /// + /// Get/Set GM_Others + /// public string GM_Others { get; set; } = ""; #endregion GameMode diff --git a/Pokemon.3D.Server.Core/Shared/jianmingyong/ThreadCollection.cs b/Pokemon.3D.Server.Core/Shared/jianmingyong/ThreadCollection.cs index 9035964..436995d 100644 --- a/Pokemon.3D.Server.Core/Shared/jianmingyong/ThreadCollection.cs +++ b/Pokemon.3D.Server.Core/Shared/jianmingyong/ThreadCollection.cs @@ -1,9 +1,6 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading; -using Amib.Threading; namespace Pokemon_3D_Server_Core.Shared.jianmingyong { @@ -15,12 +12,12 @@ public class ThreadCollection : List, IDisposable /// /// Add a new thread into the collection. /// - /// Thread to add. + /// Thread to add. public void Add(ThreadStart ThreadStart) { Thread Thread = new Thread(ThreadStart) { IsBackground = true }; Thread.Start(); - this.Add(Thread); + Add(Thread); } private void RemoveAll() @@ -39,7 +36,7 @@ private void RemoveAll() /// public void Dispose() { - this.RemoveAll(); + RemoveAll(); } } } diff --git a/Pokemon.3D.Server.Core/Shared/jianmingyong/Updater.cs b/Pokemon.3D.Server.Core/Shared/jianmingyong/Updater.cs index 091af55..ea793d1 100644 --- a/Pokemon.3D.Server.Core/Shared/jianmingyong/Updater.cs +++ b/Pokemon.3D.Server.Core/Shared/jianmingyong/Updater.cs @@ -25,12 +25,15 @@ public class Updater /// public void Update() { - UpdateURL = "https://github.com/jianmingyong/Pokemon-3D-Server-Client/raw/master/Pokemon.3D.Server.Core/Resource/Update.dat"; + if (My.Computer.Network.IsAvailable) + { + UpdateURL = "https://github.com/jianmingyong/Pokemon-3D-Server-Client/raw/master/Pokemon.3D.Server.Core/Resource/Update.dat"; - Core.Logger.Log("Checking for update...", Logger.LogTypes.Info); + Core.Logger.Log("Checking for update...", Logger.LogTypes.Info); - Client.DownloadStringAsync(new Uri(UpdateURL)); - Client.DownloadStringCompleted += Client_DownloadStringCompleted; + Client.DownloadStringAsync(new Uri(UpdateURL)); + Client.DownloadStringCompleted += Client_DownloadStringCompleted; + } } private void Client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)