public CombatLogPacket(CombatLogType type, Unit target, Unit source = null, Module module = null) : this() { AppendInt((int)type); var srcEid = source?.Eid ?? 0L; var srcCharacter = source.GetCharacter(); AppendLong(srcEid); AppendInt(srcCharacter.Id); AppendLong(target.Eid); var targetCharacter = target.GetCharacter(); AppendInt(targetCharacter.Id); if (module != null) { AppendInt(module.Definition); AppendLong(module.Eid); AppendByte((byte)module.Slot); } else { AppendInt(0); AppendLong(0); AppendByte(0); } }
private static Brush GetCombatLogColor(CombatLogType combatLogType) { return(combatLogType switch { CombatLogType.BasicDamage => Brushes.Red, CombatLogType.SpellUsage => Brushes.Blue, CombatLogType.StatChange => Brushes.Orange, _ => Brushes.Black, });
private void OnMessageReceived(CombatLogType type, string msg) { Application.Current.Dispatcher.Invoke(() => { new TextRange(CombatLogTextBox.Document.ContentEnd, CombatLogTextBox.Document.ContentEnd) { Text = $"{msg}{Environment.NewLine}" }.ApplyPropertyValue(TextElement.ForegroundProperty, GetCombatLogColor(type)); CombatLogTextBox.ScrollToEnd(); }); }
internal void DestroyCard(UInt64 guid, byte damage, CombatLogType combatLogType, bool isPeriodicDamage) { if (cards.TryGetValue(guid, out var card)) { if (isPeriodicDamage) { Game.CombatLog.LogPeriodicDamage(card.Name, damage, false); } else { Game.CombatLog.LogDamage(combatLogType, Game.GetOpponent(Id).ActiveCard?.Name, card.Name, damage, false); } cards.Remove(guid); } }
internal void AttackCard(UInt64 guid, byte damage, CombatLogType combatLogType, bool isPeriodicDamage) { InvokeCardAction(guid, card => { card.Health -= damage; if (isPeriodicDamage) { Game.CombatLog.LogPeriodicDamage(card.Name, damage, true); } else { Game.CombatLog.LogDamage(combatLogType, Game.GetOpponent(Id).ActiveCard?.Name, card.Name, damage, true); } }); }
internal void LogDamage(CombatLogType combatLogType, string attackerName, string victimName, byte damage, bool alive) { var message = string.Format(alive ? Texts.CardDamaged : Texts.CardKilled, attackerName, victimName, damage); MessageReceived?.Invoke(combatLogType, message); }