Facebook
From Ivory Pheasant, 1 Year ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 764
  1. #include "Menu.h"
  2. #include "Controls.h"
  3. #include "Hooks.h" // for the unload meme
  4. #include "Interfaces.h"
  5.  
  6. #define WINDOW_WIDTH 800
  7. #define WINDOW_HEIGHT 600
  8.  
  9. AimWareWindow Menu::Window;
  10.  
  11. void UnLoadCallbk()
  12. {
  13.     DoUnload = true;
  14. }
  15.  
  16. void KnifeApplyCallbk()
  17. {
  18.     static ConVar* Meme = Interfaces::CVar->FindVar("cl_fullupdate");
  19.     Meme->nFlags &= ~FCVAR_CHEAT;
  20.     Interfaces::Engine->ClientCmd_Unrestricted("cl_fullupdate");
  21. }
  22.  
  23. void AimWareWindow::Setup()
  24. {
  25.     SetPosition(50, 50);
  26.     SetSize(WINDOW_WIDTH, WINDOW_HEIGHT);
  27.     SetTitle(" PatrickHook-BestPrivateCheats);
  28.  
  29.     RegisterTab(&RageBotTab);
  30.     RegisterTab(&LegitBotTab);
  31.     RegisterTab(&VisualsTab);
  32.     RegisterTab(&MiscTab);
  33.  
  34.     RECT Client = GetClientArea();
  35.     Client.bottom -= 29;
  36.  
  37.     RageBotTab.Setup();
  38.     LegitBotTab.Setup();
  39.     VisualsTab.Setup();
  40.     MiscTab.Setup();
  41.  
  42. #pragma region Bottom Buttons
  43.     UnloadButton.SetText("PANIC");
  44.     UnloadButton.SetCallback(UnLoadCallbk);
  45.     UnloadButton.SetPosition(16, Client.bottom - 42);
  46.  
  47.     RageBotTab.RegisterControl(&UnloadButton);
  48.     LegitBotTab.RegisterControl(&UnloadButton);
  49.     VisualsTab.RegisterControl(&UnloadButton);
  50.     MiscTab.RegisterControl(&UnloadButton);
  51.  
  52.     //SaveButton.SetText("Save Settings");
  53.     //SaveButton.SetCallback(Call);
  54.     //SaveButton.SetPosition(112, Client.bottom - 42);
  55.  
  56.     //RageBotTab.RegisterControl(&SaveButton);
  57.     //LegitBotTab.RegisterControl(&SaveButton);
  58.     //VisualsTab.RegisterControl(&SaveButton);
  59.     //MiscTab.RegisterControl(&SaveButton);
  60.  
  61.  
  62. #pragma endregion Setting up the settings buttons
  63. }
  64.  
  65. void CRageBotTab::Setup()
  66. {
  67.     SetTitle("Rage Aimbot");
  68.  
  69.     ActiveLabel.SetPosition(16, 16);
  70.     ActiveLabel.SetText("Active");
  71.     RegisterControl(&ActiveLabel);
  72.  
  73.     Active.SetFileId("active");
  74.     Active.SetPosition(66, 16);
  75.     RegisterControl(&Active);
  76.  
  77. #pragma region Aimbot
  78.  
  79.     AimbotGroup.SetPosition(16, 48);
  80.     AimbotGroup.SetText("Aimbot");
  81.     AimbotGroup.SetSize(376, 280);
  82.     RegisterControl(&AimbotGroup);
  83.  
  84.     AimbotEnable.SetFileId("aim_enable");
  85.     AimbotGroup.PlaceLabledControl("Enable", this, &AimbotEnable);
  86.  
  87.     AimbotAutoFire.SetFileId("aim_autofire");
  88.     AimbotGroup.PlaceLabledControl("Auto Fire", this, &AimbotAutoFire);
  89.  
  90.     AimbotFov.SetFileId("aim_fov");
  91.     AimbotFov.SetBoundaries(0.f, 180.f);
  92.     AimbotFov.SetValue(39.f);
  93.     AimbotGroup.PlaceLabledControl("FOV Range", this, &AimbotFov);
  94.  
  95.     AimbotSilentAim.SetFileId("aim_silent");
  96.     AimbotGroup.PlaceLabledControl("Silent Aim", this, &AimbotSilentAim);
  97.  
  98.     AimbotPSilent.SetFileId("aim_psilent");
  99.     AimbotGroup.PlaceLabledControl("Perfect Silent", this, &AimbotPSilent);
  100.  
  101.     AimbotAutoPistol.SetFileId("aim_autopistol");
  102.     AimbotGroup.PlaceLabledControl("Auto Pistol", this, &AimbotAutoPistol);
  103.  
  104.     AimbotAimStep.SetFileId("aim_aimstep");
  105.     AimbotGroup.PlaceLabledControl("Aim Step", this, &AimbotAimStep);
  106.  
  107.     AimbotKeyPress.SetFileId("aim_usekey");
  108.     AimbotGroup.PlaceLabledControl("On Key Press", this, &AimbotKeyPress);
  109.  
  110.     AimbotKeyBind.SetFileId("aim_key");
  111.     AimbotGroup.PlaceLabledControl("Key", this, &AimbotKeyBind);
  112.  
  113.     AimbotChicken.SetFileId("aim_chicken");
  114.     AimbotGroup.PlaceLabledControl("Chikens", this, &AimbotChicken);
  115.  
  116. #pragma endregion Aimbot Controls Get Setup in here
  117.  
  118. #pragma region Target
  119.     TargetGroup.SetPosition(16, 344);
  120.     TargetGroup.SetText("Target");
  121.     TargetGroup.SetSize(376, 134);
  122.     RegisterControl(&TargetGroup);
  123.  
  124.     TargetSelection.SetFileId("tgt_selection");
  125.     TargetSelection.AddItem("Closest To Crosshair");
  126.     TargetSelection.AddItem("Distance");
  127.     TargetSelection.AddItem("Lowest Health");
  128.     TargetGroup.PlaceLabledControl("Selection", this, &TargetSelection);
  129.  
  130.     TargetFriendlyFire.SetFileId("tgt_friendlyfire");
  131.     TargetGroup.PlaceLabledControl("Friendly Fire", this, &TargetFriendlyFire);
  132.  
  133.     TargetHitbox.SetFileId("tgt_hitbox");
  134.     TargetHitbox.AddItem("Head");
  135.     TargetHitbox.AddItem("Neck");
  136.     TargetHitbox.AddItem("Chest");
  137.     TargetHitbox.AddItem("Stomach");
  138.     TargetGroup.PlaceLabledControl("Hitbox", this, &TargetHitbox);
  139.  
  140.     TargetHitscan.SetFileId("tgt_hitscan");
  141.     TargetHitscan.AddItem("Off"); //0
  142.     TargetHitscan.AddItem("Head / Body"); // 1
  143.     TargetHitscan.AddItem("All Basic"); // 2
  144.     TargetHitscan.AddItem("All Fucking Heaps"); // 3
  145.     TargetGroup.PlaceLabledControl("Hit Scan", this, &TargetHitscan);
  146. #pragma endregion Targetting controls
  147.  
  148. #pragma region Accuracy
  149.     AccuracyGroup.SetPosition(408, 48);
  150.     AccuracyGroup.SetText("Accuracy");
  151.     AccuracyGroup.SetSize(360, 280);
  152.     RegisterControl(&AccuracyGroup);
  153.  
  154.     AccuracySpread.SetFileId("acc_nospread");
  155.     AccuracyGroup.PlaceLabledControl("Anti Spread", this, &AccuracySpread);
  156.  
  157.     AccuracyRecoil.SetFileId("acc_norecoil");
  158.     AccuracyGroup.PlaceLabledControl("Anti Recoil", this, &AccuracyRecoil);
  159.  
  160.     AccuracyAutoWall.SetFileId("acc_awall");
  161.     AccuracyGroup.PlaceLabledControl("Auto Wall", this, &AccuracyAutoWall);
  162.  
  163.     AccuracyMinimumDamage.SetFileId("acc_mindmg");
  164.     AccuracyMinimumDamage.SetBoundaries(1.f, 100.f);
  165.     AccuracyMinimumDamage.SetValue(1.f);
  166.     AccuracyGroup.PlaceLabledControl("Min AWall Damage", this, &AccuracyMinimumDamage);
  167.  
  168.     AccuracyAutoStop.SetFileId("acc_stop");
  169.     AccuracyGroup.PlaceLabledControl("Auto Stop", this, &AccuracyAutoStop);
  170.  
  171.     AccuracyAutoCrouch.SetFileId("acc_crouch");
  172.     AccuracyGroup.PlaceLabledControl("Auto Crouch", this, &AccuracyAutoCrouch);
  173.  
  174.     AccuracyAutoScope.SetFileId("acc_scope");
  175.     AccuracyGroup.PlaceLabledControl("Auto Scope", this, &AccuracyAutoScope);
  176.  
  177.     AccuracySpreadLimit.SetFileId("acc_spreadlimon");
  178.     AccuracyGroup.PlaceLabledControl("Spread Limit", this, &AccuracySpreadLimit);
  179.  
  180.     AccuracyMinimumSpread.SetFileId("acc_spreadlim");
  181.     AccuracyMinimumSpread.SetBoundaries(0.f, 5.0f);
  182.     AccuracyMinimumSpread.SetValue(1.5f);
  183.     AccuracyGroup.PlaceLabledControl("Spread Limit Value", this, &AccuracyMinimumSpread);
  184.  
  185.     AccuracyAngleFix.SetFileId("acc_aaa");
  186.     AccuracyGroup.PlaceLabledControl("AngleFix", this, &AccuracyAngleFix);
  187. #pragma endregion  Accuracy controls get Setup in here
  188.  
  189. #pragma region AntiAim
  190.     AntiAimGroup.SetPosition(408, 344);
  191.     AntiAimGroup.SetText("Anti-Aim");
  192.     AntiAimGroup.SetSize(360, 134);
  193.     RegisterControl(&AntiAimGroup);
  194.  
  195.     AntiAimEnable.SetFileId("aa_enable");
  196.     AntiAimGroup.PlaceLabledControl("Enable", this, &AntiAimEnable);
  197.  
  198.     AntiAimPitch.SetFileId("aa_x");
  199.     AntiAimPitch.AddItem("None");
  200.     AntiAimPitch.AddItem("Up");
  201.     AntiAimPitch.AddItem("Down");
  202.     AntiAimPitch.AddItem("Jitter");
  203.     AntiAimGroup.PlaceLabledControl("X", this, &AntiAimPitch);
  204.  
  205.     AntiAimYaw.SetFileId("aa_y");
  206.     AntiAimYaw.AddItem("None");
  207.     AntiAimYaw.AddItem("Spin Fast");
  208.     AntiAimYaw.AddItem("Spin Slow");
  209.     AntiAimYaw.AddItem("Inverse");
  210.     AntiAimYaw.AddItem("Jitter");
  211.     AntiAimYaw.AddItem("Flip");
  212.     AntiAimGroup.PlaceLabledControl("Y", this, &AntiAimYaw);
  213.  
  214. #pragma endregion  AntiAim controls get setup in here
  215. }
  216.  
  217. void CLegitBotTab::Setup()
  218. {
  219.     SetTitle("Legit Aimbot");
  220.  
  221.     ActiveLabel.SetPosition(16, 16);
  222.     ActiveLabel.SetText("Active");
  223.     RegisterControl(&ActiveLabel);
  224.  
  225.     Active.SetFileId("active");
  226.     Active.SetPosition(66, 16);
  227.     RegisterControl(&Active);
  228.  
  229. #pragma region Aimbot
  230.     AimbotGroup.SetPosition(16, 48);
  231.     AimbotGroup.SetText("Aimbot");
  232.     AimbotGroup.SetSize(240, 210);
  233.     RegisterControl(&AimbotGroup);
  234.  
  235.     AimbotEnable.SetFileId("aim_enable");
  236.     AimbotGroup.PlaceLabledControl("Enable", this, &AimbotEnable);
  237.  
  238.     AimbotAutoFire.SetFileId("aim_autofire");
  239.     AimbotGroup.PlaceLabledControl("Auto Fire", this, &AimbotAutoFire);
  240.  
  241.     AimbotFriendlyFire.SetFileId("aim_friendfire");
  242.     AimbotGroup.PlaceLabledControl("Friendly Fire", this, &AimbotFriendlyFire);
  243.  
  244.     AimbotKeyPress.SetFileId("aim_usekey");
  245.     AimbotGroup.PlaceLabledControl("On Key Press", this, &AimbotKeyPress);
  246.  
  247.     AimbotKeyBind.SetFileId("aim_key");
  248.     AimbotGroup.PlaceLabledControl("Key Bind", this, &AimbotKeyBind);
  249.  
  250.     AimbotAutoPistol.SetFileId("aim_apistol");
  251.     AimbotGroup.PlaceLabledControl("Auto Pistol", this, &AimbotAutoPistol);
  252.  
  253. #pragma endregion Aimbot shit
  254.  
  255. #pragma region Triggerbot
  256.     TriggerGroup.SetPosition(272, 48);
  257.     TriggerGroup.SetText("Triggerbot");
  258.     TriggerGroup.SetSize(240, 210);
  259.     RegisterControl(&TriggerGroup);
  260.  
  261.     TriggerEnable.SetFileId("trig_enable");
  262.     TriggerGroup.PlaceLabledControl("Enable", this, &TriggerEnable);
  263.  
  264.     TriggerKeyPress.SetFileId("trig_onkey");
  265.     TriggerGroup.PlaceLabledControl("On Key Press", this, &TriggerKeyPress);
  266.  
  267.     TriggerKeyBind.SetFileId("trig_key");
  268.     TriggerGroup.PlaceLabledControl("Key Bind", this, &TriggerKeyBind);
  269.  
  270.     TriggerDelay.SetFileId("trig_delay");
  271.     TriggerDelay.SetBoundaries(1, 1000);
  272.     TriggerDelay.SetValue(50);
  273.     TriggerGroup.PlaceLabledControl("Delay", this, &TriggerDelay);
  274. #pragma endregion Triggerbot stuff
  275.  
  276. #pragma region Main Weapon
  277.     WeaponMainGroup.SetPosition(16, 274);
  278.     WeaponMainGroup.SetText("Rifles/Other");
  279.     WeaponMainGroup.SetSize(240, 210);
  280.     RegisterControl(&WeaponMainGroup);
  281.  
  282.     WeaponMainSpeed.SetFileId("main_speed");
  283.     WeaponMainSpeed.SetBoundaries(0.1f, 2.f);
  284.     WeaponMainSpeed.SetValue(1.0f);
  285.     WeaponMainGroup.PlaceLabledControl("Max Speed", this, &WeaponMainSpeed);
  286.  
  287.     WeaponMainFoV.SetFileId("main_fov");
  288.     WeaponMainFoV.SetBoundaries(0.1f, 30.f);
  289.     WeaponMainFoV.SetValue(5.f);
  290.     WeaponMainGroup.PlaceLabledControl("FOV", this, &WeaponMainFoV);
  291.  
  292.     WeaponMainRecoil.SetFileId("main_recoil");
  293.     WeaponMainGroup.PlaceLabledControl("Recoil", this, &WeaponMainRecoil);
  294.  
  295.     WeaponMainHitbox.SetFileId("main_hitbox");
  296.     WeaponMainHitbox.AddItem("Head");
  297.     WeaponMainHitbox.AddItem("Neck");
  298.     WeaponMainHitbox.AddItem("Chest");
  299.     WeaponMainHitbox.AddItem("Stomach");
  300.     WeaponMainGroup.PlaceLabledControl("Hitbox", this, &WeaponMainHitbox);
  301. #pragma endregion
  302.  
  303. #pragma region Pistols
  304.     WeaponPistGroup.SetPosition(272, 274);
  305.     WeaponPistGroup.SetText("Pistols");
  306.     WeaponPistGroup.SetSize(240, 210);
  307.     RegisterControl(&WeaponPistGroup);
  308.  
  309.     WeaponPistSpeed.SetFileId("pist_speed");
  310.     WeaponPistSpeed.SetBoundaries(0.1f, 2.f);
  311.     WeaponPistSpeed.SetValue(1.0f);
  312.     WeaponPistGroup.PlaceLabledControl("Max Speed", this, &WeaponPistSpeed);
  313.  
  314.     WeaponPistFoV.SetFileId("pist_fov");
  315.     WeaponPistFoV.SetBoundaries(0.1f, 30.f);
  316.     WeaponPistFoV.SetValue(5.f);
  317.     WeaponPistGroup.PlaceLabledControl("FOV", this, &WeaponPistFoV);
  318.  
  319.     WeaponPistRecoil.SetFileId("pist_recoil");
  320.     WeaponPistGroup.PlaceLabledControl("Recoil", this, &WeaponPistRecoil);
  321.  
  322.     WeaponPistHitbox.SetFileId("pist_hitbox");
  323.     WeaponPistHitbox.AddItem("Head");
  324.     WeaponPistHitbox.AddItem("Neck");
  325.     WeaponPistHitbox.AddItem("Chest");
  326.     WeaponPistHitbox.AddItem("Stomach");
  327.     WeaponPistGroup.PlaceLabledControl("Hitbox", this, &WeaponPistHitbox);
  328. #pragma endregion
  329.  
  330. #pragma region Snipers
  331.     WeaponSnipGroup.SetPosition(528, 274);
  332.     WeaponSnipGroup.SetText("Snipers");
  333.     WeaponSnipGroup.SetSize(240, 210);
  334.     RegisterControl(&WeaponSnipGroup);
  335.  
  336.     WeaponSnipSpeed.SetFileId("snip_speed");
  337.     WeaponSnipSpeed.SetBoundaries(0.1f, 2.f);
  338.     WeaponSnipSpeed.SetValue(1.0f);
  339.     WeaponSnipGroup.PlaceLabledControl("Max Speed", this, &WeaponSnipSpeed);
  340.  
  341.     WeaponSnipFoV.SetFileId("snip_fov");
  342.     WeaponSnipFoV.SetBoundaries(0.1f, 30.f);
  343.     WeaponSnipFoV.SetValue(5.f);
  344.     WeaponSnipGroup.PlaceLabledControl("FOV", this, &WeaponSnipFoV);
  345.  
  346.     WeaponSnipRecoil.SetFileId("snip_recoil");
  347.     WeaponSnipGroup.PlaceLabledControl("Recoil", this, &WeaponSnipRecoil);
  348.  
  349.     WeaponSnipHitbox.SetFileId("snip_hitbox");
  350.     WeaponSnipHitbox.AddItem("Head");
  351.     WeaponSnipHitbox.AddItem("Neck");
  352.     WeaponSnipHitbox.AddItem("Chest");
  353.     WeaponSnipHitbox.AddItem("Stomach");
  354.     WeaponSnipGroup.PlaceLabledControl("Hitbox", this, &WeaponSnipHitbox);
  355. #pragma endregion
  356. }
  357.  
  358. void CVisualTab::Setup()
  359. {
  360.     SetTitle("Visuals & Misc");
  361.  
  362.     ActiveLabel.SetPosition(16, 16);
  363.     ActiveLabel.SetText("Active");
  364.     RegisterControl(&ActiveLabel);
  365.  
  366.     Active.SetFileId("active");
  367.     Active.SetPosition(66, 16);
  368.     RegisterControl(&Active);
  369.  
  370. #pragma region Options
  371.     OptionsGroup.SetText("Options");
  372.     OptionsGroup.SetPosition(16, 48);
  373.     OptionsGroup.SetSize(193, 430);
  374.     RegisterControl(&OptionsGroup);
  375.  
  376.     OptionsBox.SetFileId("opt_box");
  377.     OptionsGroup.PlaceLabledControl("Box", this, &OptionsBox);
  378.  
  379.     OptionsName.SetFileId("opt_name");
  380.     OptionsGroup.PlaceLabledControl("Name", this, &OptionsName);
  381.  
  382.     OptionsHealth.SetFileId("opt_hp");
  383.     OptionsGroup.PlaceLabledControl("Health", this, &OptionsHealth);
  384.  
  385.     OptionsWeapon.SetFileId("opt_weapon");
  386.     OptionsGroup.PlaceLabledControl("Weapon", this, &OptionsWeapon);
  387.  
  388.     OptionsInfo.SetFileId("opt_info");
  389.     OptionsGroup.PlaceLabledControl("Info", this, &OptionsInfo);
  390.  
  391.     OptionsChams.SetFileId("opt_chams");
  392.     OptionsChams.AddItem("Off");
  393.     OptionsChams.AddItem("Normal");
  394.     OptionsChams.AddItem("Flat");
  395.     OptionsGroup.PlaceLabledControl("Chams", this, &OptionsChams);
  396.  
  397.     OptionsSkeleton.SetFileId("opt_bone");
  398.     OptionsGroup.PlaceLabledControl("Skeleton", this, &OptionsSkeleton);
  399.  
  400.     OptionsAimSpot.SetFileId("opt_aimspot");
  401.     OptionsGroup.PlaceLabledControl("Aim Spot", this, &OptionsAimSpot);
  402.  
  403.     OptionsCompRank.SetFileId("opt_comprank");
  404.     OptionsGroup.PlaceLabledControl("Competitive Rank", this, &OptionsCompRank);
  405.  
  406. #pragma endregion Setting up the Options controls
  407.  
  408. #pragma region Filters
  409.     FiltersGroup.SetText("Filters");
  410.     FiltersGroup.SetPosition(225, 48);
  411.     FiltersGroup.SetSize(193, 430);
  412.     RegisterControl(&FiltersGroup);
  413.  
  414.     FiltersAll.SetFileId("ftr_all");
  415.     FiltersGroup.PlaceLabledControl("All", this, &FiltersAll);
  416.  
  417.     FiltersPlayers.SetFileId("ftr_players");
  418.     FiltersGroup.PlaceLabledControl("Players", this, &FiltersPlayers);
  419.  
  420.     FiltersEnemiesOnly.SetFileId("ftr_enemyonly");
  421.     FiltersGroup.PlaceLabledControl("Enemies Only", this, &FiltersEnemiesOnly);
  422.  
  423.     FiltersWeapons.SetFileId("ftr_weaps");
  424.     FiltersGroup.PlaceLabledControl("Weapons", this, &FiltersWeapons);
  425.  
  426.     FiltersChickens.SetFileId("ftr_chickens");
  427.     FiltersGroup.PlaceLabledControl("Chickens", this, &FiltersChickens);
  428.  
  429.     FiltersC4.SetFileId("ftr_c4");
  430.     FiltersGroup.PlaceLabledControl("C4", this, &FiltersC4);
  431. #pragma endregion Setting up the Filters controls
  432.  
  433. #pragma region Other
  434.     OtherGroup.SetText("Other");
  435.     OtherGroup.SetPosition(434, 48);
  436.     OtherGroup.SetSize(334, 430);
  437.     RegisterControl(&OtherGroup);
  438.  
  439.     OtherCrosshair.SetFileId("otr_xhair");
  440.     OtherGroup.PlaceLabledControl("Crosshair", this, &OtherCrosshair);
  441.  
  442.     OtherRecoilCrosshair.SetFileId("otr_recoilhair");
  443.     OtherRecoilCrosshair.AddItem("Off");
  444.     OtherRecoilCrosshair.AddItem("Recoil Position");
  445.     OtherRecoilCrosshair.AddItem("Radius");
  446.     OtherGroup.PlaceLabledControl("Recoil Crosshair", this, &OtherRecoilCrosshair);
  447.  
  448.     OtherRadar.SetFileId("otr_radar");
  449.     OtherGroup.PlaceLabledControl("Radar", this, &OtherRadar);
  450.  
  451.     OtherNoVisualRecoil.SetFileId("otr_visrecoil");
  452.     OtherGroup.PlaceLabledControl("No Visual Recoil", this, &OtherNoVisualRecoil);
  453.  
  454.     OtherNoSky.SetFileId("otr_nosky");
  455.     OtherGroup.PlaceLabledControl("No Sky", this, &OtherNoSky);
  456.  
  457.     OtherNoFlash.SetFileId("otr_noflash");
  458.     OtherGroup.PlaceLabledControl("No Flash", this, &OtherNoFlash);
  459.  
  460.     OtherNoSmoke.SetFileId("otr_nosmoke");
  461.     OtherGroup.PlaceLabledControl("No Smoke", this, &OtherNoSmoke);
  462.  
  463.     OtherNoHands.SetFileId("otr_hands");
  464.     OtherNoHands.AddItem("Off");
  465.     OtherNoHands.AddItem("None");
  466.     OtherNoHands.AddItem("Transparent");
  467.     OtherNoHands.AddItem("Chams");
  468.     OtherNoHands.AddItem("Rainbow");
  469.     OtherGroup.PlaceLabledControl("Hands", this, &OtherNoHands);
  470.  
  471.     OtherAutoJump.SetFileId("otr_autojump");
  472.     OtherGroup.PlaceLabledControl("Auto Jump", this, &OtherAutoJump);
  473.  
  474.     OtherAutoStrafe.SetFileId("otr_autostrafe");
  475.     OtherGroup.PlaceLabledControl("Auto Strafe", this, &OtherAutoStrafe);
  476.  
  477.     OtherSafeMode.SetFileId("otr_safemode");
  478.     OtherSafeMode.SetState(true);
  479.     OtherGroup.PlaceLabledControl("Safe Mode", this, &OtherSafeMode);
  480.  
  481.     OtherChatSpam.SetFileId("otr_spam");
  482.     OtherChatSpam.AddItem("Off");
  483.     OtherChatSpam.AddItem("Round-Say");
  484.     OtherChatSpam.AddItem("Regular");
  485.     OtherChatSpam.AddItem("Report Text Spam");
  486.     OtherGroup.PlaceLabledControl("Chat Spam", this, &OtherChatSpam);
  487.  
  488.     OtherAirStuck.SetFileId("otr_astuck");
  489.     OtherGroup.PlaceLabledControl("Air Stuck", this, &OtherAirStuck);
  490.  
  491.     OtherSpectators.SetFileId("otr_speclist");
  492.     OtherGroup.PlaceLabledControl("Spectators List", this, &OtherSpectators);
  493. #pragma endregion Setting up the Other controls
  494. }
  495.  
  496. void CMiscTab::Setup()
  497. {
  498.     SetTitle("Skins");
  499.  
  500. #pragma region Knife
  501.     KnifeGroup.SetPosition(16, 16);
  502.     KnifeGroup.SetSize(360, 400);
  503.     KnifeGroup.SetText("Skin Changer");
  504.     RegisterControl(&KnifeGroup);
  505.  
  506.     KnifeEnable.SetFileId("knife_enable");
  507.     KnifeGroup.PlaceLabledControl("Enable", this, &KnifeEnable);
  508.  
  509.     KnifeModel.SetFileId("knife_model");
  510.     KnifeModel.AddItem("Karambit");
  511.     KnifeModel.AddItem("Bayonet");
  512.     KnifeModel.AddItem("Huntsman Knife");
  513.     KnifeModel.AddItem("Gut Knife");
  514.     KnifeModel.AddItem("Walmart Knife");
  515.     KnifeModel.AddItem("Shadow Daggers");
  516.     KnifeModel.AddItem("Butterfly Knife");
  517.     KnifeModel.AddItem("Flip Knife");
  518.     KnifeGroup.PlaceLabledControl("Knife", this, &KnifeModel);
  519.  
  520.     KnifeSkin.SetFileId("knife_skin");
  521.     KnifeSkin.AddItem("Fade");
  522.     KnifeSkin.AddItem("Damascus Steel");
  523.     KnifeSkin.AddItem("Doppler Phase 1");
  524.     KnifeSkin.AddItem("Doppler Phase 2");
  525.     KnifeSkin.AddItem("Doppler Phase 3");
  526.     KnifeSkin.AddItem("Doppler Phase 4");
  527.     KnifeSkin.AddItem("Doppler (Ruby)");
  528.     KnifeSkin.AddItem("Doppler (Sapphire)");
  529.     KnifeSkin.AddItem("Doppler (Blackpearl)");
  530.     KnifeSkin.AddItem("Marble Fade");
  531.     KnifeSkin.AddItem("Tiger Tooth");
  532.     KnifeSkin.AddItem("Ultraviolet");
  533.     KnifeSkin.AddItem("Crimson Web");
  534.     KnifeSkin.AddItem("Slaughter");
  535.     KnifeSkin.AddItem("Night");
  536.     KnifeGroup.PlaceLabledControl("Skin", this, &KnifeSkin);
  537.  
  538.     M41SSkin.SetFileId("m4a1s_skin");
  539.     M41SSkin.AddItem("Masterpiece");
  540.     M41SSkin.AddItem("Hyper Beast");
  541.     M41SSkin.AddItem("Cyrex");
  542.     M41SSkin.AddItem("Hot Rod");
  543.     KnifeGroup.PlaceLabledControl("M4A1-S", this, &M41SSkin);
  544.  
  545.     M4A4Skin.SetFileId("m4a4_skin");
  546.     M4A4Skin.AddItem("Royal Paladin");
  547.     M4A4Skin.AddItem("Howl");
  548.     M4A4Skin.AddItem("Bullet Rain");
  549.     M4A4Skin.AddItem("Dragon King");
  550.     M4A4Skin.AddItem("Asiimov");
  551.     KnifeGroup.PlaceLabledControl("M4A4", this, &M4A4Skin);
  552.  
  553.     AK47Skin.SetFileId("ak47_skin");
  554.     AK47Skin.AddItem("Point Disarray");
  555.     AK47Skin.AddItem("Aquamarine Revenge");
  556.     AK47Skin.AddItem("Vulcan");
  557.     AK47Skin.AddItem("Fire Serpent");
  558.     AK47Skin.AddItem("Jaguar");
  559.     KnifeGroup.PlaceLabledControl("AK-47", this, &AK47Skin);
  560.  
  561.     AWPSkin.SetFileId("awp_skin");
  562.     AWPSkin.AddItem("Hyper Beast");
  563.     AWPSkin.AddItem("Asiimov");
  564.     AWPSkin.AddItem("Dragon Lore");
  565.     AWPSkin.AddItem("Lightning Strike");
  566.     KnifeGroup.PlaceLabledControl("AWP", this, &AWPSkin);
  567.  
  568.     GLOCKSkin.SetFileId("glock_skin");
  569.     GLOCKSkin.AddItem("Water Elemental");
  570.     GLOCKSkin.AddItem("Fade");
  571.     GLOCKSkin.AddItem("Twilight Galaxy");
  572.     GLOCKSkin.AddItem("Bunsen Burner");
  573.     KnifeGroup.PlaceLabledControl("Glock", this, &GLOCKSkin);
  574.  
  575.     USPSSkin.SetFileId("m4a1s_skin");
  576.     USPSSkin.AddItem("Kill Confirmed");
  577.     USPSSkin.AddItem("Caiman");
  578.     USPSSkin.AddItem("Orion");
  579.     USPSSkin.AddItem("Guardian");
  580.     KnifeGroup.PlaceLabledControl("USP-S", this, &USPSSkin);
  581.  
  582.     MAGNUMSkin.SetFileId("357_skin");
  583.     MAGNUMSkin.AddItem("Crimson Web");
  584.     MAGNUMSkin.AddItem("Fade");
  585.     MAGNUMSkin.AddItem("Amber Fade");
  586.     KnifeGroup.PlaceLabledControl("R8 Revolver", this, &MAGNUMSkin);
  587.  
  588.     KnifeApply.SetText("Apply Changes");
  589.     KnifeApply.SetCallback(KnifeApplyCallbk);
  590.     KnifeGroup.PlaceLabledControl("", this, &KnifeApply);
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597. #pragma endregion
  598.  
  599. #pragma endregion other random options
  600. }
  601.  
  602. void Menu::SetupMenu()
  603. {
  604.     Window.Setup();
  605.  
  606.     GUI.RegisterWindow(&Window);
  607.     GUI.BindWindow(VK_INSERT, &Window);
  608. }
  609.  
  610. void Menu::DoUIFrame()
  611. {
  612.     // General Processing
  613.  
  614.     // If the "all filter is selected tick all the others
  615.     if (Window.VisualsTab.FiltersAll.GetState())
  616.     {
  617.         Window.VisualsTab.FiltersC4.SetState(true);
  618.         Window.VisualsTab.FiltersChickens.SetState(true);
  619.         Window.VisualsTab.FiltersPlayers.SetState(true);
  620.         Window.VisualsTab.FiltersWeapons.SetState(true);
  621.     }
  622.  
  623.     GUI.Update();
  624.     GUI.Draw();
  625.  
  626.  
  627. }
  628.  
  629.  
  630. #include "GUI.h"
  631.  
  632. #include "RenderManager.h"
  633.  
  634. #include <algorithm>
  635. #include "tinyxml2.h"
  636. #include "Controls.h"
  637.  
  638. CGUI GUI;
  639.  
  640. CGUI::CGUI()
  641. {
  642.  
  643. }
  644.  
  645. // Draws all windows
  646. void CGUI::Draw()
  647. {
  648.     bool ShouldDrawCursor = false;
  649.  
  650.     for (auto window : Windows)
  651.     {
  652.         if (window->m_bIsOpen)
  653.         {
  654.             ShouldDrawCursor = true;
  655.             DrawWindow(window);
  656.         }
  657.  
  658.     }
  659.  
  660.     if (ShouldDrawCursor)
  661.     {
  662.         static Vertex_t MouseVt[3];
  663.  
  664.         MouseVt[0].Init(Vector2D(Mouse.x, Mouse.y));
  665.         MouseVt[1].Init(Vector2D(Mouse.x + 16, Mouse.y));
  666.         MouseVt[2].Init(Vector2D(Mouse.x, Mouse.y + 16));
  667.  
  668.         Render::PolygonOutline(3, MouseVt, Color(150, 0, 0, 230), Color(0, 0, 0, 150));
  669.     }
  670. }
  671.  
  672. // Handle all input etc
  673. void CGUI::Update()
  674. {
  675.     //Key Array
  676.     std::copy(keys, keys + 255, oldKeys);
  677.     for (int x = 0; x < 255; x++)
  678.     {
  679.         //oldKeys[x] = oldKeys[x] & keys[x];
  680.         keys[x] = (GetAsyncKeyState(x));
  681.     }
  682.  
  683.     // Mouse Location
  684.     POINT mp; GetCursorPos(&mp);
  685.     Mouse.x = mp.x; Mouse.y = mp.y;
  686.  
  687.     RECT Screen = Render::GetViewport();
  688.  
  689.     // Window Binds
  690.     for (auto & bind : WindowBinds)
  691.     {
  692.         if (GetKeyPress(bind.first))
  693.         {
  694.             bind.second->Toggle();
  695.         }
  696.     }
  697.  
  698.     // Stop dragging
  699.     if (IsDraggingWindow && !GetKeyState(VK_LBUTTON))
  700.     {
  701.         IsDraggingWindow = false;
  702.         DraggingWindow = nullptr;
  703.     }
  704.  
  705.     // If we are in the proccess of dragging a window
  706.     if (IsDraggingWindow && GetKeyState(VK_LBUTTON) && !GetKeyPress(VK_LBUTTON))
  707.     {
  708.         if (DraggingWindow)
  709.         {
  710.             DraggingWindow->m_x = Mouse.x - DragOffsetX;
  711.             DraggingWindow->m_y = Mouse.y - DragOffsetY;
  712.         }
  713.     }
  714.  
  715.     // Process some windows
  716.     for (auto window : Windows)
  717.     {
  718.         if (window->m_bIsOpen)
  719.         {
  720.             // Used to tell the widget processing that there could be a click
  721.             bool bCheckWidgetClicks = false;
  722.  
  723.             // If the user clicks inside the window
  724.             if (GetKeyPress(VK_LBUTTON))
  725.             {
  726.                 if (IsMouseInRegion(window->m_x, window->m_y, window->m_x + window->m_iWidth, window->m_y + window->m_iHeight))
  727.                 {
  728.                     // Is it inside the client area?
  729.                     if (IsMouseInRegion(window->GetClientArea()))
  730.                     {
  731.                         // User is selecting a new tab
  732.                         if (IsMouseInRegion(window->GetTabArea()))
  733.                         {
  734.                             // Loose focus on the control
  735.                             window->IsFocusingControl = false;
  736.                             window->FocusedControl = nullptr;
  737.  
  738.                             int iTab = 0;
  739.                             int TabCount = window->Tabs.size();
  740.                             if (TabCount) // If there are some tabs
  741.                             {
  742.                                 int TabSize = (window->m_iWidth - 4 - 12) / TabCount;
  743.                                 int Dist = Mouse.x - (window->m_x + 8);
  744.                                 while (Dist > TabSize)
  745.                                 {
  746.                                     if (Dist > TabSize)
  747.                                     {
  748.                                         iTab++;
  749.                                         Dist -= TabSize;
  750.                                     }
  751.                                 }
  752.                                 window->SelectedTab = window->Tabs[iTab];
  753.                             }
  754.  
  755.                         }
  756.                         else
  757.                             bCheckWidgetClicks = true;
  758.                     }
  759.                     else
  760.                     {
  761.                         // Must be in the around the title or side of the window
  762.                         // So we assume the user is trying to drag the window
  763.                         IsDraggingWindow = true;
  764.                         DraggingWindow = window;
  765.                         DragOffsetX = Mouse.x - window->m_x;
  766.                         DragOffsetY = Mouse.y - window->m_y;
  767.  
  768.                         // Loose focus on the control
  769.                         window->IsFocusingControl = false;
  770.                         window->FocusedControl = nullptr;
  771.                     }
  772.                 }
  773.                 else
  774.                 {
  775.                     // Loose focus on the control
  776.                     window->IsFocusingControl = false;
  777.                     window->FocusedControl = nullptr;
  778.                 }
  779.             }
  780.  
  781.  
  782.             // Controls
  783.             if (window->SelectedTab != nullptr)
  784.             {
  785.                 // Focused widget
  786.                 bool SkipWidget = false;
  787.                 CControl* SkipMe = nullptr;
  788.  
  789.                 // this window is focusing on a widget??
  790.                 if (window->IsFocusingControl)
  791.                 {
  792.                     if (window->FocusedControl != nullptr)
  793.                     {
  794.                         // We've processed it once, skip it later
  795.                         SkipWidget = true;
  796.                         SkipMe = window->FocusedControl;
  797.  
  798.                         POINT cAbs = window->FocusedControl->GetAbsolutePos();
  799.                         RECT controlRect = { cAbs.x, cAbs.y, window->FocusedControl->m_iWidth, window->FocusedControl->m_iHeight };
  800.                         window->FocusedControl->OnUpdate();
  801.  
  802.                         if (window->FocusedControl->Flag(UIFlags::UI_Clickable) && IsMouseInRegion(controlRect) && bCheckWidgetClicks)
  803.                         {
  804.                             window->FocusedControl->OnClick();
  805.  
  806.                             // If it gets clicked we loose focus
  807.                             window->IsFocusingControl = false;
  808.                             window->FocusedControl = nullptr;
  809.                             bCheckWidgetClicks = false;
  810.                         }
  811.                     }
  812.                 }
  813.  
  814.                 // Itterate over the rest of the control
  815.                 for (auto control : window->SelectedTab->Controls)
  816.                 {
  817.                     if (control != nullptr)
  818.                     {
  819.                         if (SkipWidget && SkipMe == control)
  820.                             continue;
  821.  
  822.                         POINT cAbs = control->GetAbsolutePos();
  823.                         RECT controlRect = { cAbs.x, cAbs.y, control->m_iWidth, control->m_iHeight };
  824.                         control->OnUpdate();
  825.  
  826.                         if (control->Flag(UIFlags::UI_Clickable) && IsMouseInRegion(controlRect) && bCheckWidgetClicks)
  827.                         {
  828.                             control->OnClick();
  829.                             bCheckWidgetClicks = false;
  830.  
  831.                             // Change of focus
  832.                             if (control->Flag(UIFlags::UI_Focusable))
  833.                             {
  834.                                 window->IsFocusingControl = true;
  835.                                 window->FocusedControl = control;
  836.                             }
  837.                             else
  838.                             {
  839.                                 window->IsFocusingControl = false;
  840.                                 window->FocusedControl = nullptr;
  841.                             }
  842.  
  843.                         }
  844.                     }
  845.                 }
  846.  
  847.                 // We must have clicked whitespace
  848.                 if (bCheckWidgetClicks)
  849.                 {
  850.                     // Loose focus on the control
  851.                     window->IsFocusingControl = false;
  852.                     window->FocusedControl = nullptr;
  853.                 }
  854.             }
  855.         }
  856.     }
  857. }
  858.  
  859. // Returns
  860. bool CGUI::GetKeyPress(unsigned int key)
  861. {
  862.     if (keys[key] == true && oldKeys[key] == false)
  863.         return true;
  864.     else
  865.         return false;
  866. }
  867.  
  868. bool CGUI::GetKeyState(unsigned int key)
  869. {
  870.     return keys[key];
  871. }
  872.  
  873. bool CGUI::IsMouseInRegion(int x, int y, int x2, int y2)
  874. {
  875.     if (Mouse.x > x && Mouse.y > y && Mouse.x < x2 && Mouse.y < y2)
  876.         return true;
  877.     else
  878.         return false;
  879. }
  880.  
  881. bool CGUI::IsMouseInRegion(RECT region)
  882. {
  883.     return IsMouseInRegion(region.left, region.top, region.left + region.right, region.top + region.bottom);
  884. }
  885.  
  886. POINT CGUI::GetMouse()
  887. {
  888.     return Mouse;
  889. }
  890.  
  891. bool CGUI::DrawWindow(CWindow* window)
  892. {
  893.     // Main Window
  894.     Render::Outline(window->m_x, window->m_y, window->m_iWidth, window->m_iHeight, Color(20, 20, 20, 80));
  895.     Render::GradientV(window->m_x + 2, window->m_y + 2, window->m_iWidth - 4, 26, Color(0, 0, 0, 255), Color(0, 0, 0, 255));
  896.     Render::Clear(window->m_x + 2, window->m_y + 2 + 26, window->m_iWidth - 4, window->m_iHeight - 4 - 26, Color(0, 0, 0, 255));
  897.     Render::Outline(window->m_x + 1, window->m_y + 1, window->m_iWidth - 2, window->m_iHeight - 2, Color(255, 0, 0, 255));
  898.     Render::Text(window->m_x + 8, window->m_y + 8, Color(255, 255, 255, 255), Render::Fonts::MenuBold, window->Title.c_str());
  899.  
  900.     //Inner
  901.     Render::Outline(window->m_x + 7, window->m_y + 1 + 26, window->m_iWidth - 4 - 10, window->m_iHeight - 2 - 6 - 26, Color(255, 0, 0, 255));
  902.     Render::Clear(window->m_x + 8, window->m_y + 1 + 27, window->m_iWidth - 4 - 12, window->m_iHeight - 2 - 8 - 26, Color(255, 255, 255, 255));
  903.  
  904.     //Tab
  905.     Render::GradientV(window->m_x + 8, window->m_y + 1 + 27, window->m_iWidth - 4 - 12, 29, Color(52, 52, 52, 255), Color(6, 6, 6, 255));
  906.     int TabCount = window->Tabs.size();
  907.     if (TabCount) // If there are some tabs
  908.     {
  909.         int TabSize = (window->m_iWidth - 4 - 12) / TabCount;
  910.         for (int i = 0; i < TabCount; i++)
  911.         {
  912.             RECT TabArea = { window->m_x + 8 + (i * TabSize), window->m_y + 1 + 27, TabSize, 29 };
  913.             CTab* tab = window->Tabs[i];
  914.             if (window->SelectedTab == tab)
  915.             {
  916.                 Render::GradientV(window->m_x + 8 + (i * TabSize), window->m_y + 1 + 27, TabSize, 29, Color(52, 52, 52, 255), Color(106, 106, 106, 255));
  917.             }
  918.             else if (IsMouseInRegion(TabArea))
  919.             {
  920.                 Render::GradientV(window->m_x + 8 + (i * TabSize), window->m_y + 1 + 27, TabSize, 29, Color(106, 106, 106, 255), Color(52, 52, 52, 255));
  921.             }
  922.             RECT TextSize = Render::GetTextSize(Render::Fonts::MenuBold, tab->Title.c_str());
  923.             Render::Text(TabArea.left + (TabSize / 2) - (TextSize.right / 2), TabArea.top + 8, Color(255, 255, 255, 255), Render::Fonts::MenuBold, tab->Title.c_str());
  924.             Render::Clear(window->m_x + 8, window->m_y + 1 + 27, window->m_iWidth - 4 - 12, 2, Color(66, 66, 66, 255));
  925.         }
  926.     }
  927.  
  928.  
  929.     // Controls
  930.     if (window->SelectedTab != nullptr)
  931.     {
  932.         // Focused widget
  933.         bool SkipWidget = false;
  934.         CControl* SkipMe = nullptr;
  935.  
  936.         // this window is focusing on a widget??
  937.         if (window->IsFocusingControl)
  938.         {
  939.             if (window->FocusedControl != nullptr)
  940.             {
  941.                 // We need to draw it last, so skip it in the regular loop
  942.                 SkipWidget = true;
  943.                 SkipMe = window->FocusedControl;
  944.             }
  945.         }
  946.  
  947.  
  948.         // Itterate over all the other controls
  949.         for (auto control : window->SelectedTab->Controls)
  950.         {
  951.             if (SkipWidget && SkipMe == control)
  952.                 continue;
  953.  
  954.             if (control != nullptr && control->Flag(UIFlags::UI_Drawable))
  955.             {
  956.                 POINT cAbs = control->GetAbsolutePos();
  957.                 RECT controlRect = { cAbs.x, cAbs.y, control->m_iWidth, control->m_iHeight };
  958.                 bool hover = false;
  959.                 if (IsMouseInRegion(controlRect))
  960.                 {
  961.                     hover = true;
  962.                 }
  963.                 control->Draw(hover);
  964.             }
  965.         }
  966.  
  967.         // Draw the skipped widget last
  968.         if (SkipWidget)
  969.         {
  970.             auto control = window->FocusedControl;
  971.  
  972.             if (control != nullptr && control->Flag(UIFlags::UI_Drawable))
  973.             {
  974.                 POINT cAbs = control->GetAbsolutePos();
  975.                 RECT controlRect = { cAbs.x, cAbs.y, control->m_iWidth, control->m_iHeight };
  976.                 bool hover = false;
  977.                 if (IsMouseInRegion(controlRect))
  978.                 {
  979.                     hover = true;
  980.                 }
  981.                 control->Draw(hover);
  982.             }
  983.         }
  984.  
  985.     }
  986.  
  987.  
  988.     return true;
  989. }
  990.  
  991. void CGUI::RegisterWindow(CWindow* window)
  992. {
  993.     Windows.push_back(window);
  994.  
  995.     // Resorting to put groupboxes at the start
  996.     for (auto tab : window->Tabs)
  997.     {
  998.         for (auto control : tab->Controls)
  999.         {
  1000.             if (control->Flag(UIFlags::UI_RenderFirst))
  1001.             {
  1002.                 CControl* c = control;
  1003.                 tab->Controls.erase(std::remove(tab->Controls.begin(), tab->Controls.end(), control), tab->Controls.end());
  1004.                 tab->Controls.insert(tab->Controls.begin(), control);
  1005.             }
  1006.         }
  1007.     }
  1008. }
  1009.  
  1010. void CGUI::BindWindow(unsigned char Key, CWindow* window)
  1011. {
  1012.     if (window)
  1013.         WindowBinds[Key] = window;
  1014.     else
  1015.         WindowBinds.erase(Key);
  1016. }
  1017.  
  1018. void CGUI::SaveWindowState(CWindow* window, std::string Filename)
  1019. {
  1020.     // Create a whole new document and we'll just save over top of the old one
  1021.     tinyxml2::XMLDocument Doc;
  1022.  
  1023.     // Root Element is called "ayy"
  1024.     tinyxml2::XMLElement* Root = Doc.NewElement("ayy");
  1025.     Doc.LinkEndChild(Root);
  1026.  
  1027.     Utilities::Log("Saving Window %s", window->Title.c_str());
  1028.  
  1029.     // If the window has some tabs..
  1030.     if (Root && window->Tabs.size() > 0)
  1031.     {
  1032.         for (auto Tab : window->Tabs)
  1033.         {
  1034.             // Add a new section for this tab
  1035.             tinyxml2::XMLElement* TabElement = Doc.NewElement(Tab->Title.c_str());
  1036.             Root->LinkEndChild(TabElement);
  1037.  
  1038.             Utilities::Log("Saving Tab %s", Tab->Title.c_str());
  1039.  
  1040.             // Now we itterate the controls this tab contains
  1041.             if (TabElement && Tab->Controls.size() > 0)
  1042.             {
  1043.                 for (auto Control : Tab->Controls)
  1044.                 {
  1045.                     // If the control is ok to be saved
  1046.                     if (Control && Control->Flag(UIFlags::UI_SaveFile) && Control->FileIdentifier.length() > 1 && Control->FileControlType)
  1047.                     {
  1048.                         // Create an element for the control
  1049.                         tinyxml2::XMLElement* ControlElement = Doc.NewElement(Control->FileIdentifier.c_str());
  1050.                         TabElement->LinkEndChild(ControlElement);
  1051.  
  1052.                         Utilities::Log("Saving control %s", Control->FileIdentifier.c_str());
  1053.  
  1054.                         if (!ControlElement)
  1055.                         {
  1056.                             Utilities::Log("Errorino :(");
  1057.                             return;
  1058.                         }
  1059.  
  1060.                         CCheckBox* cbx = nullptr;
  1061.                         CComboBox* cbo = nullptr;
  1062.                         CKeyBind* key = nullptr;
  1063.                         CSlider* sld = nullptr;
  1064.  
  1065.                         // Figure out what kind of control and data this is
  1066.                         switch (Control->FileControlType)
  1067.                         {
  1068.                             case UIControlTypes::UIC_CheckBox:
  1069.                                 cbx = (CCheckBox*)Control;
  1070.                                 ControlElement->SetText(cbx->GetState());
  1071.                                 break;
  1072.                             case UIControlTypes::UIC_ComboBox:
  1073.                                 cbo = (CComboBox*)Control;
  1074.                                 ControlElement->SetText(cbo->GetIndex());
  1075.                                 break;
  1076.                             case UIControlTypes::UIC_KeyBind:
  1077.                                 key = (CKeyBind*)Control;
  1078.                                 ControlElement->SetText(key->GetKey());
  1079.                                 break;
  1080.                             case UIControlTypes::UIC_Slider:
  1081.                                 sld = (CSlider*)Control;
  1082.                                 ControlElement->SetText(sld->GetValue());
  1083.                                 break;
  1084.                         }
  1085.                     }
  1086.                 }
  1087.             }
  1088.         }
  1089.     }
  1090.  
  1091.     //Save the file
  1092.     if (Doc.SaveFile(Filename.c_str()) != tinyxml2::XML_NO_ERROR)
  1093.     {
  1094.         MessageBox(NULL, "Failed To Save Config File!", "AyyWare", MB_OK);
  1095.     }
  1096.  
  1097. }
  1098.  
  1099. void CGUI::LoadWindowState(CWindow* window, std::string Filename)
  1100. {
  1101.     // Lets load our meme
  1102.     tinyxml2::XMLDocument Doc;
  1103.     if (Doc.LoadFile(Filename.c_str()) == tinyxml2::XML_NO_ERROR)
  1104.     {
  1105.         tinyxml2::XMLElement* Root = Doc.RootElement();
  1106.  
  1107.         // The root "ayy" element
  1108.         if (Root)
  1109.         {
  1110.             // If the window has some tabs..
  1111.             if (Root && window->Tabs.size() > 0)
  1112.             {
  1113.                 for (auto Tab : window->Tabs)
  1114.                 {
  1115.                     // We find the corresponding element for this tab
  1116.                     tinyxml2::XMLElement* TabElement = Root->FirstChildElement(Tab->Title.c_str());
  1117.                     if (TabElement)
  1118.                     {
  1119.                         // Now we itterate the controls this tab contains
  1120.                         if (TabElement && Tab->Controls.size() > 0)
  1121.                         {
  1122.                             for (auto Control : Tab->Controls)
  1123.                             {
  1124.                                 // If the control is ok to be saved
  1125.                                 if (Control && Control->Flag(UIFlags::UI_SaveFile) && Control->FileIdentifier.length() > 1 && Control->FileControlType)
  1126.                                 {
  1127.                                     // Get the controls element
  1128.                                     tinyxml2::XMLElement* ControlElement = TabElement->FirstChildElement(Control->FileIdentifier.c_str());
  1129.  
  1130.                                     if (ControlElement)
  1131.                                     {
  1132.                                         Utilities::Log("We tryin to load fam");
  1133.                                         CCheckBox* cbx = nullptr;
  1134.                                         CComboBox* cbo = nullptr;
  1135.                                         CKeyBind* key = nullptr;
  1136.                                         CSlider* sld = nullptr;
  1137.  
  1138.                                         // Figure out what kind of control and data this is
  1139.                                         switch (Control->FileControlType)
  1140.                                         {
  1141.                                             case UIControlTypes::UIC_CheckBox:
  1142.                                                 cbx = (CCheckBox*)Control;
  1143.                                                 cbx->SetState(ControlElement->GetText()[0] == '1' ? true : false);
  1144.                                                 break;
  1145.                                             case UIControlTypes::UIC_ComboBox:
  1146.                                                 cbo = (CComboBox*)Control;
  1147.                                                 cbo->SelectIndex(atoi(ControlElement->GetText()));
  1148.                                                 break;
  1149.                                             case UIControlTypes::UIC_KeyBind:
  1150.                                                 key = (CKeyBind*)Control;
  1151.                                                 key->SetKey(atoi(ControlElement->GetText()));
  1152.                                                 break;
  1153.                                             case UIControlTypes::UIC_Slider:
  1154.                                                 sld = (CSlider*)Control;
  1155.                                                 sld->SetValue(atof(ControlElement->GetText()));
  1156.                                                 break;
  1157.                                         }
  1158.                                     }
  1159.                                 }
  1160.                             }
  1161.                         }
  1162.                     }
  1163.                 }
  1164.             }
  1165.         }
  1166.     }
  1167. }/*
  1168. Syn's AYYWAREFramework 2015
  1169. */
  1170.  
  1171. // Credits to Valve and Shad0w
  1172. #include "Interfaces.h"
  1173. #include "Menu.h"
  1174.  
  1175. // Shad0ws Yaw fix
  1176. // (FIX ME UP LATER)
  1177. void FixY(const CRecvProxyData* pData, void* pStruct, void* pOut)
  1178. {
  1179.     static Vector vLast[65];
  1180.     static bool bShotLastTime[65];
  1181.     static bool bJitterFix[65];
  1182.  
  1183.     float* flPitch = (float*)((DWORD)pOut - 4);
  1184.     float flYaw = pData->m_Value.m_Float;
  1185.     bool bHasAA;
  1186.     bool bSpinbot;
  1187.  
  1188.     if (Menu::Window.RageBotTab.AccuracyAngleFix.GetState())
  1189.     {
  1190.         bHasAA = ((*flPitch == 90.0f) || (*flPitch == 270.0f));
  1191.         bSpinbot = false;
  1192.  
  1193.         if (!bShotLastTime[((IClientEntity*)(pStruct))->GetIndex()]
  1194.             && (fabsf(flYaw - vLast[((IClientEntity*)(pStruct))->GetIndex()].y) > 15.0f) && !bHasAA)
  1195.         {
  1196.             flYaw = vLast[((IClientEntity*)(pStruct))->GetIndex()].y;
  1197.             bShotLastTime[((IClientEntity*)(pStruct))->GetIndex()] = true;
  1198.         }
  1199.         else
  1200.         {
  1201.             if (bShotLastTime[((IClientEntity*)(pStruct))->GetIndex()]
  1202.                 && (fabsf(flYaw - vLast[((IClientEntity*)(pStruct))->GetIndex()].y) > 15.0f))
  1203.             {
  1204.                 bShotLastTime[((IClientEntity*)(pStruct))->GetIndex()] = true;
  1205.                 bSpinbot = true;
  1206.             }
  1207.             else
  1208.             {
  1209.                 bShotLastTime[((IClientEntity*)(pStruct))->GetIndex()] = false;
  1210.             }
  1211.         }
  1212.  
  1213.         vLast[((IClientEntity*)(pStruct))->GetIndex()].y = flYaw;
  1214.  
  1215.  
  1216.         bool bTmp = bJitterFix[((IClientEntity*)(pStruct))->GetIndex()];
  1217.  
  1218.         bJitterFix[((IClientEntity*)(pStruct))->GetIndex()] = (flYaw >= 180.0f && flYaw <= 360.0f);
  1219.  
  1220.         if (bTmp && (flYaw >= 0.0f && flYaw <= 180.0f))
  1221.         {
  1222.             flYaw += 359.0f;
  1223.         }
  1224.  
  1225.     }
  1226.  
  1227.     *(float*)(pOut) = flYaw;
  1228. }
  1229.  
  1230. // Simple fix for some Fake-Downs
  1231. void FixX(const CRecvProxyData* pData, void* pStruct, void* pOut)
  1232. {
  1233.     float* ang = (float*)pOut;
  1234.     *ang = pData->m_Value.m_Float;
  1235.  
  1236.     if (!Menu::Window.RageBotTab.AccuracyAngleFix.GetState()) return;
  1237.  
  1238.     if (pData->m_Value.m_Float > 180.0f)
  1239.         *ang -= 360.0f;
  1240.     else if (pData->m_Value.m_Float < -180.0f)
  1241.         *ang += 360.0f;
  1242. }
  1243.  
  1244.  
  1245. RecvVarProxyFn oRecvnModelIndex;
  1246.  
  1247. void Hooked_RecvProxy_Viewmodel(CRecvProxyData* pData, void* pStruct, void* pOut)
  1248. {
  1249.     // Get the knife view model id's
  1250.     static int default_t = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_default_t.mdl");
  1251.     static int default_ct = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_default_ct.mdl");
  1252.     int iBayonet = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_bayonet.mdl");
  1253.     int iButterfly = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_butterfly.mdl");
  1254.     int iFlip = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_flip.mdl");
  1255.     int iGunGame = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_gg.mdl");
  1256.     int iGut = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_gut.mdl");
  1257.     int iKarambit = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_karam.mdl");
  1258.     int iM9Bayonet = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_m9_bay.mdl");
  1259.     int iHuntsman = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_tactical.mdl");
  1260.  
  1261.     int iFalchion = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_falchion_advanced.mdl");
  1262.     int iDagger = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_push.mdl");
  1263.  
  1264.     // Get local player (just to stop replacing spectators knifes)
  1265.     IClientEntity* pLocal = Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
  1266.     if (Menu::Window.MiscTab.KnifeEnable.GetState() && pLocal)
  1267.     {
  1268.         // If we are alive and holding a default knife(if we already have a knife don't worry about changing)
  1269.         if (pLocal->IsAlive() && (pData->m_Value.m_Int == default_t || pData->m_Value.m_Int == default_ct))
  1270.         {
  1271.             // Set whatever knife we want
  1272.             if (Menu::Window.MiscTab.KnifeModel.GetIndex() == 0)
  1273.                 pData->m_Value.m_Int = iKarambit;
  1274.             else if (Menu::Window.MiscTab.KnifeModel.GetIndex() == 1)
  1275.                 pData->m_Value.m_Int = iBayonet;
  1276.             else if (Menu::Window.MiscTab.KnifeModel.GetIndex() == 2)
  1277.                 pData->m_Value.m_Int = iHuntsman;
  1278.             else if (Menu::Window.MiscTab.KnifeModel.GetIndex() == 3)
  1279.                 pData->m_Value.m_Int = iGut;
  1280.             else if (Menu::Window.MiscTab.KnifeModel.GetIndex() == 4)
  1281.                 pData->m_Value.m_Int = iFalchion;
  1282.             else if (Menu::Window.MiscTab.KnifeModel.GetIndex() == 5)
  1283.                 pData->m_Value.m_Int = iDagger;
  1284.             else if (Menu::Window.MiscTab.KnifeModel.GetIndex() == 6)
  1285.                 pData->m_Value.m_Int = iButterfly;
  1286.             else if (Menu::Window.MiscTab.KnifeModel.GetIndex() == 7)
  1287.                 pData->m_Value.m_Int = iFlip;
  1288.         }
  1289.     }
  1290.  
  1291.     // Carry on the to original proxy
  1292.     oRecvnModelIndex(pData, pStruct, pOut);
  1293. }
  1294.  
  1295. void ApplyAAAHooks()
  1296. {
  1297.     ClientClass* pClass = Interfaces::Client->GetAllClasses();
  1298.     while (pClass)
  1299.     {
  1300.         const char* pszName = pClass->m_pRecvTable->m_pNetTableName;
  1301.         if (!strcmp(pszName, "DT_CSPlayer"))
  1302.         {
  1303.             for (int i = 0; i < pClass->m_pRecvTable->m_nProps; i++)
  1304.             {
  1305.                 RecvProp* pProp = &(pClass->m_pRecvTable->m_pProps[i]);
  1306.                 const char* name = pProp->m_pVarName;
  1307.  
  1308.                 // Pitch Fix
  1309.                 if (!strcmp(name, "m_angEyeAngles[0]"))
  1310.                 {
  1311.                     pProp->m_ProxyFn = FixX;
  1312.                 }
  1313.  
  1314.                 // Yaw Fix
  1315.                 if (!strcmp(name, "m_angEyeAngles[1]"))
  1316.                 {
  1317.                     //Utilities::Log("Yaw Fix Applied");
  1318.                     pProp->m_ProxyFn = FixY;
  1319.                 }
  1320.             }
  1321.         }
  1322.         else if (!strcmp(pszName, "DT_BaseViewModel"))
  1323.         {
  1324.             for (int i = 0; i < pClass->m_pRecvTable->m_nProps; i++)
  1325.             {
  1326.                 RecvProp* pProp = &(pClass->m_pRecvTable->m_pProps[i]);
  1327.                 const char* name = pProp->m_pVarName;
  1328.  
  1329.                 // Knives
  1330.                 if (!strcmp(name, "m_nModelIndex"))
  1331.                 {
  1332.                     oRecvnModelIndex = (RecvVarProxyFn)pProp->m_ProxyFn;
  1333.                     pProp->m_ProxyFn = Hooked_RecvProxy_Viewmodel;
  1334.                 }
  1335.             }
  1336.         }
  1337.         pClass = pClass->m_pNext;
  1338.     }
  1339. }/*
  1340. Syn's AYYWAREFramework 2015
  1341. */
  1342.  
  1343. // Credits to Valve and Shad0w
  1344. #pragma once
  1345.  
  1346. void ApplyAAAHooks();
  1347. #include "AutoWall.h"
  1348.  
  1349. #define    HITGROUP_GENERIC    0
  1350. #define    HITGROUP_HEAD        1
  1351. #define    HITGROUP_CHEST        2
  1352. #define    HITGROUP_STOMACH    3
  1353. #define HITGROUP_LEFTARM    4    
  1354. #define HITGROUP_RIGHTARM    5
  1355. #define HITGROUP_LEFTLEG    6
  1356. #define HITGROUP_RIGHTLEG    7
  1357. #define HITGROUP_GEAR        10
  1358.  
  1359. inline bool CGameTrace::DidHitWorld() const
  1360. {
  1361.         return m_pEnt->GetIndex() == 0;
  1362. }
  1363.  
  1364. inline bool CGameTrace::DidHitNonWorldEntity() const
  1365. {
  1366.         return m_pEnt != NULL && !DidHitWorld();
  1367. }
  1368.  
  1369. bool HandleBulletPenetration(CSWeaponInfo* wpn_data, FireBulletData &data);
  1370.  
  1371. float GetHitgroupDamageMult(int iHitGroup)
  1372. {
  1373.     switch (iHitGroup)
  1374.     {
  1375.         case HITGROUP_GENERIC:
  1376.             return 1.0f;
  1377.  
  1378.         case HITGROUP_HEAD:
  1379.             return 2.0f;
  1380.  
  1381.         case HITGROUP_CHEST:
  1382.             return 1.0f;
  1383.  
  1384.         case HITGROUP_STOMACH:
  1385.             return 1.0f;
  1386.  
  1387.         case HITGROUP_LEFTARM:
  1388.         case HITGROUP_RIGHTARM:
  1389.             return 1.0f;
  1390.  
  1391.         case HITGROUP_LEFTLEG:
  1392.         case HITGROUP_RIGHTLEG:
  1393.             return 1.0f;
  1394.  
  1395.         default:
  1396.             return 1.0f;
  1397.     }
  1398. }
  1399.  
  1400. void ScaleDamage(int hitgroup, IClientEntity* enemy, float weapon_armor_ratio, float &current_damage)
  1401. {
  1402.     current_damage *= GetHitgroupDamageMult(hitgroup);
  1403.  
  1404.     if (enemy->ArmorValue() > 0)
  1405.     {
  1406.         if (hitgroup == HITGROUP_HEAD)
  1407.         {
  1408.             if (enemy->HasHelmet())
  1409.                 current_damage *= (weapon_armor_ratio * .5f);
  1410.         }
  1411.         else
  1412.         {
  1413.             current_damage *= (weapon_armor_ratio * .5f);
  1414.         }
  1415.     }
  1416. }
  1417.  
  1418. bool SimulateFireBullet(IClientEntity* local, CBaseCombatWeapon* weapon, FireBulletData &data)
  1419. {
  1420.     //Utils::ToLog("SimulateFireBullet");
  1421.     data.penetrate_count = 4;
  1422.     data.trace_length = 0.0f;
  1423.     auto* wpn_data = weapon->GetCSWpnData();
  1424.  
  1425.     data.current_damage = (float)wpn_data->m_iDamage;
  1426.  
  1427.     while ((data.penetrate_count > 0) && (data.current_damage >= 1.0f))
  1428.     {
  1429.         data.trace_length_remaining = wpn_data->m_flRange - data.trace_length;
  1430.  
  1431.         Vector end = data.src + data.direction * data.trace_length_remaining;
  1432.  
  1433.         UTIL_TraceLine(data.src, end, 0x4600400B, local, 0, &data.enter_trace);
  1434.         UTIL_ClipTraceToPlayers(data.src, end + data.direction * 40.f, 0x4600400B, &data.filter, &data.enter_trace);
  1435.  
  1436.         if (data.enter_trace.fraction == 1.0f)
  1437.             break;
  1438.  
  1439.         if ((data.enter_trace.hitgroup <= 7)
  1440.             && (data.enter_trace.hitgroup > 0)
  1441.             && (local->GetTeamNum() != data.enter_trace.m_pEnt->GetTeamNum())
  1442.             /*&& (DoesRayTouchHitbox(end, &data))*/)
  1443.         {
  1444.             data.trace_length += data.enter_trace.fraction * data.trace_length_remaining;
  1445.             data.current_damage *= pow(wpn_data->m_flRangeModifier, data.trace_length * 0.002);
  1446.             ScaleDamage(data.enter_trace.hitgroup, data.enter_trace.m_pEnt, wpn_data->m_flArmorRatio, data.current_damage);
  1447.  
  1448.             return true;
  1449.         }
  1450.  
  1451.         if (!HandleBulletPenetration(wpn_data, data))
  1452.             break;
  1453.     }
  1454.  
  1455.     return false;
  1456. }
  1457.  
  1458. bool HandleBulletPenetration(CSWeaponInfo* wpn_data, FireBulletData &data)
  1459. {
  1460.     surfacedata_t* enter_surface_data = Interfaces::PhysProps->GetSurfaceData(data.enter_trace.surface.surfaceProps);
  1461.     int enter_material = enter_surface_data->game.material;
  1462.     float enter_surf_penetration_mod = enter_surface_data->game.flPenetrationModifier;
  1463.  
  1464.  
  1465.     data.trace_length += data.enter_trace.fraction * data.trace_length_remaining;
  1466.     data.current_damage *= pow(wpn_data->m_flRangeModifier, (data.trace_length * 0.002));
  1467.  
  1468.     if ((data.trace_length > 3000.f) || (enter_surf_penetration_mod < 0.1f))
  1469.         data.penetrate_count = 0;
  1470.  
  1471.     if (data.penetrate_count <= 0)
  1472.         return false;
  1473.  
  1474.     Vector dummy;
  1475.     trace_t trace_exit;
  1476.     if (!TraceToExit(dummy, data.enter_trace, data.enter_trace.endpos, data.direction, &trace_exit))
  1477.         return false;
  1478.  
  1479.     surfacedata_t* exit_surface_data = Interfaces::PhysProps->GetSurfaceData(trace_exit.surface.surfaceProps);
  1480.     int exit_material = exit_surface_data->game.material;
  1481.  
  1482.     float exit_surf_penetration_mod = exit_surface_data->game.flPenetrationModifier;
  1483.     float final_damage_modifier = 0.16f;
  1484.     float combined_penetration_modifier = 0.0f;
  1485.  
  1486.     if (((data.enter_trace.contents & CONTENTS_GRATE) != 0) || (enter_material == 89) || (enter_material == 71))
  1487.     {
  1488.         combined_penetration_modifier = 3.0f;
  1489.         final_damage_modifier = 0.05f;
  1490.     }
  1491.     else
  1492.     {
  1493.         combined_penetration_modifier = (enter_surf_penetration_mod + exit_surf_penetration_mod) * 0.5f;
  1494.     }
  1495.  
  1496.     if (enter_material == exit_material)
  1497.     {
  1498.         if (exit_material == 87 || exit_material == 85)
  1499.             combined_penetration_modifier = 3.0f;
  1500.         else if (exit_material == 76)
  1501.             combined_penetration_modifier = 2.0f;
  1502.     }
  1503.  
  1504.     float v34 = fmaxf(0.f, 1.0f / combined_penetration_modifier);
  1505.     float v35 = (data.current_damage * final_damage_modifier) + v34 * 3.0f * fmaxf(0.0f, (3.0f / wpn_data->m_flPenetration) * 1.25f);
  1506.     float thickness = VectorLength(trace_exit.endpos - data.enter_trace.endpos);
  1507.  
  1508.     thickness *= thickness;
  1509.     thickness *= v34;
  1510.     thickness /= 24.0f;
  1511.  
  1512.  
  1513.     float lost_damage = fmaxf(0.0f, v35 + thickness);
  1514.  
  1515.     if (lost_damage > data.current_damage)
  1516.         return false;
  1517.  
  1518.     if (lost_damage >= 0.0f)
  1519.         data.current_damage -= lost_damage;
  1520.  
  1521.     if (data.current_damage < 1.0f)
  1522.         return false;
  1523.  
  1524.     data.src = trace_exit.endpos;
  1525.     data.penetrate_count--;
  1526.  
  1527.     return true;
  1528. }
  1529.  
  1530.  
  1531. /*
  1532. *    CanHit() - example of how to use the code
  1533. *     @in  point: target hitbox vector
  1534. *     @out damage_given: amount of damage the shot would do
  1535. */
  1536. bool CanHit(const Vector &point, float* damage_given)
  1537. {
  1538.     auto* local = Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
  1539.     auto data = FireBulletData(local->GetOrigin() + local->GetViewOffset());
  1540.     data.filter = CTraceFilter();
  1541.     data.filter.pSkip = local;
  1542.  
  1543.     Vector angles;
  1544.     CalcAngle(data.src, point, angles);
  1545.     AngleVectors(angles, &data.direction);
  1546.     VectorNormalize(data.direction);
  1547.  
  1548.     if (SimulateFireBullet(local, (CBaseCombatWeapon*)Interfaces::EntList->GetClientEntityFromHandle((HANDLE)local->GetActiveWeaponHandle()), data))
  1549.     {
  1550.         *damage_given = data.current_damage;
  1551.         return true;
  1552.     }
  1553.  
  1554.     return false;
  1555. }
  1556. #pragma once
  1557.  
  1558. # include "Hacks.h"
  1559.  
  1560. struct FireBulletData
  1561. {
  1562.     FireBulletData(const Vector &eye_pos):src(eye_pos)
  1563.     {
  1564.     }
  1565.  
  1566.     Vector src;
  1567.     trace_t enter_trace;
  1568.     Vector direction;
  1569.     CTraceFilter filter;
  1570.     float trace_length;
  1571.     float trace_length_remaining;
  1572.     float current_damage;
  1573.     int penetrate_count;
  1574. };/*
  1575. Syn's AYYWAREFramework 2015
  1576. */
  1577.  
  1578. #pragma once
  1579.  
  1580. #include "MiscDefinitions.h"
  1581. #include "ClientRecvProps.h"
  1582. #include "offsets.h"
  1583.  
  1584. class IBaseClientDLL
  1585. {
  1586.     public:
  1587.  
  1588.         ClientClass* GetAllClasses(void)
  1589.     {
  1590.         typedef ClientClass*(__thiscall * OriginalFn)(PVOID); //Anything inside a VTable is a __thiscall unless it completly disregards the thisptr. You can also call them as __stdcalls, but you won't have access to the __thisptr.
  1591.         return call_vfunc<OriginalFn>(this, Offsets::VMT::CHL_GetAllClasses)(this); //Return the pointer to the head CClientClass.
  1592.     }
  1593. };//========= Copyright Valve Corporation, All rights reserved. ============//
  1594. //
  1595. // Purpose:
  1596. //
  1597. // $Workfile:     $
  1598. // $Date:         $
  1599. // $NoKeywords: $
  1600. //=============================================================================//
  1601.  
  1602. #ifndef BSPFLAGS_H
  1603. #define BSPFLAGS_H
  1604.  
  1605. #ifdef _WIN32
  1606. #pragma once
  1607. #endif
  1608.  
  1609. // contents flags are seperate bits
  1610. // a given brush can contribute multiple content bits
  1611. // multiple brushes can be in a single leaf
  1612.  
  1613. // these definitions also need to be in q_shared.h!
  1614.  
  1615. // lower bits are stronger, and will eat weaker brushes completely
  1616. #define CONTENTS_EMPTY                  0               // No contents
  1617.  
  1618. #define CONTENTS_SOLID                  0x1             // an eye is never valid in a solid
  1619. #define CONTENTS_WINDOW                 0x2             // translucent, but not watery (glass)
  1620. #define CONTENTS_AUX                    0x4
  1621. #define CONTENTS_GRATE                  0x8             // alpha-tested "grate" textures.  Bullets/sight pass through, but solids don't
  1622. #define CONTENTS_SLIME                  0x10
  1623. #define CONTENTS_WATER                  0x20
  1624. #define CONTENTS_BLOCKLOS               0x40    // block AI line of sight
  1625. #define CONTENTS_OPAQUE                 0x80    // things that cannot be seen through (may be non-solid though)
  1626. #define LAST_VISIBLE_CONTENTS   0x80
  1627.  
  1628. #define ALL_VISIBLE_CONTENTS (LAST_VISIBLE_CONTENTS | (LAST_VISIBLE_CONTENTS-1))
  1629.  
  1630. #define CONTENTS_TESTFOGVOLUME  0x100
  1631. #define CONTENTS_UNUSED                 0x200  
  1632.  
  1633. // unused
  1634. // NOTE: If it's visible, grab from the top + update LAST_VISIBLE_CONTENTS
  1635. // if not visible, then grab from the bottom.
  1636. #define CONTENTS_UNUSED6                0x400
  1637.  
  1638. #define CONTENTS_TEAM1                  0x800   // per team contents used to differentiate collisions
  1639. #define CONTENTS_TEAM2                  0x1000  // between players and objects on different teams
  1640.  
  1641. // ignore CONTENTS_OPAQUE on surfaces that have SURF_NODRAW
  1642. #define CONTENTS_IGNORE_NODRAW_OPAQUE   0x2000
  1643.  
  1644. // hits entities which are MOVETYPE_PUSH (doors, plats, etc.)
  1645. #define CONTENTS_MOVEABLE               0x4000
  1646.  
  1647. // remaining contents are non-visible, and don't eat brushes
  1648. #define CONTENTS_AREAPORTAL             0x8000
  1649.  
  1650. #define CONTENTS_PLAYERCLIP             0x10000
  1651. #define CONTENTS_MONSTERCLIP    0x20000
  1652.  
  1653. // currents can be added to any other contents, and may be mixed
  1654. #define CONTENTS_CURRENT_0              0x40000
  1655. #define CONTENTS_CURRENT_90             0x80000
  1656. #define CONTENTS_CURRENT_180    0x100000
  1657. #define CONTENTS_CURRENT_270    0x200000
  1658. #define CONTENTS_CURRENT_UP             0x400000
  1659. #define CONTENTS_CURRENT_DOWN   0x800000
  1660.  
  1661. #define CONTENTS_ORIGIN                 0x1000000       // removed before bsping an entity
  1662.  
  1663. #define CONTENTS_MONSTER                0x2000000       // should never be on a brush, only in game
  1664. #define CONTENTS_DEBRIS                 0x4000000
  1665. #define CONTENTS_DETAIL                 0x8000000       // brushes to be added after vis leafs
  1666. #define CONTENTS_TRANSLUCENT    0x10000000      // auto set if any surface has trans
  1667. #define CONTENTS_LADDER                 0x20000000
  1668. #define CONTENTS_HITBOX                 0x40000000      // use accurate hitboxes on trace
  1669.  
  1670.  
  1671. // NOTE: These are stored in a short in the engine now.  Don't use more than 16 bits
  1672. #define SURF_LIGHT              0x0001          // value will hold the light strength
  1673. #define SURF_SKY2D              0x0002          // don't draw, indicates we should skylight + draw 2d sky but not draw the 3D skybox
  1674. #define SURF_SKY                0x0004          // don't draw, but add to skybox
  1675. #define SURF_WARP               0x0008          // turbulent water warp
  1676. #define SURF_TRANS              0x0010
  1677. #define SURF_NOPORTAL   0x0020  // the surface can not have a portal placed on it
  1678. #define SURF_TRIGGER    0x0040  // FIXME: This is an xbox hack to work around elimination of trigger surfaces, which breaks occluders
  1679. #define SURF_NODRAW             0x0080  // don't bother referencing the texture
  1680.  
  1681. #define SURF_HINT               0x0100  // make a primary bsp splitter
  1682.  
  1683. #define SURF_SKIP               0x0200  // completely ignore, allowing non-closed brushes
  1684. #define SURF_NOLIGHT    0x0400  // Don't calculate light
  1685. #define SURF_BUMPLIGHT  0x0800  // calculate three lightmaps for the surface for bumpmapping
  1686. #define SURF_NOSHADOWS  0x1000  // Don't receive shadows
  1687. #define SURF_NODECALS   0x2000  // Don't receive decals
  1688. #define SURF_NOCHOP             0x4000  // Don't subdivide patches on this surface
  1689. #define SURF_HITBOX             0x8000  // surface is part of a hitbox
  1690.  
  1691.  
  1692.  
  1693. // -----------------------------------------------------
  1694. // spatial content masks - used for spatial queries (traceline,etc.)
  1695. // -----------------------------------------------------
  1696. #define MASK_ALL                                        (0xFFFFFFFF)
  1697. // everything that is normally solid
  1698. #define MASK_SOLID                                      (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_WINDOW|CONTENTS_MONSTER|CONTENTS_GRATE)
  1699. // everything that blocks player movement
  1700. #define MASK_PLAYERSOLID                        (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_PLAYERCLIP|CONTENTS_WINDOW|CONTENTS_MONSTER|CONTENTS_GRATE)
  1701. // blocks npc movement
  1702. #define MASK_NPCSOLID                           (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_MONSTERCLIP|CONTENTS_WINDOW|CONTENTS_MONSTER|CONTENTS_GRATE)
  1703. // water physics in these contents
  1704. #define MASK_WATER                                      (CONTENTS_WATER|CONTENTS_MOVEABLE|CONTENTS_SLIME)
  1705. // everything that blocks lighting
  1706. #define MASK_OPAQUE                                     (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_OPAQUE)
  1707. // everything that blocks lighting, but with monsters added.
  1708. #define MASK_OPAQUE_AND_NPCS            (MASK_OPAQUE|CONTENTS_MONSTER)
  1709. // everything that blocks line of sight for AI
  1710. #define MASK_BLOCKLOS                           (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_BLOCKLOS)
  1711. // everything that blocks line of sight for AI plus NPCs
  1712. #define MASK_BLOCKLOS_AND_NPCS          (MASK_BLOCKLOS|CONTENTS_MONSTER)
  1713. // everything that blocks line of sight for players
  1714. #define MASK_VISIBLE                                    (MASK_OPAQUE|CONTENTS_IGNORE_NODRAW_OPAQUE)
  1715. // everything that blocks line of sight for players, but with monsters added.
  1716. #define MASK_VISIBLE_AND_NPCS           (MASK_OPAQUE_AND_NPCS|CONTENTS_IGNORE_NODRAW_OPAQUE)
  1717. // bullets see these as solid
  1718. #define MASK_SHOT                                       (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_MONSTER|CONTENTS_WINDOW|CONTENTS_DEBRIS|CONTENTS_HITBOX)
  1719. // non-raycasted weapons see this as solid (includes grates)
  1720. #define MASK_SHOT_HULL                          (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_MONSTER|CONTENTS_WINDOW|CONTENTS_DEBRIS|CONTENTS_GRATE)
  1721. // hits solids (not grates) and passes through everything else
  1722. #define MASK_SHOT_PORTAL                        (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_WINDOW|CONTENTS_MONSTER)
  1723. // everything normally solid, except monsters (world+brush only)
  1724. #define MASK_SOLID_BRUSHONLY            (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_WINDOW|CONTENTS_GRATE)
  1725. // everything normally solid for player movement, except monsters (world+brush only)
  1726. #define MASK_PLAYERSOLID_BRUSHONLY      (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_WINDOW|CONTENTS_PLAYERCLIP|CONTENTS_GRATE)
  1727. // everything normally solid for npc movement, except monsters (world+brush only)
  1728. #define MASK_NPCSOLID_BRUSHONLY         (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_WINDOW|CONTENTS_MONSTERCLIP|CONTENTS_GRATE)
  1729. // just the world, used for route rebuilding
  1730. #define MASK_NPCWORLDSTATIC                     (CONTENTS_SOLID|CONTENTS_WINDOW|CONTENTS_MONSTERCLIP|CONTENTS_GRATE)
  1731. // These are things that can split areaportals
  1732. #define MASK_SPLITAREAPORTAL            (CONTENTS_WATER|CONTENTS_SLIME)
  1733.  
  1734. // UNDONE: This is untested, any moving water
  1735. #define MASK_CURRENT                            (CONTENTS_CURRENT_0|CONTENTS_CURRENT_90|CONTENTS_CURRENT_180|CONTENTS_CURRENT_270|CONTENTS_CURRENT_UP|CONTENTS_CURRENT_DOWN)
  1736.  
  1737. // everything that blocks corpse movement
  1738. // UNDONE: Not used yet / may be deleted
  1739. #define MASK_DEADSOLID                          (CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_WINDOW|CONTENTS_GRATE)
  1740.  
  1741. #endif // BSPFLAGS_H
  1742.  
  1743. bool CanHit(const Vector &point, float* damage_given);
  1744.  
  1745. #include "Chams.h"
  1746. #include "offsets.h"
  1747. #include "SDK.h"
  1748. #include "Interfaces.h"
  1749.  
  1750. void InitKeyValues(KeyValues* keyValues, char* name)
  1751. {
  1752.     DWORD dwFunction = (DWORD)Offsets::Functions::KeyValues_KeyValues;
  1753.     __asm
  1754.  
  1755.     {
  1756.         push name
  1757.  
  1758.             mov ecx, keyValues
  1759.  
  1760.             call dwFunction
  1761.  
  1762.     }
  1763. }
  1764.  
  1765. void LoadFromBuffer(KeyValues* keyValues, char const *resourceName, const char* pBuffer)
  1766. {
  1767.     DWORD dwFunction = (DWORD)Offsets::Functions::KeyValues_LoadFromBuffer;
  1768.  
  1769.     __asm
  1770.  
  1771.     {
  1772.         push 0
  1773.  
  1774.             push 0
  1775.  
  1776.             push 0
  1777.  
  1778.             push pBuffer
  1779.  
  1780.             push resourceName
  1781.  
  1782.             mov ecx, keyValues
  1783.  
  1784.             call dwFunction
  1785.  
  1786.     }
  1787. }
  1788.  
  1789. IMaterial* CreateMaterial(bool shouldIgnoreZ, bool isLit, bool isWireframe) //credits to ph0ne
  1790. {
  1791.     static int created = 0;
  1792.  
  1793.     static const char tmp[] =
  1794.     {
  1795.         "\"%s\"\
  1796.                 \n{\
  1797.                 \n\t\"$basetexture\" \"vgui/white_additive\"\
  1798.                 \n\t\"$envmap\" \"\"\
  1799.                 \n\t\"$model\" \"1\"\
  1800.                 \n\t\"$flat\" \"1\"\
  1801.                 \n\t\"$nocull\" \"0\"\
  1802.                 \n\t\"$selfillum\" \"1\"\
  1803.                 \n\t\"$halflambert\" \"1\"\
  1804.                 \n\t\"$nofog\" \"0\"\
  1805.                 \n\t\"$ignorez\" \"%i\"\
  1806.                 \n\t\"$znearer\" \"0\"\
  1807.                 \n\t\"$wireframe\" \"%i\"\
  1808.         \n}\n"
  1809.     };
  1810.  
  1811.     char* baseType = (isLit == true ? "VertexLitGeneric" : "UnlitGeneric");
  1812.     char material[512];
  1813.     sprintf_s(material, sizeof(material), tmp, baseType, (shouldIgnoreZ) ? 1 : 0, (isWireframe) ? 1 : 0);
  1814.  
  1815.     char name[512];
  1816.     sprintf_s(name, sizeof(name), "#ayy_meme_%i.vmt", created);
  1817.     ++created;
  1818.  
  1819.     KeyValues* keyValues = (KeyValues*)malloc(sizeof(KeyValues));
  1820.     InitKeyValues(keyValues, baseType);
  1821.     LoadFromBuffer(keyValues, name, material);
  1822.  
  1823.     IMaterial* createdMaterial = Interfaces::MaterialSystem->CreateMaterial(name, keyValues);
  1824.     createdMaterial->IncrementReferenceCount();
  1825.  
  1826.     return createdMaterial;
  1827. }
  1828.  
  1829. void ForceMaterial(Color color, IMaterial* material, bool useColor, bool forceMaterial)
  1830. {
  1831.     if (useColor)
  1832.     {
  1833.         float temp[3] =
  1834.         {
  1835.             color.r(),
  1836.             color.g(),
  1837.             color.b()
  1838.         };
  1839.  
  1840.         temp[0] /= 255.f;
  1841.         temp[1] /= 255.f;
  1842.         temp[2] /= 255.f;
  1843.  
  1844.  
  1845.         float alpha = color.a();
  1846.  
  1847.         Interfaces::RenderView->SetBlend(1.0f);
  1848.         Interfaces::RenderView->SetColorModulation(temp);
  1849.     }
  1850.  
  1851.     if (forceMaterial)
  1852.         Interfaces::ModelRender->ForcedMaterialOverride(material);
  1853.     else
  1854.         Interfaces::ModelRender->ForcedMaterialOverride(NULL);
  1855.  
  1856. }/*
  1857. Syn's AYYWAREFramework 2015
  1858. */
  1859.  
  1860. #pragma once
  1861. #include "SDK.h"
  1862.  
  1863. void InitKeyValues(KeyValues* keyValues, char* name);
  1864.  
  1865. void LoadFromBuffer(KeyValues* keyValues, char const *resourceName, const char* pBuffer);
  1866.  
  1867. void ForceMaterial(Color color, IMaterial* material, bool useColor = true, bool forceMaterial = true);
  1868.  
  1869. IMaterial* CreateMaterial(bool shouldIgnoreZ, bool isLit = true, bool isWireframe = false);
  1870. /*
  1871. Syn's AYYWAREFramework 2015
  1872. */
  1873.  
  1874. // Credits to Valve and Shad0w
  1875.  
  1876. #pragma once
  1877.  
  1878. struct RecvProp;
  1879.  
  1880. class DVariant
  1881. {
  1882.     public:
  1883.         union
  1884.         {
  1885.                 float m_Float;
  1886.     long m_Int;
  1887.     char* m_pString;
  1888.     void* m_pData;
  1889.     float m_Vector[3];
  1890. };
  1891. };
  1892.  
  1893. class CRecvProxyData
  1894. {
  1895.     public:
  1896.         const RecvProp* m_pRecvProp;
  1897.     char _pad[4];//csgo ( for l4d keep it commented out :) )
  1898.     DVariant m_Value;
  1899.     int m_iElement;
  1900.     int m_ObjectID;
  1901. };
  1902.  
  1903. typedef void(* RecvVarProxyFn)(const CRecvProxyData* pData, void* pStruct, void* pOut);
  1904.  
  1905. struct RecvTable
  1906. {
  1907.     RecvProp* m_pProps;
  1908.     int m_nProps;
  1909.     void* m_pDecoder;
  1910.     char* m_pNetTableName;
  1911.     bool m_bInitialized;
  1912.     bool m_bInMainList;
  1913. };
  1914.  
  1915. struct RecvProp
  1916. {
  1917.     char* m_pVarName;
  1918.     int m_RecvType;
  1919.     int m_Flags;
  1920.     int m_StringBufferSize;
  1921.     bool m_bInsideArray;
  1922.     const void* m_pExtraData;
  1923.     RecvProp* m_pArrayProp;
  1924.     void* m_ArrayLengthProxy;
  1925.     void* m_ProxyFn;
  1926.     void* m_DataTableProxyFn;
  1927.     RecvTable* m_pDataTable;
  1928.     int m_Offset;
  1929.     int m_ElementStride;
  1930.     int m_nElements;
  1931.     const char* m_pParentArrayPropName;
  1932. };
  1933.  
  1934. class ClientClass
  1935. {
  1936.     public:
  1937.         void* m_pCreateFn;
  1938.     void* m_pCreateEventFn;
  1939.     char* m_pNetworkName;
  1940.     RecvTable* m_pRecvTable;
  1941.     ClientClass* m_pNext;
  1942.     int m_ClassID;
  1943. };
  1944. #pragma once
  1945. #define _WINSOCKAPI_
  1946.  
  1947. // Includes
  1948. # include <Windows.h>
  1949. # include <cstdlib>
  1950. # include <cstdio>
  1951. # include <math.h>
  1952. # include <string>
  1953. # include <conio.h>
  1954. # include <vector>
  1955. #pragma once
  1956. #define _WINSOCKAPI_
  1957.  
  1958. // Includes
  1959. # include <Windows.h>
  1960. # include <cstdlib>
  1961. # include <cstdio>
  1962. # include <math.h>
  1963. # include <string>
  1964. # include <conio.h>
  1965. # include <vector>
  1966. /*
  1967. Syn's AYYWAREFramework 2015
  1968. */
  1969.  
  1970. #pragma once
  1971.  
  1972. # include "GUI.h"
  1973.  
  1974. class CCheckBox : public CControl
  1975. {
  1976. public:
  1977.  
  1978.     CCheckBox();
  1979. void SetState(bool s);
  1980. bool GetState();
  1981. protected:
  1982.         bool Checked;
  1983. void Draw(bool hover);
  1984. void OnUpdate();
  1985. void OnClick();
  1986. };
  1987.  
  1988. class CLabel : public CControl
  1989. {
  1990. public:
  1991.  
  1992.     CLabel();
  1993. void SetText(std::string text);
  1994. protected:
  1995.         std::string Text;
  1996. void Draw(bool hover);
  1997. void OnUpdate();
  1998. void OnClick();
  1999. };
  2000.  
  2001. class CGroupBox : public CControl
  2002. {
  2003. public:
  2004.  
  2005.     CGroupBox();
  2006. void SetText(std::string text);
  2007. void PlaceLabledControl(std::string Label, CTab* Tab, CControl* control);
  2008. protected:
  2009.         int Items;
  2010. std::string Text;
  2011. void Draw(bool hover);
  2012. void OnUpdate();
  2013. void OnClick();
  2014. };
  2015.  
  2016. class CSlider : public CControl
  2017. {
  2018. public:
  2019.  
  2020.     CSlider();
  2021. float GetValue();
  2022. void SetValue(float v);
  2023. void SetBoundaries(float min, float max);
  2024. protected:
  2025.         float Value;
  2026. float Min;
  2027. float Max;
  2028. bool DoDrag;
  2029. void Draw(bool hover);
  2030. void OnUpdate();
  2031. void OnClick();
  2032. };
  2033.  
  2034. class CKeyBind : public CControl
  2035. {
  2036. public:
  2037.  
  2038.     CKeyBind();
  2039. int GetKey();
  2040. void SetKey(int key);
  2041. protected:
  2042.         int Key;
  2043. bool IsGettingKey;
  2044. void Draw(bool hover);
  2045. void OnUpdate();
  2046. void OnClick();
  2047. };
  2048.  
  2049. class CButton : public CControl
  2050. {
  2051. public:
  2052.         typedef void(* ButtonCallback_t)(void);
  2053.  
  2054.     CButton();
  2055. void SetCallback(ButtonCallback_t callback);
  2056. void SetText(std::string text);
  2057. protected:
  2058.         ButtonCallback_t CallBack;
  2059. std::string Text;
  2060. void Draw(bool hover);
  2061. void OnUpdate();
  2062. void OnClick();
  2063. };
  2064.  
  2065. class CComboBox : public CControl
  2066. {
  2067. public:
  2068.  
  2069.     CComboBox();
  2070. void AddItem(std::string text);
  2071. void SelectIndex(int idx);
  2072. int GetIndex();
  2073. std::string GetItem();
  2074. protected:
  2075.         std::vector<std::string> Items;
  2076. int SelectedIndex;
  2077. bool IsOpen;
  2078. void Draw(bool hover);
  2079. void OnUpdate();
  2080. void OnClick();
  2081. };/*
  2082. Syn's AYYWAREFramework 2015
  2083. */
  2084.  
  2085. #include "CRC32.h"
  2086.  
  2087. unsigned int uiCRC32_Table[256] = {
  2088.     0x00000000L, 0x77073096L, 0xEE0E612CL,
  2089.     0x990951BAL, 0x076DC419L, 0x706AF48FL,
  2090.     0xE963A535L, 0x9E6495A3L, 0x0EDB8832L,
  2091.     0x79DCB8A4L, 0xE0D5E91EL, 0x97D2D988L,
  2092.     0x09B64C2BL, 0x7EB17CBDL, 0xE7B82D07L,
  2093.     0x90BF1D91L, 0x1DB71064L, 0x6AB020F2L,
  2094.     0xF3B97148L, 0x84BE41DEL, 0x1ADAD47DL,
  2095.     0x6DDDE4EBL, 0xF4D4B551L, 0x83D385C7L,
  2096.     0x136C9856L, 0x646BA8C0L, 0xFD62F97AL,
  2097.     0x8A65C9ECL, 0x14015C4FL, 0x63066CD9L,
  2098.     0xFA0F3D63L, 0x8D080DF5L, 0x3B6E20C8L,
  2099.     0x4C69105EL, 0xD56041E4L, 0xA2677172L,
  2100.     0x3C03E4D1L, 0x4B04D447L, 0xD20D85FDL,
  2101.     0xA50AB56BL, 0x35B5A8FAL, 0x42B2986CL,
  2102.     0xDBBBC9D6L, 0xACBCF940L, 0x32D86CE3L,
  2103.     0x45DF5C75L, 0xDCD60DCFL, 0xABD13D59L,
  2104.     0x26D930ACL, 0x51DE003AL, 0xC8D75180L,
  2105.     0xBFD06116L, 0x21B4F4B5L, 0x56B3C423L,
  2106.     0xCFBA9599L, 0xB8BDA50FL, 0x2802B89EL,
  2107.     0x5F058808L, 0xC60CD9B2L, 0xB10BE924L,
  2108.     0x2F6F7C87L, 0x58684C11L, 0xC1611DABL,
  2109.     0xB6662D3DL, 0x76DC4190L, 0x01DB7106L,
  2110.     0x98D220BCL, 0xEFD5102AL, 0x71B18589L,
  2111.     0x06B6B51FL, 0x9FBFE4A5L, 0xE8B8D433L,
  2112.     0x7807C9A2L, 0x0F00F934L, 0x9609A88EL,
  2113.     0xE10E9818L, 0x7F6A0DBBL, 0x086D3D2DL,
  2114.     0x91646C97L, 0xE6635C01L, 0x6B6B51F4L,
  2115.     0x1C6C6162L, 0x856530D8L, 0xF262004EL,
  2116.     0x6C0695EDL, 0x1B01A57BL, 0x8208F4C1L,
  2117.     0xF50FC457L, 0x65B0D9C6L, 0x12B7E950L,
  2118.     0x8BBEB8EAL, 0xFCB9887CL, 0x62DD1DDFL,
  2119.     0x15DA2D49L, 0x8CD37CF3L, 0xFBD44C65L,
  2120.     0x4DB26158L, 0x3AB551CEL, 0xA3BC0074L,
  2121.     0xD4BB30E2L, 0x4ADFA541L, 0x3DD895D7L,
  2122.     0xA4D1C46DL, 0xD3D6F4FBL, 0x4369E96AL,
  2123.     0x346ED9FCL, 0xAD678846L, 0xDA60B8D0L,
  2124.     0x44042D73L, 0x33031DE5L, 0xAA0A4C5FL,
  2125.     0xDD0D7CC9L, 0x5005713CL, 0x270241AAL,
  2126.     0xBE0B1010L, 0xC90C2086L, 0x5768B525L,
  2127.     0x206F85B3L, 0xB966D409L, 0xCE61E49FL,
  2128.     0x5EDEF90EL, 0x29D9C998L, 0xB0D09822L,
  2129.     0xC7D7A8B4L, 0x59B33D17L, 0x2EB40D81L,
  2130.     0xB7BD5C3BL, 0xC0BA6CADL, 0xEDB88320L,
  2131.     0x9ABFB3B6L, 0x03B6E20CL, 0x74B1D29AL,
  2132.     0xEAD54739L, 0x9DD277AFL, 0x04DB2615L,
  2133.     0x73DC1683L, 0xE3630B12L, 0x94643B84L,
  2134.     0x0D6D6A3EL, 0x7A6A5AA8L, 0xE40ECF0BL,
  2135.     0x9309FF9DL, 0x0A00AE27L, 0x7D079EB1L,
  2136.     0xF00F9344L, 0x8708A3D2L, 0x1E01F268L,
  2137.     0x6906C2FEL, 0xF762575DL, 0x806567CBL,
  2138.     0x196C3671L, 0x6E6B06E7L, 0xFED41B76L,
  2139.     0x89D32BE0L, 0x10DA7A5AL, 0x67DD4ACCL,
  2140.     0xF9B9DF6FL, 0x8EBEEFF9L, 0x17B7BE43L,
  2141.     0x60B08ED5L, 0xD6D6A3E8L, 0xA1D1937EL,
  2142.     0x38D8C2C4L, 0x4FDFF252L, 0xD1BB67F1L,
  2143.     0xA6BC5767L, 0x3FB506DDL, 0x48B2364BL,
  2144.     0xD80D2BDAL, 0xAF0A1B4CL, 0x36034AF6L,
  2145.     0x41047A60L, 0xDF60EFC3L, 0xA867DF55L,
  2146.     0x316E8EEFL, 0x4669BE79L, 0xCB61B38CL,
  2147.     0xBC66831AL, 0x256FD2A0L, 0x5268E236L,
  2148.     0xCC0C7795L, 0xBB0B4703L, 0x220216B9L,
  2149.     0x5505262FL, 0xC5BA3BBEL, 0xB2BD0B28L,
  2150.     0x2BB45A92L, 0x5CB36A04L, 0xC2D7FFA7L,
  2151.     0xB5D0CF31L, 0x2CD99E8BL, 0x5BDEAE1DL,
  2152.     0x9B64C2B0L, 0xEC63F226L, 0x756AA39CL,
  2153.     0x026D930AL, 0x9C0906A9L, 0xEB0E363FL,
  2154.     0x72076785L, 0x05005713L, 0x95BF4A82L,
  2155.     0xE2B87A14L, 0x7BB12BAEL, 0x0CB61B38L,
  2156.     0x92D28E9BL, 0xE5D5BE0DL, 0x7CDCEFB7L,
  2157.     0x0BDBDF21L, 0x86D3D2D4L, 0xF1D4E242L,
  2158.     0x68DDB3F8L, 0x1FDA836EL, 0x81BE16CDL,
  2159.     0xF6B9265BL, 0x6FB077E1L, 0x18B74777L,
  2160.     0x88085AE6L, 0xFF0F6A70L, 0x66063BCAL,
  2161.     0x11010B5CL, 0x8F659EFFL, 0xF862AE69L,
  2162.     0x616BFFD3L, 0x166CCF45L, 0xA00AE278L,
  2163.     0xD70DD2EEL, 0x4E048354L, 0x3903B3C2L,
  2164.     0xA7672661L, 0xD06016F7L, 0x4969474DL,
  2165.     0x3E6E77DBL, 0xAED16A4AL, 0xD9D65ADCL,
  2166.     0x40DF0B66L, 0x37D83BF0L, 0xA9BCAE53L,
  2167.     0xDEBB9EC5L, 0x47B2CF7FL, 0x30B5FFE9L,
  2168.     0xBDBDF21CL, 0xCABAC28AL, 0x53B39330L,
  2169.     0x24B4A3A6L, 0xBAD03605L, 0xCDD70693L,
  2170.     0x54DE5729L, 0x23D967BFL, 0xB3667A2EL,
  2171.     0xC4614AB8L, 0x5D681B02L, 0x2A6F2B94L,
  2172.     0xB40BBE37L, 0xC30C8EA1L, 0x5A05DF1BL,
  2173.     0x2D02EF8DL };
  2174.  
  2175. unsigned int CRC32(void* pData, size_t iLen)
  2176. {
  2177.     unsigned int uiCRC32 = 0xFFFFFFFF;
  2178.     unsigned char* pszData = (unsigned char*)pData;
  2179.  
  2180.     for (size_t i = 0; i < iLen; ++i)
  2181.         uiCRC32 = ((uiCRC32 >> 8) & 0x00FFFFFF) ^ uiCRC32_Table[(uiCRC32 ^ (unsigned int)*pszData++) &0xFF];
  2182.  
  2183.     return (uiCRC32 ^ 0xFFFFFFFF);
  2184. }/*
  2185. Syn's AYYWAREFramework 2015
  2186. */
  2187.  
  2188. // Credits Valve / Shad0w
  2189.  
  2190. #pragma once
  2191.  
  2192. unsigned int CRC32(void* pData, size_t iLen);
  2193. /*
  2194. Syn's AYYWAREFramework 2015
  2195. */
  2196.  
  2197. #include "Utilities.h"
  2198.  
  2199. // Stuff to initialise
  2200. #include "Offsets.h"
  2201. #include "Interfaces.h"
  2202. #include "Hooks.h"
  2203. #include "RenderManager.h"
  2204. #include "Hacks.h"
  2205. #include "Menu.h"
  2206. #include "AntiAntiAim.h"
  2207.  
  2208. #include "Dumping.h"
  2209.  
  2210. bool DoUnload;
  2211.  
  2212. HINSTANCE HThisModule;
  2213.  
  2214. // Our thread we use to setup everything we need
  2215. // Everything appart from code in hooks get's called from inside
  2216. // here.
  2217.  
  2218. int InitialThread(LPVOID lpArguments)
  2219. {
  2220.     Utilities::OpenConsole("Cebula.dll");
  2221.  
  2222.     //---------------------------------------------------------
  2223.     // Initialise all our shit
  2224.  
  2225.     Offsets::Initialise(); // Set our VMT offsets and do any pattern scans
  2226.     Interfaces::Initialise(); // Get pointers to the valve classes
  2227.     NetVar.RetrieveClasses(); // Setup our NetVar manager (thanks shad0w bby)
  2228.     Render::Initialise();
  2229.     Hacks::SetupHacks();
  2230.     Menu::SetupMenu();
  2231.     Hooks::Initialise();
  2232.     ApplyAAAHooks();
  2233.     // Dumping
  2234.     //Dump::DumpClassIds();
  2235.  
  2236.     //---------------------------------------------------------
  2237.     Utilities::Log("Ready");
  2238.  
  2239.     // While our cheat is running
  2240.     while (DoUnload == false)
  2241.     {
  2242.         Sleep(1000);
  2243.     }
  2244.  
  2245.     Hooks::UndoHooks();
  2246.     Sleep(2000); // Make sure none of our hooks are running
  2247.     FreeLibraryAndExitThread(HThisModule, 0);
  2248.  
  2249.     return 0;
  2250. }
  2251.  
  2252. // DllMain
  2253. // Entry point for our module
  2254. bool _stdcall DllMain(HINSTANCE hinst, DWORD dwReason, LPVOID lpReserved)
  2255. {
  2256.     if (dwReason == DLL_PROCESS_ATTACH)
  2257.     {
  2258.         CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)InitialThread, NULL, NULL, NULL);
  2259.     }
  2260.     return true;
  2261. }
  2262. #include "Dumping.h"
  2263.  
  2264. #define DUMPIDTOFILE
  2265.  
  2266. void Dump::DumpClassIds()
  2267. {
  2268. # ifdef DUMPIDTOFILE
  2269.     Utilities::EnableLogFile("ClassID.txt");
  2270. #endif
  2271.     ClientClass* cClass = Interfaces::Client->GetAllClasses();
  2272.     while (cClass)
  2273.     {
  2274.         Utilities::Log("%s = %d,", cClass->m_pNetworkName, cClass->m_ClassID);
  2275.         cClass = cClass->m_pNext;
  2276.     }
  2277. }/*
  2278. Syn's AYYWAREFramework 2015
  2279. */
  2280.  
  2281. #pragma once
  2282.  
  2283. #include "Interfaces.h"
  2284. #include "Utilities.h"
  2285.  
  2286. namespace Dump
  2287. {
  2288.     void DumpClassIds();
  2289. };/*
  2290. Syn's AYYWAREFramework 2015
  2291. */
  2292.  
  2293. #pragma once
  2294.  
  2295. #include "MiscDefinitions.h"
  2296. #include "ClientRecvProps.h"
  2297. #include "offsets.h"
  2298. #include "Vector.h"
  2299.  
  2300. // EngineClient
  2301. class IVEngineClient
  2302. {
  2303.     public:
  2304.         void GetScreenSize(int& width, int& height)
  2305.     {
  2306.         typedef void(__thiscall * oGetScreenSize)(PVOID, int &, int &);
  2307.         return call_vfunc<oGetScreenSize>(this, Offsets::VMT::Engine_GetScreenSize)(this, width, height);
  2308.     }
  2309.     bool GetPlayerInfo(int ent_num, player_info_t* pinfo)
  2310.     {
  2311.         typedef bool(__thiscall * oGetPlayerInfo)(PVOID, int, player_info_t *);
  2312.         return call_vfunc<oGetPlayerInfo>(this, Offsets::VMT::Engine_GetPlayerInfo)(this, ent_num, pinfo);
  2313.     }
  2314.     int GetLocalPlayer()
  2315.     {
  2316.         typedef int(__thiscall * oLocal)(PVOID);
  2317.         return call_vfunc<oLocal>(this, Offsets::VMT::Engine_GetLocalPlayer)(this);
  2318.     }
  2319.     float Time()
  2320.     {
  2321.         typedef float(__thiscall * oTime)(PVOID);
  2322.         return call_vfunc<oTime>(this, Offsets::VMT::Engine_Time)(this);
  2323.     }
  2324.     void GetViewAngles(Vector& vAngles)
  2325.     {
  2326.         typedef void(__thiscall * oSetViewAngles)(PVOID, Vector &);
  2327.         return call_vfunc<oSetViewAngles>(this, Offsets::VMT::Engine_GetViewAngles)(this, vAngles);
  2328.     }
  2329.     void SetViewAngles(Vector& vAngles)
  2330.     {
  2331.         typedef void(__thiscall * oSetViewAngles)(PVOID, Vector &);
  2332.         return call_vfunc<oSetViewAngles>(this, Offsets::VMT::Engine_SetViewAngles)(this, vAngles);
  2333.     }
  2334.     int GetMaxClients()
  2335.     {
  2336.         typedef bool(__thiscall * oGetMaxClients)(PVOID);
  2337.         return call_vfunc<oGetMaxClients>(this, Offsets::VMT::Engine_GetMaxClients)(this);
  2338.     }
  2339.     bool IsConnected()
  2340.     {
  2341.         typedef bool(__thiscall * oGetScreenSize)(PVOID);
  2342.         return call_vfunc<oGetScreenSize>(this, Offsets::VMT::Engine_IsConnected)(this);
  2343.     }
  2344.     bool IsInGame()
  2345.     {
  2346.         typedef bool(__thiscall * oLocal)(PVOID);
  2347.         return call_vfunc<oLocal>(this, Offsets::VMT::Engine_IsInGame)(this);
  2348.     }
  2349.     const matrix3x4& WorldToScreenMatrix()
  2350.     {
  2351.         typedef const matrix3x4&(__thiscall * oWorldToScreenMatrix)(PVOID);
  2352.         return call_vfunc<oWorldToScreenMatrix>(this, Offsets::VMT::Engine_WorldToScreenMatrix)(this);
  2353.     }
  2354.     void ClientCmd_Unrestricted(char  const* cmd)
  2355.         {
  2356.  
  2357.         typedef void(__thiscall* oClientCmdUnres)(PVOID, const char*);
  2358.                 return call_vfunc<oClientCmdUnres>(this, Offsets::VMT::Engine_ClientCmd_Unrestricted)(this, cmd);
  2359.         }
  2360. };/*
  2361. Syn's AyyWare Framework 2015
  2362. */
  2363.  
  2364. #pragma once
  2365.  
  2366. #include "MiscDefinitions.h"
  2367. #include "ClientRecvProps.h"
  2368. #include "offsets.h"
  2369. #include "Vector.h"
  2370.  
  2371. #define TEAM_CS_T 2
  2372. #define TEAM_CS_CT 3
  2373.  
  2374. #define BONE_USED_BY_HITBOX                     0x00000100
  2375.  
  2376. class IClientRenderable;
  2377. class IClientNetworkable;
  2378. class IClientUnknown;
  2379. class IClientThinkable;
  2380. class IClientEntity;
  2381. class CSWeaponInfo;
  2382.  
  2383. class CSWeaponInfo
  2384. {
  2385.     public:
  2386.         virtual void Function0(); //
  2387.     virtual void Function1(); //
  2388.     virtual void Parse(KeyValues* pKeyValuesData, const char* szWeaponName); //
  2389.     virtual void RefreshDynamicParameters(void); //
  2390.     virtual void Function4(); //
  2391.     virtual void Function5(); //
  2392.     virtual void Function6(); //
  2393.     virtual void Function7(); //
  2394.     virtual void Function8(); //
  2395.  
  2396.     char pad_0x0004[0x2]; //0x0004
  2397.     char m_pszName[32]; //0x0006
  2398.     char pad_0x0026[0x7E]; //0x0026
  2399.     __int16 N0000002E; //0x00A4
  2400.     char m_pszModelName[32]; //0x00A6
  2401.     char pad_0x00C6[0x6DE]; //0x00C6
  2402.     BYTE m_IsFullAuto; //0x07A4
  2403.     char pad_0x07A5[0x7]; //0x07A5
  2404.     __int32 m_iPrice; //0x07AC
  2405.     float m_flArmorRatio; //0x07B0
  2406.     char pad_0x07B4[0x10]; //0x07B4
  2407.     float m_flPenetration; //0x07C4
  2408.     __int32 m_iDamage; //0x07C8
  2409.     float m_flRange; //0x07CC
  2410.     float m_flRangeModifier; //0x07D0
  2411.     char pad_0x07D4[0x4]; //0x07D4
  2412.     float m_flCycleTime; //0x07D8
  2413.  
  2414. };
  2415.  
  2416. enum class CSGOClassID
  2417. {
  2418.     CTestTraceline = 189,
  2419.         CTEWorldDecal = 190,
  2420.         CTESpriteSpray = 187,
  2421.         CTESprite = 186,
  2422.         CTESparks = 185,
  2423.         CTESmoke = 184,
  2424.         CTEShowLine = 182,
  2425.         CTEProjectedDecal = 179,
  2426.         CTEPlayerDecal = 178,
  2427.         CTEPhysicsProp = 175,
  2428.         CTEParticleSystem = 174,
  2429.         CTEMuzzleFlash = 173,
  2430.         CTELargeFunnel = 171,
  2431.         CTEKillPlayerAttachments = 170,
  2432.         CTEImpact = 169,
  2433.         CTEGlowSprite = 168,
  2434.         CTEShatterSurface = 181,
  2435.         CTEFootprintDecal = 165,
  2436.         CTEFizz = 164,
  2437.         CTEExplosion = 162,
  2438.         CTEEnergySplash = 161,
  2439.         CTEEffectDispatch = 160,
  2440.         CTEDynamicLight = 159,
  2441.         CTEDecal = 157,
  2442.         CTEClientProjectile = 156,
  2443.         CTEBubbleTrail = 155,
  2444.         CTEBubbles = 154,
  2445.         CTEBSPDecal = 153,
  2446.         CTEBreakModel = 152,
  2447.         CTEBloodStream = 151,
  2448.         CTEBloodSprite = 150,
  2449.         CTEBeamSpline = 149,
  2450.         CTEBeamRingPoint = 148,
  2451.         CTEBeamRing = 147,
  2452.         CTEBeamPoints = 146,
  2453.         CTEBeamLaser = 145,
  2454.         CTEBeamFollow = 144,
  2455.         CTEBeamEnts = 143,
  2456.         CTEBeamEntPoint = 142,
  2457.         CTEBaseBeam = 141,
  2458.         CTEArmorRicochet = 140,
  2459.         CTEMetalSparks = 172,
  2460.         CSteamJet = 135,
  2461.         CSmokeStack = 128,
  2462.         DustTrail = 238,
  2463.         CFireTrail = 62,
  2464.         SporeTrail = 244,
  2465.         SporeExplosion = 243,
  2466.         RocketTrail = 241,
  2467.         SmokeTrail = 242,
  2468.         CPropVehicleDriveable = 117,
  2469.         ParticleSmokeGrenade = 240,
  2470.         CParticleFire = 96,
  2471.         MovieExplosion = 239,
  2472.         CTEGaussExplosion = 167,
  2473.         CEnvQuadraticBeam = 55,
  2474.         CEmbers = 45,
  2475.         CEnvWind = 59,
  2476.         CPrecipitation = 111,
  2477.         CPrecipitationBlocker = 112,
  2478.         CBaseTempEntity = 18,
  2479.         NextBotCombatCharacter = 0,
  2480.         CBaseAttributableItem = 4,
  2481.         CEconEntity = 44,
  2482.         CWeaponXM1014 = 236,
  2483.         CWeaponTaser = 231,
  2484.         CSmokeGrenade = 126,
  2485.         CWeaponSG552 = 228,
  2486.         CWeaponSawedoff = 224,
  2487.         CWeaponNOVA = 220,
  2488.         CIncendiaryGrenade = 85,
  2489.         CMolotovGrenade = 93,
  2490.         CWeaponM3 = 212,
  2491.         CKnifeGG = 90,
  2492.         CKnife = 89,
  2493.         CHEGrenade = 82,
  2494.         CFlashbang = 64,
  2495.         CWeaponElite = 203,
  2496.         CDecoyGrenade = 40,
  2497.         CDEagle = 39,
  2498.         CWeaponUSP = 235,
  2499.         CWeaponM249 = 211,
  2500.         CWeaponUMP45 = 234,
  2501.         CWeaponTMP = 233,
  2502.         CWeaponTec9 = 232,
  2503.         CWeaponSSG08 = 230,
  2504.         CWeaponSG556 = 229,
  2505.         CWeaponSG550 = 227,
  2506.         CWeaponScout = 226,
  2507.         CWeaponSCAR20 = 225,
  2508.         CSCAR17 = 122,
  2509.         CWeaponP90 = 223,
  2510.         CWeaponP250 = 222,
  2511.         CWeaponP228 = 221,
  2512.         CWeaponNegev = 219,
  2513.         CWeaponMP9 = 218,
  2514.         CWeaponMP7 = 217,
  2515.         CWeaponMP5Navy = 216,
  2516.         CWeaponMag7 = 215,
  2517.         CWeaponMAC10 = 214,
  2518.         CWeaponM4A1 = 213,
  2519.         CWeaponHKP2000 = 210,
  2520.         CWeaponGlock = 209,
  2521.         CWeaponGalilAR = 208,
  2522.         CWeaponGalil = 207,
  2523.         CWeaponG3SG1 = 206,
  2524.         CWeaponFiveSeven = 205,
  2525.         CWeaponFamas = 204,
  2526.         CWeaponBizon = 199,
  2527.         CWeaponAWP = 198,
  2528.         CWeaponAug = 197,
  2529.         CAK47 = 1,
  2530.         CWeaponCSBaseGun = 201,
  2531.         CWeaponCSBase = 200,
  2532.         CC4 = 29,
  2533.         CBaseCSGrenade = 8,
  2534.         CSmokeGrenadeProjectile = 127,
  2535.         CMolotovProjectile = 94,
  2536.         CDecoyProjectile = 41,
  2537.         CFireCrackerBlast = 60,
  2538.         CInferno = 86,
  2539.         CChicken = 31,
  2540.         CFootstepControl = 66,
  2541.         CCSGameRulesProxy = 34,
  2542.         CWeaponCubemap = 0,
  2543.         CWeaponCycler = 202,
  2544.         CTEPlantBomb = 176,
  2545.         CTEFireBullets = 163,
  2546.         CTERadioIcon = 180,
  2547.         CPlantedC4 = 104,
  2548.         CCSTeam = 38,
  2549.         CCSPlayerResource = 36,
  2550.         CCSPlayer = 35,
  2551.         CCSRagdoll = 37,
  2552.         CTEPlayerAnimEvent = 177,
  2553.         CHostage = 83,
  2554.         CHostageCarriableProp = 84,
  2555.         CBaseCSGrenadeProjectile = 9,
  2556.         CHandleTest = 81,
  2557.         CTeamplayRoundBasedRulesProxy = 139,
  2558.         CSpriteTrail = 133,
  2559.         CSpriteOriented = 132,
  2560.         CSprite = 131,
  2561.         CRagdollPropAttached = 120,
  2562.         CRagdollProp = 119,
  2563.         CPredictedViewModel = 113,
  2564.         CPoseController = 109,
  2565.         CGameRulesProxy = 80,
  2566.         CInfoLadderDismount = 87,
  2567.         CFuncLadder = 72,
  2568.         CTEFoundryHelpers = 166,
  2569.         CEnvDetailController = 51,
  2570.         CWorld = 237,
  2571.         CWaterLODControl = 196,
  2572.         CWaterBullet = 195,
  2573.         CVoteController = 194,
  2574.         CVGuiScreen = 193,
  2575.         CPropJeep = 116,
  2576.         CPropVehicleChoreoGeneric = 0,
  2577.         CTriggerSoundOperator = 192,
  2578.         CBaseVPhysicsTrigger = 22,
  2579.         CTriggerPlayerMovement = 191,
  2580.         CBaseTrigger = 20,
  2581.         CTest_ProxyToggle_Networkable = 188,
  2582.         CTesla = 183,
  2583.         CBaseTeamObjectiveResource = 17,
  2584.         CTeam = 138,
  2585.         CSunlightShadowControl = 137,
  2586.         CSun = 136,
  2587.         CParticlePerformanceMonitor = 97,
  2588.         CSpotlightEnd = 130,
  2589.         CSpatialEntity = 129,
  2590.         CSlideshowDisplay = 125,
  2591.         CShadowControl = 124,
  2592.         CSceneEntity = 123,
  2593.         CRopeKeyframe = 121,
  2594.         CRagdollManager = 118,
  2595.         CPhysicsPropMultiplayer = 102,
  2596.         CPhysBoxMultiplayer = 100,
  2597.         CPropDoorRotating = 115,
  2598.         CBasePropDoor = 16,
  2599.         CDynamicProp = 43,
  2600.         CProp_Hallucination = 114,
  2601.         CPostProcessController = 110,
  2602.         CPointCommentaryNode = 108,
  2603.         CPointCamera = 107,
  2604.         CPlayerResource = 106,
  2605.         CPlasma = 105,
  2606.         CPhysMagnet = 103,
  2607.         CPhysicsProp = 101,
  2608.         CStatueProp = 134,
  2609.         CPhysBox = 99,
  2610.         CParticleSystem = 98,
  2611.         CMovieDisplay = 95,
  2612.         CMaterialModifyControl = 92,
  2613.         CLightGlow = 91,
  2614.         CInfoOverlayAccessor = 88,
  2615.         CFuncTrackTrain = 79,
  2616.         CFuncSmokeVolume = 78,
  2617.         CFuncRotating = 77,
  2618.         CFuncReflectiveGlass = 76,
  2619.         CFuncOccluder = 75,
  2620.         CFuncMoveLinear = 74,
  2621.         CFuncMonitor = 73,
  2622.         CFunc_LOD = 68,
  2623.         CTEDust = 158,
  2624.         CFunc_Dust = 67,
  2625.         CFuncConveyor = 71,
  2626.         CFuncBrush = 70,
  2627.         CBreakableSurface = 28,
  2628.         CFuncAreaPortalWindow = 69,
  2629.         CFish = 63,
  2630.         CFireSmoke = 61,
  2631.         CEnvTonemapController = 58,
  2632.         CEnvScreenEffect = 56,
  2633.         CEnvScreenOverlay = 57,
  2634.         CEnvProjectedTexture = 54,
  2635.         CEnvParticleScript = 53,
  2636.         CFogController = 65,
  2637.         CEnvDOFController = 52,
  2638.         CCascadeLight = 30,
  2639.         CEnvAmbientLight = 50,
  2640.         CEntityParticleTrail = 49,
  2641.         CEntityFreezing = 48,
  2642.         CEntityFlame = 47,
  2643.         CEntityDissolve = 46,
  2644.         CDynamicLight = 42,
  2645.         CColorCorrectionVolume = 33,
  2646.         CColorCorrection = 32,
  2647.         CBreakableProp = 27,
  2648.         CBeamSpotlight = 25,
  2649.         CBaseButton = 5,
  2650.         CBaseToggle = 19,
  2651.         CBasePlayer = 15,
  2652.         CBaseFlex = 12,
  2653.         CBaseEntity = 11,
  2654.         CBaseDoor = 10,
  2655.         CBaseCombatCharacter = 6,
  2656.         CBaseAnimatingOverlay = 3,
  2657.         CBoneFollower = 26,
  2658.         CBaseAnimating = 2,
  2659.         CAI_BaseNPC = 0,
  2660.         CBeam = 24,
  2661.         CBaseViewModel = 21,
  2662.         CBaseParticleEntity = 14,
  2663.         CBaseGrenade = 13,
  2664.         CBaseCombatWeapon = 7,
  2665.         CBaseWeaponWorldModel = 23
  2666. };
  2667.  
  2668. enum class CSGOHitboxID
  2669. {
  2670.     Head = 0,
  2671.         Neck,
  2672.         NeckLower,
  2673.         Pelvis,
  2674.         Stomach,
  2675.         LowerChest,
  2676.         Chest,
  2677.         UpperChest,
  2678.         RightThigh,
  2679.         LeftThigh,
  2680.         RightShin,
  2681.         LeftShin,
  2682.         RightFoot,
  2683.         LeftFoot,
  2684.         RightHand,
  2685.         LeftHand,
  2686.         RightUpperArm,
  2687.         RightLowerArm,
  2688.         LeftUpperArm,
  2689.         LeftLowerArm
  2690. };
  2691.  
  2692. class ScriptCreatedItem
  2693. {
  2694.     public:
  2695.  
  2696.     CPNETVAR_FUNC(int*, ItemDefinitionIndex, 0xE67AB3B8); //m_iItemDefinitionIndex
  2697.  
  2698.     CPNETVAR_FUNC(int*, ItemIDHigh, 0x714778A); //m_iItemIDHigh
  2699.  
  2700.     CPNETVAR_FUNC(int*, ItemIDLow, 0x3A3DFC74); //m_iItemIDLow
  2701. };
  2702.  
  2703. class AttributeContainer
  2704. {
  2705.     public:
  2706.  
  2707.     CPNETVAR_FUNC(ScriptCreatedItem*, m_Item, 0x7E029CE5);
  2708. };
  2709.  
  2710.  
  2711. class CBaseCombatWeapon
  2712. {
  2713.     public:
  2714.  
  2715.     CNETVAR_FUNC(float, GetNextPrimaryAttack, 0xDB7B106E); //m_flNextPrimaryAttack
  2716.  
  2717.     CNETVAR_FUNC(int, GetAmmoInClip, 0x97B6F70C); //m_iClip1
  2718.  
  2719.     CNETVAR_FUNC(HANDLE, GetOwnerHandle, 0xC32DF98D); //m_hOwner
  2720.  
  2721.     CNETVAR_FUNC(Vector, GetOrigin, 0x1231CE10); //m_vecOrigin
  2722.  
  2723.  
  2724.     CPNETVAR_FUNC(int*, FallbackPaintKit, 0xADE4C870); // m_nFallbackPaintKit
  2725.  
  2726.     CPNETVAR_FUNC(int*, FallbackSeed, 0xC2D0683D); // m_nFallbackSeed
  2727.  
  2728.     CPNETVAR_FUNC(float*, FallbackWear, 0xA263576C); //m_flFallbackWear
  2729.  
  2730.     CPNETVAR_FUNC(int*, FallbackStatTrak, 0x1ED78768); //m_nFallbackStatTrak
  2731.  
  2732.     CPNETVAR_FUNC(int*, OwnerXuidLow, 0xAD8D897F);
  2733.  
  2734.     CPNETVAR_FUNC(int*, OwnerXuidHigh, 0x90511E77);
  2735.  
  2736.     CPNETVAR_FUNC(int*, ViewModelIndex, 0x7F7C89C1);
  2737.  
  2738.     CPNETVAR_FUNC(int*, WorldModelIndex, 0x4D8AD9F3);
  2739.  
  2740.  
  2741.     CPNETVAR_FUNC(AttributeContainer*, m_AttributeManager, 0xCFFCE089);
  2742.  
  2743.     float GetInaccuracy()
  2744.     {
  2745.         typedef float(__thiscall * oGetSpread)(PVOID);
  2746.         return call_vfunc<oGetSpread>(this, Offsets::VMT::Weapon_GetSpread)(this);
  2747.     }
  2748.  
  2749.     float GetSpread()
  2750.     {
  2751.         typedef float(__thiscall * oGetInac)(PVOID);
  2752.         return call_vfunc<oGetInac>(this, Offsets::VMT::Weapon_GetSpread + 1)(this);
  2753.     }
  2754.  
  2755.     void UpdateAccuracyPenalty()
  2756.     {
  2757.         typedef void(__thiscall * oUpdateAccuracyPenalty)(PVOID);
  2758.         return call_vfunc<oUpdateAccuracyPenalty>(this, Offsets::VMT::Weapon_GetSpread + 2)(this);
  2759.     }
  2760.  
  2761.     CSWeaponInfo* GetCSWpnData()
  2762.     {
  2763.         static DWORD GetCSWpnDataAddr = Utilities::Memory::FindPattern("client.dll", (PBYTE)"\x55\x8B\xEC\x81\xEC\x00\x00\x00\x00\xB8\x00\x00\x00\x00\x57", "xxxxx????x????x");
  2764.         if (GetCSWpnDataAddr)
  2765.         {
  2766.             CSWeaponInfo* retData;
  2767.             __asm
  2768.  
  2769.             {
  2770.                 mov ecx, this
  2771.  
  2772.                     call GetCSWpnDataAddr
  2773.  
  2774.                     mov retData, eax
  2775.  
  2776.             }
  2777.             return retData;
  2778.         }
  2779.         else
  2780.         {
  2781.             return nullptr;
  2782.         }
  2783.     }
  2784. };
  2785.  
  2786. class CCSBomb
  2787. {
  2788.     public:
  2789.  
  2790.     CNETVAR_FUNC(HANDLE, GetOwnerHandle, 0xC32DF98D); //m_hOwner
  2791.  
  2792.     CNETVAR_FUNC(float, GetC4BlowTime, 0xB5E0CA1C); //m_flC4Blow
  2793.  
  2794.     CNETVAR_FUNC(float, GetC4DefuseCountDown, 0xB959B4A6); //m_flDefuseCountDown
  2795. };
  2796.  
  2797. class CLocalPlayerExclusive
  2798. {
  2799.     public:
  2800.  
  2801.     CNETVAR_FUNC(Vector, GetViewPunchAngle, 0x68F014C0);//m_viewPunchAngle
  2802.  
  2803.     CNETVAR_FUNC(Vector, GetAimPunchAngle, 0xBF25C290);//m_aimPunchAngle
  2804.  
  2805.     CNETVAR_FUNC(Vector, GetAimPunchAngleVel, 0x8425E045);//m_aimPunchAngleVel
  2806. };
  2807.  
  2808. class CollisionProperty
  2809. {
  2810.     public:
  2811.  
  2812.     CNETVAR_FUNC(Vector, GetMins, 0xF6F78BAB);//m_vecMins
  2813.  
  2814.     CNETVAR_FUNC(Vector, GetMaxs, 0xE47C6FC4);//m_vecMaxs
  2815.  
  2816.     CNETVAR_FUNC(unsigned char, GetSolidType, 0xB86722A1);//m_nSolidType
  2817.  
  2818.     CNETVAR_FUNC(unsigned short, GetSolidFlags, 0x63BB24C1);//m_usSolidFlags
  2819.  
  2820.     CNETVAR_FUNC(int, GetSurroundsType, 0xB677A0BB); //m_nSurroundType
  2821.  
  2822.     bool IsSolid()
  2823.     {
  2824.         return (GetSolidType() != SOLID_NONE) && ((GetSolidFlags() & FSOLID_NOT_SOLID) == 0);
  2825.     }
  2826. };
  2827.  
  2828. class IClientRenderable
  2829. {
  2830.     public:
  2831.         //virtual void*                                 GetIClientUnknown() = 0;
  2832.         virtual Vector const&                   GetRenderOrigin(void) = 0;
  2833.         virtual Vector const&                   GetRenderAngles(void) = 0;
  2834.         virtual bool ShouldDraw(void) = 0;
  2835.         virtual bool IsTransparent(void) = 0;
  2836.         virtual bool UsesPowerOfTwoFrameBufferTexture() = 0;
  2837.         virtual bool UsesFullFrameBufferTexture() = 0;
  2838.         virtual void GetShadowHandle() const = 0;
  2839.     virtual void* RenderHandle() = 0;
  2840.         virtual const model_t* GetModel() const = 0;
  2841.     virtual int DrawModel(int flags) = 0;
  2842.         virtual int GetBody() = 0;
  2843.         virtual void ComputeFxBlend() = 0;
  2844.  
  2845.         bool SetupBones(matrix3x4* pBoneToWorldOut, int nMaxBones, int boneMask, float currentTime)
  2846.     {
  2847.         typedef bool(__thiscall * oSetupBones)(PVOID, matrix3x4 *, int, int, float);
  2848.         return call_vfunc<oSetupBones>(this, 13)(this, pBoneToWorldOut, nMaxBones, boneMask, currentTime);
  2849.     }
  2850. };
  2851.  
  2852. class IClientNetworkable
  2853. {
  2854.     public:
  2855.         virtual IClientUnknown* GetIClientUnknown() = 0;
  2856.         virtual void Release() = 0;
  2857.         virtual ClientClass* GetClientClass() = 0;// FOR NETVARS FIND YOURSELF ClientClass* stuffs
  2858.         virtual void NotifyShouldTransmit( /* ShouldTransmitState_t state*/) = 0;
  2859.         virtual void OnPreDataChanged( /*DataUpdateType_t updateType*/) = 0;
  2860.         virtual void OnDataChanged( /*DataUpdateType_t updateType*/) = 0;
  2861.         virtual void PreDataUpdate( /*DataUpdateType_t updateType*/) = 0;
  2862.         virtual void PostDataUpdate( /*DataUpdateType_t updateType*/) = 0;
  2863.         virtual void unknown();
  2864.     virtual bool IsDormant(void) = 0;
  2865.         virtual int GetIndex(void) const = 0;
  2866.     virtual void ReceiveMessage(int classID /*, bf_read &msg*/) = 0;
  2867.         virtual void* GetDataTableBasePtr() = 0;
  2868.         virtual void SetDestroyedOnRecreateEntities(void) = 0;
  2869. };
  2870.  
  2871. class IClientUnknown
  2872. {
  2873.     public:
  2874.         virtual void* GetCollideable() = 0;
  2875.         virtual IClientNetworkable* GetClientNetworkable() = 0;
  2876.         virtual IClientRenderable* GetClientRenderable() = 0;
  2877.         virtual IClientEntity* GetIClientEntity() = 0;
  2878.         virtual IClientEntity* GetBaseEntity() = 0;
  2879.         virtual IClientThinkable* GetClientThinkable() = 0;
  2880. };
  2881.  
  2882. class IClientThinkable
  2883. {
  2884.     public:
  2885.         virtual IClientUnknown* GetIClientUnknown() = 0;
  2886.         virtual void ClientThink() = 0;
  2887.         virtual void* GetThinkHandle() = 0;
  2888.         virtual void SetThinkHandle(void* hThink) = 0;
  2889.         virtual void Release() = 0;
  2890. };
  2891.  
  2892. class __declspec (novtable)IClientEntity : public IClientUnknown, public IClientRenderable, public IClientNetworkable, public IClientThinkable
  2893. {
  2894. public:
  2895. public:
  2896.         virtual void Release(void) = 0;
  2897.         virtual void blahblahpad(void) = 0;
  2898.         virtual Vector& GetAbsOrigin(void) const = 0;//in broken place use GetOrigin Below
  2899. virtual const Vector&   GetAbsAngles(void) const = 0;
  2900.  
  2901.     //---                 NetVars                  ---//
  2902.  
  2903.     CPNETVAR_FUNC(CLocalPlayerExclusive*, localPlayerExclusive, 0x7177BC3E);// m_Local
  2904.  
  2905.     CPNETVAR_FUNC(CollisionProperty*, collisionProperty, 0xE477CBD0);//m_Collision
  2906.  
  2907.  
  2908.     CNETVAR_FUNC(int, GetFlags, 0xE456D580); //m_fFlags
  2909.  
  2910.     CNETVAR_FUNC(Vector, GetOrigin, 0x1231CE10); //m_vecOrigin
  2911.  
  2912.     CNETVAR_FUNC(Vector, GetRotation, 0x6BEA197A); //m_angRotation
  2913.  
  2914.     CNETVAR_FUNC(int, GetTeamNum, 0xC08B6C6E); //m_iTeamNum
  2915.  
  2916.     CNETVAR_FUNC(int, GetMaxHealth, 0xC52E1C28); //m_iMaxHealth
  2917.  
  2918.     CNETVAR_FUNC(int, GetHealth, 0xA93054E3); //m_iHealth
  2919.  
  2920.     CNETVAR_FUNC(unsigned char, GetLifeState, 0xD795CCFC); //m_lifeState
  2921.  
  2922.     CNETVAR_FUNC(HANDLE, GetActiveWeaponHandle, 0xB4FECDA3); //m_hActiveWeapon
  2923.  
  2924.     CNETVAR_FUNC(int, GetTickBase, 0xD472B079); //m_nTickBase
  2925.  
  2926.     CNETVAR_FUNC(Vector, GetViewOffset, 0xA9F74931); //m_vecViewOffset[0]
  2927.  
  2928.     CNETVAR_FUNC(Vector, GetVelocity, 0x40C1CA24); //m_vecVelocity[0]
  2929.  
  2930.     CNETVAR_FUNC(bool, HasGunGameImmunity, 0x6AD6FA0D); //m_bGunGameImmunity
  2931.  
  2932.     CNETVAR_FUNC(bool, IsDefusing, 0xA2C14106); //m_bIsDefusing
  2933.  
  2934.     CNETVAR_FUNC(int, ArmorValue, 0x3898634); //m_ArmorValue
  2935.  
  2936.     CNETVAR_FUNC(bool, HasHelmet, 0x7B97F18A); //m_bHasHelmet
  2937.  
  2938.     CNETVAR_FUNC(bool, IsScoped, 0x61B9C22C); //m_bIsScoped
  2939.  
  2940.     CNETVAR_FUNC(int, GetMoney, 0xF4B3E183); //m_iAccount
  2941.  
  2942.     CNETVAR_FUNC(HANDLE, GetObserverTargetHandle, 0x8660FD83); //m_hObserverTarget
  2943.                                                                // ----------------------------------------------//
  2944.  
  2945. bool IsAlive()
  2946. {
  2947.     return (GetLifeState() == LIFE_ALIVE && GetHealth() > 0);
  2948. }
  2949.  
  2950. Vector GetBonePos(int i)
  2951. {
  2952.     matrix3x4 boneMatrix[128];
  2953.     if (this->SetupBones(boneMatrix, 128, BONE_USED_BY_HITBOX, GetTickCount64()))
  2954.     {
  2955.         return Vector(boneMatrix[i][0][3], boneMatrix[i][1][3], boneMatrix[i][2][3]);
  2956.     }
  2957.     return Vector(0, 0, 0);
  2958. }
  2959.  
  2960. Vector GetHeadPos()
  2961. {
  2962.     return this->GetBonePos(6);
  2963. }
  2964.  
  2965. };/*
  2966. Syn's AYYWAREFramework 2015
  2967. */
  2968.  
  2969. #include "ESP.h"
  2970. #include "Interfaces.h"
  2971. #include "RenderManager.h"
  2972.  
  2973. void CEsp::Init()
  2974. {
  2975.     BombCarrier = nullptr;
  2976. }
  2977.  
  2978. // Yeah dude we're defo gunna do some sick moves for the esp yeah
  2979. void CEsp::Move(CUserCmd* pCmd) { }
  2980.  
  2981. // Main ESP Drawing loop
  2982. void CEsp::Draw()
  2983. {
  2984.     IClientEntity* pLocal = hackManager.pLocal();
  2985.  
  2986.     // Loop through all active entitys
  2987.     for (int i = 0; i < Interfaces::EntList->GetHighestEntityIndex(); i++)
  2988.     {
  2989.         // Get the entity
  2990.         IClientEntity* pEntity = Interfaces::EntList->GetClientEntity(i);
  2991.         player_info_t pinfo;
  2992.  
  2993.         // The entity isn't some laggy peice of shit or something
  2994.         if (pEntity && pEntity != pLocal && !pEntity->IsDormant())
  2995.         {
  2996.             // Is it a player?!
  2997.             if (Menu::Window.VisualsTab.FiltersPlayers.GetState() && Interfaces::Engine->GetPlayerInfo(i, &pinfo) && pEntity->IsAlive())
  2998.             {
  2999.                 DrawPlayer(pEntity, pinfo);
  3000.             }
  3001.  
  3002.             // ~ Other ESP's here (items and shit) ~ //
  3003.             ClientClass* cClass = (ClientClass*)pEntity->GetClientClass();
  3004.  
  3005.             // Dropped weapons
  3006.             if (Menu::Window.VisualsTab.FiltersWeapons.GetState() && cClass->m_ClassID != (int)CSGOClassID::CBaseWeaponWorldModel && ((strstr(cClass->m_pNetworkName, "Weapon") || cClass->m_ClassID == (int)CSGOClassID::CDEagle || cClass->m_ClassID == (int)CSGOClassID::CAK47)))
  3007.             {
  3008.                 DrawDrop(pEntity, cClass);
  3009.             }
  3010.  
  3011.             // If entity is the bomb
  3012.             if (Menu::Window.VisualsTab.FiltersC4.GetState())
  3013.             {
  3014.                 if (cClass->m_ClassID == (int)CSGOClassID::CPlantedC4)
  3015.                     DrawBombPlanted(pEntity, cClass);
  3016.  
  3017.                 if (cClass->m_ClassID == (int)CSGOClassID::CC4)
  3018.                     DrawBomb(pEntity, cClass);
  3019.             }
  3020.  
  3021.             // If entity is a chicken
  3022.             if (Menu::Window.VisualsTab.FiltersChickens.GetState())
  3023.             {
  3024.                 if (cClass->m_ClassID == (int)CSGOClassID::CChicken)
  3025.                     DrawChicken(pEntity, cClass);
  3026.             }
  3027.         }
  3028.     }
  3029. }
  3030.  
  3031. //  Yeah m8
  3032. void CEsp::DrawPlayer(IClientEntity* pEntity, player_info_t pinfo)
  3033. {
  3034.     ESPBox Box;
  3035.     Color Color;
  3036.  
  3037.     // Show own team false? well gtfo teammate
  3038.     if (Menu::Window.VisualsTab.FiltersEnemiesOnly.GetState() && (pEntity->GetTeamNum() == hackManager.pLocal()->GetTeamNum()))
  3039.         return;
  3040.  
  3041.     if (GetBox(pEntity, Box))
  3042.     {
  3043.         Color = GetPlayerColor(pEntity);
  3044.  
  3045.         if (Menu::Window.VisualsTab.OptionsBox.GetState())
  3046.             DrawBox(Box, Color);
  3047.  
  3048.         if (Menu::Window.VisualsTab.OptionsName.GetState())
  3049.             DrawName(pinfo, Box);
  3050.  
  3051.         if (Menu::Window.VisualsTab.OptionsHealth.GetState())
  3052.             DrawHealth(pEntity, Box);
  3053.  
  3054.         if (Menu::Window.VisualsTab.OptionsInfo.GetState() || Menu::Window.VisualsTab.OptionsWeapon.GetState())
  3055.             DrawInfo(pEntity, Box);
  3056.  
  3057.         if (Menu::Window.VisualsTab.OptionsAimSpot.GetState())
  3058.             DrawCross(pEntity);
  3059.  
  3060.         if (Menu::Window.VisualsTab.OptionsSkeleton.GetState())
  3061.             DrawSkeleton(pEntity);
  3062.     }
  3063. }
  3064.  
  3065. // Gets the 2D bounding box for the entity
  3066. // Returns false on failure nigga don't fail me
  3067. bool CEsp::GetBox(IClientEntity* pEntity, CEsp::ESPBox &result)
  3068. {
  3069.     // Variables
  3070.     Vector vOrigin, min, max, sMin, sMax, sOrigin,
  3071.         flb, brt, blb, frt, frb, brb, blt, flt;
  3072.     float left, top, right, bottom;
  3073.  
  3074.     // Get the locations
  3075.     vOrigin = pEntity->GetOrigin();
  3076.     min = pEntity->collisionProperty()->GetMins() + vOrigin;
  3077.     max = pEntity->collisionProperty()->GetMaxs() + vOrigin;
  3078.  
  3079.     // Points of a 3d bounding box
  3080.     Vector points[] = { Vector(min.x, min.y, min.z),
  3081.         Vector(min.x, max.y, min.z),
  3082.         Vector(max.x, max.y, min.z),
  3083.         Vector(max.x, min.y, min.z),
  3084.         Vector(max.x, max.y, max.z),
  3085.         Vector(min.x, max.y, max.z),
  3086.         Vector(min.x, min.y, max.z),
  3087.         Vector(max.x, min.y, max.z) };
  3088.  
  3089.     // Get screen positions
  3090.     if (!Render::WorldToScreen(points[3], flb) || !Render::WorldToScreen(points[5], brt)
  3091.         || !Render::WorldToScreen(points[0], blb) || !Render::WorldToScreen(points[4], frt)
  3092.         || !Render::WorldToScreen(points[2], frb) || !Render::WorldToScreen(points[1], brb)
  3093.         || !Render::WorldToScreen(points[6], blt) || !Render::WorldToScreen(points[7], flt))
  3094.         return false;
  3095.  
  3096.     // Put them in an array (maybe start them off in one later for speed?)
  3097.     Vector arr[] = { flb, brt, blb, frt, frb, brb, blt, flt };
  3098.  
  3099.     // Init this shit
  3100.     left = flb.x;
  3101.     top = flb.y;
  3102.     right = flb.x;
  3103.     bottom = flb.y;
  3104.  
  3105.     // Find the bounding corners for our box
  3106.     for (int i = 1; i < 8; i++)
  3107.     {
  3108.         if (left > arr[i].x)
  3109.             left = arr[i].x;
  3110.         if (bottom < arr[i].y)
  3111.             bottom = arr[i].y;
  3112.         if (right < arr[i].x)
  3113.             right = arr[i].x;
  3114.         if (top > arr[i].y)
  3115.             top = arr[i].y;
  3116.     }
  3117.  
  3118.     // Width / height
  3119.     result.x = left;
  3120.     result.y = top;
  3121.     result.w = right - left;
  3122.     result.h = bottom - top;
  3123.  
  3124.     return true;
  3125. }
  3126.  
  3127. // Get an entities color depending on team and vis ect
  3128. Color CEsp::GetPlayerColor(IClientEntity* pEntity)
  3129. {
  3130.     int TeamNum = pEntity->GetTeamNum();
  3131.     bool IsVis = GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::Head);
  3132.  
  3133.     Color color;
  3134.  
  3135.     if (TeamNum == TEAM_CS_T)
  3136.     {
  3137.         if (IsVis)
  3138.             color = Color(235, 200, 0, 255);
  3139.         else
  3140.             color = Color(235, 50, 0, 255);
  3141.     }
  3142.     else
  3143.     {
  3144.         if (IsVis)
  3145.             color = Color(120, 210, 26, 255);
  3146.         else
  3147.             color = Color(15, 110, 220, 255);
  3148.     }
  3149.  
  3150.  
  3151.     return color;
  3152. }
  3153.  
  3154. // 2D  Esp box
  3155. void CEsp::DrawBox(CEsp::ESPBox size, Color color)
  3156. {
  3157.     //if (PlayerBoxes->GetStringIndex() == 1)
  3158.     //{
  3159.     //  // Full Box
  3160.     //  renderMan->Outline(size.x, size.y, size.w, size.h, color);
  3161.     //  renderMan->Outline(size.x - 1, size.y - 1, size.w + 2, size.h + 2, COLORCODE(10, 10, 10, 150));
  3162.     //  renderMan->Outline(size.x + 1, size.y + 1, size.w - 2, size.h - 2, COLORCODE(10, 10, 10, 150));
  3163.     //}
  3164.     //else
  3165.     //{
  3166.     // Corner Box
  3167.     int VertLine = (((float)size.w) * (0.20f));
  3168.     int HorzLine = (((float)size.h) * (0.20f));
  3169.  
  3170.     Render::Clear(size.x, size.y - 1, VertLine, 1, Color(10, 10, 10, 150));
  3171.     Render::Clear(size.x + size.w - VertLine, size.y - 1, VertLine, 1, Color(10, 10, 10, 150));
  3172.     Render::Clear(size.x, size.y + size.h - 1, VertLine, 1, Color(10, 10, 10, 150));
  3173.     Render::Clear(size.x + size.w - VertLine, size.y + size.h - 1, VertLine, 1, Color(10, 10, 10, 150));
  3174.  
  3175.     Render::Clear(size.x - 1, size.y, 1, HorzLine, Color(10, 10, 10, 150));
  3176.     Render::Clear(size.x - 1, size.y + size.h - HorzLine, 1, HorzLine, Color(10, 10, 10, 150));
  3177.     Render::Clear(size.x + size.w - 1, size.y, 1, HorzLine, Color(10, 10, 10, 150));
  3178.     Render::Clear(size.x + size.w - 1, size.y + size.h - HorzLine, 1, HorzLine, Color(10, 10, 10, 150));
  3179.  
  3180.     Render::Clear(size.x, size.y, VertLine, 1, color);
  3181.     Render::Clear(size.x + size.w - VertLine, size.y, VertLine, 1, color);
  3182.     Render::Clear(size.x, size.y + size.h, VertLine, 1, color);
  3183.     Render::Clear(size.x + size.w - VertLine, size.y + size.h, VertLine, 1, color);
  3184.  
  3185.     Render::Clear(size.x, size.y, 1, HorzLine, color);
  3186.     Render::Clear(size.x, size.y + size.h - HorzLine, 1, HorzLine, color);
  3187.     Render::Clear(size.x + size.w, size.y, 1, HorzLine, color);
  3188.     Render::Clear(size.x + size.w, size.y + size.h - HorzLine, 1, HorzLine, color);
  3189.     //}
  3190. }
  3191.  
  3192. // Unicode Conversions
  3193. static wchar_t* CharToWideChar(const char* text)
  3194. {
  3195.     size_t size = strlen(text) + 1;
  3196.     wchar_t* wa = new wchar_t[size];
  3197.     mbstowcs_s(NULL, wa, size / 4, text, size);
  3198.     return wa;
  3199. }
  3200.  
  3201. // Player name
  3202. void CEsp::DrawName(player_info_t pinfo, CEsp::ESPBox size)
  3203. {
  3204.     RECT nameSize = Render::GetTextSize(Render::Fonts::ESP, pinfo.name);
  3205.     Render::Text(size.x + (size.w / 2) - (nameSize.right / 2), size.y - 16,
  3206.         Color(255, 255, 255, 255), Render::Fonts::ESP, pinfo.name);
  3207. }
  3208.  
  3209. // Draw a health bar. For Tf2 when a bar is bigger than max health a second bar is displayed
  3210. void CEsp::DrawHealth(IClientEntity* pEntity, CEsp::ESPBox size)
  3211. {
  3212.     ESPBox HealthBar = size;
  3213.     HealthBar.y += (HealthBar.h + 6);
  3214.     HealthBar.h = 4;
  3215.  
  3216.     float HealthValue = pEntity->GetHealth();
  3217.     float HealthPerc = HealthValue / 100.f;
  3218.     float Width = (size.w * HealthPerc);
  3219.     HealthBar.w = Width;
  3220.  
  3221.     // --  Main Bar -- //
  3222.  
  3223.     Vertex_t Verts[4];
  3224.     Verts[0].Init(Vector2D(HealthBar.x, HealthBar.y));
  3225.     Verts[1].Init(Vector2D(HealthBar.x + size.w + 5, HealthBar.y));
  3226.     Verts[2].Init(Vector2D(HealthBar.x + size.w, HealthBar.y + 5));
  3227.     Verts[3].Init(Vector2D(HealthBar.x - 5, HealthBar.y + 5));
  3228.  
  3229.     Render::PolygonOutline(4, Verts, Color(10, 10, 10, 255), Color(255, 255, 255, 170));
  3230.  
  3231.     Vertex_t Verts2[4];
  3232.     Verts2[0].Init(Vector2D(HealthBar.x + 1, HealthBar.y + 1));
  3233.     Verts2[1].Init(Vector2D(HealthBar.x + HealthBar.w + 4, HealthBar.y + 1));
  3234.     Verts2[2].Init(Vector2D(HealthBar.x + HealthBar.w, HealthBar.y + 5));
  3235.     Verts2[3].Init(Vector2D(HealthBar.x - 4, HealthBar.y + 5));
  3236.  
  3237.     Color c = GetPlayerColor(pEntity);
  3238.     Render::Polygon(4, Verts2, c);
  3239.  
  3240.     Verts2[0].Init(Vector2D(HealthBar.x + 1, HealthBar.y + 1));
  3241.     Verts2[1].Init(Vector2D(HealthBar.x + HealthBar.w + 2, HealthBar.y + 1));
  3242.     Verts2[2].Init(Vector2D(HealthBar.x + HealthBar.w, HealthBar.y + 2));
  3243.     Verts2[3].Init(Vector2D(HealthBar.x - 2, HealthBar.y + 2));
  3244.  
  3245.     Render::Polygon(4, Verts2, Color(255, 255, 255, 40));
  3246.  
  3247. }
  3248.  
  3249. // Cleans the internal class name up to something human readable and nice
  3250. std::string CleanItemName(std::string name)
  3251. {
  3252.     std::string Name = name;
  3253.     // Tidy up the weapon Name
  3254.     if (Name[0] == 'C')
  3255.         Name.erase(Name.begin());
  3256.  
  3257.     // Remove the word Weapon
  3258.     auto startOfWeap = Name.find("Weapon");
  3259.     if (startOfWeap != std::string::npos)
  3260.                 Name.erase(Name.begin() + startOfWeap, Name.begin() + startOfWeap + 6);
  3261.  
  3262.     return Name;
  3263. }
  3264.  
  3265. // Anything else: weapons, class state? idk
  3266. void CEsp::DrawInfo(IClientEntity* pEntity, CEsp::ESPBox size)
  3267. {
  3268.     std::vector < std::string> Info;
  3269.  
  3270.     // Player Weapon ESP
  3271.     IClientEntity* pWeapon = Interfaces::EntList->GetClientEntityFromHandle((HANDLE)pEntity->GetActiveWeaponHandle());
  3272.     if (Menu::Window.VisualsTab.OptionsWeapon.GetState() && pWeapon)
  3273.     {
  3274.         ClientClass* cClass = (ClientClass*)pWeapon->GetClientClass();
  3275.         if (cClass)
  3276.         {
  3277.             // Draw it
  3278.             Info.push_back(CleanItemName(cClass->m_pNetworkName));
  3279.         }
  3280.     }
  3281.  
  3282.     // Bomb Carrier
  3283.     if (Menu::Window.VisualsTab.OptionsInfo.GetState() && pEntity == BombCarrier)
  3284.     {
  3285.         Info.push_back("Bomb Carrier");
  3286.     }
  3287.  
  3288.     // Comp Rank
  3289.     if (Menu::Window.VisualsTab.OptionsInfo.GetState())
  3290.     {
  3291.         int CompRank = GameUtils::GetPlayerCompRank(pEntity);
  3292.         static const char* Ranks[] =
  3293.         {
  3294.             "",
  3295.             "Silver I",
  3296.             "Silver II",
  3297.             "Silver III",
  3298.             "Silver IV",
  3299.             "Silver Elite",
  3300.             "Silver Elite Master",
  3301.  
  3302.             "Gold Nova I",
  3303.             "Gold Nova II",
  3304.             "Gold Nova III",
  3305.             "Gold Nova Master",
  3306.             "Master Guardian I",
  3307.             "Master Guardian II",
  3308.  
  3309.             "Master Guardian Elite",
  3310.             "Distinguished Master Guardian",
  3311.             "Legendary Eagle",
  3312.             "Legendary Eagle Master",
  3313.             "Supreme Master First Class",
  3314.             "Global Elite"
  3315.         };
  3316.         if (CompRank >= 0 && CompRank <= 18)
  3317.             Info.push_back(Ranks[CompRank]);
  3318.     }
  3319.  
  3320.     static RECT Size = Render::GetTextSize(Render::Fonts::Default, "Hi");
  3321.     int i = 0;
  3322.     for (auto Text : Info)
  3323.     {
  3324.         Render::Text(size.x + size.w + 3, size.y + (i * (Size.bottom + 2)), Color(255, 255, 255, 255), Render::Fonts::ESP, Text.c_str());
  3325.         i++;
  3326.     }
  3327.  
  3328. }
  3329.  
  3330. // Little cross on their heads
  3331. void CEsp::DrawCross(IClientEntity* pEntity)
  3332. {
  3333.     Vector cross = pEntity->GetHeadPos(), screen;
  3334.     static int Scale = 2;
  3335.     if (Render::WorldToScreen(cross, screen))
  3336.     {
  3337.         Render::Clear(screen.x - Scale, screen.y - (Scale * 2), (Scale * 2), (Scale * 4), Color(20, 20, 20, 160));
  3338.         Render::Clear(screen.x - (Scale * 2), screen.y - Scale, (Scale * 4), (Scale * 2), Color(20, 20, 20, 160));
  3339.         Render::Clear(screen.x - Scale - 1, screen.y - (Scale * 2) - 1, (Scale * 2) - 2, (Scale * 4) - 2, Color(250, 250, 250, 160));
  3340.         Render::Clear(screen.x - (Scale * 2) - 1, screen.y - Scale - 1, (Scale * 4) - 2, (Scale * 2) - 2, Color(250, 250, 250, 160));
  3341.     }
  3342. }
  3343.  
  3344. // Draws a dropped CS:GO Item
  3345. void CEsp::DrawDrop(IClientEntity* pEntity, ClientClass* cClass)
  3346. {
  3347.     Vector Box;
  3348.     CBaseCombatWeapon* Weapon = (CBaseCombatWeapon*)pEntity;
  3349.     IClientEntity* plr = Interfaces::EntList->GetClientEntityFromHandle((HANDLE)Weapon->GetOwnerHandle());
  3350.     if (!plr && Render::WorldToScreen(Weapon->GetOrigin(), Box))
  3351.     {
  3352.         if (Menu::Window.VisualsTab.OptionsBox.GetState())
  3353.         {
  3354.             Render::Outline(Box.x - 2, Box.y - 2, 4, 4, Color(255, 255, 255, 255));
  3355.             Render::Outline(Box.x - 3, Box.y - 3, 6, 6, Color(10, 10, 10, 150));
  3356.         }
  3357.  
  3358.         if (Menu::Window.VisualsTab.OptionsInfo.GetState())
  3359.         {
  3360.             std::string ItemName = CleanItemName(cClass->m_pNetworkName);
  3361.             RECT TextSize = Render::GetTextSize(Render::Fonts::ESP, ItemName.c_str());
  3362.             Render::Text(Box.x - (TextSize.right / 2), Box.y - 16, Color(255, 255, 255, 255), Render::Fonts::ESP, ItemName.c_str());
  3363.         }
  3364.     }
  3365. }
  3366.  
  3367. // Draws a chicken
  3368. void CEsp::DrawChicken(IClientEntity* pEntity, ClientClass* cClass)
  3369. {
  3370.     ESPBox Box;
  3371.  
  3372.     if (GetBox(pEntity, Box))
  3373.     {
  3374.         player_info_t pinfo; strcpy_s(pinfo.name, "Chicken");
  3375.         if (Menu::Window.VisualsTab.OptionsBox.GetState())
  3376.             DrawBox(Box, Color(255, 255, 255, 255));
  3377.  
  3378.         if (Menu::Window.VisualsTab.OptionsName.GetState())
  3379.             DrawName(pinfo, Box);
  3380.     }
  3381. }
  3382.  
  3383. // Draw the planted bomb and timer
  3384. void CEsp::DrawBombPlanted(IClientEntity* pEntity, ClientClass* cClass)
  3385. {
  3386.     // Null it out incase bomb has been dropped or planted
  3387.     BombCarrier = nullptr;
  3388.  
  3389.     Vector vOrig; Vector vScreen;
  3390.     vOrig = pEntity->GetOrigin();
  3391.     CCSBomb* Bomb = (CCSBomb*)pEntity;
  3392.  
  3393.     if (Render::WorldToScreen(vOrig, vScreen))
  3394.     {
  3395.         float flBlow = Bomb->GetC4BlowTime();
  3396.         float TimeRemaining = flBlow - (Interfaces::Globals->interval_per_tick * hackManager.pLocal()->GetTickBase());
  3397.         char buffer[64];
  3398.         sprintf_s(buffer, "Bomb: %.1f", TimeRemaining);
  3399.         Render::Text(vScreen.x, vScreen.y, Color(250, 42, 42, 255), Render::Fonts::ESP, buffer);
  3400.     }
  3401. }
  3402.  
  3403. // Draw the bomb if it's dropped, or store the player who's carrying
  3404. void CEsp::DrawBomb(IClientEntity* pEntity, ClientClass* cClass)
  3405. {
  3406.     // Null it out incase bomb has been dropped or planted
  3407.     BombCarrier = nullptr;
  3408.     CBaseCombatWeapon* BombWeapon = (CBaseCombatWeapon*)pEntity;
  3409.     Vector vOrig; Vector vScreen;
  3410.     vOrig = pEntity->GetOrigin();
  3411.     bool adopted = true;
  3412.     HANDLE parent = BombWeapon->GetOwnerHandle();
  3413.     if (parent || (vOrig.x == 0 && vOrig.y == 0 && vOrig.z == 0))
  3414.     {
  3415.         IClientEntity* pParentEnt = (Interfaces::EntList->GetClientEntityFromHandle(parent));
  3416.         if (pParentEnt && pParentEnt->IsAlive())
  3417.         {
  3418.             BombCarrier = pParentEnt;
  3419.             adopted = false;
  3420.         }
  3421.     }
  3422.  
  3423.     if (adopted)
  3424.     {
  3425.         if (Render::WorldToScreen(vOrig, vScreen))
  3426.         {
  3427.             Render::Text(vScreen.x, vScreen.y, Color(112, 230, 20, 255), Render::Fonts::ESP, "Bomb");
  3428.         }
  3429.     }
  3430. }
  3431.  
  3432. void DrawBoneArray(int* boneNumbers, int amount, IClientEntity* pEntity, Color color)
  3433. {
  3434.     Vector LastBoneScreen;
  3435.     for (int i = 0; i < amount; i++)
  3436.     {
  3437.         Vector Bone = pEntity->GetBonePos(boneNumbers[i]);
  3438.         Vector BoneScreen;
  3439.  
  3440.         if (Render::WorldToScreen(Bone, BoneScreen))
  3441.         {
  3442.             if (i > 0)
  3443.             {
  3444.                 Render::Line(LastBoneScreen.x, LastBoneScreen.y, BoneScreen.x, BoneScreen.y, color);
  3445.             }
  3446.         }
  3447.         LastBoneScreen = BoneScreen;
  3448.     }
  3449. }
  3450.  
  3451. void DrawBoneTest(IClientEntity* pEntity)
  3452. {
  3453.     for (int i = 0; i < 127; i++)
  3454.     {
  3455.         Vector BoneLoc = pEntity->GetBonePos(i);
  3456.         Vector BoneScreen;
  3457.         if (Render::WorldToScreen(BoneLoc, BoneScreen))
  3458.         {
  3459.             char buf[10];
  3460.             _itoa_s(i, buf, 10);
  3461.             Render::Text(BoneScreen.x, BoneScreen.y, Color(255, 255, 255, 180), Render::Fonts::ESP, buf);
  3462.         }
  3463.     }
  3464. }
  3465.  
  3466. void CEsp::DrawSkeleton(IClientEntity* pEntity)
  3467. {
  3468.     studiohdr_t* pStudioHdr = Interfaces::ModelInfo->GetStudiomodel(pEntity->GetModel());
  3469.  
  3470.     if (!pStudioHdr)
  3471.         return;
  3472.  
  3473.     Vector vParent, vChild, sParent, sChild;
  3474.  
  3475.     for (int j = 0; j < pStudioHdr->numbones; j++)
  3476.     {
  3477.         mstudiobone_t* pBone = pStudioHdr->GetBone(j);
  3478.  
  3479.         if (pBone && (pBone->flags & BONE_USED_BY_HITBOX) && (pBone->parent != -1))
  3480.         {
  3481.             vChild = pEntity->GetBonePos(j);
  3482.             vParent = pEntity->GetBonePos(pBone->parent);
  3483.  
  3484.             if (Render::WorldToScreen(vParent, sParent) && Render::WorldToScreen(vChild, sChild))
  3485.             {
  3486.                 Render::Line(sParent[0], sParent[1], sChild[0], sChild[1], Color(255, 255, 255, 255));
  3487.             }
  3488.         }
  3489.     }
  3490. }/*
  3491. Syn's AYYWAREFramework 2015
  3492. */
  3493.  
  3494. #pragma once
  3495.  
  3496. #include "Hacks.h"
  3497.  
  3498. class CEsp : public CHack
  3499. {
  3500. public:
  3501.         void Init();
  3502. void Draw();
  3503. void Move(CUserCmd* pCmd);
  3504. private:
  3505.  
  3506.         // Other shit
  3507.         IClientEntity* BombCarrier;
  3508.  
  3509. struct ESPBox
  3510. {
  3511.     int x, y, w, h;
  3512. };
  3513.  
  3514. // Draw a player
  3515. void DrawPlayer(IClientEntity* pEntity, player_info_t pinfo);
  3516.  
  3517. // Get player info
  3518. Color GetPlayerColor(IClientEntity* pEntity);
  3519. bool GetBox(IClientEntity* pEntity, ESPBox &result);
  3520.  
  3521. // Draw shit about player
  3522. void DrawBox(ESPBox size, Color color);
  3523. void DrawName(player_info_t pinfo, ESPBox size);
  3524. void DrawHealth(IClientEntity* pEntity, ESPBox size);
  3525. void DrawInfo(IClientEntity* pEntity, ESPBox size);
  3526. void DrawCross(IClientEntity* pEntity);
  3527. void DrawSkeleton(IClientEntity* pEntity);
  3528.  
  3529. void DrawChicken(IClientEntity* pEntity, ClientClass* cClass);
  3530. void DrawDrop(IClientEntity* pEntity, ClientClass* cClass);
  3531. void DrawBombPlanted(IClientEntity* pEntity, ClientClass* cClass);
  3532. void DrawBomb(IClientEntity* pEntity, ClientClass* cClass);
  3533. };
  3534.  
  3535.  
  3536.  
  3537. #include "GUI.h"
  3538.  
  3539. #include "RenderManager.h"
  3540.  
  3541. #include <algorithm>
  3542. #include "tinyxml2.h"
  3543. #include "Controls.h"
  3544.  
  3545. CGUI GUI;
  3546.  
  3547. CGUI::CGUI()
  3548. {
  3549.  
  3550. }
  3551.  
  3552. // Draws all windows
  3553. void CGUI::Draw()
  3554. {
  3555.     bool ShouldDrawCursor = false;
  3556.  
  3557.     for (auto window : Windows)
  3558.     {
  3559.         if (window->m_bIsOpen)
  3560.         {
  3561.             ShouldDrawCursor = true;
  3562.             DrawWindow(window);
  3563.         }
  3564.  
  3565.     }
  3566.  
  3567.     if (ShouldDrawCursor)
  3568.     {
  3569.         static Vertex_t MouseVt[3];
  3570.  
  3571.         MouseVt[0].Init(Vector2D(Mouse.x, Mouse.y));
  3572.         MouseVt[1].Init(Vector2D(Mouse.x + 16, Mouse.y));
  3573.         MouseVt[2].Init(Vector2D(Mouse.x, Mouse.y + 16));
  3574.  
  3575.         Render::PolygonOutline(3, MouseVt, Color(255, 0, 0, 230), Color(0, 0, 0, 240));
  3576.     }
  3577. }
  3578.  
  3579. // Handle all input etc
  3580. void CGUI::Update()
  3581. {
  3582.     //Key Array
  3583.     std::copy(keys, keys + 255, oldKeys);
  3584.     for (int x = 0; x < 255; x++)
  3585.     {
  3586.         //oldKeys[x] = oldKeys[x] & keys[x];
  3587.         keys[x] = (GetAsyncKeyState(x));
  3588.     }
  3589.  
  3590.     // Mouse Location
  3591.     POINT mp; GetCursorPos(&mp);
  3592.     Mouse.x = mp.x; Mouse.y = mp.y;
  3593.  
  3594.     RECT Screen = Render::GetViewport();
  3595.  
  3596.     // Window Binds
  3597.     for (auto & bind : WindowBinds)
  3598.     {
  3599.         if (GetKeyPress(bind.first))
  3600.         {
  3601.             bind.second->Toggle();
  3602.         }
  3603.     }
  3604.  
  3605.     // Stop dragging
  3606.     if (IsDraggingWindow && !GetKeyState(VK_LBUTTON))
  3607.     {
  3608.         IsDraggingWindow = false;
  3609.         DraggingWindow = nullptr;
  3610.     }
  3611.  
  3612.     // If we are in the proccess of dragging a window
  3613.     if (IsDraggingWindow && GetKeyState(VK_LBUTTON) && !GetKeyPress(VK_LBUTTON))
  3614.     {
  3615.         if (DraggingWindow)
  3616.         {
  3617.             DraggingWindow->m_x = Mouse.x - DragOffsetX;
  3618.             DraggingWindow->m_y = Mouse.y - DragOffsetY;
  3619.         }
  3620.     }
  3621.  
  3622.     // Process some windows
  3623.     for (auto window : Windows)
  3624.     {
  3625.         if (window->m_bIsOpen)
  3626.         {
  3627.             // Used to tell the widget processing that there could be a click
  3628.             bool bCheckWidgetClicks = false;
  3629.  
  3630.             // If the user clicks inside the window
  3631.             if (GetKeyPress(VK_LBUTTON))
  3632.             {
  3633.                 if (IsMouseInRegion(window->m_x, window->m_y, window->m_x + window->m_iWidth, window->m_y + window->m_iHeight))
  3634.                 {
  3635.                     // Is it inside the client area?
  3636.                     if (IsMouseInRegion(window->GetClientArea()))
  3637.                     {
  3638.                         // User is selecting a new tab
  3639.                         if (IsMouseInRegion(window->GetTabArea()))
  3640.                         {
  3641.                             // Loose focus on the control
  3642.                             window->IsFocusingControl = false;
  3643.                             window->FocusedControl = nullptr;
  3644.  
  3645.                             int iTab = 0;
  3646.                             int TabCount = window->Tabs.size();
  3647.                             if (TabCount) // If there are some tabs
  3648.                             {
  3649.                                 int TabSize = (window->m_iWidth - 4 - 12) / TabCount;
  3650.                                 int Dist = Mouse.x - (window->m_x + 8);
  3651.                                 while (Dist > TabSize)
  3652.                                 {
  3653.                                     if (Dist > TabSize)
  3654.                                     {
  3655.                                         iTab++;
  3656.                                         Dist -= TabSize;
  3657.                                     }
  3658.                                 }
  3659.                                 window->SelectedTab = window->Tabs[iTab];
  3660.                             }
  3661.  
  3662.                         }
  3663.                         else
  3664.                             bCheckWidgetClicks = true;
  3665.                     }
  3666.                     else
  3667.                     {
  3668.                         // Must be in the around the title or side of the window
  3669.                         // So we assume the user is trying to drag the window
  3670.                         IsDraggingWindow = true;
  3671.                         DraggingWindow = window;
  3672.                         DragOffsetX = Mouse.x - window->m_x;
  3673.                         DragOffsetY = Mouse.y - window->m_y;
  3674.  
  3675.                         // Loose focus on the control
  3676.                         window->IsFocusingControl = false;
  3677.                         window->FocusedControl = nullptr;
  3678.                     }
  3679.                 }
  3680.                 else
  3681.                 {
  3682.                     // Loose focus on the control
  3683.                     window->IsFocusingControl = false;
  3684.                     window->FocusedControl = nullptr;
  3685.                 }
  3686.             }
  3687.  
  3688.  
  3689.             // Controls
  3690.             if (window->SelectedTab != nullptr)
  3691.             {
  3692.                 // Focused widget
  3693.                 bool SkipWidget = false;
  3694.                 CControl* SkipMe = nullptr;
  3695.  
  3696.                 // this window is focusing on a widget??
  3697.                 if (window->IsFocusingControl)
  3698.                 {
  3699.                     if (window->FocusedControl != nullptr)
  3700.                     {
  3701.                         // We've processed it once, skip it later
  3702.                         SkipWidget = true;
  3703.                         SkipMe = window->FocusedControl;
  3704.  
  3705.                         POINT cAbs = window->FocusedControl->GetAbsolutePos();
  3706.                         RECT controlRect = { cAbs.x, cAbs.y, window->FocusedControl->m_iWidth, window->FocusedControl->m_iHeight };
  3707.                         window->FocusedControl->OnUpdate();
  3708.  
  3709.                         if (window->FocusedControl->Flag(UIFlags::UI_Clickable) && IsMouseInRegion(controlRect) && bCheckWidgetClicks)
  3710.                         {
  3711.                             window->FocusedControl->OnClick();
  3712.  
  3713.                             // If it gets clicked we loose focus
  3714.                             window->IsFocusingControl = false;
  3715.                             window->FocusedControl = nullptr;
  3716.                             bCheckWidgetClicks = false;
  3717.                         }
  3718.                     }
  3719.                 }
  3720.  
  3721.                 // Itterate over the rest of the control
  3722.                 for (auto control : window->SelectedTab->Controls)
  3723.                 {
  3724.                     if (control != nullptr)
  3725.                     {
  3726.                         if (SkipWidget && SkipMe == control)
  3727.                             continue;
  3728.  
  3729.                         POINT cAbs = control->GetAbsolutePos();
  3730.                         RECT controlRect = { cAbs.x, cAbs.y, control->m_iWidth, control->m_iHeight };
  3731.                         control->OnUpdate();
  3732.  
  3733.                         if (control->Flag(UIFlags::UI_Clickable) && IsMouseInRegion(controlRect) && bCheckWidgetClicks)
  3734.                         {
  3735.                             control->OnClick();
  3736.                             bCheckWidgetClicks = false;
  3737.  
  3738.                             // Change of focus
  3739.                             if (control->Flag(UIFlags::UI_Focusable))
  3740.                             {
  3741.                                 window->IsFocusingControl = true;
  3742.                                 window->FocusedControl = control;
  3743.                             }
  3744.                             else
  3745.                             {
  3746.                                 window->IsFocusingControl = false;
  3747.                                 window->FocusedControl = nullptr;
  3748.                             }
  3749.  
  3750.                         }
  3751.                     }
  3752.                 }
  3753.  
  3754.                 // We must have clicked whitespace
  3755.                 if (bCheckWidgetClicks)
  3756.                 {
  3757.                     // Loose focus on the control
  3758.                     window->IsFocusingControl = false;
  3759.                     window->FocusedControl = nullptr;
  3760.                 }
  3761.             }
  3762.         }
  3763.     }
  3764. }
  3765.  
  3766. // Returns
  3767. bool CGUI::GetKeyPress(unsigned int key)
  3768. {
  3769.     if (keys[key] == true && oldKeys[key] == false)
  3770.         return true;
  3771.     else
  3772.         return false;
  3773. }
  3774.  
  3775. bool CGUI::GetKeyState(unsigned int key)
  3776. {
  3777.     return keys[key];
  3778. }
  3779.  
  3780. bool CGUI::IsMouseInRegion(int x, int y, int x2, int y2)
  3781. {
  3782.     if (Mouse.x > x && Mouse.y > y && Mouse.x < x2 && Mouse.y < y2)
  3783.         return true;
  3784.     else
  3785.         return false;
  3786. }
  3787.  
  3788. bool CGUI::IsMouseInRegion(RECT region)
  3789. {
  3790.     return IsMouseInRegion(region.left, region.top, region.left + region.right, region.top + region.bottom);
  3791. }
  3792.  
  3793. POINT CGUI::GetMouse()
  3794. {
  3795.     return Mouse;
  3796. }
  3797.  
  3798. bool CGUI::DrawWindow(CWindow* window)
  3799. {
  3800.     // Main Window
  3801.     Render::Outline(window->m_x, window->m_y, window->m_iWidth, window->m_iHeight, Color(20, 20, 20, 80));
  3802.     Render::GradientV(window->m_x + 2, window->m_y + 2, window->m_iWidth - 4, 26, Color(0, 0, 0, 255), Color(0, 0, 0, 255));
  3803.     Render::Clear(window->m_x + 2, window->m_y + 2 + 26, window->m_iWidth - 4, window->m_iHeight - 4 - 26, Color(0, 0, 0, 255));
  3804.     Render::Outline(window->m_x + 1, window->m_y + 1, window->m_iWidth - 2, window->m_iHeight - 2, Color(255, 0, 0, 255));
  3805.     Render::Text(window->m_x + 8, window->m_y + 8, Color(255, 255, 255, 255), Render::Fonts::MenuBold, window->Title.c_str());
  3806.  
  3807.     //Inner
  3808.     Render::Outline(window->m_x + 7, window->m_y + 1 + 26, window->m_iWidth - 4 - 10, window->m_iHeight - 2 - 6 - 26, Color(255, 0, 0, 255));
  3809.     Render::Clear(window->m_x + 8, window->m_y + 1 + 27, window->m_iWidth - 4 - 12, window->m_iHeight - 2 - 8 - 26, Color(255, 255, 255, 255));
  3810.  
  3811.     //Tab
  3812.     Render::GradientV(window->m_x + 8, window->m_y + 1 + 27, window->m_iWidth - 4 - 12, 29, Color(52, 52, 52, 255), Color(6, 6, 6, 255));
  3813.     int TabCount = window->Tabs.size();
  3814.     if (TabCount) // If there are some tabs
  3815.     {
  3816.         int TabSize = (window->m_iWidth - 4 - 12) / TabCount;
  3817.         for (int i = 0; i < TabCount; i++)
  3818.         {
  3819.             RECT TabArea = { window->m_x + 8 + (i * TabSize), window->m_y + 1 + 27, TabSize, 29 };
  3820.             CTab* tab = window->Tabs[i];
  3821.             if (window->SelectedTab == tab)
  3822.             {
  3823.                 Render::GradientV(window->m_x + 8 + (i * TabSize), window->m_y + 1 + 27, TabSize, 29, Color(52, 52, 52, 255), Color(106, 106, 106, 255));
  3824.             }
  3825.             else if (IsMouseInRegion(TabArea))
  3826.             {
  3827.                 Render::GradientV(window->m_x + 8 + (i * TabSize), window->m_y + 1 + 27, TabSize, 29, Color(106, 106, 106, 255), Color(52, 52, 52, 255));
  3828.             }
  3829.             RECT TextSize = Render::GetTextSize(Render::Fonts::MenuBold, tab->Title.c_str());
  3830.             Render::Text(TabArea.left + (TabSize / 2) - (TextSize.right / 2), TabArea.top + 8, Color(255, 255, 255, 255), Render::Fonts::MenuBold, tab->Title.c_str());
  3831.             Render::Clear(window->m_x + 8, window->m_y + 1 + 27, window->m_iWidth - 4 - 12, 2, Color(66, 66, 66, 255));
  3832.         }
  3833.     }
  3834.  
  3835.  
  3836.     // Controls
  3837.     if (window->SelectedTab != nullptr)
  3838.     {
  3839.         // Focused widget
  3840.         bool SkipWidget = false;
  3841.         CControl* SkipMe = nullptr;
  3842.  
  3843.         // this window is focusing on a widget??
  3844.         if (window->IsFocusingControl)
  3845.         {
  3846.             if (window->FocusedControl != nullptr)
  3847.             {
  3848.                 // We need to draw it last, so skip it in the regular loop
  3849.                 SkipWidget = true;
  3850.                 SkipMe = window->FocusedControl;
  3851.             }
  3852.         }
  3853.  
  3854.  
  3855.         // Itterate over all the other controls
  3856.         for (auto control : window->SelectedTab->Controls)
  3857.         {
  3858.             if (SkipWidget && SkipMe == control)
  3859.                 continue;
  3860.  
  3861.             if (control != nullptr && control->Flag(UIFlags::UI_Drawable))
  3862.             {
  3863.                 POINT cAbs = control->GetAbsolutePos();
  3864.                 RECT controlRect = { cAbs.x, cAbs.y, control->m_iWidth, control->m_iHeight };
  3865.                 bool hover = false;
  3866.                 if (IsMouseInRegion(controlRect))
  3867.                 {
  3868.                     hover = true;
  3869.                 }
  3870.                 control->Draw(hover);
  3871.             }
  3872.         }
  3873.  
  3874.         // Draw the skipped widget last
  3875.         if (SkipWidget)
  3876.         {
  3877.             auto control = window->FocusedControl;
  3878.  
  3879.             if (control != nullptr && control->Flag(UIFlags::UI_Drawable))
  3880.             {
  3881.                 POINT cAbs = control->GetAbsolutePos();
  3882.                 RECT controlRect = { cAbs.x, cAbs.y, control->m_iWidth, control->m_iHeight };
  3883.                 bool hover = false;
  3884.                 if (IsMouseInRegion(controlRect))
  3885.                 {
  3886.                     hover = true;
  3887.                 }
  3888.                 control->Draw(hover);
  3889.             }
  3890.         }
  3891.  
  3892.     }
  3893.  
  3894.  
  3895.     return true;
  3896. }
  3897.  
  3898. void CGUI::RegisterWindow(CWindow* window)
  3899. {
  3900.     Windows.push_back(window);
  3901.  
  3902.     // Resorting to put groupboxes at the start
  3903.     for (auto tab : window->Tabs)
  3904.     {
  3905.         for (auto control : tab->Controls)
  3906.         {
  3907.             if (control->Flag(UIFlags::UI_RenderFirst))
  3908.             {
  3909.                 CControl* c = control;
  3910.                 tab->Controls.erase(std::remove(tab->Controls.begin(), tab->Controls.end(), control), tab->Controls.end());
  3911.                 tab->Controls.insert(tab->Controls.begin(), control);
  3912.             }
  3913.         }
  3914.     }
  3915. }
  3916.  
  3917. void CGUI::BindWindow(unsigned char Key, CWindow* window)
  3918. {
  3919.     if (window)
  3920.         WindowBinds[Key] = window;
  3921.     else
  3922.         WindowBinds.erase(Key);
  3923. }
  3924.  
  3925. void CGUI::SaveWindowState(CWindow* window, std::string Filename)
  3926. {
  3927.     // Create a whole new document and we'll just save over top of the old one
  3928.     tinyxml2::XMLDocument Doc;
  3929.  
  3930.     // Root Element is called "ayy"
  3931.     tinyxml2::XMLElement* Root = Doc.NewElement("ayy");
  3932.     Doc.LinkEndChild(Root);
  3933.  
  3934.     Utilities::Log("Saving Window %s", window->Title.c_str());
  3935.  
  3936.     // If the window has some tabs..
  3937.     if (Root && window->Tabs.size() > 0)
  3938.     {
  3939.         for (auto Tab : window->Tabs)
  3940.         {
  3941.             // Add a new section for this tab
  3942.             tinyxml2::XMLElement* TabElement = Doc.NewElement(Tab->Title.c_str());
  3943.             Root->LinkEndChild(TabElement);
  3944.  
  3945.             Utilities::Log("Saving Tab %s", Tab->Title.c_str());
  3946.  
  3947.             // Now we itterate the controls this tab contains
  3948.             if (TabElement && Tab->Controls.size() > 0)
  3949.             {
  3950.                 for (auto Control : Tab->Controls)
  3951.                 {
  3952.                     // If the control is ok to be saved
  3953.                     if (Control && Control->Flag(UIFlags::UI_SaveFile) && Control->FileIdentifier.length() > 1 && Control->FileControlType)
  3954.                     {
  3955.                         // Create an element for the control
  3956.                         tinyxml2::XMLElement* ControlElement = Doc.NewElement(Control->FileIdentifier.c_str());
  3957.                         TabElement->LinkEndChild(ControlElement);
  3958.  
  3959.                         Utilities::Log("Saving control %s", Control->FileIdentifier.c_str());
  3960.  
  3961.                         if (!ControlElement)
  3962.                         {
  3963.                             Utilities::Log("Errorino :(");
  3964.                             return;
  3965.                         }
  3966.  
  3967.                         CCheckBox* cbx = nullptr;
  3968.                         CComboBox* cbo = nullptr;
  3969.                         CKeyBind* key = nullptr;
  3970.                         CSlider* sld = nullptr;
  3971.  
  3972.                         // Figure out what kind of control and data this is
  3973.                         switch (Control->FileControlType)
  3974.                         {
  3975.                             case UIControlTypes::UIC_CheckBox:
  3976.                                 cbx = (CCheckBox*)Control;
  3977.                                 ControlElement->SetText(cbx->GetState());
  3978.                                 break;
  3979.                             case UIControlTypes::UIC_ComboBox:
  3980.                                 cbo = (CComboBox*)Control;
  3981.                                 ControlElement->SetText(cbo->GetIndex());
  3982.                                 break;
  3983.                             case UIControlTypes::UIC_KeyBind:
  3984.                                 key = (CKeyBind*)Control;
  3985.                                 ControlElement->SetText(key->GetKey());
  3986.                                 break;
  3987.                             case UIControlTypes::UIC_Slider:
  3988.                                 sld = (CSlider*)Control;
  3989.                                 ControlElement->SetText(sld->GetValue());
  3990.                                 break;
  3991.                         }
  3992.                     }
  3993.                 }
  3994.             }
  3995.         }
  3996.     }
  3997.  
  3998.     //Save the file
  3999.     if (Doc.SaveFile(Filename.c_str()) != tinyxml2::XML_NO_ERROR)
  4000.     {
  4001.         MessageBox(NULL, "Failed To Save Config File!", "AyyWare", MB_OK);
  4002.     }
  4003.  
  4004. }
  4005.  
  4006. void CGUI::LoadWindowState(CWindow* window, std::string Filename)
  4007. {
  4008.     // Lets load our meme
  4009.     tinyxml2::XMLDocument Doc;
  4010.     if (Doc.LoadFile(Filename.c_str()) == tinyxml2::XML_NO_ERROR)
  4011.     {
  4012.         tinyxml2::XMLElement* Root = Doc.RootElement();
  4013.  
  4014.         // The root "ayy" element
  4015.         if (Root)
  4016.         {
  4017.             // If the window has some tabs..
  4018.             if (Root && window->Tabs.size() > 0)
  4019.             {
  4020.                 for (auto Tab : window->Tabs)
  4021.                 {
  4022.                     // We find the corresponding element for this tab
  4023.                     tinyxml2::XMLElement* TabElement = Root->FirstChildElement(Tab->Title.c_str());
  4024.                     if (TabElement)
  4025.                     {
  4026.                         // Now we itterate the controls this tab contains
  4027.                         if (TabElement && Tab->Controls.size() > 0)
  4028.                         {
  4029.                             for (auto Control : Tab->Controls)
  4030.                             {
  4031.                                 // If the control is ok to be saved
  4032.                                 if (Control && Control->Flag(UIFlags::UI_SaveFile) && Control->FileIdentifier.length() > 1 && Control->FileControlType)
  4033.                                 {
  4034.                                     // Get the controls element
  4035.                                     tinyxml2::XMLElement* ControlElement = TabElement->FirstChildElement(Control->FileIdentifier.c_str());
  4036.  
  4037.                                     if (ControlElement)
  4038.                                     {
  4039.                                         Utilities::Log("We tryin to load fam");
  4040.                                         CCheckBox* cbx = nullptr;
  4041.                                         CComboBox* cbo = nullptr;
  4042.                                         CKeyBind* key = nullptr;
  4043.                                         CSlider* sld = nullptr;
  4044.  
  4045.                                         // Figure out what kind of control and data this is
  4046.                                         switch (Control->FileControlType)
  4047.                                         {
  4048.                                             case UIControlTypes::UIC_CheckBox:
  4049.                                                 cbx = (CCheckBox*)Control;
  4050.                                                 cbx->SetState(ControlElement->GetText()[0] == '1' ? true : false);
  4051.                                                 break;
  4052.                                             case UIControlTypes::UIC_ComboBox:
  4053.                                                 cbo = (CComboBox*)Control;
  4054.                                                 cbo->SelectIndex(atoi(ControlElement->GetText()));
  4055.                                                 break;
  4056.                                             case UIControlTypes::UIC_KeyBind:
  4057.                                                 key = (CKeyBind*)Control;
  4058.                                                 key->SetKey(atoi(ControlElement->GetText()));
  4059.                                                 break;
  4060.                                             case UIControlTypes::UIC_Slider:
  4061.                                                 sld = (CSlider*)Control;
  4062.                                                 sld->SetValue(atof(ControlElement->GetText()));
  4063.                                                 break;
  4064.                                         }
  4065.                                     }
  4066.                                 }
  4067.                             }
  4068.                         }
  4069.                     }
  4070.                 }
  4071.             }
  4072.         }
  4073.     }
  4074. }/*
  4075. Syn's AYYWAREFramework 2015
  4076. */
  4077.  
  4078. #pragma once
  4079.  
  4080. #include "CommonIncludes.h"
  4081.  
  4082. #include <map>
  4083.  
  4084. class CControl;
  4085. class CTab;
  4086. class CWindow;
  4087. class CGUI;
  4088.  
  4089. extern CGUI GUI;
  4090.  
  4091. enum UIFlags
  4092. {
  4093.     UI_None = 0x00,
  4094.     UI_Drawable = 0x01,
  4095.     UI_Clickable = 0x02,
  4096.     UI_Focusable = 0x04,
  4097.     UI_RenderFirst = 0x08,
  4098.     UI_SaveFile = 0x10
  4099. };
  4100.  
  4101. enum UIControlTypes
  4102. {
  4103.     UIC_CheckBox = 1,
  4104.     UIC_Slider,
  4105.     UIC_KeyBind,
  4106.     UIC_ComboBox
  4107. };
  4108.  
  4109. // Base class for GUI controls
  4110. class CControl
  4111. {
  4112.     friend class CGUI;
  4113.     friend class CTab;
  4114.     friend class CWindow;
  4115.     public:
  4116.         void SetPosition(int x, int y);
  4117.     void SetSize(int w, int h);
  4118.     void GetSize(int &w, int &h);
  4119.     void SetFileId(std::string fid);
  4120.  
  4121.     bool Flag(int f);
  4122.     protected:
  4123.         int m_x, m_y;
  4124.     int m_iWidth, m_iHeight;
  4125.     int m_Flags;
  4126.     CWindow* parent;
  4127.  
  4128.     std::string FileIdentifier;
  4129.     int FileControlType;
  4130.  
  4131.     virtual void Draw(bool) = 0;
  4132.         virtual void OnUpdate() = 0;
  4133.         virtual void OnClick() = 0;
  4134.  
  4135.         POINT GetAbsolutePos();
  4136. };
  4137.  
  4138. // A GUI Control Container
  4139. class CTab
  4140. {
  4141.     friend class CControl;
  4142.     friend class CGUI;
  4143.     friend class CWindow;
  4144.     public:
  4145.         void SetTitle(std::string name);
  4146.     void RegisterControl(CControl* control);
  4147.     private:
  4148.         std::string Title;
  4149.     std::vector<CControl*> Controls;
  4150.     CWindow* parent;
  4151. };
  4152.  
  4153. // Base class for a simple GUI window
  4154. class CWindow
  4155. {
  4156.     friend class CControl;
  4157.     friend class CGUI;
  4158.     public:
  4159.         void SetPosition(int x, int y);
  4160.     void SetSize(int w, int h);
  4161.     void SetTitle(std::string title);
  4162.     void Open();
  4163.     void Close();
  4164.     void Toggle();
  4165.     CControl* GetFocus();
  4166.  
  4167.     void RegisterTab(CTab* Tab);
  4168.  
  4169.     RECT GetClientArea();
  4170.     RECT GetTabArea();
  4171.  
  4172.     private:
  4173.         void DrawControls();
  4174.  
  4175.     bool m_bIsOpen;
  4176.  
  4177.     std::vector<CTab*> Tabs;
  4178.     CTab* SelectedTab;
  4179.  
  4180.     bool IsFocusingControl;
  4181.     CControl* FocusedControl;
  4182.  
  4183.     std::string Title;
  4184.     int m_x;
  4185.     int m_y;
  4186.     int m_iWidth;
  4187.     int m_iHeight;
  4188.  
  4189. };
  4190.  
  4191. // User interface manager
  4192. class CGUI
  4193. {
  4194.     public:
  4195.         CGUI();
  4196.  
  4197.     // Draws all windows
  4198.     void Draw();
  4199.  
  4200.     // Handle all input etc
  4201.     void Update();
  4202.  
  4203.     // Draws a single window
  4204.     bool DrawWindow(CWindow* window);
  4205.  
  4206.     // Registers a window
  4207.     void RegisterWindow(CWindow* window);
  4208.  
  4209.     // Config saving/loading
  4210.     void SaveWindowState(CWindow* window, std::string Filename);
  4211.     void LoadWindowState(CWindow* window, std::string Filename);
  4212.  
  4213.     // Window Binds
  4214.     void BindWindow(unsigned char Key, CWindow* window);
  4215.  
  4216.     // Input
  4217.     bool GetKeyPress(unsigned int key);
  4218.     bool GetKeyState(unsigned int key);
  4219.     bool IsMouseInRegion(int x, int y, int x2, int y2);
  4220.     bool IsMouseInRegion(RECT region);
  4221.     POINT GetMouse();
  4222.  
  4223.     private:
  4224.         // Input
  4225.         // keyboard
  4226.         bool keys[256];
  4227.     bool oldKeys[256];
  4228.     // Mouse
  4229.     POINT Mouse;
  4230.     bool MenuOpen;
  4231.  
  4232.     // Window Dragging
  4233.     bool IsDraggingWindow;
  4234.     CWindow* DraggingWindow;
  4235.     int DragOffsetX; int DragOffsetY;
  4236.  
  4237.     // Windows
  4238.     std::vector<CWindow*> Windows;
  4239.  
  4240.     // KeyBinds -> Windows Map
  4241.     std::map<int, CWindow*> WindowBinds;
  4242.  
  4243. };/*
  4244. Syn's Payhake Framework for Insanity & Razor
  4245. */
  4246.  
  4247. #include "Hacks.h"
  4248. #include "Interfaces.h"
  4249. #include "RenderManager.h"
  4250.  
  4251. #include "ESP.h"
  4252. #include "Visuals.h"
  4253. #include "RageBot.h"
  4254. #include "MiscHacks.h"
  4255. #include "LegitBot.h"
  4256.  
  4257. CEsp Esp;
  4258. CVisuals Visuals;
  4259. CMiscHacks MiscHacks;
  4260. CRageBot RageBot;
  4261. CLegitBot LegitBot;
  4262.  
  4263. // Initialise and register ALL hackmanager hacks in here nigga
  4264. void Hacks::SetupHacks()
  4265. {
  4266.     Esp.Init();
  4267.     Visuals.Init();
  4268.     MiscHacks.Init();
  4269.     RageBot.Init();
  4270.     LegitBot.Init();
  4271.  
  4272.     hackManager.RegisterHack(&Esp);
  4273.     hackManager.RegisterHack(&Visuals);
  4274.     hackManager.RegisterHack(&MiscHacks);
  4275.     hackManager.RegisterHack(&RageBot);
  4276.     hackManager.RegisterHack(&LegitBot);
  4277.  
  4278.     //--------------------------------
  4279.     hackManager.Ready();
  4280. }
  4281.  
  4282. void SpecList()
  4283. {
  4284.     IClientEntity* pLocal = hackManager.pLocal();
  4285.  
  4286.     RECT scrn = Render::GetViewport();
  4287.     int ayy = 0;
  4288.  
  4289.     // Loop through all active entitys
  4290.     for (int i = 0; i < Interfaces::EntList->GetHighestEntityIndex(); i++)
  4291.     {
  4292.         // Get the entity
  4293.         IClientEntity* pEntity = Interfaces::EntList->GetClientEntity(i);
  4294.         player_info_t pinfo;
  4295.  
  4296.         // The entity isn't some laggy peice of shit or something
  4297.         if (pEntity && pEntity != pLocal)
  4298.         {
  4299.             if (Interfaces::Engine->GetPlayerInfo(i, &pinfo) && !pEntity->IsAlive() && !pEntity->IsDormant())
  4300.             {
  4301.                 HANDLE obs = pEntity->GetObserverTargetHandle();
  4302.  
  4303.                 if (obs)
  4304.                 {
  4305.                     IClientEntity* pTarget = Interfaces::EntList->GetClientEntityFromHandle(obs);
  4306.                     player_info_t pinfo2;
  4307.                     if (pTarget)
  4308.                     {
  4309.                         if (Interfaces::Engine->GetPlayerInfo(pTarget->GetIndex(), &pinfo2))
  4310.                         {
  4311.                             char buf[255]; sprintf_s(buf, "%s => %s", pinfo.name, pinfo2.name);
  4312.                             RECT TextSize = Render::GetTextSize(Render::Fonts::ESP, buf);
  4313.                             Render::Clear(scrn.right - 260, (scrn.bottom / 2) + (16 * ayy), 260, 16, Color(0, 0, 0, 140));
  4314.                             Render::Text(scrn.right - TextSize.right - 4, (scrn.bottom / 2) + (16 * ayy), pTarget->GetIndex() == pLocal->GetIndex() ? Color(240, 70, 80, 255) : Color(255, 255, 255, 255), Render::Fonts::ESP, buf);
  4315.                             ayy++;
  4316.                         }
  4317.                     }
  4318.                 }
  4319.             }
  4320.         }
  4321.     }
  4322.  
  4323.     Render::Outline(scrn.right - 261, (scrn.bottom / 2) - 1, 262, (16 * ayy) + 2, Color(23, 23, 23, 255));
  4324.     Render::Outline(scrn.right - 260, (scrn.bottom / 2), 260, (16 * ayy), Color(90, 90, 90, 255));
  4325. }
  4326.  
  4327. // Only gets called in game, use a seperate draw UI call for menus in the hook
  4328. void Hacks::DrawHacks()
  4329. {
  4330.     // Spectator List
  4331.     if (Menu::Window.VisualsTab.OtherSpectators.GetState())
  4332.         SpecList();
  4333.  
  4334.     // Check the master visuals switch, just to be sure
  4335.     if (!Menu::Window.VisualsTab.Active.GetState())
  4336.         return;
  4337.  
  4338.     hackManager.Draw();
  4339.     //--------------------------------
  4340.  
  4341. }
  4342.  
  4343. // Game Cmd Changes
  4344. void Hacks::MoveHacks(CUserCmd* pCmd)
  4345. {
  4346.     Vector origView = pCmd->viewangles;
  4347.     hackManager.Move(pCmd);
  4348.     // ------------------------------
  4349.  
  4350.     // Put it in here so it's applied AFTER the aimbot
  4351.     int AirStuckKey = Menu::Window.VisualsTab.OtherAirStuck.GetKey();
  4352.     if (AirStuckKey > 0 && GUI.GetKeyState(AirStuckKey))
  4353.     {
  4354.         if (!(pCmd->buttons & IN_ATTACK))
  4355.             pCmd->tick_count = 0xFFFFF;
  4356.     }
  4357. }
  4358.  
  4359. //---------------------------------------------------------------------//
  4360. HackManager hackManager;
  4361.  
  4362. // Register a new hack
  4363. void HackManager::RegisterHack(CHack* hake)
  4364. {
  4365.     Hacks.push_back(hake);
  4366.     hake->Init();
  4367. }
  4368.  
  4369. // Draw all the hakes
  4370. void HackManager::Draw()
  4371. {
  4372.     if (!IsReady)
  4373.         return;
  4374.  
  4375.     // Grab the local player for drawing related hacks
  4376.     pLocalInstance = Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
  4377.     if (!pLocalInstance) return;
  4378.  
  4379.     for (auto & hack : Hacks)
  4380.     {
  4381.         hack->Draw();
  4382.     }
  4383. }
  4384.  
  4385. // Handle all the move hakes
  4386. void HackManager::Move(CUserCmd* pCmd)
  4387. {
  4388.     if (!IsReady)
  4389.         return;
  4390.  
  4391.     // Grab the local player for move related hacks
  4392.     pLocalInstance = Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
  4393.     if (!pLocalInstance) return;
  4394.  
  4395.     for (auto & hack : Hacks)
  4396.     {
  4397.         hack->Move(pCmd);
  4398.     }
  4399. }
  4400.  
  4401. //---------------------------------------------------------------------//
  4402. // Other Utils and shit
  4403.  
  4404. // Saves hacks needing to call a bunch of virtuals to get the instance
  4405. // Saves on cycles and file size. Recycle your plastic kids
  4406. IClientEntity* HackManager::pLocal()
  4407. {
  4408.     return pLocalInstance;
  4409. }
  4410.  
  4411. // Makes sure none of the hacks are called in their
  4412. // hooks until they are completely ready for use
  4413. void HackManager::Ready()
  4414. {
  4415.     IsReady = true;
  4416. }
  4417. #pragma once
  4418.  
  4419. #pragma once
  4420.  
  4421. # include "SDK.h"
  4422. # include "Menu.h"
  4423. # include <vector>
  4424.  
  4425. namespace Hacks
  4426. {
  4427.     void SetupHacks();
  4428.     void DrawHacks();
  4429.     void MoveHacks(CUserCmd* pCmd);
  4430. }
  4431.  
  4432. class CHack
  4433. {
  4434.     public:
  4435.         virtual void Draw() = 0;
  4436.         virtual void Move(CUserCmd* pCmd) = 0;
  4437.         virtual void Init() = 0;
  4438. };
  4439.  
  4440. class HackManager
  4441. {
  4442.     public:
  4443.         void RegisterHack(CHack* hake);
  4444.     void Ready();
  4445.  
  4446.     void Draw();
  4447.     void Move(CUserCmd* pCmd);
  4448.     IClientEntity* pLocal();
  4449.     private:
  4450.         std::vector<CHack*> Hacks;
  4451.     IClientEntity* pLocalInstance;
  4452.     bool IsReady;
  4453. };
  4454.  
  4455. extern HackManager hackManager;
  4456.     /*
  4457. Syn's AYYWAREFramework 2015
  4458. */
  4459.  
  4460. #include "Hooks.h"
  4461. #include "Hacks.h"
  4462. #include "Chams.h"
  4463. #include "Menu.h"
  4464.  
  4465. #include "Interfaces.h"
  4466. #include "RenderManager.h"
  4467. #include "MiscHacks.h"
  4468.  
  4469. // Funtion Typedefs
  4470. typedef void(__thiscall* DrawModelEx_)(void*, void*, void*, const ModelRenderInfo_t&, matrix3x4*);
  4471. typedef void(__thiscall* PaintTraverse_)(PVOID, unsigned int, bool, bool);
  4472. typedef bool(__thiscall* InPrediction_)(PVOID);
  4473. typedef void(__stdcall* FrameStageNotifyFn)(ClientFrameStage_t);
  4474.  
  4475. // Function Pointers to the originals
  4476. PaintTraverse_ oPaintTraverse;
  4477. DrawModelEx_ oDrawModelExecute;
  4478. FrameStageNotifyFn oFrameStageNotify;
  4479.  
  4480. // Hook function prototypes
  4481. void __fastcall PaintTraverse_Hooked(PVOID pPanels, int edx, unsigned int vguiPanel, bool forceRepaint, bool allowForce);
  4482. bool __stdcall Hooked_InPrediction();
  4483. void __fastcall Hooked_DrawModelExecute(void* thisptr, int edx, void* ctx, void* state, const ModelRenderInfo_t &pInfo, matrix3x4* pCustomBoneToWorld);
  4484. bool __fastcall CreateMoveClient_Hooked(void* self, int edx, float frametime, CUserCmd* pCmd);
  4485. void __stdcall Hooked_FrameStageNotify(ClientFrameStage_t curStage);
  4486.  
  4487. // VMT Managers
  4488. namespace Hooks
  4489. {
  4490.     // VMT Managers
  4491.     Utilities::Memory::VMTManager VMTPanel; // Hooking drawing functions
  4492.     Utilities::Memory::VMTManager VMTClient; // Maybe CreateMove
  4493.     Utilities::Memory::VMTManager VMTClientMode; // CreateMove for functionality
  4494.     Utilities::Memory::VMTManager VMTModelRender; // DrawModelEx for chams
  4495.     Utilities::Memory::VMTManager VMTPrediction; // InPrediction for no vis recoil
  4496. };
  4497.  
  4498. // Initialise all our hooks
  4499. void Hooks::Initialise()
  4500. {
  4501.     // Panel hooks for drawing to the screen via surface functions
  4502.     VMTPanel.Initialise((DWORD*)Interfaces::Panels);
  4503.     oPaintTraverse = (PaintTraverse_)VMTPanel.HookMethod((DWORD) & PaintTraverse_Hooked, Offsets::VMT::Panel_PaintTraverse);
  4504.     Utilities::Log("Paint Traverse Hooked");
  4505.  
  4506.     // No Visual Recoil
  4507.     VMTPrediction.Initialise((DWORD*)Interfaces::Prediction);
  4508.     VMTPrediction.HookMethod((DWORD) & Hooked_InPrediction, 14);
  4509.     Utilities::Log("InPrediction Hooked");
  4510.  
  4511.     // Chams
  4512.     VMTModelRender.Initialise((DWORD*)Interfaces::ModelRender);
  4513.     oDrawModelExecute = (DrawModelEx_)VMTModelRender.HookMethod((DWORD) & Hooked_DrawModelExecute, Offsets::VMT::ModelRender_DrawModelExecute);
  4514.     Utilities::Log("DrawModelExecute Hooked");
  4515.  
  4516.     // Setup ClientMode Hooks
  4517.     VMTClientMode.Initialise((DWORD*)Interfaces::ClientMode);
  4518.     VMTClientMode.HookMethod((DWORD) & CreateMoveClient_Hooked, 24);
  4519.     //oFrameStageNotify = (FrameStageNotifyFn)VMTClientMode.HookMethod((DWORD)Hooked_FrameStageNotify, 36);
  4520.     Utilities::Log("CreateMove");
  4521.  
  4522.     // Setup client hooks
  4523.     VMTClient.Initialise((DWORD*)Interfaces::Client);
  4524.     oFrameStageNotify = (FrameStageNotifyFn)VMTClient.HookMethod((DWORD) & Hooked_FrameStageNotify, 36);
  4525.     Utilities::Log("FrameStage Hey whats up hello?");
  4526. }
  4527.  
  4528. // Undo our hooks
  4529. void Hooks::UndoHooks()
  4530. {
  4531.     VMTPanel.RestoreOriginal();
  4532.     VMTPrediction.RestoreOriginal();
  4533.     VMTModelRender.RestoreOriginal();
  4534.     VMTClientMode.RestoreOriginal();
  4535.     VMTClient.RestoreOriginal();
  4536. }
  4537.  
  4538. void MovementCorrection(CUserCmd* pCmd)
  4539. {
  4540.  
  4541. }
  4542.  
  4543. //---------------------------------------------------------------------------------------------------------
  4544. //                                         Hooked Functions
  4545. //---------------------------------------------------------------------------------------------------------
  4546.  
  4547. // Paint Traverse Hooked function
  4548. void __fastcall PaintTraverse_Hooked(PVOID pPanels, int edx, unsigned int vguiPanel, bool forceRepaint, bool allowForce)
  4549. {
  4550.     oPaintTraverse(pPanels, vguiPanel, forceRepaint, allowForce);
  4551.  
  4552.     static unsigned int FocusOverlayPanel = 0;
  4553.     static bool FoundPanel = false;
  4554.  
  4555.     if (!FoundPanel)
  4556.     {
  4557.         PCHAR szPanelName = (PCHAR)Interfaces::Panels->GetName(vguiPanel);
  4558.         if (strstr(szPanelName, "MatSystemTopPanel"))
  4559.         {
  4560.             FocusOverlayPanel = vguiPanel;
  4561.             FoundPanel = true;
  4562.         }
  4563.     }
  4564.     else if (FocusOverlayPanel == vguiPanel)
  4565.     {
  4566.  
  4567.         Render::Text(10, 10, Color(255, 255, 255, 220), Render::Fonts::Menu, "AYYWARE New Meme of 2015 Fixed By UnnAmE1337");
  4568.         if (Interfaces::Engine->IsConnected() && Interfaces::Engine->IsInGame())
  4569.             Hacks::DrawHacks();
  4570.  
  4571.         // Update and draw the menu
  4572.         Menu::DoUIFrame();
  4573.     }
  4574. }
  4575.  
  4576. // InPrediction Hooked Function
  4577. bool __stdcall Hooked_InPrediction()
  4578. {
  4579.     bool result;
  4580.     static InPrediction_ origFunc = (InPrediction_)Hooks::VMTPrediction.GetOriginalFunction(14);
  4581.     static DWORD* ecxVal = Interfaces::Prediction;
  4582.     result = origFunc(ecxVal);
  4583.  
  4584.     // If we are in the right place where the player view is calculated
  4585.     // Calculate the change in the view and get rid of it
  4586.     if (Menu::Window.VisualsTab.OtherNoVisualRecoil.GetState() && (DWORD)(_ReturnAddress()) == Offsets::Functions::dwCalcPlayerView)
  4587.     {
  4588.         IClientEntity* pLocalEntity = NULL;
  4589.  
  4590.         float* m_LocalViewAngles = NULL;
  4591.  
  4592.         __asm
  4593.  
  4594.         {
  4595.             MOV pLocalEntity, ESI