Ejemplo n.º 1
0
        private void WorldStartup()
        {
            VoiceDefaultChannel        = API.getSetting <ulong>("voice_defaultchannel");
            VoiceIngameChannel         = API.getSetting <ulong>("voice_ingamechannel");
            VoiceIngameChannelPassword = API.getSetting <string>("voice_ingamechannelpassword");
            VoiceServerGUID            = API.getSetting <string>("voice_serverguid");
            ;
            VoiceServerIP     = API.getSetting <string>("voice_server");
            VoiceServerPort   = API.getSetting <int>("voice_port");
            VoiceServerSecret = API.getSetting <string>("voice_secret");
            VoiceClientPort   = API.getSetting <int>("voice_clientport");
            Version.TryParse(API.getSetting <string>("voice_minpluginversion"), out VoiceServerPluginVersion);
            VoiceEnableLipSync = API.getSetting <bool>("voice_enablelipsync");
            RadioDistanceMax   = API.getSetting <float>("radio_max_distance");

            OnWorldStartupFirst?.Invoke();

            // Register Exports in GameModeScript's
            _loadedScripts.OrderBy(lt => lt.ScriptStartPosition).ToList().ForEach(lt => RegisterExportedFunctions(lt));

            // Start all sub GameModeScript's
            _loadedScripts.OrderBy(lt => lt.ScriptStartPosition).ToList().ForEach(lt => lt.OnScriptStart());

            // Regsiter Commands in GameModeScript's
            _loadedScripts.OrderBy(lt => lt.ScriptStartPosition).ToList().ForEach(lt => RegisterScriptCommands(lt));

            OnWorldStartup?.Invoke();

            // We are reday to go
            OnWorldReady?.Invoke();

            WorldStartedEvent.Set();
            logger.Info("Server ready to accept connections ....");
        }
        private void WorldStartup()
        {
            StartTime                  = DateTime.Now;
            VoiceDefaultChannel        = API.getSetting <ulong>("voice_defaultchannel");
            VoiceIngameChannel         = API.getSetting <ulong>("voice_ingamechannel");
            VoiceIngameChannelPassword = API.getSetting <string>("voice_ingamechannelpassword");
            VoiceServerGUID            = API.getSetting <string>("voice_serverguid");;
            VoiceServerIP              = API.getSetting <string>("voice_server");
            VoiceServerPort            = API.getSetting <int>("voice_port");
            VoiceServerSecret          = API.getSetting <string>("voice_secret");
            VoiceClientPort            = API.getSetting <int>("voice_clientport");
            Version.TryParse(API.getSetting <string>("voice_minpluginversion"), out VoiceServerPluginVersion);
            VoiceEnableLipSync = API.getSetting <bool>("voice_enablelipsync");
            RadioDistanceMax   = API.getSetting <float>("radio_max_distance");

            Globals.DefaultJsonSerializerSettings.Converters.Add(new Vector3Converter());

            OnWorldStartupFirst?.Invoke();

            using (var db = new Database())
            {
                DbContext = db;
                DbContext.ItemInformations.Load();
            }

            // Start all sub GameModeScript's
            _loadedScripts.OrderBy(lt => lt.ScriptStartPosition).ToList().ForEach(lt => lt.OnScriptStart());

            // Regsiter Commands in GameModeScript's
            _loadedScripts.OrderBy(lt => lt.ScriptStartPosition).ToList().ForEach(lt => RegisterScriptCommands(lt));

            OnWorldStartup?.Invoke();

            // We are reday to go
            OnWorldReady?.Invoke();

            WorldStartedEvent.Set();
            logger.Info("Server ready to accept connections ....");
        }