AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Group.cpp File Reference
#include "Group.h"
#include "Battleground.h"
#include "BattlegroundMgr.h"
#include "Config.h"
#include "DatabaseEnv.h"
#include "GameTime.h"
#include "GroupMgr.h"
#include "InstanceSaveMgr.h"
#include "LFG.h"
#include "LFGMgr.h"
#include "Log.h"
#include "MapMgr.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "SharedDefines.h"
#include "UpdateFieldFlags.h"
#include "Util.h"
#include "World.h"
#include "WorldPacket.h"
#include "WorldSession.h"
#include "ArenaTeam.h"
#include "ArenaTeamMgr.h"

Go to the source code of this file.

Functions

bool CanRollOnItem (LootItem const &item, Player const *player, Loot *loot)
 

Function Documentation

◆ CanRollOnItem()

bool CanRollOnItem ( LootItem const &  item,
Player const *  player,
Loot loot 
)
986{
987 // Players can't roll on unique items if they already reached the maximum quantity of that item
988 ItemTemplate const* proto = sObjectMgr->GetItemTemplate(item.itemid);
989 if (!proto)
990 return false;
991
992 uint32 itemCount = player->GetItemCount(item.itemid);
993 if ((proto->MaxCount > 0 && static_cast<int32>(itemCount) >= proto->MaxCount))
994 return false;
995
996 if (!item.AllowedForPlayer(player, loot->sourceWorldObjectGUID))
997 return false;
998
999 return true;
1000}
std::int32_t int32
Definition: Define.h:103
std::uint32_t uint32
Definition: Define.h:107
#define sObjectMgr
Definition: ObjectMgr.h:1635
Definition: ItemTemplate.h:619
int32 MaxCount
Definition: ItemTemplate.h:644
ObjectGuid sourceWorldObjectGUID
Definition: LootMgr.h:330

References LootItem::AllowedForPlayer(), Player::GetItemCount(), LootItem::itemid, ItemTemplate::MaxCount, sObjectMgr, and Loot::sourceWorldObjectGUID.

Referenced by Group::GroupLoot(), and Group::NeedBeforeGreed().