diff options
Diffstat (limited to 'src/server/scripts/World')
| -rw-r--r-- | src/server/scripts/World/npcs_special.cpp | 57 |
1 files changed, 25 insertions, 32 deletions
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 93010f06283..d1d2ddc8a80 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -53,6 +53,7 @@ EndContentData */ #include "GridNotifiersImpl.h" #include "Cell.h" #include "CellImpl.h" +#include "SpellHistory.h" #include "SpellAuras.h" #include "Pet.h" #include "CreatureTextMgr.h" @@ -1214,14 +1215,14 @@ public: if (creature->IsQuestGiver()) player->PrepareQuestMenu(creature->GetGUID()); - if (player->HasSpellCooldown(SPELL_INT) || - player->HasSpellCooldown(SPELL_ARM) || - player->HasSpellCooldown(SPELL_DMG) || - player->HasSpellCooldown(SPELL_RES) || - player->HasSpellCooldown(SPELL_STR) || - player->HasSpellCooldown(SPELL_AGI) || - player->HasSpellCooldown(SPELL_STM) || - player->HasSpellCooldown(SPELL_SPI)) + if (player->GetSpellHistory()->HasCooldown(SPELL_INT) || + player->GetSpellHistory()->HasCooldown(SPELL_ARM) || + player->GetSpellHistory()->HasCooldown(SPELL_DMG) || + player->GetSpellHistory()->HasCooldown(SPELL_RES) || + player->GetSpellHistory()->HasCooldown(SPELL_STR) || + player->GetSpellHistory()->HasCooldown(SPELL_AGI) || + player->GetSpellHistory()->HasCooldown(SPELL_STM) || + player->GetSpellHistory()->HasCooldown(SPELL_SPI)) player->SEND_GOSSIP_MENU(7393, creature->GetGUID()); else { @@ -1281,52 +1282,44 @@ public: bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) override { player->PlayerTalkClass->ClearMenus(); + uint32 spellId = 0; switch (sender) { case GOSSIP_SENDER_MAIN: SendAction(player, creature, action); break; case GOSSIP_SENDER_MAIN + 1: - creature->CastSpell(player, SPELL_DMG, false); - player->AddSpellCooldown(SPELL_DMG, 0, time(NULL) + 7200); - SendAction(player, creature, action); + spellId = SPELL_DMG; break; case GOSSIP_SENDER_MAIN + 2: - creature->CastSpell(player, SPELL_RES, false); - player->AddSpellCooldown(SPELL_RES, 0, time(NULL) + 7200); - SendAction(player, creature, action); + spellId = SPELL_RES; break; case GOSSIP_SENDER_MAIN + 3: - creature->CastSpell(player, SPELL_ARM, false); - player->AddSpellCooldown(SPELL_ARM, 0, time(NULL) + 7200); - SendAction(player, creature, action); + spellId = SPELL_ARM; break; case GOSSIP_SENDER_MAIN + 4: - creature->CastSpell(player, SPELL_SPI, false); - player->AddSpellCooldown(SPELL_SPI, 0, time(NULL) + 7200); - SendAction(player, creature, action); + spellId = SPELL_SPI; break; case GOSSIP_SENDER_MAIN + 5: - creature->CastSpell(player, SPELL_INT, false); - player->AddSpellCooldown(SPELL_INT, 0, time(NULL) + 7200); - SendAction(player, creature, action); + spellId = SPELL_INT; break; case GOSSIP_SENDER_MAIN + 6: - creature->CastSpell(player, SPELL_STM, false); - player->AddSpellCooldown(SPELL_STM, 0, time(NULL) + 7200); - SendAction(player, creature, action); + spellId = SPELL_STM; break; case GOSSIP_SENDER_MAIN + 7: - creature->CastSpell(player, SPELL_STR, false); - player->AddSpellCooldown(SPELL_STR, 0, time(NULL) + 7200); - SendAction(player, creature, action); + spellId = SPELL_STR; break; case GOSSIP_SENDER_MAIN + 8: - creature->CastSpell(player, SPELL_AGI, false); - player->AddSpellCooldown(SPELL_AGI, 0, time(NULL) + 7200); - SendAction(player, creature, action); + spellId = SPELL_AGI; break; } + + if (spellId) + { + creature->CastSpell(player, spellId, false); + player->GetSpellHistory()->AddCooldown(spellId, 0, std::chrono::hours(2)); + SendAction(player, creature, action); + } return true; } }; |
