From aaf3f090ea76da59f9bcc471eadfb9ec9a8f42b5 Mon Sep 17 00:00:00 2001 From: Carbenium Date: Fri, 24 Jul 2015 01:49:34 +0200 Subject: [PATCH] Fix build --- .../Battlegrounds/Zones/BattlegroundSA.cpp | 2 +- src/server/game/DungeonFinding/LFGMgr.cpp | 2 - src/server/game/Entities/Creature/Creature.h | 6 +- src/server/game/Entities/Object/ObjectGuid.h | 43 +++++++++----- src/server/game/Entities/Player/Player.cpp | 59 ------------------- src/server/game/Entities/Player/Player.h | 1 - src/server/game/Entities/Unit/Unit.cpp | 13 +--- src/server/game/Entities/Unit/Unit.h | 2 +- src/server/game/Globals/ObjectMgr.cpp | 15 ++--- src/server/game/Handlers/QueryHandler.cpp | 5 -- src/server/game/Quests/QuestDef.cpp | 23 ++++++++ src/server/game/Server/WorldSession.cpp | 1 - src/server/game/Spells/SpellEffects.cpp | 2 +- src/server/game/Spells/SpellHistory.cpp | 32 ++++++++-- .../scripts/Kalimdor/zone_moonglade.cpp | 3 +- src/server/scripts/Spells/spell_dk.cpp | 11 +--- src/server/scripts/Spells/spell_druid.cpp | 3 +- src/server/scripts/Spells/spell_mage.cpp | 2 +- src/server/scripts/Spells/spell_paladin.cpp | 2 +- src/server/scripts/Spells/spell_rogue.cpp | 16 +---- src/server/scripts/Spells/spell_shaman.cpp | 8 +-- src/server/scripts/Spells/spell_warrior.cpp | 4 +- 22 files changed, 107 insertions(+), 148 deletions(-) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index 81d621439e5..d348d33baad 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -524,7 +524,7 @@ void BattlegroundSA::TeleportToEntrancePosition(Player* player) { if (!ShipsStarted) { - player->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT); + //player->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT); if (urand(0, 1)) player->TeleportTo(607, 2682.936f, -830.368f, 15.0f, 2.895f, 0); diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 92994f6eef6..9a83d79d496 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -429,8 +429,6 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const joinData.result = LFG_JOIN_PARTY_RANDOM_COOLDOWN; else if (plrg->InBattleground() || plrg->InArena() || plrg->InBattlegroundQueue()) joinData.result = LFG_JOIN_USING_BG_SYSTEM; - else if (plrg->HasAura(9454)) // check Freeze debuff - joinData.result = LFG_JOIN_PARTY_NOT_MEET_REQS; ++memberCount; players.insert(plrg->GetGUID()); } diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 45852c4702c..011b41a998b 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -492,7 +492,7 @@ class Creature : public Unit, public GridObject, public MapObject bool HasSpellCooldown(uint32 spell_id) const; bool HasCategoryCooldown(uint32 spell_id) const; uint32 GetCreatureSpellCooldownDelay(uint32 spellId) const; - virtual void ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs) override; + // virtual void ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs) override; bool HasSpell(uint32 spellID) const override; @@ -567,8 +567,8 @@ class Creature : public Unit, public GridObject, public MapObject SpellInfo const* reachWithSpellCure(Unit* victim); uint32 m_spells[CREATURE_MAX_SPELLS]; - CreatureSpellCooldowns m_CreatureSpellCooldowns; - CreatureSpellCooldowns m_CreatureCategoryCooldowns; + //CreatureSpellCooldowns m_CreatureSpellCooldowns; + //CreatureSpellCooldowns m_CreatureCategoryCooldowns; bool CanStartAttack(Unit const* u, bool force) const; float GetAttackDistance(Unit const* player) const; diff --git a/src/server/game/Entities/Object/ObjectGuid.h b/src/server/game/Entities/Object/ObjectGuid.h index 7febc750066..b3ce2f5b30d 100644 --- a/src/server/game/Entities/Object/ObjectGuid.h +++ b/src/server/game/Entities/Object/ObjectGuid.h @@ -90,27 +90,27 @@ class ObjectGuid typedef uint32 LowType; - ObjectGuid() : _guid(0) { } - explicit ObjectGuid(uint64 guid) : _guid(guid) { } - ObjectGuid(HighGuid hi, uint32 entry, LowType counter) : _guid(counter ? uint64(counter) | (uint64(entry) << 24) | (uint64(hi) << 48) : 0) { } - ObjectGuid(HighGuid hi, LowType counter) : _guid(counter ? uint64(counter) | (uint64(hi) << 48) : 0) { } + ObjectGuid() { _data._guid = UI64LIT(0); } + explicit ObjectGuid(uint64 guid) { _data._guid = guid; } + ObjectGuid(HighGuid hi, uint32 entry, uint32 counter) { _data._guid = counter ? uint64(counter) | (uint64(entry) << 32) | (uint64(hi) << ((hi == HIGHGUID_CORPSE || hi == HIGHGUID_AREATRIGGER) ? 48 : 52)) : 0; } + ObjectGuid(HighGuid hi, uint32 counter) { _data._guid = counter ? uint64(counter) | (uint64(hi) << ((hi == HIGHGUID_CORPSE || hi == HIGHGUID_AREATRIGGER) ? 48 : 52)) : 0; } - operator uint64() const { return _guid; } + operator uint64() const { return _data._guid; } PackedGuidReader ReadAsPacked() { return PackedGuidReader(*this); } - void Set(uint64 guid) { _guid = guid; } - void Clear() { _guid = 0; } + void Set(uint64 guid) { _data._guid = guid; } + void Clear() { _data._guid = 0; } PackedGuid WriteAsPacked() const; - uint64 GetRawValue() const { return _guid; } - HighGuid GetHigh() const { return HighGuid((_guid >> 48) & 0x0000FFFF); } - uint32 GetEntry() const { return HasEntry() ? uint32((_guid >> 24) & UI64LIT(0x0000000000FFFFFF)) : 0; } + uint64 GetRawValue() const { return _data._guid; } + HighGuid GetHigh() const { return HighGuid((_data._guid >> 48) & 0x0000FFFF); } + uint32 GetEntry() const { return HasEntry() ? uint32((_data._guid >> 24) & UI64LIT(0x0000000000FFFFFF)) : 0; } LowType GetCounter() const { return HasEntry() - ? LowType(_guid & UI64LIT(0x0000000000FFFFFF)) - : LowType(_guid & UI64LIT(0x00000000FFFFFFFF)); + ? LowType(_data._guid & UI64LIT(0x0000000000FFFFFF)) + : LowType(_data._guid & UI64LIT(0x00000000FFFFFFFF)); } static uint32 GetMaxCounter(HighGuid high) @@ -122,7 +122,7 @@ class ObjectGuid uint32 GetMaxCounter() const { return GetMaxCounter(GetHigh()); } - bool IsEmpty() const { return _guid == 0; } + bool IsEmpty() const { return _data._guid == 0; } bool IsCreature() const { return GetHigh() == HIGHGUID_UNIT; } bool IsPet() const { return GetHigh() == HIGHGUID_PET; } bool IsVehicle() const { return GetHigh() == HIGHGUID_VEHICLE; } @@ -174,6 +174,17 @@ class ObjectGuid bool operator== (ObjectGuid const& guid) const { return GetRawValue() == guid.GetRawValue(); } bool operator!= (ObjectGuid const& guid) const { return GetRawValue() != guid.GetRawValue(); } bool operator< (ObjectGuid const& guid) const { return GetRawValue() < guid.GetRawValue(); } + uint8& operator[] (uint32 index) + { + ASSERT(index < sizeof(uint64)); + return _data._bytes[index]; + } + + uint8 const& operator[](uint32 index) const + { + ASSERT(index < sizeof(uint64)); + return _data._bytes[index]; + } static char const* GetTypeName(HighGuid high); char const* GetTypeName() const { return !IsEmpty() ? GetTypeName(GetHigh()) : "None"; } @@ -208,7 +219,11 @@ class ObjectGuid ObjectGuid(HighGuid, uint32, uint64 counter) = delete; // no implementation, used to catch wrong type assignment ObjectGuid(HighGuid, uint64 counter) = delete; // no implementation, used to catch wrong type assignment - uint64 _guid; + union + { + uint64 _guid; + uint8 _bytes[sizeof(uint64)]; + } _data; }; // Some Shared defines diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 21927486e38..1b7241a6054 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -22273,32 +22273,6 @@ void Player::UpdatePvP(bool state, bool _override) } } - // Apply SPELL_AURA_MOD_SPELL_CATEGORY_COOLDOWN modifiers - // Note: This aura applies its modifiers to all cooldowns of spells with set category, not to category cooldown only - if (cat) - { - if (int32 categoryModifier = GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_SPELL_CATEGORY_COOLDOWN, cat)) - { - if (rec > 0) - rec += categoryModifier; - - if (catrec > 0) - catrec += categoryModifier; - } - - SpellCategoryEntry const* categoryEntry = sSpellCategoryStore.LookupEntry(cat); - ASSERT(categoryEntry); - if (categoryEntry->Flags & SPELL_CATEGORY_FLAG_COOLDOWN_EXPIRES_AT_MIDNIGHT) - { - tm date; - localtime_r(&curTime, &date); - catrec = catrec * DAY - (date.tm_hour * HOUR + date.tm_min * MINUTE + date.tm_sec) * IN_MILLISECONDS; - } - } - - - if (catrec < 0) - catrec = 0; void Player::UpdatePotionCooldown(Spell* spell) { // no potion used i combat or still in combat @@ -26240,39 +26214,6 @@ void Player::RemoveAtLoginFlag(AtLoginFlags flags, bool persist /*= false*/) } } -void Player::SendClearAllCooldowns(Unit* target) -{ - uint32 spellCount = m_spellCooldowns.size(); - ObjectGuid guid = target ? target->GetGUID() : ObjectGuid::Empty; - - WorldPacket data(SMSG_CLEAR_COOLDOWNS, 4+8); - data.WriteBit(guid[1]); - data.WriteBit(guid[3]); - data.WriteBit(guid[6]); - data.WriteBits(spellCount, 24); // Spell Count - data.WriteBit(guid[7]); - data.WriteBit(guid[5]); - data.WriteBit(guid[2]); - data.WriteBit(guid[4]); - data.WriteBit(guid[0]); - - data.FlushBits(); - - data.WriteByteSeq(guid[7]); - data.WriteByteSeq(guid[2]); - data.WriteByteSeq(guid[4]); - data.WriteByteSeq(guid[5]); - data.WriteByteSeq(guid[1]); - data.WriteByteSeq(guid[3]); - for (SpellCooldowns::const_iterator itr = m_spellCooldowns.begin(); itr != m_spellCooldowns.end(); ++itr) - data << uint32(itr->first); // Spell ID - - data.WriteByteSeq(guid[0]); - data.WriteByteSeq(guid[6]); - - SendDirectMessage(&data); -} - void Player::ResetMap() { // this may be called during Map::Update diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 1e84348c049..8df74235487 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1860,7 +1860,6 @@ class Player : public Unit, public GridObject void DropModCharge(SpellModifier* mod, Spell* spell); void SetSpellModTakingSpell(Spell* spell, bool apply); - void SendClearAllCooldowns(Unit* target); void RemoveArenaSpellCooldowns(bool removeActivePetCooldowns = false); uint32 GetLastPotionId() { return m_lastPotionId; } void SetLastPotionId(uint32 item_id) { m_lastPotionId = item_id; } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index d33383fe6bb..51ddebea5c4 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -1706,12 +1706,6 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe { // We're going to call functions which can modify content of the list during iteration over it's elements // Let's copy the list so we can prevent iterator invalidation - // check if caster is immune to damage - if (caster->IsImmunedToDamage(schoolMask)) - { - victim->SendSpellMiss(caster, (*itr)->GetSpellInfo()->Id, SPELL_MISS_IMMUNE); - continue; - } AuraEffectList vSplitDamagePctCopy(victim->GetAuraEffectsByType(SPELL_AURA_SPLIT_DAMAGE_PCT)); for (AuraEffectList::iterator itr = vSplitDamagePctCopy.begin(); itr != vSplitDamagePctCopy.end() && dmgInfo.GetDamage() > 0; ++itr) @@ -5042,7 +5036,7 @@ bool Unit::HandleAuraProcOnPowerAmount(Unit* victim, uint32 /*damage*/, AuraEffe } } - if (cooldown && GetTypeId() == TYPEID_PLAYER && ToPlayer()->HasSpellCooldown(trigger_spell_id)) + if (cooldown && GetTypeId() == TYPEID_PLAYER && ToPlayer()->GetSpellHistory()->HasCooldown(trigger_spell_id)) return false; // try detect target manually if not set @@ -5055,7 +5049,7 @@ bool Unit::HandleAuraProcOnPowerAmount(Unit* victim, uint32 /*damage*/, AuraEffe CastSpell(target, trigger_spell_id, true, castItem, triggeredByAura); if (cooldown && GetTypeId() == TYPEID_PLAYER) - ToPlayer()->AddSpellCooldown(trigger_spell_id, 0, time(NULL) + cooldown); + ToPlayer()->GetSpellHistory()->AddCooldown(trigger_spell_id, 0, std::chrono::seconds(cooldown)); return true; } @@ -7075,9 +7069,6 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg } break; } - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); - return spellInfo && spellInfo->GetCategory() == 1209; - }, true); // Maelstrom Weapon case 53817: { diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 3daab47da34..7dde0bb05de 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1587,7 +1587,7 @@ class Unit : public WorldObject bool SetDisableGravity(bool disable, bool packetOnly = false); bool SetFall(bool enable); bool SetSwim(bool enable); - bool SetCanFly(bool enable); + bool SetCanFly(bool enable, bool packetOnly = false); bool SetWaterWalking(bool enable, bool packetOnly = false); bool SetFeatherFall(bool enable, bool packetOnly = false); bool SetHover(bool enable, bool packetOnly = false); diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index b4057465959..4d0eb8d5da2 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -546,10 +546,6 @@ void ObjectMgr::LoadCreatureTemplate(Field* fields) creatureTemplate.ModDamage = fields[71].GetFloat(); creatureTemplate.ModExperience = fields[72].GetFloat(); creatureTemplate.RacialLeader = fields[73].GetBool(); - - creatureTemplate.movementId = fields[70].GetUInt32(); - creatureTemplate.questItems[i] = fields[74 + i].GetUInt32(); - creatureTemplate.movementId = fields[80].GetUInt32(); creatureTemplate.RegenHealth = fields[81].GetBool(); creatureTemplate.MechanicImmuneMask = fields[82].GetUInt32(); @@ -6751,15 +6747,12 @@ void ObjectMgr::LoadGameObjectTemplate() got.flags = fields[8].GetUInt32(); got.size = fields[9].GetFloat(); - for (uint8 i = 0; i < MAX_GAMEOBJECT_QUEST_ITEMS; ++i) - got.questItems[i] = fields[10 + i].GetUInt32(); - for (uint8 i = 0; i < MAX_GAMEOBJECT_DATA; ++i) - got.raw.data[i] = fields[16 + i].GetUInt32(); + got.raw.data[i] = fields[10 + i].GetUInt32(); - got.unkInt32 = fields[48].GetInt32(); - got.AIName = fields[49].GetString(); - got.ScriptId = GetScriptId(fields[50].GetCString()); + got.unkInt32 = fields[42].GetInt32(); + got.AIName = fields[43].GetString(); + got.ScriptId = GetScriptId(fields[44].GetCString()); // Checks diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp index 206cef98cdc..4aee0e9e178 100644 --- a/src/server/game/Handlers/QueryHandler.cpp +++ b/src/server/game/Handlers/QueryHandler.cpp @@ -143,10 +143,6 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket& recvData) data << float(creatureInfo->ModHealth); // dmg/hp modifier data << float(creatureInfo->ModMana); // dmg/mana modifier data << uint8(creatureInfo->RacialLeader); // RacialLeader - - for (uint8 i = 0; i < MAX_CREATURE_QUEST_ITEMS; ++i) - data << uint32(creatureInfo->questItems[i]); // itemId[6], quest drop - data << uint32(creatureInfo->movementId); // CreatureMovementInfo.dbc data << uint32(creatureInfo->expansionUnknown); // unknown meaning @@ -208,7 +204,6 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket& recvData) data.append(info->raw.data, MAX_GAMEOBJECT_DATA); data << float(info->size); // go size - data << uint32(info->questItems[i]); // itemId[6], quest drop data << int32(info->unkInt32); // 4.x, unknown SendPacket(&data); TC_LOG_DEBUG("network", "WORLD: Sent SMSG_GAMEOBJECT_QUERY_RESPONSE"); diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp index 50f996ab05f..1818ae245a1 100644 --- a/src/server/game/Quests/QuestDef.cpp +++ b/src/server/game/Quests/QuestDef.cpp @@ -199,6 +199,29 @@ Quest::Quest(Field* questRecord) ++_reqCurrencyCount; } +void Quest::LoadQuestTemplateAddon(Field* fields) +{ + MaxLevel = fields[1].GetUInt8(); + RequiredClasses = fields[2].GetUInt32(); + SourceSpellid = fields[3].GetUInt32(); + PrevQuestId = fields[4].GetInt32(); + NextQuestId = fields[5].GetInt32(); + ExclusiveGroup = fields[6].GetInt32(); + RewardMailTemplateId = fields[7].GetUInt32(); + RewardMailDelay = fields[8].GetUInt32(); + RequiredSkillId = fields[9].GetUInt16(); + RequiredSkillPoints = fields[10].GetUInt16(); + RequiredMinRepFaction = fields[11].GetUInt16(); + RequiredMaxRepFaction = fields[12].GetUInt16(); + RequiredMinRepValue = fields[13].GetInt32(); + RequiredMaxRepValue = fields[14].GetInt32(); + SourceItemIdCount = fields[15].GetUInt8(); + SpecialFlags = fields[16].GetUInt8(); + + if (SpecialFlags & QUEST_SPECIAL_FLAGS_AUTO_ACCEPT) + Flags |= QUEST_FLAGS_AUTO_ACCEPT; +} + uint32 Quest::XPValue(Player* player) const { if (player) diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index d6f6f6e1342..c6bda4d5d1f 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -1343,7 +1343,6 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co case MSG_RANDOM_ROLL: // not profiled case CMSG_TIME_SYNC_RESP: // not profiled case CMSG_TRAINER_BUY_SPELL: // not profiled - case CMSG_FORCE_RUN_SPEED_CHANGE_ACK: // not profiled { // "0" is a magic number meaning there's no limit for the opcode. // All the opcodes above must cause little CPU usage and no sync/async database queries at all diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 1ecd3b291a1..86b83634cc9 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -3931,7 +3931,7 @@ void Spell::EffectStuck(SpellEffIndex /*effIndex*/) } // the player dies if hearthstone is in cooldown, else the player is teleported to home - if (player->HasSpellCooldown(8690)) + if (player->GetSpellHistory()->HasCooldown(8690)) { player->Kill(player); return; diff --git a/src/server/game/Spells/SpellHistory.cpp b/src/server/game/Spells/SpellHistory.cpp index 09e3be690b1..b4b746877c0 100644 --- a/src/server/game/Spells/SpellHistory.cpp +++ b/src/server/game/Spells/SpellHistory.cpp @@ -606,13 +606,33 @@ void SpellHistory::SendClearCooldowns(std::vector const& cooldowns) const { if (Player* playerOwner = GetPlayerOwner()) { + ObjectGuid guid = playerOwner->GetGUID(); + WorldPacket data(SMSG_CLEAR_COOLDOWNS, 4 + 8); + data.WriteBit(guid[1]); + data.WriteBit(guid[3]); + data.WriteBit(guid[6]); + data.WriteBits(cooldowns.size(), 24); // Spell Count + data.WriteBit(guid[7]); + data.WriteBit(guid[5]); + data.WriteBit(guid[2]); + data.WriteBit(guid[4]); + data.WriteBit(guid[0]); + + data.FlushBits(); + + data.WriteByteSeq(guid[7]); + data.WriteByteSeq(guid[2]); + data.WriteByteSeq(guid[4]); + data.WriteByteSeq(guid[5]); + data.WriteByteSeq(guid[1]); + data.WriteByteSeq(guid[3]); for (int32 spell : cooldowns) - { - WorldPacket data(SMSG_CLEAR_COOLDOWN, 4 + 8); - data << uint32(spell); - data << uint64(_owner->GetGUID()); - playerOwner->SendDirectMessage(&data); - } + data << uint32(spell); // Spell ID + + data.WriteByteSeq(guid[0]); + data.WriteByteSeq(guid[6]); + + playerOwner->SendDirectMessage(&data); } } diff --git a/src/server/scripts/Kalimdor/zone_moonglade.cpp b/src/server/scripts/Kalimdor/zone_moonglade.cpp index 5f6c63bd506..944948a1453 100644 --- a/src/server/scripts/Kalimdor/zone_moonglade.cpp +++ b/src/server/scripts/Kalimdor/zone_moonglade.cpp @@ -26,8 +26,7 @@ #include "Cell.h" #include "CellImpl.h" - me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + /*#### # npc_omen ####*/ diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 86cf61183b2..a176bbf60f5 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -25,6 +25,7 @@ #include "ScriptMgr.h" #include "SpellScript.h" #include "SpellAuraEffects.h" +#include "SpellHistory.h" #include "Containers.h" enum DeathKnightSpells @@ -1527,7 +1528,7 @@ class spell_dk_will_of_the_necropolis : public SpellScriptLoader { //! HACK due to currenct proc system implementation if (Player* player = GetTarget()->ToPlayer()) - if (player->HasSpellCooldown(GetId())) + if (player->GetSpellHistory()->HasCooldown(GetId())) return false; return GetTarget()->HealthBelowPctDamaged(30, eventInfo.GetDamageInfo()->GetDamage()); @@ -1535,13 +1536,7 @@ class spell_dk_will_of_the_necropolis : public SpellScriptLoader void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) { - GetTarget()->CastSpell(GetTarget(), SPELL_DK_WILL_OF_THE_NECROPOLIS, true, NULL, aurEff); - - if (Player* player = GetTarget()->ToPlayer()) - { - player->RemoveSpellCooldown(SPELL_DK_RUNE_TAP, true); - player->AddSpellCooldown(GetId(), 0, time(NULL) + 45); - } + GetTarget()->CastSpell(GetTarget(), SPELL_DK_WILL_OF_THE_NECROPOLIS, true, nullptr, aurEff); } void Register() override diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 47e45772559..3b20b6fe6b7 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -25,6 +25,7 @@ #include "ScriptMgr.h" #include "SpellScript.h" #include "SpellAuraEffects.h" +#include "SpellHistory.h" #include "Containers.h" enum DruidSpells @@ -123,7 +124,7 @@ class spell_dru_eclipse : public SpellScriptLoader return; if (caster->ToPlayer()->GetAuraOfRankedSpell(SPELL_DRUID_NATURES_GRACE)) - caster->ToPlayer()->RemoveSpellCooldown(SPELL_DRUID_NATURES_GRACE_TRIGGER, true); + caster->ToPlayer()->GetSpellHistory()->ResetCooldown(SPELL_DRUID_NATURES_GRACE_TRIGGER, true); } void Register() override diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index 2d344b32750..6dd9222afc9 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -632,7 +632,7 @@ class spell_mage_glyph_of_ice_block : public SpellScriptLoader { PreventDefaultAction(); // Remove Frost Nova cooldown - GetTarget()->ToPlayer()->RemoveSpellCooldown(SPELL_MAGE_FROST_NOVA, true); + GetTarget()->ToPlayer()->GetSpellHistory()->ResetCooldown(SPELL_MAGE_FROST_NOVA, true); } void Register() override diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 6d19ef8e4cf..07d14153c82 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -657,7 +657,7 @@ class spell_pal_grand_crusader : public SpellScriptLoader void HandleEffectProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/) { - GetTarget()->ToPlayer()->RemoveSpellCooldown(SPELL_PALADIN_AVENGERS_SHIELD, true); + GetTarget()->ToPlayer()->GetSpellHistory()->ResetCooldown(SPELL_PALADIN_AVENGERS_SHIELD, true); } void Register() override diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index cf36ed78d03..028b70586e2 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -611,22 +611,12 @@ class spell_rog_preparation : public SpellScriptLoader if (spellInfo->SpellFamilyName != SPELLFAMILY_ROGUE) return false; - return (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_COLDB_SHADOWSTEP || // Cold Blood, Shadowstep - spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_VAN_EVAS_SPRINT) || // Vanish, Evasion, Sprint - (caster->HasAura(SPELL_ROGUE_GLYPH_OF_PREPARATION) && - (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_DISMANTLE || // Dismantle - spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_KICK || // Kick - (spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_BLADE_FLURRY && // Blade Flurry - spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_BLADE_FLURRY))); - }, true); - continue; - spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG0_ROGUE_VAN_SPRINT) || // Vanish, Sprint + return (spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG0_ROGUE_VAN_SPRINT) || // Vanish, Sprint // Glyph of Preparation (caster->HasAura(SPELL_ROGUE_GLYPH_OF_PREPARATION) && (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_DISMANTLE_SMOKE_BOMB || // Dismantle, Smoke Bomb - spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG0_ROGUE_KICK))) // Kick - { - caster->RemoveSpellCooldown((itr++)->first, true); + spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG0_ROGUE_KICK)); + }, true); } void Register() override diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index 3adf916166e..0d62da71069 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -463,7 +463,7 @@ class spell_sha_feedback : public SpellScriptLoader { PreventDefaultAction(); // will prevent default effect execution if (Player* target = GetTarget()->ToPlayer()) - target->ModifySpellCooldown(SPELL_SHAMAN_ELEMENTAL_MASTERY, aurEff->GetBaseAmount()); + target->GetSpellHistory()->ModifyCooldown(SPELL_SHAMAN_ELEMENTAL_MASTERY, aurEff->GetBaseAmount()); } void Register() override @@ -988,7 +988,7 @@ class spell_sha_lava_surge_proc : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { - GetCaster()->ToPlayer()->RemoveSpellCooldown(SPELL_SHAMAN_LAVA_BURST, true); + GetCaster()->ToPlayer()->GetSpellHistory()->ResetCooldown(SPELL_SHAMAN_LAVA_BURST, true); } void Register() override @@ -1056,7 +1056,7 @@ class spell_sha_nature_guardian : public SpellScriptLoader { //! HACK due to currenct proc system implementation if (Player* player = GetTarget()->ToPlayer()) - if (player->HasSpellCooldown(GetSpellInfo()->Id)) + if (player->GetSpellHistory()->HasCooldown(GetSpellInfo()->Id)) return false; return GetTarget()->HealthBelowPctDamaged(30, eventInfo.GetDamageInfo()->GetDamage()); @@ -1073,7 +1073,7 @@ class spell_sha_nature_guardian : public SpellScriptLoader eventInfo.GetProcTarget()->getThreatManager().modifyThreatPercent(GetTarget(), -10); if (Player* player = GetTarget()->ToPlayer()) - player->AddSpellCooldown(GetSpellInfo()->Id, 0, time(NULL) + aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()); + player->GetSpellHistory()->AddCooldown(GetSpellInfo()->Id, 0, std::chrono::seconds(GetSpellInfo()->Effects[EFFECT_1].CalcValue())); } void Register() override diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index f5497d29105..785c29d5dda 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -815,7 +815,7 @@ class spell_warr_sudden_death : public SpellScriptLoader { // Remove cooldown on Colossus Smash if (Player* player = GetTarget()->ToPlayer()) - player->RemoveSpellCooldown(SPELL_WARRIOR_COLOSSUS_SMASH, true); + player->GetSpellHistory()->ResetCooldown(SPELL_WARRIOR_COLOSSUS_SMASH, true); } void Register() override @@ -917,7 +917,7 @@ class spell_warr_sword_and_board : public SpellScriptLoader { // Remove cooldown on Shield Slam if (Player* player = GetTarget()->ToPlayer()) - player->RemoveSpellCooldown(SPELL_WARRIOR_SHIELD_SLAM, true); + player->GetSpellHistory()->ResetCooldown(SPELL_WARRIOR_SHIELD_SLAM, true); } void Register() override