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

+ Here is the call graph for this function:

+ Here is the caller graph for this function: