mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-05-20 08:26:59 -04:00
Add equip ability functions
Fix EquipAbility SQL query
This commit is contained in:
@@ -72,9 +72,9 @@ namespace FFXIVClassic.Common
|
||||
offset += header.subpacketSize;
|
||||
}
|
||||
|
||||
public SubPacket(ushort opcode, uint sourceId, uint targetId, byte[] data) : this(true, opcode, sourceId, targetId, data) { }
|
||||
public SubPacket(ushort opcode, uint sourceId, byte[] data) : this(true, opcode, sourceId, data) { }
|
||||
|
||||
public SubPacket(bool isGameMessage, ushort opcode, uint sourceId, uint targetId, byte[] data)
|
||||
public SubPacket(bool isGameMessage, ushort opcode, uint sourceId, byte[] data)
|
||||
{
|
||||
header = new SubPacketHeader();
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace FFXIVClassic.Common
|
||||
}
|
||||
|
||||
header.sourceId = sourceId;
|
||||
header.targetId = targetId;
|
||||
header.targetId = 0;
|
||||
|
||||
if (isGameMessage)
|
||||
header.type = 0x03;
|
||||
@@ -117,6 +117,11 @@ namespace FFXIVClassic.Common
|
||||
data = original.data;
|
||||
}
|
||||
|
||||
public void SetTargetId(uint target)
|
||||
{
|
||||
this.header.targetId = target;
|
||||
}
|
||||
|
||||
public byte[] GetHeaderBytes()
|
||||
{
|
||||
var size = Marshal.SizeOf(header);
|
||||
|
@@ -70,5 +70,41 @@ namespace FFXIVClassic.Common
|
||||
{
|
||||
return (lhs.X * rhs.X) + (lhs.Y * rhs.Y) + (lhs.Z * rhs.Z);
|
||||
}
|
||||
|
||||
public static float GetAngle(Vector3 lhs, Vector3 rhs)
|
||||
{
|
||||
var angle = (float)Math.Atan((rhs.Z - lhs.Z) / (rhs.X - lhs.X));
|
||||
return lhs.X > rhs.X ? angle + (float)Math.PI : angle;
|
||||
}
|
||||
|
||||
public Vector3 NewHorizontalVector(float angle, float extents)
|
||||
{
|
||||
var newVec = new Vector3();
|
||||
newVec.Y = this.Y;
|
||||
newVec.X = this.X + (float)Math.Cos(angle) * extents;
|
||||
newVec.Z = this.Z + (float)Math.Sin(angle) * extents;
|
||||
|
||||
return newVec;
|
||||
}
|
||||
|
||||
public bool IsWithinCircle(Vector3 centre, float radius)
|
||||
{
|
||||
float diffX = centre.X - this.X;
|
||||
float diffZ = centre.Z - this.Z;
|
||||
|
||||
float distance = (float)Math.Sqrt((diffX * diffX) + (diffZ * diffZ));
|
||||
|
||||
return distance < radius;
|
||||
}
|
||||
|
||||
public bool IsWithinBox(Vector3 upperLeftCorner, Vector3 lowerRightCorner)
|
||||
{
|
||||
return upperLeftCorner.X <= this.X &&
|
||||
upperLeftCorner.Y <= this.Y &&
|
||||
upperLeftCorner.Z <= this.Z &&
|
||||
lowerRightCorner.X >= this.X &&
|
||||
lowerRightCorner.Y >= this.Y &&
|
||||
lowerRightCorner.Z >= this.Z;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user