Exemple #1
0
        /// <summary>
        /// Initializes the module
        /// </summary>
        public override void Initialize()
        {
            Config = FuelConfig.FromFile();
            foreach (string Pump in Config.FuelPumpModels)
            {
                PumpModels.Add(new Model(Pump));
            }
            foreach (string Vehicle in Config.VehicleBlacklist)
            {
                BlacklistedModels.Add(new Model(Vehicle));
            }

            // Create all of the gas station blips
            foreach (Vector3 Station in Config.GasStationBlips)
            {
                Blip NewBlip = World.CreateBlip(Station);
                NewBlip.Sprite       = BlipSprite.JerryCan;
                NewBlip.Name         = "Gas Station";
                NewBlip.Color        = BlipColor.Red;
                NewBlip.IsShortRange = true;
                Blips.Add(NewBlip);
            }
        }
Exemple #2
0
        /// <summary>
        /// Loads the configuration from XML
        /// </summary>
        /// <returns></returns>
        public static FuelConfig FromFile()
        {
            XmlSerializer Serializer = new XmlSerializer(typeof(FuelConfig));

            if (File.Exists($"{Globals.FuelPath}\\Config.xml"))
            {
                FileStream Stream = new FileStream($"{Globals.FuelPath}\\Config.xml", FileMode.Open);
                FuelConfig Config = (FuelConfig)Serializer.Deserialize(Stream);
                Stream.Close();
                return(Config);
            }
            else
            {
                FileStream Stream = new FileStream($"{Globals.FuelPath}\\Config.xml", FileMode.CreateNew);
                FuelConfig Config = new FuelConfig()
                {
                    AccelerateDepletion = 0.0075f,
                    IdleDepletion       = 0.00025f,
                    DecelerateDepletion = 0.0015f,
                    MinimumPriceChange  = -15,
                    MaximumPriceChange  = 15,
                    VehicleBlacklist    = new List <string>()
                    {
                        "raiden",
                        "cyclone",
                        "voltic",
                        "caddy",
                        "caddy2",
                        "caddy3",
                        "surge",
                        "khamelion",
                        "airtug",
                        "neon",
                        "tezeract",
                        "airtug",
                        "imorgon"
                    },
                    FuelPumpModels = new List <string>()
                    {
                        "prop_gas_pump_1a",
                        "prop_gas_pump_1b",
                        "prop_gas_pump_1c",
                        "prop_gas_pump_1d",
                        "prop_gas_pump_old1",
                        "prop_gas_pump_old2",
                        "prop_gas_pump_old3",
                        "prop_vintage_pump"
                    },
                    GasStationBlips = new List <Vector3>()
                    {
                        new Vector3(1211.756f, -1407.93f, 34.67278f),
                        new Vector3(-1434.403f, -282.7147f, 45.72723f),
                        new Vector3(-74.86875f, -1755.578f, 29.11153f),
                        new Vector3(1183.869f, -327.3409f, 68.69455f),
                        new Vector3(614.7054f, 273.5178f, 102.6092f),
                        new Vector3(2590.615f, 358.7582f, 107.9775f),
                        new Vector3(1686.468f, 4930.328f, 41.59781f),
                        new Vector3(-2557.833f, 2331.427f, 32.5805f),
                        new Vector3(-1806.12f, 801.3314f, 138.0324f),
                        new Vector3(2007.822f, 3778.583f, 31.70061f),
                        new Vector3(1704.573f, 6412.813f, 32.277f),
                        new Vector3(-95.43013f, 6415.329f, 31.00079f),
                        new Vector3(174.8102f, 6603.814f, 31.36695f),
                        new Vector3(153.1613f, 6628.985f, 31.23245f),
                        new Vector3(263.78f, 2604.741f, 44.39055f),
                        new Vector3(47.44701f, 2777.335f, 57.40466f),
                        new Vector3(2676.54f, 3263.63f, 54.76064f),
                        new Vector3(-2094.415f, -320.5872f, 12.54607f),
                        new Vector3(266.9666f, -1253.497f, 28.51884f),
                        new Vector3(1788.137f, 3330.988f, 40.96835f),
                        new Vector3(1210.248f, 2660.764f, 37.50904f),
                        new Vector3(1043.307f, 2672.588f, 39.24903f),
                        new Vector3(-721.3615f, -932.5006f, 18.71538f),
                        new Vector3(821.1265f, -1030.986f, 25.87164f),
                        new Vector3(2536.900f, 2594.227f, 37.52017f),
                        new Vector3(167.4295f, -1560.498f, 28.98856f)
                    }
                };
                Serializer.Serialize(Stream, Config);
                Stream.Close();
                return(Config);
            }
        }