Added a thread and update() calls for gamestate changing.

This commit is contained in:
Filip Maj 2017-01-16 19:14:13 -05:00
parent 6a6ee67ae2
commit 9372b4bc32
7 changed files with 78 additions and 0 deletions

View file

@ -20,6 +20,8 @@ using FFXIVClassic_Map_Server.actors.group;
using FFXIVClassic_Map_Server.packets.send.group;
using FFXIVClassic_Map_Server.packets.WorldPackets.Receive;
using FFXIVClassic_Map_Server.packets.WorldPackets.Send.Group;
using System.Threading;
using System.Diagnostics;
namespace FFXIVClassic_Map_Server
{
@ -37,6 +39,9 @@ namespace FFXIVClassic_Map_Server
private Server mServer;
private const int MILIS_LOOPTIME = 10;
private Timer mZoneTimer;
public WorldManager(Server server)
{
mServer = server;
@ -801,6 +806,21 @@ namespace FFXIVClassic_Map_Server
SubPacket groupInviteResultPacket = GroupInviteResultPacket.BuildPacket(player.playerSession, groupType, result);
player.QueuePacket(groupInviteResultPacket);
}
public void StartZoneThread()
{
mZoneTimer = new Timer(ZoneThreadLoop, null, 0, MILIS_LOOPTIME);
Program.Log.Info("Zone Loop has started");
}
public void ZoneThreadLoop(Object state)
{
lock (zoneList)
{
foreach (Area area in zoneList.Values)
area.Update(MILIS_LOOPTIME);
}
}
public Player GetPCInWorld(string name)
{