fix(Core/Groups): fix group enchanting level not resetting properly (#5501)

This commit is contained in:
Axel Cocat
2021-05-07 13:51:39 +02:00
committed by GitHub
parent acb7c6291c
commit 0e8e21b812
3 changed files with 15 additions and 5 deletions

View File

@@ -557,10 +557,6 @@ bool Group::RemoveMember(ObjectGuid guid, const RemoveMethod& method /*= GROUP_R
CharacterDatabase.Execute(stmt);
}
// Reevaluate group enchanter if the leaving player had enchanting skill or the player is offline
if (!player || player->GetSkillValue(SKILL_ENCHANTING))
ResetMaxEnchantingLevel();
// Remove player from loot rolls
for (Rolls::iterator it = RollId.begin(); it != RollId.end();)
{
@@ -602,6 +598,12 @@ bool Group::RemoveMember(ObjectGuid guid, const RemoveMethod& method /*= GROUP_R
sWorld->UpdateGlobalPlayerGroup(guid.GetCounter(), 0);
}
// Reevaluate group enchanter if the leaving player had enchanting skill or the player is offline
if (!player || player->GetSkillValue(SKILL_ENCHANTING))
{
ResetMaxEnchantingLevel();
}
// Pick new leader if necessary
bool validLeader = true;
if (m_leaderGuid == guid)
@@ -2057,8 +2059,11 @@ void Group::ResetMaxEnchantingLevel()
for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
{
pMember = ObjectAccessor::FindPlayer(citr->guid);
if (pMember && m_maxEnchantingLevel < pMember->GetSkillValue(SKILL_ENCHANTING))
if (pMember && pMember->GetSession() && !pMember->GetSession()->IsSocketClosed()
&& m_maxEnchantingLevel < pMember->GetSkillValue(SKILL_ENCHANTING))
{
m_maxEnchantingLevel = pMember->GetSkillValue(SKILL_ENCHANTING);
}
}
}

View File

@@ -450,6 +450,10 @@ bool WorldSession::HandleSocketClosed()
return false;
}
bool WorldSession::IsSocketClosed() const {
return !m_Socket || m_Socket->IsClosed();
}
void WorldSession::HandleTeleportTimeout(bool updateInSessions)
{
// pussywizard: handle teleport ack timeout

View File

@@ -926,6 +926,7 @@ public: // opcodes handlers
void SetKicked(bool val) { _kicked = val; }
void SetShouldSetOfflineInDB(bool val) { _shouldSetOfflineInDB = val; }
bool GetShouldSetOfflineInDB() const { return _shouldSetOfflineInDB; }
bool IsSocketClosed() const;
/***
CALLBACKS