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
2019-08-18 00:29:05 +02:00
parent e8e5e05b0a
commit 53e99dbb85
5 changed files with 30 additions and 3 deletions

View File

@@ -1305,6 +1305,23 @@ EmotesTextSoundEntry const* FindTextSoundEmoteFor(uint32 emote, uint32 race, uin
return itr != sEmotesTextSoundMap.end() ? itr->second : nullptr;
}
uint32 GetParentSpellCategoryId(uint32 childCategory)
{
// Weekly profession reset linking
switch (childCategory)
{
case 1278: // Dream of Skywall
case 1279: // Dream of Azshara
case 1280: // Dream of Ragnaros
case 1281: // Dream of Deepholm
case 1282: // Dream of Hyjal
return 1328;
default:
return 0;
}
return 0;
}
bool IsInArea(uint32 objectAreaId, uint32 areaId)
{
do

View File

@@ -89,6 +89,8 @@ TC_GAME_API ResponseCodes ValidateName(std::wstring const& name, LocaleConstant
TC_GAME_API EmotesTextSoundEntry const* FindTextSoundEmoteFor(uint32 emote, uint32 race, uint32 gender);
TC_GAME_API uint32 GetParentSpellCategoryId(uint32 childCategory);
TC_GAME_API extern DBCStorage <AchievementEntry> sAchievementStore;
TC_GAME_API extern DBCStorage <AnimKitEntry> sAnimKitStore;
TC_GAME_API extern DBCStorage <AchievementCriteriaEntry> sAchievementCriteriaStore;

View File

@@ -2151,7 +2151,7 @@ struct SpellCategoryEntry
{
uint32 Id;
uint32 Flags;
// uint32 unk;
uint32 UsesPerWeek;
// char* Name;
};

View File

@@ -140,7 +140,7 @@ char const SkillTiersfmt[] = "nxxxxxxxxxxxxxxxxiiiiiiiiiiiiiiii";
char const SoundEntriesfmt[] = "nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
char const SpellCastTimefmt[] = "nixx";
char const SpellCategoriesEntryfmt[] = "diiiiii";
char const SpellCategoryfmt[] = "nixx";
char const SpellCategoryfmt[] = "niix";
char const SpellDifficultyfmt[] = "niiii";
const std::string CustomSpellDifficultyfmt = "ppppp";
const std::string CustomSpellDifficultyIndex = "id";

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