protected override void OnDelete() { base.OnDelete(); if (Altar != null) { Altar.Delete(); } if (Vendor != null) { Vendor.Delete(); } foreach (var b in Bosses.Where(b => b != null)) { b.Delete(); } foreach (var t in TeleportersTo.Union(TeleportersFrom).Where(t => t != null)) { t.Delete(); } foreach (var s in Floors.Where(l => l != null).SelectMany(l => l.Where(s => s != null))) { s.Delete(); } foreach (var s in Stage.Where(s => s != null)) { s.Delete(); } }
private void UpdateFilteredBosses_TextChanged(Object sender, TextChangedEventArgs e) { FilteredBosses = Bosses.Where(b => (String.IsNullOrEmpty(BossNameFilterTxtBox.Text) || b.Name.ToLower().StartsWith(BossNameFilterTxtBox.Text.ToLower())) && ((String.IsNullOrEmpty(BossHpFilterTxtBox.Text) || BossHpFilterTxtBox.Text.Equals("-")) || b.Hp == Convert.ToInt32(BossHpFilterTxtBox.Text)) && ((String.IsNullOrEmpty(BossOrderFilterTxtBox.Text) || BossOrderFilterTxtBox.Text.Equals("-")) || b.Order == Convert.ToInt32(BossOrderFilterTxtBox.Text)) && ResistanceFilter(BossFireFilterTxtBox.Text, b.Elemental.Fire, BossFireFilterCompareBtn.Content.ToString()) && ResistanceFilter(BossIceFilterTxtBox.Text, b.Elemental.Ice, BossIceFilterCompareBtn.Content.ToString()) && ResistanceFilter(BossThunderFilterTxtBox.Text, b.Elemental.Thunder, BossThunderFilterCompareBtn.Content.ToString()) && ResistanceFilter(BossAeroFilterTxtBox.Text, b.Elemental.Aero, BossAeroFilterCompareBtn.Content.ToString()) && ResistanceFilter(BossWaterFilterTxtBox.Text, b.Elemental.Water, BossWaterFilterCompareBtn.Content.ToString()) && ResistanceFilter(BossEarthFilterTxtBox.Text, b.Elemental.Earth, BossEarthFilterCompareBtn.Content.ToString()) && ResistanceFilter(BossLightFilterTxtBox.Text, b.Elemental.Light, BossLightFilterCompareBtn.Content.ToString()) && ResistanceFilter(BossDarkFilterTxtBox.Text, b.Elemental.Dark, BossDarkFilterCompareBtn.Content.ToString()) && ResistanceFilter(BossPoisonFilterTxtBox.Text, b.Ailment.Poison, BossPoisonFilterCompareBtn.Content.ToString()) && ResistanceFilter(BossConfuseFilterTxtBox.Text, b.Ailment.Confuse, BossConfuseFilterCompareBtn.Content.ToString()) && ResistanceFilter(BossSleepFilterTxtBox.Text, b.Ailment.Sleep, BossSleepFilterCompareBtn.Content.ToString()) && ResistanceFilter(BossBlindFilterTxtBox.Text, b.Ailment.Blind, BossBlindFilterCompareBtn.Content.ToString()) && ResistanceFilter(BossOblivionFilterTxtBox.Text, b.Ailment.Oblivion, BossOblivionFilterCompareBtn.Content.ToString()) && ResistanceFilter(BossBerserkFilterTxtBox.Text, b.Ailment.Berserk, BossBerserkFilterCompareBtn.Content.ToString()) && ResistanceFilter(BossSlowFilterTxtBox.Text, b.Ailment.Slow, BossSlowFilterCompareBtn.Content.ToString()) && ResistanceFilter(BossDoomFilterTxtBox.Text, b.Ailment.Doom, BossDoomFilterCompareBtn.Content.ToString()) && ((String.IsNullOrEmpty(BossExpFilterTxtBox.Text) || BossExpFilterTxtBox.Text.Equals("-")) || b.Exp == Convert.ToInt32(BossExpFilterTxtBox.Text)) && ((String.IsNullOrEmpty(BossGilFilterTxtBox.Text) || BossGilFilterTxtBox.Text.Equals("-")) || b.Gil == Convert.ToInt32(BossGilFilterTxtBox.Text)) && (String.IsNullOrEmpty(BossDropsFilterTxtBox.Text) || b.Drops.ToLower().Contains(BossDropsFilterTxtBox.Text.ToLower())) && (String.IsNullOrEmpty(BossNotesFilterTxtBox.Text) || b.Notes.ToLower().Contains(BossNotesFilterTxtBox.Text.ToLower())) ).ToList(); UpdateBossDataGrid(FilteredBosses); }
public async void TimerCallback(object obj) { int wdNumber = ((int)DateTime.Now.DayOfWeek == 0) ? 7 : (int)DateTime.Now.DayOfWeek; int nextWdNumber = wdNumber + 1 == 8 ? 1 : wdNumber + 1; var tsNow = TimeSpan.Parse(DateTime.Now.Hour + ":" + DateTime.Now.Minute); foreach (var noti in NotiTime) { var boss = Bosses.Where(x => x.Resps.Any(y => y.DayOfTheWeek == wdNumber && y.RespTime.Any(z => (TimeSpan.Parse(z.Resp.Hour + ":00") - tsNow).Hours == 0 && (TimeSpan.Parse(z.Resp.Hour + ":00") - tsNow).Minutes == noti.NotiTime))).ToList(); var nextDayBoss = Bosses.Where(x => x.Resps.Any(y => y.DayOfTheWeek == nextWdNumber && y.RespTime.Any(z => (TimeSpan.Parse(z.Resp.Hour + ":00") - tsNow).Hours == -23 && (TimeSpan.Parse(z.Resp.Hour + ":00") - tsNow).Minutes == (60 - noti.NotiTime) * -1))).ToList(); if (boss.Count > 0 || nextDayBoss.Count > 0) { var guilds = _discordClient.Guilds; foreach (var guild in guilds) { var ch = guild.Channels.SingleOrDefault(x => x.Name == "main") as ISocketMessageChannel; if (ch != null) { var currentBoss = boss.Count > 0 ? boss : nextDayBoss; foreach (var item in currentBoss) { if (noti.NotiTime != 0) { await ch.SendMessageAsync("Босс " + item.Name + " пробудится через " + noti.NotiTime + " минут"); if (AudioClients.Count > 0) { string[] path = { "sounds/внимание.mp3", "sounds/" + item.Name + ".mp3", "sounds/пробудится.mp3", "sounds/" + noti.NotiTime + ".mp3" }; foreach (var client in AudioClients) { await SendAsync(client, path); } } } else { await ch.SendMessageAsync("Босс " + item.Name + " пробудился"); } } } } } } }