tab_start("SkinChanger#2", column_1, 0, size_a_x + 600, size_d_y);
{
// we need to count our items in 1 line
auto same_line_counter = 0;
ImGui::SetCursorPosX(8);
// if we didnt choose any weapon
if (current_profile == -1)
{
for (auto i = 0; i < g_cfg.skins.skinChanger.size(); i++)
{
// do we need update our preview for some reasons?
if (!all_skins[i])
{
g_cfg.skins.skinChanger.at(i).update();
all_skins[i] = get_skin_preview(get_wep(i, (i == 34 || i == 35) ? g_cfg.skins.skinChanger.at(i).definition_override_vector_index : -1, i == 0).c_str(), g_cfg.skins.skinChanger.at(i).skin_name, device); //-V810
}
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(51 / 255.f, 51 / 255.f, 51 / 255.f, 1.f));
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0, 0, 0, 0));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0, 0, 0, 0));
ImGui::BeginGroup();
// we licked on weapon
if (ImGui::ImageButton(all_skins[i], ImVec2(100, 76)))
{
current_profile = i;
}
ImGui::Text(GetWeaponName(i));
ImGui::EndGroup();
ImGui::PopStyleColor(3);
if (same_line_counter < 4) {
ImGui::SameLine();
same_line_counter++;
}
else {
padding(8, 2);
same_line_counter = 0;
}
}
}
else
{
// update skin preview bool
static bool need_update[36];
// we pressed crypt_str("Save & Close") button
static bool leave;
// update if we have nullptr texture or if we push force update
if (!all_skins[current_profile] || need_update[current_profile])
{
all_skins[current_profile] = get_skin_preview(get_wep(current_profile, (current_profile == 34 || current_profile == 35) ? g_cfg.skins.skinChanger.at(current_profile).definition_override_vector_index : -1, current_profile == 34).c_str(), g_cfg.skins.skinChanger.at(current_profile).skin_name, device); //-V810
need_update[current_profile] = false;
}
// get settings for selected weapon
auto& selected_entry = g_cfg.skins.skinChanger[current_profile];
selected_entry.itemIdIndex = current_profile;
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(51 / 255.f, 51 / 255.f, 51 / 255.f, 1.f));
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0, 0, 0, 0));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0, 0, 0, 0));
ImGui::BeginGroup();
ImGui::PushItemWidth(290);
// search input later
static char search_skins[64] = "\0";
static auto item_index = selected_entry.paint_kit_vector_index;
if (current_profile == 34)
{
ImGui::Text(crypt_str("Knife"));
ImGui::SetCursorPosY(ImGui::GetCursorPosY() * c_menu::get().dpi_scale);
if (ImGui::Combo(crypt_str("##Knife_combo"), &selected_entry.definition_override_vector_index, [](void* data, int idx, const char** out_text)
{
*out_text = game_data::knife_names[idx].name;
return true;
}, nullptr, IM_ARRAYSIZE(game_data::knife_names)))
need_update[current_profile] = true; // push force update
}
else if (current_profile == 35)
{
ImGui::Text(crypt_str("Gloves"));
ImGui::SetCursorPosY(ImGui::GetCursorPosY() * c_menu::get().dpi_scale);
if (ImGui::Combo(crypt_str("##Glove_combo"), &selected_entry.definition_override_vector_index, [](void* data, int idx, const char** out_text)
{
*out_text = game_data::glove_names[idx].name;
return true;
}, nullptr, IM_ARRAYSIZE(game_data::glove_names)))
{
item_index = 0; // set new generated paintkits element to 0;
need_update[current_profile] = true; // push force update
}
}
else
selected_entry.definition_override_vector_index = 0;
if (current_profile != 35)
{
ImGui::Text(crypt_str("Search"));
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.f);
if (ImGui::InputText(crypt_str("##search"), search_skins, sizeof(search_skins)))
item_index = -1;
ImGui::PopStyleVar();
}
auto main_kits = current_profile == 35 ? SkinChanger::gloveKits : SkinChanger::skinKits;
auto display_index = 0;
SkinChanger::displayKits = main_kits;
// we dont need custom gloves
if (current_profile == 35)
{
for (auto i = 0; i < main_kits.size(); i++)
{
auto main_name = main_kits.at(i).name;
for (auto i = 0; i < main_name.size(); i++)
if (iswalpha((main_name.at(i))))
main_name.at(i) = towlower(main_name.at(i));
char search_name[64];
if (!strcmp(game_data::glove_names[selected_entry.definition_override_vector_index].name, crypt_str("Hydra")))
strcpy_s(search_name, sizeof(search_name), crypt_str("Bloodhound"));
else
strcpy_s(search_name, sizeof(search_name), game_data::glove_names[selected_entry.definition_override_vector_index].name);
for (auto i = 0; i < sizeof(search_name); i++)
if (iswalpha(search_name[i]))
search_name[i] = towlower(search_name[i]);
if (main_name.find(search_name) != std::string::npos)
{
SkinChanger::displayKits.at(display_index) = main_kits.at(i);
display_index++;
}
}
SkinChanger::displayKits.erase(SkinChanger::displayKits.begin() + display_index, SkinChanger::displayKits.end());
}
else
{
if (strcmp(search_skins, crypt_str(""))) //-V526
{
for (auto i = 0; i < main_kits.size(); i++)
{
auto main_name = main_kits.at(i).name;
for (auto i = 0; i < main_name.size(); i++)
if (iswalpha(main_name.at(i)))
main_name.at(i) = towlower(main_name.at(i));
char search_name[64];
strcpy_s(search_name, sizeof(search_name), search_skins);
for (auto i = 0; i < sizeof(search_name); i++)
if (iswalpha(search_name[i]))
search_name[i] = towlower(search_name[i]);
if (main_name.find(search_name) != std::string::npos)
{
SkinChanger::displayKits.at(display_index) = main_kits.at(i);
display_index++;
}
}
SkinChanger::displayKits.erase(SkinChanger::displayKits.begin() + display_index, SkinChanger::displayKits.end());
}
else
item_index = selected_entry.paint_kit_vector_index;
}
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.f);
if (!SkinChanger::displayKits.empty())
{
if (ImGui::ListBox(crypt_str("##PAINTKITS"), &item_index, [](void* data, int idx, const char** out_text) //-V107
{
while (SkinChanger::displayKits.at(idx).name.find(crypt_str("С‘")) != std::string::npos) //-V807
SkinChanger::displayKits.at(idx).name.replace(SkinChanger::displayKits.at(idx).name.find(crypt_str("С‘")), 2, crypt_str("Рµ"));
*out_text = SkinChanger::displayKits.at(idx).name.c_str();
return true;
}, nullptr, SkinChanger::displayKits.size(), SkinChanger::displayKits.size() > 9 ? 9 : SkinChanger::displayKits.size()) || !all_skins[current_profile])
{
SkinChanger::scheduleHudUpdate();
need_update[current_profile] = true;
auto i = 0;
while (i < main_kits.size())
{
if (main_kits.at(i).id == SkinChanger::displayKits.at(item_index).id)
{
selected_entry.paint_kit_vector_index = i;
break;
}
i++;
}
}
}
ImGui::PopStyleVar();
ImGui::PushItemWidth(290 - ImGui::CalcTextSize("Seed").x - ImGui::GetStyle().ItemInnerSpacing.x);
if (ImGui::InputInt(crypt_str("Seed"), &selected_entry.seed, 1, 100))
SkinChanger::scheduleHudUpdate();
ImGui::PopItemWidth();
ImGui::PushItemWidth(290 - ImGui::CalcTextSize("StatTrak").x - ImGui::GetStyle().ItemInnerSpacing.x);
if (ImGui::InputInt(crypt_str("StatTrak"), &selected_entry.stat_trak, 1, 15))
SkinChanger::scheduleHudUpdate();
ImGui::PopItemWidth();
if (current_profile != 1)
{
if (!g_cfg.skins.custom_name_tag[current_profile].empty())
strcpy_s(selected_entry.custom_name, sizeof(selected_entry.custom_name), g_cfg.skins.custom_name_tag[current_profile].c_str());
ImGui::SetCursorPosX(8);
ImGui::Text(crypt_str("Name Tag"));
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.f);
ImGui::SetCursorPosX(8);
if (ImGui::InputText(crypt_str("##nametag"), selected_entry.custom_name, sizeof(selected_entry.custom_name)))
{
g_cfg.skins.custom_name_tag[current_profile] = selected_entry.custom_name;
SkinChanger::scheduleHudUpdate();
}
ImGui::PopStyleVar();
}
ImGui::PopItemWidth();
ImGui::EndGroup();
ImGui::SetCursorPos(ImVec2(ImGui::GetCursorPosX() + 305, 15));
ImGui::BeginChild("##seett", ImVec2(280, 430));
ImGui::PushItemWidth(240);
if (ImGui::SliderFloat(crypt_str("Wear"), &selected_entry.wear, 0.0f, 1.0f))
drugs = true;
else if (drugs)
{
SkinChanger::scheduleHudUpdate();
drugs = false;
}
ImGui::SetCursorPosY(ImGui::GetCursorPosY() * c_menu::get().dpi_scale);
ImGui::SetCursorPosX(8);
ImGui::Text(crypt_str("Quality"));
ImGui::SetCursorPosY(ImGui::GetCursorPosY() * c_menu::get().dpi_scale);
if (ImGui::Combo(crypt_str("##Quality_combo"), &selected_entry.entity_quality_vector_index, [](void* data, int idx, const char** out_text)
{
*out_text = game_data::quality_names[idx].name;
return true;
}, nullptr, IM_ARRAYSIZE(game_data::quality_names)))
SkinChanger::scheduleHudUpdate();
ImGui::PopItemWidth();
ImGui::Checkbox(crypt_str("Force rare animations"), &g_cfg.skins.rare_animations);
ImGui::SetCursorPosX(8);
if (ImGui::ImageButton(all_skins[current_profile], ImVec2(256, 214)))
{
// maybe i will do smth later where, who knows :/
}
ImGui::SetCursorPosX(8);
if (ImGui::CustomButton(crypt_str("Close"), crypt_str("##CLOSE__SKING"), ImVec2(264, 20)))
{
next_id = -1;
leave = true;
}
//
ImGui::EndChild();
ImGui::PopStyleColor(3);
// update element
selected_entry.update();
// we need to reset profile in the end to prevent render images with massive's index == -1
if (leave)
{
ImGui::SetScrollY(0);
current_profile = next_id;
leave = false;
}
}
}