still crash
This commit is contained in:
@@ -9009,7 +9009,7 @@ void Unit::SetFlightCapabilityID(int32 flightCapabilityId, bool clientUpdate)
|
||||
if (flightCapabilityId && !sFlightCapabilityStore.HasRecord(flightCapabilityId))
|
||||
return;
|
||||
|
||||
SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::FlightCapabilityID), flightCapabilityId);
|
||||
/* SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::FlightCapabilityID), flightCapabilityId);
|
||||
|
||||
UpdateAdvFlyingSpeed(ADV_FLYING_AIR_FRICTION, clientUpdate);
|
||||
UpdateAdvFlyingSpeed(ADV_FLYING_MAX_VEL, clientUpdate);
|
||||
@@ -9023,7 +9023,7 @@ void Unit::SetFlightCapabilityID(int32 flightCapabilityId, bool clientUpdate)
|
||||
UpdateAdvFlyingSpeed(ADV_FLYING_TURN_VELOCITY_THRESHOLD, clientUpdate);
|
||||
UpdateAdvFlyingSpeed(ADV_FLYING_SURFACE_FRICTION, clientUpdate);
|
||||
UpdateAdvFlyingSpeed(ADV_FLYING_OVER_MAX_DECELERATION, clientUpdate);
|
||||
UpdateAdvFlyingSpeed(ADV_FLYING_LAUNCH_SPEED_COEFFICIENT, clientUpdate);
|
||||
UpdateAdvFlyingSpeed(ADV_FLYING_LAUNCH_SPEED_COEFFICIENT, clientUpdate);*/
|
||||
}
|
||||
|
||||
void Unit::UpdateAdvFlyingSpeed(AdvFlyingRateTypeSingle speedType, bool clientUpdate)
|
||||
@@ -9032,59 +9032,59 @@ void Unit::UpdateAdvFlyingSpeed(AdvFlyingRateTypeSingle speedType, bool clientUp
|
||||
if (!flightCapabilityEntry)
|
||||
flightCapabilityEntry = sFlightCapabilityStore.AssertEntry(1);
|
||||
|
||||
auto [opcode, newValue, rateAura] = [&]
|
||||
{
|
||||
switch (speedType)
|
||||
{
|
||||
case ADV_FLYING_AIR_FRICTION:
|
||||
return std::tuple(SMSG_MOVE_SET_ADV_FLYING_AIR_FRICTION, flightCapabilityEntry->AirFriction, SPELL_AURA_MOD_ADV_FLYING_AIR_FRICTION);
|
||||
case ADV_FLYING_MAX_VEL:
|
||||
return std::tuple(SMSG_MOVE_SET_ADV_FLYING_MAX_VEL, flightCapabilityEntry->MaxVel, SPELL_AURA_MOD_ADV_FLYING_MAX_VEL);
|
||||
case ADV_FLYING_LIFT_COEFFICIENT:
|
||||
return std::tuple(SMSG_MOVE_SET_ADV_FLYING_LIFT_COEFFICIENT, flightCapabilityEntry->LiftCoefficient, SPELL_AURA_MOD_ADV_FLYING_LIFT_COEF);
|
||||
case ADV_FLYING_DOUBLE_JUMP_VEL_MOD:
|
||||
return std::tuple(SMSG_MOVE_SET_ADV_FLYING_DOUBLE_JUMP_VEL_MOD, flightCapabilityEntry->DoubleJumpVelMod, SPELL_AURA_NONE);
|
||||
case ADV_FLYING_GLIDE_START_MIN_HEIGHT:
|
||||
return std::tuple(SMSG_MOVE_SET_ADV_FLYING_GLIDE_START_MIN_HEIGHT, flightCapabilityEntry->GlideStartMinHeight, SPELL_AURA_NONE);
|
||||
case ADV_FLYING_ADD_IMPULSE_MAX_SPEED:
|
||||
return std::tuple(SMSG_MOVE_SET_ADV_FLYING_ADD_IMPULSE_MAX_SPEED, flightCapabilityEntry->AddImpulseMaxSpeed, SPELL_AURA_MOD_ADV_FLYING_ADD_IMPULSE_MAX_SPEED);
|
||||
case ADV_FLYING_SURFACE_FRICTION:
|
||||
return std::tuple(SMSG_MOVE_SET_ADV_FLYING_SURFACE_FRICTION, flightCapabilityEntry->SurfaceFriction, SPELL_AURA_NONE);
|
||||
case ADV_FLYING_OVER_MAX_DECELERATION:
|
||||
return std::tuple(SMSG_MOVE_SET_ADV_FLYING_OVER_MAX_DECELERATION, flightCapabilityEntry->OverMaxDeceleration, SPELL_AURA_MOD_ADV_FLYING_OVER_MAX_DECELERATION);
|
||||
case ADV_FLYING_LAUNCH_SPEED_COEFFICIENT:
|
||||
return std::tuple(SMSG_MOVE_SET_ADV_FLYING_LAUNCH_SPEED_COEFFICIENT, flightCapabilityEntry->LaunchSpeedCoefficient, SPELL_AURA_NONE);
|
||||
default:
|
||||
return std::tuple<OpcodeServer, float, AuraType>();
|
||||
}
|
||||
}();
|
||||
//auto [opcode, newValue, rateAura] = [&]
|
||||
// {
|
||||
// switch (speedType)
|
||||
// {
|
||||
// case ADV_FLYING_AIR_FRICTION:
|
||||
// return std::tuple(SMSG_MOVE_SET_ADV_FLYING_AIR_FRICTION, flightCapabilityEntry->AirFriction, SPELL_AURA_MOD_ADV_FLYING_AIR_FRICTION);
|
||||
// case ADV_FLYING_MAX_VEL:
|
||||
// return std::tuple(SMSG_MOVE_SET_ADV_FLYING_MAX_VEL, flightCapabilityEntry->MaxVel, SPELL_AURA_MOD_ADV_FLYING_MAX_VEL);
|
||||
// case ADV_FLYING_LIFT_COEFFICIENT:
|
||||
// return std::tuple(SMSG_MOVE_SET_ADV_FLYING_LIFT_COEFFICIENT, flightCapabilityEntry->LiftCoefficient, SPELL_AURA_MOD_ADV_FLYING_LIFT_COEF);
|
||||
// case ADV_FLYING_DOUBLE_JUMP_VEL_MOD:
|
||||
// return std::tuple(SMSG_MOVE_SET_ADV_FLYING_DOUBLE_JUMP_VEL_MOD, flightCapabilityEntry->DoubleJumpVelMod, SPELL_AURA_NONE);
|
||||
// case ADV_FLYING_GLIDE_START_MIN_HEIGHT:
|
||||
// return std::tuple(SMSG_MOVE_SET_ADV_FLYING_GLIDE_START_MIN_HEIGHT, flightCapabilityEntry->GlideStartMinHeight, SPELL_AURA_NONE);
|
||||
// case ADV_FLYING_ADD_IMPULSE_MAX_SPEED:
|
||||
// return std::tuple(SMSG_MOVE_SET_ADV_FLYING_ADD_IMPULSE_MAX_SPEED, flightCapabilityEntry->AddImpulseMaxSpeed, SPELL_AURA_MOD_ADV_FLYING_ADD_IMPULSE_MAX_SPEED);
|
||||
// case ADV_FLYING_SURFACE_FRICTION:
|
||||
// return std::tuple(SMSG_MOVE_SET_ADV_FLYING_SURFACE_FRICTION, flightCapabilityEntry->SurfaceFriction, SPELL_AURA_NONE);
|
||||
// case ADV_FLYING_OVER_MAX_DECELERATION:
|
||||
// return std::tuple(SMSG_MOVE_SET_ADV_FLYING_OVER_MAX_DECELERATION, flightCapabilityEntry->OverMaxDeceleration, SPELL_AURA_MOD_ADV_FLYING_OVER_MAX_DECELERATION);
|
||||
// case ADV_FLYING_LAUNCH_SPEED_COEFFICIENT:
|
||||
// return std::tuple(SMSG_MOVE_SET_ADV_FLYING_LAUNCH_SPEED_COEFFICIENT, flightCapabilityEntry->LaunchSpeedCoefficient, SPELL_AURA_NONE);
|
||||
// default:
|
||||
// return std::tuple<OpcodeServer, float, AuraType>();
|
||||
// }
|
||||
// }();
|
||||
|
||||
if (rateAura != SPELL_AURA_NONE)
|
||||
{
|
||||
// take only lowest negative and highest positive auras - these effects do not stack
|
||||
if (float neg = GetMaxNegativeAuraModifier(rateAura, [](AuraEffect const* mod) { return mod->GetAmount() > 0 && mod->GetAmount() < 100; }))
|
||||
ApplyPct(newValue, neg);
|
||||
//if (rateAura != SPELL_AURA_NONE)
|
||||
//{
|
||||
// // take only lowest negative and highest positive auras - these effects do not stack
|
||||
// if (float neg = GetMaxNegativeAuraModifier(rateAura, [](AuraEffect const* mod) { return mod->GetAmount() > 0 && mod->GetAmount() < 100; }))
|
||||
// ApplyPct(newValue, neg);
|
||||
|
||||
if (float pos = GetMaxPositiveAuraModifier(rateAura, [](AuraEffect const* mod) { return mod->GetAmount() > 100; }))
|
||||
ApplyPct(newValue, pos);
|
||||
}
|
||||
// if (float pos = GetMaxPositiveAuraModifier(rateAura, [](AuraEffect const* mod) { return mod->GetAmount() > 100; }))
|
||||
// ApplyPct(newValue, pos);
|
||||
//}
|
||||
|
||||
if (m_advFlyingSpeed[speedType] == newValue)
|
||||
return;
|
||||
//if (m_advFlyingSpeed[speedType] == newValue)
|
||||
// return;
|
||||
|
||||
m_advFlyingSpeed[speedType] = newValue;
|
||||
//m_advFlyingSpeed[speedType] = newValue;
|
||||
|
||||
if (!clientUpdate)
|
||||
return;
|
||||
//if (!clientUpdate)
|
||||
// return;
|
||||
|
||||
if (Player* playerMover = Unit::ToPlayer(GetUnitBeingMoved()))
|
||||
{
|
||||
WorldPackets::Movement::SetAdvFlyingSpeed selfpacket(opcode);
|
||||
selfpacket.MoverGUID = GetGUID();
|
||||
selfpacket.SequenceIndex = m_movementCounter++;
|
||||
selfpacket.Speed = newValue;
|
||||
playerMover->GetSession()->SendPacket(selfpacket.Write());
|
||||
}
|
||||
//if (Player* playerMover = Unit::ToPlayer(GetUnitBeingMoved()))
|
||||
//{
|
||||
// WorldPackets::Movement::SetAdvFlyingSpeed selfpacket(opcode);
|
||||
// selfpacket.MoverGUID = GetGUID();
|
||||
// selfpacket.SequenceIndex = m_movementCounter++;
|
||||
// selfpacket.Speed = newValue;
|
||||
// playerMover->GetSession()->SendPacket(selfpacket.Write());
|
||||
//}
|
||||
}
|
||||
|
||||
void Unit::UpdateAdvFlyingSpeed(AdvFlyingRateTypeRange speedType, bool clientUpdate)
|
||||
@@ -9093,57 +9093,57 @@ void Unit::UpdateAdvFlyingSpeed(AdvFlyingRateTypeRange speedType, bool clientUpd
|
||||
if (!flightCapabilityEntry)
|
||||
flightCapabilityEntry = sFlightCapabilityStore.AssertEntry(1);
|
||||
|
||||
auto [opcode, min, max, rateAura] = [&]
|
||||
{
|
||||
switch (speedType)
|
||||
{
|
||||
case ADV_FLYING_BANKING_RATE:
|
||||
return std::tuple(SMSG_MOVE_SET_ADV_FLYING_BANKING_RATE, flightCapabilityEntry->BankingRateMin, flightCapabilityEntry->BankingRateMax, SPELL_AURA_MOD_ADV_FLYING_BANKING_RATE);
|
||||
case ADV_FLYING_PITCHING_RATE_DOWN:
|
||||
return std::tuple(SMSG_MOVE_SET_ADV_FLYING_PITCHING_RATE_DOWN, flightCapabilityEntry->PitchingRateDownMin, flightCapabilityEntry->PitchingRateDownMax, SPELL_AURA_MOD_ADV_FLYING_PITCHING_RATE_DOWN);
|
||||
case ADV_FLYING_PITCHING_RATE_UP:
|
||||
return std::tuple(SMSG_MOVE_SET_ADV_FLYING_PITCHING_RATE_UP, flightCapabilityEntry->PitchingRateUpMin, flightCapabilityEntry->PitchingRateUpMax, SPELL_AURA_MOD_ADV_FLYING_PITCHING_RATE_UP);
|
||||
case ADV_FLYING_TURN_VELOCITY_THRESHOLD:
|
||||
return std::tuple(SMSG_MOVE_SET_ADV_FLYING_TURN_VELOCITY_THRESHOLD, flightCapabilityEntry->TurnVelocityThresholdMin, flightCapabilityEntry->TurnVelocityThresholdMax, SPELL_AURA_NONE);
|
||||
default:
|
||||
return std::tuple<OpcodeServer, float, float, AuraType>();
|
||||
}
|
||||
}();
|
||||
//auto [opcode, min, max, rateAura] = [&]
|
||||
// {
|
||||
// switch (speedType)
|
||||
// {
|
||||
// case ADV_FLYING_BANKING_RATE:
|
||||
// return std::tuple(SMSG_MOVE_SET_ADV_FLYING_BANKING_RATE, flightCapabilityEntry->BankingRateMin, flightCapabilityEntry->BankingRateMax, SPELL_AURA_MOD_ADV_FLYING_BANKING_RATE);
|
||||
// case ADV_FLYING_PITCHING_RATE_DOWN:
|
||||
// return std::tuple(SMSG_MOVE_SET_ADV_FLYING_PITCHING_RATE_DOWN, flightCapabilityEntry->PitchingRateDownMin, flightCapabilityEntry->PitchingRateDownMax, SPELL_AURA_MOD_ADV_FLYING_PITCHING_RATE_DOWN);
|
||||
// case ADV_FLYING_PITCHING_RATE_UP:
|
||||
// return std::tuple(SMSG_MOVE_SET_ADV_FLYING_PITCHING_RATE_UP, flightCapabilityEntry->PitchingRateUpMin, flightCapabilityEntry->PitchingRateUpMax, SPELL_AURA_MOD_ADV_FLYING_PITCHING_RATE_UP);
|
||||
// case ADV_FLYING_TURN_VELOCITY_THRESHOLD:
|
||||
// return std::tuple(SMSG_MOVE_SET_ADV_FLYING_TURN_VELOCITY_THRESHOLD, flightCapabilityEntry->TurnVelocityThresholdMin, flightCapabilityEntry->TurnVelocityThresholdMax, SPELL_AURA_NONE);
|
||||
// default:
|
||||
// return std::tuple<OpcodeServer, float, float, AuraType>();
|
||||
// }
|
||||
// }();
|
||||
|
||||
if (rateAura != SPELL_AURA_NONE)
|
||||
{
|
||||
// take only lowest negative and highest positive auras - these effects do not stack
|
||||
if (float neg = GetMaxNegativeAuraModifier(rateAura, [](AuraEffect const* mod) { return mod->GetAmount() > 0 && mod->GetAmount() < 100; }))
|
||||
{
|
||||
ApplyPct(min, neg);
|
||||
ApplyPct(max, neg);
|
||||
}
|
||||
//if (rateAura != SPELL_AURA_NONE)
|
||||
//{
|
||||
// // take only lowest negative and highest positive auras - these effects do not stack
|
||||
// if (float neg = GetMaxNegativeAuraModifier(rateAura, [](AuraEffect const* mod) { return mod->GetAmount() > 0 && mod->GetAmount() < 100; }))
|
||||
// {
|
||||
// ApplyPct(min, neg);
|
||||
// ApplyPct(max, neg);
|
||||
// }
|
||||
|
||||
if (float pos = GetMaxPositiveAuraModifier(rateAura, [](AuraEffect const* mod) { return mod->GetAmount() > 100; }))
|
||||
{
|
||||
ApplyPct(min, pos);
|
||||
ApplyPct(max, pos);
|
||||
}
|
||||
}
|
||||
// if (float pos = GetMaxPositiveAuraModifier(rateAura, [](AuraEffect const* mod) { return mod->GetAmount() > 100; }))
|
||||
// {
|
||||
// ApplyPct(min, pos);
|
||||
// ApplyPct(max, pos);
|
||||
// }
|
||||
//}
|
||||
|
||||
if (m_advFlyingSpeed[speedType] == min && m_advFlyingSpeed[speedType + 1] == max)
|
||||
return;
|
||||
//if (m_advFlyingSpeed[speedType] == min && m_advFlyingSpeed[speedType + 1] == max)
|
||||
// return;
|
||||
|
||||
m_advFlyingSpeed[speedType] = min;
|
||||
m_advFlyingSpeed[speedType + 1] = max;
|
||||
//m_advFlyingSpeed[speedType] = min;
|
||||
//m_advFlyingSpeed[speedType + 1] = max;
|
||||
|
||||
if (!clientUpdate)
|
||||
return;
|
||||
//if (!clientUpdate)
|
||||
// return;
|
||||
|
||||
if (Player* playerMover = Unit::ToPlayer(GetUnitBeingMoved()))
|
||||
{
|
||||
WorldPackets::Movement::SetAdvFlyingSpeedRange selfpacket(opcode);
|
||||
selfpacket.MoverGUID = GetGUID();
|
||||
selfpacket.SequenceIndex = m_movementCounter++;
|
||||
selfpacket.SpeedMin = min;
|
||||
selfpacket.SpeedMax = max;
|
||||
playerMover->GetSession()->SendPacket(selfpacket.Write());
|
||||
}
|
||||
//if (Player* playerMover = Unit::ToPlayer(GetUnitBeingMoved()))
|
||||
//{
|
||||
// WorldPackets::Movement::SetAdvFlyingSpeedRange selfpacket(opcode);
|
||||
// selfpacket.MoverGUID = GetGUID();
|
||||
// selfpacket.SequenceIndex = m_movementCounter++;
|
||||
// selfpacket.SpeedMin = min;
|
||||
// selfpacket.SpeedMax = max;
|
||||
// playerMover->GetSession()->SendPacket(selfpacket.Write());
|
||||
//}
|
||||
}
|
||||
|
||||
void Unit::FollowerAdded(AbstractFollower* f)
|
||||
@@ -13849,37 +13849,37 @@ bool Unit::SetDisableInertia(bool disable)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Unit::SetCanAdvFly(bool enable)
|
||||
{
|
||||
if (enable == HasExtraUnitMovementFlag2(MOVEMENTFLAG3_CAN_ADV_FLY))
|
||||
return false;
|
||||
|
||||
if (enable)
|
||||
AddExtraUnitMovementFlag2(MOVEMENTFLAG3_CAN_ADV_FLY);
|
||||
else
|
||||
RemoveExtraUnitMovementFlag2(MOVEMENTFLAG3_CAN_ADV_FLY | MOVEMENTFLAG3_ADV_FLYING);
|
||||
|
||||
static OpcodeServer const advFlyOpcodeTable[2] =
|
||||
{
|
||||
SMSG_MOVE_UNSET_CAN_ADV_FLY,
|
||||
SMSG_MOVE_SET_CAN_ADV_FLY
|
||||
};
|
||||
|
||||
if (Player* playerMover = GetPlayerMovingMe())
|
||||
{
|
||||
WorldPackets::Movement::MoveSetFlag packet(advFlyOpcodeTable[enable]);
|
||||
packet.MoverGUID = GetGUID();
|
||||
packet.SequenceIndex = m_movementCounter++;
|
||||
playerMover->SendDirectMessage(packet.Write());
|
||||
|
||||
WorldPackets::Movement::MoveUpdate moveUpdate;
|
||||
moveUpdate.Status = &m_movementInfo;
|
||||
SendMessageToSet(moveUpdate.Write(), playerMover);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
//
|
||||
//bool Unit::SetCanAdvFly(bool enable)
|
||||
//{
|
||||
// if (enable == HasExtraUnitMovementFlag2(MOVEMENTFLAG3_CAN_ADV_FLY))
|
||||
// return false;
|
||||
//
|
||||
// if (enable)
|
||||
// AddExtraUnitMovementFlag2(MOVEMENTFLAG3_CAN_ADV_FLY);
|
||||
// else
|
||||
// RemoveExtraUnitMovementFlag2(MOVEMENTFLAG3_CAN_ADV_FLY | MOVEMENTFLAG3_ADV_FLYING);
|
||||
//
|
||||
// static OpcodeServer const advFlyOpcodeTable[2] =
|
||||
// {
|
||||
// SMSG_MOVE_UNSET_CAN_ADV_FLY,
|
||||
// SMSG_MOVE_SET_CAN_ADV_FLY
|
||||
// };
|
||||
//
|
||||
// if (Player* playerMover = GetPlayerMovingMe())
|
||||
// {
|
||||
// WorldPackets::Movement::MoveSetFlag packet(advFlyOpcodeTable[enable]);
|
||||
// packet.MoverGUID = GetGUID();
|
||||
// packet.SequenceIndex = m_movementCounter++;
|
||||
// playerMover->SendDirectMessage(packet.Write());
|
||||
//
|
||||
// WorldPackets::Movement::MoveUpdate moveUpdate;
|
||||
// moveUpdate.Status = &m_movementInfo;
|
||||
// SendMessageToSet(moveUpdate.Write(), playerMover);
|
||||
// }
|
||||
//
|
||||
// return true;
|
||||
//}
|
||||
|
||||
bool Unit::SetMoveCantSwim(bool cantSwim)
|
||||
{
|
||||
@@ -14582,41 +14582,41 @@ void Unit::SendAddImpulse(Position const& direction)
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::CalculateAdvFlyingSpeeds()
|
||||
{
|
||||
FlightCapabilityEntry const* flightCapabilityEntry = sFlightCapabilityStore.LookupEntry(GetFlightCapabilityID());
|
||||
if (!flightCapabilityEntry)
|
||||
flightCapabilityEntry = sFlightCapabilityStore.LookupEntry(1);
|
||||
|
||||
ASSERT(flightCapabilityEntry, "Wrong default value for flightCapabilityID");
|
||||
|
||||
// m_advFlyingSpeed[ADV_FLYING_ADD_IMPULSE_MAX_SPEED] = flightCapabilityEntry->AddImpulseMaxSpeed * GetTotalAuraPercent(SPELL_AURA_ADV_FLY_MOD_ADD_IMPULSE_MAX_SPEED);
|
||||
// m_advFlyingSpeed[ADV_FLYING_AIR_FRICTION] = flightCapabilityEntry->AirFriction * GetTotalAuraPercent(SPELL_AURA_ADV_FLY_MOD_AIR_FRICTION);
|
||||
// m_advFlyingSpeed[ADV_FLYING_BANKING_RATE_MIN] = flightCapabilityEntry->BankingRateMin * GetTotalAuraPercent(SPELL_AURA_ADV_FLY_MOD_BANKING_RATE);
|
||||
// m_advFlyingSpeed[ADV_FLYING_BANKING_RATE_MAX] = flightCapabilityEntry->BankingRateMax * GetTotalAuraPercent(SPELL_AURA_ADV_FLY_MOD_BANKING_RATE);
|
||||
m_advFlyingSpeed[ADV_FLYING_DOUBLE_JUMP_VEL_MOD] = flightCapabilityEntry->DoubleJumpVelMod;
|
||||
m_advFlyingSpeed[ADV_FLYING_GLIDE_START_MIN_HEIGHT] = flightCapabilityEntry->GlideStartMinHeight;
|
||||
m_advFlyingSpeed[ADV_FLYING_LAUNCH_SPEED_COEFFICIENT] = flightCapabilityEntry->LaunchSpeedCoefficient;
|
||||
// m_advFlyingSpeed[SPELL_AURA_ADV_FLY_MOD_LIFT_COEF ] = flightCapabilityEntry->LiftCoefficient * GetTotalAuraPercent(SPELL_AURA_ADV_FLY_MOD_LIFT_COEF);
|
||||
// m_advFlyingSpeed[ADV_FLYING_MAX_VEL] = flightCapabilityEntry->MaxVel * GetTotalAuraPercent(SPELL_AURA_ADV_FLY_MOD_MAX_VEL);
|
||||
// m_advFlyingSpeed[ADV_FLYING_OVER_MAX_DECELERATION] = flightCapabilityEntry->OverMaxDeceleration * GetTotalAuraPercent(SPELL_AURA_ADV_FLY_MOD_OVER_MAX_DECELERATION);
|
||||
// m_advFlyingSpeed[ADV_FLYING_PITCHING_RATE_DOWN_MIN] = flightCapabilityEntry->PitchingRateDownMin * GetTotalAuraPercent(SPELL_AURA_ADV_FLY_MOD_PITCHING_RATE_DOWN);
|
||||
// m_advFlyingSpeed[ADV_FLYING_PITCHING_RATE_DOWN_MAX] = flightCapabilityEntry->PitchingRateDownMax * GetTotalAuraPercent(SPELL_AURA_ADV_FLY_MOD_PITCHING_RATE_DOWN);
|
||||
// m_advFlyingSpeed[ADV_FLYING_PITCHING_RATE_UP_MIN] = flightCapabilityEntry->PitchingRateUpMin * GetTotalAuraPercent(SPELL_AURA_ADV_FLY_MOD_PITCHING_RATE_UP);
|
||||
// m_advFlyingSpeed[ADV_FLYING_PITCHING_RATE_UP_MAX] = flightCapabilityEntry->PitchingRateUpMax * GetTotalAuraPercent(SPELL_AURA_ADV_FLY_MOD_PITCHING_RATE_UP);
|
||||
m_advFlyingSpeed[ADV_FLYING_SURFACE_FRICTION] = flightCapabilityEntry->SurfaceFriction;
|
||||
// m_advFlyingSpeed[ADV_FLYING_TURN_VELOCITY_THRESHOLD_MIN] = flightCapabilityEntry->TurnVelocityThresholdMin;
|
||||
// m_advFlyingSpeed[ADV_FLYING_TURN_VELOCITY_THRESHOLD_MAX] = flightCapabilityEntry->TurnVelocityThresholdMax;
|
||||
}
|
||||
|
||||
float Unit::GetAdvFlyingVelocity() const
|
||||
{
|
||||
Optional<MovementInfo::AdvFlying> const& advFlying = m_movementInfo.advFlying;
|
||||
if (!advFlying)
|
||||
return .0f;
|
||||
|
||||
return std::sqrt(advFlying->forwardVelocity * advFlying->forwardVelocity + advFlying->upVelocity * advFlying->upVelocity);
|
||||
}
|
||||
//void Unit::CalculateAdvFlyingSpeeds()
|
||||
//{
|
||||
// FlightCapabilityEntry const* flightCapabilityEntry = sFlightCapabilityStore.LookupEntry(GetFlightCapabilityID());
|
||||
// if (!flightCapabilityEntry)
|
||||
// flightCapabilityEntry = sFlightCapabilityStore.LookupEntry(1);
|
||||
//
|
||||
// ASSERT(flightCapabilityEntry, "Wrong default value for flightCapabilityID");
|
||||
//
|
||||
// // m_advFlyingSpeed[ADV_FLYING_ADD_IMPULSE_MAX_SPEED] = flightCapabilityEntry->AddImpulseMaxSpeed * GetTotalAuraPercent(SPELL_AURA_ADV_FLY_MOD_ADD_IMPULSE_MAX_SPEED);
|
||||
// // m_advFlyingSpeed[ADV_FLYING_AIR_FRICTION] = flightCapabilityEntry->AirFriction * GetTotalAuraPercent(SPELL_AURA_ADV_FLY_MOD_AIR_FRICTION);
|
||||
// // m_advFlyingSpeed[ADV_FLYING_BANKING_RATE_MIN] = flightCapabilityEntry->BankingRateMin * GetTotalAuraPercent(SPELL_AURA_ADV_FLY_MOD_BANKING_RATE);
|
||||
// // m_advFlyingSpeed[ADV_FLYING_BANKING_RATE_MAX] = flightCapabilityEntry->BankingRateMax * GetTotalAuraPercent(SPELL_AURA_ADV_FLY_MOD_BANKING_RATE);
|
||||
// m_advFlyingSpeed[ADV_FLYING_DOUBLE_JUMP_VEL_MOD] = flightCapabilityEntry->DoubleJumpVelMod;
|
||||
// m_advFlyingSpeed[ADV_FLYING_GLIDE_START_MIN_HEIGHT] = flightCapabilityEntry->GlideStartMinHeight;
|
||||
// m_advFlyingSpeed[ADV_FLYING_LAUNCH_SPEED_COEFFICIENT] = flightCapabilityEntry->LaunchSpeedCoefficient;
|
||||
// // m_advFlyingSpeed[SPELL_AURA_ADV_FLY_MOD_LIFT_COEF ] = flightCapabilityEntry->LiftCoefficient * GetTotalAuraPercent(SPELL_AURA_ADV_FLY_MOD_LIFT_COEF);
|
||||
// // m_advFlyingSpeed[ADV_FLYING_MAX_VEL] = flightCapabilityEntry->MaxVel * GetTotalAuraPercent(SPELL_AURA_ADV_FLY_MOD_MAX_VEL);
|
||||
// // m_advFlyingSpeed[ADV_FLYING_OVER_MAX_DECELERATION] = flightCapabilityEntry->OverMaxDeceleration * GetTotalAuraPercent(SPELL_AURA_ADV_FLY_MOD_OVER_MAX_DECELERATION);
|
||||
// // m_advFlyingSpeed[ADV_FLYING_PITCHING_RATE_DOWN_MIN] = flightCapabilityEntry->PitchingRateDownMin * GetTotalAuraPercent(SPELL_AURA_ADV_FLY_MOD_PITCHING_RATE_DOWN);
|
||||
// // m_advFlyingSpeed[ADV_FLYING_PITCHING_RATE_DOWN_MAX] = flightCapabilityEntry->PitchingRateDownMax * GetTotalAuraPercent(SPELL_AURA_ADV_FLY_MOD_PITCHING_RATE_DOWN);
|
||||
// // m_advFlyingSpeed[ADV_FLYING_PITCHING_RATE_UP_MIN] = flightCapabilityEntry->PitchingRateUpMin * GetTotalAuraPercent(SPELL_AURA_ADV_FLY_MOD_PITCHING_RATE_UP);
|
||||
// // m_advFlyingSpeed[ADV_FLYING_PITCHING_RATE_UP_MAX] = flightCapabilityEntry->PitchingRateUpMax * GetTotalAuraPercent(SPELL_AURA_ADV_FLY_MOD_PITCHING_RATE_UP);
|
||||
// m_advFlyingSpeed[ADV_FLYING_SURFACE_FRICTION] = flightCapabilityEntry->SurfaceFriction;
|
||||
// // m_advFlyingSpeed[ADV_FLYING_TURN_VELOCITY_THRESHOLD_MIN] = flightCapabilityEntry->TurnVelocityThresholdMin;
|
||||
// // m_advFlyingSpeed[ADV_FLYING_TURN_VELOCITY_THRESHOLD_MAX] = flightCapabilityEntry->TurnVelocityThresholdMax;
|
||||
//}
|
||||
//
|
||||
//float Unit::GetAdvFlyingVelocity() const
|
||||
//{
|
||||
// Optional<MovementInfo::AdvFlying> const& advFlying = m_movementInfo.advFlying;
|
||||
// if (!advFlying)
|
||||
// return .0f;
|
||||
//
|
||||
// return std::sqrt(advFlying->forwardVelocity * advFlying->forwardVelocity + advFlying->upVelocity * advFlying->upVelocity);
|
||||
//}
|
||||
|
||||
bool Unit::IsInAir() const
|
||||
{
|
||||
|
||||
@@ -515,7 +515,7 @@ NonDefaultConstructible<pAuraEffectHandler> AuraEffectHandler[TOTAL_AURAS]=
|
||||
&AuraEffect::HandleNULL, //443 SPELL_AURA_MOD_LEECH
|
||||
&AuraEffect::HandleNULL, //444
|
||||
&AuraEffect::HandleNULL, //445
|
||||
&AuraEffect::HandleModAdvFlying, //446 SPELL_AURA_ADV_FLYING
|
||||
&AuraEffect::HandleNULL, //446 SPELL_AURA_ADV_FLYING
|
||||
&AuraEffect::HandleNoImmediateEffect, //447 SPELL_AURA_MOD_XP_FROM_CREATURE_TYPE implemented in KillRewarder::_RewardXP
|
||||
&AuraEffect::HandleNULL, //448
|
||||
&AuraEffect::HandleNULL, //449
|
||||
@@ -582,18 +582,18 @@ NonDefaultConstructible<pAuraEffectHandler> AuraEffectHandler[TOTAL_AURAS]=
|
||||
&AuraEffect::HandleNULL, //510 SPELL_AURA_MODIFIED_RAID_INSTANCE
|
||||
&AuraEffect::HandleNULL, //511 SPELL_AURA_APPLY_PROFESSION_EFFECT
|
||||
&AuraEffect::HandleNULL, //512
|
||||
&AuraEffect::HandleAuraModAdvFlyingSpeed, //513 SPELL_AURA_MOD_ADV_FLYING_AIR_FRICTION
|
||||
&AuraEffect::HandleAuraModAdvFlyingSpeed, //514 SPELL_AURA_MOD_ADV_FLYING_MAX_VEL
|
||||
&AuraEffect::HandleAuraModAdvFlyingSpeed, //515 SPELL_AURA_MOD_ADV_FLYING_LIFT_COEF
|
||||
&AuraEffect::HandleNULL, //513 SPELL_AURA_MOD_ADV_FLYING_AIR_FRICTION
|
||||
&AuraEffect::HandleNULL, //514 SPELL_AURA_MOD_ADV_FLYING_MAX_VEL
|
||||
&AuraEffect::HandleNULL, //515 SPELL_AURA_MOD_ADV_FLYING_LIFT_COEF
|
||||
&AuraEffect::HandleNULL, //516
|
||||
&AuraEffect::HandleNULL, //517
|
||||
&AuraEffect::HandleAuraModAdvFlyingSpeed, //518 SPELL_AURA_MOD_ADV_FLYING_ADD_IMPULSE_MAX_SPEED
|
||||
&AuraEffect::HandleNULL, //518 SPELL_AURA_MOD_ADV_FLYING_ADD_IMPULSE_MAX_SPEED
|
||||
&AuraEffect::HandleNULL, //519 SPELL_AURA_MOD_COOLDOWN_RECOVERY_RATE_ALL
|
||||
&AuraEffect::HandleAuraModAdvFlyingSpeed, //520 SPELL_AURA_MOD_ADV_FLYING_BANKING_RATE
|
||||
&AuraEffect::HandleAuraModAdvFlyingSpeed, //521 SPELL_AURA_MOD_ADV_FLYING_PITCHING_RATE_DOWN
|
||||
&AuraEffect::HandleAuraModAdvFlyingSpeed, //522 SPELL_AURA_MOD_ADV_FLYING_PITCHING_RATE_UP
|
||||
&AuraEffect::HandleNULL, //520 SPELL_AURA_MOD_ADV_FLYING_BANKING_RATE
|
||||
&AuraEffect::HandleNULL, //521 SPELL_AURA_MOD_ADV_FLYING_PITCHING_RATE_DOWN
|
||||
&AuraEffect::HandleNULL, //522 SPELL_AURA_MOD_ADV_FLYING_PITCHING_RATE_UP
|
||||
&AuraEffect::HandleNULL, //523
|
||||
&AuraEffect::HandleAuraModAdvFlyingSpeed, //524 SPELL_AURA_MOD_ADV_FLYING_OVER_MAX_DECELERATION
|
||||
&AuraEffect::HandleNULL, //524 SPELL_AURA_MOD_ADV_FLYING_OVER_MAX_DECELERATION
|
||||
&AuraEffect::HandleNULL, //525 SPELL_AURA_DISPLAY_PROFESSION_EQUIPMENT
|
||||
&AuraEffect::HandleNULL, //526
|
||||
&AuraEffect::HandleNULL, //527
|
||||
@@ -2984,10 +2984,10 @@ void AuraEffect::HandleModAdvFlying(AuraApplication const* aurApp, uint8 mode, b
|
||||
if (!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
|
||||
return;
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
/* Unit* target = aurApp->GetTarget();
|
||||
target->SetCanDoubleJump(apply || target->HasAura(SPELL_DH_DOUBLE_JUMP));
|
||||
target->SetCanFly(apply);
|
||||
target->SetCanAdvFly(apply);
|
||||
target->SetCanAdvFly(apply);*/
|
||||
}
|
||||
|
||||
void AuraEffect::HandleIgnoreMovementForces(AuraApplication const* aurApp, uint8 mode, bool apply) const
|
||||
@@ -3491,7 +3491,7 @@ void AuraEffect::HandleAuraModAdvFlyingSpeed(AuraApplication const* aurApp, uint
|
||||
if (!(mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK))
|
||||
return;
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
/* Unit* target = aurApp->GetTarget();
|
||||
switch (GetAuraType())
|
||||
{
|
||||
case SPELL_AURA_MOD_ADV_FLYING_AIR_FRICTION:
|
||||
@@ -3520,7 +3520,7 @@ void AuraEffect::HandleAuraModAdvFlyingSpeed(AuraApplication const* aurApp, uint
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
/*********************************************************/
|
||||
|
||||
@@ -1,442 +1,442 @@
|
||||
/*
|
||||
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Scripts for dragonriding / skyriding abilities.
|
||||
* Scriptnames prefixed with "spell_dragonriding_"
|
||||
*/
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "Player.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "SpellScript.h"
|
||||
#include "Unit.h"
|
||||
|
||||
const float THRILL_OF_THE_SKIES_MIN_VELOCITY = 40.f;
|
||||
|
||||
enum DragonridingSpells
|
||||
{
|
||||
SPELL_DRAGONRIDING_SURGE_FORWARD = 372608,
|
||||
SPELL_DRAGONRIDING_SKYWARD_ASCENT = 372610,
|
||||
SPELL_DRAGONRIDING_WHIRLING_SURGE = 361584,
|
||||
SPELL_DRAGONRIDING_LAUNCH_BOOST = 392752,
|
||||
SPELL_DRAGONRIDING_LIFT_OFF = 374763,
|
||||
SPELL_STEADY_FLIGHT = 404468,
|
||||
SPELL_SKYRIDING = 404464,
|
||||
SPELL_SKYRIDING_BASICS = 376777,
|
||||
SPELL_SWITCH_FLIGHT_STYLE = 436854,
|
||||
SPELL_VIGOR = 372773,
|
||||
SPELL_LIFT_OFF_3 = 386451,
|
||||
SPELL_THRILL_OF_THE_SKIES = 377234,
|
||||
SPELL_THRILL_OF_THE_SKIES_2 = 383366,
|
||||
SPELL_EVOKER_SOAR_RACIAL = 369536,
|
||||
SPELL_ENERGY_WIDGET = 423624,
|
||||
SPELL_VIGOR_CACHE = 433547,
|
||||
SPELL_DRAGONRIDER_ENERGIZE = 372606,
|
||||
};
|
||||
|
||||
// Spell 436854 - Switch Flight Style
|
||||
class spell_switch_flight : public SpellScript
|
||||
{
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_SKYRIDING, SPELL_STEADY_FLIGHT, SPELL_VIGOR });
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (!caster)
|
||||
return;
|
||||
|
||||
Player* player = caster->ToPlayer();
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
// Debug current state
|
||||
bool hasSkyriding = caster->HasAura(SPELL_SKYRIDING);
|
||||
bool hasSteadyFlight = caster->HasAura(SPELL_STEADY_FLIGHT);
|
||||
|
||||
TC_LOG_INFO("spells", "Switch Flight Style - Skyriding: {}, Steady Flight: {}", hasSkyriding, hasSteadyFlight);
|
||||
|
||||
// Clean up both auras first
|
||||
caster->RemoveAura(SPELL_SKYRIDING);
|
||||
caster->RemoveAura(SPELL_STEADY_FLIGHT);
|
||||
|
||||
if (hasSkyriding)
|
||||
{
|
||||
// Switch to steady flight (normal flight)
|
||||
caster->CastSpell(caster, SPELL_STEADY_FLIGHT, true);
|
||||
caster->RemoveAura(SPELL_VIGOR);
|
||||
if (caster->IsMounted())
|
||||
{
|
||||
caster->SetCanAdvFly(false);
|
||||
caster->SetCanDoubleJump(false);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// Switch to skyriding (dragonriding) - default behavior
|
||||
caster->CastSpell(caster, SPELL_SKYRIDING, true);
|
||||
if (!caster->HasAura(SPELL_VIGOR))
|
||||
caster->CastSpell(caster, SPELL_VIGOR, true);
|
||||
if (caster->IsMounted())
|
||||
{
|
||||
caster->SetCanAdvFly(true);
|
||||
caster->SetCanDoubleJump(true);
|
||||
caster->SetFlightCapabilityID(1, true);
|
||||
}
|
||||
|
||||
// Send message to player
|
||||
TC_LOG_INFO("spells", "Switched to Skyriding");
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_switch_flight::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
static void SendFacingImpulse(Unit* caster, float speed)
|
||||
{
|
||||
float orientation = caster->GetOrientation();
|
||||
float pitch = caster->m_movementInfo.pitch;
|
||||
float cosPitch = std::cos(pitch);
|
||||
Position direction(
|
||||
std::cos(orientation) * cosPitch * speed,
|
||||
std::sin(orientation) * cosPitch * speed,
|
||||
std::sin(pitch) * speed
|
||||
);
|
||||
caster->SendAddImpulse(direction);
|
||||
}
|
||||
|
||||
static SpellCastResult CheckSkyriding(SpellScript* script)
|
||||
{
|
||||
Unit* caster = script->GetCaster();
|
||||
if (!caster->HasExtraUnitMovementFlag2(MOVEMENTFLAG3_CAN_ADV_FLY))
|
||||
{
|
||||
script->SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_REQUIRES_SKYRIDING);
|
||||
return SPELL_FAILED_CUSTOM_ERROR;
|
||||
}
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
// 372608 - Surge Forward
|
||||
class spell_dragonriding_surge_forward : public SpellScript
|
||||
{
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
return CheckSkyriding(this);
|
||||
}
|
||||
|
||||
void HandleHit(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
SendFacingImpulse(caster, 30.0f);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnCheckCast += SpellCheckCastFn(spell_dragonriding_surge_forward::CheckCast);
|
||||
OnEffectHitTarget += SpellEffectFn(spell_dragonriding_surge_forward::HandleHit, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
// 372610 - Skyward Ascent
|
||||
class spell_dragonriding_skyward_ascent : public SpellScript
|
||||
{
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
return CheckSkyriding(this);
|
||||
}
|
||||
|
||||
void HandleHit(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
{
|
||||
float orientation = caster->GetOrientation();
|
||||
float horizontalSpeed = 12.25f;
|
||||
Position direction(
|
||||
std::cos(orientation) * horizontalSpeed,
|
||||
std::sin(orientation) * horizontalSpeed,
|
||||
49.0f
|
||||
);
|
||||
caster->SendAddImpulse(direction);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnCheckCast += SpellCheckCastFn(spell_dragonriding_skyward_ascent::CheckCast);
|
||||
OnEffectHitTarget += SpellEffectFn(spell_dragonriding_skyward_ascent::HandleHit, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
// 361584 - Whirling Surge (SpellScript for cast validation)
|
||||
class spell_dragonriding_whirling_surge : public SpellScript
|
||||
{
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
return CheckSkyriding(this);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnCheckCast += SpellCheckCastFn(spell_dragonriding_whirling_surge::CheckCast);
|
||||
}
|
||||
};
|
||||
|
||||
// 361584 - Whirling Surge (AuraScript for periodic impulse ticks)
|
||||
// Wowhead: Apply Aura: Dummy, 3s duration. Sniff: 5-6 impulse ticks at magnitude 5.0, facing+pitch oriented.
|
||||
class spell_dragonriding_whirling_surge_aura : public AuraScript
|
||||
{
|
||||
void HandlePeriodicDummy(AuraEffect const* /*aurEff*/)
|
||||
{
|
||||
if (Unit* target = GetTarget())
|
||||
SendFacingImpulse(target, 5.0f);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_dragonriding_whirling_surge_aura::HandlePeriodicDummy, EFFECT_0, SPELL_AURA_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
// 392752 - Launch Boost (SpellScript for initial upward impulse on spell hit)
|
||||
// Wowhead: Periodic Dummy, period 100ms, duration 2s. Sniff: Z=45 impulse on first hit.
|
||||
class spell_dragonriding_launch_boost : public SpellScript
|
||||
{
|
||||
void HandleHit(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
{
|
||||
Position direction(0.0f, 0.0f, 45.0f);
|
||||
caster->SendAddImpulse(direction);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_dragonriding_launch_boost::HandleHit, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
|
||||
}
|
||||
};
|
||||
|
||||
// 392752 - Launch Boost (AuraScript for periodic forward impulse ticks after initial launch)
|
||||
class spell_dragonriding_launch_boost_aura : public AuraScript
|
||||
{
|
||||
void HandlePeriodicDummy(AuraEffect const* /*aurEff*/)
|
||||
{
|
||||
if (Unit* target = GetTarget())
|
||||
{
|
||||
if (!target->HasExtraUnitMovementFlag2(MOVEMENTFLAG3_CAN_ADV_FLY))
|
||||
return;
|
||||
|
||||
SendFacingImpulse(target, 5.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_dragonriding_launch_boost_aura::HandlePeriodicDummy, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
// 406095 - Dynamic Flight
|
||||
class spell_dragonriding : public AuraScript
|
||||
{
|
||||
void OnPeriodic(AuraEffect const* /*aurEff*/)
|
||||
{
|
||||
float advFlyingVelocity = GetTarget()->GetAdvFlyingVelocity();
|
||||
bool advFylingEnabled = GetTarget()->HasAuraType(SPELL_AURA_ADV_FLYING);
|
||||
|
||||
float ground = GetTarget()->GetFloorZ();
|
||||
bool isInAir = (G3D::fuzzyGt(GetTarget()->GetPositionZ(), ground + GROUND_HEIGHT_TOLERANCE) || G3D::fuzzyLt(GetTarget()->GetPositionZ(), ground - GROUND_HEIGHT_TOLERANCE));
|
||||
|
||||
if (isInAir && advFlyingVelocity && advFylingEnabled)
|
||||
{
|
||||
if (advFlyingVelocity > THRILL_OF_THE_SKIES_MIN_VELOCITY)
|
||||
{
|
||||
if (!GetTarget()->HasAura(SPELL_THRILL_OF_THE_SKIES))
|
||||
GetTarget()->CastSpell(GetTarget(), SPELL_THRILL_OF_THE_SKIES, TRIGGERED_FULL_MASK);
|
||||
GetTarget()->CastSpell(GetTarget(), SPELL_THRILL_OF_THE_SKIES_2, TRIGGERED_FULL_MASK);
|
||||
}
|
||||
else
|
||||
GetTarget()->RemoveAurasDueToSpell(SPELL_THRILL_OF_THE_SKIES);
|
||||
GetTarget()->RemoveAurasDueToSpell(SPELL_THRILL_OF_THE_SKIES_2);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetTarget()->RemoveAurasDueToSpell(SPELL_THRILL_OF_THE_SKIES);
|
||||
GetTarget()->RemoveAurasDueToSpell(SPELL_THRILL_OF_THE_SKIES_2);
|
||||
}
|
||||
|
||||
if (advFlyingVelocity <= 8.5f)
|
||||
{
|
||||
// TODO ORNIXX
|
||||
}
|
||||
|
||||
// Soar Evoker
|
||||
if (!isInAir && GetCaster()->HasAura(SPELL_EVOKER_SOAR_RACIAL))
|
||||
GetCaster()->RemoveAura(SPELL_EVOKER_SOAR_RACIAL);
|
||||
}
|
||||
|
||||
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
caster->AddAura(SPELL_DRAGONRIDER_ENERGY, caster);
|
||||
GetTarget()->CastSpell(GetTarget(), SPELL_ENERGY_WIDGET, true);
|
||||
GetTarget()->SetPower(POWER_ALTERNATE_MOUNT, GetTarget()->GetPower(POWER_ALTERNATE_MOUNT), true);
|
||||
}
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
{
|
||||
caster->RemoveAura(SPELL_DRAGONRIDER_ENERGY);
|
||||
caster->RemoveAura(SPELL_VIGOR_CACHE);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_dragonriding::OnPeriodic, EFFECT_2, SPELL_AURA_PERIODIC_DUMMY);
|
||||
OnEffectApply += AuraEffectApplyFn(spell_dragonriding::OnApply, EFFECT_2, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
OnEffectRemove += AuraEffectRemoveFn(spell_dragonriding::OnRemove, EFFECT_2, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
// 372771 - Dragonrider Energy
|
||||
class spell_dragonrider_energy : public AuraScript
|
||||
{
|
||||
void OnPeriodic(AuraEffect* /*aurEff*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (!caster)
|
||||
return;
|
||||
|
||||
caster->ToPlayer()->AddAura(433547, caster);
|
||||
|
||||
int newMaxPower = 3;
|
||||
|
||||
if (caster->HasAura(377920) && !caster->HasAura(377921) && !caster->HasAura(377922))
|
||||
{
|
||||
newMaxPower = 4;
|
||||
}
|
||||
else if (caster->HasAura(377921) && caster->HasAura(377920) && !caster->HasAura(377922))
|
||||
{
|
||||
newMaxPower = 5;
|
||||
}
|
||||
else if (caster->HasAura(377922) && caster->HasAura(377921) && caster->HasAura(377920))
|
||||
{
|
||||
newMaxPower = 6;
|
||||
}
|
||||
|
||||
caster->SetMaxPower(POWER_ALTERNATE_MOUNT, newMaxPower);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_dragonrider_energy::OnPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
// 372773 - Dragonrider Energy
|
||||
class spell_af_energy : public AuraScript
|
||||
{
|
||||
void OnPeriodic(AuraEffect* /*aurEff*/)
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
{
|
||||
if (ShouldRegenEnergy(caster))
|
||||
{
|
||||
if (AuraEffect* subAmountAurEff = caster->GetAuraEffect(SPELL_VIGOR_CACHE, EFFECT_1))
|
||||
{
|
||||
int32 baseRegen = 20; // Todo : Calculate this based on talents & if we are thrilled/grounded
|
||||
|
||||
int32 newAmount = subAmountAurEff->GetAmount() + baseRegen;
|
||||
|
||||
if (newAmount >= 100)
|
||||
{
|
||||
newAmount -= 100;
|
||||
|
||||
caster->CastSpell(caster, SPELL_DRAGONRIDER_ENERGIZE, TRIGGERED_FULL_MASK);
|
||||
|
||||
if (AuraEffect* amountAurEff = caster->GetAuraEffect(SPELL_VIGOR_CACHE, EFFECT_0))
|
||||
amountAurEff->SetAmount(caster->GetPower(POWER_ALTERNATE_MOUNT));
|
||||
}
|
||||
|
||||
subAmountAurEff->SetAmount(newAmount);
|
||||
subAmountAurEff->GetBase()->SetNeedClientUpdateForTargets();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ShouldRegenEnergy(Unit const* caster) const
|
||||
{
|
||||
if (caster->GetPower(POWER_ALTERNATE_MOUNT) == caster->GetMaxPower(POWER_ALTERNATE_MOUNT))
|
||||
return false;
|
||||
|
||||
FlightCapabilityEntry const* flightCapabilityEntry = sFlightCapabilityStore.LookupEntry(caster->GetFlightCapabilityID());
|
||||
if (!flightCapabilityEntry)
|
||||
return false;
|
||||
|
||||
float velocityRegenThreshold = flightCapabilityEntry->MaxVel * flightCapabilityEntry->VigorRegenMaxVelCoefficient;
|
||||
if (caster->GetAdvFlyingVelocity() >= velocityRegenThreshold)
|
||||
return true;
|
||||
|
||||
return !caster->IsInAir() || caster->IsInWater();
|
||||
}
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
GetTarget()->RemoveAurasDueToSpell(SPELL_VIGOR_CACHE);
|
||||
}
|
||||
|
||||
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
if (!target->HasAura(SPELL_VIGOR_CACHE))
|
||||
{
|
||||
CastSpellExtraArgs extraArgs(TRIGGERED_FULL_MASK);
|
||||
extraArgs.AddSpellMod(SPELLVALUE_BASE_POINT0, target->GetPower(POWER_ALTERNATE_MOUNT));
|
||||
target->CastSpell(target, SPELL_VIGOR_CACHE, extraArgs);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectApply += AuraEffectApplyFn(spell_af_energy::OnApply, EFFECT_0, SPELL_AURA_ENABLE_ALT_POWER, AURA_EFFECT_HANDLE_REAL);
|
||||
OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_af_energy::OnPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY);
|
||||
OnEffectRemove += AuraEffectRemoveFn(spell_af_energy::OnRemove, EFFECT_0, SPELL_AURA_ENABLE_ALT_POWER, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
///*
|
||||
// * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
|
||||
// *
|
||||
// * This program is free software; you can redistribute it and/or modify it
|
||||
// * under the terms of the GNU General Public License as published by the
|
||||
// * Free Software Foundation; either version 2 of the License, or (at your
|
||||
// * option) any later version.
|
||||
// *
|
||||
// * This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
// * more details.
|
||||
// *
|
||||
// * You should have received a copy of the GNU General Public License along
|
||||
// * with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
// */
|
||||
//
|
||||
// /*
|
||||
// * Scripts for dragonriding / skyriding abilities.
|
||||
// * Scriptnames prefixed with "spell_dragonriding_"
|
||||
// */
|
||||
//
|
||||
//#include "ScriptMgr.h"
|
||||
//#include "Player.h"
|
||||
//#include "SharedDefines.h"
|
||||
//#include "SpellAuraEffects.h"
|
||||
//#include "SpellScript.h"
|
||||
//#include "Unit.h"
|
||||
//
|
||||
//const float THRILL_OF_THE_SKIES_MIN_VELOCITY = 40.f;
|
||||
//
|
||||
//enum DragonridingSpells
|
||||
//{
|
||||
// SPELL_DRAGONRIDING_SURGE_FORWARD = 372608,
|
||||
// SPELL_DRAGONRIDING_SKYWARD_ASCENT = 372610,
|
||||
// SPELL_DRAGONRIDING_WHIRLING_SURGE = 361584,
|
||||
// SPELL_DRAGONRIDING_LAUNCH_BOOST = 392752,
|
||||
// SPELL_DRAGONRIDING_LIFT_OFF = 374763,
|
||||
// SPELL_STEADY_FLIGHT = 404468,
|
||||
// SPELL_SKYRIDING = 404464,
|
||||
// SPELL_SKYRIDING_BASICS = 376777,
|
||||
// SPELL_SWITCH_FLIGHT_STYLE = 436854,
|
||||
// SPELL_VIGOR = 372773,
|
||||
// SPELL_LIFT_OFF_3 = 386451,
|
||||
// SPELL_THRILL_OF_THE_SKIES = 377234,
|
||||
// SPELL_THRILL_OF_THE_SKIES_2 = 383366,
|
||||
// SPELL_EVOKER_SOAR_RACIAL = 369536,
|
||||
// SPELL_ENERGY_WIDGET = 423624,
|
||||
// SPELL_VIGOR_CACHE = 433547,
|
||||
// SPELL_DRAGONRIDER_ENERGIZE = 372606,
|
||||
//};
|
||||
//
|
||||
//// Spell 436854 - Switch Flight Style
|
||||
//class spell_switch_flight : public SpellScript
|
||||
//{
|
||||
// bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
// {
|
||||
// return ValidateSpellInfo({ SPELL_SKYRIDING, SPELL_STEADY_FLIGHT, SPELL_VIGOR });
|
||||
// }
|
||||
//
|
||||
// void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
// {
|
||||
// Unit* caster = GetCaster();
|
||||
// if (!caster)
|
||||
// return;
|
||||
//
|
||||
// Player* player = caster->ToPlayer();
|
||||
// if (!player)
|
||||
// return;
|
||||
//
|
||||
// // Debug current state
|
||||
// bool hasSkyriding = caster->HasAura(SPELL_SKYRIDING);
|
||||
// bool hasSteadyFlight = caster->HasAura(SPELL_STEADY_FLIGHT);
|
||||
//
|
||||
// TC_LOG_INFO("spells", "Switch Flight Style - Skyriding: {}, Steady Flight: {}", hasSkyriding, hasSteadyFlight);
|
||||
//
|
||||
// // Clean up both auras first
|
||||
// caster->RemoveAura(SPELL_SKYRIDING);
|
||||
// caster->RemoveAura(SPELL_STEADY_FLIGHT);
|
||||
//
|
||||
// if (hasSkyriding)
|
||||
// {
|
||||
// // Switch to steady flight (normal flight)
|
||||
// caster->CastSpell(caster, SPELL_STEADY_FLIGHT, true);
|
||||
// caster->RemoveAura(SPELL_VIGOR);
|
||||
// if (caster->IsMounted())
|
||||
// {
|
||||
// caster->SetCanAdvFly(false);
|
||||
// caster->SetCanDoubleJump(false);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // Switch to skyriding (dragonriding) - default behavior
|
||||
// caster->CastSpell(caster, SPELL_SKYRIDING, true);
|
||||
// if (!caster->HasAura(SPELL_VIGOR))
|
||||
// caster->CastSpell(caster, SPELL_VIGOR, true);
|
||||
// if (caster->IsMounted())
|
||||
// {
|
||||
// caster->SetCanAdvFly(true);
|
||||
// caster->SetCanDoubleJump(true);
|
||||
// caster->SetFlightCapabilityID(1, true);
|
||||
// }
|
||||
//
|
||||
// // Send message to player
|
||||
// TC_LOG_INFO("spells", "Switched to Skyriding");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// void Register() override
|
||||
// {
|
||||
// OnEffectHitTarget += SpellEffectFn(spell_switch_flight::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
// }
|
||||
//};
|
||||
//
|
||||
//static void SendFacingImpulse(Unit* caster, float speed)
|
||||
//{
|
||||
// float orientation = caster->GetOrientation();
|
||||
// float pitch = caster->m_movementInfo.pitch;
|
||||
// float cosPitch = std::cos(pitch);
|
||||
// Position direction(
|
||||
// std::cos(orientation) * cosPitch * speed,
|
||||
// std::sin(orientation) * cosPitch * speed,
|
||||
// std::sin(pitch) * speed
|
||||
// );
|
||||
// caster->SendAddImpulse(direction);
|
||||
//}
|
||||
//
|
||||
//static SpellCastResult CheckSkyriding(SpellScript* script)
|
||||
//{
|
||||
// Unit* caster = script->GetCaster();
|
||||
// if (!caster->HasExtraUnitMovementFlag2(MOVEMENTFLAG3_CAN_ADV_FLY))
|
||||
// {
|
||||
// script->SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_REQUIRES_SKYRIDING);
|
||||
// return SPELL_FAILED_CUSTOM_ERROR;
|
||||
// }
|
||||
// return SPELL_CAST_OK;
|
||||
//}
|
||||
//
|
||||
//// 372608 - Surge Forward
|
||||
//class spell_dragonriding_surge_forward : public SpellScript
|
||||
//{
|
||||
// SpellCastResult CheckCast()
|
||||
// {
|
||||
// return CheckSkyriding(this);
|
||||
// }
|
||||
//
|
||||
// void HandleHit(SpellEffIndex /*effIndex*/)
|
||||
// {
|
||||
// if (Unit* caster = GetCaster())
|
||||
// SendFacingImpulse(caster, 30.0f);
|
||||
// }
|
||||
//
|
||||
// void Register() override
|
||||
// {
|
||||
// OnCheckCast += SpellCheckCastFn(spell_dragonriding_surge_forward::CheckCast);
|
||||
// OnEffectHitTarget += SpellEffectFn(spell_dragonriding_surge_forward::HandleHit, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
// }
|
||||
//};
|
||||
//
|
||||
//// 372610 - Skyward Ascent
|
||||
//class spell_dragonriding_skyward_ascent : public SpellScript
|
||||
//{
|
||||
// SpellCastResult CheckCast()
|
||||
// {
|
||||
// return CheckSkyriding(this);
|
||||
// }
|
||||
//
|
||||
// void HandleHit(SpellEffIndex /*effIndex*/)
|
||||
// {
|
||||
// if (Unit* caster = GetCaster())
|
||||
// {
|
||||
// float orientation = caster->GetOrientation();
|
||||
// float horizontalSpeed = 12.25f;
|
||||
// Position direction(
|
||||
// std::cos(orientation) * horizontalSpeed,
|
||||
// std::sin(orientation) * horizontalSpeed,
|
||||
// 49.0f
|
||||
// );
|
||||
// caster->SendAddImpulse(direction);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// void Register() override
|
||||
// {
|
||||
// OnCheckCast += SpellCheckCastFn(spell_dragonriding_skyward_ascent::CheckCast);
|
||||
// OnEffectHitTarget += SpellEffectFn(spell_dragonriding_skyward_ascent::HandleHit, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
// }
|
||||
//};
|
||||
//
|
||||
//// 361584 - Whirling Surge (SpellScript for cast validation)
|
||||
//class spell_dragonriding_whirling_surge : public SpellScript
|
||||
//{
|
||||
// SpellCastResult CheckCast()
|
||||
// {
|
||||
// return CheckSkyriding(this);
|
||||
// }
|
||||
//
|
||||
// void Register() override
|
||||
// {
|
||||
// OnCheckCast += SpellCheckCastFn(spell_dragonriding_whirling_surge::CheckCast);
|
||||
// }
|
||||
//};
|
||||
//
|
||||
//// 361584 - Whirling Surge (AuraScript for periodic impulse ticks)
|
||||
//// Wowhead: Apply Aura: Dummy, 3s duration. Sniff: 5-6 impulse ticks at magnitude 5.0, facing+pitch oriented.
|
||||
//class spell_dragonriding_whirling_surge_aura : public AuraScript
|
||||
//{
|
||||
// void HandlePeriodicDummy(AuraEffect const* /*aurEff*/)
|
||||
// {
|
||||
// if (Unit* target = GetTarget())
|
||||
// SendFacingImpulse(target, 5.0f);
|
||||
// }
|
||||
//
|
||||
// void Register() override
|
||||
// {
|
||||
// OnEffectPeriodic += AuraEffectPeriodicFn(spell_dragonriding_whirling_surge_aura::HandlePeriodicDummy, EFFECT_0, SPELL_AURA_DUMMY);
|
||||
// }
|
||||
//};
|
||||
//
|
||||
//// 392752 - Launch Boost (SpellScript for initial upward impulse on spell hit)
|
||||
//// Wowhead: Periodic Dummy, period 100ms, duration 2s. Sniff: Z=45 impulse on first hit.
|
||||
//class spell_dragonriding_launch_boost : public SpellScript
|
||||
//{
|
||||
// void HandleHit(SpellEffIndex /*effIndex*/)
|
||||
// {
|
||||
// if (Unit* caster = GetCaster())
|
||||
// {
|
||||
// Position direction(0.0f, 0.0f, 45.0f);
|
||||
// caster->SendAddImpulse(direction);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// void Register() override
|
||||
// {
|
||||
// OnEffectHitTarget += SpellEffectFn(spell_dragonriding_launch_boost::HandleHit, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
|
||||
// }
|
||||
//};
|
||||
//
|
||||
//// 392752 - Launch Boost (AuraScript for periodic forward impulse ticks after initial launch)
|
||||
//class spell_dragonriding_launch_boost_aura : public AuraScript
|
||||
//{
|
||||
// void HandlePeriodicDummy(AuraEffect const* /*aurEff*/)
|
||||
// {
|
||||
// if (Unit* target = GetTarget())
|
||||
// {
|
||||
// if (!target->HasExtraUnitMovementFlag2(MOVEMENTFLAG3_CAN_ADV_FLY))
|
||||
// return;
|
||||
//
|
||||
// SendFacingImpulse(target, 5.0f);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// void Register() override
|
||||
// {
|
||||
// OnEffectPeriodic += AuraEffectPeriodicFn(spell_dragonriding_launch_boost_aura::HandlePeriodicDummy, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
|
||||
// }
|
||||
//};
|
||||
//
|
||||
//// 406095 - Dynamic Flight
|
||||
//class spell_dragonriding : public AuraScript
|
||||
//{
|
||||
// void OnPeriodic(AuraEffect const* /*aurEff*/)
|
||||
// {
|
||||
// float advFlyingVelocity = GetTarget()->GetAdvFlyingVelocity();
|
||||
// bool advFylingEnabled = GetTarget()->HasAuraType(SPELL_AURA_ADV_FLYING);
|
||||
//
|
||||
// float ground = GetTarget()->GetFloorZ();
|
||||
// bool isInAir = (G3D::fuzzyGt(GetTarget()->GetPositionZ(), ground + GROUND_HEIGHT_TOLERANCE) || G3D::fuzzyLt(GetTarget()->GetPositionZ(), ground - GROUND_HEIGHT_TOLERANCE));
|
||||
//
|
||||
// if (isInAir && advFlyingVelocity && advFylingEnabled)
|
||||
// {
|
||||
// if (advFlyingVelocity > THRILL_OF_THE_SKIES_MIN_VELOCITY)
|
||||
// {
|
||||
// if (!GetTarget()->HasAura(SPELL_THRILL_OF_THE_SKIES))
|
||||
// GetTarget()->CastSpell(GetTarget(), SPELL_THRILL_OF_THE_SKIES, TRIGGERED_FULL_MASK);
|
||||
// GetTarget()->CastSpell(GetTarget(), SPELL_THRILL_OF_THE_SKIES_2, TRIGGERED_FULL_MASK);
|
||||
// }
|
||||
// else
|
||||
// GetTarget()->RemoveAurasDueToSpell(SPELL_THRILL_OF_THE_SKIES);
|
||||
// GetTarget()->RemoveAurasDueToSpell(SPELL_THRILL_OF_THE_SKIES_2);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// GetTarget()->RemoveAurasDueToSpell(SPELL_THRILL_OF_THE_SKIES);
|
||||
// GetTarget()->RemoveAurasDueToSpell(SPELL_THRILL_OF_THE_SKIES_2);
|
||||
// }
|
||||
//
|
||||
// if (advFlyingVelocity <= 8.5f)
|
||||
// {
|
||||
// // TODO ORNIXX
|
||||
// }
|
||||
//
|
||||
// // Soar Evoker
|
||||
// if (!isInAir && GetCaster()->HasAura(SPELL_EVOKER_SOAR_RACIAL))
|
||||
// GetCaster()->RemoveAura(SPELL_EVOKER_SOAR_RACIAL);
|
||||
// }
|
||||
//
|
||||
// void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
// {
|
||||
// if (Unit* caster = GetCaster())
|
||||
// caster->AddAura(SPELL_DRAGONRIDER_ENERGY, caster);
|
||||
// GetTarget()->CastSpell(GetTarget(), SPELL_ENERGY_WIDGET, true);
|
||||
// GetTarget()->SetPower(POWER_ALTERNATE_MOUNT, GetTarget()->GetPower(POWER_ALTERNATE_MOUNT), true);
|
||||
// }
|
||||
//
|
||||
// void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
// {
|
||||
// if (Unit* caster = GetCaster())
|
||||
// {
|
||||
// caster->RemoveAura(SPELL_DRAGONRIDER_ENERGY);
|
||||
// caster->RemoveAura(SPELL_VIGOR_CACHE);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// void Register() override
|
||||
// {
|
||||
// OnEffectPeriodic += AuraEffectPeriodicFn(spell_dragonriding::OnPeriodic, EFFECT_2, SPELL_AURA_PERIODIC_DUMMY);
|
||||
// OnEffectApply += AuraEffectApplyFn(spell_dragonriding::OnApply, EFFECT_2, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
// OnEffectRemove += AuraEffectRemoveFn(spell_dragonriding::OnRemove, EFFECT_2, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
// }
|
||||
//};
|
||||
//
|
||||
//// 372771 - Dragonrider Energy
|
||||
//class spell_dragonrider_energy : public AuraScript
|
||||
//{
|
||||
// void OnPeriodic(AuraEffect* /*aurEff*/)
|
||||
// {
|
||||
// Unit* caster = GetCaster();
|
||||
// if (!caster)
|
||||
// return;
|
||||
//
|
||||
// caster->ToPlayer()->AddAura(433547, caster);
|
||||
//
|
||||
// int newMaxPower = 3;
|
||||
//
|
||||
// if (caster->HasAura(377920) && !caster->HasAura(377921) && !caster->HasAura(377922))
|
||||
// {
|
||||
// newMaxPower = 4;
|
||||
// }
|
||||
// else if (caster->HasAura(377921) && caster->HasAura(377920) && !caster->HasAura(377922))
|
||||
// {
|
||||
// newMaxPower = 5;
|
||||
// }
|
||||
// else if (caster->HasAura(377922) && caster->HasAura(377921) && caster->HasAura(377920))
|
||||
// {
|
||||
// newMaxPower = 6;
|
||||
// }
|
||||
//
|
||||
// caster->SetMaxPower(POWER_ALTERNATE_MOUNT, newMaxPower);
|
||||
// }
|
||||
//
|
||||
// void Register() override
|
||||
// {
|
||||
// OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_dragonrider_energy::OnPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY);
|
||||
// }
|
||||
//};
|
||||
//
|
||||
//// 372773 - Dragonrider Energy
|
||||
//class spell_af_energy : public AuraScript
|
||||
//{
|
||||
// void OnPeriodic(AuraEffect* /*aurEff*/)
|
||||
// {
|
||||
// if (Unit* caster = GetCaster())
|
||||
// {
|
||||
// if (ShouldRegenEnergy(caster))
|
||||
// {
|
||||
// if (AuraEffect* subAmountAurEff = caster->GetAuraEffect(SPELL_VIGOR_CACHE, EFFECT_1))
|
||||
// {
|
||||
// int32 baseRegen = 20; // Todo : Calculate this based on talents & if we are thrilled/grounded
|
||||
//
|
||||
// int32 newAmount = subAmountAurEff->GetAmount() + baseRegen;
|
||||
//
|
||||
// if (newAmount >= 100)
|
||||
// {
|
||||
// newAmount -= 100;
|
||||
//
|
||||
// caster->CastSpell(caster, SPELL_DRAGONRIDER_ENERGIZE, TRIGGERED_FULL_MASK);
|
||||
//
|
||||
// if (AuraEffect* amountAurEff = caster->GetAuraEffect(SPELL_VIGOR_CACHE, EFFECT_0))
|
||||
// amountAurEff->SetAmount(caster->GetPower(POWER_ALTERNATE_MOUNT));
|
||||
// }
|
||||
//
|
||||
// subAmountAurEff->SetAmount(newAmount);
|
||||
// subAmountAurEff->GetBase()->SetNeedClientUpdateForTargets();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// bool ShouldRegenEnergy(Unit const* caster) const
|
||||
// {
|
||||
// if (caster->GetPower(POWER_ALTERNATE_MOUNT) == caster->GetMaxPower(POWER_ALTERNATE_MOUNT))
|
||||
// return false;
|
||||
//
|
||||
// FlightCapabilityEntry const* flightCapabilityEntry = sFlightCapabilityStore.LookupEntry(caster->GetFlightCapabilityID());
|
||||
// if (!flightCapabilityEntry)
|
||||
// return false;
|
||||
//
|
||||
// float velocityRegenThreshold = flightCapabilityEntry->MaxVel * flightCapabilityEntry->VigorRegenMaxVelCoefficient;
|
||||
// if (caster->GetAdvFlyingVelocity() >= velocityRegenThreshold)
|
||||
// return true;
|
||||
//
|
||||
// return !caster->IsInAir() || caster->IsInWater();
|
||||
// }
|
||||
//
|
||||
// void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
// {
|
||||
// GetTarget()->RemoveAurasDueToSpell(SPELL_VIGOR_CACHE);
|
||||
// }
|
||||
//
|
||||
// void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
// {
|
||||
// Unit* target = GetTarget();
|
||||
// if (!target->HasAura(SPELL_VIGOR_CACHE))
|
||||
// {
|
||||
// CastSpellExtraArgs extraArgs(TRIGGERED_FULL_MASK);
|
||||
// extraArgs.AddSpellMod(SPELLVALUE_BASE_POINT0, target->GetPower(POWER_ALTERNATE_MOUNT));
|
||||
// target->CastSpell(target, SPELL_VIGOR_CACHE, extraArgs);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// void Register() override
|
||||
// {
|
||||
// OnEffectApply += AuraEffectApplyFn(spell_af_energy::OnApply, EFFECT_0, SPELL_AURA_ENABLE_ALT_POWER, AURA_EFFECT_HANDLE_REAL);
|
||||
// OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_af_energy::OnPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY);
|
||||
// OnEffectRemove += AuraEffectRemoveFn(spell_af_energy::OnRemove, EFFECT_0, SPELL_AURA_ENABLE_ALT_POWER, AURA_EFFECT_HANDLE_REAL);
|
||||
// }
|
||||
//};
|
||||
//
|
||||
void AddSC_dragonriding_spell_scripts()
|
||||
{
|
||||
RegisterSpellScript(spell_switch_flight);
|
||||
RegisterSpellAndAuraScriptPair(spell_dragonriding_whirling_surge, spell_dragonriding_whirling_surge_aura);
|
||||
RegisterSpellAndAuraScriptPair(spell_dragonriding_launch_boost, spell_dragonriding_launch_boost_aura);
|
||||
RegisterSpellScript(spell_dragonriding_surge_forward);
|
||||
RegisterSpellScript(spell_dragonriding_skyward_ascent);
|
||||
RegisterSpellScript(spell_dragonriding);
|
||||
RegisterSpellScript(spell_dragonrider_energy);
|
||||
RegisterSpellScript(spell_af_energy);
|
||||
// RegisterSpellScript(spell_switch_flight);
|
||||
// RegisterSpellAndAuraScriptPair(spell_dragonriding_whirling_surge, spell_dragonriding_whirling_surge_aura);
|
||||
// RegisterSpellAndAuraScriptPair(spell_dragonriding_launch_boost, spell_dragonriding_launch_boost_aura);
|
||||
// RegisterSpellScript(spell_dragonriding_surge_forward);
|
||||
// RegisterSpellScript(spell_dragonriding_skyward_ascent);
|
||||
// RegisterSpellScript(spell_dragonriding);
|
||||
// RegisterSpellScript(spell_dragonrider_energy);
|
||||
// RegisterSpellScript(spell_af_energy);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user