mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-29 00:23:48 +00:00
fix(Core/Groups): fix group enchanting level not resetting properly (#5501)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user