Fixes/cleanups from b026ee7ef8, And misc fixes/crashes.

This commit is contained in:
hondacrx
2021-11-16 19:45:02 -05:00
parent 2b2b0fe076
commit 705a2fe3a1
8 changed files with 49 additions and 28 deletions
+1 -1
View File
@@ -204,7 +204,7 @@ namespace Framework.GameMath
}
else
{
float t = -(-plane.D + Vector3.Dot(Origin, plane.Normal)) / rate;
float t = -(plane.D + Vector3.Dot(Origin, plane.Normal)) / rate;
return Origin + Direction * t;
}
}
+1 -16
View File
@@ -292,22 +292,7 @@ namespace System
public static Matrix4x4 fromEulerAnglesZYX(float fYAngle, float fPAngle, float fRAngle)
{
float fCos = (float)Math.Cos(fYAngle);
float fSin = (float)Math.Sin(fYAngle);
Matrix4x4 kZMat = new(fCos, -fSin, 0, 0, fSin, fCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0);
fCos = (float)Math.Cos(fPAngle);
fSin = (float)Math.Sin(fPAngle);
Matrix4x4 kYMat = new(fCos, 0, fSin, 0, 0, 1, 0, 0, -fSin, 0, fCos, 0, 0, 0, 0, 0);
fCos = (float)Math.Cos(fRAngle);
fSin = (float)Math.Sin(fRAngle);
Matrix4x4 kXMat = new(1, 0, 0, 0, 0, fCos, -fSin, 0, 0, fSin, fCos, 0, 0, 0, 0, 0);
return (kZMat * (kYMat * kXMat));
return Matrix4x4.CreateFromYawPitchRoll(fPAngle, fRAngle, fYAngle);
}
#region Strings
@@ -652,7 +652,6 @@ namespace Game.Chat
spawntm = spawntime;
Quaternion rotation = Quaternion.CreateFromRotationMatrix(Extensions.fromEulerAnglesZYX(player.GetOrientation(), 0.0f, 0.0f));
if (Global.ObjectMgr.GetGameObjectTemplate(id) == null)
{
handler.SendSysMessage(CypherStrings.GameobjectNotExist, id);
@@ -189,7 +189,7 @@ namespace Game.DataStorage
createProperties.MorphCurveId = ValidateAndSetCurve(areatriggerCreateProperties.Read<uint>(4));
createProperties.FacingCurveId = ValidateAndSetCurve(areatriggerCreateProperties.Read<uint>(5));
createProperties.AnimId = areatriggerCreateProperties.Read<uint>(6);
createProperties.AnimId = areatriggerCreateProperties.Read<int>(6);
createProperties.AnimKitId = areatriggerCreateProperties.Read<uint>(7);
createProperties.DecalPropertiesId = areatriggerCreateProperties.Read<uint>(8);
@@ -300,7 +300,7 @@ namespace Game.Entities
public uint MorphCurveId;
public uint FacingCurveId;
public uint AnimId;
public int AnimId;
public uint AnimKitId;
public uint DecalPropertiesId;
@@ -5437,25 +5437,62 @@ namespace Game.Entities
public class VisualAnim : BaseUpdateData<AreaTrigger>
{
public UpdateField<bool> Field_C = new(0, 1);
public UpdateField<uint> AnimationDataID = new(0, 2);
public UpdateField<int> AnimationDataID = new(0, 2);
public UpdateField<uint> AnimKitID = new(0, 3);
public UpdateField<uint> AnimProgress = new(0, 4);
public VisualAnim() : base(0, TypeId.AreaTrigger, 5) { }
void WriteCreate(WorldPacket data, AreaTrigger owner, Player receiver)
public void WriteCreate(WorldPacket data, AreaTrigger owner, Player receiver)
{
data.WriteInt32(AnimationDataID);
data.WriteUInt32(AnimKitID);
data.WriteUInt32(AnimProgress);
data.WriteBit(Field_C);
data.FlushBits();
}
void WriteUpdate(WorldPacket data, bool ignoreChangesMask, AreaTrigger owner, Player receiver)
public void WriteUpdate(WorldPacket data, bool ignoreChangesMask, AreaTrigger owner, Player receiver)
{
UpdateMask changesMask = _changesMask;
if (ignoreChangesMask)
changesMask.SetAll();
data.WriteBits(changesMask.GetBlock(0), 5);
if (changesMask[0])
{
if (changesMask[1])
{
data.WriteBit(Field_C);
}
}
data.FlushBits();
if (changesMask[0])
{
if (changesMask[2])
{
data.WriteInt32(AnimationDataID);
}
if (changesMask[3])
{
data.WriteUInt32(AnimKitID);
}
if (changesMask[4])
{
data.WriteUInt32(AnimProgress);
}
}
data.FlushBits();
}
public override void ClearChangesMask()
{
ClearChangesMask(Field_C);
ClearChangesMask(AnimationDataID);
ClearChangesMask(AnimKitID);
ClearChangesMask(AnimProgress);
_changesMask.ResetAll();
}
}
+1 -1
View File
@@ -4572,7 +4572,7 @@ namespace Game.Entities
public bool HasCorpse()
{
return _corpseLocation.GetMapId() != 0xFFFFFFFF;
return _corpseLocation != null && _corpseLocation.GetMapId() != 0xFFFFFFFF;
}
public WorldLocation GetCorpseLocation() { return _corpseLocation; }
+2 -2
View File
@@ -85,8 +85,8 @@ namespace Game
Values[WorldCfg.RateXpQuest] = GetDefaultValue("Rate.XP.Quest", 1.0f);
Values[WorldCfg.RateXpExplore] = GetDefaultValue("Rate.XP.Explore", 1.0f);
Values[CONFIG_XP_BOOST_DAYMASK] = GetDefaultValue("XP.Boost.Daymask", 0);
Values[RATE_XP_BOOST] = GetDefaultValue("XP.Boost.Rate", 2.0f);
Values[WorldCfg.XpBoostDaymask] = GetDefaultValue("XP.Boost.Daymask", 0);
Values[WorldCfg.RateXpBoost] = GetDefaultValue("XP.Boost.Rate", 2.0f);
Values[WorldCfg.RateRepaircost] = GetDefaultValue("Rate.RepairCost", 1.0f);
if ((float)Values[WorldCfg.RateRepaircost] < 0.0f)