Core/Spells: fixed cooldowns of weekly profession spells. The cooldown will now start by the time the item gets created and lasts for a whole week

This commit is contained in:
Ovahlord committed 2019-08-18 00:29:05 +02:00
1 parent e8e5e05b0a
commit 53e99dbb85
5 files changed
+30 -3

No files matched your search

+9 -1
View File
@@ -350,7 +350,15 @@ void SpellHistory::StartCooldown(SpellInfo const* spellInfo, uint32 itemId, Spel
SpellCategoryEntry const* categoryEntry = sSpellCategoryStore.AssertEntry(categoryId);
if (categoryEntry->Flags & SPELL_CATEGORY_FLAG_COOLDOWN_EXPIRES_AT_DAILY_RESET)
categoryCooldown = int32(std::chrono::duration_cast<std::chrono::milliseconds>(Clock::from_time_t(sWorld->GetNextDailyQuestsResetTime()) - Clock::now()).count());
{
uint32 parentCategoryId = GetParentSpellCategoryId(categoryEntry->Id);
SpellCategoryEntry const* parentCategory = sSpellCategoryStore.LookupEntry(parentCategoryId);
if (parentCategory && parentCategory->UsesPerWeek)
categoryCooldown = WEEK * IN_MILLISECONDS;
else
categoryCooldown = int32(std::chrono::duration_cast<std::chrono::milliseconds>(Clock::from_time_t(sWorld->GetNextDailyQuestsResetTime()) - Clock::now()).count());
}
}
// replace negative cooldowns by 0