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, bool autoPass=false)
 
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 ( )
70{
71 sScriptMgr->OnConstructGroup(this);
72}
@ RAID_DIFFICULTY_10MAN_NORMAL
Definition DBCEnums.h:273
@ DUNGEON_DIFFICULTY_NORMAL
Definition DBCEnums.h:269
@ GROUPTYPE_NORMAL
Definition Group.h:86
@ DIFFICULTY_PREVENTION_CHANGE_NONE
Definition Group.h:133
@ FREE_FOR_ALL
Definition LootMgr.h:58
#define sScriptMgr
Definition ScriptMgr.h:727
@ 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 ( )
75{
76 sScriptMgr->OnDestructGroup(this);
77
78 if (m_bgGroup)
79 {
80 LOG_DEBUG("bg.battleground", "Group::~Group: battleground group being deleted.");
81
82 if (m_bgGroup->GetBgRaid(TEAM_ALLIANCE) == this)
83 {
85 }
86 else if (m_bgGroup->GetBgRaid(TEAM_HORDE) == this)
87 {
89 }
90 else
91 LOG_ERROR("bg.battleground", "Group::~Group: battleground group is not linked to the correct battleground.");
92 }
93
94 Rolls::iterator itr;
95 while (!RollId.empty())
96 {
97 itr = RollId.begin();
98 Roll* r = *itr;
99 RollId.erase(itr);
100 delete(r);
101 }
102
103 // Sub group counters clean up
104 delete[] m_subGroupsCounts;
105}
#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:482
void SetBgRaid(TeamId teamId, Group *bg_raid)
Definition Battleground.cpp:1806
Rolls RollId
Definition Group.h:351
Definition Group.h:143

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
2189{
2190 // if player is reinvited to group and in the instance - cancel homebind timer
2191 if (!player->FindMap() || !player->FindMap()->IsDungeon())
2192 return;
2193 InstancePlayerBind* bind = sInstanceSaveMgr->PlayerGetBoundInstance(player->GetGUID(), player->FindMap()->GetId(), player->GetDifficulty(player->FindMap()->IsRaid()));
2194 if (bind && bind->save->GetInstanceId() == player->GetInstanceId())
2195 player->m_InstanceValid = true;
2196}
#define sInstanceSaveMgr
Definition InstanceSaveMgr.h:202
uint32 GetInstanceId() const
Definition InstanceSaveMgr.h:61
bool IsDungeon() const
Definition Map.h:295
bool IsRaid() const
Definition Map.h:297
uint32 GetId() const
Definition Map.h:229
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:113
bool m_InstanceValid
Definition Player.h:2446
Difficulty GetDifficulty(bool isRaid) const
Definition Player.h:1928
Map * FindMap() const
Definition Object.h:538
uint32 GetInstanceId() const
Definition Object.h:449
Definition InstanceSaveMgr.h:39
InstanceSave * save
Definition InstanceSaveMgr.h:40

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
2489{
2490 for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
2491 if (itr->guid == Guid)
2492 return itr;
2493 return m_memberSlots.end();
2494}
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(), SameSubGroup(), and UpdateLooterGuid().

◆ _getMemberWSlot()

Group::member_witerator Group::_getMemberWSlot ( ObjectGuid  Guid)
protected
2497{
2498 for (member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
2499 if (itr->guid == Guid)
2500 return itr;
2501 return m_memberSlots.end();
2502}
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
2183{
2184 if (player && !player->IsGameMaster() && player->FindMap() && sMapStore.LookupEntry(player->GetMapId())->IsDungeon())
2185 player->m_InstanceValid = false;
2186}
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
bool IsGameMaster() const
Definition Player.h:1176
uint32 GetMapId() const
Definition Position.h:280

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

Referenced by Disband(), and RemoveMember().

◆ _initRaidSubGroupsCounter()

void Group::_initRaidSubGroupsCounter ( )
protected
2477{
2478 // Sub group counters initialization
2479 if (!m_subGroupsCounts)
2481
2482 memset((void*)m_subGroupsCounts, 0, (MAX_RAID_SUBGROUPS)*sizeof(uint8));
2483
2484 for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
2485 ++m_subGroupsCounts[itr->group];
2486}
std::uint8_t uint8
Definition Define.h:109
#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)
320{
321 if (!player || player->GetGroupInvite())
322 return false;
323 Group* group = player->GetGroup();
324 if (group && (group->isBGGroup() || group->isBFGroup()))
325 group = player->GetOriginalGroup();
326 if (group)
327 return false;
328
329 RemoveInvite(player);
330
331 m_invitees.insert(player);
332
333 player->SetGroupInvite(this);
334
335 sScriptMgr->OnGroupInviteMember(this, player->GetGUID());
336
337 return true;
338}
Definition Group.h:169
InvitesList m_invitees
Definition Group.h:338
void RemoveInvite(Player *player)
Definition Group.cpp:350
bool isBGGroup() const
Definition Group.cpp:2275
bool isBFGroup() const
Definition Group.cpp:2280
void SetGroupInvite(Group *group)
Definition Player.h:2477
Group * GetGroup()
Definition Player.h:2478
Group * GetGroupInvite()
Definition Player.h:2476
Group * GetOriginalGroup()
Definition Player.h:2493

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)
341{
342 if (!AddInvite(player))
343 return false;
344
345 m_leaderGuid = player->GetGUID();
346 m_leaderName = player->GetName();
347 return true;
348}
ObjectGuid m_leaderGuid
Definition Group.h:339
bool AddInvite(Player *player)
Definition Group.cpp:319
std::string const & GetName() const
Definition Object.h:464

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)
390{
391 if (!player)
392 return false;
393
394 // Get first not-full group
395 uint8 subGroup = 0;
397 {
398 bool groupFound = false;
399 for (; subGroup < MAX_RAID_SUBGROUPS; ++subGroup)
400 {
401 if (m_subGroupsCounts[subGroup] < MAXGROUPSIZE)
402 {
403 groupFound = true;
404 break;
405 }
406 }
407 // We are raid group and no one slot is free
408 if (!groupFound)
409 return false;
410 }
411
412 MemberSlot member;
413 member.guid = player->GetGUID();
414 member.name = player->GetName();
415 member.group = subGroup;
416 member.flags = 0;
417 member.roles = 0;
418 m_memberSlots.push_back(member);
419
420 if (!isBGGroup() && !isBFGroup())
421 {
422 sCharacterCache->UpdateCharacterGroup(player->GetGUID(), GetGUID());
423 }
424
425 SubGroupCounterIncrease(subGroup);
426
427 player->SetGroupInvite(nullptr);
428 if (player->GetGroup())
429 {
430 if (isBGGroup() || isBFGroup()) // if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid()
431 player->SetBattlegroundOrBattlefieldRaid(this, subGroup);
432 else //if player is in bg raid and we are adding him to normal group, then call SetOriginalGroup()
433 player->SetOriginalGroup(this, subGroup);
434 }
435 else //if player is not in group, then call set group
436 player->SetGroup(this, subGroup);
437
438 // if the same group invites the player back, cancel the homebind timer
440
441 if (!isRaidGroup()) // reset targetIcons for non-raid-groups
442 {
443 for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
444 m_targetIcons[i].Clear();
445 }
446
447 if (!isBGGroup() && !isBFGroup())
448 {
450 stmt->SetData(0, GetGUID().GetCounter());
451 stmt->SetData(1, member.guid.GetCounter());
452 stmt->SetData(2, member.flags);
453 stmt->SetData(3, member.group);
454 stmt->SetData(4, member.roles);
455 CharacterDatabase.Execute(stmt);
456 }
457
458 SendUpdate();
459
460 if (player)
461 {
462 sScriptMgr->OnGroupAddMember(this, player->GetGUID());
463
464 if (!IsLeader(player->GetGUID()) && !isBGGroup() && !isBFGroup())
465 {
467
469 {
471 player->SendDungeonDifficulty(true);
472 }
473 if (player->GetRaidDifficulty() != GetRaidDifficulty())
474 {
476 player->SendRaidDifficulty(true);
477 }
478 }
479 else if (IsLeader(player->GetGUID()) && isLFGGroup()) // pussywizard
480 {
482 }
483
486
487 // quest related GO state dependent from raid membership
488 if (isRaidGroup())
490
491 {
492 // Broadcast new player group member fields to rest of the group
494
495 UpdateData groupData;
496 WorldPacket groupDataPacket;
497
498 // Broadcast group members' fields to player
499 for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
500 {
501 if (itr->GetSource() == player) // pussywizard: no check same map, adding members is single threaded
502 {
503 continue;
504 }
505
506 if (Player* itrMember = itr->GetSource())
507 {
508 if (player->HaveAtClient(itrMember))
509 {
510 itrMember->SetFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
511 itrMember->BuildValuesUpdateBlockForPlayer(&groupData, player);
512 itrMember->RemoveFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
513 }
514
515 if (itrMember->HaveAtClient(player))
516 {
517 UpdateData newData;
518 WorldPacket newDataPacket;
519 player->BuildValuesUpdateBlockForPlayer(&newData, itrMember);
520 if (newData.HasData())
521 {
522 newData.BuildPacket(newDataPacket);
523 itrMember->SendDirectMessage(&newDataPacket);
524 }
525 }
526 }
527 }
528
529 if (groupData.HasData())
530 {
531 groupData.BuildPacket(groupDataPacket);
532 player->SendDirectMessage(&groupDataPacket);
533 }
534
536 }
537
538 if (m_maxEnchantingLevel < player->GetSkillValue(SKILL_ENCHANTING))
540 }
541
542 return true;
543}
#define sCharacterCache
Definition CharacterCache.h:83
@ CHAR_REP_GROUP_MEMBER
Definition CharacterDatabase.h:284
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition DatabaseEnv.cpp:21
#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:647
@ SKILL_ENCHANTING
Definition SharedDefines.h:2954
@ UF_FLAG_PARTY_MEMBER
Definition UpdateFieldFlags.h:33
Definition GroupReference.h:27
GroupReference * next()
Definition GroupReference.h:36
bool isLFGGroup(bool restricted=false) const
Definition Group.cpp:2264
bool IsLeader(ObjectGuid guid) const
Definition Group.cpp:2340
void SendUpdate()
Definition Group.cpp:1664
ObjectGuid GetGUID() const
Definition Group.cpp:2305
void _cancelHomebindIfInstance(Player *player)
Definition Group.cpp:2188
Difficulty GetRaidDifficulty() const
Definition Group.cpp:2452
ObjectGuid m_targetIcons[TARGETICONCOUNT]
Definition Group.h:346
void UpdatePlayerOutOfRange(Player *player)
Definition Group.cpp:1740
GroupReference * GetFirstMember()
Definition Group.h:243
void SubGroupCounterIncrease(uint8 subgroup)
Definition Group.cpp:2504
Difficulty GetDungeonDifficulty() const
Definition Group.cpp:2447
bool isRaidGroup() const
Definition Group.cpp:2270
void BuildValuesUpdateBlockForPlayer(UpdateData *data, Player *target)
Definition Object.cpp:257
void RemoveFieldNotifyFlag(uint16 flag)
Definition Object.h:196
void SetFieldNotifyFlag(uint16 flag)
Definition Object.h:195
Definition Player.h:1082
Difficulty GetRaidDifficulty() const
Definition Player.h:1930
void SetOriginalGroup(Group *group, int8 subgroup=-1)
Definition Player.cpp:13055
void SetGroupUpdateFlag(uint32 flag)
Definition Player.h:2484
void SendDirectMessage(WorldPacket const *data) const
Definition Player.cpp:5712
uint16 GetSkillValue(uint32 skill) const
Definition Player.cpp:5457
void SetDungeonDifficulty(Difficulty dungeon_difficulty)
Definition Player.h:1932
void SetGroup(Group *group, int8 subgroup=-1)
Definition Player.cpp:11509
bool HaveAtClient(WorldObject const *u) const
Definition Player.cpp:11358
void UpdateForQuestWorldObjects()
Definition PlayerUpdates.cpp:1792
void SetRaidDifficulty(Difficulty raid_difficulty)
Definition Player.h:1933
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:1929
void SendRaidDifficulty(bool IsInGroup, int32 forcedDifficulty=-1)
Definition PlayerMisc.cpp:177
void SetBattlegroundOrBattlefieldRaid(Group *group, int8 subgroup=-1)
Definition Player.cpp:13027
Acore::Types::is_default< T > SetData(const uint8 index, T value)
Definition PreparedStatement.h:77
Definition PreparedStatement.h:157
Definition UpdateData.h:52
bool HasData() const
Definition UpdateData.h:60
bool BuildPacket(WorldPacket &packet)
Definition UpdateData.cpp:48
Definition WorldPacket.h:26

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  )
2199{
2200 // FG: HACK: force flags update on group leave - for values update hack
2201 // -- not very efficient but safe
2202 for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
2203 {
2204 Player* pp = ObjectAccessor::FindPlayer(citr->guid);
2205 if (pp)
2206 {
2209 LOG_DEBUG("group", "-- Forced group value update for '{}'", pp->GetName());
2210 }
2211 }
2212}
@ UNIT_FIELD_FACTIONTEMPLATE
Definition UpdateFields.h:115
@ UNIT_FIELD_BYTES_2
Definition UpdateFields.h:161
void ForceValuesUpdateAtIndex(uint32)
Definition Object.cpp:2078
Player * FindPlayer(ObjectGuid const guid)
Definition ObjectAccessor.cpp:245

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 
)
1757{
1758 for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
1759 {
1760 Player* player = itr->GetSource();
1761 if (!player || (ignore && player->GetGUID() == ignore) || (ignorePlayersInBGRaid && player->GetGroup() != this))
1762 continue;
1763
1764 if (group == -1 || itr->getSubGroup() == group)
1765 player->GetSession()->SendPacket(packet);
1766 }
1767}
WorldSession * GetSession() const
Definition Player.h:2007
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
Definition WorldSession.cpp:226

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)
1770{
1771 for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
1772 {
1773 Player* player = itr->GetSource();
1774 if (player)
1775 if (IsLeader(player->GetGUID()) || IsAssistant(player->GetGUID()))
1776 player->GetSession()->SendPacket(packet);
1777 }
1778}
bool IsAssistant(ObjectGuid guid) const
Definition Group.cpp:2354

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 
)
1930{
1931 // check if this group is LFG group
1932 if (isLFGGroup())
1934
1935 BattlemasterListEntry const* bgEntry = sBattlemasterListStore.LookupEntry(bgTemplate->GetBgTypeID());
1936 if (!bgEntry)
1938
1939 // too many players in the group
1940 if (GetMembersCount() > bgEntry->maxGroupSize)
1941 return ERR_BATTLEGROUND_NONE;
1942
1943 // get a player as reference, to compare other players' stats to (arena team id, level bracket, etc.)
1944 Player* reference = GetFirstMember()->GetSource();
1945 if (!reference)
1947
1948 PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgTemplate->GetMapId(), reference->GetLevel());
1949 if (!bracketEntry)
1951
1952 uint32 arenaTeamId = reference->GetArenaTeamId(arenaSlot);
1953 TeamId teamId = reference->GetTeamId();
1954
1956
1957 // check every member of the group to be able to join
1958 uint32 memberscount = 0;
1959 for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next(), ++memberscount)
1960 {
1961 Player* member = itr->GetSource();
1962
1963 // don't let join with offline members
1964 if (!member)
1966
1967 if (!sScriptMgr->CanGroupJoinBattlegroundQueue(this, member, bgTemplate, MinPlayerCount, isRated, arenaSlot))
1969
1970 // don't allow cross-faction groups to join queue
1971 if (member->GetTeamId() != teamId && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
1973
1974 // don't let join rated matches if the arena team id doesn't match
1975 if (isRated && member->GetArenaTeamId(arenaSlot) != arenaTeamId)
1977
1978 // not in the same battleground level braket, don't let join
1979 PvPDifficultyEntry const* memberBracketEntry = GetBattlegroundBracketByLevel(bracketEntry->mapId, member->GetLevel());
1980 if (memberBracketEntry != bracketEntry)
1982
1983 // check for deserter debuff in case not arena queue
1984 if (bgTemplate->GetBgTypeID() != BATTLEGROUND_AA && !member->CanJoinToBattleground())
1986
1987 // check if someone in party is using dungeon system
1988 lfg::LfgState lfgState = sLFGMgr->GetState(member->GetGUID());
1989 if (lfgState > lfg::LFG_STATE_NONE && (lfgState != lfg::LFG_STATE_QUEUED || !sWorld->getBoolConfig(CONFIG_ALLOW_JOIN_BG_AND_LFG)))
1990 {
1992 }
1993
1994 // pussywizard: prevent joining when any member is in bg/arena
1995 if (member->InBattleground())
1997
1998 // pussywizard: check for free slot, this is actually ensured before calling this function, but just in case
1999 if (!member->HasFreeBattlegroundQueueId())
2001
2002 // don't let join if someone from the group is already in that bg queue
2003 if (member->InBattlegroundQueueForBattlegroundQueueType(bgQueueTypeId))
2004 {
2006 }
2007
2008 // don't let join if someone from the group is in bg queue random
2009 if (member->InBattlegroundQueueForBattlegroundQueueType(bgQueueTypeIdRandom))
2010 return ERR_IN_RANDOM_BG;
2011
2012 // don't let join to bg queue random if someone from the group is already in bg queue
2013 if (bgTemplate->GetBgTypeID() == BATTLEGROUND_RB && member->InBattlegroundQueue())
2014 return ERR_IN_NON_RANDOM_BG;
2015
2016 // don't let Death Knights join BG queues when they are not allowed to be teleported yet
2017 if (member->IsClass(CLASS_DEATH_KNIGHT, CLASS_CONTEXT_TELEPORT) && member->GetMapId() == MAP_EBON_HOLD && !member->IsGameMaster() && !member->HasSpell(50977))
2019
2020 if (!member->GetBGAccessByLevel(bgTemplate->GetBgTypeID()))
2021 {
2023 }
2024 }
2025
2026 // for arenas: check party size is proper
2027 if (bgTemplate->isArena() && memberscount != MinPlayerCount)
2029
2030 //check against other arena team members
2031 if (isRated)
2032 {
2033 ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId);
2034 for (auto const& itr : arenaTeam->GetMembers())
2035 {
2036 Player* teamMember = ObjectAccessor::FindConnectedPlayer(itr.Guid);
2037 //are they online and not a member of this current group?
2038 if (teamMember && !IsMember(teamMember->GetGUID()))
2039 {
2040 //are they already in queue for a rated arena?
2041 if (teamMember->InBattlegroundQueueForBattlegroundQueueType(bgQueueTypeId))
2042 {
2043 GroupQueueInfo ginfo;
2044 BattlegroundQueue& queue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId);
2045 if (queue.GetPlayerGroupInfoData(teamMember->GetGUID(), &ginfo))
2046 {
2047 if (ginfo.IsRated)
2049 }
2050 }
2051 //are they currently in an arena match?
2052 Battleground* bg = teamMember->GetBattleground(false);
2053 if (bg && bg->isRated() && bg->GetMinPlayersPerTeam() == MinPlayerCount)
2055 }
2056 }
2057 }
2058
2059 return GroupJoinBattlegroundResult(bgTemplate->GetBgTypeID());
2060}
@ MAP_EBON_HOLD
Definition AreaDefines.h:257
#define sArenaTeamMgr
Definition ArenaTeamMgr.h:69
#define sBattlegroundMgr
Definition BattlegroundMgr.h:187
DBCStorage< BattlemasterListEntry > sBattlemasterListStore(BattlemasterListEntryfmt)
PvPDifficultyEntry const * GetBattlegroundBracketByLevel(uint32 mapid, uint32 level)
Definition DBCStores.cpp:793
std::uint32_t uint32
Definition Define.h:107
@ CONFIG_ALLOW_JOIN_BG_AND_LFG
Definition IWorld.h:169
@ CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP
Definition IWorld.h:73
#define sLFGMgr
Definition LFGMgr.h:641
GroupJoinBattlegroundResult
Definition SharedDefines.h:3651
@ ERR_BATTLEGROUND_JOIN_TIMED_OUT
Definition SharedDefines.h:3664
@ ERR_BATTLEGROUND_JOIN_FAILED
Definition SharedDefines.h:3665
@ ERR_LFG_CANT_USE_BATTLEGROUND
Definition SharedDefines.h:3666
@ ERR_IN_NON_RANDOM_BG
Definition SharedDefines.h:3668
@ ERR_BATTLEGROUND_NONE
Definition SharedDefines.h:3654
@ ERR_GROUP_JOIN_BATTLEGROUND_DESERTERS
Definition SharedDefines.h:3655
@ ERR_ARENA_TEAM_PARTY_SIZE
Definition SharedDefines.h:3656
@ ERR_BATTLEGROUND_TOO_MANY_QUEUES
Definition SharedDefines.h:3657
@ ERR_GROUP_JOIN_BATTLEGROUND_FAIL
Definition SharedDefines.h:3653
@ ERR_BATTLEGROUND_JOIN_RANGE_INDEX
Definition SharedDefines.h:3663
@ ERR_IN_RANDOM_BG
Definition SharedDefines.h:3667
@ CLASS_DEATH_KNIGHT
Definition SharedDefines.h:146
@ BATTLEGROUND_AA
Definition SharedDefines.h:3502
@ BATTLEGROUND_RB
Definition SharedDefines.h:3509
BattlegroundQueueTypeId
Definition SharedDefines.h:3635
TeamId
Definition SharedDefines.h:759
@ CLASS_CONTEXT_TELEPORT
Definition UnitDefines.h:228
Definition ArenaTeam.h:137
static BattlegroundQueueTypeId BGQueueTypeId(BattlegroundTypeId bgTypeId, uint8 arenaType)
Definition BattlegroundMgr.cpp:686
Definition BattlegroundQueue.h:64
bool GetPlayerGroupInfoData(ObjectGuid guid, GroupQueueInfo *ginfo)
Definition BattlegroundQueue.cpp:385
Definition Battleground.h:294
uint32 GetMinPlayersPerTeam() const
Definition Battleground.h:341
bool isRated() const
Definition Battleground.h:406
uint32 GetMembersCount() const
Definition Group.h:245
bool IsMember(ObjectGuid guid) const
Definition Group.cpp:2335
bool InBattlegroundQueueForBattlegroundQueueType(BattlegroundQueueTypeId bgQueueTypeId) const
Definition Player.cpp:12185
bool InBattleground() const
Definition Player.h:2262
TeamId GetTeamId(bool original=false) const
Definition Player.h:2118
Battleground * GetBattleground(bool create=false) const
Definition Player.cpp:12142
bool InBattlegroundQueue(bool ignoreArena=false) const
Definition Player.cpp:12151
uint32 GetArenaTeamId(uint8 slot) const
Definition Player.cpp:16150
bool CanJoinToBattleground() const
Definition Player.cpp:11305
bool HasFreeBattlegroundQueueId() const
Definition Player.cpp:12205
bool IsClass(Classes playerClass, ClassContext context=CLASS_CONTEXT_NONE) const override
Definition Player.cpp:1288
bool HasSpell(uint32 spell) const override
Definition Player.cpp:3878
bool GetBGAccessByLevel(BattlegroundTypeId bgTypeId) const
Definition Player.cpp:12264
FROM * GetSource() const
Definition Reference.h:97
uint8 GetLevel() const
Definition Unit.h:1024
#define sWorld
Definition World.h:357
Player * FindConnectedPlayer(ObjectGuid const guid)
Definition ObjectAccessor.cpp:257
LfgState
Definition LFG.h:67
@ LFG_STATE_NONE
Definition LFG.h:68
@ LFG_STATE_QUEUED
Definition LFG.h:70
Definition DBCStructure.h:604
uint32 maxGroupSize
Definition DBCStructure.h:611
Definition BattlegroundQueue.h:31
bool IsRated
Definition BattlegroundQueue.h:36
Definition DBCStructure.h:1432
uint32 mapId
Definition DBCStructure.h:1434

References BATTLEGROUND_AA, BATTLEGROUND_RB, BattlegroundMgr::BGQueueTypeId(), Player::CanJoinToBattleground(), CLASS_CONTEXT_TELEPORT, 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, ObjectAccessor::FindConnectedPlayer(), Player::GetArenaTeamId(), Player::GetBattleground(), GetBattlegroundBracketByLevel(), Player::GetBGAccessByLevel(), Battleground::GetBgTypeID(), GetFirstMember(), Object::GetGUID(), Unit::GetLevel(), Battleground::GetMapId(), WorldLocation::GetMapId(), ArenaTeam::GetMembers(), GetMembersCount(), Battleground::GetMinPlayersPerTeam(), BattlegroundQueue::GetPlayerGroupInfoData(), Reference< TO, FROM >::GetSource(), Player::GetTeamId(), Player::HasFreeBattlegroundQueueId(), Player::HasSpell(), Player::InBattleground(), Player::InBattlegroundQueue(), Player::InBattlegroundQueueForBattlegroundQueueType(), Battleground::isArena(), Player::IsClass(), Player::IsGameMaster(), isLFGGroup(), IsMember(), Battleground::isRated(), GroupQueueInfo::IsRated, lfg::LFG_STATE_NONE, lfg::LFG_STATE_QUEUED, MAP_EBON_HOLD, PvPDifficultyEntry::mapId, BattlemasterListEntry::maxGroupSize, GroupReference::next(), sArenaTeamMgr, sBattlegroundMgr, sBattlemasterListStore, sLFGMgr, sScriptMgr, and sWorld.

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

◆ ChangeLeader()

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

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 
)
1808{
1809 // Only raid groups have sub groups
1810 if (!isRaidGroup())
1811 return;
1812
1813 // Check if player is really in the raid
1814 member_witerator slot = _getMemberWSlot(guid);
1815 if (slot == m_memberSlots.end())
1816 return;
1817
1818 // Abort if the player is already in the target sub group
1819 uint8 prevSubGroup = GetMemberGroup(guid);
1820 if (prevSubGroup == group)
1821 return;
1822
1823 // Update the player slot with the new sub group setting
1824 slot->group = group;
1825
1826 // Increase the counter of the new sub group..
1828
1829 // ..and decrease the counter of the previous one
1830 SubGroupCounterDecrease(prevSubGroup);
1831
1832 // Preserve new sub group in database for non-raid groups
1833 if (!isBGGroup() && !isBFGroup())
1834 {
1836
1837 stmt->SetData(0, group);
1838 stmt->SetData(1, guid.GetCounter());
1839
1840 CharacterDatabase.Execute(stmt);
1841 }
1842
1843 // In case the moved player is online, update the player object with the new sub group references
1844 if (Player* player = ObjectAccessor::FindConnectedPlayer(guid))
1845 {
1846 if (player->GetGroup() == this)
1847 player->GetGroupRef().setSubGroup(group);
1848 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
1849 player->GetOriginalGroupRef().setSubGroup(group);
1850 }
1851
1852 // Broadcast the changes to the group
1853 SendUpdate();
1854}
@ CHAR_UPD_GROUP_MEMBER_SUBGROUP
Definition CharacterDatabase.h:288
uint8 GetMemberGroup(ObjectGuid guid) const
Definition Group.cpp:2383
void SubGroupCounterDecrease(uint8 subgroup)
Definition Group.cpp:2510

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

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

Referenced by WorldSession::HandleGroupRaidConvertOpcode().

◆ ConvertToLFG()

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

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

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 
)
1360{
1361 Rolls::iterator rollI = GetRoll(Guid);
1362 if (rollI == RollId.end())
1363 return false;
1364 Roll* roll = *rollI;
1365
1366 Roll::PlayerVote::iterator itr = roll->playerVote.find(playerGUID);
1367 // this condition means that player joins to the party after roll begins
1368 // Xinef: if choice == MAX_ROLL_TYPE, player was removed from the map in removefromgroup
1369 // Xinef: itr can be invalid as it is not used below
1370 if (Choice < MAX_ROLL_TYPE && itr == roll->playerVote.end())
1371 return false;
1372
1373 if (roll->getLoot())
1374 if (roll->getLoot()->items.empty())
1375 return false;
1376
1377 switch (Choice)
1378 {
1379 case ROLL_PASS: // Player choose pass
1380 SendLootRoll(ObjectGuid::Empty, playerGUID, 128, ROLL_PASS, *roll);
1381 ++roll->totalPass;
1382 itr->second = PASS;
1383 break;
1384 case ROLL_NEED: // player choose Need
1385 SendLootRoll(ObjectGuid::Empty, playerGUID, 0, 0, *roll);
1386 ++roll->totalNeed;
1387 itr->second = NEED;
1388 break;
1389 case ROLL_GREED: // player choose Greed
1390 SendLootRoll(ObjectGuid::Empty, playerGUID, 128, ROLL_GREED, *roll);
1391 ++roll->totalGreed;
1392 itr->second = GREED;
1393 break;
1394 case ROLL_DISENCHANT: // player choose Disenchant
1395 SendLootRoll(ObjectGuid::Empty, playerGUID, 128, ROLL_DISENCHANT, *roll);
1396 ++roll->totalGreed;
1397 itr->second = DISENCHANT;
1398 break;
1399 }
1400
1401 if (roll->totalPass + roll->totalNeed + roll->totalGreed >= roll->totalPlayersRolling)
1402 {
1403 CountTheRoll(rollI, nullptr);
1404 return true;
1405 }
1406 return false;
1407}
@ 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:33
@ ROLL_GREED
Definition LootMgr.h:35
@ ROLL_NEED
Definition LootMgr.h:34
@ ROLL_DISENCHANT
Definition LootMgr.h:36
void SendLootRoll(ObjectGuid SourceGuid, ObjectGuid TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r, bool autoPass=false)
Definition Group.cpp:898
Rolls::iterator GetRoll(ObjectGuid Guid)
Definition Group.cpp:2462
void CountTheRoll(Rolls::iterator roll, Map *allowedMap)
Definition Group.cpp:1424
static ObjectGuid const Empty
Definition ObjectGuid.h:120
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:60
PlayerVote playerVote
Definition Group.h:157
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 
)
1425{
1426 Roll* roll = *rollI;
1427 if (!roll->isValid()) // is loot already deleted ?
1428 {
1429 RollId.erase(rollI);
1430 delete roll;
1431 return;
1432 }
1433
1434 //end of the roll
1435 if (roll->totalNeed > 0)
1436 {
1437 if (!roll->playerVote.empty())
1438 {
1439 uint8 maxresul = 0;
1440 ObjectGuid maxguid; // pussywizard: start with 0 >_>
1441 Player* player = nullptr;
1442
1443 for (Roll::PlayerVote::const_iterator itr = roll->playerVote.begin(); itr != roll->playerVote.end(); ++itr)
1444 {
1445 if (itr->second != NEED)
1446 continue;
1447
1448 player = ObjectAccessor::FindPlayer(itr->first);
1449 if (!player || (allowedMap != nullptr && player->FindMap() != allowedMap))
1450 {
1451 --roll->totalNeed;
1452 continue;
1453 }
1454
1455 uint8 randomN = urand(1, 100);
1456 SendLootRoll(ObjectGuid::Empty, itr->first, randomN, ROLL_NEED, *roll);
1457 if (maxresul < randomN)
1458 {
1459 maxguid = itr->first;
1460 maxresul = randomN;
1461 }
1462 }
1463
1464 if (maxguid) // pussywizard: added condition
1465 {
1466 SendLootRollWon(ObjectGuid::Empty, maxguid, maxresul, ROLL_NEED, *roll);
1467 player = ObjectAccessor::FindPlayer(maxguid);
1468
1469 if (player)
1470 {
1472
1473 ItemPosCountVec dest;
1474 LootItem* item = &(roll->itemSlot >= roll->getLoot()->items.size() ? roll->getLoot()->quest_items[roll->itemSlot - roll->getLoot()->items.size()] : roll->getLoot()->items[roll->itemSlot]);
1475 InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, roll->itemid, item->count);
1476 if (msg == EQUIP_ERR_OK)
1477 {
1478 item->is_looted = true;
1479 roll->getLoot()->NotifyItemRemoved(roll->itemSlot);
1480 roll->getLoot()->unlootedCount--;
1481 AllowedLooterSet looters = item->GetAllowedLooters();
1482 Item* _item = player->StoreNewItem(dest, roll->itemid, true, item->randomPropertyId, looters);
1483 if (_item)
1484 sScriptMgr->OnPlayerGroupRollRewardItem(player, _item, _item->GetCount(), NEED, roll);
1485 player->UpdateLootAchievements(item, roll->getLoot());
1486 }
1487 else
1488 {
1489 item->is_blocked = false;
1490 item->rollWinnerGUID = player->GetGUID();
1491 player->SendEquipError(msg, nullptr, nullptr, roll->itemid);
1492 }
1493 }
1494 }
1495 else
1496 roll->totalNeed = 0;
1497 }
1498 }
1499 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
1500 {
1501 if (!roll->playerVote.empty())
1502 {
1503 uint8 maxresul = 0;
1504 ObjectGuid maxguid; // pussywizard: start with 0
1505 Player* player = nullptr;
1506 RollVote rollvote = NOT_VALID;
1507
1508 Roll::PlayerVote::iterator itr;
1509 for (itr = roll->playerVote.begin(); itr != roll->playerVote.end(); ++itr)
1510 {
1511 if (itr->second != GREED && itr->second != DISENCHANT)
1512 continue;
1513
1514 player = ObjectAccessor::FindPlayer(itr->first);
1515 if (!player || (allowedMap != nullptr && player->FindMap() != allowedMap))
1516 {
1517 --roll->totalGreed;
1518 continue;
1519 }
1520
1521 uint8 randomN = urand(1, 100);
1522 SendLootRoll(ObjectGuid::Empty, itr->first, randomN, itr->second, *roll);
1523 if (maxresul < randomN)
1524 {
1525 maxguid = itr->first;
1526 maxresul = randomN;
1527 rollvote = itr->second;
1528 }
1529 }
1530
1531 if (maxguid) // pussywizard: added condition
1532 {
1533 SendLootRollWon(ObjectGuid::Empty, maxguid, maxresul, rollvote, *roll);
1534 player = ObjectAccessor::FindPlayer(maxguid);
1535
1536 if (player)
1537 {
1539
1540 LootItem* item = &(roll->itemSlot >= roll->getLoot()->items.size() ? roll->getLoot()->quest_items[roll->itemSlot - roll->getLoot()->items.size()] : roll->getLoot()->items[roll->itemSlot]);
1541
1542 if (rollvote == GREED)
1543 {
1544 ItemPosCountVec dest;
1545 InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, roll->itemid, item->count);
1546 if (msg == EQUIP_ERR_OK)
1547 {
1548 item->is_looted = true;
1549 roll->getLoot()->NotifyItemRemoved(roll->itemSlot);
1550 roll->getLoot()->unlootedCount--;
1551 AllowedLooterSet looters = item->GetAllowedLooters();
1552 Item* _item = player->StoreNewItem(dest, roll->itemid, true, item->randomPropertyId, looters);
1553 if (_item)
1554 sScriptMgr->OnPlayerGroupRollRewardItem(player, _item, _item->GetCount(), GREED, roll);
1555 player->UpdateLootAchievements(item, roll->getLoot());
1556 }
1557 else
1558 {
1559 item->is_blocked = false;
1560 item->rollWinnerGUID = player->GetGUID();
1561 player->SendEquipError(msg, nullptr, nullptr, roll->itemid);
1562 }
1563 }
1564 else if (rollvote == DISENCHANT)
1565 {
1566 item->is_looted = true;
1567 roll->getLoot()->NotifyItemRemoved(roll->itemSlot);
1568 roll->getLoot()->unlootedCount--;
1569 ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(roll->itemid);
1571
1572 ItemPosCountVec dest;
1573 InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, roll->itemid, item->count);
1574
1575 if (msg == EQUIP_ERR_OK)
1576 {
1577 player->AutoStoreLoot(pProto->DisenchantID, LootTemplates_Disenchant, true);
1578 }
1579 else
1580 {
1581 Loot loot;
1582 loot.FillLoot(pProto->DisenchantID, LootTemplates_Disenchant, player, true);
1583
1584 uint32 max_slot = loot.GetMaxSlotInLootFor(player);
1585 for(uint32 i = 0; i < max_slot; i++)
1586 {
1587 LootItem* lootItem = loot.LootItemInSlot(i, player);
1588 player->SendEquipError(msg, nullptr, nullptr, lootItem->itemid);
1589 player->SendItemRetrievalMail(lootItem->itemid, lootItem->count);
1590 }
1591 }
1592 }
1593 }
1594 }
1595 else
1596 roll->totalGreed = 0;
1597 }
1598 }
1599 if (roll->totalNeed == 0 && roll->totalGreed == 0) // pussywizard: if, not else, because numbers can be modified above if player is on a different map
1600 {
1601 SendLootAllPassed(*roll);
1602
1603 // remove is_blocked so that the item is lootable by all players
1604 LootItem* item = &(roll->itemSlot >= roll->getLoot()->items.size() ? roll->getLoot()->quest_items[roll->itemSlot - roll->getLoot()->items.size()] : roll->getLoot()->items[roll->itemSlot]);
1605 if (item)
1606 item->is_blocked = false;
1607 }
1608
1609 if (Loot* loot = roll->getLoot(); loot && loot->isLooted() && loot->sourceGameObject)
1610 {
1611 const GameObjectTemplate* goInfo = loot->sourceGameObject->GetGOInfo();
1612 if (goInfo && goInfo->type == GAMEOBJECT_TYPE_CHEST)
1613 {
1614 // Deactivate chest if the last item was rolled in group
1616 }
1617 }
1618
1619 RollId.erase(rollI);
1620 delete roll;
1621}
@ ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL
Definition DBCEnums.h:143
@ ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED_ON_LOOT
Definition DBCEnums.h:165
@ ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED_ON_LOOT
Definition DBCEnums.h:164
@ GO_JUST_DEACTIVATED
Definition GameObject.h:113
RollVote
Definition Group.h:49
@ NOT_VALID
Definition Group.h:55
InventoryResult
Definition Item.h:46
@ EQUIP_ERR_OK
Definition Item.h:47
@ NULL_BAG
Definition Item.h:40
@ NULL_SLOT
Definition Item.h:41
LootStore LootTemplates_Disenchant("disenchant_loot_template", "item disenchant id", true)
GuidSet AllowedLooterSet
Definition LootMgr.h:151
#define sObjectMgr
Definition ObjectMgr.h:1650
std::vector< ItemPosCount > ItemPosCountVec
Definition Player.h:777
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:44
@ GAMEOBJECT_TYPE_CHEST
Definition SharedDefines.h:1563
GameObjectTemplate const * GetGOInfo() const
Definition GameObject.h:136
void SetLootState(LootState s, Unit *unit=nullptr)
Definition GameObject.cpp:2427
void SendLootAllPassed(Roll const &roll)
Definition Group.cpp:945
void SendLootRollWon(ObjectGuid SourceGuid, ObjectGuid TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r)
Definition Group.cpp:922
Definition Item.h:220
uint32 GetCount() const
Definition Item.h:272
Definition ObjectGuid.h:118
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, Unit *unit=nullptr)
Definition PlayerUpdates.cpp:2177
void AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore const &store, bool broadcast=false)
Definition Player.cpp:13432
void SendItemRetrievalMail(uint32 itemEntry, uint32 count)
Definition PlayerMisc.cpp:439
void UpdateLootAchievements(LootItem *item, Loot *loot)
Definition PlayerUpdates.cpp:2167
Item * StoreNewItem(ItemPosCountVec const &pos, uint32 item, bool update, int32 randomPropertyId=0)
Definition PlayerStorage.cpp:2524
void SendEquipError(InventoryResult msg, Item *pItem, Item *pItem2=nullptr, uint32 itemid=0)
Definition PlayerStorage.cpp:4021
InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 item, uint32 count, uint32 *no_space_count=nullptr) const
Definition Player.h:1292
bool isValid() const
Definition Reference.h:79
uint8 itemSlot
Definition Group.h:162
uint32 itemid
Definition Group.h:152
Definition GameObjectData.h:31
uint32 type
Definition GameObjectData.h:33
Definition ItemTemplate.h:619
uint32 DisenchantID
Definition ItemTemplate.h:690
Definition LootMgr.h:154
uint32 itemid
Definition LootMgr.h:155
bool is_blocked
Definition LootMgr.h:164
ObjectGuid rollWinnerGUID
Definition LootMgr.h:161
int32 randomPropertyId
Definition LootMgr.h:158
uint8 count
Definition LootMgr.h:162
bool is_looted
Definition LootMgr.h:163
const AllowedLooterSet & GetAllowedLooters() const
Definition LootMgr.h:181
Definition LootMgr.h:313
uint32 GetMaxSlotInLootFor(Player *player) const
Definition LootMgr.cpp:915
LootItem * LootItemInSlot(uint32 lootslot, Player *player, QuestItem **qitem=nullptr, QuestItem **ffaitem=nullptr, QuestItem **conditem=nullptr)
Definition LootMgr.cpp:850
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:570
GameObject * sourceGameObject
Definition LootMgr.h:331
void NotifyItemRemoved(uint8 lootIndex)
Definition LootMgr.cpp:772
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)
108{
109 ObjectGuid leaderGuid = leader->GetGUID();
110 ObjectGuid::LowType lowguid = sGroupMgr->GenerateGroupId();
111
112 m_guid = ObjectGuid::Create<HighGuid::Group>(lowguid);
113 m_leaderGuid = leaderGuid;
114 m_leaderName = leader->GetName();
116
117 if (isBGGroup() || isBFGroup())
119
122
123 if (!isLFGGroup())
125
127 m_looterGuid = leaderGuid;
129
132
133 if (!isBGGroup() && !isBFGroup())
134 {
137
138 // Store group in database
140
141 uint8 index = 0;
142
143 stmt->SetData(index++, lowguid);
144 stmt->SetData(index++, m_leaderGuid.GetCounter());
145 stmt->SetData(index++, uint8(m_lootMethod));
146 stmt->SetData(index++, m_looterGuid.GetCounter());
147 stmt->SetData(index++, uint8(m_lootThreshold));
148 stmt->SetData(index++, m_targetIcons[0].GetRawValue());
149 stmt->SetData(index++, m_targetIcons[1].GetRawValue());
150 stmt->SetData(index++, m_targetIcons[2].GetRawValue());
151 stmt->SetData(index++, m_targetIcons[3].GetRawValue());
152 stmt->SetData(index++, m_targetIcons[4].GetRawValue());
153 stmt->SetData(index++, m_targetIcons[5].GetRawValue());
154 stmt->SetData(index++, m_targetIcons[6].GetRawValue());
155 stmt->SetData(index++, m_targetIcons[7].GetRawValue());
156 stmt->SetData(index++, uint8(m_groupType));
157 stmt->SetData(index++, uint8(m_dungeonDifficulty));
158 stmt->SetData(index++, uint8(m_raidDifficulty));
159 stmt->SetData(index++, m_masterLooterGuid.GetCounter());
160
161 CharacterDatabase.Execute(stmt);
162
163 ASSERT(AddMember(leader)); // If the leader can't be added to a new group because it appears full, something is clearly wrong.
164
165 sScriptMgr->OnCreate(this, leader);
166 }
167 else if (!AddMember(leader))
168 return false;
169
170 return true;
171}
@ CHAR_INS_GROUP
Definition CharacterDatabase.h:283
#define ASSERT
Definition Errors.h:68
#define sGroupMgr
Definition GroupMgr.h:51
@ GROUPTYPE_BGRAID
Definition Group.h:89
@ GROUP_LOOT
Definition LootMgr.h:61
ObjectGuid m_looterGuid
Definition Group.h:349
bool AddMember(Player *player)
Definition Group.cpp:389
ObjectGuid m_masterLooterGuid
Definition Group.h:350
ObjectGuid m_guid
Definition Group.h:353
uint32 LowType
Definition ObjectGuid.h:122
void Clear()
Definition ObjectGuid.h:138

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

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)
2543{
2544 for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
2545 {
2546 Player* member = itr->GetSource();
2547 if (!member)
2548 continue;
2549
2550 worker(member);
2551 }
2552}

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

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

◆ EndRoll()

void Group::EndRoll ( Loot loot,
Map allowedMap 
)
1411{
1412 for (Rolls::iterator itr = RollId.begin(); itr != RollId.end();)
1413 {
1414 if ((*itr)->getLoot() == pLoot)
1415 {
1416 CountTheRoll(itr, allowedMap); //i don't have to edit player votes, who didn't vote ... he will pass
1417 itr = RollId.begin();
1418 }
1419 else
1420 ++itr;
1421 }
1422}

References CountTheRoll(), and RollId.

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

◆ GetDifficulty()

Difficulty Group::GetDifficulty ( bool  isRaid) const
2443{
2444 return isRaid ? m_raidDifficulty : m_dungeonDifficulty;
2445}

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
2448{
2449 return m_dungeonDifficulty;
2450}

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
2291{
2292 return m_groupType;
2293}

References m_groupType.

◆ GetGUID()

◆ GetInvited() [1/2]

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

References m_invitees.

◆ GetInvited() [2/2]

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

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
2311{
2312 return m_leaderName.c_str();
2313}

References m_leaderName.

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

◆ GetLooterGuid()

ObjectGuid Group::GetLooterGuid ( ) const
2321{
2322 return m_looterGuid;
2323}

References m_looterGuid.

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

◆ GetLootMethod()

◆ GetLootThreshold()

ItemQualities Group::GetLootThreshold ( ) const
2331{
2332 return m_lootThreshold;
2333}

References m_lootThreshold.

Referenced by Loot::FillLoot().

◆ GetMasterLooterGuid()

ObjectGuid Group::GetMasterLooterGuid ( ) const

◆ GetMemberGroup()

uint8 Group::GetMemberGroup ( ObjectGuid  guid) const
2384{
2385 member_citerator mslot = _getMemberCSlot(guid);
2386 if (mslot == m_memberSlots.end())
2387 return (MAX_RAID_SUBGROUPS + 1);
2388 return mslot->group;
2389}
member_citerator _getMemberCSlot(ObjectGuid Guid) const
Definition Group.cpp:2488

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)
2346{
2347 for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
2348 if (itr->name == name)
2349 return itr->guid;
2350
2351 return ObjectGuid::Empty;
2352}

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
2453{
2454 return m_raidDifficulty;
2455}

References m_raidDifficulty.

Referenced by AddMember().

◆ GetRoll()

Group::Rolls::iterator Group::GetRoll ( ObjectGuid  Guid)
2463{
2464 Rolls::iterator iter;
2465 for (iter = RollId.begin(); iter != RollId.end(); ++iter)
2466 if ((*iter)->itemGUID == Guid && (*iter)->isValid())
2467 return iter;
2468 return RollId.end();
2469}

References RollId.

Referenced by CountRollVote().

◆ GroupLoot()

void Group::GroupLoot ( Loot loot,
WorldObject pLootedObject 
)
1004{
1005 std::vector<LootItem>::iterator i;
1006 ItemTemplate const* item;
1007 uint8 itemSlot = 0;
1008
1009 for (i = loot->items.begin(); i != loot->items.end(); ++i, ++itemSlot)
1010 {
1011 if (i->freeforall)
1012 continue;
1013
1014 item = sObjectMgr->GetItemTemplate(i->itemid);
1015 if (!item)
1016 {
1017 continue;
1018 }
1019
1020 // roll for over-threshold item if it's one-player loot
1021 if (item->Quality >= uint32(m_lootThreshold))
1022 {
1023 ObjectGuid newitemGUID = ObjectGuid::Create<HighGuid::Item>(sObjectMgr->GetGenerator<HighGuid::Item>().Generate());
1024 Roll* r = new Roll(newitemGUID, *i);
1025
1026 //a vector is filled with only near party members
1027 for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
1028 {
1029 Player* member = itr->GetSource();
1030 if (!member || !member->GetSession())
1031 continue;
1032 if (member->IsAtLootRewardDistance(pLootedObject))
1033 {
1035
1036 RollVote vote = member->GetPassOnGroupLoot() ? PASS : NOT_EMITED_YET;
1037 if (!CanRollOnItem(*i, member, loot))
1038 {
1039 vote = PASS;
1040 ++r->totalPass;
1041 }
1042
1043 r->playerVote[member->GetGUID()] = vote;
1044 }
1045 }
1046
1047 if (r->totalPlayersRolling > 0)
1048 {
1049 r->setLoot(loot);
1050 r->itemSlot = itemSlot;
1053
1054 loot->items[itemSlot].is_blocked = true;
1055
1056 // If there is any "auto pass", broadcast the pass now.
1057 if (r->totalPass)
1058 {
1059 for (Roll::PlayerVote::const_iterator itr = r->playerVote.begin(); itr != r->playerVote.end(); ++itr)
1060 {
1061 Player* p = ObjectAccessor::FindPlayer(itr->first);
1062 if (!p)
1063 continue;
1064
1065 if (itr->second == PASS)
1066 SendLootRoll(newitemGUID, p->GetGUID(), 128, ROLL_PASS, *r, true);
1067 }
1068 }
1069
1070 if (r->totalPass == r->totalPlayersRolling)
1071 delete r;
1072 else
1073 {
1074 SendLootStartRoll(60000, pLootedObject->GetMapId(), *r);
1075
1076 RollId.push_back(r);
1077
1078 if (Creature* creature = pLootedObject->ToCreature())
1079 {
1080 creature->m_groupLootTimer = 60000;
1081 creature->lootingGroupLowGUID = GetGUID().GetCounter();
1082 }
1083 else if (GameObject* go = pLootedObject->ToGameObject())
1084 {
1085 go->m_groupLootTimer = 60000;
1086 go->lootingGroupLowGUID = GetGUID().GetCounter();
1087 }
1088 }
1089 }
1090 else
1091 delete r;
1092 }
1093 else
1094 i->is_underthreshold = true;
1095 }
1096
1097 for (i = loot->quest_items.begin(); i != loot->quest_items.end(); ++i, ++itemSlot)
1098 {
1099 if (!i->follow_loot_rules)
1100 continue;
1101
1102 item = sObjectMgr->GetItemTemplate(i->itemid);
1103 if (!item)
1104 {
1105 continue;
1106 }
1107
1108 ObjectGuid newitemGUID = ObjectGuid::Create<HighGuid::Item>(sObjectMgr->GetGenerator<HighGuid::Item>().Generate());
1109 Roll* r = new Roll(newitemGUID, *i);
1110
1111 //a vector is filled with only near party members
1112 for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
1113 {
1114 Player* member = itr->GetSource();
1115 if (!member || !member->GetSession())
1116 continue;
1117
1118 if (member->IsAtLootRewardDistance(pLootedObject))
1119 {
1121
1122 RollVote vote = NOT_EMITED_YET;
1123 if (!CanRollOnItem(*i, member, loot))
1124 {
1125 vote = PASS;
1126 ++r->totalPass;
1127 }
1128 r->playerVote[member->GetGUID()] = vote;
1129 }
1130 }
1131
1132 if (r->totalPlayersRolling > 0)
1133 {
1134 r->setLoot(loot);
1135 r->itemSlot = itemSlot;
1136
1137 loot->quest_items[itemSlot - loot->items.size()].is_blocked = true;
1138
1139 SendLootStartRoll(60000, pLootedObject->GetMapId(), *r);
1140
1141 RollId.push_back(r);
1142
1143 if (Creature* creature = pLootedObject->ToCreature())
1144 {
1145 creature->m_groupLootTimer = 60000;
1146 creature->lootingGroupLowGUID = GetGUID().GetCounter();
1147 }
1148 else if (GameObject* go = pLootedObject->ToGameObject())
1149 {
1150 go->m_groupLootTimer = 60000;
1151 go->lootingGroupLowGUID = GetGUID().GetCounter();
1152 }
1153 }
1154 else
1155 delete r;
1156 }
1157}
bool CanRollOnItem(LootItem const &item, Player const *player, Loot *loot)
Definition Group.cpp:986
@ NOT_EMITED_YET
Definition Group.h:54
@ ROLL_FLAG_TYPE_DISENCHANT
Definition LootMgr.h:45
Definition Creature.h:43
Definition GameObject.h:120
void SendLootStartRoll(uint32 CountDown, uint32 mapid, const Roll &r)
Definition Group.cpp:852
GameObject * ToGameObject()
Definition Object.h:214
Creature * ToCreature()
Definition Object.h:206
bool IsAtLootRewardDistance(WorldObject const *pRewardSource) const
Definition Player.cpp:12726
bool GetPassOnGroupLoot() const
Definition Player.h:2499
void setLoot(Loot *pLoot)
Definition Group.cpp:55
uint8 rollVoteMask
Definition Group.h:163
uint32 Quality
Definition ItemTemplate.h:626
uint32 RequiredDisenchantSkill
Definition ItemTemplate.h:684

References CanRollOnItem(), ItemTemplate::DisenchantID, ObjectAccessor::FindPlayer(), ObjectGuid::GetCounter(), GetFirstMember(), GetGUID(), Object::GetGUID(), WorldLocation::GetMapId(), Player::GetPassOnGroupLoot(), Player::GetSession(), Player::IsAtLootRewardDistance(), Item, 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, 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
2286{
2287 return GetMembersCount() > 0;
2288}

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
2458{
2459 return !RollId.empty();
2460}

References RollId.

Referenced by Player::CanUninviteFromGroup().

◆ LinkMember()

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

References LinkedListHead::insertFirst(), and m_memberMgr.

Referenced by GroupReference::targetObjectBuildLink().

◆ LoadGroupFromDB()

bool Group::LoadGroupFromDB ( Field field)
174{
175 ObjectGuid::LowType groupLowGuid = fields[16].Get<uint32>();
176 m_guid = ObjectGuid::Create<HighGuid::Group>(groupLowGuid);
177
178 m_leaderGuid = ObjectGuid::Create<HighGuid::Player>(fields[0].Get<uint32>());
179
180 // group leader not exist
181 if (!sCharacterCache->GetCharacterNameByGuid(m_leaderGuid, m_leaderName))
182 {
183 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
185 stmt->SetData(0, groupLowGuid);
186 trans->Append(stmt);
187 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER_ALL);
188 stmt->SetData(0, groupLowGuid);
189 trans->Append(stmt);
190 CharacterDatabase.CommitTransaction(trans);
191 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_LFG_DATA);
192 stmt->SetData(0, groupLowGuid);
193 CharacterDatabase.Execute(stmt);
194 return false;
195 }
196
197 m_lootMethod = LootMethod(fields[1].Get<uint8>());
198 m_looterGuid = ObjectGuid::Create<HighGuid::Player>(fields[2].Get<uint32>());
199 m_lootThreshold = ItemQualities(fields[3].Get<uint8>());
200
201 for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
202 m_targetIcons[i].Set(fields[4 + i].Get<uint64>());
203
204 m_groupType = GroupType(fields[12].Get<uint8>());
207
208 uint32 diff = fields[13].Get<uint8>();
209 if (diff >= MAX_DUNGEON_DIFFICULTY)
211 else
213
214 uint32 r_diff = fields[14].Get<uint8>();
215 if (r_diff >= MAX_RAID_DIFFICULTY)
217 else
219
220 m_masterLooterGuid = ObjectGuid::Create<HighGuid::Player>(fields[15].Get<uint32>());
221
223 sLFGMgr->_LoadFromDB(fields, GetGUID());
224
225 return true;
226}
#define MAX_RAID_DIFFICULTY
Definition DBCEnums.h:282
Difficulty
Definition DBCEnums.h:266
#define MAX_DUNGEON_DIFFICULTY
Definition DBCEnums.h:281
LootMethod
Definition LootMgr.h:57
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 
)
229{
230 MemberSlot member;
231 member.guid = ObjectGuid::Create<HighGuid::Player>(guidLow);
232
233 // skip non-existed member
234 if (!sCharacterCache->GetCharacterNameByGuid(member.guid, member.name))
235 {
237 stmt->SetData(0, guidLow);
238 stmt->SetData(1, GetGUID().GetCounter());
239 CharacterDatabase.Execute(stmt);
240 return;
241 }
242
243 member.group = subgroup;
244 member.flags = memberFlags;
245 member.roles = roles;
246
247 m_memberSlots.push_back(member);
248
249 if (!isBGGroup() && !isBFGroup())
250 {
251 sCharacterCache->UpdateCharacterGroup(ObjectGuid(HighGuid::Player, guidLow), GetGUID());
252 }
253
254 SubGroupCounterIncrease(subgroup);
255
256 sLFGMgr->SetupGroupMember(member.guid, GetGUID());
257}
@ CHAR_DEL_GROUP_MEMBER
Definition CharacterDatabase.h:285

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

Referenced by GroupMgr::LoadGroups().

◆ MasterLoot()

void Group::MasterLoot ( Loot loot,
WorldObject pLootedObject 
)
1311{
1312 LOG_DEBUG("network", "Group::MasterLoot (SMSG_LOOT_MASTER_LIST, 330)");
1313
1314 for (std::vector<LootItem>::iterator i = loot->items.begin(); i != loot->items.end(); ++i)
1315 {
1316 if (i->freeforall)
1317 continue;
1318
1319 i->is_blocked = !i->is_underthreshold;
1320 }
1321
1322 for (std::vector<LootItem>::iterator i = loot->quest_items.begin(); i != loot->quest_items.end(); ++i)
1323 {
1324 if (!i->follow_loot_rules)
1325 continue;
1326
1327 i->is_blocked = !i->is_underthreshold;
1328 }
1329
1330 std::vector<Player*> looters;
1331 for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
1332 {
1333 Player* looter = itr->GetSource();
1334 if (!looter->IsInWorld())
1335 {
1336 continue;
1337 }
1338
1339 if (looter->IsAtLootRewardDistance(pLootedObject))
1340 {
1341 looters.push_back(looter);
1342 }
1343 }
1344
1345 WorldPacket data(SMSG_LOOT_MASTER_LIST, 1 + looters.size() * (1 + 8));
1346 data << uint8(looters.size());
1347
1348 for (Player* looter : looters)
1349 {
1350 data << looter->GetGUID();
1351 }
1352
1353 for (Player* looter : looters)
1354 {
1355 looter->GetSession()->SendPacket(&data);
1356 }
1357}
bool IsInWorld() const
Definition Object.h:108
@ SMSG_LOOT_MASTER_LIST
Definition Opcodes.h:706

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 
)
1160{
1161 ItemTemplate const* item;
1162 uint8 itemSlot = 0;
1163 for (std::vector<LootItem>::iterator i = loot->items.begin(); i != loot->items.end(); ++i, ++itemSlot)
1164 {
1165 if (i->freeforall)
1166 continue;
1167
1168 item = sObjectMgr->GetItemTemplate(i->itemid);
1169
1170 //roll for over-threshold item if it's one-player loot
1171 if (item->Quality >= uint32(m_lootThreshold))
1172 {
1173 ObjectGuid newitemGUID = ObjectGuid::Create<HighGuid::Item>(sObjectMgr->GetGenerator<HighGuid::Item>().Generate());
1174 Roll* r = new Roll(newitemGUID, *i);
1175
1176 for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
1177 {
1178 Player* playerToRoll = itr->GetSource();
1179 if (!playerToRoll || !playerToRoll->GetSession())
1180 continue;
1181
1182 if (playerToRoll->IsAtGroupRewardDistance(lootedObject))
1183 {
1185
1186 RollVote vote = playerToRoll->GetPassOnGroupLoot() ? PASS : NOT_EMITED_YET;
1187 if (!CanRollOnItem(*i, playerToRoll, loot))
1188 {
1189 vote = PASS;
1190 r->totalPass++; // Can't broadcast the pass now. need to wait until all rolling players are known
1191 }
1192
1193 r->playerVote[playerToRoll->GetGUID()] = vote;
1194 }
1195 }
1196
1197 if (r->totalPlayersRolling > 0)
1198 {
1199 r->setLoot(loot);
1200 r->itemSlot = itemSlot;
1203
1205 r->rollVoteMask &= ~ROLL_FLAG_TYPE_NEED;
1206
1207 loot->items[itemSlot].is_blocked = true;
1208
1209 //Broadcast Pass and Send Rollstart
1210 for (Roll::PlayerVote::const_iterator itr = r->playerVote.begin(); itr != r->playerVote.end(); ++itr)
1211 {
1212 Player* p = ObjectAccessor::FindPlayer(itr->first);
1213 if (!p)
1214 continue;
1215
1216 if (itr->second == PASS)
1217 SendLootRoll(newitemGUID, p->GetGUID(), 128, ROLL_PASS, *r);
1218 else
1219 SendLootStartRollToPlayer(60000, lootedObject->GetMapId(), p, p->CanRollForItemInLFG(item, lootedObject) == EQUIP_ERR_OK, *r);
1220 }
1221
1222 RollId.push_back(r);
1223
1224 if (Creature* creature = lootedObject->ToCreature())
1225 {
1226 creature->m_groupLootTimer = 60000;
1227 creature->lootingGroupLowGUID = GetGUID().GetCounter();
1228 }
1229 else if (GameObject* go = lootedObject->ToGameObject())
1230 {
1231 go->m_groupLootTimer = 60000;
1232 go->lootingGroupLowGUID = GetGUID().GetCounter();
1233 }
1234 }
1235 else
1236 delete r;
1237 }
1238 else
1239 i->is_underthreshold = true;
1240 }
1241
1242 for (std::vector<LootItem>::iterator i = loot->quest_items.begin(); i != loot->quest_items.end(); ++i, ++itemSlot)
1243 {
1244 if (!i->follow_loot_rules)
1245 continue;
1246
1247 item = sObjectMgr->GetItemTemplate(i->itemid);
1248 ObjectGuid newitemGUID = ObjectGuid::Create<HighGuid::Item>(sObjectMgr->GetGenerator<HighGuid::Item>().Generate());
1249 Roll* r = new Roll(newitemGUID, *i);
1250
1251 for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
1252 {
1253 Player* playerToRoll = itr->GetSource();
1254 if (!playerToRoll || !playerToRoll->GetSession())
1255 continue;
1256
1257 if (playerToRoll->IsAtGroupRewardDistance(lootedObject))
1258 {
1260
1261 RollVote vote = playerToRoll->GetPassOnGroupLoot() ? PASS : NOT_EMITED_YET;
1262 if (!CanRollOnItem(*i, playerToRoll, loot))
1263 {
1264 vote = PASS;
1265 r->totalPass++; // Can't broadcast the pass now. need to wait until all rolling players are known
1266 }
1267
1268 r->playerVote[playerToRoll->GetGUID()] = vote;
1269 }
1270 }
1271
1272 if (r->totalPlayersRolling > 0)
1273 {
1274 r->setLoot(loot);
1275 r->itemSlot = itemSlot;
1276
1277 loot->quest_items[itemSlot - loot->items.size()].is_blocked = true;
1278
1279 //Broadcast Pass and Send Rollstart
1280 for (Roll::PlayerVote::const_iterator itr = r->playerVote.begin(); itr != r->playerVote.end(); ++itr)
1281 {
1282 Player* p = ObjectAccessor::FindPlayer(itr->first);
1283 if (!p)
1284 continue;
1285
1286 if (itr->second == PASS)
1287 SendLootRoll(newitemGUID, p->GetGUID(), 128, ROLL_PASS, *r);
1288 else
1289 SendLootStartRollToPlayer(60000, lootedObject->GetMapId(), p, p->CanRollForItemInLFG(item, lootedObject) == EQUIP_ERR_OK, *r);
1290 }
1291
1292 RollId.push_back(r);
1293
1294 if (Creature* creature = lootedObject->ToCreature())
1295 {
1296 creature->m_groupLootTimer = 60000;
1297 creature->lootingGroupLowGUID = GetGUID().GetCounter();
1298 }
1299 else if (GameObject* go = lootedObject->ToGameObject())
1300 {
1301 go->m_groupLootTimer = 60000;
1302 go->lootingGroupLowGUID = GetGUID().GetCounter();
1303 }
1304 }
1305 else
1306 delete r;
1307 }
1308}
@ ITEM_FLAG2_CAN_ONLY_ROLL_GREED
Definition ItemTemplate.h:191
void SendLootStartRollToPlayer(uint32 countDown, uint32 mapId, Player *p, bool canNeed, Roll const &r)
Definition Group.cpp:876
InventoryResult CanRollForItemInLFG(ItemTemplate const *item, WorldObject const *lootedObject) const
Definition PlayerStorage.cpp:2337
bool IsAtGroupRewardDistance(WorldObject const *pRewardSource) const
Definition Player.cpp:12705
bool HasFlag2(ItemFlags2 flag) const
Definition ItemTemplate.h:828

References Player::CanRollForItemInLFG(), CanRollOnItem(), ItemTemplate::DisenchantID, EQUIP_ERR_OK, ObjectAccessor::FindPlayer(), ObjectGuid::GetCounter(), GetFirstMember(), GetGUID(), Object::GetGUID(), WorldLocation::GetMapId(), Player::GetPassOnGroupLoot(), Player::GetSession(), ItemTemplate::HasFlag2(), Player::IsAtGroupRewardDistance(), Item, ITEM_FLAG2_CAN_ONLY_ROLL_GREED, 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, Object::ToCreature(), Object::ToGameObject(), Roll::totalPass, and Roll::totalPlayersRolling.

Referenced by Player::SendLoot().

◆ OfflineReadyCheck()

void Group::OfflineReadyCheck ( )
1781{
1782 for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
1783 {
1784 Player* player = ObjectAccessor::FindConnectedPlayer(citr->guid);
1785 if (!player)
1786 {
1788 data << citr->guid;
1789 data << uint8(0);
1790 BroadcastReadyCheck(&data);
1791 }
1792 }
1793}
void BroadcastReadyCheck(WorldPacket const *packet)
Definition Group.cpp:1769
@ MSG_RAID_READY_CHECK_CONFIRM
Definition Opcodes.h:972

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

Referenced by WorldSession::HandleRaidReadyCheckOpcode().

◆ RemoveAllInvites()

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

References m_invitees.

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

◆ RemoveInvite()

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

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

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)
2517{
2518 for (member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
2519 if (itr->flags & flag)
2520 itr->flags &= ~flag;
2521}

References m_memberSlots.

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

◆ ResetInstances()

void Group::ResetInstances ( uint8  method,
bool  isRaid,
Player leader 
)
2115{
2116 if (isBGGroup() || isBFGroup() || isLFGGroup())
2117 return;
2118
2119 switch (method)
2120 {
2121 case INSTANCE_RESET_ALL:
2122 {
2123 if (leader->GetDifficulty(false) != DUNGEON_DIFFICULTY_NORMAL)
2124 break;
2125 std::vector<InstanceSave*> toUnbind;
2126 BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(leader->GetGUID(), Difficulty(DUNGEON_DIFFICULTY_NORMAL));
2127 for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr)
2128 {
2129 InstanceSave* instanceSave = itr->second.save;
2130 MapEntry const* entry = sMapStore.LookupEntry(itr->first);
2131 if (!entry || entry->IsRaid() || !instanceSave->CanReset())
2132 continue;
2133
2134 Map* map = sMapMgr->FindMap(instanceSave->GetMapId(), instanceSave->GetInstanceId());
2135 if (!map || map->ToInstanceMap()->Reset(method))
2136 {
2137 leader->SendResetInstanceSuccess(instanceSave->GetMapId());
2138 toUnbind.push_back(instanceSave);
2139 }
2140 else
2141 {
2142 leader->SendResetInstanceFailed(0, instanceSave->GetMapId());
2143 }
2144
2145 sInstanceSaveMgr->DeleteInstanceSavedData(instanceSave->GetInstanceId());
2146 }
2147 for (std::vector<InstanceSave*>::const_iterator itr = toUnbind.begin(); itr != toUnbind.end(); ++itr)
2148 sInstanceSaveMgr->UnbindAllFor(*itr);
2149 }
2150 break;
2152 {
2153 std::vector<InstanceSave*> toUnbind;
2154 BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(leader->GetGUID(), leader->GetDifficulty(isRaid));
2155 for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr)
2156 {
2157 InstanceSave* instanceSave = itr->second.save;
2158 MapEntry const* entry = sMapStore.LookupEntry(itr->first);
2159 if (!entry || entry->IsRaid() != isRaid || !instanceSave->CanReset())
2160 continue;
2161
2162 Map* map = sMapMgr->FindMap(instanceSave->GetMapId(), instanceSave->GetInstanceId());
2163 if (!map || map->ToInstanceMap()->Reset(method))
2164 {
2165 leader->SendResetInstanceSuccess(instanceSave->GetMapId());
2166 toUnbind.push_back(instanceSave);
2167 }
2168 else
2169 {
2170 leader->SendResetInstanceFailed(0, instanceSave->GetMapId());
2171 }
2172
2173 sInstanceSaveMgr->DeleteInstanceSavedData(instanceSave->GetInstanceId());
2174 }
2175 for (std::vector<InstanceSave*>::const_iterator itr = toUnbind.begin(); itr != toUnbind.end(); ++itr)
2176 sInstanceSaveMgr->UnbindAllFor(*itr);
2177 }
2178 break;
2179 }
2180}
std::unordered_map< uint32, InstancePlayerBind > BoundInstancesMap
Definition InstanceSaveMgr.h:46
#define sMapMgr
Definition MapMgr.h:220
@ INSTANCE_RESET_CHANGE_DIFFICULTY
Definition Map.h:645
@ INSTANCE_RESET_ALL
Definition Map.h:644
bool Reset(uint8 method, GuidList *globalSkipList=nullptr)
Definition Map.cpp:2289
Definition InstanceSaveMgr.h:56
uint32 GetMapId() const
Definition InstanceSaveMgr.h:62
bool CanReset() const
Definition InstanceSaveMgr.h:81
Definition Map.h:156
InstanceMap * ToInstanceMap()
Definition Map.h:393
void SendResetInstanceSuccess(uint32 MapId)
Definition PlayerMisc.cpp:326
void SendResetInstanceFailed(uint32 reason, uint32 MapId)
Definition PlayerMisc.cpp:333
Definition DBCStructure.h:1326
bool IsRaid() const
Definition DBCStructure.h:1355

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 ( )
2215{
2217 Player* pMember = nullptr;
2218 for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
2219 {
2220 pMember = ObjectAccessor::FindPlayer(citr->guid);
2221 if (pMember && pMember->GetSession() && !pMember->GetSession()->IsSocketClosed()
2222 && m_maxEnchantingLevel < pMember->GetSkillValue(SKILL_ENCHANTING))
2223 {
2225 }
2226 }
2227}
bool IsSocketClosed() const
Definition WorldSession.cpp:549

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
2371{
2372 member_citerator mslot1 = _getMemberCSlot(guid1);
2373 if (mslot1 == m_memberSlots.end() || !slot2)
2374 return false;
2375 return (mslot1->group == slot2->group);
2376}

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

◆ SameSubGroup() [2/3]

bool Group::SameSubGroup ( ObjectGuid  guid1,
ObjectGuid  guid2 
) const
2363{
2364 member_citerator mslot2 = _getMemberCSlot(guid2);
2365 if (mslot2 == m_memberSlots.end())
2366 return false;
2367 return SameSubGroup(guid1, &*mslot2);
2368}
bool SameSubGroup(ObjectGuid guid1, ObjectGuid guid2) const
Definition Group.cpp:2362

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
1796{
1797 if (!member1 || !member2)
1798 return false;
1799
1800 if (member1->GetGroup() != this || member2->GetGroup() != this)
1801 return false;
1802 else
1803 return member1->GetSubGroup() == member2->GetSubGroup();
1804}

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

◆ SendLootAllPassed()

void Group::SendLootAllPassed ( Roll const &  roll)
946{
947 WorldPacket data(SMSG_LOOT_ALL_PASSED, (8 + 4 + 4 + 4 + 4));
948 data << roll.itemGUID; // Guid of the item rolled
949 data << uint32(roll.itemSlot); // Item loot slot
950 data << uint32(roll.itemid); // The itemEntryId for the item that shall be rolled for
951 data << uint32(roll.itemRandomPropId); // Item random property ID
952 data << uint32(roll.itemRandomSuffix); // Item random suffix ID
953
954 for (Roll::PlayerVote::const_iterator itr = roll.playerVote.begin(); itr != roll.playerVote.end(); ++itr)
955 {
956 Player* player = ObjectAccessor::FindConnectedPlayer(itr->first);
957 if (!player)
958 continue;
959
960 if (itr->second != NOT_VALID)
961 player->GetSession()->SendPacket(&data);
962 }
963}
@ 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 
)
967{
968 ASSERT(creature);
969
970 WorldPacket data(SMSG_LOOT_LIST, (8 + 8));
971 data << creature->GetGUID();
972
973 if (GetLootMethod() == MASTER_LOOT && creature->loot.hasOverThresholdItem())
975 else
976 data << uint8(0);
977
978 if (groupLooter)
979 data << groupLooter->GetPackGUID();
980 else
981 data << uint8(0);
982
983 BroadcastPacket(&data, false);
984}
@ MASTER_LOOT
Definition LootMgr.h:60
Loot loot
Definition Creature.h:230
ObjectGuid GetMasterLooterGuid() const
Definition Group.cpp:2325
LootMethod GetLootMethod() const
Definition Group.cpp:2315
PackedGuid WriteAsPacked() const
Definition ObjectGuid.h:316
@ SMSG_LOOT_LIST
Definition Opcodes.h:1047
bool hasOverThresholdItem() const
Definition LootMgr.cpp:981

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,
bool  autoPass = false 
)
899{
900 WorldPacket data(SMSG_LOOT_ROLL, (8 + 4 + 8 + 4 + 4 + 4 + 1 + 1 + 1));
901 data << sourceGuid; // guid of the item rolled
902 data << uint32(roll.itemSlot); // slot
903 data << targetGuid;
904 data << uint32(roll.itemid); // the itemEntryId for the item that shall be rolled for
905 data << uint32(roll.itemRandomSuffix); // randomSuffix
906 data << uint32(roll.itemRandomPropId); // Item random property ID
907 data << uint8(rollNumber); // 0: "Need for: [item name]" > 127: "you passed on: [item name]" Roll number
908 data << uint8(rollType); // 0: "Need for: [item name]" 0: "You have selected need for [item name] 1: need roll 2: greed roll
909 data << uint8(autoPass); // 1: "You automatically passed on: %s because you cannot loot that item."
910
911 for (Roll::PlayerVote::const_iterator itr = roll.playerVote.begin(); itr != roll.playerVote.end(); ++itr)
912 {
914 if (!p)
915 continue;
916
917 if (itr->second != NOT_VALID)
918 p->GetSession()->SendPacket(&data);
919 }
920}
@ 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 
)
923{
924 WorldPacket data(SMSG_LOOT_ROLL_WON, (8 + 4 + 4 + 4 + 4 + 8 + 1 + 1));
925 data << sourceGuid; // guid of the item rolled
926 data << uint32(roll.itemSlot); // slot
927 data << uint32(roll.itemid); // the itemEntryId for the item that shall be rolled for
928 data << uint32(roll.itemRandomSuffix); // randomSuffix
929 data << uint32(roll.itemRandomPropId); // Item random property
930 data << targetGuid; // guid of the player who won.
931 data << uint8(rollNumber); // rollnumber realted to SMSG_LOOT_ROLL
932 data << uint8(rollType); // rollType related to SMSG_LOOT_ROLL
933
934 for (Roll::PlayerVote::const_iterator itr = roll.playerVote.begin(); itr != roll.playerVote.end(); ++itr)
935 {
937 if (!p)
938 continue;
939
940 if (itr->second != NOT_VALID)
941 p->GetSession()->SendPacket(&data);
942 }
943}
@ 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 
)
853{
854 WorldPacket data(SMSG_LOOT_START_ROLL, (8 + 4 + 4 + 4 + 4 + 4 + 4 + 1));
855 data << r.itemGUID; // guid of rolled item
856 data << uint32(mapid); // 3.3.3 mapid
857 data << uint32(r.itemSlot); // itemslot
858 data << uint32(r.itemid); // the itemEntryId for the item that shall be rolled for
859 data << uint32(r.itemRandomSuffix); // randomSuffix
860 data << uint32(r.itemRandomPropId); // item random property ID
861 data << uint32(r.itemCount); // items in stack
862 data << uint32(CountDown); // the countdown time to choose "need" or "greed"
863 data << uint8(r.rollVoteMask); // roll type mask
864
865 for (Roll::PlayerVote::const_iterator itr = r.playerVote.begin(); itr != r.playerVote.end(); ++itr)
866 {
868 if (!p)
869 continue;
870
871 if (itr->second == NOT_EMITED_YET)
872 p->GetSession()->SendPacket(&data);
873 }
874}
int32 itemRandomPropId
Definition Group.h:153
uint8 itemCount
Definition Group.h:155
uint32 itemRandomSuffix
Definition Group.h:154
@ SMSG_LOOT_START_ROLL
Definition Opcodes.h:703

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

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)
1645{
1646 if (!session)
1647 return;
1648
1650 data << uint8(1); // list targets
1651
1652 for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
1653 {
1654 if (!m_targetIcons[i])
1655 continue;
1656
1657 data << uint8(i);
1658 data << m_targetIcons[i];
1659 }
1660
1661 session->SendPacket(&data);
1662}
@ 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 
)
1671{
1672 Player* player = ObjectAccessor::FindConnectedPlayer(playerGUID);
1673
1674 if (!player || player->GetGroup() != this)
1675 return;
1676
1677 // if MemberSlot wasn't provided
1678 if (!slot)
1679 {
1680 member_witerator witr = _getMemberWSlot(playerGUID);
1681
1682 if (witr == m_memberSlots.end()) // if there is no MemberSlot for such a player
1683 return;
1684
1685 slot = &(*witr);
1686 }
1687
1688 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));
1689 data << uint8(m_groupType); // group type (flags in 3.3)
1690 data << uint8(slot->group);
1691 data << uint8(slot->flags);
1692 data << uint8(slot->roles);
1693 if (isLFGGroup())
1694 {
1695 data << uint8(sLFGMgr->GetState(m_guid) == lfg::LFG_STATE_FINISHED_DUNGEON ? 2 : 0); // FIXME - Dungeon save status? 2 = done
1696 data << uint32(sLFGMgr->GetDungeon(m_guid));
1697 }
1698
1699 data << m_guid;
1700 data << uint32(m_counter++); // 3.3, value increases every time this packet gets sent
1701 data << uint32(GetMembersCount() - 1);
1702 for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
1703 {
1704 if (slot->guid == citr->guid)
1705 continue;
1706
1707 Player* member = ObjectAccessor::FindConnectedPlayer(citr->guid);
1708
1709 uint8 onlineState = (member && !member->GetSession()->PlayerLogout()) ? MEMBER_STATUS_ONLINE : MEMBER_STATUS_OFFLINE;
1710 onlineState = onlineState | ((isBGGroup() || isBFGroup()) ? MEMBER_STATUS_PVP : 0);
1711
1712 data << citr->name;
1713 data << citr->guid; // guid
1714 data << uint8(onlineState); // online-state
1715 data << uint8(citr->group); // groupid
1716 data << uint8(citr->flags); // See enum GroupMemberFlags
1717 data << uint8(citr->roles); // Lfg Roles
1718 }
1719
1720 data << m_leaderGuid; // leader guid
1721
1722 if (GetMembersCount() - 1)
1723 {
1724 data << uint8(m_lootMethod); // loot method
1725
1727 data << m_masterLooterGuid; // master looter guid
1728 else
1729 data << uint64(0); // looter guid
1730
1731 data << uint8(m_lootThreshold); // loot threshold
1732 data << uint8(m_dungeonDifficulty); // Dungeon Difficulty
1733 data << uint8(m_raidDifficulty); // Raid Difficulty
1734 data << uint8(m_raidDifficulty >= RAID_DIFFICULTY_10MAN_HEROIC); // 3.3 Dynamic Raid Difficulty - 0 normal/1 heroic
1735 }
1736
1737 player->GetSession()->SendPacket(&data);
1738}
@ RAID_DIFFICULTY_10MAN_HEROIC
Definition DBCEnums.h:275
@ MEMBER_STATUS_OFFLINE
Definition Group.h:60
@ MEMBER_STATUS_PVP
Definition Group.h:62
@ MEMBER_STATUS_ONLINE
Definition Group.h:61
bool PlayerLogout() const
Definition WorldSession.h:338
@ LFG_STATE_FINISHED_DUNGEON
Definition LFG.h:74

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)
2397{
2398 m_bfGroup = bg;
2399}

References m_bfGroup.

Referenced by Battlefield::AddOrSetPlayerToCorrectBfGroup().

◆ SetBattlegroundGroup()

void Group::SetBattlegroundGroup ( Battleground bg)
2392{
2393 m_bgGroup = bg;
2394}

References m_bgGroup.

Referenced by Battleground::SetBgRaid().

◆ SetDifficultyChangePrevention()

◆ SetDungeonDifficulty()

void Group::SetDungeonDifficulty ( Difficulty  difficulty)
2073{
2074 m_dungeonDifficulty = difficulty;
2075 if (!isBGGroup() && !isBFGroup())
2076 {
2078
2080 stmt->SetData(1, GetGUID().GetCounter());
2081
2082 CharacterDatabase.Execute(stmt);
2083 }
2084
2085 for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
2086 {
2087 Player* player = itr->GetSource();
2088 player->SetDungeonDifficulty(difficulty);
2089 player->SendDungeonDifficulty(true);
2090 }
2091}
@ CHAR_UPD_GROUP_DIFFICULTY
Definition CharacterDatabase.h:290

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 
)
2402{
2403 // Assistants, main assistants and main tanks are only available in raid groups
2404 if (!isRaidGroup())
2405 return;
2406
2407 // Check if player is really in the raid
2408 member_witerator slot = _getMemberWSlot(guid);
2409 if (slot == m_memberSlots.end())
2410 return;
2411
2412 // Do flag specific actions, e.g ensure uniqueness
2413 switch (flag)
2414 {
2416 RemoveUniqueGroupMemberFlag(MEMBER_FLAG_MAINASSIST); // Remove main assist flag from current if any.
2417 break;
2419 RemoveUniqueGroupMemberFlag(MEMBER_FLAG_MAINTANK); // Remove main tank flag from current if any.
2420 break;
2422 break;
2423 default:
2424 return; // This should never happen
2425 }
2426
2427 // Switch the actual flag
2428 ToggleGroupMemberFlag(slot, flag, apply);
2429
2430 // Preserve the new setting in the db
2432
2433 stmt->SetData(0, slot->flags);
2434 stmt->SetData(1, guid.GetCounter());
2435
2436 CharacterDatabase.Execute(stmt);
2437
2438 // Broadcast the changes to the group
2439 SendUpdate();
2440}
@ CHAR_UPD_GROUP_MEMBER_FLAG
Definition CharacterDatabase.h:289
@ MEMBER_FLAG_MAINASSIST
Definition Group.h:75
@ MEMBER_FLAG_MAINTANK
Definition Group.h:74
void RemoveUniqueGroupMemberFlag(GroupMemberFlags flag)
Definition Group.cpp:2516

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 
)
2250{
2251 member_witerator slot = _getMemberWSlot(guid);
2252 if (slot == m_memberSlots.end())
2253 return;
2254
2255 slot->roles = roles;
2256 SendUpdate();
2257}

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

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

◆ SetLooterGuid()

void Group::SetLooterGuid ( ObjectGuid  guid)
2235{
2236 m_looterGuid = guid;
2237}

References m_looterGuid.

Referenced by UpdateLooterGuid().

◆ SetLootMethod()

void Group::SetLootMethod ( LootMethod  method)
2230{
2231 m_lootMethod = method;
2232}

References m_lootMethod.

Referenced by WorldSession::HandleLootMethodOpcode().

◆ SetLootThreshold()

void Group::SetLootThreshold ( ItemQualities  threshold)
2245{
2246 m_lootThreshold = threshold;
2247}

References m_lootThreshold.

Referenced by WorldSession::HandleLootMethodOpcode().

◆ SetMasterLooterGuid()

void Group::SetMasterLooterGuid ( ObjectGuid  guid)
2240{
2241 m_masterLooterGuid = guid;
2242}

References m_masterLooterGuid.

Referenced by WorldSession::HandleLootMethodOpcode().

◆ SetRaidDifficulty()

void Group::SetRaidDifficulty ( Difficulty  difficulty)
2094{
2095 m_raidDifficulty = difficulty;
2096 if (!isBGGroup() && !isBFGroup())
2097 {
2099
2100 stmt->SetData(0, uint8(m_raidDifficulty));
2101 stmt->SetData(1, GetGUID().GetCounter());
2102
2103 CharacterDatabase.Execute(stmt);
2104 }
2105
2106 for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
2107 {
2108 Player* player = itr->GetSource();
2109 player->SetRaidDifficulty(difficulty);
2110 player->SendRaidDifficulty(true);
2111 }
2112}
@ CHAR_UPD_GROUP_RAID_DIFFICULTY
Definition CharacterDatabase.h:291

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 
)
1624{
1625 if (id >= TARGETICONCOUNT)
1626 return;
1627
1628 // clean other icons
1629 if (targetGuid)
1630 for (int i = 0; i < TARGETICONCOUNT; ++i)
1631 if (m_targetIcons[i] == targetGuid)
1633
1634 m_targetIcons[id] = targetGuid;
1635
1636 WorldPacket data(MSG_RAID_TARGET_UPDATE, (1 + 8 + 1 + 8));
1637 data << uint8(0); // set targets
1638 data << whoGuid;
1639 data << uint8(id);
1640 data << targetGuid;
1641 BroadcastPacket(&data, true);
1642}
void SetTargetIcon(uint8 id, ObjectGuid whoGuid, ObjectGuid targetGuid)
Definition Group.cpp:1623

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
2511{
2513 --m_subGroupsCounts[subgroup];
2514}

References m_subGroupsCounts.

Referenced by ChangeMembersGroup(), and RemoveMember().

◆ SubGroupCounterIncrease()

void Group::SubGroupCounterIncrease ( uint8  subgroup)
protected
2505{
2507 ++m_subGroupsCounts[subgroup];
2508}

References m_subGroupsCounts.

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

◆ ToggleGroupMemberFlag()

void Group::ToggleGroupMemberFlag ( member_witerator  slot,
uint8  flag,
bool  apply 
)
protected
2524{
2525 if (apply)
2526 slot->flags |= flag;
2527 else
2528 slot->flags &= ~flag;
2529}

Referenced by ChangeLeader(), and SetGroupMemberFlag().

◆ UpdateLooterGuid()

void Group::UpdateLooterGuid ( WorldObject pLootedObject,
bool  ifneed = false 
)
1868{
1869 // round robin style looting applies for all low
1870 // quality items in each loot method except free for all
1871 if (GetLootMethod() == FREE_FOR_ALL)
1872 return;
1873
1874 ObjectGuid oldLooterGUID = GetLooterGuid();
1875 member_citerator guid_itr = _getMemberCSlot(oldLooterGUID);
1876 if (guid_itr != m_memberSlots.end())
1877 {
1878 if (ifneed)
1879 {
1880 // not update if only update if need and ok
1881 Player* looter = ObjectAccessor::FindPlayer(guid_itr->guid);
1882 if (looter && looter->IsAtLootRewardDistance(pLootedObject))
1883 return;
1884 }
1885 ++guid_itr;
1886 }
1887
1888 // search next after current
1889 Player* pNewLooter = nullptr;
1890 for (member_citerator itr = guid_itr; itr != m_memberSlots.end(); ++itr)
1891 {
1892 if (Player* player = ObjectAccessor::FindPlayer(itr->guid))
1893 if (player->IsAtLootRewardDistance(pLootedObject))
1894 {
1895 pNewLooter = player;
1896 break;
1897 }
1898 }
1899
1900 if (!pNewLooter)
1901 {
1902 // search from start
1903 for (member_citerator itr = m_memberSlots.begin(); itr != guid_itr; ++itr)
1904 {
1905 if (Player* player = ObjectAccessor::FindPlayer(itr->guid))
1906 if (player->IsAtLootRewardDistance(pLootedObject))
1907 {
1908 pNewLooter = player;
1909 break;
1910 }
1911 }
1912 }
1913
1914 if (pNewLooter)
1915 {
1916 if (oldLooterGUID != pNewLooter->GetGUID())
1917 {
1918 SetLooterGuid(pNewLooter->GetGUID());
1919 SendUpdate();
1920 }
1921 }
1922 else
1923 {
1925 SendUpdate();
1926 }
1927}
ObjectGuid GetLooterGuid() const
Definition Group.cpp:2320
void SetLooterGuid(ObjectGuid guid)
Definition Group.cpp:2234

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)
1741{
1742 if (!player || !player->IsInWorld())
1743 return;
1744
1745 WorldPacket data;
1746 player->GetSession()->BuildPartyMemberStatsChangedPacket(player, &data);
1747
1748 for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
1749 {
1750 Player* member = itr->GetSource();
1751 if (member && (!member->IsInMap(player) || !member->IsWithinDist(player, member->GetSightRange(player), false)))
1752 member->GetSession()->SendPacket(&data);
1753 }
1754}
float GetSightRange(WorldObject const *target=nullptr) const override
Definition Player.cpp:16224
bool IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
Definition Object.cpp:1327
bool IsInMap(WorldObject const *obj) const
Definition Object.cpp:1296
void BuildPartyMemberStatsChangedPacket(Player *player, WorldPacket *data)
Definition GroupHandler.cpp:767

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

◆ 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


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