From 01f394d2037be62a3d74e2d28ab9e5644f86a9a2 Mon Sep 17 00:00:00 2001
From: Adam Frisby
Date: Fri, 21 Aug 2009 11:14:55 +1000
Subject: * Fleshes more of NPCModule out. * Implements some OSSL commands:
key osNpcCreate(string user, string name, vector position, key
cloneFrom); void osNpcMoveTo(key npc, vector position); void
osNpcSay(key npc, string message); void osNpcRemove(key npc); *
Untested. Requires ThreatLevel.High.
---
OpenSim/Region/CoreModules/Avatar/NPC/INPCModule.cs | 13 +++++++++++++
1 file changed, 13 insertions(+)
create mode 100644 OpenSim/Region/CoreModules/Avatar/NPC/INPCModule.cs
(limited to 'OpenSim/Region/CoreModules')
diff --git a/OpenSim/Region/CoreModules/Avatar/NPC/INPCModule.cs b/OpenSim/Region/CoreModules/Avatar/NPC/INPCModule.cs
new file mode 100644
index 0000000..7d5c310
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Avatar/NPC/INPCModule.cs
@@ -0,0 +1,13 @@
+using OpenMetaverse;
+using OpenSim.Region.Framework.Scenes;
+
+namespace OpenSim.Region.CoreModules.Avatar.NPC
+{
+ public interface INPCModule
+ {
+ UUID CreateNPC(string firstname, string lastname, Vector3 position, Scene scene, UUID cloneAppearanceFrom);
+ void Autopilot(UUID agentID, Scene scene, Vector3 pos);
+ void Say(UUID agentID, Scene scene, string text);
+ void DeleteNPC(UUID agentID, Scene scene);
+ }
+}
\ No newline at end of file
--
cgit v1.1
From 158ad39df0de1c569d24d4ea28dc3952402df101 Mon Sep 17 00:00:00 2001
From: Jeff Ames
Date: Fri, 21 Aug 2009 15:42:36 +0900
Subject: Add copyright header. Formatting cleanup.
---
.../Region/CoreModules/Avatar/NPC/INPCModule.cs | 29 +++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/CoreModules')
diff --git a/OpenSim/Region/CoreModules/Avatar/NPC/INPCModule.cs b/OpenSim/Region/CoreModules/Avatar/NPC/INPCModule.cs
index 7d5c310..cd2fe4f 100644
--- a/OpenSim/Region/CoreModules/Avatar/NPC/INPCModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/NPC/INPCModule.cs
@@ -1,4 +1,31 @@
-using OpenMetaverse;
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using OpenMetaverse;
using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.CoreModules.Avatar.NPC
--
cgit v1.1
From 7923fd29a019eae168b6793ed6e388bc27bc288e Mon Sep 17 00:00:00 2001
From: Arthur Valadares
Date: Fri, 21 Aug 2009 21:12:22 -0300
Subject: Adds osDrawPolygon to OSSL. Works a little different then other OS
Drawing functions, this one has no start and end point, but a number of
points that will form the desired polygon. Only FilledPolygon implemented so
far. * Also added some LSL transparent type conversion, as it's done in LSL
scripting (string to integer, float to string, etc)
---
.../Scripting/VectorRender/VectorRenderModule.cs | 48 +++++++++++++++++-----
1 file changed, 37 insertions(+), 11 deletions(-)
(limited to 'OpenSim/Region/CoreModules')
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
index 2640f08..d7f39b0 100644
--- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
@@ -469,13 +469,19 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
startPoint.X += endPoint.X;
startPoint.Y += endPoint.Y;
}
+ else if (nextLine.StartsWith("FillPolygon"))
+ {
+ PointF[] points = null;
+ GetParams(partsDelimiter, ref nextLine, 11, ref points);
+ graph.FillPolygon(myBrush, points);
+ }
else if (nextLine.StartsWith("Ellipse"))
{
float x = 0;
float y = 0;
GetParams(partsDelimiter, ref nextLine, 7, ref x, ref y);
- endPoint.X = (int) x;
- endPoint.Y = (int) y;
+ endPoint.X = (int)x;
+ endPoint.Y = (int)y;
graph.DrawEllipse(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y);
startPoint.X += endPoint.X;
startPoint.Y += endPoint.Y;
@@ -492,30 +498,31 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
nextLine = nextLine.Remove(0, 8);
nextLine = nextLine.Trim();
- string [] fprops = nextLine.Split(partsDelimiter);
- foreach (string prop in fprops) {
-
+ string[] fprops = nextLine.Split(partsDelimiter);
+ foreach (string prop in fprops)
+ {
+
switch (prop)
{
case "B":
if (!(myFont.Bold))
myFont = new Font(myFont, myFont.Style | FontStyle.Bold);
- break;
+ break;
case "I":
if (!(myFont.Italic))
myFont = new Font(myFont, myFont.Style | FontStyle.Italic);
- break;
+ break;
case "U":
if (!(myFont.Underline))
myFont = new Font(myFont, myFont.Style | FontStyle.Underline);
- break;
+ break;
case "S":
if (!(myFont.Strikeout))
myFont = new Font(myFont, myFont.Style | FontStyle.Strikeout);
- break;
+ break;
case "R":
myFont = new Font(myFont, FontStyle.Regular);
- break;
+ break;
}
}
}
@@ -542,7 +549,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
if (Int32.TryParse(nextLine, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex))
{
newColour = Color.FromArgb(hex);
- }
+ }
else
{
// this doesn't fail, it just returns black if nothing is found
@@ -582,6 +589,25 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
}
}
+ private static void GetParams(char[] partsDelimiter, ref string line, int startLength, ref PointF[] points)
+ {
+ line = line.Remove(0, startLength);
+ string[] parts = line.Split(partsDelimiter);
+ if (parts.Length > 1 && parts.Length % 2 == 0)
+ {
+ points = new PointF[parts.Length / 2];
+ for (int i = 0; i < parts.Length; i = i + 2)
+ {
+ string xVal = parts[i].Trim();
+ string yVal = parts[i+1].Trim();
+ float x = Convert.ToSingle(xVal, CultureInfo.InvariantCulture);
+ float y = Convert.ToSingle(yVal, CultureInfo.InvariantCulture);
+ PointF point = new PointF(x, y);
+ points[i / 2] = point;
+ }
+ }
+ }
+
private Bitmap ImageHttpRequest(string url)
{
WebRequest request = HttpWebRequest.Create(url);
--
cgit v1.1
From b03eeeb9f6331ed36c61f55aef847ce3b2db7ba4 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Sat, 22 Aug 2009 10:24:26 -0700
Subject: * Fixes mantis http://opensimulator.org/mantis/view.php?id=4044.
Turns out folders were never being removed from trash when they were singled
out for purging in trash. They were being removed when Trash was purged as a
whole. That behavior is now fixed for the new InventoryService set. * Removed
left-overs from AssetInventoryServer.
---
.../Inventory/BaseInventoryConnector.cs | 5 +++++
.../ServiceConnectorsOut/Inventory/HGInventoryBroker.cs | 17 +++++++++++++++++
.../Inventory/LocalInventoryServiceConnector.cs | 5 +++++
.../Inventory/RemoteInventoryServiceConnector.cs | 12 ++++++++++++
4 files changed, 39 insertions(+)
(limited to 'OpenSim/Region/CoreModules')
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
index d4cb616..bd32f3b 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
@@ -139,6 +139,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
public abstract bool MoveFolder(InventoryFolderBase folder);
///
+ /// Delete a list of inventory folders (from trash)
+ ///
+ public abstract bool DeleteFolders(UUID ownerID, List folderIDs);
+
+ ///
/// Purge an inventory folder of all its items and subfolders.
///
///
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index 787c6c8..1c66254 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -330,6 +330,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
}
}
+ public override bool DeleteFolders(UUID ownerID, List folderIDs)
+ {
+ if (folderIDs == null)
+ return false;
+ if (folderIDs.Count == 0)
+ return false;
+
+ if (IsLocalGridUser(ownerID))
+ return m_GridService.DeleteFolders(ownerID, folderIDs);
+ else
+ {
+ UUID sessionID = GetSessionID(ownerID);
+ string uri = GetUserInventoryURI(ownerID) + "/" + ownerID.ToString();
+ return m_HGService.DeleteFolders(uri, folderIDs, sessionID);
+ }
+ }
+
public override bool MoveFolder(InventoryFolderBase folder)
{
if (folder == null)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
index e6edcf2..66d11dd 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
@@ -258,6 +258,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_InventoryService.MoveFolder(folder);
}
+ public override bool DeleteFolders(UUID ownerID, List folderIDs)
+ {
+ return m_InventoryService.DeleteFolders(ownerID, folderIDs);
+ }
+
///
/// Purge an inventory folder of all its items and subfolders.
///
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
index 201442c..0d32c77 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
@@ -243,6 +243,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_RemoteConnector.MoveFolder(folder.Owner.ToString(), folder, sessionID);
}
+ public override bool DeleteFolders(UUID ownerID, List folderIDs)
+ {
+ if (folderIDs == null)
+ return false;
+ if (folderIDs.Count == 0)
+ return false;
+
+ UUID sessionID = GetSessionID(ownerID);
+ return m_RemoteConnector.DeleteFolders(ownerID.ToString(), folderIDs, sessionID);
+ }
+
+
public override bool PurgeFolder(InventoryFolderBase folder)
{
if (folder == null)
--
cgit v1.1
From efb287f28f89eee06c6b90ad13297a2d33058409 Mon Sep 17 00:00:00 2001
From: Arthur Valadares
Date: Tue, 25 Aug 2009 10:32:45 -0300
Subject: Implemented osPenCap, that sets EndCap and StartCap to Pen. This
allows using arrow, diamond, round and flat caps.
* Made image request safer, if it can't find an image for any reason, draws a square where the image should be and a message alerting the user.
---
.../Scripting/VectorRender/VectorRenderModule.cs | 77 ++++++++++++++++++++--
1 file changed, 70 insertions(+), 7 deletions(-)
(limited to 'OpenSim/Region/CoreModules')
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
index d7f39b0..e577fbe 100644
--- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
@@ -443,7 +443,16 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
endPoint.X = (int) x;
endPoint.Y = (int) y;
Image image = ImageHttpRequest(nextLine);
- graph.DrawImage(image, (float) startPoint.X, (float) startPoint.Y, x, y);
+ if (image != null)
+ {
+ graph.DrawImage(image, (float)startPoint.X, (float)startPoint.Y, x, y);
+ }
+ else
+ {
+ graph.DrawString("URL couldn't be resolved or is", new Font("Arial",6), myBrush, startPoint);
+ graph.DrawString("not an image. Please check URL.", new Font("Arial", 6), myBrush, new Point(startPoint.X, 12 + startPoint.Y));
+ graph.DrawRectangle(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y);
+ }
startPoint.X += endPoint.X;
startPoint.Y += endPoint.Y;
}
@@ -539,6 +548,57 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
float size = Convert.ToSingle(nextLine, CultureInfo.InvariantCulture);
drawPen.Width = size;
}
+ else if (nextLine.StartsWith("PenCap"))
+ {
+ bool start = true, end = true;
+ nextLine = nextLine.Remove(0, 6);
+ nextLine = nextLine.Trim();
+ string[] cap = nextLine.Split(partsDelimiter);
+ if (cap[0].ToLower() == "start")
+ end = false;
+ else if (cap[0].ToLower() == "end")
+ start = false;
+ else if (cap[0].ToLower() != "both")
+ return;
+ string type = cap[1].ToLower();
+
+ if (end)
+ {
+ switch (type)
+ {
+ case "arrow":
+ drawPen.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
+ break;
+ case "round":
+ drawPen.EndCap = System.Drawing.Drawing2D.LineCap.RoundAnchor;
+ break;
+ case "diamond":
+ drawPen.EndCap = System.Drawing.Drawing2D.LineCap.DiamondAnchor;
+ break;
+ case "flat":
+ drawPen.EndCap = System.Drawing.Drawing2D.LineCap.Flat;
+ break;
+ }
+ }
+ if (start)
+ {
+ switch (type)
+ {
+ case "arrow":
+ drawPen.StartCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
+ break;
+ case "round":
+ drawPen.StartCap = System.Drawing.Drawing2D.LineCap.RoundAnchor;
+ break;
+ case "diamond":
+ drawPen.StartCap = System.Drawing.Drawing2D.LineCap.DiamondAnchor;
+ break;
+ case "flat":
+ drawPen.StartCap = System.Drawing.Drawing2D.LineCap.Flat;
+ break;
+ }
+ }
+ }
else if (nextLine.StartsWith("PenColour"))
{
nextLine = nextLine.Remove(0, 9);
@@ -610,16 +670,19 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
private Bitmap ImageHttpRequest(string url)
{
+ try
+ {
WebRequest request = HttpWebRequest.Create(url);
//Ckrinke: Comment out for now as 'str' is unused. Bring it back into play later when it is used.
//Ckrinke Stream str = null;
- HttpWebResponse response = (HttpWebResponse) (request).GetResponse();
- if (response.StatusCode == HttpStatusCode.OK)
- {
- Bitmap image = new Bitmap(response.GetResponseStream());
- return image;
+ HttpWebResponse response = (HttpWebResponse)(request).GetResponse();
+ if (response.StatusCode == HttpStatusCode.OK)
+ {
+ Bitmap image = new Bitmap(response.GetResponseStream());
+ return image;
+ }
}
-
+ catch { }
return null;
}
}
--
cgit v1.1