Open sourced NatiBot
This commit is contained in:
83
SLBot/bot/Commands/Grid/AgentLocationsCommand.cs
Normal file
83
SLBot/bot/Commands/Grid/AgentLocationsCommand.cs
Normal file
@@ -0,0 +1,83 @@
|
||||
/***************************************************************************
|
||||
The Disc Image Chef
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Filename : AgentLocationsCommand.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;
|
||||
|
||||
public class AgentLocationsCommand : Command
|
||||
{
|
||||
public AgentLocationsCommand(SecondLifeBot SecondLifeBot)
|
||||
{
|
||||
base.Name = "agentlocations";
|
||||
base.Description = bot.Localization.clResourceManager.getText("Commands.AgentLocations.Description") + " " + bot.Localization.clResourceManager.getText("Commands.AgentLocations.Usage");
|
||||
}
|
||||
|
||||
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
|
||||
{
|
||||
ulong regionHandle;
|
||||
|
||||
if (args.Length == 0)
|
||||
regionHandle = Client.Network.CurrentSim.Handle;
|
||||
else if (!(args.Length == 1 && UInt64.TryParse(args[0], out regionHandle)))
|
||||
return bot.Localization.clResourceManager.getText("Commands.AgentLocations.Usage");
|
||||
|
||||
List<MapItem> items = Client.Grid.MapItems(regionHandle, GridItemType.AgentLocations,
|
||||
GridLayerType.Objects, 1000 * 20);
|
||||
|
||||
if (items != null)
|
||||
{
|
||||
StringBuilder ret = new StringBuilder();
|
||||
ret.AppendLine(bot.Localization.clResourceManager.getText("Commands.AgentLocations.Locations"));
|
||||
|
||||
for (int i = 0; i < items.Count; i++)
|
||||
{
|
||||
MapAgentLocation location = (MapAgentLocation)items[i];
|
||||
|
||||
ret.AppendLine(String.Format(bot.Localization.clResourceManager.getText("Commands.AgentLocations.Avatar"), location.AvatarCount, location.LocalX,
|
||||
location.LocalY));
|
||||
}
|
||||
|
||||
return ret.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return bot.Localization.clResourceManager.getText("Commands.AgentLocations.Fail");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
74
SLBot/bot/Commands/Grid/FindSimCommand.cs
Normal file
74
SLBot/bot/Commands/Grid/FindSimCommand.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
/***************************************************************************
|
||||
The Disc Image Chef
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Filename : FindSimCommand.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 FindSimCommand : Command
|
||||
{
|
||||
public FindSimCommand(SecondLifeBot SecondLifeBot)
|
||||
{
|
||||
base.Name = "findsim";
|
||||
base.Description = bot.Localization.clResourceManager.getText("Commands.FindSim.Description") + " " + bot.Localization.clResourceManager.getText("Commands.FindSim.Usage");
|
||||
}
|
||||
|
||||
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
|
||||
{
|
||||
if (args.Length < 1)
|
||||
return bot.Localization.clResourceManager.getText("Commands.FindSim.Usage");
|
||||
|
||||
// Build the simulator name from the args list
|
||||
string simName = string.Empty;
|
||||
for (int i = 0; i < args.Length; i++)
|
||||
simName += args[i] + " ";
|
||||
simName = simName.TrimEnd().ToLower();
|
||||
|
||||
//if (!GridDataCached[Client])
|
||||
//{
|
||||
// Client.Grid.RequestAllSims(GridManager.MapLayerType.Objects);
|
||||
// System.Threading.Thread.Sleep(5000);
|
||||
// GridDataCached[Client] = true;
|
||||
//}
|
||||
|
||||
GridRegion region;
|
||||
|
||||
if (Client.Grid.GetGridRegion(simName, GridLayerType.Objects, out region))
|
||||
return String.Format(bot.Localization.clResourceManager.getText("Commands.FindSim.Info"), region.Name, region.RegionHandle, region.X, region.Y);
|
||||
else
|
||||
return String.Format(bot.Localization.clResourceManager.getText("Commands.FindSim.LookupFail"), simName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
61
SLBot/bot/Commands/Grid/GridLayerCommand.cs
Normal file
61
SLBot/bot/Commands/Grid/GridLayerCommand.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
/***************************************************************************
|
||||
The Disc Image Chef
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Filename : GridLayerCommand.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 GridLayerCommand : Command
|
||||
{
|
||||
public GridLayerCommand(SecondLifeBot SecondLifeBot)
|
||||
{
|
||||
base.Name = "gridlayer";
|
||||
base.Description = bot.Localization.clResourceManager.getText("Commands.GridLayer.Description");
|
||||
SecondLifeBot.Grid.GridLayer += Grid_GridLayer;
|
||||
}
|
||||
|
||||
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
|
||||
{
|
||||
base.Client.Grid.RequestMapLayer(GridLayerType.Objects);
|
||||
return bot.Localization.clResourceManager.getText("Commands.GridLayer.Ready");
|
||||
}
|
||||
|
||||
void Grid_GridLayer(object sender, GridLayerEventArgs e)
|
||||
{
|
||||
bot.Console.WriteLine(String.Format(bot.Localization.clResourceManager.getText("Commands.GridLayer.Layer"),
|
||||
e.Layer.ImageID.ToString(), e.Layer.Bottom, e.Layer.Left, e.Layer.Top, e.Layer.Right));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
54
SLBot/bot/Commands/Grid/GridMapCommand.cs
Normal file
54
SLBot/bot/Commands/Grid/GridMapCommand.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
/***************************************************************************
|
||||
The Disc Image Chef
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Filename : GridMapCommand.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 GridMapCommand : Command
|
||||
{
|
||||
public GridMapCommand(SecondLifeBot SecondLifeBot)
|
||||
{
|
||||
base.Name = "gridmap";
|
||||
base.Description = bot.Localization.clResourceManager.getText("Commands.GridMap.Description");
|
||||
}
|
||||
|
||||
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
|
||||
{
|
||||
Client.Grid.RequestMainlandSims(GridLayerType.Objects);
|
||||
return bot.Localization.clResourceManager.getText("Commands.GridMap.Ready");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user