diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Group.cpp | 56 | ||||
-rw-r--r-- | src/game/GroupHandler.cpp | 11 | ||||
-rw-r--r-- | src/game/Player.cpp | 1 | ||||
-rw-r--r-- | src/game/Player.h | 4 |
4 files changed, 62 insertions, 10 deletions
diff --git a/src/game/Group.cpp b/src/game/Group.cpp index 5087a200da6..588db34d5d2 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -489,7 +489,7 @@ void Group::SendLootStartRoll(uint32 CountDown, uint32 mapid, const Roll &r) if (!p || !p->GetSession()) continue; - if (itr->second != NOT_VALID) + if (itr->second == NOT_EMITED_YET) p->GetSession()->SendPacket(&data); } } @@ -505,7 +505,7 @@ void Group::SendLootRoll(const uint64& SourceGuid, const uint64& TargetGuid, uin 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(0); // auto pass on loot + data << uint8(0); // auto pass on NeedBeforeGreed loot because player cannot use the object for (Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr != r.playerVote.end(); ++itr) { @@ -612,8 +612,18 @@ void Group::GroupLoot(Loot *loot, WorldObject* pLootedObject) { if (member->IsWithinDistInMap(pLootedObject,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) { - r->playerVote[member->GetGUID()] = NOT_EMITED_YET; r->totalPlayersRolling++; + + if (member->GetPassOnGroupLoot()) + { + r->playerVote[member->GetGUID()] = PASS; + r->totalPass++; + // can't broadcast the pass now. need to wait until all rolling players are known. + } + else + { + r->playerVote[member->GetGUID()] = NOT_EMITED_YET; + } } } } @@ -625,6 +635,20 @@ void Group::GroupLoot(Loot *loot, WorldObject* pLootedObject) loot->items[itemSlot].is_blocked = true; + // If there is any "auto pass", broadcast the pass now. + if (r->totalPass) + { + for (Roll::PlayerVote::const_iterator itr=r->playerVote.begin(); itr != r->playerVote.end(); ++itr) + { + Player *p = objmgr.GetPlayer(itr->first); + if (!p || !p->GetSession()) + continue; + + if (itr->second == PASS) + SendLootRoll(newitemGUID, p->GetGUID(), 128, ROLL_PASS, *r); + } + } + SendLootStartRoll(60000, pLootedObject->GetMapId(), *r); RollId.push_back(r); @@ -677,8 +701,18 @@ void Group::NeedBeforeGreed(Loot *loot, WorldObject* pLootedObject) { if (playerToRoll->IsWithinDistInMap(pLootedObject,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) { - r->playerVote[playerToRoll->GetGUID()] = NOT_EMITED_YET; r->totalPlayersRolling++; + + if (playerToRoll->GetPassOnGroupLoot()) + { + r->playerVote[playerToRoll->GetGUID()] = PASS; + r->totalPass++; + // can't broadcast the pass now. need to wait until all rolling players are known. + } + else + { + r->playerVote[playerToRoll->GetGUID()] = NOT_EMITED_YET; + } } } } @@ -690,6 +724,20 @@ void Group::NeedBeforeGreed(Loot *loot, WorldObject* pLootedObject) loot->items[itemSlot].is_blocked = true; + // If there is any "auto pass", broadcast the pass now. + if (r->totalPass) + { + for (Roll::PlayerVote::const_iterator itr=r->playerVote.begin(); itr != r->playerVote.end(); ++itr) + { + Player *p = objmgr.GetPlayer(itr->first); + if (!p || !p->GetSession()) + continue; + + if (itr->second == PASS) + SendLootRoll(newitemGUID, p->GetGUID(), 128, ROLL_PASS, *r); + } + } + SendLootStartRoll(60000, pLootedObject->GetMapId(), *r); RollId.push_back(r); diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp index 3b85872dbfe..99ff56d097a 100644 --- a/src/game/GroupHandler.cpp +++ b/src/game/GroupHandler.cpp @@ -914,17 +914,16 @@ void WorldSession::HandleOptOutOfLootOpcode(WorldPacket & recv_data) { sLog.outDebug("WORLD: Received CMSG_OPT_OUT_OF_LOOT"); - uint32 unkn; - recv_data >> unkn; + uint32 passOnLoot; + recv_data >> passOnLoot; // 1 always pass, 0 do not pass // ignore if player not loaded if (!GetPlayer()) // needed because STATUS_AUTHED { - if (unkn != 0) - sLog.outError("CMSG_GROUP_PASS_ON_LOOT value<>0 for not-loaded character!"); + if (passOnLoot != 0) + sLog.outError("CMSG_OPT_OUT_OF_LOOT value<>0 for not-loaded character!"); return; } - if (unkn != 0) - sLog.outError("CMSG_GROUP_PASS_ON_LOOT: activation not implemented!"); + GetPlayer()->SetPassOnGroupLoot(passOnLoot); } diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 62dc4789533..60b7252baa8 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -337,6 +337,7 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa SetGroupInvite(NULL); m_groupUpdateMask = 0; m_auraRaidUpdateMask = 0; + m_bPassOnGroupLoot = false; duel = NULL; diff --git a/src/game/Player.h b/src/game/Player.h index 9271f868362..7b47b0d7c0f 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -2290,6 +2290,9 @@ class Player : public Unit, public GridObject<Player> uint8 GetOriginalSubGroup() const { return m_originalGroup.getSubGroup(); } void SetOriginalGroup(Group *group, int8 subgroup = -1); + void SetPassOnGroupLoot(bool bPassOnGroupLoot) { m_bPassOnGroupLoot = bPassOnGroupLoot; } + bool GetPassOnGroupLoot() const { return m_bPassOnGroupLoot; } + MapReference &GetMapRef() { return m_mapRef; } // Set map to player and add reference @@ -2563,6 +2566,7 @@ class Player : public Unit, public GridObject<Player> Group *m_groupInvite; uint32 m_groupUpdateMask; uint64 m_auraRaidUpdateMask; + bool m_bPassOnGroupLoot; // last used pet number (for BG's) uint32 m_lastpetnumber; |