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 ef3decba53
commit d4f2960c77
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());
}