mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
case ROLL_GREED: // player choose Greed
|
||||
{
|
||||
SendLootRoll(playerGUID, 128, ROLL_GREED, *roll);
|
||||
++roll->totalGreed;
|
||||
itr->second = GREED;
|
||||
}
|
||||
itr->second = ROLL_GREED;
|
||||
break;
|
||||
}
|
||||
case ROLL_DISENCHANT: // player choose Disenchant
|
||||
{
|
||||
SendLootRoll(playerGUID, 128, ROLL_DISENCHANT, *roll);
|
||||
++roll->totalGreed;
|
||||
itr->second = DISENCHANT;
|
||||
}
|
||||
itr->second = ROLL_DISENCHANT;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,14 +32,29 @@
|
|||
#define MAXRAIDSIZE 40
|
||||
#define TARGETICONCOUNT 8
|
||||
|
||||
enum LootMethod
|
||||
{
|
||||
FREE_FOR_ALL = 0,
|
||||
ROUND_ROBIN = 1,
|
||||
MASTER_LOOT = 2,
|
||||
GROUP_LOOT = 3,
|
||||
NEED_BEFORE_GREED = 4
|
||||
};
|
||||
|
||||
#define ALL_ROLL_VOTE_MASK 0x0F // set what votes allowed
|
||||
|
||||
enum RollVote
|
||||
{
|
||||
PASS = 0,
|
||||
NEED = 1,
|
||||
GREED = 2,
|
||||
DISENCHANT = 3,
|
||||
NOT_EMITED_YET = 4,
|
||||
NOT_VALID = 5
|
||||
ROLL_PASS = 0,
|
||||
ROLL_NEED = 1,
|
||||
ROLL_GREED = 2,
|
||||
ROLL_DISENCHANT = 3,
|
||||
|
||||
// other not send by client
|
||||
MAX_ROLL_FROM_CLIENT = 4,
|
||||
|
||||
ROLL_NOT_EMITED_YET = 4, // send to client
|
||||
ROLL_NOT_VALID = 5 // not send to client
|
||||
};
|
||||
|
||||
enum GroupMemberOnlineStatus
|
||||
|
|
@ -314,12 +329,12 @@ class MANGOS_DLL_SPEC Group
|
|||
|
||||
void SendLootStartRoll(uint32 CountDown, uint32 mapid, const Roll &r);
|
||||
void SendLootRoll(ObjectGuid const& targetGuid, uint8 rollNumber, uint8 rollType, const Roll &r);
|
||||
void SendLootRollWon(ObjectGuid const& targetGuid, uint8 rollNumber, uint8 rollType, const Roll &r);
|
||||
void SendLootRollWon(ObjectGuid const& targetGuid, uint8 rollNumber, RollVote rollType, const Roll &r);
|
||||
void SendLootAllPassed(const Roll &r);
|
||||
void GroupLoot(ObjectGuid const& playerGUID, Loot *loot, Creature *creature);
|
||||
void NeedBeforeGreed(ObjectGuid const& playerGUID, Loot *loot, Creature *creature);
|
||||
void MasterLoot(ObjectGuid const& playerGUID, Loot *loot, Creature *creature);
|
||||
void CountRollVote(ObjectGuid const& playerGUID, ObjectGuid const& lootedTarget, uint32 itemSlot, uint8 choise);
|
||||
void CountRollVote(ObjectGuid const& playerGUID, ObjectGuid const& lootedTarget, uint32 itemSlot, RollVote choise);
|
||||
void EndRoll();
|
||||
|
||||
void LinkMember(GroupReference *pRef) { m_memberMgr.insertFirst(pRef); }
|
||||
|
|
@ -391,7 +406,7 @@ class MANGOS_DLL_SPEC Group
|
|||
}
|
||||
|
||||
void CountTheRoll(Rolls::iterator& roll); // iterator update to next, in CountRollVote if true
|
||||
bool CountRollVote(ObjectGuid const& playerGUID, Rolls::iterator& roll, uint8 choise);
|
||||
bool CountRollVote(ObjectGuid const& playerGUID, Rolls::iterator& roll, RollVote choise);
|
||||
|
||||
uint32 m_Id; // 0 for not created or BG groups
|
||||
MemberSlotList m_memberSlots;
|
||||
|
|
|
|||
|
|
@ -389,8 +389,11 @@ void WorldSession::HandleLootRoll( WorldPacket &recv_data )
|
|||
if (!group)
|
||||
return;
|
||||
|
||||
if (rollType >= MAX_ROLL_FROM_CLIENT)
|
||||
return;
|
||||
|
||||
// everything is fine, do it
|
||||
group->CountRollVote(GetPlayer()->GetObjectGuid(), lootedTarget, itemSlot, rollType);
|
||||
group->CountRollVote(GetPlayer()->GetObjectGuid(), lootedTarget, itemSlot, RollVote(rollType));
|
||||
|
||||
switch (rollType)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,31 +26,11 @@
|
|||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
enum RollType
|
||||
{
|
||||
ROLL_PASS = 0,
|
||||
ROLL_NEED = 1,
|
||||
ROLL_GREED = 2,
|
||||
ROLL_DISENCHANT = 3,
|
||||
MAX_ROLL_TYPE = 4
|
||||
};
|
||||
|
||||
#define ALL_ROLL_TYPE_MASK 0x0F
|
||||
|
||||
#define MAX_NR_LOOT_ITEMS 16
|
||||
// note: the client cannot show more than 16 items total
|
||||
#define MAX_NR_QUEST_ITEMS 32
|
||||
// unrelated to the number of quest items shown, just for reserve
|
||||
|
||||
enum LootMethod
|
||||
{
|
||||
FREE_FOR_ALL = 0,
|
||||
ROUND_ROBIN = 1,
|
||||
MASTER_LOOT = 2,
|
||||
GROUP_LOOT = 3,
|
||||
NEED_BEFORE_GREED = 4
|
||||
};
|
||||
|
||||
enum PermissionTypes
|
||||
{
|
||||
ALL_PERMISSION = 0,
|
||||
|
|
|
|||
|
|
@ -2662,5 +2662,4 @@ bool Player::CheckAllControlledUnits(Func const& func, bool withTotems, bool wit
|
|||
return Unit::CheckAllControlledUnits(func,withTotems,withGuardians,withCharms);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "9842"
|
||||
#define REVISION_NR "9843"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue