75 lines
2.7 KiB
C#
75 lines
2.7 KiB
C#
using System;
|
|
|
|
namespace OpenMetaverse.TestClient
|
|
{
|
|
public class ShowEffectsCommand : Command
|
|
{
|
|
bool ShowEffects = false;
|
|
|
|
public ShowEffectsCommand(TestClient testClient)
|
|
{
|
|
Name = "showeffects";
|
|
Description = "Prints out information for every viewer effect that is received. Usage: showeffects [on/off]";
|
|
Category = CommandCategory.Other;
|
|
|
|
testClient.Avatars.ViewerEffect += Avatars_ViewerEffect;
|
|
testClient.Avatars.ViewerEffectPointAt += Avatars_ViewerEffectPointAt;
|
|
testClient.Avatars.ViewerEffectLookAt += Avatars_ViewerEffectLookAt;
|
|
}
|
|
|
|
void Avatars_ViewerEffectLookAt(object sender, ViewerEffectLookAtEventArgs e)
|
|
{
|
|
if (ShowEffects)
|
|
Console.WriteLine(
|
|
"ViewerEffect [LookAt]: SourceID: {0} TargetID: {1} TargetPos: {2} Type: {3} Duration: {4} ID: {5}",
|
|
e.SourceID.ToString(), e.TargetID.ToString(), e.TargetPosition, e.LookType, e.Duration,
|
|
e.EffectID.ToString());
|
|
}
|
|
|
|
void Avatars_ViewerEffectPointAt(object sender, ViewerEffectPointAtEventArgs e)
|
|
{
|
|
if (ShowEffects)
|
|
Console.WriteLine(
|
|
"ViewerEffect [PointAt]: SourceID: {0} TargetID: {1} TargetPos: {2} Type: {3} Duration: {4} ID: {5}",
|
|
e.SourceID.ToString(), e.TargetID.ToString(), e.TargetPosition, e.PointType, e.Duration,
|
|
e.EffectID.ToString());
|
|
}
|
|
|
|
void Avatars_ViewerEffect(object sender, ViewerEffectEventArgs e)
|
|
{
|
|
if (ShowEffects)
|
|
Console.WriteLine(
|
|
"ViewerEffect [{0}]: SourceID: {1} TargetID: {2} TargetPos: {3} Duration: {4} ID: {5}",
|
|
e.Type, e.SourceID.ToString(), e.TargetID.ToString(), e.TargetPosition, e.Duration,
|
|
e.EffectID.ToString());
|
|
}
|
|
|
|
public override string Execute(string[] args, UUID fromAgentID)
|
|
{
|
|
if (args.Length == 0)
|
|
{
|
|
ShowEffects = true;
|
|
return "Viewer effects will be shown on the console";
|
|
}
|
|
else if (args.Length == 1)
|
|
{
|
|
if (args[0] == "on")
|
|
{
|
|
ShowEffects = true;
|
|
return "Viewer effects will be shown on the console";
|
|
}
|
|
else
|
|
{
|
|
ShowEffects = false;
|
|
return "Viewer effects will not be shown";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return "Usage: showeffects [on/off]";
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|