aboutsummaryrefslogtreecommitdiff
path: root/src/game/Group.cpp
diff options
context:
space:
mode:
authorTrazom62 <none@none>2010-04-17 18:55:17 +0200
committerTrazom62 <none@none>2010-04-17 18:55:17 +0200
commitfbe4539e23b7b4cc052b09f2f31dc90bc6dff67b (patch)
tree08f222eb6af48bcc20ddda5e96ff0999f2f8c82c /src/game/Group.cpp
parentcc2db574f119547060cb7c3482fb29ec408d28a8 (diff)
Implement auto pass on loot.
Fixes issue #1684. --HG-- branch : trunk
Diffstat (limited to 'src/game/Group.cpp')
-rw-r--r--src/game/Group.cpp56
1 files changed, 52 insertions, 4 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);