feat: Translation Service (#844)

Co-authored-by: mrwoowoo <github@hiqaq.com>
Co-authored-by: LiamD-Flop <40887493+LiamD-Flop@users.noreply.github.com>
This commit is contained in:
Yimura
2023-02-01 19:46:33 +01:00
committed by GitHub
parent e95e7d1b47
commit 8028db84b3
79 changed files with 1183 additions and 779 deletions

View File

@ -11,18 +11,18 @@ namespace big
{
void view::player_info()
{
if (ImGui::TreeNode("Info"))
if (ImGui::TreeNode("INFO"_T.data()))
{
ImGui::Text("Player ID: %d", g_player_service->get_selected()->id());
ImGui::Text("PLAYER_INFO_ID"_T.data(), g_player_service->get_selected()->id());
ImGui::Text("Session Host: %s", g_player_service->get_selected()->is_host() ? "Yes" : "No");
ImGui::Text("PLAYER_INFO_SESSION_HOST"_T.data(), g_player_service->get_selected()->is_host() ? "YES"_T.data() : "NO"_T.data());
ImGui::Separator();
if (CPlayerInfo* player_info = g_player_service->get_selected()->get_player_info(); player_info != nullptr)
{
ImGui::Text("Wanted Level: %d", player_info->m_wanted_level);
ImGui::Text("PLAYER_INFO_WANTED_LEVEL"_T.data(), player_info->m_wanted_level);
}
uint32_t ped_damage_bits = 0;
@ -42,17 +42,17 @@ namespace big
if (ped_damage_bits & (uint32_t)eEntityProofs::GOD)
{
mode_str = "God";
mode_str = "PLAYER_INFO_GOD"_T;
}
else
{
if (ped_damage_bits & (uint32_t)eEntityProofs::BULLET)
{
mode_str += "Bullet, ";
mode_str += "PLAYER_INFO_BULLET"_T;
}
if (ped_damage_bits & (uint32_t)eEntityProofs::EXPLOSION)
{
mode_str += "Explosion, ";
mode_str += "PLAYER_INFO_EXPLOSION"_T;
}
if (ped_health > 328 || ped_maxhealth > 328 && !(uint32_t)eEntityProofs::EXPLOSION && !(uint32_t)eEntityProofs::BULLET)
{
@ -62,10 +62,10 @@ namespace big
if (mode_str.empty())
{
mode_str = "No";
mode_str = "NO"_T;
}
ImGui::Text("Player God Mode: %s", mode_str.c_str());
ImGui::Text("PLAYER_INFO_PROOFS"_T.data(), mode_str.c_str());
mode_str = "";
@ -78,44 +78,46 @@ namespace big
{
if (veh_damage_bits & (uint32_t)eEntityProofs::GOD)
{
mode_str = "God";
mode_str = "PLAYER_INFO_GOD"_T;
}
else
{
if (veh_damage_bits & (uint32_t)eEntityProofs::COLLISION)
{
mode_str += "Collision, ";
mode_str += "PLAYER_INFO_COLLISION"_T;
}
if (veh_damage_bits & (uint32_t)eEntityProofs::EXPLOSION)
{
mode_str += "Explosion, ";
mode_str += "PLAYER_INFO_EXPLOSION"_T;
}
}
if (mode_str.empty())
{
mode_str = "No";
mode_str = "NO"_T;
}
}
else
{
mode_str = "No vehicle detected";
mode_str = "PLAYER_INFO_NO_VEHICLE"_T;
}
ImGui::Text("Vehicle God Mode: %s", mode_str.c_str());
ImGui::Text("PLAYER_INFO_VEHICLE_PROOFS"_T.data(), mode_str.c_str());
ImGui::Separator();
if (auto net_player_data = g_player_service->get_selected()->get_net_data(); net_player_data != nullptr)
{
ImGui::Text("Rockstar ID: %d", net_player_data->m_gamer_handle_2.m_rockstar_id);
ImGui::Text("PLAYER_INFO_RID"_T.data(), net_player_data->m_gamer_handle_2.m_rockstar_id);
ImGui::SameLine();
if (ImGui::Button("Copy##rid")) ImGui::SetClipboardText(std::to_string(net_player_data->m_gamer_handle_2.m_rockstar_id).data());
ImGui::PushID("##rid");
if (ImGui::Button("COPY"_T.data())) ImGui::SetClipboardText(std::to_string(net_player_data->m_gamer_handle_2.m_rockstar_id).data());
ImGui::PopID();
ImGui::Text(
"IP Address: %d.%d.%d.%d:%d",
"PLAYER_INFO_IP"_T.data(),
net_player_data->m_external_ip.m_field1,
net_player_data->m_external_ip.m_field2,
net_player_data->m_external_ip.m_field3,
@ -125,11 +127,13 @@ namespace big
ImGui::SameLine();
if (ImGui::Button("Copy##ip")) ImGui::SetClipboardText(std::format("{}.{}.{}.{}:{}", net_player_data->m_external_ip.m_field1,
ImGui::PushID("##ip");
if (ImGui::Button("COPY"_T.data())) ImGui::SetClipboardText(std::format("{}.{}.{}.{}:{}", net_player_data->m_external_ip.m_field1,
net_player_data->m_external_ip.m_field2,
net_player_data->m_external_ip.m_field3,
net_player_data->m_external_ip.m_field4,
net_player_data->m_external_port).data());
ImGui::PopID();
}
ImGui::Separator();
@ -142,27 +146,28 @@ namespace big
auto& boss_goon = scr_globals::gpbd_fm_3.as<GPBD_FM_3*>()->Entries[id].BossGoon;
if (boss_goon.Language >= 0 && boss_goon.Language < 13)
ImGui::Text("Language: %s", languages[boss_goon.Language].name);
ImGui::Text("PLAYER_INFO_LANGUAGE"_T.data(), languages[boss_goon.Language].name);
ImGui::Text("PLAYER_INFO_CEO_NAME"_T.data(), boss_goon.GangName);
ImGui::Text("PLAYER_INFO_MC_NAME"_T.data(), boss_goon.ClubhouseName);
ImGui::Text("PLAYER_INFO_WALLET"_T.data(), stats.WalletBalance);
ImGui::Text("PLAYER_INFO_BANK"_T.data(), stats.Money - stats.WalletBalance);
ImGui::Text("PLAYER_INFO_TOTAL_MONEY"_T.data(), stats.Money);
ImGui::Text("PLAYER_INFO_RANK"_T.data(), stats.Rank, stats.RP);
ImGui::Text("Health: %d (MaxHealth: %d)", ped_health, ped_maxhealth); // TODO: translate
ImGui::Text("PLAYER_INFO_KD"_T.data(), stats.KdRatio);
ImGui::Text("PLAYER_INFO_KILLS"_T.data(), stats.KillsOnPlayers);
ImGui::Text("PLAYER_INFO_DEATHS"_T.data(), stats.DeathsByPlayers);
ImGui::Text("PLAYER_INFO_PROSTITUTES"_T.data(), stats.ProstitutesFrequented);
ImGui::Text("PLAYER_INFO_LAP_DANCES"_T.data(), stats.LapDancesBought);
ImGui::Text("PLAYER_INFO_MISSIONS_CREATED"_T.data(), stats.MissionsCreated);
ImGui::Text("PLAYER_INFO_METLDOWN_COMPLETE"_T.data(), scr_globals::gpbd_fm_1.as<GPBD_FM*>()->Entries[id].MeltdownComplete ? "YES"_T.data() : "NO"_T.data()); // curious to see if anyone has actually played singleplayer
ImGui::Text("CEO Name: %s", boss_goon.GangName);
ImGui::Text("MC Name: %s", boss_goon.ClubhouseName);
ImGui::Text("Money In Wallet: %d", stats.WalletBalance);
ImGui::Text("Money In Bank: %d", stats.Money - stats.WalletBalance);
ImGui::Text("Total Money: %d", stats.Money);
ImGui::Text("Rank: %d (RP %d)", stats.Rank, stats.RP);
ImGui::Text("Health: %d (MaxHealth: %d)", ped_health, ped_maxhealth);
ImGui::Text("K/D Ratio: %f", stats.KdRatio);
ImGui::Text("Kills On Players: %d", stats.KillsOnPlayers);
ImGui::Text("Deaths By Players: %d", stats.DeathsByPlayers);
ImGui::Text("Prostitutes Frequented: %d", stats.ProstitutesFrequented);
ImGui::Text("Lap Dances Bought: %d", stats.LapDancesBought);
ImGui::Text("Missions Created: %d", stats.MissionsCreated);
ImGui::Text("Meltdown Complete: %s", scr_globals::gpbd_fm_1.as<GPBD_FM*>()->Entries[id].MeltdownComplete ? "Yes" : "No"); // curious to see if anyone has actually played singleplayer
ImGui::Separator();
}
if (ImGui::BeginCombo("Chat Command Permissions", COMMAND_ACCESS_LEVELS[g_player_service->get_selected()->command_access_level.value_or(g.session.chat_command_default_access_level)]))
if (ImGui::BeginCombo("CHAT_COMMAND_PERMISSIONS"_T.data(), COMMAND_ACCESS_LEVELS[g_player_service->get_selected()->command_access_level.value_or(g.session.chat_command_default_access_level)]))
{
for (const auto& [type, name] : COMMAND_ACCESS_LEVELS)
{
@ -182,7 +187,7 @@ namespace big
ImGui::EndCombo();
}
if (ImGui::Button("Add To Database"))
if (ImGui::Button("PLAYER_INFO_ADD_TO_DB"_T.data()))
{
g_player_database_service->get_or_create_player(g_player_service->get_selected());
}

View File

@ -6,7 +6,7 @@ namespace big
{
void view::player_kick()
{
if (ImGui::TreeNode("Kick"))
if (ImGui::TreeNode("KICK"_T.data()))
{
auto const is_session_host = [] { return gta_util::get_network()->m_game_session_ptr->is_host(); };

View File

@ -5,7 +5,7 @@ namespace big
{
void view::player_misc()
{
if (ImGui::TreeNode("Misc"))
if (ImGui::TreeNode("MISC"_T.data()))
{
components::player_command_button<"joinceo">(g_player_service->get_selected());
components::player_command_button<"enterint">(g_player_service->get_selected());
@ -20,9 +20,9 @@ namespace big
ImGui::SameLine();
components::player_command_button<"giveammo">(g_player_service->get_selected());
ImGui::Checkbox("Off The Radar", &g_player_service->get_selected()->off_radar);
ImGui::Checkbox("Never Wanted", &g_player_service->get_selected()->never_wanted);
ImGui::Checkbox("Semi Godmode", &g_player_service->get_selected()->semi_godmode);
ImGui::Checkbox("OFF_THE_RADAR"_T.data(), &g_player_service->get_selected()->off_radar);
ImGui::Checkbox("NEVER_WANTED"_T.data(), &g_player_service->get_selected()->never_wanted);
ImGui::Checkbox("SEMI_GODMODE"_T.data(), &g_player_service->get_selected()->semi_godmode);
components::button("Gooch Test", []
{

View File

@ -8,7 +8,7 @@ namespace big
{
void view::player_toxic()
{
if (ImGui::TreeNode("Toxic"))
if (ImGui::TreeNode("TOXIC"_T.data()))
{
components::player_command_button<"kill">(g_player_service->get_selected(), {});
ImGui::SameLine();
@ -39,11 +39,11 @@ namespace big
components::player_command_button<"fakeban">(g_player_service->get_selected(), {});
static int wanted_level;
ImGui::SliderInt("Wanted Level", &wanted_level, 0, 5);
ImGui::SliderInt("WANTED_LVL"_T.data(), &wanted_level, 0, 5);
ImGui::SameLine();
components::player_command_button<"wanted">(g_player_service->get_selected(), { (uint64_t)wanted_level }, "Set");
components::small_text("Teleports");
components::small_text("TELEPORTS"_T);
if (ImGui::BeginCombo("##apartment", apartment_names[g.session.send_to_apartment_idx]))
{
@ -89,13 +89,13 @@ namespace big
components::player_command_button<"warehousetp">(g_player_service->get_selected(), { (uint64_t)g.session.send_to_warehouse_idx });
components::button("TP To Darts", [] { toxic::start_activity(g_player_service->get_selected(), eActivityType::Darts); });
components::button("TP_TO_DARTS"_T, [] { toxic::start_activity(g_player_service->get_selected(), eActivityType::Darts); });
ImGui::SameLine();
components::button("TP To Flight School", [] { toxic::start_activity(g_player_service->get_selected(), eActivityType::PilotSchool); });
components::button("TP_TO_FLIGHT_SCHOOL"_T, [] { toxic::start_activity(g_player_service->get_selected(), eActivityType::PilotSchool); });
ImGui::SameLine();
components::button("TP To Map Center", [] { toxic::start_activity(g_player_service->get_selected(), eActivityType::ArmWresling); });
components::button("TP_TO_MAP_CENTER"_T, [] { toxic::start_activity(g_player_service->get_selected(), eActivityType::ArmWresling); });
components::button("TP To Skydive", [] { toxic::start_activity(g_player_service->get_selected(), eActivityType::Skydive); });
components::button("TP_TO_SKYDIVE"_T, [] { toxic::start_activity(g_player_service->get_selected(), eActivityType::Skydive); });
ImGui::SameLine();
components::player_command_button<"cayotp">(g_player_service->get_selected(), { });
ImGui::SameLine();
@ -142,33 +142,33 @@ namespace big
ImGui::SameLine();
components::player_command_button<"camhedz">(g_player_service->get_selected(), { });
components::small_text("Warp Time (requires session host)");
components::small_text("WARP_TIME"_T);
components::button("+1 Minute", [] { toxic::warp_time_forward(g_player_service->get_selected(), 60 * 1000); });
components::button("PLUS_1_MINUTE"_T, [] { toxic::warp_time_forward(g_player_service->get_selected(), 60 * 1000); });
ImGui::SameLine();
components::button("+5 Minutes", [] { toxic::warp_time_forward(g_player_service->get_selected(), 5 * 60 * 1000); });
components::button("PLUS_5_MINUTES"_T, [] { toxic::warp_time_forward(g_player_service->get_selected(), 5 * 60 * 1000); });
ImGui::SameLine();
components::button("+48 Minutes", [] { toxic::warp_time_forward(g_player_service->get_selected(), 48 * 60 * 1000); });
components::button("PLUS_48_MINUTES"_T, [] { toxic::warp_time_forward(g_player_service->get_selected(), 48 * 60 * 1000); });
ImGui::SameLine();
components::button("+96 Minutes", [] { toxic::warp_time_forward(g_player_service->get_selected(), 96 * 60 * 1000); });
components::button("PLUS_96_MINUTES"_T, [] { toxic::warp_time_forward(g_player_service->get_selected(), 96 * 60 * 1000); });
ImGui::SameLine();
components::button("+200 Minutes", [] { toxic::warp_time_forward(g_player_service->get_selected(), 200 * 60 * 1000); });
components::button("PLUS_200_MINUTES"_T, [] { toxic::warp_time_forward(g_player_service->get_selected(), 200 * 60 * 1000); });
ImGui::SameLine();
components::button("Stop Time", [] { toxic::set_time(g_player_service->get_selected(), INT_MAX - 3000); });
components::button("STOP_TIME"_T, [] { toxic::set_time(g_player_service->get_selected(), INT_MAX - 3000); });
if (ImGui::IsItemHovered())
ImGui::SetTooltip("This cannot be reversed. Use with caution");
ImGui::SetTooltip("PLAYER_TOXIC_NO_WAY_BACK"_T.data());
ImGui::Checkbox("Kill Loop", &g_player_service->get_selected()->kill_loop);
ImGui::Checkbox("KILL_LOOP"_T.data(), &g_player_service->get_selected()->kill_loop);
ImGui::SameLine();
ImGui::Checkbox("Explosion Loop", &g_player_service->get_selected()->explosion_loop);
ImGui::Checkbox("EXPLOSION_LOOP"_T.data(), &g_player_service->get_selected()->explosion_loop);
ImGui::SameLine();
ImGui::Checkbox("Freeze Loop", &g_player_service->get_selected()->freeze_loop);
ImGui::Checkbox("FREEZE_LOOP"_T.data(), &g_player_service->get_selected()->freeze_loop);
ImGui::Checkbox("Ragdoll Loop", &g_player_service->get_selected()->ragdoll_loop);
ImGui::Checkbox("RAGDOLL_LOOP"_T.data(), &g_player_service->get_selected()->ragdoll_loop);
ImGui::SameLine();
ImGui::Checkbox("Rotate Cam Loop", &g_player_service->get_selected()->rotate_cam_loop);
ImGui::Checkbox("ROT_CAM_LOOP"_T.data(), &g_player_service->get_selected()->rotate_cam_loop);
if (ImGui::IsItemHovered())
ImGui::SetTooltip("Also brings the player out of godmode if the event isn't blocked");
ImGui::SetTooltip("PLAYER_TOXIC_BRING_PLAYER_OUT_GOD"_T.data());
ImGui::TreePop();
}

View File

@ -7,7 +7,7 @@ namespace big
{
void view::player_troll()
{
if (ImGui::TreeNode("Troll"))
if (ImGui::TreeNode("TROLL"_T.data()))
{
components::player_command_button<"playertp">(g_player_service->get_selected());
ImGui::SameLine();
@ -18,11 +18,11 @@ namespace big
static int bounty_value = 0;
ImGui::SliderInt("Bounty", &bounty_value, 0, 10000);
ImGui::SliderInt("BOUNTY"_T.data(), &bounty_value, 0, 10000);
ImGui::SameLine();
components::command_checkbox<"anonbounty">();
ImGui::SameLine();
components::button("Set", [] { troll::set_bounty_on_player(g_player_service->get_selected(), bounty_value, g.session.anonymous_bounty);});
components::button("SET"_T, [] { troll::set_bounty_on_player(g_player_service->get_selected(), bounty_value, g.session.anonymous_bounty);});
ImGui::TreePop();
}

View File

@ -2,12 +2,10 @@
namespace big
{
void view::view_player() {
std::string title = std::format("Player Options: {}", g_player_service->get_selected()->get_name());
ImGui::Text(title.c_str());
ImGui::Checkbox("Spectate", &g.player.spectating);
void view::view_player()
{
ImGui::Text("VIEW_PLAYER_PLAYER_OPTIONS"_T.data(), g_player_service->get_selected()->get_name());
ImGui::Checkbox("SPECTATE"_T.data(), &g.player.spectating);
if (g_player_service->get_selected()->is_valid())
{