Forums WoW Modding Support Archives TrinityCore Discord Archives [DiscordArchive] I see its returning true / false but is the purpose to validate whether the spell is available to th

[DiscordArchive] I see its returning true / false but is the purpose to validate whether the spell is available to th

[DiscordArchive] I see its returning true / false but is the purpose to validate whether the spell is available to th

rektbyfaith
Administrator
0
01-11-2025, 06:46 PM
#1
Archived author: Drikish • Posted: 2025-01-11T18:46:53.102000+00:00
Original source

I see its returning true / false but is the purpose to validate whether the spell is available to the caster / off cooldown etc?
rektbyfaith
01-11-2025, 06:46 PM #1

Archived author: Drikish • Posted: 2025-01-11T18:46:53.102000+00:00
Original source

I see its returning true / false but is the purpose to validate whether the spell is available to the caster / off cooldown etc?

rektbyfaith
Administrator
0
01-11-2025, 06:46 PM
#2
Archived author: Northstrider • Posted: 2025-01-11T18:46:58.340000+00:00
Original source

it makes sure the spell script only loads when there is a spell with that Id
rektbyfaith
01-11-2025, 06:46 PM #2

Archived author: Northstrider • Posted: 2025-01-11T18:46:58.340000+00:00
Original source

it makes sure the spell script only loads when there is a spell with that Id

rektbyfaith
Administrator
0
01-11-2025, 06:47 PM
#3
Archived author: Drikish • Posted: 2025-01-11T18:47:04.462000+00:00
Original source

Ah ok
rektbyfaith
01-11-2025, 06:47 PM #3

Archived author: Drikish • Posted: 2025-01-11T18:47:04.462000+00:00
Original source

Ah ok

rektbyfaith
Administrator
0
01-11-2025, 06:47 PM
#4
Archived author: Northstrider • Posted: 2025-01-11T18:47:06.908000+00:00
Original source

a protection to make sure outdated/broken spell scripts wont load
rektbyfaith
01-11-2025, 06:47 PM #4

Archived author: Northstrider • Posted: 2025-01-11T18:47:06.908000+00:00
Original source

a protection to make sure outdated/broken spell scripts wont load

rektbyfaith
Administrator
0
01-11-2025, 06:47 PM
#5
Archived author: Drikish • Posted: 2025-01-11T18:47:19.548000+00:00
Original source

makes sense
rektbyfaith
01-11-2025, 06:47 PM #5

Archived author: Drikish • Posted: 2025-01-11T18:47:19.548000+00:00
Original source

makes sense

rektbyfaith
Administrator
0
01-11-2025, 06:47 PM
#6
Archived author: Drikish • Posted: 2025-01-11T18:47:32.857000+00:00
Original source

So anything your working with within the script should be validated to check that it exists before trying to use it
rektbyfaith
01-11-2025, 06:47 PM #6

Archived author: Drikish • Posted: 2025-01-11T18:47:32.857000+00:00
Original source

So anything your working with within the script should be validated to check that it exists before trying to use it

rektbyfaith
Administrator
0
01-11-2025, 06:48 PM
#7
Archived author: Northstrider • Posted: 2025-01-11T18:48:01.650000+00:00
Original source

whenever you want to use another spell or reference a spell effect, you always validate the spellInfo and the effect itself
rektbyfaith
01-11-2025, 06:48 PM #7

Archived author: Northstrider • Posted: 2025-01-11T18:48:01.650000+00:00
Original source

whenever you want to use another spell or reference a spell effect, you always validate the spellInfo and the effect itself

rektbyfaith
Administrator
0
01-11-2025, 06:48 PM
#8
Archived author: Drikish • Posted: 2025-01-11T18:48:11.724000+00:00
Original source

ok thanks
rektbyfaith
01-11-2025, 06:48 PM #8

Archived author: Drikish • Posted: 2025-01-11T18:48:11.724000+00:00
Original source

ok thanks

rektbyfaith
Administrator
0
01-11-2025, 06:48 PM
#9
Archived author: Drikish • Posted: 2025-01-11T18:48:15.392000+00:00
Original source

```c++
class spell_mage_arcane_barrage : public SpellScript
{

PrepareSpellScript(spell_mage_arcane_barrage);


bool Validate(SpellInfo const* spellInfo) override
{
return ValidateSpellInfo({ SPELL_MAGE_ARCANE_BARRAGE });
}

void ConsumeArcaneCharges()
{
GetCaster()->SetPower(POWER_ARCANE_CHARGES, 0);
}

void HandleEffectHitTarget(SpellEffIndex /*effIndex*/)
{

Unit* caster = GetCaster();

// If its not the primary target it uses effect 1 which hits for 50% damage - set this first before next check
if (GetHitUnit()->GetGUID() != _primaryTarget)
SetHitDamage(CalculatePct(GetHitDamage(), GetEffectInfo(EFFECT_1)->CalcValue(GetCaster())));

// If Player has the talent Resonance add % value per target hit
if (AuraEffect const* auraEffect = caster->GetAuraEffect(TALENT_MAGE_RESONANCE, EFFECT_0, caster->GetGUID()))
SetHitDamage(GetHitDamage() + CalculatePct(GetHitDamage(), auraEffect->GetAmount() * 5));


//GetSpell()->m_targets
}

void CountTargets(std::list<WorldObject*>& targets)
{
_targets = targets.size();
}

void MarkPrimaryTarget(SpellEffIndex /*effIndex*/)
{
_primaryTarget = GetHitUnit()->GetGUID();
}

void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_mage_arcane_barrage::HandleEffectHitTarget, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
OnEffectLaunchTarget += SpellEffectFn(spell_mage_arcane_barrage::MarkPrimaryTarget, EFFECT_1, SPELL_EFFECT_DUMMY);
AfterCast += SpellCastFn(spell_mage_arcane_barrage::ConsumeArcaneCharges);
}

int32 _targets;
ObjectGuid _primaryTarget;
};
```
rektbyfaith
01-11-2025, 06:48 PM #9

Archived author: Drikish • Posted: 2025-01-11T18:48:15.392000+00:00
Original source

```c++
class spell_mage_arcane_barrage : public SpellScript
{

PrepareSpellScript(spell_mage_arcane_barrage);


bool Validate(SpellInfo const* spellInfo) override
{
return ValidateSpellInfo({ SPELL_MAGE_ARCANE_BARRAGE });
}

void ConsumeArcaneCharges()
{
GetCaster()->SetPower(POWER_ARCANE_CHARGES, 0);
}

void HandleEffectHitTarget(SpellEffIndex /*effIndex*/)
{

Unit* caster = GetCaster();

// If its not the primary target it uses effect 1 which hits for 50% damage - set this first before next check
if (GetHitUnit()->GetGUID() != _primaryTarget)
SetHitDamage(CalculatePct(GetHitDamage(), GetEffectInfo(EFFECT_1)->CalcValue(GetCaster())));

// If Player has the talent Resonance add % value per target hit
if (AuraEffect const* auraEffect = caster->GetAuraEffect(TALENT_MAGE_RESONANCE, EFFECT_0, caster->GetGUID()))
SetHitDamage(GetHitDamage() + CalculatePct(GetHitDamage(), auraEffect->GetAmount() * 5));


//GetSpell()->m_targets
}

void CountTargets(std::list<WorldObject*>& targets)
{
_targets = targets.size();
}

void MarkPrimaryTarget(SpellEffIndex /*effIndex*/)
{
_primaryTarget = GetHitUnit()->GetGUID();
}

void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_mage_arcane_barrage::HandleEffectHitTarget, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
OnEffectLaunchTarget += SpellEffectFn(spell_mage_arcane_barrage::MarkPrimaryTarget, EFFECT_1, SPELL_EFFECT_DUMMY);
AfterCast += SpellCastFn(spell_mage_arcane_barrage::ConsumeArcaneCharges);
}

int32 _targets;
ObjectGuid _primaryTarget;
};
```

rektbyfaith
Administrator
0
01-11-2025, 06:48 PM
#10
Archived author: Drikish • Posted: 2025-01-11T18:48:32.252000+00:00
Original source

This is what I have so far, (I replaced the bit I need to fix with * 5 right now just so i could compile and test)
rektbyfaith
01-11-2025, 06:48 PM #10

Archived author: Drikish • Posted: 2025-01-11T18:48:32.252000+00:00
Original source

This is what I have so far, (I replaced the bit I need to fix with * 5 right now just so i could compile and test)

Recently Browsing
 1 Guest(s)
Recently Browsing
 1 Guest(s)