Advertisement
s4000

DAV_EliteAffix

Oct 10th, 2019
877
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 7.31 KB | None | 0 0
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using Turbo.Plugins.Default;
  4.  
  5. namespace Turbo.Plugins.DAV
  6. {
  7.     public class DAV_EliteAffix : BasePlugin, IInGameWorldPainter, ICustomizer {
  8.         public float OffsetTexture { get; set; }
  9.         public float OffsetMiniMap { get; set; }
  10.         public Dictionary<MonsterAffix, DAV_MonsterAffix> IconAffixDecorators { get; set; } = new Dictionary<MonsterAffix, DAV_MonsterAffix>();
  11.  
  12.         public DAV_EliteAffix() {
  13.             Enabled = true;
  14.             Order = 2007;
  15.         }
  16.  
  17.         public override void Load(IController hud) {
  18.             base.Load(hud);
  19.            
  20.             OffsetTexture = 0f;
  21.             OffsetMiniMap = 1f;
  22.  
  23.             IconAffixDecorators.Add(MonsterAffix.Wormhole, new DAV_MonsterAffix(Hud, 1, Hud.Texture.GetTexture(3367297945))); // Wizard_BlackHole
  24.             // IconAffixDecorators.Add(MonsterAffix.Juggernaut, new DAV_MonsterAffix(Hud, 2, Hud.Texture.GetTexture(3716597234))); // Monk_MantraOfConviction
  25.             IconAffixDecorators.Add(MonsterAffix.Waller, new DAV_MonsterAffix(Hud, 3, Hud.Texture.GetTexture(57352976))); // Barbarian_Earthquake
  26.             IconAffixDecorators.Add(MonsterAffix.Teleporter, new DAV_MonsterAffix(Hud, 4, Hud.Texture.GetTexture(476572771), false)); // Wizard_Teleport
  27.             IconAffixDecorators.Add(MonsterAffix.Shielding, new DAV_MonsterAffix(Hud, 5, Hud.Texture.GetTexture(1828014503), false)); // Crusader_ShieldGlare
  28.             IconAffixDecorators.Add(MonsterAffix.Illusionist, new DAV_MonsterAffix(Hud, 6, Hud.Texture.GetTexture(3468848968), false)); // Crusader_Phalanx
  29.             IconAffixDecorators.Add(MonsterAffix.Electrified, new DAV_MonsterAffix(Hud, 7, Hud.Texture.GetTexture(3507821043), false)); // Wizard_ShockPulse
  30.             // IconAffixDecorators.Add(MonsterAffix.Orbiter, new DAV_MonsterAffix(Hud, 8, Hud.Texture.GetTexture(121780010))); // Wizard_StormArmor
  31.             // IconAffixDecorators.Add(MonsterAffix.Thunderstorm, new DAV_MonsterAffix(Hud, 9, Hud.Texture.GetTexture(2206308930))); // Crusader_HeavensFury
  32.             // IconAffixDecorators.Add(MonsterAffix.FireChains, new DAV_MonsterAffix(Hud, 10, Hud.Texture.GetTexture(114581047))); // Wizard_Disintegrate
  33.             // IconAffixDecorators.Add(MonsterAffix.Desecrator, new DAV_MonsterAffix(Hud, 11, Hud.Texture.GetTexture(2082406930))); // Enchantress_ScorchedEarth
  34.             // IconAffixDecorators.Add(MonsterAffix.Molten, new DAV_MonsterAffix(Hud, 12, Hud.Texture.GetTexture(4226958249))); // Wizard_ExplosiveBlast
  35.             // IconAffixDecorators.Add(MonsterAffix.Mortar, new DAV_MonsterAffix(Hud, 13, Hud.Texture.GetTexture(3558081954))); // Crusader_Bombardment
  36.             IconAffixDecorators.Add(MonsterAffix.Frozen, new DAV_MonsterAffix(Hud, 14, Hud.Texture.GetTexture(3774024150))); // Wizard_FrostNova
  37.             // IconAffixDecorators.Add(MonsterAffix.FrozenPulse, new DAV_MonsterAffix(Hud, 15, Hud.Texture.GetTexture(2859472454))); // Wizard_IceArmor
  38.             // IconAffixDecorators.Add(MonsterAffix.Arcane, new DAV_MonsterAffix(Hud, 16, Hud.Texture.GetTexture(3205875948))); // Wizard_ArcaneTorrent
  39.             // IconAffixDecorators.Add(MonsterAffix.Jailer, new DAV_MonsterAffix(Hud, 17, Hud.Texture.GetTexture(2660331930))); // DemonHunter_EntanglingShot
  40.             // IconAffixDecorators.Add(MonsterAffix.Plagued, new DAV_MonsterAffix(Hud, 18, Hud.Texture.GetTexture(824449717))); // Witchdoctor_AcidCloud
  41.             // IconAffixDecorators.Add(MonsterAffix.Poison, new DAV_MonsterAffix(Hud, 19, Hud.Texture.GetTexture(1341512618))); // Necro_BloodNova
  42.             IconAffixDecorators.Add(MonsterAffix.Horde, new DAV_MonsterAffix(Hud, 20, Hud.Texture.GetTexture(990905993), false)); // Witchdoctor_FetishArmy
  43.             IconAffixDecorators.Add(MonsterAffix.MissileDampening, new DAV_MonsterAffix(Hud, 21, Hud.Texture.GetTexture(329944))); // Enchantress_PoweredArmor
  44.             // IconAffixDecorators.Add(MonsterAffix.ExtraHealth, new DAV_MonsterAffix(Hud, 22, Hud.Texture.GetTexture(3715229268))); // Crusader_LawsOfHope
  45.             // IconAffixDecorators.Add(MonsterAffix.Fast, new DAV_MonsterAffix(Hud, 23, Hud.Texture.GetTexture(4272863835))); // Scoundrel_Vanish
  46.             // IconAffixDecorators.Add(MonsterAffix.Vampiric, new DAV_MonsterAffix(Hud, 24, Hud.Texture.GetTexture(4130718801))); // Necro_SiphonBlood
  47.             // IconAffixDecorators.Add(MonsterAffix.Knockback, new DAV_MonsterAffix(Hud, 25, Hud.Texture.GetTexture(3622182254))); // Monk_DeadlyReach
  48.             // IconAffixDecorators.Add(MonsterAffix.Nightmarish, new DAV_MonsterAffix(Hud, 26, Hud.Texture.GetTexture(1020438005))); // Witchdoctor_MassConfusion
  49.             // IconAffixDecorators.Add(MonsterAffix.Vortex, new DAV_MonsterAffix(Hud, 27, Hud.Texture.GetTexture(3786600151))); // Monk_CycloneStrike
  50.             // IconAffixDecorators.Add(MonsterAffix.Avenger, new DAV_MonsterAffix(Hud, 28, Hud.Texture.GetTexture(3155636273))); // Barbarian_Revenge
  51.             // IconAffixDecorators.Add(MonsterAffix.Reflect, new DAV_MonsterAffix(Hud, 29, Hud.Texture.GetTexture(3205465331))); // Crusader_ShieldBash
  52.             IconAffixDecorators.Add(MonsterAffix.HealthLink, new DAV_MonsterAffix(Hud, 30, Hud.Texture.GetTexture(764581938), false)); // Necromancer_Simulacrum
  53.         }
  54.  
  55.         public void PaintWorld(WorldLayer layer) {
  56.             var monsters = Hud.Game.AliveMonsters.Where(x => !x.Illusion && (x.Rarity == ActorRarity.Champion || x.Rarity == ActorRarity.Rare));
  57.             foreach (var monster in monsters) {
  58.                 var AffixList = monster.AffixSnoList.Where(x => IconAffixDecorators.ContainsKey(x.Affix)).ToList();
  59.                 var NumAffix = AffixList.Count();
  60.                 var NumAffixMiniMap = AffixList.Count(x => IconAffixDecorators[x.Affix].showMiniMap);
  61.                 AffixList.Sort((a, b) => (IconAffixDecorators[a.Affix].Rank).CompareTo(IconAffixDecorators[b.Affix].Rank));
  62.  
  63.                 var rank = 0;
  64.                 var rankmap = 0;
  65.                 foreach (var snoMonsterAffix in AffixList) {
  66.                     var decorator = IconAffixDecorators[snoMonsterAffix.Affix];
  67.                     decorator.Paint(Hud, monster.FloorCoordinate, OffsetTexture, NumAffix, ref rank);
  68.                     decorator.PaintMiniMap(Hud, monster.FloorCoordinate, OffsetMiniMap, NumAffixMiniMap, ref rankmap);
  69.                 }
  70.             }
  71.         }
  72.  
  73.         public void Customize() {
  74.             Hud.TogglePlugin<EliteMonsterAffixPlugin>(false);
  75.         }
  76.     }
  77.  
  78.     public class DAV_MonsterAffix {
  79.         public int Rank;
  80.         public bool showMiniMap { get; set; }
  81.         private float Size { get; set; }
  82.         private float SizeMap { get; set; }
  83.         public ITexture AffixTexture { get; set; }
  84.  
  85.         public DAV_MonsterAffix(IController hud, int rank, ITexture affixIcon, bool showMap = true, float radius = 0.6f, float mapRadius = 0.6f) {
  86.             Rank = rank;
  87.             showMiniMap = showMap;
  88.             AffixTexture = affixIcon;
  89.             SizeMap = 11f / 480f * hud.Window.Size.Height * ((mapRadius <= 0f) ? 0.6f : mapRadius);
  90.             Size= 11f / 240f * hud.Window.Size.Height * ((radius <= 0f) ? 0.6f : radius);
  91.         }
  92.  
  93.         public void Paint(IController hud, IWorldCoordinate coord, float offsetZ, int num, ref int rank) {
  94.             if (AffixTexture == null) return;
  95.            
  96.             var screenCoord = coord.ToScreenCoordinate();
  97.             AffixTexture.Draw(screenCoord.X - (Size / 2f) * (float)(num - 2*rank), screenCoord.Y - Size / 2f + Size * offsetZ, Size, Size);
  98.             rank++;
  99.         }
  100.  
  101.         public void PaintMiniMap(IController hud, IWorldCoordinate coord, float offsetMiniMap, int num, ref int rank) {
  102.             if (!showMiniMap || AffixTexture == null) return;
  103.  
  104.             hud.Render.GetMinimapCoordinates(coord.X, coord.Y, out var mapX, out var mapY);
  105.             AffixTexture.Draw(mapX - (SizeMap / 2f) * (float)(num - 2*rank), mapY - (SizeMap / 2f) + SizeMap * offsetMiniMap, SizeMap, SizeMap);
  106.             rank++;
  107.         }
  108.     }
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement