Esempio n. 1
0
        public static void Collect()
        {
            try
            {
                get_UIElementMouseOver();

                if (A_Collection.Me.HeroStates.isInGame)
                {
                    get_isPlayerContextMenu();
                    get_isChatting();
                    get_isOpenMap();
                    get_isOpenFriendlist();
                    get_isOpenInventory();
                    get_isOpenSkillPanel();
                    get_isOpenBountyMap();
                    get_InventoryMesh();
                    get_isOpenGameMenu();
                    get_isOpenGuildMain();
                    get_isOpenLeaderboards();
                    get_isOpenAchievements();
                    get_isLeavingGame();
                }
            }
            catch (Exception e)
            {
                A_Handler.Log.ExceptionLogEntry newEntry = new A_Handler.Log.ExceptionLogEntry(e, DateTime.Now, A_Enums.ExceptionThread.ICollector);

                lock (A_Handler.Log.Exception.ExceptionLog) A_Handler.Log.Exception.ExceptionLog.Add(newEntry);
            }
        }
Esempio n. 2
0
        private static void get_StatsXP()
        {
            try
            {
                int currentparagon = A_Collection.Me.HeroGlobals.Alt_Lvl;

                A_Collection.Stats.Player.NextRoundedHundred = Math.Ceiling((double)currentparagon / 100) * 100;

                if (currentparagon == A_Collection.Stats.Player.NextRoundedHundred)
                {
                    A_Collection.Stats.Player.NextRoundedHundred = A_Collection.Stats.Player.NextRoundedHundred + 100;
                }

                A_Collection.Stats.Player.NextRoundedHundredTotalXP = A_Enums.ParagonXPTable.TotalXp[(int)A_Collection.Stats.Player.NextRoundedHundred];

                double xptotalleft = A_Collection.Stats.Player.NextRoundedHundredTotalXP - A_Collection.Stats.Player.TotalXP;

                A_Collection.Stats.Player.Progression = (A_Collection.Stats.Player.TotalXP / A_Collection.Stats.Player.NextRoundedHundredTotalXP) * 100;
                

            }
            catch (Exception e)
            {
                A_Handler.Log.ExceptionLogEntry newEntry = new A_Handler.Log.ExceptionLogEntry(e, DateTime.Now, A_Enums.ExceptionThread.Handler);

                lock (A_Handler.Log.Exception.ExceptionLog) A_Handler.Log.Exception.ExceptionLog.Add(newEntry);
            }
        }
        public static void Collect()
        {
            try
            {
                load_CustomDefinitions();
                load_AreaList();
                load_MonsterRiftProgress();
                load_SkillPowers();
                load_SNOPowers();
                load_ParagonPointSetups();
                load_SkillBuilds();
                load_GearSwaps();
                load_Tooltips_ConditionTypes();
                if (!OverridesLoaded)
                {
                    load_AutoCastOverrides();
                }
                update_AutoCastOverrides();
            }
            catch (Exception e)
            {
                A_Handler.Log.ExceptionLogEntry newEntry = new A_Handler.Log.ExceptionLogEntry(e, DateTime.Now, A_Enums.ExceptionThread.ECollector);

                lock (A_Handler.Log.Exception.ExceptionLog) A_Handler.Log.Exception.ExceptionLog.Add(newEntry);
            }
        }
Esempio n. 4
0
        public static void Collect()
        {
            try
            {
                if (A_Collection.Me.HeroStates.isInGame && A_Collection.Environment.Scene.GameTick > 1 && A_Collection.Environment.Scene.Counter_CurrentFrame != 0)
                {
                    get_ActiveSkills();

                    if (_lastPassiveUpdate.AddMilliseconds(500) <= DateTime.Now)
                    {
                        get_PassiveSkills();
                        _lastPassiveUpdate = DateTime.Now;
                    }

                    get_SkillControls();
                    get_HotBarSkills();

                    update_AutoCastOverrides();

                    if (_lastGearSwapUpdate.AddMilliseconds(250) <= DateTime.Now)
                    {
                        update_GearSwapitems();
                        _lastGearSwapUpdate = DateTime.Now;
                    }
                }
            }
            catch (Exception e)
            {
                A_Handler.Log.ExceptionLogEntry newEntry = new A_Handler.Log.ExceptionLogEntry(e, DateTime.Now, A_Enums.ExceptionThread.Handler);

                lock (A_Handler.Log.Exception.ExceptionLog) A_Handler.Log.Exception.ExceptionLog.Add(newEntry);
            }

        }
        private const int _intervallCollects = 1000; // Collect every x msec

        public static void Collect()
        {
            try
            {
                if (DateTime.Now >= _nextCollect)
                {
                    
                    get_ForceMove();
                    get_ForceStandStill();
                    get_ToggleInventory();
                    get_ToggleParagon();
                    get_ActionBarSkills();
                    get_Potion();
                    get_Townportal();
                    get_SkillsWindow();
                    get_CloseAllWindows();

                    _nextCollect = DateTime.Now.AddMilliseconds(_intervallCollects);
                    
                }
            }
            catch (Exception e)
            {
                A_Handler.Log.ExceptionLogEntry newEntry = new A_Handler.Log.ExceptionLogEntry(e, DateTime.Now,
                    A_Enums.ExceptionThread.ICollector);

                lock (A_Handler.Log.Exception.ExceptionLog) A_Handler.Log.Exception.ExceptionLog.Add(newEntry);
            }
        }
Esempio n. 6
0
        private static void get_isOpenAchievements()
        {
            try
            {
                A_Collection.D3UI.isOpenAchievementsMain = A_Tools.T_D3UI.UIElement.isVisible(A_Enums.UIElements.AchievementsMain);
            }
            catch (Exception e)
            {
                A_Handler.Log.ExceptionLogEntry newEntry = new A_Handler.Log.ExceptionLogEntry(e, DateTime.Now, A_Enums.ExceptionThread.ICollector);

                lock (A_Handler.Log.Exception.ExceptionLog) A_Handler.Log.Exception.ExceptionLog.Add(newEntry);
            }
        }
Esempio n. 7
0
        private static void get_D3ClientRect()
        {
            try
            {
                A_Collection.D3Client.Window.D3ClientRect = A_Tools.T_D3Client.getClient_Rect(Engine.Current.Process.MainWindowHandle);
            }
            catch (Exception e)
            {
                A_Handler.Log.ExceptionLogEntry newEntry = new A_Handler.Log.ExceptionLogEntry(e, DateTime.Now, A_Enums.ExceptionThread.ECollector);

                lock (A_Handler.Log.Exception.ExceptionLog) A_Handler.Log.Exception.ExceptionLog.Add(newEntry);
            }
        }
Esempio n. 8
0
        private static void get_isForeground()
        {
            try
            {
                A_Collection.D3Client.Window.isForeground = A_Tools.T_D3Client.IsForeground();
            }
            catch (Exception e)
            {
                A_Handler.Log.ExceptionLogEntry newEntry = new A_Handler.Log.ExceptionLogEntry(e, DateTime.Now, A_Enums.ExceptionThread.ECollector);

                lock (A_Handler.Log.Exception.ExceptionLog) A_Handler.Log.Exception.ExceptionLog.Add(newEntry);
            }
        }
Esempio n. 9
0
        public static void Collect()
        {
            try
            {
                get_AllActors();
            }
            catch (Exception e)
            {
                A_Handler.Log.ExceptionLogEntry newEntry = new A_Handler.Log.ExceptionLogEntry(e, DateTime.Now, A_Enums.ExceptionThread.ICollector);

                lock (A_Handler.Log.Exception.ExceptionLog) A_Handler.Log.Exception.ExceptionLog.Add(newEntry);
            }
        }
Esempio n. 10
0
        private static void get_UIElementMouseOver()
        {
            try
            {
                A_Collection.D3UI.UIElement_MouseOver = Engine.Current.ObjectManager.x9CC_Ptr_10000Bytes_UI.Dereference().x0A30_MouseOver.x008_Name;
            }
            catch (Exception e)
            {
                A_Handler.Log.ExceptionLogEntry newEntry = new A_Handler.Log.ExceptionLogEntry(e, DateTime.Now, A_Enums.ExceptionThread.ICollector);

                lock (A_Handler.Log.Exception.ExceptionLog) A_Handler.Log.Exception.ExceptionLog.Add(newEntry);
            }
            
        }
Esempio n. 11
0
        public static void handleEvents()
        {
            try
            {
                start_AutoGamble();
                start_GearSwapSelection();
            }
            catch (Exception e)
            {
                A_Handler.Log.ExceptionLogEntry newEntry = new A_Handler.Log.ExceptionLogEntry(e, DateTime.Now, A_Enums.ExceptionThread.Handler);

                lock (A_Handler.Log.Exception.ExceptionLog) A_Handler.Log.Exception.ExceptionLog.Add(newEntry);
            }
        }
Esempio n. 12
0
        public static void Collect()
        {
            try
            {
                get_isForeground();
                get_D3ClientRect();
            }
            catch (Exception e)
            {
                A_Handler.Log.ExceptionLogEntry newEntry = new A_Handler.Log.ExceptionLogEntry(e, DateTime.Now, A_Enums.ExceptionThread.ECollector);

                lock (A_Handler.Log.Exception.ExceptionLog) A_Handler.Log.Exception.ExceptionLog.Add(newEntry);
            }
        }
Esempio n. 13
0
        private static void load_MonsterRiftProgress()
        {
            try
            {
                if (A_Collection.Presets.Monsters.Monsters_RiftProgress.Count < 1)
                {
                    A_Tools.T_ExternalFile.Monsters.RiftProgress.Load();
                }
            }
            catch (Exception e)
            {
                A_Handler.Log.ExceptionLogEntry newEntry = new A_Handler.Log.ExceptionLogEntry(e, DateTime.Now, A_Enums.ExceptionThread.ECollector);

                lock (A_Handler.Log.Exception.ExceptionLog) A_Handler.Log.Exception.ExceptionLog.Add(newEntry);
            }
        }
Esempio n. 14
0
        private static void load_AreaList()
        {
            try
            {
                if(A_Collection.Environment.Areas.AreaList.Count < 1)
                {
                    A_Tools.T_ExternalFile.AreaList.Load();
                }
            }
            catch (Exception e)
            {
                A_Handler.Log.ExceptionLogEntry newEntry = new A_Handler.Log.ExceptionLogEntry(e, DateTime.Now, A_Enums.ExceptionThread.ECollector);

                lock (A_Handler.Log.Exception.ExceptionLog) A_Handler.Log.Exception.ExceptionLog.Add(newEntry);
            }
        }
Esempio n. 15
0
        public static void Collect()
        {
            try
            {
                UpdateHotkeyList();
                processPressedKeys();
                ResetLastProcessedHotkey();
                get_PressedIngameKeys();
            }
            catch (Exception e)
            {
                A_Handler.Log.ExceptionLogEntry newEntry = new A_Handler.Log.ExceptionLogEntry(e, DateTime.Now, A_Enums.ExceptionThread.ECollector);

                lock (A_Handler.Log.Exception.ExceptionLog) A_Handler.Log.Exception.ExceptionLog.Add(newEntry);
            }
        }
Esempio n. 16
0
        private static void get_NewRun()
        {
            try
            {
                if (!A_Collection.Me.HeroStates.isInGame)
                {
                    
                }
            }
            catch (Exception e)
            {
                A_Handler.Log.ExceptionLogEntry newEntry = new A_Handler.Log.ExceptionLogEntry(e, DateTime.Now, A_Enums.ExceptionThread.Handler);

                lock (A_Handler.Log.Exception.ExceptionLog) A_Handler.Log.Exception.ExceptionLog.Add(newEntry);
            }
        }
Esempio n. 17
0
        private static void start_GearSwapSelection()
        {
            try
            {
                if(A_Collection.Me.GearSwap.editModeEnabled)
                {
                    A_Handler.GearSwap.GearSwap.SelectionMode();
                }
            }
            catch (Exception e)
            {
                A_Handler.Log.ExceptionLogEntry newEntry = new A_Handler.Log.ExceptionLogEntry(e, DateTime.Now, A_Enums.ExceptionThread.Handler);

                lock (A_Handler.Log.Exception.ExceptionLog) A_Handler.Log.Exception.ExceptionLog.Add(newEntry);
            }
        }
Esempio n. 18
0
        private static void get_currentGRiftTier()
        {
            try
            {
                ActorCommonData Local;
                lock (A_Collection.Me.HeroGlobals.LocalACD) Local = A_Collection.Me.HeroGlobals.LocalACD;

                if(Local != null)
                    A_Collection.Environment.Areas.GreaterRift_Tier = (int)Local.GetAttributeValue(AttributeId.InTieredLootRunLevel) + 1;
            }
            catch (Exception e)
            {
                A_Handler.Log.ExceptionLogEntry newEntry = new A_Handler.Log.ExceptionLogEntry(e, DateTime.Now, A_Enums.ExceptionThread.ICollector);

                lock (A_Handler.Log.Exception.ExceptionLog) A_Handler.Log.Exception.ExceptionLog.Add(newEntry);
            }
        }
Esempio n. 19
0
        private static void get_ForceMove()
        {
            try
            {
                A_Collection.Preferences.Hotkeys.Key1_ForceMove = ((Enigma.D3.Enums.Key)Engine.Current.HotkeyPreferences.x430_Key1_ForceMove);
                A_Collection.Preferences.Hotkeys.ModKey1_ForceMove = ((Enigma.D3.Enums.ModKey)Engine.Current.HotkeyPreferences.x434_ModKey1_ForceMove);
                A_Collection.Preferences.Hotkeys.Key2_ForceMove = ((Enigma.D3.Enums.Key)Engine.Current.HotkeyPreferences.x438_Key2_ForceMove);
                A_Collection.Preferences.Hotkeys.ModKey2_ForceMove = ((Enigma.D3.Enums.ModKey)Engine.Current.HotkeyPreferences.x43C_ModKey2_ForceMove);

            }
            catch (Exception e)
            {
                A_Handler.Log.ExceptionLogEntry newEntry = new A_Handler.Log.ExceptionLogEntry(e, DateTime.Now, A_Enums.ExceptionThread.ICollector);

                lock (A_Handler.Log.Exception.ExceptionLog) A_Handler.Log.Exception.ExceptionLog.Add(newEntry);
            }
        }
Esempio n. 20
0
        private static void get_Potion()
        {
            try
            {
                A_Collection.Preferences.Hotkeys.Key1_Potion = ((Enigma.D3.Enums.Key)Engine.Current.HotkeyPreferences.x260_Key1_PotionButton);
                A_Collection.Preferences.Hotkeys.ModKey1_Potion = ((Enigma.D3.Enums.ModKey)Engine.Current.HotkeyPreferences.x264_ModKey1_PotionButton);
                A_Collection.Preferences.Hotkeys.Key2_Potion = ((Enigma.D3.Enums.Key)Engine.Current.HotkeyPreferences.x268_Key2_PotionButton);
                A_Collection.Preferences.Hotkeys.ModKey2_Potion = ((Enigma.D3.Enums.ModKey)Engine.Current.HotkeyPreferences.x26C_ModKey2_PotionButton);

            }
            catch (Exception e)
            {
                A_Handler.Log.ExceptionLogEntry newEntry = new A_Handler.Log.ExceptionLogEntry(e, DateTime.Now, A_Enums.ExceptionThread.ICollector);

                lock (A_Handler.Log.Exception.ExceptionLog) A_Handler.Log.Exception.ExceptionLog.Add(newEntry);
            }
        }
Esempio n. 21
0
        private static void get_currentLevelArea()
        {
            try
            {
                var levelArea = Enigma.D3.LevelArea.Instance.x044_SnoId;

                if (A_Collection.Environment.Areas.currentArea_SnoId != levelArea)
                    A_Collection.Me.HeroDetails.SnapShotted_APS = A_Collection.Me.HeroDetails.AttacksPerSecondTotal;

                A_Collection.Environment.Areas.currentArea_SnoId = levelArea;
            }
            catch (Exception e)
            {
                A_Handler.Log.ExceptionLogEntry newEntry = new A_Handler.Log.ExceptionLogEntry(e, DateTime.Now, A_Enums.ExceptionThread.ICollector);

                lock (A_Handler.Log.Exception.ExceptionLog) A_Handler.Log.Exception.ExceptionLog.Add(newEntry);
            }
        }
Esempio n. 22
0
        public static void handleStats()
        {
            try
            {
                if (TotalXP_changed)
                {
                    get_StatsXP();

                    TotalXP_changed = false;
                }
                get_NewRun();
            }
            catch (Exception e)
            {
                A_Handler.Log.ExceptionLogEntry newEntry = new A_Handler.Log.ExceptionLogEntry(e, DateTime.Now, A_Enums.ExceptionThread.Handler);

                lock (A_Handler.Log.Exception.ExceptionLog) A_Handler.Log.Exception.ExceptionLog.Add(newEntry);
            }
        }
Esempio n. 23
0
        private static void use_Potion()
        {
            try
            {
                if(A_Collection.Me.HeroDetails.Hitpoints_Percentage <= Properties.Settings.Default.AutoPotionValue)
                {
                    if(!A_Tools.Skills.Skills.S_Global.isOnCooldown(A_Enums.Powers.DrinkHealthPotion))
                    {
                        A_Tools.InputSimulator.IS_Keyboard.PressKey(A_Enums.ActionBarSlot.Potion);
                    }
                }
            }
            catch (Exception e)
            {
                A_Handler.Log.ExceptionLogEntry newEntry = new A_Handler.Log.ExceptionLogEntry(e, DateTime.Now, A_Enums.ExceptionThread.Handler);

                lock (A_Handler.Log.Exception.ExceptionLog) A_Handler.Log.Exception.ExceptionLog.Add(newEntry);
            }
        }
Esempio n. 24
0
        private static void get_AllPartyMembers()
        {
            try
            {

                lock (A_Collection.Environment.Actors.AllActors)
                {
                    lock(A_Collection.Me.Party.PartyMemberInRange) A_Collection.Me.Party.PartyMemberInRange = A_Collection.Environment.Actors.AllActors.Where(x => x.IsPlayer).ToList();
                    
                }

            }
            catch (Exception e)
            {
                A_Handler.Log.ExceptionLogEntry newEntry = new A_Handler.Log.ExceptionLogEntry(e, DateTime.Now, A_Enums.ExceptionThread.ICollector);

                lock (A_Handler.Log.Exception.ExceptionLog) A_Handler.Log.Exception.ExceptionLog.Add(newEntry);
            }
        }
Esempio n. 25
0
        private static void start_AutoGamble()
        {
            try
            {
                if (Properties.Settings.Default.AutoGambleBool)
                {
                    if (A_Collection.Me.HeroStates.isInTown)
                    {
                        A_Handler.AutoGamble.AutoGamble.start_Gamble();
                    }
                }
            }
            catch (Exception e)
            {
                A_Handler.Log.ExceptionLogEntry newEntry = new A_Handler.Log.ExceptionLogEntry(e, DateTime.Now, A_Enums.ExceptionThread.Handler);

                lock (A_Handler.Log.Exception.ExceptionLog) A_Handler.Log.Exception.ExceptionLog.Add(newEntry);
            }
        }
Esempio n. 26
0
        public static void handlePotion()
        {
            try
            {
                if (Properties.Settings.Default.AutoPotionBool && A_Collection.SkillCastConditions.Custom.CustomDefinitions.FirstOrDefault(x => x.Power.PowerSNO == 0) == null)
                {
                    if (!A_Collection.Me.HeroStates.isInTown && A_Collection.Me.HeroGlobals.LocalACD != null &&
                        A_Collection.Me.HeroStates.isInGame && A_Collection.Environment.Scene.GameTick > 1 &&
                        A_Collection.Environment.Scene.Counter_CurrentFrame != 0)
                    {
                        use_Potion();
                    }
                }
            }
            catch (Exception e)
            {
                A_Handler.Log.ExceptionLogEntry newEntry = new A_Handler.Log.ExceptionLogEntry(e, DateTime.Now, A_Enums.ExceptionThread.Handler);

                lock (A_Handler.Log.Exception.ExceptionLog) A_Handler.Log.Exception.ExceptionLog.Add(newEntry);
            }
        }
Esempio n. 27
0
        public static void Collect()
        {
            try
            {
                if (A_Collection.Me.HeroStates.isInGame && A_Collection.Environment.Scene.GameTick > 1 && A_Collection.Environment.Scene.Counter_CurrentFrame != 0)
                {
                    get_currentLevelArea();
                    if (!A_Collection.Me.HeroStates.isInTown && A_Collection.Me.HeroGlobals.LocalACD != null)
                    {
                        get_currentGRiftTier();

                        if (Properties.Settings.Default.overlayriftprogress)
                            get_RiftProgressInRange();
                    }
                }
            }
            catch (Exception e)
            {
                A_Handler.Log.ExceptionLogEntry newEntry = new A_Handler.Log.ExceptionLogEntry(e, DateTime.Now, A_Enums.ExceptionThread.ICollector);

                lock (A_Handler.Log.Exception.ExceptionLog) A_Handler.Log.Exception.ExceptionLog.Add(newEntry);
            }
        }
Esempio n. 28
0
        public static void handleSkills()
        {
            try
            {
                get_SkillsToCast();

                if (can_Cast())
                {
                    HealthPotion.HealthPotion.handlePotion();
                    try_SkillCasts();
                }
                else
                {
                    A_Tools.InputSimulator.IS_Keyboard.ChannelKey_StopAll();
                }
            }
            catch (Exception e)
            {
                A_Handler.Log.ExceptionLogEntry newEntry = new A_Handler.Log.ExceptionLogEntry(e, DateTime.Now, A_Enums.ExceptionThread.Handler);

                lock (A_Handler.Log.Exception.ExceptionLog) A_Handler.Log.Exception.ExceptionLog.Add(newEntry);
                                
            }
        }
Esempio n. 29
0
        public static void log_Exceptions()
        {
            try
            {
                List<ExceptionLogEntry> ExceptionsToWrite = new List<ExceptionLogEntry>();

                lock(ExceptionLog)
                {
                    foreach(var entry in ExceptionLog.ToList())
                    {
                        ExceptionsToWrite.Add(entry);

                        ExceptionLog.Remove(entry);
                    }
                }

                string WriteToFile = String.Empty;

                foreach(var entry in ExceptionsToWrite)
                {
                    WriteToFile = WriteToFile + entry.Timestamp.ToString("yyyy-MM-dd HH:mm:ss,ffff") + "\t" + entry.ExceptionThread.ToString() + "\t" + entry.E.Message + "\t" + entry.E.StackTrace + Environment.NewLine;

                    ExceptionCount++;
                }

                if (!Directory.Exists(LogFolderPath)) Directory.CreateDirectory(LogFolderPath);

                File.AppendAllText(ExceptionsFilePath, WriteToFile);
            }
            catch (System.Exception e)
            {
                A_Handler.Log.ExceptionLogEntry newEntry = new A_Handler.Log.ExceptionLogEntry(e, DateTime.Now, A_Enums.ExceptionThread.Handler);

                lock (A_Handler.Log.Exception.ExceptionLog) A_Handler.Log.Exception.ExceptionLog.Add(newEntry);
            }
        }
Esempio n. 30
0
        private void Render_UI(object sender, EventArgs e)
        {

            while (Engine.Current == null) System.Threading.Thread.Sleep(50);

            var tick = Engine.Current.ApplicationLoopCount;
            if (tick != _tick)
            {
                _tick = tick;

                try
                {
                    if (Engine.Current == null) Environment.Exit(1);

                    if (A_Collection.D3Client.Window.isForeground && 
                        !A_Collection.D3UI.isOpenGameMenu &&
                        !A_Collection.D3UI.isOpenGuildMain &&
                        !A_Collection.D3UI.isOpenLeaderboardsMain &&
                        !A_Collection.D3UI.isOpenAchievementsMain)
                    {



                        d3clientrect = A_Collection.D3Client.Window.D3ClientRect;

                        double FontSize = (double) (d3clientrect.Height*14/1000);
                        FontFamily fontfamily = new FontFamily("Arial");

                        System.Diagnostics.Stopwatch fpsSW = new System.Diagnostics.Stopwatch();
                        fpsSW.Start();


                        this.Left = d3clientrect.X;
                            //d3WndRect.Left;//mainScreen.Left;//Engine.Current.VideoPreferences.x0C_DisplayMode.x08_WinLeft;
                        this.Top = d3clientrect.Y;
                            //d3WndRect.Top;//mainScreen.Top;//Engine.Current.VideoPreferences.x0C_DisplayMode.x0C_WinTop;
                        this.Width = d3clientrect.Width;
                            //d3WndRect.Width;//mainScreen.Width;//Engine.Current.VideoPreferences.x0C_DisplayMode.x10_WinWidth;
                        this.Height = d3clientrect.Height;
                            //d3WndRect.Height;//mainScreen.Height;//Engine.Current.VideoPreferences.x0C_DisplayMode.x14_WinHeight;

                        
                        this.WindowState = System.Windows.WindowState.Normal;
                        canvas1.Children.Clear();

                        if (A_Collection.Me.HeroStates.isInGame &&
                            A_Collection.Environment.Scene.Counter_CurrentFrame != 0 &&
                            A_Collection.Environment.Scene.GameTick > 1)
                        {
                            populateRectRenderTargets();
                            //populateSkillButtonRectRenderTargets();
                            populateTextRenderTargets();
                            //populateSkillButtonImages();



                            var rectTargets = Overlay.rectRenderTargets;
                            //var rectSkillButtonTargets = Overlay.rectSkillButtonRenderTargets;
                            var textTargets = Overlay.textRenderTargets;
                            //var canvasSkillButtonImages = canvasSkillButtonImageTargets;

                            //// Draw BackgroundImages
                            if (Properties.Settings.Default.overlayxptracker) // XP Tracker BackgroundImage
                            {
                                Canvas mycanvas = new Canvas();


                                mycanvas.Width = A_Collection.D3Client.Window.D3ClientRect.Width*18/100;
                                mycanvas.Height = A_Collection.D3Client.Window.D3ClientRect.Height*4/100;

                                ImageBrush ib = new ImageBrush();
                                ib.ImageSource =
                                    new BitmapImage(getResourceUri("TraitList_Button_Inactive"));
                                mycanvas.Background = ib;

                                Canvas.SetLeft(mycanvas, d3clientrect.Width*20/100);
                                Canvas.SetTop(mycanvas, 0);

                                canvas1.Children.Add(mycanvas);
                            }


                            //////////////////////////

                            if (A_Collection.D3UI.isOpenInventory)
                            {
                                UIRect Inventory_MainPage =
                                    A_Tools.T_D3UI.UIElement.getRect(A_Enums.UIElements.InventoryMainPage);

                                // Render Version Info


                                //TextBlock VersionInfo = new TextBlock();
                                //VersionInfo.FontFamily = fontfamily;
                                //VersionInfo.FontSize = FontSize;
                                //VersionInfo.Text = "D3Helper V" + A_Tools.Version.AppVersion.version;
                                //VersionInfo.Foreground = new SolidColorBrush(Colors.White);
                                //Canvas.SetLeft(VersionInfo, Inventory_MainPage.Left + (Inventory_MainPage.Width*60/100));
                                //Canvas.SetTop(VersionInfo, Inventory_MainPage.Top + (Inventory_MainPage.Height*5/1000));
                                //canvas1.Children.Add(VersionInfo);

                                // Render Edit Mode Status
                                if (A_Collection.Me.GearSwap.editModeEnabled)
                                {
                                    TextBlock EditModeStatus = new TextBlock();
                                    EditModeStatus.FontFamily = fontfamily;
                                    EditModeStatus.FontSize = FontSize;
                                    EditModeStatus.Text = "EditMode On";
                                    EditModeStatus.Foreground = new SolidColorBrush(Colors.GreenYellow);
                                    Canvas.SetLeft(EditModeStatus,
                                        Inventory_MainPage.Left + (Inventory_MainPage.Width*60/100));
                                    Canvas.SetTop(EditModeStatus,
                                        Inventory_MainPage.Top + (Inventory_MainPage.Height*25/1000));
                                    canvas1.Children.Add(EditModeStatus);
                                }
                                else if (!A_Collection.Me.GearSwap.editModeEnabled)
                                {
                                    TextBlock EditModeStatus = new TextBlock();
                                    EditModeStatus.FontFamily = fontfamily;
                                    EditModeStatus.FontSize = FontSize;
                                    EditModeStatus.Text = "EditMode Off";
                                    EditModeStatus.Foreground = new SolidColorBrush(Colors.IndianRed);
                                    Canvas.SetLeft(EditModeStatus,
                                        Inventory_MainPage.Left + (Inventory_MainPage.Width*60/100));
                                    Canvas.SetTop(EditModeStatus,
                                        Inventory_MainPage.Top + (Inventory_MainPage.Height*25/1000));
                                    canvas1.Children.Add(EditModeStatus);
                                }

                                // Render AutoGamble Status
                                if (Properties.Settings.Default.AutoGambleBool)
                                {
                                    TextBlock AutoGambleStatus = new TextBlock();
                                    AutoGambleStatus.FontFamily = fontfamily;
                                    AutoGambleStatus.FontSize = FontSize;
                                    AutoGambleStatus.Text = "AutoGamble On";
                                    AutoGambleStatus.Foreground = new SolidColorBrush(Colors.GreenYellow);
                                    Canvas.SetLeft(AutoGambleStatus,
                                        Inventory_MainPage.Left + (Inventory_MainPage.Width*60/100));
                                    Canvas.SetTop(AutoGambleStatus,
                                        Inventory_MainPage.Top + (Inventory_MainPage.Height*40/1000));
                                    canvas1.Children.Add(AutoGambleStatus);
                                }
                                else
                                {
                                    TextBlock AutoGambleStatus = new TextBlock();
                                    AutoGambleStatus.FontFamily = fontfamily;
                                    AutoGambleStatus.FontSize = FontSize;
                                    AutoGambleStatus.Text = "AutoGamble Off";
                                    AutoGambleStatus.Foreground = new SolidColorBrush(Colors.IndianRed);
                                    Canvas.SetLeft(AutoGambleStatus,
                                        Inventory_MainPage.Left + (Inventory_MainPage.Width*60/100));
                                    Canvas.SetTop(AutoGambleStatus,
                                        Inventory_MainPage.Top + (Inventory_MainPage.Height*40/1000));
                                    canvas1.Children.Add(AutoGambleStatus);
                                }
                            }


                            foreach (var rect in rectTargets) // Render Rectangles
                            {
                                Rectangle r = rect.Rect;

                                Canvas.SetLeft(r, rect.PosLeft);
                                Canvas.SetTop(r, rect.PosTop);

                                canvas1.Children.Add(r);

                            }

                            #region SkillButtonDraws

                            if (A_Collection.Me.HeroStates.isInGame && A_Collection.Me.HeroGlobals.LocalACD != null)
                            {
                                Dictionary<int, int> ActiveSkills;
                                lock (A_Collection.Me.HeroDetails.ActiveSkills)
                                    ActiveSkills = A_Collection.Me.HeroDetails.ActiveSkills.ToDictionary(x => x.Key,
                                        y => y.Value);

                                if (ActiveSkills.FirstOrDefault(x => x.Key == 196974).Key == 0)
                                {

                                if (Properties.Settings.Default.overlayskillbuttons ||
                                    Properties.Settings.Default.overlayskillbuttonsastext)
                                {
                                    DrawSkillButtonCross();

                                    if (missingDefinitions)
                                    {
                                        string text =
                                            "There are one or more AutoCast Skills without a single defined CastDefinition.\nCheck if you specified cast to a specific rune.\nUse the SkillEditor to create Definitions.";
                                        float x = A_Collection.D3Client.Window.D3ClientRect.X +
                                                  (A_Collection.D3Client.Window.D3ClientRect.Width*2/100);
                                        float y = A_Collection.D3Client.Window.D3ClientRect.Y +
                                                  (A_Collection.D3Client.Window.D3ClientRect.Height/2);

                                        DrawScreenText(Colors.Red, 20, new FontFamily("Arial"), text, "", x, y);
                                    }
                                }

                                if (Properties.Settings.Default.overlayskillbuttons)
                                {
                                    if (A_Collection.Skills.UI_Controls.SkillControls[0].IsVisible())
                                    {
                                        DrawSkillButtonOutlines();

                                    }

                                }
                                if (Properties.Settings.Default.overlayskillbuttonsastext)
                                {
                                    if (A_Collection.Skills.UI_Controls.SkillControls[0].IsVisible())
                                    {
                                        DrawSkillButtonCorners();
                                    }

                                }

                            }
                        }

                            #endregion

                            foreach (var text in textTargets) // Render TextBlocks
                            {
                                TextBlock t = text.Text;

                                Canvas.SetLeft(t, text.PosLeft);
                                Canvas.SetTop(t, text.PosTop);

                                canvas1.Children.Add(t);


                            }



                            #region VersionInfo

                            DrawScreenText(Colors.OrangeRed, 15, new FontFamily("SansSerif"), "D3", "versioninfo",
                                d3clientrect.X + (d3clientrect.Width*17/1000),
                                d3clientrect.Y + (d3clientrect.Height*98/100), true);
                            DrawScreenText(Colors.DimGray, 15, new FontFamily("SansSerif"), "Helper", "versioninfo",
                                d3clientrect.X + (d3clientrect.Width*27/1000),
                                d3clientrect.Y + (d3clientrect.Height*98/100), true);

                            #endregion

                            #region MenuSettings
                            //DrawScreenImage(Properties.Resources.menu_iconsettings, d3clientrect.X + (d3clientrect.Width * 20/100), d3clientrect.Y);
                            #endregion

                            #region GRift Progress Draws

                            if (Properties.Settings.Default.overlayriftprogress &&
                                A_Collection.Environment.Areas.GreaterRift_Tier > 0 &&
                                !A_Collection.D3UI.isOpenInventory &&
                                A_Tools.T_D3UI.UIElement.isVisible(A_Enums.UIElements.Bar_GRiftProgress))
                            {
                                UIRect bar_riftprogress =
                                    A_Tools.T_D3UI.UIElement.getRect(A_Enums.UIElements.Bar_GRiftProgress);

                                DrawScreenText(Colors.PeachPuff, 14, new FontFamily("Arial Black"),
                                    "(" + Properties.Settings.Default.riftprogress_radius + " yrd) " +
                                    A_Collection.Environment.Actors.RiftProgressInRange_Percentage.ToString("0.00") +
                                    "%", "riftprogress", bar_riftprogress.Left,
                                    bar_riftprogress.Bottom + (bar_riftprogress.Height*150/100));
                            }

                            #endregion

                            #region ConventionPanel

                            //--
                            if (Properties.Settings.Default.overlayconventiondraws)
                            {
                                for (int i = 0; i < 4; i++)
                                {
                                    switch (i)
                                    {
                                        case 0:
                                            if (A_Collection.Me.HeroDetails.CurrentConventionElement == DamageType.none)
                                                continue;
                                            break;

                                        case 1:
                                            if (A_Collection.Me.Party.PartyMember1_CurrentConventionElement ==
                                                DamageType.none)
                                                continue;
                                            break;

                                        case 2:
                                            if (A_Collection.Me.Party.PartyMember2_CurrentConventionElement ==
                                                DamageType.none)
                                                continue;
                                            break;

                                        case 3:
                                            if (A_Collection.Me.Party.PartyMember3_CurrentConventionElement ==
                                                DamageType.none)
                                                continue;
                                            break;
                                    }



                                    switch (i)
                                    {
                                        case 0:
                                            UIRect portrait0 =
                                                A_Tools.T_D3UI.UIElement.getRect(A_Enums.UIElements.portrait_0);
                                            DamageType current0 = A_Collection.Me.HeroDetails.CurrentConventionElement;
                                            DamageType next0 = A_Collection.Me.HeroDetails.NextConventionElement;
                                            double ticksleft0 = A_Collection.Me.HeroDetails.Convention_TicksLeft;

                                            Draw_CurrentConvention(portrait0, current0, ticksleft0);
                                            Draw_NextConvention(portrait0, next0);
                                            break;

                                        case 1:
                                            UIRect portrait1 =
                                                A_Tools.T_D3UI.UIElement.getRect(A_Enums.UIElements.portrait_1);
                                            DamageType current1 =
                                                A_Collection.Me.Party.PartyMember1_CurrentConventionElement;
                                            DamageType next1 = A_Collection.Me.Party.PartyMember1_NextConventionElement;
                                            double ticksleft1 = A_Collection.Me.Party.PartyMember1_Convention_TicksLeft;

                                            Draw_CurrentConvention(portrait1, current1, ticksleft1);
                                            Draw_NextConvention(portrait1, next1);
                                            break;

                                        case 2:
                                            UIRect portrait2 =
                                                A_Tools.T_D3UI.UIElement.getRect(A_Enums.UIElements.portrait_2);
                                            DamageType current2 =
                                                A_Collection.Me.Party.PartyMember2_CurrentConventionElement;
                                            DamageType next2 = A_Collection.Me.Party.PartyMember2_NextConventionElement;
                                            double ticksleft2 = A_Collection.Me.Party.PartyMember2_Convention_TicksLeft;

                                            Draw_CurrentConvention(portrait2, current2, ticksleft2);
                                            Draw_NextConvention(portrait2, next2);
                                            break;

                                        case 3:
                                            UIRect portrait3 =
                                                A_Tools.T_D3UI.UIElement.getRect(A_Enums.UIElements.portrait_3);
                                            DamageType current3 =
                                                A_Collection.Me.Party.PartyMember3_CurrentConventionElement;
                                            DamageType next3 = A_Collection.Me.Party.PartyMember3_NextConventionElement;
                                            double ticksleft3 = A_Collection.Me.Party.PartyMember3_Convention_TicksLeft;

                                            Draw_CurrentConvention(portrait3, current3, ticksleft3);
                                            Draw_NextConvention(portrait3, next3);
                                            break;
                                    }
                                }
                            }
                            //

                            #endregion

                            #region TotalAPS && Snapshoted TotalAPS Draws

                            if (Properties.Settings.Default.Overlay_APS)
                            {
                                string text = "CurAPS " + A_Collection.Me.HeroDetails.AttacksPerSecondTotal.ToString("0.00") + System.Environment.NewLine +
                                              "SnapAPS " + A_Collection.Me.HeroDetails.SnapShotted_APS.ToString("0.00");

                                DrawCursorText(Colors.LightSeaGreen, 14, new FontFamily("Arial Black"), text, 30, 30);
                                
                            }
                            #endregion

                            get_MouseIfHoveringUiElements();

                        }

                        this.Topmost = true;

                        fpsSW.Stop();
                        TimeSpan elapsedFpsSW = fpsSW.Elapsed;

                        renderFramesPerSecond = /*1000 / */ elapsedFpsSW.TotalMilliseconds;

                        double TimeLeftToNextTick = ((1000/Properties.Settings.Default.D3Helper_UpdateRate) -
                                                     elapsedFpsSW.TotalMilliseconds);
                        if (TimeLeftToNextTick > 0)
                            System.Threading.Thread.Sleep((int) TimeLeftToNextTick);

                        
                    }
                    else
                    {
                        canvas1.Children.Clear();
                        System.Threading.Thread.Sleep(16);
                    }

                }
                catch (Exception _e)
                {
                    A_Handler.Log.ExceptionLogEntry newEntry = new A_Handler.Log.ExceptionLogEntry(_e, DateTime.Now,
                        A_Enums.ExceptionThread.Overlay);

                    lock (A_Handler.Log.Exception.ExceptionLog) A_Handler.Log.Exception.ExceptionLog.Add(newEntry);
                }
            }
        }