From 53a2cfdfd8dfe248b073829d18e7cfe5d87900aa Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Tue, 18 Jul 2006 02:54:13 +0000 Subject: [PATCH] * Sanity check for ObjectAdd * Renamed and attempted to fix the Say/Shout functions git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@64 52acb1d6-8a22-11de-b505-999d5b087335 --- libsecondlife-cs/Avatar.cs | 8 ++-- libsecondlife-cs/Prims.cs | 11 +++--- libsecondlife-cs/Types.cs | 76 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 9 deletions(-) diff --git a/libsecondlife-cs/Avatar.cs b/libsecondlife-cs/Avatar.cs index fa33b27c..ad5dbc9f 100644 --- a/libsecondlife-cs/Avatar.cs +++ b/libsecondlife-cs/Avatar.cs @@ -312,24 +312,24 @@ namespace libsecondlife Client.Network.SendPacket(packet); } - public void Chat(string message, byte type) + public void Say(string message, int channel) { LLUUID CommandID = new LLUUID(); LLVector3 Position = new LLVector3(0.0F,0.0F,0.0F); Packet packet = Packets.Communication.ChatFromViewer(Client.Protocol, Client.Avatar.ID, Client.Network.SessionID, - message, type, 0, 0, CommandID, 20, Position); + message, (byte)1, channel, 0, CommandID, 20, Position); Client.Network.SendPacket(packet); } - public void Shout(string message) + public void Shout(string message, int channel) { LLUUID CommandID = new LLUUID(); LLVector3 Position = new LLVector3(0.0F,0.0F,0.0F); Packet packet = Packets.Communication.ChatFromViewer(Client.Protocol,Client.Avatar.ID,Client.Network.SessionID, - message, 0, 0, 0, CommandID,100,Position); + message, (byte)2, channel, 0, CommandID, 100, Position); Client.Network.SendPacket(packet); } diff --git a/libsecondlife-cs/Prims.cs b/libsecondlife-cs/Prims.cs index 368b55e9..969b49b1 100644 --- a/libsecondlife-cs/Prims.cs +++ b/libsecondlife-cs/Prims.cs @@ -35,8 +35,8 @@ namespace libsecondlife public float ProfileBegin = 0; public float PathRadiusOffset = 0; public float PathSkew = 0; - public LLVector3 RayStart = new LLVector3(); - public int ProfileCurve = 0; + public LLVector3 Position = new LLVector3(); + public uint ProfileCurve = 0; public float PathScaleX = 0; public float PathScaleY = 0; public LLUUID UUID = new LLUUID(); @@ -58,6 +58,7 @@ namespace libsecondlife public uint ProfileHollow = 0; public float PathRevolutions = 0; public LLQuaternion Rotation = new LLQuaternion(); + public uint State; public PrimObject(LLUUID texture) { @@ -88,13 +89,13 @@ namespace libsecondlife public static byte ProfileBeginByte(float profileBegin) { // Y = ceil (200X) - return (byte)Convert.ToInt16(Math.Ceiling(200.0F * profileBegin)); + return (byte)Convert.ToInt16(200.0F * profileBegin); } public static byte ProfileEndByte(float profileEnd) { - // Y = 200 - ceil (200X) - return (byte)(200 - (int)ProfileBeginByte(profileEnd)); + // Y = 200 - ceil (200X) + return (byte)(200 - (200.0F * profileEnd)); } public static byte PathBeginByte(float pathBegin) diff --git a/libsecondlife-cs/Types.cs b/libsecondlife-cs/Types.cs index 27f30ccb..d8ee57ec 100644 --- a/libsecondlife-cs/Types.cs +++ b/libsecondlife-cs/Types.cs @@ -393,6 +393,82 @@ namespace libsecondlife { return X.ToString() + " " + Y.ToString() + " " + Z.ToString(); } + + public override int GetHashCode() + { + int x = (int)X; + int y = (int)Y; + int z = (int)Z; + + return (x ^ y ^ z); + } + + public override bool Equals(object o) + { + if (!(o is LLVector3)) + { + return false; + } + + LLVector3 vector = (LLVector3)o; + + if (X == vector.X && Y == vector.Y && Z == vector.Z) + { + return true; + } + else + { + return false; + } + } + + public static bool operator==(LLVector3 lhs, LLVector3 rhs) + { + try + { + if (lhs.X == rhs.X && lhs.Y == rhs.Y && lhs.Z == rhs.Z) + { + return true; + } + else + { + return false; + } + } + catch (NullReferenceException) + { + float test; + bool lhsnull = false; + bool rhsnull = false; + + try + { + test = lhs.X; + } + catch (NullReferenceException) + { + lhsnull = true; + } + + try + { + test = rhs.X; + } + catch (NullReferenceException) + { + rhsnull = true; + } + + return (lhsnull == rhsnull); + } + + return false; + } + + public static bool operator!=(LLVector3 lhs, LLVector3 rhs) + { + return !(lhs == rhs); + } } public class LLVector3d