private void UpdateVehicleData() { if (this._vehicleCollection.Count <= 0) { return; } this._vehicleCollection.ToList <VehicleData>().ForEach((Action <VehicleData>)(v => { Vehicle vehicle = this._vehicles.Find((Predicate <Vehicle>)(i => ((Entity)i).get_Handle() == v.Handle)); if (Entity.op_Equality((Entity)vehicle, (Entity)null)) { return; } PlayerVehicles.UpdateDataSpecific(v, vehicle); })); }
public void SaveVehicle(Vehicle vehicle) { if (this._vehicleCollection == null) { this.Deserialize(); } VehicleData vehicleData = this._vehicleCollection.ToList <VehicleData>().Find((Predicate <VehicleData>)(v => v.Handle == ((Entity)vehicle).get_Handle())); if (vehicleData != null) { PlayerVehicles.UpdateDataSpecific(vehicleData, vehicle); this.Serialize(true); } else { // ISSUE: method pointer VehicleNeonLight[] array1 = ((IEnumerable <VehicleNeonLight>)Enumerable.Where <VehicleNeonLight>((IEnumerable <M0>)Enum.GetValues(typeof(VehicleNeonLight)), (Func <M0, bool>) new Func <VehicleNeonLight, bool>((object)vehicle, __methodptr(IsNeonLightsOn)))).ToArray <VehicleNeonLight>(); VehicleMod[] values = (VehicleMod[])Enum.GetValues(typeof(VehicleMod)); List <Tuple <VehicleMod, int> > mods = new List <Tuple <VehicleMod, int> >(); ((IEnumerable <VehicleMod>)values).ToList <VehicleMod>().ForEach((Action <VehicleMod>)(h => { int mod = vehicle.GetMod(h); if (mod == -1) { return; } mods.Add(new Tuple <VehicleMod, int>(h, mod)); })); // ISSUE: method pointer VehicleToggleMod[] array2 = ((IEnumerable <VehicleToggleMod>)Enumerable.Where <VehicleToggleMod>((IEnumerable <M0>)Enum.GetValues(typeof(VehicleToggleMod)), (Func <M0, bool>) new Func <VehicleToggleMod, bool>((object)vehicle, __methodptr(IsToggleModOn)))).ToArray <VehicleToggleMod>(); int handle = ((Entity)vehicle).get_Handle(); Model model = ((Entity)vehicle).get_Model(); int hash = ((Model) ref model).get_Hash(); Vector3 rotation = ((Entity)vehicle).get_Rotation(); Vector3 position = ((Entity)vehicle).get_Position(); VehicleColor primaryColor = vehicle.get_PrimaryColor(); VehicleColor secondaryColor = vehicle.get_SecondaryColor(); int health = ((Entity)vehicle).get_Health(); double engineHealth = (double)vehicle.get_EngineHealth(); double heading = (double)((Entity)vehicle).get_Heading(); VehicleNeonLight[] neonLights = array1; List <Tuple <VehicleMod, int> > mods1 = mods; VehicleToggleMod[] toggleMods = array2; VehicleWindowTint windowTint = vehicle.get_WindowTint(); VehicleWheelType wheelType = vehicle.get_WheelType(); Color neonLightsColor = vehicle.get_NeonLightsColor(); M0 m0_1 = Function.Call <int>((Hash)3150587921134411402L, new InputArgument[1] { InputArgument.op_Implicit(((Entity)vehicle).get_Handle()) }); M0 m0_2 = Function.Call <bool>((Hash) - 5507252750051666468L, new InputArgument[2] { InputArgument.op_Implicit(((Entity)vehicle).get_Handle()), InputArgument.op_Implicit(23) }); M0 m0_3 = Function.Call <bool>((Hash) - 5507252750051666468L, new InputArgument[2] { InputArgument.op_Implicit(((Entity)vehicle).get_Handle()), InputArgument.op_Implicit(24) }); this._vehicleCollection.Add(new VehicleData(handle, hash, rotation, position, primaryColor, secondaryColor, health, (float)engineHealth, (float)heading, neonLights, mods1, toggleMods, windowTint, wheelType, neonLightsColor, (int)m0_1, (bool)m0_2, (bool)m0_3)); this._vehicles.Add(vehicle); ((Entity)vehicle).set_IsPersistent(true); new EntityEventWrapper((Entity)vehicle).Died += new EntityEventWrapper.OnDeathEvent(this.WrapperOnDied); PlayerVehicles.AddBlipToVehicle(vehicle); } }