diff options
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 7 | ||||
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 28 | ||||
-rw-r--r-- | src/server/game/Entities/Unit/Unit.h | 4 | ||||
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 6 | ||||
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuras.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Spells/SpellEffects.cpp | 8 | ||||
-rw-r--r-- | src/server/game/Spells/SpellInfo.cpp | 4 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_druid.cpp | 2 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 2 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_priest.cpp | 2 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_rogue.cpp | 4 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_shaman.cpp | 4 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_warlock.cpp | 4 | ||||
-rw-r--r-- | src/server/shared/Utilities/Util.h | 129 |
14 files changed, 106 insertions, 100 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 25bbcc04e29..39b468e729e 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -23523,10 +23523,11 @@ bool Player::CanNoReagentCast(SpellInfo const* spellInfo) const return true; // Check no reagent use mask - flag96 noReagentMask; + flag128 noReagentMask; noReagentMask[0] = GetUInt32Value(PLAYER_NO_REAGENT_COST_1); - noReagentMask[1] = GetUInt32Value(PLAYER_NO_REAGENT_COST_1+1); - noReagentMask[2] = GetUInt32Value(PLAYER_NO_REAGENT_COST_1+2); + noReagentMask[1] = GetUInt32Value(PLAYER_NO_REAGENT_COST_1 + 1); + noReagentMask[2] = GetUInt32Value(PLAYER_NO_REAGENT_COST_1 + 2); + noReagentMask[3] = GetUInt32Value(PLAYER_NO_REAGENT_COST_1 + 3); if (spellInfo->SpellFamilyFlags & noReagentMask) return true; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 659f7d7ad9d..46ef88128cf 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -3787,7 +3787,7 @@ void Unit::RemoveAurasWithInterruptFlags(uint32 flag, uint32 except) UpdateInterruptMask(); } -void Unit::RemoveAurasWithFamily(SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID) +void Unit::RemoveAurasWithFamily(SpellFamilyNames family, flag128 const& familyFlag, ObjectGuid casterGUID) { for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();) { @@ -3795,7 +3795,7 @@ void Unit::RemoveAurasWithFamily(SpellFamilyNames family, uint32 familyFlag1, ui if (!casterGUID || aura->GetCasterGUID() == casterGUID) { SpellInfo const* spell = aura->GetSpellInfo(); - if (spell->SpellFamilyName == uint32(family) && spell->SpellFamilyFlags & flag96(familyFlag1, familyFlag2, familyFlag3)) + if (spell->SpellFamilyName == uint32(family) && spell->SpellFamilyFlags & familyFlag) { RemoveAura(iter); continue; @@ -4051,13 +4051,13 @@ AuraEffect* Unit::GetAuraEffect(AuraType type, SpellFamilyNames name, uint32 ico return NULL; } -AuraEffect* Unit::GetAuraEffect(AuraType type, SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID) const +AuraEffect* Unit::GetAuraEffect(AuraType type, SpellFamilyNames family, flag128 const& familyFlag, ObjectGuid casterGUID) const { AuraEffectList const& auras = GetAuraEffectsByType(type); for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i) { SpellInfo const* spell = (*i)->GetSpellInfo(); - if (spell->SpellFamilyName == uint32(family) && spell->SpellFamilyFlags & flag96(familyFlag1, familyFlag2, familyFlag3)) + if (spell->SpellFamilyName == uint32(family) && spell->SpellFamilyFlags & familyFlag) { if (!casterGUID.IsEmpty() && (*i)->GetCasterGUID() != casterGUID) continue; @@ -5520,7 +5520,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere return false; // try to find spell Rip on the target - if (AuraEffect const* AurEff = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, 0x00800000, 0x0, 0x0, GetGUID())) + if (AuraEffect const* AurEff = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, flag128(0x00800000, 0x0, 0x0), GetGUID())) { // Rip's max duration, note: spells which modifies Rip's duration also counted uint32 CountMin = AurEff->GetBase()->GetMaxDuration(); @@ -6045,7 +6045,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere if (!target) return false; // try to find spell Flame Shock on the target - if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, 0x10000000, 0x0, 0x0, GetGUID())) + if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, flag128(0x10000000, 0x0, 0x0), GetGUID())) { Aura* flameShock = aurEff->GetBase(); int32 maxDuration = flameShock->GetMaxDuration(); @@ -6081,7 +6081,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere if (dummySpell->SpellIconID == 3059) { // Lightning Shield - if (GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_SHAMAN, 0x400, 0, 0)) + if (GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_SHAMAN, flag128(0x400, 0, 0))) { uint32 spell = 26364; @@ -8379,7 +8379,7 @@ float Unit::SpellDamagePctDone(Unit* victim, SpellInfo const* spellProto, Damage } case 5481: // Starfire Bonus { - if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, 0x200002, 0, 0)) + if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, flag128(0x200002, 0, 0))) AddPct(DoneTotalMod, (*i)->GetAmount()); break; } @@ -8418,7 +8418,7 @@ float Unit::SpellDamagePctDone(Unit* victim, SpellInfo const* spellProto, Damage { // Glyph of Smite if (AuraEffect* aurEff = GetAuraEffect(55692, 0)) - if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x100000, 0, 0, GetGUID())) + if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, flag128(0x100000, 0, 0), GetGUID())) AddPct(DoneTotalMod, aurEff->GetAmount()); } break; @@ -8708,7 +8708,7 @@ float Unit::GetUnitSpellCriticalChance(Unit* victim, SpellInfo const* spellProto { // Improved Insect Swarm if (AuraEffect const* aurEff = GetDummyAuraEffect(SPELLFAMILY_DRUID, 1771, 0)) - if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, 0x00000002, 0, 0)) + if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, flag128(0x00000002, 0, 0))) crit_chance += aurEff->GetAmount(); break; } @@ -8739,7 +8739,7 @@ float Unit::GetUnitSpellCriticalChance(Unit* victim, SpellInfo const* spellProto // Lava Burst if (spellProto->SpellFamilyFlags[1] & 0x00001000) { - if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, 0x10000000, 0, 0, GetGUID())) + if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, flag128(0x10000000, 0, 0), GetGUID())) if (victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE) > -100) return 100.0f; break; @@ -8993,7 +8993,7 @@ float Unit::SpellHealingPctDone(Unit* victim, SpellInfo const* spellProto) const break; case 7798: // Glyph of Regrowth { - if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_DRUID, 0x40, 0, 0)) + if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_DRUID, flag128(0x40, 0, 0))) AddPct(DoneTotalMod, (*i)->GetAmount()); break; } @@ -9018,7 +9018,7 @@ float Unit::SpellHealingPctDone(Unit* victim, SpellInfo const* spellProto) const } case 7871: // Glyph of Lesser Healing Wave { - if (victim->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 0, 0x00000400, 0, GetGUID())) + if (victim->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, flag128(0, 0x00000400, 0), GetGUID())) AddPct(DoneTotalMod, (*i)->GetAmount()); break; } @@ -9057,7 +9057,7 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, u if (spellProto->SpellFamilyName == SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags[1] & 0x2000000) { // Rejuvenation, Regrowth, Lifebloom, or Wild Growth - if (GetAuraEffect(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_DRUID, 0x50, 0x4000010, 0)) + if (GetAuraEffect(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_DRUID, flag128(0x50, 0x4000010, 0))) // increase healing by 20% TakenTotalMod *= 1.2f; } diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 79d402c3695..f92c2f278f3 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1798,7 +1798,7 @@ class Unit : public WorldObject void RemoveNotOwnSingleTargetAuras(uint32 newPhase = 0x0, bool phaseid = false); void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except = 0); void RemoveAurasWithAttribute(uint32 flags); - void RemoveAurasWithFamily(SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID); + void RemoveAurasWithFamily(SpellFamilyNames family, flag128 const& familyFlag, ObjectGuid casterGUID); void RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemode = AURA_REMOVE_BY_DEFAULT, uint32 except = 0); void RemoveMovementImpairingAuras(); @@ -1821,7 +1821,7 @@ class Unit : public WorldObject AuraEffect* GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID = ObjectGuid::Empty) const; AuraEffect* GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID = ObjectGuid::Empty) const; AuraEffect* GetAuraEffect(AuraType type, SpellFamilyNames name, uint32 iconId, uint8 effIndex) const; // spell mustn't have familyflags - AuraEffect* GetAuraEffect(AuraType type, SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID = ObjectGuid::Empty) const; + AuraEffect* GetAuraEffect(AuraType type, SpellFamilyNames family, flag128 const& familyFlag, ObjectGuid casterGUID = ObjectGuid::Empty) const; AuraEffect* GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const; AuraApplication * GetAuraApplication(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, ObjectGuid itemCasterGUID = ObjectGuid::Empty, uint32 reqEffMask = 0, AuraApplication * except = NULL) const; diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index ad68ca988ff..a3b0c4788e7 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -1408,7 +1408,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const { case FORM_CAT: // Savage Roar - if (target->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_DRUID, 0, 0x10000000, 0)) + if (target->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_DRUID, flag128(0, 0x10000000, 0))) target->CastSpell(target, 62071, true); // Nurturing Instinct if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT, SPELLFAMILY_DRUID, 2254, EFFECT_0)) @@ -1984,7 +1984,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo if (target->getClass() == CLASS_DRUID) { // Dash - if (AuraEffect* aurEff = target->GetAuraEffect(SPELL_AURA_MOD_INCREASE_SPEED, SPELLFAMILY_DRUID, 0, 0, 0x8)) + if (AuraEffect* aurEff = target->GetAuraEffect(SPELL_AURA_MOD_INCREASE_SPEED, SPELLFAMILY_DRUID, flag128(0, 0, 0x8))) aurEff->RecalculateAmount(); // Disarm handling @@ -5731,7 +5731,7 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster) case 28820: { // Need remove self if Lightning Shield not active - if (!target->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_SHAMAN, 0x400, 0, 0)) + if (!target->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_SHAMAN, flag128(0x400, 0, 0))) target->RemoveAurasDueToSpell(28820); return; } diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index cd8427136cd..58ff14b9579 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -1519,7 +1519,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b case SPELLFAMILY_ROGUE: // Remove Vanish on stealth remove if (GetId() == 1784) - target->RemoveAurasWithFamily(SPELLFAMILY_ROGUE, 0x0000800, 0, 0, target->GetGUID()); + target->RemoveAurasWithFamily(SPELLFAMILY_ROGUE, flag128(0x0000800, 0, 0, 0), target->GetGUID()); break; case SPELLFAMILY_PALADIN: // Remove the immunity shield marker on Forbearance removal if AW marker is not present diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 4dcd0e681e9..06be95f3c26 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -483,7 +483,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) // Check aura state for speed but aura state set not only for Immolate spell if (unitTarget->HasAuraState(AURA_STATE_CONFLAGRATE)) { - if (unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_WARLOCK, 0x4, 0, 0)) + if (unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_WARLOCK, flag128(0x4, 0, 0))) damage += damage / 6; } } @@ -516,7 +516,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) if (uint32 combo = player->GetComboPoints()) { // Lookup for Deadly poison (only attacker applied) - if (AuraEffect const* aurEff = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x00010000, 0, 0, m_caster->GetGUID())) + if (AuraEffect const* aurEff = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, flag128(0x00010000, 0, 0), m_caster->GetGUID())) { // count consumed deadly poison doses at target uint32 spellId = aurEff->GetId(); @@ -561,7 +561,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) // Blood Boil - bonus for diseased targets if (m_spellInfo->SpellFamilyFlags[0] & 0x00040000) { - if (unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DEATHKNIGHT, 0, 0, 0x00000002, m_caster->GetGUID())) + if (unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DEATHKNIGHT, flag128(0, 0, 0x00000002), m_caster->GetGUID())) { damage += m_damage / 2; damage += int32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.035f); @@ -3278,7 +3278,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) case 63975: { // search our Rupture aura on target - if (AuraEffect const* aurEff = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x00100000, 0, 0, m_caster->GetGUID())) + if (AuraEffect const* aurEff = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, flag128(0x00100000, 0, 0), m_caster->GetGUID())) { uint32 countMin = aurEff->GetBase()->GetMaxDuration(); uint32 countMax = 12000; // this can be wrong, duration should be based on combo-points diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 1334f5840ab..4db7091f971 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -1061,7 +1061,7 @@ SpellInfo::SpellInfo(SpellEntry const* spellEntry, SpellEffectEntryMap const& ef // SpellClassOptionsEntry SpellClassOptionsEntry const* _class = GetSpellClassOptions(); SpellFamilyName = _class ? _class->SpellClassSet : 0; - SpellFamilyFlags = _class ? _class->SpellClassMask : flag128(0); + SpellFamilyFlags = _class ? _class->SpellClassMask : flag128(); // SpellCooldownsEntry SpellCooldownsEntry const* _cooldowns = GetSpellCooldowns(); @@ -2363,7 +2363,7 @@ SpellSpecificType SpellInfo::GetSpellSpecific() const return SPELL_SPECIFIC_STING; // only hunter aspects have this (but not all aspects in hunter family) - if (SpellFamilyFlags & flag96(0x00380000, 0x00440000, 0x00001010)) + if (SpellFamilyFlags & flag128(0x00200000, 0x00000000, 0x00001010, 0x00000000)) return SPELL_SPECIFIC_ASPECT; break; diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 84a6fab9318..4ea0695983a 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -344,7 +344,7 @@ class spell_dru_glyph_of_starfire : public SpellScriptLoader { Unit* caster = GetCaster(); if (Unit* unitTarget = GetHitUnit()) - if (AuraEffect const* aurEff = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, 0x2, 0, 0, caster->GetGUID())) + if (AuraEffect const* aurEff = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, flag128(0x2, 0, 0), caster->GetGUID())) { Aura* aura = aurEff->GetBase(); diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 453fa8ad4cf..d01883a019b 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -118,7 +118,7 @@ class spell_gen_adaptive_warding : public SpellScriptLoader return false; // find Mage Armor - if (!GetTarget()->GetAuraEffect(SPELL_AURA_MOD_MANA_REGEN_INTERRUPT, SPELLFAMILY_MAGE, 0x10000000, 0x0, 0x0)) + if (!GetTarget()->GetAuraEffect(SPELL_AURA_MOD_MANA_REGEN_INTERRUPT, SPELLFAMILY_MAGE, flag128(0x10000000, 0x0, 0x0))) return false; switch (GetFirstSchoolInMask(eventInfo.GetSchoolMask())) diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 00732f1198b..ed76d87cf83 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -748,7 +748,7 @@ class spell_pri_pain_and_suffering_proc : public SpellScriptLoader Unit* caster = GetCaster(); // Refresh Shadow Word: Pain on target if (Unit* target = GetHitUnit()) - if (AuraEffect* aur = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x8000, 0, 0, caster->GetGUID())) + if (AuraEffect* aur = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, flag128(0x8000, 0, 0), caster->GetGUID())) { uint32 damage = std::max(aur->GetAmount(), 0); sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage); diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index b70ae177928..537c57fb51f 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -280,7 +280,7 @@ class spell_rog_deadly_poison : public SpellScriptLoader { if (Unit* target = GetHitUnit()) // Deadly Poison - if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x10000, 0x80000, 0, GetCaster()->GetGUID())) + if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, flag128(0x10000, 0x80000, 0), GetCaster()->GetGUID())) _stackAmount = aurEff->GetBase()->GetStackAmount(); } @@ -326,7 +326,7 @@ class spell_rog_deadly_poison : public SpellScriptLoader continue; // Do not reproc deadly - if (spellInfo->SpellFamilyFlags == flag96(0x10000, 0x80000, 0)) + if (spellInfo->SpellFamilyFlags == flag128(0x10000, 0x80000, 0, 0)) continue; if (spellInfo->IsPositive()) diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index af4ff1f4485..14b305a591a 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -236,7 +236,7 @@ class spell_sha_chain_heal : public SpellScriptLoader if (firstHeal) { // Check if the target has Riptide - if (AuraEffect* aurEff = GetHitUnit()->GetAuraEffect(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_SHAMAN, 0, 0, 0x10, GetCaster()->GetGUID())) + if (AuraEffect* aurEff = GetHitUnit()->GetAuraEffect(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_SHAMAN, flag128(0, 0, 0x10), GetCaster()->GetGUID())) { riptide = true; amount = aurEff->GetSpellInfo()->GetEffect(DIFFICULTY_NONE, EFFECT_2)->CalcValue(); @@ -880,7 +880,7 @@ class spell_sha_lava_lash : public SpellScriptLoader if (caster->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND)) { // Damage is increased by 25% if your off-hand weapon is enchanted with Flametongue. - if (caster->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 0x200000, 0, 0)) + if (caster->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, flag128(0x200000, 0, 0))) AddPct(hitDamage, damage); SetHitDamage(hitDamage); } diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index cac3178c320..a93d23fa233 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -154,7 +154,7 @@ class spell_warl_banish : public SpellScriptLoader /// Check if the target already has Banish, if so, do nothing. if (Unit* target = GetHitUnit()) { - if (target->GetAuraEffect(SPELL_AURA_SCHOOL_IMMUNITY, SPELLFAMILY_WARLOCK, 0, 0x08000000, 0)) + if (target->GetAuraEffect(SPELL_AURA_SCHOOL_IMMUNITY, SPELLFAMILY_WARLOCK, flag128(0, 0x08000000, 0))) { // No need to remove old aura since its removed due to not stack by current Banish aura PreventHitDefaultEffect(EFFECT_0); @@ -590,7 +590,7 @@ class spell_warl_everlasting_affliction : public SpellScriptLoader Unit* caster = GetCaster(); if (Unit* target = GetHitUnit()) // Refresh corruption on target - if (AuraEffect* aurEff = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_WARLOCK, 0x2, 0, 0, caster->GetGUID())) + if (AuraEffect* aurEff = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_WARLOCK, flag128(0x2, 0, 0), caster->GetGUID())) { uint32 damage = std::max(aurEff->GetAmount(), 0); sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage); diff --git a/src/server/shared/Utilities/Util.h b/src/server/shared/Utilities/Util.h index 0886b625370..9605efe18ec 100644 --- a/src/server/shared/Utilities/Util.h +++ b/src/server/shared/Utilities/Util.h @@ -383,32 +383,41 @@ class HookList } }; -template<uint8 T_size> -class flag +class flag128 { -protected: - uint32 part[T_size]; +private: + uint32 part[4]; public: - flag() + flag128(uint32 p1 = 0, uint32 p2 = 0, uint32 p3 = 0, uint32 p4 = 0) + { + part[0] = p1; + part[1] = p2; + part[2] = p3; + part[3] = p4; + } + + inline bool IsEqual(uint32 p1 = 0, uint32 p2 = 0, uint32 p3 = 0, uint32 p4 = 0) const { - memset(part, 0, sizeof(uint32)*T_size); + return (part[0] == p1 && part[1] == p2 && part[2] == p3 && part[3] == p4); } - flag(uint32 first, ...) + inline bool HasFlag(uint32 p1 = 0, uint32 p2 = 0, uint32 p3 = 0, uint32 p4 = 0) const { - va_list ap; - part[0] = first; + return (part[0] & p1 || part[1] & p2 || part[2] & p3 || part[3] & p4); + } - va_start(ap, first); - for (int i = 1; i < T_size; ++i) - part[i] = va_arg(ap, uint32); - va_end(ap); + inline void Set(uint32 p1 = 0, uint32 p2 = 0, uint32 p3 = 0, uint32 p4 = 0) + { + part[0] = p1; + part[1] = p2; + part[2] = p3; + part[3] = p4; } - inline bool operator <(const flag<T_size>& right) const + inline bool operator <(const flag128 &right) const { - for (uint8 i = T_size; i > 0; --i) + for (uint8 i = 4; i > 0; --i) { if (part[i - 1] < right.part[i - 1]) return true; @@ -418,85 +427,84 @@ public: return false; } - inline bool operator ==(const flag<T_size>& right) const + inline bool operator ==(const flag128 &right) const { - for (uint8 i = 0; i < T_size; ++i) - if (part[i] != right.part[i]) - return false; - return true; + return + ( + part[0] == right.part[0] && + part[1] == right.part[1] && + part[2] == right.part[2] && + part[3] == right.part[3] + ); } - inline bool operator !=(const flag<T_size>& right) const + inline bool operator !=(const flag128 &right) const { return !this->operator ==(right); } - inline flag<T_size>& operator =(const flag<T_size>& right) + inline flag128 & operator =(const flag128 &right) { - for (uint8 i = 0; i < T_size; ++i) - part[i] = right.part[i]; + part[0] = right.part[0]; + part[1] = right.part[1]; + part[2] = right.part[2]; + part[3] = right.part[3]; return *this; } - inline flag<T_size> operator &(const flag<T_size> &right) const + inline flag128 operator &(const flag128 &right) const { - flag<T_size> fl; - for (uint8 i = 0; i < T_size; ++i) - fl.part[i] = part[i] & right.part[i]; - return fl; + return flag128(part[0] & right.part[0], part[1] & right.part[1], + part[2] & right.part[2], part[3] & right.part[3]); } - inline flag<T_size>& operator &=(const flag<T_size> &right) + inline flag128 & operator &=(const flag128 &right) { - for (uint8 i = 0; i < T_size; ++i) - part[i] &= right.part[i]; + part[0] &= right.part[0]; + part[1] &= right.part[1]; + part[2] &= right.part[2]; + part[3] &= right.part[3]; return *this; } - inline flag<T_size> operator |(const flag<T_size> &right) const + inline flag128 operator |(const flag128 &right) const { - flag<T_size> fl; - for (uint8 i = 0; i < T_size; ++i) - fl.part[i] = part[i] | right.part[i]; - return fl; + return flag128(part[0] | right.part[0], part[1] | right.part[1], + part[2] | right.part[2], part[3] | right.part[3]); } - inline flag<T_size>& operator |=(const flag<T_size> &right) + inline flag128 & operator |=(const flag128 &right) { - for (uint8 i = 0; i < T_size; ++i) - part[i] |= right.part[i]; + part[0] |= right.part[0]; + part[1] |= right.part[1]; + part[2] |= right.part[2]; + part[3] |= right.part[3]; return *this; } - inline flag<T_size> operator ~() const + inline flag128 operator ~() const { - flag<T_size> fl; - for (uint8 i = 0; i < T_size; ++i) - fl.part[i] = ~part[i]; - return fl; + return flag128(~part[0], ~part[1], ~part[2], ~part[3]); } - inline flag<T_size> operator ^(const flag<T_size>& right) const + inline flag128 operator ^(const flag128 &right) const { - flag<T_size> fl; - for (uint8 i = 0; i < T_size; ++i) - fl.part[i] = part[i] ^ right.part[i]; - return fl; + return flag128(part[0] ^ right.part[0], part[1] ^ right.part[1], + part[2] ^ right.part[2], part[3] ^ right.part[3]); } - inline flag<T_size>& operator ^=(const flag<T_size>& right) + inline flag128 & operator ^=(const flag128 &right) { - for (uint8 i = 0; i < T_size; ++i) - part[i] ^= right.part[i]; + part[0] ^= right.part[0]; + part[1] ^= right.part[1]; + part[2] ^= right.part[2]; + part[3] ^= right.part[3]; return *this; } inline operator bool() const { - for (uint8 i = 0; i < T_size; ++i) - if (part[i] != 0) - return true; - return false; + return (part[0] != 0 || part[1] != 0 || part[2] != 0 || part[3] != 0); } inline bool operator !() const @@ -504,20 +512,17 @@ public: return !this->operator bool(); } - inline uint32& operator [](uint8 el) + inline uint32 & operator [](uint8 el) { return part[el]; } - inline const uint32& operator [](uint8 el) const + inline const uint32 & operator [](uint8 el) const { return part[el]; } }; -typedef flag<3> flag96; -typedef flag<4> flag128; - enum ComparisionType { COMP_TYPE_EQ = 0, |