AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Group Class Reference

#include "Group.h"

Classes

struct  MemberSlot
 

Public Types

typedef std::list< MemberSlotMemberSlotList
 
typedef MemberSlotList::const_iterator member_citerator
 

Public Member Functions

 Group ()
 
 ~Group ()
 
bool Create (Player *leader)
 
bool 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=nullptr)
 
void ChangeLeader (ObjectGuid guid)
 
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, const uint8 roles)
 
bool IsFull () const
 
bool isLFGGroup (bool restricted=false) const
 
bool isRaidGroup () const
 
bool isBFGroup () const
 
bool isBGGroup () const
 
bool IsCreated () const
 
GroupType GetGroupType () const
 
ObjectGuid GetLeaderGUID () const
 
PlayerGetLeader ()
 
ObjectGuid GetGUID () const
 
const char * GetLeaderName () const
 
LootMethod GetLootMethod () const
 
ObjectGuid GetLooterGuid () const
 
ObjectGuid GetMasterLooterGuid () const
 
ItemQualities GetLootThreshold () 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 const & GetMemberSlots () const
 
GroupReferenceGetFirstMember ()
 
GroupReference const * GetFirstMember () const
 
uint32 GetMembersCount () const
 
uint32 GetInviteeCount () const
 
uint8 GetMemberGroup (ObjectGuid guid) const
 
void ConvertToLFG (bool restricted=true)
 
bool CheckLevelForRaid ()
 
void ConvertToRaid ()
 
void SetBattlegroundGroup (Battleground *bg)
 
void SetBattlefieldGroup (Battlefield *bf)
 
GroupJoinBattlegroundResult CanJoinBattlegroundQueue (Battleground const *bgTemplate, BattlegroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot)
 
void ChangeMembersGroup (ObjectGuid guid, uint8 group)
 
void SetTargetIcon (uint8 id, ObjectGuid whoGuid, ObjectGuid targetGuid)
 
void SetGroupMemberFlag (ObjectGuid guid, bool apply, GroupMemberFlags flag)
 
void RemoveUniqueGroupMemberFlag (GroupMemberFlags flag)
 
Difficulty GetDifficulty (bool isRaid) const
 
Difficulty GetDungeonDifficulty () const
 
Difficulty GetRaidDifficulty () const
 
void SetDungeonDifficulty (Difficulty difficulty)
 
void SetRaidDifficulty (Difficulty difficulty)
 
uint16 InInstance ()
 
void ResetInstances (uint8 method, bool isRaid, Player *leader)
 
void SendTargetIconList (WorldSession *session)
 
void SendUpdate ()
 
void SendUpdateToPlayer (ObjectGuid playerGUID, MemberSlot *slot=nullptr)
 
void UpdatePlayerOutOfRange (Player *player)
 
void BroadcastPacket (WorldPacket const *packet, bool ignorePlayersInBGRaid, int group=-1, ObjectGuid ignore=ObjectGuid::Empty)
 
void BroadcastReadyCheck (WorldPacket const *packet)
 
void OfflineReadyCheck ()
 
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, Map *allowedMap)
 
bool CountRollVote (ObjectGuid playerGUID, ObjectGuid Guid, uint8 Choise)
 
void EndRoll (Loot *loot, Map *allowedMap)
 
void ResetMaxEnchantingLevel ()
 
void LinkMember (GroupReference *pRef)
 
void BroadcastGroupUpdate (void)
 
void AddLfgBuffFlag ()
 
void AddLfgRandomInstanceFlag ()
 
void AddLfgHeroicFlag ()
 
bool IsLfgWithBuff () const
 
bool IsLfgRandomInstance () const
 
bool IsLfgHeroic () const
 
uint32 GetDifficultyChangePreventionTime () const
 
DifficultyPreventionChangeType GetDifficultyChangePreventionReason () const
 
void SetDifficultyChangePrevention (DifficultyPreventionChangeType type)
 
void DoForAllMembers (std::function< void(Player *)> const &worker)
 

Public Attributes

DataMap CustomData
 

Protected Types

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

Protected Member Functions

void _homebindIfInstance (Player *player)
 
void _cancelHomebindIfInstance (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
 
GroupRefMgr m_memberMgr
 
InvitesList m_invitees
 
ObjectGuid m_leaderGuid
 
std::string m_leaderName
 
GroupType m_groupType
 
Difficulty m_dungeonDifficulty
 
Difficulty m_raidDifficulty
 
Battlefieldm_bfGroup
 
Battlegroundm_bgGroup
 
ObjectGuid m_targetIcons [TARGETICONCOUNT]
 
LootMethod m_lootMethod
 
ItemQualities m_lootThreshold
 
ObjectGuid m_looterGuid
 
ObjectGuid m_masterLooterGuid
 
Rolls RollId
 
uint8m_subGroupsCounts
 
ObjectGuid m_guid
 
uint32 m_counter
 
uint32 m_maxEnchantingLevel
 
uint8 m_lfgGroupFlags
 
uint32 _difficultyChangePreventionTime
 
DifficultyPreventionChangeType _difficultyChangePreventionType
 

Detailed Description

request member stats checken todo: uninvite people that not accepted invite

Member Typedef Documentation

◆ InvitesList

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

◆ member_citerator

typedef MemberSlotList::const_iterator Group::member_citerator

◆ member_witerator

typedef MemberSlotList::iterator Group::member_witerator
protected

◆ MemberSlotList

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

◆ Rolls

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

Constructor & Destructor Documentation

◆ Group()

Group::Group ( )
71{
72 sScriptMgr->OnConstructGroup(this);
73}
@ GROUPTYPE_NORMAL
Definition: Group.h:86
@ DIFFICULTY_PREVENTION_CHANGE_NONE
Definition: Group.h:133
@ FREE_FOR_ALL
Definition: LootMgr.h:59
#define sScriptMgr
Definition: ScriptMgr.h:698
@ RAID_DIFFICULTY_10MAN_NORMAL
Definition: DBCEnums.h:281
@ DUNGEON_DIFFICULTY_NORMAL
Definition: DBCEnums.h:277
@ ITEM_QUALITY_UNCOMMON
Definition: SharedDefines.h:331
uint32 m_counter
Definition: Group.h:354
Battlefield * m_bfGroup
Definition: Group.h:344
uint32 m_maxEnchantingLevel
Definition: Group.h:355
DifficultyPreventionChangeType _difficultyChangePreventionType
Definition: Group.h:360
std::string m_leaderName
Definition: Group.h:340
Battleground * m_bgGroup
Definition: Group.h:345
Difficulty m_raidDifficulty
Definition: Group.h:343
LootMethod m_lootMethod
Definition: Group.h:347
uint8 * m_subGroupsCounts
Definition: Group.h:352
Difficulty m_dungeonDifficulty
Definition: Group.h:342
ItemQualities m_lootThreshold
Definition: Group.h:348
GroupType m_groupType
Definition: Group.h:341
uint32 _difficultyChangePreventionTime
Definition: Group.h:359

References sScriptMgr.

◆ ~Group()

Group::~Group ( )
76{
77 sScriptMgr->OnDestructGroup(this);
78
79 if (m_bgGroup)
80 {
81 LOG_DEBUG("bg.battleground", "Group::~Group: battleground group being deleted.");
82
83 if (m_bgGroup->GetBgRaid(TEAM_ALLIANCE) == this)
84 {
86 }
87 else if (m_bgGroup->GetBgRaid(TEAM_HORDE) == this)
88 {
90 }
91 else
92 LOG_ERROR("bg.battleground", "Group::~Group: battleground group is not linked to the correct battleground.");
93 }
94
95 Rolls::iterator itr;
96 while (!RollId.empty())
97 {
98 itr = RollId.begin();
99 Roll* r = *itr;
100 RollId.erase(itr);
101 delete(r);
102 }
103
104 // Sub group counters clean up
105 delete[] m_subGroupsCounts;
106}
#define LOG_ERROR(filterType__,...)
Definition: Log.h:157
#define LOG_DEBUG(filterType__,...)
Definition: Log.h:169
@ TEAM_ALLIANCE
Definition: SharedDefines.h:760
@ TEAM_HORDE
Definition: SharedDefines.h:761
Group * GetBgRaid(TeamId teamId) const
Definition: Battleground.h:481
void SetBgRaid(TeamId teamId, Group *bg_raid)
Definition: Battleground.cpp:1868
Definition: Group.h:143
Rolls RollId
Definition: Group.h:351

References Battleground::GetBgRaid(), LOG_DEBUG, LOG_ERROR, m_bgGroup, m_subGroupsCounts, RollId, Battleground::SetBgRaid(), sScriptMgr, TEAM_ALLIANCE, and TEAM_HORDE.

Member Function Documentation

◆ _cancelHomebindIfInstance()

void Group::_cancelHomebindIfInstance ( Player player)
protected
2129{
2130 // if player is reinvited to group and in the instance - cancel homebind timer
2131 if (!player->FindMap() || !player->FindMap()->IsDungeon())
2132 return;
2133 InstancePlayerBind* bind = sInstanceSaveMgr->PlayerGetBoundInstance(player->GetGUID(), player->FindMap()->GetId(), player->GetDifficulty(player->FindMap()->IsRaid()));
2134 if (bind && bind->save->GetInstanceId() == player->GetInstanceId())
2135 player->m_InstanceValid = true;
2136}
#define sInstanceSaveMgr
Definition: InstanceSaveMgr.h:202
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
Map * FindMap() const
Definition: Object.h:518
uint32 GetInstanceId() const
Definition: Object.h:431
bool m_InstanceValid
Definition: Player.h:2399
Difficulty GetDifficulty(bool isRaid) const
Definition: Player.h:1883
Definition: InstanceSaveMgr.h:39
InstanceSave * save
Definition: InstanceSaveMgr.h:40
uint32 GetInstanceId() const
Definition: InstanceSaveMgr.h:61
bool IsDungeon() const
Definition: Map.h:448
bool IsRaid() const
Definition: Map.h:450
uint32 GetId() const
Definition: Map.h:379

References WorldObject::FindMap(), Player::GetDifficulty(), Object::GetGUID(), Map::GetId(), WorldObject::GetInstanceId(), InstanceSave::GetInstanceId(), Map::IsDungeon(), Map::IsRaid(), Player::m_InstanceValid, InstancePlayerBind::save, and sInstanceSaveMgr.

Referenced by AddMember().

◆ _getMemberCSlot()

Group::member_citerator Group::_getMemberCSlot ( ObjectGuid  Guid) const
protected
2429{
2430 for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
2431 if (itr->guid == Guid)
2432 return itr;
2433 return m_memberSlots.end();
2434}
MemberSlotList m_memberSlots
Definition: Group.h:336
MemberSlotList::const_iterator member_citerator
Definition: Group.h:180

References m_memberSlots.

Referenced by GetMemberGroup(), IsAssistant(), IsMember(), SameSubGroup(), and UpdateLooterGuid().

◆ _getMemberWSlot()

Group::member_witerator Group::_getMemberWSlot ( ObjectGuid  Guid)
protected
2437{
2438 for (member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
2439 if (itr->guid == Guid)
2440 return itr;
2441 return m_memberSlots.end();
2442}
MemberSlotList::iterator member_witerator
Definition: Group.h:183

References m_memberSlots.

Referenced by ChangeLeader(), ChangeMembersGroup(), RemoveMember(), SendUpdateToPlayer(), SetGroupMemberFlag(), and SetLfgRoles().

◆ _homebindIfInstance()

void Group::_homebindIfInstance ( Player player)
protected
2123{
2124 if (player && !player->IsGameMaster() && player->FindMap() && sMapStore.LookupEntry(player->GetMapId())->IsDungeon())
2125 player->m_InstanceValid = false;
2126}
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
uint32 GetMapId() const
Definition: Position.h:276
bool IsGameMaster() const
Definition: Player.h:1148

References WorldObject::FindMap(), WorldLocation::GetMapId(), Player::IsGameMaster(), Player::m_InstanceValid, and sMapStore.

Referenced by Disband(), and RemoveMember().

◆ _initRaidSubGroupsCounter()

void Group::_initRaidSubGroupsCounter ( )
protected
2417{
2418 // Sub group counters initialization
2419 if (!m_subGroupsCounts)
2421
2422 memset((void*)m_subGroupsCounts, 0, (MAX_RAID_SUBGROUPS)*sizeof(uint8));
2423
2424 for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
2425 ++m_subGroupsCounts[itr->group];
2426}
std::uint8_t uint8
Definition: Define.h:110
#define MAX_RAID_SUBGROUPS
Definition: Group.h:45

References m_memberSlots, m_subGroupsCounts, and MAX_RAID_SUBGROUPS.

Referenced by ConvertToRaid(), Create(), and LoadGroupFromDB().

◆ AddInvite()

bool Group::AddInvite ( Player player)
321{
322 if (!player || player->GetGroupInvite())
323 return false;
324 Group* group = player->GetGroup();
325 if (group && (group->isBGGroup() || group->isBFGroup()))
326 group = player->GetOriginalGroup();
327 if (group)
328 return false;
329
330 RemoveInvite(player);
331
332 m_invitees.insert(player);
333
334 player->SetGroupInvite(this);
335
336 sScriptMgr->OnGroupInviteMember(this, player->GetGUID());
337
338 return true;
339}
void SetGroupInvite(Group *group)
Definition: Player.h:2430
Group * GetGroup()
Definition: Player.h:2431
Group * GetGroupInvite()
Definition: Player.h:2429
Group * GetOriginalGroup()
Definition: Player.h:2446
Definition: Group.h:169
InvitesList m_invitees
Definition: Group.h:338
void RemoveInvite(Player *player)
Definition: Group.cpp:351
bool isBGGroup() const
Definition: Group.cpp:2215
bool isBFGroup() const
Definition: Group.cpp:2220

References Player::GetGroup(), Player::GetGroupInvite(), Object::GetGUID(), Player::GetOriginalGroup(), isBFGroup(), isBGGroup(), m_invitees, RemoveInvite(), Player::SetGroupInvite(), and sScriptMgr.

Referenced by AddLeaderInvite(), and WorldSession::HandleGroupInviteOpcode().

◆ AddLeaderInvite()

bool Group::AddLeaderInvite ( Player player)
342{
343 if (!AddInvite(player))
344 return false;
345
346 m_leaderGuid = player->GetGUID();
347 m_leaderName = player->GetName();
348 return true;
349}
std::string const & GetName() const
Definition: Object.h:446
ObjectGuid m_leaderGuid
Definition: Group.h:339
bool AddInvite(Player *player)
Definition: Group.cpp:320

References AddInvite(), Object::GetGUID(), WorldObject::GetName(), m_leaderGuid, and m_leaderName.

Referenced by WorldSession::HandleGroupInviteOpcode().

◆ AddLfgBuffFlag()

void Group::AddLfgBuffFlag ( )
inline
@ GROUP_LFG_FLAG_APPLY_RANDOM_BUFF
Definition: Group.h:126
uint8 m_lfgGroupFlags
Definition: Group.h:356

References GROUP_LFG_FLAG_APPLY_RANDOM_BUFF, and m_lfgGroupFlags.

Referenced by lfg::LFGMgr::MakeNewGroup().

◆ AddLfgHeroicFlag()

void Group::AddLfgHeroicFlag ( )
inline
@ GROUP_LFG_FLAG_IS_HEROIC
Definition: Group.h:128

References GROUP_LFG_FLAG_IS_HEROIC, and m_lfgGroupFlags.

Referenced by lfg::LFGMgr::MakeNewGroup().

◆ AddLfgRandomInstanceFlag()

void Group::AddLfgRandomInstanceFlag ( )
inline
@ GROUP_LFG_FLAG_IS_RANDOM_INSTANCE
Definition: Group.h:127

References GROUP_LFG_FLAG_IS_RANDOM_INSTANCE, and m_lfgGroupFlags.

Referenced by lfg::LFGMgr::MakeNewGroup().

◆ AddMember()

bool Group::AddMember ( Player player)
391{
392 if (!player)
393 return false;
394
395 // Get first not-full group
396 uint8 subGroup = 0;
398 {
399 bool groupFound = false;
400 for (; subGroup < MAX_RAID_SUBGROUPS; ++subGroup)
401 {
402 if (m_subGroupsCounts[subGroup] < MAXGROUPSIZE)
403 {
404 groupFound = true;
405 break;
406 }
407 }
408 // We are raid group and no one slot is free
409 if (!groupFound)
410 return false;
411 }
412
413 MemberSlot member;
414 member.guid = player->GetGUID();
415 member.name = player->GetName();
416 member.group = subGroup;
417 member.flags = 0;
418 member.roles = 0;
419 m_memberSlots.push_back(member);
420
421 if (!isBGGroup() && !isBFGroup())
422 {
423 sCharacterCache->UpdateCharacterGroup(player->GetGUID(), GetGUID());
424 }
425
426 SubGroupCounterIncrease(subGroup);
427
428 player->SetGroupInvite(nullptr);
429 if (player->GetGroup())
430 {
431 if (isBGGroup() || isBFGroup()) // if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid()
432 player->SetBattlegroundOrBattlefieldRaid(this, subGroup);
433 else //if player is in bg raid and we are adding him to normal group, then call SetOriginalGroup()
434 player->SetOriginalGroup(this, subGroup);
435 }
436 else //if player is not in group, then call set group
437 player->SetGroup(this, subGroup);
438
439 // if the same group invites the player back, cancel the homebind timer
441
442 if (!isRaidGroup()) // reset targetIcons for non-raid-groups
443 {
444 for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
445 m_targetIcons[i].Clear();
446 }
447
448 if (!isBGGroup() && !isBFGroup())
449 {
451 stmt->SetData(0, GetGUID().GetCounter());
452 stmt->SetData(1, member.guid.GetCounter());
453 stmt->SetData(2, member.flags);
454 stmt->SetData(3, member.group);
455 stmt->SetData(4, member.roles);
456 CharacterDatabase.Execute(stmt);
457 }
458
459 SendUpdate();
460
461 if (player)
462 {
463 sScriptMgr->OnGroupAddMember(this, player->GetGUID());
464
465 if (!IsLeader(player->GetGUID()) && !isBGGroup() && !isBFGroup())
466 {
468
470 {
472 player->SendDungeonDifficulty(true);
473 }
474 if (player->GetRaidDifficulty() != GetRaidDifficulty())
475 {
477 player->SendRaidDifficulty(true);
478 }
479 }
480 else if (IsLeader(player->GetGUID()) && isLFGGroup()) // pussywizard
481 {
483 }
484
487
488 // quest related GO state dependent from raid membership
489 if (isRaidGroup())
491
492 {
493 // Broadcast new player group member fields to rest of the group
495
496 UpdateData groupData;
497 WorldPacket groupDataPacket;
498
499 // Broadcast group members' fields to player
500 for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
501 {
502 if (itr->GetSource() == player) // pussywizard: no check same map, adding members is single threaded
503 {
504 continue;
505 }
506
507 if (Player* itrMember = itr->GetSource())
508 {
509 if (player->HaveAtClient(itrMember))
510 {
511 itrMember->SetFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
512 itrMember->BuildValuesUpdateBlockForPlayer(&groupData, player);
513 itrMember->RemoveFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
514 }
515
516 if (itrMember->HaveAtClient(player))
517 {
518 UpdateData newData;
519 WorldPacket newDataPacket;
520 player->BuildValuesUpdateBlockForPlayer(&newData, itrMember);
521 if (newData.HasData())
522 {
523 newData.BuildPacket(&newDataPacket);
524 itrMember->SendDirectMessage(&newDataPacket);
525 }
526 }
527 }
528 }
529
530 if (groupData.HasData())
531 {
532 groupData.BuildPacket(&groupDataPacket);
533 player->SendDirectMessage(&groupDataPacket);
534 }
535
537 }
538
539 if (m_maxEnchantingLevel < player->GetSkillValue(SKILL_ENCHANTING))
541 }
542
543 return true;
544}
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
@ CHAR_REP_GROUP_MEMBER
Definition: CharacterDatabase.h:282
#define sCharacterCache
Definition: CharacterCache.h:83
@ UF_FLAG_PARTY_MEMBER
Definition: UpdateFieldFlags.h:33
#define TARGETICONCOUNT
Definition: Group.h:46
#define MAXGROUPSIZE
Definition: Group.h:43
@ GROUP_UPDATE_FULL
Definition: Group.h:121
@ INSTANCE_RESET_GROUP_JOIN
Definition: Map.h:813
@ SKILL_ENCHANTING
Definition: SharedDefines.h:2954
Definition: PreparedStatement.h:158
Acore::Types::is_default< T > SetData(const uint8 index, T value)
Definition: PreparedStatement.h:78
void RemoveFieldNotifyFlag(uint16 flag)
Definition: Object.h:189
void BuildValuesUpdateBlockForPlayer(UpdateData *data, Player *target) const
Definition: Object.cpp:257
void SetFieldNotifyFlag(uint16 flag)
Definition: Object.h:188
Definition: UpdateData.h:52
bool HasData() const
Definition: UpdateData.h:60
bool BuildPacket(WorldPacket *packet)
Definition: UpdateData.cpp:105
Definition: Player.h:1056
Difficulty GetRaidDifficulty() const
Definition: Player.h:1885
void SetOriginalGroup(Group *group, int8 subgroup=-1)
Definition: Player.cpp:13028
void SetGroupUpdateFlag(uint32 flag)
Definition: Player.h:2437
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:5607
uint16 GetSkillValue(uint32 skill) const
Definition: Player.cpp:5367
void SetDungeonDifficulty(Difficulty dungeon_difficulty)
Definition: Player.h:1887
void SetGroup(Group *group, int8 subgroup=-1)
Definition: Player.cpp:11478
bool HaveAtClient(WorldObject const *u) const
Definition: Player.cpp:11327
void UpdateForQuestWorldObjects()
Definition: PlayerUpdates.cpp:1746
void SetRaidDifficulty(Difficulty raid_difficulty)
Definition: Player.h:1888
void SendDungeonDifficulty(bool IsInGroup)
Definition: PlayerMisc.cpp:167
static void ResetInstances(ObjectGuid guid, uint8 method, bool isRaid)
Reset all solo instances and optionally send a message on success for each.
Definition: PlayerMisc.cpp:195
Difficulty GetDungeonDifficulty() const
Definition: Player.h:1884
void SendRaidDifficulty(bool IsInGroup, int32 forcedDifficulty=-1)
Definition: PlayerMisc.cpp:177
void SetBattlegroundOrBattlefieldRaid(Group *group, int8 subgroup=-1)
Definition: Player.cpp:13000
bool isLFGGroup(bool restricted=false) const
Definition: Group.cpp:2204
bool IsLeader(ObjectGuid guid) const
Definition: Group.cpp:2280
void SendUpdate()
Definition: Group.cpp:1633
ObjectGuid GetGUID() const
Definition: Group.cpp:2245
void _cancelHomebindIfInstance(Player *player)
Definition: Group.cpp:2128
Difficulty GetRaidDifficulty() const
Definition: Group.cpp:2392
ObjectGuid m_targetIcons[TARGETICONCOUNT]
Definition: Group.h:346
void UpdatePlayerOutOfRange(Player *player)
Definition: Group.cpp:1709
GroupReference * GetFirstMember()
Definition: Group.h:243
void SubGroupCounterIncrease(uint8 subgroup)
Definition: Group.cpp:2444
Difficulty GetDungeonDifficulty() const
Definition: Group.cpp:2387
bool isRaidGroup() const
Definition: Group.cpp:2210
Definition: GroupReference.h:27
GroupReference * next()
Definition: GroupReference.h:36
Definition: WorldPacket.h:27

References _cancelHomebindIfInstance(), UpdateData::BuildPacket(), Object::BuildValuesUpdateBlockForPlayer(), CHAR_REP_GROUP_MEMBER, CharacterDatabase, Group::MemberSlot::flags, ObjectGuid::GetCounter(), Player::GetDungeonDifficulty(), GetDungeonDifficulty(), GetFirstMember(), Player::GetGroup(), GetGUID(), Object::GetGUID(), WorldObject::GetName(), Player::GetRaidDifficulty(), GetRaidDifficulty(), Player::GetSkillValue(), Group::MemberSlot::group, GROUP_UPDATE_FULL, Group::MemberSlot::guid, UpdateData::HasData(), Player::HaveAtClient(), INSTANCE_RESET_GROUP_JOIN, isBFGroup(), isBGGroup(), IsLeader(), isLFGGroup(), isRaidGroup(), m_maxEnchantingLevel, m_memberSlots, m_subGroupsCounts, m_targetIcons, MAX_RAID_SUBGROUPS, MAXGROUPSIZE, Group::MemberSlot::name, GroupReference::next(), Object::RemoveFieldNotifyFlag(), Player::ResetInstances(), Group::MemberSlot::roles, sCharacterCache, Player::SendDirectMessage(), Player::SendDungeonDifficulty(), Player::SendRaidDifficulty(), SendUpdate(), Player::SetBattlegroundOrBattlefieldRaid(), PreparedStatementBase::SetData(), Player::SetDungeonDifficulty(), Object::SetFieldNotifyFlag(), Player::SetGroup(), Player::SetGroupInvite(), Player::SetGroupUpdateFlag(), Player::SetOriginalGroup(), Player::SetRaidDifficulty(), SKILL_ENCHANTING, sScriptMgr, SubGroupCounterIncrease(), TARGETICONCOUNT, UF_FLAG_PARTY_MEMBER, Player::UpdateForQuestWorldObjects(), and UpdatePlayerOutOfRange().

Referenced by Battlefield::AddOrSetPlayerToCorrectBfGroup(), Battleground::AddOrSetPlayerToCorrectBgGroup(), Arena::AddPlayer(), Create(), group_commandscript::HandleGroupJoinCommand(), and lfg::LFGMgr::MakeNewGroup().

◆ BroadcastGroupUpdate()

void Group::BroadcastGroupUpdate ( void  )
2139{
2140 // FG: HACK: force flags update on group leave - for values update hack
2141 // -- not very efficient but safe
2142 for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
2143 {
2144 Player* pp = ObjectAccessor::FindPlayer(citr->guid);
2145 if (pp)
2146 {
2149 LOG_DEBUG("group", "-- Forced group value update for '{}'", pp->GetName());
2150 }
2151 }
2152}
@ UNIT_FIELD_FACTIONTEMPLATE
Definition: UpdateFields.h:115
@ UNIT_FIELD_BYTES_2
Definition: UpdateFields.h:161
Player * FindPlayer(ObjectGuid const guid)
Definition: ObjectAccessor.cpp:248
void ForceValuesUpdateAtIndex(uint32)
Definition: Object.cpp:2067

References ObjectAccessor::FindPlayer(), Object::ForceValuesUpdateAtIndex(), WorldObject::GetName(), LOG_DEBUG, m_memberSlots, UNIT_FIELD_BYTES_2, and UNIT_FIELD_FACTIONTEMPLATE.

Referenced by group_commandscript::HandleGroupJoinCommand(), and RemoveMember().

◆ BroadcastPacket()

void Group::BroadcastPacket ( WorldPacket const *  packet,
bool  ignorePlayersInBGRaid,
int  group = -1,
ObjectGuid  ignore = ObjectGuid::Empty 
)
1726{
1727 for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
1728 {
1729 Player* player = itr->GetSource();
1730 if (!player || (ignore && player->GetGUID() == ignore) || (ignorePlayersInBGRaid && player->GetGroup() != this))
1731 continue;
1732
1733 if (group == -1 || itr->getSubGroup() == group)
1734 player->GetSession()->SendPacket(packet);
1735 }
1736}
WorldSession * GetSession() const
Definition: Player.h:1961
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
Definition: WorldSession.cpp:212

References GetFirstMember(), Player::GetGroup(), Object::GetGUID(), Player::GetSession(), GroupReference::next(), and WorldSession::SendPacket().

Referenced by ChangeLeader(), WorldSession::HandleMessagechatOpcode(), WorldSession::HandleMinimapPingOpcode(), WorldSession::HandleRaidReadyCheckFinishedOpcode(), WorldSession::HandleRaidReadyCheckOpcode(), Unit::Kill(), SendLooter(), Player::SendNewItem(), and SetTargetIcon().

◆ BroadcastReadyCheck()

void Group::BroadcastReadyCheck ( WorldPacket const *  packet)
1739{
1740 for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
1741 {
1742 Player* player = itr->GetSource();
1743 if (player)
1744 if (IsLeader(player->GetGUID()) || IsAssistant(player->GetGUID()))
1745 player->GetSession()->SendPacket(packet);
1746 }
1747}
bool IsAssistant(ObjectGuid guid) const
Definition: Group.cpp:2294

References GetFirstMember(), Object::GetGUID(), Player::GetSession(), IsAssistant(), IsLeader(), GroupReference::next(), and WorldSession::SendPacket().

Referenced by WorldSession::HandleRaidReadyCheckOpcode(), and OfflineReadyCheck().

◆ CanJoinBattlegroundQueue()

GroupJoinBattlegroundResult Group::CanJoinBattlegroundQueue ( Battleground const *  bgTemplate,
BattlegroundQueueTypeId  bgQueueTypeId,
uint32  MinPlayerCount,
uint32  MaxPlayerCount,
bool  isRated,
uint32  arenaSlot 
)
1899{
1900 // check if this group is LFG group
1901 if (isLFGGroup())
1903
1904 BattlemasterListEntry const* bgEntry = sBattlemasterListStore.LookupEntry(bgTemplate->GetBgTypeID());
1905 if (!bgEntry)
1907
1908 // too many players in the group
1909 if (GetMembersCount() > bgEntry->maxGroupSize)
1910 return ERR_BATTLEGROUND_NONE;
1911
1912 // get a player as reference, to compare other players' stats to (arena team id, level bracket, etc.)
1913 Player* reference = GetFirstMember()->GetSource();
1914 if (!reference)
1916
1917 PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgTemplate->GetMapId(), reference->GetLevel());
1918 if (!bracketEntry)
1920
1921 uint32 arenaTeamId = reference->GetArenaTeamId(arenaSlot);
1922 TeamId teamId = reference->GetTeamId();
1923
1925
1926 // check every member of the group to be able to join
1927 uint32 memberscount = 0;
1928 for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next(), ++memberscount)
1929 {
1930 Player* member = itr->GetSource();
1931
1932 // don't let join with offline members
1933 if (!member)
1935
1936 if (!sScriptMgr->CanGroupJoinBattlegroundQueue(this, member, bgTemplate, MinPlayerCount, isRated, arenaSlot))
1938
1939 // don't allow cross-faction groups to join queue
1940 if (member->GetTeamId() != teamId && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
1942
1943 // don't let join rated matches if the arena team id doesn't match
1944 if (isRated && member->GetArenaTeamId(arenaSlot) != arenaTeamId)
1946
1947 // not in the same battleground level braket, don't let join
1948 PvPDifficultyEntry const* memberBracketEntry = GetBattlegroundBracketByLevel(bracketEntry->mapId, member->GetLevel());
1949 if (memberBracketEntry != bracketEntry)
1951
1952 // check for deserter debuff in case not arena queue
1953 if (bgTemplate->GetBgTypeID() != BATTLEGROUND_AA && !member->CanJoinToBattleground())
1955
1956 // check if someone in party is using dungeon system
1957 lfg::LfgState lfgState = sLFGMgr->GetState(member->GetGUID());
1958 if (lfgState > lfg::LFG_STATE_NONE && (lfgState != lfg::LFG_STATE_QUEUED || !sWorld->getBoolConfig(CONFIG_ALLOW_JOIN_BG_AND_LFG)))
1959 {
1961 }
1962
1963 // pussywizard: prevent joining when any member is in bg/arena
1964 if (member->InBattleground())
1966
1967 // pussywizard: check for free slot, this is actually ensured before calling this function, but just in case
1968 if (!member->HasFreeBattlegroundQueueId())
1970
1971 // don't let join if someone from the group is already in that bg queue
1972 if (member->InBattlegroundQueueForBattlegroundQueueType(bgQueueTypeId))
1973 {
1975 }
1976
1977 // don't let join if someone from the group is in bg queue random
1978 if (member->InBattlegroundQueueForBattlegroundQueueType(bgQueueTypeIdRandom))
1979 return ERR_IN_RANDOM_BG;
1980
1981 // don't let join to bg queue random if someone from the group is already in bg queue
1982 if (bgTemplate->GetBgTypeID() == BATTLEGROUND_RB && member->InBattlegroundQueue())
1983 return ERR_IN_NON_RANDOM_BG;
1984
1985 // don't let Death Knights join BG queues when they are not allowed to be teleported yet
1986 if (member->getClass() == CLASS_DEATH_KNIGHT && member->GetMapId() == 609 && !member->IsGameMaster() && !member->HasSpell(50977))
1988
1989 if (!member->GetBGAccessByLevel(bgTemplate->GetBgTypeID()))
1990 {
1992 }
1993 }
1994
1995 // for arenas: check party size is proper
1996 if (bgTemplate->isArena() && memberscount != MinPlayerCount)
1998
1999 return GroupJoinBattlegroundResult(bgTemplate->GetBgTypeID());
2000}
std::uint32_t uint32
Definition: Define.h:108
DBCStorage< BattlemasterListEntry > sBattlemasterListStore(BattlemasterListEntryfmt)
PvPDifficultyEntry const * GetBattlegroundBracketByLevel(uint32 mapid, uint32 level)
Definition: DBCStores.cpp:789
#define sLFGMgr
Definition: LFGMgr.h:641
@ CONFIG_ALLOW_JOIN_BG_AND_LFG
Definition: IWorld.h:176
@ CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP
Definition: IWorld.h:80
GroupJoinBattlegroundResult
Definition: SharedDefines.h:3635
@ ERR_BATTLEGROUND_JOIN_TIMED_OUT
Definition: SharedDefines.h:3648
@ ERR_BATTLEGROUND_JOIN_FAILED
Definition: SharedDefines.h:3649
@ ERR_LFG_CANT_USE_BATTLEGROUND
Definition: SharedDefines.h:3650
@ ERR_IN_NON_RANDOM_BG
Definition: SharedDefines.h:3652
@ ERR_BATTLEGROUND_NONE
Definition: SharedDefines.h:3638
@ ERR_GROUP_JOIN_BATTLEGROUND_DESERTERS
Definition: SharedDefines.h:3639
@ ERR_ARENA_TEAM_PARTY_SIZE
Definition: SharedDefines.h:3640
@ ERR_BATTLEGROUND_TOO_MANY_QUEUES
Definition: SharedDefines.h:3641
@ ERR_GROUP_JOIN_BATTLEGROUND_FAIL
Definition: SharedDefines.h:3637
@ ERR_BATTLEGROUND_JOIN_RANGE_INDEX
Definition: SharedDefines.h:3647
@ ERR_IN_RANDOM_BG
Definition: SharedDefines.h:3651
@ CLASS_DEATH_KNIGHT
Definition: SharedDefines.h:146
@ BATTLEGROUND_AA
Definition: SharedDefines.h:3486
@ BATTLEGROUND_RB
Definition: SharedDefines.h:3493
BattlegroundQueueTypeId
Definition: SharedDefines.h:3619
TeamId
Definition: SharedDefines.h:759
#define sWorld
Definition: World.h:447
LfgState
Definition: LFG.h:70
@ LFG_STATE_NONE
Definition: LFG.h:71
@ LFG_STATE_QUEUED
Definition: LFG.h:73
FROM * GetSource() const
Definition: Reference.h:97
static BattlegroundQueueTypeId BGQueueTypeId(BattlegroundTypeId bgTypeId, uint8 arenaType)
Definition: BattlegroundMgr.cpp:672
bool InBattlegroundQueueForBattlegroundQueueType(BattlegroundQueueTypeId bgQueueTypeId) const
Definition: Player.cpp:12160
bool InBattleground() const
Definition: Player.h:2214
TeamId GetTeamId(bool original=false) const
Definition: Player.h:2072
bool InBattlegroundQueue(bool ignoreArena=false) const
Definition: Player.cpp:12126
uint32 GetArenaTeamId(uint8 slot) const
Definition: Player.cpp:16129
bool CanJoinToBattleground() const
Definition: Player.cpp:11274
bool HasFreeBattlegroundQueueId() const
Definition: Player.cpp:12180
bool HasSpell(uint32 spell) const override
Definition: Player.cpp:3831
bool GetBGAccessByLevel(BattlegroundTypeId bgTypeId) const
Definition: Player.cpp:12239
uint8 getClass() const
Definition: Unit.h:1438
uint8 GetLevel() const
Definition: Unit.h:1432
uint32 GetMembersCount() const
Definition: Group.h:245
Definition: DBCStructure.h:604
uint32 maxGroupSize
Definition: DBCStructure.h:611
Definition: DBCStructure.h:1429
uint32 mapId
Definition: DBCStructure.h:1431

References BATTLEGROUND_AA, BATTLEGROUND_RB, BattlegroundMgr::BGQueueTypeId(), Player::CanJoinToBattleground(), CLASS_DEATH_KNIGHT, CONFIG_ALLOW_JOIN_BG_AND_LFG, CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP, ERR_ARENA_TEAM_PARTY_SIZE, ERR_BATTLEGROUND_JOIN_FAILED, ERR_BATTLEGROUND_JOIN_RANGE_INDEX, ERR_BATTLEGROUND_JOIN_TIMED_OUT, ERR_BATTLEGROUND_NONE, ERR_BATTLEGROUND_TOO_MANY_QUEUES, ERR_GROUP_JOIN_BATTLEGROUND_DESERTERS, ERR_GROUP_JOIN_BATTLEGROUND_FAIL, ERR_IN_NON_RANDOM_BG, ERR_IN_RANDOM_BG, ERR_LFG_CANT_USE_BATTLEGROUND, Player::GetArenaTeamId(), GetBattlegroundBracketByLevel(), Player::GetBGAccessByLevel(), Battleground::GetBgTypeID(), Unit::getClass(), GetFirstMember(), Object::GetGUID(), Unit::GetLevel(), Battleground::GetMapId(), WorldLocation::GetMapId(), GetMembersCount(), Reference< TO, FROM >::GetSource(), Player::GetTeamId(), Player::HasFreeBattlegroundQueueId(), Player::HasSpell(), Player::InBattleground(), Player::InBattlegroundQueue(), Player::InBattlegroundQueueForBattlegroundQueueType(), Battleground::isArena(), Player::IsGameMaster(), isLFGGroup(), lfg::LFG_STATE_NONE, lfg::LFG_STATE_QUEUED, PvPDifficultyEntry::mapId, BattlemasterListEntry::maxGroupSize, GroupReference::next(), sBattlemasterListStore, sLFGMgr, sScriptMgr, and sWorld.

Referenced by WorldSession::HandleBattlemasterJoinArena(), and WorldSession::HandleBattlemasterJoinOpcode().

◆ ChangeLeader()

void Group::ChangeLeader ( ObjectGuid  guid)
713{
714 member_witerator slot = _getMemberWSlot(newLeaderGuid);
715
716 if (slot == m_memberSlots.end())
717 return;
718
719 Player* newLeader = ObjectAccessor::FindConnectedPlayer(slot->guid);
720
721 // Don't allow switching leader to offline players
722 if (!newLeader)
723 return;
724
725 if (!isBGGroup() && !isBFGroup())
726 {
727 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
728 // Update the group leader
730 stmt->SetData(0, newLeader->GetGUID().GetCounter());
731 stmt->SetData(1, GetGUID().GetCounter());
732 trans->Append(stmt);
733 CharacterDatabase.CommitTransaction(trans);
734
735 sInstanceSaveMgr->CopyBinds(m_leaderGuid, newLeaderGuid, newLeader);
736 }
737
739 oldLeader->RemovePlayerFlag(PLAYER_FLAGS_GROUP_LEADER);
740
742 m_leaderGuid = newLeader->GetGUID();
743 m_leaderName = newLeader->GetName();
745
747 data << slot->name;
748 BroadcastPacket(&data, true);
749
750 sScriptMgr->OnGroupChangeLeader(this, newLeaderGuid, m_leaderGuid); // This hook should be executed at the end - Not used anywhere in the original core
751}
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
Definition: DatabaseEnvFwd.h:70
@ CHAR_UPD_GROUP_LEADER
Definition: CharacterDatabase.h:284
@ PLAYER_FLAGS_GROUP_LEADER
Definition: Player.h:475
@ MEMBER_FLAG_ASSISTANT
Definition: Group.h:73
@ SMSG_GROUP_SET_LEADER
Definition: Opcodes.h:151
Player * FindConnectedPlayer(ObjectGuid const guid)
Definition: ObjectAccessor.cpp:260
LowType GetCounter() const
Definition: ObjectGuid.h:147
void SetPlayerFlag(PlayerFlags flags)
Definition: Player.h:1101
void BroadcastPacket(WorldPacket const *packet, bool ignorePlayersInBGRaid, int group=-1, ObjectGuid ignore=ObjectGuid::Empty)
Definition: Group.cpp:1725
void ToggleGroupMemberFlag(member_witerator slot, uint8 flag, bool apply)
Definition: Group.cpp:2463
member_witerator _getMemberWSlot(ObjectGuid Guid)
Definition: Group.cpp:2436

References _getMemberWSlot(), BroadcastPacket(), CHAR_UPD_GROUP_LEADER, CharacterDatabase, ObjectAccessor::FindConnectedPlayer(), ObjectGuid::GetCounter(), GetGUID(), Object::GetGUID(), WorldObject::GetName(), isBFGroup(), isBGGroup(), m_leaderGuid, m_leaderName, m_memberSlots, MEMBER_FLAG_ASSISTANT, PLAYER_FLAGS_GROUP_LEADER, PreparedStatementBase::SetData(), Player::SetPlayerFlag(), sInstanceSaveMgr, SMSG_GROUP_SET_LEADER, sScriptMgr, and ToggleGroupMemberFlag().

Referenced by Battleground::AddOrSetPlayerToCorrectBgGroup(), group_commandscript::HandleGroupLeaderCommand(), WorldSession::HandleGroupSetLeaderOpcode(), and RemoveMember().

◆ ChangeMembersGroup()

void Group::ChangeMembersGroup ( ObjectGuid  guid,
uint8  group 
)
1777{
1778 // Only raid groups have sub groups
1779 if (!isRaidGroup())
1780 return;
1781
1782 // Check if player is really in the raid
1783 member_witerator slot = _getMemberWSlot(guid);
1784 if (slot == m_memberSlots.end())
1785 return;
1786
1787 // Abort if the player is already in the target sub group
1788 uint8 prevSubGroup = GetMemberGroup(guid);
1789 if (prevSubGroup == group)
1790 return;
1791
1792 // Update the player slot with the new sub group setting
1793 slot->group = group;
1794
1795 // Increase the counter of the new sub group..
1797
1798 // ..and decrease the counter of the previous one
1799 SubGroupCounterDecrease(prevSubGroup);
1800
1801 // Preserve new sub group in database for non-raid groups
1802 if (!isBGGroup() && !isBFGroup())
1803 {
1805
1806 stmt->SetData(0, group);
1807 stmt->SetData(1, guid.GetCounter());
1808
1809 CharacterDatabase.Execute(stmt);
1810 }
1811
1812 // In case the moved player is online, update the player object with the new sub group references
1813 if (Player* player = ObjectAccessor::FindConnectedPlayer(guid))
1814 {
1815 if (player->GetGroup() == this)
1816 player->GetGroupRef().setSubGroup(group);
1817 else // 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
1818 player->GetOriginalGroupRef().setSubGroup(group);
1819 }
1820
1821 // Broadcast the changes to the group
1822 SendUpdate();
1823}
@ CHAR_UPD_GROUP_MEMBER_SUBGROUP
Definition: CharacterDatabase.h:286
uint8 GetMemberGroup(ObjectGuid guid) const
Definition: Group.cpp:2323
void SubGroupCounterDecrease(uint8 subgroup)
Definition: Group.cpp:2450

References _getMemberWSlot(), CHAR_UPD_GROUP_MEMBER_SUBGROUP, CharacterDatabase, ObjectAccessor::FindConnectedPlayer(), ObjectGuid::GetCounter(), GetMemberGroup(), isBFGroup(), isBGGroup(), isRaidGroup(), m_memberSlots, SendUpdate(), PreparedStatementBase::SetData(), SubGroupCounterDecrease(), and SubGroupCounterIncrease().

Referenced by WorldSession::HandleGroupChangeSubGroupOpcode(), and WorldSession::HandleGroupSwapSubGroupOpcode().

◆ CheckLevelForRaid()

bool Group::CheckLevelForRaid ( )
283{
284 for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
285 if (Player* player = ObjectAccessor::FindPlayer(citr->guid))
286 if (player->GetLevel() < sConfigMgr->GetOption<int32>("Group.Raid.LevelRestriction", 10))
287 return true;
288
289 return false;
290}
#define sConfigMgr
Definition: Config.h:95
std::int32_t int32
Definition: Define.h:104

References ObjectAccessor::FindPlayer(), m_memberSlots, and sConfigMgr.

Referenced by WorldSession::HandleGroupRaidConvertOpcode().

◆ ConvertToLFG()

void Group::ConvertToLFG ( bool  restricted = true)
261{
263 if (restricted)
264 {
267 }
268
269 if (!isBGGroup() && !isBFGroup())
270 {
272
273 stmt->SetData(0, uint8(m_groupType));
274 stmt->SetData(1, GetGUID().GetCounter());
275
276 CharacterDatabase.Execute(stmt);
277 }
278
279 SendUpdate();
280}
@ CHAR_UPD_GROUP_TYPE
Definition: CharacterDatabase.h:285
GroupType
Definition: Group.h:85
@ GROUPTYPE_LFG_RESTRICTED
Definition: Group.h:90
@ GROUPTYPE_LFG
Definition: Group.h:91
@ NEED_BEFORE_GREED
Definition: LootMgr.h:63

References CHAR_UPD_GROUP_TYPE, CharacterDatabase, GetGUID(), GROUPTYPE_LFG, GROUPTYPE_LFG_RESTRICTED, isBFGroup(), isBGGroup(), m_groupType, m_lootMethod, NEED_BEFORE_GREED, SendUpdate(), and PreparedStatementBase::SetData().

Referenced by lfg::LFGMgr::MakeNewGroup().

◆ ConvertToRaid()

void Group::ConvertToRaid ( )
293{
295
297
298 if (!isBGGroup() && !isBFGroup())
299 {
301
302 stmt->SetData(0, uint8(m_groupType));
303 stmt->SetData(1, GetGUID().GetCounter());
304
305 CharacterDatabase.Execute(stmt);
306 }
307
308 SendUpdate();
309
310 // update quest related GO states (quest activity dependent from raid membership)
311 for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
312 if (Player* player = ObjectAccessor::FindPlayer(citr->guid))
313 player->UpdateForQuestWorldObjects();
314
315 // pussywizard: client automatically clears df "eye" near minimap, so remove from raid browser
317 sLFGMgr->LeaveLfg(GetLeaderGUID());
318}
@ GROUPTYPE_RAID
Definition: Group.h:88
@ LFG_STATE_RAIDBROWSER
Definition: LFG.h:78
void _initRaidSubGroupsCounter()
Definition: Group.cpp:2416
ObjectGuid GetLeaderGUID() const
Definition: Group.cpp:2235

References _initRaidSubGroupsCounter(), CHAR_UPD_GROUP_TYPE, CharacterDatabase, ObjectAccessor::FindPlayer(), GetGUID(), GetLeaderGUID(), GROUPTYPE_RAID, isBFGroup(), isBGGroup(), lfg::LFG_STATE_RAIDBROWSER, m_groupType, m_memberSlots, SendUpdate(), PreparedStatementBase::SetData(), and sLFGMgr.

Referenced by WorldSession::HandleGroupRaidConvertOpcode().

◆ CountRollVote()

bool Group::CountRollVote ( ObjectGuid  playerGUID,
ObjectGuid  Guid,
uint8  Choise 
)
1329{
1330 Rolls::iterator rollI = GetRoll(Guid);
1331 if (rollI == RollId.end())
1332 return false;
1333 Roll* roll = *rollI;
1334
1335 Roll::PlayerVote::iterator itr = roll->playerVote.find(playerGUID);
1336 // this condition means that player joins to the party after roll begins
1337 // Xinef: if choice == MAX_ROLL_TYPE, player was removed from the map in removefromgroup
1338 // Xinef: itr can be invalid as it is not used below
1339 if (Choice < MAX_ROLL_TYPE && itr == roll->playerVote.end())
1340 return false;
1341
1342 if (roll->getLoot())
1343 if (roll->getLoot()->items.empty())
1344 return false;
1345
1346 switch (Choice)
1347 {
1348 case ROLL_PASS: // Player choose pass
1349 SendLootRoll(ObjectGuid::Empty, playerGUID, 128, ROLL_PASS, *roll);
1350 ++roll->totalPass;
1351 itr->second = PASS;
1352 break;
1353 case ROLL_NEED: // player choose Need
1354 SendLootRoll(ObjectGuid::Empty, playerGUID, 0, 0, *roll);
1355 ++roll->totalNeed;
1356 itr->second = NEED;
1357 break;
1358 case ROLL_GREED: // player choose Greed
1359 SendLootRoll(ObjectGuid::Empty, playerGUID, 128, ROLL_GREED, *roll);
1360 ++roll->totalGreed;
1361 itr->second = GREED;
1362 break;
1363 case ROLL_DISENCHANT: // player choose Disenchant
1364 SendLootRoll(ObjectGuid::Empty, playerGUID, 128, ROLL_DISENCHANT, *roll);
1365 ++roll->totalGreed;
1366 itr->second = DISENCHANT;
1367 break;
1368 }
1369
1370 if (roll->totalPass + roll->totalNeed + roll->totalGreed >= roll->totalPlayersRolling)
1371 {
1372 CountTheRoll(rollI, nullptr);
1373 return true;
1374 }
1375 return false;
1376}
@ PASS
Definition: Group.h:50
@ NEED
Definition: Group.h:51
@ DISENCHANT
Definition: Group.h:53
@ GREED
Definition: Group.h:52
@ ROLL_PASS
Definition: LootMgr.h:34
@ ROLL_GREED
Definition: LootMgr.h:36
@ ROLL_NEED
Definition: LootMgr.h:35
@ ROLL_DISENCHANT
Definition: LootMgr.h:37
static ObjectGuid const Empty
Definition: ObjectGuid.h:122
uint8 totalGreed
Definition: Group.h:160
uint8 totalPlayersRolling
Definition: Group.h:158
uint8 totalNeed
Definition: Group.h:159
uint8 totalPass
Definition: Group.h:161
Loot * getLoot()
Definition: Group.cpp:61
PlayerVote playerVote
Definition: Group.h:157
Rolls::iterator GetRoll(ObjectGuid Guid)
Definition: Group.cpp:2402
void CountTheRoll(Rolls::iterator roll, Map *allowedMap)
Definition: Group.cpp:1393
void SendLootRoll(ObjectGuid SourceGuid, ObjectGuid TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r)
Definition: Group.cpp:899
std::vector< LootItem > items
Definition: LootMgr.h:320

References CountTheRoll(), DISENCHANT, ObjectGuid::Empty, Roll::getLoot(), GetRoll(), GREED, Loot::items, NEED, PASS, Roll::playerVote, ROLL_DISENCHANT, ROLL_GREED, ROLL_NEED, ROLL_PASS, RollId, SendLootRoll(), Roll::totalGreed, Roll::totalNeed, Roll::totalPass, and Roll::totalPlayersRolling.

Referenced by WorldSession::HandleLootRoll(), and RemoveMember().

◆ CountTheRoll()

void Group::CountTheRoll ( Rolls::iterator  roll,
Map allowedMap 
)
1394{
1395 Roll* roll = *rollI;
1396 if (!roll->isValid()) // is loot already deleted ?
1397 {
1398 RollId.erase(rollI);
1399 delete roll;
1400 return;
1401 }
1402
1403 //end of the roll
1404 if (roll->totalNeed > 0)
1405 {
1406 if (!roll->playerVote.empty())
1407 {
1408 uint8 maxresul = 0;
1409 ObjectGuid maxguid; // pussywizard: start with 0 >_>
1410 Player* player = nullptr;
1411
1412 for (Roll::PlayerVote::const_iterator itr = roll->playerVote.begin(); itr != roll->playerVote.end(); ++itr)
1413 {
1414 if (itr->second != NEED)
1415 continue;
1416
1417 player = ObjectAccessor::FindPlayer(itr->first);
1418 if (!player || (allowedMap != nullptr && player->FindMap() != allowedMap))
1419 {
1420 --roll->totalNeed;
1421 continue;
1422 }
1423
1424 uint8 randomN = urand(1, 100);
1425 SendLootRoll(ObjectGuid::Empty, itr->first, randomN, ROLL_NEED, *roll);
1426 if (maxresul < randomN)
1427 {
1428 maxguid = itr->first;
1429 maxresul = randomN;
1430 }
1431 }
1432
1433 if (maxguid) // pussywizard: added condition
1434 {
1435 SendLootRollWon(ObjectGuid::Empty, maxguid, maxresul, ROLL_NEED, *roll);
1436 player = ObjectAccessor::FindPlayer(maxguid);
1437
1438 if (player)
1439 {
1441
1442 ItemPosCountVec dest;
1443 LootItem* item = &(roll->itemSlot >= roll->getLoot()->items.size() ? roll->getLoot()->quest_items[roll->itemSlot - roll->getLoot()->items.size()] : roll->getLoot()->items[roll->itemSlot]);
1444 InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, roll->itemid, item->count);
1445 if (msg == EQUIP_ERR_OK)
1446 {
1447 item->is_looted = true;
1448 roll->getLoot()->NotifyItemRemoved(roll->itemSlot);
1449 roll->getLoot()->unlootedCount--;
1450 AllowedLooterSet looters = item->GetAllowedLooters();
1451 Item* _item = player->StoreNewItem(dest, roll->itemid, true, item->randomPropertyId, looters);
1452 if (_item)
1453 sScriptMgr->OnGroupRollRewardItem(player, _item, _item->GetCount(), NEED, roll);
1454 player->UpdateLootAchievements(item, roll->getLoot());
1455 }
1456 else
1457 {
1458 item->is_blocked = false;
1459 item->rollWinnerGUID = player->GetGUID();
1460 player->SendEquipError(msg, nullptr, nullptr, roll->itemid);
1461 }
1462 }
1463 }
1464 else
1465 roll->totalNeed = 0;
1466 }
1467 }
1468 if (roll->totalNeed == 0 && roll->totalGreed > 0) // pussywizard: if (roll->totalNeed == 0 && ...), not else if, because numbers can be modified above if player is on a different map
1469 {
1470 if (!roll->playerVote.empty())
1471 {
1472 uint8 maxresul = 0;
1473 ObjectGuid maxguid; // pussywizard: start with 0
1474 Player* player = nullptr;
1475 RollVote rollvote = NOT_VALID;
1476
1477 Roll::PlayerVote::iterator itr;
1478 for (itr = roll->playerVote.begin(); itr != roll->playerVote.end(); ++itr)
1479 {
1480 if (itr->second != GREED && itr->second != DISENCHANT)
1481 continue;
1482
1483 player = ObjectAccessor::FindPlayer(itr->first);
1484 if (!player || (allowedMap != nullptr && player->FindMap() != allowedMap))
1485 {
1486 --roll->totalGreed;
1487 continue;
1488 }
1489
1490 uint8 randomN = urand(1, 100);
1491 SendLootRoll(ObjectGuid::Empty, itr->first, randomN, itr->second, *roll);
1492 if (maxresul < randomN)
1493 {
1494 maxguid = itr->first;
1495 maxresul = randomN;
1496 rollvote = itr->second;
1497 }
1498 }
1499
1500 if (maxguid) // pussywizard: added condition
1501 {
1502 SendLootRollWon(ObjectGuid::Empty, maxguid, maxresul, rollvote, *roll);
1503 player = ObjectAccessor::FindPlayer(maxguid);
1504
1505 if (player)
1506 {
1508
1509 LootItem* item = &(roll->itemSlot >= roll->getLoot()->items.size() ? roll->getLoot()->quest_items[roll->itemSlot - roll->getLoot()->items.size()] : roll->getLoot()->items[roll->itemSlot]);
1510
1511 if (rollvote == GREED)
1512 {
1513 ItemPosCountVec dest;
1514 InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, roll->itemid, item->count);
1515 if (msg == EQUIP_ERR_OK)
1516 {
1517 item->is_looted = true;
1518 roll->getLoot()->NotifyItemRemoved(roll->itemSlot);
1519 roll->getLoot()->unlootedCount--;
1520 AllowedLooterSet looters = item->GetAllowedLooters();
1521 Item* _item = player->StoreNewItem(dest, roll->itemid, true, item->randomPropertyId, looters);
1522 if (_item)
1523 sScriptMgr->OnGroupRollRewardItem(player, _item, _item->GetCount(), GREED, roll);
1524 player->UpdateLootAchievements(item, roll->getLoot());
1525 }
1526 else
1527 {
1528 item->is_blocked = false;
1529 item->rollWinnerGUID = player->GetGUID();
1530 player->SendEquipError(msg, nullptr, nullptr, roll->itemid);
1531 }
1532 }
1533 else if (rollvote == DISENCHANT)
1534 {
1535 item->is_looted = true;
1536 roll->getLoot()->NotifyItemRemoved(roll->itemSlot);
1537 roll->getLoot()->unlootedCount--;
1538 ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(roll->itemid);
1540
1541 ItemPosCountVec dest;
1542 InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, roll->itemid, item->count);
1543
1544 if(msg == EQUIP_ERR_OK)
1545 {
1546 player->AutoStoreLoot(pProto->DisenchantID, LootTemplates_Disenchant, true);
1547 }
1548 else
1549 {
1550 Loot loot;
1551 loot.FillLoot(pProto->DisenchantID, LootTemplates_Disenchant, player, true);
1552
1553 uint32 max_slot = loot.GetMaxSlotInLootFor(player);
1554 for(uint32 i = 0; i < max_slot; i++)
1555 {
1556 LootItem* lootItem = loot.LootItemInSlot(i, player);
1557 player->SendEquipError(msg, nullptr, nullptr, lootItem->itemid);
1558 player->SendItemRetrievalMail(lootItem->itemid, lootItem->count);
1559 }
1560 }
1561 }
1562 }
1563 }
1564 else
1565 roll->totalGreed = 0;
1566 }
1567 }
1568 if (roll->totalNeed == 0 && roll->totalGreed == 0) // pussywizard: if, not else, because numbers can be modified above if player is on a different map
1569 {
1570 SendLootAllPassed(*roll);
1571
1572 // remove is_blocked so that the item is lootable by all players
1573 LootItem* item = &(roll->itemSlot >= roll->getLoot()->items.size() ? roll->getLoot()->quest_items[roll->itemSlot - roll->getLoot()->items.size()] : roll->getLoot()->items[roll->itemSlot]);
1574 if (item)
1575 item->is_blocked = false;
1576 }
1577
1578 if (Loot* loot = roll->getLoot(); loot && loot->isLooted() && loot->sourceGameObject)
1579 {
1580 const GameObjectTemplate* goInfo = loot->sourceGameObject->GetGOInfo();
1581 if (goInfo && goInfo->type == GAMEOBJECT_TYPE_CHEST)
1582 {
1583 // Deactivate chest if the last item was rolled in group
1585 }
1586 }
1587
1588 RollId.erase(rollI);
1589 delete roll;
1590}
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
@ GO_JUST_DEACTIVATED
Definition: GameObject.h:115
InventoryResult
Definition: Item.h:40
@ EQUIP_ERR_OK
Definition: Item.h:41
std::vector< ItemPosCount > ItemPosCountVec
Definition: Player.h:772
@ NULL_BAG
Definition: Unit.h:210
@ NULL_SLOT
Definition: Unit.h:211
#define sObjectMgr
Definition: ObjectMgr.h:1640
RollVote
Definition: Group.h:49
@ NOT_VALID
Definition: Group.h:55
LootStore LootTemplates_Disenchant("disenchant_loot_template", "item disenchant id", true)
GuidSet AllowedLooterSet
Definition: LootMgr.h:152
@ ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL
Definition: DBCEnums.h:151
@ ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED_ON_LOOT
Definition: DBCEnums.h:173
@ ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED_ON_LOOT
Definition: DBCEnums.h:172
@ GAMEOBJECT_TYPE_CHEST
Definition: SharedDefines.h:1563
bool isValid() const
Definition: Reference.h:79
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:138
void SetLootState(LootState s, Unit *unit=nullptr)
Definition: GameObject.cpp:2442
Definition: GameObjectData.h:32
uint32 type
Definition: GameObjectData.h:34
Definition: Item.h:214
uint32 GetCount() const
Definition: Item.h:263
Definition: ItemTemplate.h:628
uint32 DisenchantID
Definition: ItemTemplate.h:699
Definition: ObjectGuid.h:120
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, Unit *unit=nullptr)
Definition: PlayerUpdates.cpp:2131
void AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore const &store, bool broadcast=false)
Definition: Player.cpp:13405
void SendItemRetrievalMail(uint32 itemEntry, uint32 count)
Definition: PlayerMisc.cpp:439
void UpdateLootAchievements(LootItem *item, Loot *loot)
Definition: PlayerUpdates.cpp:2121
Item * StoreNewItem(ItemPosCountVec const &pos, uint32 item, bool update, int32 randomPropertyId=0)
Definition: PlayerStorage.cpp:2546
void SendEquipError(InventoryResult msg, Item *pItem, Item *pItem2=nullptr, uint32 itemid=0)
Definition: PlayerStorage.cpp:4043
InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 item, uint32 count, uint32 *no_space_count=nullptr) const
Definition: Player.h:1260
uint8 itemSlot
Definition: Group.h:162
uint32 itemid
Definition: Group.h:152
void SendLootAllPassed(Roll const &roll)
Definition: Group.cpp:946
void SendLootRollWon(ObjectGuid SourceGuid, ObjectGuid TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r)
Definition: Group.cpp:923
Definition: LootMgr.h:155
uint32 itemid
Definition: LootMgr.h:156
bool is_blocked
Definition: LootMgr.h:165
ObjectGuid rollWinnerGUID
Definition: LootMgr.h:162
int32 randomPropertyId
Definition: LootMgr.h:159
uint8 count
Definition: LootMgr.h:163
bool is_looted
Definition: LootMgr.h:164
const AllowedLooterSet & GetAllowedLooters() const
Definition: LootMgr.h:182
Definition: LootMgr.h:313
uint32 GetMaxSlotInLootFor(Player *player) const
Definition: LootMgr.cpp:896
LootItem * LootItemInSlot(uint32 lootslot, Player *player, QuestItem **qitem=nullptr, QuestItem **ffaitem=nullptr, QuestItem **conditem=nullptr)
Definition: LootMgr.cpp:831
bool isLooted() const
Definition: LootMgr.h:368
uint8 unlootedCount
Definition: LootMgr.h:323
bool FillLoot(uint32 lootId, LootStore const &store, Player *lootOwner, bool personal, bool noEmptyError=false, uint16 lootMode=LOOT_MODE_DEFAULT, WorldObject *lootSource=nullptr)
Definition: LootMgr.cpp:553
GameObject * sourceGameObject
Definition: LootMgr.h:331
void NotifyItemRemoved(uint8 lootIndex)
Definition: LootMgr.cpp:753
std::vector< LootItem > quest_items
Definition: LootMgr.h:321

References ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL, ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED_ON_LOOT, ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED_ON_LOOT, Player::AutoStoreLoot(), Player::CanStoreNewItem(), LootItem::count, DISENCHANT, ItemTemplate::DisenchantID, ObjectGuid::Empty, EQUIP_ERR_OK, Loot::FillLoot(), WorldObject::FindMap(), ObjectAccessor::FindPlayer(), GAMEOBJECT_TYPE_CHEST, LootItem::GetAllowedLooters(), Item::GetCount(), Object::GetGUID(), Roll::getLoot(), Loot::GetMaxSlotInLootFor(), GO_JUST_DEACTIVATED, GREED, LootItem::is_blocked, LootItem::is_looted, Loot::isLooted(), Reference< TO, FROM >::isValid(), Roll::itemid, LootItem::itemid, Loot::items, Roll::itemSlot, Loot::LootItemInSlot(), LootTemplates_Disenchant, NEED, NOT_VALID, Loot::NotifyItemRemoved(), NULL_BAG, NULL_SLOT, Roll::playerVote, Loot::quest_items, LootItem::randomPropertyId, ROLL_NEED, RollId, LootItem::rollWinnerGUID, Player::SendEquipError(), Player::SendItemRetrievalMail(), SendLootAllPassed(), SendLootRoll(), SendLootRollWon(), sObjectMgr, sScriptMgr, Player::StoreNewItem(), Roll::totalGreed, Roll::totalNeed, GameObjectTemplate::type, Loot::unlootedCount, Player::UpdateAchievementCriteria(), Player::UpdateLootAchievements(), and urand().

Referenced by CountRollVote(), and EndRoll().

◆ Create()

bool Group::Create ( Player leader)
109{
110 ObjectGuid leaderGuid = leader->GetGUID();
111 ObjectGuid::LowType lowguid = sGroupMgr->GenerateGroupId();
112
113 m_guid = ObjectGuid::Create<HighGuid::Group>(lowguid);
114 m_leaderGuid = leaderGuid;
115 m_leaderName = leader->GetName();
117
118 if (isBGGroup() || isBFGroup())
120
123
124 if (!isLFGGroup())
126
128 m_looterGuid = leaderGuid;
130
133
134 if (!isBGGroup() && !isBFGroup())
135 {
138
139 // Store group in database
141
142 uint8 index = 0;
143
144 stmt->SetData(index++, lowguid);
145 stmt->SetData(index++, m_leaderGuid.GetCounter());
146 stmt->SetData(index++, uint8(m_lootMethod));
147 stmt->SetData(index++, m_looterGuid.GetCounter());
148 stmt->SetData(index++, uint8(m_lootThreshold));
149 stmt->SetData(index++, m_targetIcons[0].GetRawValue());
150 stmt->SetData(index++, m_targetIcons[1].GetRawValue());
151 stmt->SetData(index++, m_targetIcons[2].GetRawValue());
152 stmt->SetData(index++, m_targetIcons[3].GetRawValue());
153 stmt->SetData(index++, m_targetIcons[4].GetRawValue());
154 stmt->SetData(index++, m_targetIcons[5].GetRawValue());
155 stmt->SetData(index++, m_targetIcons[6].GetRawValue());
156 stmt->SetData(index++, m_targetIcons[7].GetRawValue());
157 stmt->SetData(index++, uint8(m_groupType));
158 stmt->SetData(index++, uint8(m_dungeonDifficulty));
159 stmt->SetData(index++, uint8(m_raidDifficulty));
160 stmt->SetData(index++, m_masterLooterGuid.GetCounter());
161
162 CharacterDatabase.Execute(stmt);
163
164 ASSERT(AddMember(leader)); // If the leader can't be added to a new group because it appears full, something is clearly wrong.
165
166 sScriptMgr->OnCreate(this, leader);
167 }
168 else if (!AddMember(leader))
169 return false;
170
171 return true;
172}
#define ASSERT
Definition: Errors.h:68
@ CHAR_INS_GROUP
Definition: CharacterDatabase.h:281
@ GROUPTYPE_BGRAID
Definition: Group.h:89
#define sGroupMgr
Definition: GroupMgr.h:51
@ GROUP_LOOT
Definition: LootMgr.h:62
uint32 LowType
Definition: ObjectGuid.h:124
void Clear()
Definition: ObjectGuid.h:140
ObjectGuid m_looterGuid
Definition: Group.h:349
bool AddMember(Player *player)
Definition: Group.cpp:390
ObjectGuid m_masterLooterGuid
Definition: Group.h:350
ObjectGuid m_guid
Definition: Group.h:353

References _initRaidSubGroupsCounter(), AddMember(), ASSERT, CHAR_INS_GROUP, CharacterDatabase, ObjectGuid::Clear(), DUNGEON_DIFFICULTY_NORMAL, ObjectGuid::GetCounter(), Player::GetDungeonDifficulty(), Object::GetGUID(), WorldObject::GetName(), Player::GetRaidDifficulty(), GROUP_LOOT, GROUPTYPE_BGRAID, GROUPTYPE_RAID, isBFGroup(), isBGGroup(), isLFGGroup(), ITEM_QUALITY_UNCOMMON, m_dungeonDifficulty, m_groupType, m_guid, m_leaderGuid, m_leaderName, m_looterGuid, m_lootMethod, m_lootThreshold, m_masterLooterGuid, m_raidDifficulty, m_targetIcons, PLAYER_FLAGS_GROUP_LEADER, RAID_DIFFICULTY_10MAN_NORMAL, PreparedStatementBase::SetData(), Player::SetPlayerFlag(), sGroupMgr, and sScriptMgr.

Referenced by Battlefield::AddOrSetPlayerToCorrectBfGroup(), Battleground::AddOrSetPlayerToCorrectBgGroup(), Arena::AddPlayer(), and lfg::LFGMgr::MakeNewGroup().

◆ Disband()

void Group::Disband ( bool  hideDestroy = false)
754{
755 sScriptMgr->OnGroupDisband(this);
756
757 Player* player;
758 uint32 instanceId = 0;
759
760 for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
761 {
762 if (!isBGGroup() && !isBFGroup())
763 {
764 sCharacterCache->ClearCharacterGroup(citr->guid);
765 }
766
767 player = ObjectAccessor::FindConnectedPlayer(citr->guid);
768
769 if (player && !instanceId && !isBGGroup() && !isBFGroup())
770 {
771 instanceId = player->GetInstanceId();
772 }
773
774 _homebindIfInstance(player);
775 if (!isBGGroup() && !isBFGroup())
777
778 if (!player)
779 continue;
780
781 //we cannot call _removeMember because it would invalidate member iterator
782 //if we are removing player from battleground raid
783 if (isBGGroup() || isBFGroup())
785 else
786 {
787 //we can remove player who is in battleground from his original group
788 if (player->GetOriginalGroup() == this)
789 player->SetOriginalGroup(nullptr);
790 else
791 player->SetGroup(nullptr);
792 }
793
794 // quest related GO state dependent from raid membership
795 if (isRaidGroup())
797
798 WorldPacket data;
799 if (!hideDestroy)
800 {
802 player->GetSession()->SendPacket(&data);
803 }
804
805 //we already removed player from group and in player->GetGroup() is his original group, send update
806 if (Group* group = player->GetGroup())
807 {
808 group->SendUpdate();
809 }
810 else
811 {
812 data.Initialize(SMSG_GROUP_LIST, 1 + 1 + 1 + 1 + 8 + 4 + 4 + 8);
813 data << uint8(0x10) << uint8(0) << uint8(0) << uint8(0);
814 data << m_guid << uint32(m_counter) << uint32(0) << uint64(0);
815 player->GetSession()->SendPacket(&data);
816 }
817 }
818 RollId.clear();
819 m_memberSlots.clear();
820
822
823 if (!isBGGroup() && !isBFGroup())
824 {
825 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
826
828 stmt->SetData(0, GetGUID().GetCounter());
829 trans->Append(stmt);
830
831 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER_ALL);
832 stmt->SetData(0, GetGUID().GetCounter());
833 trans->Append(stmt);
834
835 CharacterDatabase.CommitTransaction(trans);
836
837 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_LFG_DATA);
838 stmt->SetData(0, GetGUID().GetCounter());
839 CharacterDatabase.Execute(stmt);
840 }
841
842 // Cleaning up instance saved data for gameobjects when a group is disbanded
843 sInstanceSaveMgr->DeleteInstanceSavedData(instanceId);
844
845 sGroupMgr->RemoveGroup(this);
846 delete this;
847}
std::uint64_t uint64
Definition: Define.h:107
@ CHAR_DEL_GROUP_MEMBER_ALL
Definition: CharacterDatabase.h:374
@ CHAR_DEL_GROUP
Definition: CharacterDatabase.h:373
@ CHAR_DEL_LFG_DATA
Definition: CharacterDatabase.h:325
@ INSTANCE_RESET_GROUP_LEAVE
Definition: Map.h:814
@ SMSG_GROUP_LIST
Definition: Opcodes.h:155
@ SMSG_GROUP_DESTROYED
Definition: Opcodes.h:154
void RemoveFromBattlegroundOrBattlefieldRaid()
Definition: Player.cpp:13016
void RemoveAllInvites()
Definition: Group.cpp:361
void _homebindIfInstance(Player *player)
Definition: Group.cpp:2122
void Initialize(uint16 opcode, size_t newres=200)
Definition: WorldPacket.h:69

References _homebindIfInstance(), CHAR_DEL_GROUP, CHAR_DEL_GROUP_MEMBER_ALL, CHAR_DEL_LFG_DATA, CharacterDatabase, ObjectAccessor::FindConnectedPlayer(), Player::GetGroup(), GetGUID(), WorldObject::GetInstanceId(), Player::GetOriginalGroup(), Player::GetSession(), WorldPacket::Initialize(), INSTANCE_RESET_GROUP_LEAVE, isBFGroup(), isBGGroup(), isRaidGroup(), m_counter, m_guid, m_memberSlots, RemoveAllInvites(), Player::RemoveFromBattlegroundOrBattlefieldRaid(), Player::ResetInstances(), RollId, sCharacterCache, WorldSession::SendPacket(), PreparedStatementBase::SetData(), Player::SetGroup(), Player::SetOriginalGroup(), sGroupMgr, sInstanceSaveMgr, SMSG_GROUP_DESTROYED, SMSG_GROUP_LIST, sScriptMgr, and Player::UpdateForQuestWorldObjects().

Referenced by Arena::AddPlayer(), group_commandscript::HandleGroupDisbandCommand(), WorldSession::HandleGroupDisbandOpcode(), RemoveMember(), and Player::UninviteFromGroup().

◆ DoForAllMembers()

void Group::DoForAllMembers ( std::function< void(Player *)> const &  worker)
2483{
2484 for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
2485 {
2486 Player* member = itr->GetSource();
2487 if (!member)
2488 continue;
2489
2490 worker(member);
2491 }
2492}

References GetFirstMember(), and GroupReference::next().

Referenced by BattlegroundQueue::AddGroup(), WorldSession::HandleBattlemasterJoinArena(), and WorldSession::HandleBattlemasterJoinOpcode().

◆ EndRoll()

void Group::EndRoll ( Loot loot,
Map allowedMap 
)
1380{
1381 for (Rolls::iterator itr = RollId.begin(); itr != RollId.end();)
1382 {
1383 if ((*itr)->getLoot() == pLoot)
1384 {
1385 CountTheRoll(itr, allowedMap); //i don't have to edit player votes, who didn't vote ... he will pass
1386 itr = RollId.begin();
1387 }
1388 else
1389 ++itr;
1390 }
1391}

References CountTheRoll(), and RollId.

Referenced by GameObject::Update(), and Creature::Update().

◆ GetDifficulty()

Difficulty Group::GetDifficulty ( bool  isRaid) const
2383{
2384 return isRaid ? m_raidDifficulty : m_dungeonDifficulty;
2385}

References m_dungeonDifficulty, and m_raidDifficulty.

Referenced by MapInstanced::CreateInstanceForPlayer().

◆ GetDifficultyChangePreventionReason()

DifficultyPreventionChangeType Group::GetDifficultyChangePreventionReason ( ) const
inline

◆ GetDifficultyChangePreventionTime()

uint32 Group::GetDifficultyChangePreventionTime ( ) const

◆ GetDungeonDifficulty()

Difficulty Group::GetDungeonDifficulty ( ) const
2388{
2389 return m_dungeonDifficulty;
2390}

References m_dungeonDifficulty.

Referenced by AddMember().

◆ GetFirstMember() [1/2]

◆ GetFirstMember() [2/2]

GroupReference const * Group::GetFirstMember ( ) const
inline
244{ return m_memberMgr.getFirst(); }

References GroupRefMgr::getFirst(), and m_memberMgr.

◆ GetGroupType()

GroupType Group::GetGroupType ( ) const
2231{
2232 return m_groupType;
2233}

References m_groupType.

◆ GetGUID()

◆ GetInvited() [1/2]

Player * Group::GetInvited ( const std::string &  name) const
381{
382 for (InvitesList::const_iterator itr = m_invitees.begin(); itr != m_invitees.end(); ++itr)
383 {
384 if ((*itr) && (*itr)->GetName() == name)
385 return (*itr);
386 }
387 return nullptr;
388}

References m_invitees.

◆ GetInvited() [2/2]

Player * Group::GetInvited ( ObjectGuid  guid) const
371{
372 for (InvitesList::const_iterator itr = m_invitees.begin(); itr != m_invitees.end(); ++itr)
373 {
374 if ((*itr) && (*itr)->GetGUID() == guid)
375 return (*itr);
376 }
377 return nullptr;
378}

References m_invitees.

Referenced by WorldSession::HandleGroupUninviteGuidOpcode(), and WorldSession::HandleGroupUninviteOpcode().

◆ GetInviteeCount()

uint32 Group::GetInviteeCount ( ) const
inline
246{ return m_invitees.size(); }

References m_invitees.

Referenced by Player::UninviteFromGroup().

◆ GetLeader()

Player * Group::GetLeader ( )

◆ GetLeaderGUID()

◆ GetLeaderName()

const char * Group::GetLeaderName ( ) const
2251{
2252 return m_leaderName.c_str();
2253}

References m_leaderName.

Referenced by ChatLogScript::OnChat(), and Player::Satisfy().

◆ GetLooterGuid()

ObjectGuid Group::GetLooterGuid ( ) const
2261{
2262 return m_looterGuid;
2263}

References m_looterGuid.

Referenced by Unit::Kill(), and UpdateLooterGuid().

◆ GetLootMethod()

◆ GetLootThreshold()

ItemQualities Group::GetLootThreshold ( ) const
2271{
2272 return m_lootThreshold;
2273}

References m_lootThreshold.

Referenced by Loot::FillLoot().

◆ GetMasterLooterGuid()

ObjectGuid Group::GetMasterLooterGuid ( ) const

◆ GetMemberGroup()

uint8 Group::GetMemberGroup ( ObjectGuid  guid) const
2324{
2325 member_citerator mslot = _getMemberCSlot(guid);
2326 if (mslot == m_memberSlots.end())
2327 return (MAX_RAID_SUBGROUPS + 1);
2328 return mslot->group;
2329}
member_citerator _getMemberCSlot(ObjectGuid Guid) const
Definition: Group.cpp:2428

References _getMemberCSlot(), m_memberSlots, and MAX_RAID_SUBGROUPS.

Referenced by Battlefield::AddOrSetPlayerToCorrectBfGroup(), Battleground::AddOrSetPlayerToCorrectBgGroup(), ChangeMembersGroup(), WorldSession::HandleGroupSwapSubGroupOpcode(), WorldSession::HandleMessagechatOpcode(), and Unit::Kill().

◆ GetMemberGUID()

ObjectGuid Group::GetMemberGUID ( const std::string &  name)
2286{
2287 for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
2288 if (itr->name == name)
2289 return itr->guid;
2290
2291 return ObjectGuid::Empty;
2292}

References ObjectGuid::Empty, and m_memberSlots.

Referenced by WorldSession::HandleGroupSwapSubGroupOpcode(), and WorldSession::HandleGroupUninviteOpcode().

◆ GetMembersCount()

◆ GetMemberSlots()

MemberSlotList const & Group::GetMemberSlots ( ) const
inline

◆ GetRaidDifficulty()

Difficulty Group::GetRaidDifficulty ( ) const
2393{
2394 return m_raidDifficulty;
2395}

References m_raidDifficulty.

Referenced by AddMember().

◆ GetRoll()

Group::Rolls::iterator Group::GetRoll ( ObjectGuid  Guid)
2403{
2404 Rolls::iterator iter;
2405 for (iter = RollId.begin(); iter != RollId.end(); ++iter)
2406 if ((*iter)->itemGUID == Guid && (*iter)->isValid())
2407 return iter;
2408 return RollId.end();
2409}

References RollId.

Referenced by CountRollVote().

◆ GroupLoot()

void Group::GroupLoot ( Loot loot,
WorldObject pLootedObject 
)
988{
989 std::vector<LootItem>::iterator i;
990 ItemTemplate const* item;
991 uint8 itemSlot = 0;
992
993 for (i = loot->items.begin(); i != loot->items.end(); ++i, ++itemSlot)
994 {
995 if (i->freeforall)
996 continue;
997
998 item = sObjectMgr->GetItemTemplate(i->itemid);
999 if (!item)
1000 {
1001 continue;
1002 }
1003
1004 // roll for over-threshold item if it's one-player loot
1005 if (item->Quality >= uint32(m_lootThreshold))
1006 {
1007 ObjectGuid newitemGUID = ObjectGuid::Create<HighGuid::Item>(sObjectMgr->GetGenerator<HighGuid::Item>().Generate());
1008 Roll* r = new Roll(newitemGUID, *i);
1009
1010 //a vector is filled with only near party members
1011 for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
1012 {
1013 Player* member = itr->GetSource();
1014 if (!member)
1015 continue;
1016 if (member->IsAtLootRewardDistance(pLootedObject))
1017 {
1018 if (i->AllowedForPlayer(member, loot->sourceWorldObjectGUID))
1019 {
1021
1022 if (member->GetPassOnGroupLoot())
1023 {
1024 r->playerVote[member->GetGUID()] = PASS;
1025 r->totalPass++;
1026 // can't broadcast the pass now. need to wait until all rolling players are known.
1027 }
1028 else
1029 r->playerVote[member->GetGUID()] = NOT_EMITED_YET;
1030 }
1031 }
1032 }
1033
1034 if (r->totalPlayersRolling > 0)
1035 {
1036 r->setLoot(loot);
1037 r->itemSlot = itemSlot;
1040
1041 loot->items[itemSlot].is_blocked = true;
1042
1043 // If there is any "auto pass", broadcast the pass now.
1044 if (r->totalPass)
1045 {
1046 for (Roll::PlayerVote::const_iterator itr = r->playerVote.begin(); itr != r->playerVote.end(); ++itr)
1047 {
1048 Player* p = ObjectAccessor::FindPlayer(itr->first);
1049 if (!p)
1050 continue;
1051
1052 if (itr->second == PASS)
1053 SendLootRoll(newitemGUID, p->GetGUID(), 128, ROLL_PASS, *r);
1054 }
1055 }
1056
1057 SendLootStartRoll(60000, pLootedObject->GetMapId(), *r);
1058
1059 RollId.push_back(r);
1060
1061 if (Creature* creature = pLootedObject->ToCreature())
1062 {
1063 creature->m_groupLootTimer = 60000;
1064 creature->lootingGroupLowGUID = GetGUID().GetCounter();
1065 }
1066 else if (GameObject* go = pLootedObject->ToGameObject())
1067 {
1068 go->m_groupLootTimer = 60000;
1069 go->lootingGroupLowGUID = GetGUID().GetCounter();
1070 }
1071 }
1072 else
1073 delete r;
1074 }
1075 else
1076 i->is_underthreshold = true;
1077 }
1078
1079 for (i = loot->quest_items.begin(); i != loot->quest_items.end(); ++i, ++itemSlot)
1080 {
1081 if (!i->follow_loot_rules)
1082 continue;
1083
1084 item = sObjectMgr->GetItemTemplate(i->itemid);
1085 if (!item)
1086 {
1087 continue;
1088 }
1089
1090 ObjectGuid newitemGUID = ObjectGuid::Create<HighGuid::Item>(sObjectMgr->GetGenerator<HighGuid::Item>().Generate());
1091 Roll* r = new Roll(newitemGUID, *i);
1092
1093 //a vector is filled with only near party members
1094 for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
1095 {
1096 Player* member = itr->GetSource();
1097 if (!member)
1098 continue;
1099
1100 if (member->IsAtLootRewardDistance(pLootedObject))
1101 {
1102 if (i->AllowedForPlayer(member, loot->sourceWorldObjectGUID))
1103 {
1105 r->playerVote[member->GetGUID()] = NOT_EMITED_YET;
1106 }
1107 }
1108 }
1109
1110 if (r->totalPlayersRolling > 0)
1111 {
1112 r->setLoot(loot);
1113 r->itemSlot = itemSlot;
1114
1115 loot->quest_items[itemSlot - loot->items.size()].is_blocked = true;
1116
1117 SendLootStartRoll(60000, pLootedObject->GetMapId(), *r);
1118
1119 RollId.push_back(r);
1120
1121 if (Creature* creature = pLootedObject->ToCreature())
1122 {
1123 creature->m_groupLootTimer = 60000;
1124 creature->lootingGroupLowGUID = GetGUID().GetCounter();
1125 }
1126 else if (GameObject* go = pLootedObject->ToGameObject())
1127 {
1128 go->m_groupLootTimer = 60000;
1129 go->lootingGroupLowGUID = GetGUID().GetCounter();
1130 }
1131 }
1132 else
1133 delete r;
1134 }
1135}
@ NOT_EMITED_YET
Definition: Group.h:54
@ ROLL_FLAG_TYPE_DISENCHANT
Definition: LootMgr.h:46
Definition: Creature.h:46
Definition: GameObject.h:122
uint32 Quality
Definition: ItemTemplate.h:635
uint32 RequiredDisenchantSkill
Definition: ItemTemplate.h:693
GameObject * ToGameObject()
Definition: Object.h:202
Creature * ToCreature()
Definition: Object.h:197
bool IsAtLootRewardDistance(WorldObject const *pRewardSource) const
Definition: Player.cpp:12699
bool GetPassOnGroupLoot() const
Definition: Player.h:2452
void setLoot(Loot *pLoot)
Definition: Group.cpp:56
uint8 rollVoteMask
Definition: Group.h:163
void SendLootStartRoll(uint32 CountDown, uint32 mapid, const Roll &r)
Definition: Group.cpp:853
ObjectGuid sourceWorldObjectGUID
Definition: LootMgr.h:330

References ItemTemplate::DisenchantID, ObjectAccessor::FindPlayer(), ObjectGuid::GetCounter(), GetFirstMember(), GetGUID(), Object::GetGUID(), WorldLocation::GetMapId(), Player::GetPassOnGroupLoot(), Player::IsAtLootRewardDistance(), Loot::items, Roll::itemSlot, m_lootThreshold, m_maxEnchantingLevel, GroupReference::next(), NOT_EMITED_YET, PASS, Roll::playerVote, ItemTemplate::Quality, Loot::quest_items, ItemTemplate::RequiredDisenchantSkill, ROLL_FLAG_TYPE_DISENCHANT, ROLL_PASS, RollId, Roll::rollVoteMask, SendLootRoll(), SendLootStartRoll(), Roll::setLoot(), sObjectMgr, Loot::sourceWorldObjectGUID, Object::ToCreature(), Object::ToGameObject(), Roll::totalPass, and Roll::totalPlayersRolling.

Referenced by Player::SendLoot().

◆ HasFreeSlotSubGroup()

bool Group::HasFreeSlotSubGroup ( uint8  subgroup) const

◆ InInstance()

uint16 Group::InInstance ( )

◆ IsAssistant()

◆ isBFGroup()

◆ isBGGroup()

◆ IsCreated()

bool Group::IsCreated ( ) const
2226{
2227 return GetMembersCount() > 0;
2228}

References GetMembersCount().

Referenced by Player::UninviteFromGroup().

◆ IsFull()

bool Group::IsFull ( ) const

◆ IsLeader()

◆ isLFGGroup()

◆ IsLfgHeroic()

bool Group::IsLfgHeroic ( ) const
inline

◆ IsLfgRandomInstance()

◆ IsLfgWithBuff()

◆ IsMember()

◆ isRaidGroup()

◆ isRollLootActive()

bool Group::isRollLootActive ( ) const
2398{
2399 return !RollId.empty();
2400}

References RollId.

Referenced by Player::CanUninviteFromGroup().

◆ LinkMember()

void Group::LinkMember ( GroupReference pRef)
2412{
2414}
void insertFirst(LinkedListElement *pElem)
Definition: LinkedList.h:105

References LinkedListHead::insertFirst(), and m_memberMgr.

Referenced by GroupReference::targetObjectBuildLink().

◆ LoadGroupFromDB()

bool Group::LoadGroupFromDB ( Field field)
175{
176 ObjectGuid::LowType groupLowGuid = fields[16].Get<uint32>();
177 m_guid = ObjectGuid::Create<HighGuid::Group>(groupLowGuid);
178
179 m_leaderGuid = ObjectGuid::Create<HighGuid::Player>(fields[0].Get<uint32>());
180
181 // group leader not exist
182 if (!sCharacterCache->GetCharacterNameByGuid(m_leaderGuid, m_leaderName))
183 {
184 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
186 stmt->SetData(0, groupLowGuid);
187 trans->Append(stmt);
188 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER_ALL);
189 stmt->SetData(0, groupLowGuid);
190 trans->Append(stmt);
191 CharacterDatabase.CommitTransaction(trans);
192 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_LFG_DATA);
193 stmt->SetData(0, groupLowGuid);
194 CharacterDatabase.Execute(stmt);
195 return false;
196 }
197
198 m_lootMethod = LootMethod(fields[1].Get<uint8>());
199 m_looterGuid = ObjectGuid::Create<HighGuid::Player>(fields[2].Get<uint32>());
200 m_lootThreshold = ItemQualities(fields[3].Get<uint8>());
201
202 for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
203 m_targetIcons[i].Set(fields[4 + i].Get<uint64>());
204
205 m_groupType = GroupType(fields[12].Get<uint8>());
208
209 uint32 diff = fields[13].Get<uint8>();
210 if (diff >= MAX_DUNGEON_DIFFICULTY)
212 else
214
215 uint32 r_diff = fields[14].Get<uint8>();
216 if (r_diff >= MAX_RAID_DIFFICULTY)
218 else
220
221 m_masterLooterGuid = ObjectGuid::Create<HighGuid::Player>(fields[15].Get<uint32>());
222
224 sLFGMgr->_LoadFromDB(fields, GetGUID());
225
226 return true;
227}
LootMethod
Definition: LootMgr.h:58
#define MAX_RAID_DIFFICULTY
Definition: DBCEnums.h:290
Difficulty
Definition: DBCEnums.h:274
#define MAX_DUNGEON_DIFFICULTY
Definition: DBCEnums.h:289
ItemQualities
Definition: SharedDefines.h:328

References _initRaidSubGroupsCounter(), CHAR_DEL_GROUP, CHAR_DEL_GROUP_MEMBER_ALL, CHAR_DEL_LFG_DATA, CharacterDatabase, DUNGEON_DIFFICULTY_NORMAL, Field::Get(), GetGUID(), GROUPTYPE_LFG, GROUPTYPE_RAID, m_dungeonDifficulty, m_groupType, m_guid, m_leaderGuid, m_leaderName, m_looterGuid, m_lootMethod, m_lootThreshold, m_masterLooterGuid, m_raidDifficulty, m_targetIcons, MAX_DUNGEON_DIFFICULTY, MAX_RAID_DIFFICULTY, RAID_DIFFICULTY_10MAN_NORMAL, sCharacterCache, PreparedStatementBase::SetData(), sLFGMgr, and TARGETICONCOUNT.

Referenced by GroupMgr::LoadGroups().

◆ LoadMemberFromDB()

void Group::LoadMemberFromDB ( ObjectGuid::LowType  guidLow,
uint8  memberFlags,
uint8  subgroup,
uint8  roles 
)
230{
231 MemberSlot member;
232 member.guid = ObjectGuid::Create<HighGuid::Player>(guidLow);
233
234 // skip non-existed member
235 if (!sCharacterCache->GetCharacterNameByGuid(member.guid, member.name))
236 {
238 stmt->SetData(0, guidLow);
239 stmt->SetData(1, GetGUID().GetCounter());
240 CharacterDatabase.Execute(stmt);
241 return;
242 }
243
244 member.group = subgroup;
245 member.flags = memberFlags;
246 member.roles = roles;
247
248 m_memberSlots.push_back(member);
249
250 if (!isBGGroup() && !isBFGroup())
251 {
252 sCharacterCache->UpdateCharacterGroup(ObjectGuid(HighGuid::Player, guidLow), GetGUID());
253 }
254
255 SubGroupCounterIncrease(subgroup);
256
257 sLFGMgr->SetupGroupMember(member.guid, GetGUID());
258}
@ CHAR_DEL_GROUP_MEMBER
Definition: CharacterDatabase.h:283

References CHAR_DEL_GROUP_MEMBER, CharacterDatabase, Group::MemberSlot::flags, GetGUID(), Group::MemberSlot::group, Group::MemberSlot::guid, isBFGroup(), isBGGroup(), m_memberSlots, Group::MemberSlot::name, Group::MemberSlot::roles, sCharacterCache, PreparedStatementBase::SetData(), sLFGMgr, and SubGroupCounterIncrease().

Referenced by GroupMgr::LoadGroups().

◆ MasterLoot()

void Group::MasterLoot ( Loot loot,
WorldObject pLootedObject 
)
1280{
1281 LOG_DEBUG("network", "Group::MasterLoot (SMSG_LOOT_MASTER_LIST, 330)");
1282
1283 for (std::vector<LootItem>::iterator i = loot->items.begin(); i != loot->items.end(); ++i)
1284 {
1285 if (i->freeforall)
1286 continue;
1287
1288 i->is_blocked = !i->is_underthreshold;
1289 }
1290
1291 for (std::vector<LootItem>::iterator i = loot->quest_items.begin(); i != loot->quest_items.end(); ++i)
1292 {
1293 if (!i->follow_loot_rules)
1294 continue;
1295
1296 i->is_blocked = !i->is_underthreshold;
1297 }
1298
1299 std::vector<Player*> looters;
1300 for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
1301 {
1302 Player* looter = itr->GetSource();
1303 if (!looter->IsInWorld())
1304 {
1305 continue;
1306 }
1307
1308 if (looter->IsAtLootRewardDistance(pLootedObject))
1309 {
1310 looters.push_back(looter);
1311 }
1312 }
1313
1314 WorldPacket data(SMSG_LOOT_MASTER_LIST, 1 + looters.size() * (1 + 8));
1315 data << uint8(looters.size());
1316
1317 for (Player* looter : looters)
1318 {
1319 data << looter->GetGUID();
1320 }
1321
1322 for (Player* looter : looters)
1323 {
1324 looter->GetSession()->SendPacket(&data);
1325 }
1326}
@ SMSG_LOOT_MASTER_LIST
Definition: Opcodes.h:706
bool IsInWorld() const
Definition: Object.h:101

References GetFirstMember(), Player::IsAtLootRewardDistance(), Object::IsInWorld(), Loot::items, LOG_DEBUG, GroupReference::next(), Loot::quest_items, and SMSG_LOOT_MASTER_LIST.

Referenced by Player::SendLoot().

◆ NeedBeforeGreed()

void Group::NeedBeforeGreed ( Loot loot,
WorldObject pLootedObject 
)
1138{
1139 ItemTemplate const* item;
1140 uint8 itemSlot = 0;
1141 for (std::vector<LootItem>::iterator i = loot->items.begin(); i != loot->items.end(); ++i, ++itemSlot)
1142 {
1143 if (i->freeforall)
1144 continue;
1145
1146 item = sObjectMgr->GetItemTemplate(i->itemid);
1147
1148 //roll for over-threshold item if it's one-player loot
1149 if (item->Quality >= uint32(m_lootThreshold))
1150 {
1151 ObjectGuid newitemGUID = ObjectGuid::Create<HighGuid::Item>(sObjectMgr->GetGenerator<HighGuid::Item>().Generate());
1152 Roll* r = new Roll(newitemGUID, *i);
1153
1154 for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
1155 {
1156 Player* playerToRoll = itr->GetSource();
1157 if (!playerToRoll)
1158 continue;
1159
1160 if (i->AllowedForPlayer(playerToRoll, loot->sourceWorldObjectGUID) && playerToRoll->IsAtLootRewardDistance(lootedObject))
1161 {
1163 if (playerToRoll->GetPassOnGroupLoot())
1164 {
1165 r->playerVote[playerToRoll->GetGUID()] = PASS;
1166 r->totalPass++;
1167 // can't broadcast the pass now. need to wait until all rolling players are known.
1168 }
1169 else
1170 r->playerVote[playerToRoll->GetGUID()] = NOT_EMITED_YET;
1171 }
1172 }
1173
1174 if (r->totalPlayersRolling > 0)
1175 {
1176 r->setLoot(loot);
1177 r->itemSlot = itemSlot;
1180
1182 r->rollVoteMask &= ~ROLL_FLAG_TYPE_NEED;
1183
1184 loot->items[itemSlot].is_blocked = true;
1185
1186 //Broadcast Pass and Send Rollstart
1187 for (Roll::PlayerVote::const_iterator itr = r->playerVote.begin(); itr != r->playerVote.end(); ++itr)
1188 {
1189 Player* p = ObjectAccessor::FindPlayer(itr->first);
1190 if (!p)
1191 continue;
1192
1193 if (itr->second == PASS)
1194 SendLootRoll(newitemGUID, p->GetGUID(), 128, ROLL_PASS, *r);
1195 else
1196 SendLootStartRollToPlayer(60000, lootedObject->GetMapId(), p, p->CanRollForItemInLFG(item, lootedObject) == EQUIP_ERR_OK, *r);
1197 }
1198
1199 RollId.push_back(r);
1200
1201 if (Creature* creature = lootedObject->ToCreature())
1202 {
1203 creature->m_groupLootTimer = 60000;
1204 creature->lootingGroupLowGUID = GetGUID().GetCounter();
1205 }
1206 else if (GameObject* go = lootedObject->ToGameObject())
1207 {
1208 go->m_groupLootTimer = 60000;
1209 go->lootingGroupLowGUID = GetGUID().GetCounter();
1210 }
1211 }
1212 else
1213 delete r;
1214 }
1215 else
1216 i->is_underthreshold = true;
1217 }
1218
1219 for (std::vector<LootItem>::iterator i = loot->quest_items.begin(); i != loot->quest_items.end(); ++i, ++itemSlot)
1220 {
1221 if (!i->follow_loot_rules)
1222 continue;
1223
1224 item = sObjectMgr->GetItemTemplate(i->itemid);
1225 ObjectGuid newitemGUID = ObjectGuid::Create<HighGuid::Item>(sObjectMgr->GetGenerator<HighGuid::Item>().Generate());
1226 Roll* r = new Roll(newitemGUID, *i);
1227
1228 for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
1229 {
1230 Player* playerToRoll = itr->GetSource();
1231 if (!playerToRoll)
1232 continue;
1233
1234 if (i->AllowedForPlayer(playerToRoll, loot->sourceWorldObjectGUID) && playerToRoll->IsAtLootRewardDistance(lootedObject))
1235 {
1237 r->playerVote[playerToRoll->GetGUID()] = NOT_EMITED_YET;
1238 }
1239 }
1240
1241 if (r->totalPlayersRolling > 0)
1242 {
1243 r->setLoot(loot);
1244 r->itemSlot = itemSlot;
1245
1246 loot->quest_items[itemSlot - loot->items.size()].is_blocked = true;
1247
1248 //Broadcast Pass and Send Rollstart
1249 for (Roll::PlayerVote::const_iterator itr = r->playerVote.begin(); itr != r->playerVote.end(); ++itr)
1250 {
1251 Player* p = ObjectAccessor::FindPlayer(itr->first);
1252 if (!p)
1253 continue;
1254
1255 if (itr->second == PASS)
1256 SendLootRoll(newitemGUID, p->GetGUID(), 128, ROLL_PASS, *r);
1257 else
1258 SendLootStartRollToPlayer(60000, lootedObject->GetMapId(), p, p->CanRollForItemInLFG(item, lootedObject) == EQUIP_ERR_OK, *r);
1259 }
1260
1261 RollId.push_back(r);
1262
1263 if (Creature* creature = lootedObject->ToCreature())
1264 {
1265 creature->m_groupLootTimer = 60000;
1266 creature->lootingGroupLowGUID = GetGUID().GetCounter();
1267 }
1268 else if (GameObject* go = lootedObject->ToGameObject())
1269 {
1270 go->m_groupLootTimer = 60000;
1271 go->lootingGroupLowGUID = GetGUID().GetCounter();
1272 }
1273 }
1274 else
1275 delete r;
1276 }
1277}
@ ITEM_FLAGS_EXTRA_NEED_ROLL_DISABLED
Definition: ItemTemplate.h:223
uint32 Flags2
Definition: ItemTemplate.h:637
InventoryResult CanRollForItemInLFG(ItemTemplate const *item, WorldObject const *lootedObject) const
Definition: PlayerStorage.cpp:2360
void SendLootStartRollToPlayer(uint32 countDown, uint32 mapId, Player *p, bool canNeed, Roll const &r)
Definition: Group.cpp:877

References Player::CanRollForItemInLFG(), ItemTemplate::DisenchantID, EQUIP_ERR_OK, ObjectAccessor::FindPlayer(), ItemTemplate::Flags2, ObjectGuid::GetCounter(), GetFirstMember(), GetGUID(), Object::GetGUID(), WorldLocation::GetMapId(), Player::GetPassOnGroupLoot(), Player::IsAtLootRewardDistance(), ITEM_FLAGS_EXTRA_NEED_ROLL_DISABLED, Loot::items, Roll::itemSlot, m_lootThreshold, m_maxEnchantingLevel, GroupReference::next(), NOT_EMITED_YET, PASS, Roll::playerVote, ItemTemplate::Quality, Loot::quest_items, ItemTemplate::RequiredDisenchantSkill, ROLL_FLAG_TYPE_DISENCHANT, ROLL_PASS, RollId, Roll::rollVoteMask, SendLootRoll(), SendLootStartRollToPlayer(), Roll::setLoot(), sObjectMgr, Loot::sourceWorldObjectGUID, Object::ToCreature(), Object::ToGameObject(), Roll::totalPass, and Roll::totalPlayersRolling.

Referenced by Player::SendLoot().

◆ OfflineReadyCheck()

void Group::OfflineReadyCheck ( )
1750{
1751 for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
1752 {
1753 Player* player = ObjectAccessor::FindConnectedPlayer(citr->guid);
1754 if (!player)
1755 {
1757 data << citr->guid;
1758 data << uint8(0);
1759 BroadcastReadyCheck(&data);
1760 }
1761 }
1762}
@ MSG_RAID_READY_CHECK_CONFIRM
Definition: Opcodes.h:972
void BroadcastReadyCheck(WorldPacket const *packet)
Definition: Group.cpp:1738

References BroadcastReadyCheck(), ObjectAccessor::FindConnectedPlayer(), m_memberSlots, and MSG_RAID_READY_CHECK_CONFIRM.

Referenced by WorldSession::HandleRaidReadyCheckOpcode().

◆ RemoveAllInvites()

void Group::RemoveAllInvites ( )
362{
363 for (InvitesList::iterator itr = m_invitees.begin(); itr != m_invitees.end(); ++itr)
364 if (*itr)
365 (*itr)->SetGroupInvite(nullptr);
366
367 m_invitees.clear();
368}

References m_invitees.

Referenced by Disband(), and Player::UninviteFromGroup().

◆ RemoveInvite()

void Group::RemoveInvite ( Player player)
352{
353 if (player)
354 {
355 if (!m_invitees.empty())
356 m_invitees.erase(player);
357 player->SetGroupInvite(nullptr);
358 }
359}

References m_invitees, and Player::SetGroupInvite().

Referenced by AddInvite(), WorldSession::HandleGroupAcceptOpcode(), and Player::UninviteFromGroup().

◆ RemoveMember()

bool Group::RemoveMember ( ObjectGuid  guid,
const RemoveMethod method = GROUP_REMOVEMETHOD_DEFAULT,
ObjectGuid  kicker = ObjectGuid::Empty,
const char *  reason = nullptr 
)
547{
549
550 // LFG group vote kick handled in scripts
551 if (isLFGGroup(true) && method == GROUP_REMOVEMETHOD_KICK)
552 {
553 sLFGMgr->InitBoot(GetGUID(), kicker, guid, std::string(reason ? reason : ""));
554 return m_memberSlots.size() > 0;
555 }
556
557 // remove member and change leader (if need) only if strong more 2 members _before_ member remove (BG/BF allow 1 member group)
558 if (GetMembersCount() > ((isBGGroup() || isLFGGroup() || isBFGroup()) ? 1u : 2u))
559 {
561 if (player)
562 {
563 // Battleground group handling
564 if (isBGGroup() || isBFGroup())
566 else
567 // Regular group
568 {
569 if (player->GetOriginalGroup() == this)
570 player->SetOriginalGroup(nullptr);
571 else
572 player->SetGroup(nullptr);
573
574 // quest related GO state dependent from raid membership
576 }
577
578 WorldPacket data;
579
580 if (method == GROUP_REMOVEMETHOD_KICK || method == GROUP_REMOVEMETHOD_KICK_LFG)
581 {
583 player->GetSession()->SendPacket(&data);
584 }
585
586 // Do we really need to send this opcode?
587 data.Initialize(SMSG_GROUP_LIST, 1 + 1 + 1 + 1 + 8 + 4 + 4 + 8);
588 data << uint8(0x10) << uint8(0) << uint8(0) << uint8(0);
589 data << m_guid << uint32(m_counter) << uint32(0) << uint64(0);
590 player->GetSession()->SendPacket(&data);
591 }
592
593 // Remove player from group in DB
594 if (!isBGGroup() && !isBFGroup())
595 {
597 stmt->SetData(0, guid.GetCounter());
598 stmt->SetData(1, GetGUID().GetCounter());
599 CharacterDatabase.Execute(stmt);
600 }
601
602 // Remove player from loot rolls
603 for (Rolls::iterator it = RollId.begin(); it != RollId.end();)
604 {
605 Roll* roll = *it;
606 Roll::PlayerVote::iterator itr2 = roll->playerVote.find(guid);
607 if (itr2 == roll->playerVote.end())
608 {
609 ++it;
610 continue;
611 }
612
613 if (itr2->second == GREED || itr2->second == DISENCHANT)
614 --roll->totalGreed;
615 else if (itr2->second == NEED)
616 --roll->totalNeed;
617 else if (itr2->second == PASS)
618 --roll->totalPass;
619
620 if (itr2->second != NOT_VALID)
621 --roll->totalPlayersRolling;
622
623 roll->playerVote.erase(itr2);
624
625 // Xinef: itr can be erased inside
626 // Xinef: player is removed from all vote lists so it will not pass above playerVote == playerVote.end statement during second iteration
627 if (CountRollVote(guid, roll->itemGUID, MAX_ROLL_TYPE))
628 it = RollId.begin();
629 else
630 ++it;
631 }
632
633 // Update subgroups
635 if (slot != m_memberSlots.end())
636 {
637 SubGroupCounterDecrease(slot->group);
638 m_memberSlots.erase(slot);
639
640 if (!isBGGroup() && !isBFGroup())
641 {
642 sCharacterCache->ClearCharacterGroup(guid);
643 }
644 }
645
646 // Reevaluate group enchanter if the leaving player had enchanting skill or the player is offline
647 if (!player || player->GetSkillValue(SKILL_ENCHANTING))
648 {
650 }
651
652 // Pick new leader if necessary
653 bool validLeader = true;
654 if (m_leaderGuid == guid)
655 {
656 validLeader = false;
657 for (member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
658 {
660 {
661 ChangeLeader(itr->guid);
662 validLeader = true;
663 break;
664 }
665 }
666 }
667
668 _homebindIfInstance(player);
669 if (!isBGGroup() && !isBFGroup())
671
672 sScriptMgr->OnGroupRemoveMember(this, guid, method, kicker, reason);
673
674 SendUpdate();
675
676 if (!validLeader)
677 {
678 // pussywizard: temp do nothing, something causes crashes in MakeNewGroup
679 //Disband();
680 //return false;
681 }
682
683 if (isLFGGroup() && GetMembersCount() == 1)
684 {
686 uint32 mapId = sLFGMgr->GetDungeonMapId(GetGUID());
687 lfg::LfgState state = sLFGMgr->GetState(GetGUID());
688 if (!mapId || !leader || (leader->IsAlive() && leader->GetMapId() != mapId) || state == lfg::LFG_STATE_NONE)
689 {
690 Disband();
691 return false;
692 }
693 }
694
695 if (m_memberMgr.getSize() < ((isLFGGroup() || isBGGroup() || isBFGroup()) ? 1u : 2u))
696 {
697 Disband();
698 return false;
699 }
700
701 return true;
702 }
703 // If group size before player removal <= 2 then disband it
704 else
705 {
706 sScriptMgr->OnGroupRemoveMember(this, guid, method, kicker, reason);
707 Disband();
708 return false;
709 }
710}
@ MAX_ROLL_TYPE
Definition: LootMgr.h:38
@ GROUP_REMOVEMETHOD_KICK_LFG
Definition: SharedDefines.h:3590
@ GROUP_REMOVEMETHOD_KICK
Definition: SharedDefines.h:3588
@ SMSG_GROUP_UNINVITE
Definition: Opcodes.h:149
uint32 getSize() const
Definition: LinkedList.h:115
bool IsAlive() const
Definition: Unit.h:1822
ObjectGuid itemGUID
Definition: Group.h:151
void BroadcastGroupUpdate(void)
Definition: Group.cpp:2138
void Disband(bool hideDestroy=false)
Definition: Group.cpp:753
void ResetMaxEnchantingLevel()
Definition: Group.cpp:2154
void ChangeLeader(ObjectGuid guid)
Definition: Group.cpp:712
bool CountRollVote(ObjectGuid playerGUID, ObjectGuid Guid, uint8 Choise)
Definition: Group.cpp:1328

References _getMemberWSlot(), _homebindIfInstance(), BroadcastGroupUpdate(), ChangeLeader(), CHAR_DEL_GROUP_MEMBER, CharacterDatabase, CountRollVote(), Disband(), DISENCHANT, ObjectAccessor::FindConnectedPlayer(), ObjectGuid::GetCounter(), GetGUID(), GetLeaderGUID(), WorldLocation::GetMapId(), GetMembersCount(), Player::GetOriginalGroup(), Player::GetSession(), LinkedListHead::getSize(), Player::GetSkillValue(), GREED, GROUP_REMOVEMETHOD_KICK, GROUP_REMOVEMETHOD_KICK_LFG, WorldPacket::Initialize(), INSTANCE_RESET_GROUP_LEAVE, Unit::IsAlive(), isBFGroup(), isBGGroup(), isLFGGroup(), Roll::itemGUID, lfg::LFG_STATE_NONE, m_counter, m_guid, m_leaderGuid, m_memberMgr, m_memberSlots, MAX_ROLL_TYPE, NEED, NOT_VALID, PASS, Roll::playerVote, Player::RemoveFromBattlegroundOrBattlefieldRaid(), Player::ResetInstances(), ResetMaxEnchantingLevel(), RollId, sCharacterCache, WorldSession::SendPacket(), SendUpdate(), PreparedStatementBase::SetData(), Player::SetGroup(), Player::SetOriginalGroup(), SKILL_ENCHANTING, sLFGMgr, SMSG_GROUP_LIST, SMSG_GROUP_UNINVITE, sScriptMgr, SubGroupCounterDecrease(), Roll::totalGreed, Roll::totalNeed, Roll::totalPass, Roll::totalPlayersRolling, and Player::UpdateForQuestWorldObjects().

Referenced by group_commandscript::HandleGroupRemoveCommand(), lfg::LFGMgr::MakeNewGroup(), and Player::RemoveFromGroup().

◆ RemoveUniqueGroupMemberFlag()

void Group::RemoveUniqueGroupMemberFlag ( GroupMemberFlags  flag)
2457{
2458 for (member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
2459 if (itr->flags & flag)
2460 itr->flags &= ~flag;
2461}

References m_memberSlots.

Referenced by WorldSession::HandlePartyAssignmentOpcode(), and SetGroupMemberFlag().

◆ ResetInstances()

void Group::ResetInstances ( uint8  method,
bool  isRaid,
Player leader 
)
2055{
2056 if (isBGGroup() || isBFGroup() || isLFGGroup())
2057 return;
2058
2059 switch (method)
2060 {
2061 case INSTANCE_RESET_ALL:
2062 {
2063 if (leader->GetDifficulty(false) != DUNGEON_DIFFICULTY_NORMAL)
2064 break;
2065 std::vector<InstanceSave*> toUnbind;
2066 BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(leader->GetGUID(), Difficulty(DUNGEON_DIFFICULTY_NORMAL));
2067 for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr)
2068 {
2069 InstanceSave* instanceSave = itr->second.save;
2070 MapEntry const* entry = sMapStore.LookupEntry(itr->first);
2071 if (!entry || entry->IsRaid() || !instanceSave->CanReset())
2072 continue;
2073
2074 Map* map = sMapMgr->FindMap(instanceSave->GetMapId(), instanceSave->GetInstanceId());
2075 if (!map || map->ToInstanceMap()->Reset(method))
2076 {
2077 leader->SendResetInstanceSuccess(instanceSave->GetMapId());
2078 toUnbind.push_back(instanceSave);
2079 }
2080 else
2081 {
2082 leader->SendResetInstanceFailed(0, instanceSave->GetMapId());
2083 }
2084
2085 sInstanceSaveMgr->DeleteInstanceSavedData(instanceSave->GetInstanceId());
2086 }
2087 for (std::vector<InstanceSave*>::const_iterator itr = toUnbind.begin(); itr != toUnbind.end(); ++itr)
2088 sInstanceSaveMgr->UnbindAllFor(*itr);
2089 }
2090 break;
2092 {
2093 std::vector<InstanceSave*> toUnbind;
2094 BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(leader->GetGUID(), leader->GetDifficulty(isRaid));
2095 for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr)
2096 {
2097 InstanceSave* instanceSave = itr->second.save;
2098 MapEntry const* entry = sMapStore.LookupEntry(itr->first);
2099 if (!entry || entry->IsRaid() != isRaid || !instanceSave->CanReset())
2100 continue;
2101
2102 Map* map = sMapMgr->FindMap(instanceSave->GetMapId(), instanceSave->GetInstanceId());
2103 if (!map || map->ToInstanceMap()->Reset(method))
2104 {
2105 leader->SendResetInstanceSuccess(instanceSave->GetMapId());
2106 toUnbind.push_back(instanceSave);
2107 }
2108 else
2109 {
2110 leader->SendResetInstanceFailed(0, instanceSave->GetMapId());
2111 }
2112
2113 sInstanceSaveMgr->DeleteInstanceSavedData(instanceSave->GetInstanceId());
2114 }
2115 for (std::vector<InstanceSave*>::const_iterator itr = toUnbind.begin(); itr != toUnbind.end(); ++itr)
2116 sInstanceSaveMgr->UnbindAllFor(*itr);
2117 }
2118 break;
2119 }
2120}
std::unordered_map< uint32, InstancePlayerBind > BoundInstancesMap
Definition: InstanceSaveMgr.h:46
@ INSTANCE_RESET_CHANGE_DIFFICULTY
Definition: Map.h:811
@ INSTANCE_RESET_ALL
Definition: Map.h:810
#define sMapMgr
Definition: MapMgr.h:221
void SendResetInstanceSuccess(uint32 MapId)
Definition: PlayerMisc.cpp:326
void SendResetInstanceFailed(uint32 reason, uint32 MapId)
Definition: PlayerMisc.cpp:333
Definition: InstanceSaveMgr.h:56
uint32 GetMapId() const
Definition: InstanceSaveMgr.h:62
bool CanReset() const
Definition: InstanceSaveMgr.h:81
Definition: Map.h:313
InstanceMap * ToInstanceMap()
Definition: Map.h:545
bool Reset(uint8 method, GuidList *globalSkipList=nullptr)
Definition: Map.cpp:3098
Definition: DBCStructure.h:1323
bool IsRaid() const
Definition: DBCStructure.h:1352

References InstanceSave::CanReset(), DUNGEON_DIFFICULTY_NORMAL, Player::GetDifficulty(), Object::GetGUID(), InstanceSave::GetInstanceId(), InstanceSave::GetMapId(), INSTANCE_RESET_ALL, INSTANCE_RESET_CHANGE_DIFFICULTY, isBFGroup(), isBGGroup(), isLFGGroup(), MapEntry::IsRaid(), InstanceMap::Reset(), Player::SendResetInstanceFailed(), Player::SendResetInstanceSuccess(), sInstanceSaveMgr, sMapMgr, sMapStore, and Map::ToInstanceMap().

Referenced by WorldSession::HandleSetDungeonDifficultyOpcode(), and WorldSession::HandleSetRaidDifficultyOpcode().

◆ ResetMaxEnchantingLevel()

void Group::ResetMaxEnchantingLevel ( )
2155{
2157 Player* pMember = nullptr;
2158 for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
2159 {
2160 pMember = ObjectAccessor::FindPlayer(citr->guid);
2161 if (pMember && pMember->GetSession() && !pMember->GetSession()->IsSocketClosed()
2162 && m_maxEnchantingLevel < pMember->GetSkillValue(SKILL_ENCHANTING))
2163 {
2165 }
2166 }
2167}
bool IsSocketClosed() const
Definition: WorldSession.cpp:535

References ObjectAccessor::FindPlayer(), Player::GetSession(), Player::GetSkillValue(), WorldSession::IsSocketClosed(), m_maxEnchantingLevel, m_memberSlots, and SKILL_ENCHANTING.

Referenced by WorldSession::LogoutPlayer(), and RemoveMember().

◆ SameSubGroup() [1/3]

bool Group::SameSubGroup ( ObjectGuid  guid1,
MemberSlot const *  slot2 
) const
2311{
2312 member_citerator mslot1 = _getMemberCSlot(guid1);
2313 if (mslot1 == m_memberSlots.end() || !slot2)
2314 return false;
2315 return (mslot1->group == slot2->group);
2316}

References _getMemberCSlot(), Group::MemberSlot::group, and m_memberSlots.

◆ SameSubGroup() [2/3]

bool Group::SameSubGroup ( ObjectGuid  guid1,
ObjectGuid  guid2 
) const
2303{
2304 member_citerator mslot2 = _getMemberCSlot(guid2);
2305 if (mslot2 == m_memberSlots.end())
2306 return false;
2307 return SameSubGroup(guid1, &*mslot2);
2308}
bool SameSubGroup(ObjectGuid guid1, ObjectGuid guid2) const
Definition: Group.cpp:2302

References _getMemberCSlot(), m_memberSlots, and SameSubGroup().

Referenced by Player::IsInSameGroupWith(), SameSubGroup(), and PetAI::UpdateAllies().

◆ SameSubGroup() [3/3]

bool Group::SameSubGroup ( Player const *  member1,
Player const *  member2 
) const
1765{
1766 if (!member1 || !member2)
1767 return false;
1768
1769 if (member1->GetGroup() != this || member2->GetGroup() != this)
1770 return false;
1771 else
1772 return member1->GetSubGroup() == member2->GetSubGroup();
1773}

References Player::GetGroup(), and Player::GetSubGroup().

◆ SendLootAllPassed()

void Group::SendLootAllPassed ( Roll const &  roll)
947{
948 WorldPacket data(SMSG_LOOT_ALL_PASSED, (8 + 4 + 4 + 4 + 4));
949 data << roll.itemGUID; // Guid of the item rolled
950 data << uint32(roll.itemSlot); // Item loot slot
951 data << uint32(roll.itemid); // The itemEntryId for the item that shall be rolled for
952 data << uint32(roll.itemRandomPropId); // Item random property ID
953 data << uint32(roll.itemRandomSuffix); // Item random suffix ID
954
955 for (Roll::PlayerVote::const_iterator itr = roll.playerVote.begin(); itr != roll.playerVote.end(); ++itr)
956 {
957 Player* player = ObjectAccessor::FindConnectedPlayer(itr->first);
958 if (!player)
959 continue;
960
961 if (itr->second != NOT_VALID)
962 player->GetSession()->SendPacket(&data);
963 }
964}
@ SMSG_LOOT_ALL_PASSED
Definition: Opcodes.h:700

References ObjectAccessor::FindConnectedPlayer(), Player::GetSession(), Roll::itemGUID, Roll::itemid, Roll::itemRandomPropId, Roll::itemRandomSuffix, Roll::itemSlot, NOT_VALID, Roll::playerVote, WorldSession::SendPacket(), and SMSG_LOOT_ALL_PASSED.

Referenced by CountTheRoll().

◆ SendLooter()

void Group::SendLooter ( Creature creature,
Player pLooter 
)
968{
969 ASSERT(creature);
970
971 WorldPacket data(SMSG_LOOT_LIST, (8 + 8));
972 data << creature->GetGUID();
973
974 if (GetLootMethod() == MASTER_LOOT && creature->loot.hasOverThresholdItem())
976 else
977 data << uint8(0);
978
979 if (groupLooter)
980 data << groupLooter->GetPackGUID();
981 else
982 data << uint8(0);
983
984 BroadcastPacket(&data, false);
985}
@ MASTER_LOOT
Definition: LootMgr.h:61
@ SMSG_LOOT_LIST
Definition: Opcodes.h:1047
Loot loot
Definition: Creature.h:220
PackedGuid WriteAsPacked() const
Definition: ObjectGuid.h:318
ObjectGuid GetMasterLooterGuid() const
Definition: Group.cpp:2265
LootMethod GetLootMethod() const
Definition: Group.cpp:2255
bool hasOverThresholdItem() const
Definition: LootMgr.cpp:962

References ASSERT, BroadcastPacket(), Object::GetGUID(), GetLootMethod(), GetMasterLooterGuid(), Object::GetPackGUID(), Loot::hasOverThresholdItem(), Creature::loot, MASTER_LOOT, SMSG_LOOT_LIST, and ObjectGuid::WriteAsPacked().

Referenced by Unit::Kill().

◆ SendLootRoll()

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

References ObjectAccessor::FindConnectedPlayer(), Player::GetSession(), Roll::itemid, Roll::itemRandomPropId, Roll::itemRandomSuffix, Roll::itemSlot, NOT_VALID, Roll::playerVote, WorldSession::SendPacket(), and SMSG_LOOT_ROLL.

Referenced by CountRollVote(), CountTheRoll(), GroupLoot(), and NeedBeforeGreed().

◆ SendLootRollWon()

void Group::SendLootRollWon ( ObjectGuid  SourceGuid,
ObjectGuid  TargetGuid,
uint8  RollNumber,
uint8  RollType,
const Roll r 
)
924{
925 WorldPacket data(SMSG_LOOT_ROLL_WON, (8 + 4 + 4 + 4 + 4 + 8 + 1 + 1));
926 data << sourceGuid; // guid of the item rolled
927 data << uint32(roll.itemSlot); // slot
928 data << uint32(roll.itemid); // the itemEntryId for the item that shall be rolled for
929 data << uint32(roll.itemRandomSuffix); // randomSuffix
930 data << uint32(roll.itemRandomPropId); // Item random property
931 data << targetGuid; // guid of the player who won.
932 data << uint8(rollNumber); // rollnumber realted to SMSG_LOOT_ROLL
933 data << uint8(rollType); // rollType related to SMSG_LOOT_ROLL
934
935 for (Roll::PlayerVote::const_iterator itr = roll.playerVote.begin(); itr != roll.playerVote.end(); ++itr)
936 {
938 if (!p)
939 continue;
940
941 if (itr->second != NOT_VALID)
942 p->GetSession()->SendPacket(&data);
943 }
944}
@ SMSG_LOOT_ROLL_WON
Definition: Opcodes.h:701

References ObjectAccessor::FindConnectedPlayer(), Player::GetSession(), Roll::itemid, Roll::itemRandomPropId, Roll::itemRandomSuffix, Roll::itemSlot, NOT_VALID, Roll::playerVote, WorldSession::SendPacket(), and SMSG_LOOT_ROLL_WON.

Referenced by CountTheRoll().

◆ SendLootStartRoll()

void Group::SendLootStartRoll ( uint32  CountDown,
uint32  mapid,
const Roll r 
)
854{
855 WorldPacket data(SMSG_LOOT_START_ROLL, (8 + 4 + 4 + 4 + 4 + 4 + 4 + 1));
856 data << r.itemGUID; // guid of rolled item
857 data << uint32(mapid); // 3.3.3 mapid
858 data << uint32(r.itemSlot); // itemslot
859 data << uint32(r.itemid); // the itemEntryId for the item that shall be rolled for
860 data << uint32(r.itemRandomSuffix); // randomSuffix
861 data << uint32(r.itemRandomPropId); // item random property ID
862 data << uint32(r.itemCount); // items in stack
863 data << uint32(CountDown); // the countdown time to choose "need" or "greed"
864 data << uint8(r.rollVoteMask); // roll type mask
865
866 for (Roll::PlayerVote::const_iterator itr = r.playerVote.begin(); itr != r.playerVote.end(); ++itr)
867 {
869 if (!p)
870 continue;
871
872 if (itr->second == NOT_EMITED_YET)
873 p->GetSession()->SendPacket(&data);
874 }
875}
@ SMSG_LOOT_START_ROLL
Definition: Opcodes.h:703
int32 itemRandomPropId
Definition: Group.h:153
uint8 itemCount
Definition: Group.h:155
uint32 itemRandomSuffix
Definition: Group.h:154

References ObjectAccessor::FindConnectedPlayer(), Player::GetSession(), Roll::itemCount, Roll::itemGUID, Roll::itemid, Roll::itemRandomPropId, Roll::itemRandomSuffix, Roll::itemSlot, NOT_EMITED_YET, Roll::playerVote, Roll::rollVoteMask, WorldSession::SendPacket(), and SMSG_LOOT_START_ROLL.

Referenced by GroupLoot().

◆ SendLootStartRollToPlayer()

void Group::SendLootStartRollToPlayer ( uint32  countDown,
uint32  mapId,
Player p,
bool  canNeed,
Roll const &  r 
)
878{
879 if (!p)
880 return;
881
882 WorldPacket data(SMSG_LOOT_START_ROLL, (8 + 4 + 4 + 4 + 4 + 4 + 4 + 1));
883 data << r.itemGUID; // guid of rolled item
884 data << uint32(mapId); // 3.3.3 mapid
885 data << uint32(r.itemSlot); // itemslot
886 data << uint32(r.itemid); // the itemEntryId for the item that shall be rolled for
887 data << uint32(r.itemRandomSuffix); // randomSuffix
888 data << uint32(r.itemRandomPropId); // item random property ID
889 data << uint32(r.itemCount); // items in stack
890 data << uint32(countDown); // the countdown time to choose "need" or "greed"
891 uint8 voteMask = r.rollVoteMask;
892 if (!canNeed)
893 voteMask &= ~ROLL_FLAG_TYPE_NEED;
894 data << uint8(voteMask); // roll type mask
895
896 p->GetSession()->SendPacket(&data);
897}

References Player::GetSession(), Roll::itemCount, Roll::itemGUID, Roll::itemid, Roll::itemRandomPropId, Roll::itemRandomSuffix, Roll::itemSlot, Roll::rollVoteMask, WorldSession::SendPacket(), and SMSG_LOOT_START_ROLL.

Referenced by NeedBeforeGreed().

◆ SendTargetIconList()

void Group::SendTargetIconList ( WorldSession session)
1614{
1615 if (!session)
1616 return;
1617
1619 data << uint8(1); // list targets
1620
1621 for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
1622 {
1623 if (!m_targetIcons[i])
1624 continue;
1625
1626 data << uint8(i);
1627 data << m_targetIcons[i];
1628 }
1629
1630 session->SendPacket(&data);
1631}
@ MSG_RAID_TARGET_UPDATE
Definition: Opcodes.h:831

References m_targetIcons, MSG_RAID_TARGET_UPDATE, WorldSession::SendPacket(), and TARGETICONCOUNT.

Referenced by WorldSession::HandleRaidTargetUpdateOpcode().

◆ SendUpdate()

◆ SendUpdateToPlayer()

void Group::SendUpdateToPlayer ( ObjectGuid  playerGUID,
MemberSlot slot = nullptr 
)
1640{
1641 Player* player = ObjectAccessor::FindConnectedPlayer(playerGUID);
1642
1643 if (!player || player->GetGroup() != this)
1644 return;
1645
1646 // if MemberSlot wasn't provided
1647 if (!slot)
1648 {
1649 member_witerator witr = _getMemberWSlot(playerGUID);
1650
1651 if (witr == m_memberSlots.end()) // if there is no MemberSlot for such a player
1652 return;
1653
1654 slot = &(*witr);
1655 }
1656
1657 WorldPacket data(SMSG_GROUP_LIST, (1 + 1 + 1 + 1 + 1 + 4 + 8 + 4 + 4 + (GetMembersCount() - 1) * (13 + 8 + 1 + 1 + 1 + 1) + 8 + 1 + 8 + 1 + 1 + 1 + 1));
1658 data << uint8(m_groupType); // group type (flags in 3.3)
1659 data << uint8(slot->group);
1660 data << uint8(slot->flags);
1661 data << uint8(slot->roles);
1662 if (isLFGGroup())
1663 {
1664 data << uint8(sLFGMgr->GetState(m_guid) == lfg::LFG_STATE_FINISHED_DUNGEON ? 2 : 0); // FIXME - Dungeon save status? 2 = done
1665 data << uint32(sLFGMgr->GetDungeon(m_guid));
1666 }
1667
1668 data << m_guid;
1669 data << uint32(m_counter++); // 3.3, value increases every time this packet gets sent
1670 data << uint32(GetMembersCount() - 1);
1671 for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
1672 {
1673 if (slot->guid == citr->guid)
1674 continue;
1675
1676 Player* member = ObjectAccessor::FindConnectedPlayer(citr->guid);
1677
1678 uint8 onlineState = (member && !member->GetSession()->PlayerLogout()) ? MEMBER_STATUS_ONLINE : MEMBER_STATUS_OFFLINE;
1679 onlineState = onlineState | ((isBGGroup() || isBFGroup()) ? MEMBER_STATUS_PVP : 0);
1680
1681 data << citr->name;
1682 data << citr->guid; // guid
1683 data << uint8(onlineState); // online-state
1684 data << uint8(citr->group); // groupid
1685 data << uint8(citr->flags); // See enum GroupMemberFlags
1686 data << uint8(citr->roles); // Lfg Roles
1687 }
1688
1689 data << m_leaderGuid; // leader guid
1690
1691 if (GetMembersCount() - 1)
1692 {
1693 data << uint8(m_lootMethod); // loot method
1694
1696 data << m_masterLooterGuid; // master looter guid
1697 else
1698 data << uint64(0); // looter guid
1699
1700 data << uint8(m_lootThreshold); // loot threshold
1701 data << uint8(m_dungeonDifficulty); // Dungeon Difficulty
1702 data << uint8(m_raidDifficulty); // Raid Difficulty
1703 data << uint8(m_raidDifficulty >= RAID_DIFFICULTY_10MAN_HEROIC); // 3.3 Dynamic Raid Difficulty - 0 normal/1 heroic
1704 }
1705
1706 player->GetSession()->SendPacket(&data);
1707}
@ MEMBER_STATUS_OFFLINE
Definition: Group.h:60
@ MEMBER_STATUS_PVP
Definition: Group.h:62
@ MEMBER_STATUS_ONLINE
Definition: Group.h:61
@ RAID_DIFFICULTY_10MAN_HEROIC
Definition: DBCEnums.h:283
@ LFG_STATE_FINISHED_DUNGEON
Definition: LFG.h:77
bool PlayerLogout() const
Definition: WorldSession.h:338

References _getMemberWSlot(), ObjectAccessor::FindConnectedPlayer(), Group::MemberSlot::flags, Player::GetGroup(), GetMembersCount(), Player::GetSession(), Group::MemberSlot::group, Group::MemberSlot::guid, isBFGroup(), isBGGroup(), isLFGGroup(), lfg::LFG_STATE_FINISHED_DUNGEON, m_counter, m_dungeonDifficulty, m_groupType, m_guid, m_leaderGuid, m_lootMethod, m_lootThreshold, m_masterLooterGuid, m_memberSlots, m_raidDifficulty, MASTER_LOOT, MEMBER_STATUS_OFFLINE, MEMBER_STATUS_ONLINE, MEMBER_STATUS_PVP, WorldSession::PlayerLogout(), RAID_DIFFICULTY_10MAN_HEROIC, Group::MemberSlot::roles, WorldSession::SendPacket(), sLFGMgr, and SMSG_GROUP_LIST.

Referenced by SendUpdate().

◆ SetBattlefieldGroup()

void Group::SetBattlefieldGroup ( Battlefield bf)
2337{
2338 m_bfGroup = bg;
2339}

References m_bfGroup.

Referenced by Battlefield::AddOrSetPlayerToCorrectBfGroup().

◆ SetBattlegroundGroup()

void Group::SetBattlegroundGroup ( Battleground bg)
2332{
2333 m_bgGroup = bg;
2334}

References m_bgGroup.

Referenced by Battleground::SetBgRaid().

◆ SetDifficultyChangePrevention()

◆ SetDungeonDifficulty()

void Group::SetDungeonDifficulty ( Difficulty  difficulty)
2013{
2014 m_dungeonDifficulty = difficulty;
2015 if (!isBGGroup() && !isBFGroup())
2016 {
2018
2020 stmt->SetData(1, GetGUID().GetCounter());
2021
2022 CharacterDatabase.Execute(stmt);
2023 }
2024
2025 for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
2026 {
2027 Player* player = itr->GetSource();
2028 player->SetDungeonDifficulty(difficulty);
2029 player->SendDungeonDifficulty(true);
2030 }
2031}
@ CHAR_UPD_GROUP_DIFFICULTY
Definition: CharacterDatabase.h:288

References CHAR_UPD_GROUP_DIFFICULTY, CharacterDatabase, GetFirstMember(), GetGUID(), isBFGroup(), isBGGroup(), m_dungeonDifficulty, GroupReference::next(), Player::SendDungeonDifficulty(), PreparedStatementBase::SetData(), and Player::SetDungeonDifficulty().

Referenced by WorldSession::HandleSetDungeonDifficultyOpcode(), and lfg::LFGMgr::MakeNewGroup().

◆ SetGroupMemberFlag()

void Group::SetGroupMemberFlag ( ObjectGuid  guid,
bool  apply,
GroupMemberFlags  flag 
)
2342{
2343 // Assistants, main assistants and main tanks are only available in raid groups
2344 if (!isRaidGroup())
2345 return;
2346
2347 // Check if player is really in the raid
2348 member_witerator slot = _getMemberWSlot(guid);
2349 if (slot == m_memberSlots.end())
2350 return;
2351
2352 // Do flag specific actions, e.g ensure uniqueness
2353 switch (flag)
2354 {
2356 RemoveUniqueGroupMemberFlag(MEMBER_FLAG_MAINASSIST); // Remove main assist flag from current if any.
2357 break;
2359 RemoveUniqueGroupMemberFlag(MEMBER_FLAG_MAINTANK); // Remove main tank flag from current if any.
2360 break;
2362 break;
2363 default:
2364 return; // This should never happen
2365 }
2366
2367 // Switch the actual flag
2368 ToggleGroupMemberFlag(slot, flag, apply);
2369
2370 // Preserve the new setting in the db
2372
2373 stmt->SetData(0, slot->flags);
2374 stmt->SetData(1, guid.GetCounter());
2375
2376 CharacterDatabase.Execute(stmt);
2377
2378 // Broadcast the changes to the group
2379 SendUpdate();
2380}
@ CHAR_UPD_GROUP_MEMBER_FLAG
Definition: CharacterDatabase.h:287
@ MEMBER_FLAG_MAINASSIST
Definition: Group.h:75
@ MEMBER_FLAG_MAINTANK
Definition: Group.h:74
void RemoveUniqueGroupMemberFlag(GroupMemberFlags flag)
Definition: Group.cpp:2456

References _getMemberWSlot(), CHAR_UPD_GROUP_MEMBER_FLAG, CharacterDatabase, ObjectGuid::GetCounter(), isRaidGroup(), m_memberSlots, MEMBER_FLAG_ASSISTANT, MEMBER_FLAG_MAINASSIST, MEMBER_FLAG_MAINTANK, RemoveUniqueGroupMemberFlag(), SendUpdate(), PreparedStatementBase::SetData(), and ToggleGroupMemberFlag().

Referenced by WorldSession::HandleGroupAssistantLeaderOpcode(), and WorldSession::HandlePartyAssignmentOpcode().

◆ SetLfgRoles()

void Group::SetLfgRoles ( ObjectGuid  guid,
const uint8  roles 
)
2190{
2191 member_witerator slot = _getMemberWSlot(guid);
2192 if (slot == m_memberSlots.end())
2193 return;
2194
2195 slot->roles = roles;
2196 SendUpdate();
2197}

References _getMemberWSlot(), m_memberSlots, and SendUpdate().

Referenced by lfg::LFGMgr::MakeNewGroup().

◆ SetLooterGuid()

void Group::SetLooterGuid ( ObjectGuid  guid)
2175{
2176 m_looterGuid = guid;
2177}

References m_looterGuid.

Referenced by UpdateLooterGuid().

◆ SetLootMethod()

void Group::SetLootMethod ( LootMethod  method)
2170{
2171 m_lootMethod = method;
2172}

References m_lootMethod.

Referenced by WorldSession::HandleLootMethodOpcode().

◆ SetLootThreshold()

void Group::SetLootThreshold ( ItemQualities  threshold)
2185{
2186 m_lootThreshold = threshold;
2187}

References m_lootThreshold.

Referenced by WorldSession::HandleLootMethodOpcode().

◆ SetMasterLooterGuid()

void Group::SetMasterLooterGuid ( ObjectGuid  guid)
2180{
2181 m_masterLooterGuid = guid;
2182}

References m_masterLooterGuid.

Referenced by WorldSession::HandleLootMethodOpcode().

◆ SetRaidDifficulty()

void Group::SetRaidDifficulty ( Difficulty  difficulty)
2034{
2035 m_raidDifficulty = difficulty;
2036 if (!isBGGroup() && !isBFGroup())
2037 {
2039
2040 stmt->SetData(0, uint8(m_raidDifficulty));
2041 stmt->SetData(1, GetGUID().GetCounter());
2042
2043 CharacterDatabase.Execute(stmt);
2044 }
2045
2046 for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
2047 {
2048 Player* player = itr->GetSource();
2049 player->SetRaidDifficulty(difficulty);
2050 player->SendRaidDifficulty(true);
2051 }
2052}
@ CHAR_UPD_GROUP_RAID_DIFFICULTY
Definition: CharacterDatabase.h:289

References CHAR_UPD_GROUP_RAID_DIFFICULTY, CharacterDatabase, GetFirstMember(), GetGUID(), isBFGroup(), isBGGroup(), m_raidDifficulty, GroupReference::next(), Player::SendRaidDifficulty(), PreparedStatementBase::SetData(), and Player::SetRaidDifficulty().

Referenced by WorldSession::HandleSetRaidDifficultyOpcode().

◆ SetTargetIcon()

void Group::SetTargetIcon ( uint8  id,
ObjectGuid  whoGuid,
ObjectGuid  targetGuid 
)
1593{
1594 if (id >= TARGETICONCOUNT)
1595 return;
1596
1597 // clean other icons
1598 if (targetGuid)
1599 for (int i = 0; i < TARGETICONCOUNT; ++i)
1600 if (m_targetIcons[i] == targetGuid)
1602
1603 m_targetIcons[id] = targetGuid;
1604
1605 WorldPacket data(MSG_RAID_TARGET_UPDATE, (1 + 8 + 1 + 8));
1606 data << uint8(0); // set targets
1607 data << whoGuid;
1608 data << uint8(id);
1609 data << targetGuid;
1610 BroadcastPacket(&data, true);
1611}
void SetTargetIcon(uint8 id, ObjectGuid whoGuid, ObjectGuid targetGuid)
Definition: Group.cpp:1592

References BroadcastPacket(), ObjectGuid::Empty, m_targetIcons, MSG_RAID_TARGET_UPDATE, SetTargetIcon(), and TARGETICONCOUNT.

Referenced by WorldSession::HandleRaidTargetUpdateOpcode(), and SetTargetIcon().

◆ SubGroupCounterDecrease()

void Group::SubGroupCounterDecrease ( uint8  subgroup)
protected
2451{
2453 --m_subGroupsCounts[subgroup];
2454}

References m_subGroupsCounts.

Referenced by ChangeMembersGroup(), and RemoveMember().

◆ SubGroupCounterIncrease()

void Group::SubGroupCounterIncrease ( uint8  subgroup)
protected
2445{
2447 ++m_subGroupsCounts[subgroup];
2448}

References m_subGroupsCounts.

Referenced by AddMember(), ChangeMembersGroup(), and LoadMemberFromDB().

◆ ToggleGroupMemberFlag()

void Group::ToggleGroupMemberFlag ( member_witerator  slot,
uint8  flag,
bool  apply 
)
protected
2464{
2465 if (apply)
2466 slot->flags |= flag;
2467 else
2468 slot->flags &= ~flag;
2469}

Referenced by ChangeLeader(), and SetGroupMemberFlag().

◆ UpdateLooterGuid()

void Group::UpdateLooterGuid ( WorldObject pLootedObject,
bool  ifneed = false 
)
1837{
1838 // round robin style looting applies for all low
1839 // quality items in each loot method except free for all
1840 if (GetLootMethod() == FREE_FOR_ALL)
1841 return;
1842
1843 ObjectGuid oldLooterGUID = GetLooterGuid();
1844 member_citerator guid_itr = _getMemberCSlot(oldLooterGUID);
1845 if (guid_itr != m_memberSlots.end())
1846 {
1847 if (ifneed)
1848 {
1849 // not update if only update if need and ok
1850 Player* looter = ObjectAccessor::FindPlayer(guid_itr->guid);
1851 if (looter && looter->IsAtLootRewardDistance(pLootedObject))
1852 return;
1853 }
1854 ++guid_itr;
1855 }
1856
1857 // search next after current
1858 Player* pNewLooter = nullptr;
1859 for (member_citerator itr = guid_itr; itr != m_memberSlots.end(); ++itr)
1860 {
1861 if (Player* player = ObjectAccessor::FindPlayer(itr->guid))
1862 if (player->IsAtLootRewardDistance(pLootedObject))
1863 {
1864 pNewLooter = player;
1865 break;
1866 }
1867 }
1868
1869 if (!pNewLooter)
1870 {
1871 // search from start
1872 for (member_citerator itr = m_memberSlots.begin(); itr != guid_itr; ++itr)
1873 {
1874 if (Player* player = ObjectAccessor::FindPlayer(itr->guid))
1875 if (player->IsAtLootRewardDistance(pLootedObject))
1876 {
1877 pNewLooter = player;
1878 break;
1879 }
1880 }
1881 }
1882
1883 if (pNewLooter)
1884 {
1885 if (oldLooterGUID != pNewLooter->GetGUID())
1886 {
1887 SetLooterGuid(pNewLooter->GetGUID());
1888 SendUpdate();
1889 }
1890 }
1891 else
1892 {
1894 SendUpdate();
1895 }
1896}
ObjectGuid GetLooterGuid() const
Definition: Group.cpp:2260
void SetLooterGuid(ObjectGuid guid)
Definition: Group.cpp:2174

References _getMemberCSlot(), ObjectGuid::Empty, ObjectAccessor::FindPlayer(), FREE_FOR_ALL, Object::GetGUID(), GetLooterGuid(), GetLootMethod(), Player::IsAtLootRewardDistance(), m_memberSlots, SendUpdate(), and SetLooterGuid().

Referenced by Unit::Kill(), and Player::SendLoot().

◆ UpdatePlayerOutOfRange()

void Group::UpdatePlayerOutOfRange ( Player player)
1710{
1711 if (!player || !player->IsInWorld())
1712 return;
1713
1714 WorldPacket data;
1715 player->GetSession()->BuildPartyMemberStatsChangedPacket(player, &data);
1716
1717 for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
1718 {
1719 Player* member = itr->GetSource();
1720 if (member && (!member->IsInMap(player) || !member->IsWithinDist(player, member->GetSightRange(player), false)))
1721 member->GetSession()->SendPacket(&data);
1722 }
1723}
bool IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
Definition: Object.cpp:1316
bool IsInMap(WorldObject const *obj) const
Definition: Object.cpp:1285
float GetSightRange(WorldObject const *target=nullptr) const override
Definition: Player.cpp:16203
void BuildPartyMemberStatsChangedPacket(Player *player, WorldPacket *data)
Definition: GroupHandler.cpp:772

References WorldSession::BuildPartyMemberStatsChangedPacket(), GetFirstMember(), Player::GetSession(), Player::GetSightRange(), WorldObject::IsInMap(), Object::IsInWorld(), WorldObject::IsWithinDist(), GroupReference::next(), and WorldSession::SendPacket().

Referenced by AddMember().

Member Data Documentation

◆ _difficultyChangePreventionTime

uint32 Group::_difficultyChangePreventionTime
protected

◆ _difficultyChangePreventionType

DifficultyPreventionChangeType Group::_difficultyChangePreventionType
protected

◆ CustomData

DataMap Group::CustomData

◆ m_bfGroup

Battlefield* Group::m_bfGroup
protected

Referenced by isBFGroup(), and SetBattlefieldGroup().

◆ m_bgGroup

Battleground* Group::m_bgGroup
protected

◆ m_counter

uint32 Group::m_counter
protected

◆ m_dungeonDifficulty

◆ m_groupType

◆ m_guid

◆ m_invitees

InvitesList Group::m_invitees
protected

◆ m_leaderGuid

◆ m_leaderName

std::string Group::m_leaderName
protected

◆ m_lfgGroupFlags

◆ m_looterGuid

ObjectGuid Group::m_looterGuid
protected

◆ m_lootMethod

◆ m_lootThreshold

◆ m_masterLooterGuid

ObjectGuid Group::m_masterLooterGuid
protected

◆ m_maxEnchantingLevel

uint32 Group::m_maxEnchantingLevel
protected

◆ m_memberMgr

GroupRefMgr Group::m_memberMgr
protected

◆ m_memberSlots

◆ m_raidDifficulty

◆ m_subGroupsCounts

◆ m_targetIcons

◆ RollId