2009-10-22 04:29:25 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
2025-05-27 14:16:03 -05:00
|
|
|
|
using System.Linq;
|
2009-10-22 04:29:25 +00:00
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
|
|
namespace OpenMetaverse.TestClient
|
|
|
|
|
|
{
|
|
|
|
|
|
public class BotsCommand : Command
|
|
|
|
|
|
{
|
|
|
|
|
|
private Dictionary<UUID, bool> m_AgentList = new Dictionary<UUID, bool>();
|
|
|
|
|
|
|
|
|
|
|
|
public BotsCommand(TestClient testClient)
|
|
|
|
|
|
{
|
|
|
|
|
|
Name = "bots";
|
|
|
|
|
|
Description = "detects avatars that appear to be bots.";
|
2009-10-27 07:01:48 +00:00
|
|
|
|
Category = CommandCategory.Other;
|
2022-02-25 19:38:11 -06:00
|
|
|
|
testClient.Avatars.ViewerEffect += Avatars_ViewerEffect;
|
|
|
|
|
|
testClient.Avatars.ViewerEffectLookAt += Avatars_ViewerEffectLookAt;
|
|
|
|
|
|
testClient.Avatars.ViewerEffectPointAt += Avatars_ViewerEffectPointAt;
|
2009-10-22 04:29:25 +00:00
|
|
|
|
}
|
2009-10-27 07:01:48 +00:00
|
|
|
|
|
|
|
|
|
|
private void Avatars_ViewerEffectPointAt(object sender, ViewerEffectPointAtEventArgs e)
|
2009-10-22 04:29:25 +00:00
|
|
|
|
{
|
|
|
|
|
|
lock (m_AgentList)
|
|
|
|
|
|
{
|
2024-06-30 18:03:58 -05:00
|
|
|
|
m_AgentList[e.SourceID] = true;
|
2009-10-22 04:29:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2009-10-27 07:01:48 +00:00
|
|
|
|
private void Avatars_ViewerEffectLookAt(object sender, ViewerEffectLookAtEventArgs e)
|
2009-10-22 04:29:25 +00:00
|
|
|
|
{
|
|
|
|
|
|
lock (m_AgentList)
|
|
|
|
|
|
{
|
2024-06-30 18:03:58 -05:00
|
|
|
|
m_AgentList[e.SourceID] = true;
|
2009-10-22 04:29:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2009-10-27 07:01:48 +00:00
|
|
|
|
private void Avatars_ViewerEffect(object sender, ViewerEffectEventArgs e)
|
2009-10-22 04:29:25 +00:00
|
|
|
|
{
|
|
|
|
|
|
lock (m_AgentList)
|
|
|
|
|
|
{
|
2024-06-30 18:03:58 -05:00
|
|
|
|
m_AgentList[e.SourceID] = true;
|
2009-10-22 04:29:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string Execute(string[] args, UUID fromAgentID)
|
|
|
|
|
|
{
|
|
|
|
|
|
StringBuilder result = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
|
|
lock (Client.Network.Simulators)
|
|
|
|
|
|
{
|
2025-05-27 14:16:03 -05:00
|
|
|
|
foreach (var av in from sim in Client.Network.Simulators
|
|
|
|
|
|
from kvp in sim.ObjectsAvatars
|
|
|
|
|
|
where kvp.Value != null select kvp.Value into av
|
|
|
|
|
|
where !m_AgentList.ContainsKey(av.ID) select av)
|
2009-10-22 04:29:25 +00:00
|
|
|
|
{
|
2025-05-27 14:16:03 -05:00
|
|
|
|
result.AppendLine();
|
|
|
|
|
|
result.AppendFormat("{0} (Group: {1}, Location: {2}, UUID: {3} LocalID: {4}) Is Probably a bot",
|
|
|
|
|
|
av.Name, av.GroupName, av.Position, av.ID, av.LocalID);
|
2009-10-22 04:29:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return result.ToString();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|