private async void EntityOnParticleEffectAdded(Entity sender, ParticleEffectAddedEventArgs args) { await Task.Delay(1); var particle = args.ParticleEffect; if (!this.IsValid(sender, particle, args.Name)) { return; } var item = new LogItem(LogType.Particle, Color.LightGreen, "Particle added"); item.AddLine("Name: " + args.Name, args.Name); item.AddLine("Highest control point: " + particle.HighestControlPoint, particle.HighestControlPoint); if (this.showCpValues) { for (var i = 0u; i <= args.ParticleEffect.HighestControlPoint; i++) { var point = args.ParticleEffect.GetControlPoint(i); if (this.ignoreZeroCp && point.IsZero) { continue; } item.AddLine("CP " + i + ": " + point, point); } } this.log.Display(item); }
private void InformationOnPropertyChanged(MenuSwitcher switcher, SwitcherEventArgs e) { if (e.Value == information) { return; } UpdateManager.BeginInvoke(() => { var unit = (this.player.QueryUnit ?? this.player.SelectedUnits.FirstOrDefault()) as Unit; if (unit?.IsValid != true) { return; } this.lastUnitInfo = unit.Handle; var item = new LogItem(LogType.Modifier, Color.PaleGreen, "Modifiers information"); item.AddLine("Unit name: " + unit.Name, unit.Name); item.AddLine("Unit network name: " + unit.NetworkName, unit.NetworkName); item.AddLine("Unit classID: " + unit.ClassId, unit.ClassId); foreach (var modifier in unit.Modifiers) { if (!this.showHidden && modifier.IsHidden) { continue; } var modifierItem = new LogItem(LogType.Modifier, Color.PaleGreen); modifierItem.AddLine("Name: " + modifier.Name, modifier.Name); if (this.showTextureName) { modifierItem.AddLine("Texture name: " + modifier.TextureName, modifier.TextureName); } if (this.showHidden) { modifierItem.AddLine("Is hidden: " + modifier.IsHidden, modifier.IsHidden); } if (this.showElapsedTime) { modifierItem.AddLine("Elapsed time: " + modifier.ElapsedTime, modifier.ElapsedTime); } if (this.showRemainingTime) { modifierItem.AddLine("Remaining time: " + modifier.RemainingTime, modifier.RemainingTime); } this.log.Display(modifierItem); } this.log.Display(item); }); }
private async void OnHandlePropertyChange(Entity sender, HandlePropertyChangeEventArgs args) { await Task.Delay(1); if (!this.IsValid(sender, args)) { return; } var item = new LogItem(LogType.Handle, Color.Cyan, "Handle changed"); item.AddLine("Property name: " + args.PropertyName, args.PropertyName); item.AddLine( "Property values: " + ObjectManager.GetEntities <Entity>().FirstOrDefault(x => x.IsValid && x.Index == args.OldValue.Index)?.Name + " => " + ObjectManager.GetEntities <Entity>().FirstOrDefault(x => x.IsValid && x.Index == args.NewValue.Index)?.Name, ObjectManager.GetEntities <Entity>().FirstOrDefault(x => x.IsValid && x.Index == args.NewValue.Index)?.Name); item.AddLine("Sender name: " + sender.Name, sender.Name); item.AddLine("Sender network name: " + sender.NetworkName, sender.NetworkName); item.AddLine("Sender classID: " + sender.ClassId, sender.ClassId); if (sender.Owner is Unit) { item.AddLine("Owner name: " + sender.Owner.Name, sender.Owner.Name); item.AddLine("Owner network name: " + sender.Owner.NetworkName, sender.Owner.NetworkName); item.AddLine("Owner classID: " + sender.Owner.ClassId, sender.Owner.ClassId); } this.log.Display(item); }
private void PlayerOnExecuteOrder(Player sender, ExecuteOrderEventArgs args) { if (!this.IsValid(args)) { return; } var item = new LogItem(LogType.ExecuteOrder, Color.Magenta, "Execute ability order"); if (args.Ability != null) { item.AddLine("Ability name: " + args.Ability.Name, args.Ability.Name); item.AddLine("Ability network name: " + args.Ability.NetworkName, args.Ability.NetworkName); item.AddLine("Ability classID: " + args.Ability.ClassId, args.Ability.ClassId); } item.AddLine("Order: " + args.OrderId, args.OrderId); if (args.Target != null) { item.AddLine("Target name: " + args.Target.Name, args.Target.Name); item.AddLine("Target network name: " + args.Target.NetworkName, args.Target.NetworkName); item.AddLine("Target classID: " + args.Target.ClassId, args.Target.ClassId); } if (!args.TargetPosition.IsZero) { item.AddLine("Target position: " + args.TargetPosition, args.TargetPosition); } this.log.Display(item); }
private void EntityManagerOnEntityRemoved(object sender, Unit unit) { if (!this.IsValid(unit)) { return; } var item = new LogItem(LogType.Unit, Color.LightPink, "Unit removed"); item.AddLine("Name: " + unit.Name, unit.Name); item.AddLine("Network name: " + unit.NetworkName, unit.NetworkName); item.AddLine("ClassID: " + unit.ClassId, unit.ClassId); item.AddLine("Position: " + unit.Position, unit.Position); this.log.Display(item); }
private void Check() { var text = this.output.ToString(); if (!text.Any()) { return; } try { var match = Regex.Match(text, @"(.*?exception)", RegexOptions.IgnoreCase); if (match.Success) { var item = new LogItem(LogType.Exception, Color.Red, "Exception"); item.AddLine(match.Value.Split(' ').Last()); this.log.Display(item); Console.ForegroundColor = ConsoleColor.Red; } } finally { Console.SetOut(this.defaultOutput); Console.Write(text); Console.ResetColor(); this.output.Dispose(); Console.SetOut(this.output = new StringWriter()); } }
private void EntityOnAnimationChanged(Entity sender, EventArgs args) { if (!this.IsValid(sender)) { return; } var item = new LogItem(LogType.Animation, Color.Cyan, "Animation changed"); item.AddLine("Name: " + sender.Animation.Name, sender.Animation.Name); item.AddLine("Sender name: " + sender.Name, sender.Name); item.AddLine("Sender network name: " + sender.NetworkName, sender.NetworkName); item.AddLine("Sender classID: " + sender.ClassId, sender.ClassId); this.log.Display(item); }
private void OnMessage(MessageEventArgs args) { var item = new LogItem(LogType.GameEvent, Color.Yellow, "Message"); item.AddLine("Name: " + args.Message, args.Message); this.log.Display(item); }
private void OnUIStateChanged(UIStateChangedEventArgs args) { var item = new LogItem(LogType.GameEvent, Color.Yellow, "UI state changed"); item.AddLine("Name: " + args.UIState, args.UIState); this.log.Display(item); }
private void OnGCMessageReceive(GCMessageEventArgs args) { var item = new LogItem(LogType.GameEvent, Color.Yellow, "GC message received"); item.AddLine("Name: " + args.MessageID, args.MessageID); this.log.Display(item); }
private async void UnitOnModifierAdded(ModifierAddedEventArgs e) { if (e.IsCollection) { return; } await Task.Delay(1); var modifier = e.Modifier; if (!this.IsValid(modifier)) { return; } var item = new LogItem(LogType.Modifier, Color.LightGreen, "Modifier added"); item.AddLine("Name: " + modifier.Name, modifier.Name); item.AddLine("Texture name: " + modifier.TextureName, modifier.TextureName); item.AddLine("Elapsed time: " + modifier.ElapsedTime, modifier.ElapsedTime); item.AddLine("Remaining time: " + modifier.RemainingTime, modifier.RemainingTime); var sender = modifier.Owner; item.AddLine("Sender name: " + sender.Name, sender.Name); item.AddLine("Sender network name: " + sender.NetworkName, sender.NetworkName); item.AddLine("Sender classID: " + sender.ClassId, sender.ClassId); this.log.Display(item); }
private void UnitOnModifierRemoved(Unit sender, ModifierChangedEventArgs args) { var modifier = args.Modifier; if (!this.IsValid(sender, modifier)) { return; } var item = new LogItem(LogType.Modifier, Color.LightPink, "Modifier removed"); item.AddLine("Name: " + modifier.Name, modifier.Name); item.AddLine("Texture name: " + modifier.TextureName, modifier.TextureName); item.AddLine("Sender name: " + sender.Name, sender.Name); item.AddLine("Sender network name: " + sender.NetworkName, sender.NetworkName); item.AddLine("Sender classID: " + sender.ClassId, sender.ClassId); this.log.Display(item); }
private async void EntityOnParticleEffectAdded(ParticleAddedEventArgs e) { if (e.IsCollection) { return; } var particle = e.Particle; if (!this.IsValid(particle)) { return; } var item = new LogItem(LogType.Particle, Color.LightGreen, "Particle added"); item.AddLine("Name: " + particle.Name, particle.Name); await Task.Delay(1); if (this.IsValid(particle)) { item.AddLine("Highest control point: " + particle.HighestControlPoint, particle.HighestControlPoint); if (this.showCpValues) { for (var i = 0; i <= particle.HighestControlPoint; i++) { var point = particle.GetControlPoint(i); if (this.ignoreZeroCp && point.IsZero) { continue; } item.AddLine("CP " + i + ": " + point, point); } } } this.log.Display(item); }
private void EntityManagerOnEntityAdded(EntityAddedEventArgs e) { if (e.IsCollection) { return; } if (e.Entity is not Ability ability) { return; } if (!this.IsValid(ability)) { return; } var item = new LogItem(LogType.Ability, Color.LightGreen, "Ability added"); item.AddLine("Name: " + ability.Name, ability.Name); item.AddLine("Network name: " + ability.NetworkName, ability.NetworkName); item.AddLine("ClassID: " + ability.ClassId, ability.ClassId); item.AddLine("Owner name: " + ability.Owner?.Name, ability.Owner?.Name); item.AddLine("Owner network name: " + ability.Owner?.NetworkName, ability.Owner?.NetworkName); item.AddLine("Owner classID: " + ability.Owner?.ClassId, ability.Owner?.ClassId); this.log.Display(item); }
private void GameOnGameEvent(GameEventEventArgs e) { if (!this.IsValid(e)) { return; } var item = new LogItem(LogType.GameEvent, Color.Yellow, "Game event"); item.AddLine("Name: " + e.GameEvent.Name, e.GameEvent.Name); this.log.Display(item); }
private void GameOnFireEvent(FireEventEventArgs args) { if (!this.IsValid(args)) { return; } var item = new LogItem(LogType.GameEvent, Color.Yellow, "Fire event"); item.AddLine("Name: " + args.GameEvent.Name, args.GameEvent.Name); this.log.Display(item); }
private void OnRemoveTrackingProjectile(TrackingProjectileEventArgs args) { var projectile = args.Projectile; if (!this.IsValid(projectile)) { return; } var item = new LogItem(LogType.Projectile, Color.LightPink, "Projectile removed"); item.AddLine("Source name: " + projectile.Source?.Name, projectile.Source?.Name); item.AddLine("Source network name: " + projectile.Source?.NetworkName, projectile.Source?.NetworkName); item.AddLine("Source classID: " + projectile.Source?.ClassId, projectile.Source?.ClassId); item.AddLine("Speed: " + projectile.Speed, projectile.Speed); item.AddLine("Position: " + projectile.Position, projectile.Position); item.AddLine("Target name: " + projectile.Target?.Name, projectile.Target?.Name); item.AddLine("Target network name: " + projectile.Target?.NetworkName, projectile.Target?.NetworkName); item.AddLine("Target classID: " + projectile.Target?.ClassId, projectile.Target?.ClassId); item.AddLine("Target position: " + projectile.TargetPosition, projectile.TargetPosition); this.log.Display(item); }
private void EntityManagerOnEntityAdded(object sender, Unit unit) { if (!this.IsValid(unit)) { return; } var item = new LogItem(LogType.Unit, Color.LightGreen, "Unit added"); item.AddLine("Name: " + unit.Name, unit.Name); item.AddLine("Network name: " + unit.NetworkName, unit.NetworkName); item.AddLine("ClassID: " + unit.ClassId, unit.ClassId); item.AddLine("Position: " + unit.Position, unit.Position); item.AddLine("Attack capability: " + unit.AttackCapability, unit.AttackCapability); item.AddLine("Move capability: " + unit.MoveCapability, unit.MoveCapability); item.AddLine("Vision: " + unit.DayVision + "/" + unit.NightVision, unit.DayVision + "/" + unit.NightVision); item.AddLine("Health: " + unit.Health, unit.Health); this.log.Display(item); }
private void OnFloatPropertyChange(Entity sender, FloatPropertyChangeEventArgs args) { if (!this.IsValid(sender, args)) { return; } var item = new LogItem(LogType.Float, Color.Cyan, "Float changed"); item.AddLine("Property name: " + args.PropertyName, args.PropertyName); item.AddLine("Property values: " + args.OldValue + " => " + args.NewValue, args.NewValue); item.AddLine("Sender name: " + sender.Name, sender.Name); item.AddLine("Sender network name: " + sender.NetworkName, sender.NetworkName); item.AddLine("Sender classID: " + sender.ClassId, sender.ClassId); if (sender.Owner is Unit) { item.AddLine("Owner name: " + sender.Owner.Name, sender.Owner.Name); item.AddLine("Owner network name: " + sender.Owner.NetworkName, sender.Owner.NetworkName); item.AddLine("Owner classID: " + sender.Owner.ClassId, sender.Owner.ClassId); } this.log.Display(item); }
private void EntityManagerOnEntityAdded(object sender, Ability ability) { if (!this.IsValid(ability)) { return; } var item = new LogItem(LogType.Ability, Color.LightGreen, "Ability added"); item.AddLine("Name: " + ability.Name, ability.Name); item.AddLine("Network name: " + ability.NetworkName, ability.NetworkName); item.AddLine("ClassID: " + ability.ClassId, ability.ClassId); item.AddLine("Owner name: " + ability.Owner.Name, ability.Owner.Name); item.AddLine("Owner network name: " + ability.Owner.NetworkName, ability.Owner.NetworkName); item.AddLine("Owner classID: " + ability.Owner.ClassId, ability.Owner.ClassId); this.log.Display(item); }
private void InformationOnPropertyChanged(object sender, PropertyChangedEventArgs e) { var unit = (this.player.QueryUnit ?? this.player.Selection.FirstOrDefault()) as Unit; if (unit?.IsValid != true) { return; } this.lastUnitInfo = unit.Handle; var item = new LogItem(LogType.Unit, Color.PaleGreen, "Unit information"); item.AddLine("Unit name: " + unit.Name, unit.Name); item.AddLine("Unit network name: " + unit.NetworkName, unit.NetworkName); item.AddLine("Unit classID: " + unit.ClassId, unit.ClassId); item.AddLine("Unit position: " + unit.Position, unit.Position); if (this.showLevel) { item.AddLine("Unit level: " + unit.Level, unit.Level); } if (this.showTeam) { item.AddLine("Unit team: " + unit.Team, unit.Team); } if (this.showsHpMp) { item.AddLine("Unit health: " + unit.Health + "/" + unit.MaximumHealth); item.AddLine("Unit mana: " + (int)unit.Mana + "/" + (int)unit.MaximumMana); } item.AddLine("Unit attack capability: " + unit.AttackCapability, unit.AttackCapability); if (this.showVision) { item.AddLine("Unit vision: " + unit.DayVision + "/" + unit.NightVision); } if (this.showState) { item.AddLine("Unit state: " + unit.UnitState, unit.UnitState); } if (this.showsAbilityInfo) { item.AddLine("Abilities =>"); item.AddLine(" Talents count: " + unit.Spellbook.Spells.Count(x => x.Name.StartsWith("special_"))); item.AddLine( " Active spells count: " + unit.Spellbook.Spells.Count( x => !x.Name.StartsWith("special_") && x.AbilityBehavior != AbilityBehavior.Passive)); item.AddLine( " Passive spells count: " + unit.Spellbook.Spells.Count( x => !x.Name.StartsWith("special_") && x.AbilityBehavior == AbilityBehavior.Passive)); } if (this.showItemInfo && unit.HasInventory) { item.AddLine("Items =>"); item.AddLine(" Inventory Items count: " + unit.Inventory.Items.Count()); item.AddLine(" Backpack Items count: " + unit.Inventory.Backpack.Count()); item.AddLine(" Stash Items count: " + unit.Inventory.Stash.Count()); } if (this.showModifierInfo) { item.AddLine("Modifiers =>"); item.AddLine(" Active modifiers count: " + unit.Modifiers.Count(x => !x.IsHidden)); item.AddLine(" Hidden modifiers count: " + unit.Modifiers.Count(x => x.IsHidden)); } this.log.Display(item); }
private void InformationOnPropertyChanged(object sender, PropertyChangedEventArgs e) { var unit = (this.player.QueryUnit ?? this.player.Selection.FirstOrDefault()) as Unit; if (unit?.IsValid != true) { return; } this.lastUnitInfo = unit.Handle; var item = new LogItem(LogType.Spell, Color.PaleGreen, "Spells information"); item.AddLine("Unit name: " + unit.Name, unit.Name); item.AddLine("Unit network name: " + unit.NetworkName, unit.NetworkName); item.AddLine("Unit classID: " + unit.ClassId, unit.ClassId); foreach (var ability in unit.Spellbook.Spells.Reverse()) { if (!this.showHidden && ability.IsHidden) { continue; } if (!this.showTalents && ability.Name.StartsWith("special_")) { continue; } var abilityItem = new LogItem(LogType.Spell, Color.PaleGreen); abilityItem.AddLine("Name: " + ability.Name, ability.Name); abilityItem.AddLine("Network name: " + ability.NetworkName, ability.NetworkName); abilityItem.AddLine("ClassID: " + ability.ClassId, ability.ClassId); if (this.showLevel) { abilityItem.AddLine("Level: " + ability.Level, ability.Level); } if (this.showManaCost) { abilityItem.AddLine("Mana cost: " + ability.ManaCost, ability.ManaCost); } if (this.showCastRange) { abilityItem.AddLine("Cast range: " + ability.GetCastRange(), ability.GetCastRange()); } if (this.showBehavior) { abilityItem.AddLine("Behavior: " + ability.AbilityBehavior, ability.AbilityBehavior); } if (this.showTargetType) { abilityItem.AddLine("Target type: " + ability.TargetType, ability.TargetType); abilityItem.AddLine("Target team type: " + ability.TargetTeamType, ability.TargetTeamType); } if (this.showSpecialData) { abilityItem.AddLine("Special data =>"); foreach (var abilitySpecialData in ability.AbilitySpecialData.Where(x => !x.Name.StartsWith("#"))) { var values = new StringBuilder(); var count = abilitySpecialData.Count; for (uint i = 0; i < count; i++) { values.Append(abilitySpecialData.GetValue(i)); if (i < count - 1) { values.Append(", "); } } abilityItem.AddLine(" " + abilitySpecialData.Name + ": " + values, abilitySpecialData.Name); } } this.log.Display(abilityItem); } this.log.Display(item); }
private void InformationOnPropertyChanged(MenuSwitcher switcher, SwitcherEventArgs e) { if (e.Value == information) { return; } UpdateManager.BeginInvoke(() => { var unit = (this.player.QueryUnit ?? this.player.SelectedUnits.FirstOrDefault()) as Unit; if (unit?.IsValid != true || !unit.HasInventory) { return; } this.lastUnitInfo = unit.Handle; var item = new LogItem(LogType.Item, Color.PaleGreen, "Items information"); item.AddLine("Unit name: " + unit.Name, unit.Name); item.AddLine("Unit network name: " + unit.NetworkName, unit.NetworkName); item.AddLine("Unit classID: " + unit.ClassId, unit.ClassId); var localizeName = LocalizationHelper.LocalizeName(unit); item.AddLine("Unit display name: " + localizeName, localizeName); var items = new List <Item>(); if (this.showInventory) { items.AddRange(unit.Inventory.Items); } if (this.showBackpack) { items.AddRange(unit.Inventory.BackpackItems); } if (this.showStash) { items.AddRange(unit.Inventory.StashItems); } foreach (var ability in items.Reverse <Item>()) { var abilityItem = new LogItem(LogType.Spell, Color.PaleGreen); abilityItem.AddLine("Name: " + ability.Name, ability.Name); abilityItem.AddLine("Network name: " + ability.NetworkName, ability.NetworkName); abilityItem.AddLine("ClassID: " + ability.ClassId, ability.ClassId); var localizeAbilityName = LocalizationHelper.LocalizeAbilityName(ability.Name); abilityItem.AddLine("Display name: " + localizeAbilityName, localizeAbilityName); if (this.showManaCost) { abilityItem.AddLine("Mana cost: " + ability.ManaCost, ability.ManaCost); } if (this.showCastRange) { abilityItem.AddLine("Cast range: " + ability.CastRange, ability.CastRange); } if (this.showBehavior) { abilityItem.AddLine("Behavior: " + ability.AbilityBehavior, ability.AbilityBehavior); } if (this.showTargetType) { abilityItem.AddLine("Target type: " + ability.TargetType, ability.TargetType); abilityItem.AddLine("Target team type: " + ability.TargetTeamType, ability.TargetTeamType); } if (this.showSpecialData) { abilityItem.AddLine("Special data =>"); foreach (var abilitySpecialData in ability.AbilitySpecialData.Where(x => !x.Name.StartsWith("#"))) { var values = new StringBuilder(); var count = abilitySpecialData.Count; for (uint i = 0; i < count; i++) { values.Append(abilitySpecialData.GetValue(i)); if (i < count - 1) { values.Append(", "); } } abilityItem.AddLine(" " + abilitySpecialData.Name + ": " + values, abilitySpecialData.Name); } } this.log.Display(abilityItem); } this.log.Display(item); }); }