diff options
-rwxr-xr-x | src/server/game/Chat/Commands/Level3.cpp | 5 | ||||
-rwxr-xr-x | src/server/game/Entities/Player/Player.cpp | 24 | ||||
-rwxr-xr-x | src/server/game/Entities/Unit/StatSystem.cpp | 33 | ||||
-rwxr-xr-x | src/server/game/Entities/Unit/Unit.cpp | 11 | ||||
-rwxr-xr-x | src/server/game/Entities/Unit/Unit.h | 18 | ||||
-rwxr-xr-x | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 15 | ||||
-rwxr-xr-x | src/server/game/Spells/Spell.cpp | 8 | ||||
-rwxr-xr-x | src/server/game/Spells/SpellEffects.cpp | 4 |
8 files changed, 62 insertions, 56 deletions
diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp index b4ab794c44b..5c321be6e08 100755 --- a/src/server/game/Chat/Commands/Level3.cpp +++ b/src/server/game/Chat/Commands/Level3.cpp @@ -2504,7 +2504,7 @@ static bool HandleResetStatsOrLevelHelper(Player* player) // reset m_form if no aura if (!player->HasAuraType(SPELL_AURA_MOD_SHAPESHIFT)) - player->m_form = FORM_NONE; + player->SetShapeshiftForm(FORM_NONE); player->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, DEFAULT_WORLD_OBJECT_SIZE); player->SetFloatValue(UNIT_FIELD_COMBATREACH, DEFAULT_COMBAT_REACH); @@ -2514,11 +2514,10 @@ static bool HandleResetStatsOrLevelHelper(Player* player) player->SetUInt32Value(UNIT_FIELD_BYTES_0, ((player->getRace()) | (player->getClass() << 8) | (player->getGender() << 16) | (powertype << 24))); // reset only if player not in some form; - if (player->m_form == FORM_NONE) + if (player->GetShapeshiftForm() == FORM_NONE) player->InitDisplayIds(); player->SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_PVP); - player->SetByteValue(UNIT_FIELD_BYTES_2, 3, player->m_form); player->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index c12a5081f2d..7e230be6533 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -1547,7 +1547,7 @@ void Player::setDeathState(DeathState s) clearResurrectRequestData(); // remove form before other mods to prevent incorrect stats calculation - RemoveAurasDueToSpell(m_ShapeShiftFormSpellId); + RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT); //FIXME: is pet dismissed at dying or releasing spirit? if second, add setDeathState(DEAD) to HandleRepopRequestOpcode and define pet unsummon here with (s == DEAD) RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true); @@ -3589,7 +3589,9 @@ bool Player::IsNeedCastPassiveSpellAtLearn(SpellEntry const* spellInfo) const { // note: form passives activated with shapeshift spells be implemented by HandleShapeshiftBoosts instead of spell_learn_spell // talent dependent passives activated at form apply have proper stance data - bool need_cast = (!spellInfo->Stances || (m_form != 0 && (spellInfo->Stances & (1<<(m_form-1))))); + ShapeshiftForm form = GetShapeshiftForm(); + bool need_cast = (!spellInfo->Stances || (form && (spellInfo->Stances & (1 << (form - 1)))) || + (!form && (spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT))); //Check CasterAuraStates return need_cast && (!spellInfo->CasterAuraState || HasAuraState(AuraState(spellInfo->CasterAuraState))); @@ -5906,7 +5908,7 @@ void Player::UpdateWeaponSkill (WeaponAttackType attType) if (IsInFeralForm()) return; // always maximized SKILL_FERAL_COMBAT in fact - if (m_form == FORM_TREE) + if (GetShapeshiftForm() == FORM_TREE) return; // use weapon but not skill up if (pVictim && pVictim->GetTypeId() == TYPEID_UNIT && (pVictim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_SKILLGAIN)) @@ -7796,7 +7798,7 @@ void Player::ApplyEquipSpell(SpellEntry const* spellInfo, Item* item, bool apply if (apply) { // Cannot be used in this stance/form - if (GetErrorAtShapeshiftedCast(spellInfo, m_form) != SPELL_CAST_OK) + if (GetErrorAtShapeshiftedCast(spellInfo, GetShapeshiftForm()) != SPELL_CAST_OK) return; if (form_change) // check aura active state from other form @@ -7816,7 +7818,7 @@ void Player::ApplyEquipSpell(SpellEntry const* spellInfo, Item* item, bool apply if (form_change) // check aura compatibility { // Cannot be used in this stance/form - if (GetErrorAtShapeshiftedCast(spellInfo, m_form) == SPELL_CAST_OK) + if (GetErrorAtShapeshiftedCast(spellInfo, GetShapeshiftForm()) == SPELL_CAST_OK) return; // and remove only not compatible at form change } @@ -19401,7 +19403,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc return false; } - if (m_ShapeShiftFormSpellId && m_form != FORM_BATTLESTANCE && m_form != FORM_BERSERKERSTANCE && m_form != FORM_DEFENSIVESTANCE && m_form != FORM_SHADOW) + if (IsInDisallowedMountForm()) { WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4); data << uint32(ERR_TAXIPLAYERSHAPESHIFTED); @@ -19423,8 +19425,8 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc { RemoveAurasByType(SPELL_AURA_MOUNTED); - if (m_ShapeShiftFormSpellId && m_form != FORM_BATTLESTANCE && m_form != FORM_BERSERKERSTANCE && m_form != FORM_DEFENSIVESTANCE && m_form != FORM_SHADOW) - RemoveAurasDueToSpell(m_ShapeShiftFormSpellId); + if (IsInDisallowedMountForm()) + RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT); if (Spell* spell = GetCurrentSpell(CURRENT_GENERIC_SPELL)) if (spell->m_spellInfo->Id != spellid) @@ -19693,7 +19695,9 @@ void Player::ProhibitSpellScholl(SpellSchoolMask idSchoolMask, uint32 unTimeMs) void Player::InitDataForForm(bool reapplyMods) { - SpellShapeshiftEntry const* ssEntry = sSpellShapeshiftStore.LookupEntry(m_form); + ShapeshiftForm form = GetShapeshiftForm(); + + SpellShapeshiftEntry const* ssEntry = sSpellShapeshiftStore.LookupEntry(form); if (ssEntry && ssEntry->attackSpeed) { SetAttackTime(BASE_ATTACK,ssEntry->attackSpeed); @@ -19703,7 +19707,7 @@ void Player::InitDataForForm(bool reapplyMods) else SetRegularAttackTime(); - switch(m_form) + switch (form) { case FORM_GHOUL: case FORM_CAT: diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp index c57cc75ea77..4ab3c25c747 100755 --- a/src/server/game/Entities/Unit/StatSystem.cpp +++ b/src/server/game/Entities/Unit/StatSystem.cpp @@ -296,13 +296,13 @@ void Player::UpdateAttackPowerAndDamage(bool ranged) index_mod = UNIT_FIELD_RANGED_ATTACK_POWER_MODS; index_mult = UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER; - switch(getClass()) + switch (getClass()) { case CLASS_HUNTER: val2 = level * 2.0f + GetStat(STAT_AGILITY) - 10.0f; break; case CLASS_ROGUE: val2 = level + GetStat(STAT_AGILITY) - 10.0f; break; case CLASS_WARRIOR:val2 = level + GetStat(STAT_AGILITY) - 10.0f; break; case CLASS_DRUID: - switch(m_form) + switch (GetShapeshiftForm()) { case FORM_CAT: case FORM_BEAR: @@ -317,19 +317,20 @@ void Player::UpdateAttackPowerAndDamage(bool ranged) } else { - switch(getClass()) + switch (getClass()) { - case CLASS_WARRIOR: val2 = level*3.0f + GetStat(STAT_STRENGTH)*2.0f - 20.0f; break; - case CLASS_PALADIN: val2 = level*3.0f + GetStat(STAT_STRENGTH)*2.0f - 20.0f; break; - case CLASS_DEATH_KNIGHT: val2 = level*3.0f + GetStat(STAT_STRENGTH)*2.0f - 20.0f; break; - case CLASS_ROGUE: val2 = level*2.0f + GetStat(STAT_STRENGTH) + GetStat(STAT_AGILITY) - 20.0f; break; - case CLASS_HUNTER: val2 = level*2.0f + GetStat(STAT_STRENGTH) + GetStat(STAT_AGILITY) - 20.0f; break; - case CLASS_SHAMAN: val2 = level*2.0f + GetStat(STAT_STRENGTH) + GetStat(STAT_AGILITY) - 20.0f; break; + case CLASS_WARRIOR: val2 = level * 3.0f + GetStat(STAT_STRENGTH) * 2.0f - 20.0f; break; + case CLASS_PALADIN: val2 = level * 3.0f + GetStat(STAT_STRENGTH) * 2.0f - 20.0f; break; + case CLASS_DEATH_KNIGHT: val2 = level * 3.0f + GetStat(STAT_STRENGTH) * 2.0f - 20.0f; break; + case CLASS_ROGUE: val2 = level * 2.0f + GetStat(STAT_STRENGTH) + GetStat(STAT_AGILITY) - 20.0f; break; + case CLASS_HUNTER: val2 = level * 2.0f + GetStat(STAT_STRENGTH) + GetStat(STAT_AGILITY) - 20.0f; break; + case CLASS_SHAMAN: val2 = level * 2.0f + GetStat(STAT_STRENGTH) + GetStat(STAT_AGILITY) - 20.0f; break; case CLASS_DRUID: { - //Check if Predatory Strikes is skilled + ShapeshiftForm form = GetShapeshiftForm(); + // Check if Predatory Strikes is skilled float mLevelMult = 0.0; - switch(m_form) + switch (form) { case FORM_CAT: case FORM_BEAR: @@ -351,17 +352,17 @@ void Player::UpdateAttackPowerAndDamage(bool ranged) default: break; } - switch(m_form) + switch (form) { case FORM_CAT: - val2 = getLevel()*(mLevelMult+2.0f) + GetStat(STAT_STRENGTH)*2.0f + GetStat(STAT_AGILITY) - 20.0f + m_baseFeralAP; break; + val2 = getLevel() * (mLevelMult + 2.0f) + GetStat(STAT_STRENGTH) * 2.0f + GetStat(STAT_AGILITY) - 20.0f + m_baseFeralAP; break; case FORM_BEAR: case FORM_DIREBEAR: - val2 = getLevel()*(mLevelMult+3.0f) + GetStat(STAT_STRENGTH)*2.0f - 20.0f + m_baseFeralAP; break; + val2 = getLevel() * (mLevelMult + 3.0f) + GetStat(STAT_STRENGTH) * 2.0f - 20.0f + m_baseFeralAP; break; case FORM_MOONKIN: - val2 = getLevel()*(mLevelMult+1.5f) + GetStat(STAT_STRENGTH)*2.0f - 20.0f + m_baseFeralAP; break; + val2 = getLevel() * (mLevelMult + 1.5f) + GetStat(STAT_STRENGTH) * 2.0f - 20.0f + m_baseFeralAP; break; default: - val2 = GetStat(STAT_STRENGTH)*2.0f - 20.0f; break; + val2 = GetStat(STAT_STRENGTH) * 2.0f - 20.0f; break; } break; } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 3f65313c45b..d9ea36aaa7a 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -123,7 +123,6 @@ m_vehicleKit(NULL), m_unitTypeMask(UNIT_MASK_NONE), m_HostileRefManager(this) m_rootTimes = 0; m_state = 0; - m_form = FORM_NONE; m_deathState = ALIVE; for (uint8 i = 0; i < CURRENT_MAX_SPELL; ++i) @@ -140,7 +139,6 @@ m_vehicleKit(NULL), m_unitTypeMask(UNIT_MASK_NONE), m_HostileRefManager(this) m_interruptMask = 0; m_transform = 0; - m_ShapeShiftFormSpellId = 0; m_canModifyStats = false; for (uint8 i = 0; i < MAX_SPELL_IMMUNITY; ++i) @@ -1701,7 +1699,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEff if (spellProto->SpellIconID == 2253) { //reduces all damage taken while Stunned - if (pVictim->m_form == FORM_CAT && (unitflag & UNIT_FLAG_STUNNED)) + if (pVictim->GetShapeshiftForm() == FORM_CAT && (unitflag & UNIT_FLAG_STUNNED)) RemainingDamage -= RemainingDamage * currentAbsorb / 100; continue; } @@ -8290,7 +8288,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig // Druid Forms Trinket if (auraSpellInfo->Id == 37336) { - switch(m_form) + switch (GetShapeshiftForm()) { case FORM_NONE: trigger_spell_id = 37344;break; case FORM_CAT: trigger_spell_id = 37341;break; @@ -8305,7 +8303,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig // Druid T9 Feral Relic (Lacerate, Swipe, Mangle, and Shred) else if (auraSpellInfo->Id == 67353) { - switch(m_form) + switch (GetShapeshiftForm()) { case FORM_CAT: trigger_spell_id = 67355; break; case FORM_BEAR: @@ -13091,7 +13089,8 @@ uint32 Unit::GetCreatureType() const { if (GetTypeId() == TYPEID_PLAYER) { - SpellShapeshiftEntry const* ssEntry = sSpellShapeshiftStore.LookupEntry(m_form); + ShapeshiftForm form = GetShapeshiftForm(); + SpellShapeshiftEntry const* ssEntry = sSpellShapeshiftStore.LookupEntry(form); if (ssEntry && ssEntry->creatureType > 0) return ssEntry->creatureType; else diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index deae7df8ca8..347a93ebe63 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1713,9 +1713,21 @@ class Unit : public WorldObject uint64 m_SummonSlot[MAX_SUMMON_SLOT]; uint64 m_ObjectSlot[4]; - uint32 m_ShapeShiftFormSpellId; - ShapeshiftForm m_form; - bool IsInFeralForm() const { return m_form == FORM_CAT || m_form == FORM_BEAR || m_form == FORM_DIREBEAR; } + ShapeshiftForm GetShapeshiftForm() const { return ShapeshiftForm(GetByteValue(UNIT_FIELD_BYTES_2, 3)); } + void SetShapeshiftForm(ShapeshiftForm form) { SetByteValue(UNIT_FIELD_BYTES_2, 3, form); } + + inline bool IsInFeralForm() const + { + ShapeshiftForm form = GetShapeshiftForm(); + return form == FORM_CAT || form == FORM_BEAR || form == FORM_DIREBEAR; + } + + inline bool IsInDisallowedMountForm() const + { + ShapeshiftForm form = GetShapeshiftForm(); + return form != FORM_NONE && form != FORM_BATTLESTANCE && form != FORM_BERSERKERSTANCE && form != FORM_DEFENSIVESTANCE && + form != FORM_SHADOW; + } float m_modMeleeHitChance; float m_modRangedHitChance; diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 5d9f9aee68c..577deee44e1 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -754,7 +754,7 @@ int32 AuraEffect::CalculateAmount(Unit * caster) case SPELL_AURA_MOD_INCREASE_SPEED: // Dash - do not set speed if not in cat form if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_DRUID && GetSpellProto()->SpellFamilyFlags[2] & 0x00000008) - amount = GetBase()->GetUnitOwner()->m_form == FORM_CAT ? amount : 0; + amount = GetBase()->GetUnitOwner()->GetShapeshiftForm() == FORM_CAT ? amount : 0; break; default: break; @@ -3054,10 +3054,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const * aurApp, uint8 m if (apply) { // remove other shapeshift before applying a new one - if (target->m_ShapeShiftFormSpellId) - target->RemoveAurasDueToSpell(target->m_ShapeShiftFormSpellId); - - target->SetByteValue(UNIT_FIELD_BYTES_2, 3, form); + target->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT, 0, GetBase()); if (modelid > 0) target->SetDisplayId(modelid); @@ -3106,8 +3103,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const * aurApp, uint8 m } } - target->m_ShapeShiftFormSpellId = GetId(); - target->m_form = form; + target->SetShapeshiftForm(form); } else { @@ -3116,8 +3112,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const * aurApp, uint8 m target->SetByteValue(UNIT_FIELD_BYTES_2, 3, FORM_NONE); if (target->getClass() == CLASS_DRUID) target->setPowerType(POWER_MANA); - target->m_ShapeShiftFormSpellId = 0; - target->m_form = FORM_NONE; + target->SetShapeshiftForm(FORM_NONE); switch(form) { @@ -6134,7 +6129,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo uint32 spellId = 62071; if (apply) { - if (target->m_form != FORM_CAT) + if (target->GetShapeshiftForm() != FORM_CAT) break; target->CastSpell(target, spellId, true, NULL, NULL, GetCasterGUID()); diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 1ae359f38fa..05efbd1bb2c 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -4786,7 +4786,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (checkForm) { // Cannot be used in this stance/form - SpellCastResult shapeError = GetErrorAtShapeshiftedCast(m_spellInfo, m_caster->m_form); + SpellCastResult shapeError = GetErrorAtShapeshiftedCast(m_spellInfo, m_caster->GetShapeshiftForm()); if (shapeError != SPELL_CAST_OK) return shapeError; @@ -5565,11 +5565,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_caster->GetTypeId() == TYPEID_PLAYER && !AllowMount && !m_IsTriggeredSpell && !m_spellInfo->AreaGroupId) return SPELL_FAILED_NO_MOUNTS_ALLOWED; - ShapeshiftForm form = m_caster->m_form; - if (form == FORM_CAT || form == FORM_TREE || form == FORM_TRAVEL || - form == FORM_AQUA || form == FORM_BEAR || form == FORM_DIREBEAR || - form == FORM_CREATUREBEAR || form == FORM_GHOSTWOLF || form == FORM_FLIGHT || - form == FORM_FLIGHT_EPIC || form == FORM_MOONKIN || form == FORM_METAMORPHOSIS) + if (m_caster->IsInDisallowedMountForm()) return SPELL_FAILED_NOT_SHAPESHIFT; break; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 5754d247b0e..23fe73ef738 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -566,7 +566,7 @@ void Spell::SpellDamageSchoolDmg(SpellEffIndex effIndex) else if (m_spellInfo->SpellFamilyFlags[2] & 0x00002000) { // We are in Shadow Form - if (m_caster->m_form == FORM_SHADOW) + if (m_caster->GetShapeshiftForm() == FORM_SHADOW) // We have Improved Mind Blast if (AuraEffect * aurEff = m_caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST,95,0)) // Chance has been successfully rolled @@ -582,7 +582,7 @@ void Spell::SpellDamageSchoolDmg(SpellEffIndex effIndex) damage += damage * aurEff->GetAmount() / 100; } // Improved Mind Blast (Mind Blast in shadow form bonus) - else if (m_caster->m_form == FORM_SHADOW && (m_spellInfo->SpellFamilyFlags[0] & 0x00002000)) + else if (m_caster->GetShapeshiftForm() == FORM_SHADOW && (m_spellInfo->SpellFamilyFlags[0] & 0x00002000)) { Unit::AuraEffectList const& ImprMindBlast = m_caster->GetAuraEffectsByType(SPELL_AURA_ADD_FLAT_MODIFIER); for (Unit::AuraEffectList::const_iterator i = ImprMindBlast.begin(); i != ImprMindBlast.end(); ++i) |