mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[9582] Send looted creature guid in proper field of loot packets.
Also use ObjectGuid in related functions. Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
bae7d15bb9
commit
547919e249
4 changed files with 50 additions and 49 deletions
|
|
@ -448,8 +448,8 @@ void Group::Disband(bool hideDestroy)
|
|||
void Group::SendLootStartRoll(uint32 CountDown, const Roll &r)
|
||||
{
|
||||
WorldPacket data(SMSG_LOOT_START_ROLL, (8+4+4+4+4+4+4+1));
|
||||
data << uint64(r.itemGUID); // guid of rolled item
|
||||
data << uint32(r.totalPlayersRolling); // maybe the number of players rolling for it???
|
||||
data << r.lootedTargetGUID; // creature guid what we're looting
|
||||
data << uint32(r.totalPlayersRolling); // maybe the number of players rolling for it, or item slot in loot
|
||||
data << uint32(r.itemid); // the itemEntryId for the item that shall be rolled for
|
||||
data << uint32(r.itemRandomSuffix); // randomSuffix
|
||||
data << uint32(r.itemRandomPropId); // item random property ID
|
||||
|
|
@ -468,17 +468,17 @@ void Group::SendLootStartRoll(uint32 CountDown, const Roll &r)
|
|||
}
|
||||
}
|
||||
|
||||
void Group::SendLootRoll(const uint64& SourceGuid, const uint64& TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r)
|
||||
void Group::SendLootRoll(ObjectGuid const& targetGuid, uint8 rollNumber, uint8 rollType, const Roll &r)
|
||||
{
|
||||
WorldPacket data(SMSG_LOOT_ROLL, (8+4+8+4+4+4+1+1+1));
|
||||
data << uint64(SourceGuid); // guid of the item rolled
|
||||
data << uint32(0); // unknown, maybe amount of players
|
||||
data << uint64(TargetGuid);
|
||||
data << r.lootedTargetGUID; // creature guid what we're looting
|
||||
data << uint32(0); // unknown, maybe amount of players, or item slot in loot
|
||||
data << targetGuid;
|
||||
data << uint32(r.itemid); // the itemEntryId for the item that shall be rolled for
|
||||
data << uint32(r.itemRandomSuffix); // randomSuffix
|
||||
data << uint32(r.itemRandomPropId); // Item random property ID
|
||||
data << uint8(RollNumber); // 0: "Need for: [item name]" > 127: "you passed on: [item name]" Roll number
|
||||
data << uint8(RollType); // 0: "Need for: [item name]" 0: "You have selected need for [item name] 1: need roll 2: greed roll
|
||||
data << uint8(rollNumber); // 0: "Need for: [item name]" > 127: "you passed on: [item name]" Roll number
|
||||
data << uint8(rollType); // 0: "Need for: [item name]" 0: "You have selected need for [item name] 1: need roll 2: greed roll
|
||||
data << uint8(0); // 2.4.0
|
||||
|
||||
for( Roll::PlayerVote::const_iterator itr = r.playerVote.begin(); itr != r.playerVote.end(); ++itr)
|
||||
|
|
@ -492,17 +492,17 @@ void Group::SendLootRoll(const uint64& SourceGuid, const uint64& TargetGuid, uin
|
|||
}
|
||||
}
|
||||
|
||||
void Group::SendLootRollWon(const uint64& SourceGuid, const uint64& TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r)
|
||||
void Group::SendLootRollWon(ObjectGuid const& targetGuid, uint8 rollNumber, uint8 rollType, const Roll &r)
|
||||
{
|
||||
WorldPacket data(SMSG_LOOT_ROLL_WON, (8+4+4+4+4+8+1+1));
|
||||
data << uint64(SourceGuid); // guid of the item rolled
|
||||
data << uint32(0); // unknown, maybe amount of players
|
||||
data << r.lootedTargetGUID; // creature guid what we're looting
|
||||
data << uint32(0); // unknown, maybe amount of players, or item slot in loot
|
||||
data << uint32(r.itemid); // the itemEntryId for the item that shall be rolled for
|
||||
data << uint32(r.itemRandomSuffix); // randomSuffix
|
||||
data << uint32(r.itemRandomPropId); // Item random property
|
||||
data << uint64(TargetGuid); // guid of the player who won.
|
||||
data << uint8(RollNumber); // rollnumber realted to SMSG_LOOT_ROLL
|
||||
data << uint8(RollType); // Rolltype related to SMSG_LOOT_ROLL
|
||||
data << targetGuid; // guid of the player who won.
|
||||
data << uint8(rollNumber); // rollnumber realted to SMSG_LOOT_ROLL
|
||||
data << uint8(rollType); // Rolltype related to SMSG_LOOT_ROLL
|
||||
|
||||
for( Roll::PlayerVote::const_iterator itr = r.playerVote.begin(); itr != r.playerVote.end(); ++itr)
|
||||
{
|
||||
|
|
@ -518,8 +518,8 @@ void Group::SendLootRollWon(const uint64& SourceGuid, const uint64& TargetGuid,
|
|||
void Group::SendLootAllPassed(uint32 NumberOfPlayers, const Roll &r)
|
||||
{
|
||||
WorldPacket data(SMSG_LOOT_ALL_PASSED, (8+4+4+4+4));
|
||||
data << uint64(r.itemGUID); // Guid of the item rolled
|
||||
data << uint32(NumberOfPlayers); // The number of players rolling for it???
|
||||
data << r.lootedTargetGUID; // creature guid what we're looting
|
||||
data << uint32(NumberOfPlayers); // The number of players rolling for it, or item slot in loot
|
||||
data << uint32(r.itemid); // The itemEntryId for the item that shall be rolled for
|
||||
data << uint32(r.itemRandomPropId); // Item random property ID
|
||||
data << uint32(r.itemRandomSuffix); // Item random suffix ID
|
||||
|
|
@ -535,7 +535,7 @@ void Group::SendLootAllPassed(uint32 NumberOfPlayers, const Roll &r)
|
|||
}
|
||||
}
|
||||
|
||||
void Group::GroupLoot(const uint64& playerGUID, Loot *loot, Creature *creature)
|
||||
void Group::GroupLoot(ObjectGuid const& playerGUID, Loot *loot, Creature *creature)
|
||||
{
|
||||
std::vector<LootItem>::iterator i;
|
||||
ItemPrototype const *item;
|
||||
|
|
@ -556,7 +556,7 @@ void Group::GroupLoot(const uint64& playerGUID, Loot *loot, Creature *creature)
|
|||
if (item->Quality >= uint32(m_lootThreshold) && !i->freeforall)
|
||||
{
|
||||
uint64 newitemGUID = MAKE_NEW_GUID(sObjectMgr.GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM);
|
||||
Roll* r = new Roll(newitemGUID, *i);
|
||||
Roll* r=new Roll(newitemGUID,creature->GetGUID(),*i);
|
||||
|
||||
//a vector is filled with only near party members
|
||||
for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
|
|
@ -590,7 +590,7 @@ void Group::GroupLoot(const uint64& playerGUID, Loot *loot, Creature *creature)
|
|||
}
|
||||
}
|
||||
|
||||
void Group::NeedBeforeGreed(const uint64& playerGUID, Loot *loot, Creature *creature)
|
||||
void Group::NeedBeforeGreed(ObjectGuid const& playerGUID, Loot *loot, Creature *creature)
|
||||
{
|
||||
ItemPrototype const *item;
|
||||
Player *player = sObjectMgr.GetPlayer(playerGUID);
|
||||
|
|
@ -605,7 +605,7 @@ void Group::NeedBeforeGreed(const uint64& playerGUID, Loot *loot, Creature *crea
|
|||
if (item->Quality >= uint32(m_lootThreshold) && !i->freeforall)
|
||||
{
|
||||
uint64 newitemGUID = MAKE_NEW_GUID(sObjectMgr.GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM);
|
||||
Roll* r = new Roll(newitemGUID, *i);
|
||||
Roll* r=new Roll(newitemGUID,creature->GetGUID(),*i);
|
||||
|
||||
for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
{
|
||||
|
|
@ -644,7 +644,7 @@ void Group::NeedBeforeGreed(const uint64& playerGUID, Loot *loot, Creature *crea
|
|||
}
|
||||
}
|
||||
|
||||
void Group::MasterLoot(const uint64& playerGUID, Loot* /*loot*/, Creature *creature)
|
||||
void Group::MasterLoot(ObjectGuid const& playerGUID, Loot* /*loot*/, Creature *creature)
|
||||
{
|
||||
Player *player = sObjectMgr.GetPlayer(playerGUID);
|
||||
if(!player)
|
||||
|
|
@ -680,14 +680,14 @@ void Group::MasterLoot(const uint64& playerGUID, Loot* /*loot*/, Creature *creat
|
|||
}
|
||||
}
|
||||
|
||||
void Group::CountRollVote(const uint64& playerGUID, const uint64& Guid, uint32 NumberOfPlayers, uint8 Choise)
|
||||
void Group::CountRollVote(ObjectGuid const& playerGUID, ObjectGuid const& itemGuid, uint32 numberOfPlayers, uint8 choise)
|
||||
{
|
||||
Rolls::iterator rollI = GetRoll(Guid);
|
||||
Rolls::iterator rollI = GetRoll(itemGuid);
|
||||
if (rollI == RollId.end())
|
||||
return;
|
||||
Roll* roll = *rollI;
|
||||
|
||||
Roll::PlayerVote::iterator itr = roll->playerVote.find(playerGUID);
|
||||
Roll::PlayerVote::iterator itr = roll->playerVote.find(playerGUID.GetMaxCounter());
|
||||
// this condition means that player joins to the party after roll begins
|
||||
if (itr == roll->playerVote.end())
|
||||
return;
|
||||
|
|
@ -696,32 +696,32 @@ void Group::CountRollVote(const uint64& playerGUID, const uint64& Guid, uint32 N
|
|||
if (roll->getLoot()->items.empty())
|
||||
return;
|
||||
|
||||
switch (Choise)
|
||||
switch (choise)
|
||||
{
|
||||
case ROLL_PASS: // Player choose pass
|
||||
{
|
||||
SendLootRoll(0, playerGUID, 0, ROLL_PASS, *roll);
|
||||
SendLootRoll(playerGUID, 0, ROLL_PASS, *roll);
|
||||
++roll->totalPass;
|
||||
itr->second = PASS;
|
||||
}
|
||||
break;
|
||||
case ROLL_NEED: // player choose Need
|
||||
{
|
||||
SendLootRoll(0, playerGUID, 0, ROLL_NEED, *roll);
|
||||
SendLootRoll(playerGUID, 0, ROLL_NEED, *roll);
|
||||
++roll->totalNeed;
|
||||
itr->second = NEED;
|
||||
}
|
||||
break;
|
||||
case ROLL_GREED: // player choose Greed
|
||||
{
|
||||
SendLootRoll(0, playerGUID, 128, ROLL_GREED, *roll);
|
||||
SendLootRoll(playerGUID, 128, ROLL_GREED, *roll);
|
||||
++roll->totalGreed;
|
||||
itr->second = GREED;
|
||||
}
|
||||
break;
|
||||
case ROLL_DISENCHANT: // player choose Disenchant
|
||||
{
|
||||
SendLootRoll(0, playerGUID, 128, ROLL_DISENCHANT, *roll);
|
||||
SendLootRoll(playerGUID, 128, ROLL_DISENCHANT, *roll);
|
||||
++roll->totalGreed;
|
||||
itr->second = DISENCHANT;
|
||||
}
|
||||
|
|
@ -729,7 +729,7 @@ void Group::CountRollVote(const uint64& playerGUID, const uint64& Guid, uint32 N
|
|||
}
|
||||
if (roll->totalPass + roll->totalNeed + roll->totalGreed >= roll->totalPlayersRolling)
|
||||
{
|
||||
CountTheRoll(rollI, NumberOfPlayers);
|
||||
CountTheRoll(rollI, numberOfPlayers);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -760,7 +760,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers)
|
|||
if(!roll->playerVote.empty())
|
||||
{
|
||||
uint8 maxresul = 0;
|
||||
uint64 maxguid = (*roll->playerVote.begin()).first;
|
||||
ObjectGuid maxguid = (*roll->playerVote.begin()).first;
|
||||
Player *player;
|
||||
|
||||
for( Roll::PlayerVote::const_iterator itr = roll->playerVote.begin(); itr != roll->playerVote.end(); ++itr)
|
||||
|
|
@ -769,14 +769,14 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers)
|
|||
continue;
|
||||
|
||||
uint8 randomN = urand(1, 99);
|
||||
SendLootRoll(0, itr->first, randomN, ROLL_NEED, *roll);
|
||||
SendLootRoll(itr->first, randomN, ROLL_NEED, *roll);
|
||||
if (maxresul < randomN)
|
||||
{
|
||||
maxguid = itr->first;
|
||||
maxresul = randomN;
|
||||
}
|
||||
}
|
||||
SendLootRollWon(0, maxguid, maxresul, ROLL_NEED, *roll);
|
||||
SendLootRollWon(maxguid, maxresul, ROLL_NEED, *roll);
|
||||
player = sObjectMgr.GetPlayer(maxguid);
|
||||
|
||||
if(player && player->GetSession())
|
||||
|
|
@ -817,7 +817,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers)
|
|||
continue;
|
||||
|
||||
uint8 randomN = urand(1, 99);
|
||||
SendLootRoll(0, itr->first, randomN, itr->second, *roll);
|
||||
SendLootRoll(itr->first, randomN, itr->second, *roll);
|
||||
if (maxresul < randomN)
|
||||
{
|
||||
maxguid = itr->first;
|
||||
|
|
@ -825,7 +825,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers)
|
|||
rollvote = itr->second;
|
||||
}
|
||||
}
|
||||
SendLootRollWon(0, maxguid, maxresul, rollvote, *roll);
|
||||
SendLootRollWon(maxguid, maxresul, rollvote, *roll);
|
||||
player = sObjectMgr.GetPlayer(maxguid);
|
||||
|
||||
if(player && player->GetSession())
|
||||
|
|
|
|||
|
|
@ -104,15 +104,16 @@ class InstanceSave;
|
|||
class Roll : public LootValidatorRef
|
||||
{
|
||||
public:
|
||||
Roll(uint64 _guid, LootItem const& li)
|
||||
: itemGUID(_guid), itemid(li.itemid), itemRandomPropId(li.randomPropertyId), itemRandomSuffix(li.randomSuffix), itemCount(li.count),
|
||||
Roll(ObjectGuid _itemGuid, ObjectGuid _lootedTragetGuid, LootItem const& li)
|
||||
: itemGUID(_itemGuid), lootedTargetGUID(_lootedTragetGuid), itemid(li.itemid), itemRandomPropId(li.randomPropertyId), itemRandomSuffix(li.randomSuffix),
|
||||
totalPlayersRolling(0), totalNeed(0), totalGreed(0), totalPass(0), itemSlot(0) {}
|
||||
~Roll() { }
|
||||
void setLoot(Loot *pLoot) { link(pLoot, this); }
|
||||
Loot *getLoot() { return getTarget(); }
|
||||
void targetObjectBuildLink();
|
||||
|
||||
uint64 itemGUID;
|
||||
ObjectGuid itemGUID;
|
||||
ObjectGuid lootedTargetGUID;
|
||||
uint32 itemid;
|
||||
int32 itemRandomPropId;
|
||||
uint32 itemRandomSuffix;
|
||||
|
|
@ -313,13 +314,13 @@ class MANGOS_DLL_SPEC Group
|
|||
/*********************************************************/
|
||||
|
||||
void SendLootStartRoll(uint32 CountDown, const Roll &r);
|
||||
void SendLootRoll(const uint64& SourceGuid, const uint64& TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r);
|
||||
void SendLootRollWon(const uint64& SourceGuid, const uint64& TargetGuid, uint8 RollNumber, uint8 RollType, 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 SendLootAllPassed(uint32 NumberOfPlayers, const Roll &r);
|
||||
void GroupLoot(const uint64& playerGUID, Loot *loot, Creature *creature);
|
||||
void NeedBeforeGreed(const uint64& playerGUID, Loot *loot, Creature *creature);
|
||||
void MasterLoot(const uint64& playerGUID, Loot *loot, Creature *creature);
|
||||
Rolls::iterator GetRoll(uint64 Guid)
|
||||
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);
|
||||
Rolls::iterator GetRoll(ObjectGuid const& Guid)
|
||||
{
|
||||
Rolls::iterator iter;
|
||||
for (iter=RollId.begin(); iter != RollId.end(); ++iter)
|
||||
|
|
@ -332,7 +333,7 @@ class MANGOS_DLL_SPEC Group
|
|||
return RollId.end();
|
||||
}
|
||||
void CountTheRoll(Rolls::iterator roll, uint32 NumberOfPlayers);
|
||||
void CountRollVote(const uint64& playerGUID, const uint64& Guid, uint32 NumberOfPlayers, uint8 Choise);
|
||||
void CountRollVote(ObjectGuid const& playerGUID, ObjectGuid const& itemGuid, uint32 numberOfPlayers, uint8 choise);
|
||||
void EndRoll();
|
||||
|
||||
void LinkMember(GroupReference *pRef) { m_memberMgr.insertFirst(pRef); }
|
||||
|
|
|
|||
|
|
@ -7730,13 +7730,13 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)
|
|||
{
|
||||
case GROUP_LOOT:
|
||||
// GroupLoot delete items over threshold (threshold even not implemented), and roll them. Items with quality<threshold, round robin
|
||||
group->GroupLoot(recipient->GetGUID(), loot, creature);
|
||||
group->GroupLoot(recipient->GetObjectGuid(), loot, creature);
|
||||
break;
|
||||
case NEED_BEFORE_GREED:
|
||||
group->NeedBeforeGreed(recipient->GetGUID(), loot, creature);
|
||||
group->NeedBeforeGreed(recipient->GetObjectGuid(), loot, creature);
|
||||
break;
|
||||
case MASTER_LOOT:
|
||||
group->MasterLoot(recipient->GetGUID(), loot, creature);
|
||||
group->MasterLoot(recipient->GetObjectGuid(), loot, creature);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "9581"
|
||||
#define REVISION_NR "9582"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue