50 _endTime = _startTime + duration.count();
77 TC_LOG_DEBUG(
"bg.battleground",
"Group::~Group: battleground group being deleted.");
83 TC_LOG_ERROR(
"misc",
"Group::~Group: battleground group is not linked to the correct battleground.");
107 Player* newLeader =
nullptr;
145 m_guid = ObjectGuid::Create<HighGuid::Party>(
sGroupMgr->GenerateGroupId());
200 leaderInstance->TrySetOwningGroup(
this);
202 bool addMemberResult =
AddMember(leader);
214 m_guid = ObjectGuid::Create<HighGuid::Party>(
sGroupMgr->GenerateGroupId());
215 m_leaderGuid = ObjectGuid::Create<HighGuid::Player>(fields[0].GetUInt64());
225 m_looterGuid = ObjectGuid::Create<HighGuid::Player>(fields[2].GetUInt64());
229 if (std::span<uint8 const> rawGuidBytes = fields[4 + i].GetBinaryView(); rawGuidBytes.size() ==
ObjectGuid::BytesSize)
251 member.
guid = ObjectGuid::Create<HighGuid::Player>(guidLow);
269 member.
group = subgroup;
270 member.
flags = memberFlags;
271 member.
roles = roles;
320 player->UpdateVisibleObjectInteractions(
false,
true,
false,
true);
351 player->UpdateVisibleObjectInteractions(
false,
true,
false,
true);
399 (*itr)->SetGroupInvite(
nullptr);
408 if ((*itr) && (*itr)->GetGUID() == guid)
418 if ((*itr) && (*itr)->GetName() == name)
430 bool groupFound =
false;
449 member.
group = subGroup;
536 if (itr->GetSource() == player)
539 if (
Player* existingMember = itr->GetSource())
544 if (existingMember->HaveAtClient(player))
552 existingMember->SendDirectMessage(&newDataPacket);
572 sScriptMgr->OnGroupRemoveMember(
this, guid, method, kicker, reason);
579 if (
Player* groupMember = itr->GetSource())
581 if (groupMember->GetGUID() == guid)
584 groupMember->RemoveAllGroupBuffsFromCaster(guid);
661 if (!mapId || !leader || (leader->
IsAlive() && leader->
GetMapId() != mapId))
813 updateSingle.
Target = target;
815 updateSingle.
Symbol = symbol;
874 if (slot->
guid == citr->guid)
881 playerInfos.
GUID = citr->guid;
882 playerInfos.
Name = citr->name;
883 playerInfos.
Class = citr->_class;
890 playerInfos.
Flags = citr->flags;
915 partyUpdate.
LfgInfos->BootCount = 0;
916 partyUpdate.
LfgInfos->Aborted =
false;
921 partyUpdate.
LfgInfos->MyPartialClear = 0;
922 partyUpdate.
LfgInfos->MyGearDiff = 0.0f;
923 partyUpdate.
LfgInfos->MyFirstReward =
false;
925 if (
Quest const* quest =
sObjectMgr->GetQuestTemplate(reward->firstQuest))
928 partyUpdate.
LfgInfos->MyStrangerCount = 0;
929 partyUpdate.
LfgInfos->MyKickVoteCount = 0;
958 Player const* member = itr->GetSource();
968 Player* player = itr->GetSource();
969 if (!player || (!ignore.
IsEmpty() && player->
GetGUID() == ignore) || (ignorePlayersInBGRaid && player->
GetGroup() !=
this))
981 Player const* player = itr->GetSource();
982 if (!player || (!ignoredPlayer.
IsEmpty() && player->
GetGUID() == ignoredPlayer) || (ignorePlayersInBGRaid && player->
GetGroup() !=
this))
985 if (group == -1 || itr->getSubGroup() == group)
1015 if (!member1 || !member2)
1036 uint8 prevSubGroup = slot->group;
1038 if (prevSubGroup == group)
1042 slot->group = group;
1064 if (player->GetGroup() ==
this)
1065 player->GetGroupRef().setSubGroup(group);
1069 player->GetOriginalGroupRef().setSubGroup(group);
1088 if (slots[0]->group == slots[1]->group)
1091 uint8 tmp = slots[0]->group;
1092 slots[0]->group = slots[1]->group;
1093 slots[1]->group = tmp;
1096 for (
uint8 i = 0; i < 2; i++)
1103 stmt->
setUInt8(0, slots[i]->group);
1104 stmt->
setUInt64(1, slots[i]->guid.GetCounter());
1106 trans->Append(stmt);
1111 if (player->GetGroup() ==
this)
1112 player->GetGroupRef().setSubGroup(slots[i]->group);
1114 player->GetOriginalGroupRef().setSubGroup(slots[i]->group);
1155 Player* pNewLooter =
nullptr;
1159 if (player->IsAtGroupRewardDistance(pLootedObject))
1161 pNewLooter = player;
1172 if (player->IsAtGroupRewardDistance(pLootedObject))
1174 pNewLooter = player;
1182 if (oldLooterGUID != pNewLooter->
GetGUID())
1229 Player* member = itr->GetSource();
1237 if (member->
GetTeam() != team)
1239 errorGuid = member->
GetGUID();
1244 if (memberBracketEntry != bracketEntry)
1277 if (bgOrTemplate->
IsArena() && memberscount != MinPlayerCount)
1298 Player* player = itr->GetSource();
1322 Player* player = itr->GetSource();
1346 Player* player = itr->GetSource();
1361 if (!defaultDifficulty)
1376 switch (map->
Reset(method))
1418 TC_LOG_DEBUG(
"misc",
"-- Forced group value update for '{}'", pp->GetName());
1468 slot->roles = roles;
1511 readyCheckStarted.
Duration = duration;
1534 if (!citr->readyChecked)
1580 itr->readyChecked =
false;
1589 m_markers[markerId] = std::make_unique<RaidMarker>(mapId, positionX, positionY, positionZ, transportGuid);
1716 return mslot->flags;
1732 return (mslot1->group == slot2->
group);
1745 return mslot->group;
1856 if (itr->flags & flag)
1857 itr->flags &= ~flag;
1863 slot->flags |= flag;
1865 slot->flags &= ~flag;
@ SPELL_MERCENARY_CONTRACT_ALLIANCE
@ SPELL_MERCENARY_CONTRACT_HORDE
@ CHAR_DEL_GROUP_MEMBER_ALL
@ CHAR_UPD_GROUP_DIFFICULTY
@ CHAR_UPD_GROUP_RAID_DIFFICULTY
@ CHAR_UPD_GROUP_MEMBER_FLAG
@ CHAR_UPD_GROUP_PING_RESTRICTION
@ CHAR_UPD_GROUP_MEMBER_SUBGROUP
@ CHAR_UPD_GROUP_LEGACY_RAID_DIFFICULTY
DB2Storage< DifficultyEntry > sDifficultyStore("Difficulty.db2", &DifficultyLoadInfo::Instance)
DB2Storage< BattlemasterListEntry > sBattlemasterListStore("BattlemasterList.db2", &BattlemasterListLoadInfo::Instance)
DB2Storage< MapEntry > sMapStore("Map.db2", &MapLoadInfo::Instance)
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
std::chrono::seconds Seconds
Seconds shorthand typedef.
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
#define ASSERT_NOTNULL(pointer)
#define RAID_MARKERS_COUNT
@ GROUP_FLAG_LFG_RESTRICTED
@ GROUP_FLAG_EVERYONE_ASSISTANT
#define TARGET_ICONS_COUNT
@ GROUP_CATEGORY_INSTANCE
#define MAX_RAID_SUBGROUPS
#define TC_LOG_DEBUG(filterType__, message__,...)
#define TC_LOG_ERROR(filterType__, message__,...)
std::optional< T > Optional
Optional helper class to wrap optional values within.
@ PLAYER_FLAGS_GROUP_LEADER
GroupJoinBattlegroundResult
@ ERR_BATTLEGROUND_JOIN_RANGE_INDEX
@ ERR_BATTLEGROUND_JOIN_TIMED_OUT
@ ERR_GROUP_JOIN_BATTLEGROUND_DESERTERS
@ ERR_LFG_CANT_USE_BATTLEGROUND
@ ERR_BATTLEGROUND_JOIN_MERCENARY
@ ERR_BATTLEGROUND_JOIN_FAILED
@ ERR_BATTLEGROUND_TOO_MANY_QUEUES
@ ERR_ARENA_TEAM_PARTY_SIZE
@ BATTLEGROUND_RANDOM_EPIC
@ GROUP_REMOVEMETHOD_KICK_LFG
@ GROUP_REMOVEMETHOD_KICK
constexpr std::underlying_type< E >::type AsUnderlyingType(E enumValue)
static BattlegroundQueueTypeId BGQueueTypeId(uint16 battlemasterListId, BattlegroundQueueIdType type, bool rated, uint8 teamSize)
static bool IsRandomBattleground(uint32 battlemasterListId)
Group * GetBgRaid(Team team) const
void SetBgRaid(Team team, Group *bg_raid)
static PVPDifficultyEntry const * GetBattlegroundBracketByLevel(uint32 mapid, uint32 level)
Class used to access individual fields of database query result.
Seconds GetTimeLeft() const
void StartCountdown(Seconds duration, Optional< time_t > startTime={ })
ObjectGuid m_targetIcons[TARGET_ICONS_COUNT]
member_citerator _getMemberCSlot(ObjectGuid Guid) const
bool IsReadyCheckCompleted(void) const
void BroadcastGroupUpdate(void)
void StartLeaderOfflineTimer()
uint8 GetMemberGroup(ObjectGuid guid) const
void SwapMembersGroups(ObjectGuid firstGuid, ObjectGuid secondGuid)
ObjectGuid GetMasterLooterGuid() const
void SendUpdateToPlayer(ObjectGuid playerGUID, MemberSlot const *slot=nullptr) const
uint8 m_leaderFactionGroup
ObjectGuid GetMemberGUID(std::string const &name) const
bool AddLeaderInvite(Player *player)
void SetBattlefieldGroup(Battlefield *bf)
void ResetInstances(InstanceResetMethod method, Player *notifyPlayer)
void DeleteRaidMarker(uint8 markerId)
GroupCategory GetGroupCategory() const
RestrictPingsTo m_pingRestriction
Difficulty m_legacyRaidDifficulty
bool _setMembersGroup(ObjectGuid guid, uint8 group)
void SubGroupCounterDecrease(uint8 subgroup)
void SetLootMethod(LootMethod method)
void ChangeMembersGroup(ObjectGuid guid, uint8 group)
void SendTargetIconList(WorldSession *session) const
void SetEveryoneIsAssistant(bool apply)
GroupCategory m_groupCategory
void AddRaidMarker(uint8 markerId, uint32 mapId, float positionX, float positionY, float positionZ, ObjectGuid transportGuid=ObjectGuid::Empty)
void _initRaidSubGroupsCounter()
std::array< std::unique_ptr< RaidMarker >, RAID_MARKERS_COUNT > m_markers
void SetLootThreshold(ItemQualities threshold)
void Disband(bool hideDestroy=false)
void LoadGroupFromDB(Field *field)
bool AddMember(Player *player)
bool IsLeader(ObjectGuid guid) const
Difficulty m_raidDifficulty
void SetMemberReadyCheck(ObjectGuid guid, bool ready)
void BroadcastAddonMessagePacket(WorldPacket const *packet, const std::string &prefix, bool ignorePlayersInBGRaid, int group=-1, ObjectGuid ignore=ObjectGuid::Empty) const
GroupRefManager m_memberMgr
void SetDungeonDifficultyID(Difficulty difficulty)
void SetRestrictPingsTo(RestrictPingsTo restrictTo)
void SetMasterLooterGuid(ObjectGuid guid)
void SetRaidDifficultyID(Difficulty difficulty)
Trinity::unique_trackable_ptr< Group > m_scriptRef
ObjectGuid GetGUID() const
void RemoveInvite(Player *player)
void SetLegacyRaidDifficultyID(Difficulty difficulty)
ItemQualities GetLootThreshold() const
void SetOfflineMembersReadyChecked(void)
std::unordered_map< uint32, std::pair< ObjectGuid, uint32 > > m_recentInstances
MemberSlotList m_memberSlots
void StartReadyCheck(ObjectGuid starterGuid, Milliseconds duration=Milliseconds(READYCHECK_DURATION))
void SendRaidMarkersChanged(WorldSession *session=nullptr) const
uint32 GetMembersCount() const
void StopLeaderOfflineTimer()
void UpdatePlayerOutOfRange(Player const *player) const
void ToggleGroupMemberFlag(member_witerator slot, uint8 flag, bool apply)
void _homebindIfInstance(Player *player)
Difficulty GetRaidDifficultyID() const
void SetLfgRoles(ObjectGuid guid, uint8 roles)
void SetGroupMemberFlag(ObjectGuid guid, bool apply, GroupMemberFlags flag)
TimeTracker m_leaderOfflineTimer
void ResetMemberReadyChecked(void)
member_witerator _getMemberWSlot(ObjectGuid Guid)
ObjectGuid GetLooterGuid() const
Milliseconds m_readyCheckTimer
void DelinkMember(ObjectGuid guid)
void ChangeLeader(ObjectGuid guid)
const char * GetLeaderName() const
ObjectGuid m_masterLooterGuid
MemberSlotList::iterator member_witerator
void SetBattlegroundGroup(Battleground *bg)
uint8 GetLfgRoles(ObjectGuid guid) const
LootMethod GetLootMethod() const
void UpdateLooterGuid(WorldObject *pLootedObject, bool ifneed=false)
CountdownInfo const * GetCountdownInfo(CountdownTimerType timerType) const
bool RemoveMember(ObjectGuid guid, RemoveMethod method=GROUP_REMOVEMETHOD_DEFAULT, ObjectGuid kicker=ObjectGuid::Empty, const char *reason=nullptr)
Player * GetInvited(ObjectGuid guid) const
bool HasFreeSlotSubGroup(uint8 subgroup) const
void LoadMemberFromDB(ObjectGuid::LowType guidLow, uint8 memberFlags, uint8 subgroup, uint8 roles)
bool IsMember(ObjectGuid guid) const
GroupReference * GetFirstMember()
void UpdateReadyCheck(uint32 diff)
Difficulty GetDungeonDifficultyID() const
void BroadcastPacket(WorldPacket const *packet, bool ignorePlayersInBGRaid, int group=-1, ObjectGuid ignoredPlayer=ObjectGuid::Empty) const
void SelectNewPartyOrRaidLeader()
bool SameSubGroup(ObjectGuid guid1, ObjectGuid guid2) const
void LinkOwnedInstance(GroupInstanceReference *ref)
bool AddInvite(Player *player)
uint8 * m_subGroupsCounts
Difficulty GetDifficultyID(MapEntry const *mapEntry) const
MemberSlotList::const_iterator member_citerator
std::array< std::unique_ptr< CountdownInfo >, 3 > m_countdowns
void SetMemberReadyChecked(MemberSlot *slot)
void SubGroupCounterIncrease(uint8 subgroup)
void SetTargetIcon(uint8 symbol, ObjectGuid target, ObjectGuid changedBy)
bool Create(Player *leader)
RestrictPingsTo GetRestrictPings() const
ObjectGuid GetLeaderGUID() const
Difficulty m_dungeonDifficulty
uint8 GetMemberFlags(ObjectGuid guid) const
Difficulty GetLegacyRaidDifficultyID() const
void SetLooterGuid(ObjectGuid guid)
void LinkMember(GroupReference *pRef)
ItemQualities m_lootThreshold
GroupJoinBattlegroundResult CanJoinBattlegroundQueue(BattlegroundTemplate const *bgOrTemplate, BattlegroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot, ObjectGuid &errorGuid) const
void RemoveUniqueGroupMemberFlag(GroupMemberFlags flag)
GroupInstanceRefManager m_ownedInstancesMgr
void SendUpdateDestroyGroupToPlayer(Player *player) const
void StartCountdown(CountdownTimerType timerType, Seconds duration, Optional< time_t > startTime={ })
InstanceResetResult Reset(InstanceResetMethod method)
void insertLast(LinkedListElement *pElem)
void insertFirst(LinkedListElement *pElem)
InstanceMap * ToInstanceMap()
LowType GetCounter() const
static ObjectGuid const Empty
uint64 GetRawValue(std::size_t i) const
void SetRawValue(std::span< uint8 const > rawBytes)
static constexpr std::size_t BytesSize
void BuildValuesUpdateBlockForPlayerWithFlag(UpdateData *data, UF::UpdateFieldFlag flags, Player const *target) const
static ObjectGuid GetGUID(Object const *o)
bool HaveAtClient(Object const *u) const
bool InBattlegroundQueueForBattlegroundQueueType(BattlegroundQueueTypeId bgQueueTypeId) const
void SetOriginalGroup(Group *group, int8 subgroup=-1)
void SetPlayerFlag(PlayerFlags flags)
void SetPartyType(GroupCategory category, uint8 type)
int32 NextGroupUpdateSequenceNumber(GroupCategory category)
void SetGroupUpdateFlag(uint32 flag)
void SendDirectMessage(WorldPacket const *data) const
void SendResetInstanceFailed(ResetFailedReason reason, uint32 mapID) const
void SetGroup(Group *group, int8 subgroup=-1)
void SendDungeonDifficulty(int32 forcedDifficulty=-1) const
void SetGroupInvite(Group *group)
void RemoveFromBattlegroundOrBattlefieldRaid()
void SetRaidDifficultyID(Difficulty raid_difficulty)
Group * GetOriginalGroup() const
bool CanRewardQuest(Quest const *quest, bool msg) const
void UpdateVisibleObjectInteractions(bool allUnits, bool onlySpellClicks, bool gameObjectQuestGiverStatus, bool questObjectiveGameObjects)
bool IsAtGroupRewardDistance(WorldObject const *pRewardSource) const
bool InBattlegroundQueue(bool ignoreArena=false) const
WorldSession * GetSession() const
void ResetGroupUpdateSequenceIfNeeded(Group const *group)
Difficulty GetDungeonDifficultyID() const
void SetLegacyRaidDifficultyID(Difficulty raid_difficulty)
bool CanJoinToBattleground(BattlegroundTemplate const *bg) const
bool HasFreeBattlegroundQueueId() const
bool IsGameMaster() const
static Difficulty CheckLoadedLegacyRaidDifficultyID(Difficulty difficulty)
static uint8 GetFactionGroupForRace(uint8 race)
void SetDungeonDifficultyID(Difficulty dungeon_difficulty)
bool CheckInstanceValidity(bool)
Difficulty GetRaidDifficultyID() const
void SendResetInstanceSuccess(uint32 MapId) const
static Difficulty CheckLoadedRaidDifficultyID(Difficulty difficulty)
void SendRaidDifficulty(bool legacy, int32 forcedDifficulty=-1) const
Group * GetGroup(Optional< uint8 > partyIndex)
uint8 GetSubGroup() const
void FailCriteria(CriteriaFailEvent condition, int32 failAsset)
Group * GetGroupInvite() const
static Difficulty CheckLoadedDungeonDifficultyID(Difficulty difficulty)
uint32 GetArenaTeamId(uint8) const
Difficulty GetLegacyRaidDifficultyID() const
void SetBattlegroundOrBattlefieldRaid(Group *group, int8 subgroup=-1)
void setInt8(uint8 index, int8 value)
void setBinary(uint8 index, std::vector< uint8 > &&value)
void setUInt16(uint8 index, uint16 value)
void setUInt32(uint8 index, uint32 value)
void setUInt64(uint8 index, uint64 value)
void setUInt8(uint8 index, uint8 value)
ReferenceType * getFirst()
void RemoveAllGroupBuffsFromCaster(ObjectGuid casterGUID)
UF::UpdateField< UF::UnitData, int32(WowCS::EntityFragment::CGObject), TYPEID_UNIT > m_unitData
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
bool BuildPacket(WorldPacket *packet)
constexpr uint32 GetMapId() const
float GetSightRange(WorldObject const *target=nullptr) const
std::string const & GetName() const
bool IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
bool IsInMap(WorldObject const *obj) const
WorldPacket const * GetRawPacket() const
WorldPacket const * Write() override
void Initialize(Player const *player)
WorldPacket const * Write() override
Optional< PartyLootSettings > LootSettings
RestrictPingsTo PingRestriction
Optional< PartyDifficultySettings > DifficultySettings
std::vector< PartyPlayerInfo > PlayerList
WorldPacket const * Write() override
Optional< PartyLFGInfo > LfgInfos
WorldPacket const * Write() override
std::vector< RaidMarker const * > RaidMarkers
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPackets::Duration< Milliseconds > Duration
std::map< uint8, ObjectGuid > TargetIcons
WorldPacket const * Write() override
WorldPacket const * Write() override
Player session in the World.
bool PlayerLogout() const
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
bool IsAddonRegistered(std::string_view prefix) const
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
@ LFG_STATE_FINISHED_DUNGEON
std::vector< int32 > MapIDs
UpdateField< int32, 32, 44 > FactionTemplate
UpdateField< uint8, 64, 84 > PvpFlags