mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[9843] Restore need seelction show at loot roll.
Also some clanups including merge 2 roll type enum.
This commit is contained in:
parent
de95b8ad5f
commit
ec0141261a
6 changed files with 66 additions and 65 deletions
|
|
@ -32,6 +32,7 @@
|
|||
#include "InstanceSaveMgr.h"
|
||||
#include "MapInstanced.h"
|
||||
#include "Util.h"
|
||||
#include "LootMgr.h"
|
||||
|
||||
Group::Group() : m_Id(0), m_leaderGuid(0), m_mainTank(0), m_mainAssistant(0), m_groupType(GROUPTYPE_NORMAL),
|
||||
m_dungeonDifficulty(REGULAR_DIFFICULTY), m_raidDifficulty(REGULAR_DIFFICULTY),
|
||||
|
|
@ -457,7 +458,7 @@ void Group::SendLootStartRoll(uint32 CountDown, uint32 mapid, const Roll &r)
|
|||
data << uint32(r.itemRandomPropId); // item random property ID
|
||||
data << uint32(r.itemCount); // items in stack
|
||||
data << uint32(CountDown); // the countdown time to choose "need" or "greed"
|
||||
data << uint8(ALL_ROLL_TYPE_MASK); // roll type mask
|
||||
data << uint8(ALL_ROLL_VOTE_MASK); // roll type mask, allowed choises
|
||||
|
||||
for (Roll::PlayerVote::const_iterator itr = r.playerVote.begin(); itr != r.playerVote.end(); ++itr)
|
||||
{
|
||||
|
|
@ -465,7 +466,7 @@ void Group::SendLootStartRoll(uint32 CountDown, uint32 mapid, const Roll &r)
|
|||
if(!p || !p->GetSession())
|
||||
continue;
|
||||
|
||||
if(itr->second != NOT_VALID)
|
||||
if(itr->second != ROLL_NOT_VALID)
|
||||
p->GetSession()->SendPacket( &data );
|
||||
}
|
||||
}
|
||||
|
|
@ -489,12 +490,12 @@ void Group::SendLootRoll(ObjectGuid const& targetGuid, uint8 rollNumber, uint8 r
|
|||
if(!p || !p->GetSession())
|
||||
continue;
|
||||
|
||||
if(itr->second != NOT_VALID)
|
||||
if(itr->second != ROLL_NOT_VALID)
|
||||
p->GetSession()->SendPacket( &data );
|
||||
}
|
||||
}
|
||||
|
||||
void Group::SendLootRollWon(ObjectGuid const& targetGuid, uint8 rollNumber, uint8 rollType, const Roll &r)
|
||||
void Group::SendLootRollWon(ObjectGuid const& targetGuid, uint8 rollNumber, RollVote rollType, const Roll &r)
|
||||
{
|
||||
WorldPacket data(SMSG_LOOT_ROLL_WON, (8+4+4+4+4+8+1+1));
|
||||
data << r.lootedTargetGUID; // creature guid what we're looting
|
||||
|
|
@ -512,7 +513,7 @@ void Group::SendLootRollWon(ObjectGuid const& targetGuid, uint8 rollNumber, uint
|
|||
if(!p || !p->GetSession())
|
||||
continue;
|
||||
|
||||
if(itr->second != NOT_VALID)
|
||||
if(itr->second != ROLL_NOT_VALID)
|
||||
p->GetSession()->SendPacket( &data );
|
||||
}
|
||||
}
|
||||
|
|
@ -532,7 +533,7 @@ void Group::SendLootAllPassed(Roll const& r)
|
|||
if(!p || !p->GetSession())
|
||||
continue;
|
||||
|
||||
if(itr->second != NOT_VALID)
|
||||
if(itr->second != ROLL_NOT_VALID)
|
||||
p->GetSession()->SendPacket( &data );
|
||||
}
|
||||
}
|
||||
|
|
@ -569,7 +570,7 @@ void Group::GroupLoot(ObjectGuid const& playerGUID, Loot *loot, Creature *creatu
|
|||
{
|
||||
if (member->IsWithinDist(creature, sWorld.getConfig(CONFIG_FLOAT_GROUP_XP_DISTANCE), false))
|
||||
{
|
||||
r->playerVote[member->GetGUID()] = NOT_EMITED_YET;
|
||||
r->playerVote[member->GetGUID()] = ROLL_NOT_EMITED_YET;
|
||||
++r->totalPlayersRolling;
|
||||
}
|
||||
}
|
||||
|
|
@ -581,7 +582,7 @@ void Group::GroupLoot(ObjectGuid const& playerGUID, Loot *loot, Creature *creatu
|
|||
r->itemSlot = itemSlot;
|
||||
|
||||
if (r->totalPlayersRolling == 1) // single looter
|
||||
r->playerVote.begin()->second = NEED;
|
||||
r->playerVote.begin()->second = ROLL_NEED;
|
||||
else
|
||||
{
|
||||
group->SendLootStartRoll(60000, creature->GetMapId(), *r);
|
||||
|
|
@ -628,7 +629,7 @@ void Group::NeedBeforeGreed(ObjectGuid const& playerGUID, Loot *loot, Creature *
|
|||
{
|
||||
if (playerToRoll->IsWithinDist(creature, sWorld.getConfig(CONFIG_FLOAT_GROUP_XP_DISTANCE), false))
|
||||
{
|
||||
r->playerVote[playerToRoll->GetGUID()] = NOT_EMITED_YET;
|
||||
r->playerVote[playerToRoll->GetGUID()] = ROLL_NOT_EMITED_YET;
|
||||
++r->totalPlayersRolling;
|
||||
}
|
||||
}
|
||||
|
|
@ -640,7 +641,7 @@ void Group::NeedBeforeGreed(ObjectGuid const& playerGUID, Loot *loot, Creature *
|
|||
r->itemSlot = itemSlot;
|
||||
|
||||
if (r->totalPlayersRolling == 1) // single looter
|
||||
r->playerVote.begin()->second = NEED;
|
||||
r->playerVote.begin()->second = ROLL_NEED;
|
||||
else
|
||||
{
|
||||
group->SendLootStartRoll(60000, creature->GetMapId(), *r);
|
||||
|
|
@ -693,7 +694,7 @@ void Group::MasterLoot(ObjectGuid const& playerGUID, Loot* /*loot*/, Creature *c
|
|||
}
|
||||
}
|
||||
|
||||
void Group::CountRollVote(ObjectGuid const& playerGUID, ObjectGuid const& lootedTarget, uint32 itemSlot, uint8 choise)
|
||||
void Group::CountRollVote(ObjectGuid const& playerGUID, ObjectGuid const& lootedTarget, uint32 itemSlot, RollVote choise)
|
||||
{
|
||||
Rolls::iterator rollI = RollId.begin();
|
||||
for (; rollI != RollId.end(); ++rollI)
|
||||
|
|
@ -706,7 +707,7 @@ void Group::CountRollVote(ObjectGuid const& playerGUID, ObjectGuid const& looted
|
|||
CountRollVote(playerGUID, rollI, choise);
|
||||
}
|
||||
|
||||
bool Group::CountRollVote(ObjectGuid const& playerGUID, Rolls::iterator& rollI, uint8 choise)
|
||||
bool Group::CountRollVote(ObjectGuid const& playerGUID, Rolls::iterator& rollI, RollVote choise)
|
||||
{
|
||||
Roll* roll = *rollI;
|
||||
|
||||
|
|
@ -723,33 +724,36 @@ bool Group::CountRollVote(ObjectGuid const& playerGUID, Rolls::iterator& rollI,
|
|||
{
|
||||
case ROLL_PASS: // Player choose pass
|
||||
{
|
||||
SendLootRoll(playerGUID, 0, ROLL_PASS, *roll);
|
||||
SendLootRoll(playerGUID, 128, 128, *roll);
|
||||
++roll->totalPass;
|
||||
itr->second = PASS;
|
||||
itr->second = ROLL_PASS;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ROLL_NEED: // player choose Need
|
||||
{
|
||||
SendLootRoll(playerGUID, 0, ROLL_NEED, *roll);
|
||||
SendLootRoll(playerGUID, 0, 0, *roll);
|
||||
++roll->totalNeed;
|
||||
itr->second = NEED;
|
||||
itr->second = ROLL_NEED;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ROLL_GREED: // player choose Greed
|
||||
{
|
||||
SendLootRoll(playerGUID, 128, ROLL_GREED, *roll);
|
||||
++roll->totalGreed;
|
||||
itr->second = GREED;
|
||||
itr->second = ROLL_GREED;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ROLL_DISENCHANT: // player choose Disenchant
|
||||
{
|
||||
SendLootRoll(playerGUID, 128, ROLL_DISENCHANT, *roll);
|
||||
++roll->totalGreed;
|
||||
itr->second = DISENCHANT;
|
||||
itr->second = ROLL_DISENCHANT;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default: // Roll removed case
|
||||
break;
|
||||
}
|
||||
|
||||
if (roll->totalPass + roll->totalNeed + roll->totalGreed >= roll->totalPlayersRolling)
|
||||
{
|
||||
CountTheRoll(rollI);
|
||||
|
|
@ -791,7 +795,7 @@ void Group::CountTheRoll(Rolls::iterator& rollI)
|
|||
|
||||
for( Roll::PlayerVote::const_iterator itr = roll->playerVote.begin(); itr != roll->playerVote.end(); ++itr)
|
||||
{
|
||||
if (itr->second != NEED)
|
||||
if (itr->second != ROLL_NEED)
|
||||
continue;
|
||||
|
||||
uint8 randomN = urand(1, 99);
|
||||
|
|
@ -834,12 +838,12 @@ void Group::CountTheRoll(Rolls::iterator& rollI)
|
|||
uint8 maxresul = 0;
|
||||
uint64 maxguid = (*roll->playerVote.begin()).first;
|
||||
Player *player;
|
||||
RollVote rollvote = PASS; //Fixed: Using uninitialized memory 'rollvote'
|
||||
RollVote rollvote = ROLL_PASS; //Fixed: Using uninitialized memory 'rollvote'
|
||||
|
||||
Roll::PlayerVote::iterator itr;
|
||||
for (itr = roll->playerVote.begin(); itr != roll->playerVote.end(); ++itr)
|
||||
{
|
||||
if (itr->second != GREED && itr->second != DISENCHANT)
|
||||
if (itr->second != ROLL_GREED && itr->second != ROLL_DISENCHANT)
|
||||
continue;
|
||||
|
||||
uint8 randomN = urand(1, 99);
|
||||
|
|
@ -860,7 +864,7 @@ void Group::CountTheRoll(Rolls::iterator& rollI)
|
|||
|
||||
LootItem *item = &(roll->getLoot()->items[roll->itemSlot]);
|
||||
|
||||
if(rollvote == GREED)
|
||||
if(rollvote == ROLL_GREED)
|
||||
{
|
||||
ItemPosCountVec dest;
|
||||
uint8 msg = player->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, roll->itemid, item->count );
|
||||
|
|
@ -877,7 +881,7 @@ void Group::CountTheRoll(Rolls::iterator& rollI)
|
|||
player->SendEquipError( msg, NULL, NULL, roll->itemid );
|
||||
}
|
||||
}
|
||||
else if(rollvote == DISENCHANT)
|
||||
else if(rollvote == ROLL_DISENCHANT)
|
||||
{
|
||||
item->is_looted = true;
|
||||
roll->getLoot()->NotifyItemRemoved(roll->itemSlot);
|
||||
|
|
@ -1258,18 +1262,18 @@ void Group::_removeRolls(const uint64 &guid)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (itr2->second == GREED || itr2->second == DISENCHANT)
|
||||
if (itr2->second == ROLL_GREED || itr2->second == ROLL_DISENCHANT)
|
||||
--roll->totalGreed;
|
||||
if (itr2->second == NEED)
|
||||
if (itr2->second == ROLL_NEED)
|
||||
--roll->totalNeed;
|
||||
if (itr2->second == PASS)
|
||||
if (itr2->second == ROLL_PASS)
|
||||
--roll->totalPass;
|
||||
if (itr2->second != NOT_VALID)
|
||||
if (itr2->second != ROLL_NOT_VALID)
|
||||
--roll->totalPlayersRolling;
|
||||
|
||||
roll->playerVote.erase(itr2);
|
||||
|
||||
if (!CountRollVote(guid, it, MAX_ROLL_TYPE))
|
||||
if (!CountRollVote(guid, it, ROLL_NOT_EMITED_YET))
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue