Some fixes from the ports.
This commit is contained in:
@@ -180,6 +180,12 @@ namespace System.Collections.Generic
|
|||||||
{
|
{
|
||||||
Array.Clear(array, 0, array.Length);
|
Array.Clear(array, 0, array.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void EnsureWritableListIndex<T>(this List<T> list, uint index, T defaultValue)
|
||||||
|
{
|
||||||
|
while (list.Count <= index)
|
||||||
|
list.Add(defaultValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface ICheck<in T>
|
public interface ICheck<in T>
|
||||||
|
|||||||
@@ -282,7 +282,7 @@ namespace Game.Collision
|
|||||||
public GameObjectModel GetHitModel() { return _hitModel; }
|
public GameObjectModel GetHitModel() { return _hitModel; }
|
||||||
|
|
||||||
PhaseShift _phaseShift;
|
PhaseShift _phaseShift;
|
||||||
LocationInfo _locationInfo;
|
LocationInfo _locationInfo = new();
|
||||||
GameObjectModel _hitModel;
|
GameObjectModel _hitModel = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ namespace Game.Collision
|
|||||||
{
|
{
|
||||||
AreaAndLiquidData data = new();
|
AreaAndLiquidData data = new();
|
||||||
|
|
||||||
Vector3 v = new(x, y, z +0.5f);
|
Vector3 v = new(x, y, z + 0.5f);
|
||||||
DynamicTreeLocationInfoCallback intersectionCallBack = new(phaseShift);
|
DynamicTreeLocationInfoCallback intersectionCallBack = new(phaseShift);
|
||||||
impl.IntersectPoint(v, intersectionCallBack);
|
impl.IntersectPoint(v, intersectionCallBack);
|
||||||
if (intersectionCallBack.GetLocationInfo().hitModel != null)
|
if (intersectionCallBack.GetLocationInfo().hitModel != null)
|
||||||
|
|||||||
@@ -286,7 +286,7 @@ namespace Game.DataStorage
|
|||||||
uint oldMSTime = Time.GetMSTime();
|
uint oldMSTime = Time.GetMSTime();
|
||||||
// Load area trigger positions (to put them on the server)
|
// Load area trigger positions (to put them on the server)
|
||||||
// 0 1 2 3 4 5 6 7 8 9 10
|
// 0 1 2 3 4 5 6 7 8 9 10
|
||||||
SQLResult templates = DB.World.Query("SELECT SpawnId, AreaTriggerId, IsServerSide, MapId, PosX, PosY, PosZ, Orientation, PhaseUseFlags, PhaseId, PhaseGroup " +
|
SQLResult templates = DB.World.Query("SELECT SpawnId, AreaTriggerId, IsServerSide, MapId, PosX, PosY, PosZ, Orientation, PhaseUseFlags, PhaseId, PhaseGroup, " +
|
||||||
//11 12 13 14 15 16 17
|
//11 12 13 14 15 16 17
|
||||||
"Shape, ShapeData0, ShapeData1, ShapeData2, ShapeData3, ShapeData4, ShapeData5 FROM `areatrigger`");
|
"Shape, ShapeData0, ShapeData1, ShapeData2, ShapeData3, ShapeData4, ShapeData5 FROM `areatrigger`");
|
||||||
if (!templates.IsEmpty())
|
if (!templates.IsEmpty())
|
||||||
|
|||||||
@@ -311,7 +311,7 @@ namespace Game.Entities
|
|||||||
public AreaTriggerScaleInfo OverrideScale = new();
|
public AreaTriggerScaleInfo OverrideScale = new();
|
||||||
public AreaTriggerScaleInfo ExtraScale = new();
|
public AreaTriggerScaleInfo ExtraScale = new();
|
||||||
|
|
||||||
public AreaTriggerShapeInfo Shape;
|
public AreaTriggerShapeInfo Shape = new();
|
||||||
public List<Vector2> PolygonVertices = new();
|
public List<Vector2> PolygonVertices = new();
|
||||||
public List<Vector2> PolygonVerticesTarget = new();
|
public List<Vector2> PolygonVerticesTarget = new();
|
||||||
public List<Vector3> SplinePoints = new();
|
public List<Vector3> SplinePoints = new();
|
||||||
@@ -327,7 +327,7 @@ namespace Game.Entities
|
|||||||
public uint PhaseGroup;
|
public uint PhaseGroup;
|
||||||
public byte PhaseUseFlags;
|
public byte PhaseUseFlags;
|
||||||
|
|
||||||
public AreaTriggerShapeInfo Shape;
|
public AreaTriggerShapeInfo Shape = new();
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct AreaTriggerAction
|
public struct AreaTriggerAction
|
||||||
|
|||||||
@@ -41,7 +41,8 @@ namespace Game.Spells
|
|||||||
if (spellEffect == null)
|
if (spellEffect == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
_effects.Add(new SpellEffectInfo(this, spellEffect));
|
_effects.EnsureWritableListIndex(spellEffect.EffectIndex, new SpellEffectInfo(this));
|
||||||
|
_effects[(int)spellEffect.EffectIndex] = new SpellEffectInfo(this, spellEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
SpellName = spellName.Name;
|
SpellName = spellName.Name;
|
||||||
@@ -252,7 +253,10 @@ namespace Game.Spells
|
|||||||
SpellName = spellName.Name;
|
SpellName = spellName.Name;
|
||||||
|
|
||||||
foreach (SpellEffectRecord spellEffect in effects)
|
foreach (SpellEffectRecord spellEffect in effects)
|
||||||
_effects.Add(new SpellEffectInfo(this, spellEffect));
|
{
|
||||||
|
_effects.EnsureWritableListIndex(spellEffect.EffectIndex, new SpellEffectInfo(this));
|
||||||
|
_effects[(int)spellEffect.EffectIndex] = new SpellEffectInfo(this, spellEffect);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasEffect(SpellEffectName effect)
|
public bool HasEffect(SpellEffectName effect)
|
||||||
@@ -307,6 +311,9 @@ namespace Game.Spells
|
|||||||
|
|
||||||
public bool IsExplicitDiscovery()
|
public bool IsExplicitDiscovery()
|
||||||
{
|
{
|
||||||
|
if (GetEffects().Count < 2)
|
||||||
|
return false;
|
||||||
|
|
||||||
return ((GetEffect(0).Effect == SpellEffectName.CreateRandomItem
|
return ((GetEffect(0).Effect == SpellEffectName.CreateRandomItem
|
||||||
|| GetEffect(0).Effect == SpellEffectName.CreateLoot)
|
|| GetEffect(0).Effect == SpellEffectName.CreateLoot)
|
||||||
&& GetEffect(1).Effect == SpellEffectName.ScriptEffect)
|
&& GetEffect(1).Effect == SpellEffectName.ScriptEffect)
|
||||||
@@ -3917,37 +3924,40 @@ namespace Game.Spells
|
|||||||
|
|
||||||
public class SpellEffectInfo
|
public class SpellEffectInfo
|
||||||
{
|
{
|
||||||
public SpellEffectInfo(SpellInfo spellInfo, SpellEffectRecord effect)
|
public SpellEffectInfo(SpellInfo spellInfo, SpellEffectRecord effect = null)
|
||||||
{
|
{
|
||||||
_spellInfo = spellInfo;
|
_spellInfo = spellInfo;
|
||||||
EffectIndex = effect.EffectIndex;
|
if (effect != null)
|
||||||
Effect = (SpellEffectName)effect.Effect;
|
{
|
||||||
ApplyAuraName = (AuraType)effect.EffectAura;
|
EffectIndex = effect.EffectIndex;
|
||||||
ApplyAuraPeriod = effect.EffectAuraPeriod;
|
Effect = (SpellEffectName)effect.Effect;
|
||||||
BasePoints = (int)effect.EffectBasePoints;
|
ApplyAuraName = (AuraType)effect.EffectAura;
|
||||||
RealPointsPerLevel = effect.EffectRealPointsPerLevel;
|
ApplyAuraPeriod = effect.EffectAuraPeriod;
|
||||||
PointsPerResource = effect.EffectPointsPerResource;
|
BasePoints = (int)effect.EffectBasePoints;
|
||||||
Amplitude = effect.EffectAmplitude;
|
RealPointsPerLevel = effect.EffectRealPointsPerLevel;
|
||||||
ChainAmplitude = effect.EffectChainAmplitude;
|
PointsPerResource = effect.EffectPointsPerResource;
|
||||||
BonusCoefficient = effect.EffectBonusCoefficient;
|
Amplitude = effect.EffectAmplitude;
|
||||||
MiscValue = effect.EffectMiscValue[0];
|
ChainAmplitude = effect.EffectChainAmplitude;
|
||||||
MiscValueB = effect.EffectMiscValue[1];
|
BonusCoefficient = effect.EffectBonusCoefficient;
|
||||||
Mechanic = (Mechanics)effect.EffectMechanic;
|
MiscValue = effect.EffectMiscValue[0];
|
||||||
PositionFacing = effect.EffectPosFacing;
|
MiscValueB = effect.EffectMiscValue[1];
|
||||||
TargetA = new SpellImplicitTargetInfo((Targets)effect.ImplicitTarget[0]);
|
Mechanic = (Mechanics)effect.EffectMechanic;
|
||||||
TargetB = new SpellImplicitTargetInfo((Targets)effect.ImplicitTarget[1]);
|
PositionFacing = effect.EffectPosFacing;
|
||||||
RadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(effect.EffectRadiusIndex[0]);
|
TargetA = new SpellImplicitTargetInfo((Targets)effect.ImplicitTarget[0]);
|
||||||
MaxRadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(effect.EffectRadiusIndex[1]);
|
TargetB = new SpellImplicitTargetInfo((Targets)effect.ImplicitTarget[1]);
|
||||||
ChainTargets = effect.EffectChainTargets;
|
RadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(effect.EffectRadiusIndex[0]);
|
||||||
ItemType = effect.EffectItemType;
|
MaxRadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(effect.EffectRadiusIndex[1]);
|
||||||
TriggerSpell = effect.EffectTriggerSpell;
|
ChainTargets = effect.EffectChainTargets;
|
||||||
SpellClassMask = effect.EffectSpellClassMask;
|
ItemType = effect.EffectItemType;
|
||||||
BonusCoefficientFromAP = effect.BonusCoefficientFromAP;
|
TriggerSpell = effect.EffectTriggerSpell;
|
||||||
Scaling.Class = effect.ScalingClass;
|
SpellClassMask = effect.EffectSpellClassMask;
|
||||||
Scaling.Coefficient = effect.Coefficient;
|
BonusCoefficientFromAP = effect.BonusCoefficientFromAP;
|
||||||
Scaling.Variance = effect.Variance;
|
Scaling.Class = effect.ScalingClass;
|
||||||
Scaling.ResourceCoefficient = effect.ResourceCoefficient;
|
Scaling.Coefficient = effect.Coefficient;
|
||||||
EffectAttributes = effect.EffectAttributes;
|
Scaling.Variance = effect.Variance;
|
||||||
|
Scaling.ResourceCoefficient = effect.ResourceCoefficient;
|
||||||
|
EffectAttributes = effect.EffectAttributes;
|
||||||
|
}
|
||||||
|
|
||||||
ImplicitTargetConditions = null;
|
ImplicitTargetConditions = null;
|
||||||
|
|
||||||
@@ -4669,8 +4679,8 @@ namespace Game.Spells
|
|||||||
public int MiscValueB;
|
public int MiscValueB;
|
||||||
public Mechanics Mechanic;
|
public Mechanics Mechanic;
|
||||||
public float PositionFacing;
|
public float PositionFacing;
|
||||||
public SpellImplicitTargetInfo TargetA;
|
public SpellImplicitTargetInfo TargetA = new();
|
||||||
public SpellImplicitTargetInfo TargetB;
|
public SpellImplicitTargetInfo TargetB = new();
|
||||||
public SpellRadiusRecord RadiusEntry;
|
public SpellRadiusRecord RadiusEntry;
|
||||||
public SpellRadiusRecord MaxRadiusEntry;
|
public SpellRadiusRecord MaxRadiusEntry;
|
||||||
public int ChainTargets;
|
public int ChainTargets;
|
||||||
|
|||||||
@@ -2462,7 +2462,7 @@ namespace Game.Entities
|
|||||||
Log.outError(LogFilter.Sql, $"Serverside spell {spellId} difficulty {difficulty} has invalid max radius id {effect.EffectRadiusIndex[1]} at index {effect.EffectIndex}, set to 0");
|
Log.outError(LogFilter.Sql, $"Serverside spell {spellId} difficulty {difficulty} has invalid max radius id {effect.EffectRadiusIndex[1]} at index {effect.EffectIndex}, set to 0");
|
||||||
}
|
}
|
||||||
|
|
||||||
spellEffects[(spellId, difficulty)].Add(effect);
|
spellEffects.Add((spellId, difficulty), effect);
|
||||||
|
|
||||||
} while (effectsResult.NextRow());
|
} while (effectsResult.NextRow());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user