public static void HandleInput() { if (!GameInput.GetControlkey() || !GameInput.GetKeyUp(KeyCode.K) || !GameCursor.CharacterUnderCursor) { return; } var stats = GameCursor.CharacterUnderCursor.GetComponent <CharacterStats>(); if (!stats) { return; } var ai = GameCursor.CharacterUnderCursor.GetComponent <AIController>(); var message = new Console.ConsoleMessage($"Stats for {stats.Name()}, click to expand...", Console.ConsoleState.Combat); message.Children = new List <Console.ConsoleMessage>(); message.Children.Add(new Console.ConsoleMessage("Basic stats", DumpBasicStats(stats), Console.ConsoleState.Combat)); message.Children.Add(new Console.ConsoleMessage($"Status effects ({stats.ActiveStatusEffects.Count})", DumpStatusEffects(stats), Console.ConsoleState.Combat)); message.Children.Add(new Console.ConsoleMessage($"Abilities ({stats.ActiveAbilities.Count})", DumpAbilities(stats), Console.ConsoleState.Combat)); if (ai?.StateManager != null) { message.Children.Add(new Console.ConsoleMessage("AI state", DumpAIState(ai), Console.ConsoleState.Combat)); } Console.Instance.AddMessage(message); }
private LinkedList <string> CallChildren(Console.ConsoleMessage message, CombatConfiguration configuration, LinkedList <string> accumulator) { if (!message.IsVerboseEmpty) { string basic = ReplaceTags(message.m_message, configuration); string advanced = ReplaceTags(message.m_verbosemessage, configuration); accumulator.AddLast($"Combat message:\n{basic}Tooltip:\n{advanced}"); } else { accumulator.AddLast(ReplaceTags(message.m_message, configuration)); } Main.Log(accumulator.Last.Value); if (message.Children?.Count > 0) { foreach (Console.ConsoleMessage childMessage in message.Children) { accumulator = CallChildren(childMessage, configuration, accumulator); } } return(accumulator); }
/// <summary> /// Return both the basic and tooltip combat information /// </summary> /// <param name="message">The combat message</param> /// <param name="configuration">The configuration for the combat log exporter</param> /// <returns>The formated combat message</returns> public override string HandleMessage(Console.ConsoleMessage message, CombatConfiguration configuration) { LinkedList <string> stringList = new LinkedList <string>(); LinkedList <string> listOfStrings = CallChildren(message, configuration, stringList); return(string.Join("\n", listOfStrings.ToArray())); }
/// <summary> /// Add a combat message to the stringbuilder /// </summary> /// <param name="message">The message that is to be added</param> public void AddMessage(Console.ConsoleMessage message) { try { if (Main.enabled && InCombat && message.m_mode == Console.ConsoleState.COMBAT) { String handledMessage = combatReporting.HandleMessage(message, Main.settings.Configuration); if (!string.IsNullOrEmpty(handledMessage)) { CombatLogStringBuilder.Append(handledMessage); } } } catch (Exception ex) { Main.LogError(ex); } }
static void Prefix(Console.ConsoleMessage message) { CombatLogExporterManager.Instance.AddMessage(message); }
/// <summary> /// Recieve and format the combat message /// </summary> /// <param name="messageAsString">The message to format</param> /// <param name="configuration">The configuration for the combat log exporter</param> /// <returns>The message correctly formatted</returns> public abstract String HandleMessage(Console.ConsoleMessage message, CombatConfiguration configuration);
/// <summary> /// Return the basic combat information /// </summary> /// <param name="message">The combat message</param> /// <param name="configuration">The configuration for the combat log exporter</param> /// <returns>The formated combat message</returns> public override string HandleMessage(Console.ConsoleMessage message, CombatConfiguration configuration) { return(ReplaceTags(message.m_message, configuration)); }