TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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
< 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, const RemoveMethod &method=GROUP_REMOVEMETHOD_DEFAULT, ObjectGuid kicker=ObjectGuid::Empty, const char *reason=NULL)
 
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, uint32 duration=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
 
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)
 
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 constGetMemberSlots () const
 
GroupReferenceGetFirstMember ()
 
GroupReference constGetFirstMember () const
 
uint32 GetMembersCount () const
 
GroupType GetGroupType () 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=NULL)
 
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 SendLootStartRoll (uint32 CountDown, uint32 mapid, const Roll &r)
 
void SendLootStartRollToPlayer (uint32 countDown, uint32 mapId, Player *p, bool canNeed, Roll const &r)
 
void SendLootRoll (ObjectGuid SourceGuid, ObjectGuid TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r)
 
void SendLootRollWon (ObjectGuid SourceGuid, ObjectGuid TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r)
 
void SendLootAllPassed (Roll const &roll)
 
void SendLooter (Creature *creature, Player *pLooter)
 
void GroupLoot (Loot *loot, WorldObject *pLootedObject)
 
void NeedBeforeGreed (Loot *loot, WorldObject *pLootedObject)
 
void MasterLoot (Loot *loot, WorldObject *pLootedObject)
 
Rolls::iterator GetRoll (ObjectGuid Guid)
 
void CountTheRoll (Rolls::iterator roll)
 
void CountRollVote (ObjectGuid playerGUID, ObjectGuid Guid, uint8 Choise)
 
void EndRoll (Loot *loot)
 
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)
 
BoundInstancesMapGetBoundInstances (Difficulty difficulty)
 
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
 
GroupType m_groupType
 
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 [MAX_DIFFICULTY]
 
uint8m_subGroupsCounts
 
ObjectGuid m_guid
 
uint32 m_counter
 
uint32 m_maxEnchantingLevel
 
uint32 m_dbStoreId
 
bool m_readyCheckStarted
 
int32 m_readyCheckTimer
 
std::array< std::unique_ptr
< RaidMarker >
, RAID_MARKERS_COUNT
m_markers
 
uint32 m_activeMarkers
 

Detailed Description

request member stats checken

Todo:
uninvite people that not accepted invite

Member Typedef Documentation

typedef std::unordered_map< uint32 , InstanceGroupBind> Group::BoundInstancesMap
typedef std::set<Player*> Group::InvitesList
protected
typedef MemberSlotList::const_iterator Group::member_citerator
typedef MemberSlotList::iterator Group::member_witerator
protected
typedef std::list<MemberSlot> Group::MemberSlotList
typedef std::vector<Roll*> Group::Rolls
protected

Constructor & Destructor Documentation

Group::Group ( )
63 {
64  for (uint8 i = 0; i < TARGET_ICONS_COUNT; ++i)
65  m_targetIcons[i].Clear();
66 
67  for (uint8 i = 0; i < RAID_MARKERS_COUNT; ++i)
68  m_markers[i] = nullptr;
69 }
#define TARGET_ICONS_COUNT
Definition: Group.h:46
uint32 m_dbStoreId
Definition: Group.h:418
Definition: DBCEnums.h:407
Difficulty m_dungeonDifficulty
Definition: Group.h:402
uint32 m_activeMarkers
Definition: Group.h:426
uint32 m_counter
Definition: Group.h:416
uint8 * m_subGroupsCounts
Definition: Group.h:414
LootMethod m_lootMethod
Definition: Group.h:408
Definition: LootMgr.h:67
ObjectGuid m_guid
Definition: Group.h:415
bool m_readyCheckStarted
Definition: Group.h:421
Battlefield * m_bfGroup
Definition: Group.h:406
ObjectGuid m_targetIcons[TARGET_ICONS_COUNT]
Definition: Group.h:407
Battleground * m_bgGroup
Definition: Group.h:405
Definition: DBCEnums.h:416
int32 m_readyCheckTimer
Definition: Group.h:422
uint32 m_maxEnchantingLevel
Definition: Group.h:417
std::array< std::unique_ptr< RaidMarker >, RAID_MARKERS_COUNT > m_markers
Definition: Group.h:425
ObjectGuid m_leaderGuid
Definition: Group.h:399
ObjectGuid m_looterGuid
Definition: Group.h:410
Definition: SharedDefines.h:322
#define RAID_MARKERS_COUNT
Definition: Group.h:47
ObjectGuid m_masterLooterGuid
Definition: Group.h:411
Definition: Group.h:89
GroupType m_groupType
Definition: Group.h:401
ItemQualities m_lootThreshold
Definition: Group.h:409
uint8_t uint8
Definition: Define.h:152
Difficulty m_legacyRaidDifficulty
Definition: Group.h:404
std::string m_leaderName
Definition: Group.h:400
Difficulty m_raidDifficulty
Definition: Group.h:403
Definition: DBCEnums.h:405
Group::~Group ( )
72 {
73  if (m_bgGroup)
74  {
75  TC_LOG_DEBUG("bg.battleground", "Group::~Group: battleground group being deleted.");
77  else if (m_bgGroup->GetBgRaid(HORDE) == this) m_bgGroup->SetBgRaid(HORDE, NULL);
78  else TC_LOG_ERROR("misc", "Group::~Group: battleground group is not linked to the correct battleground.");
79  }
80  Rolls::iterator itr;
81  while (!RollId.empty())
82  {
83  itr = RollId.begin();
84  Roll *r = *itr;
85  RollId.erase(itr);
86  delete(r);
87  }
88 
89  // this may unload some instance saves
90  for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
91  for (BoundInstancesMap::iterator itr2 = m_boundInstances[i].begin(); itr2 != m_boundInstances[i].end(); ++itr2)
92  itr2->second.save->RemoveGroup(this);
93 
94  // Sub group counters clean up
95  delete[] m_subGroupsCounts;
96 }
Rolls RollId
Definition: Group.h:412
void SetBgRaid(uint32 TeamID, Group *bg_raid)
Definition: Battleground.cpp:1890
uint8 * m_subGroupsCounts
Definition: Group.h:414
Definition: DBCEnums.h:426
arena_t NULL
Definition: jemalloc_internal.h:624
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Definition: Group.h:144
Battleground * m_bgGroup
Definition: Group.h:405
Definition: SharedDefines.h:1000
BoundInstancesMap m_boundInstances[MAX_DIFFICULTY]
Definition: Group.h:413
Definition: SharedDefines.h:999
uint8_t uint8
Definition: Define.h:152
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Group * GetBgRaid(uint32 TeamID) const
Definition: Battleground.h:393

+ Here is the call graph for this function:

Member Function Documentation

Group::member_citerator Group::_getMemberCSlot ( ObjectGuid  Guid) const
protected
2718 {
2719  for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
2720  if (itr->guid == Guid)
2721  return itr;
2722  return m_memberSlots.end();
2723 }
MemberSlotList::const_iterator member_citerator
Definition: Group.h:205
MemberSlotList m_memberSlots
Definition: Group.h:396

+ Here is the caller graph for this function:

Group::member_witerator Group::_getMemberWSlot ( ObjectGuid  Guid)
protected
2726 {
2727  for (member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
2728  if (itr->guid == Guid)
2729  return itr;
2730  return m_memberSlots.end();
2731 }
MemberSlotList::iterator member_witerator
Definition: Group.h:209
MemberSlotList m_memberSlots
Definition: Group.h:396

+ Here is the caller graph for this function:

void Group::_homebindIfInstance ( Player player)
protected
2278 {
2279  if (player && !player->IsGameMaster() && sMapStore.LookupEntry(player->GetMapId())->IsDungeon())
2280  player->m_InstanceValid = false;
2281 }
DBCStorage< MapEntry > sMapStore(Mapfmt)

+ Here is the caller graph for this function:

void Group::_initRaidSubGroupsCounter ( )
protected
2706 {
2707  // Sub group counters initialization
2708  if (!m_subGroupsCounts)
2710 
2711  memset((void*)m_subGroupsCounts, 0, (MAX_RAID_SUBGROUPS)*sizeof(uint8));
2712 
2713  for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
2714  ++m_subGroupsCounts[itr->group];
2715 }
MemberSlotList::const_iterator member_citerator
Definition: Group.h:205
uint8 * m_subGroupsCounts
Definition: Group.h:414
MemberSlotList m_memberSlots
Definition: Group.h:396
#define MAX_RAID_SUBGROUPS
Definition: Group.h:44
uint8_t uint8
Definition: Define.h:152

+ Here is the caller graph for this function:

bool Group::_setMembersGroup ( ObjectGuid  guid,
uint8  group 
)
protected
1712 {
1713  member_witerator slot = _getMemberWSlot(guid);
1714  if (slot == m_memberSlots.end())
1715  return false;
1716 
1717  slot->group = group;
1718 
1719  SubGroupCounterIncrease(group);
1720 
1721  if (!isBGGroup() && !isBFGroup())
1722  {
1724 
1725  stmt->setUInt8(0, group);
1726  stmt->setUInt64(1, guid.GetCounter());
1727 
1728  CharacterDatabase.Execute(stmt);
1729  }
1730 
1731  return true;
1732 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
MemberSlotList::iterator member_witerator
Definition: Group.h:209
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
Definition: CharacterDatabase.h:335
Definition: PreparedStatement.h:74
MemberSlotList m_memberSlots
Definition: Group.h:396
member_witerator _getMemberWSlot(ObjectGuid Guid)
Definition: Group.cpp:2725
bool isBGGroup() const
Definition: Group.cpp:2514
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
bool isBFGroup() const
Definition: Group.cpp:2519
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
void SubGroupCounterIncrease(uint8 subgroup)
Definition: Group.cpp:2733
LowType GetCounter() const
Definition: ObjectGuid.h:221

+ Here is the call graph for this function:

bool Group::AddInvite ( Player player)
300 {
301  if (!player || player->GetGroupInvite())
302  return false;
303  Group* group = player->GetGroup();
304  if (group && (group->isBGGroup() || group->isBFGroup()))
305  group = player->GetOriginalGroup();
306  if (group)
307  return false;
308 
309  RemoveInvite(player);
310 
311  m_invitees.insert(player);
312 
313  player->SetGroupInvite(this);
314 
315  sScriptMgr->OnGroupInviteMember(this, player->GetGUID());
316 
317  return true;
318 }
InvitesList m_invitees
Definition: Group.h:398
void RemoveInvite(Player *player)
Definition: Group.cpp:330
bool isBGGroup() const
Definition: Group.cpp:2514
bool isBFGroup() const
Definition: Group.cpp:2519
#define sScriptMgr
Definition: ScriptMgr.h:837
Definition: Group.h:191

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Group::AddLeaderInvite ( Player player)
321 {
322  if (!AddInvite(player))
323  return false;
324 
325  m_leaderGuid = player->GetGUID();
326  m_leaderName = player->GetName();
327  return true;
328 }
ObjectGuid m_leaderGuid
Definition: Group.h:399
bool AddInvite(Player *player)
Definition: Group.cpp:299
std::string m_leaderName
Definition: Group.h:400

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Group::AddMember ( Player player)
369 {
370  // Get first not-full group
371  uint8 subGroup = 0;
372  if (m_subGroupsCounts)
373  {
374  bool groupFound = false;
375  for (; subGroup < MAX_RAID_SUBGROUPS; ++subGroup)
376  {
377  if (m_subGroupsCounts[subGroup] < MAX_GROUP_SIZE)
378  {
379  groupFound = true;
380  break;
381  }
382  }
383  // We are raid group and no one slot is free
384  if (!groupFound)
385  return false;
386  }
387 
388  MemberSlot member;
389  member.guid = player->GetGUID();
390  member.name = player->GetName();
391  member._class = player->getClass();
392  member.group = subGroup;
393  member.flags = 0;
394  member.roles = 0;
395  member.readyChecked = false;
396  m_memberSlots.push_back(member);
397 
398  SubGroupCounterIncrease(subGroup);
399 
400  player->SetGroupInvite(NULL);
401  if (player->GetGroup())
402  {
403  if (isBGGroup() || isBFGroup()) // if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid()
404  player->SetBattlegroundOrBattlefieldRaid(this, subGroup);
405  else //if player is in bg raid and we are adding him to normal group, then call SetOriginalGroup()
406  player->SetOriginalGroup(this, subGroup);
407  }
408  else //if player is not in group, then call set group
409  player->SetGroup(this, subGroup);
410 
411  // if the same group invites the player back, cancel the homebind timer
412  player->m_InstanceValid = player->CheckInstanceValidity(false);
413 
414  if (!isRaidGroup()) // reset targetIcons for non-raid-groups
415  {
416  for (uint8 i = 0; i < TARGET_ICONS_COUNT; ++i)
417  m_targetIcons[i].Clear();
418  }
419 
420  // insert into the table if we're not a battleground group
421  if (!isBGGroup() && !isBFGroup())
422  {
424 
425  stmt->setUInt32(0, m_dbStoreId);
426  stmt->setUInt64(1, member.guid.GetCounter());
427  stmt->setUInt8(2, member.flags);
428  stmt->setUInt8(3, member.group);
429  stmt->setUInt8(4, member.roles);
430 
432  }
433 
434  SendUpdate();
435  sScriptMgr->OnGroupAddMember(this, player->GetGUID());
436 
437  if (!IsLeader(player->GetGUID()) && !isBGGroup() && !isBFGroup())
438  {
439  // reset the new member's instances, unless he is currently in one of them
440  // including raid/heroic instances that they are not permanently bound to!
441  player->ResetInstances(INSTANCE_RESET_GROUP_JOIN, false, false);
442  player->ResetInstances(INSTANCE_RESET_GROUP_JOIN, true, false);
443  player->ResetInstances(INSTANCE_RESET_GROUP_JOIN, true, true);
444 
445  if (player->getLevel() >= LEVELREQUIREMENT_HEROIC)
446  {
447  if (player->GetDungeonDifficultyID() != GetDungeonDifficultyID())
448  {
449  player->SetDungeonDifficultyID(GetDungeonDifficultyID());
450  player->SendDungeonDifficulty();
451  }
452  if (player->GetRaidDifficultyID() != GetRaidDifficultyID())
453  {
454  player->SetRaidDifficultyID(GetRaidDifficultyID());
455  player->SendRaidDifficulty(false);
456  }
457  if (player->GetLegacyRaidDifficultyID() != GetLegacyRaidDifficultyID())
458  {
459  player->SetLegacyRaidDifficultyID(GetLegacyRaidDifficultyID());
460  player->SendRaidDifficulty(true);
461  }
462  }
463  }
464 
465  player->SetGroupUpdateFlag(GROUP_UPDATE_FULL);
466  if (Pet* pet = player->GetPet())
467  pet->SetGroupUpdateFlag(GROUP_UPDATE_PET_FULL);
468 
469  UpdatePlayerOutOfRange(player);
470 
471  // quest related GO state dependent from raid membership
472  if (isRaidGroup())
473  player->UpdateForQuestWorldObjects();
474 
475  {
476  // Broadcast new player group member fields to rest of the group
477  player->SetFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
478 
479  UpdateData groupData(player->GetMapId());
480  WorldPacket groupDataPacket;
481 
482  // Broadcast group members' fields to player
483  for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
484  {
485  if (itr->GetSource() == player)
486  continue;
487 
488  if (Player* existingMember = itr->GetSource())
489  {
490  if (player->HaveAtClient(existingMember))
491  {
492  existingMember->SetFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
493  existingMember->BuildValuesUpdateBlockForPlayer(&groupData, player);
494  existingMember->RemoveFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
495  }
496 
497  if (existingMember->HaveAtClient(player))
498  {
499  UpdateData newData(player->GetMapId());
500  WorldPacket newDataPacket;
501  player->BuildValuesUpdateBlockForPlayer(&newData, existingMember);
502  if (newData.HasData())
503  {
504  newData.BuildPacket(&newDataPacket);
505  existingMember->SendDirectMessage(&newDataPacket);
506  }
507  }
508  }
509  }
510 
511  if (groupData.HasData())
512  {
513  groupData.BuildPacket(&groupDataPacket);
514  player->SendDirectMessage(&groupDataPacket);
515  }
516 
517  player->RemoveFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
518  }
519 
520  if (m_maxEnchantingLevel < player->GetSkillValue(SKILL_ENCHANTING))
521  m_maxEnchantingLevel = player->GetSkillValue(SKILL_ENCHANTING);
522 
523  return true;
524 }
#define TARGET_ICONS_COUNT
Definition: Group.h:46
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
Definition: UpdateFieldFlags.h:32
uint32 m_dbStoreId
Definition: Group.h:418
bool isRaidGroup() const
Definition: Group.cpp:2509
Definition: SharedDefines.h:3973
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
uint8 * m_subGroupsCounts
Definition: Group.h:414
Definition: Map.h:754
Definition: Map.h:231
arena_t NULL
Definition: jemalloc_internal.h:624
void UpdatePlayerOutOfRange(Player *player)
Definition: Group.cpp:1666
ObjectGuid m_targetIcons[TARGET_ICONS_COUNT]
Definition: Group.h:407
Definition: PreparedStatement.h:74
Definition: UpdateData.h:59
Difficulty GetLegacyRaidDifficultyID() const
Definition: Group.h:322
Definition: CharacterDatabase.h:330
MemberSlotList m_memberSlots
Definition: Group.h:396
Definition: Group.h:140
#define MAX_GROUP_SIZE
Definition: Group.h:42
uint32 m_maxEnchantingLevel
Definition: Group.h:417
bool isBGGroup() const
Definition: Group.cpp:2514
bool IsLeader(ObjectGuid guid) const
Definition: Group.cpp:2571
GroupReference * GetFirstMember()
Definition: Group.h:295
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
Difficulty GetRaidDifficultyID() const
Definition: Group.h:321
Difficulty GetDungeonDifficultyID() const
Definition: Group.h:320
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
#define MAX_RAID_SUBGROUPS
Definition: Group.h:44
bool isBFGroup() const
Definition: Group.cpp:2519
Definition: Group.h:122
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
uint8_t uint8
Definition: Define.h:152
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define sScriptMgr
Definition: ScriptMgr.h:837
void SubGroupCounterIncrease(uint8 subgroup)
Definition: Group.cpp:2733
Definition: WorldPacket.h:26
void SendUpdate()
Definition: Group.cpp:1567
Definition: Pet.h:46
Definition: GroupReference.h:27

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::AddRaidMarker ( uint8  markerId,
uint32  mapId,
float  positionX,
float  positionY,
float  positionZ,
ObjectGuid  transportGuid = ObjectGuid::Empty 
)
2458 {
2459  if (markerId >= RAID_MARKERS_COUNT || m_markers[markerId])
2460  return;
2461 
2462  m_activeMarkers |= (1 << markerId);
2463  m_markers[markerId] = Trinity::make_unique<RaidMarker>(mapId, positionX, positionY, positionZ, transportGuid);
2465 }
uint32 m_activeMarkers
Definition: Group.h:426
std::array< std::unique_ptr< RaidMarker >, RAID_MARKERS_COUNT > m_markers
Definition: Group.h:425
void SendRaidMarkersChanged(WorldSession *session=nullptr, int8 partyIndex=0)
Definition: Group.cpp:2482
#define RAID_MARKERS_COUNT
Definition: Group.h:47

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

InstanceGroupBind * Group::BindToInstance ( InstanceSave save,
bool  permanent,
bool  load = false 
)
2225 {
2226  if (!save || isBGGroup() || isBFGroup())
2227  return NULL;
2228 
2229  InstanceGroupBind& bind = m_boundInstances[save->GetDifficultyID()][save->GetMapId()];
2230  if (!load && (!bind.save || permanent != bind.perm || save != bind.save))
2231  {
2233 
2234  stmt->setUInt32(0, m_dbStoreId);
2235  stmt->setUInt32(1, save->GetInstanceId());
2236  stmt->setBool(2, permanent);
2237 
2238  CharacterDatabase.Execute(stmt);
2239  }
2240 
2241  if (bind.save != save)
2242  {
2243  if (bind.save)
2244  bind.save->RemoveGroup(this);
2245  save->AddGroup(this);
2246  }
2247 
2248  bind.save = save;
2249  bind.perm = permanent;
2250  if (!load)
2251  TC_LOG_DEBUG("maps", "Group::BindToInstance: %s, storage id: %u is now bound to map %d, instance %d, difficulty %d",
2252  GetGUID().ToString().c_str(), m_dbStoreId, save->GetMapId(), save->GetInstanceId(), save->GetDifficultyID());
2253 
2254  return &bind;
2255 }
InstanceSave * save
Definition: Group.h:170
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
uint32 m_dbStoreId
Definition: Group.h:418
ObjectGuid GetGUID() const
Definition: Group.cpp:2534
Definition: Group.h:168
arena_t NULL
Definition: jemalloc_internal.h:624
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Definition: PreparedStatement.h:74
Definition: CharacterDatabase.h:353
void AddGroup(Group *group)
Definition: InstanceSaveMgr.h:103
void setBool(const uint8 index, const bool value)
Definition: PreparedStatement.cpp:88
BoundInstancesMap m_boundInstances[MAX_DIFFICULTY]
Definition: Group.h:413
string ToString(int i)
Definition: strutil.h:491
bool isBGGroup() const
Definition: Group.cpp:2514
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
uint32 GetMapId() const
Definition: InstanceSaveMgr.h:65
bool isBFGroup() const
Definition: Group.cpp:2519
Difficulty GetDifficultyID() const
Definition: InstanceSaveMgr.h:121
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
bool RemoveGroup(Group *group)
Definition: InstanceSaveMgr.h:104
uint32 GetInstanceId() const
Definition: InstanceSaveMgr.h:64
bool perm
Definition: Group.h:171

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::BroadcastAddonMessagePacket ( WorldPacket const packet,
const std::string &  prefix,
bool  ignorePlayersInBGRaid,
int  group = -1,
ObjectGuid  ignore = ObjectGuid::Empty 
)
1684 {
1685  for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
1686  {
1687  Player* player = itr->GetSource();
1688  if (!player || (!ignore.IsEmpty() && player->GetGUID() == ignore) || (ignorePlayersInBGRaid && player->GetGroup() != this))
1689  continue;
1690 
1691  if (WorldSession* session = player->GetSession())
1692  if (session && (group == -1 || itr->getSubGroup() == group))
1693  if (session->IsAddonRegistered(prefix))
1694  session->SendPacket(packet);
1695  }
1696 }
arena_t NULL
Definition: jemalloc_internal.h:624
GroupReference * GetFirstMember()
Definition: Group.h:295
Player session in the World.
Definition: WorldSession.h:882
bool IsEmpty() const
Definition: ObjectGuid.h:242
Definition: GroupReference.h:27

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::BroadcastGroupUpdate ( void  )
2284 {
2285  // FG: HACK: force flags update on group leave - for values update hack
2286  // -- not very efficient but safe
2287  for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
2288  {
2289  Player* pp = ObjectAccessor::FindPlayer(citr->guid);
2290  if (pp)
2291  {
2292  pp->ForceValuesUpdateAtIndex(UNIT_FIELD_BYTES_2);
2293  pp->ForceValuesUpdateAtIndex(UNIT_FIELD_FACTIONTEMPLATE);
2294  TC_LOG_DEBUG("misc", "-- Forced group value update for '%s'", pp->GetName().c_str());
2295  }
2296  }
2297 }
Definition: UpdateFields.h:146
MemberSlotList::const_iterator member_citerator
Definition: Group.h:205
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:209
MemberSlotList m_memberSlots
Definition: Group.h:396
Definition: UpdateFields.h:107

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::BroadcastPacket ( WorldPacket const packet,
bool  ignorePlayersInBGRaid,
int  group = -1,
ObjectGuid  ignoredPlayer = ObjectGuid::Empty 
)
1699 {
1700  for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
1701  {
1702  Player* player = itr->GetSource();
1703  if (!player || (!ignoredPlayer.IsEmpty() && player->GetGUID() == ignoredPlayer) || (ignorePlayersInBGRaid && player->GetGroup() != this))
1704  continue;
1705 
1706  if (player->GetSession() && (group == -1 || itr->getSubGroup() == group))
1707  player->GetSession()->SendPacket(packet);
1708  }
1709 }
arena_t NULL
Definition: jemalloc_internal.h:624
GroupReference * GetFirstMember()
Definition: Group.h:295
bool IsEmpty() const
Definition: ObjectGuid.h:242
Definition: GroupReference.h:27

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<class Worker >
void Group::BroadcastWorker ( Worker &  worker)
inline
334  {
335  for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
336  worker(itr->GetSource());
337  }
GroupReference * GetFirstMember()
Definition: Group.h:295
GroupReference * next()
Definition: GroupReference.h:37
Definition: GroupReference.h:27

+ Here is the call graph for this function:

template<class Worker >
void Group::BroadcastWorker ( Worker const worker) const
inline
341  {
342  for (GroupReference const* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
343  worker(itr->GetSource());
344  }
GroupReference * GetFirstMember()
Definition: Group.h:295
GroupReference * next()
Definition: GroupReference.h:37
Definition: GroupReference.h:27

+ Here is the call graph for this function:

GroupJoinBattlegroundResult Group::CanJoinBattlegroundQueue ( Battleground const bgOrTemplate,
BattlegroundQueueTypeId  bgQueueTypeId,
uint32  MinPlayerCount,
uint32  MaxPlayerCount,
bool  isRated,
uint32  arenaSlot,
ObjectGuid errorGuid 
)
1917 {
1918  // check if this group is LFG group
1919  if (isLFGGroup())
1921 
1922  BattlemasterListEntry const* bgEntry = sBattlemasterListStore.LookupEntry(bgOrTemplate->GetTypeID());
1923  if (!bgEntry)
1924  return ERR_BATTLEGROUND_JOIN_FAILED; // shouldn't happen
1925 
1926  // check for min / max count
1927  uint32 memberscount = GetMembersCount();
1928 
1929  if (memberscount > bgEntry->MaxGroupSize) // no MinPlayerCount for battlegrounds
1930  return ERR_BATTLEGROUND_NONE; // ERR_GROUP_JOIN_BATTLEGROUND_TOO_MANY handled on client side
1931 
1932  // get a player as reference, to compare other players' stats to (arena team id, queue id based on level, etc.)
1933  Player* reference = ASSERT_NOTNULL(GetFirstMember())->GetSource();
1934  // no reference found, can't join this way
1935  if (!reference)
1937 
1938  PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgOrTemplate->GetMapId(), reference->getLevel());
1939  if (!bracketEntry)
1941 
1942  uint32 arenaTeamId = reference->GetArenaTeamId(arenaSlot);
1943  uint32 team = reference->GetTeam();
1944 
1946 
1947  // check every member of the group to be able to join
1948  memberscount = 0;
1949  for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next(), ++memberscount)
1950  {
1951  Player* member = itr->GetSource();
1952  // offline member? don't let join
1953  if (!member)
1955  // don't allow cross-faction join as group
1956  if (member->GetTeam() != team)
1957  {
1958  errorGuid = member->GetGUID();
1960  }
1961  // not in the same battleground level braket, don't let join
1962  PvPDifficultyEntry const* memberBracketEntry = GetBattlegroundBracketByLevel(bracketEntry->MapID, member->getLevel());
1963  if (memberBracketEntry != bracketEntry)
1965  // don't let join rated matches if the arena team id doesn't match
1966  if (isRated && member->GetArenaTeamId(arenaSlot) != arenaTeamId)
1968  // don't let join if someone from the group is already in that bg queue
1969  if (member->InBattlegroundQueueForBattlegroundQueueType(bgQueueTypeId))
1970  return ERR_BATTLEGROUND_JOIN_FAILED; // not blizz-like
1971  // don't let join if someone from the group is in bg queue random
1972  if (member->InBattlegroundQueueForBattlegroundQueueType(bgQueueTypeIdRandom))
1973  return ERR_IN_RANDOM_BG;
1974  // don't let join to bg queue random if someone from the group is already in bg queue
1975  if (bgOrTemplate->GetTypeID() == BATTLEGROUND_RB && member->InBattlegroundQueue())
1976  return ERR_IN_NON_RANDOM_BG;
1977  // check for deserter debuff in case not arena queue
1978  if (bgOrTemplate->GetTypeID() != BATTLEGROUND_AA && !member->CanJoinToBattleground(bgOrTemplate))
1980  // check if member can join any more battleground queues
1981  if (!member->HasFreeBattlegroundQueueId())
1982  return ERR_BATTLEGROUND_TOO_MANY_QUEUES; // not blizz-like
1983  // check if someone in party is using dungeon system
1984  if (member->isUsingLfg())
1986  // check Freeze debuff
1987  if (member->HasAura(9454))
1989  }
1990 
1991  // only check for MinPlayerCount since MinPlayerCount == MaxPlayerCount for arenas...
1992  if (bgOrTemplate->isArena() && memberscount != MinPlayerCount)
1994 
1995  return ERR_BATTLEGROUND_NONE;
1996 }
uint32 MaxGroupSize
Definition: DBCStructure.h:121
Definition: SharedDefines.h:4755
T * ASSERT_NOTNULL(T *pointer)
Definition: Errors.h:58
Definition: SharedDefines.h:4752
Definition: SharedDefines.h:4566
Definition: SharedDefines.h:4767
Definition: SharedDefines.h:4753
DBCStorage< BattlemasterListEntry > sBattlemasterListStore(BattlemasterListfmt)
Definition: SharedDefines.h:4762
static BattlegroundQueueTypeId BGQueueTypeId(BattlegroundTypeId bgTypeId, uint8 arenaType)
Definition: BattlegroundMgr.cpp:623
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: SharedDefines.h:4777
Definition: SharedDefines.h:4766
Definition: SharedDefines.h:4761
PvPDifficultyEntry const * GetBattlegroundBracketByLevel(uint32 mapid, uint32 level)
Definition: DBCStores.cpp:760
uint32_t uint32
Definition: Define.h:150
GroupReference * GetFirstMember()
Definition: Group.h:295
bool isLFGGroup() const
Definition: Group.cpp:2504
Definition: SharedDefines.h:4765
BattlegroundQueueTypeId
Definition: SharedDefines.h:4732
Definition: DBCStructure.h:926
uint32 GetMembersCount() const
Definition: Group.h:297
Definition: SharedDefines.h:4573
Definition: DBCStructure.h:114
Definition: GroupReference.h:27
uint32 MapID
Definition: DBCStructure.h:929
Definition: SharedDefines.h:4754

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::ChangeLeader ( ObjectGuid  guid,
int8  partyIndex = 0 
)
652 {
653  member_witerator slot = _getMemberWSlot(newLeaderGuid);
654 
655  if (slot == m_memberSlots.end())
656  return;
657 
658  Player* newLeader = ObjectAccessor::FindConnectedPlayer(slot->guid);
659 
660  // Don't allow switching leader to offline players
661  if (!newLeader)
662  return;
663 
664  sScriptMgr->OnGroupChangeLeader(this, newLeaderGuid, m_leaderGuid);
665 
666  if (!isBGGroup() && !isBFGroup())
667  {
669 
670  // Remove the groups permanent instance bindings
671  for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
672  {
673  for (BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end();)
674  {
675  // Do not unbind saves of instances that already had map created (a newLeader entered)
676  // forcing a new instance with another leader requires group disbanding (confirmed on retail)
677  if (itr->second.perm && !sMapMgr->FindMap(itr->first, itr->second.save->GetInstanceId()))
678  {
680  stmt->setUInt32(0, m_dbStoreId);
681  stmt->setUInt32(1, itr->second.save->GetInstanceId());
682  trans->Append(stmt);
683 
684  itr->second.save->RemoveGroup(this);
685  m_boundInstances[i].erase(itr++);
686  }
687  else
688  ++itr;
689  }
690  }
691 
692  // Copy the permanent binds from the new leader to the group
693  Group::ConvertLeaderInstancesToGroup(newLeader, this, true);
694 
695  // Update the group leader
697 
698  stmt->setUInt64(0, newLeader->GetGUID().GetCounter());
699  stmt->setUInt32(1, m_dbStoreId);
700 
701  trans->Append(stmt);
702 
704  }
705 
707  oldLeader->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_GROUP_LEADER);
708 
709  newLeader->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GROUP_LEADER);
710  m_leaderGuid = newLeader->GetGUID();
711  m_leaderName = newLeader->GetName();
713 
715  groupNewLeader.Name = m_leaderName;
716  groupNewLeader.PartyIndex = partyIndex;
717  BroadcastPacket(groupNewLeader.Write(), true);
718 }
int8 PartyIndex
Definition: PartyPackets.h:480
Definition: Group.h:76
uint32 m_dbStoreId
Definition: Group.h:418
MemberSlotList::iterator member_witerator
Definition: Group.h:209
SQLTransaction BeginTransaction()
Begins an automanaged transaction pointer that will automatically rollback if not commited...
Definition: DatabaseWorkerPool.h:221
Definition: DBCEnums.h:426
Definition: PreparedStatement.h:74
void ToggleGroupMemberFlag(member_witerator slot, uint8 flag, bool apply)
Definition: Group.cpp:2752
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
Definition: PartyPackets.h:473
MemberSlotList m_memberSlots
Definition: Group.h:396
BoundInstancesMap m_boundInstances[MAX_DIFFICULTY]
Definition: Group.h:413
std::string Name
Definition: PartyPackets.h:481
Definition: CharacterDatabase.h:333
member_witerator _getMemberWSlot(ObjectGuid Guid)
Definition: Group.cpp:2725
ObjectGuid m_leaderGuid
Definition: Group.h:399
bool isBGGroup() const
Definition: Group.cpp:2514
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
Definition: Player.h:517
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
bool isBFGroup() const
Definition: Group.cpp:2519
#define sMapMgr
Definition: MapManager.h:194
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
uint8_t uint8
Definition: Define.h:152
static void ConvertLeaderInstancesToGroup(Player *player, Group *group, bool switchLeader)
convert the player's binds to the group
Definition: Group.cpp:721
void BroadcastPacket(WorldPacket const *packet, bool ignorePlayersInBGRaid, int group=-1, ObjectGuid ignoredPlayer=ObjectGuid::Empty)
Definition: Group.cpp:1698
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: UpdateFields.h:191
#define sScriptMgr
Definition: ScriptMgr.h:837
WorldPacket const * Write() override
Definition: PartyPackets.cpp:329
std::string m_leaderName
Definition: Group.h:400
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:215
Definition: CharacterDatabase.h:332
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::ChangeMembersGroup ( ObjectGuid  guid,
uint8  group 
)
1747 {
1748  // Only raid groups have sub groups
1749  if (!isRaidGroup())
1750  return;
1751 
1752  // Check if player is really in the raid
1753  member_witerator slot = _getMemberWSlot(guid);
1754  if (slot == m_memberSlots.end())
1755  return;
1756 
1757  uint8 prevSubGroup = slot->group;
1758  // Abort if the player is already in the target sub group
1759  if (prevSubGroup == group)
1760  return;
1761 
1762  // Update the player slot with the new sub group setting
1763  slot->group = group;
1764 
1765  // Increase the counter of the new sub group..
1766  SubGroupCounterIncrease(group);
1767 
1768  // ..and decrease the counter of the previous one
1769  SubGroupCounterDecrease(prevSubGroup);
1770 
1771  // Preserve new sub group in database for non-raid groups
1772  if (!isBGGroup() && !isBFGroup())
1773  {
1775 
1776  stmt->setUInt8(0, group);
1777  stmt->setUInt64(1, guid.GetCounter());
1778 
1779  CharacterDatabase.Execute(stmt);
1780  }
1781 
1782  // In case the moved player is online, update the player object with the new sub group references
1783  if (Player* player = ObjectAccessor::FindConnectedPlayer(guid))
1784  {
1785  if (player->GetGroup() == this)
1786  player->GetGroupRef().setSubGroup(group);
1787  else
1788  {
1789  // 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
1790  player->GetOriginalGroupRef().setSubGroup(group);
1791  }
1792  }
1793 
1794  // Broadcast the changes to the group
1795  SendUpdate();
1796 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
MemberSlotList::iterator member_witerator
Definition: Group.h:209
bool isRaidGroup() const
Definition: Group.cpp:2509
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
Definition: CharacterDatabase.h:335
Definition: PreparedStatement.h:74
MemberSlotList m_memberSlots
Definition: Group.h:396
member_witerator _getMemberWSlot(ObjectGuid Guid)
Definition: Group.cpp:2725
bool isBGGroup() const
Definition: Group.cpp:2514
void SubGroupCounterDecrease(uint8 subgroup)
Definition: Group.cpp:2739
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
bool isBFGroup() const
Definition: Group.cpp:2519
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
uint8_t uint8
Definition: Define.h:152
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
void SubGroupCounterIncrease(uint8 subgroup)
Definition: Group.cpp:2733
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:215
void SendUpdate()
Definition: Group.cpp:1567
LowType GetCounter() const
Definition: ObjectGuid.h:221

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

convert the player's binds to the group

722 {
723  // copy all binds to the group, when changing leader it's assumed the character
724  // will not have any solo binds
725  for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
726  {
727  for (Player::BoundInstancesMap::iterator itr = player->m_boundInstances[i].begin(); itr != player->m_boundInstances[i].end();)
728  {
729  if (!switchLeader || !group->GetBoundInstance(itr->second.save->GetDifficultyID(), itr->first))
730  if (itr->second.extendState) // not expired
731  group->BindToInstance(itr->second.save, itr->second.perm, false);
732 
733  // permanent binds are not removed
734  if (switchLeader && !itr->second.perm)
735  {
736  // increments itr in call
737  player->UnbindInstance(itr, Difficulty(i), false);
738  }
739  else
740  ++itr;
741  }
742  }
743 
744  /* 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 *
745  * (example: two-player group disbanded by disconnect where the player reconnects within 60 seconds and the group is reformed) */
746  if (Map* playerMap = player->GetMap())
747  if (!switchLeader && playerMap->IsNonRaidDungeon())
748  if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(playerMap->GetInstanceId()))
749  if (save->GetGroupCount() == 0 && save->GetPlayerCount() == 0)
750  {
751  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());
752  // if nobody is saved to this, then the save wasn't permanent
753  group->BindToInstance(save, false, false);
754  }
755 }
Difficulty
Definition: DBCEnums.h:402
InstanceGroupBind * BindToInstance(InstanceSave *save, bool permanent, bool load=false)
Definition: Group.cpp:2224
Definition: DBCEnums.h:426
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Definition: Map.h:259
Definition: InstanceSaveMgr.h:44
#define sInstanceSaveMgr
Definition: InstanceSaveMgr.h:243
uint8_t uint8
Definition: Define.h:152
InstanceGroupBind * GetBoundInstance(Player *player)
Definition: Group.cpp:2191

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::ConvertToGroup ( )
269 {
270  if (m_memberSlots.size() > 5)
271  return; // What message error should we send?
272 
274 
275  if (m_subGroupsCounts)
276  {
277  delete[] m_subGroupsCounts;
279  }
280 
281  if (!isBGGroup() && !isBFGroup())
282  {
284 
285  stmt->setUInt8(0, uint8(m_groupType));
286  stmt->setUInt32(1, m_dbStoreId);
287 
289  }
290 
291  SendUpdate();
292 
293  // update quest related GO states (quest activity dependent from raid membership)
294  for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
295  if (Player* player = ObjectAccessor::FindPlayer(citr->guid))
296  player->UpdateForQuestWorldObjects();
297 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
uint32 m_dbStoreId
Definition: Group.h:418
MemberSlotList::const_iterator member_citerator
Definition: Group.h:205
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
uint8 * m_subGroupsCounts
Definition: Group.h:414
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: CharacterDatabase.h:334
Definition: PreparedStatement.h:74
GroupType
Definition: Group.h:87
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:209
MemberSlotList m_memberSlots
Definition: Group.h:396
bool isBGGroup() const
Definition: Group.cpp:2514
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
Definition: Group.h:89
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
GroupType m_groupType
Definition: Group.h:401
uint8_t uint8
Definition: g3dmath.h:164
bool isBFGroup() const
Definition: Group.cpp:2519
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
void SendUpdate()
Definition: Group.cpp:1567

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::ConvertToLFG ( )
228 {
231  if (!isBGGroup() && !isBFGroup())
232  {
234 
235  stmt->setUInt8(0, uint8(m_groupType));
236  stmt->setUInt32(1, m_dbStoreId);
237 
239  }
240 
241  SendUpdate();
242 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
uint32 m_dbStoreId
Definition: Group.h:418
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
LootMethod m_lootMethod
Definition: Group.h:408
Definition: CharacterDatabase.h:334
Definition: LootMgr.h:71
Definition: PreparedStatement.h:74
Definition: Group.h:93
GroupType
Definition: Group.h:87
bool isBGGroup() const
Definition: Group.cpp:2514
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
GroupType m_groupType
Definition: Group.h:401
uint8_t uint8
Definition: g3dmath.h:164
bool isBFGroup() const
Definition: Group.cpp:2519
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: Group.h:94
void SendUpdate()
Definition: Group.cpp:1567

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::ConvertToRaid ( )
245 {
247 
249 
250  if (!isBGGroup() && !isBFGroup())
251  {
253 
254  stmt->setUInt8(0, uint8(m_groupType));
255  stmt->setUInt32(1, m_dbStoreId);
256 
258  }
259 
260  SendUpdate();
261 
262  // update quest related GO states (quest activity dependent from raid membership)
263  for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
264  if (Player* player = ObjectAccessor::FindPlayer(citr->guid))
265  player->UpdateForQuestWorldObjects();
266 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
uint32 m_dbStoreId
Definition: Group.h:418
void _initRaidSubGroupsCounter()
Definition: Group.cpp:2705
MemberSlotList::const_iterator member_citerator
Definition: Group.h:205
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
Definition: CharacterDatabase.h:334
Definition: PreparedStatement.h:74
GroupType
Definition: Group.h:87
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:209
MemberSlotList m_memberSlots
Definition: Group.h:396
Definition: Group.h:91
bool isBGGroup() const
Definition: Group.cpp:2514
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
GroupType m_groupType
Definition: Group.h:401
uint8_t uint8
Definition: g3dmath.h:164
bool isBFGroup() const
Definition: Group.cpp:2519
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
void SendUpdate()
Definition: Group.cpp:1567

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::CountRollVote ( ObjectGuid  playerGUID,
ObjectGuid  Guid,
uint8  Choise 
)
1326 {
1327  Rolls::iterator rollI = GetRoll(Guid);
1328  if (rollI == RollId.end())
1329  return;
1330  Roll* roll = *rollI;
1331 
1332  Roll::PlayerVote::iterator itr = roll->playerVote.find(playerGUID);
1333  // this condition means that player joins to the party after roll begins
1334  if (itr == roll->playerVote.end())
1335  return;
1336 
1337  if (roll->getLoot())
1338  if (roll->getLoot()->items.empty())
1339  return;
1340 
1341  switch (Choice)
1342  {
1343  case ROLL_PASS: // Player choose pass
1344  SendLootRoll(ObjectGuid::Empty, playerGUID, 128, ROLL_PASS, *roll);
1345  ++roll->totalPass;
1346  itr->second = PASS;
1347  break;
1348  case ROLL_NEED: // player choose Need
1349  SendLootRoll(ObjectGuid::Empty, playerGUID, 0, 0, *roll);
1350  ++roll->totalNeed;
1351  itr->second = NEED;
1352  break;
1353  case ROLL_GREED: // player choose Greed
1354  SendLootRoll(ObjectGuid::Empty, playerGUID, 128, ROLL_GREED, *roll);
1355  ++roll->totalGreed;
1356  itr->second = GREED;
1357  break;
1358  case ROLL_DISENCHANT: // player choose Disenchant
1359  SendLootRoll(ObjectGuid::Empty, playerGUID, 128, ROLL_DISENCHANT, *roll);
1360  ++roll->totalGreed;
1361  itr->second = DISENCHANT;
1362  break;
1363  }
1364 
1365  if (roll->totalPass + roll->totalNeed + roll->totalGreed >= roll->totalPlayersRolling)
1366  CountTheRoll(rollI);
1367 }
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
Rolls RollId
Definition: Group.h:412
uint8 totalPlayersRolling
Definition: Group.h:160
Loot * getLoot()
Definition: Group.cpp:53
PlayerVote playerVote
Definition: Group.h:159
Definition: Group.h:53
Rolls::iterator GetRoll(ObjectGuid Guid)
Definition: Group.cpp:2671
void SendLootRoll(ObjectGuid SourceGuid, ObjectGuid TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r)
Definition: Group.cpp:896
Definition: Group.h:144
uint8 totalNeed
Definition: Group.h:161
Definition: Group.h:54
Definition: Group.h:56
Definition: LootMgr.h:42
void CountTheRoll(Rolls::iterator roll)
Definition: Group.cpp:1383
Definition: Group.h:55
std::vector< LootItem > items
Definition: LootMgr.h:320
Definition: LootMgr.h:43
Definition: LootMgr.h:44
uint8 totalPass
Definition: Group.h:163
Definition: LootMgr.h:45
uint8 totalGreed
Definition: Group.h:162

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::CountTheRoll ( Rolls::iterator  roll)
1384 {
1385  Roll* roll = *rollI;
1386  if (!roll->isValid()) // is loot already deleted ?
1387  {
1388  RollId.erase(rollI);
1389  delete roll;
1390  return;
1391  }
1392 
1393  //end of the roll
1394  if (roll->totalNeed > 0)
1395  {
1396  if (!roll->playerVote.empty())
1397  {
1398  uint8 maxresul = 0;
1399  ObjectGuid maxguid = (*roll->playerVote.begin()).first;
1400  Player* player;
1401 
1402  for (Roll::PlayerVote::const_iterator itr=roll->playerVote.begin(); itr != roll->playerVote.end(); ++itr)
1403  {
1404  if (itr->second != NEED)
1405  continue;
1406 
1407  uint8 randomN = urand(1, 100);
1408  SendLootRoll(ObjectGuid::Empty, itr->first, randomN, ROLL_NEED, *roll);
1409  if (maxresul < randomN)
1410  {
1411  maxguid = itr->first;
1412  maxresul = randomN;
1413  }
1414  }
1415  SendLootRollWon(ObjectGuid::Empty, maxguid, maxresul, ROLL_NEED, *roll);
1416  player = ObjectAccessor::FindConnectedPlayer(maxguid);
1417 
1418  if (player && player->GetSession())
1419  {
1420  player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED_ON_LOOT, roll->itemid, maxresul);
1421 
1422  ItemPosCountVec dest;
1423  LootItem* item = &(roll->itemSlot >= roll->getLoot()->items.size() ? roll->getLoot()->quest_items[roll->itemSlot - roll->getLoot()->items.size()] : roll->getLoot()->items[roll->itemSlot]);
1424  InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, roll->itemid, item->count);
1425  if (msg == EQUIP_ERR_OK)
1426  {
1427  item->is_looted = true;
1428  roll->getLoot()->NotifyItemRemoved(roll->itemSlot);
1429  roll->getLoot()->unlootedCount--;
1430  player->StoreNewItem(dest, roll->itemid, true, item->randomPropertyId, item->GetAllowedLooters(), item->BonusListIDs);
1431  }
1432  else
1433  {
1434  item->is_blocked = false;
1435  player->SendEquipError(msg, NULL, NULL, roll->itemid);
1436  }
1437  }
1438  }
1439  }
1440  else if (roll->totalGreed > 0)
1441  {
1442  if (!roll->playerVote.empty())
1443  {
1444  uint8 maxresul = 0;
1445  ObjectGuid maxguid = (*roll->playerVote.begin()).first;
1446  Player* player;
1447  RollVote rollvote = NOT_VALID;
1448 
1449  Roll::PlayerVote::iterator itr;
1450  for (itr = roll->playerVote.begin(); itr != roll->playerVote.end(); ++itr)
1451  {
1452  if (itr->second != GREED && itr->second != DISENCHANT)
1453  continue;
1454 
1455  uint8 randomN = urand(1, 100);
1456  SendLootRoll(ObjectGuid::Empty, itr->first, randomN, itr->second, *roll);
1457  if (maxresul < randomN)
1458  {
1459  maxguid = itr->first;
1460  maxresul = randomN;
1461  rollvote = itr->second;
1462  }
1463  }
1464  SendLootRollWon(ObjectGuid::Empty, maxguid, maxresul, rollvote, *roll);
1465  player = ObjectAccessor::FindConnectedPlayer(maxguid);
1466 
1467  if (player && player->GetSession())
1468  {
1469  player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED_ON_LOOT, roll->itemid, maxresul);
1470 
1471  LootItem* item = &(roll->itemSlot >= roll->getLoot()->items.size() ? roll->getLoot()->quest_items[roll->itemSlot - roll->getLoot()->items.size()] : roll->getLoot()->items[roll->itemSlot]);
1472 
1473  if (rollvote == GREED)
1474  {
1475  ItemPosCountVec dest;
1476  InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, roll->itemid, item->count);
1477  if (msg == EQUIP_ERR_OK)
1478  {
1479  item->is_looted = true;
1480  roll->getLoot()->NotifyItemRemoved(roll->itemSlot);
1481  roll->getLoot()->unlootedCount--;
1482  player->StoreNewItem(dest, roll->itemid, true, item->randomPropertyId, item->GetAllowedLooters(), item->BonusListIDs);
1483  }
1484  else
1485  {
1486  item->is_blocked = false;
1487  player->SendEquipError(msg, NULL, NULL, roll->itemid);
1488  }
1489  }
1490  else if (rollvote == DISENCHANT)
1491  {
1492  item->is_looted = true;
1493  roll->getLoot()->NotifyItemRemoved(roll->itemSlot);
1494  roll->getLoot()->unlootedCount--;
1495  ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(roll->itemid);
1496  player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL, 13262); // Disenchant
1497 
1498  ItemPosCountVec dest;
1499  InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, roll->itemid, item->count);
1500  if (msg == EQUIP_ERR_OK)
1501  player->AutoStoreLoot(pProto->DisenchantID, LootTemplates_Disenchant, true);
1502  else // If the player's inventory is full, send the disenchant result in a mail.
1503  {
1504  Loot loot;
1505  loot.FillLoot(pProto->DisenchantID, LootTemplates_Disenchant, player, true);
1506 
1507  uint32 max_slot = loot.GetMaxSlotInLootFor(player);
1508  for (uint32 i = 0; i < max_slot; ++i)
1509  {
1510  LootItem* lootItem = loot.LootItemInSlot(i, player);
1511  player->SendEquipError(msg, NULL, NULL, lootItem->itemid);
1512  player->SendItemRetrievalMail(lootItem->itemid, lootItem->count);
1513  }
1514  }
1515  }
1516  }
1517  }
1518  }
1519  else
1520  {
1521  SendLootAllPassed(*roll);
1522 
1523  // remove is_blocked so that the item is lootable by all players
1524  LootItem* item = &(roll->itemSlot >= roll->getLoot()->items.size() ? roll->getLoot()->quest_items[roll->itemSlot - roll->getLoot()->items.size()] : roll->getLoot()->items[roll->itemSlot]);
1525  if (item)
1526  item->is_blocked = false;
1527  }
1528 
1529  RollId.erase(rollI);
1530  delete roll;
1531 }
LootStore LootTemplates_Disenchant("disenchant_loot_template","item disenchant id", true)
LootItem * LootItemInSlot(uint32 lootslot, Player *player, QuestItem **qitem=NULL, QuestItem **ffaitem=NULL, QuestItem **conditem=NULL)
Definition: LootMgr.cpp:734
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
uint32 GetMaxSlotInLootFor(Player *player) const
Definition: LootMgr.cpp:797
Definition: Unit.h:379
Definition: DBCEnums.h:221
Rolls RollId
Definition: Group.h:412
Loot * getLoot()
Definition: Group.cpp:53
PlayerVote playerVote
Definition: Group.h:159
bool is_blocked
Definition: LootMgr.h:167
arena_t NULL
Definition: jemalloc_internal.h:624
uint32 itemid
Definition: Group.h:154
void SendLootRoll(ObjectGuid SourceGuid, ObjectGuid TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r)
Definition: Group.cpp:896
void SendLootAllPassed(Roll const &roll)
Definition: Group.cpp:943
bool is_looted
Definition: LootMgr.h:166
#define sObjectMgr
Definition: ObjectMgr.h:1567
Definition: Group.h:144
void NotifyItemRemoved(uint8 lootIndex)
Definition: LootMgr.cpp:629
int32 randomPropertyId
Definition: LootMgr.h:161
uint8 totalNeed
Definition: Group.h:161
Definition: Item.h:48
Definition: Unit.h:378
Definition: Group.h:54
uint8 unlootedCount
Definition: LootMgr.h:323
GuidSet const & GetAllowedLooters() const
Definition: LootMgr.h:187
Definition: Group.h:56
Definition: LootMgr.h:314
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
uint32 DisenchantID
Definition: ItemTemplate.h:711
uint32_t uint32
Definition: Define.h:150
Definition: Group.h:55
Definition: LootMgr.h:157
std::vector< LootItem > items
Definition: LootMgr.h:320
Definition: ItemTemplate.h:647
uint8_t uint8
Definition: Define.h:152
Definition: Group.h:58
Definition: LootMgr.h:43
bool isValid() const
Definition: Reference.h:78
uint8 count
Definition: LootMgr.h:165
Definition: ObjectGuid.h:189
std::vector< int32 > BonusListIDs
Definition: LootMgr.h:162
InventoryResult
Definition: Item.h:46
bool FillLoot(uint32 lootId, LootStore const &store, Player *lootOwner, bool personal, bool noEmptyError=false, uint16 lootMode=LOOT_MODE_DEFAULT)
Definition: LootMgr.cpp:450
uint8 itemSlot
Definition: Group.h:164
uint32 itemid
Definition: LootMgr.h:159
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:215
std::vector< LootItem > quest_items
Definition: LootMgr.h:321
RollVote
Definition: Group.h:51
void SendLootRollWon(ObjectGuid SourceGuid, ObjectGuid TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r)
Definition: Group.cpp:920
uint8 totalGreed
Definition: Group.h:162

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Group::Create ( Player leader)
99 {
100  ObjectGuid leaderGuid = leader->GetGUID();
101 
102  m_guid = ObjectGuid::Create<HighGuid::Party>(sGroupMgr->GenerateGroupId());
103  m_leaderGuid = leaderGuid;
104  m_leaderName = leader->GetName();
105  leader->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GROUP_LEADER);
106 
107  if (isBGGroup() || isBFGroup())
109 
112 
113  if (!isLFGGroup())
115 
117  m_looterGuid = leaderGuid;
119 
123 
124  if (!isBGGroup() && !isBFGroup())
125  {
126  m_dungeonDifficulty = leader->GetDungeonDifficultyID();
127  m_raidDifficulty = leader->GetRaidDifficultyID();
128  m_legacyRaidDifficulty = leader->GetLegacyRaidDifficultyID();
129 
130  m_dbStoreId = sGroupMgr->GenerateNewGroupDbStoreId();
131 
132  sGroupMgr->RegisterGroupDbStoreId(m_dbStoreId, this);
133 
134  // Store group in database
136 
137  uint8 index = 0;
138 
139  stmt->setUInt32(index++, m_dbStoreId);
140  stmt->setUInt64(index++, m_leaderGuid.GetCounter());
141  stmt->setUInt8(index++, uint8(m_lootMethod));
142  stmt->setUInt64(index++, m_looterGuid.GetCounter());
143  stmt->setUInt8(index++, uint8(m_lootThreshold));
144  stmt->setBinary(index++, m_targetIcons[0].GetRawValue());
145  stmt->setBinary(index++, m_targetIcons[1].GetRawValue());
146  stmt->setBinary(index++, m_targetIcons[2].GetRawValue());
147  stmt->setBinary(index++, m_targetIcons[3].GetRawValue());
148  stmt->setBinary(index++, m_targetIcons[4].GetRawValue());
149  stmt->setBinary(index++, m_targetIcons[5].GetRawValue());
150  stmt->setBinary(index++, m_targetIcons[6].GetRawValue());
151  stmt->setBinary(index++, m_targetIcons[7].GetRawValue());
152  stmt->setUInt8(index++, uint8(m_groupType));
153  stmt->setUInt32(index++, uint8(m_dungeonDifficulty));
154  stmt->setUInt32(index++, uint8(m_raidDifficulty));
155  stmt->setUInt32(index++, uint8(m_legacyRaidDifficulty));
156  stmt->setUInt64(index++, m_masterLooterGuid.GetCounter());
157 
159 
160  Group::ConvertLeaderInstancesToGroup(leader, this, false);
161 
162  ASSERT(AddMember(leader)); // If the leader can't be added to a new group because it appears full, something is clearly wrong.
163  }
164  else if (!AddMember(leader))
165  return false;
166 
167  return true;
168 }
Definition: LootMgr.h:70
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
uint32 m_dbStoreId
Definition: Group.h:418
Definition: DBCEnums.h:407
void _initRaidSubGroupsCounter()
Definition: Group.cpp:2705
Definition: Group.h:92
Difficulty m_dungeonDifficulty
Definition: Group.h:402
void setBinary(const uint8 index, const std::vector< uint8 > &value)
Definition: PreparedStatement.cpp:197
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
LootMethod m_lootMethod
Definition: Group.h:408
ObjectGuid m_guid
Definition: Group.h:415
ObjectGuid m_targetIcons[TARGET_ICONS_COUNT]
Definition: Group.h:407
Definition: PreparedStatement.h:74
Definition: CharacterDatabase.h:329
Definition: DBCEnums.h:416
bool AddMember(Player *player)
Definition: Group.cpp:368
Definition: Group.h:91
ObjectGuid m_leaderGuid
Definition: Group.h:399
ObjectGuid m_looterGuid
Definition: Group.h:410
#define sGroupMgr
Definition: GroupMgr.h:59
bool isBGGroup() const
Definition: Group.cpp:2514
Definition: SharedDefines.h:322
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
Definition: Player.h:517
ObjectGuid m_masterLooterGuid
Definition: Group.h:411
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
bool isLFGGroup() const
Definition: Group.cpp:2504
GroupType m_groupType
Definition: Group.h:401
void Clear()
Definition: ObjectGuid.h:215
uint8_t uint8
Definition: g3dmath.h:164
bool isBFGroup() const
Definition: Group.cpp:2519
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
ItemQualities m_lootThreshold
Definition: Group.h:409
uint8_t uint8
Definition: Define.h:152
#define ASSERT
Definition: Errors.h:55
static void ConvertLeaderInstancesToGroup(Player *player, Group *group, bool switchLeader)
convert the player's binds to the group
Definition: Group.cpp:721
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Difficulty m_legacyRaidDifficulty
Definition: Group.h:404
Definition: UpdateFields.h:191
Definition: ObjectGuid.h:189
std::string m_leaderName
Definition: Group.h:400
Difficulty m_raidDifficulty
Definition: Group.h:403
LowType GetCounter() const
Definition: ObjectGuid.h:221
Definition: DBCEnums.h:405

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::DeleteRaidMarker ( uint8  markerId)
2468 {
2469  if (markerId > RAID_MARKERS_COUNT)
2470  return;
2471 
2472  for (uint8 i = 0; i < RAID_MARKERS_COUNT; i++)
2473  if (m_markers[i] && (markerId == i || markerId == RAID_MARKERS_COUNT))
2474  {
2475  m_markers[i] = nullptr;
2476  m_activeMarkers &= ~(1 << i);
2477  }
2478 
2480 }
uint32 m_activeMarkers
Definition: Group.h:426
std::array< std::unique_ptr< RaidMarker >, RAID_MARKERS_COUNT > m_markers
Definition: Group.h:425
void SendRaidMarkersChanged(WorldSession *session=nullptr, int8 partyIndex=0)
Definition: Group.cpp:2482
#define RAID_MARKERS_COUNT
Definition: Group.h:47
uint8_t uint8
Definition: Define.h:152

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::DelinkMember ( ObjectGuid  guid)
2686 {
2688  while (ref)
2689  {
2690  GroupReference* nextRef = ref->next();
2691  if (ref->GetSource()->GetGUID() == guid)
2692  {
2693  ref->unlink();
2694  break;
2695  }
2696  ref = nextRef;
2697  }
2698 }
void unlink()
Definition: Reference.h:61
GroupReference * getFirst()
Definition: GroupRefManager.h:31
GroupRefManager m_memberMgr
Definition: Group.h:397
GroupReference * next()
Definition: GroupReference.h:37
FROM * GetSource() const
Definition: Reference.h:96
Definition: GroupReference.h:27

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::Disband ( bool  hideDestroy = false)
758 {
759  sScriptMgr->OnGroupDisband(this);
760 
761  Player* player;
762  for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
763  {
764  player = ObjectAccessor::FindConnectedPlayer(citr->guid);
765  if (!player)
766  continue;
767 
768  //we cannot call _removeMember because it would invalidate member iterator
769  //if we are removing player from battleground raid
770  if (isBGGroup() || isBFGroup())
771  player->RemoveFromBattlegroundOrBattlefieldRaid();
772  else
773  {
774  //we can remove player who is in battleground from his original group
775  if (player->GetOriginalGroup() == this)
776  player->SetOriginalGroup(NULL);
777  else
778  player->SetGroup(NULL);
779  }
780 
781  // quest related GO state dependent from raid membership
782  if (isRaidGroup())
783  player->UpdateForQuestWorldObjects();
784 
785  if (!player->GetSession())
786  continue;
787 
788  WorldPacket data;
789  if (!hideDestroy)
790  {
792  player->GetSession()->SendPacket(&data);
793  }
794 
795  //we already removed player from group and in player->GetGroup() is his original group, send update
796  if (Group* group = player->GetGroup())
797  {
798  group->SendUpdate();
799  }
800  else
801  {
802  data.Initialize(SMSG_PARTY_UPDATE, 1+1+1+1+8+4+4+8);
803  data << uint8(0x10) << uint8(0) << uint8(0) << uint8(0);
804  data << m_guid << uint32(m_counter) << uint32(0) << uint64(0);
805  player->GetSession()->SendPacket(&data);
806  }
807 
808  _homebindIfInstance(player);
809  }
810  RollId.clear();
811  m_memberSlots.clear();
812 
814 
815  if (!isBGGroup() && !isBFGroup())
816  {
818 
820  stmt->setUInt32(0, m_dbStoreId);
821  trans->Append(stmt);
822 
824  stmt->setUInt32(0, m_dbStoreId);
825  trans->Append(stmt);
826 
828 
832 
834  stmt->setUInt32(0, m_dbStoreId);
836 
837  sGroupMgr->FreeGroupDbStoreId(this);
838  }
839 
840  sGroupMgr->RemoveGroup(this);
841  delete this;
842 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
void ResetInstances(uint8 method, bool isRaid, bool isLegacy, Player *SendMsgTo)
Definition: Group.cpp:2096
Definition: CharacterDatabase.h:417
uint32 m_dbStoreId
Definition: Group.h:418
MemberSlotList::const_iterator member_citerator
Definition: Group.h:205
Rolls RollId
Definition: Group.h:412
Definition: Map.h:753
bool isRaidGroup() const
Definition: Group.cpp:2509
void RemoveAllInvites()
Definition: Group.cpp:339
uint32 m_counter
Definition: Group.h:416
Definition: CharacterDatabase.h:416
void _homebindIfInstance(Player *player)
Definition: Group.cpp:2277
SQLTransaction BeginTransaction()
Begins an automanaged transaction pointer that will automatically rollback if not commited...
Definition: DatabaseWorkerPool.h:221
arena_t NULL
Definition: jemalloc_internal.h:624
ObjectGuid m_guid
Definition: Group.h:415
uint64_t uint64
Definition: g3dmath.h:170
Definition: PreparedStatement.h:74
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
Definition: Opcodes.h:1325
MemberSlotList m_memberSlots
Definition: Group.h:396
Definition: Opcodes.h:1061
#define sGroupMgr
Definition: GroupMgr.h:59
bool isBGGroup() const
Definition: Group.cpp:2514
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
uint8_t uint8
Definition: g3dmath.h:164
bool isBFGroup() const
Definition: Group.cpp:2519
void Initialize(uint32 opcode, size_t newres=200, ConnectionType connection=CONNECTION_TYPE_DEFAULT)
Definition: WorldPacket.h:71
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: CharacterDatabase.h:372
#define sScriptMgr
Definition: ScriptMgr.h:837
uint32_t uint32
Definition: g3dmath.h:168
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:215
Definition: WorldPacket.h:26
Definition: Group.h:191
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::EndReadyCheck ( void  )
2390 {
2391  if (!m_readyCheckStarted)
2392  return;
2393 
2394  m_readyCheckStarted = false;
2395  m_readyCheckTimer = 0;
2396 
2398 
2399  WorldPackets::Party::ReadyCheckCompleted readyCheckCompleted;
2400  readyCheckCompleted.PartyIndex = 0;
2401  readyCheckCompleted.PartyGUID = m_guid;
2402  BroadcastPacket(readyCheckCompleted.Write(), false);
2403 }
void ResetMemberReadyChecked(void)
Definition: Group.cpp:2451
Definition: PartyPackets.h:423
ObjectGuid m_guid
Definition: Group.h:415
bool m_readyCheckStarted
Definition: Group.h:421
ObjectGuid PartyGUID
Definition: PartyPackets.h:431
WorldPacket const * Write() override
Definition: PartyPackets.cpp:303
int32 m_readyCheckTimer
Definition: Group.h:422
int8 PartyIndex
Definition: PartyPackets.h:430
void BroadcastPacket(WorldPacket const *packet, bool ignorePlayersInBGRaid, int group=-1, ObjectGuid ignoredPlayer=ObjectGuid::Empty)
Definition: Group.cpp:1698

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::EndRoll ( Loot loot)
1371 {
1372  for (Rolls::iterator itr = RollId.begin(); itr != RollId.end();)
1373  {
1374  if ((*itr)->getLoot() == pLoot) {
1375  CountTheRoll(itr); //i don't have to edit player votes, who didn't vote ... he will pass
1376  itr = RollId.begin();
1377  }
1378  else
1379  ++itr;
1380  }
1381 }
Rolls RollId
Definition: Group.h:412
void CountTheRoll(Rolls::iterator roll)
Definition: Group.cpp:1383

+ Here is the call graph for this function:

InstanceGroupBind * Group::GetBoundInstance ( Player player)
2192 {
2193  uint32 mapid = player->GetMapId();
2194  MapEntry const* mapEntry = sMapStore.LookupEntry(mapid);
2195  return GetBoundInstance(mapEntry);
2196 }
Definition: DBCStructure.h:830
uint32_t uint32
Definition: Define.h:150
DBCStorage< MapEntry > sMapStore(Mapfmt)
InstanceGroupBind * GetBoundInstance(Player *player)
Definition: Group.cpp:2191

+ Here is the caller graph for this function:

InstanceGroupBind * Group::GetBoundInstance ( Map aMap)
2199 {
2200  return GetBoundInstance(aMap->GetEntry());
2201 }
MapEntry const * GetEntry() const
Definition: Map.h:266
InstanceGroupBind * GetBoundInstance(Player *player)
Definition: Group.cpp:2191

+ Here is the call graph for this function:

InstanceGroupBind * Group::GetBoundInstance ( MapEntry const mapEntry)
2204 {
2205  if (!mapEntry || !mapEntry->IsDungeon())
2206  return NULL;
2207 
2208  Difficulty difficulty = GetDifficultyID(mapEntry);
2209  return GetBoundInstance(difficulty, mapEntry->ID);
2210 }
Difficulty
Definition: DBCEnums.h:402
arena_t NULL
Definition: jemalloc_internal.h:624
InstanceGroupBind * GetBoundInstance(Player *player)
Definition: Group.cpp:2191
Difficulty GetDifficultyID(MapEntry const *mapEntry) const
Definition: Group.cpp:2080

+ Here is the call graph for this function:

InstanceGroupBind * Group::GetBoundInstance ( Difficulty  difficulty,
uint32  mapId 
)
2213 {
2214  // some instances only have one difficulty
2215  GetDownscaledMapDifficultyData(mapId, difficulty);
2216 
2217  BoundInstancesMap::iterator itr = m_boundInstances[difficulty].find(mapId);
2218  if (itr != m_boundInstances[difficulty].end())
2219  return &itr->second;
2220  else
2221  return NULL;
2222 }
arena_t NULL
Definition: jemalloc_internal.h:624
MapDifficultyEntry const * GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &difficulty)
Definition: DBCStores.cpp:737
BoundInstancesMap m_boundInstances[MAX_DIFFICULTY]
Definition: Group.h:413

+ Here is the call graph for this function:

Group::BoundInstancesMap & Group::GetBoundInstances ( Difficulty  difficulty)
2701 {
2702  return m_boundInstances[difficulty];
2703 }
BoundInstancesMap m_boundInstances[MAX_DIFFICULTY]
Definition: Group.h:413
uint32 Group::GetDbStoreId ( ) const
inline
278 { return m_dbStoreId; }
uint32 m_dbStoreId
Definition: Group.h:418

+ Here is the caller graph for this function:

Difficulty Group::GetDifficultyID ( MapEntry const mapEntry) const
2081 {
2082  if (!mapEntry->IsRaid())
2083  return m_dungeonDifficulty;
2084 
2085  MapDifficultyEntry const* defaultDifficulty = GetDefaultMapDifficulty(mapEntry->ID);
2086  if (!defaultDifficulty)
2087  return m_legacyRaidDifficulty;
2088 
2089  DifficultyEntry const* difficulty = sDifficultyStore.LookupEntry(defaultDifficulty->DifficultyID);
2090  if (!difficulty || difficulty->Flags & DIFFICULTY_FLAG_LEGACY)
2091  return m_legacyRaidDifficulty;
2092 
2093  return m_raidDifficulty;
2094 }
uint32 DifficultyID
Definition: DBCStructure.h:889
Difficulty m_dungeonDifficulty
Definition: Group.h:402
MapDifficultyEntry const * GetDefaultMapDifficulty(uint32 mapId, Difficulty *difficulty)
Definition: DBCStores.cpp:694
uint32 Flags
Definition: DBCStructure.h:346
Definition: DBCEnums.h:436
Definition: DBCStructure.h:885
Difficulty m_legacyRaidDifficulty
Definition: Group.h:404
DBCStorage< DifficultyEntry > sDifficultyStore(DifficultyFmt)
Difficulty m_raidDifficulty
Definition: Group.h:403
Definition: DBCStructure.h:338

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Difficulty Group::GetDungeonDifficultyID ( ) const
inline
320 { return m_dungeonDifficulty; }
Difficulty m_dungeonDifficulty
Definition: Group.h:402

+ Here is the caller graph for this function:

GroupReference* Group::GetFirstMember ( )
inline
295 { return m_memberMgr.getFirst(); }
GroupReference * getFirst()
Definition: GroupRefManager.h:31
GroupRefManager m_memberMgr
Definition: Group.h:397

+ Here is the caller graph for this function:

GroupReference const* Group::GetFirstMember ( ) const
inline
296 { return m_memberMgr.getFirst(); }
GroupReference * getFirst()
Definition: GroupRefManager.h:31
GroupRefManager m_memberMgr
Definition: Group.h:397
GroupType Group::GetGroupType ( ) const
inline
298 { return m_groupType; }
GroupType m_groupType
Definition: Group.h:401
ObjectGuid Group::GetGUID ( ) const
2535 {
2536  return m_guid;
2537 }
ObjectGuid m_guid
Definition: Group.h:415

+ Here is the caller graph for this function:

Player * Group::GetInvited ( ObjectGuid  guid) const
349 {
350  for (InvitesList::const_iterator itr = m_invitees.begin(); itr != m_invitees.end(); ++itr)
351  {
352  if ((*itr) && (*itr)->GetGUID() == guid)
353  return (*itr);
354  }
355  return NULL;
356 }
InvitesList m_invitees
Definition: Group.h:398
arena_t NULL
Definition: jemalloc_internal.h:624

+ Here is the caller graph for this function:

Player * Group::GetInvited ( const std::string &  name) const
359 {
360  for (InvitesList::const_iterator itr = m_invitees.begin(); itr != m_invitees.end(); ++itr)
361  {
362  if ((*itr) && (*itr)->GetName() == name)
363  return (*itr);
364  }
365  return NULL;
366 }
InvitesList m_invitees
Definition: Group.h:398
arena_t NULL
Definition: jemalloc_internal.h:624
ObjectGuid Group::GetLeaderGUID ( ) const
2530 {
2531  return m_leaderGuid;
2532 }
ObjectGuid m_leaderGuid
Definition: Group.h:399

+ Here is the caller graph for this function:

char const * Group::GetLeaderName ( ) const
2540 {
2541  return m_leaderName.c_str();
2542 }
std::string m_leaderName
Definition: Group.h:400

+ Here is the caller graph for this function:

Difficulty Group::GetLegacyRaidDifficultyID ( ) const
inline
322 { return m_legacyRaidDifficulty; }
Difficulty m_legacyRaidDifficulty
Definition: Group.h:404

+ Here is the caller graph for this function:

uint8 Group::GetLfgRoles ( ObjectGuid  guid)
2342 {
2343  member_witerator slot = _getMemberWSlot(guid);
2344  if (slot == m_memberSlots.end())
2345  return 0;
2346 
2347  return slot->roles;
2348 }
MemberSlotList::iterator member_witerator
Definition: Group.h:209
MemberSlotList m_memberSlots
Definition: Group.h:396
member_witerator _getMemberWSlot(ObjectGuid Guid)
Definition: Group.cpp:2725

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ObjectGuid Group::GetLooterGuid ( ) const
2550 {
2551  if (GetLootMethod() == FREE_FOR_ALL)
2552  return ObjectGuid::Empty;
2553  return m_looterGuid;
2554 }
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
Definition: LootMgr.h:67
ObjectGuid m_looterGuid
Definition: Group.h:410
LootMethod GetLootMethod() const
Definition: Group.cpp:2544

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

LootMethod Group::GetLootMethod ( ) const
2545 {
2546  return m_lootMethod;
2547 }
LootMethod m_lootMethod
Definition: Group.h:408

+ Here is the caller graph for this function:

ItemQualities Group::GetLootThreshold ( ) const
2562 {
2563  return m_lootThreshold;
2564 }
ItemQualities m_lootThreshold
Definition: Group.h:409

+ Here is the caller graph for this function:

ObjectGuid Group::GetMasterLooterGuid ( ) const
2557 {
2558  return m_masterLooterGuid;
2559 }
ObjectGuid m_masterLooterGuid
Definition: Group.h:411

+ Here is the caller graph for this function:

uint8 Group::GetMemberGroup ( ObjectGuid  guid) const
2614 {
2615  member_citerator mslot = _getMemberCSlot(guid);
2616  if (mslot == m_memberSlots.end())
2617  return (MAX_RAID_SUBGROUPS+1);
2618  return mslot->group;
2619 }
MemberSlotList::const_iterator member_citerator
Definition: Group.h:205
MemberSlotList m_memberSlots
Definition: Group.h:396
#define MAX_RAID_SUBGROUPS
Definition: Group.h:44
member_citerator _getMemberCSlot(ObjectGuid Guid) const
Definition: Group.cpp:2717

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ObjectGuid Group::GetMemberGUID ( const std::string &  name)
2577 {
2578  for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
2579  if (itr->name == name)
2580  return itr->guid;
2581  return ObjectGuid::Empty;
2582 }
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
MemberSlotList::const_iterator member_citerator
Definition: Group.h:205
MemberSlotList m_memberSlots
Definition: Group.h:396
uint32 Group::GetMembersCount ( ) const
inline
297 { return uint32(m_memberSlots.size()); }
MemberSlotList m_memberSlots
Definition: Group.h:396
uint32_t uint32
Definition: g3dmath.h:168

+ Here is the caller graph for this function:

MemberSlotList const& Group::GetMemberSlots ( ) const
inline
294 { return m_memberSlots; }
MemberSlotList m_memberSlots
Definition: Group.h:396

+ Here is the caller graph for this function:

Difficulty Group::GetRaidDifficultyID ( ) const
inline
321 { return m_raidDifficulty; }
Difficulty m_raidDifficulty
Definition: Group.h:403

+ Here is the caller graph for this function:

Group::Rolls::iterator Group::GetRoll ( ObjectGuid  Guid)
2672 {
2673  Rolls::iterator iter;
2674  for (iter=RollId.begin(); iter != RollId.end(); ++iter)
2675  if ((*iter)->itemGUID == Guid && (*iter)->isValid())
2676  return iter;
2677  return RollId.end();
2678 }
Rolls RollId
Definition: Group.h:412

+ Here is the caller graph for this function:

void Group::GroupLoot ( Loot loot,
WorldObject pLootedObject 
)
982 {
983  std::vector<LootItem>::iterator i;
984  ItemTemplate const* item;
985  uint8 itemSlot = 0;
986 
987  for (i = loot->items.begin(); i != loot->items.end(); ++i, ++itemSlot)
988  {
989  if (i->freeforall)
990  continue;
991 
992  item = sObjectMgr->GetItemTemplate(i->itemid);
993  if (!item)
994  {
995  //TC_LOG_DEBUG("misc", "Group::GroupLoot: missing item prototype for item with id: %d", i->itemid);
996  continue;
997  }
998 
999  //roll for over-threshold item if it's one-player loot
1000  if (item->GetQuality() >= uint32(m_lootThreshold))
1001  {
1002  ObjectGuid newitemGUID = ObjectGuid::Create<HighGuid::Item>(sObjectMgr->GetGenerator<HighGuid::Item>().Generate());
1003  Roll* r = new Roll(newitemGUID, *i);
1004 
1005  //a vector is filled with only near party members
1006  for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
1007  {
1008  Player* member = itr->GetSource();
1009  if (!member || !member->GetSession())
1010  continue;
1011  if (i->AllowedForPlayer(member))
1012  {
1013  if (member->IsAtGroupRewardDistance(pLootedObject))
1014  {
1015  r->totalPlayersRolling++;
1016 
1017  if (member->GetPassOnGroupLoot())
1018  {
1019  r->playerVote[member->GetGUID()] = PASS;
1020  r->totalPass++;
1021  // can't broadcast the pass now. need to wait until all rolling players are known.
1022  }
1023  else
1024  r->playerVote[member->GetGUID()] = NOT_EMITED_YET;
1025  }
1026  }
1027  }
1028 
1029  if (r->totalPlayersRolling > 0)
1030  {
1031  r->setLoot(loot);
1032  r->itemSlot = itemSlot;
1034  r->rollVoteMask |= ROLL_FLAG_TYPE_DISENCHANT;
1035 
1036  loot->items[itemSlot].is_blocked = true;
1037 
1038  // If there is any "auto pass", broadcast the pass now.
1039  if (r->totalPass)
1040  {
1041  for (Roll::PlayerVote::const_iterator itr=r->playerVote.begin(); itr != r->playerVote.end(); ++itr)
1042  {
1044  if (!p || !p->GetSession())
1045  continue;
1046 
1047  if (itr->second == PASS)
1048  SendLootRoll(newitemGUID, p->GetGUID(), 128, ROLL_PASS, *r);
1049  }
1050  }
1051 
1052  SendLootStartRoll(60000, pLootedObject->GetMapId(), *r);
1053 
1054  RollId.push_back(r);
1055 
1056  if (Creature* creature = pLootedObject->ToCreature())
1057  {
1058  creature->m_groupLootTimer = 60000;
1059  creature->lootingGroupLowGUID = GetGUID();
1060  }
1061  else if (GameObject* go = pLootedObject->ToGameObject())
1062  {
1063  go->m_groupLootTimer = 60000;
1064  go->lootingGroupLowGUID = GetGUID();
1065  }
1066  }
1067  else
1068  delete r;
1069  }
1070  else
1071  i->is_underthreshold = true;
1072  }
1073 
1074  for (i = loot->quest_items.begin(); i != loot->quest_items.end(); ++i, ++itemSlot)
1075  {
1076  if (!i->follow_loot_rules)
1077  continue;
1078 
1079  item = sObjectMgr->GetItemTemplate(i->itemid);
1080  if (!item)
1081  {
1082  //TC_LOG_DEBUG("misc", "Group::GroupLoot: missing item prototype for item with id: %d", i->itemid);
1083  continue;
1084  }
1085 
1086  ObjectGuid newitemGUID = ObjectGuid::Create<HighGuid::Item>(sObjectMgr->GetGenerator<HighGuid::Item>().Generate());
1087  Roll* r = new Roll(newitemGUID, *i);
1088 
1089  //a vector is filled with only near party members
1090  for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
1091  {
1092  Player* member = itr->GetSource();
1093  if (!member || !member->GetSession())
1094  continue;
1095 
1096  if (i->AllowedForPlayer(member))
1097  {
1098  if (member->IsAtGroupRewardDistance(pLootedObject))
1099  {
1100  r->totalPlayersRolling++;
1101  r->playerVote[member->GetGUID()] = NOT_EMITED_YET;
1102  }
1103  }
1104  }
1105 
1106  if (r->totalPlayersRolling > 0)
1107  {
1108  r->setLoot(loot);
1109  r->itemSlot = itemSlot;
1110 
1111  loot->quest_items[itemSlot - loot->items.size()].is_blocked = true;
1112 
1113  SendLootStartRoll(60000, pLootedObject->GetMapId(), *r);
1114 
1115  RollId.push_back(r);
1116 
1117  if (Creature* creature = pLootedObject->ToCreature())
1118  {
1119  creature->m_groupLootTimer = 60000;
1120  creature->lootingGroupLowGUID = GetGUID();
1121  }
1122  else if (GameObject* go = pLootedObject->ToGameObject())
1123  {
1124  go->m_groupLootTimer = 60000;
1125  go->lootingGroupLowGUID = GetGUID();
1126  }
1127  }
1128  else
1129  delete r;
1130  }
1131 }
Definition: LootMgr.h:54
Rolls RollId
Definition: Group.h:412
ObjectGuid GetGUID() const
Definition: Group.cpp:2534
Definition: Group.h:53
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Creature.h:467
void SendLootRoll(ObjectGuid SourceGuid, ObjectGuid TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r)
Definition: Group.cpp:896
#define sObjectMgr
Definition: ObjectMgr.h:1567
GameObject * ToGameObject()
Definition: Object.h:200
Definition: Group.h:144
uint32 m_maxEnchantingLevel
Definition: Group.h:417
uint32 DisenchantID
Definition: ItemTemplate.h:711
Definition: LootMgr.h:42
Definition: GameObject.h:880
uint32 RequiredDisenchantSkill
Definition: ItemTemplate.h:712
uint32 GetMapId() const
Definition: Position.h:254
Definition: Group.h:57
GroupReference * GetFirstMember()
Definition: Group.h:295
std::vector< LootItem > items
Definition: LootMgr.h:320
Definition: ItemTemplate.h:647
Creature * ToCreature()
Definition: Object.h:194
ItemQualities m_lootThreshold
Definition: Group.h:409
uint8_t uint8
Definition: Define.h:152
void SendLootStartRoll(uint32 CountDown, uint32 mapid, const Roll &r)
Definition: Group.cpp:848
Definition: ObjectGuid.h:189
uint32_t uint32
Definition: g3dmath.h:168
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:215
std::vector< LootItem > quest_items
Definition: LootMgr.h:321
Definition: GroupReference.h:27
uint32 GetQuality() const
Definition: ItemTemplate.h:655

+ Here is the call graph for this function:

bool Group::HasFreeSlotSubGroup ( uint8  subgroup) const
2609 {
2610  return (m_subGroupsCounts && m_subGroupsCounts[subgroup] < MAX_GROUP_SIZE);
2611 }
uint8 * m_subGroupsCounts
Definition: Group.h:414
#define MAX_GROUP_SIZE
Definition: Group.h:42

+ Here is the caller graph for this function:

bool Group::IsAssistant ( ObjectGuid  guid) const
2585 {
2586  member_citerator mslot = _getMemberCSlot(guid);
2587  if (mslot == m_memberSlots.end())
2588  return false;
2589  return mslot->flags & MEMBER_FLAG_ASSISTANT;
2590 }
Definition: Group.h:76
MemberSlotList::const_iterator member_citerator
Definition: Group.h:205
MemberSlotList m_memberSlots
Definition: Group.h:396
member_citerator _getMemberCSlot(ObjectGuid Guid) const
Definition: Group.cpp:2717

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Group::isBFGroup ( ) const
2520 {
2521  return m_bfGroup != NULL;
2522 }
arena_t NULL
Definition: jemalloc_internal.h:624
Battlefield * m_bfGroup
Definition: Group.h:406

+ Here is the caller graph for this function:

bool Group::isBGGroup ( ) const
2515 {
2516  return m_bgGroup != NULL;
2517 }
arena_t NULL
Definition: jemalloc_internal.h:624
Battleground * m_bgGroup
Definition: Group.h:405

+ Here is the caller graph for this function:

bool Group::IsCreated ( ) const
2525 {
2526  return GetMembersCount() > 0;
2527 }
uint32 GetMembersCount() const
Definition: Group.h:297

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Group::IsFull ( ) const
2500 {
2501  return isRaidGroup() ? (m_memberSlots.size() >= MAX_RAID_SIZE) : (m_memberSlots.size() >= MAX_GROUP_SIZE);
2502 }
bool isRaidGroup() const
Definition: Group.cpp:2509
MemberSlotList m_memberSlots
Definition: Group.h:396
#define MAX_GROUP_SIZE
Definition: Group.h:42
#define MAX_RAID_SIZE
Definition: Group.h:43

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Group::IsLeader ( ObjectGuid  guid) const
2572 {
2573  return (GetLeaderGUID() == guid);
2574 }
ObjectGuid GetLeaderGUID() const
Definition: Group.cpp:2529

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Group::isLFGGroup ( ) const
2505 {
2506  return (m_groupType & GROUPTYPE_LFG) != 0;
2507 }
GroupType m_groupType
Definition: Group.h:401
Definition: Group.h:94

+ Here is the caller graph for this function:

bool Group::IsMember ( ObjectGuid  guid) const
2567 {
2568  return _getMemberCSlot(guid) != m_memberSlots.end();
2569 }
MemberSlotList m_memberSlots
Definition: Group.h:396
member_citerator _getMemberCSlot(ObjectGuid Guid) const
Definition: Group.cpp:2717

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Group::isRaidGroup ( ) const
2510 {
2511  return (m_groupType & GROUPTYPE_RAID) != 0;
2512 }
Definition: Group.h:91
GroupType m_groupType
Definition: Group.h:401

+ Here is the caller graph for this function:

bool Group::IsReadyCheckCompleted ( void  ) const
2406 {
2407  for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
2408  if (!citr->readyChecked)
2409  return false;
2410  return true;
2411 }
MemberSlotList::const_iterator member_citerator
Definition: Group.h:205
MemberSlotList m_memberSlots
Definition: Group.h:396

+ Here is the caller graph for this function:

bool Group::IsReadyCheckStarted ( void  ) const
inline
248 { return m_readyCheckStarted; }
bool m_readyCheckStarted
Definition: Group.h:421
bool Group::isRollLootActive ( ) const
inline
353 { return !RollId.empty(); }
Rolls RollId
Definition: Group.h:412
void Group::LinkMember ( GroupReference pRef)
2681 {
2682  m_memberMgr.insertFirst(pRef);
2683 }
GroupRefManager m_memberMgr
Definition: Group.h:397
void insertFirst(LinkedListElement *pElem)
Definition: LinkedList.h:110

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::LoadGroupFromDB ( Field field)
171 {
172  m_dbStoreId = fields[17].GetUInt32();
173  m_guid = ObjectGuid::Create<HighGuid::Party>(sGroupMgr->GenerateGroupId());
174  m_leaderGuid = ObjectGuid::Create<HighGuid::Player>(fields[0].GetUInt64());
175 
176  // group leader not exist
177  if (!ObjectMgr::GetPlayerNameByGUID(m_leaderGuid, m_leaderName))
178  return;
179 
180  m_lootMethod = LootMethod(fields[1].GetUInt8());
181  m_looterGuid = ObjectGuid::Create<HighGuid::Player>(fields[2].GetUInt64());
182  m_lootThreshold = ItemQualities(fields[3].GetUInt8());
183 
184  for (uint8 i = 0; i < TARGET_ICONS_COUNT; ++i)
185  m_targetIcons[i].SetRawValue(fields[4 + i].GetBinary());
186 
187  m_groupType = GroupType(fields[12].GetUInt8());
190 
191  m_dungeonDifficulty = Player::CheckLoadedDungeonDifficultyID(Difficulty(fields[13].GetUInt8()));
192  m_raidDifficulty = Player::CheckLoadedRaidDifficultyID(Difficulty(fields[14].GetUInt8()));
193  m_legacyRaidDifficulty = Player::CheckLoadedLegacyRaidDifficultyID(Difficulty(fields[15].GetUInt8()));
194 
195  m_masterLooterGuid = ObjectGuid::Create<HighGuid::Player>(fields[16].GetUInt64());
196 
198  sLFGMgr->_LoadFromDB(fields, GetGUID());
199 }
#define TARGET_ICONS_COUNT
Definition: Group.h:46
Difficulty
Definition: DBCEnums.h:402
uint32 m_dbStoreId
Definition: Group.h:418
void _initRaidSubGroupsCounter()
Definition: Group.cpp:2705
Difficulty m_dungeonDifficulty
Definition: Group.h:402
ObjectGuid GetGUID() const
Definition: Group.cpp:2534
LootMethod m_lootMethod
Definition: Group.h:408
ObjectGuid m_guid
Definition: Group.h:415
ObjectGuid m_targetIcons[TARGET_ICONS_COUNT]
Definition: Group.h:407
GroupType
Definition: Group.h:87
Definition: Group.h:91
#define sLFGMgr
Definition: LFGMgr.h:481
ObjectGuid m_leaderGuid
Definition: Group.h:399
ObjectGuid m_looterGuid
Definition: Group.h:410
#define sGroupMgr
Definition: GroupMgr.h:59
ObjectGuid m_masterLooterGuid
Definition: Group.h:411
GroupType m_groupType
Definition: Group.h:401
ItemQualities
Definition: SharedDefines.h:318
static bool GetPlayerNameByGUID(ObjectGuid const &guid, std::string &name)
Definition: ObjectMgr.cpp:2258
LootMethod
Definition: LootMgr.h:65
ItemQualities m_lootThreshold
Definition: Group.h:409
uint8_t uint8
Definition: Define.h:152
Difficulty m_legacyRaidDifficulty
Definition: Group.h:404
Definition: Group.h:94
std::string m_leaderName
Definition: Group.h:400
Difficulty m_raidDifficulty
Definition: Group.h:403

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::LoadMemberFromDB ( ObjectGuid::LowType  guidLow,
uint8  memberFlags,
uint8  subgroup,
uint8  roles 
)
202 {
203  MemberSlot member;
204  member.guid = ObjectGuid::Create<HighGuid::Player>(guidLow);
205 
206  // skip non-existed member
207  if (!ObjectMgr::GetPlayerNameAndClassByGUID(member.guid, member.name, member._class))
208  {
210  stmt->setUInt64(0, guidLow);
212  return;
213  }
214 
215  member.group = subgroup;
216  member.flags = memberFlags;
217  member.roles = roles;
218  member.readyChecked = false;
219 
220  m_memberSlots.push_back(member);
221 
222  SubGroupCounterIncrease(subgroup);
223 
224  sLFGMgr->SetupGroupMember(member.guid, GetGUID());
225 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
Definition: CharacterDatabase.h:331
ObjectGuid GetGUID() const
Definition: Group.cpp:2534
Definition: PreparedStatement.h:74
MemberSlotList m_memberSlots
Definition: Group.h:396
#define sLFGMgr
Definition: LFGMgr.h:481
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
void SubGroupCounterIncrease(uint8 subgroup)
Definition: Group.cpp:2733
static bool GetPlayerNameAndClassByGUID(ObjectGuid const &guid, std::string &name, uint8 &_class)
Definition: ObjectMgr.cpp:2275

+ e is the call graph for this function:

+ Here is the caller graph for this function:

void Group::MasterLoot ( Loot loot,
WorldObject pLootedObject 
)
1278 {
1279  TC_LOG_DEBUG("network", "Group::MasterLoot (SMSG_MASTER_LOOT_CANDIDATE_LIST)");
1280 
1281  for (std::vector<LootItem>::iterator i = loot->items.begin(); i != loot->items.end(); ++i)
1282  {
1283  if (i->freeforall)
1284  continue;
1285 
1286  i->is_blocked = !i->is_underthreshold;
1287  }
1288 
1289  for (std::vector<LootItem>::iterator i = loot->quest_items.begin(); i != loot->quest_items.end(); ++i)
1290  {
1291  if (!i->follow_loot_rules)
1292  continue;
1293 
1294  i->is_blocked = !i->is_underthreshold;
1295  }
1296 
1297  uint32 real_count = 0;
1298 
1300  data << uint8(GetMembersCount());
1301 
1302  for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
1303  {
1304  Player* looter = itr->GetSource();
1305  if (!looter->IsInWorld())
1306  continue;
1307 
1308  if (looter->IsAtGroupRewardDistance(pLootedObject))
1309  {
1310  data << looter->GetGUID();
1311  ++real_count;
1312  }
1313  }
1314 
1315  data.put<uint8>(0, real_count);
1316 
1317  for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
1318  {
1319  Player* looter = itr->GetSource();
1320  if (looter->IsAtGroupRewardDistance(pLootedObject))
1321  looter->GetSession()->SendPacket(&data);
1322  }
1323 }
arena_t NULL
Definition: jemalloc_internal.h:624
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
uint32_t uint32
Definition: Define.h:150
GroupReference * GetFirstMember()
Definition: Group.h:295
uint8_t uint8
Definition: g3dmath.h:164
std::vector< LootItem > items
Definition: LootMgr.h:320
uint32 GetMembersCount() const
Definition: Group.h:297
uint8_t uint8
Definition: Define.h:152
Definition: Opcodes.h:1216
Definition: WorldPacket.h:26
std::vector< LootItem > quest_items
Definition: LootMgr.h:321
Definition: GroupReference.h:27

+ Here is the call graph for this function:

void Group::NeedBeforeGreed ( Loot loot,
WorldObject pLootedObject 
)
1134 {
1135  ItemTemplate const* item;
1136  uint8 itemSlot = 0;
1137  for (std::vector<LootItem>::iterator i = loot->items.begin(); i != loot->items.end(); ++i, ++itemSlot)
1138  {
1139  if (i->freeforall)
1140  continue;
1141 
1142  item = sObjectMgr->GetItemTemplate(i->itemid);
1143 
1144  //roll for over-threshold item if it's one-player loot
1145  if (item->GetQuality() >= uint32(m_lootThreshold))
1146  {
1147  ObjectGuid newitemGUID = ObjectGuid::Create<HighGuid::Item>(sObjectMgr->GetGenerator<HighGuid::Item>().Generate());
1148  Roll* r = new Roll(newitemGUID, *i);
1149 
1150  for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
1151  {
1152  Player* playerToRoll = itr->GetSource();
1153  if (!playerToRoll || !playerToRoll->GetSession())
1154  continue;
1155 
1156  bool allowedForPlayer = i->AllowedForPlayer(playerToRoll);
1157  if (allowedForPlayer && playerToRoll->IsAtGroupRewardDistance(lootedObject))
1158  {
1159  r->totalPlayersRolling++;
1160  if (playerToRoll->GetPassOnGroupLoot())
1161  {
1162  r->playerVote[playerToRoll->GetGUID()] = PASS;
1163  r->totalPass++;
1164  // can't broadcast the pass now. need to wait until all rolling players are known.
1165  }
1166  else
1167  r->playerVote[playerToRoll->GetGUID()] = NOT_EMITED_YET;
1168  }
1169  }
1170 
1171  if (r->totalPlayersRolling > 0)
1172  {
1173  r->setLoot(loot);
1174  r->itemSlot = itemSlot;
1176  r->rollVoteMask |= ROLL_FLAG_TYPE_DISENCHANT;
1177 
1179  r->rollVoteMask &= ~ROLL_FLAG_TYPE_NEED;
1180 
1181  loot->items[itemSlot].is_blocked = true;
1182 
1183  //Broadcast Pass and Send Rollstart
1184  for (Roll::PlayerVote::const_iterator itr = r->playerVote.begin(); itr != r->playerVote.end(); ++itr)
1185  {
1187  if (!p || !p->GetSession())
1188  continue;
1189 
1190  if (itr->second == PASS)
1191  SendLootRoll(newitemGUID, p->GetGUID(), 128, ROLL_PASS, *r);
1192  else
1193  SendLootStartRollToPlayer(60000, lootedObject->GetMapId(), p, p->CanRollForItemInLFG(item, lootedObject) == EQUIP_ERR_OK, *r);
1194  }
1195 
1196  RollId.push_back(r);
1197 
1198  if (Creature* creature = lootedObject->ToCreature())
1199  {
1200  creature->m_groupLootTimer = 60000;
1201  creature->lootingGroupLowGUID = GetGUID();
1202  }
1203  else if (GameObject* go = lootedObject->ToGameObject())
1204  {
1205  go->m_groupLootTimer = 60000;
1206  go->lootingGroupLowGUID = GetGUID();
1207  }
1208  }
1209  else
1210  delete r;
1211  }
1212  else
1213  i->is_underthreshold = true;
1214  }
1215 
1216  for (std::vector<LootItem>::iterator i = loot->quest_items.begin(); i != loot->quest_items.end(); ++i, ++itemSlot)
1217  {
1218  if (!i->follow_loot_rules)
1219  continue;
1220 
1221  item = sObjectMgr->GetItemTemplate(i->itemid);
1222  ObjectGuid newitemGUID = ObjectGuid::Create<HighGuid::Item>(sObjectMgr->GetGenerator<HighGuid::Item>().Generate());
1223  Roll* r = new Roll(newitemGUID, *i);
1224 
1225  for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
1226  {
1227  Player* playerToRoll = itr->GetSource();
1228  if (!playerToRoll || !playerToRoll->GetSession())
1229  continue;
1230 
1231  bool allowedForPlayer = i->AllowedForPlayer(playerToRoll);
1232  if (allowedForPlayer && playerToRoll->IsAtGroupRewardDistance(lootedObject))
1233  {
1234  r->totalPlayersRolling++;
1235  r->playerVote[playerToRoll->GetGUID()] = NOT_EMITED_YET;
1236  }
1237  }
1238 
1239  if (r->totalPlayersRolling > 0)
1240  {
1241  r->setLoot(loot);
1242  r->itemSlot = itemSlot;
1243 
1244  loot->quest_items[itemSlot - loot->items.size()].is_blocked = true;
1245 
1246  //Broadcast Pass and Send Rollstart
1247  for (Roll::PlayerVote::const_iterator itr = r->playerVote.begin(); itr != r->playerVote.end(); ++itr)
1248  {
1250  if (!p || !p->GetSession())
1251  continue;
1252 
1253  if (itr->second == PASS)
1254  SendLootRoll(newitemGUID, p->GetGUID(), 128, ROLL_PASS, *r);
1255  else
1256  SendLootStartRollToPlayer(60000, lootedObject->GetMapId(), p, p->CanRollForItemInLFG(item, lootedObject) == EQUIP_ERR_OK, *r);
1257  }
1258 
1259  RollId.push_back(r);
1260 
1261  if (Creature* creature = lootedObject->ToCreature())
1262  {
1263  creature->m_groupLootTimer = 60000;
1264  creature->lootingGroupLowGUID = GetGUID();
1265  }
1266  else if (GameObject* go = lootedObject->ToGameObject())
1267  {
1268  go->m_groupLootTimer = 60000;
1269  go->lootingGroupLowGUID = GetGUID();
1270  }
1271  }
1272  else
1273  delete r;
1274  }
1275 }
Definition: LootMgr.h:54
Rolls RollId
Definition: Group.h:412
ObjectGuid GetGUID() const
Definition: Group.cpp:2534
Definition: Group.h:53
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Creature.h:467
Definition: LootMgr.h:52
void SendLootRoll(ObjectGuid SourceGuid, ObjectGuid TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r)
Definition: Group.cpp:896
#define sObjectMgr
Definition: ObjectMgr.h:1567
GameObject * ToGameObject()
Definition: Object.h:200
Definition: Group.h:144
uint32 GetFlags2() const
Definition: ItemTemplate.h:657
Definition: Item.h:48
uint32 m_maxEnchantingLevel
Definition: Group.h:417
uint32 DisenchantID
Definition: ItemTemplate.h:711
Definition: LootMgr.h:42
Definition: GameObject.h:880
uint32 RequiredDisenchantSkill
Definition: ItemTemplate.h:712
Definition: Group.h:57
GroupReference * GetFirstMember()
Definition: Group.h:295
Definition: ItemTemplate.h:217
std::vector< LootItem > items
Definition: LootMgr.h:320
Definition: ItemTemplate.h:647
Creature * ToCreature()
Definition: Object.h:194
ItemQualities m_lootThreshold
Definition: Group.h:409
uint8_t uint8
Definition: Define.h:152
void SendLootStartRollToPlayer(uint32 countDown, uint32 mapId, Player *p, bool canNeed, Roll const &r)
Definition: Group.cpp:873
Definition: ObjectGuid.h:189
uint32_t uint32
Definition: g3dmath.h:168
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:215
std::vector< LootItem > quest_items
Definition: LootMgr.h:321
Definition: GroupReference.h:27
uint32 GetQuality() const
Definition: ItemTemplate.h:655

+ Here is the call graph for this function:

void Group::RemoveAllInvites ( )
340 {
341  for (InvitesList::iterator itr=m_invitees.begin(); itr != m_invitees.end(); ++itr)
342  if (*itr)
343  (*itr)->SetGroupInvite(NULL);
344 
345  m_invitees.clear();
346 }
InvitesList m_invitees
Definition: Group.h:398
arena_t NULL
Definition: jemalloc_internal.h:624

+ Here is the caller graph for this function:

void Group::RemoveInvite ( Player player)
331 {
332  if (player)
333  {
334  m_invitees.erase(player);
335  player->SetGroupInvite(NULL);
336  }
337 }
InvitesList m_invitees
Definition: Group.h:398
arena_t NULL
Definition: jemalloc_internal.h:624

+ Here is the caller graph for this function:

bool Group::RemoveMember ( ObjectGuid  guid,
const RemoveMethod method = GROUP_REMOVEMETHOD_DEFAULT,
ObjectGuid  kicker = ObjectGuid::Empty,
const char *  reason = NULL 
)
527 {
529 
530  sScriptMgr->OnGroupRemoveMember(this, guid, method, kicker, reason);
531 
532  // LFG group vote kick handled in scripts
533  if (isLFGGroup() && method == GROUP_REMOVEMETHOD_KICK)
534  return !m_memberSlots.empty();
535 
536  // remove member and change leader (if need) only if strong more 2 members _before_ member remove (BG/BF allow 1 member group)
537  if (GetMembersCount() > ((isBGGroup() || isLFGGroup() || isBFGroup()) ? 1u : 2u))
538  {
540  if (player)
541  {
542  // Battleground group handling
543  if (isBGGroup() || isBFGroup())
544  player->RemoveFromBattlegroundOrBattlefieldRaid();
545  else
546  // Regular group
547  {
548  if (player->GetOriginalGroup() == this)
549  player->SetOriginalGroup(NULL);
550  else
551  player->SetGroup(NULL);
552 
553  // quest related GO state dependent from raid membership
554  player->UpdateForQuestWorldObjects();
555  }
556 
557  WorldPacket data;
558 
559  if (method == GROUP_REMOVEMETHOD_KICK || method == GROUP_REMOVEMETHOD_KICK_LFG)
560  {
562  player->GetSession()->SendPacket(&data);
563  }
564 
565  _homebindIfInstance(player);
566  }
567 
568  // Remove player from group in DB
569  if (!isBGGroup() && !isBFGroup())
570  {
572  stmt->setUInt64(0, guid.GetCounter());
574  DelinkMember(guid);
575  }
576 
577  // Reevaluate group enchanter if the leaving player had enchanting skill or the player is offline
578  if (!player || player->GetSkillValue(SKILL_ENCHANTING))
580 
581  // Remove player from loot rolls
582  for (Rolls::iterator it = RollId.begin(); it != RollId.end(); ++it)
583  {
584  Roll* roll = *it;
585  Roll::PlayerVote::iterator itr2 = roll->playerVote.find(guid);
586  if (itr2 == roll->playerVote.end())
587  continue;
588 
589  if (itr2->second == GREED || itr2->second == DISENCHANT)
590  --roll->totalGreed;
591  else if (itr2->second == NEED)
592  --roll->totalNeed;
593  else if (itr2->second == PASS)
594  --roll->totalPass;
595 
596  if (itr2->second != NOT_VALID)
597  --roll->totalPlayersRolling;
598 
599  roll->playerVote.erase(itr2);
600 
601  CountRollVote(guid, roll->itemGUID, MAX_ROLL_TYPE);
602  }
603 
604  // Update subgroups
605  member_witerator slot = _getMemberWSlot(guid);
606  if (slot != m_memberSlots.end())
607  {
608  SubGroupCounterDecrease(slot->group);
609  m_memberSlots.erase(slot);
610  }
611 
612  // Pick new leader if necessary
613  if (m_leaderGuid == guid)
614  {
615  for (member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
616  {
618  {
619  ChangeLeader(itr->guid);
620  break;
621  }
622  }
623  }
624 
625  SendUpdate();
626 
627  if (isLFGGroup() && GetMembersCount() == 1)
628  {
630  uint32 mapId = sLFGMgr->GetDungeonMapId(GetGUID());
631  if (!mapId || !leader || (leader->IsAlive() && leader->GetMapId() != mapId))
632  {
633  Disband();
634  return false;
635  }
636  }
637 
638  if (m_memberMgr.getSize() < ((isLFGGroup() || isBGGroup()) ? 1u : 2u))
639  Disband();
640 
641  return true;
642  }
643  // If group size before player removal <= 2 then disband it
644  else
645  {
646  Disband();
647  return false;
648  }
649 }
ObjectGuid GetLeaderGUID() const
Definition: Group.cpp:2529
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
MemberSlotList::iterator member_witerator
Definition: Group.h:209
Definition: CharacterDatabase.h:331
Rolls RollId
Definition: Group.h:412
uint8 totalPlayersRolling
Definition: Group.h:160
ObjectGuid GetGUID() const
Definition: Group.cpp:2534
PlayerVote playerVote
Definition: Group.h:159
Definition: SharedDefines.h:3973
void BroadcastGroupUpdate(void)
Definition: Group.cpp:2283
Definition: LootMgr.h:46
void _homebindIfInstance(Player *player)
Definition: Group.cpp:2277
void DelinkMember(ObjectGuid guid)
Definition: Group.cpp:2685
Definition: Group.h:53
uint32 getSize() const
Definition: LinkedList.h:120
arena_t NULL
Definition: jemalloc_internal.h:624
void CountRollVote(ObjectGuid playerGUID, ObjectGuid Guid, uint8 Choise)
Definition: Group.cpp:1325
Definition: PreparedStatement.h:74
Definition: Group.h:144
ObjectGuid itemGUID
Definition: Group.h:153
Definition: SharedDefines.h:4688
uint8 totalNeed
Definition: Group.h:161
Definition: Opcodes.h:1063
MemberSlotList m_memberSlots
Definition: Group.h:396
Definition: Group.h:54
Definition: Group.h:56
GroupRefManager m_memberMgr
Definition: Group.h:397
#define sLFGMgr
Definition: LFGMgr.h:481
member_witerator _getMemberWSlot(ObjectGuid Guid)
Definition: Group.cpp:2725
ObjectGuid m_leaderGuid
Definition: Group.h:399
uint32_t uint32
Definition: Define.h:150
bool isBGGroup() const
Definition: Group.cpp:2514
void ResetMaxEnchantingLevel()
Definition: Group.cpp:2299
Definition: Group.h:55
void SubGroupCounterDecrease(uint8 subgroup)
Definition: Group.cpp:2739
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
bool isLFGGroup() const
Definition: Group.cpp:2504
bool isBFGroup() const
Definition: Group.cpp:2519
void Disband(bool hideDestroy=false)
Definition: Group.cpp:757
uint32 GetMembersCount() const
Definition: Group.h:297
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
void Initialize(uint32 opcode, size_t newres=200, ConnectionType connection=CONNECTION_TYPE_DEFAULT)
Definition: WorldPacket.h:71
Definition: Group.h:58
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: SharedDefines.h:4690
#define sScriptMgr
Definition: ScriptMgr.h:837
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:215
Definition: WorldPacket.h:26
uint8 totalPass
Definition: Group.h:163
void SendUpdate()
Definition: Group.cpp:1567
LowType GetCounter() const
Definition: ObjectGuid.h:221
void ChangeLeader(ObjectGuid guid, int8 partyIndex=0)
Definition: Group.cpp:651
uint8 totalGreed
Definition: Group.h:162

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::RemoveUniqueGroupMemberFlag ( GroupMemberFlags  flag)
2746 {
2747  for (member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
2748  if (itr->flags & flag)
2749  itr->flags &= ~flag;
2750 }
MemberSlotList::iterator member_witerator
Definition: Group.h:209
MemberSlotList m_memberSlots
Definition: Group.h:396

+ Here is the caller graph for this function:

void Group::ResetInstances ( uint8  method,
bool  isRaid,
bool  isLegacy,
Player SendMsgTo 
)
2097 {
2098  if (isBGGroup() || isBFGroup())
2099  return;
2100 
2101  // method can be INSTANCE_RESET_ALL, INSTANCE_RESET_CHANGE_DIFFICULTY, INSTANCE_RESET_GROUP_DISBAND
2102 
2103  // we assume that when the difficulty changes, all instances that can be reset will be
2105  if (isRaid)
2106  {
2107  if (!isLegacy)
2108  diff = GetRaidDifficultyID();
2109  else
2110  diff = GetLegacyRaidDifficultyID();
2111  }
2112 
2113  for (BoundInstancesMap::iterator itr = m_boundInstances[diff].begin(); itr != m_boundInstances[diff].end();)
2114  {
2115  InstanceSave* instanceSave = itr->second.save;
2116  const MapEntry* entry = sMapStore.LookupEntry(itr->first);
2117  if (!entry || entry->IsRaid() != isRaid || (!instanceSave->CanReset() && method != INSTANCE_RESET_GROUP_DISBAND))
2118  {
2119  ++itr;
2120  continue;
2121  }
2122 
2123  if (method == INSTANCE_RESET_ALL)
2124  {
2125  // the "reset all instances" method can only reset normal maps
2126  if (entry->IsRaid() || diff == DIFFICULTY_HEROIC)
2127  {
2128  ++itr;
2129  continue;
2130  }
2131  }
2132 
2133  bool isEmpty = true;
2134  // if the map is loaded, reset it
2135  Map* map = sMapMgr->FindMap(instanceSave->GetMapId(), instanceSave->GetInstanceId());
2136  if (map && map->IsDungeon() && !(method == INSTANCE_RESET_GROUP_DISBAND && !instanceSave->CanReset()))
2137  {
2138  if (instanceSave->CanReset())
2139  isEmpty = ((InstanceMap*)map)->Reset(method);
2140  else
2141  isEmpty = !map->HavePlayers();
2142  }
2143 
2144  if (SendMsgTo)
2145  {
2146  if (!isEmpty)
2147  SendMsgTo->SendResetInstanceFailed(INSTANCE_RESET_FAILED, instanceSave->GetMapId());
2148  else if (sWorld->getBoolConfig(CONFIG_INSTANCES_RESET_ANNOUNCE))
2149  {
2150  if (Group* group = SendMsgTo->GetGroup())
2151  {
2152  for (GroupReference* groupRef = group->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next())
2153  if (Player* player = groupRef->GetSource())
2154  player->SendResetInstanceSuccess(instanceSave->GetMapId());
2155  }
2156 
2157  else
2158  SendMsgTo->SendResetInstanceSuccess(instanceSave->GetMapId());
2159  }
2160  else
2161  SendMsgTo->SendResetInstanceSuccess(instanceSave->GetMapId());
2162  }
2163 
2164  if (isEmpty || method == INSTANCE_RESET_GROUP_DISBAND || method == INSTANCE_RESET_CHANGE_DIFFICULTY)
2165  {
2166  // do not reset the instance, just unbind if others are permanently bound to it
2167  if (isEmpty && instanceSave->CanReset())
2168  instanceSave->DeleteFromDB();
2169  else
2170  {
2172 
2173  stmt->setUInt32(0, instanceSave->GetInstanceId());
2174 
2175  CharacterDatabase.Execute(stmt);
2176  }
2177 
2178 
2179  // i don't know for sure if hash_map iterators
2180  m_boundInstances[diff].erase(itr);
2181  itr = m_boundInstances[diff].begin();
2182  // this unloads the instance save unless online players are bound to it
2183  // (eg. permanent binds or GM solo binds)
2184  instanceSave->RemoveGroup(this);
2185  }
2186  else
2187  ++itr;
2188  }
2189 }
Definition: SharedDefines.h:4908
Definition: DBCEnums.h:406
Difficulty
Definition: DBCEnums.h:402
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
Definition: Map.h:753
Definition: Map.h:750
Definition: DBCStructure.h:830
arena_t NULL
Definition: jemalloc_internal.h:624
bool IsDungeon() const
Definition: Map.h:395
#define sWorld
Definition: World.h:887
Definition: PreparedStatement.h:74
void DeleteFromDB()
Definition: InstanceSaveMgr.cpp:237
Difficulty GetLegacyRaidDifficultyID() const
Definition: Group.h:322
Definition: CharacterDatabase.h:351
BoundInstancesMap m_boundInstances[MAX_DIFFICULTY]
Definition: Group.h:413
Definition: Map.h:758
Definition: World.h:172
bool isBGGroup() const
Definition: Group.cpp:2514
bool HavePlayers() const
Definition: Map.h:423
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
Definition: Map.h:259
Definition: InstanceSaveMgr.h:44
Difficulty GetRaidDifficultyID() const
Definition: Group.h:321
Difficulty GetDungeonDifficultyID() const
Definition: Group.h:320
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
bool IsRaid() const
Definition: DBCStructure.h:860
uint32 GetMapId() const
Definition: InstanceSaveMgr.h:65
bool isBFGroup() const
Definition: Group.cpp:2519
DBCStorage< MapEntry > sMapStore(Mapfmt)
#define sMapMgr
Definition: MapManager.h:194
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
bool CanReset() const
Definition: InstanceSaveMgr.h:116
bool RemoveGroup(Group *group)
Definition: InstanceSaveMgr.h:104
uint32 GetInstanceId() const
Definition: InstanceSaveMgr.h:64
Definition: Group.h:191
Definition: GroupReference.h:27

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::ResetMaxEnchantingLevel ( )
2300 {
2302  Player* member = NULL;
2303  for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
2304  {
2305  member = ObjectAccessor::FindPlayer(citr->guid);
2306  if (member && m_maxEnchantingLevel < member->GetSkillValue(SKILL_ENCHANTING))
2307  m_maxEnchantingLevel = member->GetSkillValue(SKILL_ENCHANTING);
2308  }
2309 }
MemberSlotList::const_iterator member_citerator
Definition: Group.h:205
Definition: SharedDefines.h:3973
arena_t NULL
Definition: jemalloc_internal.h:624
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:209
MemberSlotList m_memberSlots
Definition: Group.h:396
uint32 m_maxEnchantingLevel
Definition: Group.h:417

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::ResetMemberReadyChecked ( void  )
2452 {
2453  for (member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
2454  itr->readyChecked = false;
2455 }
MemberSlotList::iterator member_witerator
Definition: Group.h:209
MemberSlotList m_memberSlots
Definition: Group.h:396

+ Here is the caller graph for this function:

bool Group::SameSubGroup ( ObjectGuid  guid1,
ObjectGuid  guid2 
) const
2593 {
2594  member_citerator mslot2 = _getMemberCSlot(guid2);
2595  if (mslot2 == m_memberSlots.end())
2596  return false;
2597  return SameSubGroup(guid1, &*mslot2);
2598 }
MemberSlotList::const_iterator member_citerator
Definition: Group.h:205
MemberSlotList m_memberSlots
Definition: Group.h:396
bool SameSubGroup(ObjectGuid guid1, ObjectGuid guid2) const
Definition: Group.cpp:2592
member_citerator _getMemberCSlot(ObjectGuid Guid) const
Definition: Group.cpp:2717

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Group::SameSubGroup ( ObjectGuid  guid1,
MemberSlot const slot2 
) const
2601 {
2602  member_citerator mslot1 = _getMemberCSlot(guid1);
2603  if (mslot1 == m_memberSlots.end() || !slot2)
2604  return false;
2605  return (mslot1->group == slot2->group);
2606 }
MemberSlotList::const_iterator member_citerator
Definition: Group.h:205
MemberSlotList m_memberSlots
Definition: Group.h:396
member_citerator _getMemberCSlot(ObjectGuid Guid) const
Definition: Group.cpp:2717

+ Here is the call graph for this function:

bool Group::SameSubGroup ( Player const member1,
Player const member2 
) const
1735 {
1736  if (!member1 || !member2)
1737  return false;
1738 
1739  if (member1->GetGroup() != this || member2->GetGroup() != this)
1740  return false;
1741  else
1742  return member1->GetSubGroup() == member2->GetSubGroup();
1743 }
void Group::SendLootAllPassed ( Roll const roll)
944 {
945  WorldPacket data(SMSG_LOOT_ALL_PASSED, (8+4+4+4+4));
946  data << roll.itemGUID; // Guid of the item rolled
947  data << uint32(roll.itemSlot); // Item loot slot
948  data << uint32(roll.itemid); // The itemEntryId for the item that shall be rolled for
949  data << uint32(roll.itemRandomPropId); // Item random property ID
950  data << uint32(roll.itemRandomSuffix); // Item random suffix ID
951 
952  for (Roll::PlayerVote::const_iterator itr = roll.playerVote.begin(); itr != roll.playerVote.end(); ++itr)
953  {
954  Player* player = ObjectAccessor::FindConnectedPlayer(itr->first);
955  if (!player || !player->GetSession())
956  continue;
957 
958  if (itr->second != NOT_VALID)
959  player->GetSession()->SendPacket(&data);
960  }
961 }
Definition: Opcodes.h:1198
Definition: Group.h:58
uint32_t uint32
Definition: g3dmath.h:168
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:215
Definition: WorldPacket.h:26

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::SendLooter ( Creature creature,
Player pLooter 
)
965 {
966  ASSERT(creature);
967 
969 
970  lootList.Owner = creature->GetGUID();
971 
972  if (GetLootMethod() == MASTER_LOOT && creature->loot.hasOverThresholdItem())
973  lootList.Master = GetMasterLooterGuid();
974 
975  if (groupLooter)
976  lootList.RoundRobinWinner = groupLooter->GetGUID();
977 
978  BroadcastPacket(lootList.Write(), false);
979 }
Optional< ObjectGuid > Master
Definition: LootPackets.h:178
Loot loot
Definition: Creature.h:578
ObjectGuid GetMasterLooterGuid() const
Definition: Group.cpp:2556
Definition: LootPackets.h:170
ObjectGuid const & GetGUID() const
Definition: Object.h:105
ObjectGuid Owner
Definition: LootPackets.h:177
bool hasOverThresholdItem() const
Definition: LootMgr.cpp:849
#define ASSERT
Definition: Errors.h:55
LootMethod GetLootMethod() const
Definition: Group.cpp:2544
void BroadcastPacket(WorldPacket const *packet, bool ignorePlayersInBGRaid, int group=-1, ObjectGuid ignoredPlayer=ObjectGuid::Empty)
Definition: Group.cpp:1698
WorldPacket const * Write() override
Definition: LootPackets.cpp:125
Optional< ObjectGuid > RoundRobinWinner
Definition: LootPackets.h:179
Definition: LootMgr.h:69

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::SendLootRoll ( ObjectGuid  SourceGuid,
ObjectGuid  TargetGuid,
uint8  RollNumber,
uint8  RollType,
const Roll r 
)
897 {
898  WorldPacket data(SMSG_LOOT_ROLL, (8+4+8+4+4+4+1+1+1));
899  data << sourceGuid; // guid of the item rolled
900  data << uint32(roll.itemSlot); // slot
901  data << targetGuid;
902  data << uint32(roll.itemid); // the itemEntryId for the item that shall be rolled for
903  data << uint32(roll.itemRandomSuffix); // randomSuffix
904  data << uint32(roll.itemRandomPropId); // Item random property ID
905  data << uint32(rollNumber); // 0: "Need for: [item name]" > 127: "you passed on: [item name]" Roll number
906  data << uint8(rollType); // 0: "Need for: [item name]" 0: "You have selected need for [item name] 1: need roll 2: greed roll
907  data << uint8(0); // 1: "You automatically passed on: %s because you cannot loot that item." - Possibly used in need befor greed
908 
909  for (Roll::PlayerVote::const_iterator itr = roll.playerVote.begin(); itr != roll.playerVote.end(); ++itr)
910  {
912  if (!p || !p->GetSession())
913  continue;
914 
915  if (itr->second != NOT_VALID)
916  p->GetSession()->SendPacket(&data);
917  }
918 }
Definition: Opcodes.h:1207
uint8_t uint8
Definition: g3dmath.h:164
Definition: Group.h:58
uint32_t uint32
Definition: g3dmath.h:168
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:215
Definition: WorldPacket.h:26

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::SendLootRollWon ( ObjectGuid  SourceGuid,
ObjectGuid  TargetGuid,
uint8  RollNumber,
uint8  RollType,
const Roll r 
)
921 {
922  WorldPacket data(SMSG_LOOT_ROLL_WON, (8+4+4+4+4+8+1+1));
923  data << sourceGuid; // guid of the item rolled
924  data << uint32(roll.itemSlot); // slot
925  data << uint32(roll.itemid); // the itemEntryId for the item that shall be rolled for
926  data << uint32(roll.itemRandomSuffix); // randomSuffix
927  data << uint32(roll.itemRandomPropId); // Item random property
928  data << targetGuid; // guid of the player who won.
929  data << uint32(rollNumber); // rollnumber realted to SMSG_LOOT_ROLL
930  data << uint8(rollType); // rollType related to SMSG_LOOT_ROLL
931 
932  for (Roll::PlayerVote::const_iterator itr = roll.playerVote.begin(); itr != roll.playerVote.end(); ++itr)
933  {
935  if (!p || !p->GetSession())
936  continue;
937 
938  if (itr->second != NOT_VALID)
939  p->GetSession()->SendPacket(&data);
940  }
941 }
Definition: Opcodes.h:1209
uint8_t uint8
Definition: g3dmath.h:164
Definition: Group.h:58
uint32_t uint32
Definition: g3dmath.h:168
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:215
Definition: WorldPacket.h:26

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::SendLootStartRoll ( uint32  CountDown,
uint32  mapid,
const Roll r 
)
849 {
850  WorldPacket data(SMSG_START_LOOT_ROLL, (8+4+4+4+4+4+4+1));
851  data << r.itemGUID; // guid of rolled item
852  data << uint32(mapid); // 3.3.3 mapid
853  data << uint32(r.itemSlot); // itemslot
854  data << uint32(r.itemid); // the itemEntryId for the item that shall be rolled for
855  data << uint32(r.itemRandomSuffix); // randomSuffix
856  data << uint32(r.itemRandomPropId); // item random property ID
857  data << uint32(r.itemCount); // items in stack
858  data << uint32(countDown); // the countdown time to choose "need" or "greed"
859  data << uint8(r.rollVoteMask); // roll type mask
860  data << uint8(r.totalPlayersRolling); // maybe the number of players rolling for it???
861 
862  for (Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr != r.playerVote.end(); ++itr)
863  {
865  if (!p || !p->GetSession())
866  continue;
867 
868  if (itr->second == NOT_EMITED_YET)
869  p->GetSession()->SendPacket(&data);
870  }
871 }
uint8 totalPlayersRolling
Definition: Group.h:160
uint32 itemRandomSuffix
Definition: Group.h:156
PlayerVote playerVote
Definition: Group.h:159
Definition: Opcodes.h:1553
uint8 rollVoteMask
Definition: Group.h:165
uint32 itemid
Definition: Group.h:154
int32 itemRandomPropId
Definition: Group.h:155
ObjectGuid itemGUID
Definition: Group.h:153
uint8 itemCount
Definition: Group.h:157
Definition: Group.h:57
uint8_t uint8
Definition: g3dmath.h:164
uint32_t uint32
Definition: g3dmath.h:168
uint8 itemSlot
Definition: Group.h:164
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:215
Definition: WorldPacket.h:26

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::SendLootStartRollToPlayer ( uint32  countDown,
uint32  mapId,
Player p,
bool  canNeed,
Roll const r 
)
874 {
875  if (!p || !p->GetSession())
876  return;
877 
878  WorldPacket data(SMSG_START_LOOT_ROLL, (8 + 4 + 4 + 4 + 4 + 4 + 4 + 1));
879  data << r.itemGUID; // guid of rolled item
880  data << uint32(mapId); // 3.3.3 mapid
881  data << uint32(r.itemSlot); // itemslot
882  data << uint32(r.itemid); // the itemEntryId for the item that shall be rolled for
883  data << uint32(r.itemRandomSuffix); // randomSuffix
884  data << uint32(r.itemRandomPropId); // item random property ID
885  data << uint32(r.itemCount); // items in stack
886  data << uint32(countDown); // the countdown time to choose "need" or "greed"
887  uint8 voteMask = r.rollVoteMask;
888  if (!canNeed)
889  voteMask &= ~ROLL_FLAG_TYPE_NEED;
890  data << uint8(voteMask); // roll type mask
891  data << uint8(r.totalPlayersRolling); // maybe the number of players rolling for it???
892 
893  p->GetSession()->SendPacket(&data);
894 }
Definition: Opcodes.h:1553
Definition: LootMgr.h:52
uint8_t uint8
Definition: g3dmath.h:164
uint8_t uint8
Definition: Define.h:152
uint32_t uint32
Definition: g3dmath.h:168
Definition: WorldPacket.h:26

+ Here is the caller graph for this function:

void Group::SendRaidMarkersChanged ( WorldSession session = nullptr,
int8  partyIndex = 0 
)
2483 {
2485 
2486  packet.PartyIndex = partyIndex;
2487  packet.ActiveMarkers = m_activeMarkers;
2488 
2489  for (uint8 i = 0; i < RAID_MARKERS_COUNT; i++)
2490  if (m_markers[i])
2491  packet.RaidMarkers.push_back(m_markers[i].get());
2492 
2493  if (session)
2494  session->SendPacket(packet.Write());
2495  else
2496  BroadcastPacket(packet.Write(), false);
2497 }
uint32 m_activeMarkers
Definition: Group.h:426
WorldPacket const * Write() override
Definition: PartyPackets.cpp:394
std::vector< RaidMarker * > RaidMarkers
Definition: PartyPackets.h:607
uint32 ActiveMarkers
Definition: PartyPackets.h:605
std::array< std::unique_ptr< RaidMarker >, RAID_MARKERS_COUNT > m_markers
Definition: Group.h:425
Definition: PartyPackets.h:597
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:211
#define RAID_MARKERS_COUNT
Definition: Group.h:47
int8 PartyIndex
Definition: PartyPackets.h:604
uint8_t uint8
Definition: Define.h:152
void BroadcastPacket(WorldPacket const *packet, bool ignorePlayersInBGRaid, int group=-1, ObjectGuid ignoredPlayer=ObjectGuid::Empty)
Definition: Group.cpp:1698

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::SendTargetIconList ( WorldSession session,
int8  partyIndex = 0 
)
1555 {
1556  if (!session)
1557  return;
1558 
1560  updateAll.PartyIndex = partyIndex;
1561  for (uint8 i = 0; i < TARGET_ICONS_COUNT; i++)
1562  updateAll.TargetIcons.insert(std::pair<uint8, ObjectGuid>(i, m_targetIcons[i]));
1563 
1564  session->SendPacket(updateAll.Write());
1565 }
#define TARGET_ICONS_COUNT
Definition: Group.h:46
ObjectGuid m_targetIcons[TARGET_ICONS_COUNT]
Definition: Group.h:407
std::map< uint8, ObjectGuid > TargetIcons
Definition: PartyPackets.h:330
Definition: PartyPackets.h:322
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:211
uint8_t uint8
Definition: Define.h:152
WorldPacket const * Write() override
Definition: PartyPackets.cpp:237
int8 PartyIndex
Definition: PartyPackets.h:329

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::SendUpdate ( )
1568 {
1569  for (member_witerator witr = m_memberSlots.begin(); witr != m_memberSlots.end(); ++witr)
1570  SendUpdateToPlayer(witr->guid, &(*witr));
1571 }
MemberSlotList::iterator member_witerator
Definition: Group.h:209
MemberSlotList m_memberSlots
Definition: Group.h:396
void SendUpdateToPlayer(ObjectGuid playerGUID, MemberSlot *slot=NULL)
Definition: Group.cpp:1573

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::SendUpdateToPlayer ( ObjectGuid  playerGUID,
MemberSlot slot = NULL 
)
1574 {
1575  Player* player = ObjectAccessor::FindConnectedPlayer(playerGUID);
1576 
1577  if (!player || !player->GetSession() || player->GetGroup() != this)
1578  return;
1579 
1580  // if MemberSlot wasn't provided
1581  if (!slot)
1582  {
1583  member_witerator witr = _getMemberWSlot(playerGUID);
1584 
1585  if (witr == m_memberSlots.end()) // if there is no MemberSlot for such a player
1586  return;
1587 
1588  slot = &(*witr);
1589  }
1590 
1592 
1593  partyUpdate.PartyType = m_groupType;
1594  partyUpdate.PartyIndex = 0;
1595  partyUpdate.PartyFlags = uint8(IsCreated());
1596 
1597  partyUpdate.PartyGUID = m_guid;
1598  partyUpdate.LeaderGUID = m_leaderGuid;
1599 
1600  partyUpdate.SequenceNum = m_counter++; // 3.3, value increases every time this packet gets sent
1601 
1602  partyUpdate.MyIndex = -1;
1603  uint8 index = 0;
1604  for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr, ++index)
1605  {
1606  if (slot->guid == citr->guid)
1607  partyUpdate.MyIndex = index;
1608 
1609  Player* member = ObjectAccessor::FindConnectedPlayer(citr->guid);
1610 
1612 
1613  playerInfos.GUID = citr->guid;
1614  playerInfos.Name = citr->name;
1615  playerInfos.Class = citr->_class;
1616 
1617  playerInfos.Status = MEMBER_STATUS_OFFLINE;
1618  if (member && member->GetSession() && !member->GetSession()->PlayerLogout())
1619  playerInfos.Status = MEMBER_STATUS_ONLINE | (isBGGroup() || isBFGroup() ? MEMBER_STATUS_PVP : 0);
1620 
1621  playerInfos.Subgroup = citr->group; // groupid
1622  playerInfos.Flags = citr->flags; // See enum GroupMemberFlags
1623  playerInfos.RolesAssigned = citr->roles; // Lfg Roles
1624 
1625  partyUpdate.PlayerList.push_back(playerInfos);
1626  }
1627 
1628  if (GetMembersCount() > 1)
1629  {
1630  // LootSettings
1631  partyUpdate.LootSettings = boost::in_place();
1632  partyUpdate.LootSettings->Method = m_lootMethod;
1633  partyUpdate.LootSettings->Threshold = m_lootThreshold;
1635 
1636  // Difficulty Settings
1637  partyUpdate.DifficultySettings = boost::in_place();
1638  partyUpdate.DifficultySettings->DungeonDifficultyID = m_dungeonDifficulty;
1639  partyUpdate.DifficultySettings->RaidDifficultyID = m_raidDifficulty;
1640  partyUpdate.DifficultySettings->LegacyRaidDifficultyID = m_legacyRaidDifficulty;
1641  }
1642 
1643  // LfgInfos
1644  if (isLFGGroup())
1645  {
1646  partyUpdate.LfgInfos = boost::in_place();
1647 
1648  partyUpdate.LfgInfos->Slot = sLFGMgr->GetDungeon(m_guid);
1649  partyUpdate.LfgInfos->BootCount = 0; // new 6.x
1650  partyUpdate.LfgInfos->Aborted = false; // new 6.x
1651 
1652  partyUpdate.LfgInfos->MyFlags = 0; // new 6.x
1653  partyUpdate.LfgInfos->MyRandomSlot = 0; // new 6.x
1654 
1655  partyUpdate.LfgInfos->MyPartialClear = sLFGMgr->GetState(m_guid) == lfg::LFG_STATE_FINISHED_DUNGEON ? 2 : 0; // FIXME - Dungeon save status? 2 = done
1656  partyUpdate.LfgInfos->MyGearDiff = 0.f; // new 6.x
1657  partyUpdate.LfgInfos->MyFirstReward = false; // new 6.x
1658 
1659  partyUpdate.LfgInfos->MyStrangerCount = 0; // new 6.x
1660  partyUpdate.LfgInfos->MyKickVoteCount = 0; // new 6.x
1661  }
1662 
1663  player->GetSession()->SendPacket(partyUpdate.Write());
1664 }
std::vector< GroupPlayerInfos > PlayerList
Definition: PartyPackets.h:545
ObjectGuid GUID
Definition: PartyPackets.h:486
Definition: Group.h:63
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
MemberSlotList::iterator member_witerator
Definition: Group.h:209
uint8 Status
Definition: PartyPackets.h:490
MemberSlotList::const_iterator member_citerator
Definition: Group.h:205
Difficulty m_dungeonDifficulty
Definition: Group.h:402
Optional< GroupDifficultySettings > DifficultySettings
Definition: PartyPackets.h:549
Optional< GroupLootSettings > LootSettings
Definition: PartyPackets.h:548
uint32 m_counter
Definition: Group.h:416
int8 PartyType
Definition: PartyPackets.h:537
LootMethod m_lootMethod
Definition: Group.h:408
int32 SequenceNum
Definition: PartyPackets.h:543
ObjectGuid m_guid
Definition: Group.h:415
int8 PartyFlags
Definition: PartyPackets.h:535
uint8 RolesAssigned
Definition: PartyPackets.h:493
MemberSlotList m_memberSlots
Definition: Group.h:396
bool IsCreated() const
Definition: Group.cpp:2524
std::string Name
Definition: PartyPackets.h:487
#define sLFGMgr
Definition: LFGMgr.h:481
member_witerator _getMemberWSlot(ObjectGuid Guid)
Definition: Group.cpp:2725
ObjectGuid m_leaderGuid
Definition: Group.h:399
uint8 Subgroup
Definition: PartyPackets.h:491
bool isBGGroup() const
Definition: Group.cpp:2514
int8 PartyIndex
Definition: PartyPackets.h:536
ObjectGuid m_masterLooterGuid
Definition: Group.h:411
bool isLFGGroup() const
Definition: Group.cpp:2504
GroupType m_groupType
Definition: Group.h:401
uint8 Flags
Definition: PartyPackets.h:492
int32 MyIndex
Definition: PartyPackets.h:542
uint8_t uint8
Definition: g3dmath.h:164
bool isBFGroup() const
Definition: Group.cpp:2519
Optional< GroupLfgInfos > LfgInfos
Definition: PartyPackets.h:547
ObjectGuid LeaderGUID
Definition: PartyPackets.h:540
uint32 GetMembersCount() const
Definition: Group.h:297
uint8 Class
Definition: PartyPackets.h:488
ItemQualities m_lootThreshold
Definition: Group.h:409
uint8_t uint8
Definition: Define.h:152
ObjectGuid PartyGUID
Definition: PartyPackets.h:539
Difficulty m_legacyRaidDifficulty
Definition: Group.h:404
Definition: PartyPackets.h:528
Definition: PartyPackets.h:484
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:215
Difficulty m_raidDifficulty
Definition: Group.h:403
Definition: Group.h:65
Definition: Group.h:64
Definition: LootMgr.h:69
WorldPacket const * Write() override
Definition: PartyPackets.cpp:338

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::SetBattlefieldGroup ( Battlefield bf)
2627 {
2628  m_bfGroup = bg;
2629 }
Battlefield * m_bfGroup
Definition: Group.h:406

+ Here is the caller graph for this function:

void Group::SetBattlegroundGroup ( Battleground bg)
2622 {
2623  m_bgGroup = bg;
2624 }
Battleground * m_bgGroup
Definition: Group.h:405

+ Here is the caller graph for this function:

void Group::SetDungeonDifficultyID ( Difficulty  difficulty)
2009 {
2010  m_dungeonDifficulty = difficulty;
2011  if (!isBGGroup() && !isBFGroup())
2012  {
2014 
2015  stmt->setUInt8(0, uint8(m_dungeonDifficulty));
2016  stmt->setUInt32(1, m_dbStoreId);
2017 
2018  CharacterDatabase.Execute(stmt);
2019  }
2020 
2021  for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
2022  {
2023  Player* player = itr->GetSource();
2024  if (!player->GetSession())
2025  continue;
2026 
2027  player->SetDungeonDifficultyID(difficulty);
2028  player->SendDungeonDifficulty();
2029  }
2030 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
uint32 m_dbStoreId
Definition: Group.h:418
Difficulty m_dungeonDifficulty
Definition: Group.h:402
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: PreparedStatement.h:74
bool isBGGroup() const
Definition: Group.cpp:2514
GroupReference * GetFirstMember()
Definition: Group.h:295
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
uint8_t uint8
Definition: g3dmath.h:164
bool isBFGroup() const
Definition: Group.cpp:2519
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: CharacterDatabase.h:337
Definition: GroupReference.h:27

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::SetEveryoneIsAssistant ( bool  apply)
2761 {
2762  if (apply)
2764  else
2766 
2767  for (member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
2769 
2770  SendUpdate();
2771 }
Definition: Group.h:76
MemberSlotList::iterator member_witerator
Definition: Group.h:209
void apply(T *val)
Definition: ByteConverter.h:41
void ToggleGroupMemberFlag(member_witerator slot, uint8 flag, bool apply)
Definition: Group.cpp:2752
GroupType
Definition: Group.h:87
MemberSlotList m_memberSlots
Definition: Group.h:396
GroupType m_groupType
Definition: Group.h:401
void SendUpdate()
Definition: Group.cpp:1567
Definition: Group.h:95

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::SetGroupMemberFlag ( ObjectGuid  guid,
bool  apply,
GroupMemberFlags  flag 
)
2632 {
2633  // Assistants, main assistants and main tanks are only available in raid groups
2634  if (!isRaidGroup())
2635  return;
2636 
2637  // Check if player is really in the raid
2638  member_witerator slot = _getMemberWSlot(guid);
2639  if (slot == m_memberSlots.end())
2640  return;
2641 
2642  // Do flag specific actions, e.g ensure uniqueness
2643  switch (flag) {
2645  RemoveUniqueGroupMemberFlag(MEMBER_FLAG_MAINASSIST); // Remove main assist flag from current if any.
2646  break;
2647  case MEMBER_FLAG_MAINTANK:
2648  RemoveUniqueGroupMemberFlag(MEMBER_FLAG_MAINTANK); // Remove main tank flag from current if any.
2649  break;
2650  case MEMBER_FLAG_ASSISTANT:
2651  break;
2652  default:
2653  return; // This should never happen
2654  }
2655 
2656  // Switch the actual flag
2657  ToggleGroupMemberFlag(slot, flag, apply);
2658 
2659  // Preserve the new setting in the db
2661 
2662  stmt->setUInt8(0, slot->flags);
2663  stmt->setUInt64(1, guid.GetCounter());
2664 
2665  CharacterDatabase.Execute(stmt);
2666 
2667  // Broadcast the changes to the group
2668  SendUpdate();
2669 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
Definition: Group.h:76
MemberSlotList::iterator member_witerator
Definition: Group.h:209
bool isRaidGroup() const
Definition: Group.cpp:2509
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
Definition: CharacterDatabase.h:336
void apply(T *val)
Definition: ByteConverter.h:41
Definition: PreparedStatement.h:74
void ToggleGroupMemberFlag(member_witerator slot, uint8 flag, bool apply)
Definition: Group.cpp:2752
void RemoveUniqueGroupMemberFlag(GroupMemberFlags flag)
Definition: Group.cpp:2745
MemberSlotList m_memberSlots
Definition: Group.h:396
Definition: Group.h:77
member_witerator _getMemberWSlot(ObjectGuid Guid)
Definition: Group.cpp:2725
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
Definition: Group.h:78
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
void SendUpdate()
Definition: Group.cpp:1567
LowType GetCounter() const
Definition: ObjectGuid.h:221

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::SetLegacyRaidDifficultyID ( Difficulty  difficulty)
2057 {
2058  m_legacyRaidDifficulty = difficulty;
2059  if (!isBGGroup() && !isBFGroup())
2060  {
2062 
2064  stmt->setUInt32(1, m_dbStoreId);
2065 
2066  CharacterDatabase.Execute(stmt);
2067  }
2068 
2069  for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
2070  {
2071  Player* player = itr->GetSource();
2072  if (!player->GetSession())
2073  continue;
2074 
2075  player->SetLegacyRaidDifficultyID(difficulty);
2076  player->SendRaidDifficulty(true);
2077  }
2078 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
uint32 m_dbStoreId
Definition: Group.h:418
Definition: CharacterDatabase.h:339
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: PreparedStatement.h:74
bool isBGGroup() const
Definition: Group.cpp:2514
GroupReference * GetFirstMember()
Definition: Group.h:295
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
uint8_t uint8
Definition: g3dmath.h:164
bool isBFGroup() const
Definition: Group.cpp:2519
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Difficulty m_legacyRaidDifficulty
Definition: Group.h:404
Definition: GroupReference.h:27

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::SetLfgRoles ( ObjectGuid  guid,
uint8  roles 
)
2332 {
2333  member_witerator slot = _getMemberWSlot(guid);
2334  if (slot == m_memberSlots.end())
2335  return;
2336 
2337  slot->roles = roles;
2338  SendUpdate();
2339 }
MemberSlotList::iterator member_witerator
Definition: Group.h:209
MemberSlotList m_memberSlots
Definition: Group.h:396
member_witerator _getMemberWSlot(ObjectGuid Guid)
Definition: Group.cpp:2725
void SendUpdate()
Definition: Group.cpp:1567

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::SetLooterGuid ( ObjectGuid  guid)
2317 {
2318  m_looterGuid = guid;
2319 }
ObjectGuid m_looterGuid
Definition: Group.h:410

+ Here is the caller graph for this function:

void Group::SetLootMethod ( LootMethod  method)
2312 {
2313  m_lootMethod = method;
2314 }
LootMethod m_lootMethod
Definition: Group.h:408

+ Here is the caller graph for this function:

void Group::SetLootThreshold ( ItemQualities  threshold)
2327 {
2328  m_lootThreshold = threshold;
2329 }
ItemQualities m_lootThreshold
Definition: Group.h:409

+ Here is the caller graph for this function:

void Group::SetMasterLooterGuid ( ObjectGuid  guid)
2322 {
2323  m_masterLooterGuid = guid;
2324 }
ObjectGuid m_masterLooterGuid
Definition: Group.h:411

+ Here is the caller graph for this function:

void Group::SetMemberReadyCheck ( ObjectGuid  guid,
bool  ready 
)
2414 {
2415  if (!m_readyCheckStarted)
2416  return;
2417 
2418  member_witerator slot = _getMemberWSlot(guid);
2419  if (slot != m_memberSlots.end())
2420  SetMemberReadyCheck(&(*slot), ready);
2421 }
MemberSlotList::iterator member_witerator
Definition: Group.h:209
void SetMemberReadyCheck(ObjectGuid guid, bool ready)
Definition: Group.cpp:2413
bool m_readyCheckStarted
Definition: Group.h:421
MemberSlotList m_memberSlots
Definition: Group.h:396
member_witerator _getMemberWSlot(ObjectGuid Guid)
Definition: Group.cpp:2725

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::SetMemberReadyCheck ( MemberSlot slot,
bool  ready 
)
2424 {
2426  response.PartyGUID = m_guid;
2427  response.Player = slot->guid;
2428  response.IsReady = ready;
2429  BroadcastPacket(response.Write(), false);
2430 
2431  SetMemberReadyChecked(slot);
2432 }
ObjectGuid Player
Definition: PartyPackets.h:419
WorldPacket const * Write() override
Definition: PartyPackets.cpp:291
void SetMemberReadyChecked(MemberSlot *slot)
Definition: Group.cpp:2444
ObjectGuid m_guid
Definition: Group.h:415
ObjectGuid PartyGUID
Definition: PartyPackets.h:418
Definition: PartyPackets.h:411
bool IsReady
Definition: PartyPackets.h:420
void BroadcastPacket(WorldPacket const *packet, bool ignorePlayersInBGRaid, int group=-1, ObjectGuid ignoredPlayer=ObjectGuid::Empty)
Definition: Group.cpp:1698

+ Here is the call graph for this function:

void Group::SetMemberReadyChecked ( MemberSlot slot)
2445 {
2446  slot->readyChecked = true;
2447  if (IsReadyCheckCompleted())
2448  EndReadyCheck();
2449 }
void EndReadyCheck()
Definition: Group.cpp:2389
bool IsReadyCheckCompleted(void) const
Definition: Group.cpp:2405

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::SetOfflineMembersReadyChecked ( void  )
2435 {
2436  for (member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
2437  {
2438  Player* player = ObjectAccessor::FindConnectedPlayer(itr->guid);
2439  if (!player || !player->GetSession())
2440  SetMemberReadyCheck(&(*itr), false);
2441  }
2442 }
MemberSlotList::iterator member_witerator
Definition: Group.h:209
void SetMemberReadyCheck(ObjectGuid guid, bool ready)
Definition: Group.cpp:2413
MemberSlotList m_memberSlots
Definition: Group.h:396
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:215

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::SetRaidDifficultyID ( Difficulty  difficulty)
2033 {
2034  m_raidDifficulty = difficulty;
2035  if (!isBGGroup() && !isBFGroup())
2036  {
2038 
2039  stmt->setUInt8(0, uint8(m_raidDifficulty));
2040  stmt->setUInt32(1, m_dbStoreId);
2041 
2042  CharacterDatabase.Execute(stmt);
2043  }
2044 
2045  for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
2046  {
2047  Player* player = itr->GetSource();
2048  if (!player->GetSession())
2049  continue;
2050 
2051  player->SetRaidDifficultyID(difficulty);
2052  player->SendRaidDifficulty(false);
2053  }
2054 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
uint32 m_dbStoreId
Definition: Group.h:418
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: CharacterDatabase.h:338
Definition: PreparedStatement.h:74
bool isBGGroup() const
Definition: Group.cpp:2514
GroupReference * GetFirstMember()
Definition: Group.h:295
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
uint8_t uint8
Definition: g3dmath.h:164
bool isBFGroup() const
Definition: Group.cpp:2519
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Difficulty m_raidDifficulty
Definition: Group.h:403
Definition: GroupReference.h:27

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::SetTargetIcon ( uint8  symbol,
ObjectGuid  target,
ObjectGuid  changedBy,
uint8  partyIndex 
)
1534 {
1535  if (symbol >= TARGET_ICONS_COUNT)
1536  return;
1537 
1538  // clean other icons
1539  if (!target.IsEmpty())
1540  for (uint8 i = 0; i < TARGET_ICONS_COUNT; ++i)
1541  if (m_targetIcons[i] == target)
1542  SetTargetIcon(i, ObjectGuid::Empty, changedBy, partyIndex);
1543 
1544  m_targetIcons[symbol] = target;
1545 
1547  updateSingle.PartyIndex = partyIndex;
1548  updateSingle.Target = target;
1549  updateSingle.ChangedBy = changedBy;
1550  updateSingle.Symbol = symbol;
1551  BroadcastPacket(updateSingle.Write(), true);
1552 }
#define TARGET_ICONS_COUNT
Definition: Group.h:46
int8 Symbol
Definition: PartyPackets.h:319
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
int8 PartyIndex
Definition: PartyPackets.h:316
void SetTargetIcon(uint8 symbol, ObjectGuid target, ObjectGuid changedBy, uint8 partyIndex)
Definition: Group.cpp:1533
ObjectGuid ChangedBy
Definition: PartyPackets.h:318
WorldPacket const * Write() override
Definition: PartyPackets.cpp:227
ObjectGuid m_targetIcons[TARGET_ICONS_COUNT]
Definition: Group.h:407
ObjectGuid Target
Definition: PartyPackets.h:317
uint8_t uint8
Definition: Define.h:152
void BroadcastPacket(WorldPacket const *packet, bool ignorePlayersInBGRaid, int group=-1, ObjectGuid ignoredPlayer=ObjectGuid::Empty)
Definition: Group.cpp:1698
bool IsEmpty() const
Definition: ObjectGuid.h:242

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::StartReadyCheck ( ObjectGuid  starterGuid,
int8  partyIndex,
uint32  duration = READYCHECK_DURATION 
)
2366 {
2367  if (m_readyCheckStarted)
2368  return;
2369 
2370  member_witerator slot = _getMemberWSlot(starterGuid);
2371  if (slot == m_memberSlots.end())
2372  return ;
2373 
2374  m_readyCheckStarted = true;
2375  m_readyCheckTimer = duration;
2376 
2378 
2379  SetMemberReadyChecked(&(*slot));
2380 
2381  WorldPackets::Party::ReadyCheckStarted readyCheckStarted;
2382  readyCheckStarted.PartyGUID = m_guid;
2383  readyCheckStarted.PartyIndex = partyIndex;
2384  readyCheckStarted.InitiatorGUID = starterGuid;
2385  readyCheckStarted.Duration = duration;
2386  BroadcastPacket(readyCheckStarted.Write(), false);
2387 }
MemberSlotList::iterator member_witerator
Definition: Group.h:209
void SetMemberReadyChecked(MemberSlot *slot)
Definition: Group.cpp:2444
void SetOfflineMembersReadyChecked(void)
Definition: Group.cpp:2434
ObjectGuid m_guid
Definition: Group.h:415
bool m_readyCheckStarted
Definition: Group.h:421
int32 m_readyCheckTimer
Definition: Group.h:422
MemberSlotList m_memberSlots
Definition: Group.h:396
uint32 Duration
Definition: PartyPackets.h:397
member_witerator _getMemberWSlot(ObjectGuid Guid)
Definition: Group.cpp:2725
ObjectGuid InitiatorGUID
Definition: PartyPackets.h:396
WorldPacket const * Write() override
Definition: PartyPackets.cpp:275
Definition: PartyPackets.h:387
ObjectGuid PartyGUID
Definition: PartyPackets.h:395
int8 PartyIndex
Definition: PartyPackets.h:394
void BroadcastPacket(WorldPacket const *packet, bool ignorePlayersInBGRaid, int group=-1, ObjectGuid ignoredPlayer=ObjectGuid::Empty)
Definition: Group.cpp:1698

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::SubGroupCounterDecrease ( uint8  subgroup)
protected
2740 {
2741  if (m_subGroupsCounts)
2742  --m_subGroupsCounts[subgroup];
2743 }
uint8 * m_subGroupsCounts
Definition: Group.h:414

+ Here is the caller graph for this function:

void Group::SubGroupCounterIncrease ( uint8  subgroup)
protected
2734 {
2735  if (m_subGroupsCounts)
2736  ++m_subGroupsCounts[subgroup];
2737 }
uint8 * m_subGroupsCounts
Definition: Group.h:414

+ Here is the caller graph for this function:

void Group::SwapMembersGroups ( ObjectGuid  firstGuid,
ObjectGuid  secondGuid 
)
1799 {
1800  if (!isRaidGroup())
1801  return;
1802 
1803  member_witerator slots[2];
1804  slots[0] = _getMemberWSlot(firstGuid);
1805  slots[1] = _getMemberWSlot(secondGuid);
1806  if (slots[0] == m_memberSlots.end() || slots[1] == m_memberSlots.end())
1807  return;
1808 
1809  if (slots[0]->group == slots[1]->group)
1810  return;
1811 
1812  uint8 tmp = slots[0]->group;
1813  slots[0]->group = slots[1]->group;
1814  slots[1]->group = tmp;
1815 
1817  for (uint8 i = 0; i < 2; i++)
1818  {
1819  // Preserve new sub group in database for non-raid groups
1820  if (!isBGGroup() && !isBFGroup())
1821  {
1823 
1824  stmt->setUInt8(0, slots[i]->group);
1825  stmt->setUInt64(1, slots[i]->guid.GetCounter());
1826 
1827  trans->Append(stmt);
1828  }
1829 
1830  if (Player* player = ObjectAccessor::FindConnectedPlayer(slots[i]->guid))
1831  {
1832  if (player->GetGroup() == this)
1833  player->GetGroupRef().setSubGroup(slots[i]->group);
1834  else
1835  player->GetOriginalGroupRef().setSubGroup(slots[i]->group);
1836  }
1837  }
1839 
1840  SendUpdate();
1841 }
MemberSlotList::iterator member_witerator
Definition: Group.h:209
bool isRaidGroup() const
Definition: Group.cpp:2509
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
SQLTransaction BeginTransaction()
Begins an automanaged transaction pointer that will automatically rollback if not commited...
Definition: DatabaseWorkerPool.h:221
Definition: CharacterDatabase.h:335
Definition: PreparedStatement.h:74
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
MemberSlotList m_memberSlots
Definition: Group.h:396
member_witerator _getMemberWSlot(ObjectGuid Guid)
Definition: Group.cpp:2725
bool isBGGroup() const
Definition: Group.cpp:2514
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
bool isBFGroup() const
Definition: Group.cpp:2519
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
uint8_t uint8
Definition: Define.h:152
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:215
void SendUpdate()
Definition: Group.cpp:1567
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::ToggleGroupMemberFlag ( member_witerator  slot,
uint8  flag,
bool  apply 
)
protected
2753 {
2754  if (apply)
2755  slot->flags |= flag;
2756  else
2757  slot->flags &= ~flag;
2758 }
void apply(T *val)
Definition: ByteConverter.h:41

+ Here is the caller graph for this function:

void Group::UnbindInstance ( uint32  mapid,
uint8  difficulty,
bool  unload = false 
)
2258 {
2259  BoundInstancesMap::iterator itr = m_boundInstances[difficulty].find(mapid);
2260  if (itr != m_boundInstances[difficulty].end())
2261  {
2262  if (!unload)
2263  {
2265 
2266  stmt->setUInt32(0, m_dbStoreId);
2267  stmt->setUInt32(1, itr->second.save->GetInstanceId());
2268 
2269  CharacterDatabase.Execute(stmt);
2270  }
2271 
2272  itr->second.save->RemoveGroup(this); // save can become invalid
2273  m_boundInstances[difficulty].erase(itr);
2274  }
2275 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
uint32 m_dbStoreId
Definition: Group.h:418
Definition: PreparedStatement.h:74
Definition: CharacterDatabase.h:352
BoundInstancesMap m_boundInstances[MAX_DIFFICULTY]
Definition: Group.h:413
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::Update ( uint32  diff)
2351 {
2352  UpdateReadyCheck(diff);
2353 }
void UpdateReadyCheck(uint32 diff)
Definition: Group.cpp:2355

+ Here is the call graph for this function:

void Group::UpdateLooterGuid ( WorldObject pLootedObject,
bool  ifneed = false 
)
1855 {
1856  // round robin style looting applies for all low
1857  // quality items in each loot method except free for all
1858  if (GetLootMethod() == FREE_FOR_ALL)
1859  return;
1860 
1861  ObjectGuid oldLooterGUID = GetLooterGuid();
1862  member_citerator guid_itr = _getMemberCSlot(oldLooterGUID);
1863  if (guid_itr != m_memberSlots.end())
1864  {
1865  if (ifneed)
1866  {
1867  // not update if only update if need and ok
1868  Player* looter = ObjectAccessor::FindPlayer(guid_itr->guid);
1869  if (looter && looter->IsAtGroupRewardDistance(pLootedObject))
1870  return;
1871  }
1872  ++guid_itr;
1873  }
1874 
1875  // search next after current
1876  Player* pNewLooter = NULL;
1877  for (member_citerator itr = guid_itr; itr != m_memberSlots.end(); ++itr)
1878  {
1879  if (Player* player = ObjectAccessor::FindPlayer(itr->guid))
1880  if (player->IsAtGroupRewardDistance(pLootedObject))
1881  {
1882  pNewLooter = player;
1883  break;
1884  }
1885  }
1886 
1887  if (!pNewLooter)
1888  {
1889  // search from start
1890  for (member_citerator itr = m_memberSlots.begin(); itr != guid_itr; ++itr)
1891  {
1892  if (Player* player = ObjectAccessor::FindPlayer(itr->guid))
1893  if (player->IsAtGroupRewardDistance(pLootedObject))
1894  {
1895  pNewLooter = player;
1896  break;
1897  }
1898  }
1899  }
1900 
1901  if (pNewLooter)
1902  {
1903  if (oldLooterGUID != pNewLooter->GetGUID())
1904  {
1905  SetLooterGuid(pNewLooter->GetGUID());
1906  SendUpdate();
1907  }
1908  }
1909  else
1910  {
1912  SendUpdate();
1913  }
1914 }
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
MemberSlotList::const_iterator member_citerator
Definition: Group.h:205
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: LootMgr.h:67
void SetLooterGuid(ObjectGuid guid)
Definition: Group.cpp:2316
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:209
MemberSlotList m_memberSlots
Definition: Group.h:396
ObjectGuid GetLooterGuid() const
Definition: Group.cpp:2549
member_citerator _getMemberCSlot(ObjectGuid Guid) const
Definition: Group.cpp:2717
LootMethod GetLootMethod() const
Definition: Group.cpp:2544
Definition: ObjectGuid.h:189
void SendUpdate()
Definition: Group.cpp:1567

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::UpdatePlayerOutOfRange ( Player player)
1667 {
1668  if (!player || !player->IsInWorld())
1669  return;
1670 
1672  packet.Initialize(player);
1673 
1674  Player* member;
1675  for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
1676  {
1677  member = itr->GetSource();
1678  if (member && member != player && (!member->IsInMap(player) || !member->IsWithinDist(player, member->GetSightRange(), false)))
1679  member->GetSession()->SendPacket(packet.Write());
1680  }
1681 }
WorldPacket const * Write() override
Definition: PartyPackets.cpp:149
void Initialize(Player const *player)
Definition: PartyPackets.cpp:412
arena_t NULL
Definition: jemalloc_internal.h:624
GroupReference * GetFirstMember()
Definition: Group.h:295
Definition: PartyPackets.h:201
Definition: GroupReference.h:27

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Group::UpdateReadyCheck ( uint32  diff)
2356 {
2357  if (!m_readyCheckStarted)
2358  return;
2359 
2360  m_readyCheckTimer -= diff;
2361  if (m_readyCheckTimer <= 0)
2362  EndReadyCheck();
2363 }
void EndReadyCheck()
Definition: Group.cpp:2389
bool m_readyCheckStarted
Definition: Group.h:421
int32 m_readyCheckTimer
Definition: Group.h:422

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

uint32 Group::m_activeMarkers
protected
Battlefield* Group::m_bfGroup
protected
Battleground* Group::m_bgGroup
protected
BoundInstancesMap Group::m_boundInstances[MAX_DIFFICULTY]
protected
uint32 Group::m_counter
protected
uint32 Group::m_dbStoreId
protected
Difficulty Group::m_dungeonDifficulty
protected
GroupType Group::m_groupType
protected
ObjectGuid Group::m_guid
protected
InvitesList Group::m_invitees
protected
ObjectGuid Group::m_leaderGuid
protected
std::string Group::m_leaderName
protected
Difficulty Group::m_legacyRaidDifficulty
protected
ObjectGuid Group::m_looterGuid
protected
LootMethod Group::m_lootMethod
protected
ItemQualities Group::m_lootThreshold
protected
std::array<std::unique_ptr<RaidMarker>, RAID_MARKERS_COUNT> Group::m_markers
protected
ObjectGuid Group::m_masterLooterGuid
protected
uint32 Group::m_maxEnchantingLevel
protected
GroupRefManager Group::m_memberMgr
protected
MemberSlotList Group::m_memberSlots
protected
Difficulty Group::m_raidDifficulty
protected
bool Group::m_readyCheckStarted
protected
int32 Group::m_readyCheckTimer
protected
uint8* Group::m_subGroupsCounts
protected
ObjectGuid Group::m_targetIcons[TARGET_ICONS_COUNT]
protected
Rolls Group::RollId
protected

The documentation for this class was generated from the following files: