Core/Quests: Fixed selecting quest package rewards

* Also revert 7e9a041470
This commit is contained in:
Shauren
2017-07-02 16:30:02 +02:00
parent 4e6ca8c21b
commit 71a4021f4d
5 changed files with 14 additions and 3 deletions

View File

@@ -0,0 +1,3 @@
UPDATE `quest_template` SET `RewardChoiceItemID1`=0, `RewardChoiceItemQuantity1`=0, `RewardChoiceItemID2`=0, `RewardChoiceItemQuantity2`=0 WHERE `ID`=26799;
UPDATE `quest_template` SET `RewardChoiceItemID1`=0, `RewardChoiceItemQuantity1`=0, `RewardChoiceItemID2`=0, `RewardChoiceItemQuantity2`=0, `RewardChoiceItemID3`=0, `RewardChoiceItemQuantity3`=0 WHERE `ID`=26800;

View File

@@ -212,8 +212,11 @@ void ItemTemplate::GetDamage(uint32 itemLevel, float& minDamage, float& maxDamag
maxDamage = floor(float(avgDamage * (GetStatScalingFactor() * 0.5f + 1.0f) + 0.5f));
}
bool ItemTemplate::IsUsableByLootSpecialization(Player const* player) const
bool ItemTemplate::IsUsableByLootSpecialization(Player const* player, bool alwaysAllowBoundToAccount) const
{
if (GetFlags() & ITEM_FLAG_IS_BOUND_TO_ACCOUNT && alwaysAllowBoundToAccount)
return true;
uint32 spec = player->GetUInt32Value(PLAYER_FIELD_LOOT_SPEC_ID);
if (!spec)
spec = player->GetUInt32Value(PLAYER_FIELD_CURRENT_SPEC_ID);

View File

@@ -803,7 +803,7 @@ struct TC_GAME_API ItemTemplate
char const* GetDefaultLocaleName() const;
uint32 GetArmor(uint32 itemLevel) const;
void GetDamage(uint32 itemLevel, float& minDamage, float& maxDamage) const;
bool IsUsableByLootSpecialization(Player const* player) const;
bool IsUsableByLootSpecialization(Player const* player, bool alwaysAllowBoundToAccount) const;
static std::size_t CalculateItemSpecBit(ChrSpecializationEntry const* spec);
};

View File

@@ -15103,7 +15103,7 @@ bool Player::CanSelectQuestPackageItem(QuestPackageItemEntry const* questPackage
switch (questPackageItem->FilterType)
{
case QUEST_PACKAGE_FILTER_LOOT_SPECIALIZATION:
return rewardProto->IsUsableByLootSpecialization(this);
return rewardProto->IsUsableByLootSpecialization(this, true);
case QUEST_PACKAGE_FILTER_CLASS:
return !rewardProto->ItemSpecClassMask || (rewardProto->ItemSpecClassMask & getClassMask()) != 0;
case QUEST_PACKAGE_FILTER_EVERYONE:

View File

@@ -2902,6 +2902,11 @@ void ObjectMgr::LoadItemTemplates()
}
}
// Items that have no specializations set can be used by everyone
for (auto& specs : itemTemplate.Specializations)
if (specs.count() == 0)
specs.set();
++sparseCount;
}