diff --git a/src/game/Guild.h b/src/game/Guild.h index 52e13febb3..0a360896aa 100644 --- a/src/game/Guild.h +++ b/src/game/Guild.h @@ -19,7 +19,7 @@ #ifndef MANGOSSERVER_GUILD_H #define MANGOSSERVER_GUILD_H -#define WITHDRAW_MONEY_UNLIMITED UI64LIT(0xFFFFFFFFFFFFFFFF) +#define WITHDRAW_MONEY_UNLIMITED uint64(0xFFFFFFFFFFFFFFFF) #define WITHDRAW_SLOT_UNLIMITED 0xFFFFFFFF #include "Common.h" diff --git a/src/game/LootMgr.cpp b/src/game/LootMgr.cpp index e60104e7a4..e67a005a38 100644 --- a/src/game/LootMgr.cpp +++ b/src/game/LootMgr.cpp @@ -375,7 +375,6 @@ LootItem::LootItem(LootStoreItem const& li, uint32 _lootSlot, uint32 threshold) currentLooterPass = false; isNotVisibleForML = false; checkRollNeed = false; -} if (lootItemType == LOOTITEM_TYPE_CURRENCY) { diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index 328f9753e4..c861b4c19e 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -22,6 +22,7 @@ #include "Opcodes.h" #include "Log.h" #include "Player.h" +#include "SpellAuras.h" #include "MapManager.h" #include "Transports.h" #include "BattleGround/BattleGround.h" diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 87970284b8..0714ecdb15 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -6393,7 +6393,10 @@ void Player::CheckAreaExploreAndOutdoor() SpellEntry const* spellInfo = sSpellStore.LookupEntry(itr->first); if (!spellInfo || !IsNeedCastSpellAtOutdoor(spellInfo) || HasAura(itr->first)) continue; - if ((spellInfo->Stances || spellInfo->StancesNot) && !IsNeedCastSpellAtFormApply(spellInfo, GetShapeshiftForm())) + + SpellShapeshiftEntry const* shapeShift = spellInfo->GetSpellShapeshift(); + + if (!shapeShift || (shapeShift->Stances || shapeShift->StancesNot) && !IsNeedCastSpellAtFormApply(spellInfo, GetShapeshiftForm())) continue; CastSpell(this, itr->first, true, nullptr); } diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index d915e651ab..5016858598 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1930,7 +1930,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& } if (!prev->IsWithinLOSInMap(*next) - || ((m_spellInfo->HasAttribute(SPELL_ATTR_EX6_IGNORE_CC_TARGETS) && !(*next)->CanFreeMove())) + || (m_spellInfo->HasAttribute(SPELL_ATTR_EX6_IGNORE_CC_TARGETS) && !(*next)->CanFreeMove())) { ++next; continue; @@ -1945,7 +1945,6 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& } } break; - } case TARGET_ALL_ENEMY_IN_AREA: FillAreaTargets(targetUnitMap, radius, PUSH_DEST_CENTER, SPELL_TARGETS_AOE_DAMAGE); @@ -2998,7 +2997,9 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& // remove caster from the list if required by attribute if (m_spellInfo->HasAttribute(SPELL_ATTR_EX_CANT_TARGET_SELF)) { - if (targetMode != TARGET_SELF && targetMode != TARGET_SELF2 && m_spellInfo->Effect[effIndex] != SPELL_EFFECT_SUMMON) + const SpellEffectEntry* spellEffect = m_spellInfo->GetSpellEffect(effIndex); + + if (targetMode != TARGET_SELF && targetMode != TARGET_SELF2 && (spellEffect && spellEffect->Effect != SPELL_EFFECT_SUMMON)) targetUnitMap.remove(m_caster); } @@ -3076,6 +3077,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& AddGOTarget(*iter, effIndex); } } +} SpellCastResult Spell::PreCastCheck(Aura* triggeredByAura /*= nullptr*/) { @@ -3676,9 +3678,9 @@ void Spell::_handle_immediate_phase() if(!spellEffect) continue; // persistent area auras target only the ground - if (m_spellInfo->Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA || + if (spellEffect->Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA || //summon a gameobject at the spell's destination xyz - (m_spellInfo->Effect == SPELL_EFFECT_TRANS_DOOR && m_spellInfo->EffectImplicitTargetA == TARGET_AREAEFFECT_GO_AROUND_DEST)) + (spellEffect->Effect == SPELL_EFFECT_TRANS_DOOR && spellEffect->EffectImplicitTargetA == TARGET_AREAEFFECT_GO_AROUND_DEST)) HandleEffects(nullptr, nullptr, nullptr, SpellEffectIndex(j)); } } @@ -6520,7 +6522,7 @@ SpellCastResult Spell::CheckPetCast(Unit* target) return SPELL_FAILED_BAD_IMPLICIT_TARGETS; break; } - else if (m_spellInfo->EffectImplicitTargetA[i] == TARGET_SCRIPT_COORDINATES) + else if (spellEffect->EffectImplicitTargetA == TARGET_SCRIPT_COORDINATES) { script = true; continue; diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 6d51ae69d5..8412713fc9 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -1126,7 +1126,8 @@ void Aura::HandleAddModifier(bool apply, bool Real) else if (opt && spellProto->Id == 37212) { // Flametongue Weapon (Passive) -uint64 } + const_cast(opt)->SpellFamilyFlags = ClassFamilyMask(uint64(0x0000000000200000)); + } } ((Player*)GetTarget())->AddSpellMod(this, apply); @@ -7598,7 +7599,7 @@ void Aura::PeriodicTick() // apply damage part to caster if needed (ex. health funnel) if (target != pCaster && spellProto->SpellVisual[0] == 163) { - uint32 damage = spellProto->manaPerSecond; + uint32 damage = spellProto->GetManaPerSecond(); uint32 absorb = 0; pCaster->DealDamageMods(pCaster, damage, &absorb); diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 1c41314e1b..3505e77c74 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -433,7 +433,7 @@ void Spell::EffectSchoolDMG(SpellEffectEntry const* effect) case SPELLFAMILY_MAGE: // remove Arcane Blast buffs at any non-Arcane Blast arcane damage spell. // NOTE: it removed at hit instead cast because currently spell done-damage calculated at hit instead cast - if ((m_spellInfo->SchoolMask & SPELL_SCHOOL_MASK_ARCANE) && !(classOptions && classOptions->SpellFamilyFlags & UI64LIT(0x20000000))) + if ((m_spellInfo->SchoolMask & SPELL_SCHOOL_MASK_ARCANE) && !(classOptions && classOptions->SpellFamilyFlags & uint64(0x20000000))) m_caster->RemoveAurasDueToSpell(36032); // Arcane Blast buff break; case SPELLFAMILY_WARRIOR: @@ -572,7 +572,7 @@ void Spell::EffectSchoolDMG(SpellEffectEntry const* effect) if (classOptions && classOptions->SpellFamilyFlags & uint64(0x0000000200000000)) m_caster->CastCustomSpell(m_caster, 32409, &damage, nullptr, nullptr, true); // Improved Mind Blast (Mind Blast in shadow form bonus) - else if (m_caster->GetShapeshiftForm() == FORM_SHADOW && (classOptions && classOptions->SpellFamilyFlags & UI64LIT(0x00002000))) + else if (m_caster->GetShapeshiftForm() == FORM_SHADOW && (classOptions && classOptions->SpellFamilyFlags & uint64(0x00002000))) { Unit::AuraList const& ImprMindBlast = m_caster->GetAurasByType(SPELL_AURA_ADD_FLAT_MODIFIER); for (Unit::AuraList::const_iterator i = ImprMindBlast.begin(); i != ImprMindBlast.end(); ++i) @@ -776,10 +776,10 @@ void Spell::EffectSchoolDMG(SpellEffectEntry const* effect) damage += count * int32(average * IN_MILLISECONDS) / m_caster->GetAttackTime(BASE_ATTACK); } // Shield of Righteousness - else if (classOptions && classOptions->SpellFamilyFlags & uint64(0x0010000000000000)) + /*else if (classOptions && classOptions->SpellFamilyFlags & uint64(0x0010000000000000)) { damage += int32(m_caster->GetShieldBlockValue()); - } + }*/ // Judgement else if (m_spellInfo->Id == 54158) { @@ -5452,8 +5452,8 @@ void Spell::EffectSummonType(SpellEffectEntry const* effect) amount = 1; // Expected Level (Totem, Pet and Critter may not use this) - uint32 level = responsibleCaster ? std::max(responsibleCaster->getLevel() + m_spellInfo->EffectMultipleValue[eff_idx], 1.0f) - : std::max(m_caster->getLevel() + m_spellInfo->EffectMultipleValue[eff_idx], 1.0f); + uint32 level = responsibleCaster ? std::max(responsibleCaster->getLevel() + effect->EffectMultipleValue, 1.0f) + : std::max(m_caster->getLevel() + effect->EffectMultipleValue, 1.0f); // level of creature summoned using engineering item based at engineering skill level if (m_caster->GetTypeId() == TYPEID_PLAYER && m_CastItem) { @@ -5529,7 +5529,7 @@ void Spell::EffectSummonType(SpellEffectEntry const* effect) if (prop_id == 61) { // Totem cases - if (CreatureInfo const* cInfo = ObjectMgr::GetCreatureTemplate(m_spellInfo->EffectMiscValue[eff_idx])) + if (CreatureInfo const* cInfo = ObjectMgr::GetCreatureTemplate(effect->EffectMiscValue)) { if (cInfo->CreatureType == CREATURE_TYPE_TOTEM) { @@ -5913,7 +5913,7 @@ bool Spell::DoSummonPossessed(CreatureSummonPositions& list, SummonPropertiesEnt uint32 const& creatureEntry = effect->EffectMiscValue; - Unit* newUnit = m_caster->TakePossessOf(m_spellInfo, prop, effIdx, list[0].x, list[0].y, list[0].z, m_caster->GetOrientation()); + Unit* newUnit = m_caster->TakePossessOf(m_spellInfo, prop, effect, list[0].x, list[0].y, list[0].z, m_caster->GetOrientation()); if (!newUnit) { sLog.outError("Spell::DoSummonPossessed: creature entry %d for spell %u could not be summoned.", creatureEntry, m_spellInfo->Id); @@ -5982,7 +5982,7 @@ bool Spell::DoSummonPet(SpellEffectEntry const* effect) return false; } - uint32 level = std::max(m_caster->getLevel() + m_spellInfo->EffectMultipleValue[eff_idx], 1.0f); + uint32 level = std::max(m_caster->getLevel() + effect->EffectMultipleValue, 1.0f); spawnCreature->SetRespawnCoord(pos); diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 96f55f78eb..ed762971d2 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -2307,8 +2307,8 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons if (classOptions2 && classOptions2->SpellFamilyName == SPELLFAMILY_MAGE ) { // Blizzard & Chilled (and some other stacked with blizzard spells - if (classOptions1 && (classOptions1->SpellFamilyFlags & uint64(0x80)) && (classOptions2->SpellFamilyFlags & UI64LIT(0x100000)) || - (classOptions2->SpellFamilyFlags & uint64(0x80)) && (classOptions1->SpellFamilyFlags & UI64LIT(0x100000)) ) + if (classOptions1 && (classOptions1->SpellFamilyFlags & uint64(0x80)) && (classOptions2->SpellFamilyFlags & uint64(0x100000)) || + (classOptions2->SpellFamilyFlags & uint64(0x80)) && (classOptions1->SpellFamilyFlags & uint64(0x100000)) ) return false; // Blink & Improved Blink @@ -4742,7 +4742,7 @@ int32 GetDiminishingReturnsLimitDuration(DiminishingGroup group, SpellEntry cons case SPELLFAMILY_HUNTER: { // Wyvern Sting - if (classOptions && classOptions->SpellFamilyFlags & Uuint64I64LIT(0x0000100000000000)) + if (classOptions && classOptions->SpellFamilyFlags & uint64(0x0000100000000000)) return 6000; break; } diff --git a/src/game/TradeHandler.cpp b/src/game/TradeHandler.cpp index 01ce9a2b38..e345b5c8d7 100644 --- a/src/game/TradeHandler.cpp +++ b/src/game/TradeHandler.cpp @@ -27,6 +27,7 @@ #include "Item.h" #include "Spell.h" #include "SocialMgr.h" +#include "Language.h" #include "DBCStores.h" void WorldSession::SendTradeStatus(TradeStatus status) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 1718cbf9d3..60dca21325 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -1879,11 +1879,6 @@ void Unit::CalculateMeleeDamage(Unit* pVictim, CalcDamageInfo* damageInfo, Weapo if (mod != 0) damageInfo->damage = int32((damageInfo->damage) * float((100.0f + mod) / 100.0f)); - - uint32 crTypeMask = damageInfo->target->GetCreatureTypeMask(); - - // Increase crit damage from SPELL_AURA_MOD_CRIT_PERCENT_VERSUS - mod += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, crTypeMask); // Resilience - reduce crit damage uint32 reduction_affected_damage = CalcNotIgnoreDamageReduction(damageInfo->damage, damageInfo->damageSchoolMask); @@ -3091,7 +3086,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit* pVictim, WeaponAttackT return MELEE_HIT_CRIT; } - tmp = (victimDefenseSkill < victimMaxSkillValueForLevel) ? victimDefenseSkill : victimMaxSkillValueForLevel; + //tmp = (victimDefenseSkill < victimMaxSkillValueForLevel) ? victimDefenseSkill : victimMaxSkillValueForLevel; // mobs can score crushing blows if they're 4 or more levels above victim // having defense above your maximum (from items, talents etc.) has no effect @@ -4605,7 +4600,7 @@ bool Unit::RemoveNoStackAurasDueToAuraHolder(SpellAuraHolder* holder) if (triggeredBy && sSpellMgr.IsSpellCanAffectSpell(triggeredBy, i_spellProto)) // check if this spell can be triggered by any talent aura continue; - if (sSpellMgr.IsNoStackSpellDueToSpell(spellProto, i_spellProto)) + if (sSpellMgr.IsNoStackSpellDueToSpell(spellProto->Id, i_spellProto->Id)) { // Its a parent aura (create this aura in ApplyModifier) if ((*i).second->IsInUse()) @@ -4957,7 +4952,7 @@ void Unit::RemoveAurasOnCast(SpellEntry const* castedSpellEntry) SpellEntry const* spellEntry = holder->GetSpellProto(); bool removeThisHolder = false; - if (spellEntry->AuraInterruptFlags & AURA_INTERRUPT_FLAG_UNK2) + if (spellEntry->GetAuraInterruptFlags() & AURA_INTERRUPT_FLAG_UNK2) { if (castedSpellEntry->HasAttribute(SPELL_ATTR_EX_NOT_BREAK_STEALTH)) { @@ -7444,9 +7439,6 @@ uint32 Unit::SpellCriticalDamageBonus(SpellEntry const* spellProto, uint32 damag else critPctDamageMod += pVictim->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_DAMAGE, GetSpellSchoolMask(spellProto)); - uint32 creatureTypeMask = pVictim->GetCreatureTypeMask(); - critPctDamageMod += GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, creatureTypeMask); - if (critPctDamageMod != 0) crit_bonus = int32(crit_bonus * float((100.0f + critPctDamageMod) / 100.0f)); @@ -12174,9 +12166,9 @@ void Unit::SendCollisionHeightUpdate(float height) } // This will create a new creature and set the current unit as the controller of that new creature -Unit* Unit::TakePossessOf(SpellEntry const* spellEntry, SummonPropertiesEntry const* summonProp, uint32 effIdx, float x, float y, float z, float ang) +Unit* Unit::TakePossessOf(SpellEntry const* spellEntry, SummonPropertiesEntry const* summonProp, SpellEffectEntry const* spellEffect, float x, float y, float z, float ang) { - int32 const& creatureEntry = spellEntry->EffectMiscValue[effIdx]; + int32 const& creatureEntry = spellEffect->EffectMiscValue; CreatureInfo const* cinfo = ObjectMgr::GetCreatureTemplate(creatureEntry); if (!cinfo) { diff --git a/src/game/Unit.h b/src/game/Unit.h index d806e179ea..d5aad3e167 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -2169,7 +2169,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject bool TakePossessOf(Unit* possessed); // Take possession of a new spawned unit - Unit* TakePossessOf(SpellEntry const* spellEntry, SummonPropertiesEntry const* summonProp, uint32 effIdx, float x, float y, float z, float ang); + Unit* TakePossessOf(SpellEntry const* spellEntry, SummonPropertiesEntry const* summonProp, SpellEffectEntry const* spellEffect, float x, float y, float z, float ang); // Reset control to player void ResetControlState(bool attackCharmer = true); diff --git a/src/game/WorldSocket.cpp b/src/game/WorldSocket.cpp index 77a06fe406..a2ba752422 100644 --- a/src/game/WorldSocket.cpp +++ b/src/game/WorldSocket.cpp @@ -121,8 +121,7 @@ bool WorldSocket::Open() data << ServerToClient; - if (SendPacket(data) == -1) - return -1; + SendPacket(data); // Send startup packet. WorldPacket packet (SMSG_AUTH_CHALLENGE, 37);