Open sourced NatiBot

This commit is contained in:
2014-09-04 04:26:22 +01:00
parent 0c66d4a2ea
commit e4b4c631af
301 changed files with 84837 additions and 7 deletions

View File

@@ -0,0 +1,101 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : AttachmentsUUIDCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using bot;
using OpenMetaverse;
using OpenMetaverse.Utilities;
using System;
using System.Text;
using System.Collections.Generic;
public class AttachmentsUUIDCommand : Command
{
public AttachmentsUUIDCommand(SecondLifeBot SecondLifeBot)
{
base.Client = SecondLifeBot;
base.Name = "attachmentsuuid";
base.Description = bot.Localization.clResourceManager.getText("Commands.AttachmentsUUID.Description") + " " + bot.Localization.clResourceManager.getText("Commands.AttachmentsUUID.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
StringBuilder builder = new StringBuilder();
if (args.Length < 1)
{
return bot.Localization.clResourceManager.getText("Commands.AttachmentsUUID.Usage");
}
List<Avatar> avatars = Client.Network.Simulators[0].ObjectsAvatars.FindAll(
delegate(Avatar av)
{
return av.ID == (UUID)args[0];
}
);
List<Primitive> attachments = Client.Network.CurrentSim.ObjectsPrimitives.FindAll(
delegate(Primitive prim)
{
return prim.ParentID == avatars[0].LocalID;
}
);
for (int i = 0; i < attachments.Count; i++)
{
Primitive prim = attachments[i];
AttachmentPoint point = StateToAttachmentPoint(prim.PrimData.State);
// TODO: Fetch properties for the objects with missing property sets so we can show names
//Logger.Log(String.Format("[Attachment @ {0}] LocalID: {1} UUID: {2} Offset: {3}",
// point, prim.LocalID, prim.ID, prim.Position), Helpers.LogLevel.Info, Client);
builder.AppendFormat(bot.Localization.clResourceManager.getText("Commands.Attachments.Attachment"),
point, prim.LocalID, prim.ID, prim.Position);
builder.AppendLine();
}
builder.AppendLine(String.Format(bot.Localization.clResourceManager.getText("Commands.Attachments.Found"), attachments.Count));
return builder.ToString();
}
public static AttachmentPoint StateToAttachmentPoint(uint state)
{
const uint ATTACHMENT_MASK = 0xF0;
uint fixedState = (((byte)state & ATTACHMENT_MASK) >> 4) | (((byte)state & ~ATTACHMENT_MASK) << 4);
return (AttachmentPoint)fixedState;
}
}
}

View File

@@ -0,0 +1,313 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : AvatarInfoCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using bot;
using OpenMetaverse;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
public class AvatarInfoCommand : Command
{
ManualResetEvent WaitforAvatar = new ManualResetEvent(false);
Avatar.AvatarProperties foundAvProperties;
Avatar.Interests foundAvInterests;
List<AvatarGroup> foundAvGroups = new List<AvatarGroup>();
UUID foundAvUUID;
bool foundAvPropertiesCorrectlyGot = false;
bool foundAvInterestsCorrectlyGot = false;
bool foundAvGroupsCorrectlyGot = false;
bool moreThanOneAvFound = false;
public AvatarInfoCommand(SecondLifeBot SecondLifeBot)
{
Name = "avatarinfo";
Description = bot.Localization.clResourceManager.getText("Commands.AvatarInfo.Description") + " " + bot.Localization.clResourceManager.getText("Commands.AvatarInfo.Usage");
}
void Avatars_AvatarPropertiesReply(object sender, AvatarPropertiesReplyEventArgs e)
{
if (e.AvatarID == foundAvUUID)
{
foundAvPropertiesCorrectlyGot = true;
foundAvProperties = e.Properties;
}
else
{
foundAvPropertiesCorrectlyGot = false;
}
WaitforAvatar.Set();
return;
}
public override string Execute(string[] args, UUID fromAgentID, bool something_else)
{
Client.Avatars.AvatarPropertiesReply += new EventHandler<AvatarPropertiesReplyEventArgs>(Avatars_AvatarPropertiesReply);
moreThanOneAvFound = false;
foundAvUUID = UUID.Zero;
Avatar foundAv = null;
foundAvProperties = new Avatar.AvatarProperties();
foundAvInterests = new Avatar.Interests();
foundAvGroups = new List<AvatarGroup>();
WaitforAvatar = new ManualResetEvent(false);
if (args.Length != 2)
return bot.Localization.clResourceManager.getText("Commands.AvatarInfo.Usage");
string targetName = String.Format("{0} {1}", args[0], args[1]);
Client.FindOneAvatar(targetName, out foundAvUUID, out moreThanOneAvFound);
foundAv = Client.Network.CurrentSim.ObjectsAvatars.Find(
delegate(Avatar avatar)
{
return (avatar.Name == targetName);
}
);
if (foundAvUUID != UUID.Zero)
{
StringBuilder output = new StringBuilder();
if (moreThanOneAvFound)
{
output.AppendFormat("More than one avatar found with that search terms.");
output.AppendLine();
output.AppendFormat("{0} ({1})", targetName, foundAvUUID);
}
else
{
output.AppendFormat("{0} ({1})", targetName, foundAvUUID);
}
output.AppendLine();
Client.Avatars.RequestAvatarProperties(foundAvUUID);
if (!WaitforAvatar.WaitOne(10000, false))
{
Client.Avatars.AvatarPropertiesReply -= Avatars_AvatarPropertiesReply;
output.AppendLine(bot.Localization.clResourceManager.getText("Commands.AvatarInfo.NotProfile"));
}
else
{
Client.Avatars.AvatarPropertiesReply -= Avatars_AvatarPropertiesReply;
if (foundAvPropertiesCorrectlyGot == true)
{
// CLAUNIA
// For some reason it is getting offline
/*
switch (foundAvProperties.Online)
{
case true:
output.AppendFormat("Avatar conectado");
output.AppendLine();
break;
case false:
output.AppendFormat("Avatar NO conectado");
output.AppendLine();
break;
}
*/
output.AppendLine(bot.Localization.clResourceManager.getText("Commands.AvatarInfo.SecondLife"));
output.AppendFormat(bot.Localization.clResourceManager.getText("Commands.AvatarInfo.Born"), foundAvProperties.BornOn);
output.AppendLine();
//output.AppendFormat(" Flags: {0}", foundAvProperties.Flags.ToString()); output.AppendLine();
output.AppendFormat(bot.Localization.clResourceManager.getText("Commands.AvatarInfo.SecondPhoto"), foundAvProperties.ProfileImage.ToString());
output.AppendLine();
output.Append(bot.Localization.clResourceManager.getText("Commands.AvatarInfo.Account"));
if (foundAvProperties.Identified)
output.Append(bot.Localization.clResourceManager.getText("Commands.AvatarInfo.Identified"));
if (foundAvProperties.MaturePublish)
output.Append(bot.Localization.clResourceManager.getText("Commands.AvatarInfo.Adult"));
if (foundAvProperties.Transacted)
output.Append(bot.Localization.clResourceManager.getText("Commands.AvatarInfo.Payment"));
if (foundAvProperties.AllowPublish)
output.Append(bot.Localization.clResourceManager.getText("Commands.AvatarInfo.Public"));
output.AppendLine(".");
output.AppendFormat(bot.Localization.clResourceManager.getText("Commands.AvatarInfo.Partner"), foundAvProperties.Partner.ToString());
output.AppendLine();
output.AppendFormat(bot.Localization.clResourceManager.getText("Commands.AvatarInfo.Charter"), foundAvProperties.CharterMember);
output.AppendLine();
WaitforAvatar.Reset();
Client.Avatars.AvatarGroupsReply += new EventHandler<AvatarGroupsReplyEventArgs>(Avatars_OnAvatarGroups);
Client.Avatars.RequestAvatarProperties(foundAvUUID);
if (!WaitforAvatar.WaitOne(2500, false))
{
Client.Avatars.AvatarGroupsReply -= Avatars_OnAvatarGroups;
output.AppendLine(bot.Localization.clResourceManager.getText("Commands.AvatarInfo.NotGroups"));
}
else
{
Client.Avatars.AvatarGroupsReply -= Avatars_OnAvatarGroups;
if (foundAvGroupsCorrectlyGot)
{
output.AppendLine(bot.Localization.clResourceManager.getText("Commands.AvatarInfo.Groups"));
foreach (AvatarGroup avGroup in foundAvGroups)
{
output.AppendFormat(" {0} ({1})", avGroup.GroupName, avGroup.GroupID);
output.AppendLine();
}
}
}
output.AppendLine(bot.Localization.clResourceManager.getText("Commands.AvatarInfo.About"));
output.AppendFormat(" {0}", foundAvProperties.AboutText);
output.AppendLine();
output.AppendLine();
output.AppendFormat(bot.Localization.clResourceManager.getText("Commands.AvatarInfo.WebProfile"), foundAvProperties.ProfileURL);
output.AppendLine();
output.AppendLine();
WaitforAvatar.Reset();
Client.Avatars.AvatarInterestsReply += new EventHandler<AvatarInterestsReplyEventArgs>(Avatars_OnAvatarInterests);
Client.Avatars.RequestAvatarProperties(foundAvUUID);
if (!WaitforAvatar.WaitOne(1000, false))
{
Client.Avatars.AvatarInterestsReply -= Avatars_OnAvatarInterests;
output.AppendLine(bot.Localization.clResourceManager.getText("Commands.AvatarInfo.NotInterests"));
}
else
{
Client.Avatars.AvatarInterestsReply -= Avatars_OnAvatarInterests;
if (foundAvInterestsCorrectlyGot)
{
output.AppendLine(bot.Localization.clResourceManager.getText("Commands.AvatarInfo.Interests"));
output.AppendFormat(bot.Localization.clResourceManager.getText("Commands.AvatarInfo.Wants"), foundAvInterests.WantToMask.ToString("X"), foundAvInterests.WantToText);
output.AppendLine();
output.AppendFormat(bot.Localization.clResourceManager.getText("Commands.AvatarInfo.Skills"), foundAvInterests.SkillsMask.ToString("X"), foundAvInterests.SkillsText);
output.AppendLine();
output.AppendFormat(bot.Localization.clResourceManager.getText("Commands.AvatarInfo.Languages"), foundAvInterests.LanguagesText);
output.AppendLine();
output.AppendLine();
}
}
output.AppendLine(bot.Localization.clResourceManager.getText("Commands.AvatarInfo.FirstLife"));
output.AppendFormat(bot.Localization.clResourceManager.getText("Commands.AvatarInfo.FirstPhoto"), foundAvProperties.FirstLifeImage.ToString());
output.AppendLine();
output.AppendFormat(bot.Localization.clResourceManager.getText("Commands.AvatarInfo.Information"), foundAvProperties.FirstLifeText);
output.AppendLine();
output.AppendLine();
}
else
{
output.AppendLine(bot.Localization.clResourceManager.getText("Commands.AvatarInfo.Error"));
}
}
// CLAUNIA
// There is no event nor method for requesting statistics.
/*
output.AppendLine("Estadísticas:");
output.AppendFormat(" Apariencia: {0} votos positivos, {1} votos negativos", foundAv.ProfileStatistics.AppearancePositive, foundAv.ProfileStatistics.AppearanceNegative); output.AppendLine();
output.AppendFormat(" Comportamiento: {0} votos positivos, {1} votos negativos", foundAv.ProfileStatistics.BehaviorPositive, foundAv.ProfileStatistics.BehaviorNegative); output.AppendLine();
output.AppendFormat(" Construcción: {0} votos positivos, {1} votos negativos", foundAv.ProfileStatistics.BuildingPositive, foundAv.ProfileStatistics.BuildingNegative); output.AppendLine();
output.AppendFormat(" Votos emitidos: {0} positivos, {1} negativos", foundAv.ProfileStatistics.GivenPositive, foundAv.ProfileStatistics.GivenNegative); output.AppendLine();
output.AppendLine();*/
if (foundAv != null)
{
if (foundAv.Textures != null)
{
output.AppendLine(bot.Localization.clResourceManager.getText("Commands.AvatarInfo.Textures"));
for (int i = 0; i < foundAv.Textures.FaceTextures.Length; i++)
{
if (foundAv.Textures.FaceTextures[i] != null)
{
Primitive.TextureEntryFace face = foundAv.Textures.FaceTextures[i];
AvatarTextureIndex type = (AvatarTextureIndex)i;
output.AppendFormat(" {0}: {1}", type, face.TextureID);
output.AppendLine();
}
}
}
}
return output.ToString();
}
else
{
return String.Format(bot.Localization.clResourceManager.getText("Commands.AvatarInfo.NotFound"), targetName);
}
}
void Avatars_OnAvatarGroups(object sender, AvatarGroupsReplyEventArgs e)
{
if (e.AvatarID == foundAvUUID)
{
foundAvGroupsCorrectlyGot = true;
foundAvGroups = e.Groups;
}
else
{
foundAvGroupsCorrectlyGot = false;
}
WaitforAvatar.Set();
return;
}
void Avatars_OnAvatarInterests(object sender, AvatarInterestsReplyEventArgs e)
{
if (e.AvatarID == foundAvUUID)
{
foundAvInterestsCorrectlyGot = true;
foundAvInterests = e.Interests;
}
else
{
foundAvInterestsCorrectlyGot = false;
}
WaitforAvatar.Set();
return;
}
}
}

View File

@@ -0,0 +1,115 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : CloneCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using bot;
using OpenMetaverse;
using OpenMetaverse.Packets;
using System;
using System.Collections.Generic;
using System.Threading;
public class CloneCommand : Command
{
uint SerialNum = 2;
public CloneCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "clone";
base.Description = bot.Localization.clResourceManager.getText("Commands.Clone.Description") + " " + bot.Localization.clResourceManager.getText("Commands.Clone.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool something_else)
{
string targetName = String.Empty;
List<DirectoryManager.AgentSearchData> matches;
for (int ct = 0; ct < args.Length; ct++)
targetName = targetName + args[ct] + " ";
targetName = targetName.TrimEnd();
if (targetName.Length == 0)
return bot.Localization.clResourceManager.getText("Commands.Clone.Usage");
if (Client.Directory.PeopleSearch(DirectoryManager.DirFindFlags.People, targetName, 0, 1000 * 10,
out matches) && matches.Count > 0)
{
UUID target = matches[0].AgentID;
targetName += String.Format(" ({0})", target);
if (Client.Appearances.ContainsKey(target))
{
#region AvatarAppearance to AgentSetAppearance
AvatarAppearancePacket appearance = Client.Appearances[target];
AgentSetAppearancePacket set = new AgentSetAppearancePacket();
set.AgentData.AgentID = Client.Self.AgentID;
set.AgentData.SessionID = Client.Self.SessionID;
set.AgentData.SerialNum = SerialNum++;
set.AgentData.Size = new Vector3(2f, 2f, 2f); // HACK
set.WearableData = new AgentSetAppearancePacket.WearableDataBlock[0];
set.VisualParam = new AgentSetAppearancePacket.VisualParamBlock[appearance.VisualParam.Length];
for (int i = 0; i < appearance.VisualParam.Length; i++)
{
set.VisualParam[i] = new AgentSetAppearancePacket.VisualParamBlock();
set.VisualParam[i].ParamValue = appearance.VisualParam[i].ParamValue;
}
set.ObjectData.TextureEntry = appearance.ObjectData.TextureEntry;
#endregion AvatarAppearance to AgentSetAppearance
// Detach everything we are currently wearing
Client.Appearance.AddAttachments(new List<InventoryItem>(), true);
// Send the new appearance packet
Client.Network.SendPacket(set);
return String.Format(bot.Localization.clResourceManager.getText("Commands.Clone.Done"), targetName);
}
else
{
return String.Format(bot.Localization.clResourceManager.getText("Commands.Clone.Unknown"), targetName);
}
}
else
{
return String.Format(bot.Localization.clResourceManager.getText("Commands.Clone.NotFound"), targetName);
}
}
}
}

View File

@@ -0,0 +1,186 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : CloneProfileCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using bot;
using OpenMetaverse;
using OpenMetaverse.Packets;
using System;
using System.Collections.Generic;
using System.Threading;
public class CloneProfileCommand : Command
{
Avatar.AvatarProperties Properties;
Avatar.Interests Interests;
List<UUID> Groups = new List<UUID>();
bool ReceivedProperties = false;
bool ReceivedInterests = false;
bool ReceivedGroups = false;
ManualResetEvent ReceivedProfileEvent = new ManualResetEvent(false);
public CloneProfileCommand(SecondLifeBot SecondLifeBot)
{
SecondLifeBot.Avatars.AvatarInterestsReply += new EventHandler<AvatarInterestsReplyEventArgs>(Avatars_AvatarInterestsReply);
SecondLifeBot.Avatars.AvatarPropertiesReply += new EventHandler<AvatarPropertiesReplyEventArgs>(Avatars_AvatarPropertiesReply);
SecondLifeBot.Avatars.AvatarGroupsReply += new EventHandler<AvatarGroupsReplyEventArgs>(Avatars_AvatarGroupsReply);
SecondLifeBot.Groups.GroupJoinedReply += new EventHandler<GroupOperationEventArgs>(Groups_OnGroupJoined);
SecondLifeBot.Avatars.AvatarPicksReply += new EventHandler<AvatarPicksReplyEventArgs>(Avatars_AvatarPicksReply);
base.Name = "cloneprofile";
base.Description = bot.Localization.clResourceManager.getText("Commands.CloneProfile.Description") + " " + bot.Localization.clResourceManager.getText("Commands.CloneProfile.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
if (args.Length != 1)
return bot.Localization.clResourceManager.getText("Commands.CloneProfile.Usage");
UUID targetID;
ReceivedProperties = false;
ReceivedInterests = false;
ReceivedGroups = false;
try
{
targetID = new UUID(args[0]);
}
catch (Exception)
{
return bot.Localization.clResourceManager.getText("Commands.CloneProfile.Usage");
}
// Request all of the packets that make up an avatar profile
Client.Avatars.RequestAvatarProperties(targetID);
// Wait for all the packets to arrive
ReceivedProfileEvent.Reset();
ReceivedProfileEvent.WaitOne(5000, false);
// Check if everything showed up
if (!ReceivedInterests || !ReceivedProperties || !ReceivedGroups)
return bot.Localization.clResourceManager.getText("Commands.CloneProfile.Fail");
// Synchronize our profile
Client.Self.UpdateInterests(Interests);
Client.Self.UpdateProfile(Properties);
// TODO: Leave all the groups we're currently a member of? This could
// break TestClient connectivity that might be relying on group authentication
// Attempt to join all the groups
foreach (UUID groupID in Groups)
{
Client.Groups.RequestJoinGroup(groupID);
}
return String.Format(bot.Localization.clResourceManager.getText("Commands.CloneProfile.Done"), targetID.ToString());
}
void Avatars_AvatarPropertiesReply(object sender, AvatarPropertiesReplyEventArgs e)
{
lock (ReceivedProfileEvent)
{
Properties = e.Properties;
ReceivedProperties = true;
if (ReceivedInterests && ReceivedProperties && ReceivedGroups)
ReceivedProfileEvent.Set();
}
}
void Avatars_AvatarInterestsReply(object sender, AvatarInterestsReplyEventArgs e)
{
lock (ReceivedProfileEvent)
{
Interests = e.Interests;
ReceivedInterests = true;
if (ReceivedInterests && ReceivedProperties && ReceivedGroups)
ReceivedProfileEvent.Set();
}
}
void Avatars_AvatarGroupsReply(object sender, AvatarGroupsReplyEventArgs e)
{
lock (ReceivedProfileEvent)
{
foreach (AvatarGroup group in e.Groups)
{
Groups.Add(group.GroupID);
}
ReceivedGroups = true;
if (ReceivedInterests && ReceivedProperties && ReceivedGroups)
ReceivedProfileEvent.Set();
}
}
void Groups_OnGroupJoined(object sender, GroupOperationEventArgs e)
{
if (e.Success)
bot.Console.WriteLine(bot.Localization.clResourceManager.getText("Commands.CloneProfile.Joined"), e.GroupID.ToString());
else
bot.Console.WriteLine(bot.Localization.clResourceManager.getText("Commands.CloneProfile.FailJoin"), e.GroupID.ToString());
if (e.Success)
{
bot.Console.WriteLine(bot.Localization.clResourceManager.getText("Commands.CloneProfile.Active"), Client.ToString(),
e.GroupID.ToString());
Client.Groups.ActivateGroup(e.GroupID);
}
}
void Avatars_PickInfoReply(object sender, PickInfoReplyEventArgs e)
{
Client.Self.PickInfoUpdate(e.PickID, e.Pick.TopPick, e.Pick.ParcelID, e.Pick.Name, e.Pick.PosGlobal, e.Pick.SnapshotID, e.Pick.Desc);
}
void Avatars_AvatarPicksReply(object sender, AvatarPicksReplyEventArgs e)
{
foreach (KeyValuePair<UUID, string> kvp in e.Picks)
{
if (e.AvatarID == Client.Self.AgentID)
{
Client.Self.PickDelete(kvp.Key);
}
else
{
Client.Avatars.RequestPickInfo(e.AvatarID, kvp.Key);
}
}
}
}
}

View File

@@ -0,0 +1,117 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : DetectBotCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using bot;
using OpenMetaverse;
using OpenMetaverse.Packets;
using System;
using System.Collections.Generic;
using System.Text;
public class DetectBotCommand : Command
{
private Dictionary<UUID, bool> m_AgentList = new Dictionary<UUID, bool>();
public DetectBotCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "detectbots";
base.Description = bot.Localization.clResourceManager.getText("Commands.DetectBot.Description");
SecondLifeBot.Avatars.ViewerEffect += new EventHandler<ViewerEffectEventArgs>(Avatars_ViewerEffect);
SecondLifeBot.Avatars.ViewerEffectLookAt += new EventHandler<ViewerEffectLookAtEventArgs>(Avatars_ViewerEffectLookAt);
SecondLifeBot.Avatars.ViewerEffectPointAt += new EventHandler<ViewerEffectPointAtEventArgs>(Avatars_ViewerEffectPointAt);
}
private void Avatars_ViewerEffectPointAt(object sender, ViewerEffectPointAtEventArgs e)
{
lock (m_AgentList)
{
if (m_AgentList.ContainsKey(e.SourceID))
m_AgentList[e.SourceID] = true;
else
m_AgentList.Add(e.SourceID, true);
}
}
private void Avatars_ViewerEffectLookAt(object sender, ViewerEffectLookAtEventArgs e)
{
lock (m_AgentList)
{
if (m_AgentList.ContainsKey(e.SourceID))
m_AgentList[e.SourceID] = true;
else
m_AgentList.Add(e.SourceID, true);
}
}
private void Avatars_ViewerEffect(object sender, ViewerEffectEventArgs e)
{
lock (m_AgentList)
{
if (m_AgentList.ContainsKey(e.SourceID))
m_AgentList[e.SourceID] = true;
else
m_AgentList.Add(e.SourceID, true);
}
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
StringBuilder result = new StringBuilder();
lock (Client.Network.Simulators)
{
for (int i = 0; i < Client.Network.Simulators.Count; i++)
{
Client.Network.Simulators[i].ObjectsAvatars.ForEach(
delegate(Avatar av)
{
lock (m_AgentList)
{
if (!m_AgentList.ContainsKey(av.ID))
{
result.AppendLine();
result.AppendFormat(bot.Localization.clResourceManager.getText("Commands.DetectBot.Bot"),
av.Name, av.GroupName, av.Position, av.ID, av.LocalID);
}
}
}
);
}
}
return result.ToString();
}
}
}

View File

@@ -0,0 +1,71 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : DetectLindensCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
/*namespace bot.Commands
{
using bot;
using libsecondlife;
using libsecondlife.Packets;
using System;
public class DetectBotCommand : Command
{
public DetectBotCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "detectlindens";
base.Description = "Runs in the background, reporting any potential bots";
SecondLifeBot.Network.RegisterCallback(PacketType.AgentUpdate, new NetworkManager.PacketCallback(this.AgentUpdatePacketHandler));
}
private void AvatarAppearanceHandler(Packet packet, Simulator simulator)
{
AvatarAppearancePacket packet2 = (AvatarAppearancePacket)packet;
packet2.ObjectData[
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
return "This command is always running";
}
private bool IsNullOrZero(LLObject.TextureEntryFace face)
{
if (face != null)
{
return (face.TextureID == UUID.Zero);
}
return true;
}
}
}
*/

View File

@@ -0,0 +1,95 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : EndFriendshipCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using bot;
using OpenMetaverse;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
public class EndFriendshipCommand : Command
{
public EndFriendshipCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "endfriendship";
base.Description = bot.Localization.clResourceManager.getText("Commands.EndFriendship.Description") + " " + bot.Localization.clResourceManager.getText("Commands.EndFriendship.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
UUID avatarID = UUID.Zero;
string avatarName = "";
bool isGroupKey = false;
if (args.Length == 1)
{
if (!UUID.TryParse(args[0], out avatarID))
return bot.Localization.clResourceManager.getText("Commands.EndFriendship.Usage");
if (!Client.key2Name(avatarID, out avatarName, out isGroupKey))
return bot.Localization.clResourceManager.getText("Commands.OfferFriendship.AvNotFound");
if (isGroupKey)
return bot.Localization.clResourceManager.getText("Commands.EndFriendship.CannotGroup");
}
else if (args.Length == 2)
{
avatarName = args[0] + " " + args[1];
if (!Client.FindOneAvatar(avatarName, out avatarID))
return String.Format(bot.Localization.clResourceManager.getText("Commands.OfferFriendship.NameNotFound"), avatarName);
}
else
{
return bot.Localization.clResourceManager.getText("Commands.EndFriendship.Usage");
}
if (avatarID != UUID.Zero)
{
if (!Client.Friends.FriendList.ContainsKey(avatarID))
return String.Format(bot.Localization.clResourceManager.getText("Commands.EndFriendship.NotFriend"), avatarName);
Client.Friends.TerminateFriendship(avatarID);
return String.Format(bot.Localization.clResourceManager.getText("Commands.EndFriendship.Terminated"), avatarName);
}
else
{
return bot.Localization.clResourceManager.getText("Commands.OfferFriendship.Error");
}
}
}
}

View File

@@ -0,0 +1,94 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : ExportOutfitCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using bot;
using OpenMetaverse;
using OpenMetaverse.Packets;
using OpenMetaverse.StructuredData;
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
public class ExportOutfitCommand : Command
{
public ExportOutfitCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "exportoutfit";
base.Description = bot.Localization.clResourceManager.getText("Commands.ExportOutfit.Description") + " " + bot.Localization.clResourceManager.getText("Commands.ExportOutfit.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
UUID id;
string path;
if (args.Length == 1)
{
id = Client.Self.AgentID;
path = args[0];
}
else if (args.Length == 2)
{
if (!UUID.TryParse(args[0], out id))
return bot.Localization.clResourceManager.getText("Commands.ExportOutfit.Usage");
path = args[1];
}
else
return bot.Localization.clResourceManager.getText("Commands.ExportOutfit.Usage");
lock (Client.Appearances)
{
if (Client.Appearances.ContainsKey(id))
{
try
{
File.WriteAllText(path, Packet.ToXmlString(Client.Appearances[id]));
}
catch (Exception e)
{
return e.ToString();
}
return String.Format(bot.Localization.clResourceManager.getText("Commands.ExportOutfit.Exported"), id.ToString(), args[1]);
}
else
{
return String.Format(bot.Localization.clResourceManager.getText("Commands.ExportOutfit.NotFound"), id.ToString());
}
}
}
}
}

View File

@@ -0,0 +1,85 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : FriendsCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using bot;
using OpenMetaverse;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
public class FriendsCommand : Command
{
public FriendsCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "friends";
base.Description = bot.Localization.clResourceManager.getText("Commands.Friends.Description");
}
/// <summary>
/// Get a list of current friends
/// </summary>
/// <param name="args">optional testClient command arguments</param>
/// <param name="fromAgentID">The <seealso cref="OpenMetaverse.UUID"/>
/// of the agent making the request</param>
/// <returns></returns>
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
// initialize a StringBuilder object used to return the results
StringBuilder sb = new StringBuilder();
// Only iterate the Friends dictionary if we actually have friends!
if (Client.Friends.FriendList.Count > 0)
{
// iterate over the InternalDictionary using a delegate to populate
// our StringBuilder output string
Client.Friends.FriendList.ForEach(delegate(FriendInfo friend)
{
// append the name of the friend to our output
sb.AppendLine(friend.Name + "(UUID: " + friend.UUID.ToString() + ")");
});
}
else
{
// we have no friends :(
sb.AppendLine(bot.Localization.clResourceManager.getText("Commands.Friends.NoFriends"));
}
// return the result
return sb.ToString();
}
}
}

View File

@@ -0,0 +1,130 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : ImportOutfitCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
/*namespace bot.Commands
{
using bot;
using OpenMetaverse;
using OpenMetaverse.Packets;
using OpenMetaverse.StructuredData;
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
public class ImportOutfitCommand : Command
{
private Vector3 currentPosition;
private Primitive currentPrim;
private List<uint> linkQueue;
private AutoResetEvent primDone = new AutoResetEvent(false);
private List<Primitive> primsCreated;
private uint rootLocalID;
private ImporterState state = ImporterState.Idle;
private uint SerialNum = 2;
private enum ImporterState
{
RezzingParent,
RezzingChildren,
Linking,
Idle
}
private class Linkset
{
public List<Primitive> Children;
public Primitive RootPrim;
public Linkset()
{
this.Children = new List<Primitive>();
this.RootPrim = new Primitive();
}
public Linkset(Primitive rootPrim)
{
this.Children = new List<Primitive>();
this.RootPrim = rootPrim;
}
}
public ImportOutfitCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "importoutfit";
base.Description = bot.Localization.clResourceManager.getText("Commands.ImportOutfit.Description") + " " + bot.Localization.clResourceManager.getText("Commands.ImportOutfit.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
/* if (args.Length != 1)
{
return "Uso: importoutfit apariencia.xml";
}
string path = args[0];
string str2;
try
{
str2 = File.ReadAllText(path);
}
catch (Exception exception)
{
return exception.Message;
}
if (str2.Length == 0)
return "El archivo exportado está dañado.";
AvatarAppearancePacket packet= (AvatarAppearancePacket)AvatarAppearancePacket.FromLLSD(LLSDParser.DeserializeXml(str2));
AgentSetAppearancePacket packet2 = new AgentSetAppearancePacket();
packet2.AgentData.AgentID = base.Client.Self.AgentID;
packet2.AgentData.SessionID = base.Client.Self.SessionID;
packet2.AgentData.SerialNum = this.SerialNum++;
packet2.AgentData.Size = new Vector3(2f, 2f, 2f);
packet2.WearableData = new AgentSetAppearancePacket.WearableDataBlock[0];
packet2.VisualParam = new AgentSetAppearancePacket.VisualParamBlock[packet.VisualParam.Length];
for (int j = 0; j < packet.VisualParam.Length; j++)
{
packet2.VisualParam[j] = new AgentSetAppearancePacket.VisualParamBlock();
packet2.VisualParam[j].ParamValue = packet.VisualParam[j].ParamValue;
}
packet2.ObjectData.TextureEntry = packet.ObjectData.TextureEntry;
base.Client.Appearance.AddAttachments(new List<InventoryBase>(), true);
base.Client.Network.SendPacket(packet2);
return ("Importado" + args[0]);*/
/* return bot.Localization.clResourceManager.getText("Exception");
}
}
}
*/

View File

@@ -0,0 +1,76 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : InformFriendCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using bot;
using System;
using OpenMetaverse;
public class InformFriendCommand : Command
{
public InformFriendCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "informfriend";
base.Description = bot.Localization.clResourceManager.getText("Commands.InformFriend.Description") + " " + bot.Localization.clResourceManager.getText("Commands.InformFriend.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
if (args.Length == 0)
{
if (Client.InformFriends)
return bot.Localization.clResourceManager.getText("Commands.InformFriend.Inform");
else
return bot.Localization.clResourceManager.getText("Commands.InformFriend.NotInform");
}
if (args.Length != 1)
return bot.Localization.clResourceManager.getText("Commands.InformFriend.Usage");
if (args[0].ToLower() == "on")
{
Client.InformFriends = true;
return bot.Localization.clResourceManager.getText("Commands.InformFriend.WillInform");
}
else if (args[0].ToLower() == "off")
{
Client.InformFriends = false;
return bot.Localization.clResourceManager.getText("Commands.InformFriend.WontInform");
}
else
{
return bot.Localization.clResourceManager.getText("Commands.InformFriend.Usage");
}
}
}
}

View File

@@ -0,0 +1,85 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : MapFriendCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using bot;
using OpenMetaverse;
using System;
using System.Text;
using System.Threading;
public class MapFriendCommand : Command
{
ManualResetEvent WaitforFriend = new ManualResetEvent(false);
public MapFriendCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "mapfriend";
base.Description = bot.Localization.clResourceManager.getText("Commands.MapFriend.Description") + " " + bot.Localization.clResourceManager.getText("Commands.MapFriend.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
if (args.Length != 1)
return bot.Localization.clResourceManager.getText("Commands.MapFriend.Usage");
UUID targetID;
if (!UUID.TryParse(args[0], out targetID))
return bot.Localization.clResourceManager.getText("Commands.MapFriend.Usage");
StringBuilder sb = new StringBuilder();
EventHandler<FriendFoundReplyEventArgs> del = delegate(object sender, FriendFoundReplyEventArgs e)
{
if (!e.RegionHandle.Equals(0))
sb.AppendFormat(bot.Localization.clResourceManager.getText("Commands.MapFriend.Found"), e.AgentID, e.RegionHandle, e.Location.X, e.Location.Y);
else
sb.AppendFormat(bot.Localization.clResourceManager.getText("Commands.MapFriend.Offline"), e.AgentID);
WaitforFriend.Set();
};
Client.Friends.FriendFoundReply += del;
WaitforFriend.Reset();
Client.Friends.MapFriend(targetID);
if (!WaitforFriend.WaitOne(10000, false))
{
sb.AppendFormat(bot.Localization.clResourceManager.getText("Commands.MapFriend.TimeOut"), targetID);
}
Client.Friends.FriendFoundReply -= del;
return sb.ToString();
}
}
}

View File

@@ -0,0 +1,95 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : OfferFriendshipCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using bot;
using OpenMetaverse;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
public class OfferFriendshipCommand : Command
{
public OfferFriendshipCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "offerfriendship";
base.Description = bot.Localization.clResourceManager.getText("Commands.OfferFriendship.Description") + " " + bot.Localization.clResourceManager.getText("Commands.OfferFriendship.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
UUID avatarID = UUID.Zero;
string avatarName = "";
bool isGroupKey = false;
if (args.Length == 1)
{
if (!UUID.TryParse(args[0], out avatarID))
return bot.Localization.clResourceManager.getText("Commands.OfferFriendship.Usage");
if (!Client.key2Name(avatarID, out avatarName, out isGroupKey))
return bot.Localization.clResourceManager.getText("Commands.OfferFriendship.AvNotFound");
if (isGroupKey)
return bot.Localization.clResourceManager.getText("Commands.OfferFriendship.CannotGroup");
}
else if (args.Length == 2)
{
avatarName = args[0] + " " + args[1];
if (!Client.FindOneAvatar(avatarName, out avatarID))
return String.Format(bot.Localization.clResourceManager.getText("Commands.OfferFriendship.NameNotFound"), avatarName);
}
else
{
return bot.Localization.clResourceManager.getText("Commands.OfferFriendship.Usage");
}
if (avatarID != UUID.Zero)
{
if (Client.Friends.FriendList.ContainsKey(avatarID))
return String.Format(bot.Localization.clResourceManager.getText("Commands.OfferFriendship.AlreadyFriend"), avatarName);
Client.Friends.OfferFriendship(avatarID, bot.Localization.clResourceManager.getText("Commands.OfferFriendship.Message"));
return String.Format(bot.Localization.clResourceManager.getText("Commands.OfferFriendship.Offered"), avatarName);
}
else
{
return bot.Localization.clResourceManager.getText("Commands.OfferFriendship.Error");
}
}
}
}

View File

@@ -0,0 +1,111 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : WhoCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using bot;
using OpenMetaverse;
using System;
using System.Text;
using System.Collections.Generic;
public class WhoCommand : Command
{
public WhoCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "who";
base.Description = bot.Localization.clResourceManager.getText("Commands.Who.Description");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
StringBuilder result = new StringBuilder();
Dictionary<UUID, string> ClientNames = ClientTags.ToDictionary();
lock (Client.Network.Simulators)
{
for (int i = 0; i < Client.Network.Simulators.Count; i++)
{
Client.Network.Simulators[i].ObjectsAvatars.ForEach(
delegate(Avatar av)
{
Vector3 RealPosition;
if (av.ParentID != 0)
{
Primitive SitPrim;
SitPrim = Client.Network.CurrentSim.ObjectsPrimitives.Find(
delegate(Primitive prim)
{
return prim.LocalID == av.ParentID;
}
);
if (SitPrim == null)
RealPosition = new Vector3(0, 0, 0);
else
RealPosition = SitPrim.Position;
}
else
{
RealPosition = av.Position;
}
string ViewerName;
if (av.Textures == null)
ViewerName = bot.Localization.clResourceManager.getText("Viewer.Unknown");
else
{
if (av.Textures.FaceTextures[(int)AvatarTextureIndex.HeadBodypaint] != null)
{
if (!ClientNames.TryGetValue(av.Textures.FaceTextures[(int)AvatarTextureIndex.HeadBodypaint].TextureID, out ViewerName))
ViewerName = bot.Localization.clResourceManager.getText("Viewer.Unidentified");
}
else
ViewerName = bot.Localization.clResourceManager.getText("Viewer.Unknown");
}
result.AppendLine();
result.AppendFormat(bot.Localization.clResourceManager.getText("Commands.Who.Info"),
av.Name, ViewerName, av.GroupName, RealPosition, av.ID.ToString());
}
);
}
}
return result.ToString();
}
}
}