Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections.Generic;
- using System.Linq;
- using Turbo.Plugins.Default;
- namespace Turbo.Plugins.DAV
- {
- public class DAV_EliteAffix : BasePlugin, IInGameWorldPainter, ICustomizer {
- public float OffsetTexture { get; set; }
- public float OffsetMiniMap { get; set; }
- public Dictionary<MonsterAffix, DAV_MonsterAffix> IconAffixDecorators { get; set; } = new Dictionary<MonsterAffix, DAV_MonsterAffix>();
- public DAV_EliteAffix() {
- Enabled = true;
- Order = 2007;
- }
- public override void Load(IController hud) {
- base.Load(hud);
- OffsetTexture = 0f;
- OffsetMiniMap = 1f;
- IconAffixDecorators.Add(MonsterAffix.Wormhole, new DAV_MonsterAffix(Hud, 1, Hud.Texture.GetTexture(3367297945))); // Wizard_BlackHole
- // IconAffixDecorators.Add(MonsterAffix.Juggernaut, new DAV_MonsterAffix(Hud, 2, Hud.Texture.GetTexture(3716597234))); // Monk_MantraOfConviction
- IconAffixDecorators.Add(MonsterAffix.Waller, new DAV_MonsterAffix(Hud, 3, Hud.Texture.GetTexture(57352976))); // Barbarian_Earthquake
- IconAffixDecorators.Add(MonsterAffix.Teleporter, new DAV_MonsterAffix(Hud, 4, Hud.Texture.GetTexture(476572771), false)); // Wizard_Teleport
- IconAffixDecorators.Add(MonsterAffix.Shielding, new DAV_MonsterAffix(Hud, 5, Hud.Texture.GetTexture(1828014503), false)); // Crusader_ShieldGlare
- IconAffixDecorators.Add(MonsterAffix.Illusionist, new DAV_MonsterAffix(Hud, 6, Hud.Texture.GetTexture(3468848968), false)); // Crusader_Phalanx
- IconAffixDecorators.Add(MonsterAffix.Electrified, new DAV_MonsterAffix(Hud, 7, Hud.Texture.GetTexture(3507821043), false)); // Wizard_ShockPulse
- // IconAffixDecorators.Add(MonsterAffix.Orbiter, new DAV_MonsterAffix(Hud, 8, Hud.Texture.GetTexture(121780010))); // Wizard_StormArmor
- // IconAffixDecorators.Add(MonsterAffix.Thunderstorm, new DAV_MonsterAffix(Hud, 9, Hud.Texture.GetTexture(2206308930))); // Crusader_HeavensFury
- // IconAffixDecorators.Add(MonsterAffix.FireChains, new DAV_MonsterAffix(Hud, 10, Hud.Texture.GetTexture(114581047))); // Wizard_Disintegrate
- // IconAffixDecorators.Add(MonsterAffix.Desecrator, new DAV_MonsterAffix(Hud, 11, Hud.Texture.GetTexture(2082406930))); // Enchantress_ScorchedEarth
- // IconAffixDecorators.Add(MonsterAffix.Molten, new DAV_MonsterAffix(Hud, 12, Hud.Texture.GetTexture(4226958249))); // Wizard_ExplosiveBlast
- // IconAffixDecorators.Add(MonsterAffix.Mortar, new DAV_MonsterAffix(Hud, 13, Hud.Texture.GetTexture(3558081954))); // Crusader_Bombardment
- IconAffixDecorators.Add(MonsterAffix.Frozen, new DAV_MonsterAffix(Hud, 14, Hud.Texture.GetTexture(3774024150))); // Wizard_FrostNova
- // IconAffixDecorators.Add(MonsterAffix.FrozenPulse, new DAV_MonsterAffix(Hud, 15, Hud.Texture.GetTexture(2859472454))); // Wizard_IceArmor
- // IconAffixDecorators.Add(MonsterAffix.Arcane, new DAV_MonsterAffix(Hud, 16, Hud.Texture.GetTexture(3205875948))); // Wizard_ArcaneTorrent
- // IconAffixDecorators.Add(MonsterAffix.Jailer, new DAV_MonsterAffix(Hud, 17, Hud.Texture.GetTexture(2660331930))); // DemonHunter_EntanglingShot
- // IconAffixDecorators.Add(MonsterAffix.Plagued, new DAV_MonsterAffix(Hud, 18, Hud.Texture.GetTexture(824449717))); // Witchdoctor_AcidCloud
- // IconAffixDecorators.Add(MonsterAffix.Poison, new DAV_MonsterAffix(Hud, 19, Hud.Texture.GetTexture(1341512618))); // Necro_BloodNova
- IconAffixDecorators.Add(MonsterAffix.Horde, new DAV_MonsterAffix(Hud, 20, Hud.Texture.GetTexture(990905993), false)); // Witchdoctor_FetishArmy
- IconAffixDecorators.Add(MonsterAffix.MissileDampening, new DAV_MonsterAffix(Hud, 21, Hud.Texture.GetTexture(329944))); // Enchantress_PoweredArmor
- // IconAffixDecorators.Add(MonsterAffix.ExtraHealth, new DAV_MonsterAffix(Hud, 22, Hud.Texture.GetTexture(3715229268))); // Crusader_LawsOfHope
- // IconAffixDecorators.Add(MonsterAffix.Fast, new DAV_MonsterAffix(Hud, 23, Hud.Texture.GetTexture(4272863835))); // Scoundrel_Vanish
- // IconAffixDecorators.Add(MonsterAffix.Vampiric, new DAV_MonsterAffix(Hud, 24, Hud.Texture.GetTexture(4130718801))); // Necro_SiphonBlood
- // IconAffixDecorators.Add(MonsterAffix.Knockback, new DAV_MonsterAffix(Hud, 25, Hud.Texture.GetTexture(3622182254))); // Monk_DeadlyReach
- // IconAffixDecorators.Add(MonsterAffix.Nightmarish, new DAV_MonsterAffix(Hud, 26, Hud.Texture.GetTexture(1020438005))); // Witchdoctor_MassConfusion
- // IconAffixDecorators.Add(MonsterAffix.Vortex, new DAV_MonsterAffix(Hud, 27, Hud.Texture.GetTexture(3786600151))); // Monk_CycloneStrike
- // IconAffixDecorators.Add(MonsterAffix.Avenger, new DAV_MonsterAffix(Hud, 28, Hud.Texture.GetTexture(3155636273))); // Barbarian_Revenge
- // IconAffixDecorators.Add(MonsterAffix.Reflect, new DAV_MonsterAffix(Hud, 29, Hud.Texture.GetTexture(3205465331))); // Crusader_ShieldBash
- IconAffixDecorators.Add(MonsterAffix.HealthLink, new DAV_MonsterAffix(Hud, 30, Hud.Texture.GetTexture(764581938), false)); // Necromancer_Simulacrum
- }
- public void PaintWorld(WorldLayer layer) {
- var monsters = Hud.Game.AliveMonsters.Where(x => !x.Illusion && (x.Rarity == ActorRarity.Champion || x.Rarity == ActorRarity.Rare));
- foreach (var monster in monsters) {
- var AffixList = monster.AffixSnoList.Where(x => IconAffixDecorators.ContainsKey(x.Affix)).ToList();
- var NumAffix = AffixList.Count();
- var NumAffixMiniMap = AffixList.Count(x => IconAffixDecorators[x.Affix].showMiniMap);
- AffixList.Sort((a, b) => (IconAffixDecorators[a.Affix].Rank).CompareTo(IconAffixDecorators[b.Affix].Rank));
- var rank = 0;
- var rankmap = 0;
- foreach (var snoMonsterAffix in AffixList) {
- var decorator = IconAffixDecorators[snoMonsterAffix.Affix];
- decorator.Paint(Hud, monster.FloorCoordinate, OffsetTexture, NumAffix, ref rank);
- decorator.PaintMiniMap(Hud, monster.FloorCoordinate, OffsetMiniMap, NumAffixMiniMap, ref rankmap);
- }
- }
- }
- public void Customize() {
- Hud.TogglePlugin<EliteMonsterAffixPlugin>(false);
- }
- }
- public class DAV_MonsterAffix {
- public int Rank;
- public bool showMiniMap { get; set; }
- private float Size { get; set; }
- private float SizeMap { get; set; }
- public ITexture AffixTexture { get; set; }
- public DAV_MonsterAffix(IController hud, int rank, ITexture affixIcon, bool showMap = true, float radius = 0.6f, float mapRadius = 0.6f) {
- Rank = rank;
- showMiniMap = showMap;
- AffixTexture = affixIcon;
- SizeMap = 11f / 480f * hud.Window.Size.Height * ((mapRadius <= 0f) ? 0.6f : mapRadius);
- Size= 11f / 240f * hud.Window.Size.Height * ((radius <= 0f) ? 0.6f : radius);
- }
- public void Paint(IController hud, IWorldCoordinate coord, float offsetZ, int num, ref int rank) {
- if (AffixTexture == null) return;
- var screenCoord = coord.ToScreenCoordinate();
- AffixTexture.Draw(screenCoord.X - (Size / 2f) * (float)(num - 2*rank), screenCoord.Y - Size / 2f + Size * offsetZ, Size, Size);
- rank++;
- }
- public void PaintMiniMap(IController hud, IWorldCoordinate coord, float offsetMiniMap, int num, ref int rank) {
- if (!showMiniMap || AffixTexture == null) return;
- hud.Render.GetMinimapCoordinates(coord.X, coord.Y, out var mapX, out var mapY);
- AffixTexture.Draw(mapX - (SizeMap / 2f) * (float)(num - 2*rank), mapY - (SizeMap / 2f) + SizeMap * offsetMiniMap, SizeMap, SizeMap);
- rank++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement