diff options
| author | Shauren <shauren.trinity@gmail.com> | 2016-08-15 00:03:38 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2016-08-15 00:03:38 +0200 |
| commit | fea0cb16f2e73ec21891ac14cdc10d9d8f518cfe (patch) | |
| tree | 7e3a6ee9b3876ca5b3a7115a9d932ce8125c41e1 /src/server/game/Spells | |
| parent | f8c5a2c723c734513eddc98a5c7f380c2f00e479 (diff) | |
Core/Items: Implemented artifacts
Diffstat (limited to 'src/server/game/Spells')
| -rw-r--r-- | src/server/game/Spells/Spell.cpp | 19 | ||||
| -rw-r--r-- | src/server/game/Spells/Spell.h | 3 | ||||
| -rw-r--r-- | src/server/game/Spells/SpellEffects.cpp | 30 |
3 files changed, 49 insertions, 3 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 16227861a26..14d5f27b182 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -5416,6 +5416,25 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_CANT_UNTALENT; break; } + case SPELL_EFFECT_GIVE_ARTIFACT_POWER: + case SPELL_EFFECT_GIVE_ARTIFACT_POWER_NO_BONUS: + { + if (m_caster->GetTypeId() != TYPEID_PLAYER) + return SPELL_FAILED_BAD_TARGETS; + Aura* artifactAura = m_caster->GetAura(ARTIFACTS_ALL_WEAPONS_GENERAL_WEAPON_EQUIPPED_PASSIVE); + if (!artifactAura) + return SPELL_FAILED_NO_ARTIFACT_EQUIPPED; + Item* artifact = m_caster->ToPlayer()->GetItemByGuid(artifactAura->GetCastItemGUID()); + if (!artifact) + return SPELL_FAILED_NO_ARTIFACT_EQUIPPED; + if (effect->Effect == SPELL_EFFECT_GIVE_ARTIFACT_POWER) + { + ArtifactEntry const* artifactEntry = sArtifactStore.LookupEntry(artifact->GetTemplate()->GetArtifactID()); + if (!artifactEntry || artifactEntry->ArtifactCategoryID != effect->MiscValue) + return SPELL_FAILED_WRONG_ARTIFACT_EQUIPPED; + } + break; + } default: break; } diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index e369ed29242..33e3107dc03 100644 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -394,7 +394,6 @@ class TC_GAME_API Spell void EffectMilling(SpellEffIndex effIndex); void EffectRenamePet(SpellEffIndex effIndex); void EffectSendTaxi(SpellEffIndex effIndex); - void EffectSummonCritter(SpellEffIndex effIndex); void EffectKnockBack(SpellEffIndex effIndex); void EffectPullTowards(SpellEffIndex effIndex); void EffectDispelMechanic(SpellEffIndex effIndex); @@ -453,6 +452,8 @@ class TC_GAME_API Spell void EffectApplyEnchantIllusion(SpellEffIndex effIndex); void EffectUpdatePlayerPhase(SpellEffIndex effIndex); void EffectUpdateZoneAurasAndPhases(SpellEffIndex effIndex); + void EffectGiveArtifactPower(SpellEffIndex effIndex); + void EffectGiveArtifactPowerNoBonus(SpellEffIndex effIndex); typedef std::set<Aura*> UsedSpellMods; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index f84704f09c6..4e95cb81afb 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -304,9 +304,9 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]= &Spell::EffectNULL, //237 SPELL_EFFECT_GIVE_RESTED_EXPERIENCE_BONUS &Spell::EffectNULL, //238 SPELL_EFFECT_INCREASE_SKILL &Spell::EffectNULL, //239 SPELL_EFFECT_END_GARRISON_BUILDING_CONSTRUCTION - &Spell::EffectNULL, //240 SPELL_EFFECT_GIVE_ARTIFACT_POWER + &Spell::EffectGiveArtifactPower, //240 SPELL_EFFECT_GIVE_ARTIFACT_POWER &Spell::EffectNULL, //241 SPELL_EFFECT_241 - &Spell::EffectNULL, //242 SPELL_EFFECT_GIVE_ARTIFACT_POWER_NO_BONUS + &Spell::EffectGiveArtifactPowerNoBonus, //242 SPELL_EFFECT_GIVE_ARTIFACT_POWER_NO_BONUS &Spell::EffectApplyEnchantIllusion, //243 SPELL_EFFECT_APPLY_ENCHANT_ILLUSION &Spell::EffectNULL, //244 SPELL_EFFECT_LEARN_FOLLOWER_ABILITY &Spell::EffectUpgradeHeirloom, //245 SPELL_EFFECT_UPGRADE_HEIRLOOM @@ -5831,3 +5831,29 @@ void Spell::EffectUpdateZoneAurasAndPhases(SpellEffIndex /*effIndex*/) unitTarget->ToPlayer()->UpdateAreaDependentAuras(unitTarget->GetAreaId()); } + +void Spell::EffectGiveArtifactPower(SpellEffIndex /*effIndex*/) +{ + if (effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH_TARGET) + return; + + if (m_caster->GetTypeId() != TYPEID_PLAYER) + return; + + if (Aura* artifactAura = m_caster->GetAura(ARTIFACTS_ALL_WEAPONS_GENERAL_WEAPON_EQUIPPED_PASSIVE)) + if (Item* artifact = m_caster->ToPlayer()->GetItemByGuid(artifactAura->GetCastItemGUID())) + artifact->GiveArtifactXp(damage, m_CastItem, uint32(effectInfo->MiscValue)); +} + +void Spell::EffectGiveArtifactPowerNoBonus(SpellEffIndex /*effIndex*/) +{ + if (effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH_TARGET) + return; + + if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) + return; + + if (Aura* artifactAura = unitTarget->GetAura(ARTIFACTS_ALL_WEAPONS_GENERAL_WEAPON_EQUIPPED_PASSIVE)) + if (Item* artifact = unitTarget->ToPlayer()->GetItemByGuid(artifactAura->GetCastItemGUID())) + artifact->GiveArtifactXp(damage, m_CastItem, 0); +} |
