* Removes references to libsecondlife.Packets from IClientAPI. BAD PROGRAMMERS. NAUGHTY.

* Thanks to Andrew (DeepThink) for working on this one.
0.6.0-stable
Adam Frisby 2008-05-07 20:31:48 +00:00
parent 02b1d908e8
commit a95f13a646
8 changed files with 232 additions and 45 deletions

View File

@ -171,11 +171,22 @@ namespace OpenSim.Framework
return circuits;
}
public void ViewerEffectHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock)
public void ViewerEffectHandler(IClientAPI sender, List<ViewerEffectEventHandlerArg> args)
{
ViewerEffectPacket packet = (ViewerEffectPacket)PacketPool.Instance.GetPacket(PacketType.ViewerEffect);
// TODO: don't create new blocks if recycling an old packet
packet.Effect = effectBlock;
List<ViewerEffectPacket.EffectBlock> effectBlock = new List<ViewerEffectPacket.EffectBlock>();
for (int i = 0; i < args.Count; i++)
{
ViewerEffectPacket.EffectBlock effect = new ViewerEffectPacket.EffectBlock();
effect.AgentID = args[i].AgentID;
effect.Color = args[i].Color;
effect.Duration = args[i].Duration;
effect.ID = args[i].ID;
effect.Type = args[i].Type;
effectBlock.Add(effect);
}
packet.Effect = effectBlock.ToArray();
// Wasteful, I know
IClientAPI[] LocalClients = new IClientAPI[0];

View File

@ -41,7 +41,8 @@ namespace OpenSim.Framework
IClientAPI Sender { get; set; }
}
public delegate void ViewerEffectEventHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock);
public delegate void ViewerEffectEventHandler(IClientAPI sender, List<ViewerEffectEventHandlerArg> args);
public delegate void ChatFromViewer(Object sender, ChatFromViewerArgs e);
@ -235,6 +236,15 @@ namespace OpenSim.Framework
#endregion
}
public class ViewerEffectEventHandlerArg : EventArgs
{
public LLUUID AgentID;
public byte[] Color;
public float Duration;
public LLUUID ID;
public byte Type;
}
public class LandUpdateArgs : EventArgs
{
public LLUUID AuthBuyerID;
@ -301,6 +311,66 @@ namespace OpenSim.Framework
public float waterHeight;
public string simName;
}
public class UpdateShapeArgs : EventArgs
{
public uint ObjectLocalID;
public ushort PathBegin;
public byte PathCurve;
public ushort PathEnd;
public sbyte PathRadiusOffset;
public byte PathRevolutions;
public byte PathScaleX;
public byte PathScaleY;
public byte PathShearX;
public byte PathShearY;
public sbyte PathSkew;
public sbyte PathTaperX;
public sbyte PathTaperY;
public sbyte PathTwist;
public sbyte PathTwistBegin;
public ushort ProfileBegin;
public byte ProfileCurve;
public ushort ProfileEnd;
public ushort ProfileHollow;
}
public class RequestAssetArgs : EventArgs
{
public int ChannelType;
public float Priority;
public int SourceType;
public LLUUID TransferID;
}
public class AgentUpdateArgs : EventArgs
{
public LLUUID AgentID;
public LLQuaternion BodyRotation;
public LLVector3 CameraAtAxis;
public LLVector3 CameraCenter;
public LLVector3 CameraLeftAxis;
public LLVector3 CameraUpAxis;
public uint ControlFlags;
public float Far;
public byte Flags;
public LLQuaternion HeadRotation;
public LLUUID SessionID;
public byte State;
}
public class AvatarPickerReplyAgentDataArgs : EventArgs
{
public LLUUID AgentID;
public LLUUID QueryID;
}
public class AvatarPickerReplyDataArgs : EventArgs
{
public LLUUID AvatarID;
public byte[] FirstName;
public byte[] LastName;
}
public delegate void TextureRequest(Object sender, TextureRequestArgs e);
public delegate void AvatarNowWearing(Object sender, AvatarWearingArgs e);
@ -325,7 +395,7 @@ namespace OpenSim.Framework
float height, float seconds, byte size, byte action, float north, float west, float south, float east,
IClientAPI remoteClient);
public delegate void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam);
public delegate void SetAppearance(byte[] texture, List<byte> visualParamList);
public delegate void StartAnim(IClientAPI remoteClient, LLUUID animID);
@ -362,7 +432,7 @@ namespace OpenSim.Framework
public delegate void GenericCall7(IClientAPI remoteClient, uint localID, string message);
public delegate void UpdateShape(LLUUID agentID, uint localID, ObjectShapePacket.ObjectDataBlock shapeBlock);
public delegate void UpdateShape(LLUUID agentID, uint localID, UpdateShapeArgs shapeBlock);
public delegate void ObjectExtraParams(LLUUID agentID, uint localID, ushort type, bool inUse, byte[] data);
@ -396,7 +466,7 @@ namespace OpenSim.Framework
public delegate void NewAvatar(IClientAPI remoteClient, LLUUID agentID, bool status);
public delegate void UpdateAgent(IClientAPI remoteClient, AgentUpdatePacket agentData);
public delegate void UpdateAgent(IClientAPI remoteClient, AgentUpdateArgs agentData);
public delegate void AgentRequestSit(IClientAPI remoteClient, LLUUID agentID, LLUUID targetID, LLVector3 offset);
@ -427,7 +497,7 @@ namespace OpenSim.Framework
public delegate void ParcelObjectOwnerRequest(int local_id, IClientAPI remote_client);
public delegate void EstateOwnerMessageRequest(EstateOwnerMessagePacket packet, IClientAPI remote_client);
public delegate void EstateOwnerMessageRequest(LLUUID AgentID, LLUUID SessionID, LLUUID TransactionID, LLUUID Invoice, byte[] Method, byte[][] Parameters, IClientAPI remote_client);
public delegate void RegionInfoRequest(IClientAPI remote_client);
@ -487,7 +557,7 @@ namespace OpenSim.Framework
public delegate void RemoveInventoryFolder(
IClientAPI remoteClient, LLUUID folderID);
public delegate void RequestAsset(IClientAPI remoteClient, TransferRequestPacket transferRequest);
public delegate void RequestAsset(IClientAPI remoteClient, RequestAssetArgs transferRequest);
public delegate void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID);
@ -822,7 +892,7 @@ namespace OpenSim.Framework
int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay,
int PricePublicObjectDelete, int PriceRentLight, int PriceUpload, int TeleportMinPrice, float TeleportPriceExponent);
void SendAvatarPickerReply(AvatarPickerReplyPacket Pack);
void SendAvatarPickerReply(AvatarPickerReplyAgentDataArgs AgentData, List<AvatarPickerReplyDataArgs> Data);
void SendAgentDataUpdate(LLUUID agentid, LLUUID activegroupid, string firstname, string lastname, ulong grouppowers, string groupname, string grouptitle);

View File

@ -1651,8 +1651,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
public void SendAvatarPickerReply(AvatarPickerReplyPacket replyPacket)
public void SendAvatarPickerReply(AvatarPickerReplyAgentDataArgs AgentData, List<AvatarPickerReplyDataArgs> Data)
{
//construct the AvatarPickerReply packet.
AvatarPickerReplyPacket replyPacket = new AvatarPickerReplyPacket();
replyPacket.AgentData.AgentID = AgentData.AgentID;
replyPacket.AgentData.QueryID = AgentData.QueryID;
int i = 0;
List<AvatarPickerReplyPacket.DataBlock> data_block = new List<AvatarPickerReplyPacket.DataBlock>();
foreach (AvatarPickerReplyDataArgs arg in Data)
{
AvatarPickerReplyPacket.DataBlock db = new AvatarPickerReplyPacket.DataBlock();
db.AvatarID = arg.AvatarID;
db.FirstName = arg.FirstName;
db.LastName = arg.LastName;
data_block.Add(db);
}
replyPacket.Data = data_block.ToArray();
OutPacket(replyPacket, ThrottleOutPacketType.Task);
}
@ -2904,12 +2919,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
handlerViewerEffect = OnViewerEffect;
if (handlerViewerEffect != null)
{
handlerViewerEffect(sender, viewer.Effect);
int length = viewer.Effect.Length;
List<ViewerEffectEventHandlerArg> args = new List<ViewerEffectEventHandlerArg>(length);
for (int i = 0; i < length; i++)
{
//copy the effects block arguments into the event handler arg.
ViewerEffectEventHandlerArg argument = new ViewerEffectEventHandlerArg();
argument.AgentID = viewer.Effect[i].AgentID;
argument.Color = viewer.Effect[i].Color;
argument.Duration = viewer.Effect[i].Duration;
argument.ID = viewer.Effect[i].ID;
argument.Type = viewer.Effect[i].Type;
args.Add(argument);
}
handlerViewerEffect(sender, args);
}
return true;
}
public void SendScriptQuestion(LLUUID taskID, string taskName, string ownerName, LLUUID itemID, int question)
{
ScriptQuestionPacket scriptQuestion = (ScriptQuestionPacket)PacketPool.Instance.GetPacket(PacketType.ScriptQuestion);
@ -3778,7 +3808,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// for the client session anyway, in order to protect ourselves against bad code in plugins
try
{
handlerSetAppearance(appear.ObjectData.TextureEntry, appear.VisualParam);
List<byte> visualparams = new List<byte>();
foreach (AgentSetAppearancePacket.VisualParamBlock x in appear.VisualParam)
{
visualparams.Add(x.ParamValue);
}
handlerSetAppearance(appear.ObjectData.TextureEntry, visualparams);
}
catch (Exception e)
{
@ -3885,9 +3921,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
AgentUpdatePacket agenUpdate = (AgentUpdatePacket)Pack;
AgentUpdatePacket.AgentDataBlock x = agenUpdate.AgentData;
AgentUpdateArgs arg = new AgentUpdateArgs();
arg.AgentID = x.AgentID;
arg.BodyRotation = x.BodyRotation;
arg.CameraAtAxis = x.CameraAtAxis;
arg.CameraCenter = x.CameraCenter;
arg.CameraLeftAxis = x.CameraLeftAxis;
arg.CameraUpAxis = x.CameraUpAxis;
arg.ControlFlags = x.ControlFlags;
arg.Far = x.Far;
arg.Flags = x.Flags;
arg.HeadRotation = x.HeadRotation;
arg.SessionID = x.SessionID;
arg.State = x.State;
handlerAgentUpdate = OnAgentUpdate;
if (handlerAgentUpdate != null)
OnAgentUpdate(this, agenUpdate);
OnAgentUpdate(this, arg);
handlerAgentUpdate = null;
//agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotationa);
@ -4085,8 +4136,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
handlerUpdatePrimShape = OnUpdatePrimShape;
if (handlerUpdatePrimShape != null)
{
UpdateShapeArgs shapeData = new UpdateShapeArgs();
shapeData.ObjectLocalID = shapePacket.ObjectData[i].ObjectLocalID;
shapeData.PathBegin = shapePacket.ObjectData[i].PathBegin;
shapeData.PathCurve = shapePacket.ObjectData[i].PathCurve;
shapeData.PathEnd = shapePacket.ObjectData[i].PathEnd;
shapeData.PathRadiusOffset = shapePacket.ObjectData[i].PathRadiusOffset;
shapeData.PathRevolutions = shapePacket.ObjectData[i].PathRevolutions;
shapeData.PathScaleX = shapePacket.ObjectData[i].PathScaleX;
shapeData.PathScaleY = shapePacket.ObjectData[i].PathScaleY;
shapeData.PathShearX = shapePacket.ObjectData[i].PathShearX;
shapeData.PathShearY = shapePacket.ObjectData[i].PathShearY;
shapeData.PathSkew = shapePacket.ObjectData[i].PathSkew;
shapeData.PathTaperX = shapePacket.ObjectData[i].PathTaperX;
shapeData.PathTaperY = shapePacket.ObjectData[i].PathTaperY;
shapeData.PathTwist = shapePacket.ObjectData[i].PathTwist;
shapeData.PathTwistBegin = shapePacket.ObjectData[i].PathTwistBegin;
shapeData.ProfileBegin = shapePacket.ObjectData[i].ProfileBegin;
shapeData.ProfileCurve = shapePacket.ObjectData[i].ProfileCurve;
shapeData.ProfileEnd = shapePacket.ObjectData[i].ProfileEnd;
shapeData.ProfileHollow = shapePacket.ObjectData[i].ProfileHollow;
handlerUpdatePrimShape(m_agentId, shapePacket.ObjectData[i].ObjectLocalID,
shapePacket.ObjectData[i]);
shapeData);
}
}
break;

View File

@ -26,6 +26,7 @@
*/
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Security.Permissions;
using libsecondlife;
@ -102,15 +103,12 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary>
/// <param name="texture"></param>
/// <param name="visualParam"></param>
public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam)
public void SetAppearance(byte[] texture, List<byte> visualParam)
{
LLObject.TextureEntry textureEnt = new LLObject.TextureEntry(texture, 0, texture.Length);
m_textureEntry = textureEnt;
for (int i = 0; i < visualParam.Length; i++)
{
m_visualParams[i] = visualParam[i].ParamValue;
}
m_visualParams = visualParam.ToArray();
// Teravus : Nifty AV Height Getting Maaaaagical formula. Oh how we love turning 0-255 into meters.
// (float)m_visualParams[25] = Height

View File

@ -1275,14 +1275,35 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary>
/// <param name="primLocalID"></param>
/// <param name="shapeBlock"></param>
public void UpdatePrimShape(LLUUID agentID, uint primLocalID, ObjectShapePacket.ObjectDataBlock shapeBlock)
public void UpdatePrimShape(LLUUID agentID, uint primLocalID, UpdateShapeArgs shapeBlock)
{
SceneObjectGroup group = GetGroupByPrim(primLocalID);
if (group != null)
{
if (m_parentScene.Permissions.CanEditObjectPosition(agentID, group.GetPartsFullID(primLocalID)))
{
group.UpdateShape(shapeBlock, primLocalID);
ObjectShapePacket.ObjectDataBlock shapeData = new ObjectShapePacket.ObjectDataBlock();
shapeData.ObjectLocalID = shapeBlock.ObjectLocalID;
shapeData.PathBegin = shapeBlock.PathBegin;
shapeData.PathCurve = shapeBlock.PathCurve;
shapeData.PathEnd = shapeBlock.PathEnd;
shapeData.PathRadiusOffset = shapeBlock.PathRadiusOffset;
shapeData.PathRevolutions = shapeBlock.PathRevolutions;
shapeData.PathScaleX = shapeBlock.PathScaleX;
shapeData.PathScaleY = shapeBlock.PathScaleY;
shapeData.PathShearX = shapeBlock.PathShearX;
shapeData.PathShearY = shapeBlock.PathShearY;
shapeData.PathSkew = shapeBlock.PathSkew;
shapeData.PathTaperX = shapeBlock.PathTaperX;
shapeData.PathTaperY = shapeBlock.PathTaperY;
shapeData.PathTwist = shapeBlock.PathTwist;
shapeData.PathTwistBegin = shapeBlock.PathTwistBegin;
shapeData.ProfileBegin = shapeBlock.ProfileBegin;
shapeData.ProfileCurve = shapeBlock.ProfileCurve;
shapeData.ProfileEnd = shapeBlock.ProfileEnd;
shapeData.ProfileHollow = shapeBlock.ProfileHollow;
group.UpdateShape(shapeData, primLocalID);
}
}
}

View File

@ -245,7 +245,21 @@ namespace OpenSim.Region.Environment.Scenes
searchData = new AvatarPickerReplyPacket.DataBlock[0];
}
replyPacket.Data = searchData;
client.SendAvatarPickerReply(replyPacket);
AvatarPickerReplyAgentDataArgs agent_data = new AvatarPickerReplyAgentDataArgs();
agent_data.AgentID = replyPacket.AgentData.AgentID;
agent_data.QueryID = replyPacket.AgentData.QueryID;
List<AvatarPickerReplyDataArgs> data_args = new List<AvatarPickerReplyDataArgs>();
for (i = 0; i < replyPacket.Data.Length; i++)
{
AvatarPickerReplyDataArgs data_arg = new AvatarPickerReplyDataArgs();
data_arg.AvatarID = replyPacket.Data[i].AvatarID;
data_arg.FirstName = replyPacket.Data[i].FirstName;
data_arg.LastName = replyPacket.Data[i].LastName;
data_args.Add(data_arg);
}
client.SendAvatarPickerReply(agent_data, data_args);
}
}
}

View File

@ -754,7 +754,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <summary>
/// This is the event handler for client movement. If a client is moving, this event is triggering.
/// </summary>
public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdatePacket agentData)
public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData)
{
//if (m_isChildAgent)
//{
@ -767,31 +767,31 @@ namespace OpenSim.Region.Environment.Scenes
m_perfMonMS = System.Environment.TickCount;
uint flags = agentData.AgentData.ControlFlags;
LLQuaternion bodyRotation = agentData.AgentData.BodyRotation;
uint flags = agentData.ControlFlags;
LLQuaternion bodyRotation = agentData.BodyRotation;
// Camera location in world. We'll need to raytrace
// from this location from time to time.
m_CameraCenter.x = agentData.AgentData.CameraCenter.X;
m_CameraCenter.y = agentData.AgentData.CameraCenter.Y;
m_CameraCenter.z = agentData.AgentData.CameraCenter.Z;
m_CameraCenter.x = agentData.CameraCenter.X;
m_CameraCenter.y = agentData.CameraCenter.Y;
m_CameraCenter.z = agentData.CameraCenter.Z;
// Use these three vectors to figure out what the agent is looking at
// Convert it to a Matrix and/or Quaternion
m_CameraAtAxis.x = agentData.AgentData.CameraAtAxis.X;
m_CameraAtAxis.y = agentData.AgentData.CameraAtAxis.Y;
m_CameraAtAxis.z = agentData.AgentData.CameraAtAxis.Z;
m_CameraAtAxis.x = agentData.CameraAtAxis.X;
m_CameraAtAxis.y = agentData.CameraAtAxis.Y;
m_CameraAtAxis.z = agentData.CameraAtAxis.Z;
m_CameraLeftAxis.x = agentData.AgentData.CameraLeftAxis.X;
m_CameraLeftAxis.y = agentData.AgentData.CameraLeftAxis.Y;
m_CameraLeftAxis.z = agentData.AgentData.CameraLeftAxis.Z;
m_CameraLeftAxis.x = agentData.CameraLeftAxis.X;
m_CameraLeftAxis.y = agentData.CameraLeftAxis.Y;
m_CameraLeftAxis.z = agentData.CameraLeftAxis.Z;
m_CameraUpAxis.x = agentData.AgentData.CameraUpAxis.X;
m_CameraUpAxis.y = agentData.AgentData.CameraUpAxis.Y;
m_CameraUpAxis.z = agentData.AgentData.CameraUpAxis.Z;
m_CameraUpAxis.x = agentData.CameraUpAxis.X;
m_CameraUpAxis.y = agentData.CameraUpAxis.Y;
m_CameraUpAxis.z = agentData.CameraUpAxis.Z;
// The Agent's Draw distance setting
m_DrawDistance = agentData.AgentData.Far;
m_DrawDistance = agentData.Far;
if ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0)
{
@ -1569,7 +1569,7 @@ namespace OpenSim.Region.Environment.Scenes
m_appearance.SendAppearanceToOtherAgent(avatar);
}
public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam)
public void SetAppearance(byte[] texture, List<byte> visualParam)
{
m_appearance.SetAppearance(texture, visualParam);
SetHeight(m_appearance.AvatarHeight);

View File

@ -271,7 +271,7 @@ namespace OpenSim.Region.Examples.SimpleModule
{
}
public virtual void SendAvatarPickerReply(AvatarPickerReplyPacket response)
public virtual void SendAvatarPickerReply(AvatarPickerReplyAgentDataArgs AgentData, List<AvatarPickerReplyDataArgs> Data)
{
}
@ -528,9 +528,10 @@ namespace OpenSim.Region.Examples.SimpleModule
frame = 0;
if (OnAgentUpdate != null)
{
AgentUpdatePacket pack = new AgentUpdatePacket();
pack.AgentData.ControlFlags = movementFlag;
pack.AgentData.BodyRotation = bodyDirection;
AgentUpdateArgs pack = new AgentUpdateArgs();
pack.ControlFlags = movementFlag;
pack.BodyRotation = bodyDirection;
OnAgentUpdate(this, pack);
}
if (flyState == 0)