diff --git a/ValorantCC/SubWindow/ProfilesWindow.xaml b/ValorantCC/SubWindow/ProfilesWindow.xaml
index c15976a..66d4e69 100644
--- a/ValorantCC/SubWindow/ProfilesWindow.xaml
+++ b/ValorantCC/SubWindow/ProfilesWindow.xaml
@@ -26,6 +26,10 @@
An error has occured while fetching profiles.
+
+
+
+
diff --git a/ValorantCC/SubWindow/ProfilesWindow.xaml.cs b/ValorantCC/SubWindow/ProfilesWindow.xaml.cs
index 3a4e638..f50702a 100644
--- a/ValorantCC/SubWindow/ProfilesWindow.xaml.cs
+++ b/ValorantCC/SubWindow/ProfilesWindow.xaml.cs
@@ -29,6 +29,7 @@ public partial class ProfilesWindow : MetroWindow
private static API ValCCApi;
private static MainWindow main;
private static List PublicProfiles = new List();
+ private int _offset = 0;
public ProfilesWindow(CrosshairProfile current, API ValCCAPI)
{
InitializeComponent();
@@ -41,6 +42,7 @@ public ProfilesWindow(CrosshairProfile current, API ValCCAPI)
private async void ShareablesContainer_Loaded(object sender, RoutedEventArgs e)
{
LoadingPlaceHolder.Visibility = Visibility.Visible;
+ Pagination.Visibility = Visibility.Collapsed;
fetchErrorTxt.Visibility = Visibility.Collapsed;
try
{
@@ -56,6 +58,7 @@ private async void ShareablesContainer_Loaded(object sender, RoutedEventArgs e)
Utilities.Utils.Log(ex.StackTrace.ToString());
}
LoadingPlaceHolder.Visibility = Visibility.Collapsed;
+ Pagination.Visibility = Visibility.Visible;
}
///
@@ -86,9 +89,10 @@ private async Task InitialFetch(String sharecode = null)
else
{
Utilities.Utils.Log($"Fetching profiles from server");
- FetchResponse fetchResponse = await ValCCApi.Fetch();
+ FetchResponse fetchResponse = await ValCCApi.Fetch(Offset: _offset);
if (!fetchResponse.success) return false;
Shareables = fetchResponse.data;
+ Pagination.Visibility = Visibility.Visible;
}
if (Shareables.Count == 0) return true;
@@ -122,6 +126,7 @@ private async Task RenderProfiles()
private async void btnSearchCode_Click(object sender, RoutedEventArgs e)
{
LoadingPlaceHolder.Visibility = Visibility.Visible;
+ Pagination.Visibility = Visibility.Collapsed;
fetchErrorTxt.Visibility = Visibility.Collapsed;
try
{
@@ -206,5 +211,51 @@ private void LoadingPlaceHolder_IsVisibleChanged(object sender, DependencyProper
else
WpfAnimatedGif.ImageBehavior.GetAnimationController(LoadingPlaceHolder)?.Pause();
}
+
+ private async void btnNextOffset_MouseUp(object sender, MouseButtonEventArgs e)
+ {
+ LoadingPlaceHolder.Visibility = Visibility.Visible;
+ Pagination.Visibility = Visibility.Collapsed;
+ fetchErrorTxt.Visibility = Visibility.Collapsed;
+ _offset += 20;
+ try
+ {
+ bool fetchSucc = await InitialFetch();
+ if (!fetchSucc) fetchErrorTxt.Visibility = Visibility.Visible;
+ else
+ {
+ await RenderProfiles();
+ }
+ }
+ catch (Exception ex)
+ {
+ Utilities.Utils.Log(ex.StackTrace.ToString());
+ }
+ LoadingPlaceHolder.Visibility = Visibility.Collapsed;
+ Pagination.Visibility = Visibility.Visible;
+ }
+
+ private async void btnPreviousOffset_MouseUp(object sender, MouseButtonEventArgs e)
+ {
+ LoadingPlaceHolder.Visibility = Visibility.Visible;
+ Pagination.Visibility = Visibility.Collapsed;
+ fetchErrorTxt.Visibility = Visibility.Collapsed;
+ if (_offset >= 20) _offset -= 20;
+ try
+ {
+ bool fetchSucc = await InitialFetch();
+ if (!fetchSucc) fetchErrorTxt.Visibility = Visibility.Visible;
+ else
+ {
+ await RenderProfiles();
+ }
+ }
+ catch (Exception ex)
+ {
+ Utilities.Utils.Log(ex.StackTrace.ToString());
+ }
+ LoadingPlaceHolder.Visibility = Visibility.Collapsed;
+ Pagination.Visibility = Visibility.Visible;
+ }
}
}
diff --git a/ValorantCC/ValorantCC.csproj b/ValorantCC/ValorantCC.csproj
index abf230a..e7ed8f5 100644
--- a/ValorantCC/ValorantCC.csproj
+++ b/ValorantCC/ValorantCC.csproj
@@ -14,8 +14,8 @@
false
- 3.0.4
- false
+ 3.1.4
+ true
diff --git a/ValorantCC/src/API.cs b/ValorantCC/src/API.cs
index 602306d..8c2a6a3 100644
--- a/ValorantCC/src/API.cs
+++ b/ValorantCC/src/API.cs
@@ -19,6 +19,7 @@ public struct FetchResponse
public bool success { get; set; }
public List data { get; set; }
public string message { get; set; }
+ public int offset { get; set; }
}
public struct ShareableProfile
@@ -49,13 +50,13 @@ public API(AuthTokens Tokens, CrosshairProfile TargetProfile, int ActionInt, boo
Shareable = isShareable;
}
- public async Task Fetch(String sharecode = null)
+ public async Task Fetch(String sharecode = null, int Offset = 0)
{
RestRequest request;
if (sharecode != null)
request = new RestRequest($"/sharecode/{sharecode}", Method.Get);
else
- request = new RestRequest("/profiles", Method.Get);
+ request = new RestRequest($"/profiles?offset={Offset}", Method.Get);
RestResponse response = await client.ExecuteAsync(request);
if (!response.IsSuccessful && response.StatusCode != System.Net.HttpStatusCode.NotFound)
@@ -65,13 +66,14 @@ public async Task Fetch(String sharecode = null)
}
if (response.StatusCode == System.Net.HttpStatusCode.NotFound)
{
- return new FetchResponse() { success = true, data = new List() };
+ return new FetchResponse() { success = true, data = new List(), offset = Offset };
}
return new FetchResponse()
{
success = true,
- data = JsonConvert.DeserializeObject>(response.Content)
+ data = JsonConvert.DeserializeObject>(response.Content),
+ offset = Offset
};
}
diff --git a/ValorantCC/src/Auth.cs b/ValorantCC/src/Auth.cs
index 711dadd..afc224a 100644
--- a/ValorantCC/src/Auth.cs
+++ b/ValorantCC/src/Auth.cs
@@ -36,19 +36,11 @@ public partial class AuthResponse
public partial class VersionResponse
{
- public int Status;
- public VersionData Data;
+ public int Status { get; set; }
+ public string riotClientVersion { get; set; }
}
- public partial class VersionData
- {
- public string RiotClientVersion { get; set; }
- public string ManifestID { get; set; }
- public string Version { get; set; }
- public string BuildVersion { get; set; }
- public string Branch { get; set; }
- public string BuildDate { get; set; }
- }
+
public class AuthObj
{
LockfileData LocalCredentials;
@@ -123,13 +115,14 @@ private async Task ObtainAuthTokens()
private async static Task GetVersion()
{
Utilities.Utils.Log("Obtaining Client Version info");
- RestRequest request = new RestRequest("https://valorant-api.com/v1/version", Method.Get);
+ RestRequest request = new RestRequest("https://vtools-next.vercel.app/api/skinslist/version", Method.Get);
RestResponse response = await client.ExecuteAsync(request);
- if (!response.IsSuccessful) return "0.0.0";
+ if (!response.IsSuccessful) return "release-04.04-shipping-15-678808";
VersionResponse RespData = JsonConvert.DeserializeObject(response.Content.ToString());
- return RespData.Data.RiotClientVersion;
+ RespData.Status = ((int)response.StatusCode);
+ return RespData.riotClientVersion;
}
}
}
diff --git a/ValorantCC/src/Binder.cs b/ValorantCC/src/Binder.cs
index ca10b15..46b7c36 100644
--- a/ValorantCC/src/Binder.cs
+++ b/ValorantCC/src/Binder.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Windows.Media;
namespace ValorantCC
{
public partial class Actionmapping
@@ -52,45 +53,45 @@ public partial class CrosshairProfile
public partial class ProfileSettings
{
- public CrosshairColor Color { get; set; } = new CrosshairColor();
- public bool bHasOutline { get; set; } = false;
- public float OutlineThickness { get; set; } = 1;
- public CrosshairColor OutlineColor { get; set; } = new CrosshairColor();
- public float OutlineOpacity { get; set; } = 0;
- public float CenterDotSize { get; set; } = 1;
- public float CenterDotOpacity { get; set; } = 0;
- public bool bDisplayCenterDot { get; set; } = false;
- public bool bFixMinErrorAcrossWeapons { get; set; } = false;
- public LineSettings InnerLines { get; set; } = new LineSettings();
- public LineSettings OuterLines { get; set; } = new LineSettings();
+ public CrosshairColor Color { 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 bFixMinErrorAcrossWeapons { get; set; }
+ public LineSettings InnerLines { get; set; }
+ public LineSettings OuterLines { get; set; }
}
public partial class SniperSettings
{
- public CrosshairColor CenterDotColor { get; set; } = new CrosshairColor();
- public float CenterDotSize { get; set; } = 0;
- public float CenterDotOpacity { get; set; } = 0;
- public bool bDisplayCenterDot { get; set; } = false;
+ public CrosshairColor CenterDotColor { get; set; }
+ public float CenterDotSize { get; set; }
+ public float CenterDotOpacity { get; set; }
+ public bool bDisplayCenterDot { get; set; }
}
public partial class CrosshairColor
{
- public byte R { get; set; } = 0;
- public byte G { get; set; } = 0;
- public byte B { get; set; } = 0;
- public byte A { get; set; } = 0;
+ public byte R { get; set; } = 254;
+ public byte G { get; set; } = 254;
+ public byte B { get; set; } = 254;
+ public byte A { get; set; } = 255;
}
public partial class LineSettings
{
- public float LineThickness { get; set; } = 2;
- public float LineLength { get; set; } = 4;
- public float LineOffset { get; set; } = 2;
- public bool bShowMovementError { get; set; } = false;
- public bool bShowShootingError { get; set; } = false;
- public bool bShowMinError { get; set; } = false;
- public float Opacity { get; set; } = 1;
- public bool bShowLines { get; set; } = true;
+ public float LineThickness { get; set; }
+ public float LineLength { get; set; }
+ public float LineOffset { get; set; }
+ public bool bShowMovementError { get; set; }
+ public bool bShowShootingError { get; set; }
+ public bool bShowMinError { get; set; }
+ public float Opacity { get; set; }
+ public bool bShowLines { get; set; }
public float firingErrorScale { get; set; }
public float movementErrorScale { get; set; }
}
@@ -113,4 +114,8 @@ public partial class Data
public List settingsProfiles { get; set; }
}
-}
+ public partial class FetchResponseData
+ {
+ public Data data { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/ValorantCC/src/Crosshair/CrosshairMain.cs b/ValorantCC/src/Crosshair/CrosshairMain.cs
new file mode 100644
index 0000000..5b3f990
--- /dev/null
+++ b/ValorantCC/src/Crosshair/CrosshairMain.cs
@@ -0,0 +1,63 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Media;
+
+namespace ValorantCC.src.Crosshair
+{
+ public class CrosshairMain
+ {
+ public static Data ChangeInActiveProfile(List 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.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.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;
+ return UserSettings;
+ }
+
+ public static Data ChangeActiveProfile(List Colors, int SelectedIndex, Data UserSettings, ProfileList FetchedProfiles)
+ {
+ Utilities.Utils.Log("Updating active color");
+ try
+ {
+ Stringsetting activeProfileColor = UserSettings.stringSettings.First(setting => setting.settingEnum == "EAresStringSettingName::CrosshairColor");
+ activeProfileColor.value = Utilities.Utils.ColorToString(Colors[0]);
+ }
+ 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]) });
+ }
+ 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::CrosshairOutlineColor");
+ UserSettings.stringSettings.RemoveAll(setting => setting.settingEnum == "EAresStringSettingName::CrosshairADSOutlineColor");
+ 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::CrosshairOutlineColor", value = Utilities.Utils.ColorToString(Colors[1]) });
+ UserSettings.stringSettings.Add(new Stringsetting { settingEnum = "EAresStringSettingName::CrosshairADSOutlineColor", value = Utilities.Utils.ColorToString(Colors[3]) });
+ 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.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.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;
+ }
+ return UserSettings;
+ }
+ }
+}
diff --git a/ValorantCC/src/Crosshair_Parser.cs b/ValorantCC/src/Crosshair_Parser.cs
index b9c7bd6..32a996b 100644
--- a/ValorantCC/src/Crosshair_Parser.cs
+++ b/ValorantCC/src/Crosshair_Parser.cs
@@ -14,10 +14,9 @@ public enum Position
West = 2,
East = 3,
}
- static CrosshairColor defaultColor = new CrosshairColor();
+
public static void Generate(int column, Grid grid, ProfileSettings settings)
{
- settings = settings ?? new ProfileSettings();
Rectangle[] rectangles = new Rectangle[16];
int recindex = 0;
for (int i = 0; i < rectangles.Length; i++)
@@ -57,8 +56,6 @@ public static void Generate(int column, Grid grid, ProfileSettings settings)
recindex++;
rectangle_redraw(rectangles[i], rectangles[i + 1], pos, settings);
- settings.Color = settings.Color ?? defaultColor;
- settings.OutlineColor = settings.OutlineColor ?? defaultColor;
rectangles[i].Fill = new SolidColorBrush(Color.FromArgb(settings.Color.A, settings.Color.R, settings.Color.G, settings.Color.B));
rectangles[i + 1].Stroke = new SolidColorBrush(Color.FromArgb(settings.OutlineColor.A, settings.OutlineColor.R, settings.OutlineColor.G, settings.OutlineColor.B));
Grid.SetColumn(rectangles[i], column);
@@ -80,8 +77,6 @@ public static void Generate(int column, Grid grid, ProfileSettings settings)
};
dot_redraw(dot, dotOT, settings);
- settings.Color = settings.Color ?? defaultColor;
- settings.OutlineColor = settings.OutlineColor ?? defaultColor;
dot.Fill = new SolidColorBrush(Color.FromArgb(settings.Color.A, settings.Color.R, settings.Color.G, settings.Color.B));
dotOT.Stroke = new SolidColorBrush(Color.FromArgb(settings.OutlineColor.A, settings.OutlineColor.R, settings.OutlineColor.G, settings.OutlineColor.B));
Grid.SetColumn(dot, column);
@@ -97,8 +92,6 @@ public static void Generate(int column, Grid grid, SniperSettings settings)
{
Ellipse ellipse = new();
dot_redraw(ellipse, settings);
- settings = settings ?? new SniperSettings();
- settings.CenterDotColor = settings.CenterDotColor ?? defaultColor;
ellipse.Fill = new SolidColorBrush(Color.FromArgb(settings.CenterDotColor.A, settings.CenterDotColor.R, settings.CenterDotColor.G, settings.CenterDotColor.B));
Grid.SetColumn(ellipse, column);
Grid.SetRow(ellipse, 0);
@@ -128,7 +121,6 @@ public static void dot_redraw(Rectangle Rect, Rectangle RectOT, ProfileSettings
public static void dot_redraw(Ellipse ellipse, SniperSettings settings)
{
- settings = settings ?? new SniperSettings();
ellipse.Width = ellipse.Height = settings.CenterDotSize * 6;
ellipse.Opacity = settings.CenterDotOpacity;
@@ -145,16 +137,10 @@ public static void rectangle_redraw(Rectangle Rect, Rectangle RectOT, Position p
Width = Rect.Width;
Height = Rect.Height;
- settings = settings ?? new ProfileSettings();
LineSettings line = settings.InnerLines;
if (Rect.Name.Contains("OL"))
line = settings.OuterLines;
- line = line ?? new LineSettings()
- {
- bShowLines = false,
- Opacity = 0
- };
if (line.bShowShootingError)
Margin += 8;
@@ -194,15 +180,15 @@ public static void rectangle_redraw(Rectangle Rect, Rectangle RectOT, Position p
RectOT.Opacity = settings.OutlineOpacity;
- if (line.bShowLines || line.Opacity > 0)
+ if (line.bShowLines)
Rect.Visibility = Visibility.Visible;
else
Rect.Visibility = Visibility.Hidden;
- if (settings.bHasOutline && line.LineThickness > 0 && line.bShowLines && line.Opacity > 0)
+ if (settings.bHasOutline && line.LineThickness > 0 && line.bShowLines)
RectOT.Visibility = Visibility.Visible;
else
RectOT.Visibility = Visibility.Hidden;
}
}
-}
+}
\ No newline at end of file
diff --git a/ValorantCC/src/Modifier.cs b/ValorantCC/src/Modifier.cs
deleted file mode 100644
index 9b37b19..0000000
--- a/ValorantCC/src/Modifier.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Windows.Media;
-
-namespace ValorantCC.src
-{
- public static class Modifier
- {
- public static Data ChangeActiveProfile(List Colors, int SelectedIndex, Data UserSettings, ProfileList FetchedProfiles)
- {
- Utilities.Utils.Log("Updating active color");
- try
- {
- Stringsetting activeProfileColor = UserSettings.stringSettings.First(setting => setting.settingEnum == "EAresStringSettingName::CrosshairColor");
- activeProfileColor.value = Utilities.Utils.ColorToString(Colors[0]);
- }
- 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]) });
- }
- finally
- {
- if (FetchedProfiles.Profiles[SelectedIndex].bUseAdvancedOptions)
- {
- 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::CrosshairOutlineColor");
- UserSettings.stringSettings.RemoveAll(setting => setting.settingEnum == "EAresStringSettingName::CrosshairADSOutlineColor");
- }
- 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::CrosshairOutlineColor", value = Utilities.Utils.ColorToString(Colors[1]) });
- UserSettings.stringSettings.Add(new Stringsetting { settingEnum = "EAresStringSettingName::CrosshairADSOutlineColor", value = Utilities.Utils.ColorToString(Colors[3]) });
- }
- return UserSettings;
- }
- }
-}
diff --git a/ValorantCC/src/Processor.cs b/ValorantCC/src/Processor.cs
index 8ab6458..0b6a3b2 100644
--- a/ValorantCC/src/Processor.cs
+++ b/ValorantCC/src/Processor.cs
@@ -6,13 +6,14 @@
using System.Threading.Tasks;
using System.Windows.Media;
using ValorantCC.src;
+using ValorantCC.src.Crosshair;
namespace ValorantCC
{
public class Processor
{
private AuthResponse AuthResponse;
public bool isLoggedIn = false;
- private RestClient client = new RestClient("https://playerpreferences.riotgames.com");
+ private RestClient client = new RestClient(new RestClientOptions() { RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true });
private Data UserSettings;
public bool ProfileListed;
public List ProfileNames;
@@ -47,7 +48,7 @@ public async Task Login()
public async Task Construct()
{
Utilities.Utils.Log("Constructing Properties -->");
-
+ client.Authenticator = new RestSharp.Authenticators.HttpBasicAuthenticator("riot", AuthResponse.LockfileData.Key);
UserSettings = await FetchUserSettings();
if (UserSettings.settingsProfiles == null) return false;
@@ -74,30 +75,35 @@ public async Task Construct()
catch
{
Utilities.Utils.Log("User is new account/Using White Color");
+ UserSettings.stringSettings.RemoveAll(setting => setting.settingEnum == "EAresStringSettingName::CrosshairSniperCenterDotColor");
+ UserSettings.stringSettings.RemoveAll(setting => setting.settingEnum == "EAresStringSettingName::CrosshairADSColor");
+ UserSettings.stringSettings.RemoveAll(setting => setting.settingEnum == "EAresStringSettingName::CrosshairOutlineColor");
+ UserSettings.stringSettings.RemoveAll(setting => setting.settingEnum == "EAresStringSettingName::CrosshairADSOutlineColor");
+
UserSettings.stringSettings.Add(new Stringsetting
{
settingEnum = "EAresStringSettingName::CrosshairColor",
- value = "(R=0,G=0,B=0,A=255)"
+ value = "(R=0,G=0,B=0,A=254)"
});
UserSettings.stringSettings.Add(new Stringsetting
{
settingEnum = "EAresStringSettingName::CrosshairOutlineColor",
- value = "(R=255,G=255,B=255,A=255)"
+ value = "(R=254,G=254,B=254,A=254)"
});
UserSettings.stringSettings.Add(new Stringsetting
{
settingEnum = "EAresStringSettingName::CrosshairADSColor",
- value = "(R=0,G=0,B=0,A=255)"
+ value = "(R=0,G=0,B=0,A=254)"
});
UserSettings.stringSettings.Add(new Stringsetting
{
settingEnum = "EAresStringSettingName::CrosshairADSOutlineColor",
- value = "(R=255,G=255,B=255,A=255)"
+ value = "(R=254,G=254,B=254,A=254)"
});
UserSettings.stringSettings.Add(new Stringsetting
{
settingEnum = "EAresStringSettingName::CrosshairSniperCenterDotColor",
- value = "(R=254,G=254,B=254,A=255)"
+ value = "(R=254,G=254,B=254,A=254)"
});
Primary = UserSettings.stringSettings.First(setting => setting.settingEnum == "EAresStringSettingName::CrosshairColor");
@@ -125,33 +131,31 @@ private bool CheckIfList(Data settings)
private async Task FetchUserSettings()
{
- Utilities.Utils.Log("Obtaining User Settings");
- RestRequest request = new RestRequest("/playerPref/v3/getPreference/Ares.PlayerSettings", Method.Get);
- request.AddHeaders(Utilities.Utils.ConstructHeaders(AuthResponse));
- string responseContent = (await client.ExecuteAsync(request)).Content;
+ Utilities.Utils.Log("Obtaining User Settings using WS");
+ RestRequest request = new RestRequest($"{AuthResponse.LockfileData.Protocol}://127.0.0.1:{AuthResponse.LockfileData.Port}/player-preferences/v1/data-json/Ares.PlayerSettings", Method.Get);
+
RestResponse resp = await client.ExecuteAsync(request);
- Dictionary response = JsonConvert.DeserializeObject>(responseContent);
- Data settings = new Data();
+ if (!resp.IsSuccessful) return new Data();
+ string responseContent = resp.Content;
+ FetchResponseData response;
try
{
- settings = Utilities.Utils.Decompress(Convert.ToString(response["data"]));
+ response = JsonConvert.DeserializeObject(responseContent);
}
catch (KeyNotFoundException)
{
- return settings;
+ return new Data();
}
- return settings;
+ return response.data;
}
private async Task putUserSettings(Data newData)
{
Utilities.Utils.Log("Saving New Data: (BACKUP) " + JsonConvert.SerializeObject(newData));
-
- RestRequest request = new RestRequest("/playerPref/v3/savePreference", Method.Put);
- request.AddHeaders(Utilities.Utils.ConstructHeaders(AuthResponse));
- request.AddJsonBody(new { type = "Ares.PlayerSettings", data = Utilities.Utils.Compress(newData) });
-
+
+ RestRequest request = new RestRequest($"{AuthResponse.LockfileData.Protocol}://127.0.0.1:{AuthResponse.LockfileData.Port}/player-preferences/v1/data-json/Ares.PlayerSettings", Method.Put);
+ request.AddJsonBody(newData);
RestResponse response = await client.ExecuteAsync(request);
if (!response.IsSuccessful)
{
@@ -217,40 +221,24 @@ public CrosshairProfile ProfileFromIndex(int Index)
private void SaveListedSettings(List Colors, int SelectedIndex)
{
+ Utilities.Utils.Log("Modifying Selected Profile.");
if (SelectedIndex == FetchedProfiles.CurrentProfile)
{
try
{
- UserSettings = Modifier.ChangeActiveProfile(Colors, SelectedIndex, UserSettings, FetchedProfiles);
+ Utilities.Utils.Log("Modifying active");
+ UserSettings = CrosshairMain.ChangeActiveProfile(Colors, SelectedIndex, UserSettings, FetchedProfiles);
}
catch (Exception e)
{
Utilities.Utils.Log($"Error occured: {e}");
}
-
}
- Utilities.Utils.Log("Modifying Selected Profile.");
- CrosshairProfile currentProfile = FetchedProfiles.Profiles[SelectedIndex];
-
- currentProfile.bUseAdvancedOptions = true;
- currentProfile.bUsePrimaryCrosshairForADS = false;
- currentProfile.Primary.Color = new CrosshairColor { R = Colors[0].R, G = Colors[0].G, B = Colors[0].B, A = 255 };
- currentProfile.Primary.OutlineColor = new CrosshairColor { R = Colors[1].R, G = Colors[1].G, B = Colors[1].B, A = 255 };
- currentProfile.aDS.Color = new CrosshairColor { R = Colors[2].R, G = Colors[2].G, B = Colors[2].B, A = 255 };
- currentProfile.aDS.OutlineColor = new CrosshairColor { R = Colors[3].R, G = Colors[3].G, B = Colors[3].B, A = 255 };
-
- if (currentProfile.Sniper == null)
+ else
{
- currentProfile.Sniper = new SniperSettings
- {
- bDisplayCenterDot = true,
- CenterDotColor = new CrosshairColor { R = Colors[4].R, G = Colors[4].G, B = Colors[4].B, A = 255 },
- CenterDotOpacity = 1,
- CenterDotSize = 1
- };
+ Utilities.Utils.Log("Modifying in-active");
+ UserSettings = CrosshairMain.ChangeInActiveProfile(Colors, SelectedIndex, UserSettings, FetchedProfiles);
}
- else
- currentProfile.Sniper.CenterDotColor = new CrosshairColor { R = Colors[4].R, G = Colors[4].G, B = Colors[4].B, A = 255 };
}
public async Task SaveNewColor(List Colors, int SelectedIndex, string ProfileName)
{
@@ -281,7 +269,7 @@ public async Task SaveNewColor(List Colors, int SelectedIndex, stri
{
Utilities.Utils.Log("Profile type: Enum");
Stringsetting profileName = UserSettings.stringSettings.FirstOrDefault(setting => setting.settingEnum == "EAresStringSettingName::CrosshairProfileName");
- UserSettings = Modifier.ChangeActiveProfile(Colors, SelectedIndex, UserSettings, FetchedProfiles);
+ UserSettings = CrosshairMain.ChangeActiveProfile(Colors, SelectedIndex, UserSettings, FetchedProfiles);
profileName.value = ProfileName;
}