public void PaintTopInGame(ClipState clipState) { if (clipState != ClipState.AfterClip) { return; } //if (!Visible) return; if (!Hud.Input.IsKeyDown(Keys.V)) { return; } var s = Hud.Window.Size; var text = string.Format(CultureInfo.InvariantCulture, "{0}x{1}\nX: {2,4}\nY: {3,4}", s.Width, s.Height, string.Format(CultureInfo.InvariantCulture, "{0} px | % : {1}f", Hud.Window.CursorX, Hud.Window.CursorX / (float)s.Width), string.Format(CultureInfo.InvariantCulture, "{0} px | % : {1}f", Hud.Window.CursorY, Hud.Window.CursorY / (float)s.Height) ); var layout = TextFont.GetTextLayout(text); var h = layout.Metrics.Height; var w = layout.Metrics.Width; var offsetX = Hud.Window.CursorX + (int)(s.Width / 2 > Hud.Window.CursorX ? Offset : -w - Offset); var offsetY = Hud.Window.CursorY + (int)(s.Height / 2 > Hud.Window.CursorY ? Offset : -h - Offset); BackgroundBrush.DrawRectangle(offsetX - Padding, offsetY - Padding, w + Padding * 2, h + Padding * 2); TextFont.DrawText(layout, offsetX, offsetY); }
private float DrawPluginsBlock2(IEnumerable <IPlugin> plugins, float rowHeaderX, float x, float _y, float _w, float h, string format = "{0} ({1}):") { BackgroundBrush.DrawRectangle(rowHeaderX - rowHeaderSpacer, _y, rowHeaderSpacer + _w, h * plugins.Count()); foreach (var plugin in plugins) { var layout = UsageLowFont.GetTextLayout(string.Format(format, plugin.GetType().Name.Replace("Plugin", ""), plugin.ToString().Split('.')[2])); //layout = UsageLowFont.GetTextLayout(string.Format("{0} :", plugin.ToString())); BackgroundBrush.DrawRectangle(rowHeaderX - rowHeaderSpacer - layout.Metrics.Width, _y, layout.Metrics.Width, layout.Metrics.Height); UsageLowFont.DrawText(layout, rowHeaderX - layout.Metrics.Width - rowHeaderSpacer, _y); var _x = x; foreach (var counter in Columns.Select(counterKey => plugin.PerformanceCounters.Where(c => c.Key == counterKey).Select(c => c.Value).FirstOrDefault())) { if (counter != null && counter.LastValue > 0) { //var text = string.Format(CultureInfo.InvariantCulture, "{0:0.##}/{1:0.##}", counter.LastValue, counter.LastCount); var text = counter.LastValue.ToString("0.##", CultureInfo.InvariantCulture); (counter.LastValue <= HighUsageThreshold ? UsageLowFont : UsageHighFont).DrawText(text, _x, _y); } _x -= columnWidth; } _y += layout.Metrics.Height; } if (plugins.Any()) { _y += h / 2; } return(_y); }
private void PaintBuff(BuffPaintInfo info, float x, float y, float w, float h, IBrush brush) { if (Opacity == 0) { return; } //Draw backbround bar BackgroundBrush.Opacity = Opacity; BackgroundBrush.DrawRectangle(x, y, w, h); //Draw cooldown Bar brush.Opacity = Opacity; brush.DrawRectangle(x, y, (float)(w * info.TimeLeft / (info.TimeLeft + info.Elapsed)), h); //Draw time left number if (ShowTimeLeftNumbers) { var text = ""; if (info.TimeLeft > 1) { text = info.TimeLeft.ToString("F0", CultureInfo.InvariantCulture); } else { text = info.TimeLeft.ToString("F1", CultureInfo.InvariantCulture); } var layout = TimeLeftFont.GetTextLayout(text); TimeLeftFont.Opacity = Opacity; TimeLeftFont.DrawText(layout, x + (w - (float)Math.Ceiling(layout.Metrics.Width)) / 2.0f, y + (h - layout.Metrics.Height) / 2); } }
private void DrawHealthBar(WorldLayer layer, IMonster m, ref float yref) { var w = m.CurHealth * w2 / m.MaxHealth; var per = LightFont.GetTextLayout((m.CurHealth * 100 / m.MaxHealth).ToString(PercentageDescriptor) + "%"); var y = YPos + py * 8 * yref; IBrush cBrush = null; IFont cFont = null; //Brush selection switch (m.Rarity) { case ActorRarity.Boss: cBrush = BossBrush; break; case ActorRarity.Champion: cBrush = ChampionBrush; break; case ActorRarity.Rare: cBrush = RareBrush; break; case ActorRarity.RareMinion: cBrush = RareMinionBrush; break; default: cBrush = BackgroundBrush; break; } //Jugger Highlight if (JuggernautHighlight && m.Rarity == ActorRarity.Rare && HasAffix(m, MonsterAffix.Juggernaut)) { cFont = RedFont; cBrush = RareJuggerBrush; } else { cFont = NameFont; } //Draw Rectangles BackgroundBrush.DrawRectangle(XPos, y, w2, h); BorderBrush.DrawRectangle(XPos, y, w2, h); cBrush.DrawRectangle(XPos, y, (float)w, h); LightFont.DrawText(per, XPos + 8 + w2, y - py); //Draw MonsterType if (ShowMonsterType) { var name = cFont.GetTextLayout(m.SnoMonster.NameLocalized); cFont.DrawText(name, XPos + 3, y - py); } //increase linecount yref += 1.0f; }
public void PaintExpandedHint(float x, float y, float w, float h, HorizontalAlign align) { if (!Enabled) { return; } if (ExpandedHintFont == null) { return; } var hint = HintFunc != null?HintFunc.Invoke() : null; if (string.IsNullOrEmpty(hint)) { return; } if (BackgroundTexture1 != null) { BackgroundTexture1.Draw(x, y, w, h, BackgroundTextureOpacity1); } if (BackgroundTexture2 != null) { BackgroundTexture2.Draw(x, y, w, h, BackgroundTextureOpacity2); } if (BackgroundBrush != null) { BackgroundBrush.DrawRectangle(x, y, w, h); } var layout = ExpandedHintFont.GetTextLayout(hint); switch (align) { case HorizontalAlign.Left: ExpandedHintFont.DrawText(layout, x, y + (h - layout.Metrics.Height) / 2); break; case HorizontalAlign.Center: ExpandedHintFont.DrawText(layout, x + (w - layout.Metrics.Width) / 2, y + (h - layout.Metrics.Height) / 2); break; case HorizontalAlign.Right: ExpandedHintFont.DrawText(layout, x + w - layout.Metrics.Width, y + (h - layout.Metrics.Height) / 2); break; } if (BorderBrush != null) { BorderBrush.DrawRectangle(x, y, w, h); } }
public void Paint(float x, float y, float w, float h, string text, string title = null, string hint = null) { if (!Enabled) { return; } if (TextFont == null) { return; } var displaySize = Hud.Window.Size; var screenBorderPadding = 0.0f; if (BorderBrush != null) { screenBorderPadding += BorderBrush.RealStrokeWidth; } var layout = TextFont.GetTextLayout(text); var rect = new RectangleF(x, y, w, h); if (!string.IsNullOrEmpty(hint) && Hud.Window.CursorInsideRect(x, y, w, h)) { Hud.Render.SetHint(hint); } if (BackgroundBrush != null) { BackgroundBrush.DrawRectangle(rect); } var realY = y; if ((TitleFont != null) && (BorderBrush != null) && !string.IsNullOrEmpty(title)) { var titleLayout = TitleFont.GetTextLayout(title); var pad = 3 * Hud.Window.Size.Height / 1200.0f; realY = y + pad + titleLayout.Metrics.Height + pad; BorderBrush.DrawLine(x, realY, x + w, realY); TitleFont.DrawText(titleLayout, x + (w - titleLayout.Metrics.Width) / 2, y + pad); } TextFont.DrawText(layout, x + (w - layout.Metrics.Width) / 2, realY + (h - (realY - y) - layout.Metrics.Height) / 2); if (BorderBrush != null) { BorderBrush.DrawRectangle(rect); } }
private void DrawHeaderLine(float x, float y, float columnHeaderWidth, IEnumerable <IItem> items) { var width = columnHeaderWidth; var rect = new RectangleF(x - width, y, width, width * 2); foreach (var location in ItemLocations) { var item = items.FirstOrDefault(i => i.Location == location); if (item != null) { var bgTex = Hud.Texture.GetItemBackgroundTexture(item); if (bgTex.Width == bgTex.Height) { rect.Y = y + width; rect.Height = width; BackgroundBrush.DrawRectangle(rect); } else { rect.Y = y; rect.Height = width * 2; } ItemRenderer.RenderItem(item, rect); var ancientRank = item.AncientRank; if (ancientRank >= 1) { var ancientRankText = ancientRank == 1 ? "A" : "P"; var font = ancientRank == 1 ? AncientRankFont : PrimalRankFont; var textRank = ancientRankText + (item.CaldesannRank > 0 ? ("+" + item.CaldesannRank.ToString("D", CultureInfo.InvariantCulture)) : ""); var textLayout = font.GetTextLayout(textRank); font.DrawText(textLayout, rect.Right - textLayout.Metrics.Width - 4, rect.Bottom - textLayout.Metrics.Height - 2); } var text = string.Format("{0:0.#} %", item.Perfection); var layout = TextFont.GetTextLayout(text); var brushIndex = (int)Math.Round(item.Perfection / 100 * (float)(gradientBrushes.Count - 1)); if (brushIndex >= 0 && brushIndex < gradientBrushes.Count) { gradientBrushes[brushIndex].DrawRectangle(rect.X, rect.Y - layout.Metrics.Height, columnHeaderWidth, layout.Metrics.Height); } TextFont.DrawText(layout, rect.X + columnHeaderWidth / 2 - layout.Metrics.Width / 2, rect.Y - layout.Metrics.Height); } rect.X -= width + 1; } }
public void Paint(float x, float y) { if (!Enabled) { return; } if (BarBrush == null) { return; } if (data.Count == 0) { return; } using (var pg = Hud.Render.CreateGeometry()) { using (var gs = pg.Open()) { BackgroundBrush.DrawRectangle(x, y, Width, Height); var max = Equals(ForcedMax, 0) ? data.Max() : ForcedMax; var startPoint = new Vector2(x, y); gs.BeginFigure(startPoint, FigureBegin.Filled); var vect = new Vector2(x, y + Height); gs.AddLine(vect); for (var xx = 0; xx < data.Count; xx++) { var yy = Height * GetHeight(data[xx], max); if (yy < 0) { yy = 0; } vect = new Vector2(x + xx, y + Height - yy); gs.AddLine(vect); } gs.AddLine(new Vector2(x + data.Count - 1, y + Height)); gs.AddLine(new Vector2(x, y + Height)); gs.EndFigure(FigureEnd.Closed); gs.Close(); } BarBrush.DrawGeometry(pg); } }
public void Paint(IEnumerable <ISnoPower> powers, float x, float y, int textLenght = 25) { BackgroundBrush.DrawRectangle(0, 0, Hud.Window.Size.Width, Hud.Window.Size.Height); foreach (var power in powers) { Paint(power, x, y, textLenght); y += StandardIconSize + StandardIconSpacing; if (!(y > Hud.Window.Size.Height * 0.98f)) { continue; } y = 0; x += Hud.Window.Size.Width * ColumnWidthRatio; } }
public void Paint(float x, float y, float w, float h, string text, HorizontalAlign align = HorizontalAlign.Center) { if (TextFont == null) { return; } if (BackgroundBrush != null) { BackgroundBrush.DrawRectangle(x, y, w, h); } if (!string.IsNullOrEmpty(text)) { var layout = TextFont.GetTextLayout(text); var layoutChar = TextFont.GetTextLayout(":"); switch (align) { case HorizontalAlign.Left: TextFont.DrawText(layout, x + layoutChar.Metrics.Width, y + (h - layout.Metrics.Height) / 2); break; case HorizontalAlign.Center: TextFont.DrawText(layout, x + (w - layout.Metrics.Width) / 2, y + (h - layout.Metrics.Height) / 2); break; case HorizontalAlign.Right: TextFont.DrawText(layout, x + w - layout.Metrics.Width - layoutChar.Metrics.Width, y + (h - layout.Metrics.Height) / 2); break; } } if (BorderBrush != null) { BorderBrush.DrawRectangle(x, y, w, h); } }
public void Paint(ISnoPower power, float x, float y, int textLenght = 25) { var name = string.Empty; var items = power.GetItemSnos(); if (items.Any(xx => xx != 0) && string.IsNullOrWhiteSpace(power.NameEnglish)) { //name = Hud.Inventory.GetSnoItem(items.First()).NameEnglish; var item = Hud.Inventory.GetSnoItem(items.First()); name = item == null?power.Sno.ToString() : item.NameEnglish; } else { name = string.IsNullOrWhiteSpace(power.NameEnglish) ? power.Sno.ToString() : power.NameEnglish; } if (name.Length > textLenght) { name = name.Substring(0, textLenght); } var layout = TextFont.GetTextLayout(string.Format("{0,25} Ic:", name)); var layoutSpacer = TextFont.GetTextLayout(":"); TextFont.DrawText(layout, x, y); if (Hud.Window.CursorInsideRect(x, y, layout.Metrics.Width, layout.Metrics.Height)) { Hud.Render.SetHint(power.Sno + " : " + power.Code + " : " + power.DescriptionEnglish); } x += layout.Metrics.Width + layoutSpacer.Metrics.Width * 2; if (power.NormalIconTextureId != 0) { var texture = Hud.Texture.GetTexture(power.NormalIconTextureId); if (texture != null) { texture.Draw(x, y, StandardIconSize, StandardIconSize); } else { BackgroundBrush.DrawRectangle(x, y, StandardIconSize, StandardIconSize); } if (Hud.Window.CursorInsideRect(x, y, StandardIconSize, StandardIconSize)) { Hud.Render.SetHint("TextureId : " + power.NormalIconTextureId); } x += StandardIconSize + StandardIconSpacing; } foreach (var icon in power.Icons.Where(xxx => xxx.Exists && xxx.TextureId != 0 && xxx.TextureId != power.NormalIconTextureId).Select(xxx => xxx.TextureId).Distinct()) { var texture = Hud.Texture.GetTexture(icon); if (texture != null) { texture.Draw(x, y, StandardIconSize, StandardIconSize); } else { BackgroundBrush.DrawRectangle(x, y, StandardIconSize, StandardIconSize); } if (Hud.Window.CursorInsideRect(x, y, StandardIconSize, StandardIconSize)) { Hud.Render.SetHint("TextureId : " + icon); } x += StandardIconSize + StandardIconSpacing; } layout = TextFont.GetTextLayout(" It:"); TextFont.DrawText(layout, x, y); x += layout.Metrics.Width + layoutSpacer.Metrics.Width; foreach (var sno in items) { if (sno == 0) { continue; } var item = Hud.Inventory.GetSnoItem(sno); if (item == null) { continue; } var brush = item.SetItemBonusesSno == uint.MaxValue ? LegendaryBackgroundBrush : SetBackgroundBrush; brush.DrawRectangle(x, y, StandardIconSize, StandardIconSize); var texture = Hud.Texture.GetItemTexture(item); if (texture != null) { texture.Draw(x, y, StandardIconSize, StandardIconSize); } else { BackgroundBrush.DrawRectangle(x, y, StandardIconSize, StandardIconSize); } if (Hud.Window.CursorInsideRect(x, y, StandardIconSize, StandardIconSize)) { Hud.Render.SetHint(item.NameEnglish + " : " + item.Sno + " : i" + item.Level + " : " + item.SetItemBonusesSno); } x += StandardIconSize + StandardIconSpacing; } }
public void PaintWorld(WorldLayer layer) { var h = 17; var w1 = 30; var textLocust = "L"; var layoutLocust = TextFontLocust.GetTextLayout(textLocust); var textHaunt = "H"; var layoutHaunt = TextFontHaunt.GetTextLayout(textHaunt); var py = Hud.Window.Size.Height / 600; var monsters = Hud.Game.AliveMonsters.Where(x => x.IsAlive); List <IMonster> monstersElite = new List <IMonster>(); foreach (var monster in monsters) { if (monster.SummonerAcdDynamicId == 0) { if (monster.Rarity == ActorRarity.Champion || monster.Rarity == ActorRarity.Rare) { monstersElite.Add(monster); } } } foreach (var monster in monstersElite) { var hptext = ValueToString(monster.CurHealth * 100 / monster.MaxHealth, ValueFormat.NormalNumberNoDecimal); var layout = TextFont.GetTextLayout(hptext); var w = monster.CurHealth * w1 / monster.MaxHealth; var monsterX = monster.FloorCoordinate.ToScreenCoordinate().X - w1 / 2; var monsterY = monster.FloorCoordinate.ToScreenCoordinate().Y + py * 12; var locustX = monsterX - w1 / 2; var hauntX = monsterX + w1 + 5; var buffY = monsterY - 1; var hpX = monsterX + 7; BorderBrush.DrawRectangle(monsterX, monsterY, w1, h); BackgroundBrush.DrawRectangle(monsterX, monsterY, w1, h); if (monster.Rarity == ActorRarity.Champion) { ChampionBrush.DrawRectangle(monsterX, monsterY, (float)w, h); } if (monster.Rarity == ActorRarity.Rare) { bool flagJ = false; foreach (var snoMonsterAffix in monster.AffixSnoList) { if (snoMonsterAffix.Affix == MonsterAffix.Juggernaut) { flagJ = true; break; } } if (flagJ) { RareJBrush.DrawRectangle(monsterX, monsterY, (float)w, h); } else { RareBrush.DrawRectangle(monsterX, monsterY, (float)w, h); } } if (monster.Locust) { TextFontLocust.DrawText(layoutLocust, locustX, buffY); } if (monster.Haunted) { TextFontHaunt.DrawText(layoutHaunt, hauntX, buffY); } TextFont.DrawText(layout, hpX, buffY); } monstersElite.Clear(); }
public void PaintWorld(WorldLayer layer) { var monsters = Hud.Game.AliveMonsters; Dictionary <IMonster, string> eliteGroup = new Dictionary <IMonster, string>(); foreach (var monster in monsters) { if (monster.Rarity == ActorRarity.Champion || monster.Rarity == ActorRarity.Rare) { eliteGroup.Add(monster, String.Join(", ", monster.AffixSnoList)); } } Dictionary <IMonster, string> 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 x = Hud.Window.Size.Width * 0.125f; 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; if (elite.Key.Invulnerable) { BorderBrush.DrawRectangle(x, y, w2, h); } BackgroundBrush.DrawRectangle(x, y, w2, h); TextFont.DrawText(layout, x + px + w2, y - py); ChampionBrush.DrawRectangle(x, y, (float)w, h); preStr = elite.Value; count++; } } if (elite.Key.Rarity == ActorRarity.Rare) { if (illusionist == false) { var x = Hud.Window.Size.Width * 0.125f; 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; if (elite.Key.Invulnerable) { BorderBrush.DrawRectangle(x, y, w2, h); } BackgroundBrush.DrawRectangle(x, y, w2, h); TextFont.DrawText(layout, x + px + w2, y - py); RareBrush.DrawRectangle(x, y, (float)w, h); preStr = elite.Value; count++; } } } eliteGroup.Clear(); }
public void PaintTopInGame(ClipState clipState) { if (Hud.Render.UiHidden) { return; } float x = Hud.Window.Size.Width * 0.42f; float y = Hud.Window.Size.Height * 0.11f; float sizex = Hud.Window.Size.Width * 0.16f; float sizey = Hud.Window.Size.Height * 0.02f; float textx = Hud.Window.Size.Width * 0.498f; float texty = Hud.Window.Size.Height * 0.111f; float MeteorOcux = Hud.Window.Size.Width * 0.505f; float MeteorOcuy = Hud.Window.Size.Height * 0.131f; float Meteorx = Hud.Window.Size.Width * 0.421f; float Meteory = Hud.Window.Size.Height * 0.131f; textBuilder.Clear(); var ATleft = (ArchonLeft - Hud.Game.CurrentGameTick) / 60.0d; WizIngame = false; foreach (var player in Hud.Game.Players) { if (player.HeroClassDefinition.HeroClass == HeroClass.Wizard) { WizIngame = true; foreach (var i in _skillOrder) { var skill = player.Powers.SkillSlots[i]; if (skill == null || skill.SnoPower.Sno != 134872) { continue; //Archon } Cooldown = (skill.CooldownFinishTick - Hud.Game.CurrentGameTick) / 60.0d; var buff = player.Powers.GetBuff(Hud.Sno.SnoPowers.Wizard_Archon.Sno); if (buff != null) { ArchonTimeLeft = buff.TimeLeftSeconds[2]; if (player.HasValidActor && buff.TimeLeftSeconds[2] > 0.0) { ArchonLeft = Hud.Game.CurrentGameTick + ArchonTimeLeft * 60.0d; } } ATleft = (ArchonLeft - Hud.Game.CurrentGameTick) / 60.0d; if (ATleft > 0) { textBuilder.AppendFormat("{0:0}", ATleft); } else { textBuilder.AppendFormat("{0:0}", 12.0 + ATleft); } // DEBUG /* * textBuilder.AppendLine(); * textBuilder.AppendFormat("{0:0.00}", ATleft); * textBuilder.AppendLine(); * textBuilder.AppendFormat("{0:0.00}", ArchonLeft);*/ } } } if (WizIngame) { if (ATleft <= 0.0) //outside { if (ATleft >= -12.0) //not bugged { BackgroundBrush.DrawRectangle(x, y, sizex, sizey); TimerOutsideBrush.DrawRectangle(x, y, sizex * (float)((12.0 + ATleft) / 12.0), sizey); BorderBrush.DrawLine(x, y, x + sizex, y, 0.6f); BorderBrush.DrawLine(x + sizex, y, x + sizex, y + sizey, BorderSize); BorderBrush.DrawLine(x, y + sizey, x + sizex, y + sizey, BorderSize); BorderBrush.DrawLine(x, y, x, y + sizey, 0.6f); Hud.Texture.GetTexture(Hud.Sno.GetSnoPower(69190).NormalIconTextureId).Draw(MeteorOcux, MeteorOcuy, 28.0f, 28.0f); //Wizard_Meteor { get; } // 69190 Hud.Texture.GetTexture(Hud.Sno.GetSnoPower(69190).NormalIconTextureId).Draw(Meteorx, Meteory, 28.0f, 28.0f); //Wizard_Meteor { get; } // 69190 } var layout = RedFont.GetTextLayout(textBuilder.ToString()); RedFont.DrawText(layout, textx, texty); } else//in archon { if (ATleft <= 20)//not bugged { BackgroundBrush.DrawRectangle(x, y, sizex, sizey); if (ATleft >= 5.0) { TimerArchonBrush.DrawRectangle(x, y, sizex * (float)(ATleft / 20.0), sizey); } else { TimerArchonWarningBrush.DrawRectangle(x, y, sizex * (float)(ATleft / 20.0), sizey); } BorderBrush.DrawLine(x, y, x + sizex, y, 0.6f); BorderBrush.DrawLine(x + sizex, y, x + sizex, y + sizey, BorderSize); BorderBrush.DrawLine(x, y + sizey, x + sizex, y + sizey, BorderSize); BorderBrush.DrawLine(x, y, x, y + sizey, 0.6f); } var layout = GreenFont.GetTextLayout(textBuilder.ToString()); GreenFont.DrawText(layout, textx, texty); } } }
public void PaintWorld(WorldLayer layer) { var monsters = Hud.Game.AliveMonsters; Dictionary <IMonster, string> eliteGroup = new Dictionary <IMonster, string>(); foreach (var monster in monsters) { if (monster.Rarity == ActorRarity.Champion || monster.Rarity == ActorRarity.Rare) { if (eliteGroup.ContainsKey(monster)) { eliteGroup[monster] = monster.SnoMonster.Priority.ToString() + monster.SnoMonster.Sno + monster.SnoMonster.NameEnglish + String.Join(", ", monster.AffixSnoList); } else { eliteGroup.Add(monster, monster.SnoMonster.Priority.ToString() + monster.SnoMonster.Sno + monster.SnoMonster.NameEnglish + String.Join(", ", monster.AffixSnoList)); } } } Dictionary <IMonster, string> 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) { if (elite.Key.Illusion) { continue; } if (elite.Key.Rarity == ActorRarity.Champion) { var x = Hud.Window.Size.Width * 0.125f; var w = elite.Key.CurHealth * w2 / elite.Key.MaxHealth; var affixlist = ""; foreach (var Affix in elite.Key.AffixSnoList) { affixlist = affixlist + " " + Affix.NameLocalized; } var text = (elite.Key.CurHealth * 100 / elite.Key.MaxHealth).ToString("f1") + "% " + elite.Key.SnoMonster.NameLocalized + affixlist; var layout = TextFont.GetTextLayout(text); if (preStr != elite.Value || preStr == null) { count++; } var y = py * 8 * count; if (elite.Key.Invulnerable) { BorderBrush.DrawRectangle(x, y, w2, h); } BackgroundBrush.DrawRectangle(x, y, w2, h); TextFont.DrawText(layout, x + px + w2, y - py); ChampionBrush.DrawRectangle(x, y, (float)w, h); preStr = elite.Value; count++; } if (elite.Key.Rarity == ActorRarity.Rare) { var x = Hud.Window.Size.Width * 0.125f; var w = elite.Key.CurHealth * w2 / elite.Key.MaxHealth; var affixlist = ""; foreach (var Affix in elite.Key.AffixSnoList) { affixlist = affixlist + " " + Affix.NameLocalized; } var text = (elite.Key.CurHealth * 100 / elite.Key.MaxHealth).ToString("f1") + "% " + elite.Key.SnoMonster.NameLocalized + affixlist; var layout = TextFont.GetTextLayout(text); if (preStr != elite.Value || preStr == null) { count++; } var y = py * 8 * count; if (elite.Key.Invulnerable) { BorderBrush.DrawRectangle(x, y, w2, h); } BackgroundBrush.DrawRectangle(x, y, w2, h); TextFont.DrawText(layout, x + px + w2, y - py); RareBrush.DrawRectangle(x, y, (float)w, h); preStr = elite.Value; count++; } } eliteGroup.Clear(); eliteGroup1.Clear(); }
public void PaintWorld(WorldLayer layer) { var players = Hud.Game.Players.Where(player => !player.IsMe && player.CoordinateKnown && (player.HeadStone == null)); foreach (var player in players) { if (player == null) { continue; } var ScreenWidth = Hud.Window.Size.Width; var ScreenHeight = Hud.Window.Size.Height; var HeroTexture = Hud.Texture.GetTexture(890155253); var HPbarWidth = (float)(ScreenWidth / 13); var HPbarHeight = (float)(ScreenHeight / 130); var ResbarWidth = (float)(ScreenWidth / 13); var ResbarHeight = (float)(ScreenHeight / 200); var CurRes = 0f; var CurRes2 = 0f; var ScreenCoordinate = player.FloorCoordinate.ToScreenCoordinate(); var PlayerX = ScreenCoordinate.X; var PlayerY = ScreenCoordinate.Y; if (HPbar == true) { var CurHealth = player.Defense.HealthCur / player.Defense.HealthMax; BorderBrush.DrawRectangle(PlayerX - (float)HPbarWidth / 2, PlayerY - (float)(ScreenHeight / 16) / 2, HPbarWidth, HPbarHeight); BackgroundBrush.DrawRectangle(PlayerX - (float)HPbarWidth / 2, PlayerY - (float)(ScreenHeight / 16) / 2, HPbarWidth, HPbarHeight); HPbarBrush.DrawRectangle(PlayerX - (float)HPbarWidth / 2, PlayerY - (float)(ScreenHeight / 16) / 2, HPbarWidth * CurHealth, HPbarHeight); } if (player.HeroClassDefinition.HeroClass.ToString() == "Barbarian") { if (Resbar == true) { CurRes = player.Stats.ResourceCurFury / player.Stats.ResourceMaxFury; BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight); FuryBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight); } if (player.HeroIsMale) { HeroTexture = Hud.Texture.GetTexture(3921484788); // male/female can't be determined, let's keep it for later... } else { HeroTexture = Hud.Texture.GetTexture(1030273087); } } else if (player.HeroClassDefinition.HeroClass.ToString() == "Crusader") { if (Resbar == true) { CurRes = player.Stats.ResourceCurWrath / player.Stats.ResourceMaxWrath; BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight); WrathBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight); } if (player.HeroIsMale) { HeroTexture = Hud.Texture.GetTexture(3742271755); } else { HeroTexture = Hud.Texture.GetTexture(3435775766); } } else if (player.HeroClassDefinition.HeroClass.ToString() == "DemonHunter") { if (Resbar == true) { CurRes = player.Stats.ResourceCurHatred / player.Stats.ResourceMaxHatred; CurRes2 = player.Stats.ResourceCurDiscipline / player.Stats.ResourceMaxDiscipline; BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight); HatreBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight); BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 40) / 1.45f, ResbarWidth, ResbarHeight); DisciplineBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 40) / 1.45f, ResbarWidth * CurRes2, ResbarHeight); } if (player.HeroIsMale) { HeroTexture = Hud.Texture.GetTexture(3785199803); } else { HeroTexture = Hud.Texture.GetTexture(2939779782); } } else if (player.HeroClassDefinition.HeroClass.ToString() == "Monk") { if (Resbar == true) { CurRes = player.Stats.ResourceCurSpirit / player.Stats.ResourceMaxSpirit; BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight); SpiritBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight); } if (player.HeroIsMale) { HeroTexture = Hud.Texture.GetTexture(2227317895); } else { HeroTexture = Hud.Texture.GetTexture(2918463890); } } else if (player.HeroClassDefinition.HeroClass.ToString() == "Necromancer") { if (Resbar == true) { CurRes = player.Stats.ResourceCurEssence / player.Stats.ResourceMaxEssence; BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight); EssenceBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight); } if (player.HeroIsMale) { HeroTexture = Hud.Texture.GetTexture(3285997023); } else { HeroTexture = Hud.Texture.GetTexture(473831658); } } else if (player.HeroClassDefinition.HeroClass.ToString() == "WitchDoctor") { if (Resbar == true) { CurRes = player.Stats.ResourceCurMana / player.Stats.ResourceMaxMana; BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight); ManaBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight); } if (player.HeroIsMale) { HeroTexture = Hud.Texture.GetTexture(3925954876); } else { HeroTexture = Hud.Texture.GetTexture(1603231623); } } else if (player.HeroClassDefinition.HeroClass.ToString() == "Wizard") { if (Resbar == true) { CurRes = player.Stats.ResourceCurArcane / player.Stats.ResourceMaxArcane; BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight); ArcaneBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight); } if (player.HeroIsMale) { HeroTexture = Hud.Texture.GetTexture(44435619); } else { HeroTexture = Hud.Texture.GetTexture(876580014); } } if (Tag == true) { string battleTag = player.BattleTagAbovePortrait; if (battleTag == null) { continue; } TagDecorator.TextFunc = () => battleTag.ToString(); var BattleTagTexture = Hud.Texture.GetTexture(3098562643); BattleTagTexture.Draw(PlayerX - (float)(ScreenWidth / 10) / 2, PlayerY - (float)(ScreenHeight / 7.8f) / 2, (float)(ScreenWidth / 10), (float)(ScreenHeight / 28), 0.7843f); HeroTexture.Draw(PlayerX - (float)(Hud.Window.Size.Height / 31) / 2, PlayerY - (float)(ScreenHeight / 6.1f) / 2, (float)(ScreenHeight / 31), (float)(Hud.Window.Size.Height / 31), 1f); TagDecorator.Paint(PlayerX - (float)(ScreenWidth / 11.5) / 2, PlayerY - (float)(ScreenHeight / 9.23f) / 2, (float)(ScreenWidth / 11.5), (float)(ScreenHeight / 45), HorizontalAlign.Center); } } }
public override void PaintWorld(WorldLayer layer) { var monsters = Hud.Game.AliveMonsters; Dictionary <IMonster, string> eliteGroup = new Dictionary <IMonster, string>(); foreach (var monster in monsters) { if (monster.Rarity == ActorRarity.Champion || monster.Rarity == ActorRarity.Rare) { eliteGroup.Add(monster, String.Join(", ", monster.AffixSnoList)); } } Dictionary <IMonster, string> 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 * 6; var w2 = py * 80; var count = 0; string preStr = null; //remove clone foreach (var elite in eliteGroup1) { if (elite.Key.Rarity == ActorRarity.Champion) { var eliteCurMaxHealth = 0.0d; var eliteMaxHealth = 0.0d; bool illusionist = false; int same = 0; eliteCurMaxHealth = elite.Key.MaxHealth; same = 0; foreach (var monster2 in monsters) { if (eliteMaxHealth < monster2.MaxHealth && monster2.Rarity == ActorRarity.Champion) { eliteMaxHealth = monster2.MaxHealth; } } foreach (var monster1 in monsters) { if (monster1.Rarity == ActorRarity.Champion) { if (eliteCurMaxHealth == monster1.MaxHealth) { same++; } if (same == 2) { illusionist = true; break; } } } 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) { var eliteCurMaxHealth = 0.0d; var eliteMaxHealth = 0.0d; bool illusionist = false; int same = 0; eliteCurMaxHealth = elite.Key.MaxHealth; same = 0; foreach (var monster2 in monsters) { if (eliteMaxHealth < monster2.MaxHealth && monster2.Rarity == ActorRarity.Rare) { eliteMaxHealth = monster2.MaxHealth; } } foreach (var monster1 in monsters) { if (monster1.Rarity == ActorRarity.Rare) { if (eliteCurMaxHealth == monster1.MaxHealth) { same++; } if (same == 2) { illusionist = true; break; } } } 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(); }
private void DrawHealthBar(WorldLayer layer, IMonster m, ref float yref) { if (m.Rarity == ActorRarity.RareMinion && !ShowRareMinions) { return; //no minions } if (m.SummonerAcdDynamicId != 0) { return; //no clones } var wint = m.CurHealth / m.MaxHealth; string whptext; if ((wint < 0) || (wint > 1)) { wint = 1; whptext = "bug"; } else { whptext = (wint * 100).ToString(PercentageDescriptor) + "%"; } var w = wint * w2; var per = LightFont.GetTextLayout(whptext); var y = YPos + py * 8 * yref; // IBrush cBrush = null; // IFont cFont = null; cBrush = null; cFont = null; //Brush selection switch (m.Rarity) { case ActorRarity.Boss: cBrush = BossBrush; break; case ActorRarity.Champion: cBrush = ChampionBrush; break; case ActorRarity.Rare: cBrush = RareBrush; break; case ActorRarity.RareMinion: cBrush = RareMinionBrush; break; default: cBrush = BackgroundBrush; break; } //Jugger Highlight if (JuggernautHighlight && m.Rarity == ActorRarity.Rare && HasAffix(m, MonsterAffix.Juggernaut)) { cFont = RedFont; cBrush = RareJuggerBrush; } else { cFont = NameFont; } //Missing Highlight if (MissingHighlight && (m.Rarity == ActorRarity.Champion || m.Rarity == ActorRarity.Rare) && !m.IsOnScreen) { var missing = RedFont.GetTextLayout("\u26A0"); RedFont.DrawText(missing, XPos - 17, y - py); } //Circle Non-Clones and Boss if (CircleNonIllusion && m.SummonerAcdDynamicId == 0 && HasAffix(m, MonsterAffix.Illusionist) || m.Rarity == ActorRarity.Boss && ShowBossHitBox) { HitBoxDecorator.Paint(layer, m, m.FloorCoordinate, string.Empty); } string d = string.Empty; //Show Debuffs on Monster if (ShowDebuffAndCC) { string textDebuff = null; if (m.Locust) { textDebuff += (textDebuff == null ? "" : ", ") + "Locust"; } if (m.Palmed) { textDebuff += (textDebuff == null ? "" : ", ") + "Palm"; } if (m.Haunted) { textDebuff += (textDebuff == null ? "" : ", ") + "Haunt"; } if (m.MarkedForDeath) { textDebuff += (textDebuff == null ? "" : ", ") + "Mark"; } //if (m.Strongarmed) textDebuff += (textDebuff == null ? "" : ", ") + "Strongarm"; // No funciona, reemplazado por otro código if (m.GetAttributeValue(Hud.Sno.Attributes.Power_Buff_2_Visual_Effect_None, 318772) == 1) //318772 2 power: ItemPassive_Unique_Ring_590_x1 { textDebuff += (textDebuff == null ? "" : ", ") + "Strongarm"; } string textCC = null; if (m.Frozen) { textCC += (textCC == null ? "" : ", ") + "Frozen"; } if (m.Chilled) { textCC += (textCC == null ? "" : ", ") + "Chill"; } if (m.Slow) { textCC += (textCC == null ? "" : ", ") + "Slow"; } if (m.Stunned) { textCC += (textCC == null ? "" : ", ") + "Stun"; } if (m.Invulnerable) { textCC += (textCC == null ? "" : ", ") + "Invulnerable"; } if (m.Blind) { textCC += (textCC == null ? "" : ", ") + "Blind"; } if (textDebuff != null) { d = textDebuff; } if (textCC != null) { d += ((d != string.Empty)? " | ":"") + textCC; } } if (ShowCurses) { string Curses = null; if (m.GetAttributeValue(Hud.Sno.Attributes.Power_Buff_2_Visual_Effect_None, 471845) == 1) //471845 1 power: Frailty { Curses += (Curses == null ? "" : " ") + "F"; } if (m.GetAttributeValue(Hud.Sno.Attributes.Power_Buff_2_Visual_Effect_None, 471869) == 1) //471869 1 power: Leech { Curses += (Curses == null ? "" : " ") + "L"; } if (m.GetAttributeValue(Hud.Sno.Attributes.Power_Buff_2_Visual_Effect_None, 471738) == 1) //471738 1 power: Decrepify { Curses += (Curses == null ? "" : " ") + "D"; } if (Curses != null) { d += ((d != string.Empty)? " | ":"") + Curses; } } if (d != string.Empty) { LightFont.DrawText(LightFont.GetTextLayout(d), XPos + 65 + w2, y - py); } //Draw Rectangles BackgroundBrush.DrawRectangle(XPos, y, w2, h); BorderBrush.DrawRectangle(XPos, y, w2, h); cBrush.DrawRectangle(XPos, y, (float)w, h); LightFont.DrawText(per, XPos + 8 + w2, y - py); //Draw MonsterType if (ShowMonsterType) { var name = cFont.GetTextLayout(m.SnoMonster.NameLocalized); cFont.DrawText(name, XPos + 3, y - py); } //increase linecount yref += 0.95f; }
public void PaintTopInGame(ClipState clipState) { if (clipState != ClipState.AfterClip) { return; } if (!_showList) { return; } var lines = GetBuffLines(); var lineWithMaxLength = lines.FirstOrDefault(l => l.Length == lines.Max(ll => ll.Length)); if (string.IsNullOrEmpty(lineWithMaxLength)) { return; } var layout = Font.GetTextLayout(lineWithMaxLength); var h = layout.Metrics.Height; var w = layout.Metrics.Width; var x = StartX; var y = StartY; //var lineCount = (int)((Hud.Window.GroundRectangle.Top + Hud.Window.GroundRectangle.Height - StartX) / h); //lineCount /= 2; //var columns = new List<List<string>>() //{ // new List<string>() //}; //var currentColumnIndex = 0; //while (currentColumnIndex * lineCount < lines.Count) //{ // var column = lines.Skip(currentColumnIndex * lineCount).Take(lineCount); // columns[currentColumnIndex].AddRange(column); // currentColumnIndex++; //} var lineCount = (int)((Hud.Window.GroundRectangle.Top + Hud.Window.GroundRectangle.Height - StartX) / h); var estimatedWidth = w * ((lines.Count / lineCount) + 1); if (BackgroundBrush != null) { BackgroundBrush.DrawRectangle(StartX - h / 2f, StartY - h / 2f, estimatedWidth + h, h * Math.Min(lineCount, lines.Count) + h); } foreach (var line in GetBuffLines()) { Font.DrawText(line, x, y); if (y >= Hud.Window.GroundRectangle.Bottom - (h * 2)) { x += w; y = StartY; } else { y += h; } } }
public void PaintWorld(WorldLayer layer) { if (Hud.Game.IsInTown) { return; } var h = 17; var w1 = 35; var py = Hud.Window.Size.Height / 600; var monsters = Hud.Game.AliveMonsters.Where(x => x.IsAlive); List <IMonster> monstersElite = new List <IMonster>(); foreach (var monster in monsters) { if (monster.SummonerAcdDynamicId == 0) { if (monster.Rarity == ActorRarity.RareMinion) { if (IlluSpawners.Contains(monster.SnoMonster.NameEnglish)) { foreach (var snoMonsterAffix in monster.AffixSnoList) { if (snoMonsterAffix.Affix == MonsterAffix.Illusionist) { monstersElite.Add(monster); break; } } } } } } foreach (var monster in monstersElite) { var wint = monster.CurHealth / monster.MaxHealth; var hptext = ""; if ((wint < 0) || (wint > 1)) { wint = 1; hptext = "bug"; } else { hptext = ValueToString(wint * 100, ValueFormat.NormalNumberNoDecimal); } var w = wint * w1; var layout = TextFont.GetTextLayout(hptext); var monsterX = monster.FloorCoordinate.ToScreenCoordinate().X - w1 / 2; var monsterY = monster.FloorCoordinate.ToScreenCoordinate().Y - py * 8; if (monsterY < 0) { monsterY = monster.FloorCoordinate.ToScreenCoordinate().Y; } monsterY -= 15.0f; var ShieldingX = monsterX - w1 / 2; var hauntX = monsterX + w1 + 5; var buffY = monsterY - 1; var hpX = monsterX + 7; BorderBrush.DrawRectangle(monsterX, monsterY, w1, h); BackgroundBrush.DrawRectangle(monsterX, monsterY, w1, h); RareBrush.DrawRectangle(monsterX, monsterY, (float)w, h); TextFont.DrawText(layout, hpX, buffY); } }
public void PaintWorld(WorldLayer layer) { var w1 = Hud.Window.Size.Width * 0.00333f * b; var textLocust = "虫群"; //"L" var layoutLocust = TextFontLocust.GetTextLayout(textLocust); var textHaunt = "蚀魂"; //"H" var layoutHaunt = TextFontHaunt.GetTextLayout(textHaunt); var h2 = Hud.Window.Size.Height * 0.017f; var x2 = Hud.Window.Size.Width * 0.001667f * b; var x3 = Hud.Window.Size.Width * 0.02f; var monsters = Hud.Game.AliveMonsters; foreach (var monster in monsters) { bool illusionist = false; if (monster.SummonerAcdDynamicId == 0) { illusionist = false; } else { illusionist = true; } if (monster.Rarity == ActorRarity.Champion) { if (illusionist == false) { var hptext = (monster.CurHealth * 100 / monster.MaxHealth).ToString("f0") + "%"; var layout = TextFont.GetTextLayout(hptext); var h = Hud.Window.Size.Height * 0.00034f * 35; var w = monster.CurHealth * w1 / monster.MaxHealth; var monsterX = monster.FloorCoordinate.ToScreenCoordinate().X; // - w1 / 2; var monsterY = monster.FloorCoordinate.ToScreenCoordinate().Y; // + py * 14; var locustX = monsterX + x3 * 0.1f; var hauntX = monsterX - x3; var buffY = monsterY - h2 * 2f; var hpX = monsterX - 1.5f; if (monster.Invulnerable) { BorderBrush.DrawRectangle(monsterX - x2, monsterY + h2, w1, h); } BackgroundBrush.DrawRectangle(monsterX - x2, monsterY + h2, w1, h); if (monster.Rarity == ActorRarity.Champion) { ChampionBrush.DrawRectangle(monsterX - x2, monsterY + h2, (float)w, h); } if (monster.Locust) { TextFontLocust.DrawText(layoutLocust, locustX, buffY); } if (monster.Haunted) { TextFontHaunt.DrawText(layoutHaunt, hauntX, buffY); } TextFont.DrawText(layout, hpX, monsterY + h2 / 1.2f); } } if (monster.Rarity == ActorRarity.Rare) { if (illusionist == false) { var hptext = (monster.CurHealth * 100 / monster.MaxHealth).ToString("f0") + "%"; var layout = TextFont.GetTextLayout(hptext); var h = Hud.Window.Size.Height * 0.00034f * 35; var w = monster.CurHealth * w1 / monster.MaxHealth; var monsterX = monster.FloorCoordinate.ToScreenCoordinate().X; // - w1 / 2; var monsterY = monster.FloorCoordinate.ToScreenCoordinate().Y; // + py * 14; var locustX = monsterX + x3 * 0.1f; var hauntX = monsterX - x3; var buffY = monsterY - h2 * 2f; var hpX = monsterX - 1.5f; if (monster.Invulnerable) { BorderBrush.DrawRectangle(monsterX - x2, monsterY + h2, w1, h); } BackgroundBrush.DrawRectangle(monsterX - x2, monsterY + h2, w1, h); if (monster.Rarity == ActorRarity.Rare) { RareBrush.DrawRectangle(monsterX - x2, monsterY + h2, (float)w, h); } if (monster.Locust) { TextFontLocust.DrawText(layoutLocust, locustX, buffY); } if (monster.Haunted) { TextFontHaunt.DrawText(layoutHaunt, hauntX, buffY); } TextFont.DrawText(layout, hpX, monsterY + h2 / 1.2f); } } } }
public void Paint(float x, float y, float w, float h, HorizontalAlign align) { if (!Enabled) { return; } if (TextFont == null) { return; } var text = TextFunc != null?TextFunc.Invoke() : null; var hint = HintFunc != null?HintFunc.Invoke() : null; if (string.IsNullOrEmpty(text) && HideBackgroundWhenTextIsEmpty) { return; } if (Hud.Window.CursorInsideRect(x, y, w, h)) { var expanded = false; if (ExpandUpLabels != null && ExpandUpLabels.Count > 0) { var ly = y - h; foreach (var label in ExpandUpLabels) { label.Paint(x, ly, w, h, align); label.PaintExpandedHint(x + w, ly, w * label.ExpandedHintWidthMultiplier, h, HorizontalAlign.Center); ly -= h; expanded = true; } this.PaintExpandedHint(x + w, y, w * 3, h, HorizontalAlign.Center); } if (ExpandDownLabels != null && ExpandDownLabels.Count > 0) { var ly = y + h; foreach (var label in ExpandDownLabels) { label.Paint(x, ly, w, h, align); label.PaintExpandedHint(x + w, ly, w * label.ExpandedHintWidthMultiplier, h, HorizontalAlign.Center); ly += h; expanded = true; } this.PaintExpandedHint(x + w, y, w * 3, h, HorizontalAlign.Center); } if (ExpandRightLabels != null && ExpandRightLabels.Count > 0) { var lx = x + w; foreach (var label in ExpandRightLabels) { label.Paint(lx, y, w, h, align); lx += h; expanded = true; } } if (ExpandLeftLabels != null && ExpandLeftLabels.Count > 0) { var lx = x - w; foreach (var label in ExpandLeftLabels) { label.Paint(lx, y, w, h, align); lx -= h; expanded = true; } } if (!expanded) { if (!string.IsNullOrEmpty(hint)) { Hud.Render.SetHint(hint); } } } if (BackgroundTexture1 != null) { BackgroundTexture1.Draw(x, y, w, h, BackgroundTextureOpacity1); } if (BackgroundTexture2 != null) { BackgroundTexture2.Draw(x, y, w, h, BackgroundTextureOpacity2); } if (BackgroundBrush != null) { BackgroundBrush.DrawRectangle(x, y, w, h); } if (!string.IsNullOrEmpty(text)) { var layout = TextFont.GetTextLayout(text); switch (align) { case HorizontalAlign.Left: TextFont.DrawText(layout, x, y + (h - layout.Metrics.Height) / 2); break; case HorizontalAlign.Center: TextFont.DrawText(layout, x + (w - layout.Metrics.Width) / 2, y + (h - layout.Metrics.Height) / 2); break; case HorizontalAlign.Right: TextFont.DrawText(layout, x + w - layout.Metrics.Width, y + (h - layout.Metrics.Height) / 2); break; } } if (BorderBrush != null) { BorderBrush.DrawRectangle(x, y, w, h); } }
private void DrawHealthBar(WorldLayer layer, IMonster m, ref float yref) { if (m.Rarity == ActorRarity.RareMinion && !ShowRareMinions) { return; //no minions } if (m.SummonerAcdDynamicId != 0) { return; //no clones } var w = m.CurHealth * w2 / m.MaxHealth; var per = LightFont.GetTextLayout((m.CurHealth * 100 / m.MaxHealth).ToString(PercentageDescriptor) + "%"); var y = YPos + py * 8 * yref; IBrush cBrush = null; IFont cFont = null; //Brush selection switch (m.Rarity) { case ActorRarity.Boss: cBrush = BossBrush; break; case ActorRarity.Champion: cBrush = ChampionBrush; break; case ActorRarity.Rare: cBrush = RareBrush; break; case ActorRarity.RareMinion: cBrush = RareMinionBrush; break; default: cBrush = BackgroundBrush; break; } //Jugger Highlight if (JuggernautHighlight && m.Rarity == ActorRarity.Rare && HasAffix(m, MonsterAffix.Juggernaut)) { cFont = RedFont; cBrush = RareJuggerBrush; } else { cFont = NameFont; } //Missing Highlight if (MissingHighlight && (m.Rarity == ActorRarity.Champion || m.Rarity == ActorRarity.Rare) && !m.IsOnScreen) { var missing = RedFont.GetTextLayout("⚠"); RedFont.DrawText(missing, XPos - 17, y - py); } //Circle Non-Clones and Boss //if (CircleNonIllusion && m.SummonerAcdDynamicId == 0 && HasAffix(m, MonsterAffix.Illusionist) || m.Rarity == ActorRarity.Boss && ShowBossHitBox) // HitBoxDecorator.Paint(layer, m, m.FloorCoordinate, string.Empty); //Show Debuffs on Monster if (ShowDebuffAndCC) { string textDebuff = null; if (m.Locust) { textDebuff += (textDebuff == null ? "" : ", ") + "Locust"; } //if (m.Palmed) textDebuff += (textDebuff == null ? "" : ", ") + "Palm"; if (m.Haunted) { textDebuff += (textDebuff == null ? "" : ", ") + "Haunt"; } if (m.MarkedForDeath) { textDebuff += (textDebuff == null ? "" : ", ") + "Mark"; } if (m.Strongarmed) { textDebuff += (textDebuff == null ? "" : ", ") + "Strongarm"; } string textCC = null; //if (m.Frozen) textCC += (textCC == null ? "" : ", ") + "Frozen"; //if (m.Chilled) textCC += (textCC == null ? "" : ", ") + "Chill"; //if (m.Slow) textCC += (textCC == null ? "" : ", ") + "Slow"; //if (m.Stunned) textCC += (textCC == null ? "" : ", ") + "Stun"; if (m.Invulnerable) { textCC += (textCC == null ? "" : ", ") + "Invulnerable"; } //if (m.Blind) textCC += (textCC == null ? "" : ", ") + "Blind"; var d = LightFont.GetTextLayout(textDebuff + (textDebuff != null && textCC != null ? " | " : "") + textCC); LightFont.DrawText(d, XPos + 65 + w2, y - py); } //Draw Rectangles BackgroundBrush.DrawRectangle(XPos, y, w2, h); BorderBrush.DrawRectangle(XPos, y, w2, h); cBrush.DrawRectangle(XPos, y, (float)w, h); LightFont.DrawText(per, XPos + 8 + w2, y - py); //Draw MonsterType if (ShowMonsterType) { var name = cFont.GetTextLayout(m.SnoMonster.NameLocalized); cFont.DrawText(name, XPos + 3, y - py); } //increase linecount yref += 1.0f; }
public void PaintTopInGame(ClipState clipState) { if (Hud.Render.UiHidden) { return; } if (Hud.Game.SpecialArea != SpecialArea.GreaterRift) { return; } var bosses = Hud.Game.AliveMonsters.Where(m => m.Rarity == ActorRarity.Boss); bool BossSpawned = false; foreach (IMonster m in bosses) { BossSpawned = true; foreach (var bosstimer in BossTimers) { if (m.SnoMonster.NameEnglish == "Ember") { var healthpercent = (m.CurHealth / m.MaxHealth); if (healthpercent > 0.5) { bosstimer.Duration = 7.5; } else { bosstimer.Duration = 4.0; } } else if (m.SnoMonster.NameEnglish == "Stonesinger") { if (bosstimer.Animation == AnimSnoEnum._sandmonsterblack_attack_03_sandwall) { var healthpercent = (m.CurHealth / m.MaxHealth); bosstimer.Duration = 12.0 * healthpercent + 5.5 * (1 - healthpercent); } } else if (m.SnoMonster.NameEnglish == "Bone Warlock") { if (bosstimer.Name == "Wormhole") { bosstimer.Duration = 16.0; var wormhole = Hud.Game.Actors.Where(x => x.SnoActor.Sno == ActorSnoEnum._x1_monsteraffix_teleportmines); // 337109 if (wormhole.Count() > 0) { var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; if (TimeElapsed > 7) { //DebugtextBuilder.Append(bosstimer.Name); //DebugtextBuilder.Append(" "); //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d); //DebugtextBuilder.AppendLine(); bosstimer.Timer = Hud.Game.CurrentGameTick; } } } } else if (m.SnoMonster.NameEnglish == "Orlash") { if (m.Animation == AnimSnoEnum._terrordemon_generic_cast && bosstimer.Name == "Orlash Summon") { var Clones = Hud.Game.Actors.Where(x => x.SnoActor.Sno == ActorSnoEnum._x1_lr_boss_terrordemon_a_breathminion); // 337109 if (Clones.Count() <= 1) { var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; if (TimeElapsed > 8) { //DebugtextBuilder.Append(bosstimer.Name); //DebugtextBuilder.Append(" "); //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d); //DebugtextBuilder.AppendLine(); bosstimer.Timer = Hud.Game.CurrentGameTick; } } } else if (m.Animation == AnimSnoEnum._terrordemon_attack_firebreath && bosstimer.Name == "Lightning Breath") { var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; if (TimeElapsed > 6) { //DebugtextBuilder.Append(bosstimer.Name); //DebugtextBuilder.Append(" "); //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d); //DebugtextBuilder.AppendLine(); bosstimer.Timer = Hud.Game.CurrentGameTick; } } } else if (m.SnoMonster.NameEnglish == "Bloodmaw") { if (m.Animation == bosstimer.Animation && bosstimer.Animation == AnimSnoEnum._x1_westmarchbrute_attack_02_out) { var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; if (TimeElapsed > 7) { //DebugtextBuilder.Append(bosstimer.Name); //DebugtextBuilder.Append(" "); //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d); //DebugtextBuilder.AppendLine(); //DebugtextBuilder.AppendLine(); } bosstimer.Timer = Hud.Game.CurrentGameTick; } if (m.Animation == AnimSnoEnum._x1_westmarchbrute_taunt && bosstimer.Animation == AnimSnoEnum._x1_westmarchbrute_attack_02_out) { var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; if (TimeElapsed > 7) { //DebugtextBuilder.Append(bosstimer.Name); //DebugtextBuilder.Append(" "); //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d); //DebugtextBuilder.AppendLine(); //DebugtextBuilder.AppendLine(); } bosstimer.Timer = Hud.Game.CurrentGameTick; } /*if (m.Animation == bosstimer.Animation && bosstimer.Animation == AnimSnoEnum._x1_westmarchbrute_taunt) * { * var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; * if (TimeElapsed > 4) * { * DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d); * DebugtextBuilder.AppendLine(); * bosstimer.LastTimer = bosstimer.Timer; * bosstimer.Timer = Hud.Game.CurrentGameTick; * } * }*/ } else if (m.SnoMonster.NameEnglish == "Rime") { if (bosstimer.Name == "Small Fields") { var Circles = Hud.Game.Actors.Where(x => x.SnoActor.Sno == ActorSnoEnum._x1_unique_monster_generic_aoe_dot_cold_10foot); // 337109 if (Circles.Count() > 0) { var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; if (TimeElapsed > 7) { //DebugtextBuilder.Append(bosstimer.Name); //DebugtextBuilder.Append(" "); //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d); //DebugtextBuilder.AppendLine(); bosstimer.Timer = Hud.Game.CurrentGameTick; } } } } else if (m.SnoMonster.NameEnglish == "Perendi") { if (bosstimer.Animation == 0 && bosstimer.Name == "Cave In") { var Circles = Hud.Game.Actors.Where(x => x.SnoActor.Sno == ActorSnoEnum._x1_lr_boss_malletdemon_fallingrocks); if (Circles.Count() > 0) { var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; if (TimeElapsed > 5) { //DebugtextBuilder.Append(bosstimer.Name); //DebugtextBuilder.Append(" "); //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d); //DebugtextBuilder.AppendLine(); bosstimer.Timer = Hud.Game.CurrentGameTick; } } } } else if (m.SnoMonster.NameEnglish == "Blighter") { if (bosstimer.Animation == 0 && bosstimer.Name == "Good Attack") { var Attack = m.GetAttributeValue(Hud.Sno.Attributes.Power_Buff_5_Visual_Effect_None, 429291); if (Attack > 0) { var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; if (TimeElapsed > 10) { //DebugtextBuilder.Append(bosstimer.Name); //DebugtextBuilder.Append(" "); //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d); //DebugtextBuilder.AppendLine(); bosstimer.Timer = Hud.Game.CurrentGameTick; } } } else if (bosstimer.Animation == 0 && bosstimer.Name == "Bad Attack") { var Attack = m.GetAttributeValue(Hud.Sno.Attributes.Power_Buff_5_Visual_Effect_None, 309921); if (Attack > 0) { var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; if (TimeElapsed > 10) { //DebugtextBuilder.Append(bosstimer.Name); //DebugtextBuilder.Append(" "); //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d); //DebugtextBuilder.AppendLine(); bosstimer.Timer = Hud.Game.CurrentGameTick; } } } else if (bosstimer.Animation == 0 && bosstimer.Name == "Line Attack") { var Attack = m.GetAttributeValue(Hud.Sno.Attributes.Power_Buff_5_Visual_Effect_None, 429077); if (Attack > 0) { var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; if (TimeElapsed > 10) { //DebugtextBuilder.Append(bosstimer.Name); //DebugtextBuilder.Append(" "); //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d); //DebugtextBuilder.AppendLine(); bosstimer.Timer = Hud.Game.CurrentGameTick; } } } } else if (m.SnoMonster.NameEnglish == "Man Carver") { if (bosstimer.Name == "Ground Effect") { var Circles = Hud.Game.Actors.Where(x => x.SnoActor.Sno == ActorSnoEnum._x1_unique_monster_generic_aoe_dot_fire_10foot); if (Circles.Count() > 0) { var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; if (TimeElapsed > 15) { //DebugtextBuilder.Append(bosstimer.Name); //DebugtextBuilder.Append(" "); //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d); //DebugtextBuilder.AppendLine(); bosstimer.Timer = Hud.Game.CurrentGameTick; } } } else if (bosstimer.Name == "Heavy Smash") { if (m.Animation == AnimSnoEnum._butcher_attack_05_telegraph) { var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; if (TimeElapsed > 6) { //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d); //DebugtextBuilder.AppendLine(); bosstimer.LastTimer = bosstimer.Timer; bosstimer.Timer = Hud.Game.CurrentGameTick; } } } } else if (m.SnoMonster.NameEnglish == "Erethon") { if (bosstimer.Name == "Poison Circle") { var Circles = Hud.Game.Actors.Where(x => x.SnoActor.Sno == ActorSnoEnum._generic_proxy); if (Circles.Count() > 0) { var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; if (TimeElapsed > 7) { //DebugtextBuilder.Append(bosstimer.Name); //DebugtextBuilder.Append(" "); //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d); //DebugtextBuilder.AppendLine(); bosstimer.Timer = Hud.Game.CurrentGameTick; } } } } else if (m.SnoMonster.NameEnglish == "Raiziel") { if (m.Animation == AnimSnoEnum._x1_sniperangel_firebomb_01) { var healthpercent = (m.CurHealth / m.MaxHealth); if (healthpercent > 0.75) { bosstimer.Duration = 7.5; } else { bosstimer.Duration = 4.0; } } } if (m.Animation == bosstimer.Animation && bosstimer.Animation != 0) { var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; if (TimeElapsed > 4) { //DebugtextBuilder.Append(bosstimer.Name); //DebugtextBuilder.Append(" "); //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d); //DebugtextBuilder.AppendLine(); bosstimer.LastTimer = bosstimer.Timer; bosstimer.Timer = Hud.Game.CurrentGameTick; } } } } if (!BossSpawned) { return; } float ydelta = Hud.Window.Size.Height * 0.03f; int i = 0; foreach (var bosstimer in BossTimers) { var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; if (TimeElapsed > 0 && TimeElapsed < 120.0d) { textBuilder.Clear(); textBuilder.AppendFormat("{0:0}", TimeElapsed); if (TimeElapsed > bosstimer.Duration) { TimeElapsed = bosstimer.Duration; } float x = Hud.Window.Size.Width * 0.14f; float y = Hud.Window.Size.Height * 0.05f; float sizex = Hud.Window.Size.Width * 0.16f; float sizey = Hud.Window.Size.Height * 0.02f; float textx = Hud.Window.Size.Width * (0.14f + 0.498f - 0.42f); float texty = Hud.Window.Size.Height * (0.05f + 0.111f - 0.11f); y += i * ydelta; texty += i * ydelta; BackgroundBrush.DrawRectangle(x, y, sizex, sizey); BarBrush.DrawRectangle(x, y, sizex * (float)(TimeElapsed / bosstimer.Duration), sizey); //BorderBrush.DrawLine(x, y, x + sizex, y, 0.6f); BorderBrush.DrawLine(x + sizex, y, x + sizex, y + sizey, BorderSize); //BorderBrush.DrawLine(x, y + sizey, x + sizex, y + sizey, BorderSize); //BorderBrush.DrawLine(x, y, x, y + sizey, 0.6f); var layout = GreenFont.GetTextLayout(textBuilder.ToString()); GreenFont.DrawText(layout, textx, texty); textBuilder.Clear(); textBuilder.Append(bosstimer.Name); var layout2 = GreenFont.GetTextLayout(textBuilder.ToString()); GreenFont.DrawText(layout2, x, texty); //var layout3 = GreenFont.GetTextLayout(DebugtextBuilder.ToString()); //GreenFont.DrawText(layout3, Hud.Window.Size.Width * 0.35f, Hud.Window.Size.Height * (0.05f + 0.111f - 0.11f)); i++; } } }