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,140 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : AnimateCommand.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
****************************************************************************/
using System;
using OpenMetaverse;
using System.Collections.Generic;
using System.Text;
namespace bot.Core.Commands
{
public class AnimateCommand : bot.Commands.Command
{
private Dictionary<UUID, string> m_BuiltInAnimations = new Dictionary<UUID, string>(Animations.ToDictionary());
public AnimateCommand(SecondLifeBot SecondLifeBot)
{
Client = SecondLifeBot;
Name = "animate";
Description = bot.Localization.clResourceManager.getText("Commands.Animate.Description") + " " + bot.Localization.clResourceManager.getText("Commands.Animate.Usage");
}
private UUID animID;
public override string Execute(string[] args, UUID fromAgentID, bool from_SL)
{
string arg;
StringBuilder result = new StringBuilder();
if (args.Length == 1)
{
arg = args[0].Trim();
if (UUID.TryParse(args[0], out animID))
{
Client.Self.AnimationStart(animID, true);
result.AppendFormat(bot.Localization.clResourceManager.getText("Commands.Animate.Starting"), animID);
}
else if (arg.ToLower().Equals("list"))
{
foreach (string key in m_BuiltInAnimations.Values)
{
result.AppendLine(key);
}
}
else if (arg.ToLower().Equals("show"))
{
Client.Self.SignaledAnimations.ForEach(delegate(KeyValuePair<UUID, int> kvp)
{
if (m_BuiltInAnimations.ContainsKey(kvp.Key))
{
result.AppendFormat(bot.Localization.clResourceManager.getText("Commands.Animate.SystemAnimation"), m_BuiltInAnimations[kvp.Key], kvp.Value);
}
else
{
result.AppendFormat(bot.Localization.clResourceManager.getText("Commands.Animate.AssetAnimation"), kvp.Key, kvp.Value);
}
});
}
else if (args[0].ToLower() == "stop")
{
Client.Self.SignaledAnimations.ForEach(delegate(KeyValuePair<UUID, int> kvp)
{
Client.Self.AnimationStop(kvp.Key, true);
result.AppendFormat(bot.Localization.clResourceManager.getText("Commands.Animate.Stopping"), kvp.Key);
});
}
else if (m_BuiltInAnimations.ContainsValue(args[0].Trim().ToUpper()))
{
foreach (var kvp in m_BuiltInAnimations)
{
if (kvp.Value.Equals(arg.ToUpper()))
{
Client.Self.AnimationStart(kvp.Key, true);
break;
}
}
}
}
else if (args.Length == 2)
{
if (args[0].ToLower() == "stop" && UUID.TryParse(args[1], out animID))
{
Client.Self.AnimationStop(animID, true);
result.AppendFormat(bot.Localization.clResourceManager.getText("Commands.Animate.Stopping"), animID);
}
else if (m_BuiltInAnimations.ContainsValue(args[0].Trim().ToUpper()))
{
foreach (var kvp in m_BuiltInAnimations)
{
if (kvp.Value.Equals(args[1].ToUpper()))
{
Client.Self.AnimationStop(kvp.Key, true);
result.AppendFormat(bot.Localization.clResourceManager.getText("Commands.Animate.Stopping"), kvp.Key);
break;
}
}
}
else
{
return bot.Localization.clResourceManager.getText("Commands.Animate.Usage");
}
}
else
{
return bot.Localization.clResourceManager.getText("Commands.Animate.Usage");
}
return result.ToString();
}
}
}

View File

@@ -0,0 +1,55 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : AppearanceCommand.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;
public class AppearanceCommand : Command
{
public AppearanceCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "appearance";
base.Description = bot.Localization.clResourceManager.getText("Commands.Appearance.Description");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
Client.Appearance.RequestSetAppearance((args.Length > 0 && args[0].Equals("rebake")));
return bot.Localization.clResourceManager.getText("Commands.Appearance.Thread");
}
}
}

View File

@@ -0,0 +1,89 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : AttachCommand.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 AttachCommand : Command
{
private InventoryManager Manager;
private OpenMetaverse.Inventory Inventory;
public AttachCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "attach";
base.Description = bot.Localization.clResourceManager.getText("Commands.Attach.Description") + " " + bot.Localization.clResourceManager.getText("Commands.Attach.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool something_else)
{
if (args.Length != 1)
{
return bot.Localization.clResourceManager.getText("Commands.Attach.Usage");
}
UUID dest;
if (!UUID.TryParse(args[0], out dest))
{
return bot.Localization.clResourceManager.getText("Commands.Attach.ExpectedID");
}
Manager = Client.Inventory;
Inventory = Manager.Store;
string inventoryName = args[0];
// WARNING: Uses local copy of inventory contents, need to download them first.
List<InventoryBase> contents = Inventory.GetContents(Client.CurrentDirectory);
foreach (InventoryBase b in contents)
{
if (inventoryName == b.Name || inventoryName.ToLower() == b.UUID.ToString())
{
if (b is InventoryItem)
{
InventoryItem item = b as InventoryItem;
Client.Appearance.Attach(item, AttachmentPoint.Default);
return String.Format(bot.Localization.clResourceManager.getText("Commands.Attach.Attaching"), item.Name);
}
else
{
return String.Format(bot.Localization.clResourceManager.getText("Commands.Attach.NotFolder"), b.Name);
}
}
}
return String.Format(bot.Localization.clResourceManager.getText("Commands.Attach.NotFound"), inventoryName);
}
}
}

View File

@@ -0,0 +1,89 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : AttachmentsCommand.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 AttachmentsCommand : Command
{
public AttachmentsCommand(SecondLifeBot SecondLifeBot)
{
base.Client = SecondLifeBot;
base.Name = "attachments";
base.Description = bot.Localization.clResourceManager.getText("Commands.Attachments.Description");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
StringBuilder builder = new StringBuilder();
List<Primitive> attachments = Client.Network.CurrentSim.ObjectsPrimitives.FindAll(
delegate(Primitive prim)
{
return prim.ParentID == Client.Self.LocalID;
}
);
for (int i = 0; i < attachments.Count; i++)
{
Primitive prim = attachments[i];
NBAttachmentPoint 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 NBAttachmentPoint StateToAttachmentPoint(uint state)
{
const uint ATTACHMENT_MASK = 0xF0;
uint fixedState = (((byte)state & ATTACHMENT_MASK) >> 4) | (((byte)state & ~ATTACHMENT_MASK) << 4);
return (NBAttachmentPoint)fixedState;
}
}
}

View File

@@ -0,0 +1,80 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : AwayCommand.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 AwayCommand : Command
{
private static readonly UUID AWAYID = new UUID("FD037134-85D4-F241-72C6-4F42164FEDEE");
public AwayCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "away";
base.Description = bot.Localization.clResourceManager.getText("Commands.Away.Description") + " " + bot.Localization.clResourceManager.getText("Commands.Away.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
if (args.Length == 0)
{
if (Client.isAway)
return bot.Localization.clResourceManager.getText("Commands.Away.Afk");
else
return bot.Localization.clResourceManager.getText("Commands.Away.NotAfk");
}
if (args.Length != 1)
return bot.Localization.clResourceManager.getText("Commands.Away.Usage");
if (args[0].ToLower() == "on")
{
Client.isAway = true;
Client.Self.AnimationStart(AWAYID, true);
return bot.Localization.clResourceManager.getText("Commands.Away.WillAfk");
}
else if (args[0].ToLower() == "off")
{
Client.isAway = false;
Client.Self.AnimationStop(AWAYID, true);
return bot.Localization.clResourceManager.getText("Commands.Away.WontAfk");
}
else
{
return bot.Localization.clResourceManager.getText("Commands.Away.Usage");
}
}
}
}

View File

@@ -0,0 +1,67 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : BalanceCommand.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 BalanceCommand : Command
{
public BalanceCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "balance";
base.Description = bot.Localization.clResourceManager.getText("Commands.Balance.Description");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
System.Threading.AutoResetEvent waitBalance = new System.Threading.AutoResetEvent(false);
EventHandler<BalanceEventArgs> del = delegate(object sender, BalanceEventArgs e)
{
waitBalance.Set();
};
Client.Self.MoneyBalance += del;
Client.Self.RequestBalance();
String result = bot.Localization.clResourceManager.getText("Commands.Balance.Timeout");
if (waitBalance.WaitOne(10000, false))
{
result = String.Format(bot.Localization.clResourceManager.getText("Commands.Balance.Balance"), Client.ToString(),
Client.Self.Balance);
}
Client.Self.MoneyBalance -= del;
return result;
}
}
}

View File

@@ -0,0 +1,140 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : BeamCommand.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;
using System.Timers;
public class BeamCommand : Command
{
private Timer b = new Timer();
private bool doBeam;
public BeamCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "beam";
base.Description = bot.Localization.clResourceManager.getText("Commands.Beam.Description") + " " + bot.Localization.clResourceManager.getText("Commands.Beam.Usage");
b.Elapsed += new ElapsedEventHandler(b_Elapsed);
}
void b_Elapsed(object sender, ElapsedEventArgs e)
{
doBeam = false;
b.Enabled = false;
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
UUID targetID = UUID.Zero;
string avatarName = "";
bool isGroupKey = false;
Avatar foundAv = null;
Primitive foundPrim;
Vector3d targetPosition;
doBeam = true;
b.Interval = 5000;
if (args.Length == 1)
{
if (!UUID.TryParse(args[0], out targetID))
return bot.Localization.clResourceManager.getText("Commands.Beam.Usage");
}
else if (args.Length == 2)
{
avatarName = args[0] + " " + args[1];
if (!Client.FindOneAvatar(avatarName, out targetID))
return String.Format(bot.Localization.clResourceManager.getText("Commands.Beam.AvNotFound"), avatarName);
}
else
{
return bot.Localization.clResourceManager.getText("Commands.Beam.Usage");
}
if (targetID != UUID.Zero)
{
Client.key2Name(targetID, out avatarName, out isGroupKey);
if (isGroupKey)
return bot.Localization.clResourceManager.getText("Commands.Beam.CannotGroup");
if (avatarName != "")
{
foundAv = Client.Network.CurrentSim.ObjectsAvatars.Find(
delegate(Avatar avatar)
{
return (avatar.Name == avatarName);
}
);
if (foundAv == null)
return String.Format(bot.Localization.clResourceManager.getText("Commands.Beam.AvNotInSim"), avatarName);
targetPosition = new Vector3d(foundAv.Position);
}
else
{
foundPrim = Client.Network.CurrentSim.ObjectsPrimitives.Find(
delegate(Primitive prim)
{
return prim.ID == targetID;
}
);
if (foundPrim == null)
return String.Format(bot.Localization.clResourceManager.getText("Commands.Beam.ObjNotInSim"), targetID);
targetPosition = new Vector3d(foundPrim.Position);
}
b.Enabled = true;
while (doBeam)
{
Client.Self.BeamEffect(Client.Self.AgentID, targetID, targetPosition, new Color4(0, 0, 0, 255), 5000.0f,
new UUID("aec29773-c421-364e-4f29-e3f633222188"));
}
if (avatarName == "")
return String.Format(bot.Localization.clResourceManager.getText("Commands.Beam.BeamObj"), targetID);
else
return String.Format(bot.Localization.clResourceManager.getText("Commands.Beam.BeamAv"), avatarName);
}
else
{
return bot.Localization.clResourceManager.getText("Commands.Beam.Usage");
}
}
}
}

View File

@@ -0,0 +1,80 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : BusyCommand.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 BusyCommand : Command
{
private static readonly UUID BUSYID = new UUID("EFCF670C-2D18-8128-973A-034EBC806B67");
public BusyCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "busy";
base.Description = bot.Localization.clResourceManager.getText("Commands.Busy.Description") + " " + bot.Localization.clResourceManager.getText("Commands.Busy.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
if (args.Length == 0)
{
if (Client.isBusy)
return bot.Localization.clResourceManager.getText("Commands.Busy.Busy");
else
return bot.Localization.clResourceManager.getText("Commands.Busy.NotBusy");
}
if (args.Length != 1)
return bot.Localization.clResourceManager.getText("Commands.Busy.Usage");
if (args[0].ToLower() == "on")
{
Client.isBusy = true;
Client.Self.AnimationStart(BUSYID, true);
return bot.Localization.clResourceManager.getText("Commands.Busy.WillBusy");
}
else if (args[0].ToLower() == "off")
{
Client.isBusy = false;
Client.Self.AnimationStop(BUSYID, true);
return bot.Localization.clResourceManager.getText("Commands.Busy.WontBusy");
}
else
{
return bot.Localization.clResourceManager.getText("Commands.Busy.Usage");
}
}
}
}

View File

@@ -0,0 +1,76 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : GestureCommand.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
****************************************************************************/
using System;
using OpenMetaverse;
using System.Collections.Generic;
using System.Text;
namespace bot.Core.Commands
{
public class GestureCommand : bot.Commands.Command
{
private Dictionary<UUID, string> m_BuiltInAnimations = new Dictionary<UUID, string>(Animations.ToDictionary());
public GestureCommand(SecondLifeBot SecondLifeBot)
{
Client = SecondLifeBot;
Name = "gesture";
Description = bot.Localization.clResourceManager.getText("Commands.Gesture.Description") + " " + bot.Localization.clResourceManager.getText("Commands.Gesture.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool from_SL)
{
UUID gestureID = UUID.Zero;
if (args.Length == 1)
{
if (UUID.TryParse(args[0], out gestureID))
{
if (gestureID == UUID.Zero)
return bot.Localization.clResourceManager.getText("Commands.Gesture.Usage");
Client.Self.PlayGesture(gestureID);
return String.Format(bot.Localization.clResourceManager.getText("Commands.Gesture.Playing"), gestureID);
}
else
{
return bot.Localization.clResourceManager.getText("Commands.Gesture.Usage");
}
}
else
{
return bot.Localization.clResourceManager.getText("Commands.Gesture.Usage");
}
}
}
}

View File

@@ -0,0 +1,54 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : GroundSitCommand.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 GroundSitCommand : Command
{
public GroundSitCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "gsit";
base.Description = bot.Localization.clResourceManager.getText("Commands.GroundSit.Description");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
Client.Self.SitOnGround();
return bot.Localization.clResourceManager.getText("Commands.GroundSit.Sitting");
}
}
}

View File

@@ -0,0 +1,53 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : HealthComand.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 HealthComand : Command
{
public HealthComand(SecondLifeBot SecondLifeBot)
{
base.Name = "health";
base.Description = bot.Localization.clResourceManager.getText("Commands.Health.Description");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
return String.Format(bot.Localization.clResourceManager.getText("Commands.Health.Health"), Client.Self.Health);
}
}
}

View File

@@ -0,0 +1,54 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : LocationCommand.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 LocationCommand : Command
{
public LocationCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "location";
base.Description = bot.Localization.clResourceManager.getText("Commands.Location.Description");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
return String.Format(bot.Localization.clResourceManager.getText("Commands.Location.Location"), Client.Network.CurrentSim.ToString(),
Client.Self.SimPosition.ToString());
}
}
}

View File

@@ -0,0 +1,122 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : LookAtCommand.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;
using System.Timers;
public class LookAtCommand : Command
{
public LookAtCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "lookat";
base.Description = bot.Localization.clResourceManager.getText("Commands.LookAt.Description") + " " + bot.Localization.clResourceManager.getText("Commands.LookAt.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
UUID targetID = UUID.Zero;
string avatarName = "";
bool isGroupKey = false;
Avatar foundAv = null;
Primitive foundPrim;
Vector3d targetPosition;
if (args.Length == 1)
{
if (!UUID.TryParse(args[0], out targetID))
return bot.Localization.clResourceManager.getText("Commands.LookAt.Usage");
}
else if (args.Length == 2)
{
avatarName = args[0] + " " + args[1];
if (!Client.FindOneAvatar(avatarName, out targetID))
return String.Format(bot.Localization.clResourceManager.getText("Commands.LookAt.AvNotFound"), avatarName);
}
else
{
return bot.Localization.clResourceManager.getText("Commands.LookAt.Usage");
}
if (targetID != UUID.Zero)
{
Client.key2Name(targetID, out avatarName, out isGroupKey);
if (isGroupKey)
return bot.Localization.clResourceManager.getText("Commands.LookAt.CannotGroup");
if (avatarName != "")
{
foundAv = Client.Network.CurrentSim.ObjectsAvatars.Find(
delegate(Avatar avatar)
{
return (avatar.Name == avatarName);
}
);
if (foundAv == null)
return String.Format(bot.Localization.clResourceManager.getText("Commands.LookAt.AvNotInSim"), avatarName);
targetPosition = new Vector3d(foundAv.Position);
}
else
{
foundPrim = Client.Network.CurrentSim.ObjectsPrimitives.Find(
delegate(Primitive prim)
{
return prim.ID == targetID;
}
);
if (foundPrim == null)
return String.Format(bot.Localization.clResourceManager.getText("Commands.LookAt.ObjNotInSim"), targetID);
targetPosition = new Vector3d(foundPrim.Position);
}
Client.Self.LookAtEffect(Client.Self.AgentID, targetID, targetPosition, LookAtType.Focus, UUID.Zero);
if (avatarName == "")
return String.Format(bot.Localization.clResourceManager.getText("Commands.LookAt.LookObj"), targetID);
else
return String.Format(bot.Localization.clResourceManager.getText("Commands.LookAt.LookAv"), avatarName);
}
else
{
return bot.Localization.clResourceManager.getText("Commands.LookAt.Usage");
}
}
}
}

View File

@@ -0,0 +1,80 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : NaduCommand.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 NaduCommand : Command
{
private static readonly UUID NADUID = new UUID("6C83A33E-90E4-A350-91FF-E10209BDEC97");
public NaduCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "nadu";
base.Description = bot.Localization.clResourceManager.getText("Commands.Nadu.Description") + " " + bot.Localization.clResourceManager.getText("Commands.Nadu.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
if (args.Length == 0)
{
if (Client.isNadu)
return bot.Localization.clResourceManager.getText("Commands.Nadu.Nadu");
else
return bot.Localization.clResourceManager.getText("Commands.Nadu.NotNadu");
}
if (args.Length != 1)
return bot.Localization.clResourceManager.getText("Commands.Nadu.Usage");
if (args[0].ToLower() == "on")
{
Client.isNadu = true;
Client.Self.AnimationStart(NADUID, true);
return bot.Localization.clResourceManager.getText("Commands.Nadu.WillNadu");
}
else if (args[0].ToLower() == "off")
{
Client.isNadu = false;
Client.Self.AnimationStop(NADUID, true);
return bot.Localization.clResourceManager.getText("Commands.Nadu.WontNadu");
}
else
{
return bot.Localization.clResourceManager.getText("Commands.Nadu.Usage");
}
}
}
}

View File

@@ -0,0 +1,86 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : PayCommand.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 PayCommand : Command
{
public PayCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "pay";
base.Description = bot.Localization.clResourceManager.getText("Commands.Pay.Description") + " " + bot.Localization.clResourceManager.getText("Commands.Pay.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
int amount;
UUID avatarID;
string avatarName;
if (args.Length == 1)
{
avatarID = Client.MasterKey;
}
else if (args.Length == 2)
{
if (!UUID.TryParse(args[1], out avatarID))
{
return bot.Localization.clResourceManager.getText("Commands.Pay.Usage");
}
}
else
{
return bot.Localization.clResourceManager.getText("Commands.Pay.Usage");
}
if (!Int32.TryParse(args[0], out amount))
if (args[0].ToLower().Equals("all"))
amount = Client.Self.Balance;
else
return bot.Localization.clResourceManager.getText("Commands.Pay.Usage");
if (!Client.key2Name(avatarID, out avatarName))
avatarName = avatarID.ToString();
if (amount > Client.Self.Balance)
amount = Client.Self.Balance;
Client.Self.GiveAvatarMoney(avatarID, amount, String.Format(bot.Localization.clResourceManager.getText("Commands.Pay.Message"), amount));
return String.Format(bot.Localization.clResourceManager.getText("Commands.Pay.Gave"), amount, avatarName);
}
}
}

View File

@@ -0,0 +1,65 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : PickCommand.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 PickCommand : Command
{
public PickCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "pick";
base.Description = bot.Localization.clResourceManager.getText("Commands.Pick.Description") + " " + bot.Localization.clResourceManager.getText("Commands.Pick.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
string description = "";
if (args.Length == 0)
return bot.Localization.clResourceManager.getText("Commands.Pick.Usage");
foreach (string arg in args)
{
description += arg;
description += " ";
}
Client.Self.PickInfoUpdate(UUID.Random(), false, UUID.Zero, bot.Localization.clResourceManager.getText("Commands.Pick.PickName"), Client.Self.GlobalPosition, UUID.Zero, description);
return bot.Localization.clResourceManager.getText("Commands.Pick.Picking");
}
}
}

View File

@@ -0,0 +1,76 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : PlaySoundCommand.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
****************************************************************************/
using System;
using OpenMetaverse;
using System.Collections.Generic;
using System.Text;
namespace bot.Core.Commands
{
public class PlaySoundCommand : bot.Commands.Command
{
private Dictionary<UUID, string> m_BuiltInAnimations = new Dictionary<UUID, string>(Animations.ToDictionary());
public PlaySoundCommand(SecondLifeBot SecondLifeBot)
{
Client = SecondLifeBot;
Name = "playsound";
Description = bot.Localization.clResourceManager.getText("Commands.PlaySound.Description") + " " + bot.Localization.clResourceManager.getText("Commands.PlaySound.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool from_SL)
{
UUID soundID = UUID.Zero;
if (args.Length == 1)
{
if (UUID.TryParse(args[0], out soundID))
{
if (soundID == UUID.Zero)
return bot.Localization.clResourceManager.getText("Commands.PlaySound.Usage");
Client.Sound.PlaySound(soundID);
return String.Format(bot.Localization.clResourceManager.getText("Commands.PlaySound.Playing"), soundID);
}
else
{
return bot.Localization.clResourceManager.getText("Commands.PlaySound.Usage");
}
}
else
{
return bot.Localization.clResourceManager.getText("Commands.PlaySound.Usage");
}
}
}
}

View File

@@ -0,0 +1,54 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : SetHomeCommand.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 SetHomeCommand : Command
{
public SetHomeCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "sethome";
base.Description = bot.Localization.clResourceManager.getText("Commands.SetHome.Description");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
Client.Self.SetHome();
return bot.Localization.clResourceManager.getText("Commands.SetHome.Set");
}
}
}

View File

@@ -0,0 +1,90 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : WearCommand.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;
public class WearCommand : Command
{
public WearCommand(SecondLifeBot SecondLifeBot)
{
base.Client = SecondLifeBot;
base.Name = "wear";
base.Description = bot.Localization.clResourceManager.getText("Commands.Wear.Description") + " " + bot.Localization.clResourceManager.getText("Commands.Wear.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
if (args.Length < 1)
return bot.Localization.clResourceManager.getText("Commands.Wear.Usage");
string target = String.Empty;
bool bake = true;
for (int ct = 0; ct < args.Length; ct++)
{
target += args[ct] + " ";
}
target = target.TrimEnd();
UUID folder = Client.Inventory.FindObjectByPath(Client.Inventory.Store.RootFolder.UUID, Client.Self.AgentID, target, 20 * 1000);
if (folder == UUID.Zero)
{
return "Outfit path " + target + " not found";
}
List<InventoryBase> contents = Client.Inventory.FolderContents(folder, Client.Self.AgentID, true, true, InventorySortOrder.ByName, 20 * 1000);
List<InventoryItem> items = new List<InventoryItem>();
if (contents == null)
{
return "Failed to get contents of " + target;
}
foreach (InventoryBase item in contents)
{
if (item is InventoryItem)
items.Add((InventoryItem)item);
}
Client.Appearance.ReplaceOutfit(items);
return "Starting to change outfit to " + target;
}
}
}