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,95 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : AllowedListCommand.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.Collections.Generic;
using System.Threading;
using System.Text;
public class AllowedListCommand : Command
{
private AutoResetEvent AllowedListDownload = new AutoResetEvent(false);
private List<ParcelManager.ParcelAccessEntry> AllowedList;
public AllowedListCommand(SecondLifeBot SecondLifeBot)
{
Name = "allowed";
Description = bot.Localization.clResourceManager.getText("Commands.AllowedList.Description");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
StringBuilder sb = new StringBuilder();
int CurrentParcel = Client.Parcels.GetParcelLocalID(Client.Network.CurrentSim, Client.Self.SimPosition);
Client.Parcels.ParcelAccessListReply += new EventHandler<ParcelAccessListReplyEventArgs>(Parcels_ParcelAccessListReply);
Client.Parcels.RequestParcelAccessList(Client.Network.CurrentSim, CurrentParcel, AccessList.Access, 0);
if (!AllowedListDownload.WaitOne(15000, false))
{
Client.Parcels.ParcelAccessListReply -= Parcels_ParcelAccessListReply;
AllowedListDownload.Reset();
return bot.Localization.clResourceManager.getText("Commands.AllowedList.Timeout");
}
else
{
Client.Parcels.ParcelAccessListReply -= Parcels_ParcelAccessListReply;
AllowedListDownload.Reset();
}
foreach (ParcelManager.ParcelAccessEntry entry in AllowedList)
{
string avatarName;
if (!Client.key2Name(entry.AgentID, out avatarName))
sb.AppendFormat(bot.Localization.clResourceManager.getText("Commands.AllowedList.AllowedID"), entry.AgentID).AppendLine();
else
sb.AppendFormat(bot.Localization.clResourceManager.getText("Commands.AllowedList.Allowed"), avatarName, entry.AgentID).AppendLine();
}
return sb.ToString();
}
void Parcels_ParcelAccessListReply(object sender, ParcelAccessListReplyEventArgs e)
{
AllowedList = e.AccessList;
AllowedListDownload.Set();
}
}
}

View File

@@ -0,0 +1,95 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : BanListCommand.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.Collections.Generic;
using System.Threading;
using System.Text;
public class BanListCommand : Command
{
private AutoResetEvent BanListDownload = new AutoResetEvent(false);
private List<ParcelManager.ParcelAccessEntry> BanList;
public BanListCommand(SecondLifeBot SecondLifeBot)
{
Name = "banlist";
Description = bot.Localization.clResourceManager.getText("Commands.BanList.Description");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
StringBuilder sb = new StringBuilder();
int CurrentParcel = Client.Parcels.GetParcelLocalID(Client.Network.CurrentSim, Client.Self.SimPosition);
Client.Parcels.ParcelAccessListReply += new EventHandler<ParcelAccessListReplyEventArgs>(Parcels_ParcelAccessListReply);
Client.Parcels.RequestParcelAccessList(Client.Network.CurrentSim, CurrentParcel, AccessList.Ban, 0);
if (!BanListDownload.WaitOne(15000, false))
{
Client.Parcels.ParcelAccessListReply -= Parcels_ParcelAccessListReply;
BanListDownload.Reset();
return bot.Localization.clResourceManager.getText("Commands.BanList.Timeout");
}
else
{
Client.Parcels.ParcelAccessListReply -= Parcels_ParcelAccessListReply;
BanListDownload.Reset();
}
foreach (ParcelManager.ParcelAccessEntry entry in BanList)
{
string avatarName;
if (!Client.key2Name(entry.AgentID, out avatarName))
sb.AppendFormat(bot.Localization.clResourceManager.getText("Commands.BanList.BannedID"), entry.AgentID).AppendLine();
else
sb.AppendFormat(bot.Localization.clResourceManager.getText("Commands.BanList.Banned"), avatarName, entry.AgentID).AppendLine();
}
return sb.ToString();
}
void Parcels_ParcelAccessListReply(object sender, ParcelAccessListReplyEventArgs e)
{
BanList = e.AccessList;
BanListDownload.Set();
}
}
}

View File

@@ -0,0 +1,72 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : BanUserCommand.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.Collections.Generic;
using System.Threading;
using System.Text;
public class BanUserCommand : Command
{
public BanUserCommand(SecondLifeBot SecondLifeBot)
{
Name = "banuser";
Description = bot.Localization.clResourceManager.getText("Commands.BanUser.Description") + " " + bot.Localization.clResourceManager.getText("Commands.BanUser.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
UUID avatarID = UUID.Zero;
string avatarName;
bool isGroupKey = false;
int CurrentParcel = Client.Parcels.GetParcelLocalID(Client.Network.CurrentSim, Client.Self.SimPosition);
if (args.Length != 1)
return bot.Localization.clResourceManager.getText("Commands.BanUser.Usage");
if (!UUID.TryParse(args[0], out avatarID))
return bot.Localization.clResourceManager.getText("Commands.EjectUser.ExpectedAvID");
if (!Client.key2Name(avatarID, out avatarName, out isGroupKey))
return bot.Localization.clResourceManager.getText("Commands.EjectUser.AvNotFound");
if (isGroupKey)
return bot.Localization.clResourceManager.getText("Commands.BanUser.CannotGroup");
Client.Parcels.EjectUser(avatarID, true);
return String.Format(bot.Localization.clResourceManager.getText("Commands.BanUser.Banning"), avatarName);
}
}
}

View File

@@ -0,0 +1,72 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : EjectUserCommand.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.Collections.Generic;
using System.Threading;
using System.Text;
public class EjectUserCommand : Command
{
public EjectUserCommand(SecondLifeBot SecondLifeBot)
{
Name = "ejectuser";
Description = bot.Localization.clResourceManager.getText("Commands.EjectUser.Description") + " " + bot.Localization.clResourceManager.getText("Commands.EjectUser.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
UUID avatarID = UUID.Zero;
string avatarName;
bool isGroupKey = false;
int CurrentParcel = Client.Parcels.GetParcelLocalID(Client.Network.CurrentSim, Client.Self.SimPosition);
if (args.Length != 1)
return bot.Localization.clResourceManager.getText("Commands.EjectUser.Usage");
if (!UUID.TryParse(args[0], out avatarID))
return bot.Localization.clResourceManager.getText("Commands.EjectUser.ExpectedAvID");
if (!Client.key2Name(avatarID, out avatarName, out isGroupKey))
return bot.Localization.clResourceManager.getText("Commands.EjectUser.AvNotFound");
if (isGroupKey)
return bot.Localization.clResourceManager.getText("Commands.EjectUser.CannotGroup");
Client.Parcels.EjectUser(avatarID, false);
return String.Format(bot.Localization.clResourceManager.getText("Commands.EjectUser.Ejecting"), avatarName);
}
}
}

View File

@@ -0,0 +1,79 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : ParcelDetailsCommand.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;
public class ParcelDetailsCommand : Command
{
public ParcelDetailsCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "parceldetails";
base.Description = bot.Localization.clResourceManager.getText("Commands.ParcelDetails.Description") + " " + bot.Localization.clResourceManager.getText("Commands.ParcelDetails.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool something_else)
{
if (args.Length < 1)
return bot.Localization.clResourceManager.getText("Commands.ParcelDetails.Usage");
int parcelID;
Parcel parcel;
// test argument that is is a valid integer, then verify we have that parcel data stored in the dictionary
if (Int32.TryParse(args[0], out parcelID) && Client.Network.CurrentSim.Parcels.TryGetValue(parcelID, out parcel))
{
// this request will update the parcels dictionary
Client.Parcels.RequestParcelProperties(Client.Network.CurrentSim, parcelID, 0);
// Use reflection to dynamically get the fields from the Parcel struct
Type t = parcel.GetType();
System.Reflection.FieldInfo[] fields = t.GetFields(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
StringBuilder sb = new StringBuilder();
foreach (System.Reflection.FieldInfo field in fields)
{
sb.AppendFormat("{0} = {1}" + System.Environment.NewLine, field.Name, field.GetValue(parcel));
}
return sb.ToString();
}
else
{
return String.Format(bot.Localization.clResourceManager.getText("Commands.ParcelDetails.NotFound"), args[0]);
}
}
}
}

View File

@@ -0,0 +1,98 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : ParcelInfoCommand.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.Collections.Generic;
using System.Threading;
using System.Text;
public class ParcelInfoCommand : Command
{
private AutoResetEvent ParcelsDownloaded = new AutoResetEvent(false);
public ParcelInfoCommand(SecondLifeBot SecondLifeBot)
{
Name = "parcelinfo";
Description = bot.Localization.clResourceManager.getText("Commands.ParcelInfo.Description");
SecondLifeBot.Network.Disconnected += Network_OnDisconnected;
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
StringBuilder sb = new StringBuilder();
string result;
EventHandler<SimParcelsDownloadedEventArgs> del = delegate(object sender, SimParcelsDownloadedEventArgs e)
{
ParcelsDownloaded.Set();
};
ParcelsDownloaded.Reset();
Client.Parcels.SimParcelsDownloaded += del;
Client.Parcels.RequestAllSimParcels(Client.Network.CurrentSim);
if (Client.Network.CurrentSim.IsParcelMapFull())
ParcelsDownloaded.Set();
if (ParcelsDownloaded.WaitOne(60000, false) && Client.Network.Connected)
{
sb.AppendFormat(bot.Localization.clResourceManager.getText("Commands.ParcelInfo.Downloaded") + System.Environment.NewLine,
Client.Network.CurrentSim.Parcels.Count, Client.Network.CurrentSim.Name);
Client.Network.CurrentSim.Parcels.ForEach(delegate(Parcel parcel)
{
sb.AppendFormat(bot.Localization.clResourceManager.getText("Commands.ParcelInfo.Parcel") + System.Environment.NewLine,
parcel.LocalID, parcel.Name, parcel.Desc, parcel.AccessWhiteList.Count, parcel.Dwell);
});
result = sb.ToString();
}
else
result = bot.Localization.clResourceManager.getText("Commands.ParcelInfo.Failed");
Client.Parcels.SimParcelsDownloaded -= del;
return result;
}
void Network_OnDisconnected(object sender, DisconnectedEventArgs e)
{
ParcelsDownloaded.Set();
}
}
}

View File

@@ -0,0 +1,94 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : ParcelPrimOwnersCommand.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 ParcelPrimOwnersCommand : Command
{
public ParcelPrimOwnersCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "primowners";
base.Description = bot.Localization.clResourceManager.getText("Commands.ParcelPrimOwners.Description") + " " + bot.Localization.clResourceManager.getText("Commands.ParcelPrimOwners.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool something_else)
{
if (args.Length < 1)
return bot.Localization.clResourceManager.getText("Commands.ParcelPrimOwners.Usage");
int parcelID;
Parcel parcel;
StringBuilder result = new StringBuilder();
// test argument that is is a valid integer, then verify we have that parcel data stored in the dictionary
if (Int32.TryParse(args[0], out parcelID) && Client.Network.CurrentSim.Parcels.TryGetValue(parcelID, out parcel))
{
AutoResetEvent wait = new AutoResetEvent(false);
EventHandler<ParcelObjectOwnersReplyEventArgs> callback = delegate(object sender, ParcelObjectOwnersReplyEventArgs e)
{
for (int i = 0; i < e.PrimOwners.Count; i++)
{
result.AppendFormat(bot.Localization.clResourceManager.getText("Commands.ParcelPrimOwners.Info") + System.Environment.NewLine, e.PrimOwners[i].OwnerID, e.PrimOwners[i].Count);
wait.Set();
}
};
Client.Parcels.ParcelObjectOwnersReply += callback;
;
Client.Parcels.RequestObjectOwners(Client.Network.CurrentSim, parcelID);
if (!wait.WaitOne(10000, false))
{
result.AppendLine(bot.Localization.clResourceManager.getText("Commands.ParcelPrimOwners.TimeOut"));
}
Client.Parcels.ParcelObjectOwnersReply -= callback;
return result.ToString();
}
else
{
return String.Format(bot.Localization.clResourceManager.getText("Commands.ParcelPrimOwners.NotFound"), args[0]);
}
}
void Parcels_OnPrimOwnersListReply(Simulator simulator, List<ParcelManager.ParcelPrimOwners> primOwners)
{
throw new Exception(bot.Localization.clResourceManager.getText("Exception"));
}
}
}

View File

@@ -0,0 +1,97 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : ParcelSelectObjectsCommand.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 ParcelSelectObjectsCommand : Command
{
public ParcelSelectObjectsCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "selectobjects";
base.Description = bot.Localization.clResourceManager.getText("Commands.ParcelSelectObjects.Description") + " " + bot.Localization.clResourceManager.getText("Commands.ParcelSelectObjects.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool something_else)
{
if (args.Length < 2)
return bot.Localization.clResourceManager.getText("Commands.ParcelSelectObjects.Usage");
int parcelID;
UUID ownerUUID;
int counter = 0;
StringBuilder result = new StringBuilder();
// test argument that is is a valid integer, then verify we have that parcel data stored in the dictionary
if (Int32.TryParse(args[0], out parcelID)
&& UUID.TryParse(args[1], out ownerUUID))
{
AutoResetEvent wait = new AutoResetEvent(false);
EventHandler<ForceSelectObjectsReplyEventArgs> callback = delegate(object sender, ForceSelectObjectsReplyEventArgs e)
{
//result.AppendLine("New List: " + resetList.ToString());
for (int i = 0; i < e.ObjectIDs.Count; i++)
{
result.Append(e.ObjectIDs[i].ToString() + " ");
counter++;
}
//result.AppendLine("Got " + objectIDs.Count.ToString() + " Objects in packet");
if (e.ObjectIDs.Count < 251)
wait.Set();
};
Client.Parcels.ForceSelectObjectsReply += callback;
Client.Parcels.RequestSelectObjects(parcelID, (ObjectReturnType)16, ownerUUID);
Client.Parcels.RequestObjectOwners(Client.Network.CurrentSim, parcelID);
if (!wait.WaitOne(30000, false))
{
result.AppendLine(bot.Localization.clResourceManager.getText("Commands.ParcelSelectObjects.Timeout"));
}
Client.Parcels.ForceSelectObjectsReply -= callback;
result.AppendFormat(bot.Localization.clResourceManager.getText("Commands.ParcelSelectObjects.Found"), counter);
return result.ToString();
}
else
{
return String.Format(bot.Localization.clResourceManager.getText("Commands.ParcelSelectObjects.NotFound"), args[0]);
}
}
}
}

View File

@@ -0,0 +1,70 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : PrimCountCommand.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;
public class PrimCountCommand : Command
{
public PrimCountCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "primcount";
base.Description = bot.Localization.clResourceManager.getText("Commands.PrimCount.Description");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
int count = 0;
lock (Client.Network.Simulators)
{
for (int i = 0; i < Client.Network.Simulators.Count; i++)
{
int avcount = Client.Network.Simulators[i].ObjectsAvatars.Count;
int primcount = Client.Network.Simulators[i].ObjectsPrimitives.Count;
bot.Console.WriteLine(bot.Localization.clResourceManager.getText("Commands.PrimCount.Detail"),
Client.Network.Simulators[i].Name, avcount, primcount);
count += avcount;
count += primcount;
}
}
return String.Format(bot.Localization.clResourceManager.getText("Commands.PrimCount.Total"), count);
}
}
}

View File

@@ -0,0 +1,100 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : SearchBuildableCommand.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.Threading;
using System.Collections.Generic;
internal class SearchBuildableCommand : Command
{
private AutoResetEvent ParcelsDownloaded = new AutoResetEvent(false);
private int ParcelCount = 0;
public SearchBuildableCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "searchbuildable";
base.Description = bot.Localization.clResourceManager.getText("Commands.SearchBuildable.Description") + " " + bot.Localization.clResourceManager.getText("Commands.SearchBuildable.Usage");
SecondLifeBot.Network.Disconnected += new EventHandler<DisconnectedEventArgs> Network_OnDisconnected;
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
String result = "";
ParcelManager.SimParcelsDownloaded del = delegate(Simulator simulator, InternalDictionary<int, Parcel> simParcels, int[,] parcelMap)
{
ParcelCount = simParcels.Count;
simParcels.ForEach(delegate(Parcel parcel)
{
if(parcel.Flags == ParcelFlags.CreateObjects)
{
base.Client.sendIRCMessage(String.Format(
bot.Localization.clResourceManager.getText("Commands.SearchBuildable.Found"),
parcel.Name,
simulator.Name
));
}
});
ParcelsDownloaded.Set();
};
ParcelsDownloaded.Reset();
Client.Parcels.OnSimParcelsDownloaded += del;
Client.Parcels.RequestAllSimParcels(Client.Network.CurrentSim);
if (ParcelsDownloaded.WaitOne(20000, false) && Client.Network.Connected)
result = bot.Localization.clResourceManager.getText("Commands.SearchBuildable.Ready");
else
result = bot.Localization.clResourceManager.getText("Commands.SearchBuildable.Failed");
Client.Parcels.OnSimParcelsDownloaded -= del;
return result;
}
void Network_OnDisconnected(NetworkManager.DisconnectType reason, string message)
{
ParcelsDownloaded.Set();
}
}
}
*/

View File

@@ -0,0 +1,81 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : TreeCommand.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;
public class TreeCommand : Command
{
public TreeCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "tree";
base.Description = bot.Localization.clResourceManager.getText("Commands.Tree.Description");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
if (args.Length == 1)
{
try
{
string treeName = args[0].Trim(new char[] { ' ' });
Tree tree = (Tree)Enum.Parse(typeof(Tree), treeName);
Vector3 treePosition = Client.Self.SimPosition;
treePosition.Z += 3.0f;
Client.Objects.AddTree(Client.Network.CurrentSim, new Vector3(0.5f, 0.5f, 0.5f),
Quaternion.Identity, treePosition, tree, Client.GroupID, false);
return String.Format(bot.Localization.clResourceManager.getText("Commands.Tree.Rezzed"), treeName);
}
catch (Exception)
{
return bot.Localization.clResourceManager.getText("Commands.Tree.Help");
}
}
string usage = bot.Localization.clResourceManager.getText("Commands.Tree.Usage") + " [";
foreach (string value in Enum.GetNames(typeof(Tree)))
{
usage += value + ",";
}
usage = usage.TrimEnd(new char[] { ',' });
usage += "]";
return usage;
}
}
}

View File

@@ -0,0 +1,62 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : WindCommand.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 System;
using System.Collections.Generic;
using OpenMetaverse;
using OpenMetaverse.Packets;
using bot;
class WindCommand : Command
{
public WindCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "wind";
base.Description = bot.Localization.clResourceManager.getText("Commands.Wind.Description");
}
public override string Execute(string[] args, UUID fromAgentID, bool something_else)
{
// Get the agent's current "patch" position, where each patch of
// wind data is a 16x16m square
Vector3 agentPos = Client.Self.SimPosition;
int xPos = (int)Utils.Clamp(agentPos.X, 0.0f, 255.0f) / 16;
int yPos = (int)Utils.Clamp(agentPos.Y, 0.0f, 255.0f) / 16;
Vector2 windSpeed = Client.Terrain.WindSpeeds[Client.Network.CurrentSim.Handle][yPos * 16 + xPos];
return String.Format(bot.Localization.clResourceManager.getText("Commands.Wind.Speed"), windSpeed.ToString());
}
}
}