예제 #1
0
        public TicTacToePlugin(PluginLoadData pluginLoadData) : base(pluginLoadData)
        {
            ClientManager.ClientConnected    += OnClientConnected;
            ClientManager.ClientDisconnected += OnClientDisconnected;

            matches = new Dictionary <ushort, MatchModel>();
        }
예제 #2
0
        public AgarPlayerManager(PluginLoadData pluginLoadData) : base(pluginLoadData)
        {
            this.random = new Random();

            ClientManager.ClientConnected    += ClientConnected;
            ClientManager.ClientDisconnected += ClientDisconnected;
        }
예제 #3
0
파일: Login.cs 프로젝트: algor1/wingsrv
 public Login(PluginLoadData pluginLoadData) : base(pluginLoadData)
 {
     LoadConfig();
     LoadRsaKey();
     ClientManager.ClientConnected    += OnPlayerConnected;
     ClientManager.ClientDisconnected += OnPlayerDisconnected;
 }
        public SpawnerHandlerPlugin(PluginLoadData pluginLoadData) : base(pluginLoadData)
        {
            _spawnTasks         = new List <SpawnTask>();
            _registeredSpawners = new List <RegisteredSpawner>();
            _pendingSpawnTasks  = new Dictionary <int, SpawnTask>();

            QueueUpdateFrequency      = Convert.ToInt32(pluginLoadData.Settings.Get(nameof(QueueUpdateFrequency)));
            EnableClientSpawnRequests =
                Convert.ToBoolean(pluginLoadData.Settings.Get(nameof(EnableClientSpawnRequests)));

            ClientManager.ClientDisconnected += OnClientDisconnected;

            updateQueue = Task.Run(() =>
            {
                while (keepUpdateQueueRunning)
                {
                    Thread.Sleep(QueueUpdateFrequency);

                    foreach (var spawner in _registeredSpawners)
                    {
                        try
                        {
                            spawner.UpdateQueue();
                        }
                        catch (Exception e)
                        {
                            Dispatcher.InvokeWait(() =>
                            {
                                WriteEvent("Failed to update spawnerqueue", LogType.Error, e);
                            });
                        }
                    }
                }
            });
        }
예제 #5
0
        public UMVoipManager(PluginLoadData pluginLoadData) : base(pluginLoadData)
        {
            MurmurServer = new UMMurmurICE();
            clients      = new Dictionary <IClient, UMClient>();

            MurmurServer.Connect("XOLI8WUJ06XFDX2NME41");
        }
예제 #6
0
 public TrainPlayerManager(PluginLoadData pluginLoadData) : base(pluginLoadData)
 {
     ClientManager.ClientConnected    += ClientConnected;
     ClientManager.ClientDisconnected += ClientDisconnected;
     InitializeTrain();
     InitializeObjects();
 }
        public CommunicationServerPlugin(PluginLoadData pluginLoadData) : base(pluginLoadData)
        {
            _clients        = new Dictionary <ushort, IClient>();
            _messageHandler = new MessageHandler(this);

            ClientManager.ClientConnected    += HandleClientConnected;
            ClientManager.ClientDisconnected += HandleClientDisconnected;
        }
예제 #8
0
 public TrainPlugin(PluginLoadData pluginLoadData) : base(pluginLoadData)
 {
     worldTrains = new List <WorldTrain>();
     queue       = new BufferQueue();
     playerHasInitializedTrain         = new List <IClient>();
     ClientManager.ClientConnected    += OnClientConnected;
     ClientManager.ClientDisconnected += OnClientDisconnect;
 }
예제 #9
0
        public GamePlugin(PluginLoadData pluginLoadData) : base(pluginLoadData)
        {
            Tickrate = Convert.ToInt32(pluginLoadData.Settings.Get(nameof(Tickrate)));

            Entities      = new Dictionary <uint, Entity>();
            _spawnQueue   = new ConcurrentQueue <Entity>();
            _despawnQueue = new ConcurrentQueue <Entity>();
        }
예제 #10
0
        public Server(PluginLoadData pluginLoadData) : base(pluginLoadData)
        {
            // Connection to DB
            DB = DataBase.getInstance().mysql;
            DB.Connect(pluginLoadData.DatabaseManager.GetConnectionString("db"));

            ClientManager.ClientConnected += ClientConnected;
        }
        public MySqlConnector(PluginLoadData pluginLoadData) : base(pluginLoadData)
        {
            _connectionString = LoadConfig();
            CreateTables();
            _dataLayer = new DataLayer("MySQL", this);

            ClientManager.ClientConnected += OnPlayerConnected;
        }
예제 #12
0
        public BlockDemoPlayerManager(PluginLoadData pluginLoadData) : base(pluginLoadData)
        {
            //Subscribe for notification when a new client connects
            ClientManager.ClientConnected += ClientManager_ClientConnected;

            //Subscribe for notifications when a new client disconnects
            ClientManager.ClientDisconnected += ClientManager_ClientDisconnected;
        }
        public Server(PluginLoadData pluginLoadData) : base(pluginLoadData)
        {
            instance = this;
            ClientManager.ClientConnected    += ConnectionManager.Connected;
            ClientManager.ClientDisconnected += ConnectionManager.Disconnected;

            new GameLogic();
        }
예제 #14
0
        /// <summary>
        ///     Creates a new bad word list plugin.
        /// </summary>
        /// <param name="pluginLoadData">The plugin load data from the server.</param>
        public BadWordFilter(PluginLoadData pluginLoadData)
            : base(pluginLoadData)
        {
            listLocation = Path.Combine(ResourceDirectory, "BadWordList.xml");

            replacementSymbols = (pluginLoadData.Settings["replacementSymbols"] ?? "$#@%&*!").ToCharArray();
            url = pluginLoadData.Settings["url"] ?? "https://darkriftnetworking.com/DarkRift2/Resources/BadWords.xml";
        }
예제 #15
0
        /// <summary>
        ///     Creates a new RankingMatchmaker/>.
        /// </summary>
        /// <param name="pluginLoadData">The data to load with.</param>
        public RankingMatchmaker(PluginLoadData pluginLoadData)
            : base(pluginLoadData)
        {
            if (float.TryParse(pluginLoadData.Settings["discardThreshold"], out float discardThreshold))
            {
                if (discardThreshold >= 0 && discardThreshold <= 1)
                {
                    this.DiscardThreshold = discardThreshold;
                }
                else
                {
                    this.DiscardThreshold = 1;
                    Logger.Error("Discard threshold was outside of the [0-1] range. Using a value of 1 instead.");
                }
            }
            else
            {
                this.DiscardThreshold = 1;
                Logger.Error("Discard threshold not parsable to a float value, using a value of 1 instead.");
            }

            if (float.TryParse(pluginLoadData.Settings["groupDiscardThreshold"], out float groupDiscardThreshold))
            {
                if (groupDiscardThreshold >= 0 && groupDiscardThreshold <= 1)
                {
                    this.GroupDiscardThreshold = groupDiscardThreshold;
                }
                else
                {
                    this.GroupDiscardThreshold = 1;
                    Logger.Error("Group discard threshold was outside of the [0-1] range. Using a value of 1 instead.");
                }
            }
            else
            {
                this.GroupDiscardThreshold = 1;
                Logger.Error("Group discard threshold not parsable to a float value, using a value of 1 instead.");
            }

            if (int.TryParse(pluginLoadData.Settings["entitiesPerGroup"], out int entitiesPerGroup))
            {
                this.EntitiesPerGroup = entitiesPerGroup;
            }
            else
            {
                Logger.Fatal("Entities per group not parsable to an int value.");
            }

            if (int.TryParse(pluginLoadData.Settings["tickPeriod"], out int tickPeriod) && tickPeriod > 0)
            {
                this.TickPeriod = tickPeriod;
            }
            else
            {
                this.TickPeriod = 500;
                Logger.Error("Tick period not parsable to an int value, using a value of 500ms instead.");
            }
        }
예제 #16
0
 public PlayerPlugin(PluginLoadData pluginLoadData) : base(pluginLoadData)
 {
     ClientManager.ClientConnected    += ClientConnected;
     ClientManager.ClientDisconnected += ClientDisconnected;
     pingSendTimer           = new Timer(250);
     pingSendTimer.Elapsed  += PingSendMessage;
     pingSendTimer.AutoReset = true;
     pingSendTimer.Start();
 }
예제 #17
0
 public MailPlugin(PluginLoadData pluginLoadData) : base(pluginLoadData)
 {
     SmtpHost          = pluginLoadData.Settings.Get(nameof(SmtpHost));
     SmtpPort          = Convert.ToInt32(pluginLoadData.Settings.Get(nameof(SmtpPort)));
     SmtpUsername      = pluginLoadData.Settings.Get(nameof(SmtpUsername));
     SmtpPassword      = pluginLoadData.Settings.Get(nameof(SmtpPassword));
     SenderDisplayName = pluginLoadData.Settings.Get(nameof(SenderDisplayName));
     EmailFrom         = pluginLoadData.Settings.Get(nameof(EmailFrom));
 }
예제 #18
0
        public PluginTest(PluginLoadData pluginLoadData) : base(pluginLoadData)
        {
            ClientManager.ClientConnected    += OnClientConnected;
            ClientManager.ClientDisconnected += OnClientDisconnected;

            var worldUpdate = new Thread(this.SendWorldUpdate);

            worldUpdate.Start();
        }
예제 #19
0
        public Database(PluginLoadData pluginLoadData) : base(pluginLoadData)
        {
            _CityDatabase.Load();
            _ClassDatabase.Load();
            _ItemSuffixDatabase.Load();
            _ItemDatabase.Load();
            _SkillDatabase.Load();

            AccountManager.Load();
        }
예제 #20
0
 public RelayPlugin(PluginLoadData loadData) : base(loadData)
 {
     ClientManager.ClientConnected    += ClientManager_ClientConnected;
     ClientManager.ClientDisconnected += ClientManager_ClientDisconnected;
     authKey = string.IsNullOrEmpty(loadData.Settings["password"]) ? "" : loadData.Settings["password"];
     Console.ForegroundColor = ConsoleColor.Green;
     Console.WriteLine("[DarkReflectiveMirror] Relay server started!");
     Console.WriteLine("[DarkReflectiveMirror] Authentication Key set to: " + authKey);
     Console.ForegroundColor = ConsoleColor.White;
 }
예제 #21
0
        public CCorePlugin(PluginLoadData pluginLoadData) : base(pluginLoadData)
        {
            Log.SetPluginLoadData(pluginLoadData);

            messageController = new MessageController(ClientManager);

            ClientManager.ClientConnected    += OnClientConnected;
            ClientManager.ClientDisconnected += OnClientConnected;

            Instance = this;
        }
예제 #22
0
        public Scheduler(PluginLoadData pluginLoadData) : base(pluginLoadData)
        {
            //Initialize some data
            //...
            Console.WriteLine("Initialize some stuff here that is needed in plugins");

            //Initialize plugins async - enable continue execution
            InitPluginsAsync(PluginManager);

            Console.WriteLine("Scheduler instanciated successfully");
        }
예제 #23
0
        public AuthenticationPlugin(PluginLoadData pluginLoadData) : base(pluginLoadData)
        {
            LoggedInClients = new Dictionary <IClient, SqlAccountData>();
            _encryptionData = new Dictionary <IClient, EncryptionData>();

            EMailMinChars          = Convert.ToInt32(pluginLoadData.Settings.Get(nameof(EMailMinChars)));
            EMailMaxChars          = Convert.ToInt32(pluginLoadData.Settings.Get(nameof(EMailMaxChars)));
            PasswordResetEmailBody = pluginLoadData.Settings.Get(nameof(PasswordResetEmailBody));
            ConfirmEmailBody       = pluginLoadData.Settings.Get(nameof(ConfirmEmailBody));

            ClientManager.ClientDisconnected += ClientDisconnected;
        }
예제 #24
0
        public AgarFoodManager(PluginLoadData pluginLoadData) : base(pluginLoadData)
        {
            this.random = new Random();

            // Spawn initial food
            for (int i = 0; i < NUM_FOOD; i++)
            {
                this.SpawnFood();
            }

            ClientManager.ClientConnected += ClientConnected;
        }
예제 #25
0
        public ServerPlugin(PluginLoadData pluginLoadData) : base(pluginLoadData)
        {
            var handlers = from t in Assembly.GetAssembly(GetType()).GetTypes()
                           .Where(t => t.GetInterfaces().Contains(typeof(IHandler <IClientPeer>)))
                           select Activator
                           .CreateInstance(t) as IHandler <IClientPeer>;

            clientHandlerList = new ClientHandlerList(handlers);

            CreateSubServers();
            ClientManager.ClientConnected += OnConnect;
        }
예제 #26
0
        public ItemManager(PluginLoadData pluginLoadData) : base(pluginLoadData)
        {
            ClientManager.ClientConnected += ClientConnected;

            List <NetworkItem> itemList = new List <NetworkItem>();

            itemList.Add(CreateItem("item.resource.wood", 2));
            CreateContainer(itemList, 0, 0, 0, 0);

            itemList = new List <NetworkItem>();
            itemList.Add(CreateItem("item.resource.gold", 2));
            CreateContainer(itemList, 5, 0, 5, 0);
        }
예제 #27
0
        public Server(PluginLoadData pluginLoadData) : base(pluginLoadData)
        {
            Instance = this;

            Thread gameBackgroundThread = new Thread(Clock.StartBackgroundloop);

            gameBackgroundThread.Priority     = ThreadPriority.AboveNormal;
            gameBackgroundThread.IsBackground = true;
            gameBackgroundThread.Start();

            ClientManager.ClientConnected    += OnClientConnect;
            ClientManager.ClientDisconnected += OnClientDisconnect;
        }
예제 #28
0
        public RelayPlugin(PluginLoadData loadData) : base(loadData)
        {
            ClientManager.ClientConnected    += ClientManager_ClientConnected;
            ClientManager.ClientDisconnected += ClientManager_ClientDisconnected;
            authKey = string.IsNullOrEmpty(loadData.Settings["password"]) ? "" : loadData.Settings["password"];
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("[DarkReflectiveMirror] Relay server started!");
            Console.WriteLine("[DarkReflectiveMirror] Authentication Key set to: " + authKey);
            int heartbeatInterval = string.IsNullOrEmpty(loadData.Settings["heartbeat"]) ? 2000 : int.TryParse(loadData.Settings["heartbeat"], out heartbeatInterval) ? heartbeatInterval : 2000;

            timer = new System.Threading.Timer(TimerCallback, null, 0, heartbeatInterval);
            Console.WriteLine("[DarkReflectiveMirror] Heartbeat Interval: " + heartbeatInterval + "ms");
            Console.ForegroundColor = ConsoleColor.White;
        }
        public BlockDemoWorldManager(PluginLoadData pluginLoadData) : base(pluginLoadData)
        {
            //Build a basic floor
            for (int x = -5; x <= 5; x++)
            {
                for (int z = -5; z <= 5; z++)
                {
                    blocks.Add(new Block(x, -2, z));
                }
            }

            //Subscribe for notification when a new client connects
            ClientManager.ClientConnected += ClientManager_ClientConnected;
        }
예제 #30
0
        public DbConnector(PluginLoadData pluginLoadData) : base(pluginLoadData)
        {
            var connectionString = LoadConfig();

            try
            {
                var client = new MongoClient(connectionString);
                _database = client.GetDatabase("test");
                GetCollections();
            }
            catch (Exception ex)
            {
                WriteEvent("Failed to set up Database:" + ex.Message + " - " + ex.StackTrace, LogType.Fatal);
            }
        }