Core/Groups: Need restrictions in need before greed loot method should apply only to LFG dungeons
This commit is contained in:
@@ -11811,8 +11811,26 @@ InventoryResult Player::CanUseItem(ItemTemplate const* proto) const
|
|||||||
return EQUIP_ERR_ITEM_NOT_FOUND;
|
return EQUIP_ERR_ITEM_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
InventoryResult Player::CanRollForItem(ItemTemplate const* proto) const
|
InventoryResult Player::CanRollForItemInLFG(ItemTemplate const* proto, WorldObject const* lootedObject) const
|
||||||
{
|
{
|
||||||
|
LfgDungeonSet const& dungeons = sLFGMgr->GetSelectedDungeons(GetGUID());
|
||||||
|
if (dungeons.empty())
|
||||||
|
return EQUIP_ERR_OK; // not using LFG
|
||||||
|
|
||||||
|
if (!GetGroup() || !GetGroup()->isLFGGroup())
|
||||||
|
return EQUIP_ERR_OK; // not in LFG group
|
||||||
|
|
||||||
|
// check if looted object is inside the lfg dungeon
|
||||||
|
bool lootedObjectInDungeon = false;
|
||||||
|
Map const* map = lootedObject->GetMap();
|
||||||
|
if (uint32 dungeonId = sLFGMgr->GetDungeon(GetGroup()->GetGUID(), true))
|
||||||
|
if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId))
|
||||||
|
if (dungeon->map == map->GetId() && dungeon->difficulty == map->GetDifficulty())
|
||||||
|
lootedObjectInDungeon = true;
|
||||||
|
|
||||||
|
if (!lootedObjectInDungeon)
|
||||||
|
return EQUIP_ERR_OK;
|
||||||
|
|
||||||
if (!proto)
|
if (!proto)
|
||||||
return EQUIP_ERR_ITEM_NOT_FOUND;
|
return EQUIP_ERR_ITEM_NOT_FOUND;
|
||||||
// Used by group, function NeedBeforeGreed, to know if a prototype can be used by a player
|
// Used by group, function NeedBeforeGreed, to know if a prototype can be used by a player
|
||||||
|
|||||||
@@ -1277,7 +1277,7 @@ class Player : public Unit, public GridObject<Player>
|
|||||||
bool HasItemTotemCategory(uint32 TotemCategory) const;
|
bool HasItemTotemCategory(uint32 TotemCategory) const;
|
||||||
InventoryResult CanUseItem(ItemTemplate const* pItem) const;
|
InventoryResult CanUseItem(ItemTemplate const* pItem) const;
|
||||||
InventoryResult CanUseAmmo(uint32 item) const;
|
InventoryResult CanUseAmmo(uint32 item) const;
|
||||||
InventoryResult CanRollForItem(ItemTemplate const* item) const;
|
InventoryResult CanRollForItemInLFG(ItemTemplate const* item, WorldObject const* lootedObject) const;
|
||||||
Item* StoreNewItem(ItemPosCountVec const& pos, uint32 item, bool update, int32 randomPropertyId = 0);
|
Item* StoreNewItem(ItemPosCountVec const& pos, uint32 item, bool update, int32 randomPropertyId = 0);
|
||||||
Item* StoreNewItem(ItemPosCountVec const& pos, uint32 item, bool update, int32 randomPropertyId, AllowedLooterSet &allowedLooters);
|
Item* StoreNewItem(ItemPosCountVec const& pos, uint32 item, bool update, int32 randomPropertyId, AllowedLooterSet &allowedLooters);
|
||||||
Item* StoreItem(ItemPosCountVec const& pos, Item* pItem, bool update);
|
Item* StoreItem(ItemPosCountVec const& pos, Item* pItem, bool update);
|
||||||
|
|||||||
@@ -740,24 +740,24 @@ 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())
|
if (!p || !p->GetSession())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
WorldPacket data(SMSG_LOOT_START_ROLL, (8 + 4 + 4 + 4 + 4 + 4 + 4 + 1 ));
|
WorldPacket data(SMSG_LOOT_START_ROLL, (8 + 4 + 4 + 4 + 4 + 4 + 4 + 1 ));
|
||||||
data << uint64(r.itemGUID); // guid of rolled item
|
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.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.itemid); // the itemEntryId for the item that shall be rolled for
|
||||||
data << uint32(r.itemRandomSuffix); // randomSuffix
|
data << uint32(r.itemRandomSuffix); // randomSuffix
|
||||||
data << uint32(r.itemRandomPropId); // item random property ID
|
data << uint32(r.itemRandomPropId); // item random property ID
|
||||||
data << uint32(r.itemCount); // items in stack
|
data << uint32(r.itemCount); // items in stack
|
||||||
data << uint32(CountDown); // the countdown time to choose "need" or "greed"
|
data << uint32(countDown); // the countdown time to choose "need" or "greed"
|
||||||
uint8 VoteMask = r.rollVoteMask;
|
uint8 voteMask = r.rollVoteMask;
|
||||||
if (NeedBlocked)
|
if (!canNeed)
|
||||||
VoteMask &= ~ROLL_FLAG_TYPE_NEED;
|
voteMask &= ~ROLL_FLAG_TYPE_NEED;
|
||||||
data << uint8(VoteMask); // roll type mask
|
data << uint8(voteMask); // roll type mask
|
||||||
|
|
||||||
p->GetSession()->SendPacket(&data);
|
p->GetSession()->SendPacket(&data);
|
||||||
}
|
}
|
||||||
@@ -944,7 +944,7 @@ void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject)
|
|||||||
{
|
{
|
||||||
ItemTemplate const* item;
|
ItemTemplate const* item;
|
||||||
uint8 itemSlot = 0;
|
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)
|
if (i->freeforall)
|
||||||
continue;
|
continue;
|
||||||
@@ -991,7 +991,7 @@ void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject)
|
|||||||
loot->items[itemSlot].is_blocked = true;
|
loot->items[itemSlot].is_blocked = true;
|
||||||
|
|
||||||
//Broadcast Pass and Send Rollstart
|
//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);
|
Player* p = ObjectAccessor::FindPlayer(itr->first);
|
||||||
if (!p || !p->GetSession())
|
if (!p || !p->GetSession())
|
||||||
@@ -999,10 +999,8 @@ void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject)
|
|||||||
|
|
||||||
if (itr->second == PASS)
|
if (itr->second == PASS)
|
||||||
SendLootRoll(newitemGUID, p->GetGUID(), 128, ROLL_PASS, *r);
|
SendLootRoll(newitemGUID, p->GetGUID(), 128, ROLL_PASS, *r);
|
||||||
if (p->CanRollForItem(item) == EQUIP_ERR_OK)
|
|
||||||
SendLootStartRollToPlayer(60000, lootedObject->GetMapId(), p, false, *r);
|
|
||||||
else
|
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);
|
RollId.push_back(r);
|
||||||
@@ -1012,6 +1010,11 @@ void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject)
|
|||||||
creature->m_groupLootTimer = 60000;
|
creature->m_groupLootTimer = 60000;
|
||||||
creature->lootingGroupLowGUID = GetLowGUID();
|
creature->lootingGroupLowGUID = GetLowGUID();
|
||||||
}
|
}
|
||||||
|
else if (GameObject* go = lootedObject->ToGameObject())
|
||||||
|
{
|
||||||
|
go->m_groupLootTimer = 60000;
|
||||||
|
go->lootingGroupLowGUID = GetLowGUID();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
delete r;
|
delete r;
|
||||||
|
|||||||
@@ -273,7 +273,7 @@ class Group
|
|||||||
|
|
||||||
bool isRollLootActive() const;
|
bool isRollLootActive() const;
|
||||||
void SendLootStartRoll(uint32 CountDown, uint32 mapid, const Roll &r);
|
void SendLootStartRoll(uint32 CountDown, uint32 mapid, const Roll &r);
|
||||||
void SendLootStartRollToPlayer(uint32 CountDown, uint32 mapid, Player* p, bool NeedBlocked, const Roll &r);
|
void SendLootStartRollToPlayer(uint32 countDown, uint32 mapId, Player* p, bool canNeed, Roll const& r);
|
||||||
void SendLootRoll(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r);
|
void SendLootRoll(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r);
|
||||||
void SendLootRollWon(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r);
|
void SendLootRollWon(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r);
|
||||||
void SendLootAllPassed(uint32 NumberOfPlayers, const Roll &r);
|
void SendLootAllPassed(uint32 NumberOfPlayers, const Roll &r);
|
||||||
|
|||||||
Reference in New Issue
Block a user