Skip to content

Commit 85089f0

Browse files
committed
Fix UFE/UCE and fix missing kp.me account.
1 parent ab350e0 commit 85089f0

2 files changed

Lines changed: 30 additions & 10 deletions

File tree

src/SquadMgr/KillproofInfo.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
///----------------------------------------------------------------------------------------------------
1717
struct KPMEInfo_t
1818
{
19+
bool IsInvalid = false; // No account.
20+
1921
struct RaidKP_t
2022
{
2123
int LI; // including LD
@@ -238,7 +240,7 @@ inline std::string CheckRequirements(const KPMEInfo_t& aValue, const KPMEInfo_t&
238240
checkBool(aValue.Strikes.EOD_LegendaryConquerorOfCerus, aRequired.Strikes.EOD_LegendaryConquerorOfCerus, "Legendary Conqueror of Cerus");
239241

240242
// Fractals
241-
checkInt(aValue.Fractals.UFE, aRequired.Fractals.UFE, "UFE Fractal clears");
243+
checkInt(aValue.Fractals.UFE, aRequired.Fractals.UFE, "UFE");
242244

243245
checkBool(aValue.Fractals.TheUnclean, aRequired.Fractals.TheUnclean, "The Unclean");
244246
checkBool(aValue.Fractals.LNHB, aRequired.Fractals.LNHB, "LNHB");

src/SquadMgr/SquadMgr.cpp

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -520,16 +520,29 @@ void CSquadMgr::Render()
520520
ImGui::TableNextColumn();
521521
if (player.KPMEInfo != nullptr)
522522
{
523-
std::string reqs = CheckRequirements(*player.KPMEInfo, this->KPRequirement).c_str();
524-
525-
if (!reqs.empty())
523+
if (player.KPMEInfo->IsInvalid == true)
526524
{
527-
ImGui::TextColored(ImColor(warnCol), reqs.c_str());
525+
ImGui::Text("-");
526+
if (ImGui::IsItemHovered())
527+
{
528+
ImGui::BeginTooltip();
529+
ImGui::Text("This player does not have a killproof.me account or does not share it.");
530+
ImGui::EndTooltip();
531+
}
528532
}
529533
else
530534
{
531-
ImGui::RenderCheckMark(dl, ImGui::GetCursorPos() + ImGui::GetWindowPos() - ImVec2(ImGui::GetScrollX(), ImGui::GetScrollY()), successCol, sz);
532-
ImGui::Dummy(ImVec2(sz, sz));
535+
std::string reqs = CheckRequirements(*player.KPMEInfo, this->KPRequirement).c_str();
536+
537+
if (!reqs.empty())
538+
{
539+
ImGui::TextColored(ImColor(warnCol), reqs.c_str());
540+
}
541+
else
542+
{
543+
ImGui::RenderCheckMark(dl, ImGui::GetCursorPos() + ImGui::GetWindowPos() - ImVec2(ImGui::GetScrollX(), ImGui::GetScrollY()), successCol, sz);
544+
ImGui::Dummy(ImVec2(sz, sz));
545+
}
533546
}
534547
}
535548
else
@@ -768,6 +781,11 @@ void CSquadMgr::GetKPData(PlayerInfo_t& aPlayer)
768781
{
769782
json response = json::parse(result);
770783

784+
if (!response.is_null() && !response["error"].is_null())
785+
{
786+
kpmeInfo->IsInvalid = response["error"].get<std::string>() == "Account not found";
787+
}
788+
771789
if (!response.is_null() && !response["linked_totals"].is_null())
772790
{
773791
response = response["linked_totals"];
@@ -823,9 +841,9 @@ void CSquadMgr::GetKPData(PlayerInfo_t& aPlayer)
823841
{
824842
case 88485: kpmeInfo->Raids.LI += kp["amount"].get<int>(); break;
825843
case 77302: kpmeInfo->Raids.LI += kp["amount"].get<int>(); break;
826-
case 94020: kpmeInfo->Fractals.UFE = kp["amount"].get<int>(); break;
827-
case 81743: kpmeInfo->Fractals.UFE = kp["amount"].get<int>(); break;
828-
case 93781: kpmeInfo->Strikes.IBS_BoneskinnerVial = kp["amount"].get<int>(); break;
844+
case 94020: kpmeInfo->Fractals.UFE += kp["amount"].get<int>(); break;
845+
case 81743: kpmeInfo->Fractals.UFE += kp["amount"].get<int>() * 5; break;
846+
case 93781: kpmeInfo->Strikes.IBS_BoneskinnerVial += kp["amount"].get<int>(); break;
829847
}
830848
}
831849
}

0 commit comments

Comments
 (0)