예제 #1
0
        private static void OnRenderer(int fps, EventArgs args)
        {
            if (!gameProcessExists)
            {
                return;                     //process is dead, don't bother drawing
            }
            if ((!isGameOnTop) && (!isOverlayOnTop))
            {
                return;                                      //if game and overlay are not on top, don't draw
            }
            if (!Components.MainAssemblyToggle.Enabled)
            {
                return;                                         //main menu boolean to toggle the cheat on or off
            }
            if (oRenderer != IntPtr.Zero)
            {
                var rendBase = Memory.ReadPointer(processHandle, oRenderer, isWow64Process);
                if (rendBase != IntPtr.Zero)
                {
                    var matStruct   = SDKUtil.ReadStructure <RendererStruct>(processHandle, rendBase);
                    var finalMatrix = matStruct.oView * matStruct.oProjection;
                    var localPlayer = Memory.ReadPointer(processHandle, oLocalPlayer, isWow64Process);
                    if (localPlayer != IntPtr.Zero)
                    {
                        gameTime = Memory.ReadFloat(processHandle, oGameTime);
                        var lPdata      = SDKUtil.ReadStructureEx <GameObjectStruct>(processHandle, localPlayer, isWow64Process);
                        var heroManager = Memory.ReadPointer(processHandle, oHeroManager, isWow64Process);
                        if (heroManager != IntPtr.Zero)
                        {
                            for (uint i = 0; i <= 12; i++)
                            {
                                var heroPtr = Memory.ReadPointer(processHandle, (IntPtr)(heroManager.ToInt64() + i * 4), isWow64Process);
                                if (heroPtr != IntPtr.Zero)
                                {
                                    var heroData = SDKUtil.ReadStructureEx <GameObjectStruct>(processHandle, heroPtr, isWow64Process);

                                    if ((heroData.oObjVisibility == 1) /* && (heroData.oObjTeam == 100 || heroData.oObjTeam == 200)*/ && (heroData.oObjHealth > 0.1) && (heroData.oObjHealth < 10000) && (heroData.oObjMaxHealth > 99) && (heroData.oObjArmor > 0) && (heroData.oObjArmor < 1000) && (heroData.oObjPos.Y != 0.0f) && (heroData.oObjPos.X != 0.0f) && (heroData.oObjPos.Z != 0.0f)) //ghetto validity check
                                    {
                                        var QData = heroData.GetSpellData(spellSlot._Q);
                                        var WData = heroData.GetSpellData(spellSlot._W);
                                        var EData = heroData.GetSpellData(spellSlot._E);
                                        var RData = heroData.GetSpellData(spellSlot._R);
                                        var DData = heroData.GetSpellData(spellSlot.SUMMONER_1);
                                        var FData = heroData.GetSpellData(spellSlot.SUMMONER_2);

                                        Console.WriteLine("Check #1");

                                        Vector2 pos2D;
                                        if (Renderer.WorldToScreen(heroData.oObjPos, out pos2D, finalMatrix, wndMargins, wndSize, W2SType.TypeOGL))
                                        {
                                            Console.WriteLine("Check #2");
                                            if (Components.VisualsComponent.DrawSpellTracker.Enabled)
                                            {
                                                Console.WriteLine("Check #3");
                                                Renderer.DrawFilledRect(pos2D.X - XposX - 5 - 1, pos2D.Y + YposY + 3 + 12 - 1, 118 + 2, 12 + 2, new Color(00, 00, 00, 0x7A)); //whole bar
                                                Renderer.DrawFilledRect(pos2D.X - XposX + 3 + 27 * 0, pos2D.Y + YposY + 3 + 16, 23, 4, new Color(00, 00, 00, 0xAA));          //spell bars

                                                Renderer.DrawFilledRect(pos2D.X - XposX + 3 + 27 * 1, pos2D.Y + YposY + 3 + 16, 23, 4, new Color(00, 00, 00, 0xAA));
                                                Renderer.DrawFilledRect(pos2D.X - XposX + 3 + 27 * 2, pos2D.Y + YposY + 3 + 16, 23, 4, new Color(00, 00, 00, 0xAA));
                                                Renderer.DrawFilledRect(pos2D.X - XposX + 3 + 27 * 3, pos2D.Y + YposY + 3 + 16, 23, 4, new Color(00, 00, 00, 0xAA));

                                                Renderer.DrawFilledRect(pos2D.X - XposX - 5 + 121 - 1, pos2D.Y + YposY + 3 + 12 - 1, 60 + 2, 12 + 2, new Color(00, 00, 0x5A, 0x7A)); //whole bar

                                                Renderer.DrawFilledRect(pos2D.X - XposX + 121, pos2D.Y + YposY + 3 + 16, 23, 4, new Color(00, 00, 00, 0xAA));                        //spell bars D
                                                Renderer.DrawFilledRect(pos2D.X - XposX + 121 + 4 + 23, pos2D.Y + YposY + 3 + 16, 23, 4, new Color(00, 00, 00, 0xAA));               //spell bars F

                                                if (QData.level > 0)
                                                {
                                                    for (uint j = 1; j <= QData.level; j++)
                                                    {
                                                        Renderer.DrawRect(pos2D.X - XposX + 27 * (uint)spellSlot._Q + j * 5 - 1, pos2D.Y + YposY + 3 + 21, 1, 2, new Color(0xFF, 0xFF, 00, 0xFF));
                                                    }
                                                    if (QData.ammoCurrentCd > 0)
                                                    {
                                                        if (QData.ammo > 0)
                                                        {
                                                            Renderer.DrawFilledRect(pos2D.X - XposX + 3 + 27 * (uint)spellSlot._Q, pos2D.Y + YposY + 3 + 16, 23 - ((QData.ammoCurrentCd / QData.ammoCd) * 23), 4, new Color(0xFF, 0x7F, 00, 0xFF));
                                                        }
                                                        else
                                                        {
                                                            Renderer.DrawFilledRect(pos2D.X - XposX + 3 + 27 * (uint)spellSlot._Q, pos2D.Y + YposY + 3 + 16, 23 - ((QData.ammoCurrentCd / QData.ammoCd) * 23), 4, new Color(0xFF, 00, 00, 0xFF));
                                                        }
                                                    }
                                                    else
                                                    {
                                                        if (QData.currentCd > 0)
                                                        {
                                                            Renderer.DrawFilledRect(pos2D.X - XposX + 3 + 27 * (uint)spellSlot._Q, pos2D.Y + YposY + 3 + 16, 23 - ((QData.currentCd / QData.spellCd) * 23), 4, new Color(0xFF, 00, 00, 0xFF));
                                                        }
                                                        else
                                                        {
                                                            Renderer.DrawFilledRect(pos2D.X - XposX + 3 + 27 * (uint)spellSlot._Q, pos2D.Y + YposY + 3 + 16, 23, 4, new Color(00, 0xFF, 00, 0xFF));
                                                        }
                                                    }
                                                }



                                                if (WData.level > 0)
                                                {
                                                    for (uint j = 1; j <= WData.level; j++)
                                                    {
                                                        Renderer.DrawRect(pos2D.X - XposX + 27 * (uint)spellSlot._W + j * 5 - 1, pos2D.Y + YposY + 3 + 21, 1, 2, new Color(0xFF, 0xFF, 00, 0xFF));
                                                    }
                                                    if (WData.ammoCurrentCd > 0)
                                                    {
                                                        if (WData.ammo > 0)
                                                        {
                                                            Renderer.DrawFilledRect(pos2D.X - XposX + 3 + 27 * (uint)spellSlot._W, pos2D.Y + YposY + 3 + 16, 23 - ((WData.ammoCurrentCd / WData.ammoCd) * 23), 4, new Color(0xFF, 0x7F, 00, 0xFF));
                                                        }
                                                        else
                                                        {
                                                            Renderer.DrawFilledRect(pos2D.X - XposX + 3 + 27 * (uint)spellSlot._W, pos2D.Y + YposY + 3 + 16, 23 - ((WData.ammoCurrentCd / WData.ammoCd) * 23), 4, new Color(0xFF, 00, 00, 0xFF));
                                                        }
                                                    }
                                                    else
                                                    {
                                                        if (WData.currentCd > 0)
                                                        {
                                                            Renderer.DrawFilledRect(pos2D.X - XposX + 3 + 27 * (uint)spellSlot._W, pos2D.Y + YposY + 3 + 16, 23 - ((WData.currentCd / WData.spellCd) * 23), 4, new Color(0xFF, 00, 00, 0xFF));
                                                        }
                                                        else
                                                        {
                                                            Renderer.DrawFilledRect(pos2D.X - XposX + 3 + 27 * (uint)spellSlot._W, pos2D.Y + YposY + 3 + 16, 23, 4, new Color(00, 0xFF, 00, 0xFF));
                                                        }
                                                    }
                                                }



                                                if (EData.level > 0)
                                                {
                                                    for (uint j = 1; j <= EData.level; j++)
                                                    {
                                                        Renderer.DrawRect(pos2D.X - XposX + 27 * (uint)spellSlot._E + j * 5 - 1, pos2D.Y + YposY + 3 + 21, 1, 2, new Color(0xFF, 0xFF, 00, 0xFF));
                                                    }
                                                    if (EData.ammoCurrentCd > 0)
                                                    {
                                                        if (EData.ammo > 0)
                                                        {
                                                            Renderer.DrawFilledRect(pos2D.X - XposX + 3 + 27 * (uint)spellSlot._E, pos2D.Y + YposY + 3 + 16, 23 - ((EData.ammoCurrentCd / EData.ammoCd) * 23), 4, new Color(0xFF, 0x7F, 00, 0xFF));
                                                        }
                                                        else
                                                        {
                                                            Renderer.DrawFilledRect(pos2D.X - XposX + 3 + 27 * (uint)spellSlot._E, pos2D.Y + YposY + 3 + 16, 23 - ((EData.ammoCurrentCd / EData.ammoCd) * 23), 4, new Color(0xFF, 00, 00, 0xFF));
                                                        }
                                                    }
                                                    else
                                                    {
                                                        if (EData.currentCd > 0)
                                                        {
                                                            Renderer.DrawFilledRect(pos2D.X - XposX + 3 + 27 * (uint)spellSlot._E, pos2D.Y + YposY + 3 + 16, 23 - ((EData.currentCd / EData.spellCd) * 23), 4, new Color(0xFF, 00, 00, 0xFF));
                                                        }
                                                        else
                                                        {
                                                            Renderer.DrawFilledRect(pos2D.X - XposX + 3 + 27 * (uint)spellSlot._E, pos2D.Y + YposY + 3 + 16, 23, 4, new Color(00, 0xFF, 00, 0xFF));
                                                        }
                                                    }
                                                }


                                                if (RData.level > 0)
                                                {
                                                    for (uint j = 1; j <= RData.level; j++)
                                                    {
                                                        Renderer.DrawRect(pos2D.X - XposX + 27 * (uint)spellSlot._R + j * 5 - 1, pos2D.Y + YposY + 3 + 21, 1, 2, new Color(0xFF, 0xFF, 00, 0xFF));
                                                    }
                                                    if (RData.ammoCurrentCd > 0)
                                                    {
                                                        if (RData.ammo > 0)
                                                        {
                                                            Renderer.DrawFilledRect(pos2D.X - XposX + 3 + 27 * (uint)spellSlot._R, pos2D.Y + YposY + 3 + 16, 23 - ((RData.ammoCurrentCd / RData.ammoCd) * 23), 4, new Color(0xFF, 0x7F, 00, 0xFF));
                                                        }
                                                        else
                                                        {
                                                            Renderer.DrawFilledRect(pos2D.X - XposX + 3 + 27 * (uint)spellSlot._R, pos2D.Y + YposY + 3 + 16, 23 - ((RData.ammoCurrentCd / RData.ammoCd) * 23), 4, new Color(0xFF, 00, 00, 0xFF));
                                                        }
                                                    }
                                                    else
                                                    {
                                                        if (RData.currentCd > 0)
                                                        {
                                                            Renderer.DrawFilledRect(pos2D.X - XposX + 3 + 27 * (uint)spellSlot._R, pos2D.Y + YposY + 3 + 16, 23 - ((RData.currentCd / RData.spellCd) * 23), 4, new Color(0xFF, 00, 00, 0xFF));
                                                        }
                                                        else
                                                        {
                                                            Renderer.DrawFilledRect(pos2D.X - XposX + 3 + 27 * (uint)spellSlot._R, pos2D.Y + YposY + 3 + 16, 23, 4, new Color(00, 0xFF, 00, 0xFF));
                                                        }
                                                    }
                                                }

                                                if (DData.currentCd > 0)
                                                {
                                                    Renderer.DrawFilledRect(pos2D.X - XposX + 121, pos2D.Y + YposY + 3 + 16, 23 - ((DData.currentCd / DData.spellCd) * 23), 4, new Color(0xFF, 00, 00, 0xFF));
                                                }
                                                else
                                                {
                                                    Renderer.DrawFilledRect(pos2D.X - XposX + 121, pos2D.Y + YposY + 3 + 16, 23, 4, new Color(00, 0xFF, 00, 0xFF));
                                                }


                                                if (FData.currentCd > 0)
                                                {
                                                    Renderer.DrawFilledRect(pos2D.X - XposX + 121 + 4 + 23, pos2D.Y + YposY + 3 + 16, 23 - ((FData.currentCd / FData.spellCd) * 23), 4, new Color(0xFF, 00, 00, 0xFF));
                                                }
                                                else
                                                {
                                                    Renderer.DrawFilledRect(pos2D.X - XposX + 121 + 4 + 23, pos2D.Y + YposY + 3 + 16, 23, 4, new Color(00, 0xFF, 00, 0xFF));
                                                }
                                            }

                                            if (heroData.oObjTeam != lPdata.oObjTeam)
                                            {
                                                if (Components.VisualsComponent.DrawInformationAlly.Enabled)
                                                {
                                                    Renderer.DrawText("Vida: " + (int)heroData.oObjHealth + " / " + (int)heroData.oObjMaxHealth, pos2D.X, pos2D.Y - 40, new Color(0xFF, 00, 00, 0xff));
                                                    Renderer.DrawText("Mana: " + (int)heroData.oObjMana + " / " + (int)heroData.oObjMaxMana, pos2D.X, pos2D.Y - 20, new Color(0, 255, 255, 0xff));
                                                }
                                                if (Components.VisualsComponent.DrawRangeCircleEmy.Enabled)
                                                {
                                                    CircleRendering.Render(finalMatrix, Components.VisualsComponent.RangeCircleColorNmy.Color, heroData.oObjAtkRange + 55.0f, heroData.oObjPos);
                                                }
                                            }
                                            if (heroData.oObjTeam == lPdata.oObjTeam)
                                            {
                                                if (Components.VisualsComponent.DrawInformationAlly.Enabled)
                                                {
                                                    Renderer.DrawText("Vida: " + (int)heroData.oObjHealth + " / " + (int)heroData.oObjMaxHealth, pos2D.X, pos2D.Y - 40, new Color(0xFF, 00, 00, 0xff));
                                                    Renderer.DrawText("Mana: " + (int)heroData.oObjMana + " / " + (int)heroData.oObjMaxMana, pos2D.X, pos2D.Y - 20, new Color(0, 255, 255, 0xff));
                                                }
                                                if (Components.VisualsComponent.DrawRangeCircleAlly.Enabled)
                                                {
                                                    CircleRendering.Render(finalMatrix, Components.VisualsComponent.RangeCircleColorAlly.Color, heroData.oObjAtkRange + 55.0f, heroData.oObjPos);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }