diff options
| author | Shauren <shauren.trinity@gmail.com> | 2018-03-12 18:20:26 +0100 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2018-03-12 23:11:49 +0100 |
| commit | 007b5a68c50bbee7d05acec888d3273c2a5a8577 (patch) | |
| tree | 4818b60a73730b98ae4785d0630edbd6cd27d5bf /src/server/game/Spells/SpellInfo.cpp | |
| parent | 50a912af72ca84095eab5effa7d70e8a50ff8a04 (diff) | |
Core/DataStores: Fixed db2 structures after 7.3.5
Diffstat (limited to 'src/server/game/Spells/SpellInfo.cpp')
| -rw-r--r-- | src/server/game/Spells/SpellInfo.cpp | 104 |
1 files changed, 49 insertions, 55 deletions
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 4e6311ec0bf..2592c973e8d 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -383,14 +383,14 @@ SpellEffectInfo::SpellEffectInfo(SpellInfo const* spellInfo, uint8 effIndex, Spe Amplitude = _effect ? _effect->EffectAmplitude : 0.0f; ChainAmplitude = _effect ? _effect->EffectChainAmplitude : 0.0f; BonusCoefficient = _effect ? _effect->EffectBonusCoefficient : 0.0f; - MiscValue = _effect ? _effect->EffectMiscValue : 0; - MiscValueB = _effect ? _effect->EffectMiscValueB : 0; + MiscValue = _effect ? _effect->EffectMiscValue[0] : 0; + MiscValueB = _effect ? _effect->EffectMiscValue[1] : 0; Mechanic = Mechanics(_effect ? _effect->EffectMechanic : 0); PositionFacing = _effect ? _effect->EffectPosFacing : 0.0f; TargetA = SpellImplicitTargetInfo(_effect ? _effect->ImplicitTarget[0] : 0); TargetB = SpellImplicitTargetInfo(_effect ? _effect->ImplicitTarget[1] : 0); - RadiusEntry = _effect && _effect->EffectRadiusIndex ? sSpellRadiusStore.LookupEntry(_effect->EffectRadiusIndex) : NULL; - MaxRadiusEntry = _effect && _effect->EffectRadiusMaxIndex ? sSpellRadiusStore.LookupEntry(_effect->EffectRadiusMaxIndex) : NULL; + RadiusEntry = _effect && _effect->EffectRadiusIndex[0] ? sSpellRadiusStore.LookupEntry(_effect->EffectRadiusIndex[0]) : NULL; + MaxRadiusEntry = _effect && _effect->EffectRadiusIndex[1] ? sSpellRadiusStore.LookupEntry(_effect->EffectRadiusIndex[1]) : NULL; ChainTargets = _effect ? _effect->EffectChainTargets : 0; ItemType = _effect ? _effect->EffectItemType : 0; TriggerSpell = _effect ? _effect->EffectTriggerSpell : 0; @@ -1002,20 +1002,20 @@ SpellInfo::SpellInfo(SpellInfoLoadHelper const& data, SpellEffectEntryMap const& // SpellMiscEntry SpellMiscEntry const* _misc = data.Misc; - Attributes = _misc ? _misc->Attributes : 0; - AttributesEx = _misc ? _misc->AttributesEx : 0; - AttributesEx2 = _misc ? _misc->AttributesExB : 0; - AttributesEx3 = _misc ? _misc->AttributesExC : 0; - AttributesEx4 = _misc ? _misc->AttributesExD : 0; - AttributesEx5 = _misc ? _misc->AttributesExE : 0; - AttributesEx6 = _misc ? _misc->AttributesExF : 0; - AttributesEx7 = _misc ? _misc->AttributesExG : 0; - AttributesEx8 = _misc ? _misc->AttributesExH : 0; - AttributesEx9 = _misc ? _misc->AttributesExI : 0; - AttributesEx10 = _misc ? _misc->AttributesExJ : 0; - AttributesEx11 = _misc ? _misc->AttributesExK : 0; - AttributesEx12 = _misc ? _misc->AttributesExL : 0; - AttributesEx13 = _misc ? _misc->AttributesExM : 0; + Attributes = _misc ? _misc->Attributes[0] : 0; + AttributesEx = _misc ? _misc->Attributes[1] : 0; + AttributesEx2 = _misc ? _misc->Attributes[2] : 0; + AttributesEx3 = _misc ? _misc->Attributes[3] : 0; + AttributesEx4 = _misc ? _misc->Attributes[4] : 0; + AttributesEx5 = _misc ? _misc->Attributes[5] : 0; + AttributesEx6 = _misc ? _misc->Attributes[6] : 0; + AttributesEx7 = _misc ? _misc->Attributes[7] : 0; + AttributesEx8 = _misc ? _misc->Attributes[8] : 0; + AttributesEx9 = _misc ? _misc->Attributes[9] : 0; + AttributesEx10 = _misc ? _misc->Attributes[10] : 0; + AttributesEx11 = _misc ? _misc->Attributes[11] : 0; + AttributesEx12 = _misc ? _misc->Attributes[12] : 0; + AttributesEx13 = _misc ? _misc->Attributes[13] : 0; CastTimeEntry = _misc ? (_misc->CastingTimeIndex ? sSpellCastTimesStore.LookupEntry(_misc->CastingTimeIndex) : NULL) : NULL; DurationEntry = _misc ? (_misc->DurationIndex ? sSpellDurationStore.LookupEntry(_misc->DurationIndex) : NULL) : NULL; RangeIndex = _misc ? _misc->RangeIndex : 0; @@ -1023,17 +1023,17 @@ SpellInfo::SpellInfo(SpellInfoLoadHelper const& data, SpellEffectEntryMap const& Speed = _misc ? _misc->Speed : 0; SchoolMask = _misc ? _misc->SchoolMask : 0; AttributesCu = 0; - IconFileDataId = _misc ? _misc->IconFileDataID : 0; + IconFileDataId = _misc ? _misc->SpellIconFileDataID : 0; ActiveIconFileDataId = _misc ? _misc->ActiveIconFileDataID : 0; _visuals = std::move(visuals); // sort all visuals so that the ones without a condition requirement are last on the list for (auto& visualPair : _visuals) - std::sort(visualPair.second.begin(), visualPair.second.end(), [](SpellXSpellVisualEntry const* first, SpellXSpellVisualEntry const* second) { return first->PlayerConditionID > second->PlayerConditionID; }); + std::sort(visualPair.second.begin(), visualPair.second.end(), [](SpellXSpellVisualEntry const* first, SpellXSpellVisualEntry const* second) { return first->CasterPlayerConditionID > second->CasterPlayerConditionID; }); // SpellScalingEntry SpellScalingEntry const* _scaling = data.Scaling; - Scaling.Class = _scaling ? _scaling->ScalingClass : 0; + Scaling.Class = _scaling ? _scaling->Class : 0; Scaling.MinScalingLevel = _scaling ? _scaling->MinScalingLevel : 0; Scaling.MaxScalingLevel = _scaling ? _scaling->MaxScalingLevel : 0; Scaling.ScalesFromItemLevel = _scaling ? _scaling->ScalesFromItemLevel : 0; @@ -1091,8 +1091,8 @@ SpellInfo::SpellInfo(SpellInfoLoadHelper const& data, SpellEffectEntryMap const& // SpellEquippedItemsEntry SpellEquippedItemsEntry const* _equipped = data.EquippedItems; EquippedItemClass = _equipped ? _equipped->EquippedItemClass : -1; - EquippedItemSubClassMask = _equipped ?_equipped->EquippedItemSubClassMask : -1; - EquippedItemInventoryTypeMask = _equipped ? _equipped->EquippedItemInventoryTypeMask : -1; + EquippedItemSubClassMask = _equipped ?_equipped->EquippedItemSubclass : -1; + EquippedItemInventoryTypeMask = _equipped ? _equipped->EquippedItemInvTypes : -1; // SpellInterruptsEntry if (SpellInterruptsEntry const* _interrupt = data.Interrupts) @@ -1131,11 +1131,11 @@ SpellInfo::SpellInfo(SpellInfoLoadHelper const& data, SpellEffectEntryMap const& // SpellTargetRestrictionsEntry SpellTargetRestrictionsEntry const* _target = data.TargetRestrictions; - ConeAngle = _target ? _target->ConeAngle : 0.f; + ConeAngle = _target ? _target->ConeDegrees : 0.f; Width = _target ? _target->Width : 0.f; Targets = _target ? _target->Targets : 0; TargetCreatureType = _target ? _target->TargetCreatureType : 0; - MaxAffectedTargets = _target ? _target->MaxAffectedTargets : 0; + MaxAffectedTargets = _target ? _target->MaxTargets : 0; MaxTargetLevel = _target ? _target->MaxTargetLevel : 0; // SpellTotemsEntry @@ -1328,7 +1328,7 @@ bool SpellInfo::IsAbilityOfSkillType(uint32 skillType) const SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(Id); for (SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx) - if (_spell_idx->second->SkillLine == uint32(skillType)) + if (_spell_idx->second->SkillLine == int32(skillType)) return true; return false; @@ -1905,7 +1905,7 @@ SpellCastResult SpellInfo::CheckLocation(uint32 map_id, uint32 zone_id, uint32 a { uint32 mountType = effect->MiscValueB; if (MountEntry const* mountEntry = sDB2Manager.GetMount(Id)) - mountType = mountEntry->MountTypeId; + mountType = mountEntry->MountTypeID; if (mountType && !player->GetMountCapability(mountType)) return SPELL_FAILED_NOT_HERE; break; @@ -2139,11 +2139,11 @@ SpellCastResult SpellInfo::CheckVehicle(Unit const* caster) const VehicleSeatEntry const* vehicleSeat = vehicle->GetSeatForPassenger(caster); if (!HasAttribute(SPELL_ATTR6_CASTABLE_WHILE_ON_VEHICLE) && !HasAttribute(SPELL_ATTR0_CASTABLE_WHILE_MOUNTED) - && (vehicleSeat->Flags[0] & checkMask) != checkMask) + && (vehicleSeat->Flags & checkMask) != checkMask) return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; // Can only summon uncontrolled minions/guardians when on controlled vehicle - if (vehicleSeat->Flags[0] & (VEHICLE_SEAT_FLAG_CAN_CONTROL | VEHICLE_SEAT_FLAG_UNK2)) + if (vehicleSeat->Flags & (VEHICLE_SEAT_FLAG_CAN_CONTROL | VEHICLE_SEAT_FLAG_UNK2)) { for (SpellEffectInfo const* effect : GetEffectsForDifficulty(caster->GetMap()->GetDifficultyID())) { @@ -2151,7 +2151,7 @@ SpellCastResult SpellInfo::CheckVehicle(Unit const* caster) const continue; SummonPropertiesEntry const* props = sSummonPropertiesStore.LookupEntry(effect->MiscValueB); - if (props && props->Category != SUMMON_CATEGORY_WILD) + if (props && props->Control != SUMMON_CATEGORY_WILD) return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; } } @@ -3473,20 +3473,14 @@ float SpellInfo::GetMinRange(bool positive) const { if (!RangeEntry) return 0.0f; - if (positive) - return RangeEntry->MinRangeFriend; - return RangeEntry->MinRangeHostile; + return RangeEntry->RangeMin[positive ? 1 : 0]; } float SpellInfo::GetMaxRange(bool positive, Unit* caster, Spell* spell) const { if (!RangeEntry) return 0.0f; - float range; - if (positive) - range = RangeEntry->MaxRangeFriend; - else - range = RangeEntry->MaxRangeHostile; + float range = RangeEntry->RangeMax[positive ? 1 : 0]; if (caster) if (Player* modOwner = caster->GetSpellModOwner()) modOwner->ApplySpellMod(Id, SPELLMOD_RANGE, range, spell); @@ -3539,9 +3533,9 @@ uint32 SpellInfo::CalcCastTime(uint8 level, Spell* spell /*= NULL*/) const if (calcLevel < 0) calcLevel = 0; - castTime = CastTimeEntry->CastTime + CastTimeEntry->CastTimePerLevel * level; - if (castTime < CastTimeEntry->MinCastTime) - castTime = CastTimeEntry->MinCastTime; + castTime = CastTimeEntry->Base + CastTimeEntry->PerLevel * level; + if (castTime < CastTimeEntry->Minimum) + castTime = CastTimeEntry->Minimum; } if (castTime <= 0) @@ -3606,7 +3600,7 @@ std::vector<SpellPowerCost> SpellInfo::CalcPowerCost(Unit const* caster, SpellSc for (SpellPowerEntry const* power : powers) { - if (power->RequiredAura && !caster->HasAura(power->RequiredAura)) + if (power->RequiredAuraSpellID && !caster->HasAura(power->RequiredAuraSpellID)) continue; // Spell drain all exist power on cast (Only paladin lay of Hands) @@ -3635,21 +3629,21 @@ std::vector<SpellPowerCost> SpellInfo::CalcPowerCost(Unit const* caster, SpellSc // Base powerCost int32 powerCost = power->ManaCost; // PCT cost from total amount - if (power->ManaCostPercentage) + if (power->PowerCostPct) { switch (power->PowerType) { // health as power used case POWER_HEALTH: - powerCost += int32(CalculatePct(caster->GetMaxHealth(), power->ManaCostPercentage)); + powerCost += int32(CalculatePct(caster->GetMaxHealth(), power->PowerCostPct)); break; case POWER_MANA: - powerCost += int32(CalculatePct(caster->GetCreateMana(), power->ManaCostPercentage)); + powerCost += int32(CalculatePct(caster->GetCreateMana(), power->PowerCostPct)); break; case POWER_RAGE: case POWER_FOCUS: case POWER_ENERGY: - powerCost += int32(CalculatePct(caster->GetMaxPower(Powers(power->PowerType)), power->ManaCostPercentage)); + powerCost += int32(CalculatePct(caster->GetMaxPower(Powers(power->PowerType)), power->PowerCostPct)); break; case POWER_RUNES: case POWER_RUNIC_POWER: @@ -3661,8 +3655,8 @@ std::vector<SpellPowerCost> SpellInfo::CalcPowerCost(Unit const* caster, SpellSc } } - if (power->HealthCostPercentage) - healthCost += int32(CalculatePct(caster->GetMaxHealth(), power->HealthCostPercentage)); + if (power->PowerCostMaxPct) + healthCost += int32(CalculatePct(caster->GetMaxHealth(), power->PowerCostMaxPct)); if (power->PowerType != POWER_HEALTH) { @@ -3701,13 +3695,13 @@ std::vector<SpellPowerCost> SpellInfo::CalcPowerCost(Unit const* caster, SpellSc // Apply cost mod by spell if (Player* modOwner = caster->GetSpellModOwner()) { - if (power->PowerIndex == 0) + if (power->OrderIndex == 0) modOwner->ApplySpellMod(Id, SPELLMOD_COST, powerCost); - else if (power->PowerIndex == 1) + else if (power->OrderIndex == 1) modOwner->ApplySpellMod(Id, SPELLMOD_SPELL_COST2, powerCost); } - if (!caster->IsControlledByPlayer() && G3D::fuzzyEq(power->ManaCostPercentage, 0.0f) && SpellLevel) + if (!caster->IsControlledByPlayer() && G3D::fuzzyEq(power->PowerCostPct, 0.0f) && SpellLevel) { if (HasAttribute(SPELL_ATTR0_LEVEL_DAMAGE_CALCULATION)) { @@ -3827,7 +3821,7 @@ inline float CalcPPMCritMod(SpellProcsPerMinuteModEntry const* mod, Unit* caster inline float CalcPPMItemLevelMod(SpellProcsPerMinuteModEntry const* mod, int32 itemLevel) { - if (uint32(itemLevel) == mod->Param) + if (itemLevel == mod->Param) return 0.0f; float itemLevelPoints = GetRandomPropertyPoints(itemLevel, ITEM_QUALITY_RARE, INVTYPE_CHEST, 0); @@ -3867,7 +3861,7 @@ float SpellInfo::CalcProcPPM(Unit* caster, int32 itemLevel) const case SPELL_PPM_MOD_SPEC: { if (Player* plrCaster = caster->ToPlayer()) - if (plrCaster->GetUInt32Value(PLAYER_FIELD_CURRENT_SPEC_ID) == mod->Param) + if (plrCaster->GetInt32Value(PLAYER_FIELD_CURRENT_SPEC_ID) == mod->Param) ppm *= 1.0f + mod->Coeff; break; } @@ -4012,7 +4006,7 @@ uint32 SpellInfo::GetSpellXSpellVisualId(Unit const* caster /*= nullptr*/) const { for (SpellXSpellVisualEntry const* visual : itr->second) { - PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(visual->PlayerConditionID); + PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(visual->CasterPlayerConditionID); if (!playerCondition || (caster->GetTypeId() == TYPEID_PLAYER && sConditionMgr->IsPlayerMeetingCondition(caster->ToPlayer(), playerCondition))) return visual->ID; } @@ -4027,7 +4021,7 @@ uint32 SpellInfo::GetSpellXSpellVisualId(Unit const* caster /*= nullptr*/) const { for (SpellXSpellVisualEntry const* visual : itr->second) { - PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(visual->PlayerConditionID); + PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(visual->CasterPlayerConditionID); if (!playerCondition || (caster && caster->GetTypeId() == TYPEID_PLAYER && sConditionMgr->IsPlayerMeetingCondition(caster->ToPlayer(), playerCondition))) return visual->ID; } |
