public void Add(string AbnormId, Abnormality Abnorm) { CurrentAbnormalities.Add(AbnormId, Abnorm); _OnNewAbnormality(CurrentAbnormalities[AbnormId]); CurrentAbnormalities[AbnormId].OnAbnormalityEnd += RemoveObsoleteAbnormality; // Logger.Debugger.Debug($"NEW ABNORMALITY: {Abnorm.Name} (ID: {Abnorm.Id})"); }
private void SetAbnormalityInfo(Abnormality Abnorm) { float angle; if (Abnorm.IsInfinite || Abnorm.MaxDuration == 0) { angle = 90; } else { angle = ConvertPercentageIntoAngle(Abnorm.Duration / Abnorm.MaxDuration); } this.AbnormalityDurationArc.EndAngle = angle; ImageSource AbnormIcon; if (Abnorm.Stack >= 1) { AbnormIcon = TryFindResource($"{Abnorm.Icon}" + string.Concat(Enumerable.Repeat("+", Abnorm.Stack))) as ImageSource ?? FindResource($"{Abnorm.Icon}") as ImageSource; } else { AbnormIcon = FindResource(Abnorm.Icon) as ImageSource; } this.AbnormalityIcon.Source = AbnormIcon; this.AbnormalityDurationArc.Stroke = Abnorm.IsDebuff ? Debuff_Color : Buff_Color; if (Abnorm.IsInfinite || !ShowAbnormalityTimerText) { this.TimeLeftText.Visibility = System.Windows.Visibility.Collapsed; this.Height = 36; } else { this.TimeLeftText.Text = FormatToMinutes(Abnorm.Duration); } }
public Abnormal(Creature.Creature creature, Abnormality abnormality, Creature.Creature caster = null) { Creature = creature; Caster = caster ?? creature; Abnormality = abnormality; TimeoutUts = RandomUtilities.GetCurrentMilliseconds() + abnormality.Time; }
private static void CheckPassivity(Abnormality ab) { if (PassivityDatabase.Passivities.Contains(ab.Id)) { SkillManager.AddPassivitySkill(ab.Id, 60); } }
public DataPoint(int time, int value, Abnormality range = Abnormality.Normal) { this.time = time; this.value = value; this.point = new SKPoint(time, value); this.range = range; }
private static void EndPlayerAbnormality(Abnormality ab) { if (ab.Type == AbnormalityType.Buff) { if (ab.Infinity) { BuffBarWindowViewModel.Instance.Player.RemoveInfBuff(ab); } else { BuffBarWindowViewModel.Instance.Player.RemoveBuff(ab); if (ab.IsShield) { SessionManager.SetPlayerShield(0); } if (ab.IsShield) { SessionManager.SetPlayerMaxShield(0); } } } else { BuffBarWindowViewModel.Instance.Player.RemoveDebuff(ab); CharacterWindowViewModel.Instance.Player.RemoveFromDebuffList(ab); //ClassManager.SetStatus(ab, false); } }
public AbnormalityControl(Abnormality Abnorm) { InitializeComponent(); SetAbnormalityInfo(Abnorm); Context = Abnorm; HookEvents(); }
private static void BeginPlayerAbnormality(Abnormality ab, int stacks, uint duration) { if (ab.Type == AbnormalityType.Buff) { if (ab.Infinity) { BuffBarWindowViewModel.Instance.Player.AddOrRefreshInfBuff(ab, duration, stacks); } else { BuffBarWindowViewModel.Instance.Player.AddOrRefreshBuff(ab, duration, stacks); if (ab.IsShield) { SessionManager.SetPlayerMaxShield(ab.ShieldSize); } } } else { BuffBarWindowViewModel.Instance.Player.AddOrRefreshDebuff(ab, duration, stacks); CharacterWindowViewModel.Instance.Player.AddToDebuffList(ab); //ClassManager.SetStatus(ab, true); } CheckPassivity(ab, duration); //var sysMsg = new ChatMessage("@661\vAbnormalName\v" + ab.Name, SystemMessages.Messages["SMT_BATTLE_BUFF_DEBUFF"]); //ChatWindowManager.Instance.AddChatMessage(sysMsg); }
private static void EndPlayerAbnormality(Abnormality ab) { GroupWindowViewModel.Instance.EndAbnormality(ab, SessionManager.CurrentPlayer.PlayerId, SessionManager.CurrentPlayer.ServerId); if (ab.Type == AbnormalityType.Buff) { if (ab.Infinity) { SessionManager.CurrentPlayer.RemoveInfBuff(ab); } else { SessionManager.CurrentPlayer.RemoveBuff(ab); if (ab.IsShield) { SessionManager.SetPlayerShield(0); SessionManager.SetPlayerMaxShield(0); } } } else { SessionManager.CurrentPlayer.RemoveDebuff(ab); SessionManager.CurrentPlayer.RemoveFromDebuffList(ab); } }
private static void ParseAbnormality() { Abnormalities = new Dictionary <int, Abnormality>(); foreach (var o in DC.GetMainObjectsByName("Abnormality")) { foreach (var data in (List <Dictionary <string, object> >)DC.GetValues(o)["Abnormal"]) { Abnormality abnormality = new Abnormality(); abnormality.Id = int.Parse(data["id"].ToString()); abnormality.Infinity = bool.Parse(data["infinity"].ToString()); abnormality.IsBuff = bool.Parse(data["isBuff"].ToString()); abnormality.Kind = int.Parse(data["kind"].ToString()); abnormality.Level = int.Parse(data["level"].ToString()); abnormality.NotCareDeath = bool.Parse(data["notCareDeath"].ToString()); abnormality.Priority = int.Parse(data["priority"].ToString()); abnormality.Property = int.Parse(data["property"].ToString()); abnormality.Time = data.GetLong("time"); abnormality.IsShow = ParseEnum <AbnormalityShowType>(data["isShow"]); abnormality.IsHideOnRefresh = bool.Parse(data["isHideOnRefresh"].ToString()); abnormality.BySkillCategory = data.GetInt("bySkillCategory"); if (data.ContainsKey("AbnormalityEffect")) { foreach (var effectData in (List <Dictionary <string, object> >)data["AbnormalityEffect"]) { abnormality.Effects.Add(ParseAbnormalityEffect(effectData)); } } if (Names.ContainsKey(abnormality.Id)) { abnormality.Name = Names[abnormality.Id].Key; abnormality.Tooltip = Names[abnormality.Id].Value; } else { abnormality.Name = "Unk"; abnormality.Tooltip = "Unk"; } Abnormalities.Add(abnormality.Id, abnormality); } } Console.WriteLine("Loaded {0} abnormalities...", Abnormalities.Count); }
private void OnAbnormalityEnd(object source, AbnormalityEventArgs args) { Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Render, new Action(() => { args.Abnormality.OnAbnormalityUpdate -= OnAbnormalityUpdate; args.Abnormality.OnAbnormalityEnd -= OnAbnormalityEnd; Context = null; })); }
public void EndAbnormality(ulong target, Abnormality ab) { if (!TryFindNPC(target, out var boss)) { return; } boss !.EndBuff(ab); }
private static void BeginNpcAbnormality(Abnormality ab, int stacks, uint duration, ulong target) { //if (EntitiesViewModel.TryGetBossById(target, out Npc b)) //{ // b.AddorRefresh(ab, duration, stacks, BOSS_AB_SIZE, BOSS_AB_LEFT_MARGIN); //} BossGageWindowViewModel.Instance.AddOrRefreshNpcAbnormality(ab, stacks, duration, target); }
internal void AbnormalityNotifierAdded(Abnormality ab, bool newStack) { if (newStack) { AbnormalityNotifierCommon(ab.Target, ab.HotDot.Id, AbnormalityTriggerType.Added, ab.Stack); } var boss = HudManager.Instance.CurrentBosses.FirstOrDefault(x => x.EntityId == ab.Target); boss?.AddOrRefresh(ab); }
public static void EndPlayerAbnormality(Abnormality ab) { CurrentPlayer.Buffs.Remove(CurrentPlayer.Buffs.FirstOrDefault(x => x.Abnormality.Id == ab.Id)); CurrentPlayer.Debuffs.Remove(CurrentPlayer.Debuffs.FirstOrDefault(x => x.Abnormality.Id == ab.Id)); CurrentPlayer.InfBuffs.Remove(CurrentPlayer.InfBuffs.FirstOrDefault(x => x.Abnormality.Id == ab.Id)); if (!ab.IsBuff) { SetDebuffedStatus(false); } }
private static bool Filter(Abnormality ab) { return(ab.IsShow && !ab.Name.Contains("BTS") && !ab.ToolTip.Contains("BTS") && ( !ab.Name.Contains("(Hidden)") && !ab.Name.Equals("Unknown") && !ab.Name.Equals(string.Empty) )); }
public bool GetAbnormality(uint id, out Abnormality ab) { ab = new Abnormality(0, false, false, false, AbnormalityType.Buff, "", "", ""); if (Abnormalities.TryGetValue(id, out var found)) { ab = found; return(true); } return(false); }
private static bool Filter(Abnormality ab) { if (ab.Name.Contains("BTS") || ab.ToolTip.Contains("BTS") || !ab.IsShow) { return(false); } if (ab.Name.Contains("(Hidden)") || ab.Name.Equals("Unknown") || ab.Name.Equals(string.Empty)) { return(false); } return(true); }
public AbnormalityDatabase(string lang) { Abnormalities = new Dictionary <uint, Abnormality>(); var hd = File.OpenText(AppDomain.CurrentDomain.BaseDirectory + "/resources/data/hotdot/hotdot-" + lang + ".tsv"); while (true) { var l = hd.ReadLine(); if (l == null) { break; } if (l == "") { continue; } var s = l.Split('\t'); var id = uint.Parse(s[0]); var type = s[1]; var amount = double.Parse(s[7], CultureInfo.InvariantCulture); var isBuff = bool.Parse(s[3]); var isShow = bool.Parse(s[14]); var name = s[8]; var tooltip = s[11]; var icon = s[13]; var abType = (AbnormalityType)Enum.Parse(typeof(AbnormalityType), s[2]); var infinite = s[5] == "0"; var ab = new Abnormality(id, isShow, isBuff, infinite, abType); ab.SetIcon(icon); ab.SetInfo(name, tooltip); if (type.IndexOf("Absorb", StringComparison.Ordinal) > -1) { ab.SetShield((uint)amount); //TODO: may just parse everything instead of doing this } if (Abnormalities.ContainsKey(id)) { if (!Abnormalities[id].IsShield && ab.IsShield) { Abnormalities[id] = ab; } if (ab.Infinity) { if (!Abnormalities[id].Infinity) { Abnormalities[id].Infinity = false; } } continue; } Abnormalities.Add(id, ab); } }
private static void CheckPassivity(Abnormality ab, uint duration) { if (PassivityDatabase.Passivities.Contains(ab.Id)) { SkillManager.AddPassivitySkill(ab.Id, 60); } else if (CooldownWindowViewModel.Instance.MainSkills.Any(m => m.CooldownType == CooldownType.Passive && ab.Id == m.Skill.Id) || CooldownWindowViewModel.Instance.SecondarySkills.Any(m => m.CooldownType == CooldownType.Passive && ab.Id == m.Skill.Id)) { //TODO: can't do this correctly since we don't know passivity cooldown from database so we just add duration SkillManager.AddPassivitySkill(ab.Id, duration / 1000); } }
public AbnormalityDuration(Abnormality b, int d, int s, ulong t) { Abnormality = b; Duration = d; Stacks = s; Target = t; DurationLeft = d; timer = new Timer(1000); timer.Elapsed += (se, ev) => DurationLeft = DurationLeft - 1000; if (!Abnormality.Infinity) { timer.Start(); } }
private void SetAbnormalityInfo(Abnormality Abnorm) { float angle; if (Abnorm.IsInfinite || Abnorm.MaxDuration == 0) { angle = 90; } else { angle = ConvertPercentageIntoAngle(Abnorm.Duration / Abnorm.MaxDuration); } this.AbnormalityDurationArc.EndAngle = angle; this.AbnormalityIcon.Source = FindResource(Abnorm.Icon) as ImageSource; }
private static void CheckPassivity(Abnormality ab, uint duration) { if (Settings.SettingsHolder.EthicalMode) { return; } if (PassivityDatabase.Passivities.TryGetValue(ab.Id, out var passivity)) { SkillManager.AddPassivitySkill(ab.Id, passivity); } else if (WindowManager.CooldownWindow.VM.MainSkills.Any(m => m.CooldownType == CooldownType.Passive && ab.Id == m.Skill.Id) || WindowManager.CooldownWindow.VM.SecondarySkills.Any(m => m.CooldownType == CooldownType.Passive && ab.Id == m.Skill.Id)) { //note: can't do this correctly since we don't know passivity cooldown from database so we just add duration SkillManager.AddPassivitySkill(ab.Id, duration / 1000); } }
public GroupAbnormalityVM(Abnormality ab) { _dispatcher = Dispatcher.CurrentDispatcher; Abnormality = ab; Classes = new SynchronizedObservableCollection <ClassToggle>(_dispatcher); for (int i = 0; i < 13; i++) { var ct = new ClassToggle((Class)i, ab.Id); if (SettingsManager.GroupAbnormals.ContainsKey(ct.Class)) { ct.Selected = SettingsManager.GroupAbnormals[ct.Class].Contains(ab.Id); } Classes.Add(ct); } Classes.Add(new ClassToggle(Class.Common, ab.Id) { Selected = SettingsManager.GroupAbnormals[Class.Common].Contains(ab.Id) }); }
public GroupAbnormalityVM(Abnormality ab) { Dispatcher = Dispatcher.CurrentDispatcher; Abnormality = ab; Classes = new SynchronizedObservableCollection <ClassToggle>(Dispatcher); for (var i = 0; i < 13; i++) { var ct = new ClassToggle((Class)i, ab.Id); if (SettingsHolder.GroupAbnormals.TryGetValue(ct.Class, out var list)) { ct.Selected = list.Contains(ab.Id); } Classes.Add(ct); } Classes.Add(new ClassToggle(Class.Common, ab.Id) { Selected = SettingsHolder.GroupAbnormals[Class.Common].Contains(ab.Id) }); }
private static void BeginPlayerAbnormality(Abnormality ab, int stacks, uint duration) { if (ab.Type == AbnormalityType.Buff) { if (ab.Infinity) { SessionManager.CurrentPlayer.AddOrRefreshInfBuff(ab, duration, stacks); } else { SessionManager.CurrentPlayer.AddOrRefreshBuff(ab, duration, stacks); //if (ab.IsShield) SessionManager.SetPlayerMaxShield(ab.ShieldSize); } } else { SessionManager.CurrentPlayer.AddOrRefreshDebuff(ab, duration, stacks); SessionManager.CurrentPlayer.AddToDebuffList(ab); } }
private static void EndPlayerAbnormality(Abnormality ab) { WindowManager.GroupWindow.VM.EndAbnormality(ab, SessionManager.CurrentPlayer.PlayerId, SessionManager.CurrentPlayer.ServerId); if (ab.Type == AbnormalityType.Buff) { if (ab.Infinity) { SessionManager.CurrentPlayer.RemoveInfBuff(ab); } else { SessionManager.CurrentPlayer.RemoveBuff(ab); } } else { SessionManager.CurrentPlayer.RemoveDebuff(ab); SessionManager.CurrentPlayer.RemoveFromDebuffList(ab); } }
public void Drop(IDropInfo dropInfo) { var l = dropInfo.TargetCollection.TryGetList(); if (l.Cast <Cooldown>().Any(cd => { var ret = dropInfo.Data switch { Skill s => (cd.Skill.IconName == s.IconName), Item i => (cd.Skill.IconName == i.IconName), Abnormality a => (cd.Skill.IconName == a.IconName), _ => false }; return(ret); })) { return; } switch (dropInfo.Data) { case Skill s: l.Add(new Cooldown(s, false)); break; case Item i: Game.DB !.ItemsDatabase.TryGetItemSkill(i.Id, out var itemSkill); l.Add(new Cooldown(itemSkill, false, CooldownType.Item)); break; case Abnormality a: l.Add(new Cooldown(new Skill(a.Id, Class.None, a.Name, a.ToolTip) { IconName = a.IconName }, false, CooldownType.Passive)); break; } //dropInfo.DragInfo.SourceCollection.TryGetList().Remove(dropInfo.Data); }
public static void SetStatus(Abnormality ab, bool adding) { if (CurrentClassManager == null || ab.IsBuff || !SettingsManager.ClassWindowSettings.Enabled) { return; } if (adding) { if (!_debuffs.Contains(ab.Id)) { _debuffs.Add(ab.Id); } } else { _debuffs.Remove(ab.Id); } bool status = _debuffs.Count == 0 ? false : true; CurrentClassManager.GetDispatcher().Invoke(() => { CurrentClassManager.HP.Status = status; }); }
public AbnormalityDuration(Abnormality b, uint d, int s, ulong t, Dispatcher disp, bool animated /*,double iconSize, double bgEllSize, Thickness margin*/) { _count++; _dispatcher = disp; Animated = animated; Abnormality = b; Duration = d; Stacks = s; Target = t; //IconSize = iconSize; //BackgroundEllipseSize = bgEllSize; //IndicatorMargin = margin; DurationLeft = d; if (!Abnormality.Infinity) { timer = new System.Timers.Timer(1000); timer.Elapsed += DecreaseDuration; timer.Start(); } }