Skip to content

Commit c3ad0cd

Browse files
committed
fix pr
1 parent d4e07a6 commit c3ad0cd

File tree

2 files changed

+489
-73
lines changed

2 files changed

+489
-73
lines changed

vMenu/CommonFunctions.cs

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1445,6 +1445,14 @@ private static async void ApplyVehicleModsDelayed(Vehicle vehicle, VehicleInfo v
14451445
{
14461446
vehicle.Mods.PrimaryColor = (VehicleColor)vehicleInfo.colors["primary"];
14471447
}
1448+
if (vehicleInfo.colors.ContainsKey("PrimaryPaintFinish"))
1449+
{
1450+
var pearlColorReset = 0;
1451+
var wheelColorReset = 0;
1452+
GetVehicleExtraColours(vehicle.Handle, ref pearlColorReset, ref wheelColorReset);
1453+
SetVehicleModColor_1(vehicle.Handle, vehicleInfo.colors["PrimaryPaintFinish"], 0, 0);
1454+
SetVehicleExtraColours(vehicle.Handle, pearlColorReset, wheelColorReset);
1455+
}
14481456

14491457
bool useCustomRgbSecondary = vehicleInfo.colors.ContainsKey("customSecondaryR") && vehicleInfo.colors.ContainsKey("customSecondaryG") && vehicleInfo.colors.ContainsKey("customSecondaryB");
14501458
if (useCustomRgbSecondary && vehicleInfo.colors["customSecondaryR"] > 0 && vehicleInfo.colors["customSecondaryG"] > 0 && vehicleInfo.colors["customSecondaryB"] > 0)
@@ -1455,7 +1463,14 @@ private static async void ApplyVehicleModsDelayed(Vehicle vehicle, VehicleInfo v
14551463
{
14561464
vehicle.Mods.SecondaryColor = (VehicleColor)vehicleInfo.colors["secondary"];
14571465
}
1458-
1466+
if (vehicleInfo.colors.ContainsKey("SecondaryPaintFinish"))
1467+
{
1468+
var pearlColorReset = 0;
1469+
var wheelColorReset = 0;
1470+
GetVehicleExtraColours(vehicle.Handle, ref pearlColorReset, ref wheelColorReset);
1471+
SetVehicleModColor_2(vehicle.Handle, vehicleInfo.colors["SecondaryPaintFinish"], 0);
1472+
SetVehicleExtraColours(vehicle.Handle, pearlColorReset, wheelColorReset);
1473+
}
14591474
SetVehicleInteriorColour(vehicle.Handle, vehicleInfo.colors["trim"]);
14601475
SetVehicleDashboardColour(vehicle.Handle, vehicleInfo.colors["dash"]);
14611476

@@ -1472,6 +1487,11 @@ private static async void ApplyVehicleModsDelayed(Vehicle vehicle, VehicleInfo v
14721487

14731488
VehicleOptions.SetHeadlightsColorForVehicle(vehicle, vehicleInfo.headlightColor);
14741489

1490+
bool useCustomRgbHeadlight = vehicleInfo.colors.ContainsKey("customheadlightR") && vehicleInfo.colors.ContainsKey("customheadlightG") && vehicleInfo.colors.ContainsKey("customheadlightB");
1491+
if (useCustomRgbHeadlight)
1492+
{
1493+
SetVehicleXenonLightsCustomColor(vehicle.Handle, vehicleInfo.colors["customheadlightR"], vehicleInfo.colors["customheadlightG"], vehicleInfo.colors["customheadlightB"]);
1494+
}
14751495
vehicle.Mods.NeonLightsColor = System.Drawing.Color.FromArgb(red: vehicleInfo.colors["neonR"], green: vehicleInfo.colors["neonG"], blue: vehicleInfo.colors["neonB"]);
14761496
vehicle.Mods.SetNeonLightsOn(VehicleNeonLight.Left, vehicleInfo.neonLeft);
14771497
vehicle.Mods.SetNeonLightsOn(VehicleNeonLight.Right, vehicleInfo.neonRight);
@@ -1600,7 +1620,13 @@ public static async void SaveVehicle(string updateExistingSavedVehicleName = nul
16001620
{
16011621
GetVehicleCustomPrimaryColour(veh.Handle, ref customPrimaryR, ref customPrimaryG, ref customPrimaryB);
16021622
}
1623+
1624+
if (!string.IsNullOrWhiteSpace($"{veh.State.Get("vMenu:PrimaryPaintFinish")}"))
1625+
{
1626+
colors.Add("PrimaryPaintFinish", Convert.ToInt32((object)veh.State.Get("vMenu:PrimaryPaintFinish")));
1627+
}
16031628

1629+
16041630
colors.Add("customPrimaryR", customPrimaryR);
16051631
colors.Add("customPrimaryG", customPrimaryG);
16061632
colors.Add("customPrimaryB", customPrimaryB);
@@ -1616,9 +1642,24 @@ public static async void SaveVehicle(string updateExistingSavedVehicleName = nul
16161642
GetVehicleCustomSecondaryColour(veh.Handle, ref customSecondaryR, ref customSecondaryG, ref customSecondaryB);
16171643
}
16181644

1645+
if (!string.IsNullOrWhiteSpace($"{veh.State.Get("vMenu:SecondaryPaintFinish")}"))
1646+
{
1647+
colors.Add("SecondaryPaintFinish", Convert.ToInt32((object)veh.State.Get("vMenu:SecondaryPaintFinish")));
1648+
}
1649+
16191650
colors.Add("customSecondaryR", customSecondaryR);
16201651
colors.Add("customSecondaryG", customSecondaryG);
16211652
colors.Add("customSecondaryB", customSecondaryB);
1653+
1654+
int customheadlightR = -1;
1655+
int customheadlightG = -1;
1656+
int customheadlightB = -1;
1657+
if (GetVehicleXenonLightsCustomColor(veh.Handle, ref customheadlightR, ref customheadlightG, ref customheadlightB))
1658+
{
1659+
colors.Add("customheadlightR", customheadlightR);
1660+
colors.Add("customheadlightG", customheadlightG);
1661+
colors.Add("customheadlightB", customheadlightB);
1662+
}
16221663
#endregion
16231664

16241665
var extras = new Dictionary<int, bool>();

0 commit comments

Comments
 (0)