diff --git a/Arsenal/Arsenal.vcxproj b/Arsenal/Arsenal.vcxproj index 38e91ef..f05fedd 100644 --- a/Arsenal/Arsenal.vcxproj +++ b/Arsenal/Arsenal.vcxproj @@ -71,10 +71,10 @@ - Level3 + TurnOffAllWarnings true true - true + false WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpplatest @@ -95,13 +95,13 @@ - + @@ -126,7 +126,6 @@ - @@ -142,7 +141,6 @@ - @@ -150,6 +148,7 @@ + diff --git a/Arsenal/Arsenal.vcxproj.filters b/Arsenal/Arsenal.vcxproj.filters index e59ef9e..19bc561 100644 --- a/Arsenal/Arsenal.vcxproj.filters +++ b/Arsenal/Arsenal.vcxproj.filters @@ -21,9 +21,6 @@ Source Files - - Source Files - Source Files @@ -144,15 +141,15 @@ Source Files - - Source Files - Source Files Source Files + + Source Files + @@ -458,10 +455,10 @@ Header Files - + Header Files - + Header Files diff --git a/Arsenal/Entry/Entry.cpp b/Arsenal/Entry/Entry.cpp index dccae50..2cb0cd3 100644 --- a/Arsenal/Entry/Entry.cpp +++ b/Arsenal/Entry/Entry.cpp @@ -1,6 +1,7 @@ #include "Entry.h" #include "../Hooks/Definitions/WINAPI_WndProc.h" #include "../Features/Notification/Notification.h" +#include "../Features/Players/Players.h" //#include //#include @@ -114,6 +115,8 @@ void CGlobal_Entry::Load() G::Hooks.Initialize(); WINAPI_HOOK::WINAPI_WndProc::Init(); + PlayerManager::Parse(); + Config::Load((std::filesystem::current_path().string() + "\\Arsenal\\default.json").c_str()); F::Notifications.Add("Config default loaded!"); diff --git a/Arsenal/Features/CFG.h b/Arsenal/Features/CFG.h index 921b33c..b8be9bb 100644 --- a/Arsenal/Features/CFG.h +++ b/Arsenal/Features/CFG.h @@ -105,7 +105,11 @@ namespace CFG CFGVAR(Colors_Team, Color_t({ 252, 92, 101, 255 })); CFGVAR(Colors_TeamT, Color_t({ 240, 90, 90, 255 })); CFGVAR(Colors_TeamCT, Color_t({ 150, 200, 255, 255 })); + CFGVAR(Color_Friend, Color_t({ 38, 222, 129, 255 })); + CFGVAR(Color_Cheater, Color_t({ 214, 48, 49, 255 })); + CFGVAR(Color_RetardLegit, Color_t({ 48, 218, 70, 255 })); CFGVAR(Colors_PlantedC4, Color_t({ 255, 219, 88, 255 })); + CFGVAR(Colors_DroppedWeapons, Color_t({ 255, 219, 88, 255 })); #pragma endregion } \ No newline at end of file diff --git a/Arsenal/Features/ESP/ESP.cpp b/Arsenal/Features/ESP/ESP.cpp index bbd963a..d1660d5 100644 --- a/Arsenal/Features/ESP/ESP.cpp +++ b/Arsenal/Features/ESP/ESP.cpp @@ -1,5 +1,6 @@ #include "ESP.h" #include "../CFG.h" +#include "../Players/Players.h" void CFeatures_ESP::Run() { @@ -49,7 +50,7 @@ void CFeatures_ESP::DrawPlayers(C_CSPlayer* pLocal) const int iHealth = pPlayer->GetHealth(); const int iMaxHealth = pPlayer->GetMaxHealth(); - const Color_t clrTeam = Util::GetTeamColor(pPlayer->m_iTeamNum(), pLocal->m_iTeamNum(), CFG::Colors_Relative); + const Color_t clrTeam = Util::GetEntityColor(pLocal, pPlayer, CFG::Colors_Relative); if (CFG::ESP_Players_Box) { @@ -234,7 +235,7 @@ std::wstring CFeatures_ESP::GetWeaponName(int wpnid) get_rel32(U::Pattern.Find("client.dll", "E8 ? ? ? ? 50 FF 75 94"), 1, 5)); if (!function(wpnid)) - return L"UNKNOWN"; + return L"unknown"; return Util::ConvertUtf8ToWide(function(wpnid)); } diff --git a/Arsenal/Features/Glow/Glow.cpp b/Arsenal/Features/Glow/Glow.cpp deleted file mode 100644 index 42890a4..0000000 --- a/Arsenal/Features/Glow/Glow.cpp +++ /dev/null @@ -1,509 +0,0 @@ -//#include "Glow.h" -// -//#include "../CFG.h" -// -//#pragma warning (disable : 4244) //possible loss of data (int to float) -// -//void CFeatures_Glow::Initialize() -//{ -// if (!m_pMatGlowColor) -// { -// m_pMatGlowColor = I::MaterialSystem->FindMaterial("dev/glow_color", TEXTURE_GROUP_OTHER); -// } -// -// if (!m_pRtFullFrame) -// { -// m_pRtFullFrame = I::MaterialSystem->FindTexture("_rt_FullFrameFB", TEXTURE_GROUP_RENDER_TARGET); -// } -// -// if (!m_pRenderBuffer0) -// { -// m_pRenderBuffer0 = I::MaterialSystem->CreateNamedRenderTargetTextureEx( -// "seo_outline_buffer0", -// m_pRtFullFrame->GetActualWidth(), -// m_pRtFullFrame->GetActualHeight(), -// RT_SIZE_LITERAL, -// IMAGE_FORMAT_RGB888, -// MATERIAL_RT_DEPTH_SHARED, -// TEXTUREFLAGS_CLAMPS | TEXTUREFLAGS_CLAMPT | TEXTUREFLAGS_EIGHTBITALPHA, -// CREATERENDERTARGETFLAGS_HDR -// ); -// -// m_pRenderBuffer0->IncrementReferenceCount(); -// } -// -// if (!m_pRenderBuffer1) -// { -// m_pRenderBuffer1 = I::MaterialSystem->CreateNamedRenderTargetTextureEx( -// "seo_outline_buffer1", -// m_pRtFullFrame->GetActualWidth(), -// m_pRtFullFrame->GetActualHeight(), -// RT_SIZE_LITERAL, -// IMAGE_FORMAT_RGB888, -// MATERIAL_RT_DEPTH_SHARED, -// TEXTUREFLAGS_CLAMPS | TEXTUREFLAGS_CLAMPT | TEXTUREFLAGS_EIGHTBITALPHA, -// CREATERENDERTARGETFLAGS_HDR -// ); -// -// m_pRenderBuffer1->IncrementReferenceCount(); -// } -// -// if (!m_pMatHaloAddToScreen) -// { -// auto kv = new KeyValues("UnlitGeneric"); -// kv->SetString("$dummy", "dummy"); -// kv->SetString("$basetexture", "seo_outline_buffer0"); -// kv->SetString("$additive", "1"); -// m_pMatHaloAddToScreen = I::MaterialSystem->CreateMaterial("seo_outline_material", kv); -// } -// -// if (!m_pMatBlurX) -// { -// auto kv = new KeyValues("BlurFilterX"); -// kv->SetString("$dummy", "dummy"); -// kv->SetString("$basetexture", "seo_outline_buffer0"); -// m_pMatBlurX = I::MaterialSystem->CreateMaterial("seo_outline_material_blurx", kv); -// } -// -// if (!m_pMatBlurY) -// { -// auto kv = new KeyValues("BlurFilterY"); -// kv->SetString("$dummy", "dummy"); -// kv->SetString("$basetexture", "seo_outline_buffer1"); -// m_pMatBlurY = I::MaterialSystem->CreateMaterial("seo_outline_material_blury", kv); -// m_pBloomAmount = m_pMatBlurY->FindVar("$bloomamount", nullptr); -// } -//} -// -//void CFeatures_Glow::DrawEntity(C_BaseEntity* pEntity, bool bModel) -//{ -// m_bRendering = true; -// -// if (!bModel) -// m_bRenderingOutlines = true; -// -// float flOldInvisibility = pEntity->GetClassId() == ETFClassIds::CTFPlayer ? pEntity->As()->m_flInvisibility() : -1.0f; -// -// if (flOldInvisibility > 0.99f) -// { -// pEntity->As()->m_flInvisibility() = 0.0f; -// -// if (!m_bRenderingOutlines) -// I::RenderView->SetBlend(0.0f); -// } -// -// pEntity->DrawModel(bModel ? STUDIO_RENDER : (STUDIO_RENDER | STUDIO_NOSHADOWS)); -// -// if (flOldInvisibility > 0.99f) -// { -// pEntity->As()->m_flInvisibility() = flOldInvisibility; -// -// if (!m_bRenderingOutlines) -// I::RenderView->SetBlend(1.0f); -// } -// -// if (bModel) -// m_mapDrawnEntities[pEntity] = true; -// -// if (!bModel) -// m_bRenderingOutlines = false; -// -// m_bRendering = false; -//} -// -//void CFeatures_Glow::RunModels() -//{ -// Initialize(); -// -// if (!m_mapDrawnEntities.empty()) -// m_mapDrawnEntities.clear(); -// -// if (!m_vecOutlineEntities.empty()) -// m_vecOutlineEntities.clear(); -// -// if (!CFG::Outlines_Active || I::EngineVGui->IsGameUIVisible() || G::bRenderingSpyCamera) -// return; -// -// int w = H::Draw->GetScreenW(), h = H::Draw->GetScreenH(); -// -// if (w < 1 || h < 1 || w > 4096 || h > 2160) -// return; -// -// auto pRC = I::MaterialSystem->GetRenderContext(); -// -// if (!pRC) -// return; -// -// auto pLocal = H::Entities->GetLocal(); -// -// if (!pLocal) -// return; -// -// ShaderStencilState_t StencilStateDisable = {}; -// StencilStateDisable.m_bEnable = false; -// -// float flOriginalColor[3] = {}; -// I::RenderView->GetColorModulation(flOriginalColor); -// float flOriginalBlend = I::RenderView->GetBlend(); -// -// SetModelStencil(pRC); -// -// I::RenderView->SetBlend(1.0f); -// I::RenderView->SetColorModulation(1.0f, 1.0f, 1.0f); -// -// if (CFG::Outlines_Players_Active) -// { -// for (auto pEntity : H::Entities->GetGroup(EEntGroup::PLAYERS_ALL)) -// { -// if (!pEntity) -// continue; -// -// auto pPlayer = pEntity->As(); -// -// if (pPlayer->deadflag()) -// continue; -// -// bool bIsLocal = pPlayer == pLocal; -// bool bIsFriend = pPlayer->IsPlayerOnSteamFriendsList(); -// -// if (CFG::Outlines_Players_Ignore_Local && bIsLocal) -// continue; -// -// if (CFG::Outlines_Players_Ignore_Friends && bIsFriend) -// continue; -// -// if (!bIsLocal) -// { -// if (!bIsFriend) -// { -// if (CFG::Outlines_Players_Ignore_Teammates && pPlayer->m_iTeamNum() == pLocal->m_iTeamNum()) -// { -// if (CFG::Outlines_Players_Show_Teammate_Medics) -// { -// if (pPlayer->m_iClass() != TF_CLASS_MEDIC) -// continue; -// } -// -// else continue; -// } -// -// if (CFG::Outlines_Players_Ignore_Enemies && pPlayer->m_iTeamNum() != pLocal->m_iTeamNum()) -// continue; -// } -// } -// -// if (!F::VisualUtils->IsOnScreen(pLocal, pPlayer)) -// continue; -// -// auto Color = F::VisualUtils->GetEntityColor(pLocal, pPlayer); -// -// m_vecOutlineEntities.emplace_back(OutlineEntity_t{ pPlayer, Color, CFG::Outlines_Players_Alpha }); -// -// if (!F::Materials->HasDrawn(pPlayer)) -// DrawEntity(pPlayer, true); -// -// C_BaseEntity* pAttach = pPlayer->FirstMoveChild(); -// -// for (int n = 0; n < 32; n++) -// { -// if (!pAttach) -// break; -// -// if (pAttach->ShouldDraw()) -// { -// m_vecOutlineEntities.emplace_back(OutlineEntity_t{ pAttach, Color, CFG::Outlines_Players_Alpha }); -// -// if (!F::Materials->HasDrawn(pAttach)) -// DrawEntity(pAttach, true); -// } -// -// pAttach = pAttach->NextMovePeer(); -// } -// } -// } -// -// if (CFG::Outlines_World_Active) -// { -// if (!CFG::Outlines_World_Ignore_HealthPacks) -// { -// auto Color = CFG::Color_HealthPack; -// -// for (auto pEntity : H::Entities->GetGroup(EEntGroup::HEALTHPACKS)) -// { -// if (!pEntity || !F::VisualUtils->IsOnScreen(pLocal, pEntity)) -// continue; -// -// m_vecOutlineEntities.emplace_back(OutlineEntity_t{ pEntity, Color, CFG::Outlines_World_Alpha }); -// -// if (!F::Materials->HasDrawn(pEntity)) -// DrawEntity(pEntity, true); -// } -// } -// -// if (!CFG::Outlines_World_Ignore_AmmoPacks) -// { -// auto Color = CFG::Color_AmmoPack; -// -// for (auto pEntity : H::Entities->GetGroup(EEntGroup::AMMOPACKS)) -// { -// if (!pEntity || !F::VisualUtils->IsOnScreen(pLocal, pEntity)) -// continue; -// -// m_vecOutlineEntities.emplace_back(OutlineEntity_t{ pEntity, Color, CFG::Outlines_World_Alpha }); -// -// if (!F::Materials->HasDrawn(pEntity)) -// DrawEntity(pEntity, true); -// } -// } -// -// if (!CFG::Outlines_World_Ignore_Halloween_Gift) -// { -// auto Color = CFG::Color_Halloween_Gift; -// -// for (auto pEntity : H::Entities->GetGroup(EEntGroup::HALLOWEEN_GIFT)) -// { -// if (!pEntity || !pEntity->ShouldDraw() || !F::VisualUtils->IsOnScreen(pLocal, pEntity)) -// continue; -// -// m_vecOutlineEntities.emplace_back(OutlineEntity_t{ pEntity, Color, CFG::Outlines_World_Alpha }); -// -// if (!F::Materials->HasDrawn(pEntity)) -// DrawEntity(pEntity, true); -// } -// } -// -// if (!CFG::Outlines_World_Ignore_MVM_Money) -// { -// auto Color = CFG::Color_MVM_Money; -// -// for (auto pEntity : H::Entities->GetGroup(EEntGroup::MVM_MONEY)) -// { -// if (!pEntity || !pEntity->ShouldDraw() || !F::VisualUtils->IsOnScreen(pLocal, pEntity)) -// continue; -// -// m_vecOutlineEntities.emplace_back(OutlineEntity_t{ pEntity, Color, CFG::Outlines_World_Alpha }); -// -// if (!F::Materials->HasDrawn(pEntity)) -// DrawEntity(pEntity, true); -// } -// } -// -// bool bIgnoringAllProjectiles = CFG::Outlines_World_Ignore_LocalProjectiles -// && CFG::Outlines_World_Ignore_EnemyProjectiles -// && CFG::Outlines_World_Ignore_TeammateProjectiles; -// -// if (!bIgnoringAllProjectiles) -// { -// for (auto pEntity : H::Entities->GetGroup(EEntGroup::PROJECTILES_ALL)) -// { -// if (!pEntity || !pEntity->ShouldDraw()) -// continue; -// -// bool bIsLocal = F::VisualUtils->IsEntityOwnedBy(pEntity, pLocal); -// -// if (CFG::Outlines_World_Ignore_LocalProjectiles && bIsLocal) -// continue; -// -// if (!bIsLocal) -// { -// if (CFG::Outlines_World_Ignore_EnemyProjectiles && pEntity->m_iTeamNum() != pLocal->m_iTeamNum()) -// continue; -// -// if (CFG::Outlines_World_Ignore_TeammateProjectiles && pEntity->m_iTeamNum() == pLocal->m_iTeamNum()) -// continue; -// } -// -// if (!F::VisualUtils->IsOnScreen(pLocal, pEntity)) -// continue; -// -// auto Color = F::VisualUtils->GetEntityColor(pLocal, pEntity); -// -// m_vecOutlineEntities.emplace_back(OutlineEntity_t{ pEntity, Color, CFG::Outlines_World_Alpha }); -// -// if (!F::Materials->HasDrawn(pEntity)) -// DrawEntity(pEntity, true); -// } -// } -// } -// -// StencilStateDisable.SetStencilState(pRC); -// -// I::ModelRender->ForcedMaterialOverride(nullptr); -// I::RenderView->SetColorModulation(flOriginalColor); -// I::RenderView->SetBlend(flOriginalBlend); -//} -// -//void CFeatures_Glow::Run() -//{ -// if (!CFG::Outlines_Active || I::EngineVGui->IsGameUIVisible() || G::bRenderingSpyCamera) -// return; -// -// if (CFG::Misc_Clean_Screenshot && I::EngineClient->IsTakingScreenshot()) -// { -// return; -// } -// -// int w = H::Draw->GetScreenW(), h = H::Draw->GetScreenH(); -// -// if (w < 1 || h < 1 || w > 4096 || h > 2160) -// return; -// -// auto pRC = I::MaterialSystem->GetRenderContext(); -// -// if (!pRC) -// return; -// -// if (CFG::Outlines_Style == 0) -// m_pBloomAmount->SetIntValue(CFG::Outlines_Bloom_Amount); -// -// ShaderStencilState_t StencilStateDisable = {}; -// StencilStateDisable.m_bEnable = false; -// -// float flOriginalColor[3] = {}; -// I::RenderView->GetColorModulation(flOriginalColor); -// float flOriginalBlend = I::RenderView->GetBlend(); -// -// if (m_vecOutlineEntities.empty()) -// return; -// -// I::ModelRender->ForcedMaterialOverride(m_pMatGlowColor); -// -// pRC->PushRenderTargetAndViewport(); -// { -// pRC->SetRenderTarget(m_pRenderBuffer0); -// pRC->Viewport(0, 0, w, h); -// pRC->ClearColor4ub(0, 0, 0, 0); -// pRC->ClearBuffers(true, false, false); -// -// for (const auto& Entity : m_vecOutlineEntities) { -// I::RenderView->SetBlend(Entity.m_flAlpha); -// I::RenderView->SetColorModulation(ColorUtils::ToFloat(Entity.m_Color.r), ColorUtils::ToFloat(Entity.m_Color.g), ColorUtils::ToFloat(Entity.m_Color.b)); -// DrawEntity(Entity.m_pEntity, false); -// } -// -// StencilStateDisable.SetStencilState(pRC); -// } -// pRC->PopRenderTargetAndViewport(); -// -// if (CFG::Outlines_Style == 0) -// { -// pRC->PushRenderTargetAndViewport(); -// { -// pRC->Viewport(0, 0, w, h); -// pRC->SetRenderTarget(m_pRenderBuffer1); -// pRC->DrawScreenSpaceRectangle(m_pMatBlurX, 0, 0, w, h, 0.0f, 0.0f, w - 1, h - 1, w, h); -// pRC->SetRenderTarget(m_pRenderBuffer0); -// pRC->DrawScreenSpaceRectangle(m_pMatBlurY, 0, 0, w, h, 0.0f, 0.0f, w - 1, h - 1, w, h); -// } -// pRC->PopRenderTargetAndViewport(); -// } -// -// ShaderStencilState_t SEffect = {}; -// SEffect.m_bEnable = true; -// SEffect.m_nWriteMask = 0x0; -// SEffect.m_nTestMask = 0xFF; -// SEffect.m_nReferenceValue = 0; -// SEffect.m_CompareFunc = STENCILCOMPARISONFUNCTION_EQUAL; -// SEffect.m_PassOp = STENCILOPERATION_KEEP; -// SEffect.m_FailOp = STENCILOPERATION_KEEP; -// SEffect.m_ZFailOp = STENCILOPERATION_KEEP; -// SEffect.SetStencilState(pRC); -// -// switch (CFG::Outlines_Style) -// { -// case 0: -// { -// pRC->DrawScreenSpaceRectangle(m_pMatHaloAddToScreen, 0, 0, w, h, 0.0f, 0.0f, w - 1, h - 1, w, h); -// break; -// } -// -// case 1: -// { -// pRC->DrawScreenSpaceRectangle(m_pMatHaloAddToScreen, -1, -1, w, h, 0.0f, 0.0f, w - 1, h - 1, w, h); -// pRC->DrawScreenSpaceRectangle(m_pMatHaloAddToScreen, -1, 1, w, h, 0.0f, 0.0f, w - 1, h - 1, w, h); -// pRC->DrawScreenSpaceRectangle(m_pMatHaloAddToScreen, 1, -1, w, h, 0.0f, 0.0f, w - 1, h - 1, w, h); -// pRC->DrawScreenSpaceRectangle(m_pMatHaloAddToScreen, 1, 1, w, h, 0.0f, 0.0f, w - 1, h - 1, w, h); -// break; -// } -// -// case 2: -// { -// pRC->DrawScreenSpaceRectangle(m_pMatHaloAddToScreen, -2, -1, w, h, 0.0f, 0.0f, w - 1, h - 1, w, h); -// pRC->DrawScreenSpaceRectangle(m_pMatHaloAddToScreen, 2, 1, w, h, 0.0f, 0.0f, w - 1, h - 1, w, h); -// pRC->DrawScreenSpaceRectangle(m_pMatHaloAddToScreen, -2, -1, w, h, 0.0f, 0.0f, w - 1, h - 1, w, h); -// pRC->DrawScreenSpaceRectangle(m_pMatHaloAddToScreen, 2, 1, w, h, 0.0f, 0.0f, w - 1, h - 1, w, h); -// break; -// } -// -// case 3: -// { -// pRC->DrawScreenSpaceRectangle(m_pMatHaloAddToScreen, -2, -2, w, h, 0.0f, 0.0f, w - 1, h - 1, w, h); -// pRC->DrawScreenSpaceRectangle(m_pMatHaloAddToScreen, -2, 2, w, h, 0.0f, 0.0f, w - 1, h - 1, w, h); -// pRC->DrawScreenSpaceRectangle(m_pMatHaloAddToScreen, 2, -2, w, h, 0.0f, 0.0f, w - 1, h - 1, w, h); -// pRC->DrawScreenSpaceRectangle(m_pMatHaloAddToScreen, 2, 2, w, h, 0.0f, 0.0f, w - 1, h - 1, w, h); -// break; -// } -// -// default: break; -// } -// -// StencilStateDisable.SetStencilState(pRC); -// -// I::ModelRender->ForcedMaterialOverride(nullptr); -// I::RenderView->SetColorModulation(flOriginalColor); -// I::RenderView->SetBlend(flOriginalBlend); -//} -// -//void CFeatures_Glow::CleanUp() -//{ -// m_bCleaningUp = true; -// -// if (m_pMatHaloAddToScreen) -// { -// m_pMatHaloAddToScreen->DecrementReferenceCount(); -// m_pMatHaloAddToScreen->DeleteIfUnreferenced(); -// m_pMatHaloAddToScreen = nullptr; -// } -// -// if (m_pRenderBuffer0) -// { -// m_pRenderBuffer0->DecrementReferenceCount(); -// m_pRenderBuffer0->DeleteIfUnreferenced(); -// m_pRenderBuffer0 = nullptr; -// } -// -// if (m_pRenderBuffer1) -// { -// m_pRenderBuffer1->DecrementReferenceCount(); -// m_pRenderBuffer1->DeleteIfUnreferenced(); -// m_pRenderBuffer1 = nullptr; -// } -// -// if (m_pMatBlurX) -// { -// m_pMatBlurX->DecrementReferenceCount(); -// m_pMatBlurX->DeleteIfUnreferenced(); -// m_pMatBlurX = nullptr; -// } -// -// if (m_pMatBlurY) -// { -// m_pMatBlurY->DecrementReferenceCount(); -// m_pMatBlurY->DeleteIfUnreferenced(); -// m_pMatBlurY = nullptr; -// } -// -// m_bCleaningUp = false; -//} -// -//void CFeatures_Glow::SetModelStencil(IMatRenderContext* pRenderContext) -//{ -// ShaderStencilState_t State = {}; -// State.m_bEnable = true; -// State.m_nReferenceValue = 1; -// State.m_CompareFunc = STENCILCOMPARISONFUNCTION_ALWAYS; -// State.m_PassOp = STENCILOPERATION_REPLACE; -// State.m_FailOp = STENCILOPERATION_KEEP; -// State.m_ZFailOp = STENCILOPERATION_REPLACE; -// State.SetStencilState(pRenderContext); -//} \ No newline at end of file diff --git a/Arsenal/Features/Glow/Glow.h b/Arsenal/Features/Glow/Glow.h deleted file mode 100644 index 556cff9..0000000 --- a/Arsenal/Features/Glow/Glow.h +++ /dev/null @@ -1,61 +0,0 @@ -//#pragma once -// -//#include "../../SDK/SDK.h" -// -//class CFeatures_Glow -//{ -//private: -// IMaterial* m_pMatGlowColor = nullptr, * m_pMatHaloAddToScreen = nullptr; -// ITexture* m_pRtFullFrame = nullptr, * m_pRenderBuffer0 = nullptr, * m_pRenderBuffer1 = nullptr; -// IMaterial* m_pMatBlurX = nullptr, * m_pMatBlurY = nullptr; -// IMaterialVar* m_pBloomAmount = nullptr; -// -// void Initialize(); -// -// std::map m_mapDrawnEntities = {}; -// bool m_bRendering = false; -// bool m_bRenderingOutlines = false; -// bool m_bCleaningUp = false; -// -// void DrawEntity(C_BaseEntity* pEntity, bool bModel); -// -//private: -// struct OutlineEntity_t -// { -// C_BaseEntity* m_pEntity = nullptr; -// Color_t m_Color = {}; -// float m_flAlpha = 0.0f; -// }; -// -// std::vector m_vecOutlineEntities = {}; -// -//public: -// void RunModels(); -// void Run(); -// void CleanUp(); -// void SetModelStencil(IMatRenderContext* pRenderContext); -// -// inline bool HasDrawn(C_BaseEntity* pEntity) { -// return m_mapDrawnEntities.find(pEntity) != m_mapDrawnEntities.end(); -// } -// -// inline bool IsRendering() { -// return m_bRendering; -// } -// -// inline bool IsRenderingOutlines() { -// return m_bRenderingOutlines; -// } -// -// inline bool IsUsedMaterial(IMaterial* pMaterial) -// { -// return pMaterial == m_pMatGlowColor -// || pMaterial == m_pMatBlurX -// || pMaterial == m_pMatBlurY -// || pMaterial == m_pMatHaloAddToScreen; -// } -// -// inline bool IsCleaningUp() { return m_bCleaningUp; } -//}; -// -//namespace F { inline CFeatures_Glow Glow; } \ No newline at end of file diff --git a/Arsenal/Features/Menu/Menu.cpp b/Arsenal/Features/Menu/Menu.cpp index 22c0020..2191355 100644 --- a/Arsenal/Features/Menu/Menu.cpp +++ b/Arsenal/Features/Menu/Menu.cpp @@ -5,7 +5,6 @@ #include "../CFG.h" #include "../Notification/Notification.h" - #define multiselect(label, unique, ...) static std::vector> unique##multiselect = __VA_ARGS__; \ SelectMulti(label, unique##multiselect) @@ -1120,8 +1119,8 @@ void CFeatures_Menu::MainWindow() if (Button("Misc", MainTab == EMainTabs::MISC, CFG::Menu_Tab_Button_Width)) MainTab = EMainTabs::MISC; - /*if (Button("Players", MainTab == EMainTabs::PLAYERS, CFG::Menu_Tab_Button_Width)) - MainTab = EMainTabs::PLAYERS;*/ + if (Button("Players", MainTab == EMainTabs::PLAYERS, CFG::Menu_Tab_Button_Width)) + MainTab = EMainTabs::PLAYERS; if (Button("Configs", MainTab == EMainTabs::CONFIGS, CFG::Menu_Tab_Button_Width)) MainTab = EMainTabs::CONFIGS; @@ -1139,7 +1138,7 @@ void CFeatures_Menu::MainWindow() if (MainTab == EMainTabs::VISUALS) { - enum class EVisualsTabs { ESP, RADAR, MATERIALS, OUTLINES, OTHER, OTHER2, COLORS }; + enum class EVisualsTabs { ESP, OTHER, COLORS }; static EVisualsTabs VisualsTab = EVisualsTabs::ESP; int anchor_x = m_nCursorX; @@ -1282,6 +1281,7 @@ void CFeatures_Menu::MainWindow() ColorPicker("Counter-Terrorists", CFG::Colors_TeamCT); } ColorPicker("Planted C4", CFG::Colors_PlantedC4); + ColorPicker("Dropped Weapons", CFG::Colors_DroppedWeapons); } GroupBoxEnd(); } @@ -1302,7 +1302,7 @@ void CFeatures_Menu::MainWindow() GroupBoxEnd(); } - /*if (MainTab == EMainTabs::PLAYERS) + if (MainTab == EMainTabs::PLAYERS) { m_nCursorX += CFG::Menu_Spacing_X; @@ -1322,24 +1322,24 @@ void CFeatures_Menu::MainWindow() continue; } - players::PlayerInfo custom_info{}; + PlayerManager::PlayerInfo custom_info{}; - players::getInfo(n, custom_info); + PlayerManager::GetInfo(n, custom_info); auto bx{ m_nCursorX }; auto by{ m_nCursorY }; - if (custom_info.m_ignored) + if (custom_info.m_bIgnored) { playerListButton(Util::ConvertUtf8ToWide(player_info.name).c_str(), 150, CFG::Color_Friend, false); } - else if (custom_info.m_cheater) + else if (custom_info.m_bCheater) { playerListButton(Util::ConvertUtf8ToWide(player_info.name).c_str(), 150, CFG::Color_Cheater, false); } - else if (custom_info.m_retard_legit) + else if (custom_info.m_bRetardLegit) { playerListButton(Util::ConvertUtf8ToWide(player_info.name).c_str(), 150, CFG::Color_RetardLegit, false); } @@ -1352,25 +1352,25 @@ void CFeatures_Menu::MainWindow() m_nCursorX += m_nLastButtonW + CFG::Menu_Spacing_X; m_nCursorY = by; - if (playerListButton(L"ignored", 60, custom_info.m_ignored ? CFG::Color_Friend : CFG::Menu_Text_Inactive, true)) + if (playerListButton(L"Ignored", 60, custom_info.m_bIgnored ? CFG::Color_Friend : CFG::Menu_Text_Inactive, true)) { - players::mark(n, { !custom_info.m_ignored, false }); + PlayerManager::Mark(n, {!custom_info.m_bIgnored, false}); } m_nCursorX += m_nLastButtonW + CFG::Menu_Spacing_X; m_nCursorY = by; - if (playerListButton(L"cheater", 60, custom_info.m_cheater ? CFG::Color_Cheater : CFG::Menu_Text_Inactive, true)) + if (playerListButton(L"Cheater", 60, custom_info.m_bCheater ? CFG::Color_Cheater : CFG::Menu_Text_Inactive, true)) { - players::mark(n, { false, !custom_info.m_cheater }); + PlayerManager::Mark(n, { false, !custom_info.m_bCheater }); } m_nCursorX += m_nLastButtonW + CFG::Menu_Spacing_X; m_nCursorY = by; - if (playerListButton(L"retard legit", 60, custom_info.m_retard_legit ? CFG::Color_RetardLegit : CFG::Menu_Text_Inactive, true)) + if (playerListButton(L"Retard Legit", 60, custom_info.m_bRetardLegit ? CFG::Color_RetardLegit : CFG::Menu_Text_Inactive, true)) { - players::mark(n, { false, false, !custom_info.m_retard_legit }); + PlayerManager::Mark(n, { false, false, !custom_info.m_bRetardLegit }); } m_nCursorX = bx; @@ -1380,7 +1380,7 @@ void CFeatures_Menu::MainWindow() } } } - */ + if (MainTab == EMainTabs::CONFIGS) { static std::string strSelected = {}; @@ -1392,6 +1392,9 @@ void CFeatures_Menu::MainWindow() if (std::string(std::filesystem::path(entry).filename().string()).find(".json") == std::string_view::npos) continue; + if (std::string(std::filesystem::path(entry).filename().string()).find("players.json") != std::string_view::npos) + continue; + nCount++; } @@ -1411,6 +1414,9 @@ void CFeatures_Menu::MainWindow() if (std::string(std::filesystem::path(entry).filename().string()).find(".json") == std::string_view::npos) continue; + if (std::string(std::filesystem::path(entry).filename().string()).find("players.json") != std::string_view::npos) + continue; + if (!std::string(std::filesystem::path(entry).filename().string()).compare(strInput)) return true; } @@ -1439,6 +1445,9 @@ void CFeatures_Menu::MainWindow() if (std::string(std::filesystem::path(entry).filename().string()).find(".json") == std::string_view::npos) continue; + if (std::string(std::filesystem::path(entry).filename().string()).find("players.json") != std::string_view::npos) + continue; + std::string s = entry.path().filename().string(); s.erase(s.end() - 5, s.end()); diff --git a/Arsenal/Features/Players/Players.cpp b/Arsenal/Features/Players/Players.cpp new file mode 100644 index 0000000..4677786 --- /dev/null +++ b/Arsenal/Features/Players/Players.cpp @@ -0,0 +1,192 @@ +#include "Players.h" +#include "../../SDK/SDK.h" + +struct Player +{ + hash::hash_t m_iSteamID{}; + PlayerManager::PlayerInfo m_Info{}; +}; + +std::vector m_vecPlayers{}; +std::string m_szLogPath{}; + +void PlayerManager::Parse() +{ + if (m_szLogPath.empty()) + { + m_szLogPath = std::filesystem::current_path().string() + "\\Arsenal"; + + if (!std::filesystem::exists(m_szLogPath)) + { + std::filesystem::create_directories(m_szLogPath); + } + + m_szLogPath += "\\players.json"; + + if (!std::filesystem::exists(m_szLogPath)) + { + std::ofstream file(m_szLogPath, std::ios::app); + + if (!file.is_open()) + { + return; + } + + file.close(); + } + } + + if (!m_vecPlayers.empty()) + { + return; + } + + std::ifstream file(m_szLogPath); + + if (!file.is_open() || file.peek() == std::ifstream::traits_type::eof()) + { + return; + } + + nlohmann::json j{}; + + file >> j; + + for (const auto& item : j.items()) + { + Player p + { + HASH_RT(item.key().c_str()), + { + j[item.key()]["ignored"].get(), + j[item.key()]["cheater"].get(), + j[item.key()]["retardlegit"].get() + } + }; + + m_vecPlayers.push_back(p); + } +} + +void PlayerManager::Mark(int entindex, const PlayerInfo& info) +{ + if (entindex == I::EngineClient->GetLocalPlayer()) + { + return; + } + + player_info_t player_info{}; + + if (!I::EngineClient->GetPlayerInfo(entindex, &player_info) || player_info.fakeplayer) + { + return; + } + + Player* ptr{}; + + auto steam_id{ HASH_RT(std::string_view(player_info.guid).data()) }; + + for (auto& pl : m_vecPlayers) + { + if (pl.m_iSteamID != steam_id) + { + continue; + } + + ptr = &pl; + + break; + } + + if (!ptr) + { + m_vecPlayers.push_back({ steam_id, info }); + + ptr = &m_vecPlayers.back(); + } + + ptr->m_Info = info; + + nlohmann::json j{}; + + std::ifstream read_file(m_szLogPath); + + if (read_file.is_open() && read_file.peek() != std::ifstream::traits_type::eof()) + { + read_file >> j; + } + + read_file.close(); + + std::ofstream file(m_szLogPath); + + if (!file.is_open()) + { + return; + } + + auto key{ std::string(player_info.guid) }; + + j[key]["ignored"] = ptr->m_Info.m_bIgnored; + j[key]["cheater"] = ptr->m_Info.m_bCheater; + j[key]["retardlegit"] = ptr->m_Info.m_bRetardLegit; + + if (!ptr->m_Info.m_bIgnored && !ptr->m_Info.m_bCheater && !ptr->m_Info.m_bRetardLegit) + { + j.erase(std::string(player_info.guid)); + } + + file << std::setw(4) << j; + + file.close(); +} + +bool PlayerManager::GetInfo(int entindex, PlayerInfo& out) +{ + if (entindex == I::EngineClient->GetLocalPlayer()) + { + return false; + } + + player_info_t player_info{}; + + if (!I::EngineClient->GetPlayerInfo(entindex, &player_info) || player_info.fakeplayer) + { + return false; + } + + auto steam_id{ HASH_RT(std::string_view(player_info.guid).data()) }; + + for (const auto& pl : m_vecPlayers) + { + if (pl.m_iSteamID != steam_id) + { + continue; + } + + out = pl.m_Info; + + return true; + } + + return false; +} + +bool PlayerManager::GetInfoGUID(const std::string& guid, PlayerInfo& out) +{ + auto steam_id{ HASH_RT(guid.c_str()) }; + + for (const auto& pl : m_vecPlayers) + { + if (pl.m_iSteamID != steam_id) + { + continue; + } + + out = pl.m_Info; + + return true; + } + + return false; +} \ No newline at end of file diff --git a/Arsenal/Features/Players/Players.h b/Arsenal/Features/Players/Players.h new file mode 100644 index 0000000..05a5936 --- /dev/null +++ b/Arsenal/Features/Players/Players.h @@ -0,0 +1,17 @@ +#pragma once +#include + +namespace PlayerManager +{ + struct PlayerInfo + { + bool m_bIgnored{}; + bool m_bCheater{}; + bool m_bRetardLegit{}; + }; + + void Parse(); + void Mark(int entindex, const PlayerInfo& info); + bool GetInfo(int entindex, PlayerInfo& out); + bool GetInfoGUID(const std::string& guid, PlayerInfo& out); +} \ No newline at end of file diff --git a/Arsenal/Features/SpectatorList/SpectatorList.cpp b/Arsenal/Features/SpectatorList/SpectatorList.cpp index 412bdfa..c248458 100644 --- a/Arsenal/Features/SpectatorList/SpectatorList.cpp +++ b/Arsenal/Features/SpectatorList/SpectatorList.cpp @@ -47,12 +47,12 @@ void CFeatures_SpectatorList::Run() int y = H::Draw.m_nScreenH / 4; EAlign align = ALIGN_TOP; - if (x <= (100 + 50)) + if (x <= 150) { x -= 42; align = ALIGN_TOPLEFT; } - else if (x >= H::Draw.m_nScreenW - (100 + 50)) + else if (x >= H::Draw.m_nScreenW - 150) { x += 42; align = ALIGN_TOPRIGHT; diff --git a/Arsenal/Hooks/Definitions/ModelRender_DrawModelExecute.cpp b/Arsenal/Hooks/Definitions/ModelRender_DrawModelExecute.cpp index a46339d..9ace289 100644 --- a/Arsenal/Hooks/Definitions/ModelRender_DrawModelExecute.cpp +++ b/Arsenal/Hooks/Definitions/ModelRender_DrawModelExecute.cpp @@ -2,24 +2,5 @@ // //DEFINE_HOOK(ModelRender_DrawModelExecute, void, __fastcall, void* ecx, const DrawModelState_t& state, const ModelRenderInfo_t& pInfo, matrix3x4_t* pCustomBoneToWorld) //{ -// if (CFG::Visual_ClearScreenshots && I::EngineClient->IsTakingScreenshot()) -// return Func.Original()(ecx, state, pInfo, pCustomBoneToWorld); // -// if (F::Chams.bRendering) -// return F::Chams.RenderHandler(pState, pInfo, pBoneToWorld); -// if (F::Glow.bRendering) -// return F::Glow.RenderHandler(pState, pInfo, pBoneToWorld); -// -// if (F::Chams.mEntities[pInfo.entity_index]) -// return; -// -// const auto& pEntity = I::ClientEntityList->GetClientEntity(pInfo.entity_index); -// if (pEntity && pEntity->GetClassID() == ETFClassID::CTFViewModel) -// { -// F::Glow.RenderViewmodel(pState, pInfo, pBoneToWorld); -// if (F::Chams.RenderViewmodel(pState, pInfo, pBoneToWorld)) -// return; -// } -// -// CALL_ORIGINAL(ecx, pState, pInfo, pBoneToWorld); //} \ No newline at end of file diff --git a/Arsenal/Hooks/Hooks.cpp b/Arsenal/Hooks/Hooks.cpp index 3551f73..82106ed 100644 --- a/Arsenal/Hooks/Hooks.cpp +++ b/Arsenal/Hooks/Hooks.cpp @@ -14,6 +14,7 @@ void CGlobal_Hooks::Initialize() Hooks::IBaseClientDLL_LevelShutdown::Initialize(); Hooks::CPrediction_RunCommand::Initialize(); Hooks::CBasePlayer_CalcPlayerView::Initialize(); + //Hooks::ModelRender_DrawModelExecute::Initialize(); XASSERT(MH_EnableHook(MH_ALL_HOOKS) != MH_STATUS::MH_OK); diff --git a/Arsenal/SDK/SDK.h b/Arsenal/SDK/SDK.h index b4c6868..846f42a 100644 --- a/Arsenal/SDK/SDK.h +++ b/Arsenal/SDK/SDK.h @@ -4,9 +4,9 @@ #include "EntityCacher/EntityCacher.h" #include "../Features/CFG.h" #include "DrawManager/DrawManager.h" - #include #include "../Util/Icons.h" +#include "../Features/Players/Players.h" namespace Util { @@ -151,33 +151,50 @@ namespace Util return !(flRight < 0 || flLeft > H::Draw.m_nScreenW || flTop < 0 || flBottom > H::Draw.m_nScreenH); } - inline Color_t GetHealthColor(const int nHealth, const int nMaxHealth) + inline Color_t GetEntityColor(C_CSPlayer* pLocal, C_BaseEntity* pEntity, bool bRelativeColors) { - if (nHealth > nMaxHealth) - return { 15, 150, 150, 255 }; + if (!pLocal || !pEntity) + return { 245, 229, 196, 255 }; - const int nHP = U::Math.Max(0, U::Math.Min(nHealth, nMaxHealth)); + if (pEntity->GetClassID() == ECSClientClass::CCSPlayer) + { + auto pPlayer = pEntity->As(); - const unsigned int nR = static_cast(U::Math.Min((510 * (nMaxHealth - nHP)) / nMaxHealth, 200)); - const unsigned int nG = static_cast(U::Math.Min((510 * nHP) / nMaxHealth, 200)); + if (pPlayer != pLocal) + { + PlayerManager::PlayerInfo custom_info{}; - return { static_cast(nR), static_cast(nG), 0, 255 }; - } + PlayerManager::GetInfo(pPlayer->entindex(), custom_info); + + if (custom_info.m_bIgnored) + { + return CFG::Color_Friend; + } + + if (custom_info.m_bCheater) + { + return CFG::Color_Cheater; + } + + if (custom_info.m_bRetardLegit) + { + return CFG::Color_RetardLegit; + } + } + } - inline Color_t GetTeamColor(const int iTargetTeam, const int iLocalTeam, bool bRelativeColors) - { if (bRelativeColors) - return iLocalTeam == iTargetTeam ? CFG::Colors_Team : CFG::Colors_Enemy; + return pLocal->m_iTeamNum() == pEntity->m_iTeamNum() ? CFG::Colors_Team : CFG::Colors_Enemy; else { - switch (iTargetTeam) + switch (pEntity->m_iTeamNum()) { - case 2: return CFG::Colors_TeamT; - case 3: return CFG::Colors_TeamCT; + case 2: return CFG::Colors_TeamT; + case 3: return CFG::Colors_TeamCT; } } - return Color_t(245, 229, 196, 255); + return { 245, 229, 196, 255 }; } inline std::wstring ConvertUtf8ToWide(const std::string& ansi) @@ -212,51 +229,4 @@ namespace Util return result; } - - inline void MakeSafeName(const char* oldName, char* newName, int newNameBufSize) - { - assert(newNameBufSize >= sizeof(newName[0])); - - int newpos = 0; - - for (const char* p = oldName; *p != 0 && newpos < newNameBufSize - 1; p++) - { - //check for a '#' char at the beginning - if (p == oldName && *p == '#') - { - newName[newpos] = '*'; - newpos++; - } - else if (*p == '%') - { - // remove % chars - newName[newpos] = '*'; - newpos++; - } - else if (*p == '&') - { - //insert another & after this one - if (newpos + 2 < newNameBufSize) - { - newName[newpos] = '&'; - newName[newpos + 1] = '&'; - newpos += 2; - } - } - else - { - newName[newpos] = *p; - newpos++; - } - } - newName[newpos] = 0; - } - - inline const char* SafeName(const char* oldName) - { - static char safeName[MAX_PLAYER_NAME_LENGTH * 2 + 1]; - MakeSafeName(oldName, safeName, sizeof(safeName)); - - return safeName; - } } \ No newline at end of file diff --git a/Arsenal/Util/Hash/Hash.cpp b/Arsenal/Util/Hash/Hash.cpp deleted file mode 100644 index 0ed43f6..0000000 --- a/Arsenal/Util/Hash/Hash.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "Hash.h" - -//Slooooow -int CUtil_Hash::String(const char* szOrg) -{ - int iHash = 5381; - - while (int iStr = *szOrg++) - iHash = iHash * 33 + iStr; - - return iHash; -} \ No newline at end of file diff --git a/Arsenal/Util/Hash/Hash.h b/Arsenal/Util/Hash/Hash.h index aba2799..08a5a7a 100644 --- a/Arsenal/Util/Hash/Hash.h +++ b/Arsenal/Util/Hash/Hash.h @@ -1,13 +1,98 @@ #pragma once - #include "../Offsets/Offsets.h" -class CUtil_Hash +namespace character +{ + template + constexpr bool isUpper(const type character) + { + return (character >= static_cast(65) && character <= static_cast(90)); + } + + template + constexpr type toLower(const type character) + { + if (isUpper(character)) + { + return character + static_cast(32); + } + + return character; + } + + template + constexpr bool isTerminator(const type character) + { + return (character == static_cast(0)); + } + + template + constexpr bool isQuestion(const type character) + { + return (character == static_cast(63)); + } + + template + constexpr size_t getLength(const type* const data) + { + size_t length{ 0 }; + + while (true) + { + if (isTerminator(data[length])) + { + break; + } + + length++; + } + + return length; + } +} + +namespace hash { -public: - int String(const char* szOrg); -}; + using hash_t = unsigned int; + + constexpr auto hash_prime = 0x1000193u; + constexpr auto hash_basis = 0x811C9DC5u; + + template + constexpr hash_t hash_compute(hash_t hash_basis, const type* data, size_t size, bool ignore_case) + { + if (size == 0) + { + return hash_basis; + } + + const auto element = static_cast(ignore_case ? character::toLower(data[0]) : data[0]); + + return hash_compute((hash_basis ^ element) * hash_prime, data + 1, size - 1, ignore_case); + } + + template + constexpr hash_t fnv1a32_hash(const type* const data, size_t size, bool ignore_case) + { + return hash_compute(hash_basis, data, size, ignore_case); + } + + constexpr hash_t fnv1a32_hash(const char* const data, bool ignore_case) + { + return fnv1a32_hash(data, character::getLength(data), ignore_case); + } + + constexpr hash_t fnv1a32_hash(const wchar_t* const data, bool ignore_case) + { + return fnv1a32_hash(data, character::getLength(data), ignore_case); + } +} -namespace U { inline CUtil_Hash Hash; } +#define HASH_CT(data)\ +[&]() \ +{ \ + constexpr auto hash = hash::fnv1a32_hash(data, true);\ + return hash;\ +}() -#define HASH_RT(str) U::Hash.String(str) \ No newline at end of file +#define HASH_RT(data) hash::fnv1a32_hash(data, true) \ No newline at end of file