mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-29 16:43:47 +00:00
refactor(Core/Player): Improve Channel.RestrictedLfg handling (#21145)
This commit is contained in:
@@ -13100,7 +13100,7 @@ PartyResult Player::CanUninviteFromGroup(ObjectGuid targetPlayerGUID) const
|
||||
return ERR_PARTY_RESULT_OK;
|
||||
}
|
||||
|
||||
bool Player::isUsingLfg()
|
||||
bool Player::IsUsingLfg()
|
||||
{
|
||||
return sLFGMgr->GetState(GetGUID()) != lfg::LFG_STATE_NONE;
|
||||
}
|
||||
|
||||
@@ -2071,6 +2071,7 @@ public:
|
||||
void LeftChannel(Channel* c);
|
||||
void CleanupChannels();
|
||||
void ClearChannelWatch();
|
||||
void UpdateLFGChannel();
|
||||
void UpdateLocalChannels(uint32 newZone);
|
||||
|
||||
void UpdateDefense();
|
||||
@@ -2406,7 +2407,7 @@ public:
|
||||
void SetAtLoginFlag(AtLoginFlags f) { m_atLoginFlags |= f; }
|
||||
void RemoveAtLoginFlag(AtLoginFlags flags, bool persist = false);
|
||||
|
||||
bool isUsingLfg();
|
||||
bool IsUsingLfg();
|
||||
bool inRandomLfgDungeon();
|
||||
|
||||
typedef std::set<uint32> DFQuestsDoneList;
|
||||
|
||||
@@ -461,6 +461,44 @@ void Player::UpdateNextMailTimeAndUnreads()
|
||||
}
|
||||
}
|
||||
|
||||
void Player::UpdateLFGChannel()
|
||||
{
|
||||
if (!sWorld->getBoolConfig(CONFIG_RESTRICTED_LFG_CHANNEL))
|
||||
return;
|
||||
|
||||
ChannelMgr* cMgr = ChannelMgr::forTeam(GetTeamId());
|
||||
if (!cMgr)
|
||||
return;
|
||||
|
||||
ChatChannelsEntry const* cce = sChatChannelsStore.LookupEntry(26); /*LookingForGroup*/
|
||||
Channel* cLFG = cMgr->GetJoinChannel(cce->pattern[m_session->GetSessionDbcLocale()], cce->ChannelID);
|
||||
if (!cLFG)
|
||||
return;
|
||||
|
||||
Channel* cUsed = nullptr;
|
||||
for (Channel* channel : m_channels)
|
||||
if (channel && channel->GetChannelId() == cce->ChannelID)
|
||||
{
|
||||
cUsed = cLFG;
|
||||
break;
|
||||
}
|
||||
|
||||
if (IsUsingLfg())
|
||||
{
|
||||
if (cUsed == cLFG)
|
||||
return;
|
||||
|
||||
cLFG->JoinChannel(this, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cLFG != cUsed)
|
||||
return;
|
||||
|
||||
cLFG->LeaveChannel(this, true);
|
||||
}
|
||||
}
|
||||
|
||||
void Player::UpdateLocalChannels(uint32 newZone)
|
||||
{
|
||||
// pussywizard: mutex needed (tc changed opcode to THREAD UNSAFE)
|
||||
|
||||
Reference in New Issue
Block a user