Esempio n. 1
0
        private float destructionRadius = 6.0f; // game units

        public Main()
        {
            Tick  += onTick;
            KeyUp += onKeyUp;

            dateTimeThatStarmanWasInitiated = janFirst1970; // now we set the value

            ss = ScriptSettings.Load(@"scripts\Starman.ini");
            if (ss.GetValue("Settings", "JumpBoost") == null)
            {
                ss.SetValue("Settings", "JumpBoost", "true");
            }
            if (ss.GetValue("Settings", "Key") == null)
            {
                ss.SetValue("Settings", "Key", "105");
            }
            if (ss.GetValue("Settings", "VehiclePower") == null)
            {
                ss.SetValue("Settings", "VehiclePower", "20");
            }
            if (ss.GetValue("Settings", "Volume") == null)
            {
                ss.SetValue("Settings", "Volume", "0.4");
            }
            ss.Save();
        }
Esempio n. 2
0
    public void PlayerMenu(UIMenu menu)
    {
        UIMenuItem CantFallFromBike          = new UIMenuCheckboxItem("Can't fall from bike", CantFallFromBike_, "You can't fall from your bike when enabled");
        UIMenuItem CantBeDraggedOutOfVehicle = new UIMenuCheckboxItem("Can't be dragged out of vehicle", CantBeDraggedOutOfVehicle_, "You can't be dragged out of your vehicle when enabled");
        UIMenuItem CantFlyThroughWindscreen  = new UIMenuCheckboxItem("Can't fly through windscreen", CantFlyThroughWindscreen_, "Crashing at high speed won't make you fly through the windscreen");

        menu.AddItem(CantFallFromBike);
        menu.AddItem(CantBeDraggedOutOfVehicle);
        menu.AddItem(CantFlyThroughWindscreen);
        menu.OnCheckboxChange += (sender, item, checked_) =>
        {
            if (item == CantFallFromBike)
            {
                CantFallFromBike_ = checked_;
                config.SetValue <bool>("Options", "CantFallFromBike", checked_);
            }
            if (item == CantBeDraggedOutOfVehicle)
            {
                CantBeDraggedOutOfVehicle_ = checked_;
                config.SetValue <bool>("Options", "CantBeDraggedOutOfVehicle", checked_);
            }
            if (item == CantFlyThroughWindscreen)
            {
                CantFlyThroughWindscreen_ = checked_;
                config.SetValue <bool>("Options", "CantFlyThroughWindscreen", checked_);
            }
            config.Save();
        };
    }
Esempio n. 3
0
        public static void SaveSettings()
        {
            ScriptSettings settings = ScriptSettings.Load("./scripts/BackToTheFutureV/settings.ini");
            CultureInfo    info     = CultureInfo.CreateSpecificCulture("en-US");

            settings.SetValue("tcd", "position_x", TCDPosition.X.ToString("G", info));
            settings.SetValue("tcd", "position_y", TCDPosition.Y.ToString("G", info));
            settings.SetValue("tcd", "scale", TCDScale.ToString("G", info));
            settings.SetValue("tcd", "background", TCDBackground.ToString());

            settings.SetValue("time_circuits", "PlayFluxCapacitorSound", PlayFluxCapacitorSound);

            settings.SetValue("time_circuits", "play_diode_sound", PlayDiodeBeep);
            settings.SetValue("time_circuits", "use_input_toggle", UseInputToggle);

            settings.SetValue("speedo", "play_speedo_beep", PlaySpeedoBeep);

            settings.SetValue("vehicle", "PlayEngineSounds", PlayEngineSounds);

            settings.SetValue("vehicle", "CinematicSpawn", CinematicSpawn);

            settings.SetValue("fly_mode", "force_fly_mode", ForceFlyMode);
            settings.SetValue("fly_mode", "LandingSystem", LandingSystem);

            settings.SetValue("time_circuits", "GlowingWormholeEmitter", GlowingWormholeEmitter);
            settings.SetValue("time_circuits", "GlowingPlutoniumReactor", GlowingPlutoniumReactor);

            settings.SetValue("events", "LightningStrikeEvent", LightningStrikeEvent);
            settings.SetValue("events", "EngineStallEvent", EngineStallEvent);
            settings.SetValue("events", "TurbulenceEvent", TurbulenceEvent);

            settings.Save();
        }
        /// <summary>
        /// Starts a wizard in which the user gets asked for all buttons one by one
        /// </summary>
        /// <param name="iniFile">The target INI file</param>
        /// <returns></returns>
        public bool StartConfiguration(string iniFile)
        {
            DirectInputManager input = new DirectInputManager(stick);

            ScriptSettings data = ScriptSettings.Load(iniFile);
            string         guid = stick.Information.ProductGuid.ToString();

            DpadType dpadType = DetermineDpadType(input);

            if (dpadType == (DpadType)3)
            {
                return(false);
            }

            if (dpadType == DpadType.Unknown)
            {
                UI.Notify("Unknown Dpad type, controller configuration stopped.");
                return(false);
            }
            data.SetValue(guid, DirectInputManager.DpadTypeKey, dpadType.ToString());

            while (input.GetDpadValue() != -1)
            {
                UI.ShowSubtitle("Please let go the Dpad button.");
                Script.Wait(100);
            }

            Script.Wait(1000);

            UI.ShowSubtitle("Determined Dpad type: " + dpadType, 2500);

            Script.Wait(2500);

            foreach (DeviceButton btn in Enum.GetValues(typeof(DeviceButton)))
            {
                if (Array.Exists(dpads, item => { return(item == btn); }) && dpadType == DpadType.DigitalDpad)
                {
                    bool result = ConfigureDigitalDpadButton(btn, data, input, guid);
                    if (!result)
                    {
                        return(false);
                    }
                }
                else
                {
                    bool result = Configure(btn, data, input, guid);
                    if (!result)
                    {
                        return(false);
                    }
                }

                UI.Notify(GetBtnText(btn) + " button configured.");
            }

            data.Save();
            return(true);
        }
Esempio n. 5
0
        public Main()
        {
            // Load settings
            try
            {
                string         configFile = Path.Combine("scripts", "spgunlocker_config.ini");
                ScriptSettings config     = ScriptSettings.Load(configFile);

                if (File.Exists(configFile))
                {
                    InteractionControl = config.GetValue("CONFIG", "InteractionControl", 51);
                    GunLockerPrice     = config.GetValue("CONFIG", "GunLockerPrice", 2500);
                }
                else
                {
                    config.SetValue("CONFIG", "InteractionControl", InteractionControl);
                    config.SetValue("CONFIG", "GunLockerPrice", GunLockerPrice);
                }

                config.Save();
            }
            catch (Exception e)
            {
                UI.Notify($"~r~SPGunLocker settings error: {e.Message}");
            }

            // Create menus
            SPGLMenuPool = new MenuPool();

            SPGLMainMenu             = new UIMenu("", "~b~GUN LOCKER", Point.Empty, "shopui_title_gr_gunmod", "shopui_title_gr_gunmod");
            SPGLWeaponsMenu          = new UIMenu("", "~b~GUN LOCKER: ~w~WEAPONS", Point.Empty, "shopui_title_gr_gunmod", "shopui_title_gr_gunmod");
            SPGLSellConfirmationMenu = new UIMenu("", "~b~GUN LOCKER: ~w~REFUND CONFIRMATION", Point.Empty, "shopui_title_gr_gunmod", "shopui_title_gr_gunmod");

            UIMenuItem putLinkItem  = new UIMenuItem("Put", "Put a weapon to the gun locker.");
            UIMenuItem takeLinkItem = new UIMenuItem("Take", "Take a weapon from the gun locker.");
            UIMenuItem sellItem     = new UIMenuItem("Refund", "Return the gun locker and get your money back. Will take you to the confirmation menu.");

            SPGLMainMenu.AddItem(putLinkItem);
            SPGLMainMenu.AddItem(takeLinkItem);
            SPGLMainMenu.AddItem(sellItem);
            SPGLSellConfirmationMenu.AddItem(new UIMenuItem("Confirm", "You'll be refunded the amount displayed on right. ~r~Weapons inside the gun locker will be lost!"));
            SPGLSellConfirmationMenu.AddItem(new UIMenuItem("Cancel", "Go back to the main menu."));

            SPGLMainMenu.BindMenuToItem(SPGLWeaponsMenu, putLinkItem);
            SPGLMainMenu.BindMenuToItem(SPGLWeaponsMenu, takeLinkItem);
            SPGLMainMenu.BindMenuToItem(SPGLSellConfirmationMenu, sellItem);

            SPGLMenuPool.Add(SPGLMainMenu);
            SPGLMenuPool.Add(SPGLWeaponsMenu);
            SPGLMenuPool.Add(SPGLSellConfirmationMenu);

            // Event handlers
            Tick    += Script_Tick;
            Aborted += Script_Aborted;
            SPGLMainMenu.OnItemSelect             += MainMenu_OnItemSelect;
            SPGLWeaponsMenu.OnItemSelect          += WeaponsMenu_OnItemSelect;
            SPGLSellConfirmationMenu.OnItemSelect += SellConfirmationMenu_OnItemSelect;
        }
        public void Save()
        {
            Distance_Of_Reach = _Distance_Of_Reach;
            Restrict_When_Stars_Bigger_Then = _Restrict_When_Stars_Bigger_Then;
            Quick_Rob_People_No_Pickup      = _Quick_Rob_People_No_Pickup;
            Help_Message_Beep_Sound         = _Help_Message_Beep_Sound;

            _settings.Save();
        }
        public void Save()
        {
            Show_Ammunations    = _Show_Ammunations;
            Show_Atm            = _Show_Atm;
            Show_Stores         = _Show_Stores;
            Show_Hospitals      = _Show_Hospitals;
            Show_PoliceStations = _Show_PoliceStations;

            _settings.Save();
        }
        public void Save()
        {
            Virtual_Timerate     = _Virtual_Timerate;
            Enable_Top_Clock     = _Enable_Top_Clock;
            Show_Seconds         = _Show_Seconds;
            Military_Time_Format = _Military_Time_Format;
            Clock_Mode           = _Clock_Mode;

            _settings.Save();
        }
Esempio n. 9
0
        void CreateIni()
        {
            if (!File.Exists(@"scripts\ParticleFxPlayer.ini"))
            {
                ScriptSettings settings = ScriptSettings.Load(@"scripts\ParticleFxPlayer.ini");

                settings.SetValue("Control", "Menu Key", Keys.ShiftKey);
                settings.SetValue("Control", "Menu Key 2", Keys.N);

                settings.Save();
            }
        }
        void SaveMergerINI(string filepath)
        {
            if (!File.Exists(filepath))
            {
                ScriptSettings config = ScriptSettings.Load(filepath);

                config.SetValue <Keys>("Keyboard Controls", "Menu Toggle Key 1", Keys.F10);
                config.SetValue <Keys>("Keyboard Controls", "Menu Toggle Key 2", Keys.F10);
                config.SetValue <Control>("Gamepad Controls", "Menu Toggle Button 1", Control.VehicleHandbrake);
                config.SetValue <Control>("Gamepad Controls", "Menu Toggle Button 2", Control.VehicleHandbrake);
                config.SetValue <Control>("Gamepad Controls", "Menu Toggle Button 3", Control.VehicleHorn);
                config.Save();
            }
        }
        public void Save()
        {
            Save_Directory_Path         = _Save_Directory_Path;
            Save_Player_Filename        = _Save_Player_Filename;
            Auto_Save_Enabled           = _Auto_Save_Enabled;
            Auto_Save_Delay             = _Auto_Save_Delay;
            Auto_Save_Show_Spinner_text = _Auto_Save_Show_Spinner_text;
            Auto_Save_After_DeathArrest = _Auto_Save_After_DeathArrest;
            Auto_Save_When_Wanted       = _Auto_Save_When_Wanted;
            Auto_Save_In_Vehicle        = _Auto_Save_In_Vehicle;
            Auto_Save_On_Transaction    = _Auto_Save_On_Transaction;

            _settings.Save();
        }
Esempio n. 12
0
 private void TrySaveChar(String fileName)
 {
     try
     {
         saveSettings = ScriptSettings.Load(fileName);
         saveSettings.SetValue <int>("Characters", Game.Player.Character.Model.ToString(), currentStrength);
         curModel = Game.Player.Character.Model.ToString();
         UI.Notify("Model " + curModel + " saved with strength " + currentStrength.ToString());
         saveSettings.Save();
     }
     catch (Exception e)
     {
         UI.Notify("~r~Error~w~: " + fileName.ToString() + " failed to load : " + e.ToString() + ".");
     }
 }
        public void Save()
        {
            Player_Death_Arrest_Script = _Player_Death_Arrest_Script;
            Player_Persistence_Script  = _Player_Persistence_Script;
            ClockTime_Script           = _ClockTime_Script;
            TimeScale_Script           = _TimeScale_Script;
            Economy_Script             = _Economy_Script;
            Rob_People_Script          = _Rob_People_Script;
            People_Money_Script        = _People_Money_Script;
            Atm_Script   = _Atm_Script;
            Store_Script = _Store_Script;
            //Play_Police_Script = _Play_Police_Script;
            Waypoint_Tools_Script = _Waypoint_Tools_Script;

            _settings.Save();
        }
Esempio n. 14
0
 public Datacreator()
 {
     if (File.Exists("scripts\\panoramic.ini"))
     {
         this.cFov           = (float)config.GetValue <float>("SETTINGS", "FOV", (float)50.0);
         this.cHideHud       = (bool)config.GetValue <bool>("SETTINGS", "HUD", true);
         this.cPlayerVisible = (bool)config.GetValue <bool>("SETTINGS", "PLAYERVISIBLE", false);
     }
     else
     {
         config.SetValue <float>("SETTINGS", "FOV", (float)50.0);
         config.SetValue <bool>("SETTINGS", "HUD", true);
         config.SetValue <bool>("SETTINGS", "PLAYERVISIBLE", false);
         config.Save();
     }
     Tick    += OnTick;
     KeyDown += OnKeyDown;
 }
Esempio n. 15
0
        public static void Check()
        {
            ScriptSettings settings = ScriptSettings.Load("./scripts/StateZ.ini");

            if (!(settings.GetValue("mod", "version_id", "0") == VersionId))
            {
                if (File.Exists("./scripts/StateZ.ini"))
                {
                    File.Delete("./scripts/StateZ.ini");
                }
                if (File.Exists("./scripts/Inventory.dat"))
                {
                    File.Delete("./scripts/Inventory.dat");
                }
                UI.Notify($"Updating Simple Zombies to version ~g~{VersionId}~s~. Overwritting the " + "inventory file since there are new items.");
                settings.SetValue("mod", "version_id", VersionId);
                settings.Save();
            }
        }
Esempio n. 16
0
        public static void Check()
        {
            ScriptSettings scriptSettings = ScriptSettings.Load("./scripts/ZombiesMod.ini");

            if (scriptSettings.GetValue("mod", "version_id", "0") == Config.VersionId)
            {
                return;
            }
            if (File.Exists("./scripts/ZombiesMod.ini"))
            {
                File.Delete("./scripts/ZombiesMod.ini");
            }
            if (File.Exists("./scripts/Inventory.dat"))
            {
                File.Delete("./scripts/Inventory.dat");
            }
            UI.Notify(string.Format("Updating Simple Zombies to version ~g~{0}~s~. Overwritting the ", (object)Config.VersionId) + "inventory file since there are new items.");
            scriptSettings.SetValue("mod", "version_id", Config.VersionId);
            scriptSettings.Save();
        }
Esempio n. 17
0
        public void Save()
        {
            Debug_Mode                        = _Debug_Mode;
            Dont_Generate_Log                 = _Dont_Generate_Log;
            Kill_GTAV_Scripts_Ms_Delay        = _Kill_GTAV_Scripts_Ms_Delay;
            Kill_GTAV_Scripts_Only            = _Kill_GTAV_Scripts_Only;
            Dont_Kill_GTAV_Scripts            = _Dont_Kill_GTAV_Scripts;
            Info_Intro_Screen                 = _Info_Intro_Screen;
            Info_Intro_Screen_Ms_Duration     = _Info_Intro_Screen_Ms_Duration;
            Unlock_All_Doors                  = _Unlock_All_Doors;
            Hospital_Spawn_OnDeath            = _Hospital_Spawn_OnDeath;
            Hospital_Fee                      = _Hospital_Fee;
            PoliceStation_Spawn_OnArrest      = _PoliceStation_Spawn_OnArrest;
            PoliceStation_Fee                 = _PoliceStation_Fee;
            Show_Radar_OnKeyDown              = _Show_Radar_OnKeyDown;
            Randomize_People_Money            = _Randomize_People_Money;
            Randomize_Poor_People_MaxMoney    = _Randomize_Poor_People_MaxMoney;
            Randomize_Regular_People_MaxMoney = _Randomize_Regular_People_MaxMoney;
            Randomize_Rich_People_MaxMoney    = _Randomize_Rich_People_MaxMoney;

            _settings.Save();
        }
Esempio n. 18
0
        private void setupIni()
        {
            const string nodefstr = "nodef3490457439";
            const int    nodefint = 439579345;

            ini = ScriptSettings.Load("JaysMod.ini");

            if (ini.GetValue <string>("General", "name", nodefstr) == nodefstr)
            {
                ini.SetValue <string>("General", "name", "player");
            }
            if (ini.GetValue <int>("General", "funds", nodefint) == nodefint)
            {
                ini.SetValue <int>("General", "funds", 0);
            }
            if (ini.GetValue <int>("General", "outfit", nodefint) == nodefint)
            {
                ini.SetValue <int>("General", "outfit", (int)Outfits.OutfitID.Casual);
            }

            ini.Save();
        }
Esempio n. 19
0
    public SeatbeltMenu()
    {
        string fileName = "scripts\\Seatbelt Menu.ini";

        config = ScriptSettings.Load(fileName);
        if (!File.Exists(fileName))
        {
            config.SetValue <string>("Options", "OpenMenu", "F7");
            config.SetValue <bool>("Options", "CantFallFromBike", false);
            config.SetValue <bool>("Options", "CantBeDraggedOutOfVehicle", false);
            config.SetValue <bool>("Options", "CantFlyThroughWindscreen", false);
            config.Save();
        }
        OpenMenu                   = (Keys)Enum.Parse(typeof(Keys), config.GetValue <string>("Options", "OpenMenu", "F7"), true);
        CantFallFromBike_          = config.GetValue <bool>("Options", "CantFallFromBike", false);
        CantBeDraggedOutOfVehicle_ = config.GetValue <bool>("Options", "CantBeDraggedOutOfVehicle", false);
        CantFlyThroughWindscreen_  = config.GetValue <bool>("Options", "CantFlyThroughWindscreen", false);
        _menuPool                  = new MenuPool();
        UIMenu mainMenu = new UIMenu("Seatbelt Menu", "~b~Mod by ShadoFax! ~r~V 1.1");

        _menuPool.Add(mainMenu);
        PlayerMenu(mainMenu);
        _menuPool.RefreshIndex();
        Tick += delegate(object o, EventArgs e)
        {
            _menuPool.ProcessMenus();
            Function.Call(Hash.SET_PED_CAN_BE_KNOCKED_OFF_VEHICLE, playerPed, CantFallFromBike_);             // this is actually inverted
            Function.Call(Hash.SET_PED_CAN_BE_DRAGGED_OUT, playerPed, !CantBeDraggedOutOfVehicle_);
            Function.Call(Hash.SET_PED_CONFIG_FLAG, playerPed, 32, !CantFlyThroughWindscreen_);
        };
        KeyDown += delegate(object o, KeyEventArgs e)
        {
            if (e.KeyCode == OpenMenu)
            {
                mainMenu.Visible = !mainMenu.Visible;
            }
        };
    }
Esempio n. 20
0
        public Main()
        {
            // Load config
            try
            {
                string         configPath = Path.Combine("scripts", "rcbomb_config.ini");
                ScriptSettings config     = ScriptSettings.Load(configPath);

                if (File.Exists(configPath))
                {
                    ShowControls    = config.GetValue("CONFIG", "ShowControls", true);
                    FPSCamera       = config.GetValue("CONFIG", "FPSCamera", false);
                    MaxDistance     = config.GetValue("CONFIG", "MaxDistance", 200.0f);
                    SpawnControl    = config.GetValue("CONTROLS", "SpawnControl", 51);
                    DetonateControl = config.GetValue("CONTROLS", "DetonateControl", 47);
                }
                else
                {
                    config.SetValue("CONFIG", "ShowControls", ShowControls);
                    config.SetValue("CONFIG", "FPSCamera", FPSCamera);
                    config.SetValue("CONFIG", "MaxDistance", MaxDistance);
                    config.SetValue("CONTROLS", "SpawnControl", SpawnControl);
                    config.SetValue("CONTROLS", "DetonateControl", DetonateControl);
                }

                config.Save();
            }
            catch (Exception e)
            {
                UI.Notify($"~r~RCBomb settings error: {e.Message}");
            }

            // Credits to jedijosh920 for this bannerless menu trick
            RCMenuPool = new MenuPool();

            RCSpawnerMenu = new UIMenu("", "SELECT A MODEL", new Point(0, -107));
            RCSpawnerMenu.SetBannerType(new UIResRectangle(Point.Empty, Size.Empty, Color.Empty));

            // This makes me cry
            RCSpawnerMenu.AddItem(new UIMenuItem("Stock"));
            RCSpawnerMenu.AddItem(new UIMenuItem("Offroad"));
            RCSpawnerMenu.AddItem(new UIMenuItem("Offroad & Spoiler"));
            RCSpawnerMenu.AddItem(new UIMenuItem("Offroad & Nets"));
            RCSpawnerMenu.AddItem(new UIMenuItem("Offroad Combined"));
            RCSpawnerMenu.AddItem(new UIMenuItem("Trophy Truck"));
            RCSpawnerMenu.AddItem(new UIMenuItem("Trophy Truck & Spoiler"));
            RCSpawnerMenu.AddItem(new UIMenuItem("Trophy Truck & Nets"));
            RCSpawnerMenu.AddItem(new UIMenuItem("Trophy Truck Combined"));
            RCSpawnerMenu.AddItem(new UIMenuItem("Gang Burrito"));
            RCSpawnerMenu.AddItem(new UIMenuItem("Gang Burrito & Spoiler"));
            RCSpawnerMenu.AddItem(new UIMenuItem("Gang Burrito & Bullbar"));
            RCSpawnerMenu.AddItem(new UIMenuItem("Gang Burrito Combined"));
            RCSpawnerMenu.AddItem(new UIMenuItem("Big Brat"));
            RCSpawnerMenu.AddItem(new UIMenuItem("Big Brat & Cage"));
            RCSpawnerMenu.AddItem(new UIMenuItem("Big Brat & Bullbar"));
            RCSpawnerMenu.AddItem(new UIMenuItem("Big Brat Combined"));
            RCSpawnerMenu.AddItem(new UIMenuItem("Midnight Pumping"));
            RCSpawnerMenu.AddItem(new UIMenuItem("Midnight Pumping & Cage"));
            RCSpawnerMenu.AddItem(new UIMenuItem("Midnight Pumping & Flames"));
            RCSpawnerMenu.AddItem(new UIMenuItem("Midnight Pumping Combined"));
            RCMenuPool.Add(RCSpawnerMenu);

            // Set up event handlers
            Tick    += Script_Tick;
            Aborted += Script_Aborted;
            RCSpawnerMenu.OnItemSelect += RCSpawnerMenu_ItemSelected;
        }
Esempio n. 21
0
        public Main()
        {
            string modFolder  = Path.Combine("scripts", "pizzaboy");
            string langFolder = Path.Combine(modFolder, "lang");

            // Create folders
            try
            {
                if (!Directory.Exists(modFolder))
                {
                    Directory.CreateDirectory(modFolder);
                }
                if (!Directory.Exists(langFolder))
                {
                    Directory.CreateDirectory(langFolder);
                }
            }
            catch (Exception e)
            {
                UI.Notify($"~r~Folder error: ~w~{e.Message}");
            }

            // Load player settings
            try
            {
                string         settingsFilePath = Path.Combine(modFolder, "config.ini");
                ScriptSettings config           = ScriptSettings.Load(settingsFilePath);

                if (File.Exists(settingsFilePath))
                {
                    JobToggleKey         = config.GetValue("SETTINGS", "JobToggleKey", 176);
                    ThrowLeftKey         = config.GetValue("SETTINGS", "ThrowLKey", 174);
                    ThrowRightKey        = config.GetValue("SETTINGS", "ThrowRKey", 175);
                    DeliveryVehicleModel = config.GetValue("SETTINGS", "VehModel", VehicleHash.Faggio2);
                    CustomerMarkers      = config.GetValue("SETTINGS", "CustomerMarkers", true);
                    JobSeconds           = config.GetValue("SETTINGS", "JobSeconds", 300);
                    MaxCustomers         = config.GetValue("SETTINGS", "MaxCustomers", 10);
                    BoxCount             = config.GetValue("SETTINGS", "BoxCount", 5);
                    RewardBase           = config.GetValue("SETTINGS", "RewardBase", 10);
                    RewardMax            = config.GetValue("SETTINGS", "RewardMax", 30);
                    Language             = config.GetValue("SETTINGS", "Language", "en");
                }
                else
                {
                    config.SetValue("SETTINGS", "JobToggleKey", JobToggleKey);
                    config.SetValue("SETTINGS", "ThrowLKey", ThrowLeftKey);
                    config.SetValue("SETTINGS", "ThrowRKey", ThrowRightKey);
                    config.SetValue("SETTINGS", "VehModel", DeliveryVehicleModel);
                    config.SetValue("SETTINGS", "CustomerMarkers", CustomerMarkers);
                    config.SetValue("SETTINGS", "JobSeconds", JobSeconds);
                    config.SetValue("SETTINGS", "MaxCustomers", MaxCustomers);
                    config.SetValue("SETTINGS", "BoxCount", BoxCount);
                    config.SetValue("SETTINGS", "RewardBase", RewardBase);
                    config.SetValue("SETTINGS", "RewardMax", RewardMax);
                    config.SetValue("SETTINGS", "Language", Language);
                }

                config.Save();
            }
            catch (Exception e)
            {
                UI.Notify($"~r~Settings error: ~w~{e.Message}");
            }

            // Load language file
            try
            {
                string   languageFilePath = Path.Combine(langFolder, $"{Language}.xml");
                XElement langFile         = XElement.Load(languageFilePath);
                Localization.Strings = langFile.Elements().ToDictionary(key => key.Name.LocalName, val => val.Value);
            }
            catch (Exception e)
            {
                UI.Notify($"~r~Language error ({Language}): ~w~{e.Message}.");
            }

            // Create pizza store blips
            foreach (Vector3 position in Constants.StoreCoords)
            {
                Blip blip = World.CreateBlip(position);
                blip.Sprite       = (BlipSprite)267;
                blip.Color        = (BlipColor)25;
                blip.IsShortRange = true;
                blip.Scale        = 1.0f;
                blip.Name         = Localization.Get("STORE_NAME");

                StoreBlips.Add(blip);
            }

            // Set up events
            Tick    += ScriptTick;
            Aborted += ScriptAborted;
        }
 public static void LoadSettings()
 {
     if (!Directory.Exists("./scripts/CWDM/"))
     {
         Directory.CreateDirectory("./scripts/CWDM/");
     }
     if (!Directory.Exists("./scripts/CWDM/SaveGame/"))
     {
         Directory.CreateDirectory("./scripts/CWDM/SaveGame/");
     }
     if (!Directory.Exists("./scripts/CWDM/Settings/"))
     {
         Directory.CreateDirectory("./scripts/CWDM/Settings/");
     }
     if (!Directory.Exists("./scripts/CWDM/Logs/"))
     {
         Directory.CreateDirectory("./scripts/CWDM/Logs/");
     }
     if (!File.Exists("./scripts/CWDM/Settings/CountryVehicles.lst"))
     {
         File.WriteAllLines("./scripts/CWDM/Settings/CountryVehicles.lst", Population.CountryVehicleModels);
     }
     if (!File.Exists("./scripts/CWDM/Settings/CityVehicles.lst"))
     {
         File.WriteAllLines("./scripts/CWDM/Settings/CityVehicles.lst", Population.CityVehicleModels);
     }
     if (!File.Exists("./scripts/CWDM/Settings/Zombies.lst"))
     {
         File.WriteAllLines("./scripts/CWDM/Settings/Zombies.lst", Population.ZombieModels);
     }
     if (!File.Exists("./scripts/CWDM/Settings/Survivors.lst"))
     {
         File.WriteAllLines("./scripts/CWDM/Settings/Survivors.lst", Population.SurvivorModels);
     }
     if (!File.Exists("./scripts/CWDM/Settings/CityAnimals.lst"))
     {
         File.WriteAllLines("./scripts/CWDM/Settings/CityAnimals.lst", Population.CityAnimalModels);
     }
     if (!File.Exists("./scripts/CWDM/Settings/CountryAnimals.lst"))
     {
         File.WriteAllLines("./scripts/CWDM/Settings/CountryAnimals.lst", Population.CountryAnimalModels);
     }
     if (File.Exists("./scripts/CWDM/Settings/Settings.ini"))
     {
         Settings                        = ScriptSettings.Load("./scripts/CWDM/Settings/Settings.ini");
         Main.MenuKey                    = Settings.GetValue("hotkeys", "menu_key", Keys.F10);
         Main.InventoryKey               = Settings.GetValue("hotkeys", "inventory_key", Keys.I);
         Population.spawnVehicles        = Settings.GetValue("world", "enable_abandoned_vehicles", true);
         Population.spawnSurvivors       = Settings.GetValue("world", "enable_survivors", true);
         Population.spawnAnimals         = Settings.GetValue("world", "enable_animals", true);
         Population.zombieHealth         = Settings.GetValue("world", "zombie_health", 750);
         Population.survivorHealth       = Settings.GetValue("world", "survivor_health", 750);
         Population.maxZombies           = Settings.GetValue("world", "max_zombies", 30);
         Population.maxVehicles          = Settings.GetValue("world", "max_vehicles", 10);
         Population.maxAnimals           = Settings.GetValue("world", "max_animals", 5);
         Population.doubleCityPopulation = Settings.GetValue("world", "enable_double_city_population", true);
         Population.survivorTime         = Settings.GetValue("world", "survivor_spawn_time", 5);
         Population.minSpawnDistance     = Settings.GetValue("world", "min_spawn_distance", 50);
         Population.maxSpawnDistance     = Settings.GetValue("world", "max_spawn_distance", 100);
         Population.customCityVehicles   = Settings.GetValue("world", "enable_custom_city_vehicles", false);
         Population.customCityVehicles   = Settings.GetValue("world", "enable_custom_country_vehicles", false);
         Population.customZombies        = Settings.GetValue("world", "enable_custom_zombies", false);
         Population.customSurvivors      = Settings.GetValue("world", "enable_custom_survivors", false);
         Population.customCityAnimals    = Settings.GetValue("world", "enable_custom_city_animals", false);
         Population.customCountryAnimals = Settings.GetValue("world", "enable_custom_country_animals", false);
         Character.hungerDecrease        = Settings.GetValue("player", "hunger_rate", 0.0004f);
         Character.thirstDecrease        = Settings.GetValue("player", "thirst_rate", 0.0008f);
         Character.energyDecrease        = Settings.GetValue("player", "energy_rate", 0.0002f);
     }
     else
     {
         Settings = ScriptSettings.Load("./scripts/CWDM/Settings/Settings.ini");
         Settings.SetValue("hotkeys", "menu_key", Keys.F10);
         Settings.SetValue("hotkeys", "inventory_key", Keys.I);
         Settings.SetValue("world", "enable_abandoned_vehicles", true);
         Settings.SetValue("world", "enable_survivors", true);
         Settings.SetValue("world", "enable_animals", true);
         Settings.SetValue("world", "zombie_health", 750);
         Settings.SetValue("world", "survivor_health", 100);
         Settings.SetValue("world", "max_zombies", 30);
         Settings.SetValue("world", "max_vehicles", 10);
         Settings.SetValue("world", "max_animals", 5);
         Settings.SetValue("world", "enable_double_city_population", true);
         Settings.SetValue("world", "survivor_spawn_time", 5);
         Settings.SetValue("world", "min_spawn_distance", 50);
         Settings.SetValue("world", "max_spawn_distance", 100);
         Settings.SetValue("world", "enable_custom_city_vehicles", false);
         Settings.SetValue("world", "enable_custom_country_vehicles", false);
         Settings.SetValue("world", "enable_custom_zombies", false);
         Settings.SetValue("world", "enable_custom_survivors", false);
         Settings.SetValue("world", "enable_custom_city_animals", false);
         Settings.SetValue("world", "enable_custom_country_animals", false);
         Settings.SetValue("player", "hunger_rate", 0.0004f);
         Settings.SetValue("player", "thirst_rate", 0.0008f);
         Settings.SetValue("player", "energy_rate", 0.0002f);
         Main.MenuKey                    = Settings.GetValue("hotkeys", "menu_key", Keys.F10);
         Main.InventoryKey               = Settings.GetValue("hotkeys", "inventory_key", Keys.I);
         Population.spawnVehicles        = Settings.GetValue("world", "enable_abandoned_vehicles", true);
         Population.spawnSurvivors       = Settings.GetValue("world", "enable_survivors", true);
         Population.spawnAnimals         = Settings.GetValue("world", "enable_animals", true);
         Population.zombieHealth         = Settings.GetValue("world", "zombie_health", 750);
         Population.zombieHealth         = Settings.GetValue("world", "zombie_health", 750);
         Population.survivorHealth       = Settings.GetValue("world", "survivor_health", 750);
         Population.maxZombies           = Settings.GetValue("world", "max_zombies", 30);
         Population.maxVehicles          = Settings.GetValue("world", "max_vehicles", 10);
         Population.maxAnimals           = Settings.GetValue("world", "max_animals", 5);
         Population.doubleCityPopulation = Settings.GetValue("world", "enable_double_city_population", true);
         Population.survivorTime         = Settings.GetValue("world", "survivor_spawn_time", 5);
         Population.minSpawnDistance     = Settings.GetValue("world", "min_spawn_distance", 50);
         Population.maxSpawnDistance     = Settings.GetValue("world", "max_spawn_distance", 100);
         Population.customCityVehicles   = Settings.GetValue("world", "enable_custom_city_vehicles", false);
         Population.customCityVehicles   = Settings.GetValue("world", "enable_custom_country_vehicles", false);
         Population.customZombies        = Settings.GetValue("world", "enable_custom_zombies", false);
         Population.customSurvivors      = Settings.GetValue("world", "enable_custom_survivors", false);
         Population.customCityAnimals    = Settings.GetValue("world", "enable_custom_city_animals", false);
         Population.customCountryAnimals = Settings.GetValue("world", "enable_custom_country_animals", false);
         Character.hungerDecrease        = Settings.GetValue("player", "hunger_rate", 0.0004f);
         Character.thirstDecrease        = Settings.GetValue("player", "thirst_rate", 0.0008f);
         Character.energyDecrease        = Settings.GetValue("player", "energy_rate", 0.0002f);
         Settings.Save();
     }
     if (Population.customCityVehicles == true)
     {
         try
         {
             Population.CityVehicleModels = File.ReadAllLines("./scripts/CWDM/Settings/CityVehicles.lst").ToList();
         }
         catch (Exception x)
         {
             Debug.Log(x.ToString());
         }
     }
     if (Population.customCountryVehicles == true)
     {
         try
         {
             Population.CountryVehicleModels = File.ReadAllLines("./scripts/CWDM/Settings/CountryVehicles.lst").ToList();
         }
         catch (Exception x)
         {
             Debug.Log(x.ToString());
         }
     }
     if (Population.customZombies == true)
     {
         try
         {
             Population.ZombieModels = File.ReadAllLines("./scripts/CWDM/Settings/Zombies.lst").ToList();
         }
         catch (Exception x)
         {
             Debug.Log(x.ToString());
         }
     }
     if (Population.customSurvivors == true)
     {
         try
         {
             Population.SurvivorModels = File.ReadAllLines("./scripts/CWDM/Settings/Survivors.lst").ToList();
         }
         catch (Exception x)
         {
             Debug.Log(x.ToString());
         }
     }
     if (Population.customCountryAnimals == true)
     {
         try
         {
             Population.CountryAnimalModels = File.ReadAllLines("./scripts/CWDM/Settings/CountryAnimals.lst").ToList();
         }
         catch (Exception x)
         {
             Debug.Log(x.ToString());
         }
     }
     if (Population.customCityAnimals == true)
     {
         try
         {
             Population.CityAnimalModels = File.ReadAllLines("./scripts/CWDM/Settings/CityAnimals.lst").ToList();
         }
         catch (Exception x)
         {
             Debug.Log(x.ToString());
         }
     }
 }
Esempio n. 23
0
        public Main()
        {
            // Load settings
            try
            {
                string         configFile = Path.Combine("scripts", "spoutfit_config.ini");
                ScriptSettings config     = ScriptSettings.Load(configFile);

                if (File.Exists(configFile))
                {
                    MenuKey   = config.GetValue("KEYS", "Menu", Keys.O);
                    DeleteKey = config.GetValue("KEYS", "Delete", Keys.Delete);
                }
                else
                {
                    config.SetValue("KEYS", "Menu", MenuKey);
                    config.SetValue("KEYS", "Delete", DeleteKey);
                }

                config.Save();
            }
            catch (Exception e)
            {
                UI.Notify($"~r~SPOutfit settings error: {e.Message}");
            }

            // Load outfits
            try
            {
                string outfitsPath = Path.Combine("scripts", "outfits");
                if (!Directory.Exists(outfitsPath))
                {
                    Directory.CreateDirectory(outfitsPath);
                }

                string[] files = Directory.GetFiles(outfitsPath, "*.xml", SearchOption.TopDirectoryOnly);
                foreach (string file in files)
                {
                    try
                    {
                        Outfit outfit = XmlUtil.Deserialize <Outfit>(File.ReadAllText(file));
                        outfit.FilePath = file;

                        AllOutfits.Add(outfit);
                    }
                    catch (Exception e)
                    {
                        UI.Notify($"~r~Outfit reading error: {e.Message} ({file})");
                    }
                }
            }
            catch (Exception e)
            {
                UI.Notify($"~r~Outfit loading error: {e.Message}");
            }

            // Set up menus
            OutfitsMenuPool = new MenuPool();
            OutfitsMainMenu = new UIMenu("", "OUTFITS MENU");
            OutfitsListMenu = new UIMenu("", "SAVED OUTFITS");

            UIMenuItem linkItem = new UIMenuItem("List", "See all of your saved outfits for the current character.");
            UIMenuItem saveItem = new UIMenuItem("Save", "Save your current outfit.");

            OutfitsMainMenu.AddItem(linkItem);
            OutfitsMainMenu.AddItem(saveItem);

            OutfitsMainMenu.BindMenuToItem(OutfitsListMenu, linkItem);
            OutfitsMenuPool.Add(OutfitsMainMenu);
            OutfitsMenuPool.Add(OutfitsListMenu);

            // Handle save item being selected
            saveItem.Activated += (menu, item) =>
            {
                string outfitName = Game.GetUserInput(WindowTitle.FMMC_KEY_TIP9N, 16).Trim();
                if (outfitName.Length < 1)
                {
                    UI.Notify("~r~You didn't write a name!");
                    return;
                }

                if (outfitName.IndexOfAny(Path.GetInvalidFileNameChars()) != -1)
                {
                    UI.Notify("~r~Your outfit name contains not allowed characters.");
                    return;
                }

                Character currentCharacter = Methods.GetCurrentCharacter();
                if (CharacterOutfits.FirstOrDefault(o => o.Name == outfitName) != null)
                {
                    UI.Notify($"~r~Outfit \"{outfitName}\" already exists for {currentCharacter}!");
                    return;
                }

                try
                {
                    string path      = Path.Combine("scripts", "outfits", $"{currentCharacter}_{outfitName}.xml");
                    Outfit newOutfit = Methods.GetCurrentOutfit();
                    newOutfit.Name      = outfitName;
                    newOutfit.Character = currentCharacter;
                    newOutfit.FilePath  = path;

                    AllOutfits.Add(newOutfit);
                    CharacterOutfits.Add(newOutfit);
                    CharacterOutfits = CharacterOutfits.OrderBy(o => o.Name).ToList();

                    OutfitsListMenu.Clear();
                    foreach (Outfit outfit in CharacterOutfits)
                    {
                        OutfitsListMenu.AddItem(new UIMenuItem(outfit.Name));
                    }
                    OutfitsListMenu.RefreshIndex();

                    File.WriteAllText(path, newOutfit.Serialize());
                    UI.Notify($"Outfit \"{outfitName}\" saved for {currentCharacter}.");
                }
                catch (Exception e)
                {
                    UI.Notify($"~r~Outfit saving failed: {e.Message}");
                }
            };

            // Handle the transition from main to the list menu
            OutfitsMainMenu.OnMenuChange += (oldMenu, newMenu, forward) =>
            {
                if (forward && newMenu == OutfitsListMenu && CharacterOutfits.Count > 0)
                {
                    int outfitItemIdx = newMenu.CurrentSelection;
                    if (outfitItemIdx >= CharacterOutfits.Count)
                    {
                        outfitItemIdx = 0;
                        newMenu.RefreshIndex();
                    }

                    Outfit outfit = CharacterOutfits.FirstOrDefault(o => o.Name == newMenu.MenuItems[outfitItemIdx].Text);
                    if (outfit == null)
                    {
                        UI.Notify("~r~Invalid outfit selected.");
                        return;
                    }

                    outfit.Apply();
                }
            };

            // Handle selection change on the list menu
            OutfitsListMenu.OnIndexChange += (menu, index) =>
            {
                Outfit outfit = CharacterOutfits.FirstOrDefault(o => o.Name == menu.MenuItems[index].Text);
                if (outfit == null)
                {
                    UI.Notify("~r~Invalid outfit selected.");
                    return;
                }

                outfit.Apply();
            };

            // Handle outfit selecting
            OutfitsListMenu.OnItemSelect += (menu, item, index) =>
            {
                Outfit outfit = CharacterOutfits.FirstOrDefault(o => o.Name == item.Text);
                if (outfit == null)
                {
                    UI.Notify("~r~Invalid outfit selected.");
                    return;
                }

                outfit.Apply();
                TempOutfit = outfit;

                UI.Notify($"Now wearing: {outfit.Name}.");
            };

            // Handle the list menu being closed
            OutfitsListMenu.OnMenuClose += (menu) =>
            {
                TempOutfit.Apply();
            };

            OutfitsMenuPool.RefreshIndex();

            // Set up events
            Tick    += ScriptTick;
            KeyUp   += ScriptKeyUp;
            Aborted += ScriptAborted;
        }
Esempio n. 24
0
 public static void SetValue(UserIndex player, string key, string value)
 {
     settings.SetValue(PlayerKey + player, key, value);
     settings.Save();
     settings = ScriptSettings.Load("scripts//" + TwoPlayerMod.ScriptName + ".ini");
 }
Esempio n. 25
0
        public Main()
        {
            // Load settings
            try
            {
                string         configFile = Path.Combine("scripts", "methoperation_config.ini");
                ScriptSettings config     = ScriptSettings.Load(configFile);

                if (File.Exists(configFile))
                {
                    InteractionControl    = config.GetValue("CONFIG", "INTERACTION_CONTROL", 51);
                    MissionTime           = config.GetValue("CONFIG", "MISSION_TIME", 15);
                    ProductionTime        = config.GetValue("CONFIG", "PRODUCTION_TIME", 6);
                    PoliceChance          = config.GetValue("CONFIG", "POLICE_CHANCE", 15);
                    PoliceStars           = config.GetValue("CONFIG", "POLICE_STARS", 2);
                    EquipmentUpgradePrice = config.GetValue("PRICES", "EQUIPMENT_UPGRADE", 1100000);
                    StaffUpgradePrice     = config.GetValue("PRICES", "STAFF_UPGRADE", 331500);
                    SecurityUpgradePrice  = config.GetValue("PRICES", "SECURITY_UPGRADE", 513000);
                    ProductValue          = config.GetValue("PRICES", "PRODUCT_VALUE", 8500);
                }
                else
                {
                    config.SetValue("CONFIG", "INTERACTION_CONTROL", InteractionControl);
                    config.SetValue("CONFIG", "MISSION_TIME", MissionTime);
                    config.SetValue("CONFIG", "PRODUCTION_TIME", ProductionTime);
                    config.SetValue("CONFIG", "POLICE_CHANCE", PoliceChance);
                    config.SetValue("CONFIG", "POLICE_STARS", PoliceStars);
                    config.SetValue("PRICES", "EQUIPMENT_UPGRADE", EquipmentUpgradePrice);
                    config.SetValue("PRICES", "STAFF_UPGRADE", StaffUpgradePrice);
                    config.SetValue("PRICES", "SECURITY_UPGRADE", SecurityUpgradePrice);
                    config.SetValue("PRICES", "PRODUCT_VALUE", ProductValue);

                    // this will cause an exception when writing to Program Files folder
                    config.Save();
                }
            }
            catch (Exception e)
            {
                UI.Notify($"~r~MethOperation settings error: {e.Message}");
            }

            // Set up NativeUI
            ManagementMenuPool      = new MenuPool();
            ManagementMain          = new UIMenu("Meth Lab", string.Empty);
            UpgradesMenu            = new UIMenu("Meth Lab", "~b~UPGRADES");
            SaleConfirmationMenu    = new UIMenu("Meth Lab", "~b~PRODUCT SALE CONFIRMATION");
            LabSaleConfirmationMenu = new UIMenu("Meth Lab", "~b~LAB SALE CONFIRMATION");

            // Upgrades menu
            UIMenuItem tempItem = new UIMenuItem("Equipment Upgrade", "Buy better equipment to speed up the production. ~r~No refunds!");

            tempItem.SetRightLabel($"${EquipmentUpgradePrice:N0}");
            UpgradesMenu.AddItem(tempItem);

            tempItem = new UIMenuItem("Staff Upgrade", "Hire more people to speed up the production. ~r~No refunds!");
            tempItem.SetRightLabel($"${StaffUpgradePrice:N0}");
            UpgradesMenu.AddItem(tempItem);

            tempItem = new UIMenuItem("Security Upgrade", "Eyes and ears in the lab to enforce discipline. ~r~No refunds!");
            tempItem.SetRightLabel($"${SecurityUpgradePrice:N0}");
            UpgradesMenu.AddItem(tempItem);

            // Product sale confirmation menu
            SaleConfirmationMenu.AddItem(new UIMenuItem("Confirm", "Start a delivery mission to sell your product. ~r~All product will be lost if you fail!"));
            SaleConfirmationMenu.AddItem(new UIMenuItem("Cancel", "Go back to the management menu."));

            // Lab sale confirmation menu
            LabSaleConfirmationMenu.AddItem(new UIMenuItem("Confirm", "You'll get the amount displayed on right. ~r~Upgrades and all produced meth will be lost!"));
            LabSaleConfirmationMenu.AddItem(new UIMenuItem("Cancel", "Go back to the management menu."));

            ManagementMenuPool.Add(ManagementMain);
            ManagementMenuPool.Add(UpgradesMenu);
            ManagementMenuPool.Add(SaleConfirmationMenu);
            ManagementMenuPool.Add(LabSaleConfirmationMenu);

            // Set up event handlers
            EnteredMethLab += Script_EnteredMethLab;
            LeftMethLab    += Script_LeftMethLab;

            ManagementMain.OnItemSelect          += ManagementMain_ItemSelected;
            UpgradesMenu.OnItemSelect            += UpgradesMenu_ItemSelected;
            SaleConfirmationMenu.OnItemSelect    += SaleConfirmationMenu_ItemSelected;
            LabSaleConfirmationMenu.OnItemSelect += LabSaleConfirmationMenu_ItemSelected;

            Tick    += Script_Tick;
            Aborted += Script_Aborted;
        }
Esempio n. 26
0
    public void CreateMenu(UIMenu menu)
    {
        // refresh button to scan for new blips
        // destroys and recreates menu
        UIMenuItem description_button = new UIMenuItem("Description", "Select the markers that you want to be displayed in the game world. Only 15 total markers can be displayed at one time, so if a marker is not showing up in the world, try unchecking other enabled markers.");

        menu.AddItem(description_button);

        // refresh button to scan for new blips
        // destroys and recreates menu
        UIMenuItem refresh_button = new UIMenuItem("Refresh", "The Marker list doesn't refresh automatically when you move around, so refresh it to re-populate with the most recent available markers");

        menu.AddItem(refresh_button);
        menu.OnItemSelect += (sender, item, index) =>
        {
            if (item == refresh_button)
            {
                CreateNewMenu();
                mainMenu.Visible = true;
            }
        };

        // scan for all active blips
        // create a list of all unique blip names
        active_blips = World.GetActiveBlips();
        List <string> blip_names = new List <string>();

        foreach (Blip b in active_blips)
        {
            string tmp_name = b.Sprite.ToString().ToUpper();
            if (!blip_names.Contains(tmp_name))
            {
                blip_names.Add(tmp_name);
            }
        }

        // alphabetize list
        blip_names.Sort();

        // iterate through list, create menu item for each unique blip name
        // set value to ini value
        foreach (string blip_name in blip_names)
        {
            // read ini, default to disabled if not found
            string enable_disable = config.GetValue <string>("options", blip_name, "disabled");
            bool   ed             = false;
            if (enable_disable == "enabled")
            {
                ed = true;
            }
            var newitem = new UIMenuCheckboxItem(blip_name, ed, "show " + blip_name + " in world");
            menu.AddItem(newitem);
            menu.OnCheckboxChange += (sender, item, checked_) =>
            {
                if (item == newitem)
                {
                    string tmp_string = "enabled";
                    if (!checked_)
                    {
                        tmp_string = "disabled";
                    }
                    config.SetValue("options", item.Text.ToUpper(), tmp_string);
                    UI.Notify(item.Text.ToUpper() + " is " + tmp_string);
                    config.Save();
                }
            };
        }
    }