namespace Aeshnidae.Healing; /// /healing for staff and the console: the settings, the counts, and every online player's vitals and factors. public static class Commands { [CommandHandler("healing", AccessLevel.Admin, CommandHandlerFlag.None, 0, "Heals that scale with the vital healed: status, and every online player's maximum vitals and factor. Console-safe.", "/healing settings, counts, and each online player's max health/stamina/mana and heal factor\n" + "/healing reload re-read Settings.json\n" + "/healing selftest [wcid] staging: heal spells on an off-world creature, retail vs x3, and harm untouched")] public static void HandleHealing(Session session, params string[] parameters) { if (parameters.Length > 0 && parameters[0].Equals("selftest", StringComparison.OrdinalIgnoreCase)) { var wcid = parameters.Length > 1 && uint.TryParse(parameters[1], out var w) ? w : 11989u; // Drudge Vagabond Reply(session, SelfTest.Run(wcid)); return; } if (parameters.Length > 0 && parameters[0].Equals("reload", StringComparison.OrdinalIgnoreCase)) { Mod.ReloadSettings(); Reply(session, "settings re-read"); } var s = Mod.Settings; var sb = new StringBuilder(); sb.AppendLine($"Healing {(s.Enabled ? "ON" : "off")}: references health {s.ReferenceHealth:N0}, stamina {s.ReferenceStamina:N0}, mana {s.ReferenceMana:N0}" + $"{(s.MaxFactor > 0 ? $", factor at most {s.MaxFactor}" : "")}; kits {(s.ScaleKits ? "on" : "off")}, spells {(s.ScaleSpells ? "on" : "off")}, " + $"mana {(s.ScaleMana ? "on" : "off")}, monster heals {(s.ScaleMonsterHeals ? "on" : "off")}"); sb.AppendLine($" since load: {Scaling.KitsScaled} kit heal(s) and {Scaling.SpellsScaled} spell heal(s) scaled above retail"); var players = PlayerManager.GetAllOnline().OrderByDescending(p => p.Level ?? 0).ToList(); foreach (var p in players) { sb.AppendLine($" {p.Name} (level {p.Level}): health {p.Health.MaxValue} (x{Scaling.Factor(p, PropertyAttribute2nd.MaxHealth):0.##}), " + $"stamina {p.Stamina.MaxValue} (x{Scaling.Factor(p, PropertyAttribute2nd.MaxStamina):0.##}), mana {p.Mana.MaxValue}"); } if (players.Count == 0) sb.AppendLine(" nobody online to measure"); Reply(session, sb.ToString()); } private static void Reply(Session? session, string message) { foreach (var line in (message ?? "").Split('\n')) { var text = line.TrimEnd('\r'); if (string.IsNullOrWhiteSpace(text)) continue; if (session?.Player is null) ModManager.Log(text); else session.Player.SendMessage(text); } } }