Core/Quests: Fix and enable all quest related opcodes

This commit is contained in:
Nay committed 2012-08-09 00:58:04 +01:00
1 parent 82e19b5d9f
commit 10c9c55700
6 files changed
+140 -231

No files matched your search

+54 -77
View File
@@ -247,100 +247,77 @@ int32 Quest::GetRewOrReqMoney() const
return int32(RewardOrRequiredMoney * sWorld->getRate(RATE_DROP_MONEY));
}
uint32 Quest::GetRewChoiceItemsEffectiveCount() const
{
uint32 count = 0;
for (uint8 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
if (RewardChoiceItemId[i] > 0)
count++;
return count;
}
uint32 Quest::GetRewItemsEffectiveCount() const
{
uint32 count = 0;
for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
if (RewardItemId[i] > 0)
count++;
return count;
}
void Quest::BuildExtraQuestInfo(WorldPacket& data, Player* player) const
{
if (HasFlag(QUEST_FLAGS_HIDDEN_REWARDS))
data << uint32(GetRewChoiceItemsCount());
for (uint8 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
data << uint32(RewardChoiceItemId[i]);
for (uint8 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
data << uint32(RewardChoiceItemCount[i]);
for (uint8 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
{
data << uint32(0); // Rewarded chosen items hidden
data << uint32(0); // Rewarded items hidden
data << uint32(0); // Rewarded money hidden
data << uint32(0); // Rewarded XP hidden
}
else
{
data << uint32(GetRewChoiceItemsEffectiveCount());
for (uint8 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
data << uint32(RewardChoiceItemId[i]);
for (uint8 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
data << uint32(RewardChoiceItemCount[i]);
for (uint8 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
{
if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(RewardChoiceItemId[i]))
data << uint32(itemTemplate->DisplayInfoID);
else
data << uint32(0);
}
data << uint32(GetRewChoiceItemsEffectiveCount());
for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
data << uint32(RewardItemId[i]);
for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
data << uint32(RewardItemIdCount[i]);
for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
{
if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(RewardItemId[i]))
data << uint32(itemTemplate->DisplayInfoID);
else
data << uint32(0);
}
data << uint32(GetRewOrReqMoney());
data << uint32(XPValue(player) * sWorld->getRate(RATE_XP_QUEST));
if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(RewardChoiceItemId[i]))
data << uint32(itemTemplate->DisplayInfoID);
else
data << uint32(0);
}
data << uint32(GetCharTitleId()); // CharTitleId, new 2.4.0, player gets this title (id from CharTitles)
data << uint32(0); // 4.x Unk
data << float(0); // 4.x Unk
data << uint32(GetBonusTalents()); // bonus talents
data << uint32(0); // 4.x Unk
data << uint32(0); // 4.x Unk
data << uint32(GetReqItemsCount());
for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
data << uint32(RewardItemId[i]);
for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
data << uint32(RewardItemIdCount[i]);
for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
{
if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(RewardItemId[i]))
data << uint32(itemTemplate->DisplayInfoID);
else
data << uint32(0);
}
/* These are probably some of the unks above
data << uint32(GetRewOrReqMoney());
data << uint32(XPValue(player) * sWorld->getRate(RATE_XP_QUEST));
data << uint32(GetCharTitleId());
data << uint32(0); // unk
data << float(0.0f); // unk
data << uint32(GetBonusTalents());
data << uint32(0); // unk
data << uint32(GetRewardReputationMask());
/* Pre cata struct, some of these unks might be the missing values in cata:
// rewarded honor points. Multiply with 10 to satisfy client
data << 10 * Trinity::Honor::hk_honor_at_level(_session->GetPlayer()->getLevel(), quest->GetRewHonorMultiplier());
data << float(0.0f); // new 3.3.0, honor multiplier?
data << uint32(quest->GetCharTitleId()); // CharTitleId, new 2.4.0, player gets this title (id from CharTitles) // unk
data << float(0); // unk, honor multiplier?
data << uint32(0x08); // unused by client?
data << uint32(quest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast == 0)
data << int32(quest->GetRewSpellCast()); // casted spell
data << uint32(0); // unknown
data << uint32(quest->GetBonusTalents()); // bonus talents
data << uint32(quest->GetRewArenaPoints()); // arena points
data << uint32(0);
*/
for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward factions ids
data << uint32(RewardFactionId[i]);
for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid in QuestFactionReward.dbc (zero based)?
data << int32(RewardFactionValueId[i]);
for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
data << int32(RewardFactionValueIdOverride[i]);
for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward reputation override?
data << uint32(RewardFactionValueIdOverride[i]);
data << uint32(GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast == 0)
data << int32(GetRewSpellCast()); // casted spell
data << uint32(GetRewSpell());
data << uint32(GetRewSpellCast());
for (uint8 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; i++)
data << uint32(RewardCurrencyId[i]); // 4.x Unk
for (uint8 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; i++)
data << uint32(RewardCurrencyCount[i]); // 4.x Unk
for (uint8 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i)
data << uint32(RewardCurrencyId[i]);
data << uint32(0); // 4.x Unk
data << uint32(0); // 4.x Unk
for (uint8 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i)
data << uint32(RewardCurrencyCount[i]);
data << uint32(GetRewardSkillId());
data << uint32(GetRewardSkillPoints());
}
bool Quest::IsAutoAccept() const