mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-07 23:38:00 +00:00
fix(Core/LFG): prevent RDF anti-kick exploit via loot rolls (#25112)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -600,35 +600,7 @@ bool Group::RemoveMember(ObjectGuid guid, const RemoveMethod& method /*= GROUP_R
|
||||
}
|
||||
|
||||
// Remove player from loot rolls
|
||||
for (Rolls::iterator it = RollId.begin(); it != RollId.end();)
|
||||
{
|
||||
Roll* roll = *it;
|
||||
Roll::PlayerVote::iterator itr2 = roll->playerVote.find(guid);
|
||||
if (itr2 == roll->playerVote.end())
|
||||
{
|
||||
++it;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (itr2->second == GREED || itr2->second == DISENCHANT)
|
||||
--roll->totalGreed;
|
||||
else if (itr2->second == NEED)
|
||||
--roll->totalNeed;
|
||||
else if (itr2->second == PASS)
|
||||
--roll->totalPass;
|
||||
|
||||
if (itr2->second != NOT_VALID)
|
||||
--roll->totalPlayersRolling;
|
||||
|
||||
roll->playerVote.erase(itr2);
|
||||
|
||||
// Xinef: itr can be erased inside
|
||||
// Xinef: player is removed from all vote lists so it will not pass above playerVote == playerVote.end statement during second iteration
|
||||
if (CountRollVote(guid, roll->itemGUID, MAX_ROLL_TYPE))
|
||||
it = RollId.begin();
|
||||
else
|
||||
++it;
|
||||
}
|
||||
RemovePlayerFromRolls(guid);
|
||||
|
||||
// Update subgroups
|
||||
member_witerator slot = _getMemberWSlot(guid);
|
||||
@@ -1422,6 +1394,37 @@ void Group::EndRoll(Loot* pLoot, Map* allowedMap)
|
||||
}
|
||||
}
|
||||
|
||||
void Group::RemovePlayerFromRolls(ObjectGuid guid)
|
||||
{
|
||||
for (Rolls::iterator it = RollId.begin(); it != RollId.end();)
|
||||
{
|
||||
Roll* roll = *it;
|
||||
Roll::PlayerVote::iterator itr2 = roll->playerVote.find(guid);
|
||||
if (itr2 == roll->playerVote.end())
|
||||
{
|
||||
++it;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (itr2->second == GREED || itr2->second == DISENCHANT)
|
||||
--roll->totalGreed;
|
||||
else if (itr2->second == NEED)
|
||||
--roll->totalNeed;
|
||||
else if (itr2->second == PASS)
|
||||
--roll->totalPass;
|
||||
|
||||
if (itr2->second != NOT_VALID)
|
||||
--roll->totalPlayersRolling;
|
||||
|
||||
roll->playerVote.erase(itr2);
|
||||
|
||||
if (CountRollVote(guid, roll->itemGUID, MAX_ROLL_TYPE))
|
||||
it = RollId.begin();
|
||||
else
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
void Group::CountTheRoll(Rolls::iterator rollI, Map* allowedMap)
|
||||
{
|
||||
Roll* roll = *rollI;
|
||||
|
||||
Reference in New Issue
Block a user