-
Member
-
Active Member
-
Active Member
//Modified plugin of the original, which can be downloaded from:
//https://www.ownedcore.com/forums/diablo-3/turbohud/turbohud-approved-plugins/612897-english-gigi-elitebarplugin.html
//Changes: Added Strongarm, Curses, Fix: Bug when a yellow elite is dead but not minions , Fix: Sometimes it shows an fake elite life , added Variables OnlyGr & ShowCurses
using System.Linq;
using System.Collections.Generic;
using Turbo.Plugins.Default;
namespace Turbo.Plugins.Gigi
{
public class EliteBarPlugin : BasePlugin, IInGameWorldPainter
{
public WorldDecoratorCollection HitBoxDecorator { get; set; }
public IFont LightFont { get; set; }
public IFont RedFont { get; set; }
public IFont NameFont { get; set; }
public IBrush BackgroundBrush { get; set; }
public IBrush BorderBrush { get; set; }
public IBrush RareBrush { get; set; }
public IBrush RareJuggerBrush { get; set; }
public IBrush RareMinionBrush { get; set; }
public IBrush ChampionBrush { get; set; }
public IBrush BossBrush { get; set; }
public bool JuggernautHighlight { get; set; }
public bool MissingHighlight { get; set; }
public bool ShowRareMinions { get ; set; }
public bool ShowDebuffAndCC { get; set; }
public bool ShowBossHitBox { get; set; }
public bool ShowMonsterType { get; set; }
public bool CircleNonIllusion { get; set; }
public float XPos { get; set; }
public float YPos { get; set; }
public float XScaling { get; set; }
public float YScaling { get; set; }
public string PercentageDescriptor { get; set; }
public Dictionary<MonsterAffix, string> DisplayAffix;
private float px, py, h, w2;
public bool OnlyGR { get; set; }
public bool ShowCurses { get; set; }
public EliteBarPlugin()
{
Enabled = true;
}
public override void Load(IController hud)
{
base.Load(hud);
//Configuration
MissingHighlight = true;
JuggernautHighlight = true;
CircleNonIllusion = true;
ShowRareMinions = true;
ShowDebuffAndCC = true;
ShowBossHitBox = true;
ShowMonsterType = true;
XScaling = 1.0f;
YScaling = 1.5f;
PercentageDescriptor = "0.00";
XPos = Hud.Window.Size.Width * 0.670f;
YPos = Hud.Window.Size.Height * 0.0720f;
DisplayAffix = new Dictionary<MonsterAffix, string>();
OnlyGR = false;
ShowCurses = true;
//Colorization
LightFont = Hud.Render.CreateFont("tahoma", 6f, 160, 255, 255, 255, false, false, true);
RedFont = Hud.Render.CreateFont("tahoma", 6f, 200, 255, 0, 0, false, false, true);
NameFont = Hud.Render.CreateFont("tahoma", 7f, 200, 255, 255, 255, false, false, true);
BackgroundBrush = Hud.Render.CreateBrush(255, 125, 120, 120, 0);
BorderBrush = Hud.Render.CreateBrush(255, 255, 255, 255, 1);
RareBrush = Hud.Render.CreateBrush(255, 255, 128, 0, 0);
RareJuggerBrush = Hud.Render.CreateBrush(255, 225, 100, 50, 0);
RareMinionBrush = Hud.Render.CreateBrush(220, 200, 100, 0, 0);
ChampionBrush = Hud.Render.CreateBrush(255, 0, 128, 255, 0);
BossBrush = Hud.Render.CreateBrush(255, 200, 20, 0, 0);
//HitBoxDecorator for Bosses and NonClone-Illusionist
HitBoxDecorator = new WorldDecoratorCollection(
new GroundCircleDecorator(Hud) {
Brush = Hud.Render.CreateBrush(255, 57, 194, 29, 3),
Radius = -1
}
);
}
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;
//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, 47173 == 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 += 1.0f;
}
private void DrawPack(WorldLayer layer, IMonsterPack p, ref float yref){
//Check if any affixes are wished to be displayed
bool elitealive = false;
foreach(IMonster m in p.MonstersAlive) {
if ((m.Rarity == ActorRarity.Rare) || (m.Rarity == ActorRarity.Champion) ) { elitealive = true; }
}
if (elitealive || ShowRareMinions) {
if (DisplayAffix.Any()){
string dAffix = "";
foreach(ISnoMonsterAffix afx in p.AffixSnoList){ //iterate affix list
if (DisplayAffix.Keys.Contains(afx.Affix)) //if affix is an key
dAffix += DisplayAffix[afx.Affix] + " "; //add to output
}
if (!string.IsNullOrEmpty(dAffix)){
var d = LightFont.GetTextLayout(dAffix);
var y = YPos + py * 8 * yref;
LightFont.DrawText(d, XPos, y - py);
yref += 1.0f;
}
}
//iterate all alive monsters of pack and print healthbars
foreach(IMonster m in p.MonstersAlive)
DrawHealthBar(layer, m, ref yref);
}
}
private bool HasAffix(IMonster m, MonsterAffix afx){
return m.AffixSnoList.Any(a => a.Affix == afx);
}
public void PaintWorld(WorldLayer layer)
{
//Spacing
if ((OnlyGR) && (Hud.Game.Me.InGreaterRiftRank == 0)) return ;
px = Hud.Window.Size.Width * 0.00155f * XScaling;
py = Hud.Window.Size.Height * 0.001667f * YScaling;
h = py * 6;
w2 = px * 60;
var packs = Hud.Game.MonsterPacks.Where(x => x.MonstersAlive.Any());
var bosses = Hud.Game.AliveMonsters.Where(m => m.Rarity == ActorRarity.Boss);
float yref = 0f;
foreach(IMonster m in bosses)
DrawHealthBar(layer, m, ref yref);
yref += 0.5f; //spacing between RG and Elites
foreach(IMonsterPack p in packs){
DrawPack(layer, p, ref yref);
yref += 0.5f; //spacing between Elites
}
}
}
}
-
Post Thanks / Like - 1 Thanks
Baiobol (1 members gave Thanks to knight84 for this useful post)
-
Legendary
-
Post Thanks / Like - 2 Thanks
-
Member
Originally Posted by
RNN
Thank you very much. I really appreciate it
-
Active Member
knight84 Your code was missing a number, I identified cause was appearing only 2 effects of curses on bar (Leech and Decrepify)
and I noted your code has a emote because 8 + ) is a emote code here in forum haha, thats why Decrepify curse was not showing properly.
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, 47173 == 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); }
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 ? "" : " ") + "Frailty";
if (m.GetAttributeValue(Hud.Sno.Attributes.Power_Buff_2_Visual_Effect_None, 471869) == 1) //471869 1 power: Leech
Curses += (Curses == null ? "" : " ") + "Leech";
if (m.GetAttributeValue(Hud.Sno.Attributes.Power_Buff_2_Visual_Effect_None, 47173
== 1) //471738 1 power: Decrepify
Curses += (Curses == null ? "" : " ") + "Decrepify";
if (Curses != null) { d += ((d != string.Empty)? " | ":"") + Curses ; }
Screenshot_5.png
Last edited by Saico; 06-16-2019 at 01:48 PM.
-
Active Member
i see all courses, but thx for the info .)
-
Active Member
i see all courses, but thx for the info .) mybe i did an mistake with copie and paste ^^