diff options
Diffstat (limited to 'src/server/game/Entities')
| -rw-r--r-- | src/server/game/Entities/GameObject/GameObject.cpp | 19 | ||||
| -rw-r--r-- | src/server/game/Entities/Item/Item.cpp | 19 | ||||
| -rw-r--r-- | src/server/game/Entities/Item/ItemBonusMgr.cpp | 3 | ||||
| -rw-r--r-- | src/server/game/Entities/Object/Updates/ViewerDependentValues.h | 30 | ||||
| -rw-r--r-- | src/server/game/Entities/Player/CollectionMgr.cpp | 8 | ||||
| -rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 39 | ||||
| -rw-r--r-- | src/server/game/Entities/Taxi/TaxiPathGraph.cpp | 5 | ||||
| -rw-r--r-- | src/server/game/Entities/Unit/Vignette.cpp | 5 |
8 files changed, 49 insertions, 79 deletions
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index ad775307b47..ec3b687283e 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -2228,7 +2228,7 @@ bool GameObject::CanActivateForPlayer(Player const* target) const if (!MeetsInteractCondition(target)) return false; - if (sObjectMgr->IsGameObjectForQuests(GetEntry()) && !ActivateToQuest(target)) + if (!ActivateToQuest(target)) return false; return true; @@ -2240,7 +2240,7 @@ bool GameObject::ActivateToQuest(Player const* target) const return true; if (!sObjectMgr->IsGameObjectForQuests(GetEntry())) - return false; + return true; switch (GetGoType()) { @@ -3321,9 +3321,9 @@ void GameObject::Use(Unit* user) return; Player* player = user->ToPlayer(); - if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(info->itemForge.conditionID1)) - if (!sConditionMgr->IsPlayerMeetingCondition(player, playerCondition)) - return; + + if (!MeetsInteractCondition(player)) + return; switch (info->itemForge.ForgeType) { @@ -4431,14 +4431,7 @@ GuidUnorderedSet const* GameObject::GetInsidePlayers() const bool GameObject::MeetsInteractCondition(Player const* user) const { - if (!m_goInfo->GetConditionID1()) - return true; - - if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(m_goInfo->GetConditionID1())) - if (!ConditionMgr::IsPlayerMeetingCondition(user, playerCondition)) - return false; - - return true; + return ConditionMgr::IsPlayerMeetingCondition(user, m_goInfo->GetConditionID1()); } std::unordered_map<ObjectGuid, GameObject::PerPlayerState>& GameObject::GetOrCreatePerPlayerStates() diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index 89b950bb54a..42e16152695 100644 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -401,9 +401,8 @@ bool Item::Create(ObjectGuid::LowType guidlow, uint32 itemId, ItemContext contex if (itemProto->GetArtifactID() != artifactAppearanceSet->ArtifactID) continue; - if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(artifactAppearance->UnlockPlayerConditionID)) - if (!owner || !sConditionMgr->IsPlayerMeetingCondition(owner, playerCondition)) - continue; + if (!owner || !ConditionMgr::IsPlayerMeetingCondition(owner, artifactAppearance->UnlockPlayerConditionID)) + continue; SetModifier(ITEM_MODIFIER_ARTIFACT_APPEARANCE_ID, artifactAppearance->ID); SetAppearanceModId(artifactAppearance->ItemAppearanceModifierID); @@ -934,13 +933,10 @@ void Item::LoadArtifactData(Player const* owner, uint64 xp, uint32 artifactAppea case ITEM_ENCHANTMENT_TYPE_ARTIFACT_POWER_BONUS_RANK_PICKER: if (_bonusData.GemRelicType[e - SOCK_ENCHANTMENT_SLOT] != -1) { - if (ArtifactPowerPickerEntry const* artifactPowerPicker = sArtifactPowerPickerStore.LookupEntry(enchant->EffectArg[i])) - { - PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(artifactPowerPicker->PlayerConditionID); - if (!playerCondition || (owner && sConditionMgr->IsPlayerMeetingCondition(owner, playerCondition))) - if (artifactPower->Label == _bonusData.GemRelicType[e - SOCK_ENCHANTMENT_SLOT]) - power.CurrentRankWithBonus += enchant->EffectPointsMin[i]; - } + ArtifactPowerPickerEntry const* artifactPowerPicker = sArtifactPowerPickerStore.LookupEntry(enchant->EffectArg[i]); + if (artifactPowerPicker && owner && ConditionMgr::IsPlayerMeetingCondition(owner, artifactPowerPicker->PlayerConditionID)) + if (artifactPower->Label == _bonusData.GemRelicType[e - SOCK_ENCHANTMENT_SLOT]) + power.CurrentRankWithBonus += enchant->EffectPointsMin[i]; } break; default: @@ -2607,8 +2603,7 @@ void Item::ApplyArtifactPowerEnchantmentBonuses(EnchantmentSlot slot, uint32 enc { if (ArtifactPowerPickerEntry const* artifactPowerPicker = sArtifactPowerPickerStore.LookupEntry(enchant->EffectArg[i])) { - PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(artifactPowerPicker->PlayerConditionID); - if (!playerCondition || sConditionMgr->IsPlayerMeetingCondition(owner, playerCondition)) + if (ConditionMgr::IsPlayerMeetingCondition(owner, artifactPowerPicker->PlayerConditionID)) { for (uint32 artifactPowerIndex = 0; artifactPowerIndex < m_itemData->ArtifactPowers.size(); ++artifactPowerIndex) { diff --git a/src/server/game/Entities/Item/ItemBonusMgr.cpp b/src/server/game/Entities/Item/ItemBonusMgr.cpp index 478b7be0826..7d743604455 100644 --- a/src/server/game/Entities/Item/ItemBonusMgr.cpp +++ b/src/server/game/Entities/Item/ItemBonusMgr.cpp @@ -94,8 +94,7 @@ ItemContext GetContextForPlayer(MapDifficultyEntry const* mapDifficulty, Player bool meetsPlayerCondition = false; if (player) - if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(itemContextPickerEntry->PlayerConditionID)) - meetsPlayerCondition = ConditionMgr::IsPlayerMeetingCondition(player, playerCondition); + meetsPlayerCondition = ConditionMgr::IsPlayerMeetingCondition(player, itemContextPickerEntry->PlayerConditionID); if (itemContextPickerEntry->Flags & 0x1) meetsPlayerCondition = !meetsPlayerCondition; diff --git a/src/server/game/Entities/Object/Updates/ViewerDependentValues.h b/src/server/game/Entities/Object/Updates/ViewerDependentValues.h index 8c7c5c22580..c89b74cafdf 100644 --- a/src/server/game/Entities/Object/Updates/ViewerDependentValues.h +++ b/src/server/game/Entities/Object/Updates/ViewerDependentValues.h @@ -90,15 +90,27 @@ public: uint16 pathProgress = 0xFFFF; switch (gameObject->GetGoType()) { + case GAMEOBJECT_TYPE_BUTTON: + case GAMEOBJECT_TYPE_GOOBER: + if (gameObject->GetGOInfo()->GetQuestID() || gameObject->GetGOInfo()->GetConditionID1()) + { + if (gameObject->CanActivateForPlayer(receiver)) + { + dynFlags |= GO_DYNFLAG_LO_HIGHLIGHT; + if (gameObject->GetGoStateFor(receiver->GetGUID()) != GO_STATE_ACTIVE) + dynFlags |= GO_DYNFLAG_LO_ACTIVATE; + } + } + break; case GAMEOBJECT_TYPE_QUESTGIVER: - if (gameObject->ActivateToQuest(receiver)) + if (gameObject->CanActivateForPlayer(receiver)) dynFlags |= GO_DYNFLAG_LO_ACTIVATE; break; case GAMEOBJECT_TYPE_CHEST: - if (gameObject->ActivateToQuest(receiver)) + if (gameObject->CanActivateForPlayer(receiver)) dynFlags |= GO_DYNFLAG_LO_ACTIVATE | GO_DYNFLAG_LO_SPARKLE | GO_DYNFLAG_LO_HIGHLIGHT; else if (receiver->IsGameMaster()) - dynFlags |= GO_DYNFLAG_LO_ACTIVATE; + dynFlags |= GO_DYNFLAG_LO_ACTIVATE | GO_DYNFLAG_LO_SPARKLE; break; case GAMEOBJECT_TYPE_GENERIC: case GAMEOBJECT_TYPE_SPELL_FOCUS: @@ -106,16 +118,6 @@ public: if (gameObject->CanActivateForPlayer(receiver)) dynFlags |= GO_DYNFLAG_LO_SPARKLE | GO_DYNFLAG_LO_HIGHLIGHT; break; - case GAMEOBJECT_TYPE_GOOBER: - if (gameObject->ActivateToQuest(receiver)) - { - dynFlags |= GO_DYNFLAG_LO_HIGHLIGHT; - if (gameObject->GetGoStateFor(receiver->GetGUID()) != GO_STATE_ACTIVE) - dynFlags |= GO_DYNFLAG_LO_ACTIVATE; - } - else if (receiver->IsGameMaster()) - dynFlags |= GO_DYNFLAG_LO_ACTIVATE; - break; case GAMEOBJECT_TYPE_TRANSPORT: case GAMEOBJECT_TYPE_MAP_OBJ_TRANSPORT: { @@ -130,7 +132,7 @@ public: dynFlags &= ~GO_DYNFLAG_LO_NO_INTERACT; break; case GAMEOBJECT_TYPE_GATHERING_NODE: - if (gameObject->ActivateToQuest(receiver)) + if (gameObject->CanActivateForPlayer(receiver)) dynFlags |= GO_DYNFLAG_LO_ACTIVATE | GO_DYNFLAG_LO_SPARKLE | GO_DYNFLAG_LO_HIGHLIGHT; if (gameObject->GetGoStateFor(receiver->GetGUID()) == GO_STATE_ACTIVE) dynFlags |= GO_DYNFLAG_LO_DEPLETED; diff --git a/src/server/game/Entities/Player/CollectionMgr.cpp b/src/server/game/Entities/Player/CollectionMgr.cpp index 2089afdcb86..e54e0b88d05 100644 --- a/src/server/game/Entities/Player/CollectionMgr.cpp +++ b/src/server/game/Entities/Player/CollectionMgr.cpp @@ -391,12 +391,8 @@ bool CollectionMgr::AddMount(uint32 spellId, MountStatusFlags flags, bool factio _mounts.insert(MountContainer::value_type(spellId, flags)); // Mount condition only applies to using it, should still learn it. - if (mount->PlayerConditionID) - { - PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(mount->PlayerConditionID); - if (playerCondition && !ConditionMgr::IsPlayerMeetingCondition(player, playerCondition)) - return false; - } + if (!ConditionMgr::IsPlayerMeetingCondition(player, mount->PlayerConditionID)) + return false; if (!learned) { diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 5b8c848c95d..49ce1431de5 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -6928,10 +6928,8 @@ void Player::SendCurrencies() const continue; // Check award condition - if (currency->AwardConditionID) - if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(currency->AwardConditionID)) - if (!ConditionMgr::IsPlayerMeetingCondition(this, playerCondition)) - continue; + if (!ConditionMgr::IsPlayerMeetingCondition(this, currency->AwardConditionID)) + continue; WorldPackets::Misc::SetupCurrency::Record record; record.Type = currency->ID; @@ -6997,10 +6995,8 @@ void Player::ModifyCurrency(uint32 id, int32 amount, CurrencyGainSource gainSour return; // Check award condition - if (currency->AwardConditionID) - if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(currency->AwardConditionID)) - if (!ConditionMgr::IsPlayerMeetingCondition(this, playerCondition)) - return; + if (!ConditionMgr::IsPlayerMeetingCondition(this, currency->AwardConditionID)) + return; bool isGainOnRefund = [&]() -> bool { @@ -8038,7 +8034,7 @@ void Player::_ApplyWeaponDamage(uint8 slot, Item* item, bool apply) // { // float average = extraDPS * proto->GetDelay() / 1000.0f; // float mod = ssv->isTwoHand(proto->GetScalingStatValue()) ? 0.2f : 0.3f; - // + // // minDamage = (1.0f - mod) * average; // maxDamage = (1.0f + mod) * average; // } @@ -15025,9 +15021,8 @@ void Player::RewardQuest(Quest const* quest, LootItemType rewardType, uint32 rew { for (QuestRewardDisplaySpell displaySpell : quest->RewardDisplaySpell) { - if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(displaySpell.PlayerConditionId)) - if (!ConditionMgr::IsPlayerMeetingCondition(this, playerCondition)) - continue; + if (!ConditionMgr::IsPlayerMeetingCondition(this, displaySpell.PlayerConditionId)) + continue; SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(displaySpell.SpellId, GetMap()->GetDifficultyID()); Unit* caster = this; @@ -19324,7 +19319,7 @@ bool Player::Satisfy(AccessRequirement const* ar, uint32 target_map, TransferAbo { for (auto&& itr : *mapDifficultyConditions) { - if (!ConditionMgr::IsPlayerMeetingCondition(this, itr.second)) + if (!ConditionMgr::IsPlayerMeetingCondition(this, itr.second->ID)) { failedMapDifficultyXCondition = itr.first; break; @@ -22678,13 +22673,10 @@ bool Player::BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uin return false; } - if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(crItem->PlayerConditionId)) + if (!ConditionMgr::IsPlayerMeetingCondition(this, crItem->PlayerConditionId)) { - if (!ConditionMgr::IsPlayerMeetingCondition(this, playerCondition)) - { - SendEquipError(EQUIP_ERR_ITEM_LOCKED, nullptr, nullptr); - return false; - } + SendEquipError(EQUIP_ERR_ITEM_LOCKED, nullptr, nullptr); + return false; } // check current item amount if it limited @@ -28866,11 +28858,7 @@ void Player::SendPlayerChoice(ObjectGuid sender, int32 choiceId) bool Player::MeetPlayerCondition(uint32 conditionId) const { - if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(conditionId)) - if (!ConditionMgr::IsPlayerMeetingCondition(this, playerCondition)) - return false; - - return true; + return ConditionMgr::IsPlayerMeetingCondition(this, conditionId); } bool Player::IsInFriendlyArea() const @@ -29373,8 +29361,7 @@ uint8 Player::GetItemLimitCategoryQuantity(ItemLimitCategoryEntry const* limitEn { for (ItemLimitCategoryConditionEntry const* limitCondition : *limitConditions) { - PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(limitCondition->PlayerConditionID); - if (!playerCondition || ConditionMgr::IsPlayerMeetingCondition(this, playerCondition)) + if (ConditionMgr::IsPlayerMeetingCondition(this, limitCondition->PlayerConditionID)) limit += limitCondition->AddQuantity; } } diff --git a/src/server/game/Entities/Taxi/TaxiPathGraph.cpp b/src/server/game/Entities/Taxi/TaxiPathGraph.cpp index a5395bbdc68..2885a4341ac 100644 --- a/src/server/game/Entities/Taxi/TaxiPathGraph.cpp +++ b/src/server/game/Entities/Taxi/TaxiPathGraph.cpp @@ -46,9 +46,8 @@ struct EdgeCost if (!isVisibleForFaction) return std::numeric_limits<uint16>::max(); - if (PlayerConditionEntry const* condition = sPlayerConditionStore.LookupEntry(To->ConditionID)) - if (!sConditionMgr->IsPlayerMeetingCondition(player, condition)) - return std::numeric_limits<uint16>::max(); + if (!ConditionMgr::IsPlayerMeetingCondition(player, To->ConditionID)) + return std::numeric_limits<uint16>::max(); return Distance; } diff --git a/src/server/game/Entities/Unit/Vignette.cpp b/src/server/game/Entities/Unit/Vignette.cpp index 1f4aa074ea2..5b3953c7d7f 100644 --- a/src/server/game/Entities/Unit/Vignette.cpp +++ b/src/server/game/Entities/Unit/Vignette.cpp @@ -119,9 +119,8 @@ bool CanSee(Player const* player, VignetteData const& vignette) if (player->IsQuestRewarded(vignette.Data->VisibleTrackingQuestID)) return false; - if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(vignette.Data->PlayerConditionID)) - if (!ConditionMgr::IsPlayerMeetingCondition(player, playerCondition)) - return false; + if (!ConditionMgr::IsPlayerMeetingCondition(player, vignette.Data->PlayerConditionID)) + return false; return true; } |
