TrinityCore
Group Class Reference

#include <Group.h>

Classes

struct  MemberSlot
 

Public Types

typedef std::list< MemberSlotMemberSlotList
 
typedef MemberSlotList::const_iterator member_citerator
 
typedef std::unordered_map< Difficulty, std::unordered_map< uint32, InstanceGroupBind > > BoundInstancesMap
 

Public Member Functions

 Group ()
 
 ~Group ()
 
bool Create (Player *leader)
 
void LoadGroupFromDB (Field *field)
 
void LoadMemberFromDB (ObjectGuid::LowType guidLow, uint8 memberFlags, uint8 subgroup, uint8 roles)
 
bool AddInvite (Player *player)
 
void RemoveInvite (Player *player)
 
void RemoveAllInvites ()
 
bool AddLeaderInvite (Player *player)
 
bool AddMember (Player *player)
 
bool RemoveMember (ObjectGuid guid, RemoveMethod method=GROUP_REMOVEMETHOD_DEFAULT, ObjectGuid kicker=ObjectGuid::Empty, const char *reason=nullptr)
 
void ChangeLeader (ObjectGuid guid, int8 partyIndex=0)
 
void SetLootMethod (LootMethod method)
 
void SetLooterGuid (ObjectGuid guid)
 
void SetMasterLooterGuid (ObjectGuid guid)
 
void UpdateLooterGuid (WorldObject *pLootedObject, bool ifneed=false)
 
void SetLootThreshold (ItemQualities threshold)
 
void Disband (bool hideDestroy=false)
 
void SetLfgRoles (ObjectGuid guid, uint8 roles)
 
uint8 GetLfgRoles (ObjectGuid guid)
 
void SetEveryoneIsAssistant (bool apply)
 
void Update (uint32 diff)
 
void UpdateReadyCheck (uint32 diff)
 
void StartReadyCheck (ObjectGuid starterGuid, int8 partyIndex, Milliseconds duration=Milliseconds(READYCHECK_DURATION))
 
void EndReadyCheck ()
 
bool IsReadyCheckStarted (void) const
 
bool IsReadyCheckCompleted (void) const
 
void SetOfflineMembersReadyChecked (void)
 
void SetMemberReadyCheck (ObjectGuid guid, bool ready)
 
void SetMemberReadyCheck (MemberSlot *slot, bool ready)
 
void SetMemberReadyChecked (MemberSlot *slot)
 
void ResetMemberReadyChecked (void)
 
void AddRaidMarker (uint8 markerId, uint32 mapId, float positionX, float positionY, float positionZ, ObjectGuid transportGuid=ObjectGuid::Empty)
 
void DeleteRaidMarker (uint8 markerId)
 
void SendRaidMarkersChanged (WorldSession *session=nullptr, int8 partyIndex=0)
 
bool IsFull () const
 
bool isLFGGroup () const
 
bool isRaidGroup () const
 
bool isBGGroup () const
 
bool isBFGroup () const
 
bool IsCreated () const
 
GroupCategory GetGroupCategory () const
 
ObjectGuid GetLeaderGUID () const
 
ObjectGuid GetGUID () const
 
const char * GetLeaderName () const
 
LootMethod GetLootMethod () const
 
ObjectGuid GetLooterGuid () const
 
ObjectGuid GetMasterLooterGuid () const
 
ItemQualities GetLootThreshold () const
 
uint32 GetDbStoreId () const
 
bool IsMember (ObjectGuid guid) const
 
bool IsLeader (ObjectGuid guid) const
 
ObjectGuid GetMemberGUID (const std::string &name)
 
uint8 GetMemberFlags (ObjectGuid guid) const
 
bool IsAssistant (ObjectGuid guid) const
 
PlayerGetInvited (ObjectGuid guid) const
 
PlayerGetInvited (const std::string &name) const
 
bool SameSubGroup (ObjectGuid guid1, ObjectGuid guid2) const
 
bool SameSubGroup (ObjectGuid guid1, MemberSlot const *slot2) const
 
bool SameSubGroup (Player const *member1, Player const *member2) const
 
bool HasFreeSlotSubGroup (uint8 subgroup) const
 
MemberSlotList const & GetMemberSlots () const
 
GroupReferenceGetFirstMember ()
 
GroupReference const * GetFirstMember () const
 
uint32 GetMembersCount () const
 
uint32 GetInviteeCount () const
 
GroupFlags GetGroupFlags () const
 
uint8 GetMemberGroup (ObjectGuid guid) const
 
void ConvertToLFG ()
 
void ConvertToRaid ()
 
void ConvertToGroup ()
 
void SetBattlegroundGroup (Battleground *bg)
 
void SetBattlefieldGroup (Battlefield *bf)
 
GroupJoinBattlegroundResult CanJoinBattlegroundQueue (Battleground const *bgOrTemplate, BattlegroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot, ObjectGuid &errorGuid)
 
void ChangeMembersGroup (ObjectGuid guid, uint8 group)
 
void SwapMembersGroups (ObjectGuid firstGuid, ObjectGuid secondGuid)
 
void SetTargetIcon (uint8 symbol, ObjectGuid target, ObjectGuid changedBy, uint8 partyIndex)
 
void SetGroupMemberFlag (ObjectGuid guid, bool apply, GroupMemberFlags flag)
 
void RemoveUniqueGroupMemberFlag (GroupMemberFlags flag)
 
void SetDungeonDifficultyID (Difficulty difficulty)
 
void SetRaidDifficultyID (Difficulty difficulty)
 
void SetLegacyRaidDifficultyID (Difficulty difficulty)
 
Difficulty GetDifficultyID (MapEntry const *mapEntry) const
 
Difficulty GetDungeonDifficultyID () const
 
Difficulty GetRaidDifficultyID () const
 
Difficulty GetLegacyRaidDifficultyID () const
 
void ResetInstances (uint8 method, bool isRaid, bool isLegacy, Player *SendMsgTo)
 
void SendTargetIconList (WorldSession *session, int8 partyIndex=0)
 
void SendUpdate ()
 
void SendUpdateToPlayer (ObjectGuid playerGUID, MemberSlot *slot=nullptr)
 
void SendUpdateDestroyGroupToPlayer (Player *player) const
 
void UpdatePlayerOutOfRange (Player *player)
 
template<class Worker >
void BroadcastWorker (Worker &worker)
 
template<class Worker >
void BroadcastWorker (Worker const &worker) const
 
void BroadcastPacket (WorldPacket const *packet, bool ignorePlayersInBGRaid, int group=-1, ObjectGuid ignoredPlayer=ObjectGuid::Empty)
 
void BroadcastAddonMessagePacket (WorldPacket const *packet, const std::string &prefix, bool ignorePlayersInBGRaid, int group=-1, ObjectGuid ignore=ObjectGuid::Empty)
 
bool isRollLootActive () const
 
void SendLootStartRollToPlayer (uint32 countDown, uint32 mapId, Player *p, bool canNeed, Roll const &r) const
 
void SendLootRoll (ObjectGuid playerGuid, int32 rollNumber, uint8 rollType, Roll const &roll) const
 
void SendLootRollWon (ObjectGuid winnerGuid, int32 rollNumber, uint8 rollType, Roll const &roll) const
 
void SendLootAllPassed (Roll const &roll) const
 
void SendLootRollsComplete (Roll const &roll) const
 
void SendLooter (Creature *creature, Player *pLooter)
 
void GroupLoot (Loot *loot, WorldObject *pLootedObject)
 
void MasterLoot (Loot *loot, WorldObject *pLootedObject)
 
Rolls::iterator GetRoll (ObjectGuid lootObjectGuid, uint8 lootListId)
 
void CountTheRoll (Rolls::iterator roll, Map *allowedMap)
 
void CountRollVote (ObjectGuid playerGuid, ObjectGuid lootObjectGuid, uint8 lootListId, uint8 choice)
 
void EndRoll (Loot *loot, Map *allowedMap)
 
void ResetMaxEnchantingLevel ()
 
void LinkMember (GroupReference *pRef)
 
void DelinkMember (ObjectGuid guid)
 
InstanceGroupBindBindToInstance (InstanceSave *save, bool permanent, bool load=false)
 
void UnbindInstance (uint32 mapid, uint8 difficulty, bool unload=false)
 
InstanceGroupBindGetBoundInstance (Player *player)
 
InstanceGroupBindGetBoundInstance (Map *aMap)
 
InstanceGroupBindGetBoundInstance (MapEntry const *mapEntry)
 
InstanceGroupBindGetBoundInstance (Difficulty difficulty, uint32 mapId)
 
BoundInstancesMap::iterator GetBoundInstances (Difficulty difficulty)
 
BoundInstancesMap::iterator GetBoundInstanceEnd ()
 
void BroadcastGroupUpdate (void)
 

Static Public Member Functions

static void ConvertLeaderInstancesToGroup (Player *player, Group *group, bool switchLeader)
 convert the player's binds to the group More...
 

Protected Types

typedef MemberSlotList::iterator member_witerator
 
typedef std::set< Player * > InvitesList
 
typedef std::vector< Roll * > Rolls
 

Protected Member Functions

bool _setMembersGroup (ObjectGuid guid, uint8 group)
 
void _homebindIfInstance (Player *player)
 
void _initRaidSubGroupsCounter ()
 
member_citerator _getMemberCSlot (ObjectGuid Guid) const
 
member_witerator _getMemberWSlot (ObjectGuid Guid)
 
void SubGroupCounterIncrease (uint8 subgroup)
 
void SubGroupCounterDecrease (uint8 subgroup)
 
void ToggleGroupMemberFlag (member_witerator slot, uint8 flag, bool apply)
 

Protected Attributes

MemberSlotList m_memberSlots
 
GroupRefManager m_memberMgr
 
InvitesList m_invitees
 
ObjectGuid m_leaderGuid
 
std::string m_leaderName
 
GroupFlags m_groupFlags
 
GroupCategory m_groupCategory
 
Difficulty m_dungeonDifficulty
 
Difficulty m_raidDifficulty
 
Difficulty m_legacyRaidDifficulty
 
Battlegroundm_bgGroup
 
Battlefieldm_bfGroup
 
ObjectGuid m_targetIcons [TARGET_ICONS_COUNT]
 
LootMethod m_lootMethod
 
ItemQualities m_lootThreshold
 
ObjectGuid m_looterGuid
 
ObjectGuid m_masterLooterGuid
 
Rolls RollId
 
BoundInstancesMap m_boundInstances
 
uint8m_subGroupsCounts
 
ObjectGuid m_guid
 
uint32 m_maxEnchantingLevel
 
uint32 m_dbStoreId
 
bool m_readyCheckStarted
 
Milliseconds m_readyCheckTimer
 
std::array< std::unique_ptr< RaidMarker >, RAID_MARKERS_COUNTm_markers
 
uint32 m_activeMarkers
 

Detailed Description

request member stats checken

Todo:
uninvite people that not accepted invite

Member Typedef Documentation

◆ BoundInstancesMap

typedef std::unordered_map<Difficulty, std::unordered_map<uint32 , InstanceGroupBind> > Group::BoundInstancesMap

◆ InvitesList

typedef std::set<Player*> Group::InvitesList
protected

◆ member_citerator

typedef MemberSlotList::const_iterator Group::member_citerator

◆ member_witerator

typedef MemberSlotList::iterator Group::member_witerator
protected

◆ MemberSlotList

typedef std::list<MemberSlot> Group::MemberSlotList

◆ Rolls

typedef std::vector<Roll*> Group::Rolls
protected

Constructor & Destructor Documentation

◆ Group()

Group::Group ( )
66 m_readyCheckStarted(false), m_readyCheckTimer(Milliseconds::zero()), m_activeMarkers(0)
67 {
68  for (uint8 i = 0; i < TARGET_ICONS_COUNT; ++i)
69  m_targetIcons[i].Clear();
70 
71  for (uint8 i = 0; i < RAID_MARKERS_COUNT; ++i)
72  m_markers[i] = nullptr;
73 }
#define TARGET_ICONS_COUNT
Definition: Group.h:55
uint32 m_dbStoreId
Definition: Group.h:453
Definition: DBCEnums.h:600
Difficulty m_dungeonDifficulty
Definition: Group.h:438
Definition: Loot.h:72
uint32 m_activeMarkers
Definition: Group.h:461
Milliseconds m_readyCheckTimer
Definition: Group.h:457
uint8 * m_subGroupsCounts
Definition: Group.h:450
LootMethod m_lootMethod
Definition: Group.h:444
ObjectGuid m_guid
Definition: Group.h:451
bool m_readyCheckStarted
Definition: Group.h:456
Battlefield * m_bfGroup
Definition: Group.h:442
Definition: Group.h:107
ObjectGuid m_targetIcons[TARGET_ICONS_COUNT]
Definition: Group.h:443
Battleground * m_bgGroup
Definition: Group.h:441
Definition: DBCEnums.h:609
uint32 m_maxEnchantingLevel
Definition: Group.h:452
std::array< std::unique_ptr< RaidMarker >, RAID_MARKERS_COUNT > m_markers
Definition: Group.h:460
GroupFlags m_groupFlags
Definition: Group.h:436
ObjectGuid m_leaderGuid
Definition: Group.h:434
ObjectGuid m_looterGuid
Definition: Group.h:446
GroupCategory m_groupCategory
Definition: Group.h:437
Definition: SharedDefines.h:340
#define RAID_MARKERS_COUNT
Definition: Group.h:56
ObjectGuid m_masterLooterGuid
Definition: Group.h:447
ItemQualities m_lootThreshold
Definition: Group.h:445
uint8_t uint8
Definition: Define.h:154
Difficulty m_legacyRaidDifficulty
Definition: Group.h:440
std::string m_leaderName
Definition: Group.h:435
Difficulty m_raidDifficulty
Definition: Group.h:439
Definition: DBCEnums.h:598
Definition: Group.h:122

◆ ~Group()

Group::~Group ( )
76 {
77  if (m_bgGroup)
78  {
79  TC_LOG_DEBUG("bg.battleground", "Group::~Group: battleground group being deleted.");
80  if (m_bgGroup->GetBgRaid(ALLIANCE) == this)
81  m_bgGroup->SetBgRaid(ALLIANCE, nullptr);
82  else if (m_bgGroup->GetBgRaid(HORDE) == this)
83  m_bgGroup->SetBgRaid(HORDE, nullptr);
84  else
85  TC_LOG_ERROR("misc", "Group::~Group: battleground group is not linked to the correct battleground.");
86  }
87  Rolls::iterator itr;
88  while (!RollId.empty())
89  {
90  itr = RollId.begin();
91  Roll *r = *itr;
92  RollId.erase(itr);
93  delete(r);
94  }
95 
96  // this may unload some instance saves
97  for (auto difficultyItr = m_boundInstances.begin(); difficultyItr != m_boundInstances.end(); ++difficultyItr)
98  for (auto itr2 = difficultyItr->second.begin(); itr2 != difficultyItr->second.end(); ++itr2)
99  itr2->second.save->RemoveGroup(this);
100 
101  // Sub group counters clean up
102  delete[] m_subGroupsCounts;
103 }
Rolls RollId
Definition: Group.h:448
void SetBgRaid(uint32 TeamID, Group *bg_raid)
Definition: Battleground.cpp:1847
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:186
uint8 * m_subGroupsCounts
Definition: Group.h:450
Definition: Group.h:172
Battleground * m_bgGroup
Definition: Group.h:441
Definition: SharedDefines.h:1081
BoundInstancesMap m_boundInstances
Definition: Group.h:449
Definition: SharedDefines.h:1080
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:177
Group * GetBgRaid(uint32 TeamID) const
Definition: Battleground.h:405
+ Here is the call graph for this function:

Member Function Documentation

◆ _getMemberCSlot()

Group::member_citerator Group::_getMemberCSlot ( ObjectGuid  Guid) const
protected
2642 {
2643  for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
2644  if (itr->guid == Guid)
2645  return itr;
2646  return m_memberSlots.end();
2647 }
MemberSlotList::const_iterator member_citerator
Definition: Group.h:233
MemberSlotList m_memberSlots
Definition: Group.h:431
+ Here is the caller graph for this function:

◆ _getMemberWSlot()

Group::member_witerator Group::_getMemberWSlot ( ObjectGuid  Guid)
protected
2650 {
2651  for (member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
2652  if (itr->guid == Guid)
2653  return itr;
2654  return m_memberSlots.end();
2655 }
MemberSlotList::iterator member_witerator
Definition: Group.h:237
MemberSlotList m_memberSlots
Definition: Group.h:431
+ Here is the caller graph for this function:

◆ _homebindIfInstance()

void Group::_homebindIfInstance ( Player player)
protected
2197 {
2198  if (player && !player->IsGameMaster() && sMapStore.LookupEntry(player->GetMapId())->IsDungeon())
2199  player->m_InstanceValid = false;
2200 }
bool IsDungeon() const
Definition: Map.cpp:4240
bool IsGameMaster() const
Definition: Player.h:1128
bool m_InstanceValid
Definition: Player.h:2420
uint32 GetMapId() const
Definition: Position.h:252
DB2Storage< MapEntry > sMapStore("Map.db2", MapLoadInfo::Instance())
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _initRaidSubGroupsCounter()

void Group::_initRaidSubGroupsCounter ( )
protected
2630 {
2631  // Sub group counters initialization
2632  if (!m_subGroupsCounts)
2634 
2635  memset((void*)m_subGroupsCounts, 0, (MAX_RAID_SUBGROUPS)*sizeof(uint8));
2636 
2637  for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
2638  ++m_subGroupsCounts[itr->group];
2639 }
MemberSlotList::const_iterator member_citerator
Definition: Group.h:233
uint8 * m_subGroupsCounts
Definition: Group.h:450
MemberSlotList m_memberSlots
Definition: Group.h:431
#define MAX_RAID_SUBGROUPS
Definition: Group.h:53
uint8_t uint8
Definition: Define.h:154
+ Here is the caller graph for this function:

◆ _setMembersGroup()

bool Group::_setMembersGroup ( ObjectGuid  guid,
uint8  group 
)
protected
1589 {
1590  member_witerator slot = _getMemberWSlot(guid);
1591  if (slot == m_memberSlots.end())
1592  return false;
1593 
1594  slot->group = group;
1595 
1596  SubGroupCounterIncrease(group);
1597 
1598  if (!isBGGroup() && !isBFGroup())
1599  {
1601 
1602  stmt->setUInt8(0, group);
1603  stmt->setUInt64(1, guid.GetCounter());
1604 
1605  CharacterDatabase.Execute(stmt);
1606  }
1607 
1608  return true;
1609 }
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
MemberSlotList::iterator member_witerator
Definition: Group.h:237
LowType GetCounter() const
Definition: ObjectGuid.h:273
Definition: CharacterDatabase.h:392
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:100
Definition: DatabaseEnvFwd.h:40
MemberSlotList m_memberSlots
Definition: Group.h:431
member_witerator _getMemberWSlot(ObjectGuid Guid)
Definition: Group.cpp:2649
bool isBGGroup() const
Definition: Group.cpp:2432
bool isBFGroup() const
Definition: Group.cpp:2437
void SubGroupCounterIncrease(uint8 subgroup)
Definition: Group.cpp:2657
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
+ Here is the call graph for this function:

◆ AddInvite()

bool Group::AddInvite ( Player player)
312 {
313  if (!player || player->GetGroupInvite())
314  return false;
315  Group* group = player->GetGroup();
316  if (group && (group->isBGGroup() || group->isBFGroup()))
317  group = player->GetOriginalGroup();
318  if (group)
319  return false;
320 
321  RemoveInvite(player);
322 
323  m_invitees.insert(player);
324 
325  player->SetGroupInvite(this);
326 
327  sScriptMgr->OnGroupInviteMember(this, player->GetGUID());
328 
329  return true;
330 }
Group * GetGroup()
Definition: Player.h:2450
void SetGroupInvite(Group *group)
Definition: Player.h:2449
InvitesList m_invitees
Definition: Group.h:433
void RemoveInvite(Player *player)
Definition: Group.cpp:342
ObjectGuid const & GetGUID() const
Definition: Object.h:154
Group * GetOriginalGroup() const
Definition: Player.h:2467
bool isBGGroup() const
Definition: Group.cpp:2432
bool isBFGroup() const
Definition: Group.cpp:2437
Group * GetGroupInvite() const
Definition: Player.h:2448
#define sScriptMgr
Definition: ScriptMgr.h:1221
Definition: Group.h:219
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddLeaderInvite()

bool Group::AddLeaderInvite ( Player player)
333 {
334  if (!AddInvite(player))
335  return false;
336 
337  m_leaderGuid = player->GetGUID();
338  m_leaderName = player->GetName();
339  return true;
340 }
ObjectGuid const & GetGUID() const
Definition: Object.h:154
std::string const & GetName() const
Definition: Object.h:467
ObjectGuid m_leaderGuid
Definition: Group.h:434
bool AddInvite(Player *player)
Definition: Group.cpp:311
std::string m_leaderName
Definition: Group.h:435
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddMember()

bool Group::AddMember ( Player player)
381 {
382  // Get first not-full group
383  uint8 subGroup = 0;
384  if (m_subGroupsCounts)
385  {
386  bool groupFound = false;
387  for (; subGroup < MAX_RAID_SUBGROUPS; ++subGroup)
388  {
389  if (m_subGroupsCounts[subGroup] < MAX_GROUP_SIZE)
390  {
391  groupFound = true;
392  break;
393  }
394  }
395  // We are raid group and no one slot is free
396  if (!groupFound)
397  return false;
398  }
399 
400  MemberSlot member;
401  member.guid = player->GetGUID();
402  member.name = player->GetName();
403  member._class = player->getClass();
404  member.group = subGroup;
405  member.flags = 0;
406  member.roles = 0;
407  member.readyChecked = false;
408  m_memberSlots.push_back(member);
409 
410  SubGroupCounterIncrease(subGroup);
411 
412  player->SetGroupInvite(nullptr);
413  if (player->GetGroup())
414  {
415  if (isBGGroup() || isBFGroup()) // if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid()
416  player->SetBattlegroundOrBattlefieldRaid(this, subGroup);
417  else //if player is in bg raid and we are adding him to normal group, then call SetOriginalGroup()
418  player->SetOriginalGroup(this, subGroup);
419  }
420  else //if player is not in group, then call set group
421  player->SetGroup(this, subGroup);
422 
424  player->ResetGroupUpdateSequenceIfNeeded(this);
425 
426  // if the same group invites the player back, cancel the homebind timer
427  player->m_InstanceValid = player->CheckInstanceValidity(false);
428 
429  if (!isRaidGroup()) // reset targetIcons for non-raid-groups
430  {
431  for (uint8 i = 0; i < TARGET_ICONS_COUNT; ++i)
432  m_targetIcons[i].Clear();
433  }
434 
435  // insert into the table if we're not a battleground group
436  if (!isBGGroup() && !isBFGroup())
437  {
439 
440  stmt->setUInt32(0, m_dbStoreId);
441  stmt->setUInt64(1, member.guid.GetCounter());
442  stmt->setUInt8(2, member.flags);
443  stmt->setUInt8(3, member.group);
444  stmt->setUInt8(4, member.roles);
445 
446  CharacterDatabase.Execute(stmt);
447  }
448 
449  SendUpdate();
450  sScriptMgr->OnGroupAddMember(this, player->GetGUID());
451 
452  if (!IsLeader(player->GetGUID()) && !isBGGroup() && !isBFGroup())
453  {
454  // reset the new member's instances, unless he is currently in one of them
455  // including raid/heroic instances that they are not permanently bound to!
456  player->ResetInstances(INSTANCE_RESET_GROUP_JOIN, false, false);
457  player->ResetInstances(INSTANCE_RESET_GROUP_JOIN, true, false);
458  player->ResetInstances(INSTANCE_RESET_GROUP_JOIN, true, true);
459 
461  {
463  player->SendDungeonDifficulty();
464  }
465  if (player->GetRaidDifficultyID() != GetRaidDifficultyID())
466  {
468  player->SendRaidDifficulty(false);
469  }
471  {
473  player->SendRaidDifficulty(true);
474  }
475  }
476 
478  if (Pet* pet = player->GetPet())
479  pet->SetGroupUpdateFlag(GROUP_UPDATE_PET_FULL);
480 
481  UpdatePlayerOutOfRange(player);
482 
483  // quest related GO state dependent from raid membership
484  if (isRaidGroup())
485  player->UpdateForQuestWorldObjects();
486 
487  {
488  // Broadcast new player group member fields to rest of the group
489  UpdateData groupData(player->GetMapId());
490  WorldPacket groupDataPacket;
491 
492  // Broadcast group members' fields to player
493  for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
494  {
495  if (itr->GetSource() == player)
496  continue;
497 
498  if (Player* existingMember = itr->GetSource())
499  {
500  if (player->HaveAtClient(existingMember))
501  existingMember->BuildValuesUpdateBlockForPlayerWithFlag(&groupData, UF::UpdateFieldFlag::PartyMember, player);
502 
503  if (existingMember->HaveAtClient(player))
504  {
505  UpdateData newData(player->GetMapId());
506  WorldPacket newDataPacket;
508  if (newData.HasData())
509  {
510  newData.BuildPacket(&newDataPacket);
511  existingMember->SendDirectMessage(&newDataPacket);
512  }
513  }
514  }
515  }
516 
517  if (groupData.HasData())
518  {
519  groupData.BuildPacket(&groupDataPacket);
520  player->SendDirectMessage(&groupDataPacket);
521  }
522  }
523 
524  if (m_maxEnchantingLevel < player->GetSkillValue(SKILL_ENCHANTING))
526 
527  return true;
528 }
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define TARGET_ICONS_COUNT
Definition: Group.h:55
Group * GetGroup()
Definition: Player.h:2450
Definition: CharacterDatabase.h:387
uint32 m_dbStoreId
Definition: Group.h:453
Difficulty GetLegacyRaidDifficultyID() const
Definition: Player.h:1904
void SetGroupInvite(Group *group)
Definition: Player.h:2449
Difficulty GetDungeonDifficultyID() const
Definition: Group.h:354
bool HaveAtClient(Object const *u) const
Definition: Player.cpp:23770
void SetRaidDifficultyID(Difficulty raid_difficulty)
Definition: Player.h:1906
Definition: SharedDefines.h:5134
uint8 * m_subGroupsCounts
Definition: Group.h:450
bool IsLeader(ObjectGuid guid) const
Definition: Group.cpp:2489
void UpdatePlayerOutOfRange(Player *player)
Definition: Group.cpp:1544
void SetDungeonDifficultyID(Difficulty dungeon_difficulty)
Definition: Player.h:1905
void SendDungeonDifficulty(int32 forcedDifficulty=-1) const
Definition: Player.cpp:21595
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:100
Difficulty GetRaidDifficultyID() const
Definition: Group.h:355
ObjectGuid m_targetIcons[TARGET_ICONS_COUNT]
Definition: Group.h:443
Definition: DatabaseEnvFwd.h:40
Definition: UpdateData.h:36
void ResetGroupUpdateSequenceIfNeeded(Group const *group)
Definition: Player.cpp:25824
MemberSlotList m_memberSlots
Definition: Group.h:431
ObjectGuid const & GetGUID() const
Definition: Object.h:154
void SetOriginalGroup(Group *group, int8 subgroup=-1)
Definition: Player.cpp:25802
std::string const & GetName() const
Definition: Object.h:467
Definition: Group.h:168
#define MAX_GROUP_SIZE
Definition: Group.h:51
uint32 m_maxEnchantingLevel
Definition: Group.h:452
Difficulty GetDungeonDifficultyID() const
Definition: Player.h:1902
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:6123
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:116
uint8 getClass() const
Definition: Unit.h:849
GroupCategory m_groupCategory
Definition: Group.h:437
Pet * GetPet() const
Definition: Player.cpp:21781
bool m_InstanceValid
Definition: Player.h:2420
bool isRaidGroup() const
Definition: Group.cpp:2427
GroupReference * GetFirstMember()
Definition: Group.h:328
Definition: Group.h:101
void SetGroup(Group *group, int8 subgroup=-1)
Definition: Player.cpp:24102
GroupReference * next()
Definition: GroupReference.h:36
#define MAX_RAID_SUBGROUPS
Definition: Group.h:53
bool isBGGroup() const
Definition: Group.cpp:2432
bool isBFGroup() const
Definition: Group.cpp:2437
void SetLegacyRaidDifficultyID(Difficulty raid_difficulty)
Definition: Player.h:1907
uint32 GetMapId() const
Definition: Position.h:252
void SendRaidDifficulty(bool legacy, int32 forcedDifficulty=-1) const
Definition: Player.cpp:21602
void SetBattlegroundOrBattlefieldRaid(Group *group, int8 subgroup=-1)
Definition: Player.cpp:25780
Definition: Group.h:150
uint8_t uint8
Definition: Define.h:154
Definition: Map.h:856
void SetGroupUpdateFlag(uint32 flag)
Definition: Player.h:2456
void SetPartyType(GroupCategory category, uint8 type)
Definition: Player.cpp:25815
#define sScriptMgr
Definition: ScriptMgr.h:1221
void SubGroupCounterIncrease(uint8 subgroup)
Definition: Group.cpp:2657
void ResetInstances(uint8 method, bool isRaid, bool isLegacy)
Reset all solo instances and optionally send a message on success for each.
Definition: Player.cpp:21617
bool CheckInstanceValidity(bool)
Definition: Player.cpp:20138
Difficulty GetRaidDifficultyID() const
Definition: Player.h:1903
void UpdateForQuestWorldObjects()
Definition: Player.cpp:25044
void BuildValuesUpdateBlockForPlayerWithFlag(UpdateData *data, UF::UpdateFieldFlag flags, Player const *target) const
Definition: Object.cpp:250
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
Definition: Player.h:1056
Definition: WorldPacket.h:24
uint16 GetSkillValue(uint32 skill) const
Definition: Player.cpp:5854
void SendUpdate()
Definition: Group.cpp:1430
Definition: Pet.h:45
Definition: GroupReference.h:26
Difficulty GetLegacyRaidDifficultyID() const
Definition: Group.h:356
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddRaidMarker()

void Group::AddRaidMarker ( uint8  markerId,
uint32  mapId,
float  positionX,
float  positionY,
float  positionZ,
ObjectGuid  transportGuid = ObjectGuid::Empty 
)
2376 {
2377  if (markerId >= RAID_MARKERS_COUNT || m_markers[markerId])
2378  return;
2379 
2380  m_activeMarkers |= (1 << markerId);
2381  m_markers[markerId] = std::make_unique<RaidMarker>(mapId, positionX, positionY, positionZ, transportGuid);
2383 }
uint32 m_activeMarkers
Definition: Group.h:461
std::array< std::unique_ptr< RaidMarker >, RAID_MARKERS_COUNT > m_markers
Definition: Group.h:460
void SendRaidMarkersChanged(WorldSession *session=nullptr, int8 partyIndex=0)
Definition: Group.cpp:2400
#define RAID_MARKERS_COUNT
Definition: Group.h:56
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BindToInstance()

InstanceGroupBind * Group::BindToInstance ( InstanceSave save,
bool  permanent,
bool  load = false 
)
2140 {
2141  if (!save || isBGGroup() || isBFGroup())
2142  return nullptr;
2143 
2144  InstanceGroupBind& bind = m_boundInstances[save->GetDifficultyID()][save->GetMapId()];
2145  if (!load && (!bind.save || permanent != bind.perm || save != bind.save))
2146  {
2148 
2149  stmt->setUInt32(0, m_dbStoreId);
2150  stmt->setUInt32(1, save->GetInstanceId());
2151  stmt->setBool(2, permanent);
2152 
2153  CharacterDatabase.Execute(stmt);
2154  }
2155 
2156  if (bind.save != save)
2157  {
2158  if (bind.save)
2159  bind.save->RemoveGroup(this);
2160  save->AddGroup(this);
2161  }
2162 
2163  bind.save = save;
2164  bind.perm = permanent;
2165  if (!load)
2166  TC_LOG_DEBUG("maps", "Group::BindToInstance: %s, storage id: %u is now bound to map %d, instance %d, difficulty %d",
2167  GetGUID().ToString().c_str(), m_dbStoreId, save->GetMapId(), save->GetInstanceId(), save->GetDifficultyID());
2168 
2169  return &bind;
2170 }
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
InstanceSave * save
Definition: Group.h:198
uint32 m_dbStoreId
Definition: Group.h:453
Definition: Group.h:196
ObjectGuid GetGUID() const
Definition: Group.cpp:2452
Definition: DatabaseEnvFwd.h:40
Definition: CharacterDatabase.h:408
void AddGroup(Group *group)
Definition: InstanceSaveMgr.h:105
string ToString(int i)
Definition: strutil.h:491
void setBool(const uint8 index, const bool value)
Definition: PreparedStatement.cpp:92
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:116
BoundInstancesMap m_boundInstances
Definition: Group.h:449
bool isBGGroup() const
Definition: Group.cpp:2432
bool isBFGroup() const
Definition: Group.cpp:2437
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:177
uint32 GetMapId() const
Definition: InstanceSaveMgr.h:64
uint32 GetInstanceId() const
Definition: InstanceSaveMgr.h:63
Difficulty GetDifficultyID() const
Definition: InstanceSaveMgr.h:123
bool RemoveGroup(Group *group)
Definition: InstanceSaveMgr.h:106
bool perm
Definition: Group.h:199
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BroadcastAddonMessagePacket()

void Group::BroadcastAddonMessagePacket ( WorldPacket const *  packet,
const std::string &  prefix,
bool  ignorePlayersInBGRaid,
int  group = -1,
ObjectGuid  ignore = ObjectGuid::Empty 
)
1563 {
1564  for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
1565  {
1566  Player* player = itr->GetSource();
1567  if (!player || (!ignore.IsEmpty() && player->GetGUID() == ignore) || (ignorePlayersInBGRaid && player->GetGroup() != this))
1568  continue;
1569 
1570  if (player->GetSession()->IsAddonRegistered(prefix) && (group == -1 || itr->getSubGroup() == group))
1571  player->SendDirectMessage(packet);
1572  }
1573 }
Group * GetGroup()
Definition: Player.h:2450
WorldSession * GetSession() const
Definition: Player.h:1990
ObjectGuid const & GetGUID() const
Definition: Object.h:154
bool IsAddonRegistered(const std::string &prefix) const
Definition: WorldSession.cpp:852
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:6123
GroupReference * GetFirstMember()
Definition: Group.h:328
GroupReference * next()
Definition: GroupReference.h:36
bool IsEmpty() const
Definition: ObjectGuid.h:299
Definition: Player.h:1056
Definition: GroupReference.h:26
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BroadcastGroupUpdate()

void Group::BroadcastGroupUpdate ( void  )
2203 {
2204  // FG: HACK: force flags update on group leave - for values update hack
2205  // -- not very efficient but safe
2206  for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
2207  {
2208  if (Player * pp = ObjectAccessor::FindPlayer(citr->guid))
2209  {
2210  pp->ForceUpdateFieldChange(pp->m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::PvpFlags));
2211  pp->ForceUpdateFieldChange(pp->m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::FactionTemplate));
2212  TC_LOG_DEBUG("misc", "-- Forced group value update for '%s'", pp->GetName().c_str());
2213  }
2214  }
2215 }
MemberSlotList::const_iterator member_citerator
Definition: Group.h:233
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:254
MemberSlotList m_memberSlots
Definition: Group.h:431
UpdateField< uint8, 64, 82 > PvpFlags
Definition: UpdateFields.h:340
UF::UpdateField< UF::UnitData, 0, TYPEID_UNIT > m_unitData
Definition: Unit.h:1826
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:177
UpdateField< int32, 32, 42 > FactionTemplate
Definition: UpdateFields.h:298
Definition: Player.h:1056
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BroadcastPacket()

void Group::BroadcastPacket ( WorldPacket const *  packet,
bool  ignorePlayersInBGRaid,
int  group = -1,
ObjectGuid  ignoredPlayer = ObjectGuid::Empty 
)
1576 {
1577  for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
1578  {
1579  Player* player = itr->GetSource();
1580  if (!player || (!ignoredPlayer.IsEmpty() && player->GetGUID() == ignoredPlayer) || (ignorePlayersInBGRaid && player->GetGroup() != this))
1581  continue;
1582 
1583  if (group == -1 || itr->getSubGroup() == group)
1584  player->SendDirectMessage(packet);
1585  }
1586 }
Group * GetGroup()
Definition: Player.h:2450
ObjectGuid const & GetGUID() const
Definition: Object.h:154
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:6123
GroupReference * GetFirstMember()
Definition: Group.h:328
GroupReference * next()
Definition: GroupReference.h:36
bool IsEmpty() const
Definition: ObjectGuid.h:299
Definition: Player.h:1056
Definition: GroupReference.h:26
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BroadcastWorker() [1/2]

template<class Worker >
void Group::BroadcastWorker ( Worker &  worker)
inline
369  {
370  for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
371  worker(itr->GetSource());
372  }
GroupReference * GetFirstMember()
Definition: Group.h:328
GroupReference * next()
Definition: GroupReference.h:36
Definition: GroupReference.h:26
+ Here is the call graph for this function:

◆ BroadcastWorker() [2/2]

template<class Worker >
void Group::BroadcastWorker ( Worker const &  worker) const
inline
376  {
377  for (GroupReference const* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
378  worker(itr->GetSource());
379  }
GroupReference * GetFirstMember()
Definition: Group.h:328
GroupReference * next()
Definition: GroupReference.h:36
Definition: GroupReference.h:26
+ Here is the call graph for this function:

◆ CanJoinBattlegroundQueue()

GroupJoinBattlegroundResult Group::CanJoinBattlegroundQueue ( Battleground const *  bgOrTemplate,
BattlegroundQueueTypeId  bgQueueTypeId,
uint32  MinPlayerCount,
uint32  MaxPlayerCount,
bool  isRated,
uint32  arenaSlot,
ObjectGuid errorGuid 
)
1794 {
1795  // check if this group is LFG group
1796  if (isLFGGroup())
1798 
1799  BattlemasterListEntry const* bgEntry = sBattlemasterListStore.LookupEntry(bgOrTemplate->GetTypeID());
1800  if (!bgEntry)
1801  return ERR_BATTLEGROUND_JOIN_FAILED; // shouldn't happen
1802 
1803  // check for min / max count
1804  uint32 memberscount = GetMembersCount();
1805 
1806  if (int32(memberscount) > bgEntry->MaxGroupSize) // no MinPlayerCount for battlegrounds
1807  return ERR_BATTLEGROUND_NONE; // ERR_GROUP_JOIN_BATTLEGROUND_TOO_MANY handled on client side
1808 
1809  // get a player as reference, to compare other players' stats to (arena team id, queue id based on level, etc.)
1810  Player* reference = ASSERT_NOTNULL(GetFirstMember())->GetSource();
1811  // no reference found, can't join this way
1812  if (!reference)
1814 
1815  PVPDifficultyEntry const* bracketEntry = DB2Manager::GetBattlegroundBracketByLevel(bgOrTemplate->GetMapId(), reference->getLevel());
1816  if (!bracketEntry)
1818 
1819  uint32 arenaTeamId = reference->GetArenaTeamId(arenaSlot);
1820  uint32 team = reference->GetTeam();
1821 
1822  // check every member of the group to be able to join
1823  memberscount = 0;
1824  for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next(), ++memberscount)
1825  {
1826  Player* member = itr->GetSource();
1827  // offline member? don't let join
1828  if (!member)
1830  // don't allow cross-faction join as group
1831  if (member->GetTeam() != team)
1832  {
1833  errorGuid = member->GetGUID();
1835  }
1836  // not in the same battleground level braket, don't let join
1837  PVPDifficultyEntry const* memberBracketEntry = DB2Manager::GetBattlegroundBracketByLevel(bracketEntry->MapID, member->getLevel());
1838  if (memberBracketEntry != bracketEntry)
1840  // don't let join rated matches if the arena team id doesn't match
1841  if (isRated && member->GetArenaTeamId(arenaSlot) != arenaTeamId)
1843  // don't let join if someone from the group is already in that bg queue
1844  if (member->InBattlegroundQueueForBattlegroundQueueType(bgQueueTypeId))
1845  return ERR_BATTLEGROUND_JOIN_FAILED; // not blizz-like
1846  // don't let join if someone from the group is in bg queue random
1849  if (isInRandomBgQueue)
1850  return ERR_IN_RANDOM_BG;
1851  // don't let join to bg queue random if someone from the group is already in bg queue
1852  if ((bgOrTemplate->GetTypeID() == BATTLEGROUND_RB || bgOrTemplate->GetTypeID() == BATTLEGROUND_RANDOM_EPIC) && member->InBattlegroundQueue() && !isInRandomBgQueue)
1853  return ERR_IN_NON_RANDOM_BG;
1854  // check for deserter debuff in case not arena queue
1855  if (bgOrTemplate->GetTypeID() != BATTLEGROUND_AA && !member->CanJoinToBattleground(bgOrTemplate))
1857  // check if member can join any more battleground queues
1858  if (!member->HasFreeBattlegroundQueueId())
1859  return ERR_BATTLEGROUND_TOO_MANY_QUEUES; // not blizz-like
1860  // check if someone in party is using dungeon system
1861  if (member->isUsingLfg())
1863  // check Freeze debuff
1864  if (member->HasAura(9454))
1866  }
1867 
1868  // only check for MinPlayerCount since MinPlayerCount == MaxPlayerCount for arenas...
1869  if (bgOrTemplate->isArena() && memberscount != MinPlayerCount)
1871 
1872  return ERR_BATTLEGROUND_NONE;
1873 }
bool isLFGGroup() const
Definition: Group.cpp:2422
Definition: SharedDefines.h:6207
uint8 getLevel() const
Definition: Unit.h:843
static PVPDifficultyEntry const * GetBattlegroundBracketByLevel(uint32 mapid, uint32 level)
Definition: DB2Stores.cpp:2706
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4418
uint32 GetArenaTeamId(uint8) const
Definition: Player.h:1895
#define ASSERT_NOTNULL(pointer)
Definition: Errors.h:69
bool HasFreeBattlegroundQueueId() const
Definition: Player.cpp:24894
bool isUsingLfg() const
Definition: Player.cpp:25764
Definition: SharedDefines.h:5926
bool InBattlegroundQueueForBattlegroundQueueType(BattlegroundQueueTypeId bgQueueTypeId) const
Definition: Player.cpp:24868
ObjectGuid const & GetGUID() const
Definition: Object.h:154
DB2Storage< BattlemasterListEntry > sBattlemasterListStore("BattlemasterList.db2", BattlemasterListLoadInfo::Instance())
bool CanJoinToBattleground(Battleground const *bg) const
Definition: Player.cpp:23667
int8 MaxGroupSize
Definition: DB2Structure.h:506
bool InBattlegroundQueue() const
Definition: Player.cpp:24836
int32_t int32
Definition: Define.h:148
Definition: SharedDefines.h:5980
uint32_t uint32
Definition: Define.h:152
GroupReference * GetFirstMember()
Definition: Group.h:328
GroupReference * next()
Definition: GroupReference.h:36
static BattlegroundQueueTypeId BGQueueTypeId(uint16 battlemasterListId, BattlegroundQueueIdType type, bool rated, uint8 teamSize)
Definition: BattlegroundMgr.cpp:606
uint32 GetMembersCount() const
Definition: Group.h:330
uint32 GetTeam() const
Definition: Player.h:2105
uint32 MapID
Definition: DB2Structure.h:2701
Definition: DB2Structure.h:2695
Definition: SharedDefines.h:5919
Definition: Player.h:1056
Definition: DB2Structure.h:492
Definition: GroupReference.h:26
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ChangeLeader()

void Group::ChangeLeader ( ObjectGuid  guid,
int8  partyIndex = 0 
)
677 {
678  member_witerator slot = _getMemberWSlot(newLeaderGuid);
679 
680  if (slot == m_memberSlots.end())
681  return;
682 
683  Player* newLeader = ObjectAccessor::FindConnectedPlayer(slot->guid);
684 
685  // Don't allow switching leader to offline players
686  if (!newLeader)
687  return;
688 
689  sScriptMgr->OnGroupChangeLeader(this, newLeaderGuid, m_leaderGuid);
690 
691  if (!isBGGroup() && !isBFGroup())
692  {
693  CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
694 
695  // Remove the groups permanent instance bindings
696  for (auto difficultyItr = m_boundInstances.begin(); difficultyItr != m_boundInstances.end(); ++difficultyItr)
697  {
698  for (auto itr = difficultyItr->second.begin(); itr != difficultyItr->second.end();)
699  {
700  // Do not unbind saves of instances that already had map created (a newLeader entered)
701  // forcing a new instance with another leader requires group disbanding (confirmed on retail)
702  if (itr->second.perm && !sMapMgr->FindMap(itr->first, itr->second.save->GetInstanceId()))
703  {
705  stmt->setUInt32(0, m_dbStoreId);
706  stmt->setUInt32(1, itr->second.save->GetInstanceId());
707  trans->Append(stmt);
708 
709  itr->second.save->RemoveGroup(this);
710  difficultyItr->second.erase(itr++);
711  }
712  else
713  ++itr;
714  }
715  }
716 
717  // Copy the permanent binds from the new leader to the group
718  Group::ConvertLeaderInstancesToGroup(newLeader, this, true);
719 
720  // Update the group leader
722 
723  stmt->setUInt64(0, newLeader->GetGUID().GetCounter());
724  stmt->setUInt32(1, m_dbStoreId);
725 
726  trans->Append(stmt);
727 
728  CharacterDatabase.CommitTransaction(trans);
729  }
730 
732  oldLeader->RemovePlayerFlag(PLAYER_FLAGS_GROUP_LEADER);
733 
735  m_leaderGuid = newLeader->GetGUID();
736  m_leaderName = newLeader->GetName();
738 
740  groupNewLeader.Name = m_leaderName;
741  groupNewLeader.PartyIndex = partyIndex;
742  BroadcastPacket(groupNewLeader.Write(), true);
743 }
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
void AddPlayerFlag(PlayerFlags flags)
Definition: Player.h:2574
int8 PartyIndex
Definition: PartyPackets.h:499
Definition: Group.h:87
uint32 m_dbStoreId
Definition: Group.h:453
MemberSlotList::iterator member_witerator
Definition: Group.h:237
LowType GetCounter() const
Definition: ObjectGuid.h:273
Definition: DatabaseEnvFwd.h:40
void ToggleGroupMemberFlag(member_witerator slot, uint8 flag, bool apply)
Definition: Group.cpp:2676
WorldPacket const * Write() override
Definition: PartyPackets.cpp:413
Definition: PartyPackets.h:492
Definition: CharacterDatabase.h:390
MemberSlotList m_memberSlots
Definition: Group.h:431
ObjectGuid const & GetGUID() const
Definition: Object.h:154
std::string const & GetName() const
Definition: Object.h:467
std::string Name
Definition: PartyPackets.h:500
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:116
BoundInstancesMap m_boundInstances
Definition: Group.h:449
member_witerator _getMemberWSlot(ObjectGuid Guid)
Definition: Group.cpp:2649
ObjectGuid m_leaderGuid
Definition: Group.h:434
Definition: Player.h:422
bool isBGGroup() const
Definition: Group.cpp:2432
bool isBFGroup() const
Definition: Group.cpp:2437
Definition: CharacterDatabase.h:389
#define sMapMgr
Definition: MapManager.h:212
static void ConvertLeaderInstancesToGroup(Player *player, Group *group, bool switchLeader)
convert the player&#39;s binds to the group
Definition: Group.cpp:746
void BroadcastPacket(WorldPacket const *packet, bool ignorePlayersInBGRaid, int group=-1, ObjectGuid ignoredPlayer=ObjectGuid::Empty)
Definition: Group.cpp:1575
#define sScriptMgr
Definition: ScriptMgr.h:1221
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
std::string m_leaderName
Definition: Group.h:435
Definition: Player.h:1056
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:275
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
Definition: DatabaseEnvFwd.h:72
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ChangeMembersGroup()

void Group::ChangeMembersGroup ( ObjectGuid  guid,
uint8  group 
)
1624 {
1625  // Only raid groups have sub groups
1626  if (!isRaidGroup())
1627  return;
1628 
1629  // Check if player is really in the raid
1630  member_witerator slot = _getMemberWSlot(guid);
1631  if (slot == m_memberSlots.end())
1632  return;
1633 
1634  uint8 prevSubGroup = slot->group;
1635  // Abort if the player is already in the target sub group
1636  if (prevSubGroup == group)
1637  return;
1638 
1639  // Update the player slot with the new sub group setting
1640  slot->group = group;
1641 
1642  // Increase the counter of the new sub group..
1643  SubGroupCounterIncrease(group);
1644 
1645  // ..and decrease the counter of the previous one
1646  SubGroupCounterDecrease(prevSubGroup);
1647 
1648  // Preserve new sub group in database for non-raid groups
1649  if (!isBGGroup() && !isBFGroup())
1650  {
1652 
1653  stmt->setUInt8(0, group);
1654  stmt->setUInt64(1, guid.GetCounter());
1655 
1656  CharacterDatabase.Execute(stmt);
1657  }
1658 
1659  // In case the moved player is online, update the player object with the new sub group references
1660  if (Player* player = ObjectAccessor::FindConnectedPlayer(guid))
1661  {
1662  if (player->GetGroup() == this)
1663  player->GetGroupRef().setSubGroup(group);
1664  else
1665  {
1666  // If player is in BG raid, it is possible that he is also in normal raid - and that normal raid is stored in m_originalGroup reference
1667  player->GetOriginalGroupRef().setSubGroup(group);
1668  }
1669  }
1670 
1671  // Broadcast the changes to the group
1672  SendUpdate();
1673 }
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
MemberSlotList::iterator member_witerator
Definition: Group.h:237
LowType GetCounter() const
Definition: ObjectGuid.h:273
Definition: CharacterDatabase.h:392
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:100
Definition: DatabaseEnvFwd.h:40
MemberSlotList m_memberSlots
Definition: Group.h:431
member_witerator _getMemberWSlot(ObjectGuid Guid)
Definition: Group.cpp:2649
bool isRaidGroup() const
Definition: Group.cpp:2427
void SubGroupCounterDecrease(uint8 subgroup)
Definition: Group.cpp:2663
bool isBGGroup() const
Definition: Group.cpp:2432
bool isBFGroup() const
Definition: Group.cpp:2437
uint8_t uint8
Definition: Define.h:154
void SubGroupCounterIncrease(uint8 subgroup)
Definition: Group.cpp:2657
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
Definition: Player.h:1056
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:275
void SendUpdate()
Definition: Group.cpp:1430
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ConvertLeaderInstancesToGroup()

void Group::ConvertLeaderInstancesToGroup ( Player player,
Group group,
bool  switchLeader 
)
static

convert the player's binds to the group

747 {
748  // copy all binds to the group, when changing leader it's assumed the character
749  // will not have any solo binds
750  for (auto difficultyItr = player->m_boundInstances.begin(); difficultyItr != player->m_boundInstances.end(); ++difficultyItr)
751  {
752  for (auto itr = difficultyItr->second.begin(); itr != difficultyItr->second.end();)
753  {
754  if (!switchLeader || !group->GetBoundInstance(itr->second.save->GetDifficultyID(), itr->first))
755  if (itr->second.extendState) // not expired
756  group->BindToInstance(itr->second.save, itr->second.perm, false);
757 
758  // permanent binds are not removed
759  if (switchLeader && !itr->second.perm)
760  {
761  // increments itr in call
762  player->UnbindInstance(itr, difficultyItr, false);
763  }
764  else
765  ++itr;
766  }
767  }
768 
769  /* if group leader is in a non-raid dungeon map and nobody is actually bound to this map then the group can "take over" the instance *
770  * (example: two-player group disbanded by disconnect where the player reconnects within 60 seconds and the group is reformed) */
771  if (Map* playerMap = player->GetMap())
772  if (!switchLeader && playerMap->IsNonRaidDungeon())
773  if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(playerMap->GetInstanceId()))
774  if (save->GetGroupCount() == 0 && save->GetPlayerCount() == 0)
775  {
776  TC_LOG_DEBUG("maps", "Group::ConvertLeaderInstancesToGroup: Group for player %s is taking over unbound instance map %d with Id %d", player->GetName().c_str(), playerMap->GetId(), playerMap->GetInstanceId());
777  // if nobody is saved to this, then the save wasn't permanent
778  group->BindToInstance(save, false, false);
779  }
780 }
BoundInstancesMap m_boundInstances
Definition: Player.h:2422
void UnbindInstance(uint32 mapid, Difficulty difficulty, bool unload=false)
Definition: Player.cpp:19875
InstanceGroupBind * BindToInstance(InstanceSave *save, bool permanent, bool load=false)
Definition: Group.cpp:2139
Map * GetMap() const
Definition: Object.h:535
std::string const & GetName() const
Definition: Object.h:467
Definition: Map.h:248
Definition: InstanceSaveMgr.h:43
#define sInstanceSaveMgr
Definition: InstanceSaveMgr.h:241
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:177
InstanceGroupBind * GetBoundInstance(Player *player)
Definition: Group.cpp:2102
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ConvertToGroup()

void Group::ConvertToGroup ( )
281 {
282  if (m_memberSlots.size() > 5)
283  return; // What message error should we send?
284 
286 
287  if (m_subGroupsCounts)
288  {
289  delete[] m_subGroupsCounts;
290  m_subGroupsCounts = nullptr;
291  }
292 
293  if (!isBGGroup() && !isBFGroup())
294  {
296 
297  stmt->setUInt8(0, uint8(m_groupFlags));
298  stmt->setUInt32(1, m_dbStoreId);
299 
300  CharacterDatabase.Execute(stmt);
301  }
302 
303  SendUpdate();
304 
305  // update quest related GO states (quest activity dependent from raid membership)
306  for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
307  if (Player* player = ObjectAccessor::FindPlayer(citr->guid))
308  player->UpdateForQuestWorldObjects();
309 }
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
uint32 m_dbStoreId
Definition: Group.h:453
MemberSlotList::const_iterator member_citerator
Definition: Group.h:233
uint8 * m_subGroupsCounts
Definition: Group.h:450
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:100
Definition: Group.h:107
Definition: DatabaseEnvFwd.h:40
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:254
MemberSlotList m_memberSlots
Definition: Group.h:431
GroupFlags m_groupFlags
Definition: Group.h:436
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:116
GroupFlags
Definition: Group.h:105
bool isBGGroup() const
Definition: Group.cpp:2432
bool isBFGroup() const
Definition: Group.cpp:2437
Definition: CharacterDatabase.h:391
uint8_t uint8
Definition: Define.h:154
Definition: Player.h:1056
void SendUpdate()
Definition: Group.cpp:1430
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ConvertToLFG()

void Group::ConvertToLFG ( )
239 {
243  if (!isBGGroup() && !isBFGroup())
244  {
246 
247  stmt->setUInt8(0, uint8(m_groupFlags));
248  stmt->setUInt32(1, m_dbStoreId);
249 
250  CharacterDatabase.Execute(stmt);
251  }
252 
253  SendUpdate();
254 }
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: Loot.h:74
uint32 m_dbStoreId
Definition: Group.h:453
Definition: Group.h:110
LootMethod m_lootMethod
Definition: Group.h:444
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:100
Definition: DatabaseEnvFwd.h:40
Definition: Group.h:111
GroupFlags m_groupFlags
Definition: Group.h:436
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:116
GroupCategory m_groupCategory
Definition: Group.h:437
GroupFlags
Definition: Group.h:105
Definition: Group.h:123
bool isBGGroup() const
Definition: Group.cpp:2432
bool isBFGroup() const
Definition: Group.cpp:2437
Definition: CharacterDatabase.h:391
uint8_t uint8
Definition: Define.h:154
void SendUpdate()
Definition: Group.cpp:1430
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ConvertToRaid()

void Group::ConvertToRaid ( )
257 {
259 
261 
262  if (!isBGGroup() && !isBFGroup())
263  {
265 
266  stmt->setUInt8(0, uint8(m_groupFlags));
267  stmt->setUInt32(1, m_dbStoreId);
268 
269  CharacterDatabase.Execute(stmt);
270  }
271 
272  SendUpdate();
273 
274  // update quest related GO states (quest activity dependent from raid membership)
275  for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
276  if (Player* player = ObjectAccessor::FindPlayer(citr->guid))
277  player->UpdateForQuestWorldObjects();
278 }
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
uint32 m_dbStoreId
Definition: Group.h:453
void _initRaidSubGroupsCounter()
Definition: Group.cpp:2629
MemberSlotList::const_iterator member_citerator
Definition: Group.h:233
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:100
Definition: DatabaseEnvFwd.h:40
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:254
MemberSlotList m_memberSlots
Definition: Group.h:431
GroupFlags m_groupFlags
Definition: Group.h:436
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:116
GroupFlags
Definition: Group.h:105
bool isBGGroup() const
Definition: Group.cpp:2432
bool isBFGroup() const
Definition: Group.cpp:2437
Definition: CharacterDatabase.h:391
uint8_t uint8
Definition: Define.h:154
Definition: Player.h:1056
void SendUpdate()
Definition: Group.cpp:1430
Definition: Group.h:109
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CountRollVote()

void Group::CountRollVote ( ObjectGuid  playerGuid,
ObjectGuid  lootObjectGuid,
uint8  lootListId,
uint8  choice 
)
1156 {
1157  Rolls::iterator rollI = GetRoll(lootObjectGuid, lootListId);
1158  if (rollI == RollId.end())
1159  return;
1160  Roll* roll = *rollI;
1161 
1162  Roll::PlayerVote::iterator itr = roll->playerVote.find(playerGuid);
1163  // this condition means that player joins to the party after roll begins
1164  if (itr == roll->playerVote.end())
1165  return;
1166 
1167  if (roll->getLoot())
1168  if (roll->getLoot()->items.empty())
1169  return;
1170 
1171  switch (choice)
1172  {
1173  case ROLL_PASS: // Player choose pass
1174  SendLootRoll(playerGuid, -1, ROLL_PASS, *roll);
1175  ++roll->totalPass;
1176  itr->second = PASS;
1177  break;
1178  case ROLL_NEED: // player choose Need
1179  SendLootRoll(playerGuid, 0, ROLL_NEED, *roll);
1180  ++roll->totalNeed;
1181  itr->second = NEED;
1182  break;
1183  case ROLL_GREED: // player choose Greed
1184  SendLootRoll(playerGuid, -7, ROLL_GREED, *roll);
1185  ++roll->totalGreed;
1186  itr->second = GREED;
1187  break;
1188  case ROLL_DISENCHANT: // player choose Disenchant
1189  SendLootRoll(playerGuid, -8, ROLL_DISENCHANT, *roll);
1190  ++roll->totalGreed;
1191  itr->second = DISENCHANT;
1192  break;
1193  }
1194 
1195  if (roll->totalPass + roll->totalNeed + roll->totalGreed >= roll->totalPlayersRolling)
1196  CountTheRoll(rollI, nullptr);
1197 }
Definition: Loot.h:50
Rolls RollId
Definition: Group.h:448
uint8 totalPlayersRolling
Definition: Group.h:188
Loot * getLoot()
Definition: Group.cpp:57
PlayerVote playerVote
Definition: Group.h:187
Definition: Group.h:62
Definition: Group.h:172
uint8 totalNeed
Definition: Group.h:189
void CountTheRoll(Rolls::iterator roll, Map *allowedMap)
Definition: Group.cpp:1214
Definition: Loot.h:47
Definition: Group.h:63
Definition: Group.h:65
void SendLootRoll(ObjectGuid playerGuid, int32 rollNumber, uint8 rollType, Roll const &roll) const
Definition: Group.cpp:875
Definition: Group.h:64
Definition: Loot.h:48
std::vector< LootItem > items
Definition: Loot.h:213
Definition: Loot.h:49
Rolls::iterator GetRoll(ObjectGuid lootObjectGuid, uint8 lootListId)
Definition: Group.cpp:2590
uint8 totalPass
Definition: Group.h:191
uint8 totalGreed
Definition: Group.h:190
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CountTheRoll()

void Group::CountTheRoll ( Rolls::iterator  roll,
Map allowedMap 
)
1215 {
1216  Roll* roll = *rollI;
1217  if (!roll->isValid()) // is loot already deleted ?
1218  {
1219  RollId.erase(rollI);
1220  delete roll;
1221  return;
1222  }
1223 
1224  //end of the roll
1225  if (roll->totalNeed > 0)
1226  {
1227  if (!roll->playerVote.empty())
1228  {
1229  uint8 maxresul = 0;
1230  ObjectGuid maxguid = ObjectGuid::Empty;
1231  Player* player = nullptr;
1232 
1233  for (Roll::PlayerVote::const_iterator itr = roll->playerVote.begin(); itr != roll->playerVote.end(); ++itr)
1234  {
1235  if (itr->second != NEED)
1236  continue;
1237 
1238  player = ObjectAccessor::FindPlayer(itr->first);
1239  if (!player || (allowedMap != nullptr && player->FindMap() != allowedMap))
1240  {
1241  --roll->totalNeed;
1242  continue;
1243  }
1244 
1245  uint8 randomN = urand(1, 100);
1246  SendLootRoll(itr->first, randomN, ROLL_NEED, *roll);
1247  if (maxresul < randomN)
1248  {
1249  maxguid = itr->first;
1250  maxresul = randomN;
1251  }
1252  }
1253 
1254  if (!maxguid.IsEmpty())
1255  {
1256  SendLootRollWon(maxguid, maxresul, ROLL_NEED, *roll);
1257  player = ObjectAccessor::FindConnectedPlayer(maxguid);
1258 
1259  if (player && player->GetSession())
1260  {
1261  player->UpdateCriteria(CriteriaType::RollNeed, roll->itemid, maxresul);
1262 
1263  ItemPosCountVec dest;
1264  LootItem* item = &(roll->itemSlot >= roll->getLoot()->items.size() ? roll->getLoot()->quest_items[roll->itemSlot - roll->getLoot()->items.size()] : roll->getLoot()->items[roll->itemSlot]);
1265  InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, roll->itemid, item->count);
1266  if (msg == EQUIP_ERR_OK)
1267  {
1268  item->is_looted = true;
1269  roll->getLoot()->NotifyItemRemoved(roll->itemSlot);
1270  roll->getLoot()->unlootedCount--;
1271  player->StoreNewItem(dest, roll->itemid, true, item->randomBonusListId, item->GetAllowedLooters(), item->context, item->BonusListIDs);
1272  }
1273  else
1274  {
1275  item->is_blocked = false;
1276  item->rollWinnerGUID = player->GetGUID();
1277  player->SendEquipError(msg, nullptr, nullptr, roll->itemid);
1278  }
1279  }
1280  }
1281  else
1282  roll->totalNeed = 0;
1283  }
1284  }
1285 
1286  if (roll->totalNeed == 0 && roll->totalGreed > 0) // if (roll->totalNeed == 0 && ...), not else if, because numbers can be modified above if player is on a different map
1287  {
1288  if (!roll->playerVote.empty())
1289  {
1290  uint8 maxresul = 0;
1291  ObjectGuid maxguid = ObjectGuid::Empty;
1292  Player* player = nullptr;
1293  RollVote rollvote = NOT_VALID;
1294 
1295  Roll::PlayerVote::iterator itr;
1296  for (itr = roll->playerVote.begin(); itr != roll->playerVote.end(); ++itr)
1297  {
1298  if (itr->second != GREED && itr->second != DISENCHANT)
1299  continue;
1300 
1301  player = ObjectAccessor::FindPlayer(itr->first);
1302  if (!player || (allowedMap != nullptr && player->FindMap() != allowedMap))
1303  {
1304  --roll->totalGreed;
1305  continue;
1306  }
1307 
1308  uint8 randomN = urand(1, 100);
1309  SendLootRoll(itr->first, randomN, itr->second, *roll);
1310  if (maxresul < randomN)
1311  {
1312  maxguid = itr->first;
1313  maxresul = randomN;
1314  rollvote = itr->second;
1315  }
1316  }
1317 
1318  if (!maxguid.IsEmpty())
1319  {
1320  SendLootRollWon(maxguid, maxresul, rollvote, *roll);
1321  player = ObjectAccessor::FindConnectedPlayer(maxguid);
1322 
1323  if (player && player->GetSession())
1324  {
1325  player->UpdateCriteria(CriteriaType::RollGreed, roll->itemid, maxresul);
1326 
1327  LootItem* item = &(roll->itemSlot >= roll->getLoot()->items.size() ? roll->getLoot()->quest_items[roll->itemSlot - roll->getLoot()->items.size()] : roll->getLoot()->items[roll->itemSlot]);
1328 
1329  if (rollvote == GREED)
1330  {
1331  ItemPosCountVec dest;
1332  InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, roll->itemid, item->count);
1333  if (msg == EQUIP_ERR_OK)
1334  {
1335  item->is_looted = true;
1336  roll->getLoot()->NotifyItemRemoved(roll->itemSlot);
1337  roll->getLoot()->unlootedCount--;
1338  player->StoreNewItem(dest, roll->itemid, true, item->randomBonusListId, item->GetAllowedLooters(), item->context, item->BonusListIDs);
1339  }
1340  else
1341  {
1342  item->is_blocked = false;
1343  item->rollWinnerGUID = player->GetGUID();
1344  player->SendEquipError(msg, nullptr, nullptr, roll->itemid);
1345  }
1346  }
1347  else if (rollvote == DISENCHANT)
1348  {
1349  item->is_looted = true;
1350  roll->getLoot()->NotifyItemRemoved(roll->itemSlot);
1351  roll->getLoot()->unlootedCount--;
1352  player->UpdateCriteria(CriteriaType::CastSpell, 13262); // Disenchant
1353 
1354  ItemDisenchantLootEntry const* disenchant = ASSERT_NOTNULL(roll->GetItemDisenchantLoot(player));
1355 
1356  ItemPosCountVec dest;
1357  InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, roll->itemid, item->count);
1358  if (msg == EQUIP_ERR_OK)
1359  player->AutoStoreLoot(disenchant->ID, LootTemplates_Disenchant, ItemContext::NONE, true);
1360  else // If the player's inventory is full, send the disenchant result in a mail.
1361  {
1362  Loot loot;
1363  loot.FillLoot(disenchant->ID, LootTemplates_Disenchant, player, true);
1364 
1365  uint32 max_slot = loot.GetMaxSlotInLootFor(player);
1366  for (uint32 i = 0; i < max_slot; ++i)
1367  {
1368  LootItem* lootItem = loot.LootItemInSlot(i, player);
1369  player->SendEquipError(msg, nullptr, nullptr, lootItem->itemid);
1370  player->SendItemRetrievalMail(lootItem->itemid, lootItem->count, lootItem->context);
1371  }
1372  }
1373  }
1374  }
1375  }
1376  else
1377  roll->totalGreed = 0;
1378  }
1379  }
1380 
1381  if (roll->totalNeed == 0 && roll->totalGreed == 0) // if, not else, because numbers can be modified above if player is on a different map
1382  {
1383  SendLootAllPassed(*roll);
1384 
1385  // remove is_blocked so that the item is lootable by all players
1386  LootItem* item = &(roll->itemSlot >= roll->getLoot()->items.size() ? roll->getLoot()->quest_items[roll->itemSlot - roll->getLoot()->items.size()] : roll->getLoot()->items[roll->itemSlot]);
1387  item->is_blocked = false;
1388  }
1389 
1390  SendLootRollsComplete(*roll);
1391 
1392  RollId.erase(rollI);
1393  delete roll;
1394 }
ItemRandomBonusListId randomBonusListId
Definition: Loot.h:137
ObjectGuid rollWinnerGUID
Definition: Loot.h:142
static ObjectGuid const Empty
Definition: ObjectGuid.h:255
Definition: DB2Structure.h:1974
Definition: Unit.h:65
Rolls RollId
Definition: Group.h:448
Loot * getLoot()
Definition: Group.cpp:57
LootStore LootTemplates_Disenchant("disenchant_loot_template", "item disenchant id", true)
ItemDisenchantLootEntry const * GetItemDisenchantLoot(Player const *player) const
Definition: Group.cpp:1897
PlayerVote playerVote
Definition: Group.h:187
WorldSession * GetSession() const
Definition: Player.h:1990
Item * StoreNewItem(ItemPosCountVec const &pos, uint32 itemId, bool update, ItemRandomBonusListId randomBonusListId=0, GuidSet const &allowedLooters=GuidSet(), ItemContext context=ItemContext::NONE, std::vector< int32 > const &bonusListIDs=std::vector< int32 >(), bool addToCollection=true)
Definition: Player.cpp:12035
void SendLootRollsComplete(Roll const &roll) const
Definition: Group.cpp:936
void SendLootAllPassed(Roll const &roll) const
Definition: Group.cpp:918
bool is_blocked
Definition: Loot.h:145
uint32 itemid
Definition: Group.h:183
uint32 GetMaxSlotInLootFor(Player *player) const
Definition: Loot.cpp:367
#define ASSERT_NOTNULL(pointer)
Definition: Errors.h:69
bool is_looted
Definition: Loot.h:144
void UpdateCriteria(CriteriaType type, uint64 miscValue1=0, uint64 miscValue2=0, uint64 miscValue3=0, WorldObject *ref=nullptr)
Definition: Player.cpp:26592
Definition: Group.h:172
void NotifyItemRemoved(uint8 lootIndex)
Definition: Loot.cpp:131
uint8 totalNeed
Definition: Group.h:189
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:254
ObjectGuid const & GetGUID() const
Definition: Object.h:154
LootItem * LootItemInSlot(uint32 lootslot, Player *player, NotNormalLootItem **qitem=nullptr, NotNormalLootItem **ffaitem=nullptr, NotNormalLootItem **conditem=nullptr)
Definition: Loot.cpp:304
Definition: Unit.h:64
Definition: Group.h:63
uint8 unlootedCount
Definition: Loot.h:216
Definition: Group.h:65
void SendItemRetrievalMail(uint32 itemEntry, uint32 count, ItemContext context)
Definition: Player.cpp:27876
Definition: Loot.h:207
InventoryResult
Definition: ItemDefines.h:23
void SendLootRoll(ObjectGuid playerGuid, int32 rollNumber, uint8 rollType, Roll const &roll) const
Definition: Group.cpp:875
uint32_t uint32
Definition: Define.h:152
bool isValid() const
Definition: Reference.h:78
void SendLootRollWon(ObjectGuid winnerGuid, int32 rollNumber, uint8 rollType, Roll const &roll) const
Definition: Group.cpp:896
Definition: Group.h:64
Map * FindMap() const
Definition: Object.h:536
Definition: Loot.h:134
std::vector< ItemPosCount > ItemPosCountVec
Definition: Player.h:694
Definition: ItemDefines.h:25
Definition: Loot.h:48
bool IsEmpty() const
Definition: ObjectGuid.h:299
std::vector< LootItem > items
Definition: Loot.h:213
GuidSet const & GetAllowedLooters() const
Definition: Loot.h:163
void SendEquipError(InventoryResult msg, Item const *item1=nullptr, Item const *item2=nullptr, uint32 itemId=0) const
Definition: Player.cpp:13728
InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 item, uint32 count, uint32 *no_space_count=nullptr) const
Definition: Player.cpp:10501
void AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore const &store, ItemContext context=ItemContext::NONE, bool broadcast=false)
Definition: Player.cpp:26197
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:46
uint8_t uint8
Definition: Define.h:154
Definition: Group.h:67
ItemContext context
Definition: Loot.h:139
uint8 count
Definition: Loot.h:143
Definition: ObjectGuid.h:248
std::vector< int32 > BonusListIDs
Definition: Loot.h:138
uint32 ID
Definition: DB2Structure.h:1976
uint8 itemSlot
Definition: Group.h:192
uint32 itemid
Definition: Loot.h:136
Definition: Player.h:1056
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:275
std::vector< LootItem > quest_items
Definition: Loot.h:214
bool FillLoot(uint32 lootId, LootStore const &store, Player *lootOwner, bool personal, bool noEmptyError=false, uint16 lootMode=LOOT_MODE_DEFAULT, ItemContext context=ItemContext::NONE)
Definition: Loot.cpp:210
RollVote
Definition: Group.h:60
uint8 totalGreed
Definition: Group.h:190
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Create()

bool Group::Create ( Player leader)
106 {
107  ObjectGuid leaderGuid = leader->GetGUID();
108 
109  m_guid = ObjectGuid::Create<HighGuid::Party>(sGroupMgr->GenerateGroupId());
110  m_leaderGuid = leaderGuid;
111  m_leaderName = leader->GetName();
113 
114  if (isBGGroup() || isBFGroup())
115  {
118  }
119 
122 
123  if (!isLFGGroup())
125 
127  m_looterGuid = leaderGuid;
129 
133 
134  if (!isBGGroup() && !isBFGroup())
135  {
139 
140  m_dbStoreId = sGroupMgr->GenerateNewGroupDbStoreId();
141 
142  sGroupMgr->RegisterGroupDbStoreId(m_dbStoreId, this);
143 
144  // Store group in database
146 
147  uint8 index = 0;
148 
149  stmt->setUInt32(index++, m_dbStoreId);
150  stmt->setUInt64(index++, m_leaderGuid.GetCounter());
151  stmt->setUInt8(index++, uint8(m_lootMethod));
152  stmt->setUInt64(index++, m_looterGuid.GetCounter());
153  stmt->setUInt8(index++, uint8(m_lootThreshold));
154  stmt->setBinary(index++, m_targetIcons[0].GetRawValue());
155  stmt->setBinary(index++, m_targetIcons[1].GetRawValue());
156  stmt->setBinary(index++, m_targetIcons[2].GetRawValue());
157  stmt->setBinary(index++, m_targetIcons[3].GetRawValue());
158  stmt->setBinary(index++, m_targetIcons[4].GetRawValue());
159  stmt->setBinary(index++, m_targetIcons[5].GetRawValue());
160  stmt->setBinary(index++, m_targetIcons[6].GetRawValue());
161  stmt->setBinary(index++, m_targetIcons[7].GetRawValue());
162  stmt->setUInt8(index++, uint8(m_groupFlags));
163  stmt->setUInt32(index++, uint8(m_dungeonDifficulty));
164  stmt->setUInt32(index++, uint8(m_raidDifficulty));
165  stmt->setUInt32(index++, uint8(m_legacyRaidDifficulty));
166  stmt->setUInt64(index++, m_masterLooterGuid.GetCounter());
167 
168  CharacterDatabase.Execute(stmt);
169 
170  Group::ConvertLeaderInstancesToGroup(leader, this, false);
171 
172  bool addMemberResult = AddMember(leader);
173  ASSERT(addMemberResult); // If the leader can't be added to a new group because it appears full, something is clearly wrong.
174  }
175  else if (!AddMember(leader))
176  return false;
177 
178  return true;
179 }
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
void AddPlayerFlag(PlayerFlags flags)
Definition: Player.h:2574
bool isLFGGroup() const
Definition: Group.cpp:2422
Definition: Loot.h:74
uint32 m_dbStoreId
Definition: Group.h:453
Definition: DBCEnums.h:600
void _initRaidSubGroupsCounter()
Definition: Group.cpp:2629
void setBinary(const uint8 index, const std::vector< uint8 > &value)
Definition: PreparedStatement.cpp:189
Difficulty GetLegacyRaidDifficultyID() const
Definition: Player.h:1904
Difficulty m_dungeonDifficulty
Definition: Group.h:438
LowType GetCounter() const
Definition: ObjectGuid.h:273
LootMethod m_lootMethod
Definition: Group.h:444
ObjectGuid m_guid
Definition: Group.h:451
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:100
ObjectGuid m_targetIcons[TARGET_ICONS_COUNT]
Definition: Group.h:443
Definition: DatabaseEnvFwd.h:40
Definition: DBCEnums.h:609
bool AddMember(Player *player)
Definition: Group.cpp:380
ObjectGuid const & GetGUID() const
Definition: Object.h:154
std::string const & GetName() const
Definition: Object.h:467
Difficulty GetDungeonDifficultyID() const
Definition: Player.h:1902
GroupFlags m_groupFlags
Definition: Group.h:436
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:116
ObjectGuid m_leaderGuid
Definition: Group.h:434
ObjectGuid m_looterGuid
Definition: Group.h:446
#define sGroupMgr
Definition: GroupMgr.h:59
GroupCategory m_groupCategory
Definition: Group.h:437
Definition: SharedDefines.h:340
Definition: Player.h:422
ObjectGuid m_masterLooterGuid
Definition: Group.h:447
Definition: Group.h:123
void Clear()
Definition: ObjectGuid.h:266
bool isBGGroup() const
Definition: Group.cpp:2432
bool isBFGroup() const
Definition: Group.cpp:2437
ItemQualities m_lootThreshold
Definition: Group.h:445
uint8_t uint8
Definition: Define.h:154
#define ASSERT
Definition: Errors.h:57
static void ConvertLeaderInstancesToGroup(Player *player, Group *group, bool switchLeader)
convert the player&#39;s binds to the group
Definition: Group.cpp:746
Difficulty m_legacyRaidDifficulty
Definition: Group.h:440
Definition: ObjectGuid.h:248
Difficulty GetRaidDifficultyID() const
Definition: Player.h:1903
Definition: Group.h:117
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
std::string m_leaderName
Definition: Group.h:435
Definition: CharacterDatabase.h:386
Difficulty m_raidDifficulty
Definition: Group.h:439
Definition: Group.h:109
Definition: DBCEnums.h:598
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DeleteRaidMarker()

void Group::DeleteRaidMarker ( uint8  markerId)
2386 {
2387  if (markerId > RAID_MARKERS_COUNT)
2388  return;
2389 
2390  for (uint8 i = 0; i < RAID_MARKERS_COUNT; i++)
2391  if (m_markers[i] && (markerId == i || markerId == RAID_MARKERS_COUNT))
2392  {
2393  m_markers[i] = nullptr;
2394  m_activeMarkers &= ~(1 << i);
2395  }
2396 
2398 }
uint32 m_activeMarkers
Definition: Group.h:461
std::array< std::unique_ptr< RaidMarker >, RAID_MARKERS_COUNT > m_markers
Definition: Group.h:460
void SendRaidMarkersChanged(WorldSession *session=nullptr, int8 partyIndex=0)
Definition: Group.cpp:2400
#define RAID_MARKERS_COUNT
Definition: Group.h:56
uint8_t uint8
Definition: Define.h:154
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DelinkMember()

void Group::DelinkMember ( ObjectGuid  guid)
2605 {
2607  while (ref)
2608  {
2609  GroupReference* nextRef = ref->next();
2610  if (ref->GetSource()->GetGUID() == guid)
2611  {
2612  ref->unlink();
2613  break;
2614  }
2615  ref = nextRef;
2616  }
2617 }
void unlink()
Definition: Reference.h:61
FROM * GetSource() const
Definition: Reference.h:96
ObjectGuid const & GetGUID() const
Definition: Object.h:154
GroupReference * getFirst()
Definition: GroupRefManager.h:30
GroupRefManager m_memberMgr
Definition: Group.h:432
GroupReference * next()
Definition: GroupReference.h:36
Definition: GroupReference.h:26
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Disband()

void Group::Disband ( bool  hideDestroy = false)
783 {
784  sScriptMgr->OnGroupDisband(this);
785 
786  Player* player;
787  for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
788  {
789  player = ObjectAccessor::FindConnectedPlayer(citr->guid);
790  if (!player)
791  continue;
792 
793  //we cannot call _removeMember because it would invalidate member iterator
794  //if we are removing player from battleground raid
795  if (isBGGroup() || isBFGroup())
797  else
798  {
799  //we can remove player who is in battleground from his original group
800  if (player->GetOriginalGroup() == this)
801  player->SetOriginalGroup(nullptr);
802  else
803  player->SetGroup(nullptr);
804  }
805 
807 
808  // quest related GO state dependent from raid membership
809  if (isRaidGroup())
810  player->UpdateForQuestWorldObjects();
811 
812  if (!hideDestroy)
814 
816 
817  _homebindIfInstance(player);
818  }
819  RollId.clear();
820  m_memberSlots.clear();
821 
823 
824  if (!isBGGroup() && !isBFGroup())
825  {
826  CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
827 
829  stmt->setUInt32(0, m_dbStoreId);
830  trans->Append(stmt);
831 
832  stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER_ALL);
833  stmt->setUInt32(0, m_dbStoreId);
834  trans->Append(stmt);
835 
836  CharacterDatabase.CommitTransaction(trans);
837 
838  ResetInstances(INSTANCE_RESET_GROUP_DISBAND, false, false, nullptr);
839  ResetInstances(INSTANCE_RESET_GROUP_DISBAND, true, false, nullptr);
840  ResetInstances(INSTANCE_RESET_GROUP_DISBAND, true, true, nullptr);
841 
842  stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_LFG_DATA);
843  stmt->setUInt32(0, m_dbStoreId);
844  CharacterDatabase.Execute(stmt);
845 
846  sGroupMgr->FreeGroupDbStoreId(this);
847  }
848 
849  sGroupMgr->RemoveGroup(this);
850  delete this;
851 }
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: Map.h:855
Definition: CharacterDatabase.h:471
void ResetInstances(uint8 method, bool isRaid, bool isLegacy, Player *SendMsgTo)
Definition: Group.cpp:2005
uint32 m_dbStoreId
Definition: Group.h:453
MemberSlotList::const_iterator member_citerator
Definition: Group.h:233
Rolls RollId
Definition: Group.h:448
void RemoveAllInvites()
Definition: Group.cpp:351
void _homebindIfInstance(Player *player)
Definition: Group.cpp:2196
Definition: Group.h:100
Definition: PartyPackets.h:638
Definition: DatabaseEnvFwd.h:40
void RemoveFromBattlegroundOrBattlefieldRaid()
Definition: Player.cpp:25790
MemberSlotList m_memberSlots
Definition: Group.h:431
void SetOriginalGroup(Group *group, int8 subgroup=-1)
Definition: Player.cpp:25802
void SendUpdateDestroyGroupToPlayer(Player *player) const
Definition: Group.cpp:1532
Definition: CharacterDatabase.h:472
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:6123
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:116
#define sGroupMgr
Definition: GroupMgr.h:59
GroupCategory m_groupCategory
Definition: Group.h:437
Group * GetOriginalGroup() const
Definition: Player.h:2467
bool isRaidGroup() const
Definition: Group.cpp:2427
void SetGroup(Group *group, int8 subgroup=-1)
Definition: Player.cpp:24102
Definition: CharacterDatabase.h:428
bool isBGGroup() const
Definition: Group.cpp:2432
bool isBFGroup() const
Definition: Group.cpp:2437
void SetPartyType(GroupCategory category, uint8 type)
Definition: Player.cpp:25815
#define sScriptMgr
Definition: ScriptMgr.h:1221
void UpdateForQuestWorldObjects()
Definition: Player.cpp:25044
Definition: Player.h:1056
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:275
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
Definition: DatabaseEnvFwd.h:72
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EndReadyCheck()

void Group::EndReadyCheck ( void  )
2308 {
2309  if (!m_readyCheckStarted)
2310  return;
2311 
2312  m_readyCheckStarted = false;
2313  m_readyCheckTimer = Milliseconds::zero();
2314 
2316 
2317  WorldPackets::Party::ReadyCheckCompleted readyCheckCompleted;
2318  readyCheckCompleted.PartyIndex = 0;
2319  readyCheckCompleted.PartyGUID = m_guid;
2320  BroadcastPacket(readyCheckCompleted.Write(), false);
2321 }
void ResetMemberReadyChecked(void)
Definition: Group.cpp:2369
Definition: PartyPackets.h:442
Milliseconds m_readyCheckTimer
Definition: Group.h:457
ObjectGuid m_guid
Definition: Group.h:451
bool m_readyCheckStarted
Definition: Group.h:456
ObjectGuid PartyGUID
Definition: PartyPackets.h:450
WorldPacket const * Write() override
Definition: PartyPackets.cpp:387
int8 PartyIndex
Definition: PartyPackets.h:449
void BroadcastPacket(WorldPacket const *packet, bool ignorePlayersInBGRaid, int group=-1, ObjectGuid ignoredPlayer=ObjectGuid::Empty)
Definition: Group.cpp:1575
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EndRoll()

void Group::EndRoll ( Loot loot,
Map allowedMap 
)
1201 {
1202  for (Rolls::iterator itr = RollId.begin(); itr != RollId.end();)
1203  {
1204  if ((*itr)->getLoot() == pLoot)
1205  {
1206  CountTheRoll(itr, allowedMap); //i don't have to edit player votes, who didn't vote ... he will pass
1207  itr = RollId.begin();
1208  }
1209  else
1210  ++itr;
1211  }
1212 }
Rolls RollId
Definition: Group.h:448
void CountTheRoll(Rolls::iterator roll, Map *allowedMap)
Definition: Group.cpp:1214
+ Here is the call graph for this function:

◆ GetBoundInstance() [1/4]

InstanceGroupBind * Group::GetBoundInstance ( Player player)
2103 {
2104  uint32 mapid = player->GetMapId();
2105  MapEntry const* mapEntry = sMapStore.LookupEntry(mapid);
2106  return GetBoundInstance(mapEntry);
2107 }
Definition: DB2Structure.h:2343
uint32_t uint32
Definition: Define.h:152
uint32 GetMapId() const
Definition: Position.h:252
InstanceGroupBind * GetBoundInstance(Player *player)
Definition: Group.cpp:2102
DB2Storage< MapEntry > sMapStore("Map.db2", MapLoadInfo::Instance())
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetBoundInstance() [2/4]

InstanceGroupBind * Group::GetBoundInstance ( Map aMap)
2110 {
2111  return GetBoundInstance(aMap->GetEntry());
2112 }
MapEntry const * GetEntry() const
Definition: Map.h:255
InstanceGroupBind * GetBoundInstance(Player *player)
Definition: Group.cpp:2102
+ Here is the call graph for this function:

◆ GetBoundInstance() [3/4]

InstanceGroupBind * Group::GetBoundInstance ( MapEntry const *  mapEntry)
2115 {
2116  if (!mapEntry || !mapEntry->IsDungeon())
2117  return nullptr;
2118 
2119  Difficulty difficulty = GetDifficultyID(mapEntry);
2120  return GetBoundInstance(difficulty, mapEntry->ID);
2121 }
Difficulty
Definition: DBCEnums.h:595
Difficulty GetDifficultyID(MapEntry const *mapEntry) const
Definition: Group.cpp:1989
InstanceGroupBind * GetBoundInstance(Player *player)
Definition: Group.cpp:2102
+ Here is the call graph for this function:

◆ GetBoundInstance() [4/4]

InstanceGroupBind * Group::GetBoundInstance ( Difficulty  difficulty,
uint32  mapId 
)
2124 {
2125  // some instances only have one difficulty
2126  sDB2Manager.GetDownscaledMapDifficultyData(mapId, difficulty);
2127 
2128  auto difficultyItr = m_boundInstances.find(difficulty);
2129  if (difficultyItr == m_boundInstances.end())
2130  return nullptr;
2131 
2132  auto itr = difficultyItr->second.find(mapId);
2133  if (itr != difficultyItr->second.end())
2134  return &itr->second;
2135  else
2136  return nullptr;
2137 }
#define sDB2Manager
Definition: DB2Stores.h:445
BoundInstancesMap m_boundInstances
Definition: Group.h:449

◆ GetBoundInstanceEnd()

Group::BoundInstancesMap::iterator Group::GetBoundInstanceEnd ( )
2625 {
2626  return m_boundInstances.end();
2627 }
BoundInstancesMap m_boundInstances
Definition: Group.h:449

◆ GetBoundInstances()

Group::BoundInstancesMap::iterator Group::GetBoundInstances ( Difficulty  difficulty)
2620 {
2621  return m_boundInstances.find(difficulty);
2622 }
BoundInstancesMap m_boundInstances
Definition: Group.h:449

◆ GetDbStoreId()

uint32 Group::GetDbStoreId ( ) const
inline
307 { return m_dbStoreId; }
uint32 m_dbStoreId
Definition: Group.h:453
+ Here is the caller graph for this function:

◆ GetDifficultyID()

Difficulty Group::GetDifficultyID ( MapEntry const *  mapEntry) const
1990 {
1991  if (!mapEntry->IsRaid())
1992  return m_dungeonDifficulty;
1993 
1994  MapDifficultyEntry const* defaultDifficulty = sDB2Manager.GetDefaultMapDifficulty(mapEntry->ID);
1995  if (!defaultDifficulty)
1996  return m_legacyRaidDifficulty;
1997 
1998  DifficultyEntry const* difficulty = sDifficultyStore.LookupEntry(defaultDifficulty->DifficultyID);
1999  if (!difficulty || difficulty->Flags & DIFFICULTY_FLAG_LEGACY)
2000  return m_legacyRaidDifficulty;
2001 
2002  return m_raidDifficulty;
2003 }
#define sDB2Manager
Definition: DB2Stores.h:445
Difficulty m_dungeonDifficulty
Definition: Group.h:438
uint16 Flags
Definition: DB2Structure.h:1303
DB2Storage< DifficultyEntry > sDifficultyStore("Difficulty.db2", DifficultyLoadInfo::Instance())
int32 DifficultyID
Definition: DB2Structure.h:2406
Definition: DBCEnums.h:644
Definition: DB2Structure.h:2402
Difficulty m_legacyRaidDifficulty
Definition: Group.h:440
Difficulty m_raidDifficulty
Definition: Group.h:439
Definition: DB2Structure.h:1293
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetDungeonDifficultyID()

Difficulty Group::GetDungeonDifficultyID ( ) const
inline
354 { return m_dungeonDifficulty; }
Difficulty m_dungeonDifficulty
Definition: Group.h:438
+ Here is the caller graph for this function:

◆ GetFirstMember() [1/2]

GroupReference* Group::GetFirstMember ( )
inline
328 { return m_memberMgr.getFirst(); }
GroupReference * getFirst()
Definition: GroupRefManager.h:30
GroupRefManager m_memberMgr
Definition: Group.h:432
+ Here is the caller graph for this function:

◆ GetFirstMember() [2/2]

GroupReference const* Group::GetFirstMember ( ) const
inline
329 { return m_memberMgr.getFirst(); }
GroupReference * getFirst()
Definition: GroupRefManager.h:30
GroupRefManager m_memberMgr
Definition: Group.h:432

◆ GetGroupCategory()

GroupCategory Group::GetGroupCategory ( ) const
inline
298 { return m_groupCategory; }
GroupCategory m_groupCategory
Definition: Group.h:437
+ Here is the caller graph for this function:

◆ GetGroupFlags()

GroupFlags Group::GetGroupFlags ( ) const
inline
332 { return m_groupFlags; }
GroupFlags m_groupFlags
Definition: Group.h:436
+ Here is the call graph for this function:

◆ GetGUID()

ObjectGuid Group::GetGUID ( ) const
2453 {
2454  return m_guid;
2455 }
ObjectGuid m_guid
Definition: Group.h:451
+ Here is the caller graph for this function:

◆ GetInvited() [1/2]

Player * Group::GetInvited ( ObjectGuid  guid) const
361 {
362  for (InvitesList::const_iterator itr = m_invitees.begin(); itr != m_invitees.end(); ++itr)
363  {
364  if ((*itr) && (*itr)->GetGUID() == guid)
365  return (*itr);
366  }
367  return nullptr;
368 }
InvitesList m_invitees
Definition: Group.h:433
+ Here is the caller graph for this function:

◆ GetInvited() [2/2]

Player * Group::GetInvited ( const std::string &  name) const
371 {
372  for (InvitesList::const_iterator itr = m_invitees.begin(); itr != m_invitees.end(); ++itr)
373  {
374  if ((*itr) && (*itr)->GetName() == name)
375  return (*itr);
376  }
377  return nullptr;
378 }
InvitesList m_invitees
Definition: Group.h:433

◆ GetInviteeCount()

uint32 Group::GetInviteeCount ( ) const
inline
331 { return m_invitees.size(); }
InvitesList m_invitees
Definition: Group.h:433
+ Here is the caller graph for this function:

◆ GetLeaderGUID()

ObjectGuid Group::GetLeaderGUID ( ) const
2448 {
2449  return m_leaderGuid;
2450 }
ObjectGuid m_leaderGuid
Definition: Group.h:434
+ Here is the caller graph for this function:

◆ GetLeaderName()

char const * Group::GetLeaderName ( ) const
2458 {
2459  return m_leaderName.c_str();
2460 }
std::string m_leaderName
Definition: Group.h:435
+ Here is the caller graph for this function:

◆ GetLegacyRaidDifficultyID()

Difficulty Group::GetLegacyRaidDifficultyID ( ) const
inline
356 { return m_legacyRaidDifficulty; }
Difficulty m_legacyRaidDifficulty
Definition: Group.h:440
+ Here is the caller graph for this function:

◆ GetLfgRoles()

uint8 Group::GetLfgRoles ( ObjectGuid  guid)
2260 {
2261  member_witerator slot = _getMemberWSlot(guid);
2262  if (slot == m_memberSlots.end())
2263  return 0;
2264 
2265  return slot->roles;
2266 }
MemberSlotList::iterator member_witerator
Definition: Group.h:237
MemberSlotList m_memberSlots
Definition: Group.h:431
member_witerator _getMemberWSlot(ObjectGuid Guid)
Definition: Group.cpp:2649
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetLooterGuid()

ObjectGuid Group::GetLooterGuid ( ) const
2468 {
2469  if (GetLootMethod() == FREE_FOR_ALL)
2470  return ObjectGuid::Empty;
2471  return m_looterGuid;
2472 }
static ObjectGuid const Empty
Definition: ObjectGuid.h:255
Definition: Loot.h:72
LootMethod GetLootMethod() const
Definition: Group.cpp:2462
ObjectGuid m_looterGuid
Definition: Group.h:446
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetLootMethod()

LootMethod Group::GetLootMethod ( ) const
2463 {
2464  return m_lootMethod;
2465 }
LootMethod m_lootMethod
Definition: Group.h:444
+ Here is the caller graph for this function:

◆ GetLootThreshold()

ItemQualities Group::GetLootThreshold ( ) const
2480 {
2481  return m_lootThreshold;
2482 }
ItemQualities m_lootThreshold
Definition: Group.h:445
+ Here is the caller graph for this function:

◆ GetMasterLooterGuid()

ObjectGuid Group::GetMasterLooterGuid ( ) const
2475 {
2476  return m_masterLooterGuid;
2477 }
ObjectGuid m_masterLooterGuid
Definition: Group.h:447
+ Here is the caller graph for this function:

◆ GetMemberFlags()

uint8 Group::GetMemberFlags ( ObjectGuid  guid) const
2503 {
2504  member_citerator mslot = _getMemberCSlot(guid);
2505  if (mslot == m_memberSlots.end())
2506  return 0u;
2507  return mslot->flags;
2508 }
MemberSlotList::const_iterator member_citerator
Definition: Group.h:233
MemberSlotList m_memberSlots
Definition: Group.h:431
member_citerator _getMemberCSlot(ObjectGuid Guid) const
Definition: Group.cpp:2641
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetMemberGroup()

uint8 Group::GetMemberGroup ( ObjectGuid  guid) const
2532 {
2533  member_citerator mslot = _getMemberCSlot(guid);
2534  if (mslot == m_memberSlots.end())
2535  return (MAX_RAID_SUBGROUPS+1);
2536  return mslot->group;
2537 }
MemberSlotList::const_iterator member_citerator
Definition: Group.h:233
MemberSlotList m_memberSlots
Definition: Group.h:431
member_citerator _getMemberCSlot(ObjectGuid Guid) const
Definition: Group.cpp:2641
#define MAX_RAID_SUBGROUPS
Definition: Group.h:53
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetMemberGUID()

ObjectGuid Group::GetMemberGUID ( const std::string &  name)
2495 {
2496  for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
2497  if (itr->name == name)
2498  return itr->guid;
2499  return ObjectGuid::Empty;
2500 }
static ObjectGuid const Empty
Definition: ObjectGuid.h:255
MemberSlotList::const_iterator member_citerator
Definition: Group.h:233
MemberSlotList m_memberSlots
Definition: Group.h:431

◆ GetMembersCount()

uint32 Group::GetMembersCount ( ) const
inline
330 { return uint32(m_memberSlots.size()); }
MemberSlotList m_memberSlots
Definition: Group.h:431
uint32_t uint32
Definition: Define.h:152
+ Here is the caller graph for this function:

◆ GetMemberSlots()

MemberSlotList const& Group::GetMemberSlots ( ) const
inline
327 { return m_memberSlots; }
MemberSlotList m_memberSlots
Definition: Group.h:431
+ Here is the caller graph for this function:

◆ GetRaidDifficultyID()

Difficulty Group::GetRaidDifficultyID ( ) const
inline
355 { return m_raidDifficulty; }
Difficulty m_raidDifficulty
Definition: Group.h:439
+ Here is the caller graph for this function:

◆ GetRoll()

Group::Rolls::iterator Group::GetRoll ( ObjectGuid  lootObjectGuid,
uint8  lootListId 
)
2591 {
2592  for (Rolls::iterator iter = RollId.begin(); iter != RollId.end(); ++iter)
2593  if ((**iter)->GetGUID() == lootObjectGuid && (*iter)->itemSlot == lootListId && (*iter)->isValid())
2594  return iter;
2595 
2596  return RollId.end();
2597 }
Rolls RollId
Definition: Group.h:448
+ Here is the caller graph for this function:

◆ GroupLoot()

void Group::GroupLoot ( Loot loot,
WorldObject pLootedObject 
)
974 {
975  ItemTemplate const* item;
976  uint8 itemSlot = 0;
977  for (std::vector<LootItem>::iterator i = loot->items.begin(); i != loot->items.end(); ++i, ++itemSlot)
978  {
979  if (i->freeforall)
980  continue;
981 
982  item = ASSERT_NOTNULL(sObjectMgr->GetItemTemplate(i->itemid));
983 
984  //roll for over-threshold item if it's one-player loot
985  if (item->GetQuality() >= uint32(m_lootThreshold))
986  {
987  Roll* r = new Roll(*i);
988 
989  for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
990  {
991  Player* playerToRoll = itr->GetSource();
992  if (!playerToRoll || !playerToRoll->GetSession())
993  continue;
994 
995  bool allowedForPlayer = i->AllowedForPlayer(playerToRoll);
996  if (allowedForPlayer && playerToRoll->IsAtGroupRewardDistance(lootedObject))
997  {
998  r->totalPlayersRolling++;
999  if (playerToRoll->GetPassOnGroupLoot())
1000  {
1001  r->playerVote[playerToRoll->GetGUID()] = PASS;
1002  r->totalPass++;
1003  // can't broadcast the pass now. need to wait until all rolling players are known.
1004  }
1005  else
1006  r->playerVote[playerToRoll->GetGUID()] = NOT_EMITED_YET;
1007  }
1008  }
1009 
1010  if (r->totalPlayersRolling > 0)
1011  {
1012  r->setLoot(loot);
1013  r->itemSlot = itemSlot;
1016 
1017  loot->items[itemSlot].is_blocked = true;
1018 
1019  //Broadcast Pass and Send Rollstart
1020  for (Roll::PlayerVote::const_iterator itr = r->playerVote.begin(); itr != r->playerVote.end(); ++itr)
1021  {
1023  if (!p || !p->GetSession())
1024  continue;
1025 
1026  if (itr->second == PASS)
1027  SendLootRoll(p->GetGUID(), -1, ROLL_PASS, *r);
1028  else
1029  SendLootStartRollToPlayer(60000, lootedObject->GetMapId(), p, p->CanRollForItemInLFG(item, lootedObject) == EQUIP_ERR_OK, *r);
1030  }
1031 
1032  RollId.push_back(r);
1033 
1034  if (Creature* creature = lootedObject->ToCreature())
1035  {
1036  creature->m_groupLootTimer = 60000;
1037  creature->lootingGroupLowGUID = GetGUID();
1038  }
1039  else if (GameObject* go = lootedObject->ToGameObject())
1040  {
1041  go->m_groupLootTimer = 60000;
1042  go->lootingGroupLowGUID = GetGUID();
1043  }
1044  }
1045  else
1046  delete r;
1047  }
1048  else
1049  i->is_underthreshold = true;
1050  }
1051 
1052  for (std::vector<LootItem>::iterator i = loot->quest_items.begin(); i != loot->quest_items.end(); ++i, ++itemSlot)
1053  {
1054  if (!i->follow_loot_rules)
1055  continue;
1056 
1057  item = sObjectMgr->GetItemTemplate(i->itemid);
1058  Roll* r = new Roll(*i);
1059 
1060  for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
1061  {
1062  Player* playerToRoll = itr->GetSource();
1063  if (!playerToRoll || !playerToRoll->GetSession())
1064  continue;
1065 
1066  bool allowedForPlayer = i->AllowedForPlayer(playerToRoll);
1067  if (allowedForPlayer && playerToRoll->IsAtGroupRewardDistance(lootedObject))
1068  {
1069  r->totalPlayersRolling++;
1070  r->playerVote[playerToRoll->GetGUID()] = NOT_EMITED_YET;
1071  }
1072  }
1073 
1074  if (r->totalPlayersRolling > 0)
1075  {
1076  r->setLoot(loot);
1077  r->itemSlot = itemSlot;
1078 
1079  loot->quest_items[itemSlot - loot->items.size()].is_blocked = true;
1080 
1081  //Broadcast Pass and Send Rollstart
1082  for (Roll::PlayerVote::const_iterator itr = r->playerVote.begin(); itr != r->playerVote.end(); ++itr)
1083  {
1085  if (!p || !p->GetSession())
1086  continue;
1087 
1088  if (itr->second == PASS)
1089  SendLootRoll(p->GetGUID(), -1, ROLL_PASS, *r);
1090  else
1091  SendLootStartRollToPlayer(60000, lootedObject->GetMapId(), p, p->CanRollForItemInLFG(item, lootedObject) == EQUIP_ERR_OK, *r);
1092  }
1093 
1094  RollId.push_back(r);
1095 
1096  if (Creature* creature = lootedObject->ToCreature())
1097  {
1098  creature->m_groupLootTimer = 60000;
1099  creature->lootingGroupLowGUID = GetGUID();
1100  }
1101  else if (GameObject* go = lootedObject->ToGameObject())
1102  {
1103  go->m_groupLootTimer = 60000;
1104  go->lootingGroupLowGUID = GetGUID();
1105  }
1106  }
1107  else
1108  delete r;
1109  }
1110 }
bool IsAtGroupRewardDistance(WorldObject const *pRewardSource) const
Definition: Player.cpp:25470
Rolls RollId
Definition: Group.h:448
uint8 totalPlayersRolling
Definition: Group.h:188
PlayerVote playerVote
Definition: Group.h:187
WorldSession * GetSession() const
Definition: Player.h:1990
Definition: Group.h:62
InventoryResult CanRollForItemInLFG(ItemTemplate const *item, WorldObject const *lootedObject) const
Definition: Player.cpp:11966
uint8 rollVoteMask
Definition: Group.h:193
Definition: Creature.h:61
#define ASSERT_NOTNULL(pointer)
Definition: Errors.h:69
ObjectGuid GetGUID() const
Definition: Group.cpp:2452
#define sObjectMgr
Definition: ObjectMgr.h:1847
GameObject * ToGameObject()
Definition: Object.h:204
bool GetPassOnGroupLoot() const
Definition: Player.h:2473
Definition: Group.h:172
ObjectGuid const & GetGUID() const
Definition: Object.h:154
Definition: Loot.h:47
void SendLootRoll(ObjectGuid playerGuid, int32 rollNumber, uint8 rollType, Roll const &roll) const
Definition: Group.cpp:875
uint32 GetQuality() const
Definition: ItemTemplate.h:738
uint32_t uint32
Definition: Define.h:152
Definition: GameObject.h:81
Definition: Group.h:66
GroupReference * GetFirstMember()
Definition: Group.h:328
void setLoot(Loot *pLoot)
Definition: Group.cpp:52
GroupReference * next()
Definition: GroupReference.h:36
Definition: ItemDefines.h:25
std::vector< LootItem > items
Definition: Loot.h:213
Definition: ItemTemplate.h:730
Creature * ToCreature()
Definition: Object.h:196
uint32 GetFlags2() const
Definition: ItemTemplate.h:740
void SendLootStartRollToPlayer(uint32 countDown, uint32 mapId, Player *p, bool canNeed, Roll const &r) const
Definition: Group.cpp:856
ItemQualities m_lootThreshold
Definition: Group.h:445
uint8_t uint8
Definition: Define.h:154
uint8 itemSlot
Definition: Group.h:192
Definition: Player.h:1056
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:275
Definition: ItemTemplate.h:222
std::vector< LootItem > quest_items
Definition: Loot.h:214
uint8 totalPass
Definition: Group.h:191
Definition: Loot.h:57
Definition: GroupReference.h:26
+ Here is the call graph for this function:

◆ HasFreeSlotSubGroup()

bool Group::HasFreeSlotSubGroup ( uint8  subgroup) const
2527 {
2528  return (m_subGroupsCounts && m_subGroupsCounts[subgroup] < MAX_GROUP_SIZE);
2529 }
uint8 * m_subGroupsCounts
Definition: Group.h:450
#define MAX_GROUP_SIZE
Definition: Group.h:51
+ Here is the caller graph for this function:

◆ IsAssistant()

bool Group::IsAssistant ( ObjectGuid  guid) const
inline
315  {
317  }
Definition: Group.h:87
uint8 GetMemberFlags(ObjectGuid guid) const
Definition: Group.cpp:2502
+ Here is the caller graph for this function:

◆ isBFGroup()

bool Group::isBFGroup ( ) const
2438 {
2439  return m_bfGroup != nullptr;
2440 }
Battlefield * m_bfGroup
Definition: Group.h:442
+ Here is the caller graph for this function:

◆ isBGGroup()

bool Group::isBGGroup ( ) const
2433 {
2434  return m_bgGroup != nullptr;
2435 }
Battleground * m_bgGroup
Definition: Group.h:441
+ Here is the caller graph for this function:

◆ IsCreated()

bool Group::IsCreated ( ) const
2443 {
2444  return GetMembersCount() > 0;
2445 }
uint32 GetMembersCount() const
Definition: Group.h:330
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsFull()

bool Group::IsFull ( ) const
2418 {
2419  return isRaidGroup() ? (m_memberSlots.size() >= MAX_RAID_SIZE) : (m_memberSlots.size() >= MAX_GROUP_SIZE);
2420 }
MemberSlotList m_memberSlots
Definition: Group.h:431
#define MAX_GROUP_SIZE
Definition: Group.h:51
#define MAX_RAID_SIZE
Definition: Group.h:52
bool isRaidGroup() const
Definition: Group.cpp:2427
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsLeader()

bool Group::IsLeader ( ObjectGuid  guid) const
2490 {
2491  return (GetLeaderGUID() == guid);
2492 }
ObjectGuid GetLeaderGUID() const
Definition: Group.cpp:2447
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isLFGGroup()

bool Group::isLFGGroup ( ) const
2423 {
2424  return (m_groupFlags & GROUP_FLAG_LFG) != 0;
2425 }
Definition: Group.h:111
GroupFlags m_groupFlags
Definition: Group.h:436
+ Here is the caller graph for this function:

◆ IsMember()

bool Group::IsMember ( ObjectGuid  guid) const
2485 {
2486  return _getMemberCSlot(guid) != m_memberSlots.end();
2487 }
MemberSlotList m_memberSlots
Definition: Group.h:431
member_citerator _getMemberCSlot(ObjectGuid Guid) const
Definition: Group.cpp:2641
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isRaidGroup()

bool Group::isRaidGroup ( ) const
2428 {
2429  return (m_groupFlags & GROUP_FLAG_RAID) != 0;
2430 }
GroupFlags m_groupFlags
Definition: Group.h:436
Definition: Group.h:109
+ Here is the caller graph for this function:

◆ IsReadyCheckCompleted()

bool Group::IsReadyCheckCompleted ( void  ) const
2324 {
2325  for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
2326  if (!citr->readyChecked)
2327  return false;
2328  return true;
2329 }
MemberSlotList::const_iterator member_citerator
Definition: Group.h:233
MemberSlotList m_memberSlots
Definition: Group.h:431
+ Here is the caller graph for this function:

◆ IsReadyCheckStarted()

bool Group::IsReadyCheckStarted ( void  ) const
inline
276 { return m_readyCheckStarted; }
bool m_readyCheckStarted
Definition: Group.h:456

◆ isRollLootActive()

bool Group::isRollLootActive ( ) const
inline
388 { return !RollId.empty(); }
Rolls RollId
Definition: Group.h:448
+ Here is the caller graph for this function:

◆ LinkMember()

void Group::LinkMember ( GroupReference pRef)
2600 {
2601  m_memberMgr.insertFirst(pRef);
2602 }
GroupRefManager m_memberMgr
Definition: Group.h:432
void insertFirst(LinkedListElement *pElem)
Definition: LinkedList.h:116
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LoadGroupFromDB()

void Group::LoadGroupFromDB ( Field field)
182 {
183  m_dbStoreId = fields[17].GetUInt32();
184  m_guid = ObjectGuid::Create<HighGuid::Party>(sGroupMgr->GenerateGroupId());
185  m_leaderGuid = ObjectGuid::Create<HighGuid::Player>(fields[0].GetUInt64());
186 
187  // group leader not exist
188  if (!sCharacterCache->GetCharacterNameByGuid(m_leaderGuid, m_leaderName))
189  return;
190 
191  m_lootMethod = LootMethod(fields[1].GetUInt8());
192  m_looterGuid = ObjectGuid::Create<HighGuid::Player>(fields[2].GetUInt64());
193  m_lootThreshold = ItemQualities(fields[3].GetUInt8());
194 
195  for (uint8 i = 0; i < TARGET_ICONS_COUNT; ++i)
196  m_targetIcons[i].SetRawValue(fields[4 + i].GetBinary());
197 
198  m_groupFlags = GroupFlags(fields[12].GetUInt8());
201 
205 
206  m_masterLooterGuid = ObjectGuid::Create<HighGuid::Player>(fields[16].GetUInt64());
207 
209  sLFGMgr->_LoadFromDB(fields, GetGUID());
210 }
#define TARGET_ICONS_COUNT
Definition: Group.h:55
Difficulty
Definition: DBCEnums.h:595
uint32 m_dbStoreId
Definition: Group.h:453
void _initRaidSubGroupsCounter()
Definition: Group.cpp:2629
static Difficulty CheckLoadedDungeonDifficultyID(Difficulty difficulty)
Definition: Player.cpp:28485
Difficulty m_dungeonDifficulty
Definition: Group.h:438
LootMethod m_lootMethod
Definition: Group.h:444
static Difficulty CheckLoadedLegacyRaidDifficultyID(Difficulty difficulty)
Definition: Player.cpp:28515
ObjectGuid m_guid
Definition: Group.h:451
ObjectGuid GetGUID() const
Definition: Group.cpp:2452
ObjectGuid m_targetIcons[TARGET_ICONS_COUNT]
Definition: Group.h:443
#define sCharacterCache
Definition: CharacterCache.h:73
Definition: Group.h:111
GroupFlags m_groupFlags
Definition: Group.h:436
#define sLFGMgr
Definition: LFGMgr.h:496
ObjectGuid m_leaderGuid
Definition: Group.h:434
ObjectGuid m_looterGuid
Definition: Group.h:446
#define sGroupMgr
Definition: GroupMgr.h:59
ObjectGuid m_masterLooterGuid
Definition: Group.h:447
GroupFlags
Definition: Group.h:105
ItemQualities
Definition: SharedDefines.h:336
ItemQualities m_lootThreshold
Definition: Group.h:445
uint8_t uint8
Definition: Define.h:154
LootMethod
Definition: Loot.h:70
Difficulty m_legacyRaidDifficulty
Definition: Group.h:440
static Difficulty CheckLoadedRaidDifficultyID(Difficulty difficulty)
Definition: Player.cpp:28500
std::string m_leaderName
Definition: Group.h:435
Difficulty m_raidDifficulty
Definition: Group.h:439
Definition: Group.h:109
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LoadMemberFromDB()

void Group::LoadMemberFromDB ( ObjectGuid::LowType  guidLow,
uint8  memberFlags,
uint8  subgroup,
uint8  roles 
)
213 {
214  MemberSlot member;
215  member.guid = ObjectGuid::Create<HighGuid::Player>(guidLow);
216 
217  // skip non-existed member
218  if (!sCharacterCache->GetCharacterNameAndClassByGUID(member.guid, member.name, member._class))
219  {
221  stmt->setUInt64(0, guidLow);
222  CharacterDatabase.Execute(stmt);
223  return;
224  }
225 
226  member.group = subgroup;
227  member.flags = memberFlags;
228  member.roles = roles;
229  member.readyChecked = false;
230 
231  m_memberSlots.push_back(member);
232 
233  SubGroupCounterIncrease(subgroup);
234 
235  sLFGMgr->SetupGroupMember(member.guid, GetGUID());
236 }
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
ObjectGuid GetGUID() const
Definition: Group.cpp:2452
Definition: DatabaseEnvFwd.h:40
#define sCharacterCache
Definition: CharacterCache.h:73
MemberSlotList m_memberSlots
Definition: Group.h:431
#define sLFGMgr
Definition: LFGMgr.h:496
void SubGroupCounterIncrease(uint8 subgroup)
Definition: Group.cpp:2657
Definition: CharacterDatabase.h:388
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MasterLoot()

void Group::MasterLoot ( Loot loot,
WorldObject pLootedObject 
)
1113 {
1114  TC_LOG_DEBUG("network", "Group::MasterLoot (SMSG_MASTER_LOOT_CANDIDATE_LIST)");
1115 
1116  for (std::vector<LootItem>::iterator i = loot->items.begin(); i != loot->items.end(); ++i)
1117  {
1118  if (i->freeforall)
1119  continue;
1120 
1121  i->is_blocked = !i->is_underthreshold;
1122  }
1123 
1124  for (std::vector<LootItem>::iterator i = loot->quest_items.begin(); i != loot->quest_items.end(); ++i)
1125  {
1126  if (!i->follow_loot_rules)
1127  continue;
1128 
1129  i->is_blocked = !i->is_underthreshold;
1130  }
1131 
1132  WorldPackets::Loot::MasterLootCandidateList masterLootCandidateList;
1133  masterLootCandidateList.LootObj = loot->GetGUID();
1134 
1135  for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
1136  {
1137  Player* looter = itr->GetSource();
1138  if (!looter->IsInWorld())
1139  continue;
1140 
1141  if (looter->IsAtGroupRewardDistance(pLootedObject))
1142  masterLootCandidateList.Players.push_back(looter->GetGUID());
1143  }
1144 
1145  masterLootCandidateList.Write();
1146 
1147  for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
1148  {
1149  Player* looter = itr->GetSource();
1150  if (looter->IsAtGroupRewardDistance(pLootedObject))
1151  looter->SendDirectMessage(masterLootCandidateList.GetRawPacket());
1152  }
1153 }
bool IsAtGroupRewardDistance(WorldObject const *pRewardSource) const
Definition: Player.cpp:25470
ObjectGuid const & GetGUID() const
Definition: Loot.h:228
bool IsInWorld() const
Definition: Object.h:149
WorldPacket const * Write() override
Definition: LootPackets.cpp:219
WorldPacket const * GetRawPacket() const
Definition: Packet.h:38
ObjectGuid const & GetGUID() const
Definition: Object.h:154
Definition: LootPackets.h:279
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:6123
GroupReference * GetFirstMember()
Definition: Group.h:328
GroupReference * next()
Definition: GroupReference.h:36
std::vector< LootItem > items
Definition: Loot.h:213
std::vector< ObjectGuid > Players
Definition: LootPackets.h:286
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:177
ObjectGuid LootObj
Definition: LootPackets.h:287
Definition: Player.h:1056
std::vector< LootItem > quest_items
Definition: Loot.h:214
Definition: GroupReference.h:26
+ Here is the call graph for this function:

◆ RemoveAllInvites()

void Group::RemoveAllInvites ( )
352 {
353  for (InvitesList::iterator itr = m_invitees.begin(); itr != m_invitees.end(); ++itr)
354  if (*itr)
355  (*itr)->SetGroupInvite(nullptr);
356 
357  m_invitees.clear();
358 }
InvitesList m_invitees
Definition: Group.h:433
+ Here is the caller graph for this function:

◆ RemoveInvite()

void Group::RemoveInvite ( Player player)
343 {
344  if (player)
345  {
346  m_invitees.erase(player);
347  player->SetGroupInvite(nullptr);
348  }
349 }
void SetGroupInvite(Group *group)
Definition: Player.h:2449
InvitesList m_invitees
Definition: Group.h:433
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RemoveMember()

bool Group::RemoveMember ( ObjectGuid  guid,
RemoveMethod  method = GROUP_REMOVEMETHOD_DEFAULT,
ObjectGuid  kicker = ObjectGuid::Empty,
const char *  reason = nullptr 
)
531 {
533 
534  sScriptMgr->OnGroupRemoveMember(this, guid, method, kicker, reason);
535 
537  if (player)
538  {
539  for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
540  {
541  if (Player* groupMember = itr->GetSource())
542  {
543  if (groupMember->GetGUID() == guid)
544  continue;
545 
546  groupMember->RemoveAllGroupBuffsFromCaster(guid);
547  player->RemoveAllGroupBuffsFromCaster(groupMember->GetGUID());
548  }
549  }
550  }
551 
552  // LFG group vote kick handled in scripts
553  if (isLFGGroup() && method == GROUP_REMOVEMETHOD_KICK)
554  return !m_memberSlots.empty();
555 
556  // remove member and change leader (if need) only if strong more 2 members _before_ member remove (BG/BF allow 1 member group)
557  if (GetMembersCount() > ((isBGGroup() || isLFGGroup() || isBFGroup()) ? 1u : 2u))
558  {
559  if (player)
560  {
561  // Battleground group handling
562  if (isBGGroup() || isBFGroup())
564  else
565  // Regular group
566  {
567  if (player->GetOriginalGroup() == this)
568  player->SetOriginalGroup(nullptr);
569  else
570  player->SetGroup(nullptr);
571 
572  // quest related GO state dependent from raid membership
573  player->UpdateForQuestWorldObjects();
574  }
575 
577 
578  if (method == GROUP_REMOVEMETHOD_KICK || method == GROUP_REMOVEMETHOD_KICK_LFG)
580 
581  _homebindIfInstance(player);
582  }
583 
584  // Remove player from group in DB
585  if (!isBGGroup() && !isBFGroup())
586  {
588  stmt->setUInt64(0, guid.GetCounter());
589  CharacterDatabase.Execute(stmt);
590  DelinkMember(guid);
591  }
592 
593  // Reevaluate group enchanter if the leaving player had enchanting skill or the player is offline
594  if (!player || player->GetSkillValue(SKILL_ENCHANTING))
596 
597  // Remove player from loot rolls
598  for (Rolls::iterator it = RollId.begin(); it != RollId.end(); ++it)
599  {
600  Roll* roll = *it;
601  Roll::PlayerVote::iterator itr2 = roll->playerVote.find(guid);
602  if (itr2 == roll->playerVote.end())
603  continue;
604 
605  if (itr2->second == GREED || itr2->second == DISENCHANT)
606  --roll->totalGreed;
607  else if (itr2->second == NEED)
608  --roll->totalNeed;
609  else if (itr2->second == PASS)
610  --roll->totalPass;
611 
612  if (itr2->second != NOT_VALID)
613  --roll->totalPlayersRolling;
614 
615  roll->playerVote.erase(itr2);
616 
617  if (roll->totalPass + roll->totalNeed + roll->totalGreed >= roll->totalPlayersRolling)
618  {
619  CountTheRoll(it, nullptr);
620  it = RollId.begin();
621  }
622  }
623 
624  // Update subgroups
625  member_witerator slot = _getMemberWSlot(guid);
626  if (slot != m_memberSlots.end())
627  {
628  SubGroupCounterDecrease(slot->group);
629  m_memberSlots.erase(slot);
630  }
631 
632  // Pick new leader if necessary
633  if (m_leaderGuid == guid)
634  {
635  for (member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
636  {
638  {
639  ChangeLeader(itr->guid);
640  break;
641  }
642  }
643  }
644 
645  SendUpdate();
646 
647  if (isLFGGroup() && GetMembersCount() == 1)
648  {
650  uint32 mapId = sLFGMgr->GetDungeonMapId(GetGUID());
651  if (!mapId || !leader || (leader->IsAlive() && leader->GetMapId() != mapId))
652  {
653  Disband();
654  return false;
655  }
656  }
657 
658  if (m_memberMgr.getSize() < ((isLFGGroup() || isBGGroup()) ? 1u : 2u))
659  Disband();
660  else if (player)
661  {
662  // send update to removed player too so party frames are destroyed clientside
664  }
665 
666  return true;
667  }
668  // If group size before player removal <= 2 then disband it
669  else
670  {
671  Disband();
672  return false;
673  }
674 }
uint32 getSize() const
Definition: LinkedList.h:126
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: SharedDefines.h:6116
bool isLFGGroup() const
Definition: Group.cpp:2422
MemberSlotList::iterator member_witerator
Definition: Group.h:237
Rolls RollId
Definition: Group.h:448
uint8 totalPlayersRolling
Definition: Group.h:188
void RemoveAllGroupBuffsFromCaster(ObjectGuid casterGUID)
Definition: Unit.cpp:4173
PlayerVote playerVote
Definition: Group.h:187
Definition: SharedDefines.h:5134
void BroadcastGroupUpdate(void)
Definition: Group.cpp:2202
void _homebindIfInstance(Player *player)
Definition: Group.cpp:2196
void DelinkMember(ObjectGuid guid)
Definition: Group.cpp:2604
LowType GetCounter() const
Definition: ObjectGuid.h:273
Definition: Group.h:62
Definition: Group.h:100
Definition: PartyPackets.h:126
ObjectGuid GetGUID() const
Definition: Group.cpp:2452
Definition: DatabaseEnvFwd.h:40
Definition: Group.h:172
ObjectGuid GetLeaderGUID() const
Definition: Group.cpp:2447
uint8 totalNeed
Definition: Group.h:189
void RemoveFromBattlegroundOrBattlefieldRaid()
Definition: Player.cpp:25790
MemberSlotList m_memberSlots
Definition: Group.h:431
void SetOriginalGroup(Group *group, int8 subgroup=-1)
Definition: Player.cpp:25802
void CountTheRoll(Rolls::iterator roll, Map *allowedMap)
Definition: Group.cpp:1214
void SendUpdateDestroyGroupToPlayer(Player *player) const
Definition: Group.cpp:1532
Definition: Group.h:63
Definition: Group.h:65
bool IsAlive() const
Definition: Unit.h:1217
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:6123
GroupRefManager m_memberMgr
Definition: Group.h:432
#define sLFGMgr
Definition: LFGMgr.h:496
member_witerator _getMemberWSlot(ObjectGuid Guid)
Definition: Group.cpp:2649
ObjectGuid m_leaderGuid
Definition: Group.h:434
uint32_t uint32
Definition: Define.h:152
GroupCategory m_groupCategory
Definition: Group.h:437
Group * GetOriginalGroup() const
Definition: Player.h:2467
void ResetMaxEnchantingLevel()
Definition: Group.cpp:2217
Definition: Group.h:64
void SubGroupCounterDecrease(uint8 subgroup)
Definition: Group.cpp:2663
GroupReference * GetFirstMember()
Definition: Group.h:328
void SetGroup(Group *group, int8 subgroup=-1)
Definition: Player.cpp:24102
GroupReference * next()
Definition: GroupReference.h:36
bool isBGGroup() const
Definition: Group.cpp:2432
bool isBFGroup() const
Definition: Group.cpp:2437
void Disband(bool hideDestroy=false)
Definition: Group.cpp:782
uint32 GetMapId() const
Definition: Position.h:252
uint32 GetMembersCount() const
Definition: Group.h:330
Definition: Group.h:67
void SetPartyType(GroupCategory category, uint8 type)
Definition: Player.cpp:25815
#define sScriptMgr
Definition: ScriptMgr.h:1221
void UpdateForQuestWorldObjects()
Definition: Player.cpp:25044
Definition: CharacterDatabase.h:388
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
Definition: Player.h:1056
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:275
uint16 GetSkillValue(uint32 skill) const
Definition: Player.cpp:5854
uint8 totalPass
Definition: Group.h:191
void SendUpdate()
Definition: Group.cpp:1430
Definition: GroupReference.h:26
Definition: SharedDefines.h:6114
void ChangeLeader(ObjectGuid guid, int8 partyIndex=0)
Definition: Group.cpp:676
uint8 totalGreed
Definition: Group.h:190
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RemoveUniqueGroupMemberFlag()

void Group::RemoveUniqueGroupMemberFlag ( GroupMemberFlags  flag)
2670 {
2671  for (member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
2672  if (itr->flags & flag)
2673  itr->flags &= ~flag;
2674 }
MemberSlotList::iterator member_witerator
Definition: Group.h:237
MemberSlotList m_memberSlots
Definition: Group.h:431
+ Here is the caller graph for this function:

◆ ResetInstances()

void Group::ResetInstances ( uint8  method,
bool  isRaid,
bool  isLegacy,
Player SendMsgTo 
)
2006 {
2007  if (isBGGroup() || isBFGroup())
2008  return;
2009 
2010  // method can be INSTANCE_RESET_ALL, INSTANCE_RESET_CHANGE_DIFFICULTY, INSTANCE_RESET_GROUP_DISBAND
2011 
2012  // we assume that when the difficulty changes, all instances that can be reset will be
2014  if (isRaid)
2015  {
2016  if (!isLegacy)
2017  diff = GetRaidDifficultyID();
2018  else
2019  diff = GetLegacyRaidDifficultyID();
2020  }
2021 
2022  auto difficultyItr = m_boundInstances.find(diff);
2023  if (difficultyItr == m_boundInstances.end())
2024  return;
2025 
2026  for (auto itr = difficultyItr->second.begin(); itr != difficultyItr->second.end();)
2027  {
2028  InstanceSave* instanceSave = itr->second.save;
2029  MapEntry const* entry = sMapStore.LookupEntry(itr->first);
2030  if (!entry || entry->IsRaid() != isRaid || (!instanceSave->CanReset() && method != INSTANCE_RESET_GROUP_DISBAND))
2031  {
2032  ++itr;
2033  continue;
2034  }
2035 
2036  if (method == INSTANCE_RESET_ALL)
2037  {
2038  // the "reset all instances" method can only reset normal maps
2039  if (entry->IsRaid() || diff == DIFFICULTY_HEROIC)
2040  {
2041  ++itr;
2042  continue;
2043  }
2044  }
2045 
2046  bool isEmpty = true;
2047  // if the map is loaded, reset it
2048  Map* map = sMapMgr->FindMap(instanceSave->GetMapId(), instanceSave->GetInstanceId());
2049  if (map && map->IsDungeon() && !(method == INSTANCE_RESET_GROUP_DISBAND && !instanceSave->CanReset()))
2050  {
2051  if (instanceSave->CanReset())
2052  isEmpty = ((InstanceMap*)map)->Reset(method);
2053  else
2054  isEmpty = !map->HavePlayers();
2055  }
2056 
2057  if (SendMsgTo)
2058  {
2059  if (!isEmpty)
2060  SendMsgTo->SendResetInstanceFailed(INSTANCE_RESET_FAILED, instanceSave->GetMapId());
2061  else if (sWorld->getBoolConfig(CONFIG_INSTANCES_RESET_ANNOUNCE))
2062  {
2063  if (Group* group = SendMsgTo->GetGroup())
2064  {
2065  for (GroupReference* groupRef = group->GetFirstMember(); groupRef != nullptr; groupRef = groupRef->next())
2066  if (Player* player = groupRef->GetSource())
2067  player->SendResetInstanceSuccess(instanceSave->GetMapId());
2068  }
2069 
2070  else
2071  SendMsgTo->SendResetInstanceSuccess(instanceSave->GetMapId());
2072  }
2073  else
2074  SendMsgTo->SendResetInstanceSuccess(instanceSave->GetMapId());
2075  }
2076 
2077  if (isEmpty || method == INSTANCE_RESET_GROUP_DISBAND || method == INSTANCE_RESET_CHANGE_DIFFICULTY)
2078  {
2079  // do not reset the instance, just unbind if others are permanently bound to it
2080  if (isEmpty && instanceSave->CanReset())
2081  instanceSave->DeleteFromDB();
2082  else
2083  {
2085 
2086  stmt->setUInt32(0, instanceSave->GetInstanceId());
2087 
2088  CharacterDatabase.Execute(stmt);
2089  }
2090 
2091 
2092  itr = difficultyItr->second.erase(itr);
2093  // this unloads the instance save unless online players are bound to it
2094  // (eg. permanent binds or GM solo binds)
2095  instanceSave->RemoveGroup(this);
2096  }
2097  else
2098  ++itr;
2099  }
2100 }
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: DBCEnums.h:599
Group * GetGroup()
Definition: Player.h:2450
Definition: Map.h:855
Difficulty
Definition: DBCEnums.h:595
Difficulty GetDungeonDifficultyID() const
Definition: Group.h:354
Definition: CharacterDatabase.h:406
void SendResetInstanceSuccess(uint32 MapId) const
Definition: Player.cpp:21676
Definition: DB2Structure.h:2343
bool IsDungeon() const
Definition: Map.cpp:4240
Difficulty GetRaidDifficultyID() const
Definition: Group.h:355
#define sWorld
Definition: World.h:925
bool isEmpty() const
Definition: LinkedList.h:108
Definition: DatabaseEnvFwd.h:40
void DeleteFromDB()
Definition: InstanceSaveMgr.cpp:255
Definition: Map.h:860
bool IsRaid() const
Definition: DB2Structure.h:2376
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:116
BoundInstancesMap m_boundInstances
Definition: Group.h:449
Definition: World.h:172
void SendResetInstanceFailed(ResetFailedReason reason, uint32 mapID) const
Definition: Player.cpp:21683
bool HavePlayers() const
Definition: Map.h:413
Definition: Map.h:248
Definition: InstanceSaveMgr.h:43
GroupReference * next()
Definition: GroupReference.h:36
bool isBGGroup() const
Definition: Group.cpp:2432
bool isBFGroup() const
Definition: Group.cpp:2437
uint32 GetMapId() const
Definition: InstanceSaveMgr.h:64
#define sMapMgr
Definition: MapManager.h:212
bool CanReset() const
Definition: InstanceSaveMgr.h:118
uint32 GetInstanceId() const
Definition: InstanceSaveMgr.h:63
Definition: SharedDefines.h:6425
bool RemoveGroup(Group *group)
Definition: InstanceSaveMgr.h:106
DB2Storage< MapEntry > sMapStore("Map.db2", MapLoadInfo::Instance())
Definition: Map.h:852
Definition: Player.h:1056
Definition: Group.h:219
Definition: GroupReference.h:26
Difficulty GetLegacyRaidDifficultyID() const
Definition: Group.h:356
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ResetMaxEnchantingLevel()

void Group::ResetMaxEnchantingLevel ( )
2218 {
2220  Player* member = nullptr;
2221  for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
2222  {
2223  member = ObjectAccessor::FindPlayer(citr->guid);
2224  if (member && m_maxEnchantingLevel < member->GetSkillValue(SKILL_ENCHANTING))
2226  }
2227 }
MemberSlotList::const_iterator member_citerator
Definition: Group.h:233
Definition: SharedDefines.h:5134
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:254
MemberSlotList m_memberSlots
Definition: Group.h:431
uint32 m_maxEnchantingLevel
Definition: Group.h:452
Definition: Player.h:1056
uint16 GetSkillValue(uint32 skill) const
Definition: Player.cpp:5854
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ResetMemberReadyChecked()

void Group::ResetMemberReadyChecked ( void  )
2370 {
2371  for (member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
2372  itr->readyChecked = false;
2373 }
MemberSlotList::iterator member_witerator
Definition: Group.h:237
MemberSlotList m_memberSlots
Definition: Group.h:431
+ Here is the caller graph for this function:

◆ SameSubGroup() [1/3]

bool Group::SameSubGroup ( ObjectGuid  guid1,
ObjectGuid  guid2 
) const
2511 {
2512  member_citerator mslot2 = _getMemberCSlot(guid2);
2513  if (mslot2 == m_memberSlots.end())
2514  return false;
2515  return SameSubGroup(guid1, &*mslot2);
2516 }
MemberSlotList::const_iterator member_citerator
Definition: Group.h:233
bool SameSubGroup(ObjectGuid guid1, ObjectGuid guid2) const
Definition: Group.cpp:2510
MemberSlotList m_memberSlots
Definition: Group.h:431
member_citerator _getMemberCSlot(ObjectGuid Guid) const
Definition: Group.cpp:2641
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SameSubGroup() [2/3]

bool Group::SameSubGroup ( ObjectGuid  guid1,
MemberSlot const *  slot2 
) const
2519 {
2520  member_citerator mslot1 = _getMemberCSlot(guid1);
2521  if (mslot1 == m_memberSlots.end() || !slot2)
2522  return false;
2523  return (mslot1->group == slot2->group);
2524 }
MemberSlotList::const_iterator member_citerator
Definition: Group.h:233
MemberSlotList m_memberSlots
Definition: Group.h:431
member_citerator _getMemberCSlot(ObjectGuid Guid) const
Definition: Group.cpp:2641
+ Here is the call graph for this function:

◆ SameSubGroup() [3/3]

bool Group::SameSubGroup ( Player const *  member1,
Player const *  member2 
) const
1612 {
1613  if (!member1 || !member2)
1614  return false;
1615 
1616  if (member1->GetGroup() != this || member2->GetGroup() != this)
1617  return false;
1618  else
1619  return member1->GetSubGroup() == member2->GetSubGroup();
1620 }
+ Here is the call graph for this function:

◆ SendLootAllPassed()

void Group::SendLootAllPassed ( Roll const &  roll) const
919 {
920  WorldPackets::Loot::LootAllPassed lootAllPassed;
921  lootAllPassed.LootObj = roll->GetGUID();
922  roll.FillPacket(lootAllPassed.Item);
923  lootAllPassed.Write();
924 
925  for (Roll::PlayerVote::const_iterator itr = roll.playerVote.begin(); itr != roll.playerVote.end(); ++itr)
926  {
927  Player* player = ObjectAccessor::FindConnectedPlayer(itr->first);
928  if (!player || !player->GetSession())
929  continue;
930 
931  if (itr->second != NOT_VALID)
932  player->SendDirectMessage(lootAllPassed.GetRawPacket());
933  }
934 }
LootItemData Item
Definition: LootPackets.h:265
Definition: LootPackets.h:257
WorldSession * GetSession() const
Definition: Player.h:1990
WorldPacket const * GetRawPacket() const
Definition: Packet.h:38
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:6123
WorldPacket const * Write() override
Definition: LootPackets.cpp:203
ObjectGuid LootObj
Definition: LootPackets.h:264
Definition: Group.h:67
Definition: Player.h:1056
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:275
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendLooter()

void Group::SendLooter ( Creature creature,
Player pLooter 
)
956 {
957  ASSERT(creature);
958 
960 
961  lootList.Owner = creature->GetGUID();
962  lootList.LootObj = creature->loot.GetGUID();
963 
964  if (GetLootMethod() == MASTER_LOOT && creature->loot.hasOverThresholdItem())
965  lootList.Master = GetMasterLooterGuid();
966 
967  if (groupLooter)
968  lootList.RoundRobinWinner = groupLooter->GetGUID();
969 
970  BroadcastPacket(lootList.Write(), false);
971 }
ObjectGuid LootObj
Definition: LootPackets.h:197
WorldPacket const * Write() override
Definition: LootPackets.cpp:141
LootMethod GetLootMethod() const
Definition: Group.cpp:2462
ObjectGuid const & GetGUID() const
Definition: Loot.h:228
Optional< ObjectGuid > Master
Definition: LootPackets.h:198
Loot loot
Definition: Creature.h:206
ObjectGuid GetMasterLooterGuid() const
Definition: Group.cpp:2474
bool hasOverThresholdItem() const
Definition: Loot.cpp:432
ObjectGuid const & GetGUID() const
Definition: Object.h:154
Definition: LootPackets.h:189
ObjectGuid Owner
Definition: LootPackets.h:196
#define ASSERT
Definition: Errors.h:57
void BroadcastPacket(WorldPacket const *packet, bool ignorePlayersInBGRaid, int group=-1, ObjectGuid ignoredPlayer=ObjectGuid::Empty)
Definition: Group.cpp:1575
Optional< ObjectGuid > RoundRobinWinner
Definition: LootPackets.h:199
Definition: Loot.h:73
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendLootRoll()

void Group::SendLootRoll ( ObjectGuid  playerGuid,
int32  rollNumber,
uint8  rollType,
Roll const &  roll 
) const
876 {
878  lootRoll.LootObj = roll->GetGUID();
879  lootRoll.Player = playerGuid;
880  lootRoll.Roll = rollNumber;
881  lootRoll.RollType = rollType;
882  roll.FillPacket(lootRoll.Item);
883  lootRoll.Write();
884 
885  for (Roll::PlayerVote::const_iterator itr = roll.playerVote.begin(); itr != roll.playerVote.end(); ++itr)
886  {
888  if (!p || !p->GetSession())
889  continue;
890 
891  if (itr->second != NOT_VALID)
892  p->SendDirectMessage(lootRoll.GetRawPacket());
893  }
894 }
WorldSession * GetSession() const
Definition: Player.h:1990
uint8 RollType
Definition: LootPackets.h:237
WorldPacket const * GetRawPacket() const
Definition: Packet.h:38
ObjectGuid LootObj
Definition: LootPackets.h:234
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:6123
WorldPacket const * Write() override
Definition: LootPackets.cpp:177
Definition: Group.h:67
int32 Roll
Roll value can be negative, it means that it is an "offspec" roll but only during roll selection broa...
Definition: LootPackets.h:236
ObjectGuid Player
Definition: LootPackets.h:235
Definition: LootPackets.h:227
Definition: Player.h:1056
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:275
LootItemData Item
Definition: LootPackets.h:238
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendLootRollsComplete()

void Group::SendLootRollsComplete ( Roll const &  roll) const
937 {
938  WorldPackets::Loot::LootRollsComplete lootRollsComplete;
939  lootRollsComplete.LootObj = roll->GetGUID();
940  lootRollsComplete.LootListID = roll.itemSlot + 1;
941  lootRollsComplete.Write();
942 
943  for (Roll::PlayerVote::const_iterator itr = roll.playerVote.begin(); itr != roll.playerVote.end(); ++itr)
944  {
945  Player* player = ObjectAccessor::FindConnectedPlayer(itr->first);
946  if (!player || !player->GetSession())
947  continue;
948 
949  if (itr->second != NOT_VALID)
950  player->SendDirectMessage(lootRollsComplete.GetRawPacket());
951  }
952 }
WorldSession * GetSession() const
Definition: Player.h:1990
ObjectGuid LootObj
Definition: LootPackets.h:275
WorldPacket const * Write() override
Definition: LootPackets.cpp:211
WorldPacket const * GetRawPacket() const
Definition: Packet.h:38
uint8 LootListID
Definition: LootPackets.h:276
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:6123
Definition: LootPackets.h:268
Definition: Group.h:67
Definition: Player.h:1056
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:275
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendLootRollWon()

void Group::SendLootRollWon ( ObjectGuid  winnerGuid,
int32  rollNumber,
uint8  rollType,
Roll const &  roll 
) const
897 {
899  lootRollWon.LootObj = roll->GetGUID();
900  lootRollWon.Winner = winnerGuid;
901  lootRollWon.Roll = rollNumber;
902  lootRollWon.RollType = rollType;
903  roll.FillPacket(lootRollWon.Item);
904  lootRollWon.MainSpec = true; // offspec rolls not implemented
905  lootRollWon.Write();
906 
907  for (Roll::PlayerVote::const_iterator itr = roll.playerVote.begin(); itr != roll.playerVote.end(); ++itr)
908  {
910  if (!p || !p->GetSession())
911  continue;
912 
913  if (itr->second != NOT_VALID)
914  p->SendDirectMessage(lootRollWon.GetRawPacket());
915  }
916 }
WorldPacket const * Write() override
Definition: LootPackets.cpp:190
uint8 RollType
Definition: LootPackets.h:252
ObjectGuid LootObj
Definition: LootPackets.h:249
WorldSession * GetSession() const
Definition: Player.h:1990
WorldPacket const * GetRawPacket() const
Definition: Packet.h:38
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:6123
ObjectGuid Winner
Definition: LootPackets.h:250
LootItemData Item
Definition: LootPackets.h:253
bool MainSpec
Definition: LootPackets.h:254
Definition: Group.h:67
Definition: LootPackets.h:242
Definition: Player.h:1056
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:275
int32 Roll
Definition: LootPackets.h:251
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendLootStartRollToPlayer()

void Group::SendLootStartRollToPlayer ( uint32  countDown,
uint32  mapId,
Player p,
bool  canNeed,
Roll const &  r 
) const
857 {
858  WorldPackets::Loot::StartLootRoll startLootRoll;
859  startLootRoll.LootObj = r->GetGUID();
860  startLootRoll.MapID = mapId;
861  startLootRoll.RollTime = countDown;
862  startLootRoll.ValidRolls = r.rollVoteMask;
863  if (!canNeed)
864  startLootRoll.ValidRolls &= ~ROLL_FLAG_TYPE_NEED;
865  startLootRoll.Method = GetLootMethod();
866  r.FillPacket(startLootRoll.Item);
867 
868  if (ItemDisenchantLootEntry const* disenchant = r.GetItemDisenchantLoot(p))
869  if (m_maxEnchantingLevel >= disenchant->SkillRequired)
870  startLootRoll.ValidRolls |= ROLL_FLAG_TYPE_DISENCHANT;
871 
872  p->SendDirectMessage(startLootRoll.Write());
873 }
LootItemData Item
Definition: LootPackets.h:224
Definition: DB2Structure.h:1974
LootMethod GetLootMethod() const
Definition: Group.cpp:2462
Definition: Loot.h:59
uint8 Method
Definition: LootPackets.h:222
uint32 m_maxEnchantingLevel
Definition: Group.h:452
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:6123
uint32 RollTime
Definition: LootPackets.h:221
Definition: LootPackets.h:212
ObjectGuid LootObj
Definition: LootPackets.h:219
uint8 ValidRolls
Definition: LootPackets.h:223
int32 MapID
Definition: LootPackets.h:220
WorldPacket const * Write() override
Definition: LootPackets.cpp:165
Definition: Loot.h:57
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendRaidMarkersChanged()

void Group::SendRaidMarkersChanged ( WorldSession session = nullptr,
int8  partyIndex = 0 
)
2401 {
2403 
2404  packet.PartyIndex = partyIndex;
2405  packet.ActiveMarkers = m_activeMarkers;
2406 
2407  for (uint8 i = 0; i < RAID_MARKERS_COUNT; i++)
2408  if (m_markers[i])
2409  packet.RaidMarkers.push_back(m_markers[i].get());
2410 
2411  if (session)
2412  session->SendPacket(packet.Write());
2413  else
2414  BroadcastPacket(packet.Write(), false);
2415 }
uint32 m_activeMarkers
Definition: Group.h:461
std::vector< RaidMarker const * > RaidMarkers
Definition: PartyPackets.h:624
uint32 ActiveMarkers
Definition: PartyPackets.h:622
WorldPacket const * Write() override
Definition: PartyPackets.cpp:531
std::array< std::unique_ptr< RaidMarker >, RAID_MARKERS_COUNT > m_markers
Definition: Group.h:460
Definition: PartyPackets.h:614
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:208
#define RAID_MARKERS_COUNT
Definition: Group.h:56
uint8 PartyIndex
Definition: PartyPackets.h:621
uint8_t uint8
Definition: Define.h:154
void BroadcastPacket(WorldPacket const *packet, bool ignorePlayersInBGRaid, int group=-1, ObjectGuid ignoredPlayer=ObjectGuid::Empty)
Definition: Group.cpp:1575
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendTargetIconList()

void Group::SendTargetIconList ( WorldSession session,
int8  partyIndex = 0 
)
1418 {
1419  if (!session)
1420  return;
1421 
1423  updateAll.PartyIndex = partyIndex;
1424  for (uint8 i = 0; i < TARGET_ICONS_COUNT; i++)
1425  updateAll.TargetIcons.insert(std::pair<uint8, ObjectGuid>(i, m_targetIcons[i]));
1426 
1427  session->SendPacket(updateAll.Write());
1428 }
#define TARGET_ICONS_COUNT
Definition: Group.h:55
uint8 PartyIndex
Definition: PartyPackets.h:348
ObjectGuid m_targetIcons[TARGET_ICONS_COUNT]
Definition: Group.h:443
std::map< uint8, ObjectGuid > TargetIcons
Definition: PartyPackets.h:349
Definition: PartyPackets.h:341
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:208
WorldPacket const * Write() override
Definition: PartyPackets.cpp:323
uint8_t uint8
Definition: Define.h:154
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendUpdate()

void Group::SendUpdate ( )
1431 {
1432  for (member_witerator witr = m_memberSlots.begin(); witr != m_memberSlots.end(); ++witr)
1433  SendUpdateToPlayer(witr->guid, &(*witr));
1434 }
MemberSlotList::iterator member_witerator
Definition: Group.h:237
MemberSlotList m_memberSlots
Definition: Group.h:431
void SendUpdateToPlayer(ObjectGuid playerGUID, MemberSlot *slot=nullptr)
Definition: Group.cpp:1436
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendUpdateDestroyGroupToPlayer()

void Group::SendUpdateDestroyGroupToPlayer ( Player player) const
1533 {
1535  partyUpdate.PartyFlags = GROUP_FLAG_DESTROYED;
1536  partyUpdate.PartyIndex = m_groupCategory;
1537  partyUpdate.PartyType = GROUP_TYPE_NONE;
1538  partyUpdate.PartyGUID = m_guid;
1539  partyUpdate.MyIndex = -1;
1541  player->SendDirectMessage(partyUpdate.Write());
1542 }
Definition: Group.h:112
uint8 PartyType
Definition: PartyPackets.h:554
Definition: Group.h:100
int32 SequenceNum
Definition: PartyPackets.h:560
ObjectGuid m_guid
Definition: Group.h:451
WorldPacket const * Write() override
Definition: PartyPackets.cpp:476
uint16 PartyFlags
Definition: PartyPackets.h:552
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:6123
GroupCategory m_groupCategory
Definition: Group.h:437
int32 NextGroupUpdateSequenceNumber(GroupCategory category)
Definition: Player.cpp:25835
int32 MyIndex
Definition: PartyPackets.h:559
uint8 PartyIndex
Definition: PartyPackets.h:553
ObjectGuid PartyGUID
Definition: PartyPackets.h:556
Definition: PartyPackets.h:545
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendUpdateToPlayer()

void Group::SendUpdateToPlayer ( ObjectGuid  playerGUID,
MemberSlot slot = nullptr 
)
1437 {
1438  Player* player = ObjectAccessor::FindConnectedPlayer(playerGUID);
1439 
1440  if (!player || !player->GetSession() || player->GetGroup() != this)
1441  return;
1442 
1443  // if MemberSlot wasn't provided
1444  if (!slot)
1445  {
1446  member_witerator witr = _getMemberWSlot(playerGUID);
1447 
1448  if (witr == m_memberSlots.end()) // if there is no MemberSlot for such a player
1449  return;
1450 
1451  slot = &(*witr);
1452  }
1453 
1455 
1456  partyUpdate.PartyFlags = m_groupFlags;
1457  partyUpdate.PartyIndex = m_groupCategory;
1459 
1460  partyUpdate.PartyGUID = m_guid;
1461  partyUpdate.LeaderGUID = m_leaderGuid;
1462 
1464 
1465  partyUpdate.MyIndex = -1;
1466  uint8 index = 0;
1467  for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr, ++index)
1468  {
1469  if (slot->guid == citr->guid)
1470  partyUpdate.MyIndex = index;
1471 
1472  Player* member = ObjectAccessor::FindConnectedPlayer(citr->guid);
1473 
1475 
1476  playerInfos.GUID = citr->guid;
1477  playerInfos.Name = citr->name;
1478  playerInfos.Class = citr->_class;
1479 
1480  playerInfos.Status = MEMBER_STATUS_OFFLINE;
1481  if (member && member->GetSession() && !member->GetSession()->PlayerLogout())
1482  playerInfos.Status = MEMBER_STATUS_ONLINE | (isBGGroup() || isBFGroup() ? MEMBER_STATUS_PVP : 0);
1483 
1484  playerInfos.Subgroup = citr->group; // groupid
1485  playerInfos.Flags = citr->flags; // See enum GroupMemberFlags
1486  playerInfos.RolesAssigned = citr->roles; // Lfg Roles
1487 
1488  partyUpdate.PlayerList.push_back(playerInfos);
1489  }
1490 
1491  if (GetMembersCount() > 1)
1492  {
1493  // LootSettings
1494  partyUpdate.LootSettings = boost::in_place();
1495  partyUpdate.LootSettings->Method = m_lootMethod;
1496  partyUpdate.LootSettings->Threshold = m_lootThreshold;
1498 
1499  // Difficulty Settings
1500  partyUpdate.DifficultySettings = boost::in_place();
1501  partyUpdate.DifficultySettings->DungeonDifficultyID = m_dungeonDifficulty;
1502  partyUpdate.DifficultySettings->RaidDifficultyID = m_raidDifficulty;
1503  partyUpdate.DifficultySettings->LegacyRaidDifficultyID = m_legacyRaidDifficulty;
1504  }
1505 
1506  // LfgInfos
1507  if (isLFGGroup())
1508  {
1509  partyUpdate.LfgInfos = boost::in_place();
1510 
1511  partyUpdate.LfgInfos->Slot = sLFGMgr->GetLFGDungeonEntry(sLFGMgr->GetDungeon(m_guid));
1512  partyUpdate.LfgInfos->BootCount = 0;
1513  partyUpdate.LfgInfos->Aborted = false;
1514 
1515  partyUpdate.LfgInfos->MyFlags = sLFGMgr->GetState(m_guid) == lfg::LFG_STATE_FINISHED_DUNGEON ? 2 : 0;
1516  partyUpdate.LfgInfos->MyRandomSlot = sLFGMgr->GetSelectedRandomDungeon(player->GetGUID());
1517 
1518  partyUpdate.LfgInfos->MyPartialClear = 0;
1519  partyUpdate.LfgInfos->MyGearDiff = 0.0f;
1520  partyUpdate.LfgInfos->MyFirstReward = false;
1521  if (lfg::LfgReward const* reward = sLFGMgr->GetRandomDungeonReward(partyUpdate.LfgInfos->MyRandomSlot, player->getLevel()))
1522  if (Quest const* quest = sObjectMgr->GetQuestTemplate(reward->firstQuest))
1523  partyUpdate.LfgInfos->MyFirstReward = player->CanRewardQuest(quest, false);
1524 
1525  partyUpdate.LfgInfos->MyStrangerCount = 0;
1526  partyUpdate.LfgInfos->MyKickVoteCount = 0;
1527  }
1528 
1529  player->SendDirectMessage(partyUpdate.Write());
1530 }
uint8 Class
Definition: PartyPackets.h:508
bool PlayerLogout() const
Definition: WorldSession.h:947
Group * GetGroup()
Definition: Player.h:2450
bool isLFGGroup() const
Definition: Group.cpp:2422
Definition: Group.h:72
static ObjectGuid const Empty
Definition: ObjectGuid.h:255
MemberSlotList::iterator member_witerator
Definition: Group.h:237
MemberSlotList::const_iterator member_citerator
Definition: Group.h:233
uint8 Subgroup
Definition: PartyPackets.h:510
Definition: QuestDef.h:447
Difficulty m_dungeonDifficulty
Definition: Group.h:438
Optional< PartyLootSettings > LootSettings
Definition: PartyPackets.h:565
uint8 getLevel() const
Definition: Unit.h:843
WorldSession * GetSession() const
Definition: Player.h:1990
uint8 PartyType
Definition: PartyPackets.h:554
Definition: PartyPackets.h:503
ObjectGuid GUID
Definition: PartyPackets.h:505
Definition: Group.h:100
LootMethod m_lootMethod
Definition: Group.h:444
Optional< PartyDifficultySettings > DifficultySettings
Definition: PartyPackets.h:566
int32 SequenceNum
Definition: PartyPackets.h:560
ObjectGuid m_guid
Definition: Group.h:451
#define sObjectMgr
Definition: ObjectMgr.h:1847
uint8 Status
Definition: PartyPackets.h:509
WorldPacket const * Write() override
Definition: PartyPackets.cpp:476
MemberSlotList m_memberSlots
Definition: Group.h:431
ObjectGuid const & GetGUID() const
Definition: Object.h:154
uint8 Flags
Definition: PartyPackets.h:511
std::string Name
Definition: PartyPackets.h:506
uint16 PartyFlags
Definition: PartyPackets.h:552
GroupFlags m_groupFlags
Definition: Group.h:436
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:6123
#define sLFGMgr
Definition: LFGMgr.h:496
member_witerator _getMemberWSlot(ObjectGuid Guid)
Definition: Group.cpp:2649
ObjectGuid m_leaderGuid
Definition: Group.h:434
uint8 RolesAssigned
Definition: PartyPackets.h:512
GroupCategory m_groupCategory
Definition: Group.h:437
Optional< PartyLFGInfo > LfgInfos
Definition: PartyPackets.h:564
int32 NextGroupUpdateSequenceNumber(GroupCategory category)
Definition: Player.cpp:25835
Definition: Group.h:101
ObjectGuid m_masterLooterGuid
Definition: Group.h:447
int32 MyIndex
Definition: PartyPackets.h:559
bool isBGGroup() const
Definition: Group.cpp:2432
uint8 PartyIndex
Definition: PartyPackets.h:553
bool isBFGroup() const
Definition: Group.cpp:2437
Reward info.
Definition: LFGMgr.h:231
std::vector< PartyPlayerInfo > PlayerList
Definition: PartyPackets.h:562
bool CanRewardQuest(Quest const *quest, bool msg) const
Definition: Player.cpp:15154
ObjectGuid LeaderGUID
Definition: PartyPackets.h:557
ItemQualities m_lootThreshold
Definition: Group.h:445
uint8_t uint8
Definition: Define.h:154
uint32 GetMembersCount() const
Definition: Group.h:330
ObjectGuid PartyGUID
Definition: PartyPackets.h:556
Difficulty m_legacyRaidDifficulty
Definition: Group.h:440
bool IsCreated() const
Definition: Group.cpp:2442
Definition: PartyPackets.h:545
Definition: Player.h:1056
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:275
Difficulty m_raidDifficulty
Definition: Group.h:439
Definition: Group.h:74
Definition: Group.h:73
Definition: Loot.h:73
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetBattlefieldGroup()

void Group::SetBattlefieldGroup ( Battlefield bf)
2545 {
2546  m_bfGroup = bg;
2547 }
Battlefield * m_bfGroup
Definition: Group.h:442
+ Here is the caller graph for this function:

◆ SetBattlegroundGroup()

void Group::SetBattlegroundGroup ( Battleground bg)
2540 {
2541  m_bgGroup = bg;
2542 }
Battleground * m_bgGroup
Definition: Group.h:441
+ Here is the caller graph for this function:

◆ SetDungeonDifficultyID()

void Group::SetDungeonDifficultyID ( Difficulty  difficulty)
1918 {
1919  m_dungeonDifficulty = difficulty;
1920  if (!isBGGroup() && !isBFGroup())
1921  {
1923 
1924  stmt->setUInt8(0, uint8(m_dungeonDifficulty));
1925  stmt->setUInt32(1, m_dbStoreId);
1926 
1927  CharacterDatabase.Execute(stmt);
1928  }
1929 
1930  for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
1931  {
1932  Player* player = itr->GetSource();
1933  if (!player->GetSession())
1934  continue;
1935 
1936  player->SetDungeonDifficultyID(difficulty);
1937  player->SendDungeonDifficulty();
1938  }
1939 }
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
uint32 m_dbStoreId
Definition: Group.h:453
Difficulty m_dungeonDifficulty
Definition: Group.h:438
WorldSession * GetSession() const
Definition: Player.h:1990
Definition: CharacterDatabase.h:394
void SetDungeonDifficultyID(Difficulty dungeon_difficulty)
Definition: Player.h:1905
void SendDungeonDifficulty(int32 forcedDifficulty=-1) const
Definition: Player.cpp:21595
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:100
Definition: DatabaseEnvFwd.h:40
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:116
GroupReference * GetFirstMember()
Definition: Group.h:328
GroupReference * next()
Definition: GroupReference.h:36
bool isBGGroup() const
Definition: Group.cpp:2432
bool isBFGroup() const
Definition: Group.cpp:2437
uint8_t uint8
Definition: Define.h:154
Definition: Player.h:1056
Definition: GroupReference.h:26
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetEveryoneIsAssistant()

void Group::SetEveryoneIsAssistant ( bool  apply)
2685 {
2686  if (apply)
2688  else
2690 
2691  for (member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
2693 
2694  SendUpdate();
2695 }
Definition: Group.h:87
MemberSlotList::iterator member_witerator
Definition: Group.h:237
Definition: Group.h:114
void ToggleGroupMemberFlag(member_witerator slot, uint8 flag, bool apply)
Definition: Group.cpp:2676
R apply(R(*func)(Ts...), apply_tuple_type< Ts... > &&args)
Definition: advstd.h:37
MemberSlotList m_memberSlots
Definition: Group.h:431
GroupFlags m_groupFlags
Definition: Group.h:436
GroupFlags
Definition: Group.h:105
void SendUpdate()
Definition: Group.cpp:1430
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetGroupMemberFlag()

void Group::SetGroupMemberFlag ( ObjectGuid  guid,
bool  apply,
GroupMemberFlags  flag 
)
2550 {
2551  // Assistants, main assistants and main tanks are only available in raid groups
2552  if (!isRaidGroup())
2553  return;
2554 
2555  // Check if player is really in the raid
2556  member_witerator slot = _getMemberWSlot(guid);
2557  if (slot == m_memberSlots.end())
2558  return;
2559 
2560  // Do flag specific actions, e.g ensure uniqueness
2561  switch (flag)
2562  {
2564  RemoveUniqueGroupMemberFlag(MEMBER_FLAG_MAINASSIST); // Remove main assist flag from current if any.
2565  break;
2566  case MEMBER_FLAG_MAINTANK:
2567  RemoveUniqueGroupMemberFlag(MEMBER_FLAG_MAINTANK); // Remove main tank flag from current if any.
2568  break;
2569  case MEMBER_FLAG_ASSISTANT:
2570  break;
2571  default:
2572  return; // This should never happen
2573  }
2574 
2575  // Switch the actual flag
2576  ToggleGroupMemberFlag(slot, flag, apply);
2577 
2578  // Preserve the new setting in the db
2580 
2581  stmt->setUInt8(0, slot->flags);
2582  stmt->setUInt64(1, guid.GetCounter());
2583 
2584  CharacterDatabase.Execute(stmt);
2585 
2586  // Broadcast the changes to the group
2587  SendUpdate();
2588 }
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: Group.h:87
MemberSlotList::iterator member_witerator
Definition: Group.h:237
LowType GetCounter() const
Definition: ObjectGuid.h:273
Definition: CharacterDatabase.h:393
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:100
Definition: DatabaseEnvFwd.h:40
void ToggleGroupMemberFlag(member_witerator slot, uint8 flag, bool apply)
Definition: Group.cpp:2676
void RemoveUniqueGroupMemberFlag(GroupMemberFlags flag)
Definition: Group.cpp:2669
R apply(R(*func)(Ts...), apply_tuple_type< Ts... > &&args)
Definition: advstd.h:37
MemberSlotList m_memberSlots
Definition: Group.h:431
Definition: Group.h:88
member_witerator _getMemberWSlot(ObjectGuid Guid)
Definition: Group.cpp:2649
bool isRaidGroup() const
Definition: Group.cpp:2427
Definition: Group.h:89
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
void SendUpdate()
Definition: Group.cpp:1430
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetLegacyRaidDifficultyID()

void Group::SetLegacyRaidDifficultyID ( Difficulty  difficulty)
1966 {
1967  m_legacyRaidDifficulty = difficulty;
1968  if (!isBGGroup() && !isBFGroup())
1969  {
1971 
1973  stmt->setUInt32(1, m_dbStoreId);
1974 
1975  CharacterDatabase.Execute(stmt);
1976  }
1977 
1978  for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
1979  {
1980  Player* player = itr->GetSource();
1981  if (!player->GetSession())
1982  continue;
1983 
1984  player->SetLegacyRaidDifficultyID(difficulty);
1985  player->SendRaidDifficulty(true);
1986  }
1987 }
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
uint32 m_dbStoreId
Definition: Group.h:453
Definition: CharacterDatabase.h:396
WorldSession * GetSession() const
Definition: Player.h:1990
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:100
Definition: DatabaseEnvFwd.h:40
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:116
GroupReference * GetFirstMember()
Definition: Group.h:328
GroupReference * next()
Definition: GroupReference.h:36
bool isBGGroup() const
Definition: Group.cpp:2432
bool isBFGroup() const
Definition: Group.cpp:2437
void SetLegacyRaidDifficultyID(Difficulty raid_difficulty)
Definition: Player.h:1907
void SendRaidDifficulty(bool legacy, int32 forcedDifficulty=-1) const
Definition: Player.cpp:21602
uint8_t uint8
Definition: Define.h:154
Difficulty m_legacyRaidDifficulty
Definition: Group.h:440
Definition: Player.h:1056