Guest User

DAV_NecroPetPlugin.cs edit for Simulacrum Clones

a guest
Jun 24th, 2020
814
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 20.93 KB | None | 0 0
  1. using Turbo.Plugins.Default;
  2. using System;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Globalization;
  6. using System.Collections.Generic;
  7.  
  8. namespace Turbo.Plugins.DavPlayer
  9. {
  10.     public class DAV_NecroPetPlugin : BasePlugin, IInGameWorldPainter, IInGameTopPainter, INewAreaHandler, IItemLocationChangedHandler {
  11.         public float barW, barH, barX, barY;
  12.        
  13.         // Command Skeleton ~~~~~~~~~~
  14.         private static uint SkeletonSkillSNO = 453801;
  15.         public HashSet<ActorSnoEnum> SkeletonActorSNOs = new HashSet<ActorSnoEnum> {
  16.             ActorSnoEnum._p6_necro_commandskeletons_a, // Skeleton - No Rune
  17.             ActorSnoEnum._p6_necro_commandskeletons_b, // Skeleton - Dark Mending
  18.             ActorSnoEnum._p6_necro_commandskeletons_c, // Skeleton - Frenzy
  19.             ActorSnoEnum._p6_necro_commandskeletons_d, // Skeleton - Kill Command
  20.             ActorSnoEnum._p6_necro_commandskeletons_e, // Skeleton - Enforcer
  21.             ActorSnoEnum._p6_necro_commandskeletons_f  // Skeleton - Freezing Grasp
  22.         };
  23.         public WorldDecoratorCollection SkeletonDecorator { get; set; }
  24.         public WorldDecoratorCollection SkeletonActiveDecorator { get; set; }
  25.         public TopLabelDecorator SkeletonCountLabel { get; set; }  
  26.         public int SkeletonCount { get; set; } = 0;
  27.         public string Label_Skeleton { get; set; } = "";
  28.         public bool ShowSkeleton { get; set; } = false;
  29.        
  30.         // Command Skeleton Target ~~~~~~~~~~
  31.         public WorldDecoratorCollection SkeletonTargetDecorator { get; set; }
  32.         public WorldDecoratorCollection SkeletonTargetEliteDecorator { get; set; }
  33.         public bool TargetOnEliteOnly { get; set; } = false;
  34.        
  35.         // Command Skeleton of other players ~~~~~~~~~~
  36.         public WorldDecoratorCollection SkeletonOtherDecorator { get; set; }
  37.         public string Label_SkeletonOthers { get; set; } = "";
  38.         public bool ShowSkeletonOthers { get; set; } = false;
  39.        
  40.         // Skeleton Mage ~~~~~~~~~~
  41.         private static uint MageSkillSNO = 462089;
  42.         public HashSet<ActorSnoEnum> MageActorSNOs = new HashSet<ActorSnoEnum> {
  43.             ActorSnoEnum._p6_necro_skeletonmage_a, // Skeleton Mage - No Rune
  44.             ActorSnoEnum._p6_necro_skeletonmage_b, // Skeleton Mage - Gift of Death
  45.             ActorSnoEnum._p6_necro_skeletonmage_c, // Skeleton Mage - Singularity
  46.             ActorSnoEnum._p6_necro_skeletonmage_d, // Skeleton Mage - Life Support
  47.             ActorSnoEnum._p6_necro_skeletonmage_e, // Skeleton Mage - Contamination
  48.             ActorSnoEnum._p6_necro_skeletonmage_f_archer // Skeleton Mage - Archer
  49.         };
  50.         public WorldDecoratorCollection MageDecorator { get; set; }
  51.         public TopLabelDecorator MageCountLabel { get; set; }
  52.         public int MageCount { get; set; } = 0;
  53.         public string Label_Mage { get; set; } = "";
  54.         public bool ShowMage { get; set; } = false;
  55.        
  56.         // Golem ~~~~~~~~~~
  57.         private static uint GolemSkillSNO = 451537;
  58.         public HashSet<ActorSnoEnum> GolemActorSNOs = new HashSet<ActorSnoEnum> {
  59.             ActorSnoEnum._p6_decaygolem, // No Rune & Flesh Golem Rune
  60.             ActorSnoEnum._p6_bonegolem, // Bone Golem Rune
  61.             ActorSnoEnum._p6_consumefleshgolem, // Decay Golem Rune
  62.             ActorSnoEnum._p6_icegolem, // Ice Golem Rune
  63.             ActorSnoEnum._p6_bloodgolem // Blood Golem Rune
  64.         };
  65.         public WorldDecoratorCollection GolemDecorator { get; set; }
  66.         public string Label_Golem { get; set; } = "";
  67.         public bool ShowGolem { get; set; } = true;
  68.        
  69.         // Simulacrum ~~~~~~~~~~
  70.         private static uint SimulacrumSkillSNO = 465350;
  71.         public HashSet<ActorSnoEnum> SimulacrumActorSNOs = new HashSet<ActorSnoEnum> {
  72.             ActorSnoEnum._p6_necro_simulacrum_a_set, // New Haunted Visions 2.6.9
  73.             ActorSnoEnum._p6_necro_simulacrum_a, // Old Haunted Visions
  74.         };
  75.         public WorldDecoratorCollection SimulacrumDecorator { get; set; }
  76.         public string Label_Simulacrum { get; set; } = "My Sim";
  77.         public bool ShowSimulacrum { get; set; } = true;
  78.  
  79.         // Simulacrum Clones of other players ~~~~~~~~~~
  80.         public WorldDecoratorCollection SimulacrumOtherDecorator { get; set; }
  81.         public string Label_SimulacrumOthers { get; set; } = "Sim";
  82.         public bool ShowSimulacrumOthers { get; set; } = true;
  83.        
  84.        
  85.         // Revive ~~~~~~~~~~
  86.         private static uint ReviveSkillSNO = 462239;
  87.         public WorldDecoratorCollection ReviveDecorator { get; set; }
  88.         public TopLabelDecorator ReviveCountLabel { get; set; }
  89.         public int ReviveCount { get; set; } = 0;
  90.         public string Label_Revive { get; set; } = "";
  91.         public bool ShowRevive { get; set; } = false;
  92.  
  93.         // Ringer timer ~~~~~~~~~~
  94.         public IMonster ActiveTarget { get; set; }
  95.         public IFont ActiveFont { get; set; }
  96.         public IWatch ActiveTime { get; set; }
  97.         public IWatch ActiveTimeLong { get; set; }
  98.         public ITexture RingerTexture { get; set; }
  99.         private bool SkillPress { get; set; } = false;
  100.         public float Xpos { get; set; }
  101.         public float Ypos { get; set; }
  102.         public float texsize { get; set; }
  103.         public int legpower { get; set; } = 30;
  104.         public bool GRonly { get; set; } = false;
  105.         public bool Bossonly { get; set; } = false;
  106.         public bool showTimerShort { get; set; } = true;
  107.         public bool showTimerLong { get; set; } = true;
  108.        
  109.         public DAV_NecroPetPlugin() {
  110.             Enabled = true;
  111.         }
  112.  
  113.         public override void Load(IController hud) {
  114.             base.Load(hud);
  115.             Order = 30950;
  116.             // Display coordinated for indicators
  117.             barW = Hud.Window.Size.Width * 0.012f;
  118.             barH = Hud.Window.Size.Height * 0.0175f;
  119.             barX = Hud.Window.Size.Width * 0.45f;
  120.             barY = Hud.Window.Size.Height * 0.62f;
  121.            
  122.             // Display Ringer Timer
  123.             Xpos = Hud.Window.Size.Width * 0.7f;
  124.             Ypos = Hud.Window.Size.Height * 0.7f;
  125.             texsize = Hud.Window.Size.Width * 0.025f;
  126.             ActiveFont = Hud.Render.CreateFont("tahoma", 10, 255, 51, 51, 51, false, false, 250, 255, 255, 255, true);
  127.             ActiveTarget = null;
  128.             ActiveTime = Hud.Time.CreateWatch();
  129.             ActiveTimeLong = Hud.Time.CreateWatch();
  130.             RingerTexture = Hud.Texture.GetItemTexture(Hud.Sno.SnoItems.P6_Unique_Phylactery_02);
  131.            
  132.             // Decorator Setting
  133.             var petsize = -1;
  134.  
  135.             SkeletonDecorator = new WorldDecoratorCollection(
  136.                 new GroundCircleDecorator(Hud) {
  137.                     Brush = Hud.Render.CreateBrush(240, 51, 255, 51, 3),
  138.                     Radius = petsize,
  139.                 },
  140.                 new GroundLabelDecorator(Hud) {
  141.                     BackgroundBrush = Hud.Render.CreateBrush(240, 51, 255, 51, 0),
  142.                     TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 255, 255, 255, true, false, false)
  143.                 }
  144.             );
  145.            
  146.             SkeletonOtherDecorator = new WorldDecoratorCollection(
  147.                 new GroundCircleDecorator(Hud) {
  148.                     Brush = Hud.Render.CreateBrush(240, 51, 255, 51, 3, SharpDX.Direct2D1.DashStyle.Dash),
  149.                     Radius = petsize,
  150.                 },
  151.                 new GroundLabelDecorator(Hud) {
  152.                     BackgroundBrush = Hud.Render.CreateBrush(240, 51, 255, 51, 0),
  153.                     TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 255, 255, 255, true, false, false)
  154.                 }
  155.             );
  156.            
  157.             SkeletonActiveDecorator = new WorldDecoratorCollection(
  158.                 new GroundCircleDecorator(Hud) {
  159.                     Brush = Hud.Render.CreateBrush(204, 255, 255, 153, 0),
  160.                     Radius = 0.8f,
  161.                 }
  162.             );
  163.  
  164.             SkeletonTargetEliteDecorator = new WorldDecoratorCollection(
  165.                 new GroundShapeDecorator(Hud) {
  166.                     Brush = Hud.Render.CreateBrush(204, 255, 102, 102, 3f),
  167.                     ShapePainter = WorldStarShapePainter.NewDoubleSquare(Hud),
  168.                     RotationTransformator = new CircularRotationTransformator(Hud, 30),
  169.                     Radius = 5f
  170.                 },
  171.                 new MapShapeDecorator(Hud) {
  172.                     Brush = Hud.Render.CreateBrush(255, 255, 255, 255, -1),
  173.                     ShapePainter = new LineFromMeShapePainter(Hud)
  174.                 }
  175.             );
  176.            
  177.             SkeletonTargetDecorator = new WorldDecoratorCollection(
  178.                 new GroundCircleDecorator(Hud) {
  179.                     Brush = Hud.Render.CreateBrush(180, 255, 0, 0, 6),
  180.                     Radius = 0.3f  
  181.                 },
  182.                 new GroundShapeDecorator(Hud) {
  183.                     Brush = Hud.Render.CreateBrush(204, 255, 102, 102, 3f),
  184.                     ShapePainter = WorldStarShapePainter.NewOctagon(Hud),
  185.                     RotationTransformator = new CircularRotationTransformator(Hud, 30),
  186.                     Radius = 5f
  187.                 }
  188.             );
  189.  
  190.             MageDecorator = new WorldDecoratorCollection(
  191.                 new GroundCircleDecorator(Hud) {
  192.                     Brush = Hud.Render.CreateBrush(240, 255, 153, 51, 3),
  193.                     Radius = petsize,
  194.                 },
  195.                 new GroundLabelDecorator(Hud) {
  196.                     BackgroundBrush = Hud.Render.CreateBrush(240, 255, 153, 51, 0),
  197.                     TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 255, 255, 255, true, false, false)
  198.                 }
  199.             );
  200.  
  201.             GolemDecorator = new WorldDecoratorCollection(
  202.                 new GroundCircleDecorator(Hud) {
  203.                     Brush = Hud.Render.CreateBrush(240, 51, 153, 255, 3),
  204.                     Radius = 2f,
  205.                 },
  206.                 new GroundLabelDecorator(Hud) {
  207.                     BackgroundBrush = Hud.Render.CreateBrush(240, 51, 153, 255, 0),
  208.                     TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 255, 255, 255, true, false, false)
  209.                 }
  210.             );
  211.  
  212.             SimulacrumDecorator = new WorldDecoratorCollection(
  213.                 new GroundCircleDecorator(Hud) {
  214.                     Brush = Hud.Render.CreateBrush(255, 255, 255, 255, 3f),
  215.                     Radius = 0.3f,
  216.                 },
  217.                 new GroundCircleDecorator(Hud) {
  218.                     Brush = Hud.Render.CreateBrush(255, 0, 255, 255, 4f),
  219.                     Radius = 1f,
  220.                 },
  221.                 new GroundCircleDecorator(Hud) {
  222.                     Brush = Hud.Render.CreateBrush(255, 255, 255, 255, 4f),
  223.                     Radius = 1.6f,
  224.                 },
  225.                 new GroundLabelDecorator(Hud) {
  226.                     BackgroundBrush = Hud.Render.CreateBrush(240, 51, 153, 255, 0),
  227.                     TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 255, 255, 255, true, false, false)
  228.                 }
  229.             );
  230.  
  231.             SimulacrumOtherDecorator = new WorldDecoratorCollection(
  232.                 new GroundCircleDecorator(Hud) {
  233.                     Brush = Hud.Render.CreateBrush(255, 255, 255, 255, 3f),
  234.                     Radius = 0.3f,
  235.                 },
  236.                 new GroundCircleDecorator(Hud) {
  237.                     Brush = Hud.Render.CreateBrush(255, 0, 255, 255, 4f),
  238.                     Radius = 1f,
  239.                 },
  240.                 new GroundCircleDecorator(Hud) {
  241.                     Brush = Hud.Render.CreateBrush(255, 255, 255, 255, 4f),
  242.                     Radius = 1.6f,
  243.                 },
  244.                 new GroundLabelDecorator(Hud) {
  245.                     BackgroundBrush = Hud.Render.CreateBrush(240, 255, 51, 51, 0),
  246.                     TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 255, 255, 255, true, false, false)
  247.                 }
  248.             );
  249.  
  250.             ReviveDecorator = new WorldDecoratorCollection(
  251.                 new GroundCircleDecorator(Hud) {
  252.                     Brush = Hud.Render.CreateBrush(240, 153, 51, 255, 3),
  253.                     Radius = -1,
  254.                 },
  255.                 new GroundLabelDecorator(Hud) {
  256.                     BackgroundBrush = Hud.Render.CreateBrush(240, 153, 51, 255, 0),
  257.                     TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 255, 255, 255, true, false, false)
  258.                 }
  259.             );
  260.  
  261.             // Pet Number Count Label
  262.             SkeletonCountLabel = new TopLabelDecorator(Hud) {
  263.                 TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 255, 240, 0, false, false, true),
  264.                 BackgroundTexture1 = Hud.Texture.ButtonTextureGray,
  265.                 BackgroundTexture2 = Hud.Texture.BackgroundTextureGreen,
  266.                 BackgroundTextureOpacity2 = 0.5f,
  267.                 TextFunc = () => SkeletonCount.ToString()
  268.             };
  269.  
  270.             MageCountLabel = new TopLabelDecorator(Hud) {
  271.                 TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 255, 240, 0, false, false, true),
  272.                 BackgroundTexture1 = Hud.Texture.ButtonTextureOrange,
  273.                 BackgroundTexture2 = Hud.Texture.BackgroundTextureGreen,
  274.                 BackgroundTextureOpacity2 = 0.5f,
  275.                 TextFunc = () => MageCount.ToString()
  276.             };
  277.            
  278.             ReviveCountLabel = new TopLabelDecorator(Hud) {
  279.                 TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 255, 240, 0, false, false, true),
  280.                 BackgroundTexture1 = Hud.Texture.ButtonTextureOrange,
  281.                 BackgroundTexture2 = Hud.Texture.BackgroundTextureGreen,
  282.                 BackgroundTextureOpacity2 = 0.5f,
  283.                 TextFunc = () => ReviveCount.ToString()
  284.             };
  285.         }
  286.  
  287.         public void PaintWorld(WorldLayer layer) {
  288.             if (ShowSkeletonOthers) {
  289.                 var players = Hud.Game.Players.Where(player => !player.IsMe && player.HeroClassDefinition.HeroClass == HeroClass.Necromancer && player.CoordinateKnown && Hud.Game.Me.SnoArea.Sno == player.SnoArea.Sno && (player.HeadStone == null));
  290.                 var OtherActors = Hud.Game.Actors.Where(EachActor => EachActor.SummonerAcdDynamicId != Hud.Game.Me.SummonerId && SkeletonActorSNOs.Contains(EachActor.SnoActor.Sno));
  291.                
  292.                 foreach(var player in players) {
  293.                     var IsActive = player.Powers.BuffIsActive(SkeletonSkillSNO, 0);
  294.                     foreach (var OtherActor in OtherActors) {
  295.                         if (OtherActor.SummonerAcdDynamicId == player.SummonerId) {
  296.                             SkeletonOtherDecorator.Paint(layer, OtherActor, OtherActor.FloorCoordinate, Label_SkeletonOthers);
  297.                             if (IsActive)
  298.                                 SkeletonActiveDecorator.Paint(layer, OtherActor, OtherActor.FloorCoordinate, Label_SkeletonOthers);
  299.                         }
  300.                     }
  301.                 }
  302.             }
  303.             if (ShowSimulacrumOthers) {
  304.                 var players = Hud.Game.Players.Where(player => !player.IsMe && player.HeroClassDefinition.HeroClass == HeroClass.Necromancer && player.CoordinateKnown && Hud.Game.Me.SnoArea.Sno == player.SnoArea.Sno && (player.HeadStone == null));
  305.                 var OtherActors = Hud.Game.Actors.Where(EachActor => EachActor.SummonerAcdDynamicId != Hud.Game.Me.SummonerId && SimulacrumActorSNOs.Contains(EachActor.SnoActor.Sno));
  306.                
  307.                 foreach(var player in players) {
  308.                     var IsActive = player.Powers.BuffIsActive(SimulacrumSkillSNO, 0);
  309.                     foreach (var OtherActor in OtherActors) {
  310.                         if (OtherActor.SummonerAcdDynamicId == player.SummonerId) {
  311.                             SimulacrumOtherDecorator.Paint(layer, OtherActor, OtherActor.FloorCoordinate, Label_SimulacrumOthers);
  312.                         }
  313.                     }
  314.                 }
  315.             }
  316.            
  317.             if (Hud.Game.Me.HeroClassDefinition.HeroClass != HeroClass.Necromancer) return;
  318.  
  319.             // For Skeleton Melee, only when equipping the skill
  320.             var skill = Hud.Game.Me.Powers.UsedSkills.FirstOrDefault(s => s.SnoPower.Sno == Hud.Sno.SnoPowers.Necromancer_CommandSkeletons.Sno);
  321.             if (skill != null) {
  322.                 var activeSkeleton = Hud.Game.Me.Powers.BuffIsActive(SkeletonSkillSNO, 0);
  323.                 var SkeletonActors = Hud.Game.Actors.Where(EachActor => EachActor.SummonerAcdDynamicId == Hud.Game.Me.SummonerId && SkeletonActorSNOs.Contains(EachActor.SnoActor.Sno));
  324.                    
  325.                 if (ShowSkeleton) {
  326.                     SkeletonCount = SkeletonActors.Count();
  327.                     foreach (var EachActor in SkeletonActors) {
  328.                         SkeletonDecorator.Paint(layer, EachActor, EachActor.FloorCoordinate, null);
  329.                         if (activeSkeleton)
  330.                             SkeletonActiveDecorator.Paint(layer, EachActor, EachActor.FloorCoordinate, Label_Skeleton);
  331.                     }
  332.                 }
  333.  
  334.                 if (activeSkeleton || skill.Rune == 3) {
  335.                     IAttribute attr;
  336.                     switch (skill.Rune) {
  337.                         case 0: attr = Hud.Sno.Attributes.Power_Buff_4_Visual_Effect_A; break;
  338.                         case 1: attr = Hud.Sno.Attributes.Power_Buff_4_Visual_Effect_B; break;
  339.                         case 2: attr = Hud.Sno.Attributes.Power_Buff_4_Visual_Effect_C; break;
  340.                         case 3: attr = Hud.Sno.Attributes.Power_Buff_4_Visual_Effect_D; break;
  341.                         case 4: attr = Hud.Sno.Attributes.Power_Buff_4_Visual_Effect_E; break;
  342.                         default: attr = Hud.Sno.Attributes.Power_Buff_4_Visual_Effect_None; break;
  343.                     }
  344.            
  345.                     var TargetonScreen = false;
  346.                     foreach (IMonster monster in Hud.Game.AliveMonsters) {
  347.                         if (monster.GetAttributeValueAsUInt(attr, Hud.Sno.SnoPowers.Necromancer_CommandSkeletons.Sno, 2) == 1) {
  348.                             TargetonScreen = true;
  349.                            
  350.                             if (ActiveTarget == null) {
  351.                                 ActiveTarget = monster;
  352.                                 if (Hud.Game.Me.Powers.BuffIsActive(476584, 0)) {
  353.                                     ResetRinger(false);
  354.                                     StartRinger();
  355.                                 }
  356.                             }
  357.                             else if (ActiveTarget != monster) {
  358.                                 ActiveTarget = monster;
  359.                                 if (Hud.Game.Me.Powers.BuffIsActive(476584, 0)) {
  360.                                     ResetRinger(true);
  361.                                     StartRinger();
  362.                                 }
  363.                             }
  364.                            
  365.                             var TargetisElite = (monster.IsElite && monster.SummonerAcdDynamicId == 0 && monster.Rarity != ActorRarity.RareMinion);
  366.                             if (TargetisElite)
  367.                                 SkeletonTargetEliteDecorator.Paint(layer, null, monster.FloorCoordinate, null);
  368.                             else if (!TargetOnEliteOnly)
  369.                                 SkeletonTargetDecorator.Paint(layer, null, monster.FloorCoordinate, null);
  370.                            
  371.                             break;
  372.                         }
  373.                     }
  374.                        
  375.                     if (Hud.Game.Me.Powers.BuffIsActive(476584, 0)) {
  376.                         if (SkeletonCount == 0) {
  377.                             ResetRinger(true);
  378.                             StartRinger();
  379.                         }
  380.                         if (!TargetonScreen) {
  381.                             ActiveTarget = null;
  382.                             ResetRinger(false);
  383.                         }
  384.                     }
  385.                 }
  386.                 else {
  387.                     ResetRinger(true);
  388.                 }
  389.             }
  390.             else SkeletonCount = 0;
  391.  
  392.             // For Skeleton Mages, only when equipping the skill
  393.             if (ShowMage && Hud.Game.Me.Powers.UsedSkills.Where(x => x.SnoPower.Sno == MageSkillSNO) != null) {
  394.                 var MageActors = Hud.Game.Actors.Where(EachActor => EachActor.SummonerAcdDynamicId == Hud.Game.Me.SummonerId && MageActorSNOs.Contains(EachActor.SnoActor.Sno));
  395.                 MageCount = MageActors.Count();
  396.  
  397.                 foreach (var EachActor in MageActors)
  398.                     MageDecorator.Paint(layer, EachActor, EachActor.FloorCoordinate, Label_Mage);
  399.             }
  400.             else MageCount = 0;
  401.                
  402.            
  403.             // For Golem, only when equipping the skill
  404.             if (ShowGolem && Hud.Game.Me.Powers.UsedSkills.Where(x => x.SnoPower.Sno == GolemSkillSNO) != null) {
  405.                 var GolemActors = Hud.Game.Actors.Where(EachActor => EachActor.SummonerAcdDynamicId == Hud.Game.Me.SummonerId && GolemActorSNOs.Contains(EachActor.SnoActor.Sno));
  406.  
  407.                 foreach (var EachActor in GolemActors)
  408.                     GolemDecorator.Paint(layer, EachActor, EachActor.FloorCoordinate, Label_Golem);
  409.             }
  410.  
  411.             // For Simulacrum, only when equipping the skill
  412.             if (ShowSimulacrum && Hud.Game.Me.Powers.UsedSkills.Where(x => x.SnoPower.Sno == SimulacrumSkillSNO) != null) {
  413.                 var SimulacrumActors = Hud.Game.Actors.Where(EachActor => EachActor.SummonerAcdDynamicId == Hud.Game.Me.SummonerId && SimulacrumActorSNOs.Contains(EachActor.SnoActor.Sno));
  414.  
  415.                 foreach (var EachActor in SimulacrumActors)
  416.                     SimulacrumDecorator.Paint(layer, EachActor, EachActor.FloorCoordinate, Label_Simulacrum);
  417.             }
  418.            
  419.             // For Revive, only when equipping the skill
  420.             if (ShowRevive && Hud.Game.Me.Powers.UsedSkills.Where(x => x.SnoPower.Sno == ReviveSkillSNO) != null) {
  421.                 var ReviveActors = Hud.Game.Actors.Where(EachActor => EachActor.SummonerAcdDynamicId == Hud.Game.Me.SummonerId && EachActor.SnoActor.Sno.ToString().Contains("_p6_necro_revive"));
  422.                 ReviveCount = ReviveActors.Count();
  423.  
  424.                 foreach (var EachActor in ReviveActors)
  425.                     ReviveDecorator.Paint(layer, EachActor, EachActor.FloorCoordinate, Label_Revive);
  426.             }
  427.             else ReviveCount = 0;
  428.         }
  429.  
  430.         public void PaintTopInGame(ClipState clipState) {
  431.             if (clipState != ClipState.BeforeClip) return;
  432.             if (Hud.Game.Me.HeroClassDefinition.HeroClass != HeroClass.Necromancer) return;
  433.  
  434.             if (SkeletonCount != 0) SkeletonCountLabel.Paint(barX, barY, barW, barH, HorizontalAlign.Center);
  435.             if (MageCount != 0) MageCountLabel.Paint(barX + 2*barW, barY, barW, barH, HorizontalAlign.Center);
  436.             if (ReviveCount != 0) ReviveCountLabel.Paint(barX + 4*barW, barY, barW, barH, HorizontalAlign.Center);
  437.            
  438.             if (ActiveTimeLong.IsRunning || ActiveTime.IsRunning) {
  439.                 RingerTexture.Draw(Xpos, Ypos, texsize, 2*texsize);
  440.  
  441.                 var text = "";
  442.                 if (showTimerShort) {
  443.                     var acctime1 = ActiveTime.ElapsedMilliseconds/1000;
  444.                     var accpower1 = (int) acctime1 * legpower;
  445.                     text += ValueToString(acctime1, ValueFormat.NormalNumberNoDecimal) + " sec +" + accpower1 + "%";
  446.                 }
  447.                 if (showTimerLong) {
  448.                     var acctime2 = ActiveTimeLong.ElapsedMilliseconds/1000;
  449.                     var accpower2 = (int) acctime2 * legpower;
  450.                     if (showTimerShort) text += "\n";
  451.                     text += ValueToString(acctime2, ValueFormat.NormalNumberNoDecimal) + " sec +" + accpower2 + "%";
  452.                 }
  453.  
  454.                 var textLayout = ActiveFont.GetTextLayout(text);
  455.                 ActiveFont.DrawText(textLayout, Xpos + texsize, Ypos + texsize - textLayout.Metrics.Height/2);
  456.             }
  457.         }
  458.        
  459.         public void OnNewArea(bool newGame, ISnoArea area) {
  460.             if (Hud.Game.Me.HeroClassDefinition.HeroClass != HeroClass.Necromancer) return;
  461.            
  462.             ActiveTarget = null;
  463.             ResetRinger(true);
  464.            
  465.             var items = Hud.Game.Items.Where(x => x.Location == ItemLocation.RightHand);
  466.             foreach (var item in items) {
  467.                 if (item.SnoItem.Sno != Hud.Sno.SnoItems.P6_Unique_Phylactery_02.Sno) continue;
  468.                
  469.                 foreach (var perfection in item.Perfections) {
  470.                     if (perfection.Attribute == Hud.Sno.Attributes.Item_Power_Passive) {
  471.                         legpower = (int) (perfection.Cur*100);
  472.                         return;
  473.                     }
  474.                 }
  475.             }
  476.         }
  477.        
  478.         public void OnItemLocationChanged(IItem item, ItemLocation from, ItemLocation to) {
  479.             if (Hud.Game.Me.HeroClassDefinition.HeroClass != HeroClass.Necromancer) return;
  480.             if (to != ItemLocation.RightHand) return;
  481.             if (item.SnoItem.Sno == Hud.Sno.SnoItems.P6_Unique_Phylactery_02.Sno) {
  482.                 foreach (var perfection in item.Perfections) {
  483.                     if (perfection.Attribute == Hud.Sno.Attributes.Item_Power_Passive) {
  484.                         legpower = (int) (perfection.Cur*100);
  485.                         ActiveTarget = null;
  486.                         ResetRinger(true);
  487.                         return;
  488.                     }
  489.                 }
  490.             }
  491.             else {
  492.                 ActiveTarget = null;
  493.                 ResetRinger(true);
  494.                 return;
  495.             }
  496.         }
  497.        
  498.         public void ResetRinger(bool resetAll) {
  499.             if (ActiveTime.IsRunning) {
  500.                 ActiveTime.Stop();
  501.                 ActiveTime.Reset();
  502.             }
  503.            
  504.             if (resetAll && ActiveTimeLong.IsRunning) {
  505.                 ActiveTimeLong.Stop();
  506.                 ActiveTimeLong.Reset();
  507.             }
  508.         }
  509.        
  510.         public void StartRinger() {
  511.             if (GRonly && Hud.Game.SpecialArea != SpecialArea.GreaterRift) return;
  512.             if (Bossonly && Hud.Game.RiftPercentage < 100) return;
  513.            
  514.             if (!ActiveTime.IsRunning)
  515.                 ActiveTime.Start();
  516.            
  517.             if (!ActiveTimeLong.IsRunning)
  518.                 ActiveTimeLong.Start();
  519.         }
  520.     }
  521. }
Add Comment
Please, Sign In to add comment