Created
May 2, 2023 09:36
-
-
Save Aokromes/e8a6e838b52c586cbd5f6be404f1db04 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (roll->totalNeed == 0 && roll->totalGreed > 0) // if (roll->totalNeed == 0 && ...), not else if, because numbers can be modified above if player is on a different map | |
{ | |
if (!roll->playerVote.empty()) | |
{ | |
uint8 maxresul = 0; | |
ObjectGuid maxguid = ObjectGuid::Empty; | |
Player* player = nullptr; | |
RollVote rollvote = NOT_VALID; | |
Roll::PlayerVote::iterator itr; | |
for (itr = roll->playerVote.begin(); itr != roll->playerVote.end(); ++itr) | |
{ | |
if (itr->second != GREED && itr->second != DISENCHANT) | |
continue; | |
player = ObjectAccessor::FindPlayer(itr->first); | |
if (!player || (allowedMap != nullptr && player->FindMap() != allowedMap)) | |
{ | |
--roll->totalGreed; | |
continue; | |
} | |
uint8 min = 1; | |
uint8 max = 100; | |
if (itr->second == GREED) | |
{ | |
min = 34; | |
} | |
else | |
{ | |
max = 33; | |
} | |
uint8 randomN = urand(min, max); | |
SendLootRoll(ObjectGuid::Empty, itr->first, randomN, itr->second, *roll); | |
if (maxresul < randomN) | |
{ | |
maxguid = itr->first; | |
maxresul = randomN; | |
rollvote = itr->second; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment