From 7192043b65f3a0032a7c65972d3fbec1abaf1c69 Mon Sep 17 00:00:00 2001 From: AdituV Date: Fri, 4 Aug 2023 01:29:35 +0100 Subject: [PATCH] Simplify IsPlayerInParty (cherry picked from commit 0c7f16fc2339406ba528a6d52c9ddc343e03621f) --- GWToolboxdll/Utils/ToolboxUtils.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/GWToolboxdll/Utils/ToolboxUtils.cpp b/GWToolboxdll/Utils/ToolboxUtils.cpp index 07822a05d..b7af96f39 100644 --- a/GWToolboxdll/Utils/ToolboxUtils.cpp +++ b/GWToolboxdll/Utils/ToolboxUtils.cpp @@ -345,8 +345,15 @@ namespace ToolboxUtils { bool IsPlayerInParty(const uint32_t login_number) { - GW::PartyInfo* party = nullptr; - return GetPlayerPartyMember(login_number, &party) && party == GW::PartyMgr::GetPartyInfo(); + GW::PartyContext* partyContext = GW::GetPartyContext(); + GW::PartyInfo* playerParty = partyContext->player_party; + + for (const auto& player : playerParty->players) { + if (player.login_number == login_number) + return true; + } + + return false; } bool IsAgentInParty(const uint32_t agent_id)