Example #1
0
 public override void Update()
 {
     // Raises the events only when the given interval has
     // passed since the last event, so it is okay to call every frame
     _tickEngine.Pulse();
 }
Example #2
0
 public override void Update()
 {
     _tickEngine.Pulse();
     base.Update();
 }
 public override void Update() => _tickEngine.Pulse();
Example #4
0
        public override void Update()
        {
            // Raises the events only when the given interval has
            // passed since the last event, so it is okay to call every frame
            _tickEngine.Pulse();
            if (!OverlayWindow.IsVisible)
            {
                return;
            }
            if (!MouseDown)
            {
                FollowTargetWindow();
            }
            Combatant        self  = Program.mem?.GetSelfCombatant();
            List <Combatant> clist = Program.mem?._getCombatantList();

            if (self != null && clist != null)
            {
                clist.RemoveAll(c => c.OwnerID == self.ID);
                foreach (uint ID in clist.Where(c => c.Type == ObjectType.PC).Select(x => x.ID).ToList())
                {
                    clist.RemoveAll(c => c.OwnerID == ID);
                }
                RemoveUnvantedCombatants(self, clist);

                double centerY = OverlayWindow.Height / 2;
                double centerX = OverlayWindow.Width / 2;
                foreach (Combatant c in clist)
                {                                                                        //ridiculous posx+posy as key, no idea what else to use
                    if (c.ID == 3758096384 && !miscDrawMap.ContainsKey(c.PosX + c.PosY)) //for aetherytes, npcs, and other stuff;
                    {
                        miscDrawMap.Add(c.PosX + c.PosY, new EntityOverlayControl(c));
                        OverlayWindow.Add(miscDrawMap[c.PosX + c.PosY]);
                    }
                    else if (!drawMap.ContainsKey(c.ID))
                    {
                        drawMap.Add(c.ID, new EntityOverlayControl(c, c.ID == self.ID));
                        OverlayWindow.Add(drawMap[c.ID]);
                    }

                    double Top  = (c.PosY - self.PosY);
                    double Left = (c.PosX - self.PosX);
                    Top  += centerY + (Top * OverlayWindow.Height * .003 * Properties.Settings.Default.RadarZoom);
                    Left += centerX + (Left * OverlayWindow.Width * .003 * Properties.Settings.Default.RadarZoom);
                    if (drawMap.ContainsKey(c.ID))
                    {
                        drawMap[c.ID].Update(c);
                        Top  -= (drawMap[c.ID].ActualHeight / 2);
                        Left -= (drawMap[c.ID].ActualWidth / 2);
                        if (Top < 0)
                        {
                            Canvas.SetTop(drawMap[c.ID], 0);
                        }
                        else if (Top > OverlayWindow.Height - drawMap[c.ID].ActualHeight)
                        {
                            Canvas.SetTop(drawMap[c.ID], OverlayWindow.Height - drawMap[c.ID].ActualHeight);
                        }
                        else
                        {
                            Canvas.SetTop(drawMap[c.ID], Top);
                        }

                        if (Left < 0)
                        {
                            Canvas.SetLeft(drawMap[c.ID], 0);
                        }
                        else if (Left > OverlayWindow.Width - drawMap[c.ID].ActualWidth)
                        {
                            Canvas.SetLeft(drawMap[c.ID], OverlayWindow.Width - drawMap[c.ID].ActualWidth);
                        }
                        else
                        {
                            Canvas.SetLeft(drawMap[c.ID], Left);
                        }
                    }
                    else if (miscDrawMap.ContainsKey(c.PosX + c.PosY))
                    {
                        miscDrawMap[c.PosX + c.PosY].Update(c);
                        Top  -= (miscDrawMap[c.ID].ActualHeight / 2);
                        Left -= (miscDrawMap[c.ID].ActualWidth / 2);
                        Canvas.SetTop(miscDrawMap[c.PosX + c.PosY], Top);
                        Canvas.SetLeft(miscDrawMap[c.PosX + c.PosY], Left);
                    }
                }
            }

            //cleanup
            foreach (KeyValuePair <uint, EntityOverlayControl> entry in drawMap.ToArray())
            {
                //Hide hoard/cairn, after Banded Coffer appeared... hmm Hoard will re-appear if going out of "sight" and in again
                if (entry.Value.GetName().Equals("Hoard!") && (clist?.Any(c => c.EventType == EObjType.Banded) ?? false))
                {
                    entry.Value.Visibility = Visibility.Collapsed;
                    if (!hoardsDiscovered.Contains(entry.Key))
                    {
                        hoardsDiscovered.Add(entry.Key);
                    }
                    continue;
                }

                if (clist?.Exists(c => c.ID == entry.Key) ?? false)
                {
                    continue;
                }
                else
                {
                    entry.Value.Visibility = Visibility.Collapsed;
                    drawMap.Remove(entry.Key);
                }
            }
            foreach (KeyValuePair <float, EntityOverlayControl> entry in miscDrawMap.ToArray())
            {
                if (clist?.Exists(c => c.PosX + c.PosY == entry.Key) ?? false)
                {
                    continue;
                }
                else
                {
                    entry.Value.Visibility = Visibility.Collapsed;
                    miscDrawMap.Remove(entry.Key);
                }
            }
        }