add support for multiple attachments

This commit is contained in:
Madpeter 2023-12-03 22:03:40 +00:00
parent 49b0f10a8a
commit 3cb9b794a5
4 changed files with 1498 additions and 1493 deletions

View file

@ -2155,6 +2155,10 @@ namespace OpenMetaverse
break; break;
} }
} }
GetFolderWearables(COF.UUID, out List<InventoryWearable> wearables, out List<InventoryItem> attachments);
Client.Appearance.AddAttachments(attachments, false, false);
return COF; return COF;
} }
@ -2396,40 +2400,29 @@ namespace OpenMetaverse
{ {
wearables = new List<InventoryWearable>(); wearables = new List<InventoryWearable>();
attachments = new List<InventoryItem>(); attachments = new List<InventoryItem>();
var objects = Client.Inventory.FolderContents(folder, Client.Self.AgentID, false, true, KeyValuePair<string, List<InventoryBase>> reply = Client.Inventory.FolderContentsWithReply(folder, Client.Self.AgentID, true, true, InventorySortOrder.ByName, INVENTORY_TIMEOUT, false);
InventorySortOrder.ByName, INVENTORY_TIMEOUT); foreach(InventoryBase entry in reply.Value)
if (objects != null)
{ {
foreach (var ib in objects) if(entry is InventoryWearable wearable)
{ {
if (ib is InventoryWearable wearable) Logger.DebugLog("Adding wearable " + wearable.Name, Client);
{ wearables.Add(wearable);
Logger.DebugLog("Adding wearable " + wearable.Name, Client); }
wearables.Add(wearable); else if (entry is InventoryAttachment attachment)
} {
else if (ib is InventoryAttachment attachment) Logger.DebugLog("Adding attachment (attachment) " + attachment.Name, Client);
{ attachments.Add(attachment);
Logger.DebugLog("Adding attachment (attachment) " + attachment.Name, Client); }
attachments.Add(attachment); else if (entry is InventoryObject inventoryObject)
} {
else if (ib is InventoryObject inventoryObject) Logger.DebugLog("Adding attachment (object) " + inventoryObject.Name, Client);
{ attachments.Add(inventoryObject);
Logger.DebugLog("Adding attachment (object) " + inventoryObject.Name, Client); }
attachments.Add(inventoryObject); else
} {
else Logger.DebugLog("Ignoring inventory item " + entry.Name, Client);
{
Logger.DebugLog("Ignoring inventory item " + ib.Name, Client);
}
} }
} }
else
{
Logger.Log("Failed to download folder contents of + " + folder, Helpers.LogLevel.Error, Client);
return false;
}
return true; return true;
} }

File diff suppressed because it is too large Load diff

View file

@ -76676,6 +76676,7 @@ namespace OpenMetaverse.Packets
public byte[] MediaURL; public byte[] MediaURL;
public byte[] PSBlock; public byte[] PSBlock;
public byte[] ExtraParams; public byte[] ExtraParams;
public string A_TextDecoded;
public UUID Sound; public UUID Sound;
public UUID OwnerID; public UUID OwnerID;
public float Gain; public float Gain;
@ -76760,6 +76761,11 @@ namespace OpenMetaverse.Packets
length = bytes[i++]; length = bytes[i++];
Text = new byte[length]; Text = new byte[length];
Buffer.BlockCopy(bytes, i, Text, 0, length); i += length; Buffer.BlockCopy(bytes, i, Text, 0, length); i += length;
A_TextDecoded = "";
if (Text.Length > 0)
{
A_TextDecoded = Utils.BytesToString(Text);
}
TextColor = new byte[4]; TextColor = new byte[4];
Buffer.BlockCopy(bytes, i, TextColor, 0, 4); i += 4; Buffer.BlockCopy(bytes, i, TextColor, 0, 4); i += 4;
length = bytes[i++]; length = bytes[i++];

View file

@ -836,32 +836,39 @@ namespace SecondBotEvents.Services
{ {
return; return;
} }
ITextChannel statusChannel = GetChannel("status", StatusPrefill(), "bot"); try
if ((e.changed == false) && (LastStatusMessageId != 0))
{ {
ITextChannel statusChannel = GetChannel("status", StatusPrefill(), "bot");
if ((e.changed == false) && (LastStatusMessageId != 0))
{
if (dif < 15)
{
return;
}
LastUpdatedSystemStatus = SecondbotHelpers.UnixTimeNow();
if (messageHasEndDot == false)
{
await statusChannel.
ModifyMessageAsync(LastStatusMessageId, m => m.Content = LastMessageContent + ".");
messageHasEndDot = true;
return;
}
await statusChannel.
ModifyMessageAsync(LastStatusMessageId, m => m.Content = LastMessageContent);
messageHasEndDot = false;
return;
}
if (dif < 15) if (dif < 15)
{ {
return; return;
} }
LastUpdatedSystemStatus = SecondbotHelpers.UnixTimeNow(); LastStatusMessageId = SendMessageToChannel(statusChannel, e.message);
if (messageHasEndDot == false) LastMessageContent = e.message;
{
await statusChannel.
ModifyMessageAsync(LastStatusMessageId, m => m.Content = LastMessageContent + ".");
messageHasEndDot = true;
return;
}
await statusChannel.
ModifyMessageAsync(LastStatusMessageId, m => m.Content = LastMessageContent);
messageHasEndDot = false;
return;
} }
if (dif < 15) catch
{ {
return; return;
} }
LastStatusMessageId = SendMessageToChannel(statusChannel, e.message);
LastMessageContent = e.message;
} }
protected async void CleanChannel(ITextChannel channel) protected async void CleanChannel(ITextChannel channel)