Exemple #1
0
        public ServerBase()
        {
            Exports.Add("QueryResult", new Func <string, dynamic, Task <List <dynamic> > >(
                            (query, parameters) => QueryResult(query, parameters))
                        );
            Exports.Add("QueryAsync", new Action <string, dynamic, CallbackDelegate>(
                            (query, parameters, cb) => QueryAsync(query, parameters, cb))
                        );

            _saveMinutes = 15;
            _flushHours  = 3;

            _logger = new ServerLogger("GGSQL", LogLevel.Info);

            EventHandlers["onServerResourceStart"]     += new Action <string>(BaseOnServerResourceStart);
            EventHandlers["playerReady"]               += new Action <Player>(OnPlayerReady);
            EventHandlers["gg_internal:updateXpMoney"] += new Action <int, int, int>(OnUpdateXpAndMoney);
            EventHandlers["gg_internal:syncUsers"]     += new Action <string>(OnUsersSync);
            EventHandlers["gg_internal:syncUser"]      += new Action <string, string>(OnUserSync);
            EventHandlers["gg_internal:syncWinner"]    += new Action <string>(OnWinnerSync);

            // Tick += SaveTick;
            // Tick += FlushTick;
            Tick += InitializeController;
        }
Exemple #2
0
        internal MySqlDatabase(string connectionString, bool debug = false, ServerLogger logger = null)
        {
            m_connectionString = connectionString;
            _scheduler         = new CustomTaskScheduler();
            m_logger           = logger;

            SqlMapper.AddTypeHandler(typeof(List <PedComponent>), new JsonTypeHandler());
            SqlMapper.AddTypeHandler(typeof(List <ClothingStyle>), new JsonTypeHandler());
        }