diff --git a/YPBBT.sln b/YPBBT.sln new file mode 100644 index 0000000..fd090a0 --- /dev/null +++ b/YPBBT.sln @@ -0,0 +1,37 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30002.166 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YPBBT", "YPBBT\YPBBT.csproj", "{2F9BF334-F3B1-4109-9A7A-31488850B97F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + AutoUpdate|Any CPU = AutoUpdate|Any CPU + AutoUpdate|x86 = AutoUpdate|x86 + Debug|Any CPU = Debug|Any CPU + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2F9BF334-F3B1-4109-9A7A-31488850B97F}.AutoUpdate|Any CPU.ActiveCfg = AutoUpdate|Any CPU + {2F9BF334-F3B1-4109-9A7A-31488850B97F}.AutoUpdate|Any CPU.Build.0 = AutoUpdate|Any CPU + {2F9BF334-F3B1-4109-9A7A-31488850B97F}.AutoUpdate|x86.ActiveCfg = Debug|x86 + {2F9BF334-F3B1-4109-9A7A-31488850B97F}.AutoUpdate|x86.Build.0 = Debug|x86 + {2F9BF334-F3B1-4109-9A7A-31488850B97F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2F9BF334-F3B1-4109-9A7A-31488850B97F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2F9BF334-F3B1-4109-9A7A-31488850B97F}.Debug|x86.ActiveCfg = Debug|x86 + {2F9BF334-F3B1-4109-9A7A-31488850B97F}.Debug|x86.Build.0 = Debug|x86 + {2F9BF334-F3B1-4109-9A7A-31488850B97F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2F9BF334-F3B1-4109-9A7A-31488850B97F}.Release|Any CPU.Build.0 = Release|Any CPU + {2F9BF334-F3B1-4109-9A7A-31488850B97F}.Release|x86.ActiveCfg = Release|x86 + {2F9BF334-F3B1-4109-9A7A-31488850B97F}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {5A129F52-B958-4FEE-916D-939C68EE97FA} + EndGlobalSection +EndGlobal diff --git a/YPBBT/App.config b/YPBBT/App.config new file mode 100644 index 0000000..3971c28 --- /dev/null +++ b/YPBBT/App.config @@ -0,0 +1,189 @@ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/YPBBT/App.xaml b/YPBBT/App.xaml new file mode 100644 index 0000000..9592d8d --- /dev/null +++ b/YPBBT/App.xaml @@ -0,0 +1,11 @@ + + + + + + + diff --git a/YPBBT/App.xaml.cs b/YPBBT/App.xaml.cs new file mode 100644 index 0000000..4b25d8d --- /dev/null +++ b/YPBBT/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace YPBBT +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/YPBBT/AutoUpdate.cs b/YPBBT/AutoUpdate.cs new file mode 100644 index 0000000..05d1790 --- /dev/null +++ b/YPBBT/AutoUpdate.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media.Animation; + +namespace YPBBT +{ + public class AutoUpdate + { + DA_MainWindow Public_MainWindow; + public void Check_For_Update(DA_MainWindow mainWindow) + { + Public_MainWindow = mainWindow; + Application.Current.Dispatcher.Invoke((Action)(() => { Public_MainWindow.Processing_Status(false, Public_MainWindow.LanguageCollection[125].ToString()); })); + try + { + HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://raw.githubusercontent.com/kresmes/BDO-Boss-Timer-Discord-Bot-Yuri-Project-/master/Resources/Version"); + HttpWebResponse response = (HttpWebResponse)request.GetResponse(); + + if (response.StatusCode == HttpStatusCode.OK) + { + Stream receiveStream = response.GetResponseStream(); + StreamReader readStream = null; + + if (String.IsNullOrWhiteSpace(response.CharacterSet)) + readStream = new StreamReader(receiveStream); + else + readStream = new StreamReader(receiveStream, Encoding.GetEncoding(response.CharacterSet)); + string data = readStream.ReadToEnd(); + + Public_MainWindow.CurrentVersion = GetStrBetweenTags(data, "[AppVersion]", "[/AppVersion]"); + if (GetStrBetweenTags(readStream.ReadToEnd(), "[TimeTable]", "[/TimeTable]") != "") + { File.WriteAllText(Directory.GetCurrentDirectory() + "/Resources/LYPBBTTT_Origin", GetStrBetweenTags(data, "[TimeTable]", "[/TimeTable]").Trim()); } + if(GetStrBetweenTags(readStream.ReadToEnd(), "[Bosses]", "[/Bosses]") != "") + { File.WriteAllText(Directory.GetCurrentDirectory() + "/Resources/BossesOrigin", GetStrBetweenTags(data, "[Bosses]", "[/Bosses]").Trim()); } + response.Close(); + readStream.Close(); + if(Public_MainWindow.CurrentVersion != Public_MainWindow.AppVersion) + { + string version = Public_MainWindow.CurrentVersion; + using (var client = new WebClient()) + { + if(!Directory.Exists(System.IO.Directory.GetCurrentDirectory() + "/Update")) + { Directory.CreateDirectory(System.IO.Directory.GetCurrentDirectory() + "/Update");} + client.DownloadFile("https://github.com/kresmes/BDO-Boss-Timer-Discord-Bot-Yuri-Project-/releases/download/" + version + "/AutoUpdate.Update", + System.IO.Directory.GetCurrentDirectory() + "/Update/AutoUpdate.Update"); + File.WriteAllText(System.IO.Directory.GetCurrentDirectory() + "/Update/installUpdate", "True"); + Application.Current.Dispatcher.Invoke((Action)(() => { + Public_MainWindow.Processing_Status(true, Public_MainWindow.LanguageCollection[126].ToString()); + Public_MainWindow.AlertNewUpdate(); + Public_MainWindow.appRestartButton.ToolTip = Public_MainWindow.LanguageCollection[146].ToString(); + })); + } + } + else + { + Application.Current.Dispatcher.Invoke((Action)(() => { Public_MainWindow.Processing_Status(true, Public_MainWindow.LanguageCollection[127].ToString()); })); + } + } + } + catch (Exception) { + Public_MainWindow.CurrentVersion = Public_MainWindow.AppVersion; + Application.Current.Dispatcher.Invoke((Action)(() => { Public_MainWindow.Processing_Status(true, Public_MainWindow.LanguageCollection[128].ToString(), true); })); + } + } + public static string GetStrBetweenTags(string value, string startTag, string endTag) + { + if (value.Contains(startTag) && value.Contains(endTag)) + { + int index = value.IndexOf(startTag) + startTag.Length; + return value.Substring(index, value.IndexOf(endTag) - index); + } + else + return null; + } + } +} diff --git a/YPBBT/Completed.png b/YPBBT/Completed.png new file mode 100644 index 0000000..846487a Binary files /dev/null and b/YPBBT/Completed.png differ diff --git a/YPBBT/CurrentVersion b/YPBBT/CurrentVersion new file mode 100644 index 0000000..1de7bcd --- /dev/null +++ b/YPBBT/CurrentVersion @@ -0,0 +1 @@ +2.1a \ No newline at end of file diff --git a/YPBBT/DA_MainWindow.xaml b/YPBBT/DA_MainWindow.xaml new file mode 100644 index 0000000..8a89871 --- /dev/null +++ b/YPBBT/DA_MainWindow.xaml @@ -0,0 +1,2972 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/YPBBT/DA_MainWindow.xaml.cs b/YPBBT/DA_MainWindow.xaml.cs new file mode 100644 index 0000000..39e2049 --- /dev/null +++ b/YPBBT/DA_MainWindow.xaml.cs @@ -0,0 +1,8071 @@ +using CefSharp; +using CefSharp.Wpf; +using Discord; +using Discord.WebSocket; +using Dsafa.WpfColorPicker; +using HtmlAgilityPack; +using System; +using System.Collections.Generic; +using System.Data; +using System.Diagnostics; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Management; +using System.Net; +using System.Runtime.Remoting.Messaging; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Animation; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using System.Windows.Threading; +using YPBBT.Properties; +using Color = Discord.Color; +//using System.Windows.Forms; +using System.Runtime.InteropServices; +using System.Windows.Interop; +using YPBBT_DLL; + + +namespace YPBBT +{ + /// + /// Interaction logic for DA_MainWindow.xaml + /// + /// private System.Windows.Forms.NotifyIcon MyNotifyIcon; + public partial class DA_MainWindow : Window + { + [DllImport("user32.dll", SetLastError = true)] + static extern int GetWindowLong(IntPtr hWnd, int nIndex); + [DllImport("user32.dll")] + static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong); + private const int GWL_EX_STYLE = -20; + private const int WS_EX_APPWINDOW = 0x00040000, WS_EX_TOOLWINDOW = 0x00000080; + + public DA_MainWindow() => InitializeComponent(); + + private System.Windows.Forms.NotifyIcon MyNotifyIcon; + public DiscordSocketClient discord = new DiscordSocketClient(); + public List ProfileCollection = new List(); + public List LanguageCollection = new List(); + List BossesCollection = new List(); + List Origin_BossesCollection = new List(); + List ServersCollection = new List(); + List ChannelsCollection = new List(); + List AlertChannelsCollection = new List(); + List RolesCollection = new List(); + public DataTable TimeTable = new DataTable(); + int MainB; + int PmaxC; + DateTime NBT; + DateTime CBT; + DateTime PBT; + string DefaultLanguage; + ulong ClientID; + public string Token; + public ulong ServerID; + public ulong Main_BotChannel_ID; + string BossSpawnRole; + string NightTimeRole; + string ImperialResetRole; + string BarteringResetRole; + string ImperialTradingResetRole; + int UpdateMesssageInterval; + int SharedDay; + int SharedTime; + DispatcherTimer timer = new DispatcherTimer(); + DispatcherTimer timer1 = new DispatcherTimer(); + public string MOTR; + int startupRS; + int overlayState = 0; + DA_OverlayModWindow omw; + public ulong MainMessageID; + int SaveLatestTimeTable = 0; + public ulong TimtableID = 0; + int intervalMessageUpdate = 0; + public string publicNbossimage; + public string publicbossUrl; + public ulong bossImageID; + public string AppVersion = "3.13b"; + public string CurrentVersion = ""; + string currentbossrole1 = ""; + string currentbossrole2 = ""; + double lastSliderValue; + int lastSelectedSource; + public Discord.Rest.RestUserMessage MainMessage; + int gridview1Row = 0; + int gridview1Column = 0; + public int isposting = 0; + int botuptime = 0; + string BossesListData = ""; + string subcolor = ""; + string maincolor = ""; + string last_HM_Set = ""; + int language_changed = -1; + string ScarletMode_Message = ""; + string Updated_ScarletMode_Message = ""; + int Selectected_boss = -1; + public ulong Alert_BotChannel_ID = 0; + List ScarletMode_CurrentBossROWxColumn = new List { 0, 0 }; + List SelfRollingRolesCollections = new List(); + string SelfRollingSettings = null; + string SelfRolling_LoadedReaction = null; + Discord.Rest.RestUserMessage SelfRolling_MainMessage; + bool SelfRolling_WaitingReaction = false; + Discord.Rest.RestUserMessage SelfRolling_GeTReactionMessage = null; + List SelfRollingMessageRolesCollections = new List(); + int SelfRolling_Messages_ListBox_SelectedIndex = -1; + public DA_MainWindow(int OL) + { + omw = new DA_OverlayModWindow(this); + if (OL == 0) + { + try + { + if (File.Exists(System.IO.Directory.GetCurrentDirectory() + "/debug.log")) + { File.Delete(System.IO.Directory.GetCurrentDirectory() + "/debug.log"); } + } + catch (Exception) { } + } + InitializeComponent(); + AppDomain currentDomain = AppDomain.CurrentDomain; + currentDomain.UnhandledException += new UnhandledExceptionEventHandler(MyHandler); + + if (Settings.Default["MainColor"].ToString() == "") + { + Settings.Default["MainColor"] = "#A028282B"; + Settings.Default.Save(); + maincolor = "#A028282B"; + } + else + { maincolor = Settings.Default["MainColor"].ToString();} + if (Settings.Default["SubColor"].ToString() == "") + { + Settings.Default["SubColor"] = "#FF8B81FC"; + Settings.Default.Save(); + subcolor = "#FF8B81FC"; + } + else + { subcolor = Settings.Default["SubColor"].ToString();} + + var converter = new System.Windows.Media.BrushConverter(); + var brush = (Brush)converter.ConvertFromString(maincolor);//Default #FF28282B + Application.Current.Resources["MainColor"] = brush; + brush = (Brush)converter.ConvertFromString(subcolor);//Default #FF8B81FC + Application.Current.Resources["SubColor"] = brush; + if (Settings.Default["HeaderColor"].ToString() == "") + { + Settings.Default["HeaderColor"] = "#962C2D32"; + Settings.Default.Save(); + converter = new System.Windows.Media.BrushConverter(); + brush = (Brush)converter.ConvertFromString("#962C2D32");//Default #FF28282B + Application.Current.Resources["HeaderColor"] = brush; + } + else + { + converter = new System.Windows.Media.BrushConverter(); + brush = (Brush)converter.ConvertFromString(Settings.Default["HeaderColor"].ToString());//Default #FF28282B + Application.Current.Resources["HeaderColor"] = brush; + } + AddSaveBossNameTextBox.IsEnabled = false; + string fversion = AppVersion; + try { fversion = fversion.Substring(0, fversion.IndexOf(".") + 2); } catch (Exception) { } + mainWindow.Title = "YPBBT " + fversion; + VersionLogoLabel.Content = fversion; + + new Thread(() => + { + Thread.CurrentThread.IsBackground = true; + AutoUpdate AU = new AutoUpdate(); + AU.Check_For_Update(this); + }).Start(); + + SelfRollingSettings = File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/SelfRolling"); + foreach(var RM in GetStrBetweenTags(SelfRollingSettings, "[MessageRoles]", "[/MessageRoles]").Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None)) + { + if (RM != "") + { SelfRollingMessageRolesCollections.Add(RM); } + } + string Origin_BossesList = File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/BossesOrigin"); + string[] Origin_BossListSP = Origin_BossesList.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); + foreach (string boss in Origin_BossListSP) + { Origin_BossesCollection.Add(boss); } + + string finalBosslist = ""; + + if (!File.Exists(System.IO.Directory.GetCurrentDirectory() + "/Resources/DA_Bosses")) + { + string OriginBossesList = File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/BossesOrigin"); + string[] BossListSplited = OriginBossesList.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); + int line = 0; + foreach (string bossdata in BossListSplited) + { + if (line == 0) + { finalBosslist += bossdata; } + else + { finalBosslist += Environment.NewLine + bossdata; } + line++; + } + File.WriteAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/DA_Bosses", finalBosslist); + BossesListData = finalBosslist; + } + if (File.Exists(System.IO.Directory.GetCurrentDirectory() + "/Resources/DA_Bosses") && Settings.Default["OriginBossList"].ToString() != File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/BossesOrigin")) + { + string OriginBossesList = File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/BossesOrigin"); + Settings.Default["OriginBossList"] = OriginBossesList; + Settings.Default.Save(); + string[] BossListSplited = OriginBossesList.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); + + string BossesList = File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/DA_Bosses"); + string[] BossListSP = BossesList.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); + finalBosslist = BossesList; + foreach (string BossData in BossListSP) + { + if (BossData != "") + { + foreach (string BD in BossListSplited) + { + if (BD != "") + { + string[] BDS = BD.Split(','); + string[] bossdataS = BossData.Split(','); + if (bossdataS[0] == BDS[0]) + { + if (bossdataS.Length == 5) + { finalBosslist = finalBosslist.Replace(bossdataS[0] + "," + bossdataS[1] + "," + bossdataS[2] + "," + bossdataS[3] + "," + bossdataS[4], BDS[0] + "," + BDS[1] + "," + BDS[2] + "," + bossdataS[3] + "," + bossdataS[4] + "," + BDS[5]); } + if (bossdataS.Length == 6) + { finalBosslist = finalBosslist.Replace(bossdataS[0] + "," + bossdataS[1] + "," + bossdataS[2] + "," + bossdataS[3] + "," + bossdataS[4] + "," + bossdataS[5], BDS[0] + "," + BDS[1] + "," + BDS[2] + "," + bossdataS[3] + "," + bossdataS[4] + "," + BDS[5]); } + } + } + } + } + } + foreach (string BD in BossListSplited) + { + string[] BDS = BD.Split(','); + if (!BossesList.Contains(BDS[0] + ",")) + { finalBosslist += Environment.NewLine + BD; } + } + File.WriteAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/DA_Bosses", finalBosslist); + BossesListData = finalBosslist; + } + if(!File.Exists(System.IO.Directory.GetCurrentDirectory() + "/Resources/LYPBBTTT")) + { + string Origin_LYPBBTTT_Data = File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/LYPBBTTT_Origin"); + File.WriteAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/LYPBBTTT", Origin_LYPBBTTT_Data); + } + Tab0.Visibility = Visibility.Hidden; + tab1.Visibility = Visibility.Hidden; + tab2.Visibility = Visibility.Hidden; + tab3.Visibility = Visibility.Hidden; + tab4.Visibility = Visibility.Hidden; + tab5.Visibility = Visibility.Hidden; + atc0.Visibility = Visibility.Hidden; + atc1.Visibility = Visibility.Hidden; + atc2.Visibility = Visibility.Hidden; + atc3.Visibility = Visibility.Hidden; + atc4.Visibility = Visibility.Hidden; + estc0.Visibility = Visibility.Hidden; + estc1.Visibility = Visibility.Hidden; + estc2.Visibility = Visibility.Hidden; + TimeTableGrid.Visibility = Visibility.Hidden; + //RemoveBossButton.Visibility = Visibility.Hidden; + Settings.Default["OverlayState"] = "0"; + Settings.Default.Save(); + + if(Settings.Default["AnimatedBackgroundSource"].ToString() == "") + { + Settings.Default["AnimatedBackgroundSource"] = System.IO.Directory.GetCurrentDirectory() + @"\Resources\img\bckg.mp4"; + Settings.Default.Save(); + } + + if (Settings.Default["AnimatedBackgroundCheckbox"].ToString() == "") + { AnimatedBackgroundCheckBox.IsChecked = true; } + if (Settings.Default["AnimatedBackgroundCheckbox"].ToString() == "1") + { AnimatedBackgroundCheckBox.IsChecked = true; } + if (Settings.Default["AnimatedBackgroundCheckbox"].ToString() == "0") + { AnimatedBackgroundCheckBox.IsChecked = false; } + + if(AnimatedBackgroundCheckBox.IsChecked == true) + { + mediaElement.IsEnabled = true; + var bc = new BrushConverter(); + PickAnimatedBackground.Foreground = (Brush)bc.ConvertFrom("#FFC6C6C9"); + PickAnimatedBackground.IsEnabled = true; + mediaElement.Visibility = Visibility.Visible; + mediaElement.LoadedBehavior = MediaState.Play; + mediaElement.Source = new Uri(Settings.Default["AnimatedBackgroundSource"].ToString(), UriKind.Absolute); + } + else + { + mediaElement.IsEnabled = false; + var bc = new BrushConverter(); + PickAnimatedBackground.Foreground = (Brush)bc.ConvertFrom("#FF72727A"); + PickAnimatedBackground.IsEnabled = false; + mediaElement.Visibility = Visibility.Hidden; + } + + if (Settings.Default["BackgroundImageSource"].ToString() == "") + { + Settings.Default["BackgroundImageSource"] = System.IO.Directory.GetCurrentDirectory() + "/Resources/img/bckg.png"; + Settings.Default.Save(); + } + + if (Settings.Default["BackgroundImageCheckbox"].ToString() == "") + { BackgroundImageCheckbox.IsChecked = true; } + if (Settings.Default["BackgroundImageCheckbox"].ToString() == "1") + { BackgroundImageCheckbox.IsChecked = true; } + if (Settings.Default["BackgroundImageCheckbox"].ToString() == "0") + { BackgroundImageCheckbox.IsChecked = false; } + + if (BackgroundImageCheckbox.IsChecked == true) + { + backgImageBox.IsEnabled = true; + var bc = new BrushConverter(); + PickBackgroundImage.Foreground = (Brush)bc.ConvertFrom("#FFC6C6C9"); + PickBackgroundImage.IsEnabled = true; + backgImageBox.Visibility = Visibility.Visible; + try { backgImageBox.Source = new BitmapImage(new Uri(Settings.Default["BackgroundImageSource"].ToString())); } + catch (Exception) { + Settings.Default["BackgroundImageSource"] = System.IO.Directory.GetCurrentDirectory() + "/Resources/img/bckg.png"; + Settings.Default.Save(); + backgImageBox.Source = new BitmapImage(new Uri(Settings.Default["BackgroundImageSource"].ToString())); + } + } + else + { + backgImageBox.IsEnabled = false; + var bc = new BrushConverter(); + PickBackgroundImage.Foreground = (Brush)bc.ConvertFrom("#FF72727A"); + PickBackgroundImage.IsEnabled = true; + backgImageBox.Visibility = Visibility.Hidden; + } + + + + MyNotifyIcon = new System.Windows.Forms.NotifyIcon(); + MyNotifyIcon.Icon = new System.Drawing.Icon( + System.IO.Directory.GetCurrentDirectory() + "/Resources/img/icon.ico"); + MyNotifyIcon.MouseDown += + new System.Windows.Forms.MouseEventHandler + (MyNotifyIcon_MouseDoubleClick); + + timer1.Interval = TimeSpan.FromSeconds(1); + timer1.Tick += timer1_Tick; + + int lastSS = 0; + try { lastSS = int.Parse(Settings.Default["SelectedSource"].ToString()); } catch (Exception) { } + lastSelectedSource = lastSS; + SourceComboBox.Items.Add("LYPBBT"); + SourceComboBox.Items.Add("MMOTIMER"); + //SourceComboBox.Items.Add("BdoBossTimer"); + SourceComboBox.SelectedIndex = lastSS; + + BotHostComboBox.Items.Add("Local"); + BotHostComboBox.Items.Add("polisystems"); + BotHostComboBox.SelectedIndex = 0; + BotHostComboBox.IsEnabled = false; + + LanguageDropBox.Items.Add("Français"); + LanguageDropBox.Items.Add("English"); + LanguageDropBox.Items.Add("Español"); + LanguageDropBox.Items.Add("русский"); + LanguageDropBox.Items.Add("日本人"); + LanguageDropBox.Items.Add("한국어"); + + try { ProfileCollection.Clear(); } catch (Exception) { } + foreach (var pc in File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/DA_Profile").Split('|')) + { ProfileCollection.Add(pc); } + DefaultLanguage = ProfileCollection[0].ToString(); + ClientID = ulong.Parse(ProfileCollection[1].ToString()); + Token = ProfileCollection[2].ToString(); + + ServerID = ulong.Parse(ProfileCollection[3].ToString().Split('{')[1].ToString()); + + Main_BotChannel_ID = ulong.Parse(ProfileCollection[4].ToString().Split('{')[1]); + Alert_BotChannel_ID = ulong.Parse(ProfileCollection[12].ToString().Split('{')[1]); + + BossSpawnRole = ProfileCollection[5].ToString().Split('{')[1].ToString(); + if (BossSpawnRole != "") + { + if (BossSpawnRole != "@everyone" && BossSpawnRole != "@here") + { BossSpawnRole = "<@&" + BossSpawnRole + ">"; } + } + string[] ntr = ProfileCollection[6].ToString().Split('{'); + NightTimeRole = ntr[1].ToString(); + if (NightTimeRole != "") + { + if (NightTimeRole != "@everyone" && NightTimeRole != "@here") + { NightTimeRole = "<@&" + NightTimeRole + ">"; } + } + string[] irr = ProfileCollection[7].ToString().Split('{'); + ImperialResetRole = irr[1].ToString(); + if (ImperialResetRole != "") + { + if (ImperialResetRole != "@everyone" && ImperialResetRole != "@here") + { ImperialResetRole = "<@&" + ImperialResetRole + ">"; } + } + string[] brr = ProfileCollection[10].ToString().Split('{'); + BarteringResetRole = brr[1].ToString(); + if (BarteringResetRole != "") + { + if (BarteringResetRole != "@everyone" && BarteringResetRole != "@here") + { BarteringResetRole = "<@&" + BarteringResetRole + ">"; } + } + string[] itrr = ProfileCollection[11].ToString().Split('{'); + ImperialTradingResetRole = itrr[1].ToString(); + if (ImperialTradingResetRole != "") + { + if (ImperialTradingResetRole != "@everyone" && ImperialTradingResetRole != "@here") + { ImperialTradingResetRole = "<@&" + ImperialTradingResetRole + ">"; } + } + + UpdateMesssageInterval = int.Parse(ProfileCollection[8].ToString()); + //AnouncmentMessageInterval = int.Parse(ProfileCollection[9].ToString()); + + LoadAlarmsSettings(); + LoadDefaultLanguage(); + + + if (Settings.Default["EditSpawnHoursSlider"].ToString() == "") + { + EditSpawnHoursSlider.Value = 0; + Settings.Default["EditSpawnHoursSlider"] = EditSpawnHoursSlider.Value.ToString(); + Settings.Default.Save(); + } + EditSpawnHoursSlider.Value = Int32.Parse(Settings.Default["EditSpawnHoursSlider"].ToString()); + + if (EditSpawnHoursSlider.Value.ToString().Contains("-")) + { EditSpawnHoursLabael1.Content = LanguageCollection[22].ToString()+ " " + EditSpawnHoursSlider.Value; } + else + { EditSpawnHoursLabael1.Content = LanguageCollection[22].ToString() + " +" + EditSpawnHoursSlider.Value; } + if (EditSpawnHoursSlider.Value == 0) + { EditSpawnHoursLabael1.Content = LanguageCollection[22].ToString() + " " + EditSpawnHoursSlider.Value; } + startupRS = 0; + } + public void AlertNewUpdate() + { + var bc = new BrushConverter(); + DoubleAnimation da = new DoubleAnimation(); + da.From = 0.2; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromMilliseconds(1500)); + da.AutoReverse = true; + da.RepeatBehavior = RepeatBehavior.Forever; + appRestartButton.BeginAnimation(OpacityProperty, da); + appRestartButton.Background = (Brush)bc.ConvertFrom(subcolor); + } + private void mainWindow_Activated(object sender, EventArgs e) + { + if (startupRS == 0 && MOTR == null) + { + var bc = new BrushConverter(); + alertbosstabrectangle.Fill = (Brush)bc.ConvertFrom(subcolor); + Homehighlight.Fill = (Brush)bc.ConvertFrom(subcolor); + Timetablehighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + bosslisthighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + SelfRollingHighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + settingshighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + abouthighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + alertnighttabbuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + alertimperialtabbuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + alertbarteringtabbuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + alertimperialresettabbuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + exssoundbuttonrectangle.Fill = (Brush)bc.ConvertFrom(subcolor); + exstimetablebuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + exsalertbuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + AddNewBossButton.Content = LanguageCollection[42].ToString(); + Processing_Status_Grid.Width = 0; + StartPostingButton.IsEnabled = false; + + if(AUTCheckbox.IsChecked == true) + { File.WriteAllText(Directory.GetCurrentDirectory() + "/Resources/LYPBBTTT", File.ReadAllText(Directory.GetCurrentDirectory() + "/Resources/LYPBBTTT_Origin")); } + + new Thread(() => + { + Thread.CurrentThread.IsBackground = true; + Discord_Bot Bot = new Discord_Bot(); + Bot.GetDiscordData(this); + Bot.StartPosting_Cooldown(this); + }).Start(); + startupRS = 1; + string region = Settings.Default["DefaultRegion"].ToString();//get Last Saved Region + if (region == "") + { + region = "NA"; + Settings.Default["DefaultRegion"] = "NA"; + Settings.Default.Save(); + } + MOTR = region; + if (SourceComboBox.SelectedIndex == 0) + { GetLYPBBTTimeTable(); } + if (SourceComboBox.SelectedIndex == 1) + { GetTimeTable(region); }//Get info from Html Code + if (SourceComboBox.SelectedIndex == 2) + { GetUrlSource("https://bdobosstimer.com/?&server=" + region); } + new Thread(() =>//icon bug fix + { + Thread.CurrentThread.IsBackground = true; + Discord_Bot Bot = new Discord_Bot(); + Bot.Missing_Icon_Fix(this); + }).Start(); + } + } + private void LoadDefaultLanguage() + { + LanguageCollection.Clear(); + string lines = File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/Languages/" + DefaultLanguage + "-m"); + string[] Collection = lines.Split('}'); + foreach (string rf in Collection) + { LanguageCollection.Add(rf); } + //MessageBox.Show(LanguageCollection.Count.ToString()); + SourceLabel.Content = LanguageCollection[0].ToString(); + RegionLabel.Content = LanguageCollection[1].ToString(); + BoshostLabel.Content = LanguageCollection[2].ToString(); + BoshostLabel.ToolTip = LanguageCollection[3].ToString(); + BotStatusLabel.Content = LanguageCollection[4].ToString(); + + DiscordBotConnectionStatusLabel.Content = LanguageCollection[5].ToString(); + //LanguageCollection[6].ToString() is "Connecting..." + //LanguageCollection[7].ToString() is "Connection Error!" + //LanguageCollection[8].ToString() is " Connected" + PbossLabel.Content = LanguageCollection[9].ToString(); + CbossLabel.Content = LanguageCollection[10].ToString(); + LbossLabel.Content = LanguageCollection[11].ToString(); + StartPostingButton.ToolTip = LanguageCollection[12].ToString(); + appRestartButton.ToolTip = LanguageCollection[13].ToString(); + ConnectDiscordBotButton.ToolTip = LanguageCollection[14].ToString(); + DisconnectDiscordBot.ToolTip = LanguageCollection[15].ToString(); + AlarmsSettingsLabel.Content = LanguageCollection[16].ToString(); + BsAlarmLabel.Content = LanguageCollection[17].ToString(); + NTAlarmLabel.Content = LanguageCollection[18].ToString(); + IRAlarmLabel.Content = LanguageCollection[19].ToString(); + BRAlarmLabel.Content = LanguageCollection[20].ToString(); + ITRAlarmLabel.Content = LanguageCollection[21].ToString(); + EditSpawnHoursLabael1.Content = LanguageCollection[22].ToString(); + try { EditSpawnHoursSlider.Value = Int32.Parse(Settings.Default["EditSpawnHoursSlider"].ToString()); } catch (Exception) { EditSpawnHoursSlider.Value = 0; } + + if (EditSpawnHoursSlider.Value.ToString().Contains("-")) + { EditSpawnHoursLabael1.Content = LanguageCollection[22].ToString() + " " + EditSpawnHoursSlider.Value; } + else + { EditSpawnHoursLabael1.Content = LanguageCollection[22].ToString() + " +" + EditSpawnHoursSlider.Value; } + if (EditSpawnHoursSlider.Value == 0) + { EditSpawnHoursLabael1.Content = LanguageCollection[22].ToString() + " " + EditSpawnHoursSlider.Value; } + EditSpawnHoursSlider.ToolTip = LanguageCollection[23].ToString(); + + BossSpawnAlarmCheckBox1.Content = LanguageCollection[24].ToString() + "1"; + BossSpawnAlarmCheckBox2.Content = LanguageCollection[24].ToString() + "2"; + BossSpawnAlarmCheckBox3.Content = LanguageCollection[24].ToString() + "3"; + + NightTimeAlarmCheckBox1.Content = LanguageCollection[24].ToString() + "1"; + NightTimeAlarmCheckBox2.Content = LanguageCollection[24].ToString() + "2"; + NightTimeAlarmCheckBox3.Content = LanguageCollection[24].ToString() + "3"; + + ImperialResetCheckBox1.Content = LanguageCollection[24].ToString() + "1"; + ImperialResetCheckBox2.Content = LanguageCollection[24].ToString() + "2"; + ImperialResetCheckBox3.Content = LanguageCollection[24].ToString() + "3"; + + BRAlarmCheckBox1.Content = LanguageCollection[24].ToString() + "1"; + BRAlarmCheckBox2.Content = LanguageCollection[24].ToString() + "2"; + BRAlarmCheckBox3.Content = LanguageCollection[24].ToString() + "3"; + + ITRAlarmCheckBox1.Content = LanguageCollection[24].ToString() + "1"; + ITRAlarmCheckBox2.Content = LanguageCollection[24].ToString() + "2"; + ITRAlarmCheckBox3.Content = LanguageCollection[24].ToString() + "3"; + + //NILabel.Content = LanguageCollection[25].ToString();// Night in: + IRILabel.Content = LanguageCollection[26].ToString(); + Notficationsettingslabel.Content = LanguageCollection[27].ToString(); + BRILabel.Content = LanguageCollection[28].ToString(); + ITRILabel.Content = LanguageCollection[29].ToString(); + + PlaySoundOnLabel.Content = LanguageCollection[30].ToString(); + SoundOptionCheckBox.Content = LanguageCollection[31].ToString(); + NTSoundOptionCheckBox.Content = LanguageCollection[32].ToString(); + IRSoundOptionCheckBox.Content = LanguageCollection[33].ToString(); + BRSoundOptionCheckBox.Content = LanguageCollection[34].ToString(); + ITRSoundOptionCheckBox.Content = LanguageCollection[35].ToString(); + + PostSettingsLabel.Content = LanguageCollection[36].ToString(); + DisplayTimeTableSetting.Content = LanguageCollection[37].ToString(); + + AlertsSettingsLabel.Content = LanguageCollection[38].ToString(); + AlertonhousandminutesCheckBox.Content = LanguageCollection[39].ToString(); + + TimeTableTimeColumnsLabel.Content = LanguageCollection[40].ToString(); + TimeTableBossesLabel.Content = LanguageCollection[41].ToString(); + TimeTableAddColumnButton.Content = LanguageCollection[42].ToString();//Add New + //LanguageCollection[43].ToString() is "Time Table" + + BossListLabel.Content = LanguageCollection[44].ToString(); + BossListBossNameLabel.Content = LanguageCollection[45].ToString(); + BossListBossCustomNameLabel.Content = LanguageCollection[46].ToString(); + DILBLLabel.Content = LanguageCollection[47].ToString(); + AddnewBossTestImgLinkButton.Content = LanguageCollection[48].ToString(); + BossListSpecificRoleForthisBossLabel.Content = LanguageCollection[49].ToString(); + DILBLLabelLocal.Content = LanguageCollection[50].ToString(); + AddnewBossTestImgLinkButtonLocal.Content = LanguageCollection[48].ToString(); + BSLLLabel.Content = LanguageCollection[51].ToString(); + //AddSaveBossButton.Content = LanguageCollection[52].ToString();//Save + RemoveBossButton.Content = LanguageCollection[53].ToString();// Remove + + BossListRestoreDefaultButton.Content = LanguageCollection[54].ToString();// Restore Default + RestoreTimeTableDefaultButton.Content = LanguageCollection[54].ToString(); + + SettingsLabel.Content = LanguageCollection[55].ToString(); + LanguageSLabel.Content = LanguageCollection[56].ToString(); + ClientIDLABEL.Content = LanguageCollection[57].ToString(); + TokenLabel.Content = LanguageCollection[58].ToString(); + ServerIDLAbel.Content = LanguageCollection[59].ToString(); + ChannelIDLabel.Content = LanguageCollection[60].ToString(); + UpdateIntervalLabel.Content = LanguageCollection[61].ToString(); + UTCombobox.ToolTip = LanguageCollection[62].ToString(); + //RMMLabel.Content = LanguageCollection[63].ToString(); + //RMMCombobox.ToolTip = LanguageCollection[64].ToString(); + //SettingsKeepMessagesCheckBox.Content = LanguageCollection[65].ToString(); + OverlayTransparencyLabel.Content = LanguageCollection[66].ToString(); + OverlayTransparencyLabel.ToolTip = LanguageCollection[67].ToString(); + PDRLabel.Content = LanguageCollection[68].ToString(); + BsPRLabel.Content = LanguageCollection[69].ToString(); + NTPRLabel.Content = LanguageCollection[70].ToString(); + IRPRLabel.Content = LanguageCollection[71].ToString(); + BRPRLabel.Content = LanguageCollection[72].ToString(); + ITRPRLabel.Content = LanguageCollection[73].ToString(); + ACMLabel.Content = LanguageCollection[74].ToString(); + BSACM1.Content = LanguageCollection[75].ToString() + "1"; + BSACM2.Content = LanguageCollection[75].ToString() + "2"; + BSACM3.Content = LanguageCollection[75].ToString() + "3"; + //LanguageCollection[76].ToString() is " is Spawning in <00:00:00>" + NTCM1.Content = LanguageCollection[77].ToString() + "1"; + NTCM2.Content = LanguageCollection[77].ToString() + "2"; + NTCM3.Content = LanguageCollection[77].ToString() + "3"; + //LanguageCollection[78].ToString() is "Night time in <00:00:00>" + IRCM1.Content = LanguageCollection[79].ToString() + "1"; + IRCM2.Content = LanguageCollection[79].ToString() + "2"; + IRCM3.Content = LanguageCollection[79].ToString() + "3"; + //LanguageCollection[80].ToString() is "Imperial will Reset in <00:00:00>" + BRCM1.Content = LanguageCollection[81].ToString() + "1"; + BRCM2.Content = LanguageCollection[81].ToString() + "2"; + BRCM3.Content = LanguageCollection[81].ToString() + "3"; + //LanguageCollection[82].ToString() is "Bartering will Reset in <00:00:00>" + ITRCM1.Content = LanguageCollection[83].ToString() + "1"; + ITRCM2.Content = LanguageCollection[83].ToString() + "2"; + ITRCM3.Content = LanguageCollection[83].ToString() + "3"; + //LanguageCollection[84].ToString() is "Imperial Trading will Reset in <00:00:00>" + //LanguageCollection[85].ToString() is "Click Here For Location" + //NSListBox.ToolTip = LanguageCollection[86].ToString(); "Scroll Down For More" + + DisplayImageLinkextBoxLocal.ToolTip = LanguageCollection[87].ToString(); + + BSA1CMTextBox.ToolTip = LanguageCollection[88].ToString(); + BSA2CMTextBox.ToolTip = BSA1CMTextBox.ToolTip; + BSA3CMTextBox.ToolTip = BSA1CMTextBox.ToolTip; + + NTA1CMTextbBox.ToolTip = LanguageCollection[89].ToString(); + NTA2CMTextbBox.ToolTip = NTA1CMTextbBox.ToolTip; + NTA3CMTextbBox.ToolTip = NTA1CMTextbBox.ToolTip; + + IRA1CMTextBox.ToolTip = LanguageCollection[90].ToString(); + IRA2CMTextBox.ToolTip = IRA1CMTextBox.ToolTip; + IRA3CMTextBox.ToolTip = IRA1CMTextBox.ToolTip; + + BRA1CMTextBox.ToolTip = LanguageCollection[91].ToString(); + BRA2CMTextBox.ToolTip = BRA1CMTextBox.ToolTip; + BRA3CMTextBox.ToolTip = BRA1CMTextBox.ToolTip; + + ITRA1CMTextBox.ToolTip = LanguageCollection[92].ToString(); + ITRA2CMTextBox.ToolTip = ITRA1CMTextBox.ToolTip; + ITRA3CMTextBox.ToolTip = ITRA1CMTextBox.ToolTip; + + AboutLabel.Content = LanguageCollection[93].ToString(); + VersionLabel.Content = LanguageCollection[94].ToString(); + AppVersionLabel.Content = AppVersion; + MainColorLabel.Content = LanguageCollection[95].ToString(); + MainColorPick.Content = LanguageCollection[96].ToString(); + SubColorLabel.Content = LanguageCollection[97].ToString(); + SubColorPick.Content = MainColorPick.Content; + ABLabel.Content = LanguageCollection[98].ToString(); + PickAnimatedBackground.Content = LanguageCollection[99].ToString(); + BILabel.Content = LanguageCollection[100].ToString(); + PickBackgroundImage.Content = PickAnimatedBackground.Content; + ResetMainColorButton.Content = LanguageCollection[101].ToString(); + ResetSubColorButton.Content = ResetMainColorButton.Content; + ResetAnimatedBackgroundButton.Content = ResetMainColorButton.Content; + ResetBackgroundImageButton.Content = ResetMainColorButton.Content; + AnimatedBackgroundCheckBox.Content = LanguageCollection[102].ToString(); + BackgroundImageCheckbox.Content = LanguageCollection[103].ToString(); + HrdResetAppButton.Content = LanguageCollection[104].ToString(); + githubbutton.ToolTip = LanguageCollection[105].ToString(); + JoinDiscordButton.ToolTip = LanguageCollection[106].ToString(); + //NILabel.Content = LanguageCollection[107].ToString();// Day in + //LanguageCollection[108].ToString() is "Discord Error" + //LanguageCollection[109].ToString() is "Solution: The bot token is incorrect please make sure u have it the right one" + //LanguageCollection[110].ToString() is "Source Error" + //LanguageCollection[111].ToString() is "Failed to collect Data from source " + Environment.NewLine + Environment.NewLine + "Solution: User Diffrent source" + //LanguageCollection[112].ToString() is "Please enter the correct Token" + //LanguageCollection[113].ToString() is "WARNING" + //LanguageCollection[114].ToString() is "Hard Resting the app well delete all saved Settings and information. are u sure u want to reset the app?" + //LanguageCollection[115].ToString() is "Solution: The bot must have admin permission in order to clean the channel" + //LanguageCollection[116].ToString() is "Solution: Delete all old messages in the channel or create a new empty channel just for the bot" + //LanguageCollection[117].ToString() is "Unknow Error" + //LanguageCollection[118].ToString() is "Solution: There have been problem loading local Resource please contact us on discord and will try our best to help whit the problem" + RemoveTimeTableColumn.Content = LanguageCollection[53].ToString(); + //LanguageCollection[119].ToString() is "Ok" + //LanguageCollection[120].ToString() is "No" + //LanguageCollection[121].ToString() is "Yes" + //LanguageCollection[122].ToString() is "Test Token" + //LanguageCollection[123].ToString() is "Bosses Locations" + //LanguageCollection[124].ToString() is "Server or the channel cannot be None u must select Server and channel in the settings Before Posting" + //LanguageCollection[125].ToString() is "Checking For Updates..." + //LanguageCollection[126].ToString() is "Update is Ready To install." + //LanguageCollection[127].ToString() is "Application is Up-To-Date." + //LanguageCollection[128].ToString() is "Failed to get version" + ScarletModeTimeTableSetting_CheckBox.Content = LanguageCollection[129].ToString();//is "Scarlet Mode" + //LanguageCollection[130].ToString() is "Self Rolling" + SRLabel2RC.Content = LanguageCollection[131].ToString();// is "Rolling Channel:" + SRLabel3.Content = LanguageCollection[132].ToString();// is "Enable Self Rolling:" + SRStartMessageLabel.Content = LanguageCollection[133].ToString();// is "Enable Self Rolling:" + UpdateSelfRollingButton.Content = LanguageCollection[134].ToString();// is "Update" + SRRR5.Content = LanguageCollection[135].ToString();// is "Roles/Reaction with Message:" + SelfRollingAddNewSelfRole_button.Content = LanguageCollection[136].ToString();// is "Add New" + SelfRollingRemoveSelfRole_button.Content = LanguageCollection[137].ToString();// is "Remove" + SRRolesLabel.Content = LanguageCollection[138].ToString();// is "Role:" + SelfRollingInsertRole.Content = LanguageCollection[139].ToString();// is "Insert Role" + SelfRollingInsertEmoji.Content = LanguageCollection[140].ToString();// is "Insert Emoji" + SRReactionLabel.Content = LanguageCollection[141].ToString();// is "Reaction:" + SelfRolling_GetReactionButton.Content = LanguageCollection[142].ToString();// is "Get Emoji" + SREMLabel.Content = LanguageCollection[143].ToString();// is "End Message:" + AlertChannelID.Content = LanguageCollection[144].ToString();// is "Alert Channel ID:" + OALabel.Content = LanguageCollection[145].ToString();// is "Optimize App :" + //LanguageCollection[146].ToString(); is Restart: New Update is ready to install + AUTTLabel.Content = LanguageCollection[147].ToString(); //Auto Update Time Tables: + AUTTLabel.ToolTip = LanguageCollection[148].ToString(); //Auto Update Time Tablesfrom online source + + + if (Settings.Default["BSA1CM"].ToString() == "") + { + BSA1CMTextBox.Text = LanguageCollection[76].ToString(); + } + else + { + BSA1CMTextBox.Text = Settings.Default["BSA1CM"].ToString(); + } + if (Settings.Default["BSA2CM"].ToString() == "") + { + BSA2CMTextBox.Text = LanguageCollection[76].ToString(); + } + else + { + BSA2CMTextBox.Text = Settings.Default["BSA2CM"].ToString(); + } + if (Settings.Default["BSA3CM"].ToString() == "") + { + BSA3CMTextBox.Text = LanguageCollection[76].ToString(); + } + else + { + BSA3CMTextBox.Text = Settings.Default["BSA3CM"].ToString(); + } + + if (Settings.Default["NTA1CM"].ToString() == "") + { + NTA1CMTextbBox.Text = LanguageCollection[78].ToString(); + } + else + { + NTA1CMTextbBox.Text = Settings.Default["NTA1CM"].ToString(); + } + if (Settings.Default["NTA2CM"].ToString() == "") + { + NTA2CMTextbBox.Text = LanguageCollection[78].ToString(); + } + else + { + NTA2CMTextbBox.Text = Settings.Default["NTA2CM"].ToString(); + } + if (Settings.Default["NTA3CM"].ToString() == "") + { + NTA3CMTextbBox.Text = LanguageCollection[78].ToString(); + } + else + { + NTA3CMTextbBox.Text = Settings.Default["NTA3CM"].ToString(); + } + + if (Settings.Default["IRA1CM"].ToString() == "") + { + IRA1CMTextBox.Text = LanguageCollection[80].ToString(); + } + else + { + IRA1CMTextBox.Text = Settings.Default["IRA1CM"].ToString(); + } + if (Settings.Default["IRA2CM"].ToString() == "") + { + IRA2CMTextBox.Text = LanguageCollection[80].ToString(); + } + else + { + IRA2CMTextBox.Text = Settings.Default["IRA2CM"].ToString(); + } + if (Settings.Default["IRA3CM"].ToString() == "") + { + IRA3CMTextBox.Text = LanguageCollection[80].ToString(); + } + else + { + IRA3CMTextBox.Text = Settings.Default["IRA3CM"].ToString(); + } + + if (Settings.Default["BRA1CM"].ToString() == "") + { + BRA1CMTextBox.Text = LanguageCollection[82].ToString(); + } + else + { + BRA1CMTextBox.Text = Settings.Default["BRA1CM"].ToString(); + } + if (Settings.Default["BRA2CM"].ToString() == "") + { + BRA2CMTextBox.Text = LanguageCollection[82].ToString(); + } + else + { + BRA2CMTextBox.Text = Settings.Default["BRA2CM"].ToString(); + } + if (Settings.Default["BRA3CM"].ToString() == "") + { + BRA3CMTextBox.Text = LanguageCollection[82].ToString(); + } + else + { + BRA3CMTextBox.Text = Settings.Default["BRA3CM"].ToString(); + } + + if (Settings.Default["ITRA1CM"].ToString() == "") + { + ITRA1CMTextBox.Text = LanguageCollection[84].ToString(); + } + else + { + ITRA1CMTextBox.Text = Settings.Default["ITRA1CM"].ToString(); + } + if (Settings.Default["ITRA2CM"].ToString() == "") + { + ITRA2CMTextBox.Text = LanguageCollection[84].ToString(); + } + else + { + ITRA2CMTextBox.Text = Settings.Default["ITRA2CM"].ToString(); + } + if (Settings.Default["ITRA3CM"].ToString() == "") + { + ITRA3CMTextBox.Text = LanguageCollection[84].ToString(); + } + else + { + ITRA3CMTextBox.Text = Settings.Default["ITRA3CM"].ToString(); + } + + + } + private void LoadAlarmsSettings() //load Last Saved User Settings + { + if (Settings.Default["BossSpawnAlarmCheckBox"].ToString() == "") + { + BossSpawnAlarm1Textbox.Text = "30"; + BossSpawnAlarmCheckBox1.IsChecked = true; + } + else + { + string[] cbD = Settings.Default["BossSpawnAlarmCheckBox"].ToString().Split(','); + BossSpawnAlarm1Textbox.Text = cbD[0].ToString(); + if (cbD[1].ToString() == "0") + { BossSpawnAlarmCheckBox1.IsChecked = false; } + if (cbD[1].ToString() == "1") + { BossSpawnAlarmCheckBox1.IsChecked = true; } + } + + if (Settings.Default["BossSpawnAlarmCheckBox"].ToString() == "") + { + BossSpawnAlarm2Textbox.Text = "15"; + BossSpawnAlarmCheckBox2.IsChecked = true; + } + else + { + string[] cbD = Settings.Default["BossSpawnAlarmCheckBox"].ToString().Split(','); + BossSpawnAlarm2Textbox.Text = cbD[2].ToString(); + if (cbD[3].ToString() == "0") + { BossSpawnAlarmCheckBox2.IsChecked = false; } + if (cbD[3].ToString() == "1") + { BossSpawnAlarmCheckBox2.IsChecked = true; } + } + + if (Settings.Default["BossSpawnAlarmCheckBox"].ToString() == "") + { + BossSpawnAlarm3Textbox.Text = "05"; + BossSpawnAlarmCheckBox3.IsChecked = true; + } + else + { + string[] cbD = Settings.Default["BossSpawnAlarmCheckBox"].ToString().Split(','); + BossSpawnAlarm3Textbox.Text = cbD[4].ToString(); + if (cbD[5].ToString() == "0") + { BossSpawnAlarmCheckBox3.IsChecked = false; } + if (cbD[5].ToString() == "1") + { BossSpawnAlarmCheckBox3.IsChecked = true; } + } + + if (Settings.Default["NightTimeAlarmCheckBox"].ToString() == "") + { + NightTimeAlarm1Textbox.Text = "30"; + NightTimeAlarmCheckBox1.IsChecked = true; + } + else + { + string[] cbD = Settings.Default["NightTimeAlarmCheckBox"].ToString().Split(','); + NightTimeAlarm1Textbox.Text = cbD[0].ToString(); + if (cbD[1].ToString() == "0") + { NightTimeAlarmCheckBox1.IsChecked = false; } + if (cbD[1].ToString() == "1") + { NightTimeAlarmCheckBox1.IsChecked = true; } + } + + if (Settings.Default["NightTimeAlarmCheckBox"].ToString() == "") + { + NightTimeAlarm2Textbox.Text = "15"; + NightTimeAlarmCheckBox2.IsChecked = true; + } + else + { + string[] cbD = Settings.Default["NightTimeAlarmCheckBox"].ToString().Split(','); + NightTimeAlarm2Textbox.Text = cbD[2].ToString(); + if (cbD[3].ToString() == "0") + { NightTimeAlarmCheckBox2.IsChecked = false; } + if (cbD[3].ToString() == "1") + { NightTimeAlarmCheckBox2.IsChecked = true; } + } + + if (Settings.Default["NightTimeAlarmCheckBox"].ToString() == "") + { + NightTimeAlarm3Textbox.Text = "05"; + NightTimeAlarmCheckBox3.IsChecked = true; + } + else + { + string[] cbD = Settings.Default["NightTimeAlarmCheckBox"].ToString().Split(','); + NightTimeAlarm3Textbox.Text = cbD[4].ToString(); + if (cbD[5].ToString() == "0") + { NightTimeAlarmCheckBox3.IsChecked = false; } + if (cbD[5].ToString() == "1") + { NightTimeAlarmCheckBox3.IsChecked = true; } + } + + if (Settings.Default["ImperialResetCheckBox"].ToString() == "") + { + ImperialResetAlarm1Textbox.Text = "30"; + ImperialResetCheckBox1.IsChecked = true; + } + else + { + string[] cbD = Settings.Default["ImperialResetCheckBox"].ToString().Split(','); + ImperialResetAlarm1Textbox.Text = cbD[0].ToString(); + if (cbD[1].ToString() == "0") + { ImperialResetCheckBox1.IsChecked = false; } + if (cbD[1].ToString() == "1") + { ImperialResetCheckBox1.IsChecked = true; } + } + + if (Settings.Default["ImperialResetCheckBox"].ToString() == "") + { + ImperialResetAlarm2Textbox.Text = "15"; + ImperialResetCheckBox2.IsChecked = true; + } + else + { + string[] cbD = Settings.Default["ImperialResetCheckBox"].ToString().Split(','); + ImperialResetAlarm2Textbox.Text = cbD[2].ToString(); + if (cbD[3].ToString() == "0") + { ImperialResetCheckBox2.IsChecked = false; } + if (cbD[3].ToString() == "1") + { ImperialResetCheckBox2.IsChecked = true; } + } + + if (Settings.Default["ImperialResetCheckBox"].ToString() == "") + { + ImperialResetAlarm3Textbox.Text = "05"; + ImperialResetCheckBox3.IsChecked = true; + } + else + { + string[] cbD = Settings.Default["ImperialResetCheckBox"].ToString().Split(','); + ImperialResetAlarm3Textbox.Text = cbD[4].ToString(); + if (cbD[5].ToString() == "0") + { ImperialResetCheckBox3.IsChecked = false; } + if (cbD[5].ToString() == "1") + { ImperialResetCheckBox3.IsChecked = true; } + } + + if (Settings.Default["PlaySoundSetting"].ToString() == "") + { SoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["PlaySoundSetting"].ToString() == "1") + { SoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["PlaySoundSetting"].ToString() == "0") + { SoundOptionCheckBox.IsChecked = false; } + + if (Settings.Default["NTPlaySoundSetting"].ToString() == "") + { NTSoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["NTPlaySoundSetting"].ToString() == "1") + { NTSoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["NTPlaySoundSetting"].ToString() == "0") + { NTSoundOptionCheckBox.IsChecked = false; } + + if (Settings.Default["IRPlaySoundSetting"].ToString() == "") + { IRSoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["IRPlaySoundSetting"].ToString() == "1") + { IRSoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["IRPlaySoundSetting"].ToString() == "0") + { IRSoundOptionCheckBox.IsChecked = false; } + + if (Settings.Default["BRPlaySoundSetting"].ToString() == "") + { BRSoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["BRPlaySoundSetting"].ToString() == "1") + { BRSoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["BRPlaySoundSetting"].ToString() == "0") + { BRSoundOptionCheckBox.IsChecked = false; } + + if (Settings.Default["ITRPlaySoundSetting"].ToString() == "") + { ITRSoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["ITRPlaySoundSetting"].ToString() == "1") + { ITRSoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["ITRPlaySoundSetting"].ToString() == "0") + { ITRSoundOptionCheckBox.IsChecked = false; } + + if (Settings.Default["DisplayTimeTableSetting"].ToString() == "") + { DisplayTimeTableSetting.IsChecked = true; } + if (Settings.Default["DisplayTimeTableSetting"].ToString() == "1") + { DisplayTimeTableSetting.IsChecked = true; } + if (Settings.Default["DisplayTimeTableSetting"].ToString() == "0") + { DisplayTimeTableSetting.IsChecked = false; } + + if (Settings.Default["OverlayTransparency"].ToString() == "") + { TransparacySlider.Value = 100; } + else { TransparacySlider.Value = double.Parse(Settings.Default["OverlayTransparency"].ToString()); } + + //if (Settings.Default["SettingKeepMessages"].ToString() == "") + //{ + // SettingsKeepMessagesCheckBox.IsChecked = false; + // RMMCombobox.Opacity = 1; + // RMMCombobox.IsEnabled = true; + //} + //if (Settings.Default["SettingKeepMessages"].ToString() == "1") + //{ + // SettingsKeepMessagesCheckBox.IsChecked = true; + // RMMCombobox.Opacity = 0.3; + // RMMCombobox.IsEnabled = false; + //} + //if (Settings.Default["SettingKeepMessages"].ToString() == "0") + //{ + // SettingsKeepMessagesCheckBox.IsChecked = false; + // RMMCombobox.Opacity = 1; + // RMMCombobox.IsEnabled = true; + //} + if (Settings.Default["AlarmonhoursCheckbox"].ToString() == "") + { + AlertonhousandminutesCheckBox.IsChecked = false; + Settings.Default["AlarmonhoursCheckbox"] = "0"; + Settings.Default.Save(); + } + if (Settings.Default["AlarmonhoursCheckbox"].ToString() == "0") + { + AlertonhousandminutesCheckBox.IsChecked = false; + } + if (Settings.Default["AlarmonhoursCheckbox"].ToString() == "1") + { + AlertonhousandminutesCheckBox.IsChecked = true; + } + + if (Settings.Default["BRAlarmCheckBox"].ToString() == "") + { + BRAlarm1Textbox.Text = "30"; + BRAlarmCheckBox1.IsChecked = true; + } + else + { + string[] cbD = Settings.Default["BRAlarmCheckBox"].ToString().Split(','); + BRAlarm1Textbox.Text = cbD[0].ToString(); + if (cbD[1].ToString() == "0") + { BRAlarmCheckBox1.IsChecked = false; } + if (cbD[1].ToString() == "1") + { BRAlarmCheckBox1.IsChecked = true; } + } + + if (Settings.Default["BRAlarmCheckBox"].ToString() == "") + { + BRAlarm2Textbox.Text = "15"; + BRAlarmCheckBox2.IsChecked = true; + } + else + { + string[] cbD = Settings.Default["BRAlarmCheckBox"].ToString().Split(','); + BRAlarm2Textbox.Text = cbD[2].ToString(); + if (cbD[3].ToString() == "0") + { BRAlarmCheckBox2.IsChecked = false; } + if (cbD[3].ToString() == "1") + { BRAlarmCheckBox2.IsChecked = true; } + } + + if (Settings.Default["BRAlarmCheckBox"].ToString() == "") + { + BRAlarm3Textbox.Text = "05"; + BRAlarmCheckBox3.IsChecked = true; + } + else + { + string[] cbD = Settings.Default["BRAlarmCheckBox"].ToString().Split(','); + BRAlarm3Textbox.Text = cbD[4].ToString(); + if (cbD[5].ToString() == "0") + { BRAlarmCheckBox3.IsChecked = false; } + if (cbD[5].ToString() == "1") + { BRAlarmCheckBox3.IsChecked = true; } + } + + + + if (Settings.Default["ITRAlarmCheckBox"].ToString() == "") + { + ITRAlarm1Textbox.Text = "30"; + ITRAlarmCheckBox1.IsChecked = true; + } + else + { + string[] cbD = Settings.Default["ITRAlarmCheckBox"].ToString().Split(','); + ITRAlarm1Textbox.Text = cbD[0].ToString(); + if (cbD[1].ToString() == "0") + { ITRAlarmCheckBox1.IsChecked = false; } + if (cbD[1].ToString() == "1") + { ITRAlarmCheckBox1.IsChecked = true; } + } + + if (Settings.Default["ITRAlarmCheckBox"].ToString() == "") + { + ITRAlarm2Textbox.Text = "15"; + ITRAlarmCheckBox2.IsChecked = true; + } + else + { + string[] cbD = Settings.Default["ITRAlarmCheckBox"].ToString().Split(','); + ITRAlarm2Textbox.Text = cbD[2].ToString(); + if (cbD[3].ToString() == "0") + { ITRAlarmCheckBox2.IsChecked = false; } + if (cbD[3].ToString() == "1") + { ITRAlarmCheckBox2.IsChecked = true; } + } + + if (Settings.Default["ITRAlarmCheckBox"].ToString() == "") + { + ITRAlarm3Textbox.Text = "05"; + ITRAlarmCheckBox3.IsChecked = true; + } + else + { + string[] cbD = Settings.Default["ITRAlarmCheckBox"].ToString().Split(','); + ITRAlarm3Textbox.Text = cbD[4].ToString(); + if (cbD[5].ToString() == "0") + { ITRAlarmCheckBox3.IsChecked = false; } + if (cbD[5].ToString() == "1") + { ITRAlarmCheckBox3.IsChecked = true; } + } + //High_RenderQuality + if (Settings.Default["High_RenderQuality"].ToString() == "") + { + BitmapScaling(false); + OptimizeAppCheckbox.IsChecked = false; + } + else + { + bool is_Optimized = bool.Parse(Settings.Default["High_RenderQuality"].ToString()); + if(is_Optimized) + { + BitmapScaling(true); + OptimizeAppCheckbox.IsChecked = true; + } + else + { + BitmapScaling(false); + OptimizeAppCheckbox.IsChecked = false; + } + } + if(Settings.Default["ScarletMode"].ToString() == "") + { + ScarletModeTimeTableSetting_CheckBox.IsChecked = true; + Settings.Default["ScarletMode"] = "true"; + Settings.Default.Save(); + } + else + { ScarletModeTimeTableSetting_CheckBox.IsChecked = bool.Parse(Settings.Default["ScarletMode"].ToString()); } + + if (Settings.Default["SelfRolling"].ToString() == "") + { + EnableSelfRollingCheckbox.IsChecked = false; + Settings.Default["SelfRolling"] = "false"; + Settings.Default.Save(); + } + else + { EnableSelfRollingCheckbox.IsChecked = bool.Parse(Settings.Default["SelfRolling"].ToString()); } + if(Settings.Default["AutoUpdateTable"].ToString() == "") + { + AUTCheckbox.IsChecked = true; + Settings.Default["AutoUpdateTable"] = true.ToString(); + Settings.Default.Save(); + } + else + { + AUTCheckbox.IsChecked = bool.Parse(Settings.Default["AutoUpdateTable"].ToString()); + } + } + private async void GetTimeTable(string r)// creat TimeTable and Get Time Logs + { + ScarletModeTimeTableSetting_CheckBox.IsChecked = false; + ScarletModeTimeTableSetting_CheckBox.IsEnabled = false; + Updated_ScarletMode_Message = ""; + ScarletMode_Message = ""; + PreviousBossTimeLabel.ToolTip = ""; + CurrentBossTimeLabel.ToolTip = ""; + NextBossTimeLabel.ToolTip = ""; + currentbossrole1 = ""; + currentbossrole2 = ""; + publicbossUrl = ""; + timer1.Stop(); + MOTR = r; + startupRS = 0; + var html = @"https://mmotimer.com/bdo/?server=" + r; + HtmlWeb web = new HtmlWeb(); + var htmlDoc = new HtmlDocument(); + string[] BossListSplited = File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/DA_Bosses").Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); + try { htmlDoc = web.Load(html); } + catch { + ErrorMessageBox emb = new ErrorMessageBox(LanguageCollection[119].ToString(), LanguageCollection[120].ToString(), LanguageCollection[121].ToString(), LanguageCollection[122].ToString()); + emb.MB_typeOK(LanguageCollection[110].ToString(), LanguageCollection[111].ToString(), this); + emb.Show(); + this.IsEnabled = false; + } + var htmlNodes1 = htmlDoc.DocumentNode.SelectSingleNode("//*[@id='ttab']").InnerText; + var htmlregionDB = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[1]/div[4]/div/div[1]/div").InnerText; + var aftertheNext = htmlDoc.DocumentNode.SelectSingleNode("//*[@id='mainTbl']/tbody/tr[1]/td[2]/span").InnerText; + var pSecondboss = ""; + try { pSecondboss = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[1]/div[1]/div/div[2]/div[1]").InnerText; } catch (Exception) { } + PbossNamLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[1]/div[1]/div/div/div[1]").InnerText; + if (pSecondboss != "") + { PbossNamLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[1]/div[1]/div/div/div[1]").InnerText + " & " + pSecondboss; } + PreviousBossTimeLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[1]/div[1]/div/div/div[2]").InnerText; + var cSecondboss = ""; + try { cSecondboss = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[1]/div[2]/div/div[2]/div[1]").InnerText; } catch (Exception) { } + CbossNameLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[1]/div[2]/div/div[1]/div[1]").InnerText; + if (cSecondboss != "") + { CbossNameLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[1]/div[2]/div/div[1]/div[1]").InnerText + " & " + cSecondboss; } + CurrentBossTimeLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[1]/div[2]/div/div[1]/div[3]").InnerText; + var nSecondboss = ""; + try { nSecondboss = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[1]/div[3]/div/div[2]/div[1]").InnerText; } catch (Exception) { } + NBossNameLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[1]/div[3]/div/div/div[1]").InnerText; + if (nSecondboss != "") + { NBossNameLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[1]/div[3]/div/div/div[1]").InnerText + " & " + nSecondboss; } + NextBossTimeLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[1]/div[3]/div/div/div[3]").InnerText; + try { NightInBdoTimeLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[2]/div[1]/div[1]/span[2]").InnerText; } catch (Exception) { } + try { IRTimeLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[2]/div[2]/div[1]/span").InnerText; } catch (Exception) { } + try { BRTimeLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[2]/div[1]/div[3]/span").InnerText; } catch (Exception) { } + try { ITRITimeLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[2]/div[2]/div[3]/span").InnerText; } catch (Exception) { } + try { NILabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[2]/div[1]/div[1]/span[1]").InnerText; } catch (Exception) { } + + if(NILabel.Content.ToString() == "Day in:") + { NILabel.Content = LanguageCollection[107].ToString(); } + else + { NILabel.Content = LanguageCollection[25].ToString(); } + + RegionComboBox.Items.Clear(); + RegionComboBox.Items.Add("ps4-asia".ToUpper()); + RegionComboBox.Items.Add("eu".ToUpper()); + RegionComboBox.Items.Add("ps4-xbox-eu".ToUpper()); + RegionComboBox.Items.Add("jp".ToUpper()); + RegionComboBox.Items.Add("kr".ToUpper()); + RegionComboBox.Items.Add("mena".ToUpper()); + RegionComboBox.Items.Add("na".ToUpper()); + RegionComboBox.Items.Add("ps4-xbox-na".ToUpper()); + RegionComboBox.Items.Add("ru".ToUpper()); + RegionComboBox.Items.Add("sa".ToUpper()); + RegionComboBox.Items.Add("sea".ToUpper()); + RegionComboBox.Items.Add("th".ToUpper()); + RegionComboBox.Items.Add("tw".ToUpper()); + + RegionComboBox.Text = Settings.Default["DefaultRegion"].ToString().ToUpper(); + + if (RegionComboBox.SelectedIndex == -1) + { RegionComboBox.Text = "NA"; } + #region Load Timetable from online source and arrange it to Local Table + string input = htmlNodes1.Replace(" ", ""); + string[] data = input.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); + try + { + TimeTable.Clear(); + for (int i = TimeTable.Rows.Count - 1; i >= 0; i--) + { + if (TimeTable.Rows[i][0].ToString() == "") + TimeTable.Rows[i].Delete(); + } + foreach (var column in TimeTable.Columns.Cast().ToArray()) + { + if (TimeTable.AsEnumerable().All(dr => dr.IsNull(column))) + TimeTable.Columns.Remove(column); + } + gridview1.ItemsSource = null; + TimeTable.AcceptChanges(); + } + catch (Exception) { } + int Crow = 0; + int Ccolumn = 0; + int MaxColumn = TimeTable.Columns.Count; + foreach (var bit in data) + { + string outpted_bit = bit; + if (bit == "" && TimeTable.Rows.Count == 1 && TimeTable.Columns.Count > 0 && Crow == 0) + { + TimeTable.Rows.Add(new object[] { "" }); + Ccolumn = 0; + Crow++; + } + if (bit != "" && Crow == 0) + { + TimeTable.Columns.Add(Ccolumn.ToString()); + if (Ccolumn == 0) + { TimeTable.Rows.Add(new object[] { "" }); } + DataRow dr = TimeTable.Rows[Crow]; + string bitP = bit; + if (bit.Contains(Environment.NewLine)) + { bitP = bit.Replace(Environment.NewLine, "," + Environment.NewLine); } + dr[Ccolumn] = bitP; + MaxColumn++; + Ccolumn++; + } + outpted_bit = bit; + if (bit == "" && Ccolumn == MaxColumn && TimeTable.Columns.Count > 0) + { + TimeTable.Rows.Add(new object[] { "" }); + Ccolumn = 0; + Crow++; + } + if (bit == "" && TimeTable.Rows.Count > 1 && Ccolumn > 0 && Ccolumn < MaxColumn) + { + DataRow dr = TimeTable.Rows[Crow]; + string bitP = bit; + dr[Ccolumn] = bitP; + Ccolumn++; + } + outpted_bit = bit; + if (bit != "" && TimeTable.Rows.Count > 1 && Ccolumn < MaxColumn) + { + DataRow dr = TimeTable.Rows[Crow]; + string bitP = bit; + string boss_name1 = ""; + string boss_name2 = ""; + foreach (string BossData in BossListSplited) + { + if (BossData != "" && outpted_bit.Contains(BossData.Split(',')[0])) + { + boss_name1 = BossData.Split(',')[0]; + outpted_bit = bit.Replace(BossData.Split(',')[0], ""); + break; + } + } + foreach (string BossData in BossListSplited) + { + if (BossData != "" && outpted_bit.Contains(BossData.Split(',')[0])) + { + boss_name2 = BossData.Split(',')[0]; + outpted_bit = bit.Replace(BossData.Split(',')[0], ""); + break; + } + } + bitP = boss_name1 + "," + Environment.NewLine + boss_name2; + if (bitP == "," + Environment.NewLine) + { bitP = "-"; } + if(Ccolumn == 0) + { bitP = bit; } + dr[Ccolumn] = bitP; + Ccolumn++; + } + + } + for (int i = TimeTable.Rows.Count - 1; i >= 0; i--) + { + if (TimeTable.Rows[i][0].ToString() == "") + TimeTable.Rows[i].Delete(); + } + + TimeTable.AcceptChanges(); + int drow = 0; + int dayC = 0; + foreach (DataRow row in TimeTable.Rows) + { + if (aftertheNext.Contains(row["0"].ToString())) + { dayC = drow; } + drow++; + } + SharedDay = dayC; + gridview1.ItemsSource = TimeTable.DefaultView; + #endregion + startupRS = 1; + try + { + BossesCollection.Clear(); + BossCollectionListBox.Items.Clear(); + } + catch (Exception) { } + + foreach (string BossData in BossListSplited) + { + if (BossData != "") + { + BossesCollection.Add(BossData.Trim()); + BossCollectionListBox.Items.Add(BossData.Split(',')[0]); + } + } + + PBImageBox.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/Bosses_img/Boss.png")); + NBImageBox.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/Bosses_img/Boss.png")); + LBImageBox.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/Bosses_img/Boss.png")); + Getimg gm = new Getimg(); + + string First_boss = ""; + string Second_boss = ""; + + foreach (string Boss in BossesCollection) + { + string bossName = Boss.Substring(0, Boss.IndexOf(",") + 1); + bossName = bossName.Replace(",", ""); + bossName = bossName.Replace(Environment.NewLine, ""); + + if (PbossNamLabel.Content.ToString().Contains(bossName)) + { + string[] bossdata = Boss.Split(','); + string imgurl = bossdata[1].ToString(); + if (bossdata[5].ToString() != "") + { + imgurl = bossdata[5].ToString(); + if (imgurl.Contains("")) + { imgurl = imgurl.Replace("", System.IO.Directory.GetCurrentDirectory()); } + } + try { PBImageBox.Source = gm.GETIMAGE(imgurl); } catch (Exception) { } + if (PbossNamLabel.Content.ToString().Contains("&")) + { try { PBImageBox.Source = gm.GETIMAGE(System.IO.Directory.GetCurrentDirectory() + "/Resources/Bosses_img/" + PbossNamLabel.Content.ToString() + ".png"); } catch (Exception) { } } + } + if (CbossNameLabel.Content.ToString().Contains(bossName)) + { + string[] bossdata = Boss.Split(','); + try + { + string imgurl = bossdata[1].ToString(); + if (bossdata[5].ToString() == "") + { + imgurl = bossdata[1].ToString(); + } + else + { + imgurl = bossdata[5].ToString(); + if (imgurl.Contains("")) + { imgurl = imgurl.Replace("", System.IO.Directory.GetCurrentDirectory()); } + } + publicNbossimage = bossdata[1].ToString(); + if (!CbossNameLabel.Content.ToString().Contains("&")) + { publicbossUrl = bossdata[2].ToString(); } + else + { + if (publicbossUrl == "") + { publicbossUrl = bossdata[2].ToString(); } + else + { publicbossUrl += " | " + bossdata[2].ToString(); } + } + NBImageBox.Source = gm.GETIMAGE(imgurl); + if (CbossNameLabel.Content.ToString().Contains("&")) + { try { NBImageBox.Source = gm.GETIMAGE(System.IO.Directory.GetCurrentDirectory() + "/Resources/Bosses_img/" + CbossNameLabel.Content.ToString() + ".png"); } catch (Exception) { } } + } + catch (Exception) { } + } + if (cSecondboss.Contains(bossName) && CbossNameLabel.Content.ToString().Contains("&") && cSecondboss != "") + { + string[] bossdata = Boss.Split(','); + if (publicbossUrl == "") + { publicbossUrl = bossdata[2].ToString(); } + else + { publicbossUrl += "|" + bossdata[2].ToString(); } + } + if (NBossNameLabel.Content.ToString().Contains(bossName)) + { + string[] bossdata = Boss.Split(','); + string imgurl = bossdata[1].ToString(); + if (bossdata[5].ToString() != "") + { + imgurl = bossdata[5].ToString(); + if (imgurl.Contains("")) + { imgurl = imgurl.Replace("", System.IO.Directory.GetCurrentDirectory()); } + } + try { LBImageBox.Source = gm.GETIMAGE(imgurl); } catch (Exception) { } + if (NBossNameLabel.Content.ToString().Contains("&")) + { try { LBImageBox.Source = gm.GETIMAGE(System.IO.Directory.GetCurrentDirectory() + "/Resources/Bosses_img/" + NBossNameLabel.Content.ToString() + ".png"); } catch (Exception) { } } + } + } + + if (PbossNamLabel.Content.ToString().Contains(" & ")) + { + string fullbossname = ""; + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = PbossNamLabel.Content.ToString(); + name = name.Substring(0, name.IndexOf("&")); + if (name.Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString() + " & "; + } + } + } + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = PbossNamLabel.Content.ToString(); + name = name.Substring(name.IndexOf("&") + 1); + if (name.Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString(); + } + } + } + if (fullbossname != "") + { PbossNamLabel.Content = fullbossname; } + + } + else + { + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + if (PbossNamLabel.Content.ToString().Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { PbossNamLabel.Content = bossdata[3].ToString(); } + } + + } + } + + if (CbossNameLabel.Content.ToString().Contains(" & ")) + { + string fullbossname = ""; + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = CbossNameLabel.Content.ToString(); + name = name.Substring(0, name.IndexOf("&")); + First_boss = name; + if (name.Contains(bossdata[0].ToString())) + { + string[] br = bossdata[4].ToString().Split('{'); + currentbossrole1 = br[1].ToString(); + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString() + " & "; + } + } + } + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = CbossNameLabel.Content.ToString(); + name = name.Substring(name.IndexOf("&") + 1); + Second_boss = name; + if (name.Contains(bossdata[0].ToString())) + { + string[] br = bossdata[4].ToString().Split('{'); + currentbossrole2 = br[1].ToString(); + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString(); + } + } + } + if (fullbossname != "") + { CbossNameLabel.Content = fullbossname; } + } + else + { + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + if (CbossNameLabel.Content.ToString().TrimStart().TrimEnd() == bossdata[0].ToString()) + { + if (bossdata[3].ToString() != "") + { + string[] br = bossdata[4].ToString().Split('{'); + currentbossrole1 = br[1].ToString(); + CbossNameLabel.Content = bossdata[3].ToString(); + } + else + { + string[] br = bossdata[4].ToString().Split('{'); + currentbossrole1 = br[1].ToString(); + } + } + + } + } + + if (NBossNameLabel.Content.ToString().Contains(" & ")) + { + string fullbossname = ""; + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = NBossNameLabel.Content.ToString(); + name = name.Substring(0, name.IndexOf("&")); + if (name.Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString() + " & "; + } + } + } + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = NBossNameLabel.Content.ToString(); + name = name.Substring(name.IndexOf("&") + 1); + if (name.Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString(); + } + } + } + if (fullbossname != "") + { NBossNameLabel.Content = fullbossname; } + } + else + { + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + if (NBossNameLabel.Content.ToString().Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { NBossNameLabel.Content = bossdata[3].ToString(); } + } + + } + } + + SaveLatestTimeTable = 0; + intervalMessageUpdate = UpdateMesssageInterval; + + if (CbossNameLabel.Content.ToString().Contains(" & ")) + { + publicNbossimage = "https://raw.githubusercontent.com/kresmes/BDO-Boss-Timer-Discord-Bot-Yuri-Project-/master/Resources/Images/" + First_boss.Replace(" ", "") + "%20%26%20" + Second_boss.Replace(" ", "") + ".png"; + } + if (discord.ConnectionState == Discord.ConnectionState.Connected && isposting == 1) + { + try + { + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(Main_BotChannel_ID); + var Message = await channel.GetMessageAsync(bossImageID) as IUserMessage; + string[] pbu = publicbossUrl.Split('|'); + string[] bnu = CbossNameLabel.Content.ToString().Split('&'); + string ANmessage = ""; + if (CbossNameLabel.Content.ToString().Contains("&")) + { + ANmessage = LanguageCollection[123].ToString() + Environment.NewLine + "[" + bnu[0] + "](" + pbu[0] + ")" + " <---" + LanguageCollection[85].ToString() + Environment.NewLine + "[" + bnu[1] + "](" + pbu[1] + ")" + " <---" + LanguageCollection[85].ToString(); + } + else + { + ANmessage = LanguageCollection[123].ToString() + Environment.NewLine + "[" + bnu[0] + "](" + pbu[0] + ")" + " <---" + LanguageCollection[85].ToString(); + } + var embed1 = new EmbedBuilder + { + Title = CbossNameLabel.Content.ToString() /*+ " <---" + LanguageCollection[87].ToString()*/, + ImageUrl = publicNbossimage, + Color = Color.LightGrey, + //Url = publicbossUrl + Description = ANmessage + }; + await Message.ModifyAsync(msg => msg.Embed = embed1.Build()); + } + catch (Exception) { } + } + TimeSpan CC = TimeSpan.FromHours(1); + if (EditSpawnHoursSlider.Value.ToString().Contains("-")) + { + TimeSpan PDT = TimeSpan.Parse(PreviousBossTimeLabel.Content.ToString()); + PreviousBossTimeLabel.Content = PDT.Add(CC).ToString(@"hh\:mm\:ss"); + + TimeSpan CDT = TimeSpan.Parse(CurrentBossTimeLabel.Content.ToString()); + CurrentBossTimeLabel.Content = CDT.Subtract(CC).ToString(@"hh\:mm\:ss"); + + TimeSpan NDT = TimeSpan.Parse(NextBossTimeLabel.Content.ToString()); + NextBossTimeLabel.Content = NDT.Subtract(CC).ToString(@"hh\:mm\:ss"); + } + if (EditSpawnHoursSlider.Value > 0) + { + TimeSpan PDT = TimeSpan.Parse(PreviousBossTimeLabel.Content.ToString()); + PreviousBossTimeLabel.Content = PDT.Subtract(CC).ToString(@"hh\:mm\:ss"); + + TimeSpan CDT = TimeSpan.Parse(CurrentBossTimeLabel.Content.ToString()); + CurrentBossTimeLabel.Content = CDT.Add(CC).ToString(@"hh\:mm\:ss"); + + TimeSpan NDT = TimeSpan.Parse(NextBossTimeLabel.Content.ToString()); + NextBossTimeLabel.Content = NDT.Add(CC).ToString(@"hh\:mm\:ss"); + } + if (currentbossrole1 != "") + { + if (currentbossrole1 != "@everyone" && currentbossrole1 != "@here") + { currentbossrole1 = "<@&" + currentbossrole1 + ">"; } + } + if (currentbossrole2 != "") + { + if (currentbossrole2 != "@everyone" && currentbossrole2 != "@here") + { currentbossrole2 = "<@&" + currentbossrole2 + ">"; } + } + + if (discord.ConnectionState == Discord.ConnectionState.Connected && isposting == 1) + { + if (DisplayTimeTableSetting.IsChecked == true) + { + if (TimtableID != 0) + { + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(Main_BotChannel_ID); + await channel.DeleteMessageAsync(TimtableID); + TimtableID = 0; + } + + if (TimtableID == 0) + { + try { gridview1.SelectedIndex = SharedDay; } catch (Exception) { } + if (File.Exists(System.IO.Directory.GetCurrentDirectory() + "/Resources/TimeTable.png")) + { File.Delete(System.IO.Directory.GetCurrentDirectory() + "/Resources/TimeTable.png"); } + //int width = int.Parse(gridview1.ActualWidth.ToString());//error + //int height = int.Parse(gridview1.ActualHeight.ToString()); + RenderTargetBitmap renderTargetBitmap = + new RenderTargetBitmap(1920, 1080, 180, 250, PixelFormats.Pbgra32); + renderTargetBitmap.Render(gridview1); + PngBitmapEncoder pngImage = new PngBitmapEncoder(); + pngImage.Frames.Add(BitmapFrame.Create(renderTargetBitmap)); + using (Stream fileStream = File.Create(System.IO.Directory.GetCurrentDirectory() + "/Resources/TimeTable.png")) + { + pngImage.Save(fileStream); + } + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(Main_BotChannel_ID); + var timetablemessage = await channel.SendFileAsync(System.IO.Directory.GetCurrentDirectory() + "/Resources/TimeTable.png", MOTR.ToString().ToUpper() + LanguageCollection[43].ToString()); + TimtableID = timetablemessage.Id; + } + } + } + + timer1.Start(); + } + void timer1_Tick(object sender, EventArgs e) //Timer Loop message Updates&others + { + if(discord.ConnectionState == Discord.ConnectionState.Connected && botuptime >= 30) + { + discord.SetStatusAsync(Discord.UserStatus.Online); botuptime = 0; + if(NBossNameLabel.Content.ToString() == "...") + { GetLYPBBTTimeTable(); } + } + botuptime++; + TimeSpan CC = TimeSpan.FromSeconds(1); + PbossNamLabel.ToolTip = PbossNamLabel.Content.ToString(); + CbossNameLabel.ToolTip = CbossNameLabel.Content.ToString(); + NBossNameLabel.ToolTip = NBossNameLabel.Content.ToString(); + + TimeSpan PDT = TimeSpan.Parse(PreviousBossTimeLabel.Content.ToString()); + PreviousBossTimeLabel.Content = PDT.Add(CC).ToString(@"hh\:mm\:ss"); + + TimeSpan CDT = TimeSpan.Parse(CurrentBossTimeLabel.Content.ToString()); + CurrentBossTimeLabel.Content = CDT.Subtract(CC).ToString(@"hh\:mm\:ss"); + + TimeSpan NDT = TimeSpan.Parse(NextBossTimeLabel.Content.ToString()); + NextBossTimeLabel.Content = NDT.Subtract(CC).ToString(@"hh\:mm\:ss"); + + TimeSpan NiBDO = TimeSpan.Parse(NightInBdoTimeLabel.Content.ToString()); + NightInBdoTimeLabel.Content = NiBDO.Subtract(CC).ToString(@"hh\:mm\:ss"); + + TimeSpan IR = TimeSpan.Parse(IRTimeLabel.Content.ToString()); + IRTimeLabel.Content = IR.Subtract(CC).ToString(@"hh\:mm\:ss"); + + TimeSpan BRI = TimeSpan.Parse(BRTimeLabel.Content.ToString()); + BRTimeLabel.Content = BRI.Subtract(CC).ToString(@"hh\:mm\:ss"); + + TimeSpan ITRI = TimeSpan.Parse(ITRITimeLabel.Content.ToString()); + ITRITimeLabel.Content = ITRI.Subtract(CC).ToString(@"hh\:mm\:ss"); + + + if (overlayState == 1) + { + try + { + BitmapImage img = new BitmapImage(); + img = NBImageBox.Source as BitmapImage; + omw.UpdateData(BRILabel.Content.ToString() , img, CbossLabel.Content.ToString(), CbossNameLabel.Content.ToString(), CurrentBossTimeLabel.Content.ToString(), NILabel.Content.ToString(), NightInBdoTimeLabel.Content.ToString(), IRILabel.Content.ToString(), IRTimeLabel.Content.ToString(), BRTimeLabel.Content.ToString(), SoundOptionCheckBox.Content.ToString(), NTSoundOptionCheckBox.Content.ToString(), IRSoundOptionCheckBox.Content.ToString(), BRSoundOptionCheckBox.Content.ToString(), ITRSoundOptionCheckBox.Content.ToString(), PlaySoundOnLabel.Content.ToString(), ITRILabel.Content.ToString(), ITRITimeLabel.Content.ToString()); + } + catch (Exception) { } + + } + + #region "Boss Alert's" + if (AlertonhousandminutesCheckBox.IsChecked == true) + { + if (BossSpawnAlarmCheckBox1.IsChecked == true && CurrentBossTimeLabel.Content.ToString() == BossSpawnAlarm1Textbox.Text + ":00" + ":00") + { + string message = BSA1CMTextBox.Text; + DiscordNotifyBossSpwn(message); + if (SoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playBossAlertaudio(); + } + } + + if (BossSpawnAlarmCheckBox2.IsChecked == true && CurrentBossTimeLabel.Content.ToString() == BossSpawnAlarm1Textbox.Text + ":00" + ":00") + { + string message = BSA2CMTextBox.Text; + DiscordNotifyBossSpwn(message); + if (SoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playBossAlertaudio(); + } + } + + if (BossSpawnAlarmCheckBox3.IsChecked == true && CurrentBossTimeLabel.Content.ToString() == BossSpawnAlarm1Textbox.Text + ":00" + ":00") + { + string message = BSA3CMTextBox.Text; + DiscordNotifyBossSpwn(message); + if (SoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playBossAlertaudio(); + } + } + } + if (BossSpawnAlarmCheckBox1.IsChecked == true && CurrentBossTimeLabel.Content.ToString() == "00:" + BossSpawnAlarm1Textbox.Text + ":00") + { + string message = BSA1CMTextBox.Text; + DiscordNotifyBossSpwn(message); + if (SoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playBossAlertaudio(); + } + } + + if (BossSpawnAlarmCheckBox2.IsChecked == true && CurrentBossTimeLabel.Content.ToString() == "00:" + BossSpawnAlarm2Textbox.Text + ":00") + { + string message = BSA2CMTextBox.Text; + DiscordNotifyBossSpwn(message); + if (SoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playBossAlertaudio(); + } + } + + if (BossSpawnAlarmCheckBox3.IsChecked == true && CurrentBossTimeLabel.Content.ToString() == "00:" + BossSpawnAlarm3Textbox.Text + ":00") + { + string message = BSA3CMTextBox.Text; + DiscordNotifyBossSpwn(message); + if (SoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playBossAlertaudio(); + } + } + #endregion + #region "NightTime Alert's" + if (AlertonhousandminutesCheckBox.IsChecked == true) + { + if (NightTimeAlarmCheckBox1.IsChecked == true && NightInBdoTimeLabel.Content.ToString() == NightTimeAlarm1Textbox.Text + ":00" + ":00" && NILabel.Content.ToString() == LanguageCollection[25].ToString()) + { + string message = NTA1CMTextbBox.Text; + DiscordNotifyNightTime(message); + if (NTSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playNightAlertaudio(); + } + } + + if (NightTimeAlarmCheckBox2.IsChecked == true && NightInBdoTimeLabel.Content.ToString() == NightTimeAlarm2Textbox.Text + ":00" + ":00" && NILabel.Content.ToString() == LanguageCollection[25].ToString()) + { + string message = NTA2CMTextbBox.Text; + DiscordNotifyNightTime(message); + if (NTSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playNightAlertaudio(); + } + } + + if (NightTimeAlarmCheckBox3.IsChecked == true && NightInBdoTimeLabel.Content.ToString() == NightTimeAlarm3Textbox.Text + ":00" + ":00" && NILabel.Content.ToString() == LanguageCollection[25].ToString()) + { + string message = NTA3CMTextbBox.Text; + DiscordNotifyNightTime(message); + if (NTSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playNightAlertaudio(); + } + } + } + if (NightTimeAlarmCheckBox1.IsChecked == true && NightInBdoTimeLabel.Content.ToString() == "00:" + NightTimeAlarm1Textbox.Text + ":00" && NILabel.Content.ToString() == LanguageCollection[25].ToString()) + { + string message = NTA1CMTextbBox.Text; + DiscordNotifyNightTime(message); + if (NTSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playNightAlertaudio(); + } + } + + if (NightTimeAlarmCheckBox2.IsChecked == true && NightInBdoTimeLabel.Content.ToString() == "00:" + NightTimeAlarm2Textbox.Text + ":00" && NILabel.Content.ToString() == LanguageCollection[25].ToString()) + { + string message = NTA2CMTextbBox.Text; + DiscordNotifyNightTime(message); + if (NTSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playNightAlertaudio(); + } + } + + if (NightTimeAlarmCheckBox3.IsChecked == true && NightInBdoTimeLabel.Content.ToString() == "00:" + NightTimeAlarm3Textbox.Text + ":00" && NILabel.Content.ToString() == LanguageCollection[25].ToString()) + { + string message = NTA3CMTextbBox.Text; + DiscordNotifyNightTime(message); + if (NTSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playNightAlertaudio(); + } + } + #endregion + #region "Imperial Reset Alert's" + if (AlertonhousandminutesCheckBox.IsChecked == true) + { + if (ImperialResetCheckBox1.IsChecked == true && IRTimeLabel.Content.ToString() == ImperialResetAlarm1Textbox.Text + ":00" + ":00") + { + string message = IRA1CMTextBox.Text; + DiscordNotifyImperialReset(message); + if (IRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playImperialResetAlertaudio(); + } + } + + if (ImperialResetCheckBox2.IsChecked == true && IRTimeLabel.Content.ToString() == ImperialResetAlarm2Textbox.Text + ":00" + ":00") + { + string message = IRA2CMTextBox.Text; + DiscordNotifyImperialReset(message); + if (IRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playImperialResetAlertaudio(); + } + } + + if (ImperialResetCheckBox3.IsChecked == true && IRTimeLabel.Content.ToString() == ImperialResetAlarm3Textbox.Text + ":00" + ":00") + { + string message = IRA3CMTextBox.Text; + DiscordNotifyImperialReset(message); + if (IRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playImperialResetAlertaudio(); + } + } + } + if (ImperialResetCheckBox1.IsChecked == true && IRTimeLabel.Content.ToString() == "00:" + ImperialResetAlarm1Textbox.Text + ":00") + { + string message = IRA1CMTextBox.Text; + DiscordNotifyImperialReset(message); + if (IRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playImperialResetAlertaudio(); + } + } + + if (ImperialResetCheckBox2.IsChecked == true && IRTimeLabel.Content.ToString() == "00:" + ImperialResetAlarm2Textbox.Text + ":00") + { + string message = IRA2CMTextBox.Text; + DiscordNotifyImperialReset(message); + if (IRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playImperialResetAlertaudio(); + } + } + + if (ImperialResetCheckBox3.IsChecked == true && IRTimeLabel.Content.ToString() == "00:" + ImperialResetAlarm3Textbox.Text + ":00") + { + string message = IRA3CMTextBox.Text; + DiscordNotifyImperialReset(message); + if (IRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playImperialResetAlertaudio(); + } + } + #endregion + #region "Bartering Reset Alert's" + if (AlertonhousandminutesCheckBox.IsChecked == true) + { + if (BRAlarmCheckBox1.IsChecked == true && BRTimeLabel.Content.ToString() == BRAlarm1Textbox.Text + ":00" + ":00") + { + string message = BRA1CMTextBox.Text; + DiscordNotifyBR(message); + if (BRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playBarteringAlertaudio(); + } + } + + if (BRAlarmCheckBox2.IsChecked == true && BRTimeLabel.Content.ToString() == BRAlarm2Textbox.Text + ":00" + ":00") + { + string message = BRA2CMTextBox.Text; + DiscordNotifyBR(message); + if (BRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playBarteringAlertaudio(); + } + } + + if (BRAlarmCheckBox3.IsChecked == true && BRTimeLabel.Content.ToString() == BRAlarm3Textbox.Text + ":00" + ":00") + { + string message = BRA3CMTextBox.Text; + DiscordNotifyBR(message); + if (BRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playBarteringAlertaudio(); + } + } + } + if (BRAlarmCheckBox1.IsChecked == true && BRTimeLabel.Content.ToString() == "00:" + BRAlarm1Textbox.Text + ":00") + { + string message = BRA1CMTextBox.Text; + DiscordNotifyBR(message); + if (BRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playBarteringAlertaudio(); + } + } + + if (BRAlarmCheckBox2.IsChecked == true && BRTimeLabel.Content.ToString() == "00:" + BRAlarm2Textbox.Text + ":00") + { + string message = BRA2CMTextBox.Text; + DiscordNotifyBR(message); + if (BRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playBarteringAlertaudio(); + } + } + + if (BRAlarmCheckBox3.IsChecked == true && BRTimeLabel.Content.ToString() == "00:" + BRAlarm3Textbox.Text + ":00") + { + string message = BRA3CMTextBox.Text; + DiscordNotifyBR(message); + if (BRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playBarteringAlertaudio(); + } + } + #endregion + #region "Imperial Trading Reset Alert's" + if (AlertonhousandminutesCheckBox.IsChecked == true) + { + if (ITRAlarmCheckBox1.IsChecked == true && ITRITimeLabel.Content.ToString() == ITRAlarm1Textbox.Text + ":00" + ":00") + { + string message = ITRA1CMTextBox.Text; + DiscordNotifyITR(message); + if (ITRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playImperialTradingResetAlertaudio(); + } + } + + if (ITRAlarmCheckBox2.IsChecked == true && ITRITimeLabel.Content.ToString() == ITRAlarm2Textbox.Text + ":00" + ":00") + { + string message = ITRA2CMTextBox.Text; + DiscordNotifyITR(message); + if (ITRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playImperialTradingResetAlertaudio(); + } + } + + if (ITRAlarmCheckBox3.IsChecked == true && ITRITimeLabel.Content.ToString() == ITRAlarm3Textbox.Text + ":00" + ":00") + { + string message = ITRA3CMTextBox.Text; + DiscordNotifyITR(message); + if (ITRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playImperialTradingResetAlertaudio(); + } + } + } + if (ITRAlarmCheckBox1.IsChecked == true && ITRITimeLabel.Content.ToString() == "00:" + ITRAlarm1Textbox.Text + ":00") + { + string message = ITRA1CMTextBox.Text; + DiscordNotifyITR(message); + if (ITRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playImperialTradingResetAlertaudio(); + } + } + + if (ITRAlarmCheckBox2.IsChecked == true && ITRITimeLabel.Content.ToString() == "00:" + ITRAlarm2Textbox.Text + ":00") + { + string message = ITRA2CMTextBox.Text; + DiscordNotifyITR(message); + if (ITRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playImperialTradingResetAlertaudio(); + } + } + + if (ITRAlarmCheckBox3.IsChecked == true && ITRITimeLabel.Content.ToString() == "00:" + ITRAlarm3Textbox.Text + ":00") + { + string message = ITRA3CMTextBox.Text; + DiscordNotifyITR(message); + if (ITRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playImperialTradingResetAlertaudio(); + } + } + #endregion + + if (CurrentBossTimeLabel.Content.ToString() != "00:00:00") + { + if (NightInBdoTimeLabel.Content.ToString() == "00:00:00") + { + // if (NILabel.Content.ToString() == LanguageCollection[25].ToString()) + // { + if (SourceComboBox.SelectedIndex == 0) + { GetLYPBBTTimeTable(); } + if (SourceComboBox.SelectedIndex == 1) + { GetTimeTable(MOTR); }//Get info from Html Code + if (SourceComboBox.SelectedIndex == 2) + { GetUrlSource("https://bdobosstimer.com/?&server=" + MOTR); } + // } + } + if (IRTimeLabel.Content.ToString() == "00:00:00") + { + if (SourceComboBox.SelectedIndex == 0) + { GetLYPBBTTimeTable(); } + if (SourceComboBox.SelectedIndex == 1) + { GetTimeTable(MOTR); }//Get info from Html Code + if (SourceComboBox.SelectedIndex == 2) + { GetUrlSource("https://bdobosstimer.com/?&server=" + MOTR); } + } + if (BRTimeLabel.Content.ToString() == "00:00:00") + { + if (SourceComboBox.SelectedIndex == 0) + { GetLYPBBTTimeTable(); } + if (SourceComboBox.SelectedIndex == 1) + { GetTimeTable(MOTR); }//Get info from Html Code + if (SourceComboBox.SelectedIndex == 2) + { GetUrlSource("https://bdobosstimer.com/?&server=" + MOTR); } + } + if (ITRITimeLabel.Content.ToString() == "00:00:00") + { + if (SourceComboBox.SelectedIndex == 0) + { GetLYPBBTTimeTable(); } + if (SourceComboBox.SelectedIndex == 1) + { GetTimeTable(MOTR); }//Get info from Html Code + if (SourceComboBox.SelectedIndex == 2) + { GetUrlSource("https://bdobosstimer.com/?&server=" + MOTR); } + } + } + + if (CurrentBossTimeLabel.Content.ToString() == "00:00:00") + { + if (SourceComboBox.SelectedIndex == 0) + { GetLYPBBTTimeTable(); } + if (SourceComboBox.SelectedIndex == 1) + { GetTimeTable(MOTR); }//Get info from Html Code + if (SourceComboBox.SelectedIndex == 2) + { GetUrlSource("https://bdobosstimer.com/?&server=" + MOTR); } + } + + if (SaveLatestTimeTable == 0) + { + try + { + try { gridview1.SelectedIndex = SharedDay; } catch (Exception) { } + if (File.Exists(System.IO.Directory.GetCurrentDirectory() + "/Resources/TimeTable.png")) + { File.Delete(System.IO.Directory.GetCurrentDirectory() + "/Resources/TimeTable.png"); } + int width = int.Parse(gridview1.ActualWidth.ToString()); + int height = int.Parse(gridview1.ActualHeight.ToString()); + RenderTargetBitmap renderTargetBitmap = + new RenderTargetBitmap(1920, 1080, 180, 250, PixelFormats.Pbgra32); + renderTargetBitmap.Render(gridview1); + PngBitmapEncoder pngImage = new PngBitmapEncoder(); + pngImage.Frames.Add(BitmapFrame.Create(renderTargetBitmap)); + using (Stream fileStream = File.Create(System.IO.Directory.GetCurrentDirectory() + "/Resources/TimeTable.png")) + { + pngImage.Save(fileStream); + } + SaveLatestTimeTable = 1; + } + catch (Exception) { } + } + + + if (discord.ConnectionState == Discord.ConnectionState.Connected && isposting == 1) + { + if (discord.ConnectionState == Discord.ConnectionState.Connected && intervalMessageUpdate == UpdateMesssageInterval) + { + try { EditMessage(); } catch (Exception) { } + } + if (intervalMessageUpdate >= UpdateMesssageInterval) + { intervalMessageUpdate = 0; } + intervalMessageUpdate++; + } + } + private void Window_MouseDown(object sender, MouseButtonEventArgs e)//Move Window Using any Ui objects + { + try + { + if (e.ChangedButton == MouseButton.Left) + this.DragMove(); + } + catch (Exception) { } + } + + private void mediaElement_MediaEnded(object sender, RoutedEventArgs e)// loop BackVid + { + mediaElement.Position = new TimeSpan(0, 0, 0); + mediaElement.Play(); + } + + public DataGridCell GetCell(int rowIndex, int columnIndex, DataGrid dg)// future Code Usage For CustomTimeTables + { + DataGridRow row = dg.ItemContainerGenerator.ContainerFromIndex(rowIndex) as DataGridRow; + DataGridCellsPresenter p = GetVisualChild(row); + DataGridCell cell = p.ItemContainerGenerator.ContainerFromIndex(columnIndex) as DataGridCell; + return cell; + } + + static T GetVisualChild(Visual parent) where T : Visual // future Code Usage For CustomTimeTables + { + T child = default(T); + int numVisuals = VisualTreeHelper.GetChildrenCount(parent); + for (int i = 0; i < numVisuals; i++) + { + Visual v = (Visual)VisualTreeHelper.GetChild(parent, i); + child = v as T; + if (child == null) + { + child = GetVisualChild(v); + } + if (child != null) + { + break; + } + } + return child; + } + + public void Count()// future Code Usage For CustomTimeTables + { + timer.Stop(); + System.Threading.Thread.Sleep(2000); + timer.Interval = TimeSpan.FromSeconds(1); + timer.Tick += timer_Tick; + + List TimeBored = new List(); + DataRow dr1 = TimeTable.Rows[0]; + int v = 0; + foreach (var column in TimeTable.Columns.Cast().ToArray()) + { + if (v > 0) + { TimeBored.Add(dr1[v].ToString()); } + v++; + } + int MaxC = 0; + int NextB = 0; + int FinalB = -1; + DateTime PT = DateTime.Now; + DateTime PTC = TimeZone.CurrentTimeZone.ToUniversalTime(PT); + foreach (var i in TimeBored) + { + DateTime CC = DateTime.Parse(TimeBored[NextB].ToString()); + DateTime CCC = TimeZone.CurrentTimeZone.ToUniversalTime(CC); + if (CCC > PTC) + { FinalB = NextB; } + if (FinalB == -1) + { NextB++; } + MaxC++; + } + if (FinalB > 0) + { + DateTime PB = DateTime.Parse(TimeBored[FinalB - 1].ToString()); + PBT = TimeZone.CurrentTimeZone.ToUniversalTime(PB); + } + DateTime CB = DateTime.Parse(TimeBored[FinalB].ToString()); + CBT = TimeZone.CurrentTimeZone.ToUniversalTime(CB); + if (FinalB < MaxC) + { + if (FinalB + 1 < MaxC) + { + DateTime NB = DateTime.Parse(TimeBored[FinalB + 1].ToString()); + NBT = TimeZone.CurrentTimeZone.ToUniversalTime(NB); + } + else + { + DateTime NB = DateTime.Parse(TimeBored[0].ToString()); + NBT = TimeZone.CurrentTimeZone.ToUniversalTime(NB); + } + } + MainB = FinalB; + PmaxC = MaxC; + + int CBI = FinalB + 1; + int day = 0; + for (int i = 0; i < 8; i++) + { + + DataRow dr = TimeTable.Rows[i]; + if (dr[0].ToString() == DateTime.Today.DayOfWeek.ToString()) + { day = i; } + } + DataRow drV = TimeTable.Rows[day]; + if (drV[CBI].ToString() == "") + { + while (true) + { + CBI++; + if (drV[CBI].ToString() != "") + { break; } + } + } + + if (CBI > 0) + { + DataRow dr2 = TimeTable.Rows[day]; + PbossNamLabel.Content = dr2[CBI - 1].ToString(); + if (PbossNamLabel.Content.ToString().Contains(",")) + { PbossNamLabel.Content = PbossNamLabel.Content.ToString().Replace("," + Environment.NewLine, " & "); } + } + else + { + PbossNamLabel.Content = "Prevoius Boss"; + } + DataRow dr3 = TimeTable.Rows[day]; + CbossNameLabel.Content = dr3[CBI].ToString(); + if (CbossNameLabel.Content.ToString().Contains(",")) + { CbossNameLabel.Content = CbossNameLabel.Content.ToString().Replace("," + Environment.NewLine, " & "); } + if (CBI < TimeTable.Columns.Count - 1) + { + DataRow dr4 = TimeTable.Rows[day]; + NBossNameLabel.Content = dr4[CBI + 1].ToString(); + if (NBossNameLabel.Content.ToString().Contains(",")) + { NBossNameLabel.Content = NBossNameLabel.Content.ToString().Replace("," + Environment.NewLine, " & "); } + } + else + { + NBossNameLabel.Content = "Followed Boss"; + } + + SharedDay = day; + SharedTime = CBI; + DateTime TN = DateTime.Now; + + + timer.Start(); + + } + + void timer_Tick(object sender, EventArgs e)// future Code Usage For CustomTimeTables + { + DateTime PT = DateTime.Now; + DateTime PTC = TimeZone.CurrentTimeZone.ToUniversalTime(PT); + + if (MainB > 0) + { + + TimeSpan PFTC = PBT.Subtract(PTC); + PreviousBossTimeLabel.Content = "-" + PFTC.ToString(@"hh\:mm\:ss"); + } + else + { + PreviousBossTimeLabel.Content = "00:00:00"; + } + TimeSpan FTC = CBT.Subtract(PTC); + CurrentBossTimeLabel.Content = FTC.ToString(@"hh\:mm\:ss"); + if (MainB < PmaxC) + { + TimeSpan NFTC = NBT.Subtract(PTC); + NextBossTimeLabel.Content = NFTC.ToString(@"hh\:mm\:ss"); + } + else + { + NextBossTimeLabel.Content = "00:00:00"; + } + if (FTC.ToString(@"hh\:mm\:ss") == "00:00:00") + { + try + { + DataGridCell cell = GetCell(SharedDay, SharedTime, gridview1); + var bc = new BrushConverter(); + cell.Background = (Brush)bc.ConvertFrom("#E51E2129"); + } + catch (Exception) { } + Count(); + } + + + try + { + DataGridCell cell = GetCell(SharedDay, SharedTime, gridview1); + var bc = new BrushConverter(); + cell.Background = (Brush)bc.ConvertFrom("#FF767676"); + } + catch (Exception) { } + + } + + private void RegionComboBox_DropDownClosed(object sender, EventArgs e)//update dropbox content + { + if (RegionComboBox.Text != MOTR.ToUpper()) + { + Settings.Default["DefaultRegion"] = RegionComboBox.Text.ToLower(); + Settings.Default.Save(); + MOTR = RegionComboBox.Text.ToLower(); + if (SourceComboBox.SelectedIndex == 0) + { GetLYPBBTTimeTable(); } + if (SourceComboBox.SelectedIndex == 1) + { GetTimeTable(RegionComboBox.Text.ToLower()); } + if (SourceComboBox.SelectedIndex == 2) + { GetUrlSource("https://bdobosstimer.com/?&server=" + RegionComboBox.Text.ToLower()); } + } + } + + private void gridview1_GotFocus(object sender, RoutedEventArgs e)// select TimezoneDay on focus + { + try + { + //gridview1.SelectedIndex = SharedDay; + } + catch (Exception) { } + } + private void AutoSaveBossData() + { + int i = 0; + int r = 0; + if(SRFTBCombobox.SelectedIndex == -1) + { SRFTBCombobox.SelectedIndex = 0; } + foreach (string item in BossesCollection) + { + string bossName = item.Substring(0, item.IndexOf(",") + 1); + bossName = bossName.Replace(",", ""); + bossName = bossName.Replace(Environment.NewLine, ""); + if (bossName.ToLower() == AddSaveBossNameTextBox.Text.ToLower()) + { + r = i; + } + i++; + } + BossesCollection[r] = AddSaveBossNameTextBox.Text + "," + DisplayImageLinkextBox.Text + "," + BossSpawnLocationLinkTextBox.Text + "," + CBNTextbox.Text + "," + SRFTBCombobox.Text + "{" + RolesCollection[SRFTBCombobox.SelectedIndex].ToString() + "," + DisplayImageLinkextBoxLocal.Text; + } + private void AddnewBossTestImgLinkButton_Click(object sender, RoutedEventArgs e)// test image url loadasync() code base + { + Getimg gm = new Getimg(); + DisplayImageLinkextBox.BorderBrush = Brushes.Silver; + AddSaveBossPictureBox.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/Bosses_img/Boss.png")); + string imgurl = DisplayImageLinkextBox.Text; + //if (imgurl.Contains("")) + //{ imgurl = imgurl.Replace("", System.IO.Directory.GetCurrentDirectory()); } + try { AddSaveBossPictureBox.Source = gm.GETIMAGE(imgurl); } catch (Exception) { DisplayImageLinkextBox.BorderBrush = Brushes.Red; } + } + private void RemoveBossButton_Click(object sender, RoutedEventArgs e)//remove selected boss from listbox + { + if (BossCollectionListBox.SelectedIndex > -1) + { + BossesCollection.RemoveAt(BossCollectionListBox.SelectedIndex); + BossCollectionListBox.Items.RemoveAt(BossCollectionListBox.SelectedIndex); + try { BossCollectionListBox.SelectedIndex = 0; } catch (Exception) { } + Trigger_bossSelection(); + } + } + + private async void BossesListButton_Click(object sender, RoutedEventArgs e)//change tabcontrol + { + if (discord.ConnectionState == Discord.ConnectionState.Connected) + { + if (tabcontrol1.SelectedIndex == 3) + { SaveGlobalSettings(); } + if (SourceComboBox.SelectedIndex == 0 && tabcontrol1.SelectedIndex == 1) + { Save_LYPBBTTT(); GetLYPBBTTimeTable(); } + GetIds(); + TimeTableGrid.Visibility = Visibility.Hidden; + + try { BossCollectionListBox.SelectedIndex = 0; Selectected_boss = BossCollectionListBox.SelectedIndex; } catch (Exception) { } + try + { + gridview1.SelectedIndex = SharedDay; + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + tabcontrol1.BeginAnimation(OpacityProperty, da); + } + catch (Exception) { } + tabcontrol1.SelectedIndex = 2; + var bc = new BrushConverter(); + Homehighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + Timetablehighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + bosslisthighlight.Fill = (Brush)bc.ConvertFrom(subcolor); + SelfRollingHighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + settingshighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + abouthighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + if (BossCollectionListBox.Items.Count > 0) + { + try + { + Getimg gm = new Getimg(); + DisplayImageLinkextBox.BorderBrush = (Brush)bc.ConvertFrom("#FF434349"); + RemoveBossButton.Visibility = Visibility.Visible; + + foreach (string item in BossesCollection) + { + string bossName = item.Substring(0, item.IndexOf(",") + 1); + bossName = bossName.Replace(",", ""); + bossName = bossName.Replace(Environment.NewLine, ""); + if (bossName.ToString() == BossCollectionListBox.SelectedItem.ToString()) + { + string[] bossdata = item.Split(','); + AddSaveBossNameTextBox.Text = bossdata[0].ToString(); + DisplayImageLinkextBox.Text = bossdata[1].ToString(); + DisplayImageLinkextBoxLocal.Text = bossdata[5].ToString(); + AddSaveBossPictureBox.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/Bosses_img/Boss.png")); + if (bossdata[5].ToString() == "") + { + string imgurl = bossdata[1].ToString(); + //if (imgurl.Contains("")) + //{ imgurl = imgurl.Replace("", System.IO.Directory.GetCurrentDirectory()); } + try { AddSaveBossPictureBox.Source = gm.GETIMAGE(imgurl); } catch (Exception) { DisplayImageLinkextBox.BorderBrush = Brushes.Red; } + } + else + { + string imgurl = bossdata[5].ToString(); + if (imgurl.Contains("")) + { imgurl = imgurl.Replace("", System.IO.Directory.GetCurrentDirectory()); } + try { AddSaveBossPictureBox.Source = gm.GETIMAGE(imgurl); } catch (Exception) { DisplayImageLinkextBoxLocal.BorderBrush = Brushes.Red; } + } + BossSpawnLocationLinkTextBox.Text = bossdata[2].ToString(); + CBNTextbox.Text = bossdata[3].ToString(); + string[] br = bossdata[4].ToString().Split('{'); + SRFTBCombobox.Text = br[0].ToString(); + if (SRFTBCombobox.SelectedIndex == -1) + { + if (br[1].ToString() != "") + { + try + { + var guild = discord.GetGuild(ServerID); + ulong Role_id = ulong.Parse(br[1].ToString()); + var Role = guild.GetRole(Role_id); + SRFTBCombobox.Text = "@" + Role.Name.ToString(); + } + catch (Exception) { SRFTBCombobox.Text = "None"; } + } + else + { SRFTBCombobox.Text = "None"; } + } + } + } + } + catch (Exception) { } + } + } + else + { + try + { + var bc = new BrushConverter(); + + DiscordBotConnectionStatusLabel.Foreground = (Brush)bc.ConvertFrom("#FFF1F1F1"); + DiscordBotConnectionStatusLabel.Content = LanguageCollection[6].ToString();//"Connecting..."; + await discord.LoginAsync(TokenType.Bot, Token); + await discord.StartAsync(); + System.Threading.Thread.Sleep(1000); + + if (DiscordBotConnectionStatusLabel.Content.ToString() == LanguageCollection[6].ToString()) + { + DiscordBotConnectionStatusLabel.Foreground = (Brush)bc.ConvertFrom("#FF669174"); + DiscordBotConnectionStatusLabel.Content = LanguageCollection[8].ToString();//"Connected"; + } + } + catch (Exception) + { + var bc = new BrushConverter(); + DiscordBotConnectionStatusLabel.Foreground = (Brush)bc.ConvertFrom("#FFBB3D3D"); + DiscordBotConnectionStatusLabel.Content = LanguageCollection[7].ToString();//"Connection ERROR!"; + ErrorMessageBox emb = new ErrorMessageBox(LanguageCollection[119].ToString(), LanguageCollection[120].ToString(), LanguageCollection[121].ToString(), LanguageCollection[122].ToString()); + emb.TestToken(LanguageCollection[112].ToString(), discord, this, Token); + emb.Show(); + this.IsEnabled = false; + + /*StartPosting();*/ + } + } + } + + private void TimeTableButton_Click(object sender, RoutedEventArgs e)//change tabcontrol + { + RemoveTimeTableColumn.Visibility = Visibility.Hidden; + if (tabcontrol1.SelectedIndex == 3) + { SaveGlobalSettings(); } + if (tabcontrol1.SelectedIndex == 2) + { savebosslist(); } + EditTimeTableGrid.Visibility = Visibility.Hidden; + if (SourceComboBox.SelectedIndex == 0) + { EditTimeTableGrid.Visibility = Visibility.Visible; gridviewbox_Copy1.Visibility = Visibility.Hidden; } + if(SourceComboBox.SelectedIndex > 0) + { gridviewbox_Copy1.Visibility = Visibility.Visible; } + TimeTableLabel.Content = MOTR.ToUpper() + LanguageCollection[43].ToString(); + try + { + gridview1Column = 1; + gridview1.SelectedIndex = SharedDay; + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + tabcontrol1.BeginAnimation(OpacityProperty, da); + TimeTableGrid.BeginAnimation(OpacityProperty, da); + } + catch (Exception) { } + TimeTableGrid.Visibility = Visibility.Visible; + tabcontrol1.SelectedIndex = 1; + var bc = new BrushConverter(); + Homehighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + Timetablehighlight.Fill = (Brush)bc.ConvertFrom(subcolor); + SelfRollingHighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + bosslisthighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + settingshighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + abouthighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + } + + private void NumberValidationTextBox(object sender, TextCompositionEventArgs e)// make sure only numbers filled in linked textbox's + { + Regex regex = new Regex("[^0-9-]+"); + e.Handled = regex.IsMatch(e.Text); + } + #region "Alarms Settings" + private void BossSpawnAlarmCheckBox1_Click(object sender, RoutedEventArgs e) + { + SaveBossSapwnAlrarmSettings(); + } + private void SaveBossSapwnAlrarmSettings() + { + if (BossSpawnAlarm1Textbox.Text == "") + { BossSpawnAlarm1Textbox.Text = "30"; } + if (BossSpawnAlarm2Textbox.Text == "") + { BossSpawnAlarm2Textbox.Text = "15"; } + if (BossSpawnAlarm3Textbox.Text == "") + { BossSpawnAlarm3Textbox.Text = "05"; } + + if (BossSpawnAlarm1Textbox.Text == "0") + { BossSpawnAlarm1Textbox.Text = "30"; } + if (BossSpawnAlarm2Textbox.Text == "0") + { BossSpawnAlarm2Textbox.Text = "15"; } + if (BossSpawnAlarm3Textbox.Text == "0") + { BossSpawnAlarm3Textbox.Text = "05"; } + + if (int.Parse(BossSpawnAlarm1Textbox.Text) < 10) + { BossSpawnAlarm1Textbox.Text = "0" + int.Parse(BossSpawnAlarm1Textbox.Text); } + if (int.Parse(BossSpawnAlarm2Textbox.Text) < 10) + { BossSpawnAlarm2Textbox.Text = "0" + int.Parse(BossSpawnAlarm2Textbox.Text); } + if (int.Parse(BossSpawnAlarm3Textbox.Text) < 10) + { BossSpawnAlarm3Textbox.Text = "0" + int.Parse(BossSpawnAlarm3Textbox.Text); } + + string bitResult = ""; + if (BossSpawnAlarmCheckBox1.IsChecked == true) + { bitResult += BossSpawnAlarm1Textbox.Text + "," + "1,"; } + else + { bitResult += BossSpawnAlarm1Textbox.Text + "," + "0,"; } + + if (BossSpawnAlarmCheckBox2.IsChecked == true) + { bitResult += BossSpawnAlarm2Textbox.Text + "," + "1,"; } + else + { bitResult += BossSpawnAlarm2Textbox.Text + "," + "0,"; } + + if (BossSpawnAlarmCheckBox3.IsChecked == true) + { bitResult += BossSpawnAlarm3Textbox.Text + "," + "1"; } + else + { bitResult += BossSpawnAlarm3Textbox.Text + "," + "0"; } + + + Settings.Default["BossSpawnAlarmCheckBox"] = bitResult; + Settings.Default.Save(); + } + + private void BossSpawnAlarm1Textbox_LostFocus(object sender, RoutedEventArgs e) + { + SaveBossSapwnAlrarmSettings(); + } + + private void BossSpawnAlarm2Textbox_LostFocus(object sender, RoutedEventArgs e) + { + SaveBossSapwnAlrarmSettings(); + } + + private void BossSpawnAlarmCheckBox2_Click(object sender, RoutedEventArgs e) + { + SaveBossSapwnAlrarmSettings(); + } + + private void BossSpawnAlarm3Textbox_LostFocus(object sender, RoutedEventArgs e) + { + SaveBossSapwnAlrarmSettings(); + } + + private void BossSpawnAlarmCheckBox3_Click(object sender, RoutedEventArgs e) + { + SaveBossSapwnAlrarmSettings(); + } + private void SaveNightTimeAlrarmSettings() + { + if (NightTimeAlarm1Textbox.Text == "") + { NightTimeAlarm1Textbox.Text = "30"; } + if (NightTimeAlarm2Textbox.Text == "") + { NightTimeAlarm2Textbox.Text = "15"; } + if (NightTimeAlarm3Textbox.Text == "") + { NightTimeAlarm3Textbox.Text = "05"; } + + if (NightTimeAlarm1Textbox.Text == "0") + { NightTimeAlarm1Textbox.Text = "30"; } + if (NightTimeAlarm2Textbox.Text == "0") + { NightTimeAlarm2Textbox.Text = "15"; } + if (NightTimeAlarm3Textbox.Text == "0") + { NightTimeAlarm3Textbox.Text = "05"; } + + if (int.Parse(NightTimeAlarm1Textbox.Text) < 10) + { NightTimeAlarm1Textbox.Text = "0" + int.Parse(NightTimeAlarm1Textbox.Text); } + if (int.Parse(NightTimeAlarm2Textbox.Text) < 10) + { NightTimeAlarm2Textbox.Text = "0" + int.Parse(NightTimeAlarm2Textbox.Text); } + if (int.Parse(NightTimeAlarm3Textbox.Text) < 10) + { NightTimeAlarm3Textbox.Text = "0" + int.Parse(NightTimeAlarm3Textbox.Text); } + + string bitResult = ""; + if (NightTimeAlarmCheckBox1.IsChecked == true) + { bitResult += NightTimeAlarm1Textbox.Text + "," + "1,"; } + else + { bitResult += NightTimeAlarm1Textbox.Text + "," + "0,"; } + + if (NightTimeAlarmCheckBox2.IsChecked == true) + { bitResult += NightTimeAlarm2Textbox.Text + "," + "1,"; } + else + { bitResult += NightTimeAlarm2Textbox.Text + "," + "0,"; } + + if (NightTimeAlarmCheckBox3.IsChecked == true) + { bitResult += NightTimeAlarm3Textbox.Text + "," + "1"; } + else + { bitResult += NightTimeAlarm3Textbox.Text + "," + "0"; } + + + Settings.Default["NightTimeAlarmCheckBox"] = bitResult; + Settings.Default.Save(); + } + + private void NightTimeAlarm1Textbox_LostFocus(object sender, RoutedEventArgs e) + { + SaveNightTimeAlrarmSettings(); + } + + private void NightTimeAlarmCheckBox1_Click(object sender, RoutedEventArgs e) + { + SaveNightTimeAlrarmSettings(); + } + + private void NightTimeAlarm2Textbox_LostFocus(object sender, RoutedEventArgs e) + { + SaveNightTimeAlrarmSettings(); + } + + private void NightTimeAlarmCheckBox2_Click(object sender, RoutedEventArgs e) + { + SaveNightTimeAlrarmSettings(); + } + + private void NightTimeAlarm3Textbox_LostFocus(object sender, RoutedEventArgs e) + { + SaveNightTimeAlrarmSettings(); + } + + private void NightTimeAlarmCheckBox3_Click(object sender, RoutedEventArgs e) + { + SaveNightTimeAlrarmSettings(); + } + + private void SaveImperialResetAlrarmSettings() + { + if (ImperialResetAlarm1Textbox.Text == "") + { ImperialResetAlarm1Textbox.Text = "30"; } + if (ImperialResetAlarm2Textbox.Text == "") + { ImperialResetAlarm2Textbox.Text = "15"; } + if (ImperialResetAlarm3Textbox.Text == "") + { ImperialResetAlarm3Textbox.Text = "05"; } + + if (ImperialResetAlarm1Textbox.Text == "0") + { ImperialResetAlarm1Textbox.Text = "30"; } + if (ImperialResetAlarm2Textbox.Text == "0") + { ImperialResetAlarm2Textbox.Text = "15"; } + if (ImperialResetAlarm3Textbox.Text == "0") + { ImperialResetAlarm3Textbox.Text = "05"; } + + if (int.Parse(ImperialResetAlarm1Textbox.Text) < 10) + { ImperialResetAlarm1Textbox.Text = "0" + int.Parse(ImperialResetAlarm1Textbox.Text); } + if (int.Parse(ImperialResetAlarm2Textbox.Text) < 10) + { ImperialResetAlarm2Textbox.Text = "0" + int.Parse(ImperialResetAlarm2Textbox.Text); } + if (int.Parse(ImperialResetAlarm3Textbox.Text) < 10) + { ImperialResetAlarm3Textbox.Text = "0" + int.Parse(ImperialResetAlarm3Textbox.Text); } + + string bitResult = ""; + if (ImperialResetCheckBox1.IsChecked == true) + { bitResult += ImperialResetAlarm1Textbox.Text + "," + "1,"; } + else + { bitResult += ImperialResetAlarm1Textbox.Text + "," + "0,"; } + + if (ImperialResetCheckBox2.IsChecked == true) + { bitResult += ImperialResetAlarm2Textbox.Text + "," + "1,"; } + else + { bitResult += ImperialResetAlarm2Textbox.Text + "," + "0,"; } + + if (ImperialResetCheckBox3.IsChecked == true) + { bitResult += ImperialResetAlarm3Textbox.Text + "," + "1"; } + else + { bitResult += ImperialResetAlarm3Textbox.Text + "," + "0"; } + + + Settings.Default["ImperialResetCheckBox"] = bitResult; + Settings.Default.Save(); + } + + private void ImperialResetAlarm1Textbox_LostFocus(object sender, RoutedEventArgs e) + { + SaveImperialResetAlrarmSettings(); + } + + private void ImperialResetCheckBox1_Click(object sender, RoutedEventArgs e) + { + SaveImperialResetAlrarmSettings(); + } + + private void ImperialResetAlarm2Textbox_LostFocus(object sender, RoutedEventArgs e) + { + SaveImperialResetAlrarmSettings(); + } + + private void ImperialResetCheckBox2_Click(object sender, RoutedEventArgs e) + { + SaveImperialResetAlrarmSettings(); + } + + private void ImperialResetAlarm3Textbox_LostFocus(object sender, RoutedEventArgs e) + { + SaveImperialResetAlrarmSettings(); + } + + private void ImperialResetCheckBox3_Click(object sender, RoutedEventArgs e) + { + SaveImperialResetAlrarmSettings(); + } + #endregion + private void CloseappButton_Click(object sender, RoutedEventArgs e) + { + this.Close(); + } + + + private async void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)// on closing action disconnect discord and animate fade out + { + try + { + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(Main_BotChannel_ID); + var messages = await channel.GetMessagesAsync(100).FlattenAsync(); //defualt is 100 + await (channel as SocketTextChannel).DeleteMessagesAsync(messages); + } + catch (Exception) { } + await discord.StopAsync(); + omw.Close(); + Closing -= Window_Closing; + e.Cancel = true; + var anim = new DoubleAnimation(0, (Duration)TimeSpan.FromSeconds(1)); + anim.Completed += (s, _) => System.Environment.Exit(1); + this.BeginAnimation(UIElement.OpacityProperty, anim); + } + + private void SendTotrayButton_Click(object sender, RoutedEventArgs e)//send app to tray + { + this.WindowState = WindowState.Minimized; + this.ShowInTaskbar = false; + MyNotifyIcon.Visible = true; + } + void MyNotifyIcon_MouseDoubleClick(object sender, System.Windows.Forms.MouseEventArgs e)// restore from tray by double clicking icon in tray + { + MyNotifyIcon.Visible = false; + this.ShowInTaskbar = true; + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + this.BeginAnimation(OpacityProperty, da); + this.WindowState = WindowState.Normal; + this.Topmost = true; + this.Topmost = false; + this.Focus(); + } + + private void appRestartButton_Click(object sender, RoutedEventArgs e) + { + System.Diagnostics.Process.Start(System.IO.Directory.GetCurrentDirectory() + "/ExternalAppRestart.exe"); + } + + private void ConnectDiscordBotButton_Click(object sender, RoutedEventArgs e) + { + System.Diagnostics.Process.Start("https://discordapp.com/oauth2/authorize?&client_id=" + ClientID + "&scope=bot&permissions=8"); + } + private async void DisconnectDiscordBot_Click(object sender, RoutedEventArgs e) + { + if (discord.ConnectionState == Discord.ConnectionState.Connected) + { + isposting = 0; + //var bc = new BrushConverter(); + //await discord.StopAsync(); + //DiscordBotConnectionStatusLabel.Foreground = (Brush)bc.ConvertFrom("#FFBB3D3D"); + //DiscordBotConnectionStatusLabel.Content = LanguageCollection[5].ToString(); + try + { + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(Main_BotChannel_ID); + var messages = await channel.GetMessagesAsync(100).FlattenAsync(); //defualt is 100 + await (channel as SocketTextChannel).DeleteMessagesAsync(messages); + } + catch (Exception) { } + new Thread(() => + { + Thread.CurrentThread.IsBackground = true; + Discord_Bot Bot = new Discord_Bot(); + Bot.GetDiscordData(this); + }).Start(); + } + } + private async void GetIds() + { + UTCombobox.SelectedIndex = -1; + UTCombobox.Items.Clear(); + + BSPRComboBox.SelectedIndex = -1; + BSPRComboBox.Items.Clear(); + NTPRComboBox.SelectedIndex = -1; + NTPRComboBox.Items.Clear(); + IRPRComboBox.SelectedIndex = -1; + IRPRComboBox.Items.Clear(); + BRPRComboBox.SelectedIndex = -1; + BRPRComboBox.Items.Clear(); + ITRPRComboBox.SelectedIndex = -1; + ITRPRComboBox.Items.Clear(); + SelRollingRoleComboBox.Items.Clear(); + SelRollingRoleComboBox.SelectedIndex = -1; + SidCombobox.SelectedIndex = -1; + SidCombobox.Items.Clear(); + ChidCombobox.SelectedIndex = -1; + ChidCombobox.Items.Clear(); + AlertChidCombobox.Items.Clear(); + RollingChannelComboBox.Items.Clear(); + AlertChidCombobox.SelectedIndex = -1; + SRFTBCombobox.Items.Clear(); + SRFTBCombobox.SelectedIndex = -1; + + ServersCollection.Clear(); + ChannelsCollection.Clear(); + AlertChannelsCollection.Clear(); + RolesCollection.Clear(); + SelfRollingRolesCollections.Clear(); + + SidCombobox.Items.Add("None"); + ServersCollection.Add("0"); + ChidCombobox.Items.Add("None"); + AlertChidCombobox.Items.Add("None"); + RollingChannelComboBox.Items.Add("None"); + ChannelsCollection.Add("0"); + AlertChannelsCollection.Add("0"); + RolesCollection.Add(""); + RolesCollection.Add("@everyone"); + RolesCollection.Add("@here"); + BSPRComboBox.Items.Add("None"); + BSPRComboBox.Items.Add("@everyone"); + BSPRComboBox.Items.Add("@here"); + NTPRComboBox.Items.Add("None"); + NTPRComboBox.Items.Add("@everyone"); + NTPRComboBox.Items.Add("@here"); + IRPRComboBox.Items.Add("None"); + IRPRComboBox.Items.Add("@everyone"); + IRPRComboBox.Items.Add("@here"); + BRPRComboBox.Items.Add("None"); + BRPRComboBox.Items.Add("@everyone"); + BRPRComboBox.Items.Add("@here"); + ITRPRComboBox.Items.Add("None"); + ITRPRComboBox.Items.Add("@everyone"); + ITRPRComboBox.Items.Add("@here"); + SRFTBCombobox.Items.Add("None"); + SRFTBCombobox.Items.Add("@everyone"); + SRFTBCombobox.Items.Add("@here"); + int SV = 2; + while (true) + { + if (SV < 60) + { UTCombobox.Items.Add(SV.ToString()); } + + SV++; + if (SV > 50) + { break; } + } + //IReadOnlyCollection Channels = null; + SocketGuild guild = null; + if (discord.ConnectionState == Discord.ConnectionState.Connected) + { + Discord_Bot bot = new Discord_Bot(); + + IReadOnlyCollection Servers = null; + Processing_Status(false, "Fetching Data..."); + await Task.Run(() => { Servers = bot.Get_Guilds(this); }); + foreach(var server in Servers) { if(server.Id == ServerID) { guild = server; break; } } + //Channels = guild.TextChannels; + //await Task.Run(() => { Channels = bot.Get_Channels(this, guild); }); + //await Task.Run(() => { Roles = bot.Get_Roles(this, guild); }); + + + foreach (var Server in Servers) + { + ServersCollection.Add(Server.Id.ToString()); + SidCombobox.Items.Add(Server.ToString()); + } + foreach (var Channel in guild.TextChannels) + { + ChannelsCollection.Add(Channel.Id.ToString()); + ChidCombobox.Items.Add(Channel.ToString()); + } + foreach (var Role in guild.Roles) + { + if (Role.ToString() != "@everyone") + { + RolesCollection.Add(Role.Id.ToString()); + SelfRollingRolesCollections.Add(Role.Id.ToString()); + SRFTBCombobox.Items.Add("@" + Role.ToString()); + BSPRComboBox.Items.Add("@" + Role.ToString()); + NTPRComboBox.Items.Add("@" + Role.ToString()); + IRPRComboBox.Items.Add("@" + Role.ToString()); + BRPRComboBox.Items.Add("@" + Role.ToString()); + ITRPRComboBox.Items.Add("@" + Role.ToString()); + SelRollingRoleComboBox.Items.Add("@" + Role.ToString()); + } + } + } + TimeTableGrid.Visibility = Visibility.Hidden; + CidTextbox.Text = ClientID.ToString(); + TokenTextbox.Text = Token; + + string[] sid = ProfileCollection[3].ToString().Split('{'); + SidCombobox.Text = sid[0].ToString(); + if (SidCombobox.SelectedIndex == -1) + { + if (sid[1].ToString() != "") + { + try + { + //ulong Server_id = ulong.Parse(sid[1].ToString()); + //var Server = discord.GetGuild(Server_id); + SidCombobox.Text = guild.Name.ToString(); + } + catch (Exception) { SidCombobox.Text = "None"; } + } + else + { SidCombobox.Text = "None"; } + } + + string[] cid = ProfileCollection[4].ToString().Split('{'); + ChidCombobox.Text = cid[0]; + if (ChidCombobox.SelectedIndex == -1) + { + if (cid[1].ToString() != "") + { + try + { + //var guild = discord.GetGuild(ServerID); + SocketGuildChannel channel = guild.GetTextChannel(ulong.Parse(cid[1].ToString())); + foreach(var chn in guild.TextChannels) { if(chn.Id == ulong.Parse(cid[1].ToString())) { channel = chn; break; } } + ChidCombobox.Text = channel.Name.ToString(); + } + catch (Exception) { ChidCombobox.Text = "None"; } + } + else + { ChidCombobox.Text = "None"; } + } + foreach (var Channel in guild.TextChannels) + { + if (Channel.Id != ulong.Parse(ProfileCollection[4].ToString().Split('{')[1])) + { + AlertChidCombobox.Items.Add(Channel.ToString()); + AlertChannelsCollection.Add(Channel.Id.ToString()); + RollingChannelComboBox.Items.Add(Channel.ToString()); + } + } + string[] Alertcid = ProfileCollection[12].ToString().Split('{'); + AlertChidCombobox.Text = Alertcid[0]; + if (AlertChidCombobox.SelectedIndex == -1) + { + if (Alertcid[1].ToString() != "") + { + try + { + var channel = guild.GetTextChannel(ulong.Parse(Alertcid[1].ToString())); + AlertChidCombobox.Text = channel.Name.ToString(); + } + catch (Exception) { AlertChidCombobox.Text = "None"; } + } + else + { AlertChidCombobox.Text = "None"; } + } + string[] rollingId = GetStrBetweenTags(File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/SelfRolling"), "[Channel]", "[/Channel]").Split('{'); + RollingChannelComboBox.Text = rollingId[0]; + if (RollingChannelComboBox.SelectedIndex == -1) + { + if (rollingId[1].ToString() != "") + { + try + { + var channel = guild.GetTextChannel(ulong.Parse(rollingId[1].ToString())); + RollingChannelComboBox.Text = channel.Name.ToString(); + } + catch (Exception) { RollingChannelComboBox.Text = "None"; } + } + else + { RollingChannelComboBox.Text = "None"; } + } + string[] bsr = ProfileCollection[5].ToString().Split('{'); + BSPRComboBox.Text = bsr[0].ToString(); + if (BSPRComboBox.SelectedIndex == -1) + { + if (bsr[1].ToString() != "") + { + try + { + ulong Role_id = ulong.Parse(bsr[1].ToString()); + var Role = guild.GetRole(Role_id); + BSPRComboBox.Text = "@" + Role.Name.ToString(); + } + catch (Exception) { BSPRComboBox.Text = "None"; } + } + else + { BSPRComboBox.Text = "None"; } + } + + string[] ntr = ProfileCollection[6].ToString().Split('{'); + NTPRComboBox.Text = ntr[0].ToString(); + if (NTPRComboBox.SelectedIndex == -1) + { + if (ntr[1].ToString() != "") + { + try + { + ulong Role_id = ulong.Parse(ntr[1].ToString()); + var Role = guild.GetRole(Role_id); + NTPRComboBox.Text = "@" + Role.Name.ToString(); + } + catch (Exception) { NTPRComboBox.Text = "None"; } + } + else + { NTPRComboBox.Text = "None"; } + } + + string[] irr = ProfileCollection[7].ToString().Split('{'); + IRPRComboBox.Text = irr[0].ToString(); + if (IRPRComboBox.SelectedIndex == -1) + { + if (irr[1].ToString() != "") + { + try + { + ulong Role_id = ulong.Parse(irr[1].ToString()); + var Role = guild.GetRole(Role_id); + IRPRComboBox.Text = "@" + Role.Name.ToString(); + } + catch (Exception) { IRPRComboBox.Text = "None"; } + } + else + { IRPRComboBox.Text = "None"; } + } + + string[] brr = ProfileCollection[10].ToString().Split('{'); + BRPRComboBox.Text = brr[0].ToString(); + if (BRPRComboBox.SelectedIndex == -1) + { + if (brr[1].ToString() != "") + { + try + { + ulong Role_id = ulong.Parse(brr[1].ToString()); + var Role = guild.GetRole(Role_id); + BRPRComboBox.Text = "@" + Role.Name.ToString(); + } + catch (Exception) { BRPRComboBox.Text = "None"; } + } + else + { BRPRComboBox.Text = "None"; } + } + + string[] itrr = ProfileCollection[11].ToString().Split('{'); + ITRPRComboBox.Text = itrr[0].ToString(); + if (ITRPRComboBox.SelectedIndex == -1) + { + if (itrr[1].ToString() != "") + { + try + { + ulong Role_id = ulong.Parse(itrr[1].ToString()); + var Role = guild.GetRole(Role_id); + ITRPRComboBox.Text = "@" + Role.Name.ToString(); + } + catch (Exception) { ITRPRComboBox.Text = "None"; } + } + else + { ITRPRComboBox.Text = "None"; } + } + + UTCombobox.Text = UpdateMesssageInterval.ToString(); + if(UTCombobox.SelectedIndex == -1) + { UTCombobox.Text = "2"; UpdateMesssageInterval = 2; } + if (DefaultLanguage == "fr") + { LanguageDropBox.Text = "Français"; } + if (DefaultLanguage == "en") + { LanguageDropBox.Text = "English"; } + if (DefaultLanguage == "es") + { LanguageDropBox.Text = "Español"; } + if (DefaultLanguage == "ru") + { LanguageDropBox.Text = "русский"; } + if (DefaultLanguage == "jp") + { LanguageDropBox.Text = "日本人"; } + if (DefaultLanguage == "kr") + { LanguageDropBox.Text = "한국어"; } + + language_changed = LanguageDropBox.SelectedIndex; + Processing_Status(true, "Loading Complete."); + } + private async void SettingsButton_Click(object sender, RoutedEventArgs e)// load Profile settings on click + { + if (discord.ConnectionState == Discord.ConnectionState.Connected) + { + if (tabcontrol1.SelectedIndex == 2) + { savebosslist(); } + if (SourceComboBox.SelectedIndex == 0 && tabcontrol1.SelectedIndex == 1) + { Save_LYPBBTTT(); GetLYPBBTTimeTable(); } + GetIds(); + + try + { + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + tabcontrol1.BeginAnimation(OpacityProperty, da); + } + catch (Exception) { } + tabcontrol1.SelectedIndex = 3; + var bc = new BrushConverter(); + Homehighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + Timetablehighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + bosslisthighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + SelfRollingHighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + settingshighlight.Fill = (Brush)bc.ConvertFrom(subcolor); + } + else + { + try + { + var bc = new BrushConverter(); + + DiscordBotConnectionStatusLabel.Foreground = (Brush)bc.ConvertFrom("#FFF1F1F1"); + DiscordBotConnectionStatusLabel.Content = LanguageCollection[6].ToString();//"Connecting..."; + await discord.LoginAsync(TokenType.Bot, Token); + await discord.StartAsync(); + System.Threading.Thread.Sleep(1000); + + if (DiscordBotConnectionStatusLabel.Content.ToString() == LanguageCollection[6].ToString()) + { + DiscordBotConnectionStatusLabel.Foreground = (Brush)bc.ConvertFrom("#FF669174"); + DiscordBotConnectionStatusLabel.Content = LanguageCollection[8].ToString();//"Connected"; + } + } + catch (Exception) + { + var bc = new BrushConverter(); + DiscordBotConnectionStatusLabel.Foreground = (Brush)bc.ConvertFrom("#FFBB3D3D"); + DiscordBotConnectionStatusLabel.Content = LanguageCollection[7].ToString();//"Connection ERROR!"; + ErrorMessageBox emb = new ErrorMessageBox(LanguageCollection[119].ToString(), LanguageCollection[120].ToString(), LanguageCollection[121].ToString(), LanguageCollection[122].ToString()); + emb.TestToken(LanguageCollection[112], discord, this, Token); + emb.Show(); + this.IsEnabled = false; + + /*StartPosting();*/ + } + } + } + private void ChidCombobox_DropDownClosed(object sender, EventArgs e) + { + AlertChidCombobox.Items.Clear(); + AlertChannelsCollection.Clear(); + AlertChidCombobox.Items.Add("None"); + RollingChannelComboBox.Items.Add("None"); + AlertChannelsCollection.Add("0"); + RollingChannelComboBox.Items.Clear(); + foreach (var channel in discord.GetGuild(ServerID).TextChannels) + { + if (channel.Id != ulong.Parse(ChannelsCollection[ChidCombobox.SelectedIndex])) + { + AlertChidCombobox.Items.Add(channel.ToString()); + AlertChannelsCollection.Add(channel.Id.ToString()); + RollingChannelComboBox.Items.Add(channel.ToString()); + } + } + if (ulong.Parse(ChannelsCollection[ChidCombobox.SelectedIndex]) != ulong.Parse(ProfileCollection[12].Split('{')[1]) && ChidCombobox.SelectedIndex != 0) + { + AlertChidCombobox.Text = ProfileCollection[12].Split('{')[0]; + } + if (AlertChidCombobox.SelectedIndex == -1) + { AlertChidCombobox.SelectedIndex = 0; } + } + private void SaveGlobalSettings() + { + ClientID = ulong.Parse(CidTextbox.Text); + Token = TokenTextbox.Text; + ServerID = ulong.Parse(ServersCollection[SidCombobox.SelectedIndex].ToString()); + Main_BotChannel_ID = ulong.Parse(ChannelsCollection[ChidCombobox.SelectedIndex].ToString()); + BossSpawnRole = RolesCollection[BSPRComboBox.SelectedIndex].ToString(); + Alert_BotChannel_ID = ulong.Parse(AlertChannelsCollection[AlertChidCombobox.SelectedIndex]); + + if (BossSpawnRole != "") + { + if (BossSpawnRole != "@everyone" && BossSpawnRole != "@here") + { BossSpawnRole = "<@&" + BossSpawnRole + ">"; } + } + NightTimeRole = RolesCollection[NTPRComboBox.SelectedIndex].ToString(); + if (NightTimeRole != "") + { + if (NightTimeRole != "@everyone" && NightTimeRole != "@here") + { NightTimeRole = "<@&" + NightTimeRole + ">"; } + } + ImperialResetRole = RolesCollection[IRPRComboBox.SelectedIndex].ToString(); + if (ImperialResetRole != "") + { + if (ImperialResetRole != "@everyone" && ImperialResetRole != "@here") + { ImperialResetRole = "<@&" + ImperialResetRole + ">"; } + } + BarteringResetRole = RolesCollection[BRPRComboBox.SelectedIndex].ToString(); + if (BarteringResetRole != "") + { + if (BarteringResetRole != "@everyone" && BarteringResetRole != "@here") + { BarteringResetRole = "<@&" + BarteringResetRole + ">"; } + } + ImperialTradingResetRole = RolesCollection[ITRPRComboBox.SelectedIndex].ToString(); + if (ImperialTradingResetRole != "") + { + if (ImperialTradingResetRole != "@everyone" && ImperialTradingResetRole != "@here") + { ImperialTradingResetRole = "<@&" + ImperialTradingResetRole + ">"; } + } + UpdateMesssageInterval = int.Parse(UTCombobox.Text); + //AnouncmentMessageInterval = int.Parse(RMMCombobox.Text); + File.WriteAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/DA_Profile", DefaultLanguage + "|" + + CidTextbox.Text + "|" + + TokenTextbox.Text + "|" + + SidCombobox.Text + "{" + ServersCollection[SidCombobox.SelectedIndex].ToString() + "|" + + ChidCombobox.Text+ "{" + ChannelsCollection[ChidCombobox.SelectedIndex].ToString() + "|" + + BSPRComboBox.Text + "{" + RolesCollection[BSPRComboBox.SelectedIndex].ToString() + "|" + + NTPRComboBox.Text + "{" + RolesCollection[NTPRComboBox.SelectedIndex].ToString() + "|" + + IRPRComboBox.Text + "{" + RolesCollection[IRPRComboBox.SelectedIndex].ToString() + "|" + + UTCombobox.Text + "|" + + "0" + "|" + + BRPRComboBox.Text + "{" + RolesCollection[BRPRComboBox.SelectedIndex].ToString() + "|" + + ITRPRComboBox.Text + "{" + RolesCollection[ITRPRComboBox.SelectedIndex].ToString() + "|" + + AlertChidCombobox.Text + "{" + AlertChannelsCollection[AlertChidCombobox.SelectedIndex]); + + ProfileCollection.Clear(); + ProfileCollection.Add(DefaultLanguage); + ProfileCollection.Add(CidTextbox.Text); + ProfileCollection.Add(TokenTextbox.Text); + ProfileCollection.Add(SidCombobox.Text + "{" + ServersCollection[SidCombobox.SelectedIndex].ToString()); + ProfileCollection.Add(ChidCombobox.Text + "{" + ChannelsCollection[ChidCombobox.SelectedIndex].ToString()); + ProfileCollection.Add(BSPRComboBox.Text + "{" + RolesCollection[BSPRComboBox.SelectedIndex].ToString()); + ProfileCollection.Add(NTPRComboBox.Text + "{" + RolesCollection[NTPRComboBox.SelectedIndex].ToString()); + ProfileCollection.Add(IRPRComboBox.Text + "{" + RolesCollection[IRPRComboBox.SelectedIndex].ToString()); + ProfileCollection.Add(UTCombobox.Text); + ProfileCollection.Add("0"); + ProfileCollection.Add(BRPRComboBox.Text + "{" + RolesCollection[BRPRComboBox.SelectedIndex].ToString()); + ProfileCollection.Add(ITRPRComboBox.Text + "{" + RolesCollection[ITRPRComboBox.SelectedIndex].ToString()); + ProfileCollection.Add(AlertChidCombobox.Text + "{" + AlertChannelsCollection[AlertChidCombobox.SelectedIndex]); + + //StartPosting(); + //FIX + if (BSA1CMTextBox.Text == "") + { + BSA1CMTextBox.Text = LanguageCollection[76].ToString(); + } + if (BSA1CMTextBox.Text == LanguageCollection[76].ToString()) + { + Settings.Default["BSA1CM"] = ""; + Settings.Default.Save(); + } + else + { + Settings.Default["BSA1CM"] = BSA1CMTextBox.Text; + Settings.Default.Save(); + } + + if (BSA2CMTextBox.Text == "") + { + BSA2CMTextBox.Text = LanguageCollection[76].ToString(); + } + if (BSA2CMTextBox.Text == LanguageCollection[76].ToString()) + { + Settings.Default["BSA2CM"] = ""; + Settings.Default.Save(); + } + else + { + Settings.Default["BSA2CM"] = BSA2CMTextBox.Text; + Settings.Default.Save(); + } + + if (BSA3CMTextBox.Text == "") + { + BSA3CMTextBox.Text = LanguageCollection[76].ToString(); + } + if (BSA3CMTextBox.Text == LanguageCollection[76].ToString()) + { + Settings.Default["BSA3CM"] = ""; + Settings.Default.Save(); + } + else + { + Settings.Default["BSA3CM"] = BSA3CMTextBox.Text; + Settings.Default.Save(); + } + + + if (NTA1CMTextbBox.Text == "") + { + NTA1CMTextbBox.Text = LanguageCollection[78].ToString(); + } + if (NTA1CMTextbBox.Text == LanguageCollection[78].ToString()) + { + Settings.Default["NTA1CM"] = ""; + Settings.Default.Save(); + } + else + { + Settings.Default["NTA1CM"] = NTA1CMTextbBox.Text; + Settings.Default.Save(); + } + + if (NTA2CMTextbBox.Text == "") + { + NTA2CMTextbBox.Text = LanguageCollection[78].ToString(); + } + if (NTA2CMTextbBox.Text == LanguageCollection[78].ToString()) + { + Settings.Default["NTA2CM"] = ""; + Settings.Default.Save(); + } + else + { + Settings.Default["NTA2CM"] = NTA2CMTextbBox.Text; + Settings.Default.Save(); + } + + if (NTA3CMTextbBox.Text == "") + { + NTA3CMTextbBox.Text = LanguageCollection[78].ToString(); + } + if (NTA3CMTextbBox.Text == LanguageCollection[78].ToString()) + { + Settings.Default["NTA3CM"] = ""; + Settings.Default.Save(); + } + else + { + Settings.Default["NTA3CM"] = NTA3CMTextbBox.Text; + Settings.Default.Save(); + } + + + if (IRA1CMTextBox.Text == "") + { + IRA1CMTextBox.Text = LanguageCollection[80].ToString(); + } + if (IRA1CMTextBox.Text == LanguageCollection[80].ToString()) + { + Settings.Default["IRA1CM"] = ""; + Settings.Default.Save(); + } + else + { + Settings.Default["IRA1CM"] = IRA1CMTextBox.Text; + Settings.Default.Save(); + } + + if (IRA2CMTextBox.Text == "") + { + IRA2CMTextBox.Text = LanguageCollection[80].ToString(); + } + if (IRA2CMTextBox.Text == LanguageCollection[80].ToString()) + { + Settings.Default["IRA2CM"] = ""; + Settings.Default.Save(); + } + else + { + Settings.Default["IRA2CM"] = IRA2CMTextBox.Text; + Settings.Default.Save(); + } + + if (IRA3CMTextBox.Text == "") + { + IRA3CMTextBox.Text = LanguageCollection[80].ToString(); + } + if (IRA3CMTextBox.Text == LanguageCollection[80].ToString()) + { + Settings.Default["IRA3CM"] = ""; + Settings.Default.Save(); + } + else + { + Settings.Default["IRA3CM"] = IRA3CMTextBox.Text; + Settings.Default.Save(); + } + + + if (BRA1CMTextBox.Text == "") + { + BRA1CMTextBox.Text = LanguageCollection[82].ToString(); + } + if (BRA1CMTextBox.Text == LanguageCollection[82].ToString()) + { + Settings.Default["BRA1CM"] = ""; + Settings.Default.Save(); + } + else + { + Settings.Default["BRA1CM"] = BRA1CMTextBox.Text; + Settings.Default.Save(); + } + + if (BRA2CMTextBox.Text == "") + { + BRA2CMTextBox.Text = LanguageCollection[82].ToString(); + } + if (BRA2CMTextBox.Text == LanguageCollection[82].ToString()) + { + Settings.Default["BRA2CM"] = ""; + Settings.Default.Save(); + } + else + { + Settings.Default["BRA2CM"] = BRA2CMTextBox.Text; + Settings.Default.Save(); + } + + if (BRA3CMTextBox.Text == "") + { + BRA3CMTextBox.Text = LanguageCollection[82].ToString(); + } + if (BRA3CMTextBox.Text == LanguageCollection[82].ToString()) + { + Settings.Default["BRA3CM"] = ""; + Settings.Default.Save(); + } + else + { + Settings.Default["BRA3CM"] = BRA3CMTextBox.Text; + Settings.Default.Save(); + } + //FIX + if (ITRA1CMTextBox.Text == "") + { + ITRA1CMTextBox.Text = LanguageCollection[84].ToString(); + } + if (ITRA1CMTextBox.Text == LanguageCollection[84].ToString()) + { + Settings.Default["ITRA1CM"] = ""; + Settings.Default.Save(); + } + else + { + Settings.Default["ITRA1CM"] = ITRA1CMTextBox.Text; + Settings.Default.Save(); + } + + if (ITRA2CMTextBox.Text == "") + { + ITRA2CMTextBox.Text = LanguageCollection[84].ToString(); + } + if (ITRA2CMTextBox.Text == LanguageCollection[84].ToString()) + { + Settings.Default["ITRA2CM"] = ""; + Settings.Default.Save(); + } + else + { + Settings.Default["ITRA2CM"] = ITRA2CMTextBox.Text; + Settings.Default.Save(); + } + + if (ITRA3CMTextBox.Text == "") + { + ITRA3CMTextBox.Text = LanguageCollection[84].ToString(); + } + if (ITRA3CMTextBox.Text == LanguageCollection[84].ToString()) + { + Settings.Default["ITRA3CM"] = ""; + Settings.Default.Save(); + } + else + { + Settings.Default["ITRA3CM"] = ITRA3CMTextBox.Text; + Settings.Default.Save(); + } + tabcontrol1.SelectedIndex = 0; + try + { + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + tabcontrol1.BeginAnimation(OpacityProperty, da); + } + catch (Exception) { } + + } + + private void HrdResetAppButton_Click(object sender, RoutedEventArgs e)// format app saved data + { + ErrorMessageBox emb = new ErrorMessageBox(LanguageCollection[119].ToString(), LanguageCollection[120].ToString(), LanguageCollection[121].ToString(), LanguageCollection[122].ToString()); + emb.MB_typeYN(LanguageCollection[113].ToString(), LanguageCollection[114].ToString(), 0, this); + emb.Show(); + IsEnabled = false; + } + public async void confirmhardreset() + { + Settings.Default["DefaultRegion"] = ""; + Settings.Default["BossSpawnAlarmCheckBox"] = ""; + Settings.Default["NightTimeAlarmCheckBox"] = ""; + Settings.Default["ImperialResetCheckBox"] = ""; + Settings.Default["PlaySoundSetting"] = ""; + Settings.Default["OverlayTransparency"] = ""; + Settings.Default["OverlayState"] = ""; + Settings.Default["NTPlaySoundSetting"] = ""; + Settings.Default["IRPlaySoundSetting"] = ""; + Settings.Default["DisplayTimeTableSetting"] = ""; + Settings.Default["BSA1CM"] = ""; + Settings.Default["BSA2CM"] = ""; + Settings.Default["BSA3CM"] = ""; + Settings.Default["NTA1CM"] = ""; + Settings.Default["NTA2CM"] = ""; + Settings.Default["NTA3CM"] = ""; + Settings.Default["IRA1CM"] = ""; + Settings.Default["IRA2CM"] = ""; + Settings.Default["IRA3CM"] = ""; + Settings.Default["EditSpawnHoursSlider"] = ""; + Settings.Default["SettingKeepMessages"] = ""; + Settings.Default["AlarmonhoursCheckbox"] = ""; + Settings.Default["BRAlarmCheckBox"] = ""; + Settings.Default["ITRAlarmCheckBox"] = ""; + Settings.Default["ITRA1CM"] = ""; + Settings.Default["ITRA2CM"] = ""; + Settings.Default["ITRA3CM"] = ""; + Settings.Default["BRA1CM"] = ""; + Settings.Default["BRA2CM"] = ""; + Settings.Default["BRA3CM"] = ""; + Settings.Default["SelectedSource"] = ""; + Settings.Default["DefaultRegion1"] = ""; + Settings.Default["MainColor"] = ""; + Settings.Default["SubColor"] = ""; + Settings.Default["HeaderColor"] = ""; + Settings.Default["OriginBossList"] = ""; + Settings.Default["AnimatedBackgroundSource"] = ""; + Settings.Default["AnimatedBackgroundCheckbox"] = ""; + Settings.Default["BackgroundImageSource"] = ""; + Settings.Default["BackgroundImageCheckbox"] = ""; + Settings.Default["BRPlaySoundSetting"] = ""; + Settings.Default["ITRPlaySoundSetting"] = ""; + Settings.Default["Overlay_Position"] = ""; + Settings.Default["High_RenderQuality"] = ""; + Settings.Default["ScarletMode"] = ""; + Settings.Default["SelfRolling"] = ""; + Settings.Default["AutoUpdateTable"] = ""; + Settings.Default.Save(); + await discord.StopAsync(); + File.Delete(System.IO.Directory.GetCurrentDirectory() + "/Resources/DA_Profile"); + File.Delete(System.IO.Directory.GetCurrentDirectory() + "/Resources/DA_Bosses"); + File.Delete(System.IO.Directory.GetCurrentDirectory() + "/Resources/LYPBBTTT"); + File.Delete(System.IO.Directory.GetCurrentDirectory() + "/Resources/SelfRolling"); + System.Diagnostics.Process.Start(System.IO.Directory.GetCurrentDirectory() + "/Launcher.exe"); + Close(); + } + + #region "Help Buttons" + private void Button_Click(object sender, RoutedEventArgs e) + { System.Diagnostics.Process.Start(System.IO.Directory.GetCurrentDirectory() + "/Resources/img/Step2CID.mp4"); } + + private void Button_Click_1(object sender, RoutedEventArgs e) + { System.Diagnostics.Process.Start(System.IO.Directory.GetCurrentDirectory() + "/Resources/img/Step4GetToken.mp4"); } + + private void Button_Click_6(object sender, RoutedEventArgs e) + { System.Diagnostics.Process.Start(System.IO.Directory.GetCurrentDirectory() + "/Resources/img/ConvertRole.mp4"); } + #endregion + private void SoundOptionCheckBox_Click(object sender, RoutedEventArgs e)//save sound settings + { + if (SoundOptionCheckBox.IsChecked == true) + { + Settings.Default["PlaySoundSetting"] = "1"; + Settings.Default.Save(); + } + else + { + Settings.Default["PlaySoundSetting"] = "0"; + Settings.Default.Save(); + } + } + + private void IoverlayModeButton_Click(object sender, RoutedEventArgs e) + { + this.WindowState = WindowState.Minimized; + this.ShowInTaskbar = false; + //MyNotifyIcon.Visible = true; + try + { + BitmapImage img = new BitmapImage(); + img = NBImageBox.Source as BitmapImage; + omw = new DA_OverlayModWindow(this); + omw.load(img); + omw.Show(); + //omw.Visibility = Visibility.Visible; + } + catch (Exception) { omw.Show(); } + overlayState = 1; + } + + private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) + { + OverlayTransperancyValueLabel.Content = TransparacySlider.Value.ToString(); + OverlayTransperancyValueLabel.Opacity = (TransparacySlider.Value) + 0.1; + Settings.Default["OverlayTransparency"] = TransparacySlider.Value.ToString(); + Settings.Default.Save(); + } + public void GetOverlayState() + { + overlayState = 0; + MyNotifyIcon.Visible = false; + this.ShowInTaskbar = true; + + if (Settings.Default["PlaySoundSetting"].ToString() == "") + { SoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["PlaySoundSetting"].ToString() == "1") + { SoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["PlaySoundSetting"].ToString() == "0") + { SoundOptionCheckBox.IsChecked = false; } + + if (Settings.Default["NTPlaySoundSetting"].ToString() == "") + { NTSoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["NTPlaySoundSetting"].ToString() == "1") + { NTSoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["NTPlaySoundSetting"].ToString() == "0") + { NTSoundOptionCheckBox.IsChecked = false; } + + if (Settings.Default["IRPlaySoundSetting"].ToString() == "") + { IRSoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["IRPlaySoundSetting"].ToString() == "1") + { IRSoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["IRPlaySoundSetting"].ToString() == "0") + { IRSoundOptionCheckBox.IsChecked = false; } + + if (Settings.Default["BRPlaySoundSetting"].ToString() == "") + { BRSoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["BRPlaySoundSetting"].ToString() == "1") + { BRSoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["BRPlaySoundSetting"].ToString() == "0") + { BRSoundOptionCheckBox.IsChecked = false; } + + if (Settings.Default["ITRPlaySoundSetting"].ToString() == "") + { ITRSoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["ITRPlaySoundSetting"].ToString() == "1") + { ITRSoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["ITRPlaySoundSetting"].ToString() == "0") + { ITRSoundOptionCheckBox.IsChecked = false; } + + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + this.BeginAnimation(OpacityProperty, da); + this.WindowState = WindowState.Normal; + this.Topmost = true; + this.Topmost = false; + this.Focus(); + } + + private void NTSoundOptionCheckBox_Click(object sender, RoutedEventArgs e) + { + if (NTSoundOptionCheckBox.IsChecked == true) + { + Settings.Default["NTPlaySoundSetting"] = "1"; + Settings.Default.Save(); + } + else + { + Settings.Default["NTPlaySoundSetting"] = "0"; + Settings.Default.Save(); + } + } + + private void IRSoundOptionCheckBox_Click(object sender, RoutedEventArgs e) + { + if (IRSoundOptionCheckBox.IsChecked == true) + { + Settings.Default["IRPlaySoundSetting"] = "1"; + Settings.Default.Save(); + } + else + { + Settings.Default["IRPlaySoundSetting"] = "0"; + Settings.Default.Save(); + } + } + private void BRSoundOptionCheckBox_Click(object sender, RoutedEventArgs e) + { + if (BRSoundOptionCheckBox.IsChecked == true) + { + Settings.Default["BRPlaySoundSetting"] = "1"; + Settings.Default.Save(); + } + else + { + Settings.Default["BRPlaySoundSetting"] = "0"; + Settings.Default.Save(); + } + } + private void ITRSoundOptionCheckBox_Click(object sender, RoutedEventArgs e) + { + if (ITRSoundOptionCheckBox.IsChecked == true) + { + Settings.Default["ITRPlaySoundSetting"] = "1"; + Settings.Default.Save(); + } + else + { + Settings.Default["ITRPlaySoundSetting"] = "0"; + Settings.Default.Save(); + } + } + + #region "max minutes allowed for alerts" + private void BossSpawnAlarm1Textbox_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + if (int.Parse(BossSpawnAlarm1Textbox.Text) > 59) + { BossSpawnAlarm1Textbox.Text = "59"; } + } + catch (Exception) { } + } + + private void BossSpawnAlarm2Textbox_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + if (int.Parse(BossSpawnAlarm2Textbox.Text) > 59) + { BossSpawnAlarm2Textbox.Text = "59"; } + } + catch (Exception) { } + } + + private void BossSpawnAlarm3Textbox_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + if (int.Parse(BossSpawnAlarm3Textbox.Text) > 59) + { BossSpawnAlarm3Textbox.Text = "59"; } + } + catch (Exception) { } + } + + private void NightTimeAlarm1Textbox_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + if (int.Parse(NightTimeAlarm1Textbox.Text) > 59) + { NightTimeAlarm1Textbox.Text = "59"; } + } + catch (Exception) { } + } + + private void NightTimeAlarm2Textbox_TextChanged(object sender, TextChangedEventArgs e) + { + if (int.Parse(NightTimeAlarm2Textbox.Text) > 59) + { NightTimeAlarm2Textbox.Text = "59"; } + } + + private void NightTimeAlarm3Textbox_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + if (int.Parse(NightTimeAlarm3Textbox.Text) > 59) + { NightTimeAlarm3Textbox.Text = "59"; } + } + catch (Exception) { } + } + + private void ImperialResetAlarm1Textbox_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + if (int.Parse(ImperialResetAlarm1Textbox.Text) > 59) + { ImperialResetAlarm1Textbox.Text = "59"; } + } + catch (Exception) { } + } + + private void ImperialResetAlarm2Textbox_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + if (int.Parse(ImperialResetAlarm2Textbox.Text) > 59) + { ImperialResetAlarm2Textbox.Text = "59"; } + } + catch (Exception) { } + } + + private void ImperialResetAlarm3Textbox_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + if (int.Parse(ImperialResetAlarm3Textbox.Text) > 59) + { ImperialResetAlarm3Textbox.Text = "59"; } + } + catch (Exception) { } + } + #endregion + + private void EditMessage()//update Timers on discord + { + try + { + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(Main_BotChannel_ID); + var Message = MainMessage; /*await channel.GetMessageAsync(MainMessageID) as IUserMessage;*/ + string message = ""; + string nb = "> ```cs" + Environment.NewLine + "> " + CurrentBossTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; + string nti = "> ```cs" + Environment.NewLine + "> " + NightInBdoTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; + string iri = "> ```cs" + Environment.NewLine + "> " + IRTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; + string br = "> ```cs" + Environment.NewLine + "> " + BRTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; + string itr = "> ```cs" + Environment.NewLine + "> " + ITRITimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; + if (CurrentBossTimeLabel.Content.ToString().StartsWith("00:")) + { nb = "> ```css" + Environment.NewLine + "> " + CurrentBossTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; } + if (NightInBdoTimeLabel.Content.ToString().StartsWith("00:")) + { nti = "> ```css" + Environment.NewLine + "> " + NightInBdoTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; } + if (IRTimeLabel.Content.ToString().StartsWith("00:")) + { iri = "> ```css" + Environment.NewLine + "> " + IRTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; } + if (BRTimeLabel.Content.ToString().StartsWith("00:")) + { br = "> ```css" + Environment.NewLine + "> " + BRTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; } + if (ITRITimeLabel.Content.ToString().StartsWith("00:")) + { itr = "> ```css" + Environment.NewLine + "> " + ITRITimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; } + + if (ScarletModeTimeTableSetting_CheckBox.IsChecked == true) + { Update_ScarletMode(); } + + message = "> " + CbossLabel.Content.ToString() + Environment.NewLine + + nb + Environment.NewLine + + "> " + NILabel.Content.ToString() + Environment.NewLine + + nti + Environment.NewLine + + "> " + IRILabel.Content.ToString() + Environment.NewLine + + iri + Environment.NewLine + + "> " + BRILabel.Content.ToString() + Environment.NewLine + + br + Environment.NewLine + + "> " + ITRILabel.Content.ToString() + Environment.NewLine + + itr + + Environment.NewLine + + Environment.NewLine + + Updated_ScarletMode_Message; + //var MainMessage = await channel.SendMessageAsync(message); + Message.ModifyAsync(msg => msg.Content = message);//must be non await to prevent over stack call + MainMessage = Message; + + } + catch (Exception) { } + } + private async void StartPostingButton_Click(object sender, RoutedEventArgs e) + { + Discord_Bot Bot = new Discord_Bot(); + StartPostingButton.IsEnabled = false; + await Task.Run(() => { Bot.StartPosting(this); Bot.StartPosting_Cooldown(this); }); + //MessageBox.Show(((GC.GetTotalMemory(true) / 1024f) / 1024f).ToString()); + //MessageBox.Show(BossesCollection.FirstOrDefault(s => s.Split(',')[0].ToLower() == "Nouver".ToLower())); + //var guild = discord.GetGuild(ServerID); + //var emojis = guild.Emotes; + //string url = ""; + //foreach (var m in emojis) + //{ + // url = m.Url; + //} + //Getimg gm = new Getimg(); + //try { SSRR_Img.Source = gm.GETIMAGE(url); } catch (Exception) { } + } + + private async void DisplayTimeTableSetting_Click(object sender, RoutedEventArgs e)// time table discplay option + { + if (discord.ConnectionState == Discord.ConnectionState.Connected && isposting == 1) + { + if (DisplayTimeTableSetting.IsChecked == true) + { + if (TimtableID == 0) + { + try { gridview1.SelectedIndex = SharedDay; } catch (Exception) { } + if (File.Exists(System.IO.Directory.GetCurrentDirectory() + "/Resources/TimeTable.png")) + { File.Delete(System.IO.Directory.GetCurrentDirectory() + "/Resources/TimeTable.png"); } + //int width = int.Parse(gridview1.ActualWidth.ToString());//error + //int height = int.Parse(gridview1.ActualHeight.ToString()); + RenderTargetBitmap renderTargetBitmap = + new RenderTargetBitmap(1920, 1080, 180, 250, PixelFormats.Pbgra32); + renderTargetBitmap.Render(gridview1); + PngBitmapEncoder pngImage = new PngBitmapEncoder(); + pngImage.Frames.Add(BitmapFrame.Create(renderTargetBitmap)); + using (Stream fileStream = File.Create(System.IO.Directory.GetCurrentDirectory() + "/Resources/TimeTable.png")) + { + pngImage.Save(fileStream); + } + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(Main_BotChannel_ID); + var timetablemessage = await channel.SendFileAsync(System.IO.Directory.GetCurrentDirectory() + "/Resources/TimeTable.png", MOTR.ToString().ToUpper() + LanguageCollection[43].ToString()); + TimtableID = timetablemessage.Id; + } + + Settings.Default["DisplayTimeTableSetting"] = "1"; + Settings.Default.Save(); + } + else + { + if (TimtableID != 0) + { + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(Main_BotChannel_ID); + await channel.DeleteMessageAsync(TimtableID); + TimtableID = 0; + } + + Settings.Default["DisplayTimeTableSetting"] = "0"; + Settings.Default.Save(); + } + } + else + { + if (DisplayTimeTableSetting.IsChecked == true) + { + Settings.Default["DisplayTimeTableSetting"] = "1"; + Settings.Default.Save(); + } + else + { + Settings.Default["DisplayTimeTableSetting"] = "0"; + Settings.Default.Save(); + } + } + } + #region "Discord Notify By ping" + private async void DiscordNotifyBossSpwn(string bossmessage) + { + if (discord.ConnectionState == Discord.ConnectionState.Connected && isposting == 1) + { + try + { + if (bossmessage.Contains("<00:00:00>")) + { bossmessage = bossmessage.Replace("<00:00:00>", CurrentBossTimeLabel.Content.ToString()); } + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(Alert_BotChannel_ID); + string ANmessage = ""; + string[] pbu = publicbossUrl.Split('|'); + string[] bnu = CbossNameLabel.Content.ToString().Split('&'); + if (CbossNameLabel.Content.ToString().Contains("&")) + { ANmessage = LanguageCollection[123].ToString() + Environment.NewLine + "[" + bnu[0] + "](" + pbu[0] + ")" + " <---" + LanguageCollection[85].ToString() + Environment.NewLine + "[" + bnu[1] + "](" + pbu[1] + ")" + " <---" + LanguageCollection[85].ToString(); } + else { ANmessage = LanguageCollection[123].ToString() + Environment.NewLine + "[" + bnu[0] + "](" + pbu[0] + ")" + " <---" + LanguageCollection[85].ToString(); } + var Alert_Embed = new EmbedBuilder + { + Title = CbossNameLabel.Content.ToString() /*+ " <---" + LanguageCollection[87].ToString()*/, + ThumbnailUrl = publicNbossimage, + Color = Discord.Color.LightGrey, + //Url = publicbossUrl + Description = bossmessage.Replace("", "") + Environment.NewLine +ANmessage + }; + await channel.SendMessageAsync(">" + " " + BossSpawnRole + " " + currentbossrole1 + " " + currentbossrole2 ,false , Alert_Embed.Build()); + } + catch (Exception) { } + } + } + private async void DiscordNotifyNightTime(string custommessage) + { + if (discord.ConnectionState == Discord.ConnectionState.Connected && isposting == 1) + { + try + { + if (custommessage.Contains("<00:00:00>")) + { custommessage = custommessage.Replace("<00:00:00>", NightInBdoTimeLabel.Content.ToString()); } + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(Alert_BotChannel_ID); + var Alert_Embed = new EmbedBuilder + { + Title = "Night Time" /*+ " <---" + LanguageCollection[87].ToString()*/, + ThumbnailUrl = "https://raw.githubusercontent.com/kresmes/BDO-Boss-Timer-Discord-Bot-Yuri-Project-/master/Resources/Images/day-and-night.png", + Color = Discord.Color.LightGrey, + //Url = publicbossUrl + Description = custommessage + }; + await channel.SendMessageAsync("> " + NightTimeRole, false , Alert_Embed.Build()); + } + catch (Exception) { } + } + } + private async void DiscordNotifyImperialReset(string custommessage) + { + if (discord.ConnectionState == Discord.ConnectionState.Connected && isposting == 1) + { + try + { + if (custommessage.Contains("<00:00:00>")) + { custommessage = custommessage.Replace("<00:00:00>", IRTimeLabel.Content.ToString()); } + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(Alert_BotChannel_ID); + var Alert_Embed = new EmbedBuilder + { + Title = "Imperial Reset" /*+ " <---" + LanguageCollection[87].ToString()*/, + ThumbnailUrl = "https://raw.githubusercontent.com/kresmes/BDO-Boss-Timer-Discord-Bot-Yuri-Project-/master/Resources/Images/BS_icon.png", + Color = Discord.Color.LightGrey, + //Url = publicbossUrl + Description = custommessage + }; + await channel.SendMessageAsync("> " + ImperialResetRole, false, Alert_Embed.Build()); + } + catch (Exception) { } + } + } + private async void DiscordNotifyBR(string custommessage) + { + if (discord.ConnectionState == Discord.ConnectionState.Connected && isposting == 1) + { + try + { + if (custommessage.Contains("<00:00:00>")) + { custommessage = custommessage.Replace("<00:00:00>", BRTimeLabel.Content.ToString()); } + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(Alert_BotChannel_ID); + var Alert_Embed = new EmbedBuilder + { + Title = "Bartering Reset" /*+ " <---" + LanguageCollection[87].ToString()*/, + ThumbnailUrl = "https://raw.githubusercontent.com/kresmes/BDO-Boss-Timer-Discord-Bot-Yuri-Project-/master/Resources/Images/BS_icon.png", + Color = Discord.Color.LightGrey, + //Url = publicbossUrl + Description = custommessage + }; + await channel.SendMessageAsync("> " + BarteringResetRole, false, Alert_Embed.Build()); + } + catch (Exception) { } + } + } + private async void DiscordNotifyITR(string custommessage) + { + if (discord.ConnectionState == Discord.ConnectionState.Connected && isposting == 1) + { + try + { + if (custommessage.Contains("<00:00:00>")) + { custommessage = custommessage.Replace("<00:00:00>", BRTimeLabel.Content.ToString()); } + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(Alert_BotChannel_ID); + var Alert_Embed = new EmbedBuilder + { + Title = "Imperial Trading Reset" /*+ " <---" + LanguageCollection[87].ToString()*/, + ThumbnailUrl = "https://raw.githubusercontent.com/kresmes/BDO-Boss-Timer-Discord-Bot-Yuri-Project-/master/Resources/Images/BS_icon.png", + Color = Discord.Color.LightGrey, + //Url = publicbossUrl + Description = custommessage + }; + await channel.SendMessageAsync("> " + ImperialTradingResetRole, false, Alert_Embed.Build()); + } + catch (Exception) { } + } + } + #endregion + + private async void GetUrlSource(string url) + { + //int i = 0; + //CefSharpSettings.LegacyJavascriptBindingEnabled = false; + //CefSharpSettings.WcfEnabled = false; + + //webbrowser1.Address = url; + //webbrowser1.LoadingStateChanged += (sender1, args) => + //{ + // if (args.IsLoading == false) + // { + // i = 1; + // } + //}; + //while (true) + //{ + // Thread.Sleep(500); + // if (i == 1) + // { + // var htmlSource = await webbrowser1.GetSourceAsync(); + // if (SourceComboBox.SelectedIndex == 2) + // { GetBdoBossTimer(htmlSource); } + // break; + // } + //} + } + + private async void GetBdoBossTimer(string source) + { + //webbrowser1.Address = "about:blank"; + var htmlDoc = new HtmlDocument(); + htmlDoc.LoadHtml(source); + currentbossrole1 = ""; + currentbossrole2 = ""; + publicbossUrl = ""; + timer1.Stop(); + startupRS = 0; + + PbossNamLabel.Content = "X"; + + var cSecondboss = ""; + try { cSecondboss = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[1]/div[2]/div/div/div[1]/div[2]/div[2]/h2").InnerText; } catch (Exception) { } + CbossNameLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[1]/div[2]/div/div/div[1]/div[2]/div[1]/h2").InnerText; + if (cSecondboss != "") + { CbossNameLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[1]/div[2]/div/div/div[1]/div[2]/div[1]/h2").InnerText + " & " + cSecondboss; } + CurrentBossTimeLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[1]/div[2]/div/div/div[1]/div[1]/div[6]/div[1]").InnerText; + + var nSecondboss = ""; + try { nSecondboss = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[1]/div[2]/div/div/div[1]/div[3]/div[3]/h5").InnerText; } catch (Exception) { } + NBossNameLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[1]/div[2]/div/div/div[1]/div[3]/div[2]/h5").InnerText; + if (nSecondboss != "") + { NBossNameLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[1]/div[2]/div/div/div[1]/div[3]/div[2]/h5").InnerText + " & " + nSecondboss; } + NextBossTimeLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[1]/div[2]/div/div/div[1]/div[3]/div[1]/h3[2]/span").InnerText; + + try { NightInBdoTimeLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[1]/div[2]/div/div/div[1]/div[4]/div[1]/p[1]/span[2]").InnerText; } catch (Exception) { } + try { IRTimeLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[1]/div[2]/div/div/div[1]/div[4]/div[2]/p[1]/span[2]").InnerText; } catch (Exception) { } + try { BRTimeLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[1]/div[2]/div/div/div[1]/div[4]/div[1]/p[2]/span[2]").InnerText; } catch (Exception) { } + try { ITRITimeLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[1]/div[2]/div/div/div[1]/div[4]/div[2]/p[2]/span[2]").InnerText; } catch (Exception) { } + try { NILabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[1]/div[2]/div/div/div[1]/div[4]/div[1]/p[1]/span[1]").InnerText; } catch (Exception) { } + + if (NILabel.Content.ToString() == "Night in") + { NILabel.Content = LanguageCollection[25].ToString(); } + else + { NILabel.Content = LanguageCollection[107].ToString(); } + + RegionComboBox.Items.Clear(); + RegionComboBox.Items.Add("eu".ToUpper()); + RegionComboBox.Items.Add("jp".ToUpper()); + RegionComboBox.Items.Add("kr".ToUpper()); + RegionComboBox.Items.Add("mena".ToUpper()); + RegionComboBox.Items.Add("na".ToUpper()); + RegionComboBox.Items.Add("ru".ToUpper()); + RegionComboBox.Items.Add("sa".ToUpper()); + RegionComboBox.Items.Add("sea".ToUpper()); + RegionComboBox.Items.Add("th".ToUpper()); + RegionComboBox.Items.Add("tw".ToUpper()); + RegionComboBox.Items.Add("xbox-na".ToUpper()); + RegionComboBox.Items.Add("xbox-eu".ToUpper()); + RegionComboBox.Items.Add("ps4-na".ToUpper()); + RegionComboBox.Items.Add("ps4-eu".ToUpper()); + RegionComboBox.Items.Add("ps4-asia".ToUpper()); + + RegionComboBox.Text = Settings.Default["DefaultRegion"].ToString().ToUpper(); + + if (RegionComboBox.SelectedIndex == -1) + { RegionComboBox.Text = "NA"; } + source = source.Replace(@"", @"" + Environment.NewLine); + string Timezone = GetStrBetweenTags(source, @""); + htmlDoc.LoadHtml(source); + var TimeRow = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[3]/div/div[2]/div/table/thead/tr").InnerText; + Clipboard.SetText(TimeRow); + string input = TimeRow; + string[] data = input.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); + try + { + TimeTable.Clear(); + for (int i = TimeTable.Rows.Count - 1; i >= 0; i--) + { + if (TimeTable.Rows[i][0].ToString() == "") + TimeTable.Rows[i].Delete(); + } + foreach (var column in TimeTable.Columns.Cast().ToArray()) + { + if (TimeTable.AsEnumerable().All(dr => dr.IsNull(column))) + TimeTable.Columns.Remove(column); + } + gridview1.ItemsSource = null; + TimeTable.AcceptChanges(); + } + catch (Exception) { } + int Crow = 0; + int Ccolumn = 0; + int MaxColumn = TimeTable.Columns.Count; + foreach (var bit in data) + { + if (Crow == 0 && Ccolumn == 0) + { + TimeTable.Columns.Add(Ccolumn.ToString()); + TimeTable.Rows.Add(new object[] { "" }); + DataRow dr = TimeTable.Rows[Crow]; + dr[Ccolumn] = Timezone; + Ccolumn++; + } + if (Crow == 0 && Ccolumn > 0 && bit.Length != 0 && bit.Length <= 6) + { + TimeTable.Columns.Add(Ccolumn.ToString()); + DataRow dr = TimeTable.Rows[Crow]; + dr[Ccolumn] = bit; + Ccolumn++; + } + } + int linP = 1; + int day = 1; + int ccl = 0; + int maxcl = TimeTable.Columns.Count; + TimeTable.Rows.Add(new object[] { "" }); + while (true) + { + foreach (var cl in TimeTable.Columns) + { + if (ccl == maxcl) + { + TimeTable.Rows.Add(new object[] { "" }); + day++; + ccl = 0; + linP = 1; + } + var obj = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[3]/div/div[2]/div/table/tbody/tr[" + day.ToString() + "]/td[" + linP.ToString() + "]").InnerText; + DataRow dr = TimeTable.Rows[day]; + string objF = obj.Replace("&", "," + Environment.NewLine); + dr[ccl] = objF; + ccl++; + linP++; + } + if (day == 7) + { break; } + } + + for (int i = TimeTable.Rows.Count - 1; i >= 0; i--) + { + if (TimeTable.Rows[i][0].ToString() == "") + TimeTable.Rows[i].Delete(); + } + + TimeTable.AcceptChanges(); + //int drow = 0; + int dayC = 0; + + SharedDay = dayC; + gridview1.ItemsSource = TimeTable.DefaultView; + + try + { + BossesCollection.Clear(); + BossCollectionListBox.Items.Clear(); + } + catch (Exception) { } + string BossesList = File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/DA_Bosses"); + string[] BossListSplited = BossesList.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); + foreach (string BossData in BossListSplited) + { + if (BossData != "") + { + BossesCollection.Add(BossData.Replace(Environment.NewLine, "")); + string bossName = BossData.Substring(0, BossData.IndexOf(",") + 1); + bossName = bossName.Replace(",", ""); + bossName = bossName.Replace(Environment.NewLine, ""); + BossCollectionListBox.Items.Add(bossName); + } + } + + PBImageBox.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/Bosses_img/Boss.png")); + NBImageBox.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/Bosses_img/Boss.png")); + LBImageBox.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/Bosses_img/Boss.png")); + Getimg gm = new Getimg(); + string First_boss = ""; + string Second_boss = ""; + foreach (string item in BossesCollection) + { + string bossName = item.Substring(0, item.IndexOf(",") + 1); + bossName = bossName.Replace(",", ""); + bossName = bossName.Replace(Environment.NewLine, ""); + + if (PbossNamLabel.Content.ToString().Contains(bossName)) + { + string[] bossdata = item.Split(','); + string imgurl = bossdata[1].ToString(); + if (bossdata[5].ToString() != "") + { + imgurl = bossdata[5].ToString(); + if (imgurl.Contains("")) + { imgurl = imgurl.Replace("", System.IO.Directory.GetCurrentDirectory()); } + } + try { PBImageBox.Source = gm.GETIMAGE(imgurl); } catch (Exception) { } + if (PbossNamLabel.Content.ToString().Contains("&")) + { try { PBImageBox.Source = gm.GETIMAGE(System.IO.Directory.GetCurrentDirectory() + "/Resources/Bosses_img/" + PbossNamLabel.Content.ToString() + ".png"); } catch (Exception) { } } + } + if (CbossNameLabel.Content.ToString().Contains(bossName)) + { + string[] bossdata = item.Split(','); + try + { + string imgurl = bossdata[1].ToString(); + if (bossdata[5].ToString() == "") + { + imgurl = bossdata[1].ToString(); + } + else + { + imgurl = bossdata[5].ToString(); + if (imgurl.Contains("")) + { imgurl = imgurl.Replace("", System.IO.Directory.GetCurrentDirectory()); } + } + publicNbossimage = bossdata[1].ToString(); + if (!CbossNameLabel.Content.ToString().Contains("&")) + { publicbossUrl = bossdata[2].ToString(); } + else + { + if (publicbossUrl == "") + { publicbossUrl = bossdata[2].ToString(); } + else + { publicbossUrl += " | " + bossdata[2].ToString(); } + } + NBImageBox.Source = gm.GETIMAGE(imgurl); + if (CbossNameLabel.Content.ToString().Contains("&")) + { try { NBImageBox.Source = gm.GETIMAGE(System.IO.Directory.GetCurrentDirectory() + "/Resources/Bosses_img/" + CbossNameLabel.Content.ToString() + ".png"); } catch (Exception) { } } + + } + catch (Exception) { } + } + + if (cSecondboss.Contains(bossName) && CbossNameLabel.Content.ToString().Contains("&") && cSecondboss != "") + { + string[] bossdata = item.Split(','); + if (publicbossUrl == "") + { publicbossUrl = bossdata[2].ToString(); } + else + { publicbossUrl += "|" + bossdata[2].ToString(); } + } + if (NBossNameLabel.Content.ToString().Contains(bossName)) + { + string[] bossdata = item.Split(','); + string imgurl = bossdata[1].ToString(); + if (bossdata[5].ToString() != "") + { + imgurl = bossdata[5].ToString(); + if (imgurl.Contains("")) + { imgurl = imgurl.Replace("", System.IO.Directory.GetCurrentDirectory()); } + } + try { LBImageBox.Source = gm.GETIMAGE(imgurl); } catch (Exception) { } + if (NBossNameLabel.Content.ToString().Contains("&")) + { try { LBImageBox.Source = gm.GETIMAGE(System.IO.Directory.GetCurrentDirectory() + "/Resources/Bosses_img/" + NBossNameLabel.Content.ToString() + ".png"); } catch (Exception) { } } + //if (bossdata[3].ToString() != "") + //{ NBossNameLabel.Content = bossdata[3].ToString(); } + } + + } + + if (PbossNamLabel.Content.ToString().Contains(" & ")) + { + string fullbossname = ""; + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = PbossNamLabel.Content.ToString(); + name = name.Substring(0, name.IndexOf("&")); + if (name.Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString() + " & "; + } + } + } + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = PbossNamLabel.Content.ToString(); + name = name.Substring(name.IndexOf("&") + 1); + if (name.Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString(); + } + } + } + if (fullbossname != "") + { PbossNamLabel.Content = fullbossname; } + + } + else + { + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + if (PbossNamLabel.Content.ToString().Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { PbossNamLabel.Content = bossdata[3].ToString(); } + } + + } + } + + if (CbossNameLabel.Content.ToString().Contains(" & ")) + { + string fullbossname = ""; + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = CbossNameLabel.Content.ToString(); + name = name.Substring(0, name.IndexOf("&")); + First_boss = name; + if (name.Contains(bossdata[0].ToString())) + { + string[] br = bossdata[4].ToString().Split('{'); + currentbossrole1 = br[1].ToString(); + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString() + " & "; + } + } + } + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = CbossNameLabel.Content.ToString(); + name = name.Substring(name.IndexOf("&") + 1); + Second_boss = name; + if (name.Contains(bossdata[0].ToString())) + { + string[] br = bossdata[4].ToString().Split('{'); + currentbossrole2 = br[1].ToString(); + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString(); + } + } + } + if (fullbossname != "") + { CbossNameLabel.Content = fullbossname; } + } + else + { + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + if (CbossNameLabel.Content.ToString().Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { + string[] br = bossdata[4].ToString().Split('{'); + currentbossrole1 = br[1].ToString(); + CbossNameLabel.Content = bossdata[3].ToString(); + } + else + { + string[] br = bossdata[4].ToString().Split('{'); + currentbossrole1 = br[1].ToString(); + } + } + + } + } + if (NBossNameLabel.Content.ToString().Contains(" & ")) + { + string fullbossname = ""; + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = NBossNameLabel.Content.ToString(); + name = name.Substring(0, name.IndexOf("&")); + if (name.Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString() + " & "; + } + } + } + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = NBossNameLabel.Content.ToString(); + name = name.Substring(name.IndexOf("&") + 1); + if (name.Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString(); + } + } + } + if (fullbossname != "") + { NBossNameLabel.Content = fullbossname; } + } + else + { + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + if (NBossNameLabel.Content.ToString().Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { NBossNameLabel.Content = bossdata[3].ToString(); } + } + + } + } + + SaveLatestTimeTable = 0; + intervalMessageUpdate = UpdateMesssageInterval; + if (CbossNameLabel.Content.ToString().Contains(" & ")) + { + publicNbossimage = "https://raw.githubusercontent.com/kresmes/BDO-Boss-Timer-Discord-Bot-Yuri-Project-/master/Resources/Images/" + First_boss.Replace(" ", "") + "%20%26%20" + Second_boss.Replace(" ", "") + ".png"; + } + if (discord.ConnectionState == Discord.ConnectionState.Connected && isposting == 1) + { + try + { + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(Main_BotChannel_ID); + var Message = await channel.GetMessageAsync(bossImageID) as IUserMessage; + string[] pbu = publicbossUrl.Split('|'); + string[] bnu = CbossNameLabel.Content.ToString().Split('&'); + string ANmessage = ""; + if (CbossNameLabel.Content.ToString().Contains("&")) + { + ANmessage = LanguageCollection[123].ToString() + Environment.NewLine + "[" + bnu[0] + "](" + pbu[0] + ")" + " <---" + LanguageCollection[85].ToString() + Environment.NewLine + "[" + bnu[1] + "](" + pbu[1] + ")" + " <---" + LanguageCollection[85].ToString(); + } + else + { + ANmessage = LanguageCollection[123].ToString() + Environment.NewLine + "[" + bnu[0] + "](" + pbu[0] + ")" + " <---" + LanguageCollection[85].ToString(); + } + var embed1 = new EmbedBuilder + { + Title = CbossNameLabel.Content.ToString() /*+ " <---" + LanguageCollection[87].ToString()*/, + ImageUrl = publicNbossimage, + Color = Color.LightGrey, + //Url = publicbossUrl + Description = ANmessage + }; + await Message.ModifyAsync(msg => msg.Embed = embed1.Build()); + } + catch (Exception) { } + } + if (EditSpawnHoursSlider.Value.ToString().Contains("-")) + { + DateTime PDT = DateTime.Parse(PreviousBossTimeLabel.Content.ToString()); + string pdtl = PDT.AddHours(double.Parse(EditSpawnHoursSlider.Value.ToString().Replace("-", "+"))).ToString(@"hh\:mm\:ss"); + PreviousBossTimeLabel.Content = pdtl; + + DateTime CDT = DateTime.Parse(CurrentBossTimeLabel.Content.ToString()); + string cbtl = CDT.AddHours(EditSpawnHoursSlider.Value).ToString(@"hh\:mm\:ss"); + CurrentBossTimeLabel.Content = cbtl; + + DateTime NDT = DateTime.Parse(NextBossTimeLabel.Content.ToString()); + string nbtl = NDT.AddHours(EditSpawnHoursSlider.Value).ToString(@"hh\:mm\:ss"); + NextBossTimeLabel.Content = nbtl; + } + if (EditSpawnHoursSlider.Value > 0) + { + DateTime PDT = DateTime.Parse(PreviousBossTimeLabel.Content.ToString()); + string pdtl = PDT.AddHours(double.Parse("-" + EditSpawnHoursSlider.Value.ToString())).ToString(@"hh\:mm\:ss"); + PreviousBossTimeLabel.Content = pdtl; + + DateTime CDT = DateTime.Parse(CurrentBossTimeLabel.Content.ToString()); + string cbtl = CDT.AddHours(EditSpawnHoursSlider.Value).ToString(@"hh\:mm\:ss"); + CurrentBossTimeLabel.Content = cbtl; + + DateTime NDT = DateTime.Parse(NextBossTimeLabel.Content.ToString()); + string nbtl = NDT.AddHours(EditSpawnHoursSlider.Value).ToString(@"hh\:mm\:ss"); + NextBossTimeLabel.Content = nbtl; + } + if (currentbossrole1 != "") + { + if(currentbossrole1 != "@everyone" && currentbossrole1 != "@here") + { currentbossrole1 = "<@&" + currentbossrole1 + ">"; } + } + if (currentbossrole2 != "") + { + if (currentbossrole2 != "@everyone" && currentbossrole2 != "@here") + { currentbossrole2 = "<@&" + currentbossrole2 + ">"; } + } + + if (discord.ConnectionState == Discord.ConnectionState.Connected && isposting == 1) + { + if (DisplayTimeTableSetting.IsChecked == true) + { + if (TimtableID != 0) + { + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(Main_BotChannel_ID); + await channel.DeleteMessageAsync(TimtableID); + TimtableID = 0; + } + + if (TimtableID == 0) + { + try { gridview1.SelectedIndex = SharedDay; } catch (Exception) { } + if (File.Exists(System.IO.Directory.GetCurrentDirectory() + "/Resources/TimeTable.png")) + { File.Delete(System.IO.Directory.GetCurrentDirectory() + "/Resources/TimeTable.png"); } + //int width = int.Parse(gridview1.ActualWidth.ToString());//error + //int height = int.Parse(gridview1.ActualHeight.ToString()); + RenderTargetBitmap renderTargetBitmap = + new RenderTargetBitmap(1920, 1080, 180, 250, PixelFormats.Pbgra32); + renderTargetBitmap.Render(gridview1); + PngBitmapEncoder pngImage = new PngBitmapEncoder(); + pngImage.Frames.Add(BitmapFrame.Create(renderTargetBitmap)); + using (Stream fileStream = File.Create(System.IO.Directory.GetCurrentDirectory() + "/Resources/TimeTable.png")) + { + pngImage.Save(fileStream); + } + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(Main_BotChannel_ID); + var timetablemessage = await channel.SendFileAsync(System.IO.Directory.GetCurrentDirectory() + "/Resources/TimeTable.png", MOTR.ToString().ToUpper() + LanguageCollection[43].ToString()); + TimtableID = timetablemessage.Id; + } + } + } + + timer1.Start(); + + } + public static string GetStrBetweenTags(string value, string startTag, string endTag) + { + if (value.Contains(startTag) && value.Contains(endTag)) + { + int index = value.IndexOf(startTag) + startTag.Length; + return value.Substring(index, value.IndexOf(endTag) - index); + } + else + return null; + } + + private void SaveSettings2Button_Click(object sender, RoutedEventArgs e) + { + + + tabcontrol1.SelectedIndex = 3; + try + { + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + tabcontrol1.BeginAnimation(OpacityProperty, da); + } + catch (Exception) { } + } + + private void EditSpawnHoursSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) + { + //timer1.Stop(); + TimeSpan CC = TimeSpan.FromHours(1); + if (EditSpawnHoursSlider.Value > lastSliderValue) + { + TimeSpan PDT = TimeSpan.Parse(PreviousBossTimeLabel.Content.ToString()); + PreviousBossTimeLabel.Content = PDT.Subtract(CC).ToString(@"hh\:mm\:ss"); + + TimeSpan CDT = TimeSpan.Parse(CurrentBossTimeLabel.Content.ToString()); + CurrentBossTimeLabel.Content = CDT.Add(CC).ToString(@"hh\:mm\:ss"); + + TimeSpan NDT = TimeSpan.Parse(NextBossTimeLabel.Content.ToString()); + NextBossTimeLabel.Content = NDT.Add(CC).ToString(@"hh\:mm\:ss"); + } + else + { + TimeSpan PDT = TimeSpan.Parse(PreviousBossTimeLabel.Content.ToString()); + PreviousBossTimeLabel.Content = PDT.Add(CC).ToString(@"hh\:mm\:ss"); + + TimeSpan CDT = TimeSpan.Parse(CurrentBossTimeLabel.Content.ToString()); + CurrentBossTimeLabel.Content = CDT.Subtract(CC).ToString(@"hh\:mm\:ss"); + + TimeSpan NDT = TimeSpan.Parse(NextBossTimeLabel.Content.ToString()); + NextBossTimeLabel.Content = NDT.Subtract(CC).ToString(@"hh\:mm\:ss"); + } + lastSliderValue = EditSpawnHoursSlider.Value; + if (EditSpawnHoursSlider.Value.ToString().Contains("-")) + { EditSpawnHoursLabael1.Content = LanguageCollection[22].ToString() + " " + EditSpawnHoursSlider.Value; } + else + { EditSpawnHoursLabael1.Content = LanguageCollection[22].ToString() + " +" + EditSpawnHoursSlider.Value; } + if (EditSpawnHoursSlider.Value == 0) + { EditSpawnHoursLabael1.Content = LanguageCollection[22].ToString() + " " + EditSpawnHoursSlider.Value; } + Settings.Default["EditSpawnHoursSlider"] = EditSpawnHoursSlider.Value.ToString(); + Settings.Default.Save(); + } + + private void AlertonhousandminutesCheckBox_Click(object sender, RoutedEventArgs e) + { + if (AlertonhousandminutesCheckBox.IsChecked == true) + { + Settings.Default["AlarmonhoursCheckbox"] = "1"; + Settings.Default.Save(); + } + else + { + Settings.Default["AlarmonhoursCheckbox"] = "0"; + Settings.Default.Save(); + } + } + + private void BRAlarm1Textbox_LostFocus(object sender, RoutedEventArgs e) + { + SaveBarteringResetAlrarmSettings(); + } + private void SaveBarteringResetAlrarmSettings() + { + if (BRAlarm1Textbox.Text == "") + { BRAlarm1Textbox.Text = "30"; } + if (BRAlarm2Textbox.Text == "") + { BRAlarm2Textbox.Text = "15"; } + if (BRAlarm3Textbox.Text == "") + { BRAlarm3Textbox.Text = "05"; } + + if (BRAlarm1Textbox.Text == "0") + { BRAlarm1Textbox.Text = "30"; } + if (BRAlarm2Textbox.Text == "0") + { BRAlarm2Textbox.Text = "15"; } + if (BRAlarm3Textbox.Text == "0") + { BRAlarm3Textbox.Text = "05"; } + + if (int.Parse(BRAlarm1Textbox.Text) < 10) + { BRAlarm1Textbox.Text = "0" + int.Parse(BRAlarm1Textbox.Text); } + if (int.Parse(BRAlarm2Textbox.Text) < 10) + { BRAlarm2Textbox.Text = "0" + int.Parse(BRAlarm2Textbox.Text); } + if (int.Parse(BRAlarm3Textbox.Text) < 10) + { BRAlarm3Textbox.Text = "0" + int.Parse(BRAlarm3Textbox.Text); } + + string bitResult = ""; + if (BRAlarmCheckBox1.IsChecked == true) + { bitResult += BRAlarm1Textbox.Text + "," + "1,"; } + else + { bitResult += BRAlarm1Textbox.Text + "," + "0,"; } + + if (BRAlarmCheckBox2.IsChecked == true) + { bitResult += BRAlarm2Textbox.Text + "," + "1,"; } + else + { bitResult += BRAlarm2Textbox.Text + "," + "0,"; } + + if (BRAlarmCheckBox3.IsChecked == true) + { bitResult += BRAlarm3Textbox.Text + "," + "1"; } + else + { bitResult += BRAlarm3Textbox.Text + "," + "0"; } + + Settings.Default["BRAlarmCheckBox"] = bitResult; + Settings.Default.Save(); + } + + private void BRAlarm1Textbox_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + if (int.Parse(BRAlarm1Textbox.Text) > 59) + { BRAlarm1Textbox.Text = "59"; } + } + catch (Exception) { } + } + + private void BRAlarm2Textbox_LostFocus(object sender, RoutedEventArgs e) + { + SaveBarteringResetAlrarmSettings(); + } + + private void BRAlarm2Textbox_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + if (int.Parse(BRAlarm2Textbox.Text) > 59) + { BRAlarm2Textbox.Text = "59"; } + } + catch (Exception) { } + } + + private void BRAlarm3Textbox_LostFocus(object sender, RoutedEventArgs e) + { + SaveBarteringResetAlrarmSettings(); + } + + private void BRAlarm3Textbox_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + if (int.Parse(BRAlarm3Textbox.Text) > 59) + { BRAlarm3Textbox.Text = "59"; } + } + catch (Exception) { } + } + + private void BRAlarmCheckBox1_Click(object sender, RoutedEventArgs e) + { + SaveBarteringResetAlrarmSettings(); + } + + private void BRAlarmCheckBox2_Click(object sender, RoutedEventArgs e) + { + SaveBarteringResetAlrarmSettings(); + } + + private void BRAlarmCheckBox3_Click(object sender, RoutedEventArgs e) + { + SaveBarteringResetAlrarmSettings(); + } + private void SaveImperialTradingResetAlrarmSettings() + { + if (ITRAlarm1Textbox.Text == "") + { ITRAlarm1Textbox.Text = "30"; } + if (ITRAlarm2Textbox.Text == "") + { ITRAlarm2Textbox.Text = "15"; } + if (ITRAlarm3Textbox.Text == "") + { ITRAlarm3Textbox.Text = "05"; } + + if (ITRAlarm1Textbox.Text == "0") + { ITRAlarm1Textbox.Text = "30"; } + if (ITRAlarm2Textbox.Text == "0") + { ITRAlarm2Textbox.Text = "15"; } + if (ITRAlarm3Textbox.Text == "0") + { ITRAlarm3Textbox.Text = "05"; } + + if (int.Parse(ITRAlarm1Textbox.Text) < 10) + { ITRAlarm1Textbox.Text = "0" + int.Parse(ITRAlarm1Textbox.Text); } + if (int.Parse(ITRAlarm2Textbox.Text) < 10) + { ITRAlarm2Textbox.Text = "0" + int.Parse(ITRAlarm2Textbox.Text); } + if (int.Parse(ITRAlarm3Textbox.Text) < 10) + { ITRAlarm3Textbox.Text = "0" + int.Parse(ITRAlarm3Textbox.Text); } + + string bitResult = ""; + if (ITRAlarmCheckBox1.IsChecked == true) + { bitResult += ITRAlarm1Textbox.Text + "," + "1,"; } + else + { bitResult += ITRAlarm1Textbox.Text + "," + "0,"; } + + if (ITRAlarmCheckBox2.IsChecked == true) + { bitResult += ITRAlarm2Textbox.Text + "," + "1,"; } + else + { bitResult += ITRAlarm2Textbox.Text + "," + "0,"; } + + if (ITRAlarmCheckBox3.IsChecked == true) + { bitResult += ITRAlarm3Textbox.Text + "," + "1"; } + else + { bitResult += ITRAlarm3Textbox.Text + "," + "0"; } + + + Settings.Default["ITRAlarmCheckBox"] = bitResult; + Settings.Default.Save(); + } + + private void ITRAlarm1Textbox_LostFocus(object sender, RoutedEventArgs e) + { + SaveImperialTradingResetAlrarmSettings(); + } + + private void ITRAlarmCheckBox1_Click(object sender, RoutedEventArgs e) + { + SaveImperialTradingResetAlrarmSettings(); + } + + private void ITRAlarm1Textbox_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + if (int.Parse(ITRAlarm1Textbox.Text) > 59) + { ITRAlarm1Textbox.Text = "59"; } + } + catch (Exception) { } + } + + private void ITRAlarm2Textbox_LostFocus(object sender, RoutedEventArgs e) + { + SaveImperialTradingResetAlrarmSettings(); + } + + private void ITRAlarm2Textbox_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + if (int.Parse(ITRAlarm2Textbox.Text) > 59) + { ITRAlarm2Textbox.Text = "59"; } + } + catch (Exception) { } + } + + private void ITRAlarmCheckBox2_Click(object sender, RoutedEventArgs e) + { + SaveImperialTradingResetAlrarmSettings(); + } + + private void ITRAlarm3Textbox_LostFocus(object sender, RoutedEventArgs e) + { + SaveImperialTradingResetAlrarmSettings(); + } + + private void ITRAlarm3Textbox_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + if (int.Parse(ITRAlarm3Textbox.Text) > 59) + { ITRAlarm3Textbox.Text = "59"; } + } + catch (Exception) { } + } + + private void ITRAlarmCheckBox3_Click(object sender, RoutedEventArgs e) + { + SaveImperialTradingResetAlrarmSettings(); + } + + + private void BotHostComboBox_DropDownClosed(object sender, EventArgs e) + { + + } + + private void SourceComboBox_DropDownClosed(object sender, EventArgs e) + { + if (lastSelectedSource != SourceComboBox.SelectedIndex) + { + Settings.Default["SelectedSource"] = SourceComboBox.SelectedIndex.ToString(); + Settings.Default.Save(); + lastSelectedSource = SourceComboBox.SelectedIndex; + string region = Settings.Default["DefaultRegion"].ToString();//get Last Saved Region + if (SourceComboBox.SelectedIndex == 0) + { GetLYPBBTTimeTable(); } + if (SourceComboBox.SelectedIndex == 1) + { GetTimeTable(region); } + if (SourceComboBox.SelectedIndex == 2) + { GetUrlSource("https://bdobosstimer.com/?&server=" + region); } + } + } + + private void AddnewBossTestImgLinkButtonLocal_Click(object sender, RoutedEventArgs e) + { + Getimg gm = new Getimg(); + DisplayImageLinkextBoxLocal.BorderBrush = Brushes.Silver; + AddSaveBossPictureBox.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/Bosses_img/Boss.png")); + string imgurl = DisplayImageLinkextBoxLocal.Text; + if (imgurl.Contains("")) + { imgurl = imgurl.Replace("", System.IO.Directory.GetCurrentDirectory()); } + try { AddSaveBossPictureBox.Source = gm.GETIMAGE(imgurl); } catch (Exception) { DisplayImageLinkextBoxLocal.BorderBrush = Brushes.Red; } + } + + public async void GetLYPBBTTimeTable() + { + try + { + ScarletMode_Message = ""; + ScarletModeTimeTableSetting_CheckBox.IsEnabled = true; + ScarletModeTimeTableSetting_CheckBox.IsChecked = bool.Parse(Settings.Default["ScarletMode"].ToString()); + botuptime = 0; + timer1.Stop(); + //Thread.Sleep(1000); + currentbossrole1 = ""; + currentbossrole2 = ""; + publicbossUrl = ""; + + RegionComboBox.Items.Clear(); + RegionComboBox.Items.Add("PS4-ASIA"); + RegionComboBox.Items.Add("EU"); + RegionComboBox.Items.Add("PS4-XBOX-EU"); + RegionComboBox.Items.Add("JP"); + RegionComboBox.Items.Add("KR"); + RegionComboBox.Items.Add("MENA"); + RegionComboBox.Items.Add("NA"); + RegionComboBox.Items.Add("PS4-XBOX-NA"); + RegionComboBox.Items.Add("RU"); + RegionComboBox.Items.Add("SA"); + RegionComboBox.Items.Add("SEA"); + RegionComboBox.Items.Add("TH"); + RegionComboBox.Items.Add("TW"); + + TimeTableBoss1DropBox.Items.Clear(); + TimeTableBoss1DropBox.Items.Add("None"); + TimeTableBoss1DropBox.Items.Add("Kzarka"); + TimeTableBoss1DropBox.Items.Add("NM Kzarka"); + TimeTableBoss1DropBox.Items.Add("Nouver"); + TimeTableBoss1DropBox.Items.Add("BS Nouver"); + TimeTableBoss1DropBox.Items.Add("Karanda"); + TimeTableBoss1DropBox.Items.Add("SB Karanda"); + TimeTableBoss1DropBox.Items.Add("Kutum"); + TimeTableBoss1DropBox.Items.Add("Offin"); + TimeTableBoss1DropBox.Items.Add("Garmoth"); + TimeTableBoss1DropBox.Items.Add("Quint"); + TimeTableBoss1DropBox.Items.Add("Muraka"); + TimeTableBoss1DropBox.Items.Add("Vell"); + + TimeTableBoss2DropBox.Items.Clear(); + TimeTableBoss2DropBox.Items.Add("None"); + TimeTableBoss2DropBox.Items.Add("Kzarka"); + TimeTableBoss2DropBox.Items.Add("NM Kzarka"); + TimeTableBoss2DropBox.Items.Add("Nouver"); + TimeTableBoss2DropBox.Items.Add("BS Nouver"); + TimeTableBoss2DropBox.Items.Add("Karanda"); + TimeTableBoss2DropBox.Items.Add("SB Karanda"); + TimeTableBoss2DropBox.Items.Add("Kutum"); + TimeTableBoss2DropBox.Items.Add("Offin"); + TimeTableBoss2DropBox.Items.Add("Garmoth"); + TimeTableBoss2DropBox.Items.Add("Quint"); + TimeTableBoss2DropBox.Items.Add("Muraka"); + TimeTableBoss2DropBox.Items.Add("Vell"); + + + TimeColumnHoursDropBox.Items.Clear(); + TimeColumnMinutesDropBox.Items.Clear(); + int HV = 0; + while (true) + { + if (HV < 24) + { + if (HV.ToString().Length == 1) + { TimeColumnHoursDropBox.Items.Add("0" + HV.ToString()); } + else + { TimeColumnHoursDropBox.Items.Add(HV.ToString()); } + } + if (HV.ToString().Length == 1) + { TimeColumnMinutesDropBox.Items.Add("0" + HV.ToString()); } + else + { TimeColumnMinutesDropBox.Items.Add(HV.ToString()); } + + HV++; + if (HV > 59) + { break; } + } + + string timetable = File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/LYPBBTTT"); + RegionComboBox.Text = Settings.Default["DefaultRegion"].ToString().ToUpper(); + if (RegionComboBox.Text == "") + { RegionComboBox.Text = "EU"; } + int rsi = RegionComboBox.SelectedIndex; + int UtcValue = 0; + switch (rsi) + { + case 0: + UtcValue = +9; + break; + case 1: + UtcValue = +1; + break; + case 2: + UtcValue = +1; + break; + case 3: + UtcValue = +9; + break; + case 4: + UtcValue = +9; + break; + case 5: + UtcValue = +3; + break; + case 6: + UtcValue = -8; + break; + case 7: + UtcValue = -8; + break; + case 8: + UtcValue = +3; + break; + case 9: + UtcValue = -3; + break; + case 10: + UtcValue = +8; + break; + case 11: + UtcValue = +7; + break; + case 12: + UtcValue = +8; + break; + } + DateTime thisDate = DateTime.UtcNow.AddHours(UtcValue); + try + { + TimeTable.Clear(); + for (int i = TimeTable.Rows.Count - 1; i >= 0; i--) + { + if (TimeTable.Rows[i][0].ToString() == "") + TimeTable.Rows[i].Delete(); + } + foreach (var column in TimeTable.Columns.Cast().ToArray()) + { + if (TimeTable.AsEnumerable().All(dr => dr.IsNull(column))) + TimeTable.Columns.Remove(column); + } + gridview1.ItemsSource = null; + TimeTable.AcceptChanges(); + } + catch (Exception) { } + TimeTable.Columns.Add(""); + string timezone = "Utc " + UtcValue; + if (!UtcValue.ToString().Contains("-")) + { timezone = "Utc +" + UtcValue; } + TimeTable.Rows.Add(new object[] { timezone }); + TimeTable.Rows.Add(new object[] { DayOfWeek.Monday }); + TimeTable.Rows.Add(new object[] { DayOfWeek.Tuesday }); + TimeTable.Rows.Add(new object[] { DayOfWeek.Wednesday }); + TimeTable.Rows.Add(new object[] { DayOfWeek.Thursday }); + TimeTable.Rows.Add(new object[] { DayOfWeek.Friday }); + TimeTable.Rows.Add(new object[] { DayOfWeek.Saturday }); + TimeTable.Rows.Add(new object[] { DayOfWeek.Sunday }); + + if (RegionComboBox.SelectedIndex == -1) + { RegionComboBox.Text = "NA"; } + string RegionTimeTable = GetStrBetweenTags(timetable, "[" + RegionComboBox.Text + "]", "[/" + RegionComboBox.Text + "]"); + string[] TimeTableRows = RegionTimeTable.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); + int rx = 0; + foreach (string row in TimeTableRows) + { + if (row != "") + { + string[] TimeTableColumns = row.Split('|'); + int cx = 1; + foreach (string cell in TimeTableColumns) + { + if (rx == 0) + { TimeTable.Columns.Add(""); } + DataRow itdr = TimeTable.Rows[rx]; + string celloutput = cell; + if (celloutput.Contains(",")) + { celloutput = celloutput.Replace(",", "," + Environment.NewLine); } + itdr[cx] = celloutput; + cx++; + } + rx++; + } + } + DateTime DT = DateTime.UtcNow.AddHours(UtcValue); + Console.WriteLine(DT.DayOfWeek + " Date: " + DT.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture) + " Time: " + DT.ToString(@"HH: mm"), CultureInfo.InvariantCulture); + int cr = 0; + int DayIndex = -1; + foreach (var row in TimeTable.Rows) + { + if (cr > 0) + { + DataRow dr = TimeTable.Rows[cr]; + if (dr[0].ToString() == DT.DayOfWeek.ToString()) + { DayIndex = cr; } + } + cr++; + } + + int cl = 0; + int g = 0; + int HourIndex = -1; + foreach (var column in TimeTable.Columns) + { + if (cl > 0) + { + DataRow dr = TimeTable.Rows[0]; + DateTime CLDT = DateTime.Parse(DT.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture) + " " + dr[cl].ToString() + ":00", CultureInfo.InvariantCulture); + if (CLDT > DT && g == 0) + { + HourIndex = cl; + g = 1; + } + } + cl++; + } + int day_correction = 0; + if (HourIndex == -1) + { + HourIndex = 1; + day_correction++; + if (DayIndex < TimeTable.Rows.Count - 1) + { DayIndex++; } + else + { DayIndex = 1; } + } + string cSecondboss = ""; + #region "Current Boss" + int CDT_addedDays = 0; + while (true) + { + DataRow dr = TimeTable.Rows[DayIndex]; + if (dr[HourIndex].ToString() == "") + { + if (HourIndex < TimeTable.Columns.Count - 1) + { + HourIndex++; + } + else + { + HourIndex = 1; + if (DayIndex < TimeTable.Rows.Count - 1) + { + DayIndex++; + CDT_addedDays++; + } + else + { + DayIndex = 1; + CDT_addedDays++; + } + } + } + else + { break; } + } + + DataRow dr1 = TimeTable.Rows[0]; + DateTime CDT = DateTime.Parse(DT.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture) + " " + dr1[HourIndex].ToString() + ":00", CultureInfo.InvariantCulture); + CDT = CDT.AddDays(CDT_addedDays); + CDT = CDT.AddDays(day_correction); + TimeSpan duration = CDT.Subtract(DT); + CurrentBossTimeLabel.Content = duration.ToString(@"hh\:mm\:ss"); + Console.WriteLine("Row: " + DayIndex + " " + "Column: " + HourIndex); + try + { + DataRow DrT = TimeTable.Rows[0]; + string Time = DrT[HourIndex].ToString(); + DrT = TimeTable.Rows[DayIndex]; + string Day = DrT[0].ToString(); + CurrentBossTimeLabel.ToolTip = Day + " " + Time; + } + catch (Exception) { } + dr1 = TimeTable.Rows[DayIndex]; + CbossNameLabel.Content = dr1[HourIndex].ToString().Replace("," + Environment.NewLine, " & "); + if (CbossNameLabel.Content.ToString().Contains(" & ")) + {cSecondboss = CbossNameLabel.Content.ToString().Split('&')[1].Trim();} + + #endregion + #region "Next Boss" + + int N_HourIndex = HourIndex; + int N_DayIndex = DayIndex; + N_HourIndex++; + CDT_addedDays = 0; + if (N_HourIndex > TimeTable.Columns.Count - 1) + { + N_HourIndex = 1; + N_DayIndex++; + CDT_addedDays++; + if (N_DayIndex > TimeTable.Rows.Count - 1) + { + N_DayIndex = 1; + CDT_addedDays = N_DayIndex; + } + } + + while (true) + { + DataRow dr = TimeTable.Rows[N_DayIndex]; + if (dr[N_HourIndex].ToString() == "") + { + if (N_HourIndex < TimeTable.Columns.Count - 1) + { + N_HourIndex++; + } + else + { + N_HourIndex = 1; + if (N_DayIndex < TimeTable.Rows.Count - 1) + { + N_DayIndex++; + CDT_addedDays++; + } + else + { + N_DayIndex = 1; + CDT_addedDays++; + } + } + } + else + { break; } + } + dr1 = TimeTable.Rows[0]; + CDT = DateTime.Parse(DT.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture) + " " + dr1[N_HourIndex].ToString() + ":00", CultureInfo.InvariantCulture); + if (CDT < DT) + { CDT = CDT.AddDays(1); } + CDT = CDT.AddDays(CDT_addedDays); + CDT = CDT.AddDays(day_correction); + duration = CDT.Subtract(DT); + NextBossTimeLabel.Content = duration.ToString(@"hh\:mm\:ss"); + Console.WriteLine("Row: " + N_DayIndex + " " + "Column: " + N_HourIndex); + try + { + DataRow DrT = TimeTable.Rows[0]; + string Time = DrT[N_HourIndex].ToString(); + DrT = TimeTable.Rows[N_DayIndex]; + string Day = DrT[0].ToString(); + NextBossTimeLabel.ToolTip = Day + " " + Time; + } + catch (Exception) { } + dr1 = TimeTable.Rows[N_DayIndex]; + NBossNameLabel.Content = dr1[N_HourIndex].ToString().Replace("," + Environment.NewLine, " & "); + #endregion + #region "Previous Boss" + + int P_HourIndex = HourIndex; + int P_DayIndex = DayIndex; + P_HourIndex--; + CDT_addedDays = 0; + if (P_HourIndex <= 0) + { + P_HourIndex = TimeTable.Columns.Count - 1; + P_DayIndex--; + CDT_addedDays--; + if (P_DayIndex == 0) + { + P_DayIndex = TimeTable.Rows.Count - 1; + CDT_addedDays = P_DayIndex * -1; + } + } + while (true) + { + DataRow dr = TimeTable.Rows[P_DayIndex]; + if (dr[P_HourIndex].ToString() == "") + { + if (P_HourIndex > 1) + { + P_HourIndex--; + } + else + { + P_HourIndex = TimeTable.Columns.Count - 1; + if (P_DayIndex > 1) + { + P_DayIndex--; + CDT_addedDays--; + } + else + { + P_DayIndex = TimeTable.Rows.Count - 1; + CDT_addedDays--; + } + } + } + else + { break; } + } + dr1 = TimeTable.Rows[0]; + CDT = DateTime.Parse(DT.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture) + " " + dr1[P_HourIndex].ToString() + ":00", CultureInfo.InvariantCulture); + CDT = CDT.AddDays(CDT_addedDays); + duration = DT.Subtract(CDT); + PreviousBossTimeLabel.Content = duration.ToString(@"hh\:mm\:ss"); + Console.WriteLine("Row: " + P_DayIndex + " " + "Column: " + P_HourIndex); + try + { + DataRow DrT = TimeTable.Rows[0]; + string Time = DrT[P_HourIndex].ToString(); + DrT = TimeTable.Rows[P_DayIndex]; + string Day = DrT[0].ToString(); + PreviousBossTimeLabel.ToolTip = Day + " " + Time; + } + catch (Exception) { } + dr1 = TimeTable.Rows[P_DayIndex]; + PbossNamLabel.Content = dr1[P_HourIndex].ToString().Replace("," + Environment.NewLine, " & "); + #endregion + + ////filter + try + { + BossesCollection.Clear(); + BossCollectionListBox.Items.Clear(); + } + catch (Exception) { } + string BossesList = File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/DA_Bosses"); + string[] BossListSplited = BossesList.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); + foreach (string BossData in BossListSplited) + { + if (BossData != "") + { + BossesCollection.Add(BossData.Replace(Environment.NewLine, "")); + string bossName = BossData.Substring(0, BossData.IndexOf(",") + 1); + bossName = bossName.Replace(",", ""); + bossName = bossName.Replace(Environment.NewLine, ""); + BossCollectionListBox.Items.Add(bossName); + } + } + + PBImageBox.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/Bosses_img/Boss.png")); + NBImageBox.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/Bosses_img/Boss.png")); + LBImageBox.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/Bosses_img/Boss.png")); + Getimg gm = new Getimg(); + + string First_boss = ""; + string Second_boss = ""; + foreach (string item in BossesCollection) + { + if (PbossNamLabel.Content.ToString().Contains(item.Split(',')[0])) + { + string[] bossdata = item.Split(','); + string imgurl = bossdata[1].ToString(); + if (bossdata[5].ToString() != "") + { + imgurl = bossdata[5].ToString(); + if (imgurl.Contains("")) + { imgurl = imgurl.Replace("", System.IO.Directory.GetCurrentDirectory()); } + } + try { PBImageBox.Source = gm.GETIMAGE(imgurl); } catch (Exception) { } + if (PbossNamLabel.Content.ToString().Contains("&")) + { try { PBImageBox.Source = gm.GETIMAGE(System.IO.Directory.GetCurrentDirectory() + "/Resources/Bosses_img/" + PbossNamLabel.Content.ToString() + ".png"); } catch (Exception) { } } + } + if (CbossNameLabel.Content.ToString().Contains(item.Split(',')[0])) + { + string[] bossdata = item.Split(','); + try + { + string imgurl = bossdata[1].ToString(); + if (bossdata[5].ToString() == "") + { + imgurl = bossdata[1].ToString(); + } + else + { + imgurl = bossdata[5].ToString(); + if (imgurl.Contains("")) + { imgurl = imgurl.Replace("", System.IO.Directory.GetCurrentDirectory()); } + } + publicNbossimage = bossdata[1].ToString(); + if (!CbossNameLabel.Content.ToString().Contains("&")) + { publicbossUrl = bossdata[2].ToString(); } + else + { + if (publicbossUrl == "") + { publicbossUrl = bossdata[2].ToString(); } + else + { publicbossUrl += " | " + bossdata[2].ToString(); } + } + NBImageBox.Source = gm.GETIMAGE(imgurl); + if (CbossNameLabel.Content.ToString().Contains("&")) + { try { NBImageBox.Source = gm.GETIMAGE(System.IO.Directory.GetCurrentDirectory() + "/Resources/Bosses_img/" + CbossNameLabel.Content.ToString() + ".png"); } catch (Exception) { } } + + } + catch (Exception) { } + } + + if (cSecondboss == item.Split(',')[0] && CbossNameLabel.Content.ToString().Contains("&") && cSecondboss != "") + { + string[] bossdata = item.Split(','); + if (publicbossUrl == "") + { publicbossUrl = bossdata[2].ToString(); } + else + { publicbossUrl += "|" + bossdata[2].ToString(); } + } + if (NBossNameLabel.Content.ToString().Contains(item.Split(',')[0])) + { + string[] bossdata = item.Split(','); + string imgurl = bossdata[1].ToString(); + if (bossdata[5].ToString() != "") + { + imgurl = bossdata[5].ToString(); + if (imgurl.Contains("")) + { imgurl = imgurl.Replace("", System.IO.Directory.GetCurrentDirectory()); } + } + try { LBImageBox.Source = gm.GETIMAGE(imgurl); } catch (Exception) { } + if (NBossNameLabel.Content.ToString().Contains("&")) + { try { LBImageBox.Source = gm.GETIMAGE(System.IO.Directory.GetCurrentDirectory() + "/Resources/Bosses_img/" + NBossNameLabel.Content.ToString() + ".png"); } catch (Exception) { } } + //if (bossdata[3].ToString() != "") + //{ NBossNameLabel.Content = bossdata[3].ToString(); } + } + + } + + if (PbossNamLabel.Content.ToString().Contains(" & "))//here + { + string fullbossname = ""; + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = PbossNamLabel.Content.ToString(); + name = name.Substring(0, name.IndexOf("&")); + if (name.Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString() + " & "; + } + } + } + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = PbossNamLabel.Content.ToString(); + name = name.Substring(name.IndexOf("&") + 1); + if (name.Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString(); + } + } + } + if (fullbossname != "") + { PbossNamLabel.Content = fullbossname; } + + } + else + { + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + if (PbossNamLabel.Content.ToString().Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { PbossNamLabel.Content = bossdata[3].ToString(); } + } + + } + } + + if (CbossNameLabel.Content.ToString().Contains(" & ")) + { + string fullbossname = ""; + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = CbossNameLabel.Content.ToString(); + name = name.Substring(0, name.IndexOf("&")); + First_boss = name; + if (name.Contains(bossdata[0].ToString())) + { + string[] br = bossdata[4].ToString().Split('{'); + currentbossrole1 = br[1].ToString(); + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString() + " & "; + } + } + } + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = CbossNameLabel.Content.ToString(); + name = name.Substring(name.IndexOf("&") + 1); + Second_boss = name; + if (name.Contains(bossdata[0].ToString())) + { + string[] br = bossdata[4].ToString().Split('{'); + currentbossrole2 = br[1].ToString(); + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString(); + } + } + } + if (fullbossname != "") + { CbossNameLabel.Content = fullbossname; } + } + else + { + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + if (CbossNameLabel.Content.ToString().TrimStart().TrimEnd() == bossdata[0].ToString()) + { + if (bossdata[3].ToString() != "") + { + string[] br = bossdata[4].ToString().Split('{'); + currentbossrole1 = br[1].ToString(); + CbossNameLabel.Content = bossdata[3].ToString(); + } + else + { + string[] br = bossdata[4].ToString().Split('{'); + currentbossrole1 = br[1].ToString(); + } + } + + } + } + if (NBossNameLabel.Content.ToString().Contains(" & ")) + { + string fullbossname = ""; + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = NBossNameLabel.Content.ToString(); + name = name.Substring(0, name.IndexOf("&")); + if (name.Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString() + " & "; + } + } + } + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = NBossNameLabel.Content.ToString(); + name = name.Substring(name.IndexOf("&") + 1); + if (name.Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString(); + } + } + } + if (fullbossname != "") + { NBossNameLabel.Content = fullbossname; } + } + else + { + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + if (NBossNameLabel.Content.ToString().Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { NBossNameLabel.Content = bossdata[3].ToString(); } + } + + } + } + + Calculate_NightTime(); + Calculate_ImperialReset(); + Calculate_Bartering(); + Calculate_ImperialTradingReset(); + TimeTable.AcceptChanges(); + gridview1.ItemsSource = TimeTable.DefaultView; + if (currentbossrole1 != "") + { + if (currentbossrole1 != "@everyone" && currentbossrole1 != "@here") + { currentbossrole1 = "<@&" + currentbossrole1 + ">"; } + } + if (currentbossrole2 != "") + { + if (currentbossrole2 != "@everyone" && currentbossrole2 != "@here") + { currentbossrole2 = "<@&" + currentbossrole2 + ">"; } + } + SharedDay = DayIndex; + gridview1.ItemsSource = TimeTable.DefaultView; + try { gridview1.SelectedIndex = SharedDay; } catch (Exception) { } + if (CbossNameLabel.Content.ToString().Contains(" & ")) + { + publicNbossimage = "https://raw.githubusercontent.com/kresmes/BDO-Boss-Timer-Discord-Bot-Yuri-Project-/master/Resources/Images/" + First_boss.Replace(" ", "") + "%20%26%20" + Second_boss.Replace(" ", "") + ".png"; + } + if (discord.ConnectionState == Discord.ConnectionState.Connected && isposting == 1) + { + try + { + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(Main_BotChannel_ID); + var Message = await channel.GetMessageAsync(bossImageID) as IUserMessage; + string[] pbu = publicbossUrl.Split('|'); + string[] bnu = CbossNameLabel.Content.ToString().Split('&'); + string ANmessage = ""; + if (CbossNameLabel.Content.ToString().Contains("&")) + { + ANmessage = LanguageCollection[123].ToString() + Environment.NewLine + "[" + bnu[0] + "](" + pbu[0] + ")" + " <---" + LanguageCollection[85].ToString() + Environment.NewLine + "[" + bnu[1] + "](" + pbu[1] + ")" + " <---" + LanguageCollection[85].ToString(); + } + else + { + ANmessage = LanguageCollection[123].ToString() + Environment.NewLine + "[" + bnu[0] + "](" + pbu[0] + ")" + " <---" + LanguageCollection[85].ToString(); + } + var embed1 = new EmbedBuilder + { + Title = CbossNameLabel.Content.ToString() /*+ " <---" + LanguageCollection[87].ToString()*/, + ImageUrl = publicNbossimage, + Color = Color.LightGrey, + //Url = publicbossUrl + Description = ANmessage + }; + await Message.ModifyAsync(msg => msg.Embed = embed1.Build()); + } + catch (Exception) { } + } + + TimeSpan CC = TimeSpan.FromHours(1); + if (EditSpawnHoursSlider.Value.ToString().Contains("-")) + { + TimeSpan PDT = TimeSpan.Parse(PreviousBossTimeLabel.Content.ToString()); + PreviousBossTimeLabel.Content = PDT.Add(CC).ToString(@"hh\:mm\:ss"); + + TimeSpan CDTI = TimeSpan.Parse(CurrentBossTimeLabel.Content.ToString()); + CurrentBossTimeLabel.Content = CDTI.Subtract(CC).ToString(@"hh\:mm\:ss"); + + TimeSpan NDT = TimeSpan.Parse(NextBossTimeLabel.Content.ToString()); + NextBossTimeLabel.Content = NDT.Subtract(CC).ToString(@"hh\:mm\:ss"); + } + if (EditSpawnHoursSlider.Value > 0) + { + TimeSpan PDT = TimeSpan.Parse(PreviousBossTimeLabel.Content.ToString()); + PreviousBossTimeLabel.Content = PDT.Subtract(CC).ToString(@"hh\:mm\:ss"); + + TimeSpan CDTI = TimeSpan.Parse(CurrentBossTimeLabel.Content.ToString()); + CurrentBossTimeLabel.Content = CDTI.Add(CC).ToString(@"hh\:mm\:ss"); + + TimeSpan NDT = TimeSpan.Parse(NextBossTimeLabel.Content.ToString()); + NextBossTimeLabel.Content = NDT.Add(CC).ToString(@"hh\:mm\:ss"); + } + if (discord.ConnectionState == Discord.ConnectionState.Connected && isposting == 1) + { + if (DisplayTimeTableSetting.IsChecked == true) + { + if (TimtableID != 0) + { + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(Main_BotChannel_ID); + await channel.DeleteMessageAsync(TimtableID); + TimtableID = 0; + } + + if (TimtableID == 0) + { + try { gridview1.SelectedIndex = SharedDay; } catch (Exception) { } + if (File.Exists(System.IO.Directory.GetCurrentDirectory() + "/Resources/TimeTable.png")) + { File.Delete(System.IO.Directory.GetCurrentDirectory() + "/Resources/TimeTable.png"); } + //int width = int.Parse(gridview1.ActualWidth.ToString());//error + //int height = int.Parse(gridview1.ActualHeight.ToString()); + RenderTargetBitmap renderTargetBitmap = + new RenderTargetBitmap(1920, 1080, 180, 250, PixelFormats.Pbgra32); + renderTargetBitmap.Render(gridview1); + PngBitmapEncoder pngImage = new PngBitmapEncoder(); + pngImage.Frames.Add(BitmapFrame.Create(renderTargetBitmap)); + using (Stream fileStream = File.Create(System.IO.Directory.GetCurrentDirectory() + "/Resources/TimeTable.png")) + { + pngImage.Save(fileStream); + } + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(Main_BotChannel_ID); + var timetablemessage = await channel.SendFileAsync(System.IO.Directory.GetCurrentDirectory() + "/Resources/TimeTable.png", MOTR.ToString().ToUpper() + LanguageCollection[43].ToString()); + TimtableID = timetablemessage.Id; + } + } + } + //SaveLatestTimeTable = 0; + timer1.Start(); + } + catch (Exception s) + { + ErrorMessageBox emb = new ErrorMessageBox(LanguageCollection[119].ToString(), LanguageCollection[120].ToString(), LanguageCollection[121].ToString(), LanguageCollection[122].ToString()); + emb.MB_typeOK(LanguageCollection[117].ToString(), s.Message + Environment.NewLine + Environment.NewLine + LanguageCollection[118].ToString(), this); + emb.Show(); + this.IsEnabled = false; + } + } + private void Calculate_NightTime() + { + DateTime DT = DateTime.Parse(DateTime.UtcNow.Date.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture) + " 00:00:00", CultureInfo.InvariantCulture); + DateTime DTN = DateTime.UtcNow; + while (true) + { + DT = DT.AddHours(4); + if (DTN < DT) + { break; } + } + TimeSpan DRE = TimeSpan.FromMinutes(40); + TimeSpan DRI = TimeSpan.FromMinutes(20); + TimeSpan Duration = DT.Subtract(DTN); + TimeSpan DRc = TimeSpan.Parse("03:40:00"); + + if (Duration > DRE && Duration < DRc) + { + NILabel.Content = LanguageCollection[25].ToString(); + Duration = Duration.Subtract(DRI); + NightInBdoTimeLabel.Content = Duration.ToString(@"hh\:mm\:ss"); + } + else + { + NILabel.Content = LanguageCollection[107].ToString(); + Duration = Duration.Add(DRI); + TimeSpan Di = TimeSpan.FromHours(3); + if(Duration > Di) + { + Di = TimeSpan.FromHours(4); + Duration = Duration.Subtract(Di); + } + NightInBdoTimeLabel.Content = Duration.ToString(@"hh\:mm\:ss"); + } + } + private void Calculate_ImperialReset() + { + DateTime DT = DateTime.Parse(DateTime.UtcNow.Date.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture) + " 00:00:00", CultureInfo.InvariantCulture); + DateTime DTN = DateTime.UtcNow; + + while (true) + { + DT = DT.AddHours(3); + if (DTN < DT) + { break; } + } + TimeSpan Duration = DTN.Subtract(DT); + IRTimeLabel.Content = Duration.ToString(@"hh\:mm\:ss"); + + } + private void Calculate_Bartering() + { + DateTime DT = DateTime.Parse(DateTime.UtcNow.Date.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture) + " 00:00:00", CultureInfo.InvariantCulture); + DateTime DTN = DateTime.UtcNow; + while(true) + { + DT = DT.AddHours(4); + if (DTN < DT) + { break; } + } + TimeSpan Duration = DTN.Subtract(DT); + BRTimeLabel.Content = Duration.ToString(@"hh\:mm\:ss"); + + } + private void Calculate_ImperialTradingReset() + { + DateTime DT = DateTime.Parse(DateTime.UtcNow.Date.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture) + " 00:00:00", CultureInfo.InvariantCulture); + DateTime DTN = DateTime.UtcNow; + while (true) + { + DT = DT.AddHours(4); + if (DTN < DT) + { break; } + } + TimeSpan Duration = DTN.Subtract(DT); + ITRITimeLabel.Content = Duration.ToString(@"hh\:mm\:ss"); + + } + + private void gridview1_CurrentCellChanged(object sender, EventArgs e) + { + //gridview1.SelectedIndex = -1; + } + private void gridview1_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) + { + try + { + //DataRowView dataRow = (DataRowView)gridview1.SelectedItem; + //int index = gridview1.CurrentCell.Column.DisplayIndex; + //string cellValue = dataRow.Row.ItemArray[index].ToString(); + DataRow dr = TimeTable.Rows[0]; + DataGridCellInfo cellInfo = gridview1.CurrentCell; + DataGridColumn column = cellInfo.Column; + gridview1Column = column.DisplayIndex; + gridview1Row = gridview1.SelectedIndex; + if (gridview1Column > 0) + { RemoveTimeTableColumn.Visibility = Visibility.Visible; } + else + { RemoveTimeTableColumn.Visibility = Visibility.Hidden; } + TimeTableBoss1DropBox.IsEnabled = true; TimeTableBoss2DropBox.IsEnabled = true; + if (gridview1Row == 0 || gridview1Column == 0 ) + { TimeTableBoss1DropBox.IsEnabled = false; TimeTableBoss2DropBox.IsEnabled = false; } + TimeColumnHoursDropBox.IsEnabled = true; + TimeColumnMinutesDropBox.IsEnabled = true; + if (gridview1Column == 0) + { + TimeColumnHoursDropBox.IsEnabled = false; TimeColumnHoursDropBox.SelectedIndex = -1; + TimeColumnMinutesDropBox.IsEnabled = false; TimeColumnMinutesDropBox.SelectedIndex = -1; + TimeTableBoss1DropBox.Text = "None"; + TimeTableBoss2DropBox.Text = "None"; + } + string input = dr[gridview1Column].ToString(); + string Hours = input.Substring(0, input.IndexOf(":") + 0); + string Minutes = input.Substring(input.IndexOf(":") + 1); + TimeColumnHoursDropBox.Text = Hours; + TimeColumnMinutesDropBox.Text = Minutes; + DataRow dr1 = TimeTable.Rows[gridview1Row]; + TimeTableBoss1DropBox.Text = "None"; + TimeTableBoss2DropBox.Text = "None"; + last_HM_Set = TimeColumnHoursDropBox.Text + ":" + TimeColumnMinutesDropBox.Text; + if (gridview1Row > 0) + { + if (dr1[gridview1Column].ToString().Contains(",")) + { + input = dr1[gridview1Column].ToString(); + string Boss1 = input.Substring(0, input.IndexOf(",") + 0); + string Boss2 = input.Substring(input.IndexOf(",") + 1); + Boss2 = Boss2.Replace(Environment.NewLine, ""); + TimeTableBoss1DropBox.Text = Boss1; + TimeTableBoss2DropBox.Text = Boss2; + } + else + { + if (dr1[gridview1Column].ToString() == "") + { TimeTableBoss1DropBox.Text = "None"; } + else + { TimeTableBoss1DropBox.Text = dr1[gridview1Column].ToString(); } + } + } + + } + catch (Exception) { } + } + private void TimeColumnHoursDropBox_DropDownClosed(object sender, EventArgs e) + { + if (gridview1Column > 0 && last_HM_Set != TimeColumnHoursDropBox.Text + ":" + TimeColumnMinutesDropBox.Text && TimeColumnHoursDropBox.SelectedIndex > -1 && TimeColumnMinutesDropBox.SelectedIndex > -1) + { + DataRow dr = TimeTable.Rows[0]; + dr[gridview1Column] = TimeColumnHoursDropBox.Text + ":" + TimeColumnMinutesDropBox.Text; + Correct_GridViewColumns_Order(); + } + } + private void TimeColumnMinutesDropBox_DropDownClosed(object sender, EventArgs e) + { + if (gridview1Column > 0 && last_HM_Set != TimeColumnHoursDropBox.Text + ":" + TimeColumnMinutesDropBox.Text && TimeColumnHoursDropBox.SelectedIndex > -1 && TimeColumnMinutesDropBox.SelectedIndex > -1) + { + DataRow dr = TimeTable.Rows[0]; + dr[gridview1Column] = TimeColumnHoursDropBox.Text + ":" + TimeColumnMinutesDropBox.Text; + Correct_GridViewColumns_Order(); + } + } + private void Correct_GridViewColumns_Order() + { + try + { + RemoveTimeTableColumn.Visibility = Visibility.Hidden; + var Times = new List(); + var Timelist = new List(); + var ColumnList = new List(); + int clv = 0; + foreach (var cli in TimeTable.Columns) + { + if (clv > 0) + { + DataRow dr = TimeTable.Rows[0]; + TimeSpan DT = TimeSpan.Parse(dr[clv].ToString()); + Times.Add(DT); + ColumnList.Add(cli.ToString()); + Timelist.Add(dr[clv].ToString()); + } + clv++; + } + Times.Sort((x, y) => y.CompareTo(x)); + Times.Reverse(); + int tc = 1; + + foreach (var dt in Times) + { + + int fcli = 1; + int cli = 0; + foreach (var cl in ColumnList) + { + if (dt.ToString(@"hh\:mm") == Timelist[cli].ToString()) + { + fcli = cli; + } + cli++; + } + TimeTable.Columns[ColumnList[fcli].ToString()].SetOrdinal(tc); + tc++; + } + gridview1.ItemsSource = null; + TimeTable.AcceptChanges(); + gridview1.ItemsSource = TimeTable.DefaultView; + TimeColumnHoursDropBox.SelectedIndex = -1; + TimeColumnMinutesDropBox.SelectedIndex = -1; + TimeTableBoss1DropBox.Text = "None"; + TimeTableBoss2DropBox.Text = "None"; + + } + catch (Exception) { } + } + + + private void TimeTableAddColumnButton_Click(object sender, RoutedEventArgs e) + { + DataRow dr = TimeTable.Rows[0]; + TimeSpan DTA = TimeSpan.FromMinutes(1); + TimeSpan DT = TimeSpan.Parse(dr[TimeTable.Columns.Count-1].ToString()); + DT = DT.Add(DTA); + TimeTable.Columns.Add(""); + gridview1Column = TimeTable.Columns.Count - 1; + dr[gridview1Column] = DT.ToString(@"hh\:mm"); + gridview1.ItemsSource = null; + TimeTable.AcceptChanges(); + gridview1.ItemsSource = TimeTable.DefaultView; + Correct_GridViewColumns_Order(); + string input = DT.ToString(@"hh\:mm"); + string Hours = input.Substring(0, input.IndexOf(":") + 0); + string Minutes = input.Substring(input.IndexOf(":") + 1); + TimeColumnHoursDropBox.Text = Hours; + TimeColumnMinutesDropBox.Text = Minutes; + gridview1.SelectedIndex = 0; + } + private void RemoveTimeTableColumn_Click(object sender, RoutedEventArgs e) + { + if(TimeColumnHoursDropBox.SelectedIndex > -1 && TimeColumnMinutesDropBox.SelectedIndex > -1 && gridview1Column > 0) + { + System.Data.DataColumn clo = new System.Data.DataColumn(); + DataRow dr = TimeTable.Rows[0]; + int ct = 0; + foreach(System.Data.DataColumn cl in TimeTable.Columns) + { + if (dr[ct].ToString() == TimeColumnHoursDropBox.Text.ToString() + ":" + TimeColumnMinutesDropBox.Text.ToString()) + { + clo = cl; + } + ct++; + } + TimeTable.Columns.Remove(clo); + gridview1.ItemsSource = null; + TimeTable.AcceptChanges(); + gridview1.ItemsSource = TimeTable.DefaultView; + } + } + private void RestoreTimeTableDefaultButton_Click(object sender, RoutedEventArgs e) + { + string Origin_LYPBBTTT_Data = File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/LYPBBTTT_Origin"); + File.WriteAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/LYPBBTTT", Origin_LYPBBTTT_Data); + GetLYPBBTTimeTable(); + } + private void TimeTableBoss1DropBox_DropDownClosed(object sender, EventArgs e) + { + if (gridview1Column > 0 && gridview1Row > 0) + { + if (TimeTableBoss1DropBox.Text == "None" && TimeTableBoss2DropBox.Text != "None") + { + TimeTableBoss1DropBox.Text = TimeTableBoss2DropBox.Text; + TimeTableBoss2DropBox.Text = "None"; + } + DataRow dr = TimeTable.Rows[gridview1Row]; + if (TimeTableBoss1DropBox.Text != "None") + { + if (TimeTableBoss2DropBox.Text == "None") + { dr[gridview1Column] = TimeTableBoss1DropBox.Text; } + else + { dr[gridview1Column] = TimeTableBoss1DropBox.Text + "," + Environment.NewLine + TimeTableBoss2DropBox.Text; } + } + else + { dr[gridview1Column] = ""; } + } + } + + private void TimeTableBoss2DropBox_DropDownClosed(object sender, EventArgs e) + { + if (gridview1Column > 0 && gridview1Row > 0) + { + if (TimeTableBoss1DropBox.Text == "None" && TimeTableBoss2DropBox.Text != "None") + { + TimeTableBoss1DropBox.Text = TimeTableBoss2DropBox.Text; + TimeTableBoss2DropBox.Text = "None"; + } + DataRow dr = TimeTable.Rows[gridview1Row]; + if (TimeTableBoss1DropBox.Text != "None") + { + if (TimeTableBoss2DropBox.Text == "None") + { dr[gridview1Column] = TimeTableBoss1DropBox.Text; } + else + { dr[gridview1Column] = TimeTableBoss1DropBox.Text + "," + Environment.NewLine + TimeTableBoss2DropBox.Text; } + } + else + { dr[gridview1Column] = ""; } + } + } + private void Save_LYPBBTTT() + { + string LYPBBTTT_Data = File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/LYPBBTTT"); + string RegionTimeTable = GetStrBetweenTags(LYPBBTTT_Data, "[" + RegionComboBox.Text + "]", "[/" + RegionComboBox.Text + "]"); + string orignal_tablet = "[" + RegionComboBox.Text + "]" + RegionTimeTable + "[/" + RegionComboBox.Text + "]"; + string output = ""; + int y = 0; + foreach(var cr in TimeTable.Rows) + { + if(output != "") + { output += Environment.NewLine; } + DataRow dr = TimeTable.Rows[y]; + int x = 0; + foreach (var cl in TimeTable.Columns) + { + if (x > 0) + { + if (x < TimeTable.Columns.Count - 1) + { output += dr[x].ToString().Replace(Environment.NewLine, "") + "|"; } + else + { output += dr[x].ToString().Replace(Environment.NewLine, ""); } + } + x++; + } + y++; + } + string New_table = "[" + RegionComboBox.Text + "]" + Environment.NewLine + output + Environment.NewLine + "[/" + RegionComboBox.Text + "]"; + LYPBBTTT_Data = LYPBBTTT_Data.Replace(orignal_tablet, New_table); + File.WriteAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/LYPBBTTT",LYPBBTTT_Data); + } + private void alertbosstab_Click(object sender, RoutedEventArgs e) + { + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + alertstabcontrol.BeginAnimation(OpacityProperty, da); + alertstabcontrol.SelectedIndex = 0; + + var bc = new BrushConverter(); + alertbosstabrectangle.Fill = (Brush)bc.ConvertFrom(subcolor); + alertnighttabbuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + alertimperialtabbuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + alertbarteringtabbuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + alertimperialresettabbuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + } + + private void alertnighttabbutton_Click(object sender, RoutedEventArgs e) + { + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + alertstabcontrol.BeginAnimation(OpacityProperty, da); + alertstabcontrol.SelectedIndex = 1; + + var bc = new BrushConverter(); + alertbosstabrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + alertnighttabbuttonrectangle.Fill = (Brush)bc.ConvertFrom(subcolor); + alertimperialtabbuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + alertbarteringtabbuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + alertimperialresettabbuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + } + + private void alertimperialtabbutton_Click(object sender, RoutedEventArgs e) + { + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + alertstabcontrol.BeginAnimation(OpacityProperty, da); + alertstabcontrol.SelectedIndex = 2; + + var bc = new BrushConverter(); + alertbosstabrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + alertnighttabbuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + alertimperialtabbuttonrectangle.Fill = (Brush)bc.ConvertFrom(subcolor); + alertbarteringtabbuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + alertimperialresettabbuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + } + + private void alertbarteringtabbutton_Click(object sender, RoutedEventArgs e) + { + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + alertstabcontrol.BeginAnimation(OpacityProperty, da); + alertstabcontrol.SelectedIndex = 3; + + var bc = new BrushConverter(); + alertbosstabrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + alertnighttabbuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + alertimperialtabbuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + alertbarteringtabbuttonrectangle.Fill = (Brush)bc.ConvertFrom(subcolor); + alertimperialresettabbuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + } + + private void alertimperialresettabbutton_Click(object sender, RoutedEventArgs e) + { + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + alertstabcontrol.BeginAnimation(OpacityProperty, da); + alertstabcontrol.SelectedIndex = 4; + + var bc = new BrushConverter(); + alertbosstabrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + alertnighttabbuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + alertimperialtabbuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + alertbarteringtabbuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + alertimperialresettabbuttonrectangle.Fill = (Brush)bc.ConvertFrom(subcolor); + } + + private void exssoundbutton_Click(object sender, RoutedEventArgs e) + { + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + extrasettingstabcontrol.BeginAnimation(OpacityProperty, da); + extrasettingstabcontrol.SelectedIndex = 0; + + var bc = new BrushConverter(); + exssoundbuttonrectangle.Fill = (Brush)bc.ConvertFrom(subcolor); + exstimetablebuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + exsalertbuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + } + + private void exstimetablebutton_Click(object sender, RoutedEventArgs e) + { + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + extrasettingstabcontrol.BeginAnimation(OpacityProperty, da); + extrasettingstabcontrol.SelectedIndex = 1; + + var bc = new BrushConverter(); + exssoundbuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + exstimetablebuttonrectangle.Fill = (Brush)bc.ConvertFrom(subcolor); + exsalertbuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + } + + private void exsalertbutton_Click(object sender, RoutedEventArgs e) + { + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + extrasettingstabcontrol.BeginAnimation(OpacityProperty, da); + extrasettingstabcontrol.SelectedIndex = 2; + + var bc = new BrushConverter(); + exssoundbuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + exstimetablebuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + exsalertbuttonrectangle.Fill = (Brush)bc.ConvertFrom(subcolor); + } + + private void HomeButton_Click(object sender, RoutedEventArgs e) + { + if(tabcontrol1.SelectedIndex == 3) + { SaveGlobalSettings(); } + if (tabcontrol1.SelectedIndex == 2) + { savebosslist(); } + if(SourceComboBox.SelectedIndex == 0 && tabcontrol1.SelectedIndex == 1) + { Save_LYPBBTTT();GetLYPBBTTimeTable(); } + TimeTableGrid.Visibility = Visibility.Hidden; + alertstabcontrol.SelectedIndex = 0; + extrasettingstabcontrol.SelectedIndex = 0; + var bc = new BrushConverter(); + alertbosstabrectangle.Fill = (Brush)bc.ConvertFrom(subcolor); + Homehighlight.Fill = (Brush)bc.ConvertFrom(subcolor); + Timetablehighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + bosslisthighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + SelfRollingHighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + settingshighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + abouthighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + alertnighttabbuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + alertimperialtabbuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + alertbarteringtabbuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + alertimperialresettabbuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + exssoundbuttonrectangle.Fill = (Brush)bc.ConvertFrom(subcolor); + exstimetablebuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + exsalertbuttonrectangle.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + tabcontrol1.BeginAnimation(OpacityProperty, da); + tabcontrol1.SelectedIndex = 0; + Homehighlight.Fill = (Brush)bc.ConvertFrom(subcolor); + Timetablehighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + bosslisthighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + SelfRollingHighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + settingshighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + abouthighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + } + private void BSA1CMTextBox_GotFocus(object sender, RoutedEventArgs e) + { + if (BSA1RGrid.ActualHeight == 28) + { + DoubleAnimation daH = new DoubleAnimation(); + daH.From = BSA1RGrid.ActualHeight; + daH.To = BSA1RGrid.ActualHeight + 100; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.5)); + BSA1RGrid.BeginAnimation(Ellipse.HeightProperty, daH); + } + } + private void BSA1CMTextBox_LostFocus(object sender, RoutedEventArgs e) + { + if (BSA1RGrid.ActualHeight > 28) + { + DoubleAnimation daH = new DoubleAnimation(); + daH.From = BSA1RGrid.ActualHeight; + daH.To = BSA1RGrid.ActualHeight - 100; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.5)); + BSA1RGrid.BeginAnimation(Ellipse.HeightProperty, daH); + } + } + + private void BSA2CMTextBox_GotFocus(object sender, RoutedEventArgs e) + { + if (BSA2RGrid.ActualHeight == 28) + { + DoubleAnimation daH = new DoubleAnimation(); + daH.From = BSA2RGrid.ActualHeight; + daH.To = BSA2RGrid.ActualHeight + 100; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.5)); + BSA2RGrid.BeginAnimation(Ellipse.HeightProperty, daH); + } + } + + private void BSA2CMTextBox_LostFocus(object sender, RoutedEventArgs e) + { + if (BSA2RGrid.ActualHeight > 28) + { + DoubleAnimation daH = new DoubleAnimation(); + daH.From = BSA2RGrid.ActualHeight; + daH.To = BSA2RGrid.ActualHeight - 100; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.5)); + BSA2RGrid.BeginAnimation(Ellipse.HeightProperty, daH); + } + } + + private void BSA3CMTextBox_GotFocus(object sender, RoutedEventArgs e) + { + if (BSA3RGrid.ActualHeight == 28) + { + DoubleAnimation daH = new DoubleAnimation(); + daH.From = BSA3RGrid.ActualHeight; + daH.To = BSA3RGrid.ActualHeight + 100; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.5)); + BSA3RGrid.BeginAnimation(Ellipse.HeightProperty, daH); + } + } + + private void BSA3CMTextBox_LostFocus(object sender, RoutedEventArgs e) + { + if (BSA3RGrid.ActualHeight > 28) + { + DoubleAnimation daH = new DoubleAnimation(); + daH.From = BSA3RGrid.ActualHeight; + daH.To = BSA3RGrid.ActualHeight - 100; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.5)); + BSA3RGrid.BeginAnimation(Ellipse.HeightProperty, daH); + } + } + + private void NTA1CMTextbBox_GotFocus(object sender, RoutedEventArgs e) + { + if (NTA1RGrid.ActualHeight == 28) + { + DoubleAnimation daH = new DoubleAnimation(); + daH.From = NTA1RGrid.ActualHeight; + daH.To = NTA1RGrid.ActualHeight + 100; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.5)); + NTA1RGrid.BeginAnimation(Ellipse.HeightProperty, daH); + } + } + + private void NTA1CMTextbBox_LostFocus(object sender, RoutedEventArgs e) + { + if (NTA1RGrid.ActualHeight > 28) + { + DoubleAnimation daH = new DoubleAnimation(); + daH.From = NTA1RGrid.ActualHeight; + daH.To = NTA1RGrid.ActualHeight - 100; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.5)); + NTA1RGrid.BeginAnimation(Ellipse.HeightProperty, daH); + } + } + + private void NTA2CMTextbBox_GotFocus(object sender, RoutedEventArgs e) + { + if (NTA2RGrid.ActualHeight == 28) + { + DoubleAnimation daH = new DoubleAnimation(); + daH.From = NTA2RGrid.ActualHeight; + daH.To = NTA2RGrid.ActualHeight + 100; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.5)); + NTA2RGrid.BeginAnimation(Ellipse.HeightProperty, daH); + } + } + + private void NTA2CMTextbBox_LostFocus(object sender, RoutedEventArgs e) + { + if (NTA2RGrid.ActualHeight > 28) + { + DoubleAnimation daH = new DoubleAnimation(); + daH.From = NTA2RGrid.ActualHeight; + daH.To = NTA2RGrid.ActualHeight - 100; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.5)); + NTA2RGrid.BeginAnimation(Ellipse.HeightProperty, daH); + } + } + + private void NTA3CMTextbBox_GotFocus(object sender, RoutedEventArgs e) + { + if (NTA3RGrid.ActualHeight == 28) + { + DoubleAnimation daH = new DoubleAnimation(); + daH.From = NTA3RGrid.ActualHeight; + daH.To = NTA3RGrid.ActualHeight + 100; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.5)); + NTA3RGrid.BeginAnimation(Ellipse.HeightProperty, daH); + } + } + + private void NTA3CMTextbBox_LostFocus(object sender, RoutedEventArgs e) + { + if (NTA3RGrid.ActualHeight > 28) + { + DoubleAnimation daH = new DoubleAnimation(); + daH.From = NTA3RGrid.ActualHeight; + daH.To = NTA3RGrid.ActualHeight - 100; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.5)); + NTA3RGrid.BeginAnimation(Ellipse.HeightProperty, daH); + } + } + + private void IRA1CMTextBox_GotFocus(object sender, RoutedEventArgs e) + { + if (IRA1RGrid.ActualHeight == 28) + { + DoubleAnimation daH = new DoubleAnimation(); + daH.From = IRA1RGrid.ActualHeight; + daH.To = IRA1RGrid.ActualHeight + 100; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.5)); + IRA1RGrid.BeginAnimation(Ellipse.HeightProperty, daH); + } + } + + private void IRA1CMTextBox_LostFocus(object sender, RoutedEventArgs e) + { + if (IRA1RGrid.ActualHeight > 28) + { + DoubleAnimation daH = new DoubleAnimation(); + daH.From = IRA1RGrid.ActualHeight; + daH.To = IRA1RGrid.ActualHeight - 100; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.5)); + IRA1RGrid.BeginAnimation(Ellipse.HeightProperty, daH); + } + } + + private void IRA2CMTextBox_GotFocus(object sender, RoutedEventArgs e) + { + if (IRA2RGrid.ActualHeight == 28) + { + DoubleAnimation daH = new DoubleAnimation(); + daH.From = IRA2RGrid.ActualHeight; + daH.To = IRA2RGrid.ActualHeight + 100; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.5)); + IRA2RGrid.BeginAnimation(Ellipse.HeightProperty, daH); + } + } + + private void IRA2CMTextBox_LostFocus(object sender, RoutedEventArgs e) + { + if (IRA2RGrid.ActualHeight > 28) + { + DoubleAnimation daH = new DoubleAnimation(); + daH.From = IRA2RGrid.ActualHeight; + daH.To = IRA2RGrid.ActualHeight - 100; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.5)); + IRA2RGrid.BeginAnimation(Ellipse.HeightProperty, daH); + } + } + + private void IRA3CMTextBox_GotFocus(object sender, RoutedEventArgs e) + { + if (IRA3RGrid.ActualHeight == 28) + { + DoubleAnimation daH = new DoubleAnimation(); + daH.From = IRA3RGrid.ActualHeight; + daH.To = IRA3RGrid.ActualHeight + 100; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.5)); + IRA3RGrid.BeginAnimation(Ellipse.HeightProperty, daH); + } + } + + private void IRA3CMTextBox_LostFocus(object sender, RoutedEventArgs e) + { + if (IRA3RGrid.ActualHeight > 28) + { + DoubleAnimation daH = new DoubleAnimation(); + daH.From = IRA3RGrid.ActualHeight; + daH.To = IRA3RGrid.ActualHeight - 100; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.5)); + IRA3RGrid.BeginAnimation(Ellipse.HeightProperty, daH); + } + } + + private void BRA1CMTextBox_GotFocus(object sender, RoutedEventArgs e) + { + if (BRA1RGrid.ActualHeight == 28) + { + DoubleAnimation daH = new DoubleAnimation(); + daH.From = BRA1RGrid.ActualHeight; + daH.To = BRA1RGrid.ActualHeight + 100; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.5)); + BRA1RGrid.BeginAnimation(Ellipse.HeightProperty, daH); + } + } + + private void BRA1CMTextBox_LostFocus(object sender, RoutedEventArgs e) + { + if (BRA1RGrid.ActualHeight > 28) + { + DoubleAnimation daH = new DoubleAnimation(); + daH.From = BRA1RGrid.ActualHeight; + daH.To = BRA1RGrid.ActualHeight - 100; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.5)); + BRA1RGrid.BeginAnimation(Ellipse.HeightProperty, daH); + } + } + + private void BRA2CMTextBox_GotFocus(object sender, RoutedEventArgs e) + { + if (BRA2RGrid.ActualHeight == 28) + { + DoubleAnimation daH = new DoubleAnimation(); + daH.From = BRA2RGrid.ActualHeight; + daH.To = BRA2RGrid.ActualHeight + 100; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.5)); + BRA2RGrid.BeginAnimation(Ellipse.HeightProperty, daH); + } + } + + private void BRA2CMTextBox_LostFocus(object sender, RoutedEventArgs e) + { + if (BRA2RGrid.ActualHeight > 28) + { + DoubleAnimation daH = new DoubleAnimation(); + daH.From = BRA2RGrid.ActualHeight; + daH.To = BRA2RGrid.ActualHeight - 100; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.5)); + BRA2RGrid.BeginAnimation(Ellipse.HeightProperty, daH); + } + } + + private void BRA3CMTextBox_GotFocus(object sender, RoutedEventArgs e) + { + if (BRA3RGrid.ActualHeight == 28) + { + DoubleAnimation daH = new DoubleAnimation(); + daH.From = BRA3RGrid.ActualHeight; + daH.To = BRA3RGrid.ActualHeight + 100; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.5)); + BRA3RGrid.BeginAnimation(Ellipse.HeightProperty, daH); + } + } + + private void BRA3CMTextBox_LostFocus(object sender, RoutedEventArgs e) + { + if (BRA3RGrid.ActualHeight > 28) + { + DoubleAnimation daH = new DoubleAnimation(); + daH.From = BRA3RGrid.ActualHeight; + daH.To = BRA3RGrid.ActualHeight - 100; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.5)); + BRA3RGrid.BeginAnimation(Ellipse.HeightProperty, daH); + } + } + + private void ITRA1CMTextBox_GotFocus(object sender, RoutedEventArgs e) + { + if (ITRA1RGrid.ActualHeight == 28) + { + DoubleAnimation daH = new DoubleAnimation(); + daH.From = ITRA1RGrid.ActualHeight; + daH.To = ITRA1RGrid.ActualHeight + 100; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.5)); + ITRA1RGrid.BeginAnimation(Ellipse.HeightProperty, daH); + } + } + + private void ITRA1CMTextBox_LostFocus(object sender, RoutedEventArgs e) + { + if (ITRA1RGrid.ActualHeight > 28) + { + DoubleAnimation daH = new DoubleAnimation(); + daH.From = ITRA1RGrid.ActualHeight; + daH.To = ITRA1RGrid.ActualHeight - 100; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.5)); + ITRA1RGrid.BeginAnimation(Ellipse.HeightProperty, daH); + } + } + + private void ITRA2CMTextBox_GotFocus(object sender, RoutedEventArgs e) + { + if (ITRA2RGrid.ActualHeight == 28) + { + DoubleAnimation daH = new DoubleAnimation(); + daH.From = ITRA2RGrid.ActualHeight; + daH.To = ITRA2RGrid.ActualHeight + 100; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.5)); + ITRA2RGrid.BeginAnimation(Ellipse.HeightProperty, daH); + } + } + + private void ITRA2CMTextBox_LostFocus(object sender, RoutedEventArgs e) + { + if (ITRA2RGrid.ActualHeight > 28) + { + DoubleAnimation daH = new DoubleAnimation(); + daH.From = ITRA2RGrid.ActualHeight; + daH.To = ITRA2RGrid.ActualHeight - 100; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.5)); + ITRA2RGrid.BeginAnimation(Ellipse.HeightProperty, daH); + } + } + + private void ITRA3CMTextBox_GotFocus(object sender, RoutedEventArgs e) + { + if (ITRA3RGrid.ActualHeight == 28) + { + DoubleAnimation daH = new DoubleAnimation(); + daH.From = ITRA3RGrid.ActualHeight; + daH.To = ITRA3RGrid.ActualHeight + 100; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.5)); + ITRA3RGrid.BeginAnimation(Ellipse.HeightProperty, daH); + } + } + + private void ITRA3CMTextBox_LostFocus(object sender, RoutedEventArgs e) + { + if (ITRA3RGrid.ActualHeight > 28) + { + DoubleAnimation daH = new DoubleAnimation(); + daH.From = ITRA3RGrid.ActualHeight; + daH.To = ITRA3RGrid.ActualHeight - 100; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.5)); + ITRA3RGrid.BeginAnimation(Ellipse.HeightProperty, daH); + } + } + public async void enableMW() + { + var bc = new BrushConverter(); + await discord.StopAsync(); + DiscordBotConnectionStatusLabel.Foreground = (Brush)bc.ConvertFrom("#FFBB3D3D"); + DiscordBotConnectionStatusLabel.Content = LanguageCollection[5].ToString(); + this.IsEnabled = true; + } + + private async void LanguageDropBox_DropDownClosed(object sender, EventArgs e) + { + if (LanguageDropBox.SelectedIndex != language_changed) + { + language_changed = LanguageDropBox.SelectedIndex; + + if (LanguageDropBox.SelectedIndex == 0) + { + DefaultLanguage = "fr"; + LoadDefaultLanguage(); + } + if (LanguageDropBox.SelectedIndex == 1) + { + DefaultLanguage = "en"; + LoadDefaultLanguage(); + } + if (LanguageDropBox.SelectedIndex == 2) + { + DefaultLanguage = "es"; + LoadDefaultLanguage(); + } + if (LanguageDropBox.SelectedIndex == 3) + { + DefaultLanguage = "ru"; + LoadDefaultLanguage(); + } + if (LanguageDropBox.SelectedIndex == 4) + { + DefaultLanguage = "jp"; + LoadDefaultLanguage(); + } + if (LanguageDropBox.SelectedIndex == 5) + { + DefaultLanguage = "kr"; + LoadDefaultLanguage(); + } + + if (SourceComboBox.SelectedIndex == 0) + { Calculate_NightTime(); } + if (discord.ConnectionState == Discord.ConnectionState.Connected && isposting == 1) + { + try + { + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(Main_BotChannel_ID); + var Message = await channel.GetMessageAsync(bossImageID) as IUserMessage; + string[] pbu = publicbossUrl.Split('|'); + string[] bnu = CbossNameLabel.Content.ToString().Split('&'); + string ANmessage = ""; + if (CbossNameLabel.Content.ToString().Contains("&")) + { + ANmessage = LanguageCollection[123].ToString() + Environment.NewLine + "[" + bnu[0] + "](" + pbu[0] + ")" + " <---" + LanguageCollection[85].ToString() + Environment.NewLine + "[" + bnu[1] + "](" + pbu[1] + ")" + " <---" + LanguageCollection[85].ToString(); + } + else + { + ANmessage = LanguageCollection[123].ToString() + Environment.NewLine + "[" + bnu[0] + "](" + pbu[0] + ")" + " <---" + LanguageCollection[85].ToString(); + } + var embed1 = new EmbedBuilder + { + Title = CbossNameLabel.Content.ToString() /*+ " <---" + LanguageCollection[87].ToString()*/, + ImageUrl = publicNbossimage, + Color = Color.LightGrey, + //Url = publicbossUrl + Description = ANmessage + }; + await Message.ModifyAsync(msg => msg.Embed = embed1.Build()); + } + catch (Exception) { } + } + + } + } + public void ReturnFixedToken(DiscordSocketClient ds,string tk) + { + this.IsEnabled = true; + discord = ds; + var bc = new BrushConverter(); + DiscordBotConnectionStatusLabel.Foreground = (Brush)bc.ConvertFrom("#FF669174"); + DiscordBotConnectionStatusLabel.Content = LanguageCollection[8].ToString();//"Connected"; + Token = tk; + tabcontrol1.SelectedIndex = 0; + } + + private void CBNTextbox_LostFocus(object sender, RoutedEventArgs e) + { + AutoSaveBossData(); + } + + private void SRFTBCombobox_DropDownClosed(object sender, EventArgs e) + { + AutoSaveBossData(); + } + + private void BossSpawnLocationLinkTextBox_LostFocus(object sender, RoutedEventArgs e) + { + AutoSaveBossData(); + } + + private void DisplayImageLinkextBoxLocal_LostFocus(object sender, RoutedEventArgs e) + { + AutoSaveBossData(); + } + + private void DisplayImageLinkextBox_LostFocus(object sender, RoutedEventArgs e) + { + AutoSaveBossData(); + } + private void savebosslist() + { + string BossList = ""; + foreach (string item in BossesCollection) + { + if (item != "") + { BossList += item + Environment.NewLine; } + } + try + { + File.WriteAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/DA_Bosses", BossList.TrimEnd()); + Processing_Status(true, "Changes Been Saved"); + } + catch (Exception) { Processing_Status(true, "Failed to Save", true); } + + if (BossesListData != BossList) + { + BossesListData = BossList; + if (SourceComboBox.SelectedIndex == 0) + { GetLYPBBTTimeTable(); } + if (SourceComboBox.SelectedIndex == 1) + { GetTimeTable(MOTR); }//Get info from Html Code + if (SourceComboBox.SelectedIndex == 2) + { GetUrlSource("https://bdobosstimer.com/?&server=" + MOTR); } + } + } + + private void AboutButton_Click(object sender, RoutedEventArgs e) + { + if (tabcontrol1.SelectedIndex == 3) + { SaveGlobalSettings(); } + if (tabcontrol1.SelectedIndex == 2) + { savebosslist(); } + if (SourceComboBox.SelectedIndex == 0 && tabcontrol1.SelectedIndex == 1) + { Save_LYPBBTTT(); GetLYPBBTTimeTable(); } + TimeTableGrid.Visibility = Visibility.Hidden; + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + tabcontrol1.BeginAnimation(OpacityProperty, da); + tabcontrol1.SelectedIndex = 4; + var bc = new BrushConverter(); + Homehighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + Timetablehighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + bosslisthighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + SelfRollingHighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + settingshighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + abouthighlight.Fill = (Brush)bc.ConvertFrom(subcolor); + } + + private void MainColorPick_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + System.Windows.Media.Color color = (System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString(maincolor); + var initialColor = color; + var dialog = new ColorPickerDialog(initialColor); + var bc = new BrushConverter(); + dialog.WindowStyle = WindowStyle.None; + dialog.ResizeMode = ResizeMode.NoResize; + dialog.WindowStartupLocation = WindowStartupLocation.CenterScreen; + dialog.BorderThickness = new Thickness(1.0); + dialog.BorderBrush = (Brush)bc.ConvertFrom("#FF434349"); + dialog.Background = (Brush)bc.ConvertFrom(maincolor); + var result = dialog.ShowDialog(); + if (result.HasValue && result.Value) + { + var newColor = dialog.Color; + var converter = new System.Windows.Media.BrushConverter(); + var brush = (Brush)converter.ConvertFromString(newColor.ToString());//Default #FF28282B + maincolor = newColor.ToString(); + Settings.Default["MainColor"] = newColor.ToString(); + Settings.Default.Save(); + Application.Current.Resources["MainColor"] = brush; + int R = int.Parse(newColor.R.ToString()); + R = R + 4; + int G = int.Parse(newColor.G.ToString()); + G = G + 5; + int B = int.Parse(newColor.B.ToString()); + B = B + 7; + System.Drawing.Color myColor = new System.Drawing.Color(); + try { myColor = System.Drawing.Color.FromArgb(R, G, B); } catch (Exception) { myColor = System.Drawing.Color.FromArgb(newColor.R, newColor.G, newColor.B); } + string hex = "#" + myColor.R.ToString("X2") + myColor.G.ToString("X2") + myColor.B.ToString("X2"); + brush = (Brush)converter.ConvertFromString(hex); + Application.Current.Resources["HeaderColor"] = brush; + + } + } + private void ResetMainColorButton_Click(object sender, RoutedEventArgs e) + { + var converter = new System.Windows.Media.BrushConverter(); + var brush = (Brush)converter.ConvertFromString("#A028282B"); + Settings.Default["MainColor"] = "#A028282B"; + Settings.Default.Save(); + maincolor = "#A028282B"; + Application.Current.Resources["MainColor"] = brush; + Settings.Default["HeaderColor"] = "#962C2D32"; + Settings.Default.Save(); + brush = (Brush)converter.ConvertFromString("#962C2D32"); + Application.Current.Resources["HeaderColor"] = brush; + + } + private void SubColorPick_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + System.Windows.Media.Color color = (System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString(subcolor); + var initialColor = color; + var dialog = new ColorPickerDialog(initialColor); + var bc = new BrushConverter(); + dialog.WindowStyle = WindowStyle.None; + dialog.ResizeMode = ResizeMode.NoResize; + dialog.WindowStartupLocation = WindowStartupLocation.CenterScreen; + dialog.BorderThickness = new Thickness(1.0); + dialog.BorderBrush = (Brush)bc.ConvertFrom("#FF434349"); + dialog.Background = (Brush)bc.ConvertFrom(maincolor); + var result = dialog.ShowDialog(); + if (result.HasValue && result.Value) + { + var newColor = dialog.Color; + var converter = new System.Windows.Media.BrushConverter(); + var brush = (Brush)converter.ConvertFromString(newColor.ToString());//Default #FF28282B + subcolor = newColor.ToString(); + Settings.Default["SubColor"] = newColor.ToString(); + Settings.Default.Save(); + Application.Current.Resources["SubColor"] = brush; + abouthighlight.Fill = (Brush)bc.ConvertFrom(subcolor); + } + } + + private void ResetSubColorButton_Click(object sender, RoutedEventArgs e) + { + var bc = new BrushConverter(); + var converter = new System.Windows.Media.BrushConverter(); + var brush = (Brush)converter.ConvertFromString("#FF8B81FC"); + Settings.Default["SubColor"] = "#FF8B81FC"; + Settings.Default.Save(); + subcolor = "#FF8B81FC"; + Application.Current.Resources["SubColor"] = brush; + abouthighlight.Fill = (Brush)bc.ConvertFrom(subcolor); + } + + private async void BossListRestoreDefaultButton_Click(object sender, RoutedEventArgs e) + { + string finalBosslist = ""; + if (File.Exists(System.IO.Directory.GetCurrentDirectory() + "/Resources/DA_Bosses")) + { + string OriginBossesList = File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/BossesOrigin"); + string[] BossListSplited = OriginBossesList.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); + Settings.Default["OriginBossList"] = OriginBossesList; + Settings.Default.Save(); + string BossesList = File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/DA_Bosses"); + string[] BossListSP = BossesList.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); + finalBosslist = BossesList; + foreach (string BossData in BossListSP) + { + if (BossData != "") + { + foreach (string BD in BossListSplited) + { + if (BD != "") + { + string[] BDS = BD.Split(','); + string[] bossdataS = BossData.Split(','); + if (bossdataS[0] == BDS[0]) + { + if (bossdataS.Length == 5) + { finalBosslist = finalBosslist.Replace(bossdataS[0] + "," + bossdataS[1] + "," + bossdataS[2] + "," + bossdataS[3] + "," + bossdataS[4] + , BDS[0] + "," + BDS[1] + "," + BDS[2] + "," + bossdataS[3] + "," + bossdataS[4] + "," + BDS[5]); } + + if (bossdataS.Length == 6) + { finalBosslist = finalBosslist.Replace(bossdataS[0] + "," + bossdataS[1] + "," + bossdataS[2] + "," + bossdataS[3] + "," + bossdataS[4] + "," + bossdataS[5] + , BDS[0] + "," + BDS[1] + "," + BDS[2] + "," + bossdataS[3] + "," + bossdataS[4] + "," + BDS[5]); } + } + } + } + } + } + foreach (string BD in BossListSplited) + { + bool is_missing = true; + foreach(string boss in BossListSP) + { + if(boss.Split(',')[0].ToLower() == BD.Split(',')[0].ToLower()) + { is_missing = false;} + } + if(is_missing) + { finalBosslist += Environment.NewLine + BD; } + } + } + File.WriteAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/DA_Bosses", finalBosslist); + BossesListData = finalBosslist; + try + { + BossesCollection.Clear(); + BossCollectionListBox.Items.Clear(); + } + catch (Exception) { } + string[] BossListSplited1 = BossesListData.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); + foreach (string BossData in BossListSplited1) + { + if (BossData != "") + { + BossesCollection.Add(BossData.Replace(Environment.NewLine, "")); + string bossName = BossData.Substring(0, BossData.IndexOf(",") + 1); + bossName = bossName.Replace(",", ""); + bossName = bossName.Replace(Environment.NewLine, ""); + BossCollectionListBox.Items.Add(bossName); + } + } + + if (discord.ConnectionState == Discord.ConnectionState.Connected) + { + if (tabcontrol1.SelectedIndex == 3) + { SaveGlobalSettings(); } + GetIds(); + TimeTableGrid.Visibility = Visibility.Hidden; + + try { BossCollectionListBox.SelectedIndex = 0; } catch (Exception) { } + try + { + gridview1.SelectedIndex = SharedDay; + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + tabcontrol1.BeginAnimation(OpacityProperty, da); + } + catch (Exception) { } + tabcontrol1.SelectedIndex = 2; + var bc = new BrushConverter(); + Homehighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + Timetablehighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + bosslisthighlight.Fill = (Brush)bc.ConvertFrom(subcolor); + SelfRollingHighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + settingshighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + abouthighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + } + else + { + try + { + var bc = new BrushConverter(); + + DiscordBotConnectionStatusLabel.Foreground = (Brush)bc.ConvertFrom("#FFF1F1F1"); + DiscordBotConnectionStatusLabel.Content = LanguageCollection[6].ToString();//"Connecting..."; + await discord.LoginAsync(TokenType.Bot, Token); + await discord.StartAsync(); + System.Threading.Thread.Sleep(1000); + + if (DiscordBotConnectionStatusLabel.Content.ToString() == LanguageCollection[6].ToString()) + { + DiscordBotConnectionStatusLabel.Foreground = (Brush)bc.ConvertFrom("#FF669174"); + DiscordBotConnectionStatusLabel.Content = LanguageCollection[8].ToString();//"Connected"; + } + } + catch (Exception) + { + var bc = new BrushConverter(); + DiscordBotConnectionStatusLabel.Foreground = (Brush)bc.ConvertFrom("#FFBB3D3D"); + DiscordBotConnectionStatusLabel.Content = LanguageCollection[7].ToString();//"Connection ERROR!"; + ErrorMessageBox emb = new ErrorMessageBox(LanguageCollection[119].ToString(), LanguageCollection[120].ToString(), LanguageCollection[121].ToString(), LanguageCollection[122].ToString()); + emb.TestToken(LanguageCollection[112].ToString(), discord, this, Token); + emb.Show(); + this.IsEnabled = false; + + /*StartPosting();*/ + } + } + } + + private void ResetAnimatedBackgroundButton_Click(object sender, RoutedEventArgs e) + { + Settings.Default["AnimatedBackgroundSource"] = System.IO.Directory.GetCurrentDirectory() + @"\Resources\img\bckg.mp4"; + Settings.Default.Save(); + Settings.Default["AnimatedBackgroundCheckbox"] = "1"; + AnimatedBackgroundCheckBox.IsChecked = true; + Settings.Default.Save(); + mediaElement.IsEnabled = true; + var bc = new BrushConverter(); + PickAnimatedBackground.Foreground = (Brush)bc.ConvertFrom("#FFC6C6C9"); + PickAnimatedBackground.IsEnabled = true; + mediaElement.Visibility = Visibility.Visible; + mediaElement.LoadedBehavior = MediaState.Play; + mediaElement.Source = new Uri(Settings.Default["AnimatedBackgroundSource"].ToString(), UriKind.Absolute); + mediaElement.Play(); + } + + private void AnimatedBackgroundCheckBox_Click(object sender, RoutedEventArgs e) + { + if (AnimatedBackgroundCheckBox.IsChecked == true) + { + Settings.Default["AnimatedBackgroundCheckbox"] = "1"; + Settings.Default.Save(); + mediaElement.IsEnabled = true; + var bc = new BrushConverter(); + PickAnimatedBackground.Foreground = (Brush)bc.ConvertFrom("#FFC6C6C9"); + PickAnimatedBackground.IsEnabled = true; + mediaElement.Visibility = Visibility.Visible; + mediaElement.LoadedBehavior = MediaState.Play; + mediaElement.Source = new Uri(Settings.Default["AnimatedBackgroundSource"].ToString(), UriKind.Absolute); + mediaElement.Play(); + } + else + { + Settings.Default["AnimatedBackgroundCheckbox"] = "0"; + Settings.Default.Save(); + mediaElement.Stop(); + mediaElement.IsEnabled = false; + var bc = new BrushConverter(); + PickAnimatedBackground.Foreground = (Brush)bc.ConvertFrom("#FF72727A"); + PickAnimatedBackground.IsEnabled = false; + mediaElement.Visibility = Visibility.Hidden; + } + } + + private void PickAnimatedBackground_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); + dlg.DefaultExt = ".mp4"; + dlg.Filter = "Video (*.mp4,*.avi,*.flv,*.mkv,*.mov,*.webm,*.wmv)|*.mp4; *.avi; *.flv; *.mkv; *.mov; *.webm; *.wmv"; + Nullable result = dlg.ShowDialog(); + if (result == true) + { + string filename = dlg.FileName; + File.Copy(filename, System.IO.Directory.GetCurrentDirectory() + @"\Resources\img\bckg.mp4"); + Settings.Default["AnimatedBackgroundSource"] = filename; + Settings.Default.Save(); + mediaElement.IsEnabled = true; + var bc = new BrushConverter(); + PickAnimatedBackground.Foreground = (Brush)bc.ConvertFrom("#FFC6C6C9"); + PickAnimatedBackground.IsEnabled = true; + mediaElement.Visibility = Visibility.Visible; + mediaElement.LoadedBehavior = MediaState.Play; + mediaElement.Source = new Uri(Settings.Default["AnimatedBackgroundSource"].ToString(), UriKind.Absolute); + mediaElement.Play(); + } + } + + private void PickBackgroundImage_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); + dlg.DefaultExt = ".png"; + dlg.Filter = "Image files (*.jpg, *.jpeg, *.jpe, *.jfif, *.png) | *.jpg; *.jpeg; *.jpe; *.jfif; *.png"; ; + Nullable result = dlg.ShowDialog(); + if (result == true) + { + string filename = dlg.FileName; + Settings.Default["BackgroundImageSource"] = filename; + Settings.Default.Save(); + backgImageBox.IsEnabled = true; + var bc = new BrushConverter(); + PickBackgroundImage.Foreground = (Brush)bc.ConvertFrom("#FFC6C6C9"); + PickBackgroundImage.IsEnabled = true; + backgImageBox.Visibility = Visibility.Visible; + backgImageBox.Source = new BitmapImage(new Uri(Settings.Default["BackgroundImageSource"].ToString())); + } + } + + private void ResetBackgroundImageButton_Click(object sender, RoutedEventArgs e) + { + Settings.Default["BackgroundImageSource"] = System.IO.Directory.GetCurrentDirectory() + "/Resources/img/bckg.png"; + Settings.Default.Save(); + Settings.Default["BackgroundImageCheckbox"] = "1"; + BackgroundImageCheckbox.IsChecked = true; + Settings.Default.Save(); + backgImageBox.IsEnabled = true; + var bc = new BrushConverter(); + PickBackgroundImage.Foreground = (Brush)bc.ConvertFrom("#FFC6C6C9"); + PickBackgroundImage.IsEnabled = true; + backgImageBox.Visibility = Visibility.Visible; + backgImageBox.Source = new BitmapImage(new Uri(Settings.Default["BackgroundImageSource"].ToString())); + } + + private void BackgroundImageCheckbox_Click(object sender, RoutedEventArgs e) + { + if (BackgroundImageCheckbox.IsChecked == true) + { + Settings.Default["BackgroundImageCheckbox"] = "1"; + Settings.Default.Save(); + backgImageBox.IsEnabled = true; + var bc = new BrushConverter(); + PickBackgroundImage.Foreground = (Brush)bc.ConvertFrom("#FFC6C6C9"); + PickBackgroundImage.IsEnabled = true; + backgImageBox.Visibility = Visibility.Visible; + backgImageBox.Source = new BitmapImage(new Uri(Settings.Default["BackgroundImageSource"].ToString())); + } + else + { + Settings.Default["BackgroundImageCheckbox"] = "0"; + Settings.Default.Save(); + backgImageBox.IsEnabled = false; + var bc = new BrushConverter(); + PickBackgroundImage.Foreground = (Brush)bc.ConvertFrom("#FFC6C6C9"); + PickBackgroundImage.IsEnabled = false; + backgImageBox.Visibility = Visibility.Hidden; + } + } + + private void githubbutton_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + System.Diagnostics.Process.Start("https://github.com/kresmes/BDO-Boss-Timer-Discord-Bot-Yuri-Project-"); + } + + private void JoinDiscordButton_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + System.Diagnostics.Process.Start("https://discord.gg/8SCcCJq"); + } + static void MyHandler(object sender, UnhandledExceptionEventArgs args) + { + Exception e = (Exception)args.ExceptionObject; + File.WriteAllText(System.IO.Directory.GetCurrentDirectory() + "/UnhandledException_Debug.txt", + e.StackTrace.ToString() + + Environment.NewLine + + "exception : " + e.Message + ); + } + private void Build_ScarletData() + { + ScarletMode_Message = ""; + int cr = 0; + int cc = 0; + DataRow Dr = TimeTable.Rows[cr]; + while (true) + { + if (Dr[cc].ToString() == NextBossTimeLabel.ToolTip.ToString().Split(' ')[1]) + { break; } + cc++; + } + while (true) + { + Dr = TimeTable.Rows[cr]; + if (Dr[0].ToString() == NextBossTimeLabel.ToolTip.ToString().Split(' ')[0]) + { break; } + cr++; + } + DataRow Dr1 = TimeTable.Rows[0]; + while (true) + { + if (Dr[cc].ToString() != "") + { + ScarletMode_Message += Environment.NewLine + + string.Format("{0, -30} | {1, 20} | {2, 20}", Dr[cc].ToString().Replace("," + Environment.NewLine, " & ") + " ", "Spawns Time: " + Dr[0].ToString() + " " + Dr1[cc].ToString() + " ", "Spawns in: " + "<00:00:00>"); + cc++; + } + else + { cc++; } + if (TimeTable.Columns.Count <= cc) + { break; } + + } + + } + private void Update_ScarletMode() + { + if (ScarletMode_Message == "" || ScarletMode_Message == null) + { Build_ScarletData(); } + else + { + string[] Inp = ScarletMode_Message.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); + if(Inp.Length > 1) + { + if (Inp[1].Contains(CbossNameLabel.Content.ToString()) && Inp[1].Contains(CurrentBossTimeLabel.ToolTip.ToString())) + { Build_ScarletData(); } + } + } + Updated_ScarletMode_Message = ""; + string[] Inputes = ScarletMode_Message.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); + var Outputs = new List { }; + int rsi = RegionComboBox.SelectedIndex; + int UtcValue = 0; + switch (rsi) + { + case 0: + UtcValue = +9; + break; + case 1: + UtcValue = +1; + break; + case 2: + UtcValue = +1; + break; + case 3: + UtcValue = +9; + break; + case 4: + UtcValue = +9; + break; + case 5: + UtcValue = +3; + break; + case 6: + UtcValue = -8; + break; + case 7: + UtcValue = -8; + break; + case 8: + UtcValue = +3; + break; + case 9: + UtcValue = -3; + break; + case 10: + UtcValue = +8; + break; + case 11: + UtcValue = +7; + break; + case 12: + UtcValue = +8; + break; + } + DateTime DT = DateTime.UtcNow.AddHours(UtcValue); + DateTime CDT = DateTime.Now; + TimeSpan duration = TimeSpan.Zero; + foreach (string input in Inputes) + { + if(input != "") + { + string[] Date_Time = GetStrBetweenTags(input, "Spawns Time: ", " | Spawns in: ").Split(' '); + CDT = DateTime.Parse(DT.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture) + " " + Date_Time[1].Trim() + ":00", CultureInfo.InvariantCulture); + duration = CDT.Subtract(DT); + Outputs.Add(input.Replace("<00:00:00>", duration.ToString(@"hh\:mm\:ss"))); + } + } + string Final_filter = ""; + foreach(string output in Outputs) + { + Final_filter += output + Environment.NewLine; + } + Updated_ScarletMode_Message = "**Bosses For Today**" + Environment.NewLine + "```css" + Environment.NewLine + + Final_filter.TrimEnd() + + Environment.NewLine + "```"; + } + + private void mainWindow_Loaded(object sender, RoutedEventArgs e) + { + var helper = new WindowInteropHelper(this).Handle; + SetWindowLong(helper, GWL_EX_STYLE, (GetWindowLong(helper, GWL_EX_STYLE) | WS_EX_TOOLWINDOW) & ~WS_EX_APPWINDOW); // hiding From alt+tab + } + public async void Processing_Status(bool Is_Process_Completed, string Process_Message, bool Process_Failed = false) + { + if (Is_Process_Completed) + { + if (Process_Failed) + { + Processing_status_Image.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/img/Cancel.png")); + Processing_status_Image.Visibility = Visibility.Visible; + Processing_Status_TextBlock.Text = Process_Message; + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromMilliseconds(1000)); + da.AutoReverse = false; + Processing_Status_TextBlock.BeginAnimation(OpacityProperty, da); + Processing_status_Image.BeginAnimation(OpacityProperty, da); + + da.From = 1; + da.To = 0; + da.Duration = new Duration(TimeSpan.FromMilliseconds(300)); + Process_Loading_icon.BeginAnimation(OpacityProperty, da); + + await Task.Delay(1500); + da.From = 200; + da.To = 0; + da.Duration = new Duration(TimeSpan.FromMilliseconds(300)); + da.AutoReverse = false; + Processing_Status_Grid.BeginAnimation(WidthProperty, da); + } + else + { + Processing_status_Image.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/img/Completed.png")); + Processing_status_Image.Visibility = Visibility.Visible; + Processing_Status_TextBlock.Text = Process_Message; + + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromMilliseconds(1000)); + da.AutoReverse = false; + Processing_Status_TextBlock.BeginAnimation(OpacityProperty, da); + Processing_status_Image.BeginAnimation(OpacityProperty, da); + + da.From = 1; + da.To = 0; + da.Duration = new Duration(TimeSpan.FromMilliseconds(300)); + Process_Loading_icon.BeginAnimation(OpacityProperty, da); + da.From = 0; + da.To = 200; + da.Duration = new Duration(TimeSpan.FromMilliseconds(300)); + da.AutoReverse = false; + Processing_Status_Grid.BeginAnimation(WidthProperty, da); + + await Task.Delay(1500); + da.From = 200; + da.To = 0; + da.Duration = new Duration(TimeSpan.FromMilliseconds(300)); + da.AutoReverse = false; + Processing_Status_Grid.BeginAnimation(WidthProperty, da); + } + } + else + { + Processing_status_Image.Visibility = Visibility.Hidden; + Processing_Status_TextBlock.Text = Process_Message; + Processing_Status_TextBlock.Opacity = 1; + Process_Loading_icon.Opacity = 1; + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromMilliseconds(300)); + Process_Loading_icon.BeginAnimation(OpacityProperty, da); + + da.From = 0; + da.To = 200; + da.Duration = new Duration(TimeSpan.FromMilliseconds(300)); + da.AutoReverse = false; + Processing_Status_Grid.BeginAnimation(WidthProperty, da); + } + } + private void AddNewBossButton_Click(object sender, RoutedEventArgs e) + { + AddSaveBossPictureBox.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/Bosses_img/Boss.png")); + AddSaveBossNameTextBox.Text = ""; + CBNTextbox.Text = ""; + DisplayImageLinkextBox.Text = ""; + DisplayImageLinkextBoxLocal.Text = ""; + SRFTBCombobox.SelectedIndex = -1; + BossSpawnLocationLinkTextBox.Text = ""; + AddSaveBossNameTextBox.IsEnabled = true; + string new_fileName = "New Boss_0"; + foreach (string item in BossCollectionListBox.Items) + { + if(item.Contains(new_fileName.Split('_')[0])) + { + if(int.Parse(item.Split('_')[1]) > int.Parse(new_fileName.Split('_')[1])) + { new_fileName = item;} + } + } + BossCollectionListBox.Items.Add(new_fileName.Split('_')[0] + "_" + (int.Parse(new_fileName.Split('_')[1]) + 1).ToString()); + AddSaveBossNameTextBox.Text = new_fileName.Split('_')[0] + "_" + (int.Parse(new_fileName.Split('_')[1]) + 1).ToString(); + DisplayImageLinkextBox.Text = "https://raw.githubusercontent.com/kresmes/BDO-Boss-Timer-Discord-Bot-Yuri-Project-/master/Resources/Images/Boss.png"; + DisplayImageLinkextBoxLocal.Text = "/Resources/Bosses_img/Boss.png"; + SRFTBCombobox.SelectedIndex = 0; + BossCollectionListBox.SelectedIndex = BossCollectionListBox.Items.Count - 1; + BossesCollection.Add(AddSaveBossNameTextBox.Text + "," + + DisplayImageLinkextBox.Text + "," + + BossSpawnLocationLinkTextBox.Text + "," + + CBNTextbox.Text + "," + + SRFTBCombobox.Text + "{" + RolesCollection[SRFTBCombobox.SelectedIndex].ToString() + "," + + DisplayImageLinkextBoxLocal.Text); + string bosses = ""; + foreach(string boss in BossesCollection) + { bosses += boss + Environment.NewLine;} + File.WriteAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/DA_Bosses", bosses.TrimEnd()); + Selectected_boss = BossCollectionListBox.SelectedIndex; + } + + private void BossCollectionListBox_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) + { Trigger_bossSelection(); } + private void Trigger_bossSelection() + { + if (BossCollectionListBox.SelectedIndex > -1) + { + try + { + Selectected_boss = BossCollectionListBox.SelectedIndex; + Getimg gm = new Getimg(); + var bc = new BrushConverter(); + DisplayImageLinkextBox.BorderBrush = (Brush)bc.ConvertFrom("#FF434349"); + RemoveBossButton.Visibility = Visibility.Visible; + AddSaveBossNameTextBox.IsEnabled = true; + foreach (string origin_item in Origin_BossesCollection) + { + if (BossCollectionListBox.SelectedItem.ToString() == origin_item.Split(',')[0]) + { AddSaveBossNameTextBox.IsEnabled = false; break; } + } + foreach (string item in BossesCollection) + { + string bossName = item.Substring(0, item.IndexOf(",") + 1); + bossName = bossName.Replace(",", ""); + bossName = bossName.Replace(Environment.NewLine, ""); + if (bossName.ToString() == BossCollectionListBox.SelectedItem.ToString()) + { + string[] bossdata = item.Split(','); + AddSaveBossNameTextBox.Text = bossdata[0].ToString(); + DisplayImageLinkextBox.Text = bossdata[1].ToString(); + DisplayImageLinkextBoxLocal.Text = bossdata[5].ToString(); + AddSaveBossPictureBox.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/Bosses_img/Boss.png")); + if (bossdata[5].ToString() == "") + { + string imgurl = bossdata[1].ToString(); + //if (imgurl.Contains("")) + //{ imgurl = imgurl.Replace("", System.IO.Directory.GetCurrentDirectory()); } + try { AddSaveBossPictureBox.Source = gm.GETIMAGE(imgurl); } catch (Exception) { DisplayImageLinkextBox.BorderBrush = Brushes.Red; } + } + else + { + string imgurl = bossdata[5].ToString(); + if (imgurl.Contains("")) + { imgurl = imgurl.Replace("", System.IO.Directory.GetCurrentDirectory()); } + try { AddSaveBossPictureBox.Source = gm.GETIMAGE(imgurl); } catch (Exception) { DisplayImageLinkextBoxLocal.BorderBrush = Brushes.Red; } + } + BossSpawnLocationLinkTextBox.Text = bossdata[2].ToString(); + CBNTextbox.Text = bossdata[3].ToString(); + string[] br = bossdata[4].ToString().Split('{'); + SRFTBCombobox.Text = br[0].ToString(); + if (SRFTBCombobox.SelectedIndex == -1) + { + if (br[1].ToString() != "") + { + try + { + var guild = discord.GetGuild(ServerID); + ulong Role_id = ulong.Parse(br[1].ToString()); + var Role = guild.GetRole(Role_id); + SRFTBCombobox.Text = "@" + Role.Name.ToString(); + } + catch (Exception) { SRFTBCombobox.Text = "None"; } + } + else + { SRFTBCombobox.Text = "None"; } + } + } + } + } + catch (Exception) { } + } + } + private void AddSaveBossNameTextBox_KeyUp(object sender, KeyEventArgs e) + { + if(AddSaveBossNameTextBox.Text.Length > 0) + { BossCollectionListBox.IsEnabled = true; } + else + { BossCollectionListBox.IsEnabled = false; } + BossCollectionListBox.Items[Selectected_boss] = AddSaveBossNameTextBox.Text; + BossCollectionListBox.SelectedIndex = Selectected_boss; + } + private void OptimizeAppCheckbox_Click(object sender, RoutedEventArgs e) + { + Settings.Default["High_RenderQuality"] = OptimizeAppCheckbox.IsChecked.ToString(); + Settings.Default.Save(); + BitmapScaling(bool.Parse(OptimizeAppCheckbox.IsChecked.ToString())); + } + + private void Discord_Settings_Click(object sender, RoutedEventArgs e) + { + if (tabcontrol1.SelectedIndex == 2) + { savebosslist(); } + if (SourceComboBox.SelectedIndex == 0 && tabcontrol1.SelectedIndex == 1) + { Save_LYPBBTTT(); GetLYPBBTTimeTable(); } + + } + + private void ScarletModeTimeTableSetting_CheckBox_Click(object sender, RoutedEventArgs e) + { + Updated_ScarletMode_Message = ""; + Settings.Default["ScarletMode"] = ScarletModeTimeTableSetting_CheckBox.IsChecked.ToString(); + Settings.Default.Save(); + } + private void BitmapScaling(bool Is_Low) + { + if (Is_Low) + { + RenderOptions.SetBitmapScalingMode(APP_Logo, BitmapScalingMode.LowQuality); + RenderOptions.SetBitmapScalingMode(Processing_status_Image, BitmapScalingMode.LowQuality); + RenderOptions.SetBitmapScalingMode(Process_Loading_icon, BitmapScalingMode.LowQuality); + RenderOptions.SetBitmapScalingMode(StartPostingButton_img, BitmapScalingMode.LowQuality); + RenderOptions.SetBitmapScalingMode(appRestartButton_img, BitmapScalingMode.LowQuality); + RenderOptions.SetBitmapScalingMode(ConnectDiscordBotButton_img, BitmapScalingMode.LowQuality); + RenderOptions.SetBitmapScalingMode(DisconnectDiscordBot_img, BitmapScalingMode.LowQuality); + RenderOptions.SetBitmapScalingMode(PBImageBox, BitmapScalingMode.LowQuality); + RenderOptions.SetBitmapScalingMode(NBImageBox, BitmapScalingMode.LowQuality); + RenderOptions.SetBitmapScalingMode(LBImageBox, BitmapScalingMode.LowQuality); + RenderOptions.SetBitmapScalingMode(alertbosstab_img, BitmapScalingMode.LowQuality); + RenderOptions.SetBitmapScalingMode(alertnighttabbutton_img, BitmapScalingMode.LowQuality); + RenderOptions.SetBitmapScalingMode(alertimperialtabbutton_img, BitmapScalingMode.LowQuality); + RenderOptions.SetBitmapScalingMode(alertimperialresettabbutton_img, BitmapScalingMode.LowQuality); + RenderOptions.SetBitmapScalingMode(exssoundbutton_img, BitmapScalingMode.LowQuality); + RenderOptions.SetBitmapScalingMode(exstimetablebutton_img, BitmapScalingMode.LowQuality); + RenderOptions.SetBitmapScalingMode(exsalertbutton_img, BitmapScalingMode.LowQuality); + RenderOptions.SetBitmapScalingMode(mediaElement, BitmapScalingMode.LowQuality); + RenderOptions.SetBitmapScalingMode(backgImageBox, BitmapScalingMode.LowQuality); + RenderOptions.SetBitmapScalingMode(HomeButton_img, BitmapScalingMode.LowQuality); + RenderOptions.SetBitmapScalingMode(TimeTableButton_img, BitmapScalingMode.LowQuality); + RenderOptions.SetBitmapScalingMode(BossesListButton_img, BitmapScalingMode.LowQuality); + RenderOptions.SetBitmapScalingMode(SettingsButton_img, BitmapScalingMode.LowQuality); + RenderOptions.SetBitmapScalingMode(AboutButton_img, BitmapScalingMode.LowQuality); + RenderOptions.SetBitmapScalingMode(AddSaveBossPictureBox, BitmapScalingMode.LowQuality); + RenderOptions.SetBitmapScalingMode(IoverlayModeButton_img, BitmapScalingMode.LowQuality); + RenderOptions.SetBitmapScalingMode(SendTotrayButton_img, BitmapScalingMode.LowQuality); + RenderOptions.SetBitmapScalingMode(CloseappButton_img, BitmapScalingMode.LowQuality); + RenderOptions.SetBitmapScalingMode(githubbutton, BitmapScalingMode.LowQuality); + RenderOptions.SetBitmapScalingMode(JoinDiscordButton, BitmapScalingMode.LowQuality); + } + else + { + RenderOptions.SetBitmapScalingMode(APP_Logo, BitmapScalingMode.HighQuality); + RenderOptions.SetBitmapScalingMode(Processing_status_Image, BitmapScalingMode.HighQuality); + RenderOptions.SetBitmapScalingMode(Process_Loading_icon, BitmapScalingMode.HighQuality); + RenderOptions.SetBitmapScalingMode(StartPostingButton_img, BitmapScalingMode.HighQuality); + RenderOptions.SetBitmapScalingMode(appRestartButton_img, BitmapScalingMode.HighQuality); + RenderOptions.SetBitmapScalingMode(ConnectDiscordBotButton_img, BitmapScalingMode.HighQuality); + RenderOptions.SetBitmapScalingMode(DisconnectDiscordBot_img, BitmapScalingMode.HighQuality); + RenderOptions.SetBitmapScalingMode(PBImageBox, BitmapScalingMode.HighQuality); + RenderOptions.SetBitmapScalingMode(NBImageBox, BitmapScalingMode.HighQuality); + RenderOptions.SetBitmapScalingMode(LBImageBox, BitmapScalingMode.HighQuality); + RenderOptions.SetBitmapScalingMode(alertbosstab_img, BitmapScalingMode.HighQuality); + RenderOptions.SetBitmapScalingMode(alertnighttabbutton_img, BitmapScalingMode.HighQuality); + RenderOptions.SetBitmapScalingMode(alertimperialtabbutton_img, BitmapScalingMode.HighQuality); + RenderOptions.SetBitmapScalingMode(alertimperialresettabbutton_img, BitmapScalingMode.HighQuality); + RenderOptions.SetBitmapScalingMode(exssoundbutton_img, BitmapScalingMode.HighQuality); + RenderOptions.SetBitmapScalingMode(exstimetablebutton_img, BitmapScalingMode.HighQuality); + RenderOptions.SetBitmapScalingMode(exsalertbutton_img, BitmapScalingMode.HighQuality); + RenderOptions.SetBitmapScalingMode(mediaElement, BitmapScalingMode.HighQuality); + RenderOptions.SetBitmapScalingMode(backgImageBox, BitmapScalingMode.HighQuality); + RenderOptions.SetBitmapScalingMode(HomeButton_img, BitmapScalingMode.HighQuality); + RenderOptions.SetBitmapScalingMode(TimeTableButton_img, BitmapScalingMode.HighQuality); + RenderOptions.SetBitmapScalingMode(BossesListButton_img, BitmapScalingMode.HighQuality); + RenderOptions.SetBitmapScalingMode(SettingsButton_img, BitmapScalingMode.HighQuality); + RenderOptions.SetBitmapScalingMode(AboutButton_img, BitmapScalingMode.HighQuality); + RenderOptions.SetBitmapScalingMode(AddSaveBossPictureBox, BitmapScalingMode.HighQuality); + RenderOptions.SetBitmapScalingMode(IoverlayModeButton_img, BitmapScalingMode.HighQuality); + RenderOptions.SetBitmapScalingMode(SendTotrayButton_img, BitmapScalingMode.HighQuality); + RenderOptions.SetBitmapScalingMode(CloseappButton_img, BitmapScalingMode.HighQuality); + RenderOptions.SetBitmapScalingMode(githubbutton, BitmapScalingMode.HighQuality); + RenderOptions.SetBitmapScalingMode(JoinDiscordButton, BitmapScalingMode.HighQuality); + } + } + private void SelfRollingButton_Click(object sender, RoutedEventArgs e) + { + if (discord.ConnectionState == Discord.ConnectionState.Connected) + { + GetIds(); + new Thread(() => + { + Thread.Sleep(1000); + Application.Current.Dispatcher.Invoke((Action)(() => { + tabcontrol1.SelectedIndex = 5; + SelfRollingMessageRolesCollections.Clear(); + SelfRolling_Messages_ListBox.Items.Clear(); + if (RollingChannelComboBox.SelectedIndex != -1 && RollingChannelComboBox.Text != "None") + { + EnableSelfRollingCheckbox.IsChecked = bool.Parse(Settings.Default["SelfRolling"].ToString()); + EnableSelfRollingCheckbox.IsEnabled = true; + } + else + { EnableSelfRollingCheckbox.IsChecked = false; EnableSelfRollingCheckbox.IsEnabled = false; } + + if (EnableSelfRollingCheckbox.IsChecked == true) + { UpdateSelfRollingButton.Visibility = Visibility.Visible; RollingGrid.Visibility = Visibility.Visible; } + else + { UpdateSelfRollingButton.Visibility = Visibility.Hidden; RollingGrid.Visibility = Visibility.Hidden; } + SelfRollingStartMesage.Text = GetStrBetweenTags(SelfRollingSettings, "[StartMessage]", "[/StartMessage]"); + foreach (var RM in GetStrBetweenTags(SelfRollingSettings, "[MessageRoles]", "[/MessageRoles]").Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None)) + { + if (RM != "") + { SelfRollingMessageRolesCollections.Add(RM); SelfRolling_Messages_ListBox.Items.Add(GetStrBetweenTags(RM, "[Message]", "[/Message]")); } + } + SelfRollingEndMessage.Text = GetStrBetweenTags(SelfRollingSettings, "[EndMessage]", "[/EndMessage]"); + SelfRolling_LoadedReaction = ""; + SelfRollingInsertRole.Visibility = Visibility.Hidden; + SelfRollingInsertEmoji.Visibility = Visibility.Hidden; + var bc = new BrushConverter(); + Homehighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + Timetablehighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + bosslisthighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + SelfRollingHighlight.Fill = (Brush)bc.ConvertFrom(subcolor); + settingshighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + abouthighlight.Fill = (Brush)bc.ConvertFrom("#008B81FC"); + })); + }).Start(); + } + } + private void RollingChannelComboBox_DropDownClosed(object sender, EventArgs e) + { if (RollingChannelComboBox.SelectedIndex > -1) { Save_SelfRolling_Settings(); }} + private void Save_SelfRolling_Settings() + { + SelfRollingSettings = "[Channel]" + RollingChannelComboBox.Text + "{" + AlertChannelsCollection[RollingChannelComboBox.SelectedIndex] + "[/Channel]" + + Environment.NewLine + + "[StartMessage]" + SelfRollingStartMesage.Text + "[/StartMessage]" + + Environment.NewLine; + string roles = ""; + ulong id = 0; + if(SelfRolling_MainMessage != null) + { id = SelfRolling_MainMessage.Id; } + foreach (var role in SelfRollingMessageRolesCollections) { roles += role + Environment.NewLine;} + SelfRollingSettings += "[MessageRoles]" + roles + "[/MessageRoles]" + + Environment.NewLine + "[EndMessage]" + SelfRollingEndMessage.Text + "[/EndMessage]" + + Environment.NewLine + "[MainMessageID]" + id + "[/MainMessageID]"; + + File.WriteAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/SelfRolling", SelfRollingSettings); + + if (RollingChannelComboBox.SelectedIndex != -1 && RollingChannelComboBox.Text != "None") + { + EnableSelfRollingCheckbox.IsChecked = bool.Parse(Settings.Default["SelfRolling"].ToString()); + EnableSelfRollingCheckbox.IsEnabled = true; + } + else + { EnableSelfRollingCheckbox.IsChecked = false; EnableSelfRollingCheckbox.IsEnabled = false; } + + if (EnableSelfRollingCheckbox.IsChecked == true) + { UpdateSelfRollingButton.Visibility = Visibility.Visible; RollingGrid.Visibility = Visibility.Visible; } + else + { UpdateSelfRollingButton.Visibility = Visibility.Hidden; RollingGrid.Visibility = Visibility.Hidden; } + } + public async void SelfRollingStartUp() + { + if (EnableSelfRollingCheckbox.IsChecked == true && discord.ConnectionState == Discord.ConnectionState.Connected) + { + try + { + ulong SelfRollingChannel_ID = ulong.Parse(GetStrBetweenTags(SelfRollingSettings, "[Channel]", "[/Channel]").Split('{')[1]); + Discord_Bot bot = new Discord_Bot(); + IReadOnlyCollection Servers = null; + List Reactions = new List(); + await Task.Run(() => { Servers = bot.Get_Guilds(this); }); + SocketGuild guild = null; + foreach (var server in Servers) { if (server.Id == ServerID) { guild = server; break; } } + SocketTextChannel channel = null; + foreach (var chn in guild.TextChannels) { if (chn.Id == SelfRollingChannel_ID) { channel = chn; break; } } + if (channel != null) + { + string SelfRollingMessage_Build = GetStrBetweenTags(SelfRollingSettings, "[StartMessage]", "[/StartMessage]") + Environment.NewLine; + int roleamounts = 0; + var RoleMessagesRoles = GetStrBetweenTags(SelfRollingSettings, "[MessageRoles]", "[/MessageRoles]").Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); + foreach (var RoleMessage in RoleMessagesRoles) + { + roleamounts++; + if (roleamounts < RoleMessagesRoles.Length) + { SelfRollingMessage_Build += GetStrBetweenTags(RoleMessage, "[Message]", "[/Message]") + Environment.NewLine; } + else + { SelfRollingMessage_Build += GetStrBetweenTags(RoleMessage, "[Message]", "[/Message]"); } + Reactions.Add(GetStrBetweenTags(RoleMessage, "[Emote]", "[/Emote]")); + } + SelfRollingMessage_Build += GetStrBetweenTags(SelfRollingSettings, "[EndMessage]", "[/EndMessage]"); + try + { + SelfRolling_MainMessage = (Discord.Rest.RestUserMessage)await channel.GetMessageAsync(ulong.Parse(GetStrBetweenTags(SelfRollingSettings, "[MainMessageID]", "[/MainMessageID]"))); + await SelfRolling_MainMessage.ModifyAsync(msg => msg.Content = SelfRollingMessage_Build); + await Task.Run(() => { bot.AddReactionsAsync(Reactions, SelfRolling_MainMessage); }); + SelfRollingSettings = SelfRollingSettings.Replace("[MainMessageID]" + + GetStrBetweenTags(SelfRollingSettings, "[MainMessageID]", "[/MainMessageID]") + "[/MainMessageID]" + , "[MainMessageID]" + SelfRolling_MainMessage.Id + "[/MainMessageID]"); + File.WriteAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/SelfRolling", SelfRollingSettings); + } + catch (Exception) + { + SelfRolling_MainMessage = await channel.SendMessageAsync(SelfRollingMessage_Build); + await Task.Run(() => { bot.AddReactionsAsync(Reactions, SelfRolling_MainMessage); }); + SelfRollingSettings = SelfRollingSettings.Replace("[MainMessageID]" + + GetStrBetweenTags(SelfRollingSettings, "[MainMessageID]", "[/MainMessageID]") + "[/MainMessageID]" + , "[MainMessageID]" + SelfRolling_MainMessage.Id + "[/MainMessageID]"); + File.WriteAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/SelfRolling", SelfRollingSettings); + } + discord.ReactionAdded -= ReactionAdded_Event; + discord.ReactionRemoved -= ReactionRemoved_Event; + discord.ReactionAdded += ReactionAdded_Event; + discord.ReactionRemoved += ReactionRemoved_Event; + } + } + catch (Exception) { } + } + } + private void EnableSelfRollingCheckbox_Click(object sender, RoutedEventArgs e) + { + if (EnableSelfRollingCheckbox.IsChecked == true) + { + UpdateSelfRollingButton.Visibility = Visibility.Visible; + RollingGrid.Visibility = Visibility.Visible; + if (discord.ConnectionState == Discord.ConnectionState.Connected) + { + discord.ReactionAdded += ReactionAdded_Event; + discord.ReactionRemoved += ReactionRemoved_Event; + SelfRollingStartUp(); + } + } + else + { + UpdateSelfRollingButton.Visibility = Visibility.Hidden; + RollingGrid.Visibility = Visibility.Hidden; + if (discord.ConnectionState == Discord.ConnectionState.Connected) + { + discord.ReactionAdded -= ReactionAdded_Event; + discord.ReactionRemoved -= ReactionRemoved_Event; + } + } + Settings.Default["SelfRolling"] = EnableSelfRollingCheckbox.IsChecked.ToString(); + Settings.Default.Save(); + } + public async Task ReactionAdded_Event(Cacheable message, ISocketMessageChannel channel, SocketReaction reaction) + { + if (SelfRolling_WaitingReaction && SelfRolling_GeTReactionMessage.Id == message.Id) + { + SelfRolling_LoadedReaction = reaction.Emote.ToString(); + Application.Current.Dispatcher.Invoke((Action)(() => + { + if (SelfRolling_LoadedReaction.Contains("<") && SelfRolling_LoadedReaction.Contains(":") && SelfRolling_LoadedReaction.Contains(">")) + { + var gm = new Getimg(); + SelfRollingReactionPicture.Source = gm.GETIMAGE("https://cdn.discordapp.com/emojis/" + SelfRolling_LoadedReaction.Split(':')[2].Replace(">", "") + ".png"); + } + else + { SelfRollingReactionPicture.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/img/SelfRoleLogo.png")); } + })); + await channel.DeleteMessageAsync(SelfRolling_GeTReactionMessage.Id); + Application.Current.Dispatcher.Invoke((Action)(() => { + SelfRollingInsertEmoji.Visibility = Visibility.Visible; + try + { + SelfRolling_RoleMessage.Text = + SelfRolling_RoleMessage.Text.Replace(GetStrBetweenTags(SelfRollingMessageRolesCollections[SelfRolling_Messages_ListBox_SelectedIndex], "[Emote]", "[/Emote]"), SelfRolling_LoadedReaction); + }catch (Exception) { } + Save_CurrentSelfRolling_RoleSettings(); + })); + //var emote = Emote.Parse("SelfRolling_LoadedReaction"); + } + if (message.Id == SelfRolling_MainMessage.Id && !reaction.User.Value.IsBot) + { + Discord_Bot bot = new Discord_Bot(); + await Task.Run(() => { bot.AddRoleToUser(SelfRollingSettings, reaction, this); }); + } + } + public async Task ReactionRemoved_Event(Cacheable message, ISocketMessageChannel channel, SocketReaction reaction) + { + if (message.Id == SelfRolling_MainMessage.Id && !reaction.User.Value.IsBot) + { + Discord_Bot bot = new Discord_Bot(); + await Task.Run(() => { bot.RemoveRoleToUser(SelfRollingSettings, reaction, this); }); + } + } + private void SelRollingRoleComboBox_DropDownClosed(object sender, EventArgs e) + { + if(SelRollingRoleComboBox.SelectedIndex != -1) + { + SelfRollingInsertRole.Visibility = Visibility.Visible; + try + { + var role = GetStrBetweenTags(SelfRollingMessageRolesCollections[SelfRolling_Messages_ListBox_SelectedIndex], "[Role]", "[/Role]"); + SelfRolling_RoleMessage.Text = SelfRolling_RoleMessage.Text.Replace("<@&" + role + ">", "<@&" + SelfRollingRolesCollections[SelRollingRoleComboBox.SelectedIndex] + ">"); + } + catch (Exception) { } + Save_CurrentSelfRolling_RoleSettings(); + } + } + + private async void SelfRolling_GetReactionButton_Click(object sender, RoutedEventArgs e) + { + if (discord.ConnectionState == Discord.ConnectionState.Connected) + { + SelfRolling_LoadedReaction = ""; + ulong SelfRollingChannel_ID = ulong.Parse(GetStrBetweenTags(SelfRollingSettings, "[Channel]", "[/Channel]").Split('{')[1]); + IReadOnlyCollection Servers = null; + Discord_Bot bot = new Discord_Bot(); + await Task.Run(() => { Servers = bot.Get_Guilds(this); }); + SocketGuild guild = null; + foreach (var server in Servers) { if (server.Id == ServerID) { guild = server; break; } } + SocketTextChannel channel = null; + foreach (var chn in guild.TextChannels) { if (chn.Id == SelfRollingChannel_ID) { channel = chn; break; } } + if (channel != null) + { + var embed1 = new EmbedBuilder(); + embed1 = new EmbedBuilder + { + Title = "LYPBBT Self Rolling", + Color = Discord.Color.LightGrey, + //Url = publicbossUrl, + Description = "React to this message to capture the Role" + }; + SelfRolling_GeTReactionMessage = await channel.SendMessageAsync("", false, embed1.Build()); + } + SelfRolling_WaitingReaction = true; + discord.ReactionAdded -= ReactionAdded_Event; + discord.ReactionAdded += ReactionAdded_Event; + } + } + + private void SelfRollingInsertRole_Click(object sender, RoutedEventArgs e) + {SelfRolling_RoleMessage.Text += " <@&" + SelfRollingRolesCollections[SelRollingRoleComboBox.SelectedIndex] + "> "; Save_CurrentSelfRolling_RoleSettings(); } + + private void SelfRollingInsertEmoji_Click(object sender, RoutedEventArgs e) + { SelfRolling_RoleMessage.Text += " " + SelfRolling_LoadedReaction + " "; Save_CurrentSelfRolling_RoleSettings(); } + + private void SelfRollingAddNewSelfRole_button_Click(object sender, RoutedEventArgs e) + { + SelfRolling_RoleMessage.Text = "New Role"; + SelRollingRoleComboBox.SelectedIndex = -1; + SelfRolling_LoadedReaction = ""; + SelfRollingReactionPicture.Source = null; + + SelfRolling_Messages_ListBox.Items.Add(SelfRolling_RoleMessage.Text); + SelfRollingMessageRolesCollections.Add("[Message]" + SelfRolling_RoleMessage.Text + "[/Message]" + "[Role][/Role]" + "[Emote][/Emote]"); + SelfRolling_Messages_ListBox.SelectedIndex = SelfRolling_Messages_ListBox.Items.Count - 1; + SelfRolling_Messages_ListBox_SelectedIndex = SelfRolling_Messages_ListBox.Items.Count - 1; + Save_SelfRolling_Settings(); + } + + private void SelfRollingStartMesage_LostFocus(object sender, RoutedEventArgs e) + { Save_SelfRolling_Settings(); } + private void Save_CurrentSelfRolling_RoleSettings() + { + try + { + string Role = ""; + try { Role = SelfRollingRolesCollections[SelRollingRoleComboBox.SelectedIndex]; } + catch (Exception) { Role = ""; } + SelfRolling_Messages_ListBox.Items[SelfRolling_Messages_ListBox_SelectedIndex] = SelfRolling_RoleMessage.Text; + SelfRollingMessageRolesCollections[SelfRolling_Messages_ListBox_SelectedIndex] = "[Message]" + SelfRolling_RoleMessage.Text + "[/Message]" + "[Role]" + Role + "[/Role]" + "[Emote]" + SelfRolling_LoadedReaction + "[/Emote]"; + Save_SelfRolling_Settings(); + } + catch (Exception) { } + } + private void UpdateSelfRollingButton_Click(object sender, RoutedEventArgs e) + { SelfRollingStartUp(); } + + private void SelfRolling_Messages_ListBox_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) + { + if(SelfRolling_Messages_ListBox.SelectedIndex > -1) + { + SelfRollingInsertRole.Visibility = Visibility.Hidden; + SelfRollingInsertEmoji.Visibility = Visibility.Hidden; + SelfRolling_Messages_ListBox_SelectedIndex = SelfRolling_Messages_ListBox.SelectedIndex; + SelfRolling_RoleMessage.Text = GetStrBetweenTags(SelfRollingMessageRolesCollections[SelfRolling_Messages_ListBox.SelectedIndex], "[Message]", "[/Message]"); + string Role = GetStrBetweenTags(SelfRollingMessageRolesCollections[SelfRolling_Messages_ListBox.SelectedIndex], "[Role]", "[/Role]"); + int role_Name = -1; + SelRollingRoleComboBox.SelectedIndex = -1; + foreach(var roleID in SelfRollingRolesCollections) + { + role_Name++; + if (roleID == Role) + { SelRollingRoleComboBox.SelectedIndex = role_Name;break; } + } + SelfRolling_LoadedReaction = GetStrBetweenTags(SelfRollingMessageRolesCollections[SelfRolling_Messages_ListBox.SelectedIndex], "[Emote]", "[/Emote]"); + if (SelfRolling_LoadedReaction.Contains("<") && SelfRolling_LoadedReaction.Contains(":") && SelfRolling_LoadedReaction.Contains(">")) + { + var gm = new Getimg(); + SelfRollingReactionPicture.Source = gm.GETIMAGE("https://cdn.discordapp.com/emojis/" + SelfRolling_LoadedReaction.Split(':')[2].Replace(">", "") + ".png"); + } + else + { SelfRollingReactionPicture.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/img/SelfRoleLogo.png")); } + if (SelRollingRoleComboBox.SelectedIndex != -1) + {SelfRollingInsertRole.Visibility = Visibility.Visible;} + if(SelfRolling_LoadedReaction != "") + { SelfRollingInsertEmoji.Visibility = Visibility.Visible; } + } + } + + private void SelfRollingRemoveSelfRole_button_Click(object sender, RoutedEventArgs e) + { + if(SelfRolling_Messages_ListBox.SelectedIndex > -1) + { + SelfRollingMessageRolesCollections.RemoveAt(SelfRolling_Messages_ListBox_SelectedIndex); + SelfRolling_Messages_ListBox.Items.RemoveAt(SelfRolling_Messages_ListBox_SelectedIndex); + Save_SelfRolling_Settings(); + } + } + + private void AUTCheckbox_Click(object sender, RoutedEventArgs e) + { + Settings.Default["AutoUpdateTable"] = AUTCheckbox.IsChecked.ToString(); + Settings.Default.Save(); + } + + private void SelfRolling_RoleMessage_KeyUp(object sender, KeyEventArgs e) + { if (SelfRolling_Messages_ListBox_SelectedIndex > -1) { Save_CurrentSelfRolling_RoleSettings(); } } + + } +} diff --git a/YPBBT/DA_OverlayModWindow.xaml b/YPBBT/DA_OverlayModWindow.xaml new file mode 100644 index 0000000..0483b7b --- /dev/null +++ b/YPBBT/DA_OverlayModWindow.xaml @@ -0,0 +1,362 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/YPBBT/DA_OverlayModWindow.xaml.cs b/YPBBT/DA_OverlayModWindow.xaml.cs new file mode 100644 index 0000000..4a6f585 --- /dev/null +++ b/YPBBT/DA_OverlayModWindow.xaml.cs @@ -0,0 +1,325 @@ +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.Animation; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; +using YPBBT.Properties; + +namespace YPBBT +{ + /// + /// Interaction logic for DA_OverlayModWindow.xaml + /// + public partial class DA_OverlayModWindow : Window + { + DA_MainWindow damw; + int expanded = 0; + double io; + public DA_OverlayModWindow(DA_MainWindow mw) + { + damw = mw; + InitializeComponent(); + WindowOv.Top = (System.Windows.SystemParameters.PrimaryScreenHeight / 2) - 60; + if (Settings.Default["PlaySoundSetting"].ToString() == "") + { SoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["PlaySoundSetting"].ToString() == "1") + { SoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["PlaySoundSetting"].ToString() == "0") + { SoundOptionCheckBox.IsChecked = false; } + + if (Settings.Default["NTPlaySoundSetting"].ToString() == "") + { NTSoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["NTPlaySoundSetting"].ToString() == "1") + { NTSoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["NTPlaySoundSetting"].ToString() == "0") + { NTSoundOptionCheckBox.IsChecked = false; } + + if (Settings.Default["IRPlaySoundSetting"].ToString() == "") + { IRSoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["IRPlaySoundSetting"].ToString() == "1") + { IRSoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["IRPlaySoundSetting"].ToString() == "0") + { IRSoundOptionCheckBox.IsChecked = false; } + + if (Settings.Default["BRPlaySoundSetting"].ToString() == "") + { BRSoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["BRPlaySoundSetting"].ToString() == "1") + { BRSoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["BRPlaySoundSetting"].ToString() == "0") + { BRSoundOptionCheckBox.IsChecked = false; } + + if (Settings.Default["ITRPlaySoundSetting"].ToString() == "") + { ITRSoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["ITRPlaySoundSetting"].ToString() == "1") + { ITRSoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["ITRPlaySoundSetting"].ToString() == "0") + { ITRSoundOptionCheckBox.IsChecked = false; } + + + + if (Settings.Default["OverlayTransparency"].ToString() == "") + {io = 1;} + else + {io = double.Parse(Settings.Default["OverlayTransparency"].ToString());} + if (io == 0) + { io = 0.1; } + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = io; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + this.BeginAnimation(OpacityProperty, da); + Settings.Default.Save(); + + WindowOv.Left = 0; + WindowOv.Top = 0; + this.ShowInTaskbar = false; + WindowOv.Topmost = true; + } + public void load(BitmapImage img) + { + try + { + if(Settings.Default["Overlay_Position"].ToString() != "") + { + string[] ps = Settings.Default["Overlay_Position"].ToString().Split('|'); + WindowOv.Top = double.Parse(ps[0]); + WindowOv.Left = double.Parse(ps[1]); + } + else + { WindowOv.Top = (System.Windows.SystemParameters.PrimaryScreenHeight / 2) - 60; } + } + catch (Exception) { WindowOv.Top = (System.Windows.SystemParameters.PrimaryScreenHeight / 2) - 60; } + + BossImage.Source = img; + if (Settings.Default["PlaySoundSetting"].ToString() == "") + { SoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["PlaySoundSetting"].ToString() == "1") + { SoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["PlaySoundSetting"].ToString() == "0") + { SoundOptionCheckBox.IsChecked = false; } + + if (Settings.Default["NTPlaySoundSetting"].ToString() == "") + { NTSoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["NTPlaySoundSetting"].ToString() == "1") + { NTSoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["NTPlaySoundSetting"].ToString() == "0") + { NTSoundOptionCheckBox.IsChecked = false; } + + if (Settings.Default["IRPlaySoundSetting"].ToString() == "") + { IRSoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["IRPlaySoundSetting"].ToString() == "1") + { IRSoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["IRPlaySoundSetting"].ToString() == "0") + { IRSoundOptionCheckBox.IsChecked = false; } + + if (Settings.Default["BRPlaySoundSetting"].ToString() == "") + { BRSoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["BRPlaySoundSetting"].ToString() == "1") + { BRSoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["BRPlaySoundSetting"].ToString() == "0") + { BRSoundOptionCheckBox.IsChecked = false; } + + if (Settings.Default["ITRPlaySoundSetting"].ToString() == "") + { ITRSoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["ITRPlaySoundSetting"].ToString() == "1") + { ITRSoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["ITRPlaySoundSetting"].ToString() == "0") + { ITRSoundOptionCheckBox.IsChecked = false; } + + + if (Settings.Default["OverlayTransparency"].ToString() == "") + { + io = 1; + } + else + { io = double.Parse(Settings.Default["OverlayTransparency"].ToString()); } + if (io == 0) + { io = 0.1; } + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = io; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + this.BeginAnimation(OpacityProperty, da); + + } + private void Window_MouseDown(object sender, MouseButtonEventArgs e) + { + try + { + if (e.ChangedButton == MouseButton.Left) + { this.DragMove(); } + Settings.Default["Overlay_Position"] = WindowOv.Top.ToString() + "|" + WindowOv.Left.ToString(); + Settings.Default.Save(); + } + catch (Exception) { } + } + public void UpdateData(string brtext, BitmapImage img, string label1, string bossname, string bosstime, string label2, string nighttime, string label3, string IrTime, string BrTime, string bossSpawnCB, string NightTimecb, string ImperialResetCB,string BRCB,string ITRCB,string PSOL, string ITR,string ITRT) + { + BRLabel.Content = brtext; + BossImage.Source = img; + Label1.Content = label1; + BossNameLabel.Content = bossname; + BossTimeLabel.Content = bosstime; + Label2.Content = label2; + NightInBdoTimeLabel.Content = nighttime; + Label3.Content = label3; + IRTimeLabel.Content = IrTime; + BrTimeLabel.Content = BrTime; + SoundOptionCheckBox.Content = bossSpawnCB; + NTSoundOptionCheckBox.Content = NightTimecb; + IRSoundOptionCheckBox.Content = ImperialResetCB; + BRSoundOptionCheckBox.Content = BRCB; + ITRSoundOptionCheckBox.Content = ITRCB; + PlaySoundOnLabel.Content = PSOL; + ITRL.Content = ITR; + ITRTimeLabel.Content = ITRT; + if (expanded == 0) + { BossImage.ToolTip = Label1.Content.ToString() + Environment.NewLine + BossNameLabel.Content.ToString() + Environment.NewLine + BossTimeLabel.Content.ToString(); } + else + { BossImage.ToolTip = null; } + } + + private void exitButton_Click(object sender, RoutedEventArgs e) + { + damw.GetOverlayState(); + damw.Show(); + this.Close(); + } + + private void SoundOptionCheckBox_Click(object sender, RoutedEventArgs e) + { + if (SoundOptionCheckBox.IsChecked == true) + { + Settings.Default["PlaySoundSetting"] = "1"; + Settings.Default.Save(); + } + else + { + Settings.Default["PlaySoundSetting"] = "0"; + Settings.Default.Save(); + } + } + + private void NTSoundOptionCheckBox_Click(object sender, RoutedEventArgs e) + { + if (NTSoundOptionCheckBox.IsChecked == true) + { + Settings.Default["NTPlaySoundSetting"] = "1"; + Settings.Default.Save(); + } + else + { + Settings.Default["NTPlaySoundSetting"] = "0"; + Settings.Default.Save(); + } + } + + private void IRSoundOptionCheckBox_Click(object sender, RoutedEventArgs e) + { + if (IRSoundOptionCheckBox.IsChecked == true) + { + Settings.Default["IRPlaySoundSetting"] = "1"; + Settings.Default.Save(); + } + else + { + Settings.Default["IRPlaySoundSetting"] = "0"; + Settings.Default.Save(); + } + } + private void BossImage_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + if (ExpandMoreButton.Content.ToString() == "-") + { + ExpandMoreButton.Content = "+"; + DoubleAnimation daH = new DoubleAnimation(); + daH.From = WindowOv.ActualHeight; + daH.To = WindowOv.ActualHeight - 185; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.3)); + WindowOv.BeginAnimation(Ellipse.HeightProperty, daH); + } + else + { + if (expanded == 0) + { + expanded = 1; + DoubleAnimation daW = new DoubleAnimation(); + daW.From = WindowOv.ActualWidth; + daW.To = WindowOv.ActualWidth + 227.333; + daW.Duration = new Duration(TimeSpan.FromSeconds(0.3)); + WindowOv.BeginAnimation(Ellipse.WidthProperty, daW); + } + else + { + expanded = 0; + DoubleAnimation daW = new DoubleAnimation(); + daW.From = WindowOv.ActualWidth; + daW.To = WindowOv.ActualWidth - 227.333; + daW.Duration = new Duration(TimeSpan.FromSeconds(0.3)); + WindowOv.BeginAnimation(Ellipse.WidthProperty, daW); + } + } + } + + private void ExpandMoreButton_Click(object sender, RoutedEventArgs e) + { + if (ExpandMoreButton.Content.ToString() == "+") + { + ExpandMoreButton.Content = "-"; + DoubleAnimation daH = new DoubleAnimation(); + daH.From = WindowOv.ActualHeight; + daH.To = WindowOv.ActualHeight + 185; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.3)); + WindowOv.BeginAnimation(Ellipse.HeightProperty, daH); + } + else + { + ExpandMoreButton.Content = "+"; + DoubleAnimation daH = new DoubleAnimation(); + daH.From = WindowOv.ActualHeight; + daH.To = WindowOv.ActualHeight - 185; + daH.Duration = new Duration(TimeSpan.FromSeconds(0.3)); + WindowOv.BeginAnimation(Ellipse.HeightProperty, daH); + } + } + + private void BRSoundOptionCheckBox_Click(object sender, RoutedEventArgs e) + { + if (BRSoundOptionCheckBox.IsChecked == true) + { + Settings.Default["BRPlaySoundSetting"] = "1"; + Settings.Default.Save(); + } + else + { + Settings.Default["BRPlaySoundSetting"] = "0"; + Settings.Default.Save(); + } + } + + private void ITRSoundOptionCheckBox_Click(object sender, RoutedEventArgs e) + { + if (ITRSoundOptionCheckBox.IsChecked == true) + { + Settings.Default["ITRPlaySoundSetting"] = "1"; + Settings.Default.Save(); + } + else + { + Settings.Default["ITRPlaySoundSetting"] = "0"; + Settings.Default.Save(); + } + } + } +} diff --git a/YPBBT/DA_Startup.xaml b/YPBBT/DA_Startup.xaml new file mode 100644 index 0000000..d5865d4 --- /dev/null +++ b/YPBBT/DA_Startup.xaml @@ -0,0 +1,921 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/YPBBT/DA_Startup.xaml.cs b/YPBBT/DA_Startup.xaml.cs new file mode 100644 index 0000000..c61bd15 --- /dev/null +++ b/YPBBT/DA_Startup.xaml.cs @@ -0,0 +1,535 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Discord; +using Discord.WebSocket; +using System.Diagnostics; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading; +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.Animation; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace YPBBT +{ + /// + /// Interaction logic for DA_Startup.xaml + /// + public partial class DA_Startup : Window + { + DiscordSocketClient discord = new DiscordSocketClient();/// Discord_Client + List LanguageLinesCollection = new List();/// Words List used for translation + List ServersCollection = new List();/// List of Server ID's Collected using Discord_Client + List ChannelsCollection = new List();/// List of Channel ID's Collected using Discord_Client + List AlertChannelsCollection = new List(); + string AppVersion = "3.13b";/// Current App Version + string Default_Language;/// String for Default Selected Langauge + bool Profile_Setup_IsCompleted = false;///make sure if the setup if completed so when its closed it opens MainWindow + public DA_Startup() + { + InitializeComponent(); + AppVersionLabel0.Content = "YPBBT " + AppVersion; + AppVersionLabel1.Content = "YPBBT " + AppVersion; + bool App_isalready_opend = false; + this.Visibility = Visibility.Hidden; + if (System.Diagnostics.Process.GetProcessesByName(System.IO.Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetEntryAssembly().Location)).Count() > 1)///Check if the application is already opend + { + if(File.Exists(System.IO.Directory.GetCurrentDirectory() + "/Resources/DA_Profile")) + { + string lines = File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/DA_Profile");//read Profile File + string[] RefferalsFilter = lines.Split('|'); + Load_Language_File(RefferalsFilter[0].ToString()); + } + else + {Load_Language_File();} + App_isalready_opend = true; + this.Visibility = Visibility.Hidden; + ErrorMessageBox emb = new ErrorMessageBox(LanguageLinesCollection[23].ToString(), LanguageLinesCollection[24].ToString(), LanguageLinesCollection[25].ToString(), LanguageLinesCollection[14].ToString()); + emb.MB_typeYN_DA_Startup(LanguageLinesCollection[21].ToString(), LanguageLinesCollection[22].ToString(), 1, this); + emb.Show(); + } + Run_Profile_Setup(App_isalready_opend); + } + public void Run_Profile_Setup(bool App_isalready_opend)///check if profile already been created if not start Profile Setup + { + if (App_isalready_opend == false) + { + if (File.Exists(System.IO.Directory.GetCurrentDirectory() + "/Resources/DA_Profile")) + { + DA_MainWindow ma = new DA_MainWindow(0); + ma.Show(); + this.Close(); + } + else + { + this.Visibility = Visibility.Visible; + CIDGRID.Visibility = Visibility.Hidden; + AlertCIDGRID.Visibility = Visibility.Hidden; + Step5NextButton.Visibility = Visibility.Hidden; + System.Threading.Thread.Sleep(2000); + tab0.Visibility = Visibility.Hidden; + tab1.Visibility = Visibility.Hidden; + tab2.Visibility = Visibility.Hidden; + tab3.Visibility = Visibility.Hidden; + tab4.Visibility = Visibility.Hidden; + tab5.Visibility = Visibility.Hidden; + tab6.Visibility = Visibility.Hidden; + tab7.Visibility = Visibility.Hidden; + mediaElement.LoadedBehavior = MediaState.Play; + mediaElement.Source = new Uri(System.IO.Directory.GetCurrentDirectory() + @"\Resources\img\SA_bckg.mp4", UriKind.Absolute); + Step1_2MediaElement.Stop(); + Step2MediaElement.Stop(); + Step3MediaElement.Stop(); + Step4MediaElement.Stop(); + Tabcontrol1.SelectedIndex = 7; + } + } + } + private void Load_Language_File(string SL = "en")///Load Language Files + { + Step1_2MediaElement.Stop(); + Step2MediaElement.Stop(); + Step3MediaElement.Stop(); + Step4MediaElement.Stop(); + Default_Language = SL; + try { LanguageLinesCollection.Clear(); } catch (Exception) { } + string lines = File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/Languages/" + SL); + string[] RefferalsFilter = lines.Split('}'); + foreach (var rf in RefferalsFilter) + { + LanguageLinesCollection.Add(rf); + } + S0Label0.Text = LanguageLinesCollection[0].ToString(); + Tc0SkipButton.Content = LanguageLinesCollection[1].ToString();// skip + Tc0NextButton.Content = LanguageLinesCollection[2].ToString(); // Next + S1L0.Content = LanguageLinesCollection[3].ToString() + " 1";//Step + S1L1.Text = LanguageLinesCollection[5].ToString(); + Step1_OpenDiscordDevUrl_Button.ToolTip = LanguageLinesCollection[6].ToString(); + Step1_2Label.Text = LanguageLinesCollection[7].ToString(); + Step1NextButton.Content = LanguageLinesCollection[2].ToString(); + S2L0.Content = LanguageLinesCollection[3].ToString() + " 2";//Step + //LanguageLinesCollection[4].ToString() is Empty + S2L1.Text = LanguageLinesCollection[8].ToString(); + Step2NextButton.Content = LanguageLinesCollection[2].ToString(); // Next + S3L0.Content = LanguageLinesCollection[3].ToString() + " 3";//Step + S3L1.Text = LanguageLinesCollection[9].ToString(); + ClientIDLABEL.Content = LanguageLinesCollection[10].ToString(); + Step3CIDTextbox.Text = LanguageLinesCollection[10].ToString().Remove(LanguageLinesCollection[10].Length - 2, 1); + Step3InviteBotButton.Content = LanguageLinesCollection[11].ToString();//Invite + Step3NextButton.Content = LanguageLinesCollection[2].ToString(); // Next + S4L0.Content = LanguageLinesCollection[3].ToString() + " 4";//Step + S4L1.Text = LanguageLinesCollection[12].ToString(); + TokenLabel.Content = LanguageLinesCollection[13].ToString();//Token: + Step4TokenTextbox.Text = LanguageLinesCollection[13].ToString().Remove(LanguageLinesCollection[13].Length - 2, 1); + Step4TestTokenButton.Content = LanguageLinesCollection[14].ToString();//Test Token + Step4NextButton.Content = LanguageLinesCollection[2].ToString(); // Next + S5L0.Content = LanguageLinesCollection[3].ToString() + " 5";//Step + S5L1.Text = LanguageLinesCollection[15].ToString(); + ServerIDLAbel.Content = LanguageLinesCollection[16].ToString(); + ChannelIDLabel.Content = LanguageLinesCollection[17].ToString(); + S5L2.Text = LanguageLinesCollection[18].ToString(); + Step5NextButton.Content = LanguageLinesCollection[2].ToString(); // Next + S6L0.Content = LanguageLinesCollection[19].ToString(); + S6L1.Text = LanguageLinesCollection[20].ToString(); + //LanguageLinesCollection[21].ToString() is "WARNING" + //LanguageLinesCollection[22].ToString() is "The Application is already running in the background do you want to close it before continuing?" + //LanguageLinesCollection[23].ToString() is "Ok" + //LanguageLinesCollection[24].ToString() is "No" + //LanguageLinesCollection[25].ToString() is "Yes" + AlertChannelIDLabel.Content = LanguageLinesCollection[26].ToString(); //Alert Channel ID: + //LanguageLinesCollection[27].ToString() is > **Welcome To Yuri Project Bdo Boss Timer Self Rolling Settings** + //LanguageLinesCollection[28].ToString() is > **U can customize all the settings on the self rolling menu** + + + #region"animate Selected Language Tab" + selctedlangImg.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/img/" + SL + ".png")); + var left = Tabcontrol1.Margin.Left; + TranslateTransform trans = new TranslateTransform(); + Tabcontrol1.RenderTransform = trans; + DoubleAnimation anim1 = new DoubleAnimation(left, 1000 + left, TimeSpan.FromSeconds(1)); + anim1.AutoReverse = true; + trans.BeginAnimation(TranslateTransform.XProperty, anim1); + + DoubleAnimation da = new DoubleAnimation(); + da.From = 1; + da.To = 0; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + da.Completed += (s, _) => { + Tabcontrol1.SelectedIndex = 0; + }; + Tabcontrol1.BeginAnimation(OpacityProperty, da); + + DoubleAnimation dar = new DoubleAnimation(); + dar.Duration = new Duration(TimeSpan.FromSeconds(2)); + dar.AutoReverse = false; + Tabcontrol1.BeginAnimation(OpacityProperty, dar); + #endregion + } + private void Window_MouseDown(object sender, MouseButtonEventArgs e)///Move Window by clicking and holding anywhere on it {DragMove()} + { + try + { + if (e.ChangedButton == MouseButton.Left) + this.DragMove(); + } + catch (Exception) { } + } + private void Tc0SkipButton_Click(object sender, RoutedEventArgs e)///Skip Bot Creation Steps + { + Step3NextButton.Visibility = Visibility.Hidden; + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(2)); + da.AutoReverse = false; + Tabcontrol1.BeginAnimation(OpacityProperty, da); + Tabcontrol1.SelectedIndex = 3; + } + private void Tc0NextButton_Click(object sender, RoutedEventArgs e)///Tabcontrol0 NextButton Function + { + Step1_2Label.Visibility = Visibility.Hidden; + Step1_2MediaElement.Visibility = Visibility.Hidden; + Step1NextButton.Visibility = Visibility.Hidden; + Tabcontrol1.Opacity = 0; + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(2)); + da.AutoReverse = false; + Tabcontrol1.BeginAnimation(OpacityProperty, da); + Tabcontrol1.SelectedIndex = 1; + } + private void Step1_OpenDiscordDevUrl_Button_Click(object sender, RoutedEventArgs e) + { + System.Diagnostics.Process.Start("https://discordapp.com/developers/applications/"); + Step1_2Label.Visibility = Visibility.Visible; + Step1NextButton.Visibility = Visibility.Visible; + Step1_2MediaElement.Visibility = Visibility.Visible; + Step1_2MediaElement.Position = new TimeSpan(0, 0, 0); + Step1_2MediaElement.Play(); + } + private void Step1_2MediaElement_MediaEnded(object sender, RoutedEventArgs e)///Replay When Video Ended + { Step1_2MediaElement.Position = new TimeSpan(0, 0, 0); Step1_2MediaElement.Play();} + private void Step1_2MediaElement_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)///Open Video On Click + {System.Diagnostics.Process.Start(System.IO.Directory.GetCurrentDirectory() + "/Resources/img/Step1.2.mp4");} + private void Step1NextButton_Click(object sender, RoutedEventArgs e)///Step 1 Tabcontrol1 Next_Button Function + { + Step2MediaElement.Stop(); + Step1_2Label.Visibility = Visibility.Hidden; + Step1_2MediaElement.Visibility = Visibility.Hidden; + Step2MediaElement.Position = new TimeSpan(0, 0, 0); + Step2MediaElement.Play(); + Tabcontrol1.Opacity = 0; + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(2)); + da.AutoReverse = false; + Tabcontrol1.BeginAnimation(OpacityProperty, da); + Tabcontrol1.SelectedIndex = 2; + } + + private void Step2MediaElement_MediaEnded(object sender, RoutedEventArgs e)///Repeat the video if ended + {Step2MediaElement.Position = new TimeSpan(0, 0, 0);Step2MediaElement.Play();} + private void Step2MediaElement_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)///Step 2 Creating a bot video Load + {System.Diagnostics.Process.Start(System.IO.Directory.GetCurrentDirectory() + "/Resources/img/Step2MakeBot.mp4");} + private void Step2NextButton_Click(object sender, RoutedEventArgs e)///Step 2 Tabcontrol 2 Next_button Function + { + Step2MediaElement.Stop(); + Step3NextButton.Visibility = Visibility.Hidden; + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(2)); + da.AutoReverse = false; + Tabcontrol1.BeginAnimation(OpacityProperty, da); + Tabcontrol1.SelectedIndex = 3; + } + + private void Step3MediaElement_MediaEnded(object sender, RoutedEventArgs e)///Repeat When video is Ended + { Step3MediaElement.Position = new TimeSpan(0, 0, 0); Step3MediaElement.Play(); } + private void Step3CIDTextbox_GotFocus(object sender, RoutedEventArgs e)///Client ID TextBox Empty Textbox on focus Event + { if (Step3CIDTextbox.Text == LanguageLinesCollection[10].ToString().Remove(LanguageLinesCollection[10].Length - 2, 1)) { Step3CIDTextbox.Text = ""; } } + private void Step3InviteBotButton_Click(object sender, RoutedEventArgs e)///Check if the Client ID textBox is Valid ID and Invite The Bot To Discord Server + { + var bc = new BrushConverter(); + Step3CIDTextbox.BorderBrush = (Brush)bc.ConvertFrom("#FFABADB3"); + Regex regex = new Regex("[^0-9-]+");///Regex Parameters for Numbers Only + + foreach (char c in Step3CIDTextbox.Text.ToString())//check for every character in Client ID TextBox.text making sure that all are numbers only if one of the characters are not then empty the textbox + { if (regex.IsMatch(c.ToString()) == true) { Step3CIDTextbox.Text = ""; } } + + if (Step3CIDTextbox.Text == LanguageLinesCollection[10].ToString().Remove(LanguageLinesCollection[10].Length - 2, 1)) + { Step3CIDTextbox.Text = ""; } + + if (Step3CIDTextbox.Text != "") + { System.Diagnostics.Process.Start("https://discordapp.com/oauth2/authorize?&client_id=" + Step3CIDTextbox.Text + "&scope=bot&permissions=8"); Step3NextButton.Visibility = Visibility.Visible; } + else + { Step3CIDTextbox.BorderBrush = Brushes.Red; } + } + private void Step3MediaElement_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)///Open Video On click + { System.Diagnostics.Process.Start(System.IO.Directory.GetCurrentDirectory() + "/Resources/img/Step2CID.mp4"); } + private void Step3NextButton_Click(object sender, RoutedEventArgs e)///Step 3 Tabcontrol 3 Next_button Event + { + Step4NextButton.Visibility = Visibility.Hidden; + Step3MediaElement.Position = new TimeSpan(0, 0, 0); + Step3MediaElement.Stop(); + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(2)); + da.AutoReverse = false; + Tabcontrol1.BeginAnimation(OpacityProperty, da); + Tabcontrol1.SelectedIndex = 4; + } + + private void Step4TokenTextbox_GotFocus(object sender, RoutedEventArgs e)///Empty Token Textbox On focus if Text = Token + { if (Step4TokenTextbox.Text == LanguageLinesCollection[13].ToString().Remove(LanguageLinesCollection[13].Length - 2, 1)){ Step4TokenTextbox.Text = ""; } } + #region"Token Button Background Color Changes On mouse Enter/Leave" + private void Step4TestTokenButton_MouseEnter(object sender, MouseEventArgs e) + {var bc = new BrushConverter();Step4TestTokenButton.Background = (Brush)bc.ConvertFrom("#818182");} + private void Step4TestTokenButton_MouseLeave(object sender, MouseEventArgs e) + { var bc = new BrushConverter();Step4TestTokenButton.Background = (Brush)bc.ConvertFrom("#FFA9A9AA"); } + #endregion + private async void Step4TestTokenButton_Click(object sender, RoutedEventArgs e)///Test Token Using Catch Exception as triger for Failing to Connect + { + try + { + SidCombobox.Items.Clear(); + ServersCollection.Clear(); + + await discord.LoginAsync(TokenType.Bot, Step4TokenTextbox.Text); + await discord.StartAsync(); + + Step4TokenTextbox.BorderBrush = Brushes.Green; + Step4TestTokenButton.Background = Brushes.Green; + Step4TestTokenButton.IsEnabled = false; + } + catch (Exception) + { + Step4TokenTextbox.BorderBrush = Brushes.Red; + Step4TestTokenButton.Background = Brushes.Red; + } + + if (Step4TokenTextbox.BorderBrush == Brushes.Green) + { Step4NextButton.Visibility = Visibility.Visible; } + } + private void Step4MediaElement_MediaEnded(object sender, RoutedEventArgs e)///Repeat Video if Ended + {Step4MediaElement.Position = new TimeSpan(0, 0, 0); Step4MediaElement.Play();} + private void Step4MediaElement_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)///Open Video On click + {System.Diagnostics.Process.Start(System.IO.Directory.GetCurrentDirectory() + "/Resources/img/Step4GetToken.mp4");} + private void Step4NextButton_Click(object sender, RoutedEventArgs e)///Step 4 Tabcontrol 4 Next_button Event + { + var servers = discord.Guilds; + foreach (var server in servers)///Get Server Id's And Names and add them to servercollection list + {SidCombobox.Items.Add(server.ToString());ServersCollection.Add(server.Id.ToString());} + Step4MediaElement.Position = new TimeSpan(0, 0, 0); + Step4MediaElement.Stop(); + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(2)); + da.AutoReverse = false; + Tabcontrol1.BeginAnimation(OpacityProperty, da); + Tabcontrol1.SelectedIndex = 5; + } + private void SidCombobox_DropDownClosed(object sender, EventArgs e)///After Server is selected from Combobox Get Channel names and id's and add them to channels collection and Cidcombobox + { + if (SidCombobox.SelectedIndex > -1) + { + CIDGRID.Visibility = Visibility.Visible; + CidCombobox.Items.Clear(); + AlertCidCombobox.Items.Clear(); + ChannelsCollection.Clear(); + AlertChannelsCollection.Clear(); + + ulong sid = ulong.Parse(ServersCollection[SidCombobox.SelectedIndex].ToString()); + var guild = discord.GetGuild(sid); + var channels = guild.TextChannels; + foreach (var channel in channels) + { CidCombobox.Items.Add(channel.ToString()); ChannelsCollection.Add(channel.Id.ToString()); AlertCidCombobox.Items.Add(channel.ToString()); AlertChannelsCollection.Add(channel.Id.ToString());} + } + } + private void CidCombobox_DropDownClosed(object sender, EventArgs e) + { + if(CidCombobox.SelectedIndex > -1) + { + AlertCidCombobox.Items.Clear(); + AlertChannelsCollection.Clear(); + int index = 0; + foreach(var channel in ChannelsCollection) + { if (index != CidCombobox.SelectedIndex) { AlertChannelsCollection.Add(channel); } index++; } + index = 0; + foreach (var channel in CidCombobox.Items) + { if (index != CidCombobox.SelectedIndex) { AlertCidCombobox.Items.Add(channel.ToString()); } index++; } + AlertCIDGRID.Visibility = Visibility.Visible; + } + } + private void CidCombobox_DropDownOpened(object sender, EventArgs e) + { + CidCombobox.Items.Clear(); + AlertCidCombobox.Items.Clear(); + ChannelsCollection.Clear(); + AlertChannelsCollection.Clear(); + + ulong sid = ulong.Parse(ServersCollection[SidCombobox.SelectedIndex].ToString()); + var guild = discord.GetGuild(sid); + var channels = guild.TextChannels; + foreach (var channel in channels) + { CidCombobox.Items.Add(channel.ToString()); ChannelsCollection.Add(channel.Id.ToString()); AlertCidCombobox.Items.Add(channel.ToString()); AlertChannelsCollection.Add(channel.Id.ToString()); } + } + private void AlertCidCombobox_DropDownClosed(object sender, EventArgs e) + { + if (AlertCidCombobox.SelectedIndex > -1) + { Step5NextButton.Visibility = Visibility.Visible; } + } + private void AlertCidCombobox_DropDownOpened(object sender, EventArgs e) + { + AlertCidCombobox.Items.Clear(); + AlertChannelsCollection.Clear(); + + ulong sid = ulong.Parse(ServersCollection[SidCombobox.SelectedIndex].ToString()); + var guild = discord.GetGuild(sid); + var channels = guild.TextChannels; + ulong MainChannel_ID = ulong.Parse(ChannelsCollection[CidCombobox.SelectedIndex]); + foreach (var channel in channels) + { + if (channel.Id != MainChannel_ID) + { AlertCidCombobox.Items.Add(channel.ToString()); AlertChannelsCollection.Add(channel.Id.ToString()); } + } + } + private void Step5NextButton_Click(object sender, RoutedEventArgs e)///Step5 Tabcontrol 5 NextButton function Save Data Profile + { + string data = Default_Language + "|" + + Step3CIDTextbox.Text + "|" + + Step4TokenTextbox.Text + + "|" + SidCombobox.Text + "{" + ServersCollection[SidCombobox.SelectedIndex].ToString() + + "|"+ CidCombobox.Text + "{" + ChannelsCollection[CidCombobox.SelectedIndex].ToString() + + "|" + "@everyone{@everyone|" + + "@everyone{@everyone|" + + "@everyone{@everyone" + + "|2|30|" + + "@everyone{@everyone|" + + "@everyone{@everyone" + + "|" + AlertCidCombobox.Text + "{" + AlertChannelsCollection[AlertCidCombobox.SelectedIndex].ToString(); + File.WriteAllText(Directory.GetCurrentDirectory() + "/Resources/DA_Profile", data); + File.WriteAllText(Directory.GetCurrentDirectory() + "/Resources/DA_Bosses", File.ReadAllText(Directory.GetCurrentDirectory() + "/Resources/BossesOrigin")); + File.WriteAllText(Directory.GetCurrentDirectory() + "/Resources/LYPBBTTT", File.ReadAllText(Directory.GetCurrentDirectory() + "/Resources/LYPBBTTT_Origin")); + string SelfRolling = "[Channel]{[/Channel]" + + Environment.NewLine + "[StartMessage]"+ LanguageLinesCollection[27].ToString() + "[/StartMessage]" + + Environment.NewLine + "[MessageRoles][/MessageRoles]" + + Environment.NewLine + "[EndMessage]"+ LanguageLinesCollection[28].ToString() + "[/EndMessage]" + + Environment.NewLine + "[MainMessageID][/MainMessageID]"; + File.WriteAllText(Directory.GetCurrentDirectory() + "/Resources/SelfRolling", SelfRolling); + + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(2)); + da.AutoReverse = false; + Tabcontrol1.BeginAnimation(OpacityProperty, da); + Tabcontrol1.SelectedIndex = 6; + } + private void Image_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)///Join Discord Url + {System.Diagnostics.Process.Start("https://discord.gg/8SCcCJq");} + private void Image_MouseLeftButtonDown_1(object sender, MouseButtonEventArgs e)///Close Profile Startup and open main app + { Profile_Setup_IsCompleted = true; this.Close();} + + private void animate_Language_Label(string language_text)///animate language buttons hover language Transition + { + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + SetLanguageLabel.BeginAnimation(OpacityProperty, da); + SetLanguageLabel.Content = language_text; + } + #region"Language Buttons Mouse Enter Enevnts" + private void frButton_MouseEnter(object sender, MouseEventArgs e) + {animate_Language_Label("Choisir la langue");} + private void enButton_MouseEnter(object sender, MouseEventArgs e) + {animate_Language_Label("Select Language");} + private void esButton_MouseEnter(object sender, MouseEventArgs e) + {animate_Language_Label("Seleccione el idioma");} + private void ruButton_MouseEnter(object sender, MouseEventArgs e) + {animate_Language_Label("выбрать язык");} + private void jpButton_MouseEnter(object sender, MouseEventArgs e) + {animate_Language_Label("言語を選択する");} + private void krButton_MouseEnter(object sender, MouseEventArgs e) + {animate_Language_Label("언어를 선택하십시오");} + #endregion + #region"Load Clicked Language click_Event" + private void frButton_Click(object sender, RoutedEventArgs e) + {Load_Language_File("fr");} + + private void enButton_Click(object sender, RoutedEventArgs e) + {Load_Language_File("en");} + + private void esButton_Click(object sender, RoutedEventArgs e) + {Load_Language_File("es");} + + private void ruButton_Click(object sender, RoutedEventArgs e) + {Load_Language_File("ru");} + + private void jpButton_Click(object sender, RoutedEventArgs e) + {Load_Language_File("jp");} + + private void krButton_Click(object sender, RoutedEventArgs e) + {Load_Language_File("kr");} + #endregion + private void SelectedlangButton_Click(object sender, RoutedEventArgs e)///Select Other Langauge Button + { + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(2)); + da.AutoReverse = false; + Tabcontrol1.BeginAnimation(OpacityProperty, da); + Tabcontrol1.SelectedIndex = 7; + } + private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)///Event on closing animate then close + { + Closing -= Window_Closing; + e.Cancel = true; + var anim = new DoubleAnimation(0, (Duration)TimeSpan.FromSeconds(1)); + anim.Completed += (s, _) => Excute(); + this.BeginAnimation(UIElement.OpacityProperty, anim); + } + private async void Excute()///excute Type of closing + { + if (Profile_Setup_IsCompleted == true) + { + await discord.StopAsync(); + DA_MainWindow ma = new DA_MainWindow(1); + ma.Show(); + } + this.Close(); + } + private void NumberValidationTextBox(object sender, TextCompositionEventArgs e)///Insures only inputed numbers on textbox + { + Regex regex = new Regex("[^0-9-]+"); + e.Handled = regex.IsMatch(e.Text); + } + + private void mediaElement_MediaEnded(object sender, RoutedEventArgs e)///repat video if ended + {mediaElement.Position = new TimeSpan(0, 0, 0); mediaElement.Play();} + + private void Step4TokenTextbox_KeyUp(object sender, KeyEventArgs e) + { + Step4TestTokenButton.IsEnabled = true; + } + + + } +} \ No newline at end of file diff --git a/YPBBT/Discord_Bot.cs b/YPBBT/Discord_Bot.cs new file mode 100644 index 0000000..9a6e4da --- /dev/null +++ b/YPBBT/Discord_Bot.cs @@ -0,0 +1,367 @@ +using Discord; +using Discord.WebSocket; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media; +using System.Windows.Media.Imaging; + +namespace YPBBT +{ + public class Discord_Bot + { + DA_MainWindow Public_MainWindow; + public async void GetDiscordData(DA_MainWindow MainWindow) + { + Public_MainWindow = MainWindow; + try + { + var bc = new BrushConverter(); + Application.Current.Dispatcher.Invoke((Action)(() => { + Public_MainWindow.DiscordBotConnectionStatusLabel.Foreground = (Brush)bc.ConvertFrom("#FFF1F1F1"); + Public_MainWindow.DiscordBotConnectionStatusLabel.Content = Public_MainWindow.LanguageCollection[6].ToString();//"Connecting..."; + if(Public_MainWindow.discord.ConnectionState == ConnectionState.Connected) + { Public_MainWindow.Processing_Status(false, "Reconnecting Bot..."); } + else + { Public_MainWindow.Processing_Status(false, "Connecting Bot..."); } + })); + await Public_MainWindow.discord.LoginAsync(TokenType.Bot, Public_MainWindow.Token); + await Public_MainWindow.discord.StartAsync(); + System.Threading.Thread.Sleep(2000); + + Application.Current.Dispatcher.Invoke((Action)(() => { + if (Public_MainWindow.DiscordBotConnectionStatusLabel.Content.ToString() == Public_MainWindow.LanguageCollection[6].ToString()) + { + Public_MainWindow.DiscordBotConnectionStatusLabel.Foreground = (Brush)bc.ConvertFrom("#FF669174"); + Public_MainWindow.DiscordBotConnectionStatusLabel.Content = Public_MainWindow.LanguageCollection[8].ToString();//"Connected"; + Public_MainWindow.Processing_Status(true, "Bot is Connected."); + } + })); + + } + catch (Exception s) + { + if (s is Discord.Net.HttpException) + { + await Public_MainWindow.discord.StopAsync(); + Application.Current.Dispatcher.Invoke((Action)(() => { + ErrorMessageBox emb = new ErrorMessageBox(Public_MainWindow.LanguageCollection[119].ToString(), Public_MainWindow.LanguageCollection[120].ToString(), Public_MainWindow.LanguageCollection[121].ToString(), Public_MainWindow.LanguageCollection[122].ToString()); + emb.MB_typeOK(Public_MainWindow.LanguageCollection[108].ToString(), s.Message + Environment.NewLine + Environment.NewLine + Public_MainWindow.LanguageCollection[109].ToString(), Public_MainWindow); + emb.Show(); + Public_MainWindow.IsEnabled = false; + })); + } + var bc = new BrushConverter(); + Application.Current.Dispatcher.Invoke((Action)(() => { + Public_MainWindow.DiscordBotConnectionStatusLabel.Foreground = (Brush)bc.ConvertFrom("#FFBB3D3D"); + Public_MainWindow.DiscordBotConnectionStatusLabel.Content = Public_MainWindow.LanguageCollection[7].ToString();//"Connection ERROR!"; + Public_MainWindow.Processing_Status(true, "Failed to connect Bot.", true); + })); + /*StartPosting();*/ + } + } + public static string GetStrBetweenTags(string value, string startTag, string endTag) + { + if (value.Contains(startTag) && value.Contains(endTag)) + { + int index = value.IndexOf(startTag) + startTag.Length; + return value.Substring(index, value.IndexOf(endTag) - index); + } + else + return null; + } + public void StartPosting_Cooldown(DA_MainWindow MainWindow) + { + System.Threading.Thread.Sleep(5000); + Application.Current.Dispatcher.Invoke((Action)(() => { + MainWindow.StartPostingButton.IsEnabled = true; + })); + } + public async void StartPosting(DA_MainWindow MainWindow)// purge discord channel and start posting + { + Public_MainWindow = MainWindow; + if (Public_MainWindow.ServerID != 0) + { + try + { + var bc = new BrushConverter(); + try + { + Application.Current.Dispatcher.Invoke((Action)(() => { + Public_MainWindow.DiscordBotConnectionStatusLabel.Foreground = (Brush)bc.ConvertFrom("#FFF1F1F1"); + Public_MainWindow.DiscordBotConnectionStatusLabel.Content = Public_MainWindow.LanguageCollection[6].ToString();//"Connecting..."; + })); + await Public_MainWindow.discord.LoginAsync(TokenType.Bot, Public_MainWindow.Token); + await Public_MainWindow.discord.StartAsync(); + System.Threading.Thread.Sleep(1000); + } + catch (Exception) + { + Application.Current.Dispatcher.Invoke((Action)(() => { + Public_MainWindow.DiscordBotConnectionStatusLabel.Foreground = (Brush)bc.ConvertFrom("#FFBB3D3D"); + Public_MainWindow.DiscordBotConnectionStatusLabel.Content = Public_MainWindow.LanguageCollection[7].ToString();//"Connection ERROR!"; + })); + } + + if (Public_MainWindow.discord.ConnectionState == Discord.ConnectionState.Connected) + { + var guild = Public_MainWindow.discord.GetGuild(Public_MainWindow.ServerID); + SocketTextChannel channel = guild.GetTextChannel(Public_MainWindow.Main_BotChannel_ID); + + var messages = await channel.GetMessagesAsync(100).FlattenAsync(); //defualt is 100 + System.Threading.Thread.Sleep(2000); + await (channel as SocketTextChannel).DeleteMessagesAsync(messages); + var embed1 = new EmbedBuilder(); + string ANmessage = ""; + Application.Current.Dispatcher.Invoke((Action)(() => { + string[] pbu = Public_MainWindow.publicbossUrl.Split('|'); + string[] bnu = Public_MainWindow.CbossNameLabel.Content.ToString().Split('&'); + + if (Public_MainWindow.CbossNameLabel.Content.ToString().Contains("&")) + { + ANmessage = Public_MainWindow.LanguageCollection[123].ToString() + Environment.NewLine + "[" + bnu[0] + "](" + pbu[0] + ")" + " <---" + Public_MainWindow.LanguageCollection[85].ToString() + Environment.NewLine + "[" + bnu[1] + "](" + pbu[1] + ")" + " <---" + Public_MainWindow.LanguageCollection[85].ToString(); + } + else + { + ANmessage = Public_MainWindow.LanguageCollection[123].ToString() + Environment.NewLine + "[" + bnu[0] + "](" + pbu[0] + ")" + " <---" + Public_MainWindow.LanguageCollection[85].ToString(); + } + embed1 = new EmbedBuilder + { + Title = Public_MainWindow.CbossNameLabel.Content.ToString()/* + " <---" + LanguageCollection[87].ToString()*/, + ImageUrl = Public_MainWindow.publicNbossimage, + Color = Discord.Color.LightGrey, + //Url = publicbossUrl, + Description = ANmessage + }; + })); + //Emoji emj = new Emoji("<:download1:832276391789199430>"); + //var s = guild.Emotes; + //var exampleFooter = new EmbedFooterBuilder().WithText( + // "Reaction 1" + " 0️⃣ " + Environment.NewLine + // + "Reaction 2" + Environment.NewLine + // + "Reaction 3" + Environment.NewLine); + //embed1.WithFooter(exampleFooter); + + + var BossImage = await channel.SendMessageAsync("", false, embed1.Build()); + var AlertChannel = guild.TextChannels.FirstOrDefault(ch => ch.Id == Public_MainWindow.Alert_BotChannel_ID); + var Alert_Embed = new EmbedBuilder + { + Title = "YPBBT is Connected" /*+ " <---" + LanguageCollection[87].ToString()*/, + ThumbnailUrl = "https://raw.githubusercontent.com/kresmes/BDO-Boss-Timer-Discord-Bot-Yuri-Project-/master/Resources/Images/Connected.png", + Color = Discord.Color.LightGrey, + //Url = publicbossUrl + Description = "All Notifications Will be Send to this channel" + }; + await AlertChannel.SendMessageAsync("", false, Alert_Embed.Build()); + Public_MainWindow.bossImageID = BossImage.Id; + + //var embed = new EmbedBuilder + //{ + // Title = "Boss Name" + //}; + //embed.AddField("Next Boss in:", "00:00:00", true); + //embed.AddField("Night In:", "00:00:00", true); + //embed.AddField("Imperial Reset:", "00:00:00", true) + // .WithColor(Color.Blue) + // .WithUrl("https://example.com") + // .Build(); + //var MainMessage = await channel.SendMessageAsync("", false, embed.Build()); + + string message = ""; + Application.Current.Dispatcher.Invoke((Action)(() => { + string nb = "> ```cs" + Environment.NewLine + "> " + Public_MainWindow.CurrentBossTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; + string nti = "> ```cs" + Environment.NewLine + "> " + Public_MainWindow.NightInBdoTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; + string iri = "> ```cs" + Environment.NewLine + "> " + Public_MainWindow.IRTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; + string br = "> ```cs" + Environment.NewLine + "> " + Public_MainWindow.BRTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; + string itr = "> ```cs" + Environment.NewLine + "> " + Public_MainWindow.ITRITimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; + if (Public_MainWindow.CurrentBossTimeLabel.Content.ToString().StartsWith("00:")) + { nb = "> ```css" + Environment.NewLine + "> " + Public_MainWindow.CurrentBossTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; } + if (Public_MainWindow.NightInBdoTimeLabel.Content.ToString().StartsWith("00:")) + { nti = "> ```css" + Environment.NewLine + "> " + Public_MainWindow.NightInBdoTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; } + if (Public_MainWindow.IRTimeLabel.Content.ToString().StartsWith("00:")) + { iri = "> ```css" + Environment.NewLine + "> " + Public_MainWindow.IRTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; } + if (Public_MainWindow.BRTimeLabel.Content.ToString().StartsWith("00:")) + { br = "> ```css" + Environment.NewLine + "> " + Public_MainWindow.BRTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; } + if (Public_MainWindow.ITRITimeLabel.Content.ToString().StartsWith("00:")) + { itr = "> ```css" + Environment.NewLine + "> " + Public_MainWindow.ITRITimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; } + + + message = "> " + Public_MainWindow.CbossLabel.Content.ToString() + Environment.NewLine + + nb + Environment.NewLine + + "> " + Public_MainWindow.NILabel.Content.ToString() + Environment.NewLine + + nti + Environment.NewLine + + "> " + Public_MainWindow.IRILabel.Content.ToString() + Environment.NewLine + + iri + Environment.NewLine + + "> " + Public_MainWindow.BRILabel.Content.ToString() + Environment.NewLine + + br + Environment.NewLine + + "> " + Public_MainWindow.ITRILabel.Content.ToString() + Environment.NewLine + + itr; + })); + Public_MainWindow.MainMessage = await channel.SendMessageAsync(message); + Public_MainWindow.MainMessageID = Public_MainWindow.MainMessage.Id; + Application.Current.Dispatcher.Invoke((Action)(() => { + if (Public_MainWindow.DiscordBotConnectionStatusLabel.Content.ToString() == Public_MainWindow.LanguageCollection[6].ToString()) + { + + Public_MainWindow.DiscordBotConnectionStatusLabel.Foreground = (Brush)bc.ConvertFrom("#FF669174"); + Public_MainWindow.DiscordBotConnectionStatusLabel.Content = Public_MainWindow.LanguageCollection[8].ToString();//"Connected"; + + } + })); + bool DTT_isChecked = false; + Application.Current.Dispatcher.Invoke((Action)(() => { DTT_isChecked = Public_MainWindow.DisplayTimeTableSetting.IsChecked.Value; })); + + if (DTT_isChecked) + { + var timetablemessage = await channel.SendFileAsync(System.IO.Directory.GetCurrentDirectory() + "/Resources/TimeTable.png", Public_MainWindow.MOTR.ToString().ToUpper() + Public_MainWindow.LanguageCollection[43].ToString()); + Public_MainWindow.TimtableID = timetablemessage.Id; + } + + if (Public_MainWindow.discord.ConnectionState == Discord.ConnectionState.Connected) + { Application.Current.Dispatcher.Invoke((Action)(() => { MainWindow.SelfRollingStartUp(); })); } + Public_MainWindow.isposting = 1; + } + } + catch (Exception s) + { + if (s is Discord.Net.HttpException) + { + await Public_MainWindow.discord.StopAsync(); + Application.Current.Dispatcher.Invoke((Action)(() => { + ErrorMessageBox emb = new ErrorMessageBox(Public_MainWindow.LanguageCollection[119].ToString(), Public_MainWindow.LanguageCollection[120].ToString(), Public_MainWindow.LanguageCollection[121].ToString(), Public_MainWindow.LanguageCollection[122].ToString()); + emb.MB_typeOK(Public_MainWindow.LanguageCollection[108].ToString(), s.Message + Environment.NewLine + Environment.NewLine + Public_MainWindow.LanguageCollection[115].ToString(), Public_MainWindow); + emb.Show(); + Public_MainWindow.IsEnabled = false; + })); + } + if (s is System.ArgumentOutOfRangeException) + { + await Public_MainWindow.discord.StopAsync(); + Application.Current.Dispatcher.Invoke((Action)(() => { + ErrorMessageBox emb = new ErrorMessageBox(Public_MainWindow.LanguageCollection[119].ToString(), Public_MainWindow.LanguageCollection[120].ToString(), Public_MainWindow.LanguageCollection[121].ToString(), Public_MainWindow.LanguageCollection[122].ToString()); + emb.MB_typeOK(Public_MainWindow.LanguageCollection[108].ToString(), s.Message + Environment.NewLine + Environment.NewLine + Public_MainWindow.LanguageCollection[116].ToString(), Public_MainWindow); + emb.Show(); + Public_MainWindow.IsEnabled = false; + })); + } + if (s is System.NullReferenceException) + { + Application.Current.Dispatcher.Invoke((Action)(() => { + ErrorMessageBox emb = new ErrorMessageBox(Public_MainWindow.LanguageCollection[119].ToString(), Public_MainWindow.LanguageCollection[120].ToString(), Public_MainWindow.LanguageCollection[121].ToString(), Public_MainWindow.LanguageCollection[122].ToString()); + emb.MB_typeOK(Public_MainWindow.LanguageCollection[113].ToString(), Public_MainWindow.LanguageCollection[124].ToString(), Public_MainWindow); + emb.Show(); + Public_MainWindow.IsEnabled = false; + })); + } + var bc = new BrushConverter(); + Application.Current.Dispatcher.Invoke((Action)(() => { + Public_MainWindow.DiscordBotConnectionStatusLabel.Foreground = (Brush)bc.ConvertFrom("#FFBB3D3D"); + Public_MainWindow.DiscordBotConnectionStatusLabel.Content = Public_MainWindow.LanguageCollection[7].ToString(); + })); + + /*StartPosting();*/ + } + } + else + { + Application.Current.Dispatcher.Invoke((Action)(() => { + ErrorMessageBox emb = new ErrorMessageBox(Public_MainWindow.LanguageCollection[119].ToString(), Public_MainWindow.LanguageCollection[120].ToString(), Public_MainWindow.LanguageCollection[121].ToString(), Public_MainWindow.LanguageCollection[122].ToString()); + emb.MB_typeOK(Public_MainWindow.LanguageCollection[113].ToString(), Public_MainWindow.LanguageCollection[124].ToString(), Public_MainWindow); + emb.Show(); + Public_MainWindow.IsEnabled = false; + })); + } + + } + public void Missing_Icon_Fix(DA_MainWindow MainWindow) + { + System.Threading.Thread.Sleep(1000); + Public_MainWindow = MainWindow; + Application.Current.Dispatcher.Invoke((Action)(() => { + Public_MainWindow.ShowInTaskbar = false; + Public_MainWindow.ShowInTaskbar = true; + //Public_MainWindow.WindowState = WindowState.Normal; + })); + } + public SocketGuild Get_Guild(DA_MainWindow MainWindow) + { + SocketGuild guild = MainWindow.discord.GetGuild(MainWindow.ServerID); + return guild; + } + public IReadOnlyCollection Get_Guilds(DA_MainWindow MainWindow) + { + IReadOnlyCollection Servers = MainWindow.discord.Guilds; + return Servers; + } + public IReadOnlyCollection Get_Channels(DA_MainWindow MainWindow, SocketGuild Guild) + { + IReadOnlyCollection Channels = Guild.TextChannels; + return Channels; + } + public IReadOnlyCollection Get_Roles(DA_MainWindow MainWindow, SocketGuild Guild) + { + IReadOnlyCollection Roles = Guild.Roles; + return Roles; + } + public async void AddReactionsAsync(List Reactions, Discord.Rest.RestUserMessage Message) + { + foreach(var Reaction in Reactions) + { + if (Reaction != "" && Reaction != null) + { + if (Reaction.Contains("<:") && Reaction.Contains(":") && Reaction.Contains(">")) + { await Message.AddReactionAsync(Emote.Parse(Reaction)); } + else + { await Message.AddReactionAsync(new Emoji(Reaction)); } + } + } + } + public async void AddRoleToUser(string SelfRollingSettings, SocketReaction Reaction, DA_MainWindow MainWindow) + { + try + { + SocketRole Selected_Role = null; + SocketGuildUser User = null; + foreach (var data in SelfRollingSettings.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None)) + { + if (Reaction.Emote.ToString() == GetStrBetweenTags(data, "[Emote]", "[/Emote]")) + { + var Guild = MainWindow.discord.GetGuild(MainWindow.ServerID); + User = Guild.GetUser(Reaction.UserId); + Selected_Role = Guild.GetRole(ulong.Parse(GetStrBetweenTags(data, "[Role]", "[/Role]"))); + break; + } + } + if (Selected_Role != null) + { await (User as IGuildUser).AddRoleAsync(Selected_Role); } + } + catch (Exception) { } + } + public async void RemoveRoleToUser(string SelfRollingSettings, SocketReaction Reaction, DA_MainWindow MainWindow) + { + try + { + SocketRole Selected_Role = null; + SocketGuildUser User = null; + foreach (var data in SelfRollingSettings.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None)) + { + if (Reaction.Emote.ToString() == GetStrBetweenTags(data, "[Emote]", "[/Emote]")) + { + var Guild = MainWindow.discord.GetGuild(MainWindow.ServerID); + User = Guild.GetUser(Reaction.UserId); + Selected_Role = Guild.GetRole(ulong.Parse(GetStrBetweenTags(data, "[Role]", "[/Role]"))); + break; + } + } + if (Selected_Role != null) + { await (User as IGuildUser).RemoveRoleAsync(Selected_Role); } + } + catch (Exception) { } + } + } +} diff --git a/YPBBT/ErrorMessageBox.xaml b/YPBBT/ErrorMessageBox.xaml new file mode 100644 index 0000000..2d67bc6 --- /dev/null +++ b/YPBBT/ErrorMessageBox.xaml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + diff --git a/YPBBT/ErrorMessageBox.xaml.cs b/YPBBT/ErrorMessageBox.xaml.cs new file mode 100644 index 0000000..e39cd10 --- /dev/null +++ b/YPBBT/ErrorMessageBox.xaml.cs @@ -0,0 +1,160 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Media; +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; +using Discord; +using Discord.WebSocket; + +namespace YPBBT +{ + /// + /// Interaction logic for ErrorMessageBox.xaml + /// + public partial class ErrorMessageBox : Window + { + int YN_Case; + DiscordSocketClient discord = new DiscordSocketClient(); + DA_MainWindow damw; + DA_Startup dasw; + public ErrorMessageBox(string ok_tr,string No_tr,string Yes_tr, string test_token_tr) + { + InitializeComponent(); + OK.Content = ok_tr; + NO.Content = No_tr; + YES.Content = Yes_tr; + Test.Content = test_token_tr; + } + public void MB_typeOK(string et,string em, DA_MainWindow dm) + { + SystemSounds.Beep.Play(); + damw = dm; + NO.Visibility = Visibility.Hidden; + YES.Visibility = Visibility.Hidden; + OK.Visibility = Visibility.Visible; + Test.Visibility = Visibility.Hidden; + Textbox1.Visibility = Visibility.Hidden; + ErrorTitle.Content = et; + ErrorMessage.Text = em; + } + public void MB_typeYN(string et, string em,int YN, DA_MainWindow dm) + { + SystemSounds.Exclamation.Play(); + NO.Visibility = Visibility.Visible; + YES.Visibility = Visibility.Visible; + OK.Visibility = Visibility.Hidden; + Test.Visibility = Visibility.Hidden; + Textbox1.Visibility = Visibility.Hidden; + damw = dm; + YN_Case = YN; + ErrorTitle.Content = et; + ErrorMessage.Text = em; + } + public void MB_typeYN_DA_Startup(string et, string em, int YN, DA_Startup ds) + { + SystemSounds.Exclamation.Play(); + NO.Visibility = Visibility.Visible; + YES.Visibility = Visibility.Visible; + OK.Visibility = Visibility.Hidden; + Test.Visibility = Visibility.Hidden; + Textbox1.Visibility = Visibility.Hidden; + dasw = ds; + YN_Case = YN; + ErrorTitle.Content = et; + ErrorMessage.Text = em; + } + private void OK_Click(object sender, RoutedEventArgs e) + { + damw.enableMW(); + damw.Show(); + this.Close(); + } + + public void TestToken(string et, DiscordSocketClient ds, DA_MainWindow dm,string token) + { + ErrorTitle.Content = et; + ErrorTitle.Visibility = Visibility.Visible; + NO.Visibility = Visibility.Hidden; + YES.Visibility = Visibility.Hidden; + OK.Visibility = Visibility.Hidden; + ErrorMessage.Visibility = Visibility.Hidden; + Test.Visibility = Visibility.Visible; + Textbox1.Visibility = Visibility.Visible; + Textbox1.Text = token; + discord = ds; + damw = dm; + } + private async void Test_Click(object sender, RoutedEventArgs e) + { + try + { + await discord.LoginAsync(TokenType.Bot, Textbox1.Text); + await discord.StartAsync(); + System.Threading.Thread.Sleep(1000); + Test.BorderBrush = Brushes.Green; + Test.Background = Brushes.Green; + } + catch (Exception) + { + Test.BorderBrush = Brushes.Red; + Test.Background = Brushes.Red; + } + + if (Test.BorderBrush == Brushes.Green) + { + damw.ReturnFixedToken(discord, Textbox1.Text); + damw.Show(); + this.Close(); + } + } + private void Step4TestTokenButton_MouseEnter(object sender, MouseEventArgs e) + { + var bc = new BrushConverter(); + Test.Background = (Brush)bc.ConvertFrom("#818182"); + } + + private void Step4TestTokenButton_MouseLeave(object sender, MouseEventArgs e) + { + var bc = new BrushConverter(); + Test.Background = (Brush)bc.ConvertFrom("#FFA9A9AA"); + } + + private void YES_Click(object sender, RoutedEventArgs e) + { + if(YN_Case == 0) + { + damw.confirmhardreset(); + damw.IsEnabled = true; + this.Close(); + } + if(YN_Case == 1) + { + System.Diagnostics.Process.Start(System.IO.Directory.GetCurrentDirectory() + "/ExternalAppRestart.exe"); + } + } + private void NO_Click(object sender, RoutedEventArgs e) + { + if (YN_Case == 0) + { + damw.IsEnabled = true; + damw.Show(); + this.Close(); + } + if (YN_Case == 1) + { + dasw.IsEnabled = true; + dasw.Run_Profile_Setup(false); + this.Close(); + } + } + } +} diff --git a/YPBBT/Getimg.cs b/YPBBT/Getimg.cs new file mode 100644 index 0000000..a7f19b0 --- /dev/null +++ b/YPBBT/Getimg.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media.Imaging; + +namespace YPBBT +{ + class Getimg + { + public BitmapImage GETIMAGE(string link) + { + BitmapImage bitmap = new BitmapImage(); + var fullFilePath = link; + + + bitmap.BeginInit(); + bitmap.UriSource = new Uri(fullFilePath, UriKind.Absolute); + bitmap.EndInit(); + return bitmap; + + } + } +} diff --git a/YPBBT/MainWindow.xaml b/YPBBT/MainWindow.xaml new file mode 100644 index 0000000..5b320e5 --- /dev/null +++ b/YPBBT/MainWindow.xaml @@ -0,0 +1,1486 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/YPBBT/MainWindow.xaml.cs b/YPBBT/MainWindow.xaml.cs new file mode 100644 index 0000000..df13e73 --- /dev/null +++ b/YPBBT/MainWindow.xaml.cs @@ -0,0 +1,5167 @@ +using CefSharp; +using CefSharp.Wpf; +using Discord; +using Discord.WebSocket; +using HtmlAgilityPack; +using System; +using System.Collections.Generic; +using System.Data; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Management; +using System.Net; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Animation; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using System.Windows.Threading; +using YPBBT.Properties; +using Color = Discord.Color; + +namespace YPBBT +{ + /// + /// Interaction logic for MainWindow.xaml + /// + /// /// lang last 87 + /// + public partial class MainWindow : Window + { + private System.Windows.Forms.NotifyIcon MyNotifyIcon; + DiscordSocketClient discord = new DiscordSocketClient(); + List ProfileCollection = new List(); + List LanguageCollection = new List(); + List BossesCollection = new List(); + public DataTable TimeTable = new DataTable(); + int MainB; + int PmaxC; + DateTime NBT; + DateTime CBT; + DateTime PBT; + string DefaultLanguage; + ulong ClientID; + string Token; + ulong ServerID; + ulong ChannelID; + string BossSpawnRole; + string NightTimeRole; + string ImperialResetRole; + string BarteringResetRole; + string ImperialTradingResetRole; + int UpdateMesssageInterval; + int SharedDay; + int SharedTime; + DispatcherTimer timer = new DispatcherTimer(); + DispatcherTimer timer1 = new DispatcherTimer(); + string MOTR; + int startupRS; + int overlayState = 0; + OverlayModWindow omw = new OverlayModWindow(); + ulong MainMessageID; + int SaveLatestTimeTable = 0; + ulong TimtableID = 0; + int intervalMessageUpdate = 0; + string publicNbossimage; + string publicbossUrl; + ulong bossImageID; + int AnouncmentMessageInterval; + int AnouncmentIntervalToDeleteMessages = 0; + ulong DiscordNotifyBossSpwnID = 0; + ulong DiscordNotifyNightTimeID = 0; + ulong DiscordNotifyImperialResetID = 0; + ulong DiscordNotifyBarteringID = 0; + ulong DiscordNotifyImperialTradingID = 0; + string AppVersion = "2.1a"; + string CurrentVersion = ""; + string currentbossrole1 = ""; + string currentbossrole2 = ""; + double lastSliderValue; + int lastSelectedSource; + Discord.Rest.RestUserMessage MainMessage; + int gridview1Row = 0; + int gridview1Column = 0; + + public MainWindow(int OL) + { + if (OL == 0) + { + if (File.Exists(System.IO.Directory.GetCurrentDirectory() + "/debug.log")) + { File.Delete(System.IO.Directory.GetCurrentDirectory() + "/debug.log"); } + } + InitializeComponent(); + AddSaveBossNameTextBox.IsEnabled = false; + string fversion = AppVersion; + try { fversion = fversion.Substring(0, fversion.IndexOf(".") + 2); } catch (Exception) { } + mainWindow.Title = "YPBBT " + fversion; + GitHub.Content = " YPBBT " + fversion; + string urlAddress = "https://raw.githubusercontent.com/kresmes/BDO-Boss-Timer-Discord-Bot-Yuri-Project-/master/YPBBT%202.0/CurrentVersion"; + try + { + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlAddress); + HttpWebResponse response = (HttpWebResponse)request.GetResponse(); + + if (response.StatusCode == HttpStatusCode.OK) + { + Stream receiveStream = response.GetResponseStream(); + StreamReader readStream = null; + + if (String.IsNullOrWhiteSpace(response.CharacterSet)) + readStream = new StreamReader(receiveStream); + else + readStream = new StreamReader(receiveStream, Encoding.GetEncoding(response.CharacterSet)); + + CurrentVersion = readStream.ReadToEnd(); + response.Close(); + readStream.Close(); + } + } + catch (Exception) { CurrentVersion = AppVersion; } + string finalBosslist = ""; + if (File.Exists(System.IO.Directory.GetCurrentDirectory() + "/Resources/Bosses")) + { + string OriginBossesList = File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/BossesOrigin"); + string[] BossListSplited = OriginBossesList.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); + + string BossesList = File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/Bosses"); + string[] BossListSP = BossesList.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); + finalBosslist = BossesList; + foreach (string BossData in BossListSP) + { + if (BossData != "") + { + foreach (string BD in BossListSplited) + { + if (BD != "") + { + string[] BDS = BD.Split(','); + string[] bossdataS = BossData.Split(','); + if (bossdataS[0] == BDS[0]) + { + if(bossdataS.Length == 5) + { finalBosslist = finalBosslist.Replace(bossdataS[0] + "," + bossdataS[1] + "," + bossdataS[2] + "," + bossdataS[3] + "," + bossdataS[4], BDS[0] + "," + BDS[1] + "," + BDS[2] + "," + bossdataS[3] + "," + bossdataS[4] + "," + BDS[5]); } + if (bossdataS.Length == 6) + { finalBosslist = finalBosslist.Replace(bossdataS[0] + "," + bossdataS[1] + "," + bossdataS[2] + "," + bossdataS[3] + "," + bossdataS[4] + "," + bossdataS[5], BDS[0] + "," + BDS[1] + "," + BDS[2] + "," + bossdataS[3] + "," + bossdataS[4] + "," + BDS[5]); } + } + } + } + } + } + foreach (string BD in BossListSplited) + { + string[] BDS = BD.Split(','); + if (!BossesList.Contains(BDS[0]+",")) + { finalBosslist += Environment.NewLine + BD; } + } + } + else + { + string OriginBossesList = File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/BossesOrigin"); + string[] BossListSplited = OriginBossesList.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); + int line = 0; + foreach(string bossdata in BossListSplited) + { + if(line == 0) + { finalBosslist += bossdata; } + else + { finalBosslist += Environment.NewLine + bossdata; } + line++; + } + } + File.WriteAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/Bosses", finalBosslist); + Tab0.Visibility = Visibility.Hidden; + tab1.Visibility = Visibility.Hidden; + tab2.Visibility = Visibility.Hidden; + tab3.Visibility = Visibility.Hidden; + tab4.Visibility = Visibility.Hidden; + tab5.Visibility = Visibility.Hidden; + AlarmsTab0.Visibility = Visibility.Hidden; + AlarmsTab1.Visibility = Visibility.Hidden; + TimeTableGrid.Visibility = Visibility.Hidden; + AlarmsPreviewsTab.Visibility = Visibility.Hidden; + + Settings.Default["OverlayState"] = "0"; + Settings.Default.Save(); + MyNotifyIcon = new System.Windows.Forms.NotifyIcon(); + MyNotifyIcon.Icon = new System.Drawing.Icon( + System.IO.Directory.GetCurrentDirectory() + "/Resources/icon.ico"); + MyNotifyIcon.MouseDown += + new System.Windows.Forms.MouseEventHandler + (MyNotifyIcon_MouseDoubleClick); + timer1.Interval = TimeSpan.FromSeconds(1); + timer1.Tick += timer1_Tick; + + int lastSS = 0; + try { lastSS = int.Parse(Settings.Default["SelectedSource"].ToString()); } catch (Exception) { } + lastSelectedSource = lastSS; + SourceComboBox.Items.Add("LYPBBT"); + SourceComboBox.Items.Add("MMOTIMER"); + SourceComboBox.Items.Add("BdoBossTimer"); + SourceComboBox.SelectedIndex = lastSS; + + BotHostComboBox.Items.Add("Local"); + BotHostComboBox.Items.Add("polisystems"); + try { ProfileCollection.Clear(); } catch (Exception) { } + string lines = File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/Profile");//read Profile File + string[] RefferalsFilter = lines.Split('|'); + foreach (var rf in RefferalsFilter) + { ProfileCollection.Add(rf); } + DefaultLanguage = ProfileCollection[0].ToString(); + ClientID = ulong.Parse(ProfileCollection[1].ToString()); + Token = ProfileCollection[2].ToString(); + ServerID = ulong.Parse(ProfileCollection[3].ToString()); + ChannelID = ulong.Parse(ProfileCollection[4].ToString()); + BossSpawnRole = ProfileCollection[5].ToString(); + NightTimeRole = ProfileCollection[6].ToString(); + ImperialResetRole = ProfileCollection[7].ToString(); + BarteringResetRole = ProfileCollection[10].ToString(); + ImperialTradingResetRole = ProfileCollection[11].ToString(); + UpdateMesssageInterval = int.Parse(ProfileCollection[8].ToString()); + AnouncmentMessageInterval = int.Parse(ProfileCollection[9].ToString()); + + LoadAlarmsSettings(); + LoadDefaultLanguage(); + + if (Settings.Default["EditSpawnHoursSlider"].ToString() == "") + { + EditSpawnHoursSlider.Value = 0; + Settings.Default["EditSpawnHoursSlider"] = EditSpawnHoursSlider.Value.ToString(); + Settings.Default.Save(); + } + EditSpawnHoursSlider.Value = Int32.Parse(Settings.Default["EditSpawnHoursSlider"].ToString()); + + if (EditSpawnHoursSlider.Value.ToString().Contains("-")) + { EditSpawnHoursLabael1.Content = "Edit Spawn Hours " + EditSpawnHoursSlider.Value; } + else + { EditSpawnHoursLabael1.Content = "Edit Spawn Hours +" + EditSpawnHoursSlider.Value; } + if (EditSpawnHoursSlider.Value == 0) + { EditSpawnHoursLabael1.Content = "Edit Spawn Hours " + EditSpawnHoursSlider.Value; } + startupRS = 0; + + + } + private void mainWindow_Activated(object sender, EventArgs e) + { + + if (startupRS == 0 && MOTR == null) + { + startupRS = 1; + string region = Settings.Default["DefaultRegion"].ToString();//get Last Saved Region + Console.WriteLine("Activated"); + if (region == "") + { + region = "NA"; + Settings.Default["DefaultRegion"] = "NA"; + Settings.Default.Save(); + } + MOTR = region; + if (SourceComboBox.SelectedIndex == 0) + { GetLYPBBTTimeTable(); } + if (SourceComboBox.SelectedIndex == 1) + { GetTimeTable(region); }//Get info from Html Code + if (SourceComboBox.SelectedIndex == 2) + { GetUrlSource("https://bdobosstimer.com/?&server=" + region); } + } + } + private void LoadDefaultLanguage() + { + LanguageCollection.Clear(); + string lines = File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/Languages/" + DefaultLanguage + "-m"); + string[] Collection = lines.Split('|'); + foreach (string rf in Collection) + { LanguageCollection.Add(rf); } + TimeTableButton.Content = LanguageCollection[0].ToString(); + BossesListButton.Content = LanguageCollection[1].ToString(); + SettingsButton.Content = LanguageCollection[2].ToString(); + SourceLabel.Content = LanguageCollection[3].ToString(); + SendTotrayButton.Content = LanguageCollection[4].ToString(); + appRestartButton.Content = LanguageCollection[5].ToString(); + StartPostingButton.Content = LanguageCollection[6].ToString(); + ConnectDiscordBotButton.Content = LanguageCollection[7].ToString(); + DisconnectDiscordBot.Content = LanguageCollection[8].ToString(); + BotStatusLabel.Content = LanguageCollection[9].ToString(); + RegionLabel.Content = LanguageCollection[10].ToString(); + PbossLabel.Content = LanguageCollection[11].ToString(); + CbossLabel.Content = LanguageCollection[12].ToString(); + LbossLabel.Content = LanguageCollection[13].ToString(); + DiscordBotConnectionStatusLabel.Content = LanguageCollection[14].ToString(); + soundLabel.Content = LanguageCollection[15].ToString(); + BsAlarmLabel.Content = LanguageCollection[16].ToString(); + BossSpawnAlarmCheckBox1.Content = LanguageCollection[17].ToString(); + BossSpawnAlarmCheckBox2.Content = LanguageCollection[18].ToString(); + PlaySoundOnLabel.Content = LanguageCollection[19].ToString(); + BossSpawnAlarmCheckBox3.Content = LanguageCollection[20].ToString(); + SoundOptionCheckBox.Content = LanguageCollection[21].ToString(); + NTAlarmLabel.Content = LanguageCollection[22].ToString(); + NTSoundOptionCheckBox.Content = LanguageCollection[23].ToString(); + IRSoundOptionCheckBox.Content = LanguageCollection[24].ToString(); + + NightTimeAlarmCheckBox1.Content = LanguageCollection[25].ToString(); + PostSettingsLabel.Content = LanguageCollection[26].ToString(); + NightTimeAlarmCheckBox2.Content = LanguageCollection[27].ToString(); + DisplayTimeTableSetting.Content = LanguageCollection[28].ToString(); + NightTimeAlarmCheckBox3.Content = LanguageCollection[29].ToString(); + IRAlarmLabel.Content = LanguageCollection[30].ToString(); + NILabel.Content = LanguageCollection[31].ToString(); + IRILabel.Content = LanguageCollection[32].ToString(); + ImperialResetCheckBox1.Content = LanguageCollection[33].ToString(); + ImperialResetCheckBox2.Content = LanguageCollection[34].ToString(); + ImperialResetCheckBox3.Content = LanguageCollection[35].ToString(); + IoverlayModeButton.Content = LanguageCollection[36].ToString(); + BossListLabel.Content = LanguageCollection[46].ToString(); + BossListBossNameLabel.Content = LanguageCollection[47].ToString(); + DILBLLabel.Content = LanguageCollection[48].ToString(); + AddnewBossTestImgLinkButton.Content = LanguageCollection[49].ToString(); + BSLLLabel.Content = LanguageCollection[50].ToString(); + AddSaveBossButton.Content = LanguageCollection[51].ToString(); + RemoveBossButton.Content = LanguageCollection[52].ToString(); + SettingsLabel.Content = LanguageCollection[55].ToString(); + LanguageSLabel.Content = LanguageCollection[56].ToString(); + ClientIDLABEL.Content = LanguageCollection[57].ToString(); + TokenLabel.Content = LanguageCollection[58].ToString(); + ServerIDLAbel.Content = LanguageCollection[59].ToString(); + ChannelIDLabel.Content = LanguageCollection[60].ToString(); + HrdResetAppButton.Content = LanguageCollection[61].ToString(); + HRWLabel.Content = LanguageCollection[62].ToString(); + OTLabel.Content = LanguageCollection[63].ToString(); + BsPRLabel.Content = LanguageCollection[64].ToString(); + NTPRLabel.Content = LanguageCollection[65].ToString(); + IRPRLabel.Content = LanguageCollection[66].ToString(); + BUDLAbel.Content = LanguageCollection[67].ToString(); + RecLabel.Content = LanguageCollection[68].ToString(); + RMMLabel.Content = LanguageCollection[69].ToString(); + BossListBossCustomNameLabel.Content = LanguageCollection[72].ToString(); + BossListSpecificRoleForthisBossLabel.Content = LanguageCollection[73].ToString(); + BSA1CMLabel.Content = LanguageCollection[74].ToString(); + BSA1CMLabel1.Content = LanguageCollection[75].ToString(); + BSA2CMLabel.Content = LanguageCollection[76].ToString(); + BSA2CMLabel1.Content = LanguageCollection[77].ToString(); + BSA3CMLabel.Content = LanguageCollection[78].ToString(); + BSA3CMLabel1.Content = LanguageCollection[79].ToString(); + NTA1CMLabel.Content = LanguageCollection[80].ToString(); + NTA2CMLabel.Content = LanguageCollection[81].ToString(); + NTA3CMLabel.Content = LanguageCollection[82].ToString(); + IRA1CMLabel.Content = LanguageCollection[83].ToString(); + IRA2CMLabel.Content = LanguageCollection[84].ToString(); + IRA3CMLabel.Content = LanguageCollection[85].ToString(); + + + if (Settings.Default["BSA1CM"].ToString() == "") + { + BSA1CMTextBox.Text = LanguageCollection[43].ToString(); + } + else + { + BSA1CMTextBox.Text = Settings.Default["BSA1CM"].ToString(); + } + if (Settings.Default["BSA2CM"].ToString() == "") + { + BSA2CMTextBox.Text = LanguageCollection[43].ToString(); + } + else + { + BSA2CMTextBox.Text = Settings.Default["BSA2CM"].ToString(); + } + if (Settings.Default["BSA3CM"].ToString() == "") + { + BSA3CMTextBox.Text = LanguageCollection[43].ToString(); + } + else + { + BSA3CMTextBox.Text = Settings.Default["BSA3CM"].ToString(); + } + + if (Settings.Default["NTA1CM"].ToString() == "") + { + NTA1CMTextbBox.Text = LanguageCollection[44].ToString(); + } + else + { + NTA1CMTextbBox.Text = Settings.Default["NTA1CM"].ToString(); + } + if (Settings.Default["NTA2CM"].ToString() == "") + { + NTA2CMTextbBox.Text = LanguageCollection[44].ToString(); + } + else + { + NTA2CMTextbBox.Text = Settings.Default["NTA2CM"].ToString(); + } + if (Settings.Default["NTA3CM"].ToString() == "") + { + NTA3CMTextbBox.Text = LanguageCollection[44].ToString(); + } + else + { + NTA3CMTextbBox.Text = Settings.Default["NTA3CM"].ToString(); + } + + if (Settings.Default["IRA1CM"].ToString() == "") + { + IRA1CMTextBox.Text = LanguageCollection[45].ToString(); + } + else + { + IRA1CMTextBox.Text = Settings.Default["IRA1CM"].ToString(); + } + if (Settings.Default["IRA2CM"].ToString() == "") + { + IRA2CMTextBox.Text = LanguageCollection[45].ToString(); + } + else + { + IRA2CMTextBox.Text = Settings.Default["IRA2CM"].ToString(); + } + if (Settings.Default["IRA3CM"].ToString() == "") + { + IRA3CMTextBox.Text = LanguageCollection[45].ToString(); + } + else + { + IRA3CMTextBox.Text = Settings.Default["IRA3CM"].ToString(); + } + if (Settings.Default["ITRA1CM"].ToString() == "") + { + ITRA1CMTextBox.Text = LanguageCollection[88].ToString(); + } + else + { + ITRA1CMTextBox.Text = Settings.Default["ITRA1CM"].ToString(); + } + if (Settings.Default["ITRA2CM"].ToString() == "") + { + ITRA2CMTextBox.Text = LanguageCollection[88].ToString(); + } + else + { + ITRA2CMTextBox.Text = Settings.Default["ITRA2CM"].ToString(); + } + if (Settings.Default["ITRA3CM"].ToString() == "") + { + ITRA3CMTextBox.Text = LanguageCollection[88].ToString(); + } + else + { + ITRA3CMTextBox.Text = Settings.Default["ITRA3CM"].ToString(); + } + if (Settings.Default["BRA1CM"].ToString() == "") + { + BRA1CMTextBox.Text = LanguageCollection[89].ToString(); + } + else + { + BRA1CMTextBox.Text = Settings.Default["BRA1CM"].ToString(); + } + if (Settings.Default["BRA2CM"].ToString() == "") + { + BRA2CMTextBox.Text = LanguageCollection[89].ToString(); + } + else + { + BRA2CMTextBox.Text = Settings.Default["BRA2CM"].ToString(); + } + if (Settings.Default["BRA3CM"].ToString() == "") + { + BRA3CMTextBox.Text = LanguageCollection[89].ToString(); + } + else + { + BRA3CMTextBox.Text = Settings.Default["BRA3CM"].ToString(); + } + + } + private void LoadAlarmsSettings() //load Last Saved User Settings + { + if (Settings.Default["BossSpawnAlarmCheckBox"].ToString() == "") + { + BossSpawnAlarm1Textbox.Text = "30"; + BossSpawnAlarmCheckBox1.IsChecked = true; + } + else + { + string[] cbD = Settings.Default["BossSpawnAlarmCheckBox"].ToString().Split(','); + BossSpawnAlarm1Textbox.Text = cbD[0].ToString(); + if (cbD[1].ToString() == "0") + { BossSpawnAlarmCheckBox1.IsChecked = false; } + if (cbD[1].ToString() == "1") + { BossSpawnAlarmCheckBox1.IsChecked = true; } + } + + if (Settings.Default["BossSpawnAlarmCheckBox"].ToString() == "") + { + BossSpawnAlarm2Textbox.Text = "15"; + BossSpawnAlarmCheckBox2.IsChecked = true; + } + else + { + string[] cbD = Settings.Default["BossSpawnAlarmCheckBox"].ToString().Split(','); + BossSpawnAlarm2Textbox.Text = cbD[2].ToString(); + if (cbD[3].ToString() == "0") + { BossSpawnAlarmCheckBox2.IsChecked = false; } + if (cbD[3].ToString() == "1") + { BossSpawnAlarmCheckBox2.IsChecked = true; } + } + + if (Settings.Default["BossSpawnAlarmCheckBox"].ToString() == "") + { + BossSpawnAlarm3Textbox.Text = "05"; + BossSpawnAlarmCheckBox3.IsChecked = true; + } + else + { + string[] cbD = Settings.Default["BossSpawnAlarmCheckBox"].ToString().Split(','); + BossSpawnAlarm3Textbox.Text = cbD[4].ToString(); + if (cbD[5].ToString() == "0") + { BossSpawnAlarmCheckBox3.IsChecked = false; } + if (cbD[5].ToString() == "1") + { BossSpawnAlarmCheckBox3.IsChecked = true; } + } + + if (Settings.Default["NightTimeAlarmCheckBox"].ToString() == "") + { + NightTimeAlarm1Textbox.Text = "30"; + NightTimeAlarmCheckBox1.IsChecked = true; + } + else + { + string[] cbD = Settings.Default["NightTimeAlarmCheckBox"].ToString().Split(','); + NightTimeAlarm1Textbox.Text = cbD[0].ToString(); + if (cbD[1].ToString() == "0") + { NightTimeAlarmCheckBox1.IsChecked = false; } + if (cbD[1].ToString() == "1") + { NightTimeAlarmCheckBox1.IsChecked = true; } + } + + if (Settings.Default["NightTimeAlarmCheckBox"].ToString() == "") + { + NightTimeAlarm2Textbox.Text = "15"; + NightTimeAlarmCheckBox2.IsChecked = true; + } + else + { + string[] cbD = Settings.Default["NightTimeAlarmCheckBox"].ToString().Split(','); + NightTimeAlarm2Textbox.Text = cbD[2].ToString(); + if (cbD[3].ToString() == "0") + { NightTimeAlarmCheckBox2.IsChecked = false; } + if (cbD[3].ToString() == "1") + { NightTimeAlarmCheckBox2.IsChecked = true; } + } + + if (Settings.Default["NightTimeAlarmCheckBox"].ToString() == "") + { + NightTimeAlarm3Textbox.Text = "05"; + NightTimeAlarmCheckBox3.IsChecked = true; + } + else + { + string[] cbD = Settings.Default["NightTimeAlarmCheckBox"].ToString().Split(','); + NightTimeAlarm3Textbox.Text = cbD[4].ToString(); + if (cbD[5].ToString() == "0") + { NightTimeAlarmCheckBox3.IsChecked = false; } + if (cbD[5].ToString() == "1") + { NightTimeAlarmCheckBox3.IsChecked = true; } + } + + if (Settings.Default["ImperialResetCheckBox"].ToString() == "") + { + ImperialResetAlarm1Textbox.Text = "30"; + ImperialResetCheckBox1.IsChecked = true; + } + else + { + string[] cbD = Settings.Default["ImperialResetCheckBox"].ToString().Split(','); + ImperialResetAlarm1Textbox.Text = cbD[0].ToString(); + if (cbD[1].ToString() == "0") + { ImperialResetCheckBox1.IsChecked = false; } + if (cbD[1].ToString() == "1") + { ImperialResetCheckBox1.IsChecked = true; } + } + + if (Settings.Default["ImperialResetCheckBox"].ToString() == "") + { + ImperialResetAlarm2Textbox.Text = "15"; + ImperialResetCheckBox2.IsChecked = true; + } + else + { + string[] cbD = Settings.Default["ImperialResetCheckBox"].ToString().Split(','); + ImperialResetAlarm2Textbox.Text = cbD[2].ToString(); + if (cbD[3].ToString() == "0") + { ImperialResetCheckBox2.IsChecked = false; } + if (cbD[3].ToString() == "1") + { ImperialResetCheckBox2.IsChecked = true; } + } + + if (Settings.Default["ImperialResetCheckBox"].ToString() == "") + { + ImperialResetAlarm3Textbox.Text = "05"; + ImperialResetCheckBox3.IsChecked = true; + } + else + { + string[] cbD = Settings.Default["ImperialResetCheckBox"].ToString().Split(','); + ImperialResetAlarm3Textbox.Text = cbD[4].ToString(); + if (cbD[5].ToString() == "0") + { ImperialResetCheckBox3.IsChecked = false; } + if (cbD[5].ToString() == "1") + { ImperialResetCheckBox3.IsChecked = true; } + } + + if (Settings.Default["PlaySoundSetting"].ToString() == "") + { SoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["PlaySoundSetting"].ToString() == "1") + { SoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["PlaySoundSetting"].ToString() == "0") + { SoundOptionCheckBox.IsChecked = false; } + + if (Settings.Default["NTPlaySoundSetting"].ToString() == "") + { NTSoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["NTPlaySoundSetting"].ToString() == "1") + { NTSoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["NTPlaySoundSetting"].ToString() == "0") + { NTSoundOptionCheckBox.IsChecked = false; } + + if (Settings.Default["IRPlaySoundSetting"].ToString() == "") + { IRSoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["IRPlaySoundSetting"].ToString() == "1") + { IRSoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["IRPlaySoundSetting"].ToString() == "0") + { IRSoundOptionCheckBox.IsChecked = false; } + + if (Settings.Default["DisplayTimeTableSetting"].ToString() == "") + { DisplayTimeTableSetting.IsChecked = true; } + if (Settings.Default["DisplayTimeTableSetting"].ToString() == "1") + { DisplayTimeTableSetting.IsChecked = true; } + if (Settings.Default["DisplayTimeTableSetting"].ToString() == "0") + { DisplayTimeTableSetting.IsChecked = false; } + + if (Settings.Default["OverlayTransparency"].ToString() == "") + { TransparacySlider.Value = 100; } + else { TransparacySlider.Value = double.Parse(Settings.Default["OverlayTransparency"].ToString()); } + + if (Settings.Default["SettingKeepMessages"].ToString() == "") + { + SettingsKeepMessagesCheckBox.IsChecked = false; + RMmtextbox.IsEnabled = true; + } + if (Settings.Default["SettingKeepMessages"].ToString() == "1") + { + SettingsKeepMessagesCheckBox.IsChecked = true; + RMmtextbox.IsEnabled = false; + } + if (Settings.Default["SettingKeepMessages"].ToString() == "0") + { + SettingsKeepMessagesCheckBox.IsChecked = false; + RMmtextbox.IsEnabled = true; + } + if (Settings.Default["AlarmonhoursCheckbox"].ToString() == "") + { + AlertonhousandminutesCheckBox.IsChecked = false; + Settings.Default["AlarmonhoursCheckbox"] = "0"; + Settings.Default.Save(); + } + if (Settings.Default["AlarmonhoursCheckbox"].ToString() == "0") + { + AlertonhousandminutesCheckBox.IsChecked = false; + } + if (Settings.Default["AlarmonhoursCheckbox"].ToString() == "1") + { + AlertonhousandminutesCheckBox.IsChecked = true; + } + + if (Settings.Default["BRAlarmCheckBox"].ToString() == "") + { + BRAlarm1Textbox.Text = "30"; + BRAlarmCheckBox1.IsChecked = true; + } + else + { + string[] cbD = Settings.Default["BRAlarmCheckBox"].ToString().Split(','); + BRAlarm1Textbox.Text = cbD[0].ToString(); + if (cbD[1].ToString() == "0") + { BRAlarmCheckBox1.IsChecked = false; } + if (cbD[1].ToString() == "1") + { BRAlarmCheckBox1.IsChecked = true; } + } + + if (Settings.Default["BRAlarmCheckBox"].ToString() == "") + { + BRAlarm2Textbox.Text = "15"; + BRAlarmCheckBox2.IsChecked = true; + } + else + { + string[] cbD = Settings.Default["BRAlarmCheckBox"].ToString().Split(','); + BRAlarm2Textbox.Text = cbD[2].ToString(); + if (cbD[3].ToString() == "0") + { BRAlarmCheckBox2.IsChecked = false; } + if (cbD[3].ToString() == "1") + { BRAlarmCheckBox2.IsChecked = true; } + } + + if (Settings.Default["BRAlarmCheckBox"].ToString() == "") + { + BRAlarm3Textbox.Text = "05"; + BRAlarmCheckBox3.IsChecked = true; + } + else + { + string[] cbD = Settings.Default["BRAlarmCheckBox"].ToString().Split(','); + BRAlarm3Textbox.Text = cbD[4].ToString(); + if (cbD[5].ToString() == "0") + { BRAlarmCheckBox3.IsChecked = false; } + if (cbD[5].ToString() == "1") + { BRAlarmCheckBox3.IsChecked = true; } + } + + + + if (Settings.Default["ITRAlarmCheckBox"].ToString() == "") + { + ITRAlarm1Textbox.Text = "30"; + ITRAlarmCheckBox1.IsChecked = true; + } + else + { + string[] cbD = Settings.Default["ITRAlarmCheckBox"].ToString().Split(','); + ITRAlarm1Textbox.Text = cbD[0].ToString(); + if (cbD[1].ToString() == "0") + { ITRAlarmCheckBox1.IsChecked = false; } + if (cbD[1].ToString() == "1") + { ITRAlarmCheckBox1.IsChecked = true; } + } + + if (Settings.Default["ITRAlarmCheckBox"].ToString() == "") + { + ITRAlarm2Textbox.Text = "15"; + ITRAlarmCheckBox2.IsChecked = true; + } + else + { + string[] cbD = Settings.Default["ITRAlarmCheckBox"].ToString().Split(','); + ITRAlarm2Textbox.Text = cbD[2].ToString(); + if (cbD[3].ToString() == "0") + { ITRAlarmCheckBox2.IsChecked = false; } + if (cbD[3].ToString() == "1") + { ITRAlarmCheckBox2.IsChecked = true; } + } + + if (Settings.Default["ITRAlarmCheckBox"].ToString() == "") + { + ITRAlarm3Textbox.Text = "05"; + ITRAlarmCheckBox3.IsChecked = true; + } + else + { + string[] cbD = Settings.Default["ITRAlarmCheckBox"].ToString().Split(','); + ITRAlarm3Textbox.Text = cbD[4].ToString(); + if (cbD[5].ToString() == "0") + { ITRAlarmCheckBox3.IsChecked = false; } + if (cbD[5].ToString() == "1") + { ITRAlarmCheckBox3.IsChecked = true; } + } + + } + private async void GetTimeTable(string r)// creat TimeTable and Get Time Logs + { + currentbossrole1 = ""; + currentbossrole2 = ""; + publicbossUrl = ""; + timer1.Stop(); + MOTR = r; + startupRS = 0; + var html = @"https://mmotimer.com/bdo/?server=" + r; + HtmlWeb web = new HtmlWeb(); + var htmlDoc = new HtmlDocument(); + try { htmlDoc = web.Load(html); } catch { MessageBox.Show("Error:404"); } + var htmlNodes1 = htmlDoc.DocumentNode.SelectSingleNode("//*[@id='ttab']").InnerText; + var htmlregionDB = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[1]/div[4]/div/div[1]/div").InnerText; + var aftertheNext = htmlDoc.DocumentNode.SelectSingleNode("//*[@id='mainTbl']/tbody/tr[1]/td[2]/span").InnerText; + var pSecondboss = ""; + try { pSecondboss = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[1]/div[1]/div/div[2]/div[1]").InnerText; } catch (Exception) { } + PbossNamLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[1]/div[1]/div/div/div[1]").InnerText; + if (pSecondboss != "") + { PbossNamLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[1]/div[1]/div/div/div[1]").InnerText + " & " + pSecondboss; } + PreviousBossTimeLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[1]/div[1]/div/div/div[2]").InnerText; + var cSecondboss = ""; + try { cSecondboss = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[1]/div[2]/div/div[2]/div[1]").InnerText; } catch (Exception) { } + CbossNameLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[1]/div[2]/div/div[1]/div[1]").InnerText; + if (cSecondboss != "") + { CbossNameLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[1]/div[2]/div/div[1]/div[1]").InnerText + " & " + cSecondboss; } + CurrentBossTimeLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[1]/div[2]/div/div[1]/div[3]").InnerText; + var nSecondboss = ""; + try { nSecondboss = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[1]/div[3]/div/div[2]/div[1]").InnerText; } catch (Exception) { } + NBossNameLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[1]/div[3]/div/div/div[1]").InnerText; + if (nSecondboss != "") + { NBossNameLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[1]/div[3]/div/div/div[1]").InnerText + " & " + nSecondboss; } + NextBossTimeLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[1]/div[3]/div/div/div[3]").InnerText; + try { NightInBdoTimeLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[2]/div[1]/div[1]/span[2]").InnerText; } catch (Exception) { } + try { IRTimeLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[2]/div[2]/div[1]/span").InnerText; } catch (Exception) { } + try { BRTimeLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[2]/div[1]/div[3]/span").InnerText; } catch (Exception) { } + try { ITRITimeLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/main/div[1]/div[2]/div[2]/div[3]/span").InnerText; } catch (Exception) { } + + RegionComboBox.Items.Clear(); + RegionComboBox.Items.Add("ps4-asia".ToUpper()); + RegionComboBox.Items.Add("eu".ToUpper()); + RegionComboBox.Items.Add("ps4-xbox-eu".ToUpper()); + RegionComboBox.Items.Add("jp".ToUpper()); + RegionComboBox.Items.Add("kr".ToUpper()); + RegionComboBox.Items.Add("mena".ToUpper()); + RegionComboBox.Items.Add("na".ToUpper()); + RegionComboBox.Items.Add("ps4-xbox-na".ToUpper()); + RegionComboBox.Items.Add("ru".ToUpper()); + RegionComboBox.Items.Add("sa".ToUpper()); + RegionComboBox.Items.Add("sea".ToUpper()); + RegionComboBox.Items.Add("th".ToUpper()); + RegionComboBox.Items.Add("tw".ToUpper()); + + RegionComboBox.Text = Settings.Default["DefaultRegion"].ToString().ToUpper(); + string input = htmlNodes1.Replace(" ", ""); + string[] data = input.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); + try + { + TimeTable.Clear(); + for (int i = TimeTable.Rows.Count - 1; i >= 0; i--) + { + if (TimeTable.Rows[i][0].ToString() == "") + TimeTable.Rows[i].Delete(); + } + foreach (var column in TimeTable.Columns.Cast().ToArray()) + { + if (TimeTable.AsEnumerable().All(dr => dr.IsNull(column))) + TimeTable.Columns.Remove(column); + } + gridview1.ItemsSource = null; + TimeTable.AcceptChanges(); + } + catch (Exception) { } + int Crow = 0; + int Ccolumn = 0; + int MaxColumn = TimeTable.Columns.Count; + foreach (var bit in data) + { + if (bit == "" && TimeTable.Rows.Count == 1 && TimeTable.Columns.Count > 0 && Crow == 0) + { + TimeTable.Rows.Add(new object[] { "" }); + Ccolumn = 0; + //tableString += Environment.NewLine; + Crow++; + } + if (bit != "" && Crow == 0) + { + TimeTable.Columns.Add(Ccolumn.ToString()); + if (Ccolumn == 0) + { TimeTable.Rows.Add(new object[] { "" }); } + DataRow dr = TimeTable.Rows[Crow]; + string bitP = bit; + if (bit.Contains(",")) + { bitP = bit.Replace(",", "," + Environment.NewLine); } + dr[Ccolumn] = bitP; + //tableString += " " + bitP; + MaxColumn++; + Ccolumn++; + //MessageBox.Show(bit); + } + + if (bit == "" && Ccolumn == MaxColumn && TimeTable.Columns.Count > 0) + { + TimeTable.Rows.Add(new object[] { "" }); + Ccolumn = 0; + //tableString += Environment.NewLine; + Crow++; + } + if (bit == "" && TimeTable.Rows.Count > 1 && Ccolumn > 0 && Ccolumn < MaxColumn) + { + DataRow dr = TimeTable.Rows[Crow]; + string bitP = bit; + if (bit.Contains(",")) + { bitP = bit.Replace(",", "," + Environment.NewLine); } + dr[Ccolumn] = bitP; + //tableString += " " + bitP; + Ccolumn++; + } + if (bit != "" && TimeTable.Rows.Count > 1 && Ccolumn < MaxColumn) + { + DataRow dr = TimeTable.Rows[Crow]; + string bitP = bit; + if (bit.Contains(",")) + { bitP = bit.Replace(",", "," + Environment.NewLine); } + dr[Ccolumn] = bitP; + //tableString += " " + bitP; + Ccolumn++; + } + + } + for (int i = TimeTable.Rows.Count - 1; i >= 0; i--) + { + if (TimeTable.Rows[i][0].ToString() == "") + TimeTable.Rows[i].Delete(); + } + + TimeTable.AcceptChanges(); + int drow = 0; + //int timeC = 0; + int dayC = 0; + foreach (DataRow row in TimeTable.Rows) + { + if (aftertheNext.Contains(row["0"].ToString())) + { dayC = drow; } + drow++; + } + SharedDay = dayC; + gridview1.ItemsSource = TimeTable.DefaultView; + startupRS = 1; + try + { + BossesCollection.Clear(); + BossCollectionListBox.Items.Clear(); + } + catch (Exception) { } + string BossesList = File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/Bosses"); + string[] BossListSplited = BossesList.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); + foreach (string BossData in BossListSplited) + { + if (BossData != "") + { + BossesCollection.Add(BossData.Replace(Environment.NewLine, "")); + string bossName = BossData.Substring(0, BossData.IndexOf(",") + 1); + bossName = bossName.Replace(",", ""); + bossName = bossName.Replace(Environment.NewLine, ""); + BossCollectionListBox.Items.Add(bossName); + } + } + + PBImageBox.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/Boss.png")); + NBImageBox.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/Boss.png")); + LBImageBox.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/Boss.png")); + Getimg gm = new Getimg(); + + foreach (string item in BossesCollection) + { + string bossName = item.Substring(0, item.IndexOf(",") + 1); + bossName = bossName.Replace(",", ""); + bossName = bossName.Replace(Environment.NewLine, ""); + + if (PbossNamLabel.Content.ToString().Contains(bossName)) + { + string[] bossdata = item.Split(','); + string imgurl = bossdata[1].ToString(); + if (bossdata[5].ToString() != "") + { + imgurl = bossdata[5].ToString(); + if (imgurl.Contains("")) + { imgurl = imgurl.Replace("", System.IO.Directory.GetCurrentDirectory()); } + } + try { PBImageBox.Source = gm.GETIMAGE(imgurl); } catch (Exception) { } + if(PbossNamLabel.Content.ToString().Contains("&")) + { try{ PBImageBox.Source = gm.GETIMAGE(System.IO.Directory.GetCurrentDirectory() + "/Resources/" + PbossNamLabel.Content.ToString() + ".png"); } catch (Exception){ } } + } + if (CbossNameLabel.Content.ToString().Contains(bossName)) + { + string[] bossdata = item.Split(','); + try + { + string imgurl = bossdata[1].ToString(); + if (bossdata[5].ToString() == "") + { + imgurl = bossdata[1].ToString(); + } + else + { + imgurl = bossdata[5].ToString(); + if (imgurl.Contains("")) + { imgurl = imgurl.Replace("", System.IO.Directory.GetCurrentDirectory()); } + } + publicNbossimage = bossdata[1].ToString(); + if (!CbossNameLabel.Content.ToString().Contains("&")) + { publicbossUrl = bossdata[2].ToString(); } + else + { + if (publicbossUrl == "") + { publicbossUrl = bossdata[2].ToString(); } + else + { publicbossUrl += " | " + bossdata[2].ToString(); } + } + NBImageBox.Source = gm.GETIMAGE(imgurl); + if (CbossNameLabel.Content.ToString().Contains("&")) + { try { NBImageBox.Source = gm.GETIMAGE(System.IO.Directory.GetCurrentDirectory() + "/Resources/" + CbossNameLabel.Content.ToString() + ".png"); } catch (Exception) { } } + //if (bossdata[3].ToString() != "") + //{ CbossNameLabel.Content = bossdata[3].ToString(); } + } + catch (Exception) { } + } + if (cSecondboss.Contains(bossName) && CbossNameLabel.Content.ToString().Contains("&") && cSecondboss != "") + { + string[] bossdata = item.Split(','); + if (publicbossUrl == "") + { publicbossUrl = bossdata[2].ToString(); } + else + { publicbossUrl += "|" + bossdata[2].ToString(); } + } + if (NBossNameLabel.Content.ToString().Contains(bossName)) + { + string[] bossdata = item.Split(','); + string imgurl = bossdata[1].ToString(); + if (bossdata[5].ToString() != "") + { + imgurl = bossdata[5].ToString(); + if (imgurl.Contains("")) + { imgurl = imgurl.Replace("", System.IO.Directory.GetCurrentDirectory()); } + } + try { LBImageBox.Source = gm.GETIMAGE(imgurl); } catch (Exception) { } + if (NBossNameLabel.Content.ToString().Contains("&")) + { try { LBImageBox.Source = gm.GETIMAGE(System.IO.Directory.GetCurrentDirectory() + "/Resources/" + NBossNameLabel.Content.ToString() + ".png"); } catch (Exception){ } } + //if (bossdata[3].ToString() != "") + //{ NBossNameLabel.Content = bossdata[3].ToString(); } + } + + } + + if (PbossNamLabel.Content.ToString().Contains(" & ")) + { + string fullbossname = ""; + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = PbossNamLabel.Content.ToString(); + name = name.Substring(0, name.IndexOf("&")); + if (name.Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString() + " & "; + } + } + } + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = PbossNamLabel.Content.ToString(); + name = name.Substring(name.IndexOf("&") + 1); + if (name.Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString(); + } + } + } + if (fullbossname != "") + { PbossNamLabel.Content = fullbossname; } + + } + else + { + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + if (PbossNamLabel.Content.ToString().Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { PbossNamLabel.Content = bossdata[3].ToString(); } + } + + } + } + + if (CbossNameLabel.Content.ToString().Contains(" & ")) + { + string fullbossname = ""; + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = CbossNameLabel.Content.ToString(); + name = name.Substring(0, name.IndexOf("&")); + if (name.Contains(bossdata[0].ToString())) + { + currentbossrole1 = bossdata[4].ToString(); + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString() + " & "; + } + } + } + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = CbossNameLabel.Content.ToString(); + name = name.Substring(name.IndexOf("&") + 1); + if (name.Contains(bossdata[0].ToString())) + { + currentbossrole2 = bossdata[4].ToString(); + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString(); + } + } + } + if (fullbossname != "") + { CbossNameLabel.Content = fullbossname; } + } + else + { + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + if (CbossNameLabel.Content.ToString().Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { + currentbossrole1 = bossdata[4].ToString(); + CbossNameLabel.Content = bossdata[3].ToString(); + } + else + { + currentbossrole1 = bossdata[4].ToString(); + } + } + + } + } + if (NBossNameLabel.Content.ToString().Contains(" & ")) + { + string fullbossname = ""; + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = NBossNameLabel.Content.ToString(); + name = name.Substring(0, name.IndexOf("&")); + if (name.Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString() + " & "; + } + } + } + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = NBossNameLabel.Content.ToString(); + name = name.Substring(name.IndexOf("&") + 1); + if (name.Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString(); + } + } + } + if (fullbossname != "") + { NBossNameLabel.Content = fullbossname; } + } + else + { + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + if (NBossNameLabel.Content.ToString().Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { NBossNameLabel.Content = bossdata[3].ToString(); } + } + + } + } + + SaveLatestTimeTable = 0; + intervalMessageUpdate = UpdateMesssageInterval; + try + { + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(ChannelID); + var Message = await channel.GetMessageAsync(bossImageID) as IUserMessage; + string[] pbu = publicbossUrl.Split('|'); + string[] bnu = CbossNameLabel.Content.ToString().Split('&'); + string ANmessage = ""; + if (CbossNameLabel.Content.ToString().Contains("&")) + { + ANmessage = "Bosses Locations" + Environment.NewLine + "[" + bnu[0] + "](" + pbu[0] + ")" + " <---" + LanguageCollection[87].ToString() + Environment.NewLine + "[" + bnu[1] + "](" + pbu[1] + ")" + " <---" + LanguageCollection[87].ToString(); + } + else + { + ANmessage = "Bosses Locations" + Environment.NewLine + "[" + bnu[0] + "](" + pbu[0] + ")" + " <---" + LanguageCollection[87].ToString(); + } + var embed1 = new EmbedBuilder + { + Title = CbossNameLabel.Content.ToString() /*+ " <---" + LanguageCollection[87].ToString()*/, + ImageUrl = publicNbossimage, + Color = Color.LightGrey, + //Url = publicbossUrl + Description = ANmessage + }; + await Message.ModifyAsync(msg => msg.Embed = embed1.Build()); + } + catch (Exception) { } + if (EditSpawnHoursSlider.Value.ToString().Contains("-")) + { + DateTime PDT = DateTime.Parse(PreviousBossTimeLabel.Content.ToString()); + string pdtl = PDT.AddHours(double.Parse(EditSpawnHoursSlider.Value.ToString().Replace("-", "+"))).ToString(@"hh\:mm\:ss"); + PreviousBossTimeLabel.Content = pdtl; + + DateTime CDT = DateTime.Parse(CurrentBossTimeLabel.Content.ToString()); + string cbtl = CDT.AddHours(EditSpawnHoursSlider.Value).ToString(@"hh\:mm\:ss"); + CurrentBossTimeLabel.Content = cbtl; + + DateTime NDT = DateTime.Parse(NextBossTimeLabel.Content.ToString()); + string nbtl = NDT.AddHours(EditSpawnHoursSlider.Value).ToString(@"hh\:mm\:ss"); + NextBossTimeLabel.Content = nbtl; + } + if (EditSpawnHoursSlider.Value > 0) + { + DateTime PDT = DateTime.Parse(PreviousBossTimeLabel.Content.ToString()); + string pdtl = PDT.AddHours(double.Parse("-" + EditSpawnHoursSlider.Value.ToString())).ToString(@"hh\:mm\:ss"); + PreviousBossTimeLabel.Content = pdtl; + + DateTime CDT = DateTime.Parse(CurrentBossTimeLabel.Content.ToString()); + string cbtl = CDT.AddHours(EditSpawnHoursSlider.Value).ToString(@"hh\:mm\:ss"); + CurrentBossTimeLabel.Content = cbtl; + + DateTime NDT = DateTime.Parse(NextBossTimeLabel.Content.ToString()); + string nbtl = NDT.AddHours(EditSpawnHoursSlider.Value).ToString(@"hh\:mm\:ss"); + NextBossTimeLabel.Content = nbtl; + } + timer1.Start(); + } + void timer1_Tick(object sender, EventArgs e) //Timer Loop message Updates&others + { + //if (checkversion == 0) + //{ + // timer1.Stop(); + // if (AppVersion != CurrentVersion) + // { + // var bc = new BrushConverter(); + // GitHub.Background = (Brush)bc.ConvertFrom("#99773139"); + + // DoubleAnimation da = new DoubleAnimation(); + // da.From = 0.3; + // da.To = 1; + // da.Duration = new Duration(TimeSpan.FromSeconds(1)); + // da.AutoReverse = true; + // da.RepeatBehavior = RepeatBehavior.Forever; + // GitHub.BeginAnimation(OpacityProperty, da); + + // string urlAddress1 = "https://raw.githubusercontent.com/kresmes/BDO-Boss-Timer-Discord-Bot-Yuri-Project-/master/YPBBT%202.0/NewVersionLog_" + DefaultLanguage; + + // HttpWebRequest request1 = (HttpWebRequest)WebRequest.Create(urlAddress1); + // HttpWebResponse response1 = (HttpWebResponse)request1.GetResponse(); + + // if (response1.StatusCode == HttpStatusCode.OK) + // { + // Stream receiveStream1 = response1.GetResponseStream(); + // StreamReader readStream1 = null; + + // if (String.IsNullOrWhiteSpace(response1.CharacterSet)) + // readStream1 = new StreamReader(receiveStream1); + // else + // readStream1 = new StreamReader(receiveStream1, Encoding.GetEncoding(response1.CharacterSet)); + + // string NewVersionLog = readStream1.ReadToEnd(); + // response1.Close(); + // readStream1.Close(); + + // MessageBoxResult result = MessageBox.Show(NewVersionLog, "Update!", MessageBoxButton.YesNo, MessageBoxImage.Exclamation); + // switch (result) + // { + // case MessageBoxResult.Yes: + // System.Diagnostics.Process.Start("https://github.com/kresmes/BDO-Boss-Timer-Discord-Bot-Yuri-Project-/releases"); + // GetTimeTable(MOTR); + // break; + // case MessageBoxResult.No: + // GetTimeTable(MOTR); + // break; + // } + // } + // } + // else + // { + // timer1.Start(); + // } + // checkversion = 1; + //} + + + if (Settings.Default["PlaySoundSetting"].ToString() == "") + { SoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["PlaySoundSetting"].ToString() == "1") + { SoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["PlaySoundSetting"].ToString() == "0") + { SoundOptionCheckBox.IsChecked = false; } + + if (Settings.Default["NTPlaySoundSetting"].ToString() == "") + { NTSoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["NTPlaySoundSetting"].ToString() == "1") + { NTSoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["NTPlaySoundSetting"].ToString() == "0") + { NTSoundOptionCheckBox.IsChecked = false; } + + if (Settings.Default["IRPlaySoundSetting"].ToString() == "") + { IRSoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["IRPlaySoundSetting"].ToString() == "1") + { IRSoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["IRPlaySoundSetting"].ToString() == "0") + { IRSoundOptionCheckBox.IsChecked = false; } + + DateTime PDT = DateTime.Parse(PreviousBossTimeLabel.Content.ToString()); + string pdtl = PDT.AddSeconds(1).ToString(@"hh\:mm\:ss"); + if (pdtl.StartsWith("12:")) + { pdtl = "00" + PDT.AddSeconds(1).ToString(@":mm\:ss"); } + PreviousBossTimeLabel.Content = pdtl; + + DateTime CDT = DateTime.Parse(CurrentBossTimeLabel.Content.ToString()); + string cbtl = CDT.AddSeconds(-1).ToString(@"hh\:mm\:ss"); + if (cbtl.StartsWith("12:")) + { cbtl = "00" + CDT.AddSeconds(-1).ToString(@":mm\:ss"); } + CurrentBossTimeLabel.Content = cbtl; + + DateTime NDT = DateTime.Parse(NextBossTimeLabel.Content.ToString()); + string nbtl = NDT.AddSeconds(-1).ToString(@"hh\:mm\:ss"); + if (nbtl.StartsWith("12:")) + { nbtl = "00" + NDT.AddSeconds(-1).ToString(@":mm\:ss"); } + NextBossTimeLabel.Content = nbtl; + + DateTime NiBDO = DateTime.Parse(NightInBdoTimeLabel.Content.ToString()); + string nibdol = NiBDO.AddSeconds(-1).ToString(@"hh\:mm\:ss"); + if (nibdol.StartsWith("12:")) + { nibdol = "00" + NiBDO.AddSeconds(-1).ToString(@":mm\:ss"); } + NightInBdoTimeLabel.Content = nibdol; + + DateTime IR = DateTime.Parse(IRTimeLabel.Content.ToString()); + string irl = IR.AddSeconds(-1).ToString(@"hh\:mm\:ss"); + if (irl.StartsWith("12:")) + { irl = "00" + IR.AddSeconds(-1).ToString(@":mm\:ss"); } + IRTimeLabel.Content = irl; + + DateTime BRI = DateTime.Parse(BRTimeLabel.Content.ToString()); + string bril = BRI.AddSeconds(-1).ToString(@"hh\:mm\:ss"); + if (bril.StartsWith("12:")) + { bril = "00" + BRI.AddSeconds(-1).ToString(@":mm\:ss"); } + BRTimeLabel.Content = bril; + + DateTime ITRI = DateTime.Parse(ITRITimeLabel.Content.ToString()); + string itril = ITRI.AddSeconds(-1).ToString(@"hh\:mm\:ss"); + if (itril.StartsWith("12:")) + { itril = "00" + ITRI.AddSeconds(-1).ToString(@":mm\:ss"); } + ITRITimeLabel.Content = itril; + + + if (overlayState == 1) + { + try + { + BitmapImage img = new BitmapImage(); + img = NBImageBox.Source as BitmapImage; + omw.UpdateData(LanguageCollection[42].ToString(), img, CbossLabel.Content.ToString(), CbossNameLabel.Content.ToString(), CurrentBossTimeLabel.Content.ToString(), NILabel.Content.ToString(), NightInBdoTimeLabel.Content.ToString(), IRILabel.Content.ToString(), IRTimeLabel.Content.ToString(), soundLabel.Content.ToString(), SoundOptionCheckBox.Content.ToString(), NTSoundOptionCheckBox.Content.ToString(), IRSoundOptionCheckBox.Content.ToString()); + } + catch (Exception) { } + + } + + if (CurrentBossTimeLabel.Content.ToString() != "00:00:00") + { + if (NightInBdoTimeLabel.Content.ToString() == "00:00:00") + { + if (SourceComboBox.SelectedIndex == 1) + { GetTimeTable(MOTR); }//Get info from Html Code + if (SourceComboBox.SelectedIndex == 2) + { GetUrlSource("https://bdobosstimer.com/?&server=" + MOTR); } + } + if (IRTimeLabel.Content.ToString() == "00:00:00") + { + if (SourceComboBox.SelectedIndex == 1) + { GetTimeTable(MOTR); }//Get info from Html Code + if (SourceComboBox.SelectedIndex == 2) + { GetUrlSource("https://bdobosstimer.com/?&server=" + MOTR); } + } + if (BRTimeLabel.Content.ToString() == "00:00:00") + { + if (SourceComboBox.SelectedIndex == 1) + { GetTimeTable(MOTR); }//Get info from Html Code + if (SourceComboBox.SelectedIndex == 2) + { GetUrlSource("https://bdobosstimer.com/?&server=" + MOTR); } + } + if (ITRITimeLabel.Content.ToString() == "00:00:00") + { + if (SourceComboBox.SelectedIndex == 1) + { GetTimeTable(MOTR); }//Get info from Html Code + if (SourceComboBox.SelectedIndex == 2) + { GetUrlSource("https://bdobosstimer.com/?&server=" + MOTR); } + } + } + + if (CurrentBossTimeLabel.Content.ToString() == "00:00:00") + { + if (SourceComboBox.SelectedIndex == 1) + { GetTimeTable(MOTR); }//Get info from Html Code + if (SourceComboBox.SelectedIndex == 2) + { GetUrlSource("https://bdobosstimer.com/?&server=" + MOTR); } + } + #region "Boss Alert's" + if (AlertonhousandminutesCheckBox.IsChecked == true) + { + if (BossSpawnAlarmCheckBox1.IsChecked == true && CurrentBossTimeLabel.Content.ToString() == BossSpawnAlarm1Textbox.Text + ":00" + ":00") + { + string message = BSA1CMTextBox.Text; + DiscordNotifyBossSpwn(message); + if (SoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playBossAlertaudio(); + } + } + + if (BossSpawnAlarmCheckBox2.IsChecked == true && CurrentBossTimeLabel.Content.ToString() == BossSpawnAlarm1Textbox.Text + ":00" + ":00") + { + string message = BSA2CMTextBox.Text; + DiscordNotifyBossSpwn(message); + if (SoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playBossAlertaudio(); + } + } + + if (BossSpawnAlarmCheckBox3.IsChecked == true && CurrentBossTimeLabel.Content.ToString() == BossSpawnAlarm1Textbox.Text + ":00" + ":00") + { + string message = BSA3CMTextBox.Text; + DiscordNotifyBossSpwn(message); + if (SoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playBossAlertaudio(); + } + } + } + if (BossSpawnAlarmCheckBox1.IsChecked == true && CurrentBossTimeLabel.Content.ToString() == "00:" + BossSpawnAlarm1Textbox.Text + ":00") + { + string message = BSA1CMTextBox.Text; + DiscordNotifyBossSpwn(message); + if (SoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playBossAlertaudio(); + } + } + + if (BossSpawnAlarmCheckBox2.IsChecked == true && CurrentBossTimeLabel.Content.ToString() == "00:" + BossSpawnAlarm2Textbox.Text + ":00") + { + string message = BSA2CMTextBox.Text; + DiscordNotifyBossSpwn(message); + if (SoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playBossAlertaudio(); + } + } + + if (BossSpawnAlarmCheckBox3.IsChecked == true && CurrentBossTimeLabel.Content.ToString() == "00:" + BossSpawnAlarm3Textbox.Text + ":00") + { + string message = BSA3CMTextBox.Text; + DiscordNotifyBossSpwn(message); + if (SoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playBossAlertaudio(); + } + } + #endregion + #region "NightTime Alert's" + if (AlertonhousandminutesCheckBox.IsChecked == true) + { + if (NightTimeAlarmCheckBox1.IsChecked == true && NightInBdoTimeLabel.Content.ToString() == NightTimeAlarm1Textbox.Text + ":00" + ":00") + { + string message = NTA1CMTextbBox.Text; + DiscordNotifyNightTime(message); + if (NTSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playNightAlertaudio(); + } + } + + if (NightTimeAlarmCheckBox2.IsChecked == true && NightInBdoTimeLabel.Content.ToString() == NightTimeAlarm2Textbox.Text + ":00" + ":00") + { + string message = NTA2CMTextbBox.Text; + DiscordNotifyNightTime(message); + if (NTSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playNightAlertaudio(); + } + } + + if (NightTimeAlarmCheckBox3.IsChecked == true && NightInBdoTimeLabel.Content.ToString() == NightTimeAlarm3Textbox.Text +":00" + ":00") + { + string message = NTA3CMTextbBox.Text; + DiscordNotifyNightTime(message); + if (NTSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playNightAlertaudio(); + } + } + } + if (NightTimeAlarmCheckBox1.IsChecked == true && NightInBdoTimeLabel.Content.ToString() == "00:" + NightTimeAlarm1Textbox.Text + ":00") + { + string message = NTA1CMTextbBox.Text; + DiscordNotifyNightTime(message); + if (NTSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playNightAlertaudio(); + } + } + + if (NightTimeAlarmCheckBox2.IsChecked == true && NightInBdoTimeLabel.Content.ToString() == "00:" + NightTimeAlarm2Textbox.Text + ":00") + { + string message = NTA2CMTextbBox.Text; + DiscordNotifyNightTime(message); + if (NTSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playNightAlertaudio(); + } + } + + if (NightTimeAlarmCheckBox3.IsChecked == true && NightInBdoTimeLabel.Content.ToString() == "00:" + NightTimeAlarm3Textbox.Text + ":00") + { + string message = NTA3CMTextbBox.Text; + DiscordNotifyNightTime(message); + if (NTSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playNightAlertaudio(); + } + } + #endregion + #region "Imperial Reset Alert's" + if (AlertonhousandminutesCheckBox.IsChecked == true) + { + if (ImperialResetCheckBox1.IsChecked == true && IRTimeLabel.Content.ToString() == ImperialResetAlarm1Textbox.Text + ":00" + ":00") + { + string message = IRA1CMTextBox.Text; + DiscordNotifyImperialReset(message); + if (IRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playImperialResetAlertaudio(); + } + } + + if (ImperialResetCheckBox2.IsChecked == true && IRTimeLabel.Content.ToString() == ImperialResetAlarm2Textbox.Text + ":00" + ":00") + { + string message = IRA2CMTextBox.Text; + DiscordNotifyImperialReset(message); + if (IRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playImperialResetAlertaudio(); + } + } + + if (ImperialResetCheckBox3.IsChecked == true && IRTimeLabel.Content.ToString() == ImperialResetAlarm3Textbox.Text + ":00" + ":00") + { + string message = IRA3CMTextBox.Text; + DiscordNotifyImperialReset(message); + if (IRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playImperialResetAlertaudio(); + } + } + } + if (ImperialResetCheckBox1.IsChecked == true && IRTimeLabel.Content.ToString() == "00:" + ImperialResetAlarm1Textbox.Text + ":00") + { + string message = IRA1CMTextBox.Text; + DiscordNotifyImperialReset(message); + if (IRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playImperialResetAlertaudio(); + } + } + + if (ImperialResetCheckBox2.IsChecked == true && IRTimeLabel.Content.ToString() == "00:" + ImperialResetAlarm2Textbox.Text + ":00") + { + string message = IRA2CMTextBox.Text; + DiscordNotifyImperialReset(message); + if (IRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playImperialResetAlertaudio(); + } + } + + if (ImperialResetCheckBox3.IsChecked == true && IRTimeLabel.Content.ToString() == "00:" + ImperialResetAlarm3Textbox.Text + ":00") + { + string message = IRA3CMTextBox.Text; + DiscordNotifyImperialReset(message); + if (IRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playImperialResetAlertaudio(); + } + } + #endregion + #region "Bartering Reset Alert's" + if (AlertonhousandminutesCheckBox.IsChecked == true) + { + if (BRAlarmCheckBox1.IsChecked == true && BRTimeLabel.Content.ToString() == BRAlarm1Textbox.Text + ":00" + ":00") + { + string message = BRA1CMTextBox.Text; + DiscordNotifyBR(message); + if (IRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playImperialResetAlertaudio(); + } + } + + if (BRAlarmCheckBox2.IsChecked == true && BRTimeLabel.Content.ToString() == BRAlarm2Textbox.Text + ":00" + ":00") + { + string message = BRA2CMTextBox.Text; + DiscordNotifyBR(message); + if (IRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playImperialResetAlertaudio(); + } + } + + if (BRAlarmCheckBox3.IsChecked == true && BRTimeLabel.Content.ToString() == BRAlarm3Textbox.Text + ":00" + ":00") + { + string message = BRA3CMTextBox.Text; + DiscordNotifyBR(message); + if (IRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playImperialResetAlertaudio(); + } + } + } + if (BRAlarmCheckBox1.IsChecked == true && BRTimeLabel.Content.ToString() == "00:" + BRAlarm1Textbox.Text + ":00") + { + string message = BRA1CMTextBox.Text; + DiscordNotifyBR(message); + if (IRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playImperialResetAlertaudio(); + } + } + + if (BRAlarmCheckBox2.IsChecked == true && BRTimeLabel.Content.ToString() == "00:" + BRAlarm2Textbox.Text + ":00") + { + string message = BRA2CMTextBox.Text; + DiscordNotifyBR(message); + if (IRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playImperialResetAlertaudio(); + } + } + + if (BRAlarmCheckBox3.IsChecked == true && BRTimeLabel.Content.ToString() == "00:" + BRAlarm3Textbox.Text + ":00") + { + string message = BRA3CMTextBox.Text; + DiscordNotifyBR(message); + if (IRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playImperialResetAlertaudio(); + } + } + #endregion + #region "Imperial Trading Reset Alert's" + if (AlertonhousandminutesCheckBox.IsChecked == true) + { + if (ITRAlarmCheckBox1.IsChecked == true && ITRITimeLabel.Content.ToString() == ITRAlarm1Textbox.Text + ":00" + ":00") + { + string message = ITRA1CMTextBox.Text; + DiscordNotifyITR(message); + if (IRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playImperialResetAlertaudio(); + } + } + + if (ITRAlarmCheckBox2.IsChecked == true && ITRITimeLabel.Content.ToString() == ITRAlarm2Textbox.Text + ":00" + ":00") + { + string message = ITRA2CMTextBox.Text; + DiscordNotifyITR(message); + if (IRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playImperialResetAlertaudio(); + } + } + + if (ITRAlarmCheckBox3.IsChecked == true && ITRITimeLabel.Content.ToString() == ITRAlarm3Textbox.Text + ":00" + ":00") + { + string message = ITRA3CMTextBox.Text; + DiscordNotifyITR(message); + if (IRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playImperialResetAlertaudio(); + } + } + } + if (ITRAlarmCheckBox1.IsChecked == true && ITRITimeLabel.Content.ToString() == "00:" + ITRAlarm1Textbox.Text + ":00") + { + string message = ITRA1CMTextBox.Text; + DiscordNotifyITR(message); + if (IRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playImperialResetAlertaudio(); + } + } + + if (ITRAlarmCheckBox2.IsChecked == true && ITRITimeLabel.Content.ToString() == "00:" + ITRAlarm2Textbox.Text + ":00") + { + string message = ITRA2CMTextBox.Text; + DiscordNotifyITR(message); + if (IRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playImperialResetAlertaudio(); + } + } + + if (ITRAlarmCheckBox3.IsChecked == true && ITRITimeLabel.Content.ToString() == "00:" + ITRAlarm3Textbox.Text + ":00") + { + string message = ITRA3CMTextBox.Text; + DiscordNotifyITR(message); + if (IRSoundOptionCheckBox.IsChecked == true) + { + playAudio pa = new playAudio(); + pa.playImperialResetAlertaudio(); + } + } + #endregion + + + if (SaveLatestTimeTable == 0) + { + try + { + try { gridview1.SelectedIndex = SharedDay; } catch (Exception) { } + if (File.Exists(System.IO.Directory.GetCurrentDirectory() + "/Resources/TimeTable.png")) + { File.Delete(System.IO.Directory.GetCurrentDirectory() + "/Resources/TimeTable.png"); } + int width = int.Parse(gridview1.ActualWidth.ToString()); + int height = int.Parse(gridview1.ActualHeight.ToString()); + RenderTargetBitmap renderTargetBitmap = + new RenderTargetBitmap(1920, 1080, 180, 250, PixelFormats.Pbgra32); + renderTargetBitmap.Render(gridview1); + PngBitmapEncoder pngImage = new PngBitmapEncoder(); + pngImage.Frames.Add(BitmapFrame.Create(renderTargetBitmap)); + using (Stream fileStream = File.Create(System.IO.Directory.GetCurrentDirectory() + "/Resources/TimeTable.png")) + { + pngImage.Save(fileStream); + } + SaveLatestTimeTable = 1; + } + catch (Exception) { } + } + + if (DiscordBotConnectionStatusLabel.Content.ToString() == LanguageCollection[39].ToString() && intervalMessageUpdate == UpdateMesssageInterval) + { + try { EditMessage(); } catch (Exception) { } + } + if (intervalMessageUpdate >= UpdateMesssageInterval) + { intervalMessageUpdate = 0; } + intervalMessageUpdate++; + + if (DiscordBotConnectionStatusLabel.Content.ToString() == LanguageCollection[39].ToString() && AnouncmentIntervalToDeleteMessages == AnouncmentMessageInterval && SettingsKeepMessagesCheckBox.IsChecked == false) + { + try { DeleteAnouncmentMessages(); } catch (Exception) { } + } + if (DiscordBotConnectionStatusLabel.Content.ToString() == LanguageCollection[39].ToString() && AnouncmentIntervalToDeleteMessages == AnouncmentMessageInterval && SettingsKeepMessagesCheckBox.IsChecked == true) + { + if (DiscordNotifyBossSpwnID != 0) + { DiscordNotifyBossSpwnID = 0; } + if (DiscordNotifyNightTimeID != 0) + { DiscordNotifyNightTimeID = 0; } + if (DiscordNotifyImperialResetID != 0) + { DiscordNotifyImperialResetID = 0; } + if (DiscordNotifyBarteringID != 0) + { DiscordNotifyBarteringID = 0; } + if (DiscordNotifyImperialTradingID != 0) + { DiscordNotifyImperialTradingID = 0; } + } + if (AnouncmentIntervalToDeleteMessages >= AnouncmentMessageInterval) + { AnouncmentIntervalToDeleteMessages = 0; } + AnouncmentIntervalToDeleteMessages++; + } + + private void Window_MouseDown(object sender, MouseButtonEventArgs e)//Move Window Using any Ui objects + { + try + { + if (e.ChangedButton == MouseButton.Left) + this.DragMove(); + } + catch (Exception) { } + } + + private void mediaElement_MediaEnded(object sender, RoutedEventArgs e)// loop BackVid + { + mediaElement.Position = new TimeSpan(0, 0, 4); + mediaElement.Play(); + } + + public DataGridCell GetCell(int rowIndex, int columnIndex, DataGrid dg)// future Code Usage For CustomTimeTables + { + DataGridRow row = dg.ItemContainerGenerator.ContainerFromIndex(rowIndex) as DataGridRow; + DataGridCellsPresenter p = GetVisualChild(row); + DataGridCell cell = p.ItemContainerGenerator.ContainerFromIndex(columnIndex) as DataGridCell; + return cell; + } + + static T GetVisualChild(Visual parent) where T : Visual // future Code Usage For CustomTimeTables + { + T child = default(T); + int numVisuals = VisualTreeHelper.GetChildrenCount(parent); + for (int i = 0; i < numVisuals; i++) + { + Visual v = (Visual)VisualTreeHelper.GetChild(parent, i); + child = v as T; + if (child == null) + { + child = GetVisualChild(v); + } + if (child != null) + { + break; + } + } + return child; + } + + public void Count()// future Code Usage For CustomTimeTables + { + timer.Stop(); + System.Threading.Thread.Sleep(2000); + timer.Interval = TimeSpan.FromSeconds(1); + timer.Tick += timer_Tick; + + List TimeBored = new List(); + DataRow dr1 = TimeTable.Rows[0]; + int v = 0; + foreach (var column in TimeTable.Columns.Cast().ToArray()) + { + if (v > 0) + { TimeBored.Add(dr1[v].ToString()); } + v++; + } + int MaxC = 0; + int NextB = 0; + int FinalB = -1; + DateTime PT = DateTime.Now; + DateTime PTC = TimeZone.CurrentTimeZone.ToUniversalTime(PT); + foreach (var i in TimeBored) + { + DateTime CC = DateTime.Parse(TimeBored[NextB].ToString()); + DateTime CCC = TimeZone.CurrentTimeZone.ToUniversalTime(CC); + if (CCC > PTC) + { FinalB = NextB; } + if (FinalB == -1) + { NextB++; } + MaxC++; + //MessageBox.Show(i.ToString()); + } + if (FinalB > 0) + { + DateTime PB = DateTime.Parse(TimeBored[FinalB - 1].ToString()); + PBT = TimeZone.CurrentTimeZone.ToUniversalTime(PB); + } + DateTime CB = DateTime.Parse(TimeBored[FinalB].ToString()); + CBT = TimeZone.CurrentTimeZone.ToUniversalTime(CB); + if (FinalB < MaxC) + { + if (FinalB + 1 < MaxC) + { + DateTime NB = DateTime.Parse(TimeBored[FinalB + 1].ToString()); + NBT = TimeZone.CurrentTimeZone.ToUniversalTime(NB); + } + else + { + DateTime NB = DateTime.Parse(TimeBored[0].ToString()); + NBT = TimeZone.CurrentTimeZone.ToUniversalTime(NB); + } + } + MainB = FinalB; + PmaxC = MaxC; + + int CBI = FinalB + 1; + int day = 0; + for (int i = 0; i < 8; i++) + { + + DataRow dr = TimeTable.Rows[i]; + if (dr[0].ToString() == DateTime.Today.DayOfWeek.ToString()) + { day = i; } + } + DataRow drV = TimeTable.Rows[day]; + if (drV[CBI].ToString() == "") + { + while (true) + { + CBI++; + if (drV[CBI].ToString() != "") + { break; } + } + } + + if (CBI > 0) + { + DataRow dr2 = TimeTable.Rows[day]; + PbossNamLabel.Content = dr2[CBI - 1].ToString(); + if (PbossNamLabel.Content.ToString().Contains(",")) + { PbossNamLabel.Content = PbossNamLabel.Content.ToString().Replace("," + Environment.NewLine, " & "); } + } + else + { + PbossNamLabel.Content = "Prevoius Boss"; + } + DataRow dr3 = TimeTable.Rows[day]; + CbossNameLabel.Content = dr3[CBI].ToString(); + if (CbossNameLabel.Content.ToString().Contains(",")) + { CbossNameLabel.Content = CbossNameLabel.Content.ToString().Replace("," + Environment.NewLine, " & "); } + if (CBI < TimeTable.Columns.Count - 1) + { + DataRow dr4 = TimeTable.Rows[day]; + NBossNameLabel.Content = dr4[CBI + 1].ToString(); + if (NBossNameLabel.Content.ToString().Contains(",")) + { NBossNameLabel.Content = NBossNameLabel.Content.ToString().Replace("," + Environment.NewLine, " & "); } + } + else + { + NBossNameLabel.Content = "Followed Boss"; + } + + SharedDay = day; + SharedTime = CBI; + DateTime TN = DateTime.Now; + + + timer.Start(); + + } + + void timer_Tick(object sender, EventArgs e)// future Code Usage For CustomTimeTables + { + DateTime PT = DateTime.Now; + DateTime PTC = TimeZone.CurrentTimeZone.ToUniversalTime(PT); + + if (MainB > 0) + { + + TimeSpan PFTC = PBT.Subtract(PTC); + PreviousBossTimeLabel.Content = "-" + PFTC.ToString(@"hh\:mm\:ss"); + } + else + { + PreviousBossTimeLabel.Content = "00:00:00"; + } + TimeSpan FTC = CBT.Subtract(PTC); + CurrentBossTimeLabel.Content = FTC.ToString(@"hh\:mm\:ss"); + if (MainB < PmaxC) + { + TimeSpan NFTC = NBT.Subtract(PTC); + NextBossTimeLabel.Content = NFTC.ToString(@"hh\:mm\:ss"); + } + else + { + NextBossTimeLabel.Content = "00:00:00"; + } + if (FTC.ToString(@"hh\:mm\:ss") == "00:00:00") + { + try + { + DataGridCell cell = GetCell(SharedDay, SharedTime, gridview1); + var bc = new BrushConverter(); + cell.Background = (Brush)bc.ConvertFrom("#E51E2129"); + } + catch (Exception) { } + Count(); + } + + + try + { + DataGridCell cell = GetCell(SharedDay, SharedTime, gridview1); + var bc = new BrushConverter(); + cell.Background = (Brush)bc.ConvertFrom("#FF767676"); + } + catch (Exception) { } + + } + + private void RegionComboBox_DropDownClosed(object sender, EventArgs e)//update dropbox content + { + if (RegionComboBox.Text != MOTR.ToUpper()) + { + Settings.Default["DefaultRegion"] = RegionComboBox.Text.ToLower(); + Settings.Default.Save(); + MOTR = RegionComboBox.Text.ToLower(); + if (SourceComboBox.SelectedIndex == 0) + { GetLYPBBTTimeTable(); } + if (SourceComboBox.SelectedIndex == 1) + {GetTimeTable(RegionComboBox.Text.ToLower());} + if (SourceComboBox.SelectedIndex == 2) + { GetUrlSource("https://bdobosstimer.com/?&server=" + RegionComboBox.Text.ToLower()); } + } + } + + private void gridview1_GotFocus(object sender, RoutedEventArgs e)// select TimezoneDay on focus + { + try + { + //gridview1.SelectedIndex = SharedDay; + } + catch (Exception) { } + } + + private void BossCollectionListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)//readBosses Data on select + { + try + { + Getimg gm = new Getimg(); + DisplayImageLinkextBox.BorderBrush = Brushes.Silver; + foreach (string item in BossesCollection) + { + string bossName = item.Substring(0, item.IndexOf(",") + 1); + bossName = bossName.Replace(",", ""); + bossName = bossName.Replace(Environment.NewLine, ""); + if (bossName.ToString() == BossCollectionListBox.SelectedItem.ToString()) + { + string[] bossdata = item.Split(','); + AddSaveBossNameTextBox.Text = bossdata[0].ToString(); + DisplayImageLinkextBox.Text = bossdata[1].ToString(); + DisplayImageLinkextBoxLocal.Text = bossdata[5].ToString(); + AddSaveBossPictureBox.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/Boss.png")); + if(bossdata[5].ToString() == "") + { + string imgurl = bossdata[1].ToString(); + //if (imgurl.Contains("")) + //{ imgurl = imgurl.Replace("", System.IO.Directory.GetCurrentDirectory()); } + try { AddSaveBossPictureBox.Source = gm.GETIMAGE(imgurl); } catch (Exception) { DisplayImageLinkextBox.BorderBrush = Brushes.Red; } + } + else + { + string imgurl = bossdata[5].ToString(); + if (imgurl.Contains("")) + { imgurl = imgurl.Replace("", System.IO.Directory.GetCurrentDirectory()); } + try { AddSaveBossPictureBox.Source = gm.GETIMAGE(imgurl); } catch (Exception) { DisplayImageLinkextBoxLocal.BorderBrush = Brushes.Red; } + } + BossSpawnLocationLinkTextBox.Text = bossdata[2].ToString(); + CBNTextbox.Text = bossdata[3].ToString(); + SRFTBTextbox.Text = bossdata[4].ToString(); + } + } + } + catch (Exception) { } + } + + private void AddSaveBossNameTextBox_TextChanged_1(object sender, TextChangedEventArgs e)//check if boss exist + { + + int i = 0; + foreach (string item in BossesCollection) + { + string bossName = item.Substring(0, item.IndexOf(",") + 1); + bossName = bossName.Replace(",", ""); + bossName = bossName.Replace(Environment.NewLine, ""); + + //MessageBox.Show(bossName); + if (i == 0) + { + if (bossName.ToLower() == AddSaveBossNameTextBox.Text.ToLower()) + { + i++; + + } + + } + + } + if (i == 0) + { + AddSaveBossButton.Content = LanguageCollection[53].ToString(); + } + else + { + AddSaveBossButton.Content = LanguageCollection[54].ToString(); + } + } + + private void AddnewBossTestImgLinkButton_Click(object sender, RoutedEventArgs e)// test image url loadasync() code base + { + Getimg gm = new Getimg(); + DisplayImageLinkextBox.BorderBrush = Brushes.Silver; + AddSaveBossPictureBox.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/Boss.png")); + string imgurl = DisplayImageLinkextBox.Text; + //if (imgurl.Contains("")) + //{ imgurl = imgurl.Replace("", System.IO.Directory.GetCurrentDirectory()); } + try { AddSaveBossPictureBox.Source = gm.GETIMAGE(imgurl); } catch (Exception) { DisplayImageLinkextBox.BorderBrush = Brushes.Red; } + } + + private void BossListButton_Click(object sender, RoutedEventArgs e)// change Tabcontrol + { + string BossList = ""; + foreach (string item in BossesCollection) + { + if (item != "") + { BossList += item + Environment.NewLine; } + } + File.WriteAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/Bosses", BossList); + if (SourceComboBox.SelectedIndex == 1) + { GetTimeTable(MOTR); }//Get info from Html Code + if (SourceComboBox.SelectedIndex == 2) + { GetUrlSource("https://bdobosstimer.com/?&server=" + MOTR); } + tabcontrol1.SelectedIndex = 0; + try + { + gridview1.SelectedIndex = SharedDay; + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + tabcontrol1.BeginAnimation(OpacityProperty, da); + } + catch (Exception) { } + } + + private void AddSaveBossButton_Click(object sender, RoutedEventArgs e)//save bosses changes if true + { + if (AddSaveBossNameTextBox.Text != "") + { + if (AddSaveBossButton.Content.ToString() == LanguageCollection[54].ToString()) + { + int i = 0; + int r = 0; + foreach (string item in BossesCollection) + { + string bossName = item.Substring(0, item.IndexOf(",") + 1); + bossName = bossName.Replace(",", ""); + bossName = bossName.Replace(Environment.NewLine, ""); + if (bossName.ToLower() == AddSaveBossNameTextBox.Text.ToLower()) + { + r = i; + } + i++; + } + BossesCollection[r] = AddSaveBossNameTextBox.Text + "," + DisplayImageLinkextBox.Text + "," + BossSpawnLocationLinkTextBox.Text + "," + CBNTextbox.Text + "," + SRFTBTextbox.Text + "," + DisplayImageLinkextBoxLocal.Text; + MessageBox.Show(LanguageCollection[86].ToString()); + } + else + { + BossesCollection.Add(AddSaveBossNameTextBox.Text + "," + DisplayImageLinkextBox.Text + "," + BossSpawnLocationLinkTextBox.Text + "," + CBNTextbox.Text + "," + SRFTBTextbox.Text + "," + DisplayImageLinkextBoxLocal.Text); + BossCollectionListBox.Items.Add(AddSaveBossNameTextBox.Text); + } + } + } + + private void RemoveBossButton_Click(object sender, RoutedEventArgs e)//remove selected boss from listbox + { + if (BossCollectionListBox.SelectedIndex != -1) + { + BossesCollection.RemoveAt(BossCollectionListBox.SelectedIndex); + BossCollectionListBox.Items.RemoveAt(BossCollectionListBox.SelectedIndex); + } + } + + private void BossesListButton_Click(object sender, RoutedEventArgs e)//change tabcontrol + { + tabcontrol1.SelectedIndex = 2; + try { BossCollectionListBox.SelectedIndex = 0; } catch (Exception) { } + try + { + gridview1.SelectedIndex = SharedDay; + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + tabcontrol1.BeginAnimation(OpacityProperty, da); + } + catch (Exception) { } + } + + private void TimeTableButton_Click(object sender, RoutedEventArgs e)//change tabcontrol + { + TimeTableLabel.Content = MOTR.ToUpper() + LanguageCollection[40].ToString(); + tabcontrol1.SelectedIndex = 1; + TimeTableGrid.Visibility = Visibility.Visible; + try + { + gridview1Column = 1; + gridview1.SelectedIndex = SharedDay; + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + tabcontrol1.BeginAnimation(OpacityProperty, da); + TimeTableGrid.BeginAnimation(OpacityProperty, da); + } + catch (Exception) { } + } + + private void TimeTableBackButton_Click(object sender, RoutedEventArgs e)// go back to tab0 + { + TimeTableGrid.Visibility = Visibility.Hidden; + tabcontrol1.SelectedIndex = 0; + try + { + gridview1.SelectedIndex = SharedDay; + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + tabcontrol1.BeginAnimation(OpacityProperty, da); + } + catch (Exception) { } + //try + //{ + // startupRS = 0; + // string region = Settings.Default["DefaultRegion"].ToString(); + // if (region == "ps4-asia") + // { RegionComboBox.SelectedIndex = 0; } + // if (region == "eu") + // { RegionComboBox.SelectedIndex = 1; } + // if (region == "ps4-xbox-eu") + // { RegionComboBox.SelectedIndex = 2; } + // if (region == "jp") + // { RegionComboBox.SelectedIndex = 3; } + // if (region == "kr") + // { RegionComboBox.SelectedIndex = 4; } + // if (region == "mena") + // { RegionComboBox.SelectedIndex = 5; } + // if (region == "na") + // { RegionComboBox.SelectedIndex = 6; } + // if (region == "ps4-xbox-na") + // { RegionComboBox.SelectedIndex = 7; } + // if (region == "ru") + // { RegionComboBox.SelectedIndex = 8; } + // if (region == "sa") + // { RegionComboBox.SelectedIndex = 9; } + // if (region == "sea") + // { RegionComboBox.SelectedIndex = 10; } + // if (region == "th") + // { RegionComboBox.SelectedIndex = 11; } + // if (region == "tw") + // { RegionComboBox.SelectedIndex = 12; } + // startupRS = 1; + //} + //catch (Exception) { } + } + private void NumberValidationTextBox(object sender, TextCompositionEventArgs e)// make sure only numbers filled in linked textbox's + { + Regex regex = new Regex("[^0-9-]+"); + e.Handled = regex.IsMatch(e.Text); + } + #region "Alarms Settings" + private void BossSpawnAlarmCheckBox1_Click(object sender, RoutedEventArgs e) + { + SaveBossSapwnAlrarmSettings(); + } + private void SaveBossSapwnAlrarmSettings() + { + if (BossSpawnAlarm1Textbox.Text == "") + { BossSpawnAlarm1Textbox.Text = "30"; } + if (BossSpawnAlarm2Textbox.Text == "") + { BossSpawnAlarm2Textbox.Text = "15"; } + if (BossSpawnAlarm3Textbox.Text == "") + { BossSpawnAlarm3Textbox.Text = "05"; } + + if (BossSpawnAlarm1Textbox.Text == "0") + { BossSpawnAlarm1Textbox.Text = "30"; } + if (BossSpawnAlarm2Textbox.Text == "0") + { BossSpawnAlarm2Textbox.Text = "15"; } + if (BossSpawnAlarm3Textbox.Text == "0") + { BossSpawnAlarm3Textbox.Text = "05"; } + + if (int.Parse(BossSpawnAlarm1Textbox.Text) < 10) + { BossSpawnAlarm1Textbox.Text = "0" + int.Parse(BossSpawnAlarm1Textbox.Text); } + if (int.Parse(BossSpawnAlarm2Textbox.Text) < 10) + { BossSpawnAlarm2Textbox.Text = "0" + int.Parse(BossSpawnAlarm2Textbox.Text); } + if (int.Parse(BossSpawnAlarm3Textbox.Text) < 10) + { BossSpawnAlarm3Textbox.Text = "0" + int.Parse(BossSpawnAlarm3Textbox.Text); } + + string bitResult = ""; + if (BossSpawnAlarmCheckBox1.IsChecked == true) + { bitResult += BossSpawnAlarm1Textbox.Text + "," + "1,"; } + else + { bitResult += BossSpawnAlarm1Textbox.Text + "," + "0,"; } + + if (BossSpawnAlarmCheckBox2.IsChecked == true) + { bitResult += BossSpawnAlarm2Textbox.Text + "," + "1,"; } + else + { bitResult += BossSpawnAlarm2Textbox.Text + "," + "0,"; } + + if (BossSpawnAlarmCheckBox3.IsChecked == true) + { bitResult += BossSpawnAlarm3Textbox.Text + "," + "1"; } + else + { bitResult += BossSpawnAlarm3Textbox.Text + "," + "0"; } + + + Settings.Default["BossSpawnAlarmCheckBox"] = bitResult; + Settings.Default.Save(); + } + + private void BossSpawnAlarm1Textbox_LostFocus(object sender, RoutedEventArgs e) + { + SaveBossSapwnAlrarmSettings(); + } + + private void BossSpawnAlarm2Textbox_LostFocus(object sender, RoutedEventArgs e) + { + SaveBossSapwnAlrarmSettings(); + } + + private void BossSpawnAlarmCheckBox2_Click(object sender, RoutedEventArgs e) + { + SaveBossSapwnAlrarmSettings(); + } + + private void BossSpawnAlarm3Textbox_LostFocus(object sender, RoutedEventArgs e) + { + SaveBossSapwnAlrarmSettings(); + } + + private void BossSpawnAlarmCheckBox3_Click(object sender, RoutedEventArgs e) + { + SaveBossSapwnAlrarmSettings(); + } + private void SaveNightTimeAlrarmSettings() + { + if (NightTimeAlarm1Textbox.Text == "") + { NightTimeAlarm1Textbox.Text = "30"; } + if (NightTimeAlarm2Textbox.Text == "") + { NightTimeAlarm2Textbox.Text = "15"; } + if (NightTimeAlarm3Textbox.Text == "") + { NightTimeAlarm3Textbox.Text = "05"; } + + if (NightTimeAlarm1Textbox.Text == "0") + { NightTimeAlarm1Textbox.Text = "30"; } + if (NightTimeAlarm2Textbox.Text == "0") + { NightTimeAlarm2Textbox.Text = "15"; } + if (NightTimeAlarm3Textbox.Text == "0") + { NightTimeAlarm3Textbox.Text = "05"; } + + if (int.Parse(NightTimeAlarm1Textbox.Text) < 10) + { NightTimeAlarm1Textbox.Text = "0" + int.Parse(NightTimeAlarm1Textbox.Text); } + if (int.Parse(NightTimeAlarm2Textbox.Text) < 10) + { NightTimeAlarm2Textbox.Text = "0" + int.Parse(NightTimeAlarm2Textbox.Text); } + if (int.Parse(NightTimeAlarm3Textbox.Text) < 10) + { NightTimeAlarm3Textbox.Text = "0" + int.Parse(NightTimeAlarm3Textbox.Text); } + + string bitResult = ""; + if (NightTimeAlarmCheckBox1.IsChecked == true) + { bitResult += NightTimeAlarm1Textbox.Text + "," + "1,"; } + else + { bitResult += NightTimeAlarm1Textbox.Text + "," + "0,"; } + + if (NightTimeAlarmCheckBox2.IsChecked == true) + { bitResult += NightTimeAlarm2Textbox.Text + "," + "1,"; } + else + { bitResult += NightTimeAlarm2Textbox.Text + "," + "0,"; } + + if (NightTimeAlarmCheckBox3.IsChecked == true) + { bitResult += NightTimeAlarm3Textbox.Text + "," + "1"; } + else + { bitResult += NightTimeAlarm3Textbox.Text + "," + "0"; } + + + Settings.Default["NightTimeAlarmCheckBox"] = bitResult; + Settings.Default.Save(); + } + + private void NightTimeAlarm1Textbox_LostFocus(object sender, RoutedEventArgs e) + { + SaveNightTimeAlrarmSettings(); + } + + private void NightTimeAlarmCheckBox1_Click(object sender, RoutedEventArgs e) + { + SaveNightTimeAlrarmSettings(); + } + + private void NightTimeAlarm2Textbox_LostFocus(object sender, RoutedEventArgs e) + { + SaveNightTimeAlrarmSettings(); + } + + private void NightTimeAlarmCheckBox2_Click(object sender, RoutedEventArgs e) + { + SaveNightTimeAlrarmSettings(); + } + + private void NightTimeAlarm3Textbox_LostFocus(object sender, RoutedEventArgs e) + { + SaveNightTimeAlrarmSettings(); + } + + private void NightTimeAlarmCheckBox3_Click(object sender, RoutedEventArgs e) + { + SaveNightTimeAlrarmSettings(); + } + + private void SaveImperialResetAlrarmSettings() + { + if (ImperialResetAlarm1Textbox.Text == "") + { ImperialResetAlarm1Textbox.Text = "30"; } + if (ImperialResetAlarm2Textbox.Text == "") + { ImperialResetAlarm2Textbox.Text = "15"; } + if (ImperialResetAlarm3Textbox.Text == "") + { ImperialResetAlarm3Textbox.Text = "05"; } + + if (ImperialResetAlarm1Textbox.Text == "0") + { ImperialResetAlarm1Textbox.Text = "30"; } + if (ImperialResetAlarm2Textbox.Text == "0") + { ImperialResetAlarm2Textbox.Text = "15"; } + if (ImperialResetAlarm3Textbox.Text == "0") + { ImperialResetAlarm3Textbox.Text = "05"; } + + if (int.Parse(ImperialResetAlarm1Textbox.Text) < 10) + { ImperialResetAlarm1Textbox.Text = "0" + int.Parse(ImperialResetAlarm1Textbox.Text); } + if (int.Parse(ImperialResetAlarm2Textbox.Text) < 10) + { ImperialResetAlarm2Textbox.Text = "0" + int.Parse(ImperialResetAlarm2Textbox.Text); } + if (int.Parse(ImperialResetAlarm3Textbox.Text) < 10) + { ImperialResetAlarm3Textbox.Text = "0" + int.Parse(ImperialResetAlarm3Textbox.Text); } + + string bitResult = ""; + if (ImperialResetCheckBox1.IsChecked == true) + { bitResult += ImperialResetAlarm1Textbox.Text + "," + "1,"; } + else + { bitResult += ImperialResetAlarm1Textbox.Text + "," + "0,"; } + + if (ImperialResetCheckBox2.IsChecked == true) + { bitResult += ImperialResetAlarm2Textbox.Text + "," + "1,"; } + else + { bitResult += ImperialResetAlarm2Textbox.Text + "," + "0,"; } + + if (ImperialResetCheckBox3.IsChecked == true) + { bitResult += ImperialResetAlarm3Textbox.Text + "," + "1"; } + else + { bitResult += ImperialResetAlarm3Textbox.Text + "," + "0"; } + + + Settings.Default["ImperialResetCheckBox"] = bitResult; + Settings.Default.Save(); + } + + private void ImperialResetAlarm1Textbox_LostFocus(object sender, RoutedEventArgs e) + { + SaveImperialResetAlrarmSettings(); + } + + private void ImperialResetCheckBox1_Click(object sender, RoutedEventArgs e) + { + SaveImperialResetAlrarmSettings(); + } + + private void ImperialResetAlarm2Textbox_LostFocus(object sender, RoutedEventArgs e) + { + SaveImperialResetAlrarmSettings(); + } + + private void ImperialResetCheckBox2_Click(object sender, RoutedEventArgs e) + { + SaveImperialResetAlrarmSettings(); + } + + private void ImperialResetAlarm3Textbox_LostFocus(object sender, RoutedEventArgs e) + { + SaveImperialResetAlrarmSettings(); + } + + private void ImperialResetCheckBox3_Click(object sender, RoutedEventArgs e) + { + SaveImperialResetAlrarmSettings(); + } + #endregion + private void CloseappButton_Click(object sender, RoutedEventArgs e) + { + this.Close(); + } + + private void MinimizeButton_Click(object sender, RoutedEventArgs e) + { + this.WindowState = WindowState.Minimized; + } + + private async void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)// on closing action disconnect discord and animate fade out + { + try + { + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(ChannelID); + var messages = await channel.GetMessagesAsync(100).FlattenAsync(); //defualt is 100 + await (channel as SocketTextChannel).DeleteMessagesAsync(messages); + } + catch (Exception) { } + await discord.StopAsync(); + omw.Close(); + Closing -= Window_Closing; + e.Cancel = true; + var anim = new DoubleAnimation(0, (Duration)TimeSpan.FromSeconds(1)); + anim.Completed += (s, _) => System.Environment.Exit(1); + this.BeginAnimation(UIElement.OpacityProperty, anim); + } + + private void SendTotrayButton_Click(object sender, RoutedEventArgs e)//send app to tray + { + this.WindowState = WindowState.Minimized; + this.ShowInTaskbar = false; + MyNotifyIcon.Visible = true; + } + void MyNotifyIcon_MouseDoubleClick(object sender, System.Windows.Forms.MouseEventArgs e)// restore from tray by double clicking icon in tray + { + + MyNotifyIcon.Visible = false; + this.ShowInTaskbar = true; + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + this.BeginAnimation(OpacityProperty, da); + this.WindowState = WindowState.Normal; + this.Topmost = true; + this.Topmost = false; + this.Focus(); + } + + private void appRestartButton_Click(object sender, RoutedEventArgs e) + { + System.Diagnostics.Process.Start(System.IO.Directory.GetCurrentDirectory() + "/YPBBT.exe"); + this.Close(); + } + + private void ConnectDiscordBotButton_Click(object sender, RoutedEventArgs e) + { + System.Diagnostics.Process.Start("https://discordapp.com/oauth2/authorize?&client_id=" + ClientID + "&scope=bot&permissions=0"); + } + private async void DisconnectDiscordBot_Click(object sender, RoutedEventArgs e) + { + var bc = new BrushConverter(); + await discord.StopAsync(); + DiscordBotConnectionStatusLabel.Foreground = (Brush)bc.ConvertFrom("#FFBB3D3D"); + DiscordBotConnectionStatusLabel.Content = LanguageCollection[14].ToString(); + } + + private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)// save language changes + { + LanguageExpander1.IsExpanded = false; + if (LanguageListBox.SelectedIndex == 0) + { + DefaultLanguage = "fr"; + LoadDefaultLanguage(); + } + if (LanguageListBox.SelectedIndex == 1) + { + DefaultLanguage = "en"; + LoadDefaultLanguage(); + } + if (LanguageListBox.SelectedIndex == 2) + { + DefaultLanguage = "es"; + LoadDefaultLanguage(); + } + if (LanguageListBox.SelectedIndex == 3) + { + DefaultLanguage = "ru"; + LoadDefaultLanguage(); + } + if (LanguageListBox.SelectedIndex == 4) + { + DefaultLanguage = "jp"; + LoadDefaultLanguage(); + } + if (LanguageListBox.SelectedIndex == 5) + { + DefaultLanguage = "kr"; + LoadDefaultLanguage(); + } + LanguageExpander1.Header = LanguageListBox.Items[LanguageListBox.SelectedIndex].ToString().Replace("System.Windows.Controls.ListBoxItem: ", ""); + + } + + private void SettingsButton_Click(object sender, RoutedEventArgs e)// load Profile settings on click + { + CidTextbox.Text = ClientID.ToString(); + TokenTextbox.Text = Token; + SidTextbox.Text = ServerID.ToString(); + ChidTextbox.Text = ChannelID.ToString(); + BSTextbox.Text = BossSpawnRole; + NTtextbox.Text = NightTimeRole; + IRTextbox.Text = ImperialResetRole; + BRPRtextbox.Text = BarteringResetRole; + ITRPRTextbox.Text = ImperialTradingResetRole; + MIUTextbox.Text = UpdateMesssageInterval.ToString(); + RMmtextbox.Text = AnouncmentMessageInterval.ToString(); + if (DefaultLanguage == "fr") + { LanguageExpander1.Header = "Français"; } + if (DefaultLanguage == "en") + { LanguageExpander1.Header = "English"; } + if (DefaultLanguage == "es") + { LanguageExpander1.Header = "Español"; } + if (DefaultLanguage == "ru") + { LanguageExpander1.Header = "русский"; } + if (DefaultLanguage == "jp") + { LanguageExpander1.Header = "日本人"; } + if (DefaultLanguage == "kr") + { LanguageExpander1.Header = "한국어"; } + tabcontrol1.SelectedIndex = 3; + try + { + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + tabcontrol1.BeginAnimation(OpacityProperty, da); + } + catch (Exception) { } + } + + private void GobackSettingsButton_Click(object sender, RoutedEventArgs e) + { + Settings.Default["OverlayTransparency"] = TransparacySlider.Value.ToString(); + Settings.Default.Save(); + ClientID = ulong.Parse(CidTextbox.Text); + Token = TokenTextbox.Text; + ServerID = ulong.Parse(SidTextbox.Text); + ChannelID = ulong.Parse(ChidTextbox.Text); + BossSpawnRole = BSTextbox.Text; + NightTimeRole = NTtextbox.Text; + ImperialResetRole = IRTextbox.Text; + BarteringResetRole = BRPRtextbox.Text; + ImperialTradingResetRole = ITRPRTextbox.Text; + UpdateMesssageInterval = int.Parse(MIUTextbox.Text); + AnouncmentMessageInterval = int.Parse(RMmtextbox.Text); + File.WriteAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/Profile", DefaultLanguage + "|" + CidTextbox.Text + "|" + TokenTextbox.Text + "|" + SidTextbox.Text + "|" + ChidTextbox.Text + "|" + BSTextbox.Text + "|" + NTtextbox.Text + "|" + IRTextbox.Text + "|" + MIUTextbox.Text + "|" + RMmtextbox.Text +"|"+ BRPRtextbox.Text+"|"+ ITRPRTextbox.Text); + //StartPosting(); + tabcontrol1.SelectedIndex = 0; + try + { + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + tabcontrol1.BeginAnimation(OpacityProperty, da); + } + catch (Exception) { } + //try + //{ + // startupRS = 0; + // string region = Settings.Default["DefaultRegion"].ToString(); + // if (region == "ps4-asia") + // { RegionComboBox.SelectedIndex = 0; } + // if (region == "eu") + // { RegionComboBox.SelectedIndex = 1; } + // if (region == "ps4-xbox-eu") + // { RegionComboBox.SelectedIndex = 2; } + // if (region == "jp") + // { RegionComboBox.SelectedIndex = 3; } + // if (region == "kr") + // { RegionComboBox.SelectedIndex = 4; } + // if (region == "mena") + // { RegionComboBox.SelectedIndex = 5; } + // if (region == "na") + // { RegionComboBox.SelectedIndex = 6; } + // if (region == "ps4-xbox-na") + // { RegionComboBox.SelectedIndex = 7; } + // if (region == "ru") + // { RegionComboBox.SelectedIndex = 8; } + // if (region == "sa") + // { RegionComboBox.SelectedIndex = 9; } + // if (region == "sea") + // { RegionComboBox.SelectedIndex = 10; } + // if (region == "th") + // { RegionComboBox.SelectedIndex = 11; } + // if (region == "tw") + // { RegionComboBox.SelectedIndex = 12; } + // startupRS = 1; + //} + //catch (Exception) { } + + } + + private async void HrdResetAppButton_Click(object sender, RoutedEventArgs e)// format app saved data + { + MessageBoxResult result = MessageBox.Show(LanguageCollection[70].ToString(), "WARNING", MessageBoxButton.YesNo, MessageBoxImage.Warning); + switch (result) + { + case MessageBoxResult.Yes: + File.Delete(System.IO.Directory.GetCurrentDirectory() + "/Resources/Profile"); + Settings.Default["DefaultRegion"] = ""; + Settings.Default.Save(); + Settings.Default["BossSpawnAlarmCheckBox"] = ""; + Settings.Default.Save(); + Settings.Default["NightTimeAlarmCheckBox"] = ""; + Settings.Default.Save(); + Settings.Default["ImperialResetCheckBox"] = ""; + Settings.Default.Save(); + Settings.Default["PlaySoundSetting"] = ""; + Settings.Default.Save(); + Settings.Default["OverlayTransparency"] = ""; + Settings.Default.Save(); + Settings.Default["OverlayState"] = ""; + Settings.Default.Save(); + Settings.Default["NTPlaySoundSetting"] = ""; + Settings.Default.Save(); + Settings.Default["IRPlaySoundSetting"] = ""; + Settings.Default.Save(); + Settings.Default["DisplayTimeTableSetting"] = ""; + Settings.Default.Save(); + Settings.Default["BSA1CM"] = ""; + Settings.Default.Save(); + Settings.Default["BSA2CM"] = ""; + Settings.Default.Save(); + Settings.Default["BSA3CM"] = ""; + Settings.Default.Save(); + Settings.Default["NTA1CM"] = ""; + Settings.Default.Save(); + Settings.Default["NTA2CM"] = ""; + Settings.Default.Save(); + Settings.Default["NTA3CM"] = ""; + Settings.Default.Save(); + Settings.Default["IRA1CM"] = ""; + Settings.Default.Save(); + Settings.Default["IRA2CM"] = ""; + Settings.Default.Save(); + Settings.Default["IRA3CM"] = ""; + Settings.Default.Save(); + await discord.StopAsync(); + System.Diagnostics.Process.Start(System.IO.Directory.GetCurrentDirectory() + "/YPBBT 2.0.exe"); + this.Close(); + break; + case MessageBoxResult.No: + + break; + } + } + + private void MIUTextbox_TextChanged(object sender, TextChangedEventArgs e)// + { + try + { + if (int.Parse(MIUTextbox.Text) > 60) + { MIUTextbox.Text = "60"; } + } + catch (Exception) { } + } + #region "Help Buttons" + private void Button_Click(object sender, RoutedEventArgs e) + { System.Diagnostics.Process.Start(System.IO.Directory.GetCurrentDirectory() + "/Resources/Step2CID.mp4"); } + + private void Button_Click_1(object sender, RoutedEventArgs e) + { System.Diagnostics.Process.Start(System.IO.Directory.GetCurrentDirectory() + "/Resources/Step4GetToken.mp4"); } + + private void Button_Click_4(object sender, RoutedEventArgs e) + { System.Diagnostics.Process.Start(System.IO.Directory.GetCurrentDirectory() + "/Resources/ServerID.mp4"); } + + private void Button_Click_5(object sender, RoutedEventArgs e) + { System.Diagnostics.Process.Start(System.IO.Directory.GetCurrentDirectory() + "/Resources/ChannelID.mp4"); } + + private void Button_Click_6(object sender, RoutedEventArgs e) + { System.Diagnostics.Process.Start(System.IO.Directory.GetCurrentDirectory() + "/Resources/ConvertRole.mp4"); } + #endregion + private void SoundOptionCheckBox_Click(object sender, RoutedEventArgs e)//save sound settings + { + if (SoundOptionCheckBox.IsChecked == true) + { + Settings.Default["PlaySoundSetting"] = "1"; + Settings.Default.Save(); + } + else + { + Settings.Default["PlaySoundSetting"] = "0"; + Settings.Default.Save(); + } + } + + private void IoverlayModeButton_Click(object sender, RoutedEventArgs e) + { + this.WindowState = WindowState.Minimized; + this.ShowInTaskbar = false; + MyNotifyIcon.Visible = true; + try + { + omw.load(); + omw.Visibility = Visibility.Visible; + } + catch (Exception) { omw.Show(); } + overlayState = 1; + } + + private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) + { + OverlayTransperancyValueLabel.Content = TransparacySlider.Value.ToString(); + OverlayTransperancyValueLabel.Opacity = (TransparacySlider.Value) + 0.1; + Settings.Default["OverlayTransparency"] = TransparacySlider.Value.ToString(); + Settings.Default.Save(); + } + public void GetOverlayState(int value) + { + overlayState = 0; + MyNotifyIcon.Visible = false; + this.ShowInTaskbar = true; + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + this.BeginAnimation(OpacityProperty, da); + this.WindowState = WindowState.Normal; + this.Topmost = true; + this.Topmost = false; + this.Focus(); + } + + private void NTSoundOptionCheckBox_Click(object sender, RoutedEventArgs e) + { + if (NTSoundOptionCheckBox.IsChecked == true) + { + Settings.Default["NTPlaySoundSetting"] = "1"; + Settings.Default.Save(); + } + else + { + Settings.Default["NTPlaySoundSetting"] = "0"; + Settings.Default.Save(); + } + } + + private void IRSoundOptionCheckBox_Click(object sender, RoutedEventArgs e) + { + if (IRSoundOptionCheckBox.IsChecked == true) + { + Settings.Default["IRPlaySoundSetting"] = "1"; + Settings.Default.Save(); + } + else + { + Settings.Default["IRPlaySoundSetting"] = "0"; + Settings.Default.Save(); + } + } + + #region "max minutes allowed for alerts" + private void BossSpawnAlarm1Textbox_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + if (int.Parse(BossSpawnAlarm1Textbox.Text) > 59) + { BossSpawnAlarm1Textbox.Text = "59"; } + } + catch (Exception) { } + } + + private void BossSpawnAlarm2Textbox_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + if (int.Parse(BossSpawnAlarm2Textbox.Text) > 59) + { BossSpawnAlarm2Textbox.Text = "59"; } + } + catch (Exception) { } + } + + private void BossSpawnAlarm3Textbox_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + if (int.Parse(BossSpawnAlarm3Textbox.Text) > 59) + { BossSpawnAlarm3Textbox.Text = "59"; } + } + catch (Exception) { } + } + + private void NightTimeAlarm1Textbox_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + if (int.Parse(NightTimeAlarm1Textbox.Text) > 59) + { NightTimeAlarm1Textbox.Text = "59"; } + } + catch (Exception) { } + } + + private void NightTimeAlarm2Textbox_TextChanged(object sender, TextChangedEventArgs e) + { + if (int.Parse(NightTimeAlarm2Textbox.Text) > 59) + { NightTimeAlarm2Textbox.Text = "59"; } + } + + private void NightTimeAlarm3Textbox_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + if (int.Parse(NightTimeAlarm3Textbox.Text) > 59) + { NightTimeAlarm3Textbox.Text = "59"; } + } + catch (Exception) { } + } + + private void ImperialResetAlarm1Textbox_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + if (int.Parse(ImperialResetAlarm1Textbox.Text) > 59) + { ImperialResetAlarm1Textbox.Text = "59"; } + } + catch (Exception) { } + } + + private void ImperialResetAlarm2Textbox_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + if (int.Parse(ImperialResetAlarm2Textbox.Text) > 59) + { ImperialResetAlarm2Textbox.Text = "59"; } + } + catch (Exception) { } + } + + private void ImperialResetAlarm3Textbox_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + if (int.Parse(ImperialResetAlarm3Textbox.Text) > 59) + { ImperialResetAlarm3Textbox.Text = "59"; } + } + catch (Exception) { } + } + #endregion + + private async void EditMessage()//update Timers on discord + { + try + { + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(ChannelID); + var Message = MainMessage; /*await channel.GetMessageAsync(MainMessageID) as IUserMessage;*/ + string message = ""; + string nb = "> ```cs" + Environment.NewLine + "> " + CurrentBossTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; + string nti = "> ```cs" + Environment.NewLine +"> " +NightInBdoTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; + string iri = "> ```cs" + Environment.NewLine + "> " + IRTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; + string br = "> ```cs" + Environment.NewLine + "> " + BRTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; + string itr = "> ```cs" + Environment.NewLine + "> " + ITRITimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; + if (CurrentBossTimeLabel.Content.ToString().StartsWith("00:")) + { nb = "> ```css" + Environment.NewLine + "> " + CurrentBossTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; } + if (NightInBdoTimeLabel.Content.ToString().StartsWith("00:")) + { nti = "> ```css" + Environment.NewLine + "> " + NightInBdoTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; } + if (IRTimeLabel.Content.ToString().StartsWith("00:")) + { iri = "> ```css" + Environment.NewLine + "> " + IRTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; } + if (BRTimeLabel.Content.ToString().StartsWith("00:")) + { br = "> ```css" + Environment.NewLine + "> " + BRTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; } + if (ITRITimeLabel.Content.ToString().StartsWith("00:")) + { itr = "> ```css" + Environment.NewLine + "> " + ITRITimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; } + + + message = "> " + CbossLabel.Content.ToString() + Environment.NewLine + + nb + Environment.NewLine + + "> " + NILabel.Content.ToString() + Environment.NewLine + + nti + Environment.NewLine + + "> " + IRILabel.Content.ToString() + Environment.NewLine + + iri + Environment.NewLine + + "> " + BRILabel.Content.ToString() + Environment.NewLine + + br + Environment.NewLine + + "> " + ITRILabel.Content.ToString() + Environment.NewLine + + itr; + //var MainMessage = await channel.SendMessageAsync(message); + await Message.ModifyAsync(msg => msg.Content = message);//must be non await to prevent over stack call + MainMessage = Message; + } + catch (Exception) { } + } + private async void StartPosting()// purge discord channel and start posting + { + try + { + var bc = new BrushConverter(); + try + { + DiscordBotConnectionStatusLabel.Foreground = (Brush)bc.ConvertFrom("#FFF1F1F1"); + DiscordBotConnectionStatusLabel.Content = LanguageCollection[37].ToString();//"Connecting..."; + await discord.LoginAsync(TokenType.Bot, Token); + await discord.StartAsync(); + System.Threading.Thread.Sleep(1000); + } + catch (Exception) + { + DiscordBotConnectionStatusLabel.Foreground = (Brush)bc.ConvertFrom("#FFBB3D3D"); + DiscordBotConnectionStatusLabel.Content = LanguageCollection[38].ToString();//"Connection ERROR!"; + } + + if (DiscordBotConnectionStatusLabel.Content.ToString() == LanguageCollection[37].ToString()) + { + DiscordBotConnectionStatusLabel.Foreground = (Brush)bc.ConvertFrom("#FF70BB88"); + DiscordBotConnectionStatusLabel.Content = LanguageCollection[39].ToString();//"Connected"; + } + + if (DiscordBotConnectionStatusLabel.Content.ToString() == LanguageCollection[39].ToString()) + { + System.Threading.Thread.Sleep(2000); + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(ChannelID); + var messages = await channel.GetMessagesAsync(100).FlattenAsync(); //defualt is 100 + await (channel as SocketTextChannel).DeleteMessagesAsync(messages); + string[] pbu = publicbossUrl.Split('|'); + string[] bnu = CbossNameLabel.Content.ToString().Split('&'); + string ANmessage = ""; + if(CbossNameLabel.Content.ToString().Contains("&")) + { + ANmessage = "Bosses Locations" + Environment.NewLine + "[" + bnu[0] + "](" + pbu[0] + ")" + " <---" + LanguageCollection[87].ToString() + Environment.NewLine + "[" + bnu[1] + "](" + pbu[1] + ")" + " <---" + LanguageCollection[87].ToString(); + } + else + { + ANmessage = "Bosses Locations" + Environment.NewLine + "[" + bnu[0] + "](" + pbu[0] + ")" + " <---" + LanguageCollection[87].ToString(); + } + var embed1 = new EmbedBuilder + { + Title = CbossNameLabel.Content.ToString()/* + " <---" + LanguageCollection[87].ToString()*/, + ImageUrl = publicNbossimage, + Color = Color.LightGrey, + //Url = publicbossUrl, + Description = ANmessage + }; + var BossImage = await channel.SendMessageAsync("", false, embed1.Build()); + bossImageID = BossImage.Id; + + //var embed = new EmbedBuilder + //{ + // Title = "Boss Name" + //}; + //embed.AddField("Next Boss in:", "00:00:00", true); + //embed.AddField("Night In:", "00:00:00", true); + //embed.AddField("Imperial Reset:", "00:00:00", true) + // .WithColor(Color.Blue) + // .WithUrl("https://example.com") + // .Build(); + //var MainMessage = await channel.SendMessageAsync("", false, embed.Build()); + string message = ""; + string nb = "> ```cs" + Environment.NewLine + "> " + CurrentBossTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; + string nti = "> ```cs" + Environment.NewLine + "> " + NightInBdoTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; + string iri = "> ```cs" + Environment.NewLine + "> " + IRTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; + string br = "> ```cs" + Environment.NewLine + "> " + BRTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; + string itr = "> ```cs" + Environment.NewLine + "> " + ITRITimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; + if (CurrentBossTimeLabel.Content.ToString().StartsWith("00:")) + { nb = "> ```css" + Environment.NewLine + "> " + CurrentBossTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; } + if (NightInBdoTimeLabel.Content.ToString().StartsWith("00:")) + { nti = "> ```css" + Environment.NewLine + "> " + NightInBdoTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; } + if (IRTimeLabel.Content.ToString().StartsWith("00:")) + { iri = "> ```css" + Environment.NewLine + "> " + IRTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; } + if (BRTimeLabel.Content.ToString().StartsWith("00:")) + { br = "> ```css" + Environment.NewLine + "> " + BRTimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; } + if (ITRITimeLabel.Content.ToString().StartsWith("00:")) + { itr = "> ```css" + Environment.NewLine + "> " + ITRITimeLabel.Content.ToString() + Environment.NewLine + "> " + "```"; } + + + message = "> " + CbossLabel.Content.ToString() + Environment.NewLine + + nb + Environment.NewLine + + "> " + NILabel.Content.ToString() + Environment.NewLine + + nti + Environment.NewLine + + "> " + IRILabel.Content.ToString() + Environment.NewLine + + iri + Environment.NewLine + + "> " + BRILabel.Content.ToString() + Environment.NewLine + + br + Environment.NewLine + + "> " + ITRILabel.Content.ToString() + Environment.NewLine + + itr; + MainMessage = await channel.SendMessageAsync(message); + MainMessageID = MainMessage.Id; + if (DisplayTimeTableSetting.IsChecked == true) + { + var timetablemessage = await channel.SendFileAsync(System.IO.Directory.GetCurrentDirectory() + "/Resources/TimeTable.png", MOTR.ToString().ToUpper() + LanguageCollection[40].ToString()); + TimtableID = timetablemessage.Id; + } + + + } + } + catch (Exception s) + { + var bc = new BrushConverter(); + DiscordBotConnectionStatusLabel.Foreground = (Brush)bc.ConvertFrom("#FFBB3D3D"); + DiscordBotConnectionStatusLabel.Content = LanguageCollection[38].ToString(); + + Clipboard.SetText(s.Message.ToString()); + + string warning = ""; + if (s.Message.ToString().Contains("403")) + { warning = LanguageCollection[71].ToString(); } + if (warning == "") + { MessageBox.Show(s.Message); } + else + { MessageBox.Show(warning); } + + /*StartPosting();*/ + } + } + + private void StartPostingButton_Click(object sender, RoutedEventArgs e) + { + if (DiscordBotConnectionStatusLabel.Content.ToString() != LanguageCollection[39].ToString()) + { StartPosting(); } + } + + private async void DisplayTimeTableSetting_Click(object sender, RoutedEventArgs e)// time table discplay option + { + if (DiscordBotConnectionStatusLabel.Content.ToString() == LanguageCollection[39].ToString()) + { + if (DisplayTimeTableSetting.IsChecked == true) + { + if (TimtableID == 0) + { + try { gridview1.SelectedIndex = SharedDay; } catch (Exception) { } + if (File.Exists(System.IO.Directory.GetCurrentDirectory() + "/Resources/TimeTable.png")) + { File.Delete(System.IO.Directory.GetCurrentDirectory() + "/Resources/TimeTable.png"); } + //int width = int.Parse(gridview1.ActualWidth.ToString());//error + //int height = int.Parse(gridview1.ActualHeight.ToString()); + RenderTargetBitmap renderTargetBitmap = + new RenderTargetBitmap(1920, 1080, 180, 250, PixelFormats.Pbgra32); + renderTargetBitmap.Render(gridview1); + PngBitmapEncoder pngImage = new PngBitmapEncoder(); + pngImage.Frames.Add(BitmapFrame.Create(renderTargetBitmap)); + using (Stream fileStream = File.Create(System.IO.Directory.GetCurrentDirectory() + "/Resources/TimeTable.png")) + { + pngImage.Save(fileStream); + } + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(ChannelID); + var timetablemessage = await channel.SendFileAsync(System.IO.Directory.GetCurrentDirectory() + "/Resources/TimeTable.png", MOTR.ToString().ToUpper() + LanguageCollection[40].ToString()); + TimtableID = timetablemessage.Id; + } + + Settings.Default["DisplayTimeTableSetting"] = "1"; + Settings.Default.Save(); + } + else + { + if (TimtableID != 0) + { + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(ChannelID); + await channel.DeleteMessageAsync(TimtableID); + TimtableID = 0; + } + + Settings.Default["DisplayTimeTableSetting"] = "0"; + Settings.Default.Save(); + } + } + else + { + if (DisplayTimeTableSetting.IsChecked == true) + { + Settings.Default["DisplayTimeTableSetting"] = "1"; + Settings.Default.Save(); + } + else + { + Settings.Default["DisplayTimeTableSetting"] = "0"; + Settings.Default.Save(); + } + } + } + #region "Discord Notify By ping" + private async void DiscordNotifyBossSpwn(string bossmessage) + { + try + { + if (DiscordNotifyBossSpwnID == 0) + { + if (bossmessage.Contains("<00:00:00>")) + { bossmessage = bossmessage.Replace("<00:00:00>", CurrentBossTimeLabel.Content.ToString()); } + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(ChannelID); + var message = await channel.SendMessageAsync(">" + " " + BossSpawnRole + " " + currentbossrole1 + " " + currentbossrole2 + " " + CbossNameLabel.Content.ToString() + " " + bossmessage); + DiscordNotifyBossSpwnID = message.Id; + AnouncmentIntervalToDeleteMessages = 0; + } + } + catch (Exception) { } + } + private async void DiscordNotifyNightTime(string custommessage) + { + try + { + if (DiscordNotifyNightTimeID == 0) + { + if (custommessage.Contains("<00:00:00>")) + { custommessage = custommessage.Replace("<00:00:00>", NightInBdoTimeLabel.Content.ToString()); } + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(ChannelID); + var message = await channel.SendMessageAsync(">" + " " + NightTimeRole + " " + custommessage); + DiscordNotifyNightTimeID = message.Id; + AnouncmentIntervalToDeleteMessages = 0; + } + } + catch (Exception) { } + } + private async void DiscordNotifyImperialReset(string custommessage) + { + try + { + if (DiscordNotifyImperialResetID == 0) + { + if (custommessage.Contains("<00:00:00>")) + { custommessage = custommessage.Replace("<00:00:00>", IRTimeLabel.Content.ToString()); } + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(ChannelID); + var message = await channel.SendMessageAsync(">" + " " + ImperialResetRole + " " + custommessage); + DiscordNotifyImperialResetID = message.Id; + AnouncmentIntervalToDeleteMessages = 0; + } + } + catch (Exception) { } + } + private async void DiscordNotifyBR(string custommessage) + { + try + { + if (DiscordNotifyBarteringID == 0) + { + if (custommessage.Contains("<00:00:00>")) + { custommessage = custommessage.Replace("<00:00:00>", BRTimeLabel.Content.ToString()); } + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(ChannelID); + var message = await channel.SendMessageAsync(">" + " " + BarteringResetRole + " " + custommessage); + DiscordNotifyBarteringID = message.Id; + AnouncmentIntervalToDeleteMessages = 0; + } + } + catch (Exception) { } + } + private async void DiscordNotifyITR(string custommessage) + { + try + { + if (DiscordNotifyImperialTradingID == 0) + { + if (custommessage.Contains("<00:00:00>")) + { custommessage = custommessage.Replace("<00:00:00>", BRTimeLabel.Content.ToString()); } + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(ChannelID); + var message = await channel.SendMessageAsync(">" + " " + ImperialTradingResetRole + " " + custommessage); + DiscordNotifyImperialTradingID = message.Id; + AnouncmentIntervalToDeleteMessages = 0; + } + } + catch (Exception) { } + } + #endregion + private async void DeleteAnouncmentMessages()// delete pinged messaged after interval pass + { + try + { + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(ChannelID); + if (DiscordNotifyBossSpwnID != 0) + { + await channel.DeleteMessageAsync(DiscordNotifyBossSpwnID); + DiscordNotifyBossSpwnID = 0; + } + if (DiscordNotifyNightTimeID != 0) + { + await channel.DeleteMessageAsync(DiscordNotifyNightTimeID); + DiscordNotifyNightTimeID = 0; + } + if (DiscordNotifyImperialResetID != 0) + { + await channel.DeleteMessageAsync(DiscordNotifyImperialResetID); + DiscordNotifyImperialResetID = 0; + } + if (DiscordNotifyBarteringID != 0) + { + await channel.DeleteMessageAsync(DiscordNotifyBarteringID); + DiscordNotifyBarteringID = 0; + } + if (DiscordNotifyImperialTradingID != 0) + { + await channel.DeleteMessageAsync(DiscordNotifyImperialTradingID); + DiscordNotifyImperialTradingID = 0; + } + } + catch (Exception) { } + } + private void RMmtextbox_TextChanged(object sender, TextChangedEventArgs e)// set max message deletion Interval + { + try + { + if (int.Parse(RMmtextbox.Text) <= 0) + { RMmtextbox.Text = "1"; } + if (int.Parse(RMmtextbox.Text) >= 50) + { RMmtextbox.Text = "50"; } + } + catch (Exception) { } + } + + private void GitHub_Click(object sender, RoutedEventArgs e) + { + Process.Start("https://github.com/kresmes/BDO-Boss-Timer-Discord-Bot-Yuri-Project-/releases"); + } + private async void GetUrlSource(string url) + { + //int i = 0; + //CefSharpSettings.LegacyJavascriptBindingEnabled = false; + //CefSharpSettings.WcfEnabled = false; + + //webbrowser1.Address = url; + //webbrowser1.LoadingStateChanged += (sender1, args) => + //{ + // if (args.IsLoading == false) + // { + // i = 1; + // } + //}; + //while (true) + //{ + // Thread.Sleep(500); + // if (i == 1) + // { + // var htmlSource = await webbrowser1.GetSourceAsync(); + // if (SourceComboBox.SelectedIndex == 2) + // { GetBdoBossTimer(htmlSource); } + // break; + // } + //} + } + + private async void GetBdoBossTimer(string source) + { + webbrowser1.Address = "about:blank"; + + //webbrowser1.IsEnabled = false; + + //MessageBox.Show(@""); + var htmlDoc = new HtmlDocument(); + htmlDoc.LoadHtml(source); + currentbossrole1 = ""; + currentbossrole2 = ""; + timer1.Stop(); + startupRS = 0; + + //Clipboard.SetText(htmlNodes1); + //MessageBox.Show(htmlNodes1); + //var htmlregionDB = htmlDoc.DocumentNode.SelectSingleNode("/html/body/header/div/div/nav/ul/li[2]/ul").InnerText; + //var aftertheNext = htmlDoc.DocumentNode.SelectSingleNode("//*[@id='mainTbl']/tbody/tr[1]/td[2]/span").InnerText; + + //var pSecondboss = ""; + //try { pSecondboss = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[1]/div[2]/div/div/div[1]/div[2]/div[2]/h2").InnerText; } catch (Exception) { } + PbossNamLabel.Content = "X"; + //if (pSecondboss != "") + //{ PbossNamLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[1]/div[2]/div/div/div[1]/div[2]/div[1]/h2").InnerText + " & " + pSecondboss; } + //PreviousBossTimeLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[1]/div[2]/div/div/div[1]/div[1]/div[6]/div[1]").InnerText; + + var cSecondboss = ""; + try { cSecondboss = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[1]/div[2]/div/div/div[1]/div[2]/div[2]/h2").InnerText; } catch (Exception) { } + CbossNameLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[1]/div[2]/div/div/div[1]/div[2]/div[1]/h2").InnerText; + if (cSecondboss != "") + { CbossNameLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[1]/div[2]/div/div/div[1]/div[2]/div[1]/h2").InnerText + " & " + cSecondboss; } + CurrentBossTimeLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[1]/div[2]/div/div/div[1]/div[1]/div[6]/div[1]").InnerText; + + var nSecondboss = ""; + try { nSecondboss = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[1]/div[2]/div/div/div[1]/div[3]/div[3]/h5").InnerText; } catch (Exception) { } + NBossNameLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[1]/div[2]/div/div/div[1]/div[3]/div[2]/h5").InnerText; + if (nSecondboss != "") + { NBossNameLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[1]/div[2]/div/div/div[1]/div[3]/div[2]/h5").InnerText + " & " + nSecondboss; } + NextBossTimeLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[1]/div[2]/div/div/div[1]/div[3]/div[1]/h3[2]/span").InnerText; + + try { NightInBdoTimeLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[1]/div[2]/div/div/div[1]/div[4]/div[1]/p[1]/span[2]").InnerText; } catch (Exception) { } + try { IRTimeLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[1]/div[2]/div/div/div[1]/div[4]/div[2]/p[1]/span[2]").InnerText; } catch (Exception) { } + try { BRTimeLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[1]/div[2]/div/div/div[1]/div[4]/div[1]/p[2]/span[2]").InnerText; } catch (Exception) { } + try { ITRITimeLabel.Content = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[1]/div[2]/div/div/div[1]/div[4]/div[2]/p[2]/span[2]").InnerText; } catch (Exception) { } + + RegionComboBox.Items.Clear(); + RegionComboBox.Items.Add("eu".ToUpper()); + RegionComboBox.Items.Add("jp".ToUpper()); + RegionComboBox.Items.Add("kr".ToUpper()); + RegionComboBox.Items.Add("mena".ToUpper()); + RegionComboBox.Items.Add("na".ToUpper()); + RegionComboBox.Items.Add("ru".ToUpper()); + RegionComboBox.Items.Add("sa".ToUpper()); + RegionComboBox.Items.Add("sea".ToUpper()); + RegionComboBox.Items.Add("th".ToUpper()); + RegionComboBox.Items.Add("tw".ToUpper()); + RegionComboBox.Items.Add("xbox-na".ToUpper()); + RegionComboBox.Items.Add("xbox-eu".ToUpper()); + RegionComboBox.Items.Add("ps4-na".ToUpper()); + RegionComboBox.Items.Add("ps4-eu".ToUpper()); + RegionComboBox.Items.Add("ps4-asia".ToUpper()); + + RegionComboBox.Text = Settings.Default["DefaultRegion"].ToString().ToUpper(); + + source = source.Replace(@"", @"" + Environment.NewLine); + string Timezone = GetStrBetweenTags(source, @""); + htmlDoc.LoadHtml(source); + var TimeRow = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[3]/div/div[2]/div/table/thead/tr").InnerText; + //MessageBox.Show(TimeRow); + Clipboard.SetText(TimeRow); + string input = TimeRow; + string[] data = input.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); + try + { + TimeTable.Clear(); + for (int i = TimeTable.Rows.Count - 1; i >= 0; i--) + { + if (TimeTable.Rows[i][0].ToString() == "") + TimeTable.Rows[i].Delete(); + } + foreach (var column in TimeTable.Columns.Cast().ToArray()) + { + if (TimeTable.AsEnumerable().All(dr => dr.IsNull(column))) + TimeTable.Columns.Remove(column); + } + gridview1.ItemsSource = null; + TimeTable.AcceptChanges(); + } + catch (Exception) { } + int Crow = 0; + int Ccolumn = 0; + int MaxColumn = TimeTable.Columns.Count; + foreach (var bit in data) + { + if (Crow == 0 && Ccolumn == 0) + { + TimeTable.Columns.Add(Ccolumn.ToString()); + TimeTable.Rows.Add(new object[] { "" }); + DataRow dr = TimeTable.Rows[Crow]; + dr[Ccolumn] = Timezone; + Ccolumn++; + } + if (Crow == 0 && Ccolumn > 0 && bit.Length != 0 && bit.Length <= 6) + { + TimeTable.Columns.Add(Ccolumn.ToString()); + DataRow dr = TimeTable.Rows[Crow]; + dr[Ccolumn] = bit; + Ccolumn++; + } + } + int linP = 1; + int day = 1; + int ccl = 0; + int maxcl = TimeTable.Columns.Count; + TimeTable.Rows.Add(new object[] { "" }); + while (true) + { + foreach (var cl in TimeTable.Columns) + { + if (ccl == maxcl) + { + TimeTable.Rows.Add(new object[] { "" }); + day++; + ccl = 0; + linP = 1; + } + var obj = htmlDoc.DocumentNode.SelectSingleNode("/html/body/section[3]/div/div[2]/div/table/tbody/tr[" + day.ToString() + "]/td[" + linP.ToString() + "]").InnerText; + DataRow dr = TimeTable.Rows[day]; + string objF = obj.Replace("&", "," + Environment.NewLine); + dr[ccl] = objF; + ccl++; + linP++; + } + if(day == 7) + { break; } + } + + for (int i = TimeTable.Rows.Count - 1; i >= 0; i--) + { + if (TimeTable.Rows[i][0].ToString() == "") + TimeTable.Rows[i].Delete(); + } + + TimeTable.AcceptChanges(); + //int drow = 0; + int dayC = 0; + //string aftertheNext = Environment.NewLine + DateTime.Now.DayOfWeek.ToString(); // using local day + //MessageBox.Show(aftertheNext); + //foreach (DataRow row in TimeTable.Rows) + //{ + // DataRow dr = TimeTable.Rows[drow]; + // if (aftertheNext.Contains(dr[0].ToString())) + // { dayC = drow; } + // drow++; + //} + SharedDay = dayC; + gridview1.ItemsSource = TimeTable.DefaultView; + + try + { + BossesCollection.Clear(); + BossCollectionListBox.Items.Clear(); + } + catch (Exception) { } + string BossesList = File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/Bosses"); + string[] BossListSplited = BossesList.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); + foreach (string BossData in BossListSplited) + { + if (BossData != "") + { + BossesCollection.Add(BossData.Replace(Environment.NewLine, "")); + string bossName = BossData.Substring(0, BossData.IndexOf(",") + 1); + bossName = bossName.Replace(",", ""); + bossName = bossName.Replace(Environment.NewLine, ""); + BossCollectionListBox.Items.Add(bossName); + } + } + + PBImageBox.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/Boss.png")); + NBImageBox.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/Boss.png")); + LBImageBox.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/Boss.png")); + Getimg gm = new Getimg(); + + foreach (string item in BossesCollection) + { + string bossName = item.Substring(0, item.IndexOf(",") + 1); + bossName = bossName.Replace(",", ""); + bossName = bossName.Replace(Environment.NewLine, ""); + + if (PbossNamLabel.Content.ToString().Contains(bossName)) + { + string[] bossdata = item.Split(','); + string imgurl = bossdata[1].ToString(); + if (bossdata[5].ToString() != "") + { + imgurl = bossdata[5].ToString(); + if (imgurl.Contains("")) + { imgurl = imgurl.Replace("", System.IO.Directory.GetCurrentDirectory()); } + } + try { PBImageBox.Source = gm.GETIMAGE(imgurl); } catch (Exception) { } + if (PbossNamLabel.Content.ToString().Contains("&")) + { try { PBImageBox.Source = gm.GETIMAGE(System.IO.Directory.GetCurrentDirectory() + "/Resources/" + PbossNamLabel.Content.ToString() + ".png"); } catch (Exception) { } } + } + if (CbossNameLabel.Content.ToString().Contains(bossName)) + { + string[] bossdata = item.Split(','); + try + { + string imgurl = bossdata[1].ToString(); + if (bossdata[5].ToString() == "") + { + imgurl = bossdata[1].ToString(); + } + else + { + imgurl = bossdata[5].ToString(); + if (imgurl.Contains("")) + { imgurl = imgurl.Replace("", System.IO.Directory.GetCurrentDirectory()); } + } + publicNbossimage = bossdata[1].ToString(); + if (!CbossNameLabel.Content.ToString().Contains("&")) + { publicbossUrl = bossdata[2].ToString(); } + else + { + if (publicbossUrl == "") + { publicbossUrl = bossdata[2].ToString(); } + else + { publicbossUrl += " | " + bossdata[2].ToString(); } + } + NBImageBox.Source = gm.GETIMAGE(imgurl); + if (CbossNameLabel.Content.ToString().Contains("&")) + { try { NBImageBox.Source = gm.GETIMAGE(System.IO.Directory.GetCurrentDirectory() + "/Resources/" + CbossNameLabel.Content.ToString() + ".png"); } catch (Exception) { } } + //if (bossdata[3].ToString() != "") + //{ CbossNameLabel.Content = bossdata[3].ToString(); } + } + catch (Exception) { } + } + if (cSecondboss.Contains(bossName) && CbossNameLabel.Content.ToString().Contains("&") && cSecondboss != "") + { + string[] bossdata = item.Split(','); + if (publicbossUrl == "") + { publicbossUrl = bossdata[2].ToString(); } + else + { publicbossUrl += "|" + bossdata[2].ToString(); } + } + if (NBossNameLabel.Content.ToString().Contains(bossName)) + { + string[] bossdata = item.Split(','); + string imgurl = bossdata[1].ToString(); + if (bossdata[5].ToString() != "") + { + imgurl = bossdata[5].ToString(); + if (imgurl.Contains("")) + { imgurl = imgurl.Replace("", System.IO.Directory.GetCurrentDirectory()); } + } + try { LBImageBox.Source = gm.GETIMAGE(imgurl); } catch (Exception) { } + if (NBossNameLabel.Content.ToString().Contains("&")) + { try { LBImageBox.Source = gm.GETIMAGE(System.IO.Directory.GetCurrentDirectory() + "/Resources/" + NBossNameLabel.Content.ToString() + ".png"); } catch (Exception) { } } + //if (bossdata[3].ToString() != "") + //{ NBossNameLabel.Content = bossdata[3].ToString(); } + } + + } + + if (PbossNamLabel.Content.ToString().Contains(" & ")) + { + string fullbossname = ""; + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = PbossNamLabel.Content.ToString(); + name = name.Substring(0, name.IndexOf("&")); + if (name.Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString() + " & "; + } + } + } + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = PbossNamLabel.Content.ToString(); + name = name.Substring(name.IndexOf("&") + 1); + if (name.Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString(); + } + } + } + if (fullbossname != "") + { PbossNamLabel.Content = fullbossname; } + + } + else + { + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + if (PbossNamLabel.Content.ToString().Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { PbossNamLabel.Content = bossdata[3].ToString(); } + } + + } + } + + if (CbossNameLabel.Content.ToString().Contains(" & ")) + { + string fullbossname = ""; + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = CbossNameLabel.Content.ToString(); + name = name.Substring(0, name.IndexOf("&")); + if (name.Contains(bossdata[0].ToString())) + { + currentbossrole1 = bossdata[4].ToString(); + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString() + " & "; + } + } + } + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = CbossNameLabel.Content.ToString(); + name = name.Substring(name.IndexOf("&") + 1); + if (name.Contains(bossdata[0].ToString())) + { + currentbossrole2 = bossdata[4].ToString(); + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString(); + } + } + } + if (fullbossname != "") + { CbossNameLabel.Content = fullbossname; } + } + else + { + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + if (CbossNameLabel.Content.ToString().Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { + currentbossrole1 = bossdata[4].ToString(); + CbossNameLabel.Content = bossdata[3].ToString(); + } + else + { + currentbossrole1 = bossdata[4].ToString(); + } + } + + } + } + if (NBossNameLabel.Content.ToString().Contains(" & ")) + { + string fullbossname = ""; + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = NBossNameLabel.Content.ToString(); + name = name.Substring(0, name.IndexOf("&")); + if (name.Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString() + " & "; + } + } + } + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = NBossNameLabel.Content.ToString(); + name = name.Substring(name.IndexOf("&") + 1); + if (name.Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString(); + } + } + } + if (fullbossname != "") + { NBossNameLabel.Content = fullbossname; } + } + else + { + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + if (NBossNameLabel.Content.ToString().Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { NBossNameLabel.Content = bossdata[3].ToString(); } + } + + } + } + + SaveLatestTimeTable = 0; + intervalMessageUpdate = UpdateMesssageInterval; + try + { + var guild = discord.GetGuild(ServerID); + var channel = guild.GetTextChannel(ChannelID); + var Message = await channel.GetMessageAsync(bossImageID) as IUserMessage; + string[] pbu = publicbossUrl.Split('|'); + string[] bnu = CbossNameLabel.Content.ToString().Split('&'); + string ANmessage = ""; + if (CbossNameLabel.Content.ToString().Contains("&")) + { + ANmessage = "Bosses Locations" + Environment.NewLine + "[" + bnu[0] + "](" + pbu[0] + ")" + " <---" + LanguageCollection[87].ToString() + Environment.NewLine + "[" + bnu[1] + "](" + pbu[1] + ")" + " <---" + LanguageCollection[87].ToString(); + } + else + { + ANmessage = "Bosses Locations" + Environment.NewLine + "[" + bnu[0] + "](" + pbu[0] + ")" + " <---" + LanguageCollection[87].ToString(); + } + var embed1 = new EmbedBuilder + { + Title = CbossNameLabel.Content.ToString() /*+ " <---" + LanguageCollection[87].ToString()*/, + ImageUrl = publicNbossimage, + Color = Color.LightGrey, + //Url = publicbossUrl + Description = ANmessage + }; + await Message.ModifyAsync(msg => msg.Embed = embed1.Build()); + } + catch (Exception) { } + if (EditSpawnHoursSlider.Value.ToString().Contains("-")) + { + DateTime PDT = DateTime.Parse(PreviousBossTimeLabel.Content.ToString()); + string pdtl = PDT.AddHours(double.Parse(EditSpawnHoursSlider.Value.ToString().Replace("-", "+"))).ToString(@"hh\:mm\:ss"); + PreviousBossTimeLabel.Content = pdtl; + + DateTime CDT = DateTime.Parse(CurrentBossTimeLabel.Content.ToString()); + string cbtl = CDT.AddHours(EditSpawnHoursSlider.Value).ToString(@"hh\:mm\:ss"); + CurrentBossTimeLabel.Content = cbtl; + + DateTime NDT = DateTime.Parse(NextBossTimeLabel.Content.ToString()); + string nbtl = NDT.AddHours(EditSpawnHoursSlider.Value).ToString(@"hh\:mm\:ss"); + NextBossTimeLabel.Content = nbtl; + } + if (EditSpawnHoursSlider.Value > 0) + { + DateTime PDT = DateTime.Parse(PreviousBossTimeLabel.Content.ToString()); + string pdtl = PDT.AddHours(double.Parse("-" + EditSpawnHoursSlider.Value.ToString())).ToString(@"hh\:mm\:ss"); + PreviousBossTimeLabel.Content = pdtl; + + DateTime CDT = DateTime.Parse(CurrentBossTimeLabel.Content.ToString()); + string cbtl = CDT.AddHours(EditSpawnHoursSlider.Value).ToString(@"hh\:mm\:ss"); + CurrentBossTimeLabel.Content = cbtl; + + DateTime NDT = DateTime.Parse(NextBossTimeLabel.Content.ToString()); + string nbtl = NDT.AddHours(EditSpawnHoursSlider.Value).ToString(@"hh\:mm\:ss"); + NextBossTimeLabel.Content = nbtl; + } + timer1.Start(); + + } + public static string GetStrBetweenTags(string value, string startTag, string endTag) + { + if (value.Contains(startTag) && value.Contains(endTag)) + { + int index = value.IndexOf(startTag) + startTag.Length; + return value.Substring(index, value.IndexOf(endTag) - index); + } + else + return null; + } + private void GlobalSettingNextButton_Click(object sender, RoutedEventArgs e) + { + + tabcontrol1.SelectedIndex = 4; + try + { + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + tabcontrol1.BeginAnimation(OpacityProperty, da); + } + catch (Exception) { } + } + + private void SaveSettings2Button_Click(object sender, RoutedEventArgs e) + { + if (BSA1CMTextBox.Text == "") + { + BSA1CMTextBox.Text = LanguageCollection[43].ToString(); + } + if (BSA1CMTextBox.Text == LanguageCollection[43].ToString()) + { + Settings.Default["BSA1CM"] = ""; + Settings.Default.Save(); + } + else + { + Settings.Default["BSA1CM"] = BSA1CMTextBox.Text; + Settings.Default.Save(); + } + + if (BSA2CMTextBox.Text == "") + { + BSA2CMTextBox.Text = LanguageCollection[43].ToString(); + } + if (BSA2CMTextBox.Text == LanguageCollection[43].ToString()) + { + Settings.Default["BSA2CM"] = ""; + Settings.Default.Save(); + } + else + { + Settings.Default["BSA2CM"] = BSA2CMTextBox.Text; + Settings.Default.Save(); + } + + if (BSA3CMTextBox.Text == "") + { + BSA3CMTextBox.Text = LanguageCollection[43].ToString(); + } + if (BSA3CMTextBox.Text == LanguageCollection[43].ToString()) + { + Settings.Default["BSA3CM"] = ""; + Settings.Default.Save(); + } + else + { + Settings.Default["BSA3CM"] = BSA3CMTextBox.Text; + Settings.Default.Save(); + } + + + if (NTA1CMTextbBox.Text == "") + { + NTA1CMTextbBox.Text = LanguageCollection[44].ToString(); + } + if (NTA1CMTextbBox.Text == LanguageCollection[44].ToString()) + { + Settings.Default["NTA1CM"] = ""; + Settings.Default.Save(); + } + else + { + Settings.Default["NTA1CM"] = NTA1CMTextbBox.Text; + Settings.Default.Save(); + } + + if (NTA2CMTextbBox.Text == "") + { + NTA2CMTextbBox.Text = LanguageCollection[44].ToString(); + } + if (NTA2CMTextbBox.Text == LanguageCollection[44].ToString()) + { + Settings.Default["NTA2CM"] = ""; + Settings.Default.Save(); + } + else + { + Settings.Default["NTA2CM"] = NTA2CMTextbBox.Text; + Settings.Default.Save(); + } + + if (NTA3CMTextbBox.Text == "") + { + NTA3CMTextbBox.Text = LanguageCollection[44].ToString(); + } + if (NTA3CMTextbBox.Text == LanguageCollection[44].ToString()) + { + Settings.Default["NTA3CM"] = ""; + Settings.Default.Save(); + } + else + { + Settings.Default["NTA3CM"] = NTA3CMTextbBox.Text; + Settings.Default.Save(); + } + + + if (IRA1CMTextBox.Text == "") + { + IRA1CMTextBox.Text = LanguageCollection[45].ToString(); + } + if (IRA1CMTextBox.Text == LanguageCollection[45].ToString()) + { + Settings.Default["IRA1CM"] = ""; + Settings.Default.Save(); + } + else + { + Settings.Default["IRA1CM"] = IRA1CMTextBox.Text; + Settings.Default.Save(); + } + + if (IRA2CMTextBox.Text == "") + { + IRA2CMTextBox.Text = LanguageCollection[45].ToString(); + } + if (IRA2CMTextBox.Text == LanguageCollection[45].ToString()) + { + Settings.Default["IRA2CM"] = ""; + Settings.Default.Save(); + } + else + { + Settings.Default["IRA2CM"] = IRA2CMTextBox.Text; + Settings.Default.Save(); + } + + if (IRA3CMTextBox.Text == "") + { + IRA3CMTextBox.Text = LanguageCollection[45].ToString(); + } + if (IRA3CMTextBox.Text == LanguageCollection[45].ToString()) + { + Settings.Default["IRA3CM"] = ""; + Settings.Default.Save(); + } + else + { + Settings.Default["IRA3CM"] = IRA3CMTextBox.Text; + Settings.Default.Save(); + } + + + if (BRA1CMTextBox.Text == "") + { + BRA1CMTextBox.Text = LanguageCollection[89].ToString(); + } + if (BRA1CMTextBox.Text == LanguageCollection[89].ToString()) + { + Settings.Default["BRA1CM"] = ""; + Settings.Default.Save(); + } + else + { + Settings.Default["BRA1CM"] = BRA1CMTextBox.Text; + Settings.Default.Save(); + } + + if (BRA2CMTextBox.Text == "") + { + BRA2CMTextBox.Text = LanguageCollection[89].ToString(); + } + if (BRA2CMTextBox.Text == LanguageCollection[89].ToString()) + { + Settings.Default["BRA2CM"] = ""; + Settings.Default.Save(); + } + else + { + Settings.Default["BRA2CM"] = BRA2CMTextBox.Text; + Settings.Default.Save(); + } + + if (BRA3CMTextBox.Text == "") + { + BRA3CMTextBox.Text = LanguageCollection[89].ToString(); + } + if (BRA3CMTextBox.Text == LanguageCollection[89].ToString()) + { + Settings.Default["BRA3CM"] = ""; + Settings.Default.Save(); + } + else + { + Settings.Default["BRA3CM"] = BRA3CMTextBox.Text; + Settings.Default.Save(); + } + + tabcontrol1.SelectedIndex = 3; + try + { + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + tabcontrol1.BeginAnimation(OpacityProperty, da); + } + catch (Exception) { } + } + + private void EditSpawnHoursSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) + { + //timer1.Stop(); + if (EditSpawnHoursSlider.Value > lastSliderValue) + { + DateTime PDT = DateTime.Parse(PreviousBossTimeLabel.Content.ToString()); + string pdtl = PDT.AddHours(-1).ToString(@"hh\:mm\:ss"); + PreviousBossTimeLabel.Content = pdtl; + + DateTime CDT = DateTime.Parse(CurrentBossTimeLabel.Content.ToString()); + string cbtl = CDT.AddHours(1).ToString(@"hh\:mm\:ss"); + CurrentBossTimeLabel.Content = cbtl; + + DateTime NDT = DateTime.Parse(NextBossTimeLabel.Content.ToString()); + string nbtl = NDT.AddHours(1).ToString(@"hh\:mm\:ss"); + NextBossTimeLabel.Content = nbtl; + } + else + { + DateTime PDT = DateTime.Parse(PreviousBossTimeLabel.Content.ToString()); + string pdtl = PDT.AddHours(1).ToString(@"hh\:mm\:ss"); + PreviousBossTimeLabel.Content = pdtl; + + DateTime CDT = DateTime.Parse(CurrentBossTimeLabel.Content.ToString()); + string cbtl = CDT.AddHours(-1).ToString(@"hh\:mm\:ss"); + CurrentBossTimeLabel.Content = cbtl; + + DateTime NDT = DateTime.Parse(NextBossTimeLabel.Content.ToString()); + string nbtl = NDT.AddHours(-1).ToString(@"hh\:mm\:ss"); + NextBossTimeLabel.Content = nbtl; + } + lastSliderValue = EditSpawnHoursSlider.Value; + if (EditSpawnHoursSlider.Value.ToString().Contains("-")) + { EditSpawnHoursLabael1.Content = "Edit Spawn Hours " + EditSpawnHoursSlider.Value; } + else + { EditSpawnHoursLabael1.Content = "Edit Spawn Hours +" + EditSpawnHoursSlider.Value; } + if (EditSpawnHoursSlider.Value == 0) + { EditSpawnHoursLabael1.Content = "Edit Spawn Hours " + EditSpawnHoursSlider.Value; } + Settings.Default["EditSpawnHoursSlider"] = EditSpawnHoursSlider.Value.ToString(); + Settings.Default.Save(); + } + + private void SettingsKeepMessagesCheckBox_Click(object sender, RoutedEventArgs e) + { + if (SettingsKeepMessagesCheckBox.IsChecked == true) + { + Settings.Default["SettingKeepMessages"] = "1"; + Settings.Default.Save(); + RMmtextbox.IsEnabled = false; + } + else + { + Settings.Default["SettingKeepMessages"] = "0"; + Settings.Default.Save(); + RMmtextbox.IsEnabled = true; + } + } + + private void AlertonhousandminutesCheckBox_Click(object sender, RoutedEventArgs e) + { + if (AlertonhousandminutesCheckBox.IsChecked == true) + { + Settings.Default["AlarmonhoursCheckbox"] = "1"; + Settings.Default.Save(); + } + else + { + Settings.Default["AlarmonhoursCheckbox"] = "0"; + Settings.Default.Save(); + } + } + + private void AlarmsNextTab_Click(object sender, RoutedEventArgs e) + { + AlarmsTabControl.SelectedIndex = 1; + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + AlarmsTabControl.BeginAnimation(OpacityProperty, da); + AlarmsPreviewsTab.Visibility = Visibility.Visible; + AlarmsNextTab.Visibility = Visibility.Hidden; + } + + private void AlarmsPreviewsTab_Click(object sender, RoutedEventArgs e) + { + AlarmsTabControl.SelectedIndex = 0; + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + AlarmsTabControl.BeginAnimation(OpacityProperty, da); + AlarmsPreviewsTab.Visibility = Visibility.Hidden; + AlarmsNextTab.Visibility = Visibility.Visible; + } + + private void BRAlarm1Textbox_LostFocus(object sender, RoutedEventArgs e) + { + SaveBarteringResetAlrarmSettings(); + } + private void SaveBarteringResetAlrarmSettings() + { + if (BRAlarm1Textbox.Text == "") + { BRAlarm1Textbox.Text = "30"; } + if (BRAlarm2Textbox.Text == "") + { BRAlarm2Textbox.Text = "15"; } + if (BRAlarm3Textbox.Text == "") + { BRAlarm3Textbox.Text = "05"; } + + if (BRAlarm1Textbox.Text == "0") + { BRAlarm1Textbox.Text = "30"; } + if (BRAlarm2Textbox.Text == "0") + { BRAlarm2Textbox.Text = "15"; } + if (BRAlarm3Textbox.Text == "0") + { BRAlarm3Textbox.Text = "05"; } + + if (int.Parse(BRAlarm1Textbox.Text) < 10) + { BRAlarm1Textbox.Text = "0" + int.Parse(BRAlarm1Textbox.Text); } + if (int.Parse(BRAlarm2Textbox.Text) < 10) + { BRAlarm2Textbox.Text = "0" + int.Parse(BRAlarm2Textbox.Text); } + if (int.Parse(BRAlarm3Textbox.Text) < 10) + { BRAlarm3Textbox.Text = "0" + int.Parse(BRAlarm3Textbox.Text); } + + string bitResult = ""; + if (BRAlarmCheckBox1.IsChecked == true) + { bitResult += BRAlarm1Textbox.Text + "," + "1,"; } + else + { bitResult += BRAlarm1Textbox.Text + "," + "0,"; } + + if (BRAlarmCheckBox2.IsChecked == true) + { bitResult += BRAlarm2Textbox.Text + "," + "1,"; } + else + { bitResult += BRAlarm2Textbox.Text + "," + "0,"; } + + if (BRAlarmCheckBox3.IsChecked == true) + { bitResult += BRAlarm3Textbox.Text + "," + "1"; } + else + { bitResult += BRAlarm3Textbox.Text + "," + "0"; } + + Settings.Default["BRAlarmCheckBox"] = bitResult; + Settings.Default.Save(); + } + + private void BRAlarm1Textbox_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + if (int.Parse(BRAlarm1Textbox.Text) > 59) + { BRAlarm1Textbox.Text = "59"; } + } + catch (Exception) { } + } + + private void BRAlarm2Textbox_LostFocus(object sender, RoutedEventArgs e) + { + SaveBarteringResetAlrarmSettings(); + } + + private void BRAlarm2Textbox_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + if (int.Parse(BRAlarm2Textbox.Text) > 59) + { BRAlarm2Textbox.Text = "59"; } + } + catch (Exception) { } + } + + private void BRAlarm3Textbox_LostFocus(object sender, RoutedEventArgs e) + { + SaveBarteringResetAlrarmSettings(); + } + + private void BRAlarm3Textbox_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + if (int.Parse(BRAlarm3Textbox.Text) > 59) + { BRAlarm3Textbox.Text = "59"; } + } + catch (Exception) { } + } + + private void BRAlarmCheckBox1_Click(object sender, RoutedEventArgs e) + { + SaveBarteringResetAlrarmSettings(); + } + + private void BRAlarmCheckBox2_Click(object sender, RoutedEventArgs e) + { + SaveBarteringResetAlrarmSettings(); + } + + private void BRAlarmCheckBox3_Click(object sender, RoutedEventArgs e) + { + SaveBarteringResetAlrarmSettings(); + } + private void SaveImperialTradingResetAlrarmSettings() + { + if (ITRAlarm1Textbox.Text == "") + { ITRAlarm1Textbox.Text = "30"; } + if (ITRAlarm2Textbox.Text == "") + { ITRAlarm2Textbox.Text = "15"; } + if (ITRAlarm3Textbox.Text == "") + { ITRAlarm3Textbox.Text = "05"; } + + if (ITRAlarm1Textbox.Text == "0") + { ITRAlarm1Textbox.Text = "30"; } + if (ITRAlarm2Textbox.Text == "0") + { ITRAlarm2Textbox.Text = "15"; } + if (ITRAlarm3Textbox.Text == "0") + { ITRAlarm3Textbox.Text = "05"; } + + if (int.Parse(ITRAlarm1Textbox.Text) < 10) + { ITRAlarm1Textbox.Text = "0" + int.Parse(ITRAlarm1Textbox.Text); } + if (int.Parse(ITRAlarm2Textbox.Text) < 10) + { ITRAlarm2Textbox.Text = "0" + int.Parse(ITRAlarm2Textbox.Text); } + if (int.Parse(ITRAlarm3Textbox.Text) < 10) + { ITRAlarm3Textbox.Text = "0" + int.Parse(ITRAlarm3Textbox.Text); } + + string bitResult = ""; + if (ITRAlarmCheckBox1.IsChecked == true) + { bitResult += ITRAlarm1Textbox.Text + "," + "1,"; } + else + { bitResult += ITRAlarm1Textbox.Text + "," + "0,"; } + + if (ITRAlarmCheckBox2.IsChecked == true) + { bitResult += ITRAlarm2Textbox.Text + "," + "1,"; } + else + { bitResult += ITRAlarm2Textbox.Text + "," + "0,"; } + + if (ITRAlarmCheckBox3.IsChecked == true) + { bitResult += ITRAlarm3Textbox.Text + "," + "1"; } + else + { bitResult += ITRAlarm3Textbox.Text + "," + "0"; } + + + Settings.Default["ITRAlarmCheckBox"] = bitResult; + Settings.Default.Save(); + } + + private void ITRAlarm1Textbox_LostFocus(object sender, RoutedEventArgs e) + { + SaveImperialTradingResetAlrarmSettings(); + } + + private void ITRAlarmCheckBox1_Click(object sender, RoutedEventArgs e) + { + SaveImperialTradingResetAlrarmSettings(); + } + + private void ITRAlarm1Textbox_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + if (int.Parse(ITRAlarm1Textbox.Text) > 59) + { ITRAlarm1Textbox.Text = "59"; } + } + catch (Exception) { } + } + + private void ITRAlarm2Textbox_LostFocus(object sender, RoutedEventArgs e) + { + SaveImperialTradingResetAlrarmSettings(); + } + + private void ITRAlarm2Textbox_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + if (int.Parse(ITRAlarm2Textbox.Text) > 59) + { ITRAlarm2Textbox.Text = "59"; } + } + catch (Exception) { } + } + + private void ITRAlarmCheckBox2_Click(object sender, RoutedEventArgs e) + { + SaveImperialTradingResetAlrarmSettings(); + } + + private void ITRAlarm3Textbox_LostFocus(object sender, RoutedEventArgs e) + { + SaveImperialTradingResetAlrarmSettings(); + } + + private void ITRAlarm3Textbox_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + if (int.Parse(ITRAlarm3Textbox.Text) > 59) + { ITRAlarm3Textbox.Text = "59"; } + } + catch (Exception) { } + } + + private void ITRAlarmCheckBox3_Click(object sender, RoutedEventArgs e) + { + SaveImperialTradingResetAlrarmSettings(); + } + + private void CMNextPage_Click(object sender, RoutedEventArgs e) + { + tabcontrol1.SelectedIndex = 5; + try + { + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + tabcontrol1.BeginAnimation(OpacityProperty, da); + } + catch (Exception) { } + } + + private void CMBback_Click(object sender, RoutedEventArgs e) + { + if (ITRA1CMTextBox.Text == "") + { + ITRA1CMTextBox.Text = LanguageCollection[88].ToString(); + } + if (ITRA1CMTextBox.Text == LanguageCollection[88].ToString()) + { + Settings.Default["ITRA1CM"] = ""; + Settings.Default.Save(); + } + else + { + Settings.Default["ITRA1CM"] = ITRA1CMTextBox.Text; + Settings.Default.Save(); + } + + if (ITRA2CMTextBox.Text == "") + { + ITRA2CMTextBox.Text = LanguageCollection[88].ToString(); + } + if (ITRA2CMTextBox.Text == LanguageCollection[88].ToString()) + { + Settings.Default["ITRA2CM"] = ""; + Settings.Default.Save(); + } + else + { + Settings.Default["ITRA2CM"] = ITRA2CMTextBox.Text; + Settings.Default.Save(); + } + + if (ITRA3CMTextBox.Text == "") + { + ITRA3CMTextBox.Text = LanguageCollection[88].ToString(); + } + if (ITRA3CMTextBox.Text == LanguageCollection[88].ToString()) + { + Settings.Default["ITRA3CM"] = ""; + Settings.Default.Save(); + } + else + { + Settings.Default["ITRA3CM"] = ITRA3CMTextBox.Text; + Settings.Default.Save(); + } + + tabcontrol1.SelectedIndex = 4; + try + { + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + tabcontrol1.BeginAnimation(OpacityProperty, da); + } + catch (Exception) { } + } + + private void SourceHelpButton_Click(object sender, RoutedEventArgs e) + { + if (SourceComboBox.SelectedIndex == 1) + { Process.Start("https://mmotimer.com/bdo/?server=" + MOTR); } + if (SourceComboBox.SelectedIndex == 2) + { Process.Start("https://bdobosstimer.com/?&server=" + MOTR); } + } + + private void BotHostHelpButton_Click(object sender, RoutedEventArgs e) + { + if (BotHostComboBox.SelectedIndex == 1) + { Process.Start("https://polisystems.ch/EN/index"); } + } + + private void BotHostComboBox_DropDownClosed(object sender, EventArgs e) + { + if (BotHostComboBox.SelectedIndex == 0) + { BotHostHelpButton.Visibility = Visibility.Hidden; } + if (BotHostComboBox.SelectedIndex == 1) + { BotHostHelpButton.Visibility = Visibility.Visible; } + } + + private void SourceComboBox_DropDownClosed(object sender, EventArgs e) + { + if (lastSelectedSource != SourceComboBox.SelectedIndex) + { + Settings.Default["SelectedSource"] = SourceComboBox.SelectedIndex.ToString(); + Settings.Default.Save(); + lastSelectedSource = SourceComboBox.SelectedIndex; + string region = Settings.Default["DefaultRegion"].ToString();//get Last Saved Region xbox-na + if (SourceComboBox.SelectedIndex == 1) + { GetTimeTable(region); } + if (SourceComboBox.SelectedIndex == 2) + { GetUrlSource("https://bdobosstimer.com/?&server=" + region); } + } + } + + private void AddnewBossTestImgLinkButtonLocal_Click(object sender, RoutedEventArgs e) + { + Getimg gm = new Getimg(); + DisplayImageLinkextBoxLocal.BorderBrush = Brushes.Silver; + AddSaveBossPictureBox.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/Boss.png")); + string imgurl = DisplayImageLinkextBoxLocal.Text; + if (imgurl.Contains("")) + { imgurl = imgurl.Replace("", System.IO.Directory.GetCurrentDirectory()); } + try { AddSaveBossPictureBox.Source = gm.GETIMAGE(imgurl); } catch (Exception) { DisplayImageLinkextBoxLocal.BorderBrush = Brushes.Red; } + } + + private void GetLYPBBTTimeTable() + { + string timetable = File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/LYPBBTTT"); + + RegionComboBox.Items.Clear(); + RegionComboBox.Items.Add("PS4-ASIA"); + RegionComboBox.Items.Add("EU"); + RegionComboBox.Items.Add("PS4-XBOX-EU"); + RegionComboBox.Items.Add("JP"); + RegionComboBox.Items.Add("KR"); + RegionComboBox.Items.Add("MENA"); + RegionComboBox.Items.Add("NA"); + RegionComboBox.Items.Add("PS4-XBOX-NA"); + RegionComboBox.Items.Add("RU"); + RegionComboBox.Items.Add("SA"); + RegionComboBox.Items.Add("SEA"); + RegionComboBox.Items.Add("TH"); + RegionComboBox.Items.Add("TW"); + + TimeTableBoss1DropBox.Items.Clear(); + TimeTableBoss1DropBox.Items.Add("None"); + TimeTableBoss1DropBox.Items.Add("Kzarka"); + TimeTableBoss1DropBox.Items.Add("Nouver"); + TimeTableBoss1DropBox.Items.Add("Karanda"); + TimeTableBoss1DropBox.Items.Add("Kutum"); + TimeTableBoss1DropBox.Items.Add("Offin"); + TimeTableBoss1DropBox.Items.Add("Garmoth"); + TimeTableBoss1DropBox.Items.Add("Quint"); + TimeTableBoss1DropBox.Items.Add("Muraka"); + TimeTableBoss1DropBox.Items.Add("Vell"); + + TimeTableBoss2DropBox.Items.Clear(); + TimeTableBoss2DropBox.Items.Add("None"); + TimeTableBoss2DropBox.Items.Add("Kzarka"); + TimeTableBoss2DropBox.Items.Add("Nouver"); + TimeTableBoss2DropBox.Items.Add("Karanda"); + TimeTableBoss2DropBox.Items.Add("Kutum"); + TimeTableBoss2DropBox.Items.Add("Offin"); + TimeTableBoss2DropBox.Items.Add("Garmoth"); + TimeTableBoss2DropBox.Items.Add("Quint"); + TimeTableBoss2DropBox.Items.Add("Muraka"); + TimeTableBoss2DropBox.Items.Add("Vell"); + + TimeColumnHoursDropBox.Items.Clear(); + TimeColumnMinutesDropBox.Items.Clear(); + int HV = 0; + while(true) + { + if (HV < 24) + { + if (HV.ToString().Length == 1) + { TimeColumnHoursDropBox.Items.Add("0" + HV.ToString()); } + else + { TimeColumnHoursDropBox.Items.Add(HV.ToString()); } + } + if (HV.ToString().Length == 1) + { TimeColumnMinutesDropBox.Items.Add("0" + HV.ToString()); } + else + { TimeColumnMinutesDropBox.Items.Add(HV.ToString()); } + + HV++; + if (HV > 59) + { break; } + } + + RegionComboBox.Text = Settings.Default["DefaultRegion"].ToString().ToUpper(); + if(RegionComboBox.Text == "") + { RegionComboBox.Text = "EU"; } + int rsi = RegionComboBox.SelectedIndex; + int UtcValue = 0; + switch (rsi) + { + case 0: + UtcValue = +9; + break; + case 1: + UtcValue = +2; + break; + case 2: + UtcValue = +1; + break; + case 3: + UtcValue = +9; + break; + case 4: + UtcValue = +9; + break; + case 5: + UtcValue = +3; + break; + case 6: + UtcValue = -8; + break; + case 7: + UtcValue = -8; + break; + case 8: + UtcValue = +3; + break; + case 9: + UtcValue = -3; + break; + case 10: + UtcValue = +8; + break; + case 11: + UtcValue = +7; + break; + case 12: + UtcValue = -6; + break; + } + DateTime thisDate = DateTime.UtcNow.AddHours(UtcValue); + Console.WriteLine(thisDate.DayOfWeek.ToString() + "//"+thisDate.ToString(@"hh\:mm\:ss")); + TimeTable.Clear(); + TimeTable.Columns.Add(""); + string timezone = "Utc " + UtcValue; + if(!UtcValue.ToString().Contains("-")) + { timezone = "Utc +" + UtcValue; } + TimeTable.Rows.Add(new object[] { timezone}); + TimeTable.Rows.Add(new object[] { DayOfWeek.Monday}); + TimeTable.Rows.Add(new object[] { DayOfWeek.Tuesday}); + TimeTable.Rows.Add(new object[] { DayOfWeek.Wednesday}); + TimeTable.Rows.Add(new object[] { DayOfWeek.Thursday}); + TimeTable.Rows.Add(new object[] { DayOfWeek.Friday}); + TimeTable.Rows.Add(new object[] { DayOfWeek.Saturday }); + TimeTable.Rows.Add(new object[] { DayOfWeek.Sunday}); + + string RegionTimeTable = GetStrBetweenTags(timetable, "[" + RegionComboBox.Text + "]", "[/" + RegionComboBox.Text + "]"); + string[] TimeTableRows = RegionTimeTable.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); + int rx = 0; + foreach(string row in TimeTableRows) + { + if (row != "") + { + string[] TimeTableColumns = row.Split('|'); + int cx = 1; + foreach (string cell in TimeTableColumns) + { + if (rx == 0) + { TimeTable.Columns.Add(""); } + DataRow itdr = TimeTable.Rows[rx]; + string celloutput = cell; + if(celloutput.Contains(",")) + { celloutput = celloutput.Replace(",", "," + Environment.NewLine); } + itdr[cx] = celloutput; + cx++; + } + rx++; + } + } + DataRow dr = TimeTable.Rows[0]; + string input = dr[1].ToString(); + if (dr[1].ToString() == "") + { + TimeColumnHoursDropBox.Text = "00"; + TimeColumnMinutesDropBox.Text = "00"; + } + else + { + string Hours = input.Substring(0, input.IndexOf(":") + 0); + string Minutes = input.Substring(input.IndexOf(":") + 1); + TimeColumnHoursDropBox.Text = Hours; + TimeColumnMinutesDropBox.Text = Minutes; + } + //MessageBox.Show(thisDate.ToString(@"HH\:mm")); + DateTime dt = thisDate; + List times = times = new List(); + int cx1 = 0; + foreach(var cl in TimeTable.Columns) + { + if (cx1 > 0) + { + DataRow itdr = TimeTable.Rows[0]; + string cell = itdr[cx1].ToString(); + DateTime dt1 = DateTime.Parse(cell); + times.Add(dt1); + } + cx1++; + } + var closestTime = (from t in times orderby (t - dt).Duration() select t).First(); + cx1 = 0; + int CbC = 1; + foreach (var cl in TimeTable.Columns) + { + if (cx1 > 0) + { + DataRow itdr = TimeTable.Rows[0]; + string cell = itdr[cx1].ToString(); + if(closestTime.ToString(@"HH\:mm") == cell) + { CbC = cx1; } + } + cx1++; + } + DateTime ct = DateTime.Parse(closestTime.ToString(@"HH\:mm")); + if(ct < dt) + { CbC++; } + int cr = 0; + int CbR = 1; + foreach(var ra in TimeTable.Rows) + { + if(cr > 0) + { + DataRow itdr = TimeTable.Rows[cr]; + if(dt.DayOfWeek.ToString() == itdr[0].ToString()) + { CbR = cr; } + } + cr++; + } + if (CbC == TimeTable.Columns.Count - 1) + { CbC = 1; CbR++; } + //filter + string cSecondboss = ""; + DataRow BN = TimeTable.Rows[CbR]; + string CBN = BN[CbC].ToString(); + if(CBN == "") + { + while(true) + { + BN = TimeTable.Rows[CbR]; + CBN = BN[CbC].ToString(); + + if (CBN != "") + { break; } + if(CbC == TimeTable.Columns.Count-1) + { + CbC = 0; + CbR++; + if(CbR >= 8) + { CbR = 1; } + } + CbC++; + } + } + if(CBN.Contains(",")) + { + CBN = CBN.Replace("," + Environment.NewLine, " & "); + cSecondboss = CBN.Substring(CBN.IndexOf(" & ") + 3); + } + CbossNameLabel.Content = CBN; + //cb timespan + DataRow rfcb = TimeTable.Rows[0]; + DateTime cbts = DateTime.Parse(rfcb[CbC].ToString()+":00"); + TimeSpan Cduration = DateTime.Parse(cbts.ToString(@"hh\:mm\:ss")).Subtract(DateTime.Parse(dt.ToString(@"hh\:mm\:ss"))); + CurrentBossTimeLabel.Content = Cduration.ToString(@"hh\:mm\:ss"); + //MessageBox.Show(cbtf.ToString(@"hh\:mm\:ss")); + int PCbc = CbC - 1; + int PCbR = CbR; + if(PCbc == 0) + { + PCbR = PCbR - 1; + BN = TimeTable.Rows[PCbR]; + PCbc = TimeTable.Columns.Count-1; + } + string PBN = BN[PCbc].ToString(); + if(PBN == "") + { + while(true) + { + BN = TimeTable.Rows[PCbR]; + PBN = BN[PCbc].ToString(); + + if (PBN != "") + { break; } + if (PCbc == 1) + { + PCbc = TimeTable.Columns.Count; + PCbR--; + if (PCbR <= 0) + { PCbR = 7; } + } + PCbc--; + } + } + if (PBN.Contains(",")) + { PBN = PBN.Replace("," + Environment.NewLine, " & "); } + PbossNamLabel.Content = PBN; + + DateTime Pcbts = DateTime.Parse(rfcb[PCbc].ToString() + ":00"); + //TimeSpan duration = DateTime.Parse(endTime).Subtract(DateTime.Parse(startTime)); + TimeSpan duration = DateTime.Parse(Pcbts.ToString(@"hh\:mm\:ss")).Subtract(DateTime.Parse(dt.ToString(@"hh\:mm\:ss"))); + PreviousBossTimeLabel.Content = duration.ToString(@"hh\:mm\:ss"); + + int NCbc = CbC + 1; + int NCbR = CbR; + if (NCbc == TimeTable.Columns.Count) + { + NCbR = NCbR + 1; + BN = TimeTable.Rows[NCbR]; + NCbc = 1; + } + BN = TimeTable.Rows[NCbR]; + string NBN = BN[NCbc].ToString(); + if(NBN == "") + { + while(true) + { + BN = TimeTable.Rows[NCbR]; + NBN = BN[NCbc].ToString(); + if (NBN != "") + { break; } + if(NCbc == TimeTable.Columns.Count -1) + { + NCbc = 0; + NCbR++; + if (NCbR >= 8) + { NCbR = 1; } + } + NCbc++; + } + } + if (NBN.Contains(",")) + { NBN = NBN.Replace("," + Environment.NewLine, " & "); } + NBossNameLabel.Content = NBN; + DateTime Ncbts = DateTime.Parse(rfcb[NCbc].ToString() + ":00"); + //TimeSpan duration = DateTime.Parse(endTime).Subtract(DateTime.Parse(startTime)); + TimeSpan Nduration = DateTime.Parse(Ncbts.ToString(@"hh\:mm\:ss")).Subtract(DateTime.Parse(dt.ToString(@"hh\:mm\:ss"))); + NextBossTimeLabel.Content = Nduration.ToString(@"hh\:mm\:ss"); + + + //filter + try + { + BossesCollection.Clear(); + BossCollectionListBox.Items.Clear(); + } + catch (Exception) { } + string BossesList = File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/Bosses"); + string[] BossListSplited = BossesList.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); + foreach (string BossData in BossListSplited) + { + if (BossData != "") + { + BossesCollection.Add(BossData.Replace(Environment.NewLine, "")); + string bossName = BossData.Substring(0, BossData.IndexOf(",") + 1); + bossName = bossName.Replace(",", ""); + bossName = bossName.Replace(Environment.NewLine, ""); + BossCollectionListBox.Items.Add(bossName); + } + } + + PBImageBox.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/Boss.png")); + NBImageBox.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/Boss.png")); + LBImageBox.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/Boss.png")); + Getimg gm = new Getimg(); + + foreach (string item in BossesCollection) + { + string bossName = item.Substring(0, item.IndexOf(",") + 1); + bossName = bossName.Replace(",", ""); + bossName = bossName.Replace(Environment.NewLine, ""); + + if (PbossNamLabel.Content.ToString().Contains(bossName)) + { + string[] bossdata = item.Split(','); + string imgurl = bossdata[1].ToString(); + if (bossdata[5].ToString() != "") + { + imgurl = bossdata[5].ToString(); + if (imgurl.Contains("")) + { imgurl = imgurl.Replace("", System.IO.Directory.GetCurrentDirectory()); } + } + try { PBImageBox.Source = gm.GETIMAGE(imgurl); } catch (Exception) { } + if (PbossNamLabel.Content.ToString().Contains("&")) + { try { PBImageBox.Source = gm.GETIMAGE(System.IO.Directory.GetCurrentDirectory() + "/Resources/" + PbossNamLabel.Content.ToString() + ".png"); } catch (Exception) { } } + } + if (CbossNameLabel.Content.ToString().Contains(bossName)) + { + string[] bossdata = item.Split(','); + try + { + string imgurl = bossdata[1].ToString(); + if (bossdata[5].ToString() == "") + { + imgurl = bossdata[1].ToString(); + } + else + { + imgurl = bossdata[5].ToString(); + if (imgurl.Contains("")) + { imgurl = imgurl.Replace("", System.IO.Directory.GetCurrentDirectory()); } + } + publicNbossimage = bossdata[1].ToString(); + if (!CbossNameLabel.Content.ToString().Contains("&")) + { publicbossUrl = bossdata[2].ToString(); } + else + { + if (publicbossUrl == "") + { publicbossUrl = bossdata[2].ToString(); } + else + { publicbossUrl += " | " + bossdata[2].ToString(); } + } + NBImageBox.Source = gm.GETIMAGE(imgurl); + if (CbossNameLabel.Content.ToString().Contains("&")) + { try { NBImageBox.Source = gm.GETIMAGE(System.IO.Directory.GetCurrentDirectory() + "/Resources/" + CbossNameLabel.Content.ToString() + ".png"); } catch (Exception) { } } + //if (bossdata[3].ToString() != "") + //{ CbossNameLabel.Content = bossdata[3].ToString(); } + } + catch (Exception) { } + } + + if (cSecondboss.Contains(bossName) && CbossNameLabel.Content.ToString().Contains("&") && cSecondboss != "") + { + string[] bossdata = item.Split(','); + if (publicbossUrl == "") + { publicbossUrl = bossdata[2].ToString(); } + else + { publicbossUrl += "|" + bossdata[2].ToString(); } + } + if (NBossNameLabel.Content.ToString().Contains(bossName)) + { + string[] bossdata = item.Split(','); + string imgurl = bossdata[1].ToString(); + if (bossdata[5].ToString() != "") + { + imgurl = bossdata[5].ToString(); + if (imgurl.Contains("")) + { imgurl = imgurl.Replace("", System.IO.Directory.GetCurrentDirectory()); } + } + try { LBImageBox.Source = gm.GETIMAGE(imgurl); } catch (Exception) { } + if (NBossNameLabel.Content.ToString().Contains("&")) + { try { LBImageBox.Source = gm.GETIMAGE(System.IO.Directory.GetCurrentDirectory() + "/Resources/" + NBossNameLabel.Content.ToString() + ".png"); } catch (Exception) { } } + //if (bossdata[3].ToString() != "") + //{ NBossNameLabel.Content = bossdata[3].ToString(); } + } + + } + + if (PbossNamLabel.Content.ToString().Contains(" & ")) + { + string fullbossname = ""; + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = PbossNamLabel.Content.ToString(); + name = name.Substring(0, name.IndexOf("&")); + if (name.Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString() + " & "; + } + } + } + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = PbossNamLabel.Content.ToString(); + name = name.Substring(name.IndexOf("&") + 1); + if (name.Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString(); + } + } + } + if (fullbossname != "") + { PbossNamLabel.Content = fullbossname; } + + } + else + { + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + if (PbossNamLabel.Content.ToString().Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { PbossNamLabel.Content = bossdata[3].ToString(); } + } + + } + } + + if (CbossNameLabel.Content.ToString().Contains(" & ")) + { + string fullbossname = ""; + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = CbossNameLabel.Content.ToString(); + name = name.Substring(0, name.IndexOf("&")); + if (name.Contains(bossdata[0].ToString())) + { + currentbossrole1 = bossdata[4].ToString(); + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString() + " & "; + } + } + } + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = CbossNameLabel.Content.ToString(); + name = name.Substring(name.IndexOf("&") + 1); + if (name.Contains(bossdata[0].ToString())) + { + currentbossrole2 = bossdata[4].ToString(); + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString(); + } + } + } + if (fullbossname != "") + { CbossNameLabel.Content = fullbossname; } + } + else + { + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + if (CbossNameLabel.Content.ToString().Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { + currentbossrole1 = bossdata[4].ToString(); + CbossNameLabel.Content = bossdata[3].ToString(); + } + else + { + currentbossrole1 = bossdata[4].ToString(); + } + } + + } + } + if (NBossNameLabel.Content.ToString().Contains(" & ")) + { + string fullbossname = ""; + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = NBossNameLabel.Content.ToString(); + name = name.Substring(0, name.IndexOf("&")); + if (name.Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString() + " & "; + } + } + } + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + string name = NBossNameLabel.Content.ToString(); + name = name.Substring(name.IndexOf("&") + 1); + if (name.Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { + fullbossname += bossdata[3].ToString(); + } + } + } + if (fullbossname != "") + { NBossNameLabel.Content = fullbossname; } + } + else + { + foreach (string item in BossesCollection) + { + string[] bossdata = item.Split(','); + if (NBossNameLabel.Content.ToString().Contains(bossdata[0].ToString())) + { + if (bossdata[3].ToString() != "") + { NBossNameLabel.Content = bossdata[3].ToString(); } + } + + } + } + + + + TimeTable.AcceptChanges(); + gridview1.ItemsSource = TimeTable.DefaultView; + timer1.Start(); + } + + private void gridview1_CurrentCellChanged(object sender, EventArgs e) + { + //gridview1.SelectedIndex = -1; + } + private void gridview1_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) + { + try + { + //DataRowView dataRow = (DataRowView)gridview1.SelectedItem; + //int index = gridview1.CurrentCell.Column.DisplayIndex; + //string cellValue = dataRow.Row.ItemArray[index].ToString(); + DataRow dr = TimeTable.Rows[0]; + DataGridCellInfo cellInfo = gridview1.CurrentCell; + DataGridColumn column = cellInfo.Column; + gridview1Column = column.DisplayIndex; + gridview1Row = gridview1.SelectedIndex; + Console.WriteLine(gridview1Row); + string input = dr[gridview1Column].ToString(); + string Hours = input.Substring(0, input.IndexOf(":") + 0); + string Minutes = input.Substring(input.IndexOf(":") + 1); + TimeColumnHoursDropBox.Text = Hours; + TimeColumnMinutesDropBox.Text = Minutes; + //TimtableCellTextbox.Text = cellValue; + //TimtableCellTextbox.Text = "Column: " + gridview1.CurrentCell.Column.DisplayIndex.ToString() + "Row: " + gridview1.SelectedIndex.ToString(); + DataRow dr1 = TimeTable.Rows[gridview1Row]; + TimeTableBoss1DropBox.Text = "None"; + TimeTableBoss2DropBox.Text = "None"; + if (gridview1Row > 0) + { + if (dr1[gridview1Column].ToString().Contains(",")) + { + input = dr1[gridview1Column].ToString(); + string Boss1 = input.Substring(0, input.IndexOf(",") + 0); + string Boss2 = input.Substring(input.IndexOf(",") + 1); + Boss2 = Boss2.Replace(Environment.NewLine, ""); + TimeTableBoss1DropBox.Text = Boss1; + TimeTableBoss2DropBox.Text = Boss2; + } + else + { + if (dr1[gridview1Column].ToString() == "") + { TimeTableBoss1DropBox.Text = "None"; } + else + { TimeTableBoss1DropBox.Text = dr1[gridview1Column].ToString(); } + } + } + } + catch (Exception) { } + } + private void TimeColumnHoursDropBox_DropDownClosed(object sender, EventArgs e) + { + DataRow dr = TimeTable.Rows[0]; + dr[gridview1Column] = TimeColumnHoursDropBox.Text + ":" + TimeColumnMinutesDropBox.Text; + } + private void TimeColumnMinutesDropBox_DropDownClosed(object sender, EventArgs e) + { + DataRow dr = TimeTable.Rows[0]; + dr[gridview1Column] = TimeColumnHoursDropBox.Text + ":" + TimeColumnMinutesDropBox.Text; + } + private void TimeTableAddColumnButton_Click(object sender, RoutedEventArgs e) + { + DataRow dr = TimeTable.Rows[0]; + TimeTable.Columns.Add(""); + gridview1Column = TimeTable.Columns.Count - 1; + dr[gridview1Column] = "00:00"; + gridview1.ItemsSource = null; + TimeTable.AcceptChanges(); + gridview1.ItemsSource = TimeTable.DefaultView; + TimeColumnHoursDropBox.Text = "00"; + TimeColumnMinutesDropBox.Text = "00"; + gridview1.SelectedIndex = 0; + } + + private void TimeTableBoss1DropBox_DropDownClosed(object sender, EventArgs e) + { + if (TimeTableBoss1DropBox.Text == "None" && TimeTableBoss2DropBox.Text != "None") + { + TimeTableBoss1DropBox.Text = TimeTableBoss2DropBox.Text; + TimeTableBoss2DropBox.Text = "None"; + } + DataRow dr = TimeTable.Rows[gridview1Row]; + if (TimeTableBoss1DropBox.Text != "None") + { + if (TimeTableBoss2DropBox.Text == "None") + { dr[gridview1Column] = TimeTableBoss1DropBox.Text; } + else + { dr[gridview1Column] = TimeTableBoss1DropBox.Text + "," + Environment.NewLine + TimeTableBoss2DropBox.Text; } + } + else + { dr[gridview1Column] = ""; } + } + + private void TimeTableBoss2DropBox_DropDownClosed(object sender, EventArgs e) + { + if(TimeTableBoss1DropBox.Text == "None" && TimeTableBoss2DropBox.Text != "None") + { + TimeTableBoss1DropBox.Text = TimeTableBoss2DropBox.Text; + TimeTableBoss2DropBox.Text = "None"; + } + DataRow dr = TimeTable.Rows[gridview1Row]; + if (TimeTableBoss1DropBox.Text != "None") + { + if (TimeTableBoss2DropBox.Text == "None") + { dr[gridview1Column] = TimeTableBoss1DropBox.Text; } + else + { dr[gridview1Column] = TimeTableBoss1DropBox.Text + "," + Environment.NewLine + TimeTableBoss2DropBox.Text; } + } + else + { dr[gridview1Column] = ""; } + } + } +} + diff --git a/YPBBT/NewVersionLog_en b/YPBBT/NewVersionLog_en new file mode 100644 index 0000000..05ba3c3 --- /dev/null +++ b/YPBBT/NewVersionLog_en @@ -0,0 +1,6 @@ +New update 2.1a is Now Available: + +● Bugfix: single boss name role ping +● New update Alerts fix + +do you want to download latest update right now? \ No newline at end of file diff --git a/YPBBT/NewVersionLog_es b/YPBBT/NewVersionLog_es new file mode 100644 index 0000000..605af2d --- /dev/null +++ b/YPBBT/NewVersionLog_es @@ -0,0 +1,6 @@ +La nueva actualización 2.1a ya está disponible: + +● Corrección de errores: ping de rol de nombre de jefe único +● Nueva corrección de alertas de actualización + +¿Desea descargar la última actualización ahora? \ No newline at end of file diff --git a/YPBBT/NewVersionLog_fr b/YPBBT/NewVersionLog_fr new file mode 100644 index 0000000..071ff73 --- /dev/null +++ b/YPBBT/NewVersionLog_fr @@ -0,0 +1,6 @@ +La nouvelle mise à jour 2.1a est maintenant disponible: + +● Bugfix: ping de rôle de nom de patron unique +● Nouveau correctif d'alertes de mise à jour + +voulez-vous télécharger la dernière mise à jour maintenant? \ No newline at end of file diff --git a/YPBBT/NewVersionLog_jp b/YPBBT/NewVersionLog_jp new file mode 100644 index 0000000..45ac692 --- /dev/null +++ b/YPBBT/NewVersionLog_jp @@ -0,0 +1,6 @@ +新しいアップデート2.1aが利用可能になりました: + +●バグ修正:単一のボス名の役割のping +●新しい更新アラートの修正 + +今すぐ最新のアップデートをダウンロードしますか? \ No newline at end of file diff --git a/YPBBT/NewVersionLog_kr b/YPBBT/NewVersionLog_kr new file mode 100644 index 0000000..6aab33f --- /dev/null +++ b/YPBBT/NewVersionLog_kr @@ -0,0 +1,6 @@ +새로운 업데이트 2.1a가 출시되었습니다 : + +● 버그 픽스 : 싱글 보스 이름 역할 핑 +● 새로운 업데이트 알림 수정 + +최신 업데이트를 지금 다운로드 하시겠습니까? \ No newline at end of file diff --git a/YPBBT/NewVersionLog_ru b/YPBBT/NewVersionLog_ru new file mode 100644 index 0000000..3264aa1 --- /dev/null +++ b/YPBBT/NewVersionLog_ru @@ -0,0 +1,6 @@ +Новое обновление 2.1a теперь доступно: + +● Исправление: пинг роли имени одного босса +● Исправлено новое обновление оповещений + +Вы хотите загрузить последнее обновление прямо сейчас? \ No newline at end of file diff --git a/YPBBT/OverlayModWindow.xaml b/YPBBT/OverlayModWindow.xaml new file mode 100644 index 0000000..b616625 --- /dev/null +++ b/YPBBT/OverlayModWindow.xaml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/YPBBT/OverlayModWindow.xaml.cs b/YPBBT/OverlayModWindow.xaml.cs new file mode 100644 index 0000000..dd15b8d --- /dev/null +++ b/YPBBT/OverlayModWindow.xaml.cs @@ -0,0 +1,186 @@ +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.Animation; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; +using YPBBT.Properties; + +namespace YPBBT +{ + /// + /// Interaction logic for OverlayModWindow.xaml + /// + public partial class OverlayModWindow : Window + { + double io; + public OverlayModWindow() + { + InitializeComponent(); + if (Settings.Default["PlaySoundSetting"].ToString() == "") + { SoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["PlaySoundSetting"].ToString() == "1") + { SoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["PlaySoundSetting"].ToString() == "0") + { SoundOptionCheckBox.IsChecked = false; } + + if (Settings.Default["NTPlaySoundSetting"].ToString() == "") + { NTSoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["NTPlaySoundSetting"].ToString() == "1") + { NTSoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["NTPlaySoundSetting"].ToString() == "0") + { NTSoundOptionCheckBox.IsChecked = false; } + + if (Settings.Default["IRPlaySoundSetting"].ToString() == "") + { IRSoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["IRPlaySoundSetting"].ToString() == "1") + { IRSoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["IRPlaySoundSetting"].ToString() == "0") + { IRSoundOptionCheckBox.IsChecked = false; } + + if (Settings.Default["OverlayTransparency"].ToString() == "") + { + io= 1; + } + else + { io = double.Parse(Settings.Default["OverlayTransparency"].ToString()); } + //MessageBox.Show(this.Opacity.ToString()); + //MessageBox.Show(io.ToString()); + if (io == 0) + { io = 0.1; } + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = io; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + this.BeginAnimation(OpacityProperty, da); + Settings.Default.Save(); + + WindowOv.Left = 0; + WindowOv.Top = 0; + this.ShowInTaskbar = false; + WindowOv.Topmost = true; + } + public void load() + { + if (Settings.Default["PlaySoundSetting"].ToString() == "") + { SoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["PlaySoundSetting"].ToString() == "1") + { SoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["PlaySoundSetting"].ToString() == "0") + { SoundOptionCheckBox.IsChecked = false; } + + if (Settings.Default["NTPlaySoundSetting"].ToString() == "") + { NTSoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["NTPlaySoundSetting"].ToString() == "1") + { NTSoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["NTPlaySoundSetting"].ToString() == "0") + { NTSoundOptionCheckBox.IsChecked = false; } + + if (Settings.Default["IRPlaySoundSetting"].ToString() == "") + { IRSoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["IRPlaySoundSetting"].ToString() == "1") + { IRSoundOptionCheckBox.IsChecked = true; } + if (Settings.Default["IRPlaySoundSetting"].ToString() == "0") + { IRSoundOptionCheckBox.IsChecked = false; } + if (Settings.Default["OverlayTransparency"].ToString() == "") + { + io = 1; + } + else + { io = double.Parse(Settings.Default["OverlayTransparency"].ToString()); } + if(io == 0) + { io = 0.1; } + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = io; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + this.BeginAnimation(OpacityProperty, da); + + } + private void Window_MouseDown(object sender, MouseButtonEventArgs e) + { + try + { + if (e.ChangedButton == MouseButton.Left) + this.DragMove(); + } + catch (Exception) { } + } + public void UpdateData(string buttontext, BitmapImage img, string label1,string bossname,string bosstime,string label2,string nighttime,string label3,string IrTime,string label4,string bossSpawnCB,string NightTimecb,string ImperialResetCB) + { + exitButton.Content = buttontext; + BossImage.Source = img; + Label1.Content = label1; + BossNameLabel.Content = bossname; + BossTimeLabel.Content = bosstime; + Label2.Content = label2; + NightInBdoTimeLabel.Content = nighttime; + Label3.Content = label3; + IRTimeLabel.Content = IrTime; + Label4.Content = label4; + SoundOptionCheckBox.Content = bossSpawnCB; + NTSoundOptionCheckBox.Content = NightTimecb; + IRSoundOptionCheckBox.Content = ImperialResetCB; + } + + private void exitButton_Click(object sender, RoutedEventArgs e) + { + MainWindow nw = new MainWindow(1); + nw.GetOverlayState(0); + this.Visibility = Visibility.Hidden; + + } + + private void SoundOptionCheckBox_Click(object sender, RoutedEventArgs e) + { + if (SoundOptionCheckBox.IsChecked == true) + { + Settings.Default["PlaySoundSetting"] = "1"; + Settings.Default.Save(); + } + else + { + Settings.Default["PlaySoundSetting"] = "0"; + Settings.Default.Save(); + } + } + + private void NTSoundOptionCheckBox_Click(object sender, RoutedEventArgs e) + { + if (NTSoundOptionCheckBox.IsChecked == true) + { + Settings.Default["NTPlaySoundSetting"] = "1"; + Settings.Default.Save(); + } + else + { + Settings.Default["NTPlaySoundSetting"] = "0"; + Settings.Default.Save(); + } + } + + private void IRSoundOptionCheckBox_Click(object sender, RoutedEventArgs e) + { + if (IRSoundOptionCheckBox.IsChecked == true) + { + Settings.Default["IRPlaySoundSetting"] = "1"; + Settings.Default.Save(); + } + else + { + Settings.Default["IRPlaySoundSetting"] = "0"; + Settings.Default.Save(); + } + } + } +} diff --git a/YPBBT/Properties/AssemblyInfo.cs b/YPBBT/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..9c96347 --- /dev/null +++ b/YPBBT/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("YPBBT")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Luame")] +[assembly: AssemblyProduct("YPBBT")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// 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("3.1.3.2")] +[assembly: AssemblyFileVersion("3.0.0.0")] diff --git a/YPBBT/Properties/Resources.Designer.cs b/YPBBT/Properties/Resources.Designer.cs new file mode 100644 index 0000000..4fe2c4b --- /dev/null +++ b/YPBBT/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace YPBBT.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("YPBBT.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/YPBBT/Properties/Resources.resx b/YPBBT/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/YPBBT/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/YPBBT/Properties/Settings.Designer.cs b/YPBBT/Properties/Settings.Designer.cs new file mode 100644 index 0000000..a2ccbca --- /dev/null +++ b/YPBBT/Properties/Settings.Designer.cs @@ -0,0 +1,590 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace YPBBT.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string DefaultRegion { + get { + return ((string)(this["DefaultRegion"])); + } + set { + this["DefaultRegion"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string BossSpawnAlarmCheckBox { + get { + return ((string)(this["BossSpawnAlarmCheckBox"])); + } + set { + this["BossSpawnAlarmCheckBox"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string NightTimeAlarmCheckBox { + get { + return ((string)(this["NightTimeAlarmCheckBox"])); + } + set { + this["NightTimeAlarmCheckBox"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string ImperialResetCheckBox { + get { + return ((string)(this["ImperialResetCheckBox"])); + } + set { + this["ImperialResetCheckBox"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string PlaySoundSetting { + get { + return ((string)(this["PlaySoundSetting"])); + } + set { + this["PlaySoundSetting"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string OverlayTransparency { + get { + return ((string)(this["OverlayTransparency"])); + } + set { + this["OverlayTransparency"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string OverlayState { + get { + return ((string)(this["OverlayState"])); + } + set { + this["OverlayState"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string NTPlaySoundSetting { + get { + return ((string)(this["NTPlaySoundSetting"])); + } + set { + this["NTPlaySoundSetting"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string IRPlaySoundSetting { + get { + return ((string)(this["IRPlaySoundSetting"])); + } + set { + this["IRPlaySoundSetting"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string DisplayTimeTableSetting { + get { + return ((string)(this["DisplayTimeTableSetting"])); + } + set { + this["DisplayTimeTableSetting"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string BSA1CM { + get { + return ((string)(this["BSA1CM"])); + } + set { + this["BSA1CM"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string BSA2CM { + get { + return ((string)(this["BSA2CM"])); + } + set { + this["BSA2CM"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string BSA3CM { + get { + return ((string)(this["BSA3CM"])); + } + set { + this["BSA3CM"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string NTA1CM { + get { + return ((string)(this["NTA1CM"])); + } + set { + this["NTA1CM"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string NTA2CM { + get { + return ((string)(this["NTA2CM"])); + } + set { + this["NTA2CM"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string NTA3CM { + get { + return ((string)(this["NTA3CM"])); + } + set { + this["NTA3CM"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string IRA1CM { + get { + return ((string)(this["IRA1CM"])); + } + set { + this["IRA1CM"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string IRA2CM { + get { + return ((string)(this["IRA2CM"])); + } + set { + this["IRA2CM"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string IRA3CM { + get { + return ((string)(this["IRA3CM"])); + } + set { + this["IRA3CM"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string EditSpawnHoursSlider { + get { + return ((string)(this["EditSpawnHoursSlider"])); + } + set { + this["EditSpawnHoursSlider"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string SettingKeepMessages { + get { + return ((string)(this["SettingKeepMessages"])); + } + set { + this["SettingKeepMessages"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string AlarmonhoursCheckbox { + get { + return ((string)(this["AlarmonhoursCheckbox"])); + } + set { + this["AlarmonhoursCheckbox"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string BRAlarmCheckBox { + get { + return ((string)(this["BRAlarmCheckBox"])); + } + set { + this["BRAlarmCheckBox"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string ITRAlarmCheckBox { + get { + return ((string)(this["ITRAlarmCheckBox"])); + } + set { + this["ITRAlarmCheckBox"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string ITRA1CM { + get { + return ((string)(this["ITRA1CM"])); + } + set { + this["ITRA1CM"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string ITRA2CM { + get { + return ((string)(this["ITRA2CM"])); + } + set { + this["ITRA2CM"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string ITRA3CM { + get { + return ((string)(this["ITRA3CM"])); + } + set { + this["ITRA3CM"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string BRA1CM { + get { + return ((string)(this["BRA1CM"])); + } + set { + this["BRA1CM"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string BRA2CM { + get { + return ((string)(this["BRA2CM"])); + } + set { + this["BRA2CM"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string BRA3CM { + get { + return ((string)(this["BRA3CM"])); + } + set { + this["BRA3CM"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string SelectedSource { + get { + return ((string)(this["SelectedSource"])); + } + set { + this["SelectedSource"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string DefaultRegion1 { + get { + return ((string)(this["DefaultRegion1"])); + } + set { + this["DefaultRegion1"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string MainColor { + get { + return ((string)(this["MainColor"])); + } + set { + this["MainColor"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string SubColor { + get { + return ((string)(this["SubColor"])); + } + set { + this["SubColor"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string HeaderColor { + get { + return ((string)(this["HeaderColor"])); + } + set { + this["HeaderColor"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string OriginBossList { + get { + return ((string)(this["OriginBossList"])); + } + set { + this["OriginBossList"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string AnimatedBackgroundSource { + get { + return ((string)(this["AnimatedBackgroundSource"])); + } + set { + this["AnimatedBackgroundSource"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string AnimatedBackgroundCheckbox { + get { + return ((string)(this["AnimatedBackgroundCheckbox"])); + } + set { + this["AnimatedBackgroundCheckbox"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string BackgroundImageSource { + get { + return ((string)(this["BackgroundImageSource"])); + } + set { + this["BackgroundImageSource"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string BackgroundImageCheckbox { + get { + return ((string)(this["BackgroundImageCheckbox"])); + } + set { + this["BackgroundImageCheckbox"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string BRPlaySoundSetting { + get { + return ((string)(this["BRPlaySoundSetting"])); + } + set { + this["BRPlaySoundSetting"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string ITRPlaySoundSetting { + get { + return ((string)(this["ITRPlaySoundSetting"])); + } + set { + this["ITRPlaySoundSetting"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string Overlay_Position { + get { + return ((string)(this["Overlay_Position"])); + } + set { + this["Overlay_Position"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string High_RenderQuality { + get { + return ((string)(this["High_RenderQuality"])); + } + set { + this["High_RenderQuality"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string ScarletMode { + get { + return ((string)(this["ScarletMode"])); + } + set { + this["ScarletMode"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string SelfRolling { + get { + return ((string)(this["SelfRolling"])); + } + set { + this["SelfRolling"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string AutoUpdateTable { + get { + return ((string)(this["AutoUpdateTable"])); + } + set { + this["AutoUpdateTable"] = value; + } + } + } +} diff --git a/YPBBT/Properties/Settings.settings b/YPBBT/Properties/Settings.settings new file mode 100644 index 0000000..30c9c84 --- /dev/null +++ b/YPBBT/Properties/Settings.settings @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/YPBBT/Resources/2020-08-06 03_45_25-.png b/YPBBT/Resources/2020-08-06 03_45_25-.png new file mode 100644 index 0000000..8da9211 Binary files /dev/null and b/YPBBT/Resources/2020-08-06 03_45_25-.png differ diff --git a/YPBBT/Resources/BasicTemp.psd b/YPBBT/Resources/BasicTemp.psd new file mode 100644 index 0000000..204cca1 Binary files /dev/null and b/YPBBT/Resources/BasicTemp.psd differ diff --git a/YPBBT/Resources/Boss.png b/YPBBT/Resources/Boss.png new file mode 100644 index 0000000..3111b49 Binary files /dev/null and b/YPBBT/Resources/Boss.png differ diff --git a/YPBBT/Resources/BossListLogo.png b/YPBBT/Resources/BossListLogo.png new file mode 100644 index 0000000..24fab39 Binary files /dev/null and b/YPBBT/Resources/BossListLogo.png differ diff --git a/YPBBT/Resources/BossSpawnAlert.wav b/YPBBT/Resources/BossSpawnAlert.wav new file mode 100644 index 0000000..1cce3ca Binary files /dev/null and b/YPBBT/Resources/BossSpawnAlert.wav differ diff --git a/YPBBT/Resources/Bosses b/YPBBT/Resources/Bosses new file mode 100644 index 0000000..2a26c65 --- /dev/null +++ b/YPBBT/Resources/Bosses @@ -0,0 +1,20 @@ +Kzarka,/Resources/Kzarka.png,http://www.somethinglovely.net/bdo/#worldbosses/kzarka,, +Nouver,/Resources/Nouver.png,http://www.somethinglovely.net/bdo/#worldbosses/nouver,, +Karanda,/Resources/Karanda.png,http://www.somethinglovely.net/bdo/#worldbosses/karanda,, +Kutum,/Resources/Kutum.png,http://www.somethinglovely.net/bdo/#worldbosses/ancient-kutum,, +Offin,/Resources/Offin.png,http://www.somethinglovely.net/bdo/#worldbosses/offin-tett,, +Garmoth,/Resources/Garmoth.png,http://www.somethinglovely.net/bdo/#worldbosses/garmoth,, +Quint,/Resources/Quint.png,http://www.somethinglovely.net/bdo/#worldbosses/quint,, +Muraka,/Resources/Muraka.png,http://www.somethinglovely.net/bdo/#worldbosses/muraka,, +Vell,/Resources/Vell.png,http://www.somethinglovely.net/bdo/#worldbosses/vell,, +Karanda & Nouver,/Resources/Karanda & Nouver.png,http://www.somethinglovely.net/bdo/#worldbosses/karanda|http://www.somethinglovely.net/bdo/#worldbosses/nouver,, +Kutum & Nouver,/Resources/Kutum & Nouver.png,http://www.somethinglovely.net/bdo/#worldbosses/ancient-kutum|http://www.somethinglovely.net/bdo/#worldbosses/nouver,, +Kzarka & Nouver,/Resources/Kzarka & Nouver.png,http://www.somethinglovely.net/bdo/#worldbosses/kzarka|http://www.somethinglovely.net/bdo/#worldbosses/nouver,, +Kzarka & Karanda,/Resources/Kzarka & Karanda.png,http://www.somethinglovely.net/bdo/#worldbosses/kzarka|http://www.somethinglovely.net/bdo/#worldbosses/karanda,, +Kutum & Karanda,/Resources/Kutum & Karanda.png,http://www.somethinglovely.net/bdo/#worldbosses/ancient-kutum|http://www.somethinglovely.net/bdo/#worldbosses/karanda,, +Kutum & Kzarka,/Resources/Kutum & Kzarka.png,http://www.somethinglovely.net/bdo/#worldbosses/ancient-kutum|http://www.somethinglovely.net/bdo/#worldbosses/kzarka,, +Quint & Muraka,/Resources/Quint & Muraka.png,http://www.somethinglovely.net/bdo/#worldbosses/quint|http://www.somethinglovely.net/bdo/#worldbosses/muraka,, +Nouver & Kutum,/Resources/Kutum & Nouver.png,http://www.somethinglovely.net/bdo/#worldbosses/nouver|http://www.somethinglovely.net/bdo/#worldbosses/ancient-kutum,, +Karanda & Kzarka,/Resources/Kzarka & Karanda.png,http://www.somethinglovely.net/bdo/#worldbosses/karanda|http://www.somethinglovely.net/bdo/#worldbosses/kzarka,, +Nouver & Karanda,/Resources/Karanda & Nouver.png,http://www.somethinglovely.net/bdo/#worldbosses/nouver|http://www.somethinglovely.net/bdo/#worldbosses/karanda,, +Karanda & Kutum,/Resources/Kutum & Karanda.png,http://www.somethinglovely.net/bdo/#worldbosses/karanda|http://www.somethinglovely.net/bdo/#worldbosses/ancient-kutum,, diff --git a/YPBBT/Resources/BossesOrigin b/YPBBT/Resources/BossesOrigin new file mode 100644 index 0000000..2a26c65 --- /dev/null +++ b/YPBBT/Resources/BossesOrigin @@ -0,0 +1,20 @@ +Kzarka,/Resources/Kzarka.png,http://www.somethinglovely.net/bdo/#worldbosses/kzarka,, +Nouver,/Resources/Nouver.png,http://www.somethinglovely.net/bdo/#worldbosses/nouver,, +Karanda,/Resources/Karanda.png,http://www.somethinglovely.net/bdo/#worldbosses/karanda,, +Kutum,/Resources/Kutum.png,http://www.somethinglovely.net/bdo/#worldbosses/ancient-kutum,, +Offin,/Resources/Offin.png,http://www.somethinglovely.net/bdo/#worldbosses/offin-tett,, +Garmoth,/Resources/Garmoth.png,http://www.somethinglovely.net/bdo/#worldbosses/garmoth,, +Quint,/Resources/Quint.png,http://www.somethinglovely.net/bdo/#worldbosses/quint,, +Muraka,/Resources/Muraka.png,http://www.somethinglovely.net/bdo/#worldbosses/muraka,, +Vell,/Resources/Vell.png,http://www.somethinglovely.net/bdo/#worldbosses/vell,, +Karanda & Nouver,/Resources/Karanda & Nouver.png,http://www.somethinglovely.net/bdo/#worldbosses/karanda|http://www.somethinglovely.net/bdo/#worldbosses/nouver,, +Kutum & Nouver,/Resources/Kutum & Nouver.png,http://www.somethinglovely.net/bdo/#worldbosses/ancient-kutum|http://www.somethinglovely.net/bdo/#worldbosses/nouver,, +Kzarka & Nouver,/Resources/Kzarka & Nouver.png,http://www.somethinglovely.net/bdo/#worldbosses/kzarka|http://www.somethinglovely.net/bdo/#worldbosses/nouver,, +Kzarka & Karanda,/Resources/Kzarka & Karanda.png,http://www.somethinglovely.net/bdo/#worldbosses/kzarka|http://www.somethinglovely.net/bdo/#worldbosses/karanda,, +Kutum & Karanda,/Resources/Kutum & Karanda.png,http://www.somethinglovely.net/bdo/#worldbosses/ancient-kutum|http://www.somethinglovely.net/bdo/#worldbosses/karanda,, +Kutum & Kzarka,/Resources/Kutum & Kzarka.png,http://www.somethinglovely.net/bdo/#worldbosses/ancient-kutum|http://www.somethinglovely.net/bdo/#worldbosses/kzarka,, +Quint & Muraka,/Resources/Quint & Muraka.png,http://www.somethinglovely.net/bdo/#worldbosses/quint|http://www.somethinglovely.net/bdo/#worldbosses/muraka,, +Nouver & Kutum,/Resources/Kutum & Nouver.png,http://www.somethinglovely.net/bdo/#worldbosses/nouver|http://www.somethinglovely.net/bdo/#worldbosses/ancient-kutum,, +Karanda & Kzarka,/Resources/Kzarka & Karanda.png,http://www.somethinglovely.net/bdo/#worldbosses/karanda|http://www.somethinglovely.net/bdo/#worldbosses/kzarka,, +Nouver & Karanda,/Resources/Karanda & Nouver.png,http://www.somethinglovely.net/bdo/#worldbosses/nouver|http://www.somethinglovely.net/bdo/#worldbosses/karanda,, +Karanda & Kutum,/Resources/Kutum & Karanda.png,http://www.somethinglovely.net/bdo/#worldbosses/karanda|http://www.somethinglovely.net/bdo/#worldbosses/ancient-kutum,, diff --git a/YPBBT/Resources/ChannelID.mp4 b/YPBBT/Resources/ChannelID.mp4 new file mode 100644 index 0000000..3d4d664 Binary files /dev/null and b/YPBBT/Resources/ChannelID.mp4 differ diff --git a/YPBBT/Resources/ConvertRole.mp4 b/YPBBT/Resources/ConvertRole.mp4 new file mode 100644 index 0000000..ae9e985 Binary files /dev/null and b/YPBBT/Resources/ConvertRole.mp4 differ diff --git a/YPBBT/Resources/Disclogo.png b/YPBBT/Resources/Disclogo.png new file mode 100644 index 0000000..03f9a63 Binary files /dev/null and b/YPBBT/Resources/Disclogo.png differ diff --git a/YPBBT/Resources/EditDiscord.png b/YPBBT/Resources/EditDiscord.png new file mode 100644 index 0000000..1e64a90 Binary files /dev/null and b/YPBBT/Resources/EditDiscord.png differ diff --git a/YPBBT/Resources/Garmoth.png b/YPBBT/Resources/Garmoth.png new file mode 100644 index 0000000..334e87d Binary files /dev/null and b/YPBBT/Resources/Garmoth.png differ diff --git a/YPBBT/Resources/Github.png b/YPBBT/Resources/Github.png new file mode 100644 index 0000000..6812fea Binary files /dev/null and b/YPBBT/Resources/Github.png differ diff --git a/YPBBT/Resources/HomeButtonlogo.png b/YPBBT/Resources/HomeButtonlogo.png new file mode 100644 index 0000000..beed6a8 Binary files /dev/null and b/YPBBT/Resources/HomeButtonlogo.png differ diff --git a/YPBBT/Resources/ImperialResetAlert.wav b/YPBBT/Resources/ImperialResetAlert.wav new file mode 100644 index 0000000..cb2932f Binary files /dev/null and b/YPBBT/Resources/ImperialResetAlert.wav differ diff --git a/YPBBT/Resources/Karanda & Nouver.png b/YPBBT/Resources/Karanda & Nouver.png new file mode 100644 index 0000000..90b8987 Binary files /dev/null and b/YPBBT/Resources/Karanda & Nouver.png differ diff --git a/YPBBT/Resources/Karanda.png b/YPBBT/Resources/Karanda.png new file mode 100644 index 0000000..91adaa8 Binary files /dev/null and b/YPBBT/Resources/Karanda.png differ diff --git a/YPBBT/Resources/Kazarka & Nouver.png b/YPBBT/Resources/Kazarka & Nouver.png new file mode 100644 index 0000000..615c0f4 Binary files /dev/null and b/YPBBT/Resources/Kazarka & Nouver.png differ diff --git a/YPBBT/Resources/Kutum & Karanda.png b/YPBBT/Resources/Kutum & Karanda.png new file mode 100644 index 0000000..8f1b616 Binary files /dev/null and b/YPBBT/Resources/Kutum & Karanda.png differ diff --git a/YPBBT/Resources/Kutum & Kzarka.png b/YPBBT/Resources/Kutum & Kzarka.png new file mode 100644 index 0000000..33d535e Binary files /dev/null and b/YPBBT/Resources/Kutum & Kzarka.png differ diff --git a/YPBBT/Resources/Kutum & Nouver.png b/YPBBT/Resources/Kutum & Nouver.png new file mode 100644 index 0000000..4d5a57b Binary files /dev/null and b/YPBBT/Resources/Kutum & Nouver.png differ diff --git a/YPBBT/Resources/Kutum.png b/YPBBT/Resources/Kutum.png new file mode 100644 index 0000000..8d8aa34 Binary files /dev/null and b/YPBBT/Resources/Kutum.png differ diff --git a/YPBBT/Resources/Kzarka & Karanda.png b/YPBBT/Resources/Kzarka & Karanda.png new file mode 100644 index 0000000..633dec4 Binary files /dev/null and b/YPBBT/Resources/Kzarka & Karanda.png differ diff --git a/YPBBT/Resources/Kzarka & Nouver.png b/YPBBT/Resources/Kzarka & Nouver.png new file mode 100644 index 0000000..369f64f Binary files /dev/null and b/YPBBT/Resources/Kzarka & Nouver.png differ diff --git a/YPBBT/Resources/Kzarka.png b/YPBBT/Resources/Kzarka.png new file mode 100644 index 0000000..232cde3 Binary files /dev/null and b/YPBBT/Resources/Kzarka.png differ diff --git a/YPBBT/Resources/LYPBBTTT b/YPBBT/Resources/LYPBBTTT new file mode 100644 index 0000000..46056c7 --- /dev/null +++ b/YPBBT/Resources/LYPBBTTT @@ -0,0 +1,130 @@ +[PS4-ASIA] +00:30|01:00|11:00|14:00|16:00|17:00|18:00|19:00|20:00|23:30 +||Kzarka,Nouver||||Karanda,Kutum|Offin|Kzarka,Nouver|Karanda,Kutum +||Karanda,Kutum||||Kzarka,Nouver||Karanda,Kutum|Kzarka,Nouver +||Kzarka,Nouver||||Karanda,Kutum||Kzarka,Nouver|Karanda,Kutum +|Quint,Muraka|Karanda,Kutum||||Kzarka,Nouver||Karanda,Kutum|Kzarka,Nouver +||Kzarka,Nouver||||Karanda,Kutum||Kzarka,Nouver|Karanda,Kutum +Offin||Kzarka,Nouver||Karanda,Kutum|Quint,Muraka||Kzarka,Nouver|| +Karanda,Kutum||Karanda,Kutum|Offin|Kzarka,Nouver||||Karanda,Kutum|Kzarka,Nouver +[/PS4-ASIA] +[EU] +00:15|02:00|05:00|09:00|12:00|16:00|19:00|22:15|23:15 +Karanda,Kutum|Karanda|Kzarka|Kzarka|Offin|Kutum|Nouver|Kzarka| +Karanda|Kutum|Kzarka|Nouver|Kutum|Nouver|Karanda|Garmoth| +Kutum,Kzarka|Karanda|Kzarka|Karanda||Kutum,Offin|Vell|Karanda,Kzarka|Quint,Muraka +Nouver|Kutum|Nouver|Kutum|Nouver|Kzarka|Kutum|Garmoth| +Kzarka,Karanda|Nouver|Karanda|Kutum|Karanda|Nouver|Kzarka|Kutum,Kzarka| +Karanda|Offin|Nouver|Kutum|Nouver|Quint,Muraka|Karanda,Kzarka|| +Nouver,Kutum|Kzarka|Kutum|Nouver|Kzarka|Vell|Garmoth|Kzarka,Nouver| +[/EU] +[PS4-XBOX-EU] +00:00|08:00|12:00|14:00|15:00|16:00|17:00|18:00|21:15|22:00|23:15 +|Kzarka,Nouver|||||Offin|Karanda,Kutum|Kzarka,Nouver|| +Karanda,Kutum|Karanda,Kutum||||||Kzarka,Nouver|Karanda,Kutum|| +Kzarka,Nouver|Kzarka,Nouver||||||Karanda,Kutum|Kzarka,Nouver|Quint,Muraka| +Karanda,Kutum|Karanda,Kutum||||||Kzarka,Nouver|Karanda,Kutum|| +Kzarka,Nouver|Kzarka,Nouver||||||Karanda,Kutum|Kzarka,Nouver|Offin| +Karanda,Kutum||Kzarka,Nouver||Karanda,Kutum|Quint,Muraka||Kzarka,Nouver|||Karanda,Kutum +||Karanda,Kutum|Offin|Kzarka,Nouver|||Karanda,Kutum|Kzarka,Nouver|| +[/PS4-XBOX-EU] +[JP] +01:30|11:00|14:00|16:00|19:00|22:30|23:00 +Kzarka,Nouver|Kzarka||Kutum,Kzarka|Karanda,Nouver||Karanda,Kutum +Kzarka,Nouver|Kzarka||Kutum,Kzarka|Kutum,Nouver||Karanda,Nouver +Kzarka,Nouver|||Kutum,Nouver|Kzarka,Karanda||Garmoth +Kzarka,Karanda|Kzarka||Kutum,Nouver|Kutum,Nouver||Vell +Kzarka,Karanda|Nouver||Kutum,Nouver|Quint,Muraka||Karanda,Kutum +Offin|Nouver,Kzarka|Offin|Karanda,Kutum|Kzarka,Karanda|| +Garmoth|Karanda,Kutum|Vell|Karanda,Kutum|Garmoth|Quint,Muraka|Offin +[/JP] +[KR] +00:15|02:00|11:00|16:00|17:00|19:00|20:00|23:15|23:45 +|Kzarka|Kzarka,Nouver|Kzarka,Kutum|||Karanda,Nouver||Offin +|Kzarka|Kzarka,Kutum|Kzarka,Nouver|||Karanda,Kutum||Garmoth +|Nouver,Offin||Kzarka,Nouver|||Karanda,Kzarka|Quint,Muraka| +Vell|Kutum|Kzarka,Nouver|Karanda,Kutum|||Nouver,Kutum||Garmoth +|Karanda|Kzarka,Kutum|Karanda,Nouver|||Kzarka,Kutum||Offin +|Karanda,Nouver|Nouver,Kutum|Karanda,Kzarka||Quint,Muraka||| +Garmoth|Karanda,Kutum|Kzarka,Nouver|Karanda,Kutum|Vell||Nouver,Kutum||Karanda +[/KR] +[MENA] +01:00|11:00|16:00|18:00|19:00|20:00|23:15 +Kzarka|Kzarka,Nouver|Kzarka,Kutum|||Karanda,Nouver|Offin +Kutum|Kzarka,Kutum|Karanda,Nouver|||Quint,Muraka|Garmoth +Karanda|Nouver,Kutum|Kzarka,Nouver|||Karanda,Kzarka|Offin +Kzarka|Kzarka,Nouver|Karanda,Kutum|||Nouver,Kutum|Garmoth +Nouver|Kzarka,Kutum|Nouver|||Kzarka,Kutum|Offin +Karanda|Nouver,Kutum|Karanda,Kzarka||Quint,Muraka|| +Karanda|Kzarka,Nouver|Karanda,Kutum|Vell||Nouver,Kutum|Garmoth +[/MENA] +[NA] +00:00|03:00|07:00|10:00|14:00|17:00|20:15|21:15|22:15 +Karanda|Kzarka|Kzarka|Offin|Kutum|Nouver|Kzarka||Karanda +Kutum|Kzarka|Nouver|Kutum|Nouver|Karanda|Garmoth||Kutum,Kzarka +Karanda||Karanda|Nouver|Kutum,Offin|Vell|Karanda,Kzarka|Quint,Muraka|Nouver +Kutum|Kzarka|Kutum|Nouver|Kzarka|Kutum|Garmoth||Kzarka,Karanda +Nouver|Karanda|Kutum|Karanda|Nouver|Kzarka|Kutum,Kzarka||Karanda +Offin|Nouver|Kutum|Nouver|Quint,Muraka|Kzarka,Karanda|||Nouver,Kutum +Kzarka|Kutum|Nouver|Kzarka|Vell|Garmoth|Kzarka,Nouver||Karanda,Kutum +[/NA] +[PS4-XBOX-NA] +07:00|11:00|13:00|14:00|15:00|16:00|17:00|20:15|21:00|22:15|23:00 +Kzarka,Nouver|||||Offin|Karanda,Kutum|Kzarka,Nouver|||Karanda,Kutum +Karanda,Kutum||||||Kzarka,Nouver|Karanda,Kutum|||Kzarka,Nouver +Kzarka,Nouver||||||Karanda,Kutum|Kzarka,Nouver|Quint,Muraka||Karanda,Kutum +Karanda,Kutum||||||Kzarka,Nouver|Karanda,Kutum|||Kzarka,Nouver +Kzarka,Nouver||||||Karanda,Kutum|Kzarka,Nouver|Offin||Karanda,Kutum +|Kzarka,Nouver||Karanda,Kutum|Quint,Muraka||Kzarka,Nouver|||Karanda,Kutum| +|Karanda,Kutum|Offin|Kzarka,Nouver|||Karanda,Kutum|Kzarka,Nouver||| +[/PS4-XBOX-NA] +[RU] +00:00|01:00|08:00|10:00|12:00|14:00|16:00|18:00|23:00 +Karanda,Kzarka|Nouver|||Kutum|Nouver|Karanda|Kutum|Nouver,Karanda +Kzarka|Karanda|||Karanda|Kzarka|Kutum|Karanda|Quint,Muraka +Kutum|Nouver||||Karanda|Nouver|Kzarka,Offin|Vell +Karanda|Kutum|||Nouver|Kutum|Nouver|Kzarka|Garmoth +Nouver|Kzarka|||Karanda|Kutum|Nouver|Kzarka|Offin +Nouver,Kzarka|Kutum|Kzarka|Nouver|Kutum|Quint,Muraka|Karanda|Kutum| +Garmoth|Kzarka|Karanda|Kutum|Garmoth|Kutum|Vell|Nouver,Kzarka|Offin +[/RU] +[SA] +02:00|11:00|16:00|18:00|20:00|23:30 +Karanda,Kzarka|Nouver|Kutum,Kzarka||Nouver,Kutum|Garmoth +Kutum|Kzarka|Nouver,Kutum||Karanda,Kzarka|Offin +Kzarka|Karanda,Kutum|Kzarka,Nouver||Quint,Muraka|Garmoth +Karanda,Kutum|Nouver,Karanda|Kutum,Kzarka||Nouver,Kutum|Vell +Karanda,Offin|Nouver|Kutum,Kzarka||Nouver,Kzarka|Garmoth +Kzarka|Kzarka,Karanda|Nouver,Kutum||Quint,Muraka| +Nouver|Nouver,Kutum|Karanda,Kzarka|Vell|Karanda,Nouver|Offin +[/SA] +[SEA] +00:00|01:30|11:00|15:00|16:00|20:00 +Kutum,Nouver|Kutum|Kzarka,Nouver|Kutum,Nouver||Kzarka,Karanda +Offin|Nouver|Kutum,Karanda|Kutum,Kzarka||Quint,Muraka +Garmoth|Kzarka|Nouver,Kutum|Karanda,Kzarka||Kutum,Nouver +Offin|Kutum|Karanda,Kzarka|Kutum,Nouver||Karanda,Nouver +Garmoth|Nouver|Kutum,Kzarka|Karanda,Kzarka||Nouver,Kutum +Offin|Karanda|Kutum,Kzarka|Karanda,Nouver|Garmoth|Quint,Muraka +|Kzarka|Nouver,Karanda|Kutum,Karanda|Vell|Karanda,Kzarka +[/SEA] +[TH] +00:30|10:00|14:00|15:00|19:00|23:00 +Kutum|Kzarka,Nouver|Kutum,Nouver||Kzarka,Karanda|Offin +Nouver|Kutum,Karanda|Kutum,Kzarka||Quint,Muraka|Garmoth +Kzarka|Kutum,Nouver|Karanda,Kzarka||Kutum,Nouver|Offin +Kutum|Karanda,Kzarka|Kutum,Nouver||Nouver,Karanda|Garmoth +Nouver|Kutum,Kzarka|Karanda,Kzarka||Kutum,Nouver|Offin +Karanda|Kutum,Kzarka|Karanda,Nouver|Garmoth|Quint,Muraka| +Kzarka|Nouver,Karanda|Kutum,Karanda|Vell|Kzarka,Karanda|Kutum,Nouver +[/TH] +[TW] +00:15|02:00|11:00|15:00|19:00|23:30 +Quint,Muraka|Kzarka,Kutum|Karanda|Kzarka,Kutum|Garmoth|Kzarka,Kutum +|Nouver|Kzarka,Kutum|Karanda,Nouver|Vell|Kzarka,Nouver +|Karanda|Kzarka,Nouver|Garmoth|Kzarka,Kutum|Nouver,Karanda +|Kutum|Karanda,Kutum|Kzarka,Nouver|Nouver|Karanda,Kutum +|Kzarka,Nouver|Offin,Kutum|Nouver,Karanda|Kzarka,Kutum|Quint,Muraka +Garmoth|Kzarka,Kutum|Karanda,Kutum|Offin|Kzarka,Nouver| +|Karanda,Nouver|Kzarka,Nouver|Vell|Karanda,Kutum|Offin +[/TW] \ No newline at end of file diff --git a/YPBBT/Resources/Languages/en b/YPBBT/Resources/Languages/en new file mode 100644 index 0000000..73e5715 --- /dev/null +++ b/YPBBT/Resources/Languages/en @@ -0,0 +1,19 @@ +● Welcome to yuri project bdo boss Timer here well help you + setup your bot step by step. + +- If you allready have Bot setup you can click Skip to start filling + the Required information + +- If u never made bot before click next and well walk you through + it and make it as easy as possible for you ^^ | Skip| Next | Step 1 | 1.1 - you will need To go to discord Developer To create the Bot +you can go there by Clicking Below | Click Me | 1.2 - Login then Click on New Application and give your Bot a +name and Then click Create like so if u cant find the button +click Below to show you | Show Me | Next | Step 2 | - in this Step you well need to Create the Bot And its Token +you can do that by clicking on Bot Button then click on +Add Bot if u having issue finding the buttons click below | Help | Next | Step 3 | - This step you well need to invite the Bot to your Discord Server + all u need to do is just put the Bot Client ID in the Box Below + then click on Invite Button to invite the Bot to Your Discord | Invite | NOTE:: if u cant find the client id Click Below | Help Can't Find The Client ID | Next | Step 4 | - Now you well need the bot token paste it in the box below + then click test to check if the token is correct | Test Token | NOTE:: if u cant find the Token Click Below | Help Cant Find The Token | Next | Step 5 | - Now you well need the to set the Server ID and the channel ID + where the bot well post its notification and set the role you want + your members to be pinged whit | NOTE:: For the Role you well need to convert the role +and dont forget to give the Bot admin privilege | Next | Final Step | - Your all done now if u have any problem or have any questions join our discord and we'll try our best to help Enjoy c: | \ No newline at end of file diff --git a/YPBBT/Resources/Languages/en-m b/YPBBT/Resources/Languages/en-m new file mode 100644 index 0000000..94dab7e --- /dev/null +++ b/YPBBT/Resources/Languages/en-m @@ -0,0 +1,7 @@ +Time Table | Bosses List | Settings | Source: | Send to tray | Restart | Start | Invite | Disconnect | Bot Status: |Region: | Previous boss | Next boss | Followed by | Disconnected | Sound: | Boss Spawn +Alarm: | Alarm 1 | Alarm 2 | Play Sound on: | Alarm 3 | Boss Spawn | Night Time + Alarm: | Night Time | Imperial Reset | Alarm 1 | Post Settings: | Alarm 2 | Display Time Table | Alarm 3 | Imperial Reset + Alarm: | Night in: | Imperial reset in: | Alarm 1 | Alarm 2 | Alarm 3 | Ingame Overlay Mode | Connecting... | Connection ERROR! | Connected | Time Table | Next boss in: | Exit +Overlay +Mode | is Spawning in <00:00:00> | Night time in <00:00:00> | Imperial will Reset in <00:00:00> | Bosses List | Boss Name | Display Image Link | test | Boss Spawn Location Link | Add/Save | Remove | Add New | Save | Settings | Language | Client ID | Token | Server ID | Channel ID | HARD RESET | WARNING:: Hard Resting the app well delete all saved Settings and information. | Overlay Transperancy | Boss spawn Pinged Role | Night Time Pinged Role | Imperial Reset Pinged Role|Bot Update Discord Message Every Seconds|Minimum recommended is 5 | Roles Mention Message stays after anouncing (seconds)|!Are you Sure you want to hard Reset the app all data Will be Deleted!|Error 403: +Possible Solution 1: Bot must have admin privileges | Custom Boss Name | Specific Role For This Boss | Boss spawn Alarm 1 Custom Message | Boss Name + | Boss spawn Alarm 2 Custom Message | Boss Name + | Boss spawn Alarm 3 Custom Message | Boss Name + | Night Time Alarm 1 Custom Message | Night Time Alarm 2 Custom Message | Night Time Alarm 3 Custom Message | Imperial Reset Alarm 1 Custom Message | Imperial Reset Alarm 2 Custom Message | Imperial Reset Alarm 3 Custom Message | Saved | Click Here For Location | Imperial Trading will Reset in <00:00:00> | Bartering will Reset in <00:00:00> \ No newline at end of file diff --git a/YPBBT/Resources/Languages/es b/YPBBT/Resources/Languages/es new file mode 100644 index 0000000..3c06a39 --- /dev/null +++ b/YPBBT/Resources/Languages/es @@ -0,0 +1,19 @@ +● Bienvenido a yuri project bdo boss Timer aquí bien te ayudaremos +   configura tu bot paso a paso. + +- Si ya tiene configuración de Bot, puede hacer clic en Omitir para comenzar a llenar +   la información requerida + +- Si nunca hiciste bot antes, haz clic en Siguiente y te guiaremos +   y hazlo lo más fácil posible para ti ^^ | Saltar | Siguiente | Paso 1 | 1.1 - deberás ir a Discord Developer para crear el Bot +puedes ir haciendo clic abajo | Haga clic en mí | 1.2 - Inicie sesión y luego haga clic en Nueva aplicación y dele a su Bot +nombre y luego haga clic en Crear como si no puede encontrar el botón +haga clic abajo para mostrarle | Muéstrame | Siguiente | Paso 2 | - en este paso, debes crear el bot y su token +puede hacerlo haciendo clic en el botón Bot y luego haga clic en +Agregue Bot si tiene problemas para encontrar los botones, haga clic a continuación | Ayuda | Siguiente | Paso 3 | - Este paso bien debes invitar al Bot a tu servidor Discord +  todo lo que necesita hacer es poner la ID del cliente Bot en el cuadro a continuación +  luego haga clic en el botón Invitar para invitar al Bot a su discordia | Invitar | NOTA :: si no puede encontrar la identificación del cliente, haga clic a continuación | Ayuda no puede encontrar el ID de cliente | Siguiente | Paso 4 | - Ahora bien necesitas el token de bot y pégalo en el cuadro de abajo +  luego haga clic en probar para verificar si el token es correcto | Token de prueba | NOTA :: si no puede encontrar el token, haga clic a continuación | Ayuda no puede encontrar el token | Siguiente | Paso 5 | - Ahora bien, necesita configurar el ID del servidor y el ID del canal +  donde el bot publica bien su notificación y establece la función que desea +  sus miembros serán golpeados con | NOTA :: Para el rol, debe convertir el rol +y no te olvides de dar el privilegio de administrador de Bot | Siguiente | Paso final | - Ya está todo listo si tiene algún problema o tiene alguna pregunta, únase a nuestra discordia y haremos todo lo posible para ayudarlo. Disfrute c: | \ No newline at end of file diff --git a/YPBBT/Resources/Languages/es-m b/YPBBT/Resources/Languages/es-m new file mode 100644 index 0000000..109411a --- /dev/null +++ b/YPBBT/Resources/Languages/es-m @@ -0,0 +1,7 @@ +Tabla de tiempos | Lista de jefes | Configuraciones | Fuente: | Enviar a la bandeja | Reiniciar | Inicio | Invitación | Desconectar | Estado del bot: | Región: | Jefe anterior | Siguiente jefe | Seguido por | Desconectado | Sonido: | Boss Spawn +Alarma: | Alarma 1 | Alarma 2 | Reproducir sonido en: | Alarma 3 | Boss Spawn | Noche + Alarma: | Tiempo de la noche | Restablecimiento imperial | Alarma 1 | Configuración de publicación: | Alarma 2 | Mostrar tabla de tiempos | Alarma 3 | Restablecimiento imperial + Alarma: | Noche en: | Reinicio imperial en: | Alarma 1 | Alarma 2 | Alarma 3 | Modo de superposición en el juego | Conectando ... | ¡Error de conexión! El | Conectado | Tabla de tiempos | Próximo jefe en: | Salida +Cubrir +Modo | está engendrando en <00:00:00> | Noche en <00:00:00> | Imperial se reiniciará en <00:00:00> | Lista de jefes | Nombre del jefe | Mostrar enlace de imagen | prueba | Enlace de ubicación de Boss Spawn | Agregar / Guardar | Eliminar | Añadir nuevo | Guardar | Configuraciones | Idioma | ID del cliente | Token | ID del servidor | ID del canal | RESET DURO | ADVERTENCIA :: El reposo duro de la aplicación elimina bien todos los ajustes e información guardados. El | Transperancia de superposición | Boss spawn Pinged Role | Rol de la noche a la hora fijada | Restablecimiento imperial Rol definido | Mensaje de discordia de actualización de bot cada segundo | El mínimo recomendado es 5 | El mensaje de mención de roles permanece después del anuncio | ! ¿Está seguro de que desea restablecer la aplicación por completo, se eliminarán todos los datos! | Error 403: +Posible solución 1: Bot debe tener privilegios de administrador El | Nombre del jefe personalizado | Rol específico para este jefe | Boss spawn Alarm 1 Mensaje personalizado | Nombre del jefe + | Boss spawn Alarm 2 Mensaje personalizado | Nombre del jefe + | Boss spawn Alarm 3 Mensaje personalizado | Nombre del jefe + | Alarma nocturna 1 Mensaje personalizado | Night Time Alarm 2 Mensaje personalizado | Night Time Alarm 3 Mensaje personalizado | Imperial Reset Alarm 1 Mensaje personalizado | Imperial Reset Alarm 2 Mensaje personalizado | Imperial Reset Alarm 3 Mensaje personalizado | Salvado | Haga clic aquí para la ubicación \ No newline at end of file diff --git a/YPBBT/Resources/Languages/fr b/YPBBT/Resources/Languages/fr new file mode 100644 index 0000000..4d2883a --- /dev/null +++ b/YPBBT/Resources/Languages/fr @@ -0,0 +1,19 @@ +● Bienvenue sur Yuri project bdo boss Timer ici bien vous aider +   configurez votre bot étape par étape. + +- Si vous avez déjà une configuration Bot, vous pouvez cliquer sur Ignorer pour commencer à remplir +   les informations requises + +- Si vous n'avez jamais fait de bot avant, cliquez sur Suivant et bien vous guider +   et le rendre aussi simple que possible pour vous ^^ | Sauter | Suivant | Étape 1 | 1.1 - vous devrez vous rendre chez Discord Developer pour créer le Bot +vous pouvez vous y rendre en cliquant ci-dessous | Cliquez sur moi | 1.2 - Connectez-vous puis cliquez sur Nouvelle application et donnez à votre Bot +nom, puis cliquez sur Créer comme si vous ne trouvez pas le bouton +cliquez ci-dessous pour vous montrer | Montrez-moi | Suivant | Étape 2 | - dans cette étape, vous devez bien créer le bot et son jeton +vous pouvez le faire en cliquant sur le bouton Bot puis sur +Ajouter Bot si vous rencontrez des problèmes pour trouver les boutons, cliquez ci-dessous | Aide | Suivant | Étape 3 | - Cette étape, vous devez bien inviter le Bot sur votre serveur Discord +  tout ce que vous devez faire est de simplement mettre l'ID du client Bot dans la boîte ci-dessous +  puis cliquez sur le bouton Inviter pour inviter le Bot à votre discorde | Inviter | REMARQUE :: si vous ne trouvez pas l'ID client Cliquez ci-dessous | Impossible de trouver l'ID client | Suivant | Étape 4 | - Maintenant, vous avez bien besoin du jeton de robot collez-le dans la boîte ci-dessous +  puis cliquez sur tester pour vérifier si le jeton est correct | Jeton de test | REMARQUE :: si vous ne trouvez pas le jeton, cliquez ci-dessous | Aider à trouver le jeton | Suivant | Étape 5 | - Maintenant, vous avez bien besoin de pour définir l'ID du serveur et l'ID du canal +  où le bot affiche bien sa notification et définit le rôle que vous voulez +  vos membres à cingler Pentecôte | REMARQUE :: Pour le rôle, vous devez bien convertir le rôle +et n'oubliez pas de donner le privilège administrateur Bot | Suivant | Étape finale | - Tout est fait maintenant si vous avez un problème ou si vous avez des questions, rejoignez notre discorde et nous ferons de notre mieux pour vous aider Profitez de c: | \ No newline at end of file diff --git a/YPBBT/Resources/Languages/fr-m b/YPBBT/Resources/Languages/fr-m new file mode 100644 index 0000000..0e1cd54 --- /dev/null +++ b/YPBBT/Resources/Languages/fr-m @@ -0,0 +1,7 @@ +Horaire | Liste des boss | Paramètres | Source: | Envoyer vers le plateau | Redémarrer | Démarrer | Inviter | Se déconnecter | Statut du bot: | Région: | Boss précédent | Boss suivant | Suivi par | Déconnecté | Son: | Spawn du boss +Alarme: | Alarme 1 | Alarme 2 | Jouer le son sur: | Alarme 3 | Apparition du boss | Nuit + Alarme: | Heure de nuit | Réinitialisation impériale | Alarme 1 | Paramètres de publication: | Alarme 2 | Afficher le calendrier | Alarme 3 | Réinitialisation impériale + Alarme: | Nuit dans: | Réinitialisation impériale dans: | Alarme 1 | Alarme 2 | Alarme 3 | Mode de superposition du jeu | Connexion ... | Connexion ERREUR! | Connecté | Horaire | Patron suivant dans: | Quitter +Recouvrir +Mode | se reproduit <00:00:00> | La nuit dans <00:00:00> | Imperial va réinitialiser <00:00:00> | Liste des boss | Nom du boss | Afficher l'image Lien | test | Lien de localisation du boss Boss | Ajouter / Enregistrer | Supprimer | Ajouter nouveau | Enregistrer | Paramètres | Langue | ID client | Jeton | ID du serveur | ID du canal | RÉINITIALISATION DUR | AVERTISSEMENT :: Bien reposer l'application et supprimez tous les paramètres et informations enregistrés. | Superposition Transperancy | Rôle d'apparition du boss | Rôle de nuit | Rôle de réinitialisation impériale | Message de discordance de mise à jour du robot toutes les (secondes) | Le minimum recommandé est de 5 | Rôles Mention Le message reste après l'annonce | Êtes-vous sûr de vouloir réinitialiser l'application toutes les données seront supprimées! | Erreur 403: +Solution possible 1: le bot doit avoir des privilèges d'administrateur | Nom du patron personnalisé | Rôle spécifique de ce patron | Boss spawn Alarm 1 Message personnalisé | Nom du boss + | Boss spawn Alarm 2 Message personnalisé | Nom du boss + | Boss spawn Alarm 3 Message personnalisé | Nom du boss + | Alarme de nuit 1 Message personnalisé | Message personnalisé de l'alarme de nuit 2 | Alarme de nuit 3 Message personnalisé | Imperial Reset Alarm 1 Message personnalisé | Impérial Réinitialiser l'alarme 2 Message personnalisé | Imperial Reset Alarm 3 Message personnalisé | Enregistré | Cliquez ici pour l'emplacement \ No newline at end of file diff --git a/YPBBT/Resources/Languages/jp b/YPBBT/Resources/Languages/jp new file mode 100644 index 0000000..a6a0028 --- /dev/null +++ b/YPBBT/Resources/Languages/jp @@ -0,0 +1,19 @@ +●yuriプロジェクトbdoボスタイマーへようこそ。 +   ステップごとにボットをセットアップします。 + +-ボットの設定が完了している場合は、[スキップ]をクリックして入力を開始できます +   必要な情報 + +-次をクリックする前にボットを作成したことがなく、順を追って説明した場合 +   それをできるだけ簡単にする^^ |スキップ|次へ|ステップ1 | 1.1-不和な開発者に移動してボットを作成する必要があります +下をクリックする|ここをクリック| 1.2-ログインして新しいアプリケーションをクリックし、ボットに +名前を入力し、ボタンが見つからない場合は、[作成]をクリックします。 +下をクリックして表示します|表示する|次へ|手順2 |-この手順では、ボットとそのトークンを作成する必要があります +あなたはボットボタンをクリックしてそれを行うことができます +ボタンの検索に問題がある場合はボットを追加してください|ヘルプ|次へ|ステップ3 |-このステップでは、ボットをDiscordサーバーに招待する必要があります +  あなたがする必要があるのは、ボットクライアントIDを下のボックスに入れるだけです +  次に、[招待]ボタンをクリックして、ボットを不和に招待します|招待|注::クライアントIDが見つからない場合は、[下をクリック] |ヘルプがクライアントIDを見つけられない|次へ|ステップ4 |-ボットトークンが必要です下のボックスに貼り付けてください +  次に、テストをクリックしてトークンが正しいかどうかを確認します|テストトークン|注:トークンが見つからない場合は、以下をクリックしてください|ヘルプカントがトークンを見つける|次へ|ステップ5 |-サーバーIDとチャンネルID +  ボットが通知を投稿し、必要な役割を設定する場所 +  メンバーにpingを実行します|注::ロールの場合、ロールを変換する必要があります +ボットに管理者権限を与えることを忘れないでください|次へ|最終ステップ| -問題がある場合や質問がある場合は、これですべて完了しました。私たちの不和に加わってください。cを楽しむために全力を尽くします。 \ No newline at end of file diff --git a/YPBBT/Resources/Languages/jp-m b/YPBBT/Resources/Languages/jp-m new file mode 100644 index 0000000..ec85ce9 --- /dev/null +++ b/YPBBT/Resources/Languages/jp-m @@ -0,0 +1,7 @@ +タイムテーブル|ボスリスト|設定|ソース:|トレイに送信|再起動|開始|招待する|切断|ボットステータス:|領域:|前のボス|次のボス|フォロー|切断|サウンド:|ボススポーン +アラーム:|アラーム1 |アラーム2 |再生音:|アラーム3 |ボススポーン|夜間 + アラーム:|夜間|インペリアルリセット|アラーム1 |ポスト設定:|アラーム2 |タイムテーブルを表示|アラーム3 |インペリアルリセット + アラーム:|夜間:|インペリアルリセットイン:|アラーム1 |アラーム2 |アラーム3 |ゲーム内オーバーレイモード|接続中... |接続エラー!|接続済み|タイムテーブル|次の上司:|終了 +オーバーレイ +モード|産卵中 <00:00:00> |夜の時間 <00:00:00> |インペリアルはでリセットされます <00:00:00> |ボスリスト|ボス名|画像リンクを表示|テスト|ボススポーンロケーションリンク|追加/保存|削除|新規追加|保存|設定|言語|クライアントID |トークン|サーバーID |チャネルID |ハードリセット|警告::アプリをハードレストすると、保存されているすべての設定と情報が削除されます。|オーバーレイ透過性|ボススポーンロール|夜間ロール|インペリアルリセットロール|ボット更新不一致メッセージ(秒)|推奨される最小値は5です|アナウンス後にメッセージが残ります|!アプリをハードリセットしてもよろしいですか?すべてのデータが削除されます!| エラー403: +考えられる解決策1:ボットには管理者権限が必要です | カスタムボス名| このボスの特定の役割| ボススポーンアラーム1カスタムメッセージ| ボス名+ | ボススポーンアラーム2カスタムメッセージ| ボス名+ | ボススポーンアラーム3カスタムメッセージ| ボス名+ | 夜間アラーム1カスタムメッセージ| 夜間アラーム2カスタムメッセージ| 夜間アラーム3カスタムメッセージ| インペリアルリセットアラーム1カスタムメッセージ| インペリアルリセットアラーム2カスタムメッセージ| インペリアルリセットアラーム3カスタムメッセージ| 保存しました | 場所はここをクリック \ No newline at end of file diff --git a/YPBBT/Resources/Languages/kr b/YPBBT/Resources/Languages/kr new file mode 100644 index 0000000..18e6ba5 --- /dev/null +++ b/YPBBT/Resources/Languages/kr @@ -0,0 +1,19 @@ +● 유리 프로젝트 BDO 보스 타이머에 오신 것을 환영합니다. +   봇을 단계별로 설정하십시오. + +-이미 Bot 설정이 완료되면 건너 뛰기를 클릭하여 채우기를 시작할 수 있습니다 +   필요한 정보 + +-다음을 클릭하기 전에 봇을 만들지 않은 경우 +   가능한 한 당신을 위해 그것을 쉽게 ^^ | 건너 뛰기 | 다음 | 1 단계 | 1.1-불화 개발자로 이동하여 봇을 생성해야합니다. +아래를 클릭하여 거기에 갈 수 있습니다 | 저를 클릭하십시오 | 1.2-로그인 후 새 애플리케이션을 클릭하고 봇에게 +이름을 입력 한 다음 버튼을 찾을 수 없으면 생성을 클릭하십시오. +아래를 클릭하면 | 보여줘 | 다음 | 2 단계 | -이 단계에서는 봇과 토큰을 만들어야합니다 +봇 버튼을 클릭 한 다음 +버튼을 찾는 데 문제가 있으면 봇 추가 아래를 클릭하십시오 | 도움말 | 다음 | 3 단계 | -이 단계에서는 봇을 Discord Server에 초대해야합니다. +  아래 상자에 봇 클라이언트 ID를 입력하기 만하면됩니다. +  초대 버튼을 클릭하여 봇을 불화에 초대하십시오 | 초대 | 참고 :: 클라이언트 ID를 찾을 수없는 경우 아래 | 도움말을 찾을 수없는 고객 ID | 다음 | 4 단계 | -이제 아래 상자에 봇 토큰 붙여 넣기가 필요합니다. +  그런 다음 테스트를 클릭하여 토큰이 올바른지 확인하십시오 | 테스트 토큰 | 참고 :: 토큰을 찾을 수 없으면 아래를 클릭하십시오 | 캔트가 토큰을 찾도록 도와주세요 | 다음 | 5 단계 | -이제 서버 ID와 채널 ID를 설정해야합니다. +  봇이 알림을 게시하고 원하는 역할을 설정하는 위치 +  회원들이 오순절을 겪고 | 참고 :: 역할의 경우 역할을 변환해야합니다. +봇 관리자 권한을 부여하는 것을 잊지 마세요 | 다음 | 마지막 단계 | -문제가 있거나 궁금한 점이 있으면 지금 모두 완료하십시오. c : 즐기기 위해 최선을 다하겠습니다. | \ No newline at end of file diff --git a/YPBBT/Resources/Languages/kr-m b/YPBBT/Resources/Languages/kr-m new file mode 100644 index 0000000..53fac13 --- /dev/null +++ b/YPBBT/Resources/Languages/kr-m @@ -0,0 +1,7 @@ +시간표 | 보스 목록 | 설정 | 출처 : | 트레이로 보내기 | 다시 시작 | 시작 | 초대 | 연결 해제 | 봇 상태 : | 지역 : | 이전 보스 | 다음 보스 | 뒤에 | 연결 해제 | 소리 : | 보스 스폰 +알람 : | 알람 1 | 경보 2 | 소리 재생 : | 경보 3 | 보스 스폰 | 밤 시간 + 알람 : | 밤 시간 | 임페리얼 리셋 | 알람 1 | 게시물 설정 : | 경보 2 | 표시 시간표 | 경보 3 | 임페리얼 리셋 + 알람 : | 밤 : | 영국식 재설정 : | 알람 1 | 경보 2 | 경보 3 | 인게임 오버레이 모드 | 연결 중 ... | 연결 오류! | 연결됨 | 시간표 | 다음 보스 : | 출구 +위에 까는 것 +모드 | 산란 <00:00:00> | 밤 시간 <00:00:00> | 임페리얼이 <00:00:00> | 보스 목록 | 보스 이름 | 이미지 링크 표시 | 테스트 | 보스 스폰 위치 링크 | 추가 / 저장 | 제거 | 새로 추가 | 저장 | 설정 | 언어 | 고객 ID | 토큰 | 서버 아이디 | 채널 ID | 하드 리셋 | 경고 : : 하드 응용 프로그램을 잘 쉬면 저장된 모든 설정과 정보를 삭제합니다. | 오버레이 투명도 | 보스 스폰 핑 역할 | 야간 핑 역할 | 임페리얼 리셋 핑된 역할 | 매초마다 봇 업데이트 불일치 메시지 | 권장되는 최소값은 5 ​​| 역할 언급 메시지는 발표 후 유지됩니다 | ! 당신은 확실히 모든 데이터가 삭제됩니다 응용 프로그램을 재설정 하드 하시겠습니까! | 403 오류 : +가능한 해결책 1 : 봇은 관리자 권한이 있어야합니다 | 커스텀 보스 이름 | 이 보스의 특정 역할 | 보스 스폰 알람 1 사용자 정의 메시지 | 보스 이름 + | 보스 스폰 알람 2 사용자 정의 메시지 | 보스 이름 + | 보스 스폰 알람 3 사용자 정의 메시지 | 보스 이름 + | 야간 알람 1 사용자 정의 메시지 | 야간 알람 2 사용자 정의 메시지 | 야간 알람 3 사용자 정의 메시지 | 영국식 재설정 경보 1 사용자 정의 메시지 | 영국식 재설정 경보 2 사용자 정의 메시지 | 영국식 재설정 경보 3 사용자 정의 메시지 | 저장되었습니다 | 위치는 여기를 클릭하십시오 \ No newline at end of file diff --git a/YPBBT/Resources/Languages/ru b/YPBBT/Resources/Languages/ru new file mode 100644 index 0000000..2de06a5 --- /dev/null +++ b/YPBBT/Resources/Languages/ru @@ -0,0 +1,17 @@ +● Добро пожаловать в проект "Юри Бдо Таймер" , эта инструкция поможет вам шаг за шагом настроить своего бота. +- Если у вас уже есть готовый бот для таймера, вы можете нажать "Пропустить", чтобы приступить к заполнению информации +   Требуемая информация + +- Если вы ранее не создавали своего бота, нажмите «Далее» и следуйте подробной инструкции, + которая максимально просто пояснит, что нужно делать^^ | Пропустить | Далее | Шаг 1 | 1.1 - вам нужно будет зайти на портал разработчика, чтобы создать бота +Вы можете перейти туда, нажав ниже | Нажми меня | 1.2 - Войдите в свой аккаунт, затем нажмите "New Application" и дайте боту имя, +затем нажмите кнопку "Создать". Если вы не можете найти ее, +нажмите ниже, чтобы посмотреть инструкцию | Показать | Далее | Шаг 2 | - на этом этапе вам необходимо создать бота и его токен, +вы можете сделать это, нажав на кнопку "Bot", а затем нажмите на +кнопку "Add bot". Если у вас возникли проблемы с поиском кнопок, нажмите ниже | Справка | Далее | Шаг 3 | - На этом шаге вам необходимо пригласить бота на сервер Discord. +  Все, что вам нужно сделать, это просто вставить идентификатор клиента бота в поле ниже +  затем нажмите кнопку "Пригласить", чтобы добавить бота на сервер | Пригласить | ПРИМЕЧАНИЕ :: если вы не можете найти идентификатор клиента бота, нажмите ниже | Справка как найти идентификатор клиента | Далее | Шаг 4 | - Теперь вам нужен токен бота, вставьте его в поле ниже +  затем нажмите "Тест токена", чтобы проверить правильность токена | Тест токена | ПРИМЕЧАНИЕ :: если вы не можете найти токен, нажмите ниже | Справка поиска токена | Далее | Шаг 5 | - Теперь вам нужно установить идентификатор сервера и идентификатор канала, +  куда бот будет отправлять уведомления, и настроить роль, +  по которой бот будет пинговать участников сервера | ПРИМЕЧАНИЕ :: Для ввода роли, вам необходимо ее преобразовать, +и не забудьте дать боту админку | Далее | Последний шаг | - Все готово, если у вас возникли проблемы или какие-либо вопросы, присоединяйтесь к нашему дискорд серверу, и мы постараемся помочь Наслаждайтесь c: | \ No newline at end of file diff --git a/YPBBT/Resources/Languages/ru-m b/YPBBT/Resources/Languages/ru-m new file mode 100644 index 0000000..5d2eaad --- /dev/null +++ b/YPBBT/Resources/Languages/ru-m @@ -0,0 +1,6 @@ +Расписание | Список боссов | Настройки | Источник: | Отправить в трей | Перезапустить | Пуск | приглашение | Отключить | Статус бота: | Регион: | Предыдущий босс | Следующий босс | Затем | Отключен | Звук: | Будильник спавна +босса: | Будильник 1 | Будильник 2 | Проигрывать звук при: | Будильник 3 | Спавн босса | Будильник ночного + времени: | Ночное время | Имперское обновление | Будильник 1 | Настройки сообщения: | Будильник 2 | Отображение расписания | Будильник 3 | Будильник обновления + Имперки: | Ночь через: | Имперское обновление через: | Будильник 1 | Будильник 2 | Будильник 3 | Режим игрового оверлея | Подключение ... | ОШИБКА подключения! | Подключено | Расписание | Следующий босс через: | Выход +Режим оверлея | Нерест в <00:00:00> | Ночное время в <00:00:00> | Имперская воля сбрасывается в <00:00:00> | Список боссов | Имя босса | Ссылка на изображение босса | тест | Ссылка на место спавна босса | Добавить/сохранить | Удалить | Добавить нового | Сохранить | Настройки | Язык | ID клиента | Токен | Идентификатор сервера | Идентификатор канала | ПОЛНЫЙ РЕСЕТ | ПРЕДУПРЕЖДЕНИЕ :: Полный ресет удалит все сохраненные настройки и информацию. | Прозрачность наложения | Роль для пинга при спавне босса | Роль для пинга ночного времени | Роль для пинга имперского обновления | Бот обновляет сообщение с таймером каждые (секунд) | Минимальное рекомендуемое значение - 5 | Сообщение с упоминанием ролей остается на (секунд) | Вы уверены, что хотите сделать полный ресет, все данные будут удалены! | Ошибка 403: +Возможное решение 1: бот должен иметь права администратора | Пользовательское имя босса | Конкретная роль для этого босса | Boss spawn Alarm 1 Custom Message | Имя босса + | Boss spawn Alarm 2 Custom Message | Имя босса + | Boss spawn Alarm 3 Custom Message | Имя босса + | Ночной сигнал тревоги 1 Пользовательское сообщение | Night Time Alarm 2 Пользовательское сообщение | Ночное время 3 Пользовательское сообщение | Imperial Reset Alarm 1 Пользовательское сообщение | Imperial Reset Alarm 2 Пользовательское сообщение | Imperial Reset Alarm 3 Пользовательское сообщение | Сохраненный | Нажмите здесь для местоположения \ No newline at end of file diff --git a/YPBBT/Resources/Logo.png b/YPBBT/Resources/Logo.png new file mode 100644 index 0000000..bb909a9 Binary files /dev/null and b/YPBBT/Resources/Logo.png differ diff --git a/YPBBT/Resources/Muraka.png b/YPBBT/Resources/Muraka.png new file mode 100644 index 0000000..c750077 Binary files /dev/null and b/YPBBT/Resources/Muraka.png differ diff --git a/YPBBT/Resources/NightTimeAlert.wav b/YPBBT/Resources/NightTimeAlert.wav new file mode 100644 index 0000000..45e3fc1 Binary files /dev/null and b/YPBBT/Resources/NightTimeAlert.wav differ diff --git a/YPBBT/Resources/Nouver & Karanda.png b/YPBBT/Resources/Nouver & Karanda.png new file mode 100644 index 0000000..ebd85c2 Binary files /dev/null and b/YPBBT/Resources/Nouver & Karanda.png differ diff --git a/YPBBT/Resources/Nouver & Kazarka.png b/YPBBT/Resources/Nouver & Kazarka.png new file mode 100644 index 0000000..8ca244a Binary files /dev/null and b/YPBBT/Resources/Nouver & Kazarka.png differ diff --git a/YPBBT/Resources/Nouver & Offin.png b/YPBBT/Resources/Nouver & Offin.png new file mode 100644 index 0000000..adf21c0 Binary files /dev/null and b/YPBBT/Resources/Nouver & Offin.png differ diff --git a/YPBBT/Resources/Nouver.png b/YPBBT/Resources/Nouver.png new file mode 100644 index 0000000..3c9677b Binary files /dev/null and b/YPBBT/Resources/Nouver.png differ diff --git a/YPBBT/Resources/OLD_Profile b/YPBBT/Resources/OLD_Profile new file mode 100644 index 0000000..b3710c5 --- /dev/null +++ b/YPBBT/Resources/OLD_Profile @@ -0,0 +1 @@ +en|691864521832267837|NjkxODY0NTIxODMyMjY3ODM3.XtHhwA.2gnje9BHBYT2STdj-0sAQZMeKgc|704331501806026782|704331501806026785|<@RoleID>|<@RoleID>|<@RoleID>|5|30|<@RoleID>|<@RoleID> \ No newline at end of file diff --git a/YPBBT/Resources/Offin & Kutum.png b/YPBBT/Resources/Offin & Kutum.png new file mode 100644 index 0000000..c5c08a1 Binary files /dev/null and b/YPBBT/Resources/Offin & Kutum.png differ diff --git a/YPBBT/Resources/Offin & Nouver.png b/YPBBT/Resources/Offin & Nouver.png new file mode 100644 index 0000000..9b77f0d Binary files /dev/null and b/YPBBT/Resources/Offin & Nouver.png differ diff --git a/YPBBT/Resources/Offin.png b/YPBBT/Resources/Offin.png new file mode 100644 index 0000000..fb297cd Binary files /dev/null and b/YPBBT/Resources/Offin.png differ diff --git a/YPBBT/Resources/Quint & Muraka.png b/YPBBT/Resources/Quint & Muraka.png new file mode 100644 index 0000000..0a360a6 Binary files /dev/null and b/YPBBT/Resources/Quint & Muraka.png differ diff --git a/YPBBT/Resources/Quint.png b/YPBBT/Resources/Quint.png new file mode 100644 index 0000000..7f5a2b4 Binary files /dev/null and b/YPBBT/Resources/Quint.png differ diff --git a/YPBBT/Resources/SelfRoleLogo.png b/YPBBT/Resources/SelfRoleLogo.png new file mode 100644 index 0000000..cfd2873 Binary files /dev/null and b/YPBBT/Resources/SelfRoleLogo.png differ diff --git a/YPBBT/Resources/ServerID.mp4 b/YPBBT/Resources/ServerID.mp4 new file mode 100644 index 0000000..e569257 Binary files /dev/null and b/YPBBT/Resources/ServerID.mp4 differ diff --git a/YPBBT/Resources/Start.png b/YPBBT/Resources/Start.png new file mode 100644 index 0000000..b1e61a9 Binary files /dev/null and b/YPBBT/Resources/Start.png differ diff --git a/YPBBT/Resources/Step1.2.mp4 b/YPBBT/Resources/Step1.2.mp4 new file mode 100644 index 0000000..76db6af Binary files /dev/null and b/YPBBT/Resources/Step1.2.mp4 differ diff --git a/YPBBT/Resources/Step2CID.mp4 b/YPBBT/Resources/Step2CID.mp4 new file mode 100644 index 0000000..4977171 Binary files /dev/null and b/YPBBT/Resources/Step2CID.mp4 differ diff --git a/YPBBT/Resources/Step2MakeBot.mp4 b/YPBBT/Resources/Step2MakeBot.mp4 new file mode 100644 index 0000000..d4eec82 Binary files /dev/null and b/YPBBT/Resources/Step2MakeBot.mp4 differ diff --git a/YPBBT/Resources/Step4GetToken.mp4 b/YPBBT/Resources/Step4GetToken.mp4 new file mode 100644 index 0000000..8d4af74 Binary files /dev/null and b/YPBBT/Resources/Step4GetToken.mp4 differ diff --git a/YPBBT/Resources/TimeTable.png b/YPBBT/Resources/TimeTable.png new file mode 100644 index 0000000..e49358b Binary files /dev/null and b/YPBBT/Resources/TimeTable.png differ diff --git a/YPBBT/Resources/TimeTableLogo.png b/YPBBT/Resources/TimeTableLogo.png new file mode 100644 index 0000000..4bcb6c0 Binary files /dev/null and b/YPBBT/Resources/TimeTableLogo.png differ diff --git a/YPBBT/Resources/Vell.png b/YPBBT/Resources/Vell.png new file mode 100644 index 0000000..f2a02c6 Binary files /dev/null and b/YPBBT/Resources/Vell.png differ diff --git a/YPBBT/Resources/about.png b/YPBBT/Resources/about.png new file mode 100644 index 0000000..8115366 Binary files /dev/null and b/YPBBT/Resources/about.png differ diff --git a/YPBBT/Resources/alerts.png b/YPBBT/Resources/alerts.png new file mode 100644 index 0000000..5f622ca Binary files /dev/null and b/YPBBT/Resources/alerts.png differ diff --git a/YPBBT/Resources/appNameLogo.psd b/YPBBT/Resources/appNameLogo.psd new file mode 100644 index 0000000..7f8b91f Binary files /dev/null and b/YPBBT/Resources/appNameLogo.psd differ diff --git a/YPBBT/Resources/back.png b/YPBBT/Resources/back.png new file mode 100644 index 0000000..bb8716e Binary files /dev/null and b/YPBBT/Resources/back.png differ diff --git a/YPBBT/Resources/barteringalert.png b/YPBBT/Resources/barteringalert.png new file mode 100644 index 0000000..3fecd62 Binary files /dev/null and b/YPBBT/Resources/barteringalert.png differ diff --git a/YPBBT/Resources/bckg.mp4 b/YPBBT/Resources/bckg.mp4 new file mode 100644 index 0000000..8655bf4 Binary files /dev/null and b/YPBBT/Resources/bckg.mp4 differ diff --git a/YPBBT/Resources/bckg.wmv b/YPBBT/Resources/bckg.wmv new file mode 100644 index 0000000..cd16ee6 Binary files /dev/null and b/YPBBT/Resources/bckg.wmv differ diff --git a/YPBBT/Resources/bckg1.mp4 b/YPBBT/Resources/bckg1.mp4 new file mode 100644 index 0000000..a1b475b Binary files /dev/null and b/YPBBT/Resources/bckg1.mp4 differ diff --git a/YPBBT/Resources/bossalert.png b/YPBBT/Resources/bossalert.png new file mode 100644 index 0000000..74ae965 Binary files /dev/null and b/YPBBT/Resources/bossalert.png differ diff --git a/YPBBT/Resources/close.png b/YPBBT/Resources/close.png new file mode 100644 index 0000000..e004e3e Binary files /dev/null and b/YPBBT/Resources/close.png differ diff --git a/YPBBT/Resources/ddpbuttonimg.png b/YPBBT/Resources/ddpbuttonimg.png new file mode 100644 index 0000000..f7952cb Binary files /dev/null and b/YPBBT/Resources/ddpbuttonimg.png differ diff --git a/YPBBT/Resources/disconnect.png b/YPBBT/Resources/disconnect.png new file mode 100644 index 0000000..fb49233 Binary files /dev/null and b/YPBBT/Resources/disconnect.png differ diff --git a/YPBBT/Resources/en.png b/YPBBT/Resources/en.png new file mode 100644 index 0000000..56268bc Binary files /dev/null and b/YPBBT/Resources/en.png differ diff --git a/YPBBT/Resources/es.png b/YPBBT/Resources/es.png new file mode 100644 index 0000000..6a9319d Binary files /dev/null and b/YPBBT/Resources/es.png differ diff --git a/YPBBT/Resources/expand.png b/YPBBT/Resources/expand.png new file mode 100644 index 0000000..57963db Binary files /dev/null and b/YPBBT/Resources/expand.png differ diff --git a/YPBBT/Resources/fr.png b/YPBBT/Resources/fr.png new file mode 100644 index 0000000..d48273c Binary files /dev/null and b/YPBBT/Resources/fr.png differ diff --git a/YPBBT/Resources/icon.ico b/YPBBT/Resources/icon.ico new file mode 100644 index 0000000..99fb937 Binary files /dev/null and b/YPBBT/Resources/icon.ico differ diff --git a/YPBBT/Resources/imperialalert.png b/YPBBT/Resources/imperialalert.png new file mode 100644 index 0000000..ff01e40 Binary files /dev/null and b/YPBBT/Resources/imperialalert.png differ diff --git a/YPBBT/Resources/imperialtradingalert.png b/YPBBT/Resources/imperialtradingalert.png new file mode 100644 index 0000000..bd143d6 Binary files /dev/null and b/YPBBT/Resources/imperialtradingalert.png differ diff --git a/YPBBT/Resources/invite.png b/YPBBT/Resources/invite.png new file mode 100644 index 0000000..cdd5828 Binary files /dev/null and b/YPBBT/Resources/invite.png differ diff --git a/YPBBT/Resources/jp.png b/YPBBT/Resources/jp.png new file mode 100644 index 0000000..2fa3de7 Binary files /dev/null and b/YPBBT/Resources/jp.png differ diff --git a/YPBBT/Resources/kr.png b/YPBBT/Resources/kr.png new file mode 100644 index 0000000..5c1fe0e Binary files /dev/null and b/YPBBT/Resources/kr.png differ diff --git a/YPBBT/Resources/logo.psd b/YPBBT/Resources/logo.psd new file mode 100644 index 0000000..1fd78d5 Binary files /dev/null and b/YPBBT/Resources/logo.psd differ diff --git a/YPBBT/Resources/logo_yYI_icon.ico b/YPBBT/Resources/logo_yYI_icon.ico new file mode 100644 index 0000000..b442a54 Binary files /dev/null and b/YPBBT/Resources/logo_yYI_icon.ico differ diff --git a/YPBBT/Resources/minimize.png b/YPBBT/Resources/minimize.png new file mode 100644 index 0000000..33992b3 Binary files /dev/null and b/YPBBT/Resources/minimize.png differ diff --git a/YPBBT/Resources/nightalert.png b/YPBBT/Resources/nightalert.png new file mode 100644 index 0000000..7694f02 Binary files /dev/null and b/YPBBT/Resources/nightalert.png differ diff --git a/YPBBT/Resources/objimg.png b/YPBBT/Resources/objimg.png new file mode 100644 index 0000000..a86c652 Binary files /dev/null and b/YPBBT/Resources/objimg.png differ diff --git a/YPBBT/Resources/objimg1.png b/YPBBT/Resources/objimg1.png new file mode 100644 index 0000000..625035d Binary files /dev/null and b/YPBBT/Resources/objimg1.png differ diff --git a/YPBBT/Resources/overlay.png b/YPBBT/Resources/overlay.png new file mode 100644 index 0000000..30b477e Binary files /dev/null and b/YPBBT/Resources/overlay.png differ diff --git a/YPBBT/Resources/post.png b/YPBBT/Resources/post.png new file mode 100644 index 0000000..216513c Binary files /dev/null and b/YPBBT/Resources/post.png differ diff --git a/YPBBT/Resources/restart.png b/YPBBT/Resources/restart.png new file mode 100644 index 0000000..ba432bb Binary files /dev/null and b/YPBBT/Resources/restart.png differ diff --git a/YPBBT/Resources/ru.png b/YPBBT/Resources/ru.png new file mode 100644 index 0000000..7f66dbb Binary files /dev/null and b/YPBBT/Resources/ru.png differ diff --git a/YPBBT/Resources/settingsLogo.png b/YPBBT/Resources/settingsLogo.png new file mode 100644 index 0000000..1672831 Binary files /dev/null and b/YPBBT/Resources/settingsLogo.png differ diff --git a/YPBBT/Resources/soundalert.png b/YPBBT/Resources/soundalert.png new file mode 100644 index 0000000..71b001e Binary files /dev/null and b/YPBBT/Resources/soundalert.png differ diff --git a/YPBBT/Resources/sp.png b/YPBBT/Resources/sp.png new file mode 100644 index 0000000..6a9319d Binary files /dev/null and b/YPBBT/Resources/sp.png differ diff --git a/YPBBT/StartUp.xaml b/YPBBT/StartUp.xaml new file mode 100644 index 0000000..415ccbc --- /dev/null +++ b/YPBBT/StartUp.xaml @@ -0,0 +1,771 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/YPBBT/StartUp.xaml.cs b/YPBBT/StartUp.xaml.cs new file mode 100644 index 0000000..b6dbc2e --- /dev/null +++ b/YPBBT/StartUp.xaml.cs @@ -0,0 +1,805 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Discord; +using Discord.WebSocket; +using System.Diagnostics; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading; +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.Animation; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace YPBBT +{ + /// + /// Interaction logic for StartUp.xaml + /// + public partial class StartUp : Window + { + + DiscordSocketClient discord = new DiscordSocketClient(); + List LanguageLinesCollection = new List(); + string defLang; + int gate = 0; + public StartUp() + { + var exists = System.Diagnostics.Process.GetProcessesByName(System.IO.Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetEntryAssembly().Location)).Count() > 1; + + + if (System.Diagnostics.Process.GetProcessesByName(System.IO.Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetEntryAssembly().Location)).Count() > 1) + { + MessageBoxResult result = MessageBox.Show("The Application is already running in the background do you want to close it before continuing?", "WARNING", MessageBoxButton.YesNo, MessageBoxImage.Warning); + switch (result) + { + case MessageBoxResult.Yes: + System.Diagnostics.Process.Start(System.IO.Directory.GetCurrentDirectory() + "/ExtrenalAppRestart.exe"); + const string processName = "YPBBT"; // without '.exe' + Process.GetProcesses() + .Where(pr => pr.ProcessName == processName) + .ToAsyncEnumerable() + .ForEachAsync(p => p.Kill()); + break; + case MessageBoxResult.No: + + break; + + } + + } + if (File.Exists(System.IO.Directory.GetCurrentDirectory() + "/Resources/Profile")) + { + MainWindow ma = new MainWindow(0); + ma.Show(); + this.Close(); + } + InitializeComponent(); + + mediaElement.Source = new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/bckg.mp4"); + mediaElement.Play(); + System.Threading.Thread.Sleep(2000); + tab0.Visibility = Visibility.Hidden; + tab1.Visibility = Visibility.Hidden; + tab2.Visibility = Visibility.Hidden; + tab3.Visibility = Visibility.Hidden; + tab4.Visibility = Visibility.Hidden; + tab5.Visibility = Visibility.Hidden; + tab6.Visibility = Visibility.Hidden; + tab7.Visibility = Visibility.Hidden; + Step1_2MediaElement.Stop(); + Step2MediaElement.Stop(); + Step3MediaElement.Stop(); + Step4MediaElement.Stop(); + Tabcontrol1.SelectedIndex = 7; + } + + private void ReadLanguage(string SL) + { + defLang = SL; + try { LanguageLinesCollection.Clear(); } catch (Exception) { } + string lines = File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/Languages/" + SL); + string[] RefferalsFilter = lines.Split('|'); + foreach (var rf in RefferalsFilter) + { + LanguageLinesCollection.Add(rf); + //MessageBox.Show(rf); + } + S0Label0.Text = LanguageLinesCollection[0].ToString(); + Tc0SkipButton.Content = LanguageLinesCollection[1].ToString(); + Tc0NextButton.Content = LanguageLinesCollection[2].ToString(); + S1L0.Content = LanguageLinesCollection[3].ToString(); + S1L1.Text = LanguageLinesCollection[4].ToString(); + Step1_1Button.Content = LanguageLinesCollection[5].ToString(); + Step1_2Label.Text = LanguageLinesCollection[6].ToString(); + Step1_2Button.Content = LanguageLinesCollection[7].ToString(); + Step1NextButton.Content = LanguageLinesCollection[8].ToString(); + S2L0.Content = LanguageLinesCollection[9].ToString(); + S2L1.Text = LanguageLinesCollection[10].ToString(); + Step2HelpButton.Content = LanguageLinesCollection[11].ToString(); + Step2NextButton.Content = LanguageLinesCollection[12].ToString(); + S3L0.Content = LanguageLinesCollection[13].ToString(); + S3L1.Text = LanguageLinesCollection[14].ToString(); + Step3InviteBotButton.Content = LanguageLinesCollection[15].ToString(); + S3L2.Text = LanguageLinesCollection[16].ToString(); + Step3HelpButton.Content = LanguageLinesCollection[17].ToString(); + Step3NextButton.Content = LanguageLinesCollection[18].ToString(); + S4L0.Content = LanguageLinesCollection[19].ToString(); + S4L1.Text = LanguageLinesCollection[20].ToString(); + Step4TestTokenButton.Content = LanguageLinesCollection[21].ToString(); + S4L2.Text = LanguageLinesCollection[22].ToString(); + Step4HelpButton.Content = LanguageLinesCollection[23].ToString(); + Step4NextButton.Content = LanguageLinesCollection[24].ToString(); + S5L0.Content = LanguageLinesCollection[25].ToString(); + S5L1.Text = LanguageLinesCollection[26].ToString(); + S5L2.Text = LanguageLinesCollection[27].ToString(); + Step5NextButton.Content = LanguageLinesCollection[28].ToString(); + S6L0.Content = LanguageLinesCollection[29].ToString(); + S6L1.Text = LanguageLinesCollection[30].ToString(); + selctedlangImg.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/" + SL + ".png")); + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(2)); + da.AutoReverse = false; + Tabcontrol1.BeginAnimation(OpacityProperty, da); + Tabcontrol1.SelectedIndex = 0; + } + private void Window_MouseDown(object sender, MouseButtonEventArgs e) + { + try + { + if (e.ChangedButton == MouseButton.Left) + this.DragMove(); + } + catch (Exception) { } + } + + + private void mediaElement_MediaEnded(object sender, RoutedEventArgs e) + { + mediaElement.Position = new TimeSpan(0, 0, 8); + mediaElement.Play(); + } + + private void Tabcontrol1_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + //Tabcontrol1.Opacity = 0; + //DoubleAnimation da = new DoubleAnimation(); + //da.From = 1; + //da.To = 0; + //da.Duration = new Duration(TimeSpan.FromSeconds(1)); + //da.AutoReverse = true; + //Tabcontrol1.BeginAnimation(OpacityProperty, da); + } + + private void Tc0NextButton_MouseEnter(object sender, MouseEventArgs e) + { + var bc = new BrushConverter(); + Tc0NextButton.Background = (Brush)bc.ConvertFrom("#818182"); + } + + private void Tc0NextButton_MouseLeave(object sender, MouseEventArgs e) + { + var bc = new BrushConverter(); + Tc0NextButton.Background = (Brush)bc.ConvertFrom("#FFA9A9AA"); + } + + private void Tc0SkipButton_MouseEnter(object sender, MouseEventArgs e) + { + var bc = new BrushConverter(); + Tc0SkipButton.Background = (Brush)bc.ConvertFrom("#8c2d2d"); + } + + private void Tc0SkipButton_MouseLeave(object sender, MouseEventArgs e) + { + var bc = new BrushConverter(); + Tc0SkipButton.Background = (Brush)bc.ConvertFrom("#FFBB3D3D"); + } + + private void Tc0NextButton_Click(object sender, RoutedEventArgs e) + { + Step1_2Label.Visibility = Visibility.Hidden; + Step1_2Button.Visibility = Visibility.Hidden; + Step1_2MediaElement.Visibility = Visibility.Hidden; + Step1NextButton.Visibility = Visibility.Hidden; + Tabcontrol1.Opacity = 0; + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(2)); + da.AutoReverse = false; + Tabcontrol1.BeginAnimation(OpacityProperty, da); + Tabcontrol1.SelectedIndex = 1; + } + + private void Step1_1Button_MouseEnter(object sender, MouseEventArgs e) + { + var bc = new BrushConverter(); + Step1_1Button.Background = (Brush)bc.ConvertFrom("#818182"); + } + + private void Step1_1Button_MouseLeave(object sender, MouseEventArgs e) + { + var bc = new BrushConverter(); + Step1_1Button.Background = (Brush)bc.ConvertFrom("#FFA9A9AA"); + } + + private void Step1_1Button_Click(object sender, RoutedEventArgs e) + { + System.Diagnostics.Process.Start("https://discordapp.com/developers/applications/"); + Step1_2Label.Visibility = Visibility.Visible; + Step1_2Button.Visibility = Visibility.Visible; + Step1NextButton.Visibility = Visibility.Visible; + } + + private void Step1_2MediaElement_MediaEnded(object sender, RoutedEventArgs e) + { + Step1_2MediaElement.Position = new TimeSpan(0, 0, 0); + Step1_2MediaElement.Play(); + } + + private void Step1_2Button_Click(object sender, RoutedEventArgs e) + { + Step1_2MediaElement.Visibility = Visibility.Visible; + Step1_2MediaElement.Position = new TimeSpan(0, 0, 0); + Step1_2MediaElement.Play(); + } + + private void Step1_2Button_MouseEnter(object sender, MouseEventArgs e) + { + var bc = new BrushConverter(); + Step1_2Button.Background = (Brush)bc.ConvertFrom("#818182"); + } + + private void Step1_2Button_MouseLeave(object sender, MouseEventArgs e) + { + var bc = new BrushConverter(); + Step1_2Button.Background = (Brush)bc.ConvertFrom("#FFA9A9AA"); + } + + private void Step1_2MediaElement_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + System.Diagnostics.Process.Start(System.IO.Directory.GetCurrentDirectory() + "/Resources/Step1.2.mp4"); + } + + private void Step1_2MediaElement_LostFocus(object sender, RoutedEventArgs e) + { + Step1_2MediaElement.Position = new TimeSpan(0, 0, 0); + Step1_2MediaElement.Stop(); + Step1_2MediaElement.Visibility = Visibility.Hidden; + } + + private void Step1_2MediaElement_MouseLeave(object sender, MouseEventArgs e) + { + Step1_2MediaElement.Position = new TimeSpan(0, 0, 0); + Step1_2MediaElement.Stop(); + Step1_2MediaElement.Visibility = Visibility.Hidden; + } + + private void Step1NextButton_Click(object sender, RoutedEventArgs e) + { + Step1_2Label.Visibility = Visibility.Hidden; + Step1_2Button.Visibility = Visibility.Hidden; + Step1_2MediaElement.Visibility = Visibility.Hidden; + Step2MediaElement.Visibility = Visibility.Hidden; + Tabcontrol1.Opacity = 0; + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(2)); + da.AutoReverse = false; + Tabcontrol1.BeginAnimation(OpacityProperty, da); + Tabcontrol1.SelectedIndex = 2; + } + + private void Step1NextButton_MouseEnter(object sender, MouseEventArgs e) + { + var bc = new BrushConverter(); + Step1NextButton.Background = (Brush)bc.ConvertFrom("#818182"); + } + + private void Step1NextButton_MouseLeave(object sender, MouseEventArgs e) + { + var bc = new BrushConverter(); + Step1NextButton.Background = (Brush)bc.ConvertFrom("#FFA9A9AA"); + } + + private void Step2CIDTextbox_GotFocus(object sender, RoutedEventArgs e) + { + if (Step3CIDTextbox.Text == "Client ID") + { Step3CIDTextbox.Text = ""; } + } + + private void Step2MediaElement_LostFocus(object sender, RoutedEventArgs e) + { + Step2MediaElement.Position = new TimeSpan(0, 0, 0); + Step2MediaElement.Stop(); + Step2MediaElement.Visibility = Visibility.Hidden; + } + + private void Step2InviteBotButton_MouseEnter(object sender, MouseEventArgs e) + { + var bc = new BrushConverter(); + Step3InviteBotButton.Background = (Brush)bc.ConvertFrom("#818182"); + } + + private void Step2InviteBotButton_MouseLeave(object sender, MouseEventArgs e) + { + var bc = new BrushConverter(); + Step3InviteBotButton.Background = (Brush)bc.ConvertFrom("#FFA9A9AA"); + } + + private void Step2InviteBotButton_Click(object sender, RoutedEventArgs e) + { + var bc = new BrushConverter(); + Step3CIDTextbox.BorderBrush = (Brush)bc.ConvertFrom("#FFABADB3"); + Regex regex = new Regex("[^0-9-]+"); + string s = Step3CIDTextbox.Text.ToString(); + foreach (char c in s) + { + if (regex.IsMatch(c.ToString()) == true) + { Step3CIDTextbox.Text = ""; } + } + if (Step3CIDTextbox.Text == "Client ID") + { Step3CIDTextbox.Text = ""; } + if (Step3CIDTextbox.Text != "") + { + System.Diagnostics.Process.Start("https://discordapp.com/oauth2/authorize?&client_id=" + Step3CIDTextbox.Text + "&scope=bot&permissions=0"); + Step3NextButton.Visibility = Visibility.Visible; + } + else + { + Step3CIDTextbox.BorderBrush = Brushes.Red; + } + } + + private void Step2MediaElement_MediaEnded(object sender, RoutedEventArgs e) + { + Step2MediaElement.Position = new TimeSpan(0, 0, 0); + Step2MediaElement.Play(); + } + + private void Step2MediaElement_MouseLeave(object sender, MouseEventArgs e) + { + Step2MediaElement.Position = new TimeSpan(0, 0, 0); + Step2MediaElement.Stop(); + Step2MediaElement.Visibility = Visibility.Hidden; + } + + private void Step2MediaElement_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + System.Diagnostics.Process.Start(System.IO.Directory.GetCurrentDirectory() + "/Resources/Step2MakeBot.mp4"); + } + + private void Step2HelpButton_MouseEnter(object sender, MouseEventArgs e) + { + var bc = new BrushConverter(); + Step2HelpButton.Background = (Brush)bc.ConvertFrom("#818182"); + } + + private void Step2HelpButton_MouseLeave(object sender, MouseEventArgs e) + { + var bc = new BrushConverter(); + Step2HelpButton.Background = (Brush)bc.ConvertFrom("#FFA9A9AA"); + } + + private void Step2HelpButton_Click(object sender, RoutedEventArgs e) + { + Step2MediaElement.Visibility = Visibility.Visible; + } + + private void Step2NextButton_MouseEnter(object sender, MouseEventArgs e) + { + var bc = new BrushConverter(); + Step2NextButton.Background = (Brush)bc.ConvertFrom("#818182"); + } + + private void Step2NextButton_MouseLeave(object sender, MouseEventArgs e) + { + var bc = new BrushConverter(); + Step2NextButton.Background = (Brush)bc.ConvertFrom("#FFA9A9AA"); + } + + private void Step2NextButton_Click(object sender, RoutedEventArgs e) + { + Step3MediaElement.Visibility = Visibility.Hidden; + Step3NextButton.Visibility = Visibility.Hidden; + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(2)); + da.AutoReverse = false; + Tabcontrol1.BeginAnimation(OpacityProperty, da); + Tabcontrol1.SelectedIndex = 3; + } + + private void Step3HelpButton_MouseEnter(object sender, MouseEventArgs e) + { + var bc = new BrushConverter(); + Step3HelpButton.Background = (Brush)bc.ConvertFrom("#818182"); + } + + private void Step3HelpButton_MouseLeave(object sender, MouseEventArgs e) + { + var bc = new BrushConverter(); + Step3HelpButton.Background = (Brush)bc.ConvertFrom("#FFA9A9AA"); + } + + private void Step3HelpButton_Click(object sender, RoutedEventArgs e) + { + Step3MediaElement.Visibility = Visibility.Visible; + } + + private void Step3MediaElement_LostFocus(object sender, RoutedEventArgs e) + { + Step3MediaElement.Position = new TimeSpan(0, 0, 0); + Step3MediaElement.Stop(); + Step3MediaElement.Visibility = Visibility.Hidden; + } + + private void Step3MediaElement_MouseLeave(object sender, MouseEventArgs e) + { + Step3MediaElement.Position = new TimeSpan(0, 0, 0); + Step3MediaElement.Stop(); + Step3MediaElement.Visibility = Visibility.Hidden; + } + + private void Step3MediaElement_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + System.Diagnostics.Process.Start(System.IO.Directory.GetCurrentDirectory() + "/Resources/Step2CID.mp4"); + } + + private void Step3MediaElement_MediaEnded(object sender, RoutedEventArgs e) + { + Step3MediaElement.Position = new TimeSpan(0, 0, 0); + Step3MediaElement.Play(); + } + + private void Step3NextButton_MouseEnter(object sender, MouseEventArgs e) + { + var bc = new BrushConverter(); + Step3NextButton.Background = (Brush)bc.ConvertFrom("#818182"); + } + + private void Step3NextButton_MouseLeave(object sender, MouseEventArgs e) + { + var bc = new BrushConverter(); + Step3NextButton.Background = (Brush)bc.ConvertFrom("#FFA9A9AA"); + } + + private void Step3NextButton_Click(object sender, RoutedEventArgs e) + { + Step4MediaElement.Visibility = Visibility.Hidden; + Step4NextButton.Visibility = Visibility.Hidden; + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(2)); + da.AutoReverse = false; + Tabcontrol1.BeginAnimation(OpacityProperty, da); + Tabcontrol1.SelectedIndex = 4; + } + + private void Step4TokenTextbox_GotFocus(object sender, RoutedEventArgs e) + { + if (Step4TokenTextbox.Text == "Token") + { Step4TokenTextbox.Text = ""; } + } + + private void Step4TestTokenButton_MouseEnter(object sender, MouseEventArgs e) + { + var bc = new BrushConverter(); + Step4TestTokenButton.Background = (Brush)bc.ConvertFrom("#818182"); + } + + private void Step4TestTokenButton_MouseLeave(object sender, MouseEventArgs e) + { + var bc = new BrushConverter(); + Step4TestTokenButton.Background = (Brush)bc.ConvertFrom("#FFA9A9AA"); + } + + private async void Step4TestTokenButton_Click(object sender, RoutedEventArgs e) + { + try + { + await discord.LoginAsync(TokenType.Bot, Step4TokenTextbox.Text); + await discord.StartAsync(); + Step4TokenTextbox.BorderBrush = Brushes.Green; + Step4TestTokenButton.Background = Brushes.Green; + } + catch (Exception) + { + Step4TokenTextbox.BorderBrush = Brushes.Red; + Step4TestTokenButton.Background = Brushes.Red; + } + + if (Step4TokenTextbox.BorderBrush == Brushes.Green) + { Step4NextButton.Visibility = Visibility.Visible; } + } + + private void Step4HelpButton_MouseEnter(object sender, MouseEventArgs e) + { + var bc = new BrushConverter(); + Step4HelpButton.Background = (Brush)bc.ConvertFrom("#818182"); + } + + private void Step4HelpButton_MouseLeave(object sender, MouseEventArgs e) + { + var bc = new BrushConverter(); + Step4HelpButton.Background = (Brush)bc.ConvertFrom("#FFA9A9AA"); + } + + private void Step4HelpButton_Click(object sender, RoutedEventArgs e) + { + Step4MediaElement.Visibility = Visibility.Visible; + } + + private void Step4MediaElement_LostFocus(object sender, RoutedEventArgs e) + { + Step4MediaElement.Position = new TimeSpan(0, 0, 0); + Step4MediaElement.Stop(); + Step4MediaElement.Visibility = Visibility.Hidden; + } + + private void Step4MediaElement_MediaEnded(object sender, RoutedEventArgs e) + { + Step4MediaElement.Position = new TimeSpan(0, 0, 0); + Step4MediaElement.Play(); + } + + private void Step4MediaElement_MouseLeave(object sender, MouseEventArgs e) + { + Step4MediaElement.Position = new TimeSpan(0, 0, 0); + Step4MediaElement.Stop(); + Step4MediaElement.Visibility = Visibility.Hidden; + } + + private void Step4MediaElement_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + System.Diagnostics.Process.Start(System.IO.Directory.GetCurrentDirectory() + "/Resources/Step4GetToken.mp4"); + } + + private void Step4NextButton_MouseEnter(object sender, MouseEventArgs e) + { + var bc = new BrushConverter(); + Step4NextButton.Background = (Brush)bc.ConvertFrom("#818182"); + } + + private void Step4NextButton_MouseLeave(object sender, MouseEventArgs e) + { + var bc = new BrushConverter(); + Step4NextButton.Background = (Brush)bc.ConvertFrom("#FFA9A9AA"); + } + + private void Step4NextButton_Click(object sender, RoutedEventArgs e) + { + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(2)); + da.AutoReverse = false; + Tabcontrol1.BeginAnimation(OpacityProperty, da); + Tabcontrol1.SelectedIndex = 5; + } + + private void Tc0SkipButton_Click(object sender, RoutedEventArgs e) + { + Step3MediaElement.Visibility = Visibility.Hidden; + Step3NextButton.Visibility = Visibility.Hidden; + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(2)); + da.AutoReverse = false; + Tabcontrol1.BeginAnimation(OpacityProperty, da); + Tabcontrol1.SelectedIndex = 3; + } + + private void HelpSID_Click(object sender, RoutedEventArgs e) + { + System.Diagnostics.Process.Start(System.IO.Directory.GetCurrentDirectory() + "/Resources/ServerID.mp4"); + } + + private void HelpCID_Click(object sender, RoutedEventArgs e) + { + System.Diagnostics.Process.Start(System.IO.Directory.GetCurrentDirectory() + "/Resources/ChannelID.mp4"); + } + + private void Step5SIDTExtbox_GotFocus(object sender, RoutedEventArgs e) + { + if (Step5SIDTExtbox.Text == "Server ID") + { Step5SIDTExtbox.Text = ""; } + } + + private void Step5CIDTextbox_GotFocus(object sender, RoutedEventArgs e) + { + if (Step5CIDTextbox.Text == "Channel ID") + { Step5CIDTextbox.Text = ""; } + } + + private void Step5NextButton_MouseEnter(object sender, MouseEventArgs e) + { + var bc = new BrushConverter(); + Step5NextButton.Background = (Brush)bc.ConvertFrom("#818182"); + } + + private void Step5NextButton_MouseLeave(object sender, MouseEventArgs e) + { + var bc = new BrushConverter(); + Step5NextButton.Background = (Brush)bc.ConvertFrom("#FFA9A9AA"); + } + + private void Step5NextButton_Click(object sender, RoutedEventArgs e) + { + int g = 0; + if (Step5SIDTExtbox.Text != "Server ID" && Step5CIDTextbox.Text != "Channel ID") + { g = 1; } + Regex regex = new Regex("[^0-9-]+"); + string s = Step5SIDTExtbox.Text.ToString(); + foreach (char c in s) + { + if (regex.IsMatch(c.ToString()) == true) + { Step5SIDTExtbox.Text = ""; } + } + string s1 = Step5CIDTextbox.Text.ToString(); + foreach (char c in s1) + { + if (regex.IsMatch(c.ToString()) == true) + { Step5CIDTextbox.Text = ""; } + } + if (Step5SIDTExtbox.Text != "" && Step5CIDTextbox.Text != "" && g == 1) + { + if (Step5RoleTextbox.Text == "") + { Step5RoleTextbox.Text = "<@RoleID>"; } + string data = defLang + "|" + Step3CIDTextbox.Text + "|" + Step4TokenTextbox.Text + "|" + Step5SIDTExtbox.Text + "|" + Step5CIDTextbox.Text + "|" + Step5RoleTextbox.Text + "|<@RoleID>" + "|<@RoleID>" + "|5|30"+ "|<@RoleID>"+ "|<@RoleID>"; + System.IO.File.WriteAllText(System.IO.Directory.GetCurrentDirectory() + "/Resources/Profile", data); + + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(2)); + da.AutoReverse = false; + Tabcontrol1.BeginAnimation(OpacityProperty, da); + Tabcontrol1.SelectedIndex = 6; + } + } + + private void Image_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + System.Diagnostics.Process.Start("https://discord.gg/8SCcCJq"); + } + + private void Image_MouseLeftButtonDown_1(object sender, MouseButtonEventArgs e) + { + gate = 1; + this.Close(); + } + + private void frButton_MouseEnter(object sender, MouseEventArgs e) + { + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + SetLanguageLabel.BeginAnimation(OpacityProperty, da); + SetLanguageLabel.Content = "Choisir la langue"; + } + + private void enButton_MouseEnter(object sender, MouseEventArgs e) + { + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + SetLanguageLabel.BeginAnimation(OpacityProperty, da); + SetLanguageLabel.Content = "Select Language"; + } + + private void esButton_MouseEnter(object sender, MouseEventArgs e) + { + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + SetLanguageLabel.BeginAnimation(OpacityProperty, da); + SetLanguageLabel.Content = "Seleccione el idioma"; + } + + private void ruButton_MouseEnter(object sender, MouseEventArgs e) + { + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + SetLanguageLabel.BeginAnimation(OpacityProperty, da); + SetLanguageLabel.Content = "выбрать язык"; + } + + private void jpButton_MouseEnter(object sender, MouseEventArgs e) + { + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + SetLanguageLabel.BeginAnimation(OpacityProperty, da); + SetLanguageLabel.Content = "言語を選択する"; + } + + private void krButton_MouseEnter(object sender, MouseEventArgs e) + { + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(1)); + da.AutoReverse = false; + SetLanguageLabel.BeginAnimation(OpacityProperty, da); + SetLanguageLabel.Content = "언어를 선택하십시오"; + } + + private void frButton_Click(object sender, RoutedEventArgs e) + { + ReadLanguage("fr"); + + } + + private void enButton_Click(object sender, RoutedEventArgs e) + { + ReadLanguage("en"); + } + + private void esButton_Click(object sender, RoutedEventArgs e) + { + ReadLanguage("es"); + } + + private void ruButton_Click(object sender, RoutedEventArgs e) + { + ReadLanguage("ru"); + } + + private void jpButton_Click(object sender, RoutedEventArgs e) + { + ReadLanguage("jp"); + } + + private void krButton_Click(object sender, RoutedEventArgs e) + { + ReadLanguage("kr"); + } + + private void SelectedlangButton_Click(object sender, RoutedEventArgs e) + { + DoubleAnimation da = new DoubleAnimation(); + da.From = 0; + da.To = 1; + da.Duration = new Duration(TimeSpan.FromSeconds(2)); + da.AutoReverse = false; + Tabcontrol1.BeginAnimation(OpacityProperty, da); + Tabcontrol1.SelectedIndex = 7; + } + + private void HelpRID_Click(object sender, RoutedEventArgs e) + { + System.Diagnostics.Process.Start(System.IO.Directory.GetCurrentDirectory() + "/Resources/ConvertRole.mp4"); + } + + private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) + { + Closing -= Window_Closing; + e.Cancel = true; + var anim = new DoubleAnimation(0, (Duration)TimeSpan.FromSeconds(1)); + anim.Completed += (s, _) => Excute(); + this.BeginAnimation(UIElement.OpacityProperty, anim); + } + private async void Excute() + { + if (gate == 1) + { + await discord.StopAsync(); + MainWindow ma = new MainWindow(1); + ma.Show(); + } + this.Close(); + } + private void NumberValidationTextBox(object sender, TextCompositionEventArgs e) + { + Regex regex = new Regex("[^0-9-]+"); + e.Handled = regex.IsMatch(e.Text); + } + + } +} diff --git a/YPBBT/YPBBT.csproj b/YPBBT/YPBBT.csproj new file mode 100644 index 0000000..8127741 --- /dev/null +++ b/YPBBT/YPBBT.csproj @@ -0,0 +1,392 @@ + + + + + + + + + Debug + AnyCPU + {2F9BF334-F3B1-4109-9A7A-31488850B97F} + WinExe + YPBBT + YPBBT + v4.7.2 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + true + + + true + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + logo_yYI_icon.ico + + + + true + bin\x86\Debug\ + x86 + 7.3 + MinimumRecommendedRules.ruleset + true + + + bin\x86\Release\ + x86 + 7.3 + MinimumRecommendedRules.ruleset + true + Auto + + + app.manifest + + + + + + + bin\AutoUpdate\ + + + bin\x86\AutoUpdate\ + + + + ..\packages\CefSharp.Common.91.1.211\lib\net452\CefSharp.dll + + + ..\packages\CefSharp.Common.91.1.211\lib\net452\CefSharp.Core.dll + + + ..\packages\CefSharp.Wpf.91.1.211\lib\net452\CefSharp.Wpf.dll + + + ..\packages\Discord.Net.Commands.2.4.0\lib\net461\Discord.Net.Commands.dll + + + ..\packages\Discord.Net.Core.2.4.0\lib\net461\Discord.Net.Core.dll + + + ..\packages\Discord.Net.Rest.2.4.0\lib\net461\Discord.Net.Rest.dll + + + ..\packages\Discord.Net.Webhook.2.4.0\lib\netstandard2.0\Discord.Net.Webhook.dll + + + ..\packages\Discord.Net.WebSocket.2.4.0\lib\net461\Discord.Net.WebSocket.dll + + + ..\packages\Dsafa.WpfColorPicker.1.3.0\lib\net462\Dsafa.WpfColorPicker.dll + + + ..\packages\HtmlAgilityPack.1.11.34\lib\Net45\HtmlAgilityPack.dll + + + ..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll + + + ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll + + + + ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + + + ..\packages\System.Collections.Immutable.5.0.0\lib\net461\System.Collections.Immutable.dll + + + + + ..\packages\System.Interactive.Async.5.0.0\lib\net461\System.Interactive.Async.dll + + + ..\packages\System.Linq.Async.5.0.0\lib\net461\System.Linq.Async.dll + + + + ..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll + + + + ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + + + ..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll + + + ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll + + + + + + + + + + 4.0 + + + + + + ..\packages\WpfScreenHelper.1.0.0\lib\net40\WpfScreenHelper.dll + + + ..\packages\Xamarin.Forms.5.0.0.2083\lib\netstandard2.0\Xamarin.Forms.Core.dll + + + ..\packages\Xamarin.Forms.5.0.0.2083\lib\netstandard2.0\Xamarin.Forms.Platform.dll + + + ..\packages\Xamarin.Forms.5.0.0.2083\lib\netstandard2.0\Xamarin.Forms.Xaml.dll + + + ..\..\..\YPBBT_DLL\YPBBT_DLL\YPBBT_DLL\bin\Debug\YPBBT_DLL.dll + + + + + MSBuild:Compile + Designer + + + + DA_MainWindow.xaml + + + DA_OverlayModWindow.xaml + + + DA_Startup.xaml + + + + ErrorMessageBox.xaml + + + + OverlayModWindow.xaml + + + + StartUp.xaml + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + MainWindow.xaml + Code + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + + + + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Always + + + Always + + + Always + + + + + + + + + + + + + + + + + + + + + + + False + Microsoft .NET Framework 4.7.2 %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + + \ No newline at end of file diff --git a/YPBBT/YPBBT.csproj.user b/YPBBT/YPBBT.csproj.user new file mode 100644 index 0000000..9511b0f --- /dev/null +++ b/YPBBT/YPBBT.csproj.user @@ -0,0 +1,14 @@ + + + + ShowAllFiles + publish\ + + + + + + en-US + false + + \ No newline at end of file diff --git a/YPBBT/app.manifest b/YPBBT/app.manifest new file mode 100644 index 0000000..46d3959 --- /dev/null +++ b/YPBBT/app.manifest @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/YPBBT/bin/AutoUpdateCreator.exe b/YPBBT/bin/AutoUpdateCreator.exe new file mode 100644 index 0000000..a4e6ce5 Binary files /dev/null and b/YPBBT/bin/AutoUpdateCreator.exe differ diff --git a/YPBBT/bin/AutoUpdateCreator.exe.config b/YPBBT/bin/AutoUpdateCreator.exe.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/YPBBT/bin/AutoUpdateCreator.exe.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/YPBBT/bin/Clean.exe b/YPBBT/bin/Clean.exe new file mode 100644 index 0000000..c9b501f Binary files /dev/null and b/YPBBT/bin/Clean.exe differ diff --git a/YPBBT/bin/Clean.exe.config b/YPBBT/bin/Clean.exe.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/YPBBT/bin/Clean.exe.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/YPBBT/bin/Launcher.exe b/YPBBT/bin/Launcher.exe new file mode 100644 index 0000000..f471d08 Binary files /dev/null and b/YPBBT/bin/Launcher.exe differ diff --git a/YPBBT/bin/Launcher.exe.config b/YPBBT/bin/Launcher.exe.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/YPBBT/bin/Launcher.exe.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/YPBBT/ddpbuttonimg.png b/YPBBT/ddpbuttonimg.png new file mode 100644 index 0000000..f7952cb Binary files /dev/null and b/YPBBT/ddpbuttonimg.png differ diff --git a/YPBBT/font/AbrilFatface-Regular.ttf b/YPBBT/font/AbrilFatface-Regular.ttf new file mode 100644 index 0000000..e761f7b Binary files /dev/null and b/YPBBT/font/AbrilFatface-Regular.ttf differ diff --git a/YPBBT/font/Uni Sans Heavy Italic.otf b/YPBBT/font/Uni Sans Heavy Italic.otf new file mode 100644 index 0000000..bf20b43 Binary files /dev/null and b/YPBBT/font/Uni Sans Heavy Italic.otf differ diff --git a/YPBBT/font/Uni Sans Heavy.otf b/YPBBT/font/Uni Sans Heavy.otf new file mode 100644 index 0000000..facd333 Binary files /dev/null and b/YPBBT/font/Uni Sans Heavy.otf differ diff --git a/YPBBT/font/Uni Sans Thin Italic.otf b/YPBBT/font/Uni Sans Thin Italic.otf new file mode 100644 index 0000000..856075b Binary files /dev/null and b/YPBBT/font/Uni Sans Thin Italic.otf differ diff --git a/YPBBT/font/Uni Sans Thin.otf b/YPBBT/font/Uni Sans Thin.otf new file mode 100644 index 0000000..aa49745 Binary files /dev/null and b/YPBBT/font/Uni Sans Thin.otf differ diff --git a/YPBBT/font/droid-sans.regular.ttf b/YPBBT/font/droid-sans.regular.ttf new file mode 100644 index 0000000..efd1f8b Binary files /dev/null and b/YPBBT/font/droid-sans.regular.ttf differ diff --git a/YPBBT/icon.ico b/YPBBT/icon.ico new file mode 100644 index 0000000..99fb937 Binary files /dev/null and b/YPBBT/icon.ico differ diff --git a/YPBBT/loading.png b/YPBBT/loading.png new file mode 100644 index 0000000..7cb5ff5 Binary files /dev/null and b/YPBBT/loading.png differ diff --git a/YPBBT/logo_yYI_icon.ico b/YPBBT/logo_yYI_icon.ico new file mode 100644 index 0000000..b442a54 Binary files /dev/null and b/YPBBT/logo_yYI_icon.ico differ diff --git a/YPBBT/objimg.png b/YPBBT/objimg.png new file mode 100644 index 0000000..a86c652 Binary files /dev/null and b/YPBBT/objimg.png differ diff --git a/YPBBT/objimg1.png b/YPBBT/objimg1.png new file mode 100644 index 0000000..625035d Binary files /dev/null and b/YPBBT/objimg1.png differ diff --git a/YPBBT/packages.config b/YPBBT/packages.config new file mode 100644 index 0000000..5cc3b83 --- /dev/null +++ b/YPBBT/packages.config @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/YPBBT/playAudio.cs b/YPBBT/playAudio.cs new file mode 100644 index 0000000..a05c645 --- /dev/null +++ b/YPBBT/playAudio.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Media; +using System.Text; +using System.Threading.Tasks; +using System.Windows; + +namespace YPBBT +{ + + class playAudio + { + MediaPlayer myPlayer = new MediaPlayer(); + public void playBossAlertaudio() + { + myPlayer.Open(new System.Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/audio/BossSpawnAlert.mp3")); + myPlayer.Play(); + } + + public void playNightAlertaudio() + { + myPlayer.Open(new System.Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/audio/NightTimeAlert.mp3")); + myPlayer.Play(); + } + public void playImperialResetAlertaudio() + { + myPlayer.Open(new System.Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/audio/ImperialResetAlert.mp3")); + myPlayer.Play(); + } + public void playBarteringAlertaudio() + { + myPlayer.Open(new System.Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/audio/BarteringAlert.mp3")); + myPlayer.Play(); + } + public void playImperialTradingResetAlertaudio() + { + myPlayer.Open(new System.Uri(System.IO.Directory.GetCurrentDirectory() + "/Resources/audio/ImperialTradingResetAlert.mp3")); + myPlayer.Play(); + } + + + } +}