use script engine osGetNotecard

master
Christopher 2020-07-10 18:06:44 +02:00
parent 2a6dd4ccdc
commit 1e3e2394b1
2 changed files with 11 additions and 19 deletions

View File

@ -28,6 +28,9 @@
<Reference name="OpenSim.Server.Base" path="../../../bin"/> <Reference name="OpenSim.Server.Base" path="../../../bin"/>
<Reference name="OpenSim.Data" path="../../../bin"/> <Reference name="OpenSim.Data" path="../../../bin"/>
<Reference name="MySql.Data" path="../../../bin"/> <Reference name="MySql.Data" path="../../../bin"/>
<Reference name="OpenSim.Region.ScriptEngine" path="../../../bin"/>
<Reference name="OpenSim.Region.ScriptEngine.Shared" path="../../../bin"/>
<Reference name="OpenSim.Region.ScriptEngine.Shared.Api" path="../../../bin"/>
<Files> <Files>
<Match pattern="*.cs" recurse="true"/> <Match pattern="*.cs" recurse="true"/>
</Files> </Files>

View File

@ -7,6 +7,9 @@ using OpenSim.Framework;
using OpenSim.Modules.Appearance2Avatar.helper; using OpenSim.Modules.Appearance2Avatar.helper;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.ScriptEngine.Interfaces;
using OpenSim.Region.ScriptEngine.Shared.Api;
using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -68,25 +71,12 @@ namespace OpenSim.Modules.Appearance2Avatar
} }
protected string LoadNotecard(UUID assetID) protected string LoadNotecard(SceneObjectPart host, String notecardname)
{ {
if (assetID != UUID.Zero) IScriptEngine wComm = m_scene.RequestModuleInterface<IScriptEngine>();
{
StringBuilder notecardData = new StringBuilder();
for (int count = 0; count < NotecardCache.GetLines(assetID); count++) IOSSL_Api _api = (IOSSL_Api)wComm.GetApi(host.UUID, "LSL");
{ return _api.osGetNotecard(notecardname);
string line = NotecardCache.GetLine(assetID, count) + "\n";
// m_log.DebugFormat("[OSSL]: From notecard {0} loading line {1}", notecardNameOrUuid, line);
notecardData.Append(line);
}
return notecardData.ToString();
}
return null;
} }
[ScriptInvocation] [ScriptInvocation]
@ -105,13 +95,12 @@ namespace OpenSim.Modules.Appearance2Avatar
{ {
if (notecardItem.Type != 7) if (notecardItem.Type != 7)
{ {
m_log.Error("[" + Name + "] ERROR: Given item is not a notecard");
throw new Exception("Given item is not a notecard."); throw new Exception("Given item is not a notecard.");
return; return;
} }
m_log.Info("[" + Name + "] Info: Fetch asset data for notecard."); m_log.Info("[" + Name + "] Info: Fetch asset data for notecard.");
String asset = LoadNotecard(notecardItem.AssetID); String asset = LoadNotecard(_host, notecard);
if (asset != null) if (asset != null)
{ {