Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Aura 402. #678

Closed
ghost opened this issue Jan 15, 2016 · 17 comments
Closed

Aura 402. #678

ghost opened this issue Jan 15, 2016 · 17 comments

Comments

@ghost
Copy link

ghost commented Jan 15, 2016

Currently not handled in the core. I can guess that it changes the power display for npc and player.
SpellWork data:

ID - 138331 Imbued with Anima
=================================================
Description: Empowered with Anima.

ToolTip: Empowered with Anima.
Category = 0, SpellIconID = 5819, activeIconID = 0, SpellVisual = (0,0)
Family SPELLFAMILY_GENERIC, flag [0] 0x00000000 [1] 0x00000000 [2] 0x00000000

SpellSchoolMask = 32 (SPELL_SCHOOL_MASK_SHADOW)
DamageClass = 0 (SPELL_DAMAGE_CLASS_NONE)
PreventionType = 0 (SPELL_PREVENTION_TYPE_NONE)
=================================================
AttributesEx2: 0x00000004 (SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS)
=================================================
Spell Level = 0, base 0, max 0

Category = 0
DispelType = 0 (DISPEL_NONE)
Mechanic = 0 (MECHANIC_NONE)
SpellRange: (Id 1) "Self Only":
    MinRangeNegative = 0, MinRangePositive = 0
    MaxRangeNegative = 0, MaxRangePositive = 0

Cast time (Id 1) = 0,00
Duration: ID (21)  -1, 0, -1
Interrupt Flags: 0x00000000, AuraIF 0x00000000, ChannelIF 0x00000000
Chance = 0, charges - 0
=================================================
Effect 0: Id 6 (SPELL_EFFECT_APPLY_AURA) RegularDifficulty
BasePoints = 0
Targets (1, 0) (TARGET_UNIT_CASTER, NO_TARGET)
Aura Id 402 (402), value = 0, misc = 215 (215), miscB = 0, periodic = 0

Effect 1: Id 6 (SPELL_EFFECT_APPLY_AURA) RegularDifficulty
BasePoints = 3
Targets (1, 0) (TARGET_UNIT_CASTER, NO_TARGET)
Aura Id 21 (SPELL_AURA_OBS_MOD_POWER), value = 3, misc = 0 (0), miscB = 0, periodic = 1000
ID - 138332 Imbued with Vita
=================================================
Description: Empowered with Vita.

ToolTip: Empowered with Vita.
Category = 0, SpellIconID = 2018, activeIconID = 0, SpellVisual = (0,0)
Family SPELLFAMILY_GENERIC, flag [0] 0x00000000 [1] 0x00000000 [2] 0x00000000

SpellSchoolMask = 32 (SPELL_SCHOOL_MASK_SHADOW)
DamageClass = 0 (SPELL_DAMAGE_CLASS_NONE)
PreventionType = 0 (SPELL_PREVENTION_TYPE_NONE)
=================================================
AttributesEx2: 0x00000004 (SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS)
=================================================
Spell Level = 0, base 0, max 0

Category = 0
DispelType = 0 (DISPEL_NONE)
Mechanic = 0 (MECHANIC_NONE)
SpellRange: (Id 1) "Self Only":
    MinRangeNegative = 0, MinRangePositive = 0
    MaxRangeNegative = 0, MaxRangePositive = 0

Cast time (Id 1) = 0,00
Duration: ID (21)  -1, 0, -1
Interrupt Flags: 0x00000000, AuraIF 0x00000000, ChannelIF 0x00000000
Chance = 0, charges - 0
=================================================
Effect 0: Id 6 (SPELL_EFFECT_APPLY_AURA) RegularDifficulty
BasePoints = 0
Targets (1, 0) (TARGET_UNIT_CASTER, NO_TARGET)
Aura Id 402 (402), value = 0, misc = 216 (216), miscB = 0, periodic = 0

Effect 1: Id 6 (SPELL_EFFECT_APPLY_AURA) RegularDifficulty
BasePoints = 10
Targets (1, 0) (TARGET_UNIT_CASTER, NO_TARGET)
Aura Id 24 (SPELL_AURA_PERIODIC_ENERGIZE), value = 10, misc = 0 (0), miscB = 0, periodic = 1000
@ghost
Copy link
Author

ghost commented Apr 21, 2016

I see in enums vehicle (I know, aura not have vehicle id in dbc)

enum PowerType
{
    POWER_STEAM                                  = 61,
    POWER_PYRITE                                 = 41,
    POWER_HEAT                                   = 101,
    POWER_OOZE                                   = 121,
    POWER_BLOOD                                  = 141,
    POWER_WRATH                                  = 142,
    POWER_ARCANE_ENERGY                          = 143,
    POWER_LIFE_ENERGY                            = 144,
    POWER_SUN_ENERGY                             = 145,
    POWER_SWING_VELOCITY                         = 146,
    POWER_SHADOWFLAME_ENERGY                     = 147,
    POWER_BLUE_POWER                             = 148,
    POWER_PURPLE_POWER                           = 149,
    POWER_GREEN_POWER                            = 150,
    POWER_ORANGE_POWER                           = 151,
    POWER_ENERGY_2                               = 153,
    POWER_ARCANEENERGY                           = 161,
    POWER_WIND_POWER_1                           = 162,
    POWER_WIND_POWER_2                           = 163,
    POWER_WIND_POWER_3                           = 164,
    POWER_FUEL                                   = 165,
    POWER_SUN_POWER                              = 166,
    POWER_TWILIGHT_ENERGY                        = 169,
    POWER_VENOM                                  = 174,
    POWER_ORANGE_POWER_2                         = 176,
    POWER_CONSUMING_FLAME                        = 177,
    POWER_PYROCLASTIC_FRENZY                     = 178,
    POWER_FLASHFIRE                              = 179,
};

I think for clarify need add more enums:

enum PowerType
{
    POWER_FEL_ENERGY                    = 181,                 // Fel energy used for warlock pets.
    POWER_VITA                                    = 215,                // Power of Unstable Vita, used for Ra-den encounter.
    POWER_ANIMA                                = 216,                // Power of Unstable Anima, used for Ra-den encounter.
};

Power display install without vehicle.
Aura 402 in my understanding.
value = 0, It means 0 power value.
misc 216 = power display.
miscB 0 = power type, in current case - this is mana.

@SkyFire, @Arcidev, @AriDEV, @Sovak, @Shoxxo All right?

@ghost
Copy link
Author

ghost commented May 25, 2016

@AriDEV, @Shoxxo need you help.
Maybe this can help.

&AuraEffect::HandleAuraSetDisplayPower,                                      //402 SPELL_AURA_SET_DISPLAY_POWER
void AuraEffect::HandleAuraSetDisplayPower(AuraApplication const* aurApp, uint8 mode, bool apply) const
{
    Powers powerType = Powers(GetMiscValue());
    Powers powerDisplay = Powers(GetMiscValueB());

    if (!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
        return;

    Unit* target = aurApp->GetTarget();

    if (apply)
    {
        target->SetPowerType(Powers(powerType));
        target->SetFieldPowerType(powerDisplay);
        int32 gain = target->ModifyPower(powerType, amount);
    }
    else
    {
        if (target->HasAuraType(SPELL_AURA_SET_DISPLAY_POWER))
            return;

        target->SetPowerType(Powers(powerType));
        target->SetFieldPowerType(powerType);
    }
}

Need any feedback.

@Arcidev
Copy link
Contributor

Arcidev commented May 25, 2016

You should set him back his original power type if apply == false, not the one from MiscValue

@ghost
Copy link
Author

ghost commented May 25, 2016

Unfortunately I do not know how to do it. No similar examples.

@Arcidev
Copy link
Contributor

Arcidev commented May 26, 2016

You could save active power before changing it with spell (some private property should be enough). Because of druids (and their 3 power types) you should not allow to change it upon change of the current form (not sure if it can affect players or not). And if there are more than just 1 aura of type SPELL_AURA_SET_DISPLAY_POWER on 1 unit you should be aware that you have to override the power with the next aura that is active on unit upon removing it.

Or you can just get the power according to class and stance/form/whatever else while removing it. But still you have to be aware that there can be more than just 1 aura of type 402 and that changing form is also changing power type

@ghost
Copy link
Author

ghost commented May 26, 2016

Ra-den on spellhit aura 402 set powertype on blue(POWER_VITA) /red(POWER_ANIMA). SetPowerType and SetPowerDisplay.
That's all I know. You can tell how to restore the original powertype, say what you need to adjust something to add, and what to remove?

@ghost
Copy link
Author

ghost commented Jun 3, 2016

I cannot understand how install m_powertype without vehicle. Aura should able this, but how? How?
Summon @Shoxxo
Summon @Arcidev
Summon @SkyFire
Summon @AriDEV

@JustZerooo
Copy link

void Vehicle::Install()
{
    if (Creature* creature = _me->ToCreature())
    {
        switch (_vehicleInfo->m_powerType)
        {
            case POWER_STEAM:
            case POWER_HEAT:
            case POWER_BLOOD:
            case POWER_OOZE:
            case POWER_WRATH:
                _me->setPowerType(POWER_ENERGY);
                _me->SetMaxPower(POWER_ENERGY, 100);
                break;
            case POWER_PYRITE:
                _me->setPowerType(POWER_ENERGY);
                _me->SetMaxPower(POWER_ENERGY, 50);
                break;
            default:
                for (uint32 i = 0; i < MAX_SPELL_VEHICLE; ++i)
                {
                    if (!creature->m_spells[i])
                        continue;

                    SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(creature->m_spells[i]);
                    if (!spellInfo)
                        continue;

                    if (spellInfo->PowerType == POWER_ENERGY)
                    {
                        _me->setPowerType(POWER_ENERGY);
                        _me->SetMaxPower(POWER_ENERGY, 100);
                        break;
                    }
                }
                break;
        }

        if (_vehicleInfo->m_powerType == POWER_PYRITE)
            creature->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER);
    }

    _status = STATUS_INSTALLED;
    if (GetBase()->GetTypeId() == TYPEID_UNIT)
        sScriptMgr->OnInstall(this);
}

--------------------------------

            /*if (m_regenTimer <= diff)
            {*/
            if (!bInCombat || IsPolymorphed()) // regenerate health if not in combat or if polymorphed
                RegenerateHealth();

            if (getPowerType() == POWER_ENERGY)
            {
                 if (!IsVehicle() || 
                    (GetVehicleKit()->GetVehicleInfo()->m_powerType != POWER_PYRITE && 
                    GetVehicleKit()->GetVehicleInfo()->m_powerType != POWER_HEAT))
                    Regenerate(POWER_ENERGY);
            }
            else
                RegenerateMana();

-------------------------------------------


uint32  m_powerType;                                    // 39, new in 3.1

@ghost
Copy link
Author

ghost commented Jun 3, 2016

@Shoxxo thanks, but I read this already. Need understand, how make this without vehicle.
Ra-den not vehicle creature.

@soulfrost
Copy link

@Ulduar

 ->setPowerType(type);
 ->SetMaxPower(type, value);

@ghost
Copy link
Author

ghost commented Jun 4, 2016

UNIT_FIELD_DISPLAY_POWER                                 = OBJECT_END + 0x17, // Size: 1, Flags: UF_FLAG_PUBLIC
    UNIT_FIELD_OVERRIDE_DISPLAY_POWER_ID                     = OBJECT_END + 0x18, // Size: 1, Flags: UF_FLAG_PUBLIC

These two values then play the role? One of them is responsible for what I need. Or no one...

void AuraEffect::HandleAuraSetDisplayPower(AuraApplication const* aurApp, uint8 mode, bool apply) const
{
    Powers powerType = Powers(GetMiscValueB());
    Powers powerDisplay = Powers(GetMiscValue());

    if (!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
        return;

    Unit* target = aurApp->GetTarget();

    if (apply)
    {
        target->SetPowerType(Powers(powerType));
        target->SetFieldPowerType(powerDisplay);
        int32 gain = target->ModifyPower(powerType, amount);
    }
    else
    {
        if (target->HasAuraType(SPELL_AURA_SET_DISPLAY_POWER))
            return;

        target->SetPowerType(Powers(powerType));
        target->SetFieldPowerType(powerType);
    }
}

Power display = MiscValue (not B)
Power Type = MiscValueB
POWER_VITA = 216, POWER_ANIMA = 215.
Vita have blue indicator, Anima have red indicator.

@ghost
Copy link
Author

ghost commented Jul 5, 2016

Trinity implement aura. But on Skyfire not have handle power display from dbc.
TrinityCore/TrinityCore@1b1478b

@ghost
Copy link
Author

ghost commented Sep 3, 2016

Any feedback?

@JustZerooo
Copy link

Nope, atm we are most time IRL!!!

@ghost
Copy link
Author

ghost commented Jan 22, 2018

class spell_generic_override_display_power : public SpellScriptLoader
{
    public:
        spell_generic_override_display_power() : SpellScriptLoader("spell_generic_override_display_power") { }

        class spell_generic_override_display_power_AuraScript : public AuraScript
        {
            PrepareAuraScript(spell_generic_override_display_power_AuraScript);

            void OnApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
            {
                if (Unit* target = GetTarget())
                    target->SetUInt32Value(UNIT_FIELD_OVERRIDE_DISPLAY_POWER_ID, aurEff->GetMiscValue());
            }

            void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
            {
                if (Unit* target = GetTarget())
                    target->SetUInt32Value(UNIT_FIELD_OVERRIDE_DISPLAY_POWER_ID, 0);
            }

            void Register() override
            {
			    if (m_scriptSpellId == 123933 || m_scriptSpellId == 145627 || m_scriptSpellId == 145628)
                    OnEffectApply += AuraEffectApplyFn(spell_generic_override_display_power_AuraScript::OnApply, EFFECT_1, SPELL_AURA_402, AURA_EFFECT_HANDLE_REAL);
				else if (m_scriptSpellId == 145044)
					OnEffectApply += AuraEffectApplyFn(spell_generic_override_display_power_AuraScript::OnApply, EFFECT_4, SPELL_AURA_402, AURA_EFFECT_HANDLE_REAL);
				else
					OnEffectApply += AuraEffectApplyFn(spell_generic_override_display_power_AuraScript::OnApply, EFFECT_0, SPELL_AURA_402, AURA_EFFECT_HANDLE_REAL);
				if (m_scriptSpellId == 123933 || m_scriptSpellId == 145627 || m_scriptSpellId == 145628)
                    OnEffectRemove += AuraEffectRemoveFn(spell_generic_override_display_power_AuraScript::OnRemove, EFFECT_1, SPELL_AURA_402, AURA_EFFECT_HANDLE_REAL);
				else if (m_scriptSpellId == 145044)
					OnEffectRemove += AuraEffectRemoveFn(spell_generic_override_display_power_AuraScript::OnRemove, EFFECT_4, SPELL_AURA_402, AURA_EFFECT_HANDLE_REAL);
				else
					OnEffectRemove += AuraEffectRemoveFn(spell_generic_override_display_power_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_402, AURA_EFFECT_HANDLE_REAL);
            }
        };

        AuraScript* GetAuraScript() const override
        {
            return new spell_generic_override_display_power_AuraScript();
        }
};

Maybe this?
Code not checked.

@JustZerooo
Copy link

Create a pullrequest with your fix and travis tells you the result!

@JustZerooo
Copy link

Implemented :

c902876

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants