#include "hotkeys.h"

#include "../config/ActionRowValue.h"
#include "../config/IntSliderValue.h"
#include "../config/IntTextboxValue.h"
#include "../config/ItemSearchValue.h"
#include "../config/MenuSectionValue.h"
#include "../config/SelectValue.h"
#include "../config/TextboxValue.h"
#include "impl/AimbotModule.h"
#include "impl/AmmoHudModule.h"
#include "impl/EspModule.h"
#include "impl/MinimapModule.h"
#include "impl/PlayerModule.h"
#include "impl/WeaponModule.h"
#include "impl/WorldModule.h"

#ifdef INCLUDE_AIMBOT
void hotkeys::register_aimbot(AimbotModule* aimbot)
{
    add_toggle("aimbot.magic_bullet", "hk_magic_bullet_act", section::aimbot, aimbot->magic_bullet);
}
#endif

void hotkeys::register_esp(EspModule* esp)
{
    add_toggle("esp.extracts", "hk_extracts_act", section::esp, esp->extracts);
    add_toggle("esp.transits", "hk_transits_act", section::esp, esp->transits);
    add_toggle("esp.players", "hk_players_act", section::esp, esp->players);
    add_toggle("esp.npc", "hk_npc_act", section::esp, esp->npc);
    add_toggle("esp.player_box", "hk_esp_box_act", section::esp, esp->player_box);
    add_toggle("esp.skeleton", "hk_skeleton_act", section::esp, esp->skeleton);
    add_toggle("esp.loot", "hk_loot_act", section::esp, esp->loot_esp);
    add_toggle("esp.containers", "hk_containers_act", section::esp, esp->container_esp);
    add_toggle("esp.show_loot_prices", "hk_show_loot_prices_act", section::esp, esp->show_loot_prices);
    add_toggle("esp.container_loot", "hk_container_loot_act", section::esp, esp->container_show_loot);
    add_toggle("esp.container_prices", "hk_container_prices_act", section::esp, esp->container_show_value);
    add_toggle("esp.corpse_loot", "hk_corpse_loot_act", section::esp, esp->corpse_show_loot);
    add_toggle("esp.provisions", "hk_provisions_act", section::esp, esp->show_provisions);
    add_toggle("esp.quest_esp", "hk_quest_esp_act", section::esp, esp->quest_esp_enabled);
    add_toggle("esp.grenades", "hk_grenade_esp_act", section::esp, esp->grenade_esp);
}

void hotkeys::register_minimap(MinimapModule* minimap)
{
    add_toggle("esp.radar", "hk_radar_act", section::esp, minimap->radar);
}

void hotkeys::register_player(PlayerModule* player)
{
    add_toggle("exploit.god_mode", "hk_god_mode_act", section::exploits, player->god_mode,
               0, [player]() { return !player->god_mode2->get_value(); });
    add_toggle("exploit.god_mode2", "hk_god_mode2_act", section::exploits, player->god_mode2,
               0, [player]() { return !player->god_mode->get_value(); });
    add_toggle("exploit.infinite_stamina", "hk_infinite_stamina_act", section::exploits, player->infinite_stamina);
    add_toggle("exploit.no_hunger_thirst", "hk_no_hunger_thirst_act", section::exploits, player->no_hunger_thirst);
    add_toggle("exploit.instant_search", "hk_instant_search_act", section::exploits, player->instant_search);
    add_toggle("exploit.speed_hack", "hk_speed_hack_act", section::exploits, player->speed_hack);
    add_toggle("exploit.fly_hack", "hk_fly_hack_act", section::exploits, player->fly_hack);
    add_keybind("exploit.fly_up", "fly_up_act", section::exploits, &player->fly_up_key, VK_SPACE);
    add_keybind("exploit.fly_down", "fly_down_act", section::exploits, &player->fly_down_key, VK_CONTROL);
    add_toggle("exploit.always_survive", "hk_always_survive_act", section::exploits, player->always_survive);
}

void hotkeys::register_weapon(WeaponModule* weapon)
{
    add_toggle("exploit.no_jam", "hk_no_jam_act", section::exploits, weapon->no_jam);
    add_toggle("exploit.infinite_ammo", "hk_infinite_ammo_act", section::exploits, weapon->infinite_ammo);
}

void hotkeys::register_world(WorldModule* world)
{
    add_action("exploit.kill_all", "hk_kill_all_act", section::exploits,
               [world]() { world->queue_kill_all = true; });
    add_action("exploit.tp_all", "hk_tp_all_act", section::exploits,
               [world]() { world->queue_tp_all = true; });
}

void hotkeys::register_ammo_hud(AmmoHudModule* ammo_hud)
{
    add_toggle("esp.ammo_hud", "hk_ammo_hud_act", section::esp, ammo_hud->enabled);
}