aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Groups/Group.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2012-01-14 18:42:23 +0100
committerShauren <shauren.trinity@gmail.com>2012-01-14 18:42:23 +0100
commit894c27af520eb550764d4cacd2b43e87fd100597 (patch)
tree48df44f5a28e6b253d427e64f5a9babf4cef5ff6 /src/server/game/Groups/Group.cpp
parentf4075f0f945c842fe2b1a08ea4a7fa253e8e2e53 (diff)
Core/Groups: Need restrictions in need before greed loot method should apply only to LFG dungeons
Diffstat (limited to 'src/server/game/Groups/Group.cpp')
-rwxr-xr-xsrc/server/game/Groups/Group.cpp37
1 files changed, 20 insertions, 17 deletions
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp
index b2fb59ea993..19bc1ab7dea 100755
--- a/src/server/game/Groups/Group.cpp
+++ b/src/server/game/Groups/Group.cpp
@@ -190,7 +190,7 @@ void Group::LoadGroupFromDB(Field* fields)
m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL;
else
m_raidDifficulty = Difficulty(r_diff);
-
+
if (m_groupType & GROUPTYPE_LFG)
sLFGMgr->_LoadFromDB(fields, GetGUID());
}
@@ -547,7 +547,7 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOV
}
SendUpdate();
-
+
if (isLFGGroup() && GetMembersCount() == 1)
{
Player* Leader = ObjectAccessor::FindPlayer(GetLeaderGUID());
@@ -700,7 +700,7 @@ void Group::Disband(bool hideDestroy /* = false */)
CharacterDatabase.CommitTransaction(trans);
ResetInstances(INSTANCE_RESET_GROUP_DISBAND, false, NULL);
ResetInstances(INSTANCE_RESET_GROUP_DISBAND, true, NULL);
-
+
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_LFG_DATA);
stmt->setUInt32(0, m_dbStoreId);
CharacterDatabase.Execute(stmt);
@@ -740,25 +740,25 @@ void Group::SendLootStartRoll(uint32 CountDown, uint32 mapid, const Roll &r)
}
}
-void Group::SendLootStartRollToPlayer(uint32 CountDown, uint32 mapid, Player* p, bool NeedBlocked, const Roll &r)
+void Group::SendLootStartRollToPlayer(uint32 countDown, uint32 mapId, Player* p, bool canNeed, Roll const& r)
{
if (!p || !p->GetSession())
return;
-
+
WorldPacket data(SMSG_LOOT_START_ROLL, (8 + 4 + 4 + 4 + 4 + 4 + 4 + 1 ));
data << uint64(r.itemGUID); // guid of rolled item
- data << uint32(mapid); // 3.3.3 mapid
+ data << uint32(mapId); // 3.3.3 mapid
data << uint32(r.totalPlayersRolling); // maybe the number of players rolling for it???
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 << uint32(r.itemCount); // items in stack
- data << uint32(CountDown); // the countdown time to choose "need" or "greed"
- uint8 VoteMask = r.rollVoteMask;
- if (NeedBlocked)
- VoteMask &= ~ROLL_FLAG_TYPE_NEED;
- data << uint8(VoteMask); // roll type mask
-
+ data << uint32(countDown); // the countdown time to choose "need" or "greed"
+ uint8 voteMask = r.rollVoteMask;
+ if (!canNeed)
+ voteMask &= ~ROLL_FLAG_TYPE_NEED;
+ data << uint8(voteMask); // roll type mask
+
p->GetSession()->SendPacket(&data);
}
@@ -944,7 +944,7 @@ void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject)
{
ItemTemplate const* item;
uint8 itemSlot = 0;
- for (std::vector<LootItem>::iterator i=loot->items.begin(); i != loot->items.end(); ++i, ++itemSlot)
+ for (std::vector<LootItem>::iterator i = loot->items.begin(); i != loot->items.end(); ++i, ++itemSlot)
{
if (i->freeforall)
continue;
@@ -991,7 +991,7 @@ void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject)
loot->items[itemSlot].is_blocked = true;
//Broadcast Pass and Send Rollstart
- for (Roll::PlayerVote::const_iterator itr=r->playerVote.begin(); itr != r->playerVote.end(); ++itr)
+ for (Roll::PlayerVote::const_iterator itr = r->playerVote.begin(); itr != r->playerVote.end(); ++itr)
{
Player* p = ObjectAccessor::FindPlayer(itr->first);
if (!p || !p->GetSession())
@@ -999,10 +999,8 @@ void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject)
if (itr->second == PASS)
SendLootRoll(newitemGUID, p->GetGUID(), 128, ROLL_PASS, *r);
- if (p->CanRollForItem(item) == EQUIP_ERR_OK)
- SendLootStartRollToPlayer(60000, lootedObject->GetMapId(), p, false, *r);
else
- SendLootStartRollToPlayer(60000, lootedObject->GetMapId(), p, true, *r);
+ SendLootStartRollToPlayer(60000, lootedObject->GetMapId(), p, p->CanRollForItemInLFG(item, lootedObject) == EQUIP_ERR_OK, *r);
}
RollId.push_back(r);
@@ -1012,6 +1010,11 @@ void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject)
creature->m_groupLootTimer = 60000;
creature->lootingGroupLowGUID = GetLowGUID();
}
+ else if (GameObject* go = lootedObject->ToGameObject())
+ {
+ go->m_groupLootTimer = 60000;
+ go->lootingGroupLowGUID = GetLowGUID();
+ }
}
else
delete r;