public Server() { wait = new AutoResetEvent(false); Current = this; Random = new Random(); // Create services ConnectionListener = new ConnectionListener(Port); ConnectionMonitor = new ConnectionMonitor(); SessionMonitor = new SessionMonitor(); Database = new Database(DataDir); CommandLookup = new DynamicCommandLookup(); Areas = Database.GetAll <Area>(); CombatSkills = Database.GetAll <CombatSkill>(); RepopHandler = new RepopHandler(TickTime); CombatHandler = new CombatHandler(CombatTickRate); RegenHandler = new RegenHandler(RegenTime); AgeHandler = new AgeHandler(AgeTime); OpenTrades = new Dictionary <Session, string>(); // Setup services ConnectionListener.ConnectionHandler = new StartupConnectionHandler(ConnectionMonitor, SessionMonitor); Console.WriteLine("listening on port {0}...", Port); }
public void Start() { if (running) { throw new InvalidOperationException("Server already running"); } running = true; ConnectionListener.Start(); RepopHandler.Start(); CombatHandler.Start(); RegenHandler.Start(); AgeHandler.Start(); DoLoop(); }
public void Dispose() { Stop(); ConnectionListener.Dispose(); wait.Dispose(); }
public void Stop() { running = false; ConnectionListener.Stop(); }