Core/AreaTriggers: Document scale curve fields (needs tested)
Port TrinityCore Commit: https://github.com/TrinityCore/TrinityCore/commit/d180944f59fc4bbe1d7a2a69896ec0af18e45d61
This commit is contained in:
@@ -87,7 +87,7 @@ namespace Game.Entities
|
|||||||
return at;
|
return at;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Create(uint spellMiscId, Unit caster, Unit target, SpellInfo spell, Position pos, int duration, uint spellXSpellVisualId, ObjectGuid castId, AuraEffect aurEff)
|
unsafe bool Create(uint spellMiscId, Unit caster, Unit target, SpellInfo spell, Position pos, int duration, uint spellXSpellVisualId, ObjectGuid castId, AuraEffect aurEff)
|
||||||
{
|
{
|
||||||
_targetGuid = target ? target.GetGUID() : ObjectGuid.Empty;
|
_targetGuid = target ? target.GetGUID() : ObjectGuid.Empty;
|
||||||
_aurEff = aurEff;
|
_aurEff = aurEff;
|
||||||
@@ -125,8 +125,8 @@ namespace Game.Entities
|
|||||||
SetUInt32Value(AreaTriggerFields.DecalPropertiesId, GetMiscTemplate().DecalPropertiesId);
|
SetUInt32Value(AreaTriggerFields.DecalPropertiesId, GetMiscTemplate().DecalPropertiesId);
|
||||||
|
|
||||||
for (byte scaleCurveIndex = 0; scaleCurveIndex < SharedConst.MaxAreatriggerScale; ++scaleCurveIndex)
|
for (byte scaleCurveIndex = 0; scaleCurveIndex < SharedConst.MaxAreatriggerScale; ++scaleCurveIndex)
|
||||||
if (GetMiscTemplate().ScaleInfo.ExtraScale[scaleCurveIndex].AsInt32 != 0)
|
if (GetMiscTemplate().ExtraScale.Raw.Data[scaleCurveIndex] != 0)
|
||||||
SetUInt32Value(AreaTriggerFields.ExtraScaleCurve + scaleCurveIndex, (uint)GetMiscTemplate().ScaleInfo.ExtraScale[scaleCurveIndex].AsInt32);
|
SetUInt32Value(AreaTriggerFields.ExtraScaleCurve + scaleCurveIndex, (uint)GetMiscTemplate().ExtraScale.Raw.Data[scaleCurveIndex]);
|
||||||
|
|
||||||
PhasingHandler.InheritPhaseShift(this, caster);
|
PhasingHandler.InheritPhaseShift(this, caster);
|
||||||
|
|
||||||
|
|||||||
@@ -81,38 +81,51 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Scale array definition
|
||||||
|
/// 0 - time offset from creation for starting of scaling
|
||||||
|
/// 1+2,3+4 are values for curve points Vector2[2]
|
||||||
|
// 5 is packed curve information (has_no_data & 1) | ((interpolation_mode & 0x7) << 1) | ((first_point_offset & 0x7FFFFF) << 4) | ((point_count & 0x1F) << 27)
|
||||||
|
/// 6 bool is_override, only valid for AREATRIGGER_OVERRIDE_SCALE_CURVE, if true then use data from AREATRIGGER_OVERRIDE_SCALE_CURVE instead of ScaleCurveId from CreateObject
|
||||||
|
/// </summary>
|
||||||
|
[StructLayout(LayoutKind.Explicit)]
|
||||||
public class AreaTriggerScaleInfo
|
public class AreaTriggerScaleInfo
|
||||||
{
|
{
|
||||||
public AreaTriggerScaleInfo()
|
[FieldOffset(0)]
|
||||||
{
|
public StructuredData Structured;
|
||||||
OverrideScale = new OverrideScaleStruct[SharedConst.MaxAreatriggerScale];
|
|
||||||
ExtraScale = new ExtraScaleStruct[SharedConst.MaxAreatriggerScale];
|
|
||||||
|
|
||||||
ExtraScale[5].AsFloat = 1.0000001f;
|
[FieldOffset(0)]
|
||||||
ExtraScale[6].AsInt32 = 1;
|
public RawData Raw;
|
||||||
}
|
|
||||||
|
|
||||||
public OverrideScaleStruct[] OverrideScale;
|
|
||||||
public ExtraScaleStruct[] ExtraScale;
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Explicit)]
|
[StructLayout(LayoutKind.Explicit)]
|
||||||
public struct OverrideScaleStruct
|
public struct StructuredData
|
||||||
{
|
{
|
||||||
[FieldOffset(0)]
|
[FieldOffset(0)]
|
||||||
public int AsInt32;
|
public uint StartTimeOffset;
|
||||||
|
|
||||||
[FieldOffset(0)]
|
[FieldOffset(4)]
|
||||||
public float AsFloat;
|
public float[] Points;
|
||||||
|
|
||||||
|
[FieldOffset(20)]
|
||||||
|
public curveparameters CurveParameters;
|
||||||
|
|
||||||
|
[FieldOffset(24)]
|
||||||
|
public uint OverrideActive;
|
||||||
|
|
||||||
|
public struct curveparameters
|
||||||
|
{
|
||||||
|
public uint Raw;
|
||||||
|
|
||||||
|
public uint NoData { get { return Raw & 1; } }
|
||||||
|
public uint InterpolationMode { get { return (Raw & 0x7) << 1; } }
|
||||||
|
public uint FirstPointOffset { get { return (Raw & 0x7FFFFF) << 4; } }
|
||||||
|
public uint PointCount { get { return (Raw & 0x1F) << 27; } }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Explicit)]
|
public unsafe struct RawData
|
||||||
public struct ExtraScaleStruct
|
|
||||||
{
|
{
|
||||||
[FieldOffset(0)]
|
public fixed uint Data[SharedConst.MaxAreatriggerScale];
|
||||||
public int AsInt32;
|
|
||||||
|
|
||||||
[FieldOffset(0)]
|
|
||||||
public float AsFloat;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,8 +229,17 @@ namespace Game.Entities
|
|||||||
public List<AreaTriggerAction> Actions = new List<AreaTriggerAction>();
|
public List<AreaTriggerAction> Actions = new List<AreaTriggerAction>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AreaTriggerMiscTemplate
|
public unsafe class AreaTriggerMiscTemplate
|
||||||
{
|
{
|
||||||
|
public AreaTriggerMiscTemplate()
|
||||||
|
{
|
||||||
|
// legacy code from before it was known what each curve field does
|
||||||
|
// wtf? thats not how you pack curve data
|
||||||
|
ExtraScale.Raw.Data[5] = (uint)1.0000001f;
|
||||||
|
// also OverrideActive does nothing on ExtraScale
|
||||||
|
ExtraScale.Structured.OverrideActive = 1;
|
||||||
|
}
|
||||||
|
|
||||||
public bool HasSplines() { return SplinePoints.Count >= 2; }
|
public bool HasSplines() { return SplinePoints.Count >= 2; }
|
||||||
|
|
||||||
public uint MiscId;
|
public uint MiscId;
|
||||||
@@ -236,7 +258,8 @@ namespace Game.Entities
|
|||||||
public uint TimeToTarget;
|
public uint TimeToTarget;
|
||||||
public uint TimeToTargetScale;
|
public uint TimeToTargetScale;
|
||||||
|
|
||||||
public AreaTriggerScaleInfo ScaleInfo = new AreaTriggerScaleInfo();
|
public AreaTriggerScaleInfo OverrideScale = new AreaTriggerScaleInfo();
|
||||||
|
public AreaTriggerScaleInfo ExtraScale = new AreaTriggerScaleInfo();
|
||||||
public AreaTriggerCircularMovementInfo CircularMovementInfo;
|
public AreaTriggerCircularMovementInfo CircularMovementInfo;
|
||||||
|
|
||||||
public AreaTriggerTemplate Template;
|
public AreaTriggerTemplate Template;
|
||||||
|
|||||||
Reference in New Issue
Block a user