Implemented item packets, did some fixes with one of the conns going null.

This commit is contained in:
Filip Maj 2015-10-04 22:43:22 -04:00
parent 3cacedf6ab
commit 8f7e7d4c0d
8 changed files with 353 additions and 28 deletions

View file

@ -8,6 +8,7 @@ using System.Threading.Tasks;
using System.Threading;
using FFXIVClassic_Lobby_Server.common;
using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Lobby_Server.packets;
namespace FFXIVClassic_Lobby_Server
{
@ -19,7 +20,7 @@ namespace FFXIVClassic_Lobby_Server
private Socket mServerSocket;
private List<Player> mConnectedPlayerList = new List<Player>();
private Dictionary<uint,Player> mConnectedPlayerList = new Dictionary<uint,Player>();
private List<ClientConnection> mConnectionList = new List<ClientConnection>();
private PacketProcessor mProcessor;
private Thread mProcessorThread;
@ -59,7 +60,7 @@ namespace FFXIVClassic_Lobby_Server
Console.WriteLine("{0}:{1}", (mServerSocket.LocalEndPoint as IPEndPoint).Address, (mServerSocket.LocalEndPoint as IPEndPoint).Port);
Console.ForegroundColor = ConsoleColor.Gray;
mProcessor = new PacketProcessor(mConnectionList);
mProcessor = new PacketProcessor(mConnectedPlayerList, mConnectionList);
mProcessorThread = new Thread(new ThreadStart(mProcessor.update));
mProcessorThread.Start();
return true;
@ -117,16 +118,16 @@ namespace FFXIVClassic_Lobby_Server
{
lock (mConnectedPlayerList)
{
foreach (Player p in mConnectedPlayerList)
foreach (KeyValuePair<uint,Player> p in mConnectedPlayerList)
{
if ((p.getConnection1().socket.RemoteEndPoint as IPEndPoint).Address.Equals((s.RemoteEndPoint as IPEndPoint).Address))
if ((p.Value.getConnection1().socket.RemoteEndPoint as IPEndPoint).Address.Equals((s.RemoteEndPoint as IPEndPoint).Address))
{
return p;
return p.Value;
}
if ((p.getConnection2().socket.RemoteEndPoint as IPEndPoint).Address.Equals((s.RemoteEndPoint as IPEndPoint).Address))
if ((p.Value.getConnection2().socket.RemoteEndPoint as IPEndPoint).Address.Equals((s.RemoteEndPoint as IPEndPoint).Address))
{
return p;
return p.Value;
}
}
}
@ -179,5 +180,10 @@ namespace FFXIVClassic_Lobby_Server
#endregion
public void sendPacket(string path, int conn)
{
mProcessor.sendPacket(path, conn);
}
}
}