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.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>
<Match pattern="*.cs" recurse="true"/>
</Files>

View File

@ -7,6 +7,9 @@ using OpenSim.Framework;
using OpenSim.Modules.Appearance2Avatar.helper;
using OpenSim.Region.Framework.Interfaces;
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.Collections.Generic;
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)
{
StringBuilder notecardData = new StringBuilder();
IScriptEngine wComm = m_scene.RequestModuleInterface<IScriptEngine>();
for (int count = 0; count < NotecardCache.GetLines(assetID); count++)
{
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;
IOSSL_Api _api = (IOSSL_Api)wComm.GetApi(host.UUID, "LSL");
return _api.osGetNotecard(notecardname);
}
[ScriptInvocation]
@ -105,13 +95,12 @@ namespace OpenSim.Modules.Appearance2Avatar
{
if (notecardItem.Type != 7)
{
m_log.Error("[" + Name + "] ERROR: Given item is not a notecard");
throw new Exception("Given item is not a notecard.");
return;
}
m_log.Info("[" + Name + "] Info: Fetch asset data for notecard.");
String asset = LoadNotecard(notecardItem.AssetID);
String asset = LoadNotecard(_host, notecard);
if (asset != null)
{