From bf3d68c7b44f77d9fa4ae41a2de1a2afd2e466dd Mon Sep 17 00:00:00 2001
From: Rokuazery
Date: Wed, 30 Nov 2022 20:50:53 +0700
Subject: [PATCH] U.GG Aram, Fixes & Small Improvements
- U.GG Aram
- Small visual changes
- Fixed some memory leak
- Update ReadMe
- Update Version.txt
- Fixed #19
---
LoL Assist/App.xaml | 11 +-
LoL Assist/App.xaml.cs | 33 +-
LoL Assist/BuildEditorWindow.xaml | 15 +-
LoL Assist/BuildEditorWindow.xaml.cs | 25 +-
LoL Assist/{ViewModel => Commands}/Command.cs | 4 +-
LoL Assist/Commands/ItemInsertedCommand.cs | 31 ++
LoL Assist/Commands/ItemReceivedCommand.cs | 31 ++
LoL Assist/Commands/ItemRemovedCommand.cs | 31 ++
.../Converters/ChampionToImageConverter.cs | 37 ++
LoL Assist/Converters/ProviderConverter.cs | 2 +-
LoL Assist/DataTemplates.xaml | 25 --
LoL Assist/Features/AutoMessage.cs | 31 ++
LoL Assist/LoL Assist.csproj | 121 +++++--
LoL Assist/MainWindow.xaml | 134 +++----
LoL Assist/MainWindow.xaml.cs | 22 +-
LoL Assist/{Model => Models}/ConfigModel.cs | 14 +-
.../{Model => Models}/ItemImageModel.cs | 2 +-
LoL Assist/{Model => Models}/LoLAWrapper.cs | 11 +-
LoL Assist/Models/MessageBoxModel.cs | 17 +
.../{Model => Models}/ProgressReportModel.cs | 2 +-
LoL Assist/{Model => Models}/RuneModel.cs | 2 +-
LoL Assist/Properties/AssemblyInfo.cs | 4 +-
.../ResourceDictionaries/DataTemplates.xaml | 29 ++
.../{ => ResourceDictionaries}/Styles.xaml | 43 ++-
.../Theme.xaml} | 8 +-
LoL Assist/Threads/AutoMessageThread.cs | 48 +++
LoL Assist/Utils/Animation.cs | 2 +-
LoL Assist/Utils/Helper.cs | 36 +-
LoL Assist/Utils/Updater.cs | 13 +-
LoL Assist/View/PatchNotesPanel.xaml | 85 -----
LoL Assist/ViewModel/MessageBoxViewModel.cs | 18 -
LoL Assist/ViewModel/PatchViewModel.cs | 106 ------
.../BuildEditorViewModel.cs | 169 ++++++---
.../ViewModels/ChampionPickViewModel.cs | 25 ++
.../ChampionPickerViewModel-Rokuazery.cs | 70 ++++
.../ViewModels/ChampionPickerViewModel.cs | 49 +++
.../ConfigViewModel.cs | 86 ++---
.../DownloadViewModel.cs | 72 ++--
LoL Assist/ViewModels/ItemListViewModel.cs | 171 +++++++++
LoL Assist/ViewModels/ItemViewModel.cs | 53 +++
.../MainViewModel.cs | 260 +++++++++----
.../MatchFoundViewModel.cs | 22 +-
LoL Assist/ViewModels/MessageViewModel.cs | 82 +++++
.../RuneEditorViewModel.cs | 252 +++----------
LoL Assist/ViewModels/ViewModelBase.cs | 16 +
.../{View => Views}/BuildEditorPanel.xaml | 0
.../{View => Views}/BuildEditorPanel.xaml.cs | 0
LoL Assist/Views/ChampionItemListView.xaml | 102 ++++++
LoL Assist/Views/ChampionItemListView.xaml.cs | 159 ++++++++
LoL Assist/Views/ChampionPickerPanel.xaml | 341 ++++++++++++++++++
.../ChampionPickerPanel.xaml.cs} | 14 +-
LoL Assist/{View => Views}/ConfigPanel.xaml | 35 +-
.../{View => Views}/ConfigPanel.xaml.cs | 24 +-
LoL Assist/{View => Views}/DownloadPanel.xaml | 22 +-
.../{View => Views}/DownloadPanel.xaml.cs | 2 +-
LoL Assist/{View => Views}/InfoPanel.xaml | 4 +-
LoL Assist/{View => Views}/InfoPanel.xaml.cs | 5 +-
.../{View => Views}/MatchFoundPanel.xaml | 3 +-
.../{View => Views}/MatchFoundPanel.xaml.cs | 2 +-
LoL Assist/{View => Views}/MessageBox.xaml | 5 +-
LoL Assist/{View => Views}/MessageBox.xaml.cs | 12 +-
LoL Assist/Views/MessagePanel.xaml | 50 +++
LoL Assist/Views/MessagePanel.xaml.cs | 28 ++
LoL Assist/{View => Views}/MsgBox.xaml | 8 +-
LoL Assist/{View => Views}/MsgBox.xaml.cs | 4 +-
LoL Assist/{View => Views}/PathSelector.xaml | 0
.../{View => Views}/PathSelector.xaml.cs | 0
.../{View => Views}/RuneEditorPanel.xaml | 11 +-
.../{View => Views}/RuneEditorPanel.xaml.cs | 2 +-
LoL Assist/Views/Windows/MainWIndow.xaml | 22 ++
LoL Assist/Views/Windows/MainWIndow.xaml.cs | 27 ++
LoL Assist/packages.config | 4 -
LoLA/LoLA/Data/ChampionBuild.cs | 8 +-
LoLA/LoLA/Data/ItemSet.cs | 28 ++
LoLA/LoLA/DataConverter.cs | 123 +------
LoLA/LoLA/LoLA.csproj | 3 +
LoLA/LoLA/Main.cs | 8 +-
LoLA/LoLA/Networking/LCU/Data/SessionData.cs | 17 +
.../Networking/LCU/Enums/RequestMethod.cs | 10 +-
.../Networking/LCU/Events/ChampionMonitor.cs | 1 +
.../Networking/LCU/Events/PhaseMonitor.cs | 12 +-
LoLA/LoLA/Networking/LCU/LCUWrapper.cs | 85 ++++-
LoLA/LoLA/Networking/LCU/LeagueClient.cs | 10 +-
.../DataDragon/DataDragonWrapper.cs | 22 +-
.../DataProviders/Metasrc/MetasrcClass.cs | 6 +-
.../DataProviders/Metasrc/MetasrcWrapper.cs | 132 +++----
.../DataProviders/UGG/UGGWrapper-Rokuazery.cs | 226 ++++++++++++
.../DataProviders/UGG/UGGWrapper.cs | 332 ++++++++++++-----
.../WebWrapper/DataProviders/Utils/Helper.cs | 67 ++++
LoLA/LoLA/Properties/AssemblyInfo.cs | 4 +-
README.md | 49 +--
Version.txt | 4 +-
92 files changed, 3036 insertions(+), 1317 deletions(-)
rename LoL Assist/{ViewModel => Commands}/Command.cs (91%)
create mode 100644 LoL Assist/Commands/ItemInsertedCommand.cs
create mode 100644 LoL Assist/Commands/ItemReceivedCommand.cs
create mode 100644 LoL Assist/Commands/ItemRemovedCommand.cs
create mode 100644 LoL Assist/Converters/ChampionToImageConverter.cs
delete mode 100644 LoL Assist/DataTemplates.xaml
create mode 100644 LoL Assist/Features/AutoMessage.cs
rename LoL Assist/{Model => Models}/ConfigModel.cs (85%)
rename LoL Assist/{Model => Models}/ItemImageModel.cs (80%)
rename LoL Assist/{Model => Models}/LoLAWrapper.cs (91%)
create mode 100644 LoL Assist/Models/MessageBoxModel.cs
rename LoL Assist/{Model => Models}/ProgressReportModel.cs (90%)
rename LoL Assist/{Model => Models}/RuneModel.cs (99%)
create mode 100644 LoL Assist/ResourceDictionaries/DataTemplates.xaml
rename LoL Assist/{ => ResourceDictionaries}/Styles.xaml (96%)
rename LoL Assist/{Colours.xaml => ResourceDictionaries/Theme.xaml} (96%)
create mode 100644 LoL Assist/Threads/AutoMessageThread.cs
delete mode 100644 LoL Assist/View/PatchNotesPanel.xaml
delete mode 100644 LoL Assist/ViewModel/MessageBoxViewModel.cs
delete mode 100644 LoL Assist/ViewModel/PatchViewModel.cs
rename LoL Assist/{ViewModel => ViewModels}/BuildEditorViewModel.cs (84%)
create mode 100644 LoL Assist/ViewModels/ChampionPickViewModel.cs
create mode 100644 LoL Assist/ViewModels/ChampionPickerViewModel-Rokuazery.cs
create mode 100644 LoL Assist/ViewModels/ChampionPickerViewModel.cs
rename LoL Assist/{ViewModel => ViewModels}/ConfigViewModel.cs (77%)
rename LoL Assist/{ViewModel => ViewModels}/DownloadViewModel.cs (80%)
create mode 100644 LoL Assist/ViewModels/ItemListViewModel.cs
create mode 100644 LoL Assist/ViewModels/ItemViewModel.cs
rename LoL Assist/{ViewModel => ViewModels}/MainViewModel.cs (74%)
rename LoL Assist/{ViewModel => ViewModels}/MatchFoundViewModel.cs (87%)
create mode 100644 LoL Assist/ViewModels/MessageViewModel.cs
rename LoL Assist/{ViewModel => ViewModels}/RuneEditorViewModel.cs (82%)
create mode 100644 LoL Assist/ViewModels/ViewModelBase.cs
rename LoL Assist/{View => Views}/BuildEditorPanel.xaml (100%)
rename LoL Assist/{View => Views}/BuildEditorPanel.xaml.cs (100%)
create mode 100644 LoL Assist/Views/ChampionItemListView.xaml
create mode 100644 LoL Assist/Views/ChampionItemListView.xaml.cs
create mode 100644 LoL Assist/Views/ChampionPickerPanel.xaml
rename LoL Assist/{View/PatchNotesPanel.xaml.cs => Views/ChampionPickerPanel.xaml.cs} (61%)
rename LoL Assist/{View => Views}/ConfigPanel.xaml (89%)
rename LoL Assist/{View => Views}/ConfigPanel.xaml.cs (81%)
rename LoL Assist/{View => Views}/DownloadPanel.xaml (77%)
rename LoL Assist/{View => Views}/DownloadPanel.xaml.cs (95%)
rename LoL Assist/{View => Views}/InfoPanel.xaml (97%)
rename LoL Assist/{View => Views}/InfoPanel.xaml.cs (93%)
rename LoL Assist/{View => Views}/MatchFoundPanel.xaml (96%)
rename LoL Assist/{View => Views}/MatchFoundPanel.xaml.cs (88%)
rename LoL Assist/{View => Views}/MessageBox.xaml (89%)
rename LoL Assist/{View => Views}/MessageBox.xaml.cs (77%)
create mode 100644 LoL Assist/Views/MessagePanel.xaml
create mode 100644 LoL Assist/Views/MessagePanel.xaml.cs
rename LoL Assist/{View => Views}/MsgBox.xaml (91%)
rename LoL Assist/{View => Views}/MsgBox.xaml.cs (93%)
rename LoL Assist/{View => Views}/PathSelector.xaml (100%)
rename LoL Assist/{View => Views}/PathSelector.xaml.cs (100%)
rename LoL Assist/{View => Views}/RuneEditorPanel.xaml (98%)
rename LoL Assist/{View => Views}/RuneEditorPanel.xaml.cs (88%)
create mode 100644 LoL Assist/Views/Windows/MainWIndow.xaml
create mode 100644 LoL Assist/Views/Windows/MainWIndow.xaml.cs
delete mode 100644 LoL Assist/packages.config
create mode 100644 LoLA/LoLA/Data/ItemSet.cs
create mode 100644 LoLA/LoLA/Networking/LCU/Data/SessionData.cs
create mode 100644 LoLA/LoLA/Networking/WebWrapper/DataProviders/UGG/UGGWrapper-Rokuazery.cs
create mode 100644 LoLA/LoLA/Networking/WebWrapper/DataProviders/Utils/Helper.cs
diff --git a/LoL Assist/App.xaml b/LoL Assist/App.xaml
index b81f350..fb940ff 100644
--- a/LoL Assist/App.xaml
+++ b/LoL Assist/App.xaml
@@ -1,9 +1,6 @@
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
@@ -12,9 +9,9 @@
-->
-
-
-
+
+
+
diff --git a/LoL Assist/App.xaml.cs b/LoL Assist/App.xaml.cs
index dfa8b08..14e0c16 100644
--- a/LoL Assist/App.xaml.cs
+++ b/LoL Assist/App.xaml.cs
@@ -1,10 +1,12 @@
-using System.Windows.Controls;
+using LoL_Assist_WAPP.ViewModels;
+using System.Windows.Controls;
+using LoL_Assist_WAPP.Models;
using LoL_Assist_WAPP.Utils;
using System.Diagnostics;
using System.Windows;
using System;
using LoLA;
-using LoL_Assist_WAPP.Model;
+using System.IO;
namespace LoL_Assist_WAPP
{
@@ -13,12 +15,30 @@ namespace LoL_Assist_WAPP
///
public partial class App : Application
{
+ public App()
+ {
+ Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
+ ToolTipService.ShowDurationProperty.OverrideMetadata(typeof(DependencyObject), new FrameworkPropertyMetadata(int.MaxValue));
+ ToolTipService.InitialShowDelayProperty.OverrideMetadata(typeof(DependencyObject), new FrameworkPropertyMetadata(350));
+ }
+
+ #if DEBUG
+ private const int MAX_INSTANCES = 2;
+ #else
+ private const int MAX_INSTANCES = 1;
+ #endif
+
protected override void OnStartup(StartupEventArgs e)
{
RuneModel.Init();
- GlobalConfig.s_Debug = true;
+
+ #if DEBUG
+ GlobalConfig.s_Debug = true;
+ #else
+ GlobalConfig.s_Debug = false;
+ #endif
+
//Console.Title = "LoL Assist - Debug Console";
- ToolTipService.ShowDurationProperty.OverrideMetadata(typeof(DependencyObject), new FrameworkPropertyMetadata(int.MaxValue));
if (!GlobalConfig.s_Debug)
{
@@ -27,13 +47,16 @@ protected override void OnStartup(StartupEventArgs e)
}
var proccName = Process.GetCurrentProcess().ProcessName;
- if (Process.GetProcessesByName(proccName).Length > 1)
+ if (Process.GetProcessesByName(proccName).Length > MAX_INSTANCES)
{
MessageBox.Show("LoL Assist is already running!", "LoL Assist",
MessageBoxButton.OK, MessageBoxImage.Warning);
Environment.Exit(0);
}
+ MainWindow mainWindow = new MainWindow();
+ mainWindow.Show();
+
base.OnStartup(e);
}
}
diff --git a/LoL Assist/BuildEditorWindow.xaml b/LoL Assist/BuildEditorWindow.xaml
index 3772938..90cf0a8 100644
--- a/LoL Assist/BuildEditorWindow.xaml
+++ b/LoL Assist/BuildEditorWindow.xaml
@@ -3,10 +3,11 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:local="clr-namespace:LoL_Assist_WAPP" xmlns:view="clr-namespace:LoL_Assist_WAPP.View"
- mc:Ignorable="d" MouseLeftButtonDown="Window_MouseLeftButtonDown" SnapsToDevicePixels="True"
- MinHeight="463" MinWidth="650" Height="463" Width="650" MaxHeight="463" MaxWidth="650" WindowStartupLocation="CenterOwner" ShowInTaskbar="False" Title="LoL Assist - Advanced Runes & Spells Editor">
-
+ mc:Ignorable="d" SnapsToDevicePixels="True" x:Name="Wnd"
+ MinHeight="450" MinWidth="550" Height="450" Width="550" MaxHeight="450" MaxWidth="550" WindowStartupLocation="CenterOwner" ShowInTaskbar="False" Title="LoL Assist - Advanced Runes & Spells Editor">
+
+
+
@@ -23,7 +24,7 @@
Margin="7,0,0,0" FontWeight="DemiBold" HorizontalAlignment="Left" VerticalAlignment="Center"/>
-
@@ -157,7 +158,7 @@
-
@@ -183,7 +184,7 @@
-
diff --git a/LoL Assist/BuildEditorWindow.xaml.cs b/LoL Assist/BuildEditorWindow.xaml.cs
index 0a16fe3..9ff104b 100644
--- a/LoL Assist/BuildEditorWindow.xaml.cs
+++ b/LoL Assist/BuildEditorWindow.xaml.cs
@@ -1,9 +1,9 @@
-using LoL_Assist_WAPP.ViewModel;
+using LoL_Assist_WAPP.ViewModels;
using LoLA.Networking.LCU.Enums;
using System.Windows.Controls;
-using LoL_Assist_WAPP.Model;
+using LoL_Assist_WAPP.Models;
+using LoL_Assist_WAPP.Views;
using System.Windows.Input;
-using LoL_Assist_WAPP.View;
using System.Windows.Forms;
using Newtonsoft.Json;
using System.Windows;
@@ -25,11 +25,6 @@ public BuildEditorWindow()
InitializeComponent();
DataContext = viewModel;
}
- private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
- {
- if (e.ChangedButton == MouseButton.Left)
- DragMove();
- }
private void DeleteBtn_Click(object sender, RoutedEventArgs e)
{
@@ -47,7 +42,7 @@ private void DeleteBtn_Click(object sender, RoutedEventArgs e)
Utils.Animation.FadeOut(BackDrop, 0.13);
Utils.Animation.Margin(exitMsg, ConfigModel.r_MarginOpen, new Thickness(0, Height, 0, 0), 0.13);
};
- Animate(exitMsg, new Thickness(0, Height, 0, 0), ConfigModel.r_MarginOpen, 0.13);
+ animate(exitMsg, new Thickness(0, Height, 0, 0), ConfigModel.r_MarginOpen, 0.13);
}
}
@@ -70,7 +65,7 @@ private void SearchFileGrid_MouseUp(object sender, MouseButtonEventArgs e)
{
var championBuildConfig = JsonConvert.DeserializeObject(ImportFromPath);
if (championBuildConfig != null)
- AnimateOpen(ImportPanel);
+ animateOpen(ImportPanel);
}
catch { saveStatus.Text = "Invalid Build Config"; }
@@ -78,7 +73,7 @@ private void SearchFileGrid_MouseUp(object sender, MouseButtonEventArgs e)
}
}
- private void CancelImportBtn_Click(object sender, RoutedEventArgs e) => AnimateClose(ImportPanel);
+ private void CancelImportBtn_Click(object sender, RoutedEventArgs e) => animateClose(ImportPanel);
private void ImportBtn_Click(object sender, RoutedEventArgs e)
{
var fileName = Path.GetFileName(ImportFromPath);
@@ -95,7 +90,7 @@ private void ImportBtn_Click(object sender, RoutedEventArgs e)
viewModel.SelectedGameMode = gameMode;
viewModel.SelectedBuildName = fileName;
viewModel.FetchBuild();
- AnimateClose(ImportPanel);
+ animateClose(ImportPanel);
}
ImportChampionList.SelectedValue = null;
ImportGameModeList.SelectedValue = null;
@@ -103,18 +98,18 @@ private void ImportBtn_Click(object sender, RoutedEventArgs e)
#region Animations
- private void Animate(FrameworkElement element, Thickness from, Thickness to, double time = 0.2)
+ private void animate(FrameworkElement element, Thickness from, Thickness to, double time = 0.2)
{
Utils.Animation.FadeIn(BackDrop, time);
Utils.Animation.Margin(element, from, to, time);
}
- private void AnimateOpen(FrameworkElement element, double time = 0.13)
+ private void animateOpen(FrameworkElement element, double time = 0.13)
{
Utils.Animation.FadeIn(BackDrop, time);
Utils.Animation.FadeIn(element, time);
}
- private void AnimateClose(FrameworkElement element, double time = 0.13)
+ private void animateClose(FrameworkElement element, double time = 0.13)
{
Utils.Animation.FadeOut(BackDrop, time);
Utils.Animation.FadeOut(element, time);
diff --git a/LoL Assist/ViewModel/Command.cs b/LoL Assist/Commands/Command.cs
similarity index 91%
rename from LoL Assist/ViewModel/Command.cs
rename to LoL Assist/Commands/Command.cs
index 497f46a..2f59a89 100644
--- a/LoL Assist/ViewModel/Command.cs
+++ b/LoL Assist/Commands/Command.cs
@@ -1,9 +1,9 @@
using System.Windows.Input;
using System;
-namespace LoL_Assist_WAPP.ViewModel
+namespace LoL_Assist_WAPP.Commands
{
- public class Command : ICommand
+ public class Command: ICommand
{
private readonly Action r_execute;
private readonly Func r_canExecute;
diff --git a/LoL Assist/Commands/ItemInsertedCommand.cs b/LoL Assist/Commands/ItemInsertedCommand.cs
new file mode 100644
index 0000000..7c7ce02
--- /dev/null
+++ b/LoL Assist/Commands/ItemInsertedCommand.cs
@@ -0,0 +1,31 @@
+using LoL_Assist_WAPP.ViewModels;
+using System.Windows.Input;
+using System;
+
+namespace LoL_Assist_WAPP.Commands
+{
+ public class ItemInsertedCommand: ICommand
+ {
+ private readonly ItemListViewModel _viewModel;
+ public ItemInsertedCommand(ItemListViewModel itemListingViewModel)
+ {
+ _viewModel = itemListingViewModel;
+ }
+
+ public void Execute(object parameter)
+ {
+ _viewModel.InsertItem(_viewModel.InsertedItemViewModel, _viewModel.TargetItemViewModel);
+ }
+
+ public event EventHandler CanExecuteChanged;
+
+ public bool CanExecute(object parameter)
+ {
+ return true;
+ }
+ protected void OnCanExecuteChanged()
+ {
+ this.CanExecuteChanged?.Invoke(this, new EventArgs());
+ }
+ }
+}
diff --git a/LoL Assist/Commands/ItemReceivedCommand.cs b/LoL Assist/Commands/ItemReceivedCommand.cs
new file mode 100644
index 0000000..ff76793
--- /dev/null
+++ b/LoL Assist/Commands/ItemReceivedCommand.cs
@@ -0,0 +1,31 @@
+using LoL_Assist_WAPP.ViewModels;
+using System.Windows.Input;
+using System;
+
+namespace LoL_Assist_WAPP.Commands
+{
+ public class ItemReceivedCommand: ICommand
+ {
+ private readonly ItemListViewModel _viewModel;
+ public ItemReceivedCommand(ItemListViewModel itemListingViewModel)
+ {
+ _viewModel = itemListingViewModel;
+ }
+
+ public void Execute(object parameter)
+ {
+ _viewModel.AddItem(_viewModel.IncomingItemViewModel);
+ }
+
+ public event EventHandler CanExecuteChanged;
+
+ public bool CanExecute(object parameter)
+ {
+ return true;
+ }
+ protected void OnCanExecuteChanged()
+ {
+ this.CanExecuteChanged?.Invoke(this, new EventArgs());
+ }
+ }
+}
diff --git a/LoL Assist/Commands/ItemRemovedCommand.cs b/LoL Assist/Commands/ItemRemovedCommand.cs
new file mode 100644
index 0000000..2271f63
--- /dev/null
+++ b/LoL Assist/Commands/ItemRemovedCommand.cs
@@ -0,0 +1,31 @@
+using LoL_Assist_WAPP.ViewModels;
+using System.Windows.Input;
+using System;
+
+namespace LoL_Assist_WAPP.Commands
+{
+ public class ItemRemovedCommand: ICommand
+ {
+ private readonly ItemListViewModel _viewModel;
+ public ItemRemovedCommand(ItemListViewModel itemListingViewModel)
+ {
+ _viewModel = itemListingViewModel;
+ }
+
+ public void Execute(object parameter)
+ {
+ _viewModel.RemoveItem(_viewModel.RemovedItemViewModel);
+ }
+
+ public event EventHandler CanExecuteChanged;
+
+ public bool CanExecute(object parameter)
+ {
+ return true;
+ }
+ protected void OnCanExecuteChanged()
+ {
+ this.CanExecuteChanged?.Invoke(this, new EventArgs());
+ }
+ }
+}
diff --git a/LoL Assist/Converters/ChampionToImageConverter.cs b/LoL Assist/Converters/ChampionToImageConverter.cs
new file mode 100644
index 0000000..2b88f94
--- /dev/null
+++ b/LoL Assist/Converters/ChampionToImageConverter.cs
@@ -0,0 +1,37 @@
+using LoLA.Networking.WebWrapper.DataDragon;
+using LoLA.Networking.WebWrapper.DataDragon.Data;
+using System.Windows.Media.Imaging;
+using System.Windows.Data;
+using System.IO;
+using System;
+
+namespace LoL_Assist_WAPP.Converters
+{
+ public class ChampionToImageConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ object result = null;
+ var path = DataDragonWrapper.GetChampionImagePath(Converter.ChampionNameToId(value.ToString()));
+
+ if (!string.IsNullOrEmpty(path) && File.Exists(path))
+ {
+ using (var stream = File.OpenRead(path))
+ {
+ var image = new BitmapImage();
+ image.BeginInit();
+ image.CacheOption = BitmapCacheOption.OnLoad;
+ image.StreamSource = stream;
+ image.EndInit();
+ result = image;
+ }
+ }
+ return result;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/LoL Assist/Converters/ProviderConverter.cs b/LoL Assist/Converters/ProviderConverter.cs
index 8fcf09b..1169ea0 100644
--- a/LoL Assist/Converters/ProviderConverter.cs
+++ b/LoL Assist/Converters/ProviderConverter.cs
@@ -5,7 +5,7 @@ namespace LoL_Assist_WAPP.Converters
{
public static class ProviderConverter
{
- // Test
+ // Hewwo
public static string ToName(Provider provider)
=> provider switch {
Provider.UGG => "U.GG",
diff --git a/LoL Assist/DataTemplates.xaml b/LoL Assist/DataTemplates.xaml
deleted file mode 100644
index 23ea96f..0000000
--- a/LoL Assist/DataTemplates.xaml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/LoL Assist/Features/AutoMessage.cs b/LoL Assist/Features/AutoMessage.cs
new file mode 100644
index 0000000..8e44fe9
--- /dev/null
+++ b/LoL Assist/Features/AutoMessage.cs
@@ -0,0 +1,31 @@
+using LoLA.Networking.LCU.Events;
+using LoLA.Networking.LCU.Enums;
+using LoL_Assist_WAPP.Models;
+using LoLA.Networking.LCU;
+using System;
+
+namespace LoL_Assist_WAPP.Features
+{
+ public static class AutoMessage
+ {
+ public static void Init()
+ => LoLAWrapper.s_PhaseMonitor.PhaseChanged += phase_Changed;
+
+ private static async void phase_Changed(object sender, PhaseMonitor.PhaseChangedArgs e)
+ {
+ if (ConfigModel.s_Config.AutoMessage)
+ {
+ if (e.currentPhase == Phase.ChampSelect)
+ {
+ var type = e.currentPhase.ToString();
+ var convo = await LCUWrapper.GetConversationAsync();
+
+ await LCUWrapper.SendMessageAsync(convo, ConfigModel.s_Config.Message, type);
+
+ if (ConfigModel.s_Config.ClearMessageAfterSent)
+ ConfigModel.s_Config.Message = string.Empty;
+ }
+ }
+ }
+ }
+}
diff --git a/LoL Assist/LoL Assist.csproj b/LoL Assist/LoL Assist.csproj
index 9052cf7..46c7c25 100644
--- a/LoL Assist/LoL Assist.csproj
+++ b/LoL Assist/LoL Assist.csproj
@@ -70,9 +70,6 @@
False
..\LoLA\LoLA\bin\Debug\LoLA.dll
-
- ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll
-
@@ -100,6 +97,11 @@
BuildEditorWindow.xaml
+
+
+
+
+
@@ -109,13 +111,14 @@
-
+
-
-
-
-
+
+
+
+
+
True
True
@@ -124,48 +127,60 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ChampionItemListView.xaml
+
+
+ ChampionPickerPanel.xaml
+
+
ConfigPanel.xaml
-
+
DownloadPanel.xaml
-
+
MessageBox.xaml
-
+
+ MessagePanel.xaml
+
+
MsgBox.xaml
-
+
InfoPanel.xaml
-
+
MatchFoundPanel.xaml
-
- PatchNotesPanel.xaml
-
-
+
RuneEditorPanel.xaml
+
+ MainWIndow.xaml
+
Designer
MSBuild:Compile
-
+
Designer
MSBuild:Compile
-
+
Designer
MSBuild:Compile
@@ -181,39 +196,51 @@
MainWindow.xaml
Code
-
+
Designer
MSBuild:Compile
-
+
Designer
MSBuild:Compile
-
+
+ MSBuild:Compile
+ Designer
+
+
Designer
MSBuild:Compile
-
+
Designer
MSBuild:Compile
-
+
Designer
MSBuild:Compile
-
+
Designer
MSBuild:Compile
-
+
Designer
MSBuild:Compile
-
+
Designer
MSBuild:Compile
-
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
Designer
MSBuild:Compile
@@ -232,7 +259,6 @@
Resources.Designer.cs
-
SettingsSingleFileGenerator
Settings.Designer.cs
@@ -766,5 +792,22 @@
+
+
+ 13.0.1
+
+
+
+
+ {F935DC20-1CF0-11D0-ADB9-00C04FD58A0B}
+ 1
+ 0
+ 0
+ tlbimp
+ False
+ True
+
+
+
\ No newline at end of file
diff --git a/LoL Assist/MainWindow.xaml b/LoL Assist/MainWindow.xaml
index d86b58a..7efdf54 100644
--- a/LoL Assist/MainWindow.xaml
+++ b/LoL Assist/MainWindow.xaml
@@ -3,17 +3,13 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:view="clr-namespace:LoL_Assist_WAPP.View" x:Name="Me"
- xmlns:viewModel ="clr-namespace:LoL_Assist_WAPP.ViewModel"
- mc:Ignorable="d" WindowStartupLocation="CenterScreen" Background="{DynamicResource bBrushSecondary}" RenderOptions.BitmapScalingMode="HighQuality" Topmost="{Binding Path=Topmost, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
+ xmlns:view="clr-namespace:LoL_Assist_WAPP.Views" x:Name="Me"
+ mc:Ignorable="d" WindowStartupLocation="CenterScreen" Background="{DynamicResource bBrushSecondary}" RenderOptions.BitmapScalingMode="HighQuality" Topmost="True"
Title="LoL Assist" Height="380" Width="505" MinHeight="380" MinWidth="505" MaxHeight="350" MaxWidth="485" BorderBrush="{DynamicResource BorderGradientBrush}" BorderThickness="1">
-
-
-
@@ -54,7 +50,7 @@
-
@@ -79,11 +75,16 @@
-
-
+
-
+
+
@@ -137,7 +138,7 @@
-
+
@@ -146,56 +147,67 @@
-
-
-
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
@@ -209,21 +221,41 @@
-
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -233,39 +265,15 @@
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
diff --git a/LoL Assist/MainWindow.xaml.cs b/LoL Assist/MainWindow.xaml.cs
index 5773aee..b06ed53 100644
--- a/LoL Assist/MainWindow.xaml.cs
+++ b/LoL Assist/MainWindow.xaml.cs
@@ -1,9 +1,8 @@
-using System.Windows.Controls;
-using LoL_Assist_WAPP.Model;
-using System.Windows.Input;
+using LoL_Assist_WAPP.ViewModels;
+using System.Windows.Controls;
+using LoL_Assist_WAPP.Models;
using System.Windows;
using System;
-using System.Windows.Media;
namespace LoL_Assist_WAPP
{
@@ -12,14 +11,15 @@ namespace LoL_Assist_WAPP
///
public partial class MainWindow : Window
{
- private readonly View.InfoPanel InfoPanel;
- private readonly View.ConfigPanel ConfigPanel;
+ private readonly Views.InfoPanel InfoPanel;
+ private readonly Views.ConfigPanel ConfigPanel;
public MainWindow()
{
InitializeComponent();
+ DataContext = new MainViewModel();
- ConfigPanel = new View.ConfigPanel(BackDrop);
- InfoPanel = new View.InfoPanel(BackDrop);
+ ConfigPanel = new Views.ConfigPanel(BackDrop);
+ InfoPanel = new Views.InfoPanel(BackDrop);
ConfigPanel.Margin = ConfigModel.r_MarginClose;
InfoPanel.Margin = ConfigModel.r_MarginClose;
@@ -31,13 +31,13 @@ public MainWindow()
MainGrid.Children.Add(ConfigPanel);
}
- private void Animate(FrameworkElement element, Thickness from, Thickness to, double time = 0.2)
+ private void animate(FrameworkElement element, Thickness from, Thickness to, double time = 0.2)
{
Utils.Animation.FadeIn(BackDrop, time);
Utils.Animation.Margin(element, from, to, time);
}
- private void SettingsBtn_Click(object sender, RoutedEventArgs e) => Animate(ConfigPanel, ConfigModel.r_MarginClose, ConfigModel.r_MarginOpen);
- private void InfoBtn_Click(object sender, RoutedEventArgs e) => Animate(InfoPanel, ConfigModel.r_MarginClose, ConfigModel.r_MarginOpen);
+ private void InfoBtn_Click(object sender, RoutedEventArgs e) => animate(InfoPanel, ConfigModel.r_MarginClose, ConfigModel.r_MarginOpen);
+ private void OptionsBtn_Click(object sender, RoutedEventArgs e) => animate(ConfigPanel, ConfigModel.r_MarginClose, ConfigModel.r_MarginOpen);
}
}
diff --git a/LoL Assist/Model/ConfigModel.cs b/LoL Assist/Models/ConfigModel.cs
similarity index 85%
rename from LoL Assist/Model/ConfigModel.cs
rename to LoL Assist/Models/ConfigModel.cs
index c226878..577e0b1 100644
--- a/LoL Assist/Model/ConfigModel.cs
+++ b/LoL Assist/Models/ConfigModel.cs
@@ -7,12 +7,12 @@
using System.IO;
using LoLA;
-namespace LoL_Assist_WAPP.Model
+namespace LoL_Assist_WAPP.Models
{
public static class ConfigModel
{
public static Config s_Config = new Config();
- public static Provider s_CurrentProvider = Provider.UGG;
+ public static Provider s_CurrentProvider = Provider.METAsrc;
public static readonly Thickness r_MarginOpen = new Thickness(0, 0, 0, 0);
public static readonly Thickness r_MarginClose = new Thickness(505, 0, 0, 0); // Main window width
public static readonly string r_Version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
@@ -21,7 +21,7 @@ public static class ConfigModel
public class Config
{
#region General
- public int MonitoringDelay { get; set; } = 250;
+ public int UpdateDelay { get; set; } = 250;
public bool AutoRunes { get; set; } = true;
public bool AutoAccept { get; set; } = true;
public bool AutoSpells { get; set; } = true;
@@ -36,7 +36,13 @@ public class Config
public bool BuildCache { get; set; } = true;
public bool UpdateOnStartup { get; set; } = true;
//public string Theme { get; set; } = "Default";
- public bool DoNotShowPatch { get; set; } = false;
+ public Provider Provider { get; set; } = Provider.METAsrc;
+ #endregion
+
+ #region AutoMessage
+ public bool AutoMessage { get; set; } = false;
+ public string Message { get; set; }
+ public bool ClearMessageAfterSent { get; set; } = true;
#endregion
}
diff --git a/LoL Assist/Model/ItemImageModel.cs b/LoL Assist/Models/ItemImageModel.cs
similarity index 80%
rename from LoL Assist/Model/ItemImageModel.cs
rename to LoL Assist/Models/ItemImageModel.cs
index 8a68d8b..e01f234 100644
--- a/LoL Assist/Model/ItemImageModel.cs
+++ b/LoL Assist/Models/ItemImageModel.cs
@@ -1,5 +1,5 @@
-namespace LoL_Assist_WAPP.Model
+namespace LoL_Assist_WAPP.Models
{
public class ItemImageModel
{
diff --git a/LoL Assist/Model/LoLAWrapper.cs b/LoL Assist/Models/LoLAWrapper.cs
similarity index 91%
rename from LoL Assist/Model/LoLAWrapper.cs
rename to LoL Assist/Models/LoLAWrapper.cs
index c033e5f..e77f476 100644
--- a/LoL Assist/Model/LoLAWrapper.cs
+++ b/LoL Assist/Models/LoLAWrapper.cs
@@ -1,20 +1,19 @@
-using LoLA.Networking.WebWrapper.DataDragon.Data;
-using LoLA.Networking.LCU.Objects;
+using LoLA.Networking.LCU.Objects;
using LoLA.Networking.LCU.Events;
using System.Collections.Generic;
+using Converter = LoLA.Networking.WebWrapper.DataDragon.Data.Converter;
using LoLA.Networking.LCU.Enums;
using System.Threading.Tasks;
using LoLA.Networking.LCU;
using LoLA.Data;
using LoLA;
-using Converter = LoLA.Networking.WebWrapper.DataDragon.Data.Converter;
-namespace LoL_Assist_WAPP.Model
+namespace LoL_Assist_WAPP.Models
{
public class LoLAWrapper
{
- public static PhaseMonitor phaseMonitor = new PhaseMonitor();
- public static ChampionMonitor champMonitor = new ChampionMonitor();
+ public static PhaseMonitor s_PhaseMonitor = new PhaseMonitor();
+ public static ChampionMonitor s_ChampMonitor = new ChampionMonitor();
public static async Task SetRuneAsync(Rune rune, RunePage CurrentRunePage, bool forceUpdate = false)
{
diff --git a/LoL Assist/Models/MessageBoxModel.cs b/LoL Assist/Models/MessageBoxModel.cs
new file mode 100644
index 0000000..69d223e
--- /dev/null
+++ b/LoL Assist/Models/MessageBoxModel.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LoL_Assist_WAPP.Models
+{
+ public class MessageBoxModel
+ {
+ public Action Action { get; set; }
+ public string Message { get; set; }
+ public string Title { get; set; }
+ public double Width { get; set; }
+ public double Height { get; set; }
+ }
+}
diff --git a/LoL Assist/Model/ProgressReportModel.cs b/LoL Assist/Models/ProgressReportModel.cs
similarity index 90%
rename from LoL Assist/Model/ProgressReportModel.cs
rename to LoL Assist/Models/ProgressReportModel.cs
index c2a2348..45c193a 100644
--- a/LoL Assist/Model/ProgressReportModel.cs
+++ b/LoL Assist/Models/ProgressReportModel.cs
@@ -4,7 +4,7 @@
using System.Text;
using System.Threading.Tasks;
-namespace LoL_Assist_WAPP.Model
+namespace LoL_Assist_WAPP.Models
{
public class ProgressReportModel
{
diff --git a/LoL Assist/Model/RuneModel.cs b/LoL Assist/Models/RuneModel.cs
similarity index 99%
rename from LoL Assist/Model/RuneModel.cs
rename to LoL Assist/Models/RuneModel.cs
index 5ca5a0b..42fbde3 100644
--- a/LoL Assist/Model/RuneModel.cs
+++ b/LoL Assist/Models/RuneModel.cs
@@ -3,7 +3,7 @@
using LoL_Assist_WAPP.Utils;
using System;
-namespace LoL_Assist_WAPP.Model
+namespace LoL_Assist_WAPP.Models
{
public static class RuneModel
{
diff --git a/LoL Assist/Properties/AssemblyInfo.cs b/LoL Assist/Properties/AssemblyInfo.cs
index c6ce7e2..be334d7 100644
--- a/LoL Assist/Properties/AssemblyInfo.cs
+++ b/LoL Assist/Properties/AssemblyInfo.cs
@@ -51,6 +51,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("2.0.0.0")]
-[assembly: AssemblyFileVersion("2.0.0.0")]
+[assembly: AssemblyVersion("2.0.0.5")]
+[assembly: AssemblyFileVersion("2.0.0.5")]
[assembly: NeutralResourcesLanguage("")]
diff --git a/LoL Assist/ResourceDictionaries/DataTemplates.xaml b/LoL Assist/ResourceDictionaries/DataTemplates.xaml
new file mode 100644
index 0000000..7114e76
--- /dev/null
+++ b/LoL Assist/ResourceDictionaries/DataTemplates.xaml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/LoL Assist/Styles.xaml b/LoL Assist/ResourceDictionaries/Styles.xaml
similarity index 96%
rename from LoL Assist/Styles.xaml
rename to LoL Assist/ResourceDictionaries/Styles.xaml
index 712d2c5..d7ffd25 100644
--- a/LoL Assist/Styles.xaml
+++ b/LoL Assist/ResourceDictionaries/Styles.xaml
@@ -1,12 +1,16 @@
-
-
+ xmlns:converters="clr-namespace:LoL_Assist_WAPP.Converters"
+ xmlns:theme="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero2">
+
+
+
M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z
M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z
-
+ M5,20h14v-2H5V20z M19,9h-4V3H9v6H5l7,7L19,9z
+
+
@@ -282,7 +286,7 @@
-
+
@@ -355,17 +359,17 @@
-
+
@@ -383,7 +387,7 @@
-
+
@@ -483,13 +487,16 @@
-
+
+
+
+
@@ -503,7 +510,7 @@
-
+
@@ -544,7 +551,7 @@
-
+
@@ -760,19 +767,23 @@
-
+
-
+ BorderThickness="0" Height="{TemplateBinding Height}"
+
+ Panel.ZIndex="2" Margin="3,2"/>
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Full Change Log
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/LoL Assist/ViewModel/MessageBoxViewModel.cs b/LoL Assist/ViewModel/MessageBoxViewModel.cs
deleted file mode 100644
index 3fc3df6..0000000
--- a/LoL Assist/ViewModel/MessageBoxViewModel.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System;
-using System.ComponentModel;
-
-namespace LoL_Assist_WAPP.ViewModel
-{
- internal class MessageBoxViewModel : INotifyPropertyChanged
- {
- public Action Action { get; set; }
- public string Message { get; set; }
- public string Title { get; set; }
- public double Width { get; set; }
- public double Height { get; set; }
-
- public event PropertyChangedEventHandler PropertyChanged;
- protected void OnPropertyChanged(string propertyName)
- => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
- }
-}
diff --git a/LoL Assist/ViewModel/PatchViewModel.cs b/LoL Assist/ViewModel/PatchViewModel.cs
deleted file mode 100644
index af93cb4..0000000
--- a/LoL Assist/ViewModel/PatchViewModel.cs
+++ /dev/null
@@ -1,106 +0,0 @@
-using System.Windows.Controls;
-using LoL_Assist_WAPP.Model;
-using System.ComponentModel;
-using System.Windows.Input;
-using System.Diagnostics;
-using System.Text;
-
-namespace LoL_Assist_WAPP.ViewModel
-{
- public class PatchViewModel : INotifyPropertyChanged
- {
- public ICommand RunUrlCommand { get; }
-
- private ICommand _hideUserControlCommand;
- public ICommand HideUserControlCommand
- {
- get
- {
- if (_hideUserControlCommand == null)
- {
- _hideUserControlCommand = new Command(o => hideUserControl(o));
- }
- return _hideUserControlCommand;
- }
- }
-
- private bool _doNotShowPatchNote;
- public bool DoNotShowPatchNote
- {
- get => _doNotShowPatchNote;
- set
- {
- if (_doNotShowPatchNote != value)
- {
- _doNotShowPatchNote = value;
-
- ConfigModel.s_Config.DoNotShowPatch = value;
- ConfigModel.SaveConfig();
-
- OnPropertyChanged(nameof(DoNotShowPatchNote));
- }
- }
- }
-
- private string _patchNotes;
- public string PatchNotes
- {
- get => _patchNotes;
- set
- {
- if (_patchNotes != value)
- {
- _patchNotes = value;
- OnPropertyChanged(nameof(PatchNotes));
- }
- }
- }
-
- private string _title;
- public string Title
- {
- get => _title;
- set
- {
- if (_title != value)
- {
- _title = value;
- OnPropertyChanged(nameof(Title));
- }
- }
- }
-
- public PatchViewModel()
- {
- RunUrlCommand = new Command(o => { Process.Start("https://www.youtube.com/watch?v=dQw4w9WgXcQ"); });
- DoNotShowPatchNote = ConfigModel.s_Config.DoNotShowPatch;
- Title = $"What's New in v{ConfigModel.r_Version}";
- initPatchNote();
- }
-
- private void initPatchNote()
- {
- StringBuilder patchNotes = new StringBuilder();
- patchNotes.AppendLine("• Added U.GG Runes");
- patchNotes.AppendLine("• Added a realtime rune editor");
- patchNotes.AppendLine("• Better LeagueClient detection");
- patchNotes.AppendLine("• Using new rewritten LoLA library");
- patchNotes.AppendLine("• Added runes & spells provider/source option");
- patchNotes.AppendLine("• Moved directory data from '\\AppData\\Local\\Temp\\LoLA' to '\\AppData\\Local\\Temp\\LoLA Data'");
- patchNotes.AppendLine("• Minor design changes (tooltip, button, etc)");
-
- patchNotes.AppendLine("• Fixed minimize to tray");
- patchNotes.AppendLine("• Fixed an issue where role selection reset after phase changed");
- patchNotes.AppendLine("• Fixed LoL Assist crashing issue when launching LeagueClient");
- patchNotes.AppendLine("• Fixed an issue where Phase Monitor won't update at initialize");
-
- PatchNotes = patchNotes.ToString();
- }
-
- private void hideUserControl(object p) => Utils.Animation.FadeOut(p as UserControl);
-
- public event PropertyChangedEventHandler PropertyChanged;
- protected void OnPropertyChanged(string propertyName)
- => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
- }
-}
diff --git a/LoL Assist/ViewModel/BuildEditorViewModel.cs b/LoL Assist/ViewModels/BuildEditorViewModel.cs
similarity index 84%
rename from LoL Assist/ViewModel/BuildEditorViewModel.cs
rename to LoL Assist/ViewModels/BuildEditorViewModel.cs
index 10d29bb..0458d01 100644
--- a/LoL Assist/ViewModel/BuildEditorViewModel.cs
+++ b/LoL Assist/ViewModels/BuildEditorViewModel.cs
@@ -5,27 +5,30 @@
using System.Collections.Generic;
using LoL_Assist_WAPP.Converters;
using LoLA.Networking.LCU.Enums;
+using LoL_Assist_WAPP.Commands;
using System.Threading.Tasks;
+using LoL_Assist_WAPP.Models;
using System.ComponentModel;
-using LoL_Assist_WAPP.Model;
using System.Windows.Input;
using System.Threading;
using Newtonsoft.Json;
+using System.Windows;
using System.Linq;
using LoLA.Data;
using System.IO;
using System;
using LoLA;
+using LoLA.Networking.LCU.Objects;
-namespace LoL_Assist_WAPP.ViewModel
+namespace LoL_Assist_WAPP.ViewModels
{
- public class BuildEditorViewModel : INotifyPropertyChanged
+ public class BuildEditorViewModel: ViewModelBase
{
#region Commands
public ICommand SaveCommand { get; }
public ICommand SetAsDefaultCommand { get; }
public ICommand ClearDefaultSourceCommand { get; }
-
+ public ICommand MoveWindowCommand { get; }
private void setAsDefaultExecute()
{
try
@@ -101,6 +104,7 @@ private async void saveConfigExecute()
BuildsName = _buildsName;
SelectedBuildName = Path.GetFileName(filePath);
+ await saved();
}
else if(string.IsNullOrEmpty(FileName))
{
@@ -108,7 +112,6 @@ private async void saveConfigExecute()
await Task.Delay(2500);
WarningText = null;
}
- await saved();
}
#endregion
@@ -243,9 +246,13 @@ public ItemImageModel SelectedSpell1
{
_selectedSpell1 = value;
SelectedSpell2 = removeDup(SelectedSpell1, SelectedSpell2);
- if(value != null)
- selectedBuild.Spell.First = DataConverter.SpellNameToSpellId(value.Text);
-
+ if (value != null)
+ {
+ #if DEBUG
+ Console.WriteLine($"Selected First Spell: {selectedBuild.Spells.First().First} | val: {value.Text}");
+ #endif
+ selectedBuild.Spells.FirstOrDefault().First = DataConverter.SpellNameToSpellId(value.Text);
+ }
OnPropertyChanged(nameof(SelectedSpell1));
isChanged();
}
@@ -263,7 +270,12 @@ public ItemImageModel SelectedSpell2
_selectedSpell2 = value;
SelectedSpell1 = removeDup(SelectedSpell2, SelectedSpell1);
if(value != null)
- selectedBuild.Spell.Second = DataConverter.SpellNameToSpellId(value.Text);
+ {
+ #if DEBUG
+ Console.WriteLine($"Selected Second Spell: {selectedBuild.Spells.First().Second} | val: {value.Text}");
+ #endif
+ selectedBuild.Spells.FirstOrDefault().Second = DataConverter.SpellNameToSpellId(value.Text);
+ }
OnPropertyChanged(nameof(SelectedSpell2));
isChanged();
@@ -284,7 +296,7 @@ public string RuneName
_runeName = value;
if(value != null)
- selectedBuild.Rune.Name = value;
+ selectedBuild.Runes.FirstOrDefault().Name = value;
OnPropertyChanged(nameof(RuneName));
isChanged();
@@ -317,7 +329,7 @@ public ItemImageModel SelectedPath1
_selectedPath1 = value;
SelectedPath2 = removeDup(SelectedPath1, SelectedPath2);
if(value != null)
- selectedBuild.Rune.PrimaryPath = LoLA.Networking.WebWrapper.DataDragon.Data.Converter.PathNameToId(value.Text);
+ selectedBuild.Runes.FirstOrDefault().PrimaryPath = Converter.PathNameToId(value.Text);
OnPropertyChanged(nameof(SelectedPath1));
path1Changed();
@@ -350,7 +362,7 @@ public ItemImageModel SelectedKeystone
{
_selectedKeystone = value;
if(value != null)
- selectedBuild.Rune.Keystone = LoLA.Networking.WebWrapper.DataDragon.Data.Converter.PerkNameToId(value.Text);
+ selectedBuild.Runes.FirstOrDefault().Keystone = Converter.PerkNameToId(value.Text);
OnPropertyChanged(nameof(SelectedKeystone));
isChanged();
@@ -382,7 +394,7 @@ public ItemImageModel SelectedPerk1
{
_selectedPerk1 = value;
if(value!=null)
- selectedBuild.Rune.Slot1 = LoLA.Networking.WebWrapper.DataDragon.Data.Converter.PerkNameToId(value.Text);
+ selectedBuild.Runes.FirstOrDefault().Slot1 = Converter.PerkNameToId(value.Text);
OnPropertyChanged(nameof(SelectedPerk1));
isChanged();
@@ -414,7 +426,7 @@ public ItemImageModel SelectedPerk2
{
_selectedPerk2 = value;
if(value != null)
- selectedBuild.Rune.Slot2 = LoLA.Networking.WebWrapper.DataDragon.Data.Converter.PerkNameToId(value.Text);
+ selectedBuild.Runes.FirstOrDefault().Slot2 = Converter.PerkNameToId(value.Text);
OnPropertyChanged(nameof(SelectedPerk2));
isChanged();
@@ -446,7 +458,7 @@ public ItemImageModel SelectedPerk3
{
_selectedPerk3 = value;
if(value!=null)
- selectedBuild.Rune.Slot3 = LoLA.Networking.WebWrapper.DataDragon.Data.Converter.PerkNameToId(value.Text);
+ selectedBuild.Runes.First().Slot3 = Converter.PerkNameToId(value.Text);
OnPropertyChanged(nameof(SelectedPerk3));
isChanged();
@@ -464,7 +476,7 @@ public ItemImageModel SelectedPath2
{
_selectedPath2 = value;
if(value != null)
- selectedBuild.Rune.SecondaryPath = LoLA.Networking.WebWrapper.DataDragon.Data.Converter.PathNameToId(value.Text);
+ selectedBuild.Runes.FirstOrDefault().SecondaryPath = Converter.PathNameToId(value.Text);
SelectedPath1 = removeDup(SelectedPath2, SelectedPath1);
OnPropertyChanged(nameof(SelectedPath2));
@@ -498,7 +510,7 @@ public ItemImageModel SelectedPerk4
{
_selectedPerk4 = value;
if(value!=null)
- selectedBuild.Rune.Slot4 = LoLA.Networking.WebWrapper.DataDragon.Data.Converter.PerkNameToId(value.Text);
+ selectedBuild.Runes.FirstOrDefault().Slot4 = Converter.PerkNameToId(value.Text);
SelectedPerk5 = removeDup(value, SelectedPerk5);
OnPropertyChanged(nameof(SelectedPerk4));
@@ -532,7 +544,7 @@ public ItemImageModel SelectedPerk5
{
_selectedPerk5 = value;
if(value != null)
- selectedBuild.Rune.Slot5 = LoLA.Networking.WebWrapper.DataDragon.Data.Converter.PerkNameToId(value.Text);
+ selectedBuild.Runes.FirstOrDefault().Slot5 = Converter.PerkNameToId(value.Text);
SelectedPerk4 = removeDup(value, SelectedPerk4);
OnPropertyChanged(nameof(SelectedPerk5));
@@ -565,7 +577,7 @@ public ItemImageModel SelectedShard1
{
_selectedShard1 = value;
if (value != null)
- selectedBuild.Rune.Shard1 = DataConverter.ShardDescriptionToShardId(value.Text);
+ selectedBuild.Runes.FirstOrDefault().Shard1 = DataConverter.ShardDescriptionToShardId(value.Text);
SelectedPerk4 = removeDup(SelectedShard1, SelectedPerk4);
OnPropertyChanged(nameof(SelectedShard1));
@@ -598,7 +610,7 @@ public ItemImageModel SelectedShard2
{
_selectedShard2 = value;
if (value != null)
- selectedBuild.Rune.Shard2 = DataConverter.ShardDescriptionToShardId(value.Text);
+ selectedBuild.Runes.FirstOrDefault().Shard2 = DataConverter.ShardDescriptionToShardId(value.Text);
SelectedPerk4 = removeDup(SelectedShard2, SelectedPerk4);
OnPropertyChanged(nameof(SelectedShard2));
@@ -631,7 +643,7 @@ public ItemImageModel SelectedShard3
{
_selectedShard3 = value;
if (value != null)
- selectedBuild.Rune.Shard3 = DataConverter.ShardDescriptionToShardId(value.Text);
+ selectedBuild.Runes.FirstOrDefault().Shard3 = DataConverter.ShardDescriptionToShardId(value.Text);
SelectedPerk4 = removeDup(SelectedShard3, SelectedPerk4);
OnPropertyChanged(nameof(SelectedShard3));
@@ -719,9 +731,16 @@ public BuildEditorViewModel()
Shards2 = RuneModel.Shards(2, false);
Shards3 = RuneModel.Shards(3, false);
- SaveCommand = new Command(o => { saveConfigExecute(); });
- SetAsDefaultCommand = new Command(o => { setAsDefaultExecute(); });
- ClearDefaultSourceCommand = new Command(o => { clearDefaultSourceExecute(); });
+ MoveWindowCommand = new Command(wnd => dragMove(wnd));
+ SaveCommand = new Command(_ => saveConfigExecute());
+ SetAsDefaultCommand = new Command(_ => setAsDefaultExecute());
+ ClearDefaultSourceCommand = new Command(_ => clearDefaultSourceExecute());
+ }
+
+ private void dragMove(object wnd)
+ {
+ var window = wnd as Window;
+ window.DragMove();
}
public async void Init()
@@ -794,6 +813,11 @@ await Task.Run(() => {
Spells = spells;
BuildsName = buildsName;
});
+
+ // bad : (
+ //selectedBuild = new ;
+
+
}
else
{
@@ -955,34 +979,56 @@ private void perk4Changed()
private void loadBuild(ChampionBuild championBuild)
{
- try
+ if(championBuild.Spells != null && championBuild.Spells.Count > 0)
{
- SelectedSpell1 = Spells.SingleOrDefault(s => s.Text == DataConverter.SpellIdToSpellName(championBuild.Spell.First));
- SelectedSpell2 = Spells.SingleOrDefault(s => s.Text == DataConverter.SpellIdToSpellName(championBuild.Spell.Second));
- } catch { }
-
- try
+ var spell = championBuild.Spells.First();
+ try
+ {
+ SelectedSpell1 = Spells.SingleOrDefault(s => s.Text == DataConverter.SpellIdToSpellName(spell.First));
+ SelectedSpell2 = Spells.SingleOrDefault(s => s.Text == DataConverter.SpellIdToSpellName(spell.Second));
+ }
+ catch { }
+ }
+ else
{
- RuneName = championBuild.Rune.Name;
- SelectedPath1 = RunePaths.SingleOrDefault(p => p.Text == Converter.PathIdToName(championBuild.Rune.PrimaryPath));
- SelectedKeystone = Keystones.SingleOrDefault(k => k.Text == Converter.PerkIdToName(championBuild.Rune.Keystone));
- SelectedPerk1 = Perks1.SingleOrDefault(p => p.Text == Converter.PerkIdToName(championBuild.Rune.Slot1));
- SelectedPerk2 = Perks2.SingleOrDefault(p => p.Text == Converter.PerkIdToName(championBuild.Rune.Slot2));
- SelectedPerk3 = Perks3.SingleOrDefault(p => p.Text == Converter.PerkIdToName(championBuild.Rune.Slot3));
-
- SelectedPath2 = RunePaths.SingleOrDefault(p => p.Text == Converter.PathIdToName(championBuild.Rune.SecondaryPath));
- SelectedPerk4 = Perks4.SingleOrDefault(p => p.Text == Converter.PerkIdToName(championBuild.Rune.Slot4));
- SelectedPerk5 = Perks5.SingleOrDefault(p => p.Text == Converter.PerkIdToName(championBuild.Rune.Slot5));
+ selectedBuild.Spells = new List();
+ selectedBuild.Spells.Add(new Spell());
+ clearSpells();
}
- catch { }
- try
+ if(championBuild.Runes != null && championBuild.Runes.Count > 0)
{
- SelectedShard1 = Shards1.SingleOrDefault(o => o.Text == DataConverter.ShardIdToShardDescription(championBuild.Rune.Shard1));
- SelectedShard2 = Shards2.SingleOrDefault(f => f.Text == DataConverter.ShardIdToShardDescription(championBuild.Rune.Shard2));
- SelectedShard3 = Shards3.SingleOrDefault(d => d.Text == DataConverter.ShardIdToShardDescription(championBuild.Rune.Shard3));
+ var rune = championBuild.Runes.First();
+ try
+ {
+ RuneName = rune.Name;
+ SelectedPath1 = RunePaths.SingleOrDefault(p => p.Text == Converter.PathIdToName(rune.PrimaryPath));
+ SelectedKeystone = Keystones.SingleOrDefault(k => k.Text == Converter.PerkIdToName(rune.Keystone));
+ SelectedPerk1 = Perks1.SingleOrDefault(p => p.Text == Converter.PerkIdToName(rune.Slot1));
+ SelectedPerk2 = Perks2.SingleOrDefault(p => p.Text == Converter.PerkIdToName(rune.Slot2));
+ SelectedPerk3 = Perks3.SingleOrDefault(p => p.Text == Converter.PerkIdToName(rune.Slot3));
+
+ SelectedPath2 = RunePaths.SingleOrDefault(p => p.Text == Converter.PathIdToName(rune.SecondaryPath));
+ SelectedPerk4 = Perks4.SingleOrDefault(p => p.Text == Converter.PerkIdToName(rune.Slot4));
+ SelectedPerk5 = Perks5.SingleOrDefault(p => p.Text == Converter.PerkIdToName(rune.Slot5));
+ }
+ catch { }
+
+ try
+ {
+ SelectedShard1 = Shards1.SingleOrDefault(o => o.Text == DataConverter.ShardIdToShardDescription(rune.Shard1));
+ SelectedShard2 = Shards2.SingleOrDefault(f => f.Text == DataConverter.ShardIdToShardDescription(rune.Shard2));
+ SelectedShard3 = Shards3.SingleOrDefault(d => d.Text == DataConverter.ShardIdToShardDescription(rune.Shard3));
+ }
+ catch { }
}
- catch { }
+ else
+ {
+ selectedBuild.Runes = new List();
+ selectedBuild.Runes.Add(new Rune());
+ clearRunes();
+ }
+
}
#region Space junk
@@ -1022,16 +1068,35 @@ public void ClearProfile()
SelectedBuildName = null;
referenceBuild = null;
selectedBuild = new ChampionBuild();
+
+ // GOOFY
+ selectedBuild.Spells = new List();
+ selectedBuild.Runes = new List();
+ selectedBuild.Spells.Add(new Spell());
+ selectedBuild.Runes.Add(new Rune());
+ // : D
+
FileName = null;
- RuneName = null;
+
+ clearSpells();
+ clearRunes();
+ }
+
+ private void clearSpells()
+ {
SelectedSpell1 = null;
SelectedSpell2 = null;
+ }
+
+ private void clearRunes()
+ {
+ RuneName = null;
SelectedPerk1 = null;
SelectedPerk2 = null;
SelectedPerk3 = null;
- SelectedPerk4 = null;
+ SelectedPerk4 = null;
SelectedPerk5 = null;
- SelectedKeystone = null;
+ SelectedKeystone = null;
SelectedPath1 = null;
SelectedPath2 = null;
SelectedShard1 = null;
@@ -1045,12 +1110,6 @@ private async Task saved()
await Task.Delay(2500);
SaveInfo = null;
}
-
- public event PropertyChangedEventHandler PropertyChanged;
- protected void OnPropertyChanged(string propertyName)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
- }
#endregion
}
}
diff --git a/LoL Assist/ViewModels/ChampionPickViewModel.cs b/LoL Assist/ViewModels/ChampionPickViewModel.cs
new file mode 100644
index 0000000..ee99823
--- /dev/null
+++ b/LoL Assist/ViewModels/ChampionPickViewModel.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LoL_Assist_WAPP.ViewModels
+{
+ public class ChampionPickViewModel: ViewModelBase
+ {
+ private string _name;
+ public string Name
+ {
+ get => _name;
+ set
+ {
+ if (_name != value)
+ {
+ _name = value;
+ OnPropertyChanged(nameof(Name));
+ }
+ }
+ }
+ }
+}
diff --git a/LoL Assist/ViewModels/ChampionPickerViewModel-Rokuazery.cs b/LoL Assist/ViewModels/ChampionPickerViewModel-Rokuazery.cs
new file mode 100644
index 0000000..4754134
--- /dev/null
+++ b/LoL Assist/ViewModels/ChampionPickerViewModel-Rokuazery.cs
@@ -0,0 +1,70 @@
+using LoLA.Networking.WebWrapper.DataDragon;
+using System.Collections.ObjectModel;
+using System.Threading.Tasks;
+using LoL_Assist_WAPP.Models;
+using System.ComponentModel;
+using System;
+
+namespace LoL_Assist_WAPP.ViewModels
+{
+ public class ChampionPickerViewModel: INotifyPropertyChanged
+ {
+ //private ObservableCollection _champions;
+ //public ObservableCollection Champions
+ //{
+ // get => _champions;
+ // set
+ // {
+ // if (_champions != value)
+ // {
+ // _champions = value;
+ // OnPropertyChanged(nameof(Champions));
+ // }
+ // }
+ //}
+
+ //private ObservableCollection _championPicks;
+ //public ObservableCollection ChampionPicks
+ //{
+ // get => _championPicks;
+ // set
+ // {
+ // if (_championPicks != value)
+ // {
+ // _championPicks = value;
+ // OnPropertyChanged(nameof(ChampionPicks));
+ // }
+ // }
+ //}
+
+ //private ObservableCollection _championBans;
+ //public ObservableCollection ChampionBans
+ //{
+ // get => _championBans;
+ // set
+ // {
+ // if (_championBans != value)
+ // {
+ // _championBans = value;
+ // OnPropertyChanged(nameof(ChampionBans));
+ // }
+ // }
+ //}
+ public ItemListViewModel Champions { get; }
+ public ItemListViewModel ChampionPicks { get; }
+ public ItemListViewModel ChampionBans { get; }
+ public ChampionPickerViewModel()
+ {
+ Champions = new ItemListViewModel();
+ ChampionPicks = new ItemListViewModel();
+ ChampionBans = new ItemListViewModel();
+
+ foreach (var championData in DataDragonWrapper.s_Champions.Data)
+ Champions.AddItem(championData.Value.name);
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+ public void OnPropertyChanged(string propertyName)
+ => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+}
diff --git a/LoL Assist/ViewModels/ChampionPickerViewModel.cs b/LoL Assist/ViewModels/ChampionPickerViewModel.cs
new file mode 100644
index 0000000..5a9f44a
--- /dev/null
+++ b/LoL Assist/ViewModels/ChampionPickerViewModel.cs
@@ -0,0 +1,49 @@
+using LoLA.Networking.WebWrapper.DataDragon;
+using System.Collections.ObjectModel;
+using System.Threading.Tasks;
+using LoL_Assist_WAPP.Models;
+using System.ComponentModel;
+using System;
+using System.Windows.Data;
+
+namespace LoL_Assist_WAPP.ViewModels
+{
+ public class ChampionPickerViewModel: ViewModelBase
+ {
+ private CollectionViewSource ChampionsCollection;
+ public ICollectionView ChampionCollectionView => ChampionsCollection.View;
+
+
+
+ private ObservableCollection _champions;
+ //public ItemListViewModel Champions { get; }
+ //public ItemListViewModel ChampionPicks { get; }
+ public ChampionPickerViewModel()
+ {
+ _champions = new ObservableCollection();
+ ChampionsCollection = new CollectionViewSource { Source = _champions };
+
+ foreach (var championData in DataDragonWrapper.s_Champions.Data)
+ {
+ _champions.Add(championData.Value.name);
+ }
+
+ //Champions = new ItemListViewModel();
+ //ChampionPicks = new ItemListViewModel();
+
+ //int index = 0;
+ //Champions.IsOrigin = true;
+ //foreach (var championData in DataDragonWrapper.s_Champions.Data)
+ //{
+ // var itemViewModel = new ItemViewModel() {
+ // OriginIndex = index,
+ // Content = championData.Value.name
+ // };
+
+ // Champions.AddItem(itemViewModel);
+ // index++;
+ //}
+
+ }
+ }
+}
diff --git a/LoL Assist/ViewModel/ConfigViewModel.cs b/LoL Assist/ViewModels/ConfigViewModel.cs
similarity index 77%
rename from LoL Assist/ViewModel/ConfigViewModel.cs
rename to LoL Assist/ViewModels/ConfigViewModel.cs
index cf94515..3e0c57a 100644
--- a/LoL Assist/ViewModel/ConfigViewModel.cs
+++ b/LoL Assist/ViewModels/ConfigViewModel.cs
@@ -1,14 +1,16 @@
-using System.Collections.Generic;
-using LoL_Assist_WAPP.Model;
+using LoL_Assist_WAPP.Commands;
+using LoL_Assist_WAPP.Models;
using System.ComponentModel;
+using System.Windows.Forms;
using System.Windows.Input;
using System.Diagnostics;
using System.IO;
+using System;
using LoLA;
-namespace LoL_Assist_WAPP.ViewModel
+namespace LoL_Assist_WAPP.ViewModels
{
- public class ConfigViewModel : INotifyPropertyChanged
+ public class ConfigViewModel: ViewModelBase
{
#region General
private bool _autoRunes;
@@ -114,7 +116,7 @@ public bool LowSpecMode
{
_lowSpecMode = value;
ConfigModel.s_Config.LowSpecMode = value;
- ConfigModel.s_Config.MonitoringDelay = ConfigModel.s_Config.LowSpecMode ? 300 : 250;
+ ConfigModel.s_Config.UpdateDelay = ConfigModel.s_Config.LowSpecMode ? 300 : 250;
OnPropertyChanged(nameof(LowSpecMode));
}
}
@@ -168,49 +170,15 @@ public bool UpdateOnStartup
}
}
- //private List themeList = new List();
- //public List ThemeList
- //{
- // get => themeList;
- // set
- // {
- // if (themeList != value)
- // {
- // themeList = value;
- // OnPropertyChanged(nameof(SelectedTheme));
- // }
- // }
- //}
-
- //private string selectedTheme;
- //public string SelectedTheme
- //{
- // get => selectedTheme;
- // set
- // {
- // if (selectedTheme != value)
- // {
- // selectedTheme = value;
- // ConfigModel.config.Theme = value;
- // Utils.SwitchTheme(ConfigModel.config.Theme);
- // OnPropertyChanged(nameof(SelectedTheme));
- // }
- // }
- //}
-
public ICommand ShowFolderInExCommand { get; }
+ public ICommand CreateShortcutCommand { get; }
#endregion
public ConfigViewModel()
{
Update();
- ShowFolderInExCommand = new Command(action => ShowFolderExecute());
- }
-
- private void ShowFolderExecute()
- {
- var path = LibInfo.r_LibFolderPath;
- if(Directory.Exists(path)) Process.Start(path);
+ ShowFolderInExCommand = new Command(_ => showFolderExecute());
+ CreateShortcutCommand = new Command(_ => createDesktopShortcut());
}
public void Update()
@@ -230,13 +198,37 @@ public void Update()
GlobalConfig.s_Caching = BuildCache;
UpdateOnStartup = ConfigModel.s_Config.UpdateOnStartup;
}
- #region Space junk
- public event PropertyChangedEventHandler PropertyChanged;
- protected void OnPropertyChanged(string propertyName)
+
+ private void showFolderExecute()
{
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
- ConfigModel.SaveConfig(false);
+ var path = LibInfo.r_LibFolderPath;
+ if (Directory.Exists(path)) Process.Start(path);
}
+
+ private bool createDesktopShortcut()
+ {
+ var deskDir = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
+ var fullDir = deskDir + @"\LoL Assist.lnk";
+ if (!File.Exists(fullDir))
+ {
+ object shDesktop = "Desktop";
+ IWshRuntimeLibrary.WshShell shell = new IWshRuntimeLibrary.WshShell();
+ string shortcutAddress = fullDir;
+ var shortcut = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(shortcutAddress);
+ shortcut.Description = "Shortcut for LoL Assist";
+ shortcut.Hotkey = "Ctrl+Shift+A";
+ shortcut.TargetPath = Application.ExecutablePath;
+ shortcut.WorkingDirectory = Directory.GetCurrentDirectory();
+ shortcut.RelativePath = Application.ExecutablePath;
+ shortcut.Save();
+ return true;
+ }
+ else
+ return false;
+ }
+ #region Space junk
+ public override void OnPropertyChanged(string propertyName)
+ => ConfigModel.SaveConfig(false);
#endregion
}
}
diff --git a/LoL Assist/ViewModel/DownloadViewModel.cs b/LoL Assist/ViewModels/DownloadViewModel.cs
similarity index 80%
rename from LoL Assist/ViewModel/DownloadViewModel.cs
rename to LoL Assist/ViewModels/DownloadViewModel.cs
index ca0307a..45bfedf 100644
--- a/LoL Assist/ViewModel/DownloadViewModel.cs
+++ b/LoL Assist/ViewModels/DownloadViewModel.cs
@@ -1,16 +1,17 @@
using LoLA.Networking.WebWrapper.DataDragon;
+using LoL_Assist_WAPP.Commands;
using System.Windows.Controls;
using System.Threading.Tasks;
-using LoL_Assist_WAPP.Model;
+using LoL_Assist_WAPP.Models;
using System.ComponentModel;
using System.Windows.Input;
using System.Threading;
using System.Windows;
using System;
-namespace LoL_Assist_WAPP.ViewModel
+namespace LoL_Assist_WAPP.ViewModels
{
- public class DownloadViewModel : INotifyPropertyChanged
+ public class DownloadViewModel: ViewModelBase
{
public ICommand DownloadCommand { get; set; }
public ICommand CancelDownloadCommand { get; set; }
@@ -88,7 +89,6 @@ public object TopMostContent
get => _topMostContent;
set
{
- //Console.WriteLine("Content set: " + value);
_topMostContent = value;
OnPropertyChanged(nameof(TopMostContent));
}
@@ -122,6 +122,21 @@ public Visibility DownloadSelectContainerVisibility
}
}
+ private Visibility _cancelBtnVisibility;
+ public Visibility CancelBtnVisibility
+ {
+ get => _cancelBtnVisibility;
+ set
+ {
+ if (_cancelBtnVisibility != value)
+ {
+ _cancelBtnVisibility = value;
+ OnPropertyChanged(nameof(CancelBtnVisibility));
+ }
+ }
+ }
+
+
CancellationTokenSource cancellationTokenSource { get; set; }
public DownloadViewModel()
@@ -129,8 +144,8 @@ public DownloadViewModel()
DownloadSelectContainerVisibility = Visibility.Visible;
DownloadigContainerVisibility = Visibility.Collapsed;
cancellationTokenSource = new CancellationTokenSource();
- DownloadCommand = new Command(o => downloadChampionAssets());
- CancelDownloadCommand = new Command(o => { cancelChampionAssetsDownload(); });
+ DownloadCommand = new Command(key => download(key.ToString()));
+ CancelDownloadCommand = new Command(_ => { cancelChampionAssetsDownload(); });
}
private bool isDownloading = false;
@@ -141,18 +156,30 @@ private void reportProgressChanged(object sender, ProgressReportModel e)
DownloadStatus = e.Status;
DownloadedTotal = e.DownloadedTotal;
}
-
- private void downloadChampionAssets()
+ Progress progress = new Progress();
+ private void download(string key)
{
- cancellationTokenSource = new CancellationTokenSource();
- var progress = new Progress();
- progress.ProgressChanged += reportProgressChanged;
if (!isDownloading)
{
isDownloading = true;
+ cancellationTokenSource = new CancellationTokenSource();
+ progress = new Progress();
+ progress.ProgressChanged += reportProgressChanged;
+
DownloadigContainerVisibility = Visibility.Visible;
DownloadSelectContainerVisibility = Visibility.Collapsed;
+
downloadChampionAssetsWorker(progress, cancellationTokenSource.Token);
+ //switch (key)
+ //{
+ // case "asst":
+
+ // break;
+ // case "ugg":
+ // break;
+ // case "meta":
+ // break;
+ //}
}
}
@@ -167,14 +194,15 @@ private async void downloadChampionAssetsWorker(IProgress p
progress.Report(progressReportModel);
- await Task.Run(async() => {
+ await Task.Run(async () =>
+ {
string leaguePatch = null;
while(leaguePatch == null)
{
- if (DataDragonWrapper.s_Versions.Count > 0
+ if (DataDragonWrapper.s_Patches.Count > 0
&& DataDragonWrapper.s_Champions?.Data?.Values?.Count > 0)
- leaguePatch = DataDragonWrapper.s_Versions[0];
+ leaguePatch = DataDragonWrapper.s_Patches[0];
}
try
@@ -210,16 +238,20 @@ await Task.Run(async() => {
});
}
- private void cancelChampionAssetsDownload() => cancellationTokenSource.Cancel();
+ private void cancelChampionAssetsDownload()
+ => cancellationTokenSource.Cancel();
private void downloadWorkerCompleted()
{
+ progress.ProgressChanged -= reportProgressChanged;
+ CancelBtnVisibility = Visibility.Hidden;
DownloadStatus = "Download Completed!";
isDownloading = false;
}
private void resetDownloadStatus()
{
+ progress.ProgressChanged -= reportProgressChanged;
DownloadSelectContainerVisibility = Visibility.Visible;
DownloadigContainerVisibility = Visibility.Collapsed;
DownloadStatus = null;
@@ -235,7 +267,9 @@ private void hideUserControl(object p)
Utils.Animation.FadeOut(p as UserControl);
return;
}
- showMsgBox(new Action(() => {
+
+ showMsgBox(new Action(() =>
+ {
cancellationTokenSource.Cancel();
Utils.Animation.FadeOut(p as UserControl); }),
"A download is still in progress. Do you want to close the Download Panel and cancel the download?",
@@ -251,7 +285,7 @@ private async void setTopMostContent(object obj)
}
private void showMsgBox(Action action, string msg, double width = 330, double height = 220)
{
- setTopMostContent(new MessageBoxViewModel()
+ setTopMostContent(new MessageBoxModel()
{
Message = msg,
Width = width,
@@ -259,10 +293,6 @@ private void showMsgBox(Action action, string msg, double width = 330, double he
Action = () => { action.Invoke(); }
});
}
-
- public event PropertyChangedEventHandler PropertyChanged;
- protected void OnPropertyChanged(string propertyName)
- => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
#endregion
}
}
diff --git a/LoL Assist/ViewModels/ItemListViewModel.cs b/LoL Assist/ViewModels/ItemListViewModel.cs
new file mode 100644
index 0000000..1fd2ddc
--- /dev/null
+++ b/LoL Assist/ViewModels/ItemListViewModel.cs
@@ -0,0 +1,171 @@
+using System.Collections.ObjectModel;
+using System.Collections.Generic;
+using LoL_Assist_WAPP.Commands;
+using System.ComponentModel;
+using System.Windows.Input;
+using System.Windows.Data;
+using System.Linq;
+using System;
+
+namespace LoL_Assist_WAPP.ViewModels
+{
+ public class ItemListViewModel: ViewModelBase
+ {
+ private ObservableCollection _itemViewModels;
+
+ private CollectionViewSource ItemViewModelsCollection;
+ public ICollectionView ItemViewModels => ItemViewModelsCollection.View;
+
+ private ItemViewModel _incomingItemViewModel;
+ public ItemViewModel IncomingItemViewModel
+ {
+ get => _incomingItemViewModel;
+ set
+ {
+ if(_incomingItemViewModel != value)
+ {
+ _incomingItemViewModel = value;
+ OnPropertyChanged(nameof(IncomingItemViewModel));
+ }
+ }
+ }
+
+ private ItemViewModel _removedItemViewModel;
+ public ItemViewModel RemovedItemViewModel
+ {
+ get => _removedItemViewModel;
+ set
+ {
+ if(_removedItemViewModel != value)
+ {
+ _removedItemViewModel = value;
+ OnPropertyChanged(nameof(RemovedItemViewModel));
+ }
+ }
+ }
+
+ private ItemViewModel _insertedItemViewModel;
+ public ItemViewModel InsertedItemViewModel
+ {
+ get => _insertedItemViewModel;
+ set
+ {
+ if(_insertedItemViewModel != value)
+ {
+ _insertedItemViewModel = value;
+ OnPropertyChanged(nameof(InsertedItemViewModel));
+ }
+ }
+ }
+
+ private ItemViewModel _targetItemViewModel;
+ public ItemViewModel TargetItemViewModel
+ {
+ get => _targetItemViewModel;
+ set
+ {
+ if(_targetItemViewModel != value)
+ {
+ _targetItemViewModel = value;
+ OnPropertyChanged(nameof(TargetItemViewModel));
+ }
+ }
+ }
+
+ private string _searchString;
+ public string SearchString
+ {
+ get => _searchString;
+ set
+ {
+ if (_searchString != value)
+ {
+ _searchString = value;
+ ItemViewModelsCollection.View.Refresh();
+ OnPropertyChanged(nameof(SearchString));
+ }
+ }
+ }
+
+ //public string Nom { get; set; }
+ public bool IsOrigin = false;
+ public ICommand ItemReceivedCommand { get; }
+ public ICommand ItemRemovedCommand { get; }
+ public ICommand ItemInsertedCommand { get; }
+
+ public ItemListViewModel()
+ {
+ _itemViewModels = new ObservableCollection();
+
+ ItemReceivedCommand = new ItemReceivedCommand(this);
+ ItemRemovedCommand = new ItemRemovedCommand(this);
+ ItemInsertedCommand = new ItemInsertedCommand(this);
+ ItemViewModelsCollection = new CollectionViewSource { Source = _itemViewModels };
+ ItemViewModelsCollection.Filter += Collection_Filter;
+ }
+
+ public void AddItem(ItemViewModel item)
+ {
+ if (!_itemViewModels.Contains(item))
+ {
+ if (IsOrigin)
+ {
+ item.ActualIndex = -1;
+ _itemViewModels.Insert(item.OriginIndex, item);
+ }
+ else
+ {
+ item.ActualIndex = item.ActualIndex == -1 ? _itemViewModels.Count : item.ActualIndex;
+ _itemViewModels.Insert(item.ActualIndex, item);
+ }
+ }
+ }
+
+ private void Collection_Filter(object sender, FilterEventArgs e)
+ {
+ if (string.IsNullOrEmpty(SearchString))
+ {
+ e.Accepted = true;
+ return;
+ }
+
+ var item = e.Item as ItemViewModel;
+ if (item.Content.ToString().ToLower().Contains(SearchString.ToLower()))
+ {
+ e.Accepted = true;
+ }
+ else
+ {
+ e.Accepted = false;
+ }
+ }
+
+ public void InsertItem(ItemViewModel insertedTodoItem, ItemViewModel targetTodoItem)
+ {
+ if(!IsOrigin)
+ {
+
+ }
+ if (insertedTodoItem == targetTodoItem)
+ {
+ return;
+ }
+
+ int oldIndex = _itemViewModels.IndexOf(insertedTodoItem);
+ int nextIndex = _itemViewModels.IndexOf(targetTodoItem);
+
+ if (oldIndex != -1 && nextIndex != -1)
+ {
+ _itemViewModels.Move(oldIndex, nextIndex);
+
+ _itemViewModels[oldIndex].ActualIndex = oldIndex;
+ _itemViewModels[nextIndex].ActualIndex = nextIndex;
+ }
+ }
+
+ public void RemoveItem(ItemViewModel item)
+ {
+ _itemViewModels.Remove(item);
+ }
+ }
+}
diff --git a/LoL Assist/ViewModels/ItemViewModel.cs b/LoL Assist/ViewModels/ItemViewModel.cs
new file mode 100644
index 0000000..46e325e
--- /dev/null
+++ b/LoL Assist/ViewModels/ItemViewModel.cs
@@ -0,0 +1,53 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LoL_Assist_WAPP.ViewModels
+{
+ public class ItemViewModel: ViewModelBase
+ {
+ private int _originIndex;
+ public int OriginIndex
+ {
+ get => _originIndex;
+ set
+ {
+ if (_originIndex != value)
+ {
+ _originIndex = value;
+ OnPropertyChanged(nameof(OriginIndex));
+ }
+ }
+ }
+
+ private int _actualIndex;
+ public int ActualIndex
+ {
+ get => _actualIndex;
+ set
+ {
+ if (_actualIndex != value)
+ {
+ _actualIndex = value;
+ OnPropertyChanged(nameof(ActualIndex));
+ }
+ }
+ }
+
+ public object _content;
+ public object Content
+ {
+ get => _content;
+ set
+ {
+ if(_content != value)
+ {
+ _content = value;
+ OnPropertyChanged(nameof(Content));
+ }
+ }
+ }
+ }
+}
diff --git a/LoL Assist/ViewModel/MainViewModel.cs b/LoL Assist/ViewModels/MainViewModel.cs
similarity index 74%
rename from LoL Assist/ViewModel/MainViewModel.cs
rename to LoL Assist/ViewModels/MainViewModel.cs
index b4c9989..17e275f 100644
--- a/LoL Assist/ViewModel/MainViewModel.cs
+++ b/LoL Assist/ViewModels/MainViewModel.cs
@@ -1,12 +1,14 @@
using LoLA.Networking.WebWrapper.DataDragon.Data;
-using static LoL_Assist_WAPP.Model.LoLAWrapper;
+using static LoL_Assist_WAPP.Models.LoLAWrapper;
using LoLA.Networking.WebWrapper.DataDragon;
using static LoL_Assist_WAPP.Utils.Helper;
using System.Collections.Generic;
using LoLA.Networking.LCU.Events;
using LoLA.Networking.LCU.Enums;
+using LoLA.Networking.LCU.Data;
+using LoL_Assist_WAPP.Commands;
using System.Threading.Tasks;
-using LoL_Assist_WAPP.Model;
+using LoL_Assist_WAPP.Models;
using System.ComponentModel;
using LoL_Assist_WAPP.Utils;
using System.Windows.Input;
@@ -22,9 +24,9 @@
using System;
using LoLA;
-namespace LoL_Assist_WAPP.ViewModel
+namespace LoL_Assist_WAPP.ViewModels
{
- public class MainViewModel : INotifyPropertyChanged
+ public class MainViewModel: ViewModelBase
{
#region Miscellaneous
@@ -33,6 +35,7 @@ public class MainViewModel : INotifyPropertyChanged
public ICommand ManualImportCommand { get; }
public ICommand ShowEditRunesPanelCommand { get; }
public ICommand ShowDownloadPanelCommand { get; }
+ public ICommand ShowAutoMessagePanelCommand { get; }
#region Window Commands
public ICommand MoveWindowCommand { get; }
@@ -141,6 +144,8 @@ public ItemImageModel SelectedProvider
if(!string.IsNullOrEmpty(value.Text))
{
ConfigModel.s_CurrentProvider = Converters.ProviderConverter.ToEnum(value.Text);
+ ConfigModel.s_Config.Provider = ConfigModel.s_CurrentProvider;
+ ConfigModel.SaveConfig(false);
reImport();
}
@@ -192,6 +197,20 @@ public Visibility RoleSelectVisibility
}
}
}
+
+ private int _selectedBuildIndex;
+ public int SelectedBuildIndex
+ {
+ get => _selectedBuildIndex;
+ set
+ {
+ if (_selectedBuildIndex != value)
+ {
+ _selectedBuildIndex = value;
+ OnPropertyChanged(nameof(SelectedBuildIndex));
+ }
+ }
+ }
#endregion
#region Status
@@ -209,6 +228,20 @@ public GameMode GMode
}
}
+ private string _gDetail;
+ public string GDetail
+ {
+ get => _gDetail;
+ set
+ {
+ if (_gDetail != value)
+ {
+ _gDetail = value;
+ OnPropertyChanged(nameof(GDetail));
+ }
+ }
+ }
+
private string _workingStatus;
public string WorkingStatus
{
@@ -333,7 +366,7 @@ public string WarningCount
#endregion
private bool isBusy = false;
- private GameMode currentGameMode = GameMode.NONE;
+ private SessionData currentSessionData = new SessionData();
private readonly Task r_currentChampionBuild = null;
private readonly StringBuilder warningStringBuilder = new StringBuilder();
@@ -347,15 +380,17 @@ public MainViewModel()
{
initTrayIcon();
- GMode = currentGameMode;
- ManualImportCommand = new Command(o => { reImport(); });
- ShutdownAppCommand = new Command(o => { shutdownAppExecute(); });
- ShowEditRunesPanelCommand = new Command(o => { showRuneEditorPanel(); });
- ShowDownloadPanelCommand = new Command(o => { setTopMostContent(new DownloadViewModel()); });
- MoveWindowCommand = new Command(o => { Application.Current.MainWindow.DragMove(); });
+ GMode = currentSessionData.GameMode;
+ DebugCommand = new Command(_ => { DebugExecute(); });
+ ManualImportCommand = new Command(_ => { reImport(); });
+ ShutdownAppCommand = new Command(_ => { shutdownAppExecute(); });
+ ShowEditRunesPanelCommand = new Command(_ => { showRuneEditorPanel(); });
+ ShowDownloadPanelCommand = new Command(_ => { setTopMostContent(new DownloadViewModel()); });
+ ShowAutoMessagePanelCommand = new Command(_ => { setTopMostContent(new MessageViewModel()); });
+ MoveWindowCommand = new Command(_ => { Application.Current.MainWindow.DragMove(); });
- MinimizeToTrayCommand = new Command(o => { minimizeToTray(); });
- MinimizeWindowCommand = new Command(o => { Application.Current.MainWindow.WindowState = WindowState.Minimized; });
+ MinimizeToTrayCommand = new Command(_ => { minimizeToTray(); });
+ MinimizeWindowCommand = new Command(_ => { Application.Current.MainWindow.WindowState = WindowState.Minimized; });
WorkingStatus = $"Clearing old logs...";
LogService.Clear();
@@ -363,8 +398,6 @@ public MainViewModel()
WorkingStatus = "Loading in configuration...";
ConfigModel.LoadConfig();
- showPatchNotes(ConfigModel.s_Config.DoNotShowPatch);
-
var roles = Enum.GetValues(typeof(Role)).Cast();
Roles = new List();
@@ -374,7 +407,8 @@ public MainViewModel()
ItemImage("U.GG", ImageSrc("ugg"))
};
- SelectedProvider = Providers[0];
+ var provider = Converters.ProviderConverter.ToName(ConfigModel.s_Config.Provider);
+ SelectedProvider = Providers.FirstOrDefault(p => p.Text.Equals(provider));
foreach (var role in roles)
{
@@ -384,6 +418,7 @@ public MainViewModel()
Roles.Add(ItemImage(role.ToString(), image));
}
+
initLoLA();
}
@@ -397,19 +432,20 @@ private async void initLoLA()
WorkingStatus = "Downloading prerequisite...";
while (!await Main.Init())
- Thread.Sleep(ConfigModel.s_Config.MonitoringDelay * 2);
+ Thread.Sleep(ConfigModel.s_Config.UpdateDelay * 2);
WorkingStatus = "Initializing LoLA components...";
- champMonitor.ChampionChanged += championChanged;
- champMonitor.MonitorDelay = ConfigModel.s_Config.MonitoringDelay;
+ s_ChampMonitor.ChampionChanged += championChanged;
+ s_ChampMonitor.MonitorDelay = ConfigModel.s_Config.UpdateDelay;
var lolMonitorThread = new Thread(LoLMonitor);
lolMonitorThread.Start();
- phaseMonitor.PhaseChanged += phaseChanged;
- phaseMonitor.MonitorDelay = ConfigModel.s_Config.MonitoringDelay;
+ s_PhaseMonitor.PhaseChanged += phaseChanged;
+ s_PhaseMonitor.MonitorDelay = ConfigModel.s_Config.UpdateDelay;
resetStatus();
+ //setTopMostContent(new ChampionPickerViewModel());
}
private async void importBuilds(string championName, bool forceRuneUpdate = false)
@@ -419,10 +455,12 @@ private async void importBuilds(string championName, bool forceRuneUpdate = fals
clearChamp(false);
while (isBusy)
- Thread.Sleep(ConfigModel.s_Config.MonitoringDelay);
+ Thread.Sleep(ConfigModel.s_Config.UpdateDelay);
isBusy = true;
bool[] isError = { false, false };
+ int ReplaceMeINT1 = 0;
+ int ReplaceMeINT2 = 0;
Stopwatch sw = Stopwatch.StartNew();
ChampionName = championName;
try
@@ -432,41 +470,56 @@ private async void importBuilds(string championName, bool forceRuneUpdate = fals
List tasks = new List();
var currentRole = Role.RECOMENDED;
- var gameMode = currentGameMode;
+ var gameMode = currentSessionData.GameMode;
var championBuild = r_currentChampionBuild;
if (gameMode.Equals(GameMode.CLASSIC) || gameMode.Equals(GameMode.PRACTICETOOL))
currentRole = (Role)(!string.IsNullOrEmpty(SelectedRole.Text) ? Enum.Parse(typeof(Role), SelectedRole.Text) : currentRole);
var currentChampionId = Converter.ChampionNameToId(championName);
-
var defaultConfigName = LocalBuild.GetLocalBuildName(currentChampionId, gameMode);
setImportStatus("Fetching Runes & Spells...");
sw.Start();
- var provider = !string.IsNullOrEmpty(defaultConfigName)
+ var provider = !string.IsNullOrEmpty(defaultConfigName)
&& defaultConfigName != ConfigModel.s_CurrentProvider.ToString()
? Provider.Local : ConfigModel.s_CurrentProvider;
- tasks.Add(championBuild = Main.RequestBuildsData(currentChampionId, gameMode, provider, currentRole));
+ tasks.Add(championBuild = Main.RequestBuildsData(currentChampionId, gameMode, provider, currentRole, SelectedBuildIndex));
tasks.Add(Task.Run(() => ChampionImage = DataDragonWrapper.GetChampionImage(currentChampionId).Result));
Parallel.ForEach(tasks, task => { Task.Run(() => task).Wait(); });
setImportStatus($"Importing {FixedName(ChampionName)} Runes & Spells...");
- Rune runeBuild = (await championBuild)?.Rune;
- Spell spellCombo = (await championBuild)?.Spell;
+ List runes = (await championBuild)?.Runes;
+ List spellCombos = (await championBuild)?.Spells;
+
+ var selectedRune = runes[ReplaceMeINT1];
+ var selectedSpellCombo = spellCombos[ReplaceMeINT2];
+
+ //Console.WriteLine(runes[ReplaceMeINT1].Name);
+ //Console.WriteLine(runes[ReplaceMeINT1].PrimaryPath);
+ //Console.WriteLine(runes[ReplaceMeINT1].SecondaryPath);
+ //Console.WriteLine(runes[ReplaceMeINT1].Keystone);
+ //Console.WriteLine(runes[ReplaceMeINT1].Slot1);
+ //Console.WriteLine(runes[ReplaceMeINT1].Slot2);
+ //Console.WriteLine(runes[ReplaceMeINT1].Slot3);
+ //Console.WriteLine(runes[ReplaceMeINT1].Slot4);
+ //Console.WriteLine(runes[ReplaceMeINT1].Slot5);
+ //Console.WriteLine(runes[ReplaceMeINT1].Shard1);
+ //Console.WriteLine(runes[ReplaceMeINT1].Shard2);
+ //Console.WriteLine(runes[ReplaceMeINT1].Shard3);
if (championBuild != null)
{
var currentPerks = await LCUWrapper.GetCurrentRunePageAsync();
List ImportTasks = new List();
if (ConfigModel.s_Config.AutoRunes)
- ImportTasks.Add(SetRuneAsync(runeBuild, currentPerks, forceRuneUpdate));
+ ImportTasks.Add(SetRuneAsync(selectedRune, currentPerks, forceRuneUpdate));
if (ConfigModel.s_Config.AutoSpells)
- ImportTasks.Add(ImportSpellsAsync(spellCombo, gameMode));
+ ImportTasks.Add(ImportSpellsAsync(selectedSpellCombo, gameMode));
int i = 0;
Parallel.ForEach(ImportTasks, async task => {
@@ -505,14 +558,15 @@ private async void importBuilds(string championName, bool forceRuneUpdate = fals
private async void phaseChanged(object sender, PhaseMonitor.PhaseChangedArgs e)
{
Topmost = e.currentPhase == Phase.ChampSelect || e.currentPhase == Phase.ReadyCheck;
- currentGameMode = await LCUWrapper.GetCurrentGameModeAsync();
+ currentSessionData = await LCUWrapper.GetSessionDataAsync();
+ setSessionDetail(currentSessionData);
if (e.currentPhase != Phase.InProgress)
{
- GMode = currentGameMode;
dispatcherInvoke(() => { // Needs to be invoke to fix delay issue
- if (currentGameMode == GameMode.CLASSIC
- || currentGameMode == GameMode.PRACTICETOOL)
+ GMode = currentSessionData.GameMode;
+ if (GMode == GameMode.CLASSIC
+ || GMode == GameMode.PRACTICETOOL)
{
if(e.currentPhase == Phase.Lobby) SelectedRole = Roles[0];
@@ -525,6 +579,7 @@ private async void phaseChanged(object sender, PhaseMonitor.PhaseChangedArgs e)
switch (e.currentPhase)
{
case Phase.ChampSelect:
+ executeAutoMessage();
dispatcherInvoke(() => {
ImportStatus = "Selecting a champion...";
ManualImportVisibility = Visibility.Visible;
@@ -557,6 +612,66 @@ private async void phaseChanged(object sender, PhaseMonitor.PhaseChangedArgs e)
}
}
+ private void setSessionDetail(SessionData sessionData)
+ {
+ if (!string.IsNullOrEmpty(sessionData.Category) && !string.IsNullOrWhiteSpace(sessionData.Category)
+ && !string.IsNullOrEmpty(sessionData.Description) && !string.IsNullOrWhiteSpace(sessionData.Description))
+ {
+ string description = null;
+ if(sessionData.GameMode != GameMode.ARAM)
+ description = $"| {sessionData.Description}";
+
+ GDetail = $"{description} | {sessionData.Category}";
+ }
+ else GDetail = string.Empty;
+ }
+
+ private async void executeAutoMessage()
+ {
+ if (ConfigModel.s_Config.AutoMessage
+ && !string.IsNullOrEmpty(ConfigModel.s_Config.Message))
+ {
+ Log("Sending a message...", LogType.INFO);
+ var type = "championSelect";
+ var messageSent = false;
+ try
+ {
+ do
+ {
+ var conversations = await LCUWrapper.GetConversationsAsync();
+ await LCUWrapper.SendMessageAsync(conversations, ConfigModel.s_Config.Message, type);
+
+ foreach (var conversation in conversations.Root)
+ {
+ if (conversation["type"].ToString() == type)
+ {
+ int? chatIndex;
+ do
+ {
+ var id = conversation["id"].ToString();
+ var messages = await LCUWrapper.GetMessagesAsync(id);
+ chatIndex = messages?.Count;
+ } while (chatIndex > 0);
+ messageSent = true;
+ }
+ }
+
+ Thread.Sleep(1);
+ } while (!messageSent);
+ }
+ catch
+ {
+ messageSent = false;
+ Log("Uh oh something went wrong when trying to send a message", LogType.EROR);
+ }
+
+ if (ConfigModel.s_Config.ClearMessageAfterSent && messageSent)
+ {
+ MessageViewModel.s_ClearMessage?.Invoke();
+ ConfigModel.s_Config.Message = string.Empty;
+ }
+ }
+ }
private void dispatcherInvoke(Action action)
=> Application.Current.Dispatcher.Invoke(action);
@@ -582,7 +697,7 @@ public async void LoLMonitor()
do
{
summonerInfo = await getSummonerInfoAsync();
- Thread.Sleep(ConfigModel.s_Config.MonitoringDelay * 2);
+ Thread.Sleep(ConfigModel.s_Config.UpdateDelay * 2);
} while (string.IsNullOrEmpty(summonerInfo));
dispatcherInvoke(() => {
@@ -605,32 +720,32 @@ public async void LoLMonitor()
updateConnection = isProcessFound;
}
- Thread.Sleep(ConfigModel.s_Config.MonitoringDelay * 2);
+ Thread.Sleep(ConfigModel.s_Config.UpdateDelay * 2);
}
}
#endregion
private void shutdownAppExecute() => showMsgBox(new Action(() => { Application.Current.MainWindow.Close(); }),
msg: "Are you sure you want to exit LoL Assist?", width: 230, height: 150);
- private void showPatchNotes(bool doNotShow) { if (!doNotShow) setTopMostContent(new PatchViewModel()); }
+ private void showRuneEditorPanel() => setTopMostContent(new RuneEditorViewModel());
private void championChanged(object sender, ChampionMonitor.ChampionChangedArgs e) => importBuilds(e.championName);
private async void reImport() => await Task.Run(async () => { importBuilds(await LCUWrapper.GetCurrentChampionAsyncV2(), true); });
- private void showRuneEditorPanel() => setTopMostContent(new RuneEditorViewModel());
#region Tray Icon
+
+ private readonly string[] r_menuOptions = { "Exit", "Show", "Edit Runes", "Minimize to Tray" };
private void initTrayIcon()
{
- string[] menuOptions = new string[] { "Exit", "Show", "Edit Runes", "Patch Notes", "Minimize to Tray" };
var trayIcon = new System.Windows.Forms.NotifyIcon();
var menus = new List();
var menuContainer = new System.Windows.Forms.ContextMenu();
- for (int i = 0; i < menuOptions.Length; i++)
+ for (int i = 0; i < r_menuOptions.Length; i++)
{
var item = new System.Windows.Forms.MenuItem()
{
Index = i,
- Text = menuOptions[i]
+ Text = r_menuOptions[i]
};
item.Click += new EventHandler(menuItem_Click);
@@ -674,12 +789,9 @@ private void menuItem_Click(object sender, EventArgs e)
showMainWindow();
showRuneEditorPanel();
break;
- case "Patch Notes":
- showMainWindow();
- showPatchNotes(false);
- break;
case "Minimize to Tray":
- minimizeToTray();
+ Application.Current.MainWindow.Hide();
+ //minimizeToTray();
break;
}
}
@@ -700,30 +812,30 @@ private void showMainWindow()
#endregion
#region Debug D:
- //private int debugI = 0;
- //public async Task DebugExecute()
- //{
- // LogService.Log(LogService.Model($"--------------attempt-{debugI}", "Debug", LogType.DBUG));
- // //* Debug Code *//
- // //await Main.RequestBuildsData("Aatrox", GameMode.URF, BuildsProvider.METAsrc);
- // var build = await Main.RequestBuildsData("Ahri", GameMode.CLASSIC, Provider.UGG, Role.RECOMENDED);
-
- // Console.WriteLine(build.Name);
- // Console.WriteLine(build.Rune.PrimaryPath);
- // Console.WriteLine(build.Rune.SecondaryPath);
- // Console.WriteLine(build.Rune.Keystone);
- // Console.WriteLine(build.Rune.Slot1);
- // Console.WriteLine(build.Rune.Slot2);
- // Console.WriteLine(build.Rune.Slot3);
- // Console.WriteLine(build.Rune.Slot4);
- // Console.WriteLine(build.Rune.Slot5);
- // Console.WriteLine(build.Rune.Shard1);
- // Console.WriteLine(build.Rune.Shard2);
- // Console.WriteLine(build.Rune.Shard3);
-
- // //Console.WriteLine(await LCUWrapper.GetCurrentSessionAsync());
- // debugI++;
- //}
+ private int debugI = 0;
+ public async void DebugExecute()
+ {
+ LogService.Log(LogService.Model($"--------------attempt-{debugI}", "Debug", LogType.DBUG));
+ //* Debug Code *//
+ //await Main.RequestBuildsData("Aatrox", GameMode.URF, BuildsProvider.METAsrc);
+ var build = await Main.RequestBuildsData("Akali", GameMode.CLASSIC, Provider.UGG, Role.RECOMENDED, 0);
+
+ //Console.WriteLine(build.Name);
+ //Console.WriteLine(build.Rune.PrimaryPath);
+ //Console.WriteLine(build.Rune.SecondaryPath);
+ //Console.WriteLine(build.Rune.Keystone);
+ //Console.WriteLine(build.Rune.Slot1);
+ //Console.WriteLine(build.Rune.Slot2);
+ //Console.WriteLine(build.Rune.Slot3);
+ //Console.WriteLine(build.Rune.Slot4);
+ //Console.WriteLine(build.Rune.Slot5);
+ //Console.WriteLine(build.Rune.Shard1);
+ //Console.WriteLine(build.Rune.Shard2);
+ //Console.WriteLine(build.Rune.Shard3);
+
+ //Console.WriteLine(await LCUWrapper.GetCurrentSessionAsync());
+ debugI++;
+ }
#endregion
#region Space junk
@@ -735,7 +847,7 @@ private async void setTopMostContent(object obj)
}
private void showMsgBox(Action action, string msg, double width = 330, double height = 220)
{
- setTopMostContent(new MessageBoxViewModel()
+ setTopMostContent(new MessageBoxModel()
{
Message = msg,
Width = width,
@@ -752,8 +864,6 @@ private async Task getSummonerInfoAsync()
|| summonerInfo.summonerLevel == 0)
return null;
- Console.WriteLine(summonerInfo.summonerId);
-
return $"{summonerInfo?.displayName} | Lvl {summonerInfo?.summonerLevel}";
}
private void setImportStatus(string msg, LogType logType = LogType.INFO)
@@ -775,10 +885,6 @@ private void resetStatus()
ManualImportVisibility = Visibility.Collapsed;
ImportStatus = "Waiting for a game queue...";
}
-
- public event PropertyChangedEventHandler PropertyChanged;
- protected void OnPropertyChanged(string propertyName)
- => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
#endregion
}
}
diff --git a/LoL Assist/ViewModel/MatchFoundViewModel.cs b/LoL Assist/ViewModels/MatchFoundViewModel.cs
similarity index 87%
rename from LoL Assist/ViewModel/MatchFoundViewModel.cs
rename to LoL Assist/ViewModels/MatchFoundViewModel.cs
index 5ce681c..5de2fea 100644
--- a/LoL Assist/ViewModel/MatchFoundViewModel.cs
+++ b/LoL Assist/ViewModels/MatchFoundViewModel.cs
@@ -1,8 +1,9 @@
using LoLA.Networking.LCU.Events;
using LoLA.Networking.LCU.Enums;
+using LoL_Assist_WAPP.Commands;
using System.Windows.Controls;
using System.Threading.Tasks;
-using LoL_Assist_WAPP.Model;
+using LoL_Assist_WAPP.Models;
using System.ComponentModel;
using System.Windows.Input;
using LoLA.Networking.LCU;
@@ -10,9 +11,9 @@
using System.Windows;
using System;
-namespace LoL_Assist_WAPP.ViewModel
+namespace LoL_Assist_WAPP.ViewModels
{
- public class MatchFoundViewModel : INotifyPropertyChanged
+ public class MatchFoundViewModel: ViewModelBase
{
#region Commands
public ICommand AcceptMatchCommand { get; }
@@ -95,18 +96,19 @@ public Visibility MatchfoundVisibility
public MatchFoundViewModel()
{
matchFound();
- AcceptMatchCommand = new Command(o => { accept(); });
- DeclineMatchCommand = new Command(o => { decline(); });
- LoLAWrapper.phaseMonitor.PhaseChanged += phase_Changed;
+ AcceptMatchCommand = new Command(_ => { accept(); });
+ DeclineMatchCommand = new Command(_ => { decline(); });
+ LoLAWrapper.s_PhaseMonitor.PhaseChanged += phase_Changed;
}
private void phase_Changed(object sender, PhaseMonitor.PhaseChangedArgs e)
{
- if (e.currentPhase != Phase.ReadyCheck) hideMatchFound();
+ if (e.currentPhase != Phase.ReadyCheck) closeMatchFound();
}
- private void hideMatchFound()
+ private void closeMatchFound()
{
+ LoLAWrapper.s_PhaseMonitor.PhaseChanged -= phase_Changed;
MatchfoundVisibility = Visibility.Collapsed;
isMatchFound = false;
isDecided = false;
@@ -158,9 +160,5 @@ private void consoleBeep() // Beep sound
}
private void hideUserControl(object p) => Utils.Animation.FadeOut(p as UserControl);
-
- public event PropertyChangedEventHandler PropertyChanged;
- protected void OnPropertyChanged(string propertyName)
- => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
diff --git a/LoL Assist/ViewModels/MessageViewModel.cs b/LoL Assist/ViewModels/MessageViewModel.cs
new file mode 100644
index 0000000..f4d1050
--- /dev/null
+++ b/LoL Assist/ViewModels/MessageViewModel.cs
@@ -0,0 +1,82 @@
+using LoL_Assist_WAPP.Commands;
+using System.Windows.Controls;
+using LoL_Assist_WAPP.Models;
+using System.ComponentModel;
+using LoL_Assist_WAPP.Utils;
+using System.Windows.Input;
+using System;
+
+namespace LoL_Assist_WAPP.ViewModels
+{
+ public class MessageViewModel: ViewModelBase
+ {
+ public ICommand CloseMessageCommand { get; }
+ private bool _autoMessageEnabeld;
+ public bool AutoMessageEnabled
+ {
+ get => _autoMessageEnabeld;
+ set
+ {
+ if (_autoMessageEnabeld != value)
+ {
+ _autoMessageEnabeld = value;
+ ConfigModel.s_Config.AutoMessage = value;
+ ConfigModel.SaveConfig(false);
+ OnPropertyChanged(nameof(AutoMessageEnabled));
+ }
+ }
+ }
+
+ private bool _clearAfterEachSent;
+ public bool ClearAfterEachSent
+ {
+ get => _clearAfterEachSent;
+ set
+ {
+ if (_clearAfterEachSent != value)
+ {
+ _clearAfterEachSent = value;
+ ConfigModel.s_Config.ClearMessageAfterSent = value;
+ ConfigModel.SaveConfig(false);
+ OnPropertyChanged(nameof(ClearAfterEachSent));
+ }
+ }
+ }
+
+ private string _messageText;
+ public string MessageText
+ {
+ get => _messageText;
+ set
+ {
+ if (_messageText != value)
+ {
+ _messageText = value;
+ ConfigModel.s_Config.Message = value;
+ ConfigModel.SaveConfig(false);
+ OnPropertyChanged(nameof(MessageText));
+ }
+ }
+ }
+ public static Action s_ClearMessage;
+ public MessageViewModel()
+ {
+ CloseMessageCommand = new Command(u => Close(u));
+
+ ConfigModel.LoadConfig();
+ s_ClearMessage = new Action(ClearMessage);
+ AutoMessageEnabled = ConfigModel.s_Config.AutoMessage;
+ MessageText = ConfigModel.s_Config.Message;
+ ClearAfterEachSent = ConfigModel.s_Config.ClearMessageAfterSent;
+ }
+
+ private void Close(object userControl)
+ {
+ var control = userControl as UserControl;
+ Animation.FadeOut(control);
+ }
+
+ public void ClearMessage()
+ => MessageText = string.Empty;
+ }
+}
diff --git a/LoL Assist/ViewModel/RuneEditorViewModel.cs b/LoL Assist/ViewModels/RuneEditorViewModel.cs
similarity index 82%
rename from LoL Assist/ViewModel/RuneEditorViewModel.cs
rename to LoL Assist/ViewModels/RuneEditorViewModel.cs
index 83baae7..8258324 100644
--- a/LoL Assist/ViewModel/RuneEditorViewModel.cs
+++ b/LoL Assist/ViewModels/RuneEditorViewModel.cs
@@ -1,196 +1,43 @@
using LoLA.Networking.WebWrapper.DataDragon.Data;
using LoLA.Networking.WebWrapper.DataDragon;
using System.Collections.ObjectModel;
+using LoLA.Networking.LCU.Objects;
using System.Collections.Generic;
+using LoL_Assist_WAPP.Commands;
using System.Windows.Controls;
-using LoL_Assist_WAPP.Model;
+using LoL_Assist_WAPP.Models;
using LoL_Assist_WAPP.Utils;
using System.ComponentModel;
using System.Windows.Input;
using LoLA.Networking.LCU;
-using System.Threading;
using LoLA.Data;
-using System;
using LoLA;
-using LoLA.Networking.LCU.Objects;
-namespace LoL_Assist_WAPP.ViewModel
+namespace LoL_Assist_WAPP.ViewModels
{
- public class RuneEditorViewModel : INotifyPropertyChanged
+ public class RuneEditorViewModel: ViewModelBase
{
- #region Command
+ #region Commands
public ICommand OpenBuildEditorCommand { get; set; }
public ICommand SaveRunePageCommand { get; set; }
public ICommand ReloadRunePagesCommand { get; set; }
+ public ICommand CloseRuneEditorCommand { get; set; }
+
+ #region Perk Commands
+ public ICommand PrimaryPathSelectCommand { get; set; }
+ public ICommand KeystoneSelectCommand { get; set; }
+ public ICommand Perk1SelectCommand { get; set; }
+ public ICommand Perk2SelectCommand { get; set; }
+ public ICommand Perk3SelectCommand { get; set; }
+ public ICommand SecondaryPathSelectCommand { get; set; }
+ public ICommand Perk4SelectCommand { get; set; }
+ public ICommand Perk5SelectCommand { get; set; }
+ public ICommand Perk6SelectCommand { get; set; }
+ public ICommand Shard1SelectCommand { get; set; }
+ public ICommand Shard2SelectCommand { get; set; }
+ public ICommand Shard3SelectCommand { get; set; }
+ #endregion
- private ICommand _closeRuneEditorCommand;
- public ICommand CloseRuneEditorCommand
- {
- get
- {
- if (_closeRuneEditorCommand == null)
- {
- _closeRuneEditorCommand = new Command(usercontrol => closeRuneEditor(usercontrol));
- }
- return _closeRuneEditorCommand;
- }
- }
-
- private ICommand _primaryPathSelectCommand;
- public ICommand PrimaryPathSelectCommand
- {
- get
- {
- if (_primaryPathSelectCommand == null)
- {
- _primaryPathSelectCommand = new Command(path => updatePrimaryPath(path.ToString()));
- }
- return _primaryPathSelectCommand;
- }
- }
-
- private ICommand _keystoneSelectCommand;
- public ICommand KeystoneSelectCommand
- {
- get
- {
- if (_keystoneSelectCommand == null)
- {
- _keystoneSelectCommand = new Command(keystone => updateKeystone(keystone?.ToString()));
- }
- return _keystoneSelectCommand;
- }
- }
-
- private ICommand _perk1SelectCommand;
- public ICommand Perk1SelectCommand
- {
- get
- {
- if (_perk1SelectCommand == null)
- {
- _perk1SelectCommand = new Command(perk => updatePrimaryPathSlot(perk?.ToString(), 1));
- }
- return _perk1SelectCommand;
- }
- }
-
- private ICommand _perk2SelectCommand;
- public ICommand Perk2SelectCommand
- {
- get
- {
- if (_perk2SelectCommand == null)
- {
- _perk2SelectCommand = new Command(perk => updatePrimaryPathSlot(perk?.ToString(), 2));
- }
- return _perk2SelectCommand;
- }
- }
-
- private ICommand _perk3SelectCommand;
- public ICommand Perk3SelectCommand
- {
- get
- {
- if (_perk3SelectCommand == null)
- {
- _perk3SelectCommand = new Command(perk => updatePrimaryPathSlot(perk?.ToString(), 3));
- }
- return _perk3SelectCommand;
- }
- }
-
- private ICommand _secondaryPathSelectCommand;
- public ICommand SecondaryPathSelectCommand
- {
- get
- {
- if (_secondaryPathSelectCommand == null)
- {
- _secondaryPathSelectCommand = new Command(path => selectSecondaryPath(path.ToString()));
- }
- return _secondaryPathSelectCommand;
- }
- }
-
- private ICommand _perk4SelectCommand;
- public ICommand Perk4SelectCommand
- {
- get
- {
- if (_perk4SelectCommand == null)
- {
- _perk4SelectCommand = new Command(perk => selectSecondPathSlot(perk?.ToString(), 0));
- }
- return _perk4SelectCommand;
- }
- }
-
- private ICommand _perk5SelectCommand;
- public ICommand Perk5SelectCommand
- {
- get
- {
- if (_perk5SelectCommand == null)
- {
- _perk5SelectCommand = new Command(perk => selectSecondPathSlot(perk?.ToString(), 1));
- }
- return _perk5SelectCommand;
- }
- }
-
- private ICommand _perk6SelectCommand;
- public ICommand Perk6SelectCommand
- {
- get
- {
- if (_perk6SelectCommand == null)
- {
- _perk6SelectCommand = new Command(perk => selectSecondPathSlot(perk?.ToString(), 2));
- }
- return _perk6SelectCommand;
- }
- }
-
- private ICommand _shard1SelectCommand;
- public ICommand Shard1SelectCommand
- {
- get
- {
- if (_shard1SelectCommand == null)
- {
- _shard1SelectCommand = new Command(shard => updateShard(shard?.ToString(), 1));
- }
- return _shard1SelectCommand;
- }
- }
-
- private ICommand _shard2SelectCommand;
- public ICommand Shard2SelectCommand
- {
- get
- {
- if (_shard2SelectCommand == null)
- {
- _shard2SelectCommand = new Command(shard => updateShard(shard?.ToString(), 2));
- }
- return _shard2SelectCommand;
- }
- }
-
- private ICommand _shard3SelectCommand;
- public ICommand Shard3SelectCommand
- {
- get
- {
- if (_shard3SelectCommand == null)
- {
- _shard3SelectCommand = new Command(shard => updateShard(shard?.ToString(), 3));
- }
- return _shard3SelectCommand;
- }
- }
#endregion
#region Primary
@@ -439,10 +286,7 @@ public string RunePageName
private readonly List r_runePages = new List();
public RuneEditorViewModel()
{
- OpenBuildEditorCommand = new Command(o => Helper.ShowBuildEditorWindow());
- ReloadRunePagesCommand = new Command(o => loadRunePages());
- SaveRunePageCommand = new Command(o => saveRunePage());
-
+ initCommands();
PrimaryPaths = new ObservableCollection();
SecondaryPaths = new ObservableCollection();
Keystones = new ObservableCollection();
@@ -459,6 +303,27 @@ public RuneEditorViewModel()
loadRunePages();
}
+ private void initCommands()
+ {
+ PrimaryPathSelectCommand = new Command(path => updatePrimaryPath(path.ToString()));
+ KeystoneSelectCommand = new Command(keystone => updateKeystone(keystone?.ToString()));
+ Perk1SelectCommand = new Command(perk => updatePrimaryPathSlot(perk?.ToString(), 1));
+ Perk2SelectCommand = new Command(perk => updatePrimaryPathSlot(perk?.ToString(), 2));
+ Perk3SelectCommand = new Command(perk => updatePrimaryPathSlot(perk?.ToString(), 3));
+ SecondaryPathSelectCommand = new Command(path => updateSecondaryPath(path.ToString()));
+ Perk4SelectCommand = new Command(perk => updateSecondPathSlot(perk?.ToString(), 0));
+ Perk5SelectCommand = new Command(perk => updateSecondPathSlot(perk?.ToString(), 1));
+ Perk6SelectCommand = new Command(perk => updateSecondPathSlot(perk?.ToString(), 2));
+ Shard1SelectCommand = new Command(shard => updateShard(shard?.ToString(), 1));
+ Shard2SelectCommand = new Command(shard => updateShard(shard?.ToString(), 2));
+ Shard3SelectCommand = new Command(shard => updateShard(shard?.ToString(), 3));
+
+ CloseRuneEditorCommand = new Command(usercontrol => closeRuneEditor(usercontrol));
+ OpenBuildEditorCommand = new Command(_ => Helper.ShowBuildEditorWindow());
+ ReloadRunePagesCommand = new Command(_ => loadRunePages());
+ SaveRunePageCommand = new Command(_ => saveRunePage());
+ }
+
private bool isSaving = false;
private async void saveRunePage()
{
@@ -521,7 +386,6 @@ private void closeRuneEditor(object usercontrol)
{
var control = usercontrol as UserControl;
Animation.FadeOut(control);
- //rune = null;
}
private void setSelectedRunePageByName(string runePageName)
@@ -540,7 +404,7 @@ private void setCurrentRunePage(RunePage runePage)
updatePrimaryPathSlot(Converter.PerkIdToName(rune.Slot1), 1);
updatePrimaryPathSlot(Converter.PerkIdToName(rune.Slot2), 2);
updatePrimaryPathSlot(Converter.PerkIdToName(rune.Slot3), 3);
- selectSecondaryPath(Converter.PathIdToName(rune.SecondaryPath));
+ updateSecondaryPath(Converter.PathIdToName(rune.SecondaryPath));
updateSecondaryPathSlots(Converter.PerkIdToName(rune.Slot4), Converter.PerkIdToName(rune.Slot5));
updateShard(DataConverter.ShardIdToShardDescription(rune.Shard1), 1);
@@ -582,23 +446,11 @@ private void updatePrimaryPath(string selectedPath = "")
if (currentPrimaryPath == currentSecondaryPath)
{
- //lastSlotIndex = 0;
- //lastSelectedSlot[0] = -1;
- //lastSelectedSlot[1] = -1;
-
- //currentSecondaryPath = null;
- //currentPerk4 = null;
- //currentPerk5 = null;
- //currentPerk6 = null;
-
currentSecondaryPath = null;
currentPerk4 = null;
currentPerk5 = null;
currentPerk6 = null;
- //rune.SecondaryPath = 0;
- //rune.Slot4 = 0;
- //rune.Slot5 = 0;
Perks4.Clear();
Perks5.Clear();
@@ -611,7 +463,7 @@ private void updatePrimaryPath(string selectedPath = "")
}
private string[,] secondSlot = null;
- private void selectSecondaryPath(string selectedSecondaryPath)
+ private void updateSecondaryPath(string selectedSecondaryPath)
{
var newSecondaryPaths = itemImageModels(currentSecondaryPath, selectedSecondaryPath, SecondaryPaths);
@@ -712,7 +564,7 @@ private ObservableCollection populateSecondaryPathSlot(string se
private int lastSlotIndex = 0;
private readonly int[] lastSelectedSlot = new int[] {-1, -1};
- private void selectSecondPathSlot(string selectedPerk, int index = -1)
+ private void updateSecondPathSlot(string selectedPerk, int index = -1)
{
var changeNeeded = false;
@@ -813,12 +665,6 @@ private void selectSecondaryPerk(string selectedPerk, string perk1, string perk2
private void setSecondaryPathRuneSlot(string selectedPerk, string currentPerk)
{
- var currentPerkId = Converter.PerkNameToId(selectedPerk);
- var selectedPerkId = Converter.PerkNameToId(selectedPerk);
- var slot4 = Converter.PerkIdToName(rune.Slot4);
- var slot5 = Converter.PerkIdToName(rune.Slot5);
-
-
if (rune.Slot4 == Converter.PerkNameToId(currentPerk))
rune.Slot4 = Converter.PerkNameToId(selectedPerk);
else
@@ -1072,9 +918,5 @@ private ObservableCollection itemImageModels(string currentValue
}
return null;
}
-
- public event PropertyChangedEventHandler PropertyChanged;
- protected void OnPropertyChanged(string propertyName)
- => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
diff --git a/LoL Assist/ViewModels/ViewModelBase.cs b/LoL Assist/ViewModels/ViewModelBase.cs
new file mode 100644
index 0000000..4755f1a
--- /dev/null
+++ b/LoL Assist/ViewModels/ViewModelBase.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.ComponentModel;
+
+namespace LoL_Assist_WAPP.ViewModels
+{
+ public class ViewModelBase: INotifyPropertyChanged
+ {
+ public event PropertyChangedEventHandler PropertyChanged;
+ public virtual void OnPropertyChanged(string propertyName)
+ => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+}
diff --git a/LoL Assist/View/BuildEditorPanel.xaml b/LoL Assist/Views/BuildEditorPanel.xaml
similarity index 100%
rename from LoL Assist/View/BuildEditorPanel.xaml
rename to LoL Assist/Views/BuildEditorPanel.xaml
diff --git a/LoL Assist/View/BuildEditorPanel.xaml.cs b/LoL Assist/Views/BuildEditorPanel.xaml.cs
similarity index 100%
rename from LoL Assist/View/BuildEditorPanel.xaml.cs
rename to LoL Assist/Views/BuildEditorPanel.xaml.cs
diff --git a/LoL Assist/Views/ChampionItemListView.xaml b/LoL Assist/Views/ChampionItemListView.xaml
new file mode 100644
index 0000000..3145b53
--- /dev/null
+++ b/LoL Assist/Views/ChampionItemListView.xaml
@@ -0,0 +1,102 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/LoL Assist/Views/ChampionItemListView.xaml.cs b/LoL Assist/Views/ChampionItemListView.xaml.cs
new file mode 100644
index 0000000..05827ea
--- /dev/null
+++ b/LoL Assist/Views/ChampionItemListView.xaml.cs
@@ -0,0 +1,159 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace LoL_Assist_WAPP.Views
+{
+ ///
+ /// Interaction logic for ChampionItemListView.xaml
+ ///
+ public partial class ChampionItemListView: UserControl
+ {
+ public static readonly DependencyProperty IncomingItemProperty =
+ DependencyProperty.Register("IncomingItem", typeof(object), typeof(ChampionItemListView),
+ new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
+
+ public object IncomingItem
+ {
+ get { return GetValue(IncomingItemProperty); }
+ set { SetValue(IncomingItemProperty, value); }
+ }
+
+ public static readonly DependencyProperty RemovedItemProperty =
+ DependencyProperty.Register("RemovedItem", typeof(object), typeof(ChampionItemListView),
+ new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
+
+ public object RemovedItem
+ {
+ get { return GetValue(RemovedItemProperty); }
+ set { SetValue(RemovedItemProperty, value); }
+ }
+
+ public static readonly DependencyProperty ItemDropCommandProperty =
+ DependencyProperty.Register("ItemDropCommand", typeof(ICommand), typeof(ChampionItemListView),
+ new PropertyMetadata(null));
+
+ public ICommand ItemDropCommand
+ {
+ get { return (ICommand)GetValue(ItemDropCommandProperty); }
+ set { SetValue(ItemDropCommandProperty, value); }
+ }
+
+ public static readonly DependencyProperty ItemRemovedCommandProperty =
+ DependencyProperty.Register("ItemRemovedCommand", typeof(ICommand), typeof(ChampionItemListView),
+ new PropertyMetadata(null));
+
+ public ICommand ItemRemovedCommand
+ {
+ get { return (ICommand)GetValue(ItemRemovedCommandProperty); }
+ set { SetValue(ItemRemovedCommandProperty, value); }
+ }
+
+ public static readonly DependencyProperty ItemInsertedCommandProperty =
+ DependencyProperty.Register("ItemInsertedCommand", typeof(ICommand), typeof(ChampionItemListView),
+ new PropertyMetadata(null));
+
+ public ICommand ItemInsertedCommand
+ {
+ get { return (ICommand)GetValue(ItemInsertedCommandProperty); }
+ set { SetValue(ItemInsertedCommandProperty, value); }
+ }
+
+ public static readonly DependencyProperty InsertedItemProperty =
+ DependencyProperty.Register("InsertedItem", typeof(object), typeof(ChampionItemListView),
+ new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
+
+ public object InsertedItem
+ {
+ get { return GetValue(InsertedItemProperty); }
+ set { SetValue(InsertedItemProperty, value); }
+ }
+
+ public static readonly DependencyProperty TargetItemProperty =
+ DependencyProperty.Register("TargetItem", typeof(object), typeof(ChampionItemListView),
+ new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
+
+ public object TargetItem
+ {
+ get { return GetValue(TargetItemProperty); }
+ set { SetValue(TargetItemProperty, value); }
+ }
+
+
+ public ChampionItemListView()
+ {
+ InitializeComponent();
+ }
+
+ private void ChampionsItem_MouseMove(object sender, MouseEventArgs e)
+ {
+ if (e.LeftButton == MouseButtonState.Pressed
+ && sender is FrameworkElement frameworkElement)
+ {
+ object item = frameworkElement.DataContext;
+
+ DragDropEffects dragDropResult = DragDrop.DoDragDrop(frameworkElement,
+ new DataObject(DataFormats.Serializable, item),
+ DragDropEffects.Move);
+
+ if (dragDropResult == DragDropEffects.None)
+ {
+ addItem(item);
+ }
+ }
+ }
+
+ private void ChampionsItem_DragOver(object sender, DragEventArgs e)
+ {
+ if (ItemInsertedCommand?.CanExecute(null) ?? false)
+ {
+ if (sender is FrameworkElement element)
+ {
+ TargetItem = element.DataContext;
+ InsertedItem = e.Data.GetData(DataFormats.Serializable);
+ ItemInsertedCommand?.Execute(null);
+ }
+ }
+ }
+
+ private void Champions_DragOver(object sender, DragEventArgs e)
+ {
+ object item = e.Data.GetData(DataFormats.Serializable);
+ addItem(item);
+ }
+
+ private void addItem(object item)
+ {
+ if (ItemDropCommand?.CanExecute(null) ?? false)
+ {
+ IncomingItem = item;
+ ItemDropCommand?.Execute(null);
+ }
+ }
+
+ private void Champions_DragLeave(object sender, DragEventArgs e)
+ {
+ HitTestResult result = VisualTreeHelper.HitTest(listViewItems, e.GetPosition(listViewItems));
+
+ if (result == null)
+ {
+ if (ItemRemovedCommand?.CanExecute(null) ?? false)
+ {
+ RemovedItem = e.Data.GetData(DataFormats.Serializable);
+ ItemRemovedCommand?.Execute(null);
+ }
+ }
+ }
+ }
+}
diff --git a/LoL Assist/Views/ChampionPickerPanel.xaml b/LoL Assist/Views/ChampionPickerPanel.xaml
new file mode 100644
index 0000000..e60ca86
--- /dev/null
+++ b/LoL Assist/Views/ChampionPickerPanel.xaml
@@ -0,0 +1,341 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/LoL Assist/View/PatchNotesPanel.xaml.cs b/LoL Assist/Views/ChampionPickerPanel.xaml.cs
similarity index 61%
rename from LoL Assist/View/PatchNotesPanel.xaml.cs
rename to LoL Assist/Views/ChampionPickerPanel.xaml.cs
index 3c9a163..81465b3 100644
--- a/LoL Assist/View/PatchNotesPanel.xaml.cs
+++ b/LoL Assist/Views/ChampionPickerPanel.xaml.cs
@@ -1,7 +1,6 @@
-using LoL_Assist_WAPP.Model;
+using LoL_Assist_WAPP.ViewModels;
using System;
using System.Collections.Generic;
-using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -15,13 +14,16 @@
using System.Windows.Navigation;
using System.Windows.Shapes;
-namespace LoL_Assist_WAPP.View
+namespace LoL_Assist_WAPP.Views
{
///
- /// Interaction logic for PatchNotesPanel.xaml
+ /// Interaction logic for ChampionPickerPanel.xaml
///
- public partial class PatchNotesPanel : UserControl
+ public partial class ChampionPickerPanel: UserControl
{
- public PatchNotesPanel() => InitializeComponent();
+ public ChampionPickerPanel()
+ {
+ InitializeComponent();
+ }
}
}
diff --git a/LoL Assist/View/ConfigPanel.xaml b/LoL Assist/Views/ConfigPanel.xaml
similarity index 89%
rename from LoL Assist/View/ConfigPanel.xaml
rename to LoL Assist/Views/ConfigPanel.xaml
index 3cf8dc2..de87f31 100644
--- a/LoL Assist/View/ConfigPanel.xaml
+++ b/LoL Assist/Views/ConfigPanel.xaml
@@ -1,10 +1,8 @@
-
@@ -17,7 +15,7 @@
-
+
@@ -66,16 +64,7 @@
-
-
-
+
@@ -121,7 +110,7 @@
+ IsChecked="{Binding Path=UpdateOnStartup, UpdateSourceTrigger=PropertyChanged}" Margin="0,0,0,6">
Update LoL Assist on startup if available
@@ -133,12 +122,17 @@
-->
-
-
-
+
+
+
+
+
+
@@ -161,7 +155,6 @@
-
diff --git a/LoL Assist/View/ConfigPanel.xaml.cs b/LoL Assist/Views/ConfigPanel.xaml.cs
similarity index 81%
rename from LoL Assist/View/ConfigPanel.xaml.cs
rename to LoL Assist/Views/ConfigPanel.xaml.cs
index 8370a98..187930f 100644
--- a/LoL Assist/View/ConfigPanel.xaml.cs
+++ b/LoL Assist/Views/ConfigPanel.xaml.cs
@@ -1,14 +1,14 @@
-using LoL_Assist_WAPP.ViewModel;
+using LoL_Assist_WAPP.ViewModels;
using System.Windows.Navigation;
using System.Windows.Controls;
-using LoL_Assist_WAPP.Model;
+using LoL_Assist_WAPP.Models;
using LoL_Assist_WAPP.Utils;
using System.Diagnostics;
using System.Windows;
using System.IO;
using LoLA;
-namespace LoL_Assist_WAPP.View
+namespace LoL_Assist_WAPP.Views
{
///
/// Interaction logic for ConfigPanel.xaml
@@ -24,7 +24,7 @@ public ConfigPanel(Border border)
DataContext = ConfigViewModel;
}
- void Close()
+ void close()
{
Animation.FadeOut(backDrop);
Animation.Margin(this, ConfigModel.r_MarginOpen, ConfigModel.r_MarginClose);
@@ -45,15 +45,21 @@ private async void CheckForUpdatesLink_Click(object sender, RoutedEventArgs e)
private void clearCacheBtn_Click(object sender, RoutedEventArgs e)
{
- MsgBox exitMsg = new MsgBox("By clicking 'Yes' Champions folder which contains images and data for the the champion will be deleted permanently. Do you want to continue this action?", 230, 130);
+ MsgBox exitMsg = new MsgBox("By clicking 'Yes' all folder in LoLA Data which contains images and data for the the champions will be deleted permanently. Do you want to continue this action?", 240, 140);
exitMsg.Margin = new Thickness(0, Height, 0, 0);
MainGrid.Children.Add(exitMsg);
Grid.SetRowSpan(exitMsg, 2);
exitMsg.Decided += delegate (bool result)
{
- var path = LibInfo.r_LibFolderPath + "\\Champions";
- if (result && Directory.Exists(path))
- Directory.Delete(path, true);
+ var path1 = LibInfo.r_LibFolderPath + "\\Champions";
+ var path2 = LibInfo.r_LibFolderPath + "\\Custom Builds";
+
+ if (result && Directory.Exists(path1))
+ Directory.Delete(path1, true);
+
+ if (result && Directory.Exists(path2))
+ Directory.Delete(path2, true);
+
Animation.FadeOut(BackDrop, 0.13);
Animation.Margin(exitMsg, ConfigModel.r_MarginOpen, new Thickness(0, Height, 0, 0), 0.13);
@@ -88,6 +94,6 @@ private void resetConfigBtn_Click(object sender, RoutedEventArgs e)
Animate(exitMsg, new Thickness(0, Height, 0, 0), ConfigModel.r_MarginOpen, 0.13);
}
- private void BackBtn_Click(object sender, RoutedEventArgs e) => Close();
+ private void BackBtn_Click(object sender, RoutedEventArgs e) => close();
}
}
diff --git a/LoL Assist/View/DownloadPanel.xaml b/LoL Assist/Views/DownloadPanel.xaml
similarity index 77%
rename from LoL Assist/View/DownloadPanel.xaml
rename to LoL Assist/Views/DownloadPanel.xaml
index 7023476..8cacf22 100644
--- a/LoL Assist/View/DownloadPanel.xaml
+++ b/LoL Assist/Views/DownloadPanel.xaml
@@ -1,9 +1,8 @@
-
@@ -26,11 +25,14 @@
-
-
+
+
-
+
+
+
@@ -47,10 +49,8 @@
-
-
-
-
+
+
@@ -60,7 +60,7 @@
+ Tag="{StaticResource XmarkIcon}" Focusable="False" CommandParameter="{Binding ElementName=Me}">
Close
diff --git a/LoL Assist/View/DownloadPanel.xaml.cs b/LoL Assist/Views/DownloadPanel.xaml.cs
similarity index 95%
rename from LoL Assist/View/DownloadPanel.xaml.cs
rename to LoL Assist/Views/DownloadPanel.xaml.cs
index b00fbdc..dc8b743 100644
--- a/LoL Assist/View/DownloadPanel.xaml.cs
+++ b/LoL Assist/Views/DownloadPanel.xaml.cs
@@ -13,7 +13,7 @@
using System.Windows.Navigation;
using System.Windows.Shapes;
-namespace LoL_Assist_WAPP.View
+namespace LoL_Assist_WAPP.Views
{
///
/// Interaction logic for DownloadPanel.xaml
diff --git a/LoL Assist/View/InfoPanel.xaml b/LoL Assist/Views/InfoPanel.xaml
similarity index 97%
rename from LoL Assist/View/InfoPanel.xaml
rename to LoL Assist/Views/InfoPanel.xaml
index 9de568a..eef7af2 100644
--- a/LoL Assist/View/InfoPanel.xaml
+++ b/LoL Assist/Views/InfoPanel.xaml
@@ -1,9 +1,9 @@
-
diff --git a/LoL Assist/View/InfoPanel.xaml.cs b/LoL Assist/Views/InfoPanel.xaml.cs
similarity index 93%
rename from LoL Assist/View/InfoPanel.xaml.cs
rename to LoL Assist/Views/InfoPanel.xaml.cs
index 14fc091..38ab651 100644
--- a/LoL Assist/View/InfoPanel.xaml.cs
+++ b/LoL Assist/Views/InfoPanel.xaml.cs
@@ -1,11 +1,10 @@
using System.Windows.Controls;
-using LoL_Assist_WAPP.Model;
-using System.Windows.Input;
+using LoL_Assist_WAPP.Models;
using System.Diagnostics;
using System;
using LoLA;
-namespace LoL_Assist_WAPP.View
+namespace LoL_Assist_WAPP.Views
{
///
/// Interaction logic for InfoPanel.xaml
diff --git a/LoL Assist/View/MatchFoundPanel.xaml b/LoL Assist/Views/MatchFoundPanel.xaml
similarity index 96%
rename from LoL Assist/View/MatchFoundPanel.xaml
rename to LoL Assist/Views/MatchFoundPanel.xaml
index 07a7762..9069b6e 100644
--- a/LoL Assist/View/MatchFoundPanel.xaml
+++ b/LoL Assist/Views/MatchFoundPanel.xaml
@@ -1,9 +1,8 @@
-
diff --git a/LoL Assist/View/MatchFoundPanel.xaml.cs b/LoL Assist/Views/MatchFoundPanel.xaml.cs
similarity index 88%
rename from LoL Assist/View/MatchFoundPanel.xaml.cs
rename to LoL Assist/Views/MatchFoundPanel.xaml.cs
index 81e320a..dcb84dd 100644
--- a/LoL Assist/View/MatchFoundPanel.xaml.cs
+++ b/LoL Assist/Views/MatchFoundPanel.xaml.cs
@@ -1,6 +1,6 @@
using System.Windows.Controls;
-namespace LoL_Assist_WAPP.View
+namespace LoL_Assist_WAPP.Views
{
///
/// Interaction logic for MatchFoundPanel.xaml
diff --git a/LoL Assist/View/MessageBox.xaml b/LoL Assist/Views/MessageBox.xaml
similarity index 89%
rename from LoL Assist/View/MessageBox.xaml
rename to LoL Assist/Views/MessageBox.xaml
index b8009f9..a82470a 100644
--- a/LoL Assist/View/MessageBox.xaml
+++ b/LoL Assist/Views/MessageBox.xaml
@@ -1,9 +1,8 @@
-
diff --git a/LoL Assist/View/MessageBox.xaml.cs b/LoL Assist/Views/MessageBox.xaml.cs
similarity index 77%
rename from LoL Assist/View/MessageBox.xaml.cs
rename to LoL Assist/Views/MessageBox.xaml.cs
index 48c6ac6..f0c41d1 100644
--- a/LoL Assist/View/MessageBox.xaml.cs
+++ b/LoL Assist/Views/MessageBox.xaml.cs
@@ -1,13 +1,9 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
+using System.Windows.Controls;
using System.Threading.Tasks;
+using LoL_Assist_WAPP.Models;
using System.Windows;
-using System.Windows.Controls;
-using LoL_Assist_WAPP.ViewModel;
-namespace LoL_Assist_WAPP.View
+namespace LoL_Assist_WAPP.Views
{
///
/// Interaction logic for MessageBox.xaml
@@ -22,7 +18,7 @@ public MessageBox()
private async void msgBox_Loaded(object sender, RoutedEventArgs e)
{
await Task.Delay(2);
- var data = ((MessageBoxViewModel)DataContext);
+ var data = ((MessageBoxModel)DataContext);
MsgBox msgBox = new MsgBox(data.Message, data.Width, data.Height);
msgBox.Opacity = 0;
msgBox.Visibility = Visibility.Collapsed;
diff --git a/LoL Assist/Views/MessagePanel.xaml b/LoL Assist/Views/MessagePanel.xaml
new file mode 100644
index 0000000..3a94f81
--- /dev/null
+++ b/LoL Assist/Views/MessagePanel.xaml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/LoL Assist/Views/MessagePanel.xaml.cs b/LoL Assist/Views/MessagePanel.xaml.cs
new file mode 100644
index 0000000..901766f
--- /dev/null
+++ b/LoL Assist/Views/MessagePanel.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace LoL_Assist_WAPP.Views
+{
+ ///
+ /// Interaction logic for MessagePanel.xaml
+ ///
+ public partial class MessagePanel: UserControl
+ {
+ public MessagePanel()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/LoL Assist/View/MsgBox.xaml b/LoL Assist/Views/MsgBox.xaml
similarity index 91%
rename from LoL Assist/View/MsgBox.xaml
rename to LoL Assist/Views/MsgBox.xaml
index 2d6efd4..9b416c0 100644
--- a/LoL Assist/View/MsgBox.xaml
+++ b/LoL Assist/Views/MsgBox.xaml
@@ -1,11 +1,9 @@
-
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ mc:Ignorable="d" Width="250" Height="160">
diff --git a/LoL Assist/View/MsgBox.xaml.cs b/LoL Assist/Views/MsgBox.xaml.cs
similarity index 93%
rename from LoL Assist/View/MsgBox.xaml.cs
rename to LoL Assist/Views/MsgBox.xaml.cs
index 4e9999e..573aaaa 100644
--- a/LoL Assist/View/MsgBox.xaml.cs
+++ b/LoL Assist/Views/MsgBox.xaml.cs
@@ -1,10 +1,10 @@
using System.Windows.Controls;
-using LoL_Assist_WAPP.Model;
+using LoL_Assist_WAPP.Models;
using System.Windows.Input;
using System.Windows;
using System;
-namespace LoL_Assist_WAPP.View
+namespace LoL_Assist_WAPP.Views
{
///
/// Interaction logic for MsgBox.xaml
diff --git a/LoL Assist/View/PathSelector.xaml b/LoL Assist/Views/PathSelector.xaml
similarity index 100%
rename from LoL Assist/View/PathSelector.xaml
rename to LoL Assist/Views/PathSelector.xaml
diff --git a/LoL Assist/View/PathSelector.xaml.cs b/LoL Assist/Views/PathSelector.xaml.cs
similarity index 100%
rename from LoL Assist/View/PathSelector.xaml.cs
rename to LoL Assist/Views/PathSelector.xaml.cs
diff --git a/LoL Assist/View/RuneEditorPanel.xaml b/LoL Assist/Views/RuneEditorPanel.xaml
similarity index 98%
rename from LoL Assist/View/RuneEditorPanel.xaml
rename to LoL Assist/Views/RuneEditorPanel.xaml
index fa51a0c..aef05ca 100644
--- a/LoL Assist/View/RuneEditorPanel.xaml
+++ b/LoL Assist/Views/RuneEditorPanel.xaml
@@ -1,15 +1,14 @@
-
-
+
@@ -384,7 +383,7 @@
-
+
+ Tag="{StaticResource XmarkIcon}" Focusable="False" CommandParameter="{Binding ElementName=Me}">
Close
diff --git a/LoL Assist/View/RuneEditorPanel.xaml.cs b/LoL Assist/Views/RuneEditorPanel.xaml.cs
similarity index 88%
rename from LoL Assist/View/RuneEditorPanel.xaml.cs
rename to LoL Assist/Views/RuneEditorPanel.xaml.cs
index 1283346..c37ccc4 100644
--- a/LoL Assist/View/RuneEditorPanel.xaml.cs
+++ b/LoL Assist/Views/RuneEditorPanel.xaml.cs
@@ -1,6 +1,6 @@
using System.Windows.Controls;
-namespace LoL_Assist_WAPP.View
+namespace LoL_Assist_WAPP.Views
{
///
/// Interaction logic for RuneEditorPanel.xaml
diff --git a/LoL Assist/Views/Windows/MainWIndow.xaml b/LoL Assist/Views/Windows/MainWIndow.xaml
new file mode 100644
index 0000000..f85a233
--- /dev/null
+++ b/LoL Assist/Views/Windows/MainWIndow.xaml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/LoL Assist/Views/Windows/MainWIndow.xaml.cs b/LoL Assist/Views/Windows/MainWIndow.xaml.cs
new file mode 100644
index 0000000..ab0142b
--- /dev/null
+++ b/LoL Assist/Views/Windows/MainWIndow.xaml.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace LoL_Assist_WAPP.Views.Windows
+{
+ ///
+ /// Interaction logic for MainWIndow.xaml
+ ///
+ public partial class MainWIndow: Window
+ {
+ public MainWIndow()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/LoL Assist/packages.config b/LoL Assist/packages.config
deleted file mode 100644
index bc2a97e..0000000
--- a/LoL Assist/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/LoLA/LoLA/Data/ChampionBuild.cs b/LoLA/LoLA/Data/ChampionBuild.cs
index c75c73f..86891ca 100644
--- a/LoLA/LoLA/Data/ChampionBuild.cs
+++ b/LoLA/LoLA/Data/ChampionBuild.cs
@@ -1,4 +1,6 @@
-namespace LoLA.Data
+using System.Collections.Generic;
+
+namespace LoLA.Data
{
public class ChampionBuild
{
@@ -6,7 +8,7 @@ public class ChampionBuild
public string Id { get; set; }
public string Role { get; set; } = "fill";
- public Rune Rune = new Rune();
- public Spell Spell = new Spell();
+ public List Runes = new List();
+ public List Spells = new List();
}
}
diff --git a/LoLA/LoLA/Data/ItemSet.cs b/LoLA/LoLA/Data/ItemSet.cs
new file mode 100644
index 0000000..e9673f4
--- /dev/null
+++ b/LoLA/LoLA/Data/ItemSet.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LoLA.Data
+{
+ public class Block
+ {
+ public List- items { get; set; }
+ public string type { get; set; }
+ }
+
+ public class Item
+ {
+ public string id { get; set; }
+ public int count { get; set; }
+ }
+
+ public class ItemSet
+ {
+ public string title { get; set; }
+ public List
associatedMaps { get; set; }
+ public List associatedChampions { get; set; }
+ public List blocks { get; set; }
+ }
+}
diff --git a/LoLA/LoLA/DataConverter.cs b/LoLA/LoLA/DataConverter.cs
index 14df6c5..d9e9567 100644
--- a/LoLA/LoLA/DataConverter.cs
+++ b/LoLA/LoLA/DataConverter.cs
@@ -30,6 +30,7 @@ public static int SpellIdToSpellKey(string id)
public static string SpellKeyToSpellId(int key)
{
var spellKeyToSpellName = new Dictionary {
+ { 21, "SummonerBarrier" },
{ 0, "SummonerBarrier" },
{ 1, "SummonerBoost" },
{ 3, "SummonerExhaust" },
@@ -55,6 +56,7 @@ public static string SpellKeyToSpellId(int key)
public static string SpellKeyToSpellName(int key)
{
var spellKeyToSpellName = new Dictionary {
+ { 21, "Barrier" },
{ 0, "Barrier" },
{ 1, "Cleanse" },
{ 3, "Exhaust" },
@@ -67,13 +69,6 @@ public static string SpellKeyToSpellName(int key)
{ 14, "Ignite" },
{ 32, "Mark" }
};
- //SpellKeyToSpellName.Add(30, "To the King!");
- //SpellKeyToSpellName.Add(31, "Poro Toss");
- //SpellKeyToSpellName.Add(33, "Nexus Siege: Siege Weapon Slot1");
- //SpellKeyToSpellName.Add(34, "Nexus Siege: Siege Weapon Slot2");
- //SpellKeyToSpellName.Add(35, "Disabled Summoner Spells1");
- //SpellKeyToSpellName.Add(36, "Disabled Summoner Spells2");
- //SpellKeyToSpellName.Add(39, "Ultra (Rapidly Flung) Mark");
return spellKeyToSpellName[key];
}
@@ -200,7 +195,6 @@ public static int ShardAliasToShardId(string alias)
public static void Init()
{
Log("Initializing Data Converters...", LogType.INFO);
-
// await Task.Run(() =>
// {
// s_SpellKeyToSpellName.Add(0, "Barrier");
@@ -223,102 +217,23 @@ public static void Init()
// //SpellKeyToSpellName.Add(39, "Ultra (Rapidly Flung) Mark");
s_SpellNameToSpellKey.Add("Barrier", 0);
- s_SpellNameToSpellKey.Add("Cleanse", 1);
- s_SpellNameToSpellKey.Add("Exhaust", 3);
- s_SpellNameToSpellKey.Add("Flash", 4);
- s_SpellNameToSpellKey.Add("Ghost", 6);
- s_SpellNameToSpellKey.Add("Heal", 7);
- s_SpellNameToSpellKey.Add("Smite", 11);
- s_SpellNameToSpellKey.Add("Teleport", 12);
- s_SpellNameToSpellKey.Add("Clarity", 13);
- s_SpellNameToSpellKey.Add("Ignite", 14);
- //SpellNameToSpellKey.Add("To the King!", 30);
- //SpellNameToSpellKey.Add("Poro Toss", 31);
- s_SpellNameToSpellKey.Add("Mark", 32);
- //SpellNameToSpellKey.Add("Nexus Siege: Siege Weapon Slot1", 33);
- //SpellNameToSpellKey.Add("Nexus Siege: Siege Weapon Slot2", 34);
- //SpellNameToSpellKey.Add("Disabled Summoner Spells1", 35);
- //SpellNameToSpellKey.Add("Disabled Summoner Spells2", 36);
- //SpellNameToSpellKey.Add("Ultra (Rapidly Flung) Mark", 39);
-
- // s_SpellIdToSpellKey.Add("SummonerBarrier", 0);
- // s_SpellIdToSpellKey.Add("SummonerBoost", 1);
- // s_SpellIdToSpellKey.Add("SummonerExhaust", 3);
- // s_SpellIdToSpellKey.Add("SummonerFlash", 4);
- // s_SpellIdToSpellKey.Add("SummonerHaste", 6);
- // s_SpellIdToSpellKey.Add("SummonerHeal", 7);
- // s_SpellIdToSpellKey.Add("SummonerSmite", 11);
- // s_SpellIdToSpellKey.Add("SummonerTeleport", 12);
- // s_SpellIdToSpellKey.Add("SummonerMana", 13);
- // s_SpellIdToSpellKey.Add("SummonerDot", 14);
- // s_SpellIdToSpellKey.Add("SummonerSnowball", 32);
-
- // s_SpellNameToSpellId.Add("Cleanse", "SummonerBoost");
- // s_SpellNameToSpellId.Add("Exhaust", "SummonerExhaust");
- // s_SpellNameToSpellId.Add("Flash", "SummonerFlash");
- // s_SpellNameToSpellId.Add("Ghost", "SummonerHaste");
- // s_SpellNameToSpellId.Add("Heal", "SummonerHeal");
- // s_SpellNameToSpellId.Add("Smite", "SummonerSmite");
- // s_SpellNameToSpellId.Add("Teleport", "SummonerTeleport");
- // s_SpellNameToSpellId.Add("Clarity", "SummonerMana");
- // s_SpellNameToSpellId.Add("Ignite", "SummonerDot");
- // s_SpellNameToSpellId.Add("Barrier", "SummonerBarrier");
- // s_SpellNameToSpellId.Add("Mark", "SummonerSnowball");
-
- // s_SpellIDToSpellName.Add("SummonerBoost", "Cleanse");
- // s_SpellIDToSpellName.Add("SummonerExhaust", "Exhaust");
- // s_SpellIDToSpellName.Add("SummonerFlash", "Flash");
- // s_SpellIDToSpellName.Add("SummonerHaste", "Ghost");
- // s_SpellIDToSpellName.Add("SummonerHeal", "Heal");
- // s_SpellIDToSpellName.Add("SummonerSmite", "Smite");
- // s_SpellIDToSpellName.Add("SummonerTeleport", "Teleport");
- // s_SpellIDToSpellName.Add("SummonerMana", "Clarity");
- // s_SpellIDToSpellName.Add("SummonerDot", "Ignite");
- // s_SpellIDToSpellName.Add("SummonerBarrier", "Barrier");
- // s_SpellIDToSpellName.Add("SummonerSnowball", "Mark");
-
- // //DescriptionToShard.Add("10% bonus attack speed", "axe");
- // //DescriptionToShard.Add("8 bonus magic resistance", "circle");
- // //DescriptionToShard.Add("5.4 bonus Attack Damage or 9 Ability Power (Adaptive)", "diamond");
- // //DescriptionToShard.Add("6 bonus armor", "shield");
- // //DescriptionToShard.Add("8 ability haste", "time");
- // //DescriptionToShard.Add("15 − 90 (based on level) bonus health", "heart");
-
- // s_ShardAliasToShardId.Add("axe", 5005);
- // s_ShardAliasToShardId.Add("circle", 5003);
- // s_ShardAliasToShardId.Add("diamond", 5008);
- // s_ShardAliasToShardId.Add("shield", 5002);
- // s_ShardAliasToShardId.Add("time", 5007);
- // s_ShardAliasToShardId.Add("heart", 5001);
-
- // s_ShardIdToShardAlias.Add(5005, "axe");
- // s_ShardIdToShardAlias.Add(5003, "circle");
- // s_ShardIdToShardAlias.Add(5008, "diamond");
- // s_ShardIdToShardAlias.Add(5002, "shield");
- // s_ShardIdToShardAlias.Add(5007, "time");
- // s_ShardIdToShardAlias.Add(5001, "heart");
-
- // s_ShardDescriptionToShardAlias.Add("10% bonus attack speed", "axe");
- // s_ShardDescriptionToShardAlias.Add("8 bonus magic resistance", "circle");
- // s_ShardDescriptionToShardAlias.Add("5.4 bonus AD or 9 AP (Adaptive)", "diamond");
- // s_ShardDescriptionToShardAlias.Add("6 bonus armor", "shield");
- // s_ShardDescriptionToShardAlias.Add("8 ability haste", "time");
- // s_ShardDescriptionToShardAlias.Add("15 − 90 (based on level) bonus health", "heart");
-
- // s_ShardDescriptionToShardId.Add("10% bonus attack speed", 5005);
- // s_ShardDescriptionToShardId.Add("8 bonus magic resistance", 5003);
- // s_ShardDescriptionToShardId.Add("5.4 bonus AD or 9 AP (Adaptive)", 5008);
- // s_ShardDescriptionToShardId.Add("6 bonus armor", 5002);
- // s_ShardDescriptionToShardId.Add("8 ability haste", 5007);
- // s_ShardDescriptionToShardId.Add("15 − 90 (based on level) bonus health", 5001);
-
- // s_ShardIdToShardDescription.Add(5005, "10% bonus attack speed");
- // s_ShardIdToShardDescription.Add(5003, "8 bonus magic resistance");
- // s_ShardIdToShardDescription.Add(5008, "5.4 bonus AD or 9 AP (Adaptive)");
- // s_ShardIdToShardDescription.Add(5002, "6 bonus armor");
- // s_ShardIdToShardDescription.Add(5007, "8 ability haste");
- // s_ShardIdToShardDescription.Add(5001, "15 − 90 (based on level) bonus health");
- // });
+ s_SpellNameToSpellKey.Add("Cleanse", 1);
+ s_SpellNameToSpellKey.Add("Exhaust", 3);
+ s_SpellNameToSpellKey.Add("Flash", 4);
+ s_SpellNameToSpellKey.Add("Ghost", 6);
+ s_SpellNameToSpellKey.Add("Heal", 7);
+ s_SpellNameToSpellKey.Add("Smite", 11);
+ s_SpellNameToSpellKey.Add("Teleport", 12);
+ s_SpellNameToSpellKey.Add("Clarity", 13);
+ s_SpellNameToSpellKey.Add("Ignite", 14);
+ //SpellNameToSpellKey.Add("To the King!", 30);
+ //SpellNameToSpellKey.Add("Poro Toss", 31);
+ s_SpellNameToSpellKey.Add("Mark", 32);
+ //SpellNameToSpellKey.Add("Nexus Siege: Siege Weapon Slot1", 33);
+ //SpellNameToSpellKey.Add("Nexus Siege: Siege Weapon Slot2", 34);
+ //SpellNameToSpellKey.Add("Disabled Summoner Spells1", 35);
+ //SpellNameToSpellKey.Add("Disabled Summoner Spells2", 36);
+ //SpellNameToSpellKey.Add("Ultra (Rapidly Flung) Mark", 39);
}
}
}
diff --git a/LoLA/LoLA/LoLA.csproj b/LoLA/LoLA/LoLA.csproj
index c1bb93c..96c451a 100644
--- a/LoLA/LoLA/LoLA.csproj
+++ b/LoLA/LoLA/LoLA.csproj
@@ -54,6 +54,7 @@
+
@@ -65,6 +66,7 @@
+
@@ -91,6 +93,7 @@
+
diff --git a/LoLA/LoLA/Main.cs b/LoLA/LoLA/Main.cs
index 6b805f3..e08b9d5 100644
--- a/LoLA/LoLA/Main.cs
+++ b/LoLA/LoLA/Main.cs
@@ -2,6 +2,7 @@
using LoLA.Networking.WebWrapper.DataProviders.UGG;
using LoLA.Networking.WebWrapper.DataDragon;
using static LoLA.Utils.Logger.LogService;
+using System.Collections.Generic;
using LoLA.Networking.LCU.Enums;
using System.Threading.Tasks;
using LoLA.Utils.Logger;
@@ -34,9 +35,10 @@ public static async Task Init()
}
}
- public static async Task RequestBuildsData(string championId, GameMode gameMode, Provider provider, Role role = Role.RECOMENDED)
+ public static async Task RequestBuildsData(string championId, GameMode gameMode, Provider provider, Role role = Role.RECOMENDED, int index = 0)
{
ChampionBuild championBuild = new ChampionBuild();
+
switch (provider)
{
case Provider.Local:
@@ -47,8 +49,8 @@ public static async Task RequestBuildsData(string championId, Gam
championBuild = await MetasrcWrapper.FetchDataAsync(championId, gameMode, role);
break;
case Provider.UGG:
- if(gameMode == GameMode.CLASSIC || gameMode == GameMode.PRACTICETOOL)
- championBuild = await UGGWrapper.FetchDataAsync(championId, gameMode, role);
+ if(gameMode == GameMode.CLASSIC || gameMode == GameMode.PRACTICETOOL || gameMode == GameMode.ARAM)
+ championBuild = await UGGWrapper.FetchDataAsync(championId, gameMode, role, index);
else
championBuild = await MetasrcWrapper.FetchDataAsync(championId, gameMode, role);
break;
diff --git a/LoLA/LoLA/Networking/LCU/Data/SessionData.cs b/LoLA/LoLA/Networking/LCU/Data/SessionData.cs
new file mode 100644
index 0000000..c94f34c
--- /dev/null
+++ b/LoLA/LoLA/Networking/LCU/Data/SessionData.cs
@@ -0,0 +1,17 @@
+using LoLA.Networking.LCU.Enums;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LoLA.Networking.LCU.Data
+{
+ public class SessionData
+ {
+ public GameMode GameMode { get; set; } = GameMode.NONE;
+ public string Category { get; set; }
+ public string Description { get; set; }
+ public bool IsRanked { get; set; }
+ }
+}
diff --git a/LoLA/LoLA/Networking/LCU/Enums/RequestMethod.cs b/LoLA/LoLA/Networking/LCU/Enums/RequestMethod.cs
index 2999d3b..4844835 100644
--- a/LoLA/LoLA/Networking/LCU/Enums/RequestMethod.cs
+++ b/LoLA/LoLA/Networking/LCU/Enums/RequestMethod.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace LoLA.Networking.LCU.Enums
+namespace LoLA.Networking.LCU.Enums
{
public enum RequestMethod
{
@@ -14,4 +8,4 @@ public enum RequestMethod
DELETE,
PATCH
}
-}
+}
\ No newline at end of file
diff --git a/LoLA/LoLA/Networking/LCU/Events/ChampionMonitor.cs b/LoLA/LoLA/Networking/LCU/Events/ChampionMonitor.cs
index fae8bfe..fd30681 100644
--- a/LoLA/LoLA/Networking/LCU/Events/ChampionMonitor.cs
+++ b/LoLA/LoLA/Networking/LCU/Events/ChampionMonitor.cs
@@ -51,6 +51,7 @@ private async void championMonitor()
ChampionChanged?.Invoke(this, new ChampionChangedArgs(currentChampion));
}
}
+
await Task.Delay(MonitorDelay);
}
}
diff --git a/LoLA/LoLA/Networking/LCU/Events/PhaseMonitor.cs b/LoLA/LoLA/Networking/LCU/Events/PhaseMonitor.cs
index f35fd9e..3992725 100644
--- a/LoLA/LoLA/Networking/LCU/Events/PhaseMonitor.cs
+++ b/LoLA/LoLA/Networking/LCU/Events/PhaseMonitor.cs
@@ -20,13 +20,13 @@ public PhaseChangedArgs(Phase currentPhase)
public event EventHandler PhaseChanged;
public bool IsMonitoring { get; set; } = true;
public int MonitorDelay { get; set; } = 300;
- private Phase LastPhase { get; set; }
+ private Phase previousPhase { get; set; }
public PhaseMonitor()
{
- Thread MonitorThread = new Thread(phaseMonitor);
- MonitorThread.IsBackground = true;
- MonitorThread.Start();
+ var monitorThread = new Thread(phaseMonitor);
+ monitorThread.IsBackground = true;
+ monitorThread.Start();
}
public async void phaseMonitor()
@@ -40,9 +40,9 @@ public async void phaseMonitor()
}
var currentPhase = await LCUWrapper.GetGamePhaseAsync();
- if (LastPhase != currentPhase)
+ if (previousPhase != currentPhase)
{
- LastPhase = currentPhase;
+ previousPhase = currentPhase;
PhaseChanged?.Invoke(this, new PhaseChangedArgs(currentPhase));
}
await Task.Delay(MonitorDelay);
diff --git a/LoLA/LoLA/Networking/LCU/LCUWrapper.cs b/LoLA/LoLA/Networking/LCU/LCUWrapper.cs
index 2a8d86b..a97cf32 100644
--- a/LoLA/LoLA/Networking/LCU/LCUWrapper.cs
+++ b/LoLA/LoLA/Networking/LCU/LCUWrapper.cs
@@ -3,6 +3,7 @@
using System.Collections.Generic;
using LoLA.Networking.Extensions;
using LoLA.Networking.LCU.Enums;
+using LoLA.Networking.LCU.Data;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using LoLA.Utils.Logger;
@@ -135,6 +136,30 @@ public static async Task AcceptMatchmakingAsync()
public static async Task DeclineMatchmakingAsync()
=> await getResponseRequestAsync(RequestMethod.POST, "/lol-matchmaking/v1/ready-check/decline");
+ public static async Task GetSessionDataAsync()
+ {
+ if (!await InitAsync())
+ return null;
+
+ var sessionData = new SessionData();
+ sessionData.GameMode = await GetCurrentGameModeAsync();
+ try
+ {
+ var json = await getDataRequestAsync(RequestMethod.GET, "/lol-gameflow/v1/session");
+ var session = JObject.Parse(json);
+ var gameDataPath = session["gameData"];
+ var queuePath = gameDataPath["queue"];
+
+ sessionData.Category = queuePath["category"].ToString();
+ sessionData.Description = queuePath["description"].ToString();
+ sessionData.IsRanked = queuePath["isRanked"].ToObject();
+
+ return sessionData;
+
+ }
+ catch { return sessionData; }
+ }
+
public static async Task GetCurrentGameModeAsync()
{
if (!await InitAsync())
@@ -142,10 +167,11 @@ public static async Task GetCurrentGameModeAsync()
try
{
- string json = await getDataRequestAsync(RequestMethod.GET, "/lol-lobby/v2/lobby");
- JObject obj = JsonConvert.DeserializeObject(json);
- JObject innerObj = obj["gameConfig"] as JObject;
- return (GameMode)Enum.Parse(typeof(GameMode), innerObj["gameMode"].ToString().ToUpper());
+ var json = await getDataRequestAsync(RequestMethod.GET, "/lol-lobby/v2/lobby");
+
+ var obj = JObject.Parse(json);
+ var gameConfig = obj["gameConfig"] as JObject;
+ return (GameMode)Enum.Parse(typeof(GameMode), gameConfig["gameMode"].ToString().ToUpper());
}
catch { return GameMode.NONE; }
}
@@ -167,7 +193,7 @@ public static async Task GetCurrentChampionAsyncV2()
try
{
- JObject obj = JsonConvert.DeserializeObject(json);
+ JObject obj = JObject.Parse(json);
return obj == null ? string.Empty : obj["championName"].Value();
}
catch { return string.Empty; }
@@ -186,12 +212,14 @@ public static async Task GetCurrentSummonerAsync()
return new Summoner();
}
- public static async Task GetCurrentSessionAsync()
+ public static async Task GetCurrentSessionAsync()
{
if (!await InitAsync())
return null;
- return await getDataRequestAsync(RequestMethod.GET, "/lol-champ-select/v1/session");
+ var currentSessionJson = await getDataRequestAsync(RequestMethod.GET, "/lol-champ-select/v1/session");
+
+ return JsonConvert.DeserializeObject(currentSessionJson);;
}
public static async Task GetMatchmakingInfo()
@@ -229,20 +257,47 @@ public static async Task GetCurrentSpellsAsync()
var currentSession = await GetCurrentSessionAsync();
string[] spells = new string[2];
- if (!string.IsNullOrEmpty(currentSession))
+ if (currentSession != null)
{
- JObject obj = JsonConvert.DeserializeObject(currentSession);
-
- var currentSummoner = obj["myTeam"][0];
- //spells[0] = DataConverter.s_SpellKeyToSpellName[(int)currentSummoner["spell1Id"]];
- //spells[1] = DataConverter.s_SpellKeyToSpellName[(int)currentSummoner["spell2Id"]];
-
+ var currentSummoner = currentSession["myTeam"][0];
spells[0] = DataConverter.SpellKeyToSpellName((int)currentSummoner["spell1Id"]);
spells[1] = DataConverter.SpellKeyToSpellName((int)currentSummoner["spell2Id"]);
return spells;
}
return null;
}
+
+ public static async Task GetMessagesAsync(string id)
+ {
+ if (!await InitAsync())
+ return null;
+
+ var json = await getDataRequestAsync(RequestMethod.GET, $"/lol-chat/v1/conversations{id}/messages");
+ return json != null ? JArray.Parse(json) : null;
+ }
+
+ public static async Task GetConversationsAsync()
+ {
+ if (!await InitAsync())
+ return null;
+
+ var json = await getDataRequestAsync(RequestMethod.GET, "/lol-chat/v1/conversations");
+ return json != null ? JArray.Parse(json) : null;
+ }
+
+ public static async Task SendMessageAsync(JArray conversations,string message, string type)
+ {
+ foreach (var conversation in conversations.Root)
+ {
+ if (conversation["type"].ToString() == type)
+ {
+ var conversationId = conversation["id"].ToString();
+
+ var body = Encoding.UTF8.GetBytes("{\"body\":\"" + message + "\"}");
+ await sendDataRequestAsync(RequestMethod.POST, $"/lol-chat/v1/conversations/{conversationId}/messages", body);
+ }
+ }
+ }
#endregion
#region Request
@@ -272,8 +327,8 @@ private static async Task sendDataRequestAsync(RequestMethod requestMethod
return false;
}
catch { return false; }
-
}
+
private static async Task getResponseRequestAsync(RequestMethod requestMethod, string url)
{
if (!await InitAsync())
diff --git a/LoLA/LoLA/Networking/LCU/LeagueClient.cs b/LoLA/LoLA/Networking/LCU/LeagueClient.cs
index 8a6e71e..7ca3a03 100644
--- a/LoLA/LoLA/Networking/LCU/LeagueClient.cs
+++ b/LoLA/LoLA/Networking/LCU/LeagueClient.cs
@@ -1,23 +1,23 @@
using System.Diagnostics;
using System.Linq;
using System.IO;
+using System;
namespace LoLA.Networking.LCU
{
public static class LeagueClient
{
- public static string ProccName = "LeagueClient";
+ public const string PROCC_NAME = "LeagueClient";
public static string GetLocation()
{
- var process = Process.GetProcessesByName(ProccName);
+ var process = Process.GetProcessesByName(PROCC_NAME);
if (process.Length > 0)
{
try
{
- string fullPath = process.First()?.MainModule?.FileName;
+ var fullPath = process?.First()?.MainModule?.FileName;
return Path.GetDirectoryName(fullPath);
- }
- catch { return null; }
+ } catch(NullReferenceException) { }
}
return null;
}
diff --git a/LoLA/LoLA/Networking/WebWrapper/DataDragon/DataDragonWrapper.cs b/LoLA/LoLA/Networking/WebWrapper/DataDragon/DataDragonWrapper.cs
index bf8ee32..5183513 100644
--- a/LoLA/LoLA/Networking/WebWrapper/DataDragon/DataDragonWrapper.cs
+++ b/LoLA/LoLA/Networking/WebWrapper/DataDragon/DataDragonWrapper.cs
@@ -15,7 +15,7 @@ public class DataDragonWrapper
{
public static List s_Perks = new List();
public static Champions s_Champions = new Champions();
- public static List s_Versions = new List();
+ public static List s_Patches = new List();
private static readonly string r_dataDragonUrl = $"{Protocol.HTTP}ddragon.leagueoflegends.com/cdn/";
public static async Task InitAsync(string patch = "latest")
@@ -25,9 +25,9 @@ public static async Task InitAsync(string patch = "latest")
Task championTasks = null;
List tasks = new List();
- s_Versions = await WebEx.DlDe>("https://ddragon.leagueoflegends.com/api/versions.json");
+ s_Patches = await WebEx.DlDe>("https://ddragon.leagueoflegends.com/api/versions.json");
- GlobalConfig.s_DataDragonPatch = patch == "latest" ? s_Versions[0] : patch;
+ GlobalConfig.s_DataDragonPatch = patch == "latest" ? s_Patches[0] : patch;
var championsWebModel = new WebModel()
{
@@ -56,13 +56,20 @@ public static async Task GetChampionImage(string championId)
WebModel webModel = new WebModel();
string imageName = championId + ".png";
- path = string.Format($"{ChampionFolder(championId)}\\champion_{imageName}");
+ path = $"{ChampionFolder(championId)}\\champion_{imageName}";
webModel.Url = $"{r_dataDragonUrl}{GlobalConfig.s_DataDragonPatch}/img/champion/{imageName}";
webModel.Path = path;
return await WebEx.RunDownloadAysnc(webModel);
}
+ public static string GetChampionImagePath(string championId)
+ {
+ var path = $"{ChampionFolder(championId)}\\champion_{championId}.png";
+ var returnPath = File.Exists(path) ? path : string.Empty;
+ return returnPath;
+ }
+
public static string ChampionFolder(string championId, string Patch = "")
{
try
@@ -84,5 +91,12 @@ public static string ChampionFolder(string championId, string Patch = "")
return null;
}
}
+
+ public static string GetPatchMM(int index = 0)
+ {
+ var patch = s_Patches[index];
+ patch = patch.Substring(0, patch.LastIndexOf("."));
+ return patch;
+ }
}
}
diff --git a/LoLA/LoLA/Networking/WebWrapper/DataProviders/Metasrc/MetasrcClass.cs b/LoLA/LoLA/Networking/WebWrapper/DataProviders/Metasrc/MetasrcClass.cs
index 456b046..f8f0b0c 100644
--- a/LoLA/LoLA/Networking/WebWrapper/DataProviders/Metasrc/MetasrcClass.cs
+++ b/LoLA/LoLA/Networking/WebWrapper/DataProviders/Metasrc/MetasrcClass.cs
@@ -21,7 +21,7 @@ public static void Init()
s_Key = Task.Run(() => WebEx.DlDe(JSON_URL)).Result;
- if (s_Key == null || string.IsNullOrEmpty(s_Key.Perks)) throw new Exception();
+ if (s_Key == null || string.IsNullOrEmpty(s_Key.Perks)) throw new NullReferenceException();
var names = typeof(Key).GetFields(FLAG).ToList();
var values = s_Key.GetType().GetFields(FLAG).Select(field => field.GetValue(s_Key)).ToList();
@@ -38,7 +38,6 @@ public static void Init()
public class Key
{
- //public int IndexRB { get; set; }
public string TipRB { get; set; }
public string SrcRB { get; set; }
public string RepRB { get; set; }
@@ -50,9 +49,6 @@ public class Key
public string SrcSP { get; set; }
public int FirstSP { get; set; }
public int SecondSP { get; set; }
- //public string MISC { get; set; }
- //public string ARAM { get; set; }
- //public string CLASSIC { get; set; }
}
}
}
diff --git a/LoLA/LoLA/Networking/WebWrapper/DataProviders/Metasrc/MetasrcWrapper.cs b/LoLA/LoLA/Networking/WebWrapper/DataProviders/Metasrc/MetasrcWrapper.cs
index 0a8cb13..9eae7ee 100644
--- a/LoLA/LoLA/Networking/WebWrapper/DataProviders/Metasrc/MetasrcWrapper.cs
+++ b/LoLA/LoLA/Networking/WebWrapper/DataProviders/Metasrc/MetasrcWrapper.cs
@@ -1,4 +1,5 @@
using static LoLA.Networking.WebWrapper.DataDragon.DataDragonWrapper;
+using static LoLA.Networking.WebWrapper.DataProviders.Utils.Helper;
using static LoLA.Utils.Logger.LogService;
using System.Collections.Generic;
using LoLA.Networking.Extensions;
@@ -25,8 +26,8 @@ public static async Task FetchDataAsync(string championId, GameMo
var championData = s_Champions.Data[championId];
var jsonContent = string.Empty;
- var filePath = DataPath(championId, gameMode, role);
- if (IsBuildFileValid(championId, gameMode, role))
+ var filePath = DataPath(championId, gameMode, role, Provider.METAsrc);
+ if (IsBuildFileValid(championId, gameMode, role, Provider.METAsrc))
{
Log($"Loading in {Misc.FixedName(championId)} build data from {Provider.METAsrc}...", LogType.INFO);
@@ -36,27 +37,27 @@ public static async Task FetchDataAsync(string championId, GameMo
else
{
Log($"Downloading {Misc.FixedName(championId)} build data from {Provider.METAsrc}...", LogType.INFO);
- string html = await GetHtmlAsync(championId, gameMode, role);
+ var html = await GetHtmlAsync(championId, gameMode, role);
if (!string.IsNullOrEmpty(html))
{
var document = new HtmlDocument();
document.LoadHtml(html);
- Task rune = null;
- Task spell = null;
+ Task> runeTasks = null;
+ Task> spellTasks = null;
List tasks = new List {
- (rune = GetRuneBuildAsync(championData.id, championData.name, gameMode, role, document)),
- (spell = GetSpellComboAsync(championData.id, gameMode, role, document))
+ (runeTasks = GetRunesAsync(championData.id, championData.name, gameMode, role, document)),
+ (spellTasks = GetSpellCombosAsync(championData.id, gameMode, role, document))
};
Parallel.ForEach(tasks, async task => { await task; });
championBuild.Id = championData.id;
championBuild.Name = championData.name;
- championBuild.Rune = await rune;
- championBuild.Spell = await spell;
+ championBuild.Runes = await runeTasks;
+ championBuild.Spells = await spellTasks;
jsonContent = JsonConvert.SerializeObject(championBuild);
@@ -77,14 +78,15 @@ public static async Task FetchDataAsync(string championId, GameMo
return championBuild;
}
- public static async Task GetRuneBuildAsync(string championId, string championName, GameMode gameMode, Role role,HtmlDocument document)
+ public static async Task> GetRunesAsync(string championId, string championName, GameMode gameMode, Role role,HtmlDocument document)
{
- Rune rune = null;
+ List runes = new List();
HtmlNodeCollection runeToolTips = null;
HtmlDocument runeContainerHtml = new HtmlDocument();
try
{
+ Log("Loading in runes...", LogType.INFO);
await Task.Run(() => {
var runeContainer = document.DocumentNode.SelectSingleNode($"//div[@id='{MetasrcClass.s_Key.Perks}']");
//Console.WriteLine(runeContainer.InnerHtml); // Debug
@@ -93,12 +95,12 @@ await Task.Run(() => {
runeContainerHtml.LoadHtml(runeContainer.InnerHtml);
if (string.IsNullOrEmpty(runeContainerHtml.DocumentNode.InnerHtml))
- File.Delete(DataPath(championId, gameMode, role));
+ File.Delete(DataPath(championId, gameMode, role, Provider.METAsrc));
runeToolTips = runeContainerHtml.DocumentNode.SelectNodes($"//div[@class='{MetasrcClass.s_Key.TipRB}']");
});
- if (runeToolTips.Count == 0) return rune;
+ if (runeToolTips.Count == 0) throw new Exception();
var runeIds = new List();
foreach (var runeToolTip in runeToolTips)
@@ -106,9 +108,9 @@ await Task.Run(() => {
.Replace(MetasrcClass.s_Key.RepRB, string.Empty)));
foreach (var runeId in runeIds)
- if (runeId == 0) return rune;
+ if (runeId == 0) throw new Exception();
- rune = new Rune()
+ var rune = new Rune()
{
Name = string.Format("METAsrc: {0} {1}", championName, role != Role.RECOMENDED ? $"[{role}]" : string.Empty),
PrimaryPath = runeIds[0],
@@ -125,39 +127,45 @@ await Task.Run(() => {
Shard2 = runeIds[9],
Shard3 = runeIds[10],
};
+ runes.Add(rune);
}
catch (Exception)
{
Log("Failed to get rune build", LogType.EROR);
- File.Delete(DataPath(championId, gameMode, role));
+ File.Delete(DataPath(championId, gameMode, role, Provider.METAsrc));
}
- return rune;
+ return runes;
}
- public static async Task GetSpellComboAsync(string championId, GameMode gameMode, Role role, HtmlDocument document)
+ public static async Task> GetSpellCombosAsync(string championId, GameMode gameMode, Role role, HtmlDocument document)
{
- Spell spell = new Spell();
+ List spells = new List();
HtmlDocument spellContainerHtml = new HtmlDocument();
await Task.Run(() => {
try
{
+ Log("Loading in spell combo...", LogType.INFO);
var spellContainer = document.DocumentNode.SelectNodes($"//div[@class='{MetasrcClass.s_Key.Spells}']")[MetasrcClass.s_Key.IndexSP];
if (spellContainer == null || string.IsNullOrEmpty(spellContainer.InnerHtml))
- File.Delete(DataPath(championId, gameMode, role));
+ File.Delete(DataPath(championId, gameMode, role, Provider.METAsrc));
spellContainerHtml.LoadHtml(spellContainer.InnerHtml);
- var Spells = spellContainerHtml.DocumentNode.SelectNodes($"//img[@class='{MetasrcClass.s_Key.ImgSP}']");
- spell.First = Path.GetFileNameWithoutExtension(Spells[MetasrcClass.s_Key.FirstSP].GetAttributeValue(MetasrcClass.s_Key.SrcSP, "value"));
- spell.Second = Path.GetFileNameWithoutExtension(Spells[MetasrcClass.s_Key.SecondSP].GetAttributeValue(MetasrcClass.s_Key.SrcSP, "value"));
+ var spellsImage = spellContainerHtml.DocumentNode.SelectNodes($"//img[@class='{MetasrcClass.s_Key.ImgSP}']");
+
+ var spell = new Spell();
+
+ spell.First = Path.GetFileNameWithoutExtension(spellsImage[MetasrcClass.s_Key.FirstSP].GetAttributeValue(MetasrcClass.s_Key.SrcSP, "value"));
+ spell.Second = Path.GetFileNameWithoutExtension(spellsImage[MetasrcClass.s_Key.SecondSP].GetAttributeValue(MetasrcClass.s_Key.SrcSP, "value"));
+ spells.Add(spell);
}
catch
{
Log("Failed to get spell combo", LogType.EROR);
- File.Delete(DataPath(championId, gameMode, role));
+ File.Delete(DataPath(championId, gameMode, role, Provider.METAsrc));
}
});
- return spell;
+ return spells;
}
public static async Task GetHtmlAsync(string championId, GameMode gameMode, Role role)
@@ -167,96 +175,52 @@ public static async Task GetHtmlAsync(string championId, GameMode gameMo
var roleTemp = role.ToString().ToLower();
var currentRole = roleTemp == "recomended" ? string.Empty : roleTemp;
- string rawHtml = string.Empty;
- string decodedHtml = string.Empty;
-
- const int maxLength = 5;
+ var rawHtml = string.Empty;
+ var decodedHtml = string.Empty;
championId = championId.ToLower();
Log("Fetching Html...", LogType.INFO);
- string version = GlobalConfig.s_LatestPatch ? s_Versions[0] : s_Versions[1];
+ var lolPatch = GlobalConfig.s_LatestPatch ? GetPatchMM(0) : GetPatchMM(1);
- if (version.Length > maxLength)
- version = version.Substring(0, maxLength);
+ string url = null;
switch (gameMode)
{
case GameMode.ARAM:
- rawHtml = await WebEx.RunDownloadStringAsync($"{Protocol.HTTPS}www.metasrc.com/aram/{version}/champion/{championId}");
+ url = $"{Protocol.HTTPS}www.metasrc.com/aram/{lolPatch}/champion/{championId}";
break;
case GameMode.URF:
- rawHtml = await WebEx.RunDownloadStringAsync($"{Protocol.HTTPS}www.metasrc.com/urf/champion/{championId}");
+ url = $"{Protocol.HTTPS}www.metasrc.com/urf/champion/{championId}";
break;
case GameMode.ARURF:
case GameMode.CLASSIC:
case GameMode.PRACTICETOOL:
- rawHtml = await WebEx.RunDownloadStringAsync($"{Protocol.HTTPS}www.metasrc.com/5v5/{version}/champion/{championId}/{currentRole}");
+ url = $"{Protocol.HTTPS}www.metasrc.com/5v5/{lolPatch}/champion/{championId}/{currentRole}";
break;
case GameMode.ONEFORALL:
- rawHtml = await WebEx.RunDownloadStringAsync($"{Protocol.HTTPS}www.metasrc.com/ofa/champion/{championId}");
+ url = $"{Protocol.HTTPS}www.metasrc.com/ofa/champion/{championId}";
break;
case GameMode.ULTBOOK:
- rawHtml = await WebEx.RunDownloadStringAsync($"{Protocol.HTTPS}www.metasrc.com/ultbook/champion/{championId}");
+ url = $"{Protocol.HTTPS}www.metasrc.com/ultbook/champion/{championId}";
break;
}
+
+ rawHtml = url != null ? await WebEx.RunDownloadStringAsync(url) : throw new Exception();
+
decodedHtml = HttpUtility.HtmlDecode(rawHtml);
return decodedHtml;
}
catch (WebException webEx)
{
Log(webEx.Message, LogType.EROR);
- return null;
}
- }
-
- public static bool IsBuildFileValid(string championId, GameMode gameMode, Role role)
- {
- Log("Checking for build file...", LogType.INFO);
-
- string json;
- string filePath = DataPath(championId, gameMode, role);
-
- if (!GlobalConfig.s_Caching || !File.Exists(filePath))
- return false;
-
- using (var stream = new StreamReader(filePath)) { json = stream.ReadToEnd(); }
-
- if (string.IsNullOrEmpty(json))
- return false;
-
- try
+ catch
{
- var championBuild = JsonConvert.DeserializeObject(json);
-
- if (championBuild.Rune == null) return false;
-
- if (string.IsNullOrEmpty(championBuild.Spell.First)
- && string.IsNullOrEmpty(championBuild.Spell.Second))
- return false;
+ Log("NULL URL",LogType.EROR);
}
- catch { return false; }
-
- return true;
- }
-
- public static string DataPath(string championId, GameMode gameMode, Role role)
- {
- int maxLength = 5;
-
- string version = GlobalConfig.s_LatestPatch ? s_Versions[0] : s_Versions[1];
-
- if (version.Length > maxLength)
- version = version.Substring(0, maxLength);
-
- string dir = Path.Combine(ChampionFolder(championId), version);
- Directory.CreateDirectory(dir);
-
- if(role != Role.RECOMENDED)
- return Path.Combine(dir, $"METAsrc-{championId} {gameMode} {role}.json");
- else
- return Path.Combine(dir, $"METAsrc-{championId} {gameMode}.json");
+ return null;
}
}
}
diff --git a/LoLA/LoLA/Networking/WebWrapper/DataProviders/UGG/UGGWrapper-Rokuazery.cs b/LoLA/LoLA/Networking/WebWrapper/DataProviders/UGG/UGGWrapper-Rokuazery.cs
new file mode 100644
index 0000000..44fed68
--- /dev/null
+++ b/LoLA/LoLA/Networking/WebWrapper/DataProviders/UGG/UGGWrapper-Rokuazery.cs
@@ -0,0 +1,226 @@
+using static LoLA.Networking.WebWrapper.DataDragon.DataDragonWrapper;
+using LoLA.Networking.WebWrapper.DataProviders.METAsrc;
+using static LoLA.Utils.Logger.LogService;
+using LoLA.Networking.Extensions;
+using LoLA.Networking.LCU.Enums;
+using System.Threading.Tasks;
+using Newtonsoft.Json.Linq;
+using LoLA.Utils.Logger;
+using LoLA.Data.Enums;
+using Newtonsoft.Json;
+using System.Linq;
+using LoLA.Utils;
+using LoLA.Data;
+using System.IO;
+
+namespace LoLA.Networking.WebWrapper.DataProviders.UGG
+{
+ public static class UGGWrapper
+ {
+ private const string UGG_API_VERSION = "1.1";
+ private const string UGG_LOL_VERSION = "12_12";
+ private const string UGG_OVERVIEW_VERSION = "1.5.0";
+ private const string UGG_API_URL = "stats2.u.gg/lol/";
+
+ private const int OVERVIEW_WORLD = 12;
+ private const int OVERVIEW_PLATINUM_PLUS = 10;
+
+ private static string getLoLVersion()
+ {
+ // Hello Roku
+
+ return null;
+ }
+
+
+ private static string getOverviewUrl(string championKey, GameMode gameMode)
+ {
+ string gameModeUrlPath = string.Empty;
+
+ switch (gameMode)
+ {
+ case GameMode.PRACTICETOOL:
+ case GameMode.CLASSIC:
+ gameModeUrlPath = "ranked_solo_5x5";
+ break;
+ case GameMode.ARAM:
+ gameModeUrlPath = "normal_aram";
+ break;
+ }
+
+ var apiUrl = $"{Protocol.HTTPS}{UGG_API_URL}{UGG_API_VERSION}/overview/{UGG_LOL_VERSION}/{gameModeUrlPath}/{championKey}/{UGG_OVERVIEW_VERSION}.json";
+
+ return apiUrl;
+ }
+
+ public static async Task FetchDataAsync(string championId, GameMode gameMode, Role role = Role.RECOMENDED)
+ {
+ ChampionBuild championBuild = new ChampionBuild();
+ var championData = s_Champions.Data[championId];
+ var jsonContent = string.Empty;
+
+ var filePath = DataPath(championId, gameMode, role);
+ if (IsBuildFileValid(championId, gameMode, role))
+ {
+ Log($"Loading in {Misc.FixedName(championId)} build data from {Provider.UGG}...", LogType.INFO);
+ using (var stream = new StreamReader(filePath)) { jsonContent = stream.ReadToEnd(); }
+ championBuild = JsonConvert.DeserializeObject(jsonContent);
+ }
+ else
+ {
+ Log($"Downloading {Misc.FixedName(championId)} build data from {Provider.UGG}...", LogType.INFO);
+
+ var championJObject = await GetChampionDataAsync(championData.key, gameMode);
+
+ if (championJObject != null)
+ {
+ championBuild.Id = championData.id;
+ championBuild.Name = championData.name;
+ championBuild.Rune = GetRune(championData.name, role, championJObject);
+ championBuild.Spell = GetSpellCombo(role, championJObject);
+
+ jsonContent = JsonConvert.SerializeObject(championBuild);
+
+ if (!File.Exists(filePath))
+ File.Create(filePath).Dispose();
+
+ using var stream = new StreamWriter(filePath);
+ stream.Write(jsonContent);
+ }
+ else
+ {
+ Log("JObject [0] NULL", LogType.WARN);
+ return null;
+ }
+ }
+
+ Log("Build data fetched successfully", LogType.INFO);
+ return championBuild;
+ }
+
+ public static async Task GetChampionDataAsync(string championKey, GameMode gameMode)
+ {
+ var rawDataObject = await WebEx.DlDe(getOverviewUrl(championKey, gameMode));
+ var championJObject = (JObject)rawDataObject[OVERVIEW_WORLD.ToString()][OVERVIEW_PLATINUM_PLUS.ToString()];
+ return championJObject;
+ }
+
+ public static Role[] GetPossibleRoles(JObject jObject)
+ {
+ JToken championData = jObject;
+ int totalGames = championData.Sum(o => ((JProperty)o).Value[0][0][0].ToObject());
+
+ //Only count positions that make up for more than 10% of the champion's total played games
+ return championData
+ .Cast()
+ .Select((o, i) => o.Value[0][0][0].ToObject() / totalGames > 0.1f ? ((Role)i + 1) : Role.RECOMENDED)
+ .Where(r => r != Role.RECOMENDED)
+ .ToArray();
+ }
+
+ public static Rune GetRune(string championName, Role role, JObject jObject)
+ {
+ Rune rune = new Rune();
+ var championData = jObject;
+
+ var roleTemp = role;
+
+ if (role == Role.RECOMENDED)
+ role = GetPossibleRoles(jObject)[0];
+
+ var root = championData[((int)role).ToString()].First();
+ var perksRoot = root.First();
+ var shardsRoot = root[8][2];
+
+ int primaryPath = perksRoot[2].ToObject();
+ int secondaryPath = perksRoot[3].ToObject();
+ int[] runeIds = perksRoot[4].Select(p => p.ToObject()) // perks
+ .Concat(shardsRoot.Select(s => int.Parse(s.ToString()))) // shards
+ .ToArray();
+
+ rune = new Rune()
+ {
+ Name = string.Format("U.GG: {0} {1}", championName, roleTemp != Role.RECOMENDED ? $"[{role}]" : string.Empty),
+ PrimaryPath = primaryPath,
+ Keystone = runeIds[0],
+ Slot1 = runeIds[1],
+ Slot2 = runeIds[2],
+ Slot3 = runeIds[3],
+
+ SecondaryPath = secondaryPath,
+ Slot4 = runeIds[4],
+ Slot5 = runeIds[5],
+
+ Shard1 = runeIds[6],
+ Shard2 = runeIds[7],
+ Shard3 = runeIds[8],
+ };
+
+ return rune;
+ }
+
+ public static Spell GetSpellCombo(Role role, JObject jObject)
+ {
+ var spell = new Spell();
+ var championData = jObject;
+
+ if (role == Role.RECOMENDED)
+ role = GetPossibleRoles(jObject)[0];
+
+ var root = championData[((int)role).ToString()].First();
+ var spells = root[1][2];
+ spell.First = DataConverter.SpellKeyToSpellId(spells[0].ToObject());
+ spell.Second = DataConverter.SpellKeyToSpellId(spells[1].ToObject());
+
+ return spell;
+ }
+
+ public static bool IsBuildFileValid(string championId, GameMode gameMode, Role role)
+ {
+ Log("Checking for build file...", LogType.INFO);
+
+ string json;
+ string filePath = DataPath(championId, gameMode, role);
+
+ if (!GlobalConfig.s_Caching || !File.Exists(filePath))
+ return false;
+
+ using (var stream = new StreamReader(filePath)) { json = stream.ReadToEnd(); }
+
+ if (string.IsNullOrEmpty(json))
+ return false;
+
+ try
+ {
+ var championBuild = JsonConvert.DeserializeObject(json);
+
+ if (championBuild.Rune == null) return false;
+
+ if (string.IsNullOrEmpty(championBuild.Spell.First)
+ && string.IsNullOrEmpty(championBuild.Spell.Second))
+ return false;
+ }
+ catch { return false; }
+
+ return true;
+ }
+
+ public static string DataPath(string championId, GameMode gameMode, Role role)
+ {
+ int maxLength = 5;
+
+ string version = GlobalConfig.s_LatestPatch ? s_Versions[0] : s_Versions[1];
+
+ if (version.Length > maxLength)
+ version = version.Substring(0, maxLength);
+
+ string dir = Path.Combine(ChampionFolder(championId), version);
+ Directory.CreateDirectory(dir);
+
+ if (role != Role.RECOMENDED)
+ return Path.Combine(dir, $"UGG-{championId} {gameMode} {role}.json");
+ else
+ return Path.Combine(dir, $"UGG-{championId} {gameMode}.json");
+ }
+ }
+}
diff --git a/LoLA/LoLA/Networking/WebWrapper/DataProviders/UGG/UGGWrapper.cs b/LoLA/LoLA/Networking/WebWrapper/DataProviders/UGG/UGGWrapper.cs
index 63f7542..681bc6e 100644
--- a/LoLA/LoLA/Networking/WebWrapper/DataProviders/UGG/UGGWrapper.cs
+++ b/LoLA/LoLA/Networking/WebWrapper/DataProviders/UGG/UGGWrapper.cs
@@ -1,6 +1,7 @@
using static LoLA.Networking.WebWrapper.DataDragon.DataDragonWrapper;
-using LoLA.Networking.WebWrapper.DataProviders.METAsrc;
+using static LoLA.Networking.WebWrapper.DataProviders.Utils.Helper;
using static LoLA.Utils.Logger.LogService;
+using System.Collections.Generic;
using LoLA.Networking.Extensions;
using LoLA.Networking.LCU.Enums;
using System.Threading.Tasks;
@@ -12,18 +13,22 @@
using LoLA.Utils;
using LoLA.Data;
using System.IO;
+using System;
namespace LoLA.Networking.WebWrapper.DataProviders.UGG
{
public static class UGGWrapper
{
- private const string UGG_API_VERSION = "1.1";
- private const string UGG_LOL_VERSION = "12_12";
+ private const string UGG_API_VERSION = "1.5";
private const string UGG_OVERVIEW_VERSION = "1.5.0";
private const string UGG_API_URL = "stats2.u.gg/lol/";
private const int OVERVIEW_WORLD = 12;
private const int OVERVIEW_PLATINUM_PLUS = 10;
+
+ private static string getCurrentPatch()
+ => GetPatchMM().Replace('.', '_');
+
private static string getOverviewUrl(string championKey, GameMode gameMode)
{
string gameModeUrlPath = string.Empty;
@@ -39,19 +44,22 @@ private static string getOverviewUrl(string championKey, GameMode gameMode)
break;
}
- var apiUrl = $"{Protocol.HTTPS}{UGG_API_URL}{UGG_API_VERSION}/overview/{UGG_LOL_VERSION}/{gameModeUrlPath}/{championKey}/{UGG_OVERVIEW_VERSION}.json";
-
+ var apiUrl = $"{Protocol.HTTPS}{UGG_API_URL}{UGG_API_VERSION}/overview/{getCurrentPatch()}/{gameModeUrlPath}/{championKey}/{UGG_OVERVIEW_VERSION}.json";
+
+ #if DEBUG
+ Console.WriteLine(apiUrl);
+ #endif
return apiUrl;
}
- public static async Task FetchDataAsync(string championId, GameMode gameMode, Role role = Role.RECOMENDED)
+ public static async Task FetchDataAsync(string championId, GameMode gameMode, Role role = Role.RECOMENDED, int index = -1)
{
ChampionBuild championBuild = new ChampionBuild();
var championData = s_Champions.Data[championId];
var jsonContent = string.Empty;
- var filePath = DataPath(championId, gameMode, role);
- if (IsBuildFileValid(championId, gameMode, role))
+ var filePath = DataPath(championId, gameMode, role, Provider.UGG);
+ if (IsBuildFileValid(championId, gameMode, role, Provider.UGG))
{
Log($"Loading in {Misc.FixedName(championId)} build data from {Provider.UGG}...", LogType.INFO);
using (var stream = new StreamReader(filePath)) { jsonContent = stream.ReadToEnd(); }
@@ -60,15 +68,14 @@ public static async Task FetchDataAsync(string championId, GameMo
else
{
Log($"Downloading {Misc.FixedName(championId)} build data from {Provider.UGG}...", LogType.INFO);
-
var championJObject = await GetChampionDataAsync(championData.key, gameMode);
if (championJObject != null)
{
championBuild.Id = championData.id;
championBuild.Name = championData.name;
- championBuild.Rune = GetRune(championData.name, role, championJObject);
- championBuild.Spell = GetSpellCombo(role, championJObject);
+ championBuild.Runes = GetRunes(championData.name, gameMode, role, championJObject);
+ championBuild.Spells = GetSpellCombos(gameMode, role, championJObject);
jsonContent = JsonConvert.SerializeObject(championBuild);
@@ -89,11 +96,15 @@ public static async Task FetchDataAsync(string championId, GameMo
return championBuild;
}
- public static async Task GetChampionDataAsync(string championKey, GameMode gameMode)
+ public static async Task GetChampionDataAsync(string championKey, GameMode gm)
{
- var rawDataObject = await WebEx.DlDe(getOverviewUrl(championKey, gameMode));
- var championJObject = (JObject)rawDataObject[OVERVIEW_WORLD.ToString()][OVERVIEW_PLATINUM_PLUS.ToString()];
- return championJObject;
+ var rawDataObject = await WebEx.DlDe(getOverviewUrl(championKey, gm));
+ if (gm != GameMode.ARAM)
+ {
+ var championJObject = (JObject)rawDataObject[OVERVIEW_WORLD.ToString()][OVERVIEW_PLATINUM_PLUS.ToString()];
+ return championJObject;
+ }
+ return rawDataObject;
}
public static Role[] GetPossibleRoles(JObject jObject)
@@ -109,109 +120,250 @@ public static Role[] GetPossibleRoles(JObject jObject)
.ToArray();
}
- public static Rune GetRune(string championName, Role role, JObject jObject)
+ public static List GetRunes(string championName, GameMode gm, Role role, JObject championData)
{
- Rune rune = new Rune();
- var championData = jObject;
+ Log("Loading in runes", LogType.INFO);
+ List runes = new List();
- var roleTemp = role;
+ if (gm != GameMode.ARAM)
+ {
+ var roleTemp = role;
- if (role == Role.RECOMENDED)
- role = GetPossibleRoles(jObject)[0];
+ if (role == Role.RECOMENDED)
+ role = GetPossibleRoles(championData)[0];
- var root = championData[((int)role).ToString()].First();
- var perksRoot = root.First();
- var shardsRoot = root[8][2];
+ var root = championData[((int)role).ToString()].First();
+ var rune = filterRune(root, $"U.GG: {championName} {(roleTemp != Role.RECOMENDED ? $"[{role}]" : string.Empty)}");
+ runes.Add(rune);
+ }
+ else
+ {
+ List tokens = new List();
+ foreach (var item in championData.Children())
+ item.ToList().ForEach(i => tokens.Add(i["8"]["6"]));
- int primaryPath = perksRoot[2].ToObject();
- int secondaryPath = perksRoot[3].ToObject();
- int[] runeIds = perksRoot[4].Select(p => p.ToObject()) // perks
- .Concat(shardsRoot.Select(s => int.Parse(s.ToString()))) // shards
- .ToArray();
+ int runeIndex = 0;
- rune = new Rune()
- {
- Name = string.Format("U.GG: {0} {1}", championName, roleTemp != Role.RECOMENDED ? $"[{role}]" : string.Empty),
- PrimaryPath = primaryPath,
- Keystone = runeIds[0],
- Slot1 = runeIds[1],
- Slot2 = runeIds[2],
- Slot3 = runeIds[3],
-
- SecondaryPath = secondaryPath,
- Slot4 = runeIds[4],
- Slot5 = runeIds[5],
-
- Shard1 = runeIds[6],
- Shard2 = runeIds[7],
- Shard3 = runeIds[8],
- };
-
- return rune;
+ foreach (var token in tokens)
+ {
+ var root = token.First();
+ var runeTemp = filterRune(root, $"U.GG: {championName} ARAM[{runeIndex}]");
+
+ runes.Add(runeTemp);
+ runeIndex++;
+ }
+
+ if (runes.Count == 0)
+ {
+ Log("Runes [0] NULL", LogType.WARN);
+ return null;
+ }
+ }
+ return runes;
}
- public static Spell GetSpellCombo(Role role, JObject jObject)
+ private static Rune filterRune(JToken root, string runeName)
{
- var spell = new Spell();
- var championData = jObject;
+ Log("Filtering rune...", LogType.INFO);
+ try
+ {
+ var rune = new Rune();
- if (role == Role.RECOMENDED)
- role = GetPossibleRoles(jObject)[0];
+ var perksRoot = root.First();
+ var shardsRoot = root[8][2];
- var root = championData[((int)role).ToString()].First();
- var spells = root[1][2];
- spell.First = DataConverter.SpellKeyToSpellId(spells[0].ToObject());
- spell.Second = DataConverter.SpellKeyToSpellId(spells[1].ToObject());
+ var primaryPath = perksRoot[2].ToObject();
+ var secondaryPath = perksRoot[3].ToObject();
+ var runeIds = perksRoot[4].Select(p => p.ToObject()) // perks
+ .Concat(shardsRoot.Select(s => int.Parse(s.ToString()))) // shards
+ .ToArray();
- return spell;
- }
+ rune.Name = runeName;
+ rune.PrimaryPath = primaryPath;
+ rune.Keystone = runeIds[0];
- public static bool IsBuildFileValid(string championId, GameMode gameMode, Role role)
- {
- Log("Checking for build file...", LogType.INFO);
+ var primaryPerks = s_Perks.Where(p => p.id == rune.PrimaryPath).ToList();
- string json;
- string filePath = DataPath(championId, gameMode, role);
+ int[] primaryPerksFound = new int[2];
+ int primaryPerkSlot = 1;
- if (!GlobalConfig.s_Caching || !File.Exists(filePath))
- return false;
+ // For some reason with the new API version of U.GG they randomize the index for the runeIds or I just don't know what's happening
+ // Wonky way to fix
+ for (int i = 0; i < 3; i++)
+ {
+ bool isFound = false;
+ foreach (var path in primaryPerks)
+ {
+ if (isFound) break;
+ foreach (var runeInfo in path.slots[primaryPerkSlot].runes)
+ {
+ if (isFound) break;
+ foreach (var runeId in runeIds)
+ {
+ if (runeId == runeInfo.id)
+ {
+ isFound = true;
+ if (primaryPerkSlot == 1)
+ {
+ rune.Slot1 = runeId;
+ primaryPerkSlot++;
+ break;
+ }
+
+ if(primaryPerkSlot == 2)
+ {
+ rune.Slot2 = runeId;
+ primaryPerkSlot++;
+ break;
+ }
+
+ if (primaryPerkSlot == 3)
+ {
+ rune.Slot3 = runeId;
+ primaryPerkSlot++;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
- using (var stream = new StreamReader(filePath)) { json = stream.ReadToEnd(); }
+ rune.SecondaryPath = secondaryPath;
+ var secondaryPerks = s_Perks.Where(p => p.id == rune.SecondaryPath).ToList();
- if (string.IsNullOrEmpty(json))
- return false;
+ int secondaryPerkFound = 0;
+ int tempSecondaryPerkFound = 0;
- try
- {
- var championBuild = JsonConvert.DeserializeObject(json);
+ foreach (var path in secondaryPerks)
+ {
+ foreach (var slot in path.slots)
+ {
+ foreach (var runeInfo in slot.runes)
+ {
+ foreach (var runeId in runeIds)
+ {
+ if(runeId == runeInfo.id && runeId != tempSecondaryPerkFound)
+ {
+ if(secondaryPerkFound == 0)
+ {
+ //Console.WriteLine($"First Found: {runeId}");
+ tempSecondaryPerkFound = runeId;
+ rune.Slot4 = runeId;
+ secondaryPerkFound++;
+ continue;
+ }
+
+ if(secondaryPerkFound == 1)
+ {
+ //Console.WriteLine($"Second Found: {runeId}");
+ rune.Slot5 = runeId;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
- if (championBuild.Rune == null) return false;
+ rune.Shard1 = runeIds[6];
+ rune.Shard2 = runeIds[7];
+ rune.Shard3 = runeIds[8];
- if (string.IsNullOrEmpty(championBuild.Spell.First)
- && string.IsNullOrEmpty(championBuild.Spell.Second))
- return false;
+ return rune;
+ }
+ catch
+ {
+ Log("Failed to filter rune", LogType.EROR);
+ Environment.Exit(0);
+ return null;
}
- catch { return false; }
-
- return true;
}
- public static string DataPath(string championId, GameMode gameMode, Role role)
+ //private static Rune filterRune(JToken root, string runeName)
+ //{
+ // Log("Filtering rune...", LogType.INFO);
+ // try
+ // {
+ // var rune = new Rune();
+
+ // var perksRoot = root.First();
+ // var shardsRoot = root[8][2];
+
+ // var primaryPath = perksRoot[2].ToObject();
+ // var secondaryPath = perksRoot[3].ToObject();
+ // var runeIds = perksRoot[4].Select(p => p.ToObject()) // perks
+ // .Concat(shardsRoot.Select(s => int.Parse(s.ToString()))) // shards
+ // .ToArray();
+
+ // rune.Name = runeName;
+ // rune.PrimaryPath = primaryPath;
+ // rune.Keystone = runeIds[0];
+ // rune.Slot1 = runeIds[1];
+ // rune.Slot2 = runeIds[2];
+ // rune.Slot3 = runeIds[3];
+ // rune.SecondaryPath = secondaryPath;
+ // rune.Slot4 = runeIds[4];
+ // rune.Slot5 = runeIds[5];
+ // rune.Shard1 = runeIds[6];
+ // rune.Shard2 = runeIds[7];
+ // rune.Shard3 = runeIds[8];
+
+ // return rune;
+ // }
+ // catch
+ // {
+ // Log("Failed to filter rune", LogType.EROR);
+ // Environment.Exit(0);
+ // return null;
+ // }
+ //}
+
+ public static List GetSpellCombos(GameMode gm, Role role, JObject championData)
{
- int maxLength = 5;
+ Log("Loading in spell combo", LogType.INFO);
+ List spells = new List();
+ if (gm != GameMode.ARAM)
+ {
+ if (role == Role.RECOMENDED)
+ role = GetPossibleRoles(championData)[0];
+
+ var root = championData[((int)role).ToString()].First();
+ var spellRoots = root[1][2];
+
+ var spell = new Spell();
+ spell.First = DataConverter.SpellKeyToSpellId(spellRoots[0].ToObject());
+ spell.Second = DataConverter.SpellKeyToSpellId(spellRoots[1].ToObject());
+ spells.Add(spell);
+ }
+ else
+ {
+ List tokens = new List();
+ foreach (var item in championData.Children())
+ item.ToList().ForEach(i => tokens.Add(i["8"]["6"]));
- string version = GlobalConfig.s_LatestPatch ? s_Versions[0] : s_Versions[1];
- if (version.Length > maxLength)
- version = version.Substring(0, maxLength);
+ foreach (var token in tokens)
+ {
+ var spellTemp = new Spell();
- string dir = Path.Combine(ChampionFolder(championId), version);
- Directory.CreateDirectory(dir);
+ var root = token.First();
+ var spellRoots = root[1][2];
- if (role != Role.RECOMENDED)
- return Path.Combine(dir, $"UGG-{championId} {gameMode} {role}.json");
- else
- return Path.Combine(dir, $"UGG-{championId} {gameMode}.json");
+ spellTemp.First = DataConverter.SpellKeyToSpellId(spellRoots[0].ToObject());
+ spellTemp.Second = DataConverter.SpellKeyToSpellId(spellRoots[1].ToObject());
+
+ spells.Add(spellTemp);
+ }
+
+ if (spells.Count == 0)
+ {
+ Log("Spells [0] NULL", LogType.WARN);
+ return null;
+ }
+ }
+
+ return spells;
}
}
}
diff --git a/LoLA/LoLA/Networking/WebWrapper/DataProviders/Utils/Helper.cs b/LoLA/LoLA/Networking/WebWrapper/DataProviders/Utils/Helper.cs
new file mode 100644
index 0000000..2130b04
--- /dev/null
+++ b/LoLA/LoLA/Networking/WebWrapper/DataProviders/Utils/Helper.cs
@@ -0,0 +1,67 @@
+using static LoLA.Networking.WebWrapper.DataDragon.DataDragonWrapper;
+using static LoLA.Utils.Logger.LogService;
+using LoLA.Networking.LCU.Enums;
+using LoLA.Utils.Logger;
+using Newtonsoft.Json;
+using LoLA.Data.Enums;
+using System.IO;
+using LoLA.Data;
+using System;
+
+namespace LoLA.Networking.WebWrapper.DataProviders.Utils
+{
+ public static class Helper
+ {
+ public static bool IsBuildFileValid(string championId, GameMode gameMode, Role role, Provider provider)
+ {
+ Log("Checking for build file...", LogType.INFO);
+
+ string json;
+ string filePath = DataPath(championId, gameMode, role, provider);
+
+ if (!GlobalConfig.s_Caching || !File.Exists(filePath))
+ return false;
+
+ using (var stream = new StreamReader(filePath)) { json = stream.ReadToEnd(); }
+
+ if (string.IsNullOrEmpty(json))
+ return false;
+
+ try
+ {
+ var championBuild = JsonConvert.DeserializeObject(json);
+
+ foreach (var rune in championBuild.Runes)
+ if (rune == null) return false;
+
+ foreach (var spell in championBuild.Spells)
+ {
+ if (string.IsNullOrEmpty(spell.First)
+ && string.IsNullOrEmpty(spell.Second))
+ return false;
+ }
+ }
+ catch { return false; }
+
+ return true;
+ }
+
+ public static string DataPath(string championId, GameMode gameMode, Role role, Provider provider)
+ {
+ int maxLength = 5;
+
+ string version = GlobalConfig.s_LatestPatch ? s_Patches[0] : s_Patches[1];
+
+ if (version.Length > maxLength)
+ version = version.Substring(0, maxLength);
+
+ string dir = Path.Combine(ChampionFolder(championId), version);
+ Directory.CreateDirectory(dir);
+
+ if (role != Role.RECOMENDED)
+ return Path.Combine(dir, $"{provider}-{championId} {gameMode} {role}.json");
+ else
+ return Path.Combine(dir, $"{provider}-{championId} {gameMode}.json");
+ }
+ }
+}
diff --git a/LoLA/LoLA/Properties/AssemblyInfo.cs b/LoLA/LoLA/Properties/AssemblyInfo.cs
index a6677a3..b462682 100644
--- a/LoLA/LoLA/Properties/AssemblyInfo.cs
+++ b/LoLA/LoLA/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("2.0.0.0")]
-[assembly: AssemblyFileVersion("2.0.0.0")]
+[assembly: AssemblyVersion("2.0.0.2")]
+[assembly: AssemblyFileVersion("2.0.0.2")]
diff --git a/README.md b/README.md
index 39a258e..2298089 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
-LoL Assist
+LoL Assist
-LoL Assist is an automatic Runes & Spells importer for League of Legends with a simple-looking UI & GUI.
+
LoL Assist is an automatic Runes & Spells importer for League of Legends with a simple-looking UI.
Builds are scraped from METAsrc and U.GG , and I'll be adding more options soon or later on.
-Consider giving my project a star to support me. 😄❤️
+Consider giving my project a star to support me and the project. 😄❤️ Download the latest release
Features
-• Auto Import Runes
-• Auto Import Spells
+• Auto import runes
+• Auto import spells
• Real-time rune editor
-• Auto Accept Matchmaking
-• Advanced Runes & Spells Editor
-• Auto Updater
+• Auto accept matchmaking
+• Auto Message (champ select only)
+• Advanced runes & spells editor
+• Auto updater
To do
-Auto chat role (Automatically send your selected role to lobby chat) ❌
+Auto detect roles for ranked ❌
+Items importer ❌
+Korean Builds? ❌
+Rune options (a way to select between best runes) ❌
- LoL Assist Preview
+ LoL Assist Preview (Click to expand)
-
-
-
-
-
Runes & Spells Editor Window
-
+
+
+
+
+ Advanced Runes & Spells Editor Window (Wonky but it works)
+
@@ -62,9 +72,6 @@ This project wouldn't be possible without their tools...
- [@pipe01](https://github.com/pipe01) -> [lcu-event-viewer](https://github.com/pipe01/lcu-event-viewer), [legendary-rune-maker](https://github.com/pipe01/legendary-rune-maker)
- [@Hi-Ray](https://github.com/Hi-Ray), [@MingweiSamuel](https://github.com/MingweiSamuel) -> [LCU Explorer](https://github.com/HextechDocs/lcu-explorer)
-## Authors
-- [@Rokuazery](https://www.youtube.com/watch?v=dQw4w9WgXcQ) <- do not click ( ͡° ͜ʖ ͡°)
-
-## Contributors
+## Helpers / Contributors
- [@ClaraaXD](https://github.com/ClaraaXD)
- [@Besalt1080](https://github.com/BeSalt1080)
diff --git a/Version.txt b/Version.txt
index ac9b26e..ef779f6 100644
--- a/Version.txt
+++ b/Version.txt
@@ -1,2 +1,2 @@
-2.0.0.1
-2.0.0.0
+2.0.0.5
+2.0.0.2
\ No newline at end of file