Skip to content
This repository has been archived by the owner on Aug 24, 2023. It is now read-only.

Commit

Permalink
Fixed to work with the new Valorant crosshair system
Browse files Browse the repository at this point in the history
  • Loading branch information
Haruki1707 committed Aug 24, 2022
1 parent 1b1fce6 commit acb1821
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 17 deletions.
11 changes: 8 additions & 3 deletions ValorantCC/MainWindow.xaml.cs
Expand Up @@ -72,13 +72,18 @@ private void profiles_SelectionChanged(object sender, SelectionChangedEventArgs
SelectedIndex = profiles.SelectedIndex;
SelectedProfile = DataProcessor.ProfileFromIndex(SelectedIndex);

primary_color.SelectedColor = Color.FromRgb(SelectedProfile.Primary.Color.R, SelectedProfile.Primary.Color.G, SelectedProfile.Primary.Color.B);
CrosshairColor primColor = SelectedProfile.Primary.bUseCustomColor ? SelectedProfile.Primary.colorCustom : SelectedProfile.Primary.Color;
primary_color.SelectedColor = Color.FromRgb(primColor.R, primColor.G, primColor.B);
prim_outline_color.SelectedColor = Color.FromRgb(SelectedProfile.Primary.OutlineColor.R, SelectedProfile.Primary.OutlineColor.G, SelectedProfile.Primary.OutlineColor.B);

if (SelectedProfile.aDS == null) SelectedProfile.aDS = SelectedProfile.Primary;
if (SelectedProfile.bUsePrimaryCrosshairForADS) SelectedProfile.aDS.Color = SelectedProfile.Primary.Color;
ads_color.SelectedColor = Color.FromRgb(SelectedProfile.aDS.Color.R, SelectedProfile.aDS.Color.G, SelectedProfile.aDS.Color.B);
CrosshairColor adsColor = SelectedProfile.aDS.bUseCustomColor ? SelectedProfile.aDS.colorCustom : SelectedProfile.aDS.Color;
ads_color.SelectedColor = Color.FromRgb(adsColor.R, adsColor.G, adsColor.B);
ads_outline_color.SelectedColor = Color.FromRgb(SelectedProfile.aDS.OutlineColor.R, SelectedProfile.aDS.OutlineColor.G, SelectedProfile.aDS.OutlineColor.B);
sniper_dot_color.SelectedColor = Color.FromRgb(SelectedProfile.Sniper.CenterDotColor.R, SelectedProfile.Sniper.CenterDotColor.G, SelectedProfile.Sniper.CenterDotColor.B);

CrosshairColor sniperColor = SelectedProfile.Sniper.bUseCustomCenterDotColor ? SelectedProfile.Sniper.centerDotColorCustom : SelectedProfile.Sniper.CenterDotColor;
sniper_dot_color.SelectedColor = Color.FromRgb(sniperColor.R, sniperColor.G, sniperColor.B);
/*if (!sharedProfileResp.HasValue)
{
if (ValCCAPI != null) sharedProfileResp = await ValCCAPI.ObtainSelfSaved();
Expand Down
2 changes: 1 addition & 1 deletion ValorantCC/ValorantCC.csproj
Expand Up @@ -14,7 +14,7 @@
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<AssemblyVersion></AssemblyVersion>
<FileVersion></FileVersion>
<Version>3.2.1</Version>
<Version>3.3</Version>
<SignAssembly>true</SignAssembly>
<AssemblyName>$(MSBuildProjectName)</AssemblyName>
</PropertyGroup>
Expand Down
11 changes: 11 additions & 0 deletions ValorantCC/src/Binder.cs
Expand Up @@ -54,13 +54,20 @@ public partial class CrosshairProfile
public partial class ProfileSettings
{
public CrosshairColor Color { get; set; }
public CrosshairColor colorCustom { get; set; }
public bool bUseCustomColor { get; set; }
public bool bHasOutline { get; set; }
public float OutlineThickness { get; set; }
public CrosshairColor OutlineColor { get; set; }
public float OutlineOpacity { get; set; }
public float CenterDotSize { get; set; }
public float CenterDotOpacity { get; set; }
public bool bDisplayCenterDot { get; set; }
public bool bFadeCrosshairWithFiringError { get; set; }
public bool bShowSpectatedPlayerCrosshair { get; set; }
public bool bHideCrosshair { get; set; }
public bool bTouchCrosshairHighlightEnabled { get; set; }
public CrosshairColor touchCrosshairHighlightColor { get; set; }
public bool bFixMinErrorAcrossWeapons { get; set; }
public LineSettings InnerLines { get; set; }
public LineSettings OuterLines { get; set; }
Expand All @@ -70,6 +77,8 @@ public partial class ProfileSettings
public partial class SniperSettings
{
public CrosshairColor CenterDotColor { get; set; }
public CrosshairColor centerDotColorCustom { get; set; }
public bool bUseCustomCenterDotColor { get; set; }
public float CenterDotSize { get; set; }
public float CenterDotOpacity { get; set; }
public bool bDisplayCenterDot { get; set; }
Expand All @@ -86,6 +95,8 @@ public partial class LineSettings
{
public float LineThickness { get; set; }
public float LineLength { get; set; }
public float LineLengthVertical { get; set; }
public bool bAllowVertScaling { get; set; }
public float LineOffset { get; set; }
public bool bShowMovementError { get; set; }
public bool bShowShootingError { get; set; }
Expand Down
51 changes: 39 additions & 12 deletions ValorantCC/src/Crosshair/CrosshairMain.cs
Expand Up @@ -9,17 +9,24 @@ namespace ValorantCC.src.Crosshair
{
public class CrosshairMain
{
private static Color WhiteColor = new Color { R = 255, G = 255, B = 255 };
public static Data ChangeInActiveProfile(List<Color> Colors, int SelectedIndex, Data UserSettings, ProfileList FetchedProfiles)
{
Utilities.Utils.Log("Updating inactive color");

var SelectedProfile = FetchedProfiles.Profiles[SelectedIndex];
if (!SelectedProfile.bUseAdvancedOptions) SelectedProfile.bUseAdvancedOptions = true;
SelectedProfile.Primary.Color.R = Colors[0].R; SelectedProfile.Primary.Color.G = Colors[0].G; SelectedProfile.Primary.Color.B = Colors[0].B; SelectedProfile.Primary.Color.A = Colors[0].A;
SelectedProfile.Primary.bUseCustomColor = true;
//SelectedProfile.Primary.Color.R = Colors[0].R; SelectedProfile.Primary.Color.G = Colors[0].G; SelectedProfile.Primary.Color.B = Colors[0].B; SelectedProfile.Primary.Color.A = Colors[0].A;
SelectedProfile.Primary.colorCustom.R = Colors[0].R; SelectedProfile.Primary.colorCustom.G = Colors[0].G; SelectedProfile.Primary.colorCustom.B = Colors[0].B; SelectedProfile.Primary.colorCustom.A = Colors[0].A;
SelectedProfile.Primary.OutlineColor.R = Colors[1].R; SelectedProfile.Primary.OutlineColor.G = Colors[1].G; SelectedProfile.Primary.OutlineColor.B = Colors[1].B; SelectedProfile.Primary.OutlineColor.A = Colors[1].A;
SelectedProfile.aDS.Color.R = Colors[2].R; SelectedProfile.aDS.Color.G = Colors[2].G; SelectedProfile.aDS.Color.B = Colors[2].B; SelectedProfile.aDS.Color.A = Colors[2].A;
SelectedProfile.aDS.bUseCustomColor = true;
//SelectedProfile.aDS.Color.R = Colors[2].R; SelectedProfile.aDS.Color.G = Colors[2].G; SelectedProfile.aDS.Color.B = Colors[2].B; SelectedProfile.aDS.Color.A = Colors[2].A;
SelectedProfile.aDS.colorCustom.R = Colors[2].R; SelectedProfile.aDS.colorCustom.G = Colors[2].G; SelectedProfile.aDS.colorCustom.B = Colors[2].B; SelectedProfile.aDS.colorCustom.A = Colors[2].A;
SelectedProfile.aDS.OutlineColor.R = Colors[3].R; SelectedProfile.aDS.OutlineColor.G = Colors[3].G; SelectedProfile.aDS.OutlineColor.B = Colors[3].B; SelectedProfile.aDS.OutlineColor.A = Colors[3].A;
SelectedProfile.Sniper.CenterDotColor.R = Colors[4].R; SelectedProfile.Sniper.CenterDotColor.G = Colors[4].G; SelectedProfile.Sniper.CenterDotColor.B = Colors[4].B; SelectedProfile.Sniper.CenterDotColor.A = Colors[4].A;
SelectedProfile.Sniper.bUseCustomCenterDotColor = true;
//SelectedProfile.Sniper.CenterDotColor.R = Colors[4].R; SelectedProfile.Sniper.CenterDotColor.G = Colors[4].G; SelectedProfile.Sniper.CenterDotColor.B = Colors[4].B; SelectedProfile.Sniper.CenterDotColor.A = Colors[4].A;
SelectedProfile.Sniper.centerDotColorCustom.R = Colors[4].R; SelectedProfile.Sniper.centerDotColorCustom.G = Colors[4].G; SelectedProfile.Sniper.centerDotColorCustom.B = Colors[4].B; SelectedProfile.Sniper.centerDotColorCustom.A = Colors[4].A;
return UserSettings;
}

Expand All @@ -29,33 +36,53 @@ public static Data ChangeActiveProfile(List<Color> Colors, int SelectedIndex, Da
try
{
Stringsetting activeProfileColor = UserSettings.stringSettings.First(setting => setting.settingEnum == "EAresStringSettingName::CrosshairColor");
activeProfileColor.value = Utilities.Utils.ColorToString(Colors[0]);
activeProfileColor.value = Utilities.Utils.ColorToString(WhiteColor);
}
catch
{
Utilities.Utils.Log("User has no entry for CrosshairColor, Creating one...");
UserSettings.stringSettings.Add(new Stringsetting { settingEnum = "EAresStringSettingName::CrosshairColor", value = Utilities.Utils.ColorToString(Colors[0]) });
UserSettings.stringSettings.Add(new Stringsetting { settingEnum = "EAresStringSettingName::CrosshairColor", value = Utilities.Utils.ColorToString(WhiteColor) });
}
finally
{
var SelectedProfile = FetchedProfiles.Profiles[SelectedIndex];
if (!SelectedProfile.bUseAdvancedOptions) SelectedProfile.bUseAdvancedOptions = true;
Utilities.Utils.Log("Removing Old colors.");
UserSettings.stringSettings.RemoveAll(setting => setting.settingEnum == "EAresStringSettingName::CrosshairSniperCenterDotColor");
UserSettings.stringSettings.RemoveAll(setting => setting.settingEnum == "EAresStringSettingName::CrosshairADSColor");
UserSettings.stringSettings.RemoveAll(setting => setting.settingEnum == "EAresStringSettingName::CrosshairColorCustom");
UserSettings.stringSettings.RemoveAll(setting => setting.settingEnum == "EAresStringSettingName::CrosshairOutlineColor");
//UserSettings.stringSettings.RemoveAll(setting => setting.settingEnum == "EAresStringSettingName::CrosshairADSColor");
UserSettings.stringSettings.RemoveAll(setting => setting.settingEnum == "EAresStringSettingName::CrosshairADSColorCustom");
UserSettings.stringSettings.RemoveAll(setting => setting.settingEnum == "EAresStringSettingName::CrosshairADSOutlineColor");
//UserSettings.stringSettings.RemoveAll(setting => setting.settingEnum == "EAresStringSettingName::CrosshairSniperCenterDotColor");
UserSettings.stringSettings.RemoveAll(setting => setting.settingEnum == "EAresStringSettingName::CrosshairSniperCenterDotColorCustom");

UserSettings.boolSettings.RemoveAll(setting => setting.settingEnum == "EAresBoolSettingName::CrosshairUseCustomColor");
UserSettings.boolSettings.RemoveAll(setting => setting.settingEnum == "EAresBoolSettingName::CrosshairADSUseCustomColor");
UserSettings.boolSettings.RemoveAll(setting => setting.settingEnum == "EAresBoolSettingName::CrosshairSniperUseCustomColor");
Utilities.Utils.Log("Appending new colors.");
UserSettings.stringSettings.Add(new Stringsetting { settingEnum = "EAresStringSettingName::CrosshairSniperCenterDotColor", value = Utilities.Utils.ColorToString(Colors[4]) });
UserSettings.stringSettings.Add(new Stringsetting { settingEnum = "EAresStringSettingName::CrosshairADSColor", value = Utilities.Utils.ColorToString(Colors[2]) });
UserSettings.stringSettings.Add(new Stringsetting { settingEnum = "EAresStringSettingName::CrosshairColorCustom", value = Utilities.Utils.ColorToString(Colors[0]) });
UserSettings.stringSettings.Add(new Stringsetting { settingEnum = "EAresStringSettingName::CrosshairOutlineColor", value = Utilities.Utils.ColorToString(Colors[1]) });
//UserSettings.stringSettings.Add(new Stringsetting { settingEnum = "EAresStringSettingName::CrosshairADSColor", value = Utilities.Utils.ColorToString(Colors[2]) });
UserSettings.stringSettings.Add(new Stringsetting { settingEnum = "EAresStringSettingName::CrosshairADSColorCustom", value = Utilities.Utils.ColorToString(Colors[2]) });
UserSettings.stringSettings.Add(new Stringsetting { settingEnum = "EAresStringSettingName::CrosshairADSOutlineColor", value = Utilities.Utils.ColorToString(Colors[3]) });
//UserSettings.stringSettings.Add(new Stringsetting { settingEnum = "EAresStringSettingName::CrosshairSniperCenterDotColor", value = Utilities.Utils.ColorToString(Colors[4]) });
UserSettings.stringSettings.Add(new Stringsetting { settingEnum = "EAresStringSettingName::CrosshairSniperCenterDotColorCustom", value = Utilities.Utils.ColorToString(Colors[4]) });

UserSettings.boolSettings.Add(new Boolsetting { settingEnum = "EAresBoolSettingName::CrosshairUseCustomColor", value = true });
UserSettings.boolSettings.Add(new Boolsetting { settingEnum = "EAresBoolSettingName::CrosshairADSUseCustomColor", value = true });
UserSettings.boolSettings.Add(new Boolsetting { settingEnum = "EAresBoolSettingName::CrosshairSniperUseCustomColor", value = true });
Utilities.Utils.Log("Modifying profile colors.");
SelectedProfile.Primary.Color.R = Colors[0].R; SelectedProfile.Primary.Color.G = Colors[0].G; SelectedProfile.Primary.Color.B = Colors[0].B; SelectedProfile.Primary.Color.A = Colors[0].A;
SelectedProfile.Primary.bUseCustomColor = true;
//SelectedProfile.Primary.Color.R = Colors[0].R; SelectedProfile.Primary.Color.G = Colors[0].G; SelectedProfile.Primary.Color.B = Colors[0].B; SelectedProfile.Primary.Color.A = Colors[0].A;
SelectedProfile.Primary.colorCustom.R = Colors[0].R; SelectedProfile.Primary.colorCustom.G = Colors[0].G; SelectedProfile.Primary.colorCustom.B = Colors[0].B; SelectedProfile.Primary.colorCustom.A = Colors[0].A;
SelectedProfile.Primary.OutlineColor.R = Colors[1].R; SelectedProfile.Primary.OutlineColor.G = Colors[1].G; SelectedProfile.Primary.OutlineColor.B = Colors[1].B; SelectedProfile.Primary.OutlineColor.A = Colors[1].A;
SelectedProfile.aDS.Color.R = Colors[2].R; SelectedProfile.aDS.Color.G = Colors[2].G; SelectedProfile.aDS.Color.B = Colors[2].B; SelectedProfile.aDS.Color.A = Colors[2].A;
SelectedProfile.aDS.bUseCustomColor = true;
//SelectedProfile.aDS.Color.R = Colors[2].R; SelectedProfile.aDS.Color.G = Colors[2].G; SelectedProfile.aDS.Color.B = Colors[2].B; SelectedProfile.aDS.Color.A = Colors[2].A;
SelectedProfile.aDS.colorCustom.R = Colors[2].R; SelectedProfile.aDS.colorCustom.G = Colors[2].G; SelectedProfile.aDS.colorCustom.B = Colors[2].B; SelectedProfile.aDS.colorCustom.A = Colors[2].A;
SelectedProfile.aDS.OutlineColor.R = Colors[3].R; SelectedProfile.aDS.OutlineColor.G = Colors[3].G; SelectedProfile.aDS.OutlineColor.B = Colors[3].B; SelectedProfile.aDS.OutlineColor.A = Colors[3].A;
SelectedProfile.Sniper.CenterDotColor.R = Colors[4].R; SelectedProfile.Sniper.CenterDotColor.G = Colors[4].G; SelectedProfile.Sniper.CenterDotColor.B = Colors[4].B; SelectedProfile.Sniper.CenterDotColor.A = Colors[4].A;
SelectedProfile.Sniper.bUseCustomCenterDotColor = true;
//SelectedProfile.Sniper.CenterDotColor.R = Colors[4].R; SelectedProfile.Sniper.CenterDotColor.G = Colors[4].G; SelectedProfile.Sniper.CenterDotColor.B = Colors[4].B; SelectedProfile.Sniper.CenterDotColor.A = Colors[4].A;
SelectedProfile.Sniper.centerDotColorCustom.R = Colors[4].R; SelectedProfile.Sniper.centerDotColorCustom.G = Colors[4].G; SelectedProfile.Sniper.centerDotColorCustom.B = Colors[4].B; SelectedProfile.Sniper.centerDotColorCustom.A = Colors[4].A;
}
return UserSettings;
}
Expand Down
2 changes: 1 addition & 1 deletion global.json
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "6.0.101"
"version": "6.0.108"
}
}

0 comments on commit acb1821

Please sign in to comment.