Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Turbo.Plugins.Zzz
- {
- // all credits to Z : http://turbohud.freeforums.net/user/788
- // rewritten to new 17.2.9.0 api as requested : http://turbohud.freeforums.net/thread/3833/request-juggernault-affixes-mini-map
- using System.Collections.Generic;
- using System.Linq;
- using Turbo.Plugins.Default;
- public class EliteDangerousAffixMinimapPlugin : BasePlugin
- {
- public WorldDecoratorCollection
- EliteLeaderDecorator,
- EliteLeaderDecorator_Dangerous,
- EliteChampionDecorator,
- EliteChampionDecorator_Dangerous;
- // public List<MonsterAffix> DangerousAffix { get; set; }
- public class customDict : Dictionary<MonsterAffix, string>
- {
- public new void Add(MonsterAffix inpMonsterAffix, string inpString = "")
- {
- base.Add(inpMonsterAffix, inpString);
- }
- }
- public customDict DangerousAffix { get; set; }
- public bool MinimapLabelEnabled { get; set; }
- public EliteDangerousAffixMinimapPlugin()
- {
- Enabled = true;
- MinimapLabelEnabled = true;
- DangerousAffix = new customDict();
- }
- public override void Load(IController hud)
- {
- base.Load(hud);
- IBrush shadowBrush = Hud.Render.CreateBrush(96, 0, 0, 0, 1);
- IBrush DangerousMapLabelBrush = Hud.Render.CreateBrush(220, 255, 0, 0, 0);
- IFont DangerousLabelFont = Hud.Render.CreateFont("tahoma", 10f, 200, 255, 255, 0, false, false, 128, 0, 0, 0, true);
- IRadiusTransformator DangerousPingSpeed = new StandardPingRadiusTransformator(Hud, 500);
- // Yellow Leader
- EliteLeaderDecorator = new WorldDecoratorCollection(
- new MapShapeDecorator(Hud)
- {
- Brush = Hud.Render.CreateBrush(180, 255, 148, 20, 0),
- ShadowBrush = shadowBrush,
- Radius = 10,
- ShapePainter = new CircleShapePainter(Hud)
- }
- );
- EliteLeaderDecorator_Dangerous = new WorldDecoratorCollection(
- new MapShapeDecorator(Hud)
- {
- Brush = DangerousMapLabelBrush,
- ShadowBrush = shadowBrush,
- Radius = 10,
- ShapePainter = new CircleShapePainter(Hud),
- RadiusTransformator = DangerousPingSpeed
- },
- new MapLabelDecorator(Hud)
- {
- LabelFont = DangerousLabelFont,
- }
- );
- // Blue
- EliteChampionDecorator = new WorldDecoratorCollection(
- new MapShapeDecorator(Hud)
- {
- Brush = Hud.Render.CreateBrush(180, 64, 128, 255, 0),
- ShadowBrush = shadowBrush,
- Radius = 10,
- ShapePainter = new CircleShapePainter(Hud),
- }
- );
- EliteChampionDecorator_Dangerous = new WorldDecoratorCollection(
- new MapShapeDecorator(Hud)
- {
- Brush = DangerousMapLabelBrush,
- ShadowBrush = shadowBrush,
- Radius = 10,
- ShapePainter = new CircleShapePainter(Hud),
- RadiusTransformator = DangerousPingSpeed
- },
- new MapLabelDecorator(Hud)
- {
- LabelFont = DangerousLabelFont,
- }
- );
- }
- public override void Customize()
- {
- if (Enabled)
- {
- // These are actually optional, set to false if you want only red blip, set to true (or comment out) if you want the original yellow/blue blip underneath the red blip
- // Hud.GetPlugin<StandardMonsterPlugin>().EliteLeaderDecorator.Enabled = false;
- // Hud.GetPlugin<StandardMonsterPlugin>().EliteChampionDecorator.Enabled = false;
- MinimapLabelEnabled = true;
- DangerousAffix.Add(MonsterAffix.Juggernaut, "JuG");
- DangerousAffix.Add(MonsterAffix.Illusionist, "Ill");
- DangerousAffix.Add(MonsterAffix.Reflect, "RD");
- DangerousAffix.Add(MonsterAffix.Poison, "P");
- DangerousAffix.Add(MonsterAffix.Arcane, "Ar");
- DangerousAffix.Add(MonsterAffix.Shielding, "Shd");
- // additional examples
- DangerousAffix.Add(MonsterAffix.Molten, "Molt");
- DangerousAffix.Add(MonsterAffix.Desecrator, "Des");
- DangerousAffix.Add(MonsterAffix.Wormhole, "Worm");
- // DangerousAffix.Add(MonsterAffix.Waller); // no string defined means it's empty, will not write anything to minimap
- // DangerousAffix.Add(MonsterAffix.Desecrator, Hud.Collections.GetMonsterAffixName(MonsterAffix.Desecrator)); // get from the default name
- // DangerousAffix.Add(MonsterAffix.Frozen, Hud.GetPlugin<z_EliteMonsterAffixPluginModified>().CustomAffixNames[MonsterAffix.Frozen]); // get from the default customaffixname, it has to be enabled! or it will throw an exception
- }
- }
- public override void PaintWorld(WorldLayer layer)
- {
- var MonstersList = Hud.Game.AliveMonsters;
- foreach (var thisMonster in MonstersList)
- {
- if (thisMonster.Rarity == ActorRarity.Rare || thisMonster.Rarity == ActorRarity.Champion)
- {
- var AffixText = "";
- var thisEliteDecorator = EliteLeaderDecorator;
- var Dangerous = false;
- /* // edit JackCeparou
- foreach (KeyValuePair<MonsterAffix, string> searchAffix in DangerousAffix)
- {
- if (thisMonster.HasAffix(searchAffix.Key))
- {
- if (MinimapLabelEnabled)
- {
- AffixText += searchAffix.Value + " ";
- }
- Dangerous = true;
- }
- }/**/
- if (thisMonster.AffixSnoList.Any(a => DangerousAffix.ContainsKey(a.Affix)))
- {
- var affixes = thisMonster.AffixSnoList.Select(a => a.Affix).ToList();
- AffixText = string.Join(" ", DangerousAffix
- .Where(da => affixes.Contains(da.Key))
- .Select(da => da.Value));
- Dangerous = true;
- } // end of edit JackCeparou
- switch (thisMonster.Rarity)
- {
- case ActorRarity.Rare:
- if (Dangerous)
- {
- thisEliteDecorator = EliteLeaderDecorator_Dangerous;
- }
- else
- {
- thisEliteDecorator = EliteLeaderDecorator;
- }
- break;
- case ActorRarity.Champion:
- if (Dangerous)
- {
- thisEliteDecorator = EliteChampionDecorator_Dangerous;
- }
- else
- {
- thisEliteDecorator = EliteChampionDecorator;
- }
- break;
- }
- thisEliteDecorator.Paint(layer, thisMonster, thisMonster.FloorCoordinate, AffixText);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement