Core/Auras: Implemented adv flying speed mod auras
Port From (https://github.com/TrinityCore/TrinityCore/commit/6e0b146f1d6df817714595995632e2514e5869a8)
This commit is contained in:
@@ -520,18 +520,18 @@ namespace Framework.Constants
|
|||||||
ModifiedRaidInstance = 510, // NYI; Related to "Fated" raid affixes
|
ModifiedRaidInstance = 510, // NYI; Related to "Fated" raid affixes
|
||||||
ApplyProfessionEffect = 511, // Nyi; Miscvalue[0] = Professioneffectid
|
ApplyProfessionEffect = 511, // Nyi; Miscvalue[0] = Professioneffectid
|
||||||
Unk512 = 512,
|
Unk512 = 512,
|
||||||
Unk513 = 513,
|
ModAdvFlyingAirFriction = 513,
|
||||||
Unk514 = 514,
|
ModAdvFlyingMaxVel = 514,
|
||||||
Unk515 = 515,
|
ModAdvFlyingLiftCoef = 515,
|
||||||
Unk516 = 516,
|
Unk516 = 516,
|
||||||
Unk517 = 517,
|
Unk517 = 517,
|
||||||
Unk518 = 518,
|
ModAdvFlyingAddImpulseMaxSpeed = 518,
|
||||||
ModCooldownRecoveryRateAll = 519, // Nyi; Applies To All Spells, Not Filtered By Familyflags Or Label
|
ModCooldownRecoveryRateAll = 519, // Nyi; Applies To All Spells, Not Filtered By Familyflags Or Label
|
||||||
Unk520 = 520,
|
ModAdvFlyingBankingRate = 520,
|
||||||
Unk521 = 521,
|
ModAdvFlyingPitchingRateDown = 521,
|
||||||
Unk522 = 522,
|
ModAdvFlyingPitchingRateUp = 522,
|
||||||
Unk523 = 523,
|
Unk523 = 523,
|
||||||
Unk524 = 524,
|
ModAdvFlyingOverMaxDeceleration = 524,
|
||||||
DisplayProfessionEquipment = 525, // Nyi; Miscvalue[0] = Profession (Enum, Not Id)
|
DisplayProfessionEquipment = 525, // Nyi; Miscvalue[0] = Profession (Enum, Not Id)
|
||||||
Unk526 = 526,
|
Unk526 = 526,
|
||||||
Unk527 = 527,
|
Unk527 = 527,
|
||||||
|
|||||||
@@ -176,26 +176,38 @@ namespace Game.Entities
|
|||||||
UpdateAdvFlyingSpeed(AdvFlyingRateTypeSingle.LaunchSpeedCoefficient, clientUpdate);
|
UpdateAdvFlyingSpeed(AdvFlyingRateTypeSingle.LaunchSpeedCoefficient, clientUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateAdvFlyingSpeed(AdvFlyingRateTypeSingle speedType, bool clientUpdate)
|
public void UpdateAdvFlyingSpeed(AdvFlyingRateTypeSingle speedType, bool clientUpdate)
|
||||||
{
|
{
|
||||||
FlightCapabilityRecord flightCapabilityEntry = CliDB.FlightCapabilityStorage.LookupByKey(GetFlightCapabilityID());
|
FlightCapabilityRecord flightCapabilityEntry = CliDB.FlightCapabilityStorage.LookupByKey(GetFlightCapabilityID());
|
||||||
if (flightCapabilityEntry == null)
|
if (flightCapabilityEntry == null)
|
||||||
flightCapabilityEntry = CliDB.FlightCapabilityStorage.LookupByKey(1);
|
flightCapabilityEntry = CliDB.FlightCapabilityStorage.LookupByKey(1);
|
||||||
|
|
||||||
(ServerOpcodes opcode, float newValue) = speedType switch
|
(ServerOpcodes opcode, float newValue, AuraType rateAura) = speedType switch
|
||||||
{
|
{
|
||||||
AdvFlyingRateTypeSingle.AirFriction => (ServerOpcodes.MoveSetAdvFlyingAirFriction, flightCapabilityEntry.AirFriction),
|
AdvFlyingRateTypeSingle.AirFriction => (ServerOpcodes.MoveSetAdvFlyingAirFriction, flightCapabilityEntry.AirFriction, AuraType.ModAdvFlyingAirFriction),
|
||||||
AdvFlyingRateTypeSingle.MaxVel => (ServerOpcodes.MoveSetAdvFlyingMaxVel, flightCapabilityEntry.MaxVel),
|
AdvFlyingRateTypeSingle.MaxVel => (ServerOpcodes.MoveSetAdvFlyingMaxVel, flightCapabilityEntry.MaxVel, AuraType.ModAdvFlyingMaxVel),
|
||||||
AdvFlyingRateTypeSingle.LiftCoefficient => (ServerOpcodes.MoveSetAdvFlyingLiftCoefficient, flightCapabilityEntry.LiftCoefficient),
|
AdvFlyingRateTypeSingle.LiftCoefficient => (ServerOpcodes.MoveSetAdvFlyingLiftCoefficient, flightCapabilityEntry.LiftCoefficient, AuraType.ModAdvFlyingLiftCoef),
|
||||||
AdvFlyingRateTypeSingle.DoubleJumpVelMod => (ServerOpcodes.MoveSetAdvFlyingDoubleJumpVelMod, flightCapabilityEntry.DoubleJumpVelMod),
|
AdvFlyingRateTypeSingle.DoubleJumpVelMod => (ServerOpcodes.MoveSetAdvFlyingDoubleJumpVelMod, flightCapabilityEntry.DoubleJumpVelMod, AuraType.None),
|
||||||
AdvFlyingRateTypeSingle.GlideStartMinHeight => (ServerOpcodes.MoveSetAdvFlyingGlideStartMinHeight, flightCapabilityEntry.GlideStartMinHeight),
|
AdvFlyingRateTypeSingle.GlideStartMinHeight => (ServerOpcodes.MoveSetAdvFlyingGlideStartMinHeight, flightCapabilityEntry.GlideStartMinHeight, AuraType.None),
|
||||||
AdvFlyingRateTypeSingle.AddImpulseMaxSpeed => (ServerOpcodes.MoveSetAdvFlyingAddImpulseMaxSpeed, flightCapabilityEntry.AddImpulseMaxSpeed),
|
AdvFlyingRateTypeSingle.AddImpulseMaxSpeed => (ServerOpcodes.MoveSetAdvFlyingAddImpulseMaxSpeed, flightCapabilityEntry.AddImpulseMaxSpeed, AuraType.ModAdvFlyingAddImpulseMaxSpeed),
|
||||||
AdvFlyingRateTypeSingle.SurfaceFriction => (ServerOpcodes.MoveSetAdvFlyingSurfaceFriction, flightCapabilityEntry.SurfaceFriction),
|
AdvFlyingRateTypeSingle.SurfaceFriction => (ServerOpcodes.MoveSetAdvFlyingSurfaceFriction, flightCapabilityEntry.SurfaceFriction, AuraType.None),
|
||||||
AdvFlyingRateTypeSingle.OverMaxDeceleration => (ServerOpcodes.MoveSetAdvFlyingOverMaxDeceleration, flightCapabilityEntry.OverMaxDeceleration),
|
AdvFlyingRateTypeSingle.OverMaxDeceleration => (ServerOpcodes.MoveSetAdvFlyingOverMaxDeceleration, flightCapabilityEntry.OverMaxDeceleration, AuraType.ModAdvFlyingOverMaxDeceleration),
|
||||||
AdvFlyingRateTypeSingle.LaunchSpeedCoefficient => (ServerOpcodes.MoveSetAdvFlyingLaunchSpeedCoefficient, flightCapabilityEntry.LaunchSpeedCoefficient),
|
AdvFlyingRateTypeSingle.LaunchSpeedCoefficient => (ServerOpcodes.MoveSetAdvFlyingLaunchSpeedCoefficient, flightCapabilityEntry.LaunchSpeedCoefficient, AuraType.None),
|
||||||
_ => (ServerOpcodes.Max, 0)
|
_ => (ServerOpcodes.Max, 0, AuraType.None)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (rateAura != AuraType.None)
|
||||||
|
{
|
||||||
|
// take only lowest negative and highest positive auras - these effects do not stack
|
||||||
|
int neg = GetMaxNegativeAuraModifier(rateAura, mod => mod.GetAmount() > 0 && mod.GetAmount() < 100);
|
||||||
|
if (neg != 0)
|
||||||
|
MathFunctions.ApplyPct(ref newValue, neg);
|
||||||
|
|
||||||
|
int pos = GetMaxPositiveAuraModifier(rateAura, mod => mod.GetAmount() > 100);
|
||||||
|
if (pos != 0)
|
||||||
|
MathFunctions.ApplyPct(ref newValue, pos);
|
||||||
|
}
|
||||||
|
|
||||||
if (m_advFlyingSpeed[(int)speedType] == newValue)
|
if (m_advFlyingSpeed[(int)speedType] == newValue)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -215,21 +227,39 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateAdvFlyingSpeed(AdvFlyingRateTypeRange speedType, bool clientUpdate)
|
public void UpdateAdvFlyingSpeed(AdvFlyingRateTypeRange speedType, bool clientUpdate)
|
||||||
{
|
{
|
||||||
FlightCapabilityRecord flightCapabilityEntry = CliDB.FlightCapabilityStorage.LookupByKey(GetFlightCapabilityID());
|
FlightCapabilityRecord flightCapabilityEntry = CliDB.FlightCapabilityStorage.LookupByKey(GetFlightCapabilityID());
|
||||||
if (flightCapabilityEntry == null)
|
if (flightCapabilityEntry == null)
|
||||||
flightCapabilityEntry = CliDB.FlightCapabilityStorage.LookupByKey(1);
|
flightCapabilityEntry = CliDB.FlightCapabilityStorage.LookupByKey(1);
|
||||||
|
|
||||||
(ServerOpcodes opcode, float min, float max) = speedType switch
|
(ServerOpcodes opcode, float min, float max, AuraType rateAura) = speedType switch
|
||||||
{
|
{
|
||||||
AdvFlyingRateTypeRange.BankingRate => (ServerOpcodes.MoveSetAdvFlyingBankingRate, flightCapabilityEntry.BankingRateMin, flightCapabilityEntry.BankingRateMax),
|
AdvFlyingRateTypeRange.BankingRate => (ServerOpcodes.MoveSetAdvFlyingBankingRate, flightCapabilityEntry.BankingRateMin, flightCapabilityEntry.BankingRateMax, AuraType.ModAdvFlyingBankingRate),
|
||||||
AdvFlyingRateTypeRange.PitchingRateDown => (ServerOpcodes.MoveSetAdvFlyingPitchingRateDown, flightCapabilityEntry.PitchingRateDownMin, flightCapabilityEntry.PitchingRateDownMax),
|
AdvFlyingRateTypeRange.PitchingRateDown => (ServerOpcodes.MoveSetAdvFlyingPitchingRateDown, flightCapabilityEntry.PitchingRateDownMin, flightCapabilityEntry.PitchingRateDownMax, AuraType.ModAdvFlyingPitchingRateDown),
|
||||||
AdvFlyingRateTypeRange.PitchingRateUp => (ServerOpcodes.MoveSetAdvFlyingPitchingRateUp, flightCapabilityEntry.PitchingRateUpMin, flightCapabilityEntry.PitchingRateUpMax),
|
AdvFlyingRateTypeRange.PitchingRateUp => (ServerOpcodes.MoveSetAdvFlyingPitchingRateUp, flightCapabilityEntry.PitchingRateUpMin, flightCapabilityEntry.PitchingRateUpMax, AuraType.ModAdvFlyingPitchingRateUp),
|
||||||
AdvFlyingRateTypeRange.TurnVelocityThreshold => (ServerOpcodes.MoveSetAdvFlyingTurnVelocityThreshold, flightCapabilityEntry.TurnVelocityThresholdMin, flightCapabilityEntry.TurnVelocityThresholdMax),
|
AdvFlyingRateTypeRange.TurnVelocityThreshold => (ServerOpcodes.MoveSetAdvFlyingTurnVelocityThreshold, flightCapabilityEntry.TurnVelocityThresholdMin, flightCapabilityEntry.TurnVelocityThresholdMax, AuraType.None),
|
||||||
_ => (ServerOpcodes.Max, 0, 0)
|
_ => (ServerOpcodes.Max, 0, 0, AuraType.None)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (rateAura != AuraType.None)
|
||||||
|
{
|
||||||
|
// take only lowest negative and highest positive auras - these effects do not stack
|
||||||
|
int neg = GetMaxNegativeAuraModifier(rateAura, mod => mod.GetAmount() > 0 && mod.GetAmount() < 100);
|
||||||
|
if (neg != 0)
|
||||||
|
{
|
||||||
|
MathFunctions.ApplyPct(ref min, neg);
|
||||||
|
MathFunctions.ApplyPct(ref max, neg);
|
||||||
|
}
|
||||||
|
|
||||||
|
int pos = GetMaxPositiveAuraModifier(rateAura, mod => mod.GetAmount() > 100);
|
||||||
|
if (pos != 0)
|
||||||
|
{
|
||||||
|
MathFunctions.ApplyPct(ref min, pos);
|
||||||
|
MathFunctions.ApplyPct(ref max, pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (m_advFlyingSpeed[(int)speedType] == min && m_advFlyingSpeed[(int)speedType + 1] == max)
|
if (m_advFlyingSpeed[(int)speedType] == min && m_advFlyingSpeed[(int)speedType + 1] == max)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -2888,6 +2888,49 @@ namespace Game.Spells
|
|||||||
aurApp.GetTarget().UpdateMovementForcesModMagnitude();
|
aurApp.GetTarget().UpdateMovementForcesModMagnitude();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[AuraEffectHandler(AuraType.ModAdvFlyingAirFriction)]
|
||||||
|
[AuraEffectHandler(AuraType.ModAdvFlyingMaxVel)]
|
||||||
|
[AuraEffectHandler(AuraType.ModAdvFlyingLiftCoef)]
|
||||||
|
[AuraEffectHandler(AuraType.ModAdvFlyingAddImpulseMaxSpeed)]
|
||||||
|
[AuraEffectHandler(AuraType.ModAdvFlyingBankingRate)]
|
||||||
|
[AuraEffectHandler(AuraType.ModAdvFlyingPitchingRateDown)]
|
||||||
|
[AuraEffectHandler(AuraType.ModAdvFlyingPitchingRateUp)]
|
||||||
|
[AuraEffectHandler(AuraType.ModAdvFlyingOverMaxDeceleration)]
|
||||||
|
void HandleAuraModAdvFlyingSpeed(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
|
||||||
|
{
|
||||||
|
if (!mode.HasAnyFlag(AuraEffectHandleModes.ChangeAmountMask))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Unit target = aurApp.GetTarget();
|
||||||
|
switch (GetAuraType())
|
||||||
|
{
|
||||||
|
case AuraType.ModAdvFlyingAirFriction:
|
||||||
|
target.UpdateAdvFlyingSpeed(AdvFlyingRateTypeSingle.AirFriction, true);
|
||||||
|
break;
|
||||||
|
case AuraType.ModAdvFlyingMaxVel:
|
||||||
|
target.UpdateAdvFlyingSpeed(AdvFlyingRateTypeSingle.MaxVel, true);
|
||||||
|
break;
|
||||||
|
case AuraType.ModAdvFlyingLiftCoef:
|
||||||
|
target.UpdateAdvFlyingSpeed(AdvFlyingRateTypeSingle.LiftCoefficient, true);
|
||||||
|
break;
|
||||||
|
case AuraType.ModAdvFlyingAddImpulseMaxSpeed:
|
||||||
|
target.UpdateAdvFlyingSpeed(AdvFlyingRateTypeSingle.AddImpulseMaxSpeed, true);
|
||||||
|
break;
|
||||||
|
case AuraType.ModAdvFlyingBankingRate:
|
||||||
|
target.UpdateAdvFlyingSpeed(AdvFlyingRateTypeRange.BankingRate, true);
|
||||||
|
break;
|
||||||
|
case AuraType.ModAdvFlyingPitchingRateDown:
|
||||||
|
target.UpdateAdvFlyingSpeed(AdvFlyingRateTypeRange.PitchingRateDown, true);
|
||||||
|
break;
|
||||||
|
case AuraType.ModAdvFlyingPitchingRateUp:
|
||||||
|
target.UpdateAdvFlyingSpeed(AdvFlyingRateTypeRange.PitchingRateUp, true);
|
||||||
|
break;
|
||||||
|
case AuraType.ModAdvFlyingOverMaxDeceleration:
|
||||||
|
target.UpdateAdvFlyingSpeed(AdvFlyingRateTypeSingle.OverMaxDeceleration, true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
/*** IMMUNITY ***/
|
/*** IMMUNITY ***/
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
|
|||||||
Reference in New Issue
Block a user