2022-05-04 19:16:40 +02:00
|
|
|
#include "core/data/custom_weapons.hpp"
|
|
|
|
#include "fiber_pool.hpp"
|
2022-06-30 00:11:54 +02:00
|
|
|
#include "natives.hpp"
|
2022-05-04 19:16:40 +02:00
|
|
|
#include "core/data/special_ammo_types.hpp"
|
2022-07-06 04:55:18 +08:00
|
|
|
#include "core/data/bullet_impact_types.hpp"
|
2022-07-29 19:51:19 +08:00
|
|
|
#include "services/gta_data/gta_data_service.hpp"
|
|
|
|
#include "gta/joaat.hpp"
|
2022-05-04 19:16:40 +02:00
|
|
|
#include "views/view.hpp"
|
2022-10-26 22:10:19 +02:00
|
|
|
#include "pointers.hpp"
|
2022-05-04 19:16:40 +02:00
|
|
|
|
|
|
|
namespace big
|
|
|
|
{
|
|
|
|
void view::weapons() {
|
2022-08-10 08:42:34 +08:00
|
|
|
components::sub_title("Ammo");
|
2022-05-04 19:16:40 +02:00
|
|
|
|
2022-11-30 03:16:07 +08:00
|
|
|
ImGui::BeginGroup();
|
2022-05-04 19:16:40 +02:00
|
|
|
|
2022-12-22 21:23:32 +00:00
|
|
|
components::command_checkbox<"infammo">();
|
|
|
|
components::command_checkbox<"infclip">();
|
2022-05-04 19:16:40 +02:00
|
|
|
|
2022-11-30 03:16:07 +08:00
|
|
|
ImGui::EndGroup();
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::BeginGroup();
|
2022-05-04 19:16:40 +02:00
|
|
|
|
2022-12-18 23:15:52 +01:00
|
|
|
if (ImGui::Checkbox("Bypass C4 Limit", &g.weapons.bypass_c4_limit))
|
2022-10-26 22:10:19 +02:00
|
|
|
{
|
2022-12-18 23:15:52 +01:00
|
|
|
if (g.weapons.bypass_c4_limit)
|
2022-11-23 06:12:40 +08:00
|
|
|
g_pointers->m_bypass_max_count_of_active_sticky_bombs->apply();
|
|
|
|
else
|
|
|
|
g_pointers->m_bypass_max_count_of_active_sticky_bombs->restore();
|
2022-10-26 22:10:19 +02:00
|
|
|
}
|
2022-12-22 21:23:32 +00:00
|
|
|
components::command_checkbox<"rapidfire">();
|
2022-11-30 03:16:07 +08:00
|
|
|
|
|
|
|
ImGui::EndGroup();
|
|
|
|
|
|
|
|
ImGui::Separator();
|
|
|
|
|
2022-12-18 23:15:52 +01:00
|
|
|
ImGui::Checkbox("Enable Special Ammo", &g.weapons.ammo_special.toggle);
|
2022-10-26 22:10:19 +02:00
|
|
|
|
2022-12-18 23:15:52 +01:00
|
|
|
eAmmoSpecialType selected_ammo = g.weapons.ammo_special.type;
|
|
|
|
eExplosionTag selected_explosion = g.weapons.ammo_special.explosion_tag;
|
2022-05-04 19:16:40 +02:00
|
|
|
|
2022-05-23 06:38:45 +08:00
|
|
|
if (ImGui::BeginCombo("Special Ammo", SPECIAL_AMMOS[(int)selected_ammo].name))
|
2022-05-04 19:16:40 +02:00
|
|
|
{
|
|
|
|
for (const auto& special_ammo : SPECIAL_AMMOS)
|
|
|
|
{
|
|
|
|
if (ImGui::Selectable(special_ammo.name, special_ammo.type == selected_ammo))
|
2022-07-29 19:51:19 +08:00
|
|
|
{
|
2022-12-18 23:15:52 +01:00
|
|
|
g.weapons.ammo_special.type = special_ammo.type;
|
2022-07-29 19:51:19 +08:00
|
|
|
}
|
2022-05-04 19:16:40 +02:00
|
|
|
|
|
|
|
if (special_ammo.type == selected_ammo)
|
2022-07-29 19:51:19 +08:00
|
|
|
{
|
2022-05-04 19:16:40 +02:00
|
|
|
ImGui::SetItemDefaultFocus();
|
2022-07-29 19:51:19 +08:00
|
|
|
}
|
2022-05-04 19:16:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ImGui::EndCombo();
|
|
|
|
}
|
|
|
|
|
2022-09-30 22:38:56 +02:00
|
|
|
if (ImGui::BeginCombo("Bullet Impact", BULLET_IMPACTS[selected_explosion]))
|
2022-07-06 04:55:18 +08:00
|
|
|
{
|
|
|
|
for (const auto& [type, name] : BULLET_IMPACTS)
|
|
|
|
{
|
2022-09-30 22:38:56 +02:00
|
|
|
if (ImGui::Selectable(name, type == selected_explosion))
|
2022-07-29 19:51:19 +08:00
|
|
|
{
|
2022-12-18 23:15:52 +01:00
|
|
|
g.weapons.ammo_special.explosion_tag = type;
|
2022-07-29 19:51:19 +08:00
|
|
|
}
|
2022-07-06 04:55:18 +08:00
|
|
|
|
2022-09-30 22:38:56 +02:00
|
|
|
if (type == selected_explosion)
|
2022-07-29 19:51:19 +08:00
|
|
|
{
|
2022-07-06 04:55:18 +08:00
|
|
|
ImGui::SetItemDefaultFocus();
|
2022-07-29 19:51:19 +08:00
|
|
|
}
|
2022-07-06 04:55:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
ImGui::EndCombo();
|
|
|
|
}
|
|
|
|
|
2022-05-04 19:16:40 +02:00
|
|
|
ImGui::Separator();
|
|
|
|
|
2022-08-10 08:42:34 +08:00
|
|
|
components::sub_title("Misc");
|
2022-05-04 19:16:40 +02:00
|
|
|
|
2022-12-22 21:23:32 +00:00
|
|
|
components::command_checkbox<"crosshairs">();
|
2022-05-04 19:16:40 +02:00
|
|
|
ImGui::SameLine();
|
2022-12-22 21:23:32 +00:00
|
|
|
components::command_checkbox<"norecoil">();
|
2022-05-04 19:16:40 +02:00
|
|
|
ImGui::SameLine();
|
2022-12-22 21:23:32 +00:00
|
|
|
components::command_checkbox<"nospread">();
|
2022-05-04 19:16:40 +02:00
|
|
|
|
2022-10-19 00:30:32 +02:00
|
|
|
components::button("Get All Weapons", []
|
|
|
|
{
|
|
|
|
for (const auto& [_, weapon] : g_gta_data_service->weapons())
|
2022-07-29 19:51:19 +08:00
|
|
|
{
|
2022-10-19 00:30:32 +02:00
|
|
|
WEAPON::GIVE_DELAYED_WEAPON_TO_PED(self::ped, weapon.m_hash, 9999, false);
|
2022-05-04 19:16:40 +02:00
|
|
|
}
|
2022-07-29 19:51:19 +08:00
|
|
|
|
|
|
|
constexpr auto parachute_hash = RAGE_JOAAT("GADGET_PARACHUTE");
|
|
|
|
WEAPON::GIVE_DELAYED_WEAPON_TO_PED(self::ped, parachute_hash, 0, true);
|
2022-10-19 00:30:32 +02:00
|
|
|
});
|
2022-05-23 06:38:45 +08:00
|
|
|
ImGui::SameLine();
|
2022-10-19 00:30:32 +02:00
|
|
|
components::button("Remove Current Weapon", []
|
|
|
|
{
|
2022-05-23 06:38:45 +08:00
|
|
|
Hash weaponHash;
|
|
|
|
WEAPON::GET_CURRENT_PED_WEAPON(self::ped, &weaponHash, 1);
|
2022-07-29 19:51:19 +08:00
|
|
|
if (weaponHash != RAGE_JOAAT("WEAPON_UNARMED"))
|
|
|
|
{
|
2022-05-23 06:38:45 +08:00
|
|
|
WEAPON::REMOVE_WEAPON_FROM_PED(self::ped, weaponHash);
|
|
|
|
}
|
2022-10-19 00:30:32 +02:00
|
|
|
});
|
2022-05-04 19:16:40 +02:00
|
|
|
|
2022-12-18 23:15:52 +01:00
|
|
|
ImGui::SliderFloat("Damage Multiplier", &g.weapons.increased_damage, 1.f, 10.f, "%.1f");
|
2022-05-04 19:16:40 +02:00
|
|
|
|
|
|
|
ImGui::Separator();
|
|
|
|
|
2022-08-10 08:42:34 +08:00
|
|
|
components::sub_title("Custom Weapons");
|
2022-05-04 19:16:40 +02:00
|
|
|
|
2022-12-18 23:15:52 +01:00
|
|
|
CustomWeapon selected = g.weapons.custom_weapon;
|
2022-05-04 19:16:40 +02:00
|
|
|
|
|
|
|
if (ImGui::BeginCombo("Weapon", custom_weapons[(int)selected].name))
|
|
|
|
{
|
|
|
|
for (const custom_weapon& weapon : custom_weapons)
|
|
|
|
{
|
|
|
|
if (ImGui::Selectable(weapon.name, weapon.id == selected))
|
|
|
|
{
|
2022-12-18 23:15:52 +01:00
|
|
|
g.weapons.custom_weapon = weapon.id;
|
2022-05-04 19:16:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (weapon.id == selected)
|
2022-07-29 19:51:19 +08:00
|
|
|
{
|
2022-05-04 19:16:40 +02:00
|
|
|
ImGui::SetItemDefaultFocus();
|
2022-07-29 19:51:19 +08:00
|
|
|
}
|
2022-05-04 19:16:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ImGui::EndCombo();
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (selected)
|
|
|
|
{
|
2023-01-16 22:16:06 +01:00
|
|
|
case CustomWeapon::GRAVITY_GUN:
|
|
|
|
ImGui::Checkbox("Launch on release", &g.weapons.gravity_gun.launch_on_release);
|
|
|
|
break;
|
2022-05-04 19:16:40 +02:00
|
|
|
case CustomWeapon::VEHICLE_GUN:
|
2022-12-18 23:15:52 +01:00
|
|
|
// this some ugly ass looking code
|
|
|
|
static char vehicle_gun[12];
|
|
|
|
std::memcpy(vehicle_gun, g.weapons.vehicle_gun_model.c_str(), 12);
|
|
|
|
if (ImGui::InputTextWithHint("Shooting Model", "Name of the vehicle model", vehicle_gun, sizeof(vehicle_gun)))
|
|
|
|
{
|
|
|
|
g.weapons.vehicle_gun_model = vehicle_gun;
|
|
|
|
}
|
|
|
|
if (ImGui::IsItemActive())
|
|
|
|
{
|
|
|
|
g_fiber_pool->queue_job([]
|
|
|
|
{
|
|
|
|
PAD::DISABLE_ALL_CONTROL_ACTIONS(0);
|
|
|
|
});
|
|
|
|
}
|
2022-05-04 19:16:40 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2022-06-27 15:59:25 +02:00
|
|
|
}
|