Aura 402. #678
Comments
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. |
@AriDEV, @Shoxxo need you 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. |
You should set him back his original power type if apply == false, not the one from MiscValue |
Unfortunately I do not know how to do it. No similar examples. |
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 |
Ra-den on spellhit aura 402 set powertype on blue(POWER_VITA) /red(POWER_ANIMA). SetPowerType and SetPowerDisplay. |
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
|
@Shoxxo thanks, but I read this already. Need understand, how make this without vehicle. |
|
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) |
Trinity implement aura. But on Skyfire not have handle power display from dbc. |
Any feedback? |
Nope, atm we are most time IRL!!! |
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? |
Create a pullrequest with your fix and travis tells you the result! |
Implemented : |
Currently not handled in the core. I can guess that it changes the power display for npc and player.
SpellWork data:
The text was updated successfully, but these errors were encountered: