using System; using System.Collections.Generic; using System.Linq; using Turbo.Plugins.Default; namespace Turbo.Plugins.glq { public class EliteHealthListPlugin : BasePlugin, IInGameWorldPainter { //作者:我想静静 修改:小米 public IFont TextFont { get; set; } public IBrush BorderBrush { get; set; } public IBrush BackgroundBrush { get; set; } public IBrush RareBrush { get; set; } public IBrush ChampionBrush { get; set; } public EliteHealthListPlugin() { Enabled = true; } public override void Load(IController hud) { base.Load(hud); TextFont = Hud.Render.CreateFont("tahoma", 6, 180, 255, 255, 255, false, false, true); BorderBrush = Hud.Render.CreateBrush(120, 50, 205, 50, 1); BackgroundBrush = Hud.Render.CreateBrush(120, 0, 0, 0, 0); RareBrush = Hud.Render.CreateBrush(120, 255, 128, 0, 0); ChampionBrush = Hud.Render.CreateBrush(120, 0, 128, 255, 0); } public void PaintWorld(WorldLayer layer) { var monsters = Hud.Game.AliveMonsters; Dictionary eliteGroup = new Dictionary(); foreach (var monster in monsters) { if (monster.Rarity == ActorRarity.Champion || monster.Rarity == ActorRarity.Rare) { eliteGroup.Add(monster, String.Join(", ", monster.AffixSnoList)); } } Dictionary eliteGroup1 = eliteGroup.OrderBy(p => p.Value).ToDictionary(p => p.Key, o => o.Value); var px = Hud.Window.Size.Width * 0.00125f; var py = Hud.Window.Size.Height * 0.001667f; var h = py * 5; var w2 = py * 50; var count = 0; string preStr = null; //remove clone foreach (var elite in eliteGroup1) { bool illusionist = false; if(elite.Key.SummonerAcdDynamicId == 0) { illusionist = false; } else { illusionist = true; } if (elite.Key.Rarity == ActorRarity.Champion) { if (illusionist == false) { var w = elite.Key.CurHealth * w2 / elite.Key.MaxHealth; var text = (elite.Key.CurHealth * 100 / elite.Key.MaxHealth).ToString("f0"); var layout = TextFont.GetTextLayout(text); if (preStr != elite.Value || preStr == null) count++; var y = py * 8 * count; //BorderBrush.DrawRectangle(x, y, 70, h); BackgroundBrush.DrawRectangle(Hud.Window.Size.Width * 0.125f, y, w2, h); TextFont.DrawText(layout, Hud.Window.Size.Width * 0.125f + px + w2, y - py); ChampionBrush.DrawRectangle(Hud.Window.Size.Width * 0.125f, y, (float)w, h); preStr = elite.Value; count++; } } if (elite.Key.Rarity == ActorRarity.Rare) { if (illusionist == false) { var w = elite.Key.CurHealth * w2 / elite.Key.MaxHealth; var text = (elite.Key.CurHealth * 100 / elite.Key.MaxHealth).ToString("f0"); var layout = TextFont.GetTextLayout(text); if (preStr != elite.Value || preStr == null) count++; var y = py * 8 * count; //BorderBrush.DrawRectangle(x, y, 70, h); BackgroundBrush.DrawRectangle(Hud.Window.Size.Width * 0.125f, y, w2, h); TextFont.DrawText(layout, Hud.Window.Size.Width * 0.125f + px + w2, y - py); RareBrush.DrawRectangle(Hud.Window.Size.Width * 0.125f, y, (float)w, h); preStr = elite.Value; count++; } } } eliteGroup.Clear(); } } }