Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jianmingyong committed Dec 10, 2015
1 parent f5a2916 commit 03ffcda
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Aragas.Core
Binary file not shown.
2 changes: 1 addition & 1 deletion Pokemon.3D.Server.Client.sln
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions Pokemon.3D.Server.Core/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]

Original file line number Diff line number Diff line change
Expand Up @@ -420,13 +420,13 @@ public void Handle()
/// </summary>
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;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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);
}

Expand Down
33 changes: 33 additions & 0 deletions Pokemon.3D.Server.Core/Server_Client_Listener/Settings/Setting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,49 @@ public int Port
/// </summary>
public List<string> GameMode { get; set; } = new List<string> { };

/// <summary>
/// Get/Set GM_Pokemon3D
/// </summary>
public bool GM_Pokemon3D { get; set; } = true;

/// <summary>
/// Get/Set GM_1YearLater3D
/// </summary>
public bool GM_1YearLater3D { get; set; } = false;

/// <summary>
/// Get/Set GM_DarkfireMode
/// </summary>
public bool GM_DarkfireMode { get; set; } = false;

/// <summary>
/// Get/Set GM_German
/// </summary>
public bool GM_German { get; set; } = false;

/// <summary>
/// Get/Set GM_PokemonGoldSilverRandomLocke
/// </summary>
public bool GM_PokemonGoldSilverRandomLocke { get; set; } = false;

/// <summary>
/// Get/Set GM_PokemonLostSilver
/// </summary>
public bool GM_PokemonLostSilver { get; set; } = false;

/// <summary>
/// Get/Set GM_PokemonSilversSoul
/// </summary>
public bool GM_PokemonSilversSoul { get; set; } = false;

/// <summary>
/// Get/Set GM_PokemonUniversal3D
/// </summary>
public bool GM_PokemonUniversal3D { get; set; } = false;

/// <summary>
/// Get/Set GM_Others
/// </summary>
public string GM_Others { get; set; } = "";
#endregion GameMode

Expand Down
Original file line number Diff line number Diff line change
@@ -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
{
Expand All @@ -15,12 +12,12 @@ public class ThreadCollection : List<Thread>, IDisposable
/// <summary>
/// Add a new thread into the collection.
/// </summary>
/// <param name="Thread">Thread to add.</param>
/// <param name="ThreadStart">Thread to add.</param>
public void Add(ThreadStart ThreadStart)
{
Thread Thread = new Thread(ThreadStart) { IsBackground = true };
Thread.Start();
this.Add(Thread);
Add(Thread);
}

private void RemoveAll()
Expand All @@ -39,7 +36,7 @@ private void RemoveAll()
/// </summary>
public void Dispose()
{
this.RemoveAll();
RemoveAll();
}
}
}
11 changes: 7 additions & 4 deletions Pokemon.3D.Server.Core/Shared/jianmingyong/Updater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@ public class Updater
/// </summary>
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)
Expand Down

0 comments on commit 03ffcda

Please sign in to comment.