diff options
| author | Shauren <shauren.trinity@gmail.com> | 2023-10-07 18:29:53 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2023-10-07 18:29:53 +0200 |
| commit | d2baaac9ec9c0b0839d5868d9666aa0901031b28 (patch) | |
| tree | 68f842598260f6129de31a595fe71a40adf2befd /src/server/game/Entities | |
| parent | 0ce96adb7a8ae29a577cce268c8bd3742253cf69 (diff) | |
Core/Chat: Corrected chat channel flag implementations
Diffstat (limited to 'src/server/game/Entities')
| -rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 59 |
1 files changed, 33 insertions, 26 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index c49a21ead31..1dc992bae6c 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -4934,16 +4934,19 @@ void Player::RepopAtGraveyard() bool Player::CanJoinConstantChannelInZone(ChatChannelsEntry const* channel, AreaTableEntry const* zone) const { - if (channel->Flags & CHANNEL_DBC_FLAG_ZONE_DEP && zone->GetFlags().HasFlag(AreaFlags::NoChatChannels)) + if (channel->GetFlags().HasFlag(ChatChannelFlags::ZoneBased) && zone->GetFlags().HasFlag(AreaFlags::NoChatChannels)) return false; - if ((channel->Flags & CHANNEL_DBC_FLAG_CITY_ONLY) && (!(zone->GetFlags().HasFlag(AreaFlags::AllowTradeChannel)))) + if (channel->GetFlags().HasFlag(ChatChannelFlags::OnlyInCities) && !zone->GetFlags().HasFlag(AreaFlags::AllowTradeChannel)) return false; - if ((channel->Flags & CHANNEL_DBC_FLAG_GUILD_REQ) && GetGuildId()) + if (channel->GetFlags().HasFlag(ChatChannelFlags::GuildRecruitment) && GetGuildId()) return false; - if (channel->Flags & CHANNEL_DBC_FLAG_NO_CLIENT_JOIN) + if (channel->GetRuleset() == ChatChannelRuleset::Disabled) + return false; + + if (channel->GetFlags().HasFlag(ChatChannelFlags::Regional)) return false; return true; @@ -4988,19 +4991,15 @@ void Player::UpdateLocalChannels(uint32 newZone) if (!cMgr) return; - for (uint32 i = 0; i < sChatChannelsStore.GetNumRows(); ++i) + for (ChatChannelsEntry const* channelEntry : sChatChannelsStore) { - ChatChannelsEntry const* channelEntry = sChatChannelsStore.LookupEntry(i); - if (!channelEntry) - continue; - - if (!(channelEntry->Flags & CHANNEL_DBC_FLAG_INITIAL)) + if (!channelEntry->GetFlags().HasFlag(ChatChannelFlags::AutoJoin)) continue; Channel* usedChannel = nullptr; for (Channel* channel : m_channels) { - if (channel->GetChannelId() == i) + if (channel->GetChannelId() == channelEntry->ID) { usedChannel = channel; break; @@ -5013,9 +5012,9 @@ void Player::UpdateLocalChannels(uint32 newZone) if (CanJoinConstantChannelInZone(channelEntry, current_zone)) { - if (!(channelEntry->Flags & CHANNEL_DBC_FLAG_GLOBAL)) + if (channelEntry->GetFlags().HasFlag(ChatChannelFlags::ZoneBased)) { - if (channelEntry->Flags & CHANNEL_DBC_FLAG_CITY_ONLY && usedChannel) + if (channelEntry->GetFlags().HasFlag(ChatChannelFlags::LinkedChannel) && usedChannel) continue; // Already on the channel, as city channel names are not changing joinChannel = cMgr->GetSystemChannel(channelEntry->ID, current_zone); @@ -7517,8 +7516,10 @@ void Player::UpdateArea(uint32 newArea) { // FFA_PVP flags are area and not zone id dependent // so apply them accordingly + uint32 const oldArea = m_areaUpdateId; m_areaUpdateId = newArea; + AreaTableEntry const* oldAreaEntry = sAreaTableStore.LookupEntry(oldArea); AreaTableEntry const* area = sAreaTableStore.LookupEntry(newArea); bool oldFFAPvPArea = pvpInfo.IsInFFAPvPArea; pvpInfo.IsInFFAPvPArea = area && (area->GetFlags().HasFlag(AreaFlags::FreeForAllPvP)); @@ -7559,6 +7560,10 @@ void Player::UpdateArea(uint32 newArea) UpdateCriteria(CriteriaType::EnterTopLevelArea, newArea); UpdateMountCapability(); + + if ((oldAreaEntry && oldAreaEntry->GetFlags2().HasFlag(AreaFlags2::UseSubzoneForChatChannel)) + || (area && area->GetFlags2().HasFlag(AreaFlags2::UseSubzoneForChatChannel))) + UpdateLocalChannels(newArea); } void Player::UpdateZone(uint32 newZone, uint32 newArea) @@ -7623,7 +7628,9 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea) AutoUnequipOffhandIfNeed(); // recent client version not send leave/join channel packets for built-in local channels - UpdateLocalChannels(newZone); + AreaTableEntry const* newAreaEntry = sAreaTableStore.LookupEntry(newArea); + if (!newAreaEntry || !newAreaEntry->GetFlags2().HasFlag(AreaFlags2::UseSubzoneForChatChannel)) + UpdateLocalChannels(newZone); UpdateZoneDependentAuras(newZone); @@ -20973,18 +20980,18 @@ void Player::outDebugValues() const if (!sLog->ShouldLog("entities.unit", LOG_LEVEL_DEBUG)) return; - TC_LOG_DEBUG("entities.unit", "HP is: \t\t\t{}\t\tMP is: \t\t\t{}", GetMaxHealth(), GetMaxPower(POWER_MANA)); - TC_LOG_DEBUG("entities.unit", "AGILITY is: \t\t{}\t\tSTRENGTH is: \t\t{}", GetStat(STAT_AGILITY), GetStat(STAT_STRENGTH)); - TC_LOG_DEBUG("entities.unit", "INTELLECT is: \t\t{}", GetStat(STAT_INTELLECT)); - TC_LOG_DEBUG("entities.unit", "STAMINA is: \t\t{}", GetStat(STAT_STAMINA)); - TC_LOG_DEBUG("entities.unit", "Armor is: \t\t{}\t\tBlock is: \t\t{}", GetArmor(), *m_activePlayerData->BlockPercentage); - TC_LOG_DEBUG("entities.unit", "HolyRes is: \t\t{}\t\tFireRes is: \t\t{}", GetResistance(SPELL_SCHOOL_MASK_HOLY), GetResistance(SPELL_SCHOOL_MASK_FIRE)); - TC_LOG_DEBUG("entities.unit", "NatureRes is: \t\t{}\t\tFrostRes is: \t\t{}", GetResistance(SPELL_SCHOOL_MASK_NATURE), GetResistance(SPELL_SCHOOL_MASK_FROST)); - TC_LOG_DEBUG("entities.unit", "ShadowRes is: \t\t{}\t\tArcaneRes is: \t\t{}", GetResistance(SPELL_SCHOOL_MASK_SHADOW), GetResistance(SPELL_SCHOOL_MASK_ARCANE)); - TC_LOG_DEBUG("entities.unit", "MIN_DAMAGE is: \t\t{}\tMAX_DAMAGE is: \t\t{}", *m_unitData->MinDamage, *m_unitData->MaxDamage); - TC_LOG_DEBUG("entities.unit", "MIN_OFFHAND_DAMAGE is: \t{}\tMAX_OFFHAND_DAMAGE is: \t{}", *m_unitData->MinOffHandDamage, *m_unitData->MaxOffHandDamage); - TC_LOG_DEBUG("entities.unit", "MIN_RANGED_DAMAGE is: \t{}\tMAX_RANGED_DAMAGE is: \t{}", *m_unitData->MinRangedDamage, *m_unitData->MaxRangedDamage); - TC_LOG_DEBUG("entities.unit", "ATTACK_TIME is: \t{}\t\tRANGE_ATTACK_TIME is: \t{}", GetBaseAttackTime(BASE_ATTACK), GetBaseAttackTime(RANGED_ATTACK)); + sLog->OutMessage("entities.unit", LOG_LEVEL_DEBUG, "HP is: \t\t\t{}\t\tMP is: \t\t\t{}", GetMaxHealth(), GetMaxPower(POWER_MANA)); + sLog->OutMessage("entities.unit", LOG_LEVEL_DEBUG, "AGILITY is: \t\t{}\t\tSTRENGTH is: \t\t{}", GetStat(STAT_AGILITY), GetStat(STAT_STRENGTH)); + sLog->OutMessage("entities.unit", LOG_LEVEL_DEBUG, "INTELLECT is: \t\t{}", GetStat(STAT_INTELLECT)); + sLog->OutMessage("entities.unit", LOG_LEVEL_DEBUG, "STAMINA is: \t\t{}", GetStat(STAT_STAMINA)); + sLog->OutMessage("entities.unit", LOG_LEVEL_DEBUG, "Armor is: \t\t{}\t\tBlock is: \t\t{}", GetArmor(), *m_activePlayerData->BlockPercentage); + sLog->OutMessage("entities.unit", LOG_LEVEL_DEBUG, "HolyRes is: \t\t{}\t\tFireRes is: \t\t{}", GetResistance(SPELL_SCHOOL_MASK_HOLY), GetResistance(SPELL_SCHOOL_MASK_FIRE)); + sLog->OutMessage("entities.unit", LOG_LEVEL_DEBUG, "NatureRes is: \t\t{}\t\tFrostRes is: \t\t{}", GetResistance(SPELL_SCHOOL_MASK_NATURE), GetResistance(SPELL_SCHOOL_MASK_FROST)); + sLog->OutMessage("entities.unit", LOG_LEVEL_DEBUG, "ShadowRes is: \t\t{}\t\tArcaneRes is: \t\t{}", GetResistance(SPELL_SCHOOL_MASK_SHADOW), GetResistance(SPELL_SCHOOL_MASK_ARCANE)); + sLog->OutMessage("entities.unit", LOG_LEVEL_DEBUG, "MIN_DAMAGE is: \t\t{}\tMAX_DAMAGE is: \t\t{}", *m_unitData->MinDamage, *m_unitData->MaxDamage); + sLog->OutMessage("entities.unit", LOG_LEVEL_DEBUG, "MIN_OFFHAND_DAMAGE is: \t{}\tMAX_OFFHAND_DAMAGE is: \t{}", *m_unitData->MinOffHandDamage, *m_unitData->MaxOffHandDamage); + sLog->OutMessage("entities.unit", LOG_LEVEL_DEBUG, "MIN_RANGED_DAMAGE is: \t{}\tMAX_RANGED_DAMAGE is: \t{}", *m_unitData->MinRangedDamage, *m_unitData->MaxRangedDamage); + sLog->OutMessage("entities.unit", LOG_LEVEL_DEBUG, "ATTACK_TIME is: \t{}\t\tRANGE_ATTACK_TIME is: \t{}", GetBaseAttackTime(BASE_ATTACK), GetBaseAttackTime(RANGED_ATTACK)); } /*********************************************************/ |
