Advertisement
Guest User

2017

a guest
Jan 29th, 2020
657
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.26 KB | None | 0 0
  1. enum Menu_Items
  2. {
  3. AIM_Enabled,
  4. Aim_Smooth,
  5. AIM_Fov,
  6. AIM_Bone,
  7. AIM_Mode,
  8. ESP_Enabled,
  9. ESP_Color
  10. };
  11.  
  12. Menu::Menu() :
  13. m_Engine(Engine::Connect()),
  14. m_CVars(CVars::Connect()),
  15. m_Menu(0, 25, 220, 300),
  16. m_MenuColor(0, 0, 0, 170),
  17. m_Index(0),
  18. m_MouseEnabled(m_Engine->GetCVar()->FindVar(Tools::GetName("gmZljtslgjbcn`", 0x9552134290151514)))
  19. {
  20. m_AimEnabledStr = Tools::GetNameW(L"_@llX!Egcfodf", 0x9552134290151514);
  21. m_AimSmoothStr = Tools::GetNameW(L"_@llX!Sdmkwi", 0x9552134290151514);
  22. m_AimFovStr = Tools::GetNameW(L"_@llX!Fft", 0x9552134290151514);
  23. m_AimBoneIdStr = Tools::GetNameW(L"_@llX!BflaJe", 0x9552134290151514);
  24. m_AimModeStr = Tools::GetNameW(L"_@llX!Mffa", 0x9552134290151514);
  25. m_EspEnabledStr = Tools::GetNameW(L"_DvqX!Egcfodf", 0x9552134290151514);
  26. m_EspColorStr = Tools::GetNameW(L"_DvqX!Cfnkq", 0x9552134290151514);
  27. m_JzrMenuStr = Tools::GetNameW(L"K[P(Dgo})!", 0x8190230981298211);
  28. Init();
  29. }
  30.  
  31. Menu::~Menu()
  32. {
  33. }
  34.  
  35. void Menu::Init()
  36. {
  37. //Gets ScreenSize
  38. m_Engine->GetVEngine()->GetScreenSize(m_ScreenSize.x, m_ScreenSize.y);
  39. m_Menu.x = (m_ScreenSize.x - m_Menu.w - 25);
  40.  
  41.  
  42. //Creates Fonts
  43. m_MenuFont = m_Engine->GetSurface()->ICreateFont();
  44. m_Engine->GetSurface()->SetFontGlyphSet(m_MenuFont, "impact", 25, 0, 0, 0, 2);
  45.  
  46. m_FFont = m_Engine->GetSurface()->ICreateFont();
  47. m_Engine->GetSurface()->SetFontGlyphSet(m_FFont, "arial", 15, 0, 0, 0, 0);
  48.  
  49. //MenuItems Add
  50. AddItem(m_AimEnabledStr, std::to_wstring(m_CVars->GetAimState()));
  51. AddItem(m_AimSmoothStr, std::to_wstring(m_CVars->GetAimSmooth()));
  52. AddItem(m_AimFovStr, std::to_wstring(m_CVars->GetAimFov()));
  53. AddItem(m_AimBoneIdStr, m_CVars->GetBoneIdStr());
  54. AddItem(m_AimModeStr, m_CVars->GetAimModeStr());
  55. AddItem(m_EspEnabledStr, std::to_wstring(m_CVars->GetEspState()));
  56. AddItem(m_EspColorStr, m_CVars->GetEspColorStr());
  57. }
  58.  
  59. void Menu::AddItem(const std::wstring & Label, const std::wstring & Item)
  60. {
  61. m_MenuItems.push_back(Label);
  62. m_MenuStates.push_back(Item);
  63. }
  64.  
  65. void Menu::Update()
  66. {
  67. static int ButtonTick = 0;
  68. if (m_Engine->GetInput()->IsButtonDown(sdk::KEY_LCONTROL) &&
  69. m_Engine->GetInput()->IsButtonDown(sdk::KEY_LALT) &&
  70. m_Engine->GetInput()->IsButtonDown(sdk::KEY_UP))
  71. {
  72. ButtonTick++;
  73. if (ButtonTick == 1)
  74. {
  75. m_CVars->SetMenuState(!m_CVars->GetMenuState());
  76. m_Engine->GetSurface()->SetFontGlyphSet(m_MenuFont, "impact", 25, 0, 0, 0, 2);
  77. m_Engine->GetSurface()->SetFontGlyphSet(m_FFont, "arial", 15, 0, 0, 0, 0);
  78. }
  79. }
  80. else
  81. {
  82. if (ButtonTick != 0)
  83. {
  84. ButtonTick = 0;
  85. }
  86. }
  87.  
  88.  
  89. if(m_CVars->GetMenuState() == true)
  90. {
  91. static int MouseEnabled = 1;
  92. static int CursorMoved = 0;
  93. if (m_Engine->GetInput()->IsButtonDown(sdk::MOUSE_4))
  94. {
  95. MouseEnabled = 0;
  96. m_MouseEnabled->SetValue(0);
  97.  
  98. CursorMoved++;
  99. if (CursorMoved == 1)
  100. {
  101. m_Engine->GetInput()->SetCursorPosition(m_Menu.x, m_Menu.y);
  102. }
  103. m_Engine->GetInput()->GetCursorPosition(m_Menu.x, m_Menu.y);
  104. }
  105. else
  106. {
  107. if (MouseEnabled == 0)
  108. {
  109. m_MouseEnabled->SetValue(1);
  110. MouseEnabled = 1;
  111. CursorMoved = 0;
  112. }
  113. }
  114.  
  115.  
  116. DrawMenuRect();
  117. DrawTitleRect();
  118. DrawItems();
  119. UpdateMenuKeys();
  120. }
  121. }
  122.  
  123. void Menu::DrawMenuRect()
  124. {
  125. static vec2<int> nSize;
  126. m_Engine->GetVEngine()->GetScreenSize(nSize.x, nSize.y);
  127.  
  128. if (m_ScreenSize != nSize)
  129. {
  130. m_Engine->GetSurface()->SetFontGlyphSet(m_MenuFont, "impact", 25, 0, 0, 0, 2);
  131. m_Engine->GetSurface()->SetFontGlyphSet(m_FFont, "arial", 15, 0, 0, 0, 0);
  132. m_ScreenSize = nSize;
  133. }
  134.  
  135.  
  136.  
  137.  
  138. m_Engine->GetSurface()->DrawSetColor(m_MenuColor.r, m_MenuColor.g, m_MenuColor.b, m_MenuColor.a);
  139. m_Engine->GetSurface()->DrawFilledRect(m_Menu.x, m_Menu.y, m_Menu.x + m_Menu.w, m_Menu.y + m_Menu.h);
  140.  
  141. m_Engine->GetSurface()->DrawSetColor(12, 116, 191, 255);
  142. m_Engine->GetSurface()->DrawFilledRect(m_Menu.x, m_Menu.y, m_Menu.x + m_Menu.w, m_Menu.y + 12);
  143. }
  144.  
  145. void Menu::DrawTitleRect()
  146. {
  147. m_Engine->GetSurface()->DrawSetTextFont(m_MenuFont);
  148. m_Engine->GetSurface()->DrawSetTextColor(255, 255, 255, 255);
  149. m_Engine->GetSurface()->DrawSetTextPos(m_Menu.x + 65, m_Menu.y + 15);
  150. m_Engine->GetSurface()->DrawPrintText(m_JzrMenuStr, 10);
  151. }
  152.  
  153. void Menu::DrawItems()
  154. {
  155. for (int i = 0; i < (int)m_MenuItems.size(); i++)
  156. {
  157. if (m_Index == i)
  158. {
  159. m_Engine->GetSurface()->DrawSetColor(12, 116, 191, 255);
  160. m_Engine->GetSurface()->DrawFilledRect(m_Menu.x + 10, m_Menu.y + 60 + i * 20, m_Menu.x + m_Menu.w - 10, m_Menu.y + 80 + i * 20);
  161. }
  162. DrawMenuText(m_MenuItems[i].c_str(), m_MenuStates[i].c_str(), 10, 60 + i * 20, Color(255, 255, 255, 255));
  163. }
  164. }
  165.  
  166. void Menu::UpdateMenuKeys()
  167. {
  168. static int ButtonTick = 0;
  169. if (m_Engine->GetInput()->IsButtonDown(sdk::KEY_LEFT))
  170. {
  171. ButtonTick++;
  172. if (ButtonTick == 1 || ButtonTick > 150)
  173. {
  174. UpdateMenuValues(CVars_Minus);
  175. }
  176. }
  177.  
  178. else if (m_Engine->GetInput()->IsButtonDown(sdk::KEY_RIGHT))
  179. {
  180. ButtonTick++;
  181. if (ButtonTick == 1 || ButtonTick > 150)
  182. {
  183. UpdateMenuValues(CVars_Plus);
  184. }
  185. }
  186.  
  187. else if (m_Engine->GetInput()->IsButtonDown(sdk::KEY_UP))
  188. {
  189. ButtonTick++;
  190. if (ButtonTick == 1 || ButtonTick > 150)
  191. {
  192. if (m_Index > 0)
  193. {
  194. m_Index--;
  195. }
  196. }
  197. }
  198.  
  199. else if (m_Engine->GetInput()->IsButtonDown(sdk::KEY_DOWN))
  200. {
  201. ButtonTick++;
  202. if (ButtonTick == 1 || ButtonTick > 150)
  203. {
  204. if (m_Index < (int)m_MenuItems.size() - 1)
  205. {
  206. m_Index++;
  207. }
  208. }
  209. }
  210. else
  211. {
  212. if (ButtonTick != 0)
  213. {
  214. ButtonTick = 0;
  215. }
  216. }
  217.  
  218. }
  219.  
  220. void Menu::UpdateMenuValues(int State)
  221. {
  222. switch (m_Index)
  223. {
  224. case AIM_Enabled:
  225. {
  226. m_CVars->SetAimState(State);
  227. m_MenuStates[m_Index] = std::to_wstring(m_CVars->GetAimState());
  228. break;
  229. }
  230. case Aim_Smooth:
  231. {
  232. m_CVars->SetAimSmooth(State);
  233. m_MenuStates[m_Index] = std::to_wstring(m_CVars->GetAimSmooth());
  234. break;
  235. }
  236. case AIM_Fov:
  237. {
  238. m_CVars->SetAimFov(State);
  239. m_MenuStates[m_Index] = std::to_wstring(m_CVars->GetAimFov());
  240. break;
  241. }
  242.  
  243. case AIM_Bone:
  244. {
  245. m_CVars->SetBoneId(State);
  246. m_MenuStates[m_Index] = m_CVars->GetBoneIdStr();
  247. break;
  248. }
  249.  
  250. case AIM_Mode:
  251. {
  252. m_CVars->SetAimMode(State);
  253. m_MenuStates[m_Index] = m_CVars->GetAimModeStr();
  254. break;
  255. }
  256.  
  257. case ESP_Enabled:
  258. {
  259. m_CVars->SetEspState(State);
  260. m_MenuStates[m_Index] = std::to_wstring(m_CVars->GetEspState());
  261. break;
  262. }
  263. case ESP_Color:
  264. {
  265. m_CVars->SetEspColor(State);
  266. m_MenuStates[m_Index] = m_CVars->GetEspColorStr();
  267. break;
  268. }
  269.  
  270. }
  271. }
  272.  
  273. void Menu::DrawMenuText(const wchar_t * Label, const wchar_t* Item, const int & x, const int & y, const Color & color) const
  274. {
  275. m_Engine->GetSurface()->DrawSetTextFont(m_FFont);
  276. m_Engine->GetSurface()->DrawSetTextColor(color.r, color.g, color.b, color.a);
  277. m_Engine->GetSurface()->DrawSetTextPos(m_Menu.x + x, m_Menu.y + y);
  278. m_Engine->GetSurface()->DrawPrintText(Label, wcslen(Label));
  279. m_Engine->GetSurface()->DrawSetTextPos(m_Menu.x + x + 120, m_Menu.y + y);
  280. m_Engine->GetSurface()->DrawPrintText(Item, wcslen(Item));
  281. }
  282.  
  283.  
  284. CVars::CVars() :
  285. m_Aim(1),
  286. m_AimSmooth(1),
  287. m_AimFov(1.0),
  288. m_BoneId(Aim_Body),
  289. m_AimMode(AIM_Mode_Faceit),
  290. m_Esp(0),
  291. m_EspColor(ESP_Color_Red),
  292. m_Menu(false)
  293. {
  294. m_BodyString = Tools::GetNameW(L"Fnax", 0x9552134290151514);
  295. m_SilentString = Tools::GetNameW(L"Whidku", 0x9552134290151514);
  296. m_FaceitStr = Tools::GetNameW(L"B`fdlu", 0x9552134290151514);
  297. }
  298.  
  299. CVars::~CVars()
  300. {
  301. }
  302.  
  303. int CVars::GetAimState() const
  304. {
  305. return m_Aim;
  306. }
  307.  
  308. int CVars::GetAimSmooth() const
  309. {
  310. return m_AimSmooth;
  311. }
  312.  
  313. double CVars::GetAimFov() const
  314. {
  315. return m_AimFov;
  316. }
  317.  
  318. int CVars::GetBoneId() const
  319. {
  320. return m_BoneId;
  321. }
  322.  
  323. std::wstring CVars::GetBoneIdStr() const
  324. {
  325. std::wstring String;
  326. if (m_BoneId == Aim_Body)
  327. {
  328. String = m_BodyString;
  329. }
  330. else
  331. {
  332. String = std::to_wstring(m_BoneId);
  333. }
  334. return String;
  335. }
  336.  
  337. int CVars::GetAimMode() const
  338. {
  339. return m_AimMode;
  340. }
  341. std::wstring CVars::GetAimModeStr() const
  342. {
  343. std::wstring String;
  344. switch (m_AimMode)
  345. {
  346. case AIM_Mode_Faceit:
  347. {
  348. String = m_FaceitStr;
  349. break;
  350. }
  351. case AIM_Mode_Normal:
  352. {
  353. String = L"Normal";
  354. break;
  355. }
  356. case AIM_Mode_Silent:
  357. {
  358. String = m_SilentString;
  359. break;
  360. }
  361. }
  362. return String;
  363. }
  364. int CVars::GetEspState() const
  365. {
  366. return m_Esp;
  367. }
  368. int CVars::GetEspColor() const
  369. {
  370. return m_EspColor;
  371. }
  372. std::wstring CVars::GetEspColorStr() const
  373. {
  374. std::wstring String;
  375. switch (m_EspColor)
  376. {
  377. case ESP_Color_Red:
  378. {
  379. String = L"Red";
  380. break;
  381. }
  382. case ESP_Color_Green:
  383. {
  384. String = L"Green";
  385. break;
  386. }
  387. case ESP_Color_Blue:
  388. {
  389. String = L"Blue";
  390. break;
  391. }
  392. case ESP_Color_White:
  393. {
  394. String = L"White";
  395. break;
  396. }
  397. }
  398. return String;
  399. }
  400. bool CVars::GetMenuState() const
  401. {
  402. return m_Menu;
  403. }
  404.  
  405. void CVars::SetAimState(const int & State)
  406. {
  407. SetValue(State, m_Aim, 0, 1);
  408. }
  409.  
  410. void CVars::SetAimSmooth(const int & State)
  411. {
  412. SetValue(State, m_AimSmooth, 0, 30);
  413. }
  414.  
  415. void CVars::SetAimFov(const int & State)
  416. {
  417. SetValueDbl(State, m_AimFov, 0.0, 180.0);
  418. }
  419.  
  420. void CVars::SetBoneId(const int & State)
  421. {
  422. SetValue(State, m_BoneId, 0, 8);
  423. }
  424.  
  425. void CVars::SetAimMode(const int & State)
  426. {
  427. SetValue(State, m_AimMode, AIM_Mode_Faceit, AIM_Mode_Silent);
  428. }
  429.  
  430. void CVars::SetEspState(const int & State)
  431. {
  432. SetValue(State, m_Esp, 0, 1);
  433. }
  434.  
  435. void CVars::SetEspColor(const int & State)
  436. {
  437. SetValue(State, m_EspColor, ESP_Color_Red, ESP_Color_White);
  438. }
  439.  
  440. void CVars::SetMenuState(const bool & State)
  441. {
  442. m_Menu = State;
  443. }
  444.  
  445. void CVars::SetValue(const int & State, int & Value, const int & Min, const int & Max)
  446. {
  447. switch (State)
  448. {
  449. case CVars_Plus:
  450. {
  451. if (Value <= Max)
  452. {
  453. Value++;
  454. }
  455.  
  456. if (Value > Max)
  457. Value = Min;
  458.  
  459. break;
  460. }
  461.  
  462. case CVars_Minus:
  463. {
  464. if (Value >= Min)
  465. {
  466. Value--;
  467. }
  468. if (Value < Min)
  469. Value = Max;
  470.  
  471. break;
  472. }
  473. }
  474. }
  475.  
  476. void CVars::SetValueDbl(const int & State, double & Value, const double & Min, const double & Max)
  477. {
  478. switch (State)
  479. {
  480. case CVars_Plus:
  481. {
  482. if (Value <= Max)
  483. {
  484. Value = Value + 0.20;
  485. }
  486.  
  487. if (Value > Max)
  488. Value = Min;
  489.  
  490. break;
  491. }
  492.  
  493. case CVars_Minus:
  494. {
  495. if (Value >= Min)
  496. {
  497. Value = Value - 0.20;
  498. }
  499. if (Value < Min)
  500. Value = Max;
  501.  
  502. break;
  503. }
  504. }
  505. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement